diff --git a/frontend/src/routes/_oh.app._index/code-editor-component.tsx b/frontend/src/routes/_oh.app._index/code-editor-component.tsx index 8182805193a0..4cc26ad213a2 100644 --- a/frontend/src/routes/_oh.app._index/code-editor-component.tsx +++ b/frontend/src/routes/_oh.app._index/code-editor-component.tsx @@ -29,6 +29,10 @@ function CodeEditorCompoonent({ if (selectedPath && value) modifyFileContent(selectedPath, value); }; + const isBase64Image = (content: string) => content.startsWith("data:image/"); + const isPDF = (content: string) => content.startsWith("data:application/pdf"); + const isVideo = (content: string) => content.startsWith("data:video/"); + React.useEffect(() => { const handleSave = async (event: KeyboardEvent) => { if (selectedPath && event.metaKey && event.key === "s") { @@ -62,16 +66,40 @@ function CodeEditorCompoonent({ ); } + const fileContent = modifiedFiles[selectedPath] || files[selectedPath]; + + if (isBase64Image(fileContent)) { + return ( +
+ {selectedPath} +
+ ); + } + + if (isPDF(fileContent)) { + return ( +