diff --git a/components/common/comment/main.vue b/components/common/comment/main.vue index 57a0ad5..f3c6351 100644 --- a/components/common/comment/main.vue +++ b/components/common/comment/main.vue @@ -152,7 +152,11 @@ }, data() { return { - tokenURL: {}, + tokenURL: { + URL: '', + linkToImageURL: '', + token: '' + }, drawer: false, direction: 'btt', initEditor: false, @@ -173,54 +177,47 @@ }, _initEditor(data) { let _ts = this; - let toolbar; - if (window.innerWidth < 768) { - toolbar = [ - 'emoji', - 'headings', - 'bold', - 'italic', - 'strike', - 'link', - '|', - 'list', - 'ordered-list', - 'check', - 'outdent', - 'indent', - '|', - 'quote', - 'line', - 'code', - 'inline-code', - 'insert-before', - 'insert-after', - '|', - 'upload', - 'record', - 'table', - '|', - 'undo', - 'redo', - '|', - 'edit-mode', - 'content-theme', - 'code-theme', - { - name: 'more', - toolbar: [ - 'fullscreen', - 'both', - 'format', - 'preview', - 'info', - 'help', - ], - }] - } + let toolbar = [ + 'emoji', + 'headings', + 'bold', + 'italic', + 'strike', + 'link', + '|', + 'list', + 'ordered-list', + 'check', + 'outdent', + 'indent', + '|', + 'quote', + 'line', + 'code', + 'inline-code', + 'insert-before', + 'insert-after', + '|', + 'upload', + // 'record', + 'table', + '|', + 'undo', + 'redo', + '|', + 'edit-mode', + { + name: 'more', + toolbar: [ + 'fullscreen', + 'both', + 'preview', + 'info' + ], + }] return new Vue.Vditor(data.id, { toolbar, - mode: 'sv', + mode: 'ir', tab: '\t', cache: { enable: this.postId ? false : true, @@ -251,10 +248,12 @@ }, upload: { max: 10 * 1024 * 1024, - url: this.tokenURL?.URL, - linkToImgUrl: this.tokenURL?.URL, - token: this.tokenURL?.token, - filename: name => name.replace(/\?|\\|\/|:|\||<|>|\*|\[|\]|\s+/g, '-') + url: this.tokenURL.URL, + linkToImgUrl: this.tokenURL.linkToImageURL, + token: this.tokenURL.token, + filename: name => name.replace(/[^(a-zA-Z0-9\u4e00-\u9fa5\.)]/g, ''). + replace(/[\?\\/:|<>\*\[\]\(\)\$%\{\}@~]/g, ''). + replace('/\\s/g', '') }, height: data.height, counter: 102400, @@ -363,6 +362,7 @@ _ts.$set(_ts, 'tokenURL', { token: responseData.uploadToken || '', URL: responseData.uploadURL || '', + linkToImageURL: responseData.linkToImageURL || '' }) } } diff --git a/pages/admin/tag/post/_tag_id.vue b/pages/admin/tag/post/_tag_id.vue index 6f44445..5077328 100644 --- a/pages/admin/tag/post/_tag_id.vue +++ b/pages/admin/tag/post/_tag_id.vue @@ -121,7 +121,7 @@ export default { 'insert-after', '|', 'upload', - 'record', + // 'record', 'table', '|', 'undo', diff --git a/pages/admin/topic/post/_topic_id.vue b/pages/admin/topic/post/_topic_id.vue index c7f3493..c42dc61 100644 --- a/pages/admin/topic/post/_topic_id.vue +++ b/pages/admin/topic/post/_topic_id.vue @@ -135,7 +135,7 @@ export default { 'insert-after', '|', 'upload', - 'record', + // 'record', 'table', '|', 'undo', diff --git a/pages/chats/_nickname.vue b/pages/chats/_nickname.vue index c1f6a8e..20fc32d 100644 --- a/pages/chats/_nickname.vue +++ b/pages/chats/_nickname.vue @@ -104,7 +104,7 @@ template> 'insert-after', '|', 'upload', - 'record', + // 'record', 'table', '|', 'undo', diff --git a/pages/guides/markdown.vue b/pages/guides/markdown.vue index cd5455f..5b0c612 100644 --- a/pages/guides/markdown.vue +++ b/pages/guides/markdown.vue @@ -41,7 +41,7 @@ export default { 'insert-after', '|', 'upload', - 'record', + // 'record', 'table', '|', 'undo', diff --git a/pages/portfolio/post/_portfolio_id.vue b/pages/portfolio/post/_portfolio_id.vue index 0ddbafa..9ee0ab9 100644 --- a/pages/portfolio/post/_portfolio_id.vue +++ b/pages/portfolio/post/_portfolio_id.vue @@ -126,7 +126,7 @@ 'insert-after', '|', 'upload', - 'record', + // 'record', 'table', '|', 'undo',