File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
packages/electron-chrome-extensions/src/browser/api Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,11 @@ export class ContextMenusAPI {
160
160
opts . submenu . forEach ( ( item ) => submenu . append ( buildFromTemplate ( item ) ) )
161
161
opts . submenu = submenu
162
162
}
163
- return new MenuItem ( opts )
163
+ return new MenuItem ( {
164
+ ...opts ,
165
+ // Force submenu type when submenu items are present
166
+ type : opts . type === 'normal' && opts . submenu ? 'submenu' : opts . type ,
167
+ } )
164
168
}
165
169
166
170
// Build all final MenuItems in-order
@@ -238,8 +242,11 @@ export class ContextMenusAPI {
238
242
239
243
menuItemOptions = [ ...menuItemOptions , groupMenuItemOptions , ...children ]
240
244
} else if ( extensionMenuItemOptions . length > 0 ) {
241
- // Set all children to show icon
242
- const children = extensionMenuItemOptions . map ( ( opt ) => ( { ...opt , showIcon : true } ) )
245
+ // Set all top-level children to show icon
246
+ const children = extensionMenuItemOptions . map ( ( opt ) => ( {
247
+ ...opt ,
248
+ showIcon : ! opt . props . parentId ,
249
+ } ) )
243
250
menuItemOptions = [ ...menuItemOptions , ...children ]
244
251
}
245
252
}
You can’t perform that action at this time.
0 commit comments