Forums / Setup & design / ezoe span tags
Mads Ovesen
Friday 23 April 2010 8:58:28 am
Hi everyone,
Is there a way to prevent the online editor (ezoe) from removing span-tags, when I press 'send for publishing'? The reason is, that I want to add a text-color button to the editor. When I set a color the editor produces a span-tag with a style on it, which is removed again when I publish.
Thanks
/m
Peter Keung
Friday 23 April 2010 1:24:04 pm
You should implement it as a custom tag. So then your custom tag has an attribute "color" that you can output in the template as:
<span style="color: {$color};">{$content}</span>
http://www.mugo.ca Mugo Web, eZ Partner in Vancouver, Canada
Saturday 24 April 2010 8:17:11 am
Yes, that is of course one solution, but not so user friendly. The custom tag is not obvious to users. And besides, the tinymce editor already has a text-color button, and does already produce the correct output. It is just a matter, that eZ publish removes thee tags. But if the custom tag is the only solution, I guess there is no other way around this problem.
Nicolas Pastorino
Saturday 24 April 2010 9:19:52 am
Hi Mads,
Instead of a span, can't you make it a <div>, which is not removed on publishing, to which a CSS class is systematically applied, making the <div> an inline entity ?
Cheers,
-- Nicolas Pastorino Director Community - eZ Member of the Community Project Board eZ Publish Community on twitter: http://twitter.com/ezcommunity t : http://twitter.com/jeanvoye G+ : http://plus.tl/jeanvoye
Thursday 29 April 2010 6:58:59 am
Hi,
Thank you Peter and Nicolas for your comments. I looked through the code, and I saw that the editor actually accepts span-tags, just only with very specifc style-attributes. For example the editor will convert <span style="font-weight:bold"> to <bold>. I could also add my styles here, with the risks this hack implies. Else i'll have to try the div solution.