ihadeed / cordova-clipboard

Clipboard management plugin for Cordova/PhoneGap
MIT License
53 stars 42 forks source link

cannot get it to work on latest cordova 9 #8

Closed rif closed 5 years ago

rif commented 5 years ago

Even with the initial hello world code I get no alert at all.

I only installed it with

cordova plugin add cordova-clipboard

What am I missing?

receivedEvent: function(id) {
        var parentElement = document.getElementById(id);
        var listeningElement = parentElement.querySelector('.listening');
        var receivedElement = parentElement.querySelector('.received');

        listeningElement.setAttribute('style', 'display:none;');
        receivedElement.setAttribute('style', 'display:block;');

        console.log('Received Event: ' + id);
        var text = "Hello World!";
        cordova.plugins.clipboard.copy(text, function(data){
            alert(data)
        }, function(err){alert(err)})

        cordova.plugins.clipboard.paste(function (text) {
            alert(text)
            receivedElement.innerHTML = text
        }, function(err){alert(err)});

        cordova.plugins.clipboard.clear();
    }
rif commented 5 years ago

looks like I missed to add manually in config.xml