Skip to content

Build your personal knowledge base with Trilium Notes

fix(pdfjs): saves as soon as document is opened

Elian Dorane485b75a448e
diff --git a/packages/pdfjs-viewer/src/custom.ts b/packages/pdfjs-viewer/src/custom.ts
index d785601222..8ec01752c0 100644
--- a/packages/pdfjs-viewer/src/custom.ts
+++ b/packages/pdfjs-viewer/src/custom.ts
@@ -81,16 +81,11 @@ function manageSave() {
}
});
- app.pdfDocument.annotationStorage.onSetModified = onChange; // works great for most cases, including forms.
- app.eventBus.on("annotationeditorcommit", onChange);
- app.eventBus.on("annotationeditorparamschanged", onChange);
- app.eventBus.on("annotationeditorstateschanged", evt => { // needed for detecting when annotations are moved around.
- const { activeEditorId } = evt;
-
- // When activeEditorId becomes null, an editor was just committed
- if (activeEditorId === null) {
- onChange();
- }
+ app.pdfDocument.annotationStorage.onSetModified = () => {
+ onChange();
+ }; // works great for most cases, including forms.
+ app.eventBus.on("switchannotationeditorparams", () => {
+ onChange();
});
}