aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/code-editor-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers/code-editor-controller.js')
-rw-r--r--js/controllers/code-editor-controller.js30
1 files changed, 25 insertions, 5 deletions
diff --git a/js/controllers/code-editor-controller.js b/js/controllers/code-editor-controller.js
index 8757dceb..5dee4ab2 100644
--- a/js/controllers/code-editor-controller.js
+++ b/js/controllers/code-editor-controller.js
@@ -166,11 +166,31 @@ var CodeEditorController = exports.CodeEditorController = Montage.create(Compone
166 166
167 handleCodeCompletionSupport:{ 167 handleCodeCompletionSupport:{
168 value:function(fileType){ 168 value:function(fileType){
169 var autoCodeCompleteElem = document.getElementsByClassName("autoCodeComplete")[0]; 169 var autoCodeCompleteElem = document.getElementsByClassName("autoCodeComplete")[0], elems=null, i=0;
170 if(autoCodeCompleteElem && (this.codeCompletionSupport[fileType] === true)){ 170 if(autoCodeCompleteElem){
171 autoCodeCompleteElem.style.visibility = "visible"; 171 elems = autoCodeCompleteElem.getElementsByTagName("*");
172 }else if(autoCodeCompleteElem && !this.codeCompletionSupport[fileType]){ 172 }
173 autoCodeCompleteElem.style.visibility = "hidden"; 173
174 if(elems && (this.codeCompletionSupport[fileType] === true)){
175 //enable elements
176 for(i=0;i<elems.length;i++){
177 if(elems[i].hasAttribute("disabled")){
178 elems[i].removeAttribute("disabled");
179 }
180 if(elems[i].classList.contains("disabled")){
181 elems[i].classList.remove("disabled");
182 }
183 }
184 }else if(elems && !this.codeCompletionSupport[fileType]){
185 //disable elements
186 for(i=0;i<elems.length;i++){
187 if(!elems[i].hasAttribute("disabled")){
188 elems[i].setAttribute("disabled", "disabled");
189 }
190 if(!elems[i].classList.contains("disabled")){
191 elems[i].classList.add("disabled");
192 }
193 }
174 } 194 }
175 } 195 }
176 }, 196 },