From ba577270f4a498120b57f0aeebcaabf828b80b76 Mon Sep 17 00:00:00 2001 From: yanglbme Date: Mon, 23 Nov 2020 23:28:28 +0800 Subject: [PATCH] build: release v1.4.4 --- package.json | 4 ++-- src/components/CodemirrorEditor/rightClickMenu.vue | 4 ++++ src/view/CodemirrorEditor.vue | 10 ++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 18795d6e5..311013f69 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "vue-md", - "version": "1.4.3", + "version": "1.4.4", "homepage": ".", "description": "An open-source wechat markdown editor.", - "author": "yanglbme ", + "author": "doocs", "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", diff --git a/src/components/CodemirrorEditor/rightClickMenu.vue b/src/components/CodemirrorEditor/rightClickMenu.vue index cf9aeb2d1..46c89232a 100644 --- a/src/components/CodemirrorEditor/rightClickMenu.vue +++ b/src/components/CodemirrorEditor/rightClickMenu.vue @@ -57,6 +57,10 @@ export default { text: "下载 Markdown 文档", key: "download", }, + { + text: "格式化 Markdown 文档", + key: "formatMarkdown", + }, ], ], }; diff --git a/src/view/CodemirrorEditor.vue b/src/view/CodemirrorEditor.vue index 2a0446a5d..c27775b3d 100644 --- a/src/view/CodemirrorEditor.vue +++ b/src/view/CodemirrorEditor.vue @@ -339,6 +339,12 @@ export default { downloadEditorContent() { downloadMD(this.editor.getValue(0)); }, + // 格式化文档 + formatContent() { + const doc = formatDoc(this.editor.getValue(0)); + localStorage.setItem("__editor_content", doc); + this.editor.setValue(doc); + }, // 右键菜单 openMenu(e) { const menuMinWidth = 105; @@ -366,6 +372,10 @@ export default { break; case "insertTable": this.dialogFormVisible = true; + break; + case "formatMarkdown": + this.formatContent(); + break; default: break; }