diff --git a/ElectronClient/app/app.js b/ElectronClient/app/app.js index e15bdacb68..d9d0db14e2 100644 --- a/ElectronClient/app/app.js +++ b/ElectronClient/app/app.js @@ -229,21 +229,22 @@ class Application extends BaseApplication { label: _('Edit'), submenu: [{ label: _('Copy'), - screens: ['Main'], + screens: ['Main', 'OneDriveLogin'], role: 'copy', accelerator: 'CommandOrControl+C', }, { label: _('Cut'), - screens: ['Main'], + screens: ['Main', 'OneDriveLogin'], role: 'cut', accelerator: 'CommandOrControl+X', }, { label: _('Paste'), - screens: ['Main'], + screens: ['Main', 'OneDriveLogin'], role: 'paste', accelerator: 'CommandOrControl+V', }, { type: 'separator', + screens: ['Main'], }, { label: _('Search in all the notes'), screens: ['Main'], @@ -290,12 +291,21 @@ class Application extends BaseApplication { }, ]; + function isEmptyMenu(template) { + for (let i = 0; i < template.length; i++) { + const t = template[i]; + if (t.type !== 'separator') return false; + } + return true; + } + function removeUnwantedItems(template, screen) { let output = []; for (let i = 0; i < template.length; i++) { const t = Object.assign({}, template[i]); if (t.screens && t.screens.indexOf(screen) < 0) continue; if (t.submenu) t.submenu = removeUnwantedItems(t.submenu, screen); + if (('submenu' in t) && isEmptyMenu(t.submenu)) continue; output.push(t); } return output;