preserve collection when switching between pane and tab
This commit is contained in:
parent
7da0313a8b
commit
87bf3f21e4
|
@ -302,7 +302,8 @@ var ZoteroOverlay = new function()
|
|||
*/
|
||||
this.toggleTab = function(setMode) {
|
||||
var tab = this.findZoteroTab();
|
||||
window.zoteroSavedSelection = ZoteroPane.itemsView.saveSelection();
|
||||
window.zoteroSavedItemSelection = ZoteroPane.itemsView.saveSelection();
|
||||
window.zoteroSavedCollectionSelection = ZoteroPane.collectionsView.saveSelection();
|
||||
if(tab) { // Zotero is running in a tab
|
||||
if(setMode) return;
|
||||
// don't do anything if Zotero tab is the only tab
|
||||
|
|
|
@ -347,21 +347,28 @@ var ZoteroPane = new function()
|
|||
return false;
|
||||
}
|
||||
|
||||
this.unserializePersist();
|
||||
this.updateTagSelectorSize();
|
||||
|
||||
// restore saved row selection (for tab switching)
|
||||
var containerWindow = (window.ZoteroTab ? window.ZoteroTab.containerWindow : window);
|
||||
if(containerWindow.zoteroSavedSelection) {
|
||||
if(containerWindow.zoteroSavedCollectionSelection) {
|
||||
this.collectionsView.rememberSelection(containerWindow.zoteroSavedCollectionSelection);
|
||||
delete containerWindow.zoteroSavedCollectionSelection;
|
||||
}
|
||||
|
||||
// restore saved item selection (for tab switching)
|
||||
if(containerWindow.zoteroSavedItemSelection) {
|
||||
var me = this;
|
||||
// hack to restore saved selection after itemTreeView finishes loading
|
||||
window.setTimeout(function() {
|
||||
if(containerWindow.zoteroSavedSelection) {
|
||||
me.itemsView.rememberSelection(containerWindow.zoteroSavedSelection)
|
||||
delete containerWindow.zoteroSavedSelection;
|
||||
if(containerWindow.zoteroSavedItemSelection) {
|
||||
me.itemsView.rememberSelection(containerWindow.zoteroSavedItemSelection);
|
||||
delete containerWindow.zoteroSavedItemSelection;
|
||||
}
|
||||
}, 51);
|
||||
}
|
||||
|
||||
this.updateTagSelectorSize();
|
||||
this.unserializePersist();
|
||||
|
||||
// Focus the quicksearch on pane open
|
||||
setTimeout("document.getElementById('zotero-tb-search').inputField.select();", 1);
|
||||
|
|
Loading…
Reference in New Issue
Block a user