diff --git a/Android/doric/src/main/java/com/github/penfeizhou/doric/dev/LocalServer.java b/Android/doric/src/main/java/com/github/penfeizhou/doric/dev/LocalServer.java index b3e8738c..2707eef7 100644 --- a/Android/doric/src/main/java/com/github/penfeizhou/doric/dev/LocalServer.java +++ b/Android/doric/src/main/java/com/github/penfeizhou/doric/dev/LocalServer.java @@ -12,6 +12,7 @@ import com.github.penfeizhou.doric.DoricDriver; import com.github.pengfeizhou.jscore.JSONBuilder; import org.json.JSONArray; +import org.json.JSONObject; import java.io.IOException; import java.io.InputStream; @@ -78,6 +79,34 @@ public class LocalServer extends NanoHTTPD { return "{}"; } }); + commandMap.put("reload", new APICommand() { + @Override + public String name() { + return "reload"; + } + + @Override + public Object exec(IHTTPSession session) { + Map files = new HashMap<>(); + try { + session.parseBody(files); + } catch (Exception e) { + e.printStackTrace(); + } + String id = session.getParms().get("id"); + DoricContext doricContext = DoricContextManager.getContext(id); + if (doricContext != null) { + try { + JSONObject jsonObject = new JSONObject(files.get("postData")); + doricContext.reload(jsonObject.optString("script")); + } catch (Exception e) { + e.printStackTrace(); + } + return "success"; + } + return "fail"; + } + }); } diff --git a/debugger/package-lock.json b/debugger/package-lock.json index b7536145..bab313ee 100644 --- a/debugger/package-lock.json +++ b/debugger/package-lock.json @@ -7453,6 +7453,11 @@ } } }, + "monaco-editor": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.17.1.tgz", + "integrity": "sha512-JAc0mtW7NeO+0SwPRcdkfDbWLgkqL9WfP1NbpP9wNASsW6oWqgZqNIWt4teymGjZIXTElx3dnQmUYHmVrJ7HxA==" + }, "move-concurrently": { "version": "1.0.1", "resolved": "https://registry.npm.taobao.org/move-concurrently/download/move-concurrently-1.0.1.tgz", diff --git a/debugger/package.json b/debugger/package.json index f99a5372..0693d222 100644 --- a/debugger/package.json +++ b/debugger/package.json @@ -12,6 +12,7 @@ "babel-plugin-prismjs": "^1.1.1", "core-js": "^2.6.5", "element-ui": "^2.11.1", + "monaco-editor": "^0.17.1", "prismjs": "^1.17.1", "vue": "^2.6.10", "vue-prism": "^1.0.5", diff --git a/debugger/public/index.html b/debugger/public/index.html index c80f7851..08bdca19 100644 --- a/debugger/public/index.html +++ b/debugger/public/index.html @@ -7,7 +7,7 @@ Doric Dev Pannel - + @@ -17,7 +17,7 @@
- + \ No newline at end of file diff --git a/debugger/src/App.vue b/debugger/src/App.vue index e86d8c34..5e073c33 100644 --- a/debugger/src/App.vue +++ b/debugger/src/App.vue @@ -11,11 +11,19 @@ export default { diff --git a/debugger/src/components/Context.vue b/debugger/src/components/Context.vue index 239b4afe..5c2c60ce 100644 --- a/debugger/src/components/Context.vue +++ b/debugger/src/components/Context.vue @@ -2,7 +2,7 @@
- +
Context info @@ -20,12 +20,7 @@ -
- Running -
-
-
 
-
+
@@ -34,13 +29,19 @@ @@ -91,6 +103,7 @@ p span { .script { text-align: left; - font-size: 50%; + font-size: 100%; + height: fill-available; }