[FIX] summernote: insert a p tag when try to insert a br with insertNode method, if the editor is inside a p, li, h1...

This commit is contained in:
Christophe Matthieu
2015-07-10 17:00:16 +02:00
parent b183817218
commit 5d51aff938
@@ -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