v-md-editor
Version:
A markdown editor built on Vue
38 lines (36 loc) • 905 B
JavaScript
import { code, codeCpp, codePython, codeInline } from '@/utils/constants/command';
export default {
name: code,
icon: 'v-md-icon-code',
title: (editor) => `${editor.langConfig.code.toolbar}(Alt+L / C / P)`,
menus: [
{
name: '插入行内代码',
text: '插入行内代码(Alt+L)',
action(editor) {
editor.execCommand(codeInline);
},
},
{
name: '插入 C++ 代码',
text: '插入 C++ 代码(Alt+C)',
action(editor) {
editor.execCommand(codeCpp);
},
},
{
name: '插入 Python 代码',
text: '插入 Python 代码(Alt+P)',
action(editor) {
editor.execCommand(codePython);
},
},
{
name: '插入代码块',
text: '插入代码块',
action(editor) {
editor.execCommand(code);
},
}
],
};