mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 11:47:04 +05:30
common: move back to compose-richtext for Markdown
The bugs in multiplatform-markdown-renderer are not worth the colored lines
This commit is contained in:
parent
2e66baaf08
commit
09dedf9015
3 changed files with 16 additions and 8 deletions
|
@ -17,7 +17,9 @@ kotlin {
|
||||||
api(compose.material)
|
api(compose.material)
|
||||||
api(projects.database)
|
api(projects.database)
|
||||||
api(projects.model)
|
api(projects.model)
|
||||||
implementation(libs.multiplatform.markdown)
|
implementation(libs.compose.richtext.markdown)
|
||||||
|
implementation(libs.compose.richtext.material)
|
||||||
|
implementation(libs.compose.richtext.ui)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sourceSets["androidMain"].apply {
|
sourceSets["androidMain"].apply {
|
||||||
|
|
|
@ -4,20 +4,20 @@ import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.IntrinsicSize
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.foundation.layout.wrapContentHeight
|
||||||
import androidx.compose.material.Divider
|
import androidx.compose.material.Divider
|
||||||
import androidx.compose.material.Surface
|
import androidx.compose.material.Surface
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.mikepenz.markdown.Markdown
|
import com.halilibo.richtext.markdown.Markdown
|
||||||
|
import com.halilibo.richtext.ui.material.MaterialRichText
|
||||||
import dev.msfjarvis.claw.common.posts.PostDetails
|
import dev.msfjarvis.claw.common.posts.PostDetails
|
||||||
import dev.msfjarvis.claw.common.posts.SubmitterName
|
import dev.msfjarvis.claw.common.posts.SubmitterName
|
||||||
import dev.msfjarvis.claw.common.posts.toDbModel
|
import dev.msfjarvis.claw.common.posts.toDbModel
|
||||||
|
@ -37,7 +37,7 @@ fun CommentsHeader(
|
||||||
PostDetails(
|
PostDetails(
|
||||||
post = postDetails.toDbModel(),
|
post = postDetails.toDbModel(),
|
||||||
)
|
)
|
||||||
Markdown(htmlToMarkdown(postDetails.description))
|
MaterialRichText { Markdown(htmlToMarkdown(postDetails.description)) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ fun CommentEntry(
|
||||||
val indentLevel = comment.indentLevel.toInt() - 1
|
val indentLevel = comment.indentLevel.toInt() - 1
|
||||||
|
|
||||||
Divider(color = Color.Gray.copy(0.4f))
|
Divider(color = Color.Gray.copy(0.4f))
|
||||||
Row(modifier = Modifier.height(IntrinsicSize.Min)) {
|
Row(modifier = Modifier.wrapContentHeight()) {
|
||||||
CommentTreeColors(indentLevel = indentLevel)
|
CommentTreeColors(indentLevel = indentLevel)
|
||||||
Column(modifier = Modifier.padding(start = 12.dp, end = 8.dp, top = 4.dp, bottom = 4.dp)) {
|
Column(modifier = Modifier.padding(start = 12.dp, end = 8.dp, top = 4.dp, bottom = 4.dp)) {
|
||||||
SubmitterName(
|
SubmitterName(
|
||||||
|
@ -58,7 +58,9 @@ fun CommentEntry(
|
||||||
avatarUrl = "https://lobste.rs/${comment.user.avatarUrl}",
|
avatarUrl = "https://lobste.rs/${comment.user.avatarUrl}",
|
||||||
contentDescription = "Submitted by ${comment.user.username}",
|
contentDescription = "Submitted by ${comment.user.username}",
|
||||||
)
|
)
|
||||||
Markdown(htmlToMarkdown(comment.comment), Modifier.padding(top = 8.dp))
|
MaterialRichText(modifier = Modifier.padding(top = 8.dp)) {
|
||||||
|
Markdown(htmlToMarkdown(comment.comment))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ accompanist = "0.20.0"
|
||||||
aurora = "0.0.58-SNAPSHOT"
|
aurora = "0.0.58-SNAPSHOT"
|
||||||
coroutines = "1.5.2"
|
coroutines = "1.5.2"
|
||||||
hilt = "2.39.1"
|
hilt = "2.39.1"
|
||||||
|
richtext = "0.8.1"
|
||||||
serialization = "1.3.0"
|
serialization = "1.3.0"
|
||||||
sqldelight = "1.5.2"
|
sqldelight = "1.5.2"
|
||||||
|
|
||||||
|
@ -34,11 +35,14 @@ aurora-window = { module = "org.pushing-pixels:aurora-window", version.ref = "au
|
||||||
coil-compose = "io.coil-kt:coil-compose:2.0.0-alpha01"
|
coil-compose = "io.coil-kt:coil-compose:2.0.0-alpha01"
|
||||||
kamel-image = "com.alialbaali.kamel:kamel-image:0.3.0"
|
kamel-image = "com.alialbaali.kamel:kamel-image:0.3.0"
|
||||||
|
|
||||||
|
compose-richtext-ui = { module = "com.halilibo.compose-richtext:richtext-ui", version.ref = "richtext" }
|
||||||
|
compose-richtext-material = { module = "com.halilibo.compose-richtext:richtext-ui-material", version.ref = "richtext" }
|
||||||
|
compose-richtext-markdown = { module = "com.halilibo.compose-richtext:richtext-commonmark", version.ref = "richtext" }
|
||||||
|
|
||||||
dagger-hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
|
dagger-hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
|
||||||
dagger-hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" }
|
dagger-hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" }
|
||||||
dagger-hilt-core = { module = "com.google.dagger:hilt-core", version.ref = "hilt" }
|
dagger-hilt-core = { module = "com.google.dagger:hilt-core", version.ref = "hilt" }
|
||||||
|
|
||||||
multiplatform-markdown = "com.mikepenz:multiplatform-markdown-renderer:0.1.0"
|
|
||||||
copydown = "io.github.furstenheim:copy_down:1.0"
|
copydown = "io.github.furstenheim:copy_down:1.0"
|
||||||
|
|
||||||
multiplatform-paging = "io.github.kuuuurt:multiplatform-paging:0.4.5"
|
multiplatform-paging = "io.github.kuuuurt:multiplatform-paging:0.4.5"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue