[FIX] web_editor: properly copy tables

A syntax error sometimes caused a traceback when copying a table.

opw-3166159

closes odoo/odoo#112562

X-original-commit: 7fdeced319902e26ce33b5ffd0dd08957c484eb4
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Antoine Guenet
2023-02-13 17:26:16 +01:00
parent 2e6ae86c58
commit 056af045be
@@ -3323,11 +3323,11 @@ export class OdooEditor extends EventTarget {
// cell that is itself selected, or if all its own cells are
// selected.
const isTableFullySelected =
table.parentElement && closestElement(table.parentElement, 'td.o_selected_td') ||
table.parentElement && !!closestElement(table.parentElement, 'td.o_selected_td') ||
[...table.querySelectorAll('td')]
.filter(td => closestElement(td, 'table') === table)
.every(td => td.classList.contains('o_selected_td'));
if (!isTableFullySelected(table)) {
if (!isTableFullySelected) {
for (const td of tableClone.querySelectorAll('td:not(.o_selected_td)')) {
if (closestElement(td, 'table') === tableClone) { // ignore nested
td.remove();