File tree 3 files changed +11
-4
lines changed
3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -329,10 +329,6 @@ class MLManager {
329
329
this . altTextLearnMoreUrl = altTextLearnMoreUrl ;
330
330
this . enableAltTextModelDownload = enableAltTextModelDownload ;
331
331
this . enableGuessAltText = enableGuessAltText ;
332
-
333
- if ( enableAltTextModelDownload ) {
334
- this . #loadAltTextEngine( false ) ;
335
- }
336
332
}
337
333
338
334
async isEnabledFor ( name ) {
@@ -356,6 +352,12 @@ class MLManager {
356
352
] ) ;
357
353
}
358
354
355
+ async loadModel ( name ) {
356
+ if ( name === "altText" && this . enableAltTextModelDownload ) {
357
+ await this . #loadAltTextEngine( false ) ;
358
+ }
359
+ }
360
+
359
361
async downloadModel ( name ) {
360
362
if ( name !== "altText" ) {
361
363
return null ;
Original file line number Diff line number Diff line change @@ -88,6 +88,8 @@ class FakeMLManager {
88
88
return null ;
89
89
}
90
90
91
+ async loadModel ( _name ) { }
92
+
91
93
async downloadModel ( _name ) {
92
94
// Simulate downloading the model but with progress.
93
95
// The progress can be seen in the new alt-text dialog.
Original file line number Diff line number Diff line change @@ -2299,6 +2299,9 @@ class PDFViewer {
2299
2299
* @param {AnnotationEditorModeOptions } options
2300
2300
*/
2301
2301
set annotationEditorMode ( { mode, editId = null , isFromKeyboard = false } ) {
2302
+ if ( mode === AnnotationEditorType . STAMP ) {
2303
+ this . #mlManager?. loadModel ( "altText" ) ;
2304
+ }
2302
2305
if ( ! this . #annotationEditorUIManager) {
2303
2306
throw new Error ( `The AnnotationEditor is not enabled.` ) ;
2304
2307
}
You can’t perform that action at this time.
0 commit comments