Question

I'm implementing Rich Edit Text using WebView,Buttons for editor actions are displayed in contextual action bar(CAB),on long press on of webview it's default CAB is shown button,I understood Webview doesn't provide any provision to customize it's CAB.

So I think it's better to implement Select, Cut, Copy, Paste action. I already tried this But not worked for me.

My Application is targeting android 3.x+ devices.

Please suggest me to how to do that.

Was it helpful?

Solution

I used BTAndroidWebViewSelection javascript library to do that.For Cut, Copy and Paste action I injected my own JavaScripts.

  • Select All - (function () { document.execCommand('selectall', true, null);})()
  • Cut - (function () { document.execCommand('cut', true, null);})()
  • Copy - (function () { document.execCommand('copy', true, null);})()
  • Paste - document.execCommand('insertHtml', false,'" + text + "'); text is data copied from ClipBoard.

Thanks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top