summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/lib/summernote/src
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2015-06-24 14:41:48 +0200
committerChristophe Matthieu <chm@odoo.com>2015-07-10 17:00:16 +0200
commit5d51aff938b348cd7ca74733feb065d280ccfd54 (patch)
tree2edd2a0c2e1e96f3c4e7f0784b795d5ddab45c69 /addons/web_editor/static/lib/summernote/src
parentb183817218ee3273fac6040b65311817ec0f68c7 (diff)
[FIX] summernote: insert a p tag when try to insert a br with insertNode method, if the editor is inside a p, li, h1...
Diffstat (limited to 'addons/web_editor/static/lib/summernote/src')
-rw-r--r--addons/web_editor/static/lib/summernote/src/js/core/range.js12
1 files changed, 9 insertions, 3 deletions
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