Fix right click bug #928
3 changed files with 7 additions and 20 deletions
|
@ -10,9 +10,9 @@ import ChildProcess from 'child_process';
|
|||
import Assert from 'assert';
|
||||
import { app, BrowserWindow, globalShortcut, ipcMain, Menu, Tray } from 'electron';
|
||||
import mainMenu from './menu/mainMenu';
|
||||
import contextMenu from './menu/contextMenu';
|
||||
|
||||
const localVersion = app.getVersion();
|
||||
export { contextMenu as Default } from './menu/contextMenu';
|
||||
|
||||
// Debug configs
|
||||
const isDevelopment = process.env.NODE_ENV === 'development';
|
||||
|
@ -526,3 +526,5 @@ ipcMain.on('get-auth-token', event => {
|
|||
ipcMain.on('set-auth-token', (event, token) => {
|
||||
Keytar.setPassword('LBRY', 'auth_token', token ? token.toString().trim() : null);
|
||||
});
|
||||
|
||||
export { contextMenu };
|
||||
|
|
|
@ -1,18 +1,8 @@
|
|||
import { Menu } from 'electron';
|
||||
|
||||
const contextMenuTemplate = [
|
||||
{
|
||||
role: 'cut',
|
||||
},
|
||||
{
|
||||
role: 'copy',
|
||||
},
|
||||
{
|
||||
role: 'paste',
|
||||
},
|
||||
];
|
||||
const contextMenuTemplate = [{ role: 'cut' }, { role: 'copy' }, { role: 'paste' }];
|
||||
|
||||
export default function contextMenu(win, posX, posY, showDevItems) {
|
||||
export default (win, posX, posY, showDevItems) => {
|
||||
const template = contextMenuTemplate.slice();
|
||||
if (showDevItems) {
|
||||
template.push({
|
||||
|
@ -27,4 +17,4 @@ export default function contextMenu(win, posX, posY, showDevItems) {
|
|||
}
|
||||
|
||||
Menu.buildFromTemplate(template).popup(win);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -20,12 +20,7 @@ import app from './app';
|
|||
const { contextMenu } = remote.require('./main.js');
|
||||
|
||||
window.addEventListener('contextmenu', event => {
|
||||
contextMenu.showContextMenu(
|
||||
remote.getCurrentWindow(),
|
||||
event.x,
|
||||
event.y,
|
||||
app.env === 'development'
|
||||
);
|
||||
contextMenu(remote.getCurrentWindow(), event.x, event.y, app.env === 'development');
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue