From f85dddf4b8f86846cb728fefea40af271ffc1bef Mon Sep 17 00:00:00 2001 From: yige Date: Sat, 18 Jul 2020 17:46:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=85=E5=AE=B9=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- pages/post/_id.vue | 13 ++++++++++--- yarn.lock | 16 ++++++++-------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 704380e..5e636fa 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "koa": "^2.11.0", "moment": "^2.27.0", "nuxt": "^2.12.2", - "vditor": "^3.3.3", + "vditor": "^3.3.8", "vue-js-modal": "^2.0.0-rc.3", "vue-toasted": "^1.1.28" }, diff --git a/pages/post/_id.vue b/pages/post/_id.vue index ccfe41e..63bd74e 100644 --- a/pages/post/_id.vue +++ b/pages/post/_id.vue @@ -290,7 +290,6 @@ export default { 'export', 'outline', 'preview', - 'format', 'devtools' ] }], @@ -339,7 +338,6 @@ export default { 'export', 'outline', 'preview', - 'format', 'devtools' ] }], @@ -485,6 +483,15 @@ export default { } const editorObj = type === 'editor-reply' ? window.editorReplyObj : window.editorObj + const content = editorObj.getValue() + + if (!content || content === '\n') { + this.$toasted.show('请输入内容', { + position: 'top-center', + duration: 5000 + }) + return + } const { data } = await this.$axios({ method: 'post', @@ -496,7 +503,7 @@ export default { postID, lastID, parentID, - content: editorObj.getValue() + content } }) diff --git a/yarn.lock b/yarn.lock index 6458806..c9d9959 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3105,10 +3105,10 @@ detect-indent@^5.0.0: resolved "https://mirrors.huaweicloud.com/repository/npm/detect-indent/-/detect-indent-5.0.0.tgz#3871cc0a6a002e8c3e5b3cf7f336264675f06b9d" integrity sha1-OHHMCmoALow+Wzz38zYmRnXwa50= -diff-match-patch@^1.0.4: +diff-match-patch@^1.0.5: version "1.0.5" - resolved "https://registry.yarnpkg.com/diff-match-patch/-/diff-match-patch-1.0.5.tgz#abb584d5f10cd1196dfc55aa03701592ae3f7b37" - integrity sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw== + resolved "https://registry.npm.taobao.org/diff-match-patch/download/diff-match-patch-1.0.5.tgz#abb584d5f10cd1196dfc55aa03701592ae3f7b37" + integrity sha1-q7WE1fEM0Rlt/FWqA3AVkq4/ezc= diffie-hellman@^5.0.0: version "5.0.3" @@ -8833,12 +8833,12 @@ vary@^1.1.2, vary@~1.1.2: resolved "https://mirrors.huaweicloud.com/repository/npm/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= -vditor@^3.3.3: - version "3.3.3" - resolved "https://registry.yarnpkg.com/vditor/-/vditor-3.3.3.tgz#fbab16bf259e060a9502aa8a146943a70cd757f1" - integrity sha512-Z3rcpW9UWeI3VxQ4K3nNfEN2iC7aflwCVZMTlm2x+X+90EFaOKzgEQEizo+tma+hXcyhhb5UeTnmabVwoDKjNQ== +vditor@^3.3.8: + version "3.3.8" + resolved "https://registry.npm.taobao.org/vditor/download/vditor-3.3.8.tgz#d60b9c24d7a3e220352c0bbbab158ff5e93e955f" + integrity sha1-1gucJNej4iA1LAu7qxWP9ek+lV8= dependencies: - diff-match-patch "^1.0.4" + diff-match-patch "^1.0.5" vendors@^1.0.0: version "1.0.4"