From ec4006549cca4f71c917fcc5b5bc473efa720b43 Mon Sep 17 00:00:00 2001 From: Antoine Guenet Date: Fri, 21 Apr 2023 08:21:09 +0000 Subject: [PATCH] [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 --- .../web_editor/static/src/js/backend/convert_inline.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/web_editor/static/src/js/backend/convert_inline.js b/addons/web_editor/static/src/js/backend/convert_inline.js index c202a129a8f..3eca5f0c9d3 100644 --- a/addons/web_editor/static/src/js/backend/convert_inline.js +++ b/addons/web_editor/static/src/js/backend/convert_inline.js @@ -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.