diff --git a/_server/editor.js b/_server/editor.js index 006a4df2..5a9f3539 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -1230,16 +1230,15 @@ editor.prototype.listen = function () { }); } - var clearLoc = document.getElementById('clearLoc'); - clearLoc.onmousedown = function(e){ + var _clearPoint = function (clearPoint) { editor.hideMidMenu(); - e.stopPropagation(); editor.preMapData = null; reDo = null; editor.info = 0; editor_mode.onmode(''); var now = editor.pos; - editor.map[now.y][now.x]=editor.info; + if (clearPoint) + editor.map[now.y][now.x]=editor.info; editor.updateMap(); fields.forEach(function(v){ delete editor.currentFloorData[v][now.x+','+now.y]; @@ -1249,11 +1248,23 @@ editor.prototype.listen = function () { printe(err); throw(err) } - ;printf('清空此点及事件成功'); + ;printf(clearPoint?'清空该点和事件成功':'只清空该点事件成功'); editor.drawPosSelection(); }); } + var clearEvent = document.getElementById('clearEvent'); + clearEvent.onmousedown = function (e) { + e.stopPropagation(); + _clearPoint(false); + } + + var clearLoc = document.getElementById('clearLoc'); + clearLoc.onmousedown = function(e){ + e.stopPropagation(); + _clearPoint(true); + } + var brushMod=document.getElementById('brushMod'); brushMod.onchange=function(){ editor.brushMod=brushMod.value; diff --git a/_server/editor_multi.js b/_server/editor_multi.js index 856fa59b..705f0ab4 100644 --- a/_server/editor_multi.js +++ b/_server/editor_multi.js @@ -64,11 +64,8 @@ editor_multi = function () { return '\t'; } - editor_multi.format = function () { - if (!editor_multi.lintAutocomplete) { - alert("只有代码才能进行格式化操作!"); - return; - } + var _format = function () { + if (!editor_multi.lintAutocomplete) return; codeEditor.setValue(js_beautify(codeEditor.getValue(), { brace_style: "collapse-preserve-inline", indent_with_tabs: true, @@ -76,6 +73,15 @@ editor_multi = function () { })); } + editor_multi.format = function () { + if (!editor_multi.lintAutocomplete) { + alert("只有代码才能进行格式化操作!"); + return; + } + _format(); + } + + editor_multi.import = function (id_, args) { var thisTr = document.getElementById(id_); if (!thisTr) return false; @@ -122,6 +128,8 @@ editor_multi = function () { editor_multi.id = ''; return; } + // ----- 自动格式化 + _format(); if (editor_multi.id === 'callFromBlockly') { editor_multi.id = ''; editor_multi.multiLineDone(); diff --git a/editor-mobile.html b/editor-mobile.html index 85c3791d..681feb8f 100644 --- a/editor-mobile.html +++ b/editor-mobile.html @@ -316,6 +316,7 @@ + diff --git a/editor.html b/editor.html index 10a6a405..4584bff7 100644 --- a/editor.html +++ b/editor.html @@ -336,6 +336,7 @@ +