Fixes citation dialog locator string not working. Closes #1771

Regression in 5a1e329
This commit is contained in:
Adomas Venčkauskas 2020-01-06 13:34:22 +02:00
parent 3d2afa9c7f
commit 51792ba242

View file

@ -237,8 +237,8 @@ var Zotero_QuickFormat = new function () {
// add to previous cite
var node = _getCurrentEditorTextNode();
var prevNode = node.previousSibling;
let citationItem = JSON.parse(prevNode && prevNode.dataset.citationItem || "{}");
if (citationItem.locator) {
let citationItem = JSON.parse(prevNode && prevNode.dataset.citationItem || "null");
if (citationItem && citationItem.locator) {
citationItem.locator += str;
prevNode.dataset.citationItem = JSON.stringify(citationItem);
prevNode.textContent = _buildBubbleString(citationItem);
@ -256,8 +256,8 @@ var Zotero_QuickFormat = new function () {
// add to previous cite
var node = _getCurrentEditorTextNode();
var prevNode = node.previousSibling;
let citationItem = JSON.parse(prevNode && prevNode.dataset.citationItem || "{}");
if(prevNode && prevNode.citationItem) {
let citationItem = JSON.parse(prevNode && prevNode.dataset.citationItem || "null");
if (citationItem) {
citationItem.locator = m[2];
prevNode.dataset.citationItem = JSON.stringify(citationItem);
prevNode.textContent = _buildBubbleString(citationItem);