@harbour-enterprises/superdoc 1.0.0-beta.82 → 1.0.0-beta.83
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-gQqtBsXT.es.js → PdfViewer-BKSYQF4A.es.js} +1 -1
- package/dist/chunks/{PdfViewer-kLZVOUbz.cjs → PdfViewer-CHGHNfNo.cjs} +1 -1
- package/dist/chunks/{index-CNPZHNDf.es.js → index-CwqkdTTS.es.js} +3 -3
- package/dist/chunks/{index-cUgy4sJN.cjs → index-Dh6EUBba.cjs} +3 -3
- package/dist/chunks/{index-GF5Urhpn-LFkKkWot.es.js → index-YXzWgyNJ-Tc_oVxxj.es.js} +1 -1
- package/dist/chunks/{index-GF5Urhpn-BNFw-VyP.cjs → index-YXzWgyNJ-pYe0a6fD.cjs} +1 -1
- package/dist/chunks/{super-editor.es-DfLaDbHA.es.js → super-editor.es-C3DMEtqC.es.js} +422 -54
- package/dist/chunks/{super-editor.es-44RL9-Ca.cjs → super-editor.es-CmeSTVH2.cjs} +422 -54
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-Bfu1F5pk.js → converter-BjVEidKj.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-Cl08Z_S_.js → docx-zipper-_rraiG3i.js} +1 -1
- package/dist/super-editor/chunks/{editor-CwTMBaym.js → editor-pX9cGnu1.js} +423 -55
- package/dist/super-editor/chunks/{index-GF5Urhpn.js → index-YXzWgyNJ.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-DZTp7DIF.js → toolbar-B2ca6SPN.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +424 -56
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -42392,7 +42392,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
42392
42392
|
static getStoredSuperdocVersion(docx) {
|
|
42393
42393
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42394
42394
|
}
|
|
42395
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
42395
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.83") {
|
|
42396
42396
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
42397
42397
|
}
|
|
42398
42398
|
/**
|
|
@@ -67438,7 +67438,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67438
67438
|
const shouldSkipNodeView = (editor) => {
|
|
67439
67439
|
return isHeadless(editor);
|
|
67440
67440
|
};
|
|
67441
|
-
const summaryVersion = "1.0.0-beta.
|
|
67441
|
+
const summaryVersion = "1.0.0-beta.83";
|
|
67442
67442
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
67443
67443
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
67444
67444
|
function mapAttributes(attrs) {
|
|
@@ -68227,7 +68227,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68227
68227
|
{ default: remarkStringify2 },
|
|
68228
68228
|
{ default: remarkGfm2 }
|
|
68229
68229
|
] = await Promise.all([
|
|
68230
|
-
Promise.resolve().then(() =>
|
|
68230
|
+
Promise.resolve().then(() => indexYXzWgyNJ),
|
|
68231
68231
|
Promise.resolve().then(() => indexDRCvimau),
|
|
68232
68232
|
Promise.resolve().then(() => indexC_x_N6Uh),
|
|
68233
68233
|
Promise.resolve().then(() => indexD_sWOSiG),
|
|
@@ -68432,7 +68432,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68432
68432
|
* Process collaboration migrations
|
|
68433
68433
|
*/
|
|
68434
68434
|
processCollaborationMigrations() {
|
|
68435
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
68435
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.83");
|
|
68436
68436
|
if (!this.options.ydoc) return;
|
|
68437
68437
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
68438
68438
|
let docVersion = metaMap.get("version");
|
|
@@ -71476,32 +71476,76 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
71476
71476
|
return hasChanges ? hydratedRuns : runs2;
|
|
71477
71477
|
};
|
|
71478
71478
|
return blocks2.map((block) => {
|
|
71479
|
-
|
|
71480
|
-
if (
|
|
71481
|
-
|
|
71482
|
-
|
|
71483
|
-
|
|
71484
|
-
|
|
71485
|
-
|
|
71486
|
-
|
|
71487
|
-
|
|
71488
|
-
|
|
71489
|
-
|
|
71490
|
-
|
|
71491
|
-
|
|
71492
|
-
|
|
71493
|
-
|
|
71494
|
-
|
|
71495
|
-
|
|
71496
|
-
|
|
71497
|
-
|
|
71498
|
-
|
|
71499
|
-
|
|
71500
|
-
|
|
71479
|
+
const hydrateBlock = (blk) => {
|
|
71480
|
+
if (blk.kind === "image") {
|
|
71481
|
+
if (!blk.src || blk.src.startsWith("data:")) {
|
|
71482
|
+
return blk;
|
|
71483
|
+
}
|
|
71484
|
+
const attrs = blk.attrs ?? {};
|
|
71485
|
+
const relId = typeof attrs.rId === "string" ? attrs.rId : void 0;
|
|
71486
|
+
const attrSrc = typeof attrs.src === "string" ? attrs.src : void 0;
|
|
71487
|
+
const extension = typeof attrs.extension === "string" ? attrs.extension.toLowerCase() : void 0;
|
|
71488
|
+
const resolvedSrc = resolveImageSrc(blk.src, relId, attrSrc, extension);
|
|
71489
|
+
if (resolvedSrc) {
|
|
71490
|
+
return { ...blk, src: resolvedSrc };
|
|
71491
|
+
}
|
|
71492
|
+
return blk;
|
|
71493
|
+
}
|
|
71494
|
+
if (blk.kind === "paragraph") {
|
|
71495
|
+
const paragraphBlock = blk;
|
|
71496
|
+
if (!paragraphBlock.runs || paragraphBlock.runs.length === 0) {
|
|
71497
|
+
return blk;
|
|
71498
|
+
}
|
|
71499
|
+
const hydratedRuns = hydrateRuns(paragraphBlock.runs);
|
|
71500
|
+
if (hydratedRuns !== paragraphBlock.runs) {
|
|
71501
|
+
return { ...paragraphBlock, runs: hydratedRuns };
|
|
71502
|
+
}
|
|
71503
|
+
return blk;
|
|
71504
|
+
}
|
|
71505
|
+
if (blk.kind === "table") {
|
|
71506
|
+
let rowsChanged = false;
|
|
71507
|
+
const newRows = blk.rows.map((row2) => {
|
|
71508
|
+
let cellsChanged = false;
|
|
71509
|
+
const newCells = row2.cells.map((cell2) => {
|
|
71510
|
+
let cellChanged = false;
|
|
71511
|
+
const hydratedBlocks = (cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : [])).map((cb) => hydrateBlock(cb));
|
|
71512
|
+
if (cell2.blocks && hydratedBlocks !== cell2.blocks) {
|
|
71513
|
+
cellChanged = true;
|
|
71514
|
+
}
|
|
71515
|
+
let hydratedParagraph = cell2.paragraph;
|
|
71516
|
+
if (!cell2.blocks && cell2.paragraph && cell2.paragraph.kind === "paragraph") {
|
|
71517
|
+
const hydratedPara = hydrateBlock(cell2.paragraph);
|
|
71518
|
+
if (hydratedPara !== cell2.paragraph) {
|
|
71519
|
+
hydratedParagraph = hydratedPara;
|
|
71520
|
+
cellChanged = true;
|
|
71521
|
+
}
|
|
71522
|
+
}
|
|
71523
|
+
if (cellChanged) {
|
|
71524
|
+
return {
|
|
71525
|
+
...cell2,
|
|
71526
|
+
blocks: hydratedBlocks.length > 0 ? hydratedBlocks : cell2.blocks,
|
|
71527
|
+
paragraph: hydratedParagraph
|
|
71528
|
+
};
|
|
71529
|
+
}
|
|
71530
|
+
return cell2;
|
|
71531
|
+
});
|
|
71532
|
+
if (newCells.some((c2, idx) => c2 !== row2.cells[idx])) {
|
|
71533
|
+
cellsChanged = true;
|
|
71534
|
+
}
|
|
71535
|
+
if (cellsChanged) {
|
|
71536
|
+
rowsChanged = true;
|
|
71537
|
+
return { ...row2, cells: newCells };
|
|
71538
|
+
}
|
|
71539
|
+
return row2;
|
|
71540
|
+
});
|
|
71541
|
+
if (rowsChanged) {
|
|
71542
|
+
return { ...blk, rows: newRows };
|
|
71543
|
+
}
|
|
71544
|
+
return blk;
|
|
71501
71545
|
}
|
|
71502
|
-
return
|
|
71503
|
-
}
|
|
71504
|
-
return block;
|
|
71546
|
+
return blk;
|
|
71547
|
+
};
|
|
71548
|
+
return hydrateBlock(block);
|
|
71505
71549
|
});
|
|
71506
71550
|
}
|
|
71507
71551
|
function isGradientFill(value) {
|
|
@@ -73216,7 +73260,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
73216
73260
|
return void 0;
|
|
73217
73261
|
}
|
|
73218
73262
|
const DEFAULT_LIST_HANGING_PX$1 = 18;
|
|
73219
|
-
const LIST_MARKER_GAP$
|
|
73263
|
+
const LIST_MARKER_GAP$3 = 8;
|
|
73220
73264
|
const DEFAULT_BULLET_GLYPH = "•";
|
|
73221
73265
|
const DEFAULT_DECIMAL_PATTERN = "%1.";
|
|
73222
73266
|
const ASCII_UPPERCASE_A = 65;
|
|
@@ -73627,7 +73671,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
73627
73671
|
let markerBoxWidthPx;
|
|
73628
73672
|
let markerX;
|
|
73629
73673
|
if (hasFirstLineIndent) {
|
|
73630
|
-
markerBoxWidthPx = glyphWidthPx != null && glyphWidthPx > 0 ? glyphWidthPx + LIST_MARKER_GAP$
|
|
73674
|
+
markerBoxWidthPx = glyphWidthPx != null && glyphWidthPx > 0 ? glyphWidthPx + LIST_MARKER_GAP$3 : DEFAULT_LIST_HANGING_PX$1;
|
|
73631
73675
|
markerX = indentLeftPx + (firstLinePx ?? 0);
|
|
73632
73676
|
layout.textStartPx = markerX + markerBoxWidthPx;
|
|
73633
73677
|
layout.hangingPx = 0;
|
|
@@ -73727,12 +73771,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
73727
73771
|
let markerBox = Math.max(hangingPxRaw || 0, 0);
|
|
73728
73772
|
if (markerBox <= 0) {
|
|
73729
73773
|
if (glyphWidthPx != null && glyphWidthPx > 0) {
|
|
73730
|
-
markerBox = glyphWidthPx + LIST_MARKER_GAP$
|
|
73774
|
+
markerBox = glyphWidthPx + LIST_MARKER_GAP$3;
|
|
73731
73775
|
} else {
|
|
73732
73776
|
markerBox = DEFAULT_LIST_HANGING_PX$1;
|
|
73733
73777
|
}
|
|
73734
|
-
} else if (glyphWidthPx != null && glyphWidthPx + LIST_MARKER_GAP$
|
|
73735
|
-
markerBox = glyphWidthPx + LIST_MARKER_GAP$
|
|
73778
|
+
} else if (glyphWidthPx != null && glyphWidthPx + LIST_MARKER_GAP$3 > markerBox) {
|
|
73779
|
+
markerBox = glyphWidthPx + LIST_MARKER_GAP$3;
|
|
73736
73780
|
}
|
|
73737
73781
|
return markerBox;
|
|
73738
73782
|
};
|
|
@@ -75018,14 +75062,29 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75018
75062
|
paragraphAttrs.frame = frame;
|
|
75019
75063
|
}
|
|
75020
75064
|
}
|
|
75065
|
+
const listRendering = normalizeListRenderingAttrs(attrs.listRendering);
|
|
75021
75066
|
const numberingSource = attrs.numberingProperties ?? paragraphProps.numberingProperties ?? hydrated?.numberingProperties;
|
|
75022
|
-
|
|
75067
|
+
let rawNumberingProps = toAdapterNumberingProps(numberingSource);
|
|
75068
|
+
if (!rawNumberingProps && listRendering) {
|
|
75069
|
+
const path2 = listRendering.path;
|
|
75070
|
+
const counterFromPath = path2 && path2.length ? path2[path2.length - 1] : void 0;
|
|
75071
|
+
const ilvl = path2 && path2.length > 1 ? path2.length - 1 : 0;
|
|
75072
|
+
rawNumberingProps = {
|
|
75073
|
+
numId: -1,
|
|
75074
|
+
ilvl,
|
|
75075
|
+
path: path2,
|
|
75076
|
+
counterValue: Number.isFinite(counterFromPath) ? Number(counterFromPath) : void 0,
|
|
75077
|
+
markerText: listRendering.markerText,
|
|
75078
|
+
format: listRendering.numberingType,
|
|
75079
|
+
lvlJc: listRendering.justification,
|
|
75080
|
+
suffix: listRendering.suffix
|
|
75081
|
+
};
|
|
75082
|
+
}
|
|
75023
75083
|
const hasValidNumbering = rawNumberingProps && isValidNumberingId(rawNumberingProps.numId);
|
|
75024
75084
|
if (hasValidNumbering) {
|
|
75025
75085
|
const numberingProps = rawNumberingProps;
|
|
75026
75086
|
const numId = numberingProps.numId;
|
|
75027
75087
|
const ilvl = Number.isFinite(numberingProps.ilvl) ? Math.max(0, Math.floor(Number(numberingProps.ilvl))) : 0;
|
|
75028
|
-
const listRendering = normalizeListRenderingAttrs(attrs.listRendering);
|
|
75029
75088
|
const numericNumId = typeof numId === "number" ? numId : void 0;
|
|
75030
75089
|
const resolvedLevel = resolveNumberingFromContext(numId, ilvl, converterContext?.numbering);
|
|
75031
75090
|
if (resolvedLevel) {
|
|
@@ -77076,29 +77135,129 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77076
77135
|
...context.converterContext,
|
|
77077
77136
|
tableStyleParagraphProps
|
|
77078
77137
|
} : context.converterContext;
|
|
77138
|
+
const paragraphToFlowBlocks2 = context.converters?.paragraphToFlowBlocks ?? context.paragraphToFlowBlocks;
|
|
77139
|
+
const listCounterContext = context.listCounterContext;
|
|
77079
77140
|
for (const childNode of cellNode.content) {
|
|
77080
77141
|
if (childNode.type === "paragraph") {
|
|
77081
|
-
|
|
77142
|
+
if (!paragraphToFlowBlocks2) continue;
|
|
77143
|
+
const paragraphBlocks = paragraphToFlowBlocks2(
|
|
77082
77144
|
childNode,
|
|
77083
77145
|
context.nextBlockId,
|
|
77084
77146
|
context.positions,
|
|
77085
77147
|
context.defaultFont,
|
|
77086
77148
|
context.defaultSize,
|
|
77087
77149
|
context.styleContext,
|
|
77088
|
-
|
|
77089
|
-
// listCounterContext
|
|
77150
|
+
listCounterContext,
|
|
77090
77151
|
context.trackedChanges,
|
|
77091
77152
|
context.bookmarks,
|
|
77092
77153
|
context.hyperlinkConfig,
|
|
77093
77154
|
context.themeColors,
|
|
77094
77155
|
cellConverterContext
|
|
77095
|
-
// converterContext at position 12
|
|
77096
77156
|
);
|
|
77097
|
-
|
|
77098
|
-
|
|
77099
|
-
|
|
77157
|
+
paragraphBlocks.forEach((block) => {
|
|
77158
|
+
if (block.kind === "paragraph" || block.kind === "image" || block.kind === "drawing") {
|
|
77159
|
+
blocks2.push(block);
|
|
77160
|
+
}
|
|
77161
|
+
});
|
|
77162
|
+
continue;
|
|
77163
|
+
}
|
|
77164
|
+
if (childNode.type === "image" && context.converters?.imageNodeToBlock) {
|
|
77165
|
+
const mergedMarks = [...childNode.marks ?? []];
|
|
77166
|
+
const trackedMeta = context.trackedChanges ? collectTrackedChangeFromMarks(mergedMarks) : void 0;
|
|
77167
|
+
if (shouldHideTrackedNode(trackedMeta, context.trackedChanges)) {
|
|
77168
|
+
continue;
|
|
77169
|
+
}
|
|
77170
|
+
const imageBlock = context.converters.imageNodeToBlock(
|
|
77171
|
+
childNode,
|
|
77172
|
+
context.nextBlockId,
|
|
77173
|
+
context.positions,
|
|
77174
|
+
trackedMeta,
|
|
77175
|
+
context.trackedChanges
|
|
77176
|
+
);
|
|
77177
|
+
if (imageBlock && imageBlock.kind === "image") {
|
|
77178
|
+
annotateBlockWithTrackedChange(imageBlock, trackedMeta, context.trackedChanges);
|
|
77179
|
+
blocks2.push(imageBlock);
|
|
77180
|
+
}
|
|
77181
|
+
continue;
|
|
77182
|
+
}
|
|
77183
|
+
if (childNode.type === "vectorShape" && context.converters?.vectorShapeNodeToDrawingBlock) {
|
|
77184
|
+
const drawingBlock = context.converters.vectorShapeNodeToDrawingBlock(
|
|
77185
|
+
childNode,
|
|
77186
|
+
context.nextBlockId,
|
|
77187
|
+
context.positions
|
|
77188
|
+
);
|
|
77189
|
+
if (drawingBlock) {
|
|
77190
|
+
blocks2.push(drawingBlock);
|
|
77100
77191
|
}
|
|
77192
|
+
continue;
|
|
77101
77193
|
}
|
|
77194
|
+
if (childNode.type === "shapeGroup" && context.converters?.shapeGroupNodeToDrawingBlock) {
|
|
77195
|
+
const drawingBlock = context.converters.shapeGroupNodeToDrawingBlock(
|
|
77196
|
+
childNode,
|
|
77197
|
+
context.nextBlockId,
|
|
77198
|
+
context.positions
|
|
77199
|
+
);
|
|
77200
|
+
if (drawingBlock) {
|
|
77201
|
+
blocks2.push(drawingBlock);
|
|
77202
|
+
}
|
|
77203
|
+
continue;
|
|
77204
|
+
}
|
|
77205
|
+
if (childNode.type === "shapeContainer" && context.converters?.shapeContainerNodeToDrawingBlock) {
|
|
77206
|
+
const drawingBlock = context.converters.shapeContainerNodeToDrawingBlock(
|
|
77207
|
+
childNode,
|
|
77208
|
+
context.nextBlockId,
|
|
77209
|
+
context.positions
|
|
77210
|
+
);
|
|
77211
|
+
if (drawingBlock) {
|
|
77212
|
+
blocks2.push(drawingBlock);
|
|
77213
|
+
}
|
|
77214
|
+
continue;
|
|
77215
|
+
}
|
|
77216
|
+
if (childNode.type === "shapeTextbox" && context.converters?.shapeTextboxNodeToDrawingBlock) {
|
|
77217
|
+
const drawingBlock = context.converters.shapeTextboxNodeToDrawingBlock(
|
|
77218
|
+
childNode,
|
|
77219
|
+
context.nextBlockId,
|
|
77220
|
+
context.positions
|
|
77221
|
+
);
|
|
77222
|
+
if (drawingBlock) {
|
|
77223
|
+
blocks2.push(drawingBlock);
|
|
77224
|
+
}
|
|
77225
|
+
}
|
|
77226
|
+
}
|
|
77227
|
+
try {
|
|
77228
|
+
const blockSummaries = blocks2.map((b2) => {
|
|
77229
|
+
if (b2.kind === "paragraph") {
|
|
77230
|
+
const runs2 = b2.runs ?? [];
|
|
77231
|
+
const attrs = b2.attrs ?? {};
|
|
77232
|
+
return {
|
|
77233
|
+
kind: "paragraph",
|
|
77234
|
+
runKinds: runs2.map((r2) => r2.kind ?? "text"),
|
|
77235
|
+
runCount: runs2.length,
|
|
77236
|
+
runPreview: runs2.map((r2) => {
|
|
77237
|
+
const kind = r2.kind ?? "text";
|
|
77238
|
+
if (kind === "image") {
|
|
77239
|
+
const img2 = r2;
|
|
77240
|
+
return { kind, src: img2.src, width: img2.width, height: img2.height };
|
|
77241
|
+
}
|
|
77242
|
+
return { kind };
|
|
77243
|
+
}),
|
|
77244
|
+
hasNumbering: Boolean(attrs.numberingProperties),
|
|
77245
|
+
markerText: attrs.wordLayout?.marker?.markerText
|
|
77246
|
+
};
|
|
77247
|
+
}
|
|
77248
|
+
return { kind: b2.kind };
|
|
77249
|
+
});
|
|
77250
|
+
console.log(
|
|
77251
|
+
"[tableNodeToBlock.parseTableCell] cell contents",
|
|
77252
|
+
JSON.stringify({
|
|
77253
|
+
cellIndex,
|
|
77254
|
+
rowIndex,
|
|
77255
|
+
cellIdPreview: `cell-${rowIndex}-${cellIndex}`,
|
|
77256
|
+
childTypes: cellNode.content.map((c2) => c2?.type),
|
|
77257
|
+
blocks: blockSummaries
|
|
77258
|
+
})
|
|
77259
|
+
);
|
|
77260
|
+
} catch {
|
|
77102
77261
|
}
|
|
77103
77262
|
if (blocks2.length === 0) {
|
|
77104
77263
|
return null;
|
|
@@ -77238,9 +77397,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77238
77397
|
}
|
|
77239
77398
|
return { anchor, wrap: wrap2 };
|
|
77240
77399
|
}
|
|
77241
|
-
function tableNodeToBlock$1(node2, nextBlockId, positions, defaultFont, defaultSize, _styleContext, trackedChanges, bookmarks, hyperlinkConfig, themeColors, paragraphToFlowBlocks2, converterContext) {
|
|
77400
|
+
function tableNodeToBlock$1(node2, nextBlockId, positions, defaultFont, defaultSize, _styleContext, trackedChanges, bookmarks, hyperlinkConfig, themeColors, paragraphToFlowBlocks2, converterContext, options) {
|
|
77242
77401
|
if (!Array.isArray(node2.content) || node2.content.length === 0) return null;
|
|
77243
|
-
|
|
77402
|
+
const paragraphConverter = paragraphToFlowBlocks2 ?? options?.converters?.paragraphToFlowBlocks;
|
|
77403
|
+
if (!paragraphConverter) return null;
|
|
77244
77404
|
const parserDeps = {
|
|
77245
77405
|
nextBlockId,
|
|
77246
77406
|
positions,
|
|
@@ -77251,8 +77411,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77251
77411
|
bookmarks,
|
|
77252
77412
|
hyperlinkConfig,
|
|
77253
77413
|
themeColors,
|
|
77254
|
-
|
|
77255
|
-
|
|
77414
|
+
listCounterContext: options?.listCounterContext,
|
|
77415
|
+
paragraphToFlowBlocks: paragraphConverter,
|
|
77416
|
+
converterContext,
|
|
77417
|
+
converters: options?.converters
|
|
77256
77418
|
};
|
|
77257
77419
|
const hydratedTableStyle = hydrateTableStyleAttrs(node2, converterContext);
|
|
77258
77420
|
const defaultCellPadding = hydratedTableStyle?.cellPadding;
|
|
@@ -77372,6 +77534,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77372
77534
|
defaultFont,
|
|
77373
77535
|
defaultSize,
|
|
77374
77536
|
styleContext,
|
|
77537
|
+
listCounterContext,
|
|
77375
77538
|
trackedChangesConfig,
|
|
77376
77539
|
bookmarks,
|
|
77377
77540
|
hyperlinkConfig,
|
|
@@ -77391,7 +77554,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77391
77554
|
void 0,
|
|
77392
77555
|
// themeColors
|
|
77393
77556
|
converters?.paragraphToFlowBlocks,
|
|
77394
|
-
converterContext
|
|
77557
|
+
converterContext,
|
|
77558
|
+
{ listCounterContext, converters }
|
|
77395
77559
|
);
|
|
77396
77560
|
if (tableBlock) {
|
|
77397
77561
|
blocks2.push(tableBlock);
|
|
@@ -77545,7 +77709,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77545
77709
|
bookmarks2,
|
|
77546
77710
|
hyperlinkConfig2,
|
|
77547
77711
|
themeColorsParam ?? themeColors,
|
|
77548
|
-
|
|
77712
|
+
paragraphConverter
|
|
77549
77713
|
);
|
|
77550
77714
|
const handlerContext = {
|
|
77551
77715
|
blocks: blocks2,
|
|
@@ -77568,7 +77732,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77568
77732
|
converters: {
|
|
77569
77733
|
paragraphToFlowBlocks: paragraphConverter,
|
|
77570
77734
|
tableNodeToBlock: tableConverter,
|
|
77571
|
-
imageNodeToBlock
|
|
77735
|
+
imageNodeToBlock,
|
|
77736
|
+
vectorShapeNodeToDrawingBlock,
|
|
77737
|
+
shapeGroupNodeToDrawingBlock,
|
|
77738
|
+
shapeContainerNodeToDrawingBlock,
|
|
77739
|
+
shapeTextboxNodeToDrawingBlock
|
|
77572
77740
|
}
|
|
77573
77741
|
};
|
|
77574
77742
|
doc2.content.forEach((node2) => {
|
|
@@ -77653,7 +77821,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77653
77821
|
hyperlinkConfig2,
|
|
77654
77822
|
themeColors2,
|
|
77655
77823
|
paragraphToFlowBlocks,
|
|
77656
|
-
converterCtx ?? converterContext
|
|
77824
|
+
converterCtx ?? converterContext,
|
|
77825
|
+
{
|
|
77826
|
+
listCounterContext,
|
|
77827
|
+
converters: {
|
|
77828
|
+
paragraphToFlowBlocks: paragraphToFlowBlocks$1,
|
|
77829
|
+
imageNodeToBlock,
|
|
77830
|
+
vectorShapeNodeToDrawingBlock,
|
|
77831
|
+
shapeGroupNodeToDrawingBlock,
|
|
77832
|
+
shapeContainerNodeToDrawingBlock,
|
|
77833
|
+
shapeTextboxNodeToDrawingBlock
|
|
77834
|
+
}
|
|
77835
|
+
}
|
|
77657
77836
|
)
|
|
77658
77837
|
},
|
|
77659
77838
|
converterContext
|
|
@@ -77672,7 +77851,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77672
77851
|
hyperlinkConfig,
|
|
77673
77852
|
themeColors,
|
|
77674
77853
|
paragraphToFlowBlocks,
|
|
77675
|
-
converterContext
|
|
77854
|
+
converterContext,
|
|
77855
|
+
{
|
|
77856
|
+
converters: {
|
|
77857
|
+
paragraphToFlowBlocks: paragraphToFlowBlocks$1,
|
|
77858
|
+
imageNodeToBlock,
|
|
77859
|
+
vectorShapeNodeToDrawingBlock,
|
|
77860
|
+
shapeGroupNodeToDrawingBlock,
|
|
77861
|
+
shapeContainerNodeToDrawingBlock,
|
|
77862
|
+
shapeTextboxNodeToDrawingBlock
|
|
77863
|
+
}
|
|
77864
|
+
}
|
|
77676
77865
|
);
|
|
77677
77866
|
}
|
|
77678
77867
|
let measurementCanvas = null;
|
|
@@ -80855,6 +81044,43 @@ ${l}
|
|
|
80855
81044
|
right: borderValueToSpec(isLastCol ? tableBorders?.right : null)
|
|
80856
81045
|
};
|
|
80857
81046
|
};
|
|
81047
|
+
const LIST_MARKER_GAP$2 = 8;
|
|
81048
|
+
function renderListMarker(params2) {
|
|
81049
|
+
const { doc: doc2, lineEl, markerLayout, markerMeasure, indentLeftPx } = params2;
|
|
81050
|
+
const markerJustification = markerLayout?.justification ?? "left";
|
|
81051
|
+
const markerBoxWidth = (typeof markerLayout?.markerBoxWidthPx === "number" ? markerLayout.markerBoxWidthPx : void 0) ?? markerMeasure?.markerWidth ?? 0;
|
|
81052
|
+
const gutter = (typeof markerLayout?.gutterWidthPx === "number" ? markerLayout.gutterWidthPx : void 0) ?? markerMeasure?.gutterWidth ?? LIST_MARKER_GAP$2;
|
|
81053
|
+
const markerStartPos = markerJustification === "left" ? indentLeftPx : (typeof markerLayout?.markerX === "number" ? markerLayout.markerX : void 0) ?? indentLeftPx;
|
|
81054
|
+
const markerLeftPos = markerStartPos - markerBoxWidth;
|
|
81055
|
+
const lineContainer = doc2.createElement("div");
|
|
81056
|
+
lineContainer.style.position = "relative";
|
|
81057
|
+
lineContainer.style.width = "100%";
|
|
81058
|
+
const markerEl = doc2.createElement("span");
|
|
81059
|
+
markerEl.classList.add("superdoc-paragraph-marker");
|
|
81060
|
+
markerEl.textContent = markerLayout?.markerText ?? "";
|
|
81061
|
+
markerEl.style.display = "inline-block";
|
|
81062
|
+
markerEl.style.fontFamily = markerLayout?.run?.fontFamily ?? "";
|
|
81063
|
+
if (markerLayout?.run?.fontSize != null) {
|
|
81064
|
+
markerEl.style.fontSize = `${markerLayout.run.fontSize}px`;
|
|
81065
|
+
}
|
|
81066
|
+
markerEl.style.fontWeight = markerLayout?.run?.bold ? "bold" : "";
|
|
81067
|
+
markerEl.style.fontStyle = markerLayout?.run?.italic ? "italic" : "";
|
|
81068
|
+
if (markerLayout?.run?.color) {
|
|
81069
|
+
markerEl.style.color = markerLayout.run.color;
|
|
81070
|
+
}
|
|
81071
|
+
if (markerLayout?.run?.letterSpacing != null) {
|
|
81072
|
+
markerEl.style.letterSpacing = `${markerLayout.run.letterSpacing}px`;
|
|
81073
|
+
}
|
|
81074
|
+
markerEl.style.position = "absolute";
|
|
81075
|
+
markerEl.style.left = `${markerLeftPos}px`;
|
|
81076
|
+
markerEl.style.width = `${markerBoxWidth}px`;
|
|
81077
|
+
markerEl.style.textAlign = markerJustification;
|
|
81078
|
+
markerEl.style.paddingRight = `${gutter}px`;
|
|
81079
|
+
lineEl.style.paddingLeft = `${markerStartPos}px`;
|
|
81080
|
+
lineContainer.appendChild(markerEl);
|
|
81081
|
+
lineContainer.appendChild(lineEl);
|
|
81082
|
+
return lineContainer;
|
|
81083
|
+
}
|
|
80858
81084
|
const renderTableCell = (deps) => {
|
|
80859
81085
|
const {
|
|
80860
81086
|
doc: doc2,
|
|
@@ -80896,6 +81122,20 @@ ${l}
|
|
|
80896
81122
|
}
|
|
80897
81123
|
const cellBlocks = cell2?.blocks ?? (cell2?.paragraph ? [cell2.paragraph] : []);
|
|
80898
81124
|
const blockMeasures = cellMeasure?.blocks ?? (cellMeasure?.paragraph ? [cellMeasure.paragraph] : []);
|
|
81125
|
+
try {
|
|
81126
|
+
console.log(
|
|
81127
|
+
"[DomPainter.renderTableCell] cell render input",
|
|
81128
|
+
JSON.stringify({
|
|
81129
|
+
cellId: cell2?.id,
|
|
81130
|
+
blockKinds: cellBlocks.map((b2) => b2.kind),
|
|
81131
|
+
measureKinds: blockMeasures.map((m2) => m2.kind),
|
|
81132
|
+
width: cellMeasure?.width,
|
|
81133
|
+
height: cellMeasure?.height,
|
|
81134
|
+
rowHeight
|
|
81135
|
+
})
|
|
81136
|
+
);
|
|
81137
|
+
} catch {
|
|
81138
|
+
}
|
|
80899
81139
|
if (cellBlocks.length > 0 && blockMeasures.length > 0) {
|
|
80900
81140
|
const content2 = doc2.createElement("div");
|
|
80901
81141
|
content2.style.position = "relative";
|
|
@@ -80927,9 +81167,106 @@ ${l}
|
|
|
80927
81167
|
for (let i2 = 0; i2 < Math.min(blockMeasures.length, cellBlocks.length); i2++) {
|
|
80928
81168
|
const blockMeasure = blockMeasures[i2];
|
|
80929
81169
|
const block = cellBlocks[i2];
|
|
81170
|
+
if (blockMeasure.kind === "image" && block?.kind === "image") {
|
|
81171
|
+
console.log(
|
|
81172
|
+
"[DomPainter.renderTableCell] rendering image block in cell",
|
|
81173
|
+
JSON.stringify({
|
|
81174
|
+
cellId: cell2?.id,
|
|
81175
|
+
blockId: block.id,
|
|
81176
|
+
width: blockMeasure.width,
|
|
81177
|
+
height: blockMeasure.height
|
|
81178
|
+
})
|
|
81179
|
+
);
|
|
81180
|
+
const imageWrapper = doc2.createElement("div");
|
|
81181
|
+
imageWrapper.style.position = "relative";
|
|
81182
|
+
imageWrapper.style.width = `${blockMeasure.width}px`;
|
|
81183
|
+
imageWrapper.style.height = `${blockMeasure.height}px`;
|
|
81184
|
+
imageWrapper.style.maxWidth = "100%";
|
|
81185
|
+
imageWrapper.style.boxSizing = "border-box";
|
|
81186
|
+
applySdtDataset(imageWrapper, block.attrs?.sdt);
|
|
81187
|
+
const imgEl = doc2.createElement("img");
|
|
81188
|
+
imgEl.classList.add("superdoc-table-image");
|
|
81189
|
+
if (block.src) {
|
|
81190
|
+
imgEl.src = block.src;
|
|
81191
|
+
}
|
|
81192
|
+
imgEl.alt = block.alt ?? "";
|
|
81193
|
+
imgEl.style.width = "100%";
|
|
81194
|
+
imgEl.style.height = "100%";
|
|
81195
|
+
imgEl.style.objectFit = block.objectFit ?? "contain";
|
|
81196
|
+
imgEl.style.display = "block";
|
|
81197
|
+
imageWrapper.appendChild(imgEl);
|
|
81198
|
+
content2.appendChild(imageWrapper);
|
|
81199
|
+
continue;
|
|
81200
|
+
}
|
|
81201
|
+
if (blockMeasure.kind === "drawing" && block?.kind === "drawing") {
|
|
81202
|
+
console.log(
|
|
81203
|
+
"[DomPainter.renderTableCell] rendering drawing block in cell",
|
|
81204
|
+
JSON.stringify({
|
|
81205
|
+
cellId: cell2?.id,
|
|
81206
|
+
blockId: block.id,
|
|
81207
|
+
drawingKind: block.drawingKind,
|
|
81208
|
+
width: blockMeasure.width,
|
|
81209
|
+
height: blockMeasure.height
|
|
81210
|
+
})
|
|
81211
|
+
);
|
|
81212
|
+
const drawingWrapper = doc2.createElement("div");
|
|
81213
|
+
drawingWrapper.style.position = "relative";
|
|
81214
|
+
drawingWrapper.style.width = `${blockMeasure.width}px`;
|
|
81215
|
+
drawingWrapper.style.height = `${blockMeasure.height}px`;
|
|
81216
|
+
drawingWrapper.style.maxWidth = "100%";
|
|
81217
|
+
drawingWrapper.style.boxSizing = "border-box";
|
|
81218
|
+
applySdtDataset(drawingWrapper, block.attrs);
|
|
81219
|
+
const drawingInner = doc2.createElement("div");
|
|
81220
|
+
drawingInner.classList.add("superdoc-table-drawing");
|
|
81221
|
+
drawingInner.style.width = "100%";
|
|
81222
|
+
drawingInner.style.height = "100%";
|
|
81223
|
+
drawingInner.style.display = "flex";
|
|
81224
|
+
drawingInner.style.alignItems = "center";
|
|
81225
|
+
drawingInner.style.justifyContent = "center";
|
|
81226
|
+
drawingInner.style.overflow = "hidden";
|
|
81227
|
+
if (block.drawingKind === "image" && "src" in block && block.src) {
|
|
81228
|
+
const img2 = doc2.createElement("img");
|
|
81229
|
+
img2.classList.add("superdoc-drawing-image");
|
|
81230
|
+
img2.src = block.src;
|
|
81231
|
+
img2.alt = block.alt ?? "";
|
|
81232
|
+
img2.style.width = "100%";
|
|
81233
|
+
img2.style.height = "100%";
|
|
81234
|
+
img2.style.objectFit = block.objectFit ?? "contain";
|
|
81235
|
+
drawingInner.appendChild(img2);
|
|
81236
|
+
} else {
|
|
81237
|
+
const placeholder = doc2.createElement("div");
|
|
81238
|
+
placeholder.style.width = "100%";
|
|
81239
|
+
placeholder.style.height = "100%";
|
|
81240
|
+
placeholder.style.background = "repeating-linear-gradient(45deg, rgba(15,23,42,0.1), rgba(15,23,42,0.1) 6px, rgba(15,23,42,0.2) 6px, rgba(15,23,42,0.2) 12px)";
|
|
81241
|
+
placeholder.style.border = "1px dashed rgba(15, 23, 42, 0.3)";
|
|
81242
|
+
drawingInner.appendChild(placeholder);
|
|
81243
|
+
}
|
|
81244
|
+
drawingWrapper.appendChild(drawingInner);
|
|
81245
|
+
content2.appendChild(drawingWrapper);
|
|
81246
|
+
continue;
|
|
81247
|
+
}
|
|
80930
81248
|
if (blockMeasure.kind === "paragraph" && block?.kind === "paragraph") {
|
|
80931
|
-
|
|
81249
|
+
try {
|
|
81250
|
+
const runKinds = (block.runs ?? []).map((r2) => r2.kind ?? "text");
|
|
81251
|
+
const imageRuns = (block.runs ?? []).filter((r2) => r2.kind === "image").map((r2) => ({ src: r2.src }));
|
|
81252
|
+
console.log(
|
|
81253
|
+
"[DomPainter.renderTableCell] rendering paragraph block in cell",
|
|
81254
|
+
JSON.stringify({
|
|
81255
|
+
cellId: cell2?.id,
|
|
81256
|
+
blockId: block.id,
|
|
81257
|
+
runKinds,
|
|
81258
|
+
imageRuns
|
|
81259
|
+
})
|
|
81260
|
+
);
|
|
81261
|
+
} catch {
|
|
81262
|
+
}
|
|
81263
|
+
const paragraphMeasure = blockMeasure;
|
|
81264
|
+
const lines = paragraphMeasure.lines;
|
|
80932
81265
|
const blockLineCount = lines?.length || 0;
|
|
81266
|
+
const wordLayout = block.attrs?.wordLayout ?? null;
|
|
81267
|
+
const markerLayout = wordLayout?.marker;
|
|
81268
|
+
const markerMeasure = paragraphMeasure.marker;
|
|
81269
|
+
const indentLeftPx = markerMeasure?.indentLeft ?? wordLayout?.indentLeftPx ?? (block.attrs?.indent && typeof block.attrs.indent.left === "number" ? block.attrs.indent.left : 0);
|
|
80933
81270
|
const blockStartGlobal = cumulativeLineCount;
|
|
80934
81271
|
const blockEndGlobal = cumulativeLineCount + blockLineCount;
|
|
80935
81272
|
if (blockEndGlobal <= globalFromLine) {
|
|
@@ -80951,7 +81288,38 @@ ${l}
|
|
|
80951
81288
|
for (let lineIdx = localStartLine; lineIdx < localEndLine && lineIdx < lines.length; lineIdx++) {
|
|
80952
81289
|
const line = lines[lineIdx];
|
|
80953
81290
|
const lineEl = renderLine(block, line, { ...context, section: "body" });
|
|
80954
|
-
|
|
81291
|
+
lineEl.style.paddingLeft = "";
|
|
81292
|
+
lineEl.style.paddingRight = "";
|
|
81293
|
+
lineEl.style.textIndent = "";
|
|
81294
|
+
const shouldRenderMarker = markerLayout && markerMeasure && lineIdx === 0 && localStartLine === 0 && markerMeasure.markerWidth > 0;
|
|
81295
|
+
if (shouldRenderMarker) {
|
|
81296
|
+
const lineContainer = renderListMarker({
|
|
81297
|
+
doc: doc2,
|
|
81298
|
+
lineEl,
|
|
81299
|
+
markerLayout,
|
|
81300
|
+
markerMeasure,
|
|
81301
|
+
indentLeftPx
|
|
81302
|
+
});
|
|
81303
|
+
paraWrapper.appendChild(lineContainer);
|
|
81304
|
+
} else {
|
|
81305
|
+
if (markerLayout && indentLeftPx) {
|
|
81306
|
+
lineEl.style.paddingLeft = `${indentLeftPx}px`;
|
|
81307
|
+
} else {
|
|
81308
|
+
const indent2 = block.attrs?.indent;
|
|
81309
|
+
if (indent2) {
|
|
81310
|
+
if (typeof indent2.left === "number" && indent2.left > 0) {
|
|
81311
|
+
lineEl.style.paddingLeft = `${indent2.left}px`;
|
|
81312
|
+
}
|
|
81313
|
+
if (typeof indent2.right === "number" && indent2.right > 0) {
|
|
81314
|
+
lineEl.style.paddingRight = `${indent2.right}px`;
|
|
81315
|
+
}
|
|
81316
|
+
if (lineIdx === 0 && typeof indent2.firstLine === "number" && indent2.firstLine !== 0) {
|
|
81317
|
+
lineEl.style.textIndent = `${indent2.firstLine}px`;
|
|
81318
|
+
}
|
|
81319
|
+
}
|
|
81320
|
+
}
|
|
81321
|
+
paraWrapper.appendChild(lineEl);
|
|
81322
|
+
}
|
|
80955
81323
|
renderedHeight += line.lineHeight;
|
|
80956
81324
|
}
|
|
80957
81325
|
const renderedEntireBlock = localStartLine === 0 && localEndLine >= blockLineCount;
|
|
@@ -150906,7 +151274,7 @@ ${style2}
|
|
|
150906
151274
|
this.config.colors = shuffleArray(this.config.colors);
|
|
150907
151275
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
150908
151276
|
this.colorIndex = 0;
|
|
150909
|
-
this.version = "1.0.0-beta.
|
|
151277
|
+
this.version = "1.0.0-beta.83";
|
|
150910
151278
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
150911
151279
|
this.superdocId = config2.superdocId || v4();
|
|
150912
151280
|
this.colors = this.config.colors;
|
|
@@ -153378,7 +153746,7 @@ ${style2}
|
|
|
153378
153746
|
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
|
153379
153747
|
);
|
|
153380
153748
|
}
|
|
153381
|
-
const
|
|
153749
|
+
const indexYXzWgyNJ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
153382
153750
|
__proto__: null,
|
|
153383
153751
|
unified
|
|
153384
153752
|
}, Symbol.toStringTag, { value: "Module" }));
|