@docx-editor.dev/react 2.30.0 → 2.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -0
- package/dist/index.d.mts +866 -83
- package/dist/index.d.ts +866 -83
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/docs/accept-reject-without-scrolling.md +72 -0
- package/docs/comment-on-found-text.md +47 -0
- package/docs/custom-review-cards.md +105 -0
- package/docs/highlight-ranges.md +25 -0
- package/docs/index.md +36 -0
- package/docs/propose-rewrite.md +247 -0
- package/docs/tracked-replacement.md +45 -0
- package/package.json +4 -3
package/dist/index.d.mts
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
* @public
|
|
10
10
|
*/
|
|
11
11
|
import * as react from 'react';
|
|
12
|
-
import react__default, { ReactNode, CSSProperties, ReactElement, ComponentType, ForwardRefExoticComponent, RefAttributes, HTMLAttributes, Ref } from 'react';
|
|
13
|
-
import { RevisionMarkupDialogSession, ResolvedRevisionMarkup, RevisionMarkupOptions, ChromeExportFormat, InvalidTextFormFieldSession, ContentControlWidgetSession, CalendarMonth, ContentControlListNavigation, CalendarDay, TextFormFieldDialogSession, RevisionAuthorStyle, ParagraphDialogFields, ParagraphDialogMixed, ChromeMenuId, ChromeSlotId, ChromeMenuEntry, DocxEditorInstance, FontConfigurationFragment, FontResolver, FontShapingOptions, EditorModule, ReviewDisplayMode, FieldResultsMode, ContentLockPolicy, LockedControlNavigation, ImageDecodePort, ChromeGroupId, SupportedImageMime, TableChromeSlotId, ChromeExportHandlers, DocumentSearchHighlight, DocumentSearchFindOptions, SurfaceHyperlink, FontOrigin, MarkedFontResolver, ReviewAuthorInfo, EditorCommandExecute, ToolbarValueMap, HighlightSource, ParagraphFormatRead, ParagraphFormatUpdate, TextMeasurer, PaginatedSurfaceState, NavigationCommand, SurfaceFormatting, SectionProperties, RulerIndent, HistoryGroupBindingOptions } from '@docx-editor.dev/core/editor';
|
|
14
|
-
export { CHROME_GROUPS, CHROME_MENUS, ChromeExportFormat, ChromeExportHandlers, ChromeMenu, ChromeMenuEntry, ChromeMenuId, ChromeMenuItemEntry, ChromeMenuSeparatorEntry, ChromeMenuSubmenuEntry, ChromeSlotId, ClearRefreshHighlightsOptions, DEFAULT_FONT, DocumentRefresh, DocumentRefreshError, DocumentRefreshState, DocumentSearchFindOptions, DocumentSearchHighlight, DocumentSearchNavigateOptions, DocumentSearchOptions, FontConfigurationBase, FontConfigurationFragment, FontLoadFailure, FontLoadFailureReason, FontOrigin, FontResolutionRequest, FontResolver, FontResolverMark, FontUrlSource, HIGHLIGHT_REFRESH_MS, HighlightSource, ImageWrapTarget, LOADING_SNAPSHOT, LoadFontsRequest, LoadFontsResult, MAX_RESOLVER_FAMILIES, MarkedFontResolver, NavigateToChangeOptions, PX_PER_CM, PX_PER_INCH, ParagraphFlagState, ParagraphFormatRead, ParagraphFormatUpdate, ParagraphTabStop, RefreshChange, RefreshChangeInput, RefreshFailureCode, RefreshHighlightAnimation, RefreshHighlightOptions, RefreshLocation, RefreshResult, RefreshSubmission, RefreshUpdate, ResolvedRevisionMarkup, ReviewAuthorInfo, ReviewDisplayMode, RevisionAuthorAssignments, RevisionAuthorStyle, RevisionChangedLinesMark, RevisionDeletionMark, RevisionMarkupChromeHandlers, RevisionMarkupColor, RevisionMarkupDialogSession, RevisionMarkupMark, RevisionMarkupNamedColor, RevisionMarkupOptions, RevisionStyles, RulerTick, RulerUnit, SEARCH_DEBOUNCE_MS, SEARCH_HIGHLIGHT_PRIORITY, SEARCH_HIGHLIGHT_SET, SEARCH_MATCH_LIMIT, ToolbarCommandState, WORD_DEFAULT_FONT, chromeMenuSlots, commandForSlot, composeFontConfiguration, composeFontOrigins, createDocumentRefresh, createFontSource, defineFontResolver, generateRulerTicks, isFontResolver, loadFonts, rulerPageBox, runToolbarCommand, toolbarCommandState } from '@docx-editor.dev/core/editor';
|
|
15
|
-
import { Editor, ViewScope, EditorCommand, DocumentSource, FontConfiguration, ZoomMode, DocumentChange, EditorFontError, TextMatch, DocumentHandle, EditorExecOptions,
|
|
16
|
-
export { AnchorHighlightAnimation, AnchorHighlightOptions, ClearAnchorHighlightOptions, Editor, EditorCommand, EditorFontError, EditorFontErrorCode, EditorQuery, EditorScope, EditorSnapshot, FontConfiguration, FontFaceRequest, FontSource, FontSourceSubstitution, HighlightHit, HighlightOptions, HighlightRange, HighlightRect, HighlightResult, PageSetup, ScrollToAnchorOptions, TextMatch } from '@docx-editor.dev/core/contracts/editor';
|
|
12
|
+
import react__default, { ReactNode, CSSProperties, ReactElement, ComponentType, ButtonHTMLAttributes, ForwardRefExoticComponent, RefAttributes, HTMLAttributes, Ref } from 'react';
|
|
13
|
+
import { UnsupportedElementRule, UnsupportedElement, RevisionMarkupDialogSession, ResolvedRevisionMarkup, RevisionMarkupOptions, ChromeExportFormat, InvalidTextFormFieldSession, ContentControlWidgetSession, CalendarMonth, ContentControlListNavigation, CalendarDay, TextFormFieldDialogSession, RevisionAuthorStyle, ParagraphDialogFields, ParagraphDialogMixed, BookmarkSortOrder, SplitCellLimits, ChromeMenuId, ChromeSlotId, ChromeMenuEntry, DocxEditorInstance, FontConfigurationFragment, FontResolver, FontShapingOptions, EditorModule, ReviewDisplayMode, FieldResultsMode, ContentLockPolicy, LockedControlNavigation, ImageDecodePort, ChromeGroupId, SupportedImageMime, TableChromeSlotId, ChromeExportHandlers, DocumentSearchHighlight, DocumentSearchFindOptions, SurfaceHyperlink, FontOrigin, MarkedFontResolver, ReviewAuthorInfo, EditorCommandExecute, ToolbarValueMap, HighlightSource, ParagraphFormatRead, ParagraphFormatUpdate, TextMeasurer, PaginatedSurfaceState, NavigationCommand, SurfaceFormatting, SectionProperties, RulerIndent, HistoryGroupBindingOptions } from '@docx-editor.dev/core/editor';
|
|
14
|
+
export { CHROME_GROUPS, CHROME_MENUS, ChromeExportFormat, ChromeExportHandlers, ChromeMenu, ChromeMenuEntry, ChromeMenuId, ChromeMenuItemEntry, ChromeMenuSeparatorEntry, ChromeMenuSubmenuEntry, ChromeSlotId, ClearRefreshHighlightsOptions, DEFAULT_FONT, DocumentRefresh, DocumentRefreshError, DocumentRefreshState, DocumentSearchFindOptions, DocumentSearchHighlight, DocumentSearchNavigateOptions, DocumentSearchOptions, FontConfigurationBase, FontConfigurationFragment, FontLoadFailure, FontLoadFailureReason, FontOrigin, FontResolutionRequest, FontResolver, FontResolverMark, FontUrlSource, HIGHLIGHT_REFRESH_MS, HighlightSource, ImageWrapTarget, LOADING_SNAPSHOT, LoadFontsRequest, LoadFontsResult, MAX_RESOLVER_FAMILIES, MarkedFontResolver, NavigateToChangeOptions, PX_PER_CM, PX_PER_INCH, ParagraphFlagState, ParagraphFormatRead, ParagraphFormatUpdate, ParagraphTabStop, RefreshChange, RefreshChangeInput, RefreshFailureCode, RefreshHighlightAnimation, RefreshHighlightOptions, RefreshLocation, RefreshResult, RefreshSubmission, RefreshUpdate, ResolvedRevisionMarkup, ReviewAuthorInfo, ReviewDisplayMode, RevisionAuthorAssignments, RevisionAuthorStyle, RevisionChangedLinesMark, RevisionDeletionMark, RevisionMarkupChromeHandlers, RevisionMarkupColor, RevisionMarkupDialogSession, RevisionMarkupMark, RevisionMarkupNamedColor, RevisionMarkupOptions, RevisionStyles, RulerTick, RulerUnit, SEARCH_DEBOUNCE_MS, SEARCH_HIGHLIGHT_PRIORITY, SEARCH_HIGHLIGHT_SET, SEARCH_MATCH_LIMIT, ToolbarCommandState, UnsupportedElement, UnsupportedElementLayout, UnsupportedElementRule, WORD_DEFAULT_FONT, chromeMenuSlots, commandForSlot, composeFontConfiguration, composeFontOrigins, createDocumentRefresh, createFontSource, defineFontResolver, generateRulerTicks, isFontResolver, loadFonts, rulerPageBox, runToolbarCommand, toolbarCommandState } from '@docx-editor.dev/core/editor';
|
|
15
|
+
import { Editor, ViewScope, EditorCommand, WatermarkState, BookmarkSummary, DocumentSource, FontConfiguration, ZoomMode, DocumentChange, EditorFontError, TextMatch, ExecResult, DocumentOpenFailure, DocumentHandle, EditorExecOptions, EditorScope, EditorSnapshot, Watermark, EditorEvents, HighlightOptions, HighlightResult, HighlightRange, HighlightHit, PageSetup, IndentFormatting, ColorValue, Theme } from '@docx-editor.dev/core/contracts/editor';
|
|
16
|
+
export { AnchorHighlightAnimation, AnchorHighlightOptions, ClearAnchorHighlightOptions, DocumentOpenFailure, DocumentOpenFailureReason, Editor, EditorCommand, EditorFontError, EditorFontErrorCode, EditorQuery, EditorScope, EditorSnapshot, FontConfiguration, FontFaceRequest, FontSource, FontSourceSubstitution, HighlightHit, HighlightOptions, HighlightRange, HighlightRect, HighlightResult, PageSetup, ScrollToAnchorOptions, TextMatch, Watermark, WatermarkState } from '@docx-editor.dev/core/contracts/editor';
|
|
17
17
|
import { TFunction, Translations, LocaleStrings } from '@docx-editor.dev/i18n';
|
|
18
18
|
export { TranslationKey } from '@docx-editor.dev/i18n';
|
|
19
19
|
import { ContentControlType, ContentControlSummary } from '@docx-editor.dev/core';
|
|
@@ -35,6 +35,27 @@ type MaybeRefOrGetter<T> = T;
|
|
|
35
35
|
*/
|
|
36
36
|
type DocxEditorChildren = ReactNode;
|
|
37
37
|
|
|
38
|
+
/** Props for a registered unsupported-content renderer. @public */
|
|
39
|
+
interface DocxEditorUnsupportedElementProps extends UnsupportedElementRule {
|
|
40
|
+
/**
|
|
41
|
+
* Render this occurrence. Return `null`, `false`, an empty fragment or array, or whitespace to
|
|
42
|
+
* keep the default placeholder.
|
|
43
|
+
*/
|
|
44
|
+
children: (props: {
|
|
45
|
+
element: UnsupportedElement;
|
|
46
|
+
}) => ReactNode;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Register a renderer under DocxEditor or DocxEditor.Root.
|
|
50
|
+
* The first mounted matching declaration wins. Prop updates retain its priority.
|
|
51
|
+
* Omit match for a catch-all. Returning `null`, `false`, an empty fragment or array, or
|
|
52
|
+
* whitespace keeps the default placeholder.
|
|
53
|
+
* Layout uses points and only sizes content without an existing layout box.
|
|
54
|
+
* Components can remount when pagination or virtualization removes an occurrence.
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
declare function DocxEditorUnsupportedElement({ match, layout, children, }: DocxEditorUnsupportedElementProps): react.JSX.Element[];
|
|
58
|
+
|
|
38
59
|
/**
|
|
39
60
|
* Presentation overrides for a dialog part. @public
|
|
40
61
|
*
|
|
@@ -547,8 +568,9 @@ interface DocxEditorContentProps {
|
|
|
547
568
|
}
|
|
548
569
|
/**
|
|
549
570
|
* The element the engine paints pages into. Must render inside a
|
|
550
|
-
* `DocxEditor.Viewport`; the facade attaches here and detaches on unmount
|
|
551
|
-
* the
|
|
571
|
+
* `DocxEditor.Viewport`; the facade attaches here and detaches on unmount. Detaching parks
|
|
572
|
+
* the editor, so mounting the content elsewhere, even in another window, moves it with its
|
|
573
|
+
* undo history, selection and reading position.
|
|
552
574
|
*
|
|
553
575
|
* Its centring margin lives in the STYLESHEET, not in an inline style here, and behind
|
|
554
576
|
* `:where()` so it carries no specificity: a host that places the page itself — inside its
|
|
@@ -560,6 +582,58 @@ interface DocxEditorContentProps {
|
|
|
560
582
|
*/
|
|
561
583
|
declare function DocxEditorContent({ className }: DocxEditorContentProps): react.JSX.Element;
|
|
562
584
|
|
|
585
|
+
/** Props for `DocxEditor.Window`. @public */
|
|
586
|
+
interface DocxEditorWindowProps {
|
|
587
|
+
/** Render `children` in a pop-out window. While `false`, they render in place. */
|
|
588
|
+
open: boolean;
|
|
589
|
+
/** A same-origin page to open. Defaults to `about:blank`. */
|
|
590
|
+
url?: string;
|
|
591
|
+
/**
|
|
592
|
+
* The window name. Defaults to `docx-editor`. Two `DocxEditor.Window` components with the
|
|
593
|
+
* same name share one browser window, so give each editor its own name.
|
|
594
|
+
*/
|
|
595
|
+
name?: string;
|
|
596
|
+
/** The `window.open` features. Defaults to `popup,width=1000,height=900`. */
|
|
597
|
+
features?: string;
|
|
598
|
+
/** The pop-out's title. */
|
|
599
|
+
title?: string;
|
|
600
|
+
/** Copy this page's stylesheets into the window, and keep copying new ones. Default `true`. */
|
|
601
|
+
styles?: boolean | ((from: Document, to: Document) => () => void);
|
|
602
|
+
/**
|
|
603
|
+
* The pop-out went away: the user closed it, or the browser blocked it. Set `open` to
|
|
604
|
+
* `false` here. The panel is already back in place when this runs.
|
|
605
|
+
*/
|
|
606
|
+
onClose?: () => void;
|
|
607
|
+
/** The editor panel: toolbar, viewport and content, or any part of them. */
|
|
608
|
+
children?: DocxEditorChildren;
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Render the editor panel in its own browser window while `open` is `true`.
|
|
612
|
+
*
|
|
613
|
+
* Place it inside `DocxEditor.Root` around the parts to pop out. The Root stays in this
|
|
614
|
+
* window, so the editor moves into the pop-out and back with its undo history, selection and
|
|
615
|
+
* collaboration session. The window gets this page's stylesheets, and closing it brings the
|
|
616
|
+
* panel back and calls `onClose`.
|
|
617
|
+
*
|
|
618
|
+
* @example
|
|
619
|
+
* ```tsx
|
|
620
|
+
* const [popped, setPopped] = useState(false);
|
|
621
|
+
*
|
|
622
|
+
* <DocxEditor.Root document={bytes}>
|
|
623
|
+
* <button onClick={() => setPopped(!popped)}>Pop out</button>
|
|
624
|
+
* <DocxEditor.Window open={popped} onClose={() => setPopped(false)}>
|
|
625
|
+
* <DocxEditor.Toolbar />
|
|
626
|
+
* <DocxEditor.Viewport>
|
|
627
|
+
* <DocxEditor.Content />
|
|
628
|
+
* </DocxEditor.Viewport>
|
|
629
|
+
* </DocxEditor.Window>
|
|
630
|
+
* </DocxEditor.Root>
|
|
631
|
+
* ```
|
|
632
|
+
*
|
|
633
|
+
* @public
|
|
634
|
+
*/
|
|
635
|
+
declare function DocxEditorWindow({ open, onClose, children, url, name, features, title, styles, }: DocxEditorWindowProps): react.JSX.Element;
|
|
636
|
+
|
|
563
637
|
/** Props for `DocxEditor.Loading`. @public */
|
|
564
638
|
interface DocxEditorLoadingProps {
|
|
565
639
|
/**
|
|
@@ -586,8 +660,8 @@ interface DocxEditorLoadingProps {
|
|
|
586
660
|
style?: CSSProperties;
|
|
587
661
|
/**
|
|
588
662
|
* Your own loading indicator, in place of the packaged spinner. The packaged screen keeps
|
|
589
|
-
* its page and centers this on it. With `overlay`, it then moves
|
|
590
|
-
*
|
|
663
|
+
* its page and centers this on it. With `overlay`, it then moves below the laid-out pages
|
|
664
|
+
* while a large document lays out its remaining pages, and scrolls with them.
|
|
591
665
|
*
|
|
592
666
|
* Include text for screen readers, as the packaged indicator does.
|
|
593
667
|
*
|
|
@@ -599,8 +673,8 @@ interface DocxEditorLoadingProps {
|
|
|
599
673
|
/**
|
|
600
674
|
* The whole first loading screen, in place of the packaged page. Compose your own around
|
|
601
675
|
* `DocxEditor.Loading.Spinner` to keep the packaged indicator beside your own copy. To
|
|
602
|
-
* change only the indicator, and keep it
|
|
603
|
-
* `indicator`.
|
|
676
|
+
* change only the indicator, and keep it below the laid-out pages as the document opens,
|
|
677
|
+
* use `indicator`.
|
|
604
678
|
*/
|
|
605
679
|
children?: DocxEditorChildren;
|
|
606
680
|
}
|
|
@@ -650,7 +724,7 @@ interface DocxEditorLoadingComponent {
|
|
|
650
724
|
* LARGE document opens — the engine mounts it behind one painted frame precisely so this
|
|
651
725
|
* screen can paint before the blocking parse and layout — it holds until the pages land;
|
|
652
726
|
* pass `overlay` to pin it over the previous document for that window. With `overlay`, once
|
|
653
|
-
* the first pages show, the indicator moves
|
|
727
|
+
* the first pages show, the indicator moves below the laid-out pages until the rest are laid out.
|
|
654
728
|
* Pass `indicator` to replace only the spinner, in both places:
|
|
655
729
|
*
|
|
656
730
|
* ```tsx
|
|
@@ -730,6 +804,24 @@ interface DocxEditorAuthorStyleProps extends RevisionAuthorStyle {
|
|
|
730
804
|
*/
|
|
731
805
|
declare function DocxEditorAuthorStyle(props: DocxEditorAuthorStyleProps): null;
|
|
732
806
|
|
|
807
|
+
/**
|
|
808
|
+
* Why a picture could not be inserted. Replace it through `popups.imageInsertError`, or pass
|
|
809
|
+
* `false` there to show nothing.
|
|
810
|
+
* @public
|
|
811
|
+
*/
|
|
812
|
+
interface DocxEditorImageInsertErrorDialogProps {
|
|
813
|
+
/** The translated reason the picture was refused. */
|
|
814
|
+
message: string;
|
|
815
|
+
/** Close the dialog. */
|
|
816
|
+
onClose(): void;
|
|
817
|
+
className?: string;
|
|
818
|
+
style?: CSSProperties;
|
|
819
|
+
/** Replaces the packaged header, message and button. */
|
|
820
|
+
children?: DocxEditorChildren;
|
|
821
|
+
}
|
|
822
|
+
/** The packaged picture refusal: an editor dialog, never a page-blocking browser alert. @public */
|
|
823
|
+
declare function DocxEditorImageInsertErrorDialog({ message, onClose, className, style, children, }: DocxEditorImageInsertErrorDialogProps): react.JSX.Element;
|
|
824
|
+
|
|
733
825
|
/** A render callback for an automatic popup. `false` disables automatic rendering. @public */
|
|
734
826
|
type DocxEditorPopup<Props extends object> = false | ((props: Props) => DocxEditorChildren | null);
|
|
735
827
|
/**
|
|
@@ -767,7 +859,15 @@ interface PageSetupDialogFields {
|
|
|
767
859
|
/** Page Setup draft and actions. @public */
|
|
768
860
|
interface UsePageSetupDialogReturn extends UseDialogReturn<PageSetupDialogFields> {
|
|
769
861
|
}
|
|
770
|
-
/**
|
|
862
|
+
/**
|
|
863
|
+
* Read the enclosing Page Setup dialog draft.
|
|
864
|
+
*
|
|
865
|
+
* Call it in a child of the dialog. It does not open the dialog. To open the dialog from your
|
|
866
|
+
* own toolbar, keep its `open` state and render `DocxEditor.PageSetupDialog` with `open` and
|
|
867
|
+
* `onClose`. Take the button's enabled state from `usePageSetup().isEnabled`.
|
|
868
|
+
*
|
|
869
|
+
* @public
|
|
870
|
+
*/
|
|
771
871
|
declare function usePageSetupDialog(): UsePageSetupDialogReturn;
|
|
772
872
|
/** Page Setup with replaceable controls and layout. @public */
|
|
773
873
|
declare const DocxEditorPageSetupDialog: typeof PageSetupDialogRoot & {
|
|
@@ -815,7 +915,15 @@ declare function ParagraphDialogRoot({ open, onClose, className, style, children
|
|
|
815
915
|
interface UseParagraphDialogReturn extends UseDialogReturn<ParagraphDialogFields> {
|
|
816
916
|
readonly mixed: ParagraphDialogMixed;
|
|
817
917
|
}
|
|
818
|
-
/**
|
|
918
|
+
/**
|
|
919
|
+
* Read the enclosing Paragraph Options draft.
|
|
920
|
+
*
|
|
921
|
+
* Call it in a child of the dialog. It does not open the dialog. To open the dialog from your
|
|
922
|
+
* own toolbar, keep its `open` state and render `DocxEditor.ParagraphDialog` with `open` and
|
|
923
|
+
* `onClose`. Take the button's enabled state from `useParagraphFormat().isEnabled`.
|
|
924
|
+
*
|
|
925
|
+
* @public
|
|
926
|
+
*/
|
|
819
927
|
declare function useParagraphDialog(): UseParagraphDialogReturn;
|
|
820
928
|
/** Paragraph Options with replaceable controls and layout. @public */
|
|
821
929
|
declare const DocxEditorParagraphDialog: typeof ParagraphDialogRoot & {
|
|
@@ -845,6 +953,210 @@ declare const DocxEditorParagraphDialog: typeof ParagraphDialogRoot & {
|
|
|
845
953
|
}) => react.ReactNode;
|
|
846
954
|
};
|
|
847
955
|
|
|
956
|
+
/** How a text watermark crosses the page. @public */
|
|
957
|
+
type WatermarkDialogLayout = NonNullable<WatermarkState['layout']>;
|
|
958
|
+
/** Which watermark the dialog writes. @public */
|
|
959
|
+
type WatermarkDialogKind = 'none' | 'picture' | 'text';
|
|
960
|
+
/** The Watermark dialog draft. Transparency is 0 to 1, color is `RRGGBB`. @public */
|
|
961
|
+
interface WatermarkDialogFields {
|
|
962
|
+
kind: WatermarkDialogKind;
|
|
963
|
+
/** The picture bytes, or null when no picture is chosen. */
|
|
964
|
+
imageData: Uint8Array | null;
|
|
965
|
+
/** The chosen file name. Null for no picture or for the document's current picture. */
|
|
966
|
+
imageName: string | null;
|
|
967
|
+
/** A factor of the picture's natural size. Null is Auto. */
|
|
968
|
+
scale: number | null;
|
|
969
|
+
washout: boolean;
|
|
970
|
+
text: string;
|
|
971
|
+
fontFamily: string;
|
|
972
|
+
/** Points. Null is Auto. */
|
|
973
|
+
fontSizePt: number | null;
|
|
974
|
+
bold: boolean;
|
|
975
|
+
italic: boolean;
|
|
976
|
+
transparency: number;
|
|
977
|
+
color: string;
|
|
978
|
+
layout: WatermarkDialogLayout;
|
|
979
|
+
}
|
|
980
|
+
/** The text choices the dialog offers when the host passes no `presets`. @public */
|
|
981
|
+
declare const DEFAULT_WATERMARK_PRESETS: readonly string[];
|
|
982
|
+
|
|
983
|
+
/** Props for `DocxEditor.WatermarkDialog`. @public */
|
|
984
|
+
interface DocxEditorWatermarkDialogProps extends DialogCustomizationProps {
|
|
985
|
+
/** Whether the dialog is shown. The host owns this state. */
|
|
986
|
+
open: boolean;
|
|
987
|
+
/** Called on Cancel, Escape, overlay click, and after a successful Apply. */
|
|
988
|
+
onClose: () => void;
|
|
989
|
+
/** The text choices offered for a text watermark. Defaults to `DEFAULT_WATERMARK_PRESETS`. */
|
|
990
|
+
presets?: readonly string[];
|
|
991
|
+
}
|
|
992
|
+
/** Named controls a host can replace with `DocxEditor.WatermarkDialog.Field`. @public */
|
|
993
|
+
type WatermarkDialogFieldName = 'noWatermark' | 'pictureWatermark' | 'picture' | 'scale' | 'washout' | 'textWatermark' | 'preset' | 'text' | 'fontFamily' | 'fontSizePt' | 'bold' | 'italic' | 'transparency' | 'color' | 'layout';
|
|
994
|
+
/** Watermark dialog draft and actions. @public */
|
|
995
|
+
interface UseWatermarkDialogReturn extends UseDialogReturn<WatermarkDialogFields> {
|
|
996
|
+
}
|
|
997
|
+
/** Read the enclosing Watermark dialog draft. @public */
|
|
998
|
+
declare function useWatermarkDialog(): UseWatermarkDialogReturn;
|
|
999
|
+
declare function WatermarkDialogRoot({ open, onClose, presets, className, style, children, preset, }: DocxEditorWatermarkDialogProps): ReactElement | null;
|
|
1000
|
+
/**
|
|
1001
|
+
* Watermark dialog: no watermark, a picture, or text, with a live page preview and
|
|
1002
|
+
* replaceable controls and layout. Applies the whole form as one undoable `setWatermark`
|
|
1003
|
+
* command, and writes nothing when the form is unchanged.
|
|
1004
|
+
*
|
|
1005
|
+
* @public
|
|
1006
|
+
*/
|
|
1007
|
+
declare const DocxEditorWatermarkDialog: typeof WatermarkDialogRoot & {
|
|
1008
|
+
Header: (props: DialogPartProps & {
|
|
1009
|
+
name?: WatermarkDialogFieldName | undefined;
|
|
1010
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1011
|
+
Title: (props: DialogPartProps & {
|
|
1012
|
+
name?: WatermarkDialogFieldName | undefined;
|
|
1013
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1014
|
+
Body: (props: DialogPartProps & {
|
|
1015
|
+
name?: WatermarkDialogFieldName | undefined;
|
|
1016
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1017
|
+
/** The page preview of the current draft. Decorative (`aria-hidden`). */
|
|
1018
|
+
Preview: (props: DialogPartProps) => ReactNode;
|
|
1019
|
+
Footer: (props: DialogPartProps & {
|
|
1020
|
+
name?: WatermarkDialogFieldName | undefined;
|
|
1021
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1022
|
+
Apply: (props: DialogPartProps & {
|
|
1023
|
+
name?: WatermarkDialogFieldName | undefined;
|
|
1024
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1025
|
+
Cancel: (props: DialogPartProps & {
|
|
1026
|
+
name?: WatermarkDialogFieldName | undefined;
|
|
1027
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1028
|
+
Error: (props: DialogPartProps & {
|
|
1029
|
+
name?: WatermarkDialogFieldName | undefined;
|
|
1030
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1031
|
+
Field: (props: DialogPartProps & {
|
|
1032
|
+
name: WatermarkDialogFieldName;
|
|
1033
|
+
}) => ReactNode;
|
|
1034
|
+
};
|
|
1035
|
+
|
|
1036
|
+
/** Props for `DocxEditor.BookmarkDialog`. @public */
|
|
1037
|
+
interface DocxEditorBookmarkDialogProps extends DialogCustomizationProps {
|
|
1038
|
+
/** Whether the dialog is shown. The host owns this state. */
|
|
1039
|
+
open: boolean;
|
|
1040
|
+
/** Called on Cancel, Escape, overlay click, and after a successful Add. */
|
|
1041
|
+
onClose: () => void;
|
|
1042
|
+
}
|
|
1043
|
+
/** The Bookmark dialog's draft. @public */
|
|
1044
|
+
interface BookmarkDialogFields {
|
|
1045
|
+
/** The name typed or picked from the list. */
|
|
1046
|
+
name: string;
|
|
1047
|
+
sortBy: BookmarkSortOrder;
|
|
1048
|
+
/** Whether hidden bookmarks (names starting with an underscore) are listed. */
|
|
1049
|
+
showHidden: boolean;
|
|
1050
|
+
}
|
|
1051
|
+
/** Bookmark dialog draft and actions. `apply` is Add. @public */
|
|
1052
|
+
interface UseBookmarkDialogReturn extends UseDialogReturn<BookmarkDialogFields> {
|
|
1053
|
+
/** The bookmarks the list shows, in the chosen order. */
|
|
1054
|
+
readonly rows: readonly BookmarkSummary[];
|
|
1055
|
+
/** Whether Delete and Go To can act on the typed name. */
|
|
1056
|
+
readonly canDelete: boolean;
|
|
1057
|
+
readonly canGoTo: boolean;
|
|
1058
|
+
/**
|
|
1059
|
+
* How many other places carry the typed bookmark's name, which collaborators adding one name
|
|
1060
|
+
* offline can leave. 0 for a name with one bookmark, or no bookmark.
|
|
1061
|
+
*/
|
|
1062
|
+
readonly duplicates: number;
|
|
1063
|
+
remove(): void;
|
|
1064
|
+
goTo(): void;
|
|
1065
|
+
/** Keep the first bookmark with the typed name and remove its copies. */
|
|
1066
|
+
keepFirst(): void;
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* The dialog is mounted only while it is open, so a closed dialog reads no bookmarks on each
|
|
1070
|
+
* editor update. Each opening starts a fresh draft.
|
|
1071
|
+
*/
|
|
1072
|
+
declare function BookmarkDialogRoot(props: DocxEditorBookmarkDialogProps): ReactElement | null;
|
|
1073
|
+
/** Read the enclosing Bookmark dialog draft. @public */
|
|
1074
|
+
declare function useBookmarkDialog(): UseBookmarkDialogReturn;
|
|
1075
|
+
type PartComponent = (props: DialogPartProps) => ReactNode;
|
|
1076
|
+
/** The Bookmark dialog with replaceable controls and layout. @public */
|
|
1077
|
+
declare const DocxEditorBookmarkDialog: typeof BookmarkDialogRoot & {
|
|
1078
|
+
Header: (props: DialogPartProps & {
|
|
1079
|
+
name?: "list" | "name" | "showHidden" | "sortBy" | undefined;
|
|
1080
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1081
|
+
Title: (props: DialogPartProps & {
|
|
1082
|
+
name?: "list" | "name" | "showHidden" | "sortBy" | undefined;
|
|
1083
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1084
|
+
Body: (props: DialogPartProps & {
|
|
1085
|
+
name?: "list" | "name" | "showHidden" | "sortBy" | undefined;
|
|
1086
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1087
|
+
Footer: (props: DialogPartProps & {
|
|
1088
|
+
name?: "list" | "name" | "showHidden" | "sortBy" | undefined;
|
|
1089
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1090
|
+
/** Add: bookmark the selection under the typed name. */
|
|
1091
|
+
Apply: (props: DialogPartProps & {
|
|
1092
|
+
name?: "list" | "name" | "showHidden" | "sortBy" | undefined;
|
|
1093
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1094
|
+
Cancel: (props: DialogPartProps & {
|
|
1095
|
+
name?: "list" | "name" | "showHidden" | "sortBy" | undefined;
|
|
1096
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1097
|
+
Error: (props: DialogPartProps & {
|
|
1098
|
+
name?: "list" | "name" | "showHidden" | "sortBy" | undefined;
|
|
1099
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1100
|
+
Field: (props: DialogPartProps & {
|
|
1101
|
+
name: "list" | "name" | "showHidden" | "sortBy";
|
|
1102
|
+
}) => ReactNode;
|
|
1103
|
+
Delete: PartComponent;
|
|
1104
|
+
GoTo: PartComponent;
|
|
1105
|
+
/** Shown while the typed name has copies: keep the first, remove the rest. */
|
|
1106
|
+
KeepFirst: PartComponent;
|
|
1107
|
+
};
|
|
1108
|
+
|
|
1109
|
+
/** Props for `DocxEditor.SplitCellDialog`. @public */
|
|
1110
|
+
interface DocxEditorSplitCellDialogProps extends DialogCustomizationProps {
|
|
1111
|
+
/** Whether the dialog is shown. The host owns this state. */
|
|
1112
|
+
open: boolean;
|
|
1113
|
+
/** Called on Cancel, Escape, overlay click, and after a successful Split. */
|
|
1114
|
+
onClose: () => void;
|
|
1115
|
+
}
|
|
1116
|
+
/** The Split cells dialog's draft, as typed. @public */
|
|
1117
|
+
interface SplitCellDialogFields {
|
|
1118
|
+
/** The number of columns, as typed. */
|
|
1119
|
+
columns: string;
|
|
1120
|
+
/** The number of rows, as typed. */
|
|
1121
|
+
rows: string;
|
|
1122
|
+
}
|
|
1123
|
+
/** Split cells dialog draft and actions. `apply` is Split. @public */
|
|
1124
|
+
interface UseSplitCellDialogReturn extends UseDialogReturn<SplitCellDialogFields> {
|
|
1125
|
+
/** The most columns and rows the cell splits into, or null outside a cell that splits. */
|
|
1126
|
+
readonly limits: SplitCellLimits | null;
|
|
1127
|
+
}
|
|
1128
|
+
declare function SplitCellDialogRoot(props: DocxEditorSplitCellDialogProps): ReactElement | null;
|
|
1129
|
+
/** Read the enclosing Split cells dialog draft. @public */
|
|
1130
|
+
declare function useSplitCellDialog(): UseSplitCellDialogReturn;
|
|
1131
|
+
/** The Split cells dialog with replaceable controls and layout. @public */
|
|
1132
|
+
declare const DocxEditorSplitCellDialog: typeof SplitCellDialogRoot & {
|
|
1133
|
+
Header: (props: DialogPartProps & {
|
|
1134
|
+
name?: "columns" | "rows" | undefined;
|
|
1135
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | Iterable<react.ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1136
|
+
Title: (props: DialogPartProps & {
|
|
1137
|
+
name?: "columns" | "rows" | undefined;
|
|
1138
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | Iterable<react.ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1139
|
+
Body: (props: DialogPartProps & {
|
|
1140
|
+
name?: "columns" | "rows" | undefined;
|
|
1141
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | Iterable<react.ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1142
|
+
Footer: (props: DialogPartProps & {
|
|
1143
|
+
name?: "columns" | "rows" | undefined;
|
|
1144
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | Iterable<react.ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1145
|
+
/** Split: divide the cell at the selection into the typed counts. */
|
|
1146
|
+
Apply: (props: DialogPartProps & {
|
|
1147
|
+
name?: "columns" | "rows" | undefined;
|
|
1148
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | Iterable<react.ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1149
|
+
Cancel: (props: DialogPartProps & {
|
|
1150
|
+
name?: "columns" | "rows" | undefined;
|
|
1151
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | Iterable<react.ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1152
|
+
Error: (props: DialogPartProps & {
|
|
1153
|
+
name?: "columns" | "rows" | undefined;
|
|
1154
|
+
}) => string | number | bigint | boolean | react.JSX.Element | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | Iterable<react.ReactNode> | ReactElement<unknown, string | react.JSXElementConstructor<any>> | react.ReactPortal | null | undefined> | null;
|
|
1155
|
+
Field: (props: DialogPartProps & {
|
|
1156
|
+
name: "columns" | "rows";
|
|
1157
|
+
}) => react.ReactNode;
|
|
1158
|
+
};
|
|
1159
|
+
|
|
848
1160
|
/** Shared props for every part. @public */
|
|
849
1161
|
interface HyperLinkPartProps {
|
|
850
1162
|
className?: string;
|
|
@@ -1374,6 +1686,14 @@ declare const ContextMenuInsertColumnLeft: (({ icon, labelKey, className, hidden
|
|
|
1374
1686
|
declare const ContextMenuInsertColumnRight: (({ icon, labelKey, className, hidden, destructive }: ContextMenuTableRowProps) => react.JSX.Element | null) & {
|
|
1375
1687
|
docxRow: string;
|
|
1376
1688
|
};
|
|
1689
|
+
/** Merge the selected cells into one cell. @public */
|
|
1690
|
+
declare const ContextMenuMergeCells: (({ icon, labelKey, className, hidden, destructive }: ContextMenuTableRowProps) => react.JSX.Element | null) & {
|
|
1691
|
+
docxRow: string;
|
|
1692
|
+
};
|
|
1693
|
+
/** Open the Split cells dialog for the cell at the selection. @public */
|
|
1694
|
+
declare const ContextMenuSplitCell: (({ icon, labelKey, className, hidden }: ContextMenuCommandProps) => react.JSX.Element | null) & {
|
|
1695
|
+
docxRow: string;
|
|
1696
|
+
};
|
|
1377
1697
|
/** Delete the current table row. @public */
|
|
1378
1698
|
declare const ContextMenuDeleteTableRow: (({ icon, labelKey, className, hidden, destructive }: ContextMenuTableRowProps) => react.JSX.Element | null) & {
|
|
1379
1699
|
docxRow: string;
|
|
@@ -1475,6 +1795,8 @@ interface DocxEditorContextMenuNamespace {
|
|
|
1475
1795
|
readonly InsertRowBelow: typeof ContextMenuInsertRowBelow;
|
|
1476
1796
|
readonly InsertColumnLeft: typeof ContextMenuInsertColumnLeft;
|
|
1477
1797
|
readonly InsertColumnRight: typeof ContextMenuInsertColumnRight;
|
|
1798
|
+
readonly MergeCells: typeof ContextMenuMergeCells;
|
|
1799
|
+
readonly SplitCell: typeof ContextMenuSplitCell;
|
|
1478
1800
|
readonly DeleteTableRow: typeof ContextMenuDeleteTableRow;
|
|
1479
1801
|
readonly DeleteTableColumn: typeof ContextMenuDeleteTableColumn;
|
|
1480
1802
|
readonly DeleteTable: typeof ContextMenuDeleteTable;
|
|
@@ -1568,6 +1890,8 @@ interface DocxEditorPopups {
|
|
|
1568
1890
|
*/
|
|
1569
1891
|
contentControlPicture?: DocxEditorPopup<DocxEditorContentControlWidgetProps>;
|
|
1570
1892
|
invalidTextFormField?: DocxEditorPopup<DocxEditorInvalidTextFormFieldDialogProps>;
|
|
1893
|
+
/** Why a chosen or pasted picture could not be inserted. False shows nothing. */
|
|
1894
|
+
imageInsertError?: DocxEditorPopup<DocxEditorImageInsertErrorDialogProps>;
|
|
1571
1895
|
imageProperties?: DocxEditorPopup<DocxEditorImagePropertiesDialogProps>;
|
|
1572
1896
|
imageAltText?: DocxEditorPopup<DocxEditorImageAltTextPopupProps>;
|
|
1573
1897
|
noteProperties?: DocxEditorPopup<DocxEditorNotePropertiesDialogProps>;
|
|
@@ -1575,6 +1899,12 @@ interface DocxEditorPopups {
|
|
|
1575
1899
|
notesContextMenu?: DocxEditorPopup<DocxEditorNotesContextMenuProps>;
|
|
1576
1900
|
pageSetup?: DocxEditorPopup<DocxEditorPageSetupDialogProps>;
|
|
1577
1901
|
paragraph?: DocxEditorPopup<DocxEditorParagraphDialogProps>;
|
|
1902
|
+
/** The Watermark dialog the Insert menu opens. Pass `presets` here to change its text choices. */
|
|
1903
|
+
watermark?: DocxEditorPopup<DocxEditorWatermarkDialogProps>;
|
|
1904
|
+
/** The Bookmark dialog the Insert menu and Ctrl/Cmd+Shift+F5 open. */
|
|
1905
|
+
bookmark?: DocxEditorPopup<DocxEditorBookmarkDialogProps>;
|
|
1906
|
+
/** The Split cells dialog the table context menu and toolbar open. */
|
|
1907
|
+
splitCell?: DocxEditorPopup<DocxEditorSplitCellDialogProps>;
|
|
1578
1908
|
revisionMarkup?: DocxEditorPopup<DocxEditorRevisionMarkupDialogProps>;
|
|
1579
1909
|
textFormField?: DocxEditorPopup<DocxEditorTextFormFieldDialogProps>;
|
|
1580
1910
|
hyperlink?: DocxEditorPopup<HyperLinkProps>;
|
|
@@ -1606,17 +1936,50 @@ declare function useDocxEditor(): DocxEditorInstance | null;
|
|
|
1606
1936
|
* legitimately compose two rails.
|
|
1607
1937
|
*/
|
|
1608
1938
|
interface ReviewRailRegistry {
|
|
1939
|
+
/**
|
|
1940
|
+
* Review columns registered through `register`: the packaged rail, and any column that
|
|
1941
|
+
* serves comment drafts. The Add comment controls in the toolbar and the context menu
|
|
1942
|
+
* appear only while this is above zero.
|
|
1943
|
+
*/
|
|
1609
1944
|
readonly mounted: number;
|
|
1945
|
+
/**
|
|
1946
|
+
* Register a review column that serves comment drafts. Also reserves the review gutter.
|
|
1947
|
+
* Call it on mount, together with `registerCommentDraft`. Returns the unregister function.
|
|
1948
|
+
*/
|
|
1610
1949
|
readonly register: () => () => void;
|
|
1950
|
+
/**
|
|
1951
|
+
* Claims registered through `reserveGutter`: columns that need the review gutter but
|
|
1952
|
+
* serve no comment draft. The viewport reserves the gutter while `mounted + gutters` is
|
|
1953
|
+
* above zero.
|
|
1954
|
+
*/
|
|
1955
|
+
readonly gutters?: number;
|
|
1956
|
+
/** Reserve the review gutter without showing comment controls. Returns the release. */
|
|
1957
|
+
readonly reserveGutter?: () => () => void;
|
|
1958
|
+
/**
|
|
1959
|
+
* Receive the Add comment requests. The handler takes no arguments: it reads the
|
|
1960
|
+
* selection's position with `getSelectionPlacement`, pins the selection with
|
|
1961
|
+
* `retainSelection`, and opens the pane. Release the pin with `releaseSelection` when the
|
|
1962
|
+
* draft closes or is cancelled. The most recently registered handler receives each request. Do not register
|
|
1963
|
+
* while the column cannot open a draft, such as in viewing mode: a request counts as
|
|
1964
|
+
* served once a handler runs. While a handler is registered, the `review.addComment`
|
|
1965
|
+
* control is enabled. Returns the unregister function.
|
|
1966
|
+
*/
|
|
1611
1967
|
readonly registerCommentDraft: (handler: () => void) => () => void;
|
|
1968
|
+
/**
|
|
1969
|
+
* Send an Add comment request through the `review.addComment` control. The most recent
|
|
1970
|
+
* registration receives it: a handler registered here, or one registered with
|
|
1971
|
+
* `useCommentDraftRequest`. Returns `true` when a handler ran, even if it then opened
|
|
1972
|
+
* nothing, and `false` when the control is disabled.
|
|
1973
|
+
*/
|
|
1612
1974
|
readonly requestCommentDraft: () => boolean;
|
|
1613
1975
|
}
|
|
1614
1976
|
declare const ReviewRailContext: react.Context<ReviewRailRegistry | null>;
|
|
1615
1977
|
|
|
1616
1978
|
/**
|
|
1617
|
-
* Props for `DocxEditor.Root`. `document
|
|
1618
|
-
*
|
|
1619
|
-
*
|
|
1979
|
+
* Props for `DocxEditor.Root`. `document` and `imageDecodePort` identity changes remount the
|
|
1980
|
+
* editor. Changing `fontShaping.maxFontBytes` also remounts. Later `fonts`, `author`, `locale`,
|
|
1981
|
+
* `mode`, `translate`, `zoom`, and `zoomMode` changes use instance setters, so edits, selection
|
|
1982
|
+
* and undo history survive them. `modules` is sampled at mount only.
|
|
1620
1983
|
*
|
|
1621
1984
|
* @public
|
|
1622
1985
|
*/
|
|
@@ -1632,8 +1995,9 @@ interface DocxEditorRootProps {
|
|
|
1632
1995
|
* uses a fixed-width estimate; fonts embedded in the document are wired automatically
|
|
1633
1996
|
* either way. Pass `await loadDefaultFonts()` from `@docx-editor.dev/fonts` for
|
|
1634
1997
|
* Word's default faces — a bare fragment is accepted — or compose several origins
|
|
1635
|
-
* with `composeFontConfiguration`.
|
|
1636
|
-
*
|
|
1998
|
+
* with `composeFontConfiguration`. An identity change replaces the fonts in place
|
|
1999
|
+
* (`setFonts`), keeping the document, selection and undo history; keep the reference stable
|
|
2000
|
+
* across renders. Failures degrade to the fixed measurer and report through `onFontError`.
|
|
1637
2001
|
*/
|
|
1638
2002
|
fonts?: FontConfiguration | FontConfigurationFragment | FontResolver;
|
|
1639
2003
|
/** Explicit shaping byte ceiling; a changed maxFontBytes value remounts. */
|
|
@@ -2402,6 +2766,10 @@ interface DocxEditorToolbarNamespace {
|
|
|
2402
2766
|
readonly TableBorderWidth: TableBorderWidthNamespace;
|
|
2403
2767
|
/** Cell background fill split compound (quick-apply main + swatch dialog). */
|
|
2404
2768
|
readonly TableCellFill: TableCellFillNamespace;
|
|
2769
|
+
/** Merge the selected cells. */
|
|
2770
|
+
readonly TableMergeCells: ToolbarPartComponent;
|
|
2771
|
+
/** Open the Split cells dialog. */
|
|
2772
|
+
readonly TableSplitCell: ToolbarPartComponent;
|
|
2405
2773
|
readonly Comments: ToolbarPartComponent;
|
|
2406
2774
|
readonly FontFamily: typeof FontFamily;
|
|
2407
2775
|
readonly FontSize: ToolbarSlotPartComponent;
|
|
@@ -2425,6 +2793,32 @@ interface DocxEditorToolbarNamespace {
|
|
|
2425
2793
|
*/
|
|
2426
2794
|
declare const DocxEditorToolbar: DocxEditorToolbarNamespace;
|
|
2427
2795
|
|
|
2796
|
+
/**
|
|
2797
|
+
* The Watermark dialog, from the Insert menu.
|
|
2798
|
+
*
|
|
2799
|
+
* Same shape as page setup: no fixed command to dispatch, so the row asks through the
|
|
2800
|
+
* slot's probe and is disabled with the engine's own words on a document it cannot rewrite.
|
|
2801
|
+
*/
|
|
2802
|
+
declare function MenuWatermarkImpl({ className, hidden }: MenuActionProps): react.JSX.Element | null;
|
|
2803
|
+
/** Insert › Watermark, so a host can hide it or place it elsewhere by name. @public */
|
|
2804
|
+
declare const MenuWatermark: typeof MenuWatermarkImpl & {
|
|
2805
|
+
docxSlot: 'insert.watermark';
|
|
2806
|
+
};
|
|
2807
|
+
|
|
2808
|
+
declare function MenuBookmarkImpl({ className, hidden }: MenuActionProps): react.JSX.Element;
|
|
2809
|
+
/**
|
|
2810
|
+
* Insert › Bookmark, so a host can hide it or place it elsewhere by name.
|
|
2811
|
+
*
|
|
2812
|
+
* An ordinary command row: the slot runs `openBookmarkDialog`, which opens the `bookmark`
|
|
2813
|
+
* popup through the editor, the same request Ctrl/Cmd+Shift+F5 sends. The row is disabled
|
|
2814
|
+
* while no bookmark dialog is registered, for example when the popup is `false`.
|
|
2815
|
+
*
|
|
2816
|
+
* @public
|
|
2817
|
+
*/
|
|
2818
|
+
declare const MenuBookmark: typeof MenuBookmarkImpl & {
|
|
2819
|
+
docxSlot: 'insert.bookmark';
|
|
2820
|
+
};
|
|
2821
|
+
|
|
2428
2822
|
/** Props for `DocxEditor.Menu.ReportIssue`. @public */
|
|
2429
2823
|
interface MenuReportIssueProps {
|
|
2430
2824
|
className?: string;
|
|
@@ -2562,6 +2956,9 @@ interface DocxEditorMenuNamespace {
|
|
|
2562
2956
|
readonly PageSetup: typeof MenuPageSetup;
|
|
2563
2957
|
/** Insert › Image, so a host can hide it or place it elsewhere by name. */
|
|
2564
2958
|
readonly ImageInsert: typeof MenuImageInsert;
|
|
2959
|
+
/** Insert › Watermark, so a host can hide it or place it elsewhere by name. */
|
|
2960
|
+
readonly Watermark: typeof MenuWatermark;
|
|
2961
|
+
readonly Bookmark: typeof MenuBookmark;
|
|
2565
2962
|
/** Review > Markup Options > Reviewers. */
|
|
2566
2963
|
readonly Reviewers: typeof MenuReviewers;
|
|
2567
2964
|
/** Help › Report issue, so a host can drop it or point it elsewhere by name. */
|
|
@@ -2635,64 +3032,8 @@ interface DocxEditorDocumentOutlineProps {
|
|
|
2635
3032
|
*/
|
|
2636
3033
|
declare function DocxEditorDocumentOutline(props: DocxEditorDocumentOutlineProps): ReactElement | null;
|
|
2637
3034
|
|
|
2638
|
-
/**
|
|
2639
|
-
|
|
2640
|
-
/**
|
|
2641
|
-
* Which matches to mark: every match with the active one emphasized (`'all'`), only the
|
|
2642
|
-
* active match (`'active'`), or none (`'none'`). Default: `'all'`.
|
|
2643
|
-
*/
|
|
2644
|
-
readonly highlight?: DocumentSearchHighlight;
|
|
2645
|
-
}
|
|
2646
|
-
/** What `useDocumentSearch` answers. @public */
|
|
2647
|
-
interface UseDocumentSearchResult {
|
|
2648
|
-
/** The text in the search box, updated synchronously as the user types. */
|
|
2649
|
-
readonly query: string;
|
|
2650
|
-
/** Update the typed query. The search runs after a short debounce. */
|
|
2651
|
-
readonly setQuery: (query: string) => void;
|
|
2652
|
-
/**
|
|
2653
|
-
* Search now and return the matches. `selectFirst` selects the first match; `highlight`
|
|
2654
|
-
* highlights the results until `clear()`, even without this hook's own request.
|
|
2655
|
-
*/
|
|
2656
|
-
readonly find: (query: string, options?: DocumentSearchFindOptions) => readonly TextMatch[];
|
|
2657
|
-
readonly matchCase: boolean;
|
|
2658
|
-
readonly setMatchCase: (value: boolean) => void;
|
|
2659
|
-
readonly wholeWord: boolean;
|
|
2660
|
-
readonly setWholeWord: (value: boolean) => void;
|
|
2661
|
-
/** Matches for the last RUN query, in document order. */
|
|
2662
|
-
readonly matches: readonly TextMatch[];
|
|
2663
|
-
/**
|
|
2664
|
-
* Whether the engine stopped at its cap with matches still ahead of it, so a count
|
|
2665
|
-
* should read "2000+" rather than an exact total. A search that lands on exactly the cap
|
|
2666
|
-
* reports true; over-reporting by one is the honest direction.
|
|
2667
|
-
*/
|
|
2668
|
-
readonly truncated: boolean;
|
|
2669
|
-
/** Index of the match the caret was last sent to, or `-1` before any navigation. */
|
|
2670
|
-
readonly activeIndex: number;
|
|
2671
|
-
/** The current match, or `null` before any navigation. */
|
|
2672
|
-
readonly activeMatch: TextMatch | null;
|
|
2673
|
-
/**
|
|
2674
|
-
* Select a match by index and bring its page into view. Focus stays where it is, so a
|
|
2675
|
-
* search box keeps it. Returns false for an index without a match.
|
|
2676
|
-
*/
|
|
2677
|
-
readonly goTo: (index: number) => boolean;
|
|
2678
|
-
/** Next / previous match, wrapping at the ends the way Word's arrows do. */
|
|
2679
|
-
readonly next: () => boolean;
|
|
2680
|
-
readonly previous: () => boolean;
|
|
2681
|
-
/** Empty the box and drop the results, without touching the selection. */
|
|
2682
|
-
readonly clear: () => void;
|
|
2683
|
-
/** Whether a typed query is waiting for its debounce to elapse. */
|
|
2684
|
-
readonly isPending: boolean;
|
|
2685
|
-
}
|
|
2686
|
-
/**
|
|
2687
|
-
* The editor's shared search, with no UI attached. The packaged Find pane uses the same
|
|
2688
|
-
* session, so state set here shows there.
|
|
2689
|
-
*
|
|
2690
|
-
* @public
|
|
2691
|
-
*/
|
|
2692
|
-
declare function useDocumentSearch(options?: UseDocumentSearchOptions): UseDocumentSearchResult;
|
|
2693
|
-
|
|
2694
|
-
/** The pane's tabs. Word's Replace tab is a later slice; nothing here pretends it exists. */
|
|
2695
|
-
type NavigationTab$1 = 'headings' | 'find';
|
|
3035
|
+
/** The pane's tabs: the outline, Find, and Go to (bookmarks). */
|
|
3036
|
+
type NavigationTab$1 = 'headings' | 'find' | 'goto';
|
|
2696
3037
|
/** How `useNavigationPane` is configured. @public */
|
|
2697
3038
|
interface UseNavigationPaneOptions {
|
|
2698
3039
|
/** Open state for the first render when the pane is uncontrolled. Defaults to closed. */
|
|
@@ -2797,6 +3138,70 @@ declare function NavigationFind({ className, style }: NavigationPartProps): Reac
|
|
|
2797
3138
|
*/
|
|
2798
3139
|
declare function NavigationToggle({ className, style, children, }: NavigationPartProps): ReactElement;
|
|
2799
3140
|
|
|
3141
|
+
/**
|
|
3142
|
+
* The Bookmarks panel: a bookmark search box, the sort order and hidden-bookmarks toggle, and
|
|
3143
|
+
* the bookmarks it offers, grouped by place when sorted by location.
|
|
3144
|
+
*
|
|
3145
|
+
* @public
|
|
3146
|
+
*/
|
|
3147
|
+
declare function NavigationGoTo({ className, style }: NavigationPartProps): ReactElement;
|
|
3148
|
+
|
|
3149
|
+
/** How `useDocumentSearch` behaves. @public */
|
|
3150
|
+
interface UseDocumentSearchOptions {
|
|
3151
|
+
/**
|
|
3152
|
+
* Which matches to mark: every match with the active one emphasized (`'all'`), only the
|
|
3153
|
+
* active match (`'active'`), or none (`'none'`). Default: `'all'`.
|
|
3154
|
+
*/
|
|
3155
|
+
readonly highlight?: DocumentSearchHighlight;
|
|
3156
|
+
}
|
|
3157
|
+
/** What `useDocumentSearch` answers. @public */
|
|
3158
|
+
interface UseDocumentSearchResult {
|
|
3159
|
+
/** The text in the search box, updated synchronously as the user types. */
|
|
3160
|
+
readonly query: string;
|
|
3161
|
+
/** Update the typed query. The search runs after a short debounce. */
|
|
3162
|
+
readonly setQuery: (query: string) => void;
|
|
3163
|
+
/**
|
|
3164
|
+
* Search now and return the matches. `selectFirst` selects the first match; `highlight`
|
|
3165
|
+
* highlights the results until `clear()`, even without this hook's own request.
|
|
3166
|
+
*/
|
|
3167
|
+
readonly find: (query: string, options?: DocumentSearchFindOptions) => readonly TextMatch[];
|
|
3168
|
+
readonly matchCase: boolean;
|
|
3169
|
+
readonly setMatchCase: (value: boolean) => void;
|
|
3170
|
+
readonly wholeWord: boolean;
|
|
3171
|
+
readonly setWholeWord: (value: boolean) => void;
|
|
3172
|
+
/** Matches for the last RUN query, in document order. */
|
|
3173
|
+
readonly matches: readonly TextMatch[];
|
|
3174
|
+
/**
|
|
3175
|
+
* Whether the engine stopped at its cap with matches still ahead of it, so a count
|
|
3176
|
+
* should read "2000+" rather than an exact total. A search that lands on exactly the cap
|
|
3177
|
+
* reports true; over-reporting by one is the honest direction.
|
|
3178
|
+
*/
|
|
3179
|
+
readonly truncated: boolean;
|
|
3180
|
+
/** Index of the match the caret was last sent to, or `-1` before any navigation. */
|
|
3181
|
+
readonly activeIndex: number;
|
|
3182
|
+
/** The current match, or `null` before any navigation. */
|
|
3183
|
+
readonly activeMatch: TextMatch | null;
|
|
3184
|
+
/**
|
|
3185
|
+
* Select a match by index and bring its page into view. Focus stays where it is, so a
|
|
3186
|
+
* search box keeps it. Returns false for an index without a match.
|
|
3187
|
+
*/
|
|
3188
|
+
readonly goTo: (index: number) => boolean;
|
|
3189
|
+
/** Next / previous match, wrapping at the ends the way Word's arrows do. */
|
|
3190
|
+
readonly next: () => boolean;
|
|
3191
|
+
readonly previous: () => boolean;
|
|
3192
|
+
/** Empty the box and drop the results, without touching the selection. */
|
|
3193
|
+
readonly clear: () => void;
|
|
3194
|
+
/** Whether a typed query is waiting for its debounce to elapse. */
|
|
3195
|
+
readonly isPending: boolean;
|
|
3196
|
+
}
|
|
3197
|
+
/**
|
|
3198
|
+
* The editor's shared search, with no UI attached. The packaged Find pane uses the same
|
|
3199
|
+
* session, so state set here shows there.
|
|
3200
|
+
*
|
|
3201
|
+
* @public
|
|
3202
|
+
*/
|
|
3203
|
+
declare function useDocumentSearch(options?: UseDocumentSearchOptions): UseDocumentSearchResult;
|
|
3204
|
+
|
|
2800
3205
|
/** Props for `DocxEditor.Navigation`. @public */
|
|
2801
3206
|
interface DocxEditorNavigationProps extends UseNavigationPaneOptions {
|
|
2802
3207
|
/**
|
|
@@ -2826,6 +3231,12 @@ interface DocxEditorNavigationProps extends UseNavigationPaneOptions {
|
|
|
2826
3231
|
* browser's own search. Set `false` to leave the shortcut to the browser everywhere.
|
|
2827
3232
|
*/
|
|
2828
3233
|
findShortcut?: boolean;
|
|
3234
|
+
/**
|
|
3235
|
+
* Whether Ctrl+G (Cmd+Option+G on macOS) opens the pane on the Go to tab. Defaults to
|
|
3236
|
+
* `true`, and applies only while focus is in this editor. The `openGoTo` editor command
|
|
3237
|
+
* opens the tab either way.
|
|
3238
|
+
*/
|
|
3239
|
+
goToShortcut?: boolean;
|
|
2829
3240
|
className?: string;
|
|
2830
3241
|
style?: CSSProperties;
|
|
2831
3242
|
/** Replaces the default composition (header, tabs, both panels). */
|
|
@@ -2851,10 +3262,68 @@ interface DocxEditorNavigationNamespace {
|
|
|
2851
3262
|
readonly Tab: typeof NavigationTab;
|
|
2852
3263
|
readonly Headings: typeof NavigationHeadings;
|
|
2853
3264
|
readonly Find: typeof NavigationFind;
|
|
3265
|
+
readonly GoTo: typeof NavigationGoTo;
|
|
2854
3266
|
readonly Toggle: typeof NavigationToggle;
|
|
2855
3267
|
}
|
|
2856
3268
|
declare const Navigation: DocxEditorNavigationNamespace;
|
|
2857
3269
|
|
|
3270
|
+
/**
|
|
3271
|
+
* Why a Go To jump did not happen: nothing was typed, no bookmark has the name, or the editor
|
|
3272
|
+
* refused the jump for another reason (it is not ready, or the story could not be shown).
|
|
3273
|
+
*
|
|
3274
|
+
* @public
|
|
3275
|
+
*/
|
|
3276
|
+
type GoToBookmarkProblem = 'empty' | 'notFound' | 'failed';
|
|
3277
|
+
/** How `useGoToBookmark` is configured. @public */
|
|
3278
|
+
interface UseGoToBookmarkOptions {
|
|
3279
|
+
/**
|
|
3280
|
+
* Whether to read the document's bookmarks. Defaults to `true`. Pass `false` while your UI
|
|
3281
|
+
* is hidden: the list is then empty and the document is not read on each change.
|
|
3282
|
+
*/
|
|
3283
|
+
readonly enabled?: boolean;
|
|
3284
|
+
}
|
|
3285
|
+
/** What `useGoToBookmark` answers. @public */
|
|
3286
|
+
interface UseGoToBookmarkReturn {
|
|
3287
|
+
/** The text in the name box. */
|
|
3288
|
+
readonly query: string;
|
|
3289
|
+
/** Change the text. The highlight goes back to none. */
|
|
3290
|
+
readonly setQuery: (query: string) => void;
|
|
3291
|
+
readonly sortBy: BookmarkSortOrder;
|
|
3292
|
+
readonly setSortBy: (sortBy: BookmarkSortOrder) => void;
|
|
3293
|
+
/** Whether hidden bookmarks (names starting with an underscore) are offered. */
|
|
3294
|
+
readonly showHidden: boolean;
|
|
3295
|
+
readonly setShowHidden: (showHidden: boolean) => void;
|
|
3296
|
+
/** The bookmarks offered for the query: names that start with it first. */
|
|
3297
|
+
readonly rows: readonly BookmarkSummary[];
|
|
3298
|
+
/** Every bookmark the document declares, hidden ones included. Empty while disabled. */
|
|
3299
|
+
readonly bookmarks: readonly BookmarkSummary[];
|
|
3300
|
+
/**
|
|
3301
|
+
* Index into `rows` of the highlighted row, or -1 when none is. The highlight follows its
|
|
3302
|
+
* bookmark when rows move, and clears when that bookmark goes away.
|
|
3303
|
+
*/
|
|
3304
|
+
readonly activeIndex: number;
|
|
3305
|
+
/** Move the highlight by `delta` rows, wrapping at either end. */
|
|
3306
|
+
readonly move: (delta: number) => void;
|
|
3307
|
+
/** Highlight the row at `index` of `rows`, or none with -1. */
|
|
3308
|
+
readonly setActiveIndex: (index: number) => void;
|
|
3309
|
+
/**
|
|
3310
|
+
* Jump to `name`, or else to what the name box means: the highlighted row, the bookmark
|
|
3311
|
+
* named exactly as typed, or the first row offered. Answers the `goToBookmark` result and
|
|
3312
|
+
* sets `problem` when it is refused.
|
|
3313
|
+
*/
|
|
3314
|
+
readonly go: (name?: string) => ExecResult;
|
|
3315
|
+
/** Why the last jump did not happen, or null. Cleared when the query changes. */
|
|
3316
|
+
readonly problem: GoToBookmarkProblem | null;
|
|
3317
|
+
/** The name the last refused jump asked for, for a message. Empty when nothing was typed. */
|
|
3318
|
+
readonly problemName: string;
|
|
3319
|
+
}
|
|
3320
|
+
/**
|
|
3321
|
+
* Go To for bookmarks: filter by name, move through the offered rows, and jump.
|
|
3322
|
+
*
|
|
3323
|
+
* @public
|
|
3324
|
+
*/
|
|
3325
|
+
declare function useGoToBookmark(options?: UseGoToBookmarkOptions): UseGoToBookmarkReturn;
|
|
3326
|
+
|
|
2858
3327
|
/**
|
|
2859
3328
|
* One heading of the engine's outline: text, 0-based level, and the block id
|
|
2860
3329
|
* `Editor.scrollToBlock` accepts.
|
|
@@ -3031,6 +3500,162 @@ interface DocxEditorFontNoticeProps {
|
|
|
3031
3500
|
*/
|
|
3032
3501
|
declare function DocxEditorFontNotice({ className, style, t: tProp }: DocxEditorFontNoticeProps): react.JSX.Element | null;
|
|
3033
3502
|
|
|
3503
|
+
/** The current refused open, with the packaged message and a way to dismiss it. @public */
|
|
3504
|
+
interface UseOpenFailureReturn {
|
|
3505
|
+
/** The refused open, or `null` when there is none or the person dismissed it. */
|
|
3506
|
+
readonly failure: DocumentOpenFailure | null;
|
|
3507
|
+
/** The packaged, translated message for {@link UseOpenFailureReturn.failure}. */
|
|
3508
|
+
readonly message: string | null;
|
|
3509
|
+
/**
|
|
3510
|
+
* Hide this refusal. A later refusal shows again, even for the same file. Pass the failure
|
|
3511
|
+
* your UI showed, such as from a toast's close callback, so a late call cannot hide a newer
|
|
3512
|
+
* refusal. It also works as a click handler directly, such as `onClick={dismiss}`: an event
|
|
3513
|
+
* hides the refusal on screen.
|
|
3514
|
+
*/
|
|
3515
|
+
dismiss(failure?: DocumentOpenFailure | Event | {
|
|
3516
|
+
readonly nativeEvent: Event;
|
|
3517
|
+
}): void;
|
|
3518
|
+
}
|
|
3519
|
+
/** Options for {@link useOpenFailure}. @public */
|
|
3520
|
+
interface UseOpenFailureOptions {
|
|
3521
|
+
/** Translator override; defaults to the ambient locale context. */
|
|
3522
|
+
t?: TFunction;
|
|
3523
|
+
}
|
|
3524
|
+
/**
|
|
3525
|
+
* Reads the document the editor refused to open, for a host that shows it in its own UI,
|
|
3526
|
+
* such as a toast. Pair it with `openFailure={false}` on `<DocxEditor>`, so the packaged
|
|
3527
|
+
* dialog does not show as well. Call it inside a `DocxEditor.Root`.
|
|
3528
|
+
*
|
|
3529
|
+
* ```tsx
|
|
3530
|
+
* function OpenFailureToast() {
|
|
3531
|
+
* const { failure, message, dismiss } = useOpenFailure();
|
|
3532
|
+
* if (!failure) return null;
|
|
3533
|
+
* return <Toast title={message} detail={failure.code} onClose={() => dismiss(failure)} />;
|
|
3534
|
+
* }
|
|
3535
|
+
* ```
|
|
3536
|
+
*
|
|
3537
|
+
* @public
|
|
3538
|
+
*/
|
|
3539
|
+
declare function useOpenFailure(options?: UseOpenFailureOptions): UseOpenFailureReturn;
|
|
3540
|
+
/** What `actions` and `children` receive. @public */
|
|
3541
|
+
interface DocxEditorOpenFailureContext {
|
|
3542
|
+
/** The refused open: its stable `code` and its `reason`. */
|
|
3543
|
+
readonly failure: DocumentOpenFailure;
|
|
3544
|
+
/** The packaged, translated message for the failure. */
|
|
3545
|
+
readonly message: string;
|
|
3546
|
+
/** Close the dialog. It calls `onDismiss`, as **Close** does. */
|
|
3547
|
+
dismiss(): void;
|
|
3548
|
+
}
|
|
3549
|
+
/** Props for `DocxEditor.OpenFailure.Action`. @public */
|
|
3550
|
+
interface DocxEditorOpenFailureActionProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
3551
|
+
/** `primary` is filled, `secondary` is outlined. Defaults to `secondary`. */
|
|
3552
|
+
variant?: 'primary' | 'secondary';
|
|
3553
|
+
/** Close the dialog after `onClick` runs, unless the handler called `preventDefault()`. */
|
|
3554
|
+
dismiss?: boolean;
|
|
3555
|
+
/** Render your own element, such as a link, with the button's classes and handler. */
|
|
3556
|
+
asChild?: boolean;
|
|
3557
|
+
children?: DocxEditorChildren;
|
|
3558
|
+
}
|
|
3559
|
+
/**
|
|
3560
|
+
* A button in the open-failure dialog, styled as the packaged **Close**. Use it in `actions`,
|
|
3561
|
+
* or in your own `children`. With `asChild`, it styles your own element instead, such as a
|
|
3562
|
+
* link to your support page:
|
|
3563
|
+
*
|
|
3564
|
+
* ```tsx
|
|
3565
|
+
* <DocxEditor.OpenFailure
|
|
3566
|
+
* actions={({ failure }) => (
|
|
3567
|
+
* <DocxEditor.OpenFailure.Action asChild>
|
|
3568
|
+
* <a href={`/support?code=${failure.code}`}>Get help</a>
|
|
3569
|
+
* </DocxEditor.OpenFailure.Action>
|
|
3570
|
+
* )}
|
|
3571
|
+
* />
|
|
3572
|
+
* ```
|
|
3573
|
+
*
|
|
3574
|
+
* @public
|
|
3575
|
+
*/
|
|
3576
|
+
declare function DocxEditorOpenFailureAction({ variant, dismiss, asChild, className, onClick, children, type, ...rest }: DocxEditorOpenFailureActionProps): react.JSX.Element;
|
|
3577
|
+
/**
|
|
3578
|
+
* A message for the open-failure dialog: text, content, or a function of the failure. It
|
|
3579
|
+
* renders in a `div`, so block content is valid.
|
|
3580
|
+
*
|
|
3581
|
+
* @public
|
|
3582
|
+
*/
|
|
3583
|
+
type DocxEditorOpenFailureMessage = string | DocxEditorChildren | ((failure: DocumentOpenFailure) => string | DocxEditorChildren);
|
|
3584
|
+
/** Props for `DocxEditor.OpenFailure`. @public */
|
|
3585
|
+
interface DocxEditorOpenFailureProps {
|
|
3586
|
+
/**
|
|
3587
|
+
* The dialog title. Defaults to the translated `openFailure.title`. It also names the dialog
|
|
3588
|
+
* for screen readers, including when your own content replaces the packaged one.
|
|
3589
|
+
*/
|
|
3590
|
+
title?: string;
|
|
3591
|
+
/** Your own message in place of the packaged one, as content or per failure. */
|
|
3592
|
+
message?: DocxEditorOpenFailureMessage;
|
|
3593
|
+
/** Show the stable error code under the message. Defaults to `true`. */
|
|
3594
|
+
showCode?: boolean;
|
|
3595
|
+
/**
|
|
3596
|
+
* Your own buttons, before **Close**. Build them from `DocxEditor.OpenFailure.Action` so
|
|
3597
|
+
* they match the dialog. The dialog shows no contact of its own.
|
|
3598
|
+
*/
|
|
3599
|
+
actions?: (context: DocxEditorOpenFailureContext) => DocxEditorChildren;
|
|
3600
|
+
/** The label of the **Close** button. Defaults to the translated `common.close`. */
|
|
3601
|
+
closeLabel?: string;
|
|
3602
|
+
/**
|
|
3603
|
+
* Show the packaged **Close** button. Defaults to `true`. Turn it off only when `actions`
|
|
3604
|
+
* gives a way out. Escape still closes the dialog.
|
|
3605
|
+
*/
|
|
3606
|
+
showClose?: boolean;
|
|
3607
|
+
/** Called after the person closes the dialog, by any route. */
|
|
3608
|
+
onDismiss?: (failure: DocumentOpenFailure) => void;
|
|
3609
|
+
/**
|
|
3610
|
+
* Your own dialog content, in place of the packaged header, body and footer. The dialog
|
|
3611
|
+
* frame, its focus handling and Escape stay.
|
|
3612
|
+
*/
|
|
3613
|
+
children?: (context: DocxEditorOpenFailureContext) => DocxEditorChildren;
|
|
3614
|
+
/** Appended after the load-bearing `docx-dialog` class. */
|
|
3615
|
+
className?: string;
|
|
3616
|
+
/** Inline styles for the dialog element. */
|
|
3617
|
+
style?: CSSProperties;
|
|
3618
|
+
/** Translator override; defaults to the ambient locale context. */
|
|
3619
|
+
t?: TFunction;
|
|
3620
|
+
}
|
|
3621
|
+
/**
|
|
3622
|
+
* The open-failure part with its button attached as a static.
|
|
3623
|
+
*
|
|
3624
|
+
* @public
|
|
3625
|
+
*/
|
|
3626
|
+
interface DocxEditorOpenFailureComponent {
|
|
3627
|
+
/** Renders the dialog while a refused open is waiting, and nothing otherwise. */
|
|
3628
|
+
(props: DocxEditorOpenFailureProps): ReactNode;
|
|
3629
|
+
/** A button styled for the dialog, for `actions` and custom `children`. */
|
|
3630
|
+
readonly Action: typeof DocxEditorOpenFailureAction;
|
|
3631
|
+
}
|
|
3632
|
+
/**
|
|
3633
|
+
* A dialog that explains why a file did not open. It shows nothing until the editor refuses a
|
|
3634
|
+
* document, and shows again for each later refusal. `<DocxEditor>` renders it by default;
|
|
3635
|
+
* compose it yourself inside a `DocxEditor.Root`:
|
|
3636
|
+
*
|
|
3637
|
+
* ```tsx
|
|
3638
|
+
* <DocxEditor.Root document={bytes}>
|
|
3639
|
+
* <DocxEditor.OpenFailure
|
|
3640
|
+
* actions={({ failure }) => (
|
|
3641
|
+
* <DocxEditor.OpenFailure.Action variant="primary" onClick={() => report(failure.code)}>
|
|
3642
|
+
* Report
|
|
3643
|
+
* </DocxEditor.OpenFailure.Action>
|
|
3644
|
+
* )}
|
|
3645
|
+
* />
|
|
3646
|
+
* <DocxEditor.Viewport>
|
|
3647
|
+
* <DocxEditor.Content />
|
|
3648
|
+
* </DocxEditor.Viewport>
|
|
3649
|
+
* </DocxEditor.Root>
|
|
3650
|
+
* ```
|
|
3651
|
+
*
|
|
3652
|
+
* The packaged message is generic and names no contact. For a toast or banner instead of a
|
|
3653
|
+
* dialog, use `useOpenFailure`.
|
|
3654
|
+
*
|
|
3655
|
+
* @public
|
|
3656
|
+
*/
|
|
3657
|
+
declare const DocxEditorOpenFailure: DocxEditorOpenFailureComponent;
|
|
3658
|
+
|
|
3034
3659
|
/** Props for `DocxEditor.HeaderFooterChrome`. @public */
|
|
3035
3660
|
interface DocxEditorHeaderFooterChromeProps {
|
|
3036
3661
|
className?: string;
|
|
@@ -3057,8 +3682,8 @@ interface DocxEditorProps {
|
|
|
3057
3682
|
/** Customize automatically mounted popups. Set an entry to false for manual ownership. */
|
|
3058
3683
|
popups?: DocxEditorPopups;
|
|
3059
3684
|
/**
|
|
3060
|
-
*
|
|
3061
|
-
*
|
|
3685
|
+
* Font sources for layout and paint. A new value replaces the fonts in place, keeping the
|
|
3686
|
+
* document, selection and undo history; keep the reference stable across renders.
|
|
3062
3687
|
*
|
|
3063
3688
|
* Optional, but it decides layout FIDELITY. With it, the engine shapes text through
|
|
3064
3689
|
* HarfBuzz and measures line and page breaks from real font metrics. Without it, layout
|
|
@@ -3069,6 +3694,8 @@ interface DocxEditorProps {
|
|
|
3069
3694
|
fonts?: FontConfiguration | FontConfigurationFragment | FontResolver;
|
|
3070
3695
|
/** Explicit shaping byte ceiling. A changed maxFontBytes value remounts; equal values keep the instance. */
|
|
3071
3696
|
fontShaping?: FontShapingOptions;
|
|
3697
|
+
/** Inject image decoding and preserved-image conversion. A changed port identity remounts the editor. */
|
|
3698
|
+
imageDecodePort?: ImageDecodePort;
|
|
3072
3699
|
/**
|
|
3073
3700
|
* Title-bar slots. The host owns what goes here — brand lockup, switchers, theme
|
|
3074
3701
|
* toggle, Open/New/Save controls — and passes them in; the editor renders them
|
|
@@ -3076,6 +3703,23 @@ interface DocxEditorProps {
|
|
|
3076
3703
|
*/
|
|
3077
3704
|
readonly renderTitleBarLeft?: () => DocxEditorChildren;
|
|
3078
3705
|
readonly renderTitleBarRight?: () => DocxEditorChildren;
|
|
3706
|
+
/**
|
|
3707
|
+
* Your own buttons in the dialog for a file that does not open, before **Close**. Build
|
|
3708
|
+
* them from `DocxEditor.OpenFailure.Action`. It is the same as `openFailure.actions`; pass
|
|
3709
|
+
* only one. With `openFailure={false}` there is no dialog, so it renders nothing.
|
|
3710
|
+
*
|
|
3711
|
+
* ```tsx
|
|
3712
|
+
* <DocxEditor
|
|
3713
|
+
* document={bytes}
|
|
3714
|
+
* renderOpenFailureActions={({ failure }) => (
|
|
3715
|
+
* <DocxEditor.OpenFailure.Action asChild>
|
|
3716
|
+
* <a href={`/support?code=${failure.code}`}>Get help</a>
|
|
3717
|
+
* </DocxEditor.OpenFailure.Action>
|
|
3718
|
+
* )}
|
|
3719
|
+
* />
|
|
3720
|
+
* ```
|
|
3721
|
+
*/
|
|
3722
|
+
readonly renderOpenFailureActions?: (context: DocxEditorOpenFailureContext) => DocxEditorChildren;
|
|
3079
3723
|
/**
|
|
3080
3724
|
* Your own loading indicator, in place of the packaged spinner. It shows centered on a
|
|
3081
3725
|
* blank page before the document arrives, then on the document's first page while a large
|
|
@@ -3205,6 +3849,15 @@ interface DocxEditorProps {
|
|
|
3205
3849
|
* `navigation={{ findShortcut: false }}` leaves the shortcut to the browser.
|
|
3206
3850
|
*/
|
|
3207
3851
|
navigation?: boolean | DocxEditorNavigationProps;
|
|
3852
|
+
/**
|
|
3853
|
+
* The dialog that explains a file the editor refused to open, on by default. A refused
|
|
3854
|
+
* open leaves the pages blank, so without it the reader sees nothing.
|
|
3855
|
+
*
|
|
3856
|
+
* An object is `DocxEditorOpenFailureProps`, passed straight through: change the title or
|
|
3857
|
+
* message, hide the error code, or add your own support action with `actions`. `false`
|
|
3858
|
+
* removes the dialog, for a host that reports the failure itself through `useOpenFailure`.
|
|
3859
|
+
*/
|
|
3860
|
+
openFailure?: boolean | DocxEditorOpenFailureProps;
|
|
3208
3861
|
/**
|
|
3209
3862
|
* Horizontal and vertical rulers, on by default with the packaged chrome.
|
|
3210
3863
|
*
|
|
@@ -3339,6 +3992,8 @@ interface DocxEditorNamespace extends ForwardRefExoticComponent<DocxEditorProps
|
|
|
3339
3992
|
readonly Root: typeof DocxEditorRoot;
|
|
3340
3993
|
readonly Viewport: typeof DocxEditorViewport;
|
|
3341
3994
|
readonly Content: typeof DocxEditorContent;
|
|
3995
|
+
/** The editor panel in a pop-out window while `open`; see the pop-out guide. */
|
|
3996
|
+
readonly Window: typeof DocxEditorWindow;
|
|
3342
3997
|
readonly Toolbar: typeof DocxEditorToolbar;
|
|
3343
3998
|
/**
|
|
3344
3999
|
* The menu bar — File · Format · Insert · Help — with its parts as statics (`.File`,
|
|
@@ -3351,6 +4006,7 @@ interface DocxEditorNamespace extends ForwardRefExoticComponent<DocxEditorProps
|
|
|
3351
4006
|
readonly ColorByChangeType: typeof DocxEditorColorByChangeType;
|
|
3352
4007
|
readonly RevisionMarkupDialog: typeof DocxEditorRevisionMarkupDialog;
|
|
3353
4008
|
readonly RevisionMarkup: typeof DocxEditorRevisionMarkup;
|
|
4009
|
+
readonly UnsupportedElement: typeof DocxEditorUnsupportedElement;
|
|
3354
4010
|
readonly AuthorStyle: typeof DocxEditorAuthorStyle;
|
|
3355
4011
|
/** Context-fed horizontal ruler with draggable margins (props-driven export stays). */
|
|
3356
4012
|
readonly HorizontalRuler: typeof DocxEditorHorizontalRuler;
|
|
@@ -3370,6 +4026,12 @@ interface DocxEditorNamespace extends ForwardRefExoticComponent<DocxEditorProps
|
|
|
3370
4026
|
readonly PrintDialog: typeof DocxEditorPrintDialog;
|
|
3371
4027
|
/** Page Setup dialog — size, orientation, margins — applied as one undo step. */
|
|
3372
4028
|
readonly PageSetupDialog: typeof DocxEditorPageSetupDialog;
|
|
4029
|
+
/** Watermark dialog — none, picture or text — applied as one undo step. */
|
|
4030
|
+
readonly WatermarkDialog: typeof DocxEditorWatermarkDialog;
|
|
4031
|
+
/** Bookmark dialog — list, add, delete and go to bookmarks. */
|
|
4032
|
+
readonly BookmarkDialog: typeof DocxEditorBookmarkDialog;
|
|
4033
|
+
/** Split cells dialog — split the cell at the selection into columns and rows. */
|
|
4034
|
+
readonly SplitCellDialog: typeof DocxEditorSplitCellDialog;
|
|
3373
4035
|
/** The Paragraph dialog: alignment, indentation, spacing and the paragraph flags. */
|
|
3374
4036
|
readonly TextFormFieldDialog: typeof DocxEditorTextFormFieldDialog;
|
|
3375
4037
|
readonly ParagraphDialog: typeof DocxEditorParagraphDialog;
|
|
@@ -3377,6 +4039,11 @@ interface DocxEditorNamespace extends ForwardRefExoticComponent<DocxEditorProps
|
|
|
3377
4039
|
readonly PageNumber: typeof DocxEditorPageNumber;
|
|
3378
4040
|
/** Word-style notice when document fonts render in substitute faces. */
|
|
3379
4041
|
readonly FontNotice: typeof DocxEditorFontNotice;
|
|
4042
|
+
/**
|
|
4043
|
+
* The dialog that explains a file the editor refused to open. Mounted by default;
|
|
4044
|
+
* `openFailure={false}` removes it.
|
|
4045
|
+
*/
|
|
4046
|
+
readonly OpenFailure: typeof DocxEditorOpenFailure;
|
|
3380
4047
|
/** Header/footer scope chrome while editing page furniture. */
|
|
3381
4048
|
readonly HeaderFooterChrome: typeof DocxEditorHeaderFooterChrome;
|
|
3382
4049
|
readonly NotesChrome: typeof DocxEditorNotesChrome;
|
|
@@ -3446,6 +4113,49 @@ declare function notificationYieldsToTask(): boolean;
|
|
|
3446
4113
|
*/
|
|
3447
4114
|
declare function useScopeClassName(): '' | 'docx-editor ';
|
|
3448
4115
|
|
|
4116
|
+
/** What `useWatermark` returns. @public */
|
|
4117
|
+
interface UseWatermarkReturn {
|
|
4118
|
+
/** The document's watermark, or null when it has none. Reference-stable while unchanged. */
|
|
4119
|
+
readonly watermark: WatermarkState | null;
|
|
4120
|
+
/** Whether the engine can write a watermark right now (mounted, editable). */
|
|
4121
|
+
readonly isEnabled: boolean;
|
|
4122
|
+
/** The full current watermark, with picture bytes, through `query({ type: 'watermark' })`. */
|
|
4123
|
+
readonly read: () => Watermark | null;
|
|
4124
|
+
/** Set the watermark as one undo step. Null removes it. */
|
|
4125
|
+
readonly apply: (watermark: Watermark | null) => ExecResult;
|
|
4126
|
+
}
|
|
4127
|
+
/**
|
|
4128
|
+
* The document watermark plus the command to change it.
|
|
4129
|
+
*
|
|
4130
|
+
* @public
|
|
4131
|
+
*/
|
|
4132
|
+
declare function useWatermark(): UseWatermarkReturn;
|
|
4133
|
+
|
|
4134
|
+
/** What `useBookmarks` returns. @public */
|
|
4135
|
+
interface UseBookmarksReturn {
|
|
4136
|
+
/** Every bookmark, hidden ones included, in document order. Reference-stable while unchanged. */
|
|
4137
|
+
readonly bookmarks: readonly BookmarkSummary[];
|
|
4138
|
+
/** Whether the document accepts bookmark edits now. Go To works either way. */
|
|
4139
|
+
readonly isWritable: boolean;
|
|
4140
|
+
/** Bookmark the selection under `name`. A bookmark with the name moves. */
|
|
4141
|
+
readonly insert: (name: string) => ExecResult;
|
|
4142
|
+
/** Delete the bookmark with this name. The text stays. */
|
|
4143
|
+
readonly remove: (name: string) => ExecResult;
|
|
4144
|
+
/** Select the bookmark and scroll to it. */
|
|
4145
|
+
readonly goTo: (name: string) => ExecResult;
|
|
4146
|
+
/**
|
|
4147
|
+
* Keep the first bookmark with this name and remove its copies, which collaborators adding
|
|
4148
|
+
* one name offline can leave. The selection does not move.
|
|
4149
|
+
*/
|
|
4150
|
+
readonly keepFirst: (name: string) => ExecResult;
|
|
4151
|
+
}
|
|
4152
|
+
/**
|
|
4153
|
+
* The document's bookmarks plus the commands that change them.
|
|
4154
|
+
*
|
|
4155
|
+
* @public
|
|
4156
|
+
*/
|
|
4157
|
+
declare function useBookmarks(): UseBookmarksReturn;
|
|
4158
|
+
|
|
3449
4159
|
/** Full reservation: the 300px card column plus its 16px gutter off the page edge. */
|
|
3450
4160
|
declare const REVIEW_PANE_GUTTER = 316;
|
|
3451
4161
|
/** The marker strip: anchors and the add-comment button, no cards. */
|
|
@@ -3522,9 +4232,14 @@ interface LocaleProviderProps {
|
|
|
3522
4232
|
children: DocxEditorChildren;
|
|
3523
4233
|
}
|
|
3524
4234
|
declare function LocaleProvider({ i18n, children }: LocaleProviderProps): react.JSX.Element;
|
|
4235
|
+
/**
|
|
4236
|
+
* The active catalogue's `t()`, the catalogue itself, and its language tag (`_lang`, `en`
|
|
4237
|
+
* by default), which formats numbers the way the strings around them read.
|
|
4238
|
+
*/
|
|
3525
4239
|
declare function useTranslation(): {
|
|
3526
4240
|
t: TFunction;
|
|
3527
4241
|
catalogue: LocaleStrings;
|
|
4242
|
+
lang: string;
|
|
3528
4243
|
};
|
|
3529
4244
|
|
|
3530
4245
|
/**
|
|
@@ -4055,7 +4770,8 @@ declare function useEditorValueCommand<K extends keyof ToolbarValueMap>(slotId:
|
|
|
4055
4770
|
/** @public */
|
|
4056
4771
|
type DocxEditorRefCallback<T> = (node: T | null) => void;
|
|
4057
4772
|
|
|
4058
|
-
|
|
4773
|
+
/** Where a scoped chrome anchor sits relative to its story: before it, after it, or on its label. */
|
|
4774
|
+
type ScopedChromeAnchorPlacement = 'before' | 'after' | 'story-label';
|
|
4059
4775
|
interface ScopedChromeAnchor {
|
|
4060
4776
|
readonly ref: DocxEditorRefCallback<HTMLDivElement>;
|
|
4061
4777
|
readonly style: CSSProperties;
|
|
@@ -4067,7 +4783,7 @@ interface ScopedChromeAnchor {
|
|
|
4067
4783
|
* portal controls into a header, footer, or note node. This hook keeps the controls as a
|
|
4068
4784
|
* sibling overlay and derives only their screen placement from the current painted host.
|
|
4069
4785
|
*/
|
|
4070
|
-
declare function useScopedChromeAnchor(findAnchor: (viewport: HTMLElement) => HTMLElement | null, placement:
|
|
4786
|
+
declare function useScopedChromeAnchor(findAnchor: (viewport: HTMLElement) => HTMLElement | null, placement: ScopedChromeAnchorPlacement): ScopedChromeAnchor;
|
|
4071
4787
|
|
|
4072
4788
|
/**
|
|
4073
4789
|
* Subscribe to an editor event (`'change'`, `'selectionChange'`, `'error'`, …) for the
|
|
@@ -4078,6 +4794,71 @@ declare function useScopedChromeAnchor(findAnchor: (viewport: HTMLElement) => HT
|
|
|
4078
4794
|
*/
|
|
4079
4795
|
declare function useEditorEvent<E extends keyof EditorEvents>(event: E, handler: EditorEvents[E]): void;
|
|
4080
4796
|
|
|
4797
|
+
/**
|
|
4798
|
+
* Open the host's own comment draft when the `review.addComment` control is pressed.
|
|
4799
|
+
*
|
|
4800
|
+
* While the component is mounted and `handler` is set, the control is enabled (subject to the
|
|
4801
|
+
* engine's other rules: the review module, the editing mode, and a selection). Without any
|
|
4802
|
+
* registration the control is disabled, because nothing could open the draft. The most recent
|
|
4803
|
+
* registration receives each request. Pass `null` to stop serving requests, for example while
|
|
4804
|
+
* your comment UI cannot open a draft.
|
|
4805
|
+
*
|
|
4806
|
+
* The handler takes no arguments. Read the selection with `editor.getSelectionPlacement()`,
|
|
4807
|
+
* and pin it with `editor.retainSelection()` while the draft is open.
|
|
4808
|
+
*
|
|
4809
|
+
* @example
|
|
4810
|
+
* ```tsx
|
|
4811
|
+
* function CommentButton() {
|
|
4812
|
+
* const [drafting, setDrafting] = useState(false);
|
|
4813
|
+
* useCommentDraftRequest(() => setDrafting(true));
|
|
4814
|
+
* const addComment = useEditorCommand('review.addComment');
|
|
4815
|
+
* return (
|
|
4816
|
+
* <>
|
|
4817
|
+
* <button
|
|
4818
|
+
* disabled={!addComment.isEnabled}
|
|
4819
|
+
* title={addComment.disabledReason ?? 'Add comment'}
|
|
4820
|
+
* onClick={() => addComment.execute()}
|
|
4821
|
+
* >
|
|
4822
|
+
* Add comment
|
|
4823
|
+
* </button>
|
|
4824
|
+
* {drafting ? <MyCommentDraft onClose={() => setDrafting(false)} /> : null}
|
|
4825
|
+
* </>
|
|
4826
|
+
* );
|
|
4827
|
+
* }
|
|
4828
|
+
* ```
|
|
4829
|
+
*
|
|
4830
|
+
* @public
|
|
4831
|
+
*/
|
|
4832
|
+
declare function useCommentDraftRequest(handler: (() => void) | null | undefined): void;
|
|
4833
|
+
|
|
4834
|
+
/** What {@link useEditorHostDocument} returns: the host document, or `null` on the server. @public */
|
|
4835
|
+
type UseEditorHostDocumentReturn = Document | null;
|
|
4836
|
+
/**
|
|
4837
|
+
* The document the editor's pages are mounted in: a pop-out window's or an iframe's when the
|
|
4838
|
+
* host attached the editor there, otherwise the page's own. `null` during server rendering.
|
|
4839
|
+
*
|
|
4840
|
+
* Custom chrome that adds document listeners, reads focus, or injects a `<style>` uses this
|
|
4841
|
+
* instead of the global `document`, which belongs to the window the script runs in. The value
|
|
4842
|
+
* changes when the editor moves to another window, so effects keyed on it re-bind.
|
|
4843
|
+
* Its `defaultView` is the editor's window, for timers, viewport size and the clipboard.
|
|
4844
|
+
*
|
|
4845
|
+
* @example
|
|
4846
|
+
* ```tsx
|
|
4847
|
+
* function ShortcutListener() {
|
|
4848
|
+
* const hostDocument = useEditorHostDocument();
|
|
4849
|
+
* useEffect(() => {
|
|
4850
|
+
* if (!hostDocument) return;
|
|
4851
|
+
* hostDocument.addEventListener('keydown', onShortcut);
|
|
4852
|
+
* return () => hostDocument.removeEventListener('keydown', onShortcut);
|
|
4853
|
+
* }, [hostDocument]);
|
|
4854
|
+
* return null;
|
|
4855
|
+
* }
|
|
4856
|
+
* ```
|
|
4857
|
+
*
|
|
4858
|
+
* @public
|
|
4859
|
+
*/
|
|
4860
|
+
declare function useEditorHostDocument(): UseEditorHostDocumentReturn;
|
|
4861
|
+
|
|
4081
4862
|
/**
|
|
4082
4863
|
* Highlight text ranges as the named set while the component is mounted, and keep them
|
|
4083
4864
|
* current as the document changes. Returns what the last application resolved.
|
|
@@ -4093,6 +4874,8 @@ declare function useEditorEvent<E extends keyof EditorEvents>(event: E, handler:
|
|
|
4093
4874
|
* );
|
|
4094
4875
|
* useHighlights('glossary', findTerms, { className: 'glossary-term' });
|
|
4095
4876
|
* ```
|
|
4877
|
+
*
|
|
4878
|
+
* @see {@link https://www.docx-editor.dev/docs/2.x/recipes/highlight-ranges | Highlight ranges}
|
|
4096
4879
|
* @public
|
|
4097
4880
|
*/
|
|
4098
4881
|
declare function useHighlights(name: string, source: HighlightSource, options?: HighlightOptions): HighlightResult;
|
|
@@ -4956,5 +5739,5 @@ interface UseHistoryGroupReturn {
|
|
|
4956
5739
|
/** Bind a control's native gesture lifecycle. Apply values through the existing command hooks. @public */
|
|
4957
5740
|
declare function useHistoryGroup({ kind }: HistoryGroupBindingOptions): UseHistoryGroupReturn;
|
|
4958
5741
|
|
|
4959
|
-
export { CONTENT_CONTROL_SLOTS, ContextMenuCellVerticalAlignment, ContextMenuCopy, ContextMenuCopyFormatting, ContextMenuCut, ContextMenuDelete, ContextMenuDeleteTable, ContextMenuDeleteTableColumn, ContextMenuDeleteTableRow, ContextMenuInsertColumnLeft, ContextMenuInsertColumnRight, ContextMenuInsertRowAbove, ContextMenuInsertRowBelow, ContextMenuItem, ContextMenuPaste, ContextMenuPasteFormatting, ContextMenuPasteWithoutFormatting, ContextMenuRefreshToc, ContextMenuRefreshTocPageNumbers, ContextMenuSelectAll, DocumentName, DocumentOutline, DocxEditor, DocxEditorAuthorStyle, DocxEditorColorByChangeType, DocxEditorContent, DocxEditorContentControl, DocxEditorContentControlWidget, DocxEditorContextMenu, DocxEditorDocumentOutline, DocxEditorEquation, DocxEditorExportDialog, DocxEditorFontNotice, DocxEditorHeaderFooterChrome, DocxEditorHorizontalRuler, DocxEditorHyperLink, DocxEditorImageAltTextPopup, DocxEditorImagePropertiesDialog, DocxEditorInvalidTextFormFieldDialog, DocxEditorLoading, DocxEditorLoadingSpinner, DocxEditorMenu, DocxEditorNavigation, DocxEditorNotePreview, DocxEditorNotePropertiesDialog, DocxEditorNotesChrome, DocxEditorNotesContextMenu, DocxEditorPageNumber, DocxEditorPageSetupDialog, DocxEditorParagraphDialog, DocxEditorPrintDialog, DocxEditorRevisionMarkup, DocxEditorRevisionMarkupDialog, DocxEditorRoot, DocxEditorShell, DocxEditorTextFormFieldDialog, DocxEditorToolbar, DocxEditorVerticalRuler, DocxEditorViewport, HorizontalRuler, ImageAltText, ImageInsertProvider, ImageInsertTrigger, ImagePropertiesTrigger, ImageWrap, LocaleProvider, Logo, MenuBar, NAVIGATION_PANE_GAP, NAVIGATION_PANE_INSET, NAVIGATION_PANE_MIN_PAGE_ROOM, NAVIGATION_PANE_WIDTH, NavigationClose, NavigationFind, NavigationHeader, NavigationHeadings, NavigationTab, NavigationTabs, NavigationTitle, NavigationToggle, OUTLINE_BUTTON_LEFT_OFFSET, OUTLINE_BUTTON_RESERVED_SPACE, OUTLINE_LEFT_OFFSET, OUTLINE_RESERVED_SPACE, PageIndicator, PageNumberTranslationContext, PaginatedDocxEditor, PaginatedDocxEditorShell, REVIEW_MARKERS_GUTTER, REVIEW_PANE_GUTTER, RULER_WIDTH, ReviewRailContext, Slot, TitleBar, TitleBarRight, Toolbar, ToolbarButton, ToolbarContext, ToolbarGroup, ToolbarImageProperties, VERSION, VerticalRuler, definePopup, editorStateActiveSubscriptionCount, isFieldLink, navigationPaneOverlays, navigationPaneReservation, navigationShift, normalizeImageBytes, notificationYieldsToTask, useProvidedDocxEditor as provideDocxEditor, reviewGutter, useChromeTranslate, useContentControl, useContentControlInstance, useContentControlWidget, useContextMenuTarget, useDocumentOutline, useDocumentSearch, useDocxEditor, useDocxSource, useEditorCaret, useEditorCommand, useEditorEvent, useEditorSnapshot, useEditorState, useEditorValueCommand, useFontFamily, useFonts, useHeaderFooterState, useHighlightAt, useHighlights, useHistoryGroup, useHyperlinkPopup, useHyperlinkPopupInstance, useNavigationPane, useNavigationShift, useNotePropertiesState, useNoteScopeState, usePageSetup, usePageSetupDialog, useParagraphDialog, useParagraphFormat, useParagraphIndent, useParagraphStyle, useReviewAuthors, useReviewGutter, useRevisionMarkupDialog, useScopeClassName, useScopedChromeAnchor, useTableBorderTargetLabel, useTextFormFieldDialog, useToolbarContext, useToolbarLabel, useToolbarLabelFor, useTranslation, useZoom };
|
|
4960
|
-
export type { ChromeTranslate, ContentControlActionProps, ContentControlInspectorState, ContentControlLock, ContentControlPartProps, ContentControlProps, ContentControlSlotId, ContentControlWidgetDayProps, ContentControlWidgetEntry, ContentControlWidgetItemProps, ContentControlWidgetPictureProps, ContextMenuAnchor, ContextMenuCommandProps, ContextMenuContextValue, ContextMenuItemProps, ContextMenuTableRowProps, DialogCustomizationProps, DialogPartProps, DocxEditorAuthorStyleProps, DocxEditorChildren, DocxEditorContentControlNamespace, DocxEditorContentControlWidgetNamespace, DocxEditorContentControlWidgetPartProps, DocxEditorContentControlWidgetProps, DocxEditorContentProps, DocxEditorContextMenuNamespace, DocxEditorContextMenuProps, DocxEditorDocumentOutlineProps, DocxEditorExportDialogProps, DocxEditorFontNoticeProps, DocxEditorHeaderFooterChromeProps, DocxEditorHyperLinkNamespace, DocxEditorImageAltTextPopupProps, DocxEditorImagePropertiesDialogProps, DocxEditorInvalidTextFormFieldDialogProps, DocxEditorLoadingComponent, DocxEditorLoadingProps, DocxEditorLoadingSpinnerProps, DocxEditorMenuNamespace, DocxEditorMenuProps, DocxEditorNamespace, DocxEditorNavigationNamespace, DocxEditorNavigationProps, DocxEditorNotePreviewProps, DocxEditorNotePropertiesDialogProps, DocxEditorNotesChromeProps, DocxEditorNotesContextMenuProps, DocxEditorPageNumberProps, DocxEditorPageSetupDialogProps, DocxEditorParagraphDialogProps, DocxEditorPopup, DocxEditorPopups, DocxEditorPrintDialogProps, DocxEditorProps, DocxEditorRef, DocxEditorRevisionMarkupDialogProps, DocxEditorRevisionMarkupProps, DocxEditorRootListeners, DocxEditorRootProps, DocxEditorRulerProps, DocxEditorTextFormFieldDialogProps, DocxEditorToolbarGroupProps, DocxEditorToolbarNamespace, DocxEditorToolbarProps, DocxEditorToolbarSlotProps, DocxEditorViewportProps, DocxFontOrigin, DocxFontsInput, DocxFontsSource, DocxSource, EditorCaret, EditorCommandState, EditorMode, EditorValueCommandState, FontFamilyItemProps, FontFamilyNamespace, FontFamilyPartProps, FontFamilyProps, FontsInput, HeaderFooterState, HorizontalRulerProps$1 as HorizontalRulerProps, HyperLinkActionProps, HyperLinkPartProps, HyperLinkProps, HyperlinkPopupAnchor, HyperlinkPopupMode, HyperlinkPopupState, ImagePropertiesTriggerProps, IndentUpdate, LocaleProviderProps, MaybeRefOrGetter, MenuActionProps, MenuGroupProps, MenuId, MenuItemBaseProps, MenuItemProps, MenuPartComponent, MenuProps, MenuReportIssueProps, MenuReviewersProps, MenuRowProps, MenuSeparatorProps, MenuSubmenuBaseProps, MenuSubmenuProps, MenuTableGridProps, NavigationPartProps, NavigationShiftInput, NavigationTabProps, NavigationTab$1 as NavigationTabValue, NormalizedImagePayload, NotePropertiesState, OutlineHeading$1 as OutlineHeading, OutlineHeadingItem, PageIndicatorProps, PageSetupDialogFields, PageSetupUpdate, PaginatedDocxEditorExpose, PaginatedDocxEditorHandle, PaginatedDocxEditorProps, PaginatedDocxEditorShellProps, ParagraphStyleItemProps, ParagraphStyleNamespace, ParagraphStyleOption, ParagraphStylePartProps, ParagraphStyleProps, ProvideDocxEditorResult, ReviewGutter, ReviewGutterInput, ReviewRailRegistry, ScopedChromeAnchor, SlotProps, TableBorderColorNamespace, TableBorderStyleNamespace, TableBorderTargetNamespace, TableBorderWidthNamespace, TableCellFillNamespace, TableChromeItemProps, TableChromePartComponent, TableChromePartProps, TextFormFieldDialogFields, ToolbarActionProps, ToolbarAlignmentComponent, ToolbarButtonProps$1 as ToolbarButtonProps, ToolbarContextValue, ToolbarPartComponent, ToolbarPartProps, ToolbarProps, ToolbarReviewersProps, ToolbarSeparatorProps, ToolbarSlotPartComponent, ToolbarSlotPartProps, ToolbarTranslate, UseContentControlResult, UseContentControlWidgetResult, UseDialogReturn, UseDocumentOutlineResult, UseDocumentSearchOptions, UseDocumentSearchResult, UseDocxSourceOptions, UseDocxSourceResult, UseFontFamilyResult, UseHistoryGroupReturn, UseHyperlinkPopupResult, UseNavigationPaneOptions, UseNavigationPaneResult, UsePageSetupDialogReturn, UsePageSetupReturn, UseParagraphDialogReturn, UseParagraphFormatReturn, UseParagraphIndentReturn, UseParagraphStyleResult, UseRevisionMarkupDialogReturn, UseTextFormFieldDialogReturn, UseZoomResult, VerticalRulerProps };
|
|
5742
|
+
export { CONTENT_CONTROL_SLOTS, ContextMenuCellVerticalAlignment, ContextMenuCopy, ContextMenuCopyFormatting, ContextMenuCut, ContextMenuDelete, ContextMenuDeleteTable, ContextMenuDeleteTableColumn, ContextMenuDeleteTableRow, ContextMenuInsertColumnLeft, ContextMenuInsertColumnRight, ContextMenuInsertRowAbove, ContextMenuInsertRowBelow, ContextMenuItem, ContextMenuMergeCells, ContextMenuPaste, ContextMenuPasteFormatting, ContextMenuPasteWithoutFormatting, ContextMenuRefreshToc, ContextMenuRefreshTocPageNumbers, ContextMenuSelectAll, ContextMenuSplitCell, DEFAULT_WATERMARK_PRESETS, DocumentName, DocumentOutline, DocxEditor, DocxEditorAuthorStyle, DocxEditorBookmarkDialog, DocxEditorColorByChangeType, DocxEditorContent, DocxEditorContentControl, DocxEditorContentControlWidget, DocxEditorContextMenu, DocxEditorDocumentOutline, DocxEditorEquation, DocxEditorExportDialog, DocxEditorFontNotice, DocxEditorHeaderFooterChrome, DocxEditorHorizontalRuler, DocxEditorHyperLink, DocxEditorImageAltTextPopup, DocxEditorImageInsertErrorDialog, DocxEditorImagePropertiesDialog, DocxEditorInvalidTextFormFieldDialog, DocxEditorLoading, DocxEditorLoadingSpinner, DocxEditorMenu, DocxEditorNavigation, DocxEditorNotePreview, DocxEditorNotePropertiesDialog, DocxEditorNotesChrome, DocxEditorNotesContextMenu, DocxEditorOpenFailure, DocxEditorOpenFailureAction, DocxEditorPageNumber, DocxEditorPageSetupDialog, DocxEditorParagraphDialog, DocxEditorPrintDialog, DocxEditorRevisionMarkup, DocxEditorRevisionMarkupDialog, DocxEditorRoot, DocxEditorShell, DocxEditorSplitCellDialog, DocxEditorTextFormFieldDialog, DocxEditorToolbar, DocxEditorUnsupportedElement, DocxEditorVerticalRuler, DocxEditorViewport, DocxEditorWatermarkDialog, DocxEditorWindow, HorizontalRuler, ImageAltText, ImageInsertProvider, ImageInsertTrigger, ImagePropertiesTrigger, ImageWrap, LocaleProvider, Logo, MenuBar, NAVIGATION_PANE_GAP, NAVIGATION_PANE_INSET, NAVIGATION_PANE_MIN_PAGE_ROOM, NAVIGATION_PANE_WIDTH, NavigationClose, NavigationFind, NavigationGoTo, NavigationHeader, NavigationHeadings, NavigationTab, NavigationTabs, NavigationTitle, NavigationToggle, OUTLINE_BUTTON_LEFT_OFFSET, OUTLINE_BUTTON_RESERVED_SPACE, OUTLINE_LEFT_OFFSET, OUTLINE_RESERVED_SPACE, PageIndicator, PageNumberTranslationContext, PaginatedDocxEditor, PaginatedDocxEditorShell, REVIEW_MARKERS_GUTTER, REVIEW_PANE_GUTTER, RULER_WIDTH, ReviewRailContext, Slot, TitleBar, TitleBarRight, Toolbar, ToolbarButton, ToolbarContext, ToolbarGroup, ToolbarImageProperties, VERSION, VerticalRuler, definePopup, editorStateActiveSubscriptionCount, isFieldLink, navigationPaneOverlays, navigationPaneReservation, navigationShift, normalizeImageBytes, notificationYieldsToTask, useProvidedDocxEditor as provideDocxEditor, reviewGutter, useBookmarkDialog, useBookmarks, useChromeTranslate, useCommentDraftRequest, useContentControl, useContentControlInstance, useContentControlWidget, useContextMenuTarget, useDocumentOutline, useDocumentSearch, useDocxEditor, useDocxSource, useEditorCaret, useEditorCommand, useEditorEvent, useEditorHostDocument, useEditorSnapshot, useEditorState, useEditorValueCommand, useFontFamily, useFonts, useGoToBookmark, useHeaderFooterState, useHighlightAt, useHighlights, useHistoryGroup, useHyperlinkPopup, useHyperlinkPopupInstance, useNavigationPane, useNavigationShift, useNotePropertiesState, useNoteScopeState, useOpenFailure, usePageSetup, usePageSetupDialog, useParagraphDialog, useParagraphFormat, useParagraphIndent, useParagraphStyle, useReviewAuthors, useReviewGutter, useRevisionMarkupDialog, useScopeClassName, useScopedChromeAnchor, useSplitCellDialog, useTableBorderTargetLabel, useTextFormFieldDialog, useToolbarContext, useToolbarLabel, useToolbarLabelFor, useTranslation, useWatermark, useWatermarkDialog, useZoom };
|
|
5743
|
+
export type { BookmarkDialogFields, ChromeTranslate, ContentControlActionProps, ContentControlInspectorState, ContentControlLock, ContentControlPartProps, ContentControlProps, ContentControlSlotId, ContentControlWidgetDayProps, ContentControlWidgetEntry, ContentControlWidgetItemProps, ContentControlWidgetPictureProps, ContextMenuAnchor, ContextMenuCommandProps, ContextMenuContextValue, ContextMenuItemProps, ContextMenuTableRowProps, DialogCustomizationProps, DialogPartProps, DocumentStyleSummary, DocxEditorAuthorStyleProps, DocxEditorBookmarkDialogProps, DocxEditorChildren, DocxEditorContentControlNamespace, DocxEditorContentControlWidgetNamespace, DocxEditorContentControlWidgetPartProps, DocxEditorContentControlWidgetProps, DocxEditorContentProps, DocxEditorContextMenuNamespace, DocxEditorContextMenuProps, DocxEditorDocumentOutlineProps, DocxEditorExportDialogProps, DocxEditorFontNoticeProps, DocxEditorHeaderFooterChromeProps, DocxEditorHyperLinkNamespace, DocxEditorImageAltTextPopupProps, DocxEditorImageInsertErrorDialogProps, DocxEditorImagePropertiesDialogProps, DocxEditorInvalidTextFormFieldDialogProps, DocxEditorLoadingComponent, DocxEditorLoadingProps, DocxEditorLoadingSpinnerProps, DocxEditorMenuNamespace, DocxEditorMenuProps, DocxEditorNamespace, DocxEditorNavigationNamespace, DocxEditorNavigationProps, DocxEditorNotePreviewProps, DocxEditorNotePropertiesDialogProps, DocxEditorNotesChromeProps, DocxEditorNotesContextMenuProps, DocxEditorOpenFailureActionProps, DocxEditorOpenFailureComponent, DocxEditorOpenFailureContext, DocxEditorOpenFailureMessage, DocxEditorOpenFailureProps, DocxEditorPageNumberProps, DocxEditorPageSetupDialogProps, DocxEditorParagraphDialogProps, DocxEditorPopup, DocxEditorPopups, DocxEditorPrintDialogProps, DocxEditorProps, DocxEditorRef, DocxEditorRefCallback, DocxEditorRevisionMarkupDialogProps, DocxEditorRevisionMarkupProps, DocxEditorRootListeners, DocxEditorRootProps, DocxEditorRulerProps, DocxEditorSplitCellDialogProps, DocxEditorTextFormFieldDialogProps, DocxEditorToolbarGroupProps, DocxEditorToolbarNamespace, DocxEditorToolbarProps, DocxEditorToolbarSlotProps, DocxEditorUnsupportedElementProps, DocxEditorViewportProps, DocxEditorWatermarkDialogProps, DocxEditorWindowProps, DocxFontOrigin, DocxFontsInput, DocxFontsSource, DocxSource, EditorCaret, EditorCommandState, EditorMode, EditorValueCommandState, FontFamilyItemProps, FontFamilyNamespace, FontFamilyPartProps, FontFamilyProps, FontOption, FontsInput, FormattingAction, GoToBookmarkProblem, HeaderFooterState, HorizontalRulerProps$1 as HorizontalRulerProps, HyperLinkActionProps, HyperLinkPartProps, HyperLinkProps, HyperlinkPopupAnchor, HyperlinkPopupMode, HyperlinkPopupState, ImagePropertiesTriggerProps, IndentUpdate, ListState, ListType, LocaleProviderProps, MaybeRefOrGetter, MenuActionProps, MenuGroupProps, MenuId, MenuItemBaseProps, MenuItemProps, MenuPartComponent, MenuProps, MenuReportIssueProps, MenuReviewersProps, MenuRowProps, MenuSeparatorProps, MenuSubmenuBaseProps, MenuSubmenuProps, MenuTableGridProps, NavigationPartProps, NavigationShiftInput, NavigationTabProps, NavigationTab$1 as NavigationTabValue, NormalizedImagePayload, NotePropertiesState, OutlineHeading$1 as OutlineHeading, OutlineHeadingItem, PageIndicatorProps, PageSetupDialogFields, PageSetupUpdate, PaginatedDocxEditorExpose, PaginatedDocxEditorHandle, PaginatedDocxEditorProps, PaginatedDocxEditorShellProps, ParagraphAlignment, ParagraphStyleItemProps, ParagraphStyleNamespace, ParagraphStyleOption, ParagraphStylePartProps, ParagraphStyleProps, ProvideDocxEditorResult, ReviewGutter, ReviewGutterInput, ReviewRailRegistry, ScopedChromeAnchor, ScopedChromeAnchorPlacement, SelectionFormatting, SlotProps, SplitCellDialogFields, TableAction, TableBorderColorNamespace, TableBorderStyleNamespace, TableBorderTargetNamespace, TableBorderWidthNamespace, TableCellFillNamespace, TableChromeItemProps, TableChromePartComponent, TableChromePartProps, TextFormFieldDialogFields, ToolbarActionProps, ToolbarAlignmentComponent, ToolbarButtonProps$1 as ToolbarButtonProps, ToolbarContextValue, ToolbarPartComponent, ToolbarPartProps, ToolbarProps, ToolbarReviewersProps, ToolbarSeparatorProps, ToolbarSlotPartComponent, ToolbarSlotPartProps, ToolbarTranslate, UseBookmarkDialogReturn, UseBookmarksReturn, UseContentControlResult, UseContentControlWidgetResult, UseDialogReturn, UseDocumentOutlineResult, UseDocumentSearchOptions, UseDocumentSearchResult, UseDocxSourceOptions, UseDocxSourceResult, UseEditorHostDocumentReturn, UseFontFamilyResult, UseGoToBookmarkOptions, UseGoToBookmarkReturn, UseHistoryGroupReturn, UseHyperlinkPopupResult, UseNavigationPaneOptions, UseNavigationPaneResult, UseOpenFailureOptions, UseOpenFailureReturn, UsePageSetupDialogReturn, UsePageSetupReturn, UseParagraphDialogReturn, UseParagraphFormatReturn, UseParagraphIndentReturn, UseParagraphStyleResult, UseRevisionMarkupDialogReturn, UseSplitCellDialogReturn, UseTextFormFieldDialogReturn, UseWatermarkDialogReturn, UseWatermarkReturn, UseZoomResult, VerticalRulerProps, WatermarkDialogFieldName, WatermarkDialogFields, WatermarkDialogKind, WatermarkDialogLayout };
|