Skip to content

Commit

Permalink
website: fix preview issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jan 17, 2022
1 parent ed4fe66 commit ff5c429
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions website/src/Markdown/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useEffect, useState } from 'react';
import MarkdownPreview from '@uiw/react-markdown-preview';
import Code from './Code';
import pkg from '@uiw/react-layout/package.json';
import styles from './index.module.less';

export interface CreatePageProps<T> extends React.HTMLAttributes<HTMLDivElement> {
Expand All @@ -23,10 +24,6 @@ const getCodeStr = (data: any[] = [], code: string = '') => {
export default function CreatePage<T>(props: CreatePageProps<T>) {
const { renderPage, dependencies, path, ...other } = props;
const [mdStr, setMdStr] = useState('');

// @ts-ignore
// eslint-disable-next-line
const version = VERSION || '2.0.0';
useEffect(() => {
if (renderPage) {
renderPage()
Expand Down Expand Up @@ -70,8 +67,9 @@ export default function CreatePage<T>(props: CreatePageProps<T>) {
if (Object.keys(config).filter((name) => config[name] !== undefined).length === 0) {
return <code {...props} />;
}
console.log('>>>', getCodeStr(node.children));
return <Code version={version} code={getCodeStr(node.children)} dependencies={dependencies} {...config} />;
return (
<Code version={pkg.version} code={getCodeStr(node.children)} dependencies={dependencies} {...config} />
);
},
}}
/>
Expand Down

0 comments on commit ff5c429

Please sign in to comment.