Skip to content

Commit 5860c7b

Browse files
committed
Add a pref containing the url for the sumo page about alt text (bug 1909097)
1 parent ebb3d27 commit 5860c7b

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

extensions/chromium/preferences_schema.json

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@
5555
"type": "boolean",
5656
"default": false
5757
},
58+
"altTextLearnMoreUrl": {
59+
"type": "string",
60+
"default": ""
61+
},
5862
"enableUpdatedAddImage": {
5963
"type": "boolean",
6064
"default": false

web/app.js

+1
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ const PDFViewerApplication = {
209209
// We want to load the image-to-text AI engine as soon as possible.
210210
this.mlManager = new MLManager({
211211
enableAltText: AppOptions.get("enableAltText"),
212+
altTextLearnMoreUrl: AppOptions.get("altTextLearnMoreUrl"),
212213
});
213214
}
214215

web/app_options.js

+8
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ const defaultOptions = {
117117
kind: OptionKind.BROWSER + OptionKind.EVENT_DISPATCH,
118118
},
119119

120+
altTextLearnMoreUrl: {
121+
/** @type {string} */
122+
value:
123+
typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")
124+
? "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/pdf-alt-text"
125+
: "",
126+
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
127+
},
120128
annotationEditorMode: {
121129
/** @type {number} */
122130
value: 0,

web/firefoxcom.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,14 @@ class MLManager {
324324
return FirefoxCom.requestAsync("mlGuess", data);
325325
}
326326

327-
enable({ enableAltText, listenToProgress }) {
327+
enable({ altTextLearnMoreUrl, enableAltText, listenToProgress }) {
328328
if (enableAltText) {
329329
this.#loadAltTextEngine(listenToProgress);
330330
}
331+
// The `altTextLearnMoreUrl` is used to provide a link to the user to learn
332+
// more about the "alt text" feature.
333+
// The link is used in the Alt Text dialog or in the Image Settings.
334+
this.altTextLearnMoreUrl = altTextLearnMoreUrl;
331335
}
332336

333337
async #loadAltTextEngine(listenToProgress) {

0 commit comments

Comments
 (0)