From c87e538fdc337639bc4d54bb087dbf2b4f20297f Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Fri, 11 May 2012 14:41:20 -0700 Subject: Adding support for new templates This is supported for NEW and OPEN, SAVE is not supported yet by I/O. Saving works, but it will not be a banner template. --- js/document/document-html.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'js/document/document-html.js') diff --git a/js/document/document-html.js b/js/document/document-html.js index e00333f0..7e1f1806 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js @@ -63,13 +63,14 @@ exports.HtmlDocument = Montage.create(Component, { //////////////////////////////////////////////////////////////////// // init: { - value:function(file, context, callback, view, template) { //TODO: Add template support logic + value:function(file, context, callback, view, template) { //Storing callback data for loaded dispatch this.loaded.callback = callback; this.loaded.context = context; //Creating instance of HTML Document Model this.model = Montage.create(HtmlDocumentModel,{ file: {value: file}, + fileTemplate: {value: template}, parentContainer: {value: document.getElementById("iframeContainer")}, //Saving reference to parent container of all views (should be changed to buckets approach views: {value: {'design': DesignDocumentView.create(), 'code': null}} //TODO: Add code view logic }); @@ -97,8 +98,13 @@ exports.HtmlDocument = Montage.create(Component, { this.model.views.design.render(function () { //TODO: Identify and remove usage of '_document' this._document = this.model.views.design.document; - //TODO: Remove usage, seems as not needed - this.documentRoot = this.model.views.design.document.body; + //TODO: Remove usage, seems as not needed + if (template && template.type === 'banner') { + //this.documentRoot = this.model.views.design.document.body; + this.documentRoot = this.model.views.design.document.body.getElementsByTagName('ninja-banner')[0]; + } else { + this.documentRoot = this.model.views.design.document.body; + } //TODO: Why is this needed? this._liveNodeList = this.model.views.design.document.body.getElementsByTagName('*'); //Initiliazing document model @@ -106,7 +112,7 @@ exports.HtmlDocument = Montage.create(Component, { //Adding observer to know when template is ready this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this)); this._observer.observe(this.model.views.design.document.head, {childList: true}); - }.bind(this)); + }.bind(this), template); } else { //TODO: Identify default view (probably code) } -- cgit v1.2.3