Problem/Motivation

CKeditor 4 will be removed in Drupal 10 and ckeditor5 has been introduced as a core module in Drupal 9.4. This module should now be made compatible with ckeditor5 and replace ckeditor as a dependency.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

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

brooke_heaton created an issue. See original summary.

rajkumar2030’s picture

Any update.

rajkumar2030’s picture

Please update this issue has been fixed or not , Thanks!

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

s_leu’s picture

Status: Active » Needs review

This can now be reviewed. The MR will integrate the list styles options as in the ckeditor5 demo of this feature.

The patch is based on a customized version of the ckeditor5-list package which is part of the ckeditor5 main repo.The reason for including the plugin that way is that it's based on the ongoing work to bring this functionality into core, which unfortunately is blocked by a bug in ckeditor5 itself, see also the corresponding comment in the core issue.

The customized version of the ckeditor5 included in the MR solves these problems and is a shortcut to make this functionality available in Drupal right now, as it's uncertain how long a fix in ckeditor5 and a corresponding update of ckeditor5 inside Drupal core will take to be committed.

Please note that the following core patch in this comment is currently required to make this patch work.

vipul tulse’s picture

Assigned: Unassigned » vipul tulse
vipul tulse’s picture

Assigned: vipul tulse » Unassigned
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new57.18 KB
new340.82 KB

Hello s_leu,

I have cloned the module and enabled it locally, the module working fine and covers all the functionality from the existing module
list type (e.g. circle, square, dot for bulleted list or decimal, lower/upper roman, lower/upper alpha for numbered list)
start number (for numbered list).

Please check the screenshot, all the options working fine

bserem’s picture

StatusFileSize
new925.95 KB

Because usage of MRs directly in composer is a bad practice (cause they are dynamic), I'm adding a patch file (which is static) of the MR as it is today, to be used until this gets included in the project.

Thanks for all the work done here.

bserem’s picture

StatusFileSize
new917.46 KB

Re-roll of all work towards the latest (1.5) version of the module.
MR updated.

wim leers’s picture

This will be obsolete once #3274635: [upstream] Use CKEditor 5's native <ol type> and <ul type> UX lands in Drupal core 😊

Please review that, so we can land it there!

bousley’s picture

Any update on this functionality? Thank you for your hard work. This is eagerly anticipated and much needed. Thanks again!

vipul tulse’s picture

@s_leu there one issue I'm facing, unable to add a code block inside list
can you check

yivanov’s picture

While using this patch and upgrading to Drupal core 10.2.1, I get the following issue:

The "ckeditor5_list" CKEditor 5 plugin definition is configurable, but its default configuration does not match its config schema. The following errors were found: [properties] missing schema, [multiBlock] missing schema.

chrisla’s picture

I am getting same issue as #14 when upgrading to Drupal 10.2.1. Only solution for me was to uninstall the module for now

chrisla’s picture

I was able to resolve issue from #14 by removing the patch from #10 I was applying -- https://www.drupal.org/files/issues/2023-08-15/3326957-liststyle_ck5-10-...

sassafrass’s picture

Using:

"drupal/core-recommended": "^10.2"
"drupal/ckeditor_liststyle": "1.x-dev@dev"

Also getting the error in #14:

Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException: The "ckeditor5_list" CKEditor 5 plugin definition is configurable, but its default configuration does not match its config schema. The following errors were found: [properties] missing schema, [multiBlock] missing schema. in Drupal\ckeditor5\Plugin\CKEditor5PluginDefinition->validateDrupalAspects() (line 190 of core/modules/ckeditor5/src/Plugin/CKEditor5PluginDefinition.php).
jncruces’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new909.54 KB

Confirmed the problem with D10.2.

The next patch solves the problem but I know that it needs more work because the schema of the configuration is incorrect. The patch works but needs more work.

jncruces’s picture

StatusFileSize
new1.17 KB

Adding interdiff.

akshayadimolam’s picture

StatusFileSize
new39.17 KB

Using:

"drupal/core-recommended": "^10.2",
"drupal/ckeditor_liststyle": "1.x-dev@dev"

Not getting any onscreen error when applied patch #18. But when I try to switch the text format on the editor, the editor box is getting added on top of each whenever we switch the text format. Attached is the screenshot. And Attached the console error:

ckeditor5.js?s9w418:477 CKEditorError: schema-cannot-extend-missing-item {"itemName":"$listItem"}
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-schema-cannot-extend-missing-item
    at li.extend (ckeditor5-dll.js?v=40.2.0:5:312284)
    at On.<anonymous> (html-support.js?v=40.2.0:5:62810)
    at On.fire (ckeditor5-dll.js?v=40.2.0:5:604093)
    at On._fireRegisterEvent (html-support.js?v=40.2.0:5:45500)
    at editor.data.on.priority (html-support.js?v=40.2.0:5:43517)
    at Vi.fire (ckeditor5-dll.js?v=40.2.0:5:604093)
    at <computed> [as init] (ckeditor5-dll.js?v=40.2.0:5:607777)
    at editor-classic.js?v=40.2.0:4:9696
(anonymous)	@	ckeditor5.js?s9w418:477

When I remove the patch and test it, the above issue is not repeating.

tomefa’s picture

Getting this error also with Drupal 10.2.4, ckeditor_liststyle 1.5.0 + this patch #18
And the CKEditor textarea is empty.

mvnovick’s picture

I am getting the the problem as described above with Drupal 10.2.2, CKEditor List Style 1.5, and patch #18.

tomefa’s picture

StatusFileSize
new909.62 KB
new571 bytes

The problem, after applying the patch, is in the file config/schema/ckeditor_liststyle.schema.yml
it is not having the correct configuration.

Here the patch updated, and the diff.

tomefa’s picture

StatusFileSize
new1.07 KB
tomefa’s picture

FYI: we have decide to uninstall this module and use the patch that bring the same functionality but directly in Drupal core: https://www.drupal.org/project/drupal/issues/3274635#comment-15507417

loopy1492’s picture

Same error for us when we apply 23. This is a real bummer. The core project @Tomefa linked is too buggy for us to use. For some reason all of these base themes have set the list styles at a fundamental level. Never mind the fact that ckeditor injects it onto the page itself with /docroot/core/assets/vendor/ckeditor5/list/list.js

Edit: nuts. Imported config and busted again.

Edit edit. Wow. I just noticed how this module is overriding list.js... it has its own committed to the repo. That is wild.

loopy1492’s picture

StatusFileSize
new355.65 KB

The list style buttons seem to work, but when the wysiwyg loads, I'm still getting this in the console:

CKEditorError: schema-cannot-extend-missing-item {"itemName":"$listItem"}
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#erro...
at li.extend (ckeditor5-dll.js?v=40.2.0:5:312284)
at On. (html-support.js?v=40.2.0:5:62810)
at On.fire (ckeditor5-dll.js?v=40.2.0:5:604093)
at On._fireRegisterEvent (html-support.js?v=40.2.0:5:45500)
at editor.data.on.priority (html-support.js?v=40.2.0:5:43517)
at Vi.fire (ckeditor5-dll.js?v=40.2.0:5:604093)
at [as init] (ckeditor5-dll.js?v=40.2.0:5:607777)
at editor-classic.js?v=40.2.0:4:9696

And every time we switch text formats, the toolbar duplicates ad nauseum.

loopy1492’s picture

And I'm getting these errors when editing two different text formats:

'styles' is not a supported key.

and

The List plugin needs another plugin to create

    , for it to be able to create the following attributes:
      . Enable a plugin that supports creating this tag. If none exists, you can configure the Source Editing plugin to support it.
loopy1492’s picture

I noticed there's no ckeditor5.yml file for this module. That's where the plugins would be defined. Isn't this file necessary for any ckeditor 5 module?

loopy1492’s picture

Cloned comment from https://www.drupal.org/node/3283526

I added a ckeditor5.yml file:

ckeditor_liststyle_liststyle:
  ckeditor5:
    plugins:
      - list.bulletedListStyle
      - list.numberedListStyle
  drupal:
    label: ListStyle
    library: ckeditor_liststyle/editor
    class: Drupal\ckeditor_liststyle\Plugin\CKEditor5Plugin\ListStyle
    elements:
      - <ul>
      - <ul type>
      - <ol>
      - <ol type>
    conditions:
      plugins:
        - ckeditor5_list

And we are getting:

LogicException: The "ckeditor_liststyle_liststyle" CKEditor 5 plugin implements ::getElementsSubset() and did return a subset ("<ul type><ol type reversed start>") but the following tags can no longer be created: "<ul><ol>". in Drupal\ckeditor5\Plugin\CKEditor5PluginManager->getProvidedElements() (line 409 of /home/ide/project/docroot/core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php).

And of course the eternal problem of this message on the text format.

With CKEditor 5 this is a read-only field. The allowed HTML tags and attributes are determined by the CKEditor 5 configuration. Manually removing tags would break enabled functionality, and any manually added tags would be removed by CKEditor 5 on render.

Even adding the ul and ol manually to the config yml file won't override the Allowed HTML tags on import.

So what are we supposed to do?

loopy1492’s picture

I genuinely have no idea what's going on with this module but we pinned to

"drupal/ckeditor_liststyle": "1.x-dev#a34d9baa310af13de950e6e1f46c38faa6ac7c07",

And another one of our team members simply created a ckeditor 5 patch for the info file

diff --git a/ckeditor_liststyle.info.yml b/ckeditor_liststyle.info.yml
index 0823a9d..691e029 100644
--- a/ckeditor_liststyle.info.yml
+++ b/ckeditor_liststyle.info.yml
@@ -3,5 +3,5 @@ type: module
 description: This plugin adds numbered list and ordered list properties dialogs (available in context menu) in CKEditor.
 package: CKEditor
 dependencies:
-  - drupal:ckeditor
+  - drupal:ckeditor5
 core_version_requirement: ^8 || ^9 || ^10

And the module works.

This makes literally no sense whatsoever but here we are. My guess is the most recent version of the library works fine and any addional Drupaly stuff isn't really necessary to make sure the plugin works in general.

Specifically, I believe whatever code was added to make the "styles" toggle work in the new code is busted in many ways. If you want this module to work, simply pin the release to the version and hash I have marked above and use the patch I added below. Hopefully this lets us ride it out until the core issue is completed and we have list styles as a part of core.

loopy1492’s picture

StatusFileSize
new440 bytes
sassafrass’s picture

loopy1492’s picture

I mis-spoke. It only works on the full_html text format ... I assume because it allows for the changing of any HTML tag? I'm guessing since every other text format must abide by whatever tags are allowed by the different plugins, ul type and ol type cannot be added.

I don't know. This is a bit of a mess.

myst1c’s picture

I’ve reviewed and tested the patch (#10), and I’ve had it working in a project for a while now.

dak5859’s picture

Any movement on updates to this module to make it compatible with CKEditor5? We're on core 10.4.5. The workarounds on this thread seem to indicate we'd have to keep the deprecated CKEditor4 dependency enabled as well which we wouldn't want to do.

dak5859’s picture

As a follow up to my last comment/question. I ended up using the 10.4.5 core patch that brings this same functionality via https://www.drupal.org/project/drupal/issues/3274635#comment-16045633. Looks as though they're getting very close to merging this update into core as well. Hoping this patch is short lived.