New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty <a> tags removed automatically despite CKEDITOR.dtd settings #3267
Comments
I can confirm this bug. Currently there is no way to preserve empty links without hacks. The source of this comes from line above. It looks like, it was to cover some IE upstream issue. Instead of removing empty links they should be filled with zero with space, eventually space can be removed when retrieving editor data. |
I am using workaround by adding dummy |
This is still a problem. Now, notices, that even having I can't correctly reproduce it, because it seems to be dependent from some specific tag structure, but I have an exact HTML code which does reproduce it, if anyone is interested to fix it. |
This is still a problem. :( |
Thoughts after delving into this issue. Overall, this is more complex than I initially assumed.
To sum up: After allowing the addition of empty links without additional |
So, we have a few places that are responsible for keeping/removing empty
Those code fragments are connected with the old issues - mentioned in the comments. I didn't encounter any issues with selection - which is a thing mentioned earlier by @KarolDawidziuk TBC... |
So we are touching core filter logic with this issue. Those cases intentionally ignore the Also, that might require setting the This will also require handling those old issues in this new reality. So probably we might ignore After that, there will be still failing tests according to the 'anchor' feature. So my recommendation is also |
Type of report
I have searched for solution, but seems there are more users having hard time to use empty tags correctly: https://stackoverflow.com/questions/18250404/ckeditor-strips-i-tag - there are at lest 3 different solutions -
DTD class alone does not help: https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dtd.html#property-S-removeEmpty
Provide detailed reproduction steps (if any)
#link1
is removed together with div wrapper (which becomes empty, of course, if A is removed).Codepen with tests: https://codepen.io/arnis-juraga/pen/NZZxPX
Expected result
A tag should either stay, or it should innerHTML replaced with
Actual result
See Codepen. Empty A tag removed.
IMPORTANT!
If you enter ANYTHING into first
<div>
tag, likeX
symbol in example - empty tag is not removed!This works fine:
If you rename this #link1 tag to
i
tag, and addthen the same HTML works fine (with
i
tag instead ofa
), check codepen:https://codepen.io/arnis-juraga/pen/yddOgN
Some other resources, having difficulties to use empty tags:
https://stackoverflow.com/questions/18261198/ckeditor-removing-empty-span-automatically
https://stackoverflow.com/questions/44417887/how-to-make-ckeditor-stop-removing-empty-divs
https://stackoverflow.com/questions/11782236/ckeditor-removes-empty-tags
The text was updated successfully, but these errors were encountered: