1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Expression editor - clear legacy flag for blank expressions

This commit is contained in:
Nick O'Leary 2017-06-26 14:12:20 +01:00
parent b63d243e33
commit e590313297
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -1863,7 +1863,8 @@ RED.editor = (function() {
var currentExpression = expressionEditor.getValue(); var currentExpression = expressionEditor.getValue();
var expr; var expr;
var usesContext = false; var usesContext = false;
var legacyMode = false; var legacyMode = /(^|[^a-zA-Z0-9_'"])msg([^a-zA-Z0-9_'"]|$)/.test(currentExpression);
$(".node-input-expression-legacy").toggle(legacyMode);
try { try {
expr = jsonata(currentExpression); expr = jsonata(currentExpression);
expr.assign('flowContext',function(val) { expr.assign('flowContext',function(val) {
@ -1874,12 +1875,10 @@ RED.editor = (function() {
usesContext = true; usesContext = true;
return null; return null;
}); });
legacyMode = /(^|[^a-zA-Z0-9_'"])msg([^a-zA-Z0-9_'"]|$)/.test(currentExpression);
} catch(err) { } catch(err) {
testResultEditor.setValue(RED._("expressionEditor.errors.invalid-expr",{message:err.message}),-1); testResultEditor.setValue(RED._("expressionEditor.errors.invalid-expr",{message:err.message}),-1);
return; return;
} }
$(".node-input-expression-legacy").toggle(legacyMode);
try { try {
parsedData = JSON.parse(value); parsedData = JSON.parse(value);
} catch(err) { } catch(err) {