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

Rad Editor adds line break to empty content in Firefox

3 Answers 72 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Albert Shenker
Top achievements
Rank 1
Veteran
Albert Shenker asked on 16 Sep 2009, 03:47 AM
If you load an editor with some content, and then delete all the content (by using the keyboard delete key), the "Content" property of the edirot contains a rogue "<br />" tag when it should be empty. This is true even if the original content never occuped more than one line.This only seems to occur in Firefox. Is there any way to avoid this <br /> tag?

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 18 Sep 2009, 03:20 PM
Hello Albert,

The observed behavior is due to the Rich Text Editing engine of Firefox and it is not caused by code in RadEditor source. The browser automatically ads a <br> tag when the content area is empty.

What you can do is make a check and if the content area contains only a single <br> tag to strip it.

All the best,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Erik
Top achievements
Rank 1
answered on 25 Aug 2014, 10:19 AM
Is there a better solution for this problem availble yet?

I would like to check whether mandatory fields are filled in. I can not know whether the user inserted a linebreak or Firefox did it after the user empied the control.
0
Ianko
Telerik team
answered on 26 Aug 2014, 03:45 PM
Hi Erik,

I suggest first verifying if the ConvertToXhtml filter is not disabled. This filter provides a logic to strip the unwanted BR tag.

If the filter is enabled, then the only possible way to resolve this browser behavior is by implementing the suggested logic by Rumen.

Note that a BR tag is added when Enter or Shift+Enter is pressed, therefore in every case only a blank new line still is blank content area. So the suggested logic should fir your requirements.

Regards,
Ianko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Editor
Asked by
Albert Shenker
Top achievements
Rank 1
Veteran
Answers by
Rumen
Telerik team
Erik
Top achievements
Rank 1
Ianko
Telerik team
Share this question
or