wordinweb 0.1.1 → 0.1.2
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 +7 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# WordInWeb
|
|
2
2
|
|
|
3
|
+
[**Live demo →**](https://wordinweb-parity.callerinfo.workers.dev/)
|
|
4
|
+
|
|
3
5
|
A Word/.docx viewer and editor for the web, embeddable as a single React component.
|
|
4
6
|
|
|
5
7
|
```tsx
|
|
@@ -12,7 +14,7 @@ Editing is in an Alpha state and is strictly opt-in via the `editable` flag; the
|
|
|
12
14
|
|
|
13
15
|
If you discover an edge case or perf issue create an issue and include the offending Word file.
|
|
14
16
|
|
|
15
|
-
Part of the broader roadmap is to migrate away from DOM rendering to
|
|
17
|
+
Part of the broader roadmap is to migrate away from DOM rendering to canvas rendering, or a hybrid of the two. Editing performance can suffer on very long documents.
|
|
16
18
|
|
|
17
19
|
---
|
|
18
20
|
|
|
@@ -83,7 +85,9 @@ export function Editor() {
|
|
|
83
85
|
| Prop | Type | Default | What it does |
|
|
84
86
|
| --- | --- | --- | --- |
|
|
85
87
|
| `source` | `ArrayBuffer \| Uint8Array \| Blob \| string` | — | The document: raw bytes, a `File`/`Blob`, or a URL to fetch. |
|
|
86
|
-
| `zoom` | `number` | `1` |
|
|
88
|
+
| `zoom` | `number` | `1` | Maximum zoom factor (`1` = 100%). |
|
|
89
|
+
| `fitWidth` | `boolean` | `true` | Scale wide pages down to fit the viewer without horizontal scrolling. Never enlarges beyond `zoom`. |
|
|
90
|
+
| `narrowWidth` | `number` | `820` | Container width in pixels where comments switch to the compact treatment. |
|
|
87
91
|
| `editable` | `boolean` | `false` | Enable editing (selection formatting, typing, save-back). Off = pure viewer. |
|
|
88
92
|
| `showComments` | `boolean` | `true` | Render review comments (range highlights + margin balloons). |
|
|
89
93
|
| `revisions` | `"final" \| "markup"` | `"final"` | Tracked-changes display: clean final text, or insertions underlined / deletions struck. |
|
|
@@ -129,6 +133,7 @@ The object passed to `onReady`. Every command operates on the current selection
|
|
|
129
133
|
**Suggesting mode (tracked changes)**
|
|
130
134
|
- `setSuggesting(on, author?)` — when on, edits record as OOXML `w:ins`/`w:del` instead of mutating text directly, and the view switches to markup.
|
|
131
135
|
- `isSuggesting()`, `acceptRevisionAtCaret()`, `rejectRevisionAtCaret()`.
|
|
136
|
+
- `revisionCount()`, `acceptAllRevisions()`, `rejectAllRevisions()`.
|
|
132
137
|
|
|
133
138
|
**Find & replace**
|
|
134
139
|
- `find(query, { matchCase? })` → match count (selects the first).
|
|
@@ -214,8 +219,6 @@ Or in a stylesheet:
|
|
|
214
219
|
|
|
215
220
|
WordInWeb never converts the document to flowing HTML. It parses the OOXML into a typed model, runs a layout engine that breaks lines with real canvas metrics and paginates like Word, and renders each primitive as one absolutely-positioned element, so the browser does zero reflow. Editing mutates the retained XML tree and re-serializes only the parts it models, leaving everything else byte-for-byte intact.
|
|
216
221
|
|
|
217
|
-
See [`BLOG.md`](BLOG.md) for the pipeline and the parity work.
|
|
218
|
-
|
|
219
222
|
## Fonts
|
|
220
223
|
|
|
221
224
|
Text is measured on a canvas before layout, so line breaks depend on the real font metrics. For Word parity, register the bundled OFL substitutes in your app entry:
|
|
@@ -253,14 +256,6 @@ Add a separate `@font-face` rule for every weight and style you use.
|
|
|
253
256
|
|
|
254
257
|
When the browser can't render a requested face, `onMissingFonts` reports it so you can warn the user that the on-screen layout may drift from Word.
|
|
255
258
|
|
|
256
|
-
## Package structure
|
|
257
|
-
|
|
258
|
-
The repository keeps the parser and layout engine in an internal `core` workspace for development. The published `wordinweb` package bundles that workspace with the React components, so applications install one package.
|
|
259
|
-
|
|
260
|
-
The demo, browser tests, fixture corpus, and Word parity references live in the
|
|
261
|
-
separate [wordinweb-parity](https://github.com/theRealestAEP/wordinweb-parity)
|
|
262
|
-
repository. That repository links this one as a Git submodule.
|
|
263
|
-
|
|
264
259
|
## Development
|
|
265
260
|
|
|
266
261
|
```bash
|