superdoc 1.0.0-beta.4 → 1.0.0-beta.6
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-DUns3s8O.es.js → PdfViewer-CdGAVn-4.es.js} +1 -1
- package/dist/chunks/{PdfViewer-ZtwLhE_8.cjs → PdfViewer-DmPiOFJ8.cjs} +1 -1
- package/dist/chunks/{index-BW38mdZF.cjs → index-QulG3CF7.cjs} +3 -3
- package/dist/chunks/{index-BNGaD3Up-D2cRHMMk.cjs → index-hjUbJ86s-BLl65XJn.cjs} +1 -1
- package/dist/chunks/{index-BNGaD3Up-CQuoo1EF.es.js → index-hjUbJ86s-BMiwCR8J.es.js} +1 -1
- package/dist/chunks/{index-DIccWgYh.es.js → index-nXifzD54.es.js} +3 -3
- package/dist/chunks/{super-editor.es-C06-V-Iy.cjs → super-editor.es-0GatZWs9.cjs} +452 -183
- package/dist/chunks/{super-editor.es-CtCHBIPE.es.js → super-editor.es-BYVEYLjl.es.js} +452 -183
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-ZJiSHoiq.js → converter-CZF9SnYh.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-B7FStorN.js → docx-zipper-DWypbE0V.js} +1 -1
- package/dist/super-editor/chunks/{editor-DvepAjbe.js → editor-BdXHlHt-.js} +440 -176
- package/dist/super-editor/chunks/{index-BNGaD3Up.js → index-hjUbJ86s.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-CKXXbIQO.js → toolbar-CmelvLTd.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 +19 -14
- 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 +454 -185
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -35581,7 +35581,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35581
35581
|
static getStoredSuperdocVersion(docx) {
|
|
35582
35582
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
35583
35583
|
}
|
|
35584
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
35584
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.6") {
|
|
35585
35585
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
35586
35586
|
}
|
|
35587
35587
|
/**
|
|
@@ -60069,7 +60069,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
60069
60069
|
const shouldSkipNodeView = (editor) => {
|
|
60070
60070
|
return isHeadless(editor);
|
|
60071
60071
|
};
|
|
60072
|
-
const summaryVersion = "1.0.0-beta.
|
|
60072
|
+
const summaryVersion = "1.0.0-beta.6";
|
|
60073
60073
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
60074
60074
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
60075
60075
|
function mapAttributes(attrs) {
|
|
@@ -60848,7 +60848,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
60848
60848
|
{ default: remarkStringify2 },
|
|
60849
60849
|
{ default: remarkGfm2 }
|
|
60850
60850
|
] = await Promise.all([
|
|
60851
|
-
Promise.resolve().then(() =>
|
|
60851
|
+
Promise.resolve().then(() => indexHjUbJ86s),
|
|
60852
60852
|
Promise.resolve().then(() => indexDRCvimau),
|
|
60853
60853
|
Promise.resolve().then(() => indexC_x_N6Uh),
|
|
60854
60854
|
Promise.resolve().then(() => indexD_sWOSiG),
|
|
@@ -61053,7 +61053,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61053
61053
|
* Process collaboration migrations
|
|
61054
61054
|
*/
|
|
61055
61055
|
processCollaborationMigrations() {
|
|
61056
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
61056
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.6");
|
|
61057
61057
|
if (!this.options.ydoc) return;
|
|
61058
61058
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
61059
61059
|
let docVersion = metaMap.get("version");
|
|
@@ -63185,9 +63185,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
63185
63185
|
}
|
|
63186
63186
|
function extractCellBorders(cellAttrs) {
|
|
63187
63187
|
if (!cellAttrs?.borders) return void 0;
|
|
63188
|
+
const bordersData = cellAttrs.borders;
|
|
63188
63189
|
const borders = {};
|
|
63189
63190
|
for (const side of ["top", "right", "bottom", "left"]) {
|
|
63190
|
-
const spec = convertBorderSpec(
|
|
63191
|
+
const spec = convertBorderSpec(bordersData[side]);
|
|
63191
63192
|
if (spec) {
|
|
63192
63193
|
borders[side] = spec;
|
|
63193
63194
|
}
|
|
@@ -63291,7 +63292,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
63291
63292
|
return trimmed ? trimmed : void 0;
|
|
63292
63293
|
};
|
|
63293
63294
|
const MAX_AUTO_LINE_MULTIPLIER = 10;
|
|
63294
|
-
const TWIPS_THRESHOLD = 50;
|
|
63295
|
+
const TWIPS_THRESHOLD$1 = 50;
|
|
63295
63296
|
const spacingPxToPt = (spacing) => {
|
|
63296
63297
|
const result = {};
|
|
63297
63298
|
if (spacing.before != null) result.before = pxToPt(spacing.before);
|
|
@@ -63431,7 +63432,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
63431
63432
|
const convert2 = (value2) => {
|
|
63432
63433
|
const num = pickNumber(value2);
|
|
63433
63434
|
if (num == null) return void 0;
|
|
63434
|
-
if (Math.abs(num) <= TWIPS_THRESHOLD) {
|
|
63435
|
+
if (Math.abs(num) <= TWIPS_THRESHOLD$1) {
|
|
63435
63436
|
return num;
|
|
63436
63437
|
}
|
|
63437
63438
|
return twipsToPx$1(Number(num));
|
|
@@ -63446,24 +63447,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
63446
63447
|
if (hanging != null) indent2.hanging = hanging;
|
|
63447
63448
|
return Object.keys(indent2).length > 0 ? indent2 : void 0;
|
|
63448
63449
|
};
|
|
63450
|
+
const PX_TO_TWIPS = 15;
|
|
63451
|
+
const TWIPS_THRESHOLD = 1e3;
|
|
63449
63452
|
const normalizeOoxmlTabs = (tabs) => {
|
|
63450
63453
|
if (!Array.isArray(tabs)) return void 0;
|
|
63451
63454
|
const normalized = [];
|
|
63452
63455
|
for (const entry of tabs) {
|
|
63453
63456
|
if (!entry || typeof entry !== "object") continue;
|
|
63454
|
-
const
|
|
63455
|
-
|
|
63456
|
-
const
|
|
63457
|
-
if (originalPos != null) {
|
|
63458
|
-
posTwips = originalPos;
|
|
63459
|
-
} else {
|
|
63460
|
-
const posPx = pickNumber(source.pos ?? source.position ?? source.offset);
|
|
63461
|
-
if (posPx != null) {
|
|
63462
|
-
posTwips = Math.round(posPx * 15);
|
|
63463
|
-
}
|
|
63464
|
-
}
|
|
63457
|
+
const rawEntry = entry;
|
|
63458
|
+
const source = rawEntry.tab && typeof rawEntry.tab === "object" ? rawEntry.tab : rawEntry;
|
|
63459
|
+
const posTwips = resolveTabPosition(source);
|
|
63465
63460
|
if (posTwips == null) continue;
|
|
63466
|
-
const val = normalizeTabVal(source.val ?? source.align ?? source.alignment ?? source.type);
|
|
63461
|
+
const val = normalizeTabVal(source.val ?? source.align ?? source.alignment ?? source.type ?? source.tabType);
|
|
63467
63462
|
if (!val) continue;
|
|
63468
63463
|
const tab = {
|
|
63469
63464
|
val,
|
|
@@ -63475,6 +63470,21 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
63475
63470
|
}
|
|
63476
63471
|
return normalized.length > 0 ? normalized : void 0;
|
|
63477
63472
|
};
|
|
63473
|
+
const resolveTabPosition = (source) => {
|
|
63474
|
+
const originalPos = pickNumber(source.originalPos);
|
|
63475
|
+
if (originalPos != null) {
|
|
63476
|
+
return originalPos;
|
|
63477
|
+
}
|
|
63478
|
+
const posValue = pickNumber(source.pos ?? source.position ?? source.offset);
|
|
63479
|
+
if (posValue == null) {
|
|
63480
|
+
return void 0;
|
|
63481
|
+
}
|
|
63482
|
+
if (posValue > TWIPS_THRESHOLD) {
|
|
63483
|
+
return posValue;
|
|
63484
|
+
} else {
|
|
63485
|
+
return Math.round(posValue * PX_TO_TWIPS);
|
|
63486
|
+
}
|
|
63487
|
+
};
|
|
63478
63488
|
const normalizeTabVal = (value) => {
|
|
63479
63489
|
switch (value) {
|
|
63480
63490
|
case "start":
|
|
@@ -63486,12 +63496,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
63486
63496
|
return value;
|
|
63487
63497
|
case "left":
|
|
63488
63498
|
return "start";
|
|
63489
|
-
// Legacy mapping
|
|
63499
|
+
// Legacy mapping for RTL support
|
|
63490
63500
|
case "right":
|
|
63491
63501
|
return "end";
|
|
63492
|
-
// Legacy mapping
|
|
63502
|
+
// Legacy mapping for RTL support
|
|
63493
63503
|
case "dec":
|
|
63494
63504
|
return "decimal";
|
|
63505
|
+
// Abbreviation mapping
|
|
63495
63506
|
default:
|
|
63496
63507
|
return void 0;
|
|
63497
63508
|
}
|
|
@@ -63507,7 +63518,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
63507
63518
|
return value;
|
|
63508
63519
|
case "thick":
|
|
63509
63520
|
return "heavy";
|
|
63510
|
-
//
|
|
63521
|
+
// Legacy mapping
|
|
63511
63522
|
default:
|
|
63512
63523
|
return void 0;
|
|
63513
63524
|
}
|
|
@@ -64435,29 +64446,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64435
64446
|
}
|
|
64436
64447
|
return void 0;
|
|
64437
64448
|
};
|
|
64438
|
-
function resolveSpacingIndent$1(style2, numbering) {
|
|
64439
|
-
const spacing = {
|
|
64440
|
-
before: style2.spacing?.before ?? 0,
|
|
64441
|
-
after: style2.spacing?.after ?? 0,
|
|
64442
|
-
line: style2.spacing?.line ?? 12,
|
|
64443
|
-
// Default line spacing
|
|
64444
|
-
lineRule: style2.spacing?.lineRule ?? "auto"
|
|
64445
|
-
};
|
|
64446
|
-
let indent2 = {
|
|
64447
|
-
left: style2.indent?.left ?? 0,
|
|
64448
|
-
right: style2.indent?.right ?? 0,
|
|
64449
|
-
firstLine: style2.indent?.firstLine ?? 0,
|
|
64450
|
-
hanging: style2.indent?.hanging ?? 0
|
|
64451
|
-
};
|
|
64452
|
-
if (numbering?.indent) {
|
|
64453
|
-
indent2 = {
|
|
64454
|
-
...indent2,
|
|
64455
|
-
left: numbering.indent.left ?? indent2.left,
|
|
64456
|
-
hanging: numbering.indent.hanging ?? indent2.hanging
|
|
64457
|
-
};
|
|
64458
|
-
}
|
|
64459
|
-
return { spacing, indent: indent2 };
|
|
64460
|
-
}
|
|
64461
64449
|
function computeTabStops$1(context) {
|
|
64462
64450
|
const { explicitStops, defaultTabInterval, paragraphIndent } = context;
|
|
64463
64451
|
const leftIndent = paragraphIndent.left ?? 0;
|
|
@@ -64569,6 +64557,90 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64569
64557
|
const targetX = stop.pos - width;
|
|
64570
64558
|
return targetX < 0 ? 0 : targetX;
|
|
64571
64559
|
}
|
|
64560
|
+
function calculateTabWidth(params2) {
|
|
64561
|
+
const {
|
|
64562
|
+
currentX,
|
|
64563
|
+
tabStops,
|
|
64564
|
+
paragraphWidth,
|
|
64565
|
+
defaultTabDistance: defaultTabDistance2,
|
|
64566
|
+
defaultLineLength: defaultLineLength2,
|
|
64567
|
+
followingText = "",
|
|
64568
|
+
measureText: measureText2,
|
|
64569
|
+
decimalSeparator = "."
|
|
64570
|
+
} = params2;
|
|
64571
|
+
const nextStop = tabStops.find((stop) => stop.val !== "clear" && stop.pos > currentX);
|
|
64572
|
+
const fallbackWidth = () => {
|
|
64573
|
+
let tabWidth = defaultTabDistance2 - currentX % defaultLineLength2 % defaultTabDistance2;
|
|
64574
|
+
if (tabWidth <= 0) tabWidth = defaultTabDistance2;
|
|
64575
|
+
return {
|
|
64576
|
+
width: tabWidth,
|
|
64577
|
+
alignment: "default",
|
|
64578
|
+
tabStopPosUsed: "default"
|
|
64579
|
+
};
|
|
64580
|
+
};
|
|
64581
|
+
if (!nextStop) {
|
|
64582
|
+
return fallbackWidth();
|
|
64583
|
+
}
|
|
64584
|
+
let width = Math.min(nextStop.pos, paragraphWidth) - currentX;
|
|
64585
|
+
const alignment2 = nextStop.val;
|
|
64586
|
+
if (alignment2 === "bar") {
|
|
64587
|
+
return {
|
|
64588
|
+
width: 0,
|
|
64589
|
+
leader: nextStop.leader,
|
|
64590
|
+
alignment: alignment2,
|
|
64591
|
+
tabStopPosUsed: nextStop.pos
|
|
64592
|
+
};
|
|
64593
|
+
}
|
|
64594
|
+
if (alignment2 === "center" || alignment2 === "end") {
|
|
64595
|
+
const textWidth = measureText2 ? measureText2(followingText) : 0;
|
|
64596
|
+
if (alignment2 === "center") {
|
|
64597
|
+
width -= textWidth / 2;
|
|
64598
|
+
} else {
|
|
64599
|
+
width -= textWidth;
|
|
64600
|
+
}
|
|
64601
|
+
} else if (alignment2 === "decimal") {
|
|
64602
|
+
const decimalIndex = followingText.indexOf(decimalSeparator);
|
|
64603
|
+
if (decimalIndex >= 0) {
|
|
64604
|
+
const before = followingText.slice(0, decimalIndex);
|
|
64605
|
+
const beforeWidth = measureText2 ? measureText2(before) : 0;
|
|
64606
|
+
width -= beforeWidth;
|
|
64607
|
+
}
|
|
64608
|
+
} else if (alignment2 === "bar") {
|
|
64609
|
+
width = 0;
|
|
64610
|
+
}
|
|
64611
|
+
if (width < 1) {
|
|
64612
|
+
return fallbackWidth();
|
|
64613
|
+
}
|
|
64614
|
+
return {
|
|
64615
|
+
width,
|
|
64616
|
+
leader: nextStop.leader,
|
|
64617
|
+
alignment: alignment2,
|
|
64618
|
+
tabStopPosUsed: nextStop.pos
|
|
64619
|
+
};
|
|
64620
|
+
}
|
|
64621
|
+
function resolveSpacingIndent$1(style2, numbering) {
|
|
64622
|
+
const spacing = {
|
|
64623
|
+
before: style2.spacing?.before ?? 0,
|
|
64624
|
+
after: style2.spacing?.after ?? 0,
|
|
64625
|
+
line: style2.spacing?.line ?? 12,
|
|
64626
|
+
// Default line spacing
|
|
64627
|
+
lineRule: style2.spacing?.lineRule ?? "auto"
|
|
64628
|
+
};
|
|
64629
|
+
let indent2 = {
|
|
64630
|
+
left: style2.indent?.left ?? 0,
|
|
64631
|
+
right: style2.indent?.right ?? 0,
|
|
64632
|
+
firstLine: style2.indent?.firstLine ?? 0,
|
|
64633
|
+
hanging: style2.indent?.hanging ?? 0
|
|
64634
|
+
};
|
|
64635
|
+
if (numbering?.indent) {
|
|
64636
|
+
indent2 = {
|
|
64637
|
+
...indent2,
|
|
64638
|
+
left: numbering.indent.left ?? indent2.left,
|
|
64639
|
+
hanging: numbering.indent.hanging ?? indent2.hanging
|
|
64640
|
+
};
|
|
64641
|
+
}
|
|
64642
|
+
return { spacing, indent: indent2 };
|
|
64643
|
+
}
|
|
64572
64644
|
function formatListLabel(level, indices) {
|
|
64573
64645
|
const { format, text: template, start: start2 } = level;
|
|
64574
64646
|
if (format === "bullet" || format === "custom") {
|
|
@@ -64734,6 +64806,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64734
64806
|
}
|
|
64735
64807
|
const Engines = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
64736
64808
|
__proto__: null,
|
|
64809
|
+
calculateTabWidth,
|
|
64737
64810
|
computeListIndent,
|
|
64738
64811
|
computeTabStops: computeTabStops$1,
|
|
64739
64812
|
computeWrapExclusion,
|
|
@@ -64782,17 +64855,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64782
64855
|
return null;
|
|
64783
64856
|
}
|
|
64784
64857
|
const resolvedExtended = resolved;
|
|
64858
|
+
const resolvedAsRecord = resolved;
|
|
64785
64859
|
const hydrated = {
|
|
64786
64860
|
resolved,
|
|
64787
|
-
spacing: cloneIfObject(
|
|
64788
|
-
indent: cloneIfObject(
|
|
64861
|
+
spacing: cloneIfObject(resolvedAsRecord.spacing),
|
|
64862
|
+
indent: cloneIfObject(resolvedAsRecord.indent),
|
|
64789
64863
|
borders: cloneIfObject(resolvedExtended.borders),
|
|
64790
64864
|
shading: cloneIfObject(resolvedExtended.shading),
|
|
64791
64865
|
alignment: resolvedExtended.justification,
|
|
64792
64866
|
tabStops: cloneIfObject(resolvedExtended.tabStops),
|
|
64793
64867
|
keepLines: resolvedExtended.keepLines,
|
|
64794
64868
|
keepNext: resolvedExtended.keepNext,
|
|
64795
|
-
numberingProperties: cloneIfObject(
|
|
64869
|
+
numberingProperties: cloneIfObject(resolvedAsRecord.numberingProperties)
|
|
64796
64870
|
};
|
|
64797
64871
|
return hydrated;
|
|
64798
64872
|
};
|
|
@@ -65005,6 +65079,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
65005
65079
|
}
|
|
65006
65080
|
};
|
|
65007
65081
|
const computeWordLayoutForParagraph = (paragraphAttrs, numberingProps, styleContext) => {
|
|
65082
|
+
if (numberingProps === null) {
|
|
65083
|
+
return null;
|
|
65084
|
+
}
|
|
65008
65085
|
try {
|
|
65009
65086
|
let effectiveIndent = paragraphAttrs.indent;
|
|
65010
65087
|
if (numberingProps?.resolvedLevelIndent) {
|
|
@@ -65039,7 +65116,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
65039
65116
|
return computeWordParagraphLayout({
|
|
65040
65117
|
paragraph: resolvedParagraph,
|
|
65041
65118
|
numbering: numberingProps,
|
|
65042
|
-
markerRun: numberingProps
|
|
65119
|
+
markerRun: numberingProps?.resolvedMarkerRpr,
|
|
65043
65120
|
// Use cached if available
|
|
65044
65121
|
docDefaults
|
|
65045
65122
|
});
|
|
@@ -65485,7 +65562,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
65485
65562
|
function processNestedStructuredContent(child, sectionMetadata, context, output, converters) {
|
|
65486
65563
|
const { getListCounter, incrementListCounter, resetListCounter } = context.listCounterContext;
|
|
65487
65564
|
const nestedMetadata = resolveNodeSdtMetadata(child, "structuredContentBlock");
|
|
65488
|
-
child.content
|
|
65565
|
+
child.content?.forEach((grandchild) => {
|
|
65489
65566
|
if (grandchild.type === "paragraph") {
|
|
65490
65567
|
const paragraphBlocks = converters.paragraphToFlowBlocks(
|
|
65491
65568
|
grandchild,
|
|
@@ -65537,7 +65614,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
65537
65614
|
if (docPartGallery === "Table of Contents") {
|
|
65538
65615
|
const blocksBeforeToc = output.blocks.length;
|
|
65539
65616
|
processTocChildren(
|
|
65540
|
-
Array.from(child.content),
|
|
65617
|
+
Array.from(child.content ?? []),
|
|
65541
65618
|
{ docPartGallery, docPartObjectId, tocInstruction, sdtMetadata: docPartSdtMetadata },
|
|
65542
65619
|
{
|
|
65543
65620
|
nextBlockId: context.nextBlockId,
|
|
@@ -66215,7 +66292,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
66215
66292
|
trackedChanges,
|
|
66216
66293
|
bookmarks,
|
|
66217
66294
|
hyperlinkConfig,
|
|
66218
|
-
|
|
66295
|
+
themeColors,
|
|
66296
|
+
...converterContext !== void 0 ? [converterContext] : []
|
|
66219
66297
|
);
|
|
66220
66298
|
if (tableBlock) {
|
|
66221
66299
|
blocks2.push(tableBlock);
|
|
@@ -66341,6 +66419,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
66341
66419
|
trackedChangesConfig,
|
|
66342
66420
|
bookmarks,
|
|
66343
66421
|
hyperlinkConfig,
|
|
66422
|
+
void 0,
|
|
66423
|
+
// themeColors - not available in NodeHandlerContext
|
|
66344
66424
|
context.converterContext
|
|
66345
66425
|
);
|
|
66346
66426
|
paragraphBlocks.forEach((block) => {
|
|
@@ -66850,9 +66930,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
66850
66930
|
const paragraph2 = paragraphBlocks.find((b2) => b2.kind === "paragraph");
|
|
66851
66931
|
if (!paragraph2) return null;
|
|
66852
66932
|
const cellAttrs = {};
|
|
66853
|
-
const borders = extractCellBorders(cellNode.attrs);
|
|
66933
|
+
const borders = extractCellBorders(cellNode.attrs ?? {});
|
|
66854
66934
|
if (borders) cellAttrs.borders = borders;
|
|
66855
|
-
const padding = extractCellPadding(cellNode.attrs) ?? (defaultCellPadding ? { ...defaultCellPadding } : void 0);
|
|
66935
|
+
const padding = extractCellPadding(cellNode.attrs ?? {}) ?? (defaultCellPadding ? { ...defaultCellPadding } : void 0);
|
|
66856
66936
|
if (padding) cellAttrs.padding = padding;
|
|
66857
66937
|
const verticalAlign = cellNode.attrs?.verticalAlign;
|
|
66858
66938
|
if (verticalAlign === "top" || verticalAlign === "middle" || verticalAlign === "bottom") {
|
|
@@ -67189,7 +67269,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67189
67269
|
themeColors,
|
|
67190
67270
|
converterContext
|
|
67191
67271
|
);
|
|
67192
|
-
const tableConverter = (node2, nextBlockId2, positions2, defaultFont2, defaultSize2, context, trackedChanges, bookmarks2, hyperlinkConfig2) => tableNodeToBlock(
|
|
67272
|
+
const tableConverter = (node2, nextBlockId2, positions2, defaultFont2, defaultSize2, context, trackedChanges, bookmarks2, hyperlinkConfig2, themeColorsParam, converterCtx) => tableNodeToBlock(
|
|
67193
67273
|
node2,
|
|
67194
67274
|
nextBlockId2,
|
|
67195
67275
|
positions2,
|
|
@@ -67199,8 +67279,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67199
67279
|
trackedChanges,
|
|
67200
67280
|
bookmarks2,
|
|
67201
67281
|
hyperlinkConfig2,
|
|
67202
|
-
themeColors,
|
|
67203
|
-
converterContext
|
|
67282
|
+
themeColorsParam ?? themeColors,
|
|
67283
|
+
converterCtx ?? converterContext
|
|
67204
67284
|
);
|
|
67205
67285
|
const handlerContext = {
|
|
67206
67286
|
blocks: blocks2,
|
|
@@ -73882,7 +73962,7 @@ ${l}
|
|
|
73882
73962
|
markerEl.style.display = "inline-block";
|
|
73883
73963
|
markerEl.style.width = `${Math.max(0, fragment.markerWidth - LIST_MARKER_GAP$1)}px`;
|
|
73884
73964
|
markerEl.style.paddingRight = `${LIST_MARKER_GAP$1}px`;
|
|
73885
|
-
markerEl.style.textAlign = marker.justification ?? "";
|
|
73965
|
+
markerEl.style.textAlign = marker.justification ?? "left";
|
|
73886
73966
|
markerEl.style.fontFamily = marker.run.fontFamily;
|
|
73887
73967
|
markerEl.style.fontSize = `${marker.run.fontSize}px`;
|
|
73888
73968
|
if (marker.run.bold) markerEl.style.fontWeight = "bold";
|
|
@@ -74270,7 +74350,7 @@ ${l}
|
|
|
74270
74350
|
buildLinkRenderData(link2) {
|
|
74271
74351
|
const dataset = buildLinkDataset(link2);
|
|
74272
74352
|
const sanitized = typeof link2.href === "string" ? sanitizeHref(link2.href) : null;
|
|
74273
|
-
const anchorHref = normalizeAnchor(link2.anchor ?? link2.name ??
|
|
74353
|
+
const anchorHref = normalizeAnchor(link2.anchor ?? link2.name ?? "");
|
|
74274
74354
|
let href = sanitized?.href ?? anchorHref;
|
|
74275
74355
|
if (link2.version === 2) {
|
|
74276
74356
|
href = appendDocLocation(href, link2.docLocation ?? null);
|
|
@@ -74448,6 +74528,10 @@ ${l}
|
|
|
74448
74528
|
const el = this.doc.createElement("div");
|
|
74449
74529
|
el.classList.add(CLASS_NAMES.line);
|
|
74450
74530
|
applyStyles$2(el, lineStyles(line.lineHeight));
|
|
74531
|
+
const styleId = block.attrs?.styleId;
|
|
74532
|
+
if (styleId) {
|
|
74533
|
+
el.setAttribute("styleid", styleId);
|
|
74534
|
+
}
|
|
74451
74535
|
const lineRange = computeLinePmRange(block, line);
|
|
74452
74536
|
if (lineRange.pmStart != null) {
|
|
74453
74537
|
el.dataset.pmStart = String(lineRange.pmStart);
|
|
@@ -74475,7 +74559,7 @@ ${l}
|
|
|
74475
74559
|
leaderEl.style.height = ld.style === "heavy" ? "2px" : "1px";
|
|
74476
74560
|
leaderEl.style.pointerEvents = "none";
|
|
74477
74561
|
leaderEl.style.zIndex = "0";
|
|
74478
|
-
if (ld.style === "dot") {
|
|
74562
|
+
if (ld.style === "dot" || ld.style === "middleDot") {
|
|
74479
74563
|
leaderEl.style.borderBottom = "1px dotted currentColor";
|
|
74480
74564
|
} else if (ld.style === "hyphen") {
|
|
74481
74565
|
leaderEl.style.borderBottom = "1px dashed currentColor";
|
|
@@ -74512,6 +74596,9 @@ ${l}
|
|
|
74512
74596
|
const segmentRun = { ...baseRun, text: segmentText };
|
|
74513
74597
|
const elem = this.renderRun(segmentRun, context, trackedConfig);
|
|
74514
74598
|
if (elem) {
|
|
74599
|
+
if (styleId) {
|
|
74600
|
+
elem.setAttribute("styleid", styleId);
|
|
74601
|
+
}
|
|
74515
74602
|
let xPos;
|
|
74516
74603
|
if (segment.x !== void 0) {
|
|
74517
74604
|
xPos = segment.x;
|
|
@@ -74537,6 +74624,9 @@ ${l}
|
|
|
74537
74624
|
runs2.forEach((run2) => {
|
|
74538
74625
|
const elem = this.renderRun(run2, context, trackedConfig);
|
|
74539
74626
|
if (elem) {
|
|
74627
|
+
if (styleId) {
|
|
74628
|
+
elem.setAttribute("styleid", styleId);
|
|
74629
|
+
}
|
|
74540
74630
|
el.appendChild(elem);
|
|
74541
74631
|
}
|
|
74542
74632
|
});
|
|
@@ -74956,6 +75046,9 @@ ${l}
|
|
|
74956
75046
|
};
|
|
74957
75047
|
const applyParagraphBlockStyles = (element2, attrs) => {
|
|
74958
75048
|
if (!attrs) return;
|
|
75049
|
+
if (attrs.styleId) {
|
|
75050
|
+
element2.setAttribute("styleid", attrs.styleId);
|
|
75051
|
+
}
|
|
74959
75052
|
if (attrs.alignment) {
|
|
74960
75053
|
element2.style.textAlign = attrs.alignment;
|
|
74961
75054
|
}
|
|
@@ -75177,6 +75270,7 @@ ${l}
|
|
|
75177
75270
|
const DEFAULT_TAB_INTERVAL_PX = twipsToPx(DEFAULT_TAB_INTERVAL_TWIPS);
|
|
75178
75271
|
const TAB_EPSILON = 0.1;
|
|
75179
75272
|
const DEFAULT_DECIMAL_SEPARATOR = ".";
|
|
75273
|
+
const ALLOWED_TAB_VALS = /* @__PURE__ */ new Set(["start", "center", "end", "decimal", "bar", "clear"]);
|
|
75180
75274
|
const roundValue = (value) => value;
|
|
75181
75275
|
function getCanvasContext() {
|
|
75182
75276
|
if (!canvasContext) {
|
|
@@ -75299,6 +75393,14 @@ ${l}
|
|
|
75299
75393
|
let tabStopCursor = 0;
|
|
75300
75394
|
let pendingTabAlignment = null;
|
|
75301
75395
|
let lastAppliedTabAlign = null;
|
|
75396
|
+
const warnedTabVals = /* @__PURE__ */ new Set();
|
|
75397
|
+
const validateTabStopVal = (stop) => {
|
|
75398
|
+
if (!ALLOWED_TAB_VALS.has(stop.val) && !warnedTabVals.has(stop.val)) {
|
|
75399
|
+
warnedTabVals.add(stop.val);
|
|
75400
|
+
return false;
|
|
75401
|
+
}
|
|
75402
|
+
return true;
|
|
75403
|
+
};
|
|
75302
75404
|
const alignSegmentAtTab = (segmentText, font, runContext) => {
|
|
75303
75405
|
if (!pendingTabAlignment || !currentLine) return;
|
|
75304
75406
|
const { target, val } = pendingTabAlignment;
|
|
@@ -75347,8 +75449,13 @@ ${l}
|
|
|
75347
75449
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, 12);
|
|
75348
75450
|
currentLine.toRun = runIndex;
|
|
75349
75451
|
currentLine.toChar = 1;
|
|
75350
|
-
|
|
75351
|
-
|
|
75452
|
+
if (stop) {
|
|
75453
|
+
validateTabStopVal(stop);
|
|
75454
|
+
pendingTabAlignment = { target, val: stop.val };
|
|
75455
|
+
} else {
|
|
75456
|
+
pendingTabAlignment = null;
|
|
75457
|
+
}
|
|
75458
|
+
if (stop && stop.leader && stop.leader !== "none") {
|
|
75352
75459
|
const leaderStyle = stop.leader;
|
|
75353
75460
|
const from2 = Math.min(originX, target);
|
|
75354
75461
|
const to = Math.max(originX, target);
|
|
@@ -75494,7 +75601,12 @@ ${l}
|
|
|
75494
75601
|
currentLine.toRun = runIndex;
|
|
75495
75602
|
currentLine.toChar = charPosInRun;
|
|
75496
75603
|
charPosInRun += 1;
|
|
75497
|
-
|
|
75604
|
+
if (stop) {
|
|
75605
|
+
validateTabStopVal(stop);
|
|
75606
|
+
pendingTabAlignment = { target, val: stop.val };
|
|
75607
|
+
} else {
|
|
75608
|
+
pendingTabAlignment = null;
|
|
75609
|
+
}
|
|
75498
75610
|
if (stop && stop.leader && stop.leader !== "none" && stop.leader !== "middleDot") {
|
|
75499
75611
|
const leaderStyle = stop.leader;
|
|
75500
75612
|
const from2 = Math.min(originX, target);
|
|
@@ -75546,10 +75658,6 @@ ${l}
|
|
|
75546
75658
|
markerTextWidth: glyphWidth,
|
|
75547
75659
|
indentLeft: wordLayout.indentLeftPx ?? 0
|
|
75548
75660
|
};
|
|
75549
|
-
console.log(
|
|
75550
|
-
"[measure] Marker:",
|
|
75551
|
-
JSON.stringify({ text: markerText, width: markerInfo.markerWidth, indent: markerInfo.indentLeft })
|
|
75552
|
-
);
|
|
75553
75661
|
}
|
|
75554
75662
|
return {
|
|
75555
75663
|
kind: "paragraph",
|
|
@@ -82378,29 +82486,6 @@ ${l}
|
|
|
82378
82486
|
};
|
|
82379
82487
|
const defaultTabDistance = 48;
|
|
82380
82488
|
const defaultLineLength = 816;
|
|
82381
|
-
const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
|
|
82382
|
-
const decorations = [];
|
|
82383
|
-
const paragraphCache = /* @__PURE__ */ new Map();
|
|
82384
|
-
const coordCache = /* @__PURE__ */ new Map();
|
|
82385
|
-
const domPosCache = /* @__PURE__ */ new Map();
|
|
82386
|
-
const end2 = to ?? doc2.content.size;
|
|
82387
|
-
doc2.nodesBetween(from2, end2, (node2, pos) => {
|
|
82388
|
-
if (node2.type.name !== "tab") return;
|
|
82389
|
-
const $pos = doc2.resolve(pos);
|
|
82390
|
-
const paragraphContext = findParagraphContext($pos, paragraphCache, helpers2);
|
|
82391
|
-
if (!paragraphContext) return;
|
|
82392
|
-
const blockParent2 = $pos.node(paragraphContext.paragraphDepth);
|
|
82393
|
-
const style2 = calculateTabStyle(node2.nodeSize, view, pos, blockParent2, paragraphContext, coordCache, domPosCache);
|
|
82394
|
-
if (style2) {
|
|
82395
|
-
decorations.push(
|
|
82396
|
-
Decoration.node(pos, pos + node2.nodeSize, {
|
|
82397
|
-
style: style2
|
|
82398
|
-
})
|
|
82399
|
-
);
|
|
82400
|
-
}
|
|
82401
|
-
});
|
|
82402
|
-
return decorations;
|
|
82403
|
-
};
|
|
82404
82489
|
function calculateTabStyle(nodeSize2, view, pos, blockParent2, paragraphContext, coordCache = null, domPosCache = null) {
|
|
82405
82490
|
let extraStyles = "";
|
|
82406
82491
|
try {
|
|
@@ -82452,14 +82537,14 @@ ${l}
|
|
|
82452
82537
|
tabWidth -= integralWidth;
|
|
82453
82538
|
}
|
|
82454
82539
|
if (tabStop.leader) {
|
|
82455
|
-
const
|
|
82540
|
+
const leaderStyles2 = {
|
|
82456
82541
|
dot: "border-bottom: 1px dotted black;",
|
|
82457
82542
|
heavy: "border-bottom: 2px solid black;",
|
|
82458
82543
|
hyphen: "border-bottom: 1px solid black;",
|
|
82459
82544
|
middleDot: "border-bottom: 1px dotted black; margin-bottom: 2px;",
|
|
82460
82545
|
underscore: "border-bottom: 1px solid black;"
|
|
82461
82546
|
};
|
|
82462
|
-
extraStyles +=
|
|
82547
|
+
extraStyles += leaderStyles2[tabStop.leader] || "";
|
|
82463
82548
|
}
|
|
82464
82549
|
}
|
|
82465
82550
|
}
|
|
@@ -82471,7 +82556,7 @@ ${l}
|
|
|
82471
82556
|
paragraphContext.accumulatedTabWidth = accumulatedTabWidth + tabWidth;
|
|
82472
82557
|
return `width: ${tabWidth}px; height: ${tabHeight}; ${extraStyles}`;
|
|
82473
82558
|
} catch (error) {
|
|
82474
|
-
|
|
82559
|
+
return null;
|
|
82475
82560
|
}
|
|
82476
82561
|
}
|
|
82477
82562
|
function findParagraphContext($pos, cache2, helpers2) {
|
|
@@ -82490,13 +82575,16 @@ ${l}
|
|
|
82490
82575
|
}
|
|
82491
82576
|
function extractParagraphContext(node2, startPos, helpers2, depth = 0) {
|
|
82492
82577
|
const paragraphProperties = getResolvedParagraphProperties(node2);
|
|
82578
|
+
const alignmentAliases = { left: "start", right: "end" };
|
|
82493
82579
|
let tabStops = [];
|
|
82494
82580
|
if (Array.isArray(paragraphProperties.tabStops)) {
|
|
82495
82581
|
tabStops = paragraphProperties.tabStops.map((stop) => {
|
|
82496
82582
|
const ref2 = stop?.tab;
|
|
82497
82583
|
if (!ref2) return stop || null;
|
|
82584
|
+
const rawType = ref2.tabType || "start";
|
|
82585
|
+
const mappedVal = alignmentAliases[rawType] || rawType;
|
|
82498
82586
|
return {
|
|
82499
|
-
val:
|
|
82587
|
+
val: mappedVal,
|
|
82500
82588
|
pos: twipsToPixels(Number(ref2.pos) || 0),
|
|
82501
82589
|
leader: ref2.leader
|
|
82502
82590
|
};
|
|
@@ -83561,6 +83649,184 @@ ${l}
|
|
|
83561
83649
|
return [CommentMarkName, Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
|
|
83562
83650
|
}
|
|
83563
83651
|
});
|
|
83652
|
+
const leaderStyles = {
|
|
83653
|
+
dot: "border-bottom: 1px dotted black;",
|
|
83654
|
+
heavy: "border-bottom: 2px solid black;",
|
|
83655
|
+
hyphen: "border-bottom: 1px solid black;",
|
|
83656
|
+
middleDot: "border-bottom: 1px dotted black; margin-bottom: 2px;",
|
|
83657
|
+
underscore: "border-bottom: 1px solid black;"
|
|
83658
|
+
};
|
|
83659
|
+
const paragraphIdFromPos = (startPos) => `para-${startPos}`;
|
|
83660
|
+
const tabIdForIndex = (paragraphId, index2) => `${paragraphId}-tab-${index2}`;
|
|
83661
|
+
function createLayoutRequest(doc2, paragraphPos, view, helpers2, revision, paragraphWidthOverride) {
|
|
83662
|
+
const $pos = doc2.resolve(paragraphPos);
|
|
83663
|
+
const paragraphCache = /* @__PURE__ */ new Map();
|
|
83664
|
+
const paragraphContext = findParagraphContext($pos, paragraphCache, helpers2);
|
|
83665
|
+
if (!paragraphContext) return null;
|
|
83666
|
+
const paragraphId = paragraphIdFromPos(paragraphContext.startPos);
|
|
83667
|
+
const paragraphNode = paragraphContext.paragraph;
|
|
83668
|
+
const { entries } = flattenParagraph(paragraphNode, paragraphContext.startPos);
|
|
83669
|
+
const spans = [];
|
|
83670
|
+
let tabIndex = 0;
|
|
83671
|
+
entries.forEach((entry, idx) => {
|
|
83672
|
+
const node2 = entry.node;
|
|
83673
|
+
const spanId = `${paragraphId}-span-${idx}`;
|
|
83674
|
+
const from2 = entry.pos;
|
|
83675
|
+
const to = entry.pos + node2.nodeSize;
|
|
83676
|
+
if (node2.type.name === "tab") {
|
|
83677
|
+
spans.push({
|
|
83678
|
+
type: "tab",
|
|
83679
|
+
spanId,
|
|
83680
|
+
tabId: tabIdForIndex(paragraphId, tabIndex++),
|
|
83681
|
+
pos: entry.pos,
|
|
83682
|
+
nodeSize: node2.nodeSize
|
|
83683
|
+
});
|
|
83684
|
+
} else if (node2.type.name === "text") {
|
|
83685
|
+
spans.push({
|
|
83686
|
+
type: "text",
|
|
83687
|
+
spanId,
|
|
83688
|
+
text: node2.text || "",
|
|
83689
|
+
style: node2.marks?.find((mark2) => mark2.type.name === "textStyle")?.attrs || {},
|
|
83690
|
+
from: from2,
|
|
83691
|
+
to
|
|
83692
|
+
});
|
|
83693
|
+
}
|
|
83694
|
+
});
|
|
83695
|
+
const tabStops = Array.isArray(paragraphContext.tabStops) ? [...paragraphContext.tabStops] : [];
|
|
83696
|
+
const hangingPx = twipsToPixels(Number(paragraphContext.indent?.hanging) || 0);
|
|
83697
|
+
if (hangingPx > 0 && paragraphContext.indentWidth != null) {
|
|
83698
|
+
tabStops.unshift({ val: "start", pos: paragraphContext.indentWidth + hangingPx, leader: "none" });
|
|
83699
|
+
}
|
|
83700
|
+
const paragraphWidth = getBlockNodeWidth(view, paragraphContext.startPos) ?? defaultLineLength;
|
|
83701
|
+
const indentWidth = paragraphContext.indentWidth ?? getIndentWidth(view, paragraphContext.startPos, paragraphContext.indent);
|
|
83702
|
+
return {
|
|
83703
|
+
paragraphId,
|
|
83704
|
+
revision,
|
|
83705
|
+
paragraphWidth,
|
|
83706
|
+
defaultTabDistance,
|
|
83707
|
+
defaultLineLength,
|
|
83708
|
+
indents: {
|
|
83709
|
+
left: twipsToPixels(Number(paragraphContext.indent?.left) || 0),
|
|
83710
|
+
right: twipsToPixels(Number(paragraphContext.indent?.right) || 0),
|
|
83711
|
+
firstLine: twipsToPixels(Number(paragraphContext.indent?.firstLine) || 0),
|
|
83712
|
+
hanging: hangingPx
|
|
83713
|
+
},
|
|
83714
|
+
tabStops,
|
|
83715
|
+
spans,
|
|
83716
|
+
indentWidth,
|
|
83717
|
+
paragraphNode
|
|
83718
|
+
};
|
|
83719
|
+
}
|
|
83720
|
+
function calculateTabLayout(request, measurement, view) {
|
|
83721
|
+
const {
|
|
83722
|
+
spans,
|
|
83723
|
+
tabStops,
|
|
83724
|
+
paragraphWidth,
|
|
83725
|
+
defaultTabDistance: defaultTabDistance2,
|
|
83726
|
+
defaultLineLength: defaultLineLength2,
|
|
83727
|
+
paragraphId,
|
|
83728
|
+
revision,
|
|
83729
|
+
indentWidth = 0,
|
|
83730
|
+
paragraphNode
|
|
83731
|
+
} = request;
|
|
83732
|
+
const tabs = {};
|
|
83733
|
+
let currentX = indentWidth;
|
|
83734
|
+
const measureText2 = (span) => {
|
|
83735
|
+
if (view && typeof span.from === "number" && typeof span.to === "number") {
|
|
83736
|
+
return measureRangeWidth(view, span.from, span.to);
|
|
83737
|
+
}
|
|
83738
|
+
return 0;
|
|
83739
|
+
};
|
|
83740
|
+
const tabHeight = paragraphNode ? calcTabHeight(paragraphNode) : void 0;
|
|
83741
|
+
for (let i2 = 0; i2 < spans.length; i2++) {
|
|
83742
|
+
const span = spans[i2];
|
|
83743
|
+
if (span.type === "text") {
|
|
83744
|
+
currentX += measureText2(span);
|
|
83745
|
+
} else if (span.type === "tab") {
|
|
83746
|
+
const followingText = collectFollowingText(spans, i2 + 1);
|
|
83747
|
+
let measureTextCallback;
|
|
83748
|
+
if (view) {
|
|
83749
|
+
const followingRange = getFollowingTextRange(spans, i2 + 1);
|
|
83750
|
+
if (followingRange) {
|
|
83751
|
+
const fullWidth = measureRangeWidth(view, followingRange.from, followingRange.to);
|
|
83752
|
+
const fullText = followingText;
|
|
83753
|
+
measureTextCallback = (text2) => {
|
|
83754
|
+
if (text2 === fullText) return fullWidth;
|
|
83755
|
+
if (fullText.length > 0) {
|
|
83756
|
+
return text2.length / fullText.length * fullWidth;
|
|
83757
|
+
}
|
|
83758
|
+
return 0;
|
|
83759
|
+
};
|
|
83760
|
+
}
|
|
83761
|
+
}
|
|
83762
|
+
const result = calculateTabWidth({
|
|
83763
|
+
currentX,
|
|
83764
|
+
tabStops,
|
|
83765
|
+
paragraphWidth,
|
|
83766
|
+
defaultTabDistance: defaultTabDistance2,
|
|
83767
|
+
defaultLineLength: defaultLineLength2,
|
|
83768
|
+
followingText,
|
|
83769
|
+
measureText: measureTextCallback
|
|
83770
|
+
});
|
|
83771
|
+
tabs[span.tabId] = {
|
|
83772
|
+
width: result.width,
|
|
83773
|
+
height: tabHeight,
|
|
83774
|
+
leader: result.leader,
|
|
83775
|
+
alignment: result.alignment,
|
|
83776
|
+
tabStopPosUsed: result.tabStopPosUsed
|
|
83777
|
+
};
|
|
83778
|
+
currentX += result.width;
|
|
83779
|
+
}
|
|
83780
|
+
}
|
|
83781
|
+
return {
|
|
83782
|
+
paragraphId,
|
|
83783
|
+
revision,
|
|
83784
|
+
tabs
|
|
83785
|
+
};
|
|
83786
|
+
}
|
|
83787
|
+
function applyLayoutResult(result, paragraph2, paragraphPos) {
|
|
83788
|
+
const decorations = [];
|
|
83789
|
+
let tabIndex = 0;
|
|
83790
|
+
paragraph2.forEach((node2, offset2) => {
|
|
83791
|
+
if (node2.type.name !== "tab") return;
|
|
83792
|
+
const pos = paragraphPos + offset2 + 1;
|
|
83793
|
+
const tabId = tabIdForIndex(result.paragraphId, tabIndex++);
|
|
83794
|
+
const layout = result.tabs[tabId];
|
|
83795
|
+
if (!layout) return;
|
|
83796
|
+
let style2 = `width: ${layout.width}px;`;
|
|
83797
|
+
if (layout.height) style2 += ` height: ${layout.height};`;
|
|
83798
|
+
if (layout.leader && leaderStyles[layout.leader]) {
|
|
83799
|
+
style2 += ` ${leaderStyles[layout.leader]}`;
|
|
83800
|
+
}
|
|
83801
|
+
decorations.push(Decoration.node(pos, pos + node2.nodeSize, { style: style2 }));
|
|
83802
|
+
});
|
|
83803
|
+
return decorations;
|
|
83804
|
+
}
|
|
83805
|
+
function collectFollowingText(spans, startIndex) {
|
|
83806
|
+
let text2 = "";
|
|
83807
|
+
for (let i2 = startIndex; i2 < spans.length; i2++) {
|
|
83808
|
+
const span = spans[i2];
|
|
83809
|
+
if (span.type === "tab") break;
|
|
83810
|
+
if (span.type === "text") text2 += span.text || "";
|
|
83811
|
+
}
|
|
83812
|
+
return text2;
|
|
83813
|
+
}
|
|
83814
|
+
function getFollowingTextRange(spans, startIndex) {
|
|
83815
|
+
let from2 = null;
|
|
83816
|
+
let to = null;
|
|
83817
|
+
for (let i2 = startIndex; i2 < spans.length; i2++) {
|
|
83818
|
+
const span = spans[i2];
|
|
83819
|
+
if (span.type === "tab") break;
|
|
83820
|
+
if (span.type === "text" && typeof span.from === "number" && typeof span.to === "number") {
|
|
83821
|
+
if (from2 === null) from2 = span.from;
|
|
83822
|
+
to = span.to;
|
|
83823
|
+
}
|
|
83824
|
+
}
|
|
83825
|
+
if (from2 !== null && to !== null) {
|
|
83826
|
+
return { from: from2, to };
|
|
83827
|
+
}
|
|
83828
|
+
return null;
|
|
83829
|
+
}
|
|
83564
83830
|
const TabNode = Node$1.create({
|
|
83565
83831
|
name: "tab",
|
|
83566
83832
|
group: "inline",
|
|
@@ -83602,87 +83868,24 @@ ${l}
|
|
|
83602
83868
|
return [];
|
|
83603
83869
|
}
|
|
83604
83870
|
const { view, helpers: helpers2 } = this.editor;
|
|
83605
|
-
const mergeRanges2 = (ranges) => {
|
|
83606
|
-
if (ranges.length === 0) return [];
|
|
83607
|
-
const sorted = ranges.slice().sort((a2, b2) => a2[0] - b2[0]);
|
|
83608
|
-
const merged = [sorted[0]];
|
|
83609
|
-
for (let i2 = 1; i2 < sorted.length; i2++) {
|
|
83610
|
-
const [start2, end2] = sorted[i2];
|
|
83611
|
-
const last = merged[merged.length - 1];
|
|
83612
|
-
if (start2 <= last[1]) {
|
|
83613
|
-
last[1] = Math.max(last[1], end2);
|
|
83614
|
-
} else {
|
|
83615
|
-
merged.push([start2, end2]);
|
|
83616
|
-
}
|
|
83617
|
-
}
|
|
83618
|
-
return merged;
|
|
83619
|
-
};
|
|
83620
83871
|
const tabPlugin = new Plugin({
|
|
83621
83872
|
name: "tabPlugin",
|
|
83622
83873
|
key: new PluginKey("tabPlugin"),
|
|
83623
83874
|
state: {
|
|
83624
83875
|
init() {
|
|
83625
|
-
return { decorations: false };
|
|
83876
|
+
return { decorations: false, revision: 0 };
|
|
83626
83877
|
},
|
|
83627
|
-
apply(tr, { decorations }, _oldState, newState) {
|
|
83878
|
+
apply(tr, { decorations, revision }, _oldState, newState) {
|
|
83628
83879
|
if (!decorations) {
|
|
83629
|
-
|
|
83630
|
-
return { decorations };
|
|
83880
|
+
const newDecorations2 = buildDecorations(newState.doc, view, helpers2, 0);
|
|
83881
|
+
return { decorations: newDecorations2, revision: 0 };
|
|
83631
83882
|
}
|
|
83632
83883
|
if (!tr.docChanged || tr.getMeta("blockNodeInitialUpdate")) {
|
|
83633
|
-
return { decorations };
|
|
83884
|
+
return { decorations, revision };
|
|
83634
83885
|
}
|
|
83635
|
-
|
|
83636
|
-
const
|
|
83637
|
-
|
|
83638
|
-
tr.steps.forEach((step, index2) => {
|
|
83639
|
-
if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1)) {
|
|
83640
|
-
return;
|
|
83641
|
-
}
|
|
83642
|
-
let hasTabInRange = false;
|
|
83643
|
-
if (step.slice?.content) {
|
|
83644
|
-
step.slice.content.descendants((node2) => {
|
|
83645
|
-
if (containsTab(node2)) {
|
|
83646
|
-
hasTabInRange = true;
|
|
83647
|
-
return false;
|
|
83648
|
-
}
|
|
83649
|
-
});
|
|
83650
|
-
}
|
|
83651
|
-
if (!hasTabInRange) {
|
|
83652
|
-
tr.docs[index2].nodesBetween(step.from, step.to, (node2) => {
|
|
83653
|
-
if (containsTab(node2)) {
|
|
83654
|
-
hasTabInRange = true;
|
|
83655
|
-
return false;
|
|
83656
|
-
}
|
|
83657
|
-
});
|
|
83658
|
-
}
|
|
83659
|
-
if (!hasTabInRange) {
|
|
83660
|
-
return;
|
|
83661
|
-
}
|
|
83662
|
-
let fromPos = step.from;
|
|
83663
|
-
let toPos = step.to;
|
|
83664
|
-
for (let i2 = index2; i2 < tr.steps.length; i2++) {
|
|
83665
|
-
const stepMap = tr.steps[i2].getMap();
|
|
83666
|
-
fromPos = stepMap.map(fromPos, -1);
|
|
83667
|
-
toPos = stepMap.map(toPos, 1);
|
|
83668
|
-
}
|
|
83669
|
-
const $from = newState.doc.resolve(fromPos);
|
|
83670
|
-
const $to = newState.doc.resolve(toPos);
|
|
83671
|
-
const start2 = $from.start(Math.min($from.depth, 1));
|
|
83672
|
-
const end2 = $to.end(Math.min($to.depth, 1));
|
|
83673
|
-
rangesToRecalculate.push([start2, end2]);
|
|
83674
|
-
});
|
|
83675
|
-
if (rangesToRecalculate.length === 0) {
|
|
83676
|
-
return { decorations };
|
|
83677
|
-
}
|
|
83678
|
-
const mergedRanges = mergeRanges2(rangesToRecalculate);
|
|
83679
|
-
mergedRanges.forEach(([start2, end2]) => {
|
|
83680
|
-
const oldDecorations = decorations.find(start2, end2);
|
|
83681
|
-
decorations = decorations.remove(oldDecorations);
|
|
83682
|
-
const newDecorations = getTabDecorations(newState.doc, view, helpers2, start2, end2);
|
|
83683
|
-
decorations = decorations.add(newState.doc, newDecorations);
|
|
83684
|
-
});
|
|
83685
|
-
return { decorations };
|
|
83886
|
+
const nextRevision = revision + 1;
|
|
83887
|
+
const newDecorations = buildDecorations(newState.doc, view, helpers2, nextRevision);
|
|
83888
|
+
return { decorations: newDecorations, revision: nextRevision };
|
|
83686
83889
|
}
|
|
83687
83890
|
},
|
|
83688
83891
|
props: {
|
|
@@ -83694,6 +83897,27 @@ ${l}
|
|
|
83694
83897
|
return [tabPlugin];
|
|
83695
83898
|
}
|
|
83696
83899
|
});
|
|
83900
|
+
function buildDecorations(doc2, view, helpers2, revision) {
|
|
83901
|
+
const decorations = [];
|
|
83902
|
+
doc2.descendants((node2, pos) => {
|
|
83903
|
+
if (node2.type.name !== "paragraph") return;
|
|
83904
|
+
let hasTab = false;
|
|
83905
|
+
node2.descendants((child) => {
|
|
83906
|
+
if (child.type.name === "tab") {
|
|
83907
|
+
hasTab = true;
|
|
83908
|
+
return false;
|
|
83909
|
+
}
|
|
83910
|
+
return true;
|
|
83911
|
+
});
|
|
83912
|
+
if (!hasTab) return;
|
|
83913
|
+
const request = createLayoutRequest(doc2, pos + 1, view, helpers2, revision);
|
|
83914
|
+
if (!request) return;
|
|
83915
|
+
const result = calculateTabLayout(request, void 0, view);
|
|
83916
|
+
const paragraphDecorations = applyLayoutResult(result, node2, pos);
|
|
83917
|
+
decorations.push(...paragraphDecorations);
|
|
83918
|
+
});
|
|
83919
|
+
return DecorationSet.create(doc2, decorations);
|
|
83920
|
+
}
|
|
83697
83921
|
const LineBreak = Node$1.create({
|
|
83698
83922
|
name: "lineBreak",
|
|
83699
83923
|
group: "inline",
|
|
@@ -97170,13 +97394,22 @@ ${l}
|
|
|
97170
97394
|
return !/\p{L}$/u.test(before.text) || !/^\p{L}/u.test(after.text);
|
|
97171
97395
|
}
|
|
97172
97396
|
class SearchState {
|
|
97173
|
-
|
|
97397
|
+
/**
|
|
97398
|
+
* Create a new SearchState instance.
|
|
97399
|
+
*
|
|
97400
|
+
* @param {SearchQuery} query - The search query to execute
|
|
97401
|
+
* @param {{from: number, to: number}|null} range - Optional range to restrict search to, or null for entire document
|
|
97402
|
+
* @param {boolean} highlight - Whether to apply CSS classes for visual highlighting of matches
|
|
97403
|
+
* @param {DecorationSet} deco - The decoration set containing match highlights
|
|
97404
|
+
*/
|
|
97405
|
+
constructor(query, range2, highlight, deco) {
|
|
97174
97406
|
this.query = query;
|
|
97175
97407
|
this.range = range2;
|
|
97408
|
+
this.highlight = highlight;
|
|
97176
97409
|
this.deco = deco;
|
|
97177
97410
|
}
|
|
97178
97411
|
}
|
|
97179
|
-
function buildMatchDeco(state2, query, range2) {
|
|
97412
|
+
function buildMatchDeco(state2, query, range2, highlight = true) {
|
|
97180
97413
|
if (!query.valid) return DecorationSet.empty;
|
|
97181
97414
|
let deco = [];
|
|
97182
97415
|
let sel = state2.selection;
|
|
@@ -97184,7 +97417,8 @@ ${l}
|
|
|
97184
97417
|
let next2 = query.findNext(state2, pos, end2);
|
|
97185
97418
|
if (!next2) break;
|
|
97186
97419
|
let cls = next2.from == sel.from && next2.to == sel.to ? "ProseMirror-active-search-match" : "ProseMirror-search-match";
|
|
97187
|
-
|
|
97420
|
+
const attrs = highlight ? { class: cls } : {};
|
|
97421
|
+
deco.push(Decoration.inline(next2.from, next2.to, attrs));
|
|
97188
97422
|
pos = next2.to;
|
|
97189
97423
|
}
|
|
97190
97424
|
return DecorationSet.create(state2.doc, deco);
|
|
@@ -97197,11 +97431,20 @@ ${l}
|
|
|
97197
97431
|
init(_config, state2) {
|
|
97198
97432
|
let query = options.initialQuery || new SearchQuery({ search: "" });
|
|
97199
97433
|
let range2 = options.initialRange || null;
|
|
97200
|
-
|
|
97434
|
+
const highlight = options.initialHighlight ?? true;
|
|
97435
|
+
return new SearchState(query, range2, highlight, buildMatchDeco(state2, query, range2, highlight));
|
|
97201
97436
|
},
|
|
97202
97437
|
apply(tr, search2, _oldState, state2) {
|
|
97203
97438
|
let set = tr.getMeta(searchKey);
|
|
97204
|
-
if (set)
|
|
97439
|
+
if (set) {
|
|
97440
|
+
const highlight = typeof set.highlight === "boolean" ? set.highlight : true;
|
|
97441
|
+
return new SearchState(
|
|
97442
|
+
set.query,
|
|
97443
|
+
set.range,
|
|
97444
|
+
highlight,
|
|
97445
|
+
buildMatchDeco(state2, set.query, set.range, highlight)
|
|
97446
|
+
);
|
|
97447
|
+
}
|
|
97205
97448
|
if (tr.docChanged || tr.selectionSet) {
|
|
97206
97449
|
let range2 = search2.range;
|
|
97207
97450
|
if (range2) {
|
|
@@ -97209,7 +97452,13 @@ ${l}
|
|
|
97209
97452
|
let to = tr.mapping.map(range2.to, -1);
|
|
97210
97453
|
range2 = from2 < to ? { from: from2, to } : null;
|
|
97211
97454
|
}
|
|
97212
|
-
|
|
97455
|
+
const highlight = typeof search2.highlight === "boolean" ? search2.highlight : true;
|
|
97456
|
+
search2 = new SearchState(
|
|
97457
|
+
search2.query,
|
|
97458
|
+
range2,
|
|
97459
|
+
highlight,
|
|
97460
|
+
buildMatchDeco(state2, search2.query, range2, highlight)
|
|
97461
|
+
);
|
|
97213
97462
|
}
|
|
97214
97463
|
return search2;
|
|
97215
97464
|
}
|
|
@@ -97223,8 +97472,12 @@ ${l}
|
|
|
97223
97472
|
let search2 = searchKey.getState(state2);
|
|
97224
97473
|
return search2 ? search2.deco : DecorationSet.empty;
|
|
97225
97474
|
}
|
|
97226
|
-
function setSearchState(tr, query, range2 = null) {
|
|
97227
|
-
|
|
97475
|
+
function setSearchState(tr, query, range2 = null, options = {}) {
|
|
97476
|
+
if (options != null && (typeof options !== "object" || Array.isArray(options))) {
|
|
97477
|
+
throw new TypeError("setSearchState options must be an object");
|
|
97478
|
+
}
|
|
97479
|
+
const highlight = typeof options?.highlight === "boolean" ? options.highlight : true;
|
|
97480
|
+
return tr.setMeta(searchKey, { query, range: range2, highlight });
|
|
97228
97481
|
}
|
|
97229
97482
|
const isRegExp = (value) => Object.prototype.toString.call(value) === "[object RegExp]";
|
|
97230
97483
|
const Search = Extension.create({
|
|
@@ -97285,14 +97538,25 @@ ${l}
|
|
|
97285
97538
|
* Search for string matches in editor content
|
|
97286
97539
|
* @category Command
|
|
97287
97540
|
* @param {String|RegExp} patternInput - Search string or pattern
|
|
97541
|
+
* @param {SearchCommandOptions} [options={}] - Options to control search behavior
|
|
97288
97542
|
* @example
|
|
97543
|
+
* // Basic search with highlighting (default)
|
|
97289
97544
|
* const matches = editor.commands.search('test string')
|
|
97545
|
+
*
|
|
97546
|
+
* // Regex search
|
|
97290
97547
|
* const regexMatches = editor.commands.search(/test/i)
|
|
97548
|
+
*
|
|
97549
|
+
* // Search without visual highlighting
|
|
97550
|
+
* const silentMatches = editor.commands.search('test', { highlight: false })
|
|
97291
97551
|
* @note Returns array of SearchMatch objects with positions and IDs
|
|
97292
97552
|
*/
|
|
97293
|
-
search: (patternInput) => (
|
|
97553
|
+
search: (patternInput, options = {}) => (
|
|
97294
97554
|
/** @returns {SearchMatch[]} */
|
|
97295
97555
|
(({ state: state2, dispatch }) => {
|
|
97556
|
+
if (options != null && (typeof options !== "object" || Array.isArray(options))) {
|
|
97557
|
+
throw new TypeError("Search options must be an object");
|
|
97558
|
+
}
|
|
97559
|
+
const highlight = typeof options?.highlight === "boolean" ? options.highlight : true;
|
|
97296
97560
|
let pattern;
|
|
97297
97561
|
let caseSensitive = false;
|
|
97298
97562
|
let regexp = false;
|
|
@@ -97319,7 +97583,7 @@ ${l}
|
|
|
97319
97583
|
regexp,
|
|
97320
97584
|
wholeWord
|
|
97321
97585
|
});
|
|
97322
|
-
const tr = setSearchState(state2.tr, query);
|
|
97586
|
+
const tr = setSearchState(state2.tr, query, null, { highlight });
|
|
97323
97587
|
dispatch(tr);
|
|
97324
97588
|
const newState = state2.apply(tr);
|
|
97325
97589
|
const decoSet = getMatchHighlights(newState);
|
|
@@ -111638,14 +111902,19 @@ ${style2}
|
|
|
111638
111902
|
});
|
|
111639
111903
|
};
|
|
111640
111904
|
updateToolbarHistory_fn = function() {
|
|
111641
|
-
if (!this.activeEditor) return;
|
|
111642
|
-
|
|
111643
|
-
|
|
111644
|
-
|
|
111645
|
-
|
|
111646
|
-
|
|
111647
|
-
|
|
111648
|
-
|
|
111905
|
+
if (!this.activeEditor?.state) return;
|
|
111906
|
+
try {
|
|
111907
|
+
if (this.activeEditor.options.ydoc) {
|
|
111908
|
+
const undoManager = yUndoPluginKey.getState(this.activeEditor.state)?.undoManager;
|
|
111909
|
+
this.undoDepth = undoManager?.undoStack.length || 0;
|
|
111910
|
+
this.redoDepth = undoManager?.redoStack.length || 0;
|
|
111911
|
+
} else {
|
|
111912
|
+
this.undoDepth = undoDepth(this.activeEditor.state);
|
|
111913
|
+
this.redoDepth = redoDepth(this.activeEditor.state);
|
|
111914
|
+
}
|
|
111915
|
+
} catch {
|
|
111916
|
+
this.undoDepth = 0;
|
|
111917
|
+
this.redoDepth = 0;
|
|
111649
111918
|
}
|
|
111650
111919
|
};
|
|
111651
111920
|
enrichTrackedChanges_fn = function(trackedChanges = []) {
|
|
@@ -131174,7 +131443,7 @@ ${style2}
|
|
|
131174
131443
|
this.config.colors = shuffleArray(this.config.colors);
|
|
131175
131444
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
131176
131445
|
this.colorIndex = 0;
|
|
131177
|
-
this.version = "1.0.0-beta.
|
|
131446
|
+
this.version = "1.0.0-beta.6";
|
|
131178
131447
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
131179
131448
|
this.superdocId = config2.superdocId || v4();
|
|
131180
131449
|
this.colors = this.config.colors;
|
|
@@ -133617,7 +133886,7 @@ ${style2}
|
|
|
133617
133886
|
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
|
133618
133887
|
);
|
|
133619
133888
|
}
|
|
133620
|
-
const
|
|
133889
|
+
const indexHjUbJ86s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
133621
133890
|
__proto__: null,
|
|
133622
133891
|
unified
|
|
133623
133892
|
}, Symbol.toStringTag, { value: "Module" }));
|