@harbour-enterprises/superdoc 1.0.0-beta.40 → 1.0.0-beta.54
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/dist/chunks/{PdfViewer-B5MRM8r_.es.js → PdfViewer-D_U-y4Wi.es.js} +1 -1
- package/dist/chunks/{PdfViewer-IpSRU3o0.cjs → PdfViewer-qBKjClah.cjs} +1 -1
- package/dist/chunks/{index-B9PZ8RCF.cjs → index-BKvAeQdF.cjs} +3 -3
- package/dist/chunks/{index-Dx9W6Dsv-D4FIlgW4.cjs → index-t8thQIOL-CV8VTGI4.cjs} +1 -1
- package/dist/chunks/{index-Dx9W6Dsv-DbYj9Ur7.es.js → index-t8thQIOL-vW80ABaR.es.js} +1 -1
- package/dist/chunks/{index-CJeY9b_E.es.js → index-to6_YLa7.es.js} +3 -3
- package/dist/chunks/{super-editor.es-C7wUYMFI.cjs → super-editor.es-BMiadG4G.cjs} +510 -180
- package/dist/chunks/{super-editor.es-CGmPt3mY.es.js → super-editor.es-xpC1DWhM.es.js} +510 -180
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-D6IUdu7s.js → converter-OoT4LYwQ.js} +294 -79
- package/dist/super-editor/chunks/{docx-zipper-C1WNNxUr.js → docx-zipper-Cf_hIcjC.js} +15 -11
- package/dist/super-editor/chunks/{editor-DNmem5Gg.js → editor-CqbtudGQ.js} +204 -93
- package/dist/super-editor/chunks/{index-Dx9W6Dsv.js → index-t8thQIOL.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-CHc2RUXU.js → toolbar-BsfRAJ0o.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +512 -182
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -18031,7 +18031,7 @@ const attrConfig$r = Object.freeze({
|
|
|
18031
18031
|
encode: encode$Q,
|
|
18032
18032
|
decode: decode$S
|
|
18033
18033
|
});
|
|
18034
|
-
const validXmlAttributes$
|
|
18034
|
+
const validXmlAttributes$h = [attrConfig$s, attrConfig$r];
|
|
18035
18035
|
const XML_NODE_NAME$q = "w:br";
|
|
18036
18036
|
const SD_NODE_NAME$k = "lineBreak";
|
|
18037
18037
|
const encode$P = (_2, encodedAttrs) => {
|
|
@@ -18067,7 +18067,7 @@ const config$p = {
|
|
|
18067
18067
|
type: NodeTranslator.translatorTypes.NODE,
|
|
18068
18068
|
encode: encode$P,
|
|
18069
18069
|
decode: decode$R,
|
|
18070
|
-
attributes: validXmlAttributes$
|
|
18070
|
+
attributes: validXmlAttributes$h
|
|
18071
18071
|
};
|
|
18072
18072
|
const translator$23 = NodeTranslator.from(config$p);
|
|
18073
18073
|
const encode$O = (attributes) => attributes?.["w:val"];
|
|
@@ -18078,7 +18078,7 @@ const attrConfig$q = Object.freeze({
|
|
|
18078
18078
|
encode: encode$O,
|
|
18079
18079
|
decode: decode$Q
|
|
18080
18080
|
});
|
|
18081
|
-
const validXmlAttributes$
|
|
18081
|
+
const validXmlAttributes$g = [attrConfig$q];
|
|
18082
18082
|
const XML_NODE_NAME$p = "w:highlight";
|
|
18083
18083
|
const SD_ATTR_KEY$4 = "highlight";
|
|
18084
18084
|
const DISABLED_TOKENS = /* @__PURE__ */ new Set(["transparent", "none", "inherit"]);
|
|
@@ -18129,7 +18129,7 @@ const config$o = {
|
|
|
18129
18129
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
18130
18130
|
encode: encode$N,
|
|
18131
18131
|
decode: decode$P,
|
|
18132
|
-
attributes: validXmlAttributes$
|
|
18132
|
+
attributes: validXmlAttributes$g
|
|
18133
18133
|
};
|
|
18134
18134
|
const translator$22 = NodeTranslator.from(config$o);
|
|
18135
18135
|
const encode$M = (attributes) => {
|
|
@@ -18172,7 +18172,7 @@ const attrConfig$n = Object.freeze({
|
|
|
18172
18172
|
encode: encode$K,
|
|
18173
18173
|
decode: decode$M
|
|
18174
18174
|
});
|
|
18175
|
-
const validXmlAttributes$
|
|
18175
|
+
const validXmlAttributes$f = [attrConfig$p, attrConfig$n, attrConfig$o];
|
|
18176
18176
|
const XML_NODE_NAME$o = "w:tab";
|
|
18177
18177
|
const SD_NODE_NAME$j = "tab";
|
|
18178
18178
|
const encode$J = (_2, encodedAttrs = {}) => {
|
|
@@ -18208,7 +18208,7 @@ const config$n = {
|
|
|
18208
18208
|
type: NodeTranslator.translatorTypes.NODE,
|
|
18209
18209
|
encode: encode$J,
|
|
18210
18210
|
decode: decode$L,
|
|
18211
|
-
attributes: validXmlAttributes$
|
|
18211
|
+
attributes: validXmlAttributes$f
|
|
18212
18212
|
};
|
|
18213
18213
|
const translator$21 = NodeTranslator.from(config$n);
|
|
18214
18214
|
const carbonCopy = (obj) => {
|
|
@@ -18579,7 +18579,7 @@ const attrConfig$i = Object.freeze({
|
|
|
18579
18579
|
encode: encode$E,
|
|
18580
18580
|
decode: decode$G
|
|
18581
18581
|
});
|
|
18582
|
-
const validXmlAttributes$
|
|
18582
|
+
const validXmlAttributes$e = [attrConfig$m, attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
|
|
18583
18583
|
const XML_NODE_NAME$n = "w:u";
|
|
18584
18584
|
const SD_ATTR_KEY$3 = "underline";
|
|
18585
18585
|
const encode$D = (params, encodedAttrs = {}) => {
|
|
@@ -18631,7 +18631,7 @@ const config$m = {
|
|
|
18631
18631
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
18632
18632
|
encode: encode$D,
|
|
18633
18633
|
decode: decode$F,
|
|
18634
|
-
attributes: validXmlAttributes$
|
|
18634
|
+
attributes: validXmlAttributes$e
|
|
18635
18635
|
};
|
|
18636
18636
|
const translator$1Z = NodeTranslator.from(config$m);
|
|
18637
18637
|
const translator$1Y = NodeTranslator.from(createSingleBooleanPropertyHandler("w:strike"));
|
|
@@ -18765,7 +18765,7 @@ const SUPPORTED_ALTERNATE_CONTENT_REQUIRES = /* @__PURE__ */ new Set([
|
|
|
18765
18765
|
]);
|
|
18766
18766
|
const XML_NODE_NAME$m = "mc:AlternateContent";
|
|
18767
18767
|
const SD_NODE_NAME$i = [];
|
|
18768
|
-
const validXmlAttributes$
|
|
18768
|
+
const validXmlAttributes$d = [];
|
|
18769
18769
|
function encode$C(params) {
|
|
18770
18770
|
const { nodeListHandler } = params;
|
|
18771
18771
|
const { node } = params.extraParams;
|
|
@@ -18805,7 +18805,7 @@ const config$l = {
|
|
|
18805
18805
|
type: NodeTranslator.translatorTypes.NODE,
|
|
18806
18806
|
encode: encode$C,
|
|
18807
18807
|
decode: decode$E,
|
|
18808
|
-
attributes: validXmlAttributes$
|
|
18808
|
+
attributes: validXmlAttributes$d
|
|
18809
18809
|
};
|
|
18810
18810
|
function selectAlternateContentElements(node) {
|
|
18811
18811
|
if (!node?.elements?.length) {
|
|
@@ -18945,7 +18945,7 @@ const createTrackStyleMark = (marks) => {
|
|
|
18945
18945
|
};
|
|
18946
18946
|
const XML_NODE_NAME$l = "w:ins";
|
|
18947
18947
|
const SD_ATTR_KEY$2 = "trackInsert";
|
|
18948
|
-
const validXmlAttributes$
|
|
18948
|
+
const validXmlAttributes$c = [
|
|
18949
18949
|
createAttributeHandler("w:id", "id"),
|
|
18950
18950
|
createAttributeHandler("w:date", "date"),
|
|
18951
18951
|
createAttributeHandler("w:author", "author"),
|
|
@@ -19005,7 +19005,7 @@ const config$k = {
|
|
|
19005
19005
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
19006
19006
|
encode: encode$B,
|
|
19007
19007
|
decode: decode$D,
|
|
19008
|
-
attributes: validXmlAttributes$
|
|
19008
|
+
attributes: validXmlAttributes$c
|
|
19009
19009
|
};
|
|
19010
19010
|
const translator$1w = NodeTranslator.from(config$k);
|
|
19011
19011
|
const translator$1v = NodeTranslator.from(createSingleIntegerPropertyHandler("w:numId"));
|
|
@@ -19199,11 +19199,12 @@ const resolveRunProperties = (params, inlineRpr, resolvedPpr, isListNumber = fal
|
|
|
19199
19199
|
}
|
|
19200
19200
|
if (isListNumber) {
|
|
19201
19201
|
let numberingProps = {};
|
|
19202
|
-
|
|
19202
|
+
const numId = resolvedPpr?.numberingProperties?.numId;
|
|
19203
|
+
if (numId != null && numId !== 0 && numId !== "0") {
|
|
19203
19204
|
numberingProps = getNumberingProperties(
|
|
19204
19205
|
params,
|
|
19205
19206
|
resolvedPpr.numberingProperties.ilvl ?? 0,
|
|
19206
|
-
|
|
19207
|
+
numId,
|
|
19207
19208
|
translator$1N
|
|
19208
19209
|
);
|
|
19209
19210
|
}
|
|
@@ -19241,9 +19242,13 @@ function resolveParagraphProperties(params, inlineProps, insideTable = false, ov
|
|
|
19241
19242
|
let styleProps = inlineProps?.styleId ? resolveStyleChain(params, inlineProps?.styleId, translator$12) : {};
|
|
19242
19243
|
let numberingProps = {};
|
|
19243
19244
|
let ilvl = inlineProps?.numberingProperties?.ilvl ?? styleProps?.numberingProperties?.ilvl;
|
|
19244
|
-
|
|
19245
|
+
let numId = inlineProps?.numberingProperties?.numId ?? styleProps?.numberingProperties?.numId;
|
|
19245
19246
|
let numberingDefinedInline = inlineProps?.numberingProperties?.numId != null;
|
|
19246
|
-
const
|
|
19247
|
+
const inlineNumIdDisablesNumbering = inlineProps?.numberingProperties?.numId === 0 || inlineProps?.numberingProperties?.numId === "0";
|
|
19248
|
+
if (inlineNumIdDisablesNumbering) {
|
|
19249
|
+
numId = null;
|
|
19250
|
+
}
|
|
19251
|
+
const isList2 = numId != null && numId !== 0 && numId !== "0";
|
|
19247
19252
|
if (isList2) {
|
|
19248
19253
|
ilvl = ilvl != null ? ilvl : 0;
|
|
19249
19254
|
numberingProps = getNumberingProperties(params, ilvl, numId, translator$12);
|
|
@@ -20384,7 +20389,7 @@ const attrConfig$b = Object.freeze({
|
|
|
20384
20389
|
encode: encode$u,
|
|
20385
20390
|
decode: decode$w
|
|
20386
20391
|
});
|
|
20387
|
-
const validXmlAttributes$
|
|
20392
|
+
const validXmlAttributes$b = [
|
|
20388
20393
|
attrConfig$c,
|
|
20389
20394
|
attrConfig$b,
|
|
20390
20395
|
attrConfig$f,
|
|
@@ -20417,7 +20422,7 @@ const config$j = {
|
|
|
20417
20422
|
type: NodeTranslator.translatorTypes.NODE,
|
|
20418
20423
|
encode: encode$t,
|
|
20419
20424
|
decode: decode$v,
|
|
20420
|
-
attributes: validXmlAttributes$
|
|
20425
|
+
attributes: validXmlAttributes$b
|
|
20421
20426
|
};
|
|
20422
20427
|
const translator$11 = NodeTranslator.from(config$j);
|
|
20423
20428
|
const EAST_ASIAN_CHARACTER_REGEX = /[\u1100-\u11FF\u2E80-\u2EFF\u2F00-\u2FDF\u3040-\u30FF\u3100-\u312F\u3130-\u318F\u31A0-\u31BF\u3400-\u4DBF\u4E00-\u9FFF\uA960-\uA97F\uAC00-\uD7AF\uF900-\uFAFF\uFF00-\uFFEF]/u;
|
|
@@ -20600,7 +20605,7 @@ const _createAttributeHandler = (xmlName, sdName) => ({
|
|
|
20600
20605
|
encode: (attributes) => attributes[xmlName],
|
|
20601
20606
|
decode: (attributes) => attributes[sdName]
|
|
20602
20607
|
});
|
|
20603
|
-
const validXmlAttributes$
|
|
20608
|
+
const validXmlAttributes$a = [
|
|
20604
20609
|
_createAttributeHandler("w:anchor", "anchor"),
|
|
20605
20610
|
_createAttributeHandler("w:docLocation", "docLocation"),
|
|
20606
20611
|
{
|
|
@@ -20702,7 +20707,7 @@ const config$i = {
|
|
|
20702
20707
|
type: NodeTranslator.translatorTypes.NODE,
|
|
20703
20708
|
encode: encode$s,
|
|
20704
20709
|
decode: decode$u,
|
|
20705
|
-
attributes: validXmlAttributes$
|
|
20710
|
+
attributes: validXmlAttributes$a
|
|
20706
20711
|
};
|
|
20707
20712
|
const translator$10 = NodeTranslator.from(config$i);
|
|
20708
20713
|
const encode$r = (attributes) => {
|
|
@@ -20741,7 +20746,7 @@ const attrConfig$8 = Object.freeze({
|
|
|
20741
20746
|
encode: encode$p,
|
|
20742
20747
|
decode: decode$r
|
|
20743
20748
|
});
|
|
20744
|
-
const validXmlAttributes$
|
|
20749
|
+
const validXmlAttributes$9 = [attrConfig$a, attrConfig$9, attrConfig$8];
|
|
20745
20750
|
const XML_NODE_NAME$i = "w:r";
|
|
20746
20751
|
const SD_KEY_NAME = "run";
|
|
20747
20752
|
const encode$o = (params, encodedAttrs = {}) => {
|
|
@@ -20888,7 +20893,7 @@ const config$h = {
|
|
|
20888
20893
|
type: NodeTranslator.translatorTypes.NODE,
|
|
20889
20894
|
encode: encode$o,
|
|
20890
20895
|
decode: decode$q,
|
|
20891
|
-
attributes: validXmlAttributes$
|
|
20896
|
+
attributes: validXmlAttributes$9
|
|
20892
20897
|
};
|
|
20893
20898
|
const translator$$ = NodeTranslator.from(config$h);
|
|
20894
20899
|
const translator$_ = NodeTranslator.from(createMeasurementPropertyHandler("w:tcW", "cellWidth"));
|
|
@@ -21318,7 +21323,7 @@ function generateTableCellProperties(node) {
|
|
|
21318
21323
|
}
|
|
21319
21324
|
const XML_NODE_NAME$h = "w:tc";
|
|
21320
21325
|
const SD_NODE_NAME$f = "tableCell";
|
|
21321
|
-
const validXmlAttributes$
|
|
21326
|
+
const validXmlAttributes$8 = [];
|
|
21322
21327
|
function encode$n(params, encodedAttrs) {
|
|
21323
21328
|
const {
|
|
21324
21329
|
node,
|
|
@@ -21359,7 +21364,7 @@ const config$g = {
|
|
|
21359
21364
|
type: NodeTranslator.translatorTypes.NODE,
|
|
21360
21365
|
encode: encode$n,
|
|
21361
21366
|
decode: decode$p,
|
|
21362
|
-
attributes: validXmlAttributes$
|
|
21367
|
+
attributes: validXmlAttributes$8
|
|
21363
21368
|
};
|
|
21364
21369
|
const translator$G = NodeTranslator.from(config$g);
|
|
21365
21370
|
const translator$F = NodeTranslator.from({
|
|
@@ -21513,7 +21518,7 @@ const isPlaceholderCell = (cell) => {
|
|
|
21513
21518
|
};
|
|
21514
21519
|
const XML_NODE_NAME$g = "w:tr";
|
|
21515
21520
|
const SD_NODE_NAME$e = "tableRow";
|
|
21516
|
-
const validXmlAttributes$
|
|
21521
|
+
const validXmlAttributes$7 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
|
|
21517
21522
|
(xmlName) => createAttributeHandler(xmlName)
|
|
21518
21523
|
);
|
|
21519
21524
|
const encode$m = (params, encodedAttrs) => {
|
|
@@ -21650,7 +21655,7 @@ const config$f = {
|
|
|
21650
21655
|
type: NodeTranslator.translatorTypes.NODE,
|
|
21651
21656
|
encode: encode$m,
|
|
21652
21657
|
decode: decode$o,
|
|
21653
|
-
attributes: validXmlAttributes$
|
|
21658
|
+
attributes: validXmlAttributes$7
|
|
21654
21659
|
};
|
|
21655
21660
|
const translator$v = NodeTranslator.from(config$f);
|
|
21656
21661
|
function parseTagValueJSON(json) {
|
|
@@ -30429,6 +30434,7 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
30429
30434
|
if (!node) return null;
|
|
30430
30435
|
const { docx, filename, converter } = params;
|
|
30431
30436
|
const attributes = node?.attributes || {};
|
|
30437
|
+
const { order, originalChildren } = collectPreservedDrawingChildren(node);
|
|
30432
30438
|
const padding = {
|
|
30433
30439
|
top: emuToPixels(attributes?.["distT"]),
|
|
30434
30440
|
bottom: emuToPixels(attributes?.["distB"]),
|
|
@@ -30624,6 +30630,7 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
30624
30630
|
}
|
|
30625
30631
|
const wrapValue = wrap2;
|
|
30626
30632
|
const nodeAttrs = {
|
|
30633
|
+
// originalXml: carbonCopy(node),
|
|
30627
30634
|
src: finalSrc,
|
|
30628
30635
|
alt: isMetafileExtension(extension) && !wasConverted ? "Unable to render EMF/WMF image" : docPr?.attributes?.name || "Image",
|
|
30629
30636
|
extension: finalExtension,
|
|
@@ -30658,7 +30665,9 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
30658
30665
|
distR: attributes["distR"]
|
|
30659
30666
|
},
|
|
30660
30667
|
originalAttributes: node.attributes,
|
|
30661
|
-
rId: relAttributes["Id"]
|
|
30668
|
+
rId: relAttributes["Id"],
|
|
30669
|
+
...order.length ? { drawingChildOrder: order } : {},
|
|
30670
|
+
...originalChildren.length ? { originalDrawingChildren: originalChildren } : {}
|
|
30662
30671
|
};
|
|
30663
30672
|
return {
|
|
30664
30673
|
type: "image",
|
|
@@ -30683,6 +30692,23 @@ const handleShapeDrawing = (params, node, graphicData, size, padding, marginOffs
|
|
|
30683
30692
|
const fallbackType = textBoxContent ? "textbox" : "drawing";
|
|
30684
30693
|
return buildShapePlaceholder(node, size, padding, marginOffset, fallbackType);
|
|
30685
30694
|
};
|
|
30695
|
+
function collectPreservedDrawingChildren(node) {
|
|
30696
|
+
const order = [];
|
|
30697
|
+
const original = [];
|
|
30698
|
+
if (!Array.isArray(node?.elements)) {
|
|
30699
|
+
return { order, originalChildren: original };
|
|
30700
|
+
}
|
|
30701
|
+
node.elements.forEach((child, index2) => {
|
|
30702
|
+
if (!child) return;
|
|
30703
|
+
const name = child.name ?? null;
|
|
30704
|
+
order.push(name);
|
|
30705
|
+
original.push({
|
|
30706
|
+
index: index2,
|
|
30707
|
+
xml: carbonCopy(child)
|
|
30708
|
+
});
|
|
30709
|
+
});
|
|
30710
|
+
return { order, originalChildren: original };
|
|
30711
|
+
}
|
|
30686
30712
|
const handleShapeGroup = (params, node, graphicData, size, padding, marginOffset, anchorData, wrap2) => {
|
|
30687
30713
|
const wgp = graphicData.elements.find((el) => el.name === "wpg:wgp");
|
|
30688
30714
|
if (!wgp) {
|
|
@@ -33451,7 +33477,7 @@ function updateNumberingProperties(newNumberingProperties, paragraphNode, pos, e
|
|
|
33451
33477
|
}
|
|
33452
33478
|
tr.setNodeMarkup(pos, null, newAttrs);
|
|
33453
33479
|
}
|
|
33454
|
-
const generateNewListDefinition = ({ numId, listType, level, start, text, fmt, editor }) => {
|
|
33480
|
+
const generateNewListDefinition = ({ numId, listType, level, start, text, fmt, editor, markerFontFamily }) => {
|
|
33455
33481
|
if (typeof listType !== "string") listType = listType.name;
|
|
33456
33482
|
const definition = listType === "orderedList" ? baseOrderedListDef : baseBulletList;
|
|
33457
33483
|
const numbering = editor.converter.numbering;
|
|
@@ -33505,6 +33531,29 @@ const generateNewListDefinition = ({ numId, listType, level, start, text, fmt, e
|
|
|
33505
33531
|
}
|
|
33506
33532
|
}
|
|
33507
33533
|
];
|
|
33534
|
+
if (markerFontFamily) {
|
|
33535
|
+
const rPrIndex = levelProps.elements.findIndex((el) => el.name === "w:rPr");
|
|
33536
|
+
let rPr = levelProps.elements[rPrIndex];
|
|
33537
|
+
if (!rPr) {
|
|
33538
|
+
rPr = {
|
|
33539
|
+
type: "element",
|
|
33540
|
+
name: "w:rPr",
|
|
33541
|
+
elements: []
|
|
33542
|
+
};
|
|
33543
|
+
levelProps.elements.push(rPr);
|
|
33544
|
+
}
|
|
33545
|
+
rPr.elements = rPr.elements.filter((el) => el.name !== "w:rFonts");
|
|
33546
|
+
rPr.elements.push({
|
|
33547
|
+
type: "element",
|
|
33548
|
+
name: "w:rFonts",
|
|
33549
|
+
attributes: {
|
|
33550
|
+
"w:ascii": markerFontFamily,
|
|
33551
|
+
"w:hAnsi": markerFontFamily,
|
|
33552
|
+
"w:eastAsia": markerFontFamily,
|
|
33553
|
+
"w:cs": markerFontFamily
|
|
33554
|
+
}
|
|
33555
|
+
});
|
|
33556
|
+
}
|
|
33508
33557
|
}
|
|
33509
33558
|
if (!skipAddingNewAbstract) newNumbering.abstracts[newAbstractId] = newAbstractDef;
|
|
33510
33559
|
const newNumDef = getBasicNumIdTag(numId, newAbstractId);
|
|
@@ -33771,8 +33820,8 @@ const extractListLevelStyles = (cssText, listId, level, numId) => {
|
|
|
33771
33820
|
}
|
|
33772
33821
|
return styleMap;
|
|
33773
33822
|
};
|
|
33774
|
-
const extractParagraphStyles = (cssText,
|
|
33775
|
-
const pattern = new RegExp(
|
|
33823
|
+
const extractParagraphStyles = (cssText, selector) => {
|
|
33824
|
+
const pattern = new RegExp(`(${selector})\\s*\\{([^}]+)\\}`, "i");
|
|
33776
33825
|
const match = cssText.match(pattern);
|
|
33777
33826
|
if (!match) return null;
|
|
33778
33827
|
const rawStyles = match[2].split(";").map((line) => line.trim()).filter(Boolean);
|
|
@@ -33887,7 +33936,7 @@ const handleDocxPaste = (html, editor, view) => {
|
|
|
33887
33936
|
cleanedHtml = cleanHtmlUnnecessaryTags(cleanedHtml);
|
|
33888
33937
|
const tempDiv = document.createElement("div");
|
|
33889
33938
|
tempDiv.innerHTML = cleanedHtml;
|
|
33890
|
-
const data = tempDiv.querySelectorAll("p, li");
|
|
33939
|
+
const data = tempDiv.querySelectorAll("p, li, " + [1, 2, 3, 4, 5, 6, 7, 8, 9].map((n) => `h${n}`).join(", "));
|
|
33891
33940
|
const startMap = {};
|
|
33892
33941
|
data.forEach((item) => {
|
|
33893
33942
|
let type2;
|
|
@@ -33899,13 +33948,24 @@ const handleDocxPaste = (html, editor, view) => {
|
|
|
33899
33948
|
const styleAttr = item.getAttribute("style") || "";
|
|
33900
33949
|
const msoListMatch = styleAttr.match(/mso-list:\s*l(\d+)\s+level(\d+)\s+lfo(\d+)/);
|
|
33901
33950
|
const css = tempDiv.querySelector("style").innerHTML;
|
|
33902
|
-
const normalStyles = extractParagraphStyles(css, "MsoNormal");
|
|
33903
|
-
|
|
33904
|
-
let
|
|
33951
|
+
const normalStyles = extractParagraphStyles(css, ".MsoNormal");
|
|
33952
|
+
let styleId = item.getAttribute("class");
|
|
33953
|
+
let charStyles = {};
|
|
33954
|
+
if (item.localName.startsWith("h") && !styleId) {
|
|
33955
|
+
styleId = item.localName;
|
|
33956
|
+
const level = styleId.substring(1);
|
|
33957
|
+
charStyles = extractParagraphStyles(css, `.Heading${level}Char`);
|
|
33958
|
+
} else if (styleId) {
|
|
33959
|
+
styleId = `.${styleId}`;
|
|
33960
|
+
}
|
|
33961
|
+
const paragraphStyles = extractParagraphStyles(css, styleId);
|
|
33962
|
+
let styleChain = { ...normalStyles, ...paragraphStyles, ...charStyles };
|
|
33905
33963
|
const numberingDefinedInline = !paragraphStyles || !paragraphStyles["mso-list"];
|
|
33906
33964
|
if (msoListMatch) {
|
|
33907
33965
|
const [, abstractId, level, numId] = msoListMatch;
|
|
33908
33966
|
const numberingStyles = extractListLevelStyles(css, abstractId, level, numId) || {};
|
|
33967
|
+
const markerFontFamily = numberingStyles?.["font-family"] ?? normalStyles?.["font-family"];
|
|
33968
|
+
delete numberingStyles["font-family"];
|
|
33909
33969
|
if (numberingDefinedInline) {
|
|
33910
33970
|
styleChain = { ...normalStyles, ...paragraphStyles, ...numberingStyles };
|
|
33911
33971
|
} else {
|
|
@@ -33928,6 +33988,7 @@ const handleDocxPaste = (html, editor, view) => {
|
|
|
33928
33988
|
if (!startMap[numId]) startMap[numId] = startGetter(item.children[0]?.innerText || "1");
|
|
33929
33989
|
start = startMap[numId];
|
|
33930
33990
|
}
|
|
33991
|
+
item.setAttribute("data-marker-font-family", markerFontFamily);
|
|
33931
33992
|
item.setAttribute("data-num-id", numId);
|
|
33932
33993
|
item.setAttribute("data-list-level", parseInt(level) - 1);
|
|
33933
33994
|
item.setAttribute("data-start", start);
|
|
@@ -33976,6 +34037,24 @@ const handleDocxPaste = (html, editor, view) => {
|
|
|
33976
34037
|
}
|
|
33977
34038
|
});
|
|
33978
34039
|
item.setAttribute("data-text-styles", JSON.stringify(textStyles));
|
|
34040
|
+
for (const child of item.children) {
|
|
34041
|
+
if (child.style) {
|
|
34042
|
+
Object.keys(textStyles).forEach((key) => {
|
|
34043
|
+
const styleValue = textStyles[key];
|
|
34044
|
+
if (styleValue) {
|
|
34045
|
+
child.style[key] = styleValue;
|
|
34046
|
+
}
|
|
34047
|
+
});
|
|
34048
|
+
}
|
|
34049
|
+
}
|
|
34050
|
+
}
|
|
34051
|
+
if (resolvedStyle["font-weight"] === "bold") {
|
|
34052
|
+
item.style.fontWeight = "bold";
|
|
34053
|
+
for (const child of item.children) {
|
|
34054
|
+
if (child.style) {
|
|
34055
|
+
child.style.fontWeight = "bold";
|
|
34056
|
+
}
|
|
34057
|
+
}
|
|
33979
34058
|
}
|
|
33980
34059
|
extractAndRemoveConditionalPrefix(item);
|
|
33981
34060
|
});
|
|
@@ -34019,6 +34098,7 @@ const transformWordLists = (container, editor) => {
|
|
|
34019
34098
|
const numFmt = item.getAttribute("data-num-fmt");
|
|
34020
34099
|
const start = item.getAttribute("data-start");
|
|
34021
34100
|
const lvlText = item.getAttribute("data-lvl-text");
|
|
34101
|
+
const markerFontFamily = item.getAttribute("data-marker-font-family");
|
|
34022
34102
|
const importedId = item.getAttribute("data-num-id");
|
|
34023
34103
|
if (!mappedLists[importedId]) mappedLists[importedId] = ListHelpers.getNewListId(editor);
|
|
34024
34104
|
const id = mappedLists[importedId];
|
|
@@ -34030,7 +34110,8 @@ const transformWordLists = (container, editor) => {
|
|
|
34030
34110
|
start,
|
|
34031
34111
|
fmt: numFmt,
|
|
34032
34112
|
text: lvlText,
|
|
34033
|
-
editor
|
|
34113
|
+
editor,
|
|
34114
|
+
markerFontFamily
|
|
34034
34115
|
});
|
|
34035
34116
|
if (!lists[id]) lists[id] = { levels: {} };
|
|
34036
34117
|
const currentListByNumId = lists[id];
|
|
@@ -34063,6 +34144,11 @@ const transformWordLists = (container, editor) => {
|
|
|
34063
34144
|
const styleValue = textStyles[key];
|
|
34064
34145
|
if (styleValue) {
|
|
34065
34146
|
pElement.style[key] = styleValue;
|
|
34147
|
+
for (const child of pElement.children) {
|
|
34148
|
+
if (child.style) {
|
|
34149
|
+
child.style[key] = styleValue;
|
|
34150
|
+
}
|
|
34151
|
+
}
|
|
34066
34152
|
}
|
|
34067
34153
|
});
|
|
34068
34154
|
}
|
|
@@ -36396,11 +36482,71 @@ function translateShapeGroup(params) {
|
|
|
36396
36482
|
elements: []
|
|
36397
36483
|
});
|
|
36398
36484
|
}
|
|
36485
|
+
function mergeDrawingChildren({ order, generated, original }) {
|
|
36486
|
+
const genQueues = groupByName(generated);
|
|
36487
|
+
const originalsByIndex = groupByIndex(original);
|
|
36488
|
+
return mergeWithOrder(order, genQueues, originalsByIndex);
|
|
36489
|
+
}
|
|
36490
|
+
function groupByIndex(entries = []) {
|
|
36491
|
+
const map = /* @__PURE__ */ new Map();
|
|
36492
|
+
entries.forEach((entry) => {
|
|
36493
|
+
if (!entry) return;
|
|
36494
|
+
const { index: index2, xml } = entry;
|
|
36495
|
+
if (typeof index2 === "number" && xml && xml.name !== "wp:extent") {
|
|
36496
|
+
map.set(index2, carbonCopy(xml));
|
|
36497
|
+
}
|
|
36498
|
+
});
|
|
36499
|
+
return map;
|
|
36500
|
+
}
|
|
36501
|
+
function mergeWithOrder(order = [], genQueues, originalsByIndex) {
|
|
36502
|
+
const out = [];
|
|
36503
|
+
const namesInOrder = new Set(order);
|
|
36504
|
+
order.forEach((name, idx) => {
|
|
36505
|
+
if (name === "wp:extent") {
|
|
36506
|
+
const queue3 = genQueues.get("wp:extent") || [];
|
|
36507
|
+
if (queue3.length) {
|
|
36508
|
+
out.push(queue3.shift());
|
|
36509
|
+
if (!queue3.length) genQueues.delete("wp:extent");
|
|
36510
|
+
}
|
|
36511
|
+
return;
|
|
36512
|
+
}
|
|
36513
|
+
if (originalsByIndex.has(idx)) {
|
|
36514
|
+
out.push(originalsByIndex.get(idx));
|
|
36515
|
+
originalsByIndex.delete(idx);
|
|
36516
|
+
if (genQueues.has(name)) {
|
|
36517
|
+
genQueues.delete(name);
|
|
36518
|
+
}
|
|
36519
|
+
return;
|
|
36520
|
+
}
|
|
36521
|
+
const queue2 = genQueues.get(name) || [];
|
|
36522
|
+
if (queue2.length) {
|
|
36523
|
+
out.push(queue2.shift());
|
|
36524
|
+
if (!queue2.length) genQueues.delete(name);
|
|
36525
|
+
}
|
|
36526
|
+
});
|
|
36527
|
+
originalsByIndex.forEach((xml) => out.push(xml));
|
|
36528
|
+
genQueues.forEach((queue2, name) => {
|
|
36529
|
+
if (namesInOrder.has(name)) return;
|
|
36530
|
+
queue2.forEach((el) => out.push(el));
|
|
36531
|
+
});
|
|
36532
|
+
return out;
|
|
36533
|
+
}
|
|
36534
|
+
function groupByName(nodes = []) {
|
|
36535
|
+
const map = /* @__PURE__ */ new Map();
|
|
36536
|
+
nodes.forEach((el) => {
|
|
36537
|
+
if (!el?.name) return;
|
|
36538
|
+
const list = map.get(el.name) || [];
|
|
36539
|
+
list.push(carbonCopy(el));
|
|
36540
|
+
map.set(el.name, list);
|
|
36541
|
+
});
|
|
36542
|
+
return map;
|
|
36543
|
+
}
|
|
36399
36544
|
function translateAnchorNode(params) {
|
|
36400
36545
|
const { attrs } = params.node;
|
|
36401
36546
|
const anchorElements = [];
|
|
36402
|
-
const
|
|
36403
|
-
|
|
36547
|
+
const useOriginalChildren = Array.isArray(attrs.originalDrawingChildren) && attrs.originalDrawingChildren.length > 0;
|
|
36548
|
+
const hasSimplePos = attrs.simplePos !== void 0 || attrs.originalAttributes?.simplePos !== void 0;
|
|
36549
|
+
if (!useOriginalChildren && hasSimplePos) {
|
|
36404
36550
|
anchorElements.push({
|
|
36405
36551
|
name: "wp:simplePos",
|
|
36406
36552
|
attributes: {
|
|
@@ -36409,7 +36555,7 @@ function translateAnchorNode(params) {
|
|
|
36409
36555
|
}
|
|
36410
36556
|
});
|
|
36411
36557
|
}
|
|
36412
|
-
if (attrs.anchorData) {
|
|
36558
|
+
if (!useOriginalChildren && attrs.anchorData) {
|
|
36413
36559
|
const hElements = [];
|
|
36414
36560
|
if (attrs.marginOffset.horizontal !== void 0) {
|
|
36415
36561
|
hElements.push({
|
|
@@ -36455,25 +36601,14 @@ function translateAnchorNode(params) {
|
|
|
36455
36601
|
if (inlineAttrs.relativeHeight == null) {
|
|
36456
36602
|
inlineAttrs.relativeHeight = 1;
|
|
36457
36603
|
}
|
|
36458
|
-
if (attrs.originalAttributes?.simplePos
|
|
36459
|
-
inlineAttrs.simplePos = attrs.originalAttributes.simplePos;
|
|
36460
|
-
} else if (hasSimplePos) {
|
|
36604
|
+
if (attrs.originalAttributes?.simplePos === void 0 && hasSimplePos) {
|
|
36461
36605
|
inlineAttrs.simplePos = "1";
|
|
36462
36606
|
}
|
|
36463
|
-
if (attrs.originalAttributes?.locked !== void 0) {
|
|
36464
|
-
inlineAttrs.locked = attrs.originalAttributes.locked;
|
|
36465
|
-
}
|
|
36466
|
-
if (attrs.originalAttributes?.layoutInCell !== void 0) {
|
|
36467
|
-
inlineAttrs.layoutInCell = attrs.originalAttributes.layoutInCell;
|
|
36468
|
-
}
|
|
36469
|
-
if (attrs.originalAttributes?.allowOverlap !== void 0) {
|
|
36470
|
-
inlineAttrs.allowOverlap = attrs.originalAttributes.allowOverlap;
|
|
36471
|
-
}
|
|
36472
36607
|
const wrapElement = {
|
|
36473
36608
|
name: `wp:wrap${attrs.wrap?.type || "None"}`
|
|
36474
36609
|
// Important: wp:anchor will break if no wrapping is specified. We need to use wrapNone.
|
|
36475
36610
|
};
|
|
36476
|
-
switch (attrs.wrap?.type) {
|
|
36611
|
+
switch (useOriginalChildren ? void 0 : attrs.wrap?.type) {
|
|
36477
36612
|
case "Square":
|
|
36478
36613
|
wrapElement.attributes = {
|
|
36479
36614
|
wrapText: attrs.wrap.attrs.wrapText
|
|
@@ -36553,15 +36688,33 @@ function translateAnchorNode(params) {
|
|
|
36553
36688
|
wrapElement,
|
|
36554
36689
|
...nodeElements.elements.slice(effectIndex + 1)
|
|
36555
36690
|
];
|
|
36691
|
+
const mergedElements = mergeDrawingChildren({
|
|
36692
|
+
order: attrs.drawingChildOrder || [],
|
|
36693
|
+
original: attrs.originalDrawingChildren || [],
|
|
36694
|
+
generated: [...anchorElements, ...elementsWithWrap]
|
|
36695
|
+
});
|
|
36556
36696
|
return {
|
|
36557
36697
|
name: "wp:anchor",
|
|
36558
36698
|
attributes: inlineAttrs,
|
|
36559
|
-
elements:
|
|
36699
|
+
elements: mergedElements
|
|
36560
36700
|
};
|
|
36561
36701
|
}
|
|
36562
36702
|
const XML_NODE_NAME$f = "wp:anchor";
|
|
36563
36703
|
const SD_NODE_NAME$d = ["image", "shapeGroup", "vectorShape", "contentBlock"];
|
|
36564
|
-
const validXmlAttributes$
|
|
36704
|
+
const validXmlAttributes$6 = [
|
|
36705
|
+
"distT",
|
|
36706
|
+
"distB",
|
|
36707
|
+
"distL",
|
|
36708
|
+
"distR",
|
|
36709
|
+
"allowOverlap",
|
|
36710
|
+
"behindDoc",
|
|
36711
|
+
"layoutInCell",
|
|
36712
|
+
"locked",
|
|
36713
|
+
"relativeHeight",
|
|
36714
|
+
"simplePos",
|
|
36715
|
+
"wp14:anchorId",
|
|
36716
|
+
"wp14:editId"
|
|
36717
|
+
].map((xmlName) => createAttributeHandler(xmlName));
|
|
36565
36718
|
function encode$l(params) {
|
|
36566
36719
|
const { node } = params.extraParams;
|
|
36567
36720
|
if (!node || !node.name) {
|
|
@@ -36582,7 +36735,7 @@ const config$e = {
|
|
|
36582
36735
|
type: NodeTranslator.translatorTypes.NODE,
|
|
36583
36736
|
encode: encode$l,
|
|
36584
36737
|
decode: decode$n,
|
|
36585
|
-
attributes: validXmlAttributes$
|
|
36738
|
+
attributes: validXmlAttributes$6
|
|
36586
36739
|
};
|
|
36587
36740
|
const translator$u = NodeTranslator.from(config$e);
|
|
36588
36741
|
function handleInlineNode(params) {
|
|
@@ -36593,16 +36746,29 @@ function handleInlineNode(params) {
|
|
|
36593
36746
|
return handleImageNode(node, params, false);
|
|
36594
36747
|
}
|
|
36595
36748
|
function translateInlineNode(params) {
|
|
36749
|
+
const { attrs } = params.node;
|
|
36596
36750
|
const nodeElements = translateImageNode(params);
|
|
36751
|
+
const inlineAttrs = {
|
|
36752
|
+
...attrs.originalAttributes || {},
|
|
36753
|
+
...nodeElements.attributes || {}
|
|
36754
|
+
};
|
|
36755
|
+
const generatedElements = nodeElements?.elements || [];
|
|
36756
|
+
const mergedElements = mergeDrawingChildren({
|
|
36757
|
+
order: params.node?.attrs?.drawingChildOrder || [],
|
|
36758
|
+
original: params.node?.attrs?.originalDrawingChildren || [],
|
|
36759
|
+
generated: generatedElements
|
|
36760
|
+
});
|
|
36597
36761
|
return {
|
|
36598
36762
|
name: "wp:inline",
|
|
36599
|
-
attributes:
|
|
36600
|
-
elements:
|
|
36763
|
+
attributes: inlineAttrs,
|
|
36764
|
+
elements: mergedElements
|
|
36601
36765
|
};
|
|
36602
36766
|
}
|
|
36603
36767
|
const XML_NODE_NAME$e = "wp:inline";
|
|
36604
36768
|
const SD_NODE_NAME$c = ["image", "shapeGroup", "vectorShape", "contentBlock"];
|
|
36605
|
-
const validXmlAttributes$
|
|
36769
|
+
const validXmlAttributes$5 = ["distT", "distB", "distL", "distR", "wp14:anchorId", "wp14:editId"].map(
|
|
36770
|
+
(xmlName) => createAttributeHandler(xmlName)
|
|
36771
|
+
);
|
|
36606
36772
|
function encode$k(params) {
|
|
36607
36773
|
const { node } = params.extraParams;
|
|
36608
36774
|
if (!node || !node.name) {
|
|
@@ -36623,12 +36789,12 @@ const config$d = {
|
|
|
36623
36789
|
type: NodeTranslator.translatorTypes.NODE,
|
|
36624
36790
|
encode: encode$k,
|
|
36625
36791
|
decode: decode$m,
|
|
36626
|
-
attributes: validXmlAttributes$
|
|
36792
|
+
attributes: validXmlAttributes$5
|
|
36627
36793
|
};
|
|
36628
36794
|
const translator$t = NodeTranslator.from(config$d);
|
|
36629
36795
|
const XML_NODE_NAME$d = "w:drawing";
|
|
36630
36796
|
const SD_NODE_NAME$b = [];
|
|
36631
|
-
const validXmlAttributes$
|
|
36797
|
+
const validXmlAttributes$4 = [];
|
|
36632
36798
|
function encode$j(params) {
|
|
36633
36799
|
const nodes = params.nodes;
|
|
36634
36800
|
const node = nodes[0];
|
|
@@ -36636,14 +36802,21 @@ function encode$j(params) {
|
|
|
36636
36802
|
"wp:anchor": translator$u,
|
|
36637
36803
|
"wp:inline": translator$t
|
|
36638
36804
|
};
|
|
36639
|
-
const result = node.elements.reduce((acc, child) => {
|
|
36805
|
+
const result = (node.elements || []).reduce((acc, child) => {
|
|
36640
36806
|
if (acc) return acc;
|
|
36641
36807
|
const translator2 = translatorByChildName[child.name];
|
|
36642
36808
|
if (!translator2) return acc;
|
|
36643
36809
|
const childResult = translator2.encode({ ...params, extraParams: { node: child } });
|
|
36644
36810
|
return childResult || acc;
|
|
36645
36811
|
}, null);
|
|
36646
|
-
return result;
|
|
36812
|
+
if (result) return result;
|
|
36813
|
+
return {
|
|
36814
|
+
type: "passthroughBlock",
|
|
36815
|
+
attrs: {
|
|
36816
|
+
originalName: "w:drawing",
|
|
36817
|
+
originalXml: carbonCopy(node)
|
|
36818
|
+
}
|
|
36819
|
+
};
|
|
36647
36820
|
}
|
|
36648
36821
|
function decode$l(params) {
|
|
36649
36822
|
const { node } = params;
|
|
@@ -36666,7 +36839,7 @@ const config$c = {
|
|
|
36666
36839
|
type: NodeTranslator.translatorTypes.NODE,
|
|
36667
36840
|
encode: encode$j,
|
|
36668
36841
|
decode: decode$l,
|
|
36669
|
-
attributes: validXmlAttributes$
|
|
36842
|
+
attributes: validXmlAttributes$4
|
|
36670
36843
|
};
|
|
36671
36844
|
const translator$s = NodeTranslator.from(config$c);
|
|
36672
36845
|
function getTextNodeForExport(text, marks, params) {
|
|
@@ -37497,7 +37670,7 @@ function generateSdtPrTagForStructuredContent({ node }) {
|
|
|
37497
37670
|
}
|
|
37498
37671
|
const XML_NODE_NAME$c = "w:sdt";
|
|
37499
37672
|
const SD_NODE_NAME$a = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
|
|
37500
|
-
const validXmlAttributes$
|
|
37673
|
+
const validXmlAttributes$3 = [];
|
|
37501
37674
|
function encode$i(params) {
|
|
37502
37675
|
const nodes = params.nodes;
|
|
37503
37676
|
const node = nodes[0];
|
|
@@ -37532,7 +37705,7 @@ const config$b = {
|
|
|
37532
37705
|
type: NodeTranslator.translatorTypes.NODE,
|
|
37533
37706
|
encode: encode$i,
|
|
37534
37707
|
decode: decode$k,
|
|
37535
|
-
attributes: validXmlAttributes$
|
|
37708
|
+
attributes: validXmlAttributes$3
|
|
37536
37709
|
};
|
|
37537
37710
|
const translator$r = NodeTranslator.from(config$b);
|
|
37538
37711
|
function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
@@ -38167,7 +38340,7 @@ const attrConfig$3 = Object.freeze({
|
|
|
38167
38340
|
encode: encode$b,
|
|
38168
38341
|
decode: decode$d
|
|
38169
38342
|
});
|
|
38170
|
-
const
|
|
38343
|
+
const bookmarkStartAttrConfigs = [attrConfig$7, attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3];
|
|
38171
38344
|
const XML_NODE_NAME$9 = "w:bookmarkStart";
|
|
38172
38345
|
const SD_NODE_NAME$8 = "bookmarkStart";
|
|
38173
38346
|
const encode$a = (params, encodedAttrs = {}) => {
|
|
@@ -38192,7 +38365,7 @@ const config$8 = {
|
|
|
38192
38365
|
type: NodeTranslator.translatorTypes.NODE,
|
|
38193
38366
|
encode: encode$a,
|
|
38194
38367
|
decode: decode$c,
|
|
38195
|
-
attributes:
|
|
38368
|
+
attributes: bookmarkStartAttrConfigs
|
|
38196
38369
|
};
|
|
38197
38370
|
const translator$8 = NodeTranslator.from(config$8);
|
|
38198
38371
|
const encode$9 = (attributes) => {
|
|
@@ -38219,7 +38392,7 @@ const attrConfig$1 = Object.freeze({
|
|
|
38219
38392
|
encode: encode$8,
|
|
38220
38393
|
decode: decode$a
|
|
38221
38394
|
});
|
|
38222
|
-
const
|
|
38395
|
+
const bookmarkEndAttrConfigs = [attrConfig$2, attrConfig$1];
|
|
38223
38396
|
const XML_NODE_NAME$8 = "w:bookmarkEnd";
|
|
38224
38397
|
const SD_NODE_NAME$7 = "bookmarkEnd";
|
|
38225
38398
|
const encode$7 = (params, encodedAttrs = {}) => {
|
|
@@ -38244,7 +38417,7 @@ const config$7 = {
|
|
|
38244
38417
|
type: NodeTranslator.translatorTypes.NODE,
|
|
38245
38418
|
encode: encode$7,
|
|
38246
38419
|
decode: decode$9,
|
|
38247
|
-
attributes:
|
|
38420
|
+
attributes: bookmarkEndAttrConfigs
|
|
38248
38421
|
};
|
|
38249
38422
|
const translator$7 = NodeTranslator.from(config$7);
|
|
38250
38423
|
const decode$8 = (attrs) => attrs?.["w:id"];
|
|
@@ -39210,7 +39383,8 @@ const INLINE_NODE_NAMES = /* @__PURE__ */ new Set([
|
|
|
39210
39383
|
]);
|
|
39211
39384
|
const BLOCK_BOUNDARY_NAMES = /* @__PURE__ */ new Set(["w:body", "w:tbl", "w:tc", "w:tr"]);
|
|
39212
39385
|
const isInlineContext = (path = [], currentNodeName) => {
|
|
39213
|
-
|
|
39386
|
+
const immediateName = currentNodeName ?? path[path.length - 1]?.name;
|
|
39387
|
+
if (immediateName && INLINE_NODE_NAMES.has(immediateName)) {
|
|
39214
39388
|
return true;
|
|
39215
39389
|
}
|
|
39216
39390
|
if (!Array.isArray(path) || path.length === 0) return false;
|
|
@@ -40348,27 +40522,28 @@ const preProcessNodesForFldChar = (nodes = [], docx) => {
|
|
|
40348
40522
|
const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
|
|
40349
40523
|
const fldType = fldCharEl?.attributes?.["w:fldCharType"];
|
|
40350
40524
|
const instrTextEl = node.elements?.find((el) => el.name === "w:instrText");
|
|
40525
|
+
const rawNode = carbonCopy(node);
|
|
40351
40526
|
collecting = collectedNodesStack.length > 0;
|
|
40352
40527
|
if (fldType === "begin") {
|
|
40353
40528
|
collectedNodesStack.push([]);
|
|
40354
|
-
rawCollectedNodesStack.push([
|
|
40529
|
+
rawCollectedNodesStack.push([rawNode]);
|
|
40355
40530
|
currentFieldStack.push({ instrText: "" });
|
|
40356
40531
|
continue;
|
|
40357
40532
|
}
|
|
40358
40533
|
if (instrTextEl && collecting && currentFieldStack.length > 0) {
|
|
40359
|
-
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(
|
|
40534
|
+
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
|
|
40360
40535
|
currentFieldStack[currentFieldStack.length - 1].instrText += (instrTextEl.elements?.[0]?.text || "") + " ";
|
|
40361
40536
|
continue;
|
|
40362
40537
|
}
|
|
40363
40538
|
if (fldType === "end") {
|
|
40364
40539
|
if (collecting) {
|
|
40365
|
-
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(
|
|
40540
|
+
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
|
|
40366
40541
|
}
|
|
40367
40542
|
finalizeField();
|
|
40368
40543
|
continue;
|
|
40369
40544
|
} else if (fldType === "separate") {
|
|
40370
40545
|
if (collecting) {
|
|
40371
|
-
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(
|
|
40546
|
+
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
|
|
40372
40547
|
}
|
|
40373
40548
|
continue;
|
|
40374
40549
|
}
|
|
@@ -40379,21 +40554,21 @@ const preProcessNodesForFldChar = (nodes = [], docx) => {
|
|
|
40379
40554
|
childResult.unpairedBegin.forEach((pendingField) => {
|
|
40380
40555
|
currentFieldStack.push(pendingField.fieldInfo);
|
|
40381
40556
|
collectedNodesStack.push([node]);
|
|
40382
|
-
rawCollectedNodesStack.push([
|
|
40557
|
+
rawCollectedNodesStack.push([rawNode]);
|
|
40383
40558
|
});
|
|
40384
40559
|
} else if (childResult.unpairedEnd) {
|
|
40385
40560
|
collectedNodesStack[collectedNodesStack.length - 1].push(node);
|
|
40386
|
-
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(
|
|
40561
|
+
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
|
|
40387
40562
|
finalizeField();
|
|
40388
40563
|
} else if (collecting) {
|
|
40389
40564
|
collectedNodesStack[collectedNodesStack.length - 1].push(node);
|
|
40390
|
-
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(
|
|
40565
|
+
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
|
|
40391
40566
|
} else {
|
|
40392
40567
|
processedNodes.push(node);
|
|
40393
40568
|
}
|
|
40394
40569
|
} else if (collecting) {
|
|
40395
40570
|
collectedNodesStack[collectedNodesStack.length - 1].push(node);
|
|
40396
|
-
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(
|
|
40571
|
+
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
|
|
40397
40572
|
} else {
|
|
40398
40573
|
processedNodes.push(node);
|
|
40399
40574
|
}
|
|
@@ -40998,8 +41173,48 @@ function filterOutRootInlineNodes(content = []) {
|
|
|
40998
41173
|
"commentReference",
|
|
40999
41174
|
"structuredContent"
|
|
41000
41175
|
]);
|
|
41001
|
-
|
|
41176
|
+
const PRESERVABLE_INLINE_XML_NAMES = {
|
|
41177
|
+
bookmarkStart: "w:bookmarkStart",
|
|
41178
|
+
bookmarkEnd: "w:bookmarkEnd"
|
|
41179
|
+
};
|
|
41180
|
+
const result = [];
|
|
41181
|
+
content.forEach((node) => {
|
|
41182
|
+
if (!node || typeof node.type !== "string") return;
|
|
41183
|
+
const type2 = node.type;
|
|
41184
|
+
const preservableNodeName = PRESERVABLE_INLINE_XML_NAMES[type2];
|
|
41185
|
+
if (!INLINE_TYPES.has(type2)) {
|
|
41186
|
+
result.push(node);
|
|
41187
|
+
} else if (preservableNodeName) {
|
|
41188
|
+
const originalXml = buildOriginalXml(type2, node.attrs, PRESERVABLE_INLINE_XML_NAMES);
|
|
41189
|
+
result.push({
|
|
41190
|
+
type: "passthroughBlock",
|
|
41191
|
+
attrs: {
|
|
41192
|
+
originalName: preservableNodeName,
|
|
41193
|
+
...originalXml ? { originalXml } : {}
|
|
41194
|
+
}
|
|
41195
|
+
});
|
|
41196
|
+
}
|
|
41197
|
+
});
|
|
41198
|
+
return result;
|
|
41002
41199
|
}
|
|
41200
|
+
const buildOriginalXml = (type2, attrs, preservableTags) => {
|
|
41201
|
+
const attrConfigsByType = {
|
|
41202
|
+
bookmarkStart: bookmarkStartAttrConfigs,
|
|
41203
|
+
bookmarkEnd: bookmarkEndAttrConfigs
|
|
41204
|
+
};
|
|
41205
|
+
const configs = attrConfigsByType[type2];
|
|
41206
|
+
if (!configs) return null;
|
|
41207
|
+
const xmlAttrs = {};
|
|
41208
|
+
configs.forEach((cfg) => {
|
|
41209
|
+
const val = cfg.decode(attrs || {});
|
|
41210
|
+
if (val !== void 0) {
|
|
41211
|
+
xmlAttrs[cfg.xmlName] = val;
|
|
41212
|
+
}
|
|
41213
|
+
});
|
|
41214
|
+
const attributes = Object.keys(xmlAttrs).length ? xmlAttrs : void 0;
|
|
41215
|
+
const name = preservableTags[type2];
|
|
41216
|
+
return { name, ...attributes ? { attributes } : {}, elements: [] };
|
|
41217
|
+
};
|
|
41003
41218
|
function collapseWhitespaceNextToInlinePassthrough(content = []) {
|
|
41004
41219
|
if (!Array.isArray(content) || content.length === 0) return;
|
|
41005
41220
|
const sequence = collectInlineSequence(content);
|
|
@@ -42131,7 +42346,7 @@ const _SuperConverter = class _SuperConverter {
|
|
|
42131
42346
|
static getStoredSuperdocVersion(docx) {
|
|
42132
42347
|
return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42133
42348
|
}
|
|
42134
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.
|
|
42349
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.54") {
|
|
42135
42350
|
return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
42136
42351
|
}
|
|
42137
42352
|
/**
|