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