From 77950e48c76f4a3b29d01831d43039caba29888a Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期二, 18 十一月 2025 14:12:42 +0800
Subject: [PATCH] 修改
---
app/components/datasets/formatted-text/flavours/shared.tsx | 38 +++++++++-----------------------------
1 files changed, 9 insertions(+), 29 deletions(-)
diff --git a/app/components/datasets/formatted-text/flavours/shared.tsx b/app/components/datasets/formatted-text/flavours/shared.tsx
index 1154857..577e3ce 100644
--- a/app/components/datasets/formatted-text/flavours/shared.tsx
+++ b/app/components/datasets/formatted-text/flavours/shared.tsx
@@ -1,32 +1,22 @@
-import type { ComponentProps, FC } from 'react'
+import { type ComponentProps, type FC, forwardRef } from 'react'
import classNames from '@/utils/classnames'
const baseStyle = 'py-[3px]'
export type SliceContainerProps = ComponentProps<'span'>
-export const SliceContainer: FC<SliceContainerProps> = (
- {
- ref,
- ...props
- },
-) => {
+export const SliceContainer: FC<SliceContainerProps> = forwardRef((props, ref) => {
const { className, ...rest } = props
return <span {...rest} ref={ref} className={classNames(
'group align-bottom mr-1 select-none text-sm',
className,
)} />
-}
+})
SliceContainer.displayName = 'SliceContainer'
export type SliceLabelProps = ComponentProps<'span'> & { labelInnerClassName?: string }
-export const SliceLabel: FC<SliceLabelProps> = (
- {
- ref,
- ...props
- },
-) => {
+export const SliceLabel: FC<SliceLabelProps> = forwardRef((props, ref) => {
const { className, children, labelInnerClassName, ...rest } = props
return <span {...rest} ref={ref} className={classNames(
baseStyle,
@@ -37,17 +27,12 @@
{children}
</span>
</span>
-}
+})
SliceLabel.displayName = 'SliceLabel'
export type SliceContentProps = ComponentProps<'span'>
-export const SliceContent: FC<SliceContentProps> = (
- {
- ref,
- ...props
- },
-) => {
+export const SliceContent: FC<SliceContentProps> = forwardRef((props, ref) => {
const { className, children, ...rest } = props
return <span {...rest} ref={ref} className={classNames(
baseStyle,
@@ -56,17 +41,12 @@
)}>
{children}
</span>
-}
+})
SliceContent.displayName = 'SliceContent'
export type SliceDividerProps = ComponentProps<'span'>
-export const SliceDivider: FC<SliceDividerProps> = (
- {
- ref,
- ...props
- },
-) => {
+export const SliceDivider: FC<SliceDividerProps> = forwardRef((props, ref) => {
const { className, ...rest } = props
return <span {...rest} ref={ref} className={classNames(
baseStyle,
@@ -76,5 +56,5 @@
{/* use a zero-width space to make the hover area bigger */}
​
</span>
-}
+})
SliceDivider.displayName = 'SliceDivider'
--
Gitblit v1.8.0