aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/code-editor/codemirror-ninja/lib/ninja-simple-hint.js4
-rw-r--r--js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css5
-rw-r--r--js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html2
-rw-r--r--js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js8
-rw-r--r--js/controllers/code-editor-controller.js5
5 files changed, 20 insertions, 4 deletions
diff --git a/js/code-editor/codemirror-ninja/lib/ninja-simple-hint.js b/js/code-editor/codemirror-ninja/lib/ninja-simple-hint.js
index 4787b4f8..adcafd41 100644
--- a/js/code-editor/codemirror-ninja/lib/ninja-simple-hint.js
+++ b/js/code-editor/codemirror-ninja/lib/ninja-simple-hint.js
@@ -22,8 +22,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
22 function insert(str) { 22 function insert(str) {
23 editor.replaceRange(str, result.from, result.to); 23 editor.replaceRange(str, result.from, result.to);
24 } 24 }
25 // Ninja override: don't autocomplete to reduce user's typing errors 25
26// if (completions.length == 1) {insert(completions[0]); return true;} 26 if (completions.length == 1) {insert(completions[0]); return true;}
27 27
28 // Build the select widget 28 // Build the select widget
29 var complete = document.createElement("div"); 29 var complete = document.createElement("div");
diff --git a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css
index aeaf604c..68d77f90 100644
--- a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css
+++ b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css
@@ -22,6 +22,11 @@
22 vertical-align: middle; 22 vertical-align: middle;
23} 23}
24 24
25.viewOptions .autoCodeComplete input{
26 width: 1em;
27 height: 1em;
28}
29
25.viewOptions .autoCodeComplete .disabled{ 30.viewOptions .autoCodeComplete .disabled{
26 color:#515151; 31 color:#515151;
27} 32}
diff --git a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html
index 4448e1f1..3d5df256 100644
--- a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html
+++ b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.html
@@ -54,7 +54,7 @@
54 <input class="zoomFont" data-montage-id="zoomFont"/> 54 <input class="zoomFont" data-montage-id="zoomFont"/>
55 <div class="autoCodeComplete" > 55 <div class="autoCodeComplete" >
56 <input type="checkbox" data-montage-id="codeComplete" /> 56 <input type="checkbox" data-montage-id="codeComplete" />
57 <label data-montage-id="autoCompleteLabel">Automatic Completion</label> 57 <label data-montage-id="autoCompleteLabel">Auto Code Hints</label>
58 </div> 58 </div>
59 <div class="floatButtons"> 59 <div class="floatButtons">
60 <!--<button disabled="disabled" id="format" value="format" class="nj-skinned format">Format</button>--> 60 <!--<button disabled="disabled" id="format" value="format" class="nj-skinned format">Format</button>-->
diff --git a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js
index 13c9a705..04b509a6 100644
--- a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js
+++ b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js
@@ -121,6 +121,12 @@ exports.CodeEditorViewOptions = Montage.create(Component, {
121 oneway : false 121 oneway : false
122 }); 122 });
123 123
124 Object.defineBinding(this.codeCompleteCheck , "checked", {
125 boundObject: this.application.ninja.codeEditorController,
126 boundObjectPropertyPath: "automaticCodeComplete",
127 oneway : false
128 });
129
124 } 130 }
125 }, 131 },
126 132
@@ -137,6 +143,8 @@ exports.CodeEditorViewOptions = Montage.create(Component, {
137 } else { 143 } else {
138 this.autoCompleteLabel.classList.remove("disabled"); 144 this.autoCompleteLabel.classList.remove("disabled");
139 } 145 }
146
147 this.codeCompleteCheck.checked = false;
140 } 148 }
141 }, 149 },
142 150
diff --git a/js/controllers/code-editor-controller.js b/js/controllers/code-editor-controller.js
index f3c19b92..4572d69a 100644
--- a/js/controllers/code-editor-controller.js
+++ b/js/controllers/code-editor-controller.js
@@ -32,7 +32,7 @@ exports.CodeEditorController = Montage.create(Component, {
32 if(!value) { 32 if(!value) {
33 33
34 } else if(this._currentDocument.currentView === "code") { 34 } else if(this._currentDocument.currentView === "code") {
35 this.autocomplete = !this.codeCompletionSupport[this._currentDocument.model.file.extension]; 35 this.autocomplete = this.codeCompletionSupport[this._currentDocument.model.file.extension];
36 this._currentDocument.model.views.code.editor.focus(); 36 this._currentDocument.model.views.code.editor.focus();
37 this.applySettings(); 37 this.applySettings();
38 } 38 }
@@ -132,6 +132,9 @@ exports.CodeEditorController = Montage.create(Component, {
132 }; 132 };
133 133
134 //configure auto code completion if it is supported for that document type 134 //configure auto code completion if it is supported for that document type
135
136 this.autocomplete = this.codeCompletionSupport[documentType];
137
135 if(this.autocomplete) { 138 if(this.autocomplete) {
136 139
137 editorOptions.onKeyEvent = function(cm, keyEvent){ 140 editorOptions.onKeyEvent = function(cm, keyEvent){