mirror of
https://github.com/jaywcjlove/wxmp.git
synced 2026-01-12 08:18:49 +08:00
feat: add editor theme switch.
This commit is contained in:
@@ -1,26 +1,31 @@
|
||||
import MarkdownEditor, { getCommands } from '@uiw/react-markdown-editor';
|
||||
import { useContext } from 'react';
|
||||
import { EditorView } from "@codemirror/view";
|
||||
import styled from 'styled-components';
|
||||
import data from '../../../README.md';
|
||||
import { Preview } from './Preview';
|
||||
import { copy } from './copy'
|
||||
import { copy } from './copy';
|
||||
import { theme as themeCommand } from './theme';
|
||||
import { Context, themes } from '../../store/context';
|
||||
import data from '../../../README.md';
|
||||
|
||||
const Warpper = styled.div`
|
||||
height: calc(100vh - 2.9rem);
|
||||
height: calc(100vh - 2.8rem);
|
||||
`;
|
||||
|
||||
export const HomePage = () => {
|
||||
const commands = getCommands();
|
||||
const commands = [...getCommands(), themeCommand];
|
||||
const { theme } = useContext(Context);
|
||||
return (
|
||||
<Warpper>
|
||||
<MarkdownEditor
|
||||
value={data.source}
|
||||
toolbars={commands}
|
||||
theme={themes[theme]}
|
||||
toolbarsMode={[copy, 'preview', 'fullscreen']}
|
||||
extensions={[EditorView.lineWrapping]}
|
||||
renderPreview={Preview}
|
||||
visible={true}
|
||||
height="calc(100vh - 5.0rem)"
|
||||
height="calc(100vh - 4.9rem)"
|
||||
/>
|
||||
</Warpper>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user