feat: add Shiki syntax highlighting, video, and audio previews in FileNav
- Add Shiki-powered syntax highlighting for code files with dual light/dark themes (github-light/github-dark), line numbers, and source/preview toggle - Add native <video> player for mp4, webm, mov, ogv, avi, mkv - Add native <audio> player for mp3, wav, ogg, flac, m4a, aac, opus - New utility: src/lib/utils/codeHighlight.ts with extension-to-lang mapping using Shiki's bundled language registry
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
export let selectedFile: string | null = null;
|
||||
export let fileLoading = false;
|
||||
export let fileImageUrl: string | null = null;
|
||||
export let fileVideoUrl: string | null = null;
|
||||
export let fileAudioUrl: string | null = null;
|
||||
export let filePdfData: ArrayBuffer | null = null;
|
||||
export let fileContent: string | null = null;
|
||||
|
||||
@@ -197,6 +199,27 @@
|
||||
draggable="false"
|
||||
/>
|
||||
</div>
|
||||
{:else if fileVideoUrl !== null}
|
||||
<div class="w-full h-full flex items-center justify-center bg-black">
|
||||
<!-- svelte-ignore a11y-media-has-caption -->
|
||||
<video
|
||||
src={fileVideoUrl}
|
||||
controls
|
||||
class="max-w-full max-h-full"
|
||||
>
|
||||
{$i18n.t('Your browser does not support the video tag.')}
|
||||
</video>
|
||||
</div>
|
||||
{:else if fileAudioUrl !== null}
|
||||
<div class="w-full h-full flex items-center justify-center p-6">
|
||||
<audio
|
||||
src={fileAudioUrl}
|
||||
controls
|
||||
class="w-full max-w-md"
|
||||
>
|
||||
{$i18n.t('Your browser does not support the audio tag.')}
|
||||
</audio>
|
||||
</div>
|
||||
{:else if filePdfData !== null}
|
||||
<PDFViewer bind:this={pdfViewerRef} data={filePdfData} className="w-full h-full" />
|
||||
{:else if fileOfficeHtml !== null}
|
||||
|
||||
Reference in New Issue
Block a user