From ef7e8a72017c1a12fffe058df95f29c04c055de5 Mon Sep 17 00:00:00 2001 From: suyao Date: Wed, 29 Oct 2025 06:35:41 +0800 Subject: [PATCH] Add YAML front matter as atom node without child content - Use explicit 'yamlFrontMatter' node name instead of dynamic this.name reference - Remove child content parsing since atom nodes don't require children - Simplify logging by removing redundant hasContent check --- .../RichEditor/extensions/yaml-front-matter.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/renderer/src/components/RichEditor/extensions/yaml-front-matter.ts b/src/renderer/src/components/RichEditor/extensions/yaml-front-matter.ts index 1628876eff..afbff76898 100644 --- a/src/renderer/src/components/RichEditor/extensions/yaml-front-matter.ts +++ b/src/renderer/src/components/RichEditor/extensions/yaml-front-matter.ts @@ -78,18 +78,17 @@ export const YamlFrontMatter = Node.create({ tokensLength: token.tokens?.length || 0 }) + // Since this is an atom node, we don't need child content const result = { - type: this.name, + type: 'yamlFrontMatter', // Use explicit node name instead of this.name attrs: { content: token.text || '' - }, - content: helpers.parseChildren(token.tokens || []) + } } logger.info('✅ parseMarkdown() result', { type: result.type, - contentLength: result.attrs.content.length, - hasContent: !!result.content + contentLength: result.attrs.content.length }) return result