From 8af50a51ba8a474dfd7767519a9719772e491c72 Mon Sep 17 00:00:00 2001 From: dceejay Date: Fri, 13 Feb 2015 22:07:31 +0000 Subject: [PATCH] add validation triangle to ace function editor on errors --- nodes/core/core/80-function.html | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/nodes/core/core/80-function.html b/nodes/core/core/80-function.html index e11e1e242..c07978a0a 100644 --- a/nodes/core/core/80-function.html +++ b/nodes/core/core/80-function.html @@ -20,8 +20,9 @@
- - + + +
@@ -59,7 +60,8 @@ defaults: { name: {value:""}, func: {value:"\nreturn msg;"}, - outputs: {value:1} + outputs: {value:1}, + valid: {value:true,required:true} }, inputs:1, outputs:1, @@ -122,6 +124,16 @@ $("#node-input-name").focus(); }, 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()); delete this.editor; }