@portone/docx-editor 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/CONTRIBUTING.md +4 -0
  3. package/dist/docx/commentOnlyChange.d.ts +3 -1
  4. package/dist/docx/commentOnlyChange.js +38 -21
  5. package/dist/docx/comments/constants.d.ts +3 -3
  6. package/dist/docx/comments/constants.js +4 -3
  7. package/dist/docx/comments/grammar.d.ts +80 -0
  8. package/dist/docx/comments/grammar.js +213 -0
  9. package/dist/docx/comments/people.js +12 -14
  10. package/dist/docx/comments/reading.d.ts +5 -3
  11. package/dist/docx/comments/reading.js +23 -20
  12. package/dist/docx/comments/verifying.d.ts +44 -0
  13. package/dist/docx/comments/verifying.js +206 -0
  14. package/dist/docx/comments/writing.js +73 -46
  15. package/dist/docx/exportDocx.js +2 -1
  16. package/dist/docx/formatting/direct.js +3 -6
  17. package/dist/docx/headersFooters.js +8 -10
  18. package/dist/docx/notes.js +3 -5
  19. package/dist/docx/paraProps.js +51 -46
  20. package/dist/docx/propsXml.d.ts +20 -2
  21. package/dist/docx/propsXml.js +72 -32
  22. package/dist/docx/relationships.js +8 -3
  23. package/dist/docx/runProps.js +34 -34
  24. package/dist/docx/sdt.js +16 -14
  25. package/dist/docx/serializeBlock.js +1 -2
  26. package/dist/docx/serializeParagraph.d.ts +2 -1
  27. package/dist/docx/serializeParagraph.js +25 -14
  28. package/dist/docx/serializeTable.js +38 -24
  29. package/dist/docx/storyProjection.d.ts +36 -0
  30. package/dist/docx/storyProjection.js +23 -0
  31. package/dist/docx/tableFormatting/editing.js +49 -73
  32. package/dist/docx/tableTemplate.js +24 -3
  33. package/dist/docx/theme.d.ts +0 -6
  34. package/dist/docx/theme.js +0 -8
  35. package/dist/editor/clipboard/images.js +17 -3
  36. package/dist/editor/clipboard/inlineFormatting.d.ts +7 -0
  37. package/dist/editor/clipboard/inlineFormatting.js +1 -0
  38. package/dist/editor/commands/breakCommands.js +4 -3
  39. package/dist/editor/commands/canRunCommand.d.ts +2 -2
  40. package/dist/editor/commands/canRunCommand.js +1 -1
  41. package/dist/editor/commands/comments/editing.js +3 -6
  42. package/dist/editor/commands/historyCommands.js +2 -1
  43. package/dist/editor/commands/lockCommands.js +10 -1
  44. package/dist/editor/commands/tabCommands.js +4 -3
  45. package/dist/editor/createEditor.js +3 -9
  46. package/dist/editor/externalClipboard.js +166 -4
  47. package/dist/editor/insertImage.js +4 -3
  48. package/dist/editor/plugins/documentProtection.d.ts +3 -3
  49. package/dist/editor/plugins/lockedContent.d.ts +4 -4
  50. package/dist/editor/plugins/lockedContent.js +1 -1
  51. package/dist/numbering/listTemplate.js +32 -10
  52. package/dist/ooxml/element.d.ts +52 -0
  53. package/dist/ooxml/element.js +49 -0
  54. package/dist/ooxml/fragment.d.ts +53 -0
  55. package/dist/ooxml/fragment.js +76 -0
  56. package/dist/ooxml/image.js +4 -3
  57. package/dist/ooxml/names.d.ts +27 -0
  58. package/dist/ooxml/names.js +29 -0
  59. package/dist/ooxml/precedence.d.ts +31 -0
  60. package/dist/ooxml/precedence.js +51 -0
  61. package/dist/ooxml/xml.d.ts +31 -0
  62. package/dist/ooxml/xml.js +27 -0
  63. package/dist/page/blockKinds.d.ts +42 -0
  64. package/dist/page/blockKinds.js +0 -0
  65. package/dist/page/measureBlocks.d.ts +14 -1
  66. package/dist/page/measureBlocks.js +31 -11
  67. package/dist/page/pageDecorations.d.ts +16 -0
  68. package/dist/page/pageDecorations.js +1 -0
  69. package/dist/page/pageLayout.d.ts +8 -43
  70. package/dist/page/pageLayout.js +28 -51
  71. package/dist/page/tableMeasurements.d.ts +10 -2
  72. package/dist/page/tableMeasurements.js +20 -16
  73. package/dist/page/usePageLayout.d.ts +15 -0
  74. package/dist/page/usePageLayout.js +30 -2
  75. package/dist/schema/attrRoles.d.ts +35 -0
  76. package/dist/schema/attrRoles.js +106 -0
  77. package/dist/schema/docxSchema.d.ts +6 -0
  78. package/dist/schema/docxSchema.js +212 -101
  79. package/dist/schema/editGuard.d.ts +99 -0
  80. package/dist/schema/editGuard.js +43 -0
  81. package/dist/schema/guards.d.ts +68 -0
  82. package/dist/schema/guards.js +82 -0
  83. package/dist/schema/locks.d.ts +8 -35
  84. package/dist/schema/locks.js +29 -64
  85. package/dist/schema/preservedGuards.d.ts +30 -0
  86. package/dist/schema/preservedGuards.js +50 -0
  87. package/dist/schema/protection.d.ts +10 -3
  88. package/dist/schema/protection.js +2 -1
  89. package/dist/schema/sourceEquality.d.ts +27 -0
  90. package/dist/schema/sourceEquality.js +65 -0
  91. package/dist/table/cellFormatting.js +2 -1
  92. package/dist/table/commands.d.ts +2 -2
  93. package/dist/table/commands.js +1 -1
  94. package/dist/table/index.d.ts +2 -2
  95. package/dist/table/merge.d.ts +2 -2
  96. package/dist/table/merge.js +1 -1
  97. package/package.json +4 -1
  98. package/dist/editor/plugins/bookmarkProtection.d.ts +0 -3
  99. package/dist/editor/plugins/bookmarkProtection.js +0 -28
  100. package/dist/editor/plugins/noteProtection.d.ts +0 -3
  101. package/dist/editor/plugins/noteProtection.js +0 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portone/docx-editor",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "A simple DOCX editor for React, built directly on OOXML.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -76,7 +76,9 @@
76
76
  "@biomejs/biome": "2.5.10",
77
77
  "@changesets/changelog-github": "^1.0.0",
78
78
  "@changesets/cli": "^3.0.1",
79
+ "@microsoft/api-extractor": "7.59.0",
79
80
  "@playwright/test": "^1.62.1",
81
+ "@types/jsdom": "^30.0.0",
80
82
  "@types/node": "^26.2.0",
81
83
  "@types/react": "19.2.18",
82
84
  "@types/react-dom": "19.2.5",
@@ -111,6 +113,7 @@
111
113
  "test": "vitest run",
112
114
  "test:package": "vitest run --dir packaging --no-file-parallelism",
113
115
  "verify:package": "node scripts/verify-package.mjs",
116
+ "api:update": "pnpm build && node scripts/api-report.mjs --local",
114
117
  "spec": "node scripts/index-ooxml-spec.mjs",
115
118
  "changeset": "changeset",
116
119
  "changeset:version": "changeset version",
@@ -1,3 +0,0 @@
1
- /** Prevents ordinary editor transactions from dropping imported bookmark range markers. */
2
- import { Plugin } from "prosemirror-state";
3
- export declare function bookmarkProtection(): Plugin;
@@ -1,28 +0,0 @@
1
- // src/editor/plugins/bookmarkProtection.ts
2
- import { Plugin } from "prosemirror-state";
3
- var BOOKMARK_XML = /<(?:[\w.-]+:)?bookmark(?:Start|End)\b/;
4
- function signatures(doc) {
5
- const found = [];
6
- doc.descendants((node) => {
7
- if (node.type.name === "bookmarkBlock") {
8
- found.push(`block:${node.attrs.srcId}:${node.attrs.name}`);
9
- } else if (node.type.name === "rawInline" && typeof node.attrs.xml === "string" && BOOKMARK_XML.test(node.attrs.xml)) {
10
- found.push(`inline:${node.attrs.xml}`);
11
- }
12
- return true;
13
- });
14
- return found;
15
- }
16
- function same(a, b) {
17
- return a.length === b.length && a.every((value, index) => value === b[index]);
18
- }
19
- function bookmarkProtection() {
20
- return new Plugin({
21
- filterTransaction(transaction, state) {
22
- return !transaction.docChanged || same(signatures(state.doc), signatures(transaction.doc));
23
- }
24
- });
25
- }
26
- export {
27
- bookmarkProtection
28
- };
@@ -1,3 +0,0 @@
1
- /** Keeps imported footnote and endnote references intact while their bodies are display-only. */
2
- import { Plugin } from "prosemirror-state";
3
- export declare function noteProtection(): Plugin;
@@ -1,25 +0,0 @@
1
- // src/editor/plugins/noteProtection.ts
2
- import { Plugin } from "prosemirror-state";
3
- function signatures(doc) {
4
- const found = [];
5
- doc.descendants((node) => {
6
- if (node.type.name === "noteReference") {
7
- found.push(JSON.stringify(node.attrs));
8
- }
9
- return true;
10
- });
11
- return found;
12
- }
13
- function same(a, b) {
14
- return a.length === b.length && a.every((value, index) => value === b[index]);
15
- }
16
- function noteProtection() {
17
- return new Plugin({
18
- filterTransaction(transaction, state) {
19
- return !transaction.docChanged || same(signatures(state.doc), signatures(transaction.doc));
20
- }
21
- });
22
- }
23
- export {
24
- noteProtection
25
- };