diff --git a/addons/web_editor/static/lib/summernote/src/js/core/range.js b/addons/web_editor/static/lib/summernote/src/js/core/range.js index aa72cd31e55..9611e09c72b 100644 --- a/addons/web_editor/static/lib/summernote/src/js/core/range.js +++ b/addons/web_editor/static/lib/summernote/src/js/core/range.js @@ -474,9 +474,15 @@ define([ return this.normalize(); } - // if apply the editor to a P, LI... - if (dom.isText(sc) && /^P|^LI|^H[1-7]/.test(sc.parentNode.nodeName.toUpperCase())) { - return this.normalize(); + // if apply the editor to a P, LI... or inside a P, LI... + if (dom.isText(sc)) { + var node = sc; + while (node.parentNode !== document) { + node = node.parentNode; + if (/^(P|LI|H[1-7]|BUTTON|A|SPAN)/.test(node.nodeName.toUpperCase())) { + return this.normalize(); + } + } } // find inline top ancestor