diff --git a/packages/pdfjs-viewer/src/annotations.ts b/packages/pdfjs-viewer/src/annotations.ts index 61e859fae7..2d33c36b28 100644 --- a/packages/pdfjs-viewer/src/annotations.ts +++ b/packages/pdfjs-viewer/src/annotations.ts @@ -81,6 +81,10 @@ export function setupAnnotationLiveUpdates() { // Fires when editor properties change (e.g. color, thickness). app.eventBus.on("annotationeditorparamschanged", debouncedRefresh); + + // Catches deletions, undo/redo, and comment deletion which + // don't trigger onSetModified or annotationeditorparamschanged. + app.eventBus.on("editingstateschanged", debouncedRefresh); } async function extractAndSendAnnotations() { diff --git a/packages/pdfjs-viewer/src/custom.ts b/packages/pdfjs-viewer/src/custom.ts index d3d80a756b..4aa35b1467 100644 --- a/packages/pdfjs-viewer/src/custom.ts +++ b/packages/pdfjs-viewer/src/custom.ts @@ -126,6 +126,11 @@ function manageSave() { app.eventBus.on("switchannotationeditorparams", () => { onChange(); }); + // Catches deletions of existing annotations, undo/redo, and comment deletion + // which don't trigger onSetModified or switchannotationeditorparams. + app.eventBus.on("editingstateschanged", () => { + onChange(); + }); } function manageDownload() {