Doesn't work inside <webview>
nfriend opened this issue ยท 4 comments
nfriend commented
nfriend commented
All that is required to fix this issue is to change this (lines 7-16):
function inpectMenuTemplate(pos) {
return {
label: 'Inspect element',
click: () => {
electron.remote
.getCurrentWindow()
.inspectElement(pos.x, pos.y);
}
};
}
to this:
function inpectMenuTemplate(pos) {
return {
label: 'Inspect element',
click: () => {
webview.inspectElement(pos.x, pos.y);
}
};
}
Perhaps the target of the inspectElement
call could be passed as an optional parameter during the install()
function call?
parro-it commented
Actually, if you use it as a electron-contextmenu-middleware the middleware method ctx
argument has a elm
property containing the element on which the click
event occur.
We can use that to discover if the click happens inside a webview. Do you mind making a PR?
nfriend commented
Sure, I can give it a shot. Thanks for the response!
teameh commented
I made a PR, hope you don't mind :)