From b820faed66e061212d4bdf6744e29076d6bc0de1 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Mon, 16 Nov 2015 15:01:30 +0100 Subject: [PATCH] [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 --- addons/web_editor/static/src/js/summernote.js | 7 +++++++ 1 file changed, 7 insertions(+) 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 *