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