mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #19110 from ryzokuken/autolink-demo
Enable automatic URL linking (bug 1019475)
This commit is contained in:
commit
2d773cb773
20 changed files with 656 additions and 14 deletions
|
@ -3238,6 +3238,33 @@ class AnnotationLayer {
|
|||
this.#setAnnotationCanvasMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add link annotations to the annotation layer.
|
||||
*
|
||||
* @param {Array<Object>} annotations
|
||||
* @param {IPDFLinkService} linkService
|
||||
* @memberof AnnotationLayer
|
||||
*/
|
||||
async addLinkAnnotations(annotations, linkService) {
|
||||
const elementParams = {
|
||||
data: null,
|
||||
layer: this.div,
|
||||
linkService,
|
||||
svgFactory: new DOMSVGFactory(),
|
||||
parent: this,
|
||||
};
|
||||
for (const data of annotations) {
|
||||
elementParams.data = data;
|
||||
const element = AnnotationElementFactory.create(elementParams);
|
||||
|
||||
if (!element.isRenderable) {
|
||||
continue;
|
||||
}
|
||||
const rendered = element.render();
|
||||
await this.#appendElement(rendered, data.id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the annotation elements on existing annotation layer.
|
||||
*
|
||||
|
|
|
@ -24,9 +24,11 @@
|
|||
|
||||
import {
|
||||
AbortException,
|
||||
AnnotationBorderStyleType,
|
||||
AnnotationEditorParamsType,
|
||||
AnnotationEditorType,
|
||||
AnnotationMode,
|
||||
AnnotationType,
|
||||
createValidAbsoluteUrl,
|
||||
FeatureTest,
|
||||
ImageKind,
|
||||
|
@ -90,12 +92,14 @@ if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("TESTING || GENERIC")) {
|
|||
|
||||
export {
|
||||
AbortException,
|
||||
AnnotationBorderStyleType,
|
||||
AnnotationEditorLayer,
|
||||
AnnotationEditorParamsType,
|
||||
AnnotationEditorType,
|
||||
AnnotationEditorUIManager,
|
||||
AnnotationLayer,
|
||||
AnnotationMode,
|
||||
AnnotationType,
|
||||
build,
|
||||
ColorPicker,
|
||||
createValidAbsoluteUrl,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue