@superdoc-dev/cli 0.2.0-next.31 → 0.2.0-next.33
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 +659 -79
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -101805,9 +101805,9 @@ var init_remark_gfm_CQ3Jg4PR_es = __esm(() => {
|
|
|
101805
101805
|
init_remark_gfm_z_sDF4ss_es();
|
|
101806
101806
|
});
|
|
101807
101807
|
|
|
101808
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
101809
|
-
var
|
|
101810
|
-
__export(
|
|
101808
|
+
// ../../packages/superdoc/dist/chunks/src-DA7AHLPf.es.js
|
|
101809
|
+
var exports_src_DA7AHLPf_es = {};
|
|
101810
|
+
__export(exports_src_DA7AHLPf_es, {
|
|
101811
101811
|
zt: () => defineMark,
|
|
101812
101812
|
z: () => cM,
|
|
101813
101813
|
yt: () => removeAwarenessStates,
|
|
@@ -116703,10 +116703,23 @@ function tablesDistributeColumnsAdapter(editor, input2, options) {
|
|
|
116703
116703
|
});
|
|
116704
116704
|
}
|
|
116705
116705
|
const tableAttrs = tableNode.attrs;
|
|
116706
|
-
|
|
116706
|
+
const normalizedGrid = normalizeGridColumns(tableAttrs.grid);
|
|
116707
|
+
const tableAttrUpdates = {
|
|
116707
116708
|
...tableAttrs,
|
|
116708
116709
|
userEdited: true
|
|
116709
|
-
}
|
|
116710
|
+
};
|
|
116711
|
+
if (normalizedGrid) {
|
|
116712
|
+
const newColumns = normalizedGrid.columns.slice();
|
|
116713
|
+
const evenWidthTwips = Math.max(1, Math.round(evenWidth * PIXELS_TO_TWIPS));
|
|
116714
|
+
const maxColumn = Math.min(rangeEnd, newColumns.length - 1);
|
|
116715
|
+
for (let col = Math.max(rangeStart, 0);col <= maxColumn; col++)
|
|
116716
|
+
newColumns[col] = { col: evenWidthTwips };
|
|
116717
|
+
tableAttrUpdates.grid = serializeGridColumns(tableAttrs.grid, {
|
|
116718
|
+
...normalizedGrid,
|
|
116719
|
+
columns: newColumns
|
|
116720
|
+
});
|
|
116721
|
+
}
|
|
116722
|
+
tr.setNodeMarkup(tablePos, null, tableAttrUpdates);
|
|
116710
116723
|
applyDirectMutationMeta(tr);
|
|
116711
116724
|
editor.dispatch(tr);
|
|
116712
116725
|
clearIndexCache(editor);
|
|
@@ -116894,19 +116907,69 @@ function tablesInsertCellAdapter(editor, input2, options) {
|
|
|
116894
116907
|
return buildTableSuccess(table2.address);
|
|
116895
116908
|
try {
|
|
116896
116909
|
const tr = editor.state.tr;
|
|
116897
|
-
const
|
|
116910
|
+
const tablePos = table2.candidate.pos;
|
|
116911
|
+
const tableStart = tablePos + 1;
|
|
116898
116912
|
const tableNode = table2.candidate.node;
|
|
116899
116913
|
const map$22 = TableMap.get(tableNode);
|
|
116900
116914
|
const schema = editor.state.schema;
|
|
116901
116915
|
if (input2.mode === "shiftRight") {
|
|
116902
|
-
const
|
|
116903
|
-
|
|
116904
|
-
|
|
116905
|
-
|
|
116906
|
-
|
|
116907
|
-
|
|
116908
|
-
|
|
116909
|
-
|
|
116916
|
+
const slotCount = map$22.width * map$22.height;
|
|
116917
|
+
if (new Set(map$22.map).size !== slotCount)
|
|
116918
|
+
return toTableFailure("INVALID_TARGET", "Cell insertion with shiftRight is not supported for merged cells in this version.");
|
|
116919
|
+
const makeEmptyCell = (preferHeader = false) => {
|
|
116920
|
+
const candidateType = preferHeader ? schema.nodes.tableHeader ?? schema.nodes.tableCell : schema.nodes.tableCell;
|
|
116921
|
+
return candidateType.createAndFill({
|
|
116922
|
+
sdBlockId: v4_default(),
|
|
116923
|
+
paraId: generateParaId()
|
|
116924
|
+
}) ?? candidateType.createAndFill();
|
|
116925
|
+
};
|
|
116926
|
+
const overflowRowCells = [];
|
|
116927
|
+
for (let col = 0;col < map$22.width; col++) {
|
|
116928
|
+
const templateOffset = map$22.map[(map$22.height - 1) * map$22.width + col];
|
|
116929
|
+
const templateCell = tableNode.nodeAt(templateOffset);
|
|
116930
|
+
overflowRowCells.push(makeEmptyCell(templateCell?.type.name === "tableHeader"));
|
|
116931
|
+
}
|
|
116932
|
+
const overflowRowAttrs = {
|
|
116933
|
+
...tableNode.child(Math.max(0, map$22.height - 1)).attrs ?? {},
|
|
116934
|
+
sdBlockId: v4_default(),
|
|
116935
|
+
paraId: generateParaId()
|
|
116936
|
+
};
|
|
116937
|
+
const overflowRow = schema.nodes.tableRow.createAndFill(overflowRowAttrs, overflowRowCells) ?? schema.nodes.tableRow.create(overflowRowAttrs, overflowRowCells);
|
|
116938
|
+
if (!overflowRow)
|
|
116939
|
+
return toTableFailure("INVALID_TARGET", "Cell insertion could not construct an overflow row.");
|
|
116940
|
+
tr.insert(tablePos + tableNode.nodeSize - 1, overflowRow);
|
|
116941
|
+
const expandedTableNode = tr.doc.nodeAt(tablePos);
|
|
116942
|
+
if (!expandedTableNode || expandedTableNode.type.name !== "table")
|
|
116943
|
+
return toTableFailure("INVALID_TARGET", "Cell insertion could not locate expanded table state.");
|
|
116944
|
+
const expandedMap = TableMap.get(expandedTableNode);
|
|
116945
|
+
const expandedSlotCount = expandedMap.width * expandedMap.height;
|
|
116946
|
+
if (new Set(expandedMap.map).size !== expandedSlotCount)
|
|
116947
|
+
return toTableFailure("INVALID_TARGET", "Cell insertion with shiftRight produced an unsupported merged-table shape.");
|
|
116948
|
+
const rowMajorCells = [];
|
|
116949
|
+
for (let i$1 = 0;i$1 < expandedSlotCount; i$1++) {
|
|
116950
|
+
const offset$1 = expandedMap.map[i$1];
|
|
116951
|
+
const cell2 = expandedTableNode.nodeAt(offset$1);
|
|
116952
|
+
if (!cell2)
|
|
116953
|
+
return toTableFailure("INVALID_TARGET", "Cell insertion could not resolve expanded table cells.");
|
|
116954
|
+
rowMajorCells.push(cell2);
|
|
116955
|
+
}
|
|
116956
|
+
const targetLinearIndex = rowIndex * expandedMap.width + columnIndex;
|
|
116957
|
+
const targetOffset = expandedMap.map[targetLinearIndex];
|
|
116958
|
+
const targetCell = expandedTableNode.nodeAt(targetOffset);
|
|
116959
|
+
rowMajorCells.splice(targetLinearIndex, 0, makeEmptyCell(targetCell?.type.name === "tableHeader"));
|
|
116960
|
+
rowMajorCells.pop();
|
|
116961
|
+
const rebuiltRows = [];
|
|
116962
|
+
const rebuiltRowCount = rowMajorCells.length / expandedMap.width;
|
|
116963
|
+
for (let rebuiltRowIndex = 0;rebuiltRowIndex < rebuiltRowCount; rebuiltRowIndex++) {
|
|
116964
|
+
const rowAttrs = expandedTableNode.child(rebuiltRowIndex).attrs ?? {};
|
|
116965
|
+
const rowCells = rowMajorCells.slice(rebuiltRowIndex * expandedMap.width, (rebuiltRowIndex + 1) * expandedMap.width);
|
|
116966
|
+
const rebuiltRow = schema.nodes.tableRow.createAndFill(rowAttrs, rowCells) ?? schema.nodes.tableRow.create(rowAttrs, rowCells);
|
|
116967
|
+
if (!rebuiltRow)
|
|
116968
|
+
return toTableFailure("INVALID_TARGET", "Cell insertion could not construct a replacement row.");
|
|
116969
|
+
rebuiltRows.push(rebuiltRow);
|
|
116970
|
+
}
|
|
116971
|
+
const rebuiltTable = schema.nodes.table.create(expandedTableNode.attrs, rebuiltRows);
|
|
116972
|
+
tr.replaceWith(tablePos, tablePos + expandedTableNode.nodeSize, rebuiltTable);
|
|
116910
116973
|
} else {
|
|
116911
116974
|
const lastRowIdx = (map$22.height - 1) * map$22.width + columnIndex;
|
|
116912
116975
|
const lastCellPos = map$22.map[lastRowIdx];
|
|
@@ -120898,6 +120961,101 @@ function setFocusMeta(tr, value) {
|
|
|
120898
120961
|
function getFocusState(state) {
|
|
120899
120962
|
return CustomSelectionPluginKey.getState(state);
|
|
120900
120963
|
}
|
|
120964
|
+
function mapPreservedSelection(selection, tr) {
|
|
120965
|
+
if (!selection || !tr.docChanged)
|
|
120966
|
+
return selection;
|
|
120967
|
+
if (typeof selection.from !== "number" || typeof selection.to !== "number")
|
|
120968
|
+
return null;
|
|
120969
|
+
const from$12 = tr.mapping.map(selection.from, -1);
|
|
120970
|
+
const to = tr.mapping.map(selection.to, 1);
|
|
120971
|
+
if (from$12 >= to)
|
|
120972
|
+
return null;
|
|
120973
|
+
try {
|
|
120974
|
+
return TextSelection2.create(tr.doc, from$12, to);
|
|
120975
|
+
} catch {
|
|
120976
|
+
return null;
|
|
120977
|
+
}
|
|
120978
|
+
}
|
|
120979
|
+
function charOffsetToPosition(doc$2, charOffset, blockSep, leafSep) {
|
|
120980
|
+
const docSize = doc$2.content.size;
|
|
120981
|
+
if (charOffset <= 0)
|
|
120982
|
+
return 0;
|
|
120983
|
+
if (charOffset >= doc$2.textBetween(0, docSize, blockSep, leafSep).length)
|
|
120984
|
+
return docSize;
|
|
120985
|
+
let low = 0;
|
|
120986
|
+
let high = docSize;
|
|
120987
|
+
while (low < high) {
|
|
120988
|
+
const mid = Math.floor((low + high) / 2);
|
|
120989
|
+
if (doc$2.textBetween(0, mid, blockSep, leafSep).length < charOffset)
|
|
120990
|
+
low = mid + 1;
|
|
120991
|
+
else
|
|
120992
|
+
high = mid;
|
|
120993
|
+
}
|
|
120994
|
+
return low;
|
|
120995
|
+
}
|
|
120996
|
+
function findRangeByText(doc$2, text5, hintFrom) {
|
|
120997
|
+
if (!text5)
|
|
120998
|
+
return null;
|
|
120999
|
+
const docSize = doc$2.content.size;
|
|
121000
|
+
const full = doc$2.textBetween(0, docSize, TEXT_RANGE_BLOCK_SEP, TEXT_RANGE_LEAF_SEP);
|
|
121001
|
+
const matches2 = [];
|
|
121002
|
+
let i$1 = 0;
|
|
121003
|
+
for (;; ) {
|
|
121004
|
+
const idx = full.indexOf(text5, i$1);
|
|
121005
|
+
if (idx === -1)
|
|
121006
|
+
break;
|
|
121007
|
+
matches2.push(idx);
|
|
121008
|
+
i$1 = idx + 1;
|
|
121009
|
+
}
|
|
121010
|
+
if (matches2.length === 0)
|
|
121011
|
+
return null;
|
|
121012
|
+
const toPos = (charOffset) => charOffsetToPosition(doc$2, charOffset, TEXT_RANGE_BLOCK_SEP, TEXT_RANGE_LEAF_SEP);
|
|
121013
|
+
const initial = matches2[0];
|
|
121014
|
+
let charOffsetFrom;
|
|
121015
|
+
if (hintFrom == null)
|
|
121016
|
+
charOffsetFrom = initial;
|
|
121017
|
+
else
|
|
121018
|
+
charOffsetFrom = matches2.reduce((acc, idx) => {
|
|
121019
|
+
const pos = toPos(idx);
|
|
121020
|
+
return Math.abs(pos - hintFrom) < Math.abs(acc.bestPos - hintFrom) ? {
|
|
121021
|
+
best: idx,
|
|
121022
|
+
bestPos: pos
|
|
121023
|
+
} : acc;
|
|
121024
|
+
}, {
|
|
121025
|
+
best: initial,
|
|
121026
|
+
bestPos: toPos(initial)
|
|
121027
|
+
}).best;
|
|
121028
|
+
const from$12 = toPos(charOffsetFrom);
|
|
121029
|
+
const to = toPos(charOffsetFrom + text5.length);
|
|
121030
|
+
return from$12 < to ? {
|
|
121031
|
+
from: from$12,
|
|
121032
|
+
to
|
|
121033
|
+
} : null;
|
|
121034
|
+
}
|
|
121035
|
+
function resolveMovedRangeFromPrevious(doc$2, docSize, prev) {
|
|
121036
|
+
if (!prev.text)
|
|
121037
|
+
return null;
|
|
121038
|
+
const resolved = findRangeByText(doc$2, prev.text, prev.from);
|
|
121039
|
+
if (!resolved)
|
|
121040
|
+
return null;
|
|
121041
|
+
if (resolved.from < 0 || resolved.to <= resolved.from || resolved.to > docSize)
|
|
121042
|
+
return null;
|
|
121043
|
+
return resolved;
|
|
121044
|
+
}
|
|
121045
|
+
function restoreRangesFromPrevious(doc$2, docSize, previousRanges) {
|
|
121046
|
+
const out = [];
|
|
121047
|
+
for (const prev of previousRanges) {
|
|
121048
|
+
const resolved = resolveMovedRangeFromPrevious(doc$2, docSize, prev);
|
|
121049
|
+
if (!resolved)
|
|
121050
|
+
continue;
|
|
121051
|
+
out.push({
|
|
121052
|
+
...prev,
|
|
121053
|
+
from: resolved.from,
|
|
121054
|
+
to: resolved.to
|
|
121055
|
+
});
|
|
121056
|
+
}
|
|
121057
|
+
return out;
|
|
121058
|
+
}
|
|
120901
121059
|
function computeTabStops$1(context) {
|
|
120902
121060
|
const { explicitStops, defaultTabInterval, paragraphIndent } = context;
|
|
120903
121061
|
const leftIndent = paragraphIndent.left ?? 0;
|
|
@@ -122305,7 +122463,7 @@ function updateMaxFontInfo(currentMaxSize, currentMaxInfo, newRun) {
|
|
|
122305
122463
|
return getFontInfoFromRun(newRun);
|
|
122306
122464
|
return currentMaxInfo;
|
|
122307
122465
|
}
|
|
122308
|
-
function isTextRun$
|
|
122466
|
+
function isTextRun$5(run2) {
|
|
122309
122467
|
return run2.kind === "text" || run2.kind === undefined;
|
|
122310
122468
|
}
|
|
122311
122469
|
function isTabRun$1(run2) {
|
|
@@ -122423,9 +122581,9 @@ async function measureBlock(block, constraints) {
|
|
|
122423
122581
|
async function measureParagraphBlock(block, maxWidth) {
|
|
122424
122582
|
const ctx$2 = getCanvasContext();
|
|
122425
122583
|
const wordLayout = block.attrs?.wordLayout;
|
|
122426
|
-
const firstTextRunWithSize = block.runs.find((run2) => isTextRun$
|
|
122584
|
+
const firstTextRunWithSize = block.runs.find((run2) => isTextRun$5(run2) && ("fontSize" in run2) && run2.fontSize != null);
|
|
122427
122585
|
const fallbackFontSize = normalizeFontSize$1(firstTextRunWithSize?.fontSize, DEFAULT_PARAGRAPH_FONT_SIZE);
|
|
122428
|
-
const fallbackFontFamily = block.runs.find((run2) => isTextRun$
|
|
122586
|
+
const fallbackFontFamily = block.runs.find((run2) => isTextRun$5(run2) && typeof run2.fontFamily === "string" && run2.fontFamily.trim().length > 0)?.fontFamily ?? DEFAULT_PARAGRAPH_FONT_FAMILY;
|
|
122429
122587
|
const normalizedRuns = normalizeRunsForMeasurement(block.runs, fallbackFontSize, fallbackFontFamily);
|
|
122430
122588
|
const markerInfo = wordLayout?.marker ? (() => {
|
|
122431
122589
|
const { font: markerFont } = buildFontString({
|
|
@@ -131050,7 +131208,7 @@ function mergeAdjacentRuns(runs2) {
|
|
|
131050
131208
|
let current = runs2[0];
|
|
131051
131209
|
for (let i$1 = 1;i$1 < runs2.length; i$1++) {
|
|
131052
131210
|
const next2 = runs2[i$1];
|
|
131053
|
-
if (isTextRun$
|
|
131211
|
+
if (isTextRun$2(current) && isTextRun$2(next2) && !current.token && !next2.token && current.pmStart != null && current.pmEnd != null && next2.pmStart != null && next2.pmEnd != null && current.pmEnd === next2.pmStart && current.fontFamily === next2.fontFamily && current.fontSize === next2.fontSize && current.bold === next2.bold && current.italic === next2.italic && current.underline === next2.underline && current.strike === next2.strike && current.color === next2.color && current.highlight === next2.highlight && (current.letterSpacing ?? 0) === (next2.letterSpacing ?? 0) && trackedChangesCompatible(current, next2) && dataAttrsCompatible(current, next2) && commentsCompatible(current, next2)) {
|
|
131054
131212
|
const currText = current.text ?? "";
|
|
131055
131213
|
const nextText = next2.text ?? "";
|
|
131056
131214
|
current = {
|
|
@@ -132849,7 +133007,7 @@ function getCtx() {
|
|
|
132849
133007
|
ctx$1 = canvas.getContext("2d");
|
|
132850
133008
|
return ctx$1;
|
|
132851
133009
|
}
|
|
132852
|
-
function isTextRun(run2) {
|
|
133010
|
+
function isTextRun$1(run2) {
|
|
132853
133011
|
if (run2.kind === "tab" || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation")
|
|
132854
133012
|
return false;
|
|
132855
133013
|
if ("src" in run2)
|
|
@@ -132857,7 +133015,7 @@ function isTextRun(run2) {
|
|
|
132857
133015
|
return true;
|
|
132858
133016
|
}
|
|
132859
133017
|
function fontString(run2) {
|
|
132860
|
-
const textRun = isTextRun(run2) ? run2 : null;
|
|
133018
|
+
const textRun = isTextRun$1(run2) ? run2 : null;
|
|
132861
133019
|
const size$2 = textRun?.fontSize ?? 16;
|
|
132862
133020
|
const family = textRun?.fontFamily ?? "Arial";
|
|
132863
133021
|
return `${textRun?.italic ? "italic " : ""}${textRun?.bold ? "bold " : ""}${size$2}px ${family}`.trim();
|
|
@@ -132868,10 +133026,10 @@ function runText(run2) {
|
|
|
132868
133026
|
function measureRunSliceWidth(run2, fromChar, toChar) {
|
|
132869
133027
|
const context = getCtx();
|
|
132870
133028
|
const fullText = runText(run2);
|
|
132871
|
-
const transform = isTextRun(run2) ? run2.textTransform : undefined;
|
|
133029
|
+
const transform = isTextRun$1(run2) ? run2.textTransform : undefined;
|
|
132872
133030
|
const text5 = applyTextTransform(fullText.slice(fromChar, toChar), transform, fullText, fromChar);
|
|
132873
133031
|
if (!context) {
|
|
132874
|
-
const size$2 = (isTextRun(run2) ? run2 : null)?.fontSize ?? 16;
|
|
133032
|
+
const size$2 = (isTextRun$1(run2) ? run2 : null)?.fontSize ?? 16;
|
|
132875
133033
|
return Math.max(1, text5.length * (size$2 * 0.6));
|
|
132876
133034
|
}
|
|
132877
133035
|
context.font = fontString(run2);
|
|
@@ -132881,7 +133039,7 @@ function lineHeightForRuns(runs2, fromRun, toRun) {
|
|
|
132881
133039
|
let maxSize$1 = 0;
|
|
132882
133040
|
for (let i$1 = fromRun;i$1 <= toRun; i$1 += 1) {
|
|
132883
133041
|
const run2 = runs2[i$1];
|
|
132884
|
-
const size$2 = (run2 && isTextRun(run2) ? run2 : null)?.fontSize ?? 16;
|
|
133042
|
+
const size$2 = (run2 && isTextRun$1(run2) ? run2 : null)?.fontSize ?? 16;
|
|
132885
133043
|
if (size$2 > maxSize$1)
|
|
132886
133044
|
maxSize$1 = size$2;
|
|
132887
133045
|
}
|
|
@@ -136542,6 +136700,108 @@ async function layoutWithPerSectionConstraints(kind, blocksByRId, sectionMetadat
|
|
|
136542
136700
|
}
|
|
136543
136701
|
}
|
|
136544
136702
|
}
|
|
136703
|
+
function getBoundaries(ranges) {
|
|
136704
|
+
const set = /* @__PURE__ */ new Set;
|
|
136705
|
+
for (const r$1 of ranges) {
|
|
136706
|
+
if (Number.isFinite(r$1.from))
|
|
136707
|
+
set.add(r$1.from);
|
|
136708
|
+
if (Number.isFinite(r$1.to))
|
|
136709
|
+
set.add(r$1.to);
|
|
136710
|
+
}
|
|
136711
|
+
return [...set].sort((a2, b$1) => a2 - b$1);
|
|
136712
|
+
}
|
|
136713
|
+
function isTextRun(run2) {
|
|
136714
|
+
return "text" in run2 && typeof run2.text === "string";
|
|
136715
|
+
}
|
|
136716
|
+
function splitParagraphRuns(paragraph2, boundaries) {
|
|
136717
|
+
const newRuns = [];
|
|
136718
|
+
for (const run2 of paragraph2.runs) {
|
|
136719
|
+
if (!isTextRun(run2)) {
|
|
136720
|
+
newRuns.push(run2);
|
|
136721
|
+
continue;
|
|
136722
|
+
}
|
|
136723
|
+
const start$1 = run2.pmStart;
|
|
136724
|
+
const end$1 = run2.pmEnd;
|
|
136725
|
+
if (start$1 == null || end$1 == null || start$1 >= end$1) {
|
|
136726
|
+
newRuns.push(run2);
|
|
136727
|
+
continue;
|
|
136728
|
+
}
|
|
136729
|
+
const runBoundaries = boundaries.filter((b$1) => b$1 > start$1 && b$1 < end$1);
|
|
136730
|
+
if (runBoundaries.length === 0) {
|
|
136731
|
+
newRuns.push(run2);
|
|
136732
|
+
continue;
|
|
136733
|
+
}
|
|
136734
|
+
const positions = [
|
|
136735
|
+
start$1,
|
|
136736
|
+
...runBoundaries,
|
|
136737
|
+
end$1
|
|
136738
|
+
];
|
|
136739
|
+
for (let i$1 = 0;i$1 < positions.length - 1; i$1++) {
|
|
136740
|
+
const segStart = positions[i$1];
|
|
136741
|
+
const segEnd = positions[i$1 + 1];
|
|
136742
|
+
const charStart = segStart - start$1;
|
|
136743
|
+
const charEnd = segEnd - start$1;
|
|
136744
|
+
const segmentText = run2.text.slice(charStart, charEnd);
|
|
136745
|
+
if (segmentText.length === 0)
|
|
136746
|
+
continue;
|
|
136747
|
+
newRuns.push({
|
|
136748
|
+
...run2,
|
|
136749
|
+
text: segmentText,
|
|
136750
|
+
pmStart: segStart,
|
|
136751
|
+
pmEnd: segEnd
|
|
136752
|
+
});
|
|
136753
|
+
}
|
|
136754
|
+
}
|
|
136755
|
+
return {
|
|
136756
|
+
...paragraph2,
|
|
136757
|
+
runs: newRuns
|
|
136758
|
+
};
|
|
136759
|
+
}
|
|
136760
|
+
function splitRunsInTableCell(cell2, boundaries) {
|
|
136761
|
+
const result = { ...cell2 };
|
|
136762
|
+
if (cell2.paragraph)
|
|
136763
|
+
result.paragraph = splitParagraphRuns(cell2.paragraph, boundaries);
|
|
136764
|
+
if (cell2.blocks?.length)
|
|
136765
|
+
result.blocks = cell2.blocks.map((b$1) => {
|
|
136766
|
+
if (b$1.kind === "paragraph")
|
|
136767
|
+
return splitParagraphRuns(b$1, boundaries);
|
|
136768
|
+
if (b$1.kind === "table")
|
|
136769
|
+
return splitRunsInBlock(b$1, boundaries);
|
|
136770
|
+
return b$1;
|
|
136771
|
+
});
|
|
136772
|
+
return result;
|
|
136773
|
+
}
|
|
136774
|
+
function splitRunsInBlock(block, boundaries) {
|
|
136775
|
+
if (block.kind === "paragraph")
|
|
136776
|
+
return splitParagraphRuns(block, boundaries);
|
|
136777
|
+
if (block.kind === "table") {
|
|
136778
|
+
const table2 = block;
|
|
136779
|
+
return {
|
|
136780
|
+
...table2,
|
|
136781
|
+
rows: table2.rows.map((row2) => ({
|
|
136782
|
+
...row2,
|
|
136783
|
+
cells: row2.cells.map((cell2) => splitRunsInTableCell(cell2, boundaries))
|
|
136784
|
+
}))
|
|
136785
|
+
};
|
|
136786
|
+
}
|
|
136787
|
+
if (block.kind === "list") {
|
|
136788
|
+
const list5 = block;
|
|
136789
|
+
return {
|
|
136790
|
+
...list5,
|
|
136791
|
+
items: list5.items.map((item) => ({
|
|
136792
|
+
...item,
|
|
136793
|
+
paragraph: splitParagraphRuns(item.paragraph, boundaries)
|
|
136794
|
+
}))
|
|
136795
|
+
};
|
|
136796
|
+
}
|
|
136797
|
+
return block;
|
|
136798
|
+
}
|
|
136799
|
+
function splitRunsAtDecorationBoundaries(blocks2, ranges) {
|
|
136800
|
+
if (ranges.length === 0)
|
|
136801
|
+
return blocks2;
|
|
136802
|
+
const boundaries = getBoundaries(ranges);
|
|
136803
|
+
return blocks2.map((block) => splitRunsInBlock(block, boundaries));
|
|
136804
|
+
}
|
|
136545
136805
|
function dropCursor(options = {}) {
|
|
136546
136806
|
return new Plugin({ view(editorView) {
|
|
136547
136807
|
return new DropCursorView(editorView, options);
|
|
@@ -155448,19 +155708,35 @@ var Node$13 = class Node$14 {
|
|
|
155448
155708
|
return "default";
|
|
155449
155709
|
}
|
|
155450
155710
|
}
|
|
155451
|
-
}, NodeResizer, EXCLUDED_PLUGIN_KEY_REF_LIST, EXCLUDED_PLUGIN_KEY_REFS, EXCLUDED_PLUGIN_KEY_PREFIXES,
|
|
155711
|
+
}, NodeResizer, EXCLUDED_PLUGIN_KEY_REF_LIST, EXCLUDED_PLUGIN_KEY_REFS, EXCLUDED_PLUGIN_KEY_PREFIXES, TEXT_RANGE_BLOCK_SEP = `
|
|
155712
|
+
`, TEXT_RANGE_LEAF_SEP = `
|
|
155713
|
+
`, DecorationBridge = class DecorationBridge2 {
|
|
155452
155714
|
#applied = /* @__PURE__ */ new WeakMap;
|
|
155453
155715
|
#eligiblePlugins = [];
|
|
155454
155716
|
#pluginListSnapshot = [];
|
|
155455
155717
|
#prevDecorationSets = /* @__PURE__ */ new Map;
|
|
155456
155718
|
#hadEligiblePlugins = false;
|
|
155457
|
-
|
|
155719
|
+
#previousRanges = /* @__PURE__ */ new Map;
|
|
155720
|
+
#skipRestoreEmptyOnNextCollect = false;
|
|
155721
|
+
#lastDocChangeToken = 0;
|
|
155722
|
+
#docChangeMappingsByToken = /* @__PURE__ */ new Map;
|
|
155723
|
+
#previousRangesTokenByPlugin = /* @__PURE__ */ new Map;
|
|
155724
|
+
sync(state, domIndex$1, options) {
|
|
155458
155725
|
this.#refreshEligiblePlugins(state);
|
|
155459
155726
|
const docSize = state.doc.content.size;
|
|
155460
|
-
const
|
|
155727
|
+
const restoreEmpty = options?.restoreEmptyDecorations !== false;
|
|
155728
|
+
if (!restoreEmpty)
|
|
155729
|
+
this.#skipRestoreEmptyOnNextCollect = true;
|
|
155730
|
+
const desired = this.#eligiblePlugins.length > 0 ? this.#collectDesiredState(state, domIndex$1, docSize, restoreEmpty) : /* @__PURE__ */ new Map;
|
|
155461
155731
|
this.#hadEligiblePlugins = this.#eligiblePlugins.length > 0;
|
|
155462
155732
|
return this.#reconcile(desired, domIndex$1, docSize);
|
|
155463
155733
|
}
|
|
155734
|
+
recordTransaction(transaction) {
|
|
155735
|
+
if (!transaction?.docChanged)
|
|
155736
|
+
return;
|
|
155737
|
+
this.#lastDocChangeToken += 1;
|
|
155738
|
+
this.#docChangeMappingsByToken.set(this.#lastDocChangeToken, transaction.mapping);
|
|
155739
|
+
}
|
|
155464
155740
|
hasChanges(state) {
|
|
155465
155741
|
this.#refreshEligiblePlugins(state);
|
|
155466
155742
|
if (this.#eligiblePlugins.length === 0)
|
|
@@ -155470,11 +155746,66 @@ var Node$13 = class Node$14 {
|
|
|
155470
155746
|
return true;
|
|
155471
155747
|
return false;
|
|
155472
155748
|
}
|
|
155749
|
+
collectDecorationRanges(state) {
|
|
155750
|
+
this.#refreshEligiblePlugins(state);
|
|
155751
|
+
const ranges = [];
|
|
155752
|
+
const docSize = state.doc.content.size;
|
|
155753
|
+
for (const plugin$2 of this.#eligiblePlugins) {
|
|
155754
|
+
const pluginRanges = [];
|
|
155755
|
+
const decorationSet = this.#getDecorationSet(plugin$2, state);
|
|
155756
|
+
const prevDecorationSet = this.#prevDecorationSets.get(plugin$2);
|
|
155757
|
+
const remapped = this.#remapUnchangedPluginRangesIfNeeded(plugin$2, decorationSet, prevDecorationSet, state.doc, docSize);
|
|
155758
|
+
if (remapped)
|
|
155759
|
+
pluginRanges.push(...remapped);
|
|
155760
|
+
else if (decorationSet !== DecorationSet.empty) {
|
|
155761
|
+
const decorations = decorationSet.find(0, docSize);
|
|
155762
|
+
for (const decoration of decorations) {
|
|
155763
|
+
if (!this.#isInlineDecoration(decoration))
|
|
155764
|
+
continue;
|
|
155765
|
+
const attrs = this.#extractSafeAttrs(decoration);
|
|
155766
|
+
if (attrs.classes.length === 0 && attrs.styleEntries.length === 0)
|
|
155767
|
+
continue;
|
|
155768
|
+
if (decoration.from >= decoration.to)
|
|
155769
|
+
continue;
|
|
155770
|
+
const dataAttrs = {};
|
|
155771
|
+
for (const [key$1, value] of attrs.dataEntries)
|
|
155772
|
+
dataAttrs[key$1] = value;
|
|
155773
|
+
const rangeText = typeof state.doc.textBetween === "function" ? state.doc.textBetween(decoration.from, decoration.to, TEXT_RANGE_BLOCK_SEP, TEXT_RANGE_LEAF_SEP) : undefined;
|
|
155774
|
+
pluginRanges.push({
|
|
155775
|
+
from: decoration.from,
|
|
155776
|
+
to: decoration.to,
|
|
155777
|
+
classes: attrs.classes,
|
|
155778
|
+
style: attrs.styleEntries.length > 0 ? attrs.styleEntries.map(([prop, val]) => `${prop}: ${val}`).join("; ") : null,
|
|
155779
|
+
dataAttrs,
|
|
155780
|
+
...rangeText ? { text: rangeText } : {}
|
|
155781
|
+
});
|
|
155782
|
+
}
|
|
155783
|
+
}
|
|
155784
|
+
const previousPluginRanges = this.#previousRanges.get(plugin$2);
|
|
155785
|
+
const mayRestoreEmpty = !this.#skipRestoreEmptyOnNextCollect && previousPluginRanges && previousPluginRanges.length > 0;
|
|
155786
|
+
if (pluginRanges.length === 0 && mayRestoreEmpty)
|
|
155787
|
+
pluginRanges.push(...restoreRangesFromPrevious(state.doc, docSize, previousPluginRanges));
|
|
155788
|
+
this.#setPreviousRanges(plugin$2, pluginRanges.length > 0 ? [...pluginRanges] : []);
|
|
155789
|
+
this.#prevDecorationSets.set(plugin$2, decorationSet);
|
|
155790
|
+
ranges.push(...pluginRanges);
|
|
155791
|
+
}
|
|
155792
|
+
this.#clearSkipRestoreFlagIfSet();
|
|
155793
|
+
return ranges;
|
|
155794
|
+
}
|
|
155795
|
+
#clearSkipRestoreFlagIfSet() {
|
|
155796
|
+
if (this.#skipRestoreEmptyOnNextCollect)
|
|
155797
|
+
this.#skipRestoreEmptyOnNextCollect = false;
|
|
155798
|
+
}
|
|
155473
155799
|
destroy() {
|
|
155474
155800
|
this.#eligiblePlugins = [];
|
|
155475
155801
|
this.#pluginListSnapshot = [];
|
|
155476
155802
|
this.#prevDecorationSets.clear();
|
|
155803
|
+
this.#previousRanges.clear();
|
|
155804
|
+
this.#previousRangesTokenByPlugin.clear();
|
|
155477
155805
|
this.#hadEligiblePlugins = false;
|
|
155806
|
+
this.#skipRestoreEmptyOnNextCollect = false;
|
|
155807
|
+
this.#lastDocChangeToken = 0;
|
|
155808
|
+
this.#docChangeMappingsByToken.clear();
|
|
155478
155809
|
}
|
|
155479
155810
|
#refreshEligiblePlugins(state) {
|
|
155480
155811
|
if (state.plugins === this.#pluginListSnapshot)
|
|
@@ -155493,6 +155824,13 @@ var Node$13 = class Node$14 {
|
|
|
155493
155824
|
for (const key$1 of this.#prevDecorationSets.keys())
|
|
155494
155825
|
if (!eligibleSet.has(key$1))
|
|
155495
155826
|
this.#prevDecorationSets.delete(key$1);
|
|
155827
|
+
for (const key$1 of this.#previousRanges.keys())
|
|
155828
|
+
if (!eligibleSet.has(key$1))
|
|
155829
|
+
this.#previousRanges.delete(key$1);
|
|
155830
|
+
for (const key$1 of this.#previousRangesTokenByPlugin.keys())
|
|
155831
|
+
if (!eligibleSet.has(key$1))
|
|
155832
|
+
this.#previousRangesTokenByPlugin.delete(key$1);
|
|
155833
|
+
this.#pruneDocChangeMappings();
|
|
155496
155834
|
}
|
|
155497
155835
|
#isExcludedByKeyRef(plugin$2) {
|
|
155498
155836
|
const specKey = plugin$2.spec?.key;
|
|
@@ -155502,34 +155840,170 @@ var Node$13 = class Node$14 {
|
|
|
155502
155840
|
const keyString = plugin$2.key ?? "";
|
|
155503
155841
|
return EXCLUDED_PLUGIN_KEY_PREFIXES.some((prefix$2) => keyString === prefix$2 || keyString.startsWith(`${prefix$2}$`));
|
|
155504
155842
|
}
|
|
155505
|
-
#collectDesiredState(state, domIndex$1, docSize) {
|
|
155843
|
+
#collectDesiredState(state, domIndex$1, docSize, restoreEmptyDecorations) {
|
|
155506
155844
|
const desired = /* @__PURE__ */ new Map;
|
|
155507
155845
|
for (const plugin$2 of this.#eligiblePlugins) {
|
|
155508
155846
|
const decorationSet = this.#getDecorationSet(plugin$2, state);
|
|
155509
|
-
this.#prevDecorationSets.
|
|
155510
|
-
|
|
155847
|
+
const prevDecorationSet = this.#prevDecorationSets.get(plugin$2);
|
|
155848
|
+
const remapped = this.#remapUnchangedPluginRangesIfNeeded(plugin$2, decorationSet, prevDecorationSet, state.doc, docSize);
|
|
155849
|
+
if (remapped) {
|
|
155850
|
+
this.#applyRangesToDesired(desired, domIndex$1, remapped);
|
|
155851
|
+
this.#setPreviousRanges(plugin$2, [...remapped]);
|
|
155852
|
+
this.#prevDecorationSets.set(plugin$2, decorationSet);
|
|
155511
155853
|
continue;
|
|
155512
|
-
|
|
155513
|
-
|
|
155514
|
-
|
|
155515
|
-
|
|
155516
|
-
const
|
|
155517
|
-
|
|
155518
|
-
|
|
155519
|
-
|
|
155520
|
-
|
|
155521
|
-
|
|
155522
|
-
|
|
155523
|
-
|
|
155854
|
+
}
|
|
155855
|
+
let pluginHasCurrentRanges = false;
|
|
155856
|
+
const currentRanges = [];
|
|
155857
|
+
if (decorationSet !== DecorationSet.empty) {
|
|
155858
|
+
const decorations = decorationSet.find(0, docSize);
|
|
155859
|
+
for (const decoration of decorations) {
|
|
155860
|
+
if (!this.#isInlineDecoration(decoration))
|
|
155861
|
+
continue;
|
|
155862
|
+
const attrs = this.#extractSafeAttrs(decoration);
|
|
155863
|
+
if (attrs.classes.length === 0 && attrs.dataEntries.length === 0 && attrs.styleEntries.length === 0)
|
|
155864
|
+
continue;
|
|
155865
|
+
if (decoration.from >= decoration.to)
|
|
155866
|
+
continue;
|
|
155867
|
+
pluginHasCurrentRanges = true;
|
|
155868
|
+
const entries = domIndex$1.findEntriesInRange(decoration.from, decoration.to);
|
|
155869
|
+
for (const entry of entries) {
|
|
155870
|
+
const d = this.#getOrCreateDesired(desired, entry.el);
|
|
155871
|
+
for (const cls of attrs.classes)
|
|
155872
|
+
d.classes.add(cls);
|
|
155873
|
+
for (const [key$1, value] of attrs.dataEntries)
|
|
155874
|
+
d.dataAttrs.set(key$1, value);
|
|
155875
|
+
for (const [prop, value] of attrs.styleEntries)
|
|
155876
|
+
d.styleProps.set(prop, value);
|
|
155877
|
+
}
|
|
155878
|
+
const dataAttrs = {};
|
|
155524
155879
|
for (const [key$1, value] of attrs.dataEntries)
|
|
155525
|
-
|
|
155526
|
-
|
|
155527
|
-
|
|
155880
|
+
dataAttrs[key$1] = value;
|
|
155881
|
+
const style$1 = attrs.styleEntries.length > 0 ? attrs.styleEntries.map(([prop, val]) => `${prop}: ${val}`).join("; ") : null;
|
|
155882
|
+
const rangeText = typeof state.doc.textBetween === "function" ? state.doc.textBetween(decoration.from, decoration.to, TEXT_RANGE_BLOCK_SEP, TEXT_RANGE_LEAF_SEP) : undefined;
|
|
155883
|
+
currentRanges.push({
|
|
155884
|
+
from: decoration.from,
|
|
155885
|
+
to: decoration.to,
|
|
155886
|
+
classes: attrs.classes,
|
|
155887
|
+
style: style$1,
|
|
155888
|
+
dataAttrs,
|
|
155889
|
+
...rangeText ? { text: rangeText } : {}
|
|
155890
|
+
});
|
|
155528
155891
|
}
|
|
155529
155892
|
}
|
|
155893
|
+
if (pluginHasCurrentRanges) {
|
|
155894
|
+
this.#setPreviousRanges(plugin$2, currentRanges);
|
|
155895
|
+
this.#prevDecorationSets.set(plugin$2, decorationSet);
|
|
155896
|
+
continue;
|
|
155897
|
+
}
|
|
155898
|
+
if (!restoreEmptyDecorations) {
|
|
155899
|
+
this.#setPreviousRanges(plugin$2, []);
|
|
155900
|
+
this.#prevDecorationSets.set(plugin$2, decorationSet);
|
|
155901
|
+
continue;
|
|
155902
|
+
}
|
|
155903
|
+
const previousPluginRanges = this.#previousRanges.get(plugin$2);
|
|
155904
|
+
if (previousPluginRanges?.length) {
|
|
155905
|
+
const restoredRanges = restoreRangesFromPrevious(state.doc, docSize, previousPluginRanges);
|
|
155906
|
+
this.#applyRangesToDesired(desired, domIndex$1, restoredRanges);
|
|
155907
|
+
}
|
|
155908
|
+
this.#prevDecorationSets.set(plugin$2, decorationSet);
|
|
155530
155909
|
}
|
|
155531
155910
|
return desired;
|
|
155532
155911
|
}
|
|
155912
|
+
#applyRangesToDesired(desired, domIndex$1, ranges) {
|
|
155913
|
+
for (const range of ranges) {
|
|
155914
|
+
const entries = domIndex$1.findEntriesInRange(range.from, range.to);
|
|
155915
|
+
for (const entry of entries) {
|
|
155916
|
+
const d = this.#getOrCreateDesired(desired, entry.el);
|
|
155917
|
+
for (const cls of range.classes)
|
|
155918
|
+
d.classes.add(cls);
|
|
155919
|
+
for (const [key$1, value] of Object.entries(range.dataAttrs))
|
|
155920
|
+
d.dataAttrs.set(key$1, value);
|
|
155921
|
+
if (range.style)
|
|
155922
|
+
for (const [prop, value] of DecorationBridge2.#parseStyleString(range.style))
|
|
155923
|
+
d.styleProps.set(prop, value);
|
|
155924
|
+
}
|
|
155925
|
+
}
|
|
155926
|
+
}
|
|
155927
|
+
#setPreviousRanges(plugin$2, ranges) {
|
|
155928
|
+
this.#previousRanges.set(plugin$2, ranges);
|
|
155929
|
+
this.#previousRangesTokenByPlugin.set(plugin$2, this.#lastDocChangeToken);
|
|
155930
|
+
this.#pruneDocChangeMappings();
|
|
155931
|
+
}
|
|
155932
|
+
#getMappingsSinceToken(fromToken) {
|
|
155933
|
+
if (fromToken >= this.#lastDocChangeToken)
|
|
155934
|
+
return [];
|
|
155935
|
+
const mappings = [];
|
|
155936
|
+
for (let token = fromToken + 1;token <= this.#lastDocChangeToken; token += 1) {
|
|
155937
|
+
const mapping = this.#docChangeMappingsByToken.get(token);
|
|
155938
|
+
if (!mapping)
|
|
155939
|
+
return [];
|
|
155940
|
+
mappings.push(mapping);
|
|
155941
|
+
}
|
|
155942
|
+
return mappings;
|
|
155943
|
+
}
|
|
155944
|
+
#mapThroughMappings(pos, assoc, mappings) {
|
|
155945
|
+
let mapped = pos;
|
|
155946
|
+
for (const mapping of mappings)
|
|
155947
|
+
mapped = mapping.map(mapped, assoc);
|
|
155948
|
+
return mapped;
|
|
155949
|
+
}
|
|
155950
|
+
#pruneDocChangeMappings() {
|
|
155951
|
+
if (this.#docChangeMappingsByToken.size === 0)
|
|
155952
|
+
return;
|
|
155953
|
+
let minTrackedToken = this.#lastDocChangeToken;
|
|
155954
|
+
for (const token of this.#previousRangesTokenByPlugin.values())
|
|
155955
|
+
if (token < minTrackedToken)
|
|
155956
|
+
minTrackedToken = token;
|
|
155957
|
+
for (const token of this.#docChangeMappingsByToken.keys())
|
|
155958
|
+
if (token <= minTrackedToken)
|
|
155959
|
+
this.#docChangeMappingsByToken.delete(token);
|
|
155960
|
+
}
|
|
155961
|
+
#remapUnchangedPluginRangesIfNeeded(plugin$2, currentSet, previousSet, doc$2, docSize) {
|
|
155962
|
+
if (!previousSet || previousSet !== currentSet)
|
|
155963
|
+
return null;
|
|
155964
|
+
const previousRanges = this.#previousRanges.get(plugin$2);
|
|
155965
|
+
if (!previousRanges?.length)
|
|
155966
|
+
return null;
|
|
155967
|
+
const rangesToken = this.#previousRangesTokenByPlugin.get(plugin$2) ?? -1;
|
|
155968
|
+
if (rangesToken === this.#lastDocChangeToken)
|
|
155969
|
+
return previousRanges;
|
|
155970
|
+
const mappings = this.#getMappingsSinceToken(rangesToken);
|
|
155971
|
+
if (mappings.length === 0)
|
|
155972
|
+
return null;
|
|
155973
|
+
const remapped = [];
|
|
155974
|
+
for (const prev of previousRanges) {
|
|
155975
|
+
if (prev.text) {
|
|
155976
|
+
const resolved = findRangeByText(doc$2, prev.text, prev.from);
|
|
155977
|
+
if (resolved && resolved.from >= 0 && resolved.to > resolved.from && resolved.to <= docSize) {
|
|
155978
|
+
remapped.push({
|
|
155979
|
+
from: resolved.from,
|
|
155980
|
+
to: resolved.to,
|
|
155981
|
+
classes: prev.classes,
|
|
155982
|
+
style: prev.style,
|
|
155983
|
+
dataAttrs: prev.dataAttrs,
|
|
155984
|
+
text: prev.text
|
|
155985
|
+
});
|
|
155986
|
+
continue;
|
|
155987
|
+
}
|
|
155988
|
+
}
|
|
155989
|
+
const from$12 = this.#mapThroughMappings(prev.from, -1, mappings);
|
|
155990
|
+
const to = this.#mapThroughMappings(prev.to, 1, mappings);
|
|
155991
|
+
if (from$12 < 0 || to <= from$12 || to > docSize)
|
|
155992
|
+
continue;
|
|
155993
|
+
remapped.push({
|
|
155994
|
+
from: from$12,
|
|
155995
|
+
to,
|
|
155996
|
+
classes: prev.classes,
|
|
155997
|
+
style: prev.style,
|
|
155998
|
+
dataAttrs: prev.dataAttrs,
|
|
155999
|
+
text: prev.text
|
|
156000
|
+
});
|
|
156001
|
+
}
|
|
156002
|
+
if (remapped.length === 0)
|
|
156003
|
+
return null;
|
|
156004
|
+
this.#setPreviousRanges(plugin$2, remapped);
|
|
156005
|
+
return remapped;
|
|
156006
|
+
}
|
|
155533
156007
|
#getDecorationSet(plugin$2, state) {
|
|
155534
156008
|
try {
|
|
155535
156009
|
const result = plugin$2.props.decorations?.call(plugin$2, state);
|
|
@@ -156619,7 +157093,7 @@ var Node$13 = class Node$14 {
|
|
|
156619
157093
|
target: currentX + DEFAULT_TAB_INTERVAL_PX$1,
|
|
156620
157094
|
nextIndex: index2
|
|
156621
157095
|
};
|
|
156622
|
-
}, SINGLE_COLUMN_DEFAULT, isTextRun$
|
|
157096
|
+
}, SINGLE_COLUMN_DEFAULT, isTextRun$4 = (run2) => {
|
|
156623
157097
|
const runWithKind = run2;
|
|
156624
157098
|
return !runWithKind.kind || runWithKind.kind === "text";
|
|
156625
157099
|
}, isEmptyTextParagraph = (block) => {
|
|
@@ -156629,7 +157103,7 @@ var Node$13 = class Node$14 {
|
|
|
156629
157103
|
if (runs2.length !== 1)
|
|
156630
157104
|
return false;
|
|
156631
157105
|
const run2 = runs2[0];
|
|
156632
|
-
if (!isTextRun$
|
|
157106
|
+
if (!isTextRun$4(run2))
|
|
156633
157107
|
return false;
|
|
156634
157108
|
return typeof run2.text === "string" && run2.text.length === 0;
|
|
156635
157109
|
}, shouldSuppressSpacingForEmpty = (block, side) => {
|
|
@@ -159108,10 +159582,10 @@ var Node$13 = class Node$14 {
|
|
|
159108
159582
|
}
|
|
159109
159583
|
}, Y_SORT_THRESHOLD_PX = 2, Y_SAME_LINE_THRESHOLD_PX = 3, HORIZONTAL_OVERLAP_THRESHOLD = 0.8, isValidTrackedMode = (value) => {
|
|
159110
159584
|
return typeof value === "string" && VALID_TRACKED_MODES.includes(value);
|
|
159111
|
-
}, isTextRun$
|
|
159585
|
+
}, isTextRun$3 = (run2) => {
|
|
159112
159586
|
return "text" in run2 && run2.kind !== "tab";
|
|
159113
159587
|
}, stripTrackedChangeFromRun = (run2) => {
|
|
159114
|
-
if (!isTextRun$
|
|
159588
|
+
if (!isTextRun$3(run2))
|
|
159115
159589
|
return;
|
|
159116
159590
|
if ("trackedChange" in run2 && run2.trackedChange)
|
|
159117
159591
|
delete run2.trackedChange;
|
|
@@ -159177,14 +159651,14 @@ var Node$13 = class Node$14 {
|
|
|
159177
159651
|
runs2.forEach((run2) => stripTrackedChangeFromRun(run2));
|
|
159178
159652
|
else
|
|
159179
159653
|
runs2.forEach((run2) => {
|
|
159180
|
-
if (isTextRun$
|
|
159654
|
+
if (isTextRun$3(run2))
|
|
159181
159655
|
applyFormatChangeMarks(run2, config2, hyperlinkConfig, applyMarksToRun$1, themeColors, enableComments);
|
|
159182
159656
|
});
|
|
159183
159657
|
return runs2;
|
|
159184
159658
|
}
|
|
159185
159659
|
const filtered = [];
|
|
159186
159660
|
runs2.forEach((run2) => {
|
|
159187
|
-
if (!isTextRun$
|
|
159661
|
+
if (!isTextRun$3(run2)) {
|
|
159188
159662
|
filtered.push(run2);
|
|
159189
159663
|
return;
|
|
159190
159664
|
}
|
|
@@ -159203,12 +159677,12 @@ var Node$13 = class Node$14 {
|
|
|
159203
159677
|
filtered.forEach((run2) => stripTrackedChangeFromRun(run2));
|
|
159204
159678
|
else {
|
|
159205
159679
|
filtered.forEach((run2) => {
|
|
159206
|
-
if (isTextRun$
|
|
159680
|
+
if (isTextRun$3(run2))
|
|
159207
159681
|
applyFormatChangeMarks(run2, config2, hyperlinkConfig || DEFAULT_HYPERLINK_CONFIG, applyMarksToRun$1, themeColors, enableComments);
|
|
159208
159682
|
});
|
|
159209
159683
|
if ((config2.mode === "original" || config2.mode === "final") && config2.enabled)
|
|
159210
159684
|
filtered.forEach((run2) => {
|
|
159211
|
-
if (isTextRun$
|
|
159685
|
+
if (isTextRun$3(run2) && run2.trackedChange && (run2.trackedChange.kind === "insert" || run2.trackedChange.kind === "delete"))
|
|
159212
159686
|
delete run2.trackedChange;
|
|
159213
159687
|
});
|
|
159214
159688
|
}
|
|
@@ -159818,7 +160292,12 @@ var Node$13 = class Node$14 {
|
|
|
159818
160292
|
if (history$1 != null)
|
|
159819
160293
|
link2.history = history$1;
|
|
159820
160294
|
return link2;
|
|
159821
|
-
}, TRACK_INSERT_MARK = "trackInsert", TRACK_DELETE_MARK = "trackDelete", TRACK_FORMAT_MARK = "trackFormat", TRACK_CHANGE_KIND_MAP, TRACK_CHANGE_PRIORITY, MAX_RUN_MARK_JSON_LENGTH = 1e4, MAX_RUN_MARK_ARRAY_LENGTH = 100, MAX_RUN_MARK_DEPTH = 5,
|
|
160295
|
+
}, TRACK_INSERT_MARK = "trackInsert", TRACK_DELETE_MARK = "trackDelete", TRACK_FORMAT_MARK = "trackFormat", TRACK_CHANGE_KIND_MAP, TRACK_CHANGE_PRIORITY, MAX_RUN_MARK_JSON_LENGTH = 1e4, MAX_RUN_MARK_ARRAY_LENGTH = 100, MAX_RUN_MARK_DEPTH = 5, RANDOM_ID_LENGTH = 9, generateRandomBase36Id = (length$1) => {
|
|
160296
|
+
let randomId = "";
|
|
160297
|
+
while (randomId.length < length$1)
|
|
160298
|
+
randomId += Math.random().toString(36).slice(2);
|
|
160299
|
+
return randomId.slice(0, length$1);
|
|
160300
|
+
}, validateDepth = (obj, currentDepth = 0) => {
|
|
159822
160301
|
if (currentDepth > MAX_RUN_MARK_DEPTH)
|
|
159823
160302
|
return false;
|
|
159824
160303
|
if (obj && typeof obj === "object") {
|
|
@@ -160026,7 +160505,7 @@ var Node$13 = class Node$14 {
|
|
|
160026
160505
|
}, deriveTrackedChangeId = (kind, attrs) => {
|
|
160027
160506
|
if (attrs && typeof attrs.id === "string" && attrs.id.trim())
|
|
160028
160507
|
return attrs.id;
|
|
160029
|
-
return `${kind}-${attrs && typeof attrs.authorEmail === "string" ? attrs.authorEmail : "unknown"}-${attrs && typeof attrs.date === "string" ? attrs.date : "unknown"}-${`${Date.now()}-${
|
|
160508
|
+
return `${kind}-${attrs && typeof attrs.authorEmail === "string" ? attrs.authorEmail : "unknown"}-${attrs && typeof attrs.date === "string" ? attrs.date : "unknown"}-${`${Date.now()}-${generateRandomBase36Id(RANDOM_ID_LENGTH)}`}`;
|
|
160030
160509
|
}, buildTrackedChangeMetaFromMark = (mark2) => {
|
|
160031
160510
|
const kind = pickTrackedChangeKind(mark2.type);
|
|
160032
160511
|
if (!kind)
|
|
@@ -160989,7 +161468,7 @@ var Node$13 = class Node$14 {
|
|
|
160989
161468
|
if (attrs.hidden === true)
|
|
160990
161469
|
return true;
|
|
160991
161470
|
return typeof attrs.visibility === "string" && attrs.visibility.toLowerCase() === "hidden";
|
|
160992
|
-
}, isTextRun$
|
|
161471
|
+
}, isTextRun$2 = (run2) => {
|
|
160993
161472
|
const kind = run2.kind;
|
|
160994
161473
|
return (kind === undefined || kind === "text") && "text" in run2;
|
|
160995
161474
|
}, dataAttrsCompatible = (a2, b$1) => {
|
|
@@ -172564,7 +173043,7 @@ var Node$13 = class Node$14 {
|
|
|
172564
173043
|
trackedChanges: context.trackedChanges ?? []
|
|
172565
173044
|
});
|
|
172566
173045
|
}, _hoisted_1$6, _hoisted_2$1, _hoisted_3, _hoisted_4, ContextMenu_default, _hoisted_1$5, BasicUpload_default, _hoisted_1$4, MIN_WIDTH = 200, PPI = 96, alignment = "flex-end", Ruler_default, GenericPopover_default, _hoisted_1$3, RESIZE_HANDLE_WIDTH_PX = 9, RESIZE_HANDLE_OFFSET_PX = 4, DRAG_OVERLAY_EXTENSION_PX = 1000, MIN_DRAG_OVERLAY_WIDTH_PX = 2000, THROTTLE_INTERVAL_MS = 16, MIN_RESIZE_DELTA_PX = 1, TableResizeOverlay_default, _hoisted_1$2, OVERLAY_EXPANSION_PX = 2000, RESIZE_HANDLE_SIZE_PX = 12, MOUSE_MOVE_THROTTLE_MS = 16, DIMENSION_CHANGE_THRESHOLD_PX = 1, Z_INDEX_OVERLAY = 10, Z_INDEX_HANDLE = 15, Z_INDEX_GUIDELINE = 20, ImageResizeOverlay_default, LINK_CLICK_DEBOUNCE_MS = 300, CURSOR_UPDATE_TIMEOUT_MS = 10, LinkClickHandler_default, _hoisted_1$1, _hoisted_2, DOCX2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", TABLE_RESIZE_HOVER_THRESHOLD = 8, TABLE_RESIZE_THROTTLE_MS = 16, SuperEditor_default, _hoisted_1, SuperInput_default, SlashMenu, Extensions;
|
|
172567
|
-
var
|
|
173046
|
+
var init_src_DA7AHLPf_es = __esm(() => {
|
|
172568
173047
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
172569
173048
|
init_SuperConverter_BSZgN87C_es();
|
|
172570
173049
|
init_jszip_ChlR43oI_es();
|
|
@@ -183445,12 +183924,25 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
183445
183924
|
init: () => ({ ...DEFAULT_SELECTION_STATE }),
|
|
183446
183925
|
apply: (tr, value) => {
|
|
183447
183926
|
const meta2 = getFocusMeta(tr);
|
|
183448
|
-
|
|
183927
|
+
const nextState = meta2 !== undefined ? normalizeSelectionState({
|
|
183928
|
+
...value,
|
|
183929
|
+
...meta2
|
|
183930
|
+
}) : value;
|
|
183931
|
+
if (!nextState?.preservedSelection)
|
|
183932
|
+
return nextState;
|
|
183933
|
+
if (!tr.docChanged)
|
|
183934
|
+
return nextState;
|
|
183935
|
+
const mappedSelection = mapPreservedSelection(nextState.preservedSelection, tr);
|
|
183936
|
+
if (!mappedSelection)
|
|
183449
183937
|
return {
|
|
183450
|
-
...
|
|
183451
|
-
|
|
183938
|
+
...nextState,
|
|
183939
|
+
preservedSelection: null,
|
|
183940
|
+
showVisualSelection: false
|
|
183452
183941
|
};
|
|
183453
|
-
return
|
|
183942
|
+
return {
|
|
183943
|
+
...nextState,
|
|
183944
|
+
preservedSelection: mappedSelection
|
|
183945
|
+
};
|
|
183454
183946
|
}
|
|
183455
183947
|
},
|
|
183456
183948
|
view: () => {
|
|
@@ -191869,7 +192361,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
191869
192361
|
try {
|
|
191870
192362
|
this.#decorationBridge.sync(state, this.#domPositionIndex);
|
|
191871
192363
|
} catch (error) {
|
|
191872
|
-
|
|
192364
|
+
console.warn("[PresentationEditor] Decoration sync failed:", error);
|
|
191873
192365
|
}
|
|
191874
192366
|
}
|
|
191875
192367
|
#scheduleDecorationSync() {
|
|
@@ -191921,8 +192413,21 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
191921
192413
|
this.#updateLocalAwarenessCursor();
|
|
191922
192414
|
this.#scheduleA11ySelectionAnnouncement();
|
|
191923
192415
|
};
|
|
191924
|
-
const handleTransaction = () => {
|
|
191925
|
-
|
|
192416
|
+
const handleTransaction = (event) => {
|
|
192417
|
+
const tr = event?.transaction;
|
|
192418
|
+
this.#decorationBridge.recordTransaction(tr);
|
|
192419
|
+
const state = this.#editor?.view?.state;
|
|
192420
|
+
const decorationChanged = state && this.#decorationBridge.hasChanges(state);
|
|
192421
|
+
if (decorationChanged) {
|
|
192422
|
+
const restoreEmpty = tr ? tr.docChanged === true : false;
|
|
192423
|
+
this.#decorationBridge.sync(state, this.#domPositionIndex, { restoreEmptyDecorations: restoreEmpty });
|
|
192424
|
+
} else
|
|
192425
|
+
this.#scheduleDecorationSync();
|
|
192426
|
+
if (decorationChanged) {
|
|
192427
|
+
this.#pendingDocChange = true;
|
|
192428
|
+
this.#selectionSync.onLayoutStart();
|
|
192429
|
+
this.#scheduleRerender();
|
|
192430
|
+
}
|
|
191926
192431
|
};
|
|
191927
192432
|
this.#editor.on("update", handleUpdate);
|
|
191928
192433
|
this.#editor.on("selectionUpdate", handleSelection);
|
|
@@ -192373,6 +192878,13 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
192373
192878
|
this.#handleLayoutError("render", /* @__PURE__ */ new Error("toFlowBlocks returned undefined blocks"));
|
|
192374
192879
|
return;
|
|
192375
192880
|
}
|
|
192881
|
+
const state = this.#editor?.view?.state;
|
|
192882
|
+
const decorationRanges = state ? this.#decorationBridge.collectDecorationRanges(state) : [];
|
|
192883
|
+
if (decorationRanges.length > 0)
|
|
192884
|
+
blocks2 = splitRunsAtDecorationBoundaries(blocks2, decorationRanges.map((r$1) => ({
|
|
192885
|
+
from: r$1.from,
|
|
192886
|
+
to: r$1.to
|
|
192887
|
+
})));
|
|
192376
192888
|
this.#applyHtmlAnnotationMeasurements(blocks2);
|
|
192377
192889
|
const baseLayoutOptions = this.#resolveLayoutOptions(blocks2, sectionMetadata);
|
|
192378
192890
|
const footnotesLayoutInput = buildFootnotesInput(this.#editor?.state, this.#editor?.converter, converterContext, this.#editor?.converter?.themeColors ?? undefined);
|
|
@@ -203424,8 +203936,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
203424
203936
|
return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
|
|
203425
203937
|
};
|
|
203426
203938
|
stubFalse_default = stubFalse;
|
|
203427
|
-
freeExports$2 = typeof
|
|
203428
|
-
freeModule$2 = freeExports$2 && typeof
|
|
203939
|
+
freeExports$2 = typeof exports_src_DA7AHLPf_es == "object" && exports_src_DA7AHLPf_es && !exports_src_DA7AHLPf_es.nodeType && exports_src_DA7AHLPf_es;
|
|
203940
|
+
freeModule$2 = freeExports$2 && typeof module_src_DA7AHLPf_es == "object" && module_src_DA7AHLPf_es && !module_src_DA7AHLPf_es.nodeType && module_src_DA7AHLPf_es;
|
|
203429
203941
|
Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
|
|
203430
203942
|
isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
|
|
203431
203943
|
typedArrayTags = {};
|
|
@@ -203433,8 +203945,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
203433
203945
|
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
|
|
203434
203946
|
_baseIsTypedArray_default = baseIsTypedArray;
|
|
203435
203947
|
_baseUnary_default = baseUnary;
|
|
203436
|
-
freeExports$1 = typeof
|
|
203437
|
-
freeModule$1 = freeExports$1 && typeof
|
|
203948
|
+
freeExports$1 = typeof exports_src_DA7AHLPf_es == "object" && exports_src_DA7AHLPf_es && !exports_src_DA7AHLPf_es.nodeType && exports_src_DA7AHLPf_es;
|
|
203949
|
+
freeModule$1 = freeExports$1 && typeof module_src_DA7AHLPf_es == "object" && module_src_DA7AHLPf_es && !module_src_DA7AHLPf_es.nodeType && module_src_DA7AHLPf_es;
|
|
203438
203950
|
freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
|
|
203439
203951
|
_nodeUtil_default = function() {
|
|
203440
203952
|
try {
|
|
@@ -203539,8 +204051,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
203539
204051
|
Stack.prototype.has = _stackHas_default;
|
|
203540
204052
|
Stack.prototype.set = _stackSet_default;
|
|
203541
204053
|
_Stack_default = Stack;
|
|
203542
|
-
freeExports = typeof
|
|
203543
|
-
freeModule = freeExports && typeof
|
|
204054
|
+
freeExports = typeof exports_src_DA7AHLPf_es == "object" && exports_src_DA7AHLPf_es && !exports_src_DA7AHLPf_es.nodeType && exports_src_DA7AHLPf_es;
|
|
204055
|
+
freeModule = freeExports && typeof module_src_DA7AHLPf_es == "object" && module_src_DA7AHLPf_es && !module_src_DA7AHLPf_es.nodeType && module_src_DA7AHLPf_es;
|
|
203544
204056
|
Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
|
|
203545
204057
|
allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
|
|
203546
204058
|
_cloneBuffer_default = cloneBuffer;
|
|
@@ -211192,7 +211704,7 @@ var init_zipper_Cnk_HjM2_es = __esm(() => {
|
|
|
211192
211704
|
|
|
211193
211705
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
211194
211706
|
var init_super_editor_es = __esm(() => {
|
|
211195
|
-
|
|
211707
|
+
init_src_DA7AHLPf_es();
|
|
211196
211708
|
init_SuperConverter_BSZgN87C_es();
|
|
211197
211709
|
init_jszip_ChlR43oI_es();
|
|
211198
211710
|
init_xml_js_DLE8mr0n_es();
|
|
@@ -271678,7 +272190,18 @@ function tablesDistributeColumnsAdapter2(editor, input2, options) {
|
|
|
271678
272190
|
}
|
|
271679
272191
|
}
|
|
271680
272192
|
const tableAttrs = tableNode.attrs;
|
|
271681
|
-
|
|
272193
|
+
const normalizedGrid = normalizeGridColumns2(tableAttrs.grid);
|
|
272194
|
+
const tableAttrUpdates = { ...tableAttrs, userEdited: true };
|
|
272195
|
+
if (normalizedGrid) {
|
|
272196
|
+
const newColumns = normalizedGrid.columns.slice();
|
|
272197
|
+
const evenWidthTwips = Math.max(1, Math.round(evenWidth * PIXELS_TO_TWIPS2));
|
|
272198
|
+
const maxColumn = Math.min(rangeEnd, newColumns.length - 1);
|
|
272199
|
+
for (let col = Math.max(rangeStart, 0);col <= maxColumn; col++) {
|
|
272200
|
+
newColumns[col] = { col: evenWidthTwips };
|
|
272201
|
+
}
|
|
272202
|
+
tableAttrUpdates.grid = serializeGridColumns2(tableAttrs.grid, { ...normalizedGrid, columns: newColumns });
|
|
272203
|
+
}
|
|
272204
|
+
tr.setNodeMarkup(tablePos, null, tableAttrUpdates);
|
|
271682
272205
|
applyDirectMutationMeta2(tr);
|
|
271683
272206
|
editor.dispatch(tr);
|
|
271684
272207
|
clearIndexCache2(editor);
|
|
@@ -271879,15 +272402,72 @@ function tablesInsertCellAdapter2(editor, input2, options) {
|
|
|
271879
272402
|
const map8 = TableMap2.get(tableNode);
|
|
271880
272403
|
const schema = editor.state.schema;
|
|
271881
272404
|
if (input2.mode === "shiftRight") {
|
|
271882
|
-
const
|
|
271883
|
-
const
|
|
271884
|
-
|
|
271885
|
-
|
|
271886
|
-
|
|
272405
|
+
const slotCount = map8.width * map8.height;
|
|
272406
|
+
const uniqueOffsets = new Set(map8.map);
|
|
272407
|
+
if (uniqueOffsets.size !== slotCount) {
|
|
272408
|
+
return toTableFailure2("INVALID_TARGET", "Cell insertion with shiftRight is not supported for merged cells in this version.");
|
|
272409
|
+
}
|
|
272410
|
+
const makeEmptyCell = (preferHeader = false) => {
|
|
272411
|
+
const candidateType = preferHeader ? schema.nodes.tableHeader ?? schema.nodes.tableCell : schema.nodes.tableCell;
|
|
272412
|
+
return candidateType.createAndFill({
|
|
272413
|
+
sdBlockId: v42(),
|
|
272414
|
+
paraId: generateParaId2()
|
|
272415
|
+
}) ?? candidateType.createAndFill();
|
|
272416
|
+
};
|
|
272417
|
+
const overflowRowCells = [];
|
|
272418
|
+
for (let col = 0;col < map8.width; col++) {
|
|
272419
|
+
const templateOffset = map8.map[(map8.height - 1) * map8.width + col];
|
|
272420
|
+
const templateCell = tableNode.nodeAt(templateOffset);
|
|
272421
|
+
overflowRowCells.push(makeEmptyCell(templateCell?.type.name === "tableHeader"));
|
|
271887
272422
|
}
|
|
271888
|
-
const
|
|
271889
|
-
const
|
|
271890
|
-
|
|
272423
|
+
const templateRowAttrs = tableNode.child(Math.max(0, map8.height - 1)).attrs ?? {};
|
|
272424
|
+
const overflowRowAttrs = {
|
|
272425
|
+
...templateRowAttrs,
|
|
272426
|
+
sdBlockId: v42(),
|
|
272427
|
+
paraId: generateParaId2()
|
|
272428
|
+
};
|
|
272429
|
+
const overflowRow = schema.nodes.tableRow.createAndFill(overflowRowAttrs, overflowRowCells) ?? schema.nodes.tableRow.create(overflowRowAttrs, overflowRowCells);
|
|
272430
|
+
if (!overflowRow) {
|
|
272431
|
+
return toTableFailure2("INVALID_TARGET", "Cell insertion could not construct an overflow row.");
|
|
272432
|
+
}
|
|
272433
|
+
tr.insert(tablePos + tableNode.nodeSize - 1, overflowRow);
|
|
272434
|
+
const expandedTableNode = tr.doc.nodeAt(tablePos);
|
|
272435
|
+
if (!expandedTableNode || expandedTableNode.type.name !== "table") {
|
|
272436
|
+
return toTableFailure2("INVALID_TARGET", "Cell insertion could not locate expanded table state.");
|
|
272437
|
+
}
|
|
272438
|
+
const expandedMap = TableMap2.get(expandedTableNode);
|
|
272439
|
+
const expandedSlotCount = expandedMap.width * expandedMap.height;
|
|
272440
|
+
if (new Set(expandedMap.map).size !== expandedSlotCount) {
|
|
272441
|
+
return toTableFailure2("INVALID_TARGET", "Cell insertion with shiftRight produced an unsupported merged-table shape.");
|
|
272442
|
+
}
|
|
272443
|
+
const rowMajorCells = [];
|
|
272444
|
+
for (let i5 = 0;i5 < expandedSlotCount; i5++) {
|
|
272445
|
+
const offset2 = expandedMap.map[i5];
|
|
272446
|
+
const cell2 = expandedTableNode.nodeAt(offset2);
|
|
272447
|
+
if (!cell2) {
|
|
272448
|
+
return toTableFailure2("INVALID_TARGET", "Cell insertion could not resolve expanded table cells.");
|
|
272449
|
+
}
|
|
272450
|
+
rowMajorCells.push(cell2);
|
|
272451
|
+
}
|
|
272452
|
+
const targetLinearIndex = rowIndex * expandedMap.width + columnIndex;
|
|
272453
|
+
const targetOffset = expandedMap.map[targetLinearIndex];
|
|
272454
|
+
const targetCell = expandedTableNode.nodeAt(targetOffset);
|
|
272455
|
+
rowMajorCells.splice(targetLinearIndex, 0, makeEmptyCell(targetCell?.type.name === "tableHeader"));
|
|
272456
|
+
rowMajorCells.pop();
|
|
272457
|
+
const rebuiltRows = [];
|
|
272458
|
+
const rebuiltRowCount = rowMajorCells.length / expandedMap.width;
|
|
272459
|
+
for (let rebuiltRowIndex = 0;rebuiltRowIndex < rebuiltRowCount; rebuiltRowIndex++) {
|
|
272460
|
+
const sourceRow = expandedTableNode.child(rebuiltRowIndex);
|
|
272461
|
+
const rowAttrs = sourceRow.attrs ?? {};
|
|
272462
|
+
const rowCells = rowMajorCells.slice(rebuiltRowIndex * expandedMap.width, (rebuiltRowIndex + 1) * expandedMap.width);
|
|
272463
|
+
const rebuiltRow = schema.nodes.tableRow.createAndFill(rowAttrs, rowCells) ?? schema.nodes.tableRow.create(rowAttrs, rowCells);
|
|
272464
|
+
if (!rebuiltRow) {
|
|
272465
|
+
return toTableFailure2("INVALID_TARGET", "Cell insertion could not construct a replacement row.");
|
|
272466
|
+
}
|
|
272467
|
+
rebuiltRows.push(rebuiltRow);
|
|
272468
|
+
}
|
|
272469
|
+
const rebuiltTable = schema.nodes.table.create(expandedTableNode.attrs, rebuiltRows);
|
|
272470
|
+
tr.replaceWith(tablePos, tablePos + expandedTableNode.nodeSize, rebuiltTable);
|
|
271891
272471
|
} else {
|
|
271892
272472
|
const lastRowIdx = (map8.height - 1) * map8.width + columnIndex;
|
|
271893
272473
|
const lastCellPos = map8.map[lastRowIdx];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.2.0-next.
|
|
3
|
+
"version": "0.2.0-next.33",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"@types/bun": "^1.3.8",
|
|
20
20
|
"@types/node": "22.19.2",
|
|
21
21
|
"typescript": "^5.9.2",
|
|
22
|
-
"@superdoc/pm-adapter": "0.0.0",
|
|
23
22
|
"@superdoc/document-api": "0.0.1",
|
|
23
|
+
"@superdoc/pm-adapter": "0.0.0",
|
|
24
24
|
"superdoc": "1.16.0",
|
|
25
25
|
"@superdoc/super-editor": "0.0.1"
|
|
26
26
|
},
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"optionalDependencies": {
|
|
32
|
-
"@superdoc-dev/cli-darwin-
|
|
33
|
-
"@superdoc-dev/cli-darwin-
|
|
34
|
-
"@superdoc-dev/cli-linux-x64": "0.2.0-next.
|
|
35
|
-
"@superdoc-dev/cli-
|
|
36
|
-
"@superdoc-dev/cli-
|
|
32
|
+
"@superdoc-dev/cli-darwin-x64": "0.2.0-next.33",
|
|
33
|
+
"@superdoc-dev/cli-darwin-arm64": "0.2.0-next.33",
|
|
34
|
+
"@superdoc-dev/cli-linux-x64": "0.2.0-next.33",
|
|
35
|
+
"@superdoc-dev/cli-linux-arm64": "0.2.0-next.33",
|
|
36
|
+
"@superdoc-dev/cli-windows-x64": "0.2.0-next.33"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"dev": "bun run src/index.ts",
|