Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
circles-android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Circles
circles-android
Commits
828e4bb3
Commit
828e4bb3
authored
1 year ago
by
Taras
Browse files
Options
Downloads
Patches
Plain Diff
Fix mention plagin
parent
4f63f297
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/src/main/java/org/futo/circles/core/feature/markdown/mentions/plugin/MentionPlugin.kt
+4
-5
4 additions, 5 deletions
...es/core/feature/markdown/mentions/plugin/MentionPlugin.kt
with
4 additions
and
5 deletions
core/src/main/java/org/futo/circles/core/feature/markdown/mentions/plugin/MentionPlugin.kt
+
4
−
5
View file @
828e4bb3
...
@@ -4,6 +4,7 @@ import android.content.Context
...
@@ -4,6 +4,7 @@ import android.content.Context
import
io.noties.markwon.AbstractMarkwonPlugin
import
io.noties.markwon.AbstractMarkwonPlugin
import
io.noties.markwon.MarkwonVisitor
import
io.noties.markwon.MarkwonVisitor
import
io.noties.markwon.SpannableBuilder
import
io.noties.markwon.SpannableBuilder
import
org.commonmark.node.Text
import
org.commonmark.parser.Parser
import
org.commonmark.parser.Parser
import
org.futo.circles.core.feature.markdown.span.MentionSpan
import
org.futo.circles.core.feature.markdown.span.MentionSpan
...
@@ -22,11 +23,9 @@ class MentionPlugin(private val context: Context) : AbstractMarkwonPlugin() {
...
@@ -22,11 +23,9 @@ class MentionPlugin(private val context: Context) : AbstractMarkwonPlugin() {
)
{
visitor
,
simpleExtNode
->
)
{
visitor
,
simpleExtNode
->
val
start
=
visitor
.
length
()
val
start
=
visitor
.
length
()
visitor
.
visitChildren
(
simpleExtNode
)
visitor
.
visitChildren
(
simpleExtNode
)
val
name
=
visitor
.
builder
().
toString
()
val
name
=
(
simpleExtNode
.
firstChild
as
Text
).
literal
visitor
.
builder
().
apply
{
val
end
=
start
+
name
.
length
clear
()
visitor
.
builder
().
spannableStringBuilder
().
replace
(
start
,
end
,
"@"
)
append
(
"@"
)
}
SpannableBuilder
.
setSpans
(
SpannableBuilder
.
setSpans
(
visitor
.
builder
(),
visitor
.
builder
(),
MentionSpan
(
context
,
name
),
MentionSpan
(
context
,
name
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment