[CCSDK-683] fixed dg import from local git repo
[ccsdk/distribution.git] / dgbuilder / public / red / ui / library.js
index 0c803bf..b3a556d 100644 (file)
@@ -51,6 +51,11 @@ RED.library = (function() {
                             a.flowName = root+(root!==""?"/":"")+data.f[i];
                             a.onclick = function() {
                                 $.get('library/flows/'+this.flowName, function(data) {
+                                       var nodeSet = getCurrentFlowNodeSet();
+                                        //console.dir(nodeSet);
+                                        if(nodeSet != null && nodeSet.length == 0){
+                                                RED.view.setIsImportAction(true);
+                                        }
                                         RED.view.importNodes(data);
                                 });
                             };
@@ -74,7 +79,19 @@ RED.library = (function() {
         var libraryData = {};
         var selectedLibraryItem = null;
         var libraryEditor = null;
-        
+       // Orion editor has set/getText
+        // ACE editor has set/getValue
+        // normalise to set/getValue
+        if (options.editor.setText) {
+            // Orion doesn't like having pos passed in, so proxy the call to drop it
+            options.editor.setValue = function(text,pos) {
+                options.editor.setText.call(options.editor,text);
+            }
+        }
+        if (options.editor.getText) {
+            options.editor.getValue = options.editor.getText;
+        }
         function buildFileListItem(item) {
             var li = document.createElement("li");
             li.onmouseover = function(e) { $(this).addClass("list-hover"); };