Skip to content

Commit

Permalink
no unsaved change fix
Browse files Browse the repository at this point in the history
  • Loading branch information
briangregoryholmes committed Dec 19, 2024
1 parent 3d68872 commit 4d7673a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions web-common/src/features/editor/Editor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@
}
}
async function save() {
async function save(force = false) {
const local = $editorContent;
if (local === null) return;
onSave(local);
await saveLocalContent();
await saveLocalContent(force);
}
function revertContent() {
Expand All @@ -77,7 +77,7 @@
<DiffBar
saving={$saving}
errorMessage={$error?.message}
onAcceptCurrent={save}
onAcceptCurrent={() => save(true)}
onAcceptIncoming={revertContent}
/>
{/if}
Expand Down
5 changes: 3 additions & 2 deletions web-common/src/features/entity-management/file-artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,10 @@ export class FileArtifact {
this.editorCallback(newContent);
};

saveLocalContent = async () => {
saveLocalContent = async (force = false) => {
const saveEnabled = get(this.saveEnabled);
if (!saveEnabled) return;

if (!saveEnabled && !force) return;
await this.saveContent(get(this.editorContent) ?? "");
};

Expand Down

0 comments on commit 4d7673a

Please sign in to comment.