Skip to content
Snippets Groups Projects
Commit f107d593 authored by Tom Käsler's avatar Tom Käsler
Browse files

Add copy-to-clipboard button for room short id

parent dc31c1cc
Branches
Tags
1 merge request!344Add copy-to-clipboard button for room short id
Pipeline #29075 failed with stages
in 1 minute and 47 seconds
......@@ -13,6 +13,9 @@
<h3>
{{ 'room-page.session-id' | translate}}: {{ room.shortId.slice(0, 4) }} {{ room.shortId.slice(4, 8) }}
</h3>
<button mat-icon-button (click)="copyShortId()">
<mat-icon>cloud_download</mat-icon>
</button>
</mat-card-subtitle>
</mat-card-header>
<span class="fill-remaining-space"></span>
......
......@@ -119,5 +119,19 @@ export class RoomCreatorPageComponent extends RoomPageComponent implements OnIni
});
dialogRef.componentInstance.roomId = this.room.id;
}
copyShortId(): void {
let selBox = document.createElement('textarea');
selBox.style.position = 'fixed';
selBox.style.left = '0';
selBox.style.top = '0';
selBox.style.opacity = '0';
selBox.value = this.room.shortId;
document.body.appendChild(selBox);
selBox.focus();
selBox.select();
document.execCommand('copy');
document.body.removeChild(selBox);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment