diff --git a/package.json b/package.json index 44da4515..a6562b9f 100644 --- a/package.json +++ b/package.json @@ -34,8 +34,7 @@ }, "dependencies": { "@types/prismjs": "~1.26.0", - "prismjs": "~1.29.0", - "prop-types": "~15.8.1" + "prismjs": "~1.29.0" }, "devDependencies": { "@types/react": "^18.0.14", diff --git a/src/index.tsx b/src/index.tsx index 78f2c0d8..b644746f 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,5 +1,4 @@ import React, { useEffect } from 'react'; -import PropTypes from 'prop-types'; import Prism from 'prismjs'; import './style/index.less'; @@ -13,7 +12,7 @@ export interface ReactPrismjsProps { export default function ReactPrismjs(props: ReactPrismjsProps = {}) { const codeRef = React.createRef(); - const { prefixCls, className, language, source, children, ...others } = props; + const { prefixCls = 'w-prismjs', className, language, source, children, ...others } = props; const langCls = language ? `language-${language}` : ''; async function highlight() { if (codeRef.current) { @@ -32,14 +31,3 @@ export default function ReactPrismjs(props: ReactPrismjsProps = {}) { ); } - -ReactPrismjs.defaultProps = { - prefixCls: 'w-prismjs', - code: '', -}; - -ReactPrismjs.propTypes = { - prefixCls: PropTypes.string, - language: PropTypes.string, - code: PropTypes.string, -};