Fix italic text is truncated when bubble mode and markdown is enabled.
This commit is contained in:
parent
10775ab2f3
commit
a31a9ab521
|
@ -27,6 +27,7 @@ package im.vector.app.features.html
|
|||
|
||||
import android.content.Context
|
||||
import android.content.res.Resources
|
||||
import android.graphics.Typeface
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.text.Spannable
|
||||
import androidx.core.text.toSpannable
|
||||
|
@ -40,6 +41,7 @@ import im.vector.app.features.settings.VectorPreferences
|
|||
import io.noties.markwon.AbstractMarkwonPlugin
|
||||
import io.noties.markwon.Markwon
|
||||
import io.noties.markwon.MarkwonPlugin
|
||||
import io.noties.markwon.MarkwonSpansFactory
|
||||
import io.noties.markwon.PrecomputedFutureTextSetterCompat
|
||||
import io.noties.markwon.ext.latex.JLatexMathPlugin
|
||||
import io.noties.markwon.ext.latex.JLatexMathTheme
|
||||
|
@ -50,6 +52,8 @@ import io.noties.markwon.inlineparser.EntityInlineProcessor
|
|||
import io.noties.markwon.inlineparser.HtmlInlineProcessor
|
||||
import io.noties.markwon.inlineparser.MarkwonInlineParser
|
||||
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin
|
||||
import me.gujun.android.span.style.CustomTypefaceSpan
|
||||
import org.commonmark.node.Emphasis
|
||||
import org.commonmark.node.Node
|
||||
import org.commonmark.parser.Parser
|
||||
import org.matrix.android.sdk.api.MatrixUrls.isMxcUrl
|
||||
|
@ -94,6 +98,12 @@ class EventHtmlRenderer @Inject constructor(
|
|||
// It needs to be in this specific format: https://noties.io/Markwon/docs/v4/ext-latex
|
||||
builder
|
||||
.usePlugin(object : AbstractMarkwonPlugin() {
|
||||
override fun configureSpansFactory(builder: MarkwonSpansFactory.Builder) {
|
||||
builder.setFactory(
|
||||
Emphasis::class.java
|
||||
) { _, _ -> CustomTypefaceSpan(Typeface.create(Typeface.DEFAULT, Typeface.ITALIC)) }
|
||||
}
|
||||
|
||||
override fun processMarkdown(markdown: String): String {
|
||||
return markdown
|
||||
.replace(Regex("""<span\s+data-mx-maths="([^"]*)">.*?</span>""")) { matchResult ->
|
||||
|
|
Loading…
Reference in New Issue