Fix edited citation prompt not displaying (regression 25d8898)

This commit is contained in:
Adomas Venčkauskas 2018-03-17 21:47:36 +02:00
parent 749faabb46
commit a659c6c6ff

View file

@ -997,14 +997,10 @@ Zotero.Integration.Fields.prototype._updateDocument = async function(forceCitati
var formattedCitation = citation.properties.custom
? citation.properties.custom : citation.text;
var plainCitation = citation.properties.plainCitation && citationField.getText();
var plaintextChanged = citation.properties.plainCitation
&& plainCitation !== citation.properties.plainCitation;
// Update citation text:
// If we're looking to reset the text even if it matches previous text
if (forceCitations == FORCE_CITATIONS_RESET_TEXT
// Or metadata has changed thus changing the formatted citation
|| (citation.properties.formattedCitation !== formattedCitation)) {
if (!ignoreCitationChanges && 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"
@ -1019,7 +1015,15 @@ Zotero.Integration.Fields.prototype._updateDocument = async function(forceCitati
}
}
if(!citation.properties.dontUpdate) {
// Update citation text:
// If we're looking to reset the text even if it matches previous text
if (forceCitations == FORCE_CITATIONS_RESET_TEXT
// Or metadata has changed thus changing the formatted citation
|| (citation.properties.formattedCitation !== formattedCitation)
// Or plaintext has changed and user does not want to keep the change
|| (plaintextChanged && !citation.properties.dontUpdate)) {
// Word will preserve previous text styling, so we need to force remove it
// for citations that were inserted with delay styling
if (citation.properties.formattedCitation && citation.properties.formattedCitation.includes(DELAYED_CITATION_STYLING)) {
@ -1032,7 +1036,6 @@ Zotero.Integration.Fields.prototype._updateDocument = async function(forceCitati
citation.properties.plainCitation = citationField.getText();
}
}
}
var serializedCitation = citation.serialize();
if (serializedCitation != citation.properties.field) {