diff --git a/frontend/index.html b/frontend/index.html index 0d9974b..926f08e 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -458,7 +458,7 @@ function bootMonaco(){ tabSize:2, suggestOnTriggerCharacters:true, quickSuggestions:true, fixedOverflowWidgets:true }); - ed.addCommand(MONACO_LIB.KeyMod.CmdCmd|MONACO_LIB.KeyCode.Enter, function(){ doAction(); }); + /* 注意:Monaco 无 KeyMod.CmdCmd(undefined|Enter 会变成裸 Enter 绑定导致回车即提交)——必须用 CtrlCmd */ ed.addCommand(MONACO_LIB.KeyMod.CtrlCmd|MONACO_LIB.KeyCode.Enter, function(){ doAction(); }); ed.addCommand(MONACO_LIB.KeyMod.Shift|MONACO_LIB.KeyCode.Enter, function(){ doAction(); }); ed.onDidChangeModelContent(function(){ setMorph('code'); document.getElementById('stSaved').textContent='代码自动保留 ✓'; lspCheck(); }); @@ -710,6 +710,7 @@ function submitCode(){ } var code=ED.getValue(); LAST_CODE=code; VER++; PENDING=true; var dot=document.getElementById('sendDot'); dot.disabled=true; + if(ED&&ED.focus){ try{ED.focus();}catch(e){} } /* 提交后焦点回编辑器,防止焦点滞留按钮再被回车误触发 */ addMsg('user', '
提交代码('+LANG_NAME()+')· 版本 v'+VER+'
'); addMsg('sys', '🔍 自动本地预检中(语法'+(CUR_LANG==='java'?' → 静态分析 → 样例自测':' → LSP 诊断')+')…'); setTimeout(function(){