Don't overwrite existing fields when build menu from template.
This commit is contained in:
parent
c858066709
commit
c700d291e5
2 changed files with 2 additions and 2 deletions
|
@ -6,7 +6,7 @@ class MenuItem
|
||||||
constructor: (options) ->
|
constructor: (options) ->
|
||||||
Menu = require 'menu'
|
Menu = require 'menu'
|
||||||
|
|
||||||
{click, selector, @type, @label, @sublabel, @accelerator, @enabled, @visible, @checked, @groupId, @submenu} = options
|
{click, @selector, @type, @label, @sublabel, @accelerator, @enabled, @visible, @checked, @groupId, @submenu} = options
|
||||||
|
|
||||||
@type = 'submenu' if not @type? and @submenu?
|
@type = 'submenu' if not @type? and @submenu?
|
||||||
throw new Error('Invalid submenu') if @type is 'submenu' and @submenu?.constructor isnt Menu
|
throw new Error('Invalid submenu') if @type is 'submenu' and @submenu?.constructor isnt Menu
|
||||||
|
|
|
@ -58,7 +58,7 @@ Menu.buildFromTemplate = (template) ->
|
||||||
|
|
||||||
item.submenu = Menu.buildFromTemplate item.submenu if item.submenu?
|
item.submenu = Menu.buildFromTemplate item.submenu if item.submenu?
|
||||||
menuItem = new MenuItem(item)
|
menuItem = new MenuItem(item)
|
||||||
menuItem[key] = value for key, value of item
|
menuItem[key] = value for key, value of item when not menuItem[key]?
|
||||||
|
|
||||||
menu.append menuItem
|
menu.append menuItem
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue