editate 0.6.14 → 0.6.15
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 +603 -605
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +465 -467
- 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,173 +2,171 @@ 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, a = e => "children" in e, l = e => e.some(a), 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 && a(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 (a(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 (a(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 (!a(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
|
+
}, y = (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
|
+
}, h = (e, t) => {
|
|
43
|
+
const n = e.children, r = p(e, t);
|
|
44
|
+
if (r) {
|
|
45
|
+
const [t, o, s] = r;
|
|
46
|
+
if (a(t)) {
|
|
47
|
+
const [r, c] = h(t, o), i = n.slice(0, s), a = n.slice(s + 1);
|
|
48
|
+
return i.push(r), a.unshift(c), [ {
|
|
49
|
+
...e,
|
|
50
|
+
children: i
|
|
49
51
|
}, {
|
|
50
|
-
...
|
|
52
|
+
...e,
|
|
51
53
|
children: a
|
|
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
|
+
}, k = (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
|
+
}, g = (e, t) => {
|
|
90
|
+
const [, n, r] = x(e, t);
|
|
89
91
|
return [ r, n ];
|
|
90
|
-
},
|
|
92
|
+
}, m = (e, [t, n]) => [ k(e, t), k(e, n) ], _ = (e, [t, n]) => [ g(e, t), g(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 (a(e)) for (const r of function*(e, t, n) {
|
|
96
|
+
if (t >= n) return;
|
|
97
|
+
if (!a(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), a(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 (a(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 = () => "", E = (n, r = 0, o = 1 / 0, s = v) => {
|
|
111
|
+
let c = "", a = r;
|
|
112
|
+
for (const [l, f] of b(n, r, o)) {
|
|
113
|
+
for (let e = t(0, f - a); e > 0; e--) c += "\n";
|
|
114
|
+
const n = d(l), u = f + n;
|
|
115
|
+
if (i(l)) {
|
|
116
|
+
const s = t(f, r) - f, i = e(u, o) - f;
|
|
117
|
+
c += 0 === s && i === n ? l.text : l.text.slice(s, i);
|
|
118
|
+
} else c += s(l);
|
|
119
|
+
a = u;
|
|
121
120
|
}
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
for (let i = t(0, e(o, d(n)) - a); i > 0; i--) c += "\n";
|
|
122
|
+
return c;
|
|
123
|
+
}, T = (e, t, n) => t >= n ? [] : h(h(e, n)[0], t)[1].children, M = ([e, t]) => e > t ? [ t, e ] : [ e, t ], S = ([e, t]) => e === t, w = ([e, t], [n, r]) => e < r && n < t;
|
|
124
124
|
|
|
125
|
-
function
|
|
126
|
-
|
|
125
|
+
function A(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 O = e => 1 === e.nodeType, R = e => 8 === e.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 = e => B.has(e.tagName), P = (e, t) => e.compareDocumentPosition(t), N = e => e.ownerDocument, L = e => N(e).getSelection(), C = (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
|
+
}, H = (e, t, [n, r], o) => {
|
|
140
|
+
const s = N(e), c = 0 === o, i = o > 0, a = i ? n : r, l = U(e, t, i ? r : n), f = c ? l : U(e, t, a), u = s.createRange(), [d, p] = l, [x, y] = f;
|
|
141
|
+
return O(d) && e !== d ? p < 1 ? u.setStartBefore(d) : u.setStartAfter(d) : u.setStart(d, p),
|
|
142
|
+
O(x) && e !== x ? y < 1 ? u.setEndBefore(x) : u.setEndAfter(x) : u.setEnd(x, y),
|
|
145
143
|
u;
|
|
146
|
-
},
|
|
147
|
-
const s =
|
|
148
|
-
if (o ||
|
|
149
|
-
const o =
|
|
144
|
+
}, F = (e, t, n, r, o) => {
|
|
145
|
+
const s = L(e);
|
|
146
|
+
if (o || C(s, e)) {
|
|
147
|
+
const o = H(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
|
-
},
|
|
150
|
+
}, U = (e, t, [n, r]) => t(({t, o, i: s, l: c}) => {
|
|
153
151
|
let i, a = 0;
|
|
154
|
-
for (;i =
|
|
155
|
-
if (a < n.length) for (let
|
|
152
|
+
for (;i = t(); ) if (4 === i) {
|
|
153
|
+
if (a < n.length) for (let e = n[a++]; 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), V = (t, n, r, o) => {
|
|
161
|
+
let s = !0;
|
|
162
|
+
if (t === r && !r.hasChildNodes()) return [ [], 0 ];
|
|
163
|
+
if (O(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: a, i: l, l: f, k: u}) => {
|
|
168
|
+
c(r), 4 !== u() && i();
|
|
169
|
+
const d = n(() => {
|
|
172
170
|
const e = [];
|
|
173
171
|
for (;u() && l() !== t; ) {
|
|
174
172
|
let t = 0;
|
|
@@ -177,111 +175,111 @@ var M = t => 1 === t.nodeType, S = t => 8 === t.nodeType, w = new Map([ [ "BR",
|
|
|
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 = P(r, l());
|
|
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
|
+
}, W = (e, t, {startOffset: n, startContainer: r, endOffset: o, endContainer: s}) => {
|
|
189
|
+
const c = V(e, t, r, n);
|
|
190
|
+
return [ c, r === s && n === o ? c : V(e, t, s, o) ];
|
|
191
|
+
}, q = (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
|
+
})), z = "delete", G = "insert_text", J = "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
|
+
}, X = (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
|
+
a(t) ? a(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] = Y(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
|
+
}, Y = (...e) => ({
|
|
228
|
+
...e[0],
|
|
229
|
+
children: e.reduce((e, t) => (X(e, t.children), e), [])
|
|
230
|
+
}), Z = (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, [ Z(e.children[o], t, n, r + 1) ]);
|
|
242
240
|
}
|
|
243
241
|
return n;
|
|
244
|
-
},
|
|
245
|
-
const [
|
|
246
|
-
|
|
247
|
-
children:
|
|
242
|
+
}, K = (e, t, n, r) => {
|
|
243
|
+
const [o, s] = h(e, t), c = t < n ? h(e, n)[1] : s, i = l(e.children);
|
|
244
|
+
l(r) ? i || (r = Y(...r).children) : i && (r = [ {
|
|
245
|
+
children: r
|
|
248
246
|
} ]);
|
|
249
|
-
const
|
|
250
|
-
return
|
|
251
|
-
...
|
|
252
|
-
children:
|
|
247
|
+
const a = o.children.slice();
|
|
248
|
+
return X(a, r), X(a, c.children), {
|
|
249
|
+
...e,
|
|
250
|
+
children: a
|
|
253
251
|
};
|
|
254
|
-
},
|
|
255
|
-
switch (
|
|
256
|
-
case
|
|
252
|
+
}, Q = (e, t) => t >= 0 && t <= d(e), $ = (e, t) => t.reduce((e, t) => ee(e, t), e), ee = (e, t) => {
|
|
253
|
+
switch (t.type) {
|
|
254
|
+
case z:
|
|
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 G:
|
|
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 J:
|
|
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 =
|
|
277
|
+
return e;
|
|
278
|
+
}, te = ([e, t], n) => [ ee(e, n), ee(t, n) ], ne = "undefined" != typeof navigator && /Mac|iP(hone|od|ad)/.test(navigator.platform), re = (e, t) => {
|
|
279
|
+
const n = e.endsWith("+"), r = (n ? e.slice(0, -2) : e).split("+"), o = n ? "+" : r.pop(), s = "Space" === o ? " " : o.toLowerCase();
|
|
282
280
|
let c = !1, i = !1, a = !1, l = !1;
|
|
283
|
-
return r.forEach(
|
|
284
|
-
switch (
|
|
281
|
+
return r.forEach(e => {
|
|
282
|
+
switch (e) {
|
|
285
283
|
case "Ctrl":
|
|
286
284
|
i = !0;
|
|
287
285
|
break;
|
|
@@ -291,7 +289,7 @@ var M = t => 1 === t.nodeType, S = t => 8 === t.nodeType, w = new Map([ [ "BR",
|
|
|
291
289
|
break;
|
|
292
290
|
|
|
293
291
|
case "Mod":
|
|
294
|
-
|
|
292
|
+
ne ? a = !0 : i = !0;
|
|
295
293
|
break;
|
|
296
294
|
|
|
297
295
|
case "Alt":
|
|
@@ -301,261 +299,261 @@ var M = t => 1 === t.nodeType, S = t => 8 === t.nodeType, w = new Map([ [ "BR",
|
|
|
301
299
|
case "Shift":
|
|
302
300
|
c = !0;
|
|
303
301
|
}
|
|
304
|
-
}),
|
|
305
|
-
if (
|
|
302
|
+
}), e => {
|
|
303
|
+
if (e.key.toLowerCase() === s && i === e.ctrlKey && a === e.metaKey && c === e.shiftKey && l === e.altKey) return !1 !== t(e);
|
|
306
304
|
};
|
|
307
305
|
};
|
|
308
306
|
|
|
309
|
-
function
|
|
310
|
-
let
|
|
311
|
-
const
|
|
312
|
-
if (i()) {
|
|
313
|
-
const n = c()[1];
|
|
314
|
-
e--;
|
|
315
|
-
const o = t.doc;
|
|
316
|
-
r = !0, t.exec(T, c()[0].children), r = !1, R(o, t.doc) || (t.selection = n);
|
|
317
|
-
}
|
|
318
|
-
}, f = () => {
|
|
307
|
+
function oe(e) {
|
|
308
|
+
let t = 0, n = 0, o = !1;
|
|
309
|
+
const s = Date.now, c = [ [ e.doc, e.selection, [] ] ], i = () => c[t], a = () => t > 0, l = () => t < c.length - 1, f = () => {
|
|
319
310
|
if (a()) {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
311
|
+
const n = i()[1];
|
|
312
|
+
t--;
|
|
313
|
+
const s = e.doc;
|
|
314
|
+
o = !0, e.exec(A, i()[0].children), o = !1, r(s, e.doc) || (e.selection = n);
|
|
315
|
+
}
|
|
316
|
+
}, u = () => {
|
|
317
|
+
if (l()) {
|
|
318
|
+
t++;
|
|
319
|
+
const [n, s, c] = i(), a = e.doc;
|
|
320
|
+
o = !0, e.exec(A, n.children), o = !1, r(a, e.doc) || (e.selection = [ $(s[0], c), $(s[1], c) ]);
|
|
323
321
|
}
|
|
324
322
|
};
|
|
325
|
-
|
|
326
|
-
if (
|
|
327
|
-
const
|
|
328
|
-
i
|
|
329
|
-
const
|
|
330
|
-
if (!
|
|
331
|
-
const
|
|
332
|
-
if (0 ===
|
|
333
|
-
|
|
334
|
-
const
|
|
335
|
-
|
|
323
|
+
e.hook("apply", (i, a) => {
|
|
324
|
+
if (o) return;
|
|
325
|
+
const l = e.doc, f = e.selection;
|
|
326
|
+
a(i);
|
|
327
|
+
const u = e.doc;
|
|
328
|
+
if (!r(l, u)) {
|
|
329
|
+
const e = s();
|
|
330
|
+
if (0 === t || e - n >= 500) {
|
|
331
|
+
t++;
|
|
332
|
+
const e = [ l, 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:
|
|
345
|
-
redoable:
|
|
338
|
+
}), e.hook("keyboard", re("Mod+Z", f)), e.hook("keyboard", re("Shift+Mod+Z", u)),
|
|
339
|
+
e.set(oe, {
|
|
340
|
+
undo: f,
|
|
341
|
+
redo: u,
|
|
342
|
+
undoable: a,
|
|
343
|
+
redoable: l
|
|
346
344
|
});
|
|
347
345
|
}
|
|
348
346
|
|
|
349
|
-
var
|
|
350
|
-
throw Error(
|
|
351
|
-
},
|
|
352
|
-
let
|
|
353
|
-
const
|
|
354
|
-
if (!
|
|
347
|
+
var se = [], ce = () => {}, ie = e => {
|
|
348
|
+
throw Error(e);
|
|
349
|
+
}, ae = ({doc: e, readonly: t = !1, schema: n, isBlock: l = I, onWarn: f = console.warn, onError: u = ie}) => {
|
|
350
|
+
let d = [ 0, 0 ];
|
|
351
|
+
const y = 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 h = new Map,
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}),
|
|
370
|
-
}),
|
|
371
|
-
|
|
361
|
+
n && !y(e) && u("Invalid document");
|
|
362
|
+
const h = new Map, g = new WeakMap, b = e => h.get(e) || se, v = new Map, E = new Set, w = e => {
|
|
363
|
+
const t = v.get(e);
|
|
364
|
+
t && (E.size || c(() => {
|
|
365
|
+
E.forEach(e => {
|
|
366
|
+
e();
|
|
367
|
+
}), E.clear();
|
|
368
|
+
}), t.forEach(e => {
|
|
369
|
+
E.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
|
+
}, A = e => {
|
|
372
|
+
if (!t) if (Array.isArray(e)) for (const t of e) R(t); else R(e);
|
|
373
|
+
return H;
|
|
374
|
+
}, R = t => {
|
|
375
|
+
const n = e, o = b("apply"), s = o.length;
|
|
376
|
+
let c = 0;
|
|
377
|
+
const l = () => {
|
|
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 z:
|
|
389
387
|
{
|
|
390
|
-
const [
|
|
391
|
-
|
|
388
|
+
const [r, o] = n.range;
|
|
389
|
+
Q(e, r) && Q(e, o) && r < o && (e = K(e, r, o, []), t = te(t, n));
|
|
392
390
|
break;
|
|
393
391
|
}
|
|
394
392
|
|
|
395
|
-
case
|
|
393
|
+
case G:
|
|
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 (Q(e, r) && o) {
|
|
397
|
+
const [s, c] = x(e, r), a = p(s, c - 1);
|
|
398
|
+
let l;
|
|
399
|
+
if (a) {
|
|
400
|
+
const e = a[0];
|
|
401
|
+
i(e) && (l = e);
|
|
404
402
|
}
|
|
405
|
-
|
|
403
|
+
e = K(e, r, r, q(o, l, s)), t = te(t, n);
|
|
406
404
|
}
|
|
407
405
|
break;
|
|
408
406
|
}
|
|
409
407
|
|
|
410
|
-
case
|
|
408
|
+
case J:
|
|
411
409
|
{
|
|
412
|
-
const {at:
|
|
413
|
-
|
|
410
|
+
const {at: r, fragment: o} = n;
|
|
411
|
+
Q(e, r) && o.length && (e = K(e, r, r, o), t = te(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 (Q(e, t) && Q(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 = Z(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 => a(e) ? {
|
|
429
|
+
...e,
|
|
430
|
+
children: e.children.map(n)
|
|
431
|
+
} : i(e) ? {
|
|
432
|
+
...e,
|
|
433
|
+
[o]: s
|
|
434
|
+
} : e;
|
|
435
|
+
e = K(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 = Z(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 !== G && e !== z)(t) && !y(n) || (e = n, B(r));
|
|
456
|
+
} catch (n) {
|
|
457
|
+
f("rollback operation: " + n);
|
|
460
458
|
}
|
|
461
459
|
}
|
|
462
|
-
},
|
|
463
|
-
|
|
460
|
+
}, u = e => {
|
|
461
|
+
e && (t = e), c++, l();
|
|
464
462
|
};
|
|
465
|
-
|
|
466
|
-
},
|
|
467
|
-
!((
|
|
468
|
-
|
|
469
|
-
},
|
|
463
|
+
l(), r(n, e) || w("change");
|
|
464
|
+
}, B = t => {
|
|
465
|
+
!((e, [t, n]) => Q(e, t) && Q(e, n))(e, t) || d[0] === t[0] && d[1] === t[1] || (d = t,
|
|
466
|
+
w("selectionchange"));
|
|
467
|
+
}, H = {
|
|
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
|
+
B(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: A,
|
|
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 = h.get(
|
|
494
|
-
return n || h.set(
|
|
495
|
-
const
|
|
496
|
-
-1 !==
|
|
490
|
+
hook: (e, t) => {
|
|
491
|
+
let n = h.get(e);
|
|
492
|
+
return n || h.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(H, ...t);
|
|
499
|
+
return void 0 === n ? H : 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 => (g.has(e) || u("No value found for key"), g.get(e)),
|
|
502
|
+
set: (e, t) => (g.set(e, t), H),
|
|
503
|
+
input: n => {
|
|
504
|
+
if (!window.InputEvent || !s(InputEvent.prototype.getTargetRanges)) return f("beforeinput event is not supported."),
|
|
505
|
+
ce;
|
|
506
|
+
const {contentEditable: r, role: c, ariaMultiLine: i, ariaReadOnly: a} = n, u = n.style.whiteSpace;
|
|
507
|
+
n.role = "textbox", n.style.whiteSpace = "pre-wrap", n.ariaMultiLine = "true";
|
|
508
|
+
let p = !1, x = null, y = !1, h = !1, g = !1;
|
|
509
|
+
const v = N(n), E = ((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 (O(r)) {
|
|
519
517
|
if ("false" === r.contentEditable) return o = 2;
|
|
520
518
|
{
|
|
521
|
-
const
|
|
522
|
-
if (null !=
|
|
523
|
-
if (
|
|
519
|
+
const e = D.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
|
|
534
|
+
const e = r.parentNode;
|
|
537
535
|
return l(() => {
|
|
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
|
}, a = {
|
|
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,100 @@ var it = [], at = () => {}, lt = t => {
|
|
|
566
564
|
p: () => {
|
|
567
565
|
for (;(o = null) || (r = n.parentNode()); ) if (4 === s()) return;
|
|
568
566
|
}
|
|
569
|
-
}, l = (
|
|
567
|
+
}, l = (t, s) => {
|
|
570
568
|
const c = n, i = r, l = o;
|
|
571
569
|
try {
|
|
572
|
-
return n || (n =
|
|
570
|
+
return n || (n = e.createTreeWalker(r = s, 5)), t(a);
|
|
573
571
|
} finally {
|
|
574
572
|
n = c, r = i, o = l, n && i && (n.currentNode = i);
|
|
575
573
|
}
|
|
576
574
|
};
|
|
577
575
|
return l;
|
|
578
|
-
})(
|
|
579
|
-
|
|
576
|
+
})(v, l), T = () => {
|
|
577
|
+
n.contentEditable = t ? "false" : "true", n.ariaReadOnly = t ? "true" : null;
|
|
580
578
|
};
|
|
581
|
-
|
|
582
|
-
const
|
|
583
|
-
|
|
584
|
-
|
|
579
|
+
T();
|
|
580
|
+
const w = H.on("change", () => {
|
|
581
|
+
h || requestAnimationFrame(() => {
|
|
582
|
+
h || n.focus({
|
|
585
583
|
preventScroll: !0
|
|
586
584
|
});
|
|
587
585
|
});
|
|
588
|
-
}),
|
|
589
|
-
for (const
|
|
590
|
-
const n = e
|
|
586
|
+
}), R = H.on("readonly", T), I = e => {
|
|
587
|
+
for (const t of b("paste")) {
|
|
588
|
+
const n = t(e);
|
|
591
589
|
if (n) return n;
|
|
592
590
|
}
|
|
593
|
-
|
|
594
|
-
},
|
|
591
|
+
f("failed to serialize pasted data");
|
|
592
|
+
}, U = ((e, t) => {
|
|
595
593
|
let n = !1, r = [];
|
|
596
|
-
const o =
|
|
597
|
-
n && r.push(...
|
|
598
|
-
}, s = new MutationObserver(
|
|
599
|
-
o(
|
|
594
|
+
const o = e => {
|
|
595
|
+
n && r.push(...e);
|
|
596
|
+
}, s = new MutationObserver(e => {
|
|
597
|
+
o(e), n || t();
|
|
600
598
|
}), c = () => {
|
|
601
599
|
o(s.takeRecords());
|
|
602
600
|
}, i = () => {
|
|
603
601
|
c();
|
|
604
|
-
const
|
|
605
|
-
return r = [],
|
|
602
|
+
const e = r;
|
|
603
|
+
return r = [], e;
|
|
606
604
|
};
|
|
607
|
-
return s.observe(
|
|
605
|
+
return s.observe(e, {
|
|
608
606
|
characterData: !0,
|
|
609
607
|
characterDataOldValue: !0,
|
|
610
608
|
childList: !0,
|
|
611
609
|
subtree: !0
|
|
612
610
|
}), {
|
|
613
|
-
m:
|
|
614
|
-
let
|
|
615
|
-
for (;
|
|
616
|
-
const {target:
|
|
617
|
-
for (let
|
|
618
|
-
for (let
|
|
619
|
-
} else
|
|
611
|
+
m: e => {
|
|
612
|
+
let t;
|
|
613
|
+
for (;t = e.pop(); ) if ("childList" === t.type) {
|
|
614
|
+
const {target: e, removedNodes: n, addedNodes: r, nextSibling: o} = t;
|
|
615
|
+
for (let t = n.length - 1; t >= 0; t--) e.insertBefore(n[t], o);
|
|
616
|
+
for (let t = r.length - 1; t >= 0; t--) e.removeChild(r[t]);
|
|
617
|
+
} else t.target.data = t.oldValue;
|
|
620
618
|
i();
|
|
621
619
|
},
|
|
622
|
-
_:
|
|
623
|
-
!n &&
|
|
620
|
+
_: e => {
|
|
621
|
+
!n && e && c(), n = e;
|
|
624
622
|
},
|
|
625
623
|
v: i,
|
|
626
624
|
T: () => {
|
|
627
625
|
r.length = 0, s.disconnect();
|
|
628
626
|
}
|
|
629
627
|
};
|
|
630
|
-
})(
|
|
631
|
-
|
|
632
|
-
}),
|
|
633
|
-
|
|
634
|
-
const n =
|
|
628
|
+
})(n, () => {
|
|
629
|
+
F(n, E, _(e, d), d[0] - d[1]);
|
|
630
|
+
}), q = () => {
|
|
631
|
+
B(m(e, ((e, t) => {
|
|
632
|
+
const n = L(e), r = C(n, e);
|
|
635
633
|
if (!r) return [ [ [ 0 ], 0 ], [ [ 0 ], 0 ] ];
|
|
636
|
-
const o =
|
|
634
|
+
const o = W(e, t, r), s = P(n.anchorNode, n.focusNode);
|
|
637
635
|
return (0 === s ? n.anchorOffset > n.focusOffset : 2 & s) ? [ o[1], o[0] ] : o;
|
|
638
|
-
})(
|
|
639
|
-
},
|
|
640
|
-
const
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
}, G =
|
|
644
|
-
if (!y) for (const
|
|
636
|
+
})(n, E)));
|
|
637
|
+
}, z = () => {
|
|
638
|
+
const t = U.v();
|
|
639
|
+
U._(!1), t.length && (U.m(t), v.removeEventListener("selectionchange", Q), F(n, E, _(e, d), d[0] - d[1], !0),
|
|
640
|
+
v.addEventListener("selectionchange", Q)), x && (B(x[1]), A(x[0]), x = null), y = !1;
|
|
641
|
+
}, G = e => {
|
|
642
|
+
if (!y) for (const t of b("keyboard")) if (t(e)) return e.preventDefault(), void U._(!1);
|
|
645
643
|
}, J = () => {
|
|
646
|
-
y ||
|
|
647
|
-
}, j =
|
|
648
|
-
|
|
649
|
-
const r =
|
|
644
|
+
y || z();
|
|
645
|
+
}, j = t => {
|
|
646
|
+
t.preventDefault();
|
|
647
|
+
const r = t.inputType;
|
|
650
648
|
if (r.startsWith("format")) return;
|
|
651
649
|
if ("historyUndo" === r || "historyRedo" === r) return;
|
|
652
|
-
y ?
|
|
653
|
-
const o =
|
|
650
|
+
y ? U._(!0) : q();
|
|
651
|
+
const o = t.getTargetRanges()[0];
|
|
654
652
|
if (o) {
|
|
655
|
-
let s = "insertParagraph" === r || "insertLineBreak" === r ? "\n" :
|
|
653
|
+
let s = "insertParagraph" === r || "insertLineBreak" === r ? "\n" : t.data;
|
|
656
654
|
if (null == s) {
|
|
657
|
-
const
|
|
658
|
-
|
|
655
|
+
const e = t.dataTransfer;
|
|
656
|
+
e && (s = e.getData("text/plain"));
|
|
659
657
|
}
|
|
660
|
-
|
|
661
|
-
const c =
|
|
662
|
-
|
|
658
|
+
x || (x = [ [], d ]);
|
|
659
|
+
const c = x[0], i = m(e, W(n, E, o));
|
|
660
|
+
S(i) || c.push({
|
|
663
661
|
type: "delete",
|
|
664
662
|
range: i
|
|
665
663
|
}), s && c.push({
|
|
@@ -668,266 +666,266 @@ var it = [], at = () => {}, lt = t => {
|
|
|
668
666
|
text: s
|
|
669
667
|
});
|
|
670
668
|
}
|
|
671
|
-
y ||
|
|
669
|
+
y || z();
|
|
672
670
|
}, X = () => {
|
|
673
|
-
y ||
|
|
671
|
+
y || q(), y = !0;
|
|
674
672
|
}, Y = () => {
|
|
675
|
-
|
|
673
|
+
z();
|
|
676
674
|
}, Z = () => {
|
|
677
|
-
|
|
675
|
+
h = !0, q();
|
|
678
676
|
}, K = () => {
|
|
679
|
-
|
|
677
|
+
h = !1;
|
|
680
678
|
}, Q = () => {
|
|
681
|
-
|
|
682
|
-
},
|
|
683
|
-
if (
|
|
684
|
-
},
|
|
685
|
-
|
|
686
|
-
},
|
|
687
|
-
|
|
679
|
+
h && !g && q();
|
|
680
|
+
}, ee = e => {
|
|
681
|
+
if (q(), !S(d)) for (const t of b("copy")) t(e);
|
|
682
|
+
}, te = e => {
|
|
683
|
+
e.preventDefault(), ee(e.clipboardData);
|
|
684
|
+
}, ne = e => {
|
|
685
|
+
e.preventDefault(), t || (ee(e.clipboardData), A({
|
|
688
686
|
type: "delete",
|
|
689
|
-
range:
|
|
687
|
+
range: M(d)
|
|
690
688
|
}));
|
|
691
|
-
},
|
|
692
|
-
|
|
693
|
-
const
|
|
694
|
-
if (
|
|
695
|
-
const
|
|
689
|
+
}, re = e => {
|
|
690
|
+
e.preventDefault();
|
|
691
|
+
const t = I(e.clipboardData);
|
|
692
|
+
if (t) {
|
|
693
|
+
const e = M(d), n = e[0], r = [ {
|
|
696
694
|
type: "delete",
|
|
697
|
-
range:
|
|
695
|
+
range: e
|
|
698
696
|
} ];
|
|
699
|
-
r.push(
|
|
697
|
+
r.push(o(t) ? {
|
|
700
698
|
type: "insert_text",
|
|
701
699
|
at: n,
|
|
702
|
-
text:
|
|
700
|
+
text: t
|
|
703
701
|
} : {
|
|
704
702
|
type: "insert_node",
|
|
705
703
|
at: n,
|
|
706
|
-
fragment:
|
|
707
|
-
}),
|
|
704
|
+
fragment: t
|
|
705
|
+
}), A(r);
|
|
708
706
|
}
|
|
709
|
-
},
|
|
710
|
-
|
|
711
|
-
const r =
|
|
712
|
-
const o =
|
|
707
|
+
}, oe = t => {
|
|
708
|
+
t.preventDefault();
|
|
709
|
+
const r = t.dataTransfer, s = ((e, t, {clientX: n, clientY: r}) => {
|
|
710
|
+
const o = N(e);
|
|
713
711
|
if (o.caretPositionFromPoint) {
|
|
714
712
|
const s = o.caretPositionFromPoint(n, r);
|
|
715
|
-
if (s) return
|
|
713
|
+
if (s) return V(e, t, s.offsetNode, s.offset);
|
|
716
714
|
} else if (o.caretRangeFromPoint) {
|
|
717
715
|
const s = o.caretRangeFromPoint(n, r);
|
|
718
|
-
if (s) return
|
|
716
|
+
if (s) return V(e, t, s.startContainer, s.startOffset);
|
|
719
717
|
}
|
|
720
|
-
})(
|
|
721
|
-
if (r &&
|
|
718
|
+
})(n, E, t);
|
|
719
|
+
if (r && s) {
|
|
722
720
|
let t;
|
|
723
|
-
const
|
|
724
|
-
|
|
721
|
+
const n = [];
|
|
722
|
+
g && n.push({
|
|
725
723
|
type: "delete",
|
|
726
|
-
range:
|
|
724
|
+
range: M(d)
|
|
727
725
|
});
|
|
728
|
-
const
|
|
729
|
-
if (
|
|
730
|
-
const r =
|
|
731
|
-
|
|
726
|
+
const c = I(r);
|
|
727
|
+
if (c) {
|
|
728
|
+
const r = k(e, s), i = $(r, n);
|
|
729
|
+
n.push(o(c) ? {
|
|
732
730
|
type: "insert_text",
|
|
733
|
-
at:
|
|
734
|
-
text:
|
|
731
|
+
at: i,
|
|
732
|
+
text: c
|
|
735
733
|
} : {
|
|
736
734
|
type: "insert_node",
|
|
737
|
-
at:
|
|
738
|
-
fragment:
|
|
739
|
-
}), t = [
|
|
735
|
+
at: i,
|
|
736
|
+
fragment: c
|
|
737
|
+
}), t = [ i, $(r, n) ];
|
|
740
738
|
}
|
|
741
|
-
|
|
739
|
+
A(n), t && B(t);
|
|
742
740
|
}
|
|
743
|
-
},
|
|
744
|
-
|
|
745
|
-
},
|
|
746
|
-
|
|
741
|
+
}, se = e => {
|
|
742
|
+
g = !0, ee(e.dataTransfer);
|
|
743
|
+
}, ie = () => {
|
|
744
|
+
g = !1;
|
|
747
745
|
};
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
const
|
|
754
|
-
return
|
|
755
|
-
const
|
|
756
|
-
|
|
746
|
+
v.addEventListener("selectionchange", Q), n.addEventListener("keydown", G), n.addEventListener("input", J),
|
|
747
|
+
n.addEventListener("beforeinput", j), n.addEventListener("compositionstart", X),
|
|
748
|
+
n.addEventListener("compositionend", Y), n.addEventListener("focus", Z), n.addEventListener("blur", K),
|
|
749
|
+
n.addEventListener("copy", te), n.addEventListener("cut", ne), n.addEventListener("paste", re),
|
|
750
|
+
n.addEventListener("drop", oe), n.addEventListener("dragstart", se), n.addEventListener("dragend", ie);
|
|
751
|
+
const ae = [];
|
|
752
|
+
return b("mount").forEach(e => {
|
|
753
|
+
const t = e(n, E);
|
|
754
|
+
t && ae.push(t);
|
|
757
755
|
}), () => {
|
|
758
|
-
p || (p = !0,
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
756
|
+
p || (p = !0, w(), R(), n.contentEditable = r, n.role = c, n.ariaMultiLine = i,
|
|
757
|
+
n.ariaReadOnly = a, n.style.whiteSpace = u, U.T(), v.removeEventListener("selectionchange", Q),
|
|
758
|
+
n.removeEventListener("keydown", G), n.removeEventListener("input", J), n.removeEventListener("beforeinput", j),
|
|
759
|
+
n.removeEventListener("compositionstart", X), n.removeEventListener("compositionend", Y),
|
|
760
|
+
n.removeEventListener("focus", Z), n.removeEventListener("blur", K), n.removeEventListener("copy", te),
|
|
761
|
+
n.removeEventListener("cut", ne), n.removeEventListener("paste", re), n.removeEventListener("drop", oe),
|
|
762
|
+
n.removeEventListener("dragstart", se), n.removeEventListener("dragend", ie), ae.forEach(e => {
|
|
763
|
+
e();
|
|
766
764
|
}));
|
|
767
765
|
};
|
|
768
766
|
}
|
|
769
767
|
};
|
|
770
|
-
return
|
|
768
|
+
return H.exec(oe), H;
|
|
771
769
|
};
|
|
772
770
|
|
|
773
|
-
function
|
|
774
|
-
const n =
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
}),
|
|
771
|
+
function le(e, t) {
|
|
772
|
+
const n = t && t.voidToString;
|
|
773
|
+
e.hook("copy", t => {
|
|
774
|
+
t.setData("text/plain", E(e.doc, ...M(e.selection), n));
|
|
775
|
+
}), e.hook("paste", e => e.getData("text/plain"));
|
|
778
776
|
}
|
|
779
777
|
|
|
780
|
-
var
|
|
778
|
+
var fe = "application/x-editate-editor";
|
|
781
779
|
|
|
782
|
-
function
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
}),
|
|
786
|
-
if ("insert_text" ===
|
|
787
|
-
...
|
|
788
|
-
text:
|
|
789
|
-
}; else if ("insert_node" ===
|
|
790
|
-
const
|
|
791
|
-
|
|
792
|
-
...
|
|
793
|
-
fragment:
|
|
780
|
+
function ue(e) {
|
|
781
|
+
e.hook("mount", e => {
|
|
782
|
+
e.ariaMultiLine = null;
|
|
783
|
+
}), e.hook("apply", (e, t) => {
|
|
784
|
+
if ("insert_text" === e.type) e = {
|
|
785
|
+
...e,
|
|
786
|
+
text: e.text.replaceAll("\n", "")
|
|
787
|
+
}; else if ("insert_node" === e.type) {
|
|
788
|
+
const t = e.fragment;
|
|
789
|
+
e = {
|
|
790
|
+
...e,
|
|
791
|
+
fragment: l(t) ? [ Y(...t) ] : t
|
|
794
792
|
};
|
|
795
793
|
}
|
|
796
|
-
e
|
|
794
|
+
t(e);
|
|
797
795
|
});
|
|
798
796
|
}
|
|
799
797
|
|
|
800
|
-
exports.Delete = function(
|
|
801
|
-
|
|
798
|
+
exports.Delete = function(e, t = M(e.selection)) {
|
|
799
|
+
e.apply({
|
|
802
800
|
type: "delete",
|
|
803
|
-
range:
|
|
801
|
+
range: t
|
|
804
802
|
});
|
|
805
|
-
}, exports.Format = function(
|
|
806
|
-
|
|
803
|
+
}, exports.Format = function(e, t, n, r = M(e.selection)) {
|
|
804
|
+
e.apply({
|
|
807
805
|
type: "format",
|
|
808
806
|
range: r,
|
|
809
|
-
key:
|
|
807
|
+
key: t,
|
|
810
808
|
value: n
|
|
811
809
|
});
|
|
812
|
-
}, exports.InsertNode = function(
|
|
813
|
-
|
|
810
|
+
}, exports.InsertNode = function(e, t, n = e.selection[0]) {
|
|
811
|
+
e.apply({
|
|
814
812
|
type: "insert_node",
|
|
815
813
|
at: n,
|
|
816
814
|
fragment: [ {
|
|
817
|
-
children: [
|
|
815
|
+
children: [ t ]
|
|
818
816
|
} ]
|
|
819
817
|
});
|
|
820
|
-
}, exports.InsertText = function(
|
|
821
|
-
|
|
818
|
+
}, exports.InsertText = function(e, t, n = e.selection[0]) {
|
|
819
|
+
e.apply({
|
|
822
820
|
type: "insert_text",
|
|
823
821
|
at: n,
|
|
824
|
-
text:
|
|
822
|
+
text: t
|
|
825
823
|
});
|
|
826
|
-
}, exports.Redo = function(
|
|
827
|
-
|
|
828
|
-
}, exports.Redoable = function(
|
|
829
|
-
return
|
|
830
|
-
}, exports.ReplaceDoc =
|
|
831
|
-
|
|
824
|
+
}, exports.Redo = function(e) {
|
|
825
|
+
e.get(oe).redo();
|
|
826
|
+
}, exports.Redoable = function(e) {
|
|
827
|
+
return e.get(oe).redoable();
|
|
828
|
+
}, exports.ReplaceDoc = A, exports.ReplaceText = function(e, t, n = M(e.selection)) {
|
|
829
|
+
e.apply({
|
|
832
830
|
type: "delete",
|
|
833
831
|
range: n
|
|
834
832
|
}).apply({
|
|
835
833
|
type: "insert_text",
|
|
836
834
|
at: n[0],
|
|
837
|
-
text:
|
|
835
|
+
text: t
|
|
838
836
|
});
|
|
839
|
-
}, exports.SetBlockAttr = function(
|
|
840
|
-
const o =
|
|
841
|
-
|
|
837
|
+
}, exports.SetBlockAttr = function(e, t, n, r = e.selection[0]) {
|
|
838
|
+
const o = x(e.doc, r)[2];
|
|
839
|
+
e.apply({
|
|
842
840
|
type: "patch_node",
|
|
843
841
|
path: o,
|
|
844
|
-
key:
|
|
842
|
+
key: t,
|
|
845
843
|
value: n
|
|
846
844
|
});
|
|
847
|
-
}, exports.ToggleBlockAttr = function(
|
|
848
|
-
const [s, , c] =
|
|
849
|
-
|
|
845
|
+
}, exports.ToggleBlockAttr = function(e, t, n, r, o = e.selection[0]) {
|
|
846
|
+
const [s, , c] = x(e.doc, o);
|
|
847
|
+
e.apply({
|
|
850
848
|
type: "patch_node",
|
|
851
849
|
path: c,
|
|
852
|
-
key:
|
|
853
|
-
value: s[
|
|
850
|
+
key: t,
|
|
851
|
+
value: s[t] === n ? r : n
|
|
854
852
|
});
|
|
855
|
-
}, exports.ToggleFormat = function(e,
|
|
856
|
-
let
|
|
857
|
-
if (
|
|
858
|
-
const
|
|
859
|
-
if (!
|
|
860
|
-
|
|
853
|
+
}, exports.ToggleFormat = function(e, t, n = M(e.selection)) {
|
|
854
|
+
let r = !1;
|
|
855
|
+
if (S(n)) {
|
|
856
|
+
const o = y(e.doc, n[0])?.[0];
|
|
857
|
+
if (!o || !i(o)) return;
|
|
858
|
+
r = !o[t];
|
|
861
859
|
} else {
|
|
862
|
-
let
|
|
863
|
-
for (const [
|
|
864
|
-
!
|
|
865
|
-
|
|
860
|
+
let o = !1;
|
|
861
|
+
for (const [s, c] of b(e.doc, ...n)) if (w(n, [ c, c + d(s) ]) && i(s) && (o = !0,
|
|
862
|
+
!s[t])) {
|
|
863
|
+
r = !0;
|
|
866
864
|
break;
|
|
867
865
|
}
|
|
868
|
-
if (!
|
|
866
|
+
if (!o) return;
|
|
869
867
|
}
|
|
870
868
|
e.apply({
|
|
871
869
|
type: "format",
|
|
872
|
-
range:
|
|
873
|
-
key:
|
|
874
|
-
value:
|
|
870
|
+
range: n,
|
|
871
|
+
key: t,
|
|
872
|
+
value: r
|
|
875
873
|
});
|
|
876
|
-
}, exports.Undo = function(
|
|
877
|
-
|
|
878
|
-
}, exports.Undoable = function(
|
|
879
|
-
return
|
|
880
|
-
}, exports.createEditor =
|
|
881
|
-
const o =
|
|
874
|
+
}, exports.Undo = function(e) {
|
|
875
|
+
e.get(oe).undo();
|
|
876
|
+
}, exports.Undoable = function(e) {
|
|
877
|
+
return e.get(oe).undoable();
|
|
878
|
+
}, exports.createEditor = ae, exports.createPlainEditor = ({text: e, singleline: t, onChange: n, ...r}) => {
|
|
879
|
+
const o = ae({
|
|
882
880
|
...r,
|
|
883
881
|
doc: {
|
|
884
|
-
children:
|
|
882
|
+
children: q(e)
|
|
885
883
|
}
|
|
886
|
-
}).exec(
|
|
887
|
-
return
|
|
888
|
-
n(
|
|
884
|
+
}).exec(le);
|
|
885
|
+
return t && o.exec(ue), o.on("change", () => {
|
|
886
|
+
n(E(o.doc));
|
|
889
887
|
}), o;
|
|
890
|
-
}, exports.debugPlugin = function(
|
|
891
|
-
|
|
892
|
-
console.log("apply",
|
|
893
|
-
}),
|
|
894
|
-
console.log("change",
|
|
895
|
-
}),
|
|
896
|
-
console.log("selectionchange",
|
|
888
|
+
}, exports.debugPlugin = function(e) {
|
|
889
|
+
e.hook("apply", e => {
|
|
890
|
+
console.log("apply", e);
|
|
891
|
+
}), e.on("change", () => {
|
|
892
|
+
console.log("change", e.doc);
|
|
893
|
+
}), e.on("selectionchange", () => {
|
|
894
|
+
console.log("selectionchange", e.selection);
|
|
897
895
|
});
|
|
898
|
-
}, exports.fileTransferPlugin = (
|
|
899
|
-
|
|
900
|
-
for (const n of
|
|
901
|
-
const
|
|
902
|
-
if (
|
|
903
|
-
const
|
|
904
|
-
if (
|
|
905
|
-
children: [ t
|
|
896
|
+
}, exports.fileTransferPlugin = (e, t) => {
|
|
897
|
+
e.hook("paste", e => {
|
|
898
|
+
for (const n of e.items) if ("file" === n.kind) {
|
|
899
|
+
const e = t[n.type];
|
|
900
|
+
if (e) {
|
|
901
|
+
const t = n.getAsFile();
|
|
902
|
+
if (t) return [ {
|
|
903
|
+
children: [ e(t) ]
|
|
906
904
|
} ];
|
|
907
905
|
}
|
|
908
906
|
}
|
|
909
907
|
return null;
|
|
910
908
|
});
|
|
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
|
|
909
|
+
}, exports.getBlockAt = x, exports.getChildAt = p, exports.getLeafAt = y, exports.getNodeSize = d,
|
|
910
|
+
exports.htmlTransferPlugin = function(e, t) {
|
|
911
|
+
e.hook("mount", (n, r) => {
|
|
912
|
+
const o = e.hook("copy", e => {
|
|
913
|
+
const t = document.createElement("div");
|
|
914
|
+
t.appendChild(C(L(n), n).cloneContents()), e.setData("text/html", t.innerHTML);
|
|
915
|
+
}), s = e.hook("paste", e => {
|
|
916
|
+
const n = e.getData("text/html");
|
|
917
|
+
return n ? ((e, t, n) => {
|
|
918
|
+
const r = n.text, o = e => {
|
|
919
|
+
const t = n[e.tagName.toLowerCase()];
|
|
920
|
+
if (t) {
|
|
921
|
+
const n = t(e);
|
|
924
922
|
if (n) return n;
|
|
925
923
|
}
|
|
926
924
|
};
|
|
927
|
-
let s = (new DOMParser).parseFromString(
|
|
928
|
-
for (const i of [ ...s.childNodes ])
|
|
925
|
+
let s = (new DOMParser).parseFromString(e, "text/html").body, c = !1;
|
|
926
|
+
for (const i of [ ...s.childNodes ]) R(i) ? "StartFragment" === i.data ? (c = !0,
|
|
929
927
|
s = new DocumentFragment) : "EndFragment" === i.data && (c = !1) : c && s.appendChild(i);
|
|
930
|
-
return
|
|
928
|
+
return t(({t: e, i: t}) => {
|
|
931
929
|
let n, s = null, c = "", i = !1;
|
|
932
930
|
const a = [], l = () => {
|
|
933
931
|
c && (s || (s = []), s.push(r(c)), c = "");
|
|
@@ -936,44 +934,44 @@ exports.htmlTransferPlugin = function(t, e) {
|
|
|
936
934
|
children: s
|
|
937
935
|
}), s = null, i = !1;
|
|
938
936
|
};
|
|
939
|
-
for (;n =
|
|
937
|
+
for (;n = e(); ) if (4 === n) f(); else if (i = !0, 1 === n) c += t().data; else if (2 === n) {
|
|
940
938
|
l();
|
|
941
|
-
const
|
|
942
|
-
|
|
939
|
+
const e = o(t());
|
|
940
|
+
e && s.push(e);
|
|
943
941
|
} else 3 === n && f();
|
|
944
942
|
return f(), a.length || a.push({
|
|
945
943
|
children: []
|
|
946
944
|
}), a;
|
|
947
945
|
}, s);
|
|
948
|
-
})(n, r,
|
|
946
|
+
})(n, r, t.serializers) : null;
|
|
949
947
|
});
|
|
950
948
|
return () => {
|
|
951
949
|
o(), s();
|
|
952
950
|
};
|
|
953
951
|
});
|
|
954
|
-
}, exports.internalTranferPlugin = function(
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
}),
|
|
952
|
+
}, exports.internalTranferPlugin = function(e) {
|
|
953
|
+
e.hook("copy", t => {
|
|
954
|
+
t.setData(fe, JSON.stringify(T(e.doc, ...M(e.selection))));
|
|
955
|
+
}), e.hook("paste", e => {
|
|
958
956
|
try {
|
|
959
|
-
return JSON.parse(
|
|
960
|
-
} catch (
|
|
957
|
+
return JSON.parse(e.getData(fe));
|
|
958
|
+
} catch (t) {
|
|
961
959
|
return null;
|
|
962
960
|
}
|
|
963
961
|
});
|
|
964
|
-
}, exports.
|
|
965
|
-
|
|
966
|
-
const r =
|
|
967
|
-
|
|
962
|
+
}, exports.iterLeafs = b, exports.keymapPlugin = function(e, t) {
|
|
963
|
+
n(t).forEach(n => {
|
|
964
|
+
const r = t[n];
|
|
965
|
+
e.hook("keyboard", re(n, r));
|
|
968
966
|
});
|
|
969
|
-
}, exports.
|
|
970
|
-
|
|
967
|
+
}, exports.plainTransferPlugin = le, exports.selectionRectPlugin = function(e, t) {
|
|
968
|
+
e.hook("mount", (n, r) => {
|
|
971
969
|
let o = !0, s = !1;
|
|
972
|
-
const c =
|
|
970
|
+
const c = e.on("selectionchange", () => {
|
|
973
971
|
s || (s = !0, requestAnimationFrame(() => {
|
|
974
|
-
s = !1, o &&
|
|
975
|
-
const
|
|
976
|
-
return
|
|
972
|
+
s = !1, o && t(() => {
|
|
973
|
+
const t = e.selection;
|
|
974
|
+
return H(n, r, _(e.doc, t), t[0] - t[1]).getBoundingClientRect();
|
|
977
975
|
});
|
|
978
976
|
}));
|
|
979
977
|
});
|
|
@@ -981,5 +979,5 @@ exports.htmlTransferPlugin = function(t, e) {
|
|
|
981
979
|
o = !1, c();
|
|
982
980
|
};
|
|
983
981
|
});
|
|
984
|
-
}, exports.singlelinePlugin =
|
|
982
|
+
}, exports.singlelinePlugin = ue, exports.sliceText = E;
|
|
985
983
|
//# sourceMappingURL=index.cjs.map
|