From f5fe01a60fb4a471ae90a6d41699377bcace7080 Mon Sep 17 00:00:00 2001 From: shsa-odoo Date: Wed, 20 Sep 2023 16:45:48 +0530 Subject: [PATCH] [FIX] web_editor: banner drag issue Before this commit: -Banner on drag and drop only drops content. -Content inside banner were draggable. After this commit: -Now we can drop banner as well. -Prevented content inside banner to be draggable. task-3512199 closes odoo/odoo#136003 Signed-off-by: David Monjoie (dmo) --- addons/web_editor/static/src/js/wysiwyg/MoveNodePlugin.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/MoveNodePlugin.js b/addons/web_editor/static/src/js/wysiwyg/MoveNodePlugin.js index 2323a4a3130..edb3b7fd35b 100644 --- a/addons/web_editor/static/src/js/wysiwyg/MoveNodePlugin.js +++ b/addons/web_editor/static/src/js/wysiwyg/MoveNodePlugin.js @@ -11,7 +11,7 @@ import { SmoothScrollOnDrag } from "@web_editor/js/editor/smooth_scroll_on_drag" const WIDGET_CONTAINER_WIDTH = 25; const WIDGET_MOVE_SIZE = 20; -const ALLOWED_ELEMENTS = 'h1, h2, h3, p, hr, pre, blockquote, ul, ol, table, .o_knowledge_behavior_anchor, .o_text_columns'; +const ALLOWED_ELEMENTS = 'h1, h2, h3, p, hr, pre, blockquote, ul, ol, table, .o_knowledge_behavior_anchor, .o_text_columns, .o_editor_banner'; export class MoveNodePlugin { constructor(options = {}) { @@ -408,7 +408,7 @@ export class MoveNodePlugin { } function isNodeMovable(node) { - return node.parentElement?.getAttribute('contentEditable') === 'true'; + return node.parentElement?.getAttribute('contentEditable') === 'true' && !node.parentElement.closest('.o_editor_banner'); } function isPointInside(rect, x, y) {