@superdoc-dev/mcp 0.3.0-next.5 → 0.3.0-next.7
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 +393 -46
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -90248,11 +90248,14 @@ var init_contract = __esm(() => {
|
|
|
90248
90248
|
oneOf: [
|
|
90249
90249
|
{
|
|
90250
90250
|
const: "resolved"
|
|
90251
|
+
},
|
|
90252
|
+
{
|
|
90253
|
+
const: "active"
|
|
90251
90254
|
}
|
|
90252
90255
|
],
|
|
90253
|
-
description: "Set comment status. Use 'resolved' to
|
|
90256
|
+
description: "Set comment status. Use 'resolved' to resolve a comment, or 'active' to reopen a previously resolved comment (lifecycle inverse)."
|
|
90254
90257
|
},
|
|
90255
|
-
description: "Set comment status. Use 'resolved' to
|
|
90258
|
+
description: "Set comment status. Use 'resolved' to resolve a comment, or 'active' to reopen a previously resolved comment (lifecycle inverse)."
|
|
90256
90259
|
},
|
|
90257
90260
|
{
|
|
90258
90261
|
name: "isInternal",
|
|
@@ -90304,9 +90307,10 @@ var init_contract = __esm(() => {
|
|
|
90304
90307
|
},
|
|
90305
90308
|
status: {
|
|
90306
90309
|
enum: [
|
|
90307
|
-
"resolved"
|
|
90310
|
+
"resolved",
|
|
90311
|
+
"active"
|
|
90308
90312
|
],
|
|
90309
|
-
description: "Set comment status. Use 'resolved' to
|
|
90313
|
+
description: "Set comment status. Use 'resolved' to resolve a comment, or 'active' to reopen a previously resolved comment (lifecycle inverse)."
|
|
90310
90314
|
},
|
|
90311
90315
|
isInternal: {
|
|
90312
90316
|
type: "boolean",
|
|
@@ -93202,6 +93206,18 @@ var init_contract = __esm(() => {
|
|
|
93202
93206
|
type: "string"
|
|
93203
93207
|
}
|
|
93204
93208
|
},
|
|
93209
|
+
activeCommentIds: {
|
|
93210
|
+
type: "array",
|
|
93211
|
+
items: {
|
|
93212
|
+
type: "string"
|
|
93213
|
+
}
|
|
93214
|
+
},
|
|
93215
|
+
activeChangeIds: {
|
|
93216
|
+
type: "array",
|
|
93217
|
+
items: {
|
|
93218
|
+
type: "string"
|
|
93219
|
+
}
|
|
93220
|
+
},
|
|
93205
93221
|
text: {
|
|
93206
93222
|
type: "string"
|
|
93207
93223
|
}
|
|
@@ -93210,7 +93226,9 @@ var init_contract = __esm(() => {
|
|
|
93210
93226
|
required: [
|
|
93211
93227
|
"empty",
|
|
93212
93228
|
"target",
|
|
93213
|
-
"activeMarks"
|
|
93229
|
+
"activeMarks",
|
|
93230
|
+
"activeCommentIds",
|
|
93231
|
+
"activeChangeIds"
|
|
93214
93232
|
]
|
|
93215
93233
|
}
|
|
93216
93234
|
},
|
|
@@ -204772,7 +204790,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
|
|
|
204772
204790
|
emptyOptions2 = {};
|
|
204773
204791
|
});
|
|
204774
204792
|
|
|
204775
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
204793
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-BtMpBQnx.es.js
|
|
204776
204794
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
204777
204795
|
const fieldValue = extension$1.config[field];
|
|
204778
204796
|
if (typeof fieldValue === "function")
|
|
@@ -207559,8 +207577,8 @@ function validatePatchCommentInput(input) {
|
|
|
207559
207577
|
field: "text",
|
|
207560
207578
|
value: text$2
|
|
207561
207579
|
});
|
|
207562
|
-
if (status !== undefined && status !== "resolved")
|
|
207563
|
-
throw new DocumentApiValidationError("INVALID_INPUT", `status must be "resolved", got "${String(status)}".`, {
|
|
207580
|
+
if (status !== undefined && status !== "resolved" && status !== "active")
|
|
207581
|
+
throw new DocumentApiValidationError("INVALID_INPUT", `status must be "resolved" or "active", got "${String(status)}".`, {
|
|
207564
207582
|
field: "status",
|
|
207565
207583
|
value: status
|
|
207566
207584
|
});
|
|
@@ -207598,6 +207616,8 @@ function executeCommentsPatch(adapter, input, options) {
|
|
|
207598
207616
|
}, options);
|
|
207599
207617
|
if (input.status === "resolved")
|
|
207600
207618
|
return adapter.resolve({ commentId: input.commentId }, options);
|
|
207619
|
+
if (input.status === "active")
|
|
207620
|
+
return adapter.reopen({ commentId: input.commentId }, options);
|
|
207601
207621
|
if (input.isInternal !== undefined)
|
|
207602
207622
|
return adapter.setInternal({
|
|
207603
207623
|
commentId: input.commentId,
|
|
@@ -257177,7 +257197,7 @@ var isRegExp = (value) => {
|
|
|
257177
257197
|
state.kern = kernNode.attributes["w:val"];
|
|
257178
257198
|
}
|
|
257179
257199
|
}, SuperConverter;
|
|
257180
|
-
var
|
|
257200
|
+
var init_SuperConverter_BtMpBQnx_es = __esm(() => {
|
|
257181
257201
|
init_rolldown_runtime_Bg48TavK_es();
|
|
257182
257202
|
init_jszip_C49i9kUs_es();
|
|
257183
257203
|
init_xml_js_CqGKpaft_es();
|
|
@@ -269627,8 +269647,8 @@ var init_SuperConverter_lmyr0gmB_es = __esm(() => {
|
|
|
269627
269647
|
},
|
|
269628
269648
|
target: textAddressSchema,
|
|
269629
269649
|
status: {
|
|
269630
|
-
enum: ["resolved"],
|
|
269631
|
-
description: "Set comment status. Use 'resolved' to
|
|
269650
|
+
enum: ["resolved", "active"],
|
|
269651
|
+
description: "Set comment status. Use 'resolved' to resolve a comment, or 'active' to reopen a previously resolved comment (lifecycle inverse)."
|
|
269632
269652
|
},
|
|
269633
269653
|
isInternal: {
|
|
269634
269654
|
type: "boolean",
|
|
@@ -270067,11 +270087,15 @@ var init_SuperConverter_lmyr0gmB_es = __esm(() => {
|
|
|
270067
270087
|
empty: { type: "boolean" },
|
|
270068
270088
|
target: { oneOf: [textTargetSchema, { type: "null" }] },
|
|
270069
270089
|
activeMarks: arraySchema({ type: "string" }),
|
|
270090
|
+
activeCommentIds: arraySchema({ type: "string" }),
|
|
270091
|
+
activeChangeIds: arraySchema({ type: "string" }),
|
|
270070
270092
|
text: { type: "string" }
|
|
270071
270093
|
}, [
|
|
270072
270094
|
"empty",
|
|
270073
270095
|
"target",
|
|
270074
|
-
"activeMarks"
|
|
270096
|
+
"activeMarks",
|
|
270097
|
+
"activeCommentIds",
|
|
270098
|
+
"activeChangeIds"
|
|
270075
270099
|
])
|
|
270076
270100
|
},
|
|
270077
270101
|
"mutations.preview": {
|
|
@@ -294776,7 +294800,7 @@ var init_SuperConverter_lmyr0gmB_es = __esm(() => {
|
|
|
294776
294800
|
};
|
|
294777
294801
|
});
|
|
294778
294802
|
|
|
294779
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
294803
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-FOTAKCop.es.js
|
|
294780
294804
|
function parseSizeUnit(val = "0") {
|
|
294781
294805
|
const length = val.toString() || "0";
|
|
294782
294806
|
const value = Number.parseFloat(length);
|
|
@@ -297398,8 +297422,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
|
|
|
297398
297422
|
}
|
|
297399
297423
|
};
|
|
297400
297424
|
};
|
|
297401
|
-
var
|
|
297402
|
-
|
|
297425
|
+
var init_create_headless_toolbar_FOTAKCop_es = __esm(() => {
|
|
297426
|
+
init_SuperConverter_BtMpBQnx_es();
|
|
297403
297427
|
init_constants_DrU4EASo_es();
|
|
297404
297428
|
init_dist_B8HfvhaK_es();
|
|
297405
297429
|
CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
|
|
@@ -351608,7 +351632,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
351608
351632
|
init_remark_gfm_BhnWr3yf_es();
|
|
351609
351633
|
});
|
|
351610
351634
|
|
|
351611
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
351635
|
+
// ../../packages/superdoc/dist/chunks/src-XFPz5mDi.es.js
|
|
351612
351636
|
function deleteProps(obj, propOrProps) {
|
|
351613
351637
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
351614
351638
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -360517,7 +360541,7 @@ function getMarksDiff(marksA = [], marksB = []) {
|
|
|
360517
360541
|
if (!attrs)
|
|
360518
360542
|
return {};
|
|
360519
360543
|
const ignoredMarkKeys = /* @__PURE__ */ new Set;
|
|
360520
|
-
if (TRACK_CHANGE_MARK_NAMES.has(markName))
|
|
360544
|
+
if (TRACK_CHANGE_MARK_NAMES$1.has(markName))
|
|
360521
360545
|
for (const key2 of TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS)
|
|
360522
360546
|
ignoredMarkKeys.add(key2);
|
|
360523
360547
|
const normalized = {};
|
|
@@ -373988,6 +374012,50 @@ function resolveCommentHandler(editor, input2, options) {
|
|
|
373988
374012
|
updated: [toCommentAddress(identity.commentId)]
|
|
373989
374013
|
};
|
|
373990
374014
|
}
|
|
374015
|
+
function reopenCommentHandler(editor, input2, options) {
|
|
374016
|
+
const reopenComment = requireEditorCommand(editor.commands?.reopenComment, "comments.patch (reopenComment)");
|
|
374017
|
+
const store = getCommentEntityStore(editor);
|
|
374018
|
+
const identity = resolveCommentIdentity(editor, input2.commentId);
|
|
374019
|
+
const existing = findCommentEntity(store, identity.commentId);
|
|
374020
|
+
const isAnchored = identity.anchors.length > 0;
|
|
374021
|
+
const isResolvedInStore = existing ? isCommentResolved(existing) : false;
|
|
374022
|
+
const isResolvedInDoc = isAnchored && identity.anchors.every((a2) => a2.status === "resolved");
|
|
374023
|
+
if (!isResolvedInStore && !isResolvedInDoc)
|
|
374024
|
+
return {
|
|
374025
|
+
success: false,
|
|
374026
|
+
failure: {
|
|
374027
|
+
code: "NO_OP",
|
|
374028
|
+
message: "Comment is already active."
|
|
374029
|
+
}
|
|
374030
|
+
};
|
|
374031
|
+
const storedInternal = existing?.isInternal;
|
|
374032
|
+
const internalOverride = typeof storedInternal === "boolean" ? storedInternal : undefined;
|
|
374033
|
+
if (executeDomainCommand(editor, () => {
|
|
374034
|
+
const didReopen = reopenComment({
|
|
374035
|
+
commentId: identity.commentId,
|
|
374036
|
+
importedId: identity.importedId,
|
|
374037
|
+
internal: internalOverride
|
|
374038
|
+
});
|
|
374039
|
+
if (didReopen)
|
|
374040
|
+
upsertCommentEntity(store, identity.commentId, {
|
|
374041
|
+
importedId: identity.importedId,
|
|
374042
|
+
isDone: false,
|
|
374043
|
+
resolvedTime: null
|
|
374044
|
+
});
|
|
374045
|
+
return Boolean(didReopen);
|
|
374046
|
+
}, { expectedRevision: options?.expectedRevision }).steps[0]?.effect !== "changed")
|
|
374047
|
+
return {
|
|
374048
|
+
success: false,
|
|
374049
|
+
failure: {
|
|
374050
|
+
code: "NO_OP",
|
|
374051
|
+
message: "Comment reopen produced no change."
|
|
374052
|
+
}
|
|
374053
|
+
};
|
|
374054
|
+
return {
|
|
374055
|
+
success: true,
|
|
374056
|
+
updated: [toCommentAddress(identity.commentId)]
|
|
374057
|
+
};
|
|
374058
|
+
}
|
|
373991
374059
|
function removeCommentHandler(editor, input2, options) {
|
|
373992
374060
|
const removeComment = requireEditorCommand(editor.commands?.removeComment, "comments.remove (removeComment)");
|
|
373993
374061
|
const store = getCommentEntityStore(editor);
|
|
@@ -374142,6 +374210,7 @@ function createCommentsWrapper(editor) {
|
|
|
374142
374210
|
reply: (input2, options) => replyToCommentHandler(editor, input2, options),
|
|
374143
374211
|
move: (input2, options) => moveCommentHandler(editor, input2, options),
|
|
374144
374212
|
resolve: (input2, options) => resolveCommentHandler(editor, input2, options),
|
|
374213
|
+
reopen: (input2, options) => reopenCommentHandler(editor, input2, options),
|
|
374145
374214
|
remove: (input2, options) => removeCommentHandler(editor, input2, options),
|
|
374146
374215
|
setInternal: (input2, options) => setCommentInternalHandler(editor, input2, options),
|
|
374147
374216
|
setActive: (input2, options) => setCommentActiveHandler(editor, input2, options),
|
|
@@ -378600,14 +378669,21 @@ function resolveCurrentSelectionInfo(editor, input2) {
|
|
|
378600
378669
|
return {
|
|
378601
378670
|
empty: true,
|
|
378602
378671
|
target: null,
|
|
378603
|
-
activeMarks: []
|
|
378672
|
+
activeMarks: [],
|
|
378673
|
+
activeCommentIds: [],
|
|
378674
|
+
activeChangeIds: []
|
|
378604
378675
|
};
|
|
378605
378676
|
const { from: from$1, to, empty: empty$1 } = state.selection;
|
|
378606
378677
|
const segments = collectTextSegments(state.doc, from$1, to);
|
|
378678
|
+
const target = segments && segments.length > 0 ? buildTextTarget(segments) : null;
|
|
378679
|
+
const activeMarks = collectActiveMarks(state, from$1, to);
|
|
378680
|
+
const { commentIds: activeCommentIds, changeIds: activeChangeRawIds } = collectActiveEntityIds(state, from$1, to);
|
|
378607
378681
|
const info = {
|
|
378608
378682
|
empty: empty$1,
|
|
378609
|
-
target
|
|
378610
|
-
activeMarks
|
|
378683
|
+
target,
|
|
378684
|
+
activeMarks,
|
|
378685
|
+
activeCommentIds,
|
|
378686
|
+
activeChangeIds: mapRawChangeIdsToCanonical(editor, activeChangeRawIds)
|
|
378611
378687
|
};
|
|
378612
378688
|
if (input2.includeText && !empty$1)
|
|
378613
378689
|
info.text = state.doc.textBetween(from$1, to, " ");
|
|
@@ -378656,6 +378732,68 @@ function readBlockId(node2) {
|
|
|
378656
378732
|
const id2 = attrs.sdBlockId ?? attrs.id ?? attrs.blockId;
|
|
378657
378733
|
return typeof id2 === "string" && id2.length > 0 ? id2 : null;
|
|
378658
378734
|
}
|
|
378735
|
+
function mapRawChangeIdsToCanonical(editor, rawIds) {
|
|
378736
|
+
if (rawIds.length === 0)
|
|
378737
|
+
return rawIds;
|
|
378738
|
+
let grouped;
|
|
378739
|
+
try {
|
|
378740
|
+
grouped = groupTrackedChanges(editor);
|
|
378741
|
+
} catch {
|
|
378742
|
+
return [];
|
|
378743
|
+
}
|
|
378744
|
+
const rawToCanonical = /* @__PURE__ */ new Map;
|
|
378745
|
+
for (const change of grouped)
|
|
378746
|
+
rawToCanonical.set(change.rawId, change.id);
|
|
378747
|
+
const seen = /* @__PURE__ */ new Set;
|
|
378748
|
+
const out = [];
|
|
378749
|
+
for (const raw of rawIds) {
|
|
378750
|
+
const canonical = rawToCanonical.get(raw);
|
|
378751
|
+
if (!canonical)
|
|
378752
|
+
continue;
|
|
378753
|
+
if (seen.has(canonical))
|
|
378754
|
+
continue;
|
|
378755
|
+
seen.add(canonical);
|
|
378756
|
+
out.push(canonical);
|
|
378757
|
+
}
|
|
378758
|
+
return out;
|
|
378759
|
+
}
|
|
378760
|
+
function collectActiveEntityIds(state, from$1, to) {
|
|
378761
|
+
const commentIds = /* @__PURE__ */ new Set;
|
|
378762
|
+
const changeIds = /* @__PURE__ */ new Set;
|
|
378763
|
+
const collectFromMark = (markType, attrs) => {
|
|
378764
|
+
if (markType === COMMENT_MARK_NAME2) {
|
|
378765
|
+
const id2 = resolveCommentIdFromAttrs(attrs ?? {});
|
|
378766
|
+
if (typeof id2 === "string" && id2.length > 0)
|
|
378767
|
+
commentIds.add(id2);
|
|
378768
|
+
} else if (TRACK_CHANGE_MARK_NAMES.has(markType)) {
|
|
378769
|
+
const id2 = attrs?.id;
|
|
378770
|
+
if (typeof id2 === "string" && id2.length > 0)
|
|
378771
|
+
changeIds.add(id2);
|
|
378772
|
+
}
|
|
378773
|
+
};
|
|
378774
|
+
if (from$1 === to) {
|
|
378775
|
+
if (state.storedMarks)
|
|
378776
|
+
for (const mark2 of state.storedMarks)
|
|
378777
|
+
collectFromMark(mark2.type.name, mark2.attrs);
|
|
378778
|
+
const $pos = state.doc.resolve(from$1);
|
|
378779
|
+
for (const mark2 of $pos.marks())
|
|
378780
|
+
collectFromMark(mark2.type.name, mark2.attrs);
|
|
378781
|
+
} else
|
|
378782
|
+
state.doc.nodesBetween(from$1, to, (node2, pos) => {
|
|
378783
|
+
if (!node2.isText)
|
|
378784
|
+
return true;
|
|
378785
|
+
const start$1 = Math.max(pos, from$1);
|
|
378786
|
+
if (Math.min(pos + node2.nodeSize, to) <= start$1)
|
|
378787
|
+
return false;
|
|
378788
|
+
for (const mark2 of node2.marks)
|
|
378789
|
+
collectFromMark(mark2.type.name, mark2.attrs);
|
|
378790
|
+
return false;
|
|
378791
|
+
});
|
|
378792
|
+
return {
|
|
378793
|
+
commentIds: Array.from(commentIds),
|
|
378794
|
+
changeIds: Array.from(changeIds)
|
|
378795
|
+
};
|
|
378796
|
+
}
|
|
378659
378797
|
function collectActiveMarks(state, from$1, to) {
|
|
378660
378798
|
const names = /* @__PURE__ */ new Set;
|
|
378661
378799
|
const stored = state.storedMarks;
|
|
@@ -378710,7 +378848,9 @@ function selectionInfoKey(info) {
|
|
|
378710
378848
|
else
|
|
378711
378849
|
targetKey = target.segments.map((s2) => `${s2.blockId}:${s2.range.start}-${s2.range.end}`).join("|");
|
|
378712
378850
|
const marks = [...info.activeMarks].sort().join(",");
|
|
378713
|
-
|
|
378851
|
+
const comments = [...info.activeCommentIds].sort().join(",");
|
|
378852
|
+
const changes = [...info.activeChangeIds].sort().join(",");
|
|
378853
|
+
return `${info.empty ? "1" : "0"}:${targetKey}:${marks}:c=${comments}:tc=${changes}`;
|
|
378714
378854
|
}
|
|
378715
378855
|
function markTypesPresentEverywhere(doc$12, from$1, to) {
|
|
378716
378856
|
let common = null;
|
|
@@ -416301,6 +416441,75 @@ var Node$13 = class Node$14 {
|
|
|
416301
416441
|
});
|
|
416302
416442
|
dispatch(tr);
|
|
416303
416443
|
return true;
|
|
416444
|
+
}, getCommentRangeAnchorsById = (commentId, doc$12, importedId) => {
|
|
416445
|
+
const anchors = [];
|
|
416446
|
+
doc$12.descendants((node2, pos) => {
|
|
416447
|
+
const typeName = node2.type?.name;
|
|
416448
|
+
if (typeName !== "commentRangeStart" && typeName !== "commentRangeEnd")
|
|
416449
|
+
return;
|
|
416450
|
+
const wid = node2.attrs?.["w:id"];
|
|
416451
|
+
if (wid !== commentId && (!importedId || wid !== importedId))
|
|
416452
|
+
return;
|
|
416453
|
+
anchors.push({
|
|
416454
|
+
pos,
|
|
416455
|
+
type: typeName === "commentRangeStart" ? "start" : "end",
|
|
416456
|
+
internal: !!node2.attrs?.internal
|
|
416457
|
+
});
|
|
416458
|
+
});
|
|
416459
|
+
const pairs = [];
|
|
416460
|
+
const stack = [];
|
|
416461
|
+
for (const anchor of anchors) {
|
|
416462
|
+
if (anchor.type === "start") {
|
|
416463
|
+
stack.push({
|
|
416464
|
+
pos: anchor.pos,
|
|
416465
|
+
internal: anchor.internal
|
|
416466
|
+
});
|
|
416467
|
+
continue;
|
|
416468
|
+
}
|
|
416469
|
+
const opener = stack.shift();
|
|
416470
|
+
if (!opener)
|
|
416471
|
+
continue;
|
|
416472
|
+
pairs.push({
|
|
416473
|
+
from: opener.pos,
|
|
416474
|
+
to: anchor.pos,
|
|
416475
|
+
internal: opener.internal
|
|
416476
|
+
});
|
|
416477
|
+
}
|
|
416478
|
+
return {
|
|
416479
|
+
pairs,
|
|
416480
|
+
anchorNodePositions: anchors.map((a2) => a2.pos)
|
|
416481
|
+
};
|
|
416482
|
+
}, reopenCommentById = ({ commentId, importedId, internal, state, tr, dispatch }) => {
|
|
416483
|
+
const { schema } = state;
|
|
416484
|
+
const markType = schema.marks?.[CommentMarkName];
|
|
416485
|
+
if (!markType)
|
|
416486
|
+
return false;
|
|
416487
|
+
const { pairs, anchorNodePositions } = getCommentRangeAnchorsById(commentId, state.doc, importedId);
|
|
416488
|
+
if (!pairs.length)
|
|
416489
|
+
return false;
|
|
416490
|
+
pairs.forEach(({ from: from$1, to, internal: anchorInternal }) => {
|
|
416491
|
+
const mappedFrom = tr.mapping.map(from$1);
|
|
416492
|
+
const mappedTo = tr.mapping.map(to);
|
|
416493
|
+
if (mappedTo <= mappedFrom)
|
|
416494
|
+
return;
|
|
416495
|
+
const attrs = {
|
|
416496
|
+
commentId,
|
|
416497
|
+
importedId,
|
|
416498
|
+
internal: typeof internal === "boolean" ? internal : anchorInternal
|
|
416499
|
+
};
|
|
416500
|
+
tr.addMark(mappedFrom + 1, mappedTo, markType.create(attrs));
|
|
416501
|
+
});
|
|
416502
|
+
anchorNodePositions.map((pos) => tr.mapping.map(pos)).sort((a2, b$1) => b$1 - a2).forEach((pos) => {
|
|
416503
|
+
const node2 = tr.doc.nodeAt(pos);
|
|
416504
|
+
if (!node2)
|
|
416505
|
+
return;
|
|
416506
|
+
const typeName = node2.type?.name;
|
|
416507
|
+
if (typeName !== "commentRangeStart" && typeName !== "commentRangeEnd")
|
|
416508
|
+
return;
|
|
416509
|
+
tr.delete(pos, pos + node2.nodeSize);
|
|
416510
|
+
});
|
|
416511
|
+
dispatch(tr);
|
|
416512
|
+
return true;
|
|
416304
416513
|
}, prepareCommentsForExport = (doc$12, tr, schema, comments = []) => {
|
|
416305
416514
|
const commentMap = /* @__PURE__ */ new Map;
|
|
416306
416515
|
comments.forEach((c) => {
|
|
@@ -421961,7 +422170,7 @@ var Node$13 = class Node$14 {
|
|
|
421961
422170
|
id: { default: null },
|
|
421962
422171
|
edGrp: { default: null },
|
|
421963
422172
|
displacedByCustomXml: { default: null }
|
|
421964
|
-
}), PermEnd, PermEndBlock, IGNORED_ATTRIBUTE_KEYS, TRACK_CHANGE_MARK_NAMES, TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS, VOLATILE_PARAGRAPH_ATTRS, VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS, SIMILARITY_THRESHOLD = 0.65, MIN_LENGTH_FOR_SIMILARITY = 4, COMMENT_ATTRS_DIFF_IGNORED_KEYS, SLOT_VARIANTS, PART_KINDS, DOCUMENT_RELS_PATH$2 = "word/_rels/document.xml.rels", DOCUMENT_RELS_PATH$1 = "word/_rels/document.xml.rels", BODY_RELATIONSHIP_EXCLUSIONS, setNestedValue = (target, path5, value) => {
|
|
422173
|
+
}), PermEnd, PermEndBlock, IGNORED_ATTRIBUTE_KEYS, TRACK_CHANGE_MARK_NAMES$1, TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS, VOLATILE_PARAGRAPH_ATTRS, VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS, SIMILARITY_THRESHOLD = 0.65, MIN_LENGTH_FOR_SIMILARITY = 4, COMMENT_ATTRS_DIFF_IGNORED_KEYS, SLOT_VARIANTS, PART_KINDS, DOCUMENT_RELS_PATH$2 = "word/_rels/document.xml.rels", DOCUMENT_RELS_PATH$1 = "word/_rels/document.xml.rels", BODY_RELATIONSHIP_EXCLUSIONS, setNestedValue = (target, path5, value) => {
|
|
421965
422174
|
if (!path5.includes(".")) {
|
|
421966
422175
|
target[path5] = value;
|
|
421967
422176
|
return;
|
|
@@ -424876,7 +425085,7 @@ var Node$13 = class Node$14 {
|
|
|
424876
425085
|
listener(snapshot2);
|
|
424877
425086
|
} catch {}
|
|
424878
425087
|
}
|
|
424879
|
-
}, TRACK_MARK_TYPE_BY_NAME, EMITTABLE_BLOCK_TYPES, SDT_BLOCK_NODE_NAMES, REQUIRED_COMMANDS, VALID_CAPABILITY_REASON_CODES, REQUIRED_HELPERS, SCHEMA_NODE_GATES, schemaGatedIds, SUPPORTED_NON_UNIFORM_STRATEGIES, SUPPORTED_SET_MARKS, REGEX_MAX_PATTERN_LENGTH = 1024, STYLES_PART = "word/styles.xml", PROPERTIES_KEY_BY_CHANNEL, XML_PATH_BY_CHANNEL, UNDERLINE_API_TO_STORAGE, UNDERLINE_STORAGE_TO_API, HEX_SUBKEYS_BY_PROPERTY, SUPPORTED_DELETE_NODE_TYPES2, REJECTED_DELETE_NODE_TYPES2, TEXT_PREVIEW_MAX_LENGTH = 80, RANGE_DELETE_SAFE_NODE_TYPES, HEADING_PATTERN, OOXML_DEFAULT_FONT_SIZE_PT = 10, INDENT_PER_LEVEL_TWIPS = 720, HANGING_INDENT_TWIPS = 360, SYMBOL_FONT_NAMES, RFONTS_FAMILY_ATTRS, ORDERED_PRESET_CONFIG, BULLET_PRESET_CONFIG, PRESET_TEMPLATES, LevelFormattingHelpers, PRESET_KIND_MAP, NUMBERING_PART = "word/numbering.xml", DEFAULT_PRESET_FOR_KIND, _setValueDelegate, PREVIEW_TEXT_MAX_LENGTH = 2000, BLOCK_PREVIEW_MAX_LENGTH = 200, EDGE_NODE_TYPES$1, POINTS_TO_PIXELS, POINTS_TO_TWIPS = 20, PIXELS_TO_TWIPS, DEFAULT_TABLE_GRID_WIDTH_TWIPS = 1500, SETTINGS_PART$1 = "word/settings.xml", WORD_DEFAULT_TBL_LOOK, FLAG_TO_OOXML_KEY, INVERTED_FLAGS, XML_KEY_TO_STYLE_OPTION, CLEARED_BORDER_OOXML, TABLE_MARGIN_KEY_GROUPS, TABLE_ADAPTER_DISPATCH, ROW_TARGETED_TABLE_OPS, registered = false, STYLES_PART_ID = "word/styles.xml", stylesPartDescriptor, settingsPartDescriptor, RELS_PART_ID2 = "word/_rels/document.xml.rels", RELS_XMLNS2 = "http://schemas.openxmlformats.org/package/2006/relationships", HEADER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", relsPartDescriptor, BatchHistoryAdapter = class {
|
|
425088
|
+
}, TRACK_MARK_TYPE_BY_NAME, EMITTABLE_BLOCK_TYPES, SDT_BLOCK_NODE_NAMES, REQUIRED_COMMANDS, VALID_CAPABILITY_REASON_CODES, REQUIRED_HELPERS, SCHEMA_NODE_GATES, schemaGatedIds, SUPPORTED_NON_UNIFORM_STRATEGIES, SUPPORTED_SET_MARKS, REGEX_MAX_PATTERN_LENGTH = 1024, STYLES_PART = "word/styles.xml", PROPERTIES_KEY_BY_CHANNEL, XML_PATH_BY_CHANNEL, UNDERLINE_API_TO_STORAGE, UNDERLINE_STORAGE_TO_API, HEX_SUBKEYS_BY_PROPERTY, SUPPORTED_DELETE_NODE_TYPES2, REJECTED_DELETE_NODE_TYPES2, TEXT_PREVIEW_MAX_LENGTH = 80, RANGE_DELETE_SAFE_NODE_TYPES, HEADING_PATTERN, OOXML_DEFAULT_FONT_SIZE_PT = 10, INDENT_PER_LEVEL_TWIPS = 720, HANGING_INDENT_TWIPS = 360, SYMBOL_FONT_NAMES, RFONTS_FAMILY_ATTRS, ORDERED_PRESET_CONFIG, BULLET_PRESET_CONFIG, PRESET_TEMPLATES, LevelFormattingHelpers, PRESET_KIND_MAP, NUMBERING_PART = "word/numbering.xml", DEFAULT_PRESET_FOR_KIND, _setValueDelegate, PREVIEW_TEXT_MAX_LENGTH = 2000, BLOCK_PREVIEW_MAX_LENGTH = 200, EDGE_NODE_TYPES$1, COMMENT_MARK_NAME2 = "commentMark", TRACK_CHANGE_MARK_NAMES, POINTS_TO_PIXELS, POINTS_TO_TWIPS = 20, PIXELS_TO_TWIPS, DEFAULT_TABLE_GRID_WIDTH_TWIPS = 1500, SETTINGS_PART$1 = "word/settings.xml", WORD_DEFAULT_TBL_LOOK, FLAG_TO_OOXML_KEY, INVERTED_FLAGS, XML_KEY_TO_STYLE_OPTION, CLEARED_BORDER_OOXML, TABLE_MARGIN_KEY_GROUPS, TABLE_ADAPTER_DISPATCH, ROW_TARGETED_TABLE_OPS, registered = false, STYLES_PART_ID = "word/styles.xml", stylesPartDescriptor, settingsPartDescriptor, RELS_PART_ID2 = "word/_rels/document.xml.rels", RELS_XMLNS2 = "http://schemas.openxmlformats.org/package/2006/relationships", HEADER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", relsPartDescriptor, BatchHistoryAdapter = class {
|
|
424880
425089
|
#done = [];
|
|
424881
425090
|
#redone = [];
|
|
424882
425091
|
#listeners = /* @__PURE__ */ new Set;
|
|
@@ -440573,12 +440782,12 @@ menclose::after {
|
|
|
440573
440782
|
return;
|
|
440574
440783
|
console.log(...args$1);
|
|
440575
440784
|
}, 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;
|
|
440576
|
-
var
|
|
440785
|
+
var init_src_XFPz5mDi_es = __esm(() => {
|
|
440577
440786
|
init_rolldown_runtime_Bg48TavK_es();
|
|
440578
|
-
|
|
440787
|
+
init_SuperConverter_BtMpBQnx_es();
|
|
440579
440788
|
init_jszip_C49i9kUs_es();
|
|
440580
440789
|
init_uuid_qzgm05fK_es();
|
|
440581
|
-
|
|
440790
|
+
init_create_headless_toolbar_FOTAKCop_es();
|
|
440582
440791
|
init_constants_DrU4EASo_es();
|
|
440583
440792
|
init_dist_B8HfvhaK_es();
|
|
440584
440793
|
init_unified_Dsuw2be5_es();
|
|
@@ -443922,6 +444131,17 @@ ${err.toString()}`);
|
|
|
443922
444131
|
dispatch
|
|
443923
444132
|
});
|
|
443924
444133
|
},
|
|
444134
|
+
reopenComment: ({ commentId, importedId, internal }) => ({ tr, dispatch, state }) => {
|
|
444135
|
+
tr.setMeta(CommentsPluginKey, { event: "update" });
|
|
444136
|
+
return reopenCommentById({
|
|
444137
|
+
commentId,
|
|
444138
|
+
importedId,
|
|
444139
|
+
internal,
|
|
444140
|
+
state,
|
|
444141
|
+
tr,
|
|
444142
|
+
dispatch
|
|
444143
|
+
});
|
|
444144
|
+
},
|
|
443925
444145
|
editComment: ({ commentId, importedId, content: content3, text: text5 }) => ({ editor }) => {
|
|
443926
444146
|
const nextCommentId = commentId ?? importedId;
|
|
443927
444147
|
if (!nextCommentId)
|
|
@@ -458830,7 +459050,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
458830
459050
|
attributes: sharedAttributes
|
|
458831
459051
|
});
|
|
458832
459052
|
IGNORED_ATTRIBUTE_KEYS = new Set(["sdBlockId"]);
|
|
458833
|
-
TRACK_CHANGE_MARK_NAMES = new Set([
|
|
459053
|
+
TRACK_CHANGE_MARK_NAMES$1 = new Set([
|
|
458834
459054
|
"trackInsert",
|
|
458835
459055
|
"trackDelete",
|
|
458836
459056
|
"trackFormat"
|
|
@@ -463282,6 +463502,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
463282
463502
|
"editComment",
|
|
463283
463503
|
"moveComment",
|
|
463284
463504
|
"resolveComment",
|
|
463505
|
+
"reopenComment",
|
|
463285
463506
|
"setCommentInternal"
|
|
463286
463507
|
],
|
|
463287
463508
|
"comments.delete": ["removeComment"],
|
|
@@ -463647,6 +463868,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
463647
463868
|
bullet: "disc"
|
|
463648
463869
|
};
|
|
463649
463870
|
EDGE_NODE_TYPES$1 = new Set(SELECTION_EDGE_NODE_TYPES);
|
|
463871
|
+
TRACK_CHANGE_MARK_NAMES = new Set([
|
|
463872
|
+
"trackInsert",
|
|
463873
|
+
"trackDelete",
|
|
463874
|
+
"trackFormat"
|
|
463875
|
+
]);
|
|
463650
463876
|
POINTS_TO_PIXELS = 96 / 72;
|
|
463651
463877
|
PIXELS_TO_TWIPS = 1440 / 96;
|
|
463652
463878
|
WORD_DEFAULT_TBL_LOOK = {
|
|
@@ -477475,11 +477701,11 @@ var init_zipper_DbkgrypV_es = __esm(() => {
|
|
|
477475
477701
|
|
|
477476
477702
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
477477
477703
|
var init_super_editor_es = __esm(() => {
|
|
477478
|
-
|
|
477479
|
-
|
|
477704
|
+
init_src_XFPz5mDi_es();
|
|
477705
|
+
init_SuperConverter_BtMpBQnx_es();
|
|
477480
477706
|
init_jszip_C49i9kUs_es();
|
|
477481
477707
|
init_xml_js_CqGKpaft_es();
|
|
477482
|
-
|
|
477708
|
+
init_create_headless_toolbar_FOTAKCop_es();
|
|
477483
477709
|
init_constants_DrU4EASo_es();
|
|
477484
477710
|
init_dist_B8HfvhaK_es();
|
|
477485
477711
|
init_unified_Dsuw2be5_es();
|
|
@@ -488924,7 +489150,10 @@ var init_schemas4 = __esm(() => {
|
|
|
488924
489150
|
commentId: { type: "string" },
|
|
488925
489151
|
text: { type: "string", description: "Updated comment text." },
|
|
488926
489152
|
target: textAddressSchema2,
|
|
488927
|
-
status: {
|
|
489153
|
+
status: {
|
|
489154
|
+
enum: ["resolved", "active"],
|
|
489155
|
+
description: "Set comment status. Use 'resolved' to resolve a comment, or 'active' to reopen a previously resolved comment (lifecycle inverse)."
|
|
489156
|
+
},
|
|
488928
489157
|
isInternal: {
|
|
488929
489158
|
type: "boolean",
|
|
488930
489159
|
description: "When true, marks the comment as internal (hidden from external collaborators)."
|
|
@@ -489248,8 +489477,10 @@ var init_schemas4 = __esm(() => {
|
|
|
489248
489477
|
empty: { type: "boolean" },
|
|
489249
489478
|
target: { oneOf: [textTargetSchema2, { type: "null" }] },
|
|
489250
489479
|
activeMarks: arraySchema2({ type: "string" }),
|
|
489480
|
+
activeCommentIds: arraySchema2({ type: "string" }),
|
|
489481
|
+
activeChangeIds: arraySchema2({ type: "string" }),
|
|
489251
489482
|
text: { type: "string" }
|
|
489252
|
-
}, ["empty", "target", "activeMarks"])
|
|
489483
|
+
}, ["empty", "target", "activeMarks", "activeCommentIds", "activeChangeIds"])
|
|
489253
489484
|
},
|
|
489254
489485
|
"mutations.preview": {
|
|
489255
489486
|
input: mutationsInputSchema,
|
|
@@ -491645,8 +491876,8 @@ function validatePatchCommentInput2(input2) {
|
|
|
491645
491876
|
value: text5
|
|
491646
491877
|
});
|
|
491647
491878
|
}
|
|
491648
|
-
if (status !== undefined && status !== "resolved") {
|
|
491649
|
-
throw new DocumentApiValidationError3("INVALID_INPUT", `status must be "resolved", got "${String(status)}".`, {
|
|
491879
|
+
if (status !== undefined && status !== "resolved" && status !== "active") {
|
|
491880
|
+
throw new DocumentApiValidationError3("INVALID_INPUT", `status must be "resolved" or "active", got "${String(status)}".`, {
|
|
491650
491881
|
field: "status",
|
|
491651
491882
|
value: status
|
|
491652
491883
|
});
|
|
@@ -491682,6 +491913,9 @@ function executeCommentsPatch2(adapter, input2, options) {
|
|
|
491682
491913
|
if (input2.status === "resolved") {
|
|
491683
491914
|
return adapter.resolve({ commentId: input2.commentId }, options);
|
|
491684
491915
|
}
|
|
491916
|
+
if (input2.status === "active") {
|
|
491917
|
+
return adapter.reopen({ commentId: input2.commentId }, options);
|
|
491918
|
+
}
|
|
491685
491919
|
if (input2.isInternal !== undefined) {
|
|
491686
491920
|
return adapter.setInternal({ commentId: input2.commentId, isInternal: input2.isInternal }, options);
|
|
491687
491921
|
}
|
|
@@ -498140,7 +498374,7 @@ function isInlineHost2(node3) {
|
|
|
498140
498374
|
function relevantMarks2(marks) {
|
|
498141
498375
|
if (!marks?.length)
|
|
498142
498376
|
return [];
|
|
498143
|
-
return marks.filter((mark2) => mark2.type?.name === LINK_MARK_NAME2 || mark2.type?.name ===
|
|
498377
|
+
return marks.filter((mark2) => mark2.type?.name === LINK_MARK_NAME2 || mark2.type?.name === COMMENT_MARK_NAME3);
|
|
498144
498378
|
}
|
|
498145
498379
|
function closeMarkSpan2(state, key2, endOffset, endPos) {
|
|
498146
498380
|
const active = state.activeMarks.get(key2);
|
|
@@ -498150,7 +498384,7 @@ function closeMarkSpan2(state, key2, endOffset, endPos) {
|
|
|
498150
498384
|
if (endOffset <= active.startOffset)
|
|
498151
498385
|
return;
|
|
498152
498386
|
const markType = active.mark.type?.name;
|
|
498153
|
-
const nodeType = markType === LINK_MARK_NAME2 ? "hyperlink" : markType ===
|
|
498387
|
+
const nodeType = markType === LINK_MARK_NAME2 ? "hyperlink" : markType === COMMENT_MARK_NAME3 ? "comment" : undefined;
|
|
498154
498388
|
if (!nodeType)
|
|
498155
498389
|
return;
|
|
498156
498390
|
const attrs = active.mark.attrs ?? {};
|
|
@@ -498354,9 +498588,9 @@ function findInlineByType2(index2, nodeType) {
|
|
|
498354
498588
|
return index2.candidates;
|
|
498355
498589
|
return index2.byType.get(nodeType) ?? [];
|
|
498356
498590
|
}
|
|
498357
|
-
var LINK_MARK_NAME2 = "link",
|
|
498591
|
+
var LINK_MARK_NAME2 = "link", COMMENT_MARK_NAME3, SUPPORTED_INLINE_TYPES2;
|
|
498358
498592
|
var init_inline_address_resolver = __esm(() => {
|
|
498359
|
-
|
|
498593
|
+
COMMENT_MARK_NAME3 = CommentMarkName2;
|
|
498360
498594
|
SUPPORTED_INLINE_TYPES2 = new Set([
|
|
498361
498595
|
"run",
|
|
498362
498596
|
"bookmark",
|
|
@@ -583598,6 +583832,45 @@ function resolveCommentHandler2(editor, input2, options) {
|
|
|
583598
583832
|
}
|
|
583599
583833
|
return { success: true, updated: [toCommentAddress2(identity.commentId)] };
|
|
583600
583834
|
}
|
|
583835
|
+
function reopenCommentHandler2(editor, input2, options) {
|
|
583836
|
+
const reopenComment = requireEditorCommand2(editor.commands?.reopenComment, "comments.patch (reopenComment)");
|
|
583837
|
+
const store = getCommentEntityStore2(editor);
|
|
583838
|
+
const identity = resolveCommentIdentity2(editor, input2.commentId);
|
|
583839
|
+
const existing = findCommentEntity2(store, identity.commentId);
|
|
583840
|
+
const isAnchored = identity.anchors.length > 0;
|
|
583841
|
+
const isResolvedInStore = existing ? isCommentResolved2(existing) : false;
|
|
583842
|
+
const isResolvedInDoc = isAnchored && identity.anchors.every((a2) => a2.status === "resolved");
|
|
583843
|
+
if (!isResolvedInStore && !isResolvedInDoc) {
|
|
583844
|
+
return {
|
|
583845
|
+
success: false,
|
|
583846
|
+
failure: { code: "NO_OP", message: "Comment is already active." }
|
|
583847
|
+
};
|
|
583848
|
+
}
|
|
583849
|
+
const storedInternal = existing?.isInternal;
|
|
583850
|
+
const internalOverride = typeof storedInternal === "boolean" ? storedInternal : undefined;
|
|
583851
|
+
const receipt2 = executeDomainCommand2(editor, () => {
|
|
583852
|
+
const didReopen = reopenComment({
|
|
583853
|
+
commentId: identity.commentId,
|
|
583854
|
+
importedId: identity.importedId,
|
|
583855
|
+
internal: internalOverride
|
|
583856
|
+
});
|
|
583857
|
+
if (didReopen) {
|
|
583858
|
+
upsertCommentEntity2(store, identity.commentId, {
|
|
583859
|
+
importedId: identity.importedId,
|
|
583860
|
+
isDone: false,
|
|
583861
|
+
resolvedTime: null
|
|
583862
|
+
});
|
|
583863
|
+
}
|
|
583864
|
+
return Boolean(didReopen);
|
|
583865
|
+
}, { expectedRevision: options?.expectedRevision });
|
|
583866
|
+
if (receipt2.steps[0]?.effect !== "changed") {
|
|
583867
|
+
return {
|
|
583868
|
+
success: false,
|
|
583869
|
+
failure: { code: "NO_OP", message: "Comment reopen produced no change." }
|
|
583870
|
+
};
|
|
583871
|
+
}
|
|
583872
|
+
return { success: true, updated: [toCommentAddress2(identity.commentId)] };
|
|
583873
|
+
}
|
|
583601
583874
|
function removeCommentHandler2(editor, input2, options) {
|
|
583602
583875
|
const removeComment = requireEditorCommand2(editor.commands?.removeComment, "comments.remove (removeComment)");
|
|
583603
583876
|
const store = getCommentEntityStore2(editor);
|
|
@@ -583766,6 +584039,7 @@ function createCommentsWrapper2(editor) {
|
|
|
583766
584039
|
reply: (input2, options) => replyToCommentHandler2(editor, input2, options),
|
|
583767
584040
|
move: (input2, options) => moveCommentHandler2(editor, input2, options),
|
|
583768
584041
|
resolve: (input2, options) => resolveCommentHandler2(editor, input2, options),
|
|
584042
|
+
reopen: (input2, options) => reopenCommentHandler2(editor, input2, options),
|
|
583769
584043
|
remove: (input2, options) => removeCommentHandler2(editor, input2, options),
|
|
583770
584044
|
setInternal: (input2, options) => setCommentInternalHandler2(editor, input2, options),
|
|
583771
584045
|
setActive: (input2, options) => setCommentActiveHandler2(editor, input2, options),
|
|
@@ -584921,7 +585195,7 @@ var init_capabilities_adapter = __esm(() => {
|
|
|
584921
585195
|
"lists.clearLevelOverrides": [],
|
|
584922
585196
|
"blocks.delete": ["deleteBlockNodeById"],
|
|
584923
585197
|
"comments.create": ["addComment", "setTextSelection", "addCommentReply"],
|
|
584924
|
-
"comments.patch": ["editComment", "moveComment", "resolveComment", "setCommentInternal"],
|
|
585198
|
+
"comments.patch": ["editComment", "moveComment", "resolveComment", "reopenComment", "setCommentInternal"],
|
|
584925
585199
|
"comments.delete": ["removeComment"],
|
|
584926
585200
|
"trackChanges.decide": [
|
|
584927
585201
|
"acceptTrackedChangeById",
|
|
@@ -588857,17 +589131,21 @@ var init_scroll_into_view_adapter = __esm(() => {
|
|
|
588857
589131
|
function resolveCurrentSelectionInfo2(editor, input2) {
|
|
588858
589132
|
const state = editor.state;
|
|
588859
589133
|
if (!state) {
|
|
588860
|
-
return { empty: true, target: null, activeMarks: [] };
|
|
589134
|
+
return { empty: true, target: null, activeMarks: [], activeCommentIds: [], activeChangeIds: [] };
|
|
588861
589135
|
}
|
|
588862
589136
|
const sel = state.selection;
|
|
588863
589137
|
const { from: from4, to, empty: empty6 } = sel;
|
|
588864
589138
|
const segments = collectTextSegments2(state.doc, from4, to);
|
|
588865
589139
|
const target = segments && segments.length > 0 ? buildTextTarget3(segments) : null;
|
|
588866
589140
|
const activeMarks = collectActiveMarks2(state, from4, to);
|
|
589141
|
+
const { commentIds: activeCommentIds, changeIds: activeChangeRawIds } = collectActiveEntityIds2(state, from4, to);
|
|
589142
|
+
const activeChangeIds = mapRawChangeIdsToCanonical2(editor, activeChangeRawIds);
|
|
588867
589143
|
const info = {
|
|
588868
589144
|
empty: empty6,
|
|
588869
589145
|
target,
|
|
588870
|
-
activeMarks
|
|
589146
|
+
activeMarks,
|
|
589147
|
+
activeCommentIds,
|
|
589148
|
+
activeChangeIds
|
|
588871
589149
|
};
|
|
588872
589150
|
if (input2.includeText && !empty6) {
|
|
588873
589151
|
info.text = state.doc.textBetween(from4, to, " ");
|
|
@@ -588911,6 +589189,69 @@ function readBlockId2(node4) {
|
|
|
588911
589189
|
const id2 = attrs.sdBlockId ?? attrs.id ?? attrs.blockId;
|
|
588912
589190
|
return typeof id2 === "string" && id2.length > 0 ? id2 : null;
|
|
588913
589191
|
}
|
|
589192
|
+
function mapRawChangeIdsToCanonical2(editor, rawIds) {
|
|
589193
|
+
if (rawIds.length === 0)
|
|
589194
|
+
return rawIds;
|
|
589195
|
+
let grouped;
|
|
589196
|
+
try {
|
|
589197
|
+
grouped = groupTrackedChanges2(editor);
|
|
589198
|
+
} catch {
|
|
589199
|
+
return [];
|
|
589200
|
+
}
|
|
589201
|
+
const rawToCanonical = new Map;
|
|
589202
|
+
for (const change of grouped) {
|
|
589203
|
+
rawToCanonical.set(change.rawId, change.id);
|
|
589204
|
+
}
|
|
589205
|
+
const seen = new Set;
|
|
589206
|
+
const out = [];
|
|
589207
|
+
for (const raw of rawIds) {
|
|
589208
|
+
const canonical = rawToCanonical.get(raw);
|
|
589209
|
+
if (!canonical)
|
|
589210
|
+
continue;
|
|
589211
|
+
if (seen.has(canonical))
|
|
589212
|
+
continue;
|
|
589213
|
+
seen.add(canonical);
|
|
589214
|
+
out.push(canonical);
|
|
589215
|
+
}
|
|
589216
|
+
return out;
|
|
589217
|
+
}
|
|
589218
|
+
function collectActiveEntityIds2(state, from4, to) {
|
|
589219
|
+
const commentIds = new Set;
|
|
589220
|
+
const changeIds = new Set;
|
|
589221
|
+
const collectFromMark = (markType, attrs) => {
|
|
589222
|
+
if (markType === COMMENT_MARK_NAME4) {
|
|
589223
|
+
const id2 = resolveCommentIdFromAttrs2(attrs ?? {});
|
|
589224
|
+
if (typeof id2 === "string" && id2.length > 0)
|
|
589225
|
+
commentIds.add(id2);
|
|
589226
|
+
} else if (TRACK_CHANGE_MARK_NAMES2.has(markType)) {
|
|
589227
|
+
const id2 = attrs?.id;
|
|
589228
|
+
if (typeof id2 === "string" && id2.length > 0)
|
|
589229
|
+
changeIds.add(id2);
|
|
589230
|
+
}
|
|
589231
|
+
};
|
|
589232
|
+
if (from4 === to) {
|
|
589233
|
+
if (state.storedMarks) {
|
|
589234
|
+
for (const mark2 of state.storedMarks)
|
|
589235
|
+
collectFromMark(mark2.type.name, mark2.attrs);
|
|
589236
|
+
}
|
|
589237
|
+
const $pos = state.doc.resolve(from4);
|
|
589238
|
+
for (const mark2 of $pos.marks())
|
|
589239
|
+
collectFromMark(mark2.type.name, mark2.attrs);
|
|
589240
|
+
} else {
|
|
589241
|
+
state.doc.nodesBetween(from4, to, (node4, pos) => {
|
|
589242
|
+
if (!node4.isText)
|
|
589243
|
+
return true;
|
|
589244
|
+
const start2 = Math.max(pos, from4);
|
|
589245
|
+
const end = Math.min(pos + node4.nodeSize, to);
|
|
589246
|
+
if (end <= start2)
|
|
589247
|
+
return false;
|
|
589248
|
+
for (const mark2 of node4.marks)
|
|
589249
|
+
collectFromMark(mark2.type.name, mark2.attrs);
|
|
589250
|
+
return false;
|
|
589251
|
+
});
|
|
589252
|
+
}
|
|
589253
|
+
return { commentIds: Array.from(commentIds), changeIds: Array.from(changeIds) };
|
|
589254
|
+
}
|
|
588914
589255
|
function collectActiveMarks2(state, from4, to) {
|
|
588915
589256
|
const names = new Set;
|
|
588916
589257
|
const stored = state.storedMarks;
|
|
@@ -588968,7 +589309,9 @@ function selectionInfoKey2(info) {
|
|
|
588968
589309
|
targetKey = target.segments.map((s2) => `${s2.blockId}:${s2.range.start}-${s2.range.end}`).join("|");
|
|
588969
589310
|
}
|
|
588970
589311
|
const marks = [...info.activeMarks].sort().join(",");
|
|
588971
|
-
|
|
589312
|
+
const comments = [...info.activeCommentIds].sort().join(",");
|
|
589313
|
+
const changes = [...info.activeChangeIds].sort().join(",");
|
|
589314
|
+
return `${info.empty ? "1" : "0"}:${targetKey}:${marks}:c=${comments}:tc=${changes}`;
|
|
588972
589315
|
}
|
|
588973
589316
|
function markTypesPresentEverywhere2(doc6, from4, to) {
|
|
588974
589317
|
let common = null;
|
|
@@ -588999,7 +589342,11 @@ function markTypesPresentEverywhere2(doc6, from4, to) {
|
|
|
588999
589342
|
});
|
|
589000
589343
|
return common ?? new Set;
|
|
589001
589344
|
}
|
|
589002
|
-
var
|
|
589345
|
+
var COMMENT_MARK_NAME4 = "commentMark", TRACK_CHANGE_MARK_NAMES2;
|
|
589346
|
+
var init_selection_info_resolver = __esm(() => {
|
|
589347
|
+
init_tracked_change_resolver();
|
|
589348
|
+
TRACK_CHANGE_MARK_NAMES2 = new Set(["trackInsert", "trackDelete", "trackFormat"]);
|
|
589349
|
+
});
|
|
589003
589350
|
|
|
589004
589351
|
// ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/table-target-resolver.ts
|
|
589005
589352
|
function resolveLocatorToCandidate2(editor, locator, operationName) {
|
|
@@ -595029,7 +595376,7 @@ function getMarksDiff2(marksA = [], marksB = []) {
|
|
|
595029
595376
|
return {};
|
|
595030
595377
|
}
|
|
595031
595378
|
const ignoredMarkKeys = new Set;
|
|
595032
|
-
if (
|
|
595379
|
+
if (TRACK_CHANGE_MARK_NAMES3.has(markName)) {
|
|
595033
595380
|
for (const key2 of TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS2) {
|
|
595034
595381
|
ignoredMarkKeys.add(key2);
|
|
595035
595382
|
}
|
|
@@ -595186,10 +595533,10 @@ function deepEquals2(a2, b2) {
|
|
|
595186
595533
|
}
|
|
595187
595534
|
return false;
|
|
595188
595535
|
}
|
|
595189
|
-
var IGNORED_ATTRIBUTE_KEYS2,
|
|
595536
|
+
var IGNORED_ATTRIBUTE_KEYS2, TRACK_CHANGE_MARK_NAMES3, TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS2;
|
|
595190
595537
|
var init_attributes_diffing = __esm(() => {
|
|
595191
595538
|
IGNORED_ATTRIBUTE_KEYS2 = new Set(["sdBlockId"]);
|
|
595192
|
-
|
|
595539
|
+
TRACK_CHANGE_MARK_NAMES3 = new Set(["trackInsert", "trackDelete", "trackFormat"]);
|
|
595193
595540
|
TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS2 = new Set(["id", "sourceId"]);
|
|
595194
595541
|
});
|
|
595195
595542
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/mcp",
|
|
3
|
-
"version": "0.3.0-next.
|
|
3
|
+
"version": "0.3.0-next.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc-mcp": "./dist/index.js"
|
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
13
13
|
"zod": "^4.3.6",
|
|
14
|
-
"@superdoc/
|
|
15
|
-
"@superdoc-
|
|
14
|
+
"@superdoc-dev/sdk": "1.7.0",
|
|
15
|
+
"@superdoc/document-api": "0.0.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/bun": "^1.3.8",
|
|
19
19
|
"@types/node": "22.19.2",
|
|
20
20
|
"typescript": "^5.9.2",
|
|
21
|
-
"
|
|
22
|
-
"superdoc": "
|
|
21
|
+
"superdoc": "1.29.0",
|
|
22
|
+
"@superdoc/super-editor": "0.0.1"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|