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