From a3e4a08281fa30e5af320529f6170a9dd6c442f6 Mon Sep 17 00:00:00 2001 From: Anders Holck Date: Fri, 22 May 2026 20:05:21 +0200 Subject: [PATCH] Allow saving without file open (Save as... prompt) --- frontend/src/App.vue | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 6ac3817..2e625bf 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -58,8 +58,8 @@ - @@ -308,7 +308,21 @@ async function openFile(path) { } async function saveFile() { - if (!currentFile.value) return + if (!currentFile.value) { + // No file open — prompt to create one + const name = prompt('Save as (e.g. notes.md):') + if (!name) return + let path = name + if (!path.endsWith('.md') && !path.endsWith('.txt')) { + path += '.md' + } + await api('/api/files/create', { path, content: content.value }) + currentFile.value = path + isDirty.value = false + await loadFiles() + setTimeout(checkGitStatus, 1000) + return + } await api('/api/files/write', { path: currentFile.value, content: content.value }) isDirty.value = false setTimeout(checkGitStatus, 1000)