Don't count missing annotation values as changed if empty string passed

Similar to 0d377a1c4a, this fixes an unnecessary annotation reload and
loss of unsaved typing on auto-sync immediately after an annotation is
created.
This commit is contained in:
Dan Stillman 2021-04-26 03:47:46 -04:00
commit 76d8818bed
3 changed files with 28 additions and 1 deletions

View file

@ -942,7 +942,12 @@ async function createAnnotation(type, parentItem, options = {}) {
if (type == 'highlight') {
annotation.annotationText = Zotero.Utilities.randomString();
}
annotation.annotationComment = Zotero.Utilities.randomString();
if (options.comment !== undefined) {
annotation.annotationComment = options.comment;
}
else {
annotation.annotationComment = Zotero.Utilities.randomString();
}
annotation.annotationColor = '#ffd400';
var page = Zotero.Utilities.rand(1, 100);
annotation.annotationPageLabel = `${page}`;