diff options
| author | Christophe Matthieu <chm@odoo.com> | 2015-12-10 13:16:20 +0100 |
|---|---|---|
| committer | Christophe Matthieu <chm@odoo.com> | 2015-12-10 15:17:44 +0100 |
| commit | b72a3b67f8fe04eea29118b13c5d2ac000370938 (patch) | |
| tree | 93fe83f4afade58401d1264ca840e95ad7cd64f7 /addons/web_editor/static/src | |
| parent | b00d070b519186535c761d06d0f6fe44b10b72d3 (diff) | |
[FIX] web_editor: remove exceed span on paste html content
Diffstat (limited to 'addons/web_editor/static/src')
| -rw-r--r-- | addons/web_editor/static/src/js/summernote.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/addons/web_editor/static/src/js/summernote.js b/addons/web_editor/static/src/js/summernote.js index ff509800c50..2b2c26bfb68 100644 --- a/addons/web_editor/static/src/js/summernote.js +++ b/addons/web_editor/static/src/js/summernote.js @@ -2336,8 +2336,8 @@ function summernote_paste (event) { $node.find('*').each(function() { var $node = $(this); - if ($(this).attr('style')) { - var style = _.filter($(this).attr('style').split(/\s*;\s*/), function (style) { + if ($node.attr('style')) { + var style = _.filter($node.attr('style').split(/\s*;\s*/), function (style) { return /width|height|color|background-color|font-weight|text-align|font-style|text-decoration/i.test(style) && $node.css(style.split(':')[0]) !== $('body').css(style.split(':')[0]); }).join(';'); if (style.length) { @@ -2347,8 +2347,8 @@ function summernote_paste (event) { } } - if ($(this).attr('class')) { - var classes = _.filter($(this).attr('class').split(/\s+/), function (style) { + if ($node.attr('class')) { + var classes = _.filter($node.attr('class').split(/\s+/), function (style) { return /(^|\s)(fa|pull|text|bg)(\s|-|$)/.test(style); }).join(' '); if (classes.length) { @@ -2365,6 +2365,12 @@ function summernote_paste (event) { $node.find('span:not([class]):not([style])').each(function () { $(this).replaceWith($(this).contents()); }); + $node.find('span + span').each(function () { + if ($(this).attr('class') === $(this).prev().attr('class') && $(this).attr('style') === $(this).prev().attr('style')) { + $(this).prev().append($(this).contents()); + $(this).remove(); + } + }); /* reset architecture HTML node and add <p> tag |
