feat: improved SVG output UX (#8765)
This commit is contained in:
parent
9a4b53a212
commit
3dfbc348e3
4 changed files with 95 additions and 61 deletions
|
|
@ -85,6 +85,19 @@ const Answer: FC<AnswerProps> = ({
|
|||
getContentWidth()
|
||||
}, [responding])
|
||||
|
||||
// Recalculate contentWidth when content changes (e.g., SVG preview/source toggle)
|
||||
useEffect(() => {
|
||||
if (!containerRef.current)
|
||||
return
|
||||
const resizeObserver = new ResizeObserver(() => {
|
||||
getContentWidth()
|
||||
})
|
||||
resizeObserver.observe(containerRef.current)
|
||||
return () => {
|
||||
resizeObserver.disconnect()
|
||||
}
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className='flex mb-2 last:mb-0'>
|
||||
<div className='shrink-0 relative w-10 h-10'>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue