diff --git a/package.json b/package.json index c374d11..79c1206 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "copilot-node-sdk": "^3.12.1", "handlebars": "^4.7.8", "http-status": "^1.7.4", + "link-to-iframe": "^1.0.8", "next": "latest", "p-retry": "^6.2.1", "prisma": "^5.6.0", diff --git a/src/components/tiptap/iframe/EmbedComponent.tsx b/src/components/tiptap/iframe/EmbedComponent.tsx index b2af5c1..2ca10f5 100644 --- a/src/components/tiptap/iframe/EmbedComponent.tsx +++ b/src/components/tiptap/iframe/EmbedComponent.tsx @@ -4,6 +4,7 @@ import { Resize } from '../image/resizeIcon' import { useAppState } from '@/hooks/useAppState' import { usePathname } from 'next/navigation' import { debounce } from '@mui/material' +import { IframeAttributes, linkToIframe } from 'link-to-iframe' export const EmbedComponent = (props: any) => { const [isResizing, setIsResizing] = useState(false) @@ -52,6 +53,9 @@ export const EmbedComponent = (props: any) => { const appState = useAppState() const pathname = usePathname() + const video = linkToIframe(extractIframeSrc(props.node.attrs.src), { + returnObject: true, + }) as IframeAttributes //safe to do. returnObject: true always returns an IframeAttributes object. return ( @@ -63,13 +67,14 @@ export const EmbedComponent = (props: any) => { }} >