how to ? electron-context-menu work webview How it will work in web view and main window
arxsheikh opened this issue · 0 comments
arxsheikh commented
How it will work in web view
and main window Works only in window with this code I
t doesn't work in Web View...
Edit this code to make the context menu work
const { app, BrowserWindow} = require('electron');
const contextMenu = require('electron-context-menu');
contextMenu({
labels: {
cut: 'Cut',
copy: 'Copy',
paste: 'Paste',
save: 'Save Image',
saveImageAs: 'Save Image As…',
copyLink: 'Copy Link',
saveLinkAs: 'Save Link As…',
inspect: 'Inspect Element'
},
prepend: () => [
{
label: 'Arxstd',
},
{
label: 'back',
},
{
label: 'Forward',
},
{
label: 'Reload',
},
{
type: 'separator'
},
{
type: 'separator'
},
{
type: 'separator'
},
{
type: 'separator'
}
],
append: () => { },
showCopyImageAddress: true,
showSaveImageAs: true,
showInspectElement: true,
showSaveLinkAs: true,
cut: true,
copy: true,
paste: true,
save: true,
saveImageAs: true,
copyLink: true,
saveLinkAs: true,
inspect: true
});
let mainWindow;
(async () => {
await app.whenReady();
mainWindow = new BrowserWindow({
webPreferences: {
spellcheck: true,
webviewTag: true,
}
});
mainWindow.loadFile('index.html')
})();
const dispose = contextMenu();
dispose();