yuuvis® RAD Q&A

0 votes
by (1.3k points)

Hi,

since version 7.14, the preview in the client has changed.
Some file types are now shown in another preview. In our use-case this is not optimal, because there are HTML files which are now shown as code and not as preview of the HTML file. Is it somehow possible to switch back the default preview for HTML files to the PDF preview?
I've seen this page but can not figure out how to switch back to the default viewer.

1 Answer

0 votes
by (660 points)

As far as I understand the viewers there's no html viewer anymore.
But you can build an own version:

  1. First go to service-manager\data\webresource\public\client\assets_default\api and add a folder named html-viewer
  2. Create a index.html file with this content: https://pastebin.com/q5Yuf84k
  3. Go to service-manager\data\webresource\public\client\assets_default\config and create a extend.json file if you don't have one yet with the following content:

{

  "preview": {
    "fileSizeLimit": 10485760,
    "viewers": [
      {
        "fileExtension": [
          "js",
          "json"
        ],
        "viewer": "assets/_default/api/monaco/?path=${path}&mimeType=${mimeType}&fileExtension=${fileExtension}&lang=${lang}&theme=${theme}&language=javascript"
      },
      {
        "mimeType": [
          "application/json"
        ],
        "viewer": "assets/_default/api/monaco/?path=${path}&mimeType=${mimeType}&fileExtension=${fileExtension}&lang=${lang}&theme=${theme}&language=javascript"
      },
      {
        "mimeType": [
          "text/plain"
        ],
        "viewer": "assets/_default/api/monaco/?path=${path}&mimeType=${mimeType}&fileExtension=${fileExtension}&lang=${lang}&theme=${theme}"
      },
      {
        "mimeType": [
          "text/xml"
        ],
        "viewer": "assets/_default/api/monaco/?path=${path}&mimeType=${mimeType}&fileExtension=${fileExtension}&lang=${lang}&theme=${theme}&language=xml"
      },
      {
        "mimeType": [
          "text/java"
        ],
        "viewer": "assets/_default/api/monaco/?path=${path}&mimeType=${mimeType}&fileExtension=${fileExtension}&lang=${lang}&theme=${theme}&language=java"
      },
      {
        "mimeType": [
          "text/javascript"
        ],
        "viewer": "assets/_default/api/monaco/?path=${path}&mimeType=${mimeType}&fileExtension=${fileExtension}&lang=${lang}&theme=${theme}&language=javascript"
      },
      {
        "mimeType": [
          "text/html"
        ],
        "viewer": "assets/_default/api/html-viewer/?path=${path}"
      },
      {
        "mimeType": [
          "text/markdown",
          "text/x-web-markdown",
          "text/x-markdown"
        ],
        "viewer": "assets/_default/api/monaco/?path=${path}&mimeType=${mimeType}&fileExtension=${fileExtension}&lang=${lang}&theme=${theme}&language=markdown"
      },
      {
        "mimeType": [
          "audio/mp3",
          "audio/webm",
          "audio/ogg",
          "audio/mpeg",
          "video/mp4",
          "video/webm",
          "video/ogg",
          "application/ogg"
        ],
        "viewer": "assets/_default/api/video/?path=${path}&mimeType=${mimeType}&fileExtension=${fileExtension}&lang=${lang}&theme=${theme}"
      },
      {
        "mimeType": [
          "image/jpeg",
          "image/png",
          "image/apng",
          "image/gif",
          "image/svg+xml",
          "image/webp"
        ],
        "viewer": "assets/_default/api/img/?path=${path}&mimeType=${mimeType}&fileExtension=${fileExtension}&lang=${lang}&theme=${theme}"
      },
      {
        "viewer": "() => parameters.defaultViewer + '#'"
      },
      {
        "error": true,
        "viewer": "assets/_default/api/error/?path=${path}&mimeType=${mimeType}&fileExtension=${fileExtension}&lang=${lang}&theme=${theme}"
      }
    ]
  }
}

I'm not able to test it right now but I think this should do the job.

Related questions

0 votes
1 answer
asked Jun 12, 2020 by Mathias Keller (1.3k points)
0 votes
1 answer
asked Jun 21, 2021 by Mathias Keller (1.3k points)
...