docs: Use <a> as example

This commit is contained in:
Cheng Zhao 2016-07-03 15:27:26 +09:00
parent b7459d50f9
commit ba1fe322e9

View file

@ -329,11 +329,14 @@ app, you need to call `webContents.startDrag(item)` API on `ondragstart` event.
In web page:
```javascript
document.getElementById('targetItem').ondragstart = (event) => {
event.preventDefault()
ipcRenderer.send('ondragstart', '/path/to/item')
}
```html
<a href="#" id="drag">item</a>
<script type="text/javascript" charset="utf-8">
document.getElementById('drag').ondragstart = (event) => {
event.preventDefault()
ipcRenderer.send('ondragstart', '/path/to/item')
}
</script>
```
In the main process: