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

[Solved] ConvertFontToSpan overlapping p,span introduces  

2 Answers 125 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 09 Jul 2009, 09:50 PM

I have been working on a problem related to use of the default content filters in RadEditor, and have reduced the problem to:

If ConvertFontToSpan is enabled, then, if the HTML has "overlapping" P and SPAN elements (I believe that this is invalid HTML), e.g.

<p>
<span>
</p> 
text

</span>

then, when the default content filtering is done, the result inclues an &nbsp:

<span>
<p>&nbsp;</p>
text </span>


This can be demonstrated by using the online demo at:

http://demos.telerik.com/aspnet-ajax/editor/examples/builtincontentfilters/defaultcs.aspx

and switching to HTML view, first replacing the HTML with:

<p>
<span>
</p> 
text

</span>

then switching to design view and then back to HTML view again, at which time, the contents are:

<span>
<p>&nbsp;</p>
text </span>

Disabling ConvertFontToSpan and repeating this results in:

<p><span>text </span></p>
text

No &nbsp;

So, I am wondering: Although the input is invalid, is ConvertFontToSpan doing the right thing by introducing a non-break space?

I am not sure.

-Jon





2 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 15 Jul 2009, 06:36 AM
Hello Jon,

Indeed, the initial content is not well formed and our recommendation is to not load or paste such content in the editor, if it is possible. 

What you can do in this scenario is to disable the ConvertFontToSpan filter, because this filter deletes the <span> tag and converts it to <font> and vice versa. Therefore the content will be broken because when the span tag is deleted the closing </p> tag will be removed too. This is how this filter works.

You can use the following server code to disable the ConvertFontToSpan filter:

RadEditor1.DisableFilter(EditorFilters.ConvertFontToSpan);

This should fix the problem.

Kind regards,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jon
Top achievements
Rank 1
answered on 15 Jul 2009, 12:42 PM
Rumen,

Re: disabling ConvertFontToSpan. I have done so and, as expected, this works.

Thanks.
-Jon
Tags
Editor
Asked by
Jon
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Jon
Top achievements
Rank 1
Share this question
or