ckeditor5 icon indicating copy to clipboard operation
ckeditor5 copied to clipboard

List plugin will merge lists that are not the same

Open mlewand opened this issue 4 years ago • 2 comments

📝 Provide detailed reproduction steps (if any)

Currently list plugin's converters (during downcasting) will consider lists the same as long as they have: same tag name and classes.

See:

https://github.com/ckeditor/ckeditor5/blob/caca54b2dd596aceefcb1b03a1bd36b84ddfccad/packages/ckeditor5-list/src/utils.js#L175-L183

And combine both lists.

Lists could be as well differentiated by different attributes. For instance, per spec, ordered list can contain ol type (values like a, I or 1 denote numbering type, though it can be done by CSS too). With this logic two different lists will be merged.

Also developer might use custom data- attribute to semantically differentiate some lists type.

For instance I saw one CKEditor 5 implementation where there were 3 list types (numbered, bulleted and third). Third type was merged with bulleted as it was downcasted to ol[type] and it was considered to be same as plain ol which caused bug.

📃 Other details

  • Browser: Any
  • OS: Any
  • First affected CKEditor version: 24.0.0 (didin't check earlier but surely it's here for a longer time)

If you'd like to see this fixed sooner, add a 👍 reaction to this post.

mlewand avatar Jan 13 '21 15:01 mlewand

I pushed a i/8829 branch where I verified that adding attribute check solves the problem.

However, there are 11 failing unit test in list style so there's probably a need to accommodate for the fix in list style plugin too.

mlewand avatar Jan 25 '21 12:01 mlewand

This remains an issue 2 years on from the last update. Is there another issue anybody is aware of? We have a client that has CKE4 markup with two very different styled lists next to each other and they are arbitrarily being merged by CKE5.

dunx avatar Feb 21 '24 09:02 dunx

Is there another issue anybody is aware of?

See https://github.com/ckeditor/ckeditor5/issues/14478, more recently the AdjacentListsSupport plugin has been added that somewhat handles this use case. See #14944 for a known issue with regard to nested lists.

star-szr avatar Feb 26 '24 18:02 star-szr

Yes, thank you @star-szr, let's close it as a duplicate, this is resolved viaAdjacentListsSupport, and we need to fix #14944.

Witoso avatar Feb 27 '24 09:02 Witoso