Skip to content

Commit

Permalink
Merge pull request #3253 from hakimLyon/hakimLyon-patch-1
Browse files Browse the repository at this point in the history
Fix: useMediaState
  • Loading branch information
felixfeng33 authored Jun 9, 2024
2 parents 0eeecf6 + 88dea35 commit 60ea69f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/weak-games-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@udecode/plate-media": patch
---

Fix: useMediaState
5 changes: 2 additions & 3 deletions packages/media/src/media/useMediaState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 60ea69f

Please sign in to comment.