Skip to content

Commit

Permalink
Load iframe.ly/embed.js for embeds
Browse files Browse the repository at this point in the history
  • Loading branch information
SamyPesse committed Apr 8, 2024
1 parent 4f743c6 commit a6dec33
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/components/DocumentView/Embed.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { DocumentBlockEmbed } from '@gitbook/api';
import Script from 'next/script';


import { Card } from '@/components/primitives';
import { api } from '@/lib/api';
Expand All @@ -15,11 +17,15 @@ export async function Embed(props: BlockProps<DocumentBlockEmbed>) {
return (
<Caption {...props}>
{embed.type === 'rich' ? (
<div
dangerouslySetInnerHTML={{
__html: embed.html,
}}
/>
<>
<div
dangerouslySetInnerHTML={{
__html: embed.html,
}}
/>
{/* We load the iframely script to resize the embed iframes dynamically */}
<Script src="https://cdn.iframe.ly/embed.js" defer async />
</>
) : (
<Card
leadingIcon={
Expand Down

0 comments on commit a6dec33

Please sign in to comment.