-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
CKEditor doesn't understand invalid nested lists #3007
Comments
cc @f1ames |
As mentioned, this is an invalid HTML ( We are aware of some issues with lists conversions (for example ckeditor/ckeditor5-list#112 or #1318) so we will definately work on that in the future. However, I'm not sure to what extend we should support invalid markup. I can agree that this one may be common for lists - and by fixing it we provide additional support for pasting from Evernote. I'm for leaving it open as a valid issue and try to handle it while working on improvements in list conversions (WDYT @Reinmar?). From more technical standpoint, the issue is caused by the list conversion mechanism and more precisely by |
I think we should consider handling such lists if some popular apps generate such an invalid HTML. Or simply if it often happens that an invalid HTML is used on some websites and people try to copy-paste that into the editor (and report it as a bug to us). That'd be a reason to work. But if this is a theoretical problem (no apps generate such content and no one stumbled upon this in real life), then it doesn't make sense to prioritise it. Also, I'm curious if the browser will actually put such an invalid HTML to the clipboard on copy. Sometimes, they fix invalid markup internally and put a more valid one into the clipboard. |
So would it be an easy fix to detect |
I encountered this issue not during copy & paste, but when I imported Evernote's ENEX file and then loaded it into the CKEditor. It's difficult to test this issue by directly copy & pasting from Evernote, because it's complicated by ckeditor/ckeditor5-list#116. So it's broken in different way: If instead I display the invalid list (without divs in li) in web browser and copy paste to CKEditor, then it behaves as the original issue (sub-list is skipped completely). |
I think it should work that way so looks like an easy fix. Shouldn't break anything during conversions IMHO.
Ok, so we should check what type of content Evernote puts into clipboard. If it's something like <ul>
<li>
<div>1</div>
</li>
<ul>
<li>
<div>1</div>
</li>
</ul>
</ul> it will cause the same issue (but invisible now due to ckeditor/ckeditor5-list#116). If the content is valid
maybe it will be good to see if there are other cases like @Reinmar mentioned:
Fixing it just because there is one specific, rare case (generating invalid HTML) may not makes sense ATM. |
I produced the invalid HTML content on Windows Evernote client. So it looks like Mac and Windows versions differ in handling this (which is a bit weird, but not impossible). |
@zadam Now that you mentioned it I checked to <ul>
<li><div>item1</div></li>
<ul>
<li><div>item2</div></li>
</ul>
</ul> so the same invalid content as on Windows. |
ps.: check the Gmail lists pasting: https://github.com/ckeditor/ckeditor5-paste-from-office/issues/20#issuecomment-520743218. |
Fix: Improved conversion of invalid nested lists. Closes #115.
Other: Remove the `fixListIndentation()` filter in favor of improved list converters fix. See ckeditor/ckeditor5-list#115.
Evernote produces following HTML:
Obviously, this (ul -> ul instead of ul -> li -> ul) isn't valid, but browsers don't have any trouble rendering it as expected. But CKEditor does this:
So it just ignores the nested list altogether. I'm not sure what approach CKEditor takes regarding the invalid HTML.
The text was updated successfully, but these errors were encountered: