[develop | FIXED | DONE]: Fix copy indicator to clipboard.
This commit is contained in:
parent
49c0569ff8
commit
7b2b3c6cc4
|
@ -48,6 +48,7 @@ import {properties} from "src/environments/environment";
|
||||||
import {NotificationHandler} from "../../utils/notification-handler";
|
import {NotificationHandler} from "../../utils/notification-handler";
|
||||||
|
|
||||||
declare var UIkit;
|
declare var UIkit;
|
||||||
|
declare var copy;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'indicators',
|
selector: 'indicators',
|
||||||
|
@ -1476,17 +1477,15 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
}
|
}
|
||||||
|
|
||||||
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');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue