1- import { FC , PropsWithChildren , useState } from 'react' ;
1+ import { FC , PropsWithChildren , useContext , useState } from 'react' ;
22import { Link } from 'react-router-dom' ;
33import CodeMirror , { ReactCodeMirrorProps } from '@uiw/react-codemirror' ;
44import * as themes from '@uiw/codemirror-themes-all' ;
55import { langs } from '@uiw/codemirror-extensions-langs' ;
66import styled from 'styled-components' ;
7- import { Preview } from '../../theme/Preview' ;
7+ import { Preview , MdContext } from '../../theme/Preview' ;
88import { useTheme } from '../../../utils/useTheme' ;
99import { PageWarpper } from '..' ;
1010
1111const ToolsWapper = styled . div `
1212 padding: 0 0 23px 0;
1313` ;
1414
15- export const ThemesAllExample : FC < PropsWithChildren < { source ?: string } > > = ( { source } ) => {
15+ export const ThemesAllExample : FC < PropsWithChildren > = ( ) => {
1616 const themesData : Record < string , Omit < ReactCodeMirrorProps [ 'theme' ] , 'dark' | 'light' > > = { } ;
1717 Object . keys ( themes )
1818 . filter ( ( item ) => typeof themes [ item as keyof typeof themes ] !== 'function' )
@@ -26,10 +26,11 @@ export const ThemesAllExample: FC<PropsWithChildren<{ source?: string }>> = ({ s
2626 const changeHandle = ( ev : React . ChangeEvent < HTMLSelectElement > ) => {
2727 setSelectTheme ( ev . target . value as keyof typeof themesData ) ;
2828 } ;
29+ const mdData = useContext ( MdContext ) ;
2930 return (
3031 < PageWarpper >
3132 < CodeMirror
32- value = { source }
33+ value = { mdData . mdstr }
3334 theme = { themeCurrent as ReactCodeMirrorProps [ 'theme' ] }
3435 height = "300px !important"
3536 style = { { margin : '0 0 23px 0' } }
0 commit comments