@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.
- package/CHANGELOG.md +65 -0
- package/CONTRIBUTING.md +4 -0
- package/dist/docx/commentOnlyChange.d.ts +3 -1
- package/dist/docx/commentOnlyChange.js +38 -21
- package/dist/docx/comments/constants.d.ts +3 -3
- package/dist/docx/comments/constants.js +4 -3
- package/dist/docx/comments/grammar.d.ts +80 -0
- package/dist/docx/comments/grammar.js +213 -0
- package/dist/docx/comments/people.js +12 -14
- package/dist/docx/comments/reading.d.ts +5 -3
- package/dist/docx/comments/reading.js +23 -20
- package/dist/docx/comments/verifying.d.ts +44 -0
- package/dist/docx/comments/verifying.js +206 -0
- package/dist/docx/comments/writing.js +73 -46
- package/dist/docx/exportDocx.js +2 -1
- package/dist/docx/formatting/direct.js +3 -6
- package/dist/docx/headersFooters.js +8 -10
- package/dist/docx/notes.js +3 -5
- package/dist/docx/paraProps.js +51 -46
- package/dist/docx/propsXml.d.ts +20 -2
- package/dist/docx/propsXml.js +72 -32
- package/dist/docx/relationships.js +8 -3
- package/dist/docx/runProps.js +34 -34
- package/dist/docx/sdt.js +16 -14
- package/dist/docx/serializeBlock.js +1 -2
- package/dist/docx/serializeParagraph.d.ts +2 -1
- package/dist/docx/serializeParagraph.js +25 -14
- package/dist/docx/serializeTable.js +38 -24
- package/dist/docx/storyProjection.d.ts +36 -0
- package/dist/docx/storyProjection.js +23 -0
- package/dist/docx/tableFormatting/editing.js +49 -73
- package/dist/docx/tableTemplate.js +24 -3
- package/dist/docx/theme.d.ts +0 -6
- package/dist/docx/theme.js +0 -8
- package/dist/editor/clipboard/images.js +17 -3
- package/dist/editor/clipboard/inlineFormatting.d.ts +7 -0
- package/dist/editor/clipboard/inlineFormatting.js +1 -0
- package/dist/editor/commands/breakCommands.js +4 -3
- package/dist/editor/commands/canRunCommand.d.ts +2 -2
- package/dist/editor/commands/canRunCommand.js +1 -1
- package/dist/editor/commands/comments/editing.js +3 -6
- package/dist/editor/commands/historyCommands.js +2 -1
- package/dist/editor/commands/lockCommands.js +10 -1
- package/dist/editor/commands/tabCommands.js +4 -3
- package/dist/editor/createEditor.js +3 -9
- package/dist/editor/externalClipboard.js +166 -4
- package/dist/editor/insertImage.js +4 -3
- package/dist/editor/plugins/documentProtection.d.ts +3 -3
- package/dist/editor/plugins/lockedContent.d.ts +4 -4
- package/dist/editor/plugins/lockedContent.js +1 -1
- package/dist/numbering/listTemplate.js +32 -10
- package/dist/ooxml/element.d.ts +52 -0
- package/dist/ooxml/element.js +49 -0
- package/dist/ooxml/fragment.d.ts +53 -0
- package/dist/ooxml/fragment.js +76 -0
- package/dist/ooxml/image.js +4 -3
- package/dist/ooxml/names.d.ts +27 -0
- package/dist/ooxml/names.js +29 -0
- package/dist/ooxml/precedence.d.ts +31 -0
- package/dist/ooxml/precedence.js +51 -0
- package/dist/ooxml/xml.d.ts +31 -0
- package/dist/ooxml/xml.js +27 -0
- package/dist/page/blockKinds.d.ts +42 -0
- package/dist/page/blockKinds.js +0 -0
- package/dist/page/measureBlocks.d.ts +14 -1
- package/dist/page/measureBlocks.js +31 -11
- package/dist/page/pageDecorations.d.ts +16 -0
- package/dist/page/pageDecorations.js +1 -0
- package/dist/page/pageLayout.d.ts +8 -43
- package/dist/page/pageLayout.js +28 -51
- package/dist/page/tableMeasurements.d.ts +10 -2
- package/dist/page/tableMeasurements.js +20 -16
- package/dist/page/usePageLayout.d.ts +15 -0
- package/dist/page/usePageLayout.js +30 -2
- package/dist/schema/attrRoles.d.ts +35 -0
- package/dist/schema/attrRoles.js +106 -0
- package/dist/schema/docxSchema.d.ts +6 -0
- package/dist/schema/docxSchema.js +212 -101
- package/dist/schema/editGuard.d.ts +99 -0
- package/dist/schema/editGuard.js +43 -0
- package/dist/schema/guards.d.ts +68 -0
- package/dist/schema/guards.js +82 -0
- package/dist/schema/locks.d.ts +8 -35
- package/dist/schema/locks.js +29 -64
- package/dist/schema/preservedGuards.d.ts +30 -0
- package/dist/schema/preservedGuards.js +50 -0
- package/dist/schema/protection.d.ts +10 -3
- package/dist/schema/protection.js +2 -1
- package/dist/schema/sourceEquality.d.ts +27 -0
- package/dist/schema/sourceEquality.js +65 -0
- package/dist/table/cellFormatting.js +2 -1
- package/dist/table/commands.d.ts +2 -2
- package/dist/table/commands.js +1 -1
- package/dist/table/index.d.ts +2 -2
- package/dist/table/merge.d.ts +2 -2
- package/dist/table/merge.js +1 -1
- package/package.json +4 -1
- package/dist/editor/plugins/bookmarkProtection.d.ts +0 -3
- package/dist/editor/plugins/bookmarkProtection.js +0 -28
- package/dist/editor/plugins/noteProtection.d.ts +0 -3
- 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.
|
|
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,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,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
|
-
};
|