mirror of
https://github.com/EthanMarti/infio-copilot.git
synced 2026-05-08 16:10:09 +00:00
update release logs
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import mermaid from "mermaid"
|
||||
import { useEffect, useRef, useState } from "react"
|
||||
import { memo, useEffect, useRef, useState } from "react"
|
||||
import styled from "styled-components"
|
||||
|
||||
import { PREVIEW_VIEW_TYPE } from "../../../constants"
|
||||
@@ -76,7 +76,7 @@ interface MermaidBlockProps {
|
||||
code: string
|
||||
}
|
||||
|
||||
export default function MermaidBlock({ code }: MermaidBlockProps) {
|
||||
function MermaidBlock({ code }: MermaidBlockProps) {
|
||||
const containerRef = useRef<HTMLDivElement>(null)
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
@@ -206,7 +206,8 @@ export default function MermaidBlock({ code }: MermaidBlockProps) {
|
||||
|
||||
if (existingLeaf) {
|
||||
// 如果已存在,关闭现有的然后重新创建以更新内容
|
||||
existingLeaf.detach()
|
||||
// existingLeaf.detach()
|
||||
return
|
||||
}
|
||||
|
||||
// 创建新的预览 tab
|
||||
@@ -391,3 +392,5 @@ const SvgContainer = styled.div<SvgContainerProps>`
|
||||
z-index: 10;
|
||||
}
|
||||
`
|
||||
|
||||
export const MemoizedMermaidBlock = memo(MermaidBlock)
|
||||
@@ -5,7 +5,7 @@ import remarkGfm from 'remark-gfm'
|
||||
|
||||
import { useDarkModeContext } from '../../../contexts/DarkModeContext'
|
||||
|
||||
import MermaidBlock from './MermaidBlock'
|
||||
import { MemoizedMermaidBlock } from './MermaidBlock'
|
||||
import { MemoizedSyntaxHighlighterWrapper } from './SyntaxHighlighterWrapper'
|
||||
|
||||
interface RawMarkdownBlockProps {
|
||||
@@ -34,7 +34,7 @@ export default function RawMarkdownBlock({
|
||||
if (!isInline && language === 'mermaid') {
|
||||
const codeText = String(children || "")
|
||||
return (
|
||||
<MermaidBlock
|
||||
<MemoizedMermaidBlock
|
||||
code={codeText}
|
||||
/>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user