mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
[Editor] Fix few telemetry issues with the new alt text flow (bug 1915434)
This commit is contained in:
parent
ab052db5b3
commit
1658b0af55
4 changed files with 19 additions and 6 deletions
|
@ -213,6 +213,13 @@ class AltText {
|
|||
this.#altTextButton.disabled = !enabled;
|
||||
}
|
||||
|
||||
shown() {
|
||||
this.#editor._reportTelemetry({
|
||||
action: "pdfjs.image.alt_text.image_status_label_displayed",
|
||||
data: { label: this.#label },
|
||||
});
|
||||
}
|
||||
|
||||
destroy() {
|
||||
this.#altTextButton?.remove();
|
||||
this.#altTextButton = null;
|
||||
|
@ -235,10 +242,6 @@ class AltText {
|
|||
const label = this.#label;
|
||||
// TODO: Update the l10n keys to avoid this.
|
||||
const type = label === "review" ? "to-review" : label;
|
||||
this.#editor._reportTelemetry({
|
||||
action: "pdfjs.image.alt_text.image_status_label_displayed",
|
||||
data: { label },
|
||||
});
|
||||
button.classList.toggle("done", !!this.#altText);
|
||||
AltText._l10nPromise
|
||||
.get(`pdfjs-editor-new-alt-text-${type}-button-label`)
|
||||
|
|
|
@ -975,7 +975,7 @@ class AnnotationEditor {
|
|||
this._editToolbar = new EditorToolbar(this);
|
||||
this.div.append(this._editToolbar.render());
|
||||
if (this.#altText) {
|
||||
this._editToolbar.addAltTextButton(await this.#altText.render());
|
||||
await this._editToolbar.addAltText(this.#altText);
|
||||
}
|
||||
|
||||
return this._editToolbar;
|
||||
|
|
|
@ -24,6 +24,8 @@ class EditorToolbar {
|
|||
|
||||
#buttons = null;
|
||||
|
||||
#altText = null;
|
||||
|
||||
constructor(editor) {
|
||||
this.#editor = editor;
|
||||
}
|
||||
|
@ -99,6 +101,7 @@ class EditorToolbar {
|
|||
|
||||
show() {
|
||||
this.#toolbar.classList.remove("hidden");
|
||||
this.#altText?.shown();
|
||||
}
|
||||
|
||||
#addDeleteButton() {
|
||||
|
@ -126,9 +129,11 @@ class EditorToolbar {
|
|||
return divider;
|
||||
}
|
||||
|
||||
addAltTextButton(button) {
|
||||
async addAltText(altText) {
|
||||
const button = await altText.render();
|
||||
this.#addListenersToElement(button);
|
||||
this.#buttons.prepend(button, this.#divider);
|
||||
this.#altText = altText;
|
||||
}
|
||||
|
||||
addColorPicker(colorPicker) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue