aboutsummaryrefslogtreecommitdiff
path: root/js/stage/stage-view.reel/stage-view.js
diff options
context:
space:
mode:
authorAnanya Sen2012-02-02 12:37:29 -0800
committerAnanya Sen2012-02-02 12:37:29 -0800
commit0e595c4e11ce9b44eff157de8616ed15fcd5d6fc (patch)
treeaba0df7f15b631345b9c44b6b50884d06b7a803a /js/stage/stage-view.reel/stage-view.js
parent87e247e74040b5e80ff40003d233d5317881102a (diff)
downloadninja-0e595c4e11ce9b44eff157de8616ed15fcd5d6fc.tar.gz
refactoring some file names and locations,
change made to maintain only one codemirror div. Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/stage/stage-view.reel/stage-view.js')
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js36
1 files changed, 33 insertions, 3 deletions
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js
index bb77b3de..d8e1e46b 100755
--- a/js/stage/stage-view.reel/stage-view.js
+++ b/js/stage/stage-view.reel/stage-view.js
@@ -121,21 +121,51 @@ exports.StageView = Montage.create(Component, {
121 } 121 }
122 }, 122 },
123 123
124
125
124 switchCodeView:{ 126 switchCodeView:{
125 value: function(doc){ 127 value: function(doc){
126 128
127 //if dirty SAVE codemirror into textarea 129 //if dirty SAVE codemirror into textarea
128 //doc.editor.save(); 130 //this.application.ninja.documentController.activeDocument.editor.save();
129 131
132 //remove the codemirror div
133 var codemirrorDiv = this.application.ninja.documentController.activeDocument.container.querySelector(".CodeMirror");
134 if(!!codemirrorDiv){
135 codemirrorDiv.parentNode.removeChild(codemirrorDiv);
136 this.application.ninja.documentController.activeDocument.editor = null;
137 }
130 138
131 var documentController = this.application.ninja.documentController;
132 this.application.ninja.documentController._hideCurrentDocument(); 139 this.application.ninja.documentController._hideCurrentDocument();
133 140
134 this.application.ninja.documentController.activeDocument = doc; 141 this.application.ninja.documentController.activeDocument = doc;
135 142
136 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe 143 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe
137
138 this.application.ninja.documentController._showCurrentDocument(); 144 this.application.ninja.documentController._showCurrentDocument();
145
146 var type;
147 switch(doc.documentType) {
148 case "css" :
149 type = "css";
150 break;
151 case "js" :
152 type = "javascript";
153 break;
154 }
155
156 //add the codemirror div again for editting
157 doc.editor = CodeMirror.fromTextArea(doc.textArea, {
158 lineNumbers: true,
159 mode: type,
160 onCursorActivity: function() {
161 //documentController._codeEditor.editor.setLineClass(documentController._codeEditor.hline, null);
162 //documentController._codeEditor.hline = documentController._codeEditor.editor.setLineClass(documentController._codeEditor.editor.getCursor().line, "activeline");
163 }
164 });
165
166 //this.application.ninja.documentController._codeEditor.hline = this.application.ninja.documentController._codeEditor.editor.setLineClass(0, "activeline");
167
168
139 } 169 }
140 }, 170 },
141 refreshCodeDocument:{ 171 refreshCodeDocument:{