ant-design / pro-editor

🕹️ The Ultimate Editor UI Framework and Components

Home Page:https://pro-editor.antdigital.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] 在prochat自定义contentRender里使用pro-editor的Markdown组件会报错

XUHANLIN opened this issue · comments

💻 系统环境 | Operating System

macOS

🌐 浏览器 | Browser

Chrome

🐛 问题描述 | Bug Description

在prochat中自定义contentRender,代码如下:
image

自定义的contentRender中对message简单做了特殊字符处理,然后用pro-editor的MarkDown组件渲染
image

message中包含代码段的情况下,Markdown/CodeBlock.tsx中这行代码会报错
image

看了下Markdown接收到的内容不知道为啥会从String变成element,导致countLines中的str.match()无法调用
image

但很费解的是翻了下prochat源码也是这样用pro-editor的Markdown的,为啥不会有问题呀!!

🚦 期望结果 | Expected Behavior

No response

📷 复现步骤 | Recurrence Steps

No response

📝 补充信息 | Additional Information

No response

破案了,因为引入了rehypeHighlight导致先trans了一下
image