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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change the "format" options

Thread ID:

Created:

Updated:

Platform:

Replies:

141071 Nov 21,2018 02:52 PM UTC Nov 27,2018 04:18 AM UTC ASP.NET MVC - EJ 2 5
loading
Tags: RichTextEditor
Fahad Khalil
Asked On November 21, 2018 02:52 PM UTC

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.

Prince Oliver [Syncfusion]
Replied On 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 


Fahad Khalil
Replied On November 26, 2018 04:13 AM UTC

Thanks! I will give it a go.

Prince Oliver [Syncfusion]
Replied On 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 


Fahad Khalil
Replied On November 26, 2018 01:10 PM UTC

Works like a charm. Thanks.

Prince Oliver [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;