From efc478576fc6cf6e47fe0b4ce540b10aab61c44b Mon Sep 17 00:00:00 2001 From: Ivan Morgillo Date: Mon, 8 Jul 2024 12:30:28 +0200 Subject: [PATCH] add disabled UI for links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When links are disabled, we show something that looks like a link, but it's not clickable and has no 👆 pointer icon. --- .../DefaultInlineMarkdownRenderer.kt | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultInlineMarkdownRenderer.kt b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultInlineMarkdownRenderer.kt index e93af136e..26dfc56e5 100644 --- a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultInlineMarkdownRenderer.kt +++ b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultInlineMarkdownRenderer.kt @@ -63,17 +63,15 @@ public open class DefaultInlineMarkdownRenderer( is InlineMarkdown.Link -> { withStyles(styling.link.withEnabled(enabled), child) { - val destination = it.nativeNode.destination - val link = - LinkAnnotation.Clickable( - tag = destination, - linkInteractionListener = { _ -> - if (enabled) { - onUrlClicked?.invoke(destination) - } - }, - ) - pushLink(link) + if (enabled) { + val destination = it.nativeNode.destination + val link = + LinkAnnotation.Clickable( + tag = destination, + linkInteractionListener = { _ -> onUrlClicked?.invoke(destination) }, + ) + pushLink(link) + } appendInlineMarkdownFrom(it.children, styling, enabled) } }