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