Replace links with HTML <a> tags when messages have a formatted_body and in all other cases

This makes (https) links show up as actual links when they're in a message with a `formatted_body`. For example, the pursuivant messages in any KDE channel (like #kirigami), or links which are in a reply to another message/image.

Also corrected a regex mistake in another place using the same link replacement regex.

Fix #331
This commit is contained in:
Bharadwaj Raju
2022-10-04 09:38:29 +00:00
parent f6609f55f8
commit cd7232e7bf
2 changed files with 19 additions and 2 deletions

View File

@@ -194,7 +194,7 @@ Kirigami.OverlayDrawer {
TextEdit {
Layout.fillWidth: true
text: room && room.topic ? room.topic.replace(replaceLinks, "<a href=\"$1\">$1</a>") : i18n("No Topic")
readonly property var replaceLinks: /\(https:\/\/[^ ]*\)/
readonly property var replaceLinks: /(https:\/\/[^ ]*)/
textFormat: TextEdit.MarkdownText
wrapMode: Text.WordWrap
selectByMouse: true