Fix citeproc preview call citationsPre/post arrays
This commit is contained in:
parent
787e57f6a2
commit
63a8d2b8c4
1 changed files with 6 additions and 6 deletions
|
@ -1222,17 +1222,17 @@ Zotero.Integration.Fields.prototype.addEditCitation = async function (field) {
|
||||||
var previewFn = async function (citation) {
|
var previewFn = async function (citation) {
|
||||||
let idx = await fieldIndexPromise;
|
let idx = await fieldIndexPromise;
|
||||||
await citationsByItemIDPromise;
|
await citationsByItemIDPromise;
|
||||||
var fields = await this.get();
|
|
||||||
|
|
||||||
var [citations, fieldToCitationIdxMapping, citationToFieldIdxMapping] = this._session.getCiteprocLists(true);
|
var [citations, fieldToCitationIdxMapping, citationToFieldIdxMapping] = this._session.getCiteprocLists();
|
||||||
for (var prevIdx = idx-1; prevIdx >= 0; prevIdx--) {
|
for (var prevIdx = idx-1; prevIdx >= 0; prevIdx--) {
|
||||||
if (prevIdx in fieldToCitationIdxMapping) break;
|
if (prevIdx in fieldToCitationIdxMapping) break;
|
||||||
}
|
}
|
||||||
for (var nextIdx = idx; nextIdx < fields.length; nextIdx++) {
|
let sliceIdx = fieldToCitationIdxMapping[prevIdx]+1;
|
||||||
if (nextIdx in fieldToCitationIdxMapping) break;
|
if (sliceIdx == NaN) {
|
||||||
|
sliceIdx = 0;
|
||||||
}
|
}
|
||||||
let citationsPre = citations.slice(0, fieldToCitationIdxMapping[prevIdx]+1);
|
let citationsPre = citations.slice(0, sliceIdx);
|
||||||
let citationsPost = citations.slice(fieldToCitationIdxMapping[nextIdx]);
|
let citationsPost = citations.slice(sliceIdx);
|
||||||
let citationID = citation.citationID;
|
let citationID = citation.citationID;
|
||||||
try {
|
try {
|
||||||
var result = this._session.style.previewCitationCluster(citation, citationsPre, citationsPost, "rtf");
|
var result = this._session.style.previewCitationCluster(citation, citationsPre, citationsPost, "rtf");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue