Skip to content

Commit

Permalink
fix: require a filename for save as dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
rmoesbergen committed May 9, 2024
1 parent eb8789f commit a178c73
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib/components/core/header/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ async function saveProjectAs() {
name: "SAVEAS",
placeholder: "GIVE_FILENAME",
confirm: "SAVE",
requireValue: true,
},
allowInteraction: false,
});
Expand Down
10 changes: 9 additions & 1 deletion src/lib/components/core/popups/popups/Prompt.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,23 @@ interface Props {
placeholder: string;
confirm: string;
value?: string;
requireValue: boolean;
}
let { name, placeholder, confirm, value = $bindable("") }: Props = $props();
let {
name,
placeholder,
confirm,
value = $bindable(""),
requireValue = false,
}: Props = $props();
const popupState = getContext<Writable<PopupState>>("state");
function cancel() {
popups.close($popupState.id, false);
}
function save() {
if (requireValue && !value) return;
popups.close($popupState.id, value);
}
Expand Down

0 comments on commit a178c73

Please sign in to comment.