mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-24 14:39:30 +00:00
* feat(webui): add space key quick preview for files and folders Allow users in file list views to press the Space key to quick preview the most recently selected item. - Add FilePreviewDialog supporting both folder previews (icon, name, count) and real file previews (reusing FileViewer with viewer area and control bar). - Constrain dialog to max 1920x1080 or 70vw/70vh. - Support dismissing via close button, clicking outside, or pressing Space again (intercepted in capture phase). - Enable across project file lists, share links, and public share views. * feat(webui): auto play video in quick preview dialog - Pass autoPlay prop from FilePreviewDialog through FileViewer to VideoViewer - Configure videojs with autoplay: 'any' and handle policy rejection with muted autoplay fallback - Add test coverage for autoPlay prop forwarding in FilePreviewDialog * fix(webui): resolve video quick preview initialization and autoplay pause bugs * fix(webui): support folder symlinks and password-protected shares in quick preview
43 lines
959 B
TypeScript
43 lines
959 B
TypeScript
import { getViewerForFile } from './viewers/registry'
|
|
import type { FileViewerProps, MediaController } from './viewers/types'
|
|
import React, { RefObject } from 'react'
|
|
|
|
interface OuterFileViewerProps extends FileViewerProps {
|
|
mediaControllerRef?: RefObject<MediaController | null>
|
|
}
|
|
|
|
export function FileViewer({
|
|
file,
|
|
mediaControllerRef,
|
|
onPlay,
|
|
onPause,
|
|
onTimeUpdate,
|
|
annotations,
|
|
startTime,
|
|
shareId,
|
|
allowDownload,
|
|
autoPlay,
|
|
children,
|
|
}: OuterFileViewerProps) {
|
|
const viewerDef = getViewerForFile(file)
|
|
const ViewerComponent = viewerDef.viewer
|
|
|
|
return (
|
|
<ViewerComponent
|
|
key={viewerDef.id}
|
|
ref={mediaControllerRef}
|
|
file={file}
|
|
onPlay={onPlay}
|
|
onPause={onPause}
|
|
onTimeUpdate={onTimeUpdate}
|
|
annotations={annotations}
|
|
startTime={startTime}
|
|
shareId={shareId}
|
|
allowDownload={allowDownload}
|
|
autoPlay={autoPlay}
|
|
>
|
|
{children}
|
|
</ViewerComponent>
|
|
)
|
|
}
|