RadMarkupDialog Strips P Tag

3 posts, 0 answers
  1. Mung
    Mung avatar
    2 posts
    Member since:
    Mar 2015

    Posted 27 Mar 2015 Link to this post

    Hello - I am trying to use RadMarkupDialog for HTML editing; however, it strips wrapping P tags. This behavior occurs when I click Save from the Markup tab, and also when I switch from the Markup tab to the Design tab. I've seen information on stopping this behavior in ASP.Net, but not in WinForms. Is there a way to make it behave correctly?
    Thanks,
    Matt

    For examples:
    1.
    currentText = "<p>some text</p>"
    Dialog is shown and Value is set to currentText; Design mode shows "some text"; switch to Markup and it shows "some text" (no wrapping P tag)

    2.
    currentText = "some text"
    Dialog is shown; switch to Markup and edit text to "<p>some text</p>"; click save
    Code is returned "<html>some text</html>" (that it is wrapped in the HTML tag is expected from what I understand)

    3.
    currentText = "some text"
    Dialog is shown; switch to Markup and edit text to "<p>some text</p>";
    Switch to Design mode and then back to Markup mode; editor now shows "some text"

    4.
    currentText = "some text"
    Dialog is shown; switch to Markup and edit text to "<p>some text</p><p>some other text</p>"
    Code is returned "<html><p>some text</p><p>some other text</p></html>
  2. Mung
    Mung avatar
    2 posts
    Member since:
    Mar 2015

    Posted 27 Mar 2015 in reply to Mung Link to this post

    I should add: Example #4 behaves how I expect.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    710 posts

    Posted 01 Apr 2015 Link to this post

    Hi Mung,

    Thank you for writing.

    The behavior which you describe is by design. Internally the RadMarkupEditor hosted in the RadMarkupDialog element works with a filters collection contained in the FiltersManager class. One of the filters is responsible for removing a parent paragraph tag if the whole content is inside it. This is the reason why the <p></p> tag is removed in the described scenario.

    You can achieve the same result a <br /> tag like this: 
    some text<br />

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top