1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Use the string value of the field when calling the Format callback (bug 1889122)

This commit is contained in:
Calixte Denizet 2024-04-03 22:24:17 +02:00
parent 25f6a0c139
commit b643c0fcfb
6 changed files with 85 additions and 3 deletions

View file

@ -58,6 +58,19 @@ class PDFScriptingManager {
this.#eventBus = eventBus;
this.#externalServices = externalServices;
this.#docProperties = docProperties;
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("TESTING")) {
Object.defineProperty(this, "sandboxTrip", {
value: () =>
setTimeout(
() =>
this.#scripting?.dispatchEventInSandbox({
name: "sandboxtripbegin",
}),
0
),
});
}
}
setViewer(pdfViewer) {
@ -258,6 +271,17 @@ class PDFScriptingManager {
const { id, siblings, command, value } = detail;
if (!id) {
if (
typeof PDFJSDev !== "undefined" &&
PDFJSDev.test("TESTING") &&
command === "sandboxTripEnd"
) {
window.setTimeout(() => {
window.dispatchEvent(new CustomEvent("sandboxtripend"));
}, 0);
return;
}
switch (command) {
case "clear":
console.clear();