diff --git a/src/App.svelte b/src/App.svelte index 5d812ea6..a6a5f55d 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -90,7 +90,7 @@ const apiUrl = window.location.origin; - const currentVersion = 20240226; + const currentVersion = 20240227; const tutorialHash = "fFjTsnFoSQMLwcvteVoNtL"; const termsVersion = 20240110; @@ -554,16 +554,24 @@ loadBlankSheet(); } break; - case "s": - case "S": + case "l": + case "L": if (!event[$modifierKey] || modalInfo.modalOpen) { return; - } else if (event.shiftKey) { + } else { modalInfo = { state: "uploadSheet", modalOpen: true, heading: "Save as Sharable Link" }; + } + break; + case "s": + case "S": + if (!event[$modifierKey] || modalInfo.modalOpen) { + return; + } else if (event.shiftKey) { + saveSheetToFile(true); } else { saveSheetToFile(); } @@ -1515,7 +1523,7 @@ Please include a link to this sheet in the email to assist in debugging the prob // Save using a download anchor element // Will be saved to users downloads folder - async function saveSheetToFile() { + async function saveSheetToFile(saveAs = false) { $history = [{ url: $title, hash: 'file', @@ -1536,7 +1544,7 @@ Please include a link to this sheet in the email to assist in debugging the prob // use current file handle if user has already saved this sheet const currentFileHandle = getFileHandleFromKey(window.history.state?.fileKey); - if (currentFileHandle && window.history.state?.fileKey === currentFileHandle.name + $title + $sheetId) { + if (!saveAs && currentFileHandle && window.history.state?.fileKey === currentFileHandle.name + $title + $sheetId) { modalInfo = {state: "saving", modalOpen: true, heading: "Saving File"}; try { const writable = await currentFileHandle.createWritable(); @@ -2679,7 +2687,7 @@ Please include a link to this sheet in the email to assist in debugging the prob {:else if modalInfo.state === "downloadDocument"} saveSheetToFile(e.detail.saveAs)} on:downloadDocument={(e) => getDocument(e.detail.docType, e.detail.getShareableLink)} /> {:else} diff --git a/src/DownloadDocumentModal.svelte b/src/DownloadDocumentModal.svelte index 4e7750ff..6027a41c 100644 --- a/src/DownloadDocumentModal.svelte +++ b/src/DownloadDocumentModal.svelte @@ -6,16 +6,17 @@ const dispatch = createEventDispatcher<{ downloadDocument: {docType: "docx" | "pdf" | "md" | "tex", getShareableLink: boolean}; - downloadSheet: null; + downloadSheet: {saveAs: boolean}; }>(); let docType: "epxyz" | "docx" | "pdf" | "md" | "tex" = "epxyz"; let getShareableLink = false; + let saveAs = false; async function handleSave() { open = false; if (docType === "epxyz") { - dispatch("downloadSheet"); + dispatch("downloadSheet", {saveAs: saveAs}); } else { dispatch("downloadDocument", {docType: docType, getShareableLink: getShareableLink}); } @@ -52,12 +53,22 @@ required={true} bind:selected={docType} > - + + {#if window.showSaveFilePicker} +
+
Save As
+ +
+ {/if}
Shareable Link
{modifier} + Shift + S + Save current sheet to local file with a new filename instead of replacing existing file + + + {modifier} + L Save current sheet to database to get a shareable link diff --git a/src/Updates.svelte b/src/Updates.svelte index 86881841..08ae8e68 100644 --- a/src/Updates.svelte +++ b/src/Updates.svelte @@ -16,6 +16,20 @@ } +February 27, 2024 +

Save As Shortcut Added and Shareable Link Shortcut Changed

+

+ When using Chrome, or a Chrome based browser such as Edge, hitting {modifier}-S + will automatically re-save the file using the same name, if it has already been + saved. The {modifier}-Shift-S keyboard shortcut can now be used to perform a Save As + operation to allow you to choose a different file name. Additionally, the Save Document + menu now includes a Save As checkbox to serve the same purpose. The {modifier}-Shift-S + keyboard shortcut was previously used to save your document as a shareable link. The + {modifier}-L keyboard shortcut can now be used the create a shareable link. +

+ +
+ February 26, 2024

File Saving Improvements