Merge "[CCSDK-683] fixed dg import from local git repo"
[ccsdk/distribution.git] / dgbuilder / public / red / ui / editor.js
index c5f7986..cae74d0 100644 (file)
@@ -234,6 +234,11 @@ RED.editor = (function() {
                                 }
                             }
                         } else if (RED.view.state() == RED.state.IMPORT) {
+                               var nodeSet = getCurrentFlowNodeSet();
+                                //console.dir(nodeSet);
+                                if(nodeSet != null && nodeSet.length == 0){
+                                        RED.view.setIsImportAction(true);
+                                }
                             RED.view.importNodes($("#node-input-import").val());
                         }
                         $( this ).dialog( "close" );
@@ -660,6 +665,33 @@ RED.editor = (function() {
         edit: showEditDialog,
         editConfig: showEditConfigNodeDialog,
         validateNode: validateNode,
-        updateNodeProperties: updateNodeProperties // TODO: only exposed for edit-undo
+        updateNodeProperties: updateNodeProperties, // TODO: only exposed for edit-undo
+        createEditor: function(options) {
+            var editor = ace.edit(options.id);
+            //editor.setTheme("ace/theme/tomorrow");
+            editor.setTheme("ace/theme/eclipse");
+            if (options.mode) {
+                editor.getSession().setMode(options.mode);
+            }
+            if (options.foldStyle) {
+                editor.getSession().setFoldStyle(options.foldStyle);
+            } else {
+                editor.getSession().setFoldStyle('markbeginend');
+            }
+
+       
+            if (options.options) {
+                editor.setOptions(options.options);
+            } else {
+                editor.setOptions({
+                    enableBasicAutocompletion:false ,
+                    enableSnippets:false ,
+                   fontSize: "14pt" ,
+                   showGutter: false
+                });
+            }
+            editor.$blockScrolling = Infinity;
+               return editor;
+       }
     }
 })();