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() {
return {
tokenURL: {},
tokenURL: {
URL: '',
linkToImageURL: '',
token: ''
},
drawer: false,
direction: 'btt',
initEditor: false,
@ -173,9 +177,7 @@
},
_initEditor(data) {
let _ts = this;
let toolbar;
if (window.innerWidth < 768) {
toolbar = [
let toolbar = [
'emoji',
'headings',
'bold',
@ -197,30 +199,25 @@
'insert-after',
'|',
'upload',
'record',
// 'record',
'table',
'|',
'undo',
'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',
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 || ''
})
}
}

View File

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

View File

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

View File

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

View File

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

View File

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