diff --git a/src/plugins/frontmatter/index.ts b/src/plugins/frontmatter/index.ts index 27942ef..1ad2319 100644 --- a/src/plugins/frontmatter/index.ts +++ b/src/plugins/frontmatter/index.ts @@ -125,7 +125,10 @@ export const frontmatterPlugin = realmPlugin({ setTimeout(() => { editor.update( () => { - $getRoot().splice(0, 0, [$createFrontmatterNode(yaml)]) + const firstItem = $getRoot().getFirstChild() + if (!$isFrontmatterNode(firstItem)) { + $getRoot().splice(0, 0, [$createFrontmatterNode(yaml)]) + } }, { discrete: true } )