fix not working copy to clipboard button in filemanager.ts Regarding Ticket #103531

(cherry picked from commit 383d8088a6)
This commit is contained in:
milan 2025-02-12 16:07:13 +01:00
parent eb1de77304
commit b4f48fe293

View File

@ -1421,20 +1421,18 @@ export class filemanagerAPP extends EgwApp
console.log("_data", _data);
let app = this;
let copy_link_to_clipboard = function (evt)
{
let $target = jQuery(evt.target);
$target.select();
let copy_link_to_clipboard = function (evt): Promise<boolean> {
const target = evt.currentTarget;
target.select();
target.setSelectionRange(0, 99999) //For mobile devices
try
{
let successful = document.execCommand('copy');
if(successful)
{
return navigator.clipboard.writeText(target.value).then(() => {
egw.message(app.egw.lang('Share link copied into clipboard'));
return true;
}
}
catch(e)
})
} catch (e)
{
}
egw.message('Failed to copy the link!');