mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-10 12:39:44 +00:00
commit
1c2103511c
3 changed files with 46 additions and 1 deletions
36
app/menu/context-menu.js
Normal file
36
app/menu/context-menu.js
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
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);
|
||||||
|
},
|
||||||
|
};
|
|
@ -21,7 +21,7 @@ var drawerImageStyle = { //@TODO: remove this, img should be properly scaled onc
|
||||||
|
|
||||||
var Drawer = React.createClass({
|
var Drawer = React.createClass({
|
||||||
handleLogoClicked: function(event) {
|
handleLogoClicked: function(event) {
|
||||||
if (event.ctrlKey && event.shiftKey) {
|
if ((event.ctrlKey || event.metaKey) && event.shiftKey) {
|
||||||
window.location.href = 'index.html?developer'
|
window.location.href = 'index.html?developer'
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,17 @@ import lighthouse from './lighthouse.js';
|
||||||
import App from './app.js';
|
import App from './app.js';
|
||||||
import SplashScreen from './component/splash.js';
|
import SplashScreen from './component/splash.js';
|
||||||
|
|
||||||
|
const {remote} = require('electron');
|
||||||
|
const contextMenu = remote.require('./menu/context-menu');
|
||||||
|
|
||||||
lbry.showMenuIfNeeded();
|
lbry.showMenuIfNeeded();
|
||||||
|
|
||||||
|
window.addEventListener('contextmenu', (event) => {
|
||||||
|
contextMenu.showContextMenu(remote.getCurrentWindow(), event.x, event.y,
|
||||||
|
lbry.getClientSetting('showDeveloperMenu'));
|
||||||
|
event.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
var init = function() {
|
var init = function() {
|
||||||
window.lbry = lbry;
|
window.lbry = lbry;
|
||||||
window.lighthouse = lighthouse;
|
window.lighthouse = lighthouse;
|
||||||
|
|
Loading…
Add table
Reference in a new issue