diff options
Diffstat (limited to 'js/document')
-rwxr-xr-x | js/document/document-html.js | 3 | ||||
-rwxr-xr-x | js/document/models/base.js | 13 | ||||
-rwxr-xr-x | js/document/models/html.js | 3 | ||||
-rw-r--r-- | js/document/templates/app/main.js | 4 | ||||
-rwxr-xr-x | js/document/views/design.js | 8 |
5 files changed, 24 insertions, 7 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js index b9c8e797..56f4e3d3 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js | |||
@@ -106,7 +106,8 @@ exports.HtmlDocument = Montage.create(Component, { | |||
106 | } | 106 | } |
107 | }, | 107 | }, |
108 | handleViewReady: { | 108 | handleViewReady: { |
109 | value: function() { | 109 | value: function(mObjects) { |
110 | this.model.mObjects = mObjects; | ||
110 | // TODO: Find a better way to initialize this property | 111 | // TODO: Find a better way to initialize this property |
111 | // Assign the domContainer to be the document root on open | 112 | // Assign the domContainer to be the document root on open |
112 | if(typeof this.model.domContainer !== "undefined") { | 113 | if(typeof this.model.domContainer !== "undefined") { |
diff --git a/js/document/models/base.js b/js/document/models/base.js index 8ff52132..1daec5c0 100755 --- a/js/document/models/base.js +++ b/js/document/models/base.js | |||
@@ -95,6 +95,19 @@ exports.BaseDocumentModel = Montage.create(Component, { | |||
95 | libs: { | 95 | libs: { |
96 | value: null | 96 | value: null |
97 | }, | 97 | }, |
98 | |||
99 | _mObjects: { | ||
100 | value: [] | ||
101 | }, | ||
102 | |||
103 | mObjects: { | ||
104 | get: function() { | ||
105 | return this._mObjects; | ||
106 | }, | ||
107 | set: function(value) { | ||
108 | this._mObjects = value; | ||
109 | } | ||
110 | }, | ||
98 | //////////////////////////////////////////////////////////////////// | 111 | //////////////////////////////////////////////////////////////////// |
99 | // | 112 | // |
100 | switchViewTo: { | 113 | switchViewTo: { |
diff --git a/js/document/models/html.js b/js/document/models/html.js index 4a232ee1..d9002b4e 100755 --- a/js/document/models/html.js +++ b/js/document/models/html.js | |||
@@ -68,9 +68,10 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, { | |||
68 | // | 68 | // |
69 | webGlHelper: { | 69 | webGlHelper: { |
70 | value: null | 70 | value: null |
71 | }, | 71 | } |
72 | //////////////////////////////////////////////////////////////////// | 72 | //////////////////////////////////////////////////////////////////// |
73 | //////////////////////////////////////////////////////////////////// | 73 | //////////////////////////////////////////////////////////////////// |
74 | |||
74 | }); | 75 | }); |
75 | //////////////////////////////////////////////////////////////////////// | 76 | //////////////////////////////////////////////////////////////////////// |
76 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file | 77 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file |
diff --git a/js/document/templates/app/main.js b/js/document/templates/app/main.js index 8dc05ba5..7737ae4c 100644 --- a/js/document/templates/app/main.js +++ b/js/document/templates/app/main.js | |||
@@ -61,7 +61,7 @@ exports.Main = Montage.create(Component, { | |||
61 | var componentRequire = component[data.name]; | 61 | var componentRequire = component[data.name]; |
62 | var componentInstance = componentRequire.create(); | 62 | var componentInstance = componentRequire.create(); |
63 | 63 | ||
64 | 64 | componentInstance._montage_metadata.label = componentInstance.identifier = data.name; | |
65 | componentInstance.addEventListener("firstDraw", self, false); | 65 | componentInstance.addEventListener("firstDraw", self, false); |
66 | 66 | ||
67 | componentInstance.element = element; | 67 | componentInstance.element = element; |
@@ -69,8 +69,6 @@ exports.Main = Montage.create(Component, { | |||
69 | componentInstance.ownerComponent = self; | 69 | componentInstance.ownerComponent = self; |
70 | 70 | ||
71 | self.componentToInsert = componentInstance; | 71 | self.componentToInsert = componentInstance; |
72 | |||
73 | |||
74 | callback(componentInstance, element); | 72 | callback(componentInstance, element); |
75 | }) | 73 | }) |
76 | .end(); | 74 | .end(); |
diff --git a/js/document/views/design.js b/js/document/views/design.js index 44c61617..4a75a1b4 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js | |||
@@ -454,21 +454,25 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
454 | initMontage: { | 454 | initMontage: { |
455 | value: function (scripttags) { | 455 | value: function (scripttags) { |
456 | var self = this; | 456 | var self = this; |
457 | // | 457 | |
458 | this.iframe.contentWindow.document.body.addEventListener('mjsTemplateReady', function () { | 458 | this.iframe.contentWindow.document.body.addEventListener('mjsTemplateReady', function () { |
459 | //Initializing template with user's seriliazation | 459 | //Initializing template with user's seriliazation |
460 | var template = this.iframe.contentWindow.mjsTemplate.create(); | 460 | var template = this.iframe.contentWindow.mjsTemplate.create(); |
461 | |||
461 | template.initWithDocument(this.iframe.contentWindow.document); | 462 | template.initWithDocument(this.iframe.contentWindow.document); |
462 | template.instantiateWithOwnerAndDocument(null, this.iframe.contentWindow.document, function (){ | 463 | template.instantiateWithOwnerAndDocument(null, this.iframe.contentWindow.document, function (){ |
463 | //TODO: Verify this is properly done, seems like a hack | 464 | //TODO: Verify this is properly done, seems like a hack |
465 | |||
466 | var objArray = []; | ||
464 | for (var c in template._deserializer._objects) { | 467 | for (var c in template._deserializer._objects) { |
465 | //Forcing draw on components | 468 | //Forcing draw on components |
466 | template._deserializer._objects[c].needsDraw = true; | 469 | template._deserializer._objects[c].needsDraw = true; |
470 | objArray.push(template._deserializer._objects[c]); | ||
467 | } | 471 | } |
468 | 472 | ||
469 | // Now call the view callback | 473 | // Now call the view callback |
470 | if(self._viewCallback) { | 474 | if(self._viewCallback) { |
471 | self._viewCallback.viewCallback.call(self._viewCallback.context); | 475 | self._viewCallback.viewCallback.call(self._viewCallback.context, objArray); |
472 | } | 476 | } |
473 | 477 | ||
474 | }); | 478 | }); |