mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
add validation triangle to ace function editor on errors
This commit is contained in:
parent
ddf31e87b2
commit
8af50a51ba
@ -20,8 +20,9 @@
|
|||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row" style="margin-bottom: 0px;">
|
<div class="form-row" style="margin-bottom: 0px;">
|
||||||
<label for="node-input-func"><i class="fa fa-wrench"></i> Function</label>
|
<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-func" autofocus="autofocus">
|
||||||
|
<input type="hidden" id="node-input-valid">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row node-text-editor-row">
|
<div class="form-row node-text-editor-row">
|
||||||
<div style="height: 250px;" class="node-text-editor" id="node-input-func-editor" ></div>
|
<div style="height: 250px;" class="node-text-editor" id="node-input-func-editor" ></div>
|
||||||
@ -59,7 +60,8 @@
|
|||||||
defaults: {
|
defaults: {
|
||||||
name: {value:""},
|
name: {value:""},
|
||||||
func: {value:"\nreturn msg;"},
|
func: {value:"\nreturn msg;"},
|
||||||
outputs: {value:1}
|
outputs: {value:1},
|
||||||
|
valid: {value:true,required:true}
|
||||||
},
|
},
|
||||||
inputs:1,
|
inputs:1,
|
||||||
outputs:1,
|
outputs:1,
|
||||||
@ -122,6 +124,16 @@
|
|||||||
$("#node-input-name").focus();
|
$("#node-input-name").focus();
|
||||||
},
|
},
|
||||||
oneditsave: function() {
|
oneditsave: function() {
|
||||||
|
var annot = this.editor.getSession().getAnnotations();
|
||||||
|
console.log(this);
|
||||||
|
this.valid = true;
|
||||||
|
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(null);
|
||||||
|
delete this.valid;
|
||||||
|
}
|
||||||
|
}
|
||||||
$("#node-input-func").val(this.editor.getValue());
|
$("#node-input-func").val(this.editor.getValue());
|
||||||
delete this.editor;
|
delete this.editor;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user