Giter VIP home page Giter VIP logo

cordovaclipboard's Introduction

Clipboard

Clipboard management plugin for Cordova/PhoneGap that supports iOS, Android, and Windows Phone 8.

Usage

Install the plugin using the CLI, for instance with PhoneGap:

phonegap local plugin add https://github.com/VersoSolutions/CordovaClipboard

The plugin creates the object cordova.plugins.clipboard with the methods copy(text, onSuccess, onError) and paste(onSuccess, onError).

Example:

var text = "Hello World!";

cordova.plugins.clipboard.copy(text);

cordova.plugins.clipboard.paste(function (text) { alert(text); });

Notes

All platforms

  • The plugin only works with text content.

Windows Phone

  • The Windows Phone platform doesn't allow applications to read the content of the clipboard. Using the paste method will return an error.

Android

  • The minimum supported API Level is 11. Make sure that minSdkVersion is larger or equal to 11 in AndroidManifest.xml.

Acknowledgements

This plugin was inspired by ClipboardManagerPlugin (Android) and ClipboardPlugin (iOS).

License

The MIT License (MIT)

Copyright (c) 2013 Verso Solutions LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

cordovaclipboard's People

Contributors

ctrevisan avatar gouravkakkar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordovaclipboard's Issues

Copy no longer works in iOS 11

Firstly, thanks for your hard work on this plugin, it's worked great for me in iOS 10 and below.

However, since iOS 11 came out, the copy function no longer works as expected. For example, if I do the following:

cordova.plugins.clipboard.copy('password');

And then open the Facebook app on iOS 11, tap and hold on the password field and tap 'Paste':

img_3602

Then nothing gets pasted:

img_3603

If I then open the default iOS Notes app and attempt to paste there, instead of the plain text being pasted, I get this "text" object pasted:

img_3604

However, in some apps, such as the default iOS Mail app, the text will be pasted as expected:

img_3605

Is there any chance this could be fixed? Or does anyone know of a workaround?

Thanks.

Just doesn't work on my S4 anymore

The plugin is there, yet there are no errors / or success on .paste (and no device error logs, window exceptions etc)
It used to work before

I have a hunch a clean slate might fix the issue, yet I haven't tested it yet

Typo in the example of the documentation of the plugin. The 'clipboard' part is missing from the function calls.

There is a typo in the example of the documentation of the plugin. The 'clipboard' part is missing from the function calls. The example in the documentation did not work when using the phonegap build.

Incorrect example:
var text = "Hello World!";
window.plugins.copy(text);
window.plugins.paste(function (text) { alert(text); });

This is what it should be:
var text = "Hello World!";
window.plugins.clipboard.copy(text);
window.plugins.clipboard.paste(function (text) { alert(text); });

💀☠️NEW PLUGIN, PLEASE DON'T USE THIS ONE ANYMORE☠️💀

Hi everyone!

This plugin is dead as you can see, please use this fork that is being regularly updated.

cordova-clipboard

you should only need to run:

cordova plugin rm com.verso.cordova.clipboard
cordova plugin add cordova-clipboard

and it should work out of the box but don't forget to test! 😄

(also please DON'T create issues here, put them on the new fork! and star it!) Thanks!

Plugin cannot install with Cordova 7 (latest Cordova Version)

Environment

  • OS: Windows 10 64 Bit - lastest OS Update
  • Node / npm
    image

Steps to reproduce

run follow script to create a new cordova android app. The only plugin is the CordovaClipboard plugin.

call npm uninstall -g cordova
call npm install -g cordova@latest

call cordova create cordova_android de.test.test Test

cd cordova_android

call cordova platform add android

call cordova plugin add https://github.com/VersoSolutions/CordovaClipboard.git

call cordova plugin ls

During the installation follow error occur

image

Error Message
C:\Test\cordova_android>call cordova plugin add https://github.com/VersoSolutions/CordovaClipboard.git
Error: Failed to fetch plugin https://github.com/VersoSolutions/CordovaClipboard.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: cmd: Command failed with exit code 4294963228 Error output:
npm ERR! addLocal Could not install C:\Users\RSCHLE~1\AppData\Local\Temp\npm-15004-95f15c54\git-cache-06e71f4f\03fe48b62411cbff22229ca13cc3ac8b282f7945
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "https://github.com/VersoSolutions/CordovaClipboard.git" "--save"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.10
npm ERR! code EISDIR
npm ERR! errno -4068
npm ERR! syscall read

npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Test\cordova_android\node_modules\npm-debug.log

❗️ ❗️ ❗️ Important NOTE ❗️ ❗️ ❗️

If I change the script to`

call npm install -g cordova@6

it works fine. ➡️ with cordova 6 everything works

No input files, build error

Hi, after installing this plugin and try to build, I get this error...

clang: error: no such file or directory: '/<path>/platforms/ios/memorizeit/Plugins/com.verso.cordova.clipboard/CDVClipboard.m'
clang: error: no input files
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

** BUILD FAILED **


The following build commands failed:
    CompileC build/memorizeit.build/Debug-iphonesimulator/memorizeit.build/Objects-normal/i386/CDVClipboard.o memorizeit/Plugins/com.verso.cordova.clipboard/CDVClipboard.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Error: /<path>/platforms/ios/cordova/build: Command failed with exit code 65
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)

Any idea why?

Not working on iOS 9

Anybody else having problems with iOS 9? There aren't any exceptions, the native plugin methods simply never gets called.

Text not added to my phone clipboard

My Environment

  • Plugin version: 0.8.5
  • Platform: android
  • OS version: 7.1.1
  • Device manufacturer / model: OnePlus 5
  • Cordova version (cordova -v): 7.0.1
  • Cordova platform version (cordova platform ls):
Installed platforms:
  android 6.2.3
Available platforms:
  blackberry10 ~3.8.0 (deprecated)
  browser ~4.1.0
  webos ~3.7.0
  windows ~5.0.0
  • Ionic Version (if using Ionic) : 2

Expected Behavior

To copy some text in my phone clipboard

Actual Behavior

No text is added

Code

I installed the plugin, added it to the imports in app.module.ts, added it in the providers.

Here is my home.ts code and the function called on button click :

...
import { Clipboard } from '@ionic-native/clipboard';

export class HomePage{

  constructor(public navCtrl: NavController, public modalCtrl: ModalController, private keyboard: Keyboard, public alertCtrl: AlertController, public storage: Storage, private clipboard: Clipboard) {

    }

  exportCards() {
    this.clipboard.copy("test");
  }
}

And then nothing is added to my clipboard ...

Thanks for your help !

About "undefined" error using clipboard

I am using this plugin in my app. And when I test it in browser,I always get this undefined error about cannot read some properties.However,when I test it on my emulator,and the clipboard's copy and paste function work fine.

Clipboard not pasting on android

Hi,
I have a problem, I am trying to set copy / paste on my android app, but paste is not working when I copy text from any app on my phone and try to paste it in my app. Copy / paste is working when I am in my app and I can paste text, what I copy in my app, in any app on my phone.

Can somebody help me?

this is how I try to paste in my app
window.plugins.clipboard.paste( text => {console.log(text)} );

package.json

Hello

I am using this plugin on Android. It is complaining there is no valid package.json. Can you add package.json to this plugin?

Thanks.

Copy Image to Clipboard

It would be really nice to have this also copy an image. Perhaps a new method called CopyImage() which accepts a URL?

Example pulled from stackoverflow

NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://fc05.deviantart.net/fs37/f/2008/283/a/b/KaleidoCoils_animated__gif_by_1389AD.gif"]];
UIPasteboard *pasteBoard=[UIPasteboard generalPasteboard];
[pasteBoard setData:data forPasteboardType:@"com.compuserve.gif"];

Mistake in documentation

It seems to be mistake in documentation:

var text = "Hello World!";

window.plugins.copy(text);

window.plugins.paste(function (text) { alert(text); });

should be

var text = "Hello World!";

window.plugins.clipboard.copy(text);

window.plugins.clipboard.paste(function (text) { alert(text); });

Cordova Windows Build.

Hi,
I am using this plugin for windows phone 8.1/10 app, but the plugin is not working.
cordova plugin add com.verso.cordova.clipboard
cordova.plugins.clipboard.copy("dfsd", function (text) { debugger; }, function (tex) { debugger; });

It is always returning error.
Could anyone help me out.
Thanks in advance.
Regards,
Ishan Deb

RegistrationIntentService.java blocks PhoneGap Build

When building with PG:B it gives the following error:

Some official plugins have to be updated if using PhoneGap >= 4.0.0. Please upgrade the version of any plugins that may include the following file: RegistrationIntentService.java

Issue pasting Imgur app link (ios)

on iOS, When in the Imgur app, looking at a picture and doing a long-press to copy the link URL,
then using the verso clipboard plugin to paste, it has an error on the native side and doesn't trigger the error callback.

I believe imgur has also copying to clipboard some hidden character that's tripping up the paste funtion (?) Because if I paste it manually somewhere and recopy the same text, then the verso clipboard paste works.

Solution here

Use this ,its Work perfectly .

window.plugins.clipboard.copy(text);
window.plugins.clipboard.paste(function (text) { });

Cannot call method 'paste' of undefined for ngCordova with ionic and phonegap build

i am using ionic ngCordova extention set and building my app using the phonegap build service.
phonegap version 3.7.0

i have added the plugin like so and it works great with the JavaScript way:

         window.plugins.clipboard.paste(function (text) { alert(text); });

but when i use the $cordovaClipboard i am getting this error:

      module.controller('ClipboardCtrl', function($scope, $cordovaClipboard) {
      $cordovaClipboard.paste().then(function (result) {
             // success, use result
            }, function () {
             // error
               });
         });

TypeError: Cannot call method 'paste' of undefined
at Object.paste (file:///android_asset/www/js/ng-cordova.min.js:7:15146)
at l.$scope.mypastefun(file:///android_asset/www/js/myCtrl.js:54:22)
at file:///android_asset/www/lib/ionic/js/ionic.bundle.min.js:229:303
at file:///android_asset/www/lib/ionic/js/ionic.bundle.min.js:388:5713
at l.$eval (file:///android_asset/www/lib/ionic/js/ionic.bundle.min.js:156:305)
at l.$apply (file:///android_asset/www/lib/ionic/js/ionic.bundle.min.js:157:6)
at HTMLButtonElement. (file:///android_asset/www/lib/ionic/js/ionic.bundle.min.js:388:5695)
at HTMLButtonElement.c (file:///android_asset/www/lib/ionic/js/ionic.bundle.min.js:63:389)
at n (file:///android_asset/www/lib/ionic/js/ionic.bundle.min.js:22:384)
at t (file:///android_asset/www/lib/ionic/js/ionic.bundle.min.js:22:216) ionic.bundle.min.js:133
(anonymous function) ionic.bundle.min.js:133
(anonymous function) ionic.bundle.min.js:107
l.$apply ionic.bundle.min.js:157
(anonymous function) ionic.bundle.min.js:388
c ionic.bundle.min.js:63
n ionic.bundle.min.js:22
t ionic.bundle.min.js:22
l ionic.bundle.min.js:22
t ionic.bundle.min.js:22
l ionic.bundle.min.js:22

This happens only on the build service and not in the CLI.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.