Skip to content

Commit

Permalink
editpage: type error fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ajasma committed Nov 25, 2024
1 parent 1a61d63 commit b0fd7f5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions web/src/components/EditPage/EditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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";
}
}
}
}
Expand Down

0 comments on commit b0fd7f5

Please sign in to comment.