- Home
- Forum
- ASP.NET MVC - EJ 2
- Disable Image on RichTextEditor
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?
SIGN IN To post a reply.
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 |
Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/RTE_deniedImageTag-829520506
In above sample, we have used inline mode Rich Text Editor component and denied the image tag when pasting operation performed.
API link: https://ej2.syncfusion.com/documentation/api/rich-text-editor/pasteCleanupSettingsModel/#deniedtags
Let us know if you need any further assistance on this.
Regards,
Prince
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
JG James Gaston
- Apr 23, 2019 05:50 PM UTC
- Apr 24, 2019 07:25 AM UTC