File tree Expand file tree Collapse file tree
android/src/main/java/com/swmansion/enriched/textinput Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import android.graphics.Rect
1010import android.graphics.text.LineBreaker
1111import android.os.Build
1212import android.text.Editable
13+ import android.text.Html
1314import android.text.InputFilter
1415import android.text.InputType
1516import android.text.Spannable
@@ -451,16 +452,16 @@ class EnrichedTextInputView :
451452 }
452453
453454 private fun resolvePastedText (item : ClipData .Item ): Spannable ? {
454- item.htmlText?.let { htmlText ->
455- val parsed = parseText(htmlText)
456- if (parsed.isNotEmpty()) {
457- return (parsed as ? Spannable ) ? : SpannableString (parsed)
455+ item.text?.let { text ->
456+ if (text.isNotEmpty()) {
457+ return SpannableString (text.toString())
458458 }
459459 }
460460
461- item.text?.let { text ->
462- if (text.isNotEmpty()) {
463- return SpannableString (text)
461+ item.htmlText?.let { htmlText ->
462+ val plainText = Html .fromHtml(htmlText, Html .FROM_HTML_MODE_LEGACY ).toString()
463+ if (plainText.isNotEmpty()) {
464+ return SpannableString (plainText)
464465 }
465466 }
466467
You can’t perform that action at this time.
0 commit comments