-
-
Notifications
You must be signed in to change notification settings - Fork 157
"Download" actions do not work in webviews #122
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
Labels
Comments
I think this should be fixed in |
Is there any reason electron-context-menu shouldn't pass the parent window as suggested, at least as a stopgap measure? Perhaps along with a console warning describing the behavior. |
I will bump this, I have the same issue; here is my log when I try to save an image: (node:3818) UnhandledPromiseRejectionWarning: TypeError: Cannot read properties of undefined (reading 'session')
at /Users/*/Developer/formalsurf-refactor/out/main/index.js:11459:42
at new Promise (<anonymous>)
at download (/Users/*/Developer/formalsurf-refactor/out/main/index.js:11454:10)
at click (/Users/*/Developer/formalsurf-refactor/out/main/index.js:11590:11)
at MenuItem.click (node:electron/js2c/browser_init:2:34816)
at a._executeCommand (node:electron/js2c/browser_init:2:40231)
(node:3818) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8) This is how I create the context menu: app.on("web-contents-created", (e, contents) => {
if (contents.getType() == "webview") {
// set context menu in webview contextMenu({ window: contents, });
contextMenu({
window: contents,
prepend: (defaultActions, params, mainWindow) => [
// Can add custom right click actions here
],
showInspectElement: true,
showSaveImageAs: true,
showSaveImage: true,
showCopyImageAddress: true,
showCopyImage: true,
showCopyVideoAddress: true,
showSaveVideo: true,
showSaveVideoAs: true,
},
);
}
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"Download" actions pass the webview as a window to electron-dl, but electron-dl does not support webviews. Electron-dl would need to change its specification or electron-context-menu should pass the parent window instead.
The text was updated successfully, but these errors were encountered: