From 53aa563cdb8ed0ef16fe9ee70073b090ce473565 Mon Sep 17 00:00:00 2001 From: azivner Date: Tue, 13 Jun 2017 22:36:56 -0400 Subject: [PATCH] focus and select title name for immediate change after creating new note --- static/js/note.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/static/js/note.js b/static/js/note.js index 9f5f15f39..8a37792d5 100644 --- a/static/js/note.js +++ b/static/js/note.js @@ -74,6 +74,8 @@ function createNewTopLevelNote() { createNote(rootNode, "root", "into"); } +let newNoteCreated = false; + function createNote(node, parentKey, target) { let newNoteName = "new note"; @@ -93,6 +95,8 @@ function createNote(node, parentKey, target) { "note_id": result.note_id }; + newNoteCreated = true; + if (target == 'after') { node.appendSibling(newNode).setActive(true); } @@ -114,6 +118,12 @@ function loadNote(noteId) { $("#noteTitle").val(note.detail.note_title); + if (newNoteCreated) { + newNoteCreated = false; + + $("#noteTitle").focus().select(); + } + let noteText = notecase2html(note); noteChangeDisabled = true;