@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
|
@@ -42374,7 +42374,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
42374
42374
|
static getStoredSuperdocVersion(docx) {
|
|
42375
42375
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42376
42376
|
}
|
|
42377
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
42377
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.83") {
|
|
42378
42378
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
42379
42379
|
}
|
|
42380
42380
|
/**
|
|
@@ -59563,7 +59563,7 @@ const isHeadless = (editor) => {
|
|
|
59563
59563
|
const shouldSkipNodeView = (editor) => {
|
|
59564
59564
|
return isHeadless(editor);
|
|
59565
59565
|
};
|
|
59566
|
-
const summaryVersion = "1.0.0-beta.
|
|
59566
|
+
const summaryVersion = "1.0.0-beta.83";
|
|
59567
59567
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
59568
59568
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
59569
59569
|
function mapAttributes(attrs) {
|
|
@@ -60352,7 +60352,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60352
60352
|
{ default: remarkStringify },
|
|
60353
60353
|
{ default: remarkGfm }
|
|
60354
60354
|
] = await Promise.all([
|
|
60355
|
-
import("./index-
|
|
60355
|
+
import("./index-YXzWgyNJ-Tc_oVxxj.es.js"),
|
|
60356
60356
|
import("./index-DRCvimau-Cw339678.es.js"),
|
|
60357
60357
|
import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
|
|
60358
60358
|
import("./index-D_sWOSiG-DE96TaT5.es.js"),
|
|
@@ -60557,7 +60557,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60557
60557
|
* Process collaboration migrations
|
|
60558
60558
|
*/
|
|
60559
60559
|
processCollaborationMigrations() {
|
|
60560
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
60560
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.83");
|
|
60561
60561
|
if (!this.options.ydoc) return;
|
|
60562
60562
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
60563
60563
|
let docVersion = metaMap.get("version");
|
|
@@ -63601,32 +63601,76 @@ function hydrateImageBlocks(blocks, mediaFiles) {
|
|
|
63601
63601
|
return hasChanges ? hydratedRuns : runs;
|
|
63602
63602
|
};
|
|
63603
63603
|
return blocks.map((block) => {
|
|
63604
|
-
|
|
63605
|
-
if (
|
|
63606
|
-
|
|
63607
|
-
|
|
63608
|
-
|
|
63609
|
-
|
|
63610
|
-
|
|
63611
|
-
|
|
63612
|
-
|
|
63613
|
-
|
|
63614
|
-
|
|
63615
|
-
|
|
63616
|
-
|
|
63617
|
-
|
|
63618
|
-
|
|
63619
|
-
|
|
63620
|
-
|
|
63621
|
-
|
|
63622
|
-
|
|
63623
|
-
|
|
63624
|
-
|
|
63625
|
-
|
|
63604
|
+
const hydrateBlock = (blk) => {
|
|
63605
|
+
if (blk.kind === "image") {
|
|
63606
|
+
if (!blk.src || blk.src.startsWith("data:")) {
|
|
63607
|
+
return blk;
|
|
63608
|
+
}
|
|
63609
|
+
const attrs = blk.attrs ?? {};
|
|
63610
|
+
const relId = typeof attrs.rId === "string" ? attrs.rId : void 0;
|
|
63611
|
+
const attrSrc = typeof attrs.src === "string" ? attrs.src : void 0;
|
|
63612
|
+
const extension = typeof attrs.extension === "string" ? attrs.extension.toLowerCase() : void 0;
|
|
63613
|
+
const resolvedSrc = resolveImageSrc(blk.src, relId, attrSrc, extension);
|
|
63614
|
+
if (resolvedSrc) {
|
|
63615
|
+
return { ...blk, src: resolvedSrc };
|
|
63616
|
+
}
|
|
63617
|
+
return blk;
|
|
63618
|
+
}
|
|
63619
|
+
if (blk.kind === "paragraph") {
|
|
63620
|
+
const paragraphBlock = blk;
|
|
63621
|
+
if (!paragraphBlock.runs || paragraphBlock.runs.length === 0) {
|
|
63622
|
+
return blk;
|
|
63623
|
+
}
|
|
63624
|
+
const hydratedRuns = hydrateRuns(paragraphBlock.runs);
|
|
63625
|
+
if (hydratedRuns !== paragraphBlock.runs) {
|
|
63626
|
+
return { ...paragraphBlock, runs: hydratedRuns };
|
|
63627
|
+
}
|
|
63628
|
+
return blk;
|
|
63629
|
+
}
|
|
63630
|
+
if (blk.kind === "table") {
|
|
63631
|
+
let rowsChanged = false;
|
|
63632
|
+
const newRows = blk.rows.map((row) => {
|
|
63633
|
+
let cellsChanged = false;
|
|
63634
|
+
const newCells = row.cells.map((cell) => {
|
|
63635
|
+
let cellChanged = false;
|
|
63636
|
+
const hydratedBlocks = (cell.blocks ?? (cell.paragraph ? [cell.paragraph] : [])).map((cb) => hydrateBlock(cb));
|
|
63637
|
+
if (cell.blocks && hydratedBlocks !== cell.blocks) {
|
|
63638
|
+
cellChanged = true;
|
|
63639
|
+
}
|
|
63640
|
+
let hydratedParagraph = cell.paragraph;
|
|
63641
|
+
if (!cell.blocks && cell.paragraph && cell.paragraph.kind === "paragraph") {
|
|
63642
|
+
const hydratedPara = hydrateBlock(cell.paragraph);
|
|
63643
|
+
if (hydratedPara !== cell.paragraph) {
|
|
63644
|
+
hydratedParagraph = hydratedPara;
|
|
63645
|
+
cellChanged = true;
|
|
63646
|
+
}
|
|
63647
|
+
}
|
|
63648
|
+
if (cellChanged) {
|
|
63649
|
+
return {
|
|
63650
|
+
...cell,
|
|
63651
|
+
blocks: hydratedBlocks.length > 0 ? hydratedBlocks : cell.blocks,
|
|
63652
|
+
paragraph: hydratedParagraph
|
|
63653
|
+
};
|
|
63654
|
+
}
|
|
63655
|
+
return cell;
|
|
63656
|
+
});
|
|
63657
|
+
if (newCells.some((c2, idx) => c2 !== row.cells[idx])) {
|
|
63658
|
+
cellsChanged = true;
|
|
63659
|
+
}
|
|
63660
|
+
if (cellsChanged) {
|
|
63661
|
+
rowsChanged = true;
|
|
63662
|
+
return { ...row, cells: newCells };
|
|
63663
|
+
}
|
|
63664
|
+
return row;
|
|
63665
|
+
});
|
|
63666
|
+
if (rowsChanged) {
|
|
63667
|
+
return { ...blk, rows: newRows };
|
|
63668
|
+
}
|
|
63669
|
+
return blk;
|
|
63626
63670
|
}
|
|
63627
|
-
return
|
|
63628
|
-
}
|
|
63629
|
-
return block;
|
|
63671
|
+
return blk;
|
|
63672
|
+
};
|
|
63673
|
+
return hydrateBlock(block);
|
|
63630
63674
|
});
|
|
63631
63675
|
}
|
|
63632
63676
|
function isGradientFill(value) {
|
|
@@ -65341,7 +65385,7 @@ function buildSdtCacheKey(nodeType, attrs, explicitKey) {
|
|
|
65341
65385
|
return void 0;
|
|
65342
65386
|
}
|
|
65343
65387
|
const DEFAULT_LIST_HANGING_PX$1 = 18;
|
|
65344
|
-
const LIST_MARKER_GAP$
|
|
65388
|
+
const LIST_MARKER_GAP$3 = 8;
|
|
65345
65389
|
const DEFAULT_BULLET_GLYPH = "•";
|
|
65346
65390
|
const DEFAULT_DECIMAL_PATTERN = "%1.";
|
|
65347
65391
|
const ASCII_UPPERCASE_A = 65;
|
|
@@ -65752,7 +65796,7 @@ function computeWordParagraphLayout(input) {
|
|
|
65752
65796
|
let markerBoxWidthPx;
|
|
65753
65797
|
let markerX;
|
|
65754
65798
|
if (hasFirstLineIndent) {
|
|
65755
|
-
markerBoxWidthPx = glyphWidthPx != null && glyphWidthPx > 0 ? glyphWidthPx + LIST_MARKER_GAP$
|
|
65799
|
+
markerBoxWidthPx = glyphWidthPx != null && glyphWidthPx > 0 ? glyphWidthPx + LIST_MARKER_GAP$3 : DEFAULT_LIST_HANGING_PX$1;
|
|
65756
65800
|
markerX = indentLeftPx + (firstLinePx ?? 0);
|
|
65757
65801
|
layout.textStartPx = markerX + markerBoxWidthPx;
|
|
65758
65802
|
layout.hangingPx = 0;
|
|
@@ -65852,12 +65896,12 @@ const resolveMarkerBoxWidth = (hangingPxRaw, glyphWidthPx) => {
|
|
|
65852
65896
|
let markerBox = Math.max(hangingPxRaw || 0, 0);
|
|
65853
65897
|
if (markerBox <= 0) {
|
|
65854
65898
|
if (glyphWidthPx != null && glyphWidthPx > 0) {
|
|
65855
|
-
markerBox = glyphWidthPx + LIST_MARKER_GAP$
|
|
65899
|
+
markerBox = glyphWidthPx + LIST_MARKER_GAP$3;
|
|
65856
65900
|
} else {
|
|
65857
65901
|
markerBox = DEFAULT_LIST_HANGING_PX$1;
|
|
65858
65902
|
}
|
|
65859
|
-
} else if (glyphWidthPx != null && glyphWidthPx + LIST_MARKER_GAP$
|
|
65860
|
-
markerBox = glyphWidthPx + LIST_MARKER_GAP$
|
|
65903
|
+
} else if (glyphWidthPx != null && glyphWidthPx + LIST_MARKER_GAP$3 > markerBox) {
|
|
65904
|
+
markerBox = glyphWidthPx + LIST_MARKER_GAP$3;
|
|
65861
65905
|
}
|
|
65862
65906
|
return markerBox;
|
|
65863
65907
|
};
|
|
@@ -67143,14 +67187,29 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
|
|
|
67143
67187
|
paragraphAttrs.frame = frame;
|
|
67144
67188
|
}
|
|
67145
67189
|
}
|
|
67190
|
+
const listRendering = normalizeListRenderingAttrs(attrs.listRendering);
|
|
67146
67191
|
const numberingSource = attrs.numberingProperties ?? paragraphProps.numberingProperties ?? hydrated?.numberingProperties;
|
|
67147
|
-
|
|
67192
|
+
let rawNumberingProps = toAdapterNumberingProps(numberingSource);
|
|
67193
|
+
if (!rawNumberingProps && listRendering) {
|
|
67194
|
+
const path = listRendering.path;
|
|
67195
|
+
const counterFromPath = path && path.length ? path[path.length - 1] : void 0;
|
|
67196
|
+
const ilvl = path && path.length > 1 ? path.length - 1 : 0;
|
|
67197
|
+
rawNumberingProps = {
|
|
67198
|
+
numId: -1,
|
|
67199
|
+
ilvl,
|
|
67200
|
+
path,
|
|
67201
|
+
counterValue: Number.isFinite(counterFromPath) ? Number(counterFromPath) : void 0,
|
|
67202
|
+
markerText: listRendering.markerText,
|
|
67203
|
+
format: listRendering.numberingType,
|
|
67204
|
+
lvlJc: listRendering.justification,
|
|
67205
|
+
suffix: listRendering.suffix
|
|
67206
|
+
};
|
|
67207
|
+
}
|
|
67148
67208
|
const hasValidNumbering = rawNumberingProps && isValidNumberingId(rawNumberingProps.numId);
|
|
67149
67209
|
if (hasValidNumbering) {
|
|
67150
67210
|
const numberingProps = rawNumberingProps;
|
|
67151
67211
|
const numId = numberingProps.numId;
|
|
67152
67212
|
const ilvl = Number.isFinite(numberingProps.ilvl) ? Math.max(0, Math.floor(Number(numberingProps.ilvl))) : 0;
|
|
67153
|
-
const listRendering = normalizeListRenderingAttrs(attrs.listRendering);
|
|
67154
67213
|
const numericNumId = typeof numId === "number" ? numId : void 0;
|
|
67155
67214
|
const resolvedLevel = resolveNumberingFromContext(numId, ilvl, converterContext?.numbering);
|
|
67156
67215
|
if (resolvedLevel) {
|
|
@@ -69201,29 +69260,129 @@ const parseTableCell = (args) => {
|
|
|
69201
69260
|
...context.converterContext,
|
|
69202
69261
|
tableStyleParagraphProps
|
|
69203
69262
|
} : context.converterContext;
|
|
69263
|
+
const paragraphToFlowBlocks2 = context.converters?.paragraphToFlowBlocks ?? context.paragraphToFlowBlocks;
|
|
69264
|
+
const listCounterContext = context.listCounterContext;
|
|
69204
69265
|
for (const childNode of cellNode.content) {
|
|
69205
69266
|
if (childNode.type === "paragraph") {
|
|
69206
|
-
|
|
69267
|
+
if (!paragraphToFlowBlocks2) continue;
|
|
69268
|
+
const paragraphBlocks = paragraphToFlowBlocks2(
|
|
69207
69269
|
childNode,
|
|
69208
69270
|
context.nextBlockId,
|
|
69209
69271
|
context.positions,
|
|
69210
69272
|
context.defaultFont,
|
|
69211
69273
|
context.defaultSize,
|
|
69212
69274
|
context.styleContext,
|
|
69213
|
-
|
|
69214
|
-
// listCounterContext
|
|
69275
|
+
listCounterContext,
|
|
69215
69276
|
context.trackedChanges,
|
|
69216
69277
|
context.bookmarks,
|
|
69217
69278
|
context.hyperlinkConfig,
|
|
69218
69279
|
context.themeColors,
|
|
69219
69280
|
cellConverterContext
|
|
69220
|
-
// converterContext at position 12
|
|
69221
69281
|
);
|
|
69222
|
-
|
|
69223
|
-
|
|
69224
|
-
|
|
69282
|
+
paragraphBlocks.forEach((block) => {
|
|
69283
|
+
if (block.kind === "paragraph" || block.kind === "image" || block.kind === "drawing") {
|
|
69284
|
+
blocks.push(block);
|
|
69285
|
+
}
|
|
69286
|
+
});
|
|
69287
|
+
continue;
|
|
69288
|
+
}
|
|
69289
|
+
if (childNode.type === "image" && context.converters?.imageNodeToBlock) {
|
|
69290
|
+
const mergedMarks = [...childNode.marks ?? []];
|
|
69291
|
+
const trackedMeta = context.trackedChanges ? collectTrackedChangeFromMarks(mergedMarks) : void 0;
|
|
69292
|
+
if (shouldHideTrackedNode(trackedMeta, context.trackedChanges)) {
|
|
69293
|
+
continue;
|
|
69294
|
+
}
|
|
69295
|
+
const imageBlock = context.converters.imageNodeToBlock(
|
|
69296
|
+
childNode,
|
|
69297
|
+
context.nextBlockId,
|
|
69298
|
+
context.positions,
|
|
69299
|
+
trackedMeta,
|
|
69300
|
+
context.trackedChanges
|
|
69301
|
+
);
|
|
69302
|
+
if (imageBlock && imageBlock.kind === "image") {
|
|
69303
|
+
annotateBlockWithTrackedChange(imageBlock, trackedMeta, context.trackedChanges);
|
|
69304
|
+
blocks.push(imageBlock);
|
|
69305
|
+
}
|
|
69306
|
+
continue;
|
|
69307
|
+
}
|
|
69308
|
+
if (childNode.type === "vectorShape" && context.converters?.vectorShapeNodeToDrawingBlock) {
|
|
69309
|
+
const drawingBlock = context.converters.vectorShapeNodeToDrawingBlock(
|
|
69310
|
+
childNode,
|
|
69311
|
+
context.nextBlockId,
|
|
69312
|
+
context.positions
|
|
69313
|
+
);
|
|
69314
|
+
if (drawingBlock) {
|
|
69315
|
+
blocks.push(drawingBlock);
|
|
69225
69316
|
}
|
|
69317
|
+
continue;
|
|
69226
69318
|
}
|
|
69319
|
+
if (childNode.type === "shapeGroup" && context.converters?.shapeGroupNodeToDrawingBlock) {
|
|
69320
|
+
const drawingBlock = context.converters.shapeGroupNodeToDrawingBlock(
|
|
69321
|
+
childNode,
|
|
69322
|
+
context.nextBlockId,
|
|
69323
|
+
context.positions
|
|
69324
|
+
);
|
|
69325
|
+
if (drawingBlock) {
|
|
69326
|
+
blocks.push(drawingBlock);
|
|
69327
|
+
}
|
|
69328
|
+
continue;
|
|
69329
|
+
}
|
|
69330
|
+
if (childNode.type === "shapeContainer" && context.converters?.shapeContainerNodeToDrawingBlock) {
|
|
69331
|
+
const drawingBlock = context.converters.shapeContainerNodeToDrawingBlock(
|
|
69332
|
+
childNode,
|
|
69333
|
+
context.nextBlockId,
|
|
69334
|
+
context.positions
|
|
69335
|
+
);
|
|
69336
|
+
if (drawingBlock) {
|
|
69337
|
+
blocks.push(drawingBlock);
|
|
69338
|
+
}
|
|
69339
|
+
continue;
|
|
69340
|
+
}
|
|
69341
|
+
if (childNode.type === "shapeTextbox" && context.converters?.shapeTextboxNodeToDrawingBlock) {
|
|
69342
|
+
const drawingBlock = context.converters.shapeTextboxNodeToDrawingBlock(
|
|
69343
|
+
childNode,
|
|
69344
|
+
context.nextBlockId,
|
|
69345
|
+
context.positions
|
|
69346
|
+
);
|
|
69347
|
+
if (drawingBlock) {
|
|
69348
|
+
blocks.push(drawingBlock);
|
|
69349
|
+
}
|
|
69350
|
+
}
|
|
69351
|
+
}
|
|
69352
|
+
try {
|
|
69353
|
+
const blockSummaries = blocks.map((b2) => {
|
|
69354
|
+
if (b2.kind === "paragraph") {
|
|
69355
|
+
const runs = b2.runs ?? [];
|
|
69356
|
+
const attrs = b2.attrs ?? {};
|
|
69357
|
+
return {
|
|
69358
|
+
kind: "paragraph",
|
|
69359
|
+
runKinds: runs.map((r2) => r2.kind ?? "text"),
|
|
69360
|
+
runCount: runs.length,
|
|
69361
|
+
runPreview: runs.map((r2) => {
|
|
69362
|
+
const kind = r2.kind ?? "text";
|
|
69363
|
+
if (kind === "image") {
|
|
69364
|
+
const img = r2;
|
|
69365
|
+
return { kind, src: img.src, width: img.width, height: img.height };
|
|
69366
|
+
}
|
|
69367
|
+
return { kind };
|
|
69368
|
+
}),
|
|
69369
|
+
hasNumbering: Boolean(attrs.numberingProperties),
|
|
69370
|
+
markerText: attrs.wordLayout?.marker?.markerText
|
|
69371
|
+
};
|
|
69372
|
+
}
|
|
69373
|
+
return { kind: b2.kind };
|
|
69374
|
+
});
|
|
69375
|
+
console.log(
|
|
69376
|
+
"[tableNodeToBlock.parseTableCell] cell contents",
|
|
69377
|
+
JSON.stringify({
|
|
69378
|
+
cellIndex,
|
|
69379
|
+
rowIndex,
|
|
69380
|
+
cellIdPreview: `cell-${rowIndex}-${cellIndex}`,
|
|
69381
|
+
childTypes: cellNode.content.map((c2) => c2?.type),
|
|
69382
|
+
blocks: blockSummaries
|
|
69383
|
+
})
|
|
69384
|
+
);
|
|
69385
|
+
} catch {
|
|
69227
69386
|
}
|
|
69228
69387
|
if (blocks.length === 0) {
|
|
69229
69388
|
return null;
|
|
@@ -69363,9 +69522,10 @@ function extractFloatingTableAnchorWrap(node) {
|
|
|
69363
69522
|
}
|
|
69364
69523
|
return { anchor, wrap: wrap2 };
|
|
69365
69524
|
}
|
|
69366
|
-
function tableNodeToBlock$1(node, nextBlockId, positions, defaultFont, defaultSize, _styleContext, trackedChanges, bookmarks, hyperlinkConfig, themeColors, paragraphToFlowBlocks2, converterContext) {
|
|
69525
|
+
function tableNodeToBlock$1(node, nextBlockId, positions, defaultFont, defaultSize, _styleContext, trackedChanges, bookmarks, hyperlinkConfig, themeColors, paragraphToFlowBlocks2, converterContext, options) {
|
|
69367
69526
|
if (!Array.isArray(node.content) || node.content.length === 0) return null;
|
|
69368
|
-
|
|
69527
|
+
const paragraphConverter = paragraphToFlowBlocks2 ?? options?.converters?.paragraphToFlowBlocks;
|
|
69528
|
+
if (!paragraphConverter) return null;
|
|
69369
69529
|
const parserDeps = {
|
|
69370
69530
|
nextBlockId,
|
|
69371
69531
|
positions,
|
|
@@ -69376,8 +69536,10 @@ function tableNodeToBlock$1(node, nextBlockId, positions, defaultFont, defaultSi
|
|
|
69376
69536
|
bookmarks,
|
|
69377
69537
|
hyperlinkConfig,
|
|
69378
69538
|
themeColors,
|
|
69379
|
-
|
|
69380
|
-
|
|
69539
|
+
listCounterContext: options?.listCounterContext,
|
|
69540
|
+
paragraphToFlowBlocks: paragraphConverter,
|
|
69541
|
+
converterContext,
|
|
69542
|
+
converters: options?.converters
|
|
69381
69543
|
};
|
|
69382
69544
|
const hydratedTableStyle = hydrateTableStyleAttrs(node, converterContext);
|
|
69383
69545
|
const defaultCellPadding = hydratedTableStyle?.cellPadding;
|
|
@@ -69497,6 +69659,7 @@ function handleTableNode(node, context) {
|
|
|
69497
69659
|
defaultFont,
|
|
69498
69660
|
defaultSize,
|
|
69499
69661
|
styleContext,
|
|
69662
|
+
listCounterContext,
|
|
69500
69663
|
trackedChangesConfig,
|
|
69501
69664
|
bookmarks,
|
|
69502
69665
|
hyperlinkConfig,
|
|
@@ -69516,7 +69679,8 @@ function handleTableNode(node, context) {
|
|
|
69516
69679
|
void 0,
|
|
69517
69680
|
// themeColors
|
|
69518
69681
|
converters?.paragraphToFlowBlocks,
|
|
69519
|
-
converterContext
|
|
69682
|
+
converterContext,
|
|
69683
|
+
{ listCounterContext, converters }
|
|
69520
69684
|
);
|
|
69521
69685
|
if (tableBlock) {
|
|
69522
69686
|
blocks.push(tableBlock);
|
|
@@ -69670,7 +69834,7 @@ function toFlowBlocks(pmDoc, options) {
|
|
|
69670
69834
|
bookmarks2,
|
|
69671
69835
|
hyperlinkConfig2,
|
|
69672
69836
|
themeColorsParam ?? themeColors,
|
|
69673
|
-
|
|
69837
|
+
paragraphConverter
|
|
69674
69838
|
);
|
|
69675
69839
|
const handlerContext = {
|
|
69676
69840
|
blocks,
|
|
@@ -69693,7 +69857,11 @@ function toFlowBlocks(pmDoc, options) {
|
|
|
69693
69857
|
converters: {
|
|
69694
69858
|
paragraphToFlowBlocks: paragraphConverter,
|
|
69695
69859
|
tableNodeToBlock: tableConverter,
|
|
69696
|
-
imageNodeToBlock
|
|
69860
|
+
imageNodeToBlock,
|
|
69861
|
+
vectorShapeNodeToDrawingBlock,
|
|
69862
|
+
shapeGroupNodeToDrawingBlock,
|
|
69863
|
+
shapeContainerNodeToDrawingBlock,
|
|
69864
|
+
shapeTextboxNodeToDrawingBlock
|
|
69697
69865
|
}
|
|
69698
69866
|
};
|
|
69699
69867
|
doc2.content.forEach((node) => {
|
|
@@ -69778,7 +69946,18 @@ function paragraphToFlowBlocks(para, nextBlockId, positions, defaultFont, defaul
|
|
|
69778
69946
|
hyperlinkConfig2,
|
|
69779
69947
|
themeColors2,
|
|
69780
69948
|
paragraphToFlowBlocks,
|
|
69781
|
-
converterCtx ?? converterContext
|
|
69949
|
+
converterCtx ?? converterContext,
|
|
69950
|
+
{
|
|
69951
|
+
listCounterContext,
|
|
69952
|
+
converters: {
|
|
69953
|
+
paragraphToFlowBlocks: paragraphToFlowBlocks$1,
|
|
69954
|
+
imageNodeToBlock,
|
|
69955
|
+
vectorShapeNodeToDrawingBlock,
|
|
69956
|
+
shapeGroupNodeToDrawingBlock,
|
|
69957
|
+
shapeContainerNodeToDrawingBlock,
|
|
69958
|
+
shapeTextboxNodeToDrawingBlock
|
|
69959
|
+
}
|
|
69960
|
+
}
|
|
69782
69961
|
)
|
|
69783
69962
|
},
|
|
69784
69963
|
converterContext
|
|
@@ -69797,7 +69976,17 @@ function tableNodeToBlock(node, nextBlockId, positions, defaultFont, defaultSize
|
|
|
69797
69976
|
hyperlinkConfig,
|
|
69798
69977
|
themeColors,
|
|
69799
69978
|
paragraphToFlowBlocks,
|
|
69800
|
-
converterContext
|
|
69979
|
+
converterContext,
|
|
69980
|
+
{
|
|
69981
|
+
converters: {
|
|
69982
|
+
paragraphToFlowBlocks: paragraphToFlowBlocks$1,
|
|
69983
|
+
imageNodeToBlock,
|
|
69984
|
+
vectorShapeNodeToDrawingBlock,
|
|
69985
|
+
shapeGroupNodeToDrawingBlock,
|
|
69986
|
+
shapeContainerNodeToDrawingBlock,
|
|
69987
|
+
shapeTextboxNodeToDrawingBlock
|
|
69988
|
+
}
|
|
69989
|
+
}
|
|
69801
69990
|
);
|
|
69802
69991
|
}
|
|
69803
69992
|
let measurementCanvas = null;
|
|
@@ -72980,6 +73169,43 @@ const resolveTableCellBorders = (tableBorders, rowIndex, colIndex, totalRows, to
|
|
|
72980
73169
|
right: borderValueToSpec(isLastCol ? tableBorders?.right : null)
|
|
72981
73170
|
};
|
|
72982
73171
|
};
|
|
73172
|
+
const LIST_MARKER_GAP$2 = 8;
|
|
73173
|
+
function renderListMarker(params2) {
|
|
73174
|
+
const { doc: doc2, lineEl, markerLayout, markerMeasure, indentLeftPx } = params2;
|
|
73175
|
+
const markerJustification = markerLayout?.justification ?? "left";
|
|
73176
|
+
const markerBoxWidth = (typeof markerLayout?.markerBoxWidthPx === "number" ? markerLayout.markerBoxWidthPx : void 0) ?? markerMeasure?.markerWidth ?? 0;
|
|
73177
|
+
const gutter = (typeof markerLayout?.gutterWidthPx === "number" ? markerLayout.gutterWidthPx : void 0) ?? markerMeasure?.gutterWidth ?? LIST_MARKER_GAP$2;
|
|
73178
|
+
const markerStartPos = markerJustification === "left" ? indentLeftPx : (typeof markerLayout?.markerX === "number" ? markerLayout.markerX : void 0) ?? indentLeftPx;
|
|
73179
|
+
const markerLeftPos = markerStartPos - markerBoxWidth;
|
|
73180
|
+
const lineContainer = doc2.createElement("div");
|
|
73181
|
+
lineContainer.style.position = "relative";
|
|
73182
|
+
lineContainer.style.width = "100%";
|
|
73183
|
+
const markerEl = doc2.createElement("span");
|
|
73184
|
+
markerEl.classList.add("superdoc-paragraph-marker");
|
|
73185
|
+
markerEl.textContent = markerLayout?.markerText ?? "";
|
|
73186
|
+
markerEl.style.display = "inline-block";
|
|
73187
|
+
markerEl.style.fontFamily = markerLayout?.run?.fontFamily ?? "";
|
|
73188
|
+
if (markerLayout?.run?.fontSize != null) {
|
|
73189
|
+
markerEl.style.fontSize = `${markerLayout.run.fontSize}px`;
|
|
73190
|
+
}
|
|
73191
|
+
markerEl.style.fontWeight = markerLayout?.run?.bold ? "bold" : "";
|
|
73192
|
+
markerEl.style.fontStyle = markerLayout?.run?.italic ? "italic" : "";
|
|
73193
|
+
if (markerLayout?.run?.color) {
|
|
73194
|
+
markerEl.style.color = markerLayout.run.color;
|
|
73195
|
+
}
|
|
73196
|
+
if (markerLayout?.run?.letterSpacing != null) {
|
|
73197
|
+
markerEl.style.letterSpacing = `${markerLayout.run.letterSpacing}px`;
|
|
73198
|
+
}
|
|
73199
|
+
markerEl.style.position = "absolute";
|
|
73200
|
+
markerEl.style.left = `${markerLeftPos}px`;
|
|
73201
|
+
markerEl.style.width = `${markerBoxWidth}px`;
|
|
73202
|
+
markerEl.style.textAlign = markerJustification;
|
|
73203
|
+
markerEl.style.paddingRight = `${gutter}px`;
|
|
73204
|
+
lineEl.style.paddingLeft = `${markerStartPos}px`;
|
|
73205
|
+
lineContainer.appendChild(markerEl);
|
|
73206
|
+
lineContainer.appendChild(lineEl);
|
|
73207
|
+
return lineContainer;
|
|
73208
|
+
}
|
|
72983
73209
|
const renderTableCell = (deps) => {
|
|
72984
73210
|
const {
|
|
72985
73211
|
doc: doc2,
|
|
@@ -73021,6 +73247,20 @@ const renderTableCell = (deps) => {
|
|
|
73021
73247
|
}
|
|
73022
73248
|
const cellBlocks = cell?.blocks ?? (cell?.paragraph ? [cell.paragraph] : []);
|
|
73023
73249
|
const blockMeasures = cellMeasure?.blocks ?? (cellMeasure?.paragraph ? [cellMeasure.paragraph] : []);
|
|
73250
|
+
try {
|
|
73251
|
+
console.log(
|
|
73252
|
+
"[DomPainter.renderTableCell] cell render input",
|
|
73253
|
+
JSON.stringify({
|
|
73254
|
+
cellId: cell?.id,
|
|
73255
|
+
blockKinds: cellBlocks.map((b2) => b2.kind),
|
|
73256
|
+
measureKinds: blockMeasures.map((m2) => m2.kind),
|
|
73257
|
+
width: cellMeasure?.width,
|
|
73258
|
+
height: cellMeasure?.height,
|
|
73259
|
+
rowHeight
|
|
73260
|
+
})
|
|
73261
|
+
);
|
|
73262
|
+
} catch {
|
|
73263
|
+
}
|
|
73024
73264
|
if (cellBlocks.length > 0 && blockMeasures.length > 0) {
|
|
73025
73265
|
const content = doc2.createElement("div");
|
|
73026
73266
|
content.style.position = "relative";
|
|
@@ -73052,9 +73292,106 @@ const renderTableCell = (deps) => {
|
|
|
73052
73292
|
for (let i = 0; i < Math.min(blockMeasures.length, cellBlocks.length); i++) {
|
|
73053
73293
|
const blockMeasure = blockMeasures[i];
|
|
73054
73294
|
const block = cellBlocks[i];
|
|
73295
|
+
if (blockMeasure.kind === "image" && block?.kind === "image") {
|
|
73296
|
+
console.log(
|
|
73297
|
+
"[DomPainter.renderTableCell] rendering image block in cell",
|
|
73298
|
+
JSON.stringify({
|
|
73299
|
+
cellId: cell?.id,
|
|
73300
|
+
blockId: block.id,
|
|
73301
|
+
width: blockMeasure.width,
|
|
73302
|
+
height: blockMeasure.height
|
|
73303
|
+
})
|
|
73304
|
+
);
|
|
73305
|
+
const imageWrapper = doc2.createElement("div");
|
|
73306
|
+
imageWrapper.style.position = "relative";
|
|
73307
|
+
imageWrapper.style.width = `${blockMeasure.width}px`;
|
|
73308
|
+
imageWrapper.style.height = `${blockMeasure.height}px`;
|
|
73309
|
+
imageWrapper.style.maxWidth = "100%";
|
|
73310
|
+
imageWrapper.style.boxSizing = "border-box";
|
|
73311
|
+
applySdtDataset(imageWrapper, block.attrs?.sdt);
|
|
73312
|
+
const imgEl = doc2.createElement("img");
|
|
73313
|
+
imgEl.classList.add("superdoc-table-image");
|
|
73314
|
+
if (block.src) {
|
|
73315
|
+
imgEl.src = block.src;
|
|
73316
|
+
}
|
|
73317
|
+
imgEl.alt = block.alt ?? "";
|
|
73318
|
+
imgEl.style.width = "100%";
|
|
73319
|
+
imgEl.style.height = "100%";
|
|
73320
|
+
imgEl.style.objectFit = block.objectFit ?? "contain";
|
|
73321
|
+
imgEl.style.display = "block";
|
|
73322
|
+
imageWrapper.appendChild(imgEl);
|
|
73323
|
+
content.appendChild(imageWrapper);
|
|
73324
|
+
continue;
|
|
73325
|
+
}
|
|
73326
|
+
if (blockMeasure.kind === "drawing" && block?.kind === "drawing") {
|
|
73327
|
+
console.log(
|
|
73328
|
+
"[DomPainter.renderTableCell] rendering drawing block in cell",
|
|
73329
|
+
JSON.stringify({
|
|
73330
|
+
cellId: cell?.id,
|
|
73331
|
+
blockId: block.id,
|
|
73332
|
+
drawingKind: block.drawingKind,
|
|
73333
|
+
width: blockMeasure.width,
|
|
73334
|
+
height: blockMeasure.height
|
|
73335
|
+
})
|
|
73336
|
+
);
|
|
73337
|
+
const drawingWrapper = doc2.createElement("div");
|
|
73338
|
+
drawingWrapper.style.position = "relative";
|
|
73339
|
+
drawingWrapper.style.width = `${blockMeasure.width}px`;
|
|
73340
|
+
drawingWrapper.style.height = `${blockMeasure.height}px`;
|
|
73341
|
+
drawingWrapper.style.maxWidth = "100%";
|
|
73342
|
+
drawingWrapper.style.boxSizing = "border-box";
|
|
73343
|
+
applySdtDataset(drawingWrapper, block.attrs);
|
|
73344
|
+
const drawingInner = doc2.createElement("div");
|
|
73345
|
+
drawingInner.classList.add("superdoc-table-drawing");
|
|
73346
|
+
drawingInner.style.width = "100%";
|
|
73347
|
+
drawingInner.style.height = "100%";
|
|
73348
|
+
drawingInner.style.display = "flex";
|
|
73349
|
+
drawingInner.style.alignItems = "center";
|
|
73350
|
+
drawingInner.style.justifyContent = "center";
|
|
73351
|
+
drawingInner.style.overflow = "hidden";
|
|
73352
|
+
if (block.drawingKind === "image" && "src" in block && block.src) {
|
|
73353
|
+
const img = doc2.createElement("img");
|
|
73354
|
+
img.classList.add("superdoc-drawing-image");
|
|
73355
|
+
img.src = block.src;
|
|
73356
|
+
img.alt = block.alt ?? "";
|
|
73357
|
+
img.style.width = "100%";
|
|
73358
|
+
img.style.height = "100%";
|
|
73359
|
+
img.style.objectFit = block.objectFit ?? "contain";
|
|
73360
|
+
drawingInner.appendChild(img);
|
|
73361
|
+
} else {
|
|
73362
|
+
const placeholder = doc2.createElement("div");
|
|
73363
|
+
placeholder.style.width = "100%";
|
|
73364
|
+
placeholder.style.height = "100%";
|
|
73365
|
+
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)";
|
|
73366
|
+
placeholder.style.border = "1px dashed rgba(15, 23, 42, 0.3)";
|
|
73367
|
+
drawingInner.appendChild(placeholder);
|
|
73368
|
+
}
|
|
73369
|
+
drawingWrapper.appendChild(drawingInner);
|
|
73370
|
+
content.appendChild(drawingWrapper);
|
|
73371
|
+
continue;
|
|
73372
|
+
}
|
|
73055
73373
|
if (blockMeasure.kind === "paragraph" && block?.kind === "paragraph") {
|
|
73056
|
-
|
|
73374
|
+
try {
|
|
73375
|
+
const runKinds = (block.runs ?? []).map((r2) => r2.kind ?? "text");
|
|
73376
|
+
const imageRuns = (block.runs ?? []).filter((r2) => r2.kind === "image").map((r2) => ({ src: r2.src }));
|
|
73377
|
+
console.log(
|
|
73378
|
+
"[DomPainter.renderTableCell] rendering paragraph block in cell",
|
|
73379
|
+
JSON.stringify({
|
|
73380
|
+
cellId: cell?.id,
|
|
73381
|
+
blockId: block.id,
|
|
73382
|
+
runKinds,
|
|
73383
|
+
imageRuns
|
|
73384
|
+
})
|
|
73385
|
+
);
|
|
73386
|
+
} catch {
|
|
73387
|
+
}
|
|
73388
|
+
const paragraphMeasure = blockMeasure;
|
|
73389
|
+
const lines = paragraphMeasure.lines;
|
|
73057
73390
|
const blockLineCount = lines?.length || 0;
|
|
73391
|
+
const wordLayout = block.attrs?.wordLayout ?? null;
|
|
73392
|
+
const markerLayout = wordLayout?.marker;
|
|
73393
|
+
const markerMeasure = paragraphMeasure.marker;
|
|
73394
|
+
const indentLeftPx = markerMeasure?.indentLeft ?? wordLayout?.indentLeftPx ?? (block.attrs?.indent && typeof block.attrs.indent.left === "number" ? block.attrs.indent.left : 0);
|
|
73058
73395
|
const blockStartGlobal = cumulativeLineCount;
|
|
73059
73396
|
const blockEndGlobal = cumulativeLineCount + blockLineCount;
|
|
73060
73397
|
if (blockEndGlobal <= globalFromLine) {
|
|
@@ -73076,7 +73413,38 @@ const renderTableCell = (deps) => {
|
|
|
73076
73413
|
for (let lineIdx = localStartLine; lineIdx < localEndLine && lineIdx < lines.length; lineIdx++) {
|
|
73077
73414
|
const line = lines[lineIdx];
|
|
73078
73415
|
const lineEl = renderLine(block, line, { ...context, section: "body" });
|
|
73079
|
-
|
|
73416
|
+
lineEl.style.paddingLeft = "";
|
|
73417
|
+
lineEl.style.paddingRight = "";
|
|
73418
|
+
lineEl.style.textIndent = "";
|
|
73419
|
+
const shouldRenderMarker = markerLayout && markerMeasure && lineIdx === 0 && localStartLine === 0 && markerMeasure.markerWidth > 0;
|
|
73420
|
+
if (shouldRenderMarker) {
|
|
73421
|
+
const lineContainer = renderListMarker({
|
|
73422
|
+
doc: doc2,
|
|
73423
|
+
lineEl,
|
|
73424
|
+
markerLayout,
|
|
73425
|
+
markerMeasure,
|
|
73426
|
+
indentLeftPx
|
|
73427
|
+
});
|
|
73428
|
+
paraWrapper.appendChild(lineContainer);
|
|
73429
|
+
} else {
|
|
73430
|
+
if (markerLayout && indentLeftPx) {
|
|
73431
|
+
lineEl.style.paddingLeft = `${indentLeftPx}px`;
|
|
73432
|
+
} else {
|
|
73433
|
+
const indent = block.attrs?.indent;
|
|
73434
|
+
if (indent) {
|
|
73435
|
+
if (typeof indent.left === "number" && indent.left > 0) {
|
|
73436
|
+
lineEl.style.paddingLeft = `${indent.left}px`;
|
|
73437
|
+
}
|
|
73438
|
+
if (typeof indent.right === "number" && indent.right > 0) {
|
|
73439
|
+
lineEl.style.paddingRight = `${indent.right}px`;
|
|
73440
|
+
}
|
|
73441
|
+
if (lineIdx === 0 && typeof indent.firstLine === "number" && indent.firstLine !== 0) {
|
|
73442
|
+
lineEl.style.textIndent = `${indent.firstLine}px`;
|
|
73443
|
+
}
|
|
73444
|
+
}
|
|
73445
|
+
}
|
|
73446
|
+
paraWrapper.appendChild(lineEl);
|
|
73447
|
+
}
|
|
73080
73448
|
renderedHeight += line.lineHeight;
|
|
73081
73449
|
}
|
|
73082
73450
|
const renderedEntireBlock = localStartLine === 0 && localEndLine >= blockLineCount;
|