[FIX] website_slides: fix share copy link

With this commit 963842381e
ClipboardJS was removed to use the native clipboard api.
But here the innerText was checked instead of the value
so there was nothing to copy in the clipboard.
This commit fix this.

Task-3607299

closes odoo/odoo#143206

Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
This commit is contained in:
Patrick Hoste
2023-11-30 10:13:18 +00:00
parent f359866bf5
commit 4a97700a38
2 changed files with 3 additions and 3 deletions
@@ -444,7 +444,7 @@
ev.preventDefault();
var $clipboardBtn = this.$('.o_clipboard_button');
$clipboardBtn.tooltip({title: "Copied!", trigger: "manual", placement: "bottom"});
await browser.navigator.clipboard.writeText(this.$('.o_wslides_js_share_link')[0].innerText);
await browser.navigator.clipboard.writeText(this.$('.o_wslides_js_share_link').val() || '');
$clipboardBtn.tooltip('show');
setTimeout(() => $clipboardBtn.tooltip("hide"), 800);
},
@@ -115,7 +115,7 @@ publicWidget.registry.websiteSlidesShare = publicWidget.Widget.extend({
var $clipboardBtn = $(ev.currentTarget);
$clipboardBtn.tooltip({title: "Copied!", trigger: "manual", placement: "bottom"});
var share_link_el = this.$('#wslides_share_link_id_' + $clipboardBtn[0].id.split('id_')[1]);
await browser.navigator.clipboard.writeText(share_link_el[0].innerText);
await browser.navigator.clipboard.writeText(share_link_el.val() || '');
$clipboardBtn.tooltip('show');
setTimeout(() => $clipboardBtn.tooltip("hide"), 800);
},
@@ -132,7 +132,7 @@ publicWidget.registry.websiteSlidesEmbedShare = publicWidget.Widget.extend({
const $clipboardBtn = $(ev.currentTarget);
$clipboardBtn.tooltip({title: "Copied!", trigger: "manual", placement: "bottom"});
var share_embed_el = this.$('#wslides_share_embed_id_' + $clipboardBtn[0].id.split('id_')[1]);
await browser.navigator.clipboard.writeText(share_embed_el[0].innerText);
await browser.navigator.clipboard.writeText(share_embed_el.val() || '');
$clipboardBtn.tooltip('show');
setTimeout(function () {
$clipboardBtn.tooltip("hide");