Skip to content
Snippets Groups Projects
Commit 296498fb authored by qsm-odoo's avatar qsm-odoo
Browse files

[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.
parent 5afb5ecd
Branches
Tags
No related merge requests found
......@@ -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
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment