Add an option to turn off the display of "File content preview" or can set not to display content in a certain format

新增一个可以关闭"File content preview"显示的选项,因为有些大文件,软件会强制去显示他的内容,会导致软件直接卡死。

You should just remove the extension of the file type you do not want to be previewed from the settings, as shown in the following screenshot:

Deleting pdf (or any other type) in the Settings > File Types panel only lasts until the next launch. That’s probably because the app scans the viewer plug-ins and re-adds any extensions they support, so the pdf entry (and the content preview) reappear immediately.

After spending hours wrestling with extconfig.js with no success, I tried a simpler fix: patch the pdf-viewer extension itself.

If you want to view the Details + Description of a file without the pdf preview (in the right panel), here’s what worked for me:

By the way, I have no experience with HTML. I used GPT o3 to generate a patch for the existing index.html file.


How to disable TagSpaces’ built-in pdf content preview (macOS 15.1, Tagspaces pro 6.4.9)

  1. Quit Tagspaces completely.

  2. Install Homebrew (skip if you already have it).

  3. In Terminal, run:

    brew install node      # gives you npm
    npm install -g asar    # CLI (~30 kB) for unpacking Electron archives
    
  4. Go to the folder /Applications/TagSpaces.app/Contents/Resources, you’ll find the file app.asar. Unpack it so that Electron loads files from app/ instead of the packed archive:

    cd /Applications/TagSpaces.app/Contents/Resources
    asar extract app.asar app   # creates an “app” folder next to app.asar
    

    This generates an app/ subfolder and some other files within Resources.

  5. Navigate to the pdf-viewer’s index.html file. I found it in the following location.

    /Applications/TagSpaces.app/Contents/Resources/app/node_modules/@tagspaces/extensions/pdf-viewer/index.html
    
  6. Backup index.html so you can revert the changes later.

  7. Open index.html in TextEdit. The file content starts like this:

    <!DOCTYPE html>
    <html style="margin: 0; padding: 0; height: 100%">
      <head>
        <meta charset="utf-8" />
        <meta
          name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1"
        />
        <script src="../common/common.js"></script>
        <link rel="stylesheet" href="../libs/bootstrap5/bootstrap.min.css" />
        <link rel="stylesheet" href="../common/common.css" />
      ...
    
  8. Within index.html, between the 3rd and 4th lines ( after <head> and before <meta charset="utf-8" /> ), paste the following block:

    <!-- ── Disable embedded PDF previews ───────────────────────── -->
    <script>
      /* Set MB_LIMIT to 0 to block every PDF,
         or to a size (in MB) above which previews are disabled. */
      (() => {
        const MB_LIMIT = 0;  // 0 ⇒ always disable
        try {
          const qs   = new URLSearchParams(location.search);
          const file = decodeURIComponent(qs.get('file') || '');
          if (MB_LIMIT === 0) {
            document.addEventListener('DOMContentLoaded', () => {
              document.body.innerHTML =
                '<div style="font:14px/1.4 -apple-system;padding:2rem">' +
                'Preview disabled. Use “Open externally” if you need to view.' +
                '</div>';
            });
            window.stop();   // abort loading pdf.js and the rest of the page
          }
        } catch (e) {
          /* If anything fails, fall back to the normal viewer */
        }
      })();
    </script>
    <!-- ─────────────────────────────────────────────────────────── -->
    
  9. This will impose a limit on the size of the pdf file before loading it for preview. You may set MB_LIMIT to a positive number if you’d like to preview small pdfs but skip large ones.

  10. Save the changes to index.html.

  11. Restart Tagspaces and click on a pdf. The preview pane in the right panel should now appear blank. It will show only Details + Description for the file.

Hope this saves someone else from a five-hour rabbit hole!