update vditor config

This commit is contained in:
x ronger 2020-10-18 18:55:27 +08:00
parent 40cded1032
commit 9712f85abd
6 changed files with 56 additions and 56 deletions

View File

@ -152,7 +152,11 @@
}, },
data() { data() {
return { return {
tokenURL: {}, tokenURL: {
URL: '',
linkToImageURL: '',
token: ''
},
drawer: false, drawer: false,
direction: 'btt', direction: 'btt',
initEditor: false, initEditor: false,
@ -173,9 +177,7 @@
}, },
_initEditor(data) { _initEditor(data) {
let _ts = this; let _ts = this;
let toolbar; let toolbar = [
if (window.innerWidth < 768) {
toolbar = [
'emoji', 'emoji',
'headings', 'headings',
'bold', 'bold',
@ -197,30 +199,25 @@
'insert-after', 'insert-after',
'|', '|',
'upload', 'upload',
'record', // 'record',
'table', 'table',
'|', '|',
'undo', 'undo',
'redo', 'redo',
'|', '|',
'edit-mode', 'edit-mode',
'content-theme',
'code-theme',
{ {
name: 'more', name: 'more',
toolbar: [ toolbar: [
'fullscreen', 'fullscreen',
'both', 'both',
'format',
'preview', 'preview',
'info', 'info'
'help',
], ],
}] }]
}
return new Vue.Vditor(data.id, { return new Vue.Vditor(data.id, {
toolbar, toolbar,
mode: 'sv', mode: 'ir',
tab: '\t', tab: '\t',
cache: { cache: {
enable: this.postId ? false : true, enable: this.postId ? false : true,
@ -251,10 +248,12 @@
}, },
upload: { upload: {
max: 10 * 1024 * 1024, max: 10 * 1024 * 1024,
url: this.tokenURL?.URL, url: this.tokenURL.URL,
linkToImgUrl: this.tokenURL?.URL, linkToImgUrl: this.tokenURL.linkToImageURL,
token: this.tokenURL?.token, 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, height: data.height,
counter: 102400, counter: 102400,
@ -363,6 +362,7 @@
_ts.$set(_ts, 'tokenURL', { _ts.$set(_ts, 'tokenURL', {
token: responseData.uploadToken || '', token: responseData.uploadToken || '',
URL: responseData.uploadURL || '', URL: responseData.uploadURL || '',
linkToImageURL: responseData.linkToImageURL || ''
}) })
} }
} }

View File

@ -121,7 +121,7 @@ export default {
'insert-after', 'insert-after',
'|', '|',
'upload', 'upload',
'record', // 'record',
'table', 'table',
'|', '|',
'undo', 'undo',

View File

@ -135,7 +135,7 @@ export default {
'insert-after', 'insert-after',
'|', '|',
'upload', 'upload',
'record', // 'record',
'table', 'table',
'|', '|',
'undo', 'undo',

View File

@ -104,7 +104,7 @@ template>
'insert-after', 'insert-after',
'|', '|',
'upload', 'upload',
'record', // 'record',
'table', 'table',
'|', '|',
'undo', 'undo',

View File

@ -41,7 +41,7 @@ export default {
'insert-after', 'insert-after',
'|', '|',
'upload', 'upload',
'record', // 'record',
'table', 'table',
'|', '|',
'undo', 'undo',

View File

@ -126,7 +126,7 @@
'insert-after', 'insert-after',
'|', '|',
'upload', 'upload',
'record', // 'record',
'table', 'table',
'|', '|',
'undo', 'undo',