From e8c7278337589d9498d2a514f10337faf87324aa Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Mon, 19 Dec 2022 01:04:04 +0100 Subject: [PATCH 1/2] Improve the `linkService` handling in the `DEFAULT_LAYER_PROPERTIES` (PR 15811 follow-up) We'll no longer import the `SimpleLinkService` dependency unconditionally in the file, since it's only used in COMPONENTS-builds. Furthermore, for the COMPONENTS-builds, we'll create a `SimpleLinkService`-instance only for those layers that actually need it. --- web/pdf_page_view.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/pdf_page_view.js b/web/pdf_page_view.js index 0cff72159..92fff4651 100644 --- a/web/pdf_page_view.js +++ b/web/pdf_page_view.js @@ -47,7 +47,6 @@ import { AnnotationEditorLayerBuilder } from "./annotation_editor_layer_builder. import { AnnotationLayerBuilder } from "./annotation_layer_builder.js"; import { compatibilityParams } from "./app_options.js"; import { NullL10n } from "./l10n_utils.js"; -import { SimpleLinkService } from "./pdf_link_service.js"; import { StructTreeLayerBuilder } from "./struct_tree_layer_builder.js"; import { TextAccessibilityManager } from "./text_accessibility.js"; import { TextHighlighter } from "./text_highlighter.js"; @@ -104,7 +103,10 @@ const DEFAULT_LAYER_PROPERTIES = () => { fieldObjectsPromise: null, findController: null, hasJSActionsPromise: null, - linkService: new SimpleLinkService(), + get linkService() { + const { SimpleLinkService } = require("./pdf_link_service.js"); + return new SimpleLinkService(); + }, }; }; From f3d7f2e64f7644ceee4259d71a2d513eeb805ae6 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Mon, 19 Dec 2022 01:10:11 +0100 Subject: [PATCH 2/2] Fix the `loadingBar` initialization in the "mobile-viewer" example (PR 15831 follow-up) Given that the `ProgressBar`-constructor was updated, we need to update the "mobile-viewer" example as well; this is yet another thing I missed during review. --- examples/mobile-viewer/viewer.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/mobile-viewer/viewer.js b/examples/mobile-viewer/viewer.js index 4eb31e685..2cc44d311 100644 --- a/examples/mobile-viewer/viewer.js +++ b/examples/mobile-viewer/viewer.js @@ -161,9 +161,12 @@ const PDFViewerApplication = { }, get loadingBar() { - const bar = new pdfjsViewer.ProgressBar("loadingBar"); - - return pdfjsLib.shadow(this, "loadingBar", bar); + const bar = document.getElementById("loadingBar"); + return pdfjsLib.shadow( + this, + "loadingBar", + new pdfjsViewer.ProgressBar(bar) + ); }, setTitleUsingUrl: function pdfViewSetTitleUsingUrl(url) {