@stll/folio-core 0.75.0 → 0.76.0
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/ai-edits/headless.d.ts +2 -1
- package/dist/ai-edits/headless.js +18 -12
- package/dist/ai-edits/pending-suggestions.js +2 -3
- package/dist/ai-edits/read.js +9 -3
- package/dist/ai-edits/types.d.ts +9 -4
- package/dist/canonical/batchCommentReferences.js +2 -1
- package/dist/canonical/canonicalBatchReview.js +5 -8
- package/dist/canonical/canonicalComments.js +8 -2
- package/dist/canonical/canonicalCompilerRefusal.d.ts +2 -4
- package/dist/canonical/canonicalCompilerRefusal.js +20 -14
- package/dist/canonical/canonicalPublicOperations.js +203 -71
- package/dist/canonical/canonicalSession.js +3 -1
- package/dist/controller/canonicalClipboard.d.ts +1 -1
- package/dist/controller/canonicalClipboard.js +71 -17
- package/dist/controller/canonicalContentControlValue.js +7 -7
- package/dist/controller/canonicalReview.d.ts +21 -0
- package/dist/controller/canonicalReview.js +44 -9
- package/dist/controller/canonicalStructure.d.ts +1 -2
- package/dist/controller/canonicalStructure.js +51 -24
- package/dist/controller/fontReadiness.js +50 -23
- package/dist/controller/hiddenEditorManager.js +5 -20
- package/dist/docx/bulletMarkers.d.ts +8 -0
- package/dist/docx/bulletMarkers.js +9 -1
- package/dist/docx/canonicalSessionInput.js +25 -11
- package/dist/docx/ensureParaIds.d.ts +31 -0
- package/dist/docx/ensureParaIds.js +57 -32
- package/dist/docx/ensureUniqueControlIds.d.ts +13 -0
- package/dist/docx/ensureUniqueControlIds.js +47 -29
- package/dist/docx/ensureUniqueRevisionIds.d.ts +13 -0
- package/dist/docx/ensureUniqueRevisionIds.js +52 -29
- package/dist/docx/server/templatePlan/apply.js +62 -8
- package/dist/docx/server/templatePlan/blocks.d.ts +55 -3
- package/dist/docx/server/templatePlan/blocks.js +182 -6
- package/dist/docx/server/templatePlan/builders.d.ts +16 -1
- package/dist/docx/server/templatePlan/builders.js +31 -3
- package/dist/docx/server/templatePlan/effects.d.ts +27 -0
- package/dist/docx/server/templatePlan/effects.js +188 -0
- package/dist/docx/server/templatePlan/emit.d.ts +2 -1
- package/dist/docx/server/templatePlan/emit.js +44 -2
- package/dist/docx/server/templatePlan/inspect.js +21 -1
- package/dist/docx/server/templatePlan/labels.js +16 -1
- package/dist/docx/server/templatePlan/plan.d.ts +12 -3
- package/dist/docx/server/templatePlan/plan.js +36 -12
- package/dist/docx/server/templatePlan/planShape.js +47 -22
- package/dist/docx/server/templatePlan/revisions.d.ts +46 -0
- package/dist/docx/server/templatePlan/revisions.js +407 -0
- package/dist/docx/server/templatePlan/story.d.ts +15 -1
- package/dist/docx/server/templatePlan/story.js +50 -2
- package/dist/docx/server/templatePlan/types.d.ts +217 -1
- package/dist/docx/server/templatePlan/verify.js +117 -8
- package/dist/docx/server/templatePlan/xml.d.ts +3 -0
- package/dist/docx/server/templatePlan/xml.js +4 -1
- package/dist/internal/revisionResolutionStep.d.ts +2 -31
- package/dist/internal/revisionResolutionStep.js +2 -171
- package/dist/prosemirror/commands/comments.d.ts +6 -234
- package/dist/prosemirror/commands/comments.js +5 -2464
- package/dist/prosemirror/commands/index.d.ts +4 -2
- package/dist/prosemirror/commands/index.js +4 -2
- package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +1 -11
- package/dist/prosemirror/commands/tableCellMergeResolution.js +3 -154
- package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +6 -8
- package/dist/prosemirror/hyperlinkRemoval.d.ts +11 -8
- package/dist/prosemirror/hyperlinkRemoval.js +24 -15
- package/dist/prosemirror/paraIds.d.ts +1 -14
- package/dist/prosemirror/paraIds.js +1 -14
- package/dist/prosemirror/paragraphMarkJoin.d.ts +0 -16
- package/dist/prosemirror/paragraphMarkJoin.js +3 -46
- package/dist/prosemirror/projectionReview.d.ts +49 -0
- package/dist/prosemirror/projectionReview.js +292 -0
- package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +1 -13
- package/dist/prosemirror/rebaseParagraphRunFormatting.js +1 -16
- package/dist/prosemirror/replacedAnnotations.d.ts +2 -5
- package/dist/prosemirror/replacedAnnotations.js +1 -10
- package/dist/prosemirror/revisionCarriers.d.ts +9 -1
- package/dist/prosemirror/revisionCarriers.js +15 -1
- package/dist/prosemirror/revisionRangeQueries.d.ts +32 -0
- package/dist/prosemirror/revisionRangeQueries.js +76 -0
- package/dist/prosemirror/runFormattingMarkNames.d.ts +1 -1
- package/dist/prosemirror/runFormattingMarkNames.js +1 -1
- package/dist/prosemirror/suggestionQueries.d.ts +114 -0
- package/dist/prosemirror/suggestionQueries.js +320 -0
- package/dist/prosemirror/tableGridMutation.d.ts +1 -16
- package/dist/prosemirror/tableGridMutation.js +1 -78
- package/dist/prosemirror/tableRowRevisionOwnership.d.ts +18 -0
- package/dist/prosemirror/tableRowRevisionOwnership.js +7 -0
- package/dist/prosemirror/utils/extractTrackedChanges.js +14 -4
- package/dist/server.d.ts +2 -2
- package/dist/types/canonicalCapabilities.d.ts +1 -25
- package/dist/types/canonicalCapabilities.js +1 -23
- package/package.json +2 -2
- package/dist/internal/headlessRevisionResolutionGuard.d.ts +0 -3
- package/dist/internal/headlessRevisionResolutionGuard.js +0 -18
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { sameStatedParagraphNumbering } from "../docx/numberingReference.js";
|
|
2
|
+
import { expectParagraphAttrs } from "./attrs/index.js";
|
|
3
|
+
import { enclosingRevisionIds } from "./contentControlRevisions.js";
|
|
4
|
+
import "./extensions/nodes/SdtExtension.js";
|
|
5
|
+
import { isPPrMarkAttr, paragraphMarkWasAdded } from "./revisionCarriers.js";
|
|
6
|
+
import { extractTrackedChanges } from "./utils/extractTrackedChanges.js";
|
|
7
|
+
import "prosemirror-model";
|
|
8
|
+
// src/prosemirror/projectionReview.ts
|
|
9
|
+
/**
|
|
10
|
+
* Add a comment mark to the current selection.
|
|
11
|
+
*/
|
|
12
|
+
function addCommentMark(commentId) {
|
|
13
|
+
return (state, dispatch) => {
|
|
14
|
+
const { from, to, empty } = state.selection;
|
|
15
|
+
if (empty) return false;
|
|
16
|
+
const commentType = state.schema.marks["comment"];
|
|
17
|
+
if (!commentType) return false;
|
|
18
|
+
if (dispatch) dispatch(state.tr.addMark(from, to, commentType.create({ commentId })));
|
|
19
|
+
return true;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Remove a comment mark by ID from the entire document.
|
|
24
|
+
*/
|
|
25
|
+
function removeCommentMark(commentId) {
|
|
26
|
+
return (state, dispatch) => {
|
|
27
|
+
const commentType = state.schema.marks["comment"];
|
|
28
|
+
if (!commentType) return false;
|
|
29
|
+
if (dispatch) {
|
|
30
|
+
const tr = state.tr;
|
|
31
|
+
state.doc.descendants((node, pos) => {
|
|
32
|
+
if (node.isText) {
|
|
33
|
+
for (const mark of node.marks) if (mark.type === commentType && mark.attrs["commentId"] === commentId) tr.removeMark(pos, pos + node.nodeSize, mark);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
if (tr.steps.length > 0) dispatch(tr);
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function readRevisionInfo(info) {
|
|
42
|
+
const revision = {};
|
|
43
|
+
if (typeof info?.author === "string") revision.author = info.author;
|
|
44
|
+
if (typeof info?.date === "string") revision.date = info.date;
|
|
45
|
+
if (typeof info?.id === "number") revision.revisionId = info.id;
|
|
46
|
+
return revision;
|
|
47
|
+
}
|
|
48
|
+
function getListPropertyChangeType(node, change) {
|
|
49
|
+
const previousFormatting = change.previousFormatting;
|
|
50
|
+
if (previousFormatting == null || !Object.hasOwn(previousFormatting, "numPr")) return null;
|
|
51
|
+
const current = expectParagraphAttrs(node).numPr;
|
|
52
|
+
const previous = previousFormatting["numPr"] ?? void 0;
|
|
53
|
+
if (sameStatedParagraphNumbering(previous, current)) return null;
|
|
54
|
+
return current === void 0 ? "deletion" : "insertion";
|
|
55
|
+
}
|
|
56
|
+
function toParagraphBoundaryChange(node, pos, type, info) {
|
|
57
|
+
return {
|
|
58
|
+
from: pos + node.nodeSize - 1,
|
|
59
|
+
to: pos + node.nodeSize,
|
|
60
|
+
type,
|
|
61
|
+
...readRevisionInfo(info)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function findParagraphBoundaryChangeAtPosition(state, pos) {
|
|
65
|
+
const $pos = state.doc.resolve(pos);
|
|
66
|
+
const node = $pos.parent;
|
|
67
|
+
if (node.type.name !== "paragraph") return null;
|
|
68
|
+
const paragraphPos = $pos.before($pos.depth);
|
|
69
|
+
const pPrMark = node.attrs["pPrMark"];
|
|
70
|
+
if (isPPrMarkAttr(pPrMark)) return toParagraphBoundaryChange(node, paragraphPos, paragraphMarkWasAdded(pPrMark.kind) ? "insertion" : "deletion", pPrMark.info);
|
|
71
|
+
const propertyChanges = expectParagraphAttrs(node)._propertyChanges;
|
|
72
|
+
if (!Array.isArray(propertyChanges)) return null;
|
|
73
|
+
for (const change of propertyChanges) {
|
|
74
|
+
const type = getListPropertyChangeType(node, change);
|
|
75
|
+
if (type) return toParagraphBoundaryChange(node, paragraphPos, type, change.info);
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
/** Every revision id one sidebar entry stands for. */
|
|
80
|
+
const trackedChangeEntryRevisionIds = (entry) => [.../* @__PURE__ */ new Set([
|
|
81
|
+
entry.revisionId,
|
|
82
|
+
...entry.insertionRevisionId === void 0 ? [] : [entry.insertionRevisionId],
|
|
83
|
+
...entry.coalescedRevisionIds ?? []
|
|
84
|
+
])];
|
|
85
|
+
const pairedReplacementRangesByDoc = /* @__PURE__ */ new WeakMap();
|
|
86
|
+
const pairedReplacementRanges = (state) => {
|
|
87
|
+
const cached = pairedReplacementRangesByDoc.get(state.doc);
|
|
88
|
+
if (cached) return cached;
|
|
89
|
+
const ranges = [];
|
|
90
|
+
const { entries } = extractTrackedChanges(state);
|
|
91
|
+
for (const entry of entries) {
|
|
92
|
+
if (entry.type !== "replacement" || entry.insertionRevisionId === void 0) continue;
|
|
93
|
+
ranges.push({
|
|
94
|
+
from: entry.from,
|
|
95
|
+
to: entry.to
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
pairedReplacementRangesByDoc.set(state.doc, ranges);
|
|
99
|
+
return ranges;
|
|
100
|
+
};
|
|
101
|
+
const pairedReplacementRangeAt = ({ ranges, from, to }) => {
|
|
102
|
+
let low = 0;
|
|
103
|
+
let high = ranges.length;
|
|
104
|
+
while (low < high) {
|
|
105
|
+
const middle = Math.floor((low + high) / 2);
|
|
106
|
+
if (ranges[middle].from <= from) low = middle + 1;
|
|
107
|
+
else high = middle;
|
|
108
|
+
}
|
|
109
|
+
const candidate = ranges[low - 1];
|
|
110
|
+
return candidate && from >= candidate.from && to <= candidate.to ? candidate : void 0;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Find the tracked change mark range at a given cursor position.
|
|
114
|
+
* If the cursor is inside a tracked change, returns the full extent
|
|
115
|
+
* of that mark (expanding to cover all adjacent nodes with the same
|
|
116
|
+
* revision ID). If from !== to (range selection), returns {from, to}.
|
|
117
|
+
*/
|
|
118
|
+
function findChangeAtPosition(state, from, to) {
|
|
119
|
+
if (from !== to) return {
|
|
120
|
+
from,
|
|
121
|
+
to
|
|
122
|
+
};
|
|
123
|
+
const insertionType = state.schema.marks["insertion"];
|
|
124
|
+
const deletionType = state.schema.marks["deletion"];
|
|
125
|
+
if (!insertionType && !deletionType) return {
|
|
126
|
+
from,
|
|
127
|
+
to
|
|
128
|
+
};
|
|
129
|
+
const $pos = state.doc.resolve(from);
|
|
130
|
+
const node = $pos.parent;
|
|
131
|
+
if (!node.inlineContent) return {
|
|
132
|
+
from,
|
|
133
|
+
to
|
|
134
|
+
};
|
|
135
|
+
let markStart = from;
|
|
136
|
+
let markEnd = from;
|
|
137
|
+
let foundMark;
|
|
138
|
+
node.forEach((child, offset) => {
|
|
139
|
+
const childStart = $pos.start() + offset;
|
|
140
|
+
const childEnd = childStart + child.nodeSize;
|
|
141
|
+
if (from >= childStart && from <= childEnd && child.isText) {
|
|
142
|
+
for (const mark of child.marks) if (mark.type === insertionType || mark.type === deletionType) {
|
|
143
|
+
foundMark = mark;
|
|
144
|
+
markStart = childStart;
|
|
145
|
+
markEnd = childEnd;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
if (foundMark === void 0) {
|
|
150
|
+
const paragraphChange = findParagraphBoundaryChangeAtPosition(state, from);
|
|
151
|
+
return paragraphChange ? {
|
|
152
|
+
from: paragraphChange.from,
|
|
153
|
+
to: paragraphChange.to
|
|
154
|
+
} : {
|
|
155
|
+
from,
|
|
156
|
+
to
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
const sameMark = foundMark;
|
|
160
|
+
const children = [];
|
|
161
|
+
node.forEach((child, offset) => {
|
|
162
|
+
if (!child.isText) return;
|
|
163
|
+
const childStart = $pos.start() + offset;
|
|
164
|
+
children.push({
|
|
165
|
+
childStart,
|
|
166
|
+
childEnd: childStart + child.nodeSize,
|
|
167
|
+
marks: child.marks
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
let extended = true;
|
|
171
|
+
while (extended) {
|
|
172
|
+
extended = false;
|
|
173
|
+
for (const child of children) {
|
|
174
|
+
if (!child.marks.some((m) => m.eq(sameMark))) continue;
|
|
175
|
+
if (child.childEnd === markStart) {
|
|
176
|
+
markStart = child.childStart;
|
|
177
|
+
extended = true;
|
|
178
|
+
}
|
|
179
|
+
if (child.childStart === markEnd) {
|
|
180
|
+
markEnd = child.childEnd;
|
|
181
|
+
extended = true;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
from: markStart,
|
|
187
|
+
to: markEnd
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Walk outward from `[fromHint, toHint]` and return the full extent of the
|
|
192
|
+
* tracked-change span carrying `mark` (matched via `Mark.eq`, so attrs like
|
|
193
|
+
* `revisionId` distinguish adjacent changes). Used to keep the
|
|
194
|
+
* navigation/scroll helpers honest when a tracked-change span is split
|
|
195
|
+
* across multiple text nodes due to inline formatting (e.g., a bold word
|
|
196
|
+
* inside an insertion).
|
|
197
|
+
*/
|
|
198
|
+
function expandTrackedChangeRange(state, mark, fromHint, toHint) {
|
|
199
|
+
const carriesSameInlineMark = (node) => node?.isInline === true && node.marks.some((m) => m.eq(mark));
|
|
200
|
+
let from = fromHint;
|
|
201
|
+
let to = toHint;
|
|
202
|
+
const revisionId = mark.attrs["revisionId"];
|
|
203
|
+
for (;;) {
|
|
204
|
+
let $from = state.doc.resolve(from);
|
|
205
|
+
let nodeBefore = $from.nodeBefore;
|
|
206
|
+
while (carriesSameInlineMark(nodeBefore)) {
|
|
207
|
+
from -= nodeBefore.nodeSize;
|
|
208
|
+
$from = state.doc.resolve(from);
|
|
209
|
+
nodeBefore = $from.nodeBefore;
|
|
210
|
+
}
|
|
211
|
+
let $to = state.doc.resolve(to);
|
|
212
|
+
let nodeAfter = $to.nodeAfter;
|
|
213
|
+
while (carriesSameInlineMark(nodeAfter)) {
|
|
214
|
+
to += nodeAfter.nodeSize;
|
|
215
|
+
$to = state.doc.resolve(to);
|
|
216
|
+
nodeAfter = $to.nodeAfter;
|
|
217
|
+
}
|
|
218
|
+
const control = $from.parent;
|
|
219
|
+
if (control.type.name !== "sdt" || typeof revisionId !== "number" || !enclosingRevisionIds(control).includes(revisionId) || from !== $from.start() || to !== $from.end()) return {
|
|
220
|
+
from,
|
|
221
|
+
to
|
|
222
|
+
};
|
|
223
|
+
from = $from.before();
|
|
224
|
+
to = $from.after();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Find the next tracked change after the given position. Returns the full
|
|
229
|
+
* range of the change (including adjacent text nodes that share the same
|
|
230
|
+
* insertion/deletion mark instance), not just the first text node.
|
|
231
|
+
*/
|
|
232
|
+
function findNextChange(state, startPos) {
|
|
233
|
+
const insertionType = state.schema.marks["insertion"];
|
|
234
|
+
const deletionType = state.schema.marks["deletion"];
|
|
235
|
+
if (!insertionType && !deletionType) return null;
|
|
236
|
+
const replacementRanges = pairedReplacementRanges(state);
|
|
237
|
+
const result = { value: null };
|
|
238
|
+
state.doc.descendants((node, pos) => {
|
|
239
|
+
if (result.value) return false;
|
|
240
|
+
if (!node.isInline) return;
|
|
241
|
+
if (pos + node.nodeSize <= startPos) return;
|
|
242
|
+
for (const mark of node.marks) if (mark.type === insertionType || mark.type === deletionType) {
|
|
243
|
+
const expanded = pairedReplacementRangeAt({
|
|
244
|
+
ranges: replacementRanges,
|
|
245
|
+
from: pos,
|
|
246
|
+
to: pos + node.nodeSize
|
|
247
|
+
}) ?? expandTrackedChangeRange(state, mark, pos, pos + node.nodeSize);
|
|
248
|
+
result.value = {
|
|
249
|
+
from: expanded.from,
|
|
250
|
+
to: expanded.to,
|
|
251
|
+
type: mark.type === insertionType ? "insertion" : "deletion"
|
|
252
|
+
};
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
if (result.value === null && startPos > 0) return findNextChange(state, 0);
|
|
257
|
+
return result.value;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Find the previous tracked change before the given position. Returns the
|
|
261
|
+
* full range of the change (including adjacent text nodes that share the
|
|
262
|
+
* same insertion/deletion mark instance), not just the last text node.
|
|
263
|
+
*/
|
|
264
|
+
function findPreviousChange(state, startPos) {
|
|
265
|
+
const insertionType = state.schema.marks["insertion"];
|
|
266
|
+
const deletionType = state.schema.marks["deletion"];
|
|
267
|
+
if (!insertionType && !deletionType) return null;
|
|
268
|
+
const replacementRanges = pairedReplacementRanges(state);
|
|
269
|
+
const result = { value: null };
|
|
270
|
+
let resultMark = null;
|
|
271
|
+
state.doc.descendants((node, pos) => {
|
|
272
|
+
if (!node.isInline) return;
|
|
273
|
+
if (pos >= startPos) return false;
|
|
274
|
+
if (result.value && resultMark && pos < result.value.to && node.marks.every((m) => m.type !== insertionType && m.type !== deletionType || m.eq(resultMark))) return;
|
|
275
|
+
for (const mark of node.marks) if (mark.type === insertionType || mark.type === deletionType) {
|
|
276
|
+
const expanded = pairedReplacementRangeAt({
|
|
277
|
+
ranges: replacementRanges,
|
|
278
|
+
from: pos,
|
|
279
|
+
to: pos + node.nodeSize
|
|
280
|
+
}) ?? expandTrackedChangeRange(state, mark, pos, pos + node.nodeSize);
|
|
281
|
+
result.value = {
|
|
282
|
+
from: expanded.from,
|
|
283
|
+
to: expanded.to,
|
|
284
|
+
type: mark.type === insertionType ? "insertion" : "deletion"
|
|
285
|
+
};
|
|
286
|
+
resultMark = mark;
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
if (result.value === null && startPos < state.doc.content.size) return findPreviousChange(state, state.doc.content.size);
|
|
290
|
+
return result.value;
|
|
291
|
+
}
|
|
292
|
+
export { addCommentMark, findChangeAtPosition, findNextChange, findParagraphBoundaryChangeAtPosition, findPreviousChange, removeCommentMark, trackedChangeEntryRevisionIds };
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import { ParagraphRunStyleContext, RunStyleResolver } from "./runStyleFormatting.js";
|
|
2
|
-
import { Transaction } from "prosemirror-state";
|
|
3
2
|
import { Node } from "prosemirror-model";
|
|
4
3
|
import { Transform } from "prosemirror-transform";
|
|
5
|
-
|
|
6
|
-
nextAttrs: Record<string, unknown>;
|
|
7
|
-
paragraphPosition: number;
|
|
8
|
-
shouldRebase?: (node: Node) => boolean;
|
|
9
|
-
styleResolver: RunStyleResolver;
|
|
10
|
-
tr: Transaction;
|
|
11
|
-
};
|
|
4
|
+
export declare const paragraphAt: (tr: Transform, paragraphPosition: number) => Node;
|
|
12
5
|
type RebaseParagraphRunsOptions<T extends Transform> = {
|
|
13
6
|
/** The style context the runs' marks were resolved in. */
|
|
14
7
|
previousContext: ParagraphRunStyleContext;
|
|
@@ -28,9 +21,4 @@ type RebaseParagraphRunsOptions<T extends Transform> = {
|
|
|
28
21
|
* the old context lent the runs goes with it.
|
|
29
22
|
*/
|
|
30
23
|
export declare const rebaseParagraphRuns: <T extends Transform>({ previousContext, paragraphPosition, range, shouldRebase, styleResolver, tr }: RebaseParagraphRunsOptions<T>) => T;
|
|
31
|
-
/**
|
|
32
|
-
* Change paragraph attrs and re-resolve inherited run marks in the new style
|
|
33
|
-
* context without turning the old rendered style into direct run formatting.
|
|
34
|
-
*/
|
|
35
|
-
export declare const setParagraphAttrsWithRebasedRunFormatting: ({ nextAttrs, paragraphPosition, shouldRebase, styleResolver, tr }: RebaseParagraphRunFormattingOptions) => Transaction;
|
|
36
24
|
export {};
|
|
@@ -70,19 +70,4 @@ const rebaseParagraphRuns = ({ previousContext, paragraphPosition, range, should
|
|
|
70
70
|
}
|
|
71
71
|
return tr;
|
|
72
72
|
};
|
|
73
|
-
|
|
74
|
-
* Change paragraph attrs and re-resolve inherited run marks in the new style
|
|
75
|
-
* context without turning the old rendered style into direct run formatting.
|
|
76
|
-
*/
|
|
77
|
-
const setParagraphAttrsWithRebasedRunFormatting = ({ nextAttrs, paragraphPosition, shouldRebase, styleResolver, tr }) => {
|
|
78
|
-
const previousContext = paragraphRunStyleContext(paragraphAt(tr, paragraphPosition), styleResolver);
|
|
79
|
-
tr = tr.setNodeMarkup(paragraphPosition, void 0, nextAttrs);
|
|
80
|
-
return rebaseParagraphRuns({
|
|
81
|
-
previousContext,
|
|
82
|
-
paragraphPosition,
|
|
83
|
-
...shouldRebase ? { shouldRebase } : {},
|
|
84
|
-
styleResolver,
|
|
85
|
-
tr
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
export { rebaseParagraphRuns, setParagraphAttrsWithRebasedRunFormatting };
|
|
73
|
+
export { paragraphAt, rebaseParagraphRuns };
|
|
@@ -87,18 +87,15 @@ export declare const NON_INCLUSIVE_MARK_DISPOSITION: {
|
|
|
87
87
|
export declare const nonInclusiveMarkNames: (schema: Schema) => string[];
|
|
88
88
|
/** One typed anchor for a comment authored as a point. */
|
|
89
89
|
export declare const commentPoint: (schema: Schema, id: number) => Node;
|
|
90
|
-
type
|
|
91
|
-
doc: Node;
|
|
90
|
+
type ResolvedCommentPointCollectorOptions = {
|
|
92
91
|
removes: (node: Node, position: number) => boolean;
|
|
93
92
|
retiresStructure: (node: Node, position: number) => boolean;
|
|
94
93
|
};
|
|
95
94
|
/** The same collector serves standalone commands and the existing bulk walk. */
|
|
96
|
-
export declare const createResolvedCommentPointCollector: ({ removes, retiresStructure }:
|
|
95
|
+
export declare const createResolvedCommentPointCollector: ({ removes, retiresStructure }: ResolvedCommentPointCollectorOptions) => {
|
|
97
96
|
visit: (node: Node, position: number, previous?: Node) => boolean;
|
|
98
97
|
finish: () => Map<number, number>;
|
|
99
98
|
};
|
|
100
|
-
/** Ranged comments whose covered non-carrier content is removed by a resolution. */
|
|
101
|
-
export declare const resolvedCommentPoints: ({ doc, removes, retiresStructure }: ResolvedCommentPointsOptions) => Map<number, number>;
|
|
102
99
|
export type ReplacedAnnotations = {
|
|
103
100
|
/** Marks the replacement must carry, in document order. */
|
|
104
101
|
carried: readonly Mark[];
|
|
@@ -173,15 +173,6 @@ const createResolvedCommentPointCollector = ({ removes, retiresStructure }) => {
|
|
|
173
173
|
finish
|
|
174
174
|
};
|
|
175
175
|
};
|
|
176
|
-
/** Ranged comments whose covered non-carrier content is removed by a resolution. */
|
|
177
|
-
const resolvedCommentPoints = ({ doc, removes, retiresStructure }) => {
|
|
178
|
-
const collector = createResolvedCommentPointCollector({
|
|
179
|
-
removes,
|
|
180
|
-
retiresStructure
|
|
181
|
-
});
|
|
182
|
-
doc.descendants((node, position, parent, index) => collector.visit(node, position, index > 0 ? parent?.maybeChild(index - 1) ?? void 0 : void 0));
|
|
183
|
-
return collector.finish();
|
|
184
|
-
};
|
|
185
176
|
/** Anchors an edit must put back, and where relative to the replacement. */
|
|
186
177
|
const ANCHOR_PLACEMENT = {
|
|
187
178
|
[COMMENT_REFERENCE_NODE_NAME]: "after",
|
|
@@ -712,4 +703,4 @@ const inheritedReplacementMarks = (doc, from, to) => {
|
|
|
712
703
|
const $from = doc.resolve(from);
|
|
713
704
|
return (to === from ? $from.marks() : $from.marksAcross(doc.resolve(to))) ?? Mark.none;
|
|
714
705
|
};
|
|
715
|
-
export { NON_INCLUSIVE_MARK_DISPOSITION, addCarriedMarks, annotatedReplacement, commentPoint, commentsAcrossBlockBoundary, commentsForTrackedInsertion, commentsSpanningInsertion, createResolvedCommentPointCollector, hasReplacedAnnotations, inheritedReplacementMarks, joinCommentStretches, nonInclusiveMarkNames, placeTrackedInsertion, preservesReplacementCommentAlignment,
|
|
706
|
+
export { NON_INCLUSIVE_MARK_DISPOSITION, addCarriedMarks, annotatedReplacement, commentPoint, commentsAcrossBlockBoundary, commentsForTrackedInsertion, commentsSpanningInsertion, createResolvedCommentPointCollector, hasReplacedAnnotations, inheritedReplacementMarks, joinCommentStretches, nonInclusiveMarkNames, placeTrackedInsertion, preservesReplacementCommentAlignment, splitAtKeptCommentBoundaries, surveyAcceptedReplacedAnnotations, surveyReplacedAnnotations };
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import { PropertyRevisionKind } from "@stll/docx-core/model";
|
|
1
|
+
import { ParagraphMarkChange, ParagraphMarkChangeKind, PropertyRevisionKind } from "@stll/docx-core/model";
|
|
2
2
|
import { Node } from "prosemirror-model";
|
|
3
|
+
export declare function isPPrMarkAttr(value: unknown): value is ParagraphMarkChange;
|
|
4
|
+
/**
|
|
5
|
+
* Whether the mark says the paragraph break was ADDED. A relocation's
|
|
6
|
+
* destination break was added exactly as an insertion's was, and its source
|
|
7
|
+
* break went exactly as a deletion's did; the kinds differ so a reader is told
|
|
8
|
+
* the two ends belong together, not because they resolve differently.
|
|
9
|
+
*/
|
|
10
|
+
export declare const paragraphMarkWasAdded: (kind: ParagraphMarkChangeKind) => boolean;
|
|
3
11
|
export declare const PROPERTY_REVISION_SITES: {
|
|
4
12
|
readonly runPropertyChange: {
|
|
5
13
|
readonly kind: "runPropertyChange";
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { PARAGRAPH_MARK_CHANGE_KINDS } from "@stll/docx-core/model";
|
|
2
2
|
// src/prosemirror/revisionCarriers.ts
|
|
3
|
+
function isPPrMarkAttr(value) {
|
|
4
|
+
if (typeof value !== "object" || value === null || !("kind" in value) || !("info" in value)) return false;
|
|
5
|
+
const { kind, info } = value;
|
|
6
|
+
if (!isParagraphMarkChangeKind(kind)) return false;
|
|
7
|
+
if (typeof info !== "object" || info === null) return false;
|
|
8
|
+
return "id" in info && typeof info.id === "number";
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Whether the mark says the paragraph break was ADDED. A relocation's
|
|
12
|
+
* destination break was added exactly as an insertion's was, and its source
|
|
13
|
+
* break went exactly as a deletion's did; the kinds differ so a reader is told
|
|
14
|
+
* the two ends belong together, not because they resolve differently.
|
|
15
|
+
*/
|
|
16
|
+
const paragraphMarkWasAdded = (kind) => kind === "ins" || kind === "moveTo";
|
|
3
17
|
const PROPERTY_REVISION_SITES = {
|
|
4
18
|
runPropertyChange: {
|
|
5
19
|
kind: "runPropertyChange",
|
|
@@ -155,4 +169,4 @@ const getFolioNodeRevisionCarriers = (node, nodePos) => {
|
|
|
155
169
|
}
|
|
156
170
|
return carriers;
|
|
157
171
|
};
|
|
158
|
-
export { PROPERTY_REVISION_SITES, getFolioNodeRevisionCarriers, nodePropertyRevisionSites, propertyRevisionMetadata, propertyRevisionRecords };
|
|
172
|
+
export { PROPERTY_REVISION_SITES, getFolioNodeRevisionCarriers, isPPrMarkAttr, nodePropertyRevisionSites, paragraphMarkWasAdded, propertyRevisionMetadata, propertyRevisionRecords };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { EditorState } from "prosemirror-state";
|
|
2
|
+
export type TableRowRevisionAttr = {
|
|
3
|
+
revisionId: number;
|
|
4
|
+
author?: string;
|
|
5
|
+
date?: string | null;
|
|
6
|
+
};
|
|
7
|
+
type TableCellRevisionAttr = {
|
|
8
|
+
kind: "ins" | "del";
|
|
9
|
+
info: {
|
|
10
|
+
revisionId: number;
|
|
11
|
+
};
|
|
12
|
+
} | {
|
|
13
|
+
kind: "merge";
|
|
14
|
+
info: {
|
|
15
|
+
revisionId: number;
|
|
16
|
+
};
|
|
17
|
+
verticalMerge?: "continue" | "rest";
|
|
18
|
+
verticalMergeOriginal?: "continue" | "rest";
|
|
19
|
+
};
|
|
20
|
+
export declare function isTableRowRevisionAttr(value: unknown): value is TableRowRevisionAttr;
|
|
21
|
+
export declare function isTableCellRevisionAttr(value: unknown): value is TableCellRevisionAttr;
|
|
22
|
+
/**
|
|
23
|
+
* Find the document range covered by all revision carriers with any of the
|
|
24
|
+
* given ids. Returns null when none are present (already accepted/rejected, or
|
|
25
|
+
* never existed). A replace operation typically passes two ids; standalone
|
|
26
|
+
* text, formatting, paragraph, section, and table revisions pass a single id.
|
|
27
|
+
*/
|
|
28
|
+
export declare function findAIEditRevisionRange(state: EditorState, revisionIds: number | readonly number[]): {
|
|
29
|
+
from: number;
|
|
30
|
+
to: number;
|
|
31
|
+
} | null;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { expectRunPropertyChangeMarkAttrs, expectTrackedChangeMarkAttrs } from "./attrs/index.js";
|
|
2
|
+
import { enclosingRevisionIds } from "./contentControlRevisions.js";
|
|
3
|
+
import "./extensions/nodes/SdtExtension.js";
|
|
4
|
+
import { getFolioNodeRevisionCarriers } from "./revisionCarriers.js";
|
|
5
|
+
import { getTableCellMergeChange } from "./tableCellMergeRevision.js";
|
|
6
|
+
// src/prosemirror/revisionRangeQueries.ts
|
|
7
|
+
function isTableRowRevisionAttr(value) {
|
|
8
|
+
return typeof value === "object" && value !== null && "revisionId" in value && typeof value.revisionId === "number";
|
|
9
|
+
}
|
|
10
|
+
function isTableCellRevisionAttr(value) {
|
|
11
|
+
if (typeof value !== "object" || value === null || !("kind" in value) || !("info" in value)) return false;
|
|
12
|
+
if (value.kind !== "ins" && value.kind !== "del" && value.kind !== "merge") return false;
|
|
13
|
+
const info = value.info;
|
|
14
|
+
return typeof info === "object" && info !== null && "revisionId" in info && typeof info.revisionId === "number";
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Find the document range covered by all revision carriers with any of the
|
|
18
|
+
* given ids. Returns null when none are present (already accepted/rejected, or
|
|
19
|
+
* never existed). A replace operation typically passes two ids; standalone
|
|
20
|
+
* text, formatting, paragraph, section, and table revisions pass a single id.
|
|
21
|
+
*/
|
|
22
|
+
function findAIEditRevisionRange(state, revisionIds) {
|
|
23
|
+
const insertionType = state.schema.marks["insertion"];
|
|
24
|
+
const deletionType = state.schema.marks["deletion"];
|
|
25
|
+
const runPropertyChangeType = state.schema.marks["runPropertyChange"];
|
|
26
|
+
const idSet = new Set(typeof revisionIds === "number" ? [revisionIds] : revisionIds);
|
|
27
|
+
const range = {
|
|
28
|
+
from: null,
|
|
29
|
+
to: null
|
|
30
|
+
};
|
|
31
|
+
const includeRange = (from, to) => {
|
|
32
|
+
if (range.from === null || from < range.from) range.from = from;
|
|
33
|
+
if (range.to === null || to > range.to) range.to = to;
|
|
34
|
+
};
|
|
35
|
+
state.doc.descendants((node, pos) => {
|
|
36
|
+
for (const carrier of getFolioNodeRevisionCarriers(node, pos)) if (idSet.has(carrier.id)) includeRange(carrier.from, carrier.to);
|
|
37
|
+
if (node.type.name === "sdt" && enclosingRevisionIds(node).some((id) => idSet.has(id))) includeRange(pos, pos + node.nodeSize);
|
|
38
|
+
if (node.type.name === "tableRow") for (const attrName of ["trIns", "trDel"]) {
|
|
39
|
+
const marker = node.attrs[attrName];
|
|
40
|
+
if (isTableRowRevisionAttr(marker) && idSet.has(marker.revisionId)) {
|
|
41
|
+
includeRange(pos, pos + node.nodeSize);
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (node.type.name === "tableCell" || node.type.name === "tableHeader") {
|
|
46
|
+
const marker = node.attrs["cellMarker"];
|
|
47
|
+
const hasDirectRevision = isTableCellRevisionAttr(marker) && idSet.has(marker.info.revisionId);
|
|
48
|
+
const continuationCells = node.attrs["_docxVMergeContinuationCells"];
|
|
49
|
+
const hasCollapsedRevision = Array.isArray(continuationCells) && continuationCells.some((cell) => {
|
|
50
|
+
const change = getTableCellMergeChange(cell);
|
|
51
|
+
return change !== null && idSet.has(change.info.id);
|
|
52
|
+
});
|
|
53
|
+
if (hasDirectRevision || hasCollapsedRevision) {
|
|
54
|
+
includeRange(pos, pos + node.nodeSize);
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (!node.isInline) return;
|
|
59
|
+
for (const mark of node.marks) {
|
|
60
|
+
if (mark.type === runPropertyChangeType && expectRunPropertyChangeMarkAttrs(mark).changes.some((change) => idSet.has(change.info.id))) {
|
|
61
|
+
includeRange(pos, pos + node.nodeSize);
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
if ((mark.type === insertionType || mark.type === deletionType) && (idSet.has(expectTrackedChangeMarkAttrs(mark).revisionId) || (expectTrackedChangeMarkAttrs(mark)._docxRevisionAncestors ?? []).some((ancestor) => idSet.has(ancestor.revisionId)))) {
|
|
65
|
+
includeRange(pos, pos + node.nodeSize);
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
if (range.from === null || range.to === null) return null;
|
|
71
|
+
return {
|
|
72
|
+
from: range.from,
|
|
73
|
+
to: range.to
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export { findAIEditRevisionRange, isTableCellRevisionAttr, isTableRowRevisionAttr };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Single source of truth shared by every place that must swap a run's live
|
|
5
5
|
* formatting back to a previously recorded set: rejecting a `runPropertyChange`
|
|
6
|
-
* (
|
|
6
|
+
* (the reference editor) and stripping a *suggested* `runPropertyChange` at the
|
|
7
7
|
* serialization boundary (conversion/fromProseDoc.ts). Keeping one list makes
|
|
8
8
|
* it structurally impossible for the two paths to drift and let a formatting
|
|
9
9
|
* mark survive a revert.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Single source of truth shared by every place that must swap a run's live
|
|
6
6
|
* formatting back to a previously recorded set: rejecting a `runPropertyChange`
|
|
7
|
-
* (
|
|
7
|
+
* (the reference editor) and stripping a *suggested* `runPropertyChange` at the
|
|
8
8
|
* serialization boundary (conversion/fromProseDoc.ts). Keeping one list makes
|
|
9
9
|
* it structurally impossible for the two paths to drift and let a formatting
|
|
10
10
|
* mark survive a revert.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { ParagraphPropertyChangeAttrs } from "./schema/nodes.js";
|
|
2
|
+
import { EditorState } from "prosemirror-state";
|
|
3
|
+
import { ParagraphMarkChange } from "@stll/docx-core/model";
|
|
4
|
+
import { Mark, Node } from "prosemirror-model";
|
|
5
|
+
export declare const isSuggestionMark: (mark: Mark) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* The suggestion a comment mark belongs to: a comment a suggestion proposed
|
|
8
|
+
* is pending with it, never saved, accepted and rejected with it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const suggestedCommentOf: (mark: Mark) => string | null;
|
|
11
|
+
/** The ids of the comments a pending suggestion proposes. */
|
|
12
|
+
export declare function suggestionCommentIds(state: EditorState, suggestionId: string): number[];
|
|
13
|
+
export type SuggestionKind = "insertion" | "deletion" | "formatting" | "insertBlock" | "insertTable" | "insertRow" | "deleteRow" | "insertColumn" | "deleteColumn" | "comment";
|
|
14
|
+
/**
|
|
15
|
+
* How a suggestion is applied when accepted:
|
|
16
|
+
* - `"tracked"` — converts to a normal OOXML tracked change (`w:ins`/`w:del`,
|
|
17
|
+
* paragraph-mark `w:ins`, row/cell `w:ins`/`w:del`);
|
|
18
|
+
* - `"direct"` — no OOXML tracked representation exists (a whole inserted
|
|
19
|
+
* table), so accepting applies it directly; a suggestion that only
|
|
20
|
+
* proposes a comment is accepted as an ordinary comment;
|
|
21
|
+
* - `"mixed"` — a heterogeneous group (one `suggestionId` spanning a whole
|
|
22
|
+
* inserted table AND other edits) whose parts apply both ways. Accept still
|
|
23
|
+
* resolves the whole group in one transaction; this flag lets the host
|
|
24
|
+
* message that some parts landed directly.
|
|
25
|
+
*/
|
|
26
|
+
export type SuggestionAppliedAs = "tracked" | "direct" | "mixed";
|
|
27
|
+
export type FolioSuggestion = {
|
|
28
|
+
suggestionId: string;
|
|
29
|
+
/** Contiguous document ranges the suggestion covers, in document order. */
|
|
30
|
+
ranges: readonly {
|
|
31
|
+
from: number;
|
|
32
|
+
to: number;
|
|
33
|
+
}[];
|
|
34
|
+
/** Which kinds of change the suggestion contains (deduped, in a stable order). */
|
|
35
|
+
kinds: readonly SuggestionKind[];
|
|
36
|
+
/** How accepting this suggestion applies it (see {@link SuggestionAppliedAs}). */
|
|
37
|
+
appliedAs: SuggestionAppliedAs;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* A node-attr (block/table) suggestion read off a single node: a whole-node
|
|
41
|
+
* `_suggestedInsert`, or a suggested `trIns`/`trDel`/`cellMarker`.
|
|
42
|
+
*/
|
|
43
|
+
type StructuralSuggestion = {
|
|
44
|
+
suggestionId: string;
|
|
45
|
+
revisionId: number;
|
|
46
|
+
kind: SuggestionKind;
|
|
47
|
+
/** True for a whole-node insert (paragraph/table): rejected by node deletion. */
|
|
48
|
+
isNodeInsert: boolean;
|
|
49
|
+
};
|
|
50
|
+
export declare const readSuggestedMarker: (marker: unknown) => {
|
|
51
|
+
suggestionId: string;
|
|
52
|
+
revisionId: number;
|
|
53
|
+
} | null;
|
|
54
|
+
export declare const readSuggestedParagraphPropertyChange: (change: ParagraphPropertyChangeAttrs) => {
|
|
55
|
+
suggestionId: string;
|
|
56
|
+
revisionId: number;
|
|
57
|
+
} | null;
|
|
58
|
+
type SuggestedParagraphMark = {
|
|
59
|
+
suggestionId: string;
|
|
60
|
+
revisionId: number;
|
|
61
|
+
kind: SuggestionKind;
|
|
62
|
+
};
|
|
63
|
+
/** The suggestion one paragraph-mark record belongs to, read off its info. */
|
|
64
|
+
export declare const suggestionIdOfMarkRecord: (info: ParagraphMarkChange["info"]) => string | null;
|
|
65
|
+
/** The suggestion the paragraph mark's own record, its break's, belongs to. */
|
|
66
|
+
export declare const readSuggestedParagraphMark: (node: Node) => SuggestedParagraphMark | null;
|
|
67
|
+
export declare const readStructuralSuggestion: (node: Node) => StructuralSuggestion | null;
|
|
68
|
+
type SuggestionAccumulator = {
|
|
69
|
+
segments: {
|
|
70
|
+
from: number;
|
|
71
|
+
to: number;
|
|
72
|
+
}[];
|
|
73
|
+
kinds: Set<SuggestionKind>;
|
|
74
|
+
revisionIds: Set<number>;
|
|
75
|
+
/** The comments the suggestion proposes. */
|
|
76
|
+
commentIds: Set<number>;
|
|
77
|
+
};
|
|
78
|
+
export declare const collectSuggestions: (state: EditorState) => Map<string, SuggestionAccumulator>;
|
|
79
|
+
/** Merge sorted, possibly adjacent/overlapping segments into contiguous ranges. */
|
|
80
|
+
export declare const mergeSegments: (segments: readonly {
|
|
81
|
+
from: number;
|
|
82
|
+
to: number;
|
|
83
|
+
}[]) => {
|
|
84
|
+
from: number;
|
|
85
|
+
to: number;
|
|
86
|
+
}[];
|
|
87
|
+
/**
|
|
88
|
+
* List every suggestion in the document for host consumption: its id, the
|
|
89
|
+
* contiguous ranges it covers, which kinds of change it contains, and how
|
|
90
|
+
* accepting it applies (tracked vs direct).
|
|
91
|
+
*/
|
|
92
|
+
export declare function getSuggestions(state: EditorState): FolioSuggestion[];
|
|
93
|
+
/** The disjoint projected ranges a single pending suggestion covers. */
|
|
94
|
+
export declare const getSuggestionRanges: (state: EditorState, suggestionId: string) => {
|
|
95
|
+
from: number;
|
|
96
|
+
to: number;
|
|
97
|
+
}[];
|
|
98
|
+
/** Physical revision IDs of every pending suggestion, in one document walk. */
|
|
99
|
+
export declare const pendingSuggestionRevisionIds: (state: EditorState) => ReadonlySet<number>;
|
|
100
|
+
/** The first owning suggestion for each physical revision, in source order. */
|
|
101
|
+
export declare const suggestionOwnersByRevision: (state: EditorState) => ReadonlyMap<number, string>;
|
|
102
|
+
/** The suggestion a revision belongs to, or `null` for an ordinary tracked change. */
|
|
103
|
+
export declare function suggestionIdOfRevision(state: EditorState, revisionId: number): string | null;
|
|
104
|
+
/**
|
|
105
|
+
* The document range covering every mark belonging to `suggestionId`, plus the
|
|
106
|
+
* revision ids those marks carry. Returns null when the suggestion is absent
|
|
107
|
+
* (already accepted/rejected, or never existed).
|
|
108
|
+
*/
|
|
109
|
+
export declare function findSuggestionRange(state: EditorState, suggestionId: string): {
|
|
110
|
+
from: number;
|
|
111
|
+
to: number;
|
|
112
|
+
revisionIds: number[];
|
|
113
|
+
} | null;
|
|
114
|
+
export {};
|