From 2f24dafec79583547fe663d5a387d8ef15aae3bf Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 21 Feb 2012 17:33:11 -0800 Subject: user document main reel listener moved to the html-document class. Signed-off-by: Valerio Virgillito --- js/controllers/selection-controller.js | 1 - js/document/html-document.js | 21 +++++++++++++++------ js/ninja.reel/ninja.js | 9 --------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index fed9affd..d69b53e0 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -33,7 +33,6 @@ exports.SelectionController = Montage.create(Component, { }, set: function(value) { if(this._selectionContainer && this._selectionContainer !== value) { - console.log("setting container in the selection tool"); this.executeSelectElement(); } diff --git a/js/document/html-document.js b/js/document/html-document.js index 01d042d6..9a7755e6 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -392,9 +392,10 @@ exports.HTMLDocument = Montage.create(TextDocument, { // this._templateDocument.head.innerHTML = this._userDocument.content.head; this._templateDocument.body.innerHTML = this._userDocument.content.body; - - - + + // Adding a handler for the main user document reel to finish loading. + this._document.body.addEventListener("userTemplateDidLoad", this.userTemplateDidLoad.bind(this), false); + /* this.iframe.contentWindow.document.addEventListener('DOMSubtreeModified', function (e) { */ //TODO: Remove events upon loading once @@ -472,12 +473,20 @@ exports.HTMLDocument = Montage.create(TextDocument, { } }, + //////////////////////////////////////////////////////////////////// + + // Handler for user content main reel. Gets called once the main reel of the template + // gets deserialized. + // Setting up the currentSelectedContainer to the document body. + userTemplateDidLoad: { + value: function(){ + this.application.ninja.currentSelectedContainer = this.documentRoot; + } + }, - - - + //////////////////////////////////////////////////////////////////// _setSWFObjectScript: { value: function() { if(!this._swfObject) { diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 399d7b4d..6efeef8a 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -168,19 +168,10 @@ exports.Ninja = Montage.create(Component, { this.appModel.show3dGrid = this.currentDocument.draw3DGrid; - this.currentDocument._document.body.addEventListener("userTemplateDidLoad", this.userTemplateDidLoad.bind(this), false); - - NJevent("openDocument"); } }, - userTemplateDidLoad: { - value: function(){ - this.currentSelectedContainer = this.currentDocument.documentRoot; - } - }, - executeLivePreview: { value: function() { var background, overflow, transitionStopRule; -- cgit v1.2.3