[FIX] website_links: copy button will get the link in link tracker

Issue: In Link Tracker for our website, when generating the link, if we
try to copy the generated url with the copy value, instead of copying
the url we are getting undefined.

Steps to reproduce:

1. Install website_links.
2. Go to the website and go to Site > Link tracker.
3. Generate a new link and try to copy.

Solution: Due to the recent changes that came from the changes made in
9638423 where we replace the ClipboardJS with Web API and hombrew
polyfill, there are still some button that is not adapted yet, and in
this case what happens is that we have a difference dataset format for
the clipboard content, being 'clipboardText' instead of 'clipboard-text'

opw-3806495

closes odoo/odoo#159674

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is contained in:
Maruan Aguerdouh (magm)
2024-04-12 12:56:36 +00:00
parent 6788f43d6b
commit 6cbbc5a1b7
3 changed files with 3 additions and 3 deletions
@@ -425,7 +425,7 @@ publicWidget.registry.websiteLinks = publicWidget.Widget.extend({
* @private
*/
_onShortenUrlButtonClick: async function (ev) {
const textValue = ev.target.dataset["clipboard-text"];
const textValue = ev.target.dataset.clipboardText;
await browser.navigator.clipboard.writeText(textValue);
if (!$('#btn_shorten_url').hasClass('btn-copy') || this.url_copy_animating) {
@@ -290,7 +290,7 @@ publicWidget.registry.websiteLinksCharts = publicWidget.Widget.extend({
_onCopyToClipboardClick: async function (ev) {
ev.preventDefault();
const textValue = ev.target.dataset["clipboard-text"];
const textValue = ev.target.dataset.clipboardText;
await browser.navigator.clipboard.writeText(textValue);
if (this.animating_copy) {
@@ -9,7 +9,7 @@ publicWidget.registry.WebsiteSaleGiftCardCopy = publicWidget.Widget.extend({
"click .copy-to-clipboard": "_onClickCopyToClipboard",
},
async _onClickCopyToClipboard(ev) {
const textValue = ev.target.dataset["clipboard-text"];
const textValue = ev.target.dataset.clipboardText;
await browser.navigator.clipboard.writeText(textValue);
},
});