@superdoc-dev/cli 0.2.0-next.31 → 0.2.0-next.32
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 +535 -62
- package/package.json +9 -9
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-DKGc94QA.es.js
|
|
101809
|
+
var exports_src_DKGc94QA_es = {};
|
|
101810
|
+
__export(exports_src_DKGc94QA_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);
|
|
@@ -120898,6 +120911,101 @@ function setFocusMeta(tr, value) {
|
|
|
120898
120911
|
function getFocusState(state) {
|
|
120899
120912
|
return CustomSelectionPluginKey.getState(state);
|
|
120900
120913
|
}
|
|
120914
|
+
function mapPreservedSelection(selection, tr) {
|
|
120915
|
+
if (!selection || !tr.docChanged)
|
|
120916
|
+
return selection;
|
|
120917
|
+
if (typeof selection.from !== "number" || typeof selection.to !== "number")
|
|
120918
|
+
return null;
|
|
120919
|
+
const from$12 = tr.mapping.map(selection.from, -1);
|
|
120920
|
+
const to = tr.mapping.map(selection.to, 1);
|
|
120921
|
+
if (from$12 >= to)
|
|
120922
|
+
return null;
|
|
120923
|
+
try {
|
|
120924
|
+
return TextSelection2.create(tr.doc, from$12, to);
|
|
120925
|
+
} catch {
|
|
120926
|
+
return null;
|
|
120927
|
+
}
|
|
120928
|
+
}
|
|
120929
|
+
function charOffsetToPosition(doc$2, charOffset, blockSep, leafSep) {
|
|
120930
|
+
const docSize = doc$2.content.size;
|
|
120931
|
+
if (charOffset <= 0)
|
|
120932
|
+
return 0;
|
|
120933
|
+
if (charOffset >= doc$2.textBetween(0, docSize, blockSep, leafSep).length)
|
|
120934
|
+
return docSize;
|
|
120935
|
+
let low = 0;
|
|
120936
|
+
let high = docSize;
|
|
120937
|
+
while (low < high) {
|
|
120938
|
+
const mid = Math.floor((low + high) / 2);
|
|
120939
|
+
if (doc$2.textBetween(0, mid, blockSep, leafSep).length < charOffset)
|
|
120940
|
+
low = mid + 1;
|
|
120941
|
+
else
|
|
120942
|
+
high = mid;
|
|
120943
|
+
}
|
|
120944
|
+
return low;
|
|
120945
|
+
}
|
|
120946
|
+
function findRangeByText(doc$2, text5, hintFrom) {
|
|
120947
|
+
if (!text5)
|
|
120948
|
+
return null;
|
|
120949
|
+
const docSize = doc$2.content.size;
|
|
120950
|
+
const full = doc$2.textBetween(0, docSize, TEXT_RANGE_BLOCK_SEP, TEXT_RANGE_LEAF_SEP);
|
|
120951
|
+
const matches2 = [];
|
|
120952
|
+
let i$1 = 0;
|
|
120953
|
+
for (;; ) {
|
|
120954
|
+
const idx = full.indexOf(text5, i$1);
|
|
120955
|
+
if (idx === -1)
|
|
120956
|
+
break;
|
|
120957
|
+
matches2.push(idx);
|
|
120958
|
+
i$1 = idx + 1;
|
|
120959
|
+
}
|
|
120960
|
+
if (matches2.length === 0)
|
|
120961
|
+
return null;
|
|
120962
|
+
const toPos = (charOffset) => charOffsetToPosition(doc$2, charOffset, TEXT_RANGE_BLOCK_SEP, TEXT_RANGE_LEAF_SEP);
|
|
120963
|
+
const initial = matches2[0];
|
|
120964
|
+
let charOffsetFrom;
|
|
120965
|
+
if (hintFrom == null)
|
|
120966
|
+
charOffsetFrom = initial;
|
|
120967
|
+
else
|
|
120968
|
+
charOffsetFrom = matches2.reduce((acc, idx) => {
|
|
120969
|
+
const pos = toPos(idx);
|
|
120970
|
+
return Math.abs(pos - hintFrom) < Math.abs(acc.bestPos - hintFrom) ? {
|
|
120971
|
+
best: idx,
|
|
120972
|
+
bestPos: pos
|
|
120973
|
+
} : acc;
|
|
120974
|
+
}, {
|
|
120975
|
+
best: initial,
|
|
120976
|
+
bestPos: toPos(initial)
|
|
120977
|
+
}).best;
|
|
120978
|
+
const from$12 = toPos(charOffsetFrom);
|
|
120979
|
+
const to = toPos(charOffsetFrom + text5.length);
|
|
120980
|
+
return from$12 < to ? {
|
|
120981
|
+
from: from$12,
|
|
120982
|
+
to
|
|
120983
|
+
} : null;
|
|
120984
|
+
}
|
|
120985
|
+
function resolveMovedRangeFromPrevious(doc$2, docSize, prev) {
|
|
120986
|
+
if (!prev.text)
|
|
120987
|
+
return null;
|
|
120988
|
+
const resolved = findRangeByText(doc$2, prev.text, prev.from);
|
|
120989
|
+
if (!resolved)
|
|
120990
|
+
return null;
|
|
120991
|
+
if (resolved.from < 0 || resolved.to <= resolved.from || resolved.to > docSize)
|
|
120992
|
+
return null;
|
|
120993
|
+
return resolved;
|
|
120994
|
+
}
|
|
120995
|
+
function restoreRangesFromPrevious(doc$2, docSize, previousRanges) {
|
|
120996
|
+
const out = [];
|
|
120997
|
+
for (const prev of previousRanges) {
|
|
120998
|
+
const resolved = resolveMovedRangeFromPrevious(doc$2, docSize, prev);
|
|
120999
|
+
if (!resolved)
|
|
121000
|
+
continue;
|
|
121001
|
+
out.push({
|
|
121002
|
+
...prev,
|
|
121003
|
+
from: resolved.from,
|
|
121004
|
+
to: resolved.to
|
|
121005
|
+
});
|
|
121006
|
+
}
|
|
121007
|
+
return out;
|
|
121008
|
+
}
|
|
120901
121009
|
function computeTabStops$1(context) {
|
|
120902
121010
|
const { explicitStops, defaultTabInterval, paragraphIndent } = context;
|
|
120903
121011
|
const leftIndent = paragraphIndent.left ?? 0;
|
|
@@ -122305,7 +122413,7 @@ function updateMaxFontInfo(currentMaxSize, currentMaxInfo, newRun) {
|
|
|
122305
122413
|
return getFontInfoFromRun(newRun);
|
|
122306
122414
|
return currentMaxInfo;
|
|
122307
122415
|
}
|
|
122308
|
-
function isTextRun$
|
|
122416
|
+
function isTextRun$5(run2) {
|
|
122309
122417
|
return run2.kind === "text" || run2.kind === undefined;
|
|
122310
122418
|
}
|
|
122311
122419
|
function isTabRun$1(run2) {
|
|
@@ -122423,9 +122531,9 @@ async function measureBlock(block, constraints) {
|
|
|
122423
122531
|
async function measureParagraphBlock(block, maxWidth) {
|
|
122424
122532
|
const ctx$2 = getCanvasContext();
|
|
122425
122533
|
const wordLayout = block.attrs?.wordLayout;
|
|
122426
|
-
const firstTextRunWithSize = block.runs.find((run2) => isTextRun$
|
|
122534
|
+
const firstTextRunWithSize = block.runs.find((run2) => isTextRun$5(run2) && ("fontSize" in run2) && run2.fontSize != null);
|
|
122427
122535
|
const fallbackFontSize = normalizeFontSize$1(firstTextRunWithSize?.fontSize, DEFAULT_PARAGRAPH_FONT_SIZE);
|
|
122428
|
-
const fallbackFontFamily = block.runs.find((run2) => isTextRun$
|
|
122536
|
+
const fallbackFontFamily = block.runs.find((run2) => isTextRun$5(run2) && typeof run2.fontFamily === "string" && run2.fontFamily.trim().length > 0)?.fontFamily ?? DEFAULT_PARAGRAPH_FONT_FAMILY;
|
|
122429
122537
|
const normalizedRuns = normalizeRunsForMeasurement(block.runs, fallbackFontSize, fallbackFontFamily);
|
|
122430
122538
|
const markerInfo = wordLayout?.marker ? (() => {
|
|
122431
122539
|
const { font: markerFont } = buildFontString({
|
|
@@ -131050,7 +131158,7 @@ function mergeAdjacentRuns(runs2) {
|
|
|
131050
131158
|
let current = runs2[0];
|
|
131051
131159
|
for (let i$1 = 1;i$1 < runs2.length; i$1++) {
|
|
131052
131160
|
const next2 = runs2[i$1];
|
|
131053
|
-
if (isTextRun$
|
|
131161
|
+
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
131162
|
const currText = current.text ?? "";
|
|
131055
131163
|
const nextText = next2.text ?? "";
|
|
131056
131164
|
current = {
|
|
@@ -132849,7 +132957,7 @@ function getCtx() {
|
|
|
132849
132957
|
ctx$1 = canvas.getContext("2d");
|
|
132850
132958
|
return ctx$1;
|
|
132851
132959
|
}
|
|
132852
|
-
function isTextRun(run2) {
|
|
132960
|
+
function isTextRun$1(run2) {
|
|
132853
132961
|
if (run2.kind === "tab" || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation")
|
|
132854
132962
|
return false;
|
|
132855
132963
|
if ("src" in run2)
|
|
@@ -132857,7 +132965,7 @@ function isTextRun(run2) {
|
|
|
132857
132965
|
return true;
|
|
132858
132966
|
}
|
|
132859
132967
|
function fontString(run2) {
|
|
132860
|
-
const textRun = isTextRun(run2) ? run2 : null;
|
|
132968
|
+
const textRun = isTextRun$1(run2) ? run2 : null;
|
|
132861
132969
|
const size$2 = textRun?.fontSize ?? 16;
|
|
132862
132970
|
const family = textRun?.fontFamily ?? "Arial";
|
|
132863
132971
|
return `${textRun?.italic ? "italic " : ""}${textRun?.bold ? "bold " : ""}${size$2}px ${family}`.trim();
|
|
@@ -132868,10 +132976,10 @@ function runText(run2) {
|
|
|
132868
132976
|
function measureRunSliceWidth(run2, fromChar, toChar) {
|
|
132869
132977
|
const context = getCtx();
|
|
132870
132978
|
const fullText = runText(run2);
|
|
132871
|
-
const transform = isTextRun(run2) ? run2.textTransform : undefined;
|
|
132979
|
+
const transform = isTextRun$1(run2) ? run2.textTransform : undefined;
|
|
132872
132980
|
const text5 = applyTextTransform(fullText.slice(fromChar, toChar), transform, fullText, fromChar);
|
|
132873
132981
|
if (!context) {
|
|
132874
|
-
const size$2 = (isTextRun(run2) ? run2 : null)?.fontSize ?? 16;
|
|
132982
|
+
const size$2 = (isTextRun$1(run2) ? run2 : null)?.fontSize ?? 16;
|
|
132875
132983
|
return Math.max(1, text5.length * (size$2 * 0.6));
|
|
132876
132984
|
}
|
|
132877
132985
|
context.font = fontString(run2);
|
|
@@ -132881,7 +132989,7 @@ function lineHeightForRuns(runs2, fromRun, toRun) {
|
|
|
132881
132989
|
let maxSize$1 = 0;
|
|
132882
132990
|
for (let i$1 = fromRun;i$1 <= toRun; i$1 += 1) {
|
|
132883
132991
|
const run2 = runs2[i$1];
|
|
132884
|
-
const size$2 = (run2 && isTextRun(run2) ? run2 : null)?.fontSize ?? 16;
|
|
132992
|
+
const size$2 = (run2 && isTextRun$1(run2) ? run2 : null)?.fontSize ?? 16;
|
|
132885
132993
|
if (size$2 > maxSize$1)
|
|
132886
132994
|
maxSize$1 = size$2;
|
|
132887
132995
|
}
|
|
@@ -136542,6 +136650,108 @@ async function layoutWithPerSectionConstraints(kind, blocksByRId, sectionMetadat
|
|
|
136542
136650
|
}
|
|
136543
136651
|
}
|
|
136544
136652
|
}
|
|
136653
|
+
function getBoundaries(ranges) {
|
|
136654
|
+
const set = /* @__PURE__ */ new Set;
|
|
136655
|
+
for (const r$1 of ranges) {
|
|
136656
|
+
if (Number.isFinite(r$1.from))
|
|
136657
|
+
set.add(r$1.from);
|
|
136658
|
+
if (Number.isFinite(r$1.to))
|
|
136659
|
+
set.add(r$1.to);
|
|
136660
|
+
}
|
|
136661
|
+
return [...set].sort((a2, b$1) => a2 - b$1);
|
|
136662
|
+
}
|
|
136663
|
+
function isTextRun(run2) {
|
|
136664
|
+
return "text" in run2 && typeof run2.text === "string";
|
|
136665
|
+
}
|
|
136666
|
+
function splitParagraphRuns(paragraph2, boundaries) {
|
|
136667
|
+
const newRuns = [];
|
|
136668
|
+
for (const run2 of paragraph2.runs) {
|
|
136669
|
+
if (!isTextRun(run2)) {
|
|
136670
|
+
newRuns.push(run2);
|
|
136671
|
+
continue;
|
|
136672
|
+
}
|
|
136673
|
+
const start$1 = run2.pmStart;
|
|
136674
|
+
const end$1 = run2.pmEnd;
|
|
136675
|
+
if (start$1 == null || end$1 == null || start$1 >= end$1) {
|
|
136676
|
+
newRuns.push(run2);
|
|
136677
|
+
continue;
|
|
136678
|
+
}
|
|
136679
|
+
const runBoundaries = boundaries.filter((b$1) => b$1 > start$1 && b$1 < end$1);
|
|
136680
|
+
if (runBoundaries.length === 0) {
|
|
136681
|
+
newRuns.push(run2);
|
|
136682
|
+
continue;
|
|
136683
|
+
}
|
|
136684
|
+
const positions = [
|
|
136685
|
+
start$1,
|
|
136686
|
+
...runBoundaries,
|
|
136687
|
+
end$1
|
|
136688
|
+
];
|
|
136689
|
+
for (let i$1 = 0;i$1 < positions.length - 1; i$1++) {
|
|
136690
|
+
const segStart = positions[i$1];
|
|
136691
|
+
const segEnd = positions[i$1 + 1];
|
|
136692
|
+
const charStart = segStart - start$1;
|
|
136693
|
+
const charEnd = segEnd - start$1;
|
|
136694
|
+
const segmentText = run2.text.slice(charStart, charEnd);
|
|
136695
|
+
if (segmentText.length === 0)
|
|
136696
|
+
continue;
|
|
136697
|
+
newRuns.push({
|
|
136698
|
+
...run2,
|
|
136699
|
+
text: segmentText,
|
|
136700
|
+
pmStart: segStart,
|
|
136701
|
+
pmEnd: segEnd
|
|
136702
|
+
});
|
|
136703
|
+
}
|
|
136704
|
+
}
|
|
136705
|
+
return {
|
|
136706
|
+
...paragraph2,
|
|
136707
|
+
runs: newRuns
|
|
136708
|
+
};
|
|
136709
|
+
}
|
|
136710
|
+
function splitRunsInTableCell(cell2, boundaries) {
|
|
136711
|
+
const result = { ...cell2 };
|
|
136712
|
+
if (cell2.paragraph)
|
|
136713
|
+
result.paragraph = splitParagraphRuns(cell2.paragraph, boundaries);
|
|
136714
|
+
if (cell2.blocks?.length)
|
|
136715
|
+
result.blocks = cell2.blocks.map((b$1) => {
|
|
136716
|
+
if (b$1.kind === "paragraph")
|
|
136717
|
+
return splitParagraphRuns(b$1, boundaries);
|
|
136718
|
+
if (b$1.kind === "table")
|
|
136719
|
+
return splitRunsInBlock(b$1, boundaries);
|
|
136720
|
+
return b$1;
|
|
136721
|
+
});
|
|
136722
|
+
return result;
|
|
136723
|
+
}
|
|
136724
|
+
function splitRunsInBlock(block, boundaries) {
|
|
136725
|
+
if (block.kind === "paragraph")
|
|
136726
|
+
return splitParagraphRuns(block, boundaries);
|
|
136727
|
+
if (block.kind === "table") {
|
|
136728
|
+
const table2 = block;
|
|
136729
|
+
return {
|
|
136730
|
+
...table2,
|
|
136731
|
+
rows: table2.rows.map((row2) => ({
|
|
136732
|
+
...row2,
|
|
136733
|
+
cells: row2.cells.map((cell2) => splitRunsInTableCell(cell2, boundaries))
|
|
136734
|
+
}))
|
|
136735
|
+
};
|
|
136736
|
+
}
|
|
136737
|
+
if (block.kind === "list") {
|
|
136738
|
+
const list5 = block;
|
|
136739
|
+
return {
|
|
136740
|
+
...list5,
|
|
136741
|
+
items: list5.items.map((item) => ({
|
|
136742
|
+
...item,
|
|
136743
|
+
paragraph: splitParagraphRuns(item.paragraph, boundaries)
|
|
136744
|
+
}))
|
|
136745
|
+
};
|
|
136746
|
+
}
|
|
136747
|
+
return block;
|
|
136748
|
+
}
|
|
136749
|
+
function splitRunsAtDecorationBoundaries(blocks2, ranges) {
|
|
136750
|
+
if (ranges.length === 0)
|
|
136751
|
+
return blocks2;
|
|
136752
|
+
const boundaries = getBoundaries(ranges);
|
|
136753
|
+
return blocks2.map((block) => splitRunsInBlock(block, boundaries));
|
|
136754
|
+
}
|
|
136545
136755
|
function dropCursor(options = {}) {
|
|
136546
136756
|
return new Plugin({ view(editorView) {
|
|
136547
136757
|
return new DropCursorView(editorView, options);
|
|
@@ -155448,19 +155658,35 @@ var Node$13 = class Node$14 {
|
|
|
155448
155658
|
return "default";
|
|
155449
155659
|
}
|
|
155450
155660
|
}
|
|
155451
|
-
}, NodeResizer, EXCLUDED_PLUGIN_KEY_REF_LIST, EXCLUDED_PLUGIN_KEY_REFS, EXCLUDED_PLUGIN_KEY_PREFIXES,
|
|
155661
|
+
}, NodeResizer, EXCLUDED_PLUGIN_KEY_REF_LIST, EXCLUDED_PLUGIN_KEY_REFS, EXCLUDED_PLUGIN_KEY_PREFIXES, TEXT_RANGE_BLOCK_SEP = `
|
|
155662
|
+
`, TEXT_RANGE_LEAF_SEP = `
|
|
155663
|
+
`, DecorationBridge = class DecorationBridge2 {
|
|
155452
155664
|
#applied = /* @__PURE__ */ new WeakMap;
|
|
155453
155665
|
#eligiblePlugins = [];
|
|
155454
155666
|
#pluginListSnapshot = [];
|
|
155455
155667
|
#prevDecorationSets = /* @__PURE__ */ new Map;
|
|
155456
155668
|
#hadEligiblePlugins = false;
|
|
155457
|
-
|
|
155669
|
+
#previousRanges = /* @__PURE__ */ new Map;
|
|
155670
|
+
#skipRestoreEmptyOnNextCollect = false;
|
|
155671
|
+
#lastDocChangeToken = 0;
|
|
155672
|
+
#docChangeMappingsByToken = /* @__PURE__ */ new Map;
|
|
155673
|
+
#previousRangesTokenByPlugin = /* @__PURE__ */ new Map;
|
|
155674
|
+
sync(state, domIndex$1, options) {
|
|
155458
155675
|
this.#refreshEligiblePlugins(state);
|
|
155459
155676
|
const docSize = state.doc.content.size;
|
|
155460
|
-
const
|
|
155677
|
+
const restoreEmpty = options?.restoreEmptyDecorations !== false;
|
|
155678
|
+
if (!restoreEmpty)
|
|
155679
|
+
this.#skipRestoreEmptyOnNextCollect = true;
|
|
155680
|
+
const desired = this.#eligiblePlugins.length > 0 ? this.#collectDesiredState(state, domIndex$1, docSize, restoreEmpty) : /* @__PURE__ */ new Map;
|
|
155461
155681
|
this.#hadEligiblePlugins = this.#eligiblePlugins.length > 0;
|
|
155462
155682
|
return this.#reconcile(desired, domIndex$1, docSize);
|
|
155463
155683
|
}
|
|
155684
|
+
recordTransaction(transaction) {
|
|
155685
|
+
if (!transaction?.docChanged)
|
|
155686
|
+
return;
|
|
155687
|
+
this.#lastDocChangeToken += 1;
|
|
155688
|
+
this.#docChangeMappingsByToken.set(this.#lastDocChangeToken, transaction.mapping);
|
|
155689
|
+
}
|
|
155464
155690
|
hasChanges(state) {
|
|
155465
155691
|
this.#refreshEligiblePlugins(state);
|
|
155466
155692
|
if (this.#eligiblePlugins.length === 0)
|
|
@@ -155470,11 +155696,66 @@ var Node$13 = class Node$14 {
|
|
|
155470
155696
|
return true;
|
|
155471
155697
|
return false;
|
|
155472
155698
|
}
|
|
155699
|
+
collectDecorationRanges(state) {
|
|
155700
|
+
this.#refreshEligiblePlugins(state);
|
|
155701
|
+
const ranges = [];
|
|
155702
|
+
const docSize = state.doc.content.size;
|
|
155703
|
+
for (const plugin$2 of this.#eligiblePlugins) {
|
|
155704
|
+
const pluginRanges = [];
|
|
155705
|
+
const decorationSet = this.#getDecorationSet(plugin$2, state);
|
|
155706
|
+
const prevDecorationSet = this.#prevDecorationSets.get(plugin$2);
|
|
155707
|
+
const remapped = this.#remapUnchangedPluginRangesIfNeeded(plugin$2, decorationSet, prevDecorationSet, state.doc, docSize);
|
|
155708
|
+
if (remapped)
|
|
155709
|
+
pluginRanges.push(...remapped);
|
|
155710
|
+
else if (decorationSet !== DecorationSet.empty) {
|
|
155711
|
+
const decorations = decorationSet.find(0, docSize);
|
|
155712
|
+
for (const decoration of decorations) {
|
|
155713
|
+
if (!this.#isInlineDecoration(decoration))
|
|
155714
|
+
continue;
|
|
155715
|
+
const attrs = this.#extractSafeAttrs(decoration);
|
|
155716
|
+
if (attrs.classes.length === 0 && attrs.styleEntries.length === 0)
|
|
155717
|
+
continue;
|
|
155718
|
+
if (decoration.from >= decoration.to)
|
|
155719
|
+
continue;
|
|
155720
|
+
const dataAttrs = {};
|
|
155721
|
+
for (const [key$1, value] of attrs.dataEntries)
|
|
155722
|
+
dataAttrs[key$1] = value;
|
|
155723
|
+
const rangeText = typeof state.doc.textBetween === "function" ? state.doc.textBetween(decoration.from, decoration.to, TEXT_RANGE_BLOCK_SEP, TEXT_RANGE_LEAF_SEP) : undefined;
|
|
155724
|
+
pluginRanges.push({
|
|
155725
|
+
from: decoration.from,
|
|
155726
|
+
to: decoration.to,
|
|
155727
|
+
classes: attrs.classes,
|
|
155728
|
+
style: attrs.styleEntries.length > 0 ? attrs.styleEntries.map(([prop, val]) => `${prop}: ${val}`).join("; ") : null,
|
|
155729
|
+
dataAttrs,
|
|
155730
|
+
...rangeText ? { text: rangeText } : {}
|
|
155731
|
+
});
|
|
155732
|
+
}
|
|
155733
|
+
}
|
|
155734
|
+
const previousPluginRanges = this.#previousRanges.get(plugin$2);
|
|
155735
|
+
const mayRestoreEmpty = !this.#skipRestoreEmptyOnNextCollect && previousPluginRanges && previousPluginRanges.length > 0;
|
|
155736
|
+
if (pluginRanges.length === 0 && mayRestoreEmpty)
|
|
155737
|
+
pluginRanges.push(...restoreRangesFromPrevious(state.doc, docSize, previousPluginRanges));
|
|
155738
|
+
this.#setPreviousRanges(plugin$2, pluginRanges.length > 0 ? [...pluginRanges] : []);
|
|
155739
|
+
this.#prevDecorationSets.set(plugin$2, decorationSet);
|
|
155740
|
+
ranges.push(...pluginRanges);
|
|
155741
|
+
}
|
|
155742
|
+
this.#clearSkipRestoreFlagIfSet();
|
|
155743
|
+
return ranges;
|
|
155744
|
+
}
|
|
155745
|
+
#clearSkipRestoreFlagIfSet() {
|
|
155746
|
+
if (this.#skipRestoreEmptyOnNextCollect)
|
|
155747
|
+
this.#skipRestoreEmptyOnNextCollect = false;
|
|
155748
|
+
}
|
|
155473
155749
|
destroy() {
|
|
155474
155750
|
this.#eligiblePlugins = [];
|
|
155475
155751
|
this.#pluginListSnapshot = [];
|
|
155476
155752
|
this.#prevDecorationSets.clear();
|
|
155753
|
+
this.#previousRanges.clear();
|
|
155754
|
+
this.#previousRangesTokenByPlugin.clear();
|
|
155477
155755
|
this.#hadEligiblePlugins = false;
|
|
155756
|
+
this.#skipRestoreEmptyOnNextCollect = false;
|
|
155757
|
+
this.#lastDocChangeToken = 0;
|
|
155758
|
+
this.#docChangeMappingsByToken.clear();
|
|
155478
155759
|
}
|
|
155479
155760
|
#refreshEligiblePlugins(state) {
|
|
155480
155761
|
if (state.plugins === this.#pluginListSnapshot)
|
|
@@ -155493,6 +155774,13 @@ var Node$13 = class Node$14 {
|
|
|
155493
155774
|
for (const key$1 of this.#prevDecorationSets.keys())
|
|
155494
155775
|
if (!eligibleSet.has(key$1))
|
|
155495
155776
|
this.#prevDecorationSets.delete(key$1);
|
|
155777
|
+
for (const key$1 of this.#previousRanges.keys())
|
|
155778
|
+
if (!eligibleSet.has(key$1))
|
|
155779
|
+
this.#previousRanges.delete(key$1);
|
|
155780
|
+
for (const key$1 of this.#previousRangesTokenByPlugin.keys())
|
|
155781
|
+
if (!eligibleSet.has(key$1))
|
|
155782
|
+
this.#previousRangesTokenByPlugin.delete(key$1);
|
|
155783
|
+
this.#pruneDocChangeMappings();
|
|
155496
155784
|
}
|
|
155497
155785
|
#isExcludedByKeyRef(plugin$2) {
|
|
155498
155786
|
const specKey = plugin$2.spec?.key;
|
|
@@ -155502,34 +155790,170 @@ var Node$13 = class Node$14 {
|
|
|
155502
155790
|
const keyString = plugin$2.key ?? "";
|
|
155503
155791
|
return EXCLUDED_PLUGIN_KEY_PREFIXES.some((prefix$2) => keyString === prefix$2 || keyString.startsWith(`${prefix$2}$`));
|
|
155504
155792
|
}
|
|
155505
|
-
#collectDesiredState(state, domIndex$1, docSize) {
|
|
155793
|
+
#collectDesiredState(state, domIndex$1, docSize, restoreEmptyDecorations) {
|
|
155506
155794
|
const desired = /* @__PURE__ */ new Map;
|
|
155507
155795
|
for (const plugin$2 of this.#eligiblePlugins) {
|
|
155508
155796
|
const decorationSet = this.#getDecorationSet(plugin$2, state);
|
|
155509
|
-
this.#prevDecorationSets.
|
|
155510
|
-
|
|
155797
|
+
const prevDecorationSet = this.#prevDecorationSets.get(plugin$2);
|
|
155798
|
+
const remapped = this.#remapUnchangedPluginRangesIfNeeded(plugin$2, decorationSet, prevDecorationSet, state.doc, docSize);
|
|
155799
|
+
if (remapped) {
|
|
155800
|
+
this.#applyRangesToDesired(desired, domIndex$1, remapped);
|
|
155801
|
+
this.#setPreviousRanges(plugin$2, [...remapped]);
|
|
155802
|
+
this.#prevDecorationSets.set(plugin$2, decorationSet);
|
|
155511
155803
|
continue;
|
|
155512
|
-
|
|
155513
|
-
|
|
155514
|
-
|
|
155515
|
-
|
|
155516
|
-
const
|
|
155517
|
-
|
|
155518
|
-
|
|
155519
|
-
|
|
155520
|
-
|
|
155521
|
-
|
|
155522
|
-
|
|
155523
|
-
|
|
155804
|
+
}
|
|
155805
|
+
let pluginHasCurrentRanges = false;
|
|
155806
|
+
const currentRanges = [];
|
|
155807
|
+
if (decorationSet !== DecorationSet.empty) {
|
|
155808
|
+
const decorations = decorationSet.find(0, docSize);
|
|
155809
|
+
for (const decoration of decorations) {
|
|
155810
|
+
if (!this.#isInlineDecoration(decoration))
|
|
155811
|
+
continue;
|
|
155812
|
+
const attrs = this.#extractSafeAttrs(decoration);
|
|
155813
|
+
if (attrs.classes.length === 0 && attrs.dataEntries.length === 0 && attrs.styleEntries.length === 0)
|
|
155814
|
+
continue;
|
|
155815
|
+
if (decoration.from >= decoration.to)
|
|
155816
|
+
continue;
|
|
155817
|
+
pluginHasCurrentRanges = true;
|
|
155818
|
+
const entries = domIndex$1.findEntriesInRange(decoration.from, decoration.to);
|
|
155819
|
+
for (const entry of entries) {
|
|
155820
|
+
const d = this.#getOrCreateDesired(desired, entry.el);
|
|
155821
|
+
for (const cls of attrs.classes)
|
|
155822
|
+
d.classes.add(cls);
|
|
155823
|
+
for (const [key$1, value] of attrs.dataEntries)
|
|
155824
|
+
d.dataAttrs.set(key$1, value);
|
|
155825
|
+
for (const [prop, value] of attrs.styleEntries)
|
|
155826
|
+
d.styleProps.set(prop, value);
|
|
155827
|
+
}
|
|
155828
|
+
const dataAttrs = {};
|
|
155524
155829
|
for (const [key$1, value] of attrs.dataEntries)
|
|
155525
|
-
|
|
155526
|
-
|
|
155527
|
-
|
|
155830
|
+
dataAttrs[key$1] = value;
|
|
155831
|
+
const style$1 = attrs.styleEntries.length > 0 ? attrs.styleEntries.map(([prop, val]) => `${prop}: ${val}`).join("; ") : null;
|
|
155832
|
+
const rangeText = typeof state.doc.textBetween === "function" ? state.doc.textBetween(decoration.from, decoration.to, TEXT_RANGE_BLOCK_SEP, TEXT_RANGE_LEAF_SEP) : undefined;
|
|
155833
|
+
currentRanges.push({
|
|
155834
|
+
from: decoration.from,
|
|
155835
|
+
to: decoration.to,
|
|
155836
|
+
classes: attrs.classes,
|
|
155837
|
+
style: style$1,
|
|
155838
|
+
dataAttrs,
|
|
155839
|
+
...rangeText ? { text: rangeText } : {}
|
|
155840
|
+
});
|
|
155528
155841
|
}
|
|
155529
155842
|
}
|
|
155843
|
+
if (pluginHasCurrentRanges) {
|
|
155844
|
+
this.#setPreviousRanges(plugin$2, currentRanges);
|
|
155845
|
+
this.#prevDecorationSets.set(plugin$2, decorationSet);
|
|
155846
|
+
continue;
|
|
155847
|
+
}
|
|
155848
|
+
if (!restoreEmptyDecorations) {
|
|
155849
|
+
this.#setPreviousRanges(plugin$2, []);
|
|
155850
|
+
this.#prevDecorationSets.set(plugin$2, decorationSet);
|
|
155851
|
+
continue;
|
|
155852
|
+
}
|
|
155853
|
+
const previousPluginRanges = this.#previousRanges.get(plugin$2);
|
|
155854
|
+
if (previousPluginRanges?.length) {
|
|
155855
|
+
const restoredRanges = restoreRangesFromPrevious(state.doc, docSize, previousPluginRanges);
|
|
155856
|
+
this.#applyRangesToDesired(desired, domIndex$1, restoredRanges);
|
|
155857
|
+
}
|
|
155858
|
+
this.#prevDecorationSets.set(plugin$2, decorationSet);
|
|
155530
155859
|
}
|
|
155531
155860
|
return desired;
|
|
155532
155861
|
}
|
|
155862
|
+
#applyRangesToDesired(desired, domIndex$1, ranges) {
|
|
155863
|
+
for (const range of ranges) {
|
|
155864
|
+
const entries = domIndex$1.findEntriesInRange(range.from, range.to);
|
|
155865
|
+
for (const entry of entries) {
|
|
155866
|
+
const d = this.#getOrCreateDesired(desired, entry.el);
|
|
155867
|
+
for (const cls of range.classes)
|
|
155868
|
+
d.classes.add(cls);
|
|
155869
|
+
for (const [key$1, value] of Object.entries(range.dataAttrs))
|
|
155870
|
+
d.dataAttrs.set(key$1, value);
|
|
155871
|
+
if (range.style)
|
|
155872
|
+
for (const [prop, value] of DecorationBridge2.#parseStyleString(range.style))
|
|
155873
|
+
d.styleProps.set(prop, value);
|
|
155874
|
+
}
|
|
155875
|
+
}
|
|
155876
|
+
}
|
|
155877
|
+
#setPreviousRanges(plugin$2, ranges) {
|
|
155878
|
+
this.#previousRanges.set(plugin$2, ranges);
|
|
155879
|
+
this.#previousRangesTokenByPlugin.set(plugin$2, this.#lastDocChangeToken);
|
|
155880
|
+
this.#pruneDocChangeMappings();
|
|
155881
|
+
}
|
|
155882
|
+
#getMappingsSinceToken(fromToken) {
|
|
155883
|
+
if (fromToken >= this.#lastDocChangeToken)
|
|
155884
|
+
return [];
|
|
155885
|
+
const mappings = [];
|
|
155886
|
+
for (let token = fromToken + 1;token <= this.#lastDocChangeToken; token += 1) {
|
|
155887
|
+
const mapping = this.#docChangeMappingsByToken.get(token);
|
|
155888
|
+
if (!mapping)
|
|
155889
|
+
return [];
|
|
155890
|
+
mappings.push(mapping);
|
|
155891
|
+
}
|
|
155892
|
+
return mappings;
|
|
155893
|
+
}
|
|
155894
|
+
#mapThroughMappings(pos, assoc, mappings) {
|
|
155895
|
+
let mapped = pos;
|
|
155896
|
+
for (const mapping of mappings)
|
|
155897
|
+
mapped = mapping.map(mapped, assoc);
|
|
155898
|
+
return mapped;
|
|
155899
|
+
}
|
|
155900
|
+
#pruneDocChangeMappings() {
|
|
155901
|
+
if (this.#docChangeMappingsByToken.size === 0)
|
|
155902
|
+
return;
|
|
155903
|
+
let minTrackedToken = this.#lastDocChangeToken;
|
|
155904
|
+
for (const token of this.#previousRangesTokenByPlugin.values())
|
|
155905
|
+
if (token < minTrackedToken)
|
|
155906
|
+
minTrackedToken = token;
|
|
155907
|
+
for (const token of this.#docChangeMappingsByToken.keys())
|
|
155908
|
+
if (token <= minTrackedToken)
|
|
155909
|
+
this.#docChangeMappingsByToken.delete(token);
|
|
155910
|
+
}
|
|
155911
|
+
#remapUnchangedPluginRangesIfNeeded(plugin$2, currentSet, previousSet, doc$2, docSize) {
|
|
155912
|
+
if (!previousSet || previousSet !== currentSet)
|
|
155913
|
+
return null;
|
|
155914
|
+
const previousRanges = this.#previousRanges.get(plugin$2);
|
|
155915
|
+
if (!previousRanges?.length)
|
|
155916
|
+
return null;
|
|
155917
|
+
const rangesToken = this.#previousRangesTokenByPlugin.get(plugin$2) ?? -1;
|
|
155918
|
+
if (rangesToken === this.#lastDocChangeToken)
|
|
155919
|
+
return previousRanges;
|
|
155920
|
+
const mappings = this.#getMappingsSinceToken(rangesToken);
|
|
155921
|
+
if (mappings.length === 0)
|
|
155922
|
+
return null;
|
|
155923
|
+
const remapped = [];
|
|
155924
|
+
for (const prev of previousRanges) {
|
|
155925
|
+
if (prev.text) {
|
|
155926
|
+
const resolved = findRangeByText(doc$2, prev.text, prev.from);
|
|
155927
|
+
if (resolved && resolved.from >= 0 && resolved.to > resolved.from && resolved.to <= docSize) {
|
|
155928
|
+
remapped.push({
|
|
155929
|
+
from: resolved.from,
|
|
155930
|
+
to: resolved.to,
|
|
155931
|
+
classes: prev.classes,
|
|
155932
|
+
style: prev.style,
|
|
155933
|
+
dataAttrs: prev.dataAttrs,
|
|
155934
|
+
text: prev.text
|
|
155935
|
+
});
|
|
155936
|
+
continue;
|
|
155937
|
+
}
|
|
155938
|
+
}
|
|
155939
|
+
const from$12 = this.#mapThroughMappings(prev.from, -1, mappings);
|
|
155940
|
+
const to = this.#mapThroughMappings(prev.to, 1, mappings);
|
|
155941
|
+
if (from$12 < 0 || to <= from$12 || to > docSize)
|
|
155942
|
+
continue;
|
|
155943
|
+
remapped.push({
|
|
155944
|
+
from: from$12,
|
|
155945
|
+
to,
|
|
155946
|
+
classes: prev.classes,
|
|
155947
|
+
style: prev.style,
|
|
155948
|
+
dataAttrs: prev.dataAttrs,
|
|
155949
|
+
text: prev.text
|
|
155950
|
+
});
|
|
155951
|
+
}
|
|
155952
|
+
if (remapped.length === 0)
|
|
155953
|
+
return null;
|
|
155954
|
+
this.#setPreviousRanges(plugin$2, remapped);
|
|
155955
|
+
return remapped;
|
|
155956
|
+
}
|
|
155533
155957
|
#getDecorationSet(plugin$2, state) {
|
|
155534
155958
|
try {
|
|
155535
155959
|
const result = plugin$2.props.decorations?.call(plugin$2, state);
|
|
@@ -156619,7 +157043,7 @@ var Node$13 = class Node$14 {
|
|
|
156619
157043
|
target: currentX + DEFAULT_TAB_INTERVAL_PX$1,
|
|
156620
157044
|
nextIndex: index2
|
|
156621
157045
|
};
|
|
156622
|
-
}, SINGLE_COLUMN_DEFAULT, isTextRun$
|
|
157046
|
+
}, SINGLE_COLUMN_DEFAULT, isTextRun$4 = (run2) => {
|
|
156623
157047
|
const runWithKind = run2;
|
|
156624
157048
|
return !runWithKind.kind || runWithKind.kind === "text";
|
|
156625
157049
|
}, isEmptyTextParagraph = (block) => {
|
|
@@ -156629,7 +157053,7 @@ var Node$13 = class Node$14 {
|
|
|
156629
157053
|
if (runs2.length !== 1)
|
|
156630
157054
|
return false;
|
|
156631
157055
|
const run2 = runs2[0];
|
|
156632
|
-
if (!isTextRun$
|
|
157056
|
+
if (!isTextRun$4(run2))
|
|
156633
157057
|
return false;
|
|
156634
157058
|
return typeof run2.text === "string" && run2.text.length === 0;
|
|
156635
157059
|
}, shouldSuppressSpacingForEmpty = (block, side) => {
|
|
@@ -159108,10 +159532,10 @@ var Node$13 = class Node$14 {
|
|
|
159108
159532
|
}
|
|
159109
159533
|
}, Y_SORT_THRESHOLD_PX = 2, Y_SAME_LINE_THRESHOLD_PX = 3, HORIZONTAL_OVERLAP_THRESHOLD = 0.8, isValidTrackedMode = (value) => {
|
|
159110
159534
|
return typeof value === "string" && VALID_TRACKED_MODES.includes(value);
|
|
159111
|
-
}, isTextRun$
|
|
159535
|
+
}, isTextRun$3 = (run2) => {
|
|
159112
159536
|
return "text" in run2 && run2.kind !== "tab";
|
|
159113
159537
|
}, stripTrackedChangeFromRun = (run2) => {
|
|
159114
|
-
if (!isTextRun$
|
|
159538
|
+
if (!isTextRun$3(run2))
|
|
159115
159539
|
return;
|
|
159116
159540
|
if ("trackedChange" in run2 && run2.trackedChange)
|
|
159117
159541
|
delete run2.trackedChange;
|
|
@@ -159177,14 +159601,14 @@ var Node$13 = class Node$14 {
|
|
|
159177
159601
|
runs2.forEach((run2) => stripTrackedChangeFromRun(run2));
|
|
159178
159602
|
else
|
|
159179
159603
|
runs2.forEach((run2) => {
|
|
159180
|
-
if (isTextRun$
|
|
159604
|
+
if (isTextRun$3(run2))
|
|
159181
159605
|
applyFormatChangeMarks(run2, config2, hyperlinkConfig, applyMarksToRun$1, themeColors, enableComments);
|
|
159182
159606
|
});
|
|
159183
159607
|
return runs2;
|
|
159184
159608
|
}
|
|
159185
159609
|
const filtered = [];
|
|
159186
159610
|
runs2.forEach((run2) => {
|
|
159187
|
-
if (!isTextRun$
|
|
159611
|
+
if (!isTextRun$3(run2)) {
|
|
159188
159612
|
filtered.push(run2);
|
|
159189
159613
|
return;
|
|
159190
159614
|
}
|
|
@@ -159203,12 +159627,12 @@ var Node$13 = class Node$14 {
|
|
|
159203
159627
|
filtered.forEach((run2) => stripTrackedChangeFromRun(run2));
|
|
159204
159628
|
else {
|
|
159205
159629
|
filtered.forEach((run2) => {
|
|
159206
|
-
if (isTextRun$
|
|
159630
|
+
if (isTextRun$3(run2))
|
|
159207
159631
|
applyFormatChangeMarks(run2, config2, hyperlinkConfig || DEFAULT_HYPERLINK_CONFIG, applyMarksToRun$1, themeColors, enableComments);
|
|
159208
159632
|
});
|
|
159209
159633
|
if ((config2.mode === "original" || config2.mode === "final") && config2.enabled)
|
|
159210
159634
|
filtered.forEach((run2) => {
|
|
159211
|
-
if (isTextRun$
|
|
159635
|
+
if (isTextRun$3(run2) && run2.trackedChange && (run2.trackedChange.kind === "insert" || run2.trackedChange.kind === "delete"))
|
|
159212
159636
|
delete run2.trackedChange;
|
|
159213
159637
|
});
|
|
159214
159638
|
}
|
|
@@ -159818,7 +160242,12 @@ var Node$13 = class Node$14 {
|
|
|
159818
160242
|
if (history$1 != null)
|
|
159819
160243
|
link2.history = history$1;
|
|
159820
160244
|
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,
|
|
160245
|
+
}, 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) => {
|
|
160246
|
+
let randomId = "";
|
|
160247
|
+
while (randomId.length < length$1)
|
|
160248
|
+
randomId += Math.random().toString(36).slice(2);
|
|
160249
|
+
return randomId.slice(0, length$1);
|
|
160250
|
+
}, validateDepth = (obj, currentDepth = 0) => {
|
|
159822
160251
|
if (currentDepth > MAX_RUN_MARK_DEPTH)
|
|
159823
160252
|
return false;
|
|
159824
160253
|
if (obj && typeof obj === "object") {
|
|
@@ -160026,7 +160455,7 @@ var Node$13 = class Node$14 {
|
|
|
160026
160455
|
}, deriveTrackedChangeId = (kind, attrs) => {
|
|
160027
160456
|
if (attrs && typeof attrs.id === "string" && attrs.id.trim())
|
|
160028
160457
|
return attrs.id;
|
|
160029
|
-
return `${kind}-${attrs && typeof attrs.authorEmail === "string" ? attrs.authorEmail : "unknown"}-${attrs && typeof attrs.date === "string" ? attrs.date : "unknown"}-${`${Date.now()}-${
|
|
160458
|
+
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
160459
|
}, buildTrackedChangeMetaFromMark = (mark2) => {
|
|
160031
160460
|
const kind = pickTrackedChangeKind(mark2.type);
|
|
160032
160461
|
if (!kind)
|
|
@@ -160989,7 +161418,7 @@ var Node$13 = class Node$14 {
|
|
|
160989
161418
|
if (attrs.hidden === true)
|
|
160990
161419
|
return true;
|
|
160991
161420
|
return typeof attrs.visibility === "string" && attrs.visibility.toLowerCase() === "hidden";
|
|
160992
|
-
}, isTextRun$
|
|
161421
|
+
}, isTextRun$2 = (run2) => {
|
|
160993
161422
|
const kind = run2.kind;
|
|
160994
161423
|
return (kind === undefined || kind === "text") && "text" in run2;
|
|
160995
161424
|
}, dataAttrsCompatible = (a2, b$1) => {
|
|
@@ -172564,7 +172993,7 @@ var Node$13 = class Node$14 {
|
|
|
172564
172993
|
trackedChanges: context.trackedChanges ?? []
|
|
172565
172994
|
});
|
|
172566
172995
|
}, _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
|
|
172996
|
+
var init_src_DKGc94QA_es = __esm(() => {
|
|
172568
172997
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
172569
172998
|
init_SuperConverter_BSZgN87C_es();
|
|
172570
172999
|
init_jszip_ChlR43oI_es();
|
|
@@ -183445,12 +183874,25 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
183445
183874
|
init: () => ({ ...DEFAULT_SELECTION_STATE }),
|
|
183446
183875
|
apply: (tr, value) => {
|
|
183447
183876
|
const meta2 = getFocusMeta(tr);
|
|
183448
|
-
|
|
183877
|
+
const nextState = meta2 !== undefined ? normalizeSelectionState({
|
|
183878
|
+
...value,
|
|
183879
|
+
...meta2
|
|
183880
|
+
}) : value;
|
|
183881
|
+
if (!nextState?.preservedSelection)
|
|
183882
|
+
return nextState;
|
|
183883
|
+
if (!tr.docChanged)
|
|
183884
|
+
return nextState;
|
|
183885
|
+
const mappedSelection = mapPreservedSelection(nextState.preservedSelection, tr);
|
|
183886
|
+
if (!mappedSelection)
|
|
183449
183887
|
return {
|
|
183450
|
-
...
|
|
183451
|
-
|
|
183888
|
+
...nextState,
|
|
183889
|
+
preservedSelection: null,
|
|
183890
|
+
showVisualSelection: false
|
|
183452
183891
|
};
|
|
183453
|
-
return
|
|
183892
|
+
return {
|
|
183893
|
+
...nextState,
|
|
183894
|
+
preservedSelection: mappedSelection
|
|
183895
|
+
};
|
|
183454
183896
|
}
|
|
183455
183897
|
},
|
|
183456
183898
|
view: () => {
|
|
@@ -191869,7 +192311,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
191869
192311
|
try {
|
|
191870
192312
|
this.#decorationBridge.sync(state, this.#domPositionIndex);
|
|
191871
192313
|
} catch (error) {
|
|
191872
|
-
|
|
192314
|
+
console.warn("[PresentationEditor] Decoration sync failed:", error);
|
|
191873
192315
|
}
|
|
191874
192316
|
}
|
|
191875
192317
|
#scheduleDecorationSync() {
|
|
@@ -191921,8 +192363,21 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
191921
192363
|
this.#updateLocalAwarenessCursor();
|
|
191922
192364
|
this.#scheduleA11ySelectionAnnouncement();
|
|
191923
192365
|
};
|
|
191924
|
-
const handleTransaction = () => {
|
|
191925
|
-
|
|
192366
|
+
const handleTransaction = (event) => {
|
|
192367
|
+
const tr = event?.transaction;
|
|
192368
|
+
this.#decorationBridge.recordTransaction(tr);
|
|
192369
|
+
const state = this.#editor?.view?.state;
|
|
192370
|
+
const decorationChanged = state && this.#decorationBridge.hasChanges(state);
|
|
192371
|
+
if (decorationChanged) {
|
|
192372
|
+
const restoreEmpty = tr ? tr.docChanged === true : false;
|
|
192373
|
+
this.#decorationBridge.sync(state, this.#domPositionIndex, { restoreEmptyDecorations: restoreEmpty });
|
|
192374
|
+
} else
|
|
192375
|
+
this.#scheduleDecorationSync();
|
|
192376
|
+
if (decorationChanged) {
|
|
192377
|
+
this.#pendingDocChange = true;
|
|
192378
|
+
this.#selectionSync.onLayoutStart();
|
|
192379
|
+
this.#scheduleRerender();
|
|
192380
|
+
}
|
|
191926
192381
|
};
|
|
191927
192382
|
this.#editor.on("update", handleUpdate);
|
|
191928
192383
|
this.#editor.on("selectionUpdate", handleSelection);
|
|
@@ -192373,6 +192828,13 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
192373
192828
|
this.#handleLayoutError("render", /* @__PURE__ */ new Error("toFlowBlocks returned undefined blocks"));
|
|
192374
192829
|
return;
|
|
192375
192830
|
}
|
|
192831
|
+
const state = this.#editor?.view?.state;
|
|
192832
|
+
const decorationRanges = state ? this.#decorationBridge.collectDecorationRanges(state) : [];
|
|
192833
|
+
if (decorationRanges.length > 0)
|
|
192834
|
+
blocks2 = splitRunsAtDecorationBoundaries(blocks2, decorationRanges.map((r$1) => ({
|
|
192835
|
+
from: r$1.from,
|
|
192836
|
+
to: r$1.to
|
|
192837
|
+
})));
|
|
192376
192838
|
this.#applyHtmlAnnotationMeasurements(blocks2);
|
|
192377
192839
|
const baseLayoutOptions = this.#resolveLayoutOptions(blocks2, sectionMetadata);
|
|
192378
192840
|
const footnotesLayoutInput = buildFootnotesInput(this.#editor?.state, this.#editor?.converter, converterContext, this.#editor?.converter?.themeColors ?? undefined);
|
|
@@ -203424,8 +203886,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
203424
203886
|
return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
|
|
203425
203887
|
};
|
|
203426
203888
|
stubFalse_default = stubFalse;
|
|
203427
|
-
freeExports$2 = typeof
|
|
203428
|
-
freeModule$2 = freeExports$2 && typeof
|
|
203889
|
+
freeExports$2 = typeof exports_src_DKGc94QA_es == "object" && exports_src_DKGc94QA_es && !exports_src_DKGc94QA_es.nodeType && exports_src_DKGc94QA_es;
|
|
203890
|
+
freeModule$2 = freeExports$2 && typeof module_src_DKGc94QA_es == "object" && module_src_DKGc94QA_es && !module_src_DKGc94QA_es.nodeType && module_src_DKGc94QA_es;
|
|
203429
203891
|
Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
|
|
203430
203892
|
isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
|
|
203431
203893
|
typedArrayTags = {};
|
|
@@ -203433,8 +203895,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
203433
203895
|
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
203896
|
_baseIsTypedArray_default = baseIsTypedArray;
|
|
203435
203897
|
_baseUnary_default = baseUnary;
|
|
203436
|
-
freeExports$1 = typeof
|
|
203437
|
-
freeModule$1 = freeExports$1 && typeof
|
|
203898
|
+
freeExports$1 = typeof exports_src_DKGc94QA_es == "object" && exports_src_DKGc94QA_es && !exports_src_DKGc94QA_es.nodeType && exports_src_DKGc94QA_es;
|
|
203899
|
+
freeModule$1 = freeExports$1 && typeof module_src_DKGc94QA_es == "object" && module_src_DKGc94QA_es && !module_src_DKGc94QA_es.nodeType && module_src_DKGc94QA_es;
|
|
203438
203900
|
freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
|
|
203439
203901
|
_nodeUtil_default = function() {
|
|
203440
203902
|
try {
|
|
@@ -203539,8 +204001,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
203539
204001
|
Stack.prototype.has = _stackHas_default;
|
|
203540
204002
|
Stack.prototype.set = _stackSet_default;
|
|
203541
204003
|
_Stack_default = Stack;
|
|
203542
|
-
freeExports = typeof
|
|
203543
|
-
freeModule = freeExports && typeof
|
|
204004
|
+
freeExports = typeof exports_src_DKGc94QA_es == "object" && exports_src_DKGc94QA_es && !exports_src_DKGc94QA_es.nodeType && exports_src_DKGc94QA_es;
|
|
204005
|
+
freeModule = freeExports && typeof module_src_DKGc94QA_es == "object" && module_src_DKGc94QA_es && !module_src_DKGc94QA_es.nodeType && module_src_DKGc94QA_es;
|
|
203544
204006
|
Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
|
|
203545
204007
|
allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
|
|
203546
204008
|
_cloneBuffer_default = cloneBuffer;
|
|
@@ -211192,7 +211654,7 @@ var init_zipper_Cnk_HjM2_es = __esm(() => {
|
|
|
211192
211654
|
|
|
211193
211655
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
211194
211656
|
var init_super_editor_es = __esm(() => {
|
|
211195
|
-
|
|
211657
|
+
init_src_DKGc94QA_es();
|
|
211196
211658
|
init_SuperConverter_BSZgN87C_es();
|
|
211197
211659
|
init_jszip_ChlR43oI_es();
|
|
211198
211660
|
init_xml_js_DLE8mr0n_es();
|
|
@@ -271678,7 +272140,18 @@ function tablesDistributeColumnsAdapter2(editor, input2, options) {
|
|
|
271678
272140
|
}
|
|
271679
272141
|
}
|
|
271680
272142
|
const tableAttrs = tableNode.attrs;
|
|
271681
|
-
|
|
272143
|
+
const normalizedGrid = normalizeGridColumns2(tableAttrs.grid);
|
|
272144
|
+
const tableAttrUpdates = { ...tableAttrs, userEdited: true };
|
|
272145
|
+
if (normalizedGrid) {
|
|
272146
|
+
const newColumns = normalizedGrid.columns.slice();
|
|
272147
|
+
const evenWidthTwips = Math.max(1, Math.round(evenWidth * PIXELS_TO_TWIPS2));
|
|
272148
|
+
const maxColumn = Math.min(rangeEnd, newColumns.length - 1);
|
|
272149
|
+
for (let col = Math.max(rangeStart, 0);col <= maxColumn; col++) {
|
|
272150
|
+
newColumns[col] = { col: evenWidthTwips };
|
|
272151
|
+
}
|
|
272152
|
+
tableAttrUpdates.grid = serializeGridColumns2(tableAttrs.grid, { ...normalizedGrid, columns: newColumns });
|
|
272153
|
+
}
|
|
272154
|
+
tr.setNodeMarkup(tablePos, null, tableAttrUpdates);
|
|
271682
272155
|
applyDirectMutationMeta2(tr);
|
|
271683
272156
|
editor.dispatch(tr);
|
|
271684
272157
|
clearIndexCache2(editor);
|
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.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -19,21 +19,21 @@
|
|
|
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",
|
|
24
|
-
"superdoc": "
|
|
25
|
-
"@superdoc/super-editor": "0.0.1"
|
|
23
|
+
"@superdoc/pm-adapter": "0.0.0",
|
|
24
|
+
"@superdoc/super-editor": "0.0.1",
|
|
25
|
+
"superdoc": "1.16.0"
|
|
26
26
|
},
|
|
27
27
|
"module": "src/index.ts",
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"optionalDependencies": {
|
|
32
|
-
"@superdoc-dev/cli-darwin-arm64": "0.2.0-next.
|
|
33
|
-
"@superdoc-dev/cli-darwin-x64": "0.2.0-next.
|
|
34
|
-
"@superdoc-dev/cli-linux-x64": "0.2.0-next.
|
|
35
|
-
"@superdoc-dev/cli-
|
|
36
|
-
"@superdoc-dev/cli-
|
|
32
|
+
"@superdoc-dev/cli-darwin-arm64": "0.2.0-next.32",
|
|
33
|
+
"@superdoc-dev/cli-darwin-x64": "0.2.0-next.32",
|
|
34
|
+
"@superdoc-dev/cli-linux-x64": "0.2.0-next.32",
|
|
35
|
+
"@superdoc-dev/cli-linux-arm64": "0.2.0-next.32",
|
|
36
|
+
"@superdoc-dev/cli-windows-x64": "0.2.0-next.32"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"dev": "bun run src/index.ts",
|