Preview settings

Noah HsuSeptember 7, 2022
  • Config
  • Config
  • Settings
About 1 min

Preview settings

Text types

The extensions of the files you want to preview as text, split by ,, such as txt,md,go,tsx.

Audio types

The extensions of the files you want to preview as audio, split by ,, such as mp3,wav,m4a.

Video types

The extensions of the files you want to preview as video, split by ,, such as mp4,webm,ogg.

Image types

The extensions of the files you want to preview as image, split by ,, such as jpg,jpeg,png,gif,webp.

Proxy types

The extensions of the files you want to separately set to download through proxy

External previews

A json object that contains the external preview settings, It is defined as

interface {
  [extensions: string]: {
    [name: string]: string //(url)
  }
}

the first key extensions is the file extensions that split by ,(if it's startsWith /, it will be considered a regular expression), and the value is also a key-value object, the key is the preview name, and the value is the external url.

For the external url, we provide some variables for you to use:

  • $url: the file url
  • $name: the file name
  • $e_url: encodeURIComponent($url)
  • $b_url: btoa($url)
  • $eb_url: encodeURIComponent(btoa($url))

Finally, the External previews will displayed a Open with menu while current file matched the extensions.

For example, set External previews to

{
  "txt": {
    "Notepad": "notepad://$url"
  },
  "/.*/": {
    "VSCode": "vscode://$url"
  }
}

when we enter a file with the extension txt, it will show:

Open-with

Iframe previews

Similar to External previews, but it will embed an iframe in current page directly.

Tips

If you want to use self-deployed onlyoffice to preview office files, you can add the configuration like this here:

{
  "doc,docx,xls,xlsx,ppt,pptx": {
    "OnlyOffice": "you_only_office_url"
  }
}

Audio cover

The default audio cover.

Audio autoplay

Whether to automatically play audio files.

Video autoplay

Whether to automatically play video files.

Loading...