mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
[JS] Use beforeinput event to trigger a keystroke event in the sandbox
- it aims to fix issue #14307; - this event has been added recently in Firefox and we can now use it; - fix few bugs in aform.js or in annotation_layer.js; - add some integration tests to test keystroke events (see `AFSpecial_Keystroke`); - make dispatchEvent in the quickjs sandbox async.
This commit is contained in:
parent
922dac035c
commit
6ac296e48e
9 changed files with 254 additions and 45 deletions
|
@ -466,6 +466,10 @@ class AForm {
|
|||
|
||||
const event = globalThis.event;
|
||||
const value = this.AFMergeChange(event);
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
|
||||
const checkers = new Map([
|
||||
["9", char => char >= "0" && char <= "9"],
|
||||
[
|
||||
|
@ -498,10 +502,6 @@ class AForm {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
|
||||
const err = `${GlobalConstants.IDS_INVALID_VALUE} = "${cMask}"`;
|
||||
|
||||
if (value.length > cMask.length) {
|
||||
|
@ -538,10 +538,6 @@ class AForm {
|
|||
|
||||
AFSpecial_Keystroke(psf) {
|
||||
const event = globalThis.event;
|
||||
if (!event.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
psf = this.AFMakeNumber(psf);
|
||||
|
||||
let formatStr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue