mirror of https://github.com/msgbyte/tailchat
feat(admin): add MarkdownEditor
parent
3ad1e4410c
commit
ca95a0dac7
@ -0,0 +1,22 @@
|
||||
import React from 'react';
|
||||
import { Editor } from '@bytemd/react';
|
||||
import { plugins } from './plugins';
|
||||
import 'bytemd/dist/index.css';
|
||||
import './style.less';
|
||||
|
||||
interface MarkdownEditorProps {
|
||||
value: string;
|
||||
onChange: (val: string) => void;
|
||||
}
|
||||
export const MarkdownEditor: React.FC<MarkdownEditorProps> = React.memo(
|
||||
(props) => {
|
||||
return (
|
||||
<Editor
|
||||
plugins={plugins}
|
||||
value={props.value ?? ''}
|
||||
onChange={props.onChange}
|
||||
/>
|
||||
);
|
||||
}
|
||||
);
|
||||
MarkdownEditor.displayName = 'MarkdownEditor';
|
@ -0,0 +1,5 @@
|
||||
import loadable from '@loadable/component';
|
||||
|
||||
export const MarkdownEditor = loadable(() =>
|
||||
import('./editor').then((module) => module.MarkdownEditor)
|
||||
);
|
@ -0,0 +1,6 @@
|
||||
import gfm from '@bytemd/plugin-gfm';
|
||||
|
||||
export const plugins = [
|
||||
gfm(),
|
||||
// Add more plugins here
|
||||
];
|
@ -0,0 +1,8 @@
|
||||
.bytemd .bytemd-toolbar-right [bytemd-tippy-path='5'] {
|
||||
// Hidden github icon
|
||||
display: none;
|
||||
}
|
||||
|
||||
.bytemd-fullscreen.bytemd {
|
||||
z-index: 99;
|
||||
}
|
Loading…
Reference in New Issue