fix: fix the row auto selected when copy id

Fix theselected state of the row changed when the id in the row is copied,  check the click event target, if the target is the copy button, then stop propagation.

Change-Id: I3bc2cd0802d2f7dd08a34c9628d282c9c1a09dd4
This commit is contained in:
zhangjingwei 2022-10-17 16:24:56 +08:00
parent b24698f3e2
commit a17edb45fd

View File

@ -169,10 +169,22 @@ export const getIdRender = (value, copyable = true, isLink = true) => {
if (!copyable) {
return shortRender;
}
const onClick = (e) => {
if (e) {
const { nodeName = '', className = '' } = e.target || {};
const isCopyClick =
nodeName === 'svg' ||
(isString(className) && className.includes('copy'));
if (isCopyClick && e.stopPropagation) {
return e.stopPropagation();
}
}
};
return (
<Paragraph
copyable={{ text: value }}
className={classnames('no-wrap', 'no-margin-bottom')}
onClick={onClick}
>
{shortRender}
</Paragraph>