Fix switching into tab mode
This commit is contained in:
parent
092a0b5560
commit
64e7738bd3
|
@ -287,8 +287,8 @@ var ZoteroOverlay = new function()
|
||||||
*/
|
*/
|
||||||
this.toggleTab = function(setMode) {
|
this.toggleTab = function(setMode) {
|
||||||
var tab = this.findZoteroTab();
|
var tab = this.findZoteroTab();
|
||||||
|
window.zoteroSavedCollectionSelection = ZoteroPane.collectionsView.selectedTreeRow.id;
|
||||||
window.zoteroSavedItemSelection = ZoteroPane.itemsView.saveSelection();
|
window.zoteroSavedItemSelection = ZoteroPane.itemsView.saveSelection();
|
||||||
window.zoteroSavedCollectionSelection = ZoteroPane.collectionsView.saveSelection();
|
|
||||||
if(tab) { // Zotero is running in a tab
|
if(tab) { // Zotero is running in a tab
|
||||||
if(setMode) return;
|
if(setMode) return;
|
||||||
// if Zotero tab is the only tab, open the home page in a new tab
|
// 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);
|
Zotero.Notifier.unregisterObserver(this._unregisterID);
|
||||||
if (this.listener) {
|
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;
|
let tree = this._treebox.treeBody.parentNode;
|
||||||
tree.removeEventListener('keypress', this.listener, false);
|
tree.removeEventListener('keypress', this.listener, false);
|
||||||
this.listener = null;
|
this.listener = null;
|
||||||
|
|
|
@ -377,20 +377,18 @@ var ZoteroPane = new function()
|
||||||
// restore saved row selection (for tab switching)
|
// restore saved row selection (for tab switching)
|
||||||
var containerWindow = (window.ZoteroTab ? window.ZoteroTab.containerWindow : window);
|
var containerWindow = (window.ZoteroTab ? window.ZoteroTab.containerWindow : window);
|
||||||
if(containerWindow.zoteroSavedCollectionSelection) {
|
if(containerWindow.zoteroSavedCollectionSelection) {
|
||||||
yield this.collectionsView.rememberSelection(containerWindow.zoteroSavedCollectionSelection);
|
this.collectionsView.addEventListener('load', Zotero.Promise.coroutine(function* () {
|
||||||
delete containerWindow.zoteroSavedCollectionSelection;
|
yield this.collectionsView.selectByID(containerWindow.zoteroSavedCollectionSelection);
|
||||||
|
|
||||||
|
if (containerWindow.zoteroSavedItemSelection) {
|
||||||
|
this.itemsView.addEventListener('load', function () {
|
||||||
|
this.itemsView.rememberSelection(containerWindow.zoteroSavedItemSelection);
|
||||||
|
delete containerWindow.zoteroSavedItemSelection;
|
||||||
|
}.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore saved item selection (for tab switching)
|
delete containerWindow.zoteroSavedCollectionSelection;
|
||||||
if(containerWindow.zoteroSavedItemSelection) {
|
}.bind(this)));
|
||||||
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;
|
|
||||||
}
|
|
||||||
}, 51);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Focus the quicksearch on pane open
|
// Focus the quicksearch on pane open
|
||||||
|
|
Loading…
Reference in New Issue
Block a user