-
-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doesn't show in webview #65
Comments
I found work around for this issue. Please use 'web-contents-created' event and window option. const electron = require('electron');
const {app, BrowserWindow, shell} = electron;
const contextMenu = require('electron-context-menu');
...
app.on('web-contents-created', (e, contents) => {
if (contents.getType() == 'webview') {
// open link with external browser in webview
contents.on('new-window', (e, url) => {
e.preventDefault()
shell.openExternal(url)
})
// set context menu in webview
contextMenu({
prepend: (defaultActions, params, browserWindow) => [{
label: 'Rainbow',
visible: params.mediaType === 'image'
}],
window: contents
});
}
}); |
Thanks @agata this workaround works ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using the latest version.
I am able to see the context menu in BrowserWindow however I dynamically render when needed using a react app and don't see the context menu.
I don't pass anything in the window option so according to the documentation it should be visible in the webview by default but isn't.
If I need to pass webview reference I'd like an example if possible, I don't understand how you expect to pass a reference to the webview which is in the renderer while the context menu is in the main process.
I have an ID for the element but can't access and get results from the DOM from the main process or pass the element itself using IPC since it doesn't work.
Thanks
The text was updated successfully, but these errors were encountered: