markloom 0.5.1 → 0.6.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/PACKAGES.md +26 -0
- package/README.md +20 -2
- package/collab.md +42 -7
- package/dist/ai/index.cjs +4 -4
- package/dist/ai/index.d.cts +5 -4
- package/dist/ai/index.d.ts +5 -4
- package/dist/ai/index.js +3 -3
- package/dist/ai/theme.css +66 -102
- package/dist/{chunk-VXM7Q6P5.cjs → chunk-ACFYBYZJ.cjs} +2604 -966
- package/dist/chunk-CGYCJORO.js +759 -0
- package/dist/chunk-EADZKEU4.cjs +498 -0
- package/dist/chunk-EJSFZHGT.js +24 -0
- package/dist/{chunk-YIFOGP2D.cjs → chunk-I5VK4U7J.cjs} +103 -60
- package/dist/{chunk-ZMTLSFLO.js → chunk-KYZJIOOL.js} +2138 -500
- package/dist/chunk-QEVME6ZU.cjs +759 -0
- package/dist/{chunk-MFYF2A6U.js → chunk-SNFF6X45.js} +51 -1
- package/dist/{chunk-FCH7LZFI.js → chunk-TB2OY3D4.js} +50 -7
- package/dist/{chunk-4TMHVNL6.cjs → chunk-TWD5T4YC.cjs} +155 -105
- package/dist/{chunk-JS527FDV.cjs → chunk-U3JZDFL4.cjs} +49 -9
- package/dist/{chunk-RLTHVQNQ.js → chunk-VSBIMMI7.js} +45 -5
- package/dist/chunk-YBAT343I.js +498 -0
- package/dist/chunk-ZKQSQSSM.cjs +24 -0
- package/dist/{client-ZRZj2nkq.d.cts → client-CLYq17SW.d.ts} +63 -7
- package/dist/{client-6KiH4kGK.d.ts → client-DAth8pPq.d.cts} +63 -7
- package/dist/collab/index.cjs +16 -4
- package/dist/collab/index.d.cts +19 -6
- package/dist/collab/index.d.ts +19 -6
- package/dist/collab/index.js +18 -6
- package/dist/{controller-BNuuUM3E.d.ts → controller-6AJ36G52.d.ts} +99 -7
- package/dist/{controller-DQITsFhy.d.cts → controller-BIOO_XKJ.d.cts} +99 -7
- package/dist/index.cjs +57 -7
- package/dist/index.d.cts +18 -5
- package/dist/index.d.ts +18 -5
- package/dist/index.js +54 -4
- package/dist/io/index.cjs +1413 -0
- package/dist/io/index.d.cts +33 -0
- package/dist/io/index.d.ts +33 -0
- package/dist/io/index.js +1413 -0
- package/dist/react/index.cjs +8 -8
- package/dist/react/index.d.cts +5 -4
- package/dist/react/index.d.ts +5 -4
- package/dist/react/index.js +7 -7
- package/dist/{rebase-batch-8rL_aXEE.d.ts → rebase-batch-DlerAcFN.d.ts} +11 -9
- package/dist/{rebase-batch-bYnBJpRO.d.cts → rebase-batch-PjENQ742.d.cts} +11 -9
- package/dist/suggest-Bk4zLzuv.d.ts +120 -0
- package/dist/suggest-BkGGiPKA.d.cts +120 -0
- package/dist/types-COUweEav.d.cts +30 -0
- package/dist/types-COUweEav.d.ts +30 -0
- package/dist/versions-9mG1epfB.d.cts +51 -0
- package/dist/versions-Bubyo4pt.d.ts +51 -0
- package/dist/view/index.cjs +56 -12
- package/dist/view/index.d.cts +203 -11
- package/dist/view/index.d.ts +203 -11
- package/dist/view/index.js +52 -8
- package/dist/view/theme.css +1829 -1587
- package/io.md +38 -0
- package/package.json +21 -5
- package/dist/chunk-4JSJAHTB.js +0 -255
- package/dist/chunk-ALZ3A5CS.cjs +0 -255
- package/dist/chunk-GQ2HHRGI.cjs +0 -16
- package/dist/chunk-LA5SBCGQ.js +0 -16
- package/dist/chunk-LEYAQNJA.js +0 -220
- package/dist/chunk-YXQDCW4Y.cjs +0 -220
- package/dist/comments-DlExS6f-.d.cts +0 -43
- package/dist/comments-PhnR7Gkn.d.ts +0 -43
- package/dist/step-BrvHIK7O.d.cts +0 -65
- package/dist/step-BrvHIK7O.d.ts +0 -65
|
@@ -0,0 +1,759 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunkTWD5T4YCcjs = require('./chunk-TWD5T4YC.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkU3JZDFL4cjs = require('./chunk-U3JZDFL4.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkZKQSQSSMcjs = require('./chunk-ZKQSQSSM.cjs');
|
|
18
|
+
|
|
19
|
+
// src/tree/history.ts
|
|
20
|
+
function init(doc, validate) {
|
|
21
|
+
return { doc, past: [], future: [], validate };
|
|
22
|
+
}
|
|
23
|
+
function gate(h, next) {
|
|
24
|
+
const v = _optionalChain([h, 'access', _ => _.validate, 'optionalCall', _2 => _2(next)]);
|
|
25
|
+
if (v)
|
|
26
|
+
throw new Error(`[invariant] \u63D0\u4EA4\u4EA7\u751F\u975E\u6CD5 doc: ${v}`);
|
|
27
|
+
}
|
|
28
|
+
function commit(h, steps, before, after) {
|
|
29
|
+
const inverse = _chunkTWD5T4YCcjs.invertAll.call(void 0, h.doc, steps);
|
|
30
|
+
const next = _chunkTWD5T4YCcjs.applyAll.call(void 0, h.doc, steps);
|
|
31
|
+
gate(h, next);
|
|
32
|
+
const entry = { steps, inverse };
|
|
33
|
+
if (before)
|
|
34
|
+
entry.before = before;
|
|
35
|
+
if (after)
|
|
36
|
+
entry.after = after;
|
|
37
|
+
return { ...h, doc: next, past: h.past.concat(entry), future: [] };
|
|
38
|
+
}
|
|
39
|
+
function applyForeign(h, steps, thisSite = 0, foreignSite = 1) {
|
|
40
|
+
if (steps.length === 0)
|
|
41
|
+
return h;
|
|
42
|
+
const next = _chunkTWD5T4YCcjs.applyAll.call(void 0, h.doc, steps);
|
|
43
|
+
gate(h, next);
|
|
44
|
+
const overs = [{ siteId: foreignSite, steps }];
|
|
45
|
+
const mapCommit = (c) => {
|
|
46
|
+
const fwd = _chunkU3JZDFL4cjs.rebaseStepsThrough.call(void 0, c.steps, overs, thisSite);
|
|
47
|
+
const inv = _chunkU3JZDFL4cjs.rebaseStepsThrough.call(void 0, c.inverse, overs, thisSite);
|
|
48
|
+
if (fwd.length === 0 && inv.length === 0)
|
|
49
|
+
return null;
|
|
50
|
+
const entry = { steps: fwd, inverse: inv };
|
|
51
|
+
const b = _chunkU3JZDFL4cjs.mapSelectionThrough.call(void 0, c.before, steps);
|
|
52
|
+
const a = _chunkU3JZDFL4cjs.mapSelectionThrough.call(void 0, c.after, steps);
|
|
53
|
+
if (b)
|
|
54
|
+
entry.before = b;
|
|
55
|
+
if (a)
|
|
56
|
+
entry.after = a;
|
|
57
|
+
return entry;
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
...h,
|
|
61
|
+
doc: next,
|
|
62
|
+
past: h.past.map(mapCommit).filter((c) => c != null),
|
|
63
|
+
future: h.future.map(mapCommit).filter((c) => c != null)
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function amend(h, more, after, before) {
|
|
67
|
+
if (more.length === 0)
|
|
68
|
+
return h;
|
|
69
|
+
if (h.past.length === 0)
|
|
70
|
+
return commit(h, more, before, after);
|
|
71
|
+
const last = h.past[h.past.length - 1];
|
|
72
|
+
const docBefore = _chunkTWD5T4YCcjs.applyAll.call(void 0, h.doc, last.inverse);
|
|
73
|
+
const steps = last.steps.concat(more);
|
|
74
|
+
const inverse = _chunkTWD5T4YCcjs.invertAll.call(void 0, docBefore, steps);
|
|
75
|
+
const next = _chunkTWD5T4YCcjs.applyAll.call(void 0, docBefore, steps);
|
|
76
|
+
gate(h, next);
|
|
77
|
+
const entry = { steps, inverse };
|
|
78
|
+
if (last.before)
|
|
79
|
+
entry.before = last.before;
|
|
80
|
+
if (after)
|
|
81
|
+
entry.after = after;
|
|
82
|
+
else if (last.after)
|
|
83
|
+
entry.after = last.after;
|
|
84
|
+
return {
|
|
85
|
+
...h,
|
|
86
|
+
doc: next,
|
|
87
|
+
past: h.past.slice(0, -1).concat(entry),
|
|
88
|
+
future: []
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function undo(h) {
|
|
92
|
+
const last = h.past[h.past.length - 1];
|
|
93
|
+
if (!last)
|
|
94
|
+
return h;
|
|
95
|
+
const next = _chunkTWD5T4YCcjs.applyAll.call(void 0, h.doc, last.inverse);
|
|
96
|
+
gate(h, next);
|
|
97
|
+
return { ...h, doc: next, past: h.past.slice(0, -1), future: [last, ...h.future] };
|
|
98
|
+
}
|
|
99
|
+
function redo(h) {
|
|
100
|
+
const next = h.future[0];
|
|
101
|
+
if (!next)
|
|
102
|
+
return h;
|
|
103
|
+
const doc = _chunkTWD5T4YCcjs.applyAll.call(void 0, h.doc, next.steps);
|
|
104
|
+
gate(h, doc);
|
|
105
|
+
return { ...h, doc, past: h.past.concat(next), future: h.future.slice(1) };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// src/tree/invariants.ts
|
|
109
|
+
function invariants(schema, doc) {
|
|
110
|
+
const out = [];
|
|
111
|
+
out.push(..._chunkTWD5T4YCcjs.validateAll.call(void 0, schema, doc));
|
|
112
|
+
const ids = /* @__PURE__ */ new Map();
|
|
113
|
+
walk(doc, [], schema, out, ids);
|
|
114
|
+
return out;
|
|
115
|
+
}
|
|
116
|
+
function walk(node, path, schema, out, ids) {
|
|
117
|
+
if (_chunkZKQSQSSMcjs.isText.call(void 0, node)) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (node.id !== void 0) {
|
|
121
|
+
ids.set(node.id, (_nullishCoalesce(ids.get(node.id), () => ( 0))) + 1);
|
|
122
|
+
if (ids.get(node.id) === 2) {
|
|
123
|
+
out.push({ path, reason: `\u91CD\u590D id "${node.id}"` });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const spec = schema.nodes[node.type];
|
|
127
|
+
if (_optionalChain([spec, 'optionalAccess', _3 => _3.atom])) {
|
|
128
|
+
if (node.type === "image") {
|
|
129
|
+
if (!_optionalChain([node, 'access', _4 => _4.attrs, 'optionalAccess', _5 => _5.url]))
|
|
130
|
+
out.push({ path, reason: `[image] \u7F3A url` });
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (node.type === "mention") {
|
|
134
|
+
if (!_optionalChain([node, 'access', _6 => _6.attrs, 'optionalAccess', _7 => _7.id]))
|
|
135
|
+
out.push({ path, reason: `[mention] \u7F3A id` });
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (node.type === "math") {
|
|
139
|
+
if (typeof _optionalChain([node, 'access', _8 => _8.attrs, 'optionalAccess', _9 => _9.latex]) !== "string")
|
|
140
|
+
out.push({ path, reason: `[math] \u7F3A latex` });
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (node.type === "embed") {
|
|
144
|
+
if (!_optionalChain([node, 'access', _10 => _10.attrs, 'optionalAccess', _11 => _11.kind]))
|
|
145
|
+
out.push({ path, reason: `[embed] \u7F3A kind` });
|
|
146
|
+
if (!_optionalChain([node, 'access', _12 => _12.attrs, 'optionalAccess', _13 => _13.src]))
|
|
147
|
+
out.push({ path, reason: `[embed] \u7F3A src` });
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
for (const reason of _chunkTWD5T4YCcjs.checkTable.call(void 0, node)) {
|
|
151
|
+
out.push({ path, reason: `[table] ${reason}` });
|
|
152
|
+
}
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (_optionalChain([spec, 'optionalAccess', _14 => _14.marks])) {
|
|
156
|
+
for (let i = 0; i < node.children.length; i++) {
|
|
157
|
+
const child = node.children[i];
|
|
158
|
+
if (_chunkZKQSQSSMcjs.isText.call(void 0, child) && child.marks) {
|
|
159
|
+
for (const m of child.marks) {
|
|
160
|
+
if (!spec.marks.includes(m.name)) {
|
|
161
|
+
out.push({ path: path.concat(i), reason: `${node.type} \u4E0D\u5141\u8BB8 mark "${m.name}"` });
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
for (let i = 0; i < node.children.length; i++) {
|
|
168
|
+
walk(node.children[i], path.concat(i), schema, out, ids);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function firstViolation(vs) {
|
|
172
|
+
if (vs.length === 0) {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
const v = vs[0];
|
|
176
|
+
return `${v.path.join(",")}: ${v.reason}`;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// src/tree/toc.ts
|
|
180
|
+
function headingText(node) {
|
|
181
|
+
let out = "";
|
|
182
|
+
for (const c of node.children) {
|
|
183
|
+
if (_chunkZKQSQSSMcjs.isText.call(void 0, c))
|
|
184
|
+
out += c.text;
|
|
185
|
+
}
|
|
186
|
+
return out;
|
|
187
|
+
}
|
|
188
|
+
function outline(doc) {
|
|
189
|
+
const out = [];
|
|
190
|
+
const walk3 = (node, path) => {
|
|
191
|
+
if (_chunkZKQSQSSMcjs.isText.call(void 0, node))
|
|
192
|
+
return;
|
|
193
|
+
if (node.type === "heading") {
|
|
194
|
+
const level = Math.min(Math.max(Number(_nullishCoalesce(_optionalChain([node, 'access', _15 => _15.attrs, 'optionalAccess', _16 => _16.depth]), () => ( 1))), 1), 6);
|
|
195
|
+
out.push({ level, text: headingText(node), path, id: node.id });
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
for (let i = 0; i < node.children.length; i++)
|
|
199
|
+
walk3(node.children[i], path.concat(i));
|
|
200
|
+
};
|
|
201
|
+
walk3(doc, []);
|
|
202
|
+
return out;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// src/tree/comments.ts
|
|
206
|
+
function commentIdsInDoc(doc) {
|
|
207
|
+
const ids = /* @__PURE__ */ new Set();
|
|
208
|
+
const walk3 = (n) => {
|
|
209
|
+
if (_chunkZKQSQSSMcjs.isText.call(void 0, n)) {
|
|
210
|
+
for (const m of _nullishCoalesce(n.marks, () => ( []))) {
|
|
211
|
+
if (m.name === "comment" && _optionalChain([m, 'access', _17 => _17.attrs, 'optionalAccess', _18 => _18.id]) != null)
|
|
212
|
+
ids.add(String(m.attrs.id));
|
|
213
|
+
}
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
if (_chunkZKQSQSSMcjs.isElement.call(void 0, n))
|
|
217
|
+
for (const c of n.children)
|
|
218
|
+
walk3(c);
|
|
219
|
+
};
|
|
220
|
+
walk3(doc);
|
|
221
|
+
return ids;
|
|
222
|
+
}
|
|
223
|
+
function stripLeaf(leaf, id) {
|
|
224
|
+
const rest = (_nullishCoalesce(leaf.marks, () => ( []))).filter((m) => !(m.name === "comment" && String(_optionalChain([m, 'access', _19 => _19.attrs, 'optionalAccess', _20 => _20.id])) === id));
|
|
225
|
+
return rest.length ? { ...leaf, marks: rest } : { text: leaf.text };
|
|
226
|
+
}
|
|
227
|
+
function stripCommentMarks(doc, id) {
|
|
228
|
+
const steps = [];
|
|
229
|
+
const walk3 = (node, path) => {
|
|
230
|
+
if (node.children.every((c) => _chunkZKQSQSSMcjs.isText.call(void 0, c) || _chunkZKQSQSSMcjs.isInlineAtom.call(void 0, c))) {
|
|
231
|
+
let changed = false;
|
|
232
|
+
const children = node.children.map((c) => {
|
|
233
|
+
if (!_chunkZKQSQSSMcjs.isText.call(void 0, c) || !_optionalChain([c, 'access', _21 => _21.marks, 'optionalAccess', _22 => _22.some, 'call', _23 => _23((m) => m.name === "comment" && String(_optionalChain([m, 'access', _24 => _24.attrs, 'optionalAccess', _25 => _25.id])) === id)]))
|
|
234
|
+
return c;
|
|
235
|
+
changed = true;
|
|
236
|
+
return stripLeaf(c, id);
|
|
237
|
+
});
|
|
238
|
+
if (changed)
|
|
239
|
+
steps.push({ kind: "replaceNode", path, node: { ...node, children } });
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
node.children.forEach((c, i) => {
|
|
243
|
+
if (_chunkZKQSQSSMcjs.isElement.call(void 0, c))
|
|
244
|
+
walk3(c, path.concat(i));
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
doc.children.forEach((c, i) => {
|
|
248
|
+
if (_chunkZKQSQSSMcjs.isElement.call(void 0, c))
|
|
249
|
+
walk3(c, [i]);
|
|
250
|
+
});
|
|
251
|
+
return steps;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// src/tree/search.ts
|
|
255
|
+
var DEFAULT_SKIP = ["code"];
|
|
256
|
+
function findText(doc, query, opts = {}) {
|
|
257
|
+
if (!query)
|
|
258
|
+
return [];
|
|
259
|
+
const skip = new Set(_nullishCoalesce(opts.skipTypes, () => ( DEFAULT_SKIP)));
|
|
260
|
+
const cs = opts.caseSensitive === true;
|
|
261
|
+
const needle = cs ? query : query.toLowerCase();
|
|
262
|
+
const out = [];
|
|
263
|
+
walk2(doc, [], skip, (path, text) => {
|
|
264
|
+
const hay = cs ? text : text.toLowerCase();
|
|
265
|
+
let from = 0;
|
|
266
|
+
while (from <= hay.length - needle.length) {
|
|
267
|
+
const i = hay.indexOf(needle, from);
|
|
268
|
+
if (i < 0)
|
|
269
|
+
break;
|
|
270
|
+
out.push({ path: path.slice(), offset: i, length: query.length });
|
|
271
|
+
from = i + Math.max(1, needle.length);
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
return out;
|
|
275
|
+
}
|
|
276
|
+
function replaceMatch(match, replacement) {
|
|
277
|
+
const del = {
|
|
278
|
+
kind: "deleteText",
|
|
279
|
+
path: match.path,
|
|
280
|
+
offset: match.offset,
|
|
281
|
+
length: match.length
|
|
282
|
+
};
|
|
283
|
+
if (!replacement)
|
|
284
|
+
return [del];
|
|
285
|
+
return [
|
|
286
|
+
del,
|
|
287
|
+
{
|
|
288
|
+
kind: "insertText",
|
|
289
|
+
path: match.path,
|
|
290
|
+
offset: match.offset,
|
|
291
|
+
text: replacement
|
|
292
|
+
}
|
|
293
|
+
];
|
|
294
|
+
}
|
|
295
|
+
function replaceAll(doc, query, replacement, opts = {}) {
|
|
296
|
+
if (!query)
|
|
297
|
+
return { steps: [], count: 0 };
|
|
298
|
+
const skip = new Set(_nullishCoalesce(opts.skipTypes, () => ( DEFAULT_SKIP)));
|
|
299
|
+
const cs = opts.caseSensitive === true;
|
|
300
|
+
const steps = [];
|
|
301
|
+
let count = 0;
|
|
302
|
+
walk2(doc, [], skip, (path, text, leaf) => {
|
|
303
|
+
const { text: next, n } = replaceInString(text, query, replacement, cs);
|
|
304
|
+
if (n === 0)
|
|
305
|
+
return;
|
|
306
|
+
count += n;
|
|
307
|
+
steps.push({
|
|
308
|
+
kind: "replaceNode",
|
|
309
|
+
path: path.slice(),
|
|
310
|
+
node: { ...leaf, text: next }
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
return { steps, count };
|
|
314
|
+
}
|
|
315
|
+
function applyReplaceAll(doc, query, replacement, opts = {}) {
|
|
316
|
+
const { steps } = replaceAll(doc, query, replacement, opts);
|
|
317
|
+
let d = doc;
|
|
318
|
+
for (const s of steps)
|
|
319
|
+
d = _chunkTWD5T4YCcjs.apply.call(void 0, d, s);
|
|
320
|
+
return d;
|
|
321
|
+
}
|
|
322
|
+
function replaceInString(text, query, replacement, caseSensitive) {
|
|
323
|
+
if (!query)
|
|
324
|
+
return { text, n: 0 };
|
|
325
|
+
if (caseSensitive) {
|
|
326
|
+
if (!text.includes(query))
|
|
327
|
+
return { text, n: 0 };
|
|
328
|
+
const parts = text.split(query);
|
|
329
|
+
return { text: parts.join(replacement), n: parts.length - 1 };
|
|
330
|
+
}
|
|
331
|
+
const needle = query.toLowerCase();
|
|
332
|
+
const hay = text.toLowerCase();
|
|
333
|
+
let out = "";
|
|
334
|
+
let i = 0;
|
|
335
|
+
let n = 0;
|
|
336
|
+
while (i < text.length) {
|
|
337
|
+
if (i <= text.length - query.length && hay.startsWith(needle, i)) {
|
|
338
|
+
out += replacement;
|
|
339
|
+
i += query.length;
|
|
340
|
+
n++;
|
|
341
|
+
} else {
|
|
342
|
+
out += text[i];
|
|
343
|
+
i++;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return { text: out, n };
|
|
347
|
+
}
|
|
348
|
+
function walk2(node, path, skip, onLeaf) {
|
|
349
|
+
if (_chunkZKQSQSSMcjs.isText.call(void 0, node)) {
|
|
350
|
+
onLeaf(path, node.text, node);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
if (!_chunkZKQSQSSMcjs.isElement.call(void 0, node))
|
|
354
|
+
return;
|
|
355
|
+
if (skip.has(node.type))
|
|
356
|
+
return;
|
|
357
|
+
for (let i = 0; i < node.children.length; i++)
|
|
358
|
+
walk2(node.children[i], path.concat(i), skip, onLeaf);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// src/tree/versions.ts
|
|
362
|
+
function cloneDoc(doc) {
|
|
363
|
+
return typeof structuredClone === "function" ? structuredClone(doc) : JSON.parse(JSON.stringify(doc));
|
|
364
|
+
}
|
|
365
|
+
function nid() {
|
|
366
|
+
return typeof crypto !== "undefined" && crypto.randomUUID ? crypto.randomUUID() : `v${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
|
|
367
|
+
}
|
|
368
|
+
function snapshotDoc(doc, name, id) {
|
|
369
|
+
const label = name.trim() || defaultName();
|
|
370
|
+
return {
|
|
371
|
+
id: _nullishCoalesce(id, () => ( nid())),
|
|
372
|
+
name: label,
|
|
373
|
+
createdAt: Date.now(),
|
|
374
|
+
doc: cloneDoc(doc)
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
function defaultName() {
|
|
378
|
+
const d = /* @__PURE__ */ new Date();
|
|
379
|
+
const p = (n) => n < 10 ? `0${n}` : `${n}`;
|
|
380
|
+
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
|
|
381
|
+
}
|
|
382
|
+
function pushVersion(list, v, max = 50) {
|
|
383
|
+
const next = list.filter((x) => x.id !== v.id).concat(v);
|
|
384
|
+
return next.length > max ? next.slice(next.length - max) : next;
|
|
385
|
+
}
|
|
386
|
+
function getVersion(list, id) {
|
|
387
|
+
return list.find((v) => v.id === id);
|
|
388
|
+
}
|
|
389
|
+
function removeVersion(list, id) {
|
|
390
|
+
return list.filter((v) => v.id !== id);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// src/tree/suggest.ts
|
|
394
|
+
function cmpPath(a, b) {
|
|
395
|
+
const n = Math.min(a.length, b.length);
|
|
396
|
+
for (let i = 0; i < n; i++) {
|
|
397
|
+
if (a[i] !== b[i])
|
|
398
|
+
return a[i] - b[i];
|
|
399
|
+
}
|
|
400
|
+
return a.length - b.length;
|
|
401
|
+
}
|
|
402
|
+
function suggestMark(id, kind, author) {
|
|
403
|
+
const attrs = { id, kind };
|
|
404
|
+
if (_optionalChain([author, 'optionalAccess', _26 => _26.id]))
|
|
405
|
+
attrs.authorId = author.id;
|
|
406
|
+
if (_optionalChain([author, 'optionalAccess', _27 => _27.name]))
|
|
407
|
+
attrs.authorName = author.name;
|
|
408
|
+
return { name: "suggest", attrs };
|
|
409
|
+
}
|
|
410
|
+
function isSuggestMark(m, id) {
|
|
411
|
+
if (m.name !== "suggest")
|
|
412
|
+
return false;
|
|
413
|
+
if (id == null)
|
|
414
|
+
return true;
|
|
415
|
+
return String(_nullishCoalesce(_optionalChain([m, 'access', _28 => _28.attrs, 'optionalAccess', _29 => _29.id]), () => ( ""))) === id;
|
|
416
|
+
}
|
|
417
|
+
function suggestIdsInDoc(doc) {
|
|
418
|
+
const ids = /* @__PURE__ */ new Set();
|
|
419
|
+
const walk3 = (n) => {
|
|
420
|
+
if (_chunkZKQSQSSMcjs.isText.call(void 0, n)) {
|
|
421
|
+
for (const m of _nullishCoalesce(n.marks, () => ( []))) {
|
|
422
|
+
if (m.name === "suggest" && _optionalChain([m, 'access', _30 => _30.attrs, 'optionalAccess', _31 => _31.id]) != null)
|
|
423
|
+
ids.add(String(m.attrs.id));
|
|
424
|
+
}
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
if (_chunkZKQSQSSMcjs.isElement.call(void 0, n))
|
|
428
|
+
for (const c of n.children)
|
|
429
|
+
walk3(c);
|
|
430
|
+
};
|
|
431
|
+
walk3(doc);
|
|
432
|
+
return ids;
|
|
433
|
+
}
|
|
434
|
+
function listSuggestions(doc) {
|
|
435
|
+
const order = [];
|
|
436
|
+
const map = /* @__PURE__ */ new Map();
|
|
437
|
+
const walk3 = (n) => {
|
|
438
|
+
if (_chunkZKQSQSSMcjs.isText.call(void 0, n)) {
|
|
439
|
+
for (const m of _nullishCoalesce(n.marks, () => ( []))) {
|
|
440
|
+
if (m.name !== "suggest" || _optionalChain([m, 'access', _32 => _32.attrs, 'optionalAccess', _33 => _33.id]) == null)
|
|
441
|
+
continue;
|
|
442
|
+
const id = String(m.attrs.id);
|
|
443
|
+
const kind = m.attrs.kind === "delete" ? "delete" : "insert";
|
|
444
|
+
const cur = map.get(id);
|
|
445
|
+
if (!cur) {
|
|
446
|
+
order.push(id);
|
|
447
|
+
map.set(id, {
|
|
448
|
+
id,
|
|
449
|
+
kind,
|
|
450
|
+
quote: n.text,
|
|
451
|
+
authorId: m.attrs.authorId != null ? String(m.attrs.authorId) : void 0,
|
|
452
|
+
authorName: m.attrs.authorName != null ? String(m.attrs.authorName) : void 0
|
|
453
|
+
});
|
|
454
|
+
} else {
|
|
455
|
+
cur.quote += n.text;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
if (_chunkZKQSQSSMcjs.isElement.call(void 0, n))
|
|
461
|
+
for (const c of n.children)
|
|
462
|
+
walk3(c);
|
|
463
|
+
};
|
|
464
|
+
walk3(doc);
|
|
465
|
+
return order.map((id) => map.get(id));
|
|
466
|
+
}
|
|
467
|
+
function stripLeaf2(leaf, id) {
|
|
468
|
+
const rest = (_nullishCoalesce(leaf.marks, () => ( []))).filter((m) => !isSuggestMark(m, id));
|
|
469
|
+
return rest.length ? { ...leaf, marks: rest } : { text: leaf.text };
|
|
470
|
+
}
|
|
471
|
+
function leafHasSuggest(leaf, id) {
|
|
472
|
+
return (_nullishCoalesce(leaf.marks, () => ( []))).some((m) => isSuggestMark(m, id));
|
|
473
|
+
}
|
|
474
|
+
function leafSuggestKind(leaf, id) {
|
|
475
|
+
const m = (_nullishCoalesce(leaf.marks, () => ( []))).find((m2) => isSuggestMark(m2, id));
|
|
476
|
+
if (!m)
|
|
477
|
+
return null;
|
|
478
|
+
return _optionalChain([m, 'access', _34 => _34.attrs, 'optionalAccess', _35 => _35.kind]) === "delete" ? "delete" : "insert";
|
|
479
|
+
}
|
|
480
|
+
function stripSuggestMarks(doc, id) {
|
|
481
|
+
const steps = [];
|
|
482
|
+
const walk3 = (node, path) => {
|
|
483
|
+
if (node.children.every((c) => _chunkZKQSQSSMcjs.isText.call(void 0, c) || _chunkZKQSQSSMcjs.isInlineAtom.call(void 0, c))) {
|
|
484
|
+
let changed = false;
|
|
485
|
+
const children = node.children.map((c) => {
|
|
486
|
+
if (!_chunkZKQSQSSMcjs.isText.call(void 0, c) || !leafHasSuggest(c, id))
|
|
487
|
+
return c;
|
|
488
|
+
changed = true;
|
|
489
|
+
return stripLeaf2(c, id);
|
|
490
|
+
});
|
|
491
|
+
if (changed)
|
|
492
|
+
steps.push({ kind: "replaceNode", path, node: { ...node, children } });
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
node.children.forEach((c, i) => {
|
|
496
|
+
if (_chunkZKQSQSSMcjs.isElement.call(void 0, c))
|
|
497
|
+
walk3(c, path.concat(i));
|
|
498
|
+
});
|
|
499
|
+
};
|
|
500
|
+
doc.children.forEach((c, i) => {
|
|
501
|
+
if (_chunkZKQSQSSMcjs.isElement.call(void 0, c))
|
|
502
|
+
walk3(c, [i]);
|
|
503
|
+
});
|
|
504
|
+
return steps;
|
|
505
|
+
}
|
|
506
|
+
function dropSuggestText(doc, id) {
|
|
507
|
+
const steps = [];
|
|
508
|
+
const walk3 = (node, path) => {
|
|
509
|
+
if (node.children.every((c) => _chunkZKQSQSSMcjs.isText.call(void 0, c) || _chunkZKQSQSSMcjs.isInlineAtom.call(void 0, c))) {
|
|
510
|
+
let changed = false;
|
|
511
|
+
const children = [];
|
|
512
|
+
for (const c of node.children) {
|
|
513
|
+
if (_chunkZKQSQSSMcjs.isText.call(void 0, c) && leafHasSuggest(c, id)) {
|
|
514
|
+
changed = true;
|
|
515
|
+
continue;
|
|
516
|
+
}
|
|
517
|
+
children.push(c);
|
|
518
|
+
}
|
|
519
|
+
if (changed) {
|
|
520
|
+
const next = children.length ? children : [{ text: "" }];
|
|
521
|
+
steps.push({ kind: "replaceNode", path, node: { ...node, children: next } });
|
|
522
|
+
}
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
node.children.forEach((c, i) => {
|
|
526
|
+
if (_chunkZKQSQSSMcjs.isElement.call(void 0, c))
|
|
527
|
+
walk3(c, path.concat(i));
|
|
528
|
+
});
|
|
529
|
+
};
|
|
530
|
+
doc.children.forEach((c, i) => {
|
|
531
|
+
if (_chunkZKQSQSSMcjs.isElement.call(void 0, c))
|
|
532
|
+
walk3(c, [i]);
|
|
533
|
+
});
|
|
534
|
+
return steps;
|
|
535
|
+
}
|
|
536
|
+
function kindOfId(doc, id) {
|
|
537
|
+
let kind = "insert";
|
|
538
|
+
const walk3 = (n) => {
|
|
539
|
+
if (_chunkZKQSQSSMcjs.isText.call(void 0, n)) {
|
|
540
|
+
const k = leafSuggestKind(n, id);
|
|
541
|
+
if (k) {
|
|
542
|
+
kind = k;
|
|
543
|
+
return true;
|
|
544
|
+
}
|
|
545
|
+
return false;
|
|
546
|
+
}
|
|
547
|
+
if (_chunkZKQSQSSMcjs.isElement.call(void 0, n)) {
|
|
548
|
+
for (const c of n.children) {
|
|
549
|
+
if (walk3(c))
|
|
550
|
+
return true;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
return false;
|
|
554
|
+
};
|
|
555
|
+
walk3(doc);
|
|
556
|
+
return kind;
|
|
557
|
+
}
|
|
558
|
+
function acceptSuggestion(doc, id) {
|
|
559
|
+
return kindOfId(doc, id) === "delete" ? dropSuggestText(doc, id) : stripSuggestMarks(doc, id);
|
|
560
|
+
}
|
|
561
|
+
function rejectSuggestion(doc, id) {
|
|
562
|
+
return kindOfId(doc, id) === "delete" ? stripSuggestMarks(doc, id) : dropSuggestText(doc, id);
|
|
563
|
+
}
|
|
564
|
+
function split(path) {
|
|
565
|
+
return {
|
|
566
|
+
blockPath: path.slice(0, -2),
|
|
567
|
+
leafIdx: path[path.length - 2],
|
|
568
|
+
char: path[path.length - 1]
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
function blockChar(children, leafIdx, char) {
|
|
572
|
+
let n = 0;
|
|
573
|
+
for (let i = 0; i < leafIdx; i++) {
|
|
574
|
+
const c = children[i];
|
|
575
|
+
n += _chunkZKQSQSSMcjs.isText.call(void 0, c) ? c.text.length : 1;
|
|
576
|
+
}
|
|
577
|
+
return n + char;
|
|
578
|
+
}
|
|
579
|
+
function totalChars(children) {
|
|
580
|
+
return children.reduce((a, c) => a + (_chunkZKQSQSSMcjs.isText.call(void 0, c) ? c.text.length : 1), 0);
|
|
581
|
+
}
|
|
582
|
+
function leafBlocksBetween(doc, fromBlock, toBlock) {
|
|
583
|
+
const all = [];
|
|
584
|
+
const walk3 = (node, path) => {
|
|
585
|
+
if (!_chunkZKQSQSSMcjs.isElement.call(void 0, node))
|
|
586
|
+
return;
|
|
587
|
+
if (node.children.every((c) => _chunkZKQSQSSMcjs.isText.call(void 0, c) || _chunkZKQSQSSMcjs.isInlineAtom.call(void 0, c)))
|
|
588
|
+
all.push({ path, node });
|
|
589
|
+
else
|
|
590
|
+
node.children.forEach((c, i) => walk3(c, path.concat(i)));
|
|
591
|
+
};
|
|
592
|
+
doc.children.forEach((c, i) => walk3(c, [i]));
|
|
593
|
+
const fi = all.findIndex((b) => cmpPath(b.path, fromBlock) === 0);
|
|
594
|
+
const ti = all.findIndex((b) => cmpPath(b.path, toBlock) === 0);
|
|
595
|
+
return fi < 0 || ti < 0 ? [] : all.slice(fi, ti + 1);
|
|
596
|
+
}
|
|
597
|
+
function setSuggestOn(leaf, mark) {
|
|
598
|
+
const rest = (_nullishCoalesce(leaf.marks, () => ( []))).filter((m) => m.name !== "suggest");
|
|
599
|
+
return { ...leaf, marks: [...rest, mark] };
|
|
600
|
+
}
|
|
601
|
+
function markChars(block, from, to, mark) {
|
|
602
|
+
const out = [];
|
|
603
|
+
let pos = 0;
|
|
604
|
+
for (const leaf of block.children) {
|
|
605
|
+
if (!_chunkZKQSQSSMcjs.isText.call(void 0, leaf)) {
|
|
606
|
+
out.push(leaf);
|
|
607
|
+
pos += 1;
|
|
608
|
+
continue;
|
|
609
|
+
}
|
|
610
|
+
const len = leaf.text.length;
|
|
611
|
+
const lo = Math.max(from, pos);
|
|
612
|
+
const hi = Math.min(to, pos + len);
|
|
613
|
+
if (lo >= hi) {
|
|
614
|
+
out.push(leaf);
|
|
615
|
+
} else {
|
|
616
|
+
if (lo > pos)
|
|
617
|
+
out.push({ ...leaf, text: leaf.text.slice(0, lo - pos) });
|
|
618
|
+
out.push(setSuggestOn({ ...leaf, text: leaf.text.slice(lo - pos, hi - pos) }, mark));
|
|
619
|
+
if (hi < pos + len)
|
|
620
|
+
out.push({ ...leaf, text: leaf.text.slice(hi - pos) });
|
|
621
|
+
}
|
|
622
|
+
pos += len;
|
|
623
|
+
}
|
|
624
|
+
return coalesce(out);
|
|
625
|
+
}
|
|
626
|
+
function coalesce(nodes) {
|
|
627
|
+
const out = [];
|
|
628
|
+
for (const n of nodes) {
|
|
629
|
+
const prev = out[out.length - 1];
|
|
630
|
+
if (prev && _chunkZKQSQSSMcjs.isText.call(void 0, prev) && _chunkZKQSQSSMcjs.isText.call(void 0, n) && sameMarks(prev.marks, n.marks))
|
|
631
|
+
out[out.length - 1] = { ...prev, text: prev.text + n.text };
|
|
632
|
+
else
|
|
633
|
+
out.push(n);
|
|
634
|
+
}
|
|
635
|
+
return out;
|
|
636
|
+
}
|
|
637
|
+
function sameMarks(a, b) {
|
|
638
|
+
const x = _nullishCoalesce(a, () => ( []));
|
|
639
|
+
const y = _nullishCoalesce(b, () => ( []));
|
|
640
|
+
if (x.length !== y.length)
|
|
641
|
+
return false;
|
|
642
|
+
return x.every((m, i) => m.name === y[i].name && JSON.stringify(_nullishCoalesce(m.attrs, () => ( {}))) === JSON.stringify(_nullishCoalesce(y[i].attrs, () => ( {}))));
|
|
643
|
+
}
|
|
644
|
+
function rangeForDelete(doc, sel, dir) {
|
|
645
|
+
if (cmpPath(sel.anchor.path, sel.head.path) !== 0)
|
|
646
|
+
return sel;
|
|
647
|
+
const path = sel.head.path;
|
|
648
|
+
if (path.length < 2)
|
|
649
|
+
return null;
|
|
650
|
+
const char = path[path.length - 1];
|
|
651
|
+
const leafPath = path.slice(0, -1);
|
|
652
|
+
const leaf = _chunkTWD5T4YCcjs.nodeAt.call(void 0, doc, leafPath);
|
|
653
|
+
if (!_chunkZKQSQSSMcjs.isText.call(void 0, leaf))
|
|
654
|
+
return null;
|
|
655
|
+
if (dir === "backward") {
|
|
656
|
+
if (char <= 0)
|
|
657
|
+
return null;
|
|
658
|
+
return {
|
|
659
|
+
anchor: { path: leafPath.concat(char - 1) },
|
|
660
|
+
head: { path: leafPath.concat(char) }
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
if (char >= leaf.text.length)
|
|
664
|
+
return null;
|
|
665
|
+
return {
|
|
666
|
+
anchor: { path: leafPath.concat(char) },
|
|
667
|
+
head: { path: leafPath.concat(char + 1) }
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
function rangeIsSuggestInsert(doc, sel) {
|
|
671
|
+
const [lo, hi] = cmpPath(sel.anchor.path, sel.head.path) <= 0 ? [sel.anchor.path, sel.head.path] : [sel.head.path, sel.anchor.path];
|
|
672
|
+
if (cmpPath(lo, hi) === 0)
|
|
673
|
+
return false;
|
|
674
|
+
const a = split(lo);
|
|
675
|
+
const b = split(hi);
|
|
676
|
+
const blocks = leafBlocksBetween(doc, a.blockPath, b.blockPath);
|
|
677
|
+
if (!blocks.length)
|
|
678
|
+
return false;
|
|
679
|
+
let any = false;
|
|
680
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
681
|
+
const blk = blocks[i];
|
|
682
|
+
const from = i === 0 ? blockChar(blk.node.children, a.leafIdx, a.char) : 0;
|
|
683
|
+
const to = i === blocks.length - 1 ? blockChar(blk.node.children, b.leafIdx, b.char) : totalChars(blk.node.children);
|
|
684
|
+
if (from >= to)
|
|
685
|
+
continue;
|
|
686
|
+
let pos = 0;
|
|
687
|
+
for (const leaf of blk.node.children) {
|
|
688
|
+
if (!_chunkZKQSQSSMcjs.isText.call(void 0, leaf)) {
|
|
689
|
+
pos += 1;
|
|
690
|
+
continue;
|
|
691
|
+
}
|
|
692
|
+
const len = leaf.text.length;
|
|
693
|
+
const loC = Math.max(from, pos);
|
|
694
|
+
const hiC = Math.min(to, pos + len);
|
|
695
|
+
if (loC < hiC) {
|
|
696
|
+
any = true;
|
|
697
|
+
const hasIns = (_nullishCoalesce(leaf.marks, () => ( []))).some((m) => m.name === "suggest" && _optionalChain([m, 'access', _36 => _36.attrs, 'optionalAccess', _37 => _37.kind]) !== "delete");
|
|
698
|
+
if (!hasIns)
|
|
699
|
+
return false;
|
|
700
|
+
}
|
|
701
|
+
pos += len;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
return any;
|
|
705
|
+
}
|
|
706
|
+
function markSuggestRange(doc, sel, kind, id, author) {
|
|
707
|
+
const [lo, hi] = cmpPath(sel.anchor.path, sel.head.path) <= 0 ? [sel.anchor.path, sel.head.path] : [sel.head.path, sel.anchor.path];
|
|
708
|
+
if (cmpPath(lo, hi) === 0)
|
|
709
|
+
return [];
|
|
710
|
+
const a = split(lo);
|
|
711
|
+
const b = split(hi);
|
|
712
|
+
const blocks = leafBlocksBetween(doc, a.blockPath, b.blockPath);
|
|
713
|
+
if (!blocks.length)
|
|
714
|
+
return [];
|
|
715
|
+
const mark = suggestMark(id, kind, author);
|
|
716
|
+
const steps = [];
|
|
717
|
+
blocks.forEach((blk, i) => {
|
|
718
|
+
const from = i === 0 ? blockChar(blk.node.children, a.leafIdx, a.char) : 0;
|
|
719
|
+
const to = i === blocks.length - 1 ? blockChar(blk.node.children, b.leafIdx, b.char) : totalChars(blk.node.children);
|
|
720
|
+
if (from >= to)
|
|
721
|
+
return;
|
|
722
|
+
const children = markChars(blk.node, from, to, mark);
|
|
723
|
+
steps.push({ kind: "replaceNode", path: blk.path, node: { ...blk.node, children } });
|
|
724
|
+
});
|
|
725
|
+
return steps;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
exports.init = init; exports.commit = commit; exports.applyForeign = applyForeign; exports.amend = amend; exports.undo = undo; exports.redo = redo; exports.invariants = invariants; exports.firstViolation = firstViolation; exports.outline = outline; exports.commentIdsInDoc = commentIdsInDoc; exports.stripCommentMarks = stripCommentMarks; exports.findText = findText; exports.replaceMatch = replaceMatch; exports.replaceAll = replaceAll; exports.applyReplaceAll = applyReplaceAll; exports.snapshotDoc = snapshotDoc; exports.pushVersion = pushVersion; exports.getVersion = getVersion; exports.removeVersion = removeVersion; exports.suggestMark = suggestMark; exports.isSuggestMark = isSuggestMark; exports.suggestIdsInDoc = suggestIdsInDoc; exports.listSuggestions = listSuggestions; exports.stripSuggestMarks = stripSuggestMarks; exports.dropSuggestText = dropSuggestText; exports.acceptSuggestion = acceptSuggestion; exports.rejectSuggestion = rejectSuggestion; exports.rangeForDelete = rangeForDelete; exports.rangeIsSuggestInsert = rangeIsSuggestInsert; exports.markSuggestRange = markSuggestRange;
|