vue-froala-wysiwyg
vue-froala-wysiwyg copied to clipboard
The pasted picture will not drop the picture upload interface
The pasted picture will not drop the picture upload interface Just save base64 format,How do I make the image upload automatically when pasted into rich text?
This is my code, hope it helps
<template>
....
<froala
:config="config"
v-model="editorData"
></froala>
....
</template>
<script>
data() {
const that = this;
return {
//.........
apiToken: "API TOKEN",
config: {
imageUploadURL: "https://this-is-my-server.name/upload",
imagePaste: true,
imagePasteProcess: true,
imageResize: true,
crossDomain: true,
imageEditButtons: [
"imageDisplay",
"imageAlign",
"imageInfo",
"imageRemove",
],
imageMaxSize: 1 * 1024 * 1024, //1 megabyte
event: {
"image.beforeUpload": function () {
var editor = this;
editor.opts.requestHeaders.authorization = that.apiToken;
editor.popups.hideAll();
},
"image.inserted": function (response) {
if (response) {
setTimeout(() => {
//autosave data to server
}, 1000);
}
},
"image.error": function (error) {
if (error.code == 5) {
alert('File is too big!')
}
}
}
}
//............
}
}
</script>