@superdoc-dev/cli 0.8.0-next.1 → 0.8.0-next.3
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 +161 -76
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -65501,7 +65501,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
|
|
|
65501
65501
|
emptyOptions2 = {};
|
|
65502
65502
|
});
|
|
65503
65503
|
|
|
65504
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
65504
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-t-W4yNkb.es.js
|
|
65505
65505
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
65506
65506
|
const fieldValue = extension$1.config[field];
|
|
65507
65507
|
if (typeof fieldValue === "function")
|
|
@@ -96675,8 +96675,74 @@ function resolveTextRangeInBlock(blockNode, blockPos, range) {
|
|
|
96675
96675
|
to: toPos
|
|
96676
96676
|
};
|
|
96677
96677
|
}
|
|
96678
|
+
function buildTextWithTabs(schema, text$2, marks, opts = {}) {
|
|
96679
|
+
if (!text$2.includes("\t"))
|
|
96680
|
+
return schema.text(text$2, marks);
|
|
96681
|
+
const tabNodeType = schema.nodes?.tab;
|
|
96682
|
+
if (!tabNodeType || opts.parentAllowsTab === false)
|
|
96683
|
+
return schema.text(text$2, marks);
|
|
96684
|
+
const tabMarks = marks ?? null;
|
|
96685
|
+
const parts = text$2.split("\t");
|
|
96686
|
+
const nodes = [];
|
|
96687
|
+
for (let i$1 = 0;i$1 < parts.length; i$1++) {
|
|
96688
|
+
if (parts[i$1])
|
|
96689
|
+
nodes.push(schema.text(parts[i$1], marks));
|
|
96690
|
+
if (i$1 < parts.length - 1)
|
|
96691
|
+
nodes.push(tabNodeType.create(null, null, tabMarks));
|
|
96692
|
+
}
|
|
96693
|
+
return Fragment.from(nodes);
|
|
96694
|
+
}
|
|
96695
|
+
function parentAllowsNodeAt(tr, absPos, nodeType) {
|
|
96696
|
+
const contentMatch = tr.doc.resolve(absPos)?.parent?.type?.contentMatch;
|
|
96697
|
+
if (!contentMatch || typeof contentMatch.matchType !== "function")
|
|
96698
|
+
return true;
|
|
96699
|
+
return contentMatch.matchType(nodeType) != null;
|
|
96700
|
+
}
|
|
96701
|
+
function textBetweenWithTabs(doc$2, from5, to, blockSeparator, leafFallback) {
|
|
96702
|
+
const anyDoc = doc$2;
|
|
96703
|
+
if (typeof anyDoc.nodesBetween !== "function") {
|
|
96704
|
+
if (typeof anyDoc.textBetween === "function")
|
|
96705
|
+
return anyDoc.textBetween(from5, to, blockSeparator, leafFallback);
|
|
96706
|
+
return "";
|
|
96707
|
+
}
|
|
96708
|
+
let out = "";
|
|
96709
|
+
let emitted = false;
|
|
96710
|
+
const seenBlocks = /* @__PURE__ */ new Set;
|
|
96711
|
+
doc$2.nodesBetween(from5, to, (node3, pos) => {
|
|
96712
|
+
if (pos >= to)
|
|
96713
|
+
return false;
|
|
96714
|
+
if (!node3)
|
|
96715
|
+
return false;
|
|
96716
|
+
if (node3.type?.name === "tab") {
|
|
96717
|
+
out += "\t";
|
|
96718
|
+
emitted = true;
|
|
96719
|
+
return false;
|
|
96720
|
+
}
|
|
96721
|
+
if (node3.isText) {
|
|
96722
|
+
const start = Math.max(from5, pos) - pos;
|
|
96723
|
+
const end = Math.min(to, pos + node3.nodeSize) - pos;
|
|
96724
|
+
const text$2 = typeof node3.text === "string" ? node3.text : "".repeat(node3.nodeSize);
|
|
96725
|
+
out += text$2.slice(start, end);
|
|
96726
|
+
emitted = true;
|
|
96727
|
+
return false;
|
|
96728
|
+
}
|
|
96729
|
+
if (node3.isLeaf) {
|
|
96730
|
+
if (node3.isInline) {
|
|
96731
|
+
out += leafFallback;
|
|
96732
|
+
emitted = true;
|
|
96733
|
+
}
|
|
96734
|
+
return false;
|
|
96735
|
+
}
|
|
96736
|
+
if (node3.isBlock && emitted && !seenBlocks.has(pos) && pos > from5) {
|
|
96737
|
+
out += blockSeparator;
|
|
96738
|
+
seenBlocks.add(pos);
|
|
96739
|
+
}
|
|
96740
|
+
return true;
|
|
96741
|
+
});
|
|
96742
|
+
return out;
|
|
96743
|
+
}
|
|
96678
96744
|
function readTextAtResolvedRange(editor, range) {
|
|
96679
|
-
return editor.state.doc
|
|
96745
|
+
return textBetweenWithTabs(editor.state.doc, range.from, range.to, `
|
|
96680
96746
|
`, OBJECT_REPLACEMENT_CHAR);
|
|
96681
96747
|
}
|
|
96682
96748
|
function buildTextMutationResolution(input) {
|
|
@@ -96786,8 +96852,8 @@ function resolveDefaultInsertTarget(editor) {
|
|
|
96786
96852
|
}
|
|
96787
96853
|
function insertParagraphAtEnd(editor, pos, text$2, applyMeta) {
|
|
96788
96854
|
const schema = editor.state.schema;
|
|
96789
|
-
const
|
|
96790
|
-
const paragraph2 = schema.nodes.paragraph.create(null,
|
|
96855
|
+
const content$2 = buildTextWithTabs(schema, text$2, undefined);
|
|
96856
|
+
const paragraph2 = schema.nodes.paragraph.create(null, content$2);
|
|
96791
96857
|
const tr = editor.state.tr;
|
|
96792
96858
|
tr.insert(pos, paragraph2);
|
|
96793
96859
|
if (applyMeta)
|
|
@@ -99484,7 +99550,7 @@ function getStoryRuntimeCache(hostEditor) {
|
|
|
99484
99550
|
}
|
|
99485
99551
|
function getTextAdapter(editor, input) {
|
|
99486
99552
|
const doc$2 = resolveStoryRuntime(editor, input.in).editor.state.doc;
|
|
99487
|
-
return doc$2
|
|
99553
|
+
return textBetweenWithTabs(doc$2, 0, doc$2.content.size, `
|
|
99488
99554
|
`, `
|
|
99489
99555
|
`);
|
|
99490
99556
|
}
|
|
@@ -117276,7 +117342,7 @@ var isRegExp = (value) => {
|
|
|
117276
117342
|
state.kern = kernNode.attributes["w:val"];
|
|
117277
117343
|
}
|
|
117278
117344
|
}, SuperConverter;
|
|
117279
|
-
var
|
|
117345
|
+
var init_SuperConverter_t_W4yNkb_es = __esm(() => {
|
|
117280
117346
|
init_rolldown_runtime_Bg48TavK_es();
|
|
117281
117347
|
init_jszip_C49i9kUs_es();
|
|
117282
117348
|
init_xml_js_CqGKpaft_es();
|
|
@@ -154562,7 +154628,7 @@ var init_SuperConverter_3_5Ylzu3_es = __esm(() => {
|
|
|
154562
154628
|
};
|
|
154563
154629
|
});
|
|
154564
154630
|
|
|
154565
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
154631
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-DfA3CPoa.es.js
|
|
154566
154632
|
function parseSizeUnit(val = "0") {
|
|
154567
154633
|
const length3 = val.toString() || "0";
|
|
154568
154634
|
const value = Number.parseFloat(length3);
|
|
@@ -157154,8 +157220,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
|
|
|
157154
157220
|
}
|
|
157155
157221
|
};
|
|
157156
157222
|
};
|
|
157157
|
-
var
|
|
157158
|
-
|
|
157223
|
+
var init_create_headless_toolbar_DfA3CPoa_es = __esm(() => {
|
|
157224
|
+
init_SuperConverter_t_W4yNkb_es();
|
|
157159
157225
|
init_constants_CGhJRd87_es();
|
|
157160
157226
|
init_dist_B8HfvhaK_es();
|
|
157161
157227
|
CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
|
|
@@ -205842,7 +205908,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
205842
205908
|
init_remark_gfm_BhnWr3yf_es();
|
|
205843
205909
|
});
|
|
205844
205910
|
|
|
205845
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
205911
|
+
// ../../packages/superdoc/dist/chunks/src-VLovL2KJ.es.js
|
|
205846
205912
|
function deleteProps(obj, propOrProps) {
|
|
205847
205913
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
205848
205914
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -224273,7 +224339,7 @@ function executeTextRewrite(editor, tr, target, step3, mapping) {
|
|
|
224273
224339
|
});
|
|
224274
224340
|
}
|
|
224275
224341
|
}
|
|
224276
|
-
const originalText = tr.doc
|
|
224342
|
+
const originalText = textBetweenWithTabs(tr.doc, absFrom, absTo, "", "");
|
|
224277
224343
|
const origLen = originalText.length;
|
|
224278
224344
|
const replLen = replacementText.length;
|
|
224279
224345
|
let prefix2 = 0;
|
|
@@ -224314,19 +224380,28 @@ function executeTextRewrite(editor, tr, target, step3, mapping) {
|
|
|
224314
224380
|
if (change.type === "delete")
|
|
224315
224381
|
tr.delete(remap(change.docFrom), remap(change.docTo));
|
|
224316
224382
|
else if (change.type === "insert") {
|
|
224317
|
-
const
|
|
224318
|
-
tr.insert(remap(change.docPos),
|
|
224383
|
+
const content3 = buildTextWithTabs(editor.state.schema, change.newText, asProseMirrorMarks(marks));
|
|
224384
|
+
tr.insert(remap(change.docPos), content3);
|
|
224319
224385
|
} else {
|
|
224320
|
-
const
|
|
224321
|
-
tr.replaceWith(remap(change.docFrom), remap(change.docTo),
|
|
224386
|
+
const content3 = buildTextWithTabs(editor.state.schema, change.newText, asProseMirrorMarks(marks));
|
|
224387
|
+
tr.replaceWith(remap(change.docFrom), remap(change.docTo), content3);
|
|
224322
224388
|
}
|
|
224323
224389
|
}
|
|
224324
224390
|
} else {
|
|
224325
|
-
const
|
|
224326
|
-
tr.replaceWith(trimmedFrom, trimmedTo,
|
|
224391
|
+
const content3 = buildTextWithTabs(editor.state.schema, trimmedNew, asProseMirrorMarks(marks));
|
|
224392
|
+
tr.replaceWith(trimmedFrom, trimmedTo, content3);
|
|
224327
224393
|
}
|
|
224328
224394
|
return { changed: replacementText !== target.text };
|
|
224329
224395
|
}
|
|
224396
|
+
function resolveInheritedMarksAt(editor, tr, absPos) {
|
|
224397
|
+
try {
|
|
224398
|
+
if (typeof editor.state?.doc?.resolve !== "function")
|
|
224399
|
+
return tr.doc.resolve(absPos).marks();
|
|
224400
|
+
return getFormattingStateAtPos(editor.state, absPos, editor)?.resolvedMarks ?? [];
|
|
224401
|
+
} catch {
|
|
224402
|
+
return tr.doc.resolve(absPos).marks();
|
|
224403
|
+
}
|
|
224404
|
+
}
|
|
224330
224405
|
function executeTextInsert(editor, tr, target, step3, mapping) {
|
|
224331
224406
|
const position4 = step3.args.position;
|
|
224332
224407
|
const absPos = mapping.map(position4 === "before" ? target.absFrom : target.absTo);
|
|
@@ -224335,15 +224410,12 @@ function executeTextInsert(editor, tr, target, step3, mapping) {
|
|
|
224335
224410
|
return { changed: false };
|
|
224336
224411
|
let marks = [];
|
|
224337
224412
|
const stylePolicy = step3.args.style?.inline;
|
|
224338
|
-
if (stylePolicy)
|
|
224339
|
-
|
|
224340
|
-
|
|
224341
|
-
|
|
224342
|
-
marks = [];
|
|
224343
|
-
else
|
|
224344
|
-
marks = tr.doc.resolve(absPos).marks();
|
|
224413
|
+
if (stylePolicy?.mode === "set")
|
|
224414
|
+
marks = buildMarksFromSetMarks(editor, stylePolicy.setMarks);
|
|
224415
|
+
else if (stylePolicy?.mode === "clear")
|
|
224416
|
+
marks = [];
|
|
224345
224417
|
else
|
|
224346
|
-
marks = tr
|
|
224418
|
+
marks = resolveInheritedMarksAt(editor, tr, absPos);
|
|
224347
224419
|
const structuralInsert = resolveStructuralTextInsert(tr.doc, absPos, step3);
|
|
224348
224420
|
if (structuralInsert) {
|
|
224349
224421
|
const slice2 = buildReplacementParagraphSlice(editor, structuralInsert.replacementBlocks, marks, structuralInsert.paragraphAttrs, step3.id, structuralInsert.leadingWrappers, structuralInsert.trailingWrappers, structuralInsert.openStart, structuralInsert.openEnd);
|
|
@@ -224362,8 +224434,9 @@ function executeTextInsert(editor, tr, target, step3, mapping) {
|
|
|
224362
224434
|
});
|
|
224363
224435
|
}
|
|
224364
224436
|
}
|
|
224365
|
-
const
|
|
224366
|
-
|
|
224437
|
+
const tabNodeType = editor.state.schema.nodes?.tab;
|
|
224438
|
+
const parentAllowsTab = tabNodeType && text5.includes("\t") ? parentAllowsNodeAt(tr, absPos, tabNodeType) : false;
|
|
224439
|
+
tr.insert(absPos, buildTextWithTabs(editor.state.schema, text5, marks, { parentAllowsTab }));
|
|
224367
224440
|
return { changed: true };
|
|
224368
224441
|
}
|
|
224369
224442
|
function executeTextDelete(_editor, tr, target, _step, mapping) {
|
|
@@ -224457,8 +224530,8 @@ function executeSpanTextRewrite(editor, tr, target, step3, mapping) {
|
|
|
224457
224530
|
const absTo = mapping.map(lastSeg.absTo, -1);
|
|
224458
224531
|
if (replacementBlocks.length === 1) {
|
|
224459
224532
|
const marks = resolveSpanMarks(editor, target, policy, step3.id);
|
|
224460
|
-
const
|
|
224461
|
-
tr.replaceWith(absFrom, absTo,
|
|
224533
|
+
const content3 = buildTextWithTabs(editor.state.schema, replacementBlocks[0], asProseMirrorMarks(marks));
|
|
224534
|
+
tr.replaceWith(absFrom, absTo, content3);
|
|
224462
224535
|
return { changed: true };
|
|
224463
224536
|
}
|
|
224464
224537
|
const { schema } = editor.state;
|
|
@@ -224471,8 +224544,8 @@ function executeSpanTextRewrite(editor, tr, target, step3, mapping) {
|
|
|
224471
224544
|
const marks = resolveSegmentMarks(editor, target, segmentIndex, policy, step3.id);
|
|
224472
224545
|
const paragraphAttrs = resolveInheritedParagraphAttrsForReplacement(editor, target, segmentIndex);
|
|
224473
224546
|
const text5 = replacementBlocks[i4];
|
|
224474
|
-
const
|
|
224475
|
-
const para = paragraphType.createAndFill(paragraphAttrs,
|
|
224547
|
+
const content3 = text5.length > 0 ? buildTextWithTabs(schema, text5, asProseMirrorMarks(marks)) : null;
|
|
224548
|
+
const para = paragraphType.createAndFill(paragraphAttrs, content3 ?? undefined) ?? paragraphType.create(paragraphAttrs, content3 ?? undefined);
|
|
224476
224549
|
nodes.push(para);
|
|
224477
224550
|
}
|
|
224478
224551
|
const slice2 = new Slice(Fragment.from(nodes), 1, 1);
|
|
@@ -224783,16 +224856,16 @@ function buildReplacementParagraphNodes(editor, replacementBlocks, marks, paragr
|
|
|
224783
224856
|
const wrapper = wrappers[index2];
|
|
224784
224857
|
content3 = wrapper.type.createAndFill(wrapper.attrs, content3 ?? undefined, wrapper.marks) ?? wrapper.type.create(wrapper.attrs, content3 ?? undefined, wrapper.marks);
|
|
224785
224858
|
}
|
|
224786
|
-
if (!content3)
|
|
224859
|
+
if (!content3 || content3 instanceof Fragment)
|
|
224787
224860
|
throw planError("INVALID_INPUT", "could not build inline wrapper content", stepId);
|
|
224788
224861
|
return content3;
|
|
224789
224862
|
};
|
|
224790
224863
|
const defaultWrappers = leadingWrappers.length > 0 ? leadingWrappers : trailingWrappers;
|
|
224791
224864
|
return replacementBlocks.map((text5, index2) => {
|
|
224792
|
-
const
|
|
224865
|
+
const textContent$1 = text5.length > 0 ? buildTextWithTabs(schema, text5, asProseMirrorMarks(marks)) : null;
|
|
224793
224866
|
const wrappers = index2 === 0 ? leadingWrappers.length > 0 ? leadingWrappers : defaultWrappers : index2 === replacementBlocks.length - 1 ? trailingWrappers.length > 0 ? trailingWrappers : defaultWrappers : defaultWrappers;
|
|
224794
|
-
const content3 =
|
|
224795
|
-
return paragraphType.createAndFill(paragraphAttrs, content3) ?? paragraphType.create(paragraphAttrs, content3);
|
|
224867
|
+
const content3 = textContent$1 == null ? wrappers.length > 0 ? wrapInlineContent(null, wrappers) : undefined : wrappers.length > 0 ? wrapInlineContent(textContent$1, wrappers) : textContent$1;
|
|
224868
|
+
return paragraphType.createAndFill(paragraphAttrs, content3 ?? undefined) ?? paragraphType.create(paragraphAttrs, content3 ?? undefined);
|
|
224796
224869
|
});
|
|
224797
224870
|
}
|
|
224798
224871
|
function buildReplacementParagraphSlice(editor, replacementBlocks, marks, paragraphAttrs, stepId, leadingWrappers, trailingWrappers, openStart, openEnd) {
|
|
@@ -224947,7 +225020,7 @@ function resolveScopedTextForAssert(doc$12, selector, within$1) {
|
|
|
224947
225020
|
return "";
|
|
224948
225021
|
if (!scope.range)
|
|
224949
225022
|
return doc$12.textContent;
|
|
224950
|
-
return doc$12
|
|
225023
|
+
return textBetweenWithTabs(doc$12, scope.range.start, scope.range.end, `
|
|
224951
225024
|
`, "");
|
|
224952
225025
|
}
|
|
224953
225026
|
function executeAssertStep(_editor, tr, step3) {
|
|
@@ -224983,7 +225056,7 @@ function executeCreateStep(editor, tr, step3, targets, mapping) {
|
|
|
224983
225056
|
throw planError("INVALID_INPUT", "paragraph node type not in schema", step3.id);
|
|
224984
225057
|
const sdBlockId = args$1.sdBlockId;
|
|
224985
225058
|
const text5 = args$1.text ?? "";
|
|
224986
|
-
const
|
|
225059
|
+
const textContent$1 = text5.length > 0 ? buildTextWithTabs(editor.state.schema, text5, undefined) : null;
|
|
224987
225060
|
let attrs;
|
|
224988
225061
|
if (step3.op === "create.heading") {
|
|
224989
225062
|
const level = args$1.level ?? 1;
|
|
@@ -224993,7 +225066,7 @@ function executeCreateStep(editor, tr, step3, targets, mapping) {
|
|
|
224993
225066
|
};
|
|
224994
225067
|
} else
|
|
224995
225068
|
attrs = sdBlockId ? { sdBlockId } : undefined;
|
|
224996
|
-
const node3 = paragraphType.createAndFill(attrs,
|
|
225069
|
+
const node3 = paragraphType.createAndFill(attrs, textContent$1 ?? undefined) ?? paragraphType.create(attrs, textContent$1 ?? undefined);
|
|
224997
225070
|
if (!node3)
|
|
224998
225071
|
throw planError("INVALID_INPUT", `could not create ${step3.op} node`, step3.id);
|
|
224999
225072
|
tr.insert(pos, node3);
|
|
@@ -225616,11 +225689,19 @@ function materializeInlineNode(schema, node3, operation, options) {
|
|
|
225616
225689
|
function materializeRun(schema, node3) {
|
|
225617
225690
|
const payload = resolvePayload(node3, "run");
|
|
225618
225691
|
const marks = buildMarksFromRunPayload(schema, payload);
|
|
225619
|
-
return schema
|
|
225692
|
+
return toMaterializedInlines(buildTextWithTabs(schema, payload.text, marks.length > 0 ? marks : undefined));
|
|
225620
225693
|
}
|
|
225621
225694
|
function materializeTextRun(schema, node3) {
|
|
225622
225695
|
const marks = buildMarksFromLegacyRun(schema, node3);
|
|
225623
|
-
return schema
|
|
225696
|
+
return toMaterializedInlines(buildTextWithTabs(schema, node3.text, marks.length > 0 ? marks : undefined));
|
|
225697
|
+
}
|
|
225698
|
+
function toMaterializedInlines(content3) {
|
|
225699
|
+
if (content3 instanceof Fragment) {
|
|
225700
|
+
const out = [];
|
|
225701
|
+
content3.forEach((child) => out.push(child));
|
|
225702
|
+
return out;
|
|
225703
|
+
}
|
|
225704
|
+
return content3;
|
|
225624
225705
|
}
|
|
225625
225706
|
function materializeHyperlink(schema, node3, operation, options) {
|
|
225626
225707
|
const payload = resolvePayload(node3, "hyperlink");
|
|
@@ -225723,7 +225804,7 @@ function materializeNoteRef(schema, node3, kind) {
|
|
|
225723
225804
|
function materializeInlineFallback(schema, node3) {
|
|
225724
225805
|
const payload = node3[resolveKind(node3)] ?? node3;
|
|
225725
225806
|
if (payload.text)
|
|
225726
|
-
return schema
|
|
225807
|
+
return toMaterializedInlines(buildTextWithTabs(schema, payload.text, undefined));
|
|
225727
225808
|
return schema.text("");
|
|
225728
225809
|
}
|
|
225729
225810
|
function buildParagraphProperties(styleRef, props) {
|
|
@@ -239319,7 +239400,7 @@ function replaceSdtTextContent(editor, target, text5) {
|
|
|
239319
239400
|
return true;
|
|
239320
239401
|
}
|
|
239321
239402
|
const paragraph2 = buildEmptyBlockContent(editor, resolved.node);
|
|
239322
|
-
const paragraphText = text5.length > 0 ? editor.schema
|
|
239403
|
+
const paragraphText = text5.length > 0 ? buildTextWithTabs(editor.schema, text5, undefined) : null;
|
|
239323
239404
|
const updatedParagraph = paragraph2?.type.create(paragraph2.attrs ?? null, paragraphText, paragraph2.marks) ?? null;
|
|
239324
239405
|
const updatedNode = resolved.node.type.create({ ...resolved.node.attrs }, updatedParagraph, resolved.node.marks);
|
|
239325
239406
|
const { tr } = editor.state;
|
|
@@ -239788,26 +239869,20 @@ function prependContentWrapper(editor, input2, options) {
|
|
|
239788
239869
|
return replaceSdtTextContent(editor, input2.target, input2.content + currentText);
|
|
239789
239870
|
});
|
|
239790
239871
|
}
|
|
239872
|
+
function insertTextAroundSdt(editor, target, content3, resolvePos) {
|
|
239873
|
+
const pos = resolvePos(resolveSdtByTarget(editor.state.doc, target));
|
|
239874
|
+
const { tr } = editor.state;
|
|
239875
|
+
const tabType = editor.schema.nodes?.tab;
|
|
239876
|
+
const parentAllowsTab = tabType && content3.includes("\t") ? parentAllowsNodeAt(tr, pos, tabType) : false;
|
|
239877
|
+
tr.insert(pos, buildTextWithTabs(editor.schema, content3, undefined, { parentAllowsTab }));
|
|
239878
|
+
dispatchTransaction(editor, tr);
|
|
239879
|
+
return true;
|
|
239880
|
+
}
|
|
239791
239881
|
function insertBeforeWrapper(editor, input2, options) {
|
|
239792
|
-
return executeSdtMutation(editor, buildTarget(resolveSdtByTarget(editor.state.doc, input2.target)), options, () =>
|
|
239793
|
-
const resolved = resolveSdtByTarget(editor.state.doc, input2.target);
|
|
239794
|
-
const textNode = editor.schema.text(input2.content);
|
|
239795
|
-
const { tr } = editor.state;
|
|
239796
|
-
tr.insert(resolved.pos, textNode);
|
|
239797
|
-
dispatchTransaction(editor, tr);
|
|
239798
|
-
return true;
|
|
239799
|
-
});
|
|
239882
|
+
return executeSdtMutation(editor, buildTarget(resolveSdtByTarget(editor.state.doc, input2.target)), options, () => insertTextAroundSdt(editor, input2.target, input2.content, (resolved) => resolved.pos));
|
|
239800
239883
|
}
|
|
239801
239884
|
function insertAfterWrapper(editor, input2, options) {
|
|
239802
|
-
return executeSdtMutation(editor, buildTarget(resolveSdtByTarget(editor.state.doc, input2.target)), options, () =>
|
|
239803
|
-
const resolved = resolveSdtByTarget(editor.state.doc, input2.target);
|
|
239804
|
-
const insertPos = resolved.pos + resolved.node.nodeSize;
|
|
239805
|
-
const textNode = editor.schema.text(input2.content);
|
|
239806
|
-
const { tr } = editor.state;
|
|
239807
|
-
tr.insert(insertPos, textNode);
|
|
239808
|
-
dispatchTransaction(editor, tr);
|
|
239809
|
-
return true;
|
|
239810
|
-
});
|
|
239885
|
+
return executeSdtMutation(editor, buildTarget(resolveSdtByTarget(editor.state.doc, input2.target)), options, () => insertTextAroundSdt(editor, input2.target, input2.content, (resolved) => resolved.pos + resolved.node.nodeSize));
|
|
239811
239886
|
}
|
|
239812
239887
|
function getBindingWrapper(editor, input2) {
|
|
239813
239888
|
return resolveBinding(resolveSdtByTarget(editor.state.doc, input2.target).node.attrs) ?? null;
|
|
@@ -242996,8 +243071,13 @@ function captionsInsertWrapper(editor, input2, options) {
|
|
|
242996
243071
|
resolvedNumber: "",
|
|
242997
243072
|
sdBlockId: `seq-${Date.now()}`
|
|
242998
243073
|
}));
|
|
242999
|
-
if (input2.text)
|
|
243000
|
-
|
|
243074
|
+
if (input2.text) {
|
|
243075
|
+
const captionContent = buildTextWithTabs(schema, `: ${input2.text}`, undefined);
|
|
243076
|
+
if (captionContent instanceof Fragment)
|
|
243077
|
+
captionContent.forEach((child) => children.push(child));
|
|
243078
|
+
else
|
|
243079
|
+
children.push(captionContent);
|
|
243080
|
+
}
|
|
243001
243081
|
const captionParagraph = schema.nodes.paragraph.create(buildCaptionParagraphAttrs(nodeId), children);
|
|
243002
243082
|
const { tr } = editor.state;
|
|
243003
243083
|
tr.insert(pos, captionParagraph);
|
|
@@ -243033,7 +243113,7 @@ function captionsUpdateWrapper(editor, input2, options) {
|
|
|
243033
243113
|
const contentEnd = resolved.pos + captionNode.nodeSize - 1;
|
|
243034
243114
|
const newText = input2.patch.text ? `: ${input2.patch.text}` : "";
|
|
243035
243115
|
if (newText)
|
|
243036
|
-
tr.replaceWith(trailingTextStart, contentEnd, editor.schema
|
|
243116
|
+
tr.replaceWith(trailingTextStart, contentEnd, buildTextWithTabs(editor.schema, newText, undefined));
|
|
243037
243117
|
else
|
|
243038
243118
|
tr.delete(trailingTextStart, contentEnd);
|
|
243039
243119
|
editor.dispatch(tr);
|
|
@@ -259914,6 +259994,11 @@ function getCommentHighlightThreadIds(target) {
|
|
|
259914
259994
|
function isDirectSingleCommentHighlightHit(target) {
|
|
259915
259995
|
return getCommentHighlightThreadIds(target).length === 1;
|
|
259916
259996
|
}
|
|
259997
|
+
function isDirectTrackedChangeHit(target) {
|
|
259998
|
+
if (!(target instanceof Element))
|
|
259999
|
+
return false;
|
|
260000
|
+
return target.closest(TRACK_CHANGE_SELECTOR) != null;
|
|
260001
|
+
}
|
|
259917
260002
|
function resolveTrackChangeThreadId(target) {
|
|
259918
260003
|
if (!(target instanceof Element))
|
|
259919
260004
|
return null;
|
|
@@ -259986,7 +260071,7 @@ function getActiveCommentThreadId(editor) {
|
|
|
259986
260071
|
function shouldIgnoreRepeatClickOnActiveComment(target, clientX, clientY, activeThreadId) {
|
|
259987
260072
|
if (!activeThreadId)
|
|
259988
260073
|
return false;
|
|
259989
|
-
if (isDirectSingleCommentHighlightHit(target))
|
|
260074
|
+
if (isDirectSingleCommentHighlightHit(target) || isDirectTrackedChangeHit(target))
|
|
259990
260075
|
return false;
|
|
259991
260076
|
return resolveCommentThreadIdNearPointer(target, clientX, clientY) === activeThreadId;
|
|
259992
260077
|
}
|
|
@@ -266932,10 +267017,10 @@ var Node$13 = class Node$14 {
|
|
|
266932
267017
|
...paraId ? { paraId } : undefined
|
|
266933
267018
|
};
|
|
266934
267019
|
const normalizedText = typeof text5 === "string" ? text5 : "";
|
|
266935
|
-
const
|
|
267020
|
+
const content3 = normalizedText.length > 0 ? buildTextWithTabs(state.schema, normalizedText, undefined) : null;
|
|
266936
267021
|
let paragraphNode;
|
|
266937
267022
|
try {
|
|
266938
|
-
paragraphNode = paragraphType.createAndFill(attrs,
|
|
267023
|
+
paragraphNode = paragraphType.createAndFill(attrs, content3 ?? undefined) ?? paragraphType.create(attrs, content3 ?? undefined);
|
|
266939
267024
|
} catch {
|
|
266940
267025
|
return false;
|
|
266941
267026
|
}
|
|
@@ -266975,10 +267060,10 @@ var Node$13 = class Node$14 {
|
|
|
266975
267060
|
}
|
|
266976
267061
|
};
|
|
266977
267062
|
const normalizedText = typeof text5 === "string" ? text5 : "";
|
|
266978
|
-
const
|
|
267063
|
+
const content3 = normalizedText.length > 0 ? buildTextWithTabs(state.schema, normalizedText, undefined) : null;
|
|
266979
267064
|
let paragraphNode;
|
|
266980
267065
|
try {
|
|
266981
|
-
paragraphNode = paragraphType.createAndFill(attrs,
|
|
267066
|
+
paragraphNode = paragraphType.createAndFill(attrs, content3 ?? undefined) ?? paragraphType.create(attrs, content3 ?? undefined);
|
|
266982
267067
|
} catch {
|
|
266983
267068
|
return false;
|
|
266984
267069
|
}
|
|
@@ -267504,10 +267589,10 @@ var Node$13 = class Node$14 {
|
|
|
267504
267589
|
numberingProperties: newParagraphProperties.numberingProperties
|
|
267505
267590
|
};
|
|
267506
267591
|
const normalizedText = typeof text5 === "string" ? text5 : "";
|
|
267507
|
-
const
|
|
267592
|
+
const content3 = normalizedText.length > 0 ? buildTextWithTabs(state.schema, normalizedText, undefined) : undefined;
|
|
267508
267593
|
let paragraphNode;
|
|
267509
267594
|
try {
|
|
267510
|
-
paragraphNode = paragraphType.createAndFill(attrs,
|
|
267595
|
+
paragraphNode = paragraphType.createAndFill(attrs, content3) ?? paragraphType.create(attrs, content3 ?? undefined);
|
|
267511
267596
|
} catch {
|
|
267512
267597
|
return false;
|
|
267513
267598
|
}
|
|
@@ -288182,7 +288267,7 @@ menclose::after {
|
|
|
288182
288267
|
return true;
|
|
288183
288268
|
}
|
|
288184
288269
|
#handleSingleCommentHighlightClick(event, target, editor) {
|
|
288185
|
-
if (isDirectSingleCommentHighlightHit(target))
|
|
288270
|
+
if (isDirectSingleCommentHighlightHit(target) || isDirectTrackedChangeHit(target))
|
|
288186
288271
|
return false;
|
|
288187
288272
|
const clickedThreadId = resolveCommentThreadIdNearPointer(target, event.clientX, event.clientY);
|
|
288188
288273
|
if (!clickedThreadId)
|
|
@@ -290543,12 +290628,12 @@ menclose::after {
|
|
|
290543
290628
|
return;
|
|
290544
290629
|
console.log(...args$1);
|
|
290545
290630
|
}, 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;
|
|
290546
|
-
var
|
|
290631
|
+
var init_src_VLovL2KJ_es = __esm(() => {
|
|
290547
290632
|
init_rolldown_runtime_Bg48TavK_es();
|
|
290548
|
-
|
|
290633
|
+
init_SuperConverter_t_W4yNkb_es();
|
|
290549
290634
|
init_jszip_C49i9kUs_es();
|
|
290550
290635
|
init_uuid_qzgm05fK_es();
|
|
290551
|
-
|
|
290636
|
+
init_create_headless_toolbar_DfA3CPoa_es();
|
|
290552
290637
|
init_constants_CGhJRd87_es();
|
|
290553
290638
|
init_dist_B8HfvhaK_es();
|
|
290554
290639
|
init_unified_Dsuw2be5_es();
|
|
@@ -325441,11 +325526,11 @@ var init_zipper_DbkgrypV_es = __esm(() => {
|
|
|
325441
325526
|
|
|
325442
325527
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
325443
325528
|
var init_super_editor_es = __esm(() => {
|
|
325444
|
-
|
|
325445
|
-
|
|
325529
|
+
init_src_VLovL2KJ_es();
|
|
325530
|
+
init_SuperConverter_t_W4yNkb_es();
|
|
325446
325531
|
init_jszip_C49i9kUs_es();
|
|
325447
325532
|
init_xml_js_CqGKpaft_es();
|
|
325448
|
-
|
|
325533
|
+
init_create_headless_toolbar_DfA3CPoa_es();
|
|
325449
325534
|
init_constants_CGhJRd87_es();
|
|
325450
325535
|
init_dist_B8HfvhaK_es();
|
|
325451
325536
|
init_unified_Dsuw2be5_es();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.8.0-next.
|
|
3
|
+
"version": "0.8.0-next.3",
|
|
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/
|
|
28
|
+
"@superdoc/pm-adapter": "0.0.0",
|
|
29
29
|
"superdoc": "1.27.0",
|
|
30
|
-
"@superdoc/
|
|
30
|
+
"@superdoc/super-editor": "0.0.1"
|
|
31
31
|
},
|
|
32
32
|
"module": "src/index.ts",
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
|
-
"@superdoc-dev/cli-darwin-arm64": "0.8.0-next.
|
|
38
|
-
"@superdoc-dev/cli-darwin-x64": "0.8.0-next.
|
|
39
|
-
"@superdoc-dev/cli-linux-
|
|
40
|
-
"@superdoc-dev/cli-linux-
|
|
41
|
-
"@superdoc-dev/cli-windows-x64": "0.8.0-next.
|
|
37
|
+
"@superdoc-dev/cli-darwin-arm64": "0.8.0-next.3",
|
|
38
|
+
"@superdoc-dev/cli-darwin-x64": "0.8.0-next.3",
|
|
39
|
+
"@superdoc-dev/cli-linux-arm64": "0.8.0-next.3",
|
|
40
|
+
"@superdoc-dev/cli-linux-x64": "0.8.0-next.3",
|
|
41
|
+
"@superdoc-dev/cli-windows-x64": "0.8.0-next.3"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"predev": "node scripts/ensure-superdoc-build.js",
|