CKEditor 5 support

Created on 3 September 2022, almost 2 years ago
Updated 1 April 2024, 3 months ago

Problem/Motivation

Drupal 10 will have CKEditor5 which will require additional changes. This module also has dependencies that must be updated as well.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Needs review

Version

2.0

Component

Code

Created by

🇺🇸United States shelane

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States emptyvoid

    Conducting an investigation and with the update of the embed module I tested taking the output for embedding a view from Ckeditor4 and simply pasted it into the source for a ckeditor5 page.

    To my surprise the embed and rendering worked!

    I noted in ckeditor4 that the placement of the view embed didn't render in editor mode anymore.
    And of course the button and dialog is missing from ckeditor5, since the plugin api has totally changed.

    Official Documentation
    https://ckeditor.com/docs/ckeditor5/latest/framework/guides/plugins/crea...

    Ckeditor5 Dev Tools
    https://www.drupal.org/project/ckeditor5_dev

    Article Overview on components
    https://tech.axelerant.com/create-and-integrate-ckeditor-5-plugin-with-d...

    The Challenge is writing a new integration plugin into the current module to use the previous display and lookup methods to embed the templated embed object into the editor.

    The input plugin and template parser appear to be working in Drupal 9.5.5 and ckeditor5!

  • Assigned to o_tymoshchuk
  • Issue was unassigned.
  • First commit to issue fork.
  • 🇺🇸United States bnjmnm Ann Arbor, MI

    I pushed some initial changes to the fork. This depends on an entity embed issue landing that adds much of the necessary logic: Drupal 10 & CKEditor 5 readiness Fixed . Fortunately, many consider landing that a high priority and it's likely to get in soon. If anyone wants to work on this prior to that landing, they should have entity embed on that issue branch.

    The fork here is far from complete, but it's already making itself available as a CKEditor 5 plugin that can open the embed views dialog. That's further along than I expected without writing any CKEditor 5 plugin code - this was purely leveraging the plugin provided by entity embed. Unfortunately, submitting the form doesn't successfully add the view, so I assume some CKEditor5 JS will need to be added. Worst case, this can wind up being a copypaste of the entity_embed plugin with small changes to get it working with the views embed. The logic will largely be the same, but preview endpoints and perhaps attributes used will need changing, but most of the logic needed is basically there.

  • Merge request !73307775 "Ckeditor5 support" → (Open) created by bnjmnm
  • Status changed to Needs review 8 months ago
  • 🇺🇸United States bnjmnm Ann Arbor, MI

    There's probably some cleaning up needed but the MR now has a working CKEditor 5 plugin. Here's a short video of it in action https://youtu.be/4FDWNzidAXI

    Remember that this requires the entity embed code provided here Drupal 10 & CKEditor 5 readiness Fixed . At the time I'm typing this, it has not yet been merged / released, but this should be happening soon.

    Also, this won't likely work with the CKEditor 5 version in Drupal 9 - but the Drupal 10 CKEditor 5 is more current and should be fine.

    I'm setting this to "Needs Review" to get eyes on it, but it probably needs a round or two of refinement before it's fully ready. The parts that require CKEditor 5 knowledge are all set.

  • 🇺🇸United States nys-osc

    Patch works good on CKEditor 5. However, it overwrites Entity Embed.
    When Entity Embed (EE) and Views Entity Embed are enabled (VEE), VEE overwrites EE.
    Both are not working together

  • 🇨🇦Canada megan_m

    Is that why I'm getting this error:

    Drupal\Component\Plugin\Exception\InvalidDeriverException: Plugin (views_entity_embed_drupalentity) deriver "Drupal\entity_embed\Plugin\CKEditor5Plugin\DrupalEntityDeriver" does not exist. in Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDeriverClass() (line 218 of core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php).

    ?

  • 🇧🇪Belgium Wim Leers Ghent 🇧🇪🇪🇺

    @megan_m: no, that suggests that you are running a version of Entity Embed that does not yet support CKEditor 5. Try updating to the dev release.

  • 🇦🇹Austria drupalfan2

    I applied this MR 7 using this patch
    https://git.drupalcode.org/project/views_entity_embed/-/merge_requests/7...

    and afterwords my 2 embed buttons for embedding blocks and nodes did not work anymore. Each button wants to embed views instead of blocks or nodes:

    This patch has negative effects on the Entity Embed module! Embeding blocks and nodes do not work anymore.

    But I would need a working solution.
    Can you help?

    Thank you very much.

  • 🇮🇳India shalini_jha

    I have attempted to implement Merge Request (MR) #7 to upgrade my existing Drupal 9.5.11 site with CKEditor 5. However, the functionality is not working as expected. Despite adding View Embed toolbar to Full HTML, the text editor is operating only in plain text mode, but the existing data remains unchanged.see screen shot (ckditor5plaintext)

    After testing with Drupal 10, I replicated the same configuration on my site using view entity embed. Now, the text editor is functioning properly with the changes introduced in Merge Request (MR) #7.

    for enabling the only view entity embed toolbar both the filter is required "Display embedded entities" & Display embedded views.

  • 🇮🇳India shalini_jha

    I have implemented a patch to address the issues in Drupal 9.5 and CKEditor 5. Upon conducting research, I discovered a similar problem documented on https://www.drupal.org/project/entity_embed/issues/3396133 🐛 Ckeditor 5 Interface not loading on text formats using entity embed Active . I adopted the same approach outlined there to resolve the issues, and after testing, I can confirm that the patch effectively resolves the problem.

    I have conducted thorough testing on Drupal 10.1.5, and there no JavaScript errors. Additionally, CKEditor 5 is functioning as expected without any console issues.

    I kindly request your review of the changes.

  • 🇺🇸United States shelane

    Is the patch the same as the MR or different?

  • 🇮🇳India shalini_jha

    This patch differs from the previously mentioned MR. After thoroughly testing the Merge Request (MR) for CKEditor 5 in Drupal 9.5, I have observed some console issues as i have mentioned in #19. To address these concerns, I have introduced an additional patch. Please let me know if i can move these changes to the MR.

  • 🇺🇸United States shelane

    Yes. Please add to the MR so I better review what is different.

  • 🇮🇳India shalini_jha

    Sure, i have pushed my changes in this MR . please review.
    Thanks

  • 🇺🇸United States shelane

    That last commit is impossible to review because it looks like everything changed. Can you explain what is different?

  • 🇮🇳India shalini_jha

    I made modifications to the toolbar.js file for the CKEditor5 plugin. Subsequently, I generated the updated build JS file using the build command.

  • 🇨🇦Canada benoit.borrel

    For info, latest version of merge request 7 has worked for us.
    Config: PHP 8.3.3, Drupal 10.2.4, embed 8.x-1.7, entity_embed 8.x-1.5, views_entity_embed 2.0.2

  • Status changed to Needs work 3 months ago
  • 🇺🇦Ukraine lobodacyril

    Merge request #7 works for me and views embed button works correctly but other embed buttons stoped working. For example, if I add new embed button that embeds webform, block or media, then this buttons works as views embed buttons and show View Embed modal form. If I disable "Display embedded views" filter, then they works as expected.

  • Status changed to Needs review 3 months ago
  • 🇺🇦Ukraine lobodacyril

    Now it works on my side.

  • 🇮🇳India Bushra Shaikh

    I applied MR !7 got below error:

    error: patch failed: src/Plugin/EmbedType/EmbedViews.php:43
    error: src/Plugin/EmbedType/EmbedViews.php: patch does not apply
Production build 0.69.0 2024