always show link, but hide iframe when necessary
This commit is contained in:
parent
2f02c0ec14
commit
c91dc34c0d
@ -1,4 +1,4 @@
|
||||
import { useCallback, useState } from "react";
|
||||
import { useCallback, useState, Children } from "react";
|
||||
import { useSelector } from "react-redux";
|
||||
import { TwitterTweetEmbed } from "react-twitter-embed";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
@ -137,14 +137,12 @@ export default function HyperText({ link, creator }: { link: string; creator: He
|
||||
} else if (isAppleMusicLink) {
|
||||
return <AppleMusicEmbed link={a} />;
|
||||
} else if (isNostrNestsLink) {
|
||||
return (
|
||||
<>
|
||||
return [
|
||||
<a href={a} onClick={e => e.stopPropagation()} target="_blank" rel="noreferrer" className="ext">
|
||||
{a}
|
||||
</a>
|
||||
<NostrNestsEmbed link={a} />
|
||||
</>
|
||||
);
|
||||
</a>,
|
||||
<NostrNestsEmbed link={a} />,
|
||||
];
|
||||
} else {
|
||||
return (
|
||||
<a href={a} onClick={e => e.stopPropagation()} target="_blank" rel="noreferrer" className="ext">
|
||||
@ -162,9 +160,6 @@ export default function HyperText({ link, creator }: { link: string; creator: He
|
||||
);
|
||||
}, [link, reveal]);
|
||||
|
||||
const elm = render();
|
||||
if (elm.type !== "a") {
|
||||
return wrapReveal(elm, link);
|
||||
}
|
||||
return elm;
|
||||
const children = render();
|
||||
return <>{Children.map(children, elm => (elm.type === "a" ? elm : wrapReveal(elm, link)))}</>;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user