aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-21 17:33:11 -0800
committerValerio Virgillito2012-02-21 17:33:11 -0800
commit2f24dafec79583547fe663d5a387d8ef15aae3bf (patch)
treebd060f29cfc38c3d9707bdbc2033e9bd988a8875
parent1d2c928c35ccc7cd875a329b2e235f34eb4f0c0d (diff)
downloadninja-2f24dafec79583547fe663d5a387d8ef15aae3bf.tar.gz
user document main reel listener moved to the html-document class.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
-rwxr-xr-xjs/controllers/selection-controller.js1
-rwxr-xr-xjs/document/html-document.js21
-rwxr-xr-xjs/ninja.reel/ninja.js9
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, {
33 }, 33 },
34 set: function(value) { 34 set: function(value) {
35 if(this._selectionContainer && this._selectionContainer !== value) { 35 if(this._selectionContainer && this._selectionContainer !== value) {
36 console.log("setting container in the selection tool");
37 this.executeSelectElement(); 36 this.executeSelectElement();
38 } 37 }
39 38
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, {
392 // 392 //
393 this._templateDocument.head.innerHTML = this._userDocument.content.head; 393 this._templateDocument.head.innerHTML = this._userDocument.content.head;
394 this._templateDocument.body.innerHTML = this._userDocument.content.body; 394 this._templateDocument.body.innerHTML = this._userDocument.content.body;
395 395
396 396 // Adding a handler for the main user document reel to finish loading.
397 397 this._document.body.addEventListener("userTemplateDidLoad", this.userTemplateDidLoad.bind(this), false);
398
398 399
399 /* this.iframe.contentWindow.document.addEventListener('DOMSubtreeModified', function (e) { */ //TODO: Remove events upon loading once 400 /* this.iframe.contentWindow.document.addEventListener('DOMSubtreeModified', function (e) { */ //TODO: Remove events upon loading once
400 401
@@ -472,12 +473,20 @@ exports.HTMLDocument = Montage.create(TextDocument, {
472 473
473 } 474 }
474 }, 475 },
476
475 //////////////////////////////////////////////////////////////////// 477 ////////////////////////////////////////////////////////////////////
478
479 // Handler for user content main reel. Gets called once the main reel of the template
480 // gets deserialized.
481 // Setting up the currentSelectedContainer to the document body.
482 userTemplateDidLoad: {
483 value: function(){
484 this.application.ninja.currentSelectedContainer = this.documentRoot;
485 }
486 },
476 487
477 488
478 489 ////////////////////////////////////////////////////////////////////
479
480
481 _setSWFObjectScript: { 490 _setSWFObjectScript: {
482 value: function() { 491 value: function() {
483 if(!this._swfObject) { 492 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, {
168 168
169 this.appModel.show3dGrid = this.currentDocument.draw3DGrid; 169 this.appModel.show3dGrid = this.currentDocument.draw3DGrid;
170 170
171 this.currentDocument._document.body.addEventListener("userTemplateDidLoad", this.userTemplateDidLoad.bind(this), false);
172
173
174 NJevent("openDocument"); 171 NJevent("openDocument");
175 } 172 }
176 }, 173 },
177 174
178 userTemplateDidLoad: {
179 value: function(){
180 this.currentSelectedContainer = this.currentDocument.documentRoot;
181 }
182 },
183
184 executeLivePreview: { 175 executeLivePreview: {
185 value: function() { 176 value: function() {
186 var background, overflow, transitionStopRule; 177 var background, overflow, transitionStopRule;