Skip to content

v4.3.0

Latest

Choose a tag to compare

@alekswebnet alekswebnet released this 19 Oct 14:33

Features

  • Individual runtime file URLs. New pdfjs-lib-src, viewer-src, viewer-css-src and theme-css-src attributes set the URL of each viewer runtime file on its own, alongside the existing worker-src. They work with or without assets-base and are made for static asset pipelines that emit content-hashed file names, such as Django's ManifestStaticFilesStorage. See the new demo/asset-attributes.html. (#57, thanks @nvi9)

Fixes

  • viewer-css-theme="LIGHT" now stays light when the operating system prefers dark. The element sets html[data-color-scheme="light|dark"] inside the viewer document, and the Paper & Ink theme selects its forced palettes by that attribute. LIGHT also no longer picks up PDF.js's dark hover and disabled-button styles. (#58, thanks @nvi9; #60)
  • A forced theme is applied before PDF.js initializes, so the first paint already uses it. (#60)
  • Runtime file URL handling: URLs are read once per viewer build so the iframe's CSP always matches the files it loads; stylesheet URLs are escaped when written into the viewer document; attribute values are trimmed; and worker-src set at runtime is normalized the same way as at load. (#57, #59)

Documentation

  • All runtime files must come from the same package release as the element.
  • LIGHT and DARK override the system color scheme; AUTOMATIC (the default) follows it.

Compatibility

No breaking changes. Custom themes loaded through theme-css-src that still match the inline color-scheme style keep working, since the element continues to set it.