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/document/html-document.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'js/document/html-document.js') 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) { -- cgit v1.2.3