【功能新增】全局:富文本编辑器,支持视频文件的上传

This commit is contained in:
YunaiV 2024-07-21 10:44:15 +08:00
parent 5d91131eb7
commit 8ed2afb712

View File

@ -96,11 +96,6 @@ const editorConfig = computed((): IEditorConfig => {
// ['image/*'] []
allowedFileTypes: ['image/*'],
// token formData
meta: { updateSupport: 0 },
// meta url false
metaWithUrl: true,
// http header
headers: {
Accept: '*',
@ -108,9 +103,6 @@ const editorConfig = computed((): IEditorConfig => {
'tenant-id': getTenantId()
},
// cookie false
withCredentials: true,
// 10
timeout: 5 * 1000, // 5
@ -119,7 +111,7 @@ const editorConfig = computed((): IEditorConfig => {
//
onBeforeUpload(file: File) {
console.log(file)
// console.log(file)
return file
},
//
@ -142,6 +134,54 @@ const editorConfig = computed((): IEditorConfig => {
customInsert(res: any, insertFn: InsertFnType) {
insertFn(res.data, 'image', res.data)
}
},
['uploadVideo']: {
server: import.meta.env.VITE_UPLOAD_URL,
// 10M
maxFileSize: 10 * 1024 * 1024,
// 100
maxNumberOfFiles: 10,
// ['video/*'] []
allowedFileTypes: ['video/*'],
// http header
headers: {
Accept: '*',
Authorization: 'Bearer ' + getAccessToken(),
'tenant-id': getTenantId()
},
// 30
timeout: 15 * 1000, // 15
// form-data fieldNamewangeditor-uploaded-image
fieldName: 'file',
//
onBeforeUpload(file: File) {
// console.log(file)
return file
},
//
onProgress(progress: number) {
// progress 0-100
console.log('progress', progress)
},
onSuccess(file: File, res: any) {
console.log('onSuccess', file, res)
},
onFailed(file: File, res: any) {
alert(res.message)
console.log('onFailed', file, res)
},
onError(file: File, err: any, res: any) {
alert(err.message)
console.error('onError', file, err, res)
},
//
customInsert(res: any, insertFn: InsertFnType) {
insertFn(res.data, 'mp4', res.data)
}
}
},
uploadImgShowBase64: true