mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-27 08:21:03 +02:00
Electron: Fixes #527: Remove empty section separators from menus
This commit is contained in:
parent
44e1245416
commit
6301ba0a12
@ -535,6 +535,21 @@ class Application extends BaseApplication {
|
||||
if (('submenu' in t) && isEmptyMenu(t.submenu)) continue;
|
||||
output.push(t);
|
||||
}
|
||||
|
||||
// Remove empty separator for now empty sections
|
||||
let temp = [];
|
||||
let previous = null;
|
||||
for (let i = 0; i < output.length; i++) {
|
||||
const t = Object.assign({}, output[i]);
|
||||
if (t.type === 'separator') {
|
||||
if (!previous) continue;
|
||||
if (previous.type === 'separator') continue;
|
||||
}
|
||||
temp.push(t);
|
||||
previous = t;
|
||||
}
|
||||
output = temp;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user