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