Skip to content
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

Issue saving nested list #23

Open
atirtahirgroupdocs opened this issue Mar 4, 2023 · 1 comment
Open

Issue saving nested list #23

atirtahirgroupdocs opened this issue Mar 4, 2023 · 1 comment
Assignees

Comments

@atirtahirgroupdocs
Copy link
Contributor

This issue is raised in https://forum.groupdocs.com/t/editor-for-java-error-saving-word-document/12382/3

Hi,
Please take a look at this GIF https://drive.google.com/file/d/1F6Nww6Qi1sIeLlGieDbHlpWZG_ssJgrD/view
and this image -
ul-structure
There is a problem when we copy some nested list from google docs, paste it in app and save it.
Thanks

@denis-gvardionov
Copy link

Hello!

The W3C specs for the UL HTML element are postulating the next:

Only LI, transparent elements (INS and DEL) and script-supporting elements (SCRIPT and TEMPLATE) are valid children for the UL element (same for OL).

From the provided screenshot I see a root UL element, which have 2 children: LI (that is valid) and UL (that is invalid). Tjis is a broken HTML markup, and GroupDocs.Editor cannot allow, pas and process such invalid HTML markup, because in this case the overall document structure and styles will became undefined behavior. You may check this by yourself with the W3C Validator, for example: https://validator.w3.org/nu/#textarea

If you want a nested unordered list in another unordered list (this is valid), then you need to wrap the nested UL inside LI, as it is shown at the beginning of this page.

Regarding the error message:

Only LI element or transparent element can be added as child to this ‘ul’ element, but not the given ‘com.groupdocs.editor.htmlcss.a.b.b.d’ element

It is slightly inaccurate - there should be a

Only LI element or transparent element can be added as child to this ‘ul’ element, but not the given ‘ul’ element

This error message will be fixed in the next release, but, the overall HTML validation and verification mechanism will be untouched.

Regarding the "There is a problem when we copy some nested list from google docs, paste it in app and save it." - this may explain the reason of this issue. Maybe, when copying text from Google Docs, it stores it inside the clipboard in the wrong way, or something like that. Anyway, when the HTML markup is pasted inside the GroupDocs.Editor and saved, it is broken and thus is rejected.

If this scenario is vital for you and you cannot avoid such copy-pasting from Google Docs or somehow fix it, we can suggest the way that is implemented by the most web-browsers - allow such invalid HTML markup, but automatically wrap nested UL inside the LI element. It is a complex algorithm to detect such "broken use-cases" but it can be done if you really need it. But, again, it is much more better to paste a correct HTML markup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants