mirror of
https://github.com/LiveFastEatTrashRaccoon/RaccoonForLemmy.git
synced 2025-02-09 17:00:42 +01:00
fix: post body max height (#813)
This commit is contained in:
parent
9363f52eca
commit
a3faaa58cc
@ -1,6 +1,5 @@
|
||||
package com.github.diegoberaldin.raccoonforlemmy.core.markdown
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
@ -14,6 +13,8 @@ import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.platform.LocalUriHandler
|
||||
import androidx.compose.ui.platform.UriHandler
|
||||
import androidx.compose.ui.unit.Density
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.isUnspecified
|
||||
import com.github.diegoberaldin.raccoonforlemmy.core.utils.compose.onClick
|
||||
import com.mikepenz.markdown.compose.Markdown
|
||||
@ -56,7 +57,7 @@ fun CustomMarkdownWrapper(
|
||||
) {
|
||||
val maxHeightDp = with(LocalDensity.current) {
|
||||
if (maxLines == null) {
|
||||
null
|
||||
Dp.Unspecified
|
||||
} else {
|
||||
val lineHeight =
|
||||
typography.paragraph.lineHeight
|
||||
@ -128,15 +129,9 @@ fun CustomMarkdownWrapper(
|
||||
fontScale = LocalDensity.current.fontScale * GLOBAL_SCALE_FACTOR,
|
||||
),
|
||||
) {
|
||||
Box(
|
||||
Markdown(
|
||||
modifier = modifier
|
||||
.then(
|
||||
if (maxHeightDp != null) {
|
||||
Modifier.heightIn(max = maxHeightDp)
|
||||
} else {
|
||||
Modifier
|
||||
}
|
||||
)
|
||||
.heightIn(min = 0.dp, max = maxHeightDp)
|
||||
.onClick(
|
||||
onClick = {
|
||||
if (!isOpeningUrl) {
|
||||
@ -149,15 +144,12 @@ fun CustomMarkdownWrapper(
|
||||
onDoubleClick = {
|
||||
onDoubleClick?.invoke()
|
||||
},
|
||||
)
|
||||
) {
|
||||
Markdown(
|
||||
content = content.sanitize(),
|
||||
colors = colors,
|
||||
typography = typography,
|
||||
padding = padding,
|
||||
components = components,
|
||||
)
|
||||
}
|
||||
),
|
||||
content = content.sanitize(),
|
||||
colors = colors,
|
||||
typography = typography,
|
||||
padding = padding,
|
||||
components = components,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user