mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Add JSON Expression editor
This commit is contained in:
@@ -21,7 +21,31 @@
|
||||
str: {value:"str",label:"string",icon:"red/images/typedInput/az.png"},
|
||||
num: {value:"num",label:"number",icon:"red/images/typedInput/09.png",validate:/^[+-]?[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)?$/},
|
||||
bool: {value:"bool",label:"boolean",icon:"red/images/typedInput/bool.png",options:["true","false"]},
|
||||
json: {value:"json",label:"JSON",icon:"red/images/typedInput/json.png", validate: function(v) { try{JSON.parse(v);return true;}catch(e){return false;}}},
|
||||
json: {
|
||||
value:"json",
|
||||
label:"JSON",
|
||||
icon:"red/images/typedInput/json.png",
|
||||
validate: function(v) { try{JSON.parse(v);return true;}catch(e){return false;}},
|
||||
expand: function() {
|
||||
var that = this;
|
||||
var value = this.value();
|
||||
try {
|
||||
value = JSON.stringify(JSON.parse(value),null,4);
|
||||
} catch(err) {
|
||||
}
|
||||
RED.editor.editJSON({
|
||||
value: value,
|
||||
complete: function(v) {
|
||||
var value = v;
|
||||
try {
|
||||
value = JSON.stringify(JSON.parse(v));
|
||||
} catch(err) {
|
||||
}
|
||||
that.value(value);
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
re: {value:"re",label:"regular expression",icon:"red/images/typedInput/re.png"},
|
||||
date: {value:"date",label:"timestamp",hasValue:false},
|
||||
jsonata: {
|
||||
|
Reference in New Issue
Block a user