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
style(channels): add block quote btn to format ribbon, update fmt ribbon button use (#3171)
Seamusa69861e5bd6c
diff --git a/js/app/packages/block-email/component/BaseInput.tsx b/js/app/packages/block-email/component/BaseInput.tsxindex ef40c48740..d218f7887d 100644--- a/js/app/packages/block-email/component/BaseInput.tsx+++ b/js/app/packages/block-email/component/BaseInput.tsx@@ -1503,7 +1503,6 @@ export function BaseInput(props: {<div class="flex flex-row w-full gap-2 items-center p-2"><FormatButtonsselectionState={() => formatState}- includeQuoteonInlineFormat={(format) => {const editor_ = editor();if (!editor_) return;diff --git a/js/app/packages/block-email/component/compose/ComposeToolbar.tsx b/js/app/packages/block-email/component/compose/ComposeToolbar.tsxindex 837cfc51dc..1be084d69b 100644--- a/js/app/packages/block-email/component/compose/ComposeToolbar.tsx+++ b/js/app/packages/block-email/component/compose/ComposeToolbar.tsx@@ -75,7 +75,6 @@ export function EmailComposeToolbar(props: {<div class="flex flex-row w-full gap-2 items-center p-2 -ml-3"><FormatButtonsselectionState={() => defaultSelectionData}- includeQuoteonInlineFormat={(format) => {props.editor?.()?.dispatchCommand(FORMAT_TEXT_COMMAND, format);}}diff --git a/js/app/packages/channel/Input/FormatButtons.tsx b/js/app/packages/channel/Input/FormatButtons.tsxindex a21b2c289e..92b2a5c05c 100644--- a/js/app/packages/channel/Input/FormatButtons.tsx+++ b/js/app/packages/channel/Input/FormatButtons.tsx@@ -2,6 +2,7 @@ import type {NodeTransformType,SelectionData,} from '@core/component/LexicalMarkdown/plugins';+import { LabelAndHotKey } from '@core/component/Tooltip';import TextBoldIcon from '@icon/bold/text-b-bold.svg';import TextCodeIcon from '@icon/regular/code.svg';import ListBulletsIcon from '@icon/regular/list-bullets.svg';@@ -10,79 +11,113 @@ import ListNumbersIcon from '@icon/regular/list-numbers.svg';import TextQuoteIcon from '@icon/regular/quotes.svg';import TextItalicIcon from '@icon/regular/text-italic.svg';import TextStrikethroughIcon from '@icon/regular/text-strikethrough.svg';+import { Button } from '@ui';import type { TextFormatType } from 'lexical';-import type { Accessor } from 'solid-js';-import { RibbonButton } from './RibbonButton';+import type { Accessor, JSX } from 'solid-js';++type HotkeyToken = Parameters<typeof LabelAndHotKey>[0]['hotkeyToken'];type FormatButtonsProps = {selectionState: Accessor<SelectionData | undefined>;onInlineFormat: (format: TextFormatType) => void;onNodeFormat: (format: NodeTransformType) => void;- includeQuote?: boolean;};export function FormatButtons(props: FormatButtonsProps) {+ const selection = () => props.selectionState();+ const elementsInRange = () => selection()?.elementsInRange;++ const toggleNodeFormat = (format: NodeTransformType) => {+ const isActive = elementsInRange()?.has(format);+ props.onNodeFormat(isActive ? 'paragraph' : format);+ };+return (<>- <RibbonButton+ <FormatButtonlabel="Bold"- active={props.selectionState()?.bold}+ active={selection()?.bold}onClick={() => props.onInlineFormat('bold')}>- <TextBoldIcon class="size-5" />- </RibbonButton>- <RibbonButton+ <TextBoldIcon />+ </FormatButton>+ <FormatButtonlabel="Italic"- active={props.selectionState()?.italic}+ active={selection()?.italic}onClick={() => props.onInlineFormat('italic')}>- <TextItalicIcon class="size-5" />- </RibbonButton>- <RibbonButton+ <TextItalicIcon />+ </FormatButton>+ <FormatButtonlabel="Strikethrough"- active={props.selectionState()?.strikethrough}+ active={selection()?.strikethrough}onClick={() => props.onInlineFormat('strikethrough')}>- <TextStrikethroughIcon class="size-5" />- </RibbonButton>- <RibbonButton- label="Code"- active={props.selectionState()?.code}+ <TextStrikethroughIcon />+ </FormatButton>+ <FormatButton+ label="Inline code"+ active={selection()?.code}onClick={() => props.onInlineFormat('code')}>- <TextCodeIcon class="size-5" />- </RibbonButton>+ <TextCodeIcon />+ </FormatButton><div class="w-px h-5 bg-edge-muted" />- <RibbonButton- label="Bullet list"- active={props.selectionState()?.elementsInRange.has('list-bullet')}- onClick={() => props.onNodeFormat('list-bullet')}+ <FormatButton+ label="Bulleted list"+ active={elementsInRange()?.has('list-bullet')}+ onClick={() => toggleNodeFormat('list-bullet')}>- <ListBulletsIcon class="size-5" />- </RibbonButton>- <RibbonButton+ <ListBulletsIcon />+ </FormatButton>+ <FormatButtonlabel="Numbered list"- active={props.selectionState()?.elementsInRange.has('list-number')}- onClick={() => props.onNodeFormat('list-number')}+ active={elementsInRange()?.has('list-number')}+ onClick={() => toggleNodeFormat('list-number')}>- <ListNumbersIcon class="size-5" />- </RibbonButton>- <RibbonButton+ <ListNumbersIcon />+ </FormatButton>+ <FormatButtonlabel="Checklist"- active={props.selectionState()?.elementsInRange.has('list-check')}- onClick={() => props.onNodeFormat('list-check')}+ active={elementsInRange()?.has('list-check')}+ onClick={() => toggleNodeFormat('list-check')}>- <ListChecksIcon class="size-5" />- </RibbonButton>- {props.includeQuote && (- <RibbonButton- label="Blockquote"- active={props.selectionState()?.elementsInRange.has('quote')}- onClick={() => props.onNodeFormat('quote')}- >- <TextQuoteIcon class="size-5" />- </RibbonButton>- )}+ <ListChecksIcon />+ </FormatButton>+ <FormatButton+ label="Blockquote"+ active={elementsInRange()?.has('quote')}+ onClick={() => toggleNodeFormat('quote')}+ >+ <TextQuoteIcon />+ </FormatButton></>);}++type FormatButtonProps = {+ label: string;+ hotkeyToken?: HotkeyToken;+ active?: boolean;+ onClick: () => void;+ children: JSX.Element;+};++function FormatButton(props: FormatButtonProps) {+ return (+ <Button+ aria-label={props.label}+ title={props.label}+ tooltip={+ <LabelAndHotKey label={props.label} hotkeyToken={props.hotkeyToken} />+ }+ variant="ghost"+ size="icon-sm"+ class={props.active ? 'bg-active text-ink' : ''}+ onPointerDown={(event: PointerEvent) => event.preventDefault()}+ onClick={() => props.onClick()}+ >+ {props.children}+ </Button>+ );+}diff --git a/js/app/packages/channel/Input/RibbonButton.tsx b/js/app/packages/channel/Input/RibbonButton.tsxdeleted file mode 100644index 6698a74a91..0000000000--- a/js/app/packages/channel/Input/RibbonButton.tsx+++ /dev/null@@ -1,33 +0,0 @@-import { cn } from '@ui';-import type { JSX } from 'solid-js';--type RibbonButtonProps = {- label: string;- active?: boolean;- onClick: () => void;- children: JSX.Element;-};--export function RibbonButton(props: RibbonButtonProps) {- return (- <button- type="button"- aria-label={props.label}- title={props.label}- class={cn(- 'flex flex-col items-center justify-center size-7 hover:bg-hover hover-transition-bg rounded-md',- {- 'bg-active': props.active,- }- )}- onPointerDown={(event) => {- event.preventDefault();- }}- onClick={() => {- props.onClick();- }}- >- {props.children}- </button>- );-}diff --git a/js/app/packages/channel/Input/index.ts b/js/app/packages/channel/Input/index.tsindex 9fb9c19494..bf2d369b1a 100644--- a/js/app/packages/channel/Input/index.ts+++ b/js/app/packages/channel/Input/index.ts@@ -26,7 +26,6 @@ export {attachmentEntityType,buildPostMessageRequest,} from './message-payload';-export { RibbonButton } from './RibbonButton';export { Root } from './Root';export { SendAction } from './SendAction';export { ThreadInput } from './ThreadInput';