File tree 4 files changed +13
-5
lines changed
services/workbench/explorer
4 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export interface IMenuItemProps extends HTMLElementProps {
13
13
/**
14
14
* The name of icon
15
15
*/
16
- icon ?: string ;
16
+ icon ?: React . ReactNode ;
17
17
type ?: 'divider' ;
18
18
/**
19
19
* Item Name
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export interface ISubMenuProps extends IMenuItemProps {
33
33
* The event of show subMenu, default value is 'hover'
34
34
*/
35
35
trigger ?: TriggerEvent ;
36
- icon ?: string ;
36
+ icon ?: React . ReactNode ;
37
37
data ?: ISubMenuProps [ ] ;
38
38
mode ?: MenuMode ;
39
39
}
@@ -84,7 +84,11 @@ export function SubMenu(props: React.PropsWithChildren<ISubMenuProps>) {
84
84
{ ...custom }
85
85
>
86
86
< a className = { menuContentClassName } >
87
- < Icon className = { checkClassName } type = { icon || '' } />
87
+ { typeof icon === 'string' ? (
88
+ < Icon className = { checkClassName } type = { icon || '' } />
89
+ ) : (
90
+ icon
91
+ ) }
88
92
< span className = { labelClassName } >
89
93
{ render ? render ( props ) : name }
90
94
</ span >
Original file line number Diff line number Diff line change @@ -204,7 +204,7 @@ export class ExplorerService
204
204
const nextMenu = headerToolBar ?. contextMenu ?. concat ( ) || [ ] ;
205
205
const currentMenu = nextMenu . find ( searchById ( id ) ) ;
206
206
if ( currentMenu ) {
207
- currentMenu . icon = this . toggleIcon ( currentMenu . icon ) ;
207
+ currentMenu . icon = this . toggleIcon ( currentMenu . icon as string ) ;
208
208
const next = {
209
209
...headerToolBar ,
210
210
contextMenu : nextMenu ,
Original file line number Diff line number Diff line change @@ -89,7 +89,11 @@ function EditorAction(props: IEditorActionProps & IEditorController) {
89
89
title = { action . name ?. toString ( ) }
90
90
>
91
91
{ action . icon ? (
92
- < Icon type = { action . icon } />
92
+ typeof action . icon === 'string' ? (
93
+ < Icon type = { action . icon } />
94
+ ) : (
95
+ action . icon
96
+ )
93
97
) : (
94
98
action . name
95
99
) }
You can’t perform that action at this time.
0 commit comments