Make ckeditor_indentblock compatible with ckeditor5

Created on 1 February 2023, over 1 year ago
Updated 21 August 2023, 10 months ago

Problem/Motivation

CKeditor 4 will be removed in Drupal 10 and ckeditor5 has been introduced as a core module in Drupal 9.4. This module should now be made compatible with ckeditor5.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇺🇸United States sean_fremouw

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @sean_fremouw
  • Assigned to justcaldwell
  • 🇺🇸United States justcaldwell

    This should be pretty simple, since the IndentBlock functionality already exists in CKEditor 5 Core—it was disabled in #3211125: Add "Block Indentation" plugin, but only allow list indentation —so we just need to re-enable it. No need for an external plugin.

  • @justcaldwell opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇺🇸United States justcaldwell

    In my testing, MR6 works with CKEditor 5 on both Drupal 9 and 10. It replicates the functionality of the current version with the exception of the ability to enable/disable paragraph indention on a per text editor/format basis. I'm guessing that this (or some version of it) would be released as a new 2.x branch.

    Please test/review if you're able. Thanks!

  • 🇺🇸United States justcaldwell

    Latest update adds the ability to enable/disable per text editor/format. The way I've done this feels a bit janky to me, but I couldn't find alternative. Maybe it's possible to fully disable the plugin in javascript?

    Also, I assume an upgrade path is still needed (i.e. implement CKEditor4To5Upgrade). I may take a crack at that in the next few days if nobody beats me to it.

  • First commit to issue fork.
  • Status changed to RTBC over 1 year ago
  • 🇺🇸United States neclimdul Houston, TX

    Worked well in testing. Made a few changes so the module could support CKEditor 4 transitions better and fixed a few nits.

  • Status changed to Needs review about 1 year ago
  • heddn Nicaragua

    We just added tests to the module and made the compatible w/ D10 and CK4. Can we re-review the work here again to make sure it will still work? We'll probably need a 2.x branch, but thats just logistics when it comes time to commit.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update about 1 year ago
    Composer require failure
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update about 1 year ago
    Composer require failure
  • 🇺🇸United States percoction

    As .patch and .diff files automatically generated from MRs on Gitlab may change as new commits are pushed, and similarly to the recommendation to download local copies of the patches to use in your workflow, I'm uploading a patch here, a copy of the current diff generated from the MR, that applies to the current latest commit of the 8.x-1.x-dev branch.

    Note: We have to target the 8.x-1.x-dev branch here instead of the latest 8.x-1.0-beta3 release as D.O. releases modify the composer.json file, which, I believe, was disallowing the patch to be applied.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update 11 months ago
    Composer require failure
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update 11 months ago
    Composer require failure
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update 11 months ago
    1 pass
  • 🇺🇸United States justcaldwell

    Okay, the tests are passing now. To do that I:

    1. Removed the drupal/ckeditor5 requirement from composer.json. It's included in core, so it's not needed and was causing Composer errors.
    2. Updated the hook_requirements() implementation to add a check for ckeditor5. The test was relying on a 'CKEditor IndentBlock' entry on at 'admin/reports/status' and none is present if ckeditor5 is installed instead of ckeditor(4).

    I manually tested again on Drupal 10 with no issues 🙌.

    I also manually tested 'upgrading' from ckeditor(4) to ckeditor5 on a fresh Drupal 9.5 instance. Again, no problems there, either (thanks to @neclimdul).

    I think this is good to go for a 2.x branch, but I don't want to RTBC since a lot of this is my code.

  • 🇺🇸United States justcaldwell

    Here's the latest version of the MR as a patch, should anyone need it.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update 11 months ago
    Patch Failed to Apply
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update 11 months ago
    Patch Failed to Apply
  • An available patch was created based on 8.x-1.0-beta3. We will use this until the new release.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update 11 months ago
    Patch Failed to Apply
  • 🇨🇦Canada ryanrobinson_wlu

    Patch worked for me to add it to ckeditor 5 (Drupal 9.5.10, PHP 8.1), but took it away from ckeditor 4 in the process.

    Is it possible to have it working in both at the same time? I'm currently evaluating 5 and trying to line up that we won't lose any features in the transition, allowing content editors to see it as a "preview." If that's not possible, so be it, I'll keep it only in 4 until I know everything else for 5 is ready.

  • 🇺🇸United States justcaldwell

    Hi @ryanrobinson_wlu! Can you elaborate on what you mean by "took it away from ckeditor 4 in the process"?

    It's absolutely possible to have both ckeditor 4 and ckeditor 5 in use in the same Drupal instance, and in all my testing the version of ckeditor_indentblock represented by the MR works fine with either 4 or 5.

    Have you created a new text format that uses ckeditor 5, so that your editors can switch to that to evaluate the new version?

  • 🇨🇦Canada ryanrobinson_wlu

    Hi @justcaldwell

    I appreciate the follow-up.

    I have a ckeditor 4 text format and a ckeditor 5 text format. Without the MR, I could indent paragraphs in ckeditor 4 but not 5. With the MR, I could indent paragraphs in ckeditor 5 but not 4, which I guess is different than your tests with it.

    Because of a few other factors I think we're now going to do a harder cutover to 5 instead of a slow transition, in which case this doesn't matter as much for us. If it isn't also a problem for anybody else, don't worry about it.

  • 🇺🇸United States justcaldwell

    Got it. Thanks for the additional info. I'm hoping this will get a review from the new maintainer soon.

    I assume this will be released as part of a 2.x branch, but I'm not entirely sure...

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update 10 months ago
    1 pass
  • heddn Nicaragua

    I've been able to test this on the CK5 site I have running. I didn't test the CK4 v CK5 scenario outlined in #15, but I think that is enough of an edge case I'm not going to worry about right now. Still testing things though.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update 10 months ago
    2 fail
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update 10 months ago
    2 fail
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update 10 months ago
    1 pass
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update 10 months ago
    1 pass
  • Status changed to RTBC 10 months ago
  • heddn Nicaragua

    I lied about not worrying about ck4 support. The test now tests that ck4 still works in d9 and ck5 works w/ d10. I think that is about as good as we'll get.

  • heddn Nicaragua

    We also need to tell site visitors that ck5 is required now with the module. It will _still_ work with ck4 (as seen w/ tests) but let's inform all new users of the module they want to install ck5. So I'm going to leave the entries:

    dependencies:
      - ckeditor:ckeditor
      - drupal:ckeditor5
    

    in info.yml. This doesn't mean we can't still provide a bc shim for ck4. But eventually we'll remove even that bc shim and only support ck5 going forward.

  • Status changed to Fixed 10 months ago
  • heddn Nicaragua

    Thanks everyone for your assistance to get this over the finished line.

  • 🇺🇸United States justcaldwell

    Yes! 🙌 Thank you, @heddn!

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

Production build 0.69.0 2024