mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
[JS] Run the named actions before running the format when the file is open (issue #15818)
It's a follow-up of #14950: some format actions are ran when the document is open but we must be sure we've everything ready for that, hence we have to run some named actions before runnig the global format. In playing with the form, I discovered that the blur event wasn't triggered when JS called `setFocus` (because in such a case the mouse was never down). So I removed the mouseState thing to just use the correct commitKey when blur is triggered by a TAB key.
This commit is contained in:
parent
2d596045d1
commit
2ebf8745a2
11 changed files with 182 additions and 159 deletions
|
@ -91,6 +91,10 @@ class EventDispatcher {
|
|||
if (id === "doc") {
|
||||
const eventName = event.name;
|
||||
if (eventName === "Open") {
|
||||
// Initialize named actions before calling formatAll to avoid any
|
||||
// errors in the case where a formatter is using one of those named
|
||||
// actions (see #15818).
|
||||
this._document.obj._initActions();
|
||||
// Before running the Open event, we format all the fields
|
||||
// (see bug 1766987).
|
||||
this.formatAll();
|
||||
|
@ -264,6 +268,7 @@ class EventDispatcher {
|
|||
value: "",
|
||||
formattedValue: null,
|
||||
selRange: [0, 0],
|
||||
focus: true, // Stay in the field.
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue