mirror of
https://github.com/torappinfo/uweb.git
synced 2024-08-14 23:54:59 +00:00
25 lines
560 B
JavaScript
25 lines
560 B
JavaScript
|
var editor;
|
||
|
onload=function(){
|
||
|
function getMode(filename){
|
||
|
var ext = filename.split('.').pop();
|
||
|
var prefix = "ace/mode/";
|
||
|
if(!ext) return prefix + "text";
|
||
|
|
||
|
switch (ext) {
|
||
|
case "js":
|
||
|
return prefix + "javascript";
|
||
|
}
|
||
|
return prefix + ext;
|
||
|
}
|
||
|
|
||
|
editor = ace.edit("editor");
|
||
|
editor.setTheme("ace/theme/clouds");
|
||
|
editor.setShowPrintMargin(false);
|
||
|
editor.setOptions({
|
||
|
enableBasicAutocompletion: true,
|
||
|
enableSnippets: true,
|
||
|
enableLiveAutocompletion: true
|
||
|
});
|
||
|
editor.session.setMode(getMode(location.href));
|
||
|
}
|