Problem/Motivation
#3261599: Use CKEditor 5's native <ol start> support (and also support <ol reversed>) should've introduced an update hook for replacing <ol start type> in the Basic HTML editor in Standard to just <ol type>.
But … it didn't.
Tests didn't fail. Because Source Editing didn't complain.
This means \Drupal\ckeditor5\Plugin\Validation\Constraint\SourceEditingRedundantTagsConstraintValidator is not working precisely enough.
Discovered this over at #3274635: [upstream] Use CKEditor 5's native <ol type> and <ul type> UX.
Steps to reproduce
Proposed resolution
- Add explicit test coverage
- Tighten validator
- Fix Standard's default config
- Write update path
Remaining tasks
None.
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
N/A
Issue fork drupal-3396628
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
Comment #2
wim leersTightening this validator should make
\Drupal\Tests\standard\Functional\StandardTestfail.Which in turn should require us to write the missing update path hook.
Comment #3
wim leersThis blocks #3274635: [upstream] Use CKEditor 5's native <ol type> and <ul type> UX.
Comment #4
wim leersTurns out this is caused by:
This was introduced by #3260857: Expand SourceEditingRedundantTagsConstraintValidator to also check attributes and attribute values.
It was done intentionally (see #3260857-42: Expand SourceEditingRedundantTagsConstraintValidator to also check attributes and attribute values), but … I think the example here in Drupal core for
<ol start type>and<ol start>actually being natively supported is a pretty convincing reason to actually tighten this: it should complain about<ol start>.If we'd done that, then #3261599: Use CKEditor 5's native <ol start> support (and also support <ol reversed>) could not have forgotten to write the appropriate update path!
Comment #6
wim leersComment #7
wim leersComment #8
smustgrave commentedRunning the test-only feature
But @wim leers left 1 question and 1 nitpicky.
LEaving in review.
Comment #9
wim leersJust realized something:
\Drupal\ckeditor5\Plugin\CKEditor4To5Upgrade\Core::computeCKEditor5PluginSubsetConfiguration()'scase 'ckeditor5_list':should also be updated.Comment #10
wim leersOops, #9 was meant to be posted on #3274635: [upstream] Use CKEditor 5's native <ol type> and <ul type> UX 😅
Comment #11
smustgrave commentedI was actually confused for a second haha.
Test-only feature failed as expected.
Post_update ran without issue on a standard profile.
So think this is good.
Comment #12
wim leers#3393557: [upstream] Update CKEditor 5 to 40.0.0 landed, this needs a rebase & conflict resolution.
Comment #13
wim leersHoping @smustgrave can review this one more time — found a pretty big bug during rebasing 😅
Comment #14
wim leersComment #15
borisson_There is a failure in the tests, but it looks like that is unrelated and I'm not sure how to rerun tests with gitlab, this looks rtbc imho
Comment #16
wim leersRetesting — Nightwatch & Functional JS have been a bit flakey this week…
Comment #17
smustgrave commentedExtremely flakey!
Also agree this looks good!
Comment #18
lauriiiI posted couple comments in the MR
Comment #19
wim leersThanks to @lauriii, a new edge case has been found: because
SourceEditingRedundantTagsConstraintValidatorwas originally designed to handle tags, this code made sense:However … in the case of plugins with optional additional attributes, the above will result for
in concluding that for the enabled
ckeditor5_listplugin, the following things can be generated:<ul> <ol> <li>… because ofIOW: what's missing here is what additional attributes could be generated by enabling optional settings! 🐣
Comment #20
wim leersNow Umami tests fail 👍 https://git.drupalcode.org/issue/drupal-3396628/-/pipelines/47417/test_r...
And it's not just
<ol start type>being made editable through "Source Editing" that triggered a violation:👍
Comment #21
wim leersFixing Umami's
editorconfig nicely triggered a validation error in the correspondingfilter_formatconfig:👍
Fixed that too now — ready for review again, and WHAT A GREAT FIND from @lauriii 👏
Comment #22
smustgrave commentedThreads appear to be answered and pipeline showing green. No randoms this time!
Comment #23
catchLeft a comment on the MR regarding the post update.
Comment #24
xjmReposting my question from Slack: Does the upgrade path work from both Drupal 9 and CKE4 as well as from CKE5/Drupal 10 content getting updated a second time? Moving the fix to presave would also help with that aspect, but it still needs its own consideration since the source data formats from the two versions would be different.
Comment #25
wim leersComment #26
wim leers#23: did that. 👍
#24:
Yes.
git show e935c438 -- core/modules/ckeditor5/src/Plugin/CKEditor4To5Upgrade/Core.phpfor the updated 4 → 5 upgrade path, andgit show e935c438 -- core/modules/ckeditor5/tests/src/Kernel/SmartDefaultSettingsTest.phpfor the explicit test coverage. Note the, meaning that from that point onwards, it wouldn't configure
ckeditor5_sourceEditinganymore to enable the user to set<ol start>.CKEditor5UpdateOlStartReversed+core/modules/ckeditor5/tests/fixtures/update/editor.editor.test_format_list_ol_start_post_3261599.yml(added just now to explicitly test this case too 👍)CKEditor5UpdateOlStartReversed+core/modules/ckeditor5/tests/fixtures/update/editor.editor.test_format_list_ol_start.ymlComment #27
smustgrave commentedBelieve additional feedback has been addressed.
For my personal knowledge is there a good rule of thumb about when post_update should be used vs save?
Comment #28
wim leersI've been struggling with this too, even after @catch has pointed this out … 3 times in 2 months? 🙈
I think the rule is: for all config entities, always 🤔
Comment #29
longwaveThis change involves an upgrade path but the update is small, self-contained, has no BC concerns that I can see, and fixes a major bug, therefore I think the impact outweighs the disruption and therefore this can be committed during the beta phase of 10.2.0. It's also nice that we found and fixed extra config validation violations here!
Committed and pushed bcf5a9159e to 11.x and ec24a58c6d to 10.2.x. Thanks!
Comment #32
catchYes, this is correct :) Anything that could be in the database but also potentially in config shipped with a module.