Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

36 lines
749 B

/*
* Squidex Headless CMS
*
* @license
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';
export const ClipboardServiceFactory = () => {
return new ClipboardService();
};
@Injectable()
export class ClipboardService {
private readonly text$ = new BehaviorSubject<string>('');
public get textChanges(): Observable<string> {
return this.text$;
}
public selectText(): string {
let result = '';
this.text$.subscribe(t => {
result = t;
}).unsubscribe();
return result || '';
}
public setText(text: any) {
this.text$.next(text);
}
}