Skip to content

Commit

Permalink
Fix new button on homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
Yureien committed Jun 9, 2023
1 parent 7a9eaa9 commit cc9cbbc
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@
}
if (e.key === 'n' && (e.ctrlKey || e.metaKey)) {
e.preventDefault();
content = '';
config = { ...initialConfig };
sessionStorage.removeItem('contentBackup');
newPaste(e);
}
if (e.key === 'i' && (e.ctrlKey || e.metaKey)) {
Expand All @@ -64,6 +61,14 @@
});
});
const newPaste = (e: any) => {
e?.preventDefault();
content = '';
password = '';
config = { ...initialConfig };
sessionStorage.removeItem('contentBackup');
};
const save = async () => {
if (!content) return;
Expand Down Expand Up @@ -160,7 +165,7 @@
<button
class="underline underline-offset-4 py-1"
title="{cmdKey}+N"
on:click={() => goto('/')}
on:click={newPaste}
>
New
</button>
Expand Down

0 comments on commit cc9cbbc

Please sign in to comment.