aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/controllers/document-controller.js8
-rw-r--r--js/document/templates/montage-html/main.reel/main.js11
-rwxr-xr-xjs/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js8
3 files changed, 15 insertions, 12 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 3db4c7d4..c6f867aa 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) {