{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "rich-text-editor-paste-from-ms-word",
  "framework": "aspnet-mvc",
  "type": "registry:component",
  "component": "RichTextEditor",
  "variant": "paste-from-ms-word",
  "dependencies": [
    "Syncfusion.AspNetMvc.RichTextEditor",
    "Syncfusion.AspNetMvc.DropDowns",
    "Syncfusion.AspNetMvc.Inputs"
  ],
  "description": "Rich text editor configured to clean and preserve formatting when pasting content from Word.",
  "meta": {
    "essentialStudioRelease": "2026 Volume 3 (v35.1.37)",
    "license": "commercial-or-community",
    "licenseNote": "The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md",
    "requiresLicenseKey": true,
    "requiresServerEndpoint": false,
    "platformIndex": "https://ai.syncfusion.com/aspnet-mvc/llms.txt",
    "skillPack": "syncfusion/aspnetmvc-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/aspnet-mvc/rich-text-editor-paste-from-ms-word.md"
  },
  "files": [
    {
      "target": "src/components/rich-text-editor-paste-from-ms-word/RichTextEditor.cshtml",
      "content": "@using Syncfusion.EJ2\n@using EJ2MVCSampleBrowser.Models\n@using Syncfusion.EJ2.DropDowns\n@section ControlsSection{\n    <div class=\"col-lg-8 control-section\">\n        <div class=\"content-wrapper\" id=\"all-option-sample\">\n            @Html.EJS().RichTextEditor(\"pasteCleanUp\").ContentTemplate(@<text>\n                <h4>Paste Cleanup in Rich Text Editor<br></h4><p>The Rich Text Editor automatically <strong>cleans up formatted content</strong> when you paste from external sources like Word, Google Docs, or web pages.</p><p><b>Paste Cleanup properties:</b></p><ul>\n                    <li>\n                        <strong>Prompt </strong>- specifies whether to enable the prompt when pasting in Rich Text Editor\n                    </li>\n                    <li>\n                        <strong>Plain Text </strong>- specifies whether to paste as plain text or not in Rich Text Editor.\n                    </li>\n                    <li>\n                        <strong>Keep Format</strong>- specifies whether to keep or remove the format when pasting in Rich Text Editor.\n                    </li>\n                    <li>\n                        <strong>Denied Tags</strong> - specifies the tags to restrict when pasting in Rich Text Editor.\n                    </li>\n                    <li>\n                        <strong>Denied Attributes</strong> - specifies the attributes to restrict when pasting in Rich Text Editor.\n                    </li>\n                    <li>\n                        <strong>Allowed Style Properties</strong> - specifies the allowed style properties when pasting in Rich Text Editor.\n                    </li>\n                </ul><p><span><strong>Try It Out!</strong></span></p><p>Copy content from a web page or document and paste it here. The editor will display a prompt and allow you to input your options.</p>\n            </text>).Created(\"created\").PasteCleanupSettings(p => p.Prompt(true)).Render()\n        </div>\n    </div>\n\n    <div class=\"col-lg-4 property-section\" id=\"all-option-table\">\n        <div>\n            <table id=\"property\" title=\"Properties\">\n                <tbody>\n                    <tr>\n                        <td>\n                            <div>Format Option </div>\n                        </td>\n                        <td>\n                            <div>\n                                @Html.EJS().DropDownList(\"format\").PopupHeight(\"200px\").Index(0).DataSource(\n                    (IEnumerable<FormatOption>)ViewData[\"Data\"]).Change(\"formatChange\").Fields(new DropDownListFieldSettings { Text = \"Format\", Value = \"Id\" }).Render()\n                            </div>\n                        </td>\n                    </tr>\n                    <tr>\n                        <td>\n                            <div>Denied Tags </div>\n                        </td>\n                        <td>\n                            <div>\n                                @Html.EJS().TextBox(\"deniedTags\").Change(\"deniedTagsChange\").Placeholder(\"'img[!href]'\").Render()\n                            </div>\n                        </td>\n                    </tr>\n                    <tr>\n                        <td>\n                            <div>Denied Attributes </div>\n                        </td>\n                        <td>\n                            <div>\n                                @Html.EJS().TextBox(\"deniedAttributes\").Change(\"deniedAttrsChange\").Placeholder(\"'id', 'title'\").Render()\n                            </div>\n                        </td>\n                    </tr>\n                    <tr>\n                        <td>\n                            <div>Allowed Style Properties </div>\n                        </td>\n                        <td>\n                            <div>\n                                @Html.EJS().TextBox(\"allowedStyleProperties\").Change(\"allowedStyleChange\").Placeholder(\"'href', 'style'\").Render()\n                            </div>\n                        </td>\n                    </tr>\n                </tbody>\n            </table>\n        </div>\n    </div>\n}\n<script>\n    var rteObj;\n    function created() {\n        rteObj = this;\n    }\n    function formatChange() {\n        if (format.value === 'Prompt') {\n            rteObj.pasteCleanupSettings.prompt = true;\n        } else if (format.value === 'Plain Text') {\n            rteObj.pasteCleanupSettings.prompt = false;\n            rteObj.pasteCleanupSettings.plainText = true;\n        } else if (format.value === 'Keep Format') {\n            rteObj.pasteCleanupSettings.prompt = false;\n            rteObj.pasteCleanupSettings.plainText = false;\n            rteObj.pasteCleanupSettings.keepFormat = true;\n        } else if (format.value === 'Clean Format') {\n            rteObj.pasteCleanupSettings.prompt = false;\n            rteObj.pasteCleanupSettings.plainText = false;\n            rteObj.pasteCleanupSettings.keepFormat = false;\n        }\n   }\n\n    function deniedTagsChange(args) {\n        onPasteCleanupSettingsChange(deniedTags.value, 'deniedTags');     \n    }\n\n    function deniedAttrsChange(args) {\n        onPasteCleanupSettingsChange(deniedAttributes.value, 'deniedAttrs');\n    }\n\n    function allowedStyleChange(args) {\n        onPasteCleanupSettingsChange(allowedStyleProperties.value, 'allowedStyleProps');\n    }\n    function onPasteCleanupSettingsChange(value, settingsProperty) {\n        if (value) {\n            var arrayValue = value.split(',').map(function (item) {\n                return item.trim().replace(/^['\"]|['\"]$/g, '');\n            });\n            rteObj.pasteCleanupSettings[settingsProperty] = arrayValue.filter(function (prop) {\n                return prop !== '';\n            });\n        }\n    }\n</script>\n"
    },
    {
      "target": "src/components/rich-text-editor-paste-from-ms-word/RichTextEditorController.cs",
      "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing System.Web.Mvc;\nusing EJ2MVCSampleBrowser.Models;\n\nnamespace EJ2MVCSampleBrowser.Models\n{\n    public class FormatOption\n    {\n        public string Id;\n        public string Format;\n        public List<FormatOption> FormatOptions()\n        {\n            return new List<FormatOption>\n            {\n                new FormatOption { Id = \"1\", Format = \"Prompt\" },\n                new FormatOption { Id = \"2\", Format = \"Plain Text\" },\n                new FormatOption { Id = \"3\", Format = \"Keep Format\" },\n                new FormatOption { Id = \"4\", Format = \"Clean Format\" }\n            };\n        }\n    }\n}\n\nnamespace EJ2MVCSampleBrowser.Controllers\n{\n    public partial class RichTextEditorController : Controller\n    {\n        // GET: /<controller>/\n        public ActionResult PasteCleanup()\n        {\n            ViewData[\"Data\"] = new FormatOption().FormatOptions();\n            return View(\"~/Views/Home/rich-text-editor/paste-from-ms-word/RichTextEditor.cshtml\");\n        }\n    }\n}\n"
    }
  ]
}