Add a pref to know if the alt-text must be automatically generated (bug 1909310)

This commit is contained in:
Calixte Denizet 2024-07-22 22:09:08 +02:00
parent 91655aae7f
commit 042183b89b
4 changed files with 21 additions and 12 deletions

View file

@ -205,10 +205,10 @@ const PDFViewerApplication = {
if (mode) {
document.documentElement.classList.add(mode);
}
} else {
} else if (AppOptions.get("enableAltText")) {
// We want to load the image-to-text AI engine as soon as possible.
this.mlManager = new MLManager({
enableAltText: AppOptions.get("enableAltText"),
enableGuessAltText: AppOptions.get("enableGuessAltText"),
altTextLearnMoreUrl: AppOptions.get("altTextLearnMoreUrl"),
});
}
@ -376,14 +376,14 @@ const PDFViewerApplication = {
let eventBus;
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
eventBus =
AppOptions.eventBus =
this.mlManager.eventBus =
new FirefoxEventBus(
AppOptions.get("allowedGlobalEvents"),
externalServices,
AppOptions.get("isInAutomation")
);
eventBus = AppOptions.eventBus = new FirefoxEventBus(
AppOptions.get("allowedGlobalEvents"),
externalServices,
AppOptions.get("isInAutomation")
);
if (this.mlManager) {
this.mlManager.eventBus = eventBus;
}
} else {
eventBus = new EventBus();
}