Problem/Motivation

When both Insert media (MediaEmbed) and Drupal media (drupalMedia) buttons are in the CKEditor 5 toolbar, pasting any text into
the editor triggers:

Oops… It seems that the editor encountered an error.

The root cause is in ckeditor_media_embed.ckeditor5.yml. Even though mediaEmbed.AutoMediaEmbed is commented out, loading
mediaEmbed.MediaEmbed always forces it — because the CKEditor 5 MediaEmbed class declares it as a hard dependency via

static get
  requires()

:

  static get requires() {
      return [ MediaEmbedEditing, MediaEmbedUI, AutoMediaEmbed ];
  }
  

AutoMediaEmbed intercepts every paste event to auto-convert URLs into embeds, which conflicts with Drupal core's DrupalMedia paste
handler — causing the fatal error.

Steps to reproduce

  1. Enable ckeditor_media_embed and media modules.
  2. Add both Insert media (MediaEmbed) and Drupal media (drupalMedia) to a CKEditor 5 toolbar.
  3. Go to a node edit form using that text format.
  4. Paste any text into the body field.
  5. The editor crashes with "Oops… It seems that the editor encountered an error."

Proposed resolution

Replace mediaEmbed.MediaEmbed with its two sub-plugins directly, bypassing the forced AutoMediaEmbed dependency:

  # Before:
  ckeditor5:
    plugins:
      - mediaEmbed.MediaEmbed
      # - mediaEmbed.AutoMediaEmbed

  # After:
  ckeditor5:
    plugins:
      - mediaEmbed.MediaEmbedEditing
      - mediaEmbed.MediaEmbedUI
  

Both classes are already exported from the existing build/media-embed.js bundle. This keeps full MediaEmbed functionality — toolbar button, embed
dialog, and <oembed> rendering — without loading AutoMediaEmbed.

Remaining tasks

  • ✅ File an issue
  • ✅ Addition/Change/Update/Fix
  • ✅ Testing to ensure no regression
  • ➖ Automated unit testing coverage
  • ➖ Automated functional testing coverage
  • ➖ UX/UI designer responsibilities
  • ➖ Readability
  • ➖ Accessibility
  • ➖ Performance
  • ➖ Security
  • ➖ Documentation
  • ✅ Code review by maintainers
  • ✅ Full testing and approval
  • ✅ Credit contributors
  • ✅ Review with the product owner
  • ✅ Release notes snippet
  • ✅ Release ckeditor_media_embed-2.0.6

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • fix: #3579176 CKEditor 5 having Oops error on paste when both MediaEmbed and DrupalMedia buttons are in toolbar AutoMediaEmbed conflict

Comments

rajab natshah created an issue. See original summary.

rajab natshah’s picture

Issue summary: View changes

  • rajab natshah committed 9be0f9dd on 2.x
    feat: #3579176 CKEditor 5 having Oops error on paste when both...
rajab natshah’s picture

Assigned: rajab natshah » Unassigned
Issue summary: View changes
Status: Active » Needs review
Issue tags: +ckeditor_media_embed-2.0.6
rajab natshah’s picture

Issue summary: View changes