-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrab.html
More file actions
50 lines (42 loc) · 804 Bytes
/
grab.html
File metadata and controls
50 lines (42 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<style>
#drag-file {
background-color: #2F688D;
color: white;
text-align: center;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
#image {
position: absolute;
height: 60%;
width: 60%;
top:20%;
bottom:20%;
left:20%;
right:20%;
}
</style>
<div id="drag-file">
<img id="image" src="./grab.png">
</div>
<script>
const {ipcRenderer} = require('electron')
var holder = document.getElementById('drag-file');
holder.ondragover = () => {
return false;
};
holder.ondragleave = () => {
return false;
};
holder.ondragend = () => {
return false;
};
holder.ondrop = (e) => {
e.preventDefault();
ipcRenderer.send('fileDropped', e.dataTransfer.files[0].path);
return false;
};
</script>