Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
after creating new note, it is focused and now also selected so renaming is super easy, #318
azivnerdffdb822881d
diff --git a/src/public/javascripts/services/frontend_script_api.js b/src/public/javascripts/services/frontend_script_api.jsindex 95e3e1a6f0..1f89e1dac6 100644--- a/src/public/javascripts/services/frontend_script_api.js+++ b/src/public/javascripts/services/frontend_script_api.js@@ -43,7 +43,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null) {this.activateNewNote = async notePath => {await treeService.reload();- await treeService.activateNote(notePath, noteDetailService.focusOnTitle);+ await treeService.activateNote(notePath, noteDetailService.focusAndSelectTitle);};/**diff --git a/src/public/javascripts/services/note_detail.js b/src/public/javascripts/services/note_detail.jsindex 1556dec7c1..3f5de42cb2 100644--- a/src/public/javascripts/services/note_detail.js+++ b/src/public/javascripts/services/note_detail.js@@ -283,6 +283,10 @@ function focusOnTitle() {$noteTitle.focus();}+function focusAndSelectTitle() {+ $noteTitle.focus().select();+}+/*** Since detail loading may take some time and user might just browse through the notes using UP-DOWN keys,* we intentionally decouple activation of the note in the tree and full load of the note so just avaiting on@@ -342,6 +346,7 @@ export default {getCurrentNoteType,getCurrentNoteId,focusOnTitle,+ focusAndSelectTitle,saveNote,saveNoteIfChanged,noteChanged,diff --git a/src/public/javascripts/services/tree.js b/src/public/javascripts/services/tree.jsindex 9dec9dc8a2..480f6a1828 100644--- a/src/public/javascripts/services/tree.js+++ b/src/public/javascripts/services/tree.js@@ -588,7 +588,7 @@ async function createNote(node, parentNoteId, target, isProtected, saveSelectionawait noteDetailService.saveNoteIfChanged();- noteDetailService.addDetailLoadedListener(note.noteId, noteDetailService.focusOnTitle);+ noteDetailService.addDetailLoadedListener(note.noteId, noteDetailService.focusAndSelectTitle);const noteEntity = new NoteShort(treeCache, note);const branchEntity = new Branch(treeCache, branch);