mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
[Editor] Make the text layer focusable before the editors (bug 1881746)
Keep the different layers in a constant order to avoid the use of a z-index and a tab-index.
This commit is contained in:
parent
0022310b9c
commit
1b00511301
14 changed files with 187 additions and 36 deletions
|
@ -30,13 +30,13 @@ import { GenericL10n } from "web-null_l10n";
|
|||
/**
|
||||
* @typedef {Object} AnnotationEditorLayerBuilderOptions
|
||||
* @property {AnnotationEditorUIManager} [uiManager]
|
||||
* @property {HTMLDivElement} pageDiv
|
||||
* @property {PDFPageProxy} pdfPage
|
||||
* @property {IL10n} [l10n]
|
||||
* @property {TextAccessibilityManager} [accessibilityManager]
|
||||
* @property {AnnotationLayer} [annotationLayer]
|
||||
* @property {TextLayer} [textLayer]
|
||||
* @property {DrawLayer} [drawLayer]
|
||||
* @property {function} [onAppend]
|
||||
*/
|
||||
|
||||
class AnnotationEditorLayerBuilder {
|
||||
|
@ -44,6 +44,8 @@ class AnnotationEditorLayerBuilder {
|
|||
|
||||
#drawLayer = null;
|
||||
|
||||
#onAppend = null;
|
||||
|
||||
#textLayer = null;
|
||||
|
||||
#uiManager;
|
||||
|
@ -52,7 +54,6 @@ class AnnotationEditorLayerBuilder {
|
|||
* @param {AnnotationEditorLayerBuilderOptions} options
|
||||
*/
|
||||
constructor(options) {
|
||||
this.pageDiv = options.pageDiv;
|
||||
this.pdfPage = options.pdfPage;
|
||||
this.accessibilityManager = options.accessibilityManager;
|
||||
this.l10n = options.l10n;
|
||||
|
@ -66,6 +67,7 @@ class AnnotationEditorLayerBuilder {
|
|||
this.#annotationLayer = options.annotationLayer || null;
|
||||
this.#textLayer = options.textLayer || null;
|
||||
this.#drawLayer = options.drawLayer || null;
|
||||
this.#onAppend = options.onAppend || null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,10 +93,9 @@ class AnnotationEditorLayerBuilder {
|
|||
// Create an AnnotationEditor layer div
|
||||
const div = (this.div = document.createElement("div"));
|
||||
div.className = "annotationEditorLayer";
|
||||
div.tabIndex = 0;
|
||||
div.hidden = true;
|
||||
div.dir = this.#uiManager.direction;
|
||||
this.pageDiv.append(div);
|
||||
this.#onAppend?.(div);
|
||||
|
||||
this.annotationEditorLayer = new AnnotationEditorLayer({
|
||||
uiManager: this.#uiManager,
|
||||
|
@ -125,7 +126,6 @@ class AnnotationEditorLayerBuilder {
|
|||
if (!this.div) {
|
||||
return;
|
||||
}
|
||||
this.pageDiv = null;
|
||||
this.annotationEditorLayer.destroy();
|
||||
this.div.remove();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue