mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +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
|
@ -65,12 +65,28 @@ class EventDispatcher {
|
|||
dispatch(baseEvent) {
|
||||
const id = baseEvent.id;
|
||||
if (!(id in this._objects)) {
|
||||
let event;
|
||||
if (id === "doc" || id === "page") {
|
||||
event = globalThis.event = new Event(baseEvent);
|
||||
event.source = event.target = this._document.wrapped;
|
||||
event.name = baseEvent.name;
|
||||
}
|
||||
if (id === "doc") {
|
||||
this._document.obj._dispatchDocEvent(event.name);
|
||||
}
|
||||
if (id === "page") {
|
||||
this._document.obj._dispatchPageEvent(
|
||||
event.name,
|
||||
baseEvent.action,
|
||||
baseEvent.pageNumber
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const name = baseEvent.name.replace(" ", "");
|
||||
const source = this._objects[id];
|
||||
globalThis.event = new Event(baseEvent);
|
||||
const event = (globalThis.event = new Event(baseEvent));
|
||||
let savedChange;
|
||||
|
||||
if (source.obj._isButton()) {
|
||||
|
@ -156,7 +172,7 @@ class EventDispatcher {
|
|||
const first = this._calculationOrder[0];
|
||||
const source = this._objects[first];
|
||||
globalThis.event = new Event({});
|
||||
this.runCalculate(source, event);
|
||||
this.runCalculate(source, globalThis.event);
|
||||
}
|
||||
|
||||
runCalculate(source, event) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue