[FIX] web_editor: make the grid item drop more robust
It happened previously that the grid item could be broken if `top` and `left` style properties were not set on it, which resulted in `NaN` values being used in the grid-area computation. This commit makes the drop more robust by obtaining their values through the computed style instead of the style. This way these properties are always defined. task-3554752 closes odoo/odoo#143903 X-original-commit: 7a8fd5792f9eedfebf812b15730259de2b511a58 Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
This commit is contained in:
@@ -1358,8 +1358,9 @@ var SnippetEditor = Widget.extend({
|
||||
// Defining the column grid area with its position.
|
||||
const gridProp = gridUtils._getGridProperties(rowEl);
|
||||
|
||||
const top = parseFloat(this.$target[0].style.top);
|
||||
const left = parseFloat(this.$target[0].style.left);
|
||||
const style = window.getComputedStyle(this.$target[0]);
|
||||
const top = parseFloat(style.top);
|
||||
const left = parseFloat(style.left);
|
||||
|
||||
const rowStart = Math.round(top / (gridProp.rowSize + gridProp.rowGap)) + 1;
|
||||
const columnStart = Math.round(left / (gridProp.columnSize + gridProp.columnGap)) + 1;
|
||||
|
||||
Reference in New Issue
Block a user