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:
Dean Sheather
2024-04-09 00:49:15 +10:00
parent fed420901c
commit 4701bb3f6d
10 changed files with 295 additions and 4 deletions
+54
View File
@@ -1040,6 +1040,24 @@ namespace ChatTwo.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Copy link to clipboard.
/// </summary>
internal static string Context_CopyLink {
get {
return ResourceManager.GetString("Context_CopyLink", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Copied link to clipboard.
/// </summary>
internal static string Context_CopyLinkNotification {
get {
return ResourceManager.GetString("Context_CopyLinkNotification", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Hide chat.
/// </summary>
@@ -1121,6 +1139,24 @@ namespace ChatTwo.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Open link in browser.
/// </summary>
internal static string Context_OpenInBrowser {
get {
return ResourceManager.GetString("Context_OpenInBrowser", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Failed to open the link in the browser, please report this issue.
/// </summary>
internal static string Context_OpenInBrowserError {
get {
return ResourceManager.GetString("Context_OpenInBrowserError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Promote.
/// </summary>
@@ -1202,6 +1238,24 @@ namespace ChatTwo.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to URL at {0}.
/// </summary>
internal static string Context_URLDomain {
get {
return ResourceManager.GetString("Context_URLDomain", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Only open URLs from websites you trust.
/// </summary>
internal static string Context_URLWarning {
get {
return ResourceManager.GetString("Context_URLWarning", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Chinese (full).
/// </summary>