mirror of https://github.com/Squidex/squidex.git
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.
34 lines
693 B
34 lines
693 B
/*
|
|
* Athene Requirements Center
|
|
*
|
|
* @license
|
|
* Copyright (c) Sebastian Stehle. All rights reserved
|
|
*/
|
|
|
|
import { BehaviorSubject, Observable } from 'rxjs';
|
|
|
|
export const ClipboardServiceFactory = () => {
|
|
return new ClipboardService();
|
|
};
|
|
|
|
export class ClipboardService {
|
|
private textInstance = new BehaviorSubject<string>('');
|
|
|
|
public get text(): Observable<string> {
|
|
return this.textInstance;
|
|
}
|
|
|
|
public selectText(): string {
|
|
let result = '';
|
|
|
|
this.textInstance.subscribe(t => {
|
|
result = t;
|
|
}).unsubscribe();
|
|
|
|
return result || '';
|
|
}
|
|
|
|
public setText(text: any) {
|
|
this.textInstance.next(text);
|
|
}
|
|
}
|