don't filter out invisible menu separators (#12825)
This commit is contained in:
parent
b280ea5579
commit
f67c625e6a
1 changed files with 10 additions and 5 deletions
|
@ -240,14 +240,19 @@ function indexToInsertByPosition (items, position) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeExtraSeparators (items) {
|
function removeExtraSeparators (items) {
|
||||||
// remove invisible items
|
|
||||||
let ret = items.filter(e => e.visible !== false)
|
|
||||||
|
|
||||||
// fold adjacent separators together
|
// 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
|
// 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) {
|
function insertItemByType (item, pos) {
|
||||||
|
|
Loading…
Reference in a new issue