vue-markdown-editor
vue-markdown-editor copied to clipboard
code insert new line
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch @kangc/[email protected]
for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/@kangc/v-md-editor/src/command/code.js b/node_modules/@kangc/v-md-editor/src/command/code.js
index 21cb6d3..052f411 100644
--- a/node_modules/@kangc/v-md-editor/src/command/code.js
+++ b/node_modules/@kangc/v-md-editor/src/command/code.js
@@ -2,12 +2,13 @@ export { code as name } from '@/utils/constants/command.js';
export default function (editor) {
editor.insert((selected) => {
- const prefix = '``` language';
+ const prefix = '``` ';
+ const midfix = 'language';
const suffix = '```';
- let text = `${prefix}\n${suffix}`;
+ let text = `${prefix}\n${midfix}\n${suffix}`;
if (selected) {
- text = `${prefix}\n ${selected}\n${suffix}`;
+ text = `${prefix}\n${midfix}\n ${selected}\n${suffix}`;
}
return {
This issue body was partially generated by patch-package.