diff --git a/packages/canyon-platform/package.json b/packages/canyon-platform/package.json index 5b3e59d0..6f165dc1 100644 --- a/packages/canyon-platform/package.json +++ b/packages/canyon-platform/package.json @@ -16,7 +16,6 @@ "@apollo/client": "^3.10.8", "@graphql-typed-document-node/core": "^3.2.0", "@monaco-editor/react": "^4.6.0", - "@paralleldrive/cuid2": "^2.2.2", "ahooks": "^3.8.0", "antd": "5.14.1", "axios": "^1.7.2", @@ -27,7 +26,6 @@ "echarts": "^5.5.1", "echarts-for-react": "^3.0.2", "graphql": "^16.9.0", - "highlight.js": "^11.9.0", "i18next": "^23.11.5", "i18next-browser-languagedetector": "^7.2.1", "monaco-themes": "^0.4.4", diff --git a/packages/canyon-platform/src/components/app/CopyCode.tsx b/packages/canyon-platform/src/components/app/CopyCode.tsx index b4140902..8fccf7d5 100755 --- a/packages/canyon-platform/src/components/app/CopyCode.tsx +++ b/packages/canyon-platform/src/components/app/CopyCode.tsx @@ -1,31 +1,36 @@ -import 'highlight.js/styles/atom-one-dark.css'; import './CopyCode.css'; import { CopyOutlined } from '@ant-design/icons'; -import hljs from 'highlight.js'; import { FC, useEffect } from 'react'; // @ts-ignore import { CopyToClipboard } from 'react-copy-to-clipboard'; +import { codeToHtml } from 'shiki'; const CopyCode: FC<{ code: string }> = ({ code }) => { const fileContent = code; + const [content, setContent] = useState(''); + useEffect(() => { if (fileContent) { - hljs.highlightAll(); + codeToHtml(fileContent, { + lang: 'json', + theme: 'tokyo-night', + }).then((r) => { + setContent(r); + }); } }, [fileContent]); return ( -
-
- {fileContent}
-
-
+
+