lbry-desktop/app/menu/context-menu.js
Alex Liebowitz 0b79e49452 Add context menu
Has Cut, Copy, Paste, and when in developer mode there's also Inspect Element
2017-03-17 07:53:34 -04:00

36 lines
643 B
JavaScript

const {Menu} = require('electron');
const electron = require('electron');
const app = electron.app;
const contextMenuTemplate = [
{
role: 'cut',
},
{
role: 'copy',
},
{
role: 'paste',
},
];
module.exports = {
showContextMenu(win, posX, posY, showDevItems) {
let template = contextMenuTemplate.slice();
if (showDevItems) {
template.push({
type: 'separator',
});
template.push(
{
label: 'Inspect Element',
click() {
win.inspectElement(posX, posY);
}
}
);
}
Menu.buildFromTemplate(template).popup(win);
},
};