Virtual whiteboard for sketching hand-drawn like diagrams
feat: show toast when saving to existing file (#2988)
David Luzar9c51ba6067b4
diff --git a/src/actions/actionExport.tsx b/src/actions/actionExport.tsxindex e341d98fc7..b24c5e3ddc 100644--- a/src/actions/actionExport.tsx+++ b/src/actions/actionExport.tsx@@ -96,9 +96,24 @@ export const actionChangeShouldAddWatermark = register({export const actionSaveScene = register({name: "saveScene",perform: async (elements, appState, value) => {+ const fileHandleExists = !!appState.fileHandle;try {const { fileHandle } = await saveAsJSON(elements, appState);- return { commitToHistory: false, appState: { ...appState, fileHandle } };+ return {+ commitToHistory: false,+ appState: {+ ...appState,+ fileHandle,+ toastMessage: fileHandleExists+ ? fileHandle.name+ ? t("toast.fileSavedToFilename").replace(+ "{filename}",+ `"${fileHandle.name}"`,+ )+ : t("toast.fileSaved")+ : null,+ },+ };} catch (error) {if (error?.name !== "AbortError") {console.error(error);diff --git a/src/locales/en.json b/src/locales/en.jsonindex 0a7949af64..e69a2a5fc8 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -243,6 +243,8 @@"toast": {"copyStyles": "Copied styles.","copyToClipboard": "Copied to clipboard.",- "copyToClipboardAsPng": "Copied to clipboard as PNG."+ "copyToClipboardAsPng": "Copied to clipboard as PNG.",+ "fileSaved": "File saved.",+ "fileSavedToFilename": "Saved to {filename}"}}