@vizel/core 0.0.1-alpha.1 → 0.0.1-alpha.3
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/LICENSE +21 -0
- package/dist/index.d.ts +13 -13
- package/dist/index.js +141 -141
- package/dist/index10.js +70 -110
- package/dist/index11.js +135 -168
- package/dist/index12.js +83 -74
- package/dist/index13.js +13 -134
- package/dist/index14.js +13 -146
- package/dist/index15.js +303 -15
- package/dist/index16.js +69 -14
- package/dist/index17.js +26 -295
- package/dist/index18.js +2 -2
- package/dist/index19.js +355 -24
- package/dist/index20.js +25 -264
- package/dist/index21.js +85 -68
- package/dist/index22.js +97 -353
- package/dist/index23.js +66 -84
- package/dist/index24.js +12 -36
- package/dist/index25.js +53 -92
- package/dist/index26.js +132 -96
- package/dist/index27.js +59 -126
- package/dist/index28.js +37 -53
- package/dist/index29.js +19 -62
- package/dist/index3.js +165 -60
- package/dist/index30.js +9 -37
- package/dist/index31.js +143 -19
- package/dist/index32.js +264 -11
- package/dist/index33.js +92 -9
- package/dist/index34.js +63 -16
- package/dist/index35.js +4 -58
- package/dist/index36.js +123 -15
- package/dist/index37.js +305 -42
- package/dist/index38.js +487 -4
- package/dist/index39.js +37 -112
- package/dist/index4.js +10 -86
- package/dist/index40.js +653 -301
- package/dist/index41.js +4 -487
- package/dist/index42.js +4 -48
- package/dist/index43.js +206 -642
- package/dist/index44.js +82 -4
- package/dist/index45.js +17 -4
- package/dist/index46.js +57 -237
- package/dist/index47.js +15 -82
- package/dist/index48.js +190 -274
- package/dist/index49.js +281 -1497
- package/dist/index5.js +132 -10
- package/dist/index50.js +1502 -5
- package/dist/index51.js +5 -1561
- package/dist/index52.js +1551 -192
- package/dist/index53.js +1 -1
- package/dist/index54.js +84 -21
- package/dist/index55.js +246 -10
- package/dist/index56.js +3 -7
- package/dist/index57.js +1231 -7
- package/dist/index58.js +731 -11
- package/dist/index59.js +21 -19
- package/dist/index6.js +48 -131
- package/dist/index60.js +10 -25
- package/dist/index61.js +6 -83
- package/dist/index62.js +7 -245
- package/dist/index63.js +11 -1229
- package/dist/index64.js +17 -732
- package/dist/index65.js +25 -3
- package/dist/index66.js +53 -1059
- package/dist/index67.js +1059 -53
- package/dist/index69.js +90 -3
- package/dist/index7.js +228 -409
- package/dist/index70.js +3 -90
- package/dist/index8.js +111 -45
- package/dist/index9.js +409 -228
- package/package.json +54 -80
package/dist/index41.js
CHANGED
|
@@ -1,489 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const k = /* @__PURE__ */ Object.create(null);
|
|
4
|
-
class l {
|
|
5
|
-
/**
|
|
6
|
-
Initialize a selection with the head and anchor and ranges. If no
|
|
7
|
-
ranges are given, constructs a single range across `$anchor` and
|
|
8
|
-
`$head`.
|
|
9
|
-
*/
|
|
10
|
-
constructor(e, t, n) {
|
|
11
|
-
this.$anchor = e, this.$head = t, this.ranges = n || [new E(e.min(t), e.max(t))];
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
The selection's anchor, as an unresolved position.
|
|
15
|
-
*/
|
|
16
|
-
get anchor() {
|
|
17
|
-
return this.$anchor.pos;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
The selection's head.
|
|
21
|
-
*/
|
|
22
|
-
get head() {
|
|
23
|
-
return this.$head.pos;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
The lower bound of the selection's main range.
|
|
27
|
-
*/
|
|
28
|
-
get from() {
|
|
29
|
-
return this.$from.pos;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
The upper bound of the selection's main range.
|
|
33
|
-
*/
|
|
34
|
-
get to() {
|
|
35
|
-
return this.$to.pos;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
The resolved lower bound of the selection's main range.
|
|
39
|
-
*/
|
|
40
|
-
get $from() {
|
|
41
|
-
return this.ranges[0].$from;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
The resolved upper bound of the selection's main range.
|
|
45
|
-
*/
|
|
46
|
-
get $to() {
|
|
47
|
-
return this.ranges[0].$to;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
Indicates whether the selection contains any content.
|
|
51
|
-
*/
|
|
52
|
-
get empty() {
|
|
53
|
-
let e = this.ranges;
|
|
54
|
-
for (let t = 0; t < e.length; t++)
|
|
55
|
-
if (e[t].$from.pos != e[t].$to.pos)
|
|
56
|
-
return !1;
|
|
57
|
-
return !0;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
Get the content of this selection as a slice.
|
|
61
|
-
*/
|
|
62
|
-
content() {
|
|
63
|
-
return this.$from.doc.slice(this.from, this.to, !0);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
Replace the selection with a slice or, if no slice is given,
|
|
67
|
-
delete the selection. Will append to the given transaction.
|
|
68
|
-
*/
|
|
69
|
-
replace(e, t = m.empty) {
|
|
70
|
-
let n = t.content.lastChild, i = null;
|
|
71
|
-
for (let s = 0; s < t.openEnd; s++)
|
|
72
|
-
i = n, n = n.lastChild;
|
|
73
|
-
let o = e.steps.length, a = this.ranges;
|
|
74
|
-
for (let s = 0; s < a.length; s++) {
|
|
75
|
-
let { $from: h, $to: g } = a[s], f = e.mapping.slice(o);
|
|
76
|
-
e.replaceRange(f.map(h.pos), f.map(g.pos), s ? m.empty : t), s == 0 && b(e, o, (n ? n.isInline : i && i.isTextblock) ? -1 : 1);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
Replace the selection with the given node, appending the changes
|
|
81
|
-
to the given transaction.
|
|
82
|
-
*/
|
|
83
|
-
replaceWith(e, t) {
|
|
84
|
-
let n = e.steps.length, i = this.ranges;
|
|
85
|
-
for (let o = 0; o < i.length; o++) {
|
|
86
|
-
let { $from: a, $to: s } = i[o], h = e.mapping.slice(n), g = h.map(a.pos), f = h.map(s.pos);
|
|
87
|
-
o ? e.deleteRange(g, f) : (e.replaceRangeWith(g, f, t), b(e, n, t.isInline ? -1 : 1));
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
Find a valid cursor or leaf node selection starting at the given
|
|
92
|
-
position and searching back if `dir` is negative, and forward if
|
|
93
|
-
positive. When `textOnly` is true, only consider cursor
|
|
94
|
-
selections. Will return null when no valid selection position is
|
|
95
|
-
found.
|
|
96
|
-
*/
|
|
97
|
-
static findFrom(e, t, n = !1) {
|
|
98
|
-
let i = e.parent.inlineContent ? new c(e) : d(e.node(0), e.parent, e.pos, e.index(), t, n);
|
|
99
|
-
if (i)
|
|
100
|
-
return i;
|
|
101
|
-
for (let o = e.depth - 1; o >= 0; o--) {
|
|
102
|
-
let a = t < 0 ? d(e.node(0), e.node(o), e.before(o + 1), e.index(o), t, n) : d(e.node(0), e.node(o), e.after(o + 1), e.index(o) + 1, t, n);
|
|
103
|
-
if (a)
|
|
104
|
-
return a;
|
|
105
|
-
}
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
Find a valid cursor or leaf node selection near the given
|
|
110
|
-
position. Searches forward first by default, but if `bias` is
|
|
111
|
-
negative, it will search backwards first.
|
|
112
|
-
*/
|
|
113
|
-
static near(e, t = 1) {
|
|
114
|
-
return this.findFrom(e, t) || this.findFrom(e, -t) || new p(e.node(0));
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
Find the cursor or leaf node selection closest to the start of
|
|
118
|
-
the given document. Will return an
|
|
119
|
-
[`AllSelection`](https://prosemirror.net/docs/ref/#state.AllSelection) if no valid position
|
|
120
|
-
exists.
|
|
121
|
-
*/
|
|
122
|
-
static atStart(e) {
|
|
123
|
-
return d(e, e, 0, 0, 1) || new p(e);
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
Find the cursor or leaf node selection closest to the end of the
|
|
127
|
-
given document.
|
|
128
|
-
*/
|
|
129
|
-
static atEnd(e) {
|
|
130
|
-
return d(e, e, e.content.size, e.childCount, -1) || new p(e);
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
Deserialize the JSON representation of a selection. Must be
|
|
134
|
-
implemented for custom classes (as a static class method).
|
|
135
|
-
*/
|
|
136
|
-
static fromJSON(e, t) {
|
|
137
|
-
if (!t || !t.type)
|
|
138
|
-
throw new RangeError("Invalid input for Selection.fromJSON");
|
|
139
|
-
let n = k[t.type];
|
|
140
|
-
if (!n)
|
|
141
|
-
throw new RangeError(`No selection type ${t.type} defined`);
|
|
142
|
-
return n.fromJSON(e, t);
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
To be able to deserialize selections from JSON, custom selection
|
|
146
|
-
classes must register themselves with an ID string, so that they
|
|
147
|
-
can be disambiguated. Try to pick something that's unlikely to
|
|
148
|
-
clash with classes from other modules.
|
|
149
|
-
*/
|
|
150
|
-
static jsonID(e, t) {
|
|
151
|
-
if (e in k)
|
|
152
|
-
throw new RangeError("Duplicate use of selection JSON ID " + e);
|
|
153
|
-
return k[e] = t, t.prototype.jsonID = e, t;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,
|
|
157
|
-
which is a value that can be mapped without having access to a
|
|
158
|
-
current document, and later resolved to a real selection for a
|
|
159
|
-
given document again. (This is used mostly by the history to
|
|
160
|
-
track and restore old selections.) The default implementation of
|
|
161
|
-
this method just converts the selection to a text selection and
|
|
162
|
-
returns the bookmark for that.
|
|
163
|
-
*/
|
|
164
|
-
getBookmark() {
|
|
165
|
-
return c.between(this.$anchor, this.$head).getBookmark();
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
l.prototype.visible = !0;
|
|
169
|
-
class E {
|
|
170
|
-
/**
|
|
171
|
-
Create a range.
|
|
172
|
-
*/
|
|
173
|
-
constructor(e, t) {
|
|
174
|
-
this.$from = e, this.$to = t;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
let I = !1;
|
|
178
|
-
function F(r) {
|
|
179
|
-
!I && !r.parent.inlineContent && (I = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + r.parent.type.name + ")"));
|
|
180
|
-
}
|
|
181
|
-
class c extends l {
|
|
182
|
-
/**
|
|
183
|
-
Construct a text selection between the given points.
|
|
184
|
-
*/
|
|
185
|
-
constructor(e, t = e) {
|
|
186
|
-
F(e), F(t), super(e, t);
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
Returns a resolved position if this is a cursor selection (an
|
|
190
|
-
empty text selection), and null otherwise.
|
|
191
|
-
*/
|
|
192
|
-
get $cursor() {
|
|
193
|
-
return this.$anchor.pos == this.$head.pos ? this.$head : null;
|
|
194
|
-
}
|
|
195
|
-
map(e, t) {
|
|
196
|
-
let n = e.resolve(t.map(this.head));
|
|
197
|
-
if (!n.parent.inlineContent)
|
|
198
|
-
return l.near(n);
|
|
199
|
-
let i = e.resolve(t.map(this.anchor));
|
|
200
|
-
return new c(i.parent.inlineContent ? i : n, n);
|
|
201
|
-
}
|
|
202
|
-
replace(e, t = m.empty) {
|
|
203
|
-
if (super.replace(e, t), t == m.empty) {
|
|
204
|
-
let n = this.$from.marksAcross(this.$to);
|
|
205
|
-
n && e.ensureMarks(n);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
eq(e) {
|
|
209
|
-
return e instanceof c && e.anchor == this.anchor && e.head == this.head;
|
|
210
|
-
}
|
|
211
|
-
getBookmark() {
|
|
212
|
-
return new y(this.anchor, this.head);
|
|
213
|
-
}
|
|
214
|
-
toJSON() {
|
|
215
|
-
return { type: "text", anchor: this.anchor, head: this.head };
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
@internal
|
|
219
|
-
*/
|
|
220
|
-
static fromJSON(e, t) {
|
|
221
|
-
if (typeof t.anchor != "number" || typeof t.head != "number")
|
|
222
|
-
throw new RangeError("Invalid input for TextSelection.fromJSON");
|
|
223
|
-
return new c(e.resolve(t.anchor), e.resolve(t.head));
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
Create a text selection from non-resolved positions.
|
|
227
|
-
*/
|
|
228
|
-
static create(e, t, n = t) {
|
|
229
|
-
let i = e.resolve(t);
|
|
230
|
-
return new this(i, n == t ? i : e.resolve(n));
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
Return a text selection that spans the given positions or, if
|
|
234
|
-
they aren't text positions, find a text selection near them.
|
|
235
|
-
`bias` determines whether the method searches forward (default)
|
|
236
|
-
or backwards (negative number) first. Will fall back to calling
|
|
237
|
-
[`Selection.near`](https://prosemirror.net/docs/ref/#state.Selection^near) when the document
|
|
238
|
-
doesn't contain a valid text position.
|
|
239
|
-
*/
|
|
240
|
-
static between(e, t, n) {
|
|
241
|
-
let i = e.pos - t.pos;
|
|
242
|
-
if ((!n || i) && (n = i >= 0 ? 1 : -1), !t.parent.inlineContent) {
|
|
243
|
-
let o = l.findFrom(t, n, !0) || l.findFrom(t, -n, !0);
|
|
244
|
-
if (o)
|
|
245
|
-
t = o.$head;
|
|
246
|
-
else
|
|
247
|
-
return l.near(t, n);
|
|
248
|
-
}
|
|
249
|
-
return e.parent.inlineContent || (i == 0 ? e = t : (e = (l.findFrom(e, -n, !0) || l.findFrom(e, n, !0)).$anchor, e.pos < t.pos != i < 0 && (e = t))), new c(e, t);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
l.jsonID("text", c);
|
|
253
|
-
class y {
|
|
254
|
-
constructor(e, t) {
|
|
255
|
-
this.anchor = e, this.head = t;
|
|
256
|
-
}
|
|
257
|
-
map(e) {
|
|
258
|
-
return new y(e.map(this.anchor), e.map(this.head));
|
|
259
|
-
}
|
|
260
|
-
resolve(e) {
|
|
261
|
-
return c.between(e.resolve(this.anchor), e.resolve(this.head));
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
class u extends l {
|
|
265
|
-
/**
|
|
266
|
-
Create a node selection. Does not verify the validity of its
|
|
267
|
-
argument.
|
|
268
|
-
*/
|
|
269
|
-
constructor(e) {
|
|
270
|
-
let t = e.nodeAfter, n = e.node(0).resolve(e.pos + t.nodeSize);
|
|
271
|
-
super(e, n), this.node = t;
|
|
272
|
-
}
|
|
273
|
-
map(e, t) {
|
|
274
|
-
let { deleted: n, pos: i } = t.mapResult(this.anchor), o = e.resolve(i);
|
|
275
|
-
return n ? l.near(o) : new u(o);
|
|
276
|
-
}
|
|
277
|
-
content() {
|
|
278
|
-
return new m(J.from(this.node), 0, 0);
|
|
279
|
-
}
|
|
280
|
-
eq(e) {
|
|
281
|
-
return e instanceof u && e.anchor == this.anchor;
|
|
282
|
-
}
|
|
283
|
-
toJSON() {
|
|
284
|
-
return { type: "node", anchor: this.anchor };
|
|
285
|
-
}
|
|
286
|
-
getBookmark() {
|
|
287
|
-
return new v(this.anchor);
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
@internal
|
|
291
|
-
*/
|
|
292
|
-
static fromJSON(e, t) {
|
|
293
|
-
if (typeof t.anchor != "number")
|
|
294
|
-
throw new RangeError("Invalid input for NodeSelection.fromJSON");
|
|
295
|
-
return new u(e.resolve(t.anchor));
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
Create a node selection from non-resolved positions.
|
|
299
|
-
*/
|
|
300
|
-
static create(e, t) {
|
|
301
|
-
return new u(e.resolve(t));
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
Determines whether the given node may be selected as a node
|
|
305
|
-
selection.
|
|
306
|
-
*/
|
|
307
|
-
static isSelectable(e) {
|
|
308
|
-
return !e.isText && e.type.spec.selectable !== !1;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
u.prototype.visible = !1;
|
|
312
|
-
l.jsonID("node", u);
|
|
313
|
-
class v {
|
|
314
|
-
constructor(e) {
|
|
315
|
-
this.anchor = e;
|
|
316
|
-
}
|
|
317
|
-
map(e) {
|
|
318
|
-
let { deleted: t, pos: n } = e.mapResult(this.anchor);
|
|
319
|
-
return t ? new y(n, n) : new v(n);
|
|
320
|
-
}
|
|
321
|
-
resolve(e) {
|
|
322
|
-
let t = e.resolve(this.anchor), n = t.nodeAfter;
|
|
323
|
-
return n && u.isSelectable(n) ? new u(t) : l.near(t);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
class p extends l {
|
|
327
|
-
/**
|
|
328
|
-
Create an all-selection over the given document.
|
|
329
|
-
*/
|
|
330
|
-
constructor(e) {
|
|
331
|
-
super(e.resolve(0), e.resolve(e.content.size));
|
|
332
|
-
}
|
|
333
|
-
replace(e, t = m.empty) {
|
|
334
|
-
if (t == m.empty) {
|
|
335
|
-
e.delete(0, e.doc.content.size);
|
|
336
|
-
let n = l.atStart(e.doc);
|
|
337
|
-
n.eq(e.selection) || e.setSelection(n);
|
|
338
|
-
} else
|
|
339
|
-
super.replace(e, t);
|
|
340
|
-
}
|
|
341
|
-
toJSON() {
|
|
342
|
-
return { type: "all" };
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
@internal
|
|
346
|
-
*/
|
|
347
|
-
static fromJSON(e) {
|
|
348
|
-
return new p(e);
|
|
349
|
-
}
|
|
350
|
-
map(e) {
|
|
351
|
-
return new p(e);
|
|
352
|
-
}
|
|
353
|
-
eq(e) {
|
|
354
|
-
return e instanceof p;
|
|
355
|
-
}
|
|
356
|
-
getBookmark() {
|
|
357
|
-
return D;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
l.jsonID("all", p);
|
|
361
|
-
const D = {
|
|
362
|
-
map() {
|
|
363
|
-
return this;
|
|
364
|
-
},
|
|
365
|
-
resolve(r) {
|
|
366
|
-
return new p(r);
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
function d(r, e, t, n, i, o = !1) {
|
|
370
|
-
if (e.inlineContent)
|
|
371
|
-
return c.create(r, t);
|
|
372
|
-
for (let a = n - (i > 0 ? 0 : 1); i > 0 ? a < e.childCount : a >= 0; a += i) {
|
|
373
|
-
let s = e.child(a);
|
|
374
|
-
if (s.isAtom) {
|
|
375
|
-
if (!o && u.isSelectable(s))
|
|
376
|
-
return u.create(r, t - (i < 0 ? s.nodeSize : 0));
|
|
377
|
-
} else {
|
|
378
|
-
let h = d(r, s, t + i, i < 0 ? s.childCount : 0, i, o);
|
|
379
|
-
if (h)
|
|
380
|
-
return h;
|
|
381
|
-
}
|
|
382
|
-
t += s.nodeSize * i;
|
|
383
|
-
}
|
|
384
|
-
return null;
|
|
385
|
-
}
|
|
386
|
-
function b(r, e, t) {
|
|
387
|
-
let n = r.steps.length - 1;
|
|
388
|
-
if (n < e)
|
|
389
|
-
return;
|
|
390
|
-
let i = r.steps[n];
|
|
391
|
-
if (!(i instanceof x || i instanceof C))
|
|
392
|
-
return;
|
|
393
|
-
let o = r.mapping.maps[n], a;
|
|
394
|
-
o.forEach((s, h, g, f) => {
|
|
395
|
-
a == null && (a = f);
|
|
396
|
-
}), r.setSelection(l.near(r.doc.resolve(a), t));
|
|
397
|
-
}
|
|
398
|
-
function N(r, e) {
|
|
399
|
-
return !e || !r ? r : r.bind(e);
|
|
400
|
-
}
|
|
401
|
-
class w {
|
|
402
|
-
constructor(e, t, n) {
|
|
403
|
-
this.name = e, this.init = N(t.init, n), this.apply = N(t.apply, n);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
new w("doc", {
|
|
407
|
-
init(r) {
|
|
408
|
-
return r.doc || r.schema.topNodeType.createAndFill();
|
|
409
|
-
},
|
|
410
|
-
apply(r) {
|
|
411
|
-
return r.doc;
|
|
412
|
-
}
|
|
413
|
-
}), new w("selection", {
|
|
414
|
-
init(r, e) {
|
|
415
|
-
return r.selection || l.atStart(e.doc);
|
|
416
|
-
},
|
|
417
|
-
apply(r) {
|
|
418
|
-
return r.selection;
|
|
419
|
-
}
|
|
420
|
-
}), new w("storedMarks", {
|
|
421
|
-
init(r) {
|
|
422
|
-
return r.storedMarks || null;
|
|
423
|
-
},
|
|
424
|
-
apply(r, e, t, n) {
|
|
425
|
-
return n.selection.$cursor ? r.storedMarks : null;
|
|
426
|
-
}
|
|
427
|
-
}), new w("scrollToSelection", {
|
|
428
|
-
init() {
|
|
429
|
-
return 0;
|
|
430
|
-
},
|
|
431
|
-
apply(r, e) {
|
|
432
|
-
return r.scrolledIntoView ? e + 1 : e;
|
|
433
|
-
}
|
|
434
|
-
});
|
|
435
|
-
function O(r, e, t) {
|
|
436
|
-
for (let n in r) {
|
|
437
|
-
let i = r[n];
|
|
438
|
-
i instanceof Function ? i = i.bind(e) : n == "handleDOMEvents" && (i = O(i, e, {})), t[n] = i;
|
|
439
|
-
}
|
|
440
|
-
return t;
|
|
441
|
-
}
|
|
442
|
-
class A {
|
|
443
|
-
/**
|
|
444
|
-
Create a plugin.
|
|
445
|
-
*/
|
|
446
|
-
constructor(e) {
|
|
447
|
-
this.spec = e, this.props = {}, e.props && O(e.props, this, this.props), this.key = e.key ? e.key.key : R("plugin");
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
Extract the plugin's state field from an editor state.
|
|
451
|
-
*/
|
|
452
|
-
getState(e) {
|
|
453
|
-
return e[this.key];
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
const S = /* @__PURE__ */ Object.create(null);
|
|
457
|
-
function R(r) {
|
|
458
|
-
return r in S ? r + "$" + ++S[r] : (S[r] = 0, r + "$");
|
|
459
|
-
}
|
|
460
|
-
class T {
|
|
461
|
-
/**
|
|
462
|
-
Create a plugin key.
|
|
463
|
-
*/
|
|
464
|
-
constructor(e = "key") {
|
|
465
|
-
this.key = R(e);
|
|
466
|
-
}
|
|
467
|
-
/**
|
|
468
|
-
Get the active plugin with this key, if any, from an editor
|
|
469
|
-
state.
|
|
470
|
-
*/
|
|
471
|
-
get(e) {
|
|
472
|
-
return e.config.pluginsByKey[this.key];
|
|
473
|
-
}
|
|
474
|
-
/**
|
|
475
|
-
Get the plugin's state from an editor state.
|
|
476
|
-
*/
|
|
477
|
-
getState(e) {
|
|
478
|
-
return e[this.key];
|
|
479
|
-
}
|
|
480
|
-
}
|
|
1
|
+
import { TaskItem as a } from "./index53.js";
|
|
2
|
+
var t = a;
|
|
481
3
|
export {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
A as Plugin,
|
|
485
|
-
T as PluginKey,
|
|
486
|
-
l as Selection,
|
|
487
|
-
E as SelectionRange,
|
|
488
|
-
c as TextSelection
|
|
4
|
+
a as TaskItem,
|
|
5
|
+
t as default
|
|
489
6
|
};
|
package/dist/index42.js
CHANGED
|
@@ -1,50 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
var g = ({ key: d, editor: o, onPaste: n, onDrop: s, allowedMimeTypes: a }) => new h({
|
|
4
|
-
key: d || new p("fileHandler"),
|
|
5
|
-
props: {
|
|
6
|
-
handleDrop(f, r) {
|
|
7
|
-
var i;
|
|
8
|
-
if (!s || !((i = r.dataTransfer) != null && i.files.length))
|
|
9
|
-
return !1;
|
|
10
|
-
const e = f.posAtCoords({
|
|
11
|
-
left: r.clientX,
|
|
12
|
-
top: r.clientY
|
|
13
|
-
});
|
|
14
|
-
let t = Array.from(r.dataTransfer.files);
|
|
15
|
-
return a && (t = t.filter((l) => a.includes(l.type))), t.length === 0 ? !1 : (r.preventDefault(), r.stopPropagation(), s(o, t, e?.pos || 0), !0);
|
|
16
|
-
},
|
|
17
|
-
handlePaste(f, r) {
|
|
18
|
-
var i;
|
|
19
|
-
if (!n || !((i = r.clipboardData) != null && i.files.length))
|
|
20
|
-
return !1;
|
|
21
|
-
let e = Array.from(r.clipboardData.files);
|
|
22
|
-
const t = r.clipboardData.getData("text/html");
|
|
23
|
-
return a && (e = e.filter((l) => a.includes(l.type))), !(e.length === 0 || (r.preventDefault(), r.stopPropagation(), n(o, e, t), t.length > 0));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}), m = u.create({
|
|
27
|
-
name: "fileHandler",
|
|
28
|
-
addOptions() {
|
|
29
|
-
return {
|
|
30
|
-
onPaste: void 0,
|
|
31
|
-
onDrop: void 0,
|
|
32
|
-
allowedMimeTypes: void 0
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
addProseMirrorPlugins() {
|
|
36
|
-
return [
|
|
37
|
-
g({
|
|
38
|
-
key: new p(this.name),
|
|
39
|
-
editor: this.editor,
|
|
40
|
-
allowedMimeTypes: this.options.allowedMimeTypes,
|
|
41
|
-
onDrop: this.options.onDrop,
|
|
42
|
-
onPaste: this.options.onPaste
|
|
43
|
-
})
|
|
44
|
-
];
|
|
45
|
-
}
|
|
46
|
-
});
|
|
1
|
+
import { TaskList as a } from "./index53.js";
|
|
2
|
+
var e = a;
|
|
47
3
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
4
|
+
a as TaskList,
|
|
5
|
+
e as default
|
|
50
6
|
};
|