From f9113e15f9a59a37276ece15401ed8326f4547e2 Mon Sep 17 00:00:00 2001 From: langxm Date: Wed, 14 Oct 2026 11:27:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(M7.4b):=20=E6=A0=B9=E6=B2=BB=E5=9B=9E?= =?UTF-8?q?=E8=BD=A6=E5=8D=B3=E6=8F=90=E4=BA=A4=E2=80=94=E2=80=94Monaco=20?= =?UTF-8?q?KeyMod.CmdCmd=20=E4=B8=8D=E5=AD=98=E5=9C=A8(undefined|Enter=3D?= =?UTF-8?q?=E8=A3=B8Enter=E7=BB=91=E5=AE=9A)=EF=BC=8C=E6=94=B9=E4=B8=BA=20?= =?UTF-8?q?CtrlCmd=EF=BC=9B=E6=8F=90=E4=BA=A4=E5=90=8E=E7=84=A6=E7=82=B9?= =?UTF-8?q?=E5=9B=9E=E7=BC=96=E8=BE=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(){