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
|
package com.github.diegoberaldin.raccoonforlemmy.core.markdown
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Box
|
|
||||||
import androidx.compose.foundation.layout.heightIn
|
import androidx.compose.foundation.layout.heightIn
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
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.LocalUriHandler
|
||||||
import androidx.compose.ui.platform.UriHandler
|
import androidx.compose.ui.platform.UriHandler
|
||||||
import androidx.compose.ui.unit.Density
|
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 androidx.compose.ui.unit.isUnspecified
|
||||||
import com.github.diegoberaldin.raccoonforlemmy.core.utils.compose.onClick
|
import com.github.diegoberaldin.raccoonforlemmy.core.utils.compose.onClick
|
||||||
import com.mikepenz.markdown.compose.Markdown
|
import com.mikepenz.markdown.compose.Markdown
|
||||||
@ -56,7 +57,7 @@ fun CustomMarkdownWrapper(
|
|||||||
) {
|
) {
|
||||||
val maxHeightDp = with(LocalDensity.current) {
|
val maxHeightDp = with(LocalDensity.current) {
|
||||||
if (maxLines == null) {
|
if (maxLines == null) {
|
||||||
null
|
Dp.Unspecified
|
||||||
} else {
|
} else {
|
||||||
val lineHeight =
|
val lineHeight =
|
||||||
typography.paragraph.lineHeight
|
typography.paragraph.lineHeight
|
||||||
@ -128,15 +129,9 @@ fun CustomMarkdownWrapper(
|
|||||||
fontScale = LocalDensity.current.fontScale * GLOBAL_SCALE_FACTOR,
|
fontScale = LocalDensity.current.fontScale * GLOBAL_SCALE_FACTOR,
|
||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
Box(
|
Markdown(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.then(
|
.heightIn(min = 0.dp, max = maxHeightDp)
|
||||||
if (maxHeightDp != null) {
|
|
||||||
Modifier.heightIn(max = maxHeightDp)
|
|
||||||
} else {
|
|
||||||
Modifier
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.onClick(
|
.onClick(
|
||||||
onClick = {
|
onClick = {
|
||||||
if (!isOpeningUrl) {
|
if (!isOpeningUrl) {
|
||||||
@ -149,15 +144,12 @@ fun CustomMarkdownWrapper(
|
|||||||
onDoubleClick = {
|
onDoubleClick = {
|
||||||
onDoubleClick?.invoke()
|
onDoubleClick?.invoke()
|
||||||
},
|
},
|
||||||
)
|
),
|
||||||
) {
|
content = content.sanitize(),
|
||||||
Markdown(
|
colors = colors,
|
||||||
content = content.sanitize(),
|
typography = typography,
|
||||||
colors = colors,
|
padding = padding,
|
||||||
typography = typography,
|
components = components,
|
||||||
padding = padding,
|
)
|
||||||
components = components,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user