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(md): autofocus empty title editor after connect root (#2557)
Seamusd1a62f9303cd
diff --git a/js/app/packages/block-md/component/TitleEditor.tsx b/js/app/packages/block-md/component/TitleEditor.tsxindex d3853cbd29..7cd1cecd2a 100644--- a/js/app/packages/block-md/component/TitleEditor.tsx+++ b/js/app/packages/block-md/component/TitleEditor.tsx@@ -202,9 +202,12 @@ export function TitleEditor(props: { autoFocusOnMount?: boolean } = {}) {trimWhitespace(editor, { trailing: true });}+ const [rootConnected, setRootConnected] = createSignal(false);+const onConnect = (el: HTMLDivElement) => {editor.setRootElement(el);el.addEventListener('blur', onBlur);+ setRootConnected(true);onCleanup(() => {cleanup();el.removeEventListener('blur', onBlur);@@ -258,18 +261,9 @@ export function TitleEditor(props: { autoFocusOnMount?: boolean } = {}) {));- // Autofocus the title if it is empty.- createEffect(() => {- if (dataReady()) {- if (untrack(mdDocumentName) === '') {- editor.focus();- }- }- });-- // Auto-focus on mount if enabled and title is empty.+ // Autofocus the title if it is empty and we didn't navigate here via J/K.createEffect(() => {- if (props.autoFocusOnMount && dataReady()) {+ if (props.autoFocusOnMount && rootConnected() && dataReady()) {if (untrack(mdDocumentName) === '') {editor.focus();}