Skip to content

Build your personal knowledge base with Trilium Notes

fix(client/pdf): form elements not detected for save

Elian Doran7836de3f08df
diff --git a/packages/pdfjs-viewer/src/custom.ts b/packages/pdfjs-viewer/src/custom.ts
index d3d9477886..060ed0c1c0 100644
--- a/packages/pdfjs-viewer/src/custom.ts
+++ b/packages/pdfjs-viewer/src/custom.ts
@@ -36,9 +36,10 @@ function manageSave(app: typeof window.PDFViewerApplication) {
}, 2_000);
}
+ app.pdfDocument.annotationStorage.onSetModified = debouncedSave; // works great for most cases, including forms.
app.eventBus.on("annotationeditorcommit", debouncedSave);
app.eventBus.on("annotationeditorparamschanged", debouncedSave);
- app.eventBus.on("annotationeditorstateschanged", evt => {
+ 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