diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index e042ee8384..9cc7ce9695 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -1842,6 +1842,13 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) { Zotero.Annotations.removeCacheImage({ libraryID, key }); }.bind(this)); } + + let fields = ['Type', 'Text', 'Comment', 'PageLabel', 'SortIndex', 'Position', 'IsExternal']; + for (let field of fields) { + this._clearChanged('annotation' + field); + } + this._markForReload('annotation'); + this._markForReload('annotationDeferred'); } // Add to new collections diff --git a/test/tests/annotationsTest.js b/test/tests/annotationsTest.js index 4d6ec2326e..b4f1c926e6 100644 --- a/test/tests/annotationsTest.js +++ b/test/tests/annotationsTest.js @@ -300,8 +300,8 @@ describe("Zotero.Annotations", function() { json.pageLabel = ''; await Zotero.Annotations.saveFromJSON(attachment, json); - assert.equal(annotation.annotationComment, ''); - assert.equal(annotation.annotationPageLabel, ''); + assert.isNull(annotation.annotationComment); + assert.isNull(annotation.annotationPageLabel); }); }); }) \ No newline at end of file diff --git a/test/tests/itemTest.js b/test/tests/itemTest.js index 14b9bb7666..9435c8c398 100644 --- a/test/tests/itemTest.js +++ b/test/tests/itemTest.js @@ -1253,6 +1253,7 @@ describe("Zotero.Item", function () { ] }); await annotation.saveTx(); + assert.isFalse(annotation.hasChanged()); }); it("should save a note annotation", async function () { @@ -1268,6 +1269,7 @@ describe("Zotero.Item", function () { ] }); await annotation.saveTx(); + assert.isFalse(annotation.hasChanged()); }); it("should save an image annotation", async function () { @@ -1292,6 +1294,7 @@ describe("Zotero.Item", function () { height: 1 }); await annotation.saveTx(); + assert.isFalse(annotation.hasChanged()); var blob = new Blob([array], { type: 'image/png' }); await Zotero.Annotations.saveCacheImage(annotation, blob);