diff options
author | Ananya Sen | 2012-03-27 17:19:18 -0700 |
---|---|---|
committer | Ananya Sen | 2012-03-27 17:19:18 -0700 |
commit | 0d83ad4dc08448e016c79ae739e84c3d71552b56 (patch) | |
tree | 85eac078fcbeab65430f2b92cc61ab9098f18dd4 | |
parent | 675fffb08f570783f055471501f94fc273de2b9e (diff) | |
download | ninja-0d83ad4dc08448e016c79ae739e84c3d71552b56.tar.gz |
- Highlight Matching bracket
- Highlight selection matched
-Highlight current line
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
-rwxr-xr-x | index.html | 12 | ||||
-rwxr-xr-x | js/stage/stage-view.reel/stage-view.js | 32 |
2 files changed, 30 insertions, 14 deletions
@@ -183,6 +183,8 @@ | |||
183 | <script type="text/javascript" src="imports/codemirror/mode/xml/xml.js"></script> | 183 | <script type="text/javascript" src="imports/codemirror/mode/xml/xml.js"></script> |
184 | <script type="text/javascript" src="imports/codemirror/mode/javascript/javascript.js"></script> | 184 | <script type="text/javascript" src="imports/codemirror/mode/javascript/javascript.js"></script> |
185 | <script type="text/javascript" src="imports/codemirror/mode/css/css.js"></script> | 185 | <script type="text/javascript" src="imports/codemirror/mode/css/css.js"></script> |
186 | <script type="text/javascript" src="imports/codemirror/lib/util/searchcursor.js"></script> | ||
187 | <script type="text/javascript" src="imports/codemirror/lib/util/match-highlighter.js"></script> | ||
186 | 188 | ||
187 | <script type="text/javascript" src="node_modules/montage/montage.js"></script> | 189 | <script type="text/javascript" src="node_modules/montage/montage.js"></script> |
188 | 190 | ||
@@ -199,6 +201,16 @@ | |||
199 | } | 201 | } |
200 | } | 202 | } |
201 | </script> | 203 | </script> |
204 | |||
205 | <style type="text/css"> | ||
206 | .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;} | ||
207 | span.CodeMirror-matchhighlight { background: #e9e9e9 } | ||
208 | .CodeMirror-focused span.CodeMirror-matchhighlight { background: #e7e4ff; !important } | ||
209 | .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;} | ||
210 | .activeline {background: #e8f2ff !important;} | ||
211 | div.CodeMirror span.CodeMirror-matchingbracket {color: #000;background-color: #ffd500;} | ||
212 | .CodeMirror-scroll {height: auto; overflow-y: hidden; overflow-x: auto; width: 100%;} | ||
213 | </style> | ||
202 | 214 | ||
203 | </head> | 215 | </head> |
204 | 216 | ||
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js index ad67cada..66a18964 100755 --- a/js/stage/stage-view.reel/stage-view.js +++ b/js/stage/stage-view.reel/stage-view.js | |||
@@ -93,23 +93,27 @@ exports.StageView = Montage.create(Component, { | |||
93 | 93 | ||
94 | var documentController = this.application.ninja.documentController; | 94 | var documentController = this.application.ninja.documentController; |
95 | doc.editor = CodeMirror.fromTextArea(doc.textArea, { | 95 | doc.editor = CodeMirror.fromTextArea(doc.textArea, { |
96 | lineNumbers: true, | 96 | lineNumbers: true, |
97 | mode: type, | 97 | lineWrapping: true, |
98 | onChange: function(){ | 98 | matchBrackets:true, |
99 | var historySize = doc.editor.historySize(); | 99 | mode: type, |
100 | if(historySize.undo>0){ | 100 | onChange: function(){ |
101 | doc.needsSave = true; | 101 | var historySize = doc.editor.historySize(); |
102 | }else if(historySize.undo===0 && historySize.redo>0){ | 102 | if(historySize.undo>0){ |
103 | doc.needsSave = false; | 103 | doc.needsSave = true; |
104 | } | 104 | }else if(historySize.undo===0 && historySize.redo>0){ |
105 | }, | 105 | doc.needsSave = false; |
106 | onCursorActivity: function() { | ||
107 | //documentController._codeEditor.editor.setLineClass(documentController._codeEditor.hline, null); | ||
108 | //documentController._codeEditor.hline = documentController._codeEditor.editor.setLineClass(documentController._codeEditor.editor.getCursor().line, "activeline"); | ||
109 | } | 106 | } |
107 | }, | ||
108 | onCursorActivity: function() { | ||
109 | doc.editor.matchHighlight("CodeMirror-matchhighlight"); | ||
110 | doc.editor.setLineClass(doc.editor.hline, null); | ||
111 | doc.editor.hline = doc.editor.setLineClass(doc.editor.getCursor().line, "activeline"); | ||
112 | } | ||
110 | }); | 113 | }); |
111 | 114 | ||
112 | //this.application.ninja.documentController._codeEditor.hline = this.application.ninja.documentController._codeEditor.editor.setLineClass(0, "activeline"); | 115 | doc.editor.hline = doc.editor.setLineClass(0, "activeline"); |
116 | |||
113 | this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe | 117 | this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe |
114 | this.application.ninja.documentController.activeDocument = doc; | 118 | this.application.ninja.documentController.activeDocument = doc; |
115 | this.application.ninja.stage.hideCanvas(true); | 119 | this.application.ninja.stage.hideCanvas(true); |