Problem/Motivation

In Drupal 11, we should remove the upgrade path from CKEditor 4.

This means that in theory in Drupal 10 we should already deprecate \Drupal\ckeditor5\Annotation\CKEditor4To5Upgrade plugins … even though it's still necessary at that point. Perhaps we don't need to deprecate it, because in Drupal 11, this all becomes dead code anyway; everything must by definition have already been migrated to CKEditor 5 if it's running in Drupal 10?

Proposed resolution

Remove in Drupal 11 with no deprecation. See #18 and #19

Remaining tasks

Delete:

  1. \Drupal\Tests\ckeditor5\Kernel\CKEditor4to5UpgradeCompletenessTest
  2. \Drupal\ckeditor5\Annotation\CKEditor4To5Upgrade
  3. \Drupal\ckeditor5\Plugin\CKEditor4To5UpgradePluginInterface
  4. \Drupal\ckeditor5\Plugin\CKEditor4To5UpgradePluginManager
  5. \Drupal\ckeditor5\Plugin\CKEditor4To5Upgrade\Core
  6. \Drupal\ckeditor5\SmartDefaultSettings::createSettingsFromCKEditor4()
  7. Some test cases in \Drupal\Tests\ckeditor5\Kernel\SmartDefaultSettingsTest::provider()
  8. \Drupal\ckeditor5\CKEditor5StylesheetsMessage

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork drupal-3239012

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

Wim Leers created an issue. See original summary.

wim leers’s picture

Project: CKEditor 5 » Drupal core
Version: 1.0.x-dev » 10.0.x-dev
Component: Code » ckeditor5.module
wim leers’s picture

xjm’s picture

Version: 10.0.x-dev » 9.4.x-dev
Issue tags: +Drupal 10
Parent issue: » #3270437: [meta] Tasks to deprecate the CKEditor 4 module

Rescoping. The code shouldn't be deleted; it should be simply moved to the CKEditor 4 module, which in turn gets moved to contrib.

xjm’s picture

Title: Remove the upgrade path from CKEditor 4 » The CKEditor 4 to 5 upgrade path should live in CKEditor 4
xjm’s picture

Status: Postponed » Active
xjm’s picture

Title: The CKEditor 4 to 5 upgrade path should live in CKEditor 4 » Figure out what to do with the CKEditor 4 to 5 upgrade path when CKEditor 4 moves to contrib
wim leers’s picture

Title: Figure out what to do with the CKEditor 4 to 5 upgrade path when CKEditor 4 moves to contrib » [Drupal 11] Remove the upgrade path from CKEditor 4
Version: 9.4.x-dev » 10.0.x-dev
Status: Active » Postponed
Issue tags: -Drupal 10 +Drupal 11
Parent issue: #3270437: [meta] Tasks to deprecate the CKEditor 4 module » #3238333: Roadmap to CKEditor 5 stable in Drupal 9
Related issues: +#3226673: API addition: \Drupal\editor\Plugin\EditorPluginInterface::getDefaultSettings() should accept old Editor + Format to generate smart defaults, +#3270831: Make the CKEditor 4 → 5 upgrade path work even when the CKEditor 4 module is removed

@xjm You've rescoped this issue to be for Drupal 10, even though it was originally for Drupal 11. Even in the roadmap (#3238333: Roadmap to CKEditor 5 stable in Drupal 9), it says: Obsoleteness of upgrade path in Drupal 11.

Rescoping. The code shouldn't be deleted; it should be simply moved to the CKEditor 4 module, which in turn gets moved to contrib.

That does not make sense: the CKEditor 4 module cannot provide an upgrade path for CKEditor 5 because:

So, created #3270831: Make the CKEditor 4 → 5 upgrade path work even when the CKEditor 4 module is removed for this new scope.

xjm’s picture

Title: [Drupal 11] Remove the upgrade path from CKEditor 4 » [late 2023] Deprecate the upgrade path from CKEditor 4
Parent issue: #3238333: Roadmap to CKEditor 5 stable in Drupal 9 » #3265680: Deprecate dependencies, libraries, modules, and themes that will be removed from Drupal 11 core
Related issues: +#3238333: Roadmap to CKEditor 5 stable in Drupal 9

Moving to the D11 roadmap. We'll probably want to do this in late 2023 or early 2024, since that's when CKEditor's security coverage is probably going to end.

wim leers’s picture

👍

Meanwhile, #3270831: Make the CKEditor 4 → 5 upgrade path work even when the CKEditor 4 module is removed is now ready for review — good news: managed to make it work with net less code than before 🤓🥳

wim leers’s picture

Version: 10.0.x-dev » 10.1.x-dev

This sort of ties into #3304736: Provide a good UX to ensure the CKEditor 4 to 5 update is always done before upgrading to Drupal 10 unless the contrib module is installed — if the upgrade to Drupal 10 and CKEditor 5 is required to do before the update to Drupal 10, we can actually just remove the upgrade path in Drupal 10.

Except … that https://www.drupal.org/project/ckeditor is around, which allows CKEditor 4 to exist on Drupal 10. So I think that means the original outline (removing this in late 2023/early 2024) is still accurate.

Moving to 10.1.x. I'd move it to a further release if I could 🤓

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

wim leers’s picture

Status: Postponed » Active
Issue tags: +Security

>14 months have passed since #11: it's now late 2023, tomorrow is December 1!

https://www.drupal.org/project/ckeditor will be unsupported soon.

Time to start exploring our options.

quietone made their first commit to this issue’s fork.

quietone’s picture

Title: [late 2023] Deprecate the upgrade path from CKEditor 4 » [late 2023] Remove the CKEditor 4 upgrade path from
Status: Active » Needs work

I was on the fence about deprecating or not but asked the other rms. Catch replied saying that in this it is ok to remove them. He pointed out that plugins are internal and these are a specific use case. Plus, since these will be in use for year or two, possibly three, it would be more disruptive to deprecate.

Based on that I started to remove files. I did remove some provider tests from SmartDefaultSettingsTest but there remains a lot of CkEditor4 strings in setup().

This will fails tests so settings to NW.

wim leers’s picture

Very interesting, I sort of expected this to not happen 😅 Then again, sites can't go from Drupal 9 to 11 directly (i.e. no bypassing start Drupal 10), so … it makes sense to do this.

It triggers … Feels 😅 to be removing this — I spent a lot of time building this. And I built it for clean ejection when it was no longer needed, which is NOW, so it does feel kinda satisfying (cathartic?) to see how nicely this is removing ~1250 LoC (and more soon) 🤩

MR reviewed — I explained which other test cases (which you already alluded to, @quietone!) that are safe to remove can be identified 😊

catch’s picture

Title: [late 2023] Remove the CKEditor 4 upgrade path from » [11.x] Remove the CKEditor 4 upgrade path from

Changing the issue title to indicate we'd only remove this in 11.x - this means sites that are still using ckeditor4 will be able to use the upgrade path on 10.x, which is going to be maintained until around 2026, years after ckeditor4's EOL.

The reason I think this would be more disruptive to deprecate than just remove outright in 11.x is because if we deprecate we either have to remove usages (which we wouldn't want to do in 10.x, there are still well over 100,000 Drupal 9.5 sites), or workaround the deprecation notices in tests etc., which is not really deprecating then. We offer 'best effort' bc and deprecations for internal code, and in this case the best we can do is none at all.

longwave’s picture

Title: [11.x] Remove the CKEditor 4 upgrade path from » [11.x] Remove the CKEditor 4 upgrade path

+1 to no deprecations, but maintaining this throughout Drupal 10 and a clean removal in Drupal 11, given that sites already must go from 9 to 10 before they can go to 11. Sites using the CKE4 contrib module in Drupal 10 will have to complete their upgrade to CKE5 before moving to Drupal 11.

quietone’s picture

Issue summary: View changes
quietone’s picture

wim leers’s picture

Failing on PHPStan:

  139    Parameter $stylesheets_message of method                             
         Drupal\ckeditor5\Plugin\Editor\CKEditor5::__construct() has invalid  
         type Drupal\ckeditor5\CKEditor5StylesheetsMessage.                   

Simple fix fortunately: that is just no longer necessary :)

wim leers’s picture

10.3 has been branched. Does that mean this can land now? It's unlikely the affected will change in 10.3 too, so it's also unlikely that this'll make MRs more difficult to land?

catch’s picture

@Wim yes :)

wim leers’s picture

Status: Needs work » Needs review

Merged in upstream changes. Then finished what @quietone started: removed all traces of CKEditor5StylesheetsMessage.

wim leers’s picture

Assigned: Unassigned » wim leers
Status: Needs review » Needs work

The test cases in SmartDefaultSettingsTest are now almost all stale/irrelevant: they're specifically testing an update from CKEditor 4, and that's no longer necessary.

Because going forward, SmartDefaultSettings can and will only look at the HTML restrictions of the text format. Will tackle that next.

wim leers’s picture

https://git.drupalcode.org/project/drupal/-/merge_requests/6329/diffs?co... got us down to 2 failing tests: SmartDefaultSettingsTest as predicted in #27, plus \Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5AllowedTagsTest::testSwitchToVersion5().

I just pushed a commit that should make the latter pass, the commit message explains how/why.

wim leers’s picture

Status: Needs work » Needs review

I recommend reviewing the test coverage changes using


Only two <code>@todo

s are left. This is 98% ready.

smustgrave’s picture

So long ckeditor4!

Following to review later.

wim leers’s picture

Assigned: wim leers » Unassigned
Priority: Normal » Major
Issue summary: View changes
Issue tags: +clean-up

And now it will be green! 😄 Whew, this was quite a lot of work: to keep the good parts of SmartDefaultSettings that are still relevant now that CKEditor 4 is gone.

Bumping to Major given the diffstat of +367, −1731.

smustgrave’s picture

Reran the javascript failing test multiple times but seems to consistently fail :(

wim leers’s picture

Assigned: Unassigned » wim leers
Status: Needs review » Needs work

Shoot!

smustgrave’s picture

Ckeditor just doesn't want to go away!

wim leers’s picture

Title: [11.x] Remove the CKEditor 4 upgrade path » [PP-1] [11.x] Remove the CKEditor 4 upgrade path
Assigned: wim leers » Unassigned
Status: Needs work » Postponed

Merged in latest 11.x.

The failure is reproducible locally:

TypeError: Cannot read properties of null (reading 'length')
    at Object._parseSetting (http://localhost/subdirectory/core/modules/filter/filter.filter_html.admin.js?v=11.0-dev:310:39)
    at http://localhost/subdirectory/core/modules/filter/filter.filter_html.admin.js?v=11.0-dev:95:30
    at Array.forEach (<anonymous>)
    at Object.attach (http://localhost/subdirectory/core/modules/filter/filter.filter_html.admin.js?v=11.0-dev:90:9)
    at http://localhost/subdirectory/core/misc/drupal.js?v=11.0-dev:166:24
    at Array.forEach (<anonymous>)
    at Drupal.attachBehaviors (http://localhost/subdirectory/core/misc/drupal.js?v=11.0-dev:162:34)
    at http://localhost/subdirectory/core/misc/drupal.init.js?v=11.0-dev:32:12
    at HTMLDocument.listener 

… but it'd be solved automatically by #2567801: Deprecate core/modules/editor/js/editor.admin.js JS APIs in Drupal 10, for removal in Drupal 11.

wim leers’s picture

Title: [PP-1] [11.x] Remove the CKEditor 4 upgrade path » [11.x] Remove the CKEditor 4 upgrade path
Assigned: Unassigned » wim leers
Status: Postponed » Active
wim leers’s picture

Assigned: wim leers » Unassigned
Status: Active » Needs review

All green! 😄 🥳

90% of this MR is trivial.

The 10% that is non-trivial is in SmartDefaultSettings. For it to continue to work (to provide default settings based on HTML restrictions of a text format, which 99% of the time means based on filter_html configuration), a few additions were necessary.

You might question the need for that. Why:

  1. It makes it easy for existing text formats to adopt CKEditor 5
  2. It minimizes the changes to SmartDefaultSettingsTest
smustgrave’s picture

Removal seems good. But question should this code be moved to the ckeditor4 contrib module?

I can imagine there are some still on ckeditor4 and they may upgrade to D11 while still trying to get to ckeditor5.

catch’s picture

I think it's entirely reasonable to require people to update to ckeditor5 on Drupal 10 before going to Drupal 11, they've got until 2026 to do that and still be supported.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Good point, forgot about the 2 year overlap

catch’s picture

Status: Reviewed & tested by the community » Fixed

I read through everything again and there was a few things I thought 'should we be deprecating this in 10.x first' and then I thought we don't want to deprecate it in 10.x because we want people to use it there to get onto ckeditor5, and then I re-read the issue and found us discussing the same thing already including me months ago and all the other release managers.

Committed/pushed to 11.x, thanks!

  • catch committed ec22f88c on 11.x
    Issue #3239012 by Wim Leers, quietone, smustgrave, xjm, catch, longwave...
catch’s picture

catch’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

catch’s picture

We've still got a couple of ckeditor4 editor config exports supporting various tests, which I think possibly might not be for actual ckeditor4 upgrade path testing at all, but in which case should probably be renamed. Opened #3442395: ckeditor5 and editor module test config exports/stubs rely on hook_editor_presave() bc layers for that and some other issues when I tried to remove ckeditor5/editors's overall 9-10.3 upgrade path.

quietone’s picture

Version: 11.x-dev » 11.0.x-dev

Update version to the branch this applies to.