RBAND

TINYMCE cuts out tags, exceptions for TINYMCE tags

The TinyMCE text editor in visual mode with the standard configuration cuts off some tags and properties.

Tiny 3.jpg

The TinyMCE text editor in visual mode with the standard configuration cuts off some tags and properties. In some cases, there may be a need to expand the allowed list of tags in a text editor, for example, to add tags: <style></style> , <script></script> , <link> and other necessary tags. In this case, the text editor receives additional functionality. A solution to this situation is provided by the developers of the TinyMCE text editor.

We prohibit cutting off necessary tags. Examples

The problem of prohibiting cutting tags necessary for our task is solved at the initialization stage of the text editor, by specifying exception rules for cut tags.

extended_valid_elements parameter:

tinyMCE.init({
...
extended_valid_elements : "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]"
});

Where img is a tag. [class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]  list of allowed parameters for the tag.

There is also a solution for situations where there is no clear definition of the required parameters of the desired tag. In this case, instead of a list of parameters, we indicate * -  i.e. allow any tag parameters. Example:

tinyMCE.init({
...
extended_valid_elements : "img[*],style[*],list[*]"
});

This is perhaps the whole trick in configuring exception rules for cut tags in the TinyMCE text editor. Thank you for your attention, subscribe to our groups on social media. networks and leave comments.

Andrey
Andrey Perederiy

lead developer

Say thanks to the author, share with friends