@file-viewer/docx 0.3.16 → 0.3.18
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
|
@@ -106,6 +106,9 @@ collectLayoutSnapshot(
|
|
|
106
106
|
ignoreFonts: false,
|
|
107
107
|
breakPages: true,
|
|
108
108
|
|
|
109
|
+
// Appearance
|
|
110
|
+
darkMode: false,
|
|
111
|
+
|
|
109
112
|
// Word fidelity / pagination
|
|
110
113
|
ignoreLastRenderedPageBreak: false,
|
|
111
114
|
strictWordCompatibility: true,
|
|
@@ -172,6 +175,8 @@ For Word-authored documents, keep `ignoreLastRenderedPageBreak: false`. Those ma
|
|
|
172
175
|
|
|
173
176
|
`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.
|
|
174
177
|
|
|
178
|
+
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
|
+
|
|
175
180
|
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.
|
|
176
181
|
|
|
177
182
|
Complex-script formatting is kept script-aware. `w:iCs` and `w:bCs` now affect RTL/complex-script spans, but they are not applied to East Asian TOC text; this avoids turning Chinese TOC level 3 entries italic when the DOCX only specified complex-script italics.
|
package/dist/docx-preview.d.ts
CHANGED