Always capture up/down when QuickFormat reference panel is open

It was annoying if you pressed the up key too many times and the cursor
moved.
This commit is contained in:
Simon Kornblith 2015-08-13 19:48:23 -04:00
parent 21e51f771c
commit f3daf6b4bc

View file

@ -1084,7 +1084,7 @@ var Zotero_QuickFormat = new function () {
selection.addRange(nodeRange);
}
} else if(keyCode === event.DOM_VK_UP) {
} else if(keyCode === event.DOM_VK_UP && referencePanel.state === "open") {
var selectedItem = referenceBox.selectedItem;
var previousSibling;
@ -1104,9 +1104,9 @@ var Zotero_QuickFormat = new function () {
visibleItem = visibleItem.previousSibling;
}
referenceBox.ensureElementIsVisible(visibleItem);
event.preventDefault();
};
} else if(keyCode === event.DOM_VK_DOWN) {
event.preventDefault();
} else if(keyCode === event.DOM_VK_DOWN && referencePanel.state === "open") {
if((Zotero.isMac ? event.metaKey : event.ctrlKey)) {
// If meta key is held down, show the citation properties panel
var bubble = _getSelectedBubble();
@ -1126,8 +1126,8 @@ var Zotero_QuickFormat = new function () {
if(nextSibling){
referenceBox.selectedItem = nextSibling;
referenceBox.ensureElementIsVisible(nextSibling);
event.preventDefault();
};
event.preventDefault();
}
} else {
_resetSearchTimer();