|
|
|
@ -11,17 +11,17 @@ import useMergedState from 'rc-util/lib/hooks/useMergedState';
|
|
|
|
|
import omit from 'rc-util/lib/omit';
|
|
|
|
|
import { composeRef } from 'rc-util/lib/ref';
|
|
|
|
|
import * as React from 'react';
|
|
|
|
|
import { isStyleSupport } from '../../_util/styleChecker';
|
|
|
|
|
import TransButton from '../../_util/transButton';
|
|
|
|
|
import { ConfigContext } from '../../config-provider';
|
|
|
|
|
import useLocale from '../../locale/useLocale';
|
|
|
|
|
import type { TooltipProps } from '../../tooltip';
|
|
|
|
|
import Tooltip from '../../tooltip';
|
|
|
|
|
import { isStyleSupport } from '../../_util/styleChecker';
|
|
|
|
|
import TransButton from '../../_util/transButton';
|
|
|
|
|
import Editable from '../Editable';
|
|
|
|
|
import useMergedConfig from '../hooks/useMergedConfig';
|
|
|
|
|
import useUpdatedEffect from '../hooks/useUpdatedEffect';
|
|
|
|
|
import type { TypographyProps } from '../Typography';
|
|
|
|
|
import Typography from '../Typography';
|
|
|
|
|
import useMergedConfig from '../hooks/useMergedConfig';
|
|
|
|
|
import useUpdatedEffect from '../hooks/useUpdatedEffect';
|
|
|
|
|
import Ellipsis from './Ellipsis';
|
|
|
|
|
import EllipsisTooltip from './EllipsisTooltip';
|
|
|
|
|
|
|
|
|
@ -193,7 +193,7 @@ const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => {
|
|
|
|
|
// ========================== Copyable ==========================
|
|
|
|
|
const [enableCopy, copyConfig] = useMergedConfig<CopyConfig>(copyable);
|
|
|
|
|
const [copied, setCopied] = React.useState(false);
|
|
|
|
|
const copyIdRef = React.useRef<number>();
|
|
|
|
|
const copyIdRef = React.useRef<NodeJS.Timeout | null>(null);
|
|
|
|
|
|
|
|
|
|
const copyOptions: Pick<CopyConfig, 'format'> = {};
|
|
|
|
|
if (copyConfig.format) {
|
|
|
|
@ -201,7 +201,9 @@ const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const cleanCopyId = () => {
|
|
|
|
|
window.clearTimeout(copyIdRef.current!);
|
|
|
|
|
if (copyIdRef.current) {
|
|
|
|
|
clearTimeout(copyIdRef.current);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const onCopyClick = (e?: React.MouseEvent<HTMLDivElement>) => {
|
|
|
|
@ -214,7 +216,7 @@ const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => {
|
|
|
|
|
|
|
|
|
|
// Trigger tips update
|
|
|
|
|
cleanCopyId();
|
|
|
|
|
copyIdRef.current = window.setTimeout(() => {
|
|
|
|
|
copyIdRef.current = setTimeout(() => {
|
|
|
|
|
setCopied(false);
|
|
|
|
|
}, 3000);
|
|
|
|
|
|
|
|
|
|