aboutsummaryrefslogtreecommitdiff
path: root/js/document/document-html.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/document/document-html.js')
-rwxr-xr-xjs/document/document-html.js20
1 files changed, 16 insertions, 4 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js
index 33a41a8e..15f88d09 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -68,6 +68,8 @@ exports.HtmlDocument = Montage.create(Component, {
68 if (this.model.views.design.initialize(this.model.parentContainer)) { 68 if (this.model.views.design.initialize(this.model.parentContainer)) {
69 //Hiding iFrame, just initiliazing 69 //Hiding iFrame, just initiliazing
70 this.model.views.design.hide(); 70 this.model.views.design.hide();
71 //Setting the iFrame property for reference in helper class
72 this.model.webGlHelper.iframe = this.model.views.design.iframe;
71 } else { 73 } else {
72 //ERROR: Design View not initialized 74 //ERROR: Design View not initialized
73 } 75 }
@@ -82,13 +84,13 @@ exports.HtmlDocument = Montage.create(Component, {
82 this.model.views.design.iframe.style.opacity = 0; 84 this.model.views.design.iframe.style.opacity = 0;
83 this.model.views.design.content = this.model.file.content; 85 this.model.views.design.content = this.model.file.content;
84 //TODO: Improve reference (probably through binding values) 86 //TODO: Improve reference (probably through binding values)
85 this.model.views.design.model = this.model; 87 this.model.views.design._webGlHelper = this.model.webGlHelper;
86 //Rendering design view, using observers to know when template is ready 88 //Rendering design view, using observers to know when template is ready
87 this.model.views.design.render(function () { 89 this.model.views.design.render(function () {
88 //Adding observer to know when template is ready 90 //Adding observer to know when template is ready
89 this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this)); 91 this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this));
90 this._observer.observe(this.model.views.design.document.head, {childList: true}); 92 this._observer.observe(this.model.views.design.document.head, {childList: true});
91 }.bind(this), template); 93 }.bind(this), template, {viewCallback: this.handleViewReady, context: this});
92 } else { 94 } else {
93 //TODO: Identify default view (probably code) 95 //TODO: Identify default view (probably code)
94 } 96 }
@@ -101,10 +103,20 @@ exports.HtmlDocument = Montage.create(Component, {
101 //Removing observer, only needed on initial load 103 //Removing observer, only needed on initial load
102 this._observer.disconnect(); 104 this._observer.disconnect();
103 this._observer = null; 105 this._observer = null;
104 //Making callback after view is loaded
105 this.loaded.callback.call(this.loaded.context, this);
106 } 106 }
107 }, 107 },
108 handleViewReady: {
109 value: function() {
110 // TODO: Find a better way to initialize this property
111 // Assign the domContainer to be the document root on open
112 if(typeof this.model.domContainer !== "undefined") {
113 this.model.domContainer = this.model.documentRoot;
114 }
115
116 //Making callback after view is loaded
117 this.loaded.callback.call(this.loaded.context, this);
118 }
119 },
108 //////////////////////////////////////////////////////////////////// 120 ////////////////////////////////////////////////////////////////////
109 // 121 //
110 closeDocument: { 122 closeDocument: {