[api-minor] Change the various factories, in the viewer, to accept Objects

Currently all of these factories take a bunch of (randomly ordered) parameters, which first of all doesn't look that nice in the `PDFPageView`-class when some parameters are optional.
Furthermore, it also makes deprecation/removal of any existing parameter a *potentially* breaking change.
Finally, using an Object will provide a small amount of "documentation" at the call-site which isn't really the case with a bunch of "regular" parameters.

Note that all of the `viewer component` examples still work as-is with this patch, which is why I don't believe that we necessarily have to deprecate in the usual fashion.
This commit is contained in:
Jonas Jenwald 2022-07-29 14:47:57 +02:00
parent 80689c6444
commit 2e059727a9
4 changed files with 250 additions and 175 deletions

View File

@ -1632,22 +1632,27 @@ class BaseViewer {
} }
/** /**
* @param {HTMLDivElement} textLayerDiv * @typedef {Object} CreateTextLayerBuilderParameters
* @param {number} pageIndex * @property {HTMLDivElement} textLayerDiv
* @param {PageViewport} viewport * @property {number} pageIndex
* @param {boolean} enhanceTextSelection * @property {PageViewport} viewport
* @param {EventBus} eventBus * @property {boolean} [enhanceTextSelection]
* @param {TextHighlighter} highlighter * @property {EventBus} eventBus
* @property {TextHighlighter} highlighter
*/
/**
* @param {CreateTextLayerBuilderParameters}
* @returns {TextLayerBuilder} * @returns {TextLayerBuilder}
*/ */
createTextLayerBuilder( createTextLayerBuilder({
textLayerDiv, textLayerDiv,
pageIndex, pageIndex,
viewport, viewport,
enhanceTextSelection = false, enhanceTextSelection = false,
eventBus, eventBus,
highlighter highlighter,
) { }) {
return new TextLayerBuilder({ return new TextLayerBuilder({
textLayerDiv, textLayerDiv,
eventBus, eventBus,
@ -1661,11 +1666,16 @@ class BaseViewer {
} }
/** /**
* @param {number} pageIndex * @typedef {Object} CreateTextHighlighterParameters
* @param {EventBus} eventBus * @property {number} pageIndex
* @property {EventBus} eventBus
*/
/**
* @param {CreateTextHighlighterParameters}
* @returns {TextHighlighter} * @returns {TextHighlighter}
*/ */
createTextHighlighter(pageIndex, eventBus) { createTextHighlighter({ pageIndex, eventBus }) {
return new TextHighlighter({ return new TextHighlighter({
eventBus, eventBus,
pageIndex, pageIndex,
@ -1674,101 +1684,123 @@ class BaseViewer {
} }
/** /**
* @param {HTMLDivElement} pageDiv * @typedef {Object} CreateAnnotationLayerBuilderParameters
* @param {PDFPageProxy} pdfPage * @property {HTMLDivElement} pageDiv
* @param {AnnotationStorage} [annotationStorage] - Storage for annotation * @property {PDFPageProxy} pdfPage
* @property {AnnotationStorage} [annotationStorage] - Storage for annotation
* data in forms. * data in forms.
* @param {string} [imageResourcesPath] - Path for image resources, mainly * @property {string} [imageResourcesPath] - Path for image resources, mainly
* for annotation icons. Include trailing slash. * for annotation icons. Include trailing slash.
* @param {boolean} renderForms * @property {boolean} renderForms
* @param {IL10n} l10n * @property {IL10n} l10n
* @param {boolean} [enableScripting] * @property {boolean} [enableScripting]
* @param {Promise<boolean>} [hasJSActionsPromise] * @property {Promise<boolean>} [hasJSActionsPromise]
* @param {Object} [mouseState] * @property {Object} [mouseState]
* @param {Promise<Object<string, Array<Object>> | null>} * @property {Promise<Object<string, Array<Object>> | null>}
* [fieldObjectsPromise] * [fieldObjectsPromise]
* @param {Map<string, HTMLCanvasElement>} [annotationCanvasMap] * @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap] - Map some
* annotation ids with canvases used to render them.
*/
/**
* @param {CreateAnnotationLayerBuilderParameters}
* @returns {AnnotationLayerBuilder} * @returns {AnnotationLayerBuilder}
*/ */
createAnnotationLayerBuilder( createAnnotationLayerBuilder({
pageDiv, pageDiv,
pdfPage, pdfPage,
annotationStorage = null, annotationStorage = this.pdfDocument?.annotationStorage,
imageResourcesPath = "", imageResourcesPath = "",
renderForms = true, renderForms = true,
l10n = NullL10n, l10n = NullL10n,
enableScripting = null, enableScripting = this.enableScripting,
hasJSActionsPromise = null, hasJSActionsPromise = this.pdfDocument?.hasJSActions(),
mouseState = null, mouseState = this._scriptingManager?.mouseState,
fieldObjectsPromise = null, fieldObjectsPromise = this.pdfDocument?.getFieldObjects(),
annotationCanvasMap = null annotationCanvasMap = null,
) { }) {
return new AnnotationLayerBuilder({ return new AnnotationLayerBuilder({
pageDiv, pageDiv,
pdfPage, pdfPage,
annotationStorage: annotationStorage,
annotationStorage || this.pdfDocument?.annotationStorage,
imageResourcesPath, imageResourcesPath,
renderForms, renderForms,
linkService: this.linkService, linkService: this.linkService,
downloadManager: this.downloadManager, downloadManager: this.downloadManager,
l10n, l10n,
enableScripting: enableScripting ?? this.enableScripting, enableScripting,
hasJSActionsPromise: hasJSActionsPromise,
hasJSActionsPromise || this.pdfDocument?.hasJSActions(), mouseState,
fieldObjectsPromise: fieldObjectsPromise,
fieldObjectsPromise || this.pdfDocument?.getFieldObjects(),
mouseState: mouseState || this._scriptingManager?.mouseState,
annotationCanvasMap, annotationCanvasMap,
}); });
} }
/** /**
* @param {HTMLDivElement} pageDiv * @typedef {Object} CreateAnnotationEditorLayerBuilderParameters
* @param {PDFPageProxy} pdfPage * @property {AnnotationEditorUIManager} [uiManager]
* @param {IL10n} l10n * @property {HTMLDivElement} pageDiv
* @param {AnnotationStorage} [annotationStorage] - Storage for annotation * @property {PDFPageProxy} pdfPage
* @property {IL10n} l10n
* @property {AnnotationStorage} [annotationStorage] - Storage for annotation
* data in forms. * data in forms.
*/
/**
* @param {CreateAnnotationEditorLayerBuilderParameters}
* @returns {AnnotationEditorLayerBuilder} * @returns {AnnotationEditorLayerBuilder}
*/ */
createAnnotationEditorLayerBuilder( createAnnotationEditorLayerBuilder({
uiManager = this.#annotationEditorUIManager,
pageDiv, pageDiv,
pdfPage, pdfPage,
l10n, l10n,
annotationStorage = null annotationStorage = this.pdfDocument?.annotationStorage,
) { }) {
return new AnnotationEditorLayerBuilder({ return new AnnotationEditorLayerBuilder({
uiManager: this.#annotationEditorUIManager, uiManager,
pageDiv, pageDiv,
pdfPage, pdfPage,
annotationStorage: annotationStorage,
annotationStorage || this.pdfDocument?.annotationStorage,
l10n, l10n,
}); });
} }
/** /**
* @param {HTMLDivElement} pageDiv * @typedef {Object} CreateXfaLayerBuilderParameters
* @param {PDFPageProxy} pdfPage * @property {HTMLDivElement} pageDiv
* @param {AnnotationStorage} [annotationStorage] - Storage for annotation * @property {PDFPageProxy} pdfPage
* @property {AnnotationStorage} [annotationStorage] - Storage for annotation
* data in forms. * data in forms.
*/
/**
* @param {CreateXfaLayerBuilderParameters}
* @returns {XfaLayerBuilder} * @returns {XfaLayerBuilder}
*/ */
createXfaLayerBuilder(pageDiv, pdfPage, annotationStorage = null) { createXfaLayerBuilder({
pageDiv,
pdfPage,
annotationStorage = this.pdfDocument?.annotationStorage,
}) {
return new XfaLayerBuilder({ return new XfaLayerBuilder({
pageDiv, pageDiv,
pdfPage, pdfPage,
annotationStorage: annotationStorage,
annotationStorage || this.pdfDocument?.annotationStorage,
linkService: this.linkService, linkService: this.linkService,
}); });
} }
/** /**
* @param {PDFPageProxy} pdfPage * @typedef {Object} CreateStructTreeLayerBuilderParameters
* @property {PDFPageProxy} pdfPage
*/
/**
* @param {CreateStructTreeLayerBuilderParameters}
* @returns {StructTreeLayerBuilder} * @returns {StructTreeLayerBuilder}
*/ */
createStructTreeLayerBuilder(pdfPage) { createStructTreeLayerBuilder({ pdfPage }) {
return new StructTreeLayerBuilder({ return new StructTreeLayerBuilder({
pdfPage, pdfPage,
}); });

View File

@ -44,23 +44,29 @@ import { XfaLayerBuilder } from "./xfa_layer_builder.js";
*/ */
class DefaultAnnotationLayerFactory { class DefaultAnnotationLayerFactory {
/** /**
* @param {HTMLDivElement} pageDiv * @typedef {Object} CreateAnnotationLayerBuilderParameters
* @param {PDFPageProxy} pdfPage * @property {HTMLDivElement} pageDiv
* @param {AnnotationStorage} [annotationStorage] * @property {PDFPageProxy} pdfPage
* @param {string} [imageResourcesPath] - Path for image resources, mainly * @property {AnnotationStorage} [annotationStorage] - Storage for annotation
* data in forms.
* @property {string} [imageResourcesPath] - Path for image resources, mainly
* for annotation icons. Include trailing slash. * for annotation icons. Include trailing slash.
* @param {boolean} renderForms * @property {boolean} renderForms
* @param {IL10n} l10n * @property {IL10n} l10n
* @param {boolean} [enableScripting] * @property {boolean} [enableScripting]
* @param {Promise<boolean>} [hasJSActionsPromise] * @property {Promise<boolean>} [hasJSActionsPromise]
* @param {Object} [mouseState] * @property {Object} [mouseState]
* @param {Promise<Object<string, Array<Object>> | null>} * @property {Promise<Object<string, Array<Object>> | null>}
* [fieldObjectsPromise] * [fieldObjectsPromise]
* @param {Map<string, HTMLCanvasElement>} [annotationCanvasMap] - Map some * @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap] - Map some
* annotation ids with canvases used to render them. * annotation ids with canvases used to render them.
*/
/**
* @param {CreateAnnotationLayerBuilderParameters}
* @returns {AnnotationLayerBuilder} * @returns {AnnotationLayerBuilder}
*/ */
createAnnotationLayerBuilder( createAnnotationLayerBuilder({
pageDiv, pageDiv,
pdfPage, pdfPage,
annotationStorage = null, annotationStorage = null,
@ -71,8 +77,8 @@ class DefaultAnnotationLayerFactory {
hasJSActionsPromise = null, hasJSActionsPromise = null,
mouseState = null, mouseState = null,
fieldObjectsPromise = null, fieldObjectsPromise = null,
annotationCanvasMap = null annotationCanvasMap = null,
) { }) {
return new AnnotationLayerBuilder({ return new AnnotationLayerBuilder({
pageDiv, pageDiv,
pdfPage, pdfPage,
@ -95,19 +101,28 @@ class DefaultAnnotationLayerFactory {
*/ */
class DefaultAnnotationEditorLayerFactory { class DefaultAnnotationEditorLayerFactory {
/** /**
* @param {HTMLDivElement} pageDiv * @typedef {Object} CreateAnnotationEditorLayerBuilderParameters
* @param {PDFPageProxy} pdfPage * @property {AnnotationEditorUIManager} [uiManager]
* @param {IL10n} l10n * @property {HTMLDivElement} pageDiv
* @param {AnnotationStorage} [annotationStorage] * @property {PDFPageProxy} pdfPage
* @property {IL10n} l10n
* @property {AnnotationStorage} [annotationStorage] - Storage for annotation
* data in forms.
*/
/**
* @param {CreateAnnotationEditorLayerBuilderParameters}
* @returns {AnnotationEditorLayerBuilder} * @returns {AnnotationEditorLayerBuilder}
*/ */
createAnnotationEditorLayerBuilder( createAnnotationEditorLayerBuilder({
uiManager = null,
pageDiv, pageDiv,
pdfPage, pdfPage,
l10n, l10n,
annotationStorage = null annotationStorage = null,
) { }) {
return new AnnotationEditorLayerBuilder({ return new AnnotationEditorLayerBuilder({
uiManager,
pageDiv, pageDiv,
pdfPage, pdfPage,
l10n, l10n,
@ -121,10 +136,15 @@ class DefaultAnnotationEditorLayerFactory {
*/ */
class DefaultStructTreeLayerFactory { class DefaultStructTreeLayerFactory {
/** /**
* @param {PDFPageProxy} pdfPage * @typedef {Object} CreateStructTreeLayerBuilderParameters
* @property {PDFPageProxy} pdfPage
*/
/**
* @param {CreateStructTreeLayerBuilderParameters}
* @returns {StructTreeLayerBuilder} * @returns {StructTreeLayerBuilder}
*/ */
createStructTreeLayerBuilder(pdfPage) { createStructTreeLayerBuilder({ pdfPage }) {
return new StructTreeLayerBuilder({ return new StructTreeLayerBuilder({
pdfPage, pdfPage,
}); });
@ -136,22 +156,27 @@ class DefaultStructTreeLayerFactory {
*/ */
class DefaultTextLayerFactory { class DefaultTextLayerFactory {
/** /**
* @param {HTMLDivElement} textLayerDiv * @typedef {Object} CreateTextLayerBuilderParameters
* @param {number} pageIndex * @property {HTMLDivElement} textLayerDiv
* @param {PageViewport} viewport * @property {number} pageIndex
* @param {boolean} enhanceTextSelection * @property {PageViewport} viewport
* @param {EventBus} eventBus * @property {boolean} [enhanceTextSelection]
* @param {TextHighlighter} highlighter * @property {EventBus} eventBus
* @property {TextHighlighter} highlighter
*/
/**
* @param {CreateTextLayerBuilderParameters}
* @returns {TextLayerBuilder} * @returns {TextLayerBuilder}
*/ */
createTextLayerBuilder( createTextLayerBuilder({
textLayerDiv, textLayerDiv,
pageIndex, pageIndex,
viewport, viewport,
enhanceTextSelection = false, enhanceTextSelection = false,
eventBus, eventBus,
highlighter highlighter,
) { }) {
return new TextLayerBuilder({ return new TextLayerBuilder({
textLayerDiv, textLayerDiv,
pageIndex, pageIndex,
@ -168,23 +193,23 @@ class DefaultTextLayerFactory {
*/ */
class DefaultXfaLayerFactory { class DefaultXfaLayerFactory {
/** /**
* @param {HTMLDivElement} pageDiv * @typedef {Object} CreateXfaLayerBuilderParameters
* @param {PDFPageProxy} pdfPage * @property {HTMLDivElement} pageDiv
* @param {AnnotationStorage} [annotationStorage] * @property {PDFPageProxy} pdfPage
* @param {Object} [xfaHtml] * @property {AnnotationStorage} [annotationStorage] - Storage for annotation
* data in forms.
*/ */
createXfaLayerBuilder(
pageDiv, /**
pdfPage, * @param {CreateXfaLayerBuilderParameters}
annotationStorage = null, * @returns {XfaLayerBuilder}
xfaHtml = null */
) { createXfaLayerBuilder({ pageDiv, pdfPage, annotationStorage = null }) {
return new XfaLayerBuilder({ return new XfaLayerBuilder({
pageDiv, pageDiv,
pdfPage, pdfPage,
annotationStorage, annotationStorage,
linkService: new SimpleLinkService(), linkService: new SimpleLinkService(),
xfaHtml,
}); });
} }
} }

View File

@ -155,22 +155,27 @@ class IRenderableView {
*/ */
class IPDFTextLayerFactory { class IPDFTextLayerFactory {
/** /**
* @param {HTMLDivElement} textLayerDiv * @typedef {Object} CreateTextLayerBuilderParameters
* @param {number} pageIndex * @property {HTMLDivElement} textLayerDiv
* @param {PageViewport} viewport * @property {number} pageIndex
* @param {boolean} enhanceTextSelection * @property {PageViewport} viewport
* @param {EventBus} eventBus * @property {boolean} [enhanceTextSelection]
* @param {TextHighlighter} highlighter * @property {EventBus} eventBus
* @property {TextHighlighter} highlighter
*/
/**
* @param {CreateTextLayerBuilderParameters}
* @returns {TextLayerBuilder} * @returns {TextLayerBuilder}
*/ */
createTextLayerBuilder( createTextLayerBuilder({
textLayerDiv, textLayerDiv,
pageIndex, pageIndex,
viewport, viewport,
enhanceTextSelection = false, enhanceTextSelection = false,
eventBus, eventBus,
highlighter highlighter,
) {} }) {}
} }
/** /**
@ -178,24 +183,29 @@ class IPDFTextLayerFactory {
*/ */
class IPDFAnnotationLayerFactory { class IPDFAnnotationLayerFactory {
/** /**
* @param {HTMLDivElement} pageDiv * @typedef {Object} CreateAnnotationLayerBuilderParameters
* @param {PDFPageProxy} pdfPage * @property {HTMLDivElement} pageDiv
* @param {AnnotationStorage} [annotationStorage] - Storage for annotation * @property {PDFPageProxy} pdfPage
* @property {AnnotationStorage} [annotationStorage] - Storage for annotation
* data in forms. * data in forms.
* @param {string} [imageResourcesPath] - Path for image resources, mainly * @property {string} [imageResourcesPath] - Path for image resources, mainly
* for annotation icons. Include trailing slash. * for annotation icons. Include trailing slash.
* @param {boolean} renderForms * @property {boolean} renderForms
* @param {IL10n} l10n * @property {IL10n} l10n
* @param {boolean} [enableScripting] * @property {boolean} [enableScripting]
* @param {Promise<boolean>} [hasJSActionsPromise] * @property {Promise<boolean>} [hasJSActionsPromise]
* @param {Object} [mouseState] * @property {Object} [mouseState]
* @param {Promise<Object<string, Array<Object>> | null>} * @property {Promise<Object<string, Array<Object>> | null>}
* [fieldObjectsPromise] * [fieldObjectsPromise]
* @param {Map<string, HTMLCanvasElement>} [annotationCanvasMap] - Map some * @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap] - Map some
* annotation ids with canvases used to render them. * annotation ids with canvases used to render them.
*/
/**
* @param {CreateAnnotationLayerBuilderParameters}
* @returns {AnnotationLayerBuilder} * @returns {AnnotationLayerBuilder}
*/ */
createAnnotationLayerBuilder( createAnnotationLayerBuilder({
pageDiv, pageDiv,
pdfPage, pdfPage,
annotationStorage = null, annotationStorage = null,
@ -206,8 +216,8 @@ class IPDFAnnotationLayerFactory {
hasJSActionsPromise = null, hasJSActionsPromise = null,
mouseState = null, mouseState = null,
fieldObjectsPromise = null, fieldObjectsPromise = null,
annotationCanvasMap = null annotationCanvasMap = null,
) {} }) {}
} }
/** /**
@ -215,19 +225,26 @@ class IPDFAnnotationLayerFactory {
*/ */
class IPDFAnnotationEditorLayerFactory { class IPDFAnnotationEditorLayerFactory {
/** /**
* @param {HTMLDivElement} pageDiv * @typedef {Object} CreateAnnotationEditorLayerBuilderParameters
* @param {PDFPageProxy} pdfPage * @property {AnnotationEditorUIManager} [uiManager]
* @param {IL10n} l10n * @property {HTMLDivElement} pageDiv
* @param {AnnotationStorage} [annotationStorage] - Storage for annotation * @property {PDFPageProxy} pdfPage
* @property {IL10n} l10n
* @property {AnnotationStorage} [annotationStorage] - Storage for annotation
* data in forms. * data in forms.
*/
/**
* @param {CreateAnnotationEditorLayerBuilderParameters}
* @returns {AnnotationEditorLayerBuilder} * @returns {AnnotationEditorLayerBuilder}
*/ */
createAnnotationEditorLayerBuilder( createAnnotationEditorLayerBuilder({
uiManager = null,
pageDiv, pageDiv,
pdfPage, pdfPage,
l10n = undefined, l10n,
annotationStorage = null annotationStorage = null,
) {} }) {}
} }
/** /**
@ -235,18 +252,18 @@ class IPDFAnnotationEditorLayerFactory {
*/ */
class IPDFXfaLayerFactory { class IPDFXfaLayerFactory {
/** /**
* @param {HTMLDivElement} pageDiv * @typedef {Object} CreateXfaLayerBuilderParameters
* @param {PDFPageProxy} pdfPage * @property {HTMLDivElement} pageDiv
* @param {AnnotationStorage} [annotationStorage] * @property {PDFPageProxy} pdfPage
* @param {Object} [xfaHtml] * @property {AnnotationStorage} [annotationStorage] - Storage for annotation
* data in forms.
*/
/**
* @param {CreateXfaLayerBuilderParameters}
* @returns {XfaLayerBuilder} * @returns {XfaLayerBuilder}
*/ */
createXfaLayerBuilder( createXfaLayerBuilder({ pageDiv, pdfPage, annotationStorage = null }) {}
pageDiv,
pdfPage,
annotationStorage = null,
xfaHtml = null
) {}
} }
/** /**
@ -254,10 +271,15 @@ class IPDFXfaLayerFactory {
*/ */
class IPDFStructTreeLayerFactory { class IPDFStructTreeLayerFactory {
/** /**
* @param {PDFPageProxy} pdfPage * @typedef {Object} CreateStructTreeLayerBuilderParameters
* @property {PDFPageProxy} pdfPage
*/
/**
* @param {CreateStructTreeLayerBuilderParameters}
* @returns {StructTreeLayerBuilder} * @returns {StructTreeLayerBuilder}
*/ */
createStructTreeLayerBuilder(pdfPage) {} createStructTreeLayerBuilder({ pdfPage }) {}
} }
/** /**

View File

@ -133,10 +133,10 @@ class PDFPageView {
this.annotationEditorLayerFactory = options.annotationEditorLayerFactory; this.annotationEditorLayerFactory = options.annotationEditorLayerFactory;
this.xfaLayerFactory = options.xfaLayerFactory; this.xfaLayerFactory = options.xfaLayerFactory;
this.textHighlighter = this.textHighlighter =
options.textHighlighterFactory?.createTextHighlighter( options.textHighlighterFactory?.createTextHighlighter({
this.id - 1, pageIndex: this.id - 1,
this.eventBus eventBus: this.eventBus,
); });
this.structTreeLayerFactory = options.structTreeLayerFactory; this.structTreeLayerFactory = options.structTreeLayerFactory;
if ( if (
typeof PDFJSDev === "undefined" || typeof PDFJSDev === "undefined" ||
@ -657,14 +657,15 @@ class PDFPageView {
div.append(textLayerDiv); div.append(textLayerDiv);
} }
textLayer = this.textLayerFactory.createTextLayerBuilder( textLayer = this.textLayerFactory.createTextLayerBuilder({
textLayerDiv, textLayerDiv,
this.id - 1, pageIndex: this.id - 1,
this.viewport, viewport: this.viewport,
enhanceTextSelection:
this.textLayerMode === TextLayerMode.ENABLE_ENHANCE, this.textLayerMode === TextLayerMode.ENABLE_ENHANCE,
this.eventBus, eventBus: this.eventBus,
this.textHighlighter highlighter: this.textHighlighter,
); });
} }
this.textLayer = textLayer; this.textLayer = textLayer;
@ -674,19 +675,14 @@ class PDFPageView {
) { ) {
this._annotationCanvasMap ||= new Map(); this._annotationCanvasMap ||= new Map();
this.annotationLayer ||= this.annotationLayer ||=
this.annotationLayerFactory.createAnnotationLayerBuilder( this.annotationLayerFactory.createAnnotationLayerBuilder({
div, pageDiv: div,
pdfPage, pdfPage,
/* annotationStorage = */ null, imageResourcesPath: this.imageResourcesPath,
this.imageResourcesPath, renderForms: this.#annotationMode === AnnotationMode.ENABLE_FORMS,
this.#annotationMode === AnnotationMode.ENABLE_FORMS, l10n: this.l10n,
this.l10n, annotationCanvasMap: this._annotationCanvasMap,
/* enableScripting = */ null, });
/* hasJSActionsPromise = */ null,
/* mouseState = */ null,
/* fieldObjectsPromise = */ null,
/* annotationCanvasMap */ this._annotationCanvasMap
);
} }
if (this.xfaLayer?.div) { if (this.xfaLayer?.div) {
@ -769,10 +765,11 @@ class PDFPageView {
if (this.annotationEditorLayerFactory) { if (this.annotationEditorLayerFactory) {
this.annotationEditorLayer ||= this.annotationEditorLayer ||=
this.annotationEditorLayerFactory.createAnnotationEditorLayerBuilder( this.annotationEditorLayerFactory.createAnnotationEditorLayerBuilder(
div, {
pageDiv: div,
pdfPage, pdfPage,
this.l10n, l10n: this.l10n,
/* annotationStorage = */ null }
); );
this._renderAnnotationEditorLayer(); this._renderAnnotationEditorLayer();
} }
@ -787,11 +784,10 @@ class PDFPageView {
if (this.xfaLayerFactory) { if (this.xfaLayerFactory) {
if (!this.xfaLayer) { if (!this.xfaLayer) {
this.xfaLayer = this.xfaLayerFactory.createXfaLayerBuilder( this.xfaLayer = this.xfaLayerFactory.createXfaLayerBuilder({
div, pageDiv: div,
pdfPage, pdfPage,
/* annotationStorage = */ null });
);
} }
this._renderXfaLayer(); this._renderXfaLayer();
} }
@ -825,7 +821,7 @@ class PDFPageView {
}; };
this.eventBus._on("textlayerrendered", this._onTextLayerRendered); this.eventBus._on("textlayerrendered", this._onTextLayerRendered);
this.structTreeLayer = this.structTreeLayer =
this.structTreeLayerFactory.createStructTreeLayerBuilder(pdfPage); this.structTreeLayerFactory.createStructTreeLayerBuilder({ pdfPage });
} }
div.setAttribute("data-loaded", true); div.setAttribute("data-loaded", true);