Fix edited citation prompt not displaying (regression 25d8898
)
This commit is contained in:
parent
749faabb46
commit
a659c6c6ff
1 changed files with 30 additions and 27 deletions
|
@ -997,40 +997,43 @@ Zotero.Integration.Fields.prototype._updateDocument = async function(forceCitati
|
||||||
var formattedCitation = citation.properties.custom
|
var formattedCitation = citation.properties.custom
|
||||||
? citation.properties.custom : citation.text;
|
? citation.properties.custom : citation.text;
|
||||||
var plainCitation = citation.properties.plainCitation && citationField.getText();
|
var plainCitation = citation.properties.plainCitation && citationField.getText();
|
||||||
|
var plaintextChanged = citation.properties.plainCitation
|
||||||
|
&& plainCitation !== citation.properties.plainCitation;
|
||||||
|
|
||||||
|
if (!ignoreCitationChanges && plaintextChanged) {
|
||||||
|
// Citation manually modified; ask user if they want to save changes
|
||||||
|
Zotero.debug("[_updateDocument] Attempting to update manually modified citation.\n"
|
||||||
|
+ "Original: " + citation.properties.plainCitation + "\n"
|
||||||
|
+ "Current: " + plainCitation
|
||||||
|
);
|
||||||
|
citationField.select();
|
||||||
|
var result = this._session.displayAlert(
|
||||||
|
Zotero.getString("integration.citationChanged")+"\n\n"+Zotero.getString("integration.citationChanged.description"),
|
||||||
|
DIALOG_ICON_CAUTION, DIALOG_BUTTONS_YES_NO);
|
||||||
|
if (result) {
|
||||||
|
citation.properties.dontUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update citation text:
|
// Update citation text:
|
||||||
// If we're looking to reset the text even if it matches previous text
|
// If we're looking to reset the text even if it matches previous text
|
||||||
if (forceCitations == FORCE_CITATIONS_RESET_TEXT
|
if (forceCitations == FORCE_CITATIONS_RESET_TEXT
|
||||||
// Or metadata has changed thus changing the formatted citation
|
// Or metadata has changed thus changing the formatted citation
|
||||||
|| (citation.properties.formattedCitation !== formattedCitation)) {
|
|| (citation.properties.formattedCitation !== formattedCitation)
|
||||||
|
// Or plaintext has changed and user does not want to keep the change
|
||||||
if (!ignoreCitationChanges && plainCitation !== citation.properties.plainCitation) {
|
|| (plaintextChanged && !citation.properties.dontUpdate)) {
|
||||||
// Citation manually modified; ask user if they want to save changes
|
|
||||||
Zotero.debug("[_updateDocument] Attempting to update manually modified citation.\n"
|
|
||||||
+ "Original: " + citation.properties.plainCitation + "\n"
|
// Word will preserve previous text styling, so we need to force remove it
|
||||||
+ "Current: " + plainCitation
|
// for citations that were inserted with delay styling
|
||||||
);
|
if (citation.properties.formattedCitation && citation.properties.formattedCitation.includes(DELAYED_CITATION_STYLING)) {
|
||||||
citationField.select();
|
isRich = citationField.setText(`${DELAYED_CITATION_STYLING_CLEAR}{${formattedCitation}}`);
|
||||||
var result = this._session.displayAlert(
|
} else {
|
||||||
Zotero.getString("integration.citationChanged")+"\n\n"+Zotero.getString("integration.citationChanged.description"),
|
isRich = citationField.setText(formattedCitation);
|
||||||
DIALOG_ICON_CAUTION, DIALOG_BUTTONS_YES_NO);
|
|
||||||
if (result) {
|
|
||||||
citation.properties.dontUpdate = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!citation.properties.dontUpdate) {
|
citation.properties.formattedCitation = formattedCitation;
|
||||||
// Word will preserve previous text styling, so we need to force remove it
|
citation.properties.plainCitation = citationField.getText();
|
||||||
// for citations that were inserted with delay styling
|
|
||||||
if (citation.properties.formattedCitation && citation.properties.formattedCitation.includes(DELAYED_CITATION_STYLING)) {
|
|
||||||
isRich = citationField.setText(`${DELAYED_CITATION_STYLING_CLEAR}{${formattedCitation}}`);
|
|
||||||
} else {
|
|
||||||
isRich = citationField.setText(formattedCitation);
|
|
||||||
}
|
|
||||||
|
|
||||||
citation.properties.formattedCitation = formattedCitation;
|
|
||||||
citation.properties.plainCitation = citationField.getText();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue