@docx-editor.dev/react 2.4.0 → 2.5.0
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/dist/index.d.mts +46 -10
- package/dist/index.d.ts +46 -10
- package/dist/index.js +5 -5
- package/dist/index.mjs +5 -5
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -38,6 +38,16 @@ interface DocxEditorLoadingProps {
|
|
|
38
38
|
* provider only after those resolve.
|
|
39
39
|
*/
|
|
40
40
|
when?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Render as an opaque overlay pinned over the nearest positioned ancestor, covering
|
|
43
|
+
* the previous document while the next one opens. This is the shape for the big-file
|
|
44
|
+
* case: a large document mounts behind one painted frame, and the overlay is what
|
|
45
|
+
* that frame shows. It carries a short appearance delay, so an open that finishes
|
|
46
|
+
* quickly never flashes it. Compose it INSIDE a positioned box (the packaged frame
|
|
47
|
+
* puts it in the workspace row); without `overlay` the part is an in-flow box that
|
|
48
|
+
* fills whatever the host gives it.
|
|
49
|
+
*/
|
|
50
|
+
overlay?: boolean;
|
|
41
51
|
/** Appended after the load-bearing `docx-editor docx-editor__loading` classes. */
|
|
42
52
|
className?: string;
|
|
43
53
|
/** Inline styles for the loading container, as on `DocxEditor.Viewport`. */
|
|
@@ -91,11 +101,17 @@ interface DocxEditorLoadingComponent {
|
|
|
91
101
|
* </DocxEditor.Root>
|
|
92
102
|
* ```
|
|
93
103
|
*
|
|
94
|
-
* It
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
104
|
+
* It covers TWO windows. Before bytes arrive it is the empty-state screen. And while a
|
|
105
|
+
* LARGE document opens — the engine mounts it behind one painted frame precisely so this
|
|
106
|
+
* screen can paint before the blocking parse and layout — it holds until the pages land;
|
|
107
|
+
* pass `overlay` to pin it over the previous document for that window. A parse failure
|
|
108
|
+
* clears both, so a broken document never spins forever; report that from
|
|
109
|
+
* `snapshot().parseError` or the `error` event. Add `when` only for async the editor
|
|
110
|
+
* cannot observe, typically a host that mounts the provider after its own fetch.
|
|
111
|
+
*
|
|
112
|
+
* A host gating its own `DocxEditor.Content` must key that on `snapshot().isLoading`,
|
|
113
|
+
* which clears as soon as bytes are handed over — never on `isOpening`, whose scheduled
|
|
114
|
+
* mount needs the mount point to stay in the tree.
|
|
99
115
|
*
|
|
100
116
|
* Rendered OUTSIDE a `DocxEditor.Root` it always shows, because there is no editor to
|
|
101
117
|
* report otherwise — the same rule `useEditorState` documents for a null editor. Place
|
|
@@ -137,8 +153,16 @@ interface DocxEditorRootProps {
|
|
|
137
153
|
* construction-time in the engine.
|
|
138
154
|
*/
|
|
139
155
|
modules?: readonly EditorModule[];
|
|
140
|
-
/**
|
|
141
|
-
|
|
156
|
+
/**
|
|
157
|
+
* The mode the editor opens in, matching the toolbar's three-state pill. Sampled at
|
|
158
|
+
* mount only.
|
|
159
|
+
*
|
|
160
|
+
* `'edit'` opens in editing even when the document's `w:trackRevisions` asks for
|
|
161
|
+
* tracked changes; `'suggesting'` opens in suggesting (needs a review module and an
|
|
162
|
+
* `author`); `'view'` is read-only and the toolbar cannot leave it. Omitted, the
|
|
163
|
+
* DOCUMENT decides: a package carrying `w:trackRevisions` opens in suggesting.
|
|
164
|
+
*/
|
|
165
|
+
mode?: 'edit' | 'view' | 'suggesting';
|
|
142
166
|
/**
|
|
143
167
|
* A fixed scale. Supplying one also means the mode is fixed, unless `zoomMode` says
|
|
144
168
|
* otherwise: an app that pinned 100% keeps 100% on every window size.
|
|
@@ -154,7 +178,9 @@ interface DocxEditorRootProps {
|
|
|
154
178
|
*/
|
|
155
179
|
zoomMode?: ZoomMode | 'auto';
|
|
156
180
|
/** Fired once per instance, after it is published to the tree (and after any
|
|
157
|
-
* `DocxEditor.Content` in the same commit has attached its mount point).
|
|
181
|
+
* `DocxEditor.Content` in the same commit has attached its mount point). A large
|
|
182
|
+
* document mounts behind one painted frame; `onReady` fires AFTER that mount lands,
|
|
183
|
+
* so scrolling or selecting from it works on any document size. */
|
|
158
184
|
onReady?: (editor: Editor) => void;
|
|
159
185
|
/** Fired when the document changes (revision + identity deltas, not bytes). */
|
|
160
186
|
onChange?: (change: DocumentChange) => void;
|
|
@@ -1841,7 +1867,7 @@ interface DocxEditorContentControlNamespace {
|
|
|
1841
1867
|
}
|
|
1842
1868
|
declare const DocxEditorContentControl: DocxEditorContentControlNamespace;
|
|
1843
1869
|
|
|
1844
|
-
type EditorMode = 'edit' | 'view';
|
|
1870
|
+
type EditorMode = 'edit' | 'view' | 'suggesting';
|
|
1845
1871
|
/**
|
|
1846
1872
|
* Props for the React `DocxEditor`. The adapter is a thin renderer over the
|
|
1847
1873
|
* `Editor` contract; it holds no editing-engine state of its own and never
|
|
@@ -1987,7 +2013,17 @@ interface DocxEditorProps {
|
|
|
1987
2013
|
rulers?: boolean;
|
|
1988
2014
|
/** A document to load: DOCX bytes or an existing handle. */
|
|
1989
2015
|
document?: DocumentSource;
|
|
1990
|
-
/**
|
|
2016
|
+
/**
|
|
2017
|
+
* The mode the editor opens in, matching the toolbar's three-state pill. Applied at
|
|
2018
|
+
* mount only — not reactive; remount to change.
|
|
2019
|
+
*
|
|
2020
|
+
* Defaults to `'edit'`: the packaged editor opens every document ready to type, even
|
|
2021
|
+
* one whose `w:trackRevisions` asks for tracked changes. Pass `'suggesting'` (needs
|
|
2022
|
+
* `modules` with a review module and an `author`) to open in suggesting, or `'view'`
|
|
2023
|
+
* for read-only. To let the DOCUMENT decide — Word's behavior, where
|
|
2024
|
+
* `w:trackRevisions` opens in suggesting — compose `DocxEditor.Root`, which follows
|
|
2025
|
+
* the file's request when `mode` is omitted.
|
|
2026
|
+
*/
|
|
1991
2027
|
mode?: EditorMode;
|
|
1992
2028
|
/** A fixed scale. Supplying one also makes the mode fixed unless `zoomMode` says otherwise. */
|
|
1993
2029
|
zoom?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -38,6 +38,16 @@ interface DocxEditorLoadingProps {
|
|
|
38
38
|
* provider only after those resolve.
|
|
39
39
|
*/
|
|
40
40
|
when?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Render as an opaque overlay pinned over the nearest positioned ancestor, covering
|
|
43
|
+
* the previous document while the next one opens. This is the shape for the big-file
|
|
44
|
+
* case: a large document mounts behind one painted frame, and the overlay is what
|
|
45
|
+
* that frame shows. It carries a short appearance delay, so an open that finishes
|
|
46
|
+
* quickly never flashes it. Compose it INSIDE a positioned box (the packaged frame
|
|
47
|
+
* puts it in the workspace row); without `overlay` the part is an in-flow box that
|
|
48
|
+
* fills whatever the host gives it.
|
|
49
|
+
*/
|
|
50
|
+
overlay?: boolean;
|
|
41
51
|
/** Appended after the load-bearing `docx-editor docx-editor__loading` classes. */
|
|
42
52
|
className?: string;
|
|
43
53
|
/** Inline styles for the loading container, as on `DocxEditor.Viewport`. */
|
|
@@ -91,11 +101,17 @@ interface DocxEditorLoadingComponent {
|
|
|
91
101
|
* </DocxEditor.Root>
|
|
92
102
|
* ```
|
|
93
103
|
*
|
|
94
|
-
* It
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
104
|
+
* It covers TWO windows. Before bytes arrive it is the empty-state screen. And while a
|
|
105
|
+
* LARGE document opens — the engine mounts it behind one painted frame precisely so this
|
|
106
|
+
* screen can paint before the blocking parse and layout — it holds until the pages land;
|
|
107
|
+
* pass `overlay` to pin it over the previous document for that window. A parse failure
|
|
108
|
+
* clears both, so a broken document never spins forever; report that from
|
|
109
|
+
* `snapshot().parseError` or the `error` event. Add `when` only for async the editor
|
|
110
|
+
* cannot observe, typically a host that mounts the provider after its own fetch.
|
|
111
|
+
*
|
|
112
|
+
* A host gating its own `DocxEditor.Content` must key that on `snapshot().isLoading`,
|
|
113
|
+
* which clears as soon as bytes are handed over — never on `isOpening`, whose scheduled
|
|
114
|
+
* mount needs the mount point to stay in the tree.
|
|
99
115
|
*
|
|
100
116
|
* Rendered OUTSIDE a `DocxEditor.Root` it always shows, because there is no editor to
|
|
101
117
|
* report otherwise — the same rule `useEditorState` documents for a null editor. Place
|
|
@@ -137,8 +153,16 @@ interface DocxEditorRootProps {
|
|
|
137
153
|
* construction-time in the engine.
|
|
138
154
|
*/
|
|
139
155
|
modules?: readonly EditorModule[];
|
|
140
|
-
/**
|
|
141
|
-
|
|
156
|
+
/**
|
|
157
|
+
* The mode the editor opens in, matching the toolbar's three-state pill. Sampled at
|
|
158
|
+
* mount only.
|
|
159
|
+
*
|
|
160
|
+
* `'edit'` opens in editing even when the document's `w:trackRevisions` asks for
|
|
161
|
+
* tracked changes; `'suggesting'` opens in suggesting (needs a review module and an
|
|
162
|
+
* `author`); `'view'` is read-only and the toolbar cannot leave it. Omitted, the
|
|
163
|
+
* DOCUMENT decides: a package carrying `w:trackRevisions` opens in suggesting.
|
|
164
|
+
*/
|
|
165
|
+
mode?: 'edit' | 'view' | 'suggesting';
|
|
142
166
|
/**
|
|
143
167
|
* A fixed scale. Supplying one also means the mode is fixed, unless `zoomMode` says
|
|
144
168
|
* otherwise: an app that pinned 100% keeps 100% on every window size.
|
|
@@ -154,7 +178,9 @@ interface DocxEditorRootProps {
|
|
|
154
178
|
*/
|
|
155
179
|
zoomMode?: ZoomMode | 'auto';
|
|
156
180
|
/** Fired once per instance, after it is published to the tree (and after any
|
|
157
|
-
* `DocxEditor.Content` in the same commit has attached its mount point).
|
|
181
|
+
* `DocxEditor.Content` in the same commit has attached its mount point). A large
|
|
182
|
+
* document mounts behind one painted frame; `onReady` fires AFTER that mount lands,
|
|
183
|
+
* so scrolling or selecting from it works on any document size. */
|
|
158
184
|
onReady?: (editor: Editor) => void;
|
|
159
185
|
/** Fired when the document changes (revision + identity deltas, not bytes). */
|
|
160
186
|
onChange?: (change: DocumentChange) => void;
|
|
@@ -1841,7 +1867,7 @@ interface DocxEditorContentControlNamespace {
|
|
|
1841
1867
|
}
|
|
1842
1868
|
declare const DocxEditorContentControl: DocxEditorContentControlNamespace;
|
|
1843
1869
|
|
|
1844
|
-
type EditorMode = 'edit' | 'view';
|
|
1870
|
+
type EditorMode = 'edit' | 'view' | 'suggesting';
|
|
1845
1871
|
/**
|
|
1846
1872
|
* Props for the React `DocxEditor`. The adapter is a thin renderer over the
|
|
1847
1873
|
* `Editor` contract; it holds no editing-engine state of its own and never
|
|
@@ -1987,7 +2013,17 @@ interface DocxEditorProps {
|
|
|
1987
2013
|
rulers?: boolean;
|
|
1988
2014
|
/** A document to load: DOCX bytes or an existing handle. */
|
|
1989
2015
|
document?: DocumentSource;
|
|
1990
|
-
/**
|
|
2016
|
+
/**
|
|
2017
|
+
* The mode the editor opens in, matching the toolbar's three-state pill. Applied at
|
|
2018
|
+
* mount only — not reactive; remount to change.
|
|
2019
|
+
*
|
|
2020
|
+
* Defaults to `'edit'`: the packaged editor opens every document ready to type, even
|
|
2021
|
+
* one whose `w:trackRevisions` asks for tracked changes. Pass `'suggesting'` (needs
|
|
2022
|
+
* `modules` with a review module and an `author`) to open in suggesting, or `'view'`
|
|
2023
|
+
* for read-only. To let the DOCUMENT decide — Word's behavior, where
|
|
2024
|
+
* `w:trackRevisions` opens in suggesting — compose `DocxEditor.Root`, which follows
|
|
2025
|
+
* the file's request when `mode` is omitted.
|
|
2026
|
+
*/
|
|
1991
2027
|
mode?: EditorMode;
|
|
1992
2028
|
/** A fixed scale. Supplying one also makes the mode fixed unless `zoomMode` says otherwise. */
|
|
1993
2029
|
zoom?: number;
|