UNPKG

v-md-editor

Version:

A markdown editor built on Vue

20 lines (16 loc) 458 B
export { codeCpp as name } from '@/utils/constants/command.js'; export default function(editor) { editor.insert((selected) => { const content = selected? selected:'代码'; const prefix = '``` cpp'; const suffix = '```'; let text = `\n${prefix}\n${content}\n${suffix}\n`; if (selected) { text = `\n${prefix}\n ${content}\n${suffix}\n`; } return { text, selected: content, }; }); }