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
chg(new-channels): prevent focus on preview (#2420)
teo3c725d75592a
diff --git a/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx b/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsxindex 5ffdecf17a..596d7d5848 100644--- a/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx+++ b/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx@@ -37,6 +37,7 @@ import {} from '@channel/Call';import { ENABLE_CALLS } from '@core/constant/featureFlags';import { SplitHeaderRight } from '@app/component/split-layout/components/SplitHeader';+import { useMaybePreviewPanel } from '@app/component/PreviewPanel';type ChannelTargetMessageParams = {[URL_PARAMS.message]?: string;@@ -100,6 +101,7 @@ function NewTop(props: { channelId: string }) {export function NewChannelBlockAdapter(props: BlockChannelProps) {useBlockEntityCommands();+ const isPreview = !!useMaybePreviewPanel();const notificationSource = useGlobalNotificationSource();const channelId = useBlockId();const blockHandle = blockHandleSignal.get;@@ -153,6 +155,7 @@ export function NewChannelBlockAdapter(props: BlockChannelProps) {<NewChannelchannelId={channelId}onHandleReady={onChannelReady}+ autofocus={!isPreview}{...convertTargetMessage(props)}/></Match>diff --git a/js/app/packages/channel/Channel/Channel.tsx b/js/app/packages/channel/Channel/Channel.tsxindex 07d41a2d1f..6c8c73d05e 100644--- a/js/app/packages/channel/Channel/Channel.tsx+++ b/js/app/packages/channel/Channel/Channel.tsx@@ -80,6 +80,8 @@ export type ChannelProps = {targetMessageReplyId?: string | undefined;lastViewedAt?: DateValue | null;onHandleReady?: (handle: ChannelHandle) => void;+ /** Whether to auto-focus the channel input on mount. Defaults to `!isMobile()`. */+ autofocus?: boolean;};export type ChannelHandle = {@@ -357,6 +359,7 @@ export function Channel(props: ChannelProps) {isHidden={isChannelInputHidden()}><ChannelInput+ autofocus={props.autofocus}input={{mode: 'channel',id: `channel-input-${props.channelId}`,diff --git a/js/app/packages/channel/Input/ChannelInput.tsx b/js/app/packages/channel/Input/ChannelInput.tsxindex 96c29e85b8..868f625aaf 100644--- a/js/app/packages/channel/Input/ChannelInput.tsx+++ b/js/app/packages/channel/Input/ChannelInput.tsx@@ -40,6 +40,8 @@ export type ChannelInputProps = InputCallbacks & {participants?: Accessor<IUser[]>;onReady?: (handle: InputHandle) => void;children?: JSX.Element;+ /** Whether to auto-focus the input on mount. Defaults to `!isMobile()`. */+ autofocus?: boolean;};function DefaultActions(props: { input: InputData }) {@@ -175,7 +177,7 @@ export function ChannelInput(props: ChannelInputProps) {config={markdownEditor}placeholder={inputState.view().placeholder}initialValue={inputState.view().value}- autofocus={!isMobile()}+ autofocus={props.autofocus ?? !isMobile()}class="text-sm"/></Input.Editor>