1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #16652 from calixteman/rm_all_exceptions

[Editor] Avoid to throw when deleting some invisible editors
This commit is contained in:
calixteman 2023-07-06 19:11:44 +02:00 committed by GitHub
commit eb2527e9d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 97 additions and 4 deletions

View file

@ -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);

View file

@ -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();
}