Hello, I've been testing out CKEditor 4.4.5 to see if it would be a good upgrade for the CMS I work on. Our existing legacy editor has been responsible for making some "span soup" in the past and it is refreshing to see CKEditor have a better standard as far as what is considered best practice with html markup.
I had ended up doing tests with ACF turned off properly and realized that the core editor functionality cleans up span tags automatically outside of content filtering which is pretty neato.
However during integration testing I came across one scenario where the editor automatically creates span tags kind of innappropriately.
Original HTML markup pasted into the editor or preloaded on page load:
<span class="pageTitle">
<table border="1" cellspacing="0" cellpadding="3">
<tr>
<td><span class="content">This is some content cell 1</span></td>
<td>This is some content in cell 2</td>
</tr>
</table>
</span>
What appears in the editor source:
<table border="1" cellspacing="0" cellpadding="3">
<tr>
<td><span class="pageTitle"><span class="content">This is some content cell 1</span></span></td>
<td><span class="pageTitle">This is some content in cell 2</span></td>
</tr>
</table>
In my testing, td tags never inherit styles from a span tag outside of the table, so automatically applying that span class to each table cell would be incorrect and lead to undesired styling.
I am fully aware that the original is not good source code but with several hundred CMS installs with thousands of pages we do not have the option of manually updating code to avoid this scenario for everyone.
Any thoughts on options? I do not want to turn off span clean up (if that's even possible?), but would there be a way for the editor to just remove the span tag around the table in this context?
Also would there be any way for the editor to remove duplicate span tags following each other? Example being:
<span class="foo"><span class="foo">Hello World!</span></span>
On a unrelated question, would it be possible to set something up in the editor where a span tag with a specific class could be transformed to a heading tag with the same class on it?
I did further testing and
I did further testing and turned off the removal of empty span tags just to see what would happen and that made it worse!
Referring to my original test case, I put this source code in the editor:
With ACF off, and remove empty span tags turned off, the editor generated this:
Thoughts? Anyone know any nooks/crannies I can try to investigate/tweak? Is this a bug to be reported?