[FIX] web_editor: properly add nested tables where needed
There was dead code in `addTables` that would never get triggered. When fixing that, the code crashed because of a reference to the wrong variable. Those two problems are hereby fixed. X-original-commit: 21dccd1521c654eb9723a93bceda8e3e3ec8cc6a Part-of: odoo/odoo#81540
This commit is contained in:
@@ -638,14 +638,14 @@ function addTables($editable) {
|
||||
$(snippet).remove();
|
||||
|
||||
// If snippet doesn't have a table as child, wrap its contents in one.
|
||||
if (!$col.children().filter('table')) {
|
||||
if (!$col.children().filter('table').length) {
|
||||
const $tableB = _createTable();
|
||||
$tableB[0].style.width
|
||||
const $rowB = $('<tr/>');
|
||||
const $colB = $('<td/>');
|
||||
$rowB.append($colB);
|
||||
$tableB.append($rowB);
|
||||
for (const child of [...$table[0].childNodes]) {
|
||||
for (const child of [...$col[0].childNodes]) {
|
||||
$colB.append(child);
|
||||
}
|
||||
$col.append($tableB);
|
||||
|
||||
Reference in New Issue
Block a user