@docx-editor.dev/pro 2.31.0 → 2.33.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/README.md +41 -3
- package/dist/chunk-25A5N6OL.js +1 -0
- package/dist/chunk-3HW2VWFW.js +1 -0
- package/dist/chunk-3MIZFGHH.cjs +1 -0
- package/dist/chunk-46N5DWZV.cjs +1 -0
- package/dist/chunk-65JEI6FY.cjs +5 -0
- package/dist/chunk-ENMURXLJ.js +1 -0
- package/dist/chunk-EOZ44UA7.js +1 -0
- package/dist/chunk-GLYQ72LS.cjs +6 -0
- package/dist/{chunk-RYF4SNKX.cjs → chunk-GOUTDQFX.cjs} +1 -1
- package/dist/chunk-HMU7J34H.js +1 -0
- package/dist/chunk-IULA3QRZ.cjs +1 -0
- package/dist/chunk-QEULTKCT.cjs +1 -0
- package/dist/{chunk-OT5R3IYV.cjs → chunk-QOXYHVBM.cjs} +1 -1
- package/dist/chunk-SINNHH3H.js +1 -0
- package/dist/chunk-SL6K2CUL.js +6 -0
- package/dist/chunk-STTJA26X.js +1 -0
- package/dist/chunk-VY7374QP.cjs +1 -0
- package/dist/chunk-WGBOER6G.js +1 -0
- package/dist/chunk-WX43PF3Z.cjs +1 -0
- package/dist/chunk-WYVEFRAM.js +5 -0
- package/dist/collaboration/hocuspocus.cjs +1 -1
- package/dist/collaboration/hocuspocus.d.cts +3 -3
- package/dist/collaboration/hocuspocus.d.ts +3 -3
- package/dist/collaboration/hocuspocus.js +1 -1
- package/dist/collaboration/index.cjs +2 -2
- package/dist/collaboration/index.d.cts +65 -8
- package/dist/collaboration/index.d.ts +65 -8
- package/dist/collaboration/index.js +2 -2
- package/dist/collaboration/webrtc.cjs +1 -1
- package/dist/collaboration/webrtc.d.cts +3 -3
- package/dist/collaboration/webrtc.d.ts +3 -3
- package/dist/collaboration/webrtc.js +1 -1
- package/dist/{collaboration-module-DWn2heE1.d.cts → collaboration-module-02CIP5sN.d.cts} +2 -20
- package/dist/{collaboration-module-DWn2heE1.d.ts → collaboration-module-COZAgqwg.d.ts} +2 -20
- package/dist/{define-custom-node-D0c36PpZ.d.ts → define-custom-node-CISpZvVB.d.cts} +8 -3
- package/dist/{define-custom-node-CNRQG1TI.d.cts → define-custom-node-DE1KjR1r.d.ts} +8 -3
- package/dist/document-session-4NUOLWKQ.cjs +1 -0
- package/dist/document-session-5VAD24RH.js +1 -0
- package/dist/{document-session-_v9vqiSX.d.cts → document-session-B-MlORjE.d.cts} +105 -9
- package/dist/{document-session-Bxs4_GgX.d.ts → document-session-B-iH-YCU.d.ts} +105 -9
- package/dist/{document-session-options-DelOC7PX.d.ts → document-session-options-CdOH-TNn.d.ts} +1 -1
- package/dist/{document-session-options-CfKypp9c.d.cts → document-session-options-CxR0F5xT.d.cts} +1 -1
- package/dist/drawing/index.cjs +1 -0
- package/dist/drawing/index.d.cts +112 -0
- package/dist/drawing/index.d.ts +112 -0
- package/dist/drawing/index.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/dist/license-D-ds5Y7c.d.cts +20 -0
- package/dist/license-D-ds5Y7c.d.ts +20 -0
- package/dist/metafile-raster-3MCAHWYO.js +1 -0
- package/dist/metafile-raster-DWGCWQTU.cjs +1 -0
- package/dist/metafile-replay-GHPEUR2W.js +1 -0
- package/dist/metafile-replay-NZWGGGZR.cjs +1 -0
- package/dist/react/hocuspocus.cjs +1 -1
- package/dist/react/hocuspocus.d.cts +2 -2
- package/dist/react/hocuspocus.d.ts +2 -2
- package/dist/react/hocuspocus.js +1 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.d.cts +176 -34
- package/dist/react/index.d.ts +176 -34
- package/dist/react/index.js +2 -2
- package/dist/react/webrtc.cjs +1 -1
- package/dist/react/webrtc.d.cts +2 -2
- package/dist/react/webrtc.d.ts +2 -2
- package/dist/react/webrtc.js +1 -1
- package/dist/{types-BQ1vBt5Q.d.ts → types-DvGpDOcZ.d.cts} +9 -1
- package/dist/{types-BQ1vBt5Q.d.cts → types-DvGpDOcZ.d.ts} +9 -1
- package/dist/{types-6EmrEn4n.d.cts → types-bt2k1VO0.d.cts} +9 -1
- package/dist/{types-6EmrEn4n.d.ts → types-bt2k1VO0.d.ts} +9 -1
- package/dist/vue/hocuspocus.cjs +1 -1
- package/dist/vue/hocuspocus.d.cts +2 -2
- package/dist/vue/hocuspocus.d.ts +2 -2
- package/dist/vue/hocuspocus.js +1 -1
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.d.cts +149 -30
- package/dist/vue/index.d.ts +149 -30
- package/dist/vue/index.js +2 -2
- package/dist/vue/webrtc.cjs +1 -1
- package/dist/vue/webrtc.d.cts +2 -2
- package/dist/vue/webrtc.d.ts +2 -2
- package/dist/vue/webrtc.js +1 -1
- package/docs/accept-reject-without-scrolling.md +95 -0
- package/docs/comment-on-found-text.md +72 -0
- package/docs/custom-review-cards.md +178 -0
- package/docs/highlight-ranges.md +48 -0
- package/docs/index.md +36 -0
- package/docs/propose-rewrite.md +247 -0
- package/docs/tracked-replacement.md +68 -0
- package/package.json +12 -5
- package/dist/chunk-32WEH2XH.cjs +0 -1
- package/dist/chunk-DLYVBBO7.js +0 -1
- package/dist/chunk-FD2KDBHX.cjs +0 -1
- package/dist/chunk-L567WP3J.js +0 -5
- package/dist/chunk-MJECUVHQ.cjs +0 -5
- package/dist/chunk-MWO2ZUEJ.js +0 -1
- package/dist/chunk-Q2VBO66F.js +0 -1
- package/dist/chunk-Q5JTCGJI.js +0 -1
- package/dist/chunk-QLZH2Q2C.cjs +0 -1
- package/dist/chunk-SNQCYZLT.js +0 -1
- package/dist/chunk-UOAEJRVX.js +0 -1
- package/dist/chunk-ZSAAX6HV.cjs +0 -1
- package/dist/document-session-3VC43WNI.cjs +0 -1
- package/dist/document-session-J2YKWERI.js +0 -1
package/dist/react/index.d.ts
CHANGED
|
@@ -27,21 +27,22 @@
|
|
|
27
27
|
* @packageDocumentation
|
|
28
28
|
* @public
|
|
29
29
|
*/
|
|
30
|
-
import { a as CustomNodeDefinition, b as ActivatedCustomNode, A as AnyCustomNodeDefinition } from '../define-custom-node-
|
|
31
|
-
export { j as ReviewModuleOptions, q as reviewModule } from '../define-custom-node-
|
|
32
|
-
export { C as CollaborationModuleOptions,
|
|
30
|
+
import { a as CustomNodeDefinition, b as ActivatedCustomNode, A as AnyCustomNodeDefinition } from '../define-custom-node-DE1KjR1r.js';
|
|
31
|
+
export { j as ReviewModuleOptions, q as reviewModule } from '../define-custom-node-DE1KjR1r.js';
|
|
32
|
+
export { C as CollaborationModuleOptions, c as collaborationModule } from '../collaboration-module-COZAgqwg.js';
|
|
33
|
+
export { P as ProLicenseOptions } from '../license-D-ds5Y7c.js';
|
|
33
34
|
import * as react from 'react';
|
|
34
35
|
import { ReactNode, RefObject } from 'react';
|
|
35
36
|
import { ToolbarTranslate, ReviewAuthorInfo, DocxEditorRootProps } from '@docx-editor.dev/react';
|
|
36
|
-
import { EditDiagnosticCode, ReviewItemPlacement, ReviewActivationOptions, ReviewItemQuery, Editor } from '@docx-editor.dev/core/contracts/editor';
|
|
37
|
-
export { ReviewActivationOptions, ReviewItemRevealEvent, ReviewItemRevealSource, ScrollPlacement } from '@docx-editor.dev/core/contracts/editor';
|
|
37
|
+
import { EditDiagnosticCode, ReviewDiagnosticCode, ReviewItemPlacement, ReviewActivationOptions, ReviewItemQuery, Editor } from '@docx-editor.dev/core/contracts/editor';
|
|
38
|
+
export { ReviewActivationOptions, ReviewDiagnosticCode, ReviewItemRevealEvent, ReviewItemRevealSource, ScrollPlacement } from '@docx-editor.dev/core/contracts/editor';
|
|
38
39
|
import { CollaborationParticipant, CollaborationRemoteSelection, CollaborationStatus, CollaborationFailure } from '@docx-editor.dev/core/collaboration';
|
|
39
40
|
export { CollaborationFailure, CollaborationFailureCode, CollaborationIdentity, CollaborationParticipant, CollaborationRemoteSelection, CollaborationRemoteSelectionAddress, CollaborationSelectionKind, CollaborationStatus, CollaborationStatusSnapshot } from '@docx-editor.dev/core/collaboration';
|
|
40
|
-
import { C as CollaborationSession } from '../types-
|
|
41
|
-
export { a as CollaborationBootstrap, b as CollaborationIdentityUpdate } from '../types-
|
|
41
|
+
import { C as CollaborationSession } from '../types-DvGpDOcZ.js';
|
|
42
|
+
export { a as CollaborationBootstrap, b as CollaborationIdentityUpdate } from '../types-DvGpDOcZ.js';
|
|
42
43
|
import { EditorModule } from '@docx-editor.dev/core/editor';
|
|
43
44
|
export { CommentMarkerStyle, ResolvedReviewPane, ReviewPaneOpening, ReviewPaneOptions, ReviewPaneOverflow, RevisionDisplay } from '@docx-editor.dev/core/editor';
|
|
44
|
-
import { C as CreateDocumentCollaborationOptions } from '../document-session-options-
|
|
45
|
+
import { C as CreateDocumentCollaborationOptions } from '../document-session-options-CdOH-TNn.js';
|
|
45
46
|
import '@docx-editor.dev/core/store';
|
|
46
47
|
import 'yjs';
|
|
47
48
|
import 'y-protocols/awareness';
|
|
@@ -70,12 +71,16 @@ type ReviewWriteAction = 'accept' | 'reject' | 'resolve' | 'reopen' | 'remove' |
|
|
|
70
71
|
* @public
|
|
71
72
|
*/
|
|
72
73
|
interface ReviewWriteRefusal {
|
|
73
|
-
/** Which write was refused. */
|
|
74
|
+
/** Which write was refused. A discarded tracked change reports `'reject'`. */
|
|
74
75
|
readonly action: ReviewWriteAction;
|
|
75
76
|
/** The card the write addressed, or null for a new comment on the selection. */
|
|
76
77
|
readonly key: string | null;
|
|
77
|
-
/**
|
|
78
|
-
|
|
78
|
+
/**
|
|
79
|
+
* The public diagnostic code, the same one `onDiagnostic` reports for the refusal. A tracked
|
|
80
|
+
* change the engine could not decide names its review code, such as
|
|
81
|
+
* `review.retained-structure` for a row that stays to keep a nested table.
|
|
82
|
+
*/
|
|
83
|
+
readonly code: EditDiagnosticCode | ReviewDiagnosticCode;
|
|
79
84
|
/**
|
|
80
85
|
* Rises with every refusal of this editor, so the same refusal twice still differs. Key a
|
|
81
86
|
* live announcement on it to announce a repeat.
|
|
@@ -104,7 +109,23 @@ type ReviewItemView = ReviewItemPlacement;
|
|
|
104
109
|
* @public
|
|
105
110
|
*/
|
|
106
111
|
interface UseReviewReturn {
|
|
107
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Every pending decision in the document, in reading order.
|
|
114
|
+
*
|
|
115
|
+
* Follows an edit in one paragraph, such as typing, at background priority. The document
|
|
116
|
+
* paints first, and the cards follow in the next render, which a further keystroke can
|
|
117
|
+
* interrupt. These update the cards at once:
|
|
118
|
+
*
|
|
119
|
+
* - the actions below
|
|
120
|
+
* - a decision made elsewhere, such as from the toolbar or the editor API
|
|
121
|
+
* - a new document
|
|
122
|
+
* - a structural edit
|
|
123
|
+
* - a selection change on its own
|
|
124
|
+
*
|
|
125
|
+
* A comment added another way, through `editor.addComment` or by a remote peer, changes one
|
|
126
|
+
* paragraph. Its card follows at background priority too. The actions always act on the
|
|
127
|
+
* document as it is.
|
|
128
|
+
*/
|
|
108
129
|
readonly items: readonly ReviewItemView[];
|
|
109
130
|
/** The CARET-ACTIVE item: the one the caret is in, or null. */
|
|
110
131
|
readonly activeKey: string | null;
|
|
@@ -141,7 +162,10 @@ interface UseReviewReturn {
|
|
|
141
162
|
* useEditorEvent('reviewItemReveal', ({ key, source }) => openMyCard(key, source));
|
|
142
163
|
* setActive(key); // fires nothing
|
|
143
164
|
* setActive(key, { announce: true }); // fires 'reviewItemReveal'
|
|
165
|
+
* setActive(key, { reveal: false }); // opens the item without scrolling
|
|
144
166
|
* ```
|
|
167
|
+
*
|
|
168
|
+
* @see {@link https://www.docx-editor.dev/docs/2.x/recipes/accept-reject-without-scrolling | Accept or reject without scrolling}
|
|
145
169
|
*/
|
|
146
170
|
readonly setActive: (key: string | null, options?: ReviewActivationOptions) => boolean;
|
|
147
171
|
/**
|
|
@@ -150,9 +174,17 @@ interface UseReviewReturn {
|
|
|
150
174
|
* False for an item whose `readOnly` is true, and equally for a resolution the engine
|
|
151
175
|
* refuses on other grounds — a document open for viewing refuses every one. A caller
|
|
152
176
|
* that assumed success drew a live button that did nothing.
|
|
177
|
+
*
|
|
178
|
+
* For headless or server use, see `Revision.accept()` in `@docx-editor.dev/editor-api`.
|
|
179
|
+
*
|
|
180
|
+
* @see {@link https://www.docx-editor.dev/docs/2.x/recipes/accept-reject-without-scrolling | Accept or reject without scrolling}
|
|
153
181
|
*/
|
|
154
182
|
readonly accept: (item: ReviewItemView) => boolean;
|
|
155
|
-
/**
|
|
183
|
+
/**
|
|
184
|
+
* Reject a revision. Reports whether it landed, on the same terms as {@link accept}.
|
|
185
|
+
*
|
|
186
|
+
* For headless or server use, see `Revision.reject()` in `@docx-editor.dev/editor-api`.
|
|
187
|
+
*/
|
|
156
188
|
readonly reject: (item: ReviewItemView) => boolean;
|
|
157
189
|
/**
|
|
158
190
|
* Adopt tracked changes as the reviewer's own: they record the reviewer as their author
|
|
@@ -181,7 +213,8 @@ interface UseReviewReturn {
|
|
|
181
213
|
*
|
|
182
214
|
* One verb for both, so a card can carry one "remove this" control whatever it holds.
|
|
183
215
|
* Reports whether it landed — a comment the engine refused to delete must not vanish from
|
|
184
|
-
* the caller's own state while the document still holds it.
|
|
216
|
+
* the caller's own state while the document still holds it. A refused discard of a tracked
|
|
217
|
+
* change is recorded in `lastRefusal` with `action: 'reject'`, as a refused reject is.
|
|
185
218
|
*/
|
|
186
219
|
readonly remove: (item: ReviewItemView) => boolean;
|
|
187
220
|
/**
|
|
@@ -192,6 +225,8 @@ interface UseReviewReturn {
|
|
|
192
225
|
* neither rather than writing an empty attribute — which is why this REPORTS whether the
|
|
193
226
|
* reply landed. A box that cleared itself on a refusal would throw the text away and show
|
|
194
227
|
* nothing, and the writer would not learn their reply never existed.
|
|
228
|
+
*
|
|
229
|
+
* For headless or server use, see `Comment.reply` in `@docx-editor.dev/editor-api`.
|
|
195
230
|
*/
|
|
196
231
|
readonly reply: (item: ReviewItemView, text: string, author?: string) => boolean;
|
|
197
232
|
/**
|
|
@@ -200,7 +235,21 @@ interface UseReviewReturn {
|
|
|
200
235
|
* From the engine, not from the DOM — the same rule the card anchors follow.
|
|
201
236
|
*/
|
|
202
237
|
readonly selectionAnchorY: number | null;
|
|
203
|
-
/**
|
|
238
|
+
/**
|
|
239
|
+
* Comment on the current selection. Reports whether it landed, like {@link reply}.
|
|
240
|
+
*
|
|
241
|
+
* To comment on found text, select it first with `editor.findMatches` and
|
|
242
|
+
* `editor.selectMatch`. For headless or server use, see `Range.insertComment` in
|
|
243
|
+
* `@docx-editor.dev/editor-api`.
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* ```tsx
|
|
247
|
+
* const [match] = editor.findMatches('Effective Date', { wholeWord: true });
|
|
248
|
+
* if (match && editor.selectMatch(match).ok) comment('Define this term.');
|
|
249
|
+
* ```
|
|
250
|
+
*
|
|
251
|
+
* @see {@link https://www.docx-editor.dev/docs/2.x/recipes/comment-on-found-text | Comment on found text}
|
|
252
|
+
*/
|
|
204
253
|
readonly comment: (text: string, author?: string) => boolean;
|
|
205
254
|
/**
|
|
206
255
|
* Why the last accept, reject, resolve, reopen, remove, reply or comment did not land, or null.
|
|
@@ -209,13 +258,15 @@ interface UseReviewReturn {
|
|
|
209
258
|
* packaged rail recorded. Set by a refused write and cleared by the next one that lands, and
|
|
210
259
|
* by a change to the document, the editing mode, editability, the collaboration status or
|
|
211
260
|
* the author filter. A caret move keeps it. The packaged cards show it as a sentence; a
|
|
212
|
-
* custom card reads `key` to place it
|
|
261
|
+
* custom card reads `key` to place it, `useReviewRefusalMessage()` to word it, and `code`, the
|
|
262
|
+
* public diagnostic code, to branch on the cause.
|
|
213
263
|
*
|
|
214
264
|
* @example
|
|
215
265
|
* ```tsx
|
|
216
266
|
* const { lastRefusal } = useReview();
|
|
267
|
+
* const refusalMessage = useReviewRefusalMessage();
|
|
217
268
|
* // The packaged rail announces it; this only shows it.
|
|
218
|
-
* return lastRefusal?.key === item.key ? <p>{lastRefusal
|
|
269
|
+
* return lastRefusal?.key === item.key ? <p>{refusalMessage(lastRefusal)}</p> : null;
|
|
219
270
|
* ```
|
|
220
271
|
*/
|
|
221
272
|
readonly lastRefusal: ReviewWriteRefusal | null;
|
|
@@ -231,6 +282,11 @@ interface UseReviewReturn {
|
|
|
231
282
|
*
|
|
232
283
|
* Subscribes to the editor's own change stream, so the list re-derives when the document does
|
|
233
284
|
* and not on every render.
|
|
285
|
+
*
|
|
286
|
+
* This is the browser review API: comment, reply, accept, reject, and open items from your own
|
|
287
|
+
* UI. For headless, server, or agent pipelines, use `@docx-editor.dev/editor-api` instead.
|
|
288
|
+
*
|
|
289
|
+
* @see {@link https://www.docx-editor.dev/docs/2.x/recipes | Which API for which job}
|
|
234
290
|
*/
|
|
235
291
|
declare function useReview(query?: ReviewItemQuery): UseReviewReturn;
|
|
236
292
|
/** The same hook against an explicit editor, for hosts that hold their own. */
|
|
@@ -258,10 +314,14 @@ declare function useReviewOf(editor: Editor | null, query?: ReviewItemQuery): Us
|
|
|
258
314
|
*
|
|
259
315
|
* Returns each card's top in layout points. `useReviewRailMetrics` supplies `scale` and the
|
|
260
316
|
* pixel offset of the first page: a card's CSS `top` is `metrics.top + position * metrics.scale`.
|
|
317
|
+
*
|
|
318
|
+
* @see {@link https://www.docx-editor.dev/docs/2.x/recipes/custom-review-cards | Custom cards in the review rail}
|
|
261
319
|
*/
|
|
262
320
|
declare function useStackedReviewPositions(items: readonly {
|
|
263
321
|
readonly key: string;
|
|
264
322
|
readonly anchorY: number | null;
|
|
323
|
+
/** Keep this entry at its own anchor; the entries before it move up. */
|
|
324
|
+
readonly isActive?: boolean;
|
|
265
325
|
}[], heights: ReadonlyMap<string, number>, options?: {
|
|
266
326
|
readonly gap?: number;
|
|
267
327
|
readonly scale?: number;
|
|
@@ -383,6 +443,26 @@ interface ReviewMarkersProps {
|
|
|
383
443
|
icon?: ReactNode | ((item: ReviewItemView) => ReactNode);
|
|
384
444
|
}
|
|
385
445
|
|
|
446
|
+
/**
|
|
447
|
+
* Props of `DocxEditorReview.Draft`.
|
|
448
|
+
*
|
|
449
|
+
* @public
|
|
450
|
+
*/
|
|
451
|
+
interface ReviewDraftProps extends ReviewPartProps {
|
|
452
|
+
/**
|
|
453
|
+
* Rail-local `top` in CSS pixels. Omit it to use the packaged card stack's position. Pass
|
|
454
|
+
* your own when you render your own cards, so the box stacks with them.
|
|
455
|
+
*/
|
|
456
|
+
top?: number;
|
|
457
|
+
/**
|
|
458
|
+
* Rail-local `left` for the COMPACT rail, where the strip is 32px wide and a box laid
|
|
459
|
+
* out at column width would be cut by the viewport's edge. Omit it to use the compact
|
|
460
|
+
* card's position in the compact rail and the rail's own column otherwise. Null keeps the
|
|
461
|
+
* box in the rail's own column.
|
|
462
|
+
*/
|
|
463
|
+
left?: number | null;
|
|
464
|
+
}
|
|
465
|
+
|
|
386
466
|
declare const ReviewResolve: {
|
|
387
467
|
({ className, asChild, hidden, children, icon: glyph }: ReviewActionProps): react.JSX.Element | null;
|
|
388
468
|
docxReviewPart: "Resolve";
|
|
@@ -392,10 +472,7 @@ declare const ReviewReopen: {
|
|
|
392
472
|
docxReviewPart: "Reopen";
|
|
393
473
|
};
|
|
394
474
|
declare const ReviewDraft: {
|
|
395
|
-
(
|
|
396
|
-
top?: number;
|
|
397
|
-
left?: number | null;
|
|
398
|
-
}): react.JSX.Element | null;
|
|
475
|
+
(props: ReviewDraftProps): react.JSX.Element | null;
|
|
399
476
|
docxReviewPart: "Draft";
|
|
400
477
|
};
|
|
401
478
|
declare const ReviewReply: {
|
|
@@ -519,7 +596,17 @@ interface ReviewListProps {
|
|
|
519
596
|
collapsed?: ReadonlySet<string>;
|
|
520
597
|
scale?: number;
|
|
521
598
|
offset?: number;
|
|
522
|
-
/**
|
|
599
|
+
/**
|
|
600
|
+
* Visible band of the scroller, in the rail's coordinates; cards outside it are not mounted.
|
|
601
|
+
* Before the rail measures its scroller the band is empty (`top` greater than `bottom`, both
|
|
602
|
+
* infinite), so no positioned card renders.
|
|
603
|
+
*
|
|
604
|
+
* Null, or leaving it out, mounts every card. That is correct but costs one card per pending
|
|
605
|
+
* change on each render. Inside the packaged review rail the band arrives on its own, including
|
|
606
|
+
* for a `List` override. A list mounted elsewhere measures its own scroller and passes the
|
|
607
|
+
* part of it in view, widened by a margin above and below (the rail uses 600 px) so cards
|
|
608
|
+
* mount before they scroll into view.
|
|
609
|
+
*/
|
|
523
610
|
window?: {
|
|
524
611
|
top: number;
|
|
525
612
|
bottom: number;
|
|
@@ -655,13 +742,21 @@ interface ReviewRailMetrics {
|
|
|
655
742
|
readonly top: number;
|
|
656
743
|
/**
|
|
657
744
|
* CSS pixels from the scroll container's left padding edge, in its scrolled content, to
|
|
658
|
-
* the column's left edge: one 16px gutter right of the page
|
|
659
|
-
*
|
|
745
|
+
* the column's left edge: one 16px gutter right of the page, or, in a right-to-left
|
|
746
|
+
* interface, one 16px gutter and the column's own width left of it. `null` until there is
|
|
747
|
+
* a page to measure. Keep the column hidden while it is `null`.
|
|
660
748
|
*/
|
|
661
749
|
readonly left: number | null;
|
|
750
|
+
/**
|
|
751
|
+
* The page side the column stands on: `'left'` in a right-to-left interface, otherwise
|
|
752
|
+
* `'right'`. On the left, give the column its width (300px for the packaged cards), because
|
|
753
|
+
* `left` keeps the column's RIGHT edge one gutter off the page; and keep each card's air on
|
|
754
|
+
* its left, away from the page.
|
|
755
|
+
*/
|
|
756
|
+
readonly side: 'left' | 'right';
|
|
662
757
|
/**
|
|
663
758
|
* The `left` value, relative to {@link ReviewRailMetrics.left}, that puts a 300px card
|
|
664
|
-
* fully inside the visible area with a 12px inset from its
|
|
759
|
+
* fully inside the visible area with a 12px inset from its edge on the column's side. Use it while
|
|
665
760
|
* {@link ReviewRailMetrics.compact} is true. `null` until there is a page to measure.
|
|
666
761
|
*/
|
|
667
762
|
readonly compactCardLeft: number | null;
|
|
@@ -682,11 +777,11 @@ interface UseReviewRailMetricsOptions {
|
|
|
682
777
|
readonly trackScroll?: boolean;
|
|
683
778
|
/**
|
|
684
779
|
* With a `railRef`, reserve the review gutter beside the page while the column element is
|
|
685
|
-
* mounted, as `DocxEditorReview` does. The viewport then shifts the page
|
|
686
|
-
* pane is open. The reservation does not show the comment controls in the
|
|
687
|
-
* context menu; see `ReviewRailContext` to serve them from your column. Set
|
|
688
|
-
* mounted `DocxEditorReview` already reserves the gutter, or when your
|
|
689
|
-
* page. Default: `true`.
|
|
780
|
+
* mounted, as `DocxEditorReview` does. The viewport then shifts the page away from the
|
|
781
|
+
* column while the pane is open. The reservation does not show the comment controls in the
|
|
782
|
+
* toolbar and the context menu; see `ReviewRailContext` to serve them from your column. Set
|
|
783
|
+
* `false` when a mounted `DocxEditorReview` already reserves the gutter, or when your
|
|
784
|
+
* column overlays the page. Default: `true`.
|
|
690
785
|
*/
|
|
691
786
|
readonly reserveGutter?: boolean;
|
|
692
787
|
}
|
|
@@ -725,6 +820,8 @@ interface UseReviewRailMetricsOptions {
|
|
|
725
820
|
* position: 'absolute',
|
|
726
821
|
* top: 0,
|
|
727
822
|
* left: metrics.left ?? 0,
|
|
823
|
+
* // The column's width places it when `metrics.side` is 'left'.
|
|
824
|
+
* width: 300,
|
|
728
825
|
* visibility: metrics.left === null ? 'hidden' : 'visible',
|
|
729
826
|
* }}
|
|
730
827
|
* >
|
|
@@ -743,6 +840,7 @@ interface UseReviewRailMetricsOptions {
|
|
|
743
840
|
* }
|
|
744
841
|
* ```
|
|
745
842
|
*
|
|
843
|
+
* @see {@link https://www.docx-editor.dev/docs/2.x/recipes/custom-review-cards | Custom cards in the review rail}
|
|
746
844
|
* @public
|
|
747
845
|
*/
|
|
748
846
|
declare function useReviewRailMetrics(railRef?: RefObject<HTMLElement | null> | null, options?: UseReviewRailMetricsOptions): ReviewRailMetrics;
|
|
@@ -783,9 +881,15 @@ interface DocxEditorReviewNamespace {
|
|
|
783
881
|
readonly Reply: typeof ReviewReply;
|
|
784
882
|
/** The collapsed rail: one marker per item, shown when the pane is closed. */
|
|
785
883
|
readonly Markers: typeof ReviewMarkers;
|
|
786
|
-
/**
|
|
884
|
+
/**
|
|
885
|
+
* The "comment on this" button beside a selected range. A root part: put it as a direct
|
|
886
|
+
* child of `DocxEditorReview` so the rail positions it.
|
|
887
|
+
*/
|
|
787
888
|
readonly AddComment: typeof ReviewAddComment;
|
|
788
|
-
/**
|
|
889
|
+
/**
|
|
890
|
+
* The compose box a new comment is written in. It renders only while a draft is open. Pass
|
|
891
|
+
* `top` when you render your own cards; without it, the box uses the packaged card stack.
|
|
892
|
+
*/
|
|
789
893
|
readonly Draft: typeof ReviewDraft;
|
|
790
894
|
/**
|
|
791
895
|
* The decision balloon opened by clicking a tracked change in the page: format and
|
|
@@ -801,6 +905,29 @@ interface DocxEditorReviewNamespace {
|
|
|
801
905
|
* via `createDocxEditor({ modules: [reviewModule()] })` — without it there is nothing to derive
|
|
802
906
|
* cards from.
|
|
803
907
|
*
|
|
908
|
+
* PARTS AND SCOPES. The rail reads its parts from its own children, by element type. There are
|
|
909
|
+
* two scopes:
|
|
910
|
+
*
|
|
911
|
+
* - Root parts: `List`, `Markers`, `AddComment`, `Draft`, and `Balloon`. Put them as DIRECT
|
|
912
|
+
* children of `DocxEditorReview` (fragments are transparent). The rail gives them the geometry
|
|
913
|
+
* only it can compute: the comment button's and the compose box's `top`, and the markers'
|
|
914
|
+
* scale and window. A root part inside a wrapper component is not seen as a part. It renders
|
|
915
|
+
* as ordinary content, without that wiring.
|
|
916
|
+
* - Card parts: `Card`, `Empty`, and the parts inside a card (`Author`, `Summary`, `Accept`,
|
|
917
|
+
* `Reject`, `Reply`, and the others). Put them inside `DocxEditorReview.List`, or as other
|
|
918
|
+
* direct children, which become the card template.
|
|
919
|
+
*
|
|
920
|
+
* `preset={false}` drops the packaged defaults. Root parts you pass still get their wiring, and
|
|
921
|
+
* every other child renders as is inside the rail, where `useReviewRailMetrics()` reads the
|
|
922
|
+
* rail's own measurement. To render your own cards, use `useReview().items`,
|
|
923
|
+
* `useStackedReviewPositions`, and `useReviewRailMetrics`. `Draft` without `top` sits where the
|
|
924
|
+
* packaged card stack puts it, so pass `top` from your own stack.
|
|
925
|
+
*
|
|
926
|
+
* In a browser host, this rail and `useReview()` are the way to build a review UI. For headless,
|
|
927
|
+
* server, or agent pipelines, use `@docx-editor.dev/editor-api`.
|
|
928
|
+
*
|
|
929
|
+
* @see {@link https://www.docx-editor.dev/docs/2.x/recipes/custom-review-cards | Custom cards in the review rail}
|
|
930
|
+
*
|
|
804
931
|
* @example
|
|
805
932
|
* ```tsx
|
|
806
933
|
* <DocxEditorReview>
|
|
@@ -1154,6 +1281,21 @@ declare function activatedCustomNodeOf(resolved: ResolvedCustomNodeActivation, e
|
|
|
1154
1281
|
*/
|
|
1155
1282
|
declare function resolveCustomNodeActivation(target: EventTarget | null, nodes: readonly AnyCustomNodeDefinition[]): ResolvedCustomNodeActivation | null;
|
|
1156
1283
|
|
|
1284
|
+
/**
|
|
1285
|
+
* The packaged sentence for a refused review write, in the reader's language, for a host's own
|
|
1286
|
+
* card or balloon. It honors the review pane's `t` overrides, as the packaged cards do.
|
|
1287
|
+
*
|
|
1288
|
+
* @example
|
|
1289
|
+
* ```tsx
|
|
1290
|
+
* const { lastRefusal } = useReview();
|
|
1291
|
+
* const refusalMessage = useReviewRefusalMessage();
|
|
1292
|
+
* return lastRefusal?.key === item.key ? <p role="alert">{refusalMessage(lastRefusal)}</p> : null;
|
|
1293
|
+
* ```
|
|
1294
|
+
*
|
|
1295
|
+
* @public
|
|
1296
|
+
*/
|
|
1297
|
+
declare function useReviewRefusalMessage(): (refusal: ReviewWriteRefusal) => string;
|
|
1298
|
+
|
|
1157
1299
|
/** Status returned by {@link useCollaborationStatus}. @public */
|
|
1158
1300
|
interface UseCollaborationStatusReturn {
|
|
1159
1301
|
/** Current lifecycle state, or `inactive` when no session is attached. */
|
|
@@ -1359,5 +1501,5 @@ interface UseDocumentCollaborationReturn {
|
|
|
1359
1501
|
*/
|
|
1360
1502
|
declare function useDocumentCollaboration(options?: UseDocumentCollaborationOptions): UseDocumentCollaborationReturn;
|
|
1361
1503
|
|
|
1362
|
-
export { CollaborationSession, CreateDocumentCollaborationOptions, CustomNodeChrome, CustomNodeContextMenu, DocxEditorCollaboration, DocxEditorCollaborationRoot, DocxEditorReview, activatedCustomNodeOf, resolveCustomNodeActivation, useCollaborationParticipants, useCollaborationSession, useCollaborationStatus, useCustomNodeDefinitions, useDocumentCollaboration, useReview, useReviewAuthor, useReviewItem, useReviewOf, useReviewRailMetrics, useStackedReviewPositions };
|
|
1363
|
-
export type { CollaborationAvatarProps, CollaborationAvatarRenderProps, CollaborationAvatarsProps, CollaborationCaretLabelRenderProps, CollaborationCaretLabelsProps, CollaborationNoticeKind, CollaborationRootSource, CollaborationStatusNoticeProps, CollaborationStatusNoticeRenderProps, CustomNodeChromeProps, CustomNodeContextMenuProps, DocxEditorCollaborationNamespace, DocxEditorCollaborationRootProps, DocxEditorReviewNamespace, ResolvedCustomNodeActivation, ReviewActionProps, ReviewAdoptOptions, ReviewBalloonProps, ReviewItemView, ReviewMarkersProps, ReviewPartProps, ReviewProps, ReviewRailMetrics, ReviewWriteAction, ReviewWriteRefusal, UseCollaborationStatusReturn, UseDocumentCollaborationConnectOptions, UseDocumentCollaborationOptions, UseDocumentCollaborationReturn, UseReviewRailMetricsOptions, UseReviewReturn };
|
|
1504
|
+
export { CollaborationSession, CreateDocumentCollaborationOptions, CustomNodeChrome, CustomNodeContextMenu, DocxEditorCollaboration, DocxEditorCollaborationRoot, DocxEditorReview, activatedCustomNodeOf, resolveCustomNodeActivation, useCollaborationParticipants, useCollaborationSession, useCollaborationStatus, useCustomNodeDefinitions, useDocumentCollaboration, useReview, useReviewAuthor, useReviewItem, useReviewOf, useReviewRailMetrics, useReviewRefusalMessage, useStackedReviewPositions };
|
|
1505
|
+
export type { CollaborationAvatarProps, CollaborationAvatarRenderProps, CollaborationAvatarsProps, CollaborationCaretLabelRenderProps, CollaborationCaretLabelsProps, CollaborationNoticeKind, CollaborationRootSource, CollaborationStatusNoticeProps, CollaborationStatusNoticeRenderProps, CustomNodeChromeProps, CustomNodeContextMenuProps, DocxEditorCollaborationNamespace, DocxEditorCollaborationRootProps, DocxEditorReviewNamespace, ResolvedCustomNodeActivation, ReviewActionProps, ReviewAdoptOptions, ReviewBalloonProps, ReviewDraftProps, ReviewItemView, ReviewMarkersProps, ReviewPartProps, ReviewProps, ReviewRailMetrics, ReviewWriteAction, ReviewWriteRefusal, UseCollaborationStatusReturn, UseDocumentCollaborationConnectOptions, UseDocumentCollaborationOptions, UseDocumentCollaborationReturn, UseReviewRailMetricsOptions, UseReviewReturn };
|