Search code examples
froala

How to customize the error message when inserting image into the Froala WYSIWYG editing area


I would like to use Froala in my web app. I am testing its image insert button and would like to limit the image size to 1M. When I drop an image larger than that, I see an error message:

Something went wrong. Please try again.

I would like to show something such as

Image cannot be larger than 1M.

Image type is not supported.

Is this doable in Froala?


Solution

  • You could do the following inside the image.error event:

    var $popup = editor.popups.get('image.insert');
    var $layer = $popup.find('.fr-image-progress-bar-layer');
    $layer.find('h3').text('Your message');