From b384a00fe26131d716dd0c87f3fcf0a164f95aee Mon Sep 17 00:00:00 2001 From: Goaman Date: Wed, 7 Aug 2019 10:13:13 +0000 Subject: [PATCH] [FIX] web_editor: Do not remove block MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not remove block in _removeNextEmptyUnbreakable. Before this commit, when you tried to remove insert a character in a td, with an empty td after the first one. The function _removeNextEmptyUnbreakable removed the empty td. It was for example breaking snippet in the website and mass_mailing. closes odoo/odoo#32096 Signed-off-by: Adrien Dieudonné (adr) --- addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js b/addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js index 141d4c1bf2e..9ac05220e45 100644 --- a/addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js +++ b/addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js @@ -827,7 +827,7 @@ var KeyboardPlugin = AbstractPlugin.extend({ } }, /** - * Remove the first unbreakable ancestor's next sibling if empty. + * Remove the first unbreakable ancestor's next sibling if not a block and empty. * * @private * @param {Node} node @@ -843,7 +843,7 @@ var KeyboardPlugin = AbstractPlugin.extend({ var isNextContainsOnlyInvisibleText = nextUnbreakable && _.all($(nextUnbreakable).contents(), function (n) { return dom.isText(n) && !self.context.invoke('HelperPlugin.isVisibleText', n); }); - if (isNextEmpty || isNextContainsOnlyInvisibleText) { + if (!dom.isBlock(nextUnbreakable) && (isNextEmpty || isNextContainsOnlyInvisibleText)) { $(nextUnbreakable).remove(); } },