@file-viewer/docx 0.3.25 → 0.3.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,6 +37,7 @@ const options = {
37
37
  preserveComplexFieldResults: true,
38
38
  updatePageReferences: false,
39
39
  hideWebHiddenContent: false,
40
+ externalLinkPolicy: "allow",
40
41
  progress: ev => console.log(ev.phase, ev.current, ev.total, ev.message)
41
42
  };
42
43
 
@@ -175,6 +176,8 @@ For Word-authored documents, keep `ignoreLastRenderedPageBreak: false`. Those ma
175
176
 
176
177
  `w:webHidden` is not hidden by default in this renderer because it only applies to Word's Web Layout view. In Print Layout, Word still displays the TOC tab before the page number and the cached `PAGEREF` result even when those runs are marked `w:webHidden`. Set `hideWebHiddenContent: true` only for an explicit Web Layout style preview.
177
178
 
179
+ External hyperlinks remain active by default. Set `externalLinkPolicy: "block"` to omit their `href` while preserving their text and target metadata. Document-internal bookmark links remain active in either mode.
180
+
178
181
  Set `darkMode: true` to reproduce Word Online's "Switch Modes" dark appearance. Every color the renderer emits — text, backgrounds/highlights, borders, underlines, theme colors and DrawingML/VML shape fills and strokes — is converted with the same lightness-inversion algorithm Microsoft uses for this exact purpose (see `roosterjs`'s `getDarkColor`): the color is converted to CIE Lab, only the lightness (`L`) channel is inverted around a fixed base value (the `L` of `#333333`), and hue/chroma (`a`/`b`) are left untouched. That guarantees every color stays legible on a dark page — pure black becomes pure white, pure white becomes `#333333`, and an arbitrary color such as `rgb(99, 36, 35)` keeps its reddish hue while becoming light enough to read — without the hue-flipping side effects of a naive per-channel RGB invert. The toggle is purely a rendering-time CSS transform — it does not change the parsed document model — and every transformed color is wrapped in a CSS variable so that `@media print` can restore the exact original light-mode value; print output always renders with Word's normal light appearance regardless of `darkMode`.
179
182
 
180
183
  Header/footer selection follows the WordprocessingML print-layout rules: `first` header/footer references are used only when the section has `w:titlePg`, and `even` references are used only when document settings contain `w:evenAndOddHeaders`; otherwise the default/odd header is used. This prevents even-page empty headers from hiding the normal header in documents that merely contain unused even header references.
@@ -20,6 +20,7 @@ export interface Options {
20
20
  preserveComplexFieldResults: boolean;
21
21
  updatePageReferences: boolean;
22
22
  hideWebHiddenContent: boolean;
23
+ externalLinkPolicy: "allow" | "block";
23
24
  darkMode: boolean;
24
25
  debug: boolean;
25
26
  experimental: boolean;