fix: 贴子正文无法触发点击事件
This commit is contained in:
parent
d86f0d9c41
commit
a758639eb1
|
|
@ -302,9 +302,9 @@ fun PbContentText(
|
|||
awaitEachGesture {
|
||||
val change = awaitFirstDown()
|
||||
val annotation =
|
||||
layoutResult.value?.getOffsetForPosition(change.position)?.let {
|
||||
text.getStringAnnotations(start = it, end = it)
|
||||
.firstOrNull()
|
||||
layoutResult.value?.getOffsetForPosition(change.position)?.let { offset ->
|
||||
text.getStringAnnotations(start = offset, end = offset)
|
||||
.firstOrNull { it.tag == "url" || it.tag == "user" }
|
||||
}
|
||||
if (annotation != null) {
|
||||
if (change.pressed != change.previousPressed) change.consume()
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@ object EmoticonUtil {
|
|||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalTextApi::class)
|
||||
val AnnotatedString.emoticonString: AnnotatedString
|
||||
get() {
|
||||
if (hasStringAnnotations("Emoticon", 0, length)) {
|
||||
|
|
@ -154,7 +155,9 @@ object EmoticonUtil {
|
|||
val regexPattern = Pattern.compile(getRegex(EMOTICON_ALL_TYPE))
|
||||
val matcher = regexPattern.matcher(this.text)
|
||||
return buildAnnotatedString {
|
||||
append(this@emoticonString)
|
||||
withAnnotation("Emoticon", "true") {
|
||||
append(this@emoticonString)
|
||||
}
|
||||
while (matcher.find()) {
|
||||
val start = matcher.start()
|
||||
val end = matcher.end()
|
||||
|
|
|
|||
Loading…
Reference in New Issue