diff --git a/_server/css/editor_mode.css b/_server/css/editor_mode.css index 9dc1d587..1eccc702 100644 --- a/_server/css/editor_mode.css +++ b/_server/css/editor_mode.css @@ -35,8 +35,17 @@ height: 780px; } -#left6 #blocklyDiv {height: 480px; width: 940px;float:left;} -#left6 #codeArea {width: 99.5%; height: 15.4em;overflow:y;/* resize:none; */clear:both;} +#left6 #blocklyDiv { + height: 480px; + width: 940px; +} + +#left6 .CodeMirror { + border: 1px solid #eee; + height: 200px; + width: 1300px; +} +#left6 #codeArea {width: 99.5%; height: 15.4em;overflow:y;/* resize:none; */} #left7 { /* height: 440px; width: 375px;float:left; */ diff --git a/_server/editor_blockly.js b/_server/editor_blockly.js index 86dbe348..a6e22dee 100644 --- a/_server/editor_blockly.js +++ b/_server/editor_blockly.js @@ -209,9 +209,9 @@ initscript=String.raw` } try { var code = Blockly.JavaScript.workspaceToCode(workspace); - document.getElementById('codeArea').value = code; + codeAreaHL.setValue(code); } catch (error) { - document.getElementById('codeArea').value = String(error); + codeAreaHL.setValue(String(error)); if (error instanceof OmitedError){ var blockName = error.blockName; var varName = error.varName; @@ -267,6 +267,14 @@ xhr.onreadystatechange = function (){ xhr.open('GET','_server/blockly/MotaAction.g4',true); xhr.send(null); +var codeAreaHL = CodeMirror.fromTextArea(document.getElementById("codeArea"), { + lineNumbers: true, + matchBrackets: true, + lineWrapping: true, + continueComments: "Enter", + extraKeys: {"Ctrl-Q": "toggleComment"} +}); + editor_blockly.showXML = function () { var xml = Blockly.Xml.workspaceToDom(editor_blockly.workspace); var xml_text = Blockly.Xml.domToPrettyText(xml); @@ -293,7 +301,7 @@ editor_blockly.runCode = function () { editor_blockly.parse = function () { MotaActionFunctions.parse( - eval('obj=' + document.getElementById('codeArea').value.replace(/[<>&]/g,function(c){return {'<':'<','>':'>','&':'&'}[c];})), + eval('obj=' + codeAreaHL.getValue().replace(/[<>&]/g,function(c){return {'<':'<','>':'>','&':'&'}[c];})), document.getElementById('entryType').value ); } @@ -322,7 +330,7 @@ editor_blockly.import = function(id_){ }[field]; if(!type)return false; editor_blockly.id=id_; - document.getElementById('codeArea').value = input.value; + codeAreaHL.setValue(input.value); document.getElementById('entryType').value = type; editor_blockly.parse(); editor_blockly.show(); @@ -350,7 +358,7 @@ editor_blockly.confirm = function (){ editor_blockly.hide(); input.onchange(); } - if(document.getElementById('codeArea').value===''){ + if(codeAreaHL.getValue()===''){ setvalue('null'); return; } diff --git a/_server/editor_file.js b/_server/editor_file.js index b5a853b4..9b576dc7 100644 --- a/_server/editor_file.js +++ b/_server/editor_file.js @@ -322,6 +322,10 @@ editor_file = function(editor, callback){ else */ locObj[v]=null; }); + Object.keys(editor_file.comment.floors.loc).forEach(function(v){ + delete(locObj[v]); + }); + delete(locObj.map); return locObj; })(), editor_file.comment.floors.floor, @@ -337,6 +341,10 @@ editor_file = function(editor, callback){ else */ locObj[v]=null; }); + Object.keys(editor_file.comment.floors.loc).forEach(function(v){ + delete(locObj[v]); + }); + delete(locObj.map); return locObj; })(), editor_file.comment.floors.floor, diff --git a/_server/vm.js b/_server/vm.js index 97d3602d..28405689 100644 --- a/_server/vm.js +++ b/_server/vm.js @@ -219,6 +219,7 @@ tip_in_showMode = [ '涉及图片的更改需要F5刷新浏览器来生效', '文本域可以通过双击,在文本编辑器或事件编辑器中编辑', '事件编辑器中的显示文本和自定义脚本的方块也可以双击', + "画出的地图要点击\"保存地图\"才会写入到文件中", ]; var tip = new Vue({ el: '#tip', diff --git a/editor.html b/editor.html index 243bb2e8..b2d4dd54 100644 --- a/editor.html +++ b/editor.html @@ -17,10 +17,9 @@

{{ errors[error-1] }}

-
+
+ - -
@@ -128,7 +127,7 @@ -
+
@@ -183,6 +182,9 @@ +



+ +