mirror of
https://github.com/linsa-io/linsa.git
synced 2026-02-23 10:54:55 +01:00
chore: editor focus between title and content
This commit is contained in:
@@ -224,8 +224,14 @@ const DetailPageForm = React.memo(({ page }: { page: PersonalPage }) => {
|
||||
handleKeyDown: handleTitleKeyDown,
|
||||
},
|
||||
onCreate: ({ editor }) => {
|
||||
if (page.title) editor.commands.setContent(`<p>${page.title}</p>`)
|
||||
if (page.title) {
|
||||
editor.commands.setContent(`<p>${page.title}</p>`)
|
||||
}
|
||||
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 (
|
||||
|
||||
Reference in New Issue
Block a user