mirror of
https://github.com/zotero/zotero.git
synced 2026-10-03 02:21:49 +00:00
Merge 76493762b3 into e863643a43
This commit is contained in:
commit
dae4d0306d
2 changed files with 47 additions and 9 deletions
|
|
@ -377,6 +377,11 @@ var Zotero_LocateMenu = new function () {
|
|||
function ViewItem(alternateWindowBehavior) {
|
||||
this._viewItemType = "mixed";
|
||||
this._numItems = 0;
|
||||
let _getOpenInNewWindow = function (viewItemType) {
|
||||
return Zotero.Prefs.get(
|
||||
viewItemType === "note" ? "openNoteInNewWindow" : "openReaderInNewWindow"
|
||||
);
|
||||
};
|
||||
Object.defineProperty(this, "className", {
|
||||
get() {
|
||||
switch (this._viewItemType) {
|
||||
|
|
@ -407,7 +412,7 @@ var Zotero_LocateMenu = new function () {
|
|||
openIn = "external";
|
||||
}
|
||||
else {
|
||||
let openInNewWindow = Zotero.Prefs.get("openReaderInNewWindow");
|
||||
let openInNewWindow = _getOpenInNewWindow(this._viewItemType);
|
||||
if (alternateWindowBehavior) {
|
||||
openInNewWindow = !openInNewWindow;
|
||||
}
|
||||
|
|
@ -432,8 +437,12 @@ var Zotero_LocateMenu = new function () {
|
|||
&& alternateWindowBehavior) {
|
||||
return false;
|
||||
}
|
||||
if ((locateMode === "tab" && !alternateWindowBehavior)
|
||||
|| (locateMode === "window" && alternateWindowBehavior)) {
|
||||
let openInWindow = _getOpenInNewWindow(usableItem.isNote() ? "note" : usableItem.attachmentReaderType);
|
||||
if (alternateWindowBehavior) {
|
||||
openInWindow = !openInWindow;
|
||||
}
|
||||
if ((locateMode === "tab" && !openInWindow)
|
||||
|| (locateMode === "window" && openInWindow)) {
|
||||
// Don't show option if it would open in the same type of the current context
|
||||
return false;
|
||||
}
|
||||
|
|
@ -473,10 +482,23 @@ var Zotero_LocateMenu = new function () {
|
|||
if (usableItem) usableItems.push(usableItem);
|
||||
}
|
||||
|
||||
let forceOpenInWindow;
|
||||
if (this._viewItemType !== "mixed" && Zotero.Prefs.get(`fileHandler.${this._viewItemType}`)) {
|
||||
// Use external handler; keep forceOpenInWindow undefined
|
||||
}
|
||||
else {
|
||||
let openInNewWindow = _getOpenInNewWindow(this._viewItemType);
|
||||
if (alternateWindowBehavior) {
|
||||
openInNewWindow = !openInNewWindow;
|
||||
}
|
||||
forceOpenInWindow = openInNewWindow;
|
||||
}
|
||||
|
||||
ZoteroPane.viewItems(usableItems, event,
|
||||
{
|
||||
noLocateOnMissing: false,
|
||||
forceAlternateWindowBehavior: alternateWindowBehavior
|
||||
forceAlternateWindowBehavior: alternateWindowBehavior,
|
||||
forceOpenInWindow,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5622,7 +5622,17 @@ var ZoteroPane = new function () {
|
|||
if (!this.collectionsView.editable) {
|
||||
continue;
|
||||
}
|
||||
let openInWindow = event?.shiftKey || options.forceAlternateWindowBehavior;
|
||||
let openInWindow;
|
||||
if (typeof options.forceOpenInWindow === 'boolean') {
|
||||
openInWindow = options.forceOpenInWindow;
|
||||
}
|
||||
else {
|
||||
openInWindow = Zotero.Prefs.get('openNoteInNewWindow');
|
||||
let useAlternateWindowBehavior = event?.shiftKey || options.forceAlternateWindowBehavior;
|
||||
if (useAlternateWindowBehavior) {
|
||||
openInWindow = !openInWindow;
|
||||
}
|
||||
}
|
||||
ZoteroPane.openNote(item.id, { openInWindow });
|
||||
}
|
||||
else if (item.isAttachment()) {
|
||||
|
|
@ -5668,10 +5678,16 @@ var ZoteroPane = new function () {
|
|||
await item.saveTx();
|
||||
}
|
||||
|
||||
let openInWindow = Zotero.Prefs.get('openReaderInNewWindow');
|
||||
let useAlternateWindowBehavior = event?.shiftKey || extraData?.forceAlternateWindowBehavior;
|
||||
if (useAlternateWindowBehavior) {
|
||||
openInWindow = !openInWindow;
|
||||
let openInWindow;
|
||||
if (typeof extraData?.forceOpenInWindow === 'boolean') {
|
||||
openInWindow = extraData.forceOpenInWindow;
|
||||
}
|
||||
else {
|
||||
openInWindow = Zotero.Prefs.get('openReaderInNewWindow');
|
||||
let useAlternateWindowBehavior = event?.shiftKey || extraData?.forceAlternateWindowBehavior;
|
||||
if (useAlternateWindowBehavior) {
|
||||
openInWindow = !openInWindow;
|
||||
}
|
||||
}
|
||||
await Zotero.FileHandlers.open(item, {
|
||||
location: extraData?.location,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue