[FIX] web_editor: handle the cut clipboard event within the editor

The feature of not altering pasted content that was copied from the
editor was not enabled for content _cut_ from the editor.

X-original-commit: d79ed0298a8366ca51b1ca54fe725c7a55860254
Part-of: odoo/odoo#105386
This commit is contained in:
Antoine Guenet
2022-11-14 15:21:12 +01:00
parent ef300d6463
commit 0aa4b317cd
@@ -587,6 +587,7 @@ export class OdooEditor extends EventTarget {
this.addDomListener(this.editable, 'drop', this._onDrop);
this.addDomListener(this.document, 'copy', this._onClipboardCopy);
this.addDomListener(this.document, 'cut', this._onClipboardCut);
this.addDomListener(this.document, 'selectionchange', this._onSelectionChange);
this.addDomListener(this.document, 'selectionchange', this._handleCommandHint);
this.addDomListener(this.document, 'keydown', this._onDocumentKeydown);
@@ -3182,6 +3183,10 @@ export class OdooEditor extends EventTarget {
}
}
_onClipboardCut(clipboardEvent) {
this._onClipboardCopy(clipboardEvent);
this.deleteRange();
}
_onClipboardCopy(clipboardEvent) {
if (this.isSelectionInEditable()) {
clipboardEvent.preventDefault();