Skip to content

Commit

Permalink
Dismiss modal on save
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Jan 8, 2024
1 parent f838b9c commit f70c95d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/common/dialog/RevisionsDialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@
{/if}

{#if isPremiumOrg(user?.organization)}
<form>
<form
on:submit={(event) => {
event.preventDefault();
}}
>
<label class="revision-control-input">
<input
type="checkbox"
Expand All @@ -99,11 +103,7 @@
{$_("dialogRevisionsDialog.controlLabel")}
</label>
<div class="buttons">
<Button
on:click={(event) => {
event.preventDefault();
onSave(enabled);
}}>{$_("dialog.save")}</Button
<Button on:click={() => onSave(enabled)}>{$_("dialog.save")}</Button
>
<Button secondary={true} on:click={onCancel}>
{$_("dialog.cancel")}
Expand Down
8 changes: 6 additions & 2 deletions src/common/dialog/RevisionsDialogContainer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@
const documentId = document?.id;
const revisions = document?.revisions;
const enabled = document?.revisionControl;
const onSave = (enabled: boolean) =>
const onSave = (enabled: boolean) => {
changeRevisionControl([documentId], enabled);
const onCancel = () => emit.dismiss();
emit.dismiss();
};
const onCancel = () => {
emit.dismiss();
};
</script>

<RevisionsDialog {documentId} {revisions} {enabled} {onSave} {onCancel} />

0 comments on commit f70c95d

Please sign in to comment.