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): stop escape from bubbling from close mentions menu (#2757)
Seamus8e3c8fceb263
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-search-bar.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-search-bar.tsxindex 7053e2d914..455f46b80f 100644--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-search-bar.tsx+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-search-bar.tsx@@ -86,7 +86,7 @@ export const SoupSearchbar = (props: SoupSearchbarProps) => {// Sync search text + mention filters only when the mention menu is closed.// This avoids cascading reactive updates during mention insertion and// prevents search from firing while typing @partial.- const menuIsOpen = () => editor.controls.isMentionMenuOpen();+ const menuIsOpen = () => editor.controls.isInlineMenuOpen();createEffect(() => setSearchPaused(menuIsOpen()));diff --git a/js/app/packages/channel/Input/ChannelInput.tsx b/js/app/packages/channel/Input/ChannelInput.tsxindex 33985c414f..1543b54176 100644--- a/js/app/packages/channel/Input/ChannelInput.tsx+++ b/js/app/packages/channel/Input/ChannelInput.tsx@@ -32,6 +32,7 @@ import {} from 'solid-js';import { isReplyInput } from './types';import type { IUser } from '@core/user/types';+import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';export type ChannelInputProps = InputCallbacks & {input: InputData;@@ -164,6 +165,19 @@ export function ChannelInput(props: ChannelInputProps) {},});+ const [attach, scopeId] = useHotkeyDOMScope('channel-input-intercept');+ registerHotkey({+ scopeId,+ description: 'block escape from moving up scope',+ hotkey: ['escape'],+ runWithInputFocused: true,+ hide: true,+ keyDownHandler: () => {+ // Block upstream escape handlers when ESC should close inline menus.+ return markdownEditor.controls.isInlineMenuOpen();+ },+ });+return (<Input.Root input={inputState.view()} commands={inputState.commands}><Input.DropZone@@ -199,6 +213,7 @@ export function ChannelInput(props: ChannelInputProps) {initialValue={inputState.view().value}autofocus={!isMobile() && (props.autofocus ?? true)}class="text-sm"+ refFn={attach}/></Input.Editor></Input.EditorShell>diff --git a/js/app/packages/core/component/LexicalMarkdown/builder/MarkdownShell.tsx b/js/app/packages/core/component/LexicalMarkdown/builder/MarkdownShell.tsxindex 100c68650b..cbd4bde311 100644--- a/js/app/packages/core/component/LexicalMarkdown/builder/MarkdownShell.tsx+++ b/js/app/packages/core/component/LexicalMarkdown/builder/MarkdownShell.tsx@@ -202,6 +202,7 @@ export const MarkdownShell: Component<editor.setRootElement(el);onConnect();});+ props.refFn?.(el);}}contentEditable={!props.disabled}/>diff --git a/js/app/packages/core/component/LexicalMarkdown/builder/buildHandleFromConfig.ts b/js/app/packages/core/component/LexicalMarkdown/builder/buildHandleFromConfig.tsindex 296b5953b9..756900ee55 100644--- a/js/app/packages/core/component/LexicalMarkdown/builder/buildHandleFromConfig.ts+++ b/js/app/packages/core/component/LexicalMarkdown/builder/buildHandleFromConfig.ts@@ -265,7 +265,12 @@ export function buildHandleFromConfig(config: EditorConfig): EditorHandle {setState: (state: SerializedEditorState) =>initializeEditorWithState(editor, state),getLexical: () => editor,- isMentionMenuOpen: () => mentionsMenuOps?.isOpen() ?? false,+ isInlineMenuOpen: () => {+ const mentions = mentionsMenuOps?.isOpen() ?? false;+ const emojis = emojisMenuOps?.isOpen() ?? false;+ const actions = actionsMenuOps?.isOpen() ?? false;+ return mentions || emojis || actions;+ },};return {diff --git a/js/app/packages/core/component/LexicalMarkdown/builder/types.ts b/js/app/packages/core/component/LexicalMarkdown/builder/types.tsindex 3631ee14eb..7e473d3805 100644--- a/js/app/packages/core/component/LexicalMarkdown/builder/types.ts+++ b/js/app/packages/core/component/LexicalMarkdown/builder/types.ts@@ -95,7 +95,8 @@ export interface EditorControls {getState: () => SerializedEditorState;setState: (state: SerializedEditorState) => void;getLexical: () => LexicalEditor;- isMentionMenuOpen: () => boolean;+ /** Signal that is true when either the MentionsMenu, EmojiMenu, or ActionMenu is open in this Editor. */+ isInlineMenuOpen: () => boolean;}/**@@ -111,6 +112,7 @@ export interface EditorComponentProps {autofocus?: boolean;class?: string;portalScope?: PortalScope;+ refFn?: (ref: HTMLDivElement) => void;}export interface EditorConfig {