From f97590388467b5a3316f6f155162fc293915fddc Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 23 May 2012 16:09:22 -0700 Subject: Fixed scrolling and centering stage code. Also, moved liveNodeList into the design view and added an option to exclude styles and text nodes when retrieving the live nodes. Signed-off-by: Nivesh Rajbhandari --- js/document/document-html.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/document/document-html.js') diff --git a/js/document/document-html.js b/js/document/document-html.js index f92a425c..2fc32791 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js @@ -98,7 +98,7 @@ exports.HtmlDocument = Montage.create(Component, { this.documentRoot = this.model.views.design.document.body; } //TODO: Why is this needed? - this._liveNodeList = this.documentRoot.getElementsByTagName('*'); + this.model.views.design._liveNodeList = this.documentRoot.getElementsByTagName('*'); //Initiliazing document model document.application.njUtils.makeElementModel(this.documentRoot, "Body", "body"); //Adding observer to know when template is ready -- cgit v1.2.3 From 5914c5b2209c4b8daac4249bb76cda5c9314c4e6 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 24 May 2012 00:07:23 -0700 Subject: Cleaning up referencing to 'documentRoot' and '_document' Moved to reference new model in DOM architecture rework. This should not affect anything, just moving the references, and also the setting to the render methods in the design view. --- js/document/document-html.js | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) (limited to 'js/document/document-html.js') diff --git a/js/document/document-html.js b/js/document/document-html.js index f92a425c..2375632c 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js @@ -6,10 +6,10 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot //////////////////////////////////////////////////////////////////////// // -var Montage = require("montage/core/core").Montage, - Component = require("montage/ui/component").Component, - HtmlDocumentModel = require("js/document/models/html").HtmlDocumentModel, - DesignDocumentView = require("js/document/views/design").DesignDocumentView; +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component, + HtmlDocumentModel = require("js/document/models/html").HtmlDocumentModel, + DesignDocumentView = require("js/document/views/design").DesignDocumentView; //////////////////////////////////////////////////////////////////////// // exports.HtmlDocument = Montage.create(Component, { @@ -32,16 +32,11 @@ exports.HtmlDocument = Montage.create(Component, { // _observer: { value: null - }, - //////////////////////////////////////////////////////////////////// - // - _document: { - value: null //TODO: Figure out if this will be needed, probably not }, //////////////////////////////////////////////////////////////////// // exclusionList: { - value: ["HTML", "BODY", "NINJA-CONTENT"] //TODO: Update to correct list + value: ["HTML", "BODY", "NINJA-CONTENT"] }, //////////////////////////////////////////////////////////////////// // @@ -72,7 +67,7 @@ exports.HtmlDocument = Montage.create(Component, { //Hiding iFrame, just initiliazing this.model.views.design.hide(); } else { - //ERROR: Design View not initilized + //ERROR: Design View not initialized } // if (view === 'design') { @@ -84,23 +79,12 @@ exports.HtmlDocument = Montage.create(Component, { this.model.views.design.show(); this.model.views.design.iframe.style.opacity = 0; this.model.views.design.content = this.model.file.content; - //TODO: Improve reference + //TODO: Improve reference (probably through binding values) this.model.views.design.model = this.model; - // - //TODO: Clean up + //Rendering design view, using observers to know when template is ready 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 - if (template && template.type === 'banner') { - this.documentRoot = this.model.views.design.document.body.getElementsByTagName('ninja-content')[0]; - } else { - this.documentRoot = this.model.views.design.document.body; - } //TODO: Why is this needed? - this._liveNodeList = this.documentRoot.getElementsByTagName('*'); - //Initiliazing document model - document.application.njUtils.makeElementModel(this.documentRoot, "Body", "body"); + this._liveNodeList = this.model.documentRoot.getElementsByTagName('*'); //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}); -- cgit v1.2.3 From a6db492176a85546047dae6d5ecb9cfc4325e043 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 24 May 2012 11:44:35 -0700 Subject: Final clean up of render callback for design view --- js/document/document-html.js | 2 -- 1 file changed, 2 deletions(-) (limited to 'js/document/document-html.js') diff --git a/js/document/document-html.js b/js/document/document-html.js index 157d7a0e..c60a12a2 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js @@ -83,8 +83,6 @@ exports.HtmlDocument = Montage.create(Component, { this.model.views.design.model = this.model; //Rendering design view, using observers to know when template is ready this.model.views.design.render(function () { - //TODO: Why is this needed? - this.model.views.design._liveNodeList = this.documentRoot.getElementsByTagName('*'); //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}); -- cgit v1.2.3