2018-04-22 23:48:56 +00:00
|
|
|
import { shell, BrowserWindow } from 'electron';
|
|
|
|
import contextMenu from 'electron-context-menu';
|
2016-01-25 07:56:33 +00:00
|
|
|
|
2018-04-22 23:48:56 +00:00
|
|
|
function initContextMenu() {
|
|
|
|
contextMenu({
|
|
|
|
prepend: (params) => {
|
|
|
|
const items = [];
|
|
|
|
if (params.linkURL) {
|
|
|
|
items.push({
|
|
|
|
label: 'Open Link in Default Browser',
|
|
|
|
click: () => {
|
|
|
|
shell.openExternal(params.linkURL);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
items.push({
|
|
|
|
label: 'Open Link in New Window',
|
|
|
|
click: () => {
|
|
|
|
new BrowserWindow().loadURL(params.linkURL);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return items;
|
|
|
|
},
|
2017-04-29 14:52:12 +00:00
|
|
|
});
|
2016-01-25 07:56:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default initContextMenu;
|