Open psmyrek opened 3 years ago
Similar issue is with the List
plugin, but in this case some comments are totally lost.
Example: after initializing the editor with the following content:
<!-- c1 -->
<ol>
<!-- c2 -->
<li>
<!-- c3 -->
Ordered list item
<!-- c4 -->
</li>
<!-- c5 -->
</ol>
<!-- c6 -->
<ul>
<!-- c7 -->
<li>
<!-- c8 -->
Unordered list item
<!-- c9 -->
</li>
<!-- c10 -->
</ul>
<!-- c11 -->
the editor.getData()
returns:
<!-- c1 -->
<ol>
<li>
<!-- c3 -->
Ordered list item
<!-- c4 -->
</li>
</ol>
<!-- c6 -->
<ul>
<li>
<!-- c8 -->
Unordered list item
<!-- c9 -->
</li>
</ul>
<!-- c11 -->
Comments <!-- c2 -->
, <!-- c5 -->
, <!-- c7 -->
and <!-- c10 -->
are lost.
I am currently trying to solve this issue with lists, specifically the newer DocumentList
plugin. I'm working on a project where it's common for <li>
items to be commented out. Would anyone be able to share some pointers on how to preserve these, whether in the HtmlComment
plugin/domconverter (happy to contribute if I can help figure it out) OR with a custom plugin?
So far I've only been able to figure out that these comments (like the c2, c5, c7, c10 from the previous comment) don't make it to the upcast converter in HtmlComment
, and I'm not yet sure why.
Example markup:
<ul>
<li>
one
</li>
<!--
<li>
two
</li>
-->
</ul>
This turns into:
<ul>
<li>
one
</li>
</ul>
@niegowski any ideas here?
I have a potential solution for lists, I can propose a fix in a pull request. I started looking into tables to see if it could be solved in a similar way but didn't get very far yet.
Update: In some cases the comments will still get repositioned (when at the start/end of the list from what I can see), but they would not be lost. I haven't looked into any solution for repositioning yet since my main concern is data loss. I will put up a basic PR later referencing this issue, and I can work on some tests next week.
Update again: Actually List and DocumentList both need updates, I have been focused on DocumentList but will see if List can be updated as well.
@star-szr Any update on comment repositioned within table?
@star-szr Any update on comment repositioned within table?
Hi, it's not needed for the project that I am working on so I am not planning to work on that.
Provide a description of the task
Steps to reproduce:
HtmlComment
manual test: http://localhost:8125/ckeditor5-html-support/tests/manual/htmlcomment.html.editor.getData()
. A few comments, originally located between<figure>
and<table>
,<table>
and<tbody>
or<tbody>
and<tr>
, are moved after the closing</table>
tag.It is also easily reproducible using
SourceEditing
:https://user-images.githubusercontent.com/56868128/125051559-5aa53680-e0a3-11eb-9e48-06bd48553ea8.mp4