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.
This commit is contained in:
Jonas Jenwald 2022-12-19 01:04:04 +01:00
parent 6a9a567670
commit e8c7278337

View File

@ -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();
},
};
};