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 @@
<div class="flex gap-2"> <div class="flex gap-2">
<dt class="font-semibold min-w-[120px]">Website:</dt> <dt class="font-semibold min-w-[120px]">Website:</dt>
<dd> <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> </dd>
</div> </div>
{/if} {/if}

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

@ -66,7 +66,7 @@ function shortenNpub(long: string|undefined) {
<CopyToClipboard displayText={shortenNpub(npub)} copyText={npub} /> <CopyToClipboard displayText={shortenNpub(npub)} copyText={npub} />
</li> </li>
<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> <UserOutline class='mr-1 !h-6 !w-6 inline !fill-none dark:!fill-none' /><span class='underline'>View profile</span>
</a> </a>
</li> </li>

8
src/lib/utils/nostrUtils.ts

@ -111,7 +111,7 @@ export function createProfileLink(identifier: string, displayText: string | unde
const defaultText = `${cleanId.slice(0, 8)}...${cleanId.slice(-4)}`; const defaultText = `${cleanId.slice(0, 8)}...${cleanId.slice(-4)}`;
const escapedText = escapeHtml(displayText || defaultText); 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
const type = nip05.endsWith('edu') ? 'edu' : 'standard'; const type = nip05.endsWith('edu') ? 'edu' : 'standard';
switch (type) { switch (type) {
case 'edu': 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': 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 {
const escapedId = escapeHtml(cleanId); const escapedId = escapeHtml(cleanId);
const escapedText = escapeHtml(shortId); 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