inherit user-specific MenuItem properties more safely
This commit is contained in:
parent
2cd10d339f
commit
b575055d7e
1 changed files with 4 additions and 6 deletions
|
@ -7,12 +7,10 @@ let nextCommandId = 0
|
|||
const MenuItem = function (options) {
|
||||
const {Menu} = require('electron')
|
||||
|
||||
// Clone and sanitize the provided options
|
||||
options = Object.assign({}, options)
|
||||
delete options.overrideProperty
|
||||
delete options.overrideReadOnlyProperty
|
||||
|
||||
Object.assign(this, options)
|
||||
// Preserve extra fields specified by user
|
||||
for (let key in options) {
|
||||
if (!(key in this)) this[key] = options[key]
|
||||
}
|
||||
|
||||
if (this.submenu != null && this.submenu.constructor !== Menu) {
|
||||
this.submenu = Menu.buildFromTemplate(this.submenu)
|
||||
|
|
Loading…
Add table
Reference in a new issue