UNPKG

2.15 kBTypeScriptView Raw
1import { NgZone } from '@angular/core';
2import { Observable } from 'rxjs';
3import { ClipboardParams, IClipboardResponse } from './interface';
4import * as i0 from "@angular/core";
5/**
6 * The following code is heavily copied from https://github.com/zenorocha/clipboard.js
7 */
8export declare class ClipboardService {
9 private ngZone;
10 document: any;
11 private window;
12 private copySubject;
13 copyResponse$: Observable<IClipboardResponse>;
14 private tempTextArea;
15 private config;
16 constructor(ngZone: NgZone, document: any, window: any);
17 configure(config: ClipboardParams): void;
18 copy(content: string): void;
19 get isSupported(): boolean;
20 isTargetValid(element: HTMLInputElement | HTMLTextAreaElement): boolean;
21 /**
22 * Attempts to copy from an input `targetElm`
23 */
24 copyFromInputElement(targetElm: HTMLInputElement | HTMLTextAreaElement, isFocus?: boolean): boolean;
25 /**
26 * This is a hack for IE11 to return `true` even if copy fails.
27 */
28 isCopySuccessInIE11(): boolean;
29 /**
30 * Creates a fake textarea element, sets its value from `text` property,
31 * and makes a selection on it.
32 */
33 copyFromContent(content: string, container?: HTMLElement): boolean;
34 /**
35 * Remove temporary textarea if any exists.
36 */
37 destroy(container?: HTMLElement): void;
38 /**
39 * Select the target html input element.
40 */
41 private selectTarget;
42 private copyText;
43 /**
44 * Moves focus away from `target` and back to the trigger, removes current selection.
45 */
46 private clearSelection;
47 /**
48 * Creates a fake textarea for copy command.
49 */
50 private createTempTextArea;
51 /**
52 * Pushes copy operation response to copySubject, to provide global access
53 * to the response.
54 */
55 pushCopyResponse(response: IClipboardResponse): void;
56 /**
57 * @deprecated use pushCopyResponse instead.
58 */
59 pushCopyReponse(response: IClipboardResponse): void;
60 static ɵfac: i0.ɵɵFactoryDeclaration<ClipboardService, [null, null, { optional: true; }]>;
61 static ɵprov: i0.ɵɵInjectableDeclaration<ClipboardService>;
62}