From 868d4f839a2cfe863272d72e8978c9d2f74a3df7 Mon Sep 17 00:00:00 2001 From: Jinjiu Liu Date: Wed, 18 Oct 2023 11:24:34 +0200 Subject: [PATCH] [FIX] web_editor: unneed size set when adding a row above a table Reproduction: 1. In project -> task, create a new task 2. In the description, make a table of 1 row 2 columns, type two line long string in the second cell 3. Create a row above, type anything short, save 4. Add the portal user as follower, e.g. search user joel 5. In an incognito tab log in with portal portal, check the task and the table is out of the field Fix: we should not fix the columns' width when create a new head row in the table, for extra long table, it should be scrollable task-3559104 closes odoo/odoo#154715 X-original-commit: 997b2f2817efe06ea37e5aca278507e0ef878635 Signed-off-by: Jinjiu Liu (jili) Signed-off-by: Antoine Guenet (age) --- .../project/views/project_portal_project_task_templates.xml | 2 +- .../src/js/editor/odoo-editor/src/commands/commands.js | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/addons/project/views/project_portal_project_task_templates.xml b/addons/project/views/project_portal_project_task_templates.xml index 382af555e97..2c65968f846 100644 --- a/addons/project/views/project_portal_project_task_templates.xml +++ b/addons/project/views/project_portal_project_task_templates.xml @@ -256,7 +256,7 @@
Description
-
+

diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/commands.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/commands.js index 8bc324ff1b0..37569552728 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/commands.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/commands.js @@ -773,7 +773,6 @@ export const editorCommands = { const newRow = document.createElement('tr'); newRow.style.height = referenceRowHeight + 'px'; const cells = referenceRow.querySelectorAll('td'); - const referenceRowWidths = [...cells].map(cell => cell.style.width || cell.clientWidth + 'px'); newRow.append(...Array.from(Array(cells.length)).map(() => { const td = document.createElement('td'); const p = document.createElement('p'); @@ -783,11 +782,10 @@ export const editorCommands = { })); referenceRow[beforeOrAfter](newRow); newRow.style.height = referenceRowHeight + 'px'; - // Preserve the width of the columns (applied only on the first row). if (getRowIndex(newRow) === 0) { let columnIndex = 0; - for (const column of newRow.children) { - column.style.width = referenceRowWidths[columnIndex]; + for (const newColumn of newRow.children) { + newColumn.style.width = cells[columnIndex].style.width; cells[columnIndex].style.width = ''; columnIndex++; }