mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +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
|
@ -14,6 +14,7 @@
|
|||
*/
|
||||
|
||||
import { Color } from "./color.js";
|
||||
import { createActionsMap } from "./common.js";
|
||||
import { PDFObject } from "./pdf_object.js";
|
||||
|
||||
class Field extends PDFObject {
|
||||
|
@ -72,7 +73,7 @@ class Field extends PDFObject {
|
|||
|
||||
// Private
|
||||
this._document = data.doc;
|
||||
this._actions = this._createActionsMap(data.actions);
|
||||
this._actions = createActionsMap(data.actions);
|
||||
|
||||
this._fillColor = data.fillColor || ["T"];
|
||||
this._strokeColor = data.strokeColor || ["G", 0];
|
||||
|
@ -133,16 +134,6 @@ class Field extends PDFObject {
|
|||
this._send({ id: this._id, focus: true });
|
||||
}
|
||||
|
||||
_createActionsMap(actions) {
|
||||
const actionsMap = new Map();
|
||||
if (actions) {
|
||||
for (const [eventType, actionsForEvent] of Object.entries(actions)) {
|
||||
actionsMap.set(eventType, actionsForEvent);
|
||||
}
|
||||
}
|
||||
return actionsMap;
|
||||
}
|
||||
|
||||
_isButton() {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue