@superdoc-dev/cli 0.5.0-next.8 → 0.5.0-next.9
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/index.js +195 -52
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -62964,7 +62964,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
|
|
|
62964
62964
|
emptyOptions2 = {};
|
|
62965
62965
|
});
|
|
62966
62966
|
|
|
62967
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
62967
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-CTUnwu05.es.js
|
|
62968
62968
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
62969
62969
|
const fieldValue = extension$1.config[field];
|
|
62970
62970
|
if (typeof fieldValue === "function")
|
|
@@ -72691,6 +72691,17 @@ function generateParagraphProperties(params3) {
|
|
|
72691
72691
|
const { node: node3 } = params3;
|
|
72692
72692
|
const { attrs = {} } = node3;
|
|
72693
72693
|
const paragraphProperties = carbonCopy(attrs.paragraphProperties || {});
|
|
72694
|
+
const inlineKeys = paragraphProperties.runPropertiesInlineKeys;
|
|
72695
|
+
delete paragraphProperties.runPropertiesInlineKeys;
|
|
72696
|
+
if (Array.isArray(inlineKeys) && inlineKeys.length === 0)
|
|
72697
|
+
delete paragraphProperties.runProperties;
|
|
72698
|
+
else if (Array.isArray(inlineKeys) && paragraphProperties.runProperties) {
|
|
72699
|
+
const filtered = Object.fromEntries(inlineKeys.filter((k) => (k in paragraphProperties.runProperties)).map((k) => [k, paragraphProperties.runProperties[k]]));
|
|
72700
|
+
if (Object.keys(filtered).length > 0)
|
|
72701
|
+
paragraphProperties.runProperties = filtered;
|
|
72702
|
+
else
|
|
72703
|
+
delete paragraphProperties.runProperties;
|
|
72704
|
+
}
|
|
72694
72705
|
let pPr = translator$126.decode({ node: {
|
|
72695
72706
|
...node3,
|
|
72696
72707
|
attrs: { paragraphProperties }
|
|
@@ -72754,7 +72765,13 @@ function mergeConsecutiveTrackedChanges(elements) {
|
|
|
72754
72765
|
return result;
|
|
72755
72766
|
}
|
|
72756
72767
|
function translateParagraphNode(params3) {
|
|
72757
|
-
let elements = translateChildNodes(
|
|
72768
|
+
let elements = translateChildNodes({
|
|
72769
|
+
...params3,
|
|
72770
|
+
extraParams: {
|
|
72771
|
+
...params3.extraParams,
|
|
72772
|
+
paragraphProperties: params3.node?.attrs?.paragraphProperties
|
|
72773
|
+
}
|
|
72774
|
+
});
|
|
72758
72775
|
elements = mergeConsecutiveTrackedChanges(elements);
|
|
72759
72776
|
const htmlAnnotationChild = elements.find((element) => element.name === "htmlAnnotation");
|
|
72760
72777
|
if (htmlAnnotationChild)
|
|
@@ -72841,6 +72858,45 @@ function _addNewLinkRelationship(params3, link2) {
|
|
|
72841
72858
|
});
|
|
72842
72859
|
return `rId${id2}`;
|
|
72843
72860
|
}
|
|
72861
|
+
function getParagraphStyleRunPropertiesFromStylesXml(docx, styleId, params3) {
|
|
72862
|
+
const stylesPart = docx?.[STYLES_KEY];
|
|
72863
|
+
if (!stylesPart?.elements?.[0]?.elements)
|
|
72864
|
+
return {};
|
|
72865
|
+
const styleElements = stylesPart.elements[0].elements.filter((el) => el.name === "w:style");
|
|
72866
|
+
const styleById = new Map(styleElements.map((el) => [el.attributes?.["w:styleId"], el]));
|
|
72867
|
+
const chain = [];
|
|
72868
|
+
let currentId = styleId;
|
|
72869
|
+
const seen = /* @__PURE__ */ new Set;
|
|
72870
|
+
while (currentId && !seen.has(currentId)) {
|
|
72871
|
+
seen.add(currentId);
|
|
72872
|
+
const styleTag = styleById.get(currentId);
|
|
72873
|
+
if (!styleTag)
|
|
72874
|
+
break;
|
|
72875
|
+
const rPr = styleTag.elements?.find((el) => el.name === "w:rPr");
|
|
72876
|
+
if (rPr?.elements?.length)
|
|
72877
|
+
chain.push(rPr);
|
|
72878
|
+
currentId = styleTag.elements?.find((el) => el.name === "w:basedOn")?.attributes?.["w:val"];
|
|
72879
|
+
}
|
|
72880
|
+
if (chain.length === 0)
|
|
72881
|
+
return {};
|
|
72882
|
+
const byName = {};
|
|
72883
|
+
chain.reverse().forEach((rPr) => {
|
|
72884
|
+
(rPr.elements || []).forEach((el) => {
|
|
72885
|
+
if (el?.name)
|
|
72886
|
+
byName[el.name] = el;
|
|
72887
|
+
});
|
|
72888
|
+
});
|
|
72889
|
+
const mergedRPr = {
|
|
72890
|
+
name: "w:rPr",
|
|
72891
|
+
elements: Object.values(byName)
|
|
72892
|
+
};
|
|
72893
|
+
const encodeParams = {
|
|
72894
|
+
...params3,
|
|
72895
|
+
docx: params3.docx ?? docx,
|
|
72896
|
+
nodes: [mergedRPr]
|
|
72897
|
+
};
|
|
72898
|
+
return translator$129.encode(encodeParams) ?? {};
|
|
72899
|
+
}
|
|
72844
72900
|
function handleTableCellNode({ params: params3, node: node3, table, row, tableProperties, columnIndex, columnWidth = null, allColumnWidths = [], preferTableGridWidths = false, _referencedStyles }) {
|
|
72845
72901
|
const { nodeListHandler } = params3;
|
|
72846
72902
|
const attributes = {};
|
|
@@ -72855,6 +72911,7 @@ function handleTableCellNode({ params: params3, node: node3, table, row, tablePr
|
|
|
72855
72911
|
nodes: [tcPr]
|
|
72856
72912
|
}) ?? {} : {};
|
|
72857
72913
|
attributes["tableCellProperties"] = tableCellProperties;
|
|
72914
|
+
attributes["tableCellPropertiesInlineKeys"] = Object.keys(tableCellProperties);
|
|
72858
72915
|
const colspan = parseInt(tableCellProperties.gridSpan || 1, 10);
|
|
72859
72916
|
if (colspan > 1)
|
|
72860
72917
|
attributes["colspan"] = colspan;
|
|
@@ -73037,6 +73094,7 @@ function translateTableCell(params3) {
|
|
|
73037
73094
|
}
|
|
73038
73095
|
function generateTableCellProperties(node3) {
|
|
73039
73096
|
let tableCellProperties = { ...node3.attrs?.tableCellProperties || {} };
|
|
73097
|
+
const inlineKeys = node3.attrs?.tableCellPropertiesInlineKeys;
|
|
73040
73098
|
const { attrs } = node3;
|
|
73041
73099
|
const { colwidth: rawColwidth, widthUnit = "px" } = attrs;
|
|
73042
73100
|
const resolvedWidthType = attrs.cellWidthType ?? (attrs.widthType !== "auto" ? attrs.widthType : undefined) ?? tableCellProperties.cellWidth?.type ?? "dxa";
|
|
@@ -73060,7 +73118,7 @@ function generateTableCellProperties(node3) {
|
|
|
73060
73118
|
else if (!background?.color && tableCellProperties?.shading?.fill)
|
|
73061
73119
|
delete tableCellProperties.shading;
|
|
73062
73120
|
const { cellMargins } = attrs;
|
|
73063
|
-
if (cellMargins)
|
|
73121
|
+
if (cellMargins && (!Array.isArray(inlineKeys) || inlineKeys.includes("cellMargins")))
|
|
73064
73122
|
[
|
|
73065
73123
|
"left",
|
|
73066
73124
|
"right",
|
|
@@ -89276,11 +89334,14 @@ function _getReferencedTableStyles(tableStyleReference, params3) {
|
|
|
89276
89334
|
}
|
|
89277
89335
|
const tblPr = styleTag.elements.find((el) => el.name === "w:tblPr");
|
|
89278
89336
|
if (tblPr && tblPr.elements) {
|
|
89279
|
-
|
|
89280
|
-
tblPr.
|
|
89337
|
+
const mergedTblPr = baseTblPr?.elements?.length > 0 ? {
|
|
89338
|
+
name: tblPr.name,
|
|
89339
|
+
attributes: tblPr.attributes,
|
|
89340
|
+
elements: [...baseTblPr.elements, ...tblPr.elements]
|
|
89341
|
+
} : tblPr;
|
|
89281
89342
|
const tableProperties = translator$163.encode({
|
|
89282
89343
|
...params3,
|
|
89283
|
-
nodes: [
|
|
89344
|
+
nodes: [mergedTblPr]
|
|
89284
89345
|
});
|
|
89285
89346
|
if (tableProperties) {
|
|
89286
89347
|
const borders = _processTableBorders(tableProperties.borders || {});
|
|
@@ -99251,11 +99312,14 @@ var isRegExp = (value) => {
|
|
|
99251
99312
|
let schemaNode;
|
|
99252
99313
|
const pPr = node3.elements?.find((el) => el.name === "w:pPr");
|
|
99253
99314
|
let inlineParagraphProperties = {};
|
|
99254
|
-
if (pPr)
|
|
99315
|
+
if (pPr) {
|
|
99255
99316
|
inlineParagraphProperties = translator$126.encode({
|
|
99256
99317
|
...params3,
|
|
99257
99318
|
nodes: [pPr]
|
|
99258
99319
|
}) || {};
|
|
99320
|
+
if (inlineParagraphProperties.runProperties && typeof inlineParagraphProperties.runProperties === "object")
|
|
99321
|
+
inlineParagraphProperties.runPropertiesInlineKeys = Object.keys(inlineParagraphProperties.runProperties);
|
|
99322
|
+
}
|
|
99259
99323
|
const tableStyleId = getTableStyleId(params3.path || []);
|
|
99260
99324
|
const resolvedParagraphProperties = resolveParagraphProperties(params3, inlineParagraphProperties, { tableStyleId });
|
|
99261
99325
|
const { elements = [], attributes = {}, marks = [] } = parseProperties(node3, params3.docx);
|
|
@@ -99634,7 +99698,7 @@ var isRegExp = (value) => {
|
|
|
99634
99698
|
return attributes["w:rsidDel"];
|
|
99635
99699
|
}, decode$53 = (attrs) => {
|
|
99636
99700
|
return attrs.rsidDel;
|
|
99637
|
-
}, attributes_default$4, XML_NODE_NAME$33 = "w:r", SD_KEY_NAME = "run", REFERENCE_RUN_STYLE_BY_XML_NAME, hasXmlNodeNamed = (node3, targetName) => {
|
|
99701
|
+
}, attributes_default$4, STYLES_KEY = "word/styles.xml", XML_NODE_NAME$33 = "w:r", SD_KEY_NAME = "run", REFERENCE_RUN_STYLE_BY_XML_NAME, hasXmlNodeNamed = (node3, targetName) => {
|
|
99638
99702
|
if (!node3 || typeof node3 !== "object")
|
|
99639
99703
|
return false;
|
|
99640
99704
|
if (node3.name === targetName)
|
|
@@ -99701,13 +99765,16 @@ var isRegExp = (value) => {
|
|
|
99701
99765
|
name: "w:vertAlign",
|
|
99702
99766
|
attributes: { "w:val": "superscript" }
|
|
99703
99767
|
});
|
|
99704
|
-
}, createRunNodeWithContent = (content$2, encodedAttrs, runLevelMarks,
|
|
99768
|
+
}, createRunNodeWithContent = (content$2, encodedAttrs, runLevelMarks, resolvedRunProperties, inlineKeysFromCombine, runPropertiesStyleKeys = null, runPropertiesOverrideKeys = null) => {
|
|
99705
99769
|
const node3 = {
|
|
99706
99770
|
type: SD_KEY_NAME,
|
|
99707
99771
|
content: content$2,
|
|
99708
99772
|
attrs: {
|
|
99709
99773
|
...encodedAttrs,
|
|
99710
|
-
runProperties
|
|
99774
|
+
runProperties: resolvedRunProperties,
|
|
99775
|
+
runPropertiesInlineKeys: inlineKeysFromCombine,
|
|
99776
|
+
runPropertiesStyleKeys: runPropertiesStyleKeys?.length ? runPropertiesStyleKeys : null,
|
|
99777
|
+
runPropertiesOverrideKeys: runPropertiesOverrideKeys?.length ? runPropertiesOverrideKeys : null
|
|
99711
99778
|
}
|
|
99712
99779
|
};
|
|
99713
99780
|
if (runLevelMarks.length)
|
|
@@ -99720,10 +99787,11 @@ var isRegExp = (value) => {
|
|
|
99720
99787
|
return;
|
|
99721
99788
|
const elements = Array.isArray(runNode.elements) ? runNode.elements : [];
|
|
99722
99789
|
const rPrNode = elements.find((child) => child?.name === "w:rPr");
|
|
99723
|
-
const
|
|
99790
|
+
const encodedRunProperties = (rPrNode ? translator$129.encode({
|
|
99724
99791
|
...params3,
|
|
99725
99792
|
nodes: [rPrNode]
|
|
99726
|
-
}) : {};
|
|
99793
|
+
}) : undefined) ?? {};
|
|
99794
|
+
const runPropertiesInlineKeysFromCombine = Object.keys(encodedRunProperties);
|
|
99727
99795
|
const paragraphProperties = params3?.extraParams?.paragraphProperties || {};
|
|
99728
99796
|
let tableInfo = null;
|
|
99729
99797
|
if (params3?.extraParams?.rowIndex != null && params3?.extraParams?.columnIndex != null && params3?.extraParams?.tableProperties != null && params3?.extraParams?.totalColumns != null && params3?.extraParams?.totalRows != null)
|
|
@@ -99734,7 +99802,8 @@ var isRegExp = (value) => {
|
|
|
99734
99802
|
numCells: params3.extraParams.totalColumns,
|
|
99735
99803
|
numRows: params3.extraParams.totalRows
|
|
99736
99804
|
};
|
|
99737
|
-
const
|
|
99805
|
+
const resolvedRunProperties = resolveRunProperties(params3, encodedRunProperties, paragraphProperties, tableInfo, false, params3?.extraParams?.numberingDefinedInline);
|
|
99806
|
+
const marksResult = encodeMarksFromRPr(resolvedRunProperties, params3?.docx);
|
|
99738
99807
|
const marks = Array.isArray(marksResult) ? marksResult : [];
|
|
99739
99808
|
const rPrChange = rPrNode?.elements?.find((el) => el.name === "w:rPrChange");
|
|
99740
99809
|
const styleChangeMarks = handleStyleChangeMarksV2(rPrChange, marks, params3) || [];
|
|
@@ -99786,14 +99855,21 @@ var isRegExp = (value) => {
|
|
|
99786
99855
|
marks: childMarks
|
|
99787
99856
|
};
|
|
99788
99857
|
}).filter(Boolean);
|
|
99858
|
+
let runPropertiesStyleKeys = null;
|
|
99859
|
+
if (encodedRunProperties?.styleId && params3?.docx) {
|
|
99860
|
+
const styleRPr = getParagraphStyleRunPropertiesFromStylesXml(params3.docx, encodedRunProperties.styleId, params3);
|
|
99861
|
+
if (styleRPr && Object.keys(styleRPr).length > 0)
|
|
99862
|
+
runPropertiesStyleKeys = Object.keys(styleRPr);
|
|
99863
|
+
}
|
|
99864
|
+
const runPropertiesOverrideKeys = runPropertiesStyleKeys?.length && runPropertiesInlineKeysFromCombine?.length ? runPropertiesInlineKeysFromCombine.filter((k) => runPropertiesStyleKeys.includes(k)) : null;
|
|
99789
99865
|
if (!filtered.some((child) => child?.type === "lineBreak"))
|
|
99790
|
-
return createRunNodeWithContent(filtered, encodedAttrs, runLevelMarks,
|
|
99866
|
+
return createRunNodeWithContent(filtered, encodedAttrs, runLevelMarks, resolvedRunProperties, runPropertiesInlineKeysFromCombine, runPropertiesStyleKeys, runPropertiesOverrideKeys);
|
|
99791
99867
|
const splitRuns = [];
|
|
99792
99868
|
let currentChunk = [];
|
|
99793
99869
|
const finalizeTextChunk = () => {
|
|
99794
99870
|
if (!currentChunk.length)
|
|
99795
99871
|
return;
|
|
99796
|
-
const chunkNode = createRunNodeWithContent(currentChunk, encodedAttrs, runLevelMarks,
|
|
99872
|
+
const chunkNode = createRunNodeWithContent(currentChunk, encodedAttrs, runLevelMarks, resolvedRunProperties, runPropertiesInlineKeysFromCombine, runPropertiesStyleKeys, runPropertiesOverrideKeys);
|
|
99797
99873
|
if (chunkNode)
|
|
99798
99874
|
splitRuns.push(chunkNode);
|
|
99799
99875
|
currentChunk = [];
|
|
@@ -99801,7 +99877,7 @@ var isRegExp = (value) => {
|
|
|
99801
99877
|
filtered.forEach((child) => {
|
|
99802
99878
|
if (child?.type === "lineBreak") {
|
|
99803
99879
|
finalizeTextChunk();
|
|
99804
|
-
const breakNode = createRunNodeWithContent([child], encodedAttrs, runLevelMarks,
|
|
99880
|
+
const breakNode = createRunNodeWithContent([child], encodedAttrs, runLevelMarks, resolvedRunProperties, runPropertiesInlineKeysFromCombine, runPropertiesStyleKeys, runPropertiesOverrideKeys);
|
|
99805
99881
|
if (breakNode)
|
|
99806
99882
|
splitRuns.push(breakNode);
|
|
99807
99883
|
} else
|
|
@@ -99825,7 +99901,15 @@ var isRegExp = (value) => {
|
|
|
99825
99901
|
}
|
|
99826
99902
|
const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext(node3);
|
|
99827
99903
|
const runTrackFormatMark = findTrackFormatMark(runNodeForExport.marks);
|
|
99828
|
-
const
|
|
99904
|
+
const runAttrs = runNodeForExport.attrs || {};
|
|
99905
|
+
const runProperties = runAttrs.runProperties || {};
|
|
99906
|
+
const inlineKeys = runAttrs.runPropertiesInlineKeys;
|
|
99907
|
+
const styleKeys = runAttrs.runPropertiesStyleKeys;
|
|
99908
|
+
const overrideKeys = runAttrs.runPropertiesOverrideKeys;
|
|
99909
|
+
const candidateKeys = inlineKeys != null ? [...new Set([...inlineKeys || [], ...overrideKeys || []])] : Object.keys(runProperties);
|
|
99910
|
+
const shouldExport = (key) => (key in (runProperties || {})) && (!(Array.isArray(styleKeys) && styleKeys.includes(key)) || Array.isArray(overrideKeys) && overrideKeys.includes(key));
|
|
99911
|
+
const exportKeys = candidateKeys.filter(shouldExport);
|
|
99912
|
+
const runPropertiesToExport = exportKeys.length > 0 ? Object.fromEntries(exportKeys.map((k) => [k, runProperties[k]])) : {};
|
|
99829
99913
|
const exportParams = {
|
|
99830
99914
|
...params3,
|
|
99831
99915
|
node: runNodeForExport,
|
|
@@ -99837,10 +99921,10 @@ var isRegExp = (value) => {
|
|
|
99837
99921
|
if (!exportParams.editor)
|
|
99838
99922
|
exportParams.editor = { extensionService: { extensions: [] } };
|
|
99839
99923
|
const childElements = translateChildNodes(exportParams) || [];
|
|
99840
|
-
let runPropertiesElement = translator$129.decode({
|
|
99924
|
+
let runPropertiesElement = Object.keys(runPropertiesToExport).length > 0 ? translator$129.decode({
|
|
99841
99925
|
...params3,
|
|
99842
|
-
node: { attrs: { runProperties } }
|
|
99843
|
-
});
|
|
99926
|
+
node: { attrs: { runProperties: runPropertiesToExport } }
|
|
99927
|
+
}) : null;
|
|
99844
99928
|
const runPropsTemplate = runPropertiesElement ? cloneXmlNode(runPropertiesElement) : null;
|
|
99845
99929
|
const applyBaseRunProps = (runNode) => applyRunPropertiesTemplate(runNode, runPropsTemplate);
|
|
99846
99930
|
const replaceRunProps = (runNode) => {
|
|
@@ -107347,19 +107431,35 @@ var isRegExp = (value) => {
|
|
|
107347
107431
|
return;
|
|
107348
107432
|
const { segments, firstInlineProps } = segmentRunByInlineProps(runNode, paragraphNode, tableInfo, $pos, editor, preservedDerivedKeys, preferExistingKeys);
|
|
107349
107433
|
const runProperties = firstInlineProps ?? null;
|
|
107434
|
+
const existingInlineKeys = runNode.attrs?.runPropertiesInlineKeys || [];
|
|
107435
|
+
const styleKeys = runNode.attrs?.runPropertiesStyleKeys || [];
|
|
107436
|
+
const keysFromMarks = (segment) => {
|
|
107437
|
+
const textNode = segment.content?.find((n) => n.isText);
|
|
107438
|
+
return Object.keys(decodeRPrFromMarks(textNode?.marks || []));
|
|
107439
|
+
};
|
|
107440
|
+
const overrideKeysFromInlineProps = (inlineProps) => styleKeys.filter((k) => inlineProps && (k in inlineProps));
|
|
107350
107441
|
if (segments.length === 1) {
|
|
107351
|
-
|
|
107442
|
+
const hadInlineKeys = Array.isArray(runNode.attrs?.runPropertiesInlineKeys) && runNode.attrs.runPropertiesInlineKeys.length > 0;
|
|
107443
|
+
if (JSON.stringify(runProperties) === JSON.stringify(runNode.attrs.runProperties) && hadInlineKeys)
|
|
107352
107444
|
return;
|
|
107445
|
+
const newInlineKeys = [...new Set([...existingInlineKeys, ...keysFromMarks(segments[0])])];
|
|
107446
|
+
const newOverrideKeys = overrideKeysFromInlineProps(runProperties);
|
|
107353
107447
|
tr.setNodeMarkup(mappedPos, runNode.type, {
|
|
107354
107448
|
...runNode.attrs,
|
|
107355
|
-
runProperties
|
|
107449
|
+
runProperties,
|
|
107450
|
+
runPropertiesInlineKeys: newInlineKeys.length ? newInlineKeys : null,
|
|
107451
|
+
runPropertiesOverrideKeys: newOverrideKeys.length ? newOverrideKeys : null
|
|
107356
107452
|
}, runNode.marks);
|
|
107357
107453
|
} else {
|
|
107358
107454
|
const newRuns = segments.map((segment) => {
|
|
107359
107455
|
const props = segment.inlineProps ?? null;
|
|
107456
|
+
const segmentInlineKeys = [...new Set([...existingInlineKeys, ...keysFromMarks(segment)])];
|
|
107457
|
+
const segmentOverrideKeys = overrideKeysFromInlineProps(props);
|
|
107360
107458
|
return runType.create({
|
|
107361
107459
|
...runNode.attrs ?? {},
|
|
107362
|
-
runProperties: props
|
|
107460
|
+
runProperties: props,
|
|
107461
|
+
runPropertiesInlineKeys: segmentInlineKeys.length ? segmentInlineKeys : null,
|
|
107462
|
+
runPropertiesOverrideKeys: segmentOverrideKeys.length ? segmentOverrideKeys : null
|
|
107363
107463
|
}, Fragment.fromArray(segment.content), runNode.marks);
|
|
107364
107464
|
});
|
|
107365
107465
|
const replacement = Fragment.fromArray(newRuns);
|
|
@@ -113235,7 +113335,7 @@ var isRegExp = (value) => {
|
|
|
113235
113335
|
state.kern = kernNode.attributes["w:val"];
|
|
113236
113336
|
}
|
|
113237
113337
|
}, SuperConverter;
|
|
113238
|
-
var
|
|
113338
|
+
var init_SuperConverter_CTUnwu05_es = __esm(() => {
|
|
113239
113339
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
113240
113340
|
init_jszip_ChlR43oI_es();
|
|
113241
113341
|
init_xml_js_40FWvL78_es();
|
|
@@ -171536,7 +171636,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
|
|
|
171536
171636
|
init_remark_gfm_z_sDF4ss_es();
|
|
171537
171637
|
});
|
|
171538
171638
|
|
|
171539
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
171639
|
+
// ../../packages/superdoc/dist/chunks/src-2Droteg9.es.js
|
|
171540
171640
|
function deleteProps(obj, propOrProps) {
|
|
171541
171641
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
171542
171642
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -196876,8 +196976,20 @@ function applyRunAttributePatch(tr, runType, absFrom, absTo, updates) {
|
|
|
196876
196976
|
const patchTo = Math.min(mappedTo, runContentTo);
|
|
196877
196977
|
if (patchFrom >= patchTo)
|
|
196878
196978
|
continue;
|
|
196879
|
-
const
|
|
196979
|
+
const currentRunProperties = isRecord$12(runNode.attrs?.runProperties) ? { ...runNode.attrs.runProperties } : {};
|
|
196980
|
+
const currentStyleKeys = Array.isArray(runNode.attrs?.runPropertiesStyleKeys) ? runNode.attrs.runPropertiesStyleKeys : [];
|
|
196981
|
+
const currentOverrideKeys = Array.isArray(runNode.attrs?.runPropertiesOverrideKeys) ? runNode.attrs.runPropertiesOverrideKeys : [];
|
|
196982
|
+
const hasInlineOwnershipMetadata = Array.isArray(runNode.attrs?.runPropertiesInlineKeys);
|
|
196983
|
+
let currentInlineKeys;
|
|
196984
|
+
if (hasInlineOwnershipMetadata)
|
|
196985
|
+
currentInlineKeys = runNode.attrs.runPropertiesInlineKeys;
|
|
196986
|
+
else if (currentStyleKeys.length > 0)
|
|
196987
|
+
currentInlineKeys = [...new Set([...Object.keys(currentRunProperties).filter((key$1) => !currentStyleKeys.includes(key$1)), ...currentOverrideKeys])];
|
|
196988
|
+
else
|
|
196989
|
+
currentInlineKeys = Object.keys(currentRunProperties);
|
|
196990
|
+
const nextRunProperties = { ...currentRunProperties };
|
|
196880
196991
|
let runChanged = false;
|
|
196992
|
+
const changedRunPropertyKeys = /* @__PURE__ */ new Set;
|
|
196881
196993
|
for (const [runPropertyKey, patchValue] of Object.entries(updates)) {
|
|
196882
196994
|
const existingValue = nextRunProperties[runPropertyKey];
|
|
196883
196995
|
const mergeResult = mergeRunAttributeValue(existingValue, patchValue);
|
|
@@ -196888,14 +197000,19 @@ function applyRunAttributePatch(tr, runType, absFrom, absTo, updates) {
|
|
|
196888
197000
|
else
|
|
196889
197001
|
nextRunProperties[runPropertyKey] = mergeResult.nextValue;
|
|
196890
197002
|
runChanged = true;
|
|
197003
|
+
changedRunPropertyKeys.add(runPropertyKey);
|
|
196891
197004
|
}
|
|
196892
197005
|
if (!runChanged)
|
|
196893
197006
|
continue;
|
|
196894
197007
|
const normalizedNextRunProperties = Object.keys(nextRunProperties).length > 0 ? nextRunProperties : null;
|
|
197008
|
+
const nextInlineKeys = [...new Set([...currentInlineKeys.filter((key$1) => normalizedNextRunProperties && (key$1 in normalizedNextRunProperties)), ...[...changedRunPropertyKeys].filter((key$1) => normalizedNextRunProperties && (key$1 in normalizedNextRunProperties))])];
|
|
197009
|
+
const nextOverrideKeys = [...new Set([...currentOverrideKeys.filter((key$1) => normalizedNextRunProperties && (key$1 in normalizedNextRunProperties) && currentStyleKeys.includes(key$1)), ...[...changedRunPropertyKeys].filter((key$1) => normalizedNextRunProperties && (key$1 in normalizedNextRunProperties) && currentStyleKeys.includes(key$1))])];
|
|
196895
197010
|
if (patchFrom === runContentFrom && patchTo === runContentTo) {
|
|
196896
197011
|
tr.setNodeMarkup(runPos, runNode.type, {
|
|
196897
197012
|
...runNode.attrs,
|
|
196898
|
-
runProperties: normalizedNextRunProperties
|
|
197013
|
+
runProperties: normalizedNextRunProperties,
|
|
197014
|
+
runPropertiesInlineKeys: nextInlineKeys.length ? nextInlineKeys : null,
|
|
197015
|
+
runPropertiesOverrideKeys: nextOverrideKeys.length ? nextOverrideKeys : null
|
|
196899
197016
|
}, runNode.marks);
|
|
196900
197017
|
changed = true;
|
|
196901
197018
|
continue;
|
|
@@ -196912,7 +197029,9 @@ function applyRunAttributePatch(tr, runType, absFrom, absTo, updates) {
|
|
|
196912
197029
|
const middleContent = runNode.content.cut(relativeFrom, relativeTo);
|
|
196913
197030
|
replacementRuns.push(runType.create({
|
|
196914
197031
|
...runNode.attrs,
|
|
196915
|
-
runProperties: normalizedNextRunProperties
|
|
197032
|
+
runProperties: normalizedNextRunProperties,
|
|
197033
|
+
runPropertiesInlineKeys: nextInlineKeys.length ? nextInlineKeys : null,
|
|
197034
|
+
runPropertiesOverrideKeys: nextOverrideKeys.length ? nextOverrideKeys : null
|
|
196916
197035
|
}, middleContent, runNode.marks));
|
|
196917
197036
|
if (relativeTo < runNode.content.size) {
|
|
196918
197037
|
const rightContent = runNode.content.cut(relativeTo, runNode.content.size);
|
|
@@ -217620,20 +217739,18 @@ function resolveLinePosition(lineEl, lineStart, lineEnd, spanEls, viewX) {
|
|
|
217620
217739
|
}
|
|
217621
217740
|
const spanStart = Number(targetEl.dataset.pmStart ?? "NaN");
|
|
217622
217741
|
const spanEnd = Number(targetEl.dataset.pmEnd ?? "NaN");
|
|
217742
|
+
const targetRect = targetEl.getBoundingClientRect();
|
|
217623
217743
|
log2("Target element:", {
|
|
217624
217744
|
tag: targetEl.tagName,
|
|
217625
217745
|
pmStart: spanStart,
|
|
217626
217746
|
pmEnd: spanEnd,
|
|
217627
217747
|
text: targetEl.textContent?.substring(0, 30),
|
|
217628
217748
|
visibility: targetEl.style.visibility,
|
|
217629
|
-
rect:
|
|
217630
|
-
|
|
217631
|
-
|
|
217632
|
-
|
|
217633
|
-
|
|
217634
|
-
width: r$1.width
|
|
217635
|
-
};
|
|
217636
|
-
})()
|
|
217749
|
+
rect: {
|
|
217750
|
+
left: targetRect.left,
|
|
217751
|
+
right: targetRect.right,
|
|
217752
|
+
width: targetRect.width
|
|
217753
|
+
}
|
|
217637
217754
|
});
|
|
217638
217755
|
if (!Number.isFinite(spanStart) || !Number.isFinite(spanEnd)) {
|
|
217639
217756
|
log2("Element has invalid PM positions");
|
|
@@ -217641,8 +217758,7 @@ function resolveLinePosition(lineEl, lineStart, lineEnd, spanEls, viewX) {
|
|
|
217641
217758
|
}
|
|
217642
217759
|
const firstChild = targetEl.firstChild;
|
|
217643
217760
|
if (!firstChild || firstChild.nodeType !== Node.TEXT_NODE || !firstChild.textContent) {
|
|
217644
|
-
const
|
|
217645
|
-
const closerToLeft = Math.abs(viewX - elRect.left) <= Math.abs(viewX - elRect.right);
|
|
217761
|
+
const closerToLeft = Math.abs(viewX - targetRect.left) <= Math.abs(viewX - targetRect.right);
|
|
217646
217762
|
const snapPos = rtl ? closerToLeft ? spanEnd : spanStart : closerToLeft ? spanStart : spanEnd;
|
|
217647
217763
|
log2("Empty/non-text element, snapping to:", {
|
|
217648
217764
|
closerToLeft,
|
|
@@ -252328,9 +252444,9 @@ var Node$13 = class Node$14 {
|
|
|
252328
252444
|
return;
|
|
252329
252445
|
console.log(...args$1);
|
|
252330
252446
|
}, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
|
|
252331
|
-
var
|
|
252447
|
+
var init_src_2Droteg9_es = __esm(() => {
|
|
252332
252448
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
252333
|
-
|
|
252449
|
+
init_SuperConverter_CTUnwu05_es();
|
|
252334
252450
|
init_jszip_ChlR43oI_es();
|
|
252335
252451
|
init_uuid_qzgm05fK_es();
|
|
252336
252452
|
init_constants_Qqwopz80_es();
|
|
@@ -254982,6 +255098,21 @@ ${err.toString()}`);
|
|
|
254982
255098
|
rendered: false,
|
|
254983
255099
|
keepOnSplit: true
|
|
254984
255100
|
},
|
|
255101
|
+
runPropertiesInlineKeys: {
|
|
255102
|
+
default: null,
|
|
255103
|
+
rendered: false,
|
|
255104
|
+
keepOnSplit: true
|
|
255105
|
+
},
|
|
255106
|
+
runPropertiesStyleKeys: {
|
|
255107
|
+
default: null,
|
|
255108
|
+
rendered: false,
|
|
255109
|
+
keepOnSplit: true
|
|
255110
|
+
},
|
|
255111
|
+
runPropertiesOverrideKeys: {
|
|
255112
|
+
default: null,
|
|
255113
|
+
rendered: false,
|
|
255114
|
+
keepOnSplit: true
|
|
255115
|
+
},
|
|
254985
255116
|
rsidR: {
|
|
254986
255117
|
default: null,
|
|
254987
255118
|
rendered: false,
|
|
@@ -256792,20 +256923,24 @@ ${err.toString()}`);
|
|
|
256792
256923
|
color: "auto"
|
|
256793
256924
|
};
|
|
256794
256925
|
state.doc.nodesBetween(from$1, to, (node3, pos) => {
|
|
256795
|
-
if (["tableCell", "tableHeader"].includes(node3.type.name))
|
|
256926
|
+
if (["tableCell", "tableHeader"].includes(node3.type.name)) {
|
|
256927
|
+
const nextTableCellProperties = {
|
|
256928
|
+
...node3.attrs.tableCellProperties ?? {},
|
|
256929
|
+
borders: {
|
|
256930
|
+
top: { ...nilBorder },
|
|
256931
|
+
bottom: { ...nilBorder },
|
|
256932
|
+
left: { ...nilBorder },
|
|
256933
|
+
right: { ...nilBorder }
|
|
256934
|
+
}
|
|
256935
|
+
};
|
|
256936
|
+
const nextInlineKeys = [...new Set([...node3.attrs.tableCellPropertiesInlineKeys || [], "borders"])];
|
|
256796
256937
|
tr.setNodeMarkup(pos, undefined, {
|
|
256797
256938
|
...node3.attrs,
|
|
256798
256939
|
borders: null,
|
|
256799
|
-
tableCellProperties:
|
|
256800
|
-
|
|
256801
|
-
borders: {
|
|
256802
|
-
top: { ...nilBorder },
|
|
256803
|
-
bottom: { ...nilBorder },
|
|
256804
|
-
left: { ...nilBorder },
|
|
256805
|
-
right: { ...nilBorder }
|
|
256806
|
-
}
|
|
256807
|
-
}
|
|
256940
|
+
tableCellProperties: nextTableCellProperties,
|
|
256941
|
+
tableCellPropertiesInlineKeys: nextInlineKeys
|
|
256808
256942
|
});
|
|
256943
|
+
}
|
|
256809
256944
|
});
|
|
256810
256945
|
tr.setNodeMarkup(table2.pos, undefined, {
|
|
256811
256946
|
...table2.node.attrs,
|
|
@@ -257024,6 +257159,10 @@ ${err.toString()}`);
|
|
|
257024
257159
|
default: null,
|
|
257025
257160
|
rendered: false
|
|
257026
257161
|
},
|
|
257162
|
+
tableCellPropertiesInlineKeys: {
|
|
257163
|
+
default: null,
|
|
257164
|
+
rendered: false
|
|
257165
|
+
},
|
|
257027
257166
|
__placeholder: {
|
|
257028
257167
|
default: null,
|
|
257029
257168
|
parseDOM: (element3) => {
|
|
@@ -257203,6 +257342,10 @@ ${err.toString()}`);
|
|
|
257203
257342
|
tableCellProperties: {
|
|
257204
257343
|
default: null,
|
|
257205
257344
|
rendered: false
|
|
257345
|
+
},
|
|
257346
|
+
tableCellPropertiesInlineKeys: {
|
|
257347
|
+
default: null,
|
|
257348
|
+
rendered: false
|
|
257206
257349
|
}
|
|
257207
257350
|
};
|
|
257208
257351
|
},
|
|
@@ -285843,8 +285986,8 @@ var init_zipper_YmNpPIyc_es = __esm(() => {
|
|
|
285843
285986
|
|
|
285844
285987
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
285845
285988
|
var init_super_editor_es = __esm(() => {
|
|
285846
|
-
|
|
285847
|
-
|
|
285989
|
+
init_src_2Droteg9_es();
|
|
285990
|
+
init_SuperConverter_CTUnwu05_es();
|
|
285848
285991
|
init_jszip_ChlR43oI_es();
|
|
285849
285992
|
init_xml_js_40FWvL78_es();
|
|
285850
285993
|
init_constants_Qqwopz80_es();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.5.0-next.
|
|
3
|
+
"version": "0.5.0-next.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -25,20 +25,20 @@
|
|
|
25
25
|
"@types/ws": "^8.5.13",
|
|
26
26
|
"typescript": "^5.9.2",
|
|
27
27
|
"@superdoc/document-api": "0.0.1",
|
|
28
|
-
"@superdoc/
|
|
28
|
+
"@superdoc/super-editor": "0.0.1",
|
|
29
29
|
"superdoc": "1.23.0",
|
|
30
|
-
"@superdoc/
|
|
30
|
+
"@superdoc/pm-adapter": "0.0.0"
|
|
31
31
|
},
|
|
32
32
|
"module": "src/index.ts",
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
|
-
"@superdoc-dev/cli-darwin-arm64": "0.5.0-next.
|
|
38
|
-
"@superdoc-dev/cli-darwin-x64": "0.5.0-next.
|
|
39
|
-
"@superdoc-dev/cli-
|
|
40
|
-
"@superdoc-dev/cli-linux-
|
|
41
|
-
"@superdoc-dev/cli-
|
|
37
|
+
"@superdoc-dev/cli-darwin-arm64": "0.5.0-next.9",
|
|
38
|
+
"@superdoc-dev/cli-darwin-x64": "0.5.0-next.9",
|
|
39
|
+
"@superdoc-dev/cli-windows-x64": "0.5.0-next.9",
|
|
40
|
+
"@superdoc-dev/cli-linux-x64": "0.5.0-next.9",
|
|
41
|
+
"@superdoc-dev/cli-linux-arm64": "0.5.0-next.9"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"predev": "node scripts/ensure-superdoc-build.js",
|