From Docs -
The server has to process the upload request, save the image and return a JSON containing a link to the uploaded image. The returned JSON needs to look like: { link: 'path/to/image.jpg' }
Can we have another imageLink option to replace fixed json. if imageLink options is used then froala should look for image url in that option instead of "link" key in json.
What you can do is to use the image.uploaded event, parse the response and insert the image using the image.insert method.
When I do it, I see two pictures in editor:
<p>
<img class="fr-dib fr-draggable" src="//my-server.org/5efe9e3135d600d02052f64fd3687c0e.png" style="width: 300px;">
<img class="fr-dib fr-uploading fr-draggable" src="blob:https://localhost:4200/6d6653c3-6583-4bcb-a547-3529437edd5e" style="width: 300px;">
</p>
"ember-froala-editor": "2.3.6-beta.2",
"froala-wysiwyg-editor": "2.3.5"
Please provide ability to normalize server response (via option or image.uploaded event).
Is it possible to get a hook function to customize the server response before Froala try to insert the ressource? With this feature, we could use any image hosting SAAS without creating a proxy server side to customize the server response.
Currently, I need to create a dirty trick 馃憥 by overriding JSON parse:
// patching `parseJSON` because Froala doesn't allow customization of response
// To update for 2.6.3+ to use JSON.parse instead of Jquery.parseJSON (https://www.froala.com/wysiwyg-editor/changelog#2.6.3)
var _parseJSON = jQuery.parseJSON; //var _parseJSON = JSON.parse;
jQuery.parseJSON = function(j) { // JSON.parse = function(j) {
var response = _parseJSON(j);
if (response.link === undefined && response.url !== undefined)
response.link = response.url;
return response;
};
Most helpful comment
Please provide ability to normalize server response (via option or
image.uploadedevent).