docs: fix broken code in drag and drop example (#45336)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Niklas Wenzel <dev@nikwen.de>
This commit is contained in:
parent
d34fa2e301
commit
813efbcdf7
1 changed files with 1 additions and 4 deletions
|
@ -22,12 +22,9 @@ In `preload.js` use the [`contextBridge`][] to inject a method `window.electron.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const { contextBridge, ipcRenderer } = require('electron')
|
const { contextBridge, ipcRenderer } = require('electron')
|
||||||
const path = require('node:path')
|
|
||||||
|
|
||||||
contextBridge.exposeInMainWorld('electron', {
|
contextBridge.exposeInMainWorld('electron', {
|
||||||
startDrag: (fileName) => {
|
startDrag: (fileName) => ipcRenderer.send('ondragstart', fileName)
|
||||||
ipcRenderer.send('ondragstart', path.join(process.cwd(), fileName))
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue