[FIX] web_editor: ensure no sibling tables for Firefox

Firefox doesn't seem to do well with sibling tables, so we need to
wrap them each in separate rows.

X-original-commit: 625a6545ee9e64a90e36b676c5b7b9a3c8d42418
Part-of: odoo/odoo#124465
This commit is contained in:
Antoine Guenet
2023-06-09 17:01:42 +02:00
parent 2b7ba8151a
commit ec4006549c
@@ -309,6 +309,16 @@ function bootstrapToTable(editable) {
for (const table of editable.querySelectorAll('table')) {
table.removeAttribute('o-temp-width');
}
// Merge tables in tds into one common table, each in its own row.
const tds = [...editable.querySelectorAll('td')]
.filter(td => td.children.length > 1 && [...td.children].every(child => child.nodeName === 'TABLE'))
.reverse();
for (const td of tds) {
const table = _createTable();
const trs = [...td.children].map(child => _wrap(child, 'td')).map(wrappedChild => _wrap(wrappedChild, 'tr'));
trs[0].before(table);
table.append(...trs);
}
}
/**
* Convert Bootstrap cards to table structures.