diff --git a/web/app/routes/_layout/_pages/_protected/pages/$pageId/index.tsx b/web/app/routes/_layout/_pages/_protected/pages/$pageId/index.tsx index bb2d45fa..f097df78 100644 --- a/web/app/routes/_layout/_pages/_protected/pages/$pageId/index.tsx +++ b/web/app/routes/_layout/_pages/_protected/pages/$pageId/index.tsx @@ -224,8 +224,14 @@ const DetailPageForm = React.memo(({ page }: { page: PersonalPage }) => { handleKeyDown: handleTitleKeyDown, }, onCreate: ({ editor }) => { - if (page.title) editor.commands.setContent(`

${page.title}

`) + if (page.title) { + editor.commands.setContent(`

${page.title}

`) + } titleEditorRef.current = editor + + if (!page.title) { + editor.commands.focus() + } }, onBlur: ({ editor }) => handleUpdateTitle(editor), onUpdate: ({ editor }) => handleUpdateTitle(editor), @@ -237,8 +243,12 @@ const DetailPageForm = React.memo(({ page }: { page: PersonalPage }) => { editor.commands.setContent(page.content as Content) } contentEditorRef.current = editor + + if (page.title) { + editor.commands.focus() + } }, - [page.content], + [page.content, page.title], ) return (