Merge remote-tracking branch 'origin/develop' into angular-16-irish-monitor

This commit is contained in:
Konstantinos Triantafyllou 2023-12-12 10:11:41 +02:00
commit a4bb94daa7
1 changed files with 5 additions and 6 deletions

View File

@ -45,6 +45,7 @@ import {NotificationHandler} from "../../utils/notification-handler";
import {IndicatorStakeholderBaseComponent} from "../utils/stakeholder-base.component"; import {IndicatorStakeholderBaseComponent} from "../utils/stakeholder-base.component";
declare var UIkit; declare var UIkit;
declare var copy;
@Component({ @Component({
selector: 'indicators', selector: 'indicators',
@ -1465,17 +1466,15 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
} }
copyToClipboard(value) { copyToClipboard(value) {
const tempBox = document.createElement('textarea'); const tempBox = document.createElement('div');
tempBox.id = 'tempBox';
tempBox.style.position = 'fixed'; tempBox.style.position = 'fixed';
tempBox.style.left = '0'; tempBox.style.left = '0';
tempBox.style.top = '0'; tempBox.style.top = '0';
tempBox.style.opacity = '0'; tempBox.style.opacity = '0';
tempBox.value = value; tempBox.innerHTML = value.toString();
document.body.appendChild(tempBox); document.body.appendChild(tempBox);
tempBox.focus(); copy.exec('tempBox');
tempBox.select();
tempBox.setSelectionRange(0, 99999);
document.execCommand('copy');
document.body.removeChild(tempBox); document.body.removeChild(tempBox);
NotificationHandler.rise('Copied to clipboard'); NotificationHandler.rise('Copied to clipboard');
} }