From 87f7a6a7bd3e613e7019168d95a207cf0b259626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Thu, 27 Jun 2024 10:09:23 +0300 Subject: [PATCH] Integration: Don't activate document after clicking Manage Styles in Doc Prefs Closes #4290 --- chrome/content/zotero/bibliography.js | 1 + chrome/content/zotero/xpcom/integration.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/bibliography.js b/chrome/content/zotero/bibliography.js index 6d278fdf5d..3a992b76f8 100644 --- a/chrome/content/zotero/bibliography.js +++ b/chrome/content/zotero/bibliography.js @@ -324,6 +324,7 @@ var Zotero_File_Interface_Bibliography = new function() { this.manageStyles = function () { + _io.dontActivateDocument = true; document.querySelector('dialog').cancelDialog(); var win = Zotero.Utilities.Internal.openPreferences('zotero-prefpane-cite', { scrollTo: '#styles' diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index 13ca9f6a73..b9af1d80e2 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -329,7 +329,9 @@ Zotero.Integration = new function() { if (document) { try { await document.cleanup(); - await document.activate(); + if (!Zotero.Integration.currentSession._dontActivateDocument) { + await document.activate(); + } // Call complete function if one exists if (document.complete) { @@ -956,6 +958,7 @@ Zotero.Integration.Session = function(doc, app) { this.primaryFieldType = app.primaryFieldType; this.secondaryFieldType = app.secondaryFieldType; this.outputFormat = app.outputFormat || 'rtf'; + this._dontActivateDocument = false; this._sessionUpToDate = false; this._app = app; @@ -1889,6 +1892,7 @@ Zotero.Integration.Session.prototype.setDocPrefs = async function (showImportExp } if (!io.style || !io.fieldType) { + this._dontActivateDocument = io.dontActivateDocument; throw new Zotero.Exception.UserCancelled("document preferences window"); }