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.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js
index a59f5848..f3163339 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -164,7 +164,7 @@ exports.HtmlDocument = Montage.create(Component, {
164 //Adding observer to know when template is ready 164 //Adding observer to know when template is ready
165 this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this)); 165 this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this));
166 this._observer.observe(this.model.views.design.document.head, {childList: true}); 166 this._observer.observe(this.model.views.design.document.head, {childList: true});
167 }.bind(this), template, {viewCallback: this.handleViewReady, context: this}); 167 }.bind(this), template, {viewCallback: this.handleReloadViewReady, context: this});
168 } else if(view === 'code'){ 168 } else if(view === 'code'){
169 //TODO: Add logic to handle external changed files 169 //TODO: Add logic to handle external changed files
170 //Checking for template type and not saving external data 170 //Checking for template type and not saving external data
@@ -176,6 +176,7 @@ exports.HtmlDocument = Montage.create(Component, {
176 //Setting current view object to code 176 //Setting current view object to code
177 this.currentView = 'code'; 177 this.currentView = 'code';
178 this.model.currentView = this.model.views.code; 178 this.model.currentView = this.model.views.code;
179 this.model.currentViewIdentifier = this.model.currentView.identifier;
179 } else { 180 } else {
180 //TODO: Identify default view (probably code) - Error handling 181 //TODO: Identify default view (probably code) - Error handling
181 } 182 }
@@ -200,10 +201,22 @@ exports.HtmlDocument = Montage.create(Component, {
200 if(typeof this.model.domContainer !== "undefined") { 201 if(typeof this.model.domContainer !== "undefined") {
201 this.model.domContainer = this.model.documentRoot; 202 this.model.domContainer = this.model.documentRoot;
202 } 203 }
204 this.model.currentViewIdentifier = this.model.currentView.identifier;
203 //Making callback after view is loaded 205 //Making callback after view is loaded
204 this.loaded.callback.call(this.loaded.context, this); 206 this.loaded.callback.call(this.loaded.context, this);
205 } 207 }
206 }, 208 },
209 handleReloadViewReady: {
210 value: function(mObjects) {
211 this.model.mObjects = mObjects;
212 // TODO: Find a better way to initialize this property
213 // Assign the domContainer to be the document root on open
214 if(typeof this.model.domContainer !== "undefined") {
215 this.model.domContainer = this.model.documentRoot;
216 }
217 this.model.currentViewIdentifier = this.model.currentView.identifier;
218 }
219 },
207 //////////////////////////////////////////////////////////////////// 220 ////////////////////////////////////////////////////////////////////
208 // 221 //
209 closeDocument: { 222 closeDocument: {