[FIX] web_editor: prevent useless tbodys on convert

When converting, we ensure each table has a tbody
but inadvertently were wrapping each <tr> in a
separate tbody rather than wrapping all the contents
of the table.

Part-of: odoo/odoo#83233
This commit is contained in:
Antoine Guenet
2022-01-24 15:09:26 +00:00
committed by David Monjoie
parent badd8922f7
commit cc90b972f8
@@ -495,7 +495,9 @@ function formatTables($editable) {
}
// Ensure a tbody in every table and cancel its default style.
for (const table of $editable.find('table:not(:has(tbody))')) {
$(table).contents().wrap('<tbody style="vertical-align: top;"/>');
const $contents = $(table).contents();
$(table).prepend('<tbody style="vertical-align: top;"/>');
$(table.firstChild).append($contents);
}
// Children will only take 100% height if the parent has a height property.
for (const node of $editable.find('*').filter((i, n) => (