Fix "this.selection is undefined" switching away from loading collection
This commit is contained in:
parent
7c3a134107
commit
bb4db297c4
1 changed files with 5 additions and 6 deletions
|
@ -1319,11 +1319,15 @@ var ZoteroPane = new function()
|
|||
});
|
||||
yield deferred.promise;
|
||||
|
||||
var selectedItems = this.itemsView.getSelectedItems();
|
||||
if (!this.itemsView || !this.itemsView.selection) {
|
||||
Zotero.debug("Items view not available in itemSelected", 2);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if selection has actually changed. The onselect event that calls this
|
||||
// can be called in various situations where the selection didn't actually change,
|
||||
// such as whenever selectEventsSuppressed is set to false.
|
||||
var selectedItems = this.itemsView.getSelectedItems();
|
||||
var ids = selectedItems.map(item => item.id);
|
||||
ids.sort();
|
||||
if (ids.length && Zotero.Utilities.arrayEquals(_lastSelectedItems, ids)) {
|
||||
|
@ -1331,11 +1335,6 @@ var ZoteroPane = new function()
|
|||
}
|
||||
_lastSelectedItems = ids;
|
||||
|
||||
if (!this.itemsView) {
|
||||
Zotero.debug("Items view not available in itemSelected", 2);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Display restore/delete buttons depending on context
|
||||
if (this.itemsView.selection.count) {
|
||||
document.getElementById('zotero-item-pane-top-buttons-trash').hidden
|
||||
|
|
Loading…
Reference in a new issue