fix(editor): 修复 LaTeX 公式导致刷新后笔记内容丢失#116
Open
liamlycoder wants to merge 1 commit into
Open
Conversation
importService.ts 导出的 tiptapExtensions 与 TiptapEditor 实际使用的扩展集合 不一致:缺少 MathInline / MathBlock / FootnoteReference / FootnoteDefinition / TextAlign。该数组被 tiptapSchemaRepair.repairTiptapJson 复用做脏 JSON 修复。 事故链: 1. 用户在 RTE 插入 LaTeX 公式,编辑器持有的 JSON 含 mathInline/mathBlock 节点 2. onUpdate debounce 后正常保存到数据库 3. 刷新后 parseContent 调 repairTiptapJson 做 round-trip 4. generateHTML(json, tiptapExtensions) 内部 Node.fromJSON 遇到 schema 不识别 的 mathInline/mathBlock 节点,抛 RangeError: Invalid node type 5. catch 兜底返回 EMPTY_DOC,整篇笔记内容被清空 脚注同机制触发同样的"内容消失";TextAlign 不消失但段落对齐会被静默丢失。 修复:把这几个扩展补齐到 importService.ts 的 tiptapExtensions,让这份 schema 与 TiptapEditor.tsx / contentFormat.ts 的扩展集合保持一致。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
importService.ts 导出的 tiptapExtensions 与 TiptapEditor 实际使用的扩展集合 不一致:缺少 MathInline / MathBlock / FootnoteReference / FootnoteDefinition / TextAlign。该数组被 tiptapSchemaRepair.repairTiptapJson 复用做脏 JSON 修复。
事故链:
脚注同机制触发同样的"内容消失";TextAlign 不消失但段落对齐会被静默丢失。
修复:把这几个扩展补齐到 importService.ts 的 tiptapExtensions,让这份 schema 与 TiptapEditor.tsx / contentFormat.ts 的扩展集合保持一致。