updated medium embeds to link out to new tab

This commit is contained in:
Jeff Emmett 2024-12-09 20:19:35 -05:00
parent 7a1093b12a
commit 647d89a70c
1 changed files with 36 additions and 2 deletions

View File

@ -61,9 +61,9 @@ const transformUrl = (url: string): string => {
return `https://platform.x.com/embed/Tweet.html?id=${tweetMatch[1]}`
}
// Medium
// Medium - return about:blank to prevent iframe loading
if (url.includes("medium.com")) {
return url.replace(/\/?$/, "?format=lite")
return "about:blank"
}
// Gather.town
@ -180,6 +180,40 @@ export class EmbedShape extends BaseBoxShapeUtil<IEmbedShape> {
)
}
if (shape.props.url?.includes("medium.com")) {
return (
<div style={wrapperStyle}>
<div
style={{
...contentStyle,
flexDirection: "column",
gap: "12px",
padding: "20px",
textAlign: "center",
pointerEvents: "all",
}}
>
<p>
Medium's content policy does not allow for embedding articles in
iframes.
</p>
<a
href={shape.props.url}
target="_blank"
rel="noopener noreferrer"
style={{
color: "#1976d2",
textDecoration: "none",
cursor: "pointer",
}}
>
Open article in new tab
</a>
</div>
</div>
)
}
return (
<div style={wrapperStyle}>
<div style={contentStyle}>