mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-27 08:21:03 +02:00
Electron: Fix #33: Allow copy and paste in OneDrive login
This commit is contained in:
parent
ede1ed8b22
commit
33fd8325be
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user