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 @@ HTML MD - - {{ isDirty ? 'Save*' : 'Saved' }} + + {{ !currentFile && content ? 'Save as...' : isDirty ? 'Save*' : 'Saved' }} @@ -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)