@beyondwork/docx-react-component 1.0.120 → 1.0.121
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 +1 -0
- package/dist/api/public-types.cjs +1713 -55
- package/dist/api/public-types.d.cts +2 -2
- package/dist/api/public-types.d.ts +2 -2
- package/dist/api/public-types.js +6 -6
- package/dist/api/v3.cjs +4958 -406
- package/dist/api/v3.d.cts +3 -3
- package/dist/api/v3.d.ts +3 -3
- package/dist/api/v3.js +14 -14
- package/dist/{canonical-document-fNawStsc.d.cts → canonical-document-ByIqTd4s.d.cts} +9 -1
- package/dist/{canonical-document-fNawStsc.d.ts → canonical-document-ByIqTd4s.d.ts} +9 -1
- package/dist/{chunk-5RNMPLXU.js → chunk-37SEJQ3G.js} +4 -4
- package/dist/{chunk-FXGQM2JB.js → chunk-3OFSP2IX.js} +11 -5
- package/dist/{chunk-U5BSQXF4.js → chunk-3OHVK2D6.js} +70 -12
- package/dist/{chunk-AUQDC5BD.js → chunk-3TUQCHYT.js} +101 -2
- package/dist/{chunk-SJSMYEMU.js → chunk-B4YHWFE3.js} +3 -3
- package/dist/{chunk-XC56YLIS.js → chunk-C2LWJ4CZ.js} +4 -0
- package/dist/{chunk-VDIUVT46.js → chunk-CX42VC67.js} +1 -1
- package/dist/{chunk-KCHEAX4Z.js → chunk-EMDH4IQN.js} +148 -70
- package/dist/{chunk-TMQGWF7R.js → chunk-G3B2OBCZ.js} +352 -17
- package/dist/{chunk-VCL5MJMZ.js → chunk-GON2DNTE.js} +149 -28
- package/dist/{chunk-WVZX4NYG.js → chunk-GZW2ERUO.js} +601 -47
- package/dist/{chunk-WDNEPRFW.js → chunk-ICX54W4U.js} +1 -1
- package/dist/{chunk-FIGWJ43K.js → chunk-IT2DK3A7.js} +1883 -90
- package/dist/{chunk-2ZWFQ74R.js → chunk-OBCP6VTG.js} +1 -1
- package/dist/{chunk-FLNQY74K.js → chunk-OYGMRRR7.js} +1 -1
- package/dist/{chunk-MPYYBRVN.js → chunk-PCXTMEGY.js} +782 -124
- package/dist/{chunk-4JNUMMM7.js → chunk-PGGPPZ65.js} +17 -2
- package/dist/{chunk-KHZNNBTN.js → chunk-QFU7ZOAD.js} +43 -39
- package/dist/{chunk-4ZNQFWFM.js → chunk-QIO6V46H.js} +84 -4
- package/dist/{chunk-IQ2VJEF6.js → chunk-QNGJRZ2D.js} +1 -1
- package/dist/{chunk-BM5NSDII.js → chunk-S4ANOS2M.js} +2 -2
- package/dist/{chunk-AQA7OZ2R.js → chunk-TFSXOIAI.js} +959 -43
- package/dist/{chunk-NQZUGMLW.js → chunk-TMU7JMXX.js} +184 -32
- package/dist/{chunk-KD5K5XIA.js → chunk-UHQOUTAX.js} +568 -88
- package/dist/{chunk-327AIUXL.js → chunk-UWDWGQH5.js} +11 -4
- package/dist/{chunk-BBB4GSDB.js → chunk-XVFENXLK.js} +2 -2
- package/dist/{chunk-MUEN2WOG.js → chunk-ZKSDVHGH.js} +6 -3
- package/dist/compare.cjs +17 -2
- package/dist/compare.d.cts +1 -1
- package/dist/compare.d.ts +1 -1
- package/dist/compare.js +3 -3
- package/dist/core/commands/formatting-commands.d.cts +2 -2
- package/dist/core/commands/formatting-commands.d.ts +2 -2
- package/dist/core/commands/image-commands.cjs +814 -45
- package/dist/core/commands/image-commands.d.cts +2 -2
- package/dist/core/commands/image-commands.d.ts +2 -2
- package/dist/core/commands/image-commands.js +8 -8
- package/dist/core/commands/section-layout-commands.d.cts +2 -2
- package/dist/core/commands/section-layout-commands.d.ts +2 -2
- package/dist/core/commands/style-commands.d.cts +2 -2
- package/dist/core/commands/style-commands.d.ts +2 -2
- package/dist/core/commands/table-structure-commands.cjs +750 -42
- package/dist/core/commands/table-structure-commands.d.cts +2 -2
- package/dist/core/commands/table-structure-commands.d.ts +2 -2
- package/dist/core/commands/table-structure-commands.js +6 -6
- package/dist/core/commands/text-commands.cjs +910 -57
- package/dist/core/commands/text-commands.d.cts +2 -2
- package/dist/core/commands/text-commands.d.ts +2 -2
- package/dist/core/commands/text-commands.js +8 -8
- package/dist/core/selection/mapping.d.cts +2 -2
- package/dist/core/selection/mapping.d.ts +2 -2
- package/dist/core/state/editor-state.cjs +17 -2
- package/dist/core/state/editor-state.d.cts +2 -2
- package/dist/core/state/editor-state.d.ts +2 -2
- package/dist/core/state/editor-state.js +2 -2
- package/dist/index.cjs +6203 -625
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +299 -67
- package/dist/io/docx-session.cjs +354 -102
- package/dist/io/docx-session.d.cts +4 -4
- package/dist/io/docx-session.d.ts +4 -4
- package/dist/io/docx-session.js +5 -5
- package/dist/legal.cjs +183 -31
- package/dist/legal.d.cts +1 -1
- package/dist/legal.d.ts +1 -1
- package/dist/legal.js +3 -3
- package/dist/{loader-CaohrhNl.d.ts → loader-BF8ju_LK.d.ts} +22 -4
- package/dist/{loader-BpCyGnZl.d.cts → loader-g54WRvj1.d.cts} +22 -4
- package/dist/{public-types-Dpch9JG0.d.cts → public-types-D_y4Ptcj.d.cts} +747 -21
- package/dist/{public-types-C948HNVF.d.ts → public-types-Dl1jiWjk.d.ts} +747 -21
- package/dist/public-types.cjs +1713 -55
- package/dist/public-types.d.cts +2 -2
- package/dist/public-types.d.ts +2 -2
- package/dist/public-types.js +6 -6
- package/dist/runtime/collab.cjs +4 -0
- package/dist/runtime/collab.d.cts +3 -3
- package/dist/runtime/collab.d.ts +3 -3
- package/dist/runtime/collab.js +2 -2
- package/dist/runtime/document-runtime.cjs +3699 -507
- package/dist/runtime/document-runtime.d.cts +2 -2
- package/dist/runtime/document-runtime.d.ts +2 -2
- package/dist/runtime/document-runtime.js +18 -18
- package/dist/{session-Dqg17V3s.d.ts → session-C1EPAkcI.d.ts} +3 -3
- package/dist/{session-BlXE5zxz.d.cts → session-D15QOO0Q.d.cts} +3 -3
- package/dist/session.cjs +951 -104
- package/dist/session.d.cts +5 -5
- package/dist/session.d.ts +5 -5
- package/dist/session.js +10 -8
- package/dist/tailwind.cjs +1752 -91
- package/dist/tailwind.d.cts +2 -2
- package/dist/tailwind.d.ts +2 -2
- package/dist/tailwind.js +10 -10
- package/dist/{types-C9vZVpKy.d.cts → types-BoSRp2Vg.d.cts} +2 -2
- package/dist/{types-B1tlF1bq.d.ts → types-DEvRwq9C.d.ts} +2 -2
- package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +3 -3
- package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +3 -3
- package/dist/ui-tailwind/editor-surface/search-plugin.js +7 -7
- package/dist/ui-tailwind/theme/editor-theme.css +5 -5
- package/dist/ui-tailwind.cjs +1752 -91
- package/dist/ui-tailwind.d.cts +8 -8
- package/dist/ui-tailwind.d.ts +8 -8
- package/dist/ui-tailwind.js +10 -10
- package/package.json +17 -5
- package/dist/ui-tailwind/theme/tokens.css +0 -382
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import { R as RevisionStoryTargetRecord, O as OpaqueFragmentRecord } from '../canonical-document-
|
|
3
|
-
import { a$ as EditorAnchorProjection } from '../public-types-
|
|
4
|
-
import '../types-
|
|
1
|
+
export { b as LoadDocxEditorSessionAsyncOptions, c as LoadDocxEditorSessionOptions, L as LoadedDocxEditorSession, l as loadDocxEditorSessionAsync } from '../loader-g54WRvj1.cjs';
|
|
2
|
+
import { R as RevisionStoryTargetRecord, O as OpaqueFragmentRecord } from '../canonical-document-ByIqTd4s.cjs';
|
|
3
|
+
import { a$ as EditorAnchorProjection } from '../public-types-D_y4Ptcj.cjs';
|
|
4
|
+
import '../types-BoSRp2Vg.cjs';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'yjs';
|
|
7
7
|
import 'y-protocols/awareness';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import { R as RevisionStoryTargetRecord, O as OpaqueFragmentRecord } from '../canonical-document-
|
|
3
|
-
import { a$ as EditorAnchorProjection } from '../public-types-
|
|
4
|
-
import '../types-
|
|
1
|
+
export { b as LoadDocxEditorSessionAsyncOptions, c as LoadDocxEditorSessionOptions, L as LoadedDocxEditorSession, l as loadDocxEditorSessionAsync } from '../loader-BF8ju_LK.js';
|
|
2
|
+
import { R as RevisionStoryTargetRecord, O as OpaqueFragmentRecord } from '../canonical-document-ByIqTd4s.js';
|
|
3
|
+
import { a$ as EditorAnchorProjection } from '../public-types-Dl1jiWjk.js';
|
|
4
|
+
import '../types-DEvRwq9C.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'yjs';
|
|
7
7
|
import 'y-protocols/awareness';
|
package/dist/io/docx-session.js
CHANGED
|
@@ -2,18 +2,18 @@ import {
|
|
|
2
2
|
loadDocxSessionAsync,
|
|
3
3
|
normalizeImportedCommentThreads,
|
|
4
4
|
stripCommentMarkup
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-EMDH4IQN.js";
|
|
6
|
+
import "../chunk-UWDWGQH5.js";
|
|
7
|
+
import "../chunk-TMU7JMXX.js";
|
|
8
8
|
import "../chunk-4BJ6K26R.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-TFSXOIAI.js";
|
|
10
10
|
import "../chunk-OL2UEHRP.js";
|
|
11
11
|
import "../chunk-EB6M3GE6.js";
|
|
12
12
|
import "../chunk-IHE7YOAY.js";
|
|
13
13
|
import "../chunk-MT37IIGN.js";
|
|
14
14
|
import "../chunk-UTL65BUI.js";
|
|
15
15
|
import "../chunk-UFVDIR2C.js";
|
|
16
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-PGGPPZ65.js";
|
|
17
17
|
import "../chunk-DNXYUIIS.js";
|
|
18
18
|
import "../chunk-M2HUK3KF.js";
|
|
19
19
|
export {
|
package/dist/legal.cjs
CHANGED
|
@@ -1017,6 +1017,7 @@ var SCOPE_MARKER_BOOKMARK_PREFIX = "bw:scope:";
|
|
|
1017
1017
|
// src/io/ooxml/parse-bookmark-references.ts
|
|
1018
1018
|
var HYPERLINK_ANCHOR_RE = /<(?:\w+:)?hyperlink\b[^>]*\bw:anchor\s*=\s*"([^"]*)"/gi;
|
|
1019
1019
|
var INSTR_TEXT_RE = /<(?:\w+:)?instrText\b[^>]*>([\s\S]*?)<\/(?:\w+:)?instrText>/gi;
|
|
1020
|
+
var SIMPLE_FIELD_INSTR_RE = /<(?:\w+:)?fldSimple\b[^>]*\bw:instr\s*=\s*"([^"]*)"/gi;
|
|
1020
1021
|
var TOC_FIELD_RE = /\bTOC\b/;
|
|
1021
1022
|
var REFLIKE_FIELD_RE = /\b(?:HYPERLINK|REF|PAGEREF|NOTEREF)\s+([A-Za-z0-9_:.\-]+)/g;
|
|
1022
1023
|
var DATA_BINDING_RE = /<(?:\w+:)?dataBinding\b/i;
|
|
@@ -1035,12 +1036,14 @@ function scanBookmarkReferences(documentXml, callerAllowlist = []) {
|
|
|
1035
1036
|
}
|
|
1036
1037
|
INSTR_TEXT_RE.lastIndex = 0;
|
|
1037
1038
|
while ((m = INSTR_TEXT_RE.exec(documentXml)) !== null) {
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1039
|
+
if (scanInstructionForRetainedBookmarks(m[1] ?? "", retained)) {
|
|
1040
|
+
retainAllToc = true;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
SIMPLE_FIELD_INSTR_RE.lastIndex = 0;
|
|
1044
|
+
while ((m = SIMPLE_FIELD_INSTR_RE.exec(documentXml)) !== null) {
|
|
1045
|
+
if (scanInstructionForRetainedBookmarks(m[1] ?? "", retained)) {
|
|
1046
|
+
retainAllToc = true;
|
|
1044
1047
|
}
|
|
1045
1048
|
}
|
|
1046
1049
|
retainRevisionBoundedBookmarks(documentXml, retained);
|
|
@@ -1050,6 +1053,15 @@ function scanBookmarkReferences(documentXml, callerAllowlist = []) {
|
|
|
1050
1053
|
retainAll
|
|
1051
1054
|
};
|
|
1052
1055
|
}
|
|
1056
|
+
function scanInstructionForRetainedBookmarks(instruction, retained) {
|
|
1057
|
+
const hasTocField = TOC_FIELD_RE.test(instruction);
|
|
1058
|
+
REFLIKE_FIELD_RE.lastIndex = 0;
|
|
1059
|
+
let r;
|
|
1060
|
+
while ((r = REFLIKE_FIELD_RE.exec(instruction)) !== null) {
|
|
1061
|
+
if (r[1]) retained.add(r[1]);
|
|
1062
|
+
}
|
|
1063
|
+
return hasTocField;
|
|
1064
|
+
}
|
|
1053
1065
|
function retainRevisionBoundedBookmarks(documentXml, retained) {
|
|
1054
1066
|
const starts = /* @__PURE__ */ new Map();
|
|
1055
1067
|
BOOKMARK_START_RE.lastIndex = 0;
|
|
@@ -3851,7 +3863,7 @@ var SAFE_TABLE_FIELD_FAMILIES = /* @__PURE__ */ new Set([
|
|
|
3851
3863
|
"FORMULA"
|
|
3852
3864
|
]);
|
|
3853
3865
|
var RISKY_TABLE_MARKUP_RE = /<w:(ins|del|moveFrom|moveTo|rPrChange|pPrChange|tblPrChange|trPrChange|tcPrChange|sectPrChange|cellIns|cellDel|cellMerge|smartTag)\b/;
|
|
3854
|
-
var
|
|
3866
|
+
var SIMPLE_FIELD_INSTR_RE2 = /\bw:instr="([^"]*)"/g;
|
|
3855
3867
|
var COMPLEX_FIELD_TOKEN_RE = /<(?:\w+:)?fldChar\b[^>]*?(?:\w+:)?fldCharType="(begin|separate|end)"[^>]*?(?:\/>|>[\s\S]*?<\/(?:\w+:)?fldChar>)|<(?:\w+:)?instrText\b[^>]*>([\s\S]*?)<\/(?:\w+:)?instrText>/gu;
|
|
3856
3868
|
function decodeXmlEntities2(text) {
|
|
3857
3869
|
return text.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
@@ -3892,7 +3904,7 @@ function isSafeTableFieldInstruction(instruction) {
|
|
|
3892
3904
|
}
|
|
3893
3905
|
function tableRequiresOpaquePreservation(rawXml) {
|
|
3894
3906
|
if (RISKY_TABLE_MARKUP_RE.test(rawXml)) return true;
|
|
3895
|
-
const simpleInstructions = [...rawXml.matchAll(
|
|
3907
|
+
const simpleInstructions = [...rawXml.matchAll(SIMPLE_FIELD_INSTR_RE2)].map(
|
|
3896
3908
|
(match) => match[1] ?? ""
|
|
3897
3909
|
);
|
|
3898
3910
|
const complexInstructions = extractComplexFieldInstructionsFromRaw(rawXml);
|
|
@@ -4572,7 +4584,11 @@ function parseMainDocumentXmlInner(xml, relationships, mediaParts, sourcePartPat
|
|
|
4572
4584
|
const documentElement = findChildElement(root, "document");
|
|
4573
4585
|
const bodyElement = findChildElement(documentElement, "body");
|
|
4574
4586
|
const relationshipMap = new Map(relationships.map((relationship) => [relationship.id, relationship]));
|
|
4575
|
-
const allBlocks =
|
|
4587
|
+
const allBlocks = mapElementChildrenWithXmlPath(
|
|
4588
|
+
bodyElement,
|
|
4589
|
+
"/document[1]/body[1]",
|
|
4590
|
+
(node, xmlPath) => parseBodyChild(node, xml, relationshipMap, relationships, mediaParts, sourcePartPath, 0, xmlPath)
|
|
4591
|
+
).filter((block) => !(block.type === "opaque_block" && block.rawXml === ""));
|
|
4576
4592
|
let finalSectionProperties;
|
|
4577
4593
|
const blocks = [];
|
|
4578
4594
|
for (let i = 0; i < allBlocks.length; i++) {
|
|
@@ -4662,22 +4678,25 @@ function parseBlockStreamFromXml(xml, ctx) {
|
|
|
4662
4678
|
const priorDepth = activeTxbxBlockStreamDepth;
|
|
4663
4679
|
activeTxbxBlockStreamDepth = depth;
|
|
4664
4680
|
try {
|
|
4665
|
-
return
|
|
4666
|
-
|
|
4681
|
+
return mapElementChildrenWithXmlPath(
|
|
4682
|
+
wrapper,
|
|
4683
|
+
`/${localName(wrapper.name)}[1]`,
|
|
4684
|
+
(n, xmlPath) => parseBodyChild(
|
|
4667
4685
|
n,
|
|
4668
4686
|
xml,
|
|
4669
4687
|
relationshipMap,
|
|
4670
4688
|
ctx.relationships,
|
|
4671
4689
|
ctx.mediaParts,
|
|
4672
4690
|
ctx.sourcePartPath,
|
|
4673
|
-
depth
|
|
4691
|
+
depth,
|
|
4692
|
+
xmlPath
|
|
4674
4693
|
)
|
|
4675
4694
|
);
|
|
4676
4695
|
} finally {
|
|
4677
4696
|
activeTxbxBlockStreamDepth = priorDepth;
|
|
4678
4697
|
}
|
|
4679
4698
|
}
|
|
4680
|
-
function parseBodyChild(node, sourceXml, relationshipMap, relationships, mediaParts, sourcePartPath, _depth = 0) {
|
|
4699
|
+
function parseBodyChild(node, sourceXml, relationshipMap, relationships, mediaParts, sourcePartPath, _depth = 0, sourceXmlPath = `/${localName(node.name)}[1]`) {
|
|
4681
4700
|
const nodeType = localName(node.name);
|
|
4682
4701
|
if (nodeType === "tbl") {
|
|
4683
4702
|
const rawTableXml = sourceXml.slice(node.start, node.end);
|
|
@@ -4688,7 +4707,15 @@ function parseBodyChild(node, sourceXml, relationshipMap, relationships, mediaPa
|
|
|
4688
4707
|
};
|
|
4689
4708
|
}
|
|
4690
4709
|
try {
|
|
4691
|
-
return parseTableElement(
|
|
4710
|
+
return parseTableElement(
|
|
4711
|
+
node,
|
|
4712
|
+
sourceXml,
|
|
4713
|
+
relationshipMap,
|
|
4714
|
+
relationships,
|
|
4715
|
+
mediaParts,
|
|
4716
|
+
sourcePartPath,
|
|
4717
|
+
sourceXmlPath
|
|
4718
|
+
);
|
|
4692
4719
|
} catch {
|
|
4693
4720
|
return {
|
|
4694
4721
|
type: "opaque_block",
|
|
@@ -4697,10 +4724,26 @@ function parseBodyChild(node, sourceXml, relationshipMap, relationships, mediaPa
|
|
|
4697
4724
|
}
|
|
4698
4725
|
}
|
|
4699
4726
|
if (nodeType === "sdt") {
|
|
4700
|
-
return parseSdtElement(
|
|
4727
|
+
return parseSdtElement(
|
|
4728
|
+
node,
|
|
4729
|
+
sourceXml,
|
|
4730
|
+
relationshipMap,
|
|
4731
|
+
relationships,
|
|
4732
|
+
mediaParts,
|
|
4733
|
+
sourcePartPath,
|
|
4734
|
+
sourceXmlPath
|
|
4735
|
+
);
|
|
4701
4736
|
}
|
|
4702
4737
|
if (nodeType === "customXml") {
|
|
4703
|
-
return parseCustomXmlElement(
|
|
4738
|
+
return parseCustomXmlElement(
|
|
4739
|
+
node,
|
|
4740
|
+
sourceXml,
|
|
4741
|
+
relationshipMap,
|
|
4742
|
+
relationships,
|
|
4743
|
+
mediaParts,
|
|
4744
|
+
sourcePartPath,
|
|
4745
|
+
sourceXmlPath
|
|
4746
|
+
);
|
|
4704
4747
|
}
|
|
4705
4748
|
if (nodeType === "altChunk") {
|
|
4706
4749
|
return parseAltChunkElement(node, sourceXml);
|
|
@@ -4846,6 +4889,7 @@ function parseBodyChild(node, sourceXml, relationshipMap, relationships, mediaPa
|
|
|
4846
4889
|
type: "bookmark_start",
|
|
4847
4890
|
bookmarkId: bkId,
|
|
4848
4891
|
name: bkName,
|
|
4892
|
+
sourceRef: createElementSourceRef(sourcePartPath, "bookmarkStart", child),
|
|
4849
4893
|
rawXml: sourceXml.slice(child.start, child.end)
|
|
4850
4894
|
};
|
|
4851
4895
|
flushActiveComplexField(children, () => {
|
|
@@ -4873,6 +4917,7 @@ function parseBodyChild(node, sourceXml, relationshipMap, relationships, mediaPa
|
|
|
4873
4917
|
const bookmarkNode = {
|
|
4874
4918
|
type: "bookmark_end",
|
|
4875
4919
|
bookmarkId: bkEndId,
|
|
4920
|
+
sourceRef: createElementSourceRef(sourcePartPath, "bookmarkEnd", child),
|
|
4876
4921
|
rawXml: sourceXml.slice(child.start, child.end)
|
|
4877
4922
|
};
|
|
4878
4923
|
flushActiveComplexField(children, () => {
|
|
@@ -5080,7 +5125,7 @@ function flushActiveComplexField(children, reset, activeComplexField) {
|
|
|
5080
5125
|
});
|
|
5081
5126
|
reset();
|
|
5082
5127
|
}
|
|
5083
|
-
function parseTableElement(node, sourceXml, relationshipMap, relationships, mediaParts, sourcePartPath) {
|
|
5128
|
+
function parseTableElement(node, sourceXml, relationshipMap, relationships, mediaParts, sourcePartPath, sourceXmlPath) {
|
|
5084
5129
|
let styleId;
|
|
5085
5130
|
let tblLook;
|
|
5086
5131
|
let propertiesXml;
|
|
@@ -5124,13 +5169,24 @@ function parseTableElement(node, sourceXml, relationshipMap, relationships, medi
|
|
|
5124
5169
|
break;
|
|
5125
5170
|
}
|
|
5126
5171
|
case "tr": {
|
|
5127
|
-
rows.push(
|
|
5172
|
+
rows.push(
|
|
5173
|
+
parseTableRowElement(
|
|
5174
|
+
child,
|
|
5175
|
+
sourceXml,
|
|
5176
|
+
relationshipMap,
|
|
5177
|
+
relationships,
|
|
5178
|
+
mediaParts,
|
|
5179
|
+
sourcePartPath,
|
|
5180
|
+
`${sourceXmlPath}/tr[${rows.length + 1}]`
|
|
5181
|
+
)
|
|
5182
|
+
);
|
|
5128
5183
|
break;
|
|
5129
5184
|
}
|
|
5130
5185
|
}
|
|
5131
5186
|
}
|
|
5132
5187
|
return {
|
|
5133
5188
|
type: "table",
|
|
5189
|
+
sourceRef: createStableTableSourceRef(sourcePartPath, "tbl", sourceXmlPath),
|
|
5134
5190
|
...styleId ? { styleId } : {},
|
|
5135
5191
|
...tblLook ? { tblLook } : {},
|
|
5136
5192
|
...propertiesXml ? { propertiesXml } : {},
|
|
@@ -5151,7 +5207,7 @@ function parseTableElement(node, sourceXml, relationshipMap, relationships, medi
|
|
|
5151
5207
|
rawXml: sourceXml.slice(node.start, node.end)
|
|
5152
5208
|
};
|
|
5153
5209
|
}
|
|
5154
|
-
function parseTableRowElement(node, sourceXml, relationshipMap, relationships, mediaParts, sourcePartPath) {
|
|
5210
|
+
function parseTableRowElement(node, sourceXml, relationshipMap, relationships, mediaParts, sourcePartPath, sourceXmlPath) {
|
|
5155
5211
|
let propertiesXml;
|
|
5156
5212
|
let unknownPropertyChildren;
|
|
5157
5213
|
let gridBefore;
|
|
@@ -5183,12 +5239,23 @@ function parseTableRowElement(node, sourceXml, relationshipMap, relationships, m
|
|
|
5183
5239
|
cnfStyle = readRowCnfStyle2(child);
|
|
5184
5240
|
break;
|
|
5185
5241
|
case "tc":
|
|
5186
|
-
cells.push(
|
|
5242
|
+
cells.push(
|
|
5243
|
+
parseTableCellElement(
|
|
5244
|
+
child,
|
|
5245
|
+
sourceXml,
|
|
5246
|
+
relationshipMap,
|
|
5247
|
+
relationships,
|
|
5248
|
+
mediaParts,
|
|
5249
|
+
sourcePartPath,
|
|
5250
|
+
`${sourceXmlPath}/tc[${cells.length + 1}]`
|
|
5251
|
+
)
|
|
5252
|
+
);
|
|
5187
5253
|
break;
|
|
5188
5254
|
}
|
|
5189
5255
|
}
|
|
5190
5256
|
return {
|
|
5191
5257
|
type: "table_row",
|
|
5258
|
+
sourceRef: createStableTableSourceRef(sourcePartPath, "tr", sourceXmlPath),
|
|
5192
5259
|
...propertiesXml ? { propertiesXml } : {},
|
|
5193
5260
|
...unknownPropertyChildren ? { unknownPropertyChildren } : {},
|
|
5194
5261
|
...gridBefore !== void 0 ? { gridBefore } : {},
|
|
@@ -5205,7 +5272,7 @@ function parseTableRowElement(node, sourceXml, relationshipMap, relationships, m
|
|
|
5205
5272
|
rawXml: sourceXml.slice(node.start, node.end)
|
|
5206
5273
|
};
|
|
5207
5274
|
}
|
|
5208
|
-
function parseTableCellElement(node, sourceXml, relationshipMap, relationships, mediaParts, sourcePartPath) {
|
|
5275
|
+
function parseTableCellElement(node, sourceXml, relationshipMap, relationships, mediaParts, sourcePartPath, sourceXmlPath) {
|
|
5209
5276
|
let propertiesXml;
|
|
5210
5277
|
let unknownPropertyChildren;
|
|
5211
5278
|
let gridSpan;
|
|
@@ -5240,13 +5307,27 @@ function parseTableCellElement(node, sourceXml, relationshipMap, relationships,
|
|
|
5240
5307
|
break;
|
|
5241
5308
|
}
|
|
5242
5309
|
default: {
|
|
5243
|
-
children.push(
|
|
5310
|
+
children.push(
|
|
5311
|
+
parseBodyChild(
|
|
5312
|
+
child,
|
|
5313
|
+
sourceXml,
|
|
5314
|
+
relationshipMap,
|
|
5315
|
+
relationships,
|
|
5316
|
+
mediaParts,
|
|
5317
|
+
sourcePartPath,
|
|
5318
|
+
0,
|
|
5319
|
+
`${sourceXmlPath}/${localName(child.name)}[${countPriorElementSiblingsByName(node, child) + 1}]`
|
|
5320
|
+
)
|
|
5321
|
+
);
|
|
5244
5322
|
break;
|
|
5245
5323
|
}
|
|
5246
5324
|
}
|
|
5247
5325
|
}
|
|
5248
5326
|
return {
|
|
5249
5327
|
type: "table_cell",
|
|
5328
|
+
sourceRef: createStableTableSourceRef(sourcePartPath, "tc", sourceXmlPath, {
|
|
5329
|
+
tableCellPath: sourceXmlPath
|
|
5330
|
+
}),
|
|
5250
5331
|
...propertiesXml ? { propertiesXml } : {},
|
|
5251
5332
|
...unknownPropertyChildren ? { unknownPropertyChildren } : {},
|
|
5252
5333
|
...gridSpan ? { gridSpan } : {},
|
|
@@ -5264,7 +5345,7 @@ function parseTableCellElement(node, sourceXml, relationshipMap, relationships,
|
|
|
5264
5345
|
rawXml: sourceXml.slice(node.start, node.end)
|
|
5265
5346
|
};
|
|
5266
5347
|
}
|
|
5267
|
-
function parseSdtElement(node, sourceXml, relationshipMap, relationships, mediaParts, sourcePartPath) {
|
|
5348
|
+
function parseSdtElement(node, sourceXml, relationshipMap, relationships, mediaParts, sourcePartPath, sourceXmlPath) {
|
|
5268
5349
|
const propertiesNode = node.children.find(
|
|
5269
5350
|
(child) => child.type === "element" && localName(child.name) === "sdtPr"
|
|
5270
5351
|
);
|
|
@@ -5277,7 +5358,20 @@ function parseSdtElement(node, sourceXml, relationshipMap, relationships, mediaP
|
|
|
5277
5358
|
rawXml: sourceXml.slice(node.start, node.end)
|
|
5278
5359
|
};
|
|
5279
5360
|
}
|
|
5280
|
-
const children =
|
|
5361
|
+
const children = mapElementChildrenWithXmlPath(
|
|
5362
|
+
contentNode,
|
|
5363
|
+
`${sourceXmlPath}/sdtContent[1]`,
|
|
5364
|
+
(child, childXmlPath) => parseBodyChild(
|
|
5365
|
+
child,
|
|
5366
|
+
sourceXml,
|
|
5367
|
+
relationshipMap,
|
|
5368
|
+
relationships,
|
|
5369
|
+
mediaParts,
|
|
5370
|
+
sourcePartPath,
|
|
5371
|
+
0,
|
|
5372
|
+
childXmlPath
|
|
5373
|
+
)
|
|
5374
|
+
);
|
|
5281
5375
|
return {
|
|
5282
5376
|
type: "sdt",
|
|
5283
5377
|
sourceRef: createElementSourceRef(sourcePartPath, "sdt", node),
|
|
@@ -5286,7 +5380,7 @@ function parseSdtElement(node, sourceXml, relationshipMap, relationships, mediaP
|
|
|
5286
5380
|
rawXml: sourceXml.slice(node.start, node.end)
|
|
5287
5381
|
};
|
|
5288
5382
|
}
|
|
5289
|
-
function parseCustomXmlElement(node, sourceXml, relationshipMap, relationships, mediaParts, sourcePartPath) {
|
|
5383
|
+
function parseCustomXmlElement(node, sourceXml, relationshipMap, relationships, mediaParts, sourcePartPath, sourceXmlPath) {
|
|
5290
5384
|
const uri = readOptionalAttribute2(node, "uri");
|
|
5291
5385
|
const element = readOptionalAttribute2(node, "element");
|
|
5292
5386
|
if (!uri && !element) {
|
|
@@ -5295,9 +5389,20 @@ function parseCustomXmlElement(node, sourceXml, relationshipMap, relationships,
|
|
|
5295
5389
|
rawXml: sourceXml.slice(node.start, node.end)
|
|
5296
5390
|
};
|
|
5297
5391
|
}
|
|
5298
|
-
const children =
|
|
5299
|
-
|
|
5300
|
-
|
|
5392
|
+
const children = mapElementChildrenWithXmlPath(
|
|
5393
|
+
node,
|
|
5394
|
+
sourceXmlPath,
|
|
5395
|
+
(child, childXmlPath) => localName(child.name) === "customXmlPr" ? void 0 : parseBodyChild(
|
|
5396
|
+
child,
|
|
5397
|
+
sourceXml,
|
|
5398
|
+
relationshipMap,
|
|
5399
|
+
relationships,
|
|
5400
|
+
mediaParts,
|
|
5401
|
+
sourcePartPath,
|
|
5402
|
+
0,
|
|
5403
|
+
childXmlPath
|
|
5404
|
+
)
|
|
5405
|
+
).filter((child) => child !== void 0);
|
|
5301
5406
|
return {
|
|
5302
5407
|
type: "custom_xml",
|
|
5303
5408
|
...uri ? { uri } : {},
|
|
@@ -5829,6 +5934,43 @@ function createElementSourceRef(partPath, element, node) {
|
|
|
5829
5934
|
endOffset: node.end
|
|
5830
5935
|
};
|
|
5831
5936
|
}
|
|
5937
|
+
function createStableTableSourceRef(partPath, element, xmlPath, extras = {}) {
|
|
5938
|
+
return {
|
|
5939
|
+
sourceId: `part:${partPath}#${xmlPath}`,
|
|
5940
|
+
partPath,
|
|
5941
|
+
storyKind: storyKindFromPartPath(partPath),
|
|
5942
|
+
element,
|
|
5943
|
+
xmlPath,
|
|
5944
|
+
...extras
|
|
5945
|
+
};
|
|
5946
|
+
}
|
|
5947
|
+
function mapElementChildrenWithXmlPath(parent, parentXmlPath, mapChild) {
|
|
5948
|
+
const ordinals = /* @__PURE__ */ new Map();
|
|
5949
|
+
const mapped = [];
|
|
5950
|
+
for (const child of parent.children) {
|
|
5951
|
+
if (child.type !== "element") {
|
|
5952
|
+
continue;
|
|
5953
|
+
}
|
|
5954
|
+
const name = localName(child.name);
|
|
5955
|
+
const ordinal = (ordinals.get(name) ?? 0) + 1;
|
|
5956
|
+
ordinals.set(name, ordinal);
|
|
5957
|
+
mapped.push(mapChild(child, `${parentXmlPath}/${name}[${ordinal}]`));
|
|
5958
|
+
}
|
|
5959
|
+
return mapped;
|
|
5960
|
+
}
|
|
5961
|
+
function countPriorElementSiblingsByName(parent, target) {
|
|
5962
|
+
const name = localName(target.name);
|
|
5963
|
+
let count = 0;
|
|
5964
|
+
for (const child of parent.children) {
|
|
5965
|
+
if (child === target) {
|
|
5966
|
+
return count;
|
|
5967
|
+
}
|
|
5968
|
+
if (child.type === "element" && localName(child.name) === name) {
|
|
5969
|
+
count += 1;
|
|
5970
|
+
}
|
|
5971
|
+
}
|
|
5972
|
+
return count;
|
|
5973
|
+
}
|
|
5832
5974
|
function createFieldSequenceSourceRef(partPath, node) {
|
|
5833
5975
|
activeFieldSequenceOrdinal += 1;
|
|
5834
5976
|
return {
|
|
@@ -5930,7 +6072,10 @@ function parseRun(node, sourceXml, relationships, mediaParts, sourcePartPath) {
|
|
|
5930
6072
|
})
|
|
5931
6073
|
});
|
|
5932
6074
|
if (frame) {
|
|
5933
|
-
result.push(
|
|
6075
|
+
result.push({
|
|
6076
|
+
...frame,
|
|
6077
|
+
sourceRef: createElementSourceRef(sourcePartPath, "drawing", child)
|
|
6078
|
+
});
|
|
5934
6079
|
break;
|
|
5935
6080
|
}
|
|
5936
6081
|
} catch {
|
|
@@ -5979,6 +6124,7 @@ function parseRun(node, sourceXml, relationships, mediaParts, sourcePartPath) {
|
|
|
5979
6124
|
...parsedMedia.map((media) => ({
|
|
5980
6125
|
type: "image",
|
|
5981
6126
|
mediaId: media.mediaId,
|
|
6127
|
+
sourceRef: createElementSourceRef(sourcePartPath, "drawing", child),
|
|
5982
6128
|
relationshipId: media.relationshipId,
|
|
5983
6129
|
packagePartName: media.packagePartName,
|
|
5984
6130
|
contentType: media.contentType,
|
|
@@ -6009,7 +6155,10 @@ function parseRun(node, sourceXml, relationships, mediaParts, sourcePartPath) {
|
|
|
6009
6155
|
})
|
|
6010
6156
|
});
|
|
6011
6157
|
if (frame) {
|
|
6012
|
-
result.push(
|
|
6158
|
+
result.push({
|
|
6159
|
+
...frame,
|
|
6160
|
+
sourceRef: createElementSourceRef(sourcePartPath, "AlternateContent", child)
|
|
6161
|
+
});
|
|
6013
6162
|
break;
|
|
6014
6163
|
}
|
|
6015
6164
|
} catch {
|
|
@@ -6046,7 +6195,10 @@ function parseRun(node, sourceXml, relationships, mediaParts, sourcePartPath) {
|
|
|
6046
6195
|
try {
|
|
6047
6196
|
const oleNode = parseObject(child, objectXml, relationships);
|
|
6048
6197
|
if (oleNode) {
|
|
6049
|
-
result.push(
|
|
6198
|
+
result.push({
|
|
6199
|
+
...oleNode,
|
|
6200
|
+
sourceRef: createElementSourceRef(sourcePartPath, "object", child)
|
|
6201
|
+
});
|
|
6050
6202
|
break;
|
|
6051
6203
|
}
|
|
6052
6204
|
} catch {
|
package/dist/legal.d.cts
CHANGED
package/dist/legal.d.ts
CHANGED
package/dist/legal.js
CHANGED
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
isHiddenBookmarkName,
|
|
5
5
|
parseBookmarksFromDocumentXml,
|
|
6
6
|
resolveWalkableRoot
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-OBCP6VTG.js";
|
|
8
8
|
import {
|
|
9
9
|
extractComplexFieldsFromBodyXml,
|
|
10
10
|
parseFieldsFromParagraphXml,
|
|
11
11
|
parseMainDocumentXml
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-TMU7JMXX.js";
|
|
13
|
+
import "./chunk-TFSXOIAI.js";
|
|
14
14
|
import "./chunk-IHE7YOAY.js";
|
|
15
15
|
import "./chunk-UTL65BUI.js";
|
|
16
16
|
import "./chunk-DNXYUIIS.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as CanonicalDocument } from './canonical-document-
|
|
2
|
-
import { ar as EditorStateNamespace, as as EditorStateLocation, a as EditorSessionState, P as PersistedEditorSnapshot, r as EditorError, t as ProtectionSnapshot, b as ExportDocxOptions, c as ExportResult, L as LoadStage, E as EditorHostAdapter, at as LoadScheduler, o as EditorSurfaceSnapshot } from './public-types-
|
|
3
|
-
import { E as EmbeddedDocumentManifest, e as ProgressiveSurfaceProjector } from './types-
|
|
1
|
+
import { C as CanonicalDocument } from './canonical-document-ByIqTd4s.js';
|
|
2
|
+
import { ar as EditorStateNamespace, as as EditorStateLocation, a as EditorSessionState, P as PersistedEditorSnapshot, r as EditorError, t as ProtectionSnapshot, b as ExportDocxOptions, c as ExportResult, L as LoadStage, E as EditorHostAdapter, at as LoadScheduler, o as EditorSurfaceSnapshot } from './public-types-Dl1jiWjk.js';
|
|
3
|
+
import { E as EmbeddedDocumentManifest, e as ProgressiveSurfaceProjector } from './types-DEvRwq9C.js';
|
|
4
4
|
|
|
5
5
|
interface EditorStatePayloadNamespaceEntry {
|
|
6
6
|
namespace: EditorStateNamespace;
|
|
@@ -271,5 +271,23 @@ interface LoadedDocxEditorSession {
|
|
|
271
271
|
* `src/session/export/stateful-export.ts` and is imported directly.
|
|
272
272
|
*/
|
|
273
273
|
declare function loadDocxSessionAsync(options: LoadDocxEditorSessionAsyncOptions): Promise<LoadedDocxEditorSession>;
|
|
274
|
+
/**
|
|
275
|
+
* Session-layer owner of the sync load path.
|
|
276
|
+
*
|
|
277
|
+
* Slice 5e-7.e.2 relocates the body of `loadDocxEditorSession` from
|
|
278
|
+
* `src/io/docx-session.ts` into this module. Body mirrors
|
|
279
|
+
* `loadDocxSessionAsync` minus the async-only orchestration shell:
|
|
280
|
+
* - No `scheduler.yield()` calls (sync execution).
|
|
281
|
+
* - No laycache short-circuit branch (`laycacheEnvelope` is not on
|
|
282
|
+
* `LoadDocxEditorSessionOptions`).
|
|
283
|
+
* - No progressive-snapshot branch (`onProgressiveSnapshot` /
|
|
284
|
+
* `surfaceProjector` not on `LoadDocxEditorSessionOptions`).
|
|
285
|
+
* - Uses `normalizeParsedTextDocument` (sync).
|
|
286
|
+
*
|
|
287
|
+
* Byte-equivalence with the async path is asserted by
|
|
288
|
+
* `test/io/fastload-parity.test.ts` on every F*.docx fixture. Drift
|
|
289
|
+
* between the two sync/async bodies will fail that test.
|
|
290
|
+
*/
|
|
291
|
+
declare function loadDocxSessionSync(options: LoadDocxEditorSessionOptions): LoadedDocxEditorSession;
|
|
274
292
|
|
|
275
|
-
export { type LoadedDocxEditorSession as L, type LoadDocxEditorSessionAsyncOptions as
|
|
293
|
+
export { type LoadedDocxEditorSession as L, loadDocxSessionSync as a, type LoadDocxEditorSessionAsyncOptions as b, type LoadDocxEditorSessionOptions as c, loadDocxSessionAsync as l };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as CanonicalDocument } from './canonical-document-
|
|
2
|
-
import { ar as EditorStateNamespace, as as EditorStateLocation, a as EditorSessionState, P as PersistedEditorSnapshot, r as EditorError, t as ProtectionSnapshot, b as ExportDocxOptions, c as ExportResult, L as LoadStage, E as EditorHostAdapter, at as LoadScheduler, o as EditorSurfaceSnapshot } from './public-types-
|
|
3
|
-
import { E as EmbeddedDocumentManifest, e as ProgressiveSurfaceProjector } from './types-
|
|
1
|
+
import { C as CanonicalDocument } from './canonical-document-ByIqTd4s.cjs';
|
|
2
|
+
import { ar as EditorStateNamespace, as as EditorStateLocation, a as EditorSessionState, P as PersistedEditorSnapshot, r as EditorError, t as ProtectionSnapshot, b as ExportDocxOptions, c as ExportResult, L as LoadStage, E as EditorHostAdapter, at as LoadScheduler, o as EditorSurfaceSnapshot } from './public-types-D_y4Ptcj.cjs';
|
|
3
|
+
import { E as EmbeddedDocumentManifest, e as ProgressiveSurfaceProjector } from './types-BoSRp2Vg.cjs';
|
|
4
4
|
|
|
5
5
|
interface EditorStatePayloadNamespaceEntry {
|
|
6
6
|
namespace: EditorStateNamespace;
|
|
@@ -271,5 +271,23 @@ interface LoadedDocxEditorSession {
|
|
|
271
271
|
* `src/session/export/stateful-export.ts` and is imported directly.
|
|
272
272
|
*/
|
|
273
273
|
declare function loadDocxSessionAsync(options: LoadDocxEditorSessionAsyncOptions): Promise<LoadedDocxEditorSession>;
|
|
274
|
+
/**
|
|
275
|
+
* Session-layer owner of the sync load path.
|
|
276
|
+
*
|
|
277
|
+
* Slice 5e-7.e.2 relocates the body of `loadDocxEditorSession` from
|
|
278
|
+
* `src/io/docx-session.ts` into this module. Body mirrors
|
|
279
|
+
* `loadDocxSessionAsync` minus the async-only orchestration shell:
|
|
280
|
+
* - No `scheduler.yield()` calls (sync execution).
|
|
281
|
+
* - No laycache short-circuit branch (`laycacheEnvelope` is not on
|
|
282
|
+
* `LoadDocxEditorSessionOptions`).
|
|
283
|
+
* - No progressive-snapshot branch (`onProgressiveSnapshot` /
|
|
284
|
+
* `surfaceProjector` not on `LoadDocxEditorSessionOptions`).
|
|
285
|
+
* - Uses `normalizeParsedTextDocument` (sync).
|
|
286
|
+
*
|
|
287
|
+
* Byte-equivalence with the async path is asserted by
|
|
288
|
+
* `test/io/fastload-parity.test.ts` on every F*.docx fixture. Drift
|
|
289
|
+
* between the two sync/async bodies will fail that test.
|
|
290
|
+
*/
|
|
291
|
+
declare function loadDocxSessionSync(options: LoadDocxEditorSessionOptions): LoadedDocxEditorSession;
|
|
274
292
|
|
|
275
|
-
export { type LoadedDocxEditorSession as L, type LoadDocxEditorSessionAsyncOptions as
|
|
293
|
+
export { type LoadedDocxEditorSession as L, loadDocxSessionSync as a, type LoadDocxEditorSessionAsyncOptions as b, type LoadDocxEditorSessionOptions as c, loadDocxSessionAsync as l };
|