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

How to change the "format" options

Hi Guys,

Can someone please help me how can I change the contents of Formats dropdown?

At the moment, default values are: Paragraph, Code, Quotation, Heading 1 etc.

I want to remove the Code, Quotation and add a new custom Format called "My Paragraph".

I have gone through the documentation and apparently, it is not listed.

Help will be appreciated.

Cheers.

5 Replies

PO Prince Oliver Syncfusion Team November 22, 2018 03:09 PM UTC

Hi Fahad , 
 
Thank you for contacting Syncfusion support. 
 
We suggest you modify the existing “format” option using “Format” property as shown below. 
 
View: 
@Html.EJS().RichTextEditor("default").Format((object)ViewBag.types).ActionBegin("onBegin").Render() 
<script> 
    function onBegin(e) { 
        alert(e.element.textContent + " is Selected"); 
    } 
</script> 
 
Controller: 
public ActionResult Index() 
        { 
 
            object format1 = new 
            { 
                text = "Paragraph", 
                value = "P" 
            }; 
            object format2 = new 
            { 
                text = "My Paragraph", 
                value = "BlockQuote" 
            }; 
            object format3 = new 
            { 
                text = "Heading 1", 
                value = "H1" 
            }; 
            object format4 = new 
            { 
                text = "Heading 2", 
                value = "H2" 
            }; 
 
            ViewBag.types = new 
            { 
                width = "40px", 
                types = new[] { format1, format2, format3, format4 } 
            }; 
            return View(); 
 
 
        } 
 
If the newly added item has any predefined format , you can mention that format in value. Else if you want to perform custom action , then you can get the selected item through actionBegin event of RTE and perform required action there. Now the items will be displayed in toolbar as shown below 
 
 
 
We have attached a sample for your reference which can be downloaded from the below link 
 
Please let us know if you require any further assistance on this. 
 
Regards, 
Prince 



FK Fahad Khalil November 26, 2018 04:13 AM UTC

Thanks! I will give it a go.


PO Prince Oliver Syncfusion Team November 26, 2018 06:06 AM UTC

Hi Fahad , 

Most welcome. We are glad to help you. Please let us know if you require any further assistance on this. 

Regards, 
Prince 



FK Fahad Khalil November 26, 2018 01:10 PM UTC

Works like a charm. Thanks.


PO Prince Oliver Syncfusion Team November 27, 2018 04:18 AM UTC

Hi Fahad ,  

Thank you for your update. We are glad that the issue is resolved in tour end. 

Regards,  
Prince 


Loader.
Live Chat Icon For mobile
Up arrow icon