mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #15195 from calixteman/empty_editor
[Editor] No need to click twice to create an editor when the last one is empty
This commit is contained in:
commit
408c10b5bb
2 changed files with 5 additions and 10 deletions
|
@ -572,7 +572,8 @@ class AnnotationEditorLayer {
|
|||
return;
|
||||
}
|
||||
|
||||
this.#allowClick = !this.#uiManager.hasActive();
|
||||
const editor = this.#uiManager.getActive();
|
||||
this.#allowClick = !editor || editor.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -938,7 +938,9 @@ class AnnotationEditorUIManager {
|
|||
for (const editor of this.#allEditors.values()) {
|
||||
editor.unselect();
|
||||
}
|
||||
this.#dispatchUpdateStates({ hasSelectedEditor: this.hasActive() });
|
||||
this.#dispatchUpdateStates({
|
||||
hasSelectedEditor: this.#activeEditor !== null,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -958,14 +960,6 @@ class AnnotationEditorUIManager {
|
|||
return this.#activeEditor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there is an active editor.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
hasActive() {
|
||||
return this.#activeEditor !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current editor mode.
|
||||
* @returns {number}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue