Lint Checkbox

This commit is contained in:
oc 2018-03-17 23:27:43 +08:00
parent 7f3b86e2f7
commit e88c5ad67f
4 changed files with 20 additions and 5 deletions

View File

@ -109,6 +109,7 @@
function getCompletions(token, context, keywords, options) {
var found = [], start = token.string, global = options && options.globalScope || window;
function maybeAdd(str) {
if (str==null || str==undefined) return;
if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) found.push(str);
}
function gatherCompletions(obj) {

View File

@ -172,9 +172,13 @@ div.etableInputDiv {
}
.etableInputDiv input[type="checkbox"] {
position:relative;
top: 35%;
height: 30px;
width: 16px;
height: 16px;
position: absolute;
left: 50%;
top: 50%;
margin-left: -8px;
margin-top: -8px;
}
.etableInputDiv select {

View File

@ -34,11 +34,19 @@ editor_multi.show = function(){
var valueNow = codeEditor.getValue();
//try{eval('function _asdygakufyg_() { return '+valueNow+'\n}');editor_multi.lintAutocomplete=true;}catch(ee){}
if(valueNow.slice(0,8)==='function')editor_multi.lintAutocomplete=true;
codeEditor.setOption("lint", editor_multi.lintAutocomplete);
codeEditor.setOption("autocomplete", editor_multi.lintAutocomplete);
editor_multi.setLint();
document.getElementById('left7').style='';
}
editor_multi.hide = function(){document.getElementById('left7').style='z-index:-1;opacity: 0;';}
editor_multi.setLint = function() {
codeEditor.setOption("lint", editor_multi.lintAutocomplete);
codeEditor.setOption("autocomplete", editor_multi.lintAutocomplete);
document.getElementById("lintCheckbox").checked = editor_multi.lintAutocomplete;
}
editor_multi.toggerLint = function() {
editor_multi.lintAutocomplete = document.getElementById("lintCheckbox").checked;
editor_multi.setLint();
}
editor_multi.indent = function(field){
if(editor && editor.mode && editor.mode.indent)return editor.mode.indent(field);

View File

@ -142,6 +142,8 @@
<div id="left7" style="z-index:-1;opacity: 0;"><!-- 多行文本编辑器 -->
<button onclick="editor_multi.confirm()">confirm</button>
<button onclick="editor_multi.cancel()">cancel</button>
<input type="checkbox" onclick="editor_multi.toggerLint()" id="lintCheckbox" style="vertical-align: bottom;margin-left:6px" />
<span style="vertical-align: bottom; margin-left: -3px">Lint</span>
<textarea id="multiLineCode" name="multiLineCode"></textarea>
</div>
<div id="left8" class='leftTab' style="z-index:-1;opacity: 0;"><!-- functions -->