This is a migrated thread and some comments may be shown as answers.

RadMarkupDialog Strips P Tag

2 Answers 33 Views
Form
This is a migrated thread and some comments may be shown as answers.
Mung
Top achievements
Rank 1
Mung asked on 27 Mar 2015, 02:46 PM
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 Answers, 1 is accepted

Sort by
0
Mung
Top achievements
Rank 1
answered on 27 Mar 2015, 02:48 PM
I should add: Example #4 behaves how I expect.
0
Hristo
Telerik team
answered on 01 Apr 2015, 02:19 PM
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.

 
Tags
Form
Asked by
Mung
Top achievements
Rank 1
Answers by
Mung
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or