Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to allow copy and paste from an ionic webview?

I am using ionic and cordova to build a hybrid application.

However, I can't copy text from any of my webviews. From my Android phone or from the browser, copying text does not work. Selecting text and dragging the pointer does nothing.

This occurs for instance with the basic app generated by ionic start myApp tabs.

Simply put, how can I allow users to copy-paste?

like image 245
Matt Avatar asked Apr 06 '14 11:04

Matt


1 Answers

Make ion-content to overflow-scroll="true" and add a class to your copyable text

.selectable{
    -webkit-user-select: auto;
}

You cannot copy anything to clipboard from javascript for now programmatically. However it can be done from native side via plugin CordovaClipboard

like image 172
engincancan Avatar answered Nov 08 '22 09:11

engincancan