Skip to content

Commit

Permalink
Fix import/export caching
Browse files Browse the repository at this point in the history
  • Loading branch information
cabalex committed Jan 26, 2025
1 parent 14f8f61 commit fdddf7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/TextEditor/SectionEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
}}
>
<IconPlus />
Add Line
Add line
</button>
</main>

Expand Down
7 changes: 6 additions & 1 deletion src/TextEditor/SideBarText.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,13 @@
}
json[key] = new Map(Object.entries(value as { [key: string]: [string, string] }));
}
const oldSection = section;
section = null;
// wait for the section to save before overwriting
await new Promise((r) => setTimeout(r, 500));
$textCache = { strings: json };
importSuccess = true;
section = oldSection;
setTimeout(() => (importSuccess = false), 1000);
};
input.click();
Expand Down Expand Up @@ -129,7 +134,7 @@
<IconDownload />
Export Text as JSON
</button>
<button on:click={importText} style="color: var(--danger)">
<button on:click={importText} style={importSuccess ? "" : "color: var(--danger)"}>
{#if importSuccess}
<IconCheck />
Import successful!
Expand Down

0 comments on commit fdddf7a

Please sign in to comment.