Skip to content

TxtViewer Component ​

File Information ​

  • Path: app/components/preview/TxtViewer.vue
  • Purpose: In-app plain-text preview with zoom, fit mode, and find-in-page; supports cross-origin via server proxy
  • Type: Preview component

Overview ​

TxtViewer displays plain-text content from a URL (typically an asset URL). It uses the useTxtViewer composable for loading, zoom, fit-to-page/width, and find-in-page with highlighted matches. Cross-origin URLs are fetched through the server proxy /api/txt/proxy?url=... so credentials and CORS are handled on the server.

Props ​

  • src: string — Text file URL (asset URL or any HTTP(S) URL)

Events ​

  • loaded: {} — Fired when the text is loaded successfully
  • error: { message: string } — Fired when loading fails

Composables ​

  • useTxtViewer — All viewer state and methods (see useTxtViewer)