From 9d80f56d817c696117eee453a93e8a422342dd54 Mon Sep 17 00:00:00 2001 From: azivner Date: Wed, 23 Aug 2017 18:47:37 -0400 Subject: [PATCH] double click can be also used to choose from recent notes --- static/js/init.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/static/js/init.js b/static/js/init.js index 928ec8629..ffc90ec43 100644 --- a/static/js/init.js +++ b/static/js/init.js @@ -42,15 +42,23 @@ $(document).bind('keypress', 'alt+q', function() { }); }); +function setActiveNoteBasedOnRecentNotes() { + let noteId = $("#recentNotesSelectBox option:selected").val(); + + $("#tree").fancytree('getNodeByKey', noteId).setActive(); + + $("#recentNotesDialog").dialog('close'); +} + $('#recentNotesSelectBox').keydown(function(e) { let key = e.which; if (key === 13)// the enter key code { - let noteId = $("#recentNotesSelectBox option:selected").val(); - - $("#tree").fancytree('getNodeByKey', noteId).setActive(); - - $("#recentNotesDialog").dialog('close'); + setActiveNoteBasedOnRecentNotes(); } +}); + +$('#recentNotesSelectBox').dblclick(function(e) { + setActiveNoteBasedOnRecentNotes(); }); \ No newline at end of file