diff options
Diffstat (limited to 'js')
4 files changed, 47 insertions, 15 deletions
diff --git a/js/components/ui/tree-basic/treeItem.reel/treeItem.js b/js/components/ui/tree-basic/treeItem.reel/treeItem.js index a67dad43..13e278e9 100755 --- a/js/components/ui/tree-basic/treeItem.reel/treeItem.js +++ b/js/components/ui/tree-basic/treeItem.reel/treeItem.js | |||
@@ -107,8 +107,8 @@ exports.TreeItem = Montage.create(Component, { | |||
107 | //icon or text click sends selection event | 107 | //icon or text click sends selection event |
108 | var contentEls = this.element.querySelectorAll(".atreeItemContent"); | 108 | var contentEls = this.element.querySelectorAll(".atreeItemContent"); |
109 | for(var i=0;i<contentEls.length;i++){ | 109 | for(var i=0;i<contentEls.length;i++){ |
110 | contentEls[i].addEventListener("click", function(evt){that.handleTreeItemContentClick(evt);}, false); | 110 | contentEls[i].addEventListener("click", function(evt){that.handleTreeItemContentClick(evt);}, true); |
111 | contentEls[i].addEventListener("dblclick", function(evt){that.handleTreeItemContentDblclick(evt);}, false); | 111 | contentEls[i].addEventListener("dblclick", function(evt){that.handleTreeItemContentDblclick(evt);}, true); |
112 | } | 112 | } |
113 | 113 | ||
114 | this.element.addEventListener("mouseover", function(evt){that.handleTreeItemMouseover(evt);}, false); | 114 | this.element.addEventListener("mouseover", function(evt){that.handleTreeItemMouseover(evt);}, false); |
@@ -123,7 +123,7 @@ exports.TreeItem = Montage.create(Component, { | |||
123 | if(this.treeItemData.modifiedDate){this.metadata = this.metadata + "<br />" + "Modified date: "+ this.formatTimestamp(this.treeItemData.modifiedDate);} | 123 | if(this.treeItemData.modifiedDate){this.metadata = this.metadata + "<br />" + "Modified date: "+ this.formatTimestamp(this.treeItemData.modifiedDate);} |
124 | 124 | ||
125 | if((this.treeItemData.type === "directory") && (this.expandAfterDraw === true)){ | 125 | if((this.treeItemData.type === "directory") && (this.expandAfterDraw === true)){ |
126 | this.toggleContent(this.treeArrow); | 126 | this.expand(this.treeArrow); |
127 | } | 127 | } |
128 | if(this.treeItemData.uri === this.highlightedUri){ | 128 | if(this.treeItemData.uri === this.highlightedUri){ |
129 | this.itemName.classList.add("selected"); | 129 | this.itemName.classList.add("selected"); |
@@ -171,6 +171,35 @@ exports.TreeItem = Montage.create(Component, { | |||
171 | } | 171 | } |
172 | }, | 172 | }, |
173 | 173 | ||
174 | expand:{ | ||
175 | writable:false, | ||
176 | enumerable:true, | ||
177 | value:function(el){ | ||
178 | //if children already drawn then just hide/show | ||
179 | if(this.element.getElementsByTagName("ul").length > 0){ | ||
180 | var theParent = this.element.getElementsByTagName("ul")[0].parentNode; | ||
181 | if(theParent.classList.contains("hideTree")){//collapsed | ||
182 | theParent.classList.remove("hideTree");//expand | ||
183 | el.innerHTML = "▼"; | ||
184 | } | ||
185 | } | ||
186 | //else send event to draw the children | ||
187 | else{ | ||
188 | var treeClickEvent = document.createEvent("Events"); | ||
189 | treeClickEvent.initEvent("drawTree", false, false); | ||
190 | treeClickEvent.uri = this.treeItemData.uri; | ||
191 | treeClickEvent.uriType = this.treeItemData.type; | ||
192 | var divEl = document.createElement("div"); | ||
193 | this.element.appendChild(divEl); | ||
194 | treeClickEvent.subTreeContainer = divEl; | ||
195 | this.element.dispatchEvent(treeClickEvent); | ||
196 | |||
197 | el.innerHTML = "▼"; | ||
198 | } | ||
199 | } | ||
200 | }, | ||
201 | |||
202 | |||
174 | /** | 203 | /** |
175 | * Event Listeners | 204 | * Event Listeners |
176 | */ | 205 | */ |
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 539fd13e..d5556fa8 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -64,10 +64,16 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
64 | 64 | ||
65 | this.eventManager.addEventListener("styleSheetDirty", this, false); | 65 | this.eventManager.addEventListener("styleSheetDirty", this, false); |
66 | 66 | ||
67 | this.eventManager.addEventListener("addComponentFirstDraw", this, false); | ||
67 | } | 68 | } |
68 | }, | 69 | }, |
69 | 70 | ||
70 | 71 | handleAddComponentFirstDraw: { | |
72 | value: function (e) { | ||
73 | //TODO: Add logic to reparse the document for dynamically added styles | ||
74 | console.log(e); | ||
75 | } | ||
76 | }, | ||
71 | 77 | ||
72 | 78 | ||
73 | 79 | ||
diff --git a/js/document/templates/montage-html/main.reel/main.js b/js/document/templates/montage-html/main.reel/main.js index 2970f37a..019c675e 100644 --- a/js/document/templates/montage-html/main.reel/main.js +++ b/js/document/templates/montage-html/main.reel/main.js | |||
@@ -31,8 +31,6 @@ exports.Main = Montage.create(Component, { | |||
31 | componentInstance.needsDraw = true; | 31 | componentInstance.needsDraw = true; |
32 | componentInstance.ownerComponent = self; | 32 | componentInstance.ownerComponent = self; |
33 | 33 | ||
34 | componentInstance.addEventListener("firstDraw", self, false); | ||
35 | |||
36 | callback(componentInstance, element); | 34 | callback(componentInstance, element); |
37 | }) | 35 | }) |
38 | .end(); | 36 | .end(); |
@@ -46,14 +44,5 @@ exports.Main = Montage.create(Component, { | |||
46 | document.body.dispatchEvent( newEvent ); | 44 | document.body.dispatchEvent( newEvent ); |
47 | 45 | ||
48 | } | 46 | } |
49 | }, | ||
50 | |||
51 | handleFirstDraw: { | ||
52 | value: function() { | ||
53 | var newEvent = document.createEvent( "CustomEvent" ); | ||
54 | newEvent.initCustomEvent( "addComponentFirstDraw", false, true ); | ||
55 | |||
56 | document.body.dispatchEvent( newEvent ); | ||
57 | } | ||
58 | } | 47 | } |
59 | }); \ No newline at end of file | 48 | }); \ No newline at end of file |
diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js index 599eeda3..3505393c 100755 --- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js +++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js | |||
@@ -297,6 +297,8 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component | |||
297 | styles[n] = defaultStyles[n]; | 297 | styles[n] = defaultStyles[n]; |
298 | } | 298 | } |
299 | } | 299 | } |
300 | |||
301 | instance.addEventListener('firstDraw', that, false); | ||
300 | 302 | ||
301 | that.application.ninja.currentDocument.setComponentInstance(instance, element); | 303 | that.application.ninja.currentDocument.setComponentInstance(instance, element); |
302 | 304 | ||
@@ -305,6 +307,12 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component | |||
305 | 307 | ||
306 | } | 308 | } |
307 | }, | 309 | }, |
310 | |||
311 | handleFirstDraw: { | ||
312 | value: function (e) { | ||
313 | NJevent("addComponentFirstDraw"); | ||
314 | } | ||
315 | }, | ||
308 | 316 | ||
309 | makeComponent: { | 317 | makeComponent: { |
310 | value: function(name) { | 318 | value: function(name) { |