From 7b2b3c6cc4222ce087ba5417deae0c30adeffa5b Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 12 Dec 2023 10:10:22 +0200 Subject: [PATCH] [develop | FIXED | DONE]: Fix copy indicator to clipboard. --- monitor-admin/topic/indicators.component.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/monitor-admin/topic/indicators.component.ts b/monitor-admin/topic/indicators.component.ts index 18d937de..10e19b97 100644 --- a/monitor-admin/topic/indicators.component.ts +++ b/monitor-admin/topic/indicators.component.ts @@ -48,6 +48,7 @@ import {properties} from "src/environments/environment"; import {NotificationHandler} from "../../utils/notification-handler"; declare var UIkit; +declare var copy; @Component({ selector: 'indicators', @@ -1476,17 +1477,15 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV } copyToClipboard(value) { - const tempBox = document.createElement('textarea'); + const tempBox = document.createElement('div'); + tempBox.id = 'tempBox'; tempBox.style.position = 'fixed'; tempBox.style.left = '0'; tempBox.style.top = '0'; tempBox.style.opacity = '0'; - tempBox.value = value; + tempBox.innerHTML = value.toString(); document.body.appendChild(tempBox); - tempBox.focus(); - tempBox.select(); - tempBox.setSelectionRange(0, 99999); - document.execCommand('copy'); + copy.exec('tempBox'); document.body.removeChild(tempBox); NotificationHandler.rise('Copied to clipboard'); }