update vditor config

This commit is contained in:
x ronger 2020-10-18 14:43:02 +08:00
parent 119e4ed0d9
commit e21fb6d829
6 changed files with 169 additions and 172 deletions

View File

@ -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 || ''
})
}
});

View File

@ -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,

View File

@ -71,7 +71,11 @@
data() {
return {
contentEditor: null,
tokenURL: {},
tokenURL: {
URL: '',
linkToImageURL: '',
token: ''
},
idArticle: 0,
articleTitle: '',
articleContent: '',
@ -88,9 +92,8 @@
methods: {
_initEditor(data) {
let _ts = this;
let toolbar;
if (window.innerWidth < 768) {
toolbar = [
let toolbar = [
'emoji',
'headings',
'bold',
@ -112,27 +115,22 @@
'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',
@ -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 || ''
})
}

View File

@ -1,4 +1,4 @@
<template>
template>
<client-only>
<el-row class="wrapper" v-if="user">
<el-col>
@ -55,7 +55,11 @@
data() {
return {
contentEditor: null,
tokenURL: {},
tokenURL: {
URL: '',
linkToImageURL: '',
token: ''
},
drawer: false,
direction: 'btt',
initEditor: false,
@ -77,9 +81,8 @@
methods: {
_initEditor(data) {
let _ts = this;
let toolbar;
if (window.innerWidth < 768) {
toolbar = [
let toolbar = [
'emoji',
'headings',
'bold',
@ -108,20 +111,15 @@
'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',
@ -150,10 +148,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,
@ -194,6 +194,7 @@
_ts.$set(_ts, 'tokenURL', {
token: responseData.uploadToken || '',
URL: responseData.uploadURL || '',
linkToImageURL: responseData.linkToImageURL || ''
})
}
}

View File

@ -93,6 +93,7 @@
loading: false,
tokenURL: {
URL: '',
linkToImageURL: '',
token: ''
},
headImgUrl: '',
@ -102,9 +103,8 @@
methods: {
_initEditor(data) {
let _ts = this;
let toolbar;
if (window.innerWidth < 768) {
toolbar = [
let toolbar = [
'emoji',
'headings',
'bold',
@ -133,20 +133,15 @@
'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 @@
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,
@ -279,8 +276,9 @@
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 || ''
})
}
});

View File

@ -97,6 +97,7 @@
svgShow: false,
tokenURL: {
URL: '',
linkToImageURL: '',
token: ''
},
avatarUrl: '',