superdoc 1.0.0-beta.88 → 1.0.0-beta.89
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-DBW8dNGO.cjs → PdfViewer-64l7m5Lq.cjs} +1 -1
- package/dist/chunks/{PdfViewer-2DqlQMKM.es.js → PdfViewer-Dj0ADYo6.es.js} +1 -1
- package/dist/chunks/{index-i17b8wYa.cjs → index-Cnq_7qcp.cjs} +3 -3
- package/dist/chunks/{index-nvs_L5an.es.js → index-DXKu3E-3.es.js} +3 -3
- package/dist/chunks/{index-BLlh97IN-75N3psN2.es.js → index-DcTrJ8db-9XJOggtC.es.js} +1 -1
- package/dist/chunks/{index-BLlh97IN-BF_Nyujm.cjs → index-DcTrJ8db-kUMXGs8M.cjs} +1 -1
- package/dist/chunks/{super-editor.es-DpbjE-x_.es.js → super-editor.es-D0fgEP38.es.js} +145 -38
- package/dist/chunks/{super-editor.es-DB49uQPF.cjs → super-editor.es-D8F0msfn.cjs} +145 -38
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-CjKHGzQU.js → converter-DPyEmTPY.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-BDVppBrA.js → docx-zipper-BTkZSGvz.js} +1 -1
- package/dist/super-editor/chunks/{editor-CgbApADp.js → editor-4iR-p-_J.js} +146 -39
- package/dist/super-editor/chunks/{index-BLlh97IN.js → index-DcTrJ8db.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-BEQMP5-e.js → toolbar-Dx7gHXE2.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 +147 -40
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -42398,7 +42398,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
42398
42398
|
static getStoredSuperdocVersion(docx) {
|
|
42399
42399
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42400
42400
|
}
|
|
42401
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
42401
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.89") {
|
|
42402
42402
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
42403
42403
|
}
|
|
42404
42404
|
/**
|
|
@@ -67461,7 +67461,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67461
67461
|
const shouldSkipNodeView = (editor) => {
|
|
67462
67462
|
return isHeadless(editor);
|
|
67463
67463
|
};
|
|
67464
|
-
const summaryVersion = "1.0.0-beta.
|
|
67464
|
+
const summaryVersion = "1.0.0-beta.89";
|
|
67465
67465
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
67466
67466
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
67467
67467
|
function mapAttributes(attrs) {
|
|
@@ -68250,7 +68250,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68250
68250
|
{ default: remarkStringify2 },
|
|
68251
68251
|
{ default: remarkGfm2 }
|
|
68252
68252
|
] = await Promise.all([
|
|
68253
|
-
Promise.resolve().then(() =>
|
|
68253
|
+
Promise.resolve().then(() => indexDcTrJ8db),
|
|
68254
68254
|
Promise.resolve().then(() => indexDRCvimau),
|
|
68255
68255
|
Promise.resolve().then(() => indexC_x_N6Uh),
|
|
68256
68256
|
Promise.resolve().then(() => indexD_sWOSiG),
|
|
@@ -68455,7 +68455,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68455
68455
|
* Process collaboration migrations
|
|
68456
68456
|
*/
|
|
68457
68457
|
processCollaborationMigrations() {
|
|
68458
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
68458
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.89");
|
|
68459
68459
|
if (!this.options.ydoc) return;
|
|
68460
68460
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
68461
68461
|
let docVersion = metaMap.get("version");
|
|
@@ -81367,7 +81367,14 @@ ${l}
|
|
|
81367
81367
|
let renderedHeight = 0;
|
|
81368
81368
|
for (let lineIdx = localStartLine; lineIdx < localEndLine && lineIdx < lines.length; lineIdx++) {
|
|
81369
81369
|
const line = lines[lineIdx];
|
|
81370
|
-
const
|
|
81370
|
+
const isLastLine = lineIdx === lines.length - 1;
|
|
81371
|
+
const lineEl = renderLine(
|
|
81372
|
+
block,
|
|
81373
|
+
line,
|
|
81374
|
+
{ ...context, section: "body" },
|
|
81375
|
+
lineIdx,
|
|
81376
|
+
isLastLine
|
|
81377
|
+
);
|
|
81371
81378
|
lineEl.style.paddingLeft = "";
|
|
81372
81379
|
lineEl.style.paddingRight = "";
|
|
81373
81380
|
lineEl.style.textIndent = "";
|
|
@@ -83999,8 +84006,11 @@ ${l}
|
|
|
83999
84006
|
const applyFragmentFrameWithSection = (el, frag) => {
|
|
84000
84007
|
this.applyFragmentFrame(el, frag, context.section);
|
|
84001
84008
|
};
|
|
84002
|
-
const renderLineForTableCell = (block, line, ctx2) => {
|
|
84003
|
-
|
|
84009
|
+
const renderLineForTableCell = (block, line, ctx2, lineIndex, isLastLine) => {
|
|
84010
|
+
const lastRun = block.runs.length > 0 ? block.runs[block.runs.length - 1] : null;
|
|
84011
|
+
const paragraphEndsWithLineBreak = lastRun?.kind === "lineBreak";
|
|
84012
|
+
const shouldSkipJustify = isLastLine && !paragraphEndsWithLineBreak;
|
|
84013
|
+
return this.renderLine(block, line, ctx2, void 0, lineIndex, shouldSkipJustify);
|
|
84004
84014
|
};
|
|
84005
84015
|
const renderDrawingContentForTableCell = (block) => {
|
|
84006
84016
|
if (block.drawingKind === "image") {
|
|
@@ -84609,9 +84619,10 @@ ${l}
|
|
|
84609
84619
|
el.setAttribute("styleid", styleId);
|
|
84610
84620
|
}
|
|
84611
84621
|
const alignment2 = block.attrs?.alignment;
|
|
84612
|
-
|
|
84613
|
-
|
|
84614
|
-
|
|
84622
|
+
const effectiveAlignment = alignment2;
|
|
84623
|
+
if (effectiveAlignment === "center" || effectiveAlignment === "right") {
|
|
84624
|
+
el.style.textAlign = effectiveAlignment;
|
|
84625
|
+
} else if (effectiveAlignment === "justify") {
|
|
84615
84626
|
el.style.textAlign = "left";
|
|
84616
84627
|
} else {
|
|
84617
84628
|
el.style.textAlign = "left";
|
|
@@ -84673,16 +84684,16 @@ ${l}
|
|
|
84673
84684
|
}
|
|
84674
84685
|
const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
|
|
84675
84686
|
const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
|
|
84676
|
-
const shouldJustify = !skipJustify &&
|
|
84687
|
+
const shouldJustify = !skipJustify && effectiveAlignment === "justify" && !hasExplicitPositioning;
|
|
84677
84688
|
if (shouldJustify) {
|
|
84678
84689
|
const spaceCount = textSlices.reduce(
|
|
84679
84690
|
(sum, s2) => sum + Array.from(s2).filter((ch) => ch === " " || ch === " ").length,
|
|
84680
84691
|
0
|
|
84681
84692
|
);
|
|
84682
|
-
const slack =
|
|
84683
|
-
if (spaceCount > 0 && slack
|
|
84684
|
-
const
|
|
84685
|
-
el.style.wordSpacing = `${
|
|
84693
|
+
const slack = availableWidth - line.width;
|
|
84694
|
+
if (spaceCount > 0 && slack !== 0) {
|
|
84695
|
+
const spacingPerSpace = slack / spaceCount;
|
|
84696
|
+
el.style.wordSpacing = `${spacingPerSpace}px`;
|
|
84686
84697
|
}
|
|
84687
84698
|
}
|
|
84688
84699
|
if (hasExplicitPositioning && line.segments) {
|
|
@@ -91923,9 +91934,7 @@ ${l}
|
|
|
91923
91934
|
try {
|
|
91924
91935
|
ctx2.font = font;
|
|
91925
91936
|
const metrics = ctx2.measureText(text2);
|
|
91926
|
-
const
|
|
91927
|
-
const paintedWidth = (metrics.actualBoundingBoxLeft || 0) + (metrics.actualBoundingBoxRight || 0);
|
|
91928
|
-
const baseWidth = Math.max(advanceWidth, paintedWidth);
|
|
91937
|
+
const baseWidth = metrics.width;
|
|
91929
91938
|
const extra = letterSpacing ? Math.max(0, text2.length - 1) * letterSpacing : 0;
|
|
91930
91939
|
const width = baseWidth + extra;
|
|
91931
91940
|
cache$1$1.set(key2, { width });
|
|
@@ -92134,7 +92143,8 @@ ${l}
|
|
|
92134
92143
|
const isWordLayoutList = Boolean(wordLayout?.marker);
|
|
92135
92144
|
const suppressFirstLine = block.attrs?.suppressFirstLineIndent === true;
|
|
92136
92145
|
const rawFirstLineOffset = suppressFirstLine ? 0 : firstLine - hanging;
|
|
92137
|
-
const
|
|
92146
|
+
const clampedFirstLineOffset = Math.max(0, rawFirstLineOffset);
|
|
92147
|
+
const firstLineOffset = isWordLayoutList ? 0 : clampedFirstLineOffset;
|
|
92138
92148
|
const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
|
|
92139
92149
|
let leftJustifiedMarkerSpace = 0;
|
|
92140
92150
|
if (wordLayout?.marker) {
|
|
@@ -92287,7 +92297,8 @@ ${l}
|
|
|
92287
92297
|
if (run2.kind === "break") {
|
|
92288
92298
|
if (currentLine) {
|
|
92289
92299
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
92290
|
-
const
|
|
92300
|
+
const { spaceCount: _sc, ...lineBase } = currentLine;
|
|
92301
|
+
const completedLine = { ...lineBase, ...metrics };
|
|
92291
92302
|
addBarTabsToLine(completedLine);
|
|
92292
92303
|
lines.push(completedLine);
|
|
92293
92304
|
currentLine = null;
|
|
@@ -92348,7 +92359,8 @@ ${l}
|
|
|
92348
92359
|
width: 0,
|
|
92349
92360
|
maxFontSize: lastFontSize,
|
|
92350
92361
|
maxWidth: nextLineMaxWidth,
|
|
92351
|
-
segments: []
|
|
92362
|
+
segments: [],
|
|
92363
|
+
spaceCount: 0
|
|
92352
92364
|
};
|
|
92353
92365
|
tabStopCursor = 0;
|
|
92354
92366
|
pendingTabAlignment = null;
|
|
@@ -92366,7 +92378,8 @@ ${l}
|
|
|
92366
92378
|
maxFontSize: 12,
|
|
92367
92379
|
// Default font size for tabs
|
|
92368
92380
|
maxWidth: getEffectiveWidth(initialAvailableWidth),
|
|
92369
|
-
segments: []
|
|
92381
|
+
segments: [],
|
|
92382
|
+
spaceCount: 0
|
|
92370
92383
|
};
|
|
92371
92384
|
}
|
|
92372
92385
|
const originX = currentLine.width;
|
|
@@ -92415,6 +92428,7 @@ ${l}
|
|
|
92415
92428
|
maxFontSize: imageHeight,
|
|
92416
92429
|
// Use image height for line height calculation
|
|
92417
92430
|
maxWidth: getEffectiveWidth(initialAvailableWidth),
|
|
92431
|
+
spaceCount: 0,
|
|
92418
92432
|
segments: [
|
|
92419
92433
|
{
|
|
92420
92434
|
runIndex,
|
|
@@ -92430,8 +92444,9 @@ ${l}
|
|
|
92430
92444
|
const appliedTabAlign = lastAppliedTabAlign;
|
|
92431
92445
|
if (currentLine.width + imageWidth > currentLine.maxWidth && currentLine.width > 0) {
|
|
92432
92446
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
92447
|
+
const { spaceCount: _sc, ...lineBase } = currentLine;
|
|
92433
92448
|
const completedLine = {
|
|
92434
|
-
...
|
|
92449
|
+
...lineBase,
|
|
92435
92450
|
...metrics
|
|
92436
92451
|
};
|
|
92437
92452
|
addBarTabsToLine(completedLine);
|
|
@@ -92447,6 +92462,7 @@ ${l}
|
|
|
92447
92462
|
width: imageWidth,
|
|
92448
92463
|
maxFontSize: imageHeight,
|
|
92449
92464
|
maxWidth: getEffectiveWidth(contentWidth),
|
|
92465
|
+
spaceCount: 0,
|
|
92450
92466
|
segments: [
|
|
92451
92467
|
{
|
|
92452
92468
|
runIndex,
|
|
@@ -92502,6 +92518,7 @@ ${l}
|
|
|
92502
92518
|
width: annotationWidth,
|
|
92503
92519
|
maxFontSize: annotationHeight,
|
|
92504
92520
|
maxWidth: getEffectiveWidth(initialAvailableWidth),
|
|
92521
|
+
spaceCount: 0,
|
|
92505
92522
|
segments: [
|
|
92506
92523
|
{
|
|
92507
92524
|
runIndex,
|
|
@@ -92516,8 +92533,9 @@ ${l}
|
|
|
92516
92533
|
}
|
|
92517
92534
|
if (currentLine.width + annotationWidth > currentLine.maxWidth && currentLine.width > 0) {
|
|
92518
92535
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
92536
|
+
const { spaceCount: _sc, ...lineBase } = currentLine;
|
|
92519
92537
|
const completedLine = {
|
|
92520
|
-
...
|
|
92538
|
+
...lineBase,
|
|
92521
92539
|
...metrics
|
|
92522
92540
|
};
|
|
92523
92541
|
addBarTabsToLine(completedLine);
|
|
@@ -92533,6 +92551,7 @@ ${l}
|
|
|
92533
92551
|
width: annotationWidth,
|
|
92534
92552
|
maxFontSize: annotationHeight,
|
|
92535
92553
|
maxWidth: getEffectiveWidth(contentWidth),
|
|
92554
|
+
spaceCount: 0,
|
|
92536
92555
|
segments: [
|
|
92537
92556
|
{
|
|
92538
92557
|
runIndex,
|
|
@@ -92588,14 +92607,16 @@ ${l}
|
|
|
92588
92607
|
maxFontSize: run2.fontSize,
|
|
92589
92608
|
maxFontInfo: getFontInfoFromRun(run2),
|
|
92590
92609
|
maxWidth: getEffectiveWidth(initialAvailableWidth),
|
|
92591
|
-
segments: [{ runIndex, fromChar: spacesStartChar, toChar: spacesEndChar, width: spacesWidth }]
|
|
92610
|
+
segments: [{ runIndex, fromChar: spacesStartChar, toChar: spacesEndChar, width: spacesWidth }],
|
|
92611
|
+
spaceCount: spacesLength
|
|
92592
92612
|
};
|
|
92593
92613
|
} else {
|
|
92594
92614
|
const boundarySpacing = currentLine.width > 0 ? run2.letterSpacing ?? 0 : 0;
|
|
92595
92615
|
if (currentLine.width + boundarySpacing + spacesWidth > currentLine.maxWidth - WIDTH_FUDGE_PX && currentLine.width > 0) {
|
|
92596
92616
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
92617
|
+
const { spaceCount: _sc, ...lineBase } = currentLine;
|
|
92597
92618
|
const completedLine = {
|
|
92598
|
-
...
|
|
92619
|
+
...lineBase,
|
|
92599
92620
|
...metrics
|
|
92600
92621
|
};
|
|
92601
92622
|
addBarTabsToLine(completedLine);
|
|
@@ -92612,7 +92633,8 @@ ${l}
|
|
|
92612
92633
|
maxFontSize: run2.fontSize,
|
|
92613
92634
|
maxFontInfo: getFontInfoFromRun(run2),
|
|
92614
92635
|
maxWidth: getEffectiveWidth(contentWidth),
|
|
92615
|
-
segments: [{ runIndex, fromChar: spacesStartChar, toChar: spacesEndChar, width: spacesWidth }]
|
|
92636
|
+
segments: [{ runIndex, fromChar: spacesStartChar, toChar: spacesEndChar, width: spacesWidth }],
|
|
92637
|
+
spaceCount: spacesLength
|
|
92616
92638
|
};
|
|
92617
92639
|
} else {
|
|
92618
92640
|
currentLine.toRun = runIndex;
|
|
@@ -92621,6 +92643,7 @@ ${l}
|
|
|
92621
92643
|
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
|
|
92622
92644
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run2.fontSize);
|
|
92623
92645
|
appendSegment(currentLine.segments, runIndex, spacesStartChar, spacesEndChar, spacesWidth);
|
|
92646
|
+
currentLine.spaceCount += spacesLength;
|
|
92624
92647
|
}
|
|
92625
92648
|
}
|
|
92626
92649
|
charPosInRun = spacesEndChar;
|
|
@@ -92637,7 +92660,56 @@ ${l}
|
|
|
92637
92660
|
for (let wordIndex = 0; wordIndex < words.length; wordIndex++) {
|
|
92638
92661
|
const word = words[wordIndex];
|
|
92639
92662
|
if (word === "") {
|
|
92640
|
-
|
|
92663
|
+
const spaceStartChar = charPosInRun;
|
|
92664
|
+
const spaceEndChar = charPosInRun + 1;
|
|
92665
|
+
const singleSpaceWidth = measureRunWidth(" ", font, ctx2, run2);
|
|
92666
|
+
if (!currentLine) {
|
|
92667
|
+
currentLine = {
|
|
92668
|
+
fromRun: runIndex,
|
|
92669
|
+
fromChar: spaceStartChar,
|
|
92670
|
+
toRun: runIndex,
|
|
92671
|
+
toChar: spaceEndChar,
|
|
92672
|
+
width: singleSpaceWidth,
|
|
92673
|
+
maxFontSize: run2.fontSize,
|
|
92674
|
+
maxFontInfo: getFontInfoFromRun(run2),
|
|
92675
|
+
maxWidth: getEffectiveWidth(initialAvailableWidth),
|
|
92676
|
+
segments: [{ runIndex, fromChar: spaceStartChar, toChar: spaceEndChar, width: singleSpaceWidth }],
|
|
92677
|
+
spaceCount: 1
|
|
92678
|
+
};
|
|
92679
|
+
} else {
|
|
92680
|
+
const boundarySpacing2 = currentLine.width > 0 ? run2.letterSpacing ?? 0 : 0;
|
|
92681
|
+
if (currentLine.width + boundarySpacing2 + singleSpaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX && currentLine.width > 0) {
|
|
92682
|
+
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
92683
|
+
const { spaceCount: _sc, ...lineBase } = currentLine;
|
|
92684
|
+
const completedLine = { ...lineBase, ...metrics };
|
|
92685
|
+
addBarTabsToLine(completedLine);
|
|
92686
|
+
lines.push(completedLine);
|
|
92687
|
+
tabStopCursor = 0;
|
|
92688
|
+
pendingTabAlignment = null;
|
|
92689
|
+
lastAppliedTabAlign = null;
|
|
92690
|
+
currentLine = {
|
|
92691
|
+
fromRun: runIndex,
|
|
92692
|
+
fromChar: spaceStartChar,
|
|
92693
|
+
toRun: runIndex,
|
|
92694
|
+
toChar: spaceEndChar,
|
|
92695
|
+
width: singleSpaceWidth,
|
|
92696
|
+
maxFontSize: run2.fontSize,
|
|
92697
|
+
maxFontInfo: getFontInfoFromRun(run2),
|
|
92698
|
+
maxWidth: getEffectiveWidth(contentWidth),
|
|
92699
|
+
segments: [{ runIndex, fromChar: spaceStartChar, toChar: spaceEndChar, width: singleSpaceWidth }],
|
|
92700
|
+
spaceCount: 1
|
|
92701
|
+
};
|
|
92702
|
+
} else {
|
|
92703
|
+
currentLine.toRun = runIndex;
|
|
92704
|
+
currentLine.toChar = spaceEndChar;
|
|
92705
|
+
currentLine.width = roundValue(currentLine.width + boundarySpacing2 + singleSpaceWidth);
|
|
92706
|
+
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
|
|
92707
|
+
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run2.fontSize);
|
|
92708
|
+
appendSegment(currentLine.segments, runIndex, spaceStartChar, spaceEndChar, singleSpaceWidth);
|
|
92709
|
+
currentLine.spaceCount += 1;
|
|
92710
|
+
}
|
|
92711
|
+
}
|
|
92712
|
+
charPosInRun = spaceEndChar;
|
|
92641
92713
|
continue;
|
|
92642
92714
|
}
|
|
92643
92715
|
const isLastWordInSegment = wordIndex === words.length - 1;
|
|
@@ -92658,13 +92730,15 @@ ${l}
|
|
|
92658
92730
|
maxFontSize: run2.fontSize,
|
|
92659
92731
|
maxFontInfo: getFontInfoFromRun(run2),
|
|
92660
92732
|
maxWidth: getEffectiveWidth(initialAvailableWidth),
|
|
92661
|
-
segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }]
|
|
92733
|
+
segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }],
|
|
92734
|
+
spaceCount: 0
|
|
92662
92735
|
};
|
|
92663
92736
|
const ls = run2.letterSpacing ?? 0;
|
|
92664
92737
|
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX) {
|
|
92665
92738
|
currentLine.toChar = wordEndWithSpace;
|
|
92666
92739
|
currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
|
|
92667
92740
|
charPosInRun = wordEndWithSpace;
|
|
92741
|
+
currentLine.spaceCount += 1;
|
|
92668
92742
|
} else {
|
|
92669
92743
|
charPosInRun = wordEndWithSpace;
|
|
92670
92744
|
}
|
|
@@ -92672,10 +92746,36 @@ ${l}
|
|
|
92672
92746
|
}
|
|
92673
92747
|
const isTocEntry = block.attrs?.isTocEntry;
|
|
92674
92748
|
const boundarySpacing = currentLine.width > 0 ? run2.letterSpacing ?? 0 : 0;
|
|
92675
|
-
|
|
92749
|
+
const justifyAlignment = block.attrs?.alignment === "justify";
|
|
92750
|
+
const totalWidthWithWord = currentLine.width + boundarySpacing + wordCommitWidth + // Safe cast: only TextRuns produce word segments from split(), other run types are handled earlier
|
|
92751
|
+
(isLastWord ? 0 : run2.letterSpacing ?? 0);
|
|
92752
|
+
const availableWidth = currentLine.maxWidth - WIDTH_FUDGE_PX;
|
|
92753
|
+
let shouldBreak = currentLine.width + boundarySpacing + wordOnlyWidth > availableWidth && currentLine.width > 0 && !isTocEntry;
|
|
92754
|
+
let compressedWidth = null;
|
|
92755
|
+
if (shouldBreak && justifyAlignment) {
|
|
92756
|
+
const isParagraphLastWord = isLastWord && runIndex === runsToProcess.length - 1;
|
|
92757
|
+
if (!isParagraphLastWord) {
|
|
92758
|
+
const existingSpaces = currentLine.spaceCount ?? 0;
|
|
92759
|
+
const candidateSpaces = existingSpaces + (isLastWord ? 0 : 1);
|
|
92760
|
+
if (candidateSpaces > 0) {
|
|
92761
|
+
const overflow = totalWidthWithWord - availableWidth;
|
|
92762
|
+
if (overflow > 0) {
|
|
92763
|
+
const baseSpaceWidth = spaceWidth || measureRunWidth(" ", font, ctx2, run2) || Math.max(1, boundarySpacing);
|
|
92764
|
+
const perSpaceCompression = overflow / candidateSpaces;
|
|
92765
|
+
const maxPerSpaceCompression = baseSpaceWidth * 0.25;
|
|
92766
|
+
if (perSpaceCompression <= maxPerSpaceCompression) {
|
|
92767
|
+
shouldBreak = false;
|
|
92768
|
+
compressedWidth = availableWidth;
|
|
92769
|
+
}
|
|
92770
|
+
}
|
|
92771
|
+
}
|
|
92772
|
+
}
|
|
92773
|
+
}
|
|
92774
|
+
if (shouldBreak) {
|
|
92676
92775
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
92776
|
+
const { spaceCount: _sc, ...lineBase } = currentLine;
|
|
92677
92777
|
const completedLine = {
|
|
92678
|
-
...
|
|
92778
|
+
...lineBase,
|
|
92679
92779
|
...metrics
|
|
92680
92780
|
};
|
|
92681
92781
|
addBarTabsToLine(completedLine);
|
|
@@ -92691,12 +92791,14 @@ ${l}
|
|
|
92691
92791
|
maxFontSize: run2.fontSize,
|
|
92692
92792
|
maxFontInfo: getFontInfoFromRun(run2),
|
|
92693
92793
|
maxWidth: getEffectiveWidth(contentWidth),
|
|
92694
|
-
segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }]
|
|
92794
|
+
segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }],
|
|
92795
|
+
spaceCount: 0
|
|
92695
92796
|
};
|
|
92696
92797
|
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX) {
|
|
92697
92798
|
currentLine.toChar = wordEndWithSpace;
|
|
92698
92799
|
currentLine.width = roundValue(currentLine.width + spaceWidth + (run2.letterSpacing ?? 0));
|
|
92699
92800
|
charPosInRun = wordEndWithSpace;
|
|
92801
|
+
currentLine.spaceCount += 1;
|
|
92700
92802
|
} else {
|
|
92701
92803
|
charPosInRun = wordEndWithSpace;
|
|
92702
92804
|
}
|
|
@@ -92717,7 +92819,8 @@ ${l}
|
|
|
92717
92819
|
useExplicitXHere ? segmentStartX : void 0
|
|
92718
92820
|
);
|
|
92719
92821
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
92720
|
-
const
|
|
92822
|
+
const { spaceCount: _sc, ...lineBase } = currentLine;
|
|
92823
|
+
const completedLine = { ...lineBase, ...metrics };
|
|
92721
92824
|
addBarTabsToLine(completedLine);
|
|
92722
92825
|
lines.push(completedLine);
|
|
92723
92826
|
tabStopCursor = 0;
|
|
@@ -92730,12 +92833,14 @@ ${l}
|
|
|
92730
92833
|
currentLine.toChar = newToChar;
|
|
92731
92834
|
const useExplicitX = wordIndex === 0 && segmentStartX !== void 0;
|
|
92732
92835
|
const explicitX = useExplicitX ? segmentStartX : void 0;
|
|
92733
|
-
currentLine.width
|
|
92734
|
-
|
|
92735
|
-
);
|
|
92836
|
+
const targetWidth = compressedWidth != null ? compressedWidth : currentLine.width + boundarySpacing + wordCommitWidth + (isLastWord ? 0 : run2.letterSpacing ?? 0);
|
|
92837
|
+
currentLine.width = roundValue(targetWidth);
|
|
92736
92838
|
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
|
|
92737
92839
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run2.fontSize);
|
|
92738
92840
|
appendSegment(currentLine.segments, runIndex, wordStartChar, newToChar, wordCommitWidth, explicitX);
|
|
92841
|
+
if (!isLastWord) {
|
|
92842
|
+
currentLine.spaceCount += 1;
|
|
92843
|
+
}
|
|
92739
92844
|
}
|
|
92740
92845
|
charPosInRun = isLastWord ? wordEndNoSpace : wordEndWithSpace;
|
|
92741
92846
|
}
|
|
@@ -92758,7 +92863,8 @@ ${l}
|
|
|
92758
92863
|
maxFontSize: run2.fontSize,
|
|
92759
92864
|
maxFontInfo: getFontInfoFromRun(run2),
|
|
92760
92865
|
maxWidth: getEffectiveWidth(initialAvailableWidth),
|
|
92761
|
-
segments: []
|
|
92866
|
+
segments: [],
|
|
92867
|
+
spaceCount: 0
|
|
92762
92868
|
};
|
|
92763
92869
|
}
|
|
92764
92870
|
const originX = currentLine.width;
|
|
@@ -92804,8 +92910,9 @@ ${l}
|
|
|
92804
92910
|
}
|
|
92805
92911
|
if (currentLine) {
|
|
92806
92912
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
92913
|
+
const { spaceCount: _sc, ...lineBase } = currentLine;
|
|
92807
92914
|
const finalLine = {
|
|
92808
|
-
...
|
|
92915
|
+
...lineBase,
|
|
92809
92916
|
...metrics
|
|
92810
92917
|
};
|
|
92811
92918
|
addBarTabsToLine(finalLine);
|
|
@@ -151515,7 +151622,7 @@ ${style2}
|
|
|
151515
151622
|
this.config.colors = shuffleArray(this.config.colors);
|
|
151516
151623
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
151517
151624
|
this.colorIndex = 0;
|
|
151518
|
-
this.version = "1.0.0-beta.
|
|
151625
|
+
this.version = "1.0.0-beta.89";
|
|
151519
151626
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
151520
151627
|
this.superdocId = config2.superdocId || v4();
|
|
151521
151628
|
this.colors = this.config.colors;
|
|
@@ -153987,7 +154094,7 @@ ${style2}
|
|
|
153987
154094
|
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
|
153988
154095
|
);
|
|
153989
154096
|
}
|
|
153990
|
-
const
|
|
154097
|
+
const indexDcTrJ8db = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
153991
154098
|
__proto__: null,
|
|
153992
154099
|
unified
|
|
153993
154100
|
}, Symbol.toStringTag, { value: "Module" }));
|