@devries-cameron20 / t3code-1 / commits / f48fb51fac
Fork 0

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

feat(web): switch the composer between rich text and Markdown source from a button or mod+/ (#26777)

maria committed Oct 30, 2026 at 03:33 UTC f48fb51fac22c76c0b76f196909acdb395f5832e
8 files changed +90 -3
apps/web/src/components/chat/ChatComposer.tsx
+27 -1
@@ -133,6 +133,7 @@ import {
133 import { attachmentUploadBlockReason } from "../../lib/attachmentUploadState";
134 import type { AssistantCitationSourceAnchor } from "~/lib/assistantTextSelection";
135 import { shortcutLabelForCommand } from "../../keybindings";
136 +import { persistClientSettingsUpdate } from "../../hooks/useSettings";
137 import {
138 type TerminalContextDraft,
139 type TerminalContextSelection,
@@ -198,6 +199,7 @@ import {
199 ComposerRestingImagePreviews,
200 } from "./ComposerAttachmentStrip";
201 import { ComposerPrimaryActions } from "./ComposerPrimaryActions";
202 +import { ComposerRichTextToggle } from "./ComposerRichTextToggle";
203 import { ComposerFooterPrimaryActions } from "./ComposerFooterControls";
204 import { ComposerPendingUserInputPanel } from "./ComposerPendingUserInputPanel";
205 import { ComposerPlanFollowUpBanner } from "./ComposerPlanFollowUpBanner";
@@ -304,6 +306,7 @@ export interface ChatComposerHandle {
306 openModelPicker: () => void;
307 stepReasoningEffort: (direction: 1 | -1) => void;
308 toggleModelPicker: () => void;
309 + toggleRichText: () => void;
310 openControl: (command: KeybindingCommand) => void;
311 isModelPickerOpen: () => boolean;
312 isCaretAtStart: () => boolean;
@@ -2852,6 +2855,13 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
2855 openModelPickerStable();
2856 }
2857 },
2858 + toggleRichText: () => {
2859 + if (isLiteralPendingAnswer) return;
2860 + persistClientSettingsUpdate((current) => ({
2861 + ...current,
2862 + composerRichTextEnabled: !current.composerRichTextEnabled,
2863 + })).catch(console.error);
2864 + },
2865 openControl: (command) => {
2866 if (composerBlurFrameRef.current !== null) {
2867 window.cancelAnimationFrame(composerBlurFrameRef.current);
@@ -3429,7 +3439,23 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
3439 showMobilePendingAnswerActions && "hidden sm:flex",
3440 )}
3441 >
3432 - {composerAttachButton ? <div className="me-2">{composerAttachButton}</div> : null}
3442 + {composerAttachButton || !isLiteralPendingAnswer ? (
3443 + <div className="me-2 flex items-center gap-0.5">
3444 + {composerAttachButton}
3445 + {isLiteralPendingAnswer ? null : (
3446 + <ComposerRichTextToggle
3447 + richTextEnabled={settings.composerRichTextEnabled}
3448 + shortcutLabel={shortcutLabelForCommand(
3449 + keybindings,
3450 + "composer.toggleRichText",
3451 + {
3452 + context: { terminalFocus: false, terminalOpen, modelPickerOpen: false },
3453 + },
3454 + )}
3455 + />
3456 + )}
3457 + </div>
3458 + ) : null}
3459 <div
3460 data-chat-composer-actions="right"
3461 data-chat-composer-transition-actions="true"
apps/web/src/components/chat/ComposerRichTextToggle.tsx new
+41
@@ -0,0 +1,41 @@
1 +import { FeatherIcon } from "lucide-react";
2 +
3 +import { updateClientSettings } from "../../hooks/useSettings";
4 +import { Button } from "../ui/button";
5 +import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
6 +
7 +// Same setting as Settings → Chat → Rich text composer. Flipping it remounts the
8 +// editor; pointer-down is swallowed so a focused editor keeps its caret across that.
9 +export function ComposerRichTextToggle({
10 + richTextEnabled,
11 + shortcutLabel,
12 +}: {
13 + readonly richTextEnabled: boolean;
14 + readonly shortcutLabel: string | null;
15 +}) {
16 + const showingSource = !richTextEnabled;
17 + return (
18 + <Tooltip>
19 + <TooltipTrigger
20 + render={
21 + <Button
22 + type="button"
23 + variant="ghost"
24 + size="icon-sm"
25 + aria-label="Markdown source"
26 + aria-pressed={showingSource}
27 + data-pressed={showingSource ? "" : undefined}
28 + onPointerDown={(event) => event.preventDefault()}
29 + onClick={() => void updateClientSettings({ composerRichTextEnabled: showingSource })}
30 + />
31 + }
32 + >
33 + <FeatherIcon />
34 + </TooltipTrigger>
35 + <TooltipPopup>
36 + {showingSource ? "Show formatting" : "Show Markdown source"}
37 + {shortcutLabel ? ` · ${shortcutLabel}` : null}
38 + </TooltipPopup>
39 + </Tooltip>
40 + );
41 +}
apps/web/src/components/chat/composerShortcuts.ts
+6
@@ -18,6 +18,12 @@ export function composerShortcutCommands(
18 "modelPicker.toggle": ({ event }) => {
19 if (!event.repeat) composerRef.current?.toggleModelPicker();
20 },
21 + "composer.toggleRichText": ({ event }) => {
22 + // The flip remounts the editor, which would drop an unsaved citation comment.
23 + if (event.target instanceof Element && event.target.closest("[data-citation-comment-editor]"))
24 + return false;
25 + if (!event.repeat) composerRef.current?.toggleRichText();
26 + },
27 "composer.increaseEffort": ({ event }) => {
28 if (!event.repeat) composerRef.current?.stepReasoningEffort(1);
29 },
apps/web/src/keybindings.test.ts
+10 -1
@@ -768,12 +768,21 @@ describe("composer and pull request shortcuts", () => {
768 });
769
770 it.each(["MacIntel", "Win32", "Linux"])(
771 - "reserves the alternate send chord for the focused composer on %s",
771 + "resolves composer toggle and alternate send chords in their contexts on %s",
772 (platform) => {
773 const modifier = {
774 metaKey: platform === "MacIntel",
775 ctrlKey: platform !== "MacIntel",
776 };
777 + for (const terminalFocus of [false, true]) {
778 + assert.strictEqual(
779 + resolveShortcutCommand(event({ key: "/", ...modifier }), DEFAULT_RESOLVED_KEYBINDINGS, {
780 + platform,
781 + context: { terminalFocus },
782 + }),
783 + terminalFocus ? null : "composer.toggleRichText",
784 + );
785 + }
786 const shiftedEnter = event({ key: "Enter", shiftKey: true, ...modifier });
787 for (const composerRequiresModifier of [false, true]) {
788 const context = {
docs/user/composer.md
+3 -1
@@ -19,7 +19,9 @@ The composer writes Markdown and shows it styled as you type. Markers such as
19 them. Lines starting with `- `, `1. `, `- [ ] `, `> `, `# ` or `---` become lists,
20 task lists, quotes, headings and rules; ` ``` ` followed by Enter opens a code
21 block. What you typed is what the agent receives, markers and numbering
22 -included, and `#1234` without a space still looks up a pull request.
22 +included, and `#1234` without a space still looks up a pull request. To see the
23 +plain Markdown instead, press the button beside attach; it is the same
24 +switch as **Settings → Chat → Rich text composer**.
25
26 Enter sends. In a list or quote, **Shift+Enter** continues it, and Shift+Enter
27 on an empty line moves out one level, then leaves it; **Tab** nests a list item
docs/user/keybindings.md
+1
@@ -28,6 +28,7 @@ Use `mod+shift+e` for effort, `mod+shift+a` for permissions, `mod+shift+x` for t
28 workspace, and `mod+shift+g` for the Git branch. The workspace menu includes the
29 current checkout, a new worktree, and the previous worktree when available.
30 Use `mod+shift+l` to reuse the previous worktree directly.
31 +Use `mod+/` to switch the composer between rich text and its Markdown source.
32
33 To change effort one step without opening the picker, bind
34 **Composer: Increase Effort** and **Composer: Decrease Effort** in Keybindings.
packages/contracts/src/keybindings.ts
+1
@@ -87,6 +87,7 @@ export const STATIC_KEYBINDING_COMMANDS = [
87 "appearance.cycle",
88 "themeEditor.toggle",
89 "composer.stash",
90 + "composer.toggleRichText",
91 "composer.sendAlternate",
92 "composer.sendBackground",
93 "composer.sendAndNewThread",
packages/shared/src/keybindings.ts
+1
@@ -179,6 +179,7 @@ export const DEFAULT_KEYBINDINGS: ReadonlyArray<KeybindingRule> = [
179 { key: "mod+alt+shift+a", command: "appearance.cycle", when: "!terminalFocus" },
180 { key: "mod+alt+shift+t", command: "themeEditor.toggle" },
181 { key: "mod+s", command: "composer.stash", when: "!terminalFocus" },
182 + { key: "mod+/", command: "composer.toggleRichText", when: "!terminalFocus" },
183 { key: "mod+shift+enter", command: "thread.steerQueuedMessage", when: "!terminalFocus" },
184 { key: "alt+arrowup", command: "thread.editQueuedMessage", when: "composerFocus" },
185 { key: "mod+enter", command: "composer.sendAlternate", when: "composerFocus && turnRunning" },