Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

1.1 KB
Raw Blame
'use client'

import { noop } from 'es-toolkit/function'
import {
  PdfHighlighter,
  PdfLoader,
} from '@/app/components/base/file-uploader/pdf-highlighter-adapter'
import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { basePath } from '@/utils/var'

export function SkillPdfPreview({ fileName, url }: { fileName: string; url: string }) {
  return (
    <div className="relative h-full overflow-hidden bg-background-default">
      <span className="sr-only">{fileName}</span>
      <PdfLoader
        workerSrc={`${basePath}/pdf.worker.min.mjs`}
        url={url}
        beforeLoad={<LoadingPlaceholder className="h-full" />}
      >
        {(pdfDocument) => (
          <PdfHighlighter
            pdfDocument={pdfDocument}
            pdfScaleValue="page-width"
            enableAreaSelection={() => false}
            scrollRef={noop}
            onScrollChange={noop}
            onSelectionFinished={() => null}
            highlightTransform={() => <div />}
            highlights={[]}
          />
        )}
      </PdfLoader>
    </div>
  )
}