mirror of
https://github.com/langgenius/dify.git
synced 2026-04-28 06:28:05 +08:00
Implement ReadOnlyFilePreview to render sandbox files by type (code, markdown, image, video, SQLite, unsupported) using existing skill viewer components with readOnly support. Add useSandboxFileDownloadUrl and useFetchTextContent hooks for data fetching, and generalize useFileTypeInfo to accept any file-like object.
23 lines
426 B
TypeScript
23 lines
426 B
TypeScript
'use client'
|
|
|
|
import * as React from 'react'
|
|
import MarkdownFileEditor from '../editor/markdown-file-editor'
|
|
|
|
type ReadOnlyMarkdownPreviewProps = {
|
|
value: string
|
|
}
|
|
|
|
const noop = () => {}
|
|
|
|
const ReadOnlyMarkdownPreview = ({ value }: ReadOnlyMarkdownPreviewProps) => {
|
|
return (
|
|
<MarkdownFileEditor
|
|
value={value}
|
|
onChange={noop}
|
|
readOnly
|
|
/>
|
|
)
|
|
}
|
|
|
|
export default React.memo(ReadOnlyMarkdownPreview)
|