mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
JS - Collect and execute actions at doc and pages level
* the goal is to execute actions like Open or OpenAction * can be tested with issue6106.pdf (auto-print) * once #12701 is merged, we can add page actions
This commit is contained in:
parent
142f131ee1
commit
1e2173f038
18 changed files with 829 additions and 125 deletions
|
@ -51,6 +51,7 @@ function initSandbox(params) {
|
|||
const { data } = params;
|
||||
const doc = new Doc({
|
||||
send,
|
||||
globalEval,
|
||||
...data.docInfo,
|
||||
});
|
||||
const _document = { obj: doc, wrapped: new Proxy(doc, proxyHandler) };
|
||||
|
@ -67,16 +68,17 @@ function initSandbox(params) {
|
|||
const util = new Util({ externalCall });
|
||||
const aform = new AForm(doc, app, util);
|
||||
|
||||
for (const [name, objs] of Object.entries(data.objects)) {
|
||||
const obj = objs[0];
|
||||
obj.send = send;
|
||||
obj.globalEval = globalEval;
|
||||
obj.doc = _document.wrapped;
|
||||
obj.globalEval = globalEval;
|
||||
const field = new Field(obj);
|
||||
const wrapped = new Proxy(field, proxyHandler);
|
||||
doc._addField(name, wrapped);
|
||||
app._objects[obj.id] = { obj: field, wrapped };
|
||||
if (data.objects) {
|
||||
for (const [name, objs] of Object.entries(data.objects)) {
|
||||
const obj = objs[0];
|
||||
obj.send = send;
|
||||
obj.globalEval = globalEval;
|
||||
obj.doc = _document.wrapped;
|
||||
const field = new Field(obj);
|
||||
const wrapped = new Proxy(field, proxyHandler);
|
||||
doc._addField(name, wrapped);
|
||||
app._objects[obj.id] = { obj: field, wrapped };
|
||||
}
|
||||
}
|
||||
|
||||
globalThis.event = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue