mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Remember test expression data on a per-node basis
This commit is contained in:
parent
749b0d7019
commit
3d2e6aea7b
@ -1657,7 +1657,14 @@ RED.editor = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var expressionTestCache = {};
|
||||||
|
|
||||||
function editExpression(options) {
|
function editExpression(options) {
|
||||||
|
var expressionTestCacheId = "_";
|
||||||
|
if (editStack.length > 0) {
|
||||||
|
expressionTestCacheId = editStack[editStack.length-1].id;
|
||||||
|
}
|
||||||
|
|
||||||
var value = options.value;
|
var value = options.value;
|
||||||
var onComplete = options.complete;
|
var onComplete = options.complete;
|
||||||
var type = "_expression"
|
var type = "_expression"
|
||||||
@ -1838,7 +1845,7 @@ RED.editor = (function() {
|
|||||||
});
|
});
|
||||||
testDataEditor = RED.editor.createEditor({
|
testDataEditor = RED.editor.createEditor({
|
||||||
id: 'node-input-expression-test-data',
|
id: 'node-input-expression-test-data',
|
||||||
value: '{\n "payload": "hello world"\n}',
|
value: expressionTestCache[expressionTestCacheId] || '{\n "payload": "hello world"\n}',
|
||||||
mode:"ace/mode/json",
|
mode:"ace/mode/json",
|
||||||
lineNumbers: false
|
lineNumbers: false
|
||||||
});
|
});
|
||||||
@ -1900,6 +1907,7 @@ RED.editor = (function() {
|
|||||||
testDataEditor.getSession().on('change', function() {
|
testDataEditor.getSession().on('change', function() {
|
||||||
clearTimeout(changeTimer);
|
clearTimeout(changeTimer);
|
||||||
changeTimer = setTimeout(testExpression,200);
|
changeTimer = setTimeout(testExpression,200);
|
||||||
|
expressionTestCache[expressionTestCacheId] = testDataEditor.getValue();
|
||||||
});
|
});
|
||||||
expressionEditor.getSession().on('change', function() {
|
expressionEditor.getSession().on('change', function() {
|
||||||
clearTimeout(changeTimer);
|
clearTimeout(changeTimer);
|
||||||
|
Loading…
Reference in New Issue
Block a user