From 90b73796bc75e80e32e45ea38511cfc78f81dced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nshimiyimana=20S=C3=A9na?= Date: Thu, 10 Nov 2022 14:15:24 +0000 Subject: [PATCH] [FIX] web: fix copying markup object to clipboard ### Steps to reproduce * install Live Chat (`im_livechat`) * Go to Live Chat > click any channel * Under Widget, Click the copy button for the first link If you're on firefox, nothing will happen (text won't be copied). On chrome, you will get a traceback saying `Failed to execute 'write' on 'Clipboard'`. ### Expected behavior The text should be copied to the clipboard, and a tooltip should appear to confirm that. opw-3058357 closes odoo/odoo#105756 X-original-commit: 977f5aacf46c3746380dda33585b407df659e07d Signed-off-by: Luca Vitali --- .../web/static/src/views/fields/copy_clipboard/copy_button.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/views/fields/copy_clipboard/copy_button.js b/addons/web/static/src/views/fields/copy_clipboard/copy_button.js index bc08f305cfd..f0484dcc4da 100644 --- a/addons/web/static/src/views/fields/copy_clipboard/copy_button.js +++ b/addons/web/static/src/views/fields/copy_clipboard/copy_button.js @@ -24,7 +24,7 @@ export class CopyButton extends Component { try { // any kind of content can be copied into the clipboard using // the appropriate native methods - if (typeof this.props.content === "string") { + if (typeof this.props.content === "string" || this.props.content instanceof String) { browser.navigator.clipboard.writeText(this.props.content).then(() => { this.showTooltip(); });