@superdoc-dev/cli 0.5.0-next.6 → 0.5.0-next.8
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/index.js +172 -104
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -171536,7 +171536,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
|
|
|
171536
171536
|
init_remark_gfm_z_sDF4ss_es();
|
|
171537
171537
|
});
|
|
171538
171538
|
|
|
171539
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
171539
|
+
// ../../packages/superdoc/dist/chunks/src-DGLGUgC-.es.js
|
|
171540
171540
|
function deleteProps(obj, propOrProps) {
|
|
171541
171541
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
171542
171542
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -217329,6 +217329,12 @@ function findCharacterAtX(block, line, x, pmStart, availableWidthOverride, align
|
|
|
217329
217329
|
pmPosition
|
|
217330
217330
|
};
|
|
217331
217331
|
}
|
|
217332
|
+
function isRtlLine(lineEl) {
|
|
217333
|
+
return getComputedStyle(lineEl).direction === "rtl";
|
|
217334
|
+
}
|
|
217335
|
+
function isVisibleRect(rect) {
|
|
217336
|
+
return rect.width > 0 && rect.height > 0;
|
|
217337
|
+
}
|
|
217332
217338
|
function clickToPositionDom(domContainer, clientX, clientY) {
|
|
217333
217339
|
log2("=== clickToPositionDom START ===");
|
|
217334
217340
|
log2("Input coords:", {
|
|
@@ -217533,64 +217539,7 @@ function processFragment(fragmentEl, viewX, viewY) {
|
|
|
217533
217539
|
}
|
|
217534
217540
|
};
|
|
217535
217541
|
}));
|
|
217536
|
-
|
|
217537
|
-
log2("No spans in line, returning lineStart:", lineStart);
|
|
217538
|
-
return lineStart;
|
|
217539
|
-
}
|
|
217540
|
-
if (viewX <= spanEls[0].getBoundingClientRect().left) {
|
|
217541
|
-
log2("Click before first span, returning lineStart:", lineStart);
|
|
217542
|
-
return lineStart;
|
|
217543
|
-
}
|
|
217544
|
-
if (viewX >= spanEls[spanEls.length - 1].getBoundingClientRect().right) {
|
|
217545
|
-
log2("Click after last span, returning lineEnd:", lineEnd);
|
|
217546
|
-
return lineEnd;
|
|
217547
|
-
}
|
|
217548
|
-
const targetEl = findSpanAtX(spanEls, viewX);
|
|
217549
|
-
if (!targetEl) {
|
|
217550
|
-
log2("No target element found, returning lineStart:", lineStart);
|
|
217551
|
-
return lineStart;
|
|
217552
|
-
}
|
|
217553
|
-
const spanStart = Number(targetEl.dataset.pmStart ?? "NaN");
|
|
217554
|
-
const spanEnd = Number(targetEl.dataset.pmEnd ?? "NaN");
|
|
217555
|
-
const targetRect = targetEl.getBoundingClientRect();
|
|
217556
|
-
log2("Target element:", {
|
|
217557
|
-
tag: targetEl.tagName,
|
|
217558
|
-
pmStart: spanStart,
|
|
217559
|
-
pmEnd: spanEnd,
|
|
217560
|
-
text: targetEl.textContent?.substring(0, 30),
|
|
217561
|
-
visibility: targetEl.style.visibility,
|
|
217562
|
-
rect: {
|
|
217563
|
-
left: targetRect.left,
|
|
217564
|
-
right: targetRect.right,
|
|
217565
|
-
width: targetRect.width
|
|
217566
|
-
},
|
|
217567
|
-
pageX: viewX,
|
|
217568
|
-
pageY: viewY
|
|
217569
|
-
});
|
|
217570
|
-
if (!Number.isFinite(spanStart) || !Number.isFinite(spanEnd)) {
|
|
217571
|
-
log2("Element has invalid PM positions");
|
|
217572
|
-
return null;
|
|
217573
|
-
}
|
|
217574
|
-
const firstChild = targetEl.firstChild;
|
|
217575
|
-
if (!firstChild || firstChild.nodeType !== Node.TEXT_NODE || !firstChild.textContent) {
|
|
217576
|
-
const elRect = targetEl.getBoundingClientRect();
|
|
217577
|
-
const closerToLeft = Math.abs(viewX - elRect.left) <= Math.abs(viewX - elRect.right);
|
|
217578
|
-
const snapPos = closerToLeft ? spanStart : spanEnd;
|
|
217579
|
-
log2("Empty/non-text element, snapping to:", {
|
|
217580
|
-
closerToLeft,
|
|
217581
|
-
snapPos
|
|
217582
|
-
});
|
|
217583
|
-
return snapPos;
|
|
217584
|
-
}
|
|
217585
|
-
const textNode = firstChild;
|
|
217586
|
-
const charIndex = findCharIndexAtX(textNode, targetEl, viewX);
|
|
217587
|
-
const pos = mapCharIndexToPm(spanStart, spanEnd, textNode.length, charIndex);
|
|
217588
|
-
log2("Character position:", {
|
|
217589
|
-
charIndex,
|
|
217590
|
-
spanStart,
|
|
217591
|
-
finalPos: pos
|
|
217592
|
-
});
|
|
217593
|
-
return pos;
|
|
217542
|
+
return resolveLinePosition(lineEl, lineStart, lineEnd, spanEls, viewX);
|
|
217594
217543
|
}
|
|
217595
217544
|
function mapCharIndexToPm(spanStart, spanEnd, textLength, charIndex) {
|
|
217596
217545
|
if (!Number.isFinite(spanStart) || !Number.isFinite(spanEnd))
|
|
@@ -217641,17 +217590,28 @@ function processLineElement(lineEl, viewX) {
|
|
|
217641
217590
|
}
|
|
217642
217591
|
};
|
|
217643
217592
|
}));
|
|
217593
|
+
return resolveLinePosition(lineEl, lineStart, lineEnd, spanEls, viewX);
|
|
217594
|
+
}
|
|
217595
|
+
function resolveLinePosition(lineEl, lineStart, lineEnd, spanEls, viewX) {
|
|
217644
217596
|
if (spanEls.length === 0) {
|
|
217645
217597
|
log2("No spans in line, returning lineStart:", lineStart);
|
|
217646
217598
|
return lineStart;
|
|
217647
217599
|
}
|
|
217648
|
-
|
|
217649
|
-
|
|
217650
|
-
|
|
217651
|
-
|
|
217652
|
-
|
|
217653
|
-
|
|
217654
|
-
|
|
217600
|
+
const rtl = isRtlLine(lineEl);
|
|
217601
|
+
const allRects = spanEls.map((el) => el.getBoundingClientRect());
|
|
217602
|
+
const visibleRects = allRects.filter(isVisibleRect);
|
|
217603
|
+
const boundsRects = visibleRects.length > 0 ? visibleRects : allRects;
|
|
217604
|
+
const visualLeft = Math.min(...boundsRects.map((r$1) => r$1.left));
|
|
217605
|
+
const visualRight = Math.max(...boundsRects.map((r$1) => r$1.right));
|
|
217606
|
+
if (viewX <= visualLeft) {
|
|
217607
|
+
const pos$1 = rtl ? lineEnd : lineStart;
|
|
217608
|
+
log2("Click to visual left of all spans, returning:", pos$1);
|
|
217609
|
+
return pos$1;
|
|
217610
|
+
}
|
|
217611
|
+
if (viewX >= visualRight) {
|
|
217612
|
+
const pos$1 = rtl ? lineStart : lineEnd;
|
|
217613
|
+
log2("Click to visual right of all spans, returning:", pos$1);
|
|
217614
|
+
return pos$1;
|
|
217655
217615
|
}
|
|
217656
217616
|
const targetEl = findSpanAtX(spanEls, viewX);
|
|
217657
217617
|
if (!targetEl) {
|
|
@@ -217660,18 +217620,20 @@ function processLineElement(lineEl, viewX) {
|
|
|
217660
217620
|
}
|
|
217661
217621
|
const spanStart = Number(targetEl.dataset.pmStart ?? "NaN");
|
|
217662
217622
|
const spanEnd = Number(targetEl.dataset.pmEnd ?? "NaN");
|
|
217663
|
-
const targetRect = targetEl.getBoundingClientRect();
|
|
217664
217623
|
log2("Target element:", {
|
|
217665
217624
|
tag: targetEl.tagName,
|
|
217666
217625
|
pmStart: spanStart,
|
|
217667
217626
|
pmEnd: spanEnd,
|
|
217668
217627
|
text: targetEl.textContent?.substring(0, 30),
|
|
217669
217628
|
visibility: targetEl.style.visibility,
|
|
217670
|
-
rect: {
|
|
217671
|
-
|
|
217672
|
-
|
|
217673
|
-
|
|
217674
|
-
|
|
217629
|
+
rect: (() => {
|
|
217630
|
+
const r$1 = targetEl.getBoundingClientRect();
|
|
217631
|
+
return {
|
|
217632
|
+
left: r$1.left,
|
|
217633
|
+
right: r$1.right,
|
|
217634
|
+
width: r$1.width
|
|
217635
|
+
};
|
|
217636
|
+
})()
|
|
217675
217637
|
});
|
|
217676
217638
|
if (!Number.isFinite(spanStart) || !Number.isFinite(spanEnd)) {
|
|
217677
217639
|
log2("Element has invalid PM positions");
|
|
@@ -217681,18 +217643,21 @@ function processLineElement(lineEl, viewX) {
|
|
|
217681
217643
|
if (!firstChild || firstChild.nodeType !== Node.TEXT_NODE || !firstChild.textContent) {
|
|
217682
217644
|
const elRect = targetEl.getBoundingClientRect();
|
|
217683
217645
|
const closerToLeft = Math.abs(viewX - elRect.left) <= Math.abs(viewX - elRect.right);
|
|
217684
|
-
const snapPos = closerToLeft ? spanStart : spanEnd;
|
|
217646
|
+
const snapPos = rtl ? closerToLeft ? spanEnd : spanStart : closerToLeft ? spanStart : spanEnd;
|
|
217685
217647
|
log2("Empty/non-text element, snapping to:", {
|
|
217686
217648
|
closerToLeft,
|
|
217649
|
+
rtl,
|
|
217687
217650
|
snapPos
|
|
217688
217651
|
});
|
|
217689
217652
|
return snapPos;
|
|
217690
217653
|
}
|
|
217691
|
-
const
|
|
217692
|
-
const
|
|
217654
|
+
const textNode = firstChild;
|
|
217655
|
+
const charIndex = findCharIndexAtX(textNode, viewX, rtl);
|
|
217656
|
+
const pos = mapCharIndexToPm(spanStart, spanEnd, textNode.length, charIndex);
|
|
217693
217657
|
log2("Character position:", {
|
|
217694
217658
|
charIndex,
|
|
217695
217659
|
spanStart,
|
|
217660
|
+
rtl,
|
|
217696
217661
|
finalPos: pos
|
|
217697
217662
|
});
|
|
217698
217663
|
return pos;
|
|
@@ -217728,9 +217693,12 @@ function findSpanAtX(spanEls, viewX) {
|
|
|
217728
217693
|
if (spanEls.length === 0)
|
|
217729
217694
|
return null;
|
|
217730
217695
|
let targetSpan = spanEls[0];
|
|
217696
|
+
let minDist = Infinity;
|
|
217731
217697
|
for (let i4 = 0;i4 < spanEls.length; i4++) {
|
|
217732
217698
|
const span = spanEls[i4];
|
|
217733
217699
|
const rect = span.getBoundingClientRect();
|
|
217700
|
+
if (!isVisibleRect(rect))
|
|
217701
|
+
continue;
|
|
217734
217702
|
if (viewX >= rect.left && viewX <= rect.right) {
|
|
217735
217703
|
log2("findSpanAtX: Found containing element at index", i4, {
|
|
217736
217704
|
tag: span.tagName,
|
|
@@ -217744,8 +217712,11 @@ function findSpanAtX(spanEls, viewX) {
|
|
|
217744
217712
|
});
|
|
217745
217713
|
return span;
|
|
217746
217714
|
}
|
|
217747
|
-
|
|
217715
|
+
const dist = Math.min(Math.abs(viewX - rect.left), Math.abs(viewX - rect.right));
|
|
217716
|
+
if (dist < minDist) {
|
|
217717
|
+
minDist = dist;
|
|
217748
217718
|
targetSpan = span;
|
|
217719
|
+
}
|
|
217749
217720
|
}
|
|
217750
217721
|
log2("findSpanAtX: No containing element, using nearest:", {
|
|
217751
217722
|
tag: targetSpan.tagName,
|
|
@@ -217755,36 +217726,63 @@ function findSpanAtX(spanEls, viewX) {
|
|
|
217755
217726
|
});
|
|
217756
217727
|
return targetSpan;
|
|
217757
217728
|
}
|
|
217758
|
-
function findCharIndexAtX(textNode,
|
|
217729
|
+
function findCharIndexAtX(textNode, targetX, rtl) {
|
|
217759
217730
|
const text5 = textNode.textContent ?? "";
|
|
217760
|
-
|
|
217731
|
+
if (text5.length === 0)
|
|
217732
|
+
return 0;
|
|
217733
|
+
const container = textNode.parentElement;
|
|
217734
|
+
if (!container)
|
|
217735
|
+
return 0;
|
|
217736
|
+
const containerRect = container.getBoundingClientRect();
|
|
217737
|
+
const caretIndex = caretOffsetFromPoint(targetX, containerRect.top + containerRect.height / 2, textNode);
|
|
217738
|
+
if (caretIndex != null) {
|
|
217739
|
+
log2("findCharIndexAtX: caret API returned", caretIndex);
|
|
217740
|
+
return caretIndex;
|
|
217741
|
+
}
|
|
217742
|
+
log2("findCharIndexAtX: falling back to range binary search, rtl =", rtl);
|
|
217761
217743
|
const range = document.createRange();
|
|
217744
|
+
const measureX = (i4) => {
|
|
217745
|
+
if (i4 <= 0)
|
|
217746
|
+
return rtl ? containerRect.right : containerRect.left;
|
|
217747
|
+
range.setStart(textNode, 0);
|
|
217748
|
+
range.setEnd(textNode, i4);
|
|
217749
|
+
const r$1 = range.getBoundingClientRect();
|
|
217750
|
+
return rtl ? r$1.left : r$1.right;
|
|
217751
|
+
};
|
|
217762
217752
|
let lo = 0;
|
|
217763
217753
|
let hi = text5.length;
|
|
217764
217754
|
while (lo < hi) {
|
|
217765
217755
|
const mid = Math.floor((lo + hi) / 2);
|
|
217766
|
-
|
|
217767
|
-
|
|
217768
|
-
if (baseLeft + range.getBoundingClientRect().width < targetX)
|
|
217756
|
+
const x = measureX(mid);
|
|
217757
|
+
if (rtl ? x > targetX : x < targetX)
|
|
217769
217758
|
lo = mid + 1;
|
|
217770
217759
|
else
|
|
217771
217760
|
hi = mid;
|
|
217772
217761
|
}
|
|
217773
217762
|
const index2 = Math.max(0, Math.min(text5.length, lo));
|
|
217774
|
-
const
|
|
217775
|
-
range.setStart(textNode, 0);
|
|
217776
|
-
range.setEnd(textNode, i4);
|
|
217777
|
-
return baseLeft + range.getBoundingClientRect().width;
|
|
217778
|
-
};
|
|
217779
|
-
const xAt = measureAt(index2);
|
|
217763
|
+
const xAt = measureX(index2);
|
|
217780
217764
|
const distAt = Math.abs(xAt - targetX);
|
|
217781
217765
|
if (index2 > 0) {
|
|
217782
|
-
const xPrev =
|
|
217766
|
+
const xPrev = measureX(index2 - 1);
|
|
217783
217767
|
if (Math.abs(xPrev - targetX) < distAt)
|
|
217784
217768
|
return index2 - 1;
|
|
217785
217769
|
}
|
|
217786
217770
|
return index2;
|
|
217787
217771
|
}
|
|
217772
|
+
function caretOffsetFromPoint(x, y$1, expectedNode) {
|
|
217773
|
+
const doc$12 = document;
|
|
217774
|
+
if (typeof doc$12.caretPositionFromPoint === "function") {
|
|
217775
|
+
const cp = doc$12.caretPositionFromPoint(x, y$1);
|
|
217776
|
+
if (cp && cp.offsetNode === expectedNode)
|
|
217777
|
+
return cp.offset;
|
|
217778
|
+
}
|
|
217779
|
+
if (typeof doc$12.caretRangeFromPoint === "function") {
|
|
217780
|
+
const r$1 = doc$12.caretRangeFromPoint(x, y$1);
|
|
217781
|
+
if (r$1 && r$1.startContainer === expectedNode)
|
|
217782
|
+
return r$1.startOffset;
|
|
217783
|
+
}
|
|
217784
|
+
return null;
|
|
217785
|
+
}
|
|
217788
217786
|
function getWordLayoutConfig(block) {
|
|
217789
217787
|
if (!block || block.kind !== "paragraph")
|
|
217790
217788
|
return;
|
|
@@ -238367,6 +238365,14 @@ var Node$13 = class Node$14 {
|
|
|
238367
238365
|
left: borderValueToSpec(cellBounds.touchesLeftEdge ? tableBorders?.left : tableBorders?.insideV),
|
|
238368
238366
|
right: borderValueToSpec(cellBounds.touchesRightEdge ? tableBorders?.right : null)
|
|
238369
238367
|
};
|
|
238368
|
+
}, swapCellBordersLR = (borders) => {
|
|
238369
|
+
if (!borders)
|
|
238370
|
+
return;
|
|
238371
|
+
return {
|
|
238372
|
+
...borders,
|
|
238373
|
+
left: borders.right,
|
|
238374
|
+
right: borders.left
|
|
238375
|
+
};
|
|
238370
238376
|
}, applyInlineStyles = (el, styles) => {
|
|
238371
238377
|
Object.entries(styles).forEach(([key$1, value]) => {
|
|
238372
238378
|
if (value != null && value !== "" && key$1 in el.style)
|
|
@@ -238415,16 +238421,16 @@ var Node$13 = class Node$14 {
|
|
|
238415
238421
|
applyStyles: applyInlineStyles
|
|
238416
238422
|
});
|
|
238417
238423
|
}, renderTableCell = (deps) => {
|
|
238418
|
-
const { doc: doc$12, x, y: y$1, rowHeight, cellMeasure, cell: cell2, borders, useDefaultBorder, renderLine, captureLineSnapshot, renderDrawingContent, context, applySdtDataset, tableSdt, tableIndent, cellWidth, fromLine, toLine } = deps;
|
|
238424
|
+
const { doc: doc$12, x, y: y$1, rowHeight, cellMeasure, cell: cell2, borders, useDefaultBorder, renderLine, captureLineSnapshot, renderDrawingContent, context, applySdtDataset, tableSdt, tableIndent, isRtl, cellWidth, fromLine, toLine } = deps;
|
|
238419
238425
|
const padding = cell2?.attrs?.padding || {
|
|
238420
238426
|
top: 0,
|
|
238421
238427
|
left: 4,
|
|
238422
238428
|
right: 4,
|
|
238423
238429
|
bottom: 0
|
|
238424
238430
|
};
|
|
238425
|
-
const paddingLeft = padding.left ?? 4;
|
|
238431
|
+
const paddingLeft = isRtl ? padding.right ?? 4 : padding.left ?? 4;
|
|
238426
238432
|
const paddingTop = padding.top ?? 0;
|
|
238427
|
-
const paddingRight = padding.right ?? 4;
|
|
238433
|
+
const paddingRight = isRtl ? padding.left ?? 4 : padding.right ?? 4;
|
|
238428
238434
|
const paddingBottom = padding.bottom ?? 0;
|
|
238429
238435
|
const cellEl = doc$12.createElement("div");
|
|
238430
238436
|
cellEl.style.position = "absolute";
|
|
@@ -238923,7 +238929,7 @@ var Node$13 = class Node$14 {
|
|
|
238923
238929
|
left: baseBorders.left
|
|
238924
238930
|
};
|
|
238925
238931
|
}, renderTableRow = (deps) => {
|
|
238926
|
-
const { doc: doc$12, container, rowIndex, y: y$1, rowMeasure, row: row2, totalRows, tableBorders, columnWidths, allRowHeights, tableIndent, context, renderLine, captureLineSnapshot, renderDrawingContent, applySdtDataset, tableSdt, continuesFromPrev, continuesOnNext, partialRow, cellSpacingPx = 0 } = deps;
|
|
238932
|
+
const { doc: doc$12, container, rowIndex, y: y$1, rowMeasure, row: row2, totalRows, tableBorders, columnWidths, allRowHeights, tableIndent, isRtl, context, renderLine, captureLineSnapshot, renderDrawingContent, applySdtDataset, tableSdt, continuesFromPrev, continuesOnNext, partialRow, cellSpacingPx = 0 } = deps;
|
|
238927
238933
|
const totalCols = columnWidths.length;
|
|
238928
238934
|
const calculateXPosition = (gridColumnStart) => {
|
|
238929
238935
|
let x = cellSpacingPx;
|
|
@@ -238931,6 +238937,12 @@ var Node$13 = class Node$14 {
|
|
|
238931
238937
|
x += columnWidths[i4] + cellSpacingPx;
|
|
238932
238938
|
return x;
|
|
238933
238939
|
};
|
|
238940
|
+
let tableContentWidth = 0;
|
|
238941
|
+
if (isRtl) {
|
|
238942
|
+
tableContentWidth = cellSpacingPx;
|
|
238943
|
+
for (let i4 = 0;i4 < columnWidths.length; i4++)
|
|
238944
|
+
tableContentWidth += columnWidths[i4] + cellSpacingPx;
|
|
238945
|
+
}
|
|
238934
238946
|
const calculateRowspanHeight = (startRowIndex, rowSpan) => {
|
|
238935
238947
|
let totalHeight = 0;
|
|
238936
238948
|
for (let i4 = 0;i4 < rowSpan && startRowIndex + i4 < allRowHeights.length; i4++)
|
|
@@ -238949,7 +238961,7 @@ var Node$13 = class Node$14 {
|
|
|
238949
238961
|
const gridColumnStart = cellMeasure.gridColumnStart ?? cellIndex;
|
|
238950
238962
|
const rowSpan = cellMeasure.rowSpan ?? 1;
|
|
238951
238963
|
const colSpan = cellMeasure.colSpan ?? 1;
|
|
238952
|
-
|
|
238964
|
+
let x = calculateXPosition(gridColumnStart);
|
|
238953
238965
|
const cellBordersAttr = cell2?.attrs?.borders;
|
|
238954
238966
|
const resolvedBorders = resolveRenderedCellBorders({
|
|
238955
238967
|
cellBorders: cellBordersAttr,
|
|
@@ -238967,6 +238979,7 @@ var Node$13 = class Node$14 {
|
|
|
238967
238979
|
continuesFromPrev: continuesFromPrev === true,
|
|
238968
238980
|
continuesOnNext: continuesOnNext === true
|
|
238969
238981
|
});
|
|
238982
|
+
const finalBorders = isRtl && resolvedBorders ? swapCellBordersLR(resolvedBorders) : resolvedBorders;
|
|
238970
238983
|
let cellHeight;
|
|
238971
238984
|
if (partialRow)
|
|
238972
238985
|
cellHeight = partialRow.partialHeight;
|
|
@@ -238977,6 +238990,8 @@ var Node$13 = class Node$14 {
|
|
|
238977
238990
|
const fromLine = partialRow?.fromLineByCell?.[cellIndex];
|
|
238978
238991
|
const toLine = partialRow?.toLineByCell?.[cellIndex];
|
|
238979
238992
|
const computedCellWidth = calculateColspanWidth(gridColumnStart, colSpan);
|
|
238993
|
+
if (isRtl && computedCellWidth > 0)
|
|
238994
|
+
x = tableContentWidth - x - computedCellWidth;
|
|
238980
238995
|
const { cellElement } = renderTableCell({
|
|
238981
238996
|
doc: doc$12,
|
|
238982
238997
|
x,
|
|
@@ -238984,7 +238999,7 @@ var Node$13 = class Node$14 {
|
|
|
238984
238999
|
rowHeight: cellHeight,
|
|
238985
239000
|
cellMeasure,
|
|
238986
239001
|
cell: cell2,
|
|
238987
|
-
borders:
|
|
239002
|
+
borders: finalBorders,
|
|
238988
239003
|
useDefaultBorder: false,
|
|
238989
239004
|
renderLine,
|
|
238990
239005
|
captureLineSnapshot,
|
|
@@ -238995,6 +239010,7 @@ var Node$13 = class Node$14 {
|
|
|
238995
239010
|
fromLine,
|
|
238996
239011
|
toLine,
|
|
238997
239012
|
tableIndent,
|
|
239013
|
+
isRtl,
|
|
238998
239014
|
cellWidth: computedCellWidth > 0 ? computedCellWidth : undefined
|
|
238999
239015
|
});
|
|
239000
239016
|
container.appendChild(cellElement);
|
|
@@ -239032,6 +239048,7 @@ var Node$13 = class Node$14 {
|
|
|
239032
239048
|
const tableBorders = block.attrs?.borders;
|
|
239033
239049
|
const tableIndentValue = block.attrs?.tableIndent?.width;
|
|
239034
239050
|
const tableIndent = typeof tableIndentValue === "number" && Number.isFinite(tableIndentValue) ? tableIndentValue : 0;
|
|
239051
|
+
const isRtl = block.attrs?.tableProperties?.rightToLeft === true;
|
|
239035
239052
|
const container = doc$12.createElement("div");
|
|
239036
239053
|
container.classList.add(CLASS_NAMES$1.fragment);
|
|
239037
239054
|
applyStyles$2(container, fragmentStyles);
|
|
@@ -239132,9 +239149,9 @@ var Node$13 = class Node$14 {
|
|
|
239132
239149
|
container.setAttribute("data-sd-block-id", block.id);
|
|
239133
239150
|
if ((block.attrs?.borderCollapse ?? (block.attrs?.cellSpacing != null ? "separate" : "collapse")) === "separate" && block.attrs?.cellSpacing && tableBorders) {
|
|
239134
239151
|
applyBorder(container, "Top", borderValueToSpec(tableBorders.top));
|
|
239135
|
-
applyBorder(container, "Right", borderValueToSpec(tableBorders.right));
|
|
239152
|
+
applyBorder(container, "Right", borderValueToSpec(isRtl ? tableBorders.left : tableBorders.right));
|
|
239136
239153
|
applyBorder(container, "Bottom", borderValueToSpec(tableBorders.bottom));
|
|
239137
|
-
applyBorder(container, "Left", borderValueToSpec(tableBorders.left));
|
|
239154
|
+
applyBorder(container, "Left", borderValueToSpec(isRtl ? tableBorders.right : tableBorders.left));
|
|
239138
239155
|
}
|
|
239139
239156
|
const allRowHeights = measure.rows.map((r$1, idx) => {
|
|
239140
239157
|
if (fragment2.partialRow && fragment2.partialRow.rowIndex === idx)
|
|
@@ -239159,6 +239176,7 @@ var Node$13 = class Node$14 {
|
|
|
239159
239176
|
columnWidths: effectiveColumnWidths,
|
|
239160
239177
|
allRowHeights,
|
|
239161
239178
|
tableIndent,
|
|
239179
|
+
isRtl,
|
|
239162
239180
|
context,
|
|
239163
239181
|
renderLine,
|
|
239164
239182
|
captureLineSnapshot,
|
|
@@ -239193,6 +239211,15 @@ var Node$13 = class Node$14 {
|
|
|
239193
239211
|
let ghostWidth = 0;
|
|
239194
239212
|
for (let i4 = gridCol;i4 < gridCol + colSpan && i4 < effectiveColumnWidths.length; i4++)
|
|
239195
239213
|
ghostWidth += effectiveColumnWidths[i4];
|
|
239214
|
+
if (isRtl && ghostWidth > 0) {
|
|
239215
|
+
let totalWidth = cellSpacingPx;
|
|
239216
|
+
for (let i4 = 0;i4 < effectiveColumnWidths.length; i4++)
|
|
239217
|
+
totalWidth += effectiveColumnWidths[i4] + cellSpacingPx;
|
|
239218
|
+
let ghostXWithSpacing = cellSpacingPx;
|
|
239219
|
+
for (let i4 = 0;i4 < gridCol && i4 < effectiveColumnWidths.length; i4++)
|
|
239220
|
+
ghostXWithSpacing += effectiveColumnWidths[i4] + cellSpacingPx;
|
|
239221
|
+
ghostX = totalWidth - ghostXWithSpacing - ghostWidth;
|
|
239222
|
+
}
|
|
239196
239223
|
const effectiveEnd = Math.min(spanEndRow, fragment2.toRow);
|
|
239197
239224
|
let ghostHeight = 0;
|
|
239198
239225
|
for (let ri = fragment2.fromRow;ri < effectiveEnd; ri++)
|
|
@@ -239220,11 +239247,20 @@ var Node$13 = class Node$14 {
|
|
|
239220
239247
|
});
|
|
239221
239248
|
const cellEndsWithinFragment = effectiveEnd <= fragment2.toRow && spanEndRow <= fragment2.toRow;
|
|
239222
239249
|
if (tableBorders) {
|
|
239223
|
-
|
|
239224
|
-
|
|
239225
|
-
|
|
239226
|
-
|
|
239227
|
-
|
|
239250
|
+
const topB = (explicit ? cellBordersAttr.top : undefined) ?? borderValueToSpec(tableBorders.top);
|
|
239251
|
+
let leftB = (explicit ? cellBordersAttr.left : undefined) ?? borderValueToSpec(cellBounds.touchesLeftEdge ? tableBorders.left : tableBorders.insideV);
|
|
239252
|
+
let rightB = (explicit ? cellBordersAttr.right : undefined) ?? borderValueToSpec(cellBounds.touchesRightEdge ? tableBorders.right : tableBorders.insideV);
|
|
239253
|
+
const bottomB = cellEndsWithinFragment ? (explicit ? cellBordersAttr.bottom : undefined) ?? borderValueToSpec(cellBounds.touchesBottomEdge ? tableBorders.bottom : tableBorders.insideH) : undefined;
|
|
239254
|
+
if (isRtl) {
|
|
239255
|
+
const tmp = leftB;
|
|
239256
|
+
leftB = rightB;
|
|
239257
|
+
rightB = tmp;
|
|
239258
|
+
}
|
|
239259
|
+
applyBorder(ghostDiv, "Top", topB);
|
|
239260
|
+
applyBorder(ghostDiv, "Left", leftB);
|
|
239261
|
+
applyBorder(ghostDiv, "Right", rightB);
|
|
239262
|
+
if (bottomB)
|
|
239263
|
+
applyBorder(ghostDiv, "Bottom", bottomB);
|
|
239228
239264
|
}
|
|
239229
239265
|
if (srcCell?.attrs?.background)
|
|
239230
239266
|
ghostDiv.style.backgroundColor = srcCell.attrs.background;
|
|
@@ -239252,6 +239288,7 @@ var Node$13 = class Node$14 {
|
|
|
239252
239288
|
columnWidths: effectiveColumnWidths,
|
|
239253
239289
|
allRowHeights,
|
|
239254
239290
|
tableIndent,
|
|
239291
|
+
isRtl,
|
|
239255
239292
|
context,
|
|
239256
239293
|
renderLine,
|
|
239257
239294
|
captureLineSnapshot,
|
|
@@ -252291,7 +252328,7 @@ var Node$13 = class Node$14 {
|
|
|
252291
252328
|
return;
|
|
252292
252329
|
console.log(...args$1);
|
|
252293
252330
|
}, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
|
|
252294
|
-
var
|
|
252331
|
+
var init_src_DGLGUgC_es = __esm(() => {
|
|
252295
252332
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
252296
252333
|
init_SuperConverter_CXcZg9Os_es();
|
|
252297
252334
|
init_jszip_ChlR43oI_es();
|
|
@@ -254303,6 +254340,16 @@ ${err.toString()}`);
|
|
|
254303
254340
|
content3 = schema.nodeFromJSON(options.json);
|
|
254304
254341
|
if (!content3)
|
|
254305
254342
|
content3 = schema.text(" ");
|
|
254343
|
+
const runType = schema.nodes.run;
|
|
254344
|
+
if (runType && !options.json && content3.isText) {
|
|
254345
|
+
const formattingState = getFormattingStateAtPos(state, from$1, editor, { storedMarks: state.storedMarks || null });
|
|
254346
|
+
const runProperties = formattingState.inlineRunProperties || null;
|
|
254347
|
+
if (formattingState.resolvedMarks?.length) {
|
|
254348
|
+
const mergedMarks = formattingState.resolvedMarks.reduce((set, mark2) => mark2.addToSet(set), content3.marks);
|
|
254349
|
+
content3 = content3.mark(mergedMarks);
|
|
254350
|
+
}
|
|
254351
|
+
content3 = runType.create({ runProperties }, content3);
|
|
254352
|
+
}
|
|
254306
254353
|
let tag = options.attrs?.tag || "inline_text_sdt";
|
|
254307
254354
|
if (options.attrs?.group)
|
|
254308
254355
|
tag = createTagObject({ group: options.attrs.group });
|
|
@@ -254317,7 +254364,28 @@ ${err.toString()}`);
|
|
|
254317
254364
|
const parent = findParentNode((node$1) => node$1.type.name === "structuredContent")(state.selection);
|
|
254318
254365
|
if (parent)
|
|
254319
254366
|
from$1 = to = parent.pos + parent.node.nodeSize;
|
|
254320
|
-
|
|
254367
|
+
const $from = state.doc.resolve(from$1);
|
|
254368
|
+
const $to = from$1 === to ? $from : state.doc.resolve(to);
|
|
254369
|
+
if (runType && $from.parent.type === runType && $from.parent === $to.parent) {
|
|
254370
|
+
const runDepth = $from.depth;
|
|
254371
|
+
const runStart = $from.before(runDepth);
|
|
254372
|
+
const runEnd = $from.after(runDepth);
|
|
254373
|
+
const parentRun = $from.parent;
|
|
254374
|
+
const startOffset = $from.parentOffset;
|
|
254375
|
+
const endOffset = $to.parentOffset;
|
|
254376
|
+
const leftContent = parentRun.content.cut(0, startOffset);
|
|
254377
|
+
const rightContent = parentRun.content.cut(endOffset);
|
|
254378
|
+
const fragments = [];
|
|
254379
|
+
if (leftContent.size > 0)
|
|
254380
|
+
fragments.push(runType.create(parentRun.attrs, leftContent, parentRun.marks));
|
|
254381
|
+
fragments.push(node3);
|
|
254382
|
+
if (rightContent.size > 0)
|
|
254383
|
+
fragments.push(runType.create(parentRun.attrs, rightContent, parentRun.marks));
|
|
254384
|
+
tr.replaceWith(runStart, runEnd, fragments);
|
|
254385
|
+
const cursorPos = runStart + (leftContent.size > 0 ? leftContent.size + 2 : 0) + node3.nodeSize;
|
|
254386
|
+
tr.setSelection(TextSelection2.create(tr.doc, cursorPos));
|
|
254387
|
+
} else
|
|
254388
|
+
tr.replaceWith(from$1, to, node3);
|
|
254321
254389
|
}
|
|
254322
254390
|
return true;
|
|
254323
254391
|
},
|
|
@@ -285775,7 +285843,7 @@ var init_zipper_YmNpPIyc_es = __esm(() => {
|
|
|
285775
285843
|
|
|
285776
285844
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
285777
285845
|
var init_super_editor_es = __esm(() => {
|
|
285778
|
-
|
|
285846
|
+
init_src_DGLGUgC_es();
|
|
285779
285847
|
init_SuperConverter_CXcZg9Os_es();
|
|
285780
285848
|
init_jszip_ChlR43oI_es();
|
|
285781
285849
|
init_xml_js_40FWvL78_es();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.5.0-next.
|
|
3
|
+
"version": "0.5.0-next.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
"typescript": "^5.9.2",
|
|
27
27
|
"@superdoc/document-api": "0.0.1",
|
|
28
28
|
"@superdoc/pm-adapter": "0.0.0",
|
|
29
|
-
"
|
|
30
|
-
"superdoc": "
|
|
29
|
+
"superdoc": "1.23.0",
|
|
30
|
+
"@superdoc/super-editor": "0.0.1"
|
|
31
31
|
},
|
|
32
32
|
"module": "src/index.ts",
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
|
-
"@superdoc-dev/cli-darwin-arm64": "0.5.0-next.
|
|
38
|
-
"@superdoc-dev/cli-
|
|
39
|
-
"@superdoc-dev/cli-
|
|
40
|
-
"@superdoc-dev/cli-linux-arm64": "0.5.0-next.
|
|
41
|
-
"@superdoc-dev/cli-windows-x64": "0.5.0-next.
|
|
37
|
+
"@superdoc-dev/cli-darwin-arm64": "0.5.0-next.8",
|
|
38
|
+
"@superdoc-dev/cli-darwin-x64": "0.5.0-next.8",
|
|
39
|
+
"@superdoc-dev/cli-linux-x64": "0.5.0-next.8",
|
|
40
|
+
"@superdoc-dev/cli-linux-arm64": "0.5.0-next.8",
|
|
41
|
+
"@superdoc-dev/cli-windows-x64": "0.5.0-next.8"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"predev": "node scripts/ensure-superdoc-build.js",
|