From 124b811493279bcdb7304aadb2d2be1988c63c53 Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Mon, 16 Dec 2024 22:10:18 -0500 Subject: [PATCH] If working on a saved or opened file, use its filename as default for Save As --- src/main.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index 0af0461..8201e9d 100644 --- a/src/main.js +++ b/src/main.js @@ -2314,7 +2314,8 @@ async function save() { } } -async function saveAs() { +async function saveAs() { + const filename = filePath ? await basename(filePath) : "untitled.beam" const path = await saveFileDialog({ filters: [ { @@ -2322,7 +2323,7 @@ async function saveAs() { extensions: ['beam'], }, ], - defaultPath: await join(await documentDir(), "untitled.beam") + defaultPath: await join(await documentDir(), filename) }); if (path != undefined) _save(path); } @@ -2364,6 +2365,7 @@ async function open() { undoStack.push(action) } lastSaveIndex = undoStack.length - 1; + filePath = path updateUI() } else { await messageDialog(`File ${path} was created in a newer version of Lightningbeam and cannot be opened in this version.`, { title: 'File version mismatch', kind: 'error' });