More annotation 'position' fixes
This commit is contained in:
parent
2536edb6ab
commit
602e4c1e1f
3 changed files with 6 additions and 11 deletions
|
@ -50,7 +50,8 @@ Zotero.Annotations = new function () {
|
||||||
o.pageLabel = item.annotationPageLabel;
|
o.pageLabel = item.annotationPageLabel;
|
||||||
o.color = item.annotationColor;
|
o.color = item.annotationColor;
|
||||||
o.sortIndex = item.annotationSortIndex;
|
o.sortIndex = item.annotationSortIndex;
|
||||||
o.position = item.annotationPosition;
|
// annotationPosition is a JSON string, but we want to pass the raw object to the reader
|
||||||
|
o.position = JSON.parse(item.annotationPosition);
|
||||||
|
|
||||||
// Add tags and tag colors
|
// Add tags and tag colors
|
||||||
var tagColors = Zotero.Tags.getColors(item.libraryID);
|
var tagColors = Zotero.Tags.getColors(item.libraryID);
|
||||||
|
|
|
@ -566,13 +566,7 @@ Zotero.Items = function() {
|
||||||
throw new Error("Item " + itemID + " not found");
|
throw new Error("Item " + itemID + " not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
item._annotationPosition = row.getResultByIndex(1);
|
||||||
item._annotationPosition = JSON.parse(row.getResultByIndex(1));
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
Zotero.logError(`Error parsing 'position' for item ${item.libraryKey}`);
|
|
||||||
item._annotationPosition = {};
|
|
||||||
}
|
|
||||||
item._annotationPageLabel = row.getResultByIndex(2);
|
item._annotationPageLabel = row.getResultByIndex(2);
|
||||||
|
|
||||||
item._loaded.annotationDeferred = true;
|
item._loaded.annotationDeferred = true;
|
||||||
|
|
|
@ -143,7 +143,7 @@ describe("Zotero.Annotations", function() {
|
||||||
if (prop == 'dateModified') {
|
if (prop == 'dateModified') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
assert.deepEqual(json[prop], exampleHighlightAlt[prop], `'${prop}' doesn't match`);
|
assert.deepEqual(json[prop], exampleHighlight[prop], `'${prop}' doesn't match`);
|
||||||
}
|
}
|
||||||
|
|
||||||
await annotation.eraseTx();
|
await annotation.eraseTx();
|
||||||
|
@ -168,7 +168,7 @@ describe("Zotero.Annotations", function() {
|
||||||
if (prop == 'dateModified') {
|
if (prop == 'dateModified') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
assert.deepEqual(json[prop], exampleNoteAlt[prop], `'${prop}' doesn't match`);
|
assert.deepEqual(json[prop], exampleNote[prop], `'${prop}' doesn't match`);
|
||||||
}
|
}
|
||||||
|
|
||||||
await annotation.eraseTx();
|
await annotation.eraseTx();
|
||||||
|
@ -207,7 +207,7 @@ describe("Zotero.Annotations", function() {
|
||||||
|| prop == 'dateModified') {
|
|| prop == 'dateModified') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
assert.deepEqual(json[prop], exampleImageAlt[prop], `'${prop}' doesn't match`);
|
assert.deepEqual(json[prop], exampleImage[prop], `'${prop}' doesn't match`);
|
||||||
}
|
}
|
||||||
assert.equal(json.imageURL, `zotero://attachment/library/items/${imageAttachment.key}`);
|
assert.equal(json.imageURL, `zotero://attachment/library/items/${imageAttachment.key}`);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue