mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 21:41:52 +08:00
fix(editor): improve affine-link toolbar (#11159)
Closes: [BS-2884](https://linear.app/affine-design/issue/BS-2884/[ui]-hover-邮箱的-toolbar)
This commit is contained in:
@@ -148,10 +148,11 @@ export function isUrlInClipboard(clipboardData: DataTransfer) {
|
||||
return isValidUrl(url);
|
||||
}
|
||||
|
||||
export function getHostName(url: string) {
|
||||
export function getHostName(link: string) {
|
||||
try {
|
||||
return new URL(url).hostname;
|
||||
const url = new URL(link);
|
||||
return url.hostname || url.pathname;
|
||||
} catch {
|
||||
return url;
|
||||
return link;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user