Change default html output

3 posts, 0 answers
  1. Bryan
    Bryan avatar
    2 posts
    Member since:
    Jul 2013

    Posted 09 Jul 2013 Link to this post

    When I save off text from the RadEditor, it saves it into html formatting. Is there a way within RadEditor that I can define how to save specific elements? 

    I would like to replace the <p>, <br>,<strong>, and <em> tags (possibly others as well) with something else. I realize this is possible through something like a string.replace, but I'm wondering if there is also a way within RadEditor itself.

    For instance, this is the output that RadEditor currently provides:
    <ol>
        <li>numbered list one</li>
        <li>numbered list two</li>
    </ol>
    <ul>
        <li>bullet list one</li>
        <li>bullet list two</li>
    </ul>
    <p><strong>bold word</strong><br />
    <br />
    <em>italics word</em></p>

    and this is what I would like it to be:
    <ol>
        <li>numbered list one</li>
        <li>numbered list two</li>
    </ol>
    <ul>
        <li>bullet list one</li>
        <li>bullet list two</li>
    </ul>
    & #013;
    & #013;
    <span style="font-weight:bold">bold word</span>
    & #013;
    & #013;
    <span style="font-style:italic">italics word</span>
  2. Ivaylo
    Admin
    Ivaylo avatar
    37 posts

    Posted 11 Jul 2013 Link to this post

    Hello Bryan,

    Thank you for contacting us.

    I am afraid that RadEditor does not support this functionality out-of-the-box. However, you can easily implement it, as you yourself have suggested, by using the get_html() and set_html() methods of the control and a custom regular expression.

    Keep in mind that the content might lose its XHTML compliance in case of manual editing of the mark-up.

    I hope that you will find the information helpful. Should you have any other questions, do not hesitate to contact us.

    Regards,
    Ivaylo
    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. Bryan
    Bryan avatar
    2 posts
    Member since:
    Jul 2013

    Posted 12 Jul 2013 Link to this post

    Thanks for the response Ivaylo, I'll just work on a custom solution for this. 
Back to Top