forked from Kieran/snort
bug: embeds in about section
This commit is contained in:
parent
dc27f4061d
commit
5d23419220
@ -25,9 +25,10 @@ export interface TextProps {
|
|||||||
content: string;
|
content: string;
|
||||||
creator: HexKey;
|
creator: HexKey;
|
||||||
tags: Array<Array<string>>;
|
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();
|
const location = useLocation();
|
||||||
|
|
||||||
function extractLinks(fragments: Fragment[]) {
|
function extractLinks(fragments: Fragment[]) {
|
||||||
@ -36,6 +37,13 @@ export default function Text({ content, tags, creator }: TextProps) {
|
|||||||
if (typeof f === "string") {
|
if (typeof f === "string") {
|
||||||
return splitByUrl(f).map(a => {
|
return splitByUrl(f).map(a => {
|
||||||
if (a.match(/^(?:https?|(?:web\+)?nostr):/i)) {
|
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 <HyperText key={a} link={a} creator={creator} />;
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
|
@ -107,6 +107,7 @@ export default function ProfilePage() {
|
|||||||
content: aboutText,
|
content: aboutText,
|
||||||
tags: [],
|
tags: [],
|
||||||
creator: "",
|
creator: "",
|
||||||
|
disableMedia: true,
|
||||||
});
|
});
|
||||||
const npub = !id?.startsWith(NostrPrefix.PublicKey) ? hexToBech32(NostrPrefix.PublicKey, id || undefined) : id;
|
const npub = !id?.startsWith(NostrPrefix.PublicKey) ? hexToBech32(NostrPrefix.PublicKey, id || undefined) : id;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user