Problem/Motivation
We either need this to be fixed or #3274635: [upstream] Use CKEditor 5's native <ol type> and <ul type> UX.
Upstream bug report: https://github.com/ckeditor/ckeditor5/issues/11615
Steps to reproduce
- Allow
<ol type>
or<ul type>
with GHS - Edit content that contains
<ol type="A">
or<ul type="disc">
, and observe that CKE5 loses it.
Proposed resolution
We were informed by the CKEditor 5 team that the List
plugin in the ckeditor5-list
package has never been updated to integrate with GHS, so the above behavior is expected.
The solution is to use DocumentList
, which is new in v34.0.0
. Unfortunately, it's not available in the DLL build of ckeditor5-list
.
The CKEditor 5 team will tag a v34.0.1
release of CKEditor 5 which will add DocumentList
to ckeditor5-list
's DLL build. This will increase the size of the JS to be downloaded. Fortunately, the List
plugin will be sunset (and removed) in the near future, which means that the JS size will automatically decrease in a future release.
(See #6)
Remaining tasks
None.
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
N/A
Comment | File | Size | Author |
---|---|---|---|
#21 | 3274651-21.patch | 11.06 KB | Wim Leers |
| |||
#21 | interdiff.txt | 1.56 KB | Wim Leers |
#17 | 3274651-17.patch | 9.58 KB | Wim Leers |
| |||
#13 | interdiff--branches-with-3261599.txt | 805 bytes | Wim Leers |
#13 | 3274651-13--branches-with-3261599.patch | 12.19 KB | Wim Leers |
|
Comments
Comment #2
Wim LeersFailing tests.
Comment #3
Wim LeersComment #4
Wim Leers4 expected failures, all somewhat like this:
IOW: the test coverage works as expected 👍
Comment #5
Wim LeersTested locally after #3274767: Update to CKEditor 5 v34.0.0 landed, still failing.
Comment #6
Wim LeersI was informed by the CKEditor 5 team that the
List
plugin in theckeditor5-list
package has never been updated to integrate with GHS, so this is expected.The solution is to use
DocumentList
, which is new inv34.0.0
. Unfortunately, it's not available in the DLL build ofckeditor5-list
.The CKEditor 5 team will tag a
v34.0.1
release of CKEditor 5 which will addDocumentList
tockeditor5-list
's DLL build. This will increase the size of the JS to be downloaded. Fortunately, theList
plugin will be sunset (and removed) in the near future, which means that the JS size will automatically decrease in a future release.Comment #7
Wim LeersConfirmed that
<ol type>
works fine out of the box in CKEditor 4 in Drupal 9's text format. Also reported upstream: https://github.com/ckeditor/ckeditor5/issues/11615#issuecomment-1099321116.Comment #8
Wim LeersWe'll get
DocumentList
in #3277405: Update @ckeditor/ckeditor5-list to v34.0.1 👍Comment #9
Wim Leers<ol type="A">
test case in #2 with HEAD:results in:
So … that means we have another stable blocker almost fixed! 🥳
Comment #10
kim.pepper#3277405: Update @ckeditor/ckeditor5-list to v34.0.1 is in so this should be un-postponed.
Comment #11
Wim Leers3274651-11--branches-with-3261599.patch
(currently only10.0.x
).3274651-11.patch
(currently9.4.x
and9.3.x
).Comment #13
Wim LeersSilly oversight for the
--branches-with-3261599
patch … 🙈Comment #15
Wim LeersI just confirmed over at #3274178-10: [upstream] [GHS] Allowing `<ul type>` or `<ol type>` in SourceEditing crashes CKEditor 5 when editing `<ul></ul>` or `<ol></ol>` without any <li> elements as children that this also fixes that bug! 🥳
Transfering tags + credit.
Comment #16
Wim LeersComment #17
Wim LeersSame patch, but now running the entire core test suite.
I've proven in #11 that this will also work in
9.4.x
and9.3.x
. That only requires a different patch because #3261599: Use CKEditor 5's native <ol start> support (and also support <ol reversed>) didn't land yet in those two branches.So, this patch should be tested and committed against all 3. But for now, only testing against
10.0.x
.Comment #18
catchComment #19
Wim Leers#3261599: Use CKEditor 5's native <ol start> support (and also support <ol reversed>) was just committed to
9.4.x
and9.3.x
too — queuing tests of #17.Comment #20
Wim LeersPer https://github.com/ckeditor/ckeditor5/pull/11668#discussion_r859487538, this means we should also update
\Drupal\ckeditor5\HTMLRestrictions::getTextContainerElementList()
.Comment #21
Wim LeersComment #23
Wim LeersRandom unrelated fail.
Comment #25
nod_The CKE5 part looks good, but in claro there is a CSS conflict. We have claro's elements.css:
So even when there is a type attribute on the list it's always the decimal version that is shown, and it makes it seems it doesn't work. Not sure if that's a followup or a fix to make in this issue.
Comment #26
Wim LeersWow — interesting! 🤯
That is a pre-existing bug in Claro then, because it means other list style types already do not work in Claro. The scope of this issue is to make CKEditor 5 support this (because it is currently a data loss issue).
Claro making it look like it does not work correctly still is better than today: today it is a data loss issue.
Apparently that line was added in #3079738: Add Claro administration theme to core — i.e. the original commit of Claro in 2019. I cannot find a pre-existing bug report for this: https://www.drupal.org/project/issues/drupal?text=ordered+list+ol&status.... Created one: #3282598: Claro should not hardcode decimal list style type for <ol>.
Comment #27
nod_sounds good to me :D
Comment #28
lauriiiSince we're changing from
List
plugin toDocumentList
plugin, it would be useful to at minimum useful to document that in the issue summary. We might want to also retitle this because even though the change makes sense, it seems like we're doing more than what this issue suggests.Comment #29
Wim LeersComment #30
Wim LeersComment #31
alexpottReading the documentation for this method...
That seems really quite significant - does this really mean that an li will always need a div or a p inside it? Does this documentation need updating in light of this change? I'm guessing that the DocumentList plugin does not require li's to have a p or a div inside them.
Comment #32
Wim Leers<li>
s will not always need a<div>
or<p>
inside — but if you apply an alignment, then yes, it will generate a<p>
: CKEditor 5 will generate<li><p class="text-align-…">...</p></li>
, not<li class="text-align-…">...</li>
.See https://github.com/ckeditor/ckeditor5/pull/11668#discussion_r859487538 (previously linked from ##2).
Comment #33
lauriiiIt seems like
li
is a really confusing special case. It is a text-container element because it allows<li>foo</li>
but it doesn't allow any of the formatting that is usually allowed for text-containers 🙈 It seems likeDocumentList
usesParagraph
+ attributes for the model. 🤯 For our purposes, I'm pretty sure we shouldn't consider it as a text-container element since what we care about is whether formatting is allowed on the element or not.Comment #34
lauriiiFiled an issue for improving the docs regarding the special case elements: #3283173: Document <li> and <td> edge cases in \Drupal\ckeditor5\HTMLRestrictions::getTextContainerElementList.
Comment #35
alexpottThanks for creating the follow-up @lauriii - +1 to rtbc let's get this done.
Comment #40
lauriiiGot a confirmation from @alexpott that #32, #33, and #34 addresses concerns raised in #31.
Committed 9018da4 and pushed to 10.0.x. Also cherry-picked to 9.5.x, 9.4.x, and 9.3.x. Thanks!