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

revert change to editor change detector, and redo function node valid

code "flag" to report as non-boolean.
This commit is contained in:
dceejay 2015-05-08 15:31:48 +01:00
parent 052302b3e7
commit 5ffde21d83
3 changed files with 9 additions and 11 deletions

View File

@ -230,7 +230,7 @@ RED.editor = (function() {
newValue = input.val();
}
if (newValue != null) {
if (editing_node[d].toString() != newValue.toString()) {
if (editing_node[d] != newValue) {
if (editing_node._def.defaults[d].type) {
if (newValue == "_ADD_") {
newValue = "";

View File

@ -22,7 +22,7 @@
<div class="form-row" style="margin-bottom: 0px;">
<label for="node-input-func"><i class="fa fa-wrench"></i> Function</label>
<input type="hidden" id="node-input-func" autofocus="autofocus">
<input type="hidden" id="node-input-valid">
<input type="hidden" id="node-input-noerr">
</div>
<div class="form-row node-text-editor-row">
<div style="height: 250px;" class="node-text-editor" id="node-input-func-editor" ></div>
@ -74,7 +74,7 @@
name: {value:""},
func: {value:"\nreturn msg;"},
outputs: {value:1},
valid: {value:true,required:true}
noerr: {value:0,required:true,validate:function(v){ return ((!v) || (v === 0)) ? true : false; }}
},
inputs:1,
outputs:1,
@ -130,12 +130,13 @@
},
oneditsave: function() {
var annot = this.editor.getSession().getAnnotations();
this.valid = true;
this.noerr = 0;
$("#node-input-noerr").val(0);
for (var k=0; k < annot.length; k++) {
//console.log(annot[k].type,":",annot[k].text, "on line", annot[k].row);
if (annot[k].type === "error") {
$("#node-input-valid").val(false);
this.valid = false;
$("#node-input-noerr").val(annot.length);
this.noerr = annot.length;
}
}
$("#node-input-func").val(this.editor.getValue());

View File

@ -19,7 +19,6 @@ module.exports = function(RED) {
var util = require("util");
var vm = require("vm");
function sendResults(node,_msgid,msgs) {
if (msgs == null) {
return;
@ -43,7 +42,6 @@ module.exports = function(RED) {
if (msgCount>0) {
node.send(msgs);
}
}
function FunctionNode(n) {
@ -126,7 +124,6 @@ module.exports = function(RED) {
this.error(err);
}
}
RED.nodes.registerType("function",FunctionNode);
RED.library.register("functions");
}