diff options
Diffstat (limited to 'js/controllers')
-rw-r--r-- | js/controllers/code-editor-controller.js | 45 | ||||
-rwxr-xr-x | js/controllers/document-controller.js | 1 |
2 files changed, 40 insertions, 6 deletions
diff --git a/js/controllers/code-editor-controller.js b/js/controllers/code-editor-controller.js index 0c13958c..534d4645 100644 --- a/js/controllers/code-editor-controller.js +++ b/js/controllers/code-editor-controller.js | |||
@@ -23,17 +23,37 @@ var CodeEditorController = exports.CodeEditorController = Montage.create(Compone | |||
23 | set: function(value){this._codeEditor = value;} | 23 | set: function(value){this._codeEditor = value;} |
24 | }, | 24 | }, |
25 | 25 | ||
26 | codeCompletionSupport : {"javascript": true}, | 26 | codeCompletionSupport : { |
27 | value: {"javascript": true} | ||
28 | }, | ||
27 | 29 | ||
28 | _automaticCodeComplete: { | 30 | _automaticCodeComplete: { |
29 | value:true | 31 | value:true |
30 | }, | 32 | }, |
31 | 33 | ||
32 | automaticCodeComplete:{ | 34 | automaticCodeComplete:{ |
33 | get: function(){return this._automaticCodeComplete;}, | 35 | get: function(){return this._automaticCodeComplete;}, |
34 | set: function(value){this._automaticCodeComplete = value;} | 36 | set: function(value){ |
35 | }, | 37 | //console.log("$$$ automaticCodeComplete setter : "+value); |
38 | this._automaticCodeComplete = value;} | ||
39 | }, | ||
40 | |||
41 | originalEditorFont:{ | ||
42 | value:"13"//px | ||
43 | }, | ||
36 | 44 | ||
45 | _editorFont:{ | ||
46 | value:null | ||
47 | }, | ||
48 | |||
49 | editorFont:{ | ||
50 | get: function(){return this._editorFont;}, | ||
51 | set: function(value){//gets a zoom % | ||
52 | this._editorFont = (value/100) * CodeEditorController.originalEditorFont; | ||
53 | //set the font size | ||
54 | document.getElementsByClassName("codeViewContainer")[0].style.fontSize = ""+this._editorFont+"px"; | ||
55 | } | ||
56 | }, | ||
37 | 57 | ||
38 | deserializedFromTemplate: { | 58 | deserializedFromTemplate: { |
39 | value: function() { | 59 | value: function() { |
@@ -70,11 +90,14 @@ var CodeEditorController = exports.CodeEditorController = Montage.create(Compone | |||
70 | }; | 90 | }; |
71 | 91 | ||
72 | //configure auto code completion if it is supported for that document type | 92 | //configure auto code completion if it is supported for that document type |
73 | if(true){ | 93 | if(this.codeCompletionSupport[type] === true){ |
74 | editorOptions.onKeyEvent = function(cm, keyEvent){self._codeCompletionKeyEventHandler.call(self, cm, keyEvent, type)}; | 94 | editorOptions.onKeyEvent = function(cm, keyEvent){self._codeCompletionKeyEventHandler.call(self, cm, keyEvent, type)}; |
75 | } | 95 | } |
76 | 96 | ||
77 | var editor = self.codeEditor.fromTextArea(doc.textArea, editorOptions); | 97 | var editor = self.codeEditor.fromTextArea(doc.textArea, editorOptions); |
98 | |||
99 | //editor.setOption("theme", "night"); | ||
100 | |||
78 | return editor; | 101 | return editor; |
79 | } | 102 | } |
80 | }, | 103 | }, |
@@ -128,6 +151,16 @@ var CodeEditorController = exports.CodeEditorController = Montage.create(Compone | |||
128 | return false; | 151 | return false; |
129 | } | 152 | } |
130 | } | 153 | } |
131 | } | 154 | }, |
132 | 155 | ||
156 | handleCodeCompletionSupport:{ | ||
157 | value:function(fileType){ | ||
158 | var autoCodeCompleteElem = document.getElementsByClassName("autoCodeComplete")[0]; | ||
159 | if(autoCodeCompleteElem && (this.codeCompletionSupport[fileType] === true)){ | ||
160 | autoCodeCompleteElem.style.visibility = "visible"; | ||
161 | }else if(autoCodeCompleteElem && !this.codeCompletionSupport[fileType]){ | ||
162 | autoCodeCompleteElem.style.visibility = "hidden"; | ||
163 | } | ||
164 | } | ||
165 | } | ||
133 | }); \ No newline at end of file | 166 | }); \ No newline at end of file |
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index a308f191..9792c7f6 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -442,6 +442,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
442 | NJevent("onOpenDocument", doc); | 442 | NJevent("onOpenDocument", doc); |
443 | // appDelegateModule.MyAppDelegate.onSetActiveDocument(); | 443 | // appDelegateModule.MyAppDelegate.onSetActiveDocument(); |
444 | 444 | ||
445 | this.application.ninja.stage.stageView.showCodeViewBar(false); | ||
445 | } | 446 | } |
446 | }, | 447 | }, |
447 | 448 | ||