Skip to content
Source
Sign inSign up
pingdotgg/t3code

Revert "fix(mobile): keep Android markdown icons aligned with text" #11098

Mergedjuliusmarmingemerged 1 commit intomain fromrefs/pull/11098/headmerged by juliusmarminge View on GitHub

Showing 9 changed files with 5 additions and 69 deletions (loading 6).

x
0 of 9 viewed, 9 left
5 additions and 9 deletionsapps/mobile/modules/t3-markdown-text/android/src/main/java/expo/modules/t3markdowntext/T3MarkdownTextSelectionModule.ktModified
View file
@@ -18,23 +18,19 @@
​
private const val OBJECT_REPLACEMENT_CHARACTER = "\uFFFC"
​
-internal fun copyTextWithoutInlineImages(
+private fun copyTextWithoutInlineImages(
text: CharSequence,
start: Int,
end: Int
): String {
if (text !is Spanned) return text.subSequence(start, end).toString()
​
- fun isInlineImage(index: Int): Boolean =
- index >= 0 && text[index].toString() == OBJECT_REPLACEMENT_CHARACTER &&
- text.getSpans(index, index + 1, ReplacementSpan::class.java).isNotEmpty()
-​
return buildString {
for (index in start until end) {
- // The renderer inserts one NBSP after each image to keep its label on the same line.
- // Inspect the original text even when selection starts after the image.
- val isIconSpacer = text[index] == '\u00A0' && isInlineImage(index - 1)
- if (!isInlineImage(index) && !isIconSpacer) append(text[index])
+ val isInlineImage =
+ text[index].toString() == OBJECT_REPLACEMENT_CHARACTER &&
+ text.getSpans(index, index + 1, ReplacementSpan::class.java).isNotEmpty()
+ if (!isInlineImage) append(text[index])