@superdoc-dev/mcp 0.3.0-next.16 → 0.3.0-next.17
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 +292 -115
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -198675,7 +198675,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
198675
198675
|
init_remark_gfm_BhnWr3yf_es();
|
|
198676
198676
|
});
|
|
198677
198677
|
|
|
198678
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
198678
|
+
// ../../packages/superdoc/dist/chunks/src-BzRjWTpH.es.js
|
|
198679
198679
|
function deleteProps(obj, propOrProps) {
|
|
198680
198680
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
198681
198681
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -198887,6 +198887,18 @@ function calculateTabWidth(params$1) {
|
|
|
198887
198887
|
tabStopPosUsed: nextStop.pos
|
|
198888
198888
|
};
|
|
198889
198889
|
}
|
|
198890
|
+
function resolveTableWidthAttr(value) {
|
|
198891
|
+
if (!value || typeof value !== "object")
|
|
198892
|
+
return null;
|
|
198893
|
+
const measurement = value;
|
|
198894
|
+
const width = measurement.width ?? measurement.value;
|
|
198895
|
+
if (typeof width !== "number" || !Number.isFinite(width) || width <= 0)
|
|
198896
|
+
return null;
|
|
198897
|
+
return {
|
|
198898
|
+
width,
|
|
198899
|
+
type: measurement.type
|
|
198900
|
+
};
|
|
198901
|
+
}
|
|
198890
198902
|
function resolveColumnWidths(columns, availableWidth) {
|
|
198891
198903
|
const width = availableWidth / columns.length;
|
|
198892
198904
|
return columns.map(() => width);
|
|
@@ -213395,7 +213407,8 @@ function executeTextSelector(editor, index2, query, diagnostics) {
|
|
|
213395
213407
|
const rawResult = requireEditorCommand(editor.commands?.search, "find (search)")(pattern, {
|
|
213396
213408
|
highlight: false,
|
|
213397
213409
|
caseSensitive: selector.caseSensitive ?? false,
|
|
213398
|
-
maxMatches: Infinity
|
|
213410
|
+
maxMatches: Infinity,
|
|
213411
|
+
searchModel: "visible"
|
|
213399
213412
|
});
|
|
213400
213413
|
if (!Array.isArray(rawResult))
|
|
213401
213414
|
throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "Editor search command returned an unexpected result format.");
|
|
@@ -220530,6 +220543,28 @@ function toNotFoundError(input2) {
|
|
|
220530
220543
|
function isSameTarget(left$1, right$1) {
|
|
220531
220544
|
return left$1.blockId === right$1.blockId && left$1.range.start === right$1.range.start && left$1.range.end === right$1.range.end;
|
|
220532
220545
|
}
|
|
220546
|
+
function isTextAddressShape(target) {
|
|
220547
|
+
if (!target || typeof target !== "object")
|
|
220548
|
+
return false;
|
|
220549
|
+
const t = target;
|
|
220550
|
+
if (t.kind !== "text")
|
|
220551
|
+
return false;
|
|
220552
|
+
if (typeof t.blockId !== "string")
|
|
220553
|
+
return false;
|
|
220554
|
+
return isTextRangeShape(t.range);
|
|
220555
|
+
}
|
|
220556
|
+
function isTextRangeShape(range) {
|
|
220557
|
+
if (!range || typeof range !== "object")
|
|
220558
|
+
return false;
|
|
220559
|
+
const r$1 = range;
|
|
220560
|
+
return Number.isInteger(r$1.start) && Number.isInteger(r$1.end) && r$1.start <= r$1.end;
|
|
220561
|
+
}
|
|
220562
|
+
function isTextSegmentShape(segment) {
|
|
220563
|
+
if (!segment || typeof segment !== "object")
|
|
220564
|
+
return false;
|
|
220565
|
+
const seg = segment;
|
|
220566
|
+
return typeof seg.blockId === "string" && isTextRangeShape(seg.range);
|
|
220567
|
+
}
|
|
220533
220568
|
function isTextTargetShape(target) {
|
|
220534
220569
|
if (!target || typeof target !== "object")
|
|
220535
220570
|
return false;
|
|
@@ -220538,17 +220573,19 @@ function isTextTargetShape(target) {
|
|
|
220538
220573
|
return false;
|
|
220539
220574
|
if (!Array.isArray(t.segments) || t.segments.length === 0)
|
|
220540
220575
|
return false;
|
|
220541
|
-
if (
|
|
220576
|
+
if (!t.segments.every(isTextSegmentShape))
|
|
220542
220577
|
return false;
|
|
220543
220578
|
return true;
|
|
220544
220579
|
}
|
|
220545
220580
|
function targetToSegments(target) {
|
|
220581
|
+
if (isTextAddressShape(target))
|
|
220582
|
+
return [{
|
|
220583
|
+
blockId: target.blockId,
|
|
220584
|
+
range: target.range
|
|
220585
|
+
}];
|
|
220546
220586
|
if (isTextTargetShape(target))
|
|
220547
220587
|
return [...target.segments];
|
|
220548
|
-
return
|
|
220549
|
-
blockId: target.blockId,
|
|
220550
|
-
range: target.range
|
|
220551
|
-
}];
|
|
220588
|
+
return null;
|
|
220552
220589
|
}
|
|
220553
220590
|
function listCommentAnchorsSafe(editor) {
|
|
220554
220591
|
try {
|
|
@@ -220766,6 +220803,15 @@ function addCommentHandler(editor, input2, options) {
|
|
|
220766
220803
|
}
|
|
220767
220804
|
};
|
|
220768
220805
|
const segments = targetToSegments(target);
|
|
220806
|
+
if (!segments)
|
|
220807
|
+
return {
|
|
220808
|
+
success: false,
|
|
220809
|
+
failure: {
|
|
220810
|
+
code: "INVALID_TARGET",
|
|
220811
|
+
message: "Comment target must be a TextAddress or TextTarget.",
|
|
220812
|
+
details: { target }
|
|
220813
|
+
}
|
|
220814
|
+
};
|
|
220769
220815
|
for (const seg of segments)
|
|
220770
220816
|
if (seg.range.start === seg.range.end)
|
|
220771
220817
|
return {
|
|
@@ -225685,8 +225731,9 @@ function resolveCurrentSelectionInfo(editor, input2) {
|
|
|
225685
225731
|
activeCommentIds: [],
|
|
225686
225732
|
activeChangeIds: []
|
|
225687
225733
|
};
|
|
225688
|
-
const
|
|
225689
|
-
const
|
|
225734
|
+
const sel = state.selection;
|
|
225735
|
+
const { from: from$1, to, empty: empty$1 } = sel;
|
|
225736
|
+
const segments = shouldProjectTextTarget(sel) ? collectTextSegments(state.doc, from$1, to) : null;
|
|
225690
225737
|
const target = segments && segments.length > 0 ? buildTextTarget(segments) : null;
|
|
225691
225738
|
const activeMarks = collectActiveMarks(state, from$1, to);
|
|
225692
225739
|
const { commentIds: activeCommentIds, changeIds: activeChangeRawIds } = collectActiveEntityIds(state, from$1, to);
|
|
@@ -225707,6 +225754,15 @@ function buildTextTarget(segments) {
|
|
|
225707
225754
|
segments
|
|
225708
225755
|
};
|
|
225709
225756
|
}
|
|
225757
|
+
function shouldProjectTextTarget(selection) {
|
|
225758
|
+
if (!selection || typeof selection !== "object")
|
|
225759
|
+
return false;
|
|
225760
|
+
if (selection instanceof NodeSelection)
|
|
225761
|
+
return false;
|
|
225762
|
+
if ("$anchorCell" in selection)
|
|
225763
|
+
return false;
|
|
225764
|
+
return true;
|
|
225765
|
+
}
|
|
225710
225766
|
function collectTextSegments(doc$12, from$1, to) {
|
|
225711
225767
|
const segments = [];
|
|
225712
225768
|
let abort = false;
|
|
@@ -245970,23 +246026,37 @@ function applyTableIndent(x, width, indent2, columnWidth) {
|
|
|
245970
246026
|
x: shiftedX,
|
|
245971
246027
|
width: Math.max(0, width - indent2)
|
|
245972
246028
|
};
|
|
246029
|
+
if (width > columnWidth)
|
|
246030
|
+
return {
|
|
246031
|
+
x: shiftedX,
|
|
246032
|
+
width
|
|
246033
|
+
};
|
|
245973
246034
|
const maxWidthWithinColumn = Math.max(0, columnWidth - indent2);
|
|
245974
246035
|
return {
|
|
245975
246036
|
x: shiftedX,
|
|
245976
246037
|
width: Math.min(width, maxWidthWithinColumn)
|
|
245977
246038
|
};
|
|
245978
246039
|
}
|
|
246040
|
+
function resolveRenderedTableWidth(columnWidth, measuredWidth, attrs) {
|
|
246041
|
+
const safeMeasuredWidth = Number.isFinite(measuredWidth) && measuredWidth > 0 ? measuredWidth : Math.max(0, columnWidth);
|
|
246042
|
+
const configuredWidth = resolveTableWidthAttr(attrs?.tableWidth);
|
|
246043
|
+
if (!configuredWidth)
|
|
246044
|
+
return safeMeasuredWidth;
|
|
246045
|
+
if (configuredWidth.type === "pct")
|
|
246046
|
+
return Math.max(0, Math.round(columnWidth * (configuredWidth.width / OOXML_PCT_DIVISOR)));
|
|
246047
|
+
return safeMeasuredWidth;
|
|
246048
|
+
}
|
|
245979
246049
|
function resolveTableFrame(baseX, columnWidth, tableWidth, attrs) {
|
|
245980
|
-
const width =
|
|
246050
|
+
const width = resolveRenderedTableWidth(columnWidth, tableWidth, attrs);
|
|
245981
246051
|
const justification = typeof attrs?.justification === "string" ? attrs.justification : undefined;
|
|
245982
246052
|
if (justification === "center")
|
|
245983
246053
|
return {
|
|
245984
|
-
x: baseX +
|
|
246054
|
+
x: baseX + (columnWidth - width) / 2,
|
|
245985
246055
|
width
|
|
245986
246056
|
};
|
|
245987
246057
|
if (justification === "right" || justification === "end")
|
|
245988
246058
|
return {
|
|
245989
|
-
x: baseX +
|
|
246059
|
+
x: baseX + (columnWidth - width),
|
|
245990
246060
|
width
|
|
245991
246061
|
};
|
|
245992
246062
|
return applyTableIndent(baseX, width, getTableIndentWidth(attrs), columnWidth);
|
|
@@ -246416,13 +246486,14 @@ function layoutMonolithicTable(context) {
|
|
|
246416
246486
|
state = context.ensurePage();
|
|
246417
246487
|
const height = Math.min(context.measure.totalHeight, state.contentBottom - state.cursorY);
|
|
246418
246488
|
const baseX = context.columnX(state.columnIndex);
|
|
246419
|
-
const baseWidth = Math.
|
|
246489
|
+
const baseWidth = Math.max(0, context.measure.totalWidth || context.columnWidth);
|
|
246420
246490
|
const { x, width } = resolveTableFrame(baseX, context.columnWidth, baseWidth, context.block.attrs);
|
|
246421
246491
|
const columnWidths = rescaleColumnWidths(context.measure.columnWidths, context.measure.totalWidth, width);
|
|
246422
246492
|
const metadata = generateFragmentMetadata(context.measure, context.block, 0, context.block.rows.length, 0, columnWidths);
|
|
246423
246493
|
const fragment = {
|
|
246424
246494
|
kind: "table",
|
|
246425
246495
|
blockId: context.block.id,
|
|
246496
|
+
columnIndex: state.columnIndex,
|
|
246426
246497
|
fromRow: 0,
|
|
246427
246498
|
toRow: context.block.rows.length,
|
|
246428
246499
|
x,
|
|
@@ -246494,12 +246565,13 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
|
|
|
246494
246565
|
let pendingPartialRow = null;
|
|
246495
246566
|
if (block.rows.length === 0 && measure.totalHeight > 0) {
|
|
246496
246567
|
const height = Math.min(measure.totalHeight, state.contentBottom - state.cursorY);
|
|
246497
|
-
const { x, width } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.
|
|
246568
|
+
const { x, width } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.max(0, measure.totalWidth || columnWidth), block.attrs);
|
|
246498
246569
|
const columnWidths = rescaleColumnWidths(measure.columnWidths, measure.totalWidth, width);
|
|
246499
246570
|
const metadata = generateFragmentMetadata(measure, block, 0, 0, 0, columnWidths);
|
|
246500
246571
|
const fragment = {
|
|
246501
246572
|
kind: "table",
|
|
246502
246573
|
blockId: block.id,
|
|
246574
|
+
columnIndex: state.columnIndex,
|
|
246503
246575
|
fromRow: 0,
|
|
246504
246576
|
toRow: 0,
|
|
246505
246577
|
x,
|
|
@@ -246564,11 +246636,12 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
|
|
|
246564
246636
|
});
|
|
246565
246637
|
const fragmentHeight$1 = computeFragmentHeight$1(measure, rowIndex, rowIndex + 1, repeatHeaderCount, borderCollapse, continuationPartialRow);
|
|
246566
246638
|
if (fragmentHeight$1 > 0 && madeProgress) {
|
|
246567
|
-
const { x: x$1, width: width$1 } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.
|
|
246639
|
+
const { x: x$1, width: width$1 } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.max(0, measure.totalWidth || columnWidth), block.attrs);
|
|
246568
246640
|
const scaledWidths$1 = rescaleColumnWidths(measure.columnWidths, measure.totalWidth, width$1);
|
|
246569
246641
|
const fragment$1 = {
|
|
246570
246642
|
kind: "table",
|
|
246571
246643
|
blockId: block.id,
|
|
246644
|
+
columnIndex: state.columnIndex,
|
|
246572
246645
|
fromRow: rowIndex,
|
|
246573
246646
|
toRow: rowIndex + 1,
|
|
246574
246647
|
x: x$1,
|
|
@@ -246620,11 +246693,12 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
|
|
|
246620
246693
|
}
|
|
246621
246694
|
const forcedEndRow = bodyStartRow + 1;
|
|
246622
246695
|
const fragmentHeight$1 = computeFragmentHeight$1(measure, bodyStartRow, forcedEndRow, repeatHeaderCount, borderCollapse, forcedPartialRow);
|
|
246623
|
-
const { x: x$1, width: width$1 } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.
|
|
246696
|
+
const { x: x$1, width: width$1 } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.max(0, measure.totalWidth || columnWidth), block.attrs);
|
|
246624
246697
|
const scaledWidths$1 = rescaleColumnWidths(measure.columnWidths, measure.totalWidth, width$1);
|
|
246625
246698
|
const fragment$1 = {
|
|
246626
246699
|
kind: "table",
|
|
246627
246700
|
blockId: block.id,
|
|
246701
|
+
columnIndex: state.columnIndex,
|
|
246628
246702
|
fromRow: bodyStartRow,
|
|
246629
246703
|
toRow: forcedEndRow,
|
|
246630
246704
|
x: x$1,
|
|
@@ -246649,11 +246723,12 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
|
|
|
246649
246723
|
continue;
|
|
246650
246724
|
}
|
|
246651
246725
|
const fragmentHeight = computeFragmentHeight$1(measure, bodyStartRow, endRow, repeatHeaderCount, borderCollapse, partialRow);
|
|
246652
|
-
const { x, width } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.
|
|
246726
|
+
const { x, width } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.max(0, measure.totalWidth || columnWidth), block.attrs);
|
|
246653
246727
|
const scaledWidths = rescaleColumnWidths(measure.columnWidths, measure.totalWidth, width);
|
|
246654
246728
|
const fragment = {
|
|
246655
246729
|
kind: "table",
|
|
246656
246730
|
blockId: block.id,
|
|
246731
|
+
columnIndex: state.columnIndex,
|
|
246657
246732
|
fromRow: bodyStartRow,
|
|
246658
246733
|
toRow: endRow,
|
|
246659
246734
|
x,
|
|
@@ -250749,32 +250824,12 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
250749
250824
|
return;
|
|
250750
250825
|
if (!block || block.kind !== "table")
|
|
250751
250826
|
return;
|
|
250752
|
-
const
|
|
250753
|
-
|
|
250754
|
-
let tableX = columnX;
|
|
250755
|
-
const justification = typeof block.attrs?.justification === "string" ? block.attrs.justification : undefined;
|
|
250756
|
-
if (justification === "center")
|
|
250757
|
-
tableX = columnX + Math.max(0, (contentWidth - tableWidth) / 2);
|
|
250758
|
-
else if (justification === "right" || justification === "end")
|
|
250759
|
-
tableX = columnX + Math.max(0, contentWidth - tableWidth);
|
|
250760
|
-
else {
|
|
250761
|
-
const indentValue = block.attrs?.tableIndent?.width;
|
|
250762
|
-
const indent2 = typeof indentValue === "number" && Number.isFinite(indentValue) ? indentValue : 0;
|
|
250763
|
-
tableX += indent2;
|
|
250764
|
-
tableWidth = Math.max(0, tableWidth - indent2);
|
|
250765
|
-
}
|
|
250766
|
-
let fragmentColumnWidths;
|
|
250767
|
-
if (tableWidthRaw > tableWidth && measure.columnWidths && measure.columnWidths.length > 0 && tableWidthRaw > 0) {
|
|
250768
|
-
const scale = tableWidth / tableWidthRaw;
|
|
250769
|
-
fragmentColumnWidths = measure.columnWidths.map((w) => Math.max(1, Math.round(w * scale)));
|
|
250770
|
-
const scaledSum = fragmentColumnWidths.reduce((a2, b$1) => a2 + b$1, 0);
|
|
250771
|
-
const target = Math.round(tableWidth);
|
|
250772
|
-
if (scaledSum !== target && fragmentColumnWidths.length > 0)
|
|
250773
|
-
fragmentColumnWidths[fragmentColumnWidths.length - 1] = Math.max(1, fragmentColumnWidths[fragmentColumnWidths.length - 1] + (target - scaledSum));
|
|
250774
|
-
}
|
|
250827
|
+
const { x: tableX, width: tableWidth } = resolveTableFrame(columnX, contentWidth, Math.max(0, measure.totalWidth ?? contentWidth), block.attrs);
|
|
250828
|
+
const fragmentColumnWidths = rescaleColumnWidths(measure.columnWidths, measure.totalWidth, tableWidth);
|
|
250775
250829
|
page.fragments.push({
|
|
250776
250830
|
kind: "table",
|
|
250777
250831
|
blockId: range.blockId,
|
|
250832
|
+
columnIndex,
|
|
250778
250833
|
fromRow: 0,
|
|
250779
250834
|
toRow: block.rows.length,
|
|
250780
250835
|
x: tableX,
|
|
@@ -251517,7 +251572,7 @@ function clickToPositionGeometry(layout, blocks2, measures, containerPoint, opti
|
|
|
251517
251572
|
layoutEpoch,
|
|
251518
251573
|
blockId: tableHit.fragment.blockId,
|
|
251519
251574
|
pageIndex,
|
|
251520
|
-
column:
|
|
251575
|
+
column: determineTableColumn(layout, tableHit.fragment),
|
|
251521
251576
|
lineIndex
|
|
251522
251577
|
};
|
|
251523
251578
|
}
|
|
@@ -251528,7 +251583,7 @@ function clickToPositionGeometry(layout, blocks2, measures, containerPoint, opti
|
|
|
251528
251583
|
layoutEpoch,
|
|
251529
251584
|
blockId: tableHit.fragment.blockId,
|
|
251530
251585
|
pageIndex,
|
|
251531
|
-
column:
|
|
251586
|
+
column: determineTableColumn(layout, tableHit.fragment),
|
|
251532
251587
|
lineIndex: 0
|
|
251533
251588
|
};
|
|
251534
251589
|
}
|
|
@@ -257833,30 +257888,21 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
257833
257888
|
...dropCapMeasure ? { dropCap: dropCapMeasure } : {}
|
|
257834
257889
|
};
|
|
257835
257890
|
}
|
|
257836
|
-
function validateTableWidthValue(attr) {
|
|
257837
|
-
const value = attr.width ?? attr.value;
|
|
257838
|
-
if (typeof value === "number" && Number.isFinite(value) && value > 0)
|
|
257839
|
-
return value;
|
|
257840
|
-
}
|
|
257841
257891
|
function resolveTableWidth(attrs, maxWidth) {
|
|
257842
|
-
const tableWidthAttr = attrs?.tableWidth;
|
|
257843
|
-
if (!tableWidthAttr
|
|
257892
|
+
const tableWidthAttr = resolveTableWidthAttr(attrs?.tableWidth);
|
|
257893
|
+
if (!tableWidthAttr)
|
|
257844
257894
|
return;
|
|
257845
|
-
|
|
257846
|
-
|
|
257847
|
-
if (
|
|
257848
|
-
return;
|
|
257849
|
-
if (typedAttr.type === "pct")
|
|
257850
|
-
return Math.round(maxWidth * (validValue / OOXML_PCT_DIVISOR));
|
|
257851
|
-
else if (typedAttr.type === "px" || typedAttr.type === "pixel" || typedAttr.type === "dxa")
|
|
257852
|
-
return validValue;
|
|
257895
|
+
if (tableWidthAttr.type === "pct")
|
|
257896
|
+
return Math.round(maxWidth * (tableWidthAttr.width / OOXML_PCT_DIVISOR));
|
|
257897
|
+
else if (tableWidthAttr.type === "px" || tableWidthAttr.type === "pixel" || tableWidthAttr.type === "dxa")
|
|
257898
|
+
return tableWidthAttr.width;
|
|
257853
257899
|
}
|
|
257854
257900
|
async function measureTableBlock(block, constraints) {
|
|
257855
257901
|
const maxWidth = typeof constraints === "number" ? constraints : constraints.maxWidth;
|
|
257856
257902
|
const resolvedTableWidth = resolveTableWidth(block.attrs, maxWidth);
|
|
257857
257903
|
let columnWidths;
|
|
257858
257904
|
const maxCellCount = Math.max(1, Math.max(...block.rows.map((r$1) => r$1.cells.reduce((sum, cell2) => sum + (cell2.colSpan ?? 1), 0))));
|
|
257859
|
-
const effectiveTargetWidth = resolvedTableWidth != null ?
|
|
257905
|
+
const effectiveTargetWidth = resolvedTableWidth != null ? resolvedTableWidth : maxWidth;
|
|
257860
257906
|
if (block.columnWidths && block.columnWidths.length > 0) {
|
|
257861
257907
|
columnWidths = [...block.columnWidths];
|
|
257862
257908
|
const hasExplicitWidth = resolvedTableWidth != null;
|
|
@@ -257864,35 +257910,24 @@ async function measureTableBlock(block, constraints) {
|
|
|
257864
257910
|
if (hasExplicitWidth || hasFixedLayout) {
|
|
257865
257911
|
const totalWidth$1 = columnWidths.reduce((a2, b$1) => a2 + b$1, 0);
|
|
257866
257912
|
const tableWidthType = block.attrs?.tableWidth?.type;
|
|
257867
|
-
|
|
257868
|
-
|
|
257869
|
-
|
|
257870
|
-
const scaledSum = columnWidths.reduce((a2, b$1) => a2 + b$1, 0);
|
|
257871
|
-
if (scaledSum !== effectiveTargetWidth && columnWidths.length > 0) {
|
|
257872
|
-
const diff = effectiveTargetWidth - scaledSum;
|
|
257873
|
-
columnWidths[columnWidths.length - 1] = Math.max(1, columnWidths[columnWidths.length - 1] + diff);
|
|
257874
|
-
}
|
|
257875
|
-
}
|
|
257876
|
-
} else {
|
|
257877
|
-
if (columnWidths.length < maxCellCount) {
|
|
257878
|
-
const usedWidth = columnWidths.reduce((a2, b$1) => a2 + b$1, 0);
|
|
257879
|
-
const remainingWidth = Math.max(0, effectiveTargetWidth - usedWidth);
|
|
257880
|
-
const missingColumns = maxCellCount - columnWidths.length;
|
|
257881
|
-
const paddingWidth = Math.max(1, Math.floor(remainingWidth / missingColumns));
|
|
257882
|
-
columnWidths.push(...Array.from({ length: missingColumns }, () => paddingWidth));
|
|
257883
|
-
} else if (columnWidths.length > maxCellCount)
|
|
257884
|
-
columnWidths = columnWidths.slice(0, maxCellCount);
|
|
257885
|
-
const totalWidth$1 = columnWidths.reduce((a2, b$1) => a2 + b$1, 0);
|
|
257886
|
-
if (totalWidth$1 > effectiveTargetWidth && effectiveTargetWidth > 0) {
|
|
257887
|
-
const scale = effectiveTargetWidth / totalWidth$1;
|
|
257913
|
+
const targetWidth = hasExplicitWidth ? effectiveTargetWidth : totalWidth$1;
|
|
257914
|
+
if ((totalWidth$1 > targetWidth || totalWidth$1 < targetWidth && targetWidth > 0 && (tableWidthType === "pct" || hasExplicitWidth && !hasFixedLayout)) && targetWidth > 0 && totalWidth$1 > 0) {
|
|
257915
|
+
const scale = targetWidth / totalWidth$1;
|
|
257888
257916
|
columnWidths = columnWidths.map((w) => Math.max(1, Math.round(w * scale)));
|
|
257889
257917
|
const scaledSum = columnWidths.reduce((a2, b$1) => a2 + b$1, 0);
|
|
257890
|
-
if (scaledSum !==
|
|
257891
|
-
const diff =
|
|
257918
|
+
if (scaledSum !== targetWidth && columnWidths.length > 0) {
|
|
257919
|
+
const diff = targetWidth - scaledSum;
|
|
257892
257920
|
columnWidths[columnWidths.length - 1] = Math.max(1, columnWidths[columnWidths.length - 1] + diff);
|
|
257893
257921
|
}
|
|
257894
257922
|
}
|
|
257895
|
-
}
|
|
257923
|
+
} else if (columnWidths.length < maxCellCount) {
|
|
257924
|
+
const usedWidth = columnWidths.reduce((a2, b$1) => a2 + b$1, 0);
|
|
257925
|
+
const remainingWidth = Math.max(0, effectiveTargetWidth - usedWidth);
|
|
257926
|
+
const missingColumns = maxCellCount - columnWidths.length;
|
|
257927
|
+
const paddingWidth = Math.max(1, Math.floor(remainingWidth / missingColumns));
|
|
257928
|
+
columnWidths.push(...Array.from({ length: missingColumns }, () => paddingWidth));
|
|
257929
|
+
} else if (columnWidths.length > maxCellCount)
|
|
257930
|
+
columnWidths = columnWidths.slice(0, maxCellCount);
|
|
257896
257931
|
} else {
|
|
257897
257932
|
const columnWidth = Math.max(1, Math.floor(effectiveTargetWidth / maxCellCount));
|
|
257898
257933
|
columnWidths = Array.from({ length: maxCellCount }, () => columnWidth);
|
|
@@ -268799,7 +268834,7 @@ var Node$13 = class Node$14 {
|
|
|
268799
268834
|
this.deco = deco;
|
|
268800
268835
|
}
|
|
268801
268836
|
}, searchKey, BLOCK_SEPARATOR = `
|
|
268802
|
-
`, ATOM_PLACEHOLDER = "", SearchIndex, customSearchHighlightsKey, isRegExp2 = (value) => Object.prototype.toString.call(value) === "[object RegExp]", SEARCH_POSITION_TRACKER_TYPE = "search-match", mapIndexMatchesToDocMatches = ({ searchIndex, indexMatches, doc: doc$12, positionTracker }) => {
|
|
268837
|
+
`, ATOM_PLACEHOLDER = "", DELETION_BARRIER = "\x00", DEFAULT_SEARCH_MODEL$1 = "raw", hasTrackDeleteMark$1 = (node2) => node2?.marks?.some((mark2) => mark2?.type?.name === "trackDelete") ?? false, SearchIndex, customSearchHighlightsKey, isRegExp2 = (value) => Object.prototype.toString.call(value) === "[object RegExp]", SEARCH_POSITION_TRACKER_TYPE = "search-match", DEFAULT_SEARCH_MODEL = "raw", normalizeSearchModel = (value) => value === "visible" ? "visible" : DEFAULT_SEARCH_MODEL, mapIndexMatchesToDocMatches = ({ searchIndex, indexMatches, doc: doc$12, positionTracker }) => {
|
|
268803
268838
|
const matches2 = [];
|
|
268804
268839
|
for (const indexMatch of indexMatches) {
|
|
268805
268840
|
const ranges = searchIndex.offsetRangeToDocRanges(indexMatch.start, indexMatch.end);
|
|
@@ -270136,7 +270171,7 @@ var Node$13 = class Node$14 {
|
|
|
270136
270171
|
});
|
|
270137
270172
|
const renderSearchDropdown = () => {
|
|
270138
270173
|
const handleSubmit = ({ value }) => {
|
|
270139
|
-
superToolbar.activeEditor.commands.search(value);
|
|
270174
|
+
superToolbar.activeEditor.commands.search(value, { searchModel: "visible" });
|
|
270140
270175
|
};
|
|
270141
270176
|
return exports_vue.h("div", {}, [exports_vue.h(SearchInput_default, {
|
|
270142
270177
|
onSubmit: handleSubmit,
|
|
@@ -280895,7 +280930,9 @@ menclose::after {
|
|
|
280895
280930
|
let columnIndex = 0;
|
|
280896
280931
|
if (columns && columns.count > 1 && page) {
|
|
280897
280932
|
const fragment = findFragmentForPos(page, ref$1.pos);
|
|
280898
|
-
if (fragment && typeof fragment.
|
|
280933
|
+
if (fragment?.kind === "table" && typeof fragment.columnIndex === "number")
|
|
280934
|
+
columnIndex = Math.max(0, Math.min(columns.count - 1, fragment.columnIndex));
|
|
280935
|
+
else if (fragment && typeof fragment.x === "number") {
|
|
280899
280936
|
const widths = Array.isArray(columns.widths) && columns.widths.length > 0 ? columns.widths : undefined;
|
|
280900
280937
|
if (widths) {
|
|
280901
280938
|
let cursorX = columns.left;
|
|
@@ -281497,6 +281534,12 @@ menclose::after {
|
|
|
281497
281534
|
const relative = fragmentX;
|
|
281498
281535
|
const raw = Math.floor(relative / Math.max(span, 1));
|
|
281499
281536
|
return Math.max(0, Math.min(columns.count - 1, raw));
|
|
281537
|
+
}, determineTableColumn = (layout, fragment) => {
|
|
281538
|
+
if (typeof fragment.columnIndex === "number") {
|
|
281539
|
+
const count = layout.columns?.count ?? 1;
|
|
281540
|
+
return Math.max(0, Math.min(Math.max(0, count - 1), fragment.columnIndex));
|
|
281541
|
+
}
|
|
281542
|
+
return determineColumn(layout, fragment.x);
|
|
281500
281543
|
}, findLineIndexAtY = (lines, offsetY, fromLine, toLine) => {
|
|
281501
281544
|
if (!lines || lines.length === 0)
|
|
281502
281545
|
return null;
|
|
@@ -288033,7 +288076,7 @@ menclose::after {
|
|
|
288033
288076
|
return;
|
|
288034
288077
|
console.log(...args$1);
|
|
288035
288078
|
}, 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;
|
|
288036
|
-
var
|
|
288079
|
+
var init_src_BzRjWTpH_es = __esm(() => {
|
|
288037
288080
|
init_rolldown_runtime_Bg48TavK_es();
|
|
288038
288081
|
init_SuperConverter_BTy5lByv_es();
|
|
288039
288082
|
init_jszip_C49i9kUs_es();
|
|
@@ -288064,6 +288107,7 @@ var init_src_CCV76OsP_es = __esm(() => {
|
|
|
288064
288107
|
measureRowHeights: () => measureRowHeights,
|
|
288065
288108
|
resolveColumnWidths: () => resolveColumnWidths,
|
|
288066
288109
|
resolveSpacingIndent: () => resolveSpacingIndent,
|
|
288110
|
+
resolveTableWidthAttr: () => resolveTableWidthAttr,
|
|
288067
288111
|
scaleWrapPolygon: () => scaleWrapPolygon
|
|
288068
288112
|
}, 1);
|
|
288069
288113
|
floor2 = Math.floor;
|
|
@@ -305416,19 +305460,69 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
305416
305460
|
valid = false;
|
|
305417
305461
|
docSize = 0;
|
|
305418
305462
|
doc = null;
|
|
305419
|
-
|
|
305420
|
-
|
|
305463
|
+
searchModel = DEFAULT_SEARCH_MODEL$1;
|
|
305464
|
+
build(doc$12, options = {}) {
|
|
305465
|
+
const searchModel = options?.searchModel === "visible" ? "visible" : DEFAULT_SEARCH_MODEL$1;
|
|
305466
|
+
if (searchModel === "visible")
|
|
305467
|
+
this.#buildVisible(doc$12);
|
|
305468
|
+
else
|
|
305469
|
+
this.text = doc$12.textBetween(0, doc$12.content.size, BLOCK_SEPARATOR, ATOM_PLACEHOLDER);
|
|
305421
305470
|
this.segments = [];
|
|
305422
305471
|
this.docSize = doc$12.content.size;
|
|
305423
305472
|
this.doc = doc$12;
|
|
305473
|
+
this.searchModel = searchModel;
|
|
305424
305474
|
let offset$1 = 0;
|
|
305475
|
+
const visibleContext = searchModel === "visible" ? { deletionBarrierActive: false } : null;
|
|
305425
305476
|
this.#walkNodeContent(doc$12, 0, offset$1, (segment) => {
|
|
305426
305477
|
this.segments.push(segment);
|
|
305427
305478
|
offset$1 = segment.offsetEnd;
|
|
305428
|
-
});
|
|
305479
|
+
}, searchModel, visibleContext);
|
|
305429
305480
|
this.valid = true;
|
|
305430
305481
|
}
|
|
305431
|
-
#
|
|
305482
|
+
#buildVisible(doc$12) {
|
|
305483
|
+
const parts = [];
|
|
305484
|
+
let emittedDeletionBarrier = false;
|
|
305485
|
+
const appendDeletionBarrier = () => {
|
|
305486
|
+
if (emittedDeletionBarrier)
|
|
305487
|
+
return;
|
|
305488
|
+
parts.push(DELETION_BARRIER);
|
|
305489
|
+
emittedDeletionBarrier = true;
|
|
305490
|
+
};
|
|
305491
|
+
const walkNodeContent2 = (node2) => {
|
|
305492
|
+
let isFirstChild = true;
|
|
305493
|
+
node2.forEach((child) => {
|
|
305494
|
+
if (child.isBlock && !isFirstChild) {
|
|
305495
|
+
parts.push(BLOCK_SEPARATOR);
|
|
305496
|
+
emittedDeletionBarrier = false;
|
|
305497
|
+
}
|
|
305498
|
+
walkNode2(child);
|
|
305499
|
+
isFirstChild = false;
|
|
305500
|
+
});
|
|
305501
|
+
};
|
|
305502
|
+
const walkNode2 = (node2) => {
|
|
305503
|
+
if (node2.isText) {
|
|
305504
|
+
const text5 = node2.text || "";
|
|
305505
|
+
if (!text5.length)
|
|
305506
|
+
return;
|
|
305507
|
+
if (hasTrackDeleteMark$1(node2)) {
|
|
305508
|
+
appendDeletionBarrier();
|
|
305509
|
+
return;
|
|
305510
|
+
}
|
|
305511
|
+
parts.push(text5);
|
|
305512
|
+
emittedDeletionBarrier = false;
|
|
305513
|
+
return;
|
|
305514
|
+
}
|
|
305515
|
+
if (node2.isLeaf) {
|
|
305516
|
+
parts.push(ATOM_PLACEHOLDER);
|
|
305517
|
+
emittedDeletionBarrier = false;
|
|
305518
|
+
return;
|
|
305519
|
+
}
|
|
305520
|
+
walkNodeContent2(node2);
|
|
305521
|
+
};
|
|
305522
|
+
walkNodeContent2(doc$12);
|
|
305523
|
+
this.text = parts.join("");
|
|
305524
|
+
}
|
|
305525
|
+
#walkNodeContent(node2, contentStart, offset$1, addSegment, searchModel = DEFAULT_SEARCH_MODEL$1, context = null) {
|
|
305432
305526
|
let currentOffset = offset$1;
|
|
305433
305527
|
let isFirstChild = true;
|
|
305434
305528
|
node2.forEach((child, childContentOffset) => {
|
|
@@ -305442,16 +305536,34 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
305442
305536
|
kind: "blockSep"
|
|
305443
305537
|
});
|
|
305444
305538
|
currentOffset += 1;
|
|
305539
|
+
if (context && searchModel === "visible")
|
|
305540
|
+
context.deletionBarrierActive = false;
|
|
305445
305541
|
}
|
|
305446
|
-
currentOffset = this.#walkNode(child, childDocPos, currentOffset, addSegment);
|
|
305542
|
+
currentOffset = this.#walkNode(child, childDocPos, currentOffset, addSegment, searchModel, context);
|
|
305447
305543
|
isFirstChild = false;
|
|
305448
305544
|
});
|
|
305449
305545
|
return currentOffset;
|
|
305450
305546
|
}
|
|
305451
|
-
#walkNode(node2, docPos, offset$1, addSegment) {
|
|
305547
|
+
#walkNode(node2, docPos, offset$1, addSegment, searchModel = DEFAULT_SEARCH_MODEL$1, context = null) {
|
|
305452
305548
|
if (node2.isText) {
|
|
305549
|
+
if (searchModel === "visible" && hasTrackDeleteMark$1(node2)) {
|
|
305550
|
+
if (context?.deletionBarrierActive)
|
|
305551
|
+
return offset$1;
|
|
305552
|
+
addSegment({
|
|
305553
|
+
offsetStart: offset$1,
|
|
305554
|
+
offsetEnd: offset$1 + 1,
|
|
305555
|
+
docFrom: docPos,
|
|
305556
|
+
docTo: docPos,
|
|
305557
|
+
kind: "atom"
|
|
305558
|
+
});
|
|
305559
|
+
if (context)
|
|
305560
|
+
context.deletionBarrierActive = true;
|
|
305561
|
+
return offset$1 + 1;
|
|
305562
|
+
}
|
|
305453
305563
|
const text5 = node2.text || "";
|
|
305454
305564
|
if (text5.length > 0) {
|
|
305565
|
+
if (context && searchModel === "visible")
|
|
305566
|
+
context.deletionBarrierActive = false;
|
|
305455
305567
|
addSegment({
|
|
305456
305568
|
offsetStart: offset$1,
|
|
305457
305569
|
offsetEnd: offset$1 + text5.length,
|
|
@@ -305464,6 +305576,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
305464
305576
|
return offset$1;
|
|
305465
305577
|
}
|
|
305466
305578
|
if (node2.isLeaf) {
|
|
305579
|
+
if (context && searchModel === "visible")
|
|
305580
|
+
context.deletionBarrierActive = false;
|
|
305467
305581
|
if (node2.type.name === "hard_break") {
|
|
305468
305582
|
addSegment({
|
|
305469
305583
|
offsetStart: offset$1,
|
|
@@ -305483,17 +305597,18 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
305483
305597
|
});
|
|
305484
305598
|
return offset$1 + 1;
|
|
305485
305599
|
}
|
|
305486
|
-
return this.#walkNodeContent(node2, docPos + 1, offset$1, addSegment);
|
|
305600
|
+
return this.#walkNodeContent(node2, docPos + 1, offset$1, addSegment, searchModel, context);
|
|
305487
305601
|
}
|
|
305488
305602
|
invalidate() {
|
|
305489
305603
|
this.valid = false;
|
|
305490
305604
|
}
|
|
305491
|
-
isStale(doc$12) {
|
|
305492
|
-
|
|
305605
|
+
isStale(doc$12, options = {}) {
|
|
305606
|
+
const searchModel = options?.searchModel === "visible" ? "visible" : DEFAULT_SEARCH_MODEL$1;
|
|
305607
|
+
return !this.valid || this.doc !== doc$12 || this.searchModel !== searchModel;
|
|
305493
305608
|
}
|
|
305494
|
-
ensureValid(doc$12) {
|
|
305495
|
-
if (this.isStale(doc$12))
|
|
305496
|
-
this.build(doc$12);
|
|
305609
|
+
ensureValid(doc$12, options = {}) {
|
|
305610
|
+
if (this.isStale(doc$12, options))
|
|
305611
|
+
this.build(doc$12, options);
|
|
305497
305612
|
}
|
|
305498
305613
|
offsetRangeToDocRanges(start$1, end$1) {
|
|
305499
305614
|
const ranges = [];
|
|
@@ -305643,7 +305758,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
305643
305758
|
activeMatchIndex: -1,
|
|
305644
305759
|
query: "",
|
|
305645
305760
|
caseSensitive: false,
|
|
305646
|
-
ignoreDiacritics: false
|
|
305761
|
+
ignoreDiacritics: false,
|
|
305762
|
+
searchModel: DEFAULT_SEARCH_MODEL
|
|
305647
305763
|
};
|
|
305648
305764
|
},
|
|
305649
305765
|
addPmPlugins() {
|
|
@@ -305657,8 +305773,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
305657
305773
|
if (storage?.searchIndex)
|
|
305658
305774
|
storage.searchIndex.invalidate();
|
|
305659
305775
|
if (storage?.query) {
|
|
305660
|
-
storage.searchIndex.ensureValid(newState.doc);
|
|
305661
|
-
const indexMatches = (storage.ignoreDiacritics ? (q$1, opts) => storage.searchIndex.searchIgnoringDiacritics(q$1, opts) : (q$1, opts) => storage.searchIndex.search(q$1, opts))(storage.query, {
|
|
305776
|
+
storage.searchIndex.ensureValid(newState.doc, { searchModel: storage.searchModel ?? DEFAULT_SEARCH_MODEL });
|
|
305777
|
+
const indexMatches = (storage.ignoreDiacritics ? (q$1, opts) => storage.searchIndex.searchIgnoringDiacritics(q$1, opts) : (q$1, opts) => storage.searchIndex.search(q$1, opts))(storage.query, {
|
|
305778
|
+
caseSensitive: storage.caseSensitive,
|
|
305779
|
+
searchModel: storage.searchModel ?? DEFAULT_SEARCH_MODEL
|
|
305780
|
+
});
|
|
305662
305781
|
const refreshed = mapIndexMatchesToDocMatches({
|
|
305663
305782
|
searchIndex: storage.searchIndex,
|
|
305664
305783
|
indexMatches,
|
|
@@ -305756,11 +305875,12 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
305756
305875
|
} catch {}
|
|
305757
305876
|
return true;
|
|
305758
305877
|
},
|
|
305759
|
-
search: (patternInput, options = {}) => ({ state,
|
|
305878
|
+
search: (patternInput, options = {}) => ({ state, editor }) => {
|
|
305760
305879
|
if (options != null && (typeof options !== "object" || Array.isArray(options)))
|
|
305761
305880
|
throw new TypeError("Search options must be an object");
|
|
305762
305881
|
const highlight = typeof options?.highlight === "boolean" ? options.highlight : true;
|
|
305763
305882
|
const maxMatches = typeof options?.maxMatches === "number" ? options.maxMatches : 1000;
|
|
305883
|
+
const searchModel = normalizeSearchModel(options?.searchModel);
|
|
305764
305884
|
let caseSensitive = false;
|
|
305765
305885
|
let searchPattern = patternInput;
|
|
305766
305886
|
if (isRegExp2(patternInput)) {
|
|
@@ -305777,12 +305897,14 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
305777
305897
|
const positionTracker = getPositionTracker(editor);
|
|
305778
305898
|
positionTracker?.untrackByType?.(SEARCH_POSITION_TRACKER_TYPE);
|
|
305779
305899
|
const searchIndex = this.storage.searchIndex;
|
|
305780
|
-
searchIndex.ensureValid(state.doc);
|
|
305900
|
+
searchIndex.ensureValid(state.doc, { searchModel });
|
|
305901
|
+
this.storage.searchModel = searchModel;
|
|
305781
305902
|
const resultMatches = mapIndexMatchesToDocMatches({
|
|
305782
305903
|
searchIndex,
|
|
305783
305904
|
indexMatches: searchIndex.search(searchPattern, {
|
|
305784
305905
|
caseSensitive,
|
|
305785
|
-
maxMatches
|
|
305906
|
+
maxMatches,
|
|
305907
|
+
searchModel
|
|
305786
305908
|
}),
|
|
305787
305909
|
doc: state.doc,
|
|
305788
305910
|
positionTracker
|
|
@@ -305827,9 +305949,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
305827
305949
|
const caseSensitive = options.caseSensitive ?? false;
|
|
305828
305950
|
const ignoreDiacritics = options.ignoreDiacritics ?? false;
|
|
305829
305951
|
const highlight = options.highlight ?? true;
|
|
305952
|
+
const searchModel = normalizeSearchModel(options.searchModel);
|
|
305830
305953
|
this.storage.query = query;
|
|
305831
305954
|
this.storage.caseSensitive = caseSensitive;
|
|
305832
305955
|
this.storage.ignoreDiacritics = ignoreDiacritics;
|
|
305956
|
+
this.storage.searchModel = searchModel;
|
|
305833
305957
|
const positionTracker = getPositionTracker(editor);
|
|
305834
305958
|
positionTracker?.untrackByType?.(SEARCH_POSITION_TRACKER_TYPE);
|
|
305835
305959
|
if (!query) {
|
|
@@ -305842,10 +305966,16 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
305842
305966
|
};
|
|
305843
305967
|
}
|
|
305844
305968
|
const searchIndex = this.storage.searchIndex;
|
|
305845
|
-
searchIndex.ensureValid(state.doc);
|
|
305969
|
+
searchIndex.ensureValid(state.doc, { searchModel });
|
|
305846
305970
|
const resultMatches = mapIndexMatchesToDocMatches({
|
|
305847
305971
|
searchIndex,
|
|
305848
|
-
indexMatches: ignoreDiacritics ? searchIndex.searchIgnoringDiacritics(query, {
|
|
305972
|
+
indexMatches: ignoreDiacritics ? searchIndex.searchIgnoringDiacritics(query, {
|
|
305973
|
+
caseSensitive,
|
|
305974
|
+
searchModel
|
|
305975
|
+
}) : searchIndex.search(query, {
|
|
305976
|
+
caseSensitive,
|
|
305977
|
+
searchModel
|
|
305978
|
+
}),
|
|
305849
305979
|
doc: state.doc,
|
|
305850
305980
|
positionTracker
|
|
305851
305981
|
});
|
|
@@ -305865,9 +305995,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
305865
305995
|
this.storage.query = "";
|
|
305866
305996
|
this.storage.caseSensitive = false;
|
|
305867
305997
|
this.storage.ignoreDiacritics = false;
|
|
305998
|
+
this.storage.searchModel = DEFAULT_SEARCH_MODEL;
|
|
305868
305999
|
return true;
|
|
305869
306000
|
},
|
|
305870
|
-
nextSearchMatch: () => ({
|
|
306001
|
+
nextSearchMatch: () => ({ editor }) => {
|
|
305871
306002
|
const matches2 = this.storage.searchResults;
|
|
305872
306003
|
if (!matches2 || matches2.length === 0)
|
|
305873
306004
|
return {
|
|
@@ -305883,7 +306014,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
305883
306014
|
match: match$1
|
|
305884
306015
|
};
|
|
305885
306016
|
},
|
|
305886
|
-
previousSearchMatch: () => ({
|
|
306017
|
+
previousSearchMatch: () => ({ editor }) => {
|
|
305887
306018
|
const matches2 = this.storage.searchResults;
|
|
305888
306019
|
if (!matches2 || matches2.length === 0)
|
|
305889
306020
|
return {
|
|
@@ -305899,7 +306030,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
305899
306030
|
match: match$1
|
|
305900
306031
|
};
|
|
305901
306032
|
},
|
|
305902
|
-
replaceSearchMatch: (replacement) => ({ state, dispatch,
|
|
306033
|
+
replaceSearchMatch: (replacement) => ({ state, dispatch, commands: commands$1 }) => {
|
|
305903
306034
|
const matches2 = this.storage.searchResults;
|
|
305904
306035
|
const activeIdx = this.storage.activeMatchIndex;
|
|
305905
306036
|
if (!matches2 || activeIdx < 0 || activeIdx >= matches2.length)
|
|
@@ -305921,7 +306052,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
305921
306052
|
const result = commands$1.setSearchSession(this.storage.query, {
|
|
305922
306053
|
caseSensitive: this.storage.caseSensitive,
|
|
305923
306054
|
ignoreDiacritics: this.storage.ignoreDiacritics,
|
|
305924
|
-
highlight: this.storage.highlightEnabled
|
|
306055
|
+
highlight: this.storage.highlightEnabled,
|
|
306056
|
+
searchModel: this.storage.searchModel
|
|
305925
306057
|
});
|
|
305926
306058
|
if (result.matches.length > 0) {
|
|
305927
306059
|
const newIdx = Math.min(activeIdx, result.matches.length - 1);
|
|
@@ -325182,7 +325314,7 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
|
|
|
325182
325314
|
|
|
325183
325315
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
325184
325316
|
var init_super_editor_es = __esm(() => {
|
|
325185
|
-
|
|
325317
|
+
init_src_BzRjWTpH_es();
|
|
325186
325318
|
init_SuperConverter_BTy5lByv_es();
|
|
325187
325319
|
init_jszip_C49i9kUs_es();
|
|
325188
325320
|
init_xml_js_CqGKpaft_es();
|
|
@@ -364932,7 +365064,8 @@ function executeTextSelector2(editor, index2, query2, diagnostics) {
|
|
|
364932
365064
|
const rawResult = search4(pattern, {
|
|
364933
365065
|
highlight: false,
|
|
364934
365066
|
caseSensitive: selector.caseSensitive ?? false,
|
|
364935
|
-
maxMatches: Infinity
|
|
365067
|
+
maxMatches: Infinity,
|
|
365068
|
+
searchModel: "visible"
|
|
364936
365069
|
});
|
|
364937
365070
|
if (!Array.isArray(rawResult)) {
|
|
364938
365071
|
throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", "Editor search command returned an unexpected result format.");
|
|
@@ -430822,6 +430955,28 @@ function toNotFoundError2(input2) {
|
|
|
430822
430955
|
function isSameTarget2(left2, right2) {
|
|
430823
430956
|
return left2.blockId === right2.blockId && left2.range.start === right2.range.start && left2.range.end === right2.range.end;
|
|
430824
430957
|
}
|
|
430958
|
+
function isTextAddressShape2(target) {
|
|
430959
|
+
if (!target || typeof target !== "object")
|
|
430960
|
+
return false;
|
|
430961
|
+
const t = target;
|
|
430962
|
+
if (t.kind !== "text")
|
|
430963
|
+
return false;
|
|
430964
|
+
if (typeof t.blockId !== "string")
|
|
430965
|
+
return false;
|
|
430966
|
+
return isTextRangeShape2(t.range);
|
|
430967
|
+
}
|
|
430968
|
+
function isTextRangeShape2(range) {
|
|
430969
|
+
if (!range || typeof range !== "object")
|
|
430970
|
+
return false;
|
|
430971
|
+
const r2 = range;
|
|
430972
|
+
return Number.isInteger(r2.start) && Number.isInteger(r2.end) && r2.start <= r2.end;
|
|
430973
|
+
}
|
|
430974
|
+
function isTextSegmentShape2(segment) {
|
|
430975
|
+
if (!segment || typeof segment !== "object")
|
|
430976
|
+
return false;
|
|
430977
|
+
const seg = segment;
|
|
430978
|
+
return typeof seg.blockId === "string" && isTextRangeShape2(seg.range);
|
|
430979
|
+
}
|
|
430825
430980
|
function isTextTargetShape2(target) {
|
|
430826
430981
|
if (!target || typeof target !== "object")
|
|
430827
430982
|
return false;
|
|
@@ -430830,14 +430985,16 @@ function isTextTargetShape2(target) {
|
|
|
430830
430985
|
return false;
|
|
430831
430986
|
if (!Array.isArray(t.segments) || t.segments.length === 0)
|
|
430832
430987
|
return false;
|
|
430833
|
-
if (
|
|
430988
|
+
if (!t.segments.every(isTextSegmentShape2))
|
|
430834
430989
|
return false;
|
|
430835
430990
|
return true;
|
|
430836
430991
|
}
|
|
430837
430992
|
function targetToSegments2(target) {
|
|
430993
|
+
if (isTextAddressShape2(target))
|
|
430994
|
+
return [{ blockId: target.blockId, range: target.range }];
|
|
430838
430995
|
if (isTextTargetShape2(target))
|
|
430839
430996
|
return [...target.segments];
|
|
430840
|
-
return
|
|
430997
|
+
return null;
|
|
430841
430998
|
}
|
|
430842
430999
|
function listCommentAnchorsSafe2(editor) {
|
|
430843
431000
|
try {
|
|
@@ -431044,6 +431201,16 @@ function addCommentHandler2(editor, input2, options) {
|
|
|
431044
431201
|
};
|
|
431045
431202
|
}
|
|
431046
431203
|
const segments = targetToSegments2(target);
|
|
431204
|
+
if (!segments) {
|
|
431205
|
+
return {
|
|
431206
|
+
success: false,
|
|
431207
|
+
failure: {
|
|
431208
|
+
code: "INVALID_TARGET",
|
|
431209
|
+
message: "Comment target must be a TextAddress or TextTarget.",
|
|
431210
|
+
details: { target }
|
|
431211
|
+
}
|
|
431212
|
+
};
|
|
431213
|
+
}
|
|
431047
431214
|
for (const seg of segments) {
|
|
431048
431215
|
if (seg.range.start === seg.range.end) {
|
|
431049
431216
|
return {
|
|
@@ -436570,7 +436737,7 @@ function resolveCurrentSelectionInfo2(editor, input2) {
|
|
|
436570
436737
|
}
|
|
436571
436738
|
const sel = state.selection;
|
|
436572
436739
|
const { from: from4, to, empty: empty6 } = sel;
|
|
436573
|
-
const segments = collectTextSegments2(state.doc, from4, to);
|
|
436740
|
+
const segments = shouldProjectTextTarget2(sel) ? collectTextSegments2(state.doc, from4, to) : null;
|
|
436574
436741
|
const target = segments && segments.length > 0 ? buildTextTarget3(segments) : null;
|
|
436575
436742
|
const activeMarks = collectActiveMarks2(state, from4, to);
|
|
436576
436743
|
const { commentIds: activeCommentIds, changeIds: activeChangeRawIds } = collectActiveEntityIds2(state, from4, to);
|
|
@@ -436593,6 +436760,15 @@ function buildTextTarget3(segments) {
|
|
|
436593
436760
|
segments
|
|
436594
436761
|
};
|
|
436595
436762
|
}
|
|
436763
|
+
function shouldProjectTextTarget2(selection) {
|
|
436764
|
+
if (!selection || typeof selection !== "object")
|
|
436765
|
+
return false;
|
|
436766
|
+
if (selection instanceof NodeSelection3)
|
|
436767
|
+
return false;
|
|
436768
|
+
if ("$anchorCell" in selection)
|
|
436769
|
+
return false;
|
|
436770
|
+
return true;
|
|
436771
|
+
}
|
|
436596
436772
|
function collectTextSegments2(doc6, from4, to) {
|
|
436597
436773
|
const segments = [];
|
|
436598
436774
|
let abort = false;
|
|
@@ -436737,6 +436913,7 @@ function markTypesPresentEverywhere2(doc6, from4, to) {
|
|
|
436737
436913
|
}
|
|
436738
436914
|
var COMMENT_MARK_NAME4 = "commentMark", TRACK_CHANGE_MARK_NAMES2;
|
|
436739
436915
|
var init_selection_info_resolver = __esm(() => {
|
|
436916
|
+
init_dist5();
|
|
436740
436917
|
init_tracked_change_resolver();
|
|
436741
436918
|
TRACK_CHANGE_MARK_NAMES2 = new Set(["trackInsert", "trackDelete", "trackFormat"]);
|
|
436742
436919
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/mcp",
|
|
3
|
-
"version": "0.3.0-next.
|
|
3
|
+
"version": "0.3.0-next.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20"
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"@types/node": "22.19.2",
|
|
21
21
|
"typescript": "^5.9.2",
|
|
22
22
|
"@superdoc/document-api": "0.0.1",
|
|
23
|
-
"
|
|
24
|
-
"superdoc": "
|
|
23
|
+
"superdoc": "1.29.1",
|
|
24
|
+
"@superdoc/super-editor": "0.0.1"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|