Products.PortalTransforms ate my TinyMCE table

When I create a table containing empty rows in TinyMCE and re-edit the page, content goes missing. I realized this while editing a page in Plone 5.0.10 but the bug (or a variant thereof) still appears on the latest Plone 5.2.8. It is also not browser dependent, both Chrome and FF on Ubuntu exhibit this behavior.

Original table after first save:

I then edit some text above the table and re-save. The result is:

With versioning enabled, I can indeed see that parts of the table were deleted...

In Plone 5.2.8, the empty lines disappear, but at least not the content :wink:

Solved: empty cells must contain a non-breaking space. I still consider this a (documentation?) bug...

Edit: spoke too soon, the non-breaking spaces are removed when editing again.

Source of the document before editing:

<tr style="height: 21px;">
<td style="width: 22.5%; height: 21px;"><strong> Planning and Evaluation </strong></td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
</tr>
<tr style="height: 21px;">
<td style="width: 22.5%; height: 21px;">Prepare Debian testing servers for Tryton and Plone</td>
<td style="width: 2.5%; height: 21px;">X</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>
<td style="width: 2.5%; height: 21px;">&nbsp;</td>

and source in TinyMCE when editing again:

<tr style="height: 21px;">
<td style="width: 22.5%; height: 21px;"><strong> Planning and Evaluation </strong></td>
<td style="width: 2.5%; height: 21px;"> </td>
<td style="width: 2.5%; height: 21px;"> </td>
<td style="width: 2.5%; height: 21px;"> </td>
<td style="width: 2.5%; height: 21px;"> </td>
<td style="width: 2.5%; height: 21px;"> </td>
<td style="width: 2.5%; height: 21px;"> </td>
<td style="width: 2.5%; height: 21px;"> </td>
<td style="width: 2.5%; height: 21px;"> </td>
<td style="width: 2.5%; height: 21px;"> </td>
<td style="width: 2.5%; height: 21px;"> </td>
<td style="width: 2.5%; height: 21px;"> </td>
<td style="width: 2.5%; height: 21px;"> </td>
<td style="width: 2.5%; height: 21px;"> </td>
<td style="width: 2.5%; height: 21px;"> </td>
<td style="width: 2.5%; height: 21px;"> </td>
<td style="width: 2.5%; height: 21px;"> </td>
<td style="width: 2.5%; height: 21px;"> </td>
<td style="width: 2.5%; height: 21px;"> </td>
</tr>
</tbody>
</table>

I think it is the plone safe transform with lxml, sometimes empty tags are removed. This can be a problem with the <script> tags and empty divs (placeholders for custom/embed javascript, for example).

To see if it is TinyMCE, you can change in edit the select from text/html to text/x-web-textile. If the code is preserved, then it is TinyMCE, otherwise it is portal transform safe html transform.

1 Like

@yurj looks like you're right: I pasted my table with non-breaking spaces back in the document I'm editing. All looks OK there. Then I change to text/x-web-textile and see this:

The non-breaking spaces have been removed. All rows are still there however...

Argh! I then save this and go back to editing, result is a broken table

Screenshot from 2022-05-18 14-37-39

And on the Plone Demo site:

Screenshot from 2022-05-18 14-46-14

Another datapoint, the behavior is yet different again on Plone 5.1.6

I think I narrowed it down to drag-resizing of columns and rows in the table.

On the 5.1.6 version, creating an initial table with 6 rows with the tinymce interface and filling 3 of those rows with text, results in a table with 3 rows. Later, I can insert empty rows through the tinymce interface. Those stay in place after editing again.

If I copy/paste the html code from the table which gives me issues, the styles are removed. resizing the table has zero effect, but no no rows go missing. (this looks similar to what I saw on the latest plone 5.2.x demo site)

On the 5.0.10 version, the empty rows stay until I resize the columns. Here, width and height styles are inserted. After saving and re-editing, rows are missing.