[FIX] web_editor: past mulitple lines and undo

Before this commit, when pasting multiples lines a new step per line.
So when performing an undo, only one line was removed instead of the
whole pasted text.

task-2833740

closes odoo/odoo#89932

X-original-commit: 06fb4e3e8377dedb02644779f0077e0d883df918
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Nicolas Bayet
2022-04-28 09:00:50 +02:00
parent 444fb09d1e
commit fa796c76ad
@@ -2997,6 +2997,7 @@ export class OdooEditor extends EventTarget {
const linkAttributes = this.options.defaultLinkAttributes || {};
const selectionIsInsideALink = !!closestElement(sel.anchorNode, 'a');
this.historyPauseSteps("_onPaste");
for (let i = 0; i < splitAroundUrl.length; i++) {
const url = /^https?:\/\//gi.test(splitAroundUrl[i])
? splitAroundUrl[i]
@@ -3153,6 +3154,7 @@ export class OdooEditor extends EventTarget {
}
}
}
this.historyUnpauseSteps("_onPaste");
this.historyStep();
}
}