diff --git a/pages/admin/tag/post/_tag_id.vue b/pages/admin/tag/post/_tag_id.vue index d7e896d..6f44445 100644 --- a/pages/admin/tag/post/_tag_id.vue +++ b/pages/admin/tag/post/_tag_id.vue @@ -86,6 +86,7 @@ export default { return { tokenURL: { URL: '', + linkToImageURL: '', token: '' }, tagIconPath: '', @@ -97,9 +98,8 @@ export default { methods: { _initEditor(data) { let _ts = this; - let toolbar; - if (window.innerWidth < 768) { - toolbar = [ + + let toolbar = [ 'emoji', 'headings', 'bold', @@ -128,20 +128,15 @@ export default { 'redo', '|', 'edit-mode', - 'content-theme', - 'code-theme', { name: 'more', toolbar: [ 'fullscreen', 'both', - 'format', 'preview', - 'info', - 'help', + 'info' ], }] - } return new Vue.Vditor(data.id, { toolbar, mode: 'sv', @@ -179,9 +174,11 @@ export default { upload: { max: 10 * 1024 * 1024, url: this.tokenURL.URL, - linkToImgUrl: this.tokenURL.URL, + linkToImgUrl: this.tokenURL.linkToImageURL, token: this.tokenURL.token, - filename: name => name.replace(/\?|\\|\/|:|\||<|>|\*|\[|\]|\s+/g, '-') + filename: name => name.replace(/[^(a-zA-Z0-9\u4e00-\u9fa5\.)]/g, ''). + replace(/[\?\\/:|<>\*\[\]\(\)\$%\{\}@~]/g, ''). + replace('/\\s/g', '') }, height: data.height, counter: 102400, @@ -248,8 +245,9 @@ export default { if (res) { _ts.$store.commit('setUploadHeaders', res.uploadToken); _ts.$set(_ts, 'tokenURL', { - token: res.uploadToken || '', - URL: res.uploadURL || '', + token: responseData.uploadToken || '', + URL: responseData.uploadURL || '', + linkToImageURL: responseData.linkToImageURL || '' }) } }); diff --git a/pages/admin/topic/post/_topic_id.vue b/pages/admin/topic/post/_topic_id.vue index c830112..c7f3493 100644 --- a/pages/admin/topic/post/_topic_id.vue +++ b/pages/admin/topic/post/_topic_id.vue @@ -102,6 +102,7 @@ export default { loading: false, tokenURL: { URL: '', + linkToImageURL: '', token: '' }, topicIconPath: '', @@ -111,9 +112,8 @@ export default { methods: { _initEditor(data) { let _ts = this; - let toolbar; - if (window.innerWidth < 768) { - toolbar = [ + + let toolbar = [ 'emoji', 'headings', 'bold', @@ -142,20 +142,15 @@ export default { 'redo', '|', 'edit-mode', - 'content-theme', - 'code-theme', { name: 'more', toolbar: [ 'fullscreen', 'both', - 'format', 'preview', - 'info', - 'help', + 'info' ], }] - } return new Vue.Vditor(data.id, { toolbar, mode: 'sv', @@ -193,9 +188,11 @@ export default { upload: { max: 10 * 1024 * 1024, url: this.tokenURL.URL, - linkToImgUrl: this.tokenURL.URL, + linkToImgUrl: this.tokenURL.linkToImageURL, token: this.tokenURL.token, - filename: name => name.replace(/\?|\\|\/|:|\||<|>|\*|\[|\]|\s+/g, '-') + filename: name => name.replace(/[^(a-zA-Z0-9\u4e00-\u9fa5\.)]/g, ''). + replace(/[\?\\/:|<>\*\[\]\(\)\$%\{\}@~]/g, ''). + replace('/\\s/g', '') }, height: data.height, counter: 102400, diff --git a/pages/article/post/_article_id.vue b/pages/article/post/_article_id.vue index d07c5c2..a1227f1 100644 --- a/pages/article/post/_article_id.vue +++ b/pages/article/post/_article_id.vue @@ -71,7 +71,11 @@ data() { return { contentEditor: null, - tokenURL: {}, + tokenURL: { + URL: '', + linkToImageURL: '', + token: '' + }, idArticle: 0, articleTitle: '', articleContent: '', @@ -88,51 +92,45 @@ methods: { _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', @@ -170,9 +168,11 @@ upload: { max: 10 * 1024 * 1024, url: this.tokenURL.URL, - linkToImgUrl: this.tokenURL.URL, + linkToImgUrl: this.tokenURL.linkToImageURL, token: this.tokenURL.token, - filename: name => name.replace(/\?|\\|\/|:|\||<|>|\*|\[|\]|\s+/g, '-') + filename: name => name.replace(/[^(a-zA-Z0-9\u4e00-\u9fa5\.)]/g, ''). + replace(/[\?\\/:|<>\*\[\]\(\)\$%\{\}@~]/g, ''). + replace('/\\s/g', '') }, height: data.height, counter: 102400, @@ -298,6 +298,7 @@ if (res) { if (res.message) { _ts.$message(res.message); + _ts.doLoading = false; return false; } localStorage.removeItem('article-title'); @@ -326,6 +327,7 @@ _ts.$set(_ts, 'tokenURL', { token: responseData.uploadToken || '', URL: responseData.uploadURL || '', + linkToImageURL: responseData.linkToImageURL || '' }) } diff --git a/pages/chats/_nickname.vue b/pages/chats/_nickname.vue index fef23f6..c1f6a8e 100644 --- a/pages/chats/_nickname.vue +++ b/pages/chats/_nickname.vue @@ -1,4 +1,4 @@ -