Merge pull request #15788 from Snuffleupagus/web-small-fixes

A few small viewer-related fixes
This commit is contained in:
Jonas Jenwald 2022-12-08 18:05:37 +01:00 committed by GitHub
commit ba2fec9891
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 12 deletions

View File

@ -16,12 +16,9 @@
/** @typedef {import("../src/display/api").PDFPageProxy} PDFPageProxy */ /** @typedef {import("../src/display/api").PDFPageProxy} PDFPageProxy */
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
/** @typedef {import("../src/display/display_utils").PageViewport} PageViewport */ /** @typedef {import("../src/display/display_utils").PageViewport} PageViewport */
/** @typedef {import("./interfaces").IPDFLinkService} IPDFLinkService */
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
/** @typedef {import("../src/display/editor/tools.js").AnnotationEditorUIManager} AnnotationEditorUIManager */ /** @typedef {import("../src/display/editor/tools.js").AnnotationEditorUIManager} AnnotationEditorUIManager */
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
/** @typedef {import("../annotation_storage.js").AnnotationStorage} AnnotationStorage */
// eslint-disable-next-line max-len
/** @typedef {import("./text_accessibility.js").TextAccessibilityManager} TextAccessibilityManager */ /** @typedef {import("./text_accessibility.js").TextAccessibilityManager} TextAccessibilityManager */
/** @typedef {import("./interfaces").IL10n} IL10n */ /** @typedef {import("./interfaces").IL10n} IL10n */
@ -30,13 +27,11 @@ import { NullL10n } from "./l10n_utils.js";
/** /**
* @typedef {Object} AnnotationEditorLayerBuilderOptions * @typedef {Object} AnnotationEditorLayerBuilderOptions
* @property {number} mode - Editor mode * @property {AnnotationEditorUIManager} [uiManager]
* @property {HTMLDivElement} pageDiv * @property {HTMLDivElement} pageDiv
* @property {PDFPageProxy} pdfPage * @property {PDFPageProxy} pdfPage
* @property {TextAccessibilityManager} accessibilityManager * @property {IL10n} l10n
* @property {AnnotationStorage} annotationStorage * @property {TextAccessibilityManager} [accessibilityManager]
* @property {IL10n} l10n - Localization service.
* @property {AnnotationEditorUIManager} uiManager
*/ */
class AnnotationEditorLayerBuilder { class AnnotationEditorLayerBuilder {
@ -48,7 +43,6 @@ class AnnotationEditorLayerBuilder {
constructor(options) { constructor(options) {
this.pageDiv = options.pageDiv; this.pageDiv = options.pageDiv;
this.pdfPage = options.pdfPage; this.pdfPage = options.pdfPage;
this.annotationStorage = options.annotationStorage || null;
this.accessibilityManager = options.accessibilityManager; this.accessibilityManager = options.accessibilityManager;
this.l10n = options.l10n || NullL10n; this.l10n = options.l10n || NullL10n;
this.annotationEditorLayer = null; this.annotationEditorLayer = null;
@ -86,9 +80,8 @@ class AnnotationEditorLayerBuilder {
this.annotationEditorLayer = new AnnotationEditorLayer({ this.annotationEditorLayer = new AnnotationEditorLayer({
uiManager: this.#uiManager, uiManager: this.#uiManager,
div: this.div, div: this.div,
annotationStorage: this.annotationStorage,
accessibilityManager: this.accessibilityManager, accessibilityManager: this.accessibilityManager,
pageIndex: this.pdfPage._pageIndex, pageIndex: this.pdfPage.pageNumber - 1,
l10n: this.l10n, l10n: this.l10n,
viewport: clonedViewport, viewport: clonedViewport,
}); });

View File

@ -1676,7 +1676,7 @@ class PDFViewer {
return new TextHighlighter({ return new TextHighlighter({
eventBus, eventBus,
pageIndex, pageIndex,
findController: this.isInPresentationMode ? null : this.findController, findController: this.findController,
}); });
} }