|
|
|
@ -137,21 +137,20 @@ const CodeBlock: any = memo(({ inline, className, children = '', ...props }: any
|
|
|
|
const echartsStyle = useMemo(() => ({
|
|
|
|
const echartsStyle = useMemo(() => ({
|
|
|
|
height: '350px',
|
|
|
|
height: '350px',
|
|
|
|
width: '100%',
|
|
|
|
width: '100%',
|
|
|
|
}), []);
|
|
|
|
}), [])
|
|
|
|
|
|
|
|
|
|
|
|
const echartsOpts = useMemo(() => ({
|
|
|
|
const echartsOpts = useMemo(() => ({
|
|
|
|
renderer: 'canvas',
|
|
|
|
renderer: 'canvas',
|
|
|
|
width: 'auto',
|
|
|
|
width: 'auto',
|
|
|
|
}) as any, []);
|
|
|
|
}) as any, [])
|
|
|
|
|
|
|
|
|
|
|
|
const echartsOnEvents = useMemo(() => ({
|
|
|
|
const echartsOnEvents = useMemo(() => ({
|
|
|
|
finished: () => {
|
|
|
|
finished: () => {
|
|
|
|
const instance = echartsRef.current?.getEchartsInstance?.();
|
|
|
|
const instance = echartsRef.current?.getEchartsInstance?.()
|
|
|
|
if (instance) {
|
|
|
|
if (instance)
|
|
|
|
instance.resize();
|
|
|
|
instance.resize()
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}), [echartsRef]); // echartsRef is stable, so this effectively runs once.
|
|
|
|
}), [echartsRef]) // echartsRef is stable, so this effectively runs once.
|
|
|
|
|
|
|
|
|
|
|
|
// Handle container resize for echarts
|
|
|
|
// Handle container resize for echarts
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
@ -423,7 +422,7 @@ const CodeBlock: any = memo(({ inline, className, children = '', ...props }: any
|
|
|
|
</SyntaxHighlighter>
|
|
|
|
</SyntaxHighlighter>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, [children, language, isSVG, finalChartOption, props, theme, match, chartState, isDarkMode, echartsStyle, echartsOpts, echartsOnEvents]);
|
|
|
|
}, [children, language, isSVG, finalChartOption, props, theme, match, chartState, isDarkMode, echartsStyle, echartsOpts, echartsOnEvents])
|
|
|
|
|
|
|
|
|
|
|
|
if (inline || !match)
|
|
|
|
if (inline || !match)
|
|
|
|
return <code {...props} className={className}>{children}</code>
|
|
|
|
return <code {...props} className={className}>{children}</code>
|
|
|
|
|