From 8c4821ceda4cc70d478b471f4174972c25a38437 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 18 May 2023 22:23:42 +0200 Subject: [PATCH] [api-minor] Slightly shorten the marked-content ids used in the textLayer Generally we try to keep the ids that we create short, hence we can slightly shorten the "static" parts of them. --- src/core/document.js | 2 +- src/core/evaluator.js | 2 +- src/core/struct_tree.js | 2 +- test/unit/api_spec.js | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/document.js b/src/core/document.js index 0180f34a2..994df897c 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -102,7 +102,7 @@ class Page { } static getPageObjId() { - return `page${ref.toString()}`; + return `p${ref.toString()}`; } }; } diff --git a/src/core/evaluator.js b/src/core/evaluator.js index b52de0610..add7f92e1 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -3343,7 +3343,7 @@ class PartialEvaluator { textContent.items.push({ type: "beginMarkedContentProps", id: Number.isInteger(mcid) - ? `${self.idFactory.getPageObjId()}_mcid${mcid}` + ? `${self.idFactory.getPageObjId()}_mc${mcid}` : null, tag: args[0] instanceof Name ? args[0].name : null, }); diff --git a/src/core/struct_tree.js b/src/core/struct_tree.js index 218aeba7d..0f576dbcf 100644 --- a/src/core/struct_tree.js +++ b/src/core/struct_tree.js @@ -315,7 +315,7 @@ class StructTreePage { ) { obj.children.push({ type: "content", - id: `page${kid.pageObjId}_mcid${kid.mcid}`, + id: `p${kid.pageObjId}_mc${kid.mcid}`, }); } else if (kid.type === StructElementType.OBJECT) { obj.children.push({ diff --git a/test/unit/api_spec.js b/test/unit/api_spec.js index c6487c105..f3e7453bf 100644 --- a/test/unit/api_spec.js +++ b/test/unit/api_spec.js @@ -2745,7 +2745,7 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`) children: [ { role: "NonStruct", - children: [{ type: "content", id: "page2R_mcid0" }], + children: [{ type: "content", id: "p2R_mc0" }], }, ], }, @@ -2754,7 +2754,7 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`) children: [ { role: "NonStruct", - children: [{ type: "content", id: "page2R_mcid1" }], + children: [{ type: "content", id: "p2R_mc1" }], }, ], }, @@ -2763,7 +2763,7 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`) children: [ { role: "NonStruct", - children: [{ type: "content", id: "page2R_mcid2" }], + children: [{ type: "content", id: "p2R_mc2" }], }, ], }, @@ -2772,7 +2772,7 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`) children: [ { role: "NonStruct", - children: [{ type: "content", id: "page2R_mcid3" }], + children: [{ type: "content", id: "p2R_mc3" }], }, ], },