diff --git a/nodes/core/core/80-function.html b/nodes/core/core/80-function.html index c07978a0a..cef0809d8 100644 --- a/nodes/core/core/80-function.html +++ b/nodes/core/core/80-function.html @@ -100,32 +100,23 @@ $( "#dialog" ).off("dialogresize",functionDialogResize); }); - ace.require("ace/ext/language_tools"); - that.editor = ace.edit('node-input-func-editor'); - that.editor.setText = that.editor.setValue; // alias to make library work :-) - that.editor.getText = that.editor.getValue; // alias to make library work - //that.editor.setTheme("ace/theme/solarized_light"); - //that.editor.setTheme("ace/theme/crimson_editor"); - //that.editor.setTheme("ace/theme/chrome"); - that.editor.setTheme("ace/theme/tomorrow"); - that.editor.getSession().setMode("ace/mode/javascript"); - that.editor.getSession().setFoldStyle("markbeginend"); - that.editor.setOptions({enableBasicAutocompletion:true, enableSnippets:true}); - that.editor.$blockScrolling = Infinity; - that.editor.setValue($("#node-input-func").val()); - that.editor.gotoLine(1,1); - document.getElementById('node-input-func-editor').style.fontSize='17px'; + this.editor = RED.editor.createEditor({ + id: 'node-input-func-editor', + mode: 'ace/mode/javascript' + }); + this.editor.setValue($("#node-input-func").val(),-1); + RED.library.create({ url:"functions", // where to get the data from type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/javascript", fields:['name','outputs'] }); - $("#node-input-name").focus(); + this.editor.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); diff --git a/nodes/core/core/80-template.html b/nodes/core/core/80-template.html index c0277064d..f88c8c5ab 100644 --- a/nodes/core/core/80-template.html +++ b/nodes/core/core/80-template.html @@ -22,7 +22,7 @@
- @@ -61,7 +61,7 @@ defaults: { name: {value:""}, field: {value:"payload"}, - mark: {value:"handlebars"}, + format: {value:"handlebars"}, template: {value:"This is the payload: {{payload}} !"}, }, inputs:1, @@ -96,30 +96,21 @@ var height = $( "#dialog" ).dialog('option','height'); $( "#dialog" ).off("dialogresize",templateDialogResize); }); - ace.require("ace/ext/language_tools"); - that.editor = ace.edit('node-input-template-editor'); - that.editor.setText = that.editor.setValue; // alias to make library work :-) - that.editor.getText = that.editor.getValue; // alias to make library work - //that.editor.setTheme("ace/theme/solarized_light"); - //that.editor.setTheme("ace/theme/crimson_editor"); - //that.editor.setTheme("ace/theme/chrome"); - that.editor.setTheme("ace/theme/tomorrow"); - that.editor.getSession().setMode("ace/mode/html"); - that.editor.getSession().setFoldStyle("markbeginend"); - that.editor.setOptions({enableBasicAutocompletion:true, enableSnippets:true}); - that.editor.$blockScrolling = Infinity; - that.editor.setValue($("#node-input-template").val()); - that.editor.gotoLine(1); - document.getElementById('node-input-template-editor').style.fontSize='17px'; + this.editor = RED.editor.createEditor({ + id: 'node-input-template-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-template").val(),-1); RED.library.create({ url:"functions", // where to get the data from type:"function", // the type of object the library is for editor:that.editor, // the field name the main text body goes to fields:['name','outputs'] }); - $("#node-input-name").focus(); - $("#node-input-mark").change(function() { - var mod = "ace/mode/"+$("#node-input-mark").val(); + this.editor.focus(); + + $("#node-input-format").change(function() { + var mod = "ace/mode/"+$("#node-input-format").val(); that.editor.getSession().setMode({ path: mod, v: Date.now() diff --git a/nodes/core/core/90-comment.html b/nodes/core/core/90-comment.html index 032955d6d..fd4106817 100644 --- a/nodes/core/core/90-comment.html +++ b/nodes/core/core/90-comment.html @@ -84,16 +84,12 @@ var height = $( "#dialog" ).dialog('option','height'); $( "#dialog" ).off("dialogresize",functionDialogResize); }); - ace.require("ace/ext/language_tools"); - that.editor = ace.edit('node-input-info-editor'); - that.editor.setTheme("ace/theme/chrome"); - that.editor.getSession().setMode("ace/mode/markdown"); - that.editor.getSession().setFoldStyle("markbeginend"); - that.editor.setOptions({enableBasicAutocompletion:true, enableSnippets:true}); - that.editor.$blockScrolling = Infinity; - that.editor.setValue($("#node-input-info").val()); - that.editor.gotoLine(1); - document.getElementById('node-input-info-editor').style.fontSize='17px'; + this.editor = RED.editor.createEditor({ + id: 'node-input-info-editor', + mode: 'ace/mode/markdown' + }); + this.editor.setValue($("#node-input-info").val(),-1); + this.editor.focus(); }, oneditsave: function() { $("#node-input-info").val(this.editor.getValue()); diff --git a/public/index.html b/public/index.html index e2bdb2a04..ae871f541 100644 --- a/public/index.html +++ b/public/index.html @@ -6,7 +6,7 @@