v-md-editor
Version:
A markdown editor built on Vue
20 lines (16 loc) • 464 B
JavaScript
export { codePython as name } from '@/utils/constants/command.js';
export default function(editor) {
editor.insert((selected) => {
const content = selected? selected:'代码';
const prefix = '``` python';
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,
};
});
}