From c26de5fa7b909a53b103b72027b5cbe7c3e1c49f Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 16 May 2012 22:48:39 -0700 Subject: code cleanup and refactoring of the document controller and stage view Signed-off-by: Valerio Virgillito --- js/stage/stage-view.reel/stage-view.js | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) (limited to 'js/stage/stage-view.reel') diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js index 518c3bdd..7680103d 100755 --- a/js/stage/stage-view.reel/stage-view.js +++ b/js/stage/stage-view.reel/stage-view.js @@ -25,32 +25,12 @@ exports.StageView = Montage.create(Component, { } }, - templateDidLoad: { - value: function() { - this.eventManager.addEventListener("appLoaded", this, false); - } - }, - didDraw:{ value: function() { if(!this.application.ninja.documentController._textHolder) this.application.ninja.documentController._textHolder = this.element; } }, - handleAppLoaded: { - value: function() { - - // Don't bind for now - /* - Object.defineBinding(this, "docs", { - boundObject: this.application.ninja.documentController, - boundObjectPropertyPath: "_documents" - }); - */ - - } - }, - /** * Public method * Creates a textarea element which will contain the content of the opened text document. @@ -172,17 +152,6 @@ exports.StageView = Montage.create(Component, { } }, - hideOtherDocuments:{ - value:function(docUuid){ - this.application.ninja.documentController._documents.forEach(function(aDoc){ - if(aDoc.currentView === "design"){ - aDoc.container.parentNode.style["display"] = "none"; - }else if((aDoc.currentView === "code") && (aDoc.uuid !== docUuid)){ - aDoc.container.style["display"] = "none"; - } - }, this); - } - }, showRulers:{ value:function(){ this.application.ninja.rulerTop.style.display = "block"; @@ -200,7 +169,7 @@ exports.StageView = Montage.create(Component, { if(isCodeView === true) { this.application.ninja.editorViewOptions.element.style.display = "block"; this.application.ninja.documentBar.element.style.display = "none"; - }else{ + } else { this.application.ninja.documentBar.element.style.display = "block"; this.application.ninja.editorViewOptions.element.style.display = "none"; } -- cgit v1.2.3 From 402a369c7bf164c3c6686be3a33f5e36f25e4130 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 16 May 2012 23:19:32 -0700 Subject: document controller and stage view code cleanup Signed-off-by: Valerio Virgillito --- js/stage/stage-view.reel/stage-view.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'js/stage/stage-view.reel') diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js index 7680103d..ba94fadf 100755 --- a/js/stage/stage-view.reel/stage-view.js +++ b/js/stage/stage-view.reel/stage-view.js @@ -120,7 +120,22 @@ exports.StageView = Montage.create(Component, { } this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe - this.application.ninja.documentController._showCurrentDocument(); + + +// this.application.ninja.documentController._showCurrentDocument(); + // Inline function below + if(this.activeDocument) { + this.activeDocument.container.style["display"] = "block"; + if(this.activeDocument.currentView === "design"){ + this.activeDocument.container.parentNode.style["display"] = "block"; + this.activeDocument.restoreAppState(); + } else { + //hide the iframe when switching to code view + document.getElementById("iframeContainer").style.display = "none"; + } + } + + //focus editor if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){ this.application.ninja.documentController.activeDocument.editor.focus(); -- cgit v1.2.3