Problem/Motivation

This issue is for preparing to move CKEditor 5 to core. This issue will be closed once CKEditor 5 has been committed in core. Any actual changes to code should happen in child issues.

The only patches posted here should be patches that apply to Drupal core, so we can apply these patches automatically as part of generating a merge request against Drupal core.

Proposed resolution

CommentFileSizeAuthor
#74 3227826-73-core.patch25.2 KBlauriii
#73 ckeditor5_create_patch.sh__1.txt2.48 KBwim leers
#72 interdiff-CKE5.txt1.92 KBlauriii
#72 3227826-72-CKE5.patch26.42 KBlauriii
#71 3227826-71-core.patch25.2 KBwim leers
#71 interdiff-core.txt1.22 KBwim leers
#70 ckeditor5_create_patch.sh_.txt2.48 KBwim leers
#69 ckeditor5_create_patch.sh_.txt2.48 KBwim leers
#69 3227826-69-core.patch25.15 KBwim leers
#69 interdiff-core.txt2.33 KBwim leers
#68 ckeditor5_create_patch.sh_.txt2.48 KBlauriii
#68 3227826-68-CKE5.patch26.26 KBlauriii
#68 3227826-68-core.patch24.19 KBlauriii
#67 ckeditor5_create_patch.sh_.txt2.61 KBwim leers
#67 3227826-67-CKE5.patch26.73 KBwim leers
#67 3227826-67-core.patch10.41 KBwim leers
#67 interdiff-core.txt1.1 KBwim leers
#65 ckeditor5_create_patch.sh_.txt2.61 KBwim leers
#65 interdiff-CKE5.txt850 byteswim leers
#65 3227826-65-CKE5.patch26.73 KBwim leers
#63 ckeditor5_create_patch.sh_.txt2.61 KBwim leers
#63 3227826-63-CKE5.patch26.73 KBwim leers
#63 interdiff-CKE5.txt1.09 KBwim leers
#62 ckeditor5_create_patch.sh_.txt2.61 KBwim leers
#62 3227826-62-CKE5.patch26.72 KBwim leers
#62 interdiff-CKE5.txt1.74 KBwim leers
#61 ckeditor5_create_patch.sh_.txt2.61 KBwim leers
#61 3227826-61-CKE5.patch26.36 KBwim leers
#61 interdiff-CKE5.txt1.99 KBwim leers
#58 ckeditor5_create_patch.sh_.txt2.61 KBwim leers
#58 interdiff-CKE5.txt1.05 KBwim leers
#58 3227826-58-CKE5.patch25.47 KBwim leers
#57 ckeditor5_create_patch.sh_.txt2.61 KBwim leers
#56 ckeditor5_create_patch.sh_.txt2.41 KBwim leers
#56 3227826-56-CKE5.patch24.51 KBwim leers
#56 interdiff-CKE5.txt1.42 KBwim leers
#55 3227826-55-CKE5.patch23.09 KBwim leers
#54 interdiff-core.txt555 byteswim leers
#54 3227826-54-core.patch10.46 KBwim leers
#53 3227826-53-core.patch10.36 KBwim leers
#53 interdiff-core.txt2.91 KBwim leers
#51 ckeditor5_create_patch.sh_.txt2.41 KBwim leers
#51 3227826-51-core.patch9.37 KBwim leers
#50 ckeditor5_create_patch.sh_.txt2.41 KBwim leers
#50 3227826-50-CKE5.patch23.02 KBwim leers
#49 3227826-49-core.patch220.03 KBwim leers
#47 ckeditor5_create_patch.sh_.txt2.41 KBwim leers
#47 3227826-47-core.patch224.09 KBwim leers
#47 interdiff-core.txt1.3 KBwim leers
#47 3227826-47-CKE5.patch23.03 KBwim leers
#47 interdiff-CKE5.txt644 byteswim leers
#44 ckeditor5_create_patch.sh_.txt2.53 KBwim leers
#44 3227826-43-CKE5.patch23.55 KBwim leers
#44 interdiff-core.txt586 byteswim leers
#44 3227826-43-core.patch225.07 KBwim leers
#42 ckeditor5_create_patch.sh_.txt2.52 KBwim leers
#41 3227826-41-CKE5.patch22.83 KBwim leers
#41 interdiff-CKE5.txt1.49 KBwim leers
#41 3227826-41-core.patch224.64 KBwim leers
#41 interdiff-core.txt1.05 KBwim leers
#39 ckeditor5_create_patch.sh_.txt2.52 KBwim leers
#37 interdiff.txt1.4 KBlauriii
#37 3227826-37-CKE5.patch21.73 KBlauriii
#36 ckeditor5_create_patch.sh_.txt2.52 KBwim leers
#35 ckeditor5_create_patch.sh_.txt2.5 KBwim leers
#34 3227826-34-core.patch224.14 KBwim leers
#34 interdiff.txt750 byteswim leers
#33 3227826-33-CKE5.patch21.24 KBwim leers
#32 3227826-32-core.patch223.41 KBwim leers
#32 interdiff.txt422 byteswim leers
#31 3227826-31-core.patch223.38 KBwim leers
#31 interdiff.txt449 byteswim leers
#30 3227826-30-CKE5.patch21.2 KBwim leers
#30 interdiff.txt2.74 KBwim leers
#29 ckeditor5_create_patch.sh_.txt2.46 KBwim leers
#28 ckeditor5_create_patch.sh_.txt2.26 KBwim leers
#27 interdiff.txt1.08 KBwim leers
#27 3227826-27-core.patch223.43 KBwim leers
#26 ckeditor5_create_patch.sh_.txt2.26 KBwim leers
#25 3227826-25-core.patch223.33 KBwim leers
#25 interdiff.txt387 byteswim leers
#24 ckeditor5_create_patch.sh_.txt2.12 KBwim leers
#23 interdiff.txt886 byteswim leers
#23 3227826-23-core.patch223.09 KBwim leers
#22 3227826-22-CKE5.patch18.46 KBwim leers
#22 interdiff.txt3.19 KBwim leers
#21 3227826-21-core.patch223.11 KBwim leers
#21 interdiff.txt1.4 KBwim leers
#20 3227826-20-CKE5.patch15.42 KBwim leers
#20 interdiff.txt1.1 KBwim leers
#19 3227826-19-core.patch222.14 KBwim leers
#19 interdiff.txt496 byteswim leers
#18 3227826-18-core.patch222.11 KBwim leers
#18 interdiff.txt847 byteswim leers
#17 interdiff-core-patch.txt5.09 KBwim leers
#16 3227826-16-core.patch222.11 KBwim leers
#16 3227826-ckeditor-16.patch15.41 KBwim leers
#16 interdiff.txt10.8 KBwim leers
#15 3227826-ckeditor-15.patch8.67 KBwim leers
#15 interdiff.txt3.88 KBwim leers
#13 ckeditor5_create_patch.sh_.txt1.88 KBlauriii
#13 3227826-11-core.patch217.13 KBlauriii
#10 3227826-ckeditor-10.patch1.79 KBwim leers
#9 ckeditor5_create_patch.sh_.txt1.88 KBwim leers
#9 interdiff.txt477 byteswim leers
#8 ckeditor5_create_patch.sh_.txt1.81 KBlauriii
#8 3227826-core.patch3.29 KBlauriii
#8 3227826-ckeditor.patch2.98 KBlauriii
#7 3227826-ckeditor.patch1.88 KBlauriii
#7 3227826-core.patch2.75 KBlauriii
#6 3227826-core.patch3.06 KBlauriii
#5 3227826-ckeditor.patch1.88 KBlauriii
#4 3227826-4.patch658 byteslauriii
#2 3227826-2.patch501 byteslauriii

Comments

lauriii created an issue. See original summary.

lauriii’s picture

StatusFileSize
new501 bytes

This allows running eslint against this module when the module is cloned under core/modules/ckeditor5.

wim leers’s picture

Issue summary: View changes
lauriii’s picture

StatusFileSize
new658 bytes
lauriii’s picture

StatusFileSize
new1.88 KB
lauriii’s picture

StatusFileSize
new3.06 KB
lauriii’s picture

StatusFileSize
new2.75 KB
new1.88 KB
lauriii’s picture

StatusFileSize
new2.98 KB
new3.29 KB
new1.81 KB
wim leers’s picture

StatusFileSize
new477 bytes
new1.88 KB

We don't want Drush-related things in Drupal core.

wim leers’s picture

StatusFileSize
new1.79 KB

Rebased the patch, no longer applied after #3227853: Remove dependency on Vue.js.

(Not yet updating the shell script because more changes inbound.)

wim leers’s picture

StatusFileSize
new1.04 KB
new4.78 KB

Change package from CKEditor 5 to Core (Experimental) and use version: VERSION.

lauriii’s picture

Related issues: -#3228956: PHP notices are not detected for headless browser-triggered requests in FunctionalJavascript tests
StatusFileSize
new217.13 KB
new1.88 KB
  • Rerolled the core patch
  • Update the scrip to use patch from #12
  • Added step to remove starter template from the core patch
lauriii’s picture

wim leers’s picture

StatusFileSize
new3.88 KB
new8.67 KB

Also removing the Drush command.

EDIT: Never mind, I had already added that to the script…

wim leers’s picture

StatusFileSize
new10.8 KB
new15.41 KB
new222.11 KB

#3231364-2: Add CKEditor 5 module to Drupal core failed gloriously on cspell :D

Adding "modules/ckeditor5/js/build/**" to core/.cspell.json.
Adding modules/ckeditor5/js/build to the list of directories that should not be checked for ES6ification.

Just moving it to core/assets/vendor instead. First step: patching ckeditor5.libraries.yml and core.libraries.yml. Note that this is not just cut and paste: significant change is necessary for things to still work.

wim leers’s picture

StatusFileSize
new5.09 KB
wim leers’s picture

StatusFileSize
new847 bytes
new222.11 KB

Update core/package.json to find the build script in core/assets/vendor/ckeditor5 now.

wim leers’s picture

StatusFileSize
new496 bytes
new222.14 KB

I can't get

yarn run v1.22.5
$ cross-env BABEL_ENV=legacy node ./scripts/js/babel-es6-build.js --check --file /var/www/html/core/modules/ckeditor5/js/ckeditor5.admin.es6.js
[22:21:31] '/var/www/html/core/modules/ckeditor5/js/ckeditor5.admin.es6.js' is being checked.
Done in 1.19s.

/var/www/html/core/modules/ckeditor5/js/ckeditor5.admin.es6.js
  309:19  error  Unexpected lexical declaration in case block  no-case-declarations
  341:19  error  Unexpected lexical declaration in case block  no-case-declarations
  357:19  error  Unexpected lexical declaration in case block  no-case-declarations
  373:19  error  Unexpected lexical declaration in case block  no-case-declarations
  412:19  error  Unexpected lexical declaration in case block  no-case-declarations
  480:32  error  'Observable' was used before it was defined   no-use-before-define

✖ 6 problems (6 errors, 0 warnings)

figured out.

I cannot reproduce this locally. It seems that the auto-ES6-ification failed to do the correct thing here. I see similar cases elsewhere in Drupal core, and there it did get generated correctly.

So temporarily ignoring this file instead :D

wim leers’s picture

StatusFileSize
new1.1 KB
new15.42 KB

We still need to update the CKE5 patch to update webpack.config.js to point to core/assets/vendor/ckeditor5/….

wim leers’s picture

StatusFileSize
new1.4 KB
new223.11 KB

Finally, I do not know enough about webpack to know if it's safe for me to move its configuration to a different location:

Checking core/webpack.config.js

FAILURE core/webpack.config.js does not have a corresponding core/webpack.config.es6.js

But the commit script already has a similar exemption for core/postcss.config.js, so I'll just follow suit.

ALSO: found one spot I missed in #16

wim leers’s picture

StatusFileSize
new3.19 KB
new18.46 KB

Missed some things in the move to core/assets

wim leers’s picture

StatusFileSize
new223.09 KB
new886 bytes

… and also for the core patch.

wim leers’s picture

StatusFileSize
new2.12 KB
wim leers’s picture

StatusFileSize
new387 bytes
new223.33 KB

Add core/modules/ckeditor5/modules/ckeditor5_dev/js/ckeditor5_dev.es6.js to the eslint ignore list.

wim leers’s picture

StatusFileSize
new2.26 KB
wim leers’s picture

StatusFileSize
new223.43 KB
new1.08 KB

The last straggler: layercake.js not needing to be ES6ified because it's external code.

wim leers’s picture

StatusFileSize
new2.26 KB

Using #27.

wim leers’s picture

StatusFileSize
new2.46 KB

Fix the failing ComposerIntegrationTest: we were not yet updating composer.lock per https://www.drupal.org/about/core/policies/core-dependencies-policies/ma....

wim leers’s picture

StatusFileSize
new2.74 KB
new21.2 KB

Update expectations in CKEditor5PluginManagerTest for the move of assets out of the CKE5 module and into core/assets/vendor/ckeditor5/.

wim leers’s picture

StatusFileSize
new449 bytes
new223.38 KB

In splitting up asset libraries between CKE5 module and core/assets/vendor, the CSS file for the language plugin ended up in both sides. Which caused a test fail at #3231364-25: Add CKEditor 5 module to Drupal core. This fixes that.

wim leers’s picture

wim leers’s picture

StatusFileSize
new21.24 KB

Update CKE5 patch for [#32321427]; it no longer applied.

wim leers’s picture

StatusFileSize
new750 bytes
new224.14 KB

This makes ResolvedLibraryDefinitionsFilesMatchTest pass tests.

wim leers’s picture

StatusFileSize
new2.5 KB

Apply the latest patches.

wim leers’s picture

StatusFileSize
new2.52 KB

… and add the composer.lock changes to the patch, which #29 should already have done.

EDIT: oh, nope, looks like we should've always been adding this one!

lauriii’s picture

StatusFileSize
new21.73 KB
new1.4 KB

This should fix Stable and Stable 9 related tests, as well as Drupal\Tests\ckeditor5\FunctionalJavascript\LanguageTest

wim leers’s picture

+++ b/src/Plugin/Editor/CKEditor5.php
@@ -816,7 +816,7 @@ class CKEditor5 extends EditorBase implements ContainerFactoryPluginInterface {
-      $plugin_libraries[] = 'ckeditor5/ckeditor5.translations.' . $ui_langcode;
+      $plugin_libraries[] = 'core/ckeditor5.translations.' . $ui_langcode;

D'oh — of course :D

wim leers’s picture

StatusFileSize
new2.52 KB
wim leers’s picture

Quoting #3231364-32: Add CKEditor 5 module to Drupal core:

We will instead from now post multiple patches: ckeditor5-CID.patch (includes everything) ckeditor5_assets_only-CID-do-not-commit.patch (assets only) and ckeditor5_module_only-CID-do-not-commit.patch.

wim leers’s picture

StatusFileSize
new2.52 KB
wim leers’s picture

wim leers’s picture

StatusFileSize
new225.07 KB
new586 bytes
new23.55 KB
new2.53 KB
wim leers’s picture

D'oh, I forgot to include #3231324: Use core icons where possible after moving to core 😬 Will do so in the next reroll!

effulgentsia’s picture

rm README.md

ckeditor5.ckeditor5.yml has this at the top:
# @see this module's README.md for details on defining CKEditor 5 plugins in

So it's a WTF that in the core patch this README doesn't exist. Maybe we should retain the README in the core patch? Or else change the above to reference something else?

wim leers’s picture

wim leers’s picture

@lauriii I just realized you created the core/yarn.lock section of the -core.patch patches here? I've been updating that patch but have not been touching that area! 😅

wim leers’s picture

StatusFileSize
new220.03 KB

Updating the core patch to now target 2073a9468d7220f5d2d0b7b4368cc3fcdb9f43c9 of the module, i.e. #3245942: Update CKEditor 5 to 31.0.0 — the core/yarn.lock needed to be updated.

Thanks to @lauriii for the mentoring on how to do this! (Basically: copy relevant parts from this module's package.json into core/package.json, then cd core && yarn install.)

wim leers’s picture

StatusFileSize
new23.02 KB
new2.41 KB
wim leers’s picture

StatusFileSize
new9.37 KB
new2.41 KB

Okay, #3231364-67: Add CKEditor 5 module to Drupal core failed to apply … and in fixing that I realized that we can keep the "core" patch here smaller, the script is taking care of regenerating the core/yarn.lock anyway 🥳

wim leers’s picture

I wrote in #43 we should incorporate #3231324: Use core icons where possible after moving to core's patch, but that still hasn't happened. Writing it again to avoid forgetting again. Once it's in here, we can mark that issue fixed.

wim leers’s picture

StatusFileSize
new2.91 KB
new10.36 KB
wim leers’s picture

StatusFileSize
new10.46 KB
new555 bytes

Missed in #53: #3247246: Attribute value encoding not compatible with Xss::filter() introduced an asset library definitions change. Updating the core patch once more…

wim leers’s picture

StatusFileSize
new23.09 KB

Rebased the CKE5 patch. Also for #3247246: Attribute value encoding not compatible with Xss::filter() in particular.

wim leers’s picture

wim leers’s picture

StatusFileSize
new2.61 KB

Ugh, the patch generated by #56 failed because of the new Nightwatch test…

Let's see how this fares: #3044496-342: [ignore] bnjmnm patch testing.

wim leers’s picture

StatusFileSize
new25.47 KB
new1.05 KB
new2.61 KB

Better, but not there yet:

Checking core/modules/ckeditor5/tests/src/Nightwatch/Tests/drupalHtmlBuilderTest.es6.js

yarn run v1.22.5
$ cross-env BABEL_ENV=legacy node ./scripts/js/babel-es6-build.js --check --file /var/www/html/core/modules/ckeditor5/tests/src/Nightwatch/Tests/drupalHtmlBuilderTest.es6.js
[16:37:06] '/var/www/html/core/modules/ckeditor5/tests/src/Nightwatch/Tests/drupalHtmlBuilderTest.es6.js' is being checked.
Done in 0.77s.

/var/www/html/core/modules/ckeditor5/tests/src/Nightwatch/Tests/drupalHtmlBuilderTest.es6.js
   4:19  error  'jsdom' should be listed in the project's dependencies, not devDependencies  import/no-extraneous-dependencies
  10:27  error  eval can be harmful                                                          no-eval

✖ 2 problems (2 errors, 0 warnings)

For the first one, I think we should do https://stackoverflow.com/a/55863857, but let's go with the simplest possible fix for now…

Fingers crossed for #3044496-343: [ignore] bnjmnm patch testing

tim.plunkett’s picture

Two failures on the latest patch:

 Error: Cannot read test source location: /var/www/html/core/modules/ckeditor5/js/ckeditor5_plugins/drupalEngine/src/drupalhtmlbuilder.js

The patch is adding it at core/assets/vendor/ckeditor5/ckeditor5_plugins/drupalHtmlEngine/src/drupalhtmlbuilder.js
Looks like drupalHtmlBuilderTest.es6.js is using a relative path that works for contrib but not post-move.

1) Drupal\Tests\ckeditor5\Kernel\CKEditor5PluginManagerTest::testEnabledPlugins
Failed asserting that two arrays are identical.
--- Expected
+++ Actual
@@ @@
 Array &0 (
     0 => 'ckeditor5/drupal.ckeditor5'
-    1 => 'core/ckeditor5.basic'
-    2 => 'core/ckeditor5.internal'
-    3 => 'core/ckeditor5.pasteFromOffice'
-    4 => 'core/drupal.ckeditor5.emphasis'
-    5 => 'ckeditor5/drupal.ckeditor5.media'
-    6 => 'ckeditor5_test/layercake'
+    1 => 'ckeditor5/drupal.ckeditor5.media'
+    2 => 'ckeditor5_test/layercake'
+    3 => 'core/ckeditor5.basic'
+    4 => 'core/ckeditor5.internal'
+    5 => 'core/ckeditor5.pasteFromOffice'
+    6 => 'core/drupal.ckeditor5.emphasis'
 )

Same ones, just different order.

wim leers’s picture

I misread the green branch test result as a passing test 🙈🙈🙈

wim leers’s picture

StatusFileSize
new1.99 KB
new26.36 KB
new2.61 KB

Tried to address both things in #59.

Fingers crossed for #3044496-344: [ignore] bnjmnm patch testing

wim leers’s picture

StatusFileSize
new1.74 KB
new26.72 KB
new2.61 KB

Closer, but not there yet.

Eyes on #3044496-345: [ignore] bnjmnm patch testing.

wim leers’s picture

StatusFileSize
new1.09 KB
new26.73 KB
new2.61 KB

So close! The plugin manager test is now passing. Still something slightly wrong with file paths in the Nightwatch test, fixing that…

Eyes on #3044496-346: [ignore] bnjmnm patch testing.

tim.plunkett’s picture

+++ b/tests/src/Nightwatch/Tests/drupalHtmlBuilderTest.js
@@ -9,7 +9,8 @@ const { JSDOM } = require('jsdom');
 // eslint-disable-next-line no-eval
-const DrupalHtmlBuilder = eval(`(${fs.readFileSync(path.resolve(__dirname, '../../../../../../assets/vendor/ckeditor5/ckeditor5_plugins/drupalEngine/src/drupalhtmlbuilder.js')).toString()})`.replace('export default', ''));
+
+const DrupalHtmlBuilder = eval(`(${fs.readFileSync(path.resolve(__dirname, '../../../../../../assets/vendor/ckeditor5/ckeditor5_plugins/drupalHtmlEngine/src/drupalhtmlbuilder.js')).toString()})`.replace('export default', ''));

The no-eval is now failing because of the blank line

wim leers’s picture

StatusFileSize
new26.73 KB
new850 bytes
new2.61 KB

A most unwelcome and unfortunate accidental change 😬

#3044496-347: [ignore] bnjmnm patch testing (that issue is now timing out 😅 → see live progress at https://dispatcher.drupalci.org/view/D8%20Core%20Patches/job/drupal_patc...)

wim leers’s picture

00:55:47.874 [Tests/drupalHtmlBuilderTest.es6]
00:55:47.883 ✔ should return empty string when empty DocumentFragment is passed
00:55:47.889 ✔ should create text from single text node
00:55:47.892 ✔ should return correct HTML from fragment with paragraph
00:55:47.896 ✔ should return correct HTML from fragment with multiple child nodes
00:55:47.899 ✔ should return correct HTML from fragment with comment
00:55:47.904 ✔ should return correct HTML from fragment with attributes
00:55:47.906 ✔ should return correct HTML from fragment with self closing tag
00:55:47.908 ✔ attribute values should be escaped
00:55:48.011 
00:55:48.011 [Tests/drupalHtmlBuilderTest]
00:55:48.013 ✔ should return empty string when empty DocumentFragment is passed
00:55:48.015 ✔ should create text from single text node
00:55:48.017 ✔ should return correct HTML from fragment with paragraph
00:55:48.020 ✔ should return correct HTML from fragment with multiple child nodes
00:55:48.022 ✔ should return correct HTML from fragment with comment
00:55:48.025 ✔ should return correct HTML from fragment with attributes
00:55:48.026 ✔ should return correct HTML from fragment with self closing tag
00:55:48.028 ✔ attribute values should be escaped

🥳

wim leers’s picture

StatusFileSize
new1.1 KB
new10.41 KB
new26.73 KB
new2.61 KB

Address #3231364-75: Add CKEditor 5 module to Drupal core, points 2 and 3.

Relative to 7e3cf3bacce08f39c3c69b1081cefc2a9a15cf8b in CKE5, d63941bc1af2e1a31debad1f202e46351eaa149d in core.

lauriii’s picture

wim leers’s picture

StatusFileSize
new2.33 KB
new25.15 KB
new2.48 KB
wim leers’s picture

StatusFileSize
new2.48 KB

Swapped the CKE5 and core patch URLs 😇

#2488258-164: [ignore] Patch testing issue

wim leers’s picture

StatusFileSize
new1.22 KB
new25.2 KB
lauriii’s picture

StatusFileSize
new26.42 KB
new1.92 KB
wim leers’s picture

StatusFileSize
new2.48 KB
lauriii’s picture

StatusFileSize
new25.2 KB
wim leers’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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