InsertParagraph inserts div tag when NewLineMode=DIV

5 posts, 0 answers
  1. Dennis
    Dennis avatar
    9 posts
    Member since:
    Jan 2013

    Posted 04 Oct Link to this post

    In the RadEditor we have the NewLineMode set to Div...

    Me.NewLineMode = EditorNewLineModes.Div

    We are also using a ToolsFile xml document to control the tools available in RadEditor.

    The problem is the InsertParagraph tool now inserts <div> tags instead of <p> tags.

    We want to keep the NewLineMode behavior as DIV while still having a tool that can insert a paragraph (i.e. a <p> tag).

    How can we do this?

     

  2. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 05 Oct Link to this post

    Hi,

    Are you sure that the InsertParagraph command inserts a div tag when the NewLineMode is set to DIV? Am I asking because I am unable to reproduce this behavior when I switch the NewLineMode to DIV in the live demo -> the InsertParagraph tool is inserting a paragraph.

    Nevertheless, if you'd like you can overwrite the command using the following code as a base:

    <script type="text/javascript">
    function OnClientCommandExecuting(editor, args)
    {
        if("InsertParagraph" == args.get_commandName())
        {
            editor.pasteHtml("<p> </p>");
            args.set_cancel(true);
        }
    }
    </script>
    <telerik:radeditor runat="server" ID="RadEditor1" NewLineMode="Div" OnClientCommandExecuting="OnClientCommandExecuting"></telerik:radeditor>



    Regards,
    Rumen
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dennis
    Dennis avatar
    9 posts
    Member since:
    Jan 2013

    Posted 05 Oct in reply to Rumen Link to this post

    In the RadEditor demo, first set "NEW LINES AS" to "Divs".

    Then, in the editor content area just above the "Destinations" table, Type in three lines:

    Comment1

    Comment2

    Comment3

    If you then toggle to the HTML tab, you will see that the Comment1 line is (incorrectly) bracketed by a <p> tag while the Comment2 and Comment3 lines are (correctly) bracketed by <div> tags.

    Next, go back to the Design tab and position yourself at the beginning of the Comment3 line then click the [Insert Paragraph] button.

    In the newly inserted "paragraph" type "Comment2b".

    If you then toggle to the HTML tab you will see that Comment2b is incorrectly bracketed by a <div> tag.

     

    Regarding your suggested solution, in our application we have created an inherited control for the RadEditor so that we have consistent behavior throughout our application without having to set the attributes for each individual RadEditor instance in markup or Javascript. 

    How would I accomplish your Javascript example in code-behind using VB.NET?

    Dennis

  5. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 07 Oct Link to this post

    Hello,

    Thank you for the bug report.Can you please log it in our public feedback portal?

    As to the workaround, you can see how to execute script code through the codebehind in the following pages:
    http://stackoverflow.com/questions/9235017/asp-net-vb-call-javascript-function-from-code-behind
    http://stackoverflow.com/questions/7673795/call-javascript-from-vb-net-code-behind
    http://www.devcurry.com/2009/01/execute-javascript-function-from-aspnet.html

    This is needed because the InsertParagraph tool is a client-side functionality that is executed in the browser and it is not possible to be controlled on the server.

    Best regards,
    Rumen
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  6. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 10 Oct Link to this post

    Hi there,

    For reference I'd like to post here your bug report https://feedback.telerik.com/Project/108/Feedback/Details/203023-new-post-in-insertparagraph-inserts-div-tag-when-newlinemode-div-and-should-inser and add that your Telerik points have been updated.

    Best regards,
    Rumen
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017