merge main

This commit is contained in:
zxhlyh
2025-05-09 18:20:56 +08:00
78 changed files with 854 additions and 609 deletions

View File

@ -22,7 +22,7 @@ const MarkdownButton = ({ node }: any) => {
return <Button
variant={variant}
size={size}
className={cn('!h-8 select-none !px-3')}
className={cn('!h-auto min-h-8 select-none whitespace-normal !px-3')}
onClick={() => {
if (is_valid_url(link)) {
window.open(link, '_blank')

View File

@ -128,13 +128,19 @@ const CodeBlock: any = memo(({ inline, className, children = '', ...props }: any
const language = match?.[1]
const languageShowName = getCorrectCapitalizationLanguageName(language || '')
const chartData = useMemo(() => {
const str = String(children).replace(/\n$/, '')
if (language === 'echarts') {
try {
return JSON.parse(String(children).replace(/\n$/, ''))
return JSON.parse(str)
}
catch { }
try {
// eslint-disable-next-line no-new-func, sonarjs/code-eval
return new Function(`return ${str}`)()
}
catch { }
}
return JSON.parse('{"title":{"text":"ECharts error - Wrong JSON format."}}')
return JSON.parse('{"title":{"text":"ECharts error - Wrong option."}}')
}, [language, children])
const renderCodeContent = useMemo(() => {