docs: update drag and drop tutorial (#29200)
* Working * Working * Make the native-file drag and drop documents use context bridge * Add per-file sections * Use the updated link format * Use path.join instead of string interpolation. Co-authored-by: Antón Molleda <molant@users.noreply.github.com> * Use fs.promises Co-authored-by: Antón Molleda <molant@users.noreply.github.com> * Update docs/tutorial/native-file-drag-drop.md Co-authored-by: Antón Molleda <molant@users.noreply.github.com> * fix formatting Co-authored-by: Antón Molleda <molant@users.noreply.github.com> * Update docs/tutorial/native-file-drag-drop.md Co-authored-by: Antón Molleda <molant@users.noreply.github.com> * Use more path.join instead of interpolation * Update with PR suggestions * Remove process.cwd() and add more example elements * Minor text fix * Fix typo Co-authored-by: Erick Zhao <erick@hotmail.ca> Co-authored-by: Antón Molleda <molant@users.noreply.github.com> Co-authored-by: Erick Zhao <erick@hotmail.ca>
This commit is contained in:
parent
af426cbdab
commit
adb85f341b
5 changed files with 63 additions and 33 deletions
|
@ -1,9 +1,9 @@
|
|||
const { ipcRenderer } = require('electron')
|
||||
const fs = require('fs')
|
||||
|
||||
document.getElementById('drag').ondragstart = (event) => {
|
||||
const fileName = 'drag-and-drop.md'
|
||||
fs.writeFileSync(fileName, '# Test drag and drop');
|
||||
document.getElementById('drag1').ondragstart = (event) => {
|
||||
event.preventDefault()
|
||||
ipcRenderer.send('ondragstart', process.cwd() + `/${fileName}`)
|
||||
window.electron.startDrag('drag-and-drop-1.md')
|
||||
}
|
||||
|
||||
document.getElementById('drag2').ondragstart = (event) => {
|
||||
event.preventDefault()
|
||||
window.electron.startDrag('drag-and-drop-2.md')
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue