Last space in the RadEditor is getting trimmed

4 posts, 0 answers
  1. Sudheera
    Sudheera avatar
    2 posts
    Member since:
    Sep 2013

    Posted 26 Sep 2013 Link to this post

    Hi,

    Text entered in RadEditor is not retaining the last space. I want the last space to be retained and not automatically trimmed.
    For Eg. If input text is "Sample Text  ", RadEditor trims the last space alone and the output is "Sample Text"

    But in case we apply any styles(bold/italic etc) to the text, then it is retaining the space, as expected by my requirement.

    Is there a way to retain the space at the end of the text? 

  2. Ianko
    Admin
    Ianko avatar
    1940 posts

    Posted 01 Oct 2013 Link to this post

    Hello Sudheera,

    I tried to reproduce the described behavior, but to no avail. I am attaching a sample project with an editor and a button for a post back. Please review it and test if the same problematic scenario is encountered.

    It would be helpful for me if you could modify the sample project, so that the problem could be reproduced with it and send it back to me.

    Currently I can suggest checking if there are some custom Client-side functionalities or content filters that could lead to the described issue.

    Regards,
    Ianko
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. Sudheera
    Sudheera avatar
    2 posts
    Member since:
    Sep 2013

    Posted 01 Oct 2013 Link to this post

    Hi,
    I can still reproduce the issue. Please find attached steps with snapshots of the issue being faced. I dont want the  last space to be trimmed automatically.

  4. Ianko
    Admin
    Ianko avatar
    1940 posts

    Posted 04 Oct 2013 Link to this post

    Hi Sudheera,

    Thank you for getting back to me.

    I would like to assure you that there is no built-in filter, the logic of which is to strip the last  . In the provided demo project I created initial content with such element. On my end nothing is being removed after a post back neither on switching from design to HTML view.

    In the provided snapshot I assume that you are using the space key, which appends a space character, which could be represented as a string value like that " " and not an  . If this is the case I would point out that the encounter behavior is related to the browsers' implementations and not the RadEditor control. 

    As a conclusion I could suggest you the following approaches:
    • Building a custom content filter that reads the HTML content of the editor and replaces the last white space with an   entity, if one exists.
    • Building a custom logic that wraps the whole text with a block element e.g. <div>, so that the white space will be preserved.
    • Override the keyboard event of the editor's content with function that inserts an &nbsp; rather than white space character when the space key is pressed. You could follow this forum post, in which an example for this approach is provided.


    Regards,
    Ianko
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top