mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-23 00:28:06 +02:00
[Editor] Set keyboard events on window instead of the main container
The keyboard shortcuts (copy, paste, ...) didn't work correctly when the main container was not focused. This patch adds few waitForTimeout in the integration test for FreeText in order to avoid possible intermittent failures.
This commit is contained in:
parent
86165a7ba6
commit
76caaab195
2 changed files with 99 additions and 2 deletions
|
@ -688,11 +688,13 @@ class AnnotationEditorUIManager {
|
|||
#addKeyboardManager() {
|
||||
// The keyboard events are caught at the container level in order to be able
|
||||
// to execute some callbacks even if the current page doesn't have focus.
|
||||
this.#container.addEventListener("keydown", this.#boundKeydown);
|
||||
window.addEventListener("keydown", this.#boundKeydown, { capture: true });
|
||||
}
|
||||
|
||||
#removeKeyboardManager() {
|
||||
this.#container.removeEventListener("keydown", this.#boundKeydown);
|
||||
window.removeEventListener("keydown", this.#boundKeydown, {
|
||||
capture: true,
|
||||
});
|
||||
}
|
||||
|
||||
#addCopyPasteListeners() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue