Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Drupal 10 will be delivered with CKEditor 5 (since Drupal 9.3.x, we can enable CKEditor 5 module and set it as a text editor).
In order to make your plugin available for Drupal 10, we should have a new branch and rewrite the plugin as it is actually not compatible with CKEditor 5.
Comment | File | Size | Author |
---|---|---|---|
#7 | nbsp-3277174-7.patch | 488.06 KB | VladimirAus |
| |||
#5 | nbsp_CK5.png | 37.39 KB | mmiramont |
Issue fork nbsp-3277174
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:
- 3277174-ckeditor-5-compatibility changes, plain diff MR !1
Comments
Comment #2
mmiramont CreditAttribution: mmiramont commentedHello!
I was looking for this module for a project I am currently working on. At first I would have just replaced the deprecated code to make it Drupal 10 compatible, but seeing this issue made me start some modifications to also make it compatible with CKEditor 5.
Things I currently did:
<nbsp></nbsp>
on the CKEditor 4 and 5 versions, as explained on Issue 3066349. The filter is changed to replace this custom tag with a str_replace.Things currently not working or done:
Failed to load nbsp - Nbsp | CKEditorError: plugincollection-plugin-not-found {"plugin":null}
I'll create an issue fork and publish the modifications I did.
EDIT: code has been pushed to the branch associated to this issue
Comment #4
mmiramont CreditAttribution: mmiramont commentedI am still working on it. I finally managed to make the plugin work on CKEditor 5, but it actually creates a
<nbsp> </nbsp>
tag and moves the rest of the line visually on a new line. The SVG icon is also not displayed.I pushed the 'open merge request' to see if it show me a window, but didn't asked for a confirmation. The work is not finished, I am moving this on a 'needs work' status.
Comment #5
mmiramont CreditAttribution: mmiramont as a volunteer commentedI decided to go back on the modifications I did on the CKEditor 4 version of the plugin, and reuse the previous code while setting the template to
<nbsp> </nbsp>
For the CKEditor 5 version, the icon did not show up because it needed path to be correctly displayed. It is better now.
I splitted the JS files to get a similar behaviour and naming of the 'ckeditor5_plugin_starter_template' of the CKEditor5 Dev plugin
For the
<nbsp> </nbsp>
insertion, I followed the FAQ to insert the same template as the CKEditor 4 version.I also wrote the Test file, based on existing uses of the CKEditor5TestTrait. Currently the 'testButton' is failing. I'll move the status to 'Ready for Review' when I will pass it.
Comment #6
mmiramont CreditAttribution: mmiramont as a volunteer commentedThe test failed because having the
<nbsp> </nbsp>
alone is prevented by theallowWhere: '$text'
definition on the plugin. It needs text alongside to be correctly inserted and displayed. I do not see this as an issue, as non-breaking spaces are used alongside punctuation characters.I added some text before clicking the button, the test is now ok. I think I thought of everything.
Comment #7
VladimirAusIt does not allow me to push to existing fork so I'll upload the patch to match that applied to the latest version.
Comment #8
mmiramont CreditAttribution: mmiramont as a volunteer commentedSorry I didn't closely follow the latest changes on the module, and didn't see there was a new version. I rebased the branch onto, and following the latest changes on the Drupal 10 Beta 2 version where ckeditor4 is removed as well as older themes, I had to make some changes on the theme used during the tests and the dependencies.
From what I can see, it seems hard to provide the same module version for CKeditor4 and CKeditor5. Would it be better to provide an exclusive version of this module for Drupal 10 and another version for Drupal 9 (the current one published for example). Ckeditor4 code would be removed then in this branch.
Comment #9
VladimirAusThank you. Works.
Comment #13
wengerkUpdate-related issues (https://www.drupal.org/project/nbsp/issues/3066349) and credit people from that issue.
Working and reviewing the suggested code. Seems pretty solid at first sight.
I agree with you @mmiramont abour having another branch for the Drupal 10 + CKeditor 5 exclusive code.
Still if the current suggestion works for both I will merge in the current branch, create a release for Drupal 9, CKeditor 4|5 and then create a new dev branch where we will remove the Ckeditor 4 code to only support Ckeditor 5 for Drupal 10.
Comment #15
wengerkThanks @mmiramont for your hard works on this issue !! This has now been merged into the current dev branch (
8.x-2.x
).Fow now we have to do the following things in this order:
8.x-2.2
that works on Drupal 9/10 and CKeditor 4/53.0.0
supporting Drupal 10 & CKeditor 5 onlyComment #16
wengerkReleased
8.x-2.2
(CKEditor 4 & CKEditor 5) and3.0.0
(CKEditor 5) done.The new default branch is now
3.0.x
.Comment #17
Wim LeersWow! CKEditor 4 support, CKEditor 5 support, upgrade path, and test coverage for the upgrade path — and updated https://www.drupal.org/docs/core-modules-and-themes/core-modules/ckedito...! 🤩 👏
Superb work, @mmiramont! 😊