[FIX] web_editor: only bind cut/copy event to editor

Before this commit, cut/copy operation in non-html fields will trigger the _onClipboardCut/_onClipboardCopy handler as long as there is html field in the same form view.

This will cause cut/copy fail when using chrome or edge.

Only bind cut/copy event to html field as these event handlers are not related to non-html fields.

closes odoo/odoo#109624

X-original-commit: 494f8300f848cf258ba8ba0132af104346083b3e
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Jason Au Yeung
2023-01-12 11:09:31 +01:00
parent c34f124f5a
commit 6a174c8eb1
@@ -601,9 +601,9 @@ export class OdooEditor extends EventTarget {
this.addDomListener(this.editable, 'paste', this._onPaste);
this.addDomListener(this.editable, 'dragstart', this._onDragStart);
this.addDomListener(this.editable, 'drop', this._onDrop);
this.addDomListener(this.editable, 'copy', this._onClipboardCopy);
this.addDomListener(this.editable, 'cut', this._onClipboardCut);
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);