Problem/Motivation

The module is not currently compatible with CKEditor 5.

Proposed resolution

Update: https://www.drupal.org/project/ckeditor5_paste_filter

After working on this more I decided to release the CKEditor 5 version as a separate module so that we don't have to maintain CKEditor 4 and CKEditor 5 code in the same codebase and to ease folks' upgrade paths.

Update to be CKEditor 5 compatible.

I would suggest that the CKEditor 5 version could be version 2.x.x of this module.

Remaining tasks

  • Create issue fork
  • Post ported module as a merge request

User interface changes

n/a

API changes

n/a

Data model changes

n/a

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Cottser created an issue. See original summary.

star-szr’s picture

Issue summary: View changes
Status: Active » Needs work

I can see (at least) one or two more default rules we should add to get closer to parity with the CKEditor 4 version, so marking as needs work for that. But if anyone comes across this in the meantime feel free to test it and provide feedback.

The reasoning for more default rules is because CKEditor 5's paste from office plugin doesn't do as much cleanup as the CKEditor 4 version. See also #3254346: [upstream] CKEditor 5 PasteFromOffice plugin should not allow MS Office/Apple Pages/Google Docs-specific classes and styles even when HTML is unrestricted.

star-szr’s picture

I did not try to port the code from https://git.drupalcode.org/project/ckeditor_paste_filter/-/blob/1.0.x/js... since it seems there is no equivalent in CKEditor 5.

https://github.com/ckeditor/ckeditor4/issues/4364

star-szr’s picture

Status: Needs work » Needs review

This has gone through more testing and can be reviewed.

My next step will be to review #3304359: Make filter rules configurable. and see if I can incorporate that into the CKEditor 5 version. I think this functionality is more important since CKEditor 5 plugins are typically using webpack.

maxilein’s picture

Thank you all.

Is this connected: https://www.drupal.org/project/ckeditor5_paste_filter or will it be version 2.0?
If so it says there on the module description:

This is a CKEditor 5 version of CKEditor Paste Filter with additional features.

may I suggest to add something like this from #3:

I can see (at least) one or two more default rules we should add to get closer to parity with the CKEditor 4 version, so marking as needs work for that. But if anyone comes across this in the meantime feel free to test it and provide feedback.

The reasoning for more default rules is because CKEditor 5's paste from office plugin doesn't do as much cleanup as the CKEditor 4 version. See also #3254346: [upstream] CKEditor 5 PasteFromOffice plugin should not allow MS Office/Apple Pages/Google Docs-specific classes and styles even when HTML is unrestricted.

or even better list the rules implemented?

star-szr’s picture

Hi @maxilein thanks for taking a look, yes that is where the CKEditor 5 version will end up after thinking about it more, and I have emailed the maintainer of this CKEditor 4 module about it. I need a few days to get things ready on that other project and will update this issue once it's ready.

I have already added additional rules here which you can see in the merge request, the biggest feature I will be adding to the other project is to make the rules fully configurable (mentioned in #5 here), rather than providing only a hardcoded set of rules.

taote’s picture

How can I download this version to test it?

star-szr’s picture

@taote I am still working on the full project but you can download or clone a working version from https://git.drupalcode.org/issue/ckeditor_paste_filter-3341385/-/tree/33... to test the basic functionality.

jaydip makawana’s picture

Thanks @cottser for the contribution. I will review and release this version once work done.

star-szr’s picture

@JaydipJD thanks! I actually think the CK4 and CK5 versions should remain separate to ease the upgrade path and would rather close this issue without merging once I have a dev version up for the CK5 project. The config form for the CK5 version is taking a lot longer than expected but is “almost” ready now.

I could use some help maintaining https://www.drupal.org/project/ckeditor5_paste_filter if you are interested.

kepesv’s picture

https://git.drupalcode.org/issue/ckeditor_paste_filter-3341385/-/tree/33...
Tested and I can confirm that working properly! It could be the initial release as individual project.

star-szr’s picture

Hi @kepesv thank you for your interest and for testing it! The reason why I do not want to release that code as an initial or dev release is that I will immediately need to build an upgrade path to go from hardcoded to configurable filter rules. So I would rather the first public release (even dev release) already have the configurable rules part done.

The full version including configuration sync and configuration UI will be released on https://www.drupal.org/project/ckeditor5_paste_filter (I am aiming to have it up this week) and I will update this issue once that is done.

star-szr’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

The first alpha of https://www.drupal.org/project/ckeditor5_paste_filter has been released, testing and feedback would be very much appreciated so we can get it to a stable 1.0.0 release. Thanks to everyone who has tested and shown interest on this issue.

I am closing this issue and merge request because releasing the CKEditor 5 project completes what I started here. Thank you.