Repository navigation
空代码块占位提示语与块头重叠修复(重修:实查装饰落点) - #331
Merged
todosdev[bot] merged 4 commits intoNov 30, 2026
Merged
Conversation
## 摘要 - 重修 #290:第一轮样式侧修复(.code-block.is-empty)落点判断错误——实测 Placeholder 的节点装饰把 is-empty / data-placeholder 挂在 React 渲染器 外层 wrapper(div.react-renderer.node-codeBlock)上,而非 CodeBlockView 自己的 .code-block(NodeViewWrapper),生产 v342 复现压住块头行。 - 改走扩展侧口径(规格二选一):Placeholder 配置 emptyNodeClass 按节点类型 排除 codeBlock(返回空类名 = 不挂 is-empty),浮动伪元素不再落到块头上。 - 普通空段落(含空文档首段)占位行为零变化;is-editor-empty 仍由扩展按 isEmptyDoc 独立控制,与本次排除互不影响。 ## 测试 - 新增 web/src/editor/placeholder.test.tsx:空代码块 NodeView 不挂 is-empty、 块头仍在;空段落照常挂 is-empty + data-placeholder。 - pnpm --filter web test:104 文件 / 1323 用例全绿(含既有 CodeBlockCollapse、 EditorToolbar、paste、roundtrip 等)。 - pnpm --filter worker test:6 文件 / 23 用例全绿。 - pnpm --filter web typecheck:tsc --noEmit 通过。 - biome check web/src/editor/extensions.ts web/src/editor/placeholder.test.tsx web/src/index.css:无新增告警(现存 16 条 noDescendingSpecificity 均为既有 主题色段落)。
…6-79fe-ba82-4d96ac52c6c7
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.
Summary
.wiki-content .code-block.is-empty::before)落点判断错误——实测is-empty/data-placeholder挂在 Tiptap React 渲染器外层 wrapper(div.react-renderer.node-codeBlock)上,而非CodeBlockView自己的.code-block(NodeViewWrapper),生产 v342 复现占位语压住块头。Placeholder配置emptyNodeClass按节点类型排除codeBlock,空代码块不再挂is-empty,浮动占位伪元素彻底不产生;普通空段落(含空文档首段)占位行为零变化。Changes
web/src/editor/extensions.tsPlaceholder.configure增加emptyNodeClass: ({ node }) => node.type.name === "codeBlock" ? "" : "is-empty",对 codeBlock 返回空类名即不挂is-empty。web/src/index.css.wiki-content .code-block.is-empty::before { display: none }规则(该类组合在实际 DOM 中不存在)。web/src/editor/placeholder.test.tsx(新增)is-empty且块头行仍在;空段落照常挂is-empty+data-placeholder。Testing
pnpm --filter web test:104 文件 / 1323 用例全绿(含既有 CodeBlockCollapse、EditorToolbar、paste、roundtrip 等)。pnpm --filter worker test:6 文件 / 23 用例全绿。pnpm --filter web typecheck:tsc --noEmit通过。biome check(改动文件):无新增告警(16 条noDescendingSpecificity均为既有主题色段落)。createExtensions渲染空代码块,修复前后截图与 DOM outerHTML 证据已留 todos 工单——修复前占位语压住「纯文本」块头,修复后块头清晰、空段落占位仍在。本仓库不跟踪前端构建产物(无 dist/ 需要重建)。