From 20f08465f9dd0389896b95f269142ad6fadbffef Mon Sep 17 00:00:00 2001 From: mbkim95 Date: Thu, 13 Jun 2024 13:37:43 +0900 Subject: [PATCH] Fix the bug where LinkClickHandler doesn't work when there is a linkin a markdown list --- .../kotlin/com/halilibo/richtext/ui/FormattedList.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/richtext-ui/src/commonMain/kotlin/com/halilibo/richtext/ui/FormattedList.kt b/richtext-ui/src/commonMain/kotlin/com/halilibo/richtext/ui/FormattedList.kt index 9bfa20f8..dae68f92 100644 --- a/richtext-ui/src/commonMain/kotlin/com/halilibo/richtext/ui/FormattedList.kt +++ b/richtext-ui/src/commonMain/kotlin/com/halilibo/richtext/ui/FormattedList.kt @@ -204,6 +204,7 @@ private val LocalListLevel = compositionLocalOf { 0 } val contentsIndent = with(density) { listStyle.contentsIndent!!.toDp() } val itemSpacing = with(density) { listStyle.itemSpacing!!.toDp() } val currentLevel = LocalListLevel.current + val currentLinkClickHandler = LocalLinkClickHandler.current PrefixListLayout( count = items.size, @@ -216,7 +217,10 @@ private val LocalListLevel = compositionLocalOf { 0 } } }, itemForIndex = { index -> - BasicRichText(style = currentRichTextStyle.copy(paragraphSpacing = listStyle.itemSpacing)) { + BasicRichText( + style = currentRichTextStyle.copy(paragraphSpacing = listStyle.itemSpacing), + linkClickHandler = currentLinkClickHandler + ) { CompositionLocalProvider(LocalListLevel provides currentLevel + 1) { drawItem(items[index]) }