TypeScript
revert(web): remove the composer rich text toggle button and mod+/ shortcut (#27390)
maria3dd62dce70b5
diff --git a/apps/web/src/components/chat/ChatComposer.tsx b/apps/web/src/components/chat/ChatComposer.tsxindex 56c73bcec16..d7878cc29a1 100644--- a/apps/web/src/components/chat/ChatComposer.tsx+++ b/apps/web/src/components/chat/ChatComposer.tsx@@ -133,7 +133,6 @@ import {import { attachmentUploadBlockReason } from "../../lib/attachmentUploadState";import type { AssistantCitationSourceAnchor } from "~/lib/assistantTextSelection";import { shortcutLabelForCommand } from "../../keybindings";-import { persistClientSettingsUpdate } from "../../hooks/useSettings";import {type TerminalContextDraft,type TerminalContextSelection,@@ -199,7 +198,6 @@ import {ComposerRestingImagePreviews,} from "./ComposerAttachmentStrip";import { ComposerPrimaryActions } from "./ComposerPrimaryActions";-import { ComposerRichTextToggle } from "./ComposerRichTextToggle";import { ComposerFooterPrimaryActions } from "./ComposerFooterControls";import { ComposerPendingUserInputPanel } from "./ComposerPendingUserInputPanel";import { ComposerPlanFollowUpBanner } from "./ComposerPlanFollowUpBanner";@@ -306,7 +304,6 @@ export interface ChatComposerHandle {openModelPicker: () => void;stepReasoningEffort: (direction: 1 | -1) => void;toggleModelPicker: () => void;- toggleRichText: () => void;openControl: (command: KeybindingCommand) => void;isModelPickerOpen: () => boolean;isCaretAtStart: () => boolean;@@ -2855,13 +2852,6 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)openModelPickerStable();}},- toggleRichText: () => {- if (isLiteralPendingAnswer) return;- persistClientSettingsUpdate((current) => ({- ...current,- composerRichTextEnabled: !current.composerRichTextEnabled,- })).catch(console.error);- },openControl: (command) => {if (composerBlurFrameRef.current !== null) {window.cancelAnimationFrame(composerBlurFrameRef.current);@@ -3439,23 +3429,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)showMobilePendingAnswerActions && "hidden sm:flex",)}>- {composerAttachButton || !isLiteralPendingAnswer ? (- <div className="me-2 flex items-center gap-0.5">- {composerAttachButton}- {isLiteralPendingAnswer ? null : (- <ComposerRichTextToggle- richTextEnabled={settings.composerRichTextEnabled}- shortcutLabel={shortcutLabelForCommand(- keybindings,- "composer.toggleRichText",- {- context: { terminalFocus: false, terminalOpen, modelPickerOpen: false },- },- )}- />- )}- </div>- ) : null}+ {composerAttachButton ? <div className="me-2">{composerAttachButton}</div> : null}<divdata-chat-composer-actions="right"data-chat-composer-transition-actions="true"diff --git a/apps/web/src/components/chat/ComposerRichTextToggle.tsx b/apps/web/src/components/chat/ComposerRichTextToggle.tsxdeleted file mode 100644index 13aebff1984..00000000000--- a/apps/web/src/components/chat/ComposerRichTextToggle.tsx+++ /dev/null@@ -1,41 +0,0 @@-import { PilcrowIcon } from "lucide-react";--import { updateClientSettings } from "../../hooks/useSettings";-import { Button } from "../ui/button";-import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";--// Same setting as Settings → Chat → Rich text composer. Flipping it remounts the-// editor; pointer-down is swallowed so a focused editor keeps its caret across that.-export function ComposerRichTextToggle({- richTextEnabled,- shortcutLabel,-}: {- readonly richTextEnabled: boolean;- readonly shortcutLabel: string | null;-}) {- const showingSource = !richTextEnabled;- return (- <Tooltip>- <TooltipTrigger- render={- <Button- type="button"- variant="ghost"- size="icon-sm"- aria-label="Markdown source"- aria-pressed={showingSource}- data-pressed={showingSource ? "" : undefined}- onPointerDown={(event) => event.preventDefault()}- onClick={() => void updateClientSettings({ composerRichTextEnabled: showingSource })}- />- }- >- <PilcrowIcon />- </TooltipTrigger>- <TooltipPopup>- {showingSource ? "Show formatting" : "Show Markdown source"}- {shortcutLabel ? ` · ${shortcutLabel}` : null}- </TooltipPopup>- </Tooltip>- );-}diff --git a/apps/web/src/components/chat/composerShortcuts.ts b/apps/web/src/components/chat/composerShortcuts.tsindex e55398996ce..30beb977196 100644--- a/apps/web/src/components/chat/composerShortcuts.ts+++ b/apps/web/src/components/chat/composerShortcuts.ts@@ -18,12 +18,6 @@ export function composerShortcutCommands("modelPicker.toggle": ({ event }) => {if (!event.repeat) composerRef.current?.toggleModelPicker();},- "composer.toggleRichText": ({ event }) => {- // The flip remounts the editor, which would drop an unsaved citation comment.- if (event.target instanceof Element && event.target.closest("[data-citation-comment-editor]"))- return false;- if (!event.repeat) composerRef.current?.toggleRichText();- },"composer.increaseEffort": ({ event }) => {if (!event.repeat) composerRef.current?.stepReasoningEffort(1);},diff --git a/apps/web/src/keybindings.test.ts b/apps/web/src/keybindings.test.tsindex 96ae09296de..a0ba7fa7ee0 100644--- a/apps/web/src/keybindings.test.ts+++ b/apps/web/src/keybindings.test.ts@@ -768,21 +768,12 @@ describe("composer and pull request shortcuts", () => {});it.each(["MacIntel", "Win32", "Linux"])(- "resolves composer toggle and alternate send chords in their contexts on %s",+ "reserves the alternate send chord for the focused composer on %s",(platform) => {const modifier = {metaKey: platform === "MacIntel",ctrlKey: platform !== "MacIntel",};- for (const terminalFocus of [false, true]) {- assert.strictEqual(- resolveShortcutCommand(event({ key: "/", ...modifier }), DEFAULT_RESOLVED_KEYBINDINGS, {- platform,- context: { terminalFocus },- }),- terminalFocus ? null : "composer.toggleRichText",- );- }const shiftedEnter = event({ key: "Enter", shiftKey: true, ...modifier });for (const composerRequiresModifier of [false, true]) {const context = {diff --git a/docs/user/composer.md b/docs/user/composer.mdindex 6156a126ca2..714572dfd50 100644--- a/docs/user/composer.md+++ b/docs/user/composer.md@@ -19,9 +19,7 @@ The composer writes Markdown and shows it styled as you type. Markers such asthem. Lines starting with `- `, `1. `, `- [ ] `, `> `, `# ` or `---` become lists,task lists, quotes, headings and rules; ` ``` ` followed by Enter opens a codeblock. What you typed is what the agent receives, markers and numbering-included, and `#1234` without a space still looks up a pull request. To see the-plain Markdown instead, press the **¶** button beside attach; it is the same-switch as **Settings → Chat → Rich text composer**.+included, and `#1234` without a space still looks up a pull request.Enter sends. In a list or quote, **Shift+Enter** continues it, and Shift+Enteron an empty line moves out one level, then leaves it; **Tab** nests a list itemdiff --git a/docs/user/keybindings.md b/docs/user/keybindings.mdindex 0e8e1774401..83989762c5b 100644--- a/docs/user/keybindings.md+++ b/docs/user/keybindings.md@@ -28,7 +28,6 @@ Use `mod+shift+e` for effort, `mod+shift+a` for permissions, `mod+shift+x` for tworkspace, and `mod+shift+g` for the Git branch. The workspace menu includes thecurrent checkout, a new worktree, and the previous worktree when available.Use `mod+shift+l` to reuse the previous worktree directly.-Use `mod+/` to switch the composer between rich text and its Markdown source.To change effort one step without opening the picker, bind**Composer: Increase Effort** and **Composer: Decrease Effort** in Keybindings.diff --git a/packages/contracts/src/keybindings.ts b/packages/contracts/src/keybindings.tsindex cc55adb9ca8..714e0a1d486 100644--- a/packages/contracts/src/keybindings.ts+++ b/packages/contracts/src/keybindings.ts@@ -87,7 +87,6 @@ export const STATIC_KEYBINDING_COMMANDS = ["appearance.cycle","themeEditor.toggle","composer.stash",- "composer.toggleRichText","composer.sendAlternate","composer.sendBackground","composer.sendAndNewThread",diff --git a/packages/shared/src/keybindings.ts b/packages/shared/src/keybindings.tsindex 8ae3f052afe..32292c0f9ef 100644--- a/packages/shared/src/keybindings.ts+++ b/packages/shared/src/keybindings.ts@@ -179,7 +179,6 @@ export const DEFAULT_KEYBINDINGS: ReadonlyArray<KeybindingRule> = [{ key: "mod+alt+shift+a", command: "appearance.cycle", when: "!terminalFocus" },{ key: "mod+alt+shift+t", command: "themeEditor.toggle" },{ key: "mod+s", command: "composer.stash", when: "!terminalFocus" },- { key: "mod+/", command: "composer.toggleRichText", when: "!terminalFocus" },{ key: "mod+shift+enter", command: "thread.steerQueuedMessage", when: "!terminalFocus" },{ key: "alt+arrowup", command: "thread.editQueuedMessage", when: "composerFocus" },{ key: "mod+enter", command: "composer.sendAlternate", when: "composerFocus && turnRunning" },