v1.2.0: 优化移动端输入与代码块显示体验

修复代码块长内容导致的页面横向溢出,并将移动端回车默认行为调整为换行,避免误触发送,提升手机端可用性。
This commit is contained in:
Daniel
2026-03-09 10:04:06 +00:00
parent 0dc2b5a768
commit e3337c8d1b
4 changed files with 32 additions and 2 deletions

View File

@@ -807,6 +807,10 @@
msgInput.style.height = Math.min(msgInput.scrollHeight, max) + 'px';
}
function isMobileInputMode() {
return window.matchMedia('(max-width: 768px), (pointer: coarse)').matches;
}
// --- Event Listeners ---
loginForm.addEventListener('submit', (e) => {
e.preventDefault();
@@ -864,6 +868,14 @@
if (e.key === 'Escape') { hideCmdMenu(); return; }
}
if (e.key === 'Enter' && !e.shiftKey) {
if (isMobileInputMode()) {
if (!cmdMenu.hidden) {
e.preventDefault();
selectCmdMenuItem();
}
return;
}
e.preventDefault();
if (!cmdMenu.hidden) {
// If menu is open and user presses Enter, select the item