After migration from D9 to D10,different html tags are enclosing in p tag. In D9 we were using ckeditor 4 and now in D10 core ckeditor5 is used. Is there any way to resolve it?
Ckeditor 4 source code:
<form>
<h1 class="hcHeading">
Can you <span>relate?</span>
</h1>
<label>label</label>
</form>Ckeditor 5 souce code : label tag inside form tag is wrapped in p tag
<form>
<h1 class="hcHeading">
Can you <span>relate?</span>
</h1>
<p>
<label>label</label>
</p>
</form>Ckeditor 4 source code :
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown button
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
<li>
<a class="dropdown-item" href="#">Action</a>
</li>
<li>
<a class="dropdown-item" href="#">Another action</a>
</li>
<li>
<a class="dropdown-item" href="#">Something else here</a>
</li>
</ul>
</div>
Ckeditor 5 code: button is wrapped inside <p> tag
<div class="dropdown">
<p>
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown button
</button>
</p>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
<li>
<a class="dropdown-item" href="#">Action</a>
</li>
<li>
<a class="dropdown-item" href="#">Another action</a>
</li>
<li>
<a class="dropdown-item" href="#">Something else here</a>
</li>
</ul>
</div>
Comments
Comment #2
cilefen commentedI feel like this may already have been asked.
Comment #3
drupalite1411 commentedHi cilefan, Could you please replicate the issue.These issues were not there in ckeditor4.
Comment #4
drupalite1411 commentedHi Someone ,can please check. This is issue is impacting our whole site after migration to cke5editor from ckeditor4
Comment #5
torresrecife commentedHi @Drupalite1411,
Did you manage to resolve this? I have the same problem
Comment #6
cilefen commentedPlease find out if this is a CKEditor behavior or a Drupal integration or filter. Use https://ckeditor.com/ckeditor-5/demo/
Comment #8
drupalite1411 commented@torresrecife No I am still using ckeditor 4 due to this issue.
Comment #9
quietone commentedMoving 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.
Comment #10
mvonfrie commented@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.
Comment #11
gaele commentedComment #12
niranjan_panem commentedchecked in drupal 11, CKEditor5 automatically adds paragraph tags to elements. Currently, this issue cannot be resolved without an update from the CKEditor 5 maintainers.
Comment #13
emanaton commentedNOTE: 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...
Comment #14
jvogt commentedI'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:
Comment #15
handkerchiefSame problem here. For example, if you add a dl-list:
Will result in this after saving:
I tried it with all format filter unchecked (/admin/config/content/formats/manage/full) , and with the filters like html corrector, newline br-tag etc. on = same result.
Edit: Interesting thing, if you add a normal ul or ol-list over the ckeditor toolbar, no p-tags are added.
Comment #16
handkerchiefSome similar issues:
#3370610: Prevent CKEdtior5 from wrapping blockquote elements with unneeded <p> tags
https://github.com/ckeditor/ckeditor5/issues/1537
Comment #17
handkerchiefWorkaround for specific cases:
But be careful, for complex scenarios you go better with the DOM-API.