Skip to content

Commit

Permalink
fix: always keep a paragraph below the last decorator
Browse files Browse the repository at this point in the history
Fixes #420
  • Loading branch information
petyosi committed Apr 19, 2024
1 parent 890e545 commit 083f6fd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/plugins/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,15 @@ export const createRootEditorSubscription$ = Appender(rootEditorSubscriptions$,
let theNewMarkdownValue!: string

editorState.read(() => {
const lastChild = $getRoot().getLastChild()
if (lastChild instanceof DecoratorNode) {
rootEditor.update(
() => {
$getRoot().append($createParagraphNode())
},
{ discrete: true }
)
}
theNewMarkdownValue = exportMarkdownFromLexical({
root: $getRoot(),
visitors: r.getValue(exportVisitors$),
Expand Down

0 comments on commit 083f6fd

Please sign in to comment.