feat: add fileMenu / viewMenu / appMenu roles (#16328)

This commit is contained in:
Milan Burda 2019-01-10 14:32:03 +01:00 committed by Alexey Kuzmin
parent 72af4941f8
commit eb02a422de
6 changed files with 271 additions and 263 deletions

View file

@ -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