Drupal is a registered trademark of Dries Buytaert

ckeditor5_paste_filter

12,874 sites Security covered
View on drupal.org

Clean up the markup of content pasted into CKEditor 5 from Microsoft Word, Google Docs, and other rich text sources. Comes with a pre-configured set of filters but fully customizable.

Paste filters can be customized via the text format user interface. Filter configuration is stored as part of the text format configuration, so you can have different sets of filters for different text formats if you wish.

Usage

First, install this module as you normally would.

To configure and start using it, follow the steps below.

  1. Add or edit a text format (/admin/config/content/formats)
  2. Set the 'Text editor' of the text format to CKEditor 5
  3. Under 'CKEditor 5 plugin settings' select the 'Paste filter' vertical tab
  4. Enable the plugin by checking the 'Filter pasted content' checkbox
  5. (Optional) Add/edit/remove the pre-configured filters if you have different filtering requirements:
    • To add filters, click the "Add another filter" button inside the Paste filter configuration form
    • To remove filters, empty the search and replace text boxes, the filters will be removed after saving the text format
  6. Save the text format: Scroll to the bottom and click "Save configuration"

Context

This module allows filtering (searching and replacing) using a set of regular expressions. Each filter consists of a search expression and a replace expression. If your use case is a common one, then you don't need to know regular expressions, just install and configure the module as described above.

Drupal core ships with a CKEditor 5 plugin which filters out some of the markup from these sources but does not go as far as the CKEditor 4 "Paste from Word" functionality. Note that this module's default set of filters is more aggressive than the CKEditor 4 "Paste from Word" functionality.

Similar Projects

This is a CKEditor 5 version of CKEditor Paste Filter with additional features, most notably that the filters are fully configurable via a form interface and the filters can be configured individually for each text format. This module has been created as a separate project so that sites transitioning over to CKEditor 5 can have both modules installed easily, and to allow this project to evolve without needing to maintain compatibility with both CKEditor 4 and 5.

CKEditor5 Custom Paste - This module has not been tested by the maintainers of this project but may be a better fit for some use cases, or may even be complementary to this project in some cases. Note that as of this writing there is no automated test coverage for this other project.

Activity

Total releases
3
First release
Feb 2025
Latest release
2 months ago
Release cadence
144 days
Stability
67% stable

Release Timeline

Releases

Version Type Release date
1.1.1 Stable Dec 10, 2025
1.1.x-dev Dev Feb 26, 2025
1.1.0 Stable Feb 26, 2025