$0
<xf:js>
$(document).ready(function()
{
$(document).on('editor:init', '.js-editor', function (e, ed)
{
ed.events.on('image.uploaded', function (response)
{
this.image.insert($.parseJSON(response).attachment.thumbnail_url, false, null, this.image.get(), response);
return false;
});
ed.events.on('image.inserted image.replaced', function ($el, response)
{
if (!response || $el.hasClass('fr-video'))
{
return;
}
try
{
const json = $.parseJSON(response);
if (json.attachment)
{
$el.data('attachment', 'thumb:' + json.attachment.attachment_id);
}
}
catch (e)
{
return;
}
});
});
});
</xf:js>