From ee809da96fa0374e7e77df1ddba81ad0704872a6 Mon Sep 17 00:00:00 2001 From: Antoine Guenet Date: Fri, 12 Nov 2021 16:17:40 +0000 Subject: [PATCH] [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 --- addons/web_editor/static/src/js/backend/convert_inline.js | 8 ++++++++ 1 file changed, 8 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 36fc47faf59..3a3a38456eb 100644 --- a/addons/web_editor/static/src/js/backend/convert_inline.js +++ b/addons/web_editor/static/src/js/backend/convert_inline.js @@ -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) {