Rad Editor adds line break to empty content in Firefox

4 posts, 0 answers
  1. Albert Shenker
    Albert Shenker avatar
    579 posts
    Member since:
    Mar 2004

    Posted 15 Sep 2009 Link to this post

    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?
  2. Rumen
    Rumen avatar
    14028 posts

    Posted 18 Sep 2009 Link to this post

    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,
    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.
  3. Erik
    Erik avatar
    28 posts
    Member since:
    Aug 2010

    Posted 25 Aug 2014 in reply to Rumen Link to this post

    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.
  4. Ianko
    Ianko avatar
    1890 posts

    Posted 26 Aug 2014 Link to this post

    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.


    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.

Back to Top