diff --git a/.changeset/weak-games-relax.md b/.changeset/weak-games-relax.md new file mode 100644 index 0000000000..9a8d651fcf --- /dev/null +++ b/.changeset/weak-games-relax.md @@ -0,0 +1,5 @@ +--- +"@udecode/plate-media": patch +--- + +Fix: useMediaState diff --git a/packages/media/src/media/useMediaState.ts b/packages/media/src/media/useMediaState.ts index aecf6a7324..7c845c9097 100644 --- a/packages/media/src/media/useMediaState.ts +++ b/packages/media/src/media/useMediaState.ts @@ -4,9 +4,8 @@ import { useElement } from '@udecode/plate-common'; import { useFocused, useReadOnly, useSelected } from 'slate-react'; import type { TMediaElement } from './types'; - -import { VIDEO_PROVIDERS } from '../media-embed'; import { ELEMENT_VIDEO } from '../video'; +import { VIDEO_PROVIDERS, ELEMENT_MEDIA_EMBED} from '../media-embed'; export type EmbedUrlData = { id?: string; @@ -29,7 +28,7 @@ export const useMediaState = ({ const { align = 'left', id, isUpload, name, type, url } = element; const embed = React.useMemo(() => { - if (!urlParsers || type !== ELEMENT_VIDEO) return; + if (!urlParsers || (type !== ELEMENT_VIDEO && type !== ELEMENT_MEDIA_EMBED)) return; for (const parser of urlParsers) { const data = parser(url);