зеркало из https://github.com/electron/electron.git
inherit user-specific MenuItem properties more safely
This commit is contained in:
Родитель
2cd10d339f
Коммит
b575055d7e
|
@ -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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче