editate 0.6.2 → 0.6.4

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/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const t = ([t, e]) => t > e ? [ e, t ] : [ t, e ], e = ([t, e]) => t === e, n = Math.min, {keys: r, is: o} = Object, c = t => "string" == typeof t, s = t => "function" == typeof t, i = s(queueMicrotask) ? queueMicrotask : t => {
2
2
  Promise.resolve().then(t);
3
- }, a = (t, e = t => h(t) ? t.text : "") => t.children.reduce((t, n, r) => {
3
+ }, a = (t, e = t => y(t) ? t.text : "") => t.children.reduce((t, n, r) => {
4
4
  const o = g(n);
5
5
  return 0 !== r && o && (t += "\n"), t + (o ? n.children.reduce((t, n) => t + e(n), "") : "");
6
6
  }, ""), l = (t, e, n) => t.split("\n").map(t => ({
@@ -9,72 +9,73 @@ const t = ([t, e]) => t > e ? [ e, t ] : [ t, e ], e = ([t, e]) => t === e, n =
9
9
  ...e,
10
10
  text: t
11
11
  } ]
12
- })), f = "delete", u = "insert_text", d = "insert_node", p = "set_attr", y = "set_node_attr", h = t => "text" in t, g = t => "children" in t, _ = (t, e) => {
12
+ })), f = "delete", u = "insert_text", d = "insert_node", p = "set_attr", h = "set_node_attr", y = t => "text" in t, g = t => "children" in t, _ = (t, e) => {
13
13
  const n = r(t);
14
14
  return n.length === r(e).length && n.every(n => n in e && ("text" === n || o(t[n], e[n])));
15
- }, k = new WeakMap, b = ({children: t}, e = 0, n = t.length) => {
15
+ }, k = new WeakMap, x = ({children: t}, e = 0, n = t.length) => {
16
16
  let r = 0, o = 0;
17
17
  for (let c = e; c < n; c++) {
18
18
  const e = t[c];
19
- r += x(e), 0 !== o && g(e) && r++, o++;
19
+ r += b(e), 0 !== o && g(e) && r++, o++;
20
20
  }
21
21
  return r;
22
- }, x = t => {
22
+ }, b = t => {
23
23
  if (g(t)) {
24
24
  let e = k.get(t);
25
- return null == e && k.set(t, e = b(t)), e;
25
+ return null == e && k.set(t, e = x(t)), e;
26
26
  }
27
- return h(t) ? t.text.length : 1;
27
+ return y(t) ? t.text.length : 1;
28
28
  }, m = (t, [e, n]) => {
29
29
  let r = 0;
30
- for (const n of e) r += b(t, 0, n), 0 !== n && r++, t = t.children[n];
30
+ for (const n of e) r += x(t, 0, n), 0 !== n && r++, t = t.children[n];
31
31
  return r + n;
32
- }, v = (t, e) => {
33
- const n = I(t, e);
32
+ }, w = (t, e) => {
33
+ const n = A(t, e);
34
34
  return [ n.t, n.o ];
35
- }, w = (t, [e, n]) => [ m(t, e), m(t, n) ], M = (t, [e, n]) => [ v(t, e), v(t, n) ], S = (t, e = 0, n = t.length - 1) => {
35
+ }, v = (t, [e, n]) => [ m(t, e), m(t, n) ], M = (t, [e, n]) => [ w(t, e), w(t, n) ], S = (t, e = 0, n = t.length - 1) => {
36
36
  let r = e + 1;
37
37
  for (;r <= n; ) {
38
38
  const e = t[r - 1], o = t[r];
39
- h(e) && h(o) && _(e, o) ? (t[r - 1] = {
39
+ y(e) && y(o) && _(e, o) ? (t[r - 1] = {
40
40
  ...e,
41
41
  text: e.text + o.text
42
42
  }, t.splice(r, 1), n--) : r++;
43
43
  }
44
44
  for (r = e; r <= n; ) {
45
45
  const e = t[r];
46
- h(e) && !e.text && t.length > 1 ? (t.splice(r, 1), n--) : r++;
46
+ y(e) && !e.text && t.length > 1 ? (t.splice(r, 1), n--) : r++;
47
47
  }
48
- }, D = (t, e = 0, n = t.length - 1) => {
48
+ }, E = (t, e = 0, n = t.length - 1) => {
49
49
  let r = e + 1;
50
50
  for (;r <= n; ) {
51
51
  const e = t[r - 1], o = t[r];
52
- t[r - 1] = O(e, o), t.splice(r, 1), n--;
52
+ t[r - 1] = D(e, o), t.splice(r, 1), n--;
53
53
  }
54
- }, E = (t, e, n) => {
54
+ }, O = (t, e, n) => {
55
55
  if (e.length) {
56
56
  const r = t.length;
57
57
  t.push(...e), r && n(t, r - 1, r);
58
58
  }
59
- }, O = (...t) => ({
59
+ }, D = (...t) => ({
60
60
  ...t[0],
61
- children: t.reduce((t, e) => (E(t, e.children, S), t), [])
62
- }), A = ({children: t}, e) => {
63
- for (let n = 0; n < t.length; n++) {
64
- const r = t[n];
65
- let o = x(r);
66
- if (g(r) && o++, o > e) return {
67
- i: r,
68
- l: n,
61
+ children: t.reduce((t, e) => (O(t, e.children, S), t), [])
62
+ }), P = ({children: t}, e) => {
63
+ const n = t.length;
64
+ for (let r = 0; r < n; r++) {
65
+ const n = t[r];
66
+ let o = b(n);
67
+ if (g(n) && o++, o > e || o === e && y(n) && !n.text) return {
68
+ i: n,
69
+ l: r,
69
70
  o: e
70
71
  };
71
72
  e -= o;
72
73
  }
73
74
  return null;
74
- }, I = (t, e) => {
75
+ }, A = (t, e) => {
75
76
  const n = [];
76
77
  for (;t; ) {
77
- const r = A(t, e);
78
+ const r = P(t, e);
78
79
  if (!r) break;
79
80
  const o = r.i;
80
81
  if (!g(o)) break;
@@ -85,12 +86,12 @@ const t = ([t, e]) => t > e ? [ e, t ] : [ t, e ], e = ([t, e]) => t === e, n =
85
86
  t: n,
86
87
  o: e
87
88
  };
88
- }, P = (t, e) => {
89
- const n = t.children, r = A(t, e);
89
+ }, I = (t, e) => {
90
+ const n = t.children, r = P(t, e);
90
91
  if (r) {
91
92
  const {i: e, o, l: c} = r;
92
93
  if (g(e)) {
93
- const [r, s] = P(e, o), i = n.slice(0, c), a = n.slice(c + 1);
94
+ const [r, s] = I(e, o), i = n.slice(0, c), a = n.slice(c + 1);
94
95
  return i.push(r), a.unshift(s), [ {
95
96
  ...t,
96
97
  children: i
@@ -101,7 +102,7 @@ const t = ([t, e]) => t > e ? [ e, t ] : [ t, e ], e = ([t, e]) => t === e, n =
101
102
  }
102
103
  {
103
104
  const r = n.slice(0, c), s = n.slice(c + 1);
104
- if (h(e)) {
105
+ if (y(e)) {
105
106
  const t = e.text.slice(0, o), n = e.text.slice(o);
106
107
  !t && r.length || r.push({
107
108
  ...e,
@@ -120,9 +121,13 @@ const t = ([t, e]) => t > e ? [ e, t ] : [ t, e ], e = ([t, e]) => t === e, n =
120
121
  } ];
121
122
  }
122
123
  }
124
+ const o = n[n.length - 1];
123
125
  return [ t, {
124
126
  ...t,
125
- children: []
127
+ children: y(o) ? [ {
128
+ ...o,
129
+ text: ""
130
+ } ] : []
126
131
  } ];
127
132
  }, C = (t, e, n, r = 0) => {
128
133
  if (r < e.length) {
@@ -136,13 +141,13 @@ const t = ([t, e]) => t > e ? [ e, t ] : [ t, e ], e = ([t, e]) => t === e, n =
136
141
  })(t, o, o, [ C(t.children[o], e, n, r + 1) ]);
137
142
  }
138
143
  return n;
139
- }, H = (t, e, n, r) => {
140
- const [o, c] = P(t, e), s = e < n ? P(t, n)[1] : c, i = o.children.slice();
141
- return E(i, r, D), E(i, s.children, D), {
144
+ }, R = (t, e, n, r) => {
145
+ const [o, c] = I(t, e), s = e < n ? I(t, n)[1] : c, i = o.children.slice();
146
+ return O(i, r, E), O(i, s.children, E), {
142
147
  ...t,
143
148
  children: i
144
149
  };
145
- }, R = (t, e, n) => e >= n ? [] : P(P(t, n)[0], e)[1].children, B = (t, e) => e >= 0 && e <= x(t), N = (t, e) => e.reduce((t, e) => V(t, e), t), V = (t, e) => {
150
+ }, T = (t, e, n) => e >= n ? [] : I(I(t, n)[0], e)[1].children, L = (t, e) => e >= 0 && e <= b(t), H = (t, e) => e.reduce((t, e) => B(t, e), t), B = (t, e) => {
146
151
  switch (e.type) {
147
152
  case f:
148
153
  {
@@ -161,23 +166,23 @@ const t = ([t, e]) => t > e ? [ e, t ] : [ t, e ], e = ([t, e]) => t === e, n =
161
166
  case d:
162
167
  {
163
168
  const {at: n, fragment: r} = e;
164
- if (t >= n) return t + x({
169
+ if (t >= n) return t + b({
165
170
  children: r
166
171
  });
167
172
  break;
168
173
  }
169
174
  }
170
175
  return t;
171
- }, F = ([t, e], n) => [ V(t, n), V(e, n) ];
176
+ }, N = ([t, e], n) => [ B(t, n), B(e, n) ];
172
177
 
173
- function L(e, n = t(e.selection)) {
178
+ function V(e, n = t(e.selection)) {
174
179
  e.apply({
175
180
  type: "delete",
176
181
  range: n
177
182
  });
178
183
  }
179
184
 
180
- function T(t, e, n = t.selection[0]) {
185
+ function F(t, e, n = t.selection[0]) {
181
186
  t.apply({
182
187
  type: "insert_text",
183
188
  at: n,
@@ -185,7 +190,7 @@ function T(t, e, n = t.selection[0]) {
185
190
  });
186
191
  }
187
192
 
188
- function W(t, e, n = t.selection[0]) {
193
+ function U(t, e, n = t.selection[0]) {
189
194
  t.apply({
190
195
  type: "insert_node",
191
196
  at: n,
@@ -195,7 +200,7 @@ function W(t, e, n = t.selection[0]) {
195
200
  });
196
201
  }
197
202
 
198
- function q(e, n) {
203
+ function W(e, n) {
199
204
  const r = t(e.selection);
200
205
  e.apply({
201
206
  type: "delete",
@@ -207,10 +212,10 @@ function q(e, n) {
207
212
  });
208
213
  }
209
214
 
210
- function J(t, e) {
215
+ function q(t, e) {
211
216
  t.apply({
212
217
  type: "delete",
213
- range: [ 0, x(t.doc) ]
218
+ range: [ 0, b(t.doc) ]
214
219
  }).apply({
215
220
  type: "insert_node",
216
221
  at: 0,
@@ -218,7 +223,7 @@ function J(t, e) {
218
223
  });
219
224
  }
220
225
 
221
- function U(e, n, r, o = t(e.selection)) {
226
+ function G(e, n, r, o = t(e.selection)) {
222
227
  e.apply({
223
228
  type: "set_attr",
224
229
  range: o,
@@ -227,18 +232,27 @@ function U(e, n, r, o = t(e.selection)) {
227
232
  });
228
233
  }
229
234
 
230
- function G(e, n, r = t(e.selection)) {
231
- const o = R(e.doc, ...r).flatMap(t => t.children.filter(h));
232
- o.length && e.apply({
235
+ function J(n, r, o = t(n.selection)) {
236
+ let c;
237
+ if (e(o)) {
238
+ const t = ((t, e) => {
239
+ const n = A(t, e);
240
+ return P(n.i, n.o);
241
+ })(n.doc, o[0]);
242
+ if (!t) return;
243
+ c = [ t.i ];
244
+ } else c = T(n.doc, ...o).flatMap(t => t.children);
245
+ const s = c.filter(y);
246
+ s.length && n.apply({
233
247
  type: "set_attr",
234
- range: r,
235
- key: n,
236
- value: !!o.some(t => !t[n])
248
+ range: o,
249
+ key: r,
250
+ value: !!s.some(t => !t[r])
237
251
  });
238
252
  }
239
253
 
240
- function Z(t, e, n, r = t.selection[0]) {
241
- const {t: o} = I(t.doc, r);
254
+ function Y(t, e, n, r = t.selection[0]) {
255
+ const {t: o} = A(t.doc, r);
242
256
  t.apply({
243
257
  type: "set_node_attr",
244
258
  path: o,
@@ -247,8 +261,8 @@ function Z(t, e, n, r = t.selection[0]) {
247
261
  });
248
262
  }
249
263
 
250
- function j(t, e, n, r, o = t.selection[0]) {
251
- const {i: c, t: s} = I(t.doc, o);
264
+ function Z(t, e, n, r, o = t.selection[0]) {
265
+ const {i: c, t: s} = A(t.doc, o);
252
266
  t.apply({
253
267
  type: "set_node_attr",
254
268
  path: s,
@@ -257,77 +271,81 @@ function j(t, e, n, r, o = t.selection[0]) {
257
271
  });
258
272
  }
259
273
 
260
- let z = null, X = null, Y = null, K = null, Q = null;
274
+ let j = null, z = null, X = null, K = null, Q = null;
261
275
 
262
- const $ = t => 1 === t.nodeType, tt = t => 8 === t.nodeType, et = () => X, nt = () => {
276
+ const $ = t => 1 === t.nodeType, tt = t => 8 === t.nodeType, et = () => z, nt = () => {
263
277
  const t = rt();
264
- return 1 === t ? X.data.length : 2 === t ? 1 : 0;
278
+ return 1 === t ? z.data.length : 2 === t ? 1 : 0;
265
279
  }, rt = () => {
266
- if (null != Y) return Y;
267
- if (X) if ((t => 3 === t.nodeType)(X)) {
268
- const t = X.data;
269
- if (t) return Y = "\n" === t ? it() ? 3 : 6 : 1;
270
- } else if ($(X)) {
271
- if ("BR" === X.tagName) return Y = it() ? 3 : 5;
272
- if (K.u(X)) return Y = 2;
273
- if (K.p(X)) return Y = 4;
280
+ if (null != X) return X;
281
+ if (z) if ((t => 3 === t.nodeType)(z)) {
282
+ const t = z.data;
283
+ if (t) return X = "\n" === t ? lt() ? 3 : 5 : 1;
284
+ } else if ($(z)) {
285
+ if ("BR" === z.tagName) return X = lt() ? 3 : 5;
286
+ if (at(z)) return X = 6;
287
+ if (K.u(z)) return X = 2;
288
+ if (K.p(z)) return X = 4;
274
289
  }
275
- return Y = 0;
276
- }, ot = () => (Y = null, X = z.nextNode()), ct = () => {
277
- for (;(Y = null) || (X = z.nextSibling()); ) if (4 === rt()) return;
290
+ return X = 0;
291
+ }, ot = () => {
292
+ const t = rt();
293
+ if (X = null, 2 === t || 6 === t) {
294
+ const t = z;
295
+ if (z = j.nextSibling(), !z) for (;(z = j.nextNode()) && t.contains(z); ) ;
296
+ return z;
297
+ }
298
+ return z = j.nextNode();
299
+ }, ct = () => {
300
+ for (;(X = null) || (z = j.nextSibling()); ) if (4 === rt()) return;
278
301
  }, st = () => {
279
- for (;(Y = null) || (X = z.parentNode()); ) if (4 === rt()) return;
280
- }, it = () => {
281
- const t = X.parentNode;
302
+ for (;(X = null) || (z = j.parentNode()); ) if (4 === rt()) return;
303
+ }, it = new Set([ "TEMPLATE", "STYLE", "SCRIPT", "COLGROUP" ]), at = t => it.has(t.tagName), lt = () => {
304
+ const t = z.parentNode;
282
305
  return Q(() => {
283
- for (;ot(); ) {
306
+ for (X = 0; ot(); ) {
284
307
  if (rt()) return !0;
285
- if (!t.contains(X)) break;
308
+ if (!t.contains(z)) break;
286
309
  }
287
310
  return !1;
288
311
  });
289
- }, at = () => {
290
- for (;;) {
291
- if (2 === rt()) {
292
- const t = X;
293
- for (;ot() && t.contains(X); ) ;
294
- } else ot();
295
- if (!X) break;
312
+ }, ft = () => {
313
+ for (;ot(); ) {
296
314
  const t = rt();
297
- if (t) return t;
315
+ if (t && 6 !== t) return t;
298
316
  }
299
- }, lt = new Set([ "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "P", "PRE", "LI", "DT", "DD", "TR" ]), ft = t => lt.has(t.tagName), ut = new Set([ "EMBED", "IMG", "PICTURE", "AUDIO", "VIDEO", "SVG", "CANVAS", "MATH", "IFRAME", "OBJECT" ]), dt = t => "false" === t.contentEditable || ut.has(t.tagName), pt = (t, e) => t.compareDocumentPosition(e), yt = t => t.ownerDocument, ht = t => yt(t).getSelection(), gt = (t, e) => {
317
+ }, ut = new Set([ "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "P", "PRE", "LI", "DT", "DD", "TR" ]), dt = t => ut.has(t.tagName), pt = new Set([ "EMBED", "IMG", "PICTURE", "AUDIO", "VIDEO", "SVG", "CANVAS", "MATH", "IFRAME", "OBJECT" ]), ht = t => "false" === t.contentEditable || pt.has(t.tagName), yt = (t, e) => t.compareDocumentPosition(e), gt = t => t.ownerDocument, _t = t => gt(t).getSelection(), kt = (t, e) => {
300
318
  if (t.rangeCount) {
301
319
  const n = t.getRangeAt(0);
302
320
  if (e.contains(n.commonAncestorContainer)) return n;
303
321
  }
304
- }, _t = (t, e, n, r) => {
305
- const o = ht(t);
306
- (n || gt(o, t)) && (o.removeAllRanges(), o.addRange(e), r && (o.collapseToEnd(),
322
+ }, xt = (t, e, n, r) => {
323
+ const o = _t(t);
324
+ (n || kt(o, t)) && (o.removeAllRanges(), o.addRange(e), r && (o.collapseToEnd(),
307
325
  o.extend(e.startContainer, e.startOffset)));
308
- }, kt = (t, e, [n, r], o, c, s) => {
326
+ }, bt = (t, e, [n, r], o, c, s) => {
309
327
  const i = 0 === o, a = o > 0, l = a ? r : n, f = a ? n : r;
310
328
  if (0 === l[0].length && 0 === l[1] && i && !e.hasChildNodes()) {
311
329
  const n = t.createRange();
312
- return n.setStart(e, 0), n.setEnd(e, 0), _t(e, n, s);
330
+ return n.setStart(e, 0), n.setEnd(e, 0), xt(e, n, s);
313
331
  }
314
- const u = bt(e, l, c);
332
+ const u = mt(e, l, c);
315
333
  if (!u) return;
316
- const d = i ? u : bt(e, f, c);
334
+ const d = i ? u : mt(e, f, c);
317
335
  if (!d) return;
318
- const p = t.createRange(), [y, h] = u, [g, _] = d;
319
- $(y) ? h < 1 ? p.setStartBefore(y) : p.setStartAfter(y) : p.setStart(y, h), $(g) ? _ < 1 ? p.setEndBefore(g) : p.setEndAfter(g) : p.setEnd(g, _),
320
- _t(e, p, s, a);
321
- }, bt = (t, [e, n], r) => r(() => {
336
+ const p = t.createRange(), [h, y] = u, [g, _] = d;
337
+ $(h) ? y < 1 ? p.setStartBefore(h) : p.setStartAfter(h) : p.setStart(h, y), $(g) ? _ < 1 ? p.setEndBefore(g) : p.setEndAfter(g) : p.setEnd(g, _),
338
+ xt(e, p, s, a);
339
+ }, mt = (t, [e, n], r) => r(() => {
322
340
  let t, r = 0;
323
- for (;t = at(); ) if (4 === t) {
341
+ for (;t = ft(); ) if (4 === t) {
324
342
  if (r < e.length) for (let t = e[r++]; t > 0; t--) ct();
325
343
  } else {
326
344
  const t = nt();
327
345
  if (n <= t) return [ et(), n ];
328
346
  n -= t;
329
347
  }
330
- }, t), xt = (t, e, r, o) => {
348
+ }, t), wt = (t, e, r, o) => {
331
349
  let c = !0;
332
350
  if (t === e && !e.hasChildNodes()) return [ [ 0 ], 0 ];
333
351
  if ($(e) && e.hasChildNodes()) {
@@ -342,12 +360,12 @@ const $ = t => 1 === t.nodeType, tt = t => 8 === t.nodeType, et = () => X, nt =
342
360
  for (;(n = et()) && n !== t; ) e.unshift(n), st();
343
361
  if (!e.length) return [ 0 ];
344
362
  let r = 0, o = e[e.length - 1];
345
- for (;o = o.previousElementSibling; ) r++;
363
+ for (;o = o.previousElementSibling; ) at(o) || r++;
346
364
  return [ r ];
347
365
  });
348
366
  let s = 0;
349
- for (;at(); ) {
350
- const t = pt(e, et());
367
+ for (;ft(); ) {
368
+ const t = yt(e, et());
351
369
  if (0 === t || 16 & t) {
352
370
  if (c) break;
353
371
  } else if (4 & t) break;
@@ -355,10 +373,10 @@ const $ = t => 1 === t.nodeType, tt = t => 8 === t.nodeType, et = () => X, nt =
355
373
  }
356
374
  return [ n, s + r ];
357
375
  }, t, e);
358
- }, mt = (t, e, {startOffset: n, startContainer: r, endOffset: o, endContainer: c}) => {
359
- const s = xt(t, r, n, e);
360
- return [ s, r === c && n === o ? s : xt(t, c, o, e) ];
361
- }, vt = "undefined" != typeof navigator && /Mac|iP(hone|od|ad)/.test(navigator.platform), wt = (t, e) => {
376
+ }, vt = (t, e, {startOffset: n, startContainer: r, endOffset: o, endContainer: c}) => {
377
+ const s = wt(t, r, n, e);
378
+ return [ s, r === c && n === o ? s : wt(t, c, o, e) ];
379
+ }, Mt = "undefined" != typeof navigator && /Mac|iP(hone|od|ad)/.test(navigator.platform), St = (t, e) => {
362
380
  const n = t.endsWith("+"), r = (n ? t.slice(0, -2) : t).split("+"), o = n ? "+" : r.pop(), c = "Space" === o ? " " : o.toLowerCase();
363
381
  let s = !1, i = !1, a = !1, l = !1;
364
382
  return r.forEach(t => {
@@ -372,7 +390,7 @@ const $ = t => 1 === t.nodeType, tt = t => 8 === t.nodeType, et = () => X, nt =
372
390
  break;
373
391
 
374
392
  case "Mod":
375
- vt ? a = !0 : i = !0;
393
+ Mt ? a = !0 : i = !0;
376
394
  break;
377
395
 
378
396
  case "Alt":
@@ -388,20 +406,20 @@ const $ = t => 1 === t.nodeType, tt = t => 8 === t.nodeType, et = () => X, nt =
388
406
  };
389
407
  };
390
408
 
391
- function Mt(t) {
409
+ function Et(t) {
392
410
  let e = 0, n = 0, r = !1;
393
411
  const c = Date.now, s = [ [ t.doc, t.selection, [] ] ], i = () => s[e], a = () => e > 0, l = () => e < s.length - 1, f = () => {
394
412
  if (a()) {
395
413
  const n = i()[1];
396
414
  e--;
397
415
  const c = t.doc;
398
- r = !0, t.exec(J, i()[0].children), r = !1, o(c, t.doc) || (t.selection = n);
416
+ r = !0, t.exec(q, i()[0].children), r = !1, o(c, t.doc) || (t.selection = n);
399
417
  }
400
418
  }, u = () => {
401
419
  if (l()) {
402
420
  e++;
403
421
  const [n, c, s] = i(), a = t.doc;
404
- r = !0, t.exec(J, n.children), r = !1, o(a, t.doc) || (t.selection = [ N(c[0], s), N(c[1], s) ]);
422
+ r = !0, t.exec(q, n.children), r = !1, o(a, t.doc) || (t.selection = [ H(c[0], s), H(c[1], s) ]);
405
423
  }
406
424
  };
407
425
  t.hook("apply", (i, a) => {
@@ -418,8 +436,8 @@ function Mt(t) {
418
436
  }
419
437
  n = t, s[e][0] = u, s[e][2].push(i), s.splice(e + 1), e > 500 && (e--, s.shift());
420
438
  }
421
- }), t.hook("keyboard", wt("Mod+Z", f)), t.hook("keyboard", wt("Shift+Mod+Z", u)),
422
- t.set(Mt, {
439
+ }), t.hook("keyboard", St("Mod+Z", f)), t.hook("keyboard", St("Shift+Mod+Z", u)),
440
+ t.set(Et, {
423
441
  undo: f,
424
442
  redo: u,
425
443
  undoable: a,
@@ -427,27 +445,27 @@ function Mt(t) {
427
445
  });
428
446
  }
429
447
 
430
- function St(t) {
431
- t.get(Mt).undo();
448
+ function Ot(t) {
449
+ t.get(Et).undo();
432
450
  }
433
451
 
434
452
  function Dt(t) {
435
- t.get(Mt).redo();
453
+ t.get(Et).redo();
436
454
  }
437
455
 
438
- function Et(t) {
439
- return t.get(Mt).undoable();
456
+ function Pt(t) {
457
+ return t.get(Et).undoable();
440
458
  }
441
459
 
442
- function Ot(t) {
443
- return t.get(Mt).redoable();
460
+ function At(t) {
461
+ return t.get(Et).redoable();
444
462
  }
445
463
 
446
- const At = [], It = () => {}, Pt = t => {
464
+ const It = [], Ct = () => {}, Rt = t => {
447
465
  throw Error(t);
448
- }, Ct = ({doc: n, readonly: r = !1, schema: a, isBlock: g = ft, onWarn: _ = console.warn, onError: k = Pt}) => {
449
- let b = [ 0, 0 ];
450
- const x = t => {
466
+ }, Tt = ({doc: n, readonly: r = !1, schema: a, isBlock: g = dt, onWarn: _ = console.warn, onError: k = Rt}) => {
467
+ let x = [ 0, 0 ];
468
+ const b = t => {
451
469
  if (!a) return _("An unsafe operation was detected. We recommend using schema option."),
452
470
  !0;
453
471
  const e = a["~standard"].validate(t);
@@ -457,19 +475,19 @@ const At = [], It = () => {}, Pt = t => {
457
475
  }
458
476
  return !1;
459
477
  };
460
- a && !x(n) && k("Invalid document");
461
- const v = new Map, S = new WeakMap, D = t => v.get(t) || At, E = new Map, O = t => {
462
- const e = E.get(t);
463
- e && !e[1] && (e[1] = !0, i(() => {
464
- e[1] = !1, e[0].forEach(t => {
478
+ a && !b(n) && k("Invalid document");
479
+ const w = new Map, S = new WeakMap, E = t => w.get(t) || It, O = new Map, D = [], I = t => {
480
+ const e = O.get(t);
481
+ e && (D.length || i(() => {
482
+ D.forEach(t => {
465
483
  t();
466
- });
467
- }));
468
- }, P = t => {
484
+ }), D.splice(0);
485
+ }), D.push(...e));
486
+ }, B = t => {
469
487
  if (!r) if (Array.isArray(t)) for (const e of t) V(e); else V(t);
470
- return T;
488
+ return U;
471
489
  }, V = t => {
472
- const e = n, r = D("apply"), c = r.length;
490
+ const e = n, r = E("apply"), c = r.length;
473
491
  let s = 0;
474
492
  const i = () => {
475
493
  if (s < c) {
@@ -483,21 +501,21 @@ const At = [], It = () => {}, Pt = t => {
483
501
  case f:
484
502
  {
485
503
  const [r, o] = n.range;
486
- B(t, r) && B(t, o) && r < o && (t = H(t, r, o, []), e = F(e, n));
504
+ L(t, r) && L(t, o) && r < o && (t = R(t, r, o, []), e = N(e, n));
487
505
  break;
488
506
  }
489
507
 
490
508
  case u:
491
509
  {
492
510
  const {at: r, text: o} = n;
493
- if (B(t, r) && o) {
494
- const {i: c, o: s} = I(t, r), i = A(c, s - 1);
511
+ if (L(t, r) && o) {
512
+ const {i: c, o: s} = A(t, r), i = P(c, s - 1);
495
513
  let a;
496
514
  if (i) {
497
515
  const t = i.i;
498
- h(t) && (a = t);
516
+ y(t) && (a = t);
499
517
  }
500
- t = H(t, r, r, l(o, a, c)), e = F(e, n);
518
+ t = R(t, r, r, l(o, a, c)), e = N(e, n);
501
519
  }
502
520
  break;
503
521
  }
@@ -505,24 +523,33 @@ const At = [], It = () => {}, Pt = t => {
505
523
  case d:
506
524
  {
507
525
  const {at: r, fragment: o} = n;
508
- B(t, r) && o.length && (t = H(t, r, r, o), e = F(e, n));
526
+ L(t, r) && o.length && (t = R(t, r, r, o), e = N(e, n));
509
527
  break;
510
528
  }
511
529
 
512
530
  case p:
513
531
  {
514
532
  const {range: [e, r], key: o, value: c} = n;
515
- B(t, e) && B(t, r) && e < r && (t = H(t, e, r, R(t, e, r).map(t => ({
533
+ if (L(t, e) && L(t, r) && e <= r) if (e === r) {
534
+ const {i: {children: n}, t: r} = A(t, e);
535
+ if (1 === n.length) {
536
+ const e = n[0];
537
+ y(e) && !e.text && (t = C(t, [ ...r, 0 ], {
538
+ ...e,
539
+ [o]: c
540
+ }));
541
+ }
542
+ } else t = R(t, e, r, T(t, e, r).map(t => ({
516
543
  ...t,
517
- children: t.children.map(t => h(t) ? {
544
+ children: t.children.map(t => y(t) ? {
518
545
  ...t,
519
546
  [o]: c
520
547
  } : t)
521
- }))));
548
+ })));
522
549
  break;
523
550
  }
524
551
 
525
- case y:
552
+ case h:
526
553
  {
527
554
  const {path: e, key: r, value: o} = n, c = ((t, e) => {
528
555
  for (let n = 0; n < e.length; n++) t = t.children[e[n]];
@@ -536,8 +563,8 @@ const At = [], It = () => {}, Pt = t => {
536
563
  }
537
564
  }
538
565
  return [ t, e ];
539
- })(n, b, t);
540
- (({type: t}) => t === d || t === p || t === y)(t) && !x(e) || (n = e, b = r);
566
+ })(n, x, t);
567
+ (({type: t}) => t === d || t === p || t === h)(t) && !b(e) || (n = e, x = r);
541
568
  } catch (t) {
542
569
  _("rollback operation: " + t);
543
570
  }
@@ -545,86 +572,84 @@ const At = [], It = () => {}, Pt = t => {
545
572
  }, a = e => {
546
573
  e && (t = e), s++, i();
547
574
  };
548
- i(), o(e, n) || O("change");
549
- }, L = t => {
550
- !((t, [e, n]) => B(t, e) && B(t, n))(n, t) || b[0] === t[0] && b[1] === t[1] || (b = t,
551
- O("selectionchange"));
552
- }, T = {
575
+ i(), o(e, n) || I("change");
576
+ }, F = t => {
577
+ !((t, [e, n]) => L(t, e) && L(t, n))(n, t) || x[0] === t[0] && x[1] === t[1] || (x = t,
578
+ I("selectionchange"));
579
+ }, U = {
553
580
  get doc() {
554
581
  return n;
555
582
  },
556
583
  get selection() {
557
- return b;
584
+ return x;
558
585
  },
559
586
  set selection(t) {
560
- L(t);
587
+ F(t);
561
588
  },
562
589
  get readonly() {
563
590
  return r;
564
591
  },
565
592
  set readonly(t) {
566
- r = t, O("readonly");
593
+ r = t, I("readonly");
567
594
  },
568
- apply: P,
595
+ apply: B,
569
596
  on: (t, e) => {
570
- let n = E.get(t);
571
- n || E.set(t, n = [ new Set, !1 ]);
572
- const r = n[0];
573
- return r.add(e), () => {
574
- r.delete(e);
597
+ let n = O.get(t);
598
+ return n || O.set(t, n = new Set), n.add(e), () => {
599
+ n.delete(e);
575
600
  };
576
601
  },
577
602
  hook: (t, e) => {
578
- let n = v.get(t);
579
- return n || v.set(t, n = []), n.push(e), () => {
603
+ let n = w.get(t);
604
+ return n || w.set(t, n = []), n.push(e), () => {
580
605
  const t = n.indexOf(e);
581
606
  -1 !== t && n.splice(t, 1);
582
607
  };
583
608
  },
584
609
  exec: (t, ...e) => {
585
- const n = t(T, ...e);
586
- return void 0 === n ? T : n;
610
+ const n = t(U, ...e);
611
+ return void 0 === n ? U : n;
587
612
  },
588
613
  get: t => (S.has(t) || k("No value found for key"), S.get(t)),
589
- set: (t, e) => (S.set(t, e), T),
614
+ set: (t, e) => (S.set(t, e), U),
590
615
  input: o => {
591
616
  if (!window.InputEvent || !s(InputEvent.prototype.getTargetRanges)) return _("beforeinput event is not supported."),
592
- It;
617
+ Ct;
593
618
  const {contentEditable: i, role: a, ariaMultiLine: l, ariaReadOnly: f} = o, u = o.style.whiteSpace;
594
619
  o.role = "textbox", o.style.whiteSpace = "pre-wrap", o.ariaMultiLine = "true";
595
- let d = !1, p = null, y = !1, h = !1, k = !1;
596
- const x = yt(o), v = (t => {
620
+ let d = !1, p = null, h = !1, y = !1, k = !1;
621
+ const b = gt(o), w = (t => {
597
622
  const e = (n, r, o) => {
598
- const c = K, s = Q, i = z, a = X, l = Y;
623
+ const c = K, s = Q, i = j, a = z, l = X;
599
624
  try {
600
- return z || (K = t, Q = e, z = K.h.createTreeWalker(r, 5)), o && (z.currentNode = X = o),
625
+ return j || (K = t, Q = e, j = K.h.createTreeWalker(r, 5)), o && (j.currentNode = z = o),
601
626
  n();
602
627
  } finally {
603
- K = c, Q = s, z = i, X = a, Y = l, z && a && (z.currentNode = a);
628
+ K = c, Q = s, j = i, z = a, X = l, j && a && (j.currentNode = a);
604
629
  }
605
630
  };
606
631
  return e;
607
632
  })({
608
- h: x,
633
+ h: b,
609
634
  p: g,
610
- u: dt
635
+ u: ht
611
636
  }), S = () => {
612
637
  o.contentEditable = r ? "false" : "true", o.ariaReadOnly = r ? "true" : null;
613
638
  };
614
639
  S();
615
- const E = T.on("change", () => {
616
- h || requestAnimationFrame(() => {
617
- h || o.focus({
640
+ const O = U.on("change", () => {
641
+ y || requestAnimationFrame(() => {
642
+ y || o.focus({
618
643
  preventScroll: !0
619
644
  });
620
645
  });
621
- }), O = T.on("readonly", S), A = t => {
622
- for (const e of D("paste")) {
623
- const n = e(t, v);
646
+ }), D = U.on("readonly", S), P = t => {
647
+ for (const e of E("paste")) {
648
+ const n = e(t, w);
624
649
  if (n) return n;
625
650
  }
626
651
  _("failed to serialize pasted data");
627
- }, I = ((t, e) => {
652
+ }, A = ((t, e) => {
628
653
  let n = !1;
629
654
  const r = [], o = t => {
630
655
  n && r.push(...t);
@@ -657,37 +682,37 @@ const At = [], It = () => {}, Pt = t => {
657
682
  }
658
683
  };
659
684
  })(o, () => {
660
- kt(x, o, M(n, b), b[0] - b[1], v);
661
- }), C = () => {
662
- L(w(n, ((t, e) => {
663
- const n = ht(t), r = gt(n, t);
685
+ bt(b, o, M(n, x), x[0] - x[1], w);
686
+ }), I = () => {
687
+ F(v(n, ((t, e) => {
688
+ const n = _t(t), r = kt(n, t);
664
689
  if (!r) return [ [ [ 0 ], 0 ], [ [ 0 ], 0 ] ];
665
- const o = mt(t, e, r), c = pt(n.anchorNode, n.focusNode);
690
+ const o = vt(t, e, r), c = yt(n.anchorNode, n.focusNode);
666
691
  return (0 === c ? n.anchorOffset > n.focusOffset : 2 & c) ? [ o[1], o[0] ] : o;
667
- })(o, v)));
668
- }, H = () => {
669
- const t = I.m();
670
- I.k(!1), t.length && (I._(t), x.removeEventListener("selectionchange", U), kt(x, o, M(n, b), b[0] - b[1], v, !0),
671
- x.addEventListener("selectionchange", U)), p && (L(p[1]), P(p[0]), p = null), y = !1;
692
+ })(o, w)));
693
+ }, C = () => {
694
+ const t = A.m();
695
+ A.k(!1), t.length && (A._(t), b.removeEventListener("selectionchange", G), bt(b, o, M(n, x), x[0] - x[1], w, !0),
696
+ b.addEventListener("selectionchange", G)), p && (F(p[1]), B(p[0]), p = null), h = !1;
672
697
  }, R = t => {
673
- if (!y) for (const e of D("keyboard")) if (e(t)) return t.preventDefault(), void I.k(!1);
674
- }, B = () => {
675
- y || H();
676
- }, V = t => {
698
+ if (!h) for (const e of E("keyboard")) if (e(t)) return t.preventDefault(), void A.k(!1);
699
+ }, T = () => {
700
+ h || C();
701
+ }, L = t => {
677
702
  t.preventDefault();
678
703
  const r = t.inputType;
679
704
  if (r.startsWith("format")) return;
680
705
  if ("historyUndo" === r || "historyRedo" === r) return;
681
- y ? I.k(!0) : C();
706
+ h ? A.k(!0) : I();
682
707
  const c = t.getTargetRanges()[0];
683
708
  if (c) {
684
- const s = w(n, mt(o, v, c));
709
+ const s = v(n, vt(o, w, c));
685
710
  let i, a = "insertParagraph" === r || "insertLineBreak" === r ? "\n" : t.data;
686
711
  if (null == a) {
687
712
  const e = t.dataTransfer;
688
713
  e && (a = e.getData("text/plain"));
689
714
  }
690
- p || (p = [ [], b ]), i = p[0], e(s) || i.push({
715
+ p || (p = [ [], x ]), i = p[0], e(s) || i.push({
691
716
  type: "delete",
692
717
  range: s
693
718
  }), a && i.push({
@@ -696,31 +721,31 @@ const At = [], It = () => {}, Pt = t => {
696
721
  text: a
697
722
  });
698
723
  }
699
- y || H();
700
- }, F = () => {
701
- y || C(), y = !0;
724
+ h || C();
725
+ }, N = () => {
726
+ h || I(), h = !0;
727
+ }, V = () => {
728
+ C();
702
729
  }, W = () => {
703
- H();
730
+ y = !0, I();
704
731
  }, q = () => {
705
- h = !0, C();
706
- }, J = () => {
707
- h = !1;
708
- }, U = () => {
709
- !h || y || k || C();
710
- }, G = t => {
711
- if (C(), !e(b)) for (const e of D("copy")) e(t);
712
- }, Z = t => {
713
- t.preventDefault(), G(t.clipboardData);
714
- }, j = e => {
715
- e.preventDefault(), r || (G(e.clipboardData), P({
732
+ y = !1;
733
+ }, G = () => {
734
+ !y || h || k || I();
735
+ }, J = t => {
736
+ if (I(), !e(x)) for (const e of E("copy")) e(t);
737
+ }, Y = t => {
738
+ t.preventDefault(), J(t.clipboardData);
739
+ }, Z = e => {
740
+ e.preventDefault(), r || (J(e.clipboardData), B({
716
741
  type: "delete",
717
- range: t(b)
742
+ range: t(x)
718
743
  }));
719
744
  }, $ = e => {
720
745
  e.preventDefault();
721
- const n = A(e.clipboardData);
746
+ const n = P(e.clipboardData);
722
747
  if (n) {
723
- const e = t(b), r = e[0], o = [ {
748
+ const e = t(x), r = e[0], o = [ {
724
749
  type: "delete",
725
750
  range: e
726
751
  } ];
@@ -732,29 +757,29 @@ const At = [], It = () => {}, Pt = t => {
732
757
  type: "insert_node",
733
758
  at: r,
734
759
  fragment: n
735
- }), P(o);
760
+ }), B(o);
736
761
  }
737
762
  }, tt = e => {
738
763
  e.preventDefault();
739
764
  const r = e.dataTransfer, s = ((t, e, {clientX: n, clientY: r}, o) => {
740
765
  if (t.caretPositionFromPoint) {
741
766
  const c = t.caretPositionFromPoint(n, r);
742
- if (c) return xt(e, c.offsetNode, c.offset, o);
767
+ if (c) return wt(e, c.offsetNode, c.offset, o);
743
768
  } else if (t.caretRangeFromPoint) {
744
769
  const c = t.caretRangeFromPoint(n, r);
745
- if (c) return xt(e, c.startContainer, c.startOffset, o);
770
+ if (c) return wt(e, c.startContainer, c.startOffset, o);
746
771
  }
747
- })(x, o, e, v);
772
+ })(b, o, e, w);
748
773
  if (r && s) {
749
774
  let e;
750
775
  const o = [];
751
776
  k && o.push({
752
777
  type: "delete",
753
- range: t(b)
778
+ range: t(x)
754
779
  });
755
- const i = A(r);
780
+ const i = P(r);
756
781
  if (i) {
757
- const t = m(n, s), r = N(t, o);
782
+ const t = m(n, s), r = H(t, o);
758
783
  o.push(c(i) ? {
759
784
  type: "insert_text",
760
785
  at: r,
@@ -763,39 +788,39 @@ const At = [], It = () => {}, Pt = t => {
763
788
  type: "insert_node",
764
789
  at: r,
765
790
  fragment: i
766
- }), e = [ r, N(t, o) ];
791
+ }), e = [ r, H(t, o) ];
767
792
  }
768
- P(o), e && L(e);
793
+ B(o), e && F(e);
769
794
  }
770
795
  }, et = t => {
771
- k = !0, G(t.dataTransfer);
796
+ k = !0, J(t.dataTransfer);
772
797
  }, nt = () => {
773
798
  k = !1;
774
799
  };
775
- x.addEventListener("selectionchange", U), o.addEventListener("keydown", R), o.addEventListener("input", B),
776
- o.addEventListener("beforeinput", V), o.addEventListener("compositionstart", F),
777
- o.addEventListener("compositionend", W), o.addEventListener("focus", q), o.addEventListener("blur", J),
778
- o.addEventListener("copy", Z), o.addEventListener("cut", j), o.addEventListener("paste", $),
800
+ b.addEventListener("selectionchange", G), o.addEventListener("keydown", R), o.addEventListener("input", T),
801
+ o.addEventListener("beforeinput", L), o.addEventListener("compositionstart", N),
802
+ o.addEventListener("compositionend", V), o.addEventListener("focus", W), o.addEventListener("blur", q),
803
+ o.addEventListener("copy", Y), o.addEventListener("cut", Z), o.addEventListener("paste", $),
779
804
  o.addEventListener("drop", tt), o.addEventListener("dragstart", et), o.addEventListener("dragend", nt);
780
805
  const rt = [];
781
- return D("mount").forEach(t => {
806
+ return E("mount").forEach(t => {
782
807
  const e = t(o);
783
808
  e && rt.push(e);
784
809
  }), () => {
785
- d || (d = !0, E(), O(), o.contentEditable = i, o.role = a, o.ariaMultiLine = l,
786
- o.ariaReadOnly = f, o.style.whiteSpace = u, I.v(), x.removeEventListener("selectionchange", U),
787
- o.removeEventListener("keydown", R), o.removeEventListener("input", B), o.removeEventListener("beforeinput", V),
788
- o.removeEventListener("compositionstart", F), o.removeEventListener("compositionend", W),
789
- o.removeEventListener("focus", q), o.removeEventListener("blur", J), o.removeEventListener("copy", Z),
790
- o.removeEventListener("cut", j), o.removeEventListener("paste", $), o.removeEventListener("drop", tt),
810
+ d || (d = !0, O(), D(), o.contentEditable = i, o.role = a, o.ariaMultiLine = l,
811
+ o.ariaReadOnly = f, o.style.whiteSpace = u, A.v(), b.removeEventListener("selectionchange", G),
812
+ o.removeEventListener("keydown", R), o.removeEventListener("input", T), o.removeEventListener("beforeinput", L),
813
+ o.removeEventListener("compositionstart", N), o.removeEventListener("compositionend", V),
814
+ o.removeEventListener("focus", W), o.removeEventListener("blur", q), o.removeEventListener("copy", Y),
815
+ o.removeEventListener("cut", Z), o.removeEventListener("paste", $), o.removeEventListener("drop", tt),
791
816
  o.removeEventListener("dragstart", et), o.removeEventListener("dragend", nt), rt.forEach(t => {
792
817
  t();
793
818
  }));
794
819
  };
795
820
  }
796
821
  };
797
- return T.exec(Mt), T;
798
- }, Ht = (t, e) => {
822
+ return U.exec(Et), U;
823
+ }, Lt = (t, e) => {
799
824
  t.hook("paste", t => {
800
825
  for (const n of t.items) if ("file" === n.kind) {
801
826
  const t = e[n.type];
@@ -810,11 +835,11 @@ const At = [], It = () => {}, Pt = t => {
810
835
  });
811
836
  };
812
837
 
813
- function Rt(e, n) {
838
+ function Ht(e, n) {
814
839
  const r = n && n.serializer;
815
840
  e.hook("copy", n => {
816
841
  n.setData("text/plain", a({
817
- children: R(e.doc, ...t(e.selection))
842
+ children: T(e.doc, ...t(e.selection))
818
843
  }, r));
819
844
  }), e.hook("paste", t => t.getData("text/plain"));
820
845
  }
@@ -826,7 +851,7 @@ function Bt(t, e) {
826
851
  })), t.hook("copy", t => {
827
852
  if (!n) return;
828
853
  const e = document.createElement("div");
829
- e.appendChild(gt(ht(n), n).cloneContents()), t.setData("text/html", e.innerHTML);
854
+ e.appendChild(kt(_t(n), n).cloneContents()), t.setData("text/html", e.innerHTML);
830
855
  }), t.hook("paste", ((t, e = []) => (n, r) => {
831
856
  const o = n.getData("text/html");
832
857
  if (o) {
@@ -842,7 +867,7 @@ function Bt(t, e) {
842
867
  children: e
843
868
  }), e = null, c = !1;
844
869
  };
845
- for (;t = at(); ) if (4 === t) a(); else if (c = !0, 1 === t) o += et().data; else if (2 === t) {
870
+ for (;t = ft(); ) if (4 === t) a(); else if (c = !0, 1 === t) o += et().data; else if (2 === t) {
846
871
  i();
847
872
  const t = r(et());
848
873
  t && e.push(t);
@@ -865,7 +890,7 @@ const Nt = "application/x-editate-editor";
865
890
 
866
891
  function Vt(e) {
867
892
  e.hook("copy", n => {
868
- n.setData(Nt, JSON.stringify(R(e.doc, ...t(e.selection))));
893
+ n.setData(Nt, JSON.stringify(T(e.doc, ...t(e.selection))));
869
894
  }), e.hook("paste", t => {
870
895
  try {
871
896
  return JSON.parse(t.getData(Nt));
@@ -885,16 +910,16 @@ function Ft(t) {
885
910
  });
886
911
  }
887
912
 
888
- function Lt(t, e) {
913
+ function Ut(t, e) {
889
914
  r(e).forEach(n => {
890
915
  const r = e[n];
891
- t.hook("keyboard", wt(n, () => {
916
+ t.hook("keyboard", St(n, () => {
892
917
  r();
893
918
  }));
894
919
  });
895
920
  }
896
921
 
897
- function Tt(t) {
922
+ function Wt(t) {
898
923
  t.hook("mount", t => {
899
924
  t.ariaMultiLine = null;
900
925
  }), t.hook("apply", (t, e) => {
@@ -903,22 +928,22 @@ function Tt(t) {
903
928
  text: t.text.replaceAll("\n", "")
904
929
  } : "insert_node" === t.type && (t = {
905
930
  ...t,
906
- fragment: [ O(...t.fragment) ]
931
+ fragment: [ D(...t.fragment) ]
907
932
  }), e(t);
908
933
  });
909
934
  }
910
935
 
911
- const Wt = ({text: t, singleline: e, onChange: n, ...r}) => {
912
- const o = Ct({
936
+ const qt = ({text: t, singleline: e, onChange: n, ...r}) => {
937
+ const o = Tt({
913
938
  ...r,
914
939
  doc: {
915
940
  children: l(t)
916
941
  }
917
- }).exec(Rt);
942
+ }).exec(Ht);
918
943
  return o.on("change", () => {
919
944
  n(a(o.doc));
920
- }), e && o.exec(Tt), o;
945
+ }), e && o.exec(Wt), o;
921
946
  };
922
947
 
923
- export { L as Delete, U as Format, W as InsertNode, T as InsertText, Dt as Redo, Ot as Redoable, J as ReplaceDoc, q as ReplaceText, Z as SetBlockAttr, j as ToggleBlockAttr, G as ToggleFormat, St as Undo, Et as Undoable, Ct as createEditor, Wt as createPlainEditor, Ft as debugPlugin, Ht as fileTransferPlugin, Bt as htmlTransferPlugin, Vt as internalTranferPlugin, Lt as keymapPlugin, Rt as plainTransferPlugin, Tt as singlelinePlugin };
948
+ export { V as Delete, G as Format, U as InsertNode, F as InsertText, Dt as Redo, At as Redoable, q as ReplaceDoc, W as ReplaceText, Y as SetBlockAttr, Z as ToggleBlockAttr, J as ToggleFormat, Ot as Undo, Pt as Undoable, Tt as createEditor, qt as createPlainEditor, Ft as debugPlugin, Lt as fileTransferPlugin, Bt as htmlTransferPlugin, Vt as internalTranferPlugin, Ut as keymapPlugin, Ht as plainTransferPlugin, Wt as singlelinePlugin };
924
949
  //# sourceMappingURL=index.js.map