[FIX] web_editor: prevent traceback on convert single-col align stretch

When converting a row with items that are supposed to be stretch-aligned
we need to set each of its column's height. However this failed when
the row contained less than two columns.

opw-3371134

closes odoo/odoo#127813

X-original-commit: 7df4cc0d9aaccf0dabcc4a7863549b276efaa403
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Antoine Guenet
2023-07-10 15:32:53 +02:00
parent 88ac225011
commit e47bc1115f
@@ -980,10 +980,12 @@ function formatTables($editable) {
row.style.verticalAlign = 'bottom';
} else if (alignItems === 'stretch') {
const columns = [...row.querySelectorAll('td.o_converted_col')];
const commonAncestor = commonParentGet(columns[0], columns[1]);
const biggestHeight = commonAncestor.clientHeight;
for (const column of columns) {
column.style.height = biggestHeight + 'px';
if (columns.length > 1) {
const commonAncestor = commonParentGet(columns[0], columns[1]);
const biggestHeight = commonAncestor.clientHeight;
for (const column of columns) {
column.style.height = biggestHeight + 'px';
}
}
}
}