Fix corrupt citation prompt going into recursive loop
This commit is contained in:
parent
8d3e893aec
commit
a12b997b8a
|
@ -2211,31 +2211,24 @@ Zotero.Integration.CitationField = class extends Zotero.Integration.Field {
|
||||||
}
|
}
|
||||||
|
|
||||||
resolveCorrupt(code) {
|
resolveCorrupt(code) {
|
||||||
return Zotero.Promise.coroutine(function* () {
|
Zotero.debug(`Integration: handling corrupt citation field ${code}`);
|
||||||
Zotero.debug(`Integration: handling corrupt citation field ${code}`);
|
var msg = Zotero.getString("integration.corruptField")+'\n\n'+
|
||||||
var msg = Zotero.getString("integration.corruptField")+'\n\n'+
|
Zotero.getString('integration.corruptField.description');
|
||||||
Zotero.getString('integration.corruptField.description');
|
this.select();
|
||||||
this.select();
|
Zotero.Integration.currentDoc.activate();
|
||||||
Zotero.Integration.currentDoc.activate();
|
var result = Zotero.Integration.currentSession.displayAlert(msg, DIALOG_ICON_CAUTION, DIALOG_BUTTONS_YES_NO_CANCEL);
|
||||||
var result = Zotero.Integration.currentSession.displayAlert(msg, DIALOG_ICON_CAUTION, DIALOG_BUTTONS_YES_NO_CANCEL);
|
if (result == 0) { // Cancel
|
||||||
if (result == 0) { // Cancel
|
return new Zotero.Exception.UserCancelled("corrupt citation resolution");
|
||||||
return new Zotero.Exception.UserCancelled("corrupt citation resolution");
|
} else if (result == 1) { // No
|
||||||
} else if (result == 1) { // No
|
return false;
|
||||||
return false;
|
} else { // Yes
|
||||||
} else { // Yes
|
var fieldGetter = Zotero.Integration.currentSession.fields,
|
||||||
var fieldGetter = Zotero.Integration.currentSession.fields,
|
oldWindow = Zotero.Integration.currentWindow,
|
||||||
oldWindow = Zotero.Integration.currentWindow,
|
oldProgressCallback = this.progressCallback;
|
||||||
oldProgressCallback = this.progressCallback;
|
// Clear current code and subsequent addEditCitation dialog will be the reselection
|
||||||
// Display reselect edit citation dialog
|
this.clearCode();
|
||||||
let [idx, field, citation] = yield fieldGetter.addEditCitation(this);
|
return this.unserialize();
|
||||||
if (Zotero.Integration.currentWindow && !Zotero.Integration.currentWindow.closed) {
|
}
|
||||||
Zotero.Integration.currentWindow.close();
|
|
||||||
}
|
|
||||||
Zotero.Integration.currentWindow = oldWindow;
|
|
||||||
fieldGetter.progressCallback = oldProgressCallback;
|
|
||||||
return citation;
|
|
||||||
}
|
|
||||||
}).apply(this, arguments);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2256,18 +2249,16 @@ Zotero.Integration.BibliographyField = class extends Zotero.Integration.Field {
|
||||||
}
|
}
|
||||||
|
|
||||||
resolveCorrupt(code) {
|
resolveCorrupt(code) {
|
||||||
return Zotero.Promise.coroutine(function* () {
|
Zotero.debug(`Integration: handling corrupt bibliography field ${code}`);
|
||||||
Zotero.debug(`Integration: handling corrupt bibliography field ${code}`);
|
var msg = Zotero.getString("integration.corruptBibliography")+'\n\n'+
|
||||||
var msg = Zotero.getString("integration.corruptBibliography")+'\n\n'+
|
Zotero.getString('integration.corruptBibliography.description');
|
||||||
Zotero.getString('integration.corruptBibliography.description');
|
var result = Zotero.Integration.currentSession.displayAlert(msg, DIALOG_ICON_CAUTION, DIALOG_BUTTONS_OK_CANCEL);
|
||||||
var result = Zotero.Integration.currentSession.displayAlert(msg, DIALOG_ICON_CAUTION, DIALOG_BUTTONS_OK_CANCEL);
|
if (result == 0) {
|
||||||
if (result == 0) {
|
throw new Zotero.Exception.UserCancelled("corrupt bibliography resolution");
|
||||||
throw new Zotero.Exception.UserCancelled("corrupt bibliography resolution");
|
} else {
|
||||||
} else {
|
this.clearCode();
|
||||||
this.clearCode();
|
return unserialize();
|
||||||
return unserialize();
|
}
|
||||||
}
|
|
||||||
}).apply(this, arguments);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user