Fix highlighted collection not unhighlighting

This commit is contained in:
Adomas Venčkauskas 2020-06-16 12:26:20 +03:00 committed by Dan Stillman
parent 2f72ed17b7
commit 1e75425698

View file

@ -78,6 +78,7 @@ var ZoteroPane = new function()
// Set key down handler
document.getElementById('appcontent').addEventListener('keydown', ZoteroPane_Local.handleKeyDown, true);
document.addEventListener('blur', ZoteroPane.handleBlur);
// Init toolbar buttons for all progress queues
let progressQueueButtons = document.getElementById('zotero-pq-buttons');
@ -636,9 +637,17 @@ var ZoteroPane = new function()
}
}
this.handleBlur = (event) => {
if (this.highlightTimer) {
this.highlightTimer.cancel();
this.highlightTimer = null;
}
ZoteroPane_Local.collectionsView.setHighlightedRows();
}
function handleKeyUp(event) {
var from = event.originalTarget.id;
if (from == 'zotero-items-tree') {
if (ZoteroPane.itemsView && from == ZoteroPane.itemsView.id) {
if ((Zotero.isWin && event.keyCode == 17) ||
(!Zotero.isWin && event.keyCode == 18)) {
if (this.highlightTimer) {
@ -686,7 +695,7 @@ var ZoteroPane = new function()
return;
}
if (from == this.itemsView.id) {
if (this.itemsView && from == this.itemsView.id) {
// Focus TinyMCE explicitly on tab key, since the normal focusing doesn't work right
if (!event.shiftKey && event.keyCode == event.DOM_VK_TAB) {
var deck = document.getElementById('zotero-item-pane-content');