Skip to content

Commit

Permalink
fix: fix copy issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jul 9, 2024
1 parent cc73e1d commit 0769487
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"@icongo/wi": "1.2.0",
"@icongo/wl": "1.2.0",
"@types/react-lazy-load-image-component": "^1.5.2",
"@uiw/copy-to-clipboard": "^1.0.12",
"@uiw/copy-to-clipboard": "^1.0.17",
"@uiw/react-back-to-top": "^1.2.0",
"@uiw/react-github-corners": "^1.5.14",
"@uiw/react-markdown-preview": "^4.0.23",
Expand Down
6 changes: 3 additions & 3 deletions www/src/components/IconCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useNavigate, NavLink } from 'react-router-dom';
import styled from 'styled-components';
import Keywords from 'react-keywords';
import toast from 'react-hot-toast';
import clipboard from 'clipboardy';
import copyTextToClipboard from '@uiw/copy-to-clipboard';
import { BIBxsCopy, BIBxsCloudDownload, BIBxsHomeCircle } from '@icongo/bi';
// @ts-ignore
import { LazyLoadImage } from 'react-lazy-load-image-component';
Expand Down Expand Up @@ -120,15 +120,15 @@ export const Card: React.FC<React.PropsWithRef<IconCardProps>> = (props) => {

const componentName = name.replace(',', '');
const copyName = () => {
clipboard.write(componentName);
copyTextToClipboard(componentName);
toast.success(<div>Copied '<b>{componentName}</b>' name to clipboard</div>, { position: 'top-right' });
$ref.current?.focus()
}
const handleCopy = (evn: React.MouseEvent<HTMLElement, MouseEvent>) => {
evn.stopPropagation();
fetch(path!).then(response => response.text()).then((svgStr) => {
toast.success(<LazyLoadImage height={80} src={path} alt={componentName} />, { position: 'bottom-right' });
clipboard.write(svgStr);
copyTextToClipboard(svgStr);
toast.success(<div>Copied '<b>{componentName}</b>' icon HTML code to clipboard</div>, { position: 'top-right' });
$ref.current?.focus();
}).catch(() => {
Expand Down
6 changes: 3 additions & 3 deletions www/src/pages/IconDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useParams, Link } from 'react-router-dom';
import styled from 'styled-components';
import toast from 'react-hot-toast';
import MarkdownPreview from '@uiw/react-markdown-preview';
import clipboard from 'clipboardy';
import copyTextToClipboard from '@uiw/copy-to-clipboard';
import { FADownload } from '@icongo/fa/lib/FADownload';
import { FACopy } from '@icongo/fa/lib/FACopy';
import { FAHouseChimneyCrack } from '@icongo/fa/lib/FAHouseChimneyCrack';
Expand Down Expand Up @@ -129,7 +129,7 @@ export const IconDetailPage = () => {
const copySVGHTML = (evn: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
evn.stopPropagation();
evn.preventDefault();
clipboard.write(`${svgString}`);
copyTextToClipboard(`${svgString}`);
toast.success(<div>Copied '<b>{filename}</b>' icon HTML code to clipboard</div>, { position: 'top-right' });
return false
}
Expand All @@ -150,7 +150,7 @@ export const IconDetailPage = () => {
const copyComName = (evn: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
evn.stopPropagation();
evn.preventDefault();
clipboard.write(`${comName || ""}`);
copyTextToClipboard(`${comName || ""}`);
toast.success(<div>Copied '<b>{comName}</b>' name to clipboard</div>, { position: 'top-right' });
return false
}
Expand Down

0 comments on commit 0769487

Please sign in to comment.