Don't break citation ID regeneration
This commit is contained in:
parent
6fe3ef27d4
commit
fc5e8be8c0
1 changed files with 9 additions and 5 deletions
|
@ -1883,11 +1883,12 @@ Zotero.Integration.Session.prototype.resetRequest = function(doc) {
|
||||||
this.updateIndices = {};
|
this.updateIndices = {};
|
||||||
this.newIndices = {};
|
this.newIndices = {};
|
||||||
|
|
||||||
this.oldCitationIDs = this.citationIDs;
|
this.oldCitationIDs = this.citeprocCitationIDs;
|
||||||
|
|
||||||
this.citationsByItemID = {};
|
this.citationsByItemID = {};
|
||||||
this.citationsByIndex = [];
|
this.citationsByIndex = [];
|
||||||
this.citationIDs = {};
|
this.documentCitationIDs = {};
|
||||||
|
this.citeprocCitationIDs = {};
|
||||||
this.citationText = {};
|
this.citationText = {};
|
||||||
|
|
||||||
this.doc = doc;
|
this.doc = doc;
|
||||||
|
@ -1963,6 +1964,7 @@ Zotero.Integration.Session.prototype.setDocPrefs = function(doc, primaryFieldTyp
|
||||||
if(!oldData || oldData.style.styleID != data.style.styleID
|
if(!oldData || oldData.style.styleID != data.style.styleID
|
||||||
|| oldData.prefs.noteType != data.prefs.noteType
|
|| oldData.prefs.noteType != data.prefs.noteType
|
||||||
|| oldData.prefs.fieldType != data.prefs.fieldType) {
|
|| oldData.prefs.fieldType != data.prefs.fieldType) {
|
||||||
|
// This will cause us to regenerate all citations
|
||||||
me.oldCitationIDs = {};
|
me.oldCitationIDs = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2121,7 +2123,8 @@ Zotero.Integration.Session.prototype.addCitation = function(index, noteIndex, ar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var needNewID = !citation.citationID || this.citationIDs[citation.citationID];
|
// We need a new ID if there's another citation with the same citation ID in this document
|
||||||
|
var needNewID = !citation.citationID || this.documentCitationIDs[citation.citationID];
|
||||||
if(needNewID || !this.oldCitationIDs[citation.citationID]) {
|
if(needNewID || !this.oldCitationIDs[citation.citationID]) {
|
||||||
if(needNewID) {
|
if(needNewID) {
|
||||||
Zotero.debug("Integration: "+citation.citationID+" ("+index+") needs new citationID");
|
Zotero.debug("Integration: "+citation.citationID+" ("+index+") needs new citationID");
|
||||||
|
@ -2131,6 +2134,7 @@ Zotero.Integration.Session.prototype.addCitation = function(index, noteIndex, ar
|
||||||
this.updateIndices[index] = true;
|
this.updateIndices[index] = true;
|
||||||
}
|
}
|
||||||
Zotero.debug("Integration: Adding citationID "+citation.citationID);
|
Zotero.debug("Integration: Adding citationID "+citation.citationID);
|
||||||
|
this.documentCitationIDs[citation.citationID] = citation.citationID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2362,7 +2366,7 @@ Zotero.Integration.Session.prototype.deleteCitation = function(index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Zotero.debug("Integration: Deleting old citationID "+oldCitation.citationID);
|
Zotero.debug("Integration: Deleting old citationID "+oldCitation.citationID);
|
||||||
if(oldCitation.citationID) delete this.citationIDs[oldCitation.citationID];
|
if(oldCitation.citationID) delete this.citeprocCitationIDs[oldCitation.citationID];
|
||||||
|
|
||||||
this.updateIndices[index] = true;
|
this.updateIndices[index] = true;
|
||||||
}
|
}
|
||||||
|
@ -2513,7 +2517,7 @@ Zotero.Integration.Session.prototype.updateCitations = function(callback) {
|
||||||
if(this.formatCitation(index, citation)) {
|
if(this.formatCitation(index, citation)) {
|
||||||
this.bibliographyHasChanged = true;
|
this.bibliographyHasChanged = true;
|
||||||
}
|
}
|
||||||
this.citationIDs[citation.citationID] = true;
|
this.citeprocCitationIDs[citation.citationID] = true;
|
||||||
delete this.newIndices[index];
|
delete this.newIndices[index];
|
||||||
yield true;
|
yield true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue