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

change user prop name for injected values

- less chance for collision
This commit is contained in:
Steve-Mcl 2021-05-20 22:35:42 +01:00
parent bae6bfc32d
commit 9d7b8f1f2f
2 changed files with 5 additions and 5 deletions

View File

@ -750,7 +750,7 @@
var items = $('#node-inject-custom-list').editableList('items'); var items = $('#node-inject-custom-list').editableList('items');
var result = getProps(items); var result = getProps(items);
if (result && result.props && result.props.length) { if (result && result.props && result.props.length) {
m = { __customProps: result.props }; m = { __user_inject_props__: result.props };
} }
doInject(m); doInject(m);
//RED.tray.close(); //RED.tray.close();

View File

@ -101,10 +101,10 @@ module.exports = function(RED) {
this.on("input", function(msg, send, done) { this.on("input", function(msg, send, done) {
var errors = []; var errors = [];
var props = this.props; var props = this.props;
if(msg.__customProps && Array.isArray(msg.__customProps)) { if(msg.__user_inject_props__ && Array.isArray(msg.__user_inject_props__)) {
props = msg.__customProps; props = msg.__user_inject_props__;
} }
delete msg.__customProps; delete msg.__user_inject_props__;
props.forEach(p => { props.forEach(p => {
var property = p.p; var property = p.p;
var value = p.v ? p.v : ''; var value = p.v ? p.v : '';
@ -160,7 +160,7 @@ module.exports = function(RED) {
var node = RED.nodes.getNode(req.params.id); var node = RED.nodes.getNode(req.params.id);
if (node != null) { if (node != null) {
try { try {
if (req.body && req.body.__customProps) { if (req.body && req.body.__user_inject_props__) {
node.receive(req.body); node.receive(req.body);
} else { } else {
node.receive(); node.receive();