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,54 +177,47 @@
}, },
_initEditor(data) { _initEditor(data) {
let _ts = this; let _ts = this;
let toolbar; let toolbar = [
if (window.innerWidth < 768) { 'emoji',
toolbar = [ 'headings',
'emoji', 'bold',
'headings', 'italic',
'bold', 'strike',
'italic', 'link',
'strike', '|',
'link', 'list',
'|', 'ordered-list',
'list', 'check',
'ordered-list', 'outdent',
'check', 'indent',
'outdent', '|',
'indent', 'quote',
'|', 'line',
'quote', 'code',
'line', 'inline-code',
'code', 'insert-before',
'inline-code', 'insert-after',
'insert-before', '|',
'insert-after', 'upload',
'|', // 'record',
'upload', 'table',
'record', '|',
'table', 'undo',
'|', 'redo',
'undo', '|',
'redo', 'edit-mode',
'|', {
'edit-mode', name: 'more',
'content-theme', toolbar: [
'code-theme', 'fullscreen',
{ 'both',
name: 'more', 'preview',
toolbar: [ 'info'
'fullscreen', ],
'both', }]
'format',
'preview',
'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',