feat: add fileMenu
/ viewMenu
/ appMenu
roles (#16328)
This commit is contained in:
parent
72af4941f8
commit
eb02a422de
6 changed files with 271 additions and 263 deletions
|
@ -159,13 +159,13 @@ Menu.buildFromTemplate = function (template) {
|
|||
if (!Array.isArray(template)) {
|
||||
throw new TypeError('Invalid template for Menu: Menu template must be an array')
|
||||
}
|
||||
const menu = new Menu()
|
||||
if (!areValidTemplateItems(template)) {
|
||||
throw new TypeError('Invalid template for MenuItem: must have at least one of label, role or type')
|
||||
}
|
||||
const filtered = removeExtraSeparators(template)
|
||||
const sorted = sortTemplate(filtered)
|
||||
|
||||
const menu = new Menu()
|
||||
sorted.forEach((item) => menu.append(new MenuItem(item)))
|
||||
|
||||
return menu
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue