File tree Expand file tree Collapse file tree 3 files changed +21
-20
lines changed
core-browser/src/services Expand file tree Collapse file tree 3 files changed +21
-20
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ export interface StatusBarEntry {
51
51
* 可以通过 text 设置图标
52
52
* $(iconClassName) :text
53
53
*/
54
- text ?: string ;
54
+ text ?: string | React . ReactNode ;
55
55
/**
56
56
* 当前菜单显示名称
57
57
* 标识当前状态栏组件 contextmenu 显示的名称,如果没有使用 text 代替
Original file line number Diff line number Diff line change @@ -137,22 +137,23 @@ export const StatusBarItem = memo((props: StatusBarEntry) => {
137
137
>
138
138
< div className = { styles . popover_item } >
139
139
{ iconClass && < span key = { - 1 } className = { cls ( styles . icon , iconClass ) } > </ span > }
140
- { text &&
141
- transformLabelWithCodicon (
142
- text ,
143
- { } ,
144
- iconService . fromString . bind ( iconService ) ,
145
- ( text : string , index : number ) => (
146
- < span
147
- key = { `${ text } -${ index } ` }
148
- style = { { height : '22px' , lineHeight : '22px' } }
149
- aria-label = { ariaLabel }
150
- role = { role }
151
- >
152
- { replaceLocalizePlaceholder ( text ) }
153
- </ span >
154
- ) ,
155
- ) }
140
+ { typeof text === 'string'
141
+ ? transformLabelWithCodicon (
142
+ text ,
143
+ { } ,
144
+ iconService . fromString . bind ( iconService ) ,
145
+ ( text : string , index : number ) => (
146
+ < span
147
+ key = { `${ text } -${ index } ` }
148
+ style = { { height : '22px' , lineHeight : '22px' } }
149
+ aria-label = { ariaLabel }
150
+ role = { role }
151
+ >
152
+ { replaceLocalizePlaceholder ( text ) }
153
+ </ span >
154
+ ) ,
155
+ )
156
+ : text }
156
157
</ div >
157
158
</ Popover >
158
159
</ div >
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ export class StatusBarService extends Disposable implements IStatusBarService {
27
27
private background : string | undefined ;
28
28
private foreground : string | undefined ;
29
29
30
- private entriesObservable = observableValue < Map < string , StatusBarEntry > > ( this , new Map ( ) ) ;
30
+ entriesObservable = observableValue < Map < string , StatusBarEntry > > ( this , new Map ( ) ) ;
31
31
32
32
@Autowired ( CommandService )
33
33
private commandService : CommandService ;
@@ -101,14 +101,14 @@ export class StatusBarService extends Disposable implements IStatusBarService {
101
101
* @param id 状态栏 id
102
102
* @returns
103
103
*/
104
- private getEntriesById ( id : string ) {
104
+ getEntriesById ( id : string ) {
105
105
return this . entriesArray . get ( ) . filter ( ( entry ) => entry . id === id ) ;
106
106
}
107
107
108
108
/**
109
109
* 从 storage 中读取 state
110
110
*/
111
- private getStorageState ( id : string ) {
111
+ getStorageState ( id : string ) {
112
112
return this . layoutState . getState < { [ id : string ] : StatusBarState } > ( LAYOUT_STATE . STATUSBAR , { } ) [ id ] ;
113
113
}
114
114
You can’t perform that action at this time.
0 commit comments