import { Overlay , OverlayPositionBuilder } from '@angular/cdk/overlay' ; import { ChangeDetectionStrategy , ChangeDetectorRef , Component , ElementRef , HostListener , ViewRef , } from '@angular/core' ; import { Events } from '../../../services/events.service' ; import { OverwolfService } from '../../../services/overwolf.service' ; import { SocialShareButtonComponent } from '../social-share-button.component' ; @ Component ( { selector : 'clipboard-share-button' , styleUrls : [ `../../../../css/component/sharing/social-share-button.component.scss` , `../../../../css/component/sharing/clipboard/clipboard-share-button.component.scss` , ] , template : `
		<!-- We don't want it to stay open on click, because otherwise the tooltip is in the screenshot -->
		<div
			class="social-share {{ _network }}"
			[helpTooltip]="tooltip"
			[stayOpenOnClick]="false"
			[inlineSVG]="networkSvg"
		></div>
		<div class="label" *ngIf="showLabel">Clipboard</div>
	` , changeDetection : ChangeDetectionStrategy . OnPush , } ) export class ClipboardShareButtonComponent extends SocialShareButtonComponent { tooltip : string ; constructor ( protected readonly ow , protected readonly overlay , protected readonly elementRef , protected readonly overlayPositionBuilder , protected readonly cdr , private readonly events ) { super ( ow , overlay , elementRef , overlayPositionBuilder , cdr ) ; this . network = 'clipboard' ; this . tooltip = 'Copy current screen to clipboard' ; } @ HostListener ( 'mousedown' ) onClick ( ) { this . startSharing ( true ) ; } protected async doShare ( screenshotLocation , base64Image ) { this . events . broadcast ( Events . SHOW_SCREEN_CAPTURE_EFFECT ) ; this . tooltip = 'Image copied to clipboard' ; if ( ! ( this . cdr as ViewRef ) ?. destroyed ) { this . cdr . detectChanges ( ) ; } setTimeout ( ( ) => { this . tooltip = 'Copy current screen to clipboard' ; if ( ! ( this . cdr as ViewRef ) ?. destroyed ) { this . cdr . detectChanges ( ) ; } } , 2000 ) ; } }