From 7dcd80bd812f706d2790b6ec024c9d43009ab1b1 Mon Sep 17 00:00:00 2001 From: azivner Date: Sun, 24 Dec 2017 14:01:20 -0500 Subject: [PATCH] fix for not working keyboard navigation after context menu (de)activation by handling this with hotkeys plugin --- public/javascripts/note_tree.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/public/javascripts/note_tree.js b/public/javascripts/note_tree.js index bb0e32805..c47a19ef7 100644 --- a/public/javascripts/note_tree.js +++ b/public/javascripts/note_tree.js @@ -432,11 +432,27 @@ const noteTree = (function() { }, "f2": node => { editTreePrefix.showDialog(node); + }, + // code below shouldn't be necessary normally, however there's some problem with interaction with context menu plugin + // after opening context menu, standard shortcuts don't work, but they are detected here + // so we essentially takeover the standard handling with our implementation. + "left": node => { + node.navigate($.ui.keyCode.LEFT, true); + }, + "right": node => { + node.navigate($.ui.keyCode.RIGHT, true); + }, + "up": node => { + node.navigate($.ui.keyCode.UP, true); + }, + "down": node => { + node.navigate($.ui.keyCode.DOWN, true); } }; treeEl.fancytree({ autoScroll: true, + keyboard: false, // we takover keyboard handling in the hotkeys plugin extensions: ["hotkeys", "filter", "dnd", "clones"], source: noteTree, scrollParent: $("#tree"),