removed dependency on built-editor.min.js
[ccsdk/distribution.git] / dgbuilder / nodes / dge / dgemain / comment.html
index c34d14c..f6da461 100644 (file)
@@ -22,6 +22,7 @@
     <div class="form-row">
         <label for="node-input-info" style="width: 100% !important;"><i class="fa fa-comments"></i> More</label>
         <input type="hidden" id="node-input-info" autofocus="autofocus">
+       <div class="form-row node-text-editor-row">
         <div style="height: 250px;" class="node-text-editor" id="node-input-info-editor" ></div>
         <input type="hidden" id="node-input-comments">
     </div>
         labelStyle: function() {
             return this.name?"node_label_italic":"";
         },
+        oneditprepare: function() {
+            var that = this;
+            $( "#node-input-outputs" ).spinner({
+                min:1
+            });
+            var comments = $( "#node-input-comments").val();
+            if(comments != null){
+               comments = comments.trim();
+               if(comments != ''){
+                       $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>");
+               }
+            }
+            function functionDialogResize() {
+                var rows = $("#dialog-form>div:not(.node-text-editor-row)");
+                var height = $("#dialog-form").height();
+                for (var i=0;i<rows.size();i++) {
+                    height -= $(rows[i]).outerHeight(true);
+                }
+                var editorRow = $("#dialog-form>div.node-text-editor-row");
+                height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom")));
+                $(".node-text-editor").css("height",height+"px");
+                that.editor.resize();
+            };
+            $( "#dialog" ).on("dialogresize", functionDialogResize);
+            $( "#dialog" ).one("dialogopen", function(ev) {
+                var size = $( "#dialog" ).dialog('option','sizeCache-function');
+                if (size) {
+                    $("#dialog").dialog('option','width',size.width);
+                    $("#dialog").dialog('option','height',size.height);
+                    functionDialogResize();
+                }
+            });
+            $( "#dialog" ).one("dialogclose", function(ev,ui) {
+                var height = $( "#dialog" ).dialog('option','height');
+                $( "#dialog" ).off("dialogresize",functionDialogResize);
+            });
+            this.editor = RED.editor.createEditor({
+                id: 'node-input-info-editor',
+                mode: 'ace/mode/markdown',
+               fontSize: "15pt"
+            });
+       console.dir(this.editor);
+           this.editor.setValue($("#node-input-info").val(),-1);
+           this.editor.focus();
+        },
+/*
         oneditprepare: function() {
             $( "#node-input-outputs" ).spinner({
                 min:1
                 });
                 $("#node-input-name").focus();
             });
+           this.editor = RED.editor.createEditor({
+                       id: 'node-input-info-editor',
+                       mode: 'ace/mode/markdown',
+                       options: {
+                               showLineNumbers : false,
+                               enableBasicAutocompletion : true,
+                               enableSnippets:true,
+                               fontSize: "14px"
+                       }
+               });
+            console.dir(this.editor);
+            this.editor.setValue($("#node-input-info").val(),-1);
+            this.editor.focus();
+
         },
+       */
         oneditsave: function() {
-            $("#node-input-info").val(this.editor.getText());
+            $("#node-input-info").val(this.editor.getValue());
             delete this.editor;
         }
     });