fix: text compose papercuts (#270)
* make fixes * cleanup
This commit was merged in pull request #270.
This commit is contained in:
@@ -14,3 +14,11 @@ export function extractUrls(text: string): string[] {
|
||||
// should only yield a single preview card.
|
||||
return Array.from(new Set(Array.from(text.matchAll(URL_REGEX), (m) => m[0])));
|
||||
}
|
||||
|
||||
export function domainFromUrl(url: string): string {
|
||||
try {
|
||||
return new URL(url).hostname.replace(/^www\./, '');
|
||||
} catch {
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user