Focus note editor when pressing Tab is pressed on note in middle pane
Closes #1136
This commit is contained in:
parent
084f5a72df
commit
7e39e46085
1 changed files with 14 additions and 1 deletions
|
@ -128,6 +128,19 @@ Zotero.ItemTreeView.prototype.setTree = Zotero.Promise.coroutine(function* (tree
|
||||||
return;
|
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
|
// Handle arrow keys specially on multiple selection, since
|
||||||
// otherwise the tree just applies it to the last-selected row
|
// otherwise the tree just applies it to the last-selected row
|
||||||
if (event.keyCode == 39 || event.keyCode == 37) {
|
if (event.keyCode == 39 || event.keyCode == 37) {
|
||||||
|
@ -220,7 +233,7 @@ Zotero.ItemTreeView.prototype.setTree = Zotero.Promise.coroutine(function* (tree
|
||||||
.catch(function (e) {
|
.catch(function (e) {
|
||||||
Zotero.logError(e);
|
Zotero.logError(e);
|
||||||
})
|
})
|
||||||
};
|
}.bind(this);
|
||||||
// Store listener so we can call removeEventListener() in ItemTreeView.unregister()
|
// Store listener so we can call removeEventListener() in ItemTreeView.unregister()
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
tree.addEventListener('keypress', listener);
|
tree.addEventListener('keypress', listener);
|
||||||
|
|
Loading…
Add table
Reference in a new issue