We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

RichTextEditor - body style

Hi, 

I would like to remove default formating for RTE. If i create blank document everything is alright. But when I want to edit it RTE insert before my code this html and broke all my formating. 

<html><head> <meta charset="utf-8"> <style>html,body{height:100%;width:100%;} body{font-family:Times New Roman,Times,serif;display:inline-block;}.e-rte-table caption{border: 1px solid;border-bottom:none}body{color:#5C5C5C;margin: 0px;text-indent: 8px;}</style></head><body autocorrect="off" contenteditable="true">

Is it possible to disable this? Or just disable <style>...</style> section?

Thanks for your reply.

1 Reply

AP Arun Palaniyandi Syncfusion Team March 3, 2016 11:27 AM UTC

Hi Jan,

Thanks for contacting Syncfusion support.

Query :  “I would like to remove default formating for RTE. Is it possible to disable this? Or just disable <style>...</style> section?”
          
You can achieve this by triggerring RTE create function and insert a required HTML into the document element.


Please find to the below code snippet:

<code>

#view

@{   

Html.EJ().RTE("rteSample").Width("100%").Height("380px").ClientSideEvents(e => e.Create("RTEcreate")).Render();

}

<script type="text/javascript">

    function RTEcreate(args)

    {

        var rteInstance = $("#rteSample").data("ejRTE");

        // Insert HTML tag

        rteInstance.getDocument().documentElement.innerHTML = "<head></head><body>RTE sample</body>";

    }

</script>

</code>

We have prepared a sample to meet your requirement. Please find the sample from the link: :  http://www.syncfusion.com/downloads/support/forum/123268/ze/MVCsample527264439


Note: If you remove default styles in RTE document, you will see the below cases :
            1).In dark theme, RTE contents will not be shown because of removed body color  (
body{color:#5C5C5C;margin: 0px;text-indent: 8px;}).
            2). Border will not be applied when using table caption because of removed caption border (
.e-rte-table caption{border: 1px solid;border-bottom:none}) .
            3). Body height is considered and calculated based on inner content because of removed body height (
html,body{height:100%;width:100%;})
            4).Font family dropdown will not be selected initially because of removed default font family (
body{font-family:Times New Roman,Times,serif;display:inline-block;}) .


Please let us know the complete issue details, so that we can analyze more and provide an efficient solution.

Regards,
Arun P


Loader.
Live Chat Icon For mobile
Up arrow icon