diff --git a/src/display/editor/annotation_editor_layer.js b/src/display/editor/annotation_editor_layer.js index 0b4d6ed2b7478..27c3fbe1c8d32 100644 --- a/src/display/editor/annotation_editor_layer.js +++ b/src/display/editor/annotation_editor_layer.js @@ -405,7 +405,7 @@ class AnnotationEditorLayer { return; } - this.#uiManager._eventBus.dispatch("annotationstart", { source: this }); + this.#uiManager._editorUndoBar?.hide(); this.#uiManager.showAllEditors( "highlight", diff --git a/src/display/editor/freetext.js b/src/display/editor/freetext.js index c72fa51e7ec9e..fe6d483aba0ee 100644 --- a/src/display/editor/freetext.js +++ b/src/display/editor/freetext.js @@ -552,7 +552,7 @@ class FreeTextEditor extends AnnotationEditor { return this.div; } - this._uiManager._eventBus.dispatch("annotationstart", { source: this }); + this._uiManager._editorUndoBar?.hide(); let baseX, baseY; if (this.width) { diff --git a/src/display/editor/highlight.js b/src/display/editor/highlight.js index 2e2d9cbf7f423..aa0b76f22f1ab 100644 --- a/src/display/editor/highlight.js +++ b/src/display/editor/highlight.js @@ -569,6 +569,8 @@ class HighlightEditor extends AnnotationEditor { return this.div; } + this._uiManager._editorUndoBar?.hide(); + const div = super.render(); if (this.#text) { div.setAttribute("aria-label", this.#text); diff --git a/src/display/editor/ink.js b/src/display/editor/ink.js index ac5c14e41eb37..e55af40bcc143 100644 --- a/src/display/editor/ink.js +++ b/src/display/editor/ink.js @@ -694,7 +694,7 @@ class InkEditor extends AnnotationEditor { }); } - this._uiManager._eventBus.dispatch("annotationstart", { source: this }); + this._uiManager._editorUndoBar?.hide(); this.#startDrawing(event.offsetX, event.offsetY); } diff --git a/src/display/editor/stamp.js b/src/display/editor/stamp.js index 2f9298b2664d6..92f1f2a57a027 100644 --- a/src/display/editor/stamp.js +++ b/src/display/editor/stamp.js @@ -365,7 +365,7 @@ class StampEditor extends AnnotationEditor { return this.div; } - this._uiManager._eventBus.dispatch("annotationstart", { source: this }); + this._uiManager._editorUndoBar?.hide(); let baseX, baseY; if (this.width) { diff --git a/src/display/editor/tools.js b/src/display/editor/tools.js index c9df07bded126..4777417bcef78 100644 --- a/src/display/editor/tools.js +++ b/src/display/editor/tools.js @@ -562,7 +562,7 @@ class AnnotationEditorUIManager { #editorsToRescale = new Set(); - #editorUndoBar = null; + _editorUndoBar = null; #enableHighlightFloatingButton = false; @@ -807,7 +807,7 @@ class AnnotationEditorUIManager { rotation: 0, }; this.isShiftKeyDown = false; - this.#editorUndoBar = editorUndoBar; + this._editorUndoBar = editorUndoBar; if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("TESTING")) { Object.defineProperty(this, "reset", { @@ -2006,7 +2006,7 @@ class AnnotationEditorUIManager { const editors = [...this.#selectedEditors]; const cmd = () => { - this.#editorUndoBar?.show( + this._editorUndoBar?.show( undo, editors.length === 1 ? editors[0].editorType : editors.length ); diff --git a/web/editor_undo_bar.js b/web/editor_undo_bar.js index 4f554da74e1a8..ee99f739346e8 100644 --- a/web/editor_undo_bar.js +++ b/web/editor_undo_bar.js @@ -43,7 +43,6 @@ class EditorUndoBar { closeButton.addEventListener("click", boundHide); eventBus._on("beforeprint", boundHide); eventBus._on("download", boundHide); - eventBus._on("annotationstart", boundHide); eventBus._on("secondarytoolbaraction", boundHide); }