【Auto】fix(MarkdownRender): 修复 GFM 单列表格渲染丢失 cell 内容#3129
Open
SudoUserReal wants to merge 1 commit intomainfrom
Open
【Auto】fix(MarkdownRender): 修复 GFM 单列表格渲染丢失 cell 内容#3129SudoUserReal wants to merge 1 commit intomainfrom
SudoUserReal wants to merge 1 commit intomainfrom
Conversation
This commit was automatically generated by Semi Issue Solver. Closes #3077
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 29dd765:
|
semi-design
|
||||||||||||||||||||||||||||||
| Project |
semi-design
|
| Branch Review |
solve/issue-3077-1770116572723
|
| Run status |
|
| Run duration | 08m 26s |
| Commit |
|
| Committer | SudoUser |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
1
|
|
|
0
|
|
|
13
|
|
|
0
|
|
|
290
|
Upgrade your plan to view test results. | |
| View all changes introduced in this branch ↗︎ | |
Tests for review
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.
关联 Issue: #3077
问题概述
MarkdownRender在渲染remark-gfm生成的表格时,当表格只有 1 列(tr.props.children为单个 ReactElement 而非数组)会导致行内单元格无法被遍历写入,最终表现为表格 cell 内容丢失。解决方案说明
在表格渲染逻辑中统一使用
React.Children.toArray归一化children,避免对forEach/map的数组假设,从而兼容单列/多列以及不同 children 结构的表格节点。主要变更点
tr.props.children非数组导致 cell 不写入的问题packages/semi-ui/markdownRender/components/table.tsxpackages/semi-ui/markdownRender/__test__/markdown.test.js测试说明
packages/semi-ui/markdownRender/__test__/markdown.test.js(新增单列表格用例,覆盖 “| 标题 | ... | 内容 |” 场景)