mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 17:55:37 +02:00
JS -- Add support for buttons
* radio buttons * checkboxes
This commit is contained in:
parent
9c99df7cac
commit
7c3facb174
10 changed files with 280 additions and 24 deletions
|
@ -26,12 +26,12 @@ import {
|
|||
Trans,
|
||||
ZoomType,
|
||||
} from "./constants.js";
|
||||
import { CheckboxField, Field, RadioButtonField } from "./field.js";
|
||||
import { AForm } from "./aform.js";
|
||||
import { App } from "./app.js";
|
||||
import { Color } from "./color.js";
|
||||
import { Console } from "./console.js";
|
||||
import { Doc } from "./doc.js";
|
||||
import { Field } from "./field.js";
|
||||
import { ProxyHandler } from "./proxy.js";
|
||||
import { Util } from "./util.js";
|
||||
|
||||
|
@ -74,10 +74,23 @@ function initSandbox(params) {
|
|||
obj.send = send;
|
||||
obj.globalEval = globalEval;
|
||||
obj.doc = _document.wrapped;
|
||||
const field = new Field(obj);
|
||||
let field;
|
||||
if (obj.type === "radiobutton") {
|
||||
const otherButtons = objs.slice(1);
|
||||
field = new RadioButtonField(otherButtons, obj);
|
||||
} else if (obj.type === "checkbox") {
|
||||
const otherButtons = objs.slice(1);
|
||||
field = new CheckboxField(otherButtons, obj);
|
||||
} else {
|
||||
field = new Field(obj);
|
||||
}
|
||||
|
||||
const wrapped = new Proxy(field, proxyHandler);
|
||||
doc._addField(name, wrapped);
|
||||
app._objects[obj.id] = { obj: field, wrapped };
|
||||
const _object = { obj: field, wrapped };
|
||||
for (const object of objs) {
|
||||
app._objects[object.id] = _object;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue