对function更好的支持
This commit is contained in:
parent
15cdfa0f23
commit
68fa560b0c
@ -29,7 +29,13 @@ 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 {
|
||||||
codeEditor.setValue(input.value||'');
|
eval('var tobj='+input.value);
|
||||||
|
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);
|
||||||
|
for(var id_ in tmap){
|
||||||
|
tstr = tstr.replace('"'+id_+'"',tmap[id_])
|
||||||
|
}
|
||||||
|
codeEditor.setValue(tstr||'');
|
||||||
}
|
}
|
||||||
editor_multi.show();
|
editor_multi.show();
|
||||||
return true;
|
return true;
|
||||||
@ -58,7 +64,13 @@ editor_multi.confirm = function (){
|
|||||||
if(editor_multi.isString){
|
if(editor_multi.isString){
|
||||||
input.value = JSON.stringify(value);
|
input.value = JSON.stringify(value);
|
||||||
} else {
|
} else {
|
||||||
input.value = value;
|
eval('var tobj='+value);
|
||||||
|
var tmap={};
|
||||||
|
var tstr = JSON.stringify(tobj,function(k,v){if(v instanceof Function){var id_ = editor.guid();tmap[id_]=v.toString();return id_;}else return v},4);
|
||||||
|
for(var id_ in tmap){
|
||||||
|
tstr = tstr.replace('"'+id_+'"',JSON.stringify(tmap[id_]))
|
||||||
|
}
|
||||||
|
input.value = tstr;
|
||||||
}
|
}
|
||||||
editor_multi.hide();
|
editor_multi.hide();
|
||||||
input.onchange();
|
input.onchange();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user