superdoc 0.31.0-next.6 → 0.31.0-next.7
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-BSud7RY4.cjs → PdfViewer-C_gVEaJa.cjs} +1 -1
- package/dist/chunks/{PdfViewer-DK93vPf1.es.js → PdfViewer-HhmcCtfd.es.js} +1 -1
- package/dist/chunks/{index-DAES86tg-Cjexh3WM.cjs → index-BJ6cOegF-BuvRSNoV.cjs} +1 -1
- package/dist/chunks/{index-DAES86tg-BDL6WVta.es.js → index-BJ6cOegF-C-oX4LAe.es.js} +1 -1
- package/dist/chunks/{index-Bz2Q2Xq2.es.js → index-Cz10rZ5n.es.js} +3 -3
- package/dist/chunks/{index-Crequs_q.cjs → index-wLtubQ87.cjs} +3 -3
- package/dist/chunks/{super-editor.es-D8NdQdlk.cjs → super-editor.es-Bz-s1Pw4.cjs} +319 -153
- package/dist/chunks/{super-editor.es-BWeMHRHm.es.js → super-editor.es-C20nShDu.es.js} +319 -153
- package/dist/style.css +10 -9
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-DEQxlCAJ.js → converter-DVDL6NWz.js} +100 -53
- package/dist/super-editor/chunks/{docx-zipper-C6VMEIY_.js → docx-zipper-4ipmBNSH.js} +1 -1
- package/dist/super-editor/chunks/{editor-D0zFmUwx.js → editor-B8v33PJq.js} +221 -102
- package/dist/super-editor/chunks/{index-DAES86tg.js → index-BJ6cOegF.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-Cwx5bBDV.js → toolbar-CfUofx7k.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/style.css +10 -9
- package/dist/super-editor/super-editor/src/core/super-converter/helpers.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/helpers.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/styles.d.ts +2 -1
- package/dist/super-editor/super-editor/src/core/super-converter/styles.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/legacy-handle-paragraph-node.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tbl/tbl-translator.d.ts +14 -10
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tbl/tbl-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tblGrid/tblGrid-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tr/tr-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-commands.d.ts +8 -2
- package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-commands.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentByGroup.d.ts +19 -0
- package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentByGroup.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/tagUtils.d.ts +53 -0
- package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/tagUtils.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/table/TableView.d.ts +7 -1
- package/dist/super-editor/super-editor/src/extensions/table/TableView.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/table/table.d.ts +18 -0
- package/dist/super-editor/super-editor/src/extensions/table/table.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/table-cell/table-cell.d.ts.map +1 -1
- package/dist/super-editor/super-editor.es.js +7 -7
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +320 -154
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -15426,6 +15426,38 @@ const hasSomeParentWithClass = (element, classname) => {
|
|
|
15426
15426
|
if (element.className?.split(" ")?.indexOf(classname) >= 0) return true;
|
|
15427
15427
|
return element.parentNode && hasSomeParentWithClass(element.parentNode, classname);
|
|
15428
15428
|
};
|
|
15429
|
+
function convertSizeToCSS(value, type2) {
|
|
15430
|
+
if (typeof value === "string" && value.endsWith("%")) {
|
|
15431
|
+
type2 = "pct";
|
|
15432
|
+
}
|
|
15433
|
+
if (value === null || value === void 0) {
|
|
15434
|
+
value = 0;
|
|
15435
|
+
}
|
|
15436
|
+
switch (type2) {
|
|
15437
|
+
case "dxa":
|
|
15438
|
+
case null:
|
|
15439
|
+
case void 0:
|
|
15440
|
+
return `${twipsToPixels(value)}px`;
|
|
15441
|
+
case "nil":
|
|
15442
|
+
return "0";
|
|
15443
|
+
case "auto":
|
|
15444
|
+
return null;
|
|
15445
|
+
case "pct":
|
|
15446
|
+
let percent2;
|
|
15447
|
+
if (typeof value === "number") {
|
|
15448
|
+
percent2 = value * 0.02;
|
|
15449
|
+
} else {
|
|
15450
|
+
if (value.endsWith("%")) {
|
|
15451
|
+
percent2 = parseFloat(value.slice(0, -1));
|
|
15452
|
+
} else {
|
|
15453
|
+
percent2 = parseFloat(value) * 0.02;
|
|
15454
|
+
}
|
|
15455
|
+
}
|
|
15456
|
+
return `${percent2}%`;
|
|
15457
|
+
default:
|
|
15458
|
+
return null;
|
|
15459
|
+
}
|
|
15460
|
+
}
|
|
15429
15461
|
const DEFAULT_DOCX_DEFS = {
|
|
15430
15462
|
"xmlns:wpc": "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
|
|
15431
15463
|
"xmlns:cx": "http://schemas.microsoft.com/office/drawing/2014/chartex",
|
|
@@ -19238,7 +19270,7 @@ const resolveRunProperties = (params2, inlineRpr, resolvedPpr, isListNumber = fa
|
|
|
19238
19270
|
const finalProps = combineProperties(styleChain, ["fontFamily", "color"]);
|
|
19239
19271
|
return finalProps;
|
|
19240
19272
|
};
|
|
19241
|
-
function resolveParagraphProperties(params2, inlineProps, insideTable = false, overrideInlineStyleId = false) {
|
|
19273
|
+
function resolveParagraphProperties(params2, inlineProps, insideTable = false, overrideInlineStyleId = false, tableStyleId = null) {
|
|
19242
19274
|
const defaultProps2 = getDefaultProperties(params2, translator$12);
|
|
19243
19275
|
const { properties: normalProps, isDefault: isNormalDefault } = getStyleProperties(params2, "Normal", translator$12);
|
|
19244
19276
|
let styleId = inlineProps?.styleId;
|
|
@@ -19263,13 +19295,14 @@ function resolveParagraphProperties(params2, inlineProps, insideTable = false, o
|
|
|
19263
19295
|
}
|
|
19264
19296
|
}
|
|
19265
19297
|
}
|
|
19298
|
+
const tableProps = tableStyleId ? resolveStyleChain(params2, tableStyleId, translator$12) : {};
|
|
19266
19299
|
let defaultsChain;
|
|
19267
19300
|
if (isNormalDefault) {
|
|
19268
19301
|
defaultsChain = [defaultProps2, normalProps];
|
|
19269
19302
|
} else {
|
|
19270
19303
|
defaultsChain = [normalProps, defaultProps2];
|
|
19271
19304
|
}
|
|
19272
|
-
const propsChain = [...defaultsChain, numberingProps, styleProps, inlineProps];
|
|
19305
|
+
const propsChain = [...defaultsChain, tableProps, numberingProps, styleProps, inlineProps];
|
|
19273
19306
|
let indentChain;
|
|
19274
19307
|
if (isList2) {
|
|
19275
19308
|
if (numberingDefinedInline) {
|
|
@@ -20020,6 +20053,21 @@ function getStrikeValue(attributes) {
|
|
|
20020
20053
|
if (value === "0" || value === "false" || value === "off") return "0";
|
|
20021
20054
|
return "1";
|
|
20022
20055
|
}
|
|
20056
|
+
function getTableStyleId(path) {
|
|
20057
|
+
const tbl = path.find((ancestor) => ancestor.name === "w:tbl");
|
|
20058
|
+
if (!tbl) {
|
|
20059
|
+
return;
|
|
20060
|
+
}
|
|
20061
|
+
const tblPr = tbl.elements?.find((child) => child.name === "w:tblPr");
|
|
20062
|
+
if (!tblPr) {
|
|
20063
|
+
return;
|
|
20064
|
+
}
|
|
20065
|
+
const tblStyle = tblPr.elements?.find((child) => child.name === "w:tblStyle");
|
|
20066
|
+
if (!tblStyle) {
|
|
20067
|
+
return;
|
|
20068
|
+
}
|
|
20069
|
+
return tblStyle.attributes?.["w:val"];
|
|
20070
|
+
}
|
|
20023
20071
|
const handleParagraphNode$1 = (params2) => {
|
|
20024
20072
|
const { nodes, nodeListHandler, filename } = params2;
|
|
20025
20073
|
const node = carbonCopy(nodes[0]);
|
|
@@ -20030,7 +20078,14 @@ const handleParagraphNode$1 = (params2) => {
|
|
|
20030
20078
|
inlineParagraphProperties = translator$12.encode({ ...params2, nodes: [pPr] }) || {};
|
|
20031
20079
|
}
|
|
20032
20080
|
const insideTable = (params2.path || []).some((ancestor) => ancestor.name === "w:tc");
|
|
20033
|
-
const
|
|
20081
|
+
const tableStyleId = getTableStyleId(params2.path || []);
|
|
20082
|
+
const resolvedParagraphProperties = resolveParagraphProperties(
|
|
20083
|
+
params2,
|
|
20084
|
+
inlineParagraphProperties,
|
|
20085
|
+
insideTable,
|
|
20086
|
+
false,
|
|
20087
|
+
tableStyleId
|
|
20088
|
+
);
|
|
20034
20089
|
const handleStandardNode2 = nodeListHandler.handlerEntities.find(
|
|
20035
20090
|
(e) => e.handlerName === "standardNodeHandler"
|
|
20036
20091
|
)?.handler;
|
|
@@ -21385,6 +21440,7 @@ const encode$m = (params2, encodedAttrs) => {
|
|
|
21385
21440
|
const columnWidth = gridColumnWidths?.[startColumn] || null;
|
|
21386
21441
|
const result = translator$G.encode({
|
|
21387
21442
|
...params2,
|
|
21443
|
+
path: [...params2.path || [], node],
|
|
21388
21444
|
extraParams: {
|
|
21389
21445
|
...params2.extraParams,
|
|
21390
21446
|
node,
|
|
@@ -31555,14 +31611,15 @@ const decode$j = (params2) => {
|
|
|
31555
31611
|
const grid = Array.isArray(rawGrid) ? rawGrid : [];
|
|
31556
31612
|
const { firstRow = {} } = params2.extraParams || {};
|
|
31557
31613
|
const cellNodes = firstRow.content?.filter((n) => n.type === "tableCell") ?? [];
|
|
31558
|
-
const
|
|
31614
|
+
const colWidthsFromCellNodes = cellNodes.flatMap((cell) => {
|
|
31559
31615
|
const spanCount = Math.max(1, cell?.attrs?.colspan ?? 1);
|
|
31560
|
-
|
|
31561
|
-
|
|
31616
|
+
const colwidth = cell.attrs?.colwidth;
|
|
31617
|
+
return Array.from({ length: spanCount }).map((_2, span) => Array.isArray(colwidth) ? colwidth[span] : void 0);
|
|
31618
|
+
});
|
|
31619
|
+
const columnCountFromCells = colWidthsFromCellNodes.length;
|
|
31562
31620
|
const totalColumns = Math.max(columnCountFromCells, grid.length);
|
|
31563
31621
|
const fallbackColumnWidthTwips = resolveFallbackColumnWidthTwips(params2, totalColumns, cellMinWidth);
|
|
31564
31622
|
const elements = [];
|
|
31565
|
-
let columnIndex = 0;
|
|
31566
31623
|
const pushColumn = (widthTwips, { enforceMinimum = false } = {}) => {
|
|
31567
31624
|
let numericWidth = typeof widthTwips === "string" ? parseInt(widthTwips, 10) : widthTwips;
|
|
31568
31625
|
let shouldEnforceMinimum = enforceMinimum;
|
|
@@ -31581,39 +31638,29 @@ const decode$j = (params2) => {
|
|
|
31581
31638
|
});
|
|
31582
31639
|
if (decoded) elements.push(decoded);
|
|
31583
31640
|
};
|
|
31584
|
-
|
|
31585
|
-
const
|
|
31586
|
-
const
|
|
31587
|
-
|
|
31588
|
-
|
|
31589
|
-
|
|
31590
|
-
|
|
31591
|
-
|
|
31592
|
-
|
|
31593
|
-
|
|
31594
|
-
|
|
31595
|
-
|
|
31596
|
-
|
|
31597
|
-
|
|
31598
|
-
if (gridWidthTwips != null && gridWidthPixels != null && Math.abs(gridWidthPixels - cellWidthPixels) <= tolerance) {
|
|
31599
|
-
cellWidthTwips = gridWidthTwips;
|
|
31600
|
-
} else {
|
|
31601
|
-
cellWidthTwips = pixelsToTwips(cellWidthPixels);
|
|
31602
|
-
}
|
|
31603
|
-
} else if (gridWidthTwips != null) {
|
|
31641
|
+
for (let columnIndex = 0; columnIndex < totalColumns; ++columnIndex) {
|
|
31642
|
+
const rawWidth = colWidthsFromCellNodes[columnIndex];
|
|
31643
|
+
const cellWidthPixels = typeof rawWidth === "number" && Number.isFinite(rawWidth) ? rawWidth : Number(rawWidth);
|
|
31644
|
+
const hasCellWidth = Number.isFinite(cellWidthPixels) && cellWidthPixels > 0;
|
|
31645
|
+
const colGridAttrs = grid?.[columnIndex] || {};
|
|
31646
|
+
const gridWidthTwips = normalizeTwipWidth(colGridAttrs.col);
|
|
31647
|
+
const gridWidthPixels = gridWidthTwips != null ? twipsToPixels(gridWidthTwips) : null;
|
|
31648
|
+
let cellWidthTwips;
|
|
31649
|
+
let enforceMinimum = false;
|
|
31650
|
+
if (gridWidthTwips != null) {
|
|
31651
|
+
cellWidthTwips = gridWidthTwips;
|
|
31652
|
+
} else if (hasCellWidth) {
|
|
31653
|
+
const tolerance = 0.5;
|
|
31654
|
+
if (gridWidthTwips != null && gridWidthPixels != null && Math.abs(gridWidthPixels - cellWidthPixels) <= tolerance) {
|
|
31604
31655
|
cellWidthTwips = gridWidthTwips;
|
|
31605
31656
|
} else {
|
|
31606
|
-
cellWidthTwips =
|
|
31607
|
-
enforceMinimum = true;
|
|
31657
|
+
cellWidthTwips = pixelsToTwips(cellWidthPixels);
|
|
31608
31658
|
}
|
|
31609
|
-
|
|
31610
|
-
|
|
31659
|
+
} else {
|
|
31660
|
+
cellWidthTwips = fallbackColumnWidthTwips;
|
|
31661
|
+
enforceMinimum = true;
|
|
31611
31662
|
}
|
|
31612
|
-
|
|
31613
|
-
while (columnIndex < grid.length) {
|
|
31614
|
-
const gridWidthTwips = normalizeTwipWidth(grid[columnIndex]?.col);
|
|
31615
|
-
pushColumn(gridWidthTwips);
|
|
31616
|
-
columnIndex++;
|
|
31663
|
+
pushColumn(cellWidthTwips, { enforceMinimum });
|
|
31617
31664
|
}
|
|
31618
31665
|
const newNode = {
|
|
31619
31666
|
name: XML_NODE_NAME$b,
|
|
@@ -31700,6 +31747,8 @@ const encode$g = (params2, encodedAttrs) => {
|
|
|
31700
31747
|
if (tblPr) {
|
|
31701
31748
|
const encodedProperties = translator$c.encode({ ...params2, nodes: [tblPr] });
|
|
31702
31749
|
encodedAttrs["tableProperties"] = encodedProperties || {};
|
|
31750
|
+
} else {
|
|
31751
|
+
encodedAttrs["tableProperties"] || (encodedAttrs["tableProperties"] = {});
|
|
31703
31752
|
}
|
|
31704
31753
|
const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
|
|
31705
31754
|
if (tblGrid) {
|
|
@@ -31720,14 +31769,14 @@ const encode$g = (params2, encodedAttrs) => {
|
|
|
31720
31769
|
key2 = prop;
|
|
31721
31770
|
transform = (v2) => v2;
|
|
31722
31771
|
}
|
|
31723
|
-
if (encodedAttrs.tableProperties
|
|
31772
|
+
if (encodedAttrs.tableProperties[key2]) {
|
|
31724
31773
|
encodedAttrs[key2] = transform(encodedAttrs.tableProperties[key2]);
|
|
31725
31774
|
}
|
|
31726
31775
|
});
|
|
31727
31776
|
if (encodedAttrs.tableCellSpacing) {
|
|
31728
31777
|
encodedAttrs["borderCollapse"] = "separate";
|
|
31729
31778
|
}
|
|
31730
|
-
if (encodedAttrs.tableProperties
|
|
31779
|
+
if (encodedAttrs.tableProperties.tableWidth) {
|
|
31731
31780
|
const tableWidthMeasurement = encodedAttrs.tableProperties.tableWidth;
|
|
31732
31781
|
const widthPx = twipsToPixels(tableWidthMeasurement.value);
|
|
31733
31782
|
if (widthPx != null) {
|
|
@@ -31742,25 +31791,22 @@ const encode$g = (params2, encodedAttrs) => {
|
|
|
31742
31791
|
};
|
|
31743
31792
|
}
|
|
31744
31793
|
}
|
|
31745
|
-
const
|
|
31746
|
-
const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params2);
|
|
31747
|
-
|
|
31748
|
-
|
|
31749
|
-
|
|
31750
|
-
|
|
31751
|
-
|
|
31752
|
-
}
|
|
31794
|
+
const borderProps = _processTableBorders(encodedAttrs.tableProperties.borders || {});
|
|
31795
|
+
const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params2) || {};
|
|
31796
|
+
const rowBorders = { ...referencedStyles.rowBorders, ...borderProps.rowBorders };
|
|
31797
|
+
encodedAttrs.borders = { ...referencedStyles.borders, ...borderProps.borders };
|
|
31798
|
+
encodedAttrs.tableProperties.cellMargins = referencedStyles.cellMargins = {
|
|
31799
|
+
...referencedStyles.cellMargins,
|
|
31800
|
+
...encodedAttrs.tableProperties.cellMargins
|
|
31801
|
+
};
|
|
31753
31802
|
const rows = node.elements.filter((el) => el.name === "w:tr");
|
|
31754
|
-
const borderData = Object.assign({}, referencedStyles?.borders || {}, borders || {});
|
|
31755
|
-
const borderRowData = Object.assign({}, referencedStyles?.rowBorders || {}, rowBorders || {});
|
|
31756
|
-
encodedAttrs["borders"] = borderData;
|
|
31757
31803
|
let columnWidths = Array.isArray(encodedAttrs["grid"]) ? encodedAttrs["grid"].map((item) => twipsToPixels(item.col)) : [];
|
|
31758
31804
|
if (!columnWidths.length) {
|
|
31759
31805
|
const fallback = buildFallbackGridForTable({
|
|
31760
31806
|
params: params2,
|
|
31761
31807
|
rows,
|
|
31762
31808
|
tableWidth: encodedAttrs.tableWidth,
|
|
31763
|
-
tableWidthMeasurement: encodedAttrs.tableProperties
|
|
31809
|
+
tableWidthMeasurement: encodedAttrs.tableProperties.tableWidth
|
|
31764
31810
|
});
|
|
31765
31811
|
if (fallback) {
|
|
31766
31812
|
encodedAttrs.grid = fallback.grid;
|
|
@@ -31773,11 +31819,12 @@ const encode$g = (params2, encodedAttrs) => {
|
|
|
31773
31819
|
rows.forEach((row, rowIndex) => {
|
|
31774
31820
|
const result = translator$v.encode({
|
|
31775
31821
|
...params2,
|
|
31822
|
+
path: [...params2.path || [], node],
|
|
31776
31823
|
nodes: [row],
|
|
31777
31824
|
extraParams: {
|
|
31778
31825
|
row,
|
|
31779
31826
|
table: node,
|
|
31780
|
-
rowBorders
|
|
31827
|
+
rowBorders,
|
|
31781
31828
|
columnWidths,
|
|
31782
31829
|
activeRowSpans: activeRowSpans.slice(),
|
|
31783
31830
|
rowIndex,
|
|
@@ -35302,7 +35349,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
35302
35349
|
static getStoredSuperdocVersion(docx) {
|
|
35303
35350
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
35304
35351
|
}
|
|
35305
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.31.0-next.
|
|
35352
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.31.0-next.7") {
|
|
35306
35353
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
35307
35354
|
}
|
|
35308
35355
|
/**
|
|
@@ -52562,7 +52609,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52562
52609
|
{ default: remarkStringify },
|
|
52563
52610
|
{ default: remarkGfm }
|
|
52564
52611
|
] = await Promise.all([
|
|
52565
|
-
Promise.resolve().then(() => require("./index-
|
|
52612
|
+
Promise.resolve().then(() => require("./index-BJ6cOegF-BuvRSNoV.cjs")),
|
|
52566
52613
|
Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
|
|
52567
52614
|
Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
|
|
52568
52615
|
Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
|
|
@@ -52763,7 +52810,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52763
52810
|
* Process collaboration migrations
|
|
52764
52811
|
*/
|
|
52765
52812
|
processCollaborationMigrations() {
|
|
52766
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.
|
|
52813
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.7");
|
|
52767
52814
|
if (!this.options.ydoc) return;
|
|
52768
52815
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
52769
52816
|
let docVersion = metaMap.get("version");
|
|
@@ -55172,6 +55219,46 @@ function getStructuredContentTagsById(idOrIds, state2) {
|
|
|
55172
55219
|
});
|
|
55173
55220
|
return result;
|
|
55174
55221
|
}
|
|
55222
|
+
function createTagObject(tagData) {
|
|
55223
|
+
if (!tagData || typeof tagData !== "object") {
|
|
55224
|
+
return null;
|
|
55225
|
+
}
|
|
55226
|
+
return JSON.stringify(tagData);
|
|
55227
|
+
}
|
|
55228
|
+
function parseTagObject(tag) {
|
|
55229
|
+
if (typeof tag !== "string" || !tag.startsWith("{")) {
|
|
55230
|
+
return null;
|
|
55231
|
+
}
|
|
55232
|
+
try {
|
|
55233
|
+
const parsed = JSON.parse(tag);
|
|
55234
|
+
return parsed && typeof parsed === "object" ? parsed : null;
|
|
55235
|
+
} catch {
|
|
55236
|
+
return null;
|
|
55237
|
+
}
|
|
55238
|
+
}
|
|
55239
|
+
function hasGroup(tag) {
|
|
55240
|
+
const parsed = parseTagObject(tag);
|
|
55241
|
+
return parsed !== null && typeof parsed.group === "string";
|
|
55242
|
+
}
|
|
55243
|
+
function getGroup(tag) {
|
|
55244
|
+
const parsed = parseTagObject(tag);
|
|
55245
|
+
return parsed && typeof parsed.group === "string" ? parsed.group : null;
|
|
55246
|
+
}
|
|
55247
|
+
function getStructuredContentByGroup(groupOrGroups, state2) {
|
|
55248
|
+
const searchGroups = Array.isArray(groupOrGroups) ? groupOrGroups : [groupOrGroups];
|
|
55249
|
+
const result = findChildren$5(state2.doc, (node) => {
|
|
55250
|
+
const isStructuredContent = ["structuredContent", "structuredContentBlock"].includes(node.type.name);
|
|
55251
|
+
if (!isStructuredContent) {
|
|
55252
|
+
return false;
|
|
55253
|
+
}
|
|
55254
|
+
const nodeGroup = getGroup(node.attrs.tag);
|
|
55255
|
+
if (!nodeGroup) {
|
|
55256
|
+
return false;
|
|
55257
|
+
}
|
|
55258
|
+
return searchGroups.includes(nodeGroup);
|
|
55259
|
+
});
|
|
55260
|
+
return result;
|
|
55261
|
+
}
|
|
55175
55262
|
function getStructuredContentTags(state2) {
|
|
55176
55263
|
const result = findChildren$5(state2.doc, (node) => {
|
|
55177
55264
|
return node.type.name === "structuredContent" || node.type.name === "structuredContentBlock";
|
|
@@ -55204,11 +55291,16 @@ function getStructuredContentTablesById(id, state2) {
|
|
|
55204
55291
|
}
|
|
55205
55292
|
const structuredContentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
55206
55293
|
__proto__: null,
|
|
55294
|
+
createTagObject,
|
|
55295
|
+
getGroup,
|
|
55207
55296
|
getStructuredContentBlockTags,
|
|
55297
|
+
getStructuredContentByGroup,
|
|
55208
55298
|
getStructuredContentInlineTags,
|
|
55209
55299
|
getStructuredContentTablesById,
|
|
55210
55300
|
getStructuredContentTags,
|
|
55211
|
-
getStructuredContentTagsById
|
|
55301
|
+
getStructuredContentTagsById,
|
|
55302
|
+
hasGroup,
|
|
55303
|
+
parseTagObject
|
|
55212
55304
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
55213
55305
|
const STRUCTURED_CONTENT_NAMES = ["structuredContent", "structuredContentBlock"];
|
|
55214
55306
|
const StructuredContentCommands = Extension.create({
|
|
@@ -55220,6 +55312,16 @@ const StructuredContentCommands = Extension.create({
|
|
|
55220
55312
|
* @category Command
|
|
55221
55313
|
* @param {StructuredContentInlineInsert} options
|
|
55222
55314
|
* @example
|
|
55315
|
+
* // With group for linking multiple fields
|
|
55316
|
+
* editor.commands.insertStructuredContentInline({
|
|
55317
|
+
* attrs: {
|
|
55318
|
+
* group: 'customer-info',
|
|
55319
|
+
* alias: 'Customer Name',
|
|
55320
|
+
* },
|
|
55321
|
+
* text: 'John Doe',
|
|
55322
|
+
* });
|
|
55323
|
+
*
|
|
55324
|
+
* // No group
|
|
55223
55325
|
* editor.commands.insertStructuredContentInline({
|
|
55224
55326
|
* attrs: {
|
|
55225
55327
|
* id: '123',
|
|
@@ -55248,12 +55350,17 @@ const StructuredContentCommands = Extension.create({
|
|
|
55248
55350
|
if (!content) {
|
|
55249
55351
|
content = schema.text(" ");
|
|
55250
55352
|
}
|
|
55353
|
+
let tag = options.attrs?.tag || "inline_text_sdt";
|
|
55354
|
+
if (options.attrs?.group) {
|
|
55355
|
+
tag = createTagObject({ group: options.attrs.group });
|
|
55356
|
+
}
|
|
55251
55357
|
const attrs = {
|
|
55252
|
-
...options.attrs,
|
|
55253
55358
|
id: options.attrs?.id || generateRandomSigned32BitIntStrId(),
|
|
55254
|
-
tag
|
|
55255
|
-
alias: options.attrs?.alias || "Structured content"
|
|
55359
|
+
tag,
|
|
55360
|
+
alias: options.attrs?.alias || "Structured content",
|
|
55361
|
+
...options.attrs
|
|
55256
55362
|
};
|
|
55363
|
+
delete attrs.group;
|
|
55257
55364
|
const node = schema.nodes.structuredContent.create(attrs, content, null);
|
|
55258
55365
|
const parent = findParentNode((node2) => node2.type.name === "structuredContent")(state2.selection);
|
|
55259
55366
|
if (parent) {
|
|
@@ -55269,14 +55376,22 @@ const StructuredContentCommands = Extension.create({
|
|
|
55269
55376
|
* @category Command
|
|
55270
55377
|
* @param {StructuredContentBlockInsert} options
|
|
55271
55378
|
* @example
|
|
55379
|
+
* // With group for linking multiple fields
|
|
55380
|
+
* editor.commands.insertStructuredContentBlock({
|
|
55381
|
+
* attrs: {
|
|
55382
|
+
* group: 'terms-section',
|
|
55383
|
+
* alias: 'Terms & Conditions',
|
|
55384
|
+
* },
|
|
55385
|
+
* html: '<p>Legal content...</p>',
|
|
55386
|
+
* });
|
|
55387
|
+
*
|
|
55388
|
+
* // No group
|
|
55272
55389
|
* editor.commands.insertStructuredContentBlock({
|
|
55273
55390
|
* attrs: {
|
|
55274
55391
|
* id: '456',
|
|
55275
55392
|
* alias: 'Terms & Conditions',
|
|
55276
55393
|
* },
|
|
55277
55394
|
* json: { type: 'paragraph', content: [{ type: 'text', text: 'Legal content...' }] }
|
|
55278
|
-
* // or
|
|
55279
|
-
* html: '<p>Legal content...</p>',
|
|
55280
55395
|
* });
|
|
55281
55396
|
*/
|
|
55282
55397
|
insertStructuredContentBlock: (options = {}) => ({ editor, dispatch, state: state2, tr }) => {
|
|
@@ -55299,12 +55414,17 @@ const StructuredContentCommands = Extension.create({
|
|
|
55299
55414
|
if (!content) {
|
|
55300
55415
|
content = schema.nodeFromJSON({ type: "paragraph", content: [] });
|
|
55301
55416
|
}
|
|
55417
|
+
let tag = options.attrs?.tag || "block_table_sdt";
|
|
55418
|
+
if (options.attrs?.group) {
|
|
55419
|
+
tag = createTagObject({ group: options.attrs.group });
|
|
55420
|
+
}
|
|
55302
55421
|
const attrs = {
|
|
55303
|
-
...options.attrs,
|
|
55304
55422
|
id: options.attrs?.id || generateRandomSigned32BitIntStrId(),
|
|
55305
|
-
tag
|
|
55306
|
-
alias: options.attrs?.alias || "Structured content"
|
|
55423
|
+
tag,
|
|
55424
|
+
alias: options.attrs?.alias || "Structured content",
|
|
55425
|
+
...options.attrs
|
|
55307
55426
|
};
|
|
55427
|
+
delete attrs.group;
|
|
55308
55428
|
const node = schema.nodes.structuredContentBlock.create(attrs, content, null);
|
|
55309
55429
|
const parent = findParentNode((node2) => node2.type.name === "structuredContentBlock")(state2.selection);
|
|
55310
55430
|
if (parent) {
|
|
@@ -55434,6 +55554,85 @@ const StructuredContentCommands = Extension.create({
|
|
|
55434
55554
|
}
|
|
55435
55555
|
return true;
|
|
55436
55556
|
},
|
|
55557
|
+
/**
|
|
55558
|
+
* Updates all structured content fields that share the same group identifier.
|
|
55559
|
+
* Groups allow linking multiple fields together for batch operations.
|
|
55560
|
+
* @category Command
|
|
55561
|
+
* @param {string} group - Group identifier shared by multiple fields
|
|
55562
|
+
* @param {StructuredContentUpdate} options
|
|
55563
|
+
* @example
|
|
55564
|
+
* // Update all fields in the customer-info group
|
|
55565
|
+
* editor.commands.updateStructuredContentByGroup('customer-info', { text: 'Jane Doe' });
|
|
55566
|
+
*
|
|
55567
|
+
* // Update block content in a group
|
|
55568
|
+
* editor.commands.updateStructuredContentByGroup('terms-section', {
|
|
55569
|
+
* html: '<p>Updated terms...</p>'
|
|
55570
|
+
* });
|
|
55571
|
+
*/
|
|
55572
|
+
updateStructuredContentByGroup: (group, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
|
|
55573
|
+
const structuredContentTags = getStructuredContentByGroup(group, state2);
|
|
55574
|
+
if (!structuredContentTags.length) {
|
|
55575
|
+
return true;
|
|
55576
|
+
}
|
|
55577
|
+
const { schema } = editor;
|
|
55578
|
+
if (dispatch) {
|
|
55579
|
+
structuredContentTags.forEach((structuredContent) => {
|
|
55580
|
+
const { pos, node } = structuredContent;
|
|
55581
|
+
const posFrom = tr.mapping.map(pos);
|
|
55582
|
+
const posTo = tr.mapping.map(pos + node.nodeSize);
|
|
55583
|
+
let content = null;
|
|
55584
|
+
if (options.text) {
|
|
55585
|
+
content = schema.text(options.text);
|
|
55586
|
+
}
|
|
55587
|
+
if (options.html) {
|
|
55588
|
+
const html = htmlHandler(options.html, editor);
|
|
55589
|
+
const doc2 = DOMParser$1.fromSchema(schema).parse(html);
|
|
55590
|
+
content = doc2.content;
|
|
55591
|
+
}
|
|
55592
|
+
if (options.json) {
|
|
55593
|
+
content = schema.nodeFromJSON(options.json);
|
|
55594
|
+
}
|
|
55595
|
+
if (!content) {
|
|
55596
|
+
content = node.content;
|
|
55597
|
+
}
|
|
55598
|
+
const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
|
|
55599
|
+
const currentNode = tr.doc.nodeAt(posFrom);
|
|
55600
|
+
if (currentNode && node.eq(currentNode)) {
|
|
55601
|
+
tr.replaceWith(posFrom, posTo, updatedNode);
|
|
55602
|
+
}
|
|
55603
|
+
});
|
|
55604
|
+
}
|
|
55605
|
+
return true;
|
|
55606
|
+
},
|
|
55607
|
+
/**
|
|
55608
|
+
* Removes all structured content fields that share the same group identifier.
|
|
55609
|
+
* @category Command
|
|
55610
|
+
* @param {string | string[]} groupOrGroups - Single group or array of groups
|
|
55611
|
+
* @example
|
|
55612
|
+
* // Delete all fields in a group
|
|
55613
|
+
* editor.commands.deleteStructuredContentByGroup('customer-info');
|
|
55614
|
+
*
|
|
55615
|
+
* // Delete multiple groups
|
|
55616
|
+
* editor.commands.deleteStructuredContentByGroup(['header', 'footer']);
|
|
55617
|
+
*/
|
|
55618
|
+
deleteStructuredContentByGroup: (groupOrGroups) => ({ dispatch, state: state2, tr }) => {
|
|
55619
|
+
const structuredContentTags = getStructuredContentByGroup(groupOrGroups, state2);
|
|
55620
|
+
if (!structuredContentTags.length) {
|
|
55621
|
+
return true;
|
|
55622
|
+
}
|
|
55623
|
+
if (dispatch) {
|
|
55624
|
+
structuredContentTags.forEach((structuredContent) => {
|
|
55625
|
+
const { pos, node } = structuredContent;
|
|
55626
|
+
const posFrom = tr.mapping.map(pos);
|
|
55627
|
+
const posTo = tr.mapping.map(pos + node.nodeSize);
|
|
55628
|
+
const currentNode = tr.doc.nodeAt(posFrom);
|
|
55629
|
+
if (currentNode && node.eq(currentNode)) {
|
|
55630
|
+
tr.delete(posFrom, posTo);
|
|
55631
|
+
}
|
|
55632
|
+
});
|
|
55633
|
+
}
|
|
55634
|
+
return true;
|
|
55635
|
+
},
|
|
55437
55636
|
/**
|
|
55438
55637
|
* Append multiple rows to the end of a table inside a structured content block.
|
|
55439
55638
|
* Each inner array represents the cell values for one new row.
|
|
@@ -58828,15 +59027,6 @@ const HardBreak = Node$1.create({
|
|
|
58828
59027
|
};
|
|
58829
59028
|
}
|
|
58830
59029
|
});
|
|
58831
|
-
const getColStyleDeclaration = (minWidth, width) => {
|
|
58832
|
-
if (width != null) {
|
|
58833
|
-
const numericWidth = Number(width);
|
|
58834
|
-
if (Number.isFinite(numericWidth) && numericWidth >= 0) {
|
|
58835
|
-
return ["width", `${numericWidth}px`];
|
|
58836
|
-
}
|
|
58837
|
-
}
|
|
58838
|
-
return ["min-width", `${minWidth}px`];
|
|
58839
|
-
};
|
|
58840
59030
|
const createTableView = ({ editor }) => {
|
|
58841
59031
|
return class TableView {
|
|
58842
59032
|
constructor(node, cellMinWidth2) {
|
|
@@ -58855,7 +59045,7 @@ const createTableView = ({ editor }) => {
|
|
|
58855
59045
|
this.table = this.dom.appendChild(document.createElement("table"));
|
|
58856
59046
|
this.colgroup = this.table.appendChild(document.createElement("colgroup"));
|
|
58857
59047
|
updateTable(this.editor, this.node, this.table);
|
|
58858
|
-
updateColumns(node, this.colgroup, this.table
|
|
59048
|
+
updateColumns(node, this.colgroup, this.table);
|
|
58859
59049
|
this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
58860
59050
|
setTimeout(() => {
|
|
58861
59051
|
updateTableWrapper(this.dom, this.table);
|
|
@@ -58867,7 +59057,7 @@ const createTableView = ({ editor }) => {
|
|
|
58867
59057
|
}
|
|
58868
59058
|
this.node = node;
|
|
58869
59059
|
updateTable(this.editor, node, this.table);
|
|
58870
|
-
updateColumns(node, this.colgroup, this.table, this.cellMinWidth
|
|
59060
|
+
updateColumns(node, this.colgroup, this.table, this.cellMinWidth);
|
|
58871
59061
|
updateTableWrapper(this.dom, this.table);
|
|
58872
59062
|
return true;
|
|
58873
59063
|
}
|
|
@@ -58880,43 +59070,20 @@ const createTableView = ({ editor }) => {
|
|
|
58880
59070
|
}
|
|
58881
59071
|
};
|
|
58882
59072
|
};
|
|
58883
|
-
function updateColumns(node, colgroup, table, cellMinWidth2
|
|
59073
|
+
function updateColumns(node, colgroup, table, cellMinWidth2) {
|
|
58884
59074
|
const gridColumns = Array.isArray(node.attrs?.grid) && node.attrs.grid.length ? node.attrs.grid.map((col) => twipsToPixels(col.col)) : null;
|
|
58885
59075
|
const totalColumns = gridColumns?.length ?? null;
|
|
58886
|
-
const pageBody = table.closest(".page__body");
|
|
58887
|
-
const wrapper = table.parentElement;
|
|
58888
|
-
let availableWidth = pageBody?.getBoundingClientRect?.().width;
|
|
58889
|
-
if (!availableWidth && wrapper) {
|
|
58890
|
-
availableWidth = wrapper.getBoundingClientRect().width;
|
|
58891
|
-
}
|
|
58892
|
-
if (typeof availableWidth === "number" && !Number.isNaN(availableWidth)) {
|
|
58893
|
-
availableWidth = Math.max(availableWidth - 2, 0);
|
|
58894
|
-
} else {
|
|
58895
|
-
availableWidth = null;
|
|
58896
|
-
}
|
|
58897
|
-
const pageStyles = editor?.converter?.pageStyles;
|
|
58898
|
-
if (pageStyles?.pageSize?.width) {
|
|
58899
|
-
const toNumber = (v2) => typeof v2 === "number" ? v2 : parseFloat(v2) || 0;
|
|
58900
|
-
const pageWidth = toNumber(pageStyles.pageSize.width);
|
|
58901
|
-
const marginLeft = toNumber(pageStyles.pageMargins?.left);
|
|
58902
|
-
const marginRight = toNumber(pageStyles.pageMargins?.right);
|
|
58903
|
-
const pageAvailableWidthPx = Math.max((pageWidth - marginLeft - marginRight) * PIXELS_PER_INCH, 0);
|
|
58904
|
-
if (pageAvailableWidthPx > 0) {
|
|
58905
|
-
availableWidth = availableWidth ? Math.min(availableWidth, pageAvailableWidthPx) : pageAvailableWidthPx;
|
|
58906
|
-
}
|
|
58907
|
-
}
|
|
58908
59076
|
const resolveColumnWidth = (colIndex2, colwidthValue) => {
|
|
58909
|
-
if (overrideCol === colIndex2) return overrideValue;
|
|
58910
59077
|
if (colwidthValue != null) return colwidthValue;
|
|
58911
59078
|
if (gridColumns && gridColumns[colIndex2] != null) return gridColumns[colIndex2];
|
|
58912
59079
|
return null;
|
|
58913
59080
|
};
|
|
58914
59081
|
const widths = [];
|
|
58915
|
-
const
|
|
59082
|
+
const firstRow = node.firstChild;
|
|
58916
59083
|
let colIndex = 0;
|
|
58917
|
-
if (
|
|
58918
|
-
for (let i = 0; i <
|
|
58919
|
-
const child =
|
|
59084
|
+
if (firstRow !== null) {
|
|
59085
|
+
for (let i = 0; i < firstRow.childCount; i++) {
|
|
59086
|
+
const child = firstRow.child(i);
|
|
58920
59087
|
const { colspan, colwidth } = child.attrs;
|
|
58921
59088
|
for (let span = 0; span < colspan; span += 1, colIndex += 1) {
|
|
58922
59089
|
widths.push(resolveColumnWidth(colIndex, colwidth && colwidth[span]));
|
|
@@ -58936,49 +59103,41 @@ function updateColumns(node, colgroup, table, cellMinWidth2, overrideCol, overri
|
|
|
58936
59103
|
if (numericWidth < 1) return 0;
|
|
58937
59104
|
return numericWidth;
|
|
58938
59105
|
});
|
|
58939
|
-
const
|
|
58940
|
-
|
|
58941
|
-
|
|
58942
|
-
|
|
58943
|
-
|
|
58944
|
-
let
|
|
58945
|
-
let hasUndefinedWidth = false;
|
|
58946
|
-
let dom = colgroup.firstChild;
|
|
59106
|
+
const tableWidthCSS = convertSizeToCSS(
|
|
59107
|
+
// TODO: why is tableWidth undefined in src/tests/import-export/font-default-styles.test.js?
|
|
59108
|
+
node.attrs.tableProperties.tableWidth?.value ?? null,
|
|
59109
|
+
node.attrs.tableProperties.tableWidth?.type ?? "auto"
|
|
59110
|
+
);
|
|
59111
|
+
let colElement = colgroup.firstChild;
|
|
58947
59112
|
normalizedWidths.forEach((width) => {
|
|
58948
|
-
|
|
58949
|
-
|
|
58950
|
-
scaledWidth = scaledWidth * scale;
|
|
58951
|
-
}
|
|
58952
|
-
const [propKey, propVal] = getColStyleDeclaration(cellMinWidth2, scaledWidth);
|
|
58953
|
-
if (scaledWidth == null) {
|
|
58954
|
-
totalWidth += cellMinWidth2;
|
|
58955
|
-
hasUndefinedWidth = true;
|
|
58956
|
-
} else {
|
|
58957
|
-
totalWidth += scaledWidth;
|
|
58958
|
-
}
|
|
58959
|
-
if (!dom) {
|
|
58960
|
-
const colElement = document.createElement("col");
|
|
58961
|
-
colElement.style.setProperty(propKey, propVal);
|
|
59113
|
+
if (!colElement) {
|
|
59114
|
+
colElement = document.createElement("col");
|
|
58962
59115
|
colgroup.appendChild(colElement);
|
|
58963
|
-
} else {
|
|
58964
|
-
dom.style.setProperty(propKey, propVal);
|
|
58965
|
-
dom = dom.nextSibling;
|
|
58966
59116
|
}
|
|
59117
|
+
colElement.style.width = width !== null && width !== void 0 ? `${width}px` : null;
|
|
59118
|
+
colElement = colElement.nextSibling;
|
|
58967
59119
|
});
|
|
58968
|
-
while (
|
|
58969
|
-
const next =
|
|
58970
|
-
|
|
58971
|
-
|
|
58972
|
-
}
|
|
58973
|
-
|
|
58974
|
-
|
|
58975
|
-
|
|
58976
|
-
|
|
59120
|
+
while (colElement) {
|
|
59121
|
+
const next = colElement.nextSibling;
|
|
59122
|
+
colElement.parentNode?.removeChild(colElement);
|
|
59123
|
+
colElement = next;
|
|
59124
|
+
}
|
|
59125
|
+
const tableIndent = convertSizeToCSS(
|
|
59126
|
+
node.attrs.tableProperties.tableIndent?.value ?? 0,
|
|
59127
|
+
node.attrs.tableProperties.tableIndent?.type ?? "dxa"
|
|
59128
|
+
);
|
|
59129
|
+
const firstRowFirstCellPaddingLeftPx = firstRow?.firstChild?.attrs?.cellMargins?.left ?? 0;
|
|
59130
|
+
const firstRowLastCellPaddingRightPx = firstRow?.lastChild?.attrs?.cellMargins?.right ?? 0;
|
|
59131
|
+
table.style.marginLeft = `${-firstRowFirstCellPaddingLeftPx}px`;
|
|
59132
|
+
if (tableIndent !== null) {
|
|
59133
|
+
table.style.marginLeft = tableIndent;
|
|
59134
|
+
}
|
|
59135
|
+
if (node.attrs.tableProperties.tableWidth?.type === "pct") {
|
|
59136
|
+
const padding = firstRowFirstCellPaddingLeftPx + firstRowLastCellPaddingRightPx;
|
|
59137
|
+
table.style.maxWidth = table.style.width = `calc(${tableWidthCSS} + ${padding}px)`;
|
|
58977
59138
|
} else {
|
|
58978
|
-
table.style.width =
|
|
58979
|
-
table.style.minWidth = `${totalWidth}px`;
|
|
59139
|
+
table.style.maxWidth = table.style.width = tableWidthCSS;
|
|
58980
59140
|
}
|
|
58981
|
-
table.style.maxWidth = "100%";
|
|
58982
59141
|
}
|
|
58983
59142
|
function updateTable(editor, node, table) {
|
|
58984
59143
|
const allExtensionsAttrs = editor.extensionService.attributes;
|
|
@@ -59056,6 +59215,15 @@ const createTable = (schema, rowsCount, colsCount, withHeaderRow, cellContent =
|
|
|
59056
59215
|
const tableBorders = createTableBorders();
|
|
59057
59216
|
return types2.table.createChecked({ borders: tableBorders }, rows);
|
|
59058
59217
|
};
|
|
59218
|
+
const getColStyleDeclaration = (minWidth, width) => {
|
|
59219
|
+
if (width != null) {
|
|
59220
|
+
const numericWidth = Number(width);
|
|
59221
|
+
if (Number.isFinite(numericWidth) && numericWidth >= 0) {
|
|
59222
|
+
return ["width", `${numericWidth}px`];
|
|
59223
|
+
}
|
|
59224
|
+
}
|
|
59225
|
+
return ["min-width", `${minWidth}px`];
|
|
59226
|
+
};
|
|
59059
59227
|
const MIN_MEANINGFUL_WIDTH_PX = 1;
|
|
59060
59228
|
const createColGroup = (node, cellMinWidth2, overrideCol, overrideValue) => {
|
|
59061
59229
|
let totalWidth = 0;
|
|
@@ -61422,15 +61590,6 @@ const Table = Node$1.create({
|
|
|
61422
61590
|
},
|
|
61423
61591
|
addAttributes() {
|
|
61424
61592
|
return {
|
|
61425
|
-
/* tableWidth: {
|
|
61426
|
-
renderDOM: ({ tableWidth }) => {
|
|
61427
|
-
if (!tableWidth) return {};
|
|
61428
|
-
const { width, type = 'auto' } = tableWidth;
|
|
61429
|
-
return {
|
|
61430
|
-
style: `width: ${width}px`
|
|
61431
|
-
};
|
|
61432
|
-
},
|
|
61433
|
-
}, */
|
|
61434
61593
|
/**
|
|
61435
61594
|
* @private
|
|
61436
61595
|
* @category Attribute
|
|
@@ -61534,7 +61693,12 @@ const Table = Node$1.create({
|
|
|
61534
61693
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 371-483
|
|
61535
61694
|
*/
|
|
61536
61695
|
tableProperties: {
|
|
61537
|
-
default:
|
|
61696
|
+
default: {
|
|
61697
|
+
tableWidth: {
|
|
61698
|
+
value: null,
|
|
61699
|
+
type: "auto"
|
|
61700
|
+
}
|
|
61701
|
+
},
|
|
61538
61702
|
rendered: false
|
|
61539
61703
|
},
|
|
61540
61704
|
/**
|
|
@@ -62302,12 +62466,14 @@ const TableCell = Node$1.create({
|
|
|
62302
62466
|
}
|
|
62303
62467
|
},
|
|
62304
62468
|
cellMargins: {
|
|
62305
|
-
renderDOM({ cellMargins }) {
|
|
62469
|
+
renderDOM({ cellMargins, borders }) {
|
|
62306
62470
|
if (!cellMargins) return {};
|
|
62307
62471
|
const sides2 = ["top", "right", "bottom", "left"];
|
|
62308
62472
|
const style2 = sides2.map((side) => {
|
|
62309
|
-
const margin = cellMargins?.[side];
|
|
62310
|
-
|
|
62473
|
+
const margin = cellMargins?.[side] ?? 0;
|
|
62474
|
+
const border = borders?.[side];
|
|
62475
|
+
const borderSize = border && border.val !== "none" ? Math.ceil(border.size) : 0;
|
|
62476
|
+
if (margin) return `padding-${side}: ${Math.max(0, margin - borderSize)}px;`;
|
|
62311
62477
|
return "";
|
|
62312
62478
|
}).join(" ");
|
|
62313
62479
|
return { style: style2 };
|
|
@@ -91529,7 +91695,7 @@ const _sfc_main$1 = {
|
|
|
91529
91695
|
};
|
|
91530
91696
|
}
|
|
91531
91697
|
};
|
|
91532
|
-
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
91698
|
+
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-4615ea7d"]]);
|
|
91533
91699
|
const _hoisted_1 = ["innerHTML"];
|
|
91534
91700
|
const _sfc_main = {
|
|
91535
91701
|
__name: "SuperInput",
|