commit 7e39e460858561a62c4637e772c298dd3e24b675 parent 084f5a72df24912820724e8fe46b39b837deb554 Author: Dan Stillman <dstillman@zotero.org> Date: Wed, 21 Dec 2016 06:13:21 -0500 Focus note editor when pressing Tab is pressed on note in middle pane Closes #1136 Diffstat:
| M | chrome/content/zotero/xpcom/itemTreeView.js | | | 15 | ++++++++++++++- |
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js @@ -128,6 +128,19 @@ Zotero.ItemTreeView.prototype.setTree = Zotero.Promise.coroutine(function* (tree return; } + // Focus note editor when Tab is pressed on a selected note + if (event.keyCode == event.DOM_VK_TAB) { + let items = this.getSelectedItems(); + if (items.length == 1 && items[0].isNote()) { + let noteEditor = this._ownerDocument.getElementById('zotero-note-editor'); + if (noteEditor) { + noteEditor.focus(); + event.preventDefault(); + } + } + return; + } + // Handle arrow keys specially on multiple selection, since // otherwise the tree just applies it to the last-selected row if (event.keyCode == 39 || event.keyCode == 37) { @@ -220,7 +233,7 @@ Zotero.ItemTreeView.prototype.setTree = Zotero.Promise.coroutine(function* (tree .catch(function (e) { Zotero.logError(e); }) - }; + }.bind(this); // Store listener so we can call removeEventListener() in ItemTreeView.unregister() this.listener = listener; tree.addEventListener('keypress', listener);