From e1786c40eb6d783e32a6350d0a56782ac63204d3 Mon Sep 17 00:00:00 2001 From: YouWei Zhao Date: Fri, 16 Mar 2018 00:45:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E5=BC=80?= =?UTF-8?q?=E5=90=AFlint=E5=92=8C=E8=87=AA=E5=8A=A8=E8=A1=A5=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/editor_blockly.js | 2 +- _server/editor_multi.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/_server/editor_blockly.js b/_server/editor_blockly.js index 769031f0..716c7a28 100644 --- a/_server/editor_blockly.js +++ b/_server/editor_blockly.js @@ -232,7 +232,7 @@ Blockly.svgResize(workspace); //Blockly.bindEventWithChecks_(editor_blockly.workspace.svgGroup_,"wheel",editor_blockly.workspace,function(e){}); document.getElementById('blocklyDiv').onmousewheel = function(e){ - console.log(e); + //console.log(e); e.preventDefault(); var hvScroll = e.shiftKey?'hScroll':'vScroll'; editor_blockly.workspace.scrollbar[hvScroll].handlePosition_+=( ((e.deltaY||0)+(e.detail||0)) >0?20:-20); diff --git a/_server/editor_multi.js b/_server/editor_multi.js index a72d28be..4a735402 100644 --- a/_server/editor_multi.js +++ b/_server/editor_multi.js @@ -28,8 +28,14 @@ codeEditor.on("keyup", function (cm, event) { editor_multi.id=''; editor_multi.isString=false; +editor_multi.lintAutocomplete=false; -editor_multi.show = function(){document.getElementById('left7').style='';} +editor_multi.show = function(){ + if(codeEditor.getValue().slice(0,8)==='function')editor_multi.lintAutocomplete=true; + codeEditor.setOption("lint", editor_multi.lintAutocomplete); + codeEditor.setOption("autocomplete", editor_multi.lintAutocomplete); + document.getElementById('left7').style=''; +} editor_multi.hide = function(){document.getElementById('left7').style='z-index:-1;opacity: 0;';} editor_multi.indent = function(field){ @@ -42,9 +48,12 @@ editor_multi.import = function(id_){ if(!thisTr)return false; var input = thisTr.children[2].children[0].children[0]; var field = thisTr.children[0].getAttribute('title'); + var comment = thisTr.children[1].getAttribute('title'); if(!input.type || input.type!=='textarea')return false; editor_multi.id=id_; editor_multi.isString=false; + editor_multi.lintAutocomplete=false; + if(field.indexOf('Effect') !== -1)editor_multi.lintAutocomplete=true; if(input.value.slice(0,1)==='"'){ editor_multi.isString=true; codeEditor.setValue(JSON.parse(input.value)||''); @@ -106,6 +115,7 @@ editor_multi.multiLineEdit = function(value,b,f,callback){ multiLineArgs[0]=b; multiLineArgs[1]=f; multiLineArgs[2]=callback; + editor_multi.lintAutocomplete=false; editor_multi.show(); } editor_multi.multiLineDone = function(){