@beyondwork/docx-react-component 1.0.12 → 1.0.13
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 +42 -23
- 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/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/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 +519 -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/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beyondwork/docx-react-component",
|
|
3
3
|
"publisher": "beyondwork",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.13",
|
|
5
5
|
"description": "Embeddable React Word (docx) editor with review, comments, tracked changes, and round-trip OOXML fidelity.",
|
|
6
|
+
"packageManager": "pnpm@10.30.3",
|
|
6
7
|
"type": "module",
|
|
7
8
|
"sideEffects": [
|
|
8
9
|
"**/*.css"
|
|
@@ -33,10 +34,41 @@
|
|
|
33
34
|
"types": "./src/api/public-types.ts",
|
|
34
35
|
"import": "./src/api/public-types.ts"
|
|
35
36
|
},
|
|
37
|
+
"./io/docx-session": {
|
|
38
|
+
"types": "./src/io/docx-session.ts",
|
|
39
|
+
"import": "./src/io/docx-session.ts"
|
|
40
|
+
},
|
|
41
|
+
"./runtime/document-runtime": {
|
|
42
|
+
"types": "./src/runtime/document-runtime.ts",
|
|
43
|
+
"import": "./src/runtime/document-runtime.ts"
|
|
44
|
+
},
|
|
36
45
|
"./ui-tailwind/theme/editor-theme.css": "./src/ui-tailwind/theme/editor-theme.css",
|
|
37
46
|
"./package.json": "./package.json"
|
|
38
47
|
},
|
|
39
48
|
"types": "./src/index.ts",
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsup",
|
|
51
|
+
"test": "bash scripts/run-workspace-tests.sh",
|
|
52
|
+
"test:repo": "node scripts/run-repo-tests.mjs core",
|
|
53
|
+
"test:repo:all": "node scripts/run-repo-tests.mjs all",
|
|
54
|
+
"test:repo:optional": "node scripts/run-repo-tests.mjs optional",
|
|
55
|
+
"test:wcag-audit": "node scripts/run-repo-tests.mjs wcag-audit",
|
|
56
|
+
"test:harness": "pnpm --filter @docx-react-component/react-word-editor-harness test",
|
|
57
|
+
"lint": "pnpm run lint:no-authored-js && pnpm run lint:tsgo && pnpm run lint:tsgo:harness",
|
|
58
|
+
"lint:no-authored-js": "bash scripts/check-no-authored-js.sh",
|
|
59
|
+
"lint:tsgo": "tsgo --noEmit -p tsconfig.build.json",
|
|
60
|
+
"lint:tsgo:harness": "pnpm --filter @docx-react-component/react-word-editor-harness lint:tsgo",
|
|
61
|
+
"context7:api-check": "bash scripts/context7-export-env.sh run bash scripts/context7-api-check.sh",
|
|
62
|
+
"wave:doctor": "bash scripts/context7-export-env.sh run pnpm exec wave doctor --json",
|
|
63
|
+
"wave:dry-run": "bash scripts/context7-export-env.sh run pnpm exec wave launch --lane main --dry-run --no-dashboard",
|
|
64
|
+
"wave:launch": "bash scripts/context7-export-env.sh run pnpm exec wave launch --lane main",
|
|
65
|
+
"wave:launch:managed": "bash scripts/wave-launch.sh",
|
|
66
|
+
"wave:status": "bash scripts/wave-status.sh",
|
|
67
|
+
"wave:watch": "bash scripts/wave-watch.sh --follow",
|
|
68
|
+
"wave:dashboard:current": "bash scripts/wave-dashboard-attach.sh current",
|
|
69
|
+
"wave:dashboard:global": "bash scripts/wave-dashboard-attach.sh global",
|
|
70
|
+
"harness:dev": "pnpm --filter @docx-react-component/react-word-editor-harness dev"
|
|
71
|
+
},
|
|
40
72
|
"keywords": [
|
|
41
73
|
"docx",
|
|
42
74
|
"word",
|
|
@@ -99,27 +131,14 @@
|
|
|
99
131
|
"tsup": "^8.3.0",
|
|
100
132
|
"tsx": "^4.21.0"
|
|
101
133
|
},
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
"lint:no-authored-js": "bash scripts/check-no-authored-js.sh",
|
|
112
|
-
"lint:tsgo": "tsgo --noEmit -p tsconfig.build.json",
|
|
113
|
-
"lint:tsgo:harness": "pnpm --filter @docx-react-component/react-word-editor-harness lint:tsgo",
|
|
114
|
-
"context7:api-check": "bash scripts/context7-export-env.sh run bash scripts/context7-api-check.sh",
|
|
115
|
-
"wave:doctor": "bash scripts/context7-export-env.sh run pnpm exec wave doctor --json",
|
|
116
|
-
"wave:dry-run": "bash scripts/context7-export-env.sh run pnpm exec wave launch --lane main --dry-run --no-dashboard",
|
|
117
|
-
"wave:launch": "bash scripts/context7-export-env.sh run pnpm exec wave launch --lane main",
|
|
118
|
-
"wave:launch:managed": "bash scripts/wave-launch.sh",
|
|
119
|
-
"wave:status": "bash scripts/wave-status.sh",
|
|
120
|
-
"wave:watch": "bash scripts/wave-watch.sh --follow",
|
|
121
|
-
"wave:dashboard:current": "bash scripts/wave-dashboard-attach.sh current",
|
|
122
|
-
"wave:dashboard:global": "bash scripts/wave-dashboard-attach.sh global",
|
|
123
|
-
"harness:dev": "pnpm --filter @docx-react-component/react-word-editor-harness dev"
|
|
134
|
+
"pnpm": {
|
|
135
|
+
"onlyBuiltDependencies": [
|
|
136
|
+
"esbuild",
|
|
137
|
+
"sharp"
|
|
138
|
+
],
|
|
139
|
+
"overrides": {
|
|
140
|
+
"react": "19.2.4",
|
|
141
|
+
"react-dom": "19.2.4"
|
|
142
|
+
}
|
|
124
143
|
}
|
|
125
144
|
}
|
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
|
}
|