mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-3389 Space-level chat | Fix | Fix range for URL markup flow
This commit is contained in:
parent
d8673e0ac4
commit
4dc4cc8e2f
1 changed files with 4 additions and 2 deletions
|
@ -348,13 +348,15 @@ class ChatViewModel @Inject constructor(
|
|||
val parsedUrls = buildList {
|
||||
urlRegex.findAll(msg).forEach { match ->
|
||||
val range = match.range
|
||||
// Adjust the range to include the last character (inclusive end range)
|
||||
val adjustedRange = range.first..range.last + 1
|
||||
val url = match.value
|
||||
|
||||
// Check if a LINK markup already exists in the same range
|
||||
if (markup.none { it.range == range && it.type == Block.Content.Text.Mark.Type.LINK }) {
|
||||
if (markup.none { it.range == adjustedRange && it.type == Block.Content.Text.Mark.Type.LINK }) {
|
||||
add(
|
||||
Block.Content.Text.Mark(
|
||||
range = range,
|
||||
range = adjustedRange,
|
||||
type = Block.Content.Text.Mark.Type.LINK,
|
||||
param = url
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue