mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
[Editor] Unselect highlight editor when pressing Escape when the focus is on the color picker without a dropdown menu
This commit is contained in:
parent
dd3adc84db
commit
1859412507
2 changed files with 42 additions and 1 deletions
|
@ -34,6 +34,8 @@ class ColorPicker {
|
|||
|
||||
#isMainColorPicker = false;
|
||||
|
||||
#editor = null;
|
||||
|
||||
#eventBus;
|
||||
|
||||
#uiManager = null;
|
||||
|
@ -68,6 +70,7 @@ class ColorPicker {
|
|||
if (editor) {
|
||||
this.#isMainColorPicker = false;
|
||||
this.#type = AnnotationEditorParamsType.HIGHLIGHT_COLOR;
|
||||
this.#editor = editor;
|
||||
} else {
|
||||
this.#isMainColorPicker = true;
|
||||
this.#type = AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR;
|
||||
|
@ -233,7 +236,13 @@ class ColorPicker {
|
|||
}
|
||||
|
||||
_hideDropdownFromKeyboard() {
|
||||
if (this.#isMainColorPicker || !this.#isDropdownVisible) {
|
||||
if (this.#isMainColorPicker) {
|
||||
return;
|
||||
}
|
||||
if (!this.#isDropdownVisible) {
|
||||
// The user pressed Escape with no dropdown visible, so we must
|
||||
// unselect it.
|
||||
this.#editor?.unselect();
|
||||
return;
|
||||
}
|
||||
this.hideDropdown();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue