From fd7a9253383ac2c705b6494adf573fd8623a8a9c Mon Sep 17 00:00:00 2001 From: Gamosoft Date: Mon, 9 Feb 2026 18:17:12 +0100 Subject: [PATCH] set focus on new note when creating --- frontend/app.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/frontend/app.js b/frontend/app.js index 78f51d9..24e4c26 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -1272,6 +1272,7 @@ function noteApp() { // Reload notes and open the new note await this.loadNotes(); await this.loadNote(data.path); + this.focusEditorForNewNote(); } catch (error) { ErrorHandler.handle('create note from template', error); @@ -3073,6 +3074,20 @@ function noteApp() { // UNIFIED CREATION FUNCTIONS (reusable from anywhere) // ===================================================== + // Switch to split view (if in preview-only mode) and focus editor for new notes + focusEditorForNewNote() { + // Only switch if in preview-only mode - don't disturb edit or split mode + if (this.viewMode === 'preview') { + this.viewMode = 'split'; + this.saveViewMode(); + } + // Focus the editor after a short delay to ensure DOM is updated + this.$nextTick(() => { + const editor = document.getElementById('note-editor'); + if (editor) editor.focus(); + }); + }, + async createNote(folderPath = null, directPath = null) { let notePath; @@ -3138,6 +3153,7 @@ function noteApp() { if (folderPart) this.expandedFolders.add(folderPart); await this.loadNotes(); await this.loadNote(notePath); + this.focusEditorForNewNote(); } else { ErrorHandler.handle('create note', new Error('Server returned error')); }