diff options
author | Ananya Sen | 2012-04-26 12:26:31 -0700 |
---|---|---|
committer | Ananya Sen | 2012-04-26 12:26:31 -0700 |
commit | b680af490b9736d16ed491c999af3f06d78a7d18 (patch) | |
tree | 0f2cca5618e9cfd58fbd250ef842996e79c5fd6d | |
parent | 45bddda788afc27094b781d0823f821a421e0934 (diff) | |
download | ninja-b680af490b9736d16ed491c999af3f06d78a7d18.tar.gz |
IKNINJA-1551 - added editor support for other file types
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
-rwxr-xr-x | index.html | 8 | ||||
-rw-r--r-- | js/controllers/code-editor-controller.js | 20 | ||||
-rw-r--r-- | js/io/templates/descriptor.json | 9 | ||||
-rw-r--r-- | js/io/templates/files/xml.txt | 1 | ||||
-rwxr-xr-x | js/stage/stage-view.reel/stage-view.js | 21 |
5 files changed, 52 insertions, 7 deletions
@@ -225,15 +225,23 @@ | |||
225 | <!-- End Ridge Uncompiled --> | 225 | <!-- End Ridge Uncompiled --> |
226 | 226 | ||
227 | <script type="text/javascript" src="imports/codemirror/lib/codemirror.js"></script> | 227 | <script type="text/javascript" src="imports/codemirror/lib/codemirror.js"></script> |
228 | <!-- // modes // --> | ||
228 | <script type="text/javascript" src="imports/codemirror/mode/htmlmixed/htmlmixed.js"></script> | 229 | <script type="text/javascript" src="imports/codemirror/mode/htmlmixed/htmlmixed.js"></script> |
229 | <script type="text/javascript" src="imports/codemirror/mode/xml/xml.js"></script> | 230 | <script type="text/javascript" src="imports/codemirror/mode/xml/xml.js"></script> |
230 | <script type="text/javascript" src="imports/codemirror/mode/javascript/javascript.js"></script> | 231 | <script type="text/javascript" src="imports/codemirror/mode/javascript/javascript.js"></script> |
231 | <script type="text/javascript" src="imports/codemirror/mode/css/css.js"></script> | 232 | <script type="text/javascript" src="imports/codemirror/mode/css/css.js"></script> |
233 | <script type="text/javascript" src="imports/codemirror/mode/php/php.js"></script> | ||
234 | <script type="text/javascript" src="imports/codemirror/mode/clike/clike.js"></script> | ||
235 | <script type="text/javascript" src="imports/codemirror/mode/perl/perl.js"></script> | ||
236 | <script type="text/javascript" src="imports/codemirror/mode/python/python.js"></script> | ||
237 | <script type="text/javascript" src="imports/codemirror/mode/ruby/ruby.js"></script> | ||
238 | <!-- functionality libraries --> | ||
232 | <script type="text/javascript" src="imports/codemirror/lib/util/searchcursor.js"></script> | 239 | <script type="text/javascript" src="imports/codemirror/lib/util/searchcursor.js"></script> |
233 | <script type="text/javascript" src="imports/codemirror/lib/util/match-highlighter.js"></script> | 240 | <script type="text/javascript" src="imports/codemirror/lib/util/match-highlighter.js"></script> |
234 | <script type="text/javascript" src="js/code-editor/codemirror-ninja-lib/ninja-simple-hint.js"></script> | 241 | <script type="text/javascript" src="js/code-editor/codemirror-ninja-lib/ninja-simple-hint.js"></script> |
235 | <script type="text/javascript" src="imports/codemirror/lib/util/javascript-hint.js"></script> | 242 | <script type="text/javascript" src="imports/codemirror/lib/util/javascript-hint.js"></script> |
236 | <script type="text/javascript" src="imports/codemirror/lib/util/formatting.js"></script> | 243 | <script type="text/javascript" src="imports/codemirror/lib/util/formatting.js"></script> |
244 | <!-- --> | ||
237 | 245 | ||
238 | <script type="text/javascript" src="node_modules/montage/montage.js"></script> | 246 | <script type="text/javascript" src="node_modules/montage/montage.js"></script> |
239 | 247 | ||
diff --git a/js/controllers/code-editor-controller.js b/js/controllers/code-editor-controller.js index ab0521eb..d560e721 100644 --- a/js/controllers/code-editor-controller.js +++ b/js/controllers/code-editor-controller.js | |||
@@ -130,6 +130,10 @@ var CodeEditorController = exports.CodeEditorController = Montage.create(Compone | |||
130 | _showAutoComplete : { | 130 | _showAutoComplete : { |
131 | enumerable:false, | 131 | enumerable:false, |
132 | value:function(type, keyEvent){ | 132 | value:function(type, keyEvent){ |
133 | var status=false; | ||
134 | if(((keyEvent.keyCode === 83) && (keyEvent.ctrlKey || keyEvent.metaKey))){ | ||
135 | debugger; | ||
136 | } | ||
133 | switch(type){ | 137 | switch(type){ |
134 | case "javascript": | 138 | case "javascript": |
135 | if((keyEvent.type === "keyup")//need seperate keycode set per mode | 139 | if((keyEvent.type === "keyup")//need seperate keycode set per mode |
@@ -145,15 +149,19 @@ var CodeEditorController = exports.CodeEditorController = Montage.create(Compone | |||
145 | || (keyEvent.shiftKey && keyEvent.keyCode === 221)//close bracket } | 149 | || (keyEvent.shiftKey && keyEvent.keyCode === 221)//close bracket } |
146 | || (keyEvent.shiftKey && keyEvent.keyCode === 57)//open bracket ( | 150 | || (keyEvent.shiftKey && keyEvent.keyCode === 57)//open bracket ( |
147 | || (keyEvent.shiftKey && keyEvent.keyCode === 48)//close bracket ) | 151 | || (keyEvent.shiftKey && keyEvent.keyCode === 48)//close bracket ) |
148 | || ((keyEvent.ctrlKey || keyEvent.metaKey) && keyEvent.keyCode === 83)//ctrl+S | 152 | || ((keyEvent.keyCode === 83) && (keyEvent.ctrlKey || keyEvent.metaKey))//ctrl+S |
149 | || ((keyEvent.ctrlKey || keyEvent.metaKey) && keyEvent.keyCode === 90)//ctrl+z | 153 | || ((keyEvent.keyCode === 90) && (keyEvent.ctrlKey || keyEvent.metaKey))//ctrl+z |
150 | || ((keyEvent.ctrlKey || keyEvent.metaKey) && keyEvent.shiftKey && keyEvent.keyCode === 90)//ctrl+shift+z | 154 | || ((keyEvent.keyCode === 89) && (keyEvent.ctrlKey || keyEvent.metaKey))//ctrl+y |
151 | || ((keyEvent.ctrlKey || keyEvent.metaKey) && keyEvent.keyCode === 89)//ctrl+y | ||
152 | ) | 155 | ) |
153 | ){return true;} | 156 | ){ |
157 | status = true; | ||
158 | break; | ||
159 | } | ||
154 | default : | 160 | default : |
155 | return false; | 161 | status = false; |
156 | } | 162 | } |
163 | |||
164 | return status; | ||
157 | } | 165 | } |
158 | }, | 166 | }, |
159 | 167 | ||
diff --git a/js/io/templates/descriptor.json b/js/io/templates/descriptor.json index acc03979..21c4b58c 100644 --- a/js/io/templates/descriptor.json +++ b/js/io/templates/descriptor.json | |||
@@ -6,7 +6,7 @@ | |||
6 | "name":"Blank File", | 6 | "name":"Blank File", |
7 | "uri":"/", | 7 | "uri":"/", |
8 | "type":"directory", | 8 | "type":"directory", |
9 | "children":["js/io/templates/files/html.txt", "js/io/templates/files/js.txt", "js/io/templates/files/css.txt", "js/io/templates/files/json.txt", "js/io/templates/files/php.txt", "js/io/templates/files/pl.txt", "js/io/templates/files/py.txt", "js/io/templates/files/rb.txt"] | 9 | "children":["js/io/templates/files/html.txt", "js/io/templates/files/js.txt", "js/io/templates/files/css.txt", "js/io/templates/files/json.txt", "js/io/templates/files/php.txt", "js/io/templates/files/pl.txt", "js/io/templates/files/py.txt", "js/io/templates/files/rb.txt", "js/io/templates/files/xml.txt"] |
10 | }, | 10 | }, |
11 | "js/io/templates/files/html.txt":{ | 11 | "js/io/templates/files/html.txt":{ |
12 | "name":"HTML", | 12 | "name":"HTML", |
@@ -64,6 +64,13 @@ | |||
64 | "fileExtension":".rb", | 64 | "fileExtension":".rb", |
65 | "children":["defaultTemplate"] | 65 | "children":["defaultTemplate"] |
66 | }, | 66 | }, |
67 | "js/io/templates/files/xml.txt":{ | ||
68 | "name":"XML", | ||
69 | "uri":"js/io/templates/files/xml.txt", | ||
70 | "type":"file", | ||
71 | "fileExtension":".xml", | ||
72 | "children":["defaultTemplate"] | ||
73 | }, | ||
67 | "defaultTemplate":{ | 74 | "defaultTemplate":{ |
68 | "name": "Basic", | 75 | "name": "Basic", |
69 | "uri": "defaultTemplate", | 76 | "uri": "defaultTemplate", |
diff --git a/js/io/templates/files/xml.txt b/js/io/templates/files/xml.txt new file mode 100644 index 00000000..8906a78b --- /dev/null +++ b/js/io/templates/files/xml.txt | |||
@@ -0,0 +1 @@ | |||
<!-- Created with Motorola Mobility Ninja --> \ No newline at end of file | |||
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js index 53c6125b..dcc84a35 100755 --- a/js/stage/stage-view.reel/stage-view.js +++ b/js/stage/stage-view.reel/stage-view.js | |||
@@ -88,6 +88,27 @@ exports.StageView = Montage.create(Component, { | |||
88 | case "js" : | 88 | case "js" : |
89 | type = "javascript"; | 89 | type = "javascript"; |
90 | break; | 90 | break; |
91 | case "html" : | ||
92 | type = "htmlmixed"; | ||
93 | break; | ||
94 | case "json" : | ||
95 | type = "javascript"; | ||
96 | break; | ||
97 | case "php" : | ||
98 | type = "php"; | ||
99 | break; | ||
100 | case "pl" : | ||
101 | type = "perl"; | ||
102 | break; | ||
103 | case "py" : | ||
104 | type = "python"; | ||
105 | break; | ||
106 | case "rb" : | ||
107 | type = "ruby"; | ||
108 | break; | ||
109 | case "xml" : | ||
110 | type = "xml"; | ||
111 | break; | ||
91 | } | 112 | } |
92 | document.getElementById("codeMirror_"+doc.uuid).style.display="block"; | 113 | document.getElementById("codeMirror_"+doc.uuid).style.display="block"; |
93 | 114 | ||