mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-02-08 00:21:11 +01:00
Remove the IPDFLinkService interface
Given that `SimpleLinkService` now extends the regular `PDFLinkService` class, see PR 18013, it should no longer be necessary to keep the interface-definition. This should help reduce the maintenance burden of the code, since you no longer need to remember to update separate code when touching the `PDFLinkService` class.
This commit is contained in:
parent
e4cd3176ab
commit
b517b5c597
@ -19,7 +19,6 @@
|
||||
/** @typedef {import("../../web/text_accessibility.js").TextAccessibilityManager} TextAccessibilityManager */
|
||||
// eslint-disable-next-line max-len
|
||||
/** @typedef {import("../../web/interfaces").IDownloadManager} IDownloadManager */
|
||||
/** @typedef {import("../../web/interfaces").IPDFLinkService} IPDFLinkService */
|
||||
// eslint-disable-next-line max-len
|
||||
/** @typedef {import("../src/display/editor/tools.js").AnnotationEditorUIManager} AnnotationEditorUIManager */
|
||||
// eslint-disable-next-line max-len
|
||||
@ -57,7 +56,7 @@ const TIMEZONE_OFFSET = new Date().getTimezoneOffset() * 60 * 1000;
|
||||
* @typedef {Object} AnnotationElementParameters
|
||||
* @property {Object} data
|
||||
* @property {HTMLDivElement} layer
|
||||
* @property {IPDFLinkService} linkService
|
||||
* @property {PDFLinkService} linkService
|
||||
* @property {IDownloadManager} [downloadManager]
|
||||
* @property {AnnotationStorage} [annotationStorage]
|
||||
* @property {string} [imageResourcesPath] - Path for image resources, mainly
|
||||
@ -3736,7 +3735,7 @@ class FileAttachmentAnnotationElement extends AnnotationElement {
|
||||
* @property {HTMLDivElement} div
|
||||
* @property {Array} annotations
|
||||
* @property {PDFPageProxy} page
|
||||
* @property {IPDFLinkService} linkService
|
||||
* @property {PDFLinkService} linkService
|
||||
* @property {IDownloadManager} [downloadManager]
|
||||
* @property {AnnotationStorage} [annotationStorage]
|
||||
* @property {string} [imageResourcesPath] - Path for image resources, mainly
|
||||
@ -4018,8 +4017,6 @@ class AnnotationLayer {
|
||||
* Add link annotations to the annotation layer.
|
||||
*
|
||||
* @param {Array<Object>} annotations
|
||||
* @param {IPDFLinkService} linkService
|
||||
* @memberof AnnotationLayer
|
||||
*/
|
||||
async addLinkAnnotations(annotations) {
|
||||
const elementParams = {
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
// eslint-disable-next-line max-len
|
||||
/** @typedef {import("./annotation_storage").AnnotationStorage} AnnotationStorage */
|
||||
/** @typedef {import("./display_utils").PageViewport} PageViewport */
|
||||
/** @typedef {import("../../web/interfaces").IPDFLinkService} IPDFLinkService */
|
||||
|
||||
import { XfaText } from "./xfa_text.js";
|
||||
|
||||
@ -26,7 +25,7 @@ import { XfaText } from "./xfa_text.js";
|
||||
* @property {HTMLDivElement} div
|
||||
* @property {Object} xfaHtml
|
||||
* @property {AnnotationStorage} [annotationStorage]
|
||||
* @property {IPDFLinkService} linkService
|
||||
* @property {PDFLinkService} linkService
|
||||
* @property {string} [intent] - (default value is 'display').
|
||||
*/
|
||||
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
// eslint-disable-next-line max-len
|
||||
/** @typedef {import("../src/display/annotation_storage").AnnotationStorage} AnnotationStorage */
|
||||
/** @typedef {import("./interfaces").IDownloadManager} IDownloadManager */
|
||||
/** @typedef {import("./interfaces").IPDFLinkService} IPDFLinkService */
|
||||
// eslint-disable-next-line max-len
|
||||
/** @typedef {import("./struct_tree_layer_builder.js").StructTreeLayerBuilder} StructTreeLayerBuilder */
|
||||
// eslint-disable-next-line max-len
|
||||
@ -43,7 +42,7 @@ import { PresentationModeState } from "./ui_utils.js";
|
||||
* @property {string} [imageResourcesPath] - Path for image resources, mainly
|
||||
* for annotation icons. Include trailing slash.
|
||||
* @property {boolean} renderForms
|
||||
* @property {IPDFLinkService} linkService
|
||||
* @property {PDFLinkService} linkService
|
||||
* @property {IDownloadManager} [downloadManager]
|
||||
* @property {boolean} [enableComment]
|
||||
* @property {boolean} [enableScripting]
|
||||
|
||||
@ -19,103 +19,6 @@
|
||||
/** @typedef {import("../src/display/display_utils").PageViewport} PageViewport */
|
||||
/** @typedef {import("./ui_utils").RenderingStates} RenderingStates */
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*/
|
||||
class IPDFLinkService {
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
get pagesCount() {}
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
get page() {}
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
*/
|
||||
set page(value) {}
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
get rotation() {}
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
*/
|
||||
set rotation(value) {}
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isInPresentationMode() {}
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
get externalLinkEnabled() {}
|
||||
|
||||
/**
|
||||
* @param {boolean} value
|
||||
*/
|
||||
set externalLinkEnabled(value) {}
|
||||
|
||||
/**
|
||||
* @param {string|Array} dest - The named, or explicit, PDF destination.
|
||||
*/
|
||||
async goToDestination(dest) {}
|
||||
|
||||
/**
|
||||
* @param {number|string} val - The page number, or page label.
|
||||
*/
|
||||
goToPage(val) {}
|
||||
|
||||
/**
|
||||
* Scrolls to a specific location in the PDF document.
|
||||
* @param {number} pageNumber - The page number to scroll to.
|
||||
* @param {number} x - The x-coordinate to scroll to in page coordinates.
|
||||
* @param {number} y - The y-coordinate to scroll to in page coordinates.
|
||||
*/
|
||||
goToXY(pageNumber, x, y) {}
|
||||
|
||||
/**
|
||||
* @param {HTMLAnchorElement} link
|
||||
* @param {string} url
|
||||
* @param {boolean} [newWindow]
|
||||
*/
|
||||
addLinkAttributes(link, url, newWindow = false) {}
|
||||
|
||||
/**
|
||||
* @param dest - The PDF destination object.
|
||||
* @returns {string} The hyperlink to the PDF object.
|
||||
*/
|
||||
getDestinationHash(dest) {}
|
||||
|
||||
/**
|
||||
* @param hash - The PDF parameters/hash.
|
||||
* @returns {string} The hyperlink to the PDF object.
|
||||
*/
|
||||
getAnchorUrl(hash) {}
|
||||
|
||||
/**
|
||||
* @param {string} hash
|
||||
*/
|
||||
setHash(hash) {}
|
||||
|
||||
/**
|
||||
* @param {string} action
|
||||
*/
|
||||
executeNamedAction(action) {}
|
||||
|
||||
/**
|
||||
* @param {Object} action
|
||||
*/
|
||||
executeSetOCGState(action) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*/
|
||||
@ -226,10 +129,4 @@ class IPDFPrintServiceFactory {
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
IDownloadManager,
|
||||
IL10n,
|
||||
IPDFLinkService,
|
||||
IPDFPrintServiceFactory,
|
||||
IRenderableView,
|
||||
};
|
||||
export { IDownloadManager, IL10n, IPDFPrintServiceFactory, IRenderableView };
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
|
||||
/** @typedef {import("../src/display/api").PDFDocumentProxy} PDFDocumentProxy */
|
||||
/** @typedef {import("./event_utils").EventBus} EventBus */
|
||||
/** @typedef {import("./interfaces").IPDFLinkService} IPDFLinkService */
|
||||
|
||||
import { binarySearchFirstItem, scrollIntoView } from "./ui_utils.js";
|
||||
import { getCharacterType, getNormalizeWithNFKC } from "./pdf_find_utils.js";
|
||||
@ -405,7 +404,7 @@ function getOriginalIndex(diffs, pos, len) {
|
||||
|
||||
/**
|
||||
* @typedef {Object} PDFFindControllerOptions
|
||||
* @property {IPDFLinkService} linkService - The navigation/linking service.
|
||||
* @property {PDFLinkService} linkService - The navigation/linking service.
|
||||
* @property {EventBus} eventBus - The application event bus.
|
||||
* @property {boolean} [updateMatchesCountOnProgress] - True if the matches
|
||||
* count must be updated on progress or only when the last page is reached.
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
*/
|
||||
|
||||
/** @typedef {import("./event_utils").EventBus} EventBus */
|
||||
/** @typedef {import("./interfaces").IPDFLinkService} IPDFLinkService */
|
||||
|
||||
import { isValidRotation, parseQueryString } from "./ui_utils.js";
|
||||
import { updateUrlHash } from "pdfjs-lib";
|
||||
@ -29,7 +28,7 @@ const UPDATE_VIEWAREA_TIMEOUT = 1000; // milliseconds
|
||||
|
||||
/**
|
||||
* @typedef {Object} PDFHistoryOptions
|
||||
* @property {IPDFLinkService} linkService - The navigation/linking service.
|
||||
* @property {PDFLinkService} linkService - The navigation/linking service.
|
||||
* @property {EventBus} eventBus - The application event bus.
|
||||
*/
|
||||
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
*/
|
||||
|
||||
/** @typedef {import("./event_utils").EventBus} EventBus */
|
||||
/** @typedef {import("./interfaces").IPDFLinkService} IPDFLinkService */
|
||||
|
||||
import { isValidExplicitDest } from "pdfjs-lib";
|
||||
import { parseQueryString } from "./ui_utils.js";
|
||||
@ -45,7 +44,6 @@ const LinkTarget = {
|
||||
/**
|
||||
* Performs navigation functions inside PDF, such as opening specified page,
|
||||
* or destination.
|
||||
* @implements {IPDFLinkService}
|
||||
*/
|
||||
class PDFLinkService {
|
||||
externalLinkEnabled = true;
|
||||
@ -517,9 +515,6 @@ class PDFLinkService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @implements {IPDFLinkService}
|
||||
*/
|
||||
class SimpleLinkService extends PDFLinkService {
|
||||
setDocument(pdfDocument, baseUrl = null) {}
|
||||
}
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
/** @typedef {import("./event_utils.js").EventBus} EventBus */
|
||||
// eslint-disable-next-line max-len
|
||||
/** @typedef {import("./download_manager.js").DownloadManager} DownloadManager */
|
||||
/** @typedef {import("./interfaces.js").IPDFLinkService} IPDFLinkService */
|
||||
// eslint-disable-next-line max-len
|
||||
/** @typedef {import("../src/display/api.js").PDFDocumentProxy} PDFDocumentProxy */
|
||||
|
||||
@ -27,7 +26,7 @@ import { SidebarView } from "./ui_utils.js";
|
||||
* @typedef {Object} PDFOutlineViewerOptions
|
||||
* @property {HTMLDivElement} container - The viewer element.
|
||||
* @property {EventBus} eventBus - The application event bus.
|
||||
* @property {IPDFLinkService} linkService - The navigation/linking service.
|
||||
* @property {PDFLinkService} linkService - The navigation/linking service.
|
||||
* @property {DownloadManager} downloadManager - The download manager.
|
||||
*/
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
// eslint-disable-next-line max-len
|
||||
/** @typedef {import("../src/display/display_utils").PageViewport} PageViewport */
|
||||
/** @typedef {import("./event_utils").EventBus} EventBus */
|
||||
/** @typedef {import("./interfaces").IPDFLinkService} IPDFLinkService */
|
||||
/** @typedef {import("./interfaces").IRenderableView} IRenderableView */
|
||||
// eslint-disable-next-line max-len
|
||||
/** @typedef {import("./pdf_rendering_queue").PDFRenderingQueue} PDFRenderingQueue */
|
||||
@ -44,7 +43,7 @@ const THUMBNAIL_WIDTH = 126; // px
|
||||
* @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -
|
||||
* A promise that is resolved with an {@link OptionalContentConfig} instance.
|
||||
* The default value is `null`.
|
||||
* @property {IPDFLinkService} linkService - The navigation/linking service.
|
||||
* @property {PDFLinkService} linkService - The navigation/linking service.
|
||||
* @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
|
||||
* @property {number} [maxCanvasPixels] - The maximum supported canvas size in
|
||||
* total pixels, i.e. width * height. Use `-1` for no limit, or `0` for
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
/** @typedef {import("../src/display/api").PDFDocumentProxy} PDFDocumentProxy */
|
||||
/** @typedef {import("../src/display/api").PDFPageProxy} PDFPageProxy */
|
||||
/** @typedef {import("./event_utils").EventBus} EventBus */
|
||||
/** @typedef {import("./interfaces").IPDFLinkService} IPDFLinkService */
|
||||
// eslint-disable-next-line max-len
|
||||
/** @typedef {import("./pdf_rendering_queue").PDFRenderingQueue} PDFRenderingQueue */
|
||||
|
||||
@ -51,7 +50,7 @@ const SPACE_FOR_DRAG_MARKER_WHEN_NO_NEXT_ELEMENT = 15;
|
||||
* @property {HTMLDivElement} container - The container for the thumbnail
|
||||
* elements.
|
||||
* @property {EventBus} eventBus - The application event bus.
|
||||
* @property {IPDFLinkService} linkService - The navigation/linking service.
|
||||
* @property {PDFLinkService} linkService - The navigation/linking service.
|
||||
* @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
|
||||
* @property {number} [maxCanvasPixels] - The maximum supported canvas size in
|
||||
* total pixels, i.e. width * height. Use `-1` for no limit, or `0` for
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
/** @typedef {import("./event_utils").EventBus} EventBus */
|
||||
/** @typedef {import("./interfaces").IDownloadManager} IDownloadManager */
|
||||
/** @typedef {import("./interfaces").IL10n} IL10n */
|
||||
/** @typedef {import("./interfaces").IPDFLinkService} IPDFLinkService */
|
||||
// eslint-disable-next-line max-len
|
||||
/** @typedef {import("./pdf_find_controller").PDFFindController} PDFFindController */
|
||||
// eslint-disable-next-line max-len
|
||||
@ -90,7 +89,7 @@ function isValidAnnotationEditorMode(mode) {
|
||||
* @property {HTMLDivElement} container - The container for the viewer element.
|
||||
* @property {HTMLDivElement} [viewer] - The viewer element.
|
||||
* @property {EventBus} eventBus - The application event bus.
|
||||
* @property {IPDFLinkService} [linkService] - The navigation/linking service.
|
||||
* @property {PDFLinkService} [linkService] - The navigation/linking service.
|
||||
* @property {IDownloadManager} [downloadManager] - The download manager
|
||||
* component.
|
||||
* @property {PDFFindController} [findController] - The find controller
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
/** @typedef {import("../src/display/annotation_storage").AnnotationStorage} AnnotationStorage */
|
||||
// eslint-disable-next-line max-len
|
||||
/** @typedef {import("../src/display/display_utils").PageViewport} PageViewport */
|
||||
/** @typedef {import("./interfaces").IPDFLinkService} IPDFLinkService */
|
||||
|
||||
import { XfaLayer } from "pdfjs-lib";
|
||||
|
||||
@ -26,7 +25,7 @@ import { XfaLayer } from "pdfjs-lib";
|
||||
* @typedef {Object} XfaLayerBuilderOptions
|
||||
* @property {PDFPageProxy} pdfPage
|
||||
* @property {AnnotationStorage} [annotationStorage]
|
||||
* @property {IPDFLinkService} linkService
|
||||
* @property {PDFLinkService} linkService
|
||||
* @property {Object} [xfaHtml]
|
||||
*/
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user