Review main Merged Breaking

75480[!!!][FEATURE] Integrate CKEditor5 as new RTE

Benni Mack CR +2 V +2 Impossible +109961 −833 updated 10/01/22, 20:17

Commit message

This change adds CKEditor v5, which is a completely new
editor compared to the previous CKEditor 4. It works without
iframes, and has a new plugin API and editing API, allowing to
work faster and easier with rich text content editing.

CKEditor v4 is removed completely from TYPO3 v12, as its
support lifecycle will end in late 2023.

CKEditor v5 is created as a bundle file with a list of built-in plugins
(see ckeditor5-bundle.js).

TYPO3 ships with a typo-link custom plugin, which can be added and
loaded dynamically via the RTE configuration yaml file.

As most of the editor configuration is changed due, a migration
tool will migrate as many options as possible. However, PLEASE NOTE:
It might be possible that data loss occurs as some features have
to be enabled explicitly.

As the iframe is removed, the contents.css now needs a CSS prefix
for the editor in order to apply styling. This is done via a SCSS
parser (added as PHP dependency) for the time being, until we find
a better solution to create custom CSS files for RTEs.

This change is marked as breaking as CKEditor 4 configuration and
integration is removed, and due to the possible data loss, which
might happen due to invalid plugins (based on CKEditor 4) which then
do not render their contents anymore.

The new editor and its configuration is still experimental as
we need to stabilize our integration code to cover more scenarios.

Supported functionality:
* Configurable toolbar items via RTE presets
* Custom typolink plugin + dynamically loaded plugin architecture via ES6
* Custom contents.css file loaded
* Migration for various config settings (see CKEditor5Migrator class)

Missing features which might get added later-on:
* extended autolinking plugin
* additional attributes for typo3-link plugin

In addition, the integration code still contains various "@todo"
remarks which should get resolved during further v12 development.

CKEditor4 removal is put in a dedicated, separate patch.

Used commands:

  composer req scssphp/scssphp:^1.11
  composer req scssphp/scssphp:^1.11 -d typo3/sysext/core --no-update

  cd Build/

  npm install \
      @ckeditor/ckeditor5-alignment \
      @ckeditor/ckeditor5-autoformat \
      @ckeditor/ckeditor5-basic-styles \
      @ckeditor/ckeditor5-block-quote \
      @ckeditor/ckeditor5-clipboard \
      @ckeditor/ckeditor5-code-block \
      @ckeditor/ckeditor5-core \
      @ckeditor/ckeditor5-dev-utils \
      @ckeditor/ckeditor5-editor-classic \
      @ckeditor/ckeditor5-engine \
      @ckeditor/ckeditor5-essentials \
      @ckeditor/ckeditor5-find-and-replace \
      @ckeditor/ckeditor5-heading \
      @ckeditor/ckeditor5-horizontal-line \
      @ckeditor/ckeditor5-html-support \
      @ckeditor/ckeditor5-indent \
      @ckeditor/ckeditor5-link \
      @ckeditor/ckeditor5-list \
      @ckeditor/ckeditor5-paragraph \
      @ckeditor/ckeditor5-paste-from-office \
      @ckeditor/ckeditor5-remove-format \
      @ckeditor/ckeditor5-source-editing \
      @ckeditor/ckeditor5-special-characters \
      @ckeditor/ckeditor5-style \
      @ckeditor/ckeditor5-table \
      @ckeditor/ckeditor5-theme-lark \
      @ckeditor/ckeditor5-ui \
      @ckeditor/ckeditor5-undo \
      @ckeditor/ckeditor5-utils \
      @ckeditor/ckeditor5-word-count

  npm install --save-dev \
      @types/ckeditor__ckeditor5-alignment \
      @types/ckeditor__ckeditor5-autoformat \
      @types/ckeditor__ckeditor5-basic-styles \
      @types/ckeditor__ckeditor5-block-quote \
      @types/ckeditor__ckeditor5-clipboard \
      @types/ckeditor__ckeditor5-code-block \
      @types/ckeditor__ckeditor5-core \
      @types/ckeditor__ckeditor5-editor-classic \
      @types/ckeditor__ckeditor5-engine \
      @types/ckeditor__ckeditor5-essentials \
      @types/ckeditor__ckeditor5-find-and-replace \
      @types/ckeditor__ckeditor5-heading \
      @types/ckeditor__ckeditor5-horizontal-line \
      @types/ckeditor__ckeditor5-html-support \
      @types/ckeditor__ckeditor5-indent \
      @types/ckeditor__ckeditor5-link \
      @types/ckeditor__ckeditor5-list \
      @types/ckeditor__ckeditor5-paste-from-office \
      @types/ckeditor__ckeditor5-remove-format \
      @types/ckeditor__ckeditor5-source-editing \
      @types/ckeditor__ckeditor5-special-characters \
      @types/ckeditor__ckeditor5-table \
      @types/ckeditor__ckeditor5-ui \
      @types/ckeditor__ckeditor5-undo \
      @types/ckeditor__ckeditor5-utils \
      @types/ckeditor__ckeditor5-word-count

  npm uninstall \
    ckeditor-wordcount-plugin \
    ckeditor4

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Georg Ringer +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Georg Ringer +1
    • core-ci +1 CI

Issues 1

Files 40

Show 20 more files

Review log 64109

Show 4784 earlier messages
  1. Benni Mack uploaded patch set 1 08/17/22, 10:55

  2. core-ci voted on patch set 1 V +1 08/17/22, 11:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30226

  3. Oliver Hader uploaded patch set 2 08/17/22, 11:40

  4. core-ci voted on patch set 2 V -1 08/17/22, 11:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30230

  5. Benjamin Franzke uploaded patch set 3 08/23/22, 20:44

  6. core-ci voted on patch set 3 V +1 08/23/22, 20:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30392

  7. Oliver Hader uploaded patch set 4 08/26/22, 09:41

  8. core-ci voted on patch set 4 V -1 08/26/22, 09:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30458

  9. Oliver Hader uploaded patch set 5 08/26/22, 18:09

  10. core-ci voted on patch set 5 V -1 08/26/22, 18:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30472

  11. Benjamin Franzke uploaded patch set 6 08/29/22, 06:39

  12. Benjamin Franzke commented on patch set 6 08/29/22, 06:39

    Not sure whether it is "better", but for bootstrap.js (which we bundled via an entry-point script as well ) we used: Build/Sources/JavaScript/core/Resources/Public/JavaScript/Contrib/bootstrap.js (Although I'd drop Resources/Public/JavaScript from the path nowadays). So maybe: Build/Sources/JavaScript/rte_ckeditor/contrib/ckeditor5-bundle.js Did so in patchset 6.
    yea, we should probably use something like @typo3/ckeditor5-bundle instead, as @ckeditor/ckeditor5 isn't available as a npm package all, and it contains a custom composition of ckeditor5 packages, so it's rather a @typo3/... thing. Then a custom declaration doesn't feel so wrong (and is fine) IMO. Did so in patchset 6, hope that's ok.
  13. core-ci voted on patch set 6 V +1 08/29/22, 06:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30515

  14. Oliver Hader commented on patch set 6 08/31/22, 20:05

    Reply

    > Did so in patchset 6, hope that's ok. Any change/improvement is totally fine, thx! I felt kind of lost with the combination of Grunt, Rollup (or Webpack) and the CKEditor5 dependencies...
  15. Oliver Hader uploaded patch set 7 09/07/22, 17:45

  16. core-ci voted on patch set 7 V +1 09/07/22, 17:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30776

  17. Oliver Hader uploaded patch set 8 09/07/22, 18:29

  18. core-ci voted on patch set 8 V +1 09/07/22, 18:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30778

  19. Tyrell king commented on patch set 8 09/07/22, 18:47

    test
  20. Tyrell king commented on patch set 8 09/07/22, 18:50

    <a onmouseover="alert(1)">xyz link</a>
  21. Oliver Hader commented on patch set 8 09/07/22, 18:51

    Reply

    https://typo3.org/community/teams/security/bug-bounty-program → please report potential security issues to mailto:security@typo3.org
  22. Benjamin Franzke commented on patch set 8 09/07/22, 18:55

    Reply

    I think this was a penetration test against this gerrit instance, not a security report.
  23. Benni Mack wrote 09/07/22, 19:45

    Removed cc Tyrell king.
  24. Oliver Hader uploaded patch set 9 09/08/22, 10:56

  25. core-ci voted on patch set 9 V -1 09/08/22, 11:03 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30804

  26. Oliver Hader uploaded patch set 10 09/21/22, 07:23

  27. core-ci voted on patch set 10 V -1 09/21/22, 07:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31338

  28. Oliver Hader uploaded patch set 11 09/21/22, 13:06

  29. core-ci voted on patch set 11 V -1 09/21/22, 13:22 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31368

  30. Oliver Hader uploaded patch set 12 09/21/22, 15:14

  31. core-ci voted on patch set 12 V -1 09/21/22, 15:23 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31385

  32. Oliver Hader uploaded patch set 13 09/22/22, 14:43

  33. core-ci voted on patch set 13 V -1 09/22/22, 14:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31456

  34. Oliver Hader uploaded patch set 14 09/23/22, 10:51

  35. core-ci voted on patch set 14 V -1 09/23/22, 10:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31476

  36. Oliver Hader uploaded patch set 15 09/23/22, 15:40

  37. core-ci voted on patch set 15 V -1 09/23/22, 15:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31486

  38. Oliver Hader uploaded patch set 16 09/28/22, 16:48

  39. core-ci voted on patch set 16 V -1 09/28/22, 16:56 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31670

  40. Benni Mack uploaded patch set 17 09/28/22, 21:23

  41. core-ci voted on patch set 17 V -1 09/28/22, 21:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31673

  42. Benni Mack uploaded patch set 18 09/28/22, 21:59

  43. core-ci voted on patch set 18 V -1 09/28/22, 22:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31674

  44. Oliver Hader uploaded patch set 19 09/28/22, 22:13

  45. core-ci voted on patch set 19 V -1 09/28/22, 22:21 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31675

  46. Oliver Hader commented on patch set 19 09/28/22, 22:36

    bootstrap.js:1

    Unrelated... probably due to newer rollup or whatever version
  47. Benni Mack uploaded patch set 20 09/28/22, 22:51

  48. Oliver Hader uploaded patch set 21 09/28/22, 22:56

  49. core-ci voted on patch set 20 V -1 09/28/22, 22:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31676

  50. core-ci voted on patch set 21 V -1 09/28/22, 23:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31677

  51. Benni Mack uploaded patch set 22 09/28/22, 23:09

  52. Benni Mack uploaded patch set 23 09/28/22, 23:15

  53. core-ci voted on patch set 22 V -1 09/28/22, 23:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31678

  54. Benni Mack updated the commit message in patch set 24 09/28/22, 23:19

  55. Benni Mack uploaded patch set 25 09/28/22, 23:20

  56. core-ci voted on patch set 23 V -1 09/28/22, 23:24 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31679

  57. core-ci voted on patch set 24 V -1 09/28/22, 23:28 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31680

  58. core-ci voted on patch set 25 V -1 09/28/22, 23:33 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31681

  59. Oliver Hader uploaded patch set 26 09/29/22, 07:39

  60. core-ci voted on patch set 26 V -1 09/29/22, 07:57 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31689

  61. Oliver Hader uploaded patch set 27 09/29/22, 11:25

  62. core-ci voted on patch set 27 V -1 09/29/22, 11:39 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31700

  63. Oliver Hader uploaded patch set 28 09/29/22, 15:02

  64. core-ci voted on patch set 28 V -1 09/29/22, 15:10 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31712

  65. Oliver Hader uploaded patch set 29 09/29/22, 15:21

  66. core-ci voted on patch set 29 V -1 09/29/22, 15:29 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31713

  67. Benni Mack uploaded patch set 30 09/29/22, 22:46

  68. core-ci voted on patch set 30 V -1 09/29/22, 22:54 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31720

  69. Benni Mack uploaded patch set 31 09/29/22, 22:57

  70. Benni Mack uploaded patch set 32 09/29/22, 22:58

  71. core-ci voted on patch set 32 V -1 09/29/22, 23:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31723

  72. core-ci voted on patch set 31 V -1 09/29/22, 23:10 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31722

  73. Oliver Hader uploaded patch set 33 09/30/22, 12:00

  74. core-ci voted on patch set 33 V +1 09/30/22, 12:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31744

  75. Oliver Hader uploaded patch set 34 09/30/22, 12:08

  76. core-ci voted on patch set 34 V +1 09/30/22, 12:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31745

  77. Benni Mack uploaded patch set 35 09/30/22, 12:15

  78. core-ci voted on patch set 35 V +1 09/30/22, 12:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31746

  79. Benni Mack uploaded patch set 36 09/30/22, 12:52

  80. Benni Mack commented on patch set 36 09/30/22, 12:54

    bootstrap.js:1 Reply

    Done
  81. core-ci voted on patch set 36 V +1 09/30/22, 13:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31750

  82. Oliver Hader uploaded patch set 37 09/30/22, 13:19

  83. core-ci voted on patch set 37 V +1 09/30/22, 13:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31756

  84. Oliver Hader uploaded patch set 38 09/30/22, 14:59

  1. core-ci voted on patch set 38 V +1 09/30/22, 15:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31762

  2. Benni Mack uploaded patch set 39 09/30/22, 15:49

  3. core-ci voted on patch set 39 V +1 09/30/22, 15:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31764

  4. Oliver Hader uploaded patch set 40 09/30/22, 20:36

  5. core-ci voted on patch set 40 V +1 09/30/22, 20:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31770

  6. Benni Mack voted on patch set 40 V +1 CR +1 09/30/22, 21:24

  7. Oliver Hader uploaded patch set 41 10/01/22, 07:32

  8. core-ci voted on patch set 41 V +1 10/01/22, 07:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31801

  9. Benjamin Franzke uploaded patch set 42 10/01/22, 08:18

  10. core-ci voted on patch set 42 V +1 10/01/22, 08:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31803

  11. Benni Mack commented on patch set 42 V +1 CR +1 10/01/22, 08:52

    Still flaky but I think we should integrate it rather sooner than just before the LTS release ;)
  12. Benjamin Franzke commented on patch set 42 10/01/22, 10:27

    RichTextElement.php:137

    Hm, so this field-dependent prefix will result in a cached css file to be created for every content element that is added. Do we really need to take into account the `$fieldId` in the cssPrefix? Is that because RTE configuration may be configured per page/table/whatever (i don't know all the possibilities to be honest). Would really be valueable when ckeditor could be rendered into shadowdom.
  13. Oliver Hader commented on patch set 42 10/01/22, 11:52

    RichTextElement.php:137 Reply

    ShadowDOM and cache-identifier would be a future optimization (actually the partition is just the `styleScr`).
  14. Benjamin Franzke commented on patch set 42 10/01/22, 14:08

    RichTextElement.php:137 Reply

    > actually the partition is just the `styleScr You mean like "should be" (as future optimization)? Because currently it is really both, $cssPrefix and $styleSrc: > $styleSrcHash = sha1(json_encode([$cssPrefix, $styleSrcContent])); https://review.typo3.org/c/Packages/TYPO3.CMS/+/75480/42/typo3/sysext/rte_ckeditor/Classes/Controller/ResourceController.php#54
  15. Benni Mack uploaded patch set 43 10/01/22, 15:08

  16. core-ci voted on patch set 43 V +1 10/01/22, 15:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31830

  17. Georg Ringer voted on patch set 43 V +1 CR +1 10/01/22, 18:48

  18. Benjamin Franzke uploaded patch set 44 10/01/22, 18:51

  19. Benjamin Franzke commented on patch set 44 10/01/22, 18:59

    Note: moved the requirejs-cleanup in coordination with benni into a separate TASK which can be merged in parallel (before or after this one, doesn't matter): https://review.typo3.org/c/Packages/TYPO3.CMS/+/75936

    RichTextElement.php:137 Reply

    Ok, anyway, let's fix that later on.
  20. core-ci voted on patch set 44 V -1 10/01/22, 19:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31841

  21. Benjamin Franzke commented on patch set 44 V +1 CR +1 10/01/22, 19:09

    Voting positive now to merge this asap, albeit there is still quite some stuff to be done: Especially annoying is the behaviour when writing a lot of content: * the ballooning-toolbar sticks to the docheader when scrolling back up * missing max-height
  22. core-ci voted on patch set 44 V +1 10/01/22, 19:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31841

  23. Georg Ringer voted on patch set 44 V +1 CR +1 10/01/22, 20:01

  24. Benjamin Franzke commented on patch set 44 V +2 CR +2 10/01/22, 20:16

    Merging now, decision to merge was basically already taken in https://review.typo3.org/c/Packages/TYPO3.CMS/+/75480/44#message-f7c2342f6bfa4bcffc153c917fd819fdf2646479 and this is starting to block other patches.
  25. Benjamin Franzke merged patch set 45 10/01/22, 20:17