diff --git a/extensions/chromium/preferences_schema.json b/extensions/chromium/preferences_schema.json index 3035f6500..23b37fb7f 100644 --- a/extensions/chromium/preferences_schema.json +++ b/extensions/chromium/preferences_schema.json @@ -55,6 +55,10 @@ "type": "boolean", "default": false }, + "altTextLearnMoreUrl": { + "type": "string", + "default": "" + }, "enableUpdatedAddImage": { "type": "boolean", "default": false diff --git a/web/app.js b/web/app.js index 30cf81644..3c5e80856 100644 --- a/web/app.js +++ b/web/app.js @@ -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"), }); } diff --git a/web/app_options.js b/web/app_options.js index 962cac375..acb18e434 100644 --- a/web/app_options.js +++ b/web/app_options.js @@ -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, diff --git a/web/firefoxcom.js b/web/firefoxcom.js index af2e8ee4b..afa2b69fc 100644 --- a/web/firefoxcom.js +++ b/web/firefoxcom.js @@ -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) {