Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(channels): expose formatting in mobile message composers (#9526)
Peter Chinman8bb5d18ca386
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.mdindex c31c85a70b..206914d289 100644--- a/apps/web/AGENTS.md+++ b/apps/web/AGENTS.md@@ -203,6 +203,9 @@ Channel composer draft persistence has a backend-free browser regression:It checks draft blank lines across remounts, that a sent message renders itslines with the spacing the draft showed, and pending sends on desktop and phone: clear immediately, restore failed sends, and preserve a new draft typed during delivery.It also pastes a Macro link and Markdown into a code block, which must keep both as literal text.+Its phone formatting regression opens the ribbon from the add drawer in the+production message editor, removes selected strikethrough, and saves; keep+the ribbon horizontally scrollable and preserve editor focus on its controls.Shared GraphQL query metadata has a backend-free desktop and iPhone WebKit regression:`bunx playwright test --config src/lib/urql-solid/browser-test/playwright.config.ts`.diff --git a/apps/web/src/features/channel/Channel/InlineMessageEditor.tsx b/apps/web/src/features/channel/Channel/InlineMessageEditor.tsxindex db763c83a8..00c42d0374 100644--- a/apps/web/src/features/channel/Channel/InlineMessageEditor.tsx+++ b/apps/web/src/features/channel/Channel/InlineMessageEditor.tsx@@ -1,5 +1,6 @@import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';import { TOKENS } from '@core/hotkey/tokens';+import { isMobile } from '@core/mobile/isMobile';import { isPlatform } from '@core/util/platform';import type { MessageParent } from '@service-storage/messages';import { cn } from '@ui';@@ -76,15 +77,29 @@ export function MessageEditorContent(props: MessageEditorContentProps) {props.messageEditor.save(props.message, nextSnapshot)}>- <Input.Layout.ActionsLeft>- <Show when={isPlatform('ios')} fallback={<Input.AttachFilesAction />}>- <Input.AttachNativeMediaAction />- </Show>- <Input.DiscardDraftAction />- </Input.Layout.ActionsLeft>- <Input.Layout.ActionsRight>- <Input.SendAction />- </Input.Layout.ActionsRight>+ {(addMenu) => (+ <>+ <Input.Layout.ActionsLeft>+ <Show+ when={isMobile()}+ fallback={+ <Show+ when={isPlatform('ios')}+ fallback={<Input.AttachFilesAction />}+ >+ <Input.AttachNativeMediaAction />+ </Show>+ }+ >+ {addMenu}+ </Show>+ <Input.DiscardDraftAction />+ </Input.Layout.ActionsLeft>+ <Input.Layout.ActionsRight>+ <Input.SendAction />+ </Input.Layout.ActionsRight>+ </>+ )}</ChannelInput></div>);diff --git a/apps/web/src/features/channel/Input/ChannelInput.tsx b/apps/web/src/features/channel/Input/ChannelInput.tsxindex bef7c14a94..5610ca3ed9 100644--- a/apps/web/src/features/channel/Input/ChannelInput.tsx+++ b/apps/web/src/features/channel/Input/ChannelInput.tsx@@ -1,3 +1,4 @@+import { t } from '@app/lib/i18n';import { useMacroMentionLinkResolver } from '@components/app/split-layout/split-router/mention-links';import { EntityIcon } from '@core/component/EntityIcon';import { ComposerEditor } from '@core/component/LexicalMarkdown/component/ComposerEditor';@@ -22,6 +23,7 @@ import { isMacroAgentId } from '@core/constant/macroAgent';import { isMacroNewId } from '@core/constant/macroNew';import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';import { createMessageComposer } from '@core/messages/create-message-composer';+import { isMobile } from '@core/mobile/isMobile';import { isTouchDevice } from '@core/mobile/isTouchDevice';import type { IUser } from '@core/user/types';import { fireAndForget } from '@core/util/fireAndForget';@@ -35,6 +37,7 @@ import type { EntityData } from '@entity';import AtIcon from '@icon/system/regular/at.svg';import PaperclipIcon from '@icon/system/regular/paperclip.svg';import PhoneIcon from '@icon/system/regular/phone.svg';+import FormatIcon from '@icon/system/regular/text-aa.svg';import ChartBarIcon from '@phosphor/chart-bar-horizontal.svg';import GifIcon from '@phosphor/gif.svg';import type { MessageParent } from '@service-storage/messages';@@ -161,7 +164,8 @@ export type ChannelInputProps = InputCallbacks & {onStartCall?: () => void;/** A call is live in the channel, so the add menu offers to join it. */callInProgress?: boolean;- children?: JSX.Element;+ /** Custom action rows can place the composer's shared add menu. */+ children?: JSX.Element | ((addMenu: JSX.Element) => JSX.Element);/** Whether to auto-focus the input on mount. Defaults to `!isTouchDevice()`. */autofocus?: boolean;/**@@ -496,7 +500,7 @@ export function ChannelInput(props: ChannelInputProps) {return [{id: 'gif',- label: 'GIF',+ label: t('channelComposer.gif'),icon: <GifIcon class="size-5" />,onSelect: () =>runInEditor((editor) => action.action(editor, actionContext), {@@ -516,7 +520,7 @@ export function ChannelInput(props: ChannelInputProps) {? [{id: 'mention',- label: 'Mention',+ label: t('channelComposer.mention'),icon: <AtIcon class="size-5" />,hint: '@',onSelect: () =>@@ -525,9 +529,24 @@ export function ChannelInput(props: ChannelInputProps) {},]: []),+ ...(isMobile()+ ? [+ {+ id: 'format-text',+ label: t('channelComposer.formatText'),+ icon: <FormatIcon class="size-5" />,+ onSelect: () => {+ collapsedInput.expand();+ focusEditor();+ commands.toggleFormatRibbon();+ },+ focusesEditor: true,+ },+ ]+ : []),{id: 'attach',- label: 'Attach files',+ label: t('channelComposer.attachFiles'),icon: <PaperclipIcon class="size-5" />,onSelect: () => collapsedInput.attach(),},@@ -535,28 +554,28 @@ export function ChannelInput(props: ChannelInputProps) {],},{- label: 'Create',+ label: t('channelComposer.create'),items: !features().createItems? []: [...create('task',- 'New task',+ t('channelComposer.newTask'),<EntityIcon targetType="task" size="xs" />),...create('poll',- 'New poll',+ t('channelComposer.newPoll'),<ChartBarIcon class="size-3.5 text-violet" />),...create('form',- 'New form',+ t('channelComposer.newForm'),<EntityIcon targetType="form" size="xs" />),...create('document',- 'New document',+ t('channelComposer.newDocument'),<EntityIcon targetType="md" size="xs" />),],@@ -567,7 +586,7 @@ export function ChannelInput(props: ChannelInputProps) {? [{id: 'ask-macro',- label: 'Ask Macro',+ label: t('channelComposer.askMacro'),icon: <EntityIcon targetType="agent" size="xs" />,hint: '@macro',onSelect: () =>@@ -597,7 +616,9 @@ export function ChannelInput(props: ChannelInputProps) {? [{id: 'call',- label: callInProgress ? 'Join call' : 'Start a call',+ label: callInProgress+ ? t('channelComposer.joinCall')+ : t('channelComposer.startCall'),icon: (<PhoneIconclass={cn('size-3.5', callInProgress && 'text-success')}@@ -758,7 +779,12 @@ export function ChannelInput(props: ChannelInputProps) {><Input.DropOverlay /><Input.Layout.Body>- <Input.FormatRibbon>+ <Input.FormatRibbon+ class="overflow-x-auto"+ data-keep-keyboard+ onPointerDown={(event) => event.preventDefault()}+ onMouseDown={(event) => event.preventDefault()}+ ><FormatButtonsselectionState={() => markdownEditor.selection}onInlineFormat={(format) =>@@ -806,7 +832,11 @@ export function ChannelInput(props: ChannelInputProps) {<Input.Attachments kind="document" /></Input.Layout.Body><Switch>- <Match when={props.children}>{props.children}</Match>+ <Match when={props.children}>+ {typeof props.children === 'function'+ ? props.children(addMenu())+ : props.children}+ </Match><Match when><DefaultActionsinput={inputState.view()}diff --git a/apps/web/src/features/channel/Input/ComposerAddMenu.tsx b/apps/web/src/features/channel/Input/ComposerAddMenu.tsxindex c358f0fc39..2070e9fc44 100644--- a/apps/web/src/features/channel/Input/ComposerAddMenu.tsx+++ b/apps/web/src/features/channel/Input/ComposerAddMenu.tsx@@ -1,3 +1,4 @@+import { t } from '@app/lib/i18n';import { MobileDrawer } from '@components/app/mobile/MobileDrawer';import { focusInput } from '@core/directive/focusInput';import { isMobile } from '@core/mobile/isMobile';@@ -64,7 +65,7 @@ export function ComposerAddMenu(props: {variant="ghost"size="icon-md"class={props.class}- aria-label="Add"+ aria-label={t('common.add')}aria-haspopup="dialog"disabled={props.disabled}// Keep compatibility mouse focus from blurring the editor before the@@ -99,12 +100,12 @@ function AddDropdown(props: {return (<Dropdown placement={props.placement ?? 'top-start'} gutter={8}><Dropdown.Trigger- tooltip="Add"+ tooltip={t('common.add')}data-composer-menu-anchorvariant="ghost"size="icon-md"class={props.class}- aria-label="Add"+ aria-label={t('common.add')}disabled={props.disabled}><PlusIcon class="size-5 touch:size-6 shrink-0 pointer-events-none" />@@ -191,7 +192,7 @@ export function ComposerAddDrawer(props: {><MobileDrawer.Portal><MobileDrawer.Overlay />- <MobileDrawer.Content aria-label="Add to message">+ <MobileDrawer.Content aria-label={t('channelComposer.addToMessage')}><MobileDrawer.Handle /><MobileDrawer.ScrollBody class="gap-3"><For each={nonEmpty(props.groups)}>diff --git a/apps/web/src/features/channel/Input/FormatButtons.tsx b/apps/web/src/features/channel/Input/FormatButtons.tsxindex 74c5052e65..21ca9f6001 100644--- a/apps/web/src/features/channel/Input/FormatButtons.tsx+++ b/apps/web/src/features/channel/Input/FormatButtons.tsx@@ -60,7 +60,7 @@ export function FormatButtons(props: FormatButtonsProps) {><TextCodeIcon class="size-4" /></FormatButton>- <div class="w-px h-5 bg-edge-muted" />+ <div class="w-px h-5 shrink-0 bg-edge-muted" /><FormatButtonlabel="Bulleted list"active={elementsInRange()?.has('list-bullet')}@@ -108,8 +108,10 @@ function FormatButton(props: FormatButtonProps) {aria-label={props.label}variant="ghost"size="icon-sm"- class={props.active ? 'bg-active text-ink' : ''}+ class="shrink-0"+ aria-pressed={!!props.active}onPointerDown={(event: PointerEvent) => event.preventDefault()}+ onMouseDown={(event: MouseEvent) => event.preventDefault()}onClick={() => props.onClick()}>{props.children}diff --git a/apps/web/src/features/channel/Input/browser-test/README.md b/apps/web/src/features/channel/Input/browser-test/README.mdindex 86a585a700..a872e2f4fd 100644--- a/apps/web/src/features/channel/Input/browser-test/README.md+++ b/apps/web/src/features/channel/Input/browser-test/README.md@@ -25,6 +25,13 @@ The send regression checks desktop and phone: a pending send clears the editor,a rejected send restores its draft, and a rejection preserves a newer drafttyped while delivery was pending. The fixture controls completion locally.+The formatting regression mounts the production message editor on 320px and+390px touch screens. It selects part of a draft before opening the add drawer,+opens the ribbon, removes strikethrough only from that selection, hides the+ribbon, and saves the edit. It also checks that tapping ribbon padding keeps+editor focus and the selection, and that the last control stays reachable+without widening the composer.+The code-paste regression types three backticks to open a code block in theproduction composer and pastes a Macro link, then Markdown. Both land as literalcode text: the link used to become a mention the code block dropped, and thediff --git a/apps/web/src/features/channel/Input/browser-test/draft.tsx b/apps/web/src/features/channel/Input/browser-test/draft.tsxindex efd745264e..a281467ff5 100644--- a/apps/web/src/features/channel/Input/browser-test/draft.tsx+++ b/apps/web/src/features/channel/Input/browser-test/draft.tsx@@ -5,15 +5,45 @@ import { ChannelsContextProvider } from '@core/context/channels';import { QuickAccessProvider } from '@core/context/quickAccess/QuickAccessProvider';import { UserContextProvider } from '@core/context/user';import { useHotKeyRoot } from '@core/hotkey/hotkeys';+import type { MessageData } from '@core/messages/types';import { EntityProvider } from '@entity';import { QueryClient, QueryClientProvider } from '@tanstack/solid-query';import { createSignal, onCleanup, Show } from 'solid-js';import { render } from 'solid-js/web';+import { createMessageEditor } from '../../Channel/create-message-editor';+import { MessageEditorContent } from '../../Channel/InlineMessageEditor';import { ChannelInput } from '../ChannelInput';import { makeInputValuePersistenceKey } from '../utils/persistence';const channelId = 'draft-fixture-channel';+function EditFixture(props: { onSave: (content: string) => void }) {+ const parent = { type: 'channel' as const, id: channelId };+ const message: MessageData = {+ id: 'formatted-message',+ parent,+ content: '~~formatted draft~~',+ sender_id: 'fixture-user',+ created_at: '2026-01-01T00:00:00Z',+ updated_at: '2026-01-01T00:00:00Z',+ attachments: [],+ reactions: [],+ };+ const editor = createMessageEditor({+ parent: () => parent,+ patchMessage: ({ content }) => props.onSave(content),+ });+ editor.start(message);+ return (+ <MessageEditorContent+ parent={parent}+ message={message}+ messageEditor={editor}+ collapsible+ />+ );+}+/*** The real channel composer over the app shell's providers, in the order* `routes/Root.tsx` mounts them. Leaving the channel unmounts the composer;@@ -58,34 +88,39 @@ function Fixture() {>Fail send</button>- <Show when={open()}>- <ChannelInput- input={{- mode: 'channel',- id: `channel-input-${channelId}`,- placeholder: 'Message #draft-fixture',- }}- onSend={(snapshot) => {- setSent(snapshot.value);- setPending(true);- return new Promise<void>((resolve, reject) => {- completeSend = () => {- setPending(false);- resolve();- };- failSend = () => {- setPending(false);- reject(new Error('offline'));- };- });- }}- onSendError={() => {}}- participants={() => []}- bots={() => []}- persistenceKey={makeInputValuePersistenceKey({- channelId,- })}- />+ <Show+ when={!new URLSearchParams(location.search).has('edit')}+ fallback={<EditFixture onSave={setSent} />}+ >+ <Show when={open()}>+ <ChannelInput+ input={{+ mode: 'channel',+ id: `channel-input-${channelId}`,+ placeholder: 'Message #draft-fixture',+ }}+ onSend={(snapshot) => {+ setSent(snapshot.value);+ setPending(true);+ return new Promise<void>((resolve, reject) => {+ completeSend = () => {+ setPending(false);+ resolve();+ };+ failSend = () => {+ setPending(false);+ reject(new Error('offline'));+ };+ });+ }}+ onSendError={() => {}}+ participants={() => []}+ bots={() => []}+ persistenceKey={makeInputValuePersistenceKey({+ channelId,+ })}+ />+ </Show></Show></main></QuickAccessProvider>diff --git a/apps/web/src/features/channel/Input/browser-test/formatting.browser.e2e.ts b/apps/web/src/features/channel/Input/browser-test/formatting.browser.e2e.tsnew file mode 100644index 0000000000..8ed554e229--- /dev/null+++ b/apps/web/src/features/channel/Input/browser-test/formatting.browser.e2e.ts@@ -0,0 +1,93 @@+import { expect, test } from '@playwright/test';++for (const width of [320, 390]) {+ test(`removes strikethrough from a mobile message edit at ${width}px`, async ({+ browser,+ }) => {+ const context = await browser.newContext({+ viewport: { width, height: 844 },+ isMobile: true,+ hasTouch: true,+ });+ const page = await context.newPage();+ await page.route('**/*', async (route) => {+ const url = new URL(route.request().url());+ if (+ url.hostname === 'localhost' &&+ !url.pathname.startsWith('/__macro_dev/')+ ) {+ await route.continue();+ } else {+ await route.fulfill({+ status: 401,+ contentType: 'application/json',+ body: '{"responses":[]}',+ });+ }+ });+ await page.routeWebSocket('**/*', (socket) => socket.close());+ await page.goto('/src/features/channel/Input/browser-test/draft.html?edit');+ const add = page.getByRole('button', { name: 'Add', exact: true });+ await expect(add).toBeVisible({ timeout: 60_000 });+ await page.locator('[data-collapsed-input-preview]').tap();+ const editor = page.locator('[data-markdown-editable]');+ await expect(editor).toBeFocused();+ await expect(editor).toHaveText('formatted draft');++ // The existing partial selection must survive opening the add drawer.+ await editor.evaluate((element) => {+ const text = document+ .createTreeWalker(element, NodeFilter.SHOW_TEXT)+ .nextNode();+ if (!text) throw new Error('Formatted draft text missing');+ const range = document.createRange();+ range.setStart(text, 0);+ range.setEnd(text, 'formatted'.length);+ const selection = window.getSelection();+ selection?.removeAllRanges();+ selection?.addRange(range);+ document.dispatchEvent(new Event('selectionchange'));+ });+ expect(await page.evaluate(() => window.getSelection()?.toString())).toBe(+ 'formatted'+ );+ await add.tap();+ const format = page.locator('[data-composer-add-item="format-text"]');+ await expect(format).toBeVisible();+ await format.tap();+ const ribbon = page.locator('[data-input-format-ribbon]');+ await expect(ribbon).toBeVisible();+ await expect(editor).toBeFocused();+ expect(await page.evaluate(() => window.getSelection()?.toString())).toBe(+ 'formatted'+ );+ await ribbon.tap({ position: { x: 2, y: 2 } });+ await expect(editor).toBeFocused();+ expect(await page.evaluate(() => window.getSelection()?.toString())).toBe(+ 'formatted'+ );+ const strike = ribbon.getByRole('button', { name: 'Strikethrough' });+ await expect(strike).toHaveAttribute('aria-pressed', 'true');+ await strike.tap();+ await expect(strike).toHaveAttribute('aria-pressed', 'false');+ await expect(editor).toBeFocused();+ await expect(editor.locator('.md-strike')).toHaveText(' draft');++ // The final control stays reachable without widening the page.+ const quote = ribbon.getByRole('button', { name: 'Blockquote' });+ await quote.scrollIntoViewIfNeeded();+ const bounds = await ribbon.boundingBox();+ if (!bounds) throw new Error('Formatting ribbon has no bounds');+ expect(bounds.x + bounds.width).toBeLessThanOrEqual(width);++ await add.tap();+ await format.tap();+ await expect(ribbon).toHaveCount(0);+ await expect(editor).toHaveText('formatted draft');+ await page.getByRole('button', { name: 'Send message', exact: true }).tap();+ await expect(page.getByLabel('Sent message')).toHaveText(+ 'formatted ~~draft~~'+ );+ await context.close();+ });+}diff --git a/apps/web/src/lib/i18n/locales/en.ts b/apps/web/src/lib/i18n/locales/en.tsindex ea9b991ead..78342b6509 100644--- a/apps/web/src/lib/i18n/locales/en.ts+++ b/apps/web/src/lib/i18n/locales/en.ts@@ -1,6 +1,7 @@import agentAutoArchive from './en/agent-auto-archive';import agentSetup from './en/agent-setup';import calls from './en/calls';+import channelComposer from './en/channel-composer';import channelLabels from './en/channel-labels';import channelSections from './en/channel-sections';import commandMenu from './en/command-menu';@@ -26,6 +27,7 @@ export default {agentAutoArchive,agentSetup,calls,+ channelComposer,channelLabels,channelSections,commandMenu,diff --git a/apps/web/src/lib/i18n/locales/en/channel-composer.ts b/apps/web/src/lib/i18n/locales/en/channel-composer.tsnew file mode 100644index 0000000000..9085297cd5--- /dev/null+++ b/apps/web/src/lib/i18n/locales/en/channel-composer.ts@@ -0,0 +1,15 @@+export default {+ addToMessage: 'Add to message',+ mention: 'Mention',+ formatText: 'Format text',+ attachFiles: 'Attach files',+ gif: 'GIF',+ create: 'Create',+ newTask: 'New task',+ newPoll: 'New poll',+ newForm: 'New form',+ newDocument: 'New document',+ askMacro: 'Ask Macro',+ joinCall: 'Join call',+ startCall: 'Start a call',+};diff --git a/docs/agent-guide/channels.md b/docs/agent-guide/channels.mdindex c43c5d61a9..78bb704952 100644--- a/docs/agent-guide/channels.md+++ b/docs/agent-guide/channels.md@@ -371,7 +371,8 @@ Desktop message text uses a 16px horizontal inset and a compact gap above thetoolbar, consistent at narrow and wide composer widths.The new-message compose screen and channel message/reply inputs use the same-attachment and send controls on mobile and desktop, with no format toggle.+attachment and send controls on mobile and desktop. On phones, the `+` drawer+offers `Format text` beneath `Mention` to toggle the formatting ribbon.iOS uses the native media attachment picker.In the iOS app, both collapsed and expanded channel inputs use the shared[glass press spotlight](navigation.md#mobile-glass-feedback). Tap the editor and its@@ -415,6 +416,13 @@ below the editor. Check one image, several mixed attachments, and a documentalone, with and without text, in light and dark themes.Input action and formatting buttons show the app tooltip without a secondnative browser tooltip.+On phones, choose `+` → `Format text` beneath `Mention` to show or hide the+ribbon above the editor, including in message and reply edits. It offers bold,+italic, strikethrough, inline code, lists, checklists, and blockquotes; scroll+the ribbon horizontally to reach all controls. Verify that selecting struck-through+text, tapping Strikethrough, and saving removes the formatting while preserving+the text. Toggling the ribbon keeps the draft and returns focus to the editor.+Tapping the ribbon's padding or dividers also keeps the editor focused.On desktop, select draft text to open the floating formatting toolbar. Itscompact frame uses 4px outer padding with concentric button corners, a whitelight-mode background, a thin border, and a soft downward shadow. Check@@ -425,8 +433,8 @@ beside the buttons and collapse when it fits again, without flickering betweenlayouts. Also add and remove a line break or attachment andconfirm the draft and caret position survive. The attachment and send controlsshould remain usable in both layouts. Existing message and reply edit inputs show-Attach files, Discard Edit, and Send, with no format toggle; Escape also cancels-an edit. The iOS app uses its native media picker. Check inline and unified edits+Add, Discard Edit, and Send on phones; desktop keeps Attach files in place of Add.+Escape also cancels an edit. The iOS app uses its native media picker. Check inline and unified editson desktop and touch: attach a file and save, then edit again and discard changeswithout changing the original message or attachments.The iOS share sheet keeps its editor above the attachment and formatting controls.