@beyondwork/docx-react-component 1.0.12 → 1.0.14
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/package.json +9 -1
- package/src/api/public-types.ts +72 -0
- package/src/core/commands/formatting-commands.ts +742 -0
- package/src/core/commands/image-commands.ts +84 -2
- package/src/core/commands/structural-helpers.ts +309 -0
- package/src/core/commands/table-structure-commands.ts +721 -0
- package/src/core/commands/text-commands.ts +166 -1
- package/src/core/selection/review-anchors.ts +89 -0
- package/src/formats/xlsx/io/parse-sheet.ts +177 -7
- package/src/formats/xlsx/io/parse-styles.ts +2 -0
- package/src/formats/xlsx/io/xlsx-session.ts +18 -12
- package/src/formats/xlsx/model/sheet.ts +81 -1
- package/src/formats/xlsx/model/workbook.ts +10 -6
- package/src/runtime/document-runtime.ts +13 -0
- package/src/runtime/session-capabilities.ts +22 -1
- package/src/runtime/surface-projection.ts +1 -0
- package/src/runtime/table-commands.ts +79 -0
- package/src/runtime/table-schema.ts +9 -0
- package/src/ui/WordReviewEditor.tsx +534 -8
- package/src/ui-tailwind/chrome/tw-selection-toolbar.tsx +8 -2
- package/src/ui-tailwind/editor-surface/pm-state-from-snapshot.ts +7 -5
- package/src/ui-tailwind/editor-surface/search-plugin.ts +76 -16
- package/src/ui-tailwind/editor-surface/tw-prosemirror-surface.tsx +162 -14
- package/src/ui-tailwind/tw-review-workspace.tsx +3 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beyondwork/docx-react-component",
|
|
3
3
|
"publisher": "beyondwork",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.14",
|
|
5
5
|
"description": "Embeddable React Word (docx) editor with review, comments, tracked changes, and round-trip OOXML fidelity.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": [
|
|
@@ -33,6 +33,14 @@
|
|
|
33
33
|
"types": "./src/api/public-types.ts",
|
|
34
34
|
"import": "./src/api/public-types.ts"
|
|
35
35
|
},
|
|
36
|
+
"./io/docx-session": {
|
|
37
|
+
"types": "./src/io/docx-session.ts",
|
|
38
|
+
"import": "./src/io/docx-session.ts"
|
|
39
|
+
},
|
|
40
|
+
"./runtime/document-runtime": {
|
|
41
|
+
"types": "./src/runtime/document-runtime.ts",
|
|
42
|
+
"import": "./src/runtime/document-runtime.ts"
|
|
43
|
+
},
|
|
36
44
|
"./ui-tailwind/theme/editor-theme.css": "./src/ui-tailwind/theme/editor-theme.css",
|
|
37
45
|
"./package.json": "./package.json"
|
|
38
46
|
},
|
package/src/api/public-types.ts
CHANGED
|
@@ -123,6 +123,48 @@ export interface TrackedChangesSnapshot {
|
|
|
123
123
|
revisions: TrackedChangeEntrySnapshot[];
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
export type FormattingAlignment = "left" | "center" | "right" | "justify";
|
|
127
|
+
|
|
128
|
+
export interface FormattingStateSnapshot {
|
|
129
|
+
bold: boolean;
|
|
130
|
+
italic: boolean;
|
|
131
|
+
underline: boolean;
|
|
132
|
+
strikethrough: boolean;
|
|
133
|
+
superscript: boolean;
|
|
134
|
+
subscript: boolean;
|
|
135
|
+
fontFamily?: string;
|
|
136
|
+
fontSize?: number;
|
|
137
|
+
textColor?: string;
|
|
138
|
+
highlightColor?: string | null;
|
|
139
|
+
alignment?: FormattingAlignment;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface SearchOptions {
|
|
143
|
+
matchCase?: boolean;
|
|
144
|
+
wholeWord?: boolean;
|
|
145
|
+
limit?: number;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface SearchResultSnapshot {
|
|
149
|
+
resultId: string;
|
|
150
|
+
anchor: EditorAnchorProjection;
|
|
151
|
+
excerpt: string;
|
|
152
|
+
isActive: boolean;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface InsertTableOptions {
|
|
156
|
+
rows: number;
|
|
157
|
+
columns: number;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface InsertImageOptions {
|
|
161
|
+
data: Uint8Array;
|
|
162
|
+
mimeType: string;
|
|
163
|
+
width?: number;
|
|
164
|
+
height?: number;
|
|
165
|
+
altText?: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
126
168
|
export type SurfaceTextMark =
|
|
127
169
|
| "bold"
|
|
128
170
|
| "italic"
|
|
@@ -192,6 +234,7 @@ export interface SurfaceTableCellSnapshot {
|
|
|
192
234
|
verticalMerge: "restart" | "continue" | null;
|
|
193
235
|
colspan: number;
|
|
194
236
|
rowspan: number;
|
|
237
|
+
backgroundColor?: string | null;
|
|
195
238
|
content: SurfaceBlockSnapshot[];
|
|
196
239
|
}
|
|
197
240
|
|
|
@@ -538,6 +581,35 @@ export interface WordReviewEditorRef {
|
|
|
538
581
|
getWarnings(): EditorWarning[];
|
|
539
582
|
getComments(): CommentSidebarSnapshot;
|
|
540
583
|
getTrackedChanges(): TrackedChangesSnapshot;
|
|
584
|
+
getFormattingState(): FormattingStateSnapshot;
|
|
585
|
+
toggleBold(): void;
|
|
586
|
+
toggleItalic(): void;
|
|
587
|
+
toggleUnderline(): void;
|
|
588
|
+
toggleStrikethrough(): void;
|
|
589
|
+
toggleSuperscript(): void;
|
|
590
|
+
toggleSubscript(): void;
|
|
591
|
+
setFontFamily(fontFamily: string | null): void;
|
|
592
|
+
setFontSize(size: number | null): void;
|
|
593
|
+
setTextColor(color: string | null): void;
|
|
594
|
+
setHighlightColor(color: string | null): void;
|
|
595
|
+
setAlignment(alignment: FormattingAlignment): void;
|
|
596
|
+
indent(): void;
|
|
597
|
+
outdent(): void;
|
|
598
|
+
insertPageBreak(): void;
|
|
599
|
+
insertTable(options: InsertTableOptions): void;
|
|
600
|
+
insertImage(options: InsertImageOptions): void;
|
|
601
|
+
addRowBefore(): void;
|
|
602
|
+
addRowAfter(): void;
|
|
603
|
+
addColumnBefore(): void;
|
|
604
|
+
addColumnAfter(): void;
|
|
605
|
+
deleteRow(): void;
|
|
606
|
+
deleteColumn(): void;
|
|
607
|
+
deleteTable(): void;
|
|
608
|
+
mergeCells(): void;
|
|
609
|
+
splitCell(): void;
|
|
610
|
+
setCellBackground(color: string): void;
|
|
611
|
+
search(query: string, options?: SearchOptions): SearchResultSnapshot[];
|
|
612
|
+
clearSearch(): void;
|
|
541
613
|
scrollToRevision(revisionId: string): void;
|
|
542
614
|
scrollToComment(commentId: string): void;
|
|
543
615
|
}
|