Editor inserts h2 tag instead of line break

2 posts, 0 answers
  1. Ivan
    Ivan avatar
    16 posts
    Member since:
    Oct 2011

    Posted 19 Jun 2013 Link to this post


    I have the following scenario:
    1. configure editor to use br as a line breaks
    2. insert mark up into editor

    3.in design mode set cursor before the "text2" and press enter to add an empty line
    4. switch to html mode - you get the following mark up
    an extra h2 tag is added instead of br. How this can be fixed?
  2. Nikolay
    Nikolay avatar
    98 posts

    Posted 24 Jun 2013 Link to this post


    Thank you for reporting this problem.

    I have created a public item for this issue, so that you can monitor its progress, comment and vote on it here. However, I am sorry to say that I cannot guarantee with any time bound for the fix, as our developers are currently working on already scheduled tasks of RadEditor that have also high priority.

    For the time being, I have prepared the following workaround:
    <telerik:RadEditor ID="RadEditor1" runat="server" OnClientCommandExecuted="OnClientCommandExecuted">
    <script type="text/javascript">
        function OnClientCommandExecuted(editor, args)
            if (args.get_commandName() == 'EnterNewLine')
                    var selectedElement = editor.getSelectedElement();
                    if (selectedElement && selectedElement.previousSibling &&
                        selectedElement.nodeName == selectedElement.previousSibling.nodeName &&
                        var br = editor.get_document().createElement('br');
                        var extraElement = selectedElement.previousSibling;
                }, 0);

    I have handled the OnClientCommandExecuted event and if the executed command is EnterNewLine check for an extra element.
    You can see how it behaves in this screencast: http://screencast.com/t/1ntRtGOURlo

    I have also update your Telerik points for reporting this problem.

    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