Merge pull request #75 from zhaouv/v2.0-editor-20180304
editor:更改部分内容显示的缩进
This commit is contained in:
commit
7ad578a2a2
@ -126,12 +126,12 @@ editor_mode.prototype.objToTr = function(obj,commentObj,field){
|
|||||||
|
|
||||||
var outstr=['<tr id="',guid,'"><td title="',field,'">',shortField,'</td>',
|
var outstr=['<tr id="',guid,'"><td title="',field,'">',shortField,'</td>',
|
||||||
'<td title="',commentHTMLescape,'">',shortCommentHTMLescape,'</td>',
|
'<td title="',commentHTMLescape,'">',shortCommentHTMLescape,'</td>',
|
||||||
'<td><div class="etableInputDiv">',editor_mode.objToTd(thiseval,comment),'</div></td></tr>\n',
|
'<td><div class="etableInputDiv">',editor_mode.objToTd(thiseval,comment,field),'</div></td></tr>\n',
|
||||||
];
|
];
|
||||||
return [outstr.join(''),guid];
|
return [outstr.join(''),guid];
|
||||||
}
|
}
|
||||||
|
|
||||||
editor_mode.prototype.objToTd = function(thiseval,comment){
|
editor_mode.prototype.objToTd = function(thiseval,comment,field){
|
||||||
if( comment.indexOf('$select') != -1){
|
if( comment.indexOf('$select') != -1){
|
||||||
var evalstr = comment.split('$select')[1].split('$end')[0];
|
var evalstr = comment.split('$select')[1].split('$end')[0];
|
||||||
var values = eval(evalstr)['values'];
|
var values = eval(evalstr)['values'];
|
||||||
@ -145,10 +145,19 @@ editor_mode.prototype.objToTd = function(thiseval,comment){
|
|||||||
return ["<input spellcheck='false' value='",JSON.stringify(thiseval),"'/>\n"].join('');
|
return ["<input spellcheck='false' value='",JSON.stringify(thiseval),"'/>\n"].join('');
|
||||||
} else {
|
} else {
|
||||||
//rows='",rows,"'
|
//rows='",rows,"'
|
||||||
return ["<textarea spellcheck='false' >",JSON.stringify(thiseval,null,4),'</textarea>\n'].join('');
|
var num = 0;//editor_mode.indent(field);
|
||||||
|
return ["<textarea spellcheck='false' >",JSON.stringify(thiseval,null,num),'</textarea>\n'].join('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
editor_mode.prototype.indent = function(field){
|
||||||
|
var num = 4;
|
||||||
|
if(field.indexOf("['main']")===0)return 0;
|
||||||
|
if(field.indexOf("['flyRange']")!==-1)return 0;
|
||||||
|
if(field==="['special']")return 0;
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
editor_mode.prototype.addAction = function(action){
|
editor_mode.prototype.addAction = function(action){
|
||||||
editor_mode.actionList.push(action);
|
editor_mode.actionList.push(action);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,10 @@ editor_multi.isString=false;
|
|||||||
editor_multi.show = function(){document.getElementById('left7').style='';}
|
editor_multi.show = function(){document.getElementById('left7').style='';}
|
||||||
editor_multi.hide = function(){document.getElementById('left7').style='z-index:-1;opacity: 0;';}
|
editor_multi.hide = function(){document.getElementById('left7').style='z-index:-1;opacity: 0;';}
|
||||||
|
|
||||||
|
editor_multi.indent = function(field){
|
||||||
|
if(editor && editor.mode && editor.mode.indent)return editor.mode.indent(field);
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
editor_multi.import = function(id_){
|
editor_multi.import = function(id_){
|
||||||
var thisTr = document.getElementById(id_);
|
var thisTr = document.getElementById(id_);
|
||||||
@ -29,9 +33,10 @@ editor_multi.import = function(id_){
|
|||||||
editor_multi.isString=true;
|
editor_multi.isString=true;
|
||||||
codeEditor.setValue(JSON.parse(input.value)||'');
|
codeEditor.setValue(JSON.parse(input.value)||'');
|
||||||
} else {
|
} else {
|
||||||
|
var num = editor_multi.indent(field);
|
||||||
eval('var tobj='+(input.value||'null'));
|
eval('var tobj='+(input.value||'null'));
|
||||||
var tmap={};
|
var tmap={};
|
||||||
var tstr = JSON.stringify(tobj,function(k,v){if(typeof(v)===typeof('') && v.slice(0,8)==='function'){var id_ = editor.guid();tmap[id_]=v.toString();return id_;}else return v},4);
|
var tstr = JSON.stringify(tobj,function(k,v){if(typeof(v)===typeof('') && v.slice(0,8)==='function'){var id_ = editor.guid();tmap[id_]=v.toString();return id_;}else return v},num);
|
||||||
for(var id_ in tmap){
|
for(var id_ in tmap){
|
||||||
tstr = tstr.replace('"'+id_+'"',tmap[id_])
|
tstr = tstr.replace('"'+id_+'"',tmap[id_])
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user