From: root Date: Mon, 19 Jul 2021 14:54:53 +0000 (+0000) Subject: added dropping files X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=b4b2b3b689f7abee7d86ebb141acbc0edbe35a32;p=onyx-live.git added dropping files --- diff --git a/static/src/index.js b/static/src/index.js index 99c2c1c..3b0b91a 100644 --- 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 e3a3885..4191255 100644 --- a/templates/index.html +++ b/templates/index.html @@ -38,7 +38,7 @@
-
+            
 #load "core/std"
 
 use package core