@@ -75,12 +75,22 @@ export class ImageComponent extends ConfigComponent<Promise<TImageRawWrap>, HTML
75
75
protected override _onEnabledChanged ( ) : void {
76
76
super . _onEnabledChanged ( ) ;
77
77
78
+ const imageElement = UIUtil . getElementById ( this . _imageId ) as HTMLImageElement ;
79
+ const placeholderComponent = UIUtil . getElementById ( this . _imageId + '-placeholder' ) ;
80
+ if ( ! this . enabled ) {
81
+ imageElement . classList . add ( 'disabled' ) ;
82
+ placeholderComponent . classList . add ( 'disabled' ) ;
83
+ } else {
84
+ imageElement . classList . remove ( 'disabled' ) ;
85
+ placeholderComponent . classList . remove ( 'disabled' ) ;
86
+ }
87
+
78
88
this . _switchElement . setEnabled ( this . enabled ) ;
79
89
}
80
90
81
91
protected override _onValueChanged ( ) : void {
82
92
const inputElement = UIUtil . getElementById ( this . _imageId ) as HTMLImageElement ;
83
- const PlaceholderComponent = UIUtil . getElementById ( this . _imageId + '-placeholder' ) ;
93
+ const placeholderComponent = UIUtil . getElementById ( this . _imageId + '-placeholder' ) ;
84
94
85
95
this . getValue ( )
86
96
. then ( ( res ) => {
@@ -90,13 +100,13 @@ export class ImageComponent extends ConfigComponent<Promise<TImageRawWrap>, HTML
90
100
this . _switchElement . setActive ( false ) ;
91
101
inputElement . src = res . raw ;
92
102
inputElement . style . display = 'unset' ;
93
- PlaceholderComponent . style . display = 'none' ;
103
+ placeholderComponent . style . display = 'none' ;
94
104
} )
95
105
. catch ( ( err ) => {
96
106
this . _switchElement . setActive ( true ) ;
97
107
inputElement . src = '' ;
98
108
inputElement . style . display = 'none' ;
99
- PlaceholderComponent . style . display = 'flex' ;
109
+ placeholderComponent . style . display = 'flex' ;
100
110
} ) ;
101
111
}
102
112
0 commit comments