This is a migrated thread and some comments may be shown as answers.

Html re-write

4 Answers 51 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Niclas Ahlqvist
Top achievements
Rank 1
Niclas Ahlqvist asked on 09 Sep 2010, 01:54 PM
Hi!

We are in the process of upgrading the editor. We develop a software were you can design emails. The formatting of html is very important in various email clients. We have a problem with html designed in the older version of the editor is re-written in the newer version.

Examples
Original
<td width="32" height="35" align="left" valign="top"> </td>
rewritten to
<td style="text-align: left; width: 32px; height: 35px; vertical-align: top;"> </td>

Original
<img src="lasmer.jpg" width="120" height="62" align="right" />

rewritten to
<img alt="" width="120" height="62" style="float: right;" src="lasmer.jpg" />

As you see the height,width and valign attributes are re-written as inline styles.

This does not play well in outlook 2007,2010 which does not support inline style width,height, float + most of the styles.

Is there a workaround?

/Niclas

4 Answers, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 10 Sep 2010, 04:03 PM
Hi Niclas,

This is an expected behavior caused by the RadEditor's built-in content filter ConvertToXhtml. This content filter modifies the content to be XHTML compliant.

You can avoid this behavior by disabling the content filter, e.g.:
RadEditor1.DisableFilter(Telerik.Web.UI.EditorFilters.ConvertToXhtml)

Sincerely yours,
Dobromir
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Niclas Ahlqvist
Top achievements
Rank 1
answered on 13 Sep 2010, 12:51 PM
Hi!

Its great that you modify the content to be xhtml compliant. 

We used the Xhtml property of the older version of the editor to get the content as xhtml. In that version the code wasn't reformatted in the same way as it is now. And it is very important for us to get xhtml compliant code, but I cant see the use in removing xhtml compliant attributes as width, height and setting them i style instead. Is there a way to get the old xhtml convter in the new editor? =)

/Niclas
0
Dobromir
Telerik team
answered on 16 Sep 2010, 08:43 AM
Hi Niclas,

It is possible to use a content filter of older version of RadEditor. You can achieve this by overriding the getHtmlContent() function with the old one. However, the width and height attributes are not XHTML compliant and they have always been replaced with the style attribute, you can verify this using the XHTML Validator dialog of RadEditor.

My suggestion is to use the default XHTML converter filter and implement custom content filter to replace the style width and height rules to be applied as attributes.

You can find more information on how to implement custom content filter in the following live demo and help article:
Custom Content Filters
Content Filters 


Regards,
Dobromir
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Niclas Ahlqvist
Top achievements
Rank 1
answered on 04 Oct 2010, 07:14 AM
Hi!

I decided to make all the xhtml rewrite in code behind when the content is saved!

Thanks!
Tags
Editor
Asked by
Niclas Ahlqvist
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Niclas Ahlqvist
Top achievements
Rank 1
Share this question
or