<font> vs <span>


(Karl Fredrik) #1

Hi all


Having some trouble editing font-sizes using the WYSIWYG editor. To realy prove my point I have stripped the site for all font tags (i.e. sizes) to see if the editor does anything at all.

Using the friendly UI I for example choose to set the font size to 14pt, by looking at the source-code before submitting, I can see that there has been applied a <font size="a size"> tag. After commiting, this tag is stripped and taken out for some reason. Anyone with similar issues?



I tried to manually set a <span> (with for instance style="font-size:0.8.em") and commit. This gets applied to the page. So to round-up, will the WYSIWYG editor apply a <span> in the future instead of <font>?



Anyone who knows a way around this problem?



Any feedback welcome!





Cheers

-Karl


(Rhulse) #2

[quote]Using the friendly UI I for example choose to set the font size to 14pt, by looking at the source-code before submitting, I can see that there has been applied a <font size=“a size”> tag. After commiting, this tag is stripped and taken out for some reason. Anyone with similar issues?
[right][post=“12711”]<{POST_SNAPBACK}>[/post][/right][/quote]

Is tidy running on your system? It may be set to move font tags which are no longer in the latest W3C Standards?



cheers,

Richard


(Rayn Ong) #3

Hi Karl,


When you use the font formatting plugin in the wysiwyg editor, you will get different results depending on the browser implementation of the execCommand method for DHTML object model. In particular, the FontSize command.



More information here:

execCommand method: Internet Explorer, Internet Explorer

FontSize command identifier: Internet Explorer



I can confirm that on Firefox 1.5, it adds <font size=“x”> tag when you use the font formatting plugin. You can submit a bug report, and the solution would be to intercept the FontSize command and replace it with our own implementation in the wysiwyg plugin code.



Edited to add:

Richard is right about the HTMLTidy. If you have it enabled, it will remove <font> tags which are now deprecated.


(Greg Sherwood) #4

Note that this would be treated as a feature request rather than a bug report as the WYSIWYG code would need to be rewritten to implement it's own FontSize implementation.


(Karl Fredrik) #5

I tested it in IE as well and the same <font> tagging occurs.

Since the <font> tagging has deppricated, will this be fixes by squiz staff sooner rather than later? And is this a known problem for v8 and v10 as well?

Karl

(Greg Sherwood) #6

From what Rayn is saying, this is caused by the way the browser set's font size. We'd have to rewrite our own implementation of the font size plugin. This would be considered a feature request and would only be added to the development version.


Have you considered using styles instead of setting the font size directly?


(Karl Fredrik) #7

I have applied styles to the site but this limits the person that has an update request, i.e. when they want to change the font size or color this will not happen since the CSS already have these attributes defined.

Find it a bit strange that the WYSIWYG editor is not W3C compliant or produces compliant code.

Anyways will try to find a way around it.

Cheers,
Karl

(Avi Miller) #8

[quote]Find it a bit strange that the WYSIWYG editor is not W3C compliant or produces compliant code.
[right][post=“12773”]<{POST_SNAPBACK}>[/post][/right][/quote]



Actually, this is the fault (as we’ve said) of the browsers – they don’t produce W3C compliant code. The WYSIWYG editor is just a view into the browser’s internal code creation/exposure mechanisms. We have had to override bad browser behaviour before, so your best bet is to log this as a feature request so that one of our developers can look at it in the future.