@dllcn/ngx-clipboard
Version:
33 lines (32 loc) • 1.12 kB
TypeScript
import { Observable } from 'rxjs';
import { IClipboardResponse } from './interface';
export declare class ClipboardService {
document: any;
private window;
private tempTextArea;
private copySubject;
copyResponse$: Observable<IClipboardResponse>;
constructor(document: any, window: any);
readonly isSupported: boolean;
isTargetValid(element: HTMLInputElement | HTMLTextAreaElement): boolean;
/**
* copyFromInputElement
*/
copyFromInputElement(targetElm: HTMLInputElement | HTMLTextAreaElement): boolean;
isCopySuccessInIE11(): boolean;
/**
* Creates a fake textarea element, sets its value from `text` property,
* and makes a selection on it.
*/
copyFromContent(content: string, container?: HTMLElement): boolean;
destroy(container?: HTMLElement): void;
private selectTarget;
private copyText;
private clearSelection;
private createTempTextArea;
/**
* Pushes copy operation response to copySubject, to provide global access
* to the response.
*/
pushCopyReponse(response: IClipboardResponse): void;
}