New to Kendo UI for VueStart a free 30-day trial

Sanitizing Pasted Content in Kendo UI for Vue Editor

Updated on Oct 27, 2025

Environment

Product Kendo UI for Vue Editor
Version Current

Description

I need to sanitize pasted content in the Kendo UI for Vue Editor. I want to remove styles such as background color and font color from the pasted text. The provided demo in the documentation mentions sanitizing pasted content, but unwanted styles are still preserved. I also need clarification on what "sanitize" means in this context.

This knowledge base article also answers the following questions:

  • How can I remove font and background styles when pasting content in Kendo Vue Editor?
  • What does sanitizing pasted content mean in Kendo Vue Editor?
  • How can I customize the paste settings in Kendo Vue Editor?

Solution

Sanitizing pasted content in the Kendo UI for Vue Editor means removing or modifying specific attributes or styles from the pasted content. To remove styles like background color and font color, customize the pasteSettings by using the removeAttribute function for the style attribute.

Follow these steps to achieve this:

  1. Define a pasteSettings object and use the removeAttribute function for the style attribute.
  2. Apply the pasteSettings to the Editor.

Example code snippet:

javascript
const pasteSettings = {
  convertMsLists: true,
  attributes: {
    class: sanitizeClassAttr, // Example for sanitizing class attributes
    style: removeAttribute,   // Removes all style attributes
    width: () => {}           // Example for other attributes
  }
};

function removeAttribute() {
  return null; // Removes the attribute
}

// Apply the pasteSettings to the Editor
<Editor :paste-html="pasteSettings" />

You can see a demo implementing the suggestions above here:

Change Theme
Theme
Loading ...

See Also

In this article
EnvironmentDescriptionSolutionSee Also
Not finding the help you need?
Contact Support