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 {
160160 opts . submenu . forEach ( ( item ) => submenu . append ( buildFromTemplate ( item ) ) )
161161 opts . submenu = submenu
162162 }
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+ } )
164168 }
165169
166170 // Build all final MenuItems in-order
@@ -238,8 +242,11 @@ export class ContextMenusAPI {
238242
239243 menuItemOptions = [ ...menuItemOptions , groupMenuItemOptions , ...children ]
240244 } 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+ } ) )
243250 menuItemOptions = [ ...menuItemOptions , ...children ]
244251 }
245252 }
You can’t perform that action at this time.
0 commit comments