Paste Cleanup

The Editor provides options for cleaning up pasted HTML content. This allows for greater control over the entered content and ensures that its styling is consistent. Cleaning up the pasted HTML content is advisable when the user copies content from MS Word.

The Editor supports the following options for cleaning up pasted content:

  • convertMsLists - if set to true, MS Word lists will be converted into HTML lists.
  • removeHtmlComments - if set to true, comments will be removed from the HTML.
  • stripTags - specifies a list of tags to be removed from the HTML.
  • removeAttributes - specifies the DOM attributes that should be removed from the HTML.
  • removeMsClasses - if set to true, class attributes starting with 'Mso' will be removed from the HTML.
  • removeMsStyles - if set to true, style attributes starting with 'Mso' will be removed from the HTML.
  • removeInvalidHTML - if set to true, invalid HTML will be removed.

The following example demonstrates how to use cleanup on pasted content.

@Component({
    selector: 'my-app',
    template: `
        <kendo-editor [pasteCleanupSettings]="pasteCleanupSettings" style="height: 370px;"></kendo-editor>
    `
})
export class AppComponent {
    public pasteCleanupSettings = {
        convertMsLists: true,
        removeHtmlComments: true,
        // stripTags: ['span', 'h1'],
        // removeAttributes: ['lang'],
        removeMsClasses: true,
        removeMsStyles: true,
        removeInvalidHTML: true
    }
}

In this article