@harbour-enterprises/superdoc 1.3.0-next.1 → 1.3.0-next.10
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-BAoRLNIo.cjs → PdfViewer-BBQ-ukct.cjs} +2 -2
- package/dist/chunks/{PdfViewer-CkOzQzPk.es.js → PdfViewer-CgwCQZZ6.es.js} +2 -2
- package/dist/chunks/{SuperConverter-Dy0-KTCc.cjs → SuperConverter-BIATaPlu.cjs} +455 -283
- package/dist/chunks/{SuperConverter-BXP6NikG.es.js → SuperConverter-BO5wIcsr.es.js} +488 -316
- package/dist/chunks/{index-BNpbdx2a.cjs → index-B045iT2T.cjs} +1444 -616
- package/dist/chunks/{index-wwGlJ58Z.es.js → index-Bv9MbOsf.es.js} +1444 -616
- package/dist/chunks/{index-BbvMtiJY.cjs → index-D9yb-45i.cjs} +10 -5
- package/dist/chunks/{index-C31VY_46.es.js → index-yNMvRgm_.es.js} +10 -5
- package/dist/style.css +2 -2
- package/dist/super-editor/converter.cjs +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +3 -3
- package/dist/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/superdoc/src/stores/comments-store.d.ts +4 -1
- package/dist/superdoc/src/stores/comments-store.d.ts.map +1 -1
- package/dist/superdoc/src/stores/superdoc-store.d.ts +12 -3
- package/dist/superdoc/src/stores/superdoc-store.d.ts.map +1 -1
- package/dist/superdoc.cjs +3 -3
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +1910 -909
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +3 -3
|
@@ -7490,134 +7490,200 @@ const INLINE_OVERRIDE_PROPERTIES = [
|
|
|
7490
7490
|
"italic",
|
|
7491
7491
|
"strike",
|
|
7492
7492
|
"underline",
|
|
7493
|
-
"letterSpacing"
|
|
7494
|
-
"vertAlign",
|
|
7495
|
-
"position"
|
|
7493
|
+
"letterSpacing"
|
|
7496
7494
|
];
|
|
7497
7495
|
const DEFAULT_FONT_SIZE_HALF_POINTS = 20;
|
|
7498
|
-
|
|
7499
|
-
|
|
7496
|
+
function isObject(item) {
|
|
7497
|
+
return item != null && typeof item === "object" && !Array.isArray(item);
|
|
7498
|
+
}
|
|
7499
|
+
function combineProperties$1(propertiesArray, options = {}) {
|
|
7500
|
+
const { fullOverrideProps = [], specialHandling = {} } = options;
|
|
7501
|
+
if (!propertiesArray || propertiesArray.length === 0) {
|
|
7502
|
+
return {};
|
|
7503
|
+
}
|
|
7504
|
+
const merge = (target, source) => {
|
|
7505
|
+
const output = { ...target };
|
|
7506
|
+
if (isObject(target) && isObject(source)) {
|
|
7507
|
+
for (const key in source) {
|
|
7508
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
7509
|
+
const handler2 = specialHandling[key];
|
|
7510
|
+
if (handler2 && typeof handler2 === "function") {
|
|
7511
|
+
output[key] = handler2(output, source);
|
|
7512
|
+
} else if (!fullOverrideProps.includes(key) && isObject(source[key])) {
|
|
7513
|
+
if (key in target && isObject(target[key])) {
|
|
7514
|
+
output[key] = merge(target[key], source[key]);
|
|
7515
|
+
} else {
|
|
7516
|
+
output[key] = source[key];
|
|
7517
|
+
}
|
|
7518
|
+
} else {
|
|
7519
|
+
output[key] = source[key];
|
|
7520
|
+
}
|
|
7521
|
+
}
|
|
7522
|
+
}
|
|
7523
|
+
}
|
|
7524
|
+
return output;
|
|
7525
|
+
};
|
|
7526
|
+
return propertiesArray.reduce((acc, current) => merge(acc, current ?? {}), {});
|
|
7527
|
+
}
|
|
7528
|
+
function combineRunProperties$1(propertiesArray) {
|
|
7529
|
+
return combineProperties$1(propertiesArray, {
|
|
7530
|
+
fullOverrideProps: ["fontFamily", "color"]
|
|
7531
|
+
});
|
|
7532
|
+
}
|
|
7533
|
+
function applyInlineOverrides(finalProps, inlineProps, overrideKeys = INLINE_OVERRIDE_PROPERTIES) {
|
|
7534
|
+
if (!inlineProps) return finalProps;
|
|
7535
|
+
for (const prop of overrideKeys) {
|
|
7536
|
+
if (inlineProps[prop] != null) {
|
|
7537
|
+
finalProps[prop] = inlineProps[prop];
|
|
7538
|
+
}
|
|
7539
|
+
}
|
|
7540
|
+
return finalProps;
|
|
7541
|
+
}
|
|
7542
|
+
function isValidFontSize(value) {
|
|
7543
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
7544
|
+
}
|
|
7545
|
+
function resolveFontSizeWithFallback(value, defaultProps, normalProps) {
|
|
7546
|
+
if (isValidFontSize(value)) {
|
|
7547
|
+
return value;
|
|
7548
|
+
}
|
|
7549
|
+
if (defaultProps && isValidFontSize(defaultProps.fontSize)) {
|
|
7550
|
+
return defaultProps.fontSize;
|
|
7551
|
+
}
|
|
7552
|
+
if (normalProps && isValidFontSize(normalProps.fontSize)) {
|
|
7553
|
+
return normalProps.fontSize;
|
|
7554
|
+
}
|
|
7555
|
+
return DEFAULT_FONT_SIZE_HALF_POINTS;
|
|
7556
|
+
}
|
|
7557
|
+
function orderDefaultsAndNormal(defaultProps, normalProps, isNormalDefault) {
|
|
7558
|
+
if (isNormalDefault) {
|
|
7559
|
+
return [defaultProps, normalProps];
|
|
7560
|
+
} else {
|
|
7561
|
+
return [normalProps, defaultProps];
|
|
7562
|
+
}
|
|
7563
|
+
}
|
|
7564
|
+
function createFirstLineIndentHandler() {
|
|
7565
|
+
return (target, source) => {
|
|
7566
|
+
if (target.hanging != null && source.firstLine != null) {
|
|
7567
|
+
delete target.hanging;
|
|
7568
|
+
}
|
|
7569
|
+
return source.firstLine;
|
|
7570
|
+
};
|
|
7571
|
+
}
|
|
7572
|
+
function combineIndentProperties(indentChain) {
|
|
7573
|
+
const indentOnly = indentChain.map((props) => props.indent != null ? { indent: props.indent } : {});
|
|
7574
|
+
return combineProperties$1(indentOnly, {
|
|
7575
|
+
specialHandling: {
|
|
7576
|
+
firstLine: createFirstLineIndentHandler()
|
|
7577
|
+
}
|
|
7578
|
+
});
|
|
7579
|
+
}
|
|
7580
|
+
function createOoxmlResolver(translators) {
|
|
7581
|
+
return {
|
|
7582
|
+
resolveRunProperties: (params, inlineRpr, resolvedPpr, isListNumber = false, numberingDefinedInline = false) => resolveRunProperties$1(translators, params, inlineRpr, resolvedPpr, isListNumber, numberingDefinedInline),
|
|
7583
|
+
resolveParagraphProperties: (params, inlineProps, insideTable = false, overrideInlineStyleId = false, tableStyleId = null) => resolveParagraphProperties$1(translators, params, inlineProps, insideTable, overrideInlineStyleId, tableStyleId),
|
|
7584
|
+
getDefaultProperties,
|
|
7585
|
+
getStyleProperties,
|
|
7586
|
+
resolveStyleChain,
|
|
7587
|
+
getNumberingProperties: (params, ilvl, numId, translator2, tries = 0) => getNumberingProperties(translators, params, ilvl, numId, translator2, tries)
|
|
7588
|
+
};
|
|
7589
|
+
}
|
|
7590
|
+
function resolveRunProperties$1(translators, params, inlineRpr, resolvedPpr, isListNumber = false, numberingDefinedInline = false) {
|
|
7500
7591
|
const paragraphStyleId = resolvedPpr?.styleId;
|
|
7501
|
-
const paragraphStyleProps = resolveStyleChain(params, paragraphStyleId,
|
|
7502
|
-
const defaultProps = getDefaultProperties(params,
|
|
7503
|
-
const { properties: normalProps, isDefault: isNormalDefault } = getStyleProperties(params, "Normal",
|
|
7592
|
+
const paragraphStyleProps = resolveStyleChain(params, paragraphStyleId, translators.rPr);
|
|
7593
|
+
const defaultProps = getDefaultProperties(params, translators.rPr);
|
|
7594
|
+
const { properties: normalProps, isDefault: isNormalDefault } = getStyleProperties(params, "Normal", translators.rPr);
|
|
7504
7595
|
let runStyleProps = {};
|
|
7505
7596
|
if (!paragraphStyleId?.startsWith("TOC")) {
|
|
7506
|
-
runStyleProps = inlineRpr
|
|
7597
|
+
runStyleProps = inlineRpr?.styleId ? resolveStyleChain(params, inlineRpr.styleId, translators.rPr) : {};
|
|
7507
7598
|
}
|
|
7599
|
+
const defaultsChain = orderDefaultsAndNormal(defaultProps, normalProps, isNormalDefault);
|
|
7600
|
+
const inlineRprSafe = inlineRpr ?? {};
|
|
7508
7601
|
let styleChain;
|
|
7509
|
-
|
|
7510
|
-
styleChain = [defaultProps, normalProps];
|
|
7511
|
-
} else {
|
|
7512
|
-
styleChain = [normalProps, defaultProps];
|
|
7513
|
-
}
|
|
7602
|
+
let inlineOverrideSource = inlineRprSafe;
|
|
7514
7603
|
if (isListNumber) {
|
|
7515
7604
|
let numberingProps = {};
|
|
7516
|
-
const
|
|
7605
|
+
const numberingProperties = resolvedPpr?.numberingProperties;
|
|
7606
|
+
const numId = numberingProperties?.numId;
|
|
7517
7607
|
if (numId != null && numId !== 0 && numId !== "0") {
|
|
7518
7608
|
numberingProps = getNumberingProperties(
|
|
7609
|
+
translators,
|
|
7519
7610
|
params,
|
|
7520
|
-
|
|
7611
|
+
numberingProperties?.ilvl ?? 0,
|
|
7521
7612
|
numId,
|
|
7522
|
-
|
|
7613
|
+
translators.rPr
|
|
7523
7614
|
);
|
|
7524
7615
|
}
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
if (inlineRpr?.underline) {
|
|
7529
|
-
delete inlineRpr.underline;
|
|
7616
|
+
const inlineRprForList = numberingDefinedInline ? inlineRprSafe : {};
|
|
7617
|
+
if (inlineRprForList?.underline) {
|
|
7618
|
+
delete inlineRprForList.underline;
|
|
7530
7619
|
}
|
|
7531
|
-
styleChain = [...
|
|
7620
|
+
styleChain = [...defaultsChain, paragraphStyleProps, runStyleProps, inlineRprForList, numberingProps];
|
|
7621
|
+
inlineOverrideSource = inlineRprForList;
|
|
7532
7622
|
} else {
|
|
7533
|
-
styleChain = [...
|
|
7534
|
-
}
|
|
7535
|
-
const finalProps = combineProperties(styleChain, ["fontFamily", "color"]);
|
|
7536
|
-
for (const prop of INLINE_OVERRIDE_PROPERTIES) {
|
|
7537
|
-
if (inlineRpr?.[prop] != null) {
|
|
7538
|
-
finalProps[prop] = inlineRpr[prop];
|
|
7539
|
-
}
|
|
7540
|
-
}
|
|
7541
|
-
if (finalProps.fontSize == null || typeof finalProps.fontSize !== "number" || !Number.isFinite(finalProps.fontSize) || finalProps.fontSize <= 0) {
|
|
7542
|
-
let defaultFontSize = DEFAULT_FONT_SIZE_HALF_POINTS;
|
|
7543
|
-
if (defaultProps?.fontSize != null && typeof defaultProps.fontSize === "number" && Number.isFinite(defaultProps.fontSize) && defaultProps.fontSize > 0) {
|
|
7544
|
-
defaultFontSize = defaultProps.fontSize;
|
|
7545
|
-
} else if (normalProps?.fontSize != null && typeof normalProps.fontSize === "number" && Number.isFinite(normalProps.fontSize) && normalProps.fontSize > 0) {
|
|
7546
|
-
defaultFontSize = normalProps.fontSize;
|
|
7547
|
-
}
|
|
7548
|
-
finalProps.fontSize = defaultFontSize;
|
|
7623
|
+
styleChain = [...defaultsChain, paragraphStyleProps, runStyleProps, inlineRprSafe];
|
|
7549
7624
|
}
|
|
7625
|
+
const finalProps = combineRunProperties$1(styleChain);
|
|
7626
|
+
applyInlineOverrides(finalProps, inlineOverrideSource);
|
|
7627
|
+
finalProps.fontSize = resolveFontSizeWithFallback(finalProps.fontSize, defaultProps, normalProps);
|
|
7550
7628
|
return finalProps;
|
|
7551
|
-
}
|
|
7552
|
-
function resolveParagraphProperties(params, inlineProps, insideTable = false, overrideInlineStyleId = false, tableStyleId = null) {
|
|
7553
|
-
const defaultProps = getDefaultProperties(params,
|
|
7554
|
-
const { properties: normalProps, isDefault: isNormalDefault } = getStyleProperties(params, "Normal",
|
|
7555
|
-
|
|
7556
|
-
let
|
|
7629
|
+
}
|
|
7630
|
+
function resolveParagraphProperties$1(translators, params, inlineProps, insideTable = false, overrideInlineStyleId = false, tableStyleId = null) {
|
|
7631
|
+
const defaultProps = getDefaultProperties(params, translators.pPr);
|
|
7632
|
+
const { properties: normalProps, isDefault: isNormalDefault } = getStyleProperties(params, "Normal", translators.pPr);
|
|
7633
|
+
const inlinePropsSafe = inlineProps ?? {};
|
|
7634
|
+
let styleId = inlinePropsSafe?.styleId;
|
|
7635
|
+
let styleProps = inlinePropsSafe?.styleId ? resolveStyleChain(params, inlinePropsSafe.styleId, translators.pPr) : {};
|
|
7557
7636
|
let numberingProps = {};
|
|
7558
|
-
|
|
7559
|
-
let numId =
|
|
7560
|
-
let numberingDefinedInline =
|
|
7561
|
-
const
|
|
7637
|
+
const ilvl = inlinePropsSafe?.numberingProperties?.ilvl ?? styleProps?.numberingProperties?.ilvl;
|
|
7638
|
+
let numId = inlinePropsSafe?.numberingProperties?.numId ?? styleProps?.numberingProperties?.numId;
|
|
7639
|
+
let numberingDefinedInline = inlinePropsSafe?.numberingProperties?.numId != null;
|
|
7640
|
+
const inlineNumId = inlinePropsSafe?.numberingProperties?.numId;
|
|
7641
|
+
const inlineNumIdDisablesNumbering = inlineNumId === 0 || inlineNumId === "0";
|
|
7562
7642
|
if (inlineNumIdDisablesNumbering) {
|
|
7563
7643
|
numId = null;
|
|
7564
7644
|
}
|
|
7565
7645
|
const isList2 = numId != null && numId !== 0 && numId !== "0";
|
|
7566
7646
|
if (isList2) {
|
|
7567
|
-
|
|
7568
|
-
numberingProps = getNumberingProperties(params,
|
|
7647
|
+
const ilvlNum = ilvl != null ? ilvl : 0;
|
|
7648
|
+
numberingProps = getNumberingProperties(translators, params, ilvlNum, numId, translators.pPr);
|
|
7569
7649
|
if (overrideInlineStyleId && numberingProps.styleId) {
|
|
7570
7650
|
styleId = numberingProps.styleId;
|
|
7571
|
-
styleProps = resolveStyleChain(params, styleId,
|
|
7572
|
-
if (
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7651
|
+
styleProps = resolveStyleChain(params, styleId, translators.pPr);
|
|
7652
|
+
if (inlinePropsSafe) {
|
|
7653
|
+
inlinePropsSafe.styleId = styleId;
|
|
7654
|
+
const inlineNumProps = inlinePropsSafe.numberingProperties;
|
|
7655
|
+
if (styleProps.numberingProperties?.ilvl === inlineNumProps?.ilvl && styleProps.numberingProperties?.numId === inlineNumProps?.numId) {
|
|
7656
|
+
delete inlinePropsSafe.numberingProperties;
|
|
7576
7657
|
numberingDefinedInline = false;
|
|
7577
7658
|
}
|
|
7578
7659
|
}
|
|
7579
7660
|
}
|
|
7580
7661
|
}
|
|
7581
|
-
const tableProps = tableStyleId ? resolveStyleChain(params, tableStyleId,
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
defaultsChain = [defaultProps, normalProps];
|
|
7585
|
-
} else {
|
|
7586
|
-
defaultsChain = [normalProps, defaultProps];
|
|
7587
|
-
}
|
|
7588
|
-
const propsChain = [...defaultsChain, tableProps, numberingProps, styleProps, inlineProps];
|
|
7662
|
+
const tableProps = tableStyleId ? resolveStyleChain(params, tableStyleId, translators.pPr) : {};
|
|
7663
|
+
const defaultsChain = orderDefaultsAndNormal(defaultProps, normalProps, isNormalDefault);
|
|
7664
|
+
const propsChain = [...defaultsChain, tableProps, numberingProps, styleProps, inlinePropsSafe];
|
|
7589
7665
|
let indentChain;
|
|
7590
7666
|
if (isList2) {
|
|
7591
7667
|
if (numberingDefinedInline) {
|
|
7592
|
-
indentChain = [...defaultsChain, styleProps, numberingProps,
|
|
7668
|
+
indentChain = [...defaultsChain, styleProps, numberingProps, inlinePropsSafe];
|
|
7593
7669
|
} else {
|
|
7594
|
-
styleProps = resolveStyleChain(params, styleId,
|
|
7595
|
-
indentChain = [...defaultsChain, numberingProps, styleProps,
|
|
7670
|
+
styleProps = resolveStyleChain(params, styleId, translators.pPr, false);
|
|
7671
|
+
indentChain = [...defaultsChain, numberingProps, styleProps, inlinePropsSafe];
|
|
7596
7672
|
}
|
|
7597
7673
|
} else {
|
|
7598
|
-
indentChain = [...defaultsChain, numberingProps, styleProps,
|
|
7674
|
+
indentChain = [...defaultsChain, numberingProps, styleProps, inlinePropsSafe];
|
|
7599
7675
|
}
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
indentChain.map((props) => props.indent != null ? { indent: props.indent } : {}),
|
|
7603
|
-
[],
|
|
7604
|
-
{
|
|
7605
|
-
firstLine: (target, source) => {
|
|
7606
|
-
if (target.hanging != null && source.firstLine != null) {
|
|
7607
|
-
delete target.hanging;
|
|
7608
|
-
}
|
|
7609
|
-
return source.firstLine;
|
|
7610
|
-
}
|
|
7611
|
-
}
|
|
7612
|
-
);
|
|
7676
|
+
const finalProps = combineProperties$1(propsChain);
|
|
7677
|
+
const finalIndent = combineIndentProperties(indentChain);
|
|
7613
7678
|
finalProps.indent = finalIndent.indent;
|
|
7614
|
-
if (insideTable && !
|
|
7679
|
+
if (insideTable && !inlinePropsSafe?.spacing && !styleProps?.spacing) {
|
|
7615
7680
|
finalProps.spacing = void 0;
|
|
7616
7681
|
}
|
|
7617
7682
|
return finalProps;
|
|
7618
7683
|
}
|
|
7619
|
-
|
|
7620
|
-
let styleProps = {}
|
|
7684
|
+
function resolveStyleChain(params, styleId, translator2, followBasedOnChain = true) {
|
|
7685
|
+
let styleProps = {};
|
|
7686
|
+
let basedOn = void 0;
|
|
7621
7687
|
if (styleId && styleId !== "Normal") {
|
|
7622
7688
|
({ properties: styleProps, basedOn } = getStyleProperties(params, styleId, translator2));
|
|
7623
7689
|
}
|
|
@@ -7629,7 +7695,7 @@ const resolveStyleChain = (params, styleId, translator2, followBasedOnChain = tr
|
|
|
7629
7695
|
break;
|
|
7630
7696
|
}
|
|
7631
7697
|
seenStyles.add(basedOn);
|
|
7632
|
-
const result = getStyleProperties(params,
|
|
7698
|
+
const result = getStyleProperties(params, nextBasedOn, translator2);
|
|
7633
7699
|
const basedOnProps = result.properties;
|
|
7634
7700
|
nextBasedOn = result.basedOn;
|
|
7635
7701
|
if (basedOnProps && Object.keys(basedOnProps).length) {
|
|
@@ -7638,120 +7704,151 @@ const resolveStyleChain = (params, styleId, translator2, followBasedOnChain = tr
|
|
|
7638
7704
|
basedOn = nextBasedOn;
|
|
7639
7705
|
}
|
|
7640
7706
|
styleChain = styleChain.reverse();
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
};
|
|
7707
|
+
return combineProperties$1(styleChain);
|
|
7708
|
+
}
|
|
7644
7709
|
function getDefaultProperties(params, translator2) {
|
|
7645
|
-
const
|
|
7646
|
-
const styles = docx["word/styles.xml"];
|
|
7710
|
+
const docx = params?.docx;
|
|
7711
|
+
const styles = docx?.["word/styles.xml"];
|
|
7647
7712
|
const rootElements = styles?.elements?.[0]?.elements;
|
|
7648
7713
|
if (!rootElements?.length) {
|
|
7649
7714
|
return {};
|
|
7650
7715
|
}
|
|
7651
7716
|
const defaults = rootElements.find((el) => el.name === "w:docDefaults");
|
|
7652
7717
|
const xmlName = translator2.xmlName;
|
|
7653
|
-
const
|
|
7654
|
-
const
|
|
7718
|
+
const defaultsElements = defaults?.elements;
|
|
7719
|
+
const elementPrDefault = defaultsElements?.find((el) => el.name === `${xmlName}Default`);
|
|
7720
|
+
const elementPrDefaultElements = elementPrDefault?.elements;
|
|
7721
|
+
const elementPr = elementPrDefaultElements?.find((el) => el.name === xmlName);
|
|
7655
7722
|
if (!elementPr) {
|
|
7656
7723
|
return {};
|
|
7657
7724
|
}
|
|
7658
|
-
|
|
7659
|
-
return result;
|
|
7725
|
+
return translator2.encode({ ...params, nodes: [elementPr] }) || {};
|
|
7660
7726
|
}
|
|
7661
7727
|
function getStyleProperties(params, styleId, translator2) {
|
|
7662
|
-
const {
|
|
7663
|
-
const emptyResult = { properties: {}, isDefault: false, basedOn: null };
|
|
7728
|
+
const emptyResult = { properties: {}, isDefault: false, basedOn: void 0 };
|
|
7664
7729
|
if (!styleId) return emptyResult;
|
|
7665
|
-
const
|
|
7730
|
+
const docx = params?.docx;
|
|
7731
|
+
const styles = docx?.["word/styles.xml"];
|
|
7666
7732
|
const rootElements = styles?.elements?.[0]?.elements;
|
|
7667
7733
|
if (!rootElements?.length) {
|
|
7668
7734
|
return emptyResult;
|
|
7669
7735
|
}
|
|
7670
|
-
const style = rootElements.find(
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
const
|
|
7736
|
+
const style = rootElements.find(
|
|
7737
|
+
(el) => el.name === "w:style" && el.attributes?.["w:styleId"] === styleId
|
|
7738
|
+
);
|
|
7739
|
+
const styleElements = style?.elements;
|
|
7740
|
+
const basedOnElement = styleElements?.find((el) => el.name === "w:basedOn");
|
|
7741
|
+
const basedOn = basedOnElement?.attributes?.["w:val"];
|
|
7742
|
+
const elementPr = styleElements?.find((el) => el.name === translator2.xmlName);
|
|
7676
7743
|
if (!elementPr) {
|
|
7677
7744
|
return { ...emptyResult, basedOn };
|
|
7678
7745
|
}
|
|
7679
7746
|
const result = translator2.encode({ ...params, nodes: [elementPr] }) || {};
|
|
7680
|
-
|
|
7747
|
+
const isDefault = style?.attributes?.["w:default"] === "1";
|
|
7748
|
+
return { properties: result, isDefault, basedOn };
|
|
7681
7749
|
}
|
|
7682
|
-
function getNumberingProperties(params, ilvl, numId, translator2, tries = 0) {
|
|
7683
|
-
const
|
|
7684
|
-
if (!
|
|
7685
|
-
const { definitions, abstracts } =
|
|
7750
|
+
function getNumberingProperties(translators, params, ilvl, numId, translator2, tries = 0) {
|
|
7751
|
+
const numbering = params?.numbering;
|
|
7752
|
+
if (!numbering) return {};
|
|
7753
|
+
const { definitions, abstracts } = numbering;
|
|
7754
|
+
if (!definitions || !abstracts) return {};
|
|
7686
7755
|
const propertiesChain = [];
|
|
7687
7756
|
const numDefinition = definitions[numId];
|
|
7688
7757
|
if (!numDefinition) return {};
|
|
7689
|
-
const
|
|
7690
|
-
|
|
7758
|
+
const numDefElements = numDefinition.elements;
|
|
7759
|
+
const lvlOverride = numDefElements?.find(
|
|
7760
|
+
(element) => element.name === "w:lvlOverride" && element.attributes?.["w:ilvl"] == ilvl
|
|
7691
7761
|
);
|
|
7692
|
-
const
|
|
7762
|
+
const lvlOverrideElements = lvlOverride?.elements;
|
|
7763
|
+
const overridePr = lvlOverrideElements?.find((el) => el.name === translator2.xmlName);
|
|
7693
7764
|
if (overridePr) {
|
|
7694
7765
|
const overrideProps = translator2.encode({ ...params, nodes: [overridePr] }) || {};
|
|
7695
7766
|
propertiesChain.push(overrideProps);
|
|
7696
7767
|
}
|
|
7697
|
-
const
|
|
7768
|
+
const abstractNumIdElement = numDefElements?.find((item) => item.name === "w:abstractNumId");
|
|
7769
|
+
const abstractNumId = abstractNumIdElement?.attributes?.["w:val"];
|
|
7698
7770
|
const listDefinitionForThisNumId = abstracts[abstractNumId];
|
|
7699
7771
|
if (!listDefinitionForThisNumId) return {};
|
|
7700
|
-
const
|
|
7772
|
+
const listDefElements = listDefinitionForThisNumId.elements;
|
|
7773
|
+
const numStyleLink = listDefElements?.find((item) => item.name === "w:numStyleLink");
|
|
7701
7774
|
const styleId = numStyleLink?.attributes?.["w:val"];
|
|
7702
7775
|
if (styleId && tries < 1) {
|
|
7703
|
-
const { properties: styleProps } = getStyleProperties(params, styleId,
|
|
7704
|
-
|
|
7705
|
-
|
|
7776
|
+
const { properties: styleProps } = getStyleProperties(params, styleId, translators.pPr);
|
|
7777
|
+
const numIdFromStyle = styleProps?.numberingProperties?.numId;
|
|
7778
|
+
if (numIdFromStyle) {
|
|
7779
|
+
return getNumberingProperties(
|
|
7780
|
+
translators,
|
|
7781
|
+
params,
|
|
7782
|
+
ilvl,
|
|
7783
|
+
numIdFromStyle,
|
|
7784
|
+
translator2,
|
|
7785
|
+
tries + 1
|
|
7786
|
+
);
|
|
7706
7787
|
}
|
|
7707
7788
|
}
|
|
7708
|
-
const levelDefinition =
|
|
7709
|
-
(element) => element.name === "w:lvl" && element.attributes["w:ilvl"] == ilvl
|
|
7789
|
+
const levelDefinition = listDefElements?.find(
|
|
7790
|
+
(element) => element.name === "w:lvl" && element.attributes?.["w:ilvl"] == ilvl
|
|
7710
7791
|
);
|
|
7711
7792
|
if (!levelDefinition) return {};
|
|
7712
|
-
const
|
|
7793
|
+
const levelDefElements = levelDefinition.elements;
|
|
7794
|
+
const abstractElementPr = levelDefElements?.find((el) => el.name === translator2.xmlName);
|
|
7713
7795
|
if (!abstractElementPr) return {};
|
|
7714
7796
|
const abstractProps = translator2.encode({ ...params, nodes: [abstractElementPr] }) || {};
|
|
7715
|
-
const pStyleElement =
|
|
7797
|
+
const pStyleElement = levelDefElements?.find((el) => el.name === "w:pStyle");
|
|
7716
7798
|
if (pStyleElement) {
|
|
7717
|
-
const pStyleId = pStyleElement
|
|
7799
|
+
const pStyleId = pStyleElement.attributes?.["w:val"];
|
|
7718
7800
|
abstractProps.styleId = pStyleId;
|
|
7719
7801
|
}
|
|
7720
7802
|
propertiesChain.push(abstractProps);
|
|
7721
7803
|
propertiesChain.reverse();
|
|
7722
|
-
|
|
7723
|
-
return result;
|
|
7804
|
+
return combineProperties$1(propertiesChain);
|
|
7724
7805
|
}
|
|
7725
|
-
|
|
7726
|
-
if (!
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
const
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
output[key] = source[key];
|
|
7747
|
-
}
|
|
7748
|
-
}
|
|
7749
|
-
}
|
|
7750
|
-
}
|
|
7806
|
+
function resolveDocxFontFamily(attributes, docx, toCssFontFamily) {
|
|
7807
|
+
if (!attributes || typeof attributes !== "object") return null;
|
|
7808
|
+
const ascii = attributes["w:ascii"] ?? attributes["ascii"];
|
|
7809
|
+
const themeAscii = attributes["w:asciiTheme"] ?? attributes["asciiTheme"];
|
|
7810
|
+
let resolved = ascii;
|
|
7811
|
+
if (docx && themeAscii) {
|
|
7812
|
+
const theme = docx["word/theme/theme1.xml"];
|
|
7813
|
+
const themeElements = theme?.elements;
|
|
7814
|
+
if (themeElements?.length) {
|
|
7815
|
+
const topElement = themeElements[0];
|
|
7816
|
+
const topElementElements = topElement?.elements;
|
|
7817
|
+
const themeElementsNode = topElementElements?.find((el) => el.name === "a:themeElements");
|
|
7818
|
+
const themeElementsElements = themeElementsNode?.elements;
|
|
7819
|
+
const fontScheme = themeElementsElements?.find((el) => el.name === "a:fontScheme");
|
|
7820
|
+
const fontSchemeElements = fontScheme?.elements;
|
|
7821
|
+
const prefix = themeAscii.startsWith("minor") ? "minor" : "major";
|
|
7822
|
+
const font = fontSchemeElements?.find((el) => el.name === `a:${prefix}Font`);
|
|
7823
|
+
const fontElements = font?.elements;
|
|
7824
|
+
const latin = fontElements?.find((el) => el.name === "a:latin");
|
|
7825
|
+
const typeface = latin?.attributes?.typeface;
|
|
7826
|
+
resolved = typeface || resolved;
|
|
7751
7827
|
}
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7828
|
+
}
|
|
7829
|
+
if (!resolved) return null;
|
|
7830
|
+
if (toCssFontFamily) {
|
|
7831
|
+
return toCssFontFamily(resolved, docx ?? void 0);
|
|
7832
|
+
}
|
|
7833
|
+
return resolved;
|
|
7834
|
+
}
|
|
7835
|
+
const ooxmlResolver = createOoxmlResolver({ pPr: translator$14, rPr: translator$1O });
|
|
7836
|
+
const getToCssFontFamily = () => {
|
|
7837
|
+
return SuperConverter.toCssFontFamily;
|
|
7838
|
+
};
|
|
7839
|
+
const SUBSCRIPT_SUPERSCRIPT_SCALE = 0.65;
|
|
7840
|
+
const resolveRunProperties = (params, inlineRpr, resolvedPpr, isListNumber = false, numberingDefinedInline = false) => ooxmlResolver.resolveRunProperties(params, inlineRpr, resolvedPpr, isListNumber, numberingDefinedInline);
|
|
7841
|
+
function resolveParagraphProperties(params, inlineProps, insideTable = false, overrideInlineStyleId = false, tableStyleId = null) {
|
|
7842
|
+
return ooxmlResolver.resolveParagraphProperties(
|
|
7843
|
+
params,
|
|
7844
|
+
inlineProps,
|
|
7845
|
+
insideTable,
|
|
7846
|
+
overrideInlineStyleId,
|
|
7847
|
+
tableStyleId
|
|
7848
|
+
);
|
|
7849
|
+
}
|
|
7850
|
+
const combineProperties = (propertiesArray, fullOverrideProps = [], specialHandling = {}) => {
|
|
7851
|
+
return combineProperties$1(propertiesArray, { fullOverrideProps, specialHandling });
|
|
7755
7852
|
};
|
|
7756
7853
|
const combineRunProperties = (propertiesArray) => {
|
|
7757
7854
|
return combineProperties(propertiesArray, ["fontFamily", "color"]);
|
|
@@ -7810,9 +7907,9 @@ function encodeMarksFromRPr(runProperties, docx) {
|
|
|
7810
7907
|
textStyleAttrs[key] = `${spacing}pt`;
|
|
7811
7908
|
break;
|
|
7812
7909
|
case "fontFamily":
|
|
7813
|
-
const fontFamily =
|
|
7910
|
+
const fontFamily = resolveDocxFontFamily(value, docx, getToCssFontFamily());
|
|
7814
7911
|
textStyleAttrs[key] = fontFamily;
|
|
7815
|
-
const eastAsiaFamily = value["eastAsia"];
|
|
7912
|
+
const eastAsiaFamily = typeof value === "object" && value !== null ? value["eastAsia"] : void 0;
|
|
7816
7913
|
if (eastAsiaFamily) {
|
|
7817
7914
|
const eastAsiaCss = getFontFamilyValue$1({ "w:ascii": eastAsiaFamily }, docx);
|
|
7818
7915
|
if (!fontFamily || eastAsiaCss !== textStyleAttrs.fontFamily) {
|
|
@@ -8067,11 +8164,11 @@ function encodeCSSFromRPr(runProperties, docx) {
|
|
|
8067
8164
|
}
|
|
8068
8165
|
case "fontFamily": {
|
|
8069
8166
|
if (!value) break;
|
|
8070
|
-
const fontFamily =
|
|
8167
|
+
const fontFamily = resolveDocxFontFamily(value, docx, getToCssFontFamily());
|
|
8071
8168
|
if (fontFamily) {
|
|
8072
8169
|
css["font-family"] = fontFamily;
|
|
8073
8170
|
}
|
|
8074
|
-
const eastAsiaFamily = value["eastAsia"];
|
|
8171
|
+
const eastAsiaFamily = typeof value === "object" && value !== null ? value["eastAsia"] : void 0;
|
|
8075
8172
|
if (eastAsiaFamily) {
|
|
8076
8173
|
const eastAsiaCss = getFontFamilyValue$1({ "w:ascii": eastAsiaFamily }, docx);
|
|
8077
8174
|
if (eastAsiaCss && (!fontFamily || eastAsiaCss !== fontFamily)) {
|
|
@@ -9418,6 +9515,9 @@ function handleTableCellNode({
|
|
|
9418
9515
|
columnIndex,
|
|
9419
9516
|
columnWidth = null,
|
|
9420
9517
|
allColumnWidths = [],
|
|
9518
|
+
rowIndex = 0,
|
|
9519
|
+
totalRows = 1,
|
|
9520
|
+
totalColumns,
|
|
9421
9521
|
_referencedStyles
|
|
9422
9522
|
}) {
|
|
9423
9523
|
const { nodeListHandler } = params;
|
|
@@ -9426,19 +9526,46 @@ function handleTableCellNode({
|
|
|
9426
9526
|
const tcPr = node.elements.find((el) => el.name === "w:tcPr");
|
|
9427
9527
|
const tableCellProperties = tcPr ? translator$J.encode({ ...params, nodes: [tcPr] }) ?? {} : {};
|
|
9428
9528
|
attributes["tableCellProperties"] = tableCellProperties;
|
|
9429
|
-
|
|
9430
|
-
|
|
9431
|
-
|
|
9432
|
-
|
|
9433
|
-
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
}
|
|
9437
|
-
if (rowBorders)
|
|
9438
|
-
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
|
|
9529
|
+
const effectiveTotalColumns = totalColumns ?? (allColumnWidths.length || 1);
|
|
9530
|
+
const effectiveTotalRows = totalRows ?? (table?.elements?.filter((el) => el.name === "w:tr").length || 1);
|
|
9531
|
+
const colspan = parseInt(tableCellProperties.gridSpan || 1, 10);
|
|
9532
|
+
const isFirstRow = rowIndex === 0;
|
|
9533
|
+
const isLastRow = rowIndex === effectiveTotalRows - 1;
|
|
9534
|
+
const isFirstColumn = columnIndex === 0;
|
|
9535
|
+
const isLastColumn = columnIndex + colspan >= effectiveTotalColumns;
|
|
9536
|
+
const cellBorders = {};
|
|
9537
|
+
if (rowBorders) {
|
|
9538
|
+
if (rowBorders.top?.val === "none") {
|
|
9539
|
+
cellBorders.top = rowBorders.top;
|
|
9540
|
+
} else if (isFirstRow && rowBorders.top) {
|
|
9541
|
+
cellBorders.top = rowBorders.top;
|
|
9542
|
+
}
|
|
9543
|
+
if (rowBorders.bottom?.val === "none") {
|
|
9544
|
+
cellBorders.bottom = rowBorders.bottom;
|
|
9545
|
+
} else if (isLastRow && rowBorders.bottom) {
|
|
9546
|
+
cellBorders.bottom = rowBorders.bottom;
|
|
9547
|
+
}
|
|
9548
|
+
if (rowBorders.left?.val === "none") {
|
|
9549
|
+
cellBorders.left = rowBorders.left;
|
|
9550
|
+
} else if (isFirstColumn && rowBorders.left) {
|
|
9551
|
+
cellBorders.left = rowBorders.left;
|
|
9552
|
+
}
|
|
9553
|
+
if (rowBorders.right?.val === "none") {
|
|
9554
|
+
cellBorders.right = rowBorders.right;
|
|
9555
|
+
} else if (isLastColumn && rowBorders.right) {
|
|
9556
|
+
cellBorders.right = rowBorders.right;
|
|
9557
|
+
}
|
|
9558
|
+
if (!isLastRow && rowBorders.insideH) {
|
|
9559
|
+
cellBorders.bottom = rowBorders.insideH;
|
|
9560
|
+
}
|
|
9561
|
+
if (!isLastColumn && rowBorders.insideV) {
|
|
9562
|
+
cellBorders.right = rowBorders.insideV;
|
|
9563
|
+
}
|
|
9564
|
+
}
|
|
9565
|
+
attributes["borders"] = cellBorders;
|
|
9566
|
+
const inlineBorders = processInlineCellBorders(tableCellProperties.borders, cellBorders);
|
|
9567
|
+
if (inlineBorders) attributes["borders"] = Object.assign(attributes["borders"], inlineBorders);
|
|
9568
|
+
if (colspan > 1) attributes["colspan"] = colspan;
|
|
9442
9569
|
let width = tableCellProperties.cellWidth?.value ? helpers.twipsToPixels(tableCellProperties.cellWidth?.value) : null;
|
|
9443
9570
|
const widthType = tableCellProperties.cellWidth?.type;
|
|
9444
9571
|
if (widthType) attributes["widthType"] = widthType;
|
|
@@ -9448,10 +9575,9 @@ function handleTableCellNode({
|
|
|
9448
9575
|
attributes["widthUnit"] = "px";
|
|
9449
9576
|
const defaultColWidths = allColumnWidths;
|
|
9450
9577
|
const hasDefaultColWidths = allColumnWidths && allColumnWidths.length > 0;
|
|
9451
|
-
|
|
9452
|
-
if (colspanNum && colspanNum > 1 && hasDefaultColWidths) {
|
|
9578
|
+
if (colspan > 1 && hasDefaultColWidths) {
|
|
9453
9579
|
let colwidth = [];
|
|
9454
|
-
for (let i = 0; i <
|
|
9580
|
+
for (let i = 0; i < colspan; i++) {
|
|
9455
9581
|
let colwidthValue = defaultColWidths[columnIndex + i];
|
|
9456
9582
|
let defaultColwidth = 100;
|
|
9457
9583
|
if (typeof colwidthValue !== "undefined") {
|
|
@@ -9601,22 +9727,18 @@ const processInlineCellBorders = (borders, rowBorders) => {
|
|
|
9601
9727
|
return ["bottom", "top", "left", "right"].reduce((acc, direction) => {
|
|
9602
9728
|
const borderAttrs = borders[direction];
|
|
9603
9729
|
const rowBorderAttrs = rowBorders[direction];
|
|
9604
|
-
if (borderAttrs && borderAttrs["val"] !== "
|
|
9730
|
+
if (borderAttrs && borderAttrs["val"] !== "none") {
|
|
9605
9731
|
const color = borderAttrs["color"];
|
|
9606
9732
|
let size = borderAttrs["size"];
|
|
9607
9733
|
if (size) size = helpers.eighthPointsToPixels(size);
|
|
9608
9734
|
acc[direction] = { color, size, val: borderAttrs["val"] };
|
|
9609
9735
|
return acc;
|
|
9610
9736
|
}
|
|
9611
|
-
if (borderAttrs && borderAttrs["val"] === "
|
|
9737
|
+
if (borderAttrs && borderAttrs["val"] === "none") {
|
|
9612
9738
|
const border = Object.assign({}, rowBorderAttrs || {});
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
border["val"] = "none";
|
|
9617
|
-
acc[direction] = border;
|
|
9618
|
-
return acc;
|
|
9619
|
-
}
|
|
9739
|
+
border["val"] = "none";
|
|
9740
|
+
acc[direction] = border;
|
|
9741
|
+
return acc;
|
|
9620
9742
|
}
|
|
9621
9743
|
return acc;
|
|
9622
9744
|
}, {});
|
|
@@ -9752,6 +9874,9 @@ function encode$w(params, encodedAttrs) {
|
|
|
9752
9874
|
columnIndex,
|
|
9753
9875
|
columnWidth,
|
|
9754
9876
|
columnWidths: allColumnWidths,
|
|
9877
|
+
rowIndex,
|
|
9878
|
+
totalRows,
|
|
9879
|
+
totalColumns,
|
|
9755
9880
|
_referencedStyles
|
|
9756
9881
|
} = params.extraParams;
|
|
9757
9882
|
const schemaNode = handleTableCellNode({
|
|
@@ -9763,6 +9888,9 @@ function encode$w(params, encodedAttrs) {
|
|
|
9763
9888
|
columnIndex,
|
|
9764
9889
|
columnWidth,
|
|
9765
9890
|
allColumnWidths,
|
|
9891
|
+
rowIndex,
|
|
9892
|
+
totalRows,
|
|
9893
|
+
totalColumns,
|
|
9766
9894
|
_referencedStyles
|
|
9767
9895
|
});
|
|
9768
9896
|
if (encodedAttrs && Object.keys(encodedAttrs).length) {
|
|
@@ -9786,13 +9914,26 @@ const config$i = {
|
|
|
9786
9914
|
attributes: validXmlAttributes$a
|
|
9787
9915
|
};
|
|
9788
9916
|
const translator$I = NodeTranslator.from(config$i);
|
|
9789
|
-
const
|
|
9917
|
+
const propertyTranslators$3 = [
|
|
9918
|
+
translator$1q,
|
|
9919
|
+
translator$Z,
|
|
9920
|
+
translator$X,
|
|
9921
|
+
translator$W,
|
|
9922
|
+
translator$1o,
|
|
9923
|
+
translator$1m,
|
|
9924
|
+
translator$V,
|
|
9925
|
+
translator$1k
|
|
9926
|
+
];
|
|
9927
|
+
const translator$H = NodeTranslator.from(
|
|
9928
|
+
createNestedPropertiesTranslator("w:tblBorders", "borders", propertyTranslators$3)
|
|
9929
|
+
);
|
|
9930
|
+
const translator$G = NodeTranslator.from({
|
|
9790
9931
|
xmlName: "w:cantSplit",
|
|
9791
9932
|
sdNodeOrKeyName: "cantSplit",
|
|
9792
9933
|
encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
9793
9934
|
decode: ({ node }) => node.attrs?.cantSplit ? { attributes: {} } : void 0
|
|
9794
9935
|
});
|
|
9795
|
-
const translator$
|
|
9936
|
+
const translator$F = NodeTranslator.from(
|
|
9796
9937
|
createSingleAttrPropertyHandler(
|
|
9797
9938
|
"w:gridAfter",
|
|
9798
9939
|
null,
|
|
@@ -9801,7 +9942,7 @@ const translator$G = NodeTranslator.from(
|
|
|
9801
9942
|
(v2) => integerToString(v2)
|
|
9802
9943
|
)
|
|
9803
9944
|
);
|
|
9804
|
-
const translator$
|
|
9945
|
+
const translator$E = NodeTranslator.from(
|
|
9805
9946
|
createSingleAttrPropertyHandler(
|
|
9806
9947
|
"w:gridBefore",
|
|
9807
9948
|
null,
|
|
@@ -9810,20 +9951,20 @@ const translator$F = NodeTranslator.from(
|
|
|
9810
9951
|
(v2) => integerToString(v2)
|
|
9811
9952
|
)
|
|
9812
9953
|
);
|
|
9813
|
-
const translator$
|
|
9954
|
+
const translator$D = NodeTranslator.from({
|
|
9814
9955
|
xmlName: "w:hidden",
|
|
9815
9956
|
sdNodeOrKeyName: "hidden",
|
|
9816
9957
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
9817
9958
|
decode: ({ node }) => node.attrs.hidden ? { attributes: {} } : void 0
|
|
9818
9959
|
});
|
|
9819
|
-
const translator$
|
|
9820
|
-
const translator$
|
|
9960
|
+
const translator$C = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
|
|
9961
|
+
const translator$B = NodeTranslator.from({
|
|
9821
9962
|
xmlName: "w:tblHeader",
|
|
9822
9963
|
sdNodeOrKeyName: "repeatHeader",
|
|
9823
9964
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
9824
9965
|
decode: ({ node }) => node.attrs.repeatHeader ? { attributes: {} } : void 0
|
|
9825
9966
|
});
|
|
9826
|
-
const translator$
|
|
9967
|
+
const translator$A = NodeTranslator.from({
|
|
9827
9968
|
xmlName: "w:trHeight",
|
|
9828
9969
|
sdNodeOrKeyName: "rowHeight",
|
|
9829
9970
|
encode: ({ nodes }) => {
|
|
@@ -9850,24 +9991,24 @@ const translator$B = NodeTranslator.from({
|
|
|
9850
9991
|
return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
|
|
9851
9992
|
}
|
|
9852
9993
|
});
|
|
9853
|
-
const translator$
|
|
9854
|
-
const translator$
|
|
9855
|
-
const propertyTranslators$
|
|
9856
|
-
translator$
|
|
9994
|
+
const translator$z = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
|
|
9995
|
+
const translator$y = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
|
|
9996
|
+
const propertyTranslators$2 = [
|
|
9997
|
+
translator$G,
|
|
9857
9998
|
translator$1I,
|
|
9858
9999
|
translator$1G,
|
|
9859
|
-
translator$G,
|
|
9860
10000
|
translator$F,
|
|
9861
10001
|
translator$E,
|
|
9862
|
-
translator$1D,
|
|
9863
10002
|
translator$D,
|
|
10003
|
+
translator$1D,
|
|
9864
10004
|
translator$C,
|
|
9865
10005
|
translator$B,
|
|
9866
10006
|
translator$A,
|
|
9867
|
-
translator$z
|
|
10007
|
+
translator$z,
|
|
10008
|
+
translator$y
|
|
9868
10009
|
];
|
|
9869
|
-
const translator$
|
|
9870
|
-
createNestedPropertiesTranslator("w:trPr", "tableRowProperties", propertyTranslators$
|
|
10010
|
+
const translator$x = NodeTranslator.from(
|
|
10011
|
+
createNestedPropertiesTranslator("w:trPr", "tableRowProperties", propertyTranslators$2, {
|
|
9871
10012
|
cantSplit: false,
|
|
9872
10013
|
hidden: false,
|
|
9873
10014
|
repeatHeader: false
|
|
@@ -9945,7 +10086,7 @@ const encode$v = (params, encodedAttrs) => {
|
|
|
9945
10086
|
let tableRowProperties = {};
|
|
9946
10087
|
const tPr = row.elements.find((el) => el.name === "w:trPr");
|
|
9947
10088
|
if (tPr) {
|
|
9948
|
-
tableRowProperties = translator$
|
|
10089
|
+
tableRowProperties = translator$x.encode({
|
|
9949
10090
|
...params,
|
|
9950
10091
|
nodes: [tPr]
|
|
9951
10092
|
});
|
|
@@ -9955,6 +10096,12 @@ const encode$v = (params, encodedAttrs) => {
|
|
|
9955
10096
|
encodedAttrs["tableRowProperties"] = Object.freeze(tableRowProperties);
|
|
9956
10097
|
encodedAttrs["rowHeight"] = helpers.twipsToPixels(tableRowProperties["rowHeight"]?.value);
|
|
9957
10098
|
encodedAttrs["cantSplit"] = tableRowProperties["cantSplit"];
|
|
10099
|
+
const baseBorders = params.extraParams?.rowBorders;
|
|
10100
|
+
const rowTableBorders = getRowTableBorders({
|
|
10101
|
+
params,
|
|
10102
|
+
row,
|
|
10103
|
+
baseBorders
|
|
10104
|
+
});
|
|
9958
10105
|
const { columnWidths: gridColumnWidths, activeRowSpans = [] } = params.extraParams;
|
|
9959
10106
|
const totalColumns = Array.isArray(gridColumnWidths) ? gridColumnWidths.length : 0;
|
|
9960
10107
|
const pendingRowSpans = Array.isArray(activeRowSpans) ? activeRowSpans.slice() : [];
|
|
@@ -9987,6 +10134,10 @@ const encode$v = (params, encodedAttrs) => {
|
|
|
9987
10134
|
path: [...params.path || [], node],
|
|
9988
10135
|
extraParams: {
|
|
9989
10136
|
...params.extraParams,
|
|
10137
|
+
rowBorders: {
|
|
10138
|
+
...baseBorders,
|
|
10139
|
+
...rowTableBorders
|
|
10140
|
+
},
|
|
9990
10141
|
node,
|
|
9991
10142
|
columnIndex: startColumn,
|
|
9992
10143
|
columnWidth
|
|
@@ -10016,6 +10167,33 @@ const encode$v = (params, encodedAttrs) => {
|
|
|
10016
10167
|
};
|
|
10017
10168
|
return newNode;
|
|
10018
10169
|
};
|
|
10170
|
+
function getRowTableBorders({ params, row, baseBorders }) {
|
|
10171
|
+
const tblPrEx = row?.elements?.find?.((el) => el.name === "w:tblPrEx");
|
|
10172
|
+
const tblBorders = tblPrEx?.elements?.find?.((el) => el.name === "w:tblBorders");
|
|
10173
|
+
if (!tblBorders) {
|
|
10174
|
+
return baseBorders;
|
|
10175
|
+
}
|
|
10176
|
+
const rawOverrides = translator$H.encode({ ...params, nodes: [tblBorders] }) || {};
|
|
10177
|
+
const overrides = processRawTableBorders(rawOverrides);
|
|
10178
|
+
if (!Object.keys(overrides).length) {
|
|
10179
|
+
return baseBorders;
|
|
10180
|
+
}
|
|
10181
|
+
return { ...baseBorders || {}, ...overrides };
|
|
10182
|
+
}
|
|
10183
|
+
function processRawTableBorders(rawBorders) {
|
|
10184
|
+
const borders = {};
|
|
10185
|
+
Object.entries(rawBorders || {}).forEach(([name, attributes]) => {
|
|
10186
|
+
const attrs = {};
|
|
10187
|
+
const color = attributes?.color;
|
|
10188
|
+
const size = attributes?.size;
|
|
10189
|
+
const val = attributes?.val;
|
|
10190
|
+
if (color && color !== "auto") attrs.color = color.startsWith("#") ? color : `#${color}`;
|
|
10191
|
+
if (size != null && size !== "auto") attrs.size = helpers.eighthPointsToPixels(size);
|
|
10192
|
+
if (val) attrs.val = val;
|
|
10193
|
+
borders[name] = attrs;
|
|
10194
|
+
});
|
|
10195
|
+
return borders;
|
|
10196
|
+
}
|
|
10019
10197
|
const decode$x = (params, decodedAttrs) => {
|
|
10020
10198
|
const { node } = params;
|
|
10021
10199
|
const cells = node.content || [];
|
|
@@ -10056,7 +10234,7 @@ const decode$x = (params, decodedAttrs) => {
|
|
|
10056
10234
|
}
|
|
10057
10235
|
}
|
|
10058
10236
|
tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
|
|
10059
|
-
const trPr = translator$
|
|
10237
|
+
const trPr = translator$x.decode({
|
|
10060
10238
|
...params,
|
|
10061
10239
|
node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
|
|
10062
10240
|
});
|
|
@@ -10076,7 +10254,7 @@ const config$h = {
|
|
|
10076
10254
|
decode: decode$x,
|
|
10077
10255
|
attributes: validXmlAttributes$9
|
|
10078
10256
|
};
|
|
10079
|
-
const translator$
|
|
10257
|
+
const translator$w = NodeTranslator.from(config$h);
|
|
10080
10258
|
function parseTagValueJSON(json) {
|
|
10081
10259
|
if (typeof json !== "string") {
|
|
10082
10260
|
return {};
|
|
@@ -24767,7 +24945,7 @@ const config$g = {
|
|
|
24767
24945
|
decode: decode$w,
|
|
24768
24946
|
attributes: validXmlAttributes$8
|
|
24769
24947
|
};
|
|
24770
|
-
const translator$
|
|
24948
|
+
const translator$v = NodeTranslator.from(config$g);
|
|
24771
24949
|
function handleInlineNode(params) {
|
|
24772
24950
|
const { node } = params.extraParams;
|
|
24773
24951
|
if (node.name !== "wp:inline") {
|
|
@@ -24821,7 +24999,7 @@ const config$f = {
|
|
|
24821
24999
|
decode: decode$v,
|
|
24822
25000
|
attributes: validXmlAttributes$7
|
|
24823
25001
|
};
|
|
24824
|
-
const translator$
|
|
25002
|
+
const translator$u = NodeTranslator.from(config$f);
|
|
24825
25003
|
const XML_NODE_NAME$f = "w:drawing";
|
|
24826
25004
|
const SD_NODE_NAME$d = [];
|
|
24827
25005
|
const validXmlAttributes$6 = [];
|
|
@@ -24829,8 +25007,8 @@ function encode$s(params) {
|
|
|
24829
25007
|
const nodes = params.nodes;
|
|
24830
25008
|
const node = nodes[0];
|
|
24831
25009
|
const translatorByChildName = {
|
|
24832
|
-
"wp:anchor": translator$
|
|
24833
|
-
"wp:inline": translator$
|
|
25010
|
+
"wp:anchor": translator$v,
|
|
25011
|
+
"wp:inline": translator$u
|
|
24834
25012
|
};
|
|
24835
25013
|
const result = (node.elements || []).reduce((acc, child) => {
|
|
24836
25014
|
if (acc) return acc;
|
|
@@ -24853,7 +25031,7 @@ function decode$u(params) {
|
|
|
24853
25031
|
if (!node || !node.type) {
|
|
24854
25032
|
return null;
|
|
24855
25033
|
}
|
|
24856
|
-
const childTranslator = node.attrs.isAnchor ? translator$
|
|
25034
|
+
const childTranslator = node.attrs.isAnchor ? translator$v : translator$u;
|
|
24857
25035
|
const resultNode = childTranslator.decode(params);
|
|
24858
25036
|
return wrapTextInRun(
|
|
24859
25037
|
{
|
|
@@ -24871,7 +25049,7 @@ const config$e = {
|
|
|
24871
25049
|
decode: decode$u,
|
|
24872
25050
|
attributes: validXmlAttributes$6
|
|
24873
25051
|
};
|
|
24874
|
-
const translator$
|
|
25052
|
+
const translator$t = NodeTranslator.from(config$e);
|
|
24875
25053
|
function getTextNodeForExport(text, marks, params) {
|
|
24876
25054
|
const hasLeadingOrTrailingSpace = /^\s|\s$/.test(text);
|
|
24877
25055
|
const space = hasLeadingOrTrailingSpace ? "preserve" : null;
|
|
@@ -25221,8 +25399,9 @@ function translateFieldAnnotation(params) {
|
|
|
25221
25399
|
hash: attrs.hash
|
|
25222
25400
|
};
|
|
25223
25401
|
const annotationAttrsJson = JSON.stringify(annotationAttrs);
|
|
25402
|
+
const sanitizedDisplayLabel = attrs.displayLabel === "undefined" || attrs.displayLabel === void 0 ? "" : attrs.displayLabel;
|
|
25224
25403
|
const sdtPrElements = [
|
|
25225
|
-
{ name: "w:alias", attributes: { "w:val":
|
|
25404
|
+
{ name: "w:alias", attributes: { "w:val": sanitizedDisplayLabel } },
|
|
25226
25405
|
{ name: "w:tag", attributes: { "w:val": annotationAttrsJson } },
|
|
25227
25406
|
{ name: "w:id", attributes: { "w:val": id } }
|
|
25228
25407
|
];
|
|
@@ -25278,7 +25457,7 @@ function prepareTextAnnotation(params) {
|
|
|
25278
25457
|
return getTextNodeForExport(attrs.displayLabel, [...marks, ...marksFromAttrs], params);
|
|
25279
25458
|
}
|
|
25280
25459
|
function prepareImageAnnotation(params, imageSize) {
|
|
25281
|
-
return translator$
|
|
25460
|
+
return translator$t.decode({
|
|
25282
25461
|
...params,
|
|
25283
25462
|
imageSize
|
|
25284
25463
|
});
|
|
@@ -25740,7 +25919,7 @@ const config$d = {
|
|
|
25740
25919
|
decode: decode$t,
|
|
25741
25920
|
attributes: validXmlAttributes$5
|
|
25742
25921
|
};
|
|
25743
|
-
const translator$
|
|
25922
|
+
const translator$s = NodeTranslator.from(config$d);
|
|
25744
25923
|
function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
25745
25924
|
if (!table || !Array.isArray(table.content)) {
|
|
25746
25925
|
return table;
|
|
@@ -25781,17 +25960,17 @@ function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
|
25781
25960
|
}
|
|
25782
25961
|
return table;
|
|
25783
25962
|
}
|
|
25784
|
-
const translator$
|
|
25963
|
+
const translator$r = NodeTranslator.from({
|
|
25785
25964
|
xmlName: "w:bidiVisual",
|
|
25786
25965
|
sdNodeOrKeyName: "rightToLeft",
|
|
25787
25966
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
25788
25967
|
decode: ({ node }) => node.attrs.rightToLeft ? { attributes: {} } : void 0
|
|
25789
25968
|
});
|
|
25790
|
-
const translator$
|
|
25791
|
-
const translator$
|
|
25792
|
-
const translator$
|
|
25793
|
-
const translator$
|
|
25794
|
-
const translator$
|
|
25969
|
+
const translator$q = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
|
|
25970
|
+
const translator$p = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
|
|
25971
|
+
const translator$o = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
|
|
25972
|
+
const translator$n = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
|
|
25973
|
+
const translator$m = NodeTranslator.from({
|
|
25795
25974
|
xmlName: "w:tblLook",
|
|
25796
25975
|
sdNodeOrKeyName: "tblLook",
|
|
25797
25976
|
attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
|
|
@@ -25803,16 +25982,16 @@ const translator$n = NodeTranslator.from({
|
|
|
25803
25982
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25804
25983
|
}
|
|
25805
25984
|
});
|
|
25806
|
-
const translator$
|
|
25807
|
-
const translator$
|
|
25808
|
-
const translator$
|
|
25985
|
+
const translator$l = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
|
|
25986
|
+
const translator$k = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
|
|
25987
|
+
const translator$j = NodeTranslator.from(
|
|
25809
25988
|
createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
|
|
25810
25989
|
);
|
|
25811
|
-
const translator$
|
|
25990
|
+
const translator$i = NodeTranslator.from(
|
|
25812
25991
|
createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
|
|
25813
25992
|
);
|
|
25814
|
-
const translator$
|
|
25815
|
-
const translator$
|
|
25993
|
+
const translator$h = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
|
|
25994
|
+
const translator$g = NodeTranslator.from({
|
|
25816
25995
|
xmlName: "w:tblpPr",
|
|
25817
25996
|
sdNodeOrKeyName: "floatingTableProperties",
|
|
25818
25997
|
attributes: ["w:leftFromText", "w:rightFromText", "w:topFromText", "w:bottomFromText", "w:tblpX", "w:tblpY"].map((attr) => createAttributeHandler(attr, null, parseInteger, integerToString)).concat(["w:horzAnchor", "w:vertAnchor", "w:tblpXSpec", "w:tblpYSpec"].map((attr) => createAttributeHandler(attr))),
|
|
@@ -25824,19 +26003,6 @@ const translator$h = NodeTranslator.from({
|
|
|
25824
26003
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25825
26004
|
}
|
|
25826
26005
|
});
|
|
25827
|
-
const propertyTranslators$2 = [
|
|
25828
|
-
translator$1q,
|
|
25829
|
-
translator$Z,
|
|
25830
|
-
translator$X,
|
|
25831
|
-
translator$W,
|
|
25832
|
-
translator$1o,
|
|
25833
|
-
translator$1m,
|
|
25834
|
-
translator$V,
|
|
25835
|
-
translator$1k
|
|
25836
|
-
];
|
|
25837
|
-
const translator$g = NodeTranslator.from(
|
|
25838
|
-
createNestedPropertiesTranslator("w:tblBorders", "borders", propertyTranslators$2)
|
|
25839
|
-
);
|
|
25840
26006
|
const propertyTranslators$1 = [
|
|
25841
26007
|
translator$1p,
|
|
25842
26008
|
translator$Y,
|
|
@@ -25849,12 +26015,11 @@ const translator$f = NodeTranslator.from(
|
|
|
25849
26015
|
createNestedPropertiesTranslator("w:tblCellMar", "cellMargins", propertyTranslators$1)
|
|
25850
26016
|
);
|
|
25851
26017
|
const propertyTranslators = [
|
|
25852
|
-
translator$
|
|
26018
|
+
translator$r,
|
|
25853
26019
|
translator$1D,
|
|
25854
26020
|
translator$2b,
|
|
25855
|
-
translator$r,
|
|
25856
|
-
translator$D,
|
|
25857
26021
|
translator$q,
|
|
26022
|
+
translator$C,
|
|
25858
26023
|
translator$p,
|
|
25859
26024
|
translator$o,
|
|
25860
26025
|
translator$n,
|
|
@@ -25865,6 +26030,7 @@ const propertyTranslators = [
|
|
|
25865
26030
|
translator$i,
|
|
25866
26031
|
translator$h,
|
|
25867
26032
|
translator$g,
|
|
26033
|
+
translator$H,
|
|
25868
26034
|
translator$f
|
|
25869
26035
|
];
|
|
25870
26036
|
const translator$e = NodeTranslator.from(
|
|
@@ -26124,8 +26290,7 @@ const encode$p = (params, encodedAttrs) => {
|
|
|
26124
26290
|
}
|
|
26125
26291
|
const borderProps = _processTableBorders(encodedAttrs.tableProperties.borders || {});
|
|
26126
26292
|
const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params) || {};
|
|
26127
|
-
|
|
26128
|
-
encodedAttrs.borders = { ...referencedStyles.borders, ...borderProps.borders };
|
|
26293
|
+
encodedAttrs.borders = { ...referencedStyles.borders, ...borderProps };
|
|
26129
26294
|
encodedAttrs.tableProperties.cellMargins = referencedStyles.cellMargins = {
|
|
26130
26295
|
...referencedStyles.cellMargins,
|
|
26131
26296
|
...encodedAttrs.tableProperties.cellMargins
|
|
@@ -26146,19 +26311,22 @@ const encode$p = (params, encodedAttrs) => {
|
|
|
26146
26311
|
}
|
|
26147
26312
|
const content = [];
|
|
26148
26313
|
const totalColumns = columnWidths.length;
|
|
26314
|
+
const totalRows = rows.length;
|
|
26149
26315
|
const activeRowSpans = totalColumns > 0 ? new Array(totalColumns).fill(0) : [];
|
|
26150
26316
|
rows.forEach((row, rowIndex) => {
|
|
26151
|
-
const result = translator$
|
|
26317
|
+
const result = translator$w.encode({
|
|
26152
26318
|
...params,
|
|
26153
26319
|
path: [...params.path || [], node],
|
|
26154
26320
|
nodes: [row],
|
|
26155
26321
|
extraParams: {
|
|
26156
26322
|
row,
|
|
26157
26323
|
table: node,
|
|
26158
|
-
rowBorders,
|
|
26324
|
+
rowBorders: encodedAttrs.borders,
|
|
26159
26325
|
columnWidths,
|
|
26160
26326
|
activeRowSpans: activeRowSpans.slice(),
|
|
26161
26327
|
rowIndex,
|
|
26328
|
+
totalRows,
|
|
26329
|
+
totalColumns,
|
|
26162
26330
|
_referencedStyles: referencedStyles
|
|
26163
26331
|
}
|
|
26164
26332
|
});
|
|
@@ -26233,21 +26401,17 @@ const decode$r = (params, decodedAttrs) => {
|
|
|
26233
26401
|
};
|
|
26234
26402
|
function _processTableBorders(rawBorders) {
|
|
26235
26403
|
const borders = {};
|
|
26236
|
-
const rowBorders = {};
|
|
26237
26404
|
Object.entries(rawBorders).forEach(([name, attributes]) => {
|
|
26238
26405
|
const attrs = {};
|
|
26239
26406
|
const color = attributes.color;
|
|
26240
26407
|
const size = attributes.size;
|
|
26408
|
+
const val = attributes.val;
|
|
26241
26409
|
if (color && color !== "auto") attrs["color"] = color.startsWith("#") ? color : `#${color}`;
|
|
26242
26410
|
if (size && size !== "auto") attrs["size"] = helpers.eighthPointsToPixels(size);
|
|
26243
|
-
|
|
26244
|
-
if (rowBorderNames.includes(name)) rowBorders[name] = attrs;
|
|
26411
|
+
if (val) attrs["val"] = val;
|
|
26245
26412
|
borders[name] = attrs;
|
|
26246
26413
|
});
|
|
26247
|
-
return
|
|
26248
|
-
borders,
|
|
26249
|
-
rowBorders
|
|
26250
|
-
};
|
|
26414
|
+
return borders;
|
|
26251
26415
|
}
|
|
26252
26416
|
function _getReferencedTableStyles(tableStyleReference, params) {
|
|
26253
26417
|
if (!tableStyleReference) return null;
|
|
@@ -26287,9 +26451,8 @@ function _getReferencedTableStyles(tableStyleReference, params) {
|
|
|
26287
26451
|
}
|
|
26288
26452
|
const tableProperties = translator$e.encode({ ...params, nodes: [tblPr] });
|
|
26289
26453
|
if (tableProperties) {
|
|
26290
|
-
const
|
|
26291
|
-
if (borders) stylesToReturn.borders = borders;
|
|
26292
|
-
if (rowBorders) stylesToReturn.rowBorders = rowBorders;
|
|
26454
|
+
const borders = _processTableBorders(tableProperties.borders || {});
|
|
26455
|
+
if (borders || Object.keys(borders).length) stylesToReturn.borders = borders;
|
|
26293
26456
|
const cellMargins = {};
|
|
26294
26457
|
Object.entries(tableProperties.cellMargins || {}).forEach(([key, attrs]) => {
|
|
26295
26458
|
if (attrs?.value != null) {
|
|
@@ -27138,7 +27301,7 @@ const handleDrawingNode = (params) => {
|
|
|
27138
27301
|
return { nodes: [], consumed: 0 };
|
|
27139
27302
|
}
|
|
27140
27303
|
const translatorParams = { ...params, nodes: [node] };
|
|
27141
|
-
const schemaNode = translator$
|
|
27304
|
+
const schemaNode = translator$t.encode(translatorParams);
|
|
27142
27305
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
27143
27306
|
return { nodes: newNodes, consumed: 1 };
|
|
27144
27307
|
};
|
|
@@ -27295,7 +27458,8 @@ const encode$1 = (params, encodedAttrs = {}) => {
|
|
|
27295
27458
|
text = text.replace(/^[ \t\n\r]+/, "").replace(/[ \t\n\r]+$/, "");
|
|
27296
27459
|
}
|
|
27297
27460
|
text = text.replace(/\[\[sdspace\]\]/g, "");
|
|
27298
|
-
|
|
27461
|
+
const isWhitespaceOnly = /^[ \t\n\r]*$/.test(text);
|
|
27462
|
+
if (xmlSpace !== "preserve" && isWhitespaceOnly) {
|
|
27299
27463
|
return null;
|
|
27300
27464
|
}
|
|
27301
27465
|
} else if (!elements.length && encodedAttrs.xmlSpace === "preserve") {
|
|
@@ -27380,7 +27544,7 @@ const handleSdtNode = (params) => {
|
|
|
27380
27544
|
if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
|
|
27381
27545
|
return { nodes: [], consumed: 0 };
|
|
27382
27546
|
}
|
|
27383
|
-
const result = translator$
|
|
27547
|
+
const result = translator$s.encode(params);
|
|
27384
27548
|
if (!result) {
|
|
27385
27549
|
return { nodes: [], consumed: 0 };
|
|
27386
27550
|
}
|
|
@@ -27408,12 +27572,12 @@ const translatorList = Array.from(
|
|
|
27408
27572
|
translator$1s,
|
|
27409
27573
|
translator$2n,
|
|
27410
27574
|
translator$2m,
|
|
27411
|
-
translator$
|
|
27575
|
+
translator$r,
|
|
27412
27576
|
translator$9,
|
|
27413
27577
|
translator$a,
|
|
27414
27578
|
translator$1q,
|
|
27415
27579
|
translator$2r,
|
|
27416
|
-
translator$
|
|
27580
|
+
translator$G,
|
|
27417
27581
|
translator$2c,
|
|
27418
27582
|
translator$1I,
|
|
27419
27583
|
translator$2h,
|
|
@@ -27421,7 +27585,7 @@ const translatorList = Array.from(
|
|
|
27421
27585
|
translator$1R,
|
|
27422
27586
|
translator$2,
|
|
27423
27587
|
translator$1G,
|
|
27424
|
-
translator$
|
|
27588
|
+
translator$t,
|
|
27425
27589
|
translator$2i,
|
|
27426
27590
|
translator$1T,
|
|
27427
27591
|
translator$1Z,
|
|
@@ -27430,13 +27594,13 @@ const translatorList = Array.from(
|
|
|
27430
27594
|
translator$Z,
|
|
27431
27595
|
translator$1U,
|
|
27432
27596
|
translator$1F,
|
|
27433
|
-
translator$G,
|
|
27434
27597
|
translator$F,
|
|
27598
|
+
translator$E,
|
|
27435
27599
|
translator$d,
|
|
27436
27600
|
translator$$,
|
|
27437
27601
|
translator$L,
|
|
27438
27602
|
translator$K,
|
|
27439
|
-
translator$
|
|
27603
|
+
translator$D,
|
|
27440
27604
|
translator$M,
|
|
27441
27605
|
translator$2q,
|
|
27442
27606
|
translator$12,
|
|
@@ -27478,7 +27642,7 @@ const translatorList = Array.from(
|
|
|
27478
27642
|
translator$2f,
|
|
27479
27643
|
translator$1S,
|
|
27480
27644
|
translator$1m,
|
|
27481
|
-
translator$
|
|
27645
|
+
translator$s,
|
|
27482
27646
|
translator$20,
|
|
27483
27647
|
translator$2b,
|
|
27484
27648
|
translator$27,
|
|
@@ -27496,23 +27660,23 @@ const translatorList = Array.from(
|
|
|
27496
27660
|
translator$2p,
|
|
27497
27661
|
translator$1b,
|
|
27498
27662
|
translator$b,
|
|
27499
|
-
translator$
|
|
27500
|
-
translator$r,
|
|
27501
|
-
translator$f,
|
|
27502
|
-
translator$D,
|
|
27663
|
+
translator$H,
|
|
27503
27664
|
translator$q,
|
|
27504
|
-
translator$
|
|
27665
|
+
translator$f,
|
|
27505
27666
|
translator$C,
|
|
27506
27667
|
translator$p,
|
|
27668
|
+
translator$c,
|
|
27669
|
+
translator$B,
|
|
27507
27670
|
translator$o,
|
|
27508
27671
|
translator$n,
|
|
27509
27672
|
translator$m,
|
|
27510
|
-
translator$e,
|
|
27511
27673
|
translator$l,
|
|
27674
|
+
translator$e,
|
|
27512
27675
|
translator$k,
|
|
27513
27676
|
translator$j,
|
|
27514
27677
|
translator$i,
|
|
27515
27678
|
translator$h,
|
|
27679
|
+
translator$g,
|
|
27516
27680
|
translator$I,
|
|
27517
27681
|
translator$R,
|
|
27518
27682
|
translator$O,
|
|
@@ -27521,10 +27685,10 @@ const translatorList = Array.from(
|
|
|
27521
27685
|
translator$10,
|
|
27522
27686
|
translator$19,
|
|
27523
27687
|
translator$T,
|
|
27524
|
-
translator$
|
|
27688
|
+
translator$w,
|
|
27525
27689
|
translator$S,
|
|
27526
|
-
translator$
|
|
27527
|
-
translator$
|
|
27690
|
+
translator$A,
|
|
27691
|
+
translator$x,
|
|
27528
27692
|
translator$1a,
|
|
27529
27693
|
translator$18,
|
|
27530
27694
|
translator$17,
|
|
@@ -27535,13 +27699,13 @@ const translatorList = Array.from(
|
|
|
27535
27699
|
translator$28,
|
|
27536
27700
|
translator$_,
|
|
27537
27701
|
translator$1X,
|
|
27538
|
-
translator$A,
|
|
27539
27702
|
translator$z,
|
|
27703
|
+
translator$y,
|
|
27540
27704
|
translator$1P,
|
|
27541
27705
|
translator$16,
|
|
27542
27706
|
translator$15,
|
|
27543
|
-
translator$w,
|
|
27544
27707
|
translator$v,
|
|
27708
|
+
translator$u,
|
|
27545
27709
|
commentRangeStartTranslator,
|
|
27546
27710
|
commentRangeEndTranslator
|
|
27547
27711
|
])
|
|
@@ -27880,8 +28044,8 @@ function importCommentData({ docx, editor, converter }) {
|
|
|
27880
28044
|
converter,
|
|
27881
28045
|
path: [el]
|
|
27882
28046
|
});
|
|
27883
|
-
const
|
|
27884
|
-
const paraId = attrs["w14:paraId"];
|
|
28047
|
+
const lastElement = parsedElements[parsedElements.length - 1];
|
|
28048
|
+
const paraId = lastElement?.attrs?.["w14:paraId"];
|
|
27885
28049
|
return {
|
|
27886
28050
|
commentId: internalId || uuid.v4(),
|
|
27887
28051
|
importedId,
|
|
@@ -27924,7 +28088,11 @@ const generateCommentsWithExtendedData = ({ docx, comments }) => {
|
|
|
27924
28088
|
if (!extendedDef) return { ...comment, isDone: comment.isDone ?? false };
|
|
27925
28089
|
const { isDone, paraIdParent } = getExtendedDetails(extendedDef);
|
|
27926
28090
|
let parentComment;
|
|
27927
|
-
if (paraIdParent)
|
|
28091
|
+
if (paraIdParent) {
|
|
28092
|
+
parentComment = comments.find(
|
|
28093
|
+
(c) => c.paraId === paraIdParent || c.elements?.some((el) => el.attrs?.["w14:paraId"] === paraIdParent)
|
|
28094
|
+
);
|
|
28095
|
+
}
|
|
27928
28096
|
const newComment = {
|
|
27929
28097
|
...comment,
|
|
27930
28098
|
isDone: isDone ?? false,
|
|
@@ -29809,13 +29977,13 @@ function exportSchemaToJson(params) {
|
|
|
29809
29977
|
text: translator$1,
|
|
29810
29978
|
lineBreak: translator$2r,
|
|
29811
29979
|
table: translator$b,
|
|
29812
|
-
tableRow: translator$
|
|
29980
|
+
tableRow: translator$w,
|
|
29813
29981
|
tableCell: translator$I,
|
|
29814
29982
|
bookmarkStart: translator$a,
|
|
29815
29983
|
bookmarkEnd: translator$9,
|
|
29816
|
-
fieldAnnotation: translator$
|
|
29984
|
+
fieldAnnotation: translator$s,
|
|
29817
29985
|
tab: translator$2p,
|
|
29818
|
-
image: translator$
|
|
29986
|
+
image: translator$t,
|
|
29819
29987
|
hardBreak: translator$2r,
|
|
29820
29988
|
commentRangeStart: commentRangeStartTranslator,
|
|
29821
29989
|
commentRangeEnd: commentRangeEndTranslator,
|
|
@@ -29827,10 +29995,10 @@ function exportSchemaToJson(params) {
|
|
|
29827
29995
|
contentBlock: translator,
|
|
29828
29996
|
vectorShape: translateVectorShape,
|
|
29829
29997
|
shapeGroup: translateShapeGroup,
|
|
29830
|
-
structuredContent: translator$
|
|
29831
|
-
structuredContentBlock: translator$
|
|
29832
|
-
documentPartObject: translator$
|
|
29833
|
-
documentSection: translator$
|
|
29998
|
+
structuredContent: translator$s,
|
|
29999
|
+
structuredContentBlock: translator$s,
|
|
30000
|
+
documentPartObject: translator$s,
|
|
30001
|
+
documentSection: translator$s,
|
|
29834
30002
|
"page-number": translator$4,
|
|
29835
30003
|
"total-page-number": translator$3,
|
|
29836
30004
|
pageReference: translator$6,
|
|
@@ -30840,7 +31008,7 @@ class SuperConverter {
|
|
|
30840
31008
|
static getStoredSuperdocVersion(docx) {
|
|
30841
31009
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
30842
31010
|
}
|
|
30843
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.3.0-next.
|
|
31011
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.3.0-next.10") {
|
|
30844
31012
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
30845
31013
|
}
|
|
30846
31014
|
/**
|
|
@@ -31521,11 +31689,13 @@ exports.changeListLevel = changeListLevel;
|
|
|
31521
31689
|
exports.convertMarkdownToHTML = convertMarkdownToHTML;
|
|
31522
31690
|
exports.createDocFromHTML = createDocFromHTML;
|
|
31523
31691
|
exports.createDocFromMarkdown = createDocFromMarkdown;
|
|
31692
|
+
exports.createOoxmlResolver = createOoxmlResolver;
|
|
31524
31693
|
exports.decodeRPrFromMarks = decodeRPrFromMarks;
|
|
31525
31694
|
exports.docxNumberingHelpers = docxNumberingHelpers;
|
|
31526
31695
|
exports.dropPoint = dropPoint;
|
|
31527
31696
|
exports.encodeCSSFromPPr = encodeCSSFromPPr;
|
|
31528
31697
|
exports.encodeCSSFromRPr = encodeCSSFromRPr;
|
|
31698
|
+
exports.encodeMarksFromRPr = encodeMarksFromRPr;
|
|
31529
31699
|
exports.findParentNode = findParentNode;
|
|
31530
31700
|
exports.findParentNodeClosestToPos = findParentNodeClosestToPos;
|
|
31531
31701
|
exports.generateDocxRandomId = generateDocxRandomId;
|
|
@@ -31544,8 +31714,10 @@ exports.liftTarget = liftTarget;
|
|
|
31544
31714
|
exports.objectIncludes = objectIncludes;
|
|
31545
31715
|
exports.registeredHandlers = registeredHandlers;
|
|
31546
31716
|
exports.replaceStep = replaceStep;
|
|
31547
|
-
exports.
|
|
31717
|
+
exports.resolveDocxFontFamily = resolveDocxFontFamily;
|
|
31548
31718
|
exports.resolveRunProperties = resolveRunProperties;
|
|
31719
|
+
exports.translator = translator$14;
|
|
31720
|
+
exports.translator$1 = translator$1O;
|
|
31549
31721
|
exports.unflattenListsInHtml = unflattenListsInHtml;
|
|
31550
31722
|
exports.updateNumberingProperties = updateNumberingProperties;
|
|
31551
31723
|
exports.wrapTextsInRuns = wrapTextsInRuns;
|