wwf
2 天以前 a430284aa21e3ae1f0d5654e55b2ad2852519cc2
app/components/base/file-uploader/pdf-preview.tsx
@@ -9,7 +9,6 @@
import Loading from '@/app/components/base/loading'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
import Tooltip from '@/app/components/base/tooltip'
import { noop } from 'lodash-es'
type PdfPreviewProps = {
  url: string
@@ -48,26 +47,26 @@
  return createPortal(
    <div
      className={`fixed inset-0 z-[1000] flex items-center justify-center bg-black/80 ${!isMobile && 'p-8'}`}
      className={`fixed inset-0 flex items-center justify-center bg-black/80 z-[1000] ${!isMobile && 'p-8'}`}
      onClick={e => e.stopPropagation()}
      tabIndex={-1}
    >
      <div
        className='h-[95vh] max-h-full w-[100vw] max-w-full overflow-hidden'
        className='h-[95vh] w-[100vw] max-w-full max-h-full overflow-hidden'
        style={{ transform: `scale(${scale})`, transformOrigin: 'center', scrollbarWidth: 'none', msOverflowStyle: 'none' }}
      >
        <PdfLoader
          workerSrc='/pdf.worker.min.mjs'
          url={url}
          beforeLoad={<div className='flex h-64 items-center justify-center'><Loading type='app' /></div>}
          beforeLoad={<div className='flex justify-center items-center h-64'><Loading type='app' /></div>}
        >
          {(pdfDocument) => {
            return (
              <PdfHighlighter
                pdfDocument={pdfDocument}
                enableAreaSelection={event => event.altKey}
                scrollRef={noop}
                onScrollChange={noop}
                scrollRef={() => { }}
                onScrollChange={() => { }}
                onSelectionFinished={() => null}
                highlightTransform={() => { return <div/> }}
                highlights={[]}
@@ -77,22 +76,22 @@
        </PdfLoader>
      </div>
      <Tooltip popupContent={t('common.operation.zoomOut')}>
        <div className='absolute right-24 top-6 flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg'
        <div className='absolute top-6 right-24 flex items-center justify-center w-8 h-8 rounded-lg cursor-pointer'
          onClick={zoomOut}>
          <RiZoomOutLine className='h-4 w-4 text-gray-500'/>
          <RiZoomOutLine className='w-4 h-4 text-gray-500'/>
        </div>
      </Tooltip>
      <Tooltip popupContent={t('common.operation.zoomIn')}>
        <div className='absolute right-16 top-6 flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg'
        <div className='absolute top-6 right-16 flex items-center justify-center w-8 h-8 rounded-lg cursor-pointer'
          onClick={zoomIn}>
          <RiZoomInLine className='h-4 w-4 text-gray-500'/>
          <RiZoomInLine className='w-4 h-4 text-gray-500'/>
        </div>
      </Tooltip>
      <Tooltip popupContent={t('common.operation.cancel')}>
        <div
          className='absolute right-6 top-6 flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg bg-white/8 backdrop-blur-[2px]'
          className='absolute top-6 right-6 flex items-center justify-center w-8 h-8 bg-white/8 rounded-lg backdrop-blur-[2px] cursor-pointer'
          onClick={onCancel}>
          <RiCloseLine className='h-4 w-4 text-gray-500'/>
          <RiCloseLine className='w-4 h-4 text-gray-500'/>
        </div>
      </Tooltip>
    </div>,