@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
|
@@ -18042,7 +18042,7 @@ const attrConfig$r = Object.freeze({
|
|
|
18042
18042
|
encode: encode$Q,
|
|
18043
18043
|
decode: decode$S
|
|
18044
18044
|
});
|
|
18045
|
-
const validXmlAttributes$
|
|
18045
|
+
const validXmlAttributes$h = [attrConfig$s, attrConfig$r];
|
|
18046
18046
|
const XML_NODE_NAME$q = "w:br";
|
|
18047
18047
|
const SD_NODE_NAME$k = "lineBreak";
|
|
18048
18048
|
const encode$P = (_2, encodedAttrs) => {
|
|
@@ -18078,7 +18078,7 @@ const config$p = {
|
|
|
18078
18078
|
type: NodeTranslator.translatorTypes.NODE,
|
|
18079
18079
|
encode: encode$P,
|
|
18080
18080
|
decode: decode$R,
|
|
18081
|
-
attributes: validXmlAttributes$
|
|
18081
|
+
attributes: validXmlAttributes$h
|
|
18082
18082
|
};
|
|
18083
18083
|
const translator$23 = NodeTranslator.from(config$p);
|
|
18084
18084
|
const encode$O = (attributes) => attributes?.["w:val"];
|
|
@@ -18089,7 +18089,7 @@ const attrConfig$q = Object.freeze({
|
|
|
18089
18089
|
encode: encode$O,
|
|
18090
18090
|
decode: decode$Q
|
|
18091
18091
|
});
|
|
18092
|
-
const validXmlAttributes$
|
|
18092
|
+
const validXmlAttributes$g = [attrConfig$q];
|
|
18093
18093
|
const XML_NODE_NAME$p = "w:highlight";
|
|
18094
18094
|
const SD_ATTR_KEY$4 = "highlight";
|
|
18095
18095
|
const DISABLED_TOKENS = /* @__PURE__ */ new Set(["transparent", "none", "inherit"]);
|
|
@@ -18140,7 +18140,7 @@ const config$o = {
|
|
|
18140
18140
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
18141
18141
|
encode: encode$N,
|
|
18142
18142
|
decode: decode$P,
|
|
18143
|
-
attributes: validXmlAttributes$
|
|
18143
|
+
attributes: validXmlAttributes$g
|
|
18144
18144
|
};
|
|
18145
18145
|
const translator$22 = NodeTranslator.from(config$o);
|
|
18146
18146
|
const encode$M = (attributes) => {
|
|
@@ -18183,7 +18183,7 @@ const attrConfig$n = Object.freeze({
|
|
|
18183
18183
|
encode: encode$K,
|
|
18184
18184
|
decode: decode$M
|
|
18185
18185
|
});
|
|
18186
|
-
const validXmlAttributes$
|
|
18186
|
+
const validXmlAttributes$f = [attrConfig$p, attrConfig$n, attrConfig$o];
|
|
18187
18187
|
const XML_NODE_NAME$o = "w:tab";
|
|
18188
18188
|
const SD_NODE_NAME$j = "tab";
|
|
18189
18189
|
const encode$J = (_2, encodedAttrs = {}) => {
|
|
@@ -18219,7 +18219,7 @@ const config$n = {
|
|
|
18219
18219
|
type: NodeTranslator.translatorTypes.NODE,
|
|
18220
18220
|
encode: encode$J,
|
|
18221
18221
|
decode: decode$L,
|
|
18222
|
-
attributes: validXmlAttributes$
|
|
18222
|
+
attributes: validXmlAttributes$f
|
|
18223
18223
|
};
|
|
18224
18224
|
const translator$21 = NodeTranslator.from(config$n);
|
|
18225
18225
|
const carbonCopy = (obj) => {
|
|
@@ -18590,7 +18590,7 @@ const attrConfig$i = Object.freeze({
|
|
|
18590
18590
|
encode: encode$E,
|
|
18591
18591
|
decode: decode$G
|
|
18592
18592
|
});
|
|
18593
|
-
const validXmlAttributes$
|
|
18593
|
+
const validXmlAttributes$e = [attrConfig$m, attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
|
|
18594
18594
|
const XML_NODE_NAME$n = "w:u";
|
|
18595
18595
|
const SD_ATTR_KEY$3 = "underline";
|
|
18596
18596
|
const encode$D = (params2, encodedAttrs = {}) => {
|
|
@@ -18642,7 +18642,7 @@ const config$m = {
|
|
|
18642
18642
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
18643
18643
|
encode: encode$D,
|
|
18644
18644
|
decode: decode$F,
|
|
18645
|
-
attributes: validXmlAttributes$
|
|
18645
|
+
attributes: validXmlAttributes$e
|
|
18646
18646
|
};
|
|
18647
18647
|
const translator$1Z = NodeTranslator.from(config$m);
|
|
18648
18648
|
const translator$1Y = NodeTranslator.from(createSingleBooleanPropertyHandler("w:strike"));
|
|
@@ -18776,7 +18776,7 @@ const SUPPORTED_ALTERNATE_CONTENT_REQUIRES = /* @__PURE__ */ new Set([
|
|
|
18776
18776
|
]);
|
|
18777
18777
|
const XML_NODE_NAME$m = "mc:AlternateContent";
|
|
18778
18778
|
const SD_NODE_NAME$i = [];
|
|
18779
|
-
const validXmlAttributes$
|
|
18779
|
+
const validXmlAttributes$d = [];
|
|
18780
18780
|
function encode$C(params2) {
|
|
18781
18781
|
const { nodeListHandler } = params2;
|
|
18782
18782
|
const { node } = params2.extraParams;
|
|
@@ -18816,7 +18816,7 @@ const config$l = {
|
|
|
18816
18816
|
type: NodeTranslator.translatorTypes.NODE,
|
|
18817
18817
|
encode: encode$C,
|
|
18818
18818
|
decode: decode$E,
|
|
18819
|
-
attributes: validXmlAttributes$
|
|
18819
|
+
attributes: validXmlAttributes$d
|
|
18820
18820
|
};
|
|
18821
18821
|
function selectAlternateContentElements(node) {
|
|
18822
18822
|
if (!node?.elements?.length) {
|
|
@@ -18956,7 +18956,7 @@ const createTrackStyleMark = (marks) => {
|
|
|
18956
18956
|
};
|
|
18957
18957
|
const XML_NODE_NAME$l = "w:ins";
|
|
18958
18958
|
const SD_ATTR_KEY$2 = "trackInsert";
|
|
18959
|
-
const validXmlAttributes$
|
|
18959
|
+
const validXmlAttributes$c = [
|
|
18960
18960
|
createAttributeHandler("w:id", "id"),
|
|
18961
18961
|
createAttributeHandler("w:date", "date"),
|
|
18962
18962
|
createAttributeHandler("w:author", "author"),
|
|
@@ -19016,7 +19016,7 @@ const config$k = {
|
|
|
19016
19016
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
19017
19017
|
encode: encode$B,
|
|
19018
19018
|
decode: decode$D,
|
|
19019
|
-
attributes: validXmlAttributes$
|
|
19019
|
+
attributes: validXmlAttributes$c
|
|
19020
19020
|
};
|
|
19021
19021
|
const translator$1w = NodeTranslator.from(config$k);
|
|
19022
19022
|
const translator$1v = NodeTranslator.from(createSingleIntegerPropertyHandler("w:numId"));
|
|
@@ -19210,11 +19210,12 @@ const resolveRunProperties = (params2, inlineRpr, resolvedPpr, isListNumber = fa
|
|
|
19210
19210
|
}
|
|
19211
19211
|
if (isListNumber) {
|
|
19212
19212
|
let numberingProps = {};
|
|
19213
|
-
|
|
19213
|
+
const numId = resolvedPpr?.numberingProperties?.numId;
|
|
19214
|
+
if (numId != null && numId !== 0 && numId !== "0") {
|
|
19214
19215
|
numberingProps = getNumberingProperties(
|
|
19215
19216
|
params2,
|
|
19216
19217
|
resolvedPpr.numberingProperties.ilvl ?? 0,
|
|
19217
|
-
|
|
19218
|
+
numId,
|
|
19218
19219
|
translator$1N
|
|
19219
19220
|
);
|
|
19220
19221
|
}
|
|
@@ -19252,9 +19253,13 @@ function resolveParagraphProperties(params2, inlineProps, insideTable = false, o
|
|
|
19252
19253
|
let styleProps = inlineProps?.styleId ? resolveStyleChain$1(params2, inlineProps?.styleId, translator$12) : {};
|
|
19253
19254
|
let numberingProps = {};
|
|
19254
19255
|
let ilvl = inlineProps?.numberingProperties?.ilvl ?? styleProps?.numberingProperties?.ilvl;
|
|
19255
|
-
|
|
19256
|
+
let numId = inlineProps?.numberingProperties?.numId ?? styleProps?.numberingProperties?.numId;
|
|
19256
19257
|
let numberingDefinedInline = inlineProps?.numberingProperties?.numId != null;
|
|
19257
|
-
const
|
|
19258
|
+
const inlineNumIdDisablesNumbering = inlineProps?.numberingProperties?.numId === 0 || inlineProps?.numberingProperties?.numId === "0";
|
|
19259
|
+
if (inlineNumIdDisablesNumbering) {
|
|
19260
|
+
numId = null;
|
|
19261
|
+
}
|
|
19262
|
+
const isList2 = numId != null && numId !== 0 && numId !== "0";
|
|
19258
19263
|
if (isList2) {
|
|
19259
19264
|
ilvl = ilvl != null ? ilvl : 0;
|
|
19260
19265
|
numberingProps = getNumberingProperties(params2, ilvl, numId, translator$12);
|
|
@@ -20395,7 +20400,7 @@ const attrConfig$b = Object.freeze({
|
|
|
20395
20400
|
encode: encode$u,
|
|
20396
20401
|
decode: decode$w
|
|
20397
20402
|
});
|
|
20398
|
-
const validXmlAttributes$
|
|
20403
|
+
const validXmlAttributes$b = [
|
|
20399
20404
|
attrConfig$c,
|
|
20400
20405
|
attrConfig$b,
|
|
20401
20406
|
attrConfig$f,
|
|
@@ -20428,7 +20433,7 @@ const config$j = {
|
|
|
20428
20433
|
type: NodeTranslator.translatorTypes.NODE,
|
|
20429
20434
|
encode: encode$t,
|
|
20430
20435
|
decode: decode$v,
|
|
20431
|
-
attributes: validXmlAttributes$
|
|
20436
|
+
attributes: validXmlAttributes$b
|
|
20432
20437
|
};
|
|
20433
20438
|
const translator$11 = NodeTranslator.from(config$j);
|
|
20434
20439
|
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;
|
|
@@ -20611,7 +20616,7 @@ const _createAttributeHandler = (xmlName, sdName) => ({
|
|
|
20611
20616
|
encode: (attributes) => attributes[xmlName],
|
|
20612
20617
|
decode: (attributes) => attributes[sdName]
|
|
20613
20618
|
});
|
|
20614
|
-
const validXmlAttributes$
|
|
20619
|
+
const validXmlAttributes$a = [
|
|
20615
20620
|
_createAttributeHandler("w:anchor", "anchor"),
|
|
20616
20621
|
_createAttributeHandler("w:docLocation", "docLocation"),
|
|
20617
20622
|
{
|
|
@@ -20713,7 +20718,7 @@ const config$i = {
|
|
|
20713
20718
|
type: NodeTranslator.translatorTypes.NODE,
|
|
20714
20719
|
encode: encode$s,
|
|
20715
20720
|
decode: decode$u,
|
|
20716
|
-
attributes: validXmlAttributes$
|
|
20721
|
+
attributes: validXmlAttributes$a
|
|
20717
20722
|
};
|
|
20718
20723
|
const translator$10 = NodeTranslator.from(config$i);
|
|
20719
20724
|
const encode$r = (attributes) => {
|
|
@@ -20752,7 +20757,7 @@ const attrConfig$8 = Object.freeze({
|
|
|
20752
20757
|
encode: encode$p,
|
|
20753
20758
|
decode: decode$r
|
|
20754
20759
|
});
|
|
20755
|
-
const validXmlAttributes$
|
|
20760
|
+
const validXmlAttributes$9 = [attrConfig$a, attrConfig$9, attrConfig$8];
|
|
20756
20761
|
const XML_NODE_NAME$i = "w:r";
|
|
20757
20762
|
const SD_KEY_NAME = "run";
|
|
20758
20763
|
const encode$o = (params2, encodedAttrs = {}) => {
|
|
@@ -20899,7 +20904,7 @@ const config$h = {
|
|
|
20899
20904
|
type: NodeTranslator.translatorTypes.NODE,
|
|
20900
20905
|
encode: encode$o,
|
|
20901
20906
|
decode: decode$q,
|
|
20902
|
-
attributes: validXmlAttributes$
|
|
20907
|
+
attributes: validXmlAttributes$9
|
|
20903
20908
|
};
|
|
20904
20909
|
const translator$$ = NodeTranslator.from(config$h);
|
|
20905
20910
|
const translator$_ = NodeTranslator.from(createMeasurementPropertyHandler("w:tcW", "cellWidth"));
|
|
@@ -21329,7 +21334,7 @@ function generateTableCellProperties(node) {
|
|
|
21329
21334
|
}
|
|
21330
21335
|
const XML_NODE_NAME$h = "w:tc";
|
|
21331
21336
|
const SD_NODE_NAME$f = "tableCell";
|
|
21332
|
-
const validXmlAttributes$
|
|
21337
|
+
const validXmlAttributes$8 = [];
|
|
21333
21338
|
function encode$n(params2, encodedAttrs) {
|
|
21334
21339
|
const {
|
|
21335
21340
|
node,
|
|
@@ -21370,7 +21375,7 @@ const config$g = {
|
|
|
21370
21375
|
type: NodeTranslator.translatorTypes.NODE,
|
|
21371
21376
|
encode: encode$n,
|
|
21372
21377
|
decode: decode$p,
|
|
21373
|
-
attributes: validXmlAttributes$
|
|
21378
|
+
attributes: validXmlAttributes$8
|
|
21374
21379
|
};
|
|
21375
21380
|
const translator$G = NodeTranslator.from(config$g);
|
|
21376
21381
|
const translator$F = NodeTranslator.from({
|
|
@@ -21524,7 +21529,7 @@ const isPlaceholderCell = (cell) => {
|
|
|
21524
21529
|
};
|
|
21525
21530
|
const XML_NODE_NAME$g = "w:tr";
|
|
21526
21531
|
const SD_NODE_NAME$e = "tableRow";
|
|
21527
|
-
const validXmlAttributes$
|
|
21532
|
+
const validXmlAttributes$7 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
|
|
21528
21533
|
(xmlName) => createAttributeHandler(xmlName)
|
|
21529
21534
|
);
|
|
21530
21535
|
const encode$m = (params2, encodedAttrs) => {
|
|
@@ -21661,7 +21666,7 @@ const config$f = {
|
|
|
21661
21666
|
type: NodeTranslator.translatorTypes.NODE,
|
|
21662
21667
|
encode: encode$m,
|
|
21663
21668
|
decode: decode$o,
|
|
21664
|
-
attributes: validXmlAttributes$
|
|
21669
|
+
attributes: validXmlAttributes$7
|
|
21665
21670
|
};
|
|
21666
21671
|
const translator$v = NodeTranslator.from(config$f);
|
|
21667
21672
|
function parseTagValueJSON(json) {
|
|
@@ -30440,6 +30445,7 @@ function handleImageNode$1(node, params2, isAnchor) {
|
|
|
30440
30445
|
if (!node) return null;
|
|
30441
30446
|
const { docx, filename, converter } = params2;
|
|
30442
30447
|
const attributes = node?.attributes || {};
|
|
30448
|
+
const { order: order2, originalChildren } = collectPreservedDrawingChildren(node);
|
|
30443
30449
|
const padding = {
|
|
30444
30450
|
top: emuToPixels(attributes?.["distT"]),
|
|
30445
30451
|
bottom: emuToPixels(attributes?.["distB"]),
|
|
@@ -30635,6 +30641,7 @@ function handleImageNode$1(node, params2, isAnchor) {
|
|
|
30635
30641
|
}
|
|
30636
30642
|
const wrapValue = wrap2;
|
|
30637
30643
|
const nodeAttrs = {
|
|
30644
|
+
// originalXml: carbonCopy(node),
|
|
30638
30645
|
src: finalSrc,
|
|
30639
30646
|
alt: isMetafileExtension(extension) && !wasConverted ? "Unable to render EMF/WMF image" : docPr?.attributes?.name || "Image",
|
|
30640
30647
|
extension: finalExtension,
|
|
@@ -30669,7 +30676,9 @@ function handleImageNode$1(node, params2, isAnchor) {
|
|
|
30669
30676
|
distR: attributes["distR"]
|
|
30670
30677
|
},
|
|
30671
30678
|
originalAttributes: node.attributes,
|
|
30672
|
-
rId: relAttributes["Id"]
|
|
30679
|
+
rId: relAttributes["Id"],
|
|
30680
|
+
...order2.length ? { drawingChildOrder: order2 } : {},
|
|
30681
|
+
...originalChildren.length ? { originalDrawingChildren: originalChildren } : {}
|
|
30673
30682
|
};
|
|
30674
30683
|
return {
|
|
30675
30684
|
type: "image",
|
|
@@ -30694,6 +30703,23 @@ const handleShapeDrawing = (params2, node, graphicData, size2, padding, marginOf
|
|
|
30694
30703
|
const fallbackType = textBoxContent ? "textbox" : "drawing";
|
|
30695
30704
|
return buildShapePlaceholder(node, size2, padding, marginOffset, fallbackType);
|
|
30696
30705
|
};
|
|
30706
|
+
function collectPreservedDrawingChildren(node) {
|
|
30707
|
+
const order2 = [];
|
|
30708
|
+
const original = [];
|
|
30709
|
+
if (!Array.isArray(node?.elements)) {
|
|
30710
|
+
return { order: order2, originalChildren: original };
|
|
30711
|
+
}
|
|
30712
|
+
node.elements.forEach((child, index2) => {
|
|
30713
|
+
if (!child) return;
|
|
30714
|
+
const name = child.name ?? null;
|
|
30715
|
+
order2.push(name);
|
|
30716
|
+
original.push({
|
|
30717
|
+
index: index2,
|
|
30718
|
+
xml: carbonCopy(child)
|
|
30719
|
+
});
|
|
30720
|
+
});
|
|
30721
|
+
return { order: order2, originalChildren: original };
|
|
30722
|
+
}
|
|
30697
30723
|
const handleShapeGroup = (params2, node, graphicData, size2, padding, marginOffset, anchorData, wrap2) => {
|
|
30698
30724
|
const wgp = graphicData.elements.find((el) => el.name === "wpg:wgp");
|
|
30699
30725
|
if (!wgp) {
|
|
@@ -33462,7 +33488,7 @@ function updateNumberingProperties(newNumberingProperties, paragraphNode, pos, e
|
|
|
33462
33488
|
}
|
|
33463
33489
|
tr.setNodeMarkup(pos, null, newAttrs);
|
|
33464
33490
|
}
|
|
33465
|
-
const generateNewListDefinition = ({ numId, listType, level, start: start2, text, fmt, editor }) => {
|
|
33491
|
+
const generateNewListDefinition = ({ numId, listType, level, start: start2, text, fmt, editor, markerFontFamily }) => {
|
|
33466
33492
|
if (typeof listType !== "string") listType = listType.name;
|
|
33467
33493
|
const definition = listType === "orderedList" ? baseOrderedListDef : baseBulletList;
|
|
33468
33494
|
const numbering = editor.converter.numbering;
|
|
@@ -33516,6 +33542,29 @@ const generateNewListDefinition = ({ numId, listType, level, start: start2, text
|
|
|
33516
33542
|
}
|
|
33517
33543
|
}
|
|
33518
33544
|
];
|
|
33545
|
+
if (markerFontFamily) {
|
|
33546
|
+
const rPrIndex = levelProps.elements.findIndex((el) => el.name === "w:rPr");
|
|
33547
|
+
let rPr = levelProps.elements[rPrIndex];
|
|
33548
|
+
if (!rPr) {
|
|
33549
|
+
rPr = {
|
|
33550
|
+
type: "element",
|
|
33551
|
+
name: "w:rPr",
|
|
33552
|
+
elements: []
|
|
33553
|
+
};
|
|
33554
|
+
levelProps.elements.push(rPr);
|
|
33555
|
+
}
|
|
33556
|
+
rPr.elements = rPr.elements.filter((el) => el.name !== "w:rFonts");
|
|
33557
|
+
rPr.elements.push({
|
|
33558
|
+
type: "element",
|
|
33559
|
+
name: "w:rFonts",
|
|
33560
|
+
attributes: {
|
|
33561
|
+
"w:ascii": markerFontFamily,
|
|
33562
|
+
"w:hAnsi": markerFontFamily,
|
|
33563
|
+
"w:eastAsia": markerFontFamily,
|
|
33564
|
+
"w:cs": markerFontFamily
|
|
33565
|
+
}
|
|
33566
|
+
});
|
|
33567
|
+
}
|
|
33519
33568
|
}
|
|
33520
33569
|
if (!skipAddingNewAbstract) newNumbering.abstracts[newAbstractId] = newAbstractDef;
|
|
33521
33570
|
const newNumDef = getBasicNumIdTag(numId, newAbstractId);
|
|
@@ -33782,8 +33831,8 @@ const extractListLevelStyles = (cssText, listId, level, numId) => {
|
|
|
33782
33831
|
}
|
|
33783
33832
|
return styleMap;
|
|
33784
33833
|
};
|
|
33785
|
-
const extractParagraphStyles = (cssText,
|
|
33786
|
-
const pattern = new RegExp(
|
|
33834
|
+
const extractParagraphStyles = (cssText, selector) => {
|
|
33835
|
+
const pattern = new RegExp(`(${selector})\\s*\\{([^}]+)\\}`, "i");
|
|
33787
33836
|
const match = cssText.match(pattern);
|
|
33788
33837
|
if (!match) return null;
|
|
33789
33838
|
const rawStyles = match[2].split(";").map((line) => line.trim()).filter(Boolean);
|
|
@@ -33898,7 +33947,7 @@ const handleDocxPaste = (html, editor, view) => {
|
|
|
33898
33947
|
cleanedHtml = cleanHtmlUnnecessaryTags(cleanedHtml);
|
|
33899
33948
|
const tempDiv = document.createElement("div");
|
|
33900
33949
|
tempDiv.innerHTML = cleanedHtml;
|
|
33901
|
-
const data = tempDiv.querySelectorAll("p, li");
|
|
33950
|
+
const data = tempDiv.querySelectorAll("p, li, " + [1, 2, 3, 4, 5, 6, 7, 8, 9].map((n) => `h${n}`).join(", "));
|
|
33902
33951
|
const startMap = {};
|
|
33903
33952
|
data.forEach((item) => {
|
|
33904
33953
|
let type2;
|
|
@@ -33910,13 +33959,24 @@ const handleDocxPaste = (html, editor, view) => {
|
|
|
33910
33959
|
const styleAttr = item.getAttribute("style") || "";
|
|
33911
33960
|
const msoListMatch = styleAttr.match(/mso-list:\s*l(\d+)\s+level(\d+)\s+lfo(\d+)/);
|
|
33912
33961
|
const css = tempDiv.querySelector("style").innerHTML;
|
|
33913
|
-
const normalStyles = extractParagraphStyles(css, "MsoNormal");
|
|
33914
|
-
|
|
33915
|
-
let
|
|
33962
|
+
const normalStyles = extractParagraphStyles(css, ".MsoNormal");
|
|
33963
|
+
let styleId = item.getAttribute("class");
|
|
33964
|
+
let charStyles = {};
|
|
33965
|
+
if (item.localName.startsWith("h") && !styleId) {
|
|
33966
|
+
styleId = item.localName;
|
|
33967
|
+
const level = styleId.substring(1);
|
|
33968
|
+
charStyles = extractParagraphStyles(css, `.Heading${level}Char`);
|
|
33969
|
+
} else if (styleId) {
|
|
33970
|
+
styleId = `.${styleId}`;
|
|
33971
|
+
}
|
|
33972
|
+
const paragraphStyles = extractParagraphStyles(css, styleId);
|
|
33973
|
+
let styleChain = { ...normalStyles, ...paragraphStyles, ...charStyles };
|
|
33916
33974
|
const numberingDefinedInline = !paragraphStyles || !paragraphStyles["mso-list"];
|
|
33917
33975
|
if (msoListMatch) {
|
|
33918
33976
|
const [, abstractId, level, numId] = msoListMatch;
|
|
33919
33977
|
const numberingStyles = extractListLevelStyles(css, abstractId, level, numId) || {};
|
|
33978
|
+
const markerFontFamily = numberingStyles?.["font-family"] ?? normalStyles?.["font-family"];
|
|
33979
|
+
delete numberingStyles["font-family"];
|
|
33920
33980
|
if (numberingDefinedInline) {
|
|
33921
33981
|
styleChain = { ...normalStyles, ...paragraphStyles, ...numberingStyles };
|
|
33922
33982
|
} else {
|
|
@@ -33939,6 +33999,7 @@ const handleDocxPaste = (html, editor, view) => {
|
|
|
33939
33999
|
if (!startMap[numId]) startMap[numId] = startGetter(item.children[0]?.innerText || "1");
|
|
33940
34000
|
start2 = startMap[numId];
|
|
33941
34001
|
}
|
|
34002
|
+
item.setAttribute("data-marker-font-family", markerFontFamily);
|
|
33942
34003
|
item.setAttribute("data-num-id", numId);
|
|
33943
34004
|
item.setAttribute("data-list-level", parseInt(level) - 1);
|
|
33944
34005
|
item.setAttribute("data-start", start2);
|
|
@@ -33987,6 +34048,24 @@ const handleDocxPaste = (html, editor, view) => {
|
|
|
33987
34048
|
}
|
|
33988
34049
|
});
|
|
33989
34050
|
item.setAttribute("data-text-styles", JSON.stringify(textStyles));
|
|
34051
|
+
for (const child of item.children) {
|
|
34052
|
+
if (child.style) {
|
|
34053
|
+
Object.keys(textStyles).forEach((key2) => {
|
|
34054
|
+
const styleValue = textStyles[key2];
|
|
34055
|
+
if (styleValue) {
|
|
34056
|
+
child.style[key2] = styleValue;
|
|
34057
|
+
}
|
|
34058
|
+
});
|
|
34059
|
+
}
|
|
34060
|
+
}
|
|
34061
|
+
}
|
|
34062
|
+
if (resolvedStyle["font-weight"] === "bold") {
|
|
34063
|
+
item.style.fontWeight = "bold";
|
|
34064
|
+
for (const child of item.children) {
|
|
34065
|
+
if (child.style) {
|
|
34066
|
+
child.style.fontWeight = "bold";
|
|
34067
|
+
}
|
|
34068
|
+
}
|
|
33990
34069
|
}
|
|
33991
34070
|
extractAndRemoveConditionalPrefix(item);
|
|
33992
34071
|
});
|
|
@@ -34030,6 +34109,7 @@ const transformWordLists = (container, editor) => {
|
|
|
34030
34109
|
const numFmt = item.getAttribute("data-num-fmt");
|
|
34031
34110
|
const start2 = item.getAttribute("data-start");
|
|
34032
34111
|
const lvlText = item.getAttribute("data-lvl-text");
|
|
34112
|
+
const markerFontFamily = item.getAttribute("data-marker-font-family");
|
|
34033
34113
|
const importedId = item.getAttribute("data-num-id");
|
|
34034
34114
|
if (!mappedLists[importedId]) mappedLists[importedId] = ListHelpers.getNewListId(editor);
|
|
34035
34115
|
const id = mappedLists[importedId];
|
|
@@ -34041,7 +34121,8 @@ const transformWordLists = (container, editor) => {
|
|
|
34041
34121
|
start: start2,
|
|
34042
34122
|
fmt: numFmt,
|
|
34043
34123
|
text: lvlText,
|
|
34044
|
-
editor
|
|
34124
|
+
editor,
|
|
34125
|
+
markerFontFamily
|
|
34045
34126
|
});
|
|
34046
34127
|
if (!lists[id]) lists[id] = { levels: {} };
|
|
34047
34128
|
const currentListByNumId = lists[id];
|
|
@@ -34074,6 +34155,11 @@ const transformWordLists = (container, editor) => {
|
|
|
34074
34155
|
const styleValue = textStyles[key2];
|
|
34075
34156
|
if (styleValue) {
|
|
34076
34157
|
pElement.style[key2] = styleValue;
|
|
34158
|
+
for (const child of pElement.children) {
|
|
34159
|
+
if (child.style) {
|
|
34160
|
+
child.style[key2] = styleValue;
|
|
34161
|
+
}
|
|
34162
|
+
}
|
|
34077
34163
|
}
|
|
34078
34164
|
});
|
|
34079
34165
|
}
|
|
@@ -36407,11 +36493,71 @@ function translateShapeGroup(params2) {
|
|
|
36407
36493
|
elements: []
|
|
36408
36494
|
});
|
|
36409
36495
|
}
|
|
36496
|
+
function mergeDrawingChildren({ order: order2, generated, original }) {
|
|
36497
|
+
const genQueues = groupByName(generated);
|
|
36498
|
+
const originalsByIndex = groupByIndex(original);
|
|
36499
|
+
return mergeWithOrder(order2, genQueues, originalsByIndex);
|
|
36500
|
+
}
|
|
36501
|
+
function groupByIndex(entries = []) {
|
|
36502
|
+
const map3 = /* @__PURE__ */ new Map();
|
|
36503
|
+
entries.forEach((entry) => {
|
|
36504
|
+
if (!entry) return;
|
|
36505
|
+
const { index: index2, xml } = entry;
|
|
36506
|
+
if (typeof index2 === "number" && xml && xml.name !== "wp:extent") {
|
|
36507
|
+
map3.set(index2, carbonCopy(xml));
|
|
36508
|
+
}
|
|
36509
|
+
});
|
|
36510
|
+
return map3;
|
|
36511
|
+
}
|
|
36512
|
+
function mergeWithOrder(order2 = [], genQueues, originalsByIndex) {
|
|
36513
|
+
const out = [];
|
|
36514
|
+
const namesInOrder = new Set(order2);
|
|
36515
|
+
order2.forEach((name, idx) => {
|
|
36516
|
+
if (name === "wp:extent") {
|
|
36517
|
+
const queue3 = genQueues.get("wp:extent") || [];
|
|
36518
|
+
if (queue3.length) {
|
|
36519
|
+
out.push(queue3.shift());
|
|
36520
|
+
if (!queue3.length) genQueues.delete("wp:extent");
|
|
36521
|
+
}
|
|
36522
|
+
return;
|
|
36523
|
+
}
|
|
36524
|
+
if (originalsByIndex.has(idx)) {
|
|
36525
|
+
out.push(originalsByIndex.get(idx));
|
|
36526
|
+
originalsByIndex.delete(idx);
|
|
36527
|
+
if (genQueues.has(name)) {
|
|
36528
|
+
genQueues.delete(name);
|
|
36529
|
+
}
|
|
36530
|
+
return;
|
|
36531
|
+
}
|
|
36532
|
+
const queue2 = genQueues.get(name) || [];
|
|
36533
|
+
if (queue2.length) {
|
|
36534
|
+
out.push(queue2.shift());
|
|
36535
|
+
if (!queue2.length) genQueues.delete(name);
|
|
36536
|
+
}
|
|
36537
|
+
});
|
|
36538
|
+
originalsByIndex.forEach((xml) => out.push(xml));
|
|
36539
|
+
genQueues.forEach((queue2, name) => {
|
|
36540
|
+
if (namesInOrder.has(name)) return;
|
|
36541
|
+
queue2.forEach((el) => out.push(el));
|
|
36542
|
+
});
|
|
36543
|
+
return out;
|
|
36544
|
+
}
|
|
36545
|
+
function groupByName(nodes = []) {
|
|
36546
|
+
const map3 = /* @__PURE__ */ new Map();
|
|
36547
|
+
nodes.forEach((el) => {
|
|
36548
|
+
if (!el?.name) return;
|
|
36549
|
+
const list = map3.get(el.name) || [];
|
|
36550
|
+
list.push(carbonCopy(el));
|
|
36551
|
+
map3.set(el.name, list);
|
|
36552
|
+
});
|
|
36553
|
+
return map3;
|
|
36554
|
+
}
|
|
36410
36555
|
function translateAnchorNode(params2) {
|
|
36411
36556
|
const { attrs } = params2.node;
|
|
36412
36557
|
const anchorElements = [];
|
|
36413
|
-
const
|
|
36414
|
-
|
|
36558
|
+
const useOriginalChildren = Array.isArray(attrs.originalDrawingChildren) && attrs.originalDrawingChildren.length > 0;
|
|
36559
|
+
const hasSimplePos = attrs.simplePos !== void 0 || attrs.originalAttributes?.simplePos !== void 0;
|
|
36560
|
+
if (!useOriginalChildren && hasSimplePos) {
|
|
36415
36561
|
anchorElements.push({
|
|
36416
36562
|
name: "wp:simplePos",
|
|
36417
36563
|
attributes: {
|
|
@@ -36420,7 +36566,7 @@ function translateAnchorNode(params2) {
|
|
|
36420
36566
|
}
|
|
36421
36567
|
});
|
|
36422
36568
|
}
|
|
36423
|
-
if (attrs.anchorData) {
|
|
36569
|
+
if (!useOriginalChildren && attrs.anchorData) {
|
|
36424
36570
|
const hElements = [];
|
|
36425
36571
|
if (attrs.marginOffset.horizontal !== void 0) {
|
|
36426
36572
|
hElements.push({
|
|
@@ -36466,25 +36612,14 @@ function translateAnchorNode(params2) {
|
|
|
36466
36612
|
if (inlineAttrs.relativeHeight == null) {
|
|
36467
36613
|
inlineAttrs.relativeHeight = 1;
|
|
36468
36614
|
}
|
|
36469
|
-
if (attrs.originalAttributes?.simplePos
|
|
36470
|
-
inlineAttrs.simplePos = attrs.originalAttributes.simplePos;
|
|
36471
|
-
} else if (hasSimplePos) {
|
|
36615
|
+
if (attrs.originalAttributes?.simplePos === void 0 && hasSimplePos) {
|
|
36472
36616
|
inlineAttrs.simplePos = "1";
|
|
36473
36617
|
}
|
|
36474
|
-
if (attrs.originalAttributes?.locked !== void 0) {
|
|
36475
|
-
inlineAttrs.locked = attrs.originalAttributes.locked;
|
|
36476
|
-
}
|
|
36477
|
-
if (attrs.originalAttributes?.layoutInCell !== void 0) {
|
|
36478
|
-
inlineAttrs.layoutInCell = attrs.originalAttributes.layoutInCell;
|
|
36479
|
-
}
|
|
36480
|
-
if (attrs.originalAttributes?.allowOverlap !== void 0) {
|
|
36481
|
-
inlineAttrs.allowOverlap = attrs.originalAttributes.allowOverlap;
|
|
36482
|
-
}
|
|
36483
36618
|
const wrapElement = {
|
|
36484
36619
|
name: `wp:wrap${attrs.wrap?.type || "None"}`
|
|
36485
36620
|
// Important: wp:anchor will break if no wrapping is specified. We need to use wrapNone.
|
|
36486
36621
|
};
|
|
36487
|
-
switch (attrs.wrap?.type) {
|
|
36622
|
+
switch (useOriginalChildren ? void 0 : attrs.wrap?.type) {
|
|
36488
36623
|
case "Square":
|
|
36489
36624
|
wrapElement.attributes = {
|
|
36490
36625
|
wrapText: attrs.wrap.attrs.wrapText
|
|
@@ -36564,15 +36699,33 @@ function translateAnchorNode(params2) {
|
|
|
36564
36699
|
wrapElement,
|
|
36565
36700
|
...nodeElements.elements.slice(effectIndex + 1)
|
|
36566
36701
|
];
|
|
36702
|
+
const mergedElements = mergeDrawingChildren({
|
|
36703
|
+
order: attrs.drawingChildOrder || [],
|
|
36704
|
+
original: attrs.originalDrawingChildren || [],
|
|
36705
|
+
generated: [...anchorElements, ...elementsWithWrap]
|
|
36706
|
+
});
|
|
36567
36707
|
return {
|
|
36568
36708
|
name: "wp:anchor",
|
|
36569
36709
|
attributes: inlineAttrs,
|
|
36570
|
-
elements:
|
|
36710
|
+
elements: mergedElements
|
|
36571
36711
|
};
|
|
36572
36712
|
}
|
|
36573
36713
|
const XML_NODE_NAME$f = "wp:anchor";
|
|
36574
36714
|
const SD_NODE_NAME$d = ["image", "shapeGroup", "vectorShape", "contentBlock"];
|
|
36575
|
-
const validXmlAttributes$
|
|
36715
|
+
const validXmlAttributes$6 = [
|
|
36716
|
+
"distT",
|
|
36717
|
+
"distB",
|
|
36718
|
+
"distL",
|
|
36719
|
+
"distR",
|
|
36720
|
+
"allowOverlap",
|
|
36721
|
+
"behindDoc",
|
|
36722
|
+
"layoutInCell",
|
|
36723
|
+
"locked",
|
|
36724
|
+
"relativeHeight",
|
|
36725
|
+
"simplePos",
|
|
36726
|
+
"wp14:anchorId",
|
|
36727
|
+
"wp14:editId"
|
|
36728
|
+
].map((xmlName) => createAttributeHandler(xmlName));
|
|
36576
36729
|
function encode$l(params2) {
|
|
36577
36730
|
const { node } = params2.extraParams;
|
|
36578
36731
|
if (!node || !node.name) {
|
|
@@ -36593,7 +36746,7 @@ const config$e = {
|
|
|
36593
36746
|
type: NodeTranslator.translatorTypes.NODE,
|
|
36594
36747
|
encode: encode$l,
|
|
36595
36748
|
decode: decode$n,
|
|
36596
|
-
attributes: validXmlAttributes$
|
|
36749
|
+
attributes: validXmlAttributes$6
|
|
36597
36750
|
};
|
|
36598
36751
|
const translator$u = NodeTranslator.from(config$e);
|
|
36599
36752
|
function handleInlineNode(params2) {
|
|
@@ -36604,16 +36757,29 @@ function handleInlineNode(params2) {
|
|
|
36604
36757
|
return handleImageNode$1(node, params2, false);
|
|
36605
36758
|
}
|
|
36606
36759
|
function translateInlineNode(params2) {
|
|
36760
|
+
const { attrs } = params2.node;
|
|
36607
36761
|
const nodeElements = translateImageNode(params2);
|
|
36762
|
+
const inlineAttrs = {
|
|
36763
|
+
...attrs.originalAttributes || {},
|
|
36764
|
+
...nodeElements.attributes || {}
|
|
36765
|
+
};
|
|
36766
|
+
const generatedElements = nodeElements?.elements || [];
|
|
36767
|
+
const mergedElements = mergeDrawingChildren({
|
|
36768
|
+
order: params2.node?.attrs?.drawingChildOrder || [],
|
|
36769
|
+
original: params2.node?.attrs?.originalDrawingChildren || [],
|
|
36770
|
+
generated: generatedElements
|
|
36771
|
+
});
|
|
36608
36772
|
return {
|
|
36609
36773
|
name: "wp:inline",
|
|
36610
|
-
attributes:
|
|
36611
|
-
elements:
|
|
36774
|
+
attributes: inlineAttrs,
|
|
36775
|
+
elements: mergedElements
|
|
36612
36776
|
};
|
|
36613
36777
|
}
|
|
36614
36778
|
const XML_NODE_NAME$e = "wp:inline";
|
|
36615
36779
|
const SD_NODE_NAME$c = ["image", "shapeGroup", "vectorShape", "contentBlock"];
|
|
36616
|
-
const validXmlAttributes$
|
|
36780
|
+
const validXmlAttributes$5 = ["distT", "distB", "distL", "distR", "wp14:anchorId", "wp14:editId"].map(
|
|
36781
|
+
(xmlName) => createAttributeHandler(xmlName)
|
|
36782
|
+
);
|
|
36617
36783
|
function encode$k(params2) {
|
|
36618
36784
|
const { node } = params2.extraParams;
|
|
36619
36785
|
if (!node || !node.name) {
|
|
@@ -36634,12 +36800,12 @@ const config$d = {
|
|
|
36634
36800
|
type: NodeTranslator.translatorTypes.NODE,
|
|
36635
36801
|
encode: encode$k,
|
|
36636
36802
|
decode: decode$m,
|
|
36637
|
-
attributes: validXmlAttributes$
|
|
36803
|
+
attributes: validXmlAttributes$5
|
|
36638
36804
|
};
|
|
36639
36805
|
const translator$t = NodeTranslator.from(config$d);
|
|
36640
36806
|
const XML_NODE_NAME$d = "w:drawing";
|
|
36641
36807
|
const SD_NODE_NAME$b = [];
|
|
36642
|
-
const validXmlAttributes$
|
|
36808
|
+
const validXmlAttributes$4 = [];
|
|
36643
36809
|
function encode$j(params2) {
|
|
36644
36810
|
const nodes = params2.nodes;
|
|
36645
36811
|
const node = nodes[0];
|
|
@@ -36647,14 +36813,21 @@ function encode$j(params2) {
|
|
|
36647
36813
|
"wp:anchor": translator$u,
|
|
36648
36814
|
"wp:inline": translator$t
|
|
36649
36815
|
};
|
|
36650
|
-
const result = node.elements.reduce((acc, child) => {
|
|
36816
|
+
const result = (node.elements || []).reduce((acc, child) => {
|
|
36651
36817
|
if (acc) return acc;
|
|
36652
36818
|
const translator2 = translatorByChildName[child.name];
|
|
36653
36819
|
if (!translator2) return acc;
|
|
36654
36820
|
const childResult = translator2.encode({ ...params2, extraParams: { node: child } });
|
|
36655
36821
|
return childResult || acc;
|
|
36656
36822
|
}, null);
|
|
36657
|
-
return result;
|
|
36823
|
+
if (result) return result;
|
|
36824
|
+
return {
|
|
36825
|
+
type: "passthroughBlock",
|
|
36826
|
+
attrs: {
|
|
36827
|
+
originalName: "w:drawing",
|
|
36828
|
+
originalXml: carbonCopy(node)
|
|
36829
|
+
}
|
|
36830
|
+
};
|
|
36658
36831
|
}
|
|
36659
36832
|
function decode$l(params2) {
|
|
36660
36833
|
const { node } = params2;
|
|
@@ -36677,7 +36850,7 @@ const config$c = {
|
|
|
36677
36850
|
type: NodeTranslator.translatorTypes.NODE,
|
|
36678
36851
|
encode: encode$j,
|
|
36679
36852
|
decode: decode$l,
|
|
36680
|
-
attributes: validXmlAttributes$
|
|
36853
|
+
attributes: validXmlAttributes$4
|
|
36681
36854
|
};
|
|
36682
36855
|
const translator$s = NodeTranslator.from(config$c);
|
|
36683
36856
|
function getTextNodeForExport(text, marks, params2) {
|
|
@@ -37508,7 +37681,7 @@ function generateSdtPrTagForStructuredContent({ node }) {
|
|
|
37508
37681
|
}
|
|
37509
37682
|
const XML_NODE_NAME$c = "w:sdt";
|
|
37510
37683
|
const SD_NODE_NAME$a = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
|
|
37511
|
-
const validXmlAttributes$
|
|
37684
|
+
const validXmlAttributes$3 = [];
|
|
37512
37685
|
function encode$i(params2) {
|
|
37513
37686
|
const nodes = params2.nodes;
|
|
37514
37687
|
const node = nodes[0];
|
|
@@ -37543,7 +37716,7 @@ const config$b = {
|
|
|
37543
37716
|
type: NodeTranslator.translatorTypes.NODE,
|
|
37544
37717
|
encode: encode$i,
|
|
37545
37718
|
decode: decode$k,
|
|
37546
|
-
attributes: validXmlAttributes$
|
|
37719
|
+
attributes: validXmlAttributes$3
|
|
37547
37720
|
};
|
|
37548
37721
|
const translator$r = NodeTranslator.from(config$b);
|
|
37549
37722
|
function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
@@ -38178,7 +38351,7 @@ const attrConfig$3 = Object.freeze({
|
|
|
38178
38351
|
encode: encode$b,
|
|
38179
38352
|
decode: decode$d
|
|
38180
38353
|
});
|
|
38181
|
-
const
|
|
38354
|
+
const bookmarkStartAttrConfigs = [attrConfig$7, attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3];
|
|
38182
38355
|
const XML_NODE_NAME$9 = "w:bookmarkStart";
|
|
38183
38356
|
const SD_NODE_NAME$8 = "bookmarkStart";
|
|
38184
38357
|
const encode$a = (params2, encodedAttrs = {}) => {
|
|
@@ -38203,7 +38376,7 @@ const config$8 = {
|
|
|
38203
38376
|
type: NodeTranslator.translatorTypes.NODE,
|
|
38204
38377
|
encode: encode$a,
|
|
38205
38378
|
decode: decode$c,
|
|
38206
|
-
attributes:
|
|
38379
|
+
attributes: bookmarkStartAttrConfigs
|
|
38207
38380
|
};
|
|
38208
38381
|
const translator$8 = NodeTranslator.from(config$8);
|
|
38209
38382
|
const encode$9 = (attributes) => {
|
|
@@ -38230,7 +38403,7 @@ const attrConfig$1 = Object.freeze({
|
|
|
38230
38403
|
encode: encode$8,
|
|
38231
38404
|
decode: decode$a
|
|
38232
38405
|
});
|
|
38233
|
-
const
|
|
38406
|
+
const bookmarkEndAttrConfigs = [attrConfig$2, attrConfig$1];
|
|
38234
38407
|
const XML_NODE_NAME$8 = "w:bookmarkEnd";
|
|
38235
38408
|
const SD_NODE_NAME$7 = "bookmarkEnd";
|
|
38236
38409
|
const encode$7 = (params2, encodedAttrs = {}) => {
|
|
@@ -38255,7 +38428,7 @@ const config$7 = {
|
|
|
38255
38428
|
type: NodeTranslator.translatorTypes.NODE,
|
|
38256
38429
|
encode: encode$7,
|
|
38257
38430
|
decode: decode$9,
|
|
38258
|
-
attributes:
|
|
38431
|
+
attributes: bookmarkEndAttrConfigs
|
|
38259
38432
|
};
|
|
38260
38433
|
const translator$7 = NodeTranslator.from(config$7);
|
|
38261
38434
|
const decode$8 = (attrs) => attrs?.["w:id"];
|
|
@@ -39221,7 +39394,8 @@ const INLINE_NODE_NAMES = /* @__PURE__ */ new Set([
|
|
|
39221
39394
|
]);
|
|
39222
39395
|
const BLOCK_BOUNDARY_NAMES = /* @__PURE__ */ new Set(["w:body", "w:tbl", "w:tc", "w:tr"]);
|
|
39223
39396
|
const isInlineContext = (path = [], currentNodeName) => {
|
|
39224
|
-
|
|
39397
|
+
const immediateName = currentNodeName ?? path[path.length - 1]?.name;
|
|
39398
|
+
if (immediateName && INLINE_NODE_NAMES.has(immediateName)) {
|
|
39225
39399
|
return true;
|
|
39226
39400
|
}
|
|
39227
39401
|
if (!Array.isArray(path) || path.length === 0) return false;
|
|
@@ -40084,27 +40258,28 @@ const preProcessNodesForFldChar = (nodes = [], docx) => {
|
|
|
40084
40258
|
const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
|
|
40085
40259
|
const fldType = fldCharEl?.attributes?.["w:fldCharType"];
|
|
40086
40260
|
const instrTextEl = node.elements?.find((el) => el.name === "w:instrText");
|
|
40261
|
+
const rawNode = carbonCopy(node);
|
|
40087
40262
|
collecting = collectedNodesStack.length > 0;
|
|
40088
40263
|
if (fldType === "begin") {
|
|
40089
40264
|
collectedNodesStack.push([]);
|
|
40090
|
-
rawCollectedNodesStack.push([
|
|
40265
|
+
rawCollectedNodesStack.push([rawNode]);
|
|
40091
40266
|
currentFieldStack.push({ instrText: "" });
|
|
40092
40267
|
continue;
|
|
40093
40268
|
}
|
|
40094
40269
|
if (instrTextEl && collecting && currentFieldStack.length > 0) {
|
|
40095
|
-
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(
|
|
40270
|
+
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
|
|
40096
40271
|
currentFieldStack[currentFieldStack.length - 1].instrText += (instrTextEl.elements?.[0]?.text || "") + " ";
|
|
40097
40272
|
continue;
|
|
40098
40273
|
}
|
|
40099
40274
|
if (fldType === "end") {
|
|
40100
40275
|
if (collecting) {
|
|
40101
|
-
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(
|
|
40276
|
+
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
|
|
40102
40277
|
}
|
|
40103
40278
|
finalizeField();
|
|
40104
40279
|
continue;
|
|
40105
40280
|
} else if (fldType === "separate") {
|
|
40106
40281
|
if (collecting) {
|
|
40107
|
-
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(
|
|
40282
|
+
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
|
|
40108
40283
|
}
|
|
40109
40284
|
continue;
|
|
40110
40285
|
}
|
|
@@ -40115,21 +40290,21 @@ const preProcessNodesForFldChar = (nodes = [], docx) => {
|
|
|
40115
40290
|
childResult.unpairedBegin.forEach((pendingField) => {
|
|
40116
40291
|
currentFieldStack.push(pendingField.fieldInfo);
|
|
40117
40292
|
collectedNodesStack.push([node]);
|
|
40118
|
-
rawCollectedNodesStack.push([
|
|
40293
|
+
rawCollectedNodesStack.push([rawNode]);
|
|
40119
40294
|
});
|
|
40120
40295
|
} else if (childResult.unpairedEnd) {
|
|
40121
40296
|
collectedNodesStack[collectedNodesStack.length - 1].push(node);
|
|
40122
|
-
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(
|
|
40297
|
+
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
|
|
40123
40298
|
finalizeField();
|
|
40124
40299
|
} else if (collecting) {
|
|
40125
40300
|
collectedNodesStack[collectedNodesStack.length - 1].push(node);
|
|
40126
|
-
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(
|
|
40301
|
+
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
|
|
40127
40302
|
} else {
|
|
40128
40303
|
processedNodes.push(node);
|
|
40129
40304
|
}
|
|
40130
40305
|
} else if (collecting) {
|
|
40131
40306
|
collectedNodesStack[collectedNodesStack.length - 1].push(node);
|
|
40132
|
-
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(
|
|
40307
|
+
rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
|
|
40133
40308
|
} else {
|
|
40134
40309
|
processedNodes.push(node);
|
|
40135
40310
|
}
|
|
@@ -40734,8 +40909,48 @@ function filterOutRootInlineNodes(content = []) {
|
|
|
40734
40909
|
"commentReference",
|
|
40735
40910
|
"structuredContent"
|
|
40736
40911
|
]);
|
|
40737
|
-
|
|
40912
|
+
const PRESERVABLE_INLINE_XML_NAMES = {
|
|
40913
|
+
bookmarkStart: "w:bookmarkStart",
|
|
40914
|
+
bookmarkEnd: "w:bookmarkEnd"
|
|
40915
|
+
};
|
|
40916
|
+
const result = [];
|
|
40917
|
+
content.forEach((node) => {
|
|
40918
|
+
if (!node || typeof node.type !== "string") return;
|
|
40919
|
+
const type2 = node.type;
|
|
40920
|
+
const preservableNodeName = PRESERVABLE_INLINE_XML_NAMES[type2];
|
|
40921
|
+
if (!INLINE_TYPES.has(type2)) {
|
|
40922
|
+
result.push(node);
|
|
40923
|
+
} else if (preservableNodeName) {
|
|
40924
|
+
const originalXml = buildOriginalXml(type2, node.attrs, PRESERVABLE_INLINE_XML_NAMES);
|
|
40925
|
+
result.push({
|
|
40926
|
+
type: "passthroughBlock",
|
|
40927
|
+
attrs: {
|
|
40928
|
+
originalName: preservableNodeName,
|
|
40929
|
+
...originalXml ? { originalXml } : {}
|
|
40930
|
+
}
|
|
40931
|
+
});
|
|
40932
|
+
}
|
|
40933
|
+
});
|
|
40934
|
+
return result;
|
|
40738
40935
|
}
|
|
40936
|
+
const buildOriginalXml = (type2, attrs, preservableTags) => {
|
|
40937
|
+
const attrConfigsByType = {
|
|
40938
|
+
bookmarkStart: bookmarkStartAttrConfigs,
|
|
40939
|
+
bookmarkEnd: bookmarkEndAttrConfigs
|
|
40940
|
+
};
|
|
40941
|
+
const configs = attrConfigsByType[type2];
|
|
40942
|
+
if (!configs) return null;
|
|
40943
|
+
const xmlAttrs = {};
|
|
40944
|
+
configs.forEach((cfg) => {
|
|
40945
|
+
const val = cfg.decode(attrs || {});
|
|
40946
|
+
if (val !== void 0) {
|
|
40947
|
+
xmlAttrs[cfg.xmlName] = val;
|
|
40948
|
+
}
|
|
40949
|
+
});
|
|
40950
|
+
const attributes = Object.keys(xmlAttrs).length ? xmlAttrs : void 0;
|
|
40951
|
+
const name = preservableTags[type2];
|
|
40952
|
+
return { name, ...attributes ? { attributes } : {}, elements: [] };
|
|
40953
|
+
};
|
|
40739
40954
|
function collapseWhitespaceNextToInlinePassthrough(content = []) {
|
|
40740
40955
|
if (!Array.isArray(content) || content.length === 0) return;
|
|
40741
40956
|
const sequence = collectInlineSequence(content);
|
|
@@ -41867,7 +42082,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
41867
42082
|
static getStoredSuperdocVersion(docx) {
|
|
41868
42083
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
41869
42084
|
}
|
|
41870
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
42085
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.54") {
|
|
41871
42086
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
41872
42087
|
}
|
|
41873
42088
|
/**
|
|
@@ -44940,19 +45155,24 @@ class DocxZipper {
|
|
|
44940
45155
|
const u8 = await zipEntry.async("uint8array");
|
|
44941
45156
|
const content = ensureXmlString(u8);
|
|
44942
45157
|
this.files.push({ name, content });
|
|
44943
|
-
} else if (name.startsWith("word/media") && name !== "word/media/" || zipEntry.name.startsWith("media") && zipEntry.name !== "media/" || name.startsWith("media") && name !== "media/") {
|
|
45158
|
+
} else if (name.startsWith("word/media") && name !== "word/media/" || zipEntry.name.startsWith("media") && zipEntry.name !== "media/" || name.startsWith("media") && name !== "media/" || name.startsWith("word/embeddings") && name !== "word/embeddings/") {
|
|
44944
45159
|
if (isNode2) {
|
|
44945
45160
|
const buffer2 = await zipEntry.async("nodebuffer");
|
|
44946
45161
|
const fileBase64 = buffer2.toString("base64");
|
|
44947
45162
|
this.mediaFiles[name] = fileBase64;
|
|
44948
45163
|
} else {
|
|
44949
|
-
const blob = await zipEntry.async("blob");
|
|
44950
|
-
const extension = this.getFileExtension(name);
|
|
44951
45164
|
const fileBase64 = await zipEntry.async("base64");
|
|
44952
|
-
this.
|
|
44953
|
-
const
|
|
44954
|
-
|
|
44955
|
-
|
|
45165
|
+
const extension = this.getFileExtension(name)?.toLowerCase();
|
|
45166
|
+
const imageTypes = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "bmp", "tiff", "emf", "wmf", "svg", "webp"]);
|
|
45167
|
+
if (imageTypes.has(extension)) {
|
|
45168
|
+
this.mediaFiles[name] = `data:image/${extension};base64,${fileBase64}`;
|
|
45169
|
+
const blob = await zipEntry.async("blob");
|
|
45170
|
+
const fileObj = new File([blob], name, { type: blob.type });
|
|
45171
|
+
const imageUrl = URL.createObjectURL(fileObj);
|
|
45172
|
+
this.media[name] = imageUrl;
|
|
45173
|
+
} else {
|
|
45174
|
+
this.mediaFiles[name] = fileBase64;
|
|
45175
|
+
}
|
|
44956
45176
|
}
|
|
44957
45177
|
} else if (name.startsWith("word/fonts") && name !== "word/fonts/") {
|
|
44958
45178
|
const uint8array = await zipEntry.async("uint8array");
|
|
@@ -44971,9 +45191,8 @@ class DocxZipper {
|
|
|
44971
45191
|
*/
|
|
44972
45192
|
async updateContentTypes(docx, media, fromJson, updatedDocs = {}) {
|
|
44973
45193
|
const additionalPartNames = Object.keys(updatedDocs || {});
|
|
44974
|
-
const
|
|
44975
|
-
|
|
44976
|
-
}).filter(Boolean);
|
|
45194
|
+
const imageExts = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "bmp", "tiff", "emf", "wmf", "svg", "webp"]);
|
|
45195
|
+
const newMediaTypes = Object.keys(media).map((name) => this.getFileExtension(name)).filter((ext) => ext && imageExts.has(ext));
|
|
44977
45196
|
const contentTypesPath = "[Content_Types].xml";
|
|
44978
45197
|
let contentTypesXml;
|
|
44979
45198
|
if (fromJson) {
|
|
@@ -59045,7 +59264,7 @@ const isHeadless = (editor) => {
|
|
|
59045
59264
|
const shouldSkipNodeView = (editor) => {
|
|
59046
59265
|
return isHeadless(editor);
|
|
59047
59266
|
};
|
|
59048
|
-
const summaryVersion = "1.0.0-beta.
|
|
59267
|
+
const summaryVersion = "1.0.0-beta.54";
|
|
59049
59268
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
59050
59269
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
59051
59270
|
function mapAttributes(attrs) {
|
|
@@ -59834,7 +60053,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
59834
60053
|
{ default: remarkStringify },
|
|
59835
60054
|
{ default: remarkGfm }
|
|
59836
60055
|
] = await Promise.all([
|
|
59837
|
-
Promise.resolve().then(() => require("./index-
|
|
60056
|
+
Promise.resolve().then(() => require("./index-t8thQIOL-CV8VTGI4.cjs")),
|
|
59838
60057
|
Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
|
|
59839
60058
|
Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
|
|
59840
60059
|
Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
|
|
@@ -60039,7 +60258,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60039
60258
|
* Process collaboration migrations
|
|
60040
60259
|
*/
|
|
60041
60260
|
processCollaborationMigrations() {
|
|
60042
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
60261
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.54");
|
|
60043
60262
|
if (!this.options.ydoc) return;
|
|
60044
60263
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
60045
60264
|
let docVersion = metaMap.get("version");
|
|
@@ -62498,8 +62717,8 @@ const indentPtToPx = (indent) => {
|
|
|
62498
62717
|
const hanging = ptToPx(indent.hanging);
|
|
62499
62718
|
if (left2 != null && left2 !== 0) result.left = left2;
|
|
62500
62719
|
if (right2 != null && right2 !== 0) result.right = right2;
|
|
62501
|
-
if (firstLine != null
|
|
62502
|
-
if (hanging != null
|
|
62720
|
+
if (firstLine != null) result.firstLine = firstLine;
|
|
62721
|
+
if (hanging != null) result.hanging = hanging;
|
|
62503
62722
|
return Object.keys(result).length > 0 ? result : void 0;
|
|
62504
62723
|
};
|
|
62505
62724
|
const normalizeAlignment = (value) => {
|
|
@@ -62586,7 +62805,7 @@ const normalizePxIndent = (value) => {
|
|
|
62586
62805
|
}
|
|
62587
62806
|
});
|
|
62588
62807
|
if (!values.length) return void 0;
|
|
62589
|
-
const looksLikeTwips = values.some((val) => val >= 50 || Math.abs(val % 15) < 1e-6);
|
|
62808
|
+
const looksLikeTwips = values.some((val) => val >= 50 || val !== 0 && Math.abs(val % 15) < 1e-6);
|
|
62590
62809
|
if (looksLikeTwips) {
|
|
62591
62810
|
return void 0;
|
|
62592
62811
|
}
|
|
@@ -63471,6 +63690,7 @@ function computeWordParagraphLayout(input) {
|
|
|
63471
63690
|
const firstLinePx = indent.firstLine;
|
|
63472
63691
|
const defaultTabIntervalPx = resolveDefaultTabIntervalPx(paragraph.tabIntervalTwips, docDefaults);
|
|
63473
63692
|
const tabsPx = tabs.map((tab) => tab.position);
|
|
63693
|
+
const hasFirstLineIndent = indent.firstLine != null && Number.isFinite(indent.firstLine) && indent.firstLine > 0 && !indent.hanging;
|
|
63474
63694
|
const layout = {
|
|
63475
63695
|
indentLeftPx,
|
|
63476
63696
|
hangingPx: Math.max(hangingPxRaw, 0),
|
|
@@ -63494,9 +63714,19 @@ function computeWordParagraphLayout(input) {
|
|
|
63494
63714
|
});
|
|
63495
63715
|
const markerText = numbering.markerText ?? formatMarkerText(numbering);
|
|
63496
63716
|
const glyphWidthPx = measurement?.measureText && markerText ? measurement.measureText(markerText, buildFontCss(markerRun), { letterSpacing: markerRun.letterSpacing }) : void 0;
|
|
63497
|
-
|
|
63498
|
-
|
|
63499
|
-
|
|
63717
|
+
let markerBoxWidthPx;
|
|
63718
|
+
let markerX;
|
|
63719
|
+
if (hasFirstLineIndent) {
|
|
63720
|
+
markerBoxWidthPx = glyphWidthPx != null && glyphWidthPx > 0 ? glyphWidthPx + LIST_MARKER_GAP$2 : DEFAULT_LIST_HANGING_PX$1;
|
|
63721
|
+
markerX = indentLeftPx + (firstLinePx ?? 0);
|
|
63722
|
+
layout.textStartPx = markerX + markerBoxWidthPx;
|
|
63723
|
+
layout.hangingPx = 0;
|
|
63724
|
+
layout.firstLineIndentMode = true;
|
|
63725
|
+
} else {
|
|
63726
|
+
markerBoxWidthPx = resolveMarkerBoxWidth(hangingPxRaw, glyphWidthPx);
|
|
63727
|
+
markerX = indentLeftPx - markerBoxWidthPx;
|
|
63728
|
+
layout.hangingPx = markerBoxWidthPx;
|
|
63729
|
+
}
|
|
63500
63730
|
layout.marker = buildMarkerLayout({
|
|
63501
63731
|
numbering,
|
|
63502
63732
|
markerText,
|
|
@@ -64088,6 +64318,9 @@ const cloneIfObject = (value) => {
|
|
|
64088
64318
|
};
|
|
64089
64319
|
const { resolveSpacingIndent } = Engines;
|
|
64090
64320
|
const DEFAULT_DECIMAL_SEPARATOR$2 = ".";
|
|
64321
|
+
const isValidNumberingId = (numId) => {
|
|
64322
|
+
return numId != null && numId !== 0 && numId !== "0";
|
|
64323
|
+
};
|
|
64091
64324
|
const asOoxmlElement = (value) => {
|
|
64092
64325
|
if (!value || typeof value !== "object") return void 0;
|
|
64093
64326
|
const element = value;
|
|
@@ -64580,9 +64813,10 @@ const computeWordLayoutForParagraph = (paragraphAttrs, numberingProps, styleCont
|
|
|
64580
64813
|
let effectiveIndent = paragraphAttrs.indent;
|
|
64581
64814
|
if (numberingProps?.resolvedLevelIndent) {
|
|
64582
64815
|
const resolvedIndentPx = convertIndentTwipsToPx(numberingProps.resolvedLevelIndent);
|
|
64816
|
+
const numberingIndent = resolvedIndentPx ?? numberingProps.resolvedLevelIndent;
|
|
64583
64817
|
effectiveIndent = {
|
|
64584
|
-
...
|
|
64585
|
-
...
|
|
64818
|
+
...numberingIndent,
|
|
64819
|
+
...paragraphAttrs.indent
|
|
64586
64820
|
};
|
|
64587
64821
|
}
|
|
64588
64822
|
const resolvedTabs = toResolvedTabStops(paragraphAttrs.tabs);
|
|
@@ -64744,11 +64978,6 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
|
|
|
64744
64978
|
} else if (computed2.paragraph.alignment) {
|
|
64745
64979
|
paragraphAttrs.alignment = computed2.paragraph.alignment;
|
|
64746
64980
|
}
|
|
64747
|
-
const isJustified = paragraphAttrs.alignment === "justify";
|
|
64748
|
-
const hasFirstLineIndent = normalizedIndent?.firstLine && normalizedIndent.firstLine > 0;
|
|
64749
|
-
if (isJustified && hasFirstLineIndent) {
|
|
64750
|
-
paragraphAttrs.suppressFirstLineIndent = true;
|
|
64751
|
-
}
|
|
64752
64981
|
const spacingPx = spacingPtToPx(spacing, normalizedSpacing);
|
|
64753
64982
|
if (spacingPx) paragraphAttrs.spacing = spacingPx;
|
|
64754
64983
|
if (normalizedSpacing?.beforeAutospacing != null || normalizedSpacing?.afterAutospacing != null) {
|
|
@@ -64887,7 +65116,8 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
|
|
|
64887
65116
|
}
|
|
64888
65117
|
const numberingSource = attrs.numberingProperties ?? paragraphProps.numberingProperties ?? hydrated?.numberingProperties;
|
|
64889
65118
|
const rawNumberingProps = toAdapterNumberingProps(numberingSource);
|
|
64890
|
-
|
|
65119
|
+
const hasValidNumbering = rawNumberingProps && isValidNumberingId(rawNumberingProps.numId);
|
|
65120
|
+
if (hasValidNumbering) {
|
|
64891
65121
|
const numberingProps = rawNumberingProps;
|
|
64892
65122
|
const numId = numberingProps.numId;
|
|
64893
65123
|
const ilvl = Number.isFinite(numberingProps.ilvl) ? Math.max(0, Math.floor(Number(numberingProps.ilvl))) : 0;
|
|
@@ -71185,6 +71415,50 @@ function assertFragmentPmPositions(fragment, _context) {
|
|
|
71185
71415
|
const hasPmEnd = fragment.pmEnd != null;
|
|
71186
71416
|
globalValidationStats.record(hasPmStart, hasPmEnd);
|
|
71187
71417
|
}
|
|
71418
|
+
function isMinimalWordLayout(value) {
|
|
71419
|
+
if (typeof value !== "object" || value === null) {
|
|
71420
|
+
return false;
|
|
71421
|
+
}
|
|
71422
|
+
const obj = value;
|
|
71423
|
+
if (obj.marker !== void 0) {
|
|
71424
|
+
if (typeof obj.marker !== "object" || obj.marker === null) {
|
|
71425
|
+
return false;
|
|
71426
|
+
}
|
|
71427
|
+
const marker = obj.marker;
|
|
71428
|
+
if (marker.markerX !== void 0 && typeof marker.markerX !== "number") {
|
|
71429
|
+
return false;
|
|
71430
|
+
}
|
|
71431
|
+
if (marker.textStartX !== void 0 && typeof marker.textStartX !== "number") {
|
|
71432
|
+
return false;
|
|
71433
|
+
}
|
|
71434
|
+
}
|
|
71435
|
+
if (obj.indentLeftPx !== void 0) {
|
|
71436
|
+
if (typeof obj.indentLeftPx !== "number") {
|
|
71437
|
+
return false;
|
|
71438
|
+
}
|
|
71439
|
+
}
|
|
71440
|
+
if (obj.firstLineIndentMode !== void 0) {
|
|
71441
|
+
if (typeof obj.firstLineIndentMode !== "boolean") {
|
|
71442
|
+
return false;
|
|
71443
|
+
}
|
|
71444
|
+
}
|
|
71445
|
+
if (obj.textStartPx !== void 0) {
|
|
71446
|
+
if (typeof obj.textStartPx !== "number") {
|
|
71447
|
+
return false;
|
|
71448
|
+
}
|
|
71449
|
+
}
|
|
71450
|
+
if (obj.tabsPx !== void 0) {
|
|
71451
|
+
if (!Array.isArray(obj.tabsPx)) {
|
|
71452
|
+
return false;
|
|
71453
|
+
}
|
|
71454
|
+
for (const tab of obj.tabsPx) {
|
|
71455
|
+
if (typeof tab !== "number") {
|
|
71456
|
+
return false;
|
|
71457
|
+
}
|
|
71458
|
+
}
|
|
71459
|
+
}
|
|
71460
|
+
return true;
|
|
71461
|
+
}
|
|
71188
71462
|
const LIST_MARKER_GAP$1 = 8;
|
|
71189
71463
|
const DEFAULT_TAB_INTERVAL_PX$1 = 48;
|
|
71190
71464
|
const COMMENT_EXTERNAL_COLOR = "#B1124B";
|
|
@@ -71946,7 +72220,7 @@ const _DomPainter = class _DomPainter2 {
|
|
|
71946
72220
|
}
|
|
71947
72221
|
const block = lookup2.block;
|
|
71948
72222
|
const measure = lookup2.measure;
|
|
71949
|
-
const wordLayout = block.attrs?.wordLayout;
|
|
72223
|
+
const wordLayout = isMinimalWordLayout(block.attrs?.wordLayout) ? block.attrs.wordLayout : void 0;
|
|
71950
72224
|
const fragmentEl = this.doc.createElement("div");
|
|
71951
72225
|
fragmentEl.classList.add(CLASS_NAMES$1.fragment);
|
|
71952
72226
|
const isTocEntry = block.attrs?.isTocEntry;
|
|
@@ -71987,11 +72261,11 @@ const _DomPainter = class _DomPainter2 {
|
|
|
71987
72261
|
const paraIndentRight = paraIndent?.right ?? 0;
|
|
71988
72262
|
const suppressFirstLineIndent = block.attrs?.suppressFirstLineIndent === true;
|
|
71989
72263
|
const firstLineOffset = suppressFirstLineIndent ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
|
|
71990
|
-
const isListParagraph = !!(fragment.markerWidth && wordLayout?.marker);
|
|
71991
72264
|
const lastRun = block.runs.length > 0 ? block.runs[block.runs.length - 1] : null;
|
|
71992
72265
|
const paragraphEndsWithLineBreak = lastRun?.kind === "lineBreak";
|
|
71993
72266
|
lines.forEach((line, index2) => {
|
|
71994
|
-
const
|
|
72267
|
+
const fallbackAvailableWidth = Math.max(0, fragment.width - (paraIndentLeft + paraIndentRight));
|
|
72268
|
+
const availableWidthOverride = line.maxWidth ?? fallbackAvailableWidth;
|
|
71995
72269
|
const isLastLineOfFragment = index2 === lines.length - 1;
|
|
71996
72270
|
const isLastLineOfParagraph = isLastLineOfFragment && !fragment.continuesOnNext;
|
|
71997
72271
|
const shouldSkipJustifyForLastLine = isLastLineOfParagraph && !paragraphEndsWithLineBreak;
|
|
@@ -72001,7 +72275,7 @@ const _DomPainter = class _DomPainter2 {
|
|
|
72001
72275
|
context,
|
|
72002
72276
|
availableWidthOverride,
|
|
72003
72277
|
fragment.fromLine + index2,
|
|
72004
|
-
|
|
72278
|
+
shouldSkipJustifyForLastLine
|
|
72005
72279
|
);
|
|
72006
72280
|
const isListFirstLine = index2 === 0 && !fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker;
|
|
72007
72281
|
const hasExplicitSegmentPositioning = line.segments?.some((seg) => seg.x !== void 0);
|
|
@@ -72025,8 +72299,17 @@ const _DomPainter = class _DomPainter2 {
|
|
|
72025
72299
|
lineEl.style.textIndent = "0px";
|
|
72026
72300
|
}
|
|
72027
72301
|
if (isListFirstLine && wordLayout?.marker && fragment.markerWidth) {
|
|
72028
|
-
const
|
|
72029
|
-
|
|
72302
|
+
const isFirstLineIndentMode = wordLayout.firstLineIndentMode === true;
|
|
72303
|
+
let markerStartPos;
|
|
72304
|
+
if (isFirstLineIndentMode && wordLayout.marker.markerX !== void 0 && Number.isFinite(wordLayout.marker.markerX)) {
|
|
72305
|
+
markerStartPos = wordLayout.marker.markerX;
|
|
72306
|
+
} else if (isFirstLineIndentMode) {
|
|
72307
|
+
markerStartPos = paraIndentLeft + (paraIndent?.firstLine ?? 0);
|
|
72308
|
+
} else {
|
|
72309
|
+
markerStartPos = paraIndentLeft - (paraIndent?.hanging ?? 0);
|
|
72310
|
+
}
|
|
72311
|
+
const validMarkerStartPos = Number.isFinite(markerStartPos) ? markerStartPos : 0;
|
|
72312
|
+
lineEl.style.paddingLeft = `${validMarkerStartPos}px`;
|
|
72030
72313
|
const markerContainer = this.doc.createElement("span");
|
|
72031
72314
|
markerContainer.style.display = "inline-block";
|
|
72032
72315
|
const markerEl = this.doc.createElement("span");
|
|
@@ -72042,7 +72325,7 @@ const _DomPainter = class _DomPainter2 {
|
|
|
72042
72325
|
if (markerJustification === "left") {
|
|
72043
72326
|
markerContainer.style.position = "relative";
|
|
72044
72327
|
} else {
|
|
72045
|
-
const markerLeftX =
|
|
72328
|
+
const markerLeftX = validMarkerStartPos - fragment.markerWidth;
|
|
72046
72329
|
markerContainer.style.position = "absolute";
|
|
72047
72330
|
markerContainer.style.left = `${markerLeftX}px`;
|
|
72048
72331
|
markerContainer.style.top = "0";
|
|
@@ -72067,12 +72350,36 @@ const _DomPainter = class _DomPainter2 {
|
|
|
72067
72350
|
const markerBoxWidth = fragment.markerWidth;
|
|
72068
72351
|
const markerTextWidth = fragment.markerTextWidth != null && isFinite(fragment.markerTextWidth) && fragment.markerTextWidth >= 0 ? fragment.markerTextWidth : markerBoxWidth;
|
|
72069
72352
|
if ((wordLayout.marker.justification ?? "left") === "left") {
|
|
72070
|
-
const currentPos =
|
|
72071
|
-
|
|
72072
|
-
|
|
72073
|
-
|
|
72074
|
-
|
|
72075
|
-
|
|
72353
|
+
const currentPos = validMarkerStartPos + markerTextWidth;
|
|
72354
|
+
if (isFirstLineIndentMode) {
|
|
72355
|
+
const explicitTabs = wordLayout.tabsPx;
|
|
72356
|
+
let targetTabStop;
|
|
72357
|
+
if (Array.isArray(explicitTabs) && explicitTabs.length > 0) {
|
|
72358
|
+
for (const tab of explicitTabs) {
|
|
72359
|
+
if (typeof tab === "number" && tab > currentPos) {
|
|
72360
|
+
targetTabStop = tab;
|
|
72361
|
+
break;
|
|
72362
|
+
}
|
|
72363
|
+
}
|
|
72364
|
+
}
|
|
72365
|
+
const textStartTarget = wordLayout.marker.textStartX !== void 0 && Number.isFinite(wordLayout.marker.textStartX) ? wordLayout.marker.textStartX : wordLayout.textStartPx;
|
|
72366
|
+
if (targetTabStop !== void 0) {
|
|
72367
|
+
tabWidth = targetTabStop - currentPos;
|
|
72368
|
+
} else if (textStartTarget !== void 0 && Number.isFinite(textStartTarget) && textStartTarget > currentPos) {
|
|
72369
|
+
tabWidth = textStartTarget - currentPos;
|
|
72370
|
+
} else {
|
|
72371
|
+
tabWidth = LIST_MARKER_GAP$1;
|
|
72372
|
+
}
|
|
72373
|
+
if (tabWidth < LIST_MARKER_GAP$1) {
|
|
72374
|
+
tabWidth = LIST_MARKER_GAP$1;
|
|
72375
|
+
}
|
|
72376
|
+
} else {
|
|
72377
|
+
const implicitTabStop = paraIndentLeft;
|
|
72378
|
+
tabWidth = implicitTabStop - currentPos;
|
|
72379
|
+
if (tabWidth < 1) {
|
|
72380
|
+
tabWidth = DEFAULT_TAB_INTERVAL_PX$1 - currentPos % DEFAULT_TAB_INTERVAL_PX$1;
|
|
72381
|
+
if (tabWidth === 0) tabWidth = DEFAULT_TAB_INTERVAL_PX$1;
|
|
72382
|
+
}
|
|
72076
72383
|
}
|
|
72077
72384
|
} else {
|
|
72078
72385
|
tabWidth = fragment.markerGutter != null && isFinite(fragment.markerGutter) ? fragment.markerGutter : typeof wordLayout.marker.gutterWidthPx === "number" && isFinite(wordLayout.marker.gutterWidthPx) && wordLayout.marker.gutterWidthPx > 0 ? wordLayout.marker.gutterWidthPx : LIST_MARKER_GAP$1;
|
|
@@ -76044,8 +76351,13 @@ function computePartialRow(rowIndex, blockRow, measure, availableHeight, fromLin
|
|
|
76044
76351
|
toLineByCell.push(cutLine);
|
|
76045
76352
|
heightByCell.push(cumulativeHeight);
|
|
76046
76353
|
}
|
|
76047
|
-
const
|
|
76048
|
-
|
|
76354
|
+
const allCellsCompleteInFirstPass = toLineByCell.every((cutLine, idx) => {
|
|
76355
|
+
const totalLines = getCellTotalLines(row.cells[idx]);
|
|
76356
|
+
return cutLine >= totalLines;
|
|
76357
|
+
});
|
|
76358
|
+
const lineAdvancements = toLineByCell.map((cutLine, idx) => cutLine - (startLines[idx] || 0));
|
|
76359
|
+
const positiveAdvancements = lineAdvancements.filter((adv) => adv > 0);
|
|
76360
|
+
const minLineAdvancement = positiveAdvancements.length > 0 ? Math.min(...positiveAdvancements) : 0;
|
|
76049
76361
|
let actualPartialHeight = 0;
|
|
76050
76362
|
let maxPaddingTotal = 0;
|
|
76051
76363
|
for (let cellIdx = 0; cellIdx < cellCount; cellIdx++) {
|
|
@@ -76055,18 +76367,17 @@ function computePartialRow(rowIndex, blockRow, measure, availableHeight, fromLin
|
|
|
76055
76367
|
const cellPadding = cellPaddings[cellIdx];
|
|
76056
76368
|
const paddingTotal = cellPadding.top + cellPadding.bottom;
|
|
76057
76369
|
maxPaddingTotal = Math.max(maxPaddingTotal, paddingTotal);
|
|
76058
|
-
|
|
76059
|
-
|
|
76060
|
-
|
|
76061
|
-
const
|
|
76062
|
-
|
|
76063
|
-
|
|
76370
|
+
if (allCellsCompleteInFirstPass) {
|
|
76371
|
+
actualPartialHeight = Math.max(actualPartialHeight, heightByCell[cellIdx] + paddingTotal);
|
|
76372
|
+
} else {
|
|
76373
|
+
const targetLine = Math.min(startLine + minLineAdvancement, lines.length);
|
|
76374
|
+
let cumulativeHeight = 0;
|
|
76375
|
+
for (let i = startLine; i < targetLine; i++) {
|
|
76376
|
+
cumulativeHeight += lines[i].lineHeight || 0;
|
|
76064
76377
|
}
|
|
76065
|
-
|
|
76066
|
-
|
|
76378
|
+
toLineByCell[cellIdx] = targetLine;
|
|
76379
|
+
actualPartialHeight = Math.max(actualPartialHeight, cumulativeHeight + paddingTotal);
|
|
76067
76380
|
}
|
|
76068
|
-
toLineByCell[cellIdx] = cutLine;
|
|
76069
|
-
actualPartialHeight = Math.max(actualPartialHeight, cumulativeHeight + paddingTotal);
|
|
76070
76381
|
}
|
|
76071
76382
|
const madeProgress = toLineByCell.some((cutLine, idx) => cutLine > (startLines[idx] || 0));
|
|
76072
76383
|
const isFirstPart = startLines.every((l3) => l3 === 0);
|
|
@@ -76294,7 +76605,6 @@ function layoutTableBlock({
|
|
|
76294
76605
|
} else if (!madeProgress && hadRemainingLinesBefore) {
|
|
76295
76606
|
state2 = advanceColumn(state2);
|
|
76296
76607
|
} else {
|
|
76297
|
-
state2 = advanceColumn(state2);
|
|
76298
76608
|
pendingPartialRow = continuationPartialRow;
|
|
76299
76609
|
}
|
|
76300
76610
|
isTableContinuation = true;
|
|
@@ -91054,6 +91364,52 @@ function createDropcapPlugin(editor) {
|
|
|
91054
91364
|
}
|
|
91055
91365
|
});
|
|
91056
91366
|
}
|
|
91367
|
+
function parseAttrs(node) {
|
|
91368
|
+
const numberingProperties = {};
|
|
91369
|
+
let indent, spacing;
|
|
91370
|
+
const { styleid: styleId, ...extraAttrs } = Array.from(node.attributes).reduce((acc, attr) => {
|
|
91371
|
+
if (attr.name === "data-num-id") {
|
|
91372
|
+
numberingProperties.numId = parseInt(attr.value);
|
|
91373
|
+
} else if (attr.name === "data-level") {
|
|
91374
|
+
numberingProperties.ilvl = parseInt(attr.value);
|
|
91375
|
+
} else if (attr.name === "data-indent") {
|
|
91376
|
+
try {
|
|
91377
|
+
indent = JSON.parse(attr.value);
|
|
91378
|
+
Object.keys(indent).forEach((key2) => {
|
|
91379
|
+
indent[key2] = Number(indent[key2]);
|
|
91380
|
+
});
|
|
91381
|
+
} catch {
|
|
91382
|
+
}
|
|
91383
|
+
} else if (attr.name === "data-spacing") {
|
|
91384
|
+
try {
|
|
91385
|
+
spacing = JSON.parse(attr.value);
|
|
91386
|
+
Object.keys(spacing).forEach((key2) => {
|
|
91387
|
+
spacing[key2] = Number(spacing[key2]);
|
|
91388
|
+
});
|
|
91389
|
+
} catch {
|
|
91390
|
+
}
|
|
91391
|
+
} else {
|
|
91392
|
+
acc[attr.name] = attr.value;
|
|
91393
|
+
}
|
|
91394
|
+
return acc;
|
|
91395
|
+
}, {});
|
|
91396
|
+
let attrs = {
|
|
91397
|
+
paragraphProperties: {
|
|
91398
|
+
styleId: styleId || null
|
|
91399
|
+
},
|
|
91400
|
+
extraAttrs
|
|
91401
|
+
};
|
|
91402
|
+
if (indent && Object.keys(indent).length > 0) {
|
|
91403
|
+
attrs.paragraphProperties.indent = indent;
|
|
91404
|
+
}
|
|
91405
|
+
if (spacing && Object.keys(spacing).length > 0) {
|
|
91406
|
+
attrs.paragraphProperties.spacing = spacing;
|
|
91407
|
+
}
|
|
91408
|
+
if (Object.keys(numberingProperties).length > 0) {
|
|
91409
|
+
attrs.paragraphProperties.numberingProperties = numberingProperties;
|
|
91410
|
+
}
|
|
91411
|
+
return attrs;
|
|
91412
|
+
}
|
|
91057
91413
|
const bulletInputRegex = /^\s*([-+*])\s$/;
|
|
91058
91414
|
const orderedInputRegex = /^(\d+)\.\s$/;
|
|
91059
91415
|
const Paragraph = OxmlNode.create({
|
|
@@ -91123,50 +91479,7 @@ const Paragraph = OxmlNode.create({
|
|
|
91123
91479
|
return [
|
|
91124
91480
|
{
|
|
91125
91481
|
tag: "p",
|
|
91126
|
-
getAttrs:
|
|
91127
|
-
const numberingProperties = {};
|
|
91128
|
-
let indent, spacing;
|
|
91129
|
-
const { styleid: styleId, ...extraAttrs } = Array.from(node.attributes).reduce((acc, attr) => {
|
|
91130
|
-
if (attr.name === "data-num-id") {
|
|
91131
|
-
numberingProperties.numId = parseInt(attr.value);
|
|
91132
|
-
} else if (attr.name === "data-level") {
|
|
91133
|
-
numberingProperties.ilvl = parseInt(attr.value);
|
|
91134
|
-
} else if (attr.name === "data-indent") {
|
|
91135
|
-
try {
|
|
91136
|
-
indent = JSON.parse(attr.value);
|
|
91137
|
-
Object.keys(indent).forEach((key2) => {
|
|
91138
|
-
indent[key2] = Number(indent[key2]);
|
|
91139
|
-
});
|
|
91140
|
-
} catch {
|
|
91141
|
-
}
|
|
91142
|
-
} else if (attr.name === "data-spacing") {
|
|
91143
|
-
try {
|
|
91144
|
-
spacing = JSON.parse(attr.value);
|
|
91145
|
-
Object.keys(spacing).forEach((key2) => {
|
|
91146
|
-
spacing[key2] = Number(spacing[key2]);
|
|
91147
|
-
});
|
|
91148
|
-
} catch {
|
|
91149
|
-
}
|
|
91150
|
-
} else {
|
|
91151
|
-
acc[attr.name] = attr.value;
|
|
91152
|
-
}
|
|
91153
|
-
return acc;
|
|
91154
|
-
}, {});
|
|
91155
|
-
if (Object.keys(numberingProperties).length > 0) {
|
|
91156
|
-
return {
|
|
91157
|
-
paragraphProperties: {
|
|
91158
|
-
numberingProperties,
|
|
91159
|
-
indent,
|
|
91160
|
-
spacing,
|
|
91161
|
-
styleId: styleId || null
|
|
91162
|
-
},
|
|
91163
|
-
extraAttrs
|
|
91164
|
-
};
|
|
91165
|
-
}
|
|
91166
|
-
return {
|
|
91167
|
-
extraAttrs
|
|
91168
|
-
};
|
|
91169
|
-
}
|
|
91482
|
+
getAttrs: parseAttrs
|
|
91170
91483
|
},
|
|
91171
91484
|
{
|
|
91172
91485
|
tag: "div",
|
|
@@ -91184,7 +91497,16 @@ const Paragraph = OxmlNode.create({
|
|
|
91184
91497
|
},
|
|
91185
91498
|
...this.options.headingLevels.map((level) => ({
|
|
91186
91499
|
tag: `h${level}`,
|
|
91187
|
-
|
|
91500
|
+
getAttrs: (node) => {
|
|
91501
|
+
let attrs = parseAttrs(node);
|
|
91502
|
+
return {
|
|
91503
|
+
...attrs,
|
|
91504
|
+
paragraphProperties: {
|
|
91505
|
+
...attrs.paragraphProperties,
|
|
91506
|
+
styleId: `Heading${level}`
|
|
91507
|
+
}
|
|
91508
|
+
};
|
|
91509
|
+
}
|
|
91188
91510
|
}))
|
|
91189
91511
|
];
|
|
91190
91512
|
},
|
|
@@ -97675,6 +97997,14 @@ const Image = Node$1.create({
|
|
|
97675
97997
|
if (!style2) return {};
|
|
97676
97998
|
return { style: style2 };
|
|
97677
97999
|
}
|
|
98000
|
+
},
|
|
98001
|
+
drawingChildOrder: {
|
|
98002
|
+
default: null,
|
|
98003
|
+
rendered: false
|
|
98004
|
+
},
|
|
98005
|
+
originalDrawingChildren: {
|
|
98006
|
+
default: null,
|
|
98007
|
+
rendered: false
|
|
97678
98008
|
}
|
|
97679
98009
|
};
|
|
97680
98010
|
},
|
|
@@ -102289,11 +102619,11 @@ const getChangesByIdToResolve = (state2, id) => {
|
|
|
102289
102619
|
break;
|
|
102290
102620
|
}
|
|
102291
102621
|
const [left2, right2] = direction < 0 ? [neighbor, currentChange] : [currentChange, neighbor];
|
|
102292
|
-
if (!areDirectlyConnected(left2, right2)) {
|
|
102293
|
-
break;
|
|
102294
|
-
}
|
|
102295
102622
|
const sharesId = neighbor.mark.attrs.id === matchingId;
|
|
102296
102623
|
const complementary = isComplementaryPair(currentChange.mark.type.name, neighbor.mark.type.name);
|
|
102624
|
+
if (!sharesId && !areDirectlyConnected(left2, right2)) {
|
|
102625
|
+
break;
|
|
102626
|
+
}
|
|
102297
102627
|
if (!sharesId && !complementary) {
|
|
102298
102628
|
break;
|
|
102299
102629
|
}
|