@docx-editor.dev/react 2.21.0 → 2.21.1

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
@@ -14,16 +14,20 @@
14
14
 
15
15
  # @docx-editor.dev/react
16
16
 
17
- WYSIWYG `.docx` editor for React. Opens a Word file in the browser, paints the real paginated layout, edits it in place, and writes a `.docx` back out. No upload service, no conversion backend: parsing and serialization both happen client-side.
17
+ A visual `.docx` editor for React. Open a Word document, edit its paginated layout, and save a DOCX file. Parsing and serialization run in the browser.
18
18
 
19
- Saving has a lossless semantic round-trip. Untouched content, unsupported OOXML, and package payloads survive editing and save. Two oracles gate that in CI, so opening a document here cannot quietly destroy it.
19
+ Saving preserves untouched content, unsupported OOXML, and package payloads. Continuous integration (CI) checks document structure and save-and-reopen behavior.
20
+
21
+ Install the adapter and its required engine peer:
20
22
 
21
23
  ```bash
22
- npm install @docx-editor.dev/react
24
+ npm install @docx-editor.dev/react @docx-editor.dev/core
23
25
  ```
24
26
 
25
27
  ## Quick start
26
28
 
29
+ Import the stylesheet once and give the editor a container with a defined height:
30
+
27
31
  ```tsx
28
32
  import { useState } from 'react';
29
33
  import { DocxEditor } from '@docx-editor.dev/react';
@@ -52,7 +56,7 @@ export function App() {
52
56
 
53
57
  `<DocxEditor>` is the full packaged editor: title bar, menu, toolbar, navigation pane, context menu, and the painted document. It fills its parent, so give it a box with a real height, and import the stylesheet once.
54
58
 
55
- > **Next.js / SSR:** the editor measures text in the DOM at mount, so render it client-side (`dynamic(..., { ssr: false })`).
59
+ For Next.js and server-side rendering (SSR), load the editor in the browser. Use `dynamic(..., { ssr: false })` inside a Client Component.
56
60
 
57
61
  ## Build your own UI
58
62
 
@@ -70,7 +74,7 @@ function BoldButton() {
70
74
  disabled={!bold.isEnabled}
71
75
  data-active={bold.isActive || undefined}
72
76
  >
73
- B
77
+ Bold
74
78
  </button>
75
79
  );
76
80
  }
@@ -93,23 +97,23 @@ The customization ladder, in order: `className` and `data-active` → the `icon`
93
97
 
94
98
  ## Hooks
95
99
 
96
- | Hook | What it gives you |
97
- | ---------------------------------------------- | ---------------------------------------------------- |
98
- | `useEditorCommand(slot)` | `execute`, `isActive`, `isEnabled`, `disabledReason` |
99
- | `useEditorState(selector)` | A memoized slice of the editor snapshot |
100
- | `useDocxEditor()` | The editor instance, or `null` before mount |
101
- | `useEditorEvent(event, fn)` | `change`, `selectionChange`, `error` |
102
- | `useFontFamily()` / `useParagraphStyle()` | Value controls: current value, options, setter |
103
- | `usePageSetup()` | Margins, orientation, paper size |
104
- | `useDocumentOutline()` / `useDocumentSearch()` | The navigation pane, headless |
105
- | `useContentControl()` | Word content controls at the caret |
100
+ | Hook | What it gives you |
101
+ | --- | --- |
102
+ | `useEditorCommand(slot)` | `execute`, `isActive`, `isEnabled`, `disabledReason` |
103
+ | `useEditorState(selector)` | A memoized slice of the editor snapshot |
104
+ | `useDocxEditor()` | The editor instance, or `null` before mount |
105
+ | `useEditorEvent(event, fn)` | `change`, `selectionChange`, `error` |
106
+ | `useFontFamily()` / `useParagraphStyle()` | Value controls: current value, options, setter |
107
+ | `usePageSetup()` | Margins, orientation, paper size |
108
+ | `useDocumentOutline()` / `useDocumentSearch()` | The navigation pane, headless |
109
+ | `useContentControl()` | Word content controls at the caret |
106
110
 
107
111
  Enabled state has exactly one source. A control that hardcodes `disabled` will drift from the engine. Read `isEnabled` and show `disabledReason`.
108
112
 
109
113
  ## Companion packages
110
114
 
111
115
  - [`@docx-editor.dev/pro`](https://www.npmjs.com/package/@docx-editor.dev/pro) — tracked changes, comments, custom nodes
112
- - [`@docx-editor.dev/editor-api`](https://www.npmjs.com/package/@docx-editor.dev/editor-api) — Office.js-compatible editing API, on a server or against an open editor
116
+ - [`@docx-editor.dev/editor-api`](https://www.npmjs.com/package/@docx-editor.dev/editor-api) — A supported subset of the Word Office.js API for server and browser editing
113
117
  - [`@docx-editor.dev/core`](https://www.npmjs.com/package/@docx-editor.dev/core) — the engine this adapter renders
114
118
 
115
119
  ## Documentation
package/dist/index.d.mts CHANGED
@@ -2628,7 +2628,7 @@ interface DocxEditorProps {
2628
2628
  * HarfBuzz and measures line and page breaks from real font metrics. Without it, layout
2629
2629
  * runs on a fixed monospace approximation: glyphs still paint in their true faces, so the
2630
2630
  * page looks right, but wrap points and pagination are estimated rather than
2631
- * Word-accurate. Omit it to mount in one line; supply it when breaks must match Word.
2631
+ * measured. Omit it to mount in one line; supply it when break positions matter.
2632
2632
  */
2633
2633
  fonts?: FontConfiguration | FontConfigurationFragment | FontResolver;
2634
2634
  /**
package/dist/index.d.ts CHANGED
@@ -2628,7 +2628,7 @@ interface DocxEditorProps {
2628
2628
  * HarfBuzz and measures line and page breaks from real font metrics. Without it, layout
2629
2629
  * runs on a fixed monospace approximation: glyphs still paint in their true faces, so the
2630
2630
  * page looks right, but wrap points and pagination are estimated rather than
2631
- * Word-accurate. Omit it to mount in one line; supply it when breaks must match Word.
2631
+ * measured. Omit it to mount in one line; supply it when break positions matter.
2632
2632
  */
2633
2633
  fonts?: FontConfiguration | FontConfigurationFragment | FontResolver;
2634
2634
  /**