Joomla TinyMCE deletes empty span

2019-07-31 16:36发布

问题:

I want to use following tag

<h4><span class="icon-phone"></span></h4>

but TinyMCE from Joomla always deletes it, when i save it.

I find the solution that i have to add span[*] to "Extended Valid Elements" in Options from TinyMCE in PluginManager. but it doesn't work. It always delete it again and again. I searched here for a while and found some articles which was similar to my problem but doesn't solve it.

I use Joomla Version 3.3.6 and the plugin is 4.1.2.

Hope somebody can help.

Best Regards, Dennis

回答1:

Welcome to TinyMCE, my most hated editor ever.

I've had the same problem multiple times and I believe it's because the editor expects content within the element. So try the following:

<h4><span class="icon-phone">&nbsp;</span></h4>

&nbsp; is simply a non breaking space



回答2:

go to: Joomla! administration - Extensions - Plugins - edit Editor - TinyMCE

Set the following parameter: Extended Valid Elements: span[class|style]

This works for me in Joomla! 3.5 (plugin version 4.3.3)