Directly assign submenu when constructor is Menu
This commit is contained in:
parent
83c69b56a4
commit
96ef09742c
1 changed files with 5 additions and 2 deletions
|
@ -26,8 +26,11 @@ class MenuItem
|
|||
|
||||
{click, @selector, @type, @role, @label, @sublabel, @accelerator, @icon, @enabled, @visible, @checked} = options
|
||||
|
||||
if options.submenu? and options.submenu.constructor isnt Menu
|
||||
@submenu = Menu.buildFromTemplate options.submenu
|
||||
if options.submenu?
|
||||
if options.submenu.constructor is Menu
|
||||
@submenu = options.submenu
|
||||
else
|
||||
@submenu = Menu.buildFromTemplate options.submenu
|
||||
@type = 'submenu' if not @type? and @submenu?
|
||||
throw new Error('Invalid submenu') if @type is 'submenu' and @submenu?.constructor isnt Menu
|
||||
|
||||
|
|
Loading…
Reference in a new issue