Skip to content

Commit

Permalink
Merge pull request #15187 from calixteman/rm_useless_ed
Browse files Browse the repository at this point in the history
[Editor] Remove useless and potentially deleted editors
  • Loading branch information
calixteman authored Jul 20, 2022
2 parents f46895d + 964fb77 commit 33d7a35
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/display/editor/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ class AnnotationEditorUIManager {
delete() {
let cmd, undo;
if (this.#isAllSelected) {
this.#previousActiveEditor = this.#activeEditor = null;
const editors = Array.from(this.#allEditors.values());
cmd = () => {
for (const editor of editors) {
Expand All @@ -807,6 +808,7 @@ class AnnotationEditorUIManager {
return;
}
const editor = this.#activeEditor;
this.#previousActiveEditor = this.#activeEditor = null;
cmd = () => {
editor.remove();
};
Expand Down Expand Up @@ -834,15 +836,7 @@ class AnnotationEditorUIManager {
cut() {
if (this.#activeEditor) {
this.#clipboardManager.copy(this.#activeEditor);
const editor = this.#activeEditor;
const cmd = () => {
editor.remove();
};
const undo = () => {
this.#addEditorToLayer(editor);
};

this.addCommands({ cmd, undo, mustExec: true });
this.delete();
}
}

Expand Down

0 comments on commit 33d7a35

Please sign in to comment.