mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-31 00:10:22 +08:00
refactor(SvgPreview): use transparent container for SVG (#9294)
* refactor(SvgPreview): use transparent container for SVG * test: fix snapshot
This commit is contained in:
parent
2e2cfc2409
commit
cc8915842a
@ -2,7 +2,7 @@ import { memo, useCallback } from 'react'
|
||||
|
||||
import { useDebouncedRender } from './hooks/useDebouncedRender'
|
||||
import ImagePreviewLayout from './ImagePreviewLayout'
|
||||
import { ShadowWhiteContainer } from './styles'
|
||||
import { ShadowTransparentContainer } from './styles'
|
||||
import { BasicPreviewHandles } from './types'
|
||||
import { renderSvgInShadowHost } from './utils'
|
||||
|
||||
@ -35,7 +35,8 @@ const SvgPreview = ({ children, enableToolbar = false, className, ref }: SvgPrev
|
||||
ref={ref}
|
||||
imageRef={containerRef}
|
||||
source="svg">
|
||||
<ShadowWhiteContainer ref={containerRef} className={className ?? 'svg-preview special-preview'} />
|
||||
{/* 使用透明容器,把背景色完全交给 SVG 自己控制 */}
|
||||
<ShadowTransparentContainer ref={containerRef} className={className ?? 'svg-preview special-preview'} />
|
||||
</ImagePreviewLayout>
|
||||
)
|
||||
}
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
exports[`SvgPreview > basic rendering > should match snapshot 1`] = `
|
||||
.c0 {
|
||||
--shadow-host-background-color: white;
|
||||
--shadow-host-border: 0.5px solid var(--color-code-background);
|
||||
--shadow-host-border-radius: 8px;
|
||||
--shadow-host-background-color: transparent;
|
||||
--shadow-host-border: unset;
|
||||
--shadow-host-border-radius: unset;
|
||||
}
|
||||
|
||||
<div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user