[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user