mirror of
https://github.com/zotero/zotero.git
synced 2026-10-03 02:21:49 +00:00
Do not switch to library tab while changing target collection in connector (#5020)
Do not switch to library tab while changing target
collection in connector.
Deprecate inLibraryRoot as an independent boolean
param in ZoteroPane.selectItems to instead have
a composite options param { inLibraryRoot, noTabSwitch }
Fixes: #4262
This commit is contained in:
parent
cef26fae09
commit
060a15fe78
4 changed files with 15 additions and 7 deletions
|
|
@ -183,7 +183,7 @@ var ZoteroAdvancedSearch = new function() {
|
|||
return;
|
||||
}
|
||||
|
||||
lastWin.ZoteroPane.selectItems(items.map(item => item.id), false);
|
||||
lastWin.ZoteroPane.selectItems(items.map(item => item.id));
|
||||
lastWin.focus();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ async function _handleActivate(event, indices) {
|
|||
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
if (win) {
|
||||
win.ZoteroPane.selectItem(itemID, false, true);
|
||||
win.ZoteroPane.selectItem(itemID);
|
||||
win.focus();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ Zotero.Server.Connector.SaveSession.prototype.update = async function (targetID,
|
|||
item = item.isTopLevelItem() ? item : item.parentItem;
|
||||
// Don't select if in trash
|
||||
if (!item.deleted) {
|
||||
await zp.selectItem(item.id);
|
||||
await zp.selectItem(item.id, { noTabSwitch: true });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2985,15 +2985,20 @@ var ZoteroPane = new function()
|
|||
};
|
||||
|
||||
|
||||
this.selectItem = async function (itemID, inLibraryRoot) {
|
||||
this.selectItem = async function (itemID, options) {
|
||||
if (!itemID) {
|
||||
return false;
|
||||
}
|
||||
return this.selectItems([itemID], inLibraryRoot);
|
||||
return this.selectItems([itemID], options);
|
||||
};
|
||||
|
||||
|
||||
this.selectItems = async function (itemIDs, inLibraryRoot) {
|
||||
this.selectItems = async function (itemIDs, options = {}) {
|
||||
if (typeof options == "boolean") {
|
||||
Zotero.warn("ZoteroPane.selectItems() now takes an 'options' object -- update your code");
|
||||
options = { inLibraryRoot: options };
|
||||
}
|
||||
let { inLibraryRoot, noTabSwitch } = options;
|
||||
if (!itemIDs.length) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -3019,7 +3024,10 @@ var ZoteroPane = new function()
|
|||
document.getElementById(ZoteroPane.itemsView.id).focus();
|
||||
}
|
||||
|
||||
Zotero_Tabs.select('zotero-pane', false, { focusElementID: ZoteroPane.itemsView.id });
|
||||
if (!noTabSwitch) {
|
||||
Zotero_Tabs.select('zotero-pane', false, { focusElementID: ZoteroPane.itemsView.id });
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue