CKEditor 5 plugin only works when the "Link" plugin is enabled

Created on 7 November 2023, about 1 year ago
Updated 16 September 2024, 3 months ago

Problem/Motivation

I have an editor configuration which includes Entity Embed buttons but not the Link button in the toolbar. CKEditor is not able to load and i get the following error in the browser console (Firefox):

CKEditorError: plugincollection-soft-required {"missingPlugin":"LinkEditing","requiredBy":"EntityEmbedLinkUi"}
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-plugincollection-soft-required

Proposed resolution

Correctly configure dependency to link plugin and add checks in JavaScript.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

CKEditor integration

Created by

πŸ‡©πŸ‡ͺGermany tgauges

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

Merge Requests

Comments & Activities

  • Issue created by @tgauges
  • πŸ‡©πŸ‡ͺGermany tgauges

    I found out that adding core/ckeditor5.link to the entity_embed/entity_embed library and link.LinkEditing and link.LinkUI to plugins entry of the CKEditor 5 plugin PHP class fixes the initial problem.
    This causes another error very unhelpful error:

    TypeError: e is undefined
  • πŸ‡©πŸ‡ͺGermany tgauges

    The error seems to be caused by linkediting.js#L394 because the 'link' command ist not available as well. The same issue will pop up a few lines above.

  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • πŸ‡©πŸ‡ͺGermany tgauges

    My changes in the issue fork work for my use case. I'm not sure that I found every use of the link dependency, please review.

  • Pipeline finished with Success
    about 1 year ago
    Total: 996s
    #45562
  • πŸ‡ΊπŸ‡ΈUnited States jayemel

    I ran into this as well while creating an input format to only allow Entity embeds. CKEditor toolbar and entity embeds fail to render without the link button added to the toolbar. I get the same error in the issue description.

    Maybe has something to do with the balloon that comes up when clicking an embedded entity? "Link Entity Embed (cmd-k)" needs the link plugin?

    Is there a way to disable this behavior? I don't have the need to link entities.

  • Status changed to Needs work 5 months ago
  • πŸ‡­πŸ‡ΊHungary Balu Ertl Budapest πŸ‡ͺπŸ‡Ί

    I can confirm the issue is reproducible with the latest HEAD of this module on 10.1.x and 10.2.x core versions both. (On 10.3.x no β€œE” button appears on the filter format settings page.)

    The suggested solution resolves the problem indeed: the WYSIWYG editor's toolbar loads & works as expected even if the only single button is the one with the letter β€œE” on it. (No link button is needed to be present.)

    The merge request currently conflicts with the target branch 8.x-1.x in the /js/build/drupalentity.js file. As JavaScript falls out of my expertise domain, thus I'll let someone with more confidence in JS resolve the conflict. Hence moving to Needs work.

  • Status changed to Needs review 5 months ago
  • πŸ‡©πŸ‡ͺGermany tgauges

    I created a new branch and MR against 8.x-1.6: https://git.drupalcode.org/project/entity_embed/-/merge_requests/42

  • Pipeline finished with Failed
    5 months ago
    Total: 793s
    #226780
  • πŸ‡ΊπŸ‡ΈUnited States possibri

    Tested #10 and that looks to have fixed the error. Having people test it now, but upon initial checks things seem to work as expected. Thanks @tgauges!

Production build 0.71.5 2024