mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-09 15:07:10 +02:00
feat: message ux improvements (#52)
* feat(chat): add Ctrl+Enter shortcut to send messages Allows users to send messages using Ctrl+Enter (or Cmd+Enter on Mac) in addition to the existing Enter key shortcut. * fix(chat): disable autofocus on message editor Prevents keyboard from popping up automatically on mobile devices. --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -423,7 +423,6 @@ export function ChatViewer({
|
||||
handleSend(content, replyTo);
|
||||
}
|
||||
}}
|
||||
autoFocus
|
||||
className="flex-1 min-w-0"
|
||||
/>
|
||||
<Button
|
||||
|
||||
@@ -47,7 +47,7 @@ export const MentionEditor = forwardRef<
|
||||
placeholder = "Type a message...",
|
||||
onSubmit,
|
||||
searchProfiles,
|
||||
autoFocus = true,
|
||||
autoFocus = false,
|
||||
className = "",
|
||||
},
|
||||
ref,
|
||||
@@ -216,8 +216,11 @@ export const MentionEditor = forwardRef<
|
||||
"prose prose-sm max-w-none focus:outline-none min-h-[2rem] px-3 py-1.5",
|
||||
},
|
||||
handleKeyDown: (view, event) => {
|
||||
// Submit on Enter (without Shift)
|
||||
if (event.key === "Enter" && !event.shiftKey) {
|
||||
// Submit on Enter (without Shift) or Ctrl/Cmd+Enter
|
||||
if (
|
||||
event.key === "Enter" &&
|
||||
(!event.shiftKey || event.ctrlKey || event.metaKey)
|
||||
) {
|
||||
event.preventDefault();
|
||||
// Get editor from view state
|
||||
const editorInstance = (view as any).editor;
|
||||
|
||||
Reference in New Issue
Block a user