[FIX] web_editor: properly convert incomplete overflowing irregular row

When converting the last row of a grid to a table row, we may end up
having handled all of its columns, but there is still space in the row.
This ensures we properly insert the columns and fill the row.

X-original-commit: 52c35361a0cc86e87337ef321c1b198d4f8cc3c1
Part-of: odoo/odoo#81540
This commit is contained in:
Antoine Guenet
2021-12-16 15:58:20 +00:00
parent 33a158502e
commit ee809da96f
@@ -512,6 +512,14 @@ function bootstrapToTable($editable) {
$currentCol = grid[0];
_applyColspanToGridElement($currentCol, columnSize);
gridIndex = columnSize;
if (columnIndex === $bootstrapColumns.length - 1 && gridIndex < 12) {
// We handled all the columns but there is still space
// in the row. Insert the columns and fill the row.
grid[gridIndex].attr('colspan', 12 - gridIndex);
$currentRow.append(...grid.filter(td => td.attr('colspan')));
// Adapt width to colspan.
_applyColspanToGridElement(grid[gridIndex], 12 - gridIndex);
}
}
if ($currentCol) {
for (const attr of bootstrapColumn.attributes) {