From 9f54400f18a1939a1533717ebb675414d7d5ae0f Mon Sep 17 00:00:00 2001 From: Jeff Emmett <46964190+Jeff-Emmett@users.noreply.github.com> Date: Mon, 9 Dec 2024 20:19:35 -0500 Subject: [PATCH] updated medium embeds to link out to new tab --- src/shapes/EmbedShapeUtil.tsx | 38 +++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/shapes/EmbedShapeUtil.tsx b/src/shapes/EmbedShapeUtil.tsx index 325dedd..90ce022 100644 --- a/src/shapes/EmbedShapeUtil.tsx +++ b/src/shapes/EmbedShapeUtil.tsx @@ -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 { ) } + if (shape.props.url?.includes("medium.com")) { + return ( +
+
+

+ Medium's content policy does not allow for embedding articles in + iframes. +

+ + Open article in new tab → + +
+
+ ) + } + return (