Problem/Motivation
With #3362386: CKEditor 5 should respect <textarea disabled>, the CKEditor is set to read-only mode during creation if the textarea is disabled.
But the textarea can also be disabled or enabled dynamically, e.g. via Conditional Form Fields.
Steps to reproduce
- Configure the
#statesproperty to dynamically set the disabled property (or use Conditional Fields) of a CKEditor field. - Notice that the read-only mode of the CKEditor is only set once at the start, but not dynamically.
Proposed resolution
Use a MutationObserver to observe the disabled attribute of the textarea and set the read-only mode dynamically.
Remaining tasks
implement testsimplement solution
User interface changes
N/A
Introduced terminology
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
The CKEditor 5 read-only mode is now set dynamically dependent on the disabled attribute of the textarea. Previously, it was only set once at initialization.
Issue fork drupal-3578477
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 #3
tgaugesI implemented my solution in !15058, please take a look.
I also needed to update
AssetAggregationAcrossPagesTest, presumably because of the increased size of ckeditor5.js. Is that correct?Comment #4
smustgrave commented99% there just some comments on the MR.
Comment #5
tgaugesThanks for the review. All the review comments have been fixed with https://git.drupalcode.org/project/drupal/-/merge_requests/15058/diffs?commit_id=fa6540948b6ff6e50c34dacedef951129dc0603f.
Please re-review.
Comment #6
smustgrave commentedBelieve this one is ready to go, working as expected.
Comment #7
alexpottCommitted 58b9d70 and pushed to main. Thanks!
We need backport to 11.x
Comment #10
tgaugesMR against
11.x: !15586Comment #11
alexpottThanks for doing the backport.
Comment #12
alexpottCommitted 4b4ace1 and pushed to 11.x. Thanks!
It conflicts with 11.3.x - @tgauges - if you want to backport it to there feel free to re-open and set to patch to be ported and make the branch.