From 4e1b71dac25b08a26ea101f293276342f4aa5706 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 25 Apr 2026 21:24:48 +0300 Subject: [PATCH] fix(pdfjs): not reacting to deleting highlights or moving (closes #9069) --- packages/pdfjs-viewer/src/annotations.ts | 4 ++++ packages/pdfjs-viewer/src/custom.ts | 5 +++++ 2 files changed, 9 insertions(+) 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() {