2016-07-08 00:46:46 +02:00
|
|
|
import { Cordova, Plugin } from './plugin';
|
|
|
|
|
2016-02-17 04:49:26 -05:00
|
|
|
|
|
|
|
/**
|
2016-03-12 18:30:16 -05:00
|
|
|
* @name Clipboard
|
|
|
|
* @description
|
2016-02-17 04:49:26 -05:00
|
|
|
* Clipboard management plugin for Cordova that supports iOS, Android, and Windows Phone 8.
|
|
|
|
*
|
|
|
|
* Requires Cordova plugin: https://github.com/VersoSolutions/CordovaClipboard
|
2016-03-04 15:42:21 -06:00
|
|
|
* For more info, please see the [Clipboard plugin docs](https://github.com/VersoSolutions/CordovaClipboard.git).
|
2016-02-17 04:49:26 -05:00
|
|
|
*
|
|
|
|
* @usage
|
2016-07-20 17:17:09 +02:00
|
|
|
* ```typescript
|
|
|
|
* import { Clipboard } from 'ionic-native';
|
2016-03-24 13:00:18 -04:00
|
|
|
*
|
|
|
|
*
|
2016-07-20 17:17:09 +02:00
|
|
|
* Clipboard.copy('Hello world');
|
2016-02-17 04:49:26 -05:00
|
|
|
*
|
|
|
|
* Clipboard.paste().then(
|
2016-07-20 17:17:09 +02:00
|
|
|
* (resolve: string) => {
|
2016-07-08 15:19:13 -04:00
|
|
|
* alert(resolve);
|
|
|
|
* },
|
2016-07-20 17:17:09 +02:00
|
|
|
* (reject: string) => {
|
|
|
|
* alert('Error: ' + reject);
|
2016-02-17 04:49:26 -05:00
|
|
|
* }
|
2016-07-08 15:19:13 -04:00
|
|
|
* );
|
2016-02-17 04:49:26 -05:00
|
|
|
* );
|
|
|
|
* ```
|
|
|
|
*/
|
|
|
|
@Plugin({
|
2016-10-27 12:48:50 -05:00
|
|
|
pluginName: 'Clipboard',
|
2016-03-04 15:42:21 -06:00
|
|
|
plugin: 'https://github.com/VersoSolutions/CordovaClipboard.git',
|
2016-03-12 19:08:47 -05:00
|
|
|
pluginRef: 'cordova.plugins.clipboard',
|
2016-03-14 13:38:35 -04:00
|
|
|
repo: 'https://github.com/VersoSolutions/CordovaClipboard',
|
|
|
|
platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser']
|
2016-02-17 04:49:26 -05:00
|
|
|
})
|
|
|
|
export class Clipboard {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Copies the given text
|
2016-07-08 15:19:13 -04:00
|
|
|
* @param {string} text Text that gets copied on the system clipboard
|
|
|
|
* @returns {Promise<T>} Returns a promise after the text has been copied
|
2016-02-17 04:49:26 -05:00
|
|
|
*/
|
2016-02-17 04:52:00 -05:00
|
|
|
@Cordova()
|
2016-04-29 23:56:49 -04:00
|
|
|
static copy(text: string): Promise<any> { return; }
|
2016-02-17 04:49:26 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Pastes the text stored in clipboard
|
2016-07-08 15:19:13 -04:00
|
|
|
* @returns {Promise<T>} Returns a promise after the text has been pasted
|
2016-02-17 04:49:26 -05:00
|
|
|
*/
|
2016-02-17 04:52:00 -05:00
|
|
|
@Cordova()
|
2016-04-29 23:56:49 -04:00
|
|
|
static paste(): Promise<any> { return; }
|
2016-02-17 04:49:26 -05:00
|
|
|
|
|
|
|
}
|