Browse Source

fixed internal links opening in a new browser tab

master
Silberengel 8 months ago
parent
commit
03753a577b
  1. 2
      src/lib/components/cards/ProfileHeader.svelte
  2. 2
      src/lib/components/util/Profile.svelte
  3. 8
      src/lib/utils/nostrUtils.ts

2
src/lib/components/cards/ProfileHeader.svelte

@ -68,7 +68,7 @@ @@ -68,7 +68,7 @@
<div class="flex gap-2">
<dt class="font-semibold min-w-[120px]">Website:</dt>
<dd>
<a href={profile.website} target="_blank" class="underline text-primary-700 dark:text-primary-200">{profile.website}</a>
<a href={profile.website} class="underline text-primary-700 dark:text-primary-200">{profile.website}</a>
</dd>
</div>
{/if}

2
src/lib/components/util/Profile.svelte

@ -66,7 +66,7 @@ function shortenNpub(long: string|undefined) { @@ -66,7 +66,7 @@ function shortenNpub(long: string|undefined) {
<CopyToClipboard displayText={shortenNpub(npub)} copyText={npub} />
</li>
<li>
<a class='hover:text-primary-400 dark:hover:text-primary-500 text-nowrap mt-3 m-0' href='{externalProfileDestination}{npub}' target='_blank'>
<a class='hover:text-primary-400 dark:hover:text-primary-500 text-nowrap mt-3 m-0' href='{externalProfileDestination}{npub}'>
<UserOutline class='mr-1 !h-6 !w-6 inline !fill-none dark:!fill-none' /><span class='underline'>View profile</span>
</a>
</li>

8
src/lib/utils/nostrUtils.ts

@ -111,7 +111,7 @@ export function createProfileLink(identifier: string, displayText: string | unde @@ -111,7 +111,7 @@ export function createProfileLink(identifier: string, displayText: string | unde
const defaultText = `${cleanId.slice(0, 8)}...${cleanId.slice(-4)}`;
const escapedText = escapeHtml(displayText || defaultText);
return `<a href="./events?id=${escapedId}" class="npub-badge" target="_blank">@${escapedText}</a>`;
return `<a href="./events?id=${escapedId}" class="npub-badge">@${escapedText}</a>`;
}
/**
@ -167,9 +167,9 @@ export async function createProfileLinkWithVerification(identifier: string, disp @@ -167,9 +167,9 @@ export async function createProfileLinkWithVerification(identifier: string, disp
const type = nip05.endsWith('edu') ? 'edu' : 'standard';
switch (type) {
case 'edu':
return `<span class="npub-badge"><a href="./events?id=${escapedId}" target="_blank">@${displayIdentifier}</a>${graduationCapSvg}</span>`;
return `<span class="npub-badge"><a href="./events?id=${escapedId}">@${displayIdentifier}</a>${graduationCapSvg}</span>`;
case 'standard':
return `<span class="npub-badge"><a href="./events?id=${escapedId}" target="_blank">@${displayIdentifier}</a>${badgeCheckSvg}</span>`;
return `<span class="npub-badge"><a href="./events?id=${escapedId}">@${displayIdentifier}</a>${badgeCheckSvg}</span>`;
}
}
/**
@ -181,7 +181,7 @@ function createNoteLink(identifier: string): string { @@ -181,7 +181,7 @@ function createNoteLink(identifier: string): string {
const escapedId = escapeHtml(cleanId);
const escapedText = escapeHtml(shortId);
return `<a href="./events?id=${escapedId}" class="inline-flex items-center text-primary-600 dark:text-primary-500 hover:underline break-all" target="_blank">${escapedText}</a>`;
return `<a href="./events?id=${escapedId}" class="inline-flex items-center text-primary-600 dark:text-primary-500 hover:underline break-all">${escapedText}</a>`;
}
/**

Loading…
Cancel
Save