mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Merge pull request #16761 from calixteman/editor_add_new_with_keyboard
[Editor] Add the possibility to create a new editor in using the keyboard (bug 1853424)
This commit is contained in:
commit
905ad1fe68
5 changed files with 218 additions and 9 deletions
|
@ -2208,7 +2208,7 @@ class PDFViewer {
|
|||
/**
|
||||
* @param {number} mode - AnnotationEditor mode (None, FreeText, Ink, ...)
|
||||
*/
|
||||
set annotationEditorMode({ mode, editId = null }) {
|
||||
set annotationEditorMode({ mode, editId = null, isFromKeyboard = false }) {
|
||||
if (!this.#annotationEditorUIManager) {
|
||||
throw new Error(`The AnnotationEditor is not enabled.`);
|
||||
}
|
||||
|
@ -2227,7 +2227,7 @@ class PDFViewer {
|
|||
mode,
|
||||
});
|
||||
|
||||
this.#annotationEditorUIManager.updateMode(mode, editId);
|
||||
this.#annotationEditorUIManager.updateMode(mode, editId, isFromKeyboard);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line accessor-pairs
|
||||
|
|
|
@ -162,7 +162,12 @@ class Toolbar {
|
|||
for (const { element, eventName, eventDetails } of this.buttons) {
|
||||
element.addEventListener("click", evt => {
|
||||
if (eventName !== null) {
|
||||
this.eventBus.dispatch(eventName, { source: this, ...eventDetails });
|
||||
this.eventBus.dispatch(eventName, {
|
||||
source: this,
|
||||
...eventDetails,
|
||||
// evt.detail is the number of clicks.
|
||||
isFromKeyboard: evt.detail === 0,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue