From b4b2b3b689f7abee7d86ebb141acbc0edbe35a32 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 19 Jul 2021 14:54:53 +0000 Subject: [PATCH] added dropping files --- static/src/index.js | 14 ++++++++++++++ templates/index.html | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) 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
-- 
2.25.1