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 May 5, 2024
1 parent c6c728a commit 6e1d6aa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions www/src/pages/IconDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ export const IconDetailPage = () => {
const copySVGHTML = (evn: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
evn.stopPropagation();
evn.preventDefault();
if (window.isSecureContext) {
// @ts-ignore
navigator.clipboard.writeText(svgString!)
}
copyTextToClipboard(svgString!, () => {
toast.success(<div>Copied '<b>{filename}</b>' icon HTML code to clipboard</div>, { position: 'top-right' });
});
Expand Down

0 comments on commit 6e1d6aa

Please sign in to comment.