diff options
Diffstat (limited to 'js/stage')
-rwxr-xr-x | js/stage/stage-view.reel/stage-view.js | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js index 727c16eb..c0b0b83e 100755 --- a/js/stage/stage-view.reel/stage-view.js +++ b/js/stage/stage-view.reel/stage-view.js | |||
@@ -49,6 +49,8 @@ exports.StageView = Montage.create(Component, { | |||
49 | // Temporary function to create a Codemirror text view | 49 | // Temporary function to create a Codemirror text view |
50 | createTextView: { | 50 | createTextView: { |
51 | value: function(doc) { | 51 | value: function(doc) { |
52 | var documentController = this.application.ninja.documentController; | ||
53 | |||
52 | this.application.ninja.documentController._hideCurrentDocument(); | 54 | this.application.ninja.documentController._hideCurrentDocument(); |
53 | 55 | ||
54 | this.application.ninja.currentDocument.container.parentNode.style["display"] = "none"; | 56 | this.application.ninja.currentDocument.container.parentNode.style["display"] = "none"; |
@@ -79,8 +81,8 @@ exports.StageView = Montage.create(Component, { | |||
79 | lineNumbers: true, | 81 | lineNumbers: true, |
80 | mode: type, | 82 | mode: type, |
81 | onCursorActivity: function() { | 83 | onCursorActivity: function() { |
82 | this.application.ninja.documentController._codeEditor.editor.setLineClass(this.application.ninja.documentController._codeEditor.hline, null); | 84 | //documentController._codeEditor.editor.setLineClass(documentController._codeEditor.hline, null); |
83 | this.application.ninja.documentController._codeEditor.hline = this.application.ninja.documentController._codeEditor.editor.setLineClass(this.application.ninja.documentController._codeEditor.editor.getCursor().line, "activeline"); | 85 | //documentController._codeEditor.hline = documentController._codeEditor.editor.setLineClass(documentController._codeEditor.editor.getCursor().line, "activeline"); |
84 | } | 86 | } |
85 | }); | 87 | }); |
86 | 88 | ||
@@ -93,9 +95,15 @@ exports.StageView = Montage.create(Component, { | |||
93 | 95 | ||
94 | switchCodeView:{ | 96 | switchCodeView:{ |
95 | value: function(doc){ | 97 | value: function(doc){ |
96 | 98 | var documentController = this.application.ninja.documentController; | |
97 | this.application.ninja.documentController._hideCurrentDocument(); | 99 | this.application.ninja.documentController._hideCurrentDocument(); |
98 | 100 | ||
101 | this.application.ninja.documentController.activeDocument = doc; | ||
102 | |||
103 | this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe | ||
104 | |||
105 | |||
106 | |||
99 | //remove any previous Codemirror div | 107 | //remove any previous Codemirror div |
100 | var codemirrorDiv = this.element.querySelector(".CodeMirror"); | 108 | var codemirrorDiv = this.element.querySelector(".CodeMirror"); |
101 | if(!!codemirrorDiv){ | 109 | if(!!codemirrorDiv){ |
@@ -117,13 +125,49 @@ exports.StageView = Montage.create(Component, { | |||
117 | lineNumbers: true, | 125 | lineNumbers: true, |
118 | mode: type, | 126 | mode: type, |
119 | onCursorActivity: function() { | 127 | onCursorActivity: function() { |
120 | this.application.ninja.documentController._codeEditor.editor.setLineClass(this.application.ninja.documentController._codeEditor.hline, null); | 128 | //documentController._codeEditor.editor.setLineClass(documentController._codeEditor.hline, null); |
121 | this.application.ninja.documentController._codeEditor.hline = this.application.ninja.documentController._codeEditor.editor.setLineClass(this.application.ninja.documentController._codeEditor.editor.getCursor().line, "activeline"); | 129 | //documentController._codeEditor.hline = documentController._codeEditor.editor.setLineClass(documentController._codeEditor.editor.getCursor().line, "activeline"); |
122 | } | 130 | } |
123 | }); | 131 | }); |
124 | 132 | ||
125 | //this.application.ninja.documentController._codeEditor.hline = this.application.ninja.documentController._codeEditor.editor.setLineClass(0, "activeline"); | 133 | //this.application.ninja.documentController._codeEditor.hline = this.application.ninja.documentController._codeEditor.editor.setLineClass(0, "activeline"); |
126 | 134 | ||
127 | } | 135 | } |
136 | }, | ||
137 | refreshCodeDocument:{ | ||
138 | value:function(doc){ | ||
139 | |||
140 | } | ||
141 | }, | ||
142 | addCodeDocument:{ | ||
143 | value:function(doc){ | ||
144 | var type; | ||
145 | switch(doc.documentType) { | ||
146 | case "css" : | ||
147 | type = "css"; | ||
148 | break; | ||
149 | case "js" : | ||
150 | type = "javascript"; | ||
151 | break; | ||
152 | } | ||
153 | |||
154 | var codeM = CodeMirror.fromTextArea(doc.textArea, { | ||
155 | lineNumbers: true, | ||
156 | mode: type, | ||
157 | onCursorActivity: function() { | ||
158 | //documentController._codeEditor.editor.setLineClass(documentController._codeEditor.hline, null); | ||
159 | //documentController._codeEditor.hline = documentController._codeEditor.editor.setLineClass(documentController._codeEditor.editor.getCursor().line, "activeline"); | ||
160 | } | ||
161 | }); | ||
162 | } | ||
163 | }, | ||
164 | removeCodeDocument:{ | ||
165 | value:function(){ | ||
166 | //remove any previous Codemirror div | ||
167 | var codemirrorDiv = this.element.querySelector(".CodeMirror"); | ||
168 | if(!!codemirrorDiv){ | ||
169 | codemirrorDiv.parentNode.removeChild(codemirrorDiv); | ||
170 | } | ||
171 | } | ||
128 | } | 172 | } |
129 | }); \ No newline at end of file | 173 | }); \ No newline at end of file |