From 8cd6c76aabb4c75ab63f8d46b7e89bddbcbfe2a7 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 19 Apr 2012 10:38:43 -0700 Subject: - fixed the text cursor - code cleanup Signed-off-by: Ananya Sen --- js/controllers/code-editor-controller.js | 13 +++++++++++++ js/stage/stage-view.reel/stage-view.css | 2 +- js/stage/stage-view.reel/stage-view.js | 18 ++++++++---------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/js/controllers/code-editor-controller.js b/js/controllers/code-editor-controller.js index 2302730c..8757dceb 100644 --- a/js/controllers/code-editor-controller.js +++ b/js/controllers/code-editor-controller.js @@ -199,5 +199,18 @@ var CodeEditorController = exports.CodeEditorController = Montage.create(Compone value: function(){ this.application.ninja.documentController.activeDocument.editor.setOption("theme", this.editorTheme); } + }, + + applySettings:{ + value:function(){ + var codeLineElem = null, i=0; + //set theme + this.handleThemeSelection(); + //check autocomplete support + this.handleCodeCompletionSupport(this.application.ninja.documentController.activeDocument.editor.getOption("mode")); + //set zoom + codeLineElem = this.application.ninja.documentController.activeDocument.container.getElementsByClassName("CodeMirror-lines")[0]; + codeLineElem.style.fontSize = ""+this._editorFont+"px"; + } } }); \ No newline at end of file diff --git a/js/stage/stage-view.reel/stage-view.css b/js/stage/stage-view.reel/stage-view.css index a7e255ae..4cf5b2ab 100755 --- a/js/stage/stage-view.reel/stage-view.css +++ b/js/stage/stage-view.reel/stage-view.css @@ -14,7 +14,7 @@ width: 100%; height: 100%; overflow:auto; - /*display: none;*/ + cursor:text; } /* OLD CSS for reference diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js index bc8b469c..53eff90e 100755 --- a/js/stage/stage-view.reel/stage-view.js +++ b/js/stage/stage-view.reel/stage-view.js @@ -94,14 +94,13 @@ exports.StageView = Montage.create(Component, { doc.editor = this.application.ninja.codeEditorController.createEditor(doc, type); doc.editor.hline = doc.editor.setLineClass(0, "activeline"); - this.showCodeViewBar(true); - - this.application.ninja.codeEditorController.handleCodeCompletionSupport(type); - this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe this.application.ninja.documentController.activeDocument = doc; this.application.ninja.stage.hideCanvas(true); document.getElementById("iframeContainer").style.display="none";//hide the iframe when switching to code view + + this.showCodeViewBar(true); + this.application.ninja.codeEditorController.applySettings(); this.collapseAllPanels(); } }, @@ -117,11 +116,6 @@ exports.StageView = Montage.create(Component, { if(this.application.ninja.documentController.activeDocument.currentView === "design") { this.application.ninja.currentDocument = this.application.ninja.documentController.activeDocument; - - this.showCodeViewBar(false); - }else{ - this.showCodeViewBar(true); - this.application.ninja.codeEditorController.handleCodeCompletionSupport(this.application.ninja.documentController.activeDocument.editor.getOption("mode")); } this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe @@ -129,13 +123,17 @@ exports.StageView = Montage.create(Component, { //focus editor if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){ this.application.ninja.documentController.activeDocument.editor.focus(); - this.application.ninja.codeEditorController.handleThemeSelection(); + + this.showCodeViewBar(true); + this.application.ninja.codeEditorController.applySettings(); this.collapseAllPanels(); } if(this.application.ninja.documentController.activeDocument.currentView === "design") { this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe this.application.ninja.stage.stageDeps.reinitializeForSwitchDocument();//reinitialize draw-util, snapmanager and view-util + + this.showCodeViewBar(false); this.restoreAllPanels(); } -- cgit v1.2.3