|
|
@ -42,7 +42,11 @@ const props = defineProps({ |
|
|
|
'undo', // 撤销 |
|
|
|
'undo', // 撤销 |
|
|
|
'redo', // 重做 |
|
|
|
'redo', // 重做 |
|
|
|
'fullScreen' |
|
|
|
'fullScreen' |
|
|
|
] |
|
|
|
], |
|
|
|
|
|
|
|
insertKeys: { |
|
|
|
|
|
|
|
index: 20, // 自定义插入的位置 |
|
|
|
|
|
|
|
keys: ['uploadAttachment'] // “上传附件”菜单 |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
@ -104,6 +108,12 @@ const editorConfig = computed((): IEditorConfig => { |
|
|
|
}, |
|
|
|
}, |
|
|
|
autoFocus: false, |
|
|
|
autoFocus: false, |
|
|
|
scroll: true, |
|
|
|
scroll: true, |
|
|
|
|
|
|
|
// 在编辑器中,点击选中“附件”节点时,要弹出的菜单 |
|
|
|
|
|
|
|
hoverbarKeys: { |
|
|
|
|
|
|
|
attachment: { |
|
|
|
|
|
|
|
menuKeys: ['downloadAttachment'] // “下载附件”菜单 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
MENU_CONF: { |
|
|
|
MENU_CONF: { |
|
|
|
['uploadImage']: { |
|
|
|
['uploadImage']: { |
|
|
|
server: import.meta.env.VITE_UPLOAD_URL, |
|
|
|
server: import.meta.env.VITE_UPLOAD_URL, |
|
|
@ -218,6 +228,52 @@ const editorConfig = computed((): IEditorConfig => { |
|
|
|
customInsert(res: any, insertFn: InsertFnType) { |
|
|
|
customInsert(res: any, insertFn: InsertFnType) { |
|
|
|
insertFn(res.data, 'video', res.data) |
|
|
|
insertFn(res.data, 'video', res.data) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
uploadAttachment: { |
|
|
|
|
|
|
|
server: import.meta.env.VITE_UPLOAD_URL, |
|
|
|
|
|
|
|
timeout: 20 * 1000, // 2s |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fieldName: 'file', |
|
|
|
|
|
|
|
// meta: { token: 'xxx', a: 100 }, // 请求时附加的数据 |
|
|
|
|
|
|
|
// metaWithUrl: true, // meta 拼接到 url 上 |
|
|
|
|
|
|
|
// headers: { Accept: 'text/x-json' }, |
|
|
|
|
|
|
|
// 自定义增加 http header |
|
|
|
|
|
|
|
headers: { |
|
|
|
|
|
|
|
Accept: '*', |
|
|
|
|
|
|
|
Authorization: 'Bearer ' + getAccessToken(), |
|
|
|
|
|
|
|
'tenant-id': getTenantId(), |
|
|
|
|
|
|
|
'instance-id': getAppId() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
maxFileSize: 20 * 1024 * 1024, // 20M |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onBeforeUpload(file: File) { |
|
|
|
|
|
|
|
console.log('onBeforeUpload', file) |
|
|
|
|
|
|
|
return file // 上传 file 文件 |
|
|
|
|
|
|
|
// return false // 会阻止上传 |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
onProgress(progress: number) { |
|
|
|
|
|
|
|
console.log('onProgress', 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: Error, res: any) { |
|
|
|
|
|
|
|
alert(err.message) |
|
|
|
|
|
|
|
console.error('onError', file, err, res) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 上传成功后,用户自定义插入文件 |
|
|
|
|
|
|
|
customInsert(res: any, file: File, insertFn: Function) { |
|
|
|
|
|
|
|
console.log('customInsert', res) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 插入附件到编辑器 |
|
|
|
|
|
|
|
insertFn(file.name, res.data) |
|
|
|
|
|
|
|
// insertFn(res.data, `customInsert-${file.name}`, res.data) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
uploadImgShowBase64: true |
|
|
|
uploadImgShowBase64: true |
|
|
|