summaryrefslogtreecommitdiff
path: root/addons/web_editor/static
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2015-11-16 15:01:30 +0100
committerNicolas Lempereur <nle@odoo.com>2015-11-16 16:02:45 +0100
commitb820faed66e061212d4bdf6744e29076d6bc0de1 (patch)
tree31072e52373d86b773917b07ff2fa0e7c41692e9 /addons/web_editor/static
parent3dd79b3d65cdac2598db95a287d85442bb3bc0f4 (diff)
[FIX] web_editor: don't think HTML comment are visible
Summernote sometimes doesn't take into account HTML comment could be embedded in the edited content, this can lead to issue since this situation can happen in Odoo. This commit patch the "isVisiblePoint" summernote's function to take care of this issue. opw-656332
Diffstat (limited to 'addons/web_editor/static')
-rw-r--r--addons/web_editor/static/src/js/summernote.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/addons/web_editor/static/src/js/summernote.js b/addons/web_editor/static/src/js/summernote.js
index ab170a45935..c5a9b3ebbef 100644
--- a/addons/web_editor/static/src/js/summernote.js
+++ b/addons/web_editor/static/src/js/summernote.js
@@ -676,6 +676,13 @@ dom.isFont = function (node) {
dom.isVisibleText = function (textNode) {
return !!textNode.textContent.match(/\S|\u00A0/);
};
+
+/* avoid thinking HTML comment are visible */
+var old_isVisiblePoint = dom.isVisiblePoint;
+dom.isVisiblePoint = function (point) {
+ return point.node.nodeType !== 8 && old_isVisiblePoint.apply(this, arguments);
+};
+
/**
* order the style of the node to compare 2 nodes and remove attribute if empty
*