Fix switching into tab mode
This commit is contained in:
parent
092a0b5560
commit
64e7738bd3
3 changed files with 17 additions and 14 deletions
|
@ -287,8 +287,8 @@ var ZoteroOverlay = new function()
|
|||
*/
|
||||
this.toggleTab = function(setMode) {
|
||||
var tab = this.findZoteroTab();
|
||||
window.zoteroSavedCollectionSelection = ZoteroPane.collectionsView.selectedTreeRow.id;
|
||||
window.zoteroSavedItemSelection = ZoteroPane.itemsView.saveSelection();
|
||||
window.zoteroSavedCollectionSelection = ZoteroPane.collectionsView.saveSelection();
|
||||
if(tab) { // Zotero is running in a tab
|
||||
if(setMode) return;
|
||||
// if Zotero tab is the only tab, open the home page in a new tab
|
||||
|
|
|
@ -923,6 +923,11 @@ Zotero.ItemTreeView.prototype.unregister = function()
|
|||
{
|
||||
Zotero.Notifier.unregisterObserver(this._unregisterID);
|
||||
if (this.listener) {
|
||||
if (!this._treebox.treeBody) {
|
||||
Zotero.debug("No more tree body in Zotero.ItemTreeView::unregister()");
|
||||
this.listener = null;
|
||||
return;
|
||||
}
|
||||
let tree = this._treebox.treeBody.parentNode;
|
||||
tree.removeEventListener('keypress', this.listener, false);
|
||||
this.listener = null;
|
||||
|
|
|
@ -377,20 +377,18 @@ var ZoteroPane = new function()
|
|||
// restore saved row selection (for tab switching)
|
||||
var containerWindow = (window.ZoteroTab ? window.ZoteroTab.containerWindow : window);
|
||||
if(containerWindow.zoteroSavedCollectionSelection) {
|
||||
yield this.collectionsView.rememberSelection(containerWindow.zoteroSavedCollectionSelection);
|
||||
delete containerWindow.zoteroSavedCollectionSelection;
|
||||
}
|
||||
this.collectionsView.addEventListener('load', Zotero.Promise.coroutine(function* () {
|
||||
yield this.collectionsView.selectByID(containerWindow.zoteroSavedCollectionSelection);
|
||||
|
||||
// restore saved item selection (for tab switching)
|
||||
if(containerWindow.zoteroSavedItemSelection) {
|
||||
let self = this;
|
||||
// hack to restore saved selection after itemTreeView finishes loading
|
||||
window.setTimeout(function() {
|
||||
if(containerWindow.zoteroSavedItemSelection) {
|
||||
yield self.itemsView.rememberSelection(containerWindow.zoteroSavedItemSelection);
|
||||
delete containerWindow.zoteroSavedItemSelection;
|
||||
if (containerWindow.zoteroSavedItemSelection) {
|
||||
this.itemsView.addEventListener('load', function () {
|
||||
this.itemsView.rememberSelection(containerWindow.zoteroSavedItemSelection);
|
||||
delete containerWindow.zoteroSavedItemSelection;
|
||||
}.bind(this));
|
||||
}
|
||||
}, 51);
|
||||
|
||||
delete containerWindow.zoteroSavedCollectionSelection;
|
||||
}.bind(this)));
|
||||
}
|
||||
|
||||
// Focus the quicksearch on pane open
|
||||
|
|
Loading…
Add table
Reference in a new issue