Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a pref containing the url for the sumo page about alt text (bug 1909097) #18471

Merged
merged 1 commit into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions extensions/chromium/preferences_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
"type": "boolean",
"default": false
},
"altTextLearnMoreUrl": {
"type": "string",
"default": ""
},
"enableUpdatedAddImage": {
"type": "boolean",
"default": false
Expand Down
1 change: 1 addition & 0 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ const PDFViewerApplication = {
// We want to load the image-to-text AI engine as soon as possible.
this.mlManager = new MLManager({
enableAltText: AppOptions.get("enableAltText"),
altTextLearnMoreUrl: AppOptions.get("altTextLearnMoreUrl"),
});
}

Expand Down
8 changes: 8 additions & 0 deletions web/app_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ const defaultOptions = {
kind: OptionKind.BROWSER + OptionKind.EVENT_DISPATCH,
},

altTextLearnMoreUrl: {
/** @type {string} */
value:
typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")
? "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/pdf-alt-text"
: "",
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
},
annotationEditorMode: {
/** @type {number} */
value: 0,
Expand Down
6 changes: 5 additions & 1 deletion web/firefoxcom.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,14 @@ class MLManager {
return FirefoxCom.requestAsync("mlGuess", data);
}

enable({ enableAltText, listenToProgress }) {
enable({ altTextLearnMoreUrl, enableAltText, listenToProgress }) {
if (enableAltText) {
this.#loadAltTextEngine(listenToProgress);
}
// The `altTextLearnMoreUrl` is used to provide a link to the user to learn
// more about the "alt text" feature.
// The link is used in the Alt Text dialog or in the Image Settings.
this.altTextLearnMoreUrl = altTextLearnMoreUrl;
}

async #loadAltTextEngine(listenToProgress) {
Expand Down