[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 <luvi@odoo.com>
This commit is contained in:
Nshimiyimana Séna
2022-11-15 13:01:40 +01:00
parent f1eb3b9d42
commit 90b73796bc
@@ -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();
});