[FIX] web_editor: remove copy paste unwanted newline

Before this commit:

- When you try to paste text beside a text which is in code formate it
  puts the new text in new line with smaller font.

- When we try to paste text in code formate in new line then it will
  give a blank space below the pasted text

After this commit:

- when you try to paste text beside a text which is in code formate it
  puts the pasted text in new line with original fontsize.

- When we paste the text in code formate in new line then it will not give
  a empty line below it,

Task-2683455

closes odoo/odoo#106488

X-original-commit: bf7835e80ffa70236dca4b4b8fb4edb45d42f46a
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
vishal padhiyar
2022-11-25 10:52:07 +01:00
committed by Hiral Bhavsar
parent 05348b8b03
commit ff366852fe
2 changed files with 5 additions and 0 deletions
@@ -20,6 +20,7 @@ import {
isBlock,
isColorGradient,
isContentTextNode,
isEmptyBlock,
isSelectionFormat,
isShrunkBlock,
isVisible,
@@ -262,6 +263,9 @@ export const editorCommands = {
if (offset) {
const [left, right] = splitElement(currentNode.parentElement, offset);
currentNode = insertBefore ? right : left;
if (isEmptyBlock(right)) {
right.remove();
}
} else {
currentNode = currentNode.parentElement;
}
@@ -1443,6 +1443,7 @@ const paragraphRelatedElements = [
'H4',
'H5',
'H6',
'PRE',
];
/**