mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
[Editor] Avoid to throw when deleting some invisible editors
This commit is contained in:
parent
8281bb8858
commit
e4b4d222fa
3 changed files with 97 additions and 4 deletions
|
@ -581,7 +581,11 @@ class AnnotationEditor {
|
|||
// undo/redo so we must commit it before.
|
||||
this.commit();
|
||||
}
|
||||
this.parent.remove(this);
|
||||
if (this.parent) {
|
||||
this.parent.remove(this);
|
||||
} else {
|
||||
this._uiManager.removeEditor(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -638,6 +642,9 @@ class AnnotationEditor {
|
|||
*/
|
||||
set isEditing(value) {
|
||||
this.#isEditing = value;
|
||||
if (!this.parent) {
|
||||
return;
|
||||
}
|
||||
if (value) {
|
||||
this.parent.setSelected(this);
|
||||
this.parent.setActiveEditor(this);
|
||||
|
|
|
@ -307,8 +307,10 @@ class FreeTextEditor extends AnnotationEditor {
|
|||
/** @inheritdoc */
|
||||
remove() {
|
||||
this.isEditing = false;
|
||||
this.parent.setEditingState(true);
|
||||
this.parent.div.classList.add("freeTextEditing");
|
||||
if (this.parent) {
|
||||
this.parent.setEditingState(true);
|
||||
this.parent.div.classList.add("freeTextEditing");
|
||||
}
|
||||
super.remove();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue