@devries-cameron20 / t3code-1 / commits / 77e35c5612
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): send cited messages with Cmd+Enter (#9307)

Exotic committed Sep 3, 2026 at 19:22 UTC 77e35c561259733d880ab62a43aad0894d301d9b
5 files changed +49 -4
apps/web/src/components/ComposerCitationNode.tsx
+7 -1
@@ -47,7 +47,8 @@ export type ComposerCitationCommentTarget = {
47 export const ComposerCitationCommentContext = createContext<{
48 openComment: ComposerCitationCommentTarget | null;
49 onOpenChange: (nodeKey: NodeKey, open: boolean) => void;
50 -}>({ openComment: null, onOpenChange: () => {} });
50 + onSubmitAndSend: () => void;
51 +}>({ openComment: null, onOpenChange: () => {}, onSubmitAndSend: () => {} });
52
53 /** Consume a cite action once its controlled prompt has been committed to the editor. */
54 export function $consumeComposerCitationCommentRequest(requestRef: {
@@ -127,6 +128,11 @@ function ComposerCitationDecorator(props: { citation: AssistantCitation; nodeKey
128 commentContext.onOpenChange(props.nodeKey, open);
129 },
130 onSave: onSaveComment,
131 + onSaveAndSend: (comment) => {
132 + if (!onSaveComment(comment)) return false;
133 + commentContext.onSubmitAndSend();
134 + return true;
135 + },
136 }}
137 onRemove={onRemove}
138 />
apps/web/src/components/ComposerPromptEditor.tsx
+6 -1
@@ -924,6 +924,7 @@ interface ComposerPromptEditorProps {
924 onPageScrollKeyDown?: (key: "PageUp" | "PageDown") => void;
925 onPageScrollKeyUp?: (key: string) => void;
926 onPageScrollRelease?: () => void;
927 + onCitationSubmitAndSend?: () => void;
928 onPaste: React.ClipboardEventHandler<HTMLElement>;
929 editorRef: React.RefObject<ComposerPromptEditorHandle | null>;
930 }
@@ -1571,6 +1572,7 @@ function ComposerPromptEditorInner({
1572 onPageScrollKeyDown,
1573 onPageScrollKeyUp,
1574 onPageScrollRelease,
1575 + onCitationSubmitAndSend,
1576 onPaste,
1577 editorRef,
1578 }: ComposerPromptEditorProps) {
@@ -1603,8 +1605,9 @@ function ComposerPromptEditorInner({
1605 open ? { nodeKey } : current?.nodeKey === nodeKey ? null : current,
1606 );
1607 },
1608 + onSubmitAndSend: onCitationSubmitAndSend ?? (() => {}),
1609 }),
1607 - [openCitationComment],
1610 + [onCitationSubmitAndSend, openCitationComment],
1611 );
1612 const terminalContextActions = useMemo(
1613 () => ({ onRemoveTerminalContext }),
@@ -1969,6 +1972,7 @@ export function ComposerPromptEditor({
1972 onPageScrollKeyDown,
1973 onPageScrollKeyUp,
1974 onPageScrollRelease,
1975 + onCitationSubmitAndSend,
1976 onPaste,
1977 editorRef,
1978 }: ComposerPromptEditorProps) {
@@ -2013,6 +2017,7 @@ export function ComposerPromptEditor({
2017 onChange={onChange}
2018 {...(onVisibleSelectionChange ? { onVisibleSelectionChange } : {})}
2019 onPaste={onPaste}
2020 + {...(onCitationSubmitAndSend ? { onCitationSubmitAndSend } : {})}
2021 editorRef={editorRef}
2022 {...(onCommandKeyDown ? { onCommandKeyDown } : {})}
2023 {...(onPageScrollKeyDown ? { onPageScrollKeyDown } : {})}
apps/web/src/components/chat/AssistantCitationChip.tsx
+10
@@ -42,6 +42,7 @@ export function AssistantCitationChip({
42 sourceAnchor?: AssistantCitationSourceAnchor | undefined;
43 onOpenChange: (open: boolean) => void;
44 onSave: (comment: string) => boolean;
45 + onSaveAndSend?: (comment: string) => boolean;
46 };
47 }) {
48 const navigate = useNavigate();
@@ -158,6 +159,15 @@ export function AssistantCitationChip({
159 commentEditor.onOpenChange(false);
160 return true;
161 }}
162 + {...(commentEditor.onSaveAndSend
163 + ? {
164 + onSubmitAndSend: (comment: string) => {
165 + if (!commentEditor.onSaveAndSend?.(comment)) return false;
166 + commentEditor.onOpenChange(false);
167 + return true;
168 + },
169 + }
170 + : {})}
171 onCancel={() => commentEditor.onOpenChange(false)}
172 />
173 </PopoverPopup>
apps/web/src/components/chat/AssistantCitationCommentEditor.tsx
+16 -2
@@ -7,11 +7,13 @@ export function AssistantCitationCommentEditor({
7 citation,
8 inputRef,
9 onSubmit,
10 + onSubmitAndSend,
11 onCancel,
12 }: {
13 citation: AssistantCitation;
14 inputRef?: Ref<HTMLTextAreaElement>;
15 onSubmit: (comment: string) => boolean;
16 + onSubmitAndSend?: (comment: string) => boolean;
17 onCancel: () => void;
18 }) {
19 const [comment, setComment] = useState(citation.comment ?? "");
@@ -19,6 +21,14 @@ export function AssistantCitationCommentEditor({
21 const submit = () => {
22 if (!commentTooLong) onSubmit(comment);
23 };
24 + const submitAndSend = () => {
25 + if (commentTooLong) return;
26 + if (onSubmitAndSend) {
27 + onSubmitAndSend(comment);
28 + } else {
29 + onSubmit(comment);
30 + }
31 + };
32
33 return (
34 <div
@@ -35,7 +45,7 @@ export function AssistantCitationCommentEditor({
45 <textarea
46 ref={inputRef}
47 aria-label="Comment on selected text"
38 - aria-description="Enter to save the citation comment; Shift+Enter for a new line."
48 + aria-description="Enter to save the citation comment; Command/Ctrl+Enter to save and send; Shift+Enter for a new line."
49 aria-invalid={commentTooLong || undefined}
50 placeholder="Add an optional comment..."
51 rows={2}
@@ -50,7 +60,11 @@ export function AssistantCitationCommentEditor({
60 event.keyCode !== 229
61 ) {
62 event.preventDefault();
53 - submit();
63 + if (event.metaKey || event.ctrlKey) {
64 + submitAndSend();
65 + } else {
66 + submit();
67 + }
68 }
69 }}
70 />
apps/web/src/components/chat/ChatComposer.tsx
+10
@@ -2824,6 +2824,15 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
2824 shouldBlurMobileComposerOnSubmit,
2825 ],
2826 );
2827 + const submitCitationAndSend = useCallback(() => {
2828 + const intent = composerSubmissionIntentForEnter({
2829 + isMobileViewport,
2830 + shiftKey: false,
2831 + modifierKey: true,
2832 + isDraftThread: routeKind === "draft",
2833 + });
2834 + submitComposer(undefined, intent ?? "foreground");
2835 + }, [isMobileViewport, routeKind, submitComposer]);
2836 const compactThreadContext = useCallback(() => {
2837 if (
2838 compactDisabled ||
@@ -5246,6 +5255,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
5255 onPageScrollKeyDown={onPageScrollKeyDown}
5256 onPageScrollKeyUp={onPageScrollKeyUp}
5257 onPageScrollRelease={onPageScrollRelease}
5258 + onCitationSubmitAndSend={submitCitationAndSend}
5259 onPaste={onComposerPaste}
5260 placeholder={
5261 isComposerApprovalState