Fix annotations not appearing when imported while reader is opening

Fixes https://forums.zotero.org/discussion/133270/bug-embedded-pdf-annotations-and-highlights-fail-to-render-in-zotero-reader

(cherry picked from commit db1216d3e2)
This commit is contained in:
Martynas Bagdonas 2026-08-19 09:55:28 +03:00 committed by Dan Stillman
parent 16a79acf7c
commit e01e6ef9f5

View file

@ -740,11 +740,15 @@ class ReaderInstance {
}
}
if (annotations.length) {
// Annotations can be added before the reader finishes initializing -- e.g., when
// embedded annotations are imported right after opening a newly added file
await this._initPromise;
this._internalReader.setAnnotations(Components.utils.cloneInto(annotations, this._iframeWindow));
}
}
unsetAnnotations(keys) {
async unsetAnnotations(keys) {
await this._initPromise;
this._internalReader.unsetAnnotations(Components.utils.cloneInto(keys, this._iframeWindow));
}