I am encountering a problem with style attributes. If I create and edit text in the FCKeditor and apply some styles to it by selecting the text and choosing a font from the Font pulldown menu, the HTML that is generated is something like the following:
<p><span style="font-family: Tahoma;"><strong>More test text</strong></span></p>
I save the text to the database, and then open the editor again, passing in the string above as the text to start with. However, when the editor displays the text, the style attribute values have been removed. This is what is displayed in the editor when I look at the source:
<p><span style=""><strong>More test text</strong></span></p>
This is happening with every style that is applied via the span tag.
Here's another example:
Created by FCKeditor when I select text and apply a Font and a Size to the font:
<p><span style="font-size: large;"><span style="font-family: Comic Sans MS;">Test Text Style</span></span></p>
Source of text in FCKeditor when I pass the above string back into FCKeditor:
<p><span style=""><span sans="" comic="" style="">Test Text Style</span></span></p>
Is there something I need to do with the configuration files to get those style attribute values retained? It seems really weird that the style attributes are created in this way by FCKeditor, and then FCKeditor strips them out when you go back to edit the text again.
Thanks,
Pam
<p><span style="font-family: Tahoma;"><strong>More test text</strong></span></p>
I save the text to the database, and then open the editor again, passing in the string above as the text to start with. However, when the editor displays the text, the style attribute values have been removed. This is what is displayed in the editor when I look at the source:
<p><span style=""><strong>More test text</strong></span></p>
This is happening with every style that is applied via the span tag.
Here's another example:
Created by FCKeditor when I select text and apply a Font and a Size to the font:
<p><span style="font-size: large;"><span style="font-family: Comic Sans MS;">Test Text Style</span></span></p>
Source of text in FCKeditor when I pass the above string back into FCKeditor:
<p><span style=""><span sans="" comic="" style="">Test Text Style</span></span></p>
Is there something I need to do with the configuration files to get those style attribute values retained? It seems really weird that the style attributes are created in this way by FCKeditor, and then FCKeditor strips them out when you go back to edit the text again.
Thanks,
Pam
Re: value of style attribute is removed
Andre
Re: value of style attribute is removed
you are right _and_ wrong.
FCKeditor does indeed strip the attribute value of the "style" attribute, but not on data entry or save (that's easily confirmed by looking at the generated HTML) BUT on LOAD!
can anybody point to a solution for this!
i tried lots of things, including removing "style" and "class" from the fckconfig.js "Remove Attributes" List. No Luck - it gets still removed on load which makes the "font size" and "font face" selectors (and the whole wysiwyg part) quite useless for me!
the only change I made to the configuration file after doing a clean reinstall was to FCKConfig.ToolbarSets["Default"].
thanks in advance!
jeff
Re: value of style attribute is removed
So my - very speculative - deduction is, that the attribute value(s) are touched during the JS generation done by the PHP FCKeditor class.
I hope this helps anybody,
Regards, Jeff
Re: value of style attribute is removed
This would match the results some other people have posted here - that the PHP FCKeditor class has peculiarities when loading initial data. I don't use the PHP helper, so I don't know. I'm guessing there's a trick to getting it to load properly - I just don't know what it is.
Re: value of style attribute is removed
Hi jlebowski ,
May I know how to inclusion method from php to javascript?
I am facing similar issue, and am loading the editor using javascript.
whenever i .setData or .SetHtml, style got stripped
Thanks in advanced.
Re: value of style attribute is removed
I read this thread and I have exact the same problem.
It seems there is a solution, so I am very eager to here it.
The original poster didn't answer the last question and I found no other thread about this issue.
So please! Does anyone know the solution, so I can use this editor. I looks if it's a fully functioned editor but in this way useless for me.
I need to find out how to add my own classe to the style list, but that's not urgent until this issue is solved.
'From Holland with love'
Piet