- Issue created by @drupalite1411
- 🇮🇳India drupalite1411
Hi cilefan, Could you please replicate the issue.These issues were not there in ckeditor4.
- 🇮🇳India drupalite1411
Hi Someone ,can please check. This is issue is impacting our whole site after migration to cke5editor from ckeditor4
Hi @Drupalite1411,
Did you manage to resolve this? I have the same problemPlease find out if this is a CKEditor behavior or a Drupal integration or filter. Use https://ckeditor.com/ckeditor-5/demo/
- 🇮🇳India drupalite1411
@torresrecife No I am still using ckeditor 4 due to this issue.
- 🇳🇿New Zealand quietone
Moving to CKEditor5 component. The component 'ckeditor.module' refers to CKEditor 4, it was the simplest way to distinguish them when they were both in core.
- 🇦🇹Austria mvonfrie
@cilefen, this definitely is a CKeditor behavior. To get some context, why that happens in CKeditor5, please read https://github.com/ckeditor/ckeditor5/issues/16203.
Some support from the Drupal Core team there might be helpful.
- 🇮🇳India niranjan_panem Gurugram
checked in drupal 11, CKEditor5 automatically adds paragraph tags to elements. Currently, this issue cannot be resolved without an update from the CKEditor 5 maintainers.
- 🇺🇸United States emanaton
NOTE: Pasting into ckeditor5 works on their website without it adding the extra wrapping p tag: https://ckeditor.com/docs/ckeditor5/latest/examples/builds-custom/full-f...
Given that, this is something we should be able to fix in drupal...
- 🇺🇸United States jvogt Seattle, WA
I'm still seeing the issue at the link from emanaton.
From the Source view, enter this outside any other element:
<span class="test">test</span>
Click Save and it turns into:
<p> <span class="test">test</span> </p>
- 🇨🇭Switzerland handkerchief
Same problem here. For example, if you add a dl-list:
<dl> <dt>Some text</dt> <dd>Some text too</dd> </dl>
Will result in this after saving:
<dl> <dt><p>Some text</p></dt> <dd><p>Some text too</p></dd> </dl>
I tried it with all format filter unchecked (/admin/config/content/formats/manage/full) , and with the filters like html corrector, newline
etc. on = same result. - 🇨🇭Switzerland handkerchief
Some simila issues:
🐛 Prevent CKEdtior5 from wrapping blockquote elements with unneeded tags Closed: works as designed - 🇨🇭Switzerland handkerchief
Workaround for specific cases:
/** * Implements hook_preprocess_HOOK(). */ function THEME_preprocess_TEMPLATENAME(&$variables) { // Remove the <p>tags inside <dt> and <dd> tags. if ($text = $variables['items'][0]['content']['#text']??NULL) { if (str_contains($text, '<dt')) { $result = preg_replace( pattern: '#<(dt|dd)\s*>\s*<p>(.*?)</p>\s*</\1>#si', replacement: '<$1>$2</$1>', subject: $text ); $variables['items'][0]['content']['#text'] = $result; } } }
But be careful, for complex scenarios you go better with the DOM-API.