From b0fd7f5099cee1c2381fbfa75901e8fe63640c46 Mon Sep 17 00:00:00 2001 From: ajasma Date: Tue, 26 Nov 2024 01:50:34 +0530 Subject: [PATCH] editpage: type error fixed --- web/src/components/EditPage/EditPage.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/web/src/components/EditPage/EditPage.tsx b/web/src/components/EditPage/EditPage.tsx index dabbcb6..acc9ab1 100644 --- a/web/src/components/EditPage/EditPage.tsx +++ b/web/src/components/EditPage/EditPage.tsx @@ -154,7 +154,7 @@ export default function EditPage() { }); const [editorContent, setEditorContent] = useState([ - { type: "paragraph", content: "" }, + { type: "paragraph", content: "" } as any, // eslint-disable-line @typescript-eslint/no-explicit-any ]); const generateSlug = (title: string) => { @@ -405,12 +405,14 @@ export default function EditPage() { await editor.tryParseMarkdownToBlocks(fileContent); for (const content of parsedContent) { - if (content.props?.url) { - const url = content.props.url; - if (url.endsWith(".mp4")) { - content.type = "video"; - } else if (url.endsWith(".mp3")) { - content.type = "audio"; + if (content.props) { + if ("url" in content.props) { + const url = content.props.url; + if (url.endsWith(".mp4")) { + content.type = "video"; + } else if (url.endsWith(".mp3")) { + content.type = "audio"; + } } } }