@superdoc-dev/cli 0.7.0-next.36 → 0.7.0-next.37
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 +155 -23
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -205830,7 +205830,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
205830
205830
|
init_remark_gfm_BhnWr3yf_es();
|
|
205831
205831
|
});
|
|
205832
205832
|
|
|
205833
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
205833
|
+
// ../../packages/superdoc/dist/chunks/src-j2qoSUF1.es.js
|
|
205834
205834
|
function deleteProps(obj, propOrProps) {
|
|
205835
205835
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
205836
205836
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -207576,33 +207576,137 @@ function createStructuredContentLockPlugin() {
|
|
|
207576
207576
|
}
|
|
207577
207577
|
});
|
|
207578
207578
|
}
|
|
207579
|
+
function needsEditableSlot(node3, side) {
|
|
207580
|
+
if (!node3)
|
|
207581
|
+
return true;
|
|
207582
|
+
const name = node3.type.name;
|
|
207583
|
+
if (name === "hardBreak" || name === "lineBreak" || name === "structuredContent")
|
|
207584
|
+
return true;
|
|
207585
|
+
if (name === "run")
|
|
207586
|
+
return !(side === "before" ? node3.lastChild?.isText : node3.firstChild?.isText);
|
|
207587
|
+
return false;
|
|
207588
|
+
}
|
|
207589
|
+
function applyEditableSlotAtInlineBoundary(tr, pos, direction) {
|
|
207590
|
+
const clampedPos = Math.max(0, Math.min(pos, tr.doc.content.size));
|
|
207591
|
+
if (direction === "before") {
|
|
207592
|
+
if (!needsEditableSlot(tr.doc.resolve(clampedPos).nodeBefore, "before"))
|
|
207593
|
+
return tr.setSelection(TextSelection.create(tr.doc, clampedPos));
|
|
207594
|
+
tr.insertText("", clampedPos);
|
|
207595
|
+
return tr.setSelection(TextSelection.create(tr.doc, clampedPos + 1));
|
|
207596
|
+
}
|
|
207597
|
+
if (!needsEditableSlot(tr.doc.nodeAt(clampedPos), "after"))
|
|
207598
|
+
return tr.setSelection(TextSelection.create(tr.doc, clampedPos));
|
|
207599
|
+
tr.insertText("", clampedPos);
|
|
207600
|
+
return tr.setSelection(TextSelection.create(tr.doc, clampedPos + 1));
|
|
207601
|
+
}
|
|
207579
207602
|
function createStructuredContentSelectPlugin(editor) {
|
|
207580
|
-
return new Plugin({
|
|
207581
|
-
|
|
207582
|
-
|
|
207583
|
-
|
|
207584
|
-
|
|
207585
|
-
|
|
207586
|
-
|
|
207587
|
-
|
|
207588
|
-
|
|
207589
|
-
|
|
207590
|
-
|
|
207591
|
-
|
|
207592
|
-
|
|
207603
|
+
return new Plugin({
|
|
207604
|
+
props: { handleKeyDown(view, event) {
|
|
207605
|
+
if (editor?.options?.documentMode === "viewing")
|
|
207606
|
+
return false;
|
|
207607
|
+
if (event.key !== "ArrowRight" && event.key !== "ArrowLeft")
|
|
207608
|
+
return false;
|
|
207609
|
+
if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey)
|
|
207610
|
+
return false;
|
|
207611
|
+
const { state } = view;
|
|
207612
|
+
const { selection } = state;
|
|
207613
|
+
const resolveBoundaryExit = ($pos) => {
|
|
207614
|
+
for (let depth = $pos.depth;depth > 0; depth -= 1) {
|
|
207615
|
+
const node3 = $pos.node(depth);
|
|
207616
|
+
if (node3.type.name !== "structuredContent")
|
|
207617
|
+
continue;
|
|
207618
|
+
const contentFrom = $pos.start(depth);
|
|
207619
|
+
const contentTo = $pos.end(depth);
|
|
207620
|
+
const nodePos = $pos.before(depth);
|
|
207621
|
+
const beforePos = nodePos;
|
|
207622
|
+
const afterPos = nodePos + node3.nodeSize;
|
|
207623
|
+
if (selection.empty) {
|
|
207624
|
+
if (event.key === "ArrowRight" && selection.from >= contentTo - 1)
|
|
207625
|
+
return afterPos;
|
|
207626
|
+
if (event.key === "ArrowLeft" && selection.from <= contentFrom + 1)
|
|
207627
|
+
return beforePos;
|
|
207628
|
+
return null;
|
|
207629
|
+
}
|
|
207630
|
+
if (!(selection.from === contentFrom && selection.to === contentTo))
|
|
207631
|
+
return null;
|
|
207632
|
+
if (event.key === "ArrowRight")
|
|
207633
|
+
return afterPos;
|
|
207634
|
+
if (event.key === "ArrowLeft")
|
|
207635
|
+
return beforePos;
|
|
207636
|
+
return null;
|
|
207637
|
+
}
|
|
207638
|
+
return null;
|
|
207639
|
+
};
|
|
207640
|
+
const nextPos = resolveBoundaryExit(selection.$from);
|
|
207641
|
+
if (nextPos == null)
|
|
207642
|
+
return false;
|
|
207643
|
+
try {
|
|
207644
|
+
const direction = event.key === "ArrowLeft" ? "before" : "after";
|
|
207645
|
+
const tr = applyEditableSlotAtInlineBoundary(state.tr, nextPos, direction);
|
|
207646
|
+
view.dispatch(tr);
|
|
207647
|
+
event.preventDefault();
|
|
207648
|
+
return true;
|
|
207649
|
+
} catch {
|
|
207650
|
+
return false;
|
|
207651
|
+
}
|
|
207652
|
+
} },
|
|
207653
|
+
appendTransaction(transactions, oldState, newState) {
|
|
207654
|
+
if (editor?.options?.documentMode === "viewing")
|
|
207655
|
+
return null;
|
|
207656
|
+
const { selection } = newState;
|
|
207657
|
+
if (oldState.selection.eq(newState.selection))
|
|
207658
|
+
return null;
|
|
207659
|
+
if (transactions.some((tr) => tr.docChanged))
|
|
207660
|
+
return null;
|
|
207661
|
+
if (!selection.empty) {
|
|
207662
|
+
let selectedSdt = null;
|
|
207663
|
+
newState.doc.descendants((node3, pos) => {
|
|
207664
|
+
if (node3.type.name !== "structuredContent")
|
|
207665
|
+
return true;
|
|
207666
|
+
const contentFrom = pos + 1;
|
|
207667
|
+
const contentTo = pos + node3.nodeSize - 1;
|
|
207668
|
+
if (!(selection.from <= contentFrom && selection.to >= contentTo))
|
|
207669
|
+
return true;
|
|
207670
|
+
selectedSdt = {
|
|
207671
|
+
node: node3,
|
|
207672
|
+
pos,
|
|
207673
|
+
contentFrom,
|
|
207674
|
+
contentTo
|
|
207675
|
+
};
|
|
207676
|
+
return false;
|
|
207677
|
+
});
|
|
207678
|
+
if (selectedSdt) {
|
|
207679
|
+
const oldAtTrailingBoundary = oldState.selection.empty && oldState.selection.from >= selectedSdt.pos + selectedSdt.node.nodeSize;
|
|
207680
|
+
const oldAtLeadingBoundary = oldState.selection.empty && oldState.selection.from <= selectedSdt.pos;
|
|
207681
|
+
if (oldAtTrailingBoundary)
|
|
207682
|
+
return applyEditableSlotAtInlineBoundary(newState.tr, selectedSdt.pos + selectedSdt.node.nodeSize, "after");
|
|
207683
|
+
if (oldAtLeadingBoundary)
|
|
207684
|
+
return applyEditableSlotAtInlineBoundary(newState.tr, selectedSdt.pos, "before");
|
|
207685
|
+
}
|
|
207686
|
+
return null;
|
|
207687
|
+
}
|
|
207688
|
+
if (!selection.empty)
|
|
207689
|
+
return null;
|
|
207690
|
+
const $pos = selection.$from;
|
|
207691
|
+
const old$pos = oldState.selection.$from;
|
|
207692
|
+
for (let d = $pos.depth;d > 0; d--) {
|
|
207693
|
+
if ($pos.node(d).type.name !== "structuredContent")
|
|
207694
|
+
continue;
|
|
207593
207695
|
const sdtStart = $pos.before(d);
|
|
207594
207696
|
const contentFrom = $pos.start(d);
|
|
207595
207697
|
const contentTo = $pos.end(d);
|
|
207698
|
+
if (selection.from <= contentFrom || selection.from >= contentTo)
|
|
207699
|
+
return null;
|
|
207596
207700
|
if (contentFrom === contentTo)
|
|
207597
207701
|
return null;
|
|
207598
|
-
const old$pos = oldState.selection.$from;
|
|
207599
207702
|
for (let od = old$pos.depth;od > 0; od--)
|
|
207600
207703
|
if (old$pos.node(od).type.name === "structuredContent" && old$pos.before(od) === sdtStart)
|
|
207601
207704
|
return null;
|
|
207602
207705
|
return newState.tr.setSelection(TextSelection.create(newState.doc, contentFrom, contentTo));
|
|
207603
207706
|
}
|
|
207604
|
-
|
|
207605
|
-
|
|
207707
|
+
return null;
|
|
207708
|
+
}
|
|
207709
|
+
});
|
|
207606
207710
|
}
|
|
207607
207711
|
function getStructuredContentTagsById(idOrIds, state) {
|
|
207608
207712
|
return findChildren$1(state.doc, (node3) => {
|
|
@@ -259379,6 +259483,17 @@ function readPmRange(el) {
|
|
|
259379
259483
|
end: Number(el.dataset.pmEnd ?? "NaN")
|
|
259380
259484
|
};
|
|
259381
259485
|
}
|
|
259486
|
+
function getInlineSdtWrapperBoundaryPos(spanEl, side) {
|
|
259487
|
+
if (!(spanEl instanceof HTMLElement))
|
|
259488
|
+
return null;
|
|
259489
|
+
const wrapper = spanEl.closest(`.${CLASS.inlineSdtWrapper}`);
|
|
259490
|
+
if (!wrapper)
|
|
259491
|
+
return null;
|
|
259492
|
+
const { start: start$1, end: end$1 } = readPmRange(wrapper);
|
|
259493
|
+
if (!Number.isFinite(start$1) || !Number.isFinite(end$1))
|
|
259494
|
+
return null;
|
|
259495
|
+
return side === "before" ? start$1 - 1 : end$1 + 1;
|
|
259496
|
+
}
|
|
259382
259497
|
function getClickableSpans(lineEl) {
|
|
259383
259498
|
return Array.from(lineEl.querySelectorAll("span, a")).filter((el) => el.dataset.pmStart !== undefined && el.dataset.pmEnd !== undefined && !el.classList.contains(CLASS.inlineSdtWrapper));
|
|
259384
259499
|
}
|
|
@@ -259494,9 +259609,9 @@ function resolvePositionInLine(lineEl, lineStart, lineEnd, spanEls, viewX) {
|
|
|
259494
259609
|
const visualLeft = Math.min(...boundsRects.map((r$1) => r$1.left));
|
|
259495
259610
|
const visualRight = Math.max(...boundsRects.map((r$1) => r$1.right));
|
|
259496
259611
|
if (viewX <= visualLeft)
|
|
259497
|
-
return rtl ? lineEnd : lineStart;
|
|
259612
|
+
return getInlineSdtWrapperBoundaryPos(rtl ? spanEls[spanEls.length - 1] : spanEls[0], rtl ? "after" : "before") ?? (rtl ? lineEnd : lineStart);
|
|
259498
259613
|
if (viewX >= visualRight)
|
|
259499
|
-
return rtl ? lineStart : lineEnd;
|
|
259614
|
+
return getInlineSdtWrapperBoundaryPos(rtl ? spanEls[0] : spanEls[spanEls.length - 1], rtl ? "before" : "after") ?? (rtl ? lineStart : lineEnd);
|
|
259500
259615
|
const targetEl = findSpanAtX(spanEls, viewX);
|
|
259501
259616
|
if (!targetEl)
|
|
259502
259617
|
return lineStart;
|
|
@@ -287248,15 +287363,32 @@ menclose::after {
|
|
|
287248
287363
|
try {
|
|
287249
287364
|
const sdtBlock = clickDepth === 1 ? this.#findStructuredContentBlockAtPos(doc$12, hit.pos) : null;
|
|
287250
287365
|
let nextSelection;
|
|
287366
|
+
let inlineSdtBoundaryPos = null;
|
|
287367
|
+
let inlineSdtBoundaryDirection = null;
|
|
287251
287368
|
const insideTableInSdt = !!sdtBlock && this.#isInsideTableWithinStructuredContentBlock(doc$12, hit.pos, sdtBlock.pos);
|
|
287252
287369
|
if (sdtBlock && !insideTableInSdt)
|
|
287253
287370
|
nextSelection = NodeSelection.create(doc$12, sdtBlock.pos);
|
|
287254
287371
|
else {
|
|
287255
|
-
|
|
287372
|
+
const inlineSdt = clickDepth === 1 ? this.#findStructuredContentInlineAtPos(doc$12, hit.pos) : null;
|
|
287373
|
+
if (inlineSdt && hit.pos >= inlineSdt.end) {
|
|
287374
|
+
const afterInlineSdt = inlineSdt.pos + inlineSdt.node.nodeSize;
|
|
287375
|
+
inlineSdtBoundaryPos = afterInlineSdt;
|
|
287376
|
+
inlineSdtBoundaryDirection = "after";
|
|
287377
|
+
nextSelection = TextSelection.create(doc$12, afterInlineSdt);
|
|
287378
|
+
} else if (inlineSdt && hit.pos <= inlineSdt.start) {
|
|
287379
|
+
inlineSdtBoundaryPos = inlineSdt.pos;
|
|
287380
|
+
inlineSdtBoundaryDirection = "before";
|
|
287381
|
+
nextSelection = TextSelection.create(doc$12, inlineSdt.pos);
|
|
287382
|
+
} else
|
|
287383
|
+
nextSelection = TextSelection.create(doc$12, hit.pos);
|
|
287256
287384
|
if (!nextSelection.$from.parent.inlineContent)
|
|
287257
287385
|
nextSelection = Selection.near(doc$12.resolve(hit.pos), 1);
|
|
287258
287386
|
}
|
|
287259
|
-
|
|
287387
|
+
let tr = editor.state.tr.setSelection(nextSelection);
|
|
287388
|
+
if (inlineSdtBoundaryPos != null && inlineSdtBoundaryDirection) {
|
|
287389
|
+
tr = applyEditableSlotAtInlineBoundary(tr, inlineSdtBoundaryPos, inlineSdtBoundaryDirection);
|
|
287390
|
+
nextSelection = tr.selection;
|
|
287391
|
+
}
|
|
287260
287392
|
if (nextSelection instanceof TextSelection && nextSelection.empty && editor.state.storedMarks)
|
|
287261
287393
|
tr.setStoredMarks(editor.state.storedMarks);
|
|
287262
287394
|
editor.view?.dispatch(tr);
|
|
@@ -290353,7 +290485,7 @@ menclose::after {
|
|
|
290353
290485
|
return;
|
|
290354
290486
|
console.log(...args$1);
|
|
290355
290487
|
}, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
|
|
290356
|
-
var
|
|
290488
|
+
var init_src_j2qoSUF1_es = __esm(() => {
|
|
290357
290489
|
init_rolldown_runtime_Bg48TavK_es();
|
|
290358
290490
|
init_SuperConverter_D8HLuwGQ_es();
|
|
290359
290491
|
init_jszip_C49i9kUs_es();
|
|
@@ -325227,7 +325359,7 @@ var init_zipper_DbkgrypV_es = __esm(() => {
|
|
|
325227
325359
|
|
|
325228
325360
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
325229
325361
|
var init_super_editor_es = __esm(() => {
|
|
325230
|
-
|
|
325362
|
+
init_src_j2qoSUF1_es();
|
|
325231
325363
|
init_SuperConverter_D8HLuwGQ_es();
|
|
325232
325364
|
init_jszip_C49i9kUs_es();
|
|
325233
325365
|
init_xml_js_CqGKpaft_es();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.7.0-next.
|
|
3
|
+
"version": "0.7.0-next.37",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -25,20 +25,20 @@
|
|
|
25
25
|
"@types/ws": "^8.5.13",
|
|
26
26
|
"typescript": "^5.9.2",
|
|
27
27
|
"@superdoc/document-api": "0.0.1",
|
|
28
|
-
"@superdoc/pm-adapter": "0.0.0",
|
|
29
28
|
"@superdoc/super-editor": "0.0.1",
|
|
30
|
-
"superdoc": "1.26.0"
|
|
29
|
+
"superdoc": "1.26.0",
|
|
30
|
+
"@superdoc/pm-adapter": "0.0.0"
|
|
31
31
|
},
|
|
32
32
|
"module": "src/index.ts",
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
|
-
"@superdoc-dev/cli-darwin-arm64": "0.7.0-next.
|
|
38
|
-
"@superdoc-dev/cli-darwin-x64": "0.7.0-next.
|
|
39
|
-
"@superdoc-dev/cli-
|
|
40
|
-
"@superdoc-dev/cli-linux-arm64": "0.7.0-next.
|
|
41
|
-
"@superdoc-dev/cli-
|
|
37
|
+
"@superdoc-dev/cli-darwin-arm64": "0.7.0-next.37",
|
|
38
|
+
"@superdoc-dev/cli-darwin-x64": "0.7.0-next.37",
|
|
39
|
+
"@superdoc-dev/cli-linux-x64": "0.7.0-next.37",
|
|
40
|
+
"@superdoc-dev/cli-linux-arm64": "0.7.0-next.37",
|
|
41
|
+
"@superdoc-dev/cli-windows-x64": "0.7.0-next.37"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"predev": "node scripts/ensure-superdoc-build.js",
|