[FIX] web_editor: Do not remove block

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) <adr@odoo.com>
This commit is contained in:
Goaman
2019-08-07 15:00:25 +00:00
parent d0e8059330
commit b384a00fe2
@@ -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();
}
},