[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:
Calixte Denizet 2022-01-08 17:57:06 +01:00
parent 922dac035c
commit 6ac296e48e
9 changed files with 254 additions and 45 deletions

View file

@ -151,6 +151,14 @@ class EventDispatcher {
value: savedChange.value,
selRange: [savedChange.selStart, savedChange.selEnd],
});
} else {
// Entry is not valid (rc == false) and it's a commit
// so just clear the field.
source.obj._send({
id: source.obj._id,
value: "",
selRange: [0, 0],
});
}
}
}