Skip to content

Commit

Permalink
fix: make it easier to enter when last child is a table/image
Browse files Browse the repository at this point in the history
Insert an empty paragraph below.
  • Loading branch information
petyosi committed Sep 29, 2023
1 parent 20420a8 commit 0f51f6f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/importMarkdownToLexical.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ export function importMarkdownToLexical({ root, markdown, visitors, syntaxExtens
mdastRoot.children.push({ type: 'paragraph', children: [] })
}

// leave empty paragraph, so that the user can start typing
if (mdastRoot.children.at(-1)?.type !== 'paragraph') {
mdastRoot.children.push({ type: 'paragraph', children: [] })
}

importMdastTreeToLexical({ root, mdastRoot, visitors })
}

Expand Down

0 comments on commit 0f51f6f

Please sign in to comment.