@extend-ai/react-docx 0.8.0 → 0.8.2
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 +16 -6
- package/dist/{chunk-HWEQ63UE.js → chunk-4CPXLVFB.js} +32 -6
- package/dist/chunk-4CPXLVFB.js.map +1 -0
- package/dist/{chunk-XBI2PYTU.js → chunk-KB6YHU6O.js} +6 -5
- package/dist/chunk-KB6YHU6O.js.map +1 -0
- package/dist/{chunk-WKBPLHUA.js → chunk-THNPK4N7.js} +23 -3
- package/dist/chunk-THNPK4N7.js.map +1 -0
- package/dist/docx-import-worker.cjs +26 -5
- package/dist/docx-import-worker.cjs.map +1 -1
- package/dist/docx-import-worker.js +3 -3
- package/dist/docx_wasm_bg.wasm +0 -0
- package/dist/index.cjs +2899 -544
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +190 -37
- package/dist/index.d.ts +190 -37
- package/dist/index.js +2838 -543
- package/dist/index.js.map +1 -1
- package/dist/{src-2FP7IUE6.js → src-JS3OX73I.js} +3 -3
- package/dist/{src-FCCRPRMV.js → src-KC2H22CB.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-HWEQ63UE.js.map +0 -1
- package/dist/chunk-WKBPLHUA.js.map +0 -1
- package/dist/chunk-XBI2PYTU.js.map +0 -1
- /package/dist/{src-2FP7IUE6.js.map → src-JS3OX73I.js.map} +0 -0
- /package/dist/{src-FCCRPRMV.js.map → src-KC2H22CB.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -28,11 +28,13 @@ interface WasmOoxmlPart {
|
|
|
28
28
|
interface WasmOoxmlPackage {
|
|
29
29
|
parts: Record<string, WasmOoxmlPart>;
|
|
30
30
|
binaryAssets: Record<string, Uint8Array>;
|
|
31
|
+
warnings?: string[];
|
|
31
32
|
}
|
|
32
33
|
/** Package shape produced by pre-Uint8Array versions of this library. */
|
|
33
34
|
interface LegacyWasmOoxmlPackage {
|
|
34
35
|
parts: Record<string, WasmOoxmlPart>;
|
|
35
36
|
binaryAssets: Record<string, number[]>;
|
|
37
|
+
warnings?: string[];
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
interface OoxmlPart {
|
|
@@ -42,6 +44,8 @@ interface OoxmlPart {
|
|
|
42
44
|
interface OoxmlPackage {
|
|
43
45
|
parts: Map<string, OoxmlPart>;
|
|
44
46
|
binaryAssets: Map<string, Uint8Array>;
|
|
47
|
+
/** Diagnostics produced while adapting a non-OOXML source such as legacy DOC. */
|
|
48
|
+
warnings?: string[];
|
|
45
49
|
}
|
|
46
50
|
declare function parseDocx(input: ArrayBuffer): Promise<OoxmlPackage>;
|
|
47
51
|
declare function packageToArrayBuffer(pkg: OoxmlPackage): Promise<ArrayBuffer>;
|
|
@@ -68,7 +72,34 @@ interface TextStyle {
|
|
|
68
72
|
highlight?: string;
|
|
69
73
|
backgroundColor?: string;
|
|
70
74
|
fontSizePt?: number;
|
|
75
|
+
/** Resolved single-family fallback retained for backwards compatibility. */
|
|
71
76
|
fontFamily?: string;
|
|
77
|
+
/** @internal Import-time fallback used to detect fontFamily edits. */
|
|
78
|
+
sourceFontFamily?: string;
|
|
79
|
+
/** Explicit OOXML w:rFonts slots. */
|
|
80
|
+
fontFamilyAscii?: string;
|
|
81
|
+
fontFamilyHAnsi?: string;
|
|
82
|
+
fontFamilyEastAsia?: string;
|
|
83
|
+
fontFamilyCs?: string;
|
|
84
|
+
fontThemeAscii?: string;
|
|
85
|
+
fontThemeHAnsi?: string;
|
|
86
|
+
fontThemeEastAsia?: string;
|
|
87
|
+
fontThemeCs?: string;
|
|
88
|
+
/** @internal Concrete families resolved from the document theme per slot. */
|
|
89
|
+
resolvedFontFamilyAscii?: string;
|
|
90
|
+
/** @internal Concrete families resolved from the document theme per slot. */
|
|
91
|
+
resolvedFontFamilyHAnsi?: string;
|
|
92
|
+
/** @internal Concrete families resolved from the document theme per slot. */
|
|
93
|
+
resolvedFontFamilyEastAsia?: string;
|
|
94
|
+
/** @internal Concrete families resolved from the document theme per slot. */
|
|
95
|
+
resolvedFontFamilyCs?: string;
|
|
96
|
+
fontHint?: string;
|
|
97
|
+
/** OOXML w:lang slots and complex-script direction controls. */
|
|
98
|
+
language?: string;
|
|
99
|
+
languageEastAsia?: string;
|
|
100
|
+
languageBidi?: string;
|
|
101
|
+
rightToLeft?: boolean;
|
|
102
|
+
complexScript?: boolean;
|
|
72
103
|
characterSpacingTwips?: number;
|
|
73
104
|
verticalAlign?: "superscript" | "subscript";
|
|
74
105
|
runBorder?: TextRunBorderStyle;
|
|
@@ -240,6 +271,22 @@ interface ParagraphNode {
|
|
|
240
271
|
style?: ParagraphStyle;
|
|
241
272
|
paragraphMarkDeleted?: boolean;
|
|
242
273
|
sourceXml?: string;
|
|
274
|
+
/** @internal Validated provenance for a surgical plain-text sourceXml patch. */
|
|
275
|
+
sourceTextPatch?: {
|
|
276
|
+
runs: Array<{
|
|
277
|
+
style?: TextStyle;
|
|
278
|
+
link?: string;
|
|
279
|
+
noteReference?: TextRunNode["noteReference"];
|
|
280
|
+
}>;
|
|
281
|
+
};
|
|
282
|
+
/** @internal Immutable import-time run metadata used by surgical editors. */
|
|
283
|
+
sourceRunProvenance?: {
|
|
284
|
+
runs: Array<{
|
|
285
|
+
style?: TextStyle;
|
|
286
|
+
link?: string;
|
|
287
|
+
noteReference?: TextRunNode["noteReference"];
|
|
288
|
+
}>;
|
|
289
|
+
};
|
|
243
290
|
}
|
|
244
291
|
interface TableBoxSpacing {
|
|
245
292
|
topTwips?: number;
|
|
@@ -318,6 +365,11 @@ interface TableNode {
|
|
|
318
365
|
rows: TableRowNode[];
|
|
319
366
|
style?: TableStyle;
|
|
320
367
|
sourceXml?: string;
|
|
368
|
+
/** @internal Validated text-only descendant replacements for sourceXml. */
|
|
369
|
+
sourceTextPatches?: Array<{
|
|
370
|
+
sourceParagraphXml: string;
|
|
371
|
+
paragraph: ParagraphNode;
|
|
372
|
+
}>;
|
|
321
373
|
}
|
|
322
374
|
type DocNode = ParagraphNode | TableNode;
|
|
323
375
|
interface HeaderSection {
|
|
@@ -409,6 +461,16 @@ interface DocumentCommentDefinition {
|
|
|
409
461
|
parentId?: number;
|
|
410
462
|
/** True when the comment thread is marked done in commentsExtended. */
|
|
411
463
|
resolved?: boolean;
|
|
464
|
+
/** @internal Original `w:comment` block retained for lossless serialization. */
|
|
465
|
+
sourceXml?: string;
|
|
466
|
+
/** @internal Final comment paragraph id used by `commentsExtended.xml`. */
|
|
467
|
+
extendedParagraphId?: string;
|
|
468
|
+
/** @internal Resolution state read from `commentsExtended.xml`. */
|
|
469
|
+
sourceResolved?: boolean;
|
|
470
|
+
/** @internal True when `resolved` differs from the imported state. */
|
|
471
|
+
resolutionDirty?: boolean;
|
|
472
|
+
/** @internal True for a comment created in the editor rather than imported. */
|
|
473
|
+
isNew?: boolean;
|
|
412
474
|
}
|
|
413
475
|
interface DocumentCompatibilitySettings {
|
|
414
476
|
suppressSpacingBeforeAfterPageBreak?: boolean;
|
|
@@ -541,6 +603,83 @@ interface LayoutPage {
|
|
|
541
603
|
}
|
|
542
604
|
declare function layoutDocument(model: DocModel, options?: LayoutOptions): LayoutPage[];
|
|
543
605
|
|
|
606
|
+
type AnnotationMutationFailureReason = "stale" | "unsupported" | "unsafe-xml";
|
|
607
|
+
type AnnotationMutationResult = {
|
|
608
|
+
ok: true;
|
|
609
|
+
model: DocModel;
|
|
610
|
+
} | {
|
|
611
|
+
ok: false;
|
|
612
|
+
reason: AnnotationMutationFailureReason;
|
|
613
|
+
};
|
|
614
|
+
type CommentCreationResult = {
|
|
615
|
+
ok: true;
|
|
616
|
+
model: DocModel;
|
|
617
|
+
commentId: number;
|
|
618
|
+
} | {
|
|
619
|
+
ok: false;
|
|
620
|
+
reason: AnnotationMutationFailureReason;
|
|
621
|
+
};
|
|
622
|
+
type ParagraphRevisionKind = "insertion" | "deletion" | "move-from" | "move-to" | "format-change" | "paragraph-format-change";
|
|
623
|
+
interface ParagraphRevisionTarget {
|
|
624
|
+
/** Top-level body node containing the revision. Table locations are unsupported. */
|
|
625
|
+
nodeIndex: number;
|
|
626
|
+
/** OOXML `w:id` from the `w:ins` or `w:del` wrapper. */
|
|
627
|
+
revisionId: string | number;
|
|
628
|
+
kind: ParagraphRevisionKind;
|
|
629
|
+
}
|
|
630
|
+
interface CreateParagraphCommentInput {
|
|
631
|
+
/** Top-level body paragraph index. */
|
|
632
|
+
nodeIndex: number;
|
|
633
|
+
/** UTF-16 offsets into the paragraph's plain text, matching DOM selection offsets. */
|
|
634
|
+
startOffset: number;
|
|
635
|
+
endOffset: number;
|
|
636
|
+
text: string;
|
|
637
|
+
author?: string;
|
|
638
|
+
initials?: string;
|
|
639
|
+
date?: string;
|
|
640
|
+
}
|
|
641
|
+
declare function acceptParagraphRevision(model: DocModel, target: ParagraphRevisionTarget): AnnotationMutationResult;
|
|
642
|
+
declare function rejectParagraphRevision(model: DocModel, target: ParagraphRevisionTarget): AnnotationMutationResult;
|
|
643
|
+
declare function setCommentResolved(model: DocModel, commentId: number, resolved: boolean): AnnotationMutationResult;
|
|
644
|
+
/**
|
|
645
|
+
* Creates a comment over a plain-text range in one top-level paragraph. The
|
|
646
|
+
* operation splits only the boundary runs and preserves their original rPr.
|
|
647
|
+
*/
|
|
648
|
+
declare function createParagraphComment(model: DocModel, input: CreateParagraphCommentInput): CommentCreationResult;
|
|
649
|
+
|
|
650
|
+
interface InsertParagraphOptions {
|
|
651
|
+
paragraphStyle?: ParagraphStyle;
|
|
652
|
+
runStyle?: TextStyle;
|
|
653
|
+
}
|
|
654
|
+
interface UpdateTextOptions {
|
|
655
|
+
insertedStyle?: TextStyle;
|
|
656
|
+
}
|
|
657
|
+
declare function splitParagraphChildrenAtTextOffsets(paragraph: ParagraphNode, text: string, startOffset: number, endOffset: number, options?: {
|
|
658
|
+
beforeInsertedStyle?: TextStyle;
|
|
659
|
+
afterInsertedStyle?: TextStyle;
|
|
660
|
+
}): {
|
|
661
|
+
beforeChildren: ParagraphNode["children"];
|
|
662
|
+
afterChildren: ParagraphNode["children"];
|
|
663
|
+
};
|
|
664
|
+
declare function insertParagraph(model: DocModel, text: string, index?: number, options?: InsertParagraphOptions): DocModel;
|
|
665
|
+
declare function removeParagraph(model: DocModel, index: number): DocModel;
|
|
666
|
+
declare function duplicateParagraph(model: DocModel, index: number): DocModel;
|
|
667
|
+
declare function updateParagraphText(model: DocModel, index: number, text: string, options?: UpdateTextOptions): DocModel;
|
|
668
|
+
declare function updateTableCellText(model: DocModel, tableIndex: number, rowIndex: number, cellIndex: number, text: string, options?: UpdateTextOptions): DocModel;
|
|
669
|
+
declare function updateTableCellParagraphText(model: DocModel, tableIndex: number, rowIndex: number, cellIndex: number, paragraphIndex: number, text: string, options?: UpdateTextOptions): DocModel;
|
|
670
|
+
declare function updateTableCellParagraphTextRecursive(model: DocModel, tableIndex: number, rowIndex: number, cellIndex: number, paragraphIndex: number, text: string, options?: UpdateTextOptions): DocModel;
|
|
671
|
+
declare function replaceText(model: DocModel, searchValue: string | RegExp, replacement: string): DocModel;
|
|
672
|
+
declare function setParagraphHeading(model: DocModel, nodeIndex: number, headingLevel?: HeadingLevel): DocModel;
|
|
673
|
+
declare function setParagraphAlignment(model: DocModel, nodeIndex: number, align?: ParagraphAlignment): DocModel;
|
|
674
|
+
declare function applyRunStyle(model: DocModel, nodeIndex: number, runIndex: number, style: Partial<TextStyle>): DocModel;
|
|
675
|
+
declare function toggleRunStyleFlag(model: DocModel, nodeIndex: number, runIndex: number, key: "bold" | "italic" | "underline" | "strike"): DocModel;
|
|
676
|
+
declare function setRunHighlight(model: DocModel, nodeIndex: number, runIndex: number, highlight?: string): DocModel;
|
|
677
|
+
declare function setRunColor(model: DocModel, nodeIndex: number, runIndex: number, color?: string): DocModel;
|
|
678
|
+
declare function copyParagraphs(model: DocModel, startIndex: number, endIndex?: number): ParagraphNode[];
|
|
679
|
+
declare function pasteParagraphs(model: DocModel, index: number, paragraphs: ParagraphNode[]): DocModel;
|
|
680
|
+
declare function serializeParagraphsForClipboard(paragraphs: ParagraphNode[]): string;
|
|
681
|
+
declare function parseParagraphsFromClipboard(input: string): ParagraphNode[] | undefined;
|
|
682
|
+
|
|
544
683
|
interface DocumentLayoutMetrics {
|
|
545
684
|
pageWidthPx: number;
|
|
546
685
|
pageHeightPx: number;
|
|
@@ -647,7 +786,15 @@ type DocxImageDropTarget = ParagraphLocation & {
|
|
|
647
786
|
type DocxTrackedChangeKind = "insertion" | "deletion" | "move-from" | "move-to" | "format-change" | "paragraph-format-change";
|
|
648
787
|
interface DocxTrackedChange {
|
|
649
788
|
id: string;
|
|
789
|
+
/** Document generation that produced this handle. */
|
|
790
|
+
documentLoadNonce: number;
|
|
791
|
+
/** Stable block identity used to reject shifted/stale handles. */
|
|
792
|
+
blockId?: string;
|
|
793
|
+
/** Opaque source-state signature used to fail closed after mutation. */
|
|
794
|
+
sourceFingerprint: string;
|
|
650
795
|
inlineAnchorId?: string;
|
|
796
|
+
/** OOXML `w:id` used by safe accept/reject operations. */
|
|
797
|
+
revisionId?: string;
|
|
651
798
|
kind: DocxTrackedChangeKind;
|
|
652
799
|
author?: string;
|
|
653
800
|
date?: string;
|
|
@@ -665,6 +812,12 @@ interface DocxTrackedChange {
|
|
|
665
812
|
interface DocxComment {
|
|
666
813
|
/** Stable identifier (unique per rendered anchor). */
|
|
667
814
|
id: string;
|
|
815
|
+
/** Document generation that produced this handle. */
|
|
816
|
+
documentLoadNonce: number;
|
|
817
|
+
/** Stable block identity used to reject shifted/stale handles. */
|
|
818
|
+
blockId?: string;
|
|
819
|
+
/** Opaque source/comment signature used to fail closed after mutation. */
|
|
820
|
+
sourceFingerprint: string;
|
|
668
821
|
/** Comment id from `word/comments.xml` (`w:id`). */
|
|
669
822
|
commentId: number;
|
|
670
823
|
author?: string;
|
|
@@ -681,6 +834,25 @@ interface DocxComment {
|
|
|
681
834
|
nodeIndex: number;
|
|
682
835
|
location: DocxTextRangeLocation;
|
|
683
836
|
}
|
|
837
|
+
type DocxAnnotationCommandFailureReason = AnnotationMutationFailureReason;
|
|
838
|
+
type DocxAnnotationCommandResult = {
|
|
839
|
+
ok: true;
|
|
840
|
+
} | {
|
|
841
|
+
ok: false;
|
|
842
|
+
reason: DocxAnnotationCommandFailureReason;
|
|
843
|
+
};
|
|
844
|
+
type DocxCommentCreationCommandResult = {
|
|
845
|
+
ok: true;
|
|
846
|
+
commentId: number;
|
|
847
|
+
} | {
|
|
848
|
+
ok: false;
|
|
849
|
+
reason: DocxAnnotationCommandFailureReason;
|
|
850
|
+
};
|
|
851
|
+
interface DocxCreateCommentOptions {
|
|
852
|
+
author?: string;
|
|
853
|
+
initials?: string;
|
|
854
|
+
date?: string;
|
|
855
|
+
}
|
|
684
856
|
type DocxLineSpacingRule = "auto" | "exact" | "atLeast";
|
|
685
857
|
type DocxSelectionSessionKind = "idle" | "pointer" | "keyboard" | "composition" | "command" | "history-restore";
|
|
686
858
|
interface DocxLineSpacingInfo {
|
|
@@ -798,6 +970,10 @@ interface DocxEditorController {
|
|
|
798
970
|
syncPaginationInfo: (pagination: DocxPaginationInfo) => void;
|
|
799
971
|
toggleShowTrackedChanges: () => void;
|
|
800
972
|
toggleShowComments: () => void;
|
|
973
|
+
acceptTrackedChange: (change: DocxTrackedChange) => DocxAnnotationCommandResult;
|
|
974
|
+
rejectTrackedChange: (change: DocxTrackedChange) => DocxAnnotationCommandResult;
|
|
975
|
+
createComment: (text: string, options?: DocxCreateCommentOptions) => DocxCommentCreationCommandResult;
|
|
976
|
+
setCommentResolved: (comment: DocxComment, resolved: boolean) => DocxAnnotationCommandResult;
|
|
801
977
|
importDocxFile: (file: File) => Promise<void>;
|
|
802
978
|
newDocument: () => void;
|
|
803
979
|
exportDocx: () => void;
|
|
@@ -1201,6 +1377,10 @@ interface DocxTrackedChangeCardRenderProps {
|
|
|
1201
1377
|
pageIndex: number;
|
|
1202
1378
|
/** Positioning style computed by the viewer. Apply this to the card root. */
|
|
1203
1379
|
style: React.CSSProperties;
|
|
1380
|
+
/** Accept this change. Unsupported or stale markup fails closed. */
|
|
1381
|
+
accept: () => DocxAnnotationCommandResult;
|
|
1382
|
+
/** Reject this change. Unsupported or stale markup fails closed. */
|
|
1383
|
+
reject: () => DocxAnnotationCommandResult;
|
|
1204
1384
|
}
|
|
1205
1385
|
interface DocxCommentCardRenderProps {
|
|
1206
1386
|
/** Comment data represented by the card. */
|
|
@@ -1217,6 +1397,8 @@ interface DocxCommentCardRenderProps {
|
|
|
1217
1397
|
pageIndex: number;
|
|
1218
1398
|
/** Positioning style computed by the viewer. Apply this to the card root. */
|
|
1219
1399
|
style: React.CSSProperties;
|
|
1400
|
+
/** Mark the comment resolved or reopen it. */
|
|
1401
|
+
setResolved: (resolved: boolean) => DocxAnnotationCommandResult;
|
|
1220
1402
|
}
|
|
1221
1403
|
/**
|
|
1222
1404
|
* Viewer interaction mode.
|
|
@@ -1261,6 +1443,8 @@ interface UseDocxTrackChangesResult {
|
|
|
1261
1443
|
toggleShowTrackedChanges: () => void;
|
|
1262
1444
|
changesByLocation: Map<string, DocxTrackedChange[]>;
|
|
1263
1445
|
getChangesForLocation: (location: DocxTextRangeLocation) => DocxTrackedChange[];
|
|
1446
|
+
acceptChange: (change: DocxTrackedChange) => DocxAnnotationCommandResult;
|
|
1447
|
+
rejectChange: (change: DocxTrackedChange) => DocxAnnotationCommandResult;
|
|
1264
1448
|
}
|
|
1265
1449
|
interface UseDocxCommentsResult {
|
|
1266
1450
|
comments: DocxComment[];
|
|
@@ -1269,6 +1453,8 @@ interface UseDocxCommentsResult {
|
|
|
1269
1453
|
toggleShowComments: () => void;
|
|
1270
1454
|
commentsByLocation: Map<string, DocxComment[]>;
|
|
1271
1455
|
getCommentsForLocation: (location: DocxTextRangeLocation) => DocxComment[];
|
|
1456
|
+
createComment: (text: string, options?: DocxCreateCommentOptions) => DocxCommentCreationCommandResult;
|
|
1457
|
+
setCommentResolved: (comment: DocxComment, resolved: boolean) => DocxAnnotationCommandResult;
|
|
1272
1458
|
}
|
|
1273
1459
|
interface DocxSectionColumnLayout {
|
|
1274
1460
|
count: number;
|
|
@@ -1473,50 +1659,17 @@ declare function useDocxImageWrapMenu(menu: Pick<DocxContextMenuRenderProps, "co
|
|
|
1473
1659
|
declare function useDocxLineSpacing(editor: Pick<DocxEditorController, "selectedLineSpacing" | "setLineSpacing">): UseDocxLineSpacingResult;
|
|
1474
1660
|
declare function useDocxBorders(editor: Pick<DocxEditorController, "selectedBorderContext" | "activeBorderPresets" | "applyBorderPreset">): UseDocxBordersResult;
|
|
1475
1661
|
declare function useDocxFormFields(editor: Pick<DocxEditorController, "model" | "selectedFormField" | "selectFormField" | "setFormFieldValue" | "toggleFormCheckbox" | "updateFormFieldWidget">): UseDocxFormFieldsResult;
|
|
1476
|
-
declare function useDocxTrackChanges(editor: Pick<DocxEditorController, "trackedChanges" | "showTrackedChanges" | "setShowTrackedChanges" | "toggleShowTrackedChanges">): UseDocxTrackChangesResult;
|
|
1662
|
+
declare function useDocxTrackChanges(editor: Pick<DocxEditorController, "trackedChanges" | "showTrackedChanges" | "setShowTrackedChanges" | "toggleShowTrackedChanges" | "acceptTrackedChange" | "rejectTrackedChange">): UseDocxTrackChangesResult;
|
|
1477
1663
|
/**
|
|
1478
1664
|
* Exposes document comments and the show/hide state, mirroring
|
|
1479
1665
|
* `useDocxTrackChanges`. Pair with `DocxEditorViewer`'s `renderCommentCard`
|
|
1480
1666
|
* to fully customize how comments render.
|
|
1481
1667
|
*/
|
|
1482
|
-
declare function useDocxComments(editor: Pick<DocxEditorController, "comments" | "showComments" | "setShowComments" | "toggleShowComments">): UseDocxCommentsResult;
|
|
1668
|
+
declare function useDocxComments(editor: Pick<DocxEditorController, "comments" | "showComments" | "setShowComments" | "toggleShowComments" | "createComment" | "setCommentResolved">): UseDocxCommentsResult;
|
|
1483
1669
|
declare function useDocxPageLayout(editor: Pick<DocxEditorController, "model">): UseDocxPageLayoutResult;
|
|
1484
1670
|
declare function useDocxPagination(editor: Pick<DocxEditorController, "currentPage" | "totalPages">): UseDocxPaginationResult;
|
|
1485
1671
|
declare function DocxEditorViewer({ editor, className, style, pageBackgroundColor, pageGapBackgroundColor, deferInitialPaginationPaint, loadingState, pageVirtualization, visiblePageRange, onPageCountChange, onRequestPageReveal, headingStyles, showTrackedChanges, renderTrackedChangeCard, showComments, renderCommentCard, renderTableContextMenu, renderContextMenu, onFormFieldDoubleClick, mode, }: DocxEditorViewerProps): React.JSX.Element;
|
|
1486
1672
|
|
|
1487
|
-
interface InsertParagraphOptions {
|
|
1488
|
-
paragraphStyle?: ParagraphStyle;
|
|
1489
|
-
runStyle?: TextStyle;
|
|
1490
|
-
}
|
|
1491
|
-
interface UpdateTextOptions {
|
|
1492
|
-
insertedStyle?: TextStyle;
|
|
1493
|
-
}
|
|
1494
|
-
declare function splitParagraphChildrenAtTextOffsets(paragraph: ParagraphNode, text: string, startOffset: number, endOffset: number, options?: {
|
|
1495
|
-
beforeInsertedStyle?: TextStyle;
|
|
1496
|
-
afterInsertedStyle?: TextStyle;
|
|
1497
|
-
}): {
|
|
1498
|
-
beforeChildren: ParagraphNode["children"];
|
|
1499
|
-
afterChildren: ParagraphNode["children"];
|
|
1500
|
-
};
|
|
1501
|
-
declare function insertParagraph(model: DocModel, text: string, index?: number, options?: InsertParagraphOptions): DocModel;
|
|
1502
|
-
declare function removeParagraph(model: DocModel, index: number): DocModel;
|
|
1503
|
-
declare function duplicateParagraph(model: DocModel, index: number): DocModel;
|
|
1504
|
-
declare function updateParagraphText(model: DocModel, index: number, text: string, options?: UpdateTextOptions): DocModel;
|
|
1505
|
-
declare function updateTableCellText(model: DocModel, tableIndex: number, rowIndex: number, cellIndex: number, text: string, options?: UpdateTextOptions): DocModel;
|
|
1506
|
-
declare function updateTableCellParagraphText(model: DocModel, tableIndex: number, rowIndex: number, cellIndex: number, paragraphIndex: number, text: string, options?: UpdateTextOptions): DocModel;
|
|
1507
|
-
declare function updateTableCellParagraphTextRecursive(model: DocModel, tableIndex: number, rowIndex: number, cellIndex: number, paragraphIndex: number, text: string, options?: UpdateTextOptions): DocModel;
|
|
1508
|
-
declare function replaceText(model: DocModel, searchValue: string | RegExp, replacement: string): DocModel;
|
|
1509
|
-
declare function setParagraphHeading(model: DocModel, nodeIndex: number, headingLevel?: HeadingLevel): DocModel;
|
|
1510
|
-
declare function setParagraphAlignment(model: DocModel, nodeIndex: number, align?: ParagraphAlignment): DocModel;
|
|
1511
|
-
declare function applyRunStyle(model: DocModel, nodeIndex: number, runIndex: number, style: Partial<TextStyle>): DocModel;
|
|
1512
|
-
declare function toggleRunStyleFlag(model: DocModel, nodeIndex: number, runIndex: number, key: "bold" | "italic" | "underline" | "strike"): DocModel;
|
|
1513
|
-
declare function setRunHighlight(model: DocModel, nodeIndex: number, runIndex: number, highlight?: string): DocModel;
|
|
1514
|
-
declare function setRunColor(model: DocModel, nodeIndex: number, runIndex: number, color?: string): DocModel;
|
|
1515
|
-
declare function copyParagraphs(model: DocModel, startIndex: number, endIndex?: number): ParagraphNode[];
|
|
1516
|
-
declare function pasteParagraphs(model: DocModel, index: number, paragraphs: ParagraphNode[]): DocModel;
|
|
1517
|
-
declare function serializeParagraphsForClipboard(paragraphs: ParagraphNode[]): string;
|
|
1518
|
-
declare function parseParagraphsFromClipboard(input: string): ParagraphNode[] | undefined;
|
|
1519
|
-
|
|
1520
1673
|
interface ResolvedModelSection {
|
|
1521
1674
|
startNodeIndex: number;
|
|
1522
1675
|
sectionPropertiesXml?: string;
|
|
@@ -1797,6 +1950,6 @@ interface UseDocxModelState {
|
|
|
1797
1950
|
error?: Error;
|
|
1798
1951
|
}
|
|
1799
1952
|
declare function useDocxModel(file?: ArrayBuffer): UseDocxModelState;
|
|
1800
|
-
declare function ReactDocxViewer({ file, model, className, layoutOptions, emptyState }: ReactDocxViewerProps): React.JSX.Element;
|
|
1953
|
+
declare function ReactDocxViewer({ file, model, className, layoutOptions, emptyState, }: ReactDocxViewerProps): React.JSX.Element;
|
|
1801
1954
|
|
|
1802
|
-
export { DEFAULT_MIN_PARAGRAPH_LINE_HEIGHT_PX, DEFAULT_PAGE_OVERFLOW_TOLERANCE_PX, type DocModel, type DocNode, type DocumentCommentDefinition, type DocumentCompatibilitySettings, type DocumentNoteDefinition, type DocumentPageNodeSegment, type DocumentPageRange, type DocumentPageSegmentationOptions, type DocumentSection, type DocxBorderContext, type DocxBorderPreset, type DocxBorderPresetState, type DocxComment, type DocxCommentCardRenderProps, type DocxContextMenuAction, type DocxContextMenuActionId, type DocxContextMenuContext, type DocxContextMenuRenderProps, type DocxDocumentTheme, type DocxEditorController, type DocxEditorSelection, DocxEditorViewer, type DocxEditorViewerMode, type DocxEditorViewerProps, type DocxFormFieldLocation, type DocxHeadingStyleMap, type DocxImageDropTarget, type DocxImageLocation, type DocxImageWrapMenuOption, type DocxImageWrapMode, type DocxImageWrapState, type DocxLineSpacingInfo, type DocxListType, type DocxPageLayoutInfo, type DocxPageThumbnailBounds, type DocxPageThumbnailItem, type DocxPageThumbnailRenderWindow, type DocxPageThumbnailResolution, type DocxPageThumbnailResolutionOptions, type DocxPageThumbnailStatus, type DocxPageVirtualizationOptions, type DocxPaginationInfo, type DocxSectionColumnLayout, type DocxSelectedFormField, type DocxTableContextMenuAction, type DocxTableContextMenuActionId, type DocxTableContextMenuContext, type DocxTableContextMenuRenderProps, type DocxTextRange, type DocxTextRangeLocation, type DocxTrackedChange, type DocxTrackedChangeCardRenderProps, type DocxTrackedChangeKind, type DocxViewerThumbnails, type DocxVisiblePageRange, type FooterSection, type FormFieldCheckboxWidgetSettings, type FormFieldDropdownWidgetSettings, type FormFieldOption, type FormFieldRunNode, type FormFieldSourceKind, type FormFieldTextWidgetSettings, type FormFieldType, type FormFieldWidgetSettings, type HeaderSection, type HeadingLevel, type ImageRunNode, type InsertParagraphOptions, type LayoutBlock, type LayoutFragmentSource, type LayoutImageRun, type LayoutOptions, type LayoutPage, type LayoutParagraphBlock, type LayoutRun, type LayoutSnapshot, type LayoutSnapshotBlockFragment, type LayoutSnapshotImageRun, type LayoutSnapshotMargins, type LayoutSnapshotOptions, type LayoutSnapshotPage, type LayoutSnapshotPageSize, type LayoutSnapshotParagraphFragment, type LayoutSnapshotRect, type LayoutSnapshotRun, type LayoutSnapshotTableCellFragment, type LayoutSnapshotTableFragment, type LayoutSnapshotTableRowFragment, type LayoutSnapshotTextRun, type LayoutTableBlock, type LayoutTableCell, type LayoutTableRow, type LayoutTextRun, type LegacyWasmOoxmlPackage, type LetterheadColumnSegmentGroup, type NumberingAbstractDefinition, type NumberingDefinitionSet, type NumberingInstanceDefinition, type NumberingLevelDefinition, type NumberingPictureBulletDefinition, type OoxmlPackage, type OoxmlPart, type OverflowBreakCollectionOptions, type PageSegmentationCallbacks, type PaginationSectionMetrics, type ParagraphAlignment, type ParagraphBorderSet, type ParagraphBorderStyle, type ParagraphChildNode, type ParagraphIndent, type ParagraphLineRange, type ParagraphNode, type ParagraphNumbering, type ParagraphSpacing, type ParagraphSplitControlOptions, type ParagraphStyle, type ParagraphStyleDefinition, type ParagraphTabStop, ReactDocxViewer, type ReactDocxViewerProps, type ResolvedDocument, type ResolvedDocumentSection, type ResolvedLayoutMetrics, type ResolvedModelSection, type TableBorderSet, type TableBorderStyle, type TableBoxSpacing, type TableCellContentNode, type TableCellNode, type TableCellStyle, type TableExplicitPageBreakInfo, type TableNode, type TableRowNode, type TableRowRange, type TableRowStyle, type TableStyle, type TextRunBorderStyle, type TextRunNode, type TextStyle, type UpdateTextOptions, type UseDocxBordersResult, type UseDocxCommentsResult, type UseDocxDocumentThemeResult, type UseDocxEditorOptions, type UseDocxFormFieldsResult, type UseDocxImageWrapMenuResult, type UseDocxLineSpacingResult, type UseDocxModelState, type UseDocxPageLayoutResult, type UseDocxPageThumbnailsOptions, type UseDocxPageThumbnailsResult, type UseDocxPaginationResult, type UseDocxParagraphStylesResult, type UseDocxTrackChangesResult, type UseDocxViewerThumbnailsOptions, type WasmOoxmlPackage, type WasmSource, allocateBlockId, applyRunStyle, buildDocModel, buildDocModelFromBytes, buildDocumentPageNodeSegments, buildDocumentPageRanges, buildLayoutSnapshot, cloneDocModel, cloneParagraphNode, cloneTableNode, collectDocxEstimatedOverflowBreakStartNodeIndexes, collectDocxHardPageBreakStartNodeIndexes, collectDocxLastRenderedPageBreakStartNodeIndexes, collectDuplicateDocModelBlockIds, collectTableExplicitPageBreakInfo, collectTopLevelExplicitPageBreakStartNodeIndexes, copyParagraphs, createMinimalDocxPackage, deepFreezeDocModel, defaultStarterModel, duplicateParagraph, ensureDocModelBlockIds, getPart, initWasm, insertParagraph, layoutDocument, modelToDocumentXml, normalizeDocModel, packageToArrayBuffer, paragraphAfterSpacingPx, paragraphBeforeSpacingPx, paragraphHasExplicitPageBreak, paragraphHasLastRenderedPageBreak, paragraphHasPageBreakBefore, paragraphLetterheadColumnGroupAtSegmentOffset, paragraphLetterheadFloatSideAtNodeIndex, paragraphStartsWithLastRenderedPageBreak, parseDocx, parseParagraphsFromClipboard, parseSectionLayout, pasteParagraphs, removeParagraph, replaceText, resolveDocumentForLayout, resolveDocumentLayout, resolveDocumentPageSegmentStartNodeIndex, resolveDocumentSectionsFromMetadata, resolveDocxPageThumbnailResolution, resolvePaginationSectionMetricsIndexForNodeIndex, resolveParagraphBeforeSpacingPx, resolveSectionIndexForNodeIndex, resolveSectionPropertiesXmlForNodeIndex, scalePaginationSectionMetricsHeights, scorePaginationAgainstStoredPageBreaks, sectionBreakAfterParagraphStartsNewPage, sectionBreakPropertiesStartNewPage, sectionTitlePageEnabled, selectSectionVariantForPage, serializeDocModel, serializeDocx, serializeParagraphsForClipboard, setParagraphAlignment, setParagraphHeading, setRunColor, setRunHighlight, setWasmSource, splitParagraphChildrenAtTextOffsets, toggleRunStyleFlag, updateParagraphText, updateTableCellParagraphText, updateTableCellParagraphTextRecursive, updateTableCellText, useDocxBorders, useDocxComments, useDocxDocumentTheme, useDocxEditor, useDocxFormFields, useDocxImageWrapMenu, useDocxLineSpacing, useDocxModel, useDocxPageLayout, useDocxPageThumbnails, useDocxPagination, useDocxParagraphStyles, useDocxTrackChanges, useDocxViewerThumbnails, withPart };
|
|
1955
|
+
export { type AnnotationMutationFailureReason, type AnnotationMutationResult, type CommentCreationResult, type CreateParagraphCommentInput, DEFAULT_MIN_PARAGRAPH_LINE_HEIGHT_PX, DEFAULT_PAGE_OVERFLOW_TOLERANCE_PX, type DocModel, type DocNode, type DocumentCommentDefinition, type DocumentCompatibilitySettings, type DocumentNoteDefinition, type DocumentPageNodeSegment, type DocumentPageRange, type DocumentPageSegmentationOptions, type DocumentSection, type DocxAnnotationCommandFailureReason, type DocxAnnotationCommandResult, type DocxBorderContext, type DocxBorderPreset, type DocxBorderPresetState, type DocxComment, type DocxCommentCardRenderProps, type DocxCommentCreationCommandResult, type DocxContextMenuAction, type DocxContextMenuActionId, type DocxContextMenuContext, type DocxContextMenuRenderProps, type DocxCreateCommentOptions, type DocxDocumentTheme, type DocxEditorController, type DocxEditorSelection, DocxEditorViewer, type DocxEditorViewerMode, type DocxEditorViewerProps, type DocxFormFieldLocation, type DocxHeadingStyleMap, type DocxImageDropTarget, type DocxImageLocation, type DocxImageWrapMenuOption, type DocxImageWrapMode, type DocxImageWrapState, type DocxLineSpacingInfo, type DocxListType, type DocxPageLayoutInfo, type DocxPageThumbnailBounds, type DocxPageThumbnailItem, type DocxPageThumbnailRenderWindow, type DocxPageThumbnailResolution, type DocxPageThumbnailResolutionOptions, type DocxPageThumbnailStatus, type DocxPageVirtualizationOptions, type DocxPaginationInfo, type DocxSectionColumnLayout, type DocxSelectedFormField, type DocxTableContextMenuAction, type DocxTableContextMenuActionId, type DocxTableContextMenuContext, type DocxTableContextMenuRenderProps, type DocxTextRange, type DocxTextRangeLocation, type DocxTrackedChange, type DocxTrackedChangeCardRenderProps, type DocxTrackedChangeKind, type DocxViewerThumbnails, type DocxVisiblePageRange, type FooterSection, type FormFieldCheckboxWidgetSettings, type FormFieldDropdownWidgetSettings, type FormFieldOption, type FormFieldRunNode, type FormFieldSourceKind, type FormFieldTextWidgetSettings, type FormFieldType, type FormFieldWidgetSettings, type HeaderSection, type HeadingLevel, type ImageRunNode, type InsertParagraphOptions, type LayoutBlock, type LayoutFragmentSource, type LayoutImageRun, type LayoutOptions, type LayoutPage, type LayoutParagraphBlock, type LayoutRun, type LayoutSnapshot, type LayoutSnapshotBlockFragment, type LayoutSnapshotImageRun, type LayoutSnapshotMargins, type LayoutSnapshotOptions, type LayoutSnapshotPage, type LayoutSnapshotPageSize, type LayoutSnapshotParagraphFragment, type LayoutSnapshotRect, type LayoutSnapshotRun, type LayoutSnapshotTableCellFragment, type LayoutSnapshotTableFragment, type LayoutSnapshotTableRowFragment, type LayoutSnapshotTextRun, type LayoutTableBlock, type LayoutTableCell, type LayoutTableRow, type LayoutTextRun, type LegacyWasmOoxmlPackage, type LetterheadColumnSegmentGroup, type NumberingAbstractDefinition, type NumberingDefinitionSet, type NumberingInstanceDefinition, type NumberingLevelDefinition, type NumberingPictureBulletDefinition, type OoxmlPackage, type OoxmlPart, type OverflowBreakCollectionOptions, type PageSegmentationCallbacks, type PaginationSectionMetrics, type ParagraphAlignment, type ParagraphBorderSet, type ParagraphBorderStyle, type ParagraphChildNode, type ParagraphIndent, type ParagraphLineRange, type ParagraphNode, type ParagraphNumbering, type ParagraphRevisionKind, type ParagraphRevisionTarget, type ParagraphSpacing, type ParagraphSplitControlOptions, type ParagraphStyle, type ParagraphStyleDefinition, type ParagraphTabStop, ReactDocxViewer, type ReactDocxViewerProps, type ResolvedDocument, type ResolvedDocumentSection, type ResolvedLayoutMetrics, type ResolvedModelSection, type TableBorderSet, type TableBorderStyle, type TableBoxSpacing, type TableCellContentNode, type TableCellNode, type TableCellStyle, type TableExplicitPageBreakInfo, type TableNode, type TableRowNode, type TableRowRange, type TableRowStyle, type TableStyle, type TextRunBorderStyle, type TextRunNode, type TextStyle, type UpdateTextOptions, type UseDocxBordersResult, type UseDocxCommentsResult, type UseDocxDocumentThemeResult, type UseDocxEditorOptions, type UseDocxFormFieldsResult, type UseDocxImageWrapMenuResult, type UseDocxLineSpacingResult, type UseDocxModelState, type UseDocxPageLayoutResult, type UseDocxPageThumbnailsOptions, type UseDocxPageThumbnailsResult, type UseDocxPaginationResult, type UseDocxParagraphStylesResult, type UseDocxTrackChangesResult, type UseDocxViewerThumbnailsOptions, type WasmOoxmlPackage, type WasmSource, acceptParagraphRevision, allocateBlockId, applyRunStyle, buildDocModel, buildDocModelFromBytes, buildDocumentPageNodeSegments, buildDocumentPageRanges, buildLayoutSnapshot, cloneDocModel, cloneParagraphNode, cloneTableNode, collectDocxEstimatedOverflowBreakStartNodeIndexes, collectDocxHardPageBreakStartNodeIndexes, collectDocxLastRenderedPageBreakStartNodeIndexes, collectDuplicateDocModelBlockIds, collectTableExplicitPageBreakInfo, collectTopLevelExplicitPageBreakStartNodeIndexes, copyParagraphs, createMinimalDocxPackage, createParagraphComment, deepFreezeDocModel, defaultStarterModel, duplicateParagraph, ensureDocModelBlockIds, getPart, initWasm, insertParagraph, layoutDocument, modelToDocumentXml, normalizeDocModel, packageToArrayBuffer, paragraphAfterSpacingPx, paragraphBeforeSpacingPx, paragraphHasExplicitPageBreak, paragraphHasLastRenderedPageBreak, paragraphHasPageBreakBefore, paragraphLetterheadColumnGroupAtSegmentOffset, paragraphLetterheadFloatSideAtNodeIndex, paragraphStartsWithLastRenderedPageBreak, parseDocx, parseParagraphsFromClipboard, parseSectionLayout, pasteParagraphs, rejectParagraphRevision, removeParagraph, replaceText, resolveDocumentForLayout, resolveDocumentLayout, resolveDocumentPageSegmentStartNodeIndex, resolveDocumentSectionsFromMetadata, resolveDocxPageThumbnailResolution, resolvePaginationSectionMetricsIndexForNodeIndex, resolveParagraphBeforeSpacingPx, resolveSectionIndexForNodeIndex, resolveSectionPropertiesXmlForNodeIndex, scalePaginationSectionMetricsHeights, scorePaginationAgainstStoredPageBreaks, sectionBreakAfterParagraphStartsNewPage, sectionBreakPropertiesStartNewPage, sectionTitlePageEnabled, selectSectionVariantForPage, serializeDocModel, serializeDocx, serializeParagraphsForClipboard, setCommentResolved, setParagraphAlignment, setParagraphHeading, setRunColor, setRunHighlight, setWasmSource, splitParagraphChildrenAtTextOffsets, toggleRunStyleFlag, updateParagraphText, updateTableCellParagraphText, updateTableCellParagraphTextRecursive, updateTableCellText, useDocxBorders, useDocxComments, useDocxDocumentTheme, useDocxEditor, useDocxFormFields, useDocxImageWrapMenu, useDocxLineSpacing, useDocxModel, useDocxPageLayout, useDocxPageThumbnails, useDocxPagination, useDocxParagraphStyles, useDocxTrackChanges, useDocxViewerThumbnails, withPart };
|