Repository navigation
编辑器代码块合并与块内粘贴修复(实现 + 编辑器级测试) - #328
Merged
todosdev[bot] merged 3 commits intoNov 29, 2026
Merged
Conversation
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.
摘要
变更
web/src/editor/extensions.ts:覆盖WikiCodeBlock的toggleCodeBlock命令,新增合并/拆回辅助逻辑——选区覆盖 ≥2 个同级块时合并为单个 codeBlock(各块纯文本\n连接、行内标记剥除、语言/折叠取默认);代码块再点一次按行拆回段落;列表/引用容器下沉到内部块取行;列表项选区整表提出为「剩余列表 + 代码块 + 剩余列表」;文末空占位段落只从文本/替换范围剔除、不参与块数判定;单块选区回退原生开关。web/src/editor/paste/paste-plugin.ts:在图片文件分支之后、text/html分支之前加「光标在 codeBlock 内」判断,取text/plain以文本节点插入({ type: "text", text }),换行保留为块内换行,选区非空时先替换选区;非代码块三路粘贴行为不变。web/src/editor/code-block-toggle.test.ts:合并/拆回、嵌套引用与列表、列表部分项、全选标题+列表、全选单标题(不生成空代码块)等回归。web/src/editor/paste/paste-plugin.test.ts:空代码块粘贴、代码块中间粘贴(带/不带选区)、同时带 text/html 与 text/plain 时按纯文本、普通段落粘贴 Confluence 样本与纯文本回归。测试
npx vitest run src/editor→ 22 文件 / 303 测试全过(含 EditorToolbar、paste/roundtrip、CodeBlockCollapse、block-insert、colors、table 等既有用例)。npx tsc --noEmit无类型错误;npx biome check无告警(仅 CLI 与配置 schema 版本信息提示)。fflate、build-info.json等模块缺失导致的文件加载失败),测试体 0 失败。