versosolutions / cordovaclipboard Goto Github PK
View Code? Open in Web Editor NEWClipboard management plugin for Cordova/PhoneGap
License: MIT License
Clipboard management plugin for Cordova/PhoneGap
License: MIT License
Hello @VersoSolutions .
Corodova have announced that all plugins should be prepared to move to npm (read http://cordova.apache.org/announcements/2015/04/21/plugins-release-and-move-to-npm.html).
Please, hope you're making plans to move as well? Your plugin is very very important to thousands of developers.
Thanks
Anybody else having problems with iOS 9? There aren't any exceptions, the native plugin methods simply never gets called.
cordova -v
): 7.0.1cordova 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
To copy some text in my phone clipboard
No text is added
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 !
The new Phonega build has gradle support, that use NPM on plugins. Are you intend to update to it on the next few days?
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)} );
It is unable to copy from your app and paste text into another app. Paste simply does not work.
Please see and make changes like made in XPanniX@dac4c0e
The solution works.
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.
hi all,
plugins behaviour seems to be strange on windows phone (8,1 and 10):
cordova.plugins.clipboard.copy fires, but then, the app hangs for seconds
anyone having similar issues?
thanks in advance for any info on that
I am using phonegap build 3.1,and very sure that my phonegap.js and clipboard.js are all loaded successfully
but when I use your code and run it...nothing happened
and I use Chrome to debug,it said "Cannot call method 'copy' of undefined"
here is my code
Use this ,its Work perfectly .
window.plugins.clipboard.copy(text);
window.plugins.clipboard.paste(function (text) { });
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.
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.
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.
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
I can't get any copy/paste functionality to work in iOS 10 using cordova-ios 4.1.1
Visiting the Phonegap Build Plugin Documentation sends to here: https://github.com/VersoSolutions/CordovaClipboard/blob/941fd568ff924018a223a48f4e94c1d0a8d18e25/README.md
But I found this version that is newer and the documentations are different. Which one is correct for Phonegap Build Plugin? Thanks!
And another question, is necessary include explicitly the phonegap.js file into the index.html for the plugin works?
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?
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':
Then nothing gets pasted:
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:
However, in some apps, such as the default iOS Mail app, the text will be pasted as expected:
Is there any chance this could be fixed? Or does anyone know of a workaround?
Thanks.
Hi
paste is not working on an iPhone Xs. In the xcode simulator it is working very well as on an android device.
Any Ideas?
Bernd
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); });
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
Hi everyone!
This plugin is dead as you can see, please use this fork that is being regularly updated.
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!
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"];
Hi ,
I'm using phonegap 5.2.0 and building application using phonegap build .
I have added plugin in config
https://build.phonegap.com/plugins/67
But is not working .
Please suggest me,how to
use this plugin with phonegap build
hello
can you help me
i install this plugin to my ionic 2 project
and the result is like this
http://prntscr.com/fhxpts
http://prntscr.com/fhxq17
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
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); });
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
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
If I change the script to`
call npm install -g cordova@6
it works fine. ➡️ with cordova 6 everything works
Hi.I wrote this line in node.js command prompt but it show me warning
phonegap local plugin add https://github.com/VersoSolutions/CordovaClipboard
[warning] The command phonegap local <command>
has been DEPRECATED.
[warning] The command has been delegated to phonegap <command>
.
[warning] The command phonegap local <command>
will soon be removed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.