{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "rich-text-editor-paste-from-ms-word",
  "framework": "javascript",
  "type": "registry:component",
  "component": "RichTextEditor",
  "variant": "paste-from-ms-word",
  "dependencies": [
    "@syncfusion/ej2-richtexteditor"
  ],
  "description": "Rich text editor sample cleaning paste content from Microsoft Word automatically.",
  "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/javascript/llms.txt",
    "skillPack": "syncfusion/javascript-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/javascript/rich-text-editor-paste-from-ms-word.md"
  },
  "files": [
    {
      "target": "src/components/rich-text-editor-paste-from-ms-word/rich-text-editor.html",
      "content": "<div class=\"col-lg-8 control-section\">\n    <div class=\"control-wrapper\">\n        <div class=\"sample-container\">\n            <div class=\"default-section\">\n                <div id=\"container\">\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><strong>Prompt </strong>- specifies whether to enable the prompt when pasting in Rich Text Editor\n                    </li>\n                    <li><strong>Plain Text </strong>- specifies whether to paste as plain text or not in Rich Text Editor.\n                    </li>\n                    <li><strong>Keep Format</strong>- specifies whether to keep or remove the format when pasting in Rich Text Editor.\n                    </li>\n                    <li><strong>Denied Tags</strong> - specifies the tags to restrict when pasting in Rich Text Editor.\n                    </li>\n                    <li><strong>Denied Attributes</strong> - specifies the attributes to restrict when pasting in Rich Text Editor.\n                    </li>\n                    <li><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                </div>\n            </div>\n        </div>\n    </div>\n</div>\n<div class=\"col-lg-4 property-section\">\n    <div title=\"Properties\">\n        <table id=\"property\" title=\"Properties\">\n            <tbody>\n                <tr>\n                    <td>\n                        <div>Format Option</div>\n                    </td>\n                    <td>\n                        <div>\n                            <select id=\"formattingOption\"> \n                                <option value=\"prompt\">Prompt</option>\n                                <option value=\"plainText\">Plain Text</option>\n                                <option value=\"keepFormat\">Keep Format</option>\n                                <option value=\"cleanFormat\">Clean Format</option>\n                            </select>\n                        </div>\n                    </td>\n                </tr>\n                <tr>\n                    <td>\n                        <div>Denied Tags </div>\n                    </td>\n                    <td>\n                        <div>\n                            <input id=\"deniedTags\" type=\"text\" class=\"e-input\" placeholder=\"'img[!href]', 'h1'\">\n                        </div>\n                    </td>\n                </tr>\n                <tr>\n                    <td>\n                        <div>Denied Attributes </div>\n                    </td>\n                    <td>\n                        <div>\n                            <input id=\"deniedAttributes\" type=\"text\" class=\"e-input\" placeholder=\"'id', 'title'\">\n                        </div>\n                    </td>\n                </tr>\n                <tr>\n                    <td>\n                        <div>Allowed Style Properties </div>\n                    </td>\n                    <td>\n                        <div>\n                            <input id=\"allowedStyleProperties\" type=\"text\" class=\"e-input\" placeholder=\"'href', 'style'\">\n                        </div>\n                    </td>\n                </tr>\n            </tbody>\n        </table>\n    </div>\n</div>"
    },
    {
      "target": "src/components/rich-text-editor-paste-from-ms-word/rich-text-editor.ts",
      "content": "import { RichTextEditor, Toolbar, Link, Image, HtmlEditor, QuickToolbar, PasteCleanup, Table, Video, Audio, ClipBoardCleanup, AutoFormat } from '@syncfusion/ej2-richtexteditor';\nimport { DropDownList } from '@syncfusion/ej2-dropdowns';\nimport { isNullOrUndefined } from '@syncfusion/ej2-base';\nRichTextEditor.Inject(Toolbar, Link, Image, HtmlEditor, QuickToolbar, Table, PasteCleanup, Video, Audio, ClipBoardCleanup, AutoFormat);\n\nexport function initRichTextEditorPasteFromMsWord(): void {\n    let defaultRTE: RichTextEditor = new RichTextEditor({\n        pasteCleanupSettings: {\n            prompt: true,\n            plainText: false,\n            keepFormat: false\n        }\n    });\n    defaultRTE.appendTo('#container');\n\n    let formatOption: DropDownList = new DropDownList({\n        index: 0,\n        popupHeight: '200px',\n        change: () => { valueChange(); }\n    });\n    formatOption.appendTo('#formattingOption');\n\n    function valueChange(): void {\n        if (formatOption.value === 'prompt') {\n            defaultRTE.pasteCleanupSettings.prompt = true;\n        } else if (formatOption.value === 'plainText') {\n            defaultRTE.pasteCleanupSettings.prompt = false;\n            defaultRTE.pasteCleanupSettings.plainText = true;\n        } else if (formatOption.value === 'keepFormat') {\n            defaultRTE.pasteCleanupSettings.prompt = false;\n            defaultRTE.pasteCleanupSettings.plainText = false;\n            defaultRTE.pasteCleanupSettings.keepFormat = true;\n        } else if (formatOption.value === 'cleanFormat') {\n            defaultRTE.pasteCleanupSettings.prompt = false;\n            defaultRTE.pasteCleanupSettings.plainText = false;\n            defaultRTE.pasteCleanupSettings.keepFormat = false;\n        }\n    }\n    let allowedStylePropsElem: HTMLElement = document.getElementById('allowedStyleProperties');\n    let deniedTagsElem: HTMLElement = document.getElementById('deniedTags');\n    let deniedAttrsElem: HTMLElement = document.getElementById('deniedAttributes');\n    allowedStylePropsElem.addEventListener('blur', (e: FocusEvent) => {\n        onPasteCleanupSettingsChange((e.target as HTMLInputElement).value, 'allowedStyleProps');\n        defaultRTE.dataBind();\n    });\n    deniedAttrsElem.addEventListener('blur', (e: FocusEvent) => {\n        onPasteCleanupSettingsChange((e.target as HTMLInputElement).value, 'deniedAttrs');\n        defaultRTE.dataBind();\n    });\n    deniedTagsElem.addEventListener('blur', (e: FocusEvent) => {\n        onPasteCleanupSettingsChange((e.target as HTMLInputElement).value, 'deniedTags');\n        defaultRTE.dataBind();\n    });\n\n    function onPasteCleanupSettingsChange(value: string, settingsProperty: string): void {\n        if (!isNullOrUndefined(value)) {\n            const arrayValue = value.split(',').map((item) => item.trim().replace(/^['\"]|['\"]$/g, ''));\n            defaultRTE.pasteCleanupSettings[settingsProperty] = arrayValue.filter((prop) => prop !== '');\n        }\n    }\n}\n"
    }
  ]
}