TinyMCE Custom Elements with a ' : '?

327 Views Asked by At

So I'm looking to allow Thymeleaf tags inside my TinyMce Editor (using angular-ui-tinymce if that matters)

I understand the basic format

 extended_valid_elements : 'script[charset|language|type|src]'

but how would I use this to allow for things like

 <p th:text="..."> //or// <img th:src="..."/>

Before anyone asks, yes it is necessary to have both tinyMce and thymeleaf, and No I don't need the thymeleaf to work inside tinymce, I just need the editor to stop stripping the tags.

2

There are 2 best solutions below

0
On
extended_valid_elements : 'img[th::text]'

Double colon symbol works as a single ':' char, but unfortunately you can't add attribute to * (any element) in extended_valid_elements. But you can list all needed elements.

1
On

Try putting this in your TinyMCE configuration:

valid_elements: "*[*]"