mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
don't filter out invisible menu separators (#12825)
This commit is contained in:
@@ -240,14 +240,19 @@ function indexToInsertByPosition (items, position) {
|
||||
}
|
||||
|
||||
function removeExtraSeparators (items) {
|
||||
// remove invisible items
|
||||
let ret = items.filter(e => e.visible !== false)
|
||||
|
||||
// fold adjacent separators together
|
||||
ret = ret.filter((e, idx, arr) => e.type !== 'separator' || idx === 0 || arr[idx - 1].type !== 'separator')
|
||||
let ret = items.filter((e, idx, arr) => {
|
||||
if (e.visible === false) return true
|
||||
return e.type !== 'separator' || idx === 0 || arr[idx - 1].type !== 'separator'
|
||||
})
|
||||
|
||||
// remove edge separators
|
||||
return ret.filter((e, idx, arr) => e.type !== 'separator' || (idx !== 0 && idx !== arr.length - 1))
|
||||
ret = ret.filter((e, idx, arr) => {
|
||||
if (e.visible === false) return true
|
||||
return e.type !== 'separator' || (idx !== 0 && idx !== arr.length - 1)
|
||||
})
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
function insertItemByType (item, pos) {
|
||||
|
||||
Reference in New Issue
Block a user