Skip to content

Commit 1dd0e77

Browse files
authored
Merge pull request #143 from mbkim95/fix/link-click-handler
Fix: LinkClickHandler does not work when clicking a link in the markdown list
2 parents 12d4cd7 + 20f0846 commit 1dd0e77

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

richtext-ui/src/commonMain/kotlin/com/halilibo/richtext/ui/FormattedList.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ private val LocalListLevel = compositionLocalOf { 0 }
204204
val contentsIndent = with(density) { listStyle.contentsIndent!!.toDp() }
205205
val itemSpacing = with(density) { listStyle.itemSpacing!!.toDp() }
206206
val currentLevel = LocalListLevel.current
207+
val currentLinkClickHandler = LocalLinkClickHandler.current
207208

208209
PrefixListLayout(
209210
count = items.size,
@@ -216,7 +217,10 @@ private val LocalListLevel = compositionLocalOf { 0 }
216217
}
217218
},
218219
itemForIndex = { index ->
219-
BasicRichText(style = currentRichTextStyle.copy(paragraphSpacing = listStyle.itemSpacing)) {
220+
BasicRichText(
221+
style = currentRichTextStyle.copy(paragraphSpacing = listStyle.itemSpacing),
222+
linkClickHandler = currentLinkClickHandler
223+
) {
220224
CompositionLocalProvider(LocalListLevel provides currentLevel + 1) {
221225
drawItem(items[index])
222226
}

0 commit comments

Comments
 (0)