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

Disable Image on RichTextEditor

I'm using the RichTextEditor in InLine Mode and I want to disable the image features, as pasting an image.

Is there any way to achieve that?

3 Replies

JG James Gaston April 23, 2019 06:19 PM UTC

I just found out... It's just to add PasteCleanupSettings(p => p.PlainText(true))
I had hidden the add image button already


PO Prince Oliver Syncfusion Team April 24, 2019 05:02 AM UTC

Hello James, 

Greetings from Syncfusion support. 

We are glad that you found the solution for your requirement. Please let us know if you need any further assistance on this. 

Regards, 
Prince 



PO Prince Oliver Syncfusion Team April 24, 2019 07:25 AM UTC

Hello James, 
 
You can also disable the images in the Rich Text Editor content using DeniedTags property in the PasteCleanupSettings when pasting an image. It will prevent image tags when pasting image element. In PlainText property, the copied content will be converted as a plain text by removing all the HTML tags and styles applied to it and only the plain text is pasted in the editor. If you wish to remove only on image tag, you can use DeniedTags property instead of using PlainText property. Please find the below code. 
 
[Index.cshtml] 
@*// You can use the Denied Tags property*@ 
 
@Html.EJS().RichTextEditor("image").InlineMode((object)ViewBag.inline).PasteCleanupSettings(p => p.DeniedTags(ViewBag.deniedTags)).Render() 
 
 [HomeController.cs] 
ViewBag.deniedTags = new string[] { "img" }; // Here, specify denied tags when paste the content 
 
In above sample, we have used inline mode Rich Text Editor component and denied the image tag when pasting operation performed. 
 
 
Let us know if you need any further assistance on this. 
 
Regards, 
Prince 


Loader.
Up arrow icon