feat: clickable URLs in chat log
Adds a parsing step when constructing `Message` objects that scans the message content for anything that looks URL-like, and inserts new `TextChunk`s into the message content with a URIPayload set. Hovering over a URL shows an on-hover effect. Clicking a URL opens it in the default browser. Right clicking shows the hostname, with an option to open and an option to copy the URL to the clipboard.
This commit is contained in:
@@ -59,6 +59,19 @@ internal class TextChunk : Chunk {
|
||||
public TextChunk() : base(ChunkSource.None, null) {
|
||||
}
|
||||
#pragma warning restore CS8618
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new TextChunk with identical styling to this one.
|
||||
/// </summary>
|
||||
public TextChunk NewWithStyle(ChunkSource source, Payload? link, string content)
|
||||
{
|
||||
return new TextChunk(source, link, content) {
|
||||
FallbackColour = this.FallbackColour,
|
||||
Foreground = this.Foreground,
|
||||
Glow = this.Glow,
|
||||
Italic = this.Italic,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
internal class IconChunk : Chunk {
|
||||
|
||||
Reference in New Issue
Block a user