Save scroll position across non-selected changes for collections view
This commit is contained in:
parent
9345452601
commit
16a58c03be
1 changed files with 8 additions and 0 deletions
|
@ -364,6 +364,12 @@ Zotero.CollectionTreeView.prototype.notify = Zotero.Promise.coroutine(function*
|
|||
var currentTreeRow = this.getRow(this.selection.currentIndex);
|
||||
this.selection.selectEventsSuppressed = true;
|
||||
|
||||
// If there's not at least one new collection to be selected, get a scroll position to restore later
|
||||
var scrollPosition = false;
|
||||
if (action != 'add' || ids.every(id => extraData[id] && extraData[id].skipSelect)) {
|
||||
scrollPosition = this._saveScrollPosition();
|
||||
}
|
||||
|
||||
if (action == 'delete') {
|
||||
var selectedIndex = this.selection.count ? this.selection.currentIndex : 0;
|
||||
|
||||
|
@ -513,6 +519,8 @@ Zotero.CollectionTreeView.prototype.notify = Zotero.Promise.coroutine(function*
|
|||
}
|
||||
}
|
||||
|
||||
this._rememberScrollPosition(scrollPosition);
|
||||
|
||||
var deferred = Zotero.Promise.defer();
|
||||
this.addEventListener('select', () => deferred.resolve());
|
||||
this.selection.selectEventsSuppressed = false;
|
||||
|
|
Loading…
Reference in a new issue