Is is possible to customize the Rich Text Editor?

I am using the Rich Text Editor to add some html content to my pages. Is it possible to customize the behavior of this editor, in instance:

  • To change the container div into a p tag
  • To add target="_blank" to links

I am using a Rails app.


As far as I know, you can’t change the main container, but if you tick the option in the screenshot, you can inject any HTML you want inside of it and it won’t be escaped.

A common pattern for customers which want to inject html in the forms is to create a readonly smart fields, and generate html from the smart field handler, as seen here: Display field with complex info in html format (rich text editor)

Beware of code injection, as you will be responsible from correctly escaping javascript/html code if the content you inject is user-generated

1 Like

Thanks a lot @romaing, very helpful!