Skip to content

Commit

Permalink
fixup! Pop open a message when user deletes an annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
ryzokuken committed Oct 18, 2024
1 parent 349e29f commit 48e196f
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/display/editor/annotation_editor_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ class AnnotationEditorLayer {
return;
}

this.#uiManager._eventBus.dispatch("annotationstart", { source: this });
this.#uiManager._editorUndoBar?.hide();

this.#uiManager.showAllEditors(
"highlight",
Expand Down
2 changes: 1 addition & 1 deletion src/display/editor/freetext.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions src/display/editor/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/display/editor/ink.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/display/editor/stamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/display/editor/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ class AnnotationEditorUIManager {

#editorsToRescale = new Set();

#editorUndoBar = null;
_editorUndoBar = null;

#enableHighlightFloatingButton = false;

Expand Down Expand Up @@ -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", {
Expand Down Expand Up @@ -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
);
Expand Down
1 change: 0 additions & 1 deletion web/editor_undo_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 48e196f

Please sign in to comment.