sindresorhus/electron-context-menu

Error at <webview> using "save image"

amwtxgt opened this issue · 3 comments

contextMenu({ window:document.getElementById('webview'), showCopyImage:true, showSaveImageAs:true, showCopyImageAddress:true, })

Uncaught (in promise) TypeError: Cannot read property 'session' of undefined at index.js:138 at new Promise (<anonymous>) at module.exports../node_modules/electron-dl/index.js.module.exports.download (index.js:135) at click (index.js:109) at CallbacksRegistry.apply (callbacks-registry.ts:45) at remote.js:292 at EventEmitter.<anonymous> (remote.js:272) at EventEmitter.emit (events.js:210) at Object.onMessage (init.ts:50)

Electron verson 8.0.0

Help welcome. I don't use <webview> :)

The Electron team also recommends against using <webview />. Not super helpful for resolution I know, but in case anyone comes across this and was unaware of that fact.

You can try my solution:

contextMenu({
    window: { webContents },
    showSaveImageAs: true
  })