-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upload Image #23
Comments
That's currently not possible. PRs are very welcome to implement this |
Hey @espositodaniele What exactly do you want to implement for images? I'm exploring options how to improve the package, your input is very welcome. |
What I've done is to upload photo that are sorted on my server, and at the moment it is not configurable. I needed to force the plug-in directly from .vue files. Would be helpful to have an option to indicate our root folder where to place image and then provide that information to the api that store image. Here is the code I've added to your UnlayerEditor.vue window.unlayer.registerCallback('image', (file, done) => {
let data = new FormData();
data.append('file', file.attachments[0]);
fetch('/api/upload-unlayer', {
method: 'POST',
headers: {
'Accept': 'application/json',
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content'),
},
body: data
}).then(response => {
// Make sure the response was valid
if (response.status >= 200 && response.status < 300) {
return response.json()
}
let error = new Error(response.statusText);
error.response = response;
throw error
}).then(data => done({progress: 100, url: data.url}))
});
|
Hello,
how we can manager uploap image?
The docs from unlayer says that we need to add a callbacks like the this:
How can we add this feature?
Many thanks
The text was updated successfully, but these errors were encountered: