From fe84807936ff3de2f5ba7f75e0f4bf6badcab50d Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Sun, 20 Nov 2016 17:00:21 +0530 Subject: [PATCH] WIP --- src/index.html | 2 ++ src/script.js | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/index.html b/src/index.html index 91ddc8c..a0fcb31 100644 --- a/src/index.html +++ b/src/index.html @@ -699,6 +699,8 @@ + + diff --git a/src/script.js b/src/script.js index 2104a41..fd32901 100644 --- a/src/script.js +++ b/src/script.js @@ -632,12 +632,18 @@ $('#js-code-side').addEventListener('drop', function(e) { var f = e.dataTransfer.files[0]; var reader = new FileReader(); + var extension = f.name.match(/\.([^\.]*)$/)[1]; // Closure to capture the file information. reader.onload = (function(theFile) { return function(e) { var code = e.target.result; - // editor.cm.html=========== + setTimeout(function() { + if (editur.cm[extension]) { + editur.cm[extension].setValue(code); + // editur.cm.[extension].setValue(code.match(/([\s\S]*)<\/body>/)[1]); + } + }, 500) }; })(f);