Tinymce valid_element not allowing all html elements

I would like my tinymce editor to allow all html elements, including some nested view.

I read the docs on tinima: http://www.tinymce.com/wiki.php/Configuration:valid_elements

And also confirmed by this post in Stackoverflow: TinyMce Allow all HTML tags

I use valid_elements :"*[*]", in my tinymce parameters:

 $('.page-tinymce-editor').tinymce({ theme: 'advanced', theme_advanced_buttons1: "fontsizeselect,bold,italic,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,undo,redo,link,unlink,code,image,uploadimage,uploadattachment", theme_advanced_buttons2: "", theme_advanced_buttons3: "", theme_advanced_toolbar_location: "top", theme_advanced_toolbar_align: "left", width : "660px", height: "1200", body_id :"article", valid_elements :"*[*]", skin: "wp_theme", relative_urls: false, content_css: "http://" + location.host + "/assets/screen.css", plugins: 'uploadimage,uploadattachment' }) 

But in my html, the nest condition is still removed by tinima. I have a html part like:

 <span class="text"> <p> Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum </p> </span> 

which becomes the following:

 <p> Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum </p> 

Tinymce removes the span outside the p tag. Other span tags are ok. I studied the muds again and again, but did not understand how to fix it.

Is there any way to fix this?

thanks a lot

+4
source share
3 answers

I think this is not possible to do on the tinymce side. Here is a post saying on the Tinymce forum: http://www.tinymce.com/forum/viewtopic.php?pid=98807#p98807

0
source

You will need to adjust the valid_children setting! I think p tags are not defined / allowed by default for child nodes.

0
source

Try something like extended_valid_elements : '+span[p]', in addition to the valid_children setting discussed above. And make sure you clear your cache completely to make sure it doesn't serve your old configuration file.

This should allow p be a child of the span

Additional information on this topic:
Alan Storm at Magento TinyMCE
Pixafy - Overcoming Magento TinyMCE

I know this is an old topic, but it still holds a high place in the search results, so hopefully this helps someone.

-one
source

Source: https://habr.com/ru/post/1394976/


All Articles