v1.2.0: 优化移动端输入与代码块显示体验
修复代码块长内容导致的页面横向溢出,并将移动端回车默认行为调整为换行,避免误触发送,提升手机端可用性。
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user