1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Merge pull request #12552 from Snuffleupagus/annotation-fixes

Miscellaneous (small) improvements in `src/core/annotation.js`
This commit is contained in:
Tim van der Meij 2020-10-31 00:41:39 +01:00 committed by GitHub
commit 46e60a266c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 22 deletions

View file

@ -25,7 +25,7 @@ import {
isBool,
isNum,
isString,
objectFromEntries,
objectSize,
PermissionFlag,
shadow,
stringToPDFString,
@ -828,7 +828,7 @@ class Catalog {
*/
get openAction() {
const obj = this._catDict.get("OpenAction");
const openActionMap = new Map();
const openAction = Object.create(null);
if (isDict(obj)) {
// Convert the OpenAction dictionary into a format that works with
@ -840,17 +840,17 @@ class Catalog {
Catalog.parseDestDictionary({ destDict, resultObj });
if (Array.isArray(resultObj.dest)) {
openActionMap.set("dest", resultObj.dest);
openAction.dest = resultObj.dest;
} else if (resultObj.action) {
openActionMap.set("action", resultObj.action);
openAction.action = resultObj.action;
}
} else if (Array.isArray(obj)) {
openActionMap.set("dest", obj);
openAction.dest = obj;
}
return shadow(
this,
"openAction",
openActionMap.size > 0 ? objectFromEntries(openActionMap) : null
objectSize(openAction) > 0 ? openAction : null
);
}