1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

[Editor] Make stamp annotations editable (bug 1921291)

This commit is contained in:
Calixte Denizet 2024-10-02 14:36:35 +02:00
parent ebbd019d7d
commit 8410252eb8
11 changed files with 281 additions and 18 deletions

View file

@ -82,7 +82,8 @@
}
}
#viewerContainer.pdfPresentationMode:fullscreen {
#viewerContainer.pdfPresentationMode:fullscreen,
.annotationEditorLayer.disabled {
.noAltTextBadge {
display: none !important;
}

View file

@ -23,6 +23,8 @@
/** @typedef {import("./interfaces").IL10n} IL10n */
// eslint-disable-next-line max-len
/** @typedef {import("../src/display/annotation_layer.js").AnnotationLayer} AnnotationLayer */
// eslint-disable-next-line max-len
/** @typedef {import("../src/display/struct_tree_layer_builder.js").StructTreeLayerBuilder} StructTreeLayerBuilder */
import { AnnotationEditorLayer } from "pdfjs-lib";
import { GenericL10n } from "web-null_l10n";
@ -32,6 +34,7 @@ import { GenericL10n } from "web-null_l10n";
* @property {AnnotationEditorUIManager} [uiManager]
* @property {PDFPageProxy} pdfPage
* @property {IL10n} [l10n]
* @property {StructTreeLayerBuilder} [structTreeLayer]
* @property {TextAccessibilityManager} [accessibilityManager]
* @property {AnnotationLayer} [annotationLayer]
* @property {TextLayer} [textLayer]
@ -46,6 +49,8 @@ class AnnotationEditorLayerBuilder {
#onAppend = null;
#structTreeLayer = null;
#textLayer = null;
#uiManager;
@ -68,6 +73,7 @@ class AnnotationEditorLayerBuilder {
this.#textLayer = options.textLayer || null;
this.#drawLayer = options.drawLayer || null;
this.#onAppend = options.onAppend || null;
this.#structTreeLayer = options.structTreeLayer || null;
}
/**
@ -100,6 +106,7 @@ class AnnotationEditorLayerBuilder {
this.annotationEditorLayer = new AnnotationEditorLayer({
uiManager: this.#uiManager,
div,
structTreeLayer: this.#structTreeLayer,
accessibilityManager: this.accessibilityManager,
pageIndex: this.pdfPage.pageNumber - 1,
l10n: this.l10n,

View file

@ -1098,12 +1098,10 @@ class PDFPageView {
showCanvas?.(true);
await this.#finishRenderTask(renderTask);
if (this.textLayer || this.annotationLayer) {
this.structTreeLayer ||= new StructTreeLayerBuilder(
pdfPage,
viewport.rawDims
);
}
this.structTreeLayer ||= new StructTreeLayerBuilder(
pdfPage,
viewport.rawDims
);
this.#renderTextLayer();
@ -1126,6 +1124,7 @@ class PDFPageView {
uiManager: annotationEditorUIManager,
pdfPage,
l10n,
structTreeLayer: this.structTreeLayer,
accessibilityManager: this._accessibilityManager,
annotationLayer: this.annotationLayer?.annotationLayer,
textLayer: this.textLayer,