File tree 2 files changed +16
-6
lines changed
arduino-ide-extension/src/browser/dialogs/settings
2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -201,12 +201,7 @@ export class SettingsComponent extends React.Component<
201
201
< div className = "flex-line" >
202
202
< select
203
203
className = "theia-select"
204
- value = {
205
- ThemeService . get ( )
206
- . getThemes ( )
207
- . find ( ( { id } ) => id === this . state . themeId ) ?. label ||
208
- nls . localize ( 'arduino/common/unknown' , 'Unknown' )
209
- }
204
+ value = { ThemeService . get ( ) . getCurrentTheme ( ) . label }
210
205
onChange = { this . themeDidChange }
211
206
>
212
207
{ ThemeService . get ( )
@@ -591,6 +586,9 @@ export class SettingsComponent extends React.Component<
591
586
const theme = ThemeService . get ( ) . getThemes ( ) [ selectedIndex ] ;
592
587
if ( theme ) {
593
588
this . setState ( { themeId : theme . id } ) ;
589
+ if ( ThemeService . get ( ) . getCurrentTheme ( ) . id !== theme . id ) {
590
+ ThemeService . get ( ) . setCurrentTheme ( theme . id ) ;
591
+ }
594
592
}
595
593
} ;
596
594
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import { SettingsComponent } from './settings-component';
16
16
import { AsyncLocalizationProvider } from '@theia/core/lib/common/i18n/localization' ;
17
17
import { AdditionalUrls } from '../../../common/protocol' ;
18
18
import { AbstractDialog } from '../../theia/dialogs/dialogs' ;
19
+ import { ThemeService } from '@theia/core/lib/browser/theming' ;
19
20
20
21
@injectable ( )
21
22
export class SettingsWidget extends ReactWidget {
@@ -118,6 +119,17 @@ export class SettingsDialog extends AbstractDialog<Promise<Settings>> {
118
119
119
120
this . widget . activate ( ) ;
120
121
}
122
+
123
+ override async open ( ) : Promise < Promise < Settings > | undefined > {
124
+ const themeIdBeforeOpen = ThemeService . get ( ) . getCurrentTheme ( ) . id ;
125
+ const result = await super . open ( ) ;
126
+ if ( ! result ) {
127
+ if ( ThemeService . get ( ) . getCurrentTheme ( ) . id !== themeIdBeforeOpen ) {
128
+ ThemeService . get ( ) . setCurrentTheme ( themeIdBeforeOpen ) ;
129
+ }
130
+ }
131
+ return result ;
132
+ }
121
133
}
122
134
123
135
export class AdditionalUrlsDialog extends AbstractDialog < string [ ] > {
You can’t perform that action at this time.
0 commit comments