I'm using the "Allowed html tags" filter in Ckeditor - Drupal 8.
I want Ckeditor to keep <span>
tags that have specific classes or IDs, and to remove if it has no attribute.
For example :
- Keep span:
<span class="apple">text sample</span>
- Keep span :
<span id="fruit">text sample</span>
- Remove span :
<span>text sample</span> -> text sample
Actually, when I configure a text format, I have this code in the allowed tags field :
<p><sup><sub><span id class="apple"><a href !href accesskey id rel target title>
It keeps <span>
with IDs or wanted classes, but I cannot get rid of the unwanted <span>
with no attribute.
Is there any way to solve this problem with code input?
Thanks in advance,
Emilie
editor.insertHtml
pollutes editable with empty spans #2813. I hope that an answer to this question will help me too. The span tags need to be removed by ckeditor on submitting the form as they should not be saved. – LarS