@docx-editor.dev/pro 2.30.0 → 2.32.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 +24 -0
- package/dist/chunk-3WTOHPAB.js +1 -0
- package/dist/chunk-AVZO5ZHZ.js +1 -0
- package/dist/{chunk-CNXDNDD3.js → chunk-DLYVBBO7.js} +1 -1
- package/dist/chunk-GAGYRL3L.js +5 -0
- package/dist/chunk-HMSOWKXT.js +1 -0
- package/dist/chunk-I6HVINA4.cjs +1 -0
- package/dist/chunk-MHB6ID2P.cjs +1 -0
- package/dist/chunk-PMS3PGOE.cjs +1 -0
- package/dist/{chunk-N34IUO36.cjs → chunk-RYF4SNKX.cjs} +1 -1
- package/dist/chunk-YOWEY5F3.cjs +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 +63 -7
- package/dist/collaboration/index.d.ts +63 -7
- package/dist/collaboration/index.js +2 -2
- package/dist/collaboration/webrtc.cjs +2 -2
- package/dist/collaboration/webrtc.d.cts +34 -15
- package/dist/collaboration/webrtc.d.ts +34 -15
- package/dist/collaboration/webrtc.js +2 -2
- 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-B35ZX2W4.js +1 -0
- package/dist/document-session-V3O7XBJY.cjs +1 -0
- 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/index.cjs +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/react/hocuspocus.d.cts +2 -2
- package/dist/react/hocuspocus.d.ts +2 -2
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.d.cts +283 -16
- package/dist/react/index.d.ts +283 -16
- package/dist/react/index.js +2 -2
- package/dist/react/webrtc.d.cts +9 -4
- package/dist/react/webrtc.d.ts +9 -4
- 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 +285 -16
- package/dist/vue/index.d.ts +285 -16
- package/dist/vue/index.js +2 -2
- package/dist/vue/webrtc.cjs +1 -1
- package/dist/vue/webrtc.d.cts +9 -4
- package/dist/vue/webrtc.d.ts +9 -4
- 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 +5 -4
- package/dist/chunk-FD2KDBHX.cjs +0 -1
- package/dist/chunk-JRHEYVVY.cjs +0 -1
- package/dist/chunk-L567WP3J.js +0 -5
- package/dist/chunk-MJECUVHQ.cjs +0 -5
- package/dist/chunk-P2EF7WMV.js +0 -1
- package/dist/chunk-Q5JTCGJI.js +0 -1
- package/dist/chunk-SNQCYZLT.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/vue/index.d.ts
CHANGED
|
@@ -16,11 +16,11 @@ export { CollaborationFailure, CollaborationFailureCode, CollaborationIdentity,
|
|
|
16
16
|
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
17
17
|
import * as vue from 'vue';
|
|
18
18
|
import { ComputedRef, Ref, VNode, MaybeRefOrGetter as MaybeRefOrGetter$1, PropType } from 'vue';
|
|
19
|
-
import { ReviewItemPlacement, ReviewActivationOptions, ReviewItemQuery, Editor } from '@docx-editor.dev/core/contracts/editor';
|
|
19
|
+
import { EditDiagnosticCode, ReviewItemPlacement, ReviewActivationOptions, ReviewItemQuery, Editor } from '@docx-editor.dev/core/contracts/editor';
|
|
20
20
|
export { ReviewActivationOptions, ReviewItemRevealEvent, ReviewItemRevealSource, ScrollPlacement } from '@docx-editor.dev/core/contracts/editor';
|
|
21
21
|
import { MaybeRefOrGetter, ReviewAuthorInfo } from '@docx-editor.dev/vue';
|
|
22
|
-
import { C as CollaborationSession, a as CollaborationBootstrap } from '../types-
|
|
23
|
-
export { b as CollaborationIdentityUpdate } from '../types-
|
|
22
|
+
import { C as CollaborationSession, a as CollaborationBootstrap } from '../types-bt2k1VO0.js';
|
|
23
|
+
export { b as CollaborationIdentityUpdate } from '../types-bt2k1VO0.js';
|
|
24
24
|
import * as Y from 'yjs';
|
|
25
25
|
import { Awareness } from 'y-protocols/awareness';
|
|
26
26
|
|
|
@@ -107,6 +107,36 @@ interface ReviewAdoptOptions {
|
|
|
107
107
|
readonly date?: Date;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
/**
|
|
111
|
+
* The review write a refusal answered.
|
|
112
|
+
*
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
115
|
+
type ReviewWriteAction = 'accept' | 'reject' | 'resolve' | 'reopen' | 'remove' | 'reply' | 'comment';
|
|
116
|
+
/**
|
|
117
|
+
* A review write the editor refused.
|
|
118
|
+
*
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
interface ReviewWriteRefusal {
|
|
122
|
+
/** Which write was refused. */
|
|
123
|
+
readonly action: ReviewWriteAction;
|
|
124
|
+
/** The card the write addressed, or null for a new comment on the selection. */
|
|
125
|
+
readonly key: string | null;
|
|
126
|
+
/** The public diagnostic code, the same one `onDiagnostic` reports for the refusal. */
|
|
127
|
+
readonly code: EditDiagnosticCode;
|
|
128
|
+
/**
|
|
129
|
+
* Rises with every refusal of this editor, so the same refusal twice still differs. Key a
|
|
130
|
+
* live announcement on it to announce a repeat.
|
|
131
|
+
*/
|
|
132
|
+
readonly sequence: number;
|
|
133
|
+
/**
|
|
134
|
+
* True when retrying cannot help: the collaboration session ended, so the document must be
|
|
135
|
+
* opened again before it takes another review write.
|
|
136
|
+
*/
|
|
137
|
+
readonly final: boolean;
|
|
138
|
+
}
|
|
139
|
+
|
|
110
140
|
/** @public */
|
|
111
141
|
type ReviewItemView = ReviewItemPlacement;
|
|
112
142
|
|
|
@@ -139,10 +169,23 @@ interface UseReviewReturn {
|
|
|
139
169
|
* useEditorEvent('reviewItemReveal', ({ key, source }) => openMyCard(key, source));
|
|
140
170
|
* setActive(key); // fires nothing
|
|
141
171
|
* setActive(key, { announce: true }); // fires 'reviewItemReveal'
|
|
172
|
+
* setActive(key, { reveal: false }); // opens the item without scrolling
|
|
142
173
|
* ```
|
|
174
|
+
*
|
|
175
|
+
* @see {@link https://www.docx-editor.dev/docs/2.x/recipes/accept-reject-without-scrolling | Accept or reject without scrolling}
|
|
143
176
|
*/
|
|
144
177
|
readonly setActive: (key: string | null, options?: ReviewActivationOptions) => boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Accept a revision. Reports whether it landed. For headless or server use, see
|
|
180
|
+
* `Revision.accept()` in `@docx-editor.dev/editor-api`.
|
|
181
|
+
*
|
|
182
|
+
* @see {@link https://www.docx-editor.dev/docs/2.x/recipes/accept-reject-without-scrolling | Accept or reject without scrolling}
|
|
183
|
+
*/
|
|
145
184
|
readonly accept: (item: ReviewItemView) => boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Reject a revision. Reports whether it landed. For headless or server use, see
|
|
187
|
+
* `Revision.reject()` in `@docx-editor.dev/editor-api`.
|
|
188
|
+
*/
|
|
146
189
|
readonly reject: (item: ReviewItemView) => boolean;
|
|
147
190
|
/**
|
|
148
191
|
* Adopt tracked changes as the reviewer's own; they stay pending. Takes one item or a list,
|
|
@@ -155,9 +198,32 @@ interface UseReviewReturn {
|
|
|
155
198
|
readonly reopen: (item: ReviewItemView) => boolean;
|
|
156
199
|
readonly commentResolutionDisabledReason: ComputedRef<string | null>;
|
|
157
200
|
readonly remove: (item: ReviewItemView) => boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Reply to a comment or a revision. The author is `DocxEditorConfig.author` unless you pass
|
|
203
|
+
* one. Reports whether the reply landed. For headless or server use, see `Comment.reply` in
|
|
204
|
+
* `@docx-editor.dev/editor-api`.
|
|
205
|
+
*/
|
|
158
206
|
readonly reply: (item: ReviewItemView, text: string, author?: string) => boolean;
|
|
207
|
+
/** Where a comment on the current selection would sit, in layout points, or null. */
|
|
159
208
|
readonly selectionAnchorY: ComputedRef<number | null>;
|
|
209
|
+
/**
|
|
210
|
+
* Comment on the current selection. Reports whether it landed, like `reply`. To comment
|
|
211
|
+
* on found text, select it first with `editor.findMatches` and `editor.selectMatch`. For
|
|
212
|
+
* headless or server use, see `Range.insertComment` in `@docx-editor.dev/editor-api`.
|
|
213
|
+
*
|
|
214
|
+
* @see {@link https://www.docx-editor.dev/docs/2.x/recipes/comment-on-found-text | Comment on found text}
|
|
215
|
+
*/
|
|
160
216
|
readonly comment: (text: string, author?: string) => boolean;
|
|
217
|
+
/**
|
|
218
|
+
* Why the last accept, reject, resolve, reopen, remove, reply or comment did not land, or null.
|
|
219
|
+
*
|
|
220
|
+
* Shared by every `useReview()` over the same editor, so a custom card sees a refusal the
|
|
221
|
+
* packaged rail recorded. Cleared by the next write that lands and by a change to the
|
|
222
|
+
* document, the editing mode, editability, the collaboration status or the author filter; a
|
|
223
|
+
* caret move keeps it. The packaged cards show it as a sentence; a custom card reads `key` to
|
|
224
|
+
* place it and `code`, the public diagnostic code, to word it.
|
|
225
|
+
*/
|
|
226
|
+
readonly lastRefusal: ComputedRef<ReviewWriteRefusal | null>;
|
|
161
227
|
readonly paneOpen: ComputedRef<boolean>;
|
|
162
228
|
readonly setPaneOpen: (open: boolean) => void;
|
|
163
229
|
readonly ready: ComputedRef<boolean>;
|
|
@@ -166,10 +232,24 @@ interface UseReviewReturn {
|
|
|
166
232
|
declare function useReview(query?: MaybeRefOrGetter<ReviewItemQuery | undefined>): UseReviewReturn;
|
|
167
233
|
/** @public */
|
|
168
234
|
declare function useReviewOf(editorRef: Ref<Editor | null>, query?: MaybeRefOrGetter<ReviewItemQuery | undefined>): UseReviewReturn;
|
|
169
|
-
/**
|
|
235
|
+
/**
|
|
236
|
+
* Non-overlapping Y positions for cards you have measured.
|
|
237
|
+
*
|
|
238
|
+
* Pass entries in document order, each with a key and an anchor, and the measured card heights.
|
|
239
|
+
* An entry with `isActive: true` stays at its own anchor, and the entries before it move up.
|
|
240
|
+
* Anchors are in layout points. Measured heights are in CSS pixels, so pass `scale` to add them.
|
|
241
|
+
*
|
|
242
|
+
* Returns each card's top in layout points. `useReviewRailMetrics` supplies `scale` and the
|
|
243
|
+
* pixel offset of the first page: a card's CSS `top` is `metrics.top + position * metrics.scale`.
|
|
244
|
+
*
|
|
245
|
+
* @see {@link https://www.docx-editor.dev/docs/2.x/recipes/custom-review-cards | Custom cards in the review rail}
|
|
246
|
+
* @public
|
|
247
|
+
*/
|
|
170
248
|
declare function useStackedReviewPositions(items: MaybeRefOrGetter<readonly {
|
|
171
249
|
readonly key: string;
|
|
172
250
|
readonly anchorY: number | null;
|
|
251
|
+
/** Keep this entry at its own anchor; the entries before it move up. */
|
|
252
|
+
readonly isActive?: boolean;
|
|
173
253
|
}[]>, heights: MaybeRefOrGetter<ReadonlyMap<string, number>>, options?: MaybeRefOrGetter<{
|
|
174
254
|
readonly gap?: number;
|
|
175
255
|
readonly scale?: number;
|
|
@@ -203,6 +283,23 @@ interface ReviewBalloonProps {
|
|
|
203
283
|
*/
|
|
204
284
|
hidden?: boolean;
|
|
205
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* Props of `DocxEditorReview.Draft`.
|
|
288
|
+
*
|
|
289
|
+
* @public
|
|
290
|
+
*/
|
|
291
|
+
interface ReviewDraftProps extends ReviewPartProps {
|
|
292
|
+
/**
|
|
293
|
+
* Rail-local `top` in CSS pixels. Omit it to use the packaged card stack's position. Pass
|
|
294
|
+
* your own when you render your own cards, so the box stacks with them.
|
|
295
|
+
*/
|
|
296
|
+
top?: number;
|
|
297
|
+
/**
|
|
298
|
+
* Rail-local `left` for the compact rail. Omit it to use the compact card's position in the
|
|
299
|
+
* compact rail and the rail's own column otherwise. Null keeps the box in the rail's column.
|
|
300
|
+
*/
|
|
301
|
+
left?: number | null;
|
|
302
|
+
}
|
|
206
303
|
/** @public */
|
|
207
304
|
interface ReviewMarkersProps extends ReviewPartProps {
|
|
208
305
|
scale?: number;
|
|
@@ -243,6 +340,35 @@ declare function useReviewItem(): ComputedRef<ReviewItemView | null>;
|
|
|
243
340
|
*/
|
|
244
341
|
declare function useReviewAuthor(author: MaybeRefOrGetter$1<string | undefined>): ComputedRef<ReviewAuthorInfo | undefined>;
|
|
245
342
|
|
|
343
|
+
/**
|
|
344
|
+
* The review rail: comments and tracked changes as a compound component. Requires
|
|
345
|
+
* `reviewModule()` in the editor's modules.
|
|
346
|
+
*
|
|
347
|
+
* PARTS AND SCOPES. The rail reads its parts from its own children, by element type. There are
|
|
348
|
+
* two scopes:
|
|
349
|
+
*
|
|
350
|
+
* - Root parts: `List`, `Markers`, `AddComment`, `Draft`, and `Balloon`. Put them as DIRECT
|
|
351
|
+
* children of `DocxEditorReview` (fragments are transparent). The rail gives them the geometry
|
|
352
|
+
* only it can compute: the comment button's and the compose box's `top`, and the markers'
|
|
353
|
+
* scale and window. A root part inside a wrapper component is not seen as a part. It renders
|
|
354
|
+
* as ordinary content, without that wiring.
|
|
355
|
+
* - Card parts: `Card`, `Empty`, and the parts inside a card (`Author`, `Summary`, `Accept`,
|
|
356
|
+
* `Reject`, `Reply`, and the others). Put them inside `DocxEditorReview.List`, or as other
|
|
357
|
+
* direct children, which become the card template.
|
|
358
|
+
*
|
|
359
|
+
* `:preset="false"` drops the packaged defaults. Root parts you pass still get their wiring, and
|
|
360
|
+
* every other child renders as is inside the rail, where `useReviewRailMetrics()` reads the
|
|
361
|
+
* rail's own measurement. To render your own cards, use `useReview().items`,
|
|
362
|
+
* `useStackedReviewPositions`, and `useReviewRailMetrics`. `Draft` without `top` sits where the
|
|
363
|
+
* packaged card stack puts it, so pass `top` from your own stack.
|
|
364
|
+
*
|
|
365
|
+
* In a browser host, this rail and `useReview()` are the way to build a review UI. For headless,
|
|
366
|
+
* server, or agent pipelines, use `@docx-editor.dev/editor-api`.
|
|
367
|
+
*
|
|
368
|
+
* @see {@link https://www.docx-editor.dev/docs/2.x/recipes/custom-review-cards | Custom cards in the review rail}
|
|
369
|
+
*
|
|
370
|
+
* @public
|
|
371
|
+
*/
|
|
246
372
|
declare const DocxEditorReview: {
|
|
247
373
|
new (...args: any[]): vue.CreateComponentPublicInstanceWithMixins<Readonly<vue.ExtractPropTypes<{
|
|
248
374
|
className: StringConstructor;
|
|
@@ -705,6 +831,18 @@ declare const DocxEditorReview: {
|
|
|
705
831
|
[key: string]: any;
|
|
706
832
|
}>;
|
|
707
833
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
834
|
+
Refusal: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
835
|
+
className: StringConstructor;
|
|
836
|
+
hidden: BooleanConstructor;
|
|
837
|
+
asChild: BooleanConstructor;
|
|
838
|
+
}>, () => vue_jsx_runtime.JSX.Element | null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
839
|
+
className: StringConstructor;
|
|
840
|
+
hidden: BooleanConstructor;
|
|
841
|
+
asChild: BooleanConstructor;
|
|
842
|
+
}>> & Readonly<{}>, {
|
|
843
|
+
hidden: boolean;
|
|
844
|
+
asChild: boolean;
|
|
845
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
708
846
|
Replies: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
709
847
|
className: StringConstructor;
|
|
710
848
|
hidden: BooleanConstructor;
|
|
@@ -812,12 +950,12 @@ declare const DocxEditorReview: {
|
|
|
812
950
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
813
951
|
Draft: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
814
952
|
top: {
|
|
815
|
-
type:
|
|
816
|
-
default:
|
|
953
|
+
type: PropType<number | undefined>;
|
|
954
|
+
default: undefined;
|
|
817
955
|
};
|
|
818
956
|
left: {
|
|
819
|
-
type: PropType<number | null>;
|
|
820
|
-
default:
|
|
957
|
+
type: PropType<number | null | undefined>;
|
|
958
|
+
default: undefined;
|
|
821
959
|
};
|
|
822
960
|
className: StringConstructor;
|
|
823
961
|
hidden: BooleanConstructor;
|
|
@@ -825,18 +963,18 @@ declare const DocxEditorReview: {
|
|
|
825
963
|
[key: string]: any;
|
|
826
964
|
}> | null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
827
965
|
top: {
|
|
828
|
-
type:
|
|
829
|
-
default:
|
|
966
|
+
type: PropType<number | undefined>;
|
|
967
|
+
default: undefined;
|
|
830
968
|
};
|
|
831
969
|
left: {
|
|
832
|
-
type: PropType<number | null>;
|
|
833
|
-
default:
|
|
970
|
+
type: PropType<number | null | undefined>;
|
|
971
|
+
default: undefined;
|
|
834
972
|
};
|
|
835
973
|
className: StringConstructor;
|
|
836
974
|
hidden: BooleanConstructor;
|
|
837
975
|
}>> & Readonly<{}>, {
|
|
838
|
-
top: number;
|
|
839
|
-
left: number | null;
|
|
976
|
+
top: number | undefined;
|
|
977
|
+
left: number | null | undefined;
|
|
840
978
|
hidden: boolean;
|
|
841
979
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
842
980
|
Balloon: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
@@ -854,6 +992,137 @@ declare const DocxEditorReview: {
|
|
|
854
992
|
/** @public */
|
|
855
993
|
type DocxEditorReviewNamespace = typeof DocxEditorReview;
|
|
856
994
|
|
|
995
|
+
/**
|
|
996
|
+
* Where a review column sits, in the coordinates of the editor's scroll container.
|
|
997
|
+
*
|
|
998
|
+
* Review anchors (`item.anchorY`) and stacked positions (`useStackedReviewPositions`) are in
|
|
999
|
+
* layout points from the top of the first page. These values convert them to CSS pixels.
|
|
1000
|
+
*
|
|
1001
|
+
* @example Position a card at its stacked anchor
|
|
1002
|
+
* ```ts
|
|
1003
|
+
* const top = metrics.top + positions.get(item.key)! * metrics.scale;
|
|
1004
|
+
* ```
|
|
1005
|
+
*
|
|
1006
|
+
* @public
|
|
1007
|
+
*/
|
|
1008
|
+
interface ReviewRailMetrics {
|
|
1009
|
+
/** CSS pixels per layout point, zoom included. */
|
|
1010
|
+
readonly scale: number;
|
|
1011
|
+
/**
|
|
1012
|
+
* CSS pixels from the scroll container's top padding edge, in its scrolled content, to the
|
|
1013
|
+
* top of the first page. Content above the pages, such as a host banner inside the
|
|
1014
|
+
* viewport, is included. Scrolling does not change it.
|
|
1015
|
+
*/
|
|
1016
|
+
readonly top: number;
|
|
1017
|
+
/**
|
|
1018
|
+
* CSS pixels from the scroll container's left padding edge, in its scrolled content, to
|
|
1019
|
+
* the column's left edge: one 16px gutter right of the page. `null` until there is a page
|
|
1020
|
+
* to measure. Keep the column hidden while it is `null`.
|
|
1021
|
+
*/
|
|
1022
|
+
readonly left: number | null;
|
|
1023
|
+
/**
|
|
1024
|
+
* The `left` value, relative to {@link ReviewRailMetrics.left}, that puts a 300px card
|
|
1025
|
+
* fully inside the visible area with a 12px inset from its right edge. Use it while
|
|
1026
|
+
* {@link ReviewRailMetrics.compact} is true. `null` until there is a page to measure.
|
|
1027
|
+
*/
|
|
1028
|
+
readonly compactCardLeft: number | null;
|
|
1029
|
+
/**
|
|
1030
|
+
* The review pane is open, but the viewport is too narrow for a full column beside the
|
|
1031
|
+
* page. The packaged rail then shows markers and one floating card, the active item's,
|
|
1032
|
+
* at `compactCardLeft`.
|
|
1033
|
+
*/
|
|
1034
|
+
readonly compact: boolean;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
/** Options for {@link useReviewRailMetrics}. @public */
|
|
1038
|
+
interface UseReviewRailMetricsOptions {
|
|
1039
|
+
/**
|
|
1040
|
+
* Re-measure while the scroll container scrolls. Only `compactCardLeft` changes with
|
|
1041
|
+
* scrolling, and only when the page is wider than the viewport. Default: `false`.
|
|
1042
|
+
*/
|
|
1043
|
+
readonly trackScroll?: boolean;
|
|
1044
|
+
/**
|
|
1045
|
+
* With a `railRef`, reserve the review gutter beside the page while the column element is
|
|
1046
|
+
* mounted, as `DocxEditorReview` does. The viewport then shifts the page left while the
|
|
1047
|
+
* pane is open. The reservation does not show the comment controls in the toolbar and the
|
|
1048
|
+
* context menu; see `ReviewRailContext` to serve them from your column. Set `false` when a
|
|
1049
|
+
* mounted `DocxEditorReview` already reserves the gutter, or when your column overlays the
|
|
1050
|
+
* page. Default: `true`.
|
|
1051
|
+
*/
|
|
1052
|
+
readonly reserveGutter?: boolean;
|
|
1053
|
+
}
|
|
1054
|
+
/** The review column's geometry for Vue hosts. @public */
|
|
1055
|
+
interface UseReviewRailMetricsReturn {
|
|
1056
|
+
/** The current measurement. See `ReviewRailMetrics` for each value's meaning. */
|
|
1057
|
+
readonly metrics: Readonly<Ref<ReviewRailMetrics>>;
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* The review column's geometry in CSS pixels: what converts review anchors and stacked
|
|
1061
|
+
* positions, which are layout points from the top of the first page, into a card's `top`.
|
|
1062
|
+
*
|
|
1063
|
+
* Call it without arguments inside `DocxEditorReview`, for example in a component placed in
|
|
1064
|
+
* `<DocxEditorReview :preset="false">`, to read the packaged rail's own measurement. Those
|
|
1065
|
+
* children render inside the rail element, which already sits at `left`.
|
|
1066
|
+
*
|
|
1067
|
+
* Pass `railRef`, a template ref or a getter, to measure your own column instead. Give the
|
|
1068
|
+
* element `position: absolute` and render it directly inside `DocxEditor.Viewport` with no
|
|
1069
|
+
* positioned element in between: its offset parent must be the scroll container that holds
|
|
1070
|
+
* the pages. Development builds warn once when it is not. The column reserves the review
|
|
1071
|
+
* gutter unless `reserveGutter` is `false`.
|
|
1072
|
+
*
|
|
1073
|
+
* While `useReview().paneOpen` is false the viewport reserves only a marker strip, so
|
|
1074
|
+
* render no cards then. `compact` is true when the pane is open but too narrow for a column.
|
|
1075
|
+
*
|
|
1076
|
+
* The value updates when the zoom, the window size, the page count, the document load,
|
|
1077
|
+
* content above the pages, or the reserved review gutter changes. It works in a pop-out
|
|
1078
|
+
* window or an iframe, because it observes the element's own window.
|
|
1079
|
+
*
|
|
1080
|
+
* @example Position custom cards
|
|
1081
|
+
* ```vue
|
|
1082
|
+
* <script setup lang="ts">
|
|
1083
|
+
* import { ref } from 'vue';
|
|
1084
|
+
* import {
|
|
1085
|
+
* useReview,
|
|
1086
|
+
* useReviewRailMetrics,
|
|
1087
|
+
* useStackedReviewPositions,
|
|
1088
|
+
* } from '@docx-editor.dev/pro/vue';
|
|
1089
|
+
*
|
|
1090
|
+
* const props = defineProps<{ heights: ReadonlyMap<string, number> }>();
|
|
1091
|
+
* const railRef = ref<HTMLElement | null>(null);
|
|
1092
|
+
* const { metrics } = useReviewRailMetrics(railRef);
|
|
1093
|
+
* const { items } = useReview();
|
|
1094
|
+
* const positions = useStackedReviewPositions(items, () => props.heights, () => ({
|
|
1095
|
+
* scale: metrics.value.scale,
|
|
1096
|
+
* }));
|
|
1097
|
+
* const topOf = (key: string) =>
|
|
1098
|
+
* metrics.value.top + (positions.value.get(key) ?? 0) * metrics.value.scale;
|
|
1099
|
+
* </script>
|
|
1100
|
+
*
|
|
1101
|
+
* <template>
|
|
1102
|
+
* <div
|
|
1103
|
+
* ref="railRef"
|
|
1104
|
+
* :style="{
|
|
1105
|
+
* position: 'absolute',
|
|
1106
|
+
* top: '0px',
|
|
1107
|
+
* left: `${metrics.left ?? 0}px`,
|
|
1108
|
+
* visibility: metrics.left === null ? 'hidden' : 'visible',
|
|
1109
|
+
* }"
|
|
1110
|
+
* >
|
|
1111
|
+
* <MyCard
|
|
1112
|
+
* v-for="item in items"
|
|
1113
|
+
* :key="item.key"
|
|
1114
|
+
* :item="item"
|
|
1115
|
+
* :style="{ position: 'absolute', top: `${topOf(item.key)}px` }"
|
|
1116
|
+
* />
|
|
1117
|
+
* </div>
|
|
1118
|
+
* </template>
|
|
1119
|
+
* ```
|
|
1120
|
+
*
|
|
1121
|
+
* @see {@link https://www.docx-editor.dev/docs/2.x/recipes/custom-review-cards | Custom cards in the review rail}
|
|
1122
|
+
* @public
|
|
1123
|
+
*/
|
|
1124
|
+
declare function useReviewRailMetrics(railRef?: MaybeRefOrGetter$1<HTMLElement | null> | null, options?: MaybeRefOrGetter$1<UseReviewRailMetricsOptions | undefined>): UseReviewRailMetricsReturn;
|
|
1125
|
+
|
|
857
1126
|
/** Reactive collaboration status for Vue hosts. @public */
|
|
858
1127
|
interface UseCollaborationStatusReturn {
|
|
859
1128
|
/** Current lifecycle state, or `inactive` when no session is attached. */
|
|
@@ -1730,5 +1999,5 @@ declare function activatedCustomNodeOf(resolved: ResolvedCustomNodeActivation, e
|
|
|
1730
1999
|
/** Resolves a painted pointer target to a registered custom-node definition. @public */
|
|
1731
2000
|
declare function resolveCustomNodeActivation(target: EventTarget | null, nodes: readonly AnyCustomNodeDefinition[]): ResolvedCustomNodeActivation | null;
|
|
1732
2001
|
|
|
1733
|
-
export { CollaborationBootstrap, CollaborationSession, CustomNodeChrome, CustomNodeContextMenu, DocxEditorCollaboration, DocxEditorCollaborationRoot, DocxEditorReview, activatedCustomNodeOf, collaborationModule, resolveCustomNodeActivation, reviewModule, useCollaborationParticipants, useCollaborationSession, useCollaborationStatus, useCustomNodeDefinitions, useDocumentCollaboration, useReview, useReviewAuthor, useReviewItem, useReviewOf, useStackedReviewPositions };
|
|
1734
|
-
export type { CollaborationAvatarProps, CollaborationAvatarRenderProps, CollaborationAvatarsProps, CollaborationCaretLabelRenderProps, CollaborationCaretLabelsProps, CollaborationModuleOptions, CollaborationNoticeKind, CollaborationRootSource, CollaborationStatusNoticeProps, CollaborationStatusNoticeRenderProps, CreateDocumentCollaborationOptions, CustomNodeChromeProps, CustomNodeContextMenuProps, DocxEditorCollaborationNamespace, DocxEditorCollaborationRootProps, DocxEditorReviewNamespace, ProLicenseOptions, ResolvedCustomNodeActivation, ReviewActionProps, ReviewAdoptOptions, ReviewBalloonProps, ReviewItemView, ReviewMarkersProps, ReviewModuleOptions, ReviewPartProps, ReviewProps, UseCollaborationParticipantsReturn, UseCollaborationSessionReturn, UseCollaborationStatusReturn, UseDocumentCollaborationConnectOptions, UseDocumentCollaborationOptions, UseDocumentCollaborationReturn, UseReviewReturn };
|
|
2002
|
+
export { CollaborationBootstrap, CollaborationSession, CustomNodeChrome, CustomNodeContextMenu, DocxEditorCollaboration, DocxEditorCollaborationRoot, DocxEditorReview, activatedCustomNodeOf, collaborationModule, resolveCustomNodeActivation, reviewModule, useCollaborationParticipants, useCollaborationSession, useCollaborationStatus, useCustomNodeDefinitions, useDocumentCollaboration, useReview, useReviewAuthor, useReviewItem, useReviewOf, useReviewRailMetrics, useStackedReviewPositions };
|
|
2003
|
+
export type { CollaborationAvatarProps, CollaborationAvatarRenderProps, CollaborationAvatarsProps, CollaborationCaretLabelRenderProps, CollaborationCaretLabelsProps, CollaborationModuleOptions, CollaborationNoticeKind, CollaborationRootSource, CollaborationStatusNoticeProps, CollaborationStatusNoticeRenderProps, CreateDocumentCollaborationOptions, CustomNodeChromeProps, CustomNodeContextMenuProps, DocxEditorCollaborationNamespace, DocxEditorCollaborationRootProps, DocxEditorReviewNamespace, ProLicenseOptions, ResolvedCustomNodeActivation, ReviewActionProps, ReviewAdoptOptions, ReviewBalloonProps, ReviewDraftProps, ReviewItemView, ReviewMarkersProps, ReviewModuleOptions, ReviewPartProps, ReviewProps, ReviewRailMetrics, ReviewWriteAction, ReviewWriteRefusal, UseCollaborationParticipantsReturn, UseCollaborationSessionReturn, UseCollaborationStatusReturn, UseDocumentCollaborationConnectOptions, UseDocumentCollaborationOptions, UseDocumentCollaborationReturn, UseReviewRailMetricsOptions, UseReviewRailMetricsReturn, UseReviewReturn };
|