Hi,
When the user selects a font or color and starts typing, in automatically creats the text inside font tag.
For example: <font face="Arial">Nice Text</font> or <font color="#ffffff">Nice Text</font>.
I want to prevent the editor from using the FONT tag in all functions.
So with the above example, the output should be:
<span style="font-face: Aria"">Nice Text</span> or <span style="font-color:#ffffff">Nice Text</span>
I searched online but didn't find a full answer for this.
Any help would be appreciated.
Thanks
I don't see any advantage.
I don't see any advantage. The problem with allowing users to insert inline font tags is that if you later decide to change the font, you have literally hundreds of tags to modify. Spans with a font attribute would have exactly the same issue.
The right way to do this is to provide the user with a limited set of styles in a dropdown. Each style just sets a class attribute, the actual styling being in separate css. See the instructions on how to add items to the styles (H1, H2 etc) dropdown.
Thanks for the answer, but
Thanks for the answer, but the thing is that after the user enters his text, I then send the text to and external text editor that is creating effects on the text.
And, this editor detects only span and div tags and not font tags.
Does someone knows how to configure the editor in such way?
The method I outlined will
The method I outlined will allow the user to add divs or spans to the text.
http://docs.ckeditor.com/#!/guide/dev_styles
Though, one issue with spans is that they don't show up in the editor. This can make things confusing. Divs do show, but unless you set display:inline they will cause unwanted line breaks. They also can't be placed inside paragraphs regardess of display setting, whereas IIRC font tags can be placed inside a para but are (for some obscure reason) not supposed to enclosed multiple paras.
The other approach would be to postprocess the document in php or similar. str_ireplace would probably suffice for replacing instances of </font> with </span> whist a preg_replace regular expression would be best for converting the font opening tags to spans. Bear in mind that the correct css syntax is 'font-family' not 'font-face' so you would need to convert this too.
I think if it was me I'd go for the postprocessing option, especially if you're handing-off the text to another program anyway. You could probably manage it with javascript at a pinch, although php is generally better for such tasks.
I want to read only DUMET
I want to read only DUMET