Clear annotation change state after save
This commit is contained in:
parent
98f9a99126
commit
4a4a54da7b
3 changed files with 12 additions and 2 deletions
|
@ -1842,6 +1842,13 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
|
||||||
Zotero.Annotations.removeCacheImage({ libraryID, key });
|
Zotero.Annotations.removeCacheImage({ libraryID, key });
|
||||||
}.bind(this));
|
}.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
|
// Add to new collections
|
||||||
|
|
|
@ -300,8 +300,8 @@ describe("Zotero.Annotations", function() {
|
||||||
json.pageLabel = '';
|
json.pageLabel = '';
|
||||||
await Zotero.Annotations.saveFromJSON(attachment, json);
|
await Zotero.Annotations.saveFromJSON(attachment, json);
|
||||||
|
|
||||||
assert.equal(annotation.annotationComment, '');
|
assert.isNull(annotation.annotationComment);
|
||||||
assert.equal(annotation.annotationPageLabel, '');
|
assert.isNull(annotation.annotationPageLabel);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
|
@ -1253,6 +1253,7 @@ describe("Zotero.Item", function () {
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
await annotation.saveTx();
|
await annotation.saveTx();
|
||||||
|
assert.isFalse(annotation.hasChanged());
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should save a note annotation", async function () {
|
it("should save a note annotation", async function () {
|
||||||
|
@ -1268,6 +1269,7 @@ describe("Zotero.Item", function () {
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
await annotation.saveTx();
|
await annotation.saveTx();
|
||||||
|
assert.isFalse(annotation.hasChanged());
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should save an image annotation", async function () {
|
it("should save an image annotation", async function () {
|
||||||
|
@ -1292,6 +1294,7 @@ describe("Zotero.Item", function () {
|
||||||
height: 1
|
height: 1
|
||||||
});
|
});
|
||||||
await annotation.saveTx();
|
await annotation.saveTx();
|
||||||
|
assert.isFalse(annotation.hasChanged());
|
||||||
|
|
||||||
var blob = new Blob([array], { type: 'image/png' });
|
var blob = new Blob([array], { type: 'image/png' });
|
||||||
await Zotero.Annotations.saveCacheImage(annotation, blob);
|
await Zotero.Annotations.saveCacheImage(annotation, blob);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue