Refactor:upgrade react19 ref as props (#25225)
Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
This commit is contained in:
parent
27bf244b3b
commit
98204d78fb
8 changed files with 83 additions and 78 deletions
|
|
@ -107,10 +107,13 @@ const initMermaid = () => {
|
|||
return isMermaidInitialized
|
||||
}
|
||||
|
||||
const Flowchart = React.forwardRef((props: {
|
||||
type FlowchartProps = {
|
||||
PrimitiveCode: string
|
||||
theme?: 'light' | 'dark'
|
||||
}, ref) => {
|
||||
ref?: React.Ref<HTMLDivElement>
|
||||
}
|
||||
|
||||
const Flowchart = (props: FlowchartProps) => {
|
||||
const { t } = useTranslation()
|
||||
const [svgString, setSvgString] = useState<string | null>(null)
|
||||
const [look, setLook] = useState<'classic' | 'handDrawn'>('classic')
|
||||
|
|
@ -490,7 +493,7 @@ const Flowchart = React.forwardRef((props: {
|
|||
}
|
||||
|
||||
return (
|
||||
<div ref={ref as React.RefObject<HTMLDivElement>} className={themeClasses.container}>
|
||||
<div ref={props.ref as React.RefObject<HTMLDivElement>} className={themeClasses.container}>
|
||||
<div className={themeClasses.segmented}>
|
||||
<div className="msh-segmented-group">
|
||||
<label className="msh-segmented-item m-2 flex w-[200px] items-center space-x-1">
|
||||
|
|
@ -572,7 +575,7 @@ const Flowchart = React.forwardRef((props: {
|
|||
)}
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
Flowchart.displayName = 'Flowchart'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue