Problem/Motivation

In the issue queue of the Disable field module, issue #3353045: Not working on CKEditor5 Text(formatted, long) was reported, that it's no longer possible to disable ckeditor fields, since CKEditor5.

With CKEditor4 it was possible to disable the text editor by adding an disabled attribute to the underlying textarea. In CKEditor5, this needs some more changes:
https://ckeditor.com/docs/ckeditor5/latest/features/read-only.html
editor.enableReadOnlyMode()

Steps to reproduce

  • Visit a page with an CKEditor5 text editor.
  • Make the form element disabled. e.g. $form['editor']['#disabled'] = TRUE;

Proposed resolution

When the underlying textarea is disabled, enable read only mode.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3362386

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

JeroenT created an issue. See original summary.

jeroent’s picture

Issue summary: View changes
jeroent’s picture

jeroent’s picture

Status: Active » Needs review
StatusFileSize
new2.28 KB
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

Seems test-only patch passed.

MR should probably be updated for 11.x as that's the current development branch. Could be backported from there.

jeroent’s picture

Version: 10.0.x-dev » 11.x-dev

jeroent’s picture

Status: Needs work » Needs review
StatusFileSize
new5.51 KB

Status: Needs review » Needs work

The last submitted patch, 10: 3362386-10-test-only.patch, failed testing. View results

jeroent’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the test-only patch.

Think this is good. Could almost move to feature request though.

lauriii’s picture

Status: Reviewed & tested by the community » Needs review

Asked question on the MR.

smustgrave’s picture

Status: Needs review » Needs work

Could we extend the tests to include an additional text field?

dmitry.korhov’s picture

StatusFileSize
new7.66 KB

re-rolled for 10.1

jeroent’s picture

Status: Needs work » Needs review

I've tested the MR with multiple CKEditor5 fields and the MR works.

The example on https://ckeditor.com/docs/ckeditor5/latest/features/read-only.html also uses the same ID "docs-snippet", which can be found in the following js files:
https://ckeditor.com/docs/ckeditor5/latest/snippets/features/read-only-h...
https://ckeditor.com/docs/ckeditor5/latest/snippets/features/read-only/s...

smustgrave’s picture

Status: Needs review » Needs work

Still think the tests should be expanded for when there are multiple ckeditors on a form and only 1 is being disabled.

jeroent’s picture

Status: Needs work » Needs review

I've extended the tests to check if it still works with multiple fields.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

jeroent’s picture

Wim Leers made their first commit to this issue’s fork.

wim leers’s picture

Title: CKEditor5: Make it possible to disable text input » CKEditor 5 should respect <textarea disabled>

Fixed nits, RTBC++ — thank you, @JeroenT!

lauriii’s picture

Version: 11.x-dev » 10.1.x-dev
Status: Reviewed & tested by the community » Fixed

Committed b00c941 and pushed to 11.x. Cherry-picked to 10.1.x as a non-disruptive bug fix. Thanks!

  • lauriii committed b00c9410 on 11.x
    Issue #3362386 by JeroenT, Wim Leers, smustgrave: CKEditor 5 should...

  • lauriii committed d1979705 on 10.1.x
    Issue #3362386 by JeroenT, Wim Leers, smustgrave: CKEditor 5 should...
dmitry.korhov’s picture

Hi laurii,

Would be nice to respect all the contributors with credit for participating in resolving this issue.

Thanks

dmitry.korhov’s picture

Status: Fixed » Needs work
lauriii’s picture

Status: Needs work » Fixed

@dmitry.korkhau Thank you for your contributions to Drupal! I agree that it would be nice to grant all participants with issue credit. However, Drupal Core maintainers are trying to encourage contributors to contribute in ways that help the issue move forward. This means that we are not granting credit for certain types of participation that are not helping the issue move forward.

In the case of #16, the issue had been converted to an MR, meaning that posting additional patches of the MR is not helping the issue move forward. For that reason, I didn't grant credit for the additional patch posted.

More information on the issue credit guidelines.

wim leers’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.