6

In Android 4.1.1 copying some content from a WebView (like paragraphs, bullets, spans, links) and pasting it into an EditText renders the HTML almost like the original (since many tags aren't supported it's not exactly the same but close enough).

But as of Android 4.1.2, the text is not pasted as HTML anymore, and when reading from the ClipboardManager the text has the MIME_TYPE text\plain. Is there a way to tell the clipboard manager to copy the selection from a WebView as HTML and not text?

Guillaume
  • 2,912
  • 3
  • 35
  • 59
  • I want to do the exact opposite, that is copy webview text as plain on all devices. Any solutions yet? – ThanosFisherman Nov 30 '14 at 01:11
  • @ThanosF I don't undestand... when you select some text in a Webview and click on copy in the toolbar, it does copy in plain text. What do you want to do? – Guillaume Dec 10 '14 at 14:34
  • Actually no. On my 4.4.2 android devices when you copy a text from webview It does copy it formatted. I ended up using a textView with isSelectable option set to true for apis >= 11 and a web view for < 11 so that i can copy everything in plain text. Iam not sure about your issue though as webviews seems to be really messed up across android versions – ThanosFisherman Dec 10 '14 at 15:40
  • Android 5.1 indeed does not provide text/html in the clipboardData for some odd reason. even public.html data type returns empty value. Only one working is text/plain - this is ridiculous! – Moonwalker Jun 29 '17 at 12:16

0 Answers0