【更新】更新适配新的tinymce上传文件方法

pull/60/head
小诺 2 years ago committed by 俞宝山
parent a64f6e4c6e
commit 304fa3e315

@ -1,7 +1,5 @@
<template> <template>
<div class="sceditor">
<Editor v-model="contentValue" :init="init" :disabled="disabled" :placeholder="placeholder" @onClick="onClick" /> <Editor v-model="contentValue" :init="init" :disabled="disabled" :placeholder="placeholder" @onClick="onClick" />
</div>
</template> </template>
<script> <script>
@ -69,15 +67,16 @@
resize: true, resize: true,
elementpath: true, elementpath: true,
content_style: '', content_style: '',
images_upload_handler: async (blobInfo, success, failure) => { images_upload_handler(blobInfo, progress) {
return new Promise((resolve, reject) => {
const data = new FormData() const data = new FormData()
data.append('file', blobInfo.blob(), blobInfo.filename()) data.append('file', blobInfo.blob(), blobInfo.filename())
try { fileApi.fileUploadDynamicReturnUrl(data).then((res) => {
const res = await fileApi.fileUploadDynamicReturnUrl(data) return resolve(res)
success(res) }).catch((err) => {
} catch (error) { return reject('err:' + err)
failure('Image upload failed') })
} })
}, },
setup: (editor) => { setup: (editor) => {
editor.on('init', function () { editor.on('init', function () {
@ -106,5 +105,3 @@
} }
} }
</script> </script>
<style></style>

Loading…
Cancel
Save