From 296498fb588614b8ce64da47954faac71eef1751 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Mon, 16 Oct 2017 11:11:18 +0200 Subject: [FIX] web_editor: do not break

when pasting a

element This fixes a bug when pasting text in a paragraph, it was always creating a new paragraph for no reason. --- .../static/lib/summernote/src/js/module/Clipboard.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'addons/web_editor/static/lib/summernote/src/js/module') diff --git a/addons/web_editor/static/lib/summernote/src/js/module/Clipboard.js b/addons/web_editor/static/lib/summernote/src/js/module/Clipboard.js index 8b42726ff7a..955b49437a8 100644 --- a/addons/web_editor/static/lib/summernote/src/js/module/Clipboard.js +++ b/addons/web_editor/static/lib/summernote/src/js/module/Clipboard.js @@ -206,6 +206,18 @@ define([ r.select(); } + // If only pasting a

element in an unique

element, only paste + // the

element text + var $p = $arch.children('p'); + var onlyAP = ($p.length === 1 && $arch.children().length === 1); + if (onlyAP) { + var $p1 = $(r.sc).closest('p'); + var $p2 = $(r.ec).closest('p'); + if ($p1.length && $p2.length && $p1[0] === $p2[0]) { + $arch.html($p.text()); + } + } + /* insert content */ -- cgit v1.2.3