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/lexical): fix input focus causing scroll instability (#2687)
teo5ad2cd2a62d2
diff --git a/js/app/packages/core/component/LexicalMarkdown/builder/MarkdownShell.tsx b/js/app/packages/core/component/LexicalMarkdown/builder/MarkdownShell.tsxindex b51154ef5e..b197cb0d24 100644--- a/js/app/packages/core/component/LexicalMarkdown/builder/MarkdownShell.tsx+++ b/js/app/packages/core/component/LexicalMarkdown/builder/MarkdownShell.tsx@@ -26,6 +26,7 @@ import {} from '../utils/fileUploadUtils';import {editorIsEmpty,+ focusEditorWithoutScroll,initializeEditorEmpty,initializeEditorWithState,setEditorStateFromMarkdown,@@ -60,7 +61,9 @@ export const MarkdownShell: Component<const onConnect = () => {if (props.autofocus) {- setTimeout(() => editor.focus());+ setTimeout(() => {+ focusEditorWithoutScroll(editor);+ });}if (props.initialState) {diff --git a/js/app/packages/core/component/LexicalMarkdown/utils.ts b/js/app/packages/core/component/LexicalMarkdown/utils.tsindex c4242cf179..19be3d383b 100644--- a/js/app/packages/core/component/LexicalMarkdown/utils.ts+++ b/js/app/packages/core/component/LexicalMarkdown/utils.ts@@ -1,4 +1,5 @@import { ENABLE_MARKDOWN_SEARCH_TEXT } from '@core/constant/featureFlags';+import { SKIP_SCROLL_INTO_VIEW_TAG } from '@lexical-core/constants';import { $isCodeNode } from '@lexical/code';import { $generateNodesFromDOM } from '@lexical/html';import {@@ -1320,3 +1321,18 @@ export function pendingEditorState(});});}++/**+ * Calls `editor.focus()` on the editor instance with `SKIP_SCROLL_INTO_VIEW_TAG`+ * to prevent focus scrolling+ */+export function focusEditorWithoutScroll(editor: LexicalEditor): void {+ editor.update(+ () => {+ editor.focus();+ },+ {+ tag: SKIP_SCROLL_INTO_VIEW_TAG,+ }+ );+}