From 61cb08d0a6b951577d6482de2f647aebcd585fcc Mon Sep 17 00:00:00 2001 From: Saif Alhaider Date: Sat, 1 Feb 2025 00:36:41 +0300 Subject: [PATCH] add: hover icon on linked text --- .../com/mikepenz/markdown/compose/elements/MarkdownText.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/elements/MarkdownText.kt b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/elements/MarkdownText.kt index bd1447a..a775b1b 100644 --- a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/elements/MarkdownText.kt +++ b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/elements/MarkdownText.kt @@ -7,6 +7,8 @@ import androidx.compose.foundation.gestures.waitForUpOrCancellation import androidx.compose.foundation.text.InlineTextContent import androidx.compose.runtime.* import androidx.compose.ui.Modifier +import androidx.compose.ui.input.pointer.PointerIcon +import androidx.compose.ui.input.pointer.pointerHoverIcon import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.layout.onPlaced import androidx.compose.ui.platform.LocalUriHandler @@ -102,7 +104,7 @@ fun MarkdownText( val imageState = rememberMarkdownImageState() val hasUrl = content.getStringAnnotations(MARKDOWN_TAG_URL, 0, content.length).any() - val textModifier = if (hasUrl) modifier.pointerInput(Unit) { + val textModifier = if (hasUrl) modifier.pointerHoverIcon(PointerIcon.Hand, true).pointerInput(Unit) { awaitEachGesture { val pointer = awaitFirstDown() val pos = pointer.position // current position