feat: add preview themes.

This commit is contained in:
jaywcjlove
2022-09-03 01:11:22 +08:00
parent d007e11f20
commit 0580011f7b
11 changed files with 858 additions and 251 deletions

View File

@@ -4,7 +4,7 @@ import { EditorView } from '@codemirror/view';
import styled from 'styled-components';
import { Preview } from './Preview';
import { copy } from './copy';
import { theme as themeCommand } from './theme';
import { theme as themeCommand, previeTheme } from './theme';
import { Context, themes } from '../../store/context';
import data from '../../../README.md';
@@ -15,13 +15,14 @@ const Warpper = styled.div`
export const HomePage = () => {
const commands = [...getCommands(), themeCommand];
const { theme } = useContext(Context);
const value = themes[theme].value;
return (
<Warpper>
<MarkdownEditor
value={data.source}
toolbars={commands}
theme={themes[theme]}
toolbarsMode={[copy, 'preview', 'fullscreen']}
theme={value}
toolbarsMode={[previeTheme, copy, 'preview', 'fullscreen']}
extensions={[EditorView.lineWrapping]}
renderPreview={Preview}
visible={true}