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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加在这里应该会影响 live demo 的编辑态,尾部新增空行会没有反应,在 antd 官网调用 SourceCode 的地方 trim 一下?类似这样:
dumi/src/client/theme-default/slots/PreviewerActions/index.tsx
Line 244 in 14620d9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我看
antd
也没怎么用<SourceCode />
,antd
使用的<LiveCode />
实际上是用的是dumi
的SourceCodeEditor
这里是antd的代码我看直接使用markdown 写法,也会出问题。
https://ant.design/docs/react/introduce-cn#%E7%A4%BA%E4%BE%8B 对应antd源码地址 本质上还是调用SourceCode
我的解决思路是:
我在
SourceCode
中 判断是否有textarea
属性如果有表示的是可以编辑的LiveCode
那么不应该trim, 否则应该trim
?dumi/src/client/theme-default/slots/SourceCodeEditor/index.tsx
Line 54 in 19ebd41
下面这里表示的是可以编辑的代码
dumi/src/client/theme-default/builtins/SourceCode/index.tsx
Line 109 in 19ebd41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是这里改坏的 ant-design/ant-design#47347 ,看上去这个修复是对的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
合理的,那就按这个思路👍