Fix note citation insertion breaking when citing the same item in a note
This commit is contained in:
parent
1401550230
commit
6be2faa9c2
1 changed files with 5 additions and 2 deletions
|
@ -1435,8 +1435,11 @@ Zotero.Integration.Session.prototype._processNote = function (item) {
|
|||
placeholderIDs.push(placeholderID);
|
||||
let placeholderURL = NOTE_CITATION_PLACEHOLDER_LINK + placeholderID;
|
||||
// Split out the citation element and replace with a placeholder link
|
||||
text = text.split(citationElem.outerHTML)
|
||||
.join(`<a href="${placeholderURL}">${citationElem.textContent}</a>`);
|
||||
let startIndex = text.indexOf(citationElem.outerHTML);
|
||||
let endIndex = startIndex + citationElem.outerHTML.length;
|
||||
text = text.slice(0, startIndex)
|
||||
+ `<a href="${placeholderURL}">${citationElem.textContent}</a>`
|
||||
+ text.slice(endIndex);
|
||||
}
|
||||
catch (e) {
|
||||
e.message = `Failed to parse a citation from a note: ${decodeURIComponent(citationElem.dataset.citation)}`;
|
||||
|
|
Loading…
Reference in a new issue