Integration: Don't activate document after clicking Manage Styles in Doc Prefs

Closes #4290
This commit is contained in:
Adomas Venčkauskas 2024-06-27 10:09:23 +03:00
parent d5bb667fb3
commit 87f7a6a7bd
2 changed files with 6 additions and 1 deletions

View file

@ -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'

View file

@ -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");
}