projects
/
onyx-live.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ca0fd37
)
added dropping files
author
root
<root@brendanfh.com>
Mon, 19 Jul 2021 14:54:53 +0000
(14:54 +0000)
committer
root
<root@brendanfh.com>
Mon, 19 Jul 2021 14:54:53 +0000
(14:54 +0000)
static/src/index.js
patch
|
blob
|
history
templates/index.html
patch
|
blob
|
history
diff --git
a/static/src/index.js
b/static/src/index.js
index 99c2c1c1ed232a189cc00e50a90ad7e1bcfea46b..3b0b91ad5dd92e09df2aa568a23bacbff0379cf0 100644
(file)
--- a/
static/src/index.js
+++ b/
static/src/index.js
@@
-129,6
+129,20
@@
function load_settings() {
change_keybindings(editor_keybind_mode);
}
+async function handle_drop(e) {
+ e.preventDefault();
+
+ let editor = ace.edit('code-editor');
+ editor.setValue(await e.dataTransfer.items[0].getAsFile().text(), 0);
+
+ return false;
+}
+
+function handle_dragover(e) {
+ e.preventDefault();
+ return false;
+}
+
window.onload = () => {
let editor = ace.edit('code-editor');
diff --git
a/templates/index.html
b/templates/index.html
index e3a38859c736d7bd3650a472413bde73a0af9427..4191255d8f0348586ceccbd8ac1d1e228326ad56 100644
(file)
--- a/
templates/index.html
+++ b/
templates/index.html
@@
-38,7
+38,7
@@
</div>
<div class="bottom-half">
- <pre id="code-editor">
+ <pre id="code-editor"
ondragover="handle_dragover(event);" ondrop="handle_drop(event);"
>
#load "core/std"
use package core