Closed L0kidor closed 5 years ago
Hi, i'm trying to use the remove image/file function when a user delete it from the editor.
It seems that events aren't handled identically in KMS/froala than in other classic versions.
The docs don't mention it, but I found this issue #43 wich is talking about event handling.
I tried to define a JS function (called deleteImage) wich make the AJAX request and call it from event handler
->add('content', FroalaEditorType::class, array('events' => array('image.removed' => 'deleteImage')) )
But it seems that the function isn't called (my alert('test') isn't displayed)
function deleteImage(e, editor, $img) { alert('test'); $.ajax({ // Request method. method: "POST", // Request URL. url: '/admin/imageDelete', // Request params. data: { src: $img.attr('src') } }) .done (function (data) { console.log ('image was deleted'); }) .fail (function () { console.log ('image delete problem'); }) }
Can't find any Symfony specific doc about this. It don't seems to be the right way to achieve this, can anyone help ?
@L0kidor can you please try naming the event as "froalaEditor.image.removed" ? It has worked for me.
Hi, gonna try as soon as possible. Thx
Hi, i'm trying to use the remove image/file function when a user delete it from the editor.
It seems that events aren't handled identically in KMS/froala than in other classic versions.
The docs don't mention it, but I found this issue #43 wich is talking about event handling.
I tried to define a JS function (called deleteImage) wich make the AJAX request and call it from event handler
->add('content', FroalaEditorType::class, array('events' => array('image.removed' => 'deleteImage')) )
But it seems that the function isn't called (my alert('test') isn't displayed)
Can't find any Symfony specific doc about this. It don't seems to be the right way to achieve this, can anyone help ?