ckeditor / ckeditor5

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.
https://ckeditor.com/ckeditor-5
Other
9.36k stars 3.68k forks source link

A tag added inside <span> in the "Source" mode is moved outside of <span> #15198

Open klimp-drupal opened 11 months ago

klimp-drupal commented 11 months ago

📝 Provide detailed reproduction steps (if any)

  1. Switch to the "Source" mode
  2. Paste <span><i>hello</i></span>
  3. Turn off the "Source mode" and then turn it on again

✔️ Expected result

<span><i>hello</i></span>

❌ Actual result

<i><span>hello</span></i>

📃 Other details

The same goes for <span><a>hello</a></span>. I tried the steps above with CKEditor4 - it works correctly. The problem occurs only with CKEditor 5. The problem occurs both on my Drupal 10 site (CKEDitor5 version: "39.0.1") and the demo page https://ckeditor.com/ckeditor-5/demo/html-support/

Witoso commented 11 months ago

Hi, the CKEditor 5 operates on an internal data model, not directly on the HTML as CKEditor 4 did. The converters then decide on the priority of how inline elements are reflected and their order. Think about it as a standardization process, the editor can have countless options how HTML is represented on the input but provides a unified output. It's possible to overwrite I think but requires a custom extension.

wimleers commented 10 months ago

Reminds me of https://www.drupal.org/project/drupal/issues/3389707 and https://www.drupal.org/project/drupal/issues/3393850 on drupal.org.