diff --git a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json index c8abada3e..0300a220f 100755 --- a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json @@ -936,6 +936,9 @@ "invalid-expr": "Invalid JSONata expression:\n __message__", "invalid-msg": "Invalid example JSON message:\n __message__", "context-unsupported": "Cannot test context functions\n $flowContext or $globalContext", + "env-unsupported": "Cannot test $env function", + "moment-unsupported": "Cannot test $moment function", + "clone-unsupported": "Cannot test $clone function", "eval": "Error evaluating expression:\n __message__" } }, diff --git a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json index dc7858250..f5fbced50 100644 --- a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json @@ -936,6 +936,9 @@ "invalid-expr": "不正なJSONata式:\n __message__", "invalid-msg": "不正なJSONメッセージ例:\n __message__", "context-unsupported": "$flowContext や $globalContextの\nコンテキスト機能をテストできません", + "env-unsupported": "$env関数はテストできません", + "moment-unsupported": "$moment関数はテストできません", + "clone-unsupported": "$clone関数はテストできません", "eval": "表現評価エラー:\n __message__" } }, diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/expression.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/expression.js index b3c4c3848..d470e14f2 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/expression.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/expression.js @@ -255,6 +255,9 @@ var currentExpression = expressionEditor.getValue(); var expr; var usesContext = false; + var usesEnv = false; + var usesMoment = false; + var usesClone = false; var legacyMode = /(^|[^a-zA-Z0-9_'".])msg([^a-zA-Z0-9_'"]|$)/.test(currentExpression); $(".red-ui-editor-type-expression-legacy").toggle(legacyMode); try { @@ -267,6 +270,18 @@ usesContext = true; return null; }); + expr.assign("env", function(name) { + usesEnv = true; + return null; + }); + expr.assign("moment", function(name) { + usesMoment = true; + return null; + }); + expr.assign("clone", function(name) { + usesClone = true; + return null; + }); } catch(err) { testResultEditor.setValue(RED._("expressionEditor.errors.invalid-expr",{message:err.message}),-1); return; @@ -284,6 +299,18 @@ testResultEditor.setValue(RED._("expressionEditor.errors.context-unsupported"),-1); return; } + if (usesEnv) { + testResultEditor.setValue(RED._("expressionEditor.errors.env-unsupported"),-1); + return; + } + if (usesMoment) { + testResultEditor.setValue(RED._("expressionEditor.errors.moment-unsupported"),-1); + return; + } + if (usesClone) { + testResultEditor.setValue(RED._("expressionEditor.errors.clone-unsupported"),-1); + return; + } var formattedResult; if (result !== undefined) {