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