Fix the place of the span factory.

This commit is contained in:
Onuray Sahin 2022-11-17 15:58:42 +03:00
parent a31a9ab521
commit ab94b21807
2 changed files with 7 additions and 6 deletions

1
changelog.d/5679.bugfix Normal file
View file

@ -0,0 +1 @@
Fix italic text is truncated when bubble mode and markdown is enabled

View file

@ -98,12 +98,6 @@ 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 ->
@ -133,6 +127,12 @@ class EventHtmlRenderer @Inject constructor(
)
)
.usePlugin(object : AbstractMarkwonPlugin() {
override fun configureSpansFactory(builder: MarkwonSpansFactory.Builder) {
builder.setFactory(
Emphasis::class.java
) { _, _ -> CustomTypefaceSpan(Typeface.create(Typeface.DEFAULT, Typeface.ITALIC)) }
}
override fun configureParser(builder: Parser.Builder) {
/* Configuring the Markwon block formatting processor.
* Default settings are all Markdown blocks. Turn those off.