小改动
This commit is contained in:
@@ -6,9 +6,7 @@ import { baseURL } from '@/utils/request';
|
||||
import { useUserStore } from '@/stores';
|
||||
|
||||
import { Editor } from '@bytemd/react';
|
||||
import gfm from '@bytemd/plugin-gfm'
|
||||
import gemoji from '@bytemd/plugin-gemoji'
|
||||
import highlight from '@bytemd/plugin-highlight';
|
||||
import plugins from './plugins';
|
||||
import 'highlight.js/styles/vs2015.css';
|
||||
import 'bytemd/dist/index.css';
|
||||
import zh from 'bytemd/lib/locales/zh_Hans.json';
|
||||
@@ -20,12 +18,6 @@ interface Props {
|
||||
onChange: (value: string) => void;
|
||||
}
|
||||
|
||||
const plugins = [
|
||||
gfm(),
|
||||
gemoji(),
|
||||
highlight()
|
||||
];
|
||||
|
||||
const EditorMD = ({ value, onChange }: Props) => {
|
||||
const store = useUserStore();
|
||||
const [loading, setLoading] = useState(false)
|
||||
|
||||
@@ -22,7 +22,7 @@ const markers = (): BytemdPlugin => {
|
||||
remark: (processor) => processor.use(remarkFlexibleMarkers),
|
||||
actions: [
|
||||
{
|
||||
title: 'markers',
|
||||
title: '标记',
|
||||
icon: markerSvg,
|
||||
handler: {
|
||||
type: 'action',
|
||||
@@ -50,13 +50,13 @@ const callouts = (): BytemdPlugin => {
|
||||
icon: calloutSvg,
|
||||
handler: {
|
||||
type: 'dropdown',
|
||||
actions: calloutTypes.map(type => ({
|
||||
title: type.title,
|
||||
icon: type.icon,
|
||||
actions: calloutTypes.map(({ title, icon, blockType }) => ({
|
||||
title,
|
||||
icon,
|
||||
handler: {
|
||||
type: 'action',
|
||||
click: (ctx) => {
|
||||
ctx.appendBlock(`> ${type.blockType} ${type.title}\n> `);
|
||||
ctx.appendBlock(`> ${blockType} ${title}\n> `);
|
||||
}
|
||||
}
|
||||
}))
|
||||
@@ -66,13 +66,11 @@ const callouts = (): BytemdPlugin => {
|
||||
}
|
||||
}
|
||||
|
||||
const plugins = [
|
||||
export default [
|
||||
gfm({ singleTilde: false }),
|
||||
markers(),
|
||||
// markers(),
|
||||
gemoji(),
|
||||
math(),
|
||||
highlight(),
|
||||
callouts()
|
||||
]
|
||||
|
||||
export default plugins;
|
||||
];
|
||||
Reference in New Issue
Block a user