mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
[api-minor] Add more general OpenAction support (PR 10334 follow-up, issue 11642)
This patch deprecates the existing `getOpenActionDestination` API method, in favor of a better and more general `getOpenAction` method instead. (For now JavaScript actions, related to printing, are still handled as before.) By clearly separating "regular" Print actions from the JavaScript handling, it's thus possible to get rid of the somewhat annoying and strictly incorrect warning when the viewer loads.
This commit is contained in:
parent
25693c6b6d
commit
01fb309a2a
5 changed files with 117 additions and 97 deletions
|
@ -668,11 +668,18 @@ class PDFDocumentProxy {
|
|||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise} A promise that is resolved with an {Array} containing
|
||||
* the destination, or `null` when no open action is present in the PDF.
|
||||
* @returns {Promise} A promise that is resolved with an {Object} containing
|
||||
* the currently supported actions, or `null` when no OpenAction exists.
|
||||
*/
|
||||
getOpenAction() {
|
||||
return this._transport.getOpenAction();
|
||||
}
|
||||
|
||||
getOpenActionDestination() {
|
||||
return this._transport.getOpenActionDestination();
|
||||
deprecated("getOpenActionDestination, use getOpenAction instead.");
|
||||
return this.getOpenAction().then(function(openAction) {
|
||||
return openAction && openAction.dest ? openAction.dest : null;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2518,11 +2525,8 @@ class WorkerTransport {
|
|||
return this.messageHandler.sendWithPromise("GetViewerPreferences", null);
|
||||
}
|
||||
|
||||
getOpenActionDestination() {
|
||||
return this.messageHandler.sendWithPromise(
|
||||
"GetOpenActionDestination",
|
||||
null
|
||||
);
|
||||
getOpenAction() {
|
||||
return this.messageHandler.sendWithPromise("GetOpenAction", null);
|
||||
}
|
||||
|
||||
getAttachments() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue