Has anyone ever managed to prevent TinyMCE from stripping <span>
tags when moving between the SOURCE and PREVIEW state in the text editor? We need to be able to apply some inline styles to elements in the body cotnent area - but TinyMCE bins al the <span>
tags!
There is a system setting tinymcerte.valid_elements
(valid_elements), but there you would have to define all the elements you want to allow.
TinyMCE also has a setting extended_valid_elements. There is no explicit system setting for that, but you probably could add it to the system setting tinymcerte.settings
with a value like {"extended_valid_elements":"span[*]"}
.
Or you could provide an external config file with the setting tinymcerte.external_config
.
Thanks - yeh, i’ve tried the external config - doesnt seem to make any difference. Some weird behaviour going on with the RTE - if I add in some markup in the source window and hit ok, it collapses it all into a single <p>
element…
It seems adding anything into the Valid_elements field breaks TinyMCERTE!
Entering a “valid_elements” setting with just the span tag would indeed break it. “extended_valid_elements”, however, shouldn’t.
Sadly it does… I binned tinyMCE in the end and used the Markdown Editor - seems a lot more stable!
I’d have to see your setup. I use this on existing sites with no problem.
This works well for me [for allowing <dfn>
tags]:
{"extended_valid_elements":"dfn[*]"}
thanks @halftrainedharry