editor细节调整
This commit is contained in:
parent
628d7eeafa
commit
ae0a8be8f1
@ -35,8 +35,17 @@
|
|||||||
height: 780px;
|
height: 780px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#left6 #blocklyDiv {height: 480px; width: 940px;float:left;}
|
#left6 #blocklyDiv {
|
||||||
#left6 #codeArea {width: 99.5%; height: 15.4em;overflow:y;/* resize:none; */clear:both;}
|
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 {
|
#left7 {
|
||||||
/* height: 440px; width: 375px;float:left; */
|
/* height: 440px; width: 375px;float:left; */
|
||||||
|
|||||||
@ -209,9 +209,9 @@ initscript=String.raw`
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
var code = Blockly.JavaScript.workspaceToCode(workspace);
|
var code = Blockly.JavaScript.workspaceToCode(workspace);
|
||||||
document.getElementById('codeArea').value = code;
|
codeAreaHL.setValue(code);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
document.getElementById('codeArea').value = String(error);
|
codeAreaHL.setValue(String(error));
|
||||||
if (error instanceof OmitedError){
|
if (error instanceof OmitedError){
|
||||||
var blockName = error.blockName;
|
var blockName = error.blockName;
|
||||||
var varName = error.varName;
|
var varName = error.varName;
|
||||||
@ -267,6 +267,14 @@ xhr.onreadystatechange = function (){
|
|||||||
xhr.open('GET','_server/blockly/MotaAction.g4',true);
|
xhr.open('GET','_server/blockly/MotaAction.g4',true);
|
||||||
xhr.send(null);
|
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 () {
|
editor_blockly.showXML = function () {
|
||||||
var xml = Blockly.Xml.workspaceToDom(editor_blockly.workspace);
|
var xml = Blockly.Xml.workspaceToDom(editor_blockly.workspace);
|
||||||
var xml_text = Blockly.Xml.domToPrettyText(xml);
|
var xml_text = Blockly.Xml.domToPrettyText(xml);
|
||||||
@ -293,7 +301,7 @@ editor_blockly.runCode = function () {
|
|||||||
|
|
||||||
editor_blockly.parse = function () {
|
editor_blockly.parse = function () {
|
||||||
MotaActionFunctions.parse(
|
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
|
document.getElementById('entryType').value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -322,7 +330,7 @@ editor_blockly.import = function(id_){
|
|||||||
}[field];
|
}[field];
|
||||||
if(!type)return false;
|
if(!type)return false;
|
||||||
editor_blockly.id=id_;
|
editor_blockly.id=id_;
|
||||||
document.getElementById('codeArea').value = input.value;
|
codeAreaHL.setValue(input.value);
|
||||||
document.getElementById('entryType').value = type;
|
document.getElementById('entryType').value = type;
|
||||||
editor_blockly.parse();
|
editor_blockly.parse();
|
||||||
editor_blockly.show();
|
editor_blockly.show();
|
||||||
@ -350,7 +358,7 @@ editor_blockly.confirm = function (){
|
|||||||
editor_blockly.hide();
|
editor_blockly.hide();
|
||||||
input.onchange();
|
input.onchange();
|
||||||
}
|
}
|
||||||
if(document.getElementById('codeArea').value===''){
|
if(codeAreaHL.getValue()===''){
|
||||||
setvalue('null');
|
setvalue('null');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -322,6 +322,10 @@ editor_file = function(editor, callback){
|
|||||||
else */
|
else */
|
||||||
locObj[v]=null;
|
locObj[v]=null;
|
||||||
});
|
});
|
||||||
|
Object.keys(editor_file.comment.floors.loc).forEach(function(v){
|
||||||
|
delete(locObj[v]);
|
||||||
|
});
|
||||||
|
delete(locObj.map);
|
||||||
return locObj;
|
return locObj;
|
||||||
})(),
|
})(),
|
||||||
editor_file.comment.floors.floor,
|
editor_file.comment.floors.floor,
|
||||||
@ -337,6 +341,10 @@ editor_file = function(editor, callback){
|
|||||||
else */
|
else */
|
||||||
locObj[v]=null;
|
locObj[v]=null;
|
||||||
});
|
});
|
||||||
|
Object.keys(editor_file.comment.floors.loc).forEach(function(v){
|
||||||
|
delete(locObj[v]);
|
||||||
|
});
|
||||||
|
delete(locObj.map);
|
||||||
return locObj;
|
return locObj;
|
||||||
})(),
|
})(),
|
||||||
editor_file.comment.floors.floor,
|
editor_file.comment.floors.floor,
|
||||||
|
|||||||
@ -219,6 +219,7 @@ tip_in_showMode = [
|
|||||||
'涉及图片的更改需要F5刷新浏览器来生效',
|
'涉及图片的更改需要F5刷新浏览器来生效',
|
||||||
'文本域可以通过双击,在文本编辑器或事件编辑器中编辑',
|
'文本域可以通过双击,在文本编辑器或事件编辑器中编辑',
|
||||||
'事件编辑器中的显示文本和自定义脚本的方块也可以双击',
|
'事件编辑器中的显示文本和自定义脚本的方块也可以双击',
|
||||||
|
"画出的地图要点击\"保存地图\"才会写入到文件中",
|
||||||
];
|
];
|
||||||
var tip = new Vue({
|
var tip = new Vue({
|
||||||
el: '#tip',
|
el: '#tip',
|
||||||
|
|||||||
14
editor.html
14
editor.html
@ -17,10 +17,9 @@
|
|||||||
<p class="warnText" v-if="error">{{ errors[error-1] }}</p>
|
<p class="warnText" v-if="error">{{ errors[error-1] }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="editTip" v-cloak>
|
<div id="editTip" v-cloak>
|
||||||
<select id="selectFloor"></select><br>
|
<br>
|
||||||
|
<input type="button" value="当前地图另存为" id='saveFloorAs'/>
|
||||||
<input id='saveAsName' placeholder="输入新楼层id"/>
|
<input id='saveAsName' placeholder="输入新楼层id"/>
|
||||||
<input class='btn' type="button" value="save" id='saveFloor'/>
|
|
||||||
<input class='btn' type="button" value="saveAs" id='saveFloorAs'/>
|
|
||||||
<input class='btn' type="button" value="复制地图" v-on:click="copyMap"/>
|
<input class='btn' type="button" value="复制地图" v-on:click="copyMap"/>
|
||||||
</div>
|
</div>
|
||||||
<div style="position: absolute;right: 10px;bottom:70px;">
|
<div style="position: absolute;right: 10px;bottom:70px;">
|
||||||
@ -128,7 +127,7 @@
|
|||||||
<category name="template"></category>
|
<category name="template"></category>
|
||||||
</xml>
|
</xml>
|
||||||
</h3>
|
</h3>
|
||||||
<div>
|
<div style="position: relative;">
|
||||||
<div id="blocklyDiv"></div>
|
<div id="blocklyDiv"></div>
|
||||||
<textarea id="codeArea" spellcheck="false"></textarea>
|
<textarea id="codeArea" spellcheck="false"></textarea>
|
||||||
</div>
|
</div>
|
||||||
@ -183,6 +182,9 @@
|
|||||||
<option value="functions">脚本编辑</option>
|
<option value="functions">脚本编辑</option>
|
||||||
<option value="appendpic">追加素材</option>
|
<option value="appendpic">追加素材</option>
|
||||||
</select>
|
</select>
|
||||||
|
<br><br><br><br>
|
||||||
|
<select id="selectFloor"></select>
|
||||||
|
<input type="button" value="保存地图" id='saveFloor'/>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<div id="bgSelect" v-cloak style="display:none">
|
<div id="bgSelect" v-cloak style="display:none">
|
||||||
<span>当前地板: </span>
|
<span>当前地板: </span>
|
||||||
@ -337,7 +339,7 @@
|
|||||||
<script>
|
<script>
|
||||||
//所有全局量
|
//所有全局量
|
||||||
__all__=['Vue','fs','editor_file','editor_mode','main','core','hasOwnProp','printf','printe','editor','converter','ActionParser','MotaActionFunctions','MotaActionBlocks'];
|
__all__=['Vue','fs','editor_file','editor_mode','main','core','hasOwnProp','printf','printe','editor','converter','ActionParser','MotaActionFunctions','MotaActionBlocks'];
|
||||||
__id__=['editArea','arrRowMark','mapRowMark','data','bg','dataSelection','blocklyDiv','codeArea','entryType'];
|
__id__=['editArea','arrRowMark','mapRowMark','data','bg','dataSelection','blocklyDiv','codeAreaHL','entryType'];
|
||||||
__Vue__=['exportM','editArea','editTip','clear','tip','selectBox'];
|
__Vue__=['exportM','editArea','editTip','clear','tip','selectBox'];
|
||||||
//var event = document.getElementById('event');
|
//var event = document.getElementById('event');
|
||||||
|
|
||||||
@ -357,7 +359,7 @@ main.init('editor', function() {
|
|||||||
editor.mode.floor();
|
editor.mode.floor();
|
||||||
editor.mode.tower();
|
editor.mode.tower();
|
||||||
editor.mode.functions();
|
editor.mode.functions();
|
||||||
editor.mode.showMode('loc');
|
editor.mode.showMode('floor');
|
||||||
editor.mode.listen();
|
editor.mode.listen();
|
||||||
editor_multi=editor_multi();
|
editor_multi=editor_multi();
|
||||||
editor_blockly=editor_blockly();
|
editor_blockly=editor_blockly();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user