diff options
Diffstat (limited to 'js')
-rwxr-xr-x | js/stage/stage-view.reel/stage-view.js | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js index 1f471431..917cbeb5 100755 --- a/js/stage/stage-view.reel/stage-view.js +++ b/js/stage/stage-view.reel/stage-view.js | |||
@@ -93,23 +93,47 @@ 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, null); | ||
111 | doc.editor.hline = doc.editor.setLineClass(doc.editor.getCursor().line, null, "activeline"); | ||
112 | }, | ||
113 | //extraKeys: {"Ctrl-Space": function(cm) {CodeMirror.simpleHint(cm, CodeMirror.javascriptHint);}} | ||
114 | onKeyEvent: function(cm, keyEvent) { | ||
115 | if((keyEvent.type === "keyup")//need seperate keycode set per mode | ||
116 | && ((keyEvent.keyCode > 47 && keyEvent.keyCode < 57)//numbers | ||
117 | || (keyEvent.keyCode > 64 && keyEvent.keyCode <91)//letters | ||
118 | || (keyEvent.keyCode === 190)//period | ||
119 | || (keyEvent.keyCode === 189)//underscore, dash | ||
120 | ) | ||
121 | && !( (keyEvent.keyCode === 219)//open bracket [ | ||
122 | || (keyEvent.keyCode === 221)//close bracket ] | ||
123 | || (keyEvent.shiftKey && keyEvent.keyCode === 219)//open bracket { | ||
124 | || (keyEvent.shiftKey && keyEvent.keyCode === 221)//close bracket } | ||
125 | || (keyEvent.shiftKey && keyEvent.keyCode === 57)//open bracket ( | ||
126 | || (keyEvent.shiftKey && keyEvent.keyCode === 48)//close bracket ) | ||
127 | ) | ||
128 | ){ | ||
129 | |||
130 | CodeMirror.simpleHint(cm, CodeMirror.javascriptHint); | ||
131 | } | ||
132 | } | ||
110 | }); | 133 | }); |
111 | 134 | ||
112 | //this.application.ninja.documentController._codeEditor.hline = this.application.ninja.documentController._codeEditor.editor.setLineClass(0, "activeline"); | 135 | doc.editor.hline = doc.editor.setLineClass(0, "activeline"); |
136 | |||
113 | this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe | 137 | this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe |
114 | this.application.ninja.documentController.activeDocument = doc; | 138 | this.application.ninja.documentController.activeDocument = doc; |
115 | this.application.ninja.stage.hideCanvas(true); | 139 | this.application.ninja.stage.hideCanvas(true); |