diff options
| author | qsm-odoo <qsm@odoo.com> | 2017-10-16 11:11:18 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2017-10-16 14:14:47 +0200 |
| commit | 296498fb588614b8ce64da47954faac71eef1751 (patch) | |
| tree | 347cc598d9a5a1df039cd1931ef1a62f0c8bdef9 /addons/web_editor/static/lib/summernote/src | |
| parent | 5afb5ecd04cf49be6bedb655b187b19a65e1e02d (diff) | |
[FIX] web_editor: do not break <p/> when pasting a <p/> element
This fixes a bug when pasting text in a paragraph, it was always
creating a new paragraph for no reason.
Diffstat (limited to 'addons/web_editor/static/lib/summernote/src')
| -rw-r--r-- | addons/web_editor/static/lib/summernote/src/js/module/Clipboard.js | 12 |
1 files changed, 12 insertions, 0 deletions
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 <p/> element in an unique <p/> element, only paste + // the <p/> 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 */ |
