@docx-editor.dev/react 2.5.0 → 2.6.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/dist/index.d.mts +644 -341
- package/dist/index.d.ts +644 -341
- package/dist/index.js +5 -5
- package/dist/index.mjs +5 -5
- package/package.json +7 -7
- package/src/styles/editor.css +6 -0
- package/src/styles/zIndex.ts +28 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import react__default, {
|
|
2
|
+
import react__default, { ReactNode, CSSProperties, ReactElement, ForwardRefExoticComponent, RefAttributes, HTMLAttributes, Ref } from 'react';
|
|
3
|
+
import { RevisionAuthorStyle, DocxEditorInstance, FontConfigurationFragment, FontResolver, EditorModule, ImageDecodePort, ChromeSlotId, SupportedImageMime, TableChromeSlotId, ChromeMenuId, ChromeMenuEntry, SurfaceHyperlink, ReviewAuthorInfo, ImageWrapTarget, TextMeasurer, PaginatedSurfaceState, NavigationCommand, SurfaceFormatting, SectionProperties, RulerIndent } from '@docx-editor.dev/core/editor';
|
|
4
|
+
export { CHROME_GROUPS, CHROME_MENUS, ChromeMenu, ChromeMenuEntry, ChromeMenuId, ChromeMenuItemEntry, ChromeMenuSeparatorEntry, ChromeMenuSubmenuEntry, ChromeSlotId, FontConfigurationBase, FontConfigurationFragment, FontLoadFailure, FontLoadFailureReason, FontResolutionRequest, FontResolver, FontUrlSource, ImageWrapTarget, LOADING_SNAPSHOT, LoadFontsRequest, LoadFontsResult, MAX_RESOLVER_FAMILIES, PX_PER_CM, PX_PER_INCH, ReviewAuthorInfo, RevisionAuthorAssignments, RevisionAuthorStyle, RevisionStyles, RulerTick, RulerUnit, ToolbarCommandState, WORD_DEFAULT_FONT, chromeMenuSlots, commandForSlot, composeFontConfiguration, createFontSource, generateRulerTicks, loadFonts, rulerPageBox, runToolbarCommand, toolbarCommandState } from '@docx-editor.dev/core/editor';
|
|
3
5
|
import { DocumentSource, FontConfiguration, ZoomMode, Editor, DocumentChange, EditorFontError, TextMatch, ViewScope, DocumentHandle, EditorCommand, EditorScope, ExecResult, EditorSnapshot, EditorEvents, PageSetup, IndentFormatting, ColorValue, Theme } from '@docx-editor.dev/core/contracts/editor';
|
|
4
6
|
export { Editor, EditorCommand, EditorFontError, EditorFontErrorCode, EditorQuery, EditorScope, EditorSnapshot, FontConfiguration, FontFaceRequest, FontSource, FontSourceSubstitution, PageSetup } from '@docx-editor.dev/core/contracts/editor';
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
7
|
-
import { TFunction, Translations } from '@docx-editor.dev/i18n';
|
|
7
|
+
import { TFunction, Translations, LocaleStrings } from '@docx-editor.dev/i18n';
|
|
8
|
+
export { TranslationKey } from '@docx-editor.dev/i18n';
|
|
8
9
|
import { ContentControlType, ContentControlSummary } from '@docx-editor.dev/core';
|
|
9
10
|
export { DocxDocument } from '@docx-editor.dev/core/contracts/types';
|
|
10
11
|
|
|
12
|
+
/** @public */
|
|
13
|
+
declare const VERSION: string;
|
|
14
|
+
|
|
15
|
+
/** React composables take plain values; parity name matches the Vue surface. @public */
|
|
16
|
+
type MaybeRefOrGetter<T> = T;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Slot and icon content in public component props.
|
|
20
|
+
*
|
|
21
|
+
* React hosts pass {@link ReactNode}. Vue hosts pass {@link https://vuejs.org/api/utility-types.html#vnode | VNode}
|
|
22
|
+
* through the paired {@link DocxEditorChildren} alias in `@docx-editor.dev/vue`.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
type DocxEditorChildren = ReactNode;
|
|
27
|
+
|
|
11
28
|
/** Props for `DocxEditor.Content`. @public */
|
|
12
29
|
interface DocxEditorContentProps {
|
|
13
30
|
/** Appended after the load-bearing `docx-paginated-surface` class. */
|
|
14
31
|
className?: string;
|
|
32
|
+
children?: DocxEditorChildren;
|
|
15
33
|
}
|
|
16
34
|
/**
|
|
17
35
|
* The element the engine paints pages into. Must render inside a
|
|
@@ -57,7 +75,7 @@ interface DocxEditorLoadingProps {
|
|
|
57
75
|
* used, so the batteries-included path has something to show. Compose your own around
|
|
58
76
|
* `DocxEditor.Loading.Spinner` to keep the packaged indicator beside your own copy.
|
|
59
77
|
*/
|
|
60
|
-
children?:
|
|
78
|
+
children?: DocxEditorChildren;
|
|
61
79
|
}
|
|
62
80
|
/** Props for `DocxEditor.Loading.Spinner`. @public */
|
|
63
81
|
interface DocxEditorLoadingSpinnerProps {
|
|
@@ -123,6 +141,91 @@ interface DocxEditorLoadingComponent {
|
|
|
123
141
|
*/
|
|
124
142
|
declare const DocxEditorLoading: DocxEditorLoadingComponent;
|
|
125
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Colour tracked changes by the TYPE of change instead of by author, while mounted.
|
|
146
|
+
*
|
|
147
|
+
* The editor colours by author out of the box — Word's own default, so a paragraph three
|
|
148
|
+
* people edited reads as three people. Mount this to opt out: insertions take
|
|
149
|
+
* `--doc-revision-insertion` and deletions `--doc-revision-deletion`, whoever proposed
|
|
150
|
+
* them. Renders nothing; unmounting it returns to by-author colouring.
|
|
151
|
+
*
|
|
152
|
+
* Composed with `DocxEditor.AuthorStyle`, it also expresses "highlight these reviewers and
|
|
153
|
+
* leave everyone else green and red": the authors you declare keep their own colour, and
|
|
154
|
+
* this puts the rest on the kind colours.
|
|
155
|
+
*
|
|
156
|
+
* ```tsx
|
|
157
|
+
* <DocxEditor.Root document={bytes} modules={MODULES}>
|
|
158
|
+
* <DocxEditor.ColorByChangeType />
|
|
159
|
+
* …
|
|
160
|
+
* </DocxEditor.Root>
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
163
|
+
* @public
|
|
164
|
+
*/
|
|
165
|
+
declare function DocxEditorColorByChangeType(): null;
|
|
166
|
+
/**
|
|
167
|
+
* Props for `DocxEditor.AuthorStyle`: one author, and the {@link RevisionAuthorStyle}
|
|
168
|
+
* fields to apply — `color` (document ink and the review chrome's accent), `background`
|
|
169
|
+
* (the wash), `spanClassName` (classes on the painted spans), and `avatarUrl`.
|
|
170
|
+
*
|
|
171
|
+
* @public
|
|
172
|
+
*/
|
|
173
|
+
interface DocxEditorAuthorStyleProps extends RevisionAuthorStyle {
|
|
174
|
+
/** The author to style. Matches `w:author` exactly. */
|
|
175
|
+
author: string;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Declare one author's presentation, while mounted.
|
|
179
|
+
*
|
|
180
|
+
* Renders nothing. The editor already colours every author from the
|
|
181
|
+
* `--doc-review-author-N` ramp; this overrides one of them, and leaves the rest where they
|
|
182
|
+
* are. Prop changes re-apply live — pages repaint without a remount, so the caret and undo
|
|
183
|
+
* history stay — and unmounting returns that author to the ramp.
|
|
184
|
+
*
|
|
185
|
+
* Read who is in the document with `useReviewAuthors`, and read these declarations back
|
|
186
|
+
* inside a custom review card with `useReviewAuthor`.
|
|
187
|
+
*
|
|
188
|
+
* ```tsx
|
|
189
|
+
* <DocxEditor.Root document={bytes} modules={MODULES}>
|
|
190
|
+
* <DocxEditor.AuthorStyle author="Jess Lin" color="#7c3aed" avatarUrl="/jess.png" />
|
|
191
|
+
* …
|
|
192
|
+
* </DocxEditor.Root>
|
|
193
|
+
* ```
|
|
194
|
+
*
|
|
195
|
+
* @public
|
|
196
|
+
*/
|
|
197
|
+
declare function DocxEditorAuthorStyle(props: DocxEditorAuthorStyleProps): null;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* The editor instance from the nearest `DocxEditor.Root`, or `null` before the Root's
|
|
201
|
+
* mount effect has created it (and outside any Root). Deliberately not a throwing
|
|
202
|
+
* variant: pre-mount is a normal frame every consumer renders through, and the state
|
|
203
|
+
* hooks built on this already answer it with a typed loading snapshot.
|
|
204
|
+
*
|
|
205
|
+
* @public
|
|
206
|
+
*/
|
|
207
|
+
declare function useDocxEditor(): DocxEditorInstance | null;
|
|
208
|
+
/**
|
|
209
|
+
* Whether a review rail is mounted under this Root, and how much room it wants.
|
|
210
|
+
*
|
|
211
|
+
* The GUTTER is the reason this exists. `DocxEditor.Viewport` reserves space beside the
|
|
212
|
+
* page for the pane, and the ruler shifts by the same amount — but neither of them can see
|
|
213
|
+
* whether a rail was actually composed in. Keyed on the pane's open state alone, every
|
|
214
|
+
* consumer of the tier-2 `<DocxEditor>` sugar (which mounts no rail) had its page pushed
|
|
215
|
+
* 158px off centre beside an empty column.
|
|
216
|
+
*
|
|
217
|
+
* A rail registers on mount and unregisters on unmount, so the reservation follows what is
|
|
218
|
+
* really on screen. Count rather than boolean: StrictMode mounts twice, and a host may
|
|
219
|
+
* legitimately compose two rails.
|
|
220
|
+
*/
|
|
221
|
+
interface ReviewRailRegistry {
|
|
222
|
+
readonly mounted: number;
|
|
223
|
+
readonly register: () => () => void;
|
|
224
|
+
readonly registerCommentDraft: (handler: () => void) => () => void;
|
|
225
|
+
readonly requestCommentDraft: () => boolean;
|
|
226
|
+
}
|
|
227
|
+
declare const ReviewRailContext: react.Context<ReviewRailRegistry | null>;
|
|
228
|
+
|
|
126
229
|
/**
|
|
127
230
|
* Props for `DocxEditor.Root`. Creation parameters (`document`, `fonts`, `author`,
|
|
128
231
|
* `locale`, and the initial `mode`/`zoom`) are sampled when the instance is created;
|
|
@@ -132,7 +235,9 @@ declare const DocxEditorLoading: DocxEditorLoadingComponent;
|
|
|
132
235
|
* @public
|
|
133
236
|
*/
|
|
134
237
|
interface DocxEditorRootProps {
|
|
135
|
-
/** A document to load: DOCX bytes or an existing handle.
|
|
238
|
+
/** A document to load: DOCX bytes, `'blank'` for an empty one, or an existing handle.
|
|
239
|
+
* Identity change remounts; `'blank'` is a constant, so holding it across renders does
|
|
240
|
+
* not. Omitting this mounts NO document, which is not the same as an empty one. */
|
|
136
241
|
document?: DocumentSource;
|
|
137
242
|
/**
|
|
138
243
|
* Font bytes for Word-accurate (HarfBuzz-shaped) wrap and pagination. Omitted, layout
|
|
@@ -193,8 +298,29 @@ interface DocxEditorRootProps {
|
|
|
193
298
|
tableInteractionLabel?: (key: 'table.insertRowBelow' | 'table.insertColumnRight') => string;
|
|
194
299
|
/** Optional decode port for embedded image insertion and paint in tests or custom hosts. */
|
|
195
300
|
imageDecodePort?: ImageDecodePort;
|
|
196
|
-
children?:
|
|
301
|
+
children?: DocxEditorChildren;
|
|
302
|
+
}
|
|
303
|
+
/** @public Vue-only lifecycle listeners; exported for cross-adapter API parity. */
|
|
304
|
+
interface DocxEditorRootListeners {
|
|
305
|
+
onReady?: (editor: Editor) => void;
|
|
306
|
+
onChange?: (change: DocumentChange) => void;
|
|
307
|
+
onFontError?: (error: EditorFontError) => void;
|
|
308
|
+
}
|
|
309
|
+
/** @public Vue-only setup result; exported for cross-adapter API parity. */
|
|
310
|
+
interface ProvideDocxEditorResult {
|
|
311
|
+
readonly DocxEditorRoot: typeof DocxEditorRoot;
|
|
312
|
+
readonly rootProps: Omit<DocxEditorRootProps, keyof DocxEditorRootListeners>;
|
|
313
|
+
readonly rootListeners: DocxEditorRootListeners;
|
|
314
|
+
readonly editorRef: ReturnType<typeof useDocxEditor>;
|
|
197
315
|
}
|
|
316
|
+
/**
|
|
317
|
+
* Prepares Root props and listeners while exposing the instance created by that Root.
|
|
318
|
+
* Call this function during render, like a React hook.
|
|
319
|
+
*
|
|
320
|
+
* @public
|
|
321
|
+
*/
|
|
322
|
+
declare function useProvidedDocxEditor(options: DocxEditorRootProps): ProvideDocxEditorResult;
|
|
323
|
+
|
|
198
324
|
/**
|
|
199
325
|
* Creates and owns a `DocxEditorInstance` and provides it to the subtree. Renders no
|
|
200
326
|
* DOM — compose it with `DocxEditor.Viewport` + `DocxEditor.Content` for the painted
|
|
@@ -209,7 +335,7 @@ interface DocxEditorViewportProps {
|
|
|
209
335
|
/** Appended after the load-bearing viewport classes (e.g. `dark` for chrome theming). */
|
|
210
336
|
className?: string;
|
|
211
337
|
style?: CSSProperties;
|
|
212
|
-
children?:
|
|
338
|
+
children?: DocxEditorChildren;
|
|
213
339
|
}
|
|
214
340
|
/**
|
|
215
341
|
* The sole scroll container for the painted document. Put `DocxEditor.Content` inside
|
|
@@ -221,17 +347,33 @@ declare function DocxEditorViewport({ className, style, children }: DocxEditorVi
|
|
|
221
347
|
|
|
222
348
|
/** Resolves an i18n key to display text. @public */
|
|
223
349
|
type ToolbarTranslate = (key: string) => string;
|
|
350
|
+
interface ToolbarContextValue {
|
|
351
|
+
readonly t: ToolbarTranslate | undefined;
|
|
352
|
+
/** Host save handler for the `file.save` part; absent renders the part disabled. */
|
|
353
|
+
readonly onSave: (() => void) | undefined;
|
|
354
|
+
}
|
|
355
|
+
declare const ToolbarContext: react.Context<ToolbarContextValue>;
|
|
356
|
+
/** The toolbar root's published value. Internal: parts read it, hosts pass props. */
|
|
357
|
+
declare function useToolbarContext(): ToolbarContextValue;
|
|
358
|
+
/**
|
|
359
|
+
* The label for an i18n key given a host resolver: the host's translation, else the
|
|
360
|
+
* locale catalogue. The toolbar ROOT needs this before it publishes its context, so the
|
|
361
|
+
* resolver is separate from the context read below — a raw key must never reach the DOM.
|
|
362
|
+
*/
|
|
363
|
+
declare function useToolbarLabelFor(t: ToolbarTranslate | undefined): (key: string) => string;
|
|
364
|
+
/** The label for an i18n key: the host's translation, else the locale catalogue. */
|
|
365
|
+
declare function useToolbarLabel(): (key: string) => string;
|
|
224
366
|
|
|
225
367
|
/** Props for `DocxEditorToolbar.Button`. @public */
|
|
226
368
|
interface ToolbarButtonProps$1 {
|
|
227
369
|
/** The chrome slot this button drives (`'text.bold'`, `'history.undo'`, ...). */
|
|
228
370
|
slot: ChromeSlotId;
|
|
229
371
|
/** Icon override; falls back to `children`, then to the registry's icon paths. */
|
|
230
|
-
icon?:
|
|
372
|
+
icon?: DocxEditorChildren;
|
|
231
373
|
/** Merge the button's behavior into the single child element instead of a <button>. */
|
|
232
374
|
asChild?: boolean;
|
|
233
375
|
className?: string;
|
|
234
|
-
children?:
|
|
376
|
+
children?: DocxEditorChildren;
|
|
235
377
|
/** Render nothing — inside the default arrangement this removes the slot. */
|
|
236
378
|
hidden?: boolean;
|
|
237
379
|
}
|
|
@@ -256,7 +398,7 @@ interface ImageInsertTriggerProps {
|
|
|
256
398
|
className?: string;
|
|
257
399
|
hidden?: boolean;
|
|
258
400
|
asChild?: boolean;
|
|
259
|
-
children?:
|
|
401
|
+
children?: DocxEditorChildren;
|
|
260
402
|
}
|
|
261
403
|
/** Toolbar insert-image control — opens the shared file picker. @public */
|
|
262
404
|
declare function ImageInsertTrigger({ className, hidden, asChild, children, }: ImageInsertTriggerProps): react.JSX.Element | null;
|
|
@@ -269,7 +411,7 @@ interface ImageWrapProps {
|
|
|
269
411
|
className?: string;
|
|
270
412
|
hidden?: boolean;
|
|
271
413
|
asChild?: boolean;
|
|
272
|
-
children?:
|
|
414
|
+
children?: DocxEditorChildren;
|
|
273
415
|
}
|
|
274
416
|
/**
|
|
275
417
|
* Wrap-text dropdown presenting all nine Word choices.
|
|
@@ -291,7 +433,7 @@ interface ImageAltTextProps {
|
|
|
291
433
|
className?: string;
|
|
292
434
|
hidden?: boolean;
|
|
293
435
|
asChild?: boolean;
|
|
294
|
-
children?:
|
|
436
|
+
children?: DocxEditorChildren;
|
|
295
437
|
}
|
|
296
438
|
/**
|
|
297
439
|
* Opens a small panel to edit image description (and optional title).
|
|
@@ -308,12 +450,17 @@ interface ImageAltTextPartComponent {
|
|
|
308
450
|
readonly docxSlot: 'image.altText';
|
|
309
451
|
}
|
|
310
452
|
|
|
453
|
+
/** @public */
|
|
454
|
+
interface RefObject<T> {
|
|
455
|
+
readonly current: T | null;
|
|
456
|
+
}
|
|
457
|
+
|
|
311
458
|
/** Props for `DocxEditor.ImagePropertiesDialog`. @public */
|
|
312
459
|
interface DocxEditorImagePropertiesDialogProps {
|
|
313
460
|
open: boolean;
|
|
314
461
|
onClose: () => void;
|
|
315
462
|
className?: string;
|
|
316
|
-
triggerRef?:
|
|
463
|
+
triggerRef?: RefObject<HTMLElement | null>;
|
|
317
464
|
}
|
|
318
465
|
/**
|
|
319
466
|
* Properties dialog for the selected picture.
|
|
@@ -326,7 +473,7 @@ interface ImagePropertiesTriggerProps {
|
|
|
326
473
|
className?: string;
|
|
327
474
|
hidden?: boolean;
|
|
328
475
|
asChild?: boolean;
|
|
329
|
-
children?:
|
|
476
|
+
children?: DocxEditorChildren;
|
|
330
477
|
}
|
|
331
478
|
/**
|
|
332
479
|
* Opens the image properties dialog for the selected drawing.
|
|
@@ -337,6 +484,9 @@ declare function ImagePropertiesTrigger({ className, hidden, asChild, children,
|
|
|
337
484
|
declare namespace ImagePropertiesTrigger {
|
|
338
485
|
var docxSlot: "image.properties";
|
|
339
486
|
}
|
|
487
|
+
declare const ToolbarImageProperties: typeof ImagePropertiesTrigger & {
|
|
488
|
+
docxSlot: "image.properties";
|
|
489
|
+
};
|
|
340
490
|
|
|
341
491
|
type NormalizedImagePayload = {
|
|
342
492
|
readonly ok: true;
|
|
@@ -393,7 +543,7 @@ interface ToolbarColorSplitProps extends ToolbarSlotPartProps {
|
|
|
393
543
|
* The BAR is not replaceable and still paints the live value, so a host swapping the glyph
|
|
394
544
|
* keeps the thing that makes this control readable at a glance.
|
|
395
545
|
*/
|
|
396
|
-
icon?:
|
|
546
|
+
icon?: DocxEditorChildren;
|
|
397
547
|
}
|
|
398
548
|
/** A split colour control pinned to one slot. @public */
|
|
399
549
|
interface ToolbarColorSplitComponent {
|
|
@@ -417,7 +567,7 @@ interface ToolbarActionProps {
|
|
|
417
567
|
*/
|
|
418
568
|
label: string;
|
|
419
569
|
/** Icon content. Inline SVG sized ~18px matches the packaged controls. */
|
|
420
|
-
icon?:
|
|
570
|
+
icon?: DocxEditorChildren;
|
|
421
571
|
/** Pressed state, for an action that toggles. Sets `aria-pressed` and `data-active`. */
|
|
422
572
|
active?: boolean;
|
|
423
573
|
disabled?: boolean;
|
|
@@ -427,7 +577,7 @@ interface ToolbarActionProps {
|
|
|
427
577
|
/** Merge the behavior onto the single child element instead of rendering a `<button>`. */
|
|
428
578
|
asChild?: boolean;
|
|
429
579
|
className?: string;
|
|
430
|
-
children?:
|
|
580
|
+
children?: DocxEditorChildren;
|
|
431
581
|
}
|
|
432
582
|
/**
|
|
433
583
|
* A host-owned toolbar action, styled and behaved like the packaged controls.
|
|
@@ -463,7 +613,7 @@ declare function useFontFamily(): UseFontFamilyResult;
|
|
|
463
613
|
interface FontFamilyPartProps {
|
|
464
614
|
asChild?: boolean;
|
|
465
615
|
className?: string;
|
|
466
|
-
children?:
|
|
616
|
+
children?: DocxEditorChildren;
|
|
467
617
|
}
|
|
468
618
|
/** Props for the compound root. @public */
|
|
469
619
|
interface FontFamilyProps extends FontFamilyPartProps {
|
|
@@ -533,7 +683,7 @@ declare function useParagraphStyle(): UseParagraphStyleResult;
|
|
|
533
683
|
interface ParagraphStylePartProps {
|
|
534
684
|
asChild?: boolean;
|
|
535
685
|
className?: string;
|
|
536
|
-
children?:
|
|
686
|
+
children?: DocxEditorChildren;
|
|
537
687
|
}
|
|
538
688
|
/** Props for the compound root. @public */
|
|
539
689
|
interface ParagraphStyleProps extends ParagraphStylePartProps {
|
|
@@ -570,7 +720,7 @@ interface TableChromePartProps {
|
|
|
570
720
|
/** Merge props onto the single child element instead of rendering a default host node. */
|
|
571
721
|
asChild?: boolean;
|
|
572
722
|
/** Custom panel body or trigger label; defaults to the packaged control chrome. */
|
|
573
|
-
children?:
|
|
723
|
+
children?: DocxEditorChildren;
|
|
574
724
|
}
|
|
575
725
|
/** Props for a value-driven row or swatch inside a table compound menu. @public */
|
|
576
726
|
interface TableChromeItemProps extends TableChromePartProps {
|
|
@@ -587,11 +737,11 @@ interface TableChromePartComponent extends ToolbarSlotPartComponent {
|
|
|
587
737
|
/** The chrome slot this compound drives. */
|
|
588
738
|
readonly docxSlot: TableChromeSlotId;
|
|
589
739
|
/** Opens the picker menu or dialog. */
|
|
590
|
-
readonly Trigger: (props: TableChromePartProps) =>
|
|
740
|
+
readonly Trigger: (props: TableChromePartProps) => DocxEditorChildren;
|
|
591
741
|
/** The open menu or dialog panel; omit to use the default item list. */
|
|
592
|
-
readonly Content: (props: TableChromePartProps) =>
|
|
742
|
+
readonly Content: (props: TableChromePartProps) => DocxEditorChildren;
|
|
593
743
|
/** One selectable value row or swatch inside {@link Content}. */
|
|
594
|
-
readonly Item: (props: TableChromeItemProps) =>
|
|
744
|
+
readonly Item: (props: TableChromeItemProps) => DocxEditorChildren;
|
|
595
745
|
}
|
|
596
746
|
/**
|
|
597
747
|
* Border-target picker compound (`DocxEditor.Toolbar.TableBorderTarget`).
|
|
@@ -602,11 +752,11 @@ interface TableBorderTargetNamespace extends TableChromePartComponent {
|
|
|
602
752
|
/** Chrome slot id: `table.borderTarget`. */
|
|
603
753
|
readonly docxSlot: 'table.borderTarget';
|
|
604
754
|
/** Button that opens the border-edge target menu. */
|
|
605
|
-
readonly Trigger: (props: TableChromePartProps) =>
|
|
755
|
+
readonly Trigger: (props: TableChromePartProps) => DocxEditorChildren;
|
|
606
756
|
/** Open menu listing edge scopes and clear. */
|
|
607
|
-
readonly Content: (props: TableChromePartProps) =>
|
|
757
|
+
readonly Content: (props: TableChromePartProps) => DocxEditorChildren;
|
|
608
758
|
/** One edge scope or clear row inside the target menu. */
|
|
609
|
-
readonly Item: (props: TableChromeItemProps) =>
|
|
759
|
+
readonly Item: (props: TableChromeItemProps) => DocxEditorChildren;
|
|
610
760
|
}
|
|
611
761
|
/**
|
|
612
762
|
* Border-colour split compound with a quick-apply main button and swatch dialog
|
|
@@ -618,13 +768,13 @@ interface TableBorderColorNamespace extends TableChromePartComponent {
|
|
|
618
768
|
/** Chrome slot id: `table.borderColor`. */
|
|
619
769
|
readonly docxSlot: 'table.borderColor';
|
|
620
770
|
/** Applies the last swatch without opening the dialog. */
|
|
621
|
-
readonly Main: (props: TableChromePartProps) =>
|
|
771
|
+
readonly Main: (props: TableChromePartProps) => DocxEditorChildren;
|
|
622
772
|
/** Button that opens the border-colour swatch dialog. */
|
|
623
|
-
readonly Trigger: (props: TableChromePartProps) =>
|
|
773
|
+
readonly Trigger: (props: TableChromePartProps) => DocxEditorChildren;
|
|
624
774
|
/** Open swatch dialog for the active border target. */
|
|
625
|
-
readonly Content: (props: TableChromePartProps) =>
|
|
775
|
+
readonly Content: (props: TableChromePartProps) => DocxEditorChildren;
|
|
626
776
|
/** One colour swatch inside the border-colour dialog. */
|
|
627
|
-
readonly Item: (props: TableChromeItemProps) =>
|
|
777
|
+
readonly Item: (props: TableChromeItemProps) => DocxEditorChildren;
|
|
628
778
|
}
|
|
629
779
|
/**
|
|
630
780
|
* Cell-fill split compound (`DocxEditor.Toolbar.TableCellFill`).
|
|
@@ -635,13 +785,13 @@ interface TableCellFillNamespace extends TableChromePartComponent {
|
|
|
635
785
|
/** Chrome slot id: `table.cellFill`. */
|
|
636
786
|
readonly docxSlot: 'table.cellFill';
|
|
637
787
|
/** Applies the last swatch without opening the dialog. */
|
|
638
|
-
readonly Main: (props: TableChromePartProps) =>
|
|
788
|
+
readonly Main: (props: TableChromePartProps) => DocxEditorChildren;
|
|
639
789
|
/** Button that opens the cell-fill swatch dialog. */
|
|
640
|
-
readonly Trigger: (props: TableChromePartProps) =>
|
|
790
|
+
readonly Trigger: (props: TableChromePartProps) => DocxEditorChildren;
|
|
641
791
|
/** Open swatch dialog for the selected cell(s). */
|
|
642
|
-
readonly Content: (props: TableChromePartProps) =>
|
|
792
|
+
readonly Content: (props: TableChromePartProps) => DocxEditorChildren;
|
|
643
793
|
/** One fill swatch inside the cell-fill dialog. */
|
|
644
|
-
readonly Item: (props: TableChromeItemProps) =>
|
|
794
|
+
readonly Item: (props: TableChromeItemProps) => DocxEditorChildren;
|
|
645
795
|
}
|
|
646
796
|
/**
|
|
647
797
|
* Border-style menu compound (`DocxEditor.Toolbar.TableBorderStyle`).
|
|
@@ -652,11 +802,11 @@ interface TableBorderStyleNamespace extends TableChromePartComponent {
|
|
|
652
802
|
/** Chrome slot id: `table.borderStyle`. */
|
|
653
803
|
readonly docxSlot: 'table.borderStyle';
|
|
654
804
|
/** Button that opens the border line-style menu. */
|
|
655
|
-
readonly Trigger: (props: TableChromePartProps) =>
|
|
805
|
+
readonly Trigger: (props: TableChromePartProps) => DocxEditorChildren;
|
|
656
806
|
/** Open menu listing line styles for the active target. */
|
|
657
|
-
readonly Content: (props: TableChromePartProps) =>
|
|
807
|
+
readonly Content: (props: TableChromePartProps) => DocxEditorChildren;
|
|
658
808
|
/** One line-style row inside the style menu. */
|
|
659
|
-
readonly Item: (props: TableChromeItemProps) =>
|
|
809
|
+
readonly Item: (props: TableChromeItemProps) => DocxEditorChildren;
|
|
660
810
|
}
|
|
661
811
|
/**
|
|
662
812
|
* Border-width menu compound (`DocxEditor.Toolbar.TableBorderWidth`).
|
|
@@ -667,11 +817,11 @@ interface TableBorderWidthNamespace extends TableChromePartComponent {
|
|
|
667
817
|
/** Chrome slot id: `table.borderWidth`. */
|
|
668
818
|
readonly docxSlot: 'table.borderWidth';
|
|
669
819
|
/** Button that opens the border width menu. */
|
|
670
|
-
readonly Trigger: (props: TableChromePartProps) =>
|
|
820
|
+
readonly Trigger: (props: TableChromePartProps) => DocxEditorChildren;
|
|
671
821
|
/** Open menu listing width presets for the active target. */
|
|
672
|
-
readonly Content: (props: TableChromePartProps) =>
|
|
822
|
+
readonly Content: (props: TableChromePartProps) => DocxEditorChildren;
|
|
673
823
|
/** One width preset row inside the width menu. */
|
|
674
|
-
readonly Item: (props: TableChromeItemProps) =>
|
|
824
|
+
readonly Item: (props: TableChromeItemProps) => DocxEditorChildren;
|
|
675
825
|
}
|
|
676
826
|
/**
|
|
677
827
|
* Resolved label for the active border target in the shared draft.
|
|
@@ -704,7 +854,7 @@ interface DocxEditorToolbarProps {
|
|
|
704
854
|
* menu when it runs out of width. Default `true`.
|
|
705
855
|
*/
|
|
706
856
|
overflow?: boolean;
|
|
707
|
-
children?:
|
|
857
|
+
children?: DocxEditorChildren;
|
|
708
858
|
}
|
|
709
859
|
/** The toolbar with its parts attached as statics. @public */
|
|
710
860
|
interface DocxEditorToolbarNamespace {
|
|
@@ -785,7 +935,7 @@ type MenuId = ChromeMenuId | (string & {});
|
|
|
785
935
|
/** Props for `DocxEditor.Menu.Row`: one presentational menu row. @public */
|
|
786
936
|
interface MenuRowProps {
|
|
787
937
|
/** Material Symbols paths, rendered as inline SVG in the row's icon column. */
|
|
788
|
-
icon?:
|
|
938
|
+
icon?: DocxEditorChildren;
|
|
789
939
|
/** Right-aligned shortcut text (already resolved). */
|
|
790
940
|
shortcut?: string;
|
|
791
941
|
disabled?: boolean;
|
|
@@ -809,9 +959,19 @@ interface MenuRowProps {
|
|
|
809
959
|
selected?: true;
|
|
810
960
|
/** Stable marker for hosts, tests and e2e. */
|
|
811
961
|
slot?: string;
|
|
962
|
+
/**
|
|
963
|
+
* Vue TSX maps row identity through `rowSlot` because `slot` is reserved.
|
|
964
|
+
* React uses {@link slot} directly.
|
|
965
|
+
*/
|
|
966
|
+
rowSlot?: string;
|
|
812
967
|
onSelect?: () => void;
|
|
968
|
+
/**
|
|
969
|
+
* Vue TSX binds row activation through `selectHandler` because `onSelect`
|
|
970
|
+
* is treated as a listener. React uses {@link onSelect} directly.
|
|
971
|
+
*/
|
|
972
|
+
selectHandler?: () => void;
|
|
813
973
|
className?: string;
|
|
814
|
-
children?:
|
|
974
|
+
children?: DocxEditorChildren;
|
|
815
975
|
}
|
|
816
976
|
/**
|
|
817
977
|
* One menu row: icon column, label, shortcut column.
|
|
@@ -830,7 +990,7 @@ interface MenuGroupProps {
|
|
|
830
990
|
labelKey?: string;
|
|
831
991
|
className?: string;
|
|
832
992
|
hidden?: boolean;
|
|
833
|
-
children?:
|
|
993
|
+
children?: DocxEditorChildren;
|
|
834
994
|
}
|
|
835
995
|
/**
|
|
836
996
|
* A named section inside a panel: a visible heading and the rows under it.
|
|
@@ -892,7 +1052,7 @@ interface MenuSubmenuProps {
|
|
|
892
1052
|
/** Material Symbols paths for the parent row's icon. */
|
|
893
1053
|
paths?: readonly string[] | null;
|
|
894
1054
|
className?: string;
|
|
895
|
-
children?:
|
|
1055
|
+
children?: DocxEditorChildren;
|
|
896
1056
|
}
|
|
897
1057
|
/**
|
|
898
1058
|
* A row that opens a nested panel to its right (Insert › Break).
|
|
@@ -960,7 +1120,7 @@ interface MenuProps {
|
|
|
960
1120
|
*
|
|
961
1121
|
* Decorative: the label is the accessible name, so the icon is hidden from assistive tech.
|
|
962
1122
|
*/
|
|
963
|
-
icon?:
|
|
1123
|
+
icon?: DocxEditorChildren;
|
|
964
1124
|
className?: string;
|
|
965
1125
|
/** Render nothing — inside the default bar this removes the menu. */
|
|
966
1126
|
hidden?: boolean;
|
|
@@ -972,7 +1132,7 @@ interface MenuProps {
|
|
|
972
1132
|
*/
|
|
973
1133
|
preset?: boolean;
|
|
974
1134
|
/** Panel content. */
|
|
975
|
-
children?:
|
|
1135
|
+
children?: DocxEditorChildren;
|
|
976
1136
|
}
|
|
977
1137
|
/**
|
|
978
1138
|
* One menu of the bar: a trigger and the panel it opens.
|
|
@@ -1064,7 +1224,7 @@ interface DocxEditorMenuProps {
|
|
|
1064
1224
|
* children override their menu in place, others append.
|
|
1065
1225
|
*/
|
|
1066
1226
|
preset?: boolean;
|
|
1067
|
-
children?:
|
|
1227
|
+
children?: DocxEditorChildren;
|
|
1068
1228
|
}
|
|
1069
1229
|
/** The menu bar with its parts attached as statics. @public */
|
|
1070
1230
|
interface DocxEditorMenuNamespace {
|
|
@@ -1130,7 +1290,11 @@ declare function DocxEditorHorizontalRuler(props: DocxEditorRulerProps): ReactEl
|
|
|
1130
1290
|
* when the engine supports page-setup writes, committing one undoable step on release.
|
|
1131
1291
|
*
|
|
1132
1292
|
* Renders nothing while the editor holds no document — see
|
|
1133
|
-
* {@link selectDocumentAbsent}
|
|
1293
|
+
* {@link selectDocumentAbsent} — and nothing while the page is wider than the
|
|
1294
|
+
* viewport: the ruler rides the scroller at content x=0, so a horizontal scroll
|
|
1295
|
+
* would carry it out of view, and pinning it instead would paint ticks over page
|
|
1296
|
+
* text. Word's web peers drop it on cramped viewports; so does this part, and it
|
|
1297
|
+
* returns as soon as the page fits again.
|
|
1134
1298
|
*
|
|
1135
1299
|
* @public
|
|
1136
1300
|
*/
|
|
@@ -1203,7 +1367,7 @@ declare function useNavigationPane(options?: UseNavigationPaneOptions): UseNavig
|
|
|
1203
1367
|
interface NavigationPartProps {
|
|
1204
1368
|
className?: string;
|
|
1205
1369
|
style?: CSSProperties;
|
|
1206
|
-
children?:
|
|
1370
|
+
children?: DocxEditorChildren;
|
|
1207
1371
|
}
|
|
1208
1372
|
/**
|
|
1209
1373
|
* The pane's title row. With no children it renders the close arrow and the title.
|
|
@@ -1276,7 +1440,7 @@ interface DocxEditorNavigationProps extends UseNavigationPaneOptions {
|
|
|
1276
1440
|
className?: string;
|
|
1277
1441
|
style?: CSSProperties;
|
|
1278
1442
|
/** Replaces the default composition (header, tabs, both panels). */
|
|
1279
|
-
children?:
|
|
1443
|
+
children?: DocxEditorChildren;
|
|
1280
1444
|
}
|
|
1281
1445
|
/**
|
|
1282
1446
|
* The document navigation pane — headings and find — over the left gutter.
|
|
@@ -1409,6 +1573,12 @@ interface NavigationShiftInput {
|
|
|
1409
1573
|
readonly reservation: number;
|
|
1410
1574
|
/** Padding already reserved at the inline end, for example by the review rail. */
|
|
1411
1575
|
readonly inlineEndReservation?: number;
|
|
1576
|
+
/**
|
|
1577
|
+
* Padding already standing at the inline START besides the shift itself — the review
|
|
1578
|
+
* gutter's mirrored strip. It moves the page exactly as the shift does, so a shift
|
|
1579
|
+
* computed without it lands the page that far past the reservation.
|
|
1580
|
+
*/
|
|
1581
|
+
readonly inlineStartReservation?: number;
|
|
1412
1582
|
/**
|
|
1413
1583
|
* Whether the page's WIDTH follows the padding right now.
|
|
1414
1584
|
*
|
|
@@ -1435,7 +1605,7 @@ interface NavigationShiftInput {
|
|
|
1435
1605
|
* document with no page setup) rather than guessing: shifting on a zero measurement would
|
|
1436
1606
|
* make the pane jump on the first frame and settle on the second.
|
|
1437
1607
|
*/
|
|
1438
|
-
declare function navigationShift({ viewportWidth, pageWidthPx, reservation, inlineEndReservation, docked, }: NavigationShiftInput): number;
|
|
1608
|
+
declare function navigationShift({ viewportWidth, pageWidthPx, reservation, inlineEndReservation, inlineStartReservation, docked, }: NavigationShiftInput): number;
|
|
1439
1609
|
|
|
1440
1610
|
/**
|
|
1441
1611
|
* The px the chrome is currently displaced by an open navigation pane. `0` when no pane
|
|
@@ -1461,6 +1631,8 @@ interface DocxEditorPageSetupDialogProps {
|
|
|
1461
1631
|
*/
|
|
1462
1632
|
declare function DocxEditorPageSetupDialog({ open, onClose, className, }: DocxEditorPageSetupDialogProps): ReactElement | null;
|
|
1463
1633
|
|
|
1634
|
+
/** Internal bridge from the batteries-included editor's `t` prop to this composition part. */
|
|
1635
|
+
declare const PageNumberTranslationContext: react.Context<((key: string) => string) | null>;
|
|
1464
1636
|
/** Props for `DocxEditor.PageNumber`. @public */
|
|
1465
1637
|
interface DocxEditorPageNumberProps {
|
|
1466
1638
|
/** Appended after the default page-number classes. */
|
|
@@ -1519,12 +1691,12 @@ interface HyperLinkPartProps {
|
|
|
1519
1691
|
asChild?: boolean;
|
|
1520
1692
|
/** Render nothing — inside the default arrangement this removes the part. */
|
|
1521
1693
|
hidden?: boolean;
|
|
1522
|
-
children?:
|
|
1694
|
+
children?: DocxEditorChildren;
|
|
1523
1695
|
}
|
|
1524
1696
|
/** Props for the action parts, which also take an icon. @public */
|
|
1525
1697
|
interface HyperLinkActionProps extends HyperLinkPartProps {
|
|
1526
1698
|
/** Icon override; falls back to `children`, then to the part's default glyph. */
|
|
1527
|
-
icon?:
|
|
1699
|
+
icon?: DocxEditorChildren;
|
|
1528
1700
|
}
|
|
1529
1701
|
/** Props for `DocxEditor.HyperLink`. @public */
|
|
1530
1702
|
interface HyperLinkProps extends HyperLinkPartProps {
|
|
@@ -1632,7 +1804,7 @@ declare function DocxEditorNotesChrome({ className, }: DocxEditorNotesChromeProp
|
|
|
1632
1804
|
/** Props for a packaged context-menu row. @public */
|
|
1633
1805
|
interface ContextMenuCommandProps {
|
|
1634
1806
|
/** Icon override. Defaults to the row's own Material Symbol. */
|
|
1635
|
-
icon?:
|
|
1807
|
+
icon?: DocxEditorChildren;
|
|
1636
1808
|
/** i18n key for the label, overriding the packaged one. */
|
|
1637
1809
|
labelKey?: string;
|
|
1638
1810
|
/** i18n key for the shortcut column, overriding the packaged one. */
|
|
@@ -1729,7 +1901,7 @@ interface ContextMenuItemProps {
|
|
|
1729
1901
|
* action, so the host's own catalogue resolves it. The packaged rows go the other way.
|
|
1730
1902
|
*/
|
|
1731
1903
|
label: string;
|
|
1732
|
-
icon?:
|
|
1904
|
+
icon?: DocxEditorChildren;
|
|
1733
1905
|
/** Right-aligned shortcut text, already resolved. */
|
|
1734
1906
|
shortcut?: string;
|
|
1735
1907
|
disabled?: boolean;
|
|
@@ -1769,7 +1941,7 @@ interface DocxEditorContextMenuProps {
|
|
|
1769
1941
|
disabled?: boolean;
|
|
1770
1942
|
/** Notified whenever the panel opens or closes. */
|
|
1771
1943
|
onOpenChange?: (open: boolean) => void;
|
|
1772
|
-
children?:
|
|
1944
|
+
children?: DocxEditorChildren;
|
|
1773
1945
|
}
|
|
1774
1946
|
/**
|
|
1775
1947
|
* The packaged right-click menu over the painted document.
|
|
@@ -1821,6 +1993,45 @@ interface ContextMenuAnchor {
|
|
|
1821
1993
|
readonly x: number;
|
|
1822
1994
|
readonly y: number;
|
|
1823
1995
|
}
|
|
1996
|
+
interface ContextMenuContextValue {
|
|
1997
|
+
/**
|
|
1998
|
+
* Close the panel. `restoreFocus` on the paths where the user is FINISHING with the menu
|
|
1999
|
+
* (selecting a row); not on the ones where they are already going elsewhere.
|
|
2000
|
+
*/
|
|
2001
|
+
readonly close: (restoreFocus?: boolean) => void;
|
|
2002
|
+
/** Non-null exactly while the panel is open. */
|
|
2003
|
+
readonly anchor: ContextMenuAnchor | null;
|
|
2004
|
+
/**
|
|
2005
|
+
* The table of contents this open was over, captured AT OPEN TIME.
|
|
2006
|
+
*
|
|
2007
|
+
* Read imperatively from the editor in the same event that opens the panel, not
|
|
2008
|
+
* subscribed to. The engine records the right-click target and the panel opens from the
|
|
2009
|
+
* same event, so a subscription is a render behind: the first right-click on a TOC drew
|
|
2010
|
+
* the menu without its rows and only a second one had them. It is also the more honest
|
|
2011
|
+
* shape — an open menu describes the gesture that opened it, whatever happens next.
|
|
2012
|
+
*/
|
|
2013
|
+
readonly tocId: string | null;
|
|
2014
|
+
/**
|
|
2015
|
+
* The element the opening right-click landed on, captured AT OPEN TIME like {@link tocId}.
|
|
2016
|
+
*
|
|
2017
|
+
* What lets a contextual row decide it applies — a custom-node chip, a painted marker —
|
|
2018
|
+
* without installing a second `contextmenu` listener that could disagree with the one
|
|
2019
|
+
* that opened the panel. Null while closed, and for keyboard-invoked opens, which have
|
|
2020
|
+
* no pointer target.
|
|
2021
|
+
*/
|
|
2022
|
+
readonly target: HTMLElement | null;
|
|
2023
|
+
/**
|
|
2024
|
+
* The browser's reason for refusing a clipboard READ, once one has actually been refused.
|
|
2025
|
+
*
|
|
2026
|
+
* Lives on the ROOT rather than in the Paste row because selecting that row closes the
|
|
2027
|
+
* panel, which unmounts the row — state kept there was written and discarded in the same
|
|
2028
|
+
* batch, so the row it was meant to disable came back enabled on the next right-click and
|
|
2029
|
+
* the documented behaviour never once happened. Firefox and Safari refuse every read, so
|
|
2030
|
+
* "ask once, then stop offering it" has to outlive one open.
|
|
2031
|
+
*/
|
|
2032
|
+
readonly clipboardRefusal: string | null;
|
|
2033
|
+
readonly reportClipboardRefusal: (reason: string) => void;
|
|
2034
|
+
}
|
|
1824
2035
|
/**
|
|
1825
2036
|
* The element the opening right-click landed on, or null while the menu is closed.
|
|
1826
2037
|
*
|
|
@@ -1836,11 +2047,11 @@ interface ContentControlPartProps {
|
|
|
1836
2047
|
className?: string;
|
|
1837
2048
|
asChild?: boolean;
|
|
1838
2049
|
hidden?: boolean;
|
|
1839
|
-
children?:
|
|
2050
|
+
children?: DocxEditorChildren;
|
|
1840
2051
|
}
|
|
1841
2052
|
/** Props for action parts that also take an icon. @public */
|
|
1842
2053
|
interface ContentControlActionProps extends ContentControlPartProps {
|
|
1843
|
-
icon?:
|
|
2054
|
+
icon?: DocxEditorChildren;
|
|
1844
2055
|
}
|
|
1845
2056
|
/** Props for `DocxEditor.ContentControl`. @public */
|
|
1846
2057
|
interface ContentControlProps extends ContentControlPartProps {
|
|
@@ -1868,6 +2079,7 @@ interface DocxEditorContentControlNamespace {
|
|
|
1868
2079
|
declare const DocxEditorContentControl: DocxEditorContentControlNamespace;
|
|
1869
2080
|
|
|
1870
2081
|
type EditorMode = 'edit' | 'view' | 'suggesting';
|
|
2082
|
+
|
|
1871
2083
|
/**
|
|
1872
2084
|
* Props for the React `DocxEditor`. The adapter is a thin renderer over the
|
|
1873
2085
|
* `Editor` contract; it holds no editing-engine state of its own and never
|
|
@@ -1890,8 +2102,8 @@ interface DocxEditorProps {
|
|
|
1890
2102
|
* toggle, Open/New/Save controls — and passes them in; the editor renders them
|
|
1891
2103
|
* verbatim on either side of the document title.
|
|
1892
2104
|
*/
|
|
1893
|
-
readonly renderTitleBarLeft?: () =>
|
|
1894
|
-
readonly renderTitleBarRight?: () =>
|
|
2105
|
+
readonly renderTitleBarLeft?: () => DocxEditorChildren;
|
|
2106
|
+
readonly renderTitleBarRight?: () => DocxEditorChildren;
|
|
1895
2107
|
/**
|
|
1896
2108
|
* Chrome colour mode. `'system'` follows the OS and re-resolves when it changes.
|
|
1897
2109
|
* Only the editor CHROME is themed — the document canvas stays Word-faithful.
|
|
@@ -2011,7 +2223,8 @@ interface DocxEditorProps {
|
|
|
2011
2223
|
* `DocxEditor.HorizontalRuler` / `DocxEditor.VerticalRuler` yourself.
|
|
2012
2224
|
*/
|
|
2013
2225
|
rulers?: boolean;
|
|
2014
|
-
/** A document to load: DOCX bytes or an existing handle.
|
|
2226
|
+
/** A document to load: DOCX bytes, `'blank'` for an empty one, or an existing handle.
|
|
2227
|
+
* Omitting it mounts NO document, which is not the same as an empty one. */
|
|
2015
2228
|
document?: DocumentSource;
|
|
2016
2229
|
/**
|
|
2017
2230
|
* The mode the editor opens in, matching the toolbar's three-state pill. Applied at
|
|
@@ -2047,7 +2260,7 @@ interface DocxEditorProps {
|
|
|
2047
2260
|
* `DocxEditorReview` from `@docx-editor.dev/pro/react`). For more control,
|
|
2048
2261
|
* compose `DocxEditor.Root`/`Viewport`/`Content` directly.
|
|
2049
2262
|
*/
|
|
2050
|
-
children?:
|
|
2263
|
+
children?: DocxEditorChildren;
|
|
2051
2264
|
className?: string;
|
|
2052
2265
|
/** Fired after the underlying `Editor` is created. */
|
|
2053
2266
|
onReady?: (editor: Editor) => void;
|
|
@@ -2068,7 +2281,8 @@ interface DocxEditorProps {
|
|
|
2068
2281
|
* mirrors capabilities the `Editor` contract already names.
|
|
2069
2282
|
*/
|
|
2070
2283
|
interface DocxEditorRef {
|
|
2071
|
-
/** Load a document: DOCX bytes or an existing handle.
|
|
2284
|
+
/** Load a document: DOCX bytes, `'blank'` for an empty one, or an existing handle.
|
|
2285
|
+
* No-op before mount. */
|
|
2072
2286
|
load(document: DocumentSource): void;
|
|
2073
2287
|
/** Serialize the current document; `null` when no editor is mounted. */
|
|
2074
2288
|
save(): Promise<ArrayBuffer | null>;
|
|
@@ -2107,6 +2321,8 @@ interface DocxEditorNamespace extends ForwardRefExoticComponent<DocxEditorProps
|
|
|
2107
2321
|
readonly Menu: typeof DocxEditorMenu;
|
|
2108
2322
|
/** Conditional loading screen: renders while there is no document to paint. */
|
|
2109
2323
|
readonly Loading: typeof DocxEditorLoading;
|
|
2324
|
+
readonly ColorByChangeType: typeof DocxEditorColorByChangeType;
|
|
2325
|
+
readonly AuthorStyle: typeof DocxEditorAuthorStyle;
|
|
2110
2326
|
/** Context-fed horizontal ruler with draggable margins (props-driven export stays). */
|
|
2111
2327
|
readonly HorizontalRuler: typeof DocxEditorHorizontalRuler;
|
|
2112
2328
|
/** Context-fed vertical ruler with draggable margins (props-driven export stays). */
|
|
@@ -2149,49 +2365,111 @@ interface DocxEditorNamespace extends ForwardRefExoticComponent<DocxEditorProps
|
|
|
2149
2365
|
}
|
|
2150
2366
|
declare const DocxEditor: DocxEditorNamespace;
|
|
2151
2367
|
|
|
2368
|
+
/** @internal Test seam — count of mounted {@link useEditorState} multiplexed subscriptions. */
|
|
2369
|
+
declare function editorStateActiveSubscriptionCount(): number;
|
|
2370
|
+
/** Optional lifecycle hooks for test instrumentation. @internal */
|
|
2371
|
+
interface UseEditorStateOptions {
|
|
2372
|
+
readonly onSubscribe?: () => void;
|
|
2373
|
+
readonly onUnsubscribe?: () => void;
|
|
2374
|
+
}
|
|
2152
2375
|
/**
|
|
2153
|
-
*
|
|
2154
|
-
*
|
|
2155
|
-
*
|
|
2156
|
-
*
|
|
2376
|
+
* Subscribe to a slice of the editor's read model. Re-renders the component ONLY when
|
|
2377
|
+
* `selector`'s result changes (by `isEqual`, default `Object.is`).
|
|
2378
|
+
*
|
|
2379
|
+
* Before the editor exists — outside a `DocxEditor.Root`, pre-mount, and on the
|
|
2380
|
+
* server — the selector receives a frozen loading snapshot (`isLoading: true`,
|
|
2381
|
+
* `page: {current: 0, total: 0}`), never `null`.
|
|
2157
2382
|
*
|
|
2158
2383
|
* @public
|
|
2159
2384
|
*/
|
|
2160
|
-
declare function
|
|
2385
|
+
declare function useEditorState<T>(selector: (snapshot: EditorSnapshot) => T, isEqual?: (a: T, b: T) => boolean, options?: UseEditorStateOptions): T;
|
|
2386
|
+
|
|
2161
2387
|
/**
|
|
2162
|
-
*
|
|
2388
|
+
* The scope class a chrome part should add to its own root element: the class
|
|
2389
|
+
* when nothing above it is scoped, an empty string when something already is.
|
|
2163
2390
|
*
|
|
2164
|
-
*
|
|
2165
|
-
*
|
|
2166
|
-
*
|
|
2167
|
-
*
|
|
2168
|
-
* 158px off centre beside an empty column.
|
|
2391
|
+
* ```tsx
|
|
2392
|
+
* const scope = useScopeClassName();
|
|
2393
|
+
* <div className={`${scope}docx-toolbar`} />
|
|
2394
|
+
* ```
|
|
2169
2395
|
*
|
|
2170
|
-
*
|
|
2171
|
-
* really on screen. Count rather than boolean: StrictMode mounts twice, and a host may
|
|
2172
|
-
* legitimately compose two rails.
|
|
2396
|
+
* Returns a trailing space so it concatenates cleanly, and `''` collapses away.
|
|
2173
2397
|
*/
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2398
|
+
declare function useScopeClassName(): '' | 'docx-editor ';
|
|
2399
|
+
|
|
2400
|
+
/** Full reservation: the 300px card column plus its 16px gutter off the page edge. */
|
|
2401
|
+
declare const REVIEW_PANE_GUTTER = 316;
|
|
2402
|
+
/** The marker strip: anchors and the add-comment button, no cards. */
|
|
2403
|
+
declare const REVIEW_MARKERS_GUTTER = 44;
|
|
2404
|
+
/** What the scroll container reserves on each edge, in px. */
|
|
2405
|
+
interface ReviewGutter {
|
|
2406
|
+
readonly inlineStart: number;
|
|
2407
|
+
readonly inlineEnd: number;
|
|
2177
2408
|
}
|
|
2178
|
-
|
|
2409
|
+
interface ReviewGutterInput {
|
|
2410
|
+
/** Whether the pane is showing its cards (`snapshot.reviewPaneOpen`). */
|
|
2411
|
+
readonly open: boolean;
|
|
2412
|
+
/** Client width of the scroll container. */
|
|
2413
|
+
readonly viewportWidth: number;
|
|
2414
|
+
/** The width the page is entitled to paint at — authored width times the entitled zoom. */
|
|
2415
|
+
readonly pageWidthPx: number;
|
|
2416
|
+
/**
|
|
2417
|
+
* Start-edge room OTHER chrome is asking for — an open navigation pane's reservation.
|
|
2418
|
+
* Without it the column judged only page-against-viewport, stood in the two-pane case,
|
|
2419
|
+
* and the pane's displacement then squeezed the fit below the page's entitlement — the
|
|
2420
|
+
* very symptom the measurement exists to remove. The STATIC ask (open pane × width),
|
|
2421
|
+
* never the pane's computed shift: the shift depends on this gutter, and reading it
|
|
2422
|
+
* back would close a cycle the two reservations then chase around.
|
|
2423
|
+
*/
|
|
2424
|
+
readonly inlineStartReservation?: number;
|
|
2425
|
+
/**
|
|
2426
|
+
* An uncapped fit is in force: the page fills whatever box it is given, so there is no
|
|
2427
|
+
* entitlement to measure the leftover against. The full column stands.
|
|
2428
|
+
*/
|
|
2429
|
+
readonly docked?: boolean;
|
|
2430
|
+
}
|
|
2431
|
+
/**
|
|
2432
|
+
* The paddings, in px, the scroll container reserves for the review rail.
|
|
2433
|
+
*
|
|
2434
|
+
* Returns the FULL column for a degenerate measurement (a viewport that has not been
|
|
2435
|
+
* laid out yet, a document with no page setup) rather than guessing: that is the value
|
|
2436
|
+
* the stylesheet fell back to before this measurement existed, so an unmeasured first
|
|
2437
|
+
* frame paints exactly as it always did and collapses only once there is a real width
|
|
2438
|
+
* to decide by.
|
|
2439
|
+
*/
|
|
2440
|
+
declare function reviewGutter({ open, viewportWidth, pageWidthPx, inlineStartReservation, docked, }: ReviewGutterInput): ReviewGutter;
|
|
2441
|
+
/**
|
|
2442
|
+
* The gutter the review rail reserves right now: nothing with no rail mounted, and the
|
|
2443
|
+
* measured `reviewGutter` pair otherwise. The one source for the scroll container's
|
|
2444
|
+
* paddings and both rulers.
|
|
2445
|
+
*
|
|
2446
|
+
* The result is reference-stable — the pure function answers with one of three shared
|
|
2447
|
+
* constants — and the hook stores THAT, never the raw width: a resize sweeps through
|
|
2448
|
+
* hundreds of widths that all resolve to the same constant, and holding the width as
|
|
2449
|
+
* state re-rendered every consumer (the review rail among them) once per pixel. Storing
|
|
2450
|
+
* the derived constant lets the state setter bail on identity, so consumers re-render
|
|
2451
|
+
* only when the reservation actually flips.
|
|
2452
|
+
*/
|
|
2453
|
+
declare function useReviewGutter(): ReviewGutter;
|
|
2179
2454
|
|
|
2180
2455
|
interface SlotProps extends HTMLAttributes<HTMLElement> {
|
|
2181
|
-
children?:
|
|
2456
|
+
children?: DocxEditorChildren;
|
|
2182
2457
|
/** Fanned out alongside the child's own ref. */
|
|
2183
2458
|
ref?: Ref<unknown>;
|
|
2459
|
+
className?: string;
|
|
2460
|
+
style?: CSSProperties;
|
|
2184
2461
|
}
|
|
2185
2462
|
/** Renders its single child element with the slot's props merged in. */
|
|
2186
2463
|
declare function Slot({ children, ...slotProps }: SlotProps): ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
|
|
2187
2464
|
|
|
2188
2465
|
interface LocaleProviderProps {
|
|
2189
2466
|
i18n?: Translations;
|
|
2190
|
-
children:
|
|
2467
|
+
children: DocxEditorChildren;
|
|
2191
2468
|
}
|
|
2192
2469
|
declare function LocaleProvider({ i18n, children }: LocaleProviderProps): react.JSX.Element;
|
|
2193
2470
|
declare function useTranslation(): {
|
|
2194
2471
|
t: TFunction;
|
|
2472
|
+
catalogue: LocaleStrings;
|
|
2195
2473
|
};
|
|
2196
2474
|
|
|
2197
2475
|
/**
|
|
@@ -2300,6 +2578,15 @@ interface UseHyperlinkPopupResult {
|
|
|
2300
2578
|
*/
|
|
2301
2579
|
openTarget: () => boolean;
|
|
2302
2580
|
}
|
|
2581
|
+
/**
|
|
2582
|
+
* A field-derived link (a `HYPERLINK` field's instruction) rather than a typed
|
|
2583
|
+
* `w:hyperlink`. Structurally signalled: the field registry mints every record with no
|
|
2584
|
+
* addressable range (`paragraphId` stays empty), because no `w:hyperlink` node backs it.
|
|
2585
|
+
* The typed editing lane (edit / unlink) can never resolve its id, so chrome offers neither
|
|
2586
|
+
* action. Caret dismissal DOES apply: the field is a one-unit atom, and `fieldLinkAtCaret`
|
|
2587
|
+
* resolves the caret onto it (boundary-inclusive) so the panel closes when the caret leaves.
|
|
2588
|
+
*/
|
|
2589
|
+
declare function isFieldLink(link: SurfaceHyperlink): boolean;
|
|
2303
2590
|
/**
|
|
2304
2591
|
* The hyperlink popover's behavior.
|
|
2305
2592
|
*
|
|
@@ -2330,7 +2617,16 @@ type DocxFontsInput = FontConfiguration | FontConfigurationFragment;
|
|
|
2330
2617
|
* @public
|
|
2331
2618
|
*/
|
|
2332
2619
|
type DocxFontsSource = DocxFontsInput | Promise<DocxFontsInput> | (() => DocxFontsInput | Promise<DocxFontsInput>);
|
|
2333
|
-
/**
|
|
2620
|
+
/**
|
|
2621
|
+
* What the document itself can be: a URL to fetch, or bytes already in hand.
|
|
2622
|
+
*
|
|
2623
|
+
* A string here is ALWAYS a URL — this hook exists to fetch one. That is the opposite of
|
|
2624
|
+
* the `document` prop, whose `DocumentSource` reads the string `'blank'` as Word's blank
|
|
2625
|
+
* template; `useDocxSource('blank')` would request `./blank` and report the 404. There is
|
|
2626
|
+
* nothing to fetch for an empty document, so pass `'blank'` straight to `document`.
|
|
2627
|
+
*
|
|
2628
|
+
* @public
|
|
2629
|
+
*/
|
|
2334
2630
|
type DocxSource = string | URL | Uint8Array | ArrayBuffer;
|
|
2335
2631
|
/** Options for {@link useDocxSource}. @public */
|
|
2336
2632
|
interface UseDocxSourceOptions {
|
|
@@ -2501,22 +2797,33 @@ declare function useContentControl(): UseContentControlResult;
|
|
|
2501
2797
|
*/
|
|
2502
2798
|
declare function useContentControlInstance(): UseContentControlResult;
|
|
2503
2799
|
|
|
2504
|
-
/** Optional lifecycle hooks for test instrumentation. @internal */
|
|
2505
|
-
interface UseEditorStateOptions {
|
|
2506
|
-
readonly onSubscribe?: () => void;
|
|
2507
|
-
readonly onUnsubscribe?: () => void;
|
|
2508
|
-
}
|
|
2509
2800
|
/**
|
|
2510
|
-
*
|
|
2511
|
-
* `
|
|
2801
|
+
* Every author the review surface DRAWS, in Word's slot order, with the colour and style
|
|
2802
|
+
* each resolves to. `[]` before an editor or document exists.
|
|
2512
2803
|
*
|
|
2513
|
-
*
|
|
2514
|
-
*
|
|
2515
|
-
*
|
|
2804
|
+
* Both halves of review: authors of tracked changes first, numbered by where their first
|
|
2805
|
+
* change appears, then authors who only commented. One person is one colour across the two.
|
|
2806
|
+
*
|
|
2807
|
+
* A read of the rendered projection, not of the package: a resolved view hides the
|
|
2808
|
+
* revisions it has resolved away, so an author whose only change is hidden there is listed
|
|
2809
|
+
* only if they also commented.
|
|
2810
|
+
*
|
|
2811
|
+
* The array is reference-stable between changes (the facade caches per layout and colour
|
|
2812
|
+
* state), so it is safe as a dependency and under `useSyncExternalStore`.
|
|
2813
|
+
*
|
|
2814
|
+
* Pairs with the declarative components: read the roster here, declare the styling as
|
|
2815
|
+
* `<DocxEditor.AuthorStyle>` elements.
|
|
2816
|
+
*
|
|
2817
|
+
* ```tsx
|
|
2818
|
+
* const authors = useReviewAuthors();
|
|
2819
|
+
* authors.map(({ author }) => (
|
|
2820
|
+
* <DocxEditor.AuthorStyle key={author} author={author} color={myTeam[author]?.color} />
|
|
2821
|
+
* ));
|
|
2822
|
+
* ```
|
|
2516
2823
|
*
|
|
2517
2824
|
* @public
|
|
2518
2825
|
*/
|
|
2519
|
-
declare function
|
|
2826
|
+
declare function useReviewAuthors(): readonly ReviewAuthorInfo[];
|
|
2520
2827
|
|
|
2521
2828
|
/** What {@link useZoom} answers. @public */
|
|
2522
2829
|
interface UseZoomResult {
|
|
@@ -2634,6 +2941,23 @@ declare function useEditorValueCommand(slotId: 'image.wrap'): EditorValueCommand
|
|
|
2634
2941
|
*/
|
|
2635
2942
|
declare function useEditorValueCommand(slotId: 'image.altText'): EditorValueCommandState<string>;
|
|
2636
2943
|
|
|
2944
|
+
/** @public */
|
|
2945
|
+
type DocxEditorRefCallback<T> = (node: T | null) => void;
|
|
2946
|
+
|
|
2947
|
+
type AnchorPlacement = 'before' | 'after' | 'story-label';
|
|
2948
|
+
interface ScopedChromeAnchor {
|
|
2949
|
+
readonly ref: DocxEditorRefCallback<HTMLDivElement>;
|
|
2950
|
+
readonly style: CSSProperties;
|
|
2951
|
+
}
|
|
2952
|
+
/**
|
|
2953
|
+
* Attach contextual chrome to a painted story instead of the top of the editor viewport.
|
|
2954
|
+
*
|
|
2955
|
+
* The engine owns and may replace everything inside the paginated surface, so React cannot
|
|
2956
|
+
* portal controls into a header, footer, or note node. This hook keeps the controls as a
|
|
2957
|
+
* sibling overlay and derives only their screen placement from the current painted host.
|
|
2958
|
+
*/
|
|
2959
|
+
declare function useScopedChromeAnchor(findAnchor: (viewport: HTMLElement) => HTMLElement | null, placement: AnchorPlacement): ScopedChromeAnchor;
|
|
2960
|
+
|
|
2637
2961
|
/**
|
|
2638
2962
|
* Subscribe to an editor event (`'change'`, `'selectionChange'`, `'error'`, …) for the
|
|
2639
2963
|
* lifetime of the component. No-op until the nearest `DocxEditor.Root` has created the
|
|
@@ -2777,6 +3101,8 @@ interface PaginatedDocxEditorHandle {
|
|
|
2777
3101
|
/** Serialize the current document. */
|
|
2778
3102
|
save(): Uint8Array | null;
|
|
2779
3103
|
}
|
|
3104
|
+
/** Vue name for the same handle contract. @public */
|
|
3105
|
+
type PaginatedDocxEditorExpose = PaginatedDocxEditorHandle;
|
|
2780
3106
|
declare function PaginatedDocxEditor({ source, scale, measurer, onStateChange, onError, className, documentFontFamily, ref, }: PaginatedDocxEditorProps): react.JSX.Element;
|
|
2781
3107
|
|
|
2782
3108
|
interface PaginatedDocxEditorShellProps {
|
|
@@ -2796,8 +3122,8 @@ interface PaginatedDocxEditorShellProps {
|
|
|
2796
3122
|
* They belong to whoever embeds the editor — a demo's switchers are not editor chrome, and
|
|
2797
3123
|
* baking them in would ship them to every consumer.
|
|
2798
3124
|
*/
|
|
2799
|
-
readonly renderTitleBarLeft?: () =>
|
|
2800
|
-
readonly renderTitleBarRight?: () =>
|
|
3125
|
+
readonly renderTitleBarLeft?: () => DocxEditorChildren;
|
|
3126
|
+
readonly renderTitleBarRight?: () => DocxEditorChildren;
|
|
2801
3127
|
/** Commands, forwarded from the editor the shell hosts. */
|
|
2802
3128
|
readonly ref?: Ref<PaginatedDocxEditorHandle>;
|
|
2803
3129
|
/** Applies the editor's own dark palette; the document canvas stays Word-faithful. */
|
|
@@ -2808,207 +3134,47 @@ interface PaginatedDocxEditorShellProps {
|
|
|
2808
3134
|
readonly documentFontFamily?: string;
|
|
2809
3135
|
readonly className?: string;
|
|
2810
3136
|
}
|
|
3137
|
+
/** @deprecated Use `<DocxEditor>` from the composition layer instead. */
|
|
2811
3138
|
declare function PaginatedDocxEditorShell({ source, scale, measurer, documentName, onStateChange, onError, onSave, renderTitleBarLeft, renderTitleBarRight, ref, colorMode, onZoomChange, documentFontFamily, className, }: PaginatedDocxEditorShellProps): react.JSX.Element;
|
|
2812
3139
|
|
|
2813
3140
|
/**
|
|
2814
|
-
*
|
|
2815
|
-
*
|
|
2816
|
-
* Margins are the grey zones at either end; dragging the grey/white boundary moves them.
|
|
2817
|
-
*
|
|
2818
|
-
* The indent handles are Word's, not Google's three:
|
|
2819
|
-
*
|
|
2820
|
-
* ▽ first line at leftMargin + left + firstLine
|
|
2821
|
-
* △ hanging at leftMargin + left — drags `left`, PINS the first-line marker
|
|
2822
|
-
* ▭ left box at leftMargin + left — drags `left`, TAKES the first line with it
|
|
2823
|
-
* △ right at pageWidth - rightMargin - right
|
|
2824
|
-
*
|
|
2825
|
-
* The hanging triangle and the left box are coincident horizontally, as in Word, and are
|
|
2826
|
-
* separated vertically instead — the box sits below the strip. They differ only in what a
|
|
2827
|
-
* drag takes with them.
|
|
3141
|
+
* Paragraph-style preview + option resolution — shared between the React and
|
|
3142
|
+
* Vue toolbars so the style-picker dropdown looks and behaves identically.
|
|
2828
3143
|
*
|
|
2829
|
-
*
|
|
2830
|
-
*
|
|
3144
|
+
* Pure logic only: no i18n and no framework CSS types. The returned preview is
|
|
3145
|
+
* a plain `{ fontSize, lineHeight, fontWeight?, fontStyle?, color? }` object,
|
|
3146
|
+
* which is structurally assignable to both React's `CSSProperties` and Vue's
|
|
3147
|
+
* inline-style record, so neither adapter needs a cast. Name localization stays
|
|
3148
|
+
* in the adapters (they own the i18n `t()` boundary).
|
|
3149
|
+
* @packageDocumentation
|
|
3150
|
+
* @public
|
|
2831
3151
|
*/
|
|
2832
3152
|
|
|
2833
3153
|
/**
|
|
2834
|
-
*
|
|
2835
|
-
*
|
|
3154
|
+
* One entry of `Editor.getDocumentStyles()` — the engine's document-style
|
|
3155
|
+
* summary the picker consumes. Derived from the contract, not re-declared.
|
|
3156
|
+
* @public
|
|
2836
3157
|
*/
|
|
2837
|
-
type
|
|
3158
|
+
type DocumentStyleSummary = ReturnType<Editor['getDocumentStyles']>[number];
|
|
3159
|
+
|
|
2838
3160
|
/**
|
|
2839
|
-
*
|
|
2840
|
-
*
|
|
3161
|
+
* The paragraph alignments this control understands, in OOXML `w:jc`
|
|
3162
|
+
* vocabulary (`both` is Word's justify; `distribute` renders as justify).
|
|
3163
|
+
* Presentation-only: the dropdown emits the first four.
|
|
2841
3164
|
*/
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
/**
|
|
2856
|
-
* Paint the four indent handles.
|
|
2857
|
-
*
|
|
2858
|
-
* Off by default so a ruler with no paragraph context does not show handles pinned at
|
|
2859
|
-
* zero. When on they are painted whatever `indentEditable` says: Word shows the markers
|
|
2860
|
-
* on a read-only document and simply refuses the drag, and hiding them would remove the
|
|
2861
|
-
* only place a reader can see a paragraph's indents.
|
|
2862
|
-
*/
|
|
2863
|
-
showIndentHandles?: boolean;
|
|
2864
|
-
/** The paragraph's indent in twips; `firstLine` is SIGNED, negative for a hanging. */
|
|
2865
|
-
indent?: RulerIndent | null;
|
|
2866
|
-
/** Whether the INDENT handles drag — a different capability from `editable`. */
|
|
2867
|
-
indentEditable?: boolean;
|
|
2868
|
-
/** Fires continuously through an indent drag, for the host to preview. */
|
|
2869
|
-
onIndentChange?: (indent: RulerIndent) => void;
|
|
2870
|
-
/** Fires when an indent drag is released — the moment to commit one undoable step. */
|
|
2871
|
-
onIndentDragEnd?: () => void;
|
|
2872
|
-
unit?: 'inch' | 'cm';
|
|
2873
|
-
className?: string;
|
|
2874
|
-
style?: CSSProperties;
|
|
2875
|
-
tabMarks?: RulerTabStop[] | null;
|
|
2876
|
-
onTabMarkRemove?: (positionTwips: number) => void;
|
|
2877
|
-
}
|
|
2878
|
-
declare function HorizontalRuler({ pageSetup, zoom, editable, onLeftMarginChange, onRightMarginChange, onMarginDragEnd, showIndentHandles, indent, indentEditable, onIndentChange, onIndentDragEnd, unit, className, style, tabMarks, onTabMarkRemove, }: HorizontalRulerProps$1): react__default.ReactElement;
|
|
2879
|
-
|
|
2880
|
-
/**
|
|
2881
|
-
* One heading of the engine's outline (`Editor.getOutline()`): text, level,
|
|
2882
|
-
* and the block id `Editor.scrollToBlock` accepts. Derived from the contract.
|
|
2883
|
-
*/
|
|
2884
|
-
type OutlineHeading = ReturnType<Editor['getOutline']>[number];
|
|
2885
|
-
|
|
2886
|
-
/** One tracked change as the engine reports it (`Editor.getTrackedChanges()`). */
|
|
2887
|
-
type TrackedChangeSummary = ReturnType<Editor['getTrackedChanges']>[number];
|
|
2888
|
-
interface ScrollPageInfo {
|
|
2889
|
-
currentPage: number;
|
|
2890
|
-
totalPages: number;
|
|
2891
|
-
visible: boolean;
|
|
2892
|
-
}
|
|
2893
|
-
interface HorizontalRulerProps {
|
|
2894
|
-
pageSetup: RulerPageSetup | undefined;
|
|
2895
|
-
zoom: number;
|
|
2896
|
-
unit: 'inch' | 'cm';
|
|
2897
|
-
editable: boolean;
|
|
2898
|
-
onLeftMarginChange: (marginTwips: number) => void;
|
|
2899
|
-
onRightMarginChange: (marginTwips: number) => void;
|
|
2900
|
-
tabMarks: RulerTabStop[] | null;
|
|
2901
|
-
onTabMarkRemove: (positionTwips: number) => void;
|
|
2902
|
-
}
|
|
2903
|
-
interface VerticalRulerProps$1 {
|
|
2904
|
-
pageSetup: RulerPageSetup | undefined;
|
|
2905
|
-
zoom: number;
|
|
2906
|
-
unit: 'inch' | 'cm';
|
|
2907
|
-
editable: boolean;
|
|
2908
|
-
onTopMarginChange: (marginTwips: number) => void;
|
|
2909
|
-
onBottomMarginChange: (marginTwips: number) => void;
|
|
2910
|
-
}
|
|
2911
|
-
interface OutlineProps {
|
|
2912
|
-
headings: readonly OutlineHeading[];
|
|
2913
|
-
onHeadingClick: (blockId: string) => void;
|
|
2914
|
-
onClose: () => void;
|
|
2915
|
-
topOffset: number;
|
|
2916
|
-
scrollLeft: number;
|
|
2917
|
-
}
|
|
2918
|
-
/**
|
|
2919
|
-
* Outer chrome of the editor: i18n + error provider wrappers, the
|
|
2920
|
-
* scroll container with its background-click handler, horizontal and
|
|
2921
|
-
* vertical rulers, the floating page indicator, document outline panel
|
|
2922
|
-
* + toggle button, plus slots for the toolbar, paged-area body,
|
|
2923
|
-
* overlays, dialogs, and hidden file inputs.
|
|
2924
|
-
*
|
|
2925
|
-
* The expanded-sidebar-item highlight styles are computed here from
|
|
2926
|
-
* `expandedSidebarItem` + `trackedChanges` because they need to live
|
|
2927
|
-
* inside the editor-content `<div>` for proper scoping.
|
|
2928
|
-
*/
|
|
2929
|
-
declare function DocxEditorShell({ i18n, isDark, onEditorError, containerRef, scrollContainerRef, editorContentRef, className, containerStyle, mainContentStyle, editorContainerStyle, showRuler, readOnlyProp, showOutline, showOutlineButton, sidebarOpen, minLayoutWidth, toolbarHeight, editorScrollLeft, expandedSidebarItem, trackedChanges, onScrollContainerMouseDown, onEditorBgMouseDown, onEditorContextMenu, horizontalRulerProps, verticalRulerProps, outlineProps, onToggleOutline, scrollPageInfo, toolbar, pagedArea, overlays, dialogs, fileInputs, }: {
|
|
2930
|
-
i18n: React.ComponentProps<typeof LocaleProvider>['i18n'];
|
|
2931
|
-
isDark?: boolean;
|
|
2932
|
-
onEditorError: (error: Error) => void;
|
|
2933
|
-
containerRef: React.Ref<HTMLDivElement>;
|
|
2934
|
-
scrollContainerRef: React.Ref<HTMLDivElement>;
|
|
2935
|
-
editorContentRef: React.Ref<HTMLDivElement>;
|
|
2936
|
-
className: string | undefined;
|
|
2937
|
-
containerStyle: CSSProperties;
|
|
2938
|
-
mainContentStyle: CSSProperties;
|
|
2939
|
-
editorContainerStyle: CSSProperties;
|
|
2940
|
-
showRuler: boolean;
|
|
2941
|
-
readOnlyProp: boolean | undefined;
|
|
2942
|
-
showOutline: boolean;
|
|
2943
|
-
showOutlineButton: boolean;
|
|
2944
|
-
sidebarOpen: boolean;
|
|
2945
|
-
minLayoutWidth: number;
|
|
2946
|
-
toolbarHeight: number;
|
|
2947
|
-
editorScrollLeft: number;
|
|
2948
|
-
expandedSidebarItem: string | null;
|
|
2949
|
-
trackedChanges: readonly TrackedChangeSummary[];
|
|
2950
|
-
onScrollContainerMouseDown: (e: React.MouseEvent) => void;
|
|
2951
|
-
onEditorBgMouseDown: (e: React.MouseEvent) => void;
|
|
2952
|
-
onEditorContextMenu: (e: React.MouseEvent) => void;
|
|
2953
|
-
horizontalRulerProps: HorizontalRulerProps;
|
|
2954
|
-
verticalRulerProps: VerticalRulerProps$1;
|
|
2955
|
-
outlineProps: OutlineProps;
|
|
2956
|
-
onToggleOutline: () => void;
|
|
2957
|
-
scrollPageInfo: ScrollPageInfo;
|
|
2958
|
-
toolbar: ReactNode;
|
|
2959
|
-
pagedArea: ReactNode;
|
|
2960
|
-
overlays: ReactNode;
|
|
2961
|
-
dialogs: ReactNode;
|
|
2962
|
-
fileInputs: ReactNode;
|
|
2963
|
-
}): react.JSX.Element;
|
|
2964
|
-
|
|
2965
|
-
/**
|
|
2966
|
-
* Paragraph-style preview + option resolution — shared between the React and
|
|
2967
|
-
* Vue toolbars so the style-picker dropdown looks and behaves identically.
|
|
2968
|
-
*
|
|
2969
|
-
* Pure logic only: no i18n and no framework CSS types. The returned preview is
|
|
2970
|
-
* a plain `{ fontSize, lineHeight, fontWeight?, fontStyle?, color? }` object,
|
|
2971
|
-
* which is structurally assignable to both React's `CSSProperties` and Vue's
|
|
2972
|
-
* inline-style record, so neither adapter needs a cast. Name localization stays
|
|
2973
|
-
* in the adapters (they own the i18n `t()` boundary).
|
|
2974
|
-
* @packageDocumentation
|
|
2975
|
-
* @public
|
|
2976
|
-
*/
|
|
2977
|
-
|
|
2978
|
-
/**
|
|
2979
|
-
* One entry of `Editor.getDocumentStyles()` — the engine's document-style
|
|
2980
|
-
* summary the picker consumes. Derived from the contract, not re-declared.
|
|
2981
|
-
* @public
|
|
2982
|
-
*/
|
|
2983
|
-
type DocumentStyleSummary = ReturnType<Editor['getDocumentStyles']>[number];
|
|
2984
|
-
|
|
2985
|
-
/**
|
|
2986
|
-
* Alignment Dropdown Component (Google Docs style)
|
|
2987
|
-
*
|
|
2988
|
-
* A single dropdown button for paragraph alignment controls:
|
|
2989
|
-
* - Shows current alignment icon + chevron
|
|
2990
|
-
* - Opens a floating panel with Left, Center, Right, Justify options
|
|
2991
|
-
* - Active option is highlighted
|
|
2992
|
-
*/
|
|
2993
|
-
|
|
2994
|
-
/**
|
|
2995
|
-
* The paragraph alignments this control understands, in OOXML `w:jc`
|
|
2996
|
-
* vocabulary (`both` is Word's justify; `distribute` renders as justify).
|
|
2997
|
-
* Presentation-only: the dropdown emits the first four.
|
|
2998
|
-
*/
|
|
2999
|
-
type ParagraphAlignment = 'left' | 'center' | 'right' | 'both' | 'distribute';
|
|
3000
|
-
|
|
3001
|
-
/**
|
|
3002
|
-
* Shared FontOption shape + normaliser used by FontPicker components
|
|
3003
|
-
* in both adapters. Lifted from packages/react/src/components/ui/
|
|
3004
|
-
* normalizeFontFamilies.ts so the type definition has a single home.
|
|
3005
|
-
* @packageDocumentation
|
|
3006
|
-
* @public
|
|
3007
|
-
*/
|
|
3008
|
-
interface FontOption {
|
|
3009
|
-
name: string;
|
|
3010
|
-
fontFamily: string;
|
|
3011
|
-
category?: 'sans-serif' | 'serif' | 'monospace' | 'other';
|
|
3165
|
+
type ParagraphAlignment = 'left' | 'center' | 'right' | 'both' | 'distribute';
|
|
3166
|
+
|
|
3167
|
+
/**
|
|
3168
|
+
* Shared FontOption shape + normaliser used by FontPicker components
|
|
3169
|
+
* in both adapters. Lifted from packages/react/src/components/ui/
|
|
3170
|
+
* normalizeFontFamilies.ts so the type definition has a single home.
|
|
3171
|
+
* @packageDocumentation
|
|
3172
|
+
* @public
|
|
3173
|
+
*/
|
|
3174
|
+
interface FontOption {
|
|
3175
|
+
name: string;
|
|
3176
|
+
fontFamily: string;
|
|
3177
|
+
category?: 'sans-serif' | 'serif' | 'monospace' | 'other';
|
|
3012
3178
|
}
|
|
3013
3179
|
|
|
3014
3180
|
/**
|
|
@@ -3028,19 +3194,6 @@ interface ListState {
|
|
|
3028
3194
|
numId?: number;
|
|
3029
3195
|
}
|
|
3030
3196
|
|
|
3031
|
-
/**
|
|
3032
|
-
* TableToolbar Component
|
|
3033
|
-
*
|
|
3034
|
-
* Provides controls for editing tables:
|
|
3035
|
-
* - Add row above/below
|
|
3036
|
-
* - Add column left/right
|
|
3037
|
-
* - Delete row/column
|
|
3038
|
-
* - Merge cells
|
|
3039
|
-
* - Split cell
|
|
3040
|
-
*
|
|
3041
|
-
* Shows when cursor is in a table.
|
|
3042
|
-
*/
|
|
3043
|
-
|
|
3044
3197
|
/**
|
|
3045
3198
|
* Table editing action types
|
|
3046
3199
|
*/
|
|
@@ -3099,18 +3252,6 @@ type TableAction = 'addRowAbove' | 'addRowBelow' | 'addColumnLeft' | 'addColumnR
|
|
|
3099
3252
|
styleId: string;
|
|
3100
3253
|
};
|
|
3101
3254
|
|
|
3102
|
-
/**
|
|
3103
|
-
* Toolbar Component
|
|
3104
|
-
*
|
|
3105
|
-
* The customizable formatting rail — undo/redo, zoom, styles, fonts,
|
|
3106
|
-
* bold/italic/underline, colors, alignment, lists, table/image context,
|
|
3107
|
-
* clear formatting. Used standalone (`<Toolbar ...props>`), inside
|
|
3108
|
-
* `<EditorToolbar>` (reads from context via `EditorToolbar.Toolbar`), or
|
|
3109
|
-
* embedded inline. Also the home of the `ToolbarButton` / `ToolbarGroup` /
|
|
3110
|
-
* `ToolbarSeparator` primitives and the shared `FormattingAction` /
|
|
3111
|
-
* `SelectionFormatting` / `ToolbarProps` types.
|
|
3112
|
-
*/
|
|
3113
|
-
|
|
3114
3255
|
/**
|
|
3115
3256
|
* Current formatting state of the selection
|
|
3116
3257
|
*/
|
|
@@ -3175,6 +3316,7 @@ type FormattingAction = 'bold' | 'italic' | 'underline' | 'strikethrough' | 'sup
|
|
|
3175
3316
|
};
|
|
3176
3317
|
/**
|
|
3177
3318
|
* Props for the Toolbar (formatting rail) component
|
|
3319
|
+
* @deprecated Use `DocxEditor.Toolbar` from the composition layer instead.
|
|
3178
3320
|
*/
|
|
3179
3321
|
interface ToolbarProps {
|
|
3180
3322
|
/** Current formatting of the selection */
|
|
@@ -3198,9 +3340,9 @@ interface ToolbarProps {
|
|
|
3198
3340
|
/** Whether to enable keyboard shortcuts (default: true) */
|
|
3199
3341
|
enableShortcuts?: boolean;
|
|
3200
3342
|
/** Ref to the editor container for keyboard events */
|
|
3201
|
-
editorRef?:
|
|
3343
|
+
editorRef?: RefObject<HTMLElement>;
|
|
3202
3344
|
/** Custom toolbar items to render at the end */
|
|
3203
|
-
children?:
|
|
3345
|
+
children?: DocxEditorChildren;
|
|
3204
3346
|
/** When true, renders with display:contents so children flow in the parent flex container */
|
|
3205
3347
|
inline?: boolean;
|
|
3206
3348
|
/** Whether to show font family picker (default: true) */
|
|
@@ -3338,30 +3480,197 @@ interface ToolbarGroupProps {
|
|
|
3338
3480
|
/**
|
|
3339
3481
|
* Individual toolbar button with shadcn styling
|
|
3340
3482
|
*/
|
|
3483
|
+
/** @deprecated Use `DocxEditor.Toolbar` button parts instead. */
|
|
3341
3484
|
declare function ToolbarButton({ active, disabled, title, onClick, children, className, ariaLabel, }: ToolbarButtonProps): react__default.JSX.Element;
|
|
3342
3485
|
/**
|
|
3343
3486
|
* Toolbar button group with modern styling
|
|
3344
3487
|
*/
|
|
3488
|
+
/** @deprecated Use `DocxEditor.Toolbar` group parts instead. */
|
|
3345
3489
|
declare function ToolbarGroup({ label, children, className }: ToolbarGroupProps): react__default.JSX.Element;
|
|
3346
3490
|
/**
|
|
3347
3491
|
* Icon-based formatting toolbar — undo/redo, zoom, styles, fonts,
|
|
3348
3492
|
* bold/italic/underline, colors, alignment, lists, table/image context, clear formatting.
|
|
3349
3493
|
*/
|
|
3494
|
+
/** @deprecated Use `DocxEditor.Toolbar` from the composition layer instead. */
|
|
3350
3495
|
declare function Toolbar(explicitProps: ToolbarProps): react__default.JSX.Element;
|
|
3351
3496
|
|
|
3352
3497
|
/**
|
|
3353
|
-
*
|
|
3498
|
+
* The horizontal ruler — page margins plus Word's four indent handles.
|
|
3499
|
+
*
|
|
3500
|
+
* Margins are the grey zones at either end; dragging the grey/white boundary moves them.
|
|
3501
|
+
*
|
|
3502
|
+
* The indent handles are Word's, not Google's three:
|
|
3503
|
+
*
|
|
3504
|
+
* ▽ first line at leftMargin + left + firstLine
|
|
3505
|
+
* △ hanging at leftMargin + left — drags `left`, PINS the first-line marker
|
|
3506
|
+
* ▭ left box at leftMargin + left — drags `left`, TAKES the first line with it
|
|
3507
|
+
* △ right at pageWidth - rightMargin - right
|
|
3354
3508
|
*
|
|
3355
|
-
*
|
|
3356
|
-
*
|
|
3357
|
-
*
|
|
3358
|
-
*
|
|
3359
|
-
*
|
|
3509
|
+
* The hanging triangle and the left box are coincident horizontally, as in Word, and are
|
|
3510
|
+
* separated vertically instead — the box sits below the strip. They differ only in what a
|
|
3511
|
+
* drag takes with them.
|
|
3512
|
+
*
|
|
3513
|
+
* All the arithmetic lives in the engine (`ruler-indent.ts`), including the snap grid and
|
|
3514
|
+
* the clamps, so this file only converts pixels to twips and paints.
|
|
3515
|
+
*/
|
|
3516
|
+
|
|
3517
|
+
/**
|
|
3518
|
+
* Section page setup as the engine reports it (`Editor.getPageSetup()`) —
|
|
3519
|
+
* page size, orientation, and margins, in twips. Derived from the contract.
|
|
3520
|
+
*/
|
|
3521
|
+
type RulerPageSetup = NonNullable<ReturnType<Editor['getPageSetup']>>;
|
|
3522
|
+
/**
|
|
3523
|
+
* A tab stop the ruler paints. `position` is twips from the left margin edge —
|
|
3524
|
+
* the same value the `removeTabMark` command takes as `positionTwips`.
|
|
3525
|
+
*/
|
|
3526
|
+
interface RulerTabStop {
|
|
3527
|
+
position: number;
|
|
3528
|
+
alignment: 'left' | 'center' | 'right' | 'decimal' | 'bar';
|
|
3529
|
+
}
|
|
3530
|
+
interface HorizontalRulerProps$1 {
|
|
3531
|
+
pageSetup?: RulerPageSetup | null;
|
|
3532
|
+
zoom?: number;
|
|
3533
|
+
/** Whether the MARGIN handles drag. */
|
|
3534
|
+
editable?: boolean;
|
|
3535
|
+
onLeftMarginChange?: (marginTwips: number) => void;
|
|
3536
|
+
onRightMarginChange?: (marginTwips: number) => void;
|
|
3537
|
+
/** Fires when a margin drag is released — the moment to commit what the drag previewed. */
|
|
3538
|
+
onMarginDragEnd?: () => void;
|
|
3539
|
+
/**
|
|
3540
|
+
* Paint the four indent handles.
|
|
3541
|
+
*
|
|
3542
|
+
* Off by default so a ruler with no paragraph context does not show handles pinned at
|
|
3543
|
+
* zero. When on they are painted whatever `indentEditable` says: Word shows the markers
|
|
3544
|
+
* on a read-only document and simply refuses the drag, and hiding them would remove the
|
|
3545
|
+
* only place a reader can see a paragraph's indents.
|
|
3546
|
+
*/
|
|
3547
|
+
showIndentHandles?: boolean;
|
|
3548
|
+
/** The paragraph's indent in twips; `firstLine` is SIGNED, negative for a hanging. */
|
|
3549
|
+
indent?: RulerIndent | null;
|
|
3550
|
+
/** Whether the INDENT handles drag — a different capability from `editable`. */
|
|
3551
|
+
indentEditable?: boolean;
|
|
3552
|
+
/** Fires continuously through an indent drag, for the host to preview. */
|
|
3553
|
+
onIndentChange?: (indent: RulerIndent) => void;
|
|
3554
|
+
/** Fires when an indent drag is released — the moment to commit one undoable step. */
|
|
3555
|
+
onIndentDragEnd?: () => void;
|
|
3556
|
+
unit?: 'inch' | 'cm';
|
|
3557
|
+
className?: string;
|
|
3558
|
+
style?: CSSProperties;
|
|
3559
|
+
tabMarks?: RulerTabStop[] | null;
|
|
3560
|
+
onTabMarkRemove?: (positionTwips: number) => void;
|
|
3561
|
+
}
|
|
3562
|
+
declare function HorizontalRuler({ pageSetup, zoom, editable, onLeftMarginChange, onRightMarginChange, onMarginDragEnd, showIndentHandles, indent, indentEditable, onIndentChange, onIndentDragEnd, unit, className, style, tabMarks, onTabMarkRemove, }: HorizontalRulerProps$1): react__default.ReactElement;
|
|
3563
|
+
|
|
3564
|
+
/**
|
|
3565
|
+
* One heading of the engine's outline (`Editor.getOutline()`): text, level,
|
|
3566
|
+
* and the block id `Editor.scrollToBlock` accepts. Derived from the contract.
|
|
3567
|
+
*/
|
|
3568
|
+
type OutlineHeading = ReturnType<Editor['getOutline']>[number];
|
|
3569
|
+
declare const OUTLINE_LEFT_OFFSET = 12;
|
|
3570
|
+
declare const OUTLINE_RESERVED_SPACE: number;
|
|
3571
|
+
declare const OUTLINE_BUTTON_LEFT_OFFSET = 12;
|
|
3572
|
+
declare const OUTLINE_BUTTON_RESERVED_SPACE: number;
|
|
3573
|
+
interface DocumentOutlineProps {
|
|
3574
|
+
headings: readonly OutlineHeading[];
|
|
3575
|
+
/** Called with the heading's block id — feed it to `Editor.scrollToBlock`. */
|
|
3576
|
+
onHeadingClick: (blockId: string) => void;
|
|
3577
|
+
onClose: () => void;
|
|
3578
|
+
topOffset?: number;
|
|
3579
|
+
/** Horizontal scroll offset of the editor — outline slides left with the doc. */
|
|
3580
|
+
scrollLeft?: number;
|
|
3581
|
+
/**
|
|
3582
|
+
* Left anchor (px) from the editor area's left edge. Defaults to
|
|
3583
|
+
* OUTLINE_LEFT_OFFSET; the host bumps it past the vertical ruler when one
|
|
3584
|
+
* is shown so the panel doesn't render on top of it.
|
|
3585
|
+
*/
|
|
3586
|
+
leftOffset?: number;
|
|
3587
|
+
}
|
|
3588
|
+
declare const DocumentOutline: react__default.NamedExoticComponent<DocumentOutlineProps>;
|
|
3589
|
+
|
|
3590
|
+
/** One tracked change as the engine reports it (`Editor.getTrackedChanges()`). */
|
|
3591
|
+
type TrackedChangeSummary = ReturnType<Editor['getTrackedChanges']>[number];
|
|
3592
|
+
interface ScrollPageInfo {
|
|
3593
|
+
currentPage: number;
|
|
3594
|
+
totalPages: number;
|
|
3595
|
+
visible: boolean;
|
|
3596
|
+
}
|
|
3597
|
+
interface HorizontalRulerProps {
|
|
3598
|
+
pageSetup: RulerPageSetup | undefined;
|
|
3599
|
+
zoom: number;
|
|
3600
|
+
unit: 'inch' | 'cm';
|
|
3601
|
+
editable: boolean;
|
|
3602
|
+
onLeftMarginChange: (marginTwips: number) => void;
|
|
3603
|
+
onRightMarginChange: (marginTwips: number) => void;
|
|
3604
|
+
tabMarks: RulerTabStop[] | null;
|
|
3605
|
+
onTabMarkRemove: (positionTwips: number) => void;
|
|
3606
|
+
}
|
|
3607
|
+
interface VerticalRulerProps$1 {
|
|
3608
|
+
pageSetup: RulerPageSetup | undefined;
|
|
3609
|
+
zoom: number;
|
|
3610
|
+
unit: 'inch' | 'cm';
|
|
3611
|
+
editable: boolean;
|
|
3612
|
+
onTopMarginChange: (marginTwips: number) => void;
|
|
3613
|
+
onBottomMarginChange: (marginTwips: number) => void;
|
|
3614
|
+
}
|
|
3615
|
+
interface OutlineProps {
|
|
3616
|
+
headings: readonly OutlineHeading[];
|
|
3617
|
+
onHeadingClick: (blockId: string) => void;
|
|
3618
|
+
onClose: () => void;
|
|
3619
|
+
topOffset: number;
|
|
3620
|
+
scrollLeft: number;
|
|
3621
|
+
}
|
|
3622
|
+
/**
|
|
3623
|
+
* Outer chrome of the editor: i18n + error provider wrappers, the
|
|
3624
|
+
* scroll container with its background-click handler, horizontal and
|
|
3625
|
+
* vertical rulers, the floating page indicator, document outline panel
|
|
3626
|
+
* + toggle button, plus slots for the toolbar, paged-area body,
|
|
3627
|
+
* overlays, dialogs, and hidden file inputs.
|
|
3628
|
+
*
|
|
3629
|
+
* The expanded-sidebar-item highlight styles are computed here from
|
|
3630
|
+
* `expandedSidebarItem` + `trackedChanges` because they need to live
|
|
3631
|
+
* inside the editor-content `<div>` for proper scoping.
|
|
3360
3632
|
*/
|
|
3633
|
+
/** @deprecated Use `<DocxEditor>` from the composition layer instead. */
|
|
3634
|
+
declare function DocxEditorShell({ i18n, isDark, onEditorError, containerRef, scrollContainerRef, editorContentRef, className, containerStyle, mainContentStyle, editorContainerStyle, showRuler, readOnlyProp, showOutline, showOutlineButton, sidebarOpen, minLayoutWidth, toolbarHeight, editorScrollLeft, expandedSidebarItem, trackedChanges, onScrollContainerMouseDown, onEditorBgMouseDown, onEditorContextMenu, horizontalRulerProps, verticalRulerProps, outlineProps, onToggleOutline, scrollPageInfo, toolbar, pagedArea, overlays, dialogs, fileInputs, }: {
|
|
3635
|
+
i18n: React.ComponentProps<typeof LocaleProvider>['i18n'];
|
|
3636
|
+
isDark?: boolean;
|
|
3637
|
+
onEditorError: (error: Error) => void;
|
|
3638
|
+
containerRef: React.Ref<HTMLDivElement>;
|
|
3639
|
+
scrollContainerRef: React.Ref<HTMLDivElement>;
|
|
3640
|
+
editorContentRef: React.Ref<HTMLDivElement>;
|
|
3641
|
+
className: string | undefined;
|
|
3642
|
+
containerStyle: CSSProperties;
|
|
3643
|
+
mainContentStyle: CSSProperties;
|
|
3644
|
+
editorContainerStyle: CSSProperties;
|
|
3645
|
+
showRuler: boolean;
|
|
3646
|
+
readOnlyProp: boolean | undefined;
|
|
3647
|
+
showOutline: boolean;
|
|
3648
|
+
showOutlineButton: boolean;
|
|
3649
|
+
sidebarOpen: boolean;
|
|
3650
|
+
minLayoutWidth: number;
|
|
3651
|
+
toolbarHeight: number;
|
|
3652
|
+
editorScrollLeft: number;
|
|
3653
|
+
expandedSidebarItem: string | null;
|
|
3654
|
+
trackedChanges: readonly TrackedChangeSummary[];
|
|
3655
|
+
onScrollContainerMouseDown: (e: React.MouseEvent) => void;
|
|
3656
|
+
onEditorBgMouseDown: (e: React.MouseEvent) => void;
|
|
3657
|
+
onEditorContextMenu: (e: React.MouseEvent) => void;
|
|
3658
|
+
horizontalRulerProps: HorizontalRulerProps;
|
|
3659
|
+
verticalRulerProps: VerticalRulerProps$1;
|
|
3660
|
+
outlineProps: OutlineProps;
|
|
3661
|
+
onToggleOutline: () => void;
|
|
3662
|
+
scrollPageInfo: ScrollPageInfo;
|
|
3663
|
+
toolbar: ReactNode;
|
|
3664
|
+
pagedArea: ReactNode;
|
|
3665
|
+
overlays: ReactNode;
|
|
3666
|
+
dialogs: ReactNode;
|
|
3667
|
+
fileInputs: ReactNode;
|
|
3668
|
+
}): react.JSX.Element;
|
|
3361
3669
|
|
|
3362
3670
|
interface LogoProps {
|
|
3363
3671
|
children: ReactNode;
|
|
3364
3672
|
}
|
|
3673
|
+
/** @deprecated Use `<DocxEditor>` title slots instead. */
|
|
3365
3674
|
declare function Logo({ children }: LogoProps): react__default.JSX.Element;
|
|
3366
3675
|
interface DocumentNameProps {
|
|
3367
3676
|
value: string;
|
|
@@ -3369,11 +3678,14 @@ interface DocumentNameProps {
|
|
|
3369
3678
|
placeholder?: string;
|
|
3370
3679
|
editable?: boolean;
|
|
3371
3680
|
}
|
|
3681
|
+
/** @deprecated Use `<DocxEditor>` document name slot instead. */
|
|
3372
3682
|
declare function DocumentName({ value, onChange, placeholder, editable }: DocumentNameProps): react__default.JSX.Element;
|
|
3373
3683
|
interface TitleBarRightProps {
|
|
3374
3684
|
children: ReactNode;
|
|
3375
3685
|
}
|
|
3686
|
+
/** @deprecated Use `<DocxEditor>` title slots instead. */
|
|
3376
3687
|
declare function TitleBarRight({ children }: TitleBarRightProps): react__default.JSX.Element;
|
|
3688
|
+
/** @deprecated Use `DocxEditor.Menu` from the composition layer instead. */
|
|
3377
3689
|
declare function MenuBar(): react__default.JSX.Element;
|
|
3378
3690
|
interface TitleBarProps {
|
|
3379
3691
|
children: ReactNode;
|
|
@@ -3390,19 +3702,22 @@ interface TitleBarProps {
|
|
|
3390
3702
|
* Logo and TitleBarRight span full height. DocumentName + MenuBar
|
|
3391
3703
|
* stack vertically in the center column.
|
|
3392
3704
|
*/
|
|
3705
|
+
/** @deprecated Use `<DocxEditor>` from the composition layer instead. */
|
|
3393
3706
|
declare function TitleBar({ children }: TitleBarProps): react__default.JSX.Element;
|
|
3394
3707
|
|
|
3708
|
+
/** @public */
|
|
3709
|
+
interface PageIndicatorProps {
|
|
3710
|
+
currentPage: number;
|
|
3711
|
+
totalPages: number;
|
|
3712
|
+
visible: boolean;
|
|
3713
|
+
}
|
|
3395
3714
|
/**
|
|
3396
3715
|
* Floating page indicator shown next to the scrollbar while the user
|
|
3397
3716
|
* scrolls a multi-page document. Wrapped so the `{current} of {total}`
|
|
3398
3717
|
* template runs through `t()`; `useTranslation()` only works inside
|
|
3399
3718
|
* `<LocaleProvider>`, which `DocxEditor`'s own body is not.
|
|
3400
3719
|
*/
|
|
3401
|
-
declare function PageIndicator({ currentPage, totalPages, visible
|
|
3402
|
-
currentPage: number;
|
|
3403
|
-
totalPages: number;
|
|
3404
|
-
visible: boolean;
|
|
3405
|
-
}): react.JSX.Element;
|
|
3720
|
+
declare function PageIndicator({ currentPage, totalPages, visible }: PageIndicatorProps): react.JSX.Element;
|
|
3406
3721
|
|
|
3407
3722
|
/**
|
|
3408
3723
|
* VerticalRuler Component
|
|
@@ -3446,16 +3761,4 @@ declare function VerticalRuler({ pageSetup, zoom, editable, onTopMarginChange, o
|
|
|
3446
3761
|
*/
|
|
3447
3762
|
declare function useEditorSnapshot(editor: Editor | null): number;
|
|
3448
3763
|
|
|
3449
|
-
|
|
3450
|
-
* @docx-editor.dev/react
|
|
3451
|
-
*
|
|
3452
|
-
* React adapter for the DOCX editor. A thin renderer over the `Editor`
|
|
3453
|
-
* contract from `@docx-editor.dev/core`: it supplies DOM and paints
|
|
3454
|
-
* the engine's positioned display list, and holds no editing-engine state.
|
|
3455
|
-
*
|
|
3456
|
-
* @packageDocumentation
|
|
3457
|
-
* @public
|
|
3458
|
-
*/
|
|
3459
|
-
declare const VERSION = "0.0.2";
|
|
3460
|
-
|
|
3461
|
-
export { CONTENT_CONTROL_SLOTS, type ChromeTranslate, type ContentControlActionProps, type ContentControlInspectorState, type ContentControlLock, type ContentControlPartProps, type ContentControlProps, type ContentControlSlotId, type ContextMenuAnchor, ContextMenuCellVerticalAlignment, type ContextMenuCommandProps, ContextMenuCopy, ContextMenuCut, ContextMenuDelete, ContextMenuDeleteTable, ContextMenuDeleteTableColumn, ContextMenuDeleteTableRow, ContextMenuInsertColumnLeft, ContextMenuInsertColumnRight, ContextMenuInsertRowAbove, ContextMenuInsertRowBelow, ContextMenuItem, type ContextMenuItemProps, ContextMenuPaste, ContextMenuSelectAll, type ContextMenuTableRowProps, DocumentName, DocxEditor, DocxEditorContent, DocxEditorContentControl, type DocxEditorContentControlNamespace, type DocxEditorContentProps, DocxEditorContextMenu, type DocxEditorContextMenuNamespace, type DocxEditorContextMenuProps, DocxEditorDocumentOutline, type DocxEditorDocumentOutlineProps, DocxEditorFontNotice, type DocxEditorFontNoticeProps, DocxEditorHeaderFooterChrome, type DocxEditorHeaderFooterChromeProps, DocxEditorHorizontalRuler, DocxEditorHyperLink, type DocxEditorHyperLinkNamespace, DocxEditorImagePropertiesDialog, type DocxEditorImagePropertiesDialogProps, DocxEditorLoading, type DocxEditorLoadingComponent, type DocxEditorLoadingProps, DocxEditorLoadingSpinner, type DocxEditorLoadingSpinnerProps, DocxEditorMenu, type DocxEditorMenuNamespace, type DocxEditorMenuProps, type DocxEditorNamespace, DocxEditorNavigation, type DocxEditorNavigationNamespace, type DocxEditorNavigationProps, DocxEditorNotesChrome, type DocxEditorNotesChromeProps, DocxEditorPageSetupDialog, type DocxEditorPageSetupDialogProps, type DocxEditorProps, type DocxEditorRef, DocxEditorRoot, type DocxEditorRootProps, type DocxEditorRulerProps, DocxEditorShell, DocxEditorToolbar, type DocxEditorToolbarNamespace, type DocxEditorToolbarProps, DocxEditorVerticalRuler, DocxEditorViewport, type DocxEditorViewportProps, type DocxFontsInput, type DocxFontsSource, type DocxSource, type EditorCaret, type EditorCommandState, type EditorMode, type EditorValueCommandState, type FontFamilyItemProps, type FontFamilyNamespace, type FontFamilyPartProps, type FontFamilyProps, type FontsInput, type HeaderFooterState, HorizontalRuler, type HorizontalRulerProps$1 as HorizontalRulerProps, type HyperLinkActionProps, type HyperLinkPartProps, type HyperLinkProps, type HyperlinkPopupAnchor, type HyperlinkPopupMode, type HyperlinkPopupState, ImageAltText, ImageInsertProvider, ImageInsertTrigger, ImagePropertiesTrigger, ImageWrap, type IndentUpdate, LocaleProvider, Logo, type MenuActionProps, MenuBar, type MenuGroupProps, type MenuId, type MenuItemProps, type MenuPartComponent, type MenuProps, type MenuReportIssueProps, type MenuRowProps, type MenuSeparatorProps, type MenuSubmenuProps, type MenuTableGridProps, NAVIGATION_PANE_GAP, NAVIGATION_PANE_INSET, NAVIGATION_PANE_WIDTH, NavigationClose, NavigationFind, NavigationHeader, NavigationHeadings, type NavigationPartProps, type NavigationShiftInput, NavigationTab, type NavigationTabProps, type NavigationTab$1 as NavigationTabValue, NavigationTabs, NavigationTitle, NavigationToggle, type NormalizedImagePayload, type NotePropertiesState, type OutlineHeading$1 as OutlineHeading, type OutlineHeadingItem, PageIndicator, type PageSetupUpdate, PaginatedDocxEditor, type PaginatedDocxEditorHandle as PaginatedDocxEditorExpose, type PaginatedDocxEditorHandle, type PaginatedDocxEditorProps, PaginatedDocxEditorShell, type PaginatedDocxEditorShellProps, type ParagraphStyleItemProps, type ParagraphStyleNamespace, type ParagraphStyleOption, type ParagraphStylePartProps, type ParagraphStyleProps, RULER_WIDTH, ReviewRailContext, type ReviewRailRegistry, SEARCH_DEBOUNCE_MS, SEARCH_MATCH_LIMIT, Slot, type SlotProps, type TableBorderColorNamespace, type TableBorderStyleNamespace, type TableBorderTargetNamespace, type TableBorderWidthNamespace, type TableCellFillNamespace, type TableChromeItemProps, type TableChromePartComponent, type TableChromePartProps, TitleBar, TitleBarRight, Toolbar, type ToolbarActionProps, type ToolbarAlignmentComponent, ToolbarButton, type ToolbarButtonProps$1 as ToolbarButtonProps, ToolbarGroup, type ToolbarPartComponent, type ToolbarPartProps, type ToolbarProps, type ToolbarSeparatorProps, type ToolbarSlotPartComponent, type ToolbarSlotPartProps, type ToolbarTranslate, type UseContentControlResult, type UseDocumentOutlineResult, type UseDocumentSearchResult, type UseDocxSourceOptions, type UseDocxSourceResult, type UseFontFamilyResult, type UseHyperlinkPopupResult, type UseNavigationPaneOptions, type UseNavigationPaneResult, type UsePageSetupReturn, type UseParagraphIndentReturn, type UseParagraphStyleResult, type UseZoomResult, VERSION, VerticalRuler, type VerticalRulerProps, navigationPaneReservation, navigationShift, normalizeImageBytes, useChromeTranslate, useContentControl, useContentControlInstance, useContextMenuTarget, useDocumentOutline, useDocumentSearch, useDocxEditor, useDocxSource, useEditorCaret, useEditorCommand, useEditorEvent, useEditorSnapshot, useEditorState, useEditorValueCommand, useFontFamily, useFonts, useHeaderFooterState, useHyperlinkPopup, useHyperlinkPopupInstance, useNavigationPane, useNavigationShift, useNotePropertiesState, useNoteScopeState, usePageSetup, useParagraphIndent, useParagraphStyle, useTableBorderTargetLabel, useTranslation, useZoom };
|
|
3764
|
+
export { CONTENT_CONTROL_SLOTS, type ChromeTranslate, type ContentControlActionProps, type ContentControlInspectorState, type ContentControlLock, type ContentControlPartProps, type ContentControlProps, type ContentControlSlotId, type ContextMenuAnchor, ContextMenuCellVerticalAlignment, type ContextMenuCommandProps, type ContextMenuContextValue, ContextMenuCopy, ContextMenuCut, ContextMenuDelete, ContextMenuDeleteTable, ContextMenuDeleteTableColumn, ContextMenuDeleteTableRow, ContextMenuInsertColumnLeft, ContextMenuInsertColumnRight, ContextMenuInsertRowAbove, ContextMenuInsertRowBelow, ContextMenuItem, type ContextMenuItemProps, ContextMenuPaste, ContextMenuRefreshToc, ContextMenuRefreshTocPageNumbers, ContextMenuSelectAll, type ContextMenuTableRowProps, DocumentName, DocumentOutline, DocxEditor, DocxEditorAuthorStyle, type DocxEditorAuthorStyleProps, type DocxEditorChildren, DocxEditorColorByChangeType, DocxEditorContent, DocxEditorContentControl, type DocxEditorContentControlNamespace, type DocxEditorContentProps, DocxEditorContextMenu, type DocxEditorContextMenuNamespace, type DocxEditorContextMenuProps, DocxEditorDocumentOutline, type DocxEditorDocumentOutlineProps, DocxEditorFontNotice, type DocxEditorFontNoticeProps, DocxEditorHeaderFooterChrome, type DocxEditorHeaderFooterChromeProps, DocxEditorHorizontalRuler, DocxEditorHyperLink, type DocxEditorHyperLinkNamespace, DocxEditorImagePropertiesDialog, type DocxEditorImagePropertiesDialogProps, DocxEditorLoading, type DocxEditorLoadingComponent, type DocxEditorLoadingProps, DocxEditorLoadingSpinner, type DocxEditorLoadingSpinnerProps, DocxEditorMenu, type DocxEditorMenuNamespace, type DocxEditorMenuProps, type DocxEditorNamespace, DocxEditorNavigation, type DocxEditorNavigationNamespace, type DocxEditorNavigationProps, DocxEditorNotesChrome, type DocxEditorNotesChromeProps, DocxEditorPageNumber, type DocxEditorPageNumberProps, DocxEditorPageSetupDialog, type DocxEditorPageSetupDialogProps, type DocxEditorProps, type DocxEditorRef, DocxEditorRoot, type DocxEditorRootListeners, type DocxEditorRootProps, type DocxEditorRulerProps, DocxEditorShell, DocxEditorToolbar, type DocxEditorToolbarNamespace, type DocxEditorToolbarProps, DocxEditorVerticalRuler, DocxEditorViewport, type DocxEditorViewportProps, type DocxFontsInput, type DocxFontsSource, type DocxSource, type EditorCaret, type EditorCommandState, type EditorMode, type EditorValueCommandState, type FontFamilyItemProps, type FontFamilyNamespace, type FontFamilyPartProps, type FontFamilyProps, type FontsInput, type HeaderFooterState, HorizontalRuler, type HorizontalRulerProps$1 as HorizontalRulerProps, type HyperLinkActionProps, type HyperLinkPartProps, type HyperLinkProps, type HyperlinkPopupAnchor, type HyperlinkPopupMode, type HyperlinkPopupState, ImageAltText, ImageInsertProvider, ImageInsertTrigger, ImagePropertiesTrigger, type ImagePropertiesTriggerProps, ImageWrap, type IndentUpdate, LocaleProvider, type LocaleProviderProps, Logo, type MaybeRefOrGetter, type MenuActionProps, MenuBar, type MenuGroupProps, type MenuId, type MenuItemProps, type MenuPartComponent, type MenuProps, type MenuReportIssueProps, type MenuRowProps, type MenuSeparatorProps, type MenuSubmenuProps, type MenuTableGridProps, NAVIGATION_PANE_GAP, NAVIGATION_PANE_INSET, NAVIGATION_PANE_WIDTH, NavigationClose, NavigationFind, NavigationHeader, NavigationHeadings, type NavigationPartProps, type NavigationShiftInput, NavigationTab, type NavigationTabProps, type NavigationTab$1 as NavigationTabValue, NavigationTabs, NavigationTitle, NavigationToggle, type NormalizedImagePayload, type NotePropertiesState, OUTLINE_BUTTON_LEFT_OFFSET, OUTLINE_BUTTON_RESERVED_SPACE, OUTLINE_LEFT_OFFSET, OUTLINE_RESERVED_SPACE, type OutlineHeading$1 as OutlineHeading, type OutlineHeadingItem, PageIndicator, type PageIndicatorProps, PageNumberTranslationContext, type PageSetupUpdate, PaginatedDocxEditor, type PaginatedDocxEditorExpose, type PaginatedDocxEditorHandle, type PaginatedDocxEditorProps, PaginatedDocxEditorShell, type PaginatedDocxEditorShellProps, type ParagraphStyleItemProps, type ParagraphStyleNamespace, type ParagraphStyleOption, type ParagraphStylePartProps, type ParagraphStyleProps, type ProvideDocxEditorResult, REVIEW_MARKERS_GUTTER, REVIEW_PANE_GUTTER, RULER_WIDTH, type ReviewGutter, type ReviewGutterInput, ReviewRailContext, type ReviewRailRegistry, SEARCH_DEBOUNCE_MS, SEARCH_MATCH_LIMIT, type ScopedChromeAnchor, Slot, type SlotProps, type TableBorderColorNamespace, type TableBorderStyleNamespace, type TableBorderTargetNamespace, type TableBorderWidthNamespace, type TableCellFillNamespace, type TableChromeItemProps, type TableChromePartComponent, type TableChromePartProps, TitleBar, TitleBarRight, Toolbar, type ToolbarActionProps, type ToolbarAlignmentComponent, ToolbarButton, type ToolbarButtonProps$1 as ToolbarButtonProps, ToolbarContext, type ToolbarContextValue, ToolbarGroup, ToolbarImageProperties, type ToolbarPartComponent, type ToolbarPartProps, type ToolbarProps, type ToolbarSeparatorProps, type ToolbarSlotPartComponent, type ToolbarSlotPartProps, type ToolbarTranslate, type UseContentControlResult, type UseDocumentOutlineResult, type UseDocumentSearchResult, type UseDocxSourceOptions, type UseDocxSourceResult, type UseFontFamilyResult, type UseHyperlinkPopupResult, type UseNavigationPaneOptions, type UseNavigationPaneResult, type UsePageSetupReturn, type UseParagraphIndentReturn, type UseParagraphStyleResult, type UseZoomResult, VERSION, VerticalRuler, type VerticalRulerProps, editorStateActiveSubscriptionCount, isFieldLink, navigationPaneReservation, navigationShift, normalizeImageBytes, useProvidedDocxEditor as provideDocxEditor, reviewGutter, useChromeTranslate, useContentControl, useContentControlInstance, useContextMenuTarget, useDocumentOutline, useDocumentSearch, useDocxEditor, useDocxSource, useEditorCaret, useEditorCommand, useEditorEvent, useEditorSnapshot, useEditorState, useEditorValueCommand, useFontFamily, useFonts, useHeaderFooterState, useHyperlinkPopup, useHyperlinkPopupInstance, useNavigationPane, useNavigationShift, useNotePropertiesState, useNoteScopeState, usePageSetup, useParagraphIndent, useParagraphStyle, useReviewAuthors, useReviewGutter, useScopeClassName, useScopedChromeAnchor, useTableBorderTargetLabel, useToolbarContext, useToolbarLabel, useToolbarLabelFor, useTranslation, useZoom };
|