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:
trop[bot] 2025-01-27 13:05:42 -05:00 committed by GitHub
parent d34fa2e301
commit 813efbcdf7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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))
}
}) })
``` ```