bug: embeds in about section

This commit is contained in:
Kieran 2023-04-04 19:25:11 +01:00
parent dc27f4061d
commit 5d23419220
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
2 changed files with 10 additions and 1 deletions

View File

@ -25,9 +25,10 @@ export interface TextProps {
content: string;
creator: HexKey;
tags: Array<Array<string>>;
disableMedia?: boolean;
}
export default function Text({ content, tags, creator }: TextProps) {
export default function Text({ content, tags, creator, disableMedia }: TextProps) {
const location = useLocation();
function extractLinks(fragments: Fragment[]) {
@ -36,6 +37,13 @@ export default function Text({ content, tags, creator }: TextProps) {
if (typeof f === "string") {
return splitByUrl(f).map(a => {
if (a.match(/^(?:https?|(?:web\+)?nostr):/i)) {
if (disableMedia ?? false) {
return (
<a href={a} onClick={e => e.stopPropagation()} target="_blank" rel="noreferrer" className="ext">
{a}
</a>
);
}
return <HyperText key={a} link={a} creator={creator} />;
}
return a;

View File

@ -107,6 +107,7 @@ export default function ProfilePage() {
content: aboutText,
tags: [],
creator: "",
disableMedia: true,
});
const npub = !id?.startsWith(NostrPrefix.PublicKey) ? hexToBech32(NostrPrefix.PublicKey, id || undefined) : id;