@caspeco/casper-ui-library 9.11.1 → 9.13.0
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/dist/components/date-picker/base-date-picker.d.ts +1 -1
- package/dist/components/date-picker/base-date-picker.d.ts.map +1 -1
- package/dist/components/date-picker/base-date-picker.js +198 -178
- package/dist/components/date-picker/date-multi-picker.d.ts +8 -0
- package/dist/components/date-picker/date-multi-picker.d.ts.map +1 -0
- package/dist/components/date-picker/date-multi-picker.js +54 -0
- package/dist/components/date-picker/date-picker.composition.d.ts +3 -0
- package/dist/components/date-picker/date-picker.composition.d.ts.map +1 -1
- package/dist/components/date-picker/index.d.ts +2 -1
- package/dist/components/date-picker/index.d.ts.map +1 -1
- package/dist/components/date-picker/types.d.ts +16 -0
- package/dist/components/date-picker/types.d.ts.map +1 -1
- package/dist/components/spinner/index.d.ts +3 -0
- package/dist/components/spinner/index.d.ts.map +1 -0
- package/dist/components/spinner/spinner.composition.d.ts +3 -0
- package/dist/components/spinner/spinner.composition.d.ts.map +1 -0
- package/dist/components/spinner/spinner.d.ts +3 -0
- package/dist/components/spinner/spinner.d.ts.map +1 -0
- package/dist/components/spinner/spinner.js +52 -0
- package/dist/components/spinner/spinner.spec.d.ts +2 -0
- package/dist/components/spinner/spinner.spec.d.ts.map +1 -0
- package/dist/components/spinner/spinner.visual.test.d.ts +2 -0
- package/dist/components/spinner/spinner.visual.test.d.ts.map +1 -0
- package/dist/components/spinner/types.d.ts +6 -0
- package/dist/components/spinner/types.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +664 -660
- package/dist/node_modules/@tiptap/core/dist/index.js +541 -525
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +1464 -27
- package/dist/node_modules/@tiptap/extension-code/dist/index.js +26 -9
- package/dist/node_modules/@tiptap/extension-list/dist/index.js +314 -250
- package/dist/node_modules/@tiptap/extensions/dist/index.js +205 -182
- package/package.json +9 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { findWrapping as ye, canJoin as bt, Transform as ke, RemoveMarkStep as we, liftTarget as
|
|
2
|
-
import { createParagraphNear as Ee, exitCode as Te, joinUp as Ae, joinDown as Ce, joinBackward as Pe, joinForward as $e, joinTextblockBackward as Ne, joinTextblockForward as Ie, lift as
|
|
3
|
-
import { NodeSelection as st, EditorState as Ve, Selection as F, TextSelection as
|
|
4
|
-
import { Node as zt, DOMParser as tt, DOMSerializer as We, Schema as Ft, Fragment as
|
|
1
|
+
import { findWrapping as ye, canJoin as bt, Transform as ke, RemoveMarkStep as we, liftTarget as Me, joinPoint as Lt, canSplit as X, ReplaceStep as xe, ReplaceAroundStep as Se } from "../../../prosemirror-transform/dist/index.js";
|
|
2
|
+
import { createParagraphNear as Ee, exitCode as Te, joinUp as Ae, joinDown as Ce, joinBackward as Pe, joinForward as $e, joinTextblockBackward as Ne, joinTextblockForward as Ie, lift as Re, liftEmptyBlock as Oe, newlineInCode as je, selectNodeBackward as Be, selectNodeForward as De, selectParentNode as _e, selectTextblockEnd as Le, selectTextblockStart as ze, setBlockType as Ct, wrapIn as Fe } from "../../../prosemirror-commands/dist/index.js";
|
|
3
|
+
import { NodeSelection as st, EditorState as Ve, Selection as F, TextSelection as R, Plugin as O, PluginKey as _, AllSelection as He } from "../../../prosemirror-state/dist/index.js";
|
|
4
|
+
import { Node as zt, DOMParser as tt, DOMSerializer as We, Schema as Ft, Fragment as D, Slice as Ue } from "../../../prosemirror-model/dist/index.js";
|
|
5
5
|
import { liftListItem as qe, sinkListItem as Je, wrapInList as Ke } from "../../../prosemirror-schema-list/dist/index.js";
|
|
6
6
|
import { EditorView as Qe } from "../../../prosemirror-view/dist/index.js";
|
|
7
7
|
import { keymap as Ze } from "../../../prosemirror-keymap/dist/index.js";
|
|
@@ -47,8 +47,8 @@ var at = class {
|
|
|
47
47
|
get commands() {
|
|
48
48
|
const { rawCommands: t, editor: e, state: n } = this, { view: r } = e, { tr: o } = n, s = this.buildProps(o);
|
|
49
49
|
return Object.fromEntries(
|
|
50
|
-
Object.entries(t).map(([i,
|
|
51
|
-
const f =
|
|
50
|
+
Object.entries(t).map(([i, a]) => [i, (...l) => {
|
|
51
|
+
const f = a(...l)(s);
|
|
52
52
|
return !o.getMeta("preventDispatch") && !this.hasCustomState && r.dispatch(o), f;
|
|
53
53
|
}])
|
|
54
54
|
);
|
|
@@ -60,10 +60,10 @@ var at = class {
|
|
|
60
60
|
return () => this.createCan();
|
|
61
61
|
}
|
|
62
62
|
createChain(t, e = !0) {
|
|
63
|
-
const { rawCommands: n, editor: r, state: o } = this, { view: s } = r, i = [],
|
|
63
|
+
const { rawCommands: n, editor: r, state: o } = this, { view: s } = r, i = [], a = !!t, c = t || o.tr, l = () => (!a && e && !c.getMeta("preventDispatch") && !this.hasCustomState && s.dispatch(c), i.every((u) => u === !0)), f = {
|
|
64
64
|
...Object.fromEntries(
|
|
65
65
|
Object.entries(n).map(([u, p]) => [u, (...h) => {
|
|
66
|
-
const m = this.buildProps(
|
|
66
|
+
const m = this.buildProps(c, e), g = p(...h)(m);
|
|
67
67
|
return i.push(g), f;
|
|
68
68
|
}])
|
|
69
69
|
),
|
|
@@ -75,7 +75,7 @@ var at = class {
|
|
|
75
75
|
const { rawCommands: e, state: n } = this, r = !1, o = t || n.tr, s = this.buildProps(o, r);
|
|
76
76
|
return {
|
|
77
77
|
...Object.fromEntries(
|
|
78
|
-
Object.entries(e).map(([
|
|
78
|
+
Object.entries(e).map(([a, c]) => [a, (...l) => c(...l)({ ...s, dispatch: void 0 })])
|
|
79
79
|
),
|
|
80
80
|
chain: () => this.createChain(o, r)
|
|
81
81
|
};
|
|
@@ -95,7 +95,7 @@ var at = class {
|
|
|
95
95
|
can: () => this.createCan(t),
|
|
96
96
|
get commands() {
|
|
97
97
|
return Object.fromEntries(
|
|
98
|
-
Object.entries(n).map(([
|
|
98
|
+
Object.entries(n).map(([a, c]) => [a, (...l) => c(...l)(i)])
|
|
99
99
|
);
|
|
100
100
|
}
|
|
101
101
|
};
|
|
@@ -122,20 +122,20 @@ yt(Vt, {
|
|
|
122
122
|
insertContent: () => bn,
|
|
123
123
|
insertContentAt: () => wn,
|
|
124
124
|
joinBackward: () => Sn,
|
|
125
|
-
joinDown: () =>
|
|
125
|
+
joinDown: () => xn,
|
|
126
126
|
joinForward: () => En,
|
|
127
127
|
joinItemBackward: () => Tn,
|
|
128
128
|
joinItemForward: () => An,
|
|
129
129
|
joinTextblockBackward: () => Cn,
|
|
130
130
|
joinTextblockForward: () => Pn,
|
|
131
|
-
joinUp: () =>
|
|
131
|
+
joinUp: () => Mn,
|
|
132
132
|
keyboardShortcut: () => Nn,
|
|
133
133
|
lift: () => In,
|
|
134
|
-
liftEmptyBlock: () =>
|
|
135
|
-
liftListItem: () =>
|
|
136
|
-
newlineInCode: () =>
|
|
137
|
-
resetAttributes: () =>
|
|
138
|
-
scrollIntoView: () =>
|
|
134
|
+
liftEmptyBlock: () => Rn,
|
|
135
|
+
liftListItem: () => On,
|
|
136
|
+
newlineInCode: () => jn,
|
|
137
|
+
resetAttributes: () => Bn,
|
|
138
|
+
scrollIntoView: () => Dn,
|
|
139
139
|
selectAll: () => _n,
|
|
140
140
|
selectNodeBackward: () => Ln,
|
|
141
141
|
selectNodeForward: () => zn,
|
|
@@ -154,8 +154,8 @@ yt(Vt, {
|
|
|
154
154
|
splitListItem: () => br,
|
|
155
155
|
toggleList: () => kr,
|
|
156
156
|
toggleMark: () => wr,
|
|
157
|
-
toggleNode: () =>
|
|
158
|
-
toggleWrap: () =>
|
|
157
|
+
toggleNode: () => Mr,
|
|
158
|
+
toggleWrap: () => xr,
|
|
159
159
|
undoInputRule: () => Sr,
|
|
160
160
|
unsetAllMarks: () => Er,
|
|
161
161
|
unsetMark: () => Tr,
|
|
@@ -170,14 +170,14 @@ var Ye = () => ({ editor: t, view: e }) => (requestAnimationFrame(() => {
|
|
|
170
170
|
}), !0), Xe = (t = !0) => ({ commands: e }) => e.setContent("", { emitUpdate: t }), tn = () => ({ state: t, tr: e, dispatch: n }) => {
|
|
171
171
|
const { selection: r } = e, { ranges: o } = r;
|
|
172
172
|
return n && o.forEach(({ $from: s, $to: i }) => {
|
|
173
|
-
t.doc.nodesBetween(s.pos, i.pos, (
|
|
174
|
-
if (
|
|
173
|
+
t.doc.nodesBetween(s.pos, i.pos, (a, c) => {
|
|
174
|
+
if (a.type.isText)
|
|
175
175
|
return;
|
|
176
|
-
const { doc: l, mapping: f } = e, u = l.resolve(f.map(
|
|
176
|
+
const { doc: l, mapping: f } = e, u = l.resolve(f.map(c)), p = l.resolve(f.map(c + a.nodeSize)), d = u.blockRange(p);
|
|
177
177
|
if (!d)
|
|
178
178
|
return;
|
|
179
|
-
const h =
|
|
180
|
-
if (
|
|
179
|
+
const h = Me(d);
|
|
180
|
+
if (a.type.isTextblock) {
|
|
181
181
|
const { defaultType: m } = u.parent.contentMatchAt(u.index());
|
|
182
182
|
e.setNodeMarkup(d.start, m);
|
|
183
183
|
}
|
|
@@ -188,7 +188,7 @@ var Ye = () => ({ editor: t, view: e }) => (requestAnimationFrame(() => {
|
|
|
188
188
|
const { state: o } = n, s = o.doc.slice(t.from, t.to);
|
|
189
189
|
r.deleteRange(t.from, t.to);
|
|
190
190
|
const i = r.mapping.map(e);
|
|
191
|
-
return r.insert(i, s.content), r.setSelection(new
|
|
191
|
+
return r.insert(i, s.content), r.setSelection(new R(r.doc.resolve(Math.max(i - 1, 0)))), !0;
|
|
192
192
|
}, on = () => ({ tr: t, dispatch: e }) => {
|
|
193
193
|
const { selection: n } = t, r = n.$anchor.node();
|
|
194
194
|
if (r.content.size > 0)
|
|
@@ -197,8 +197,8 @@ var Ye = () => ({ editor: t, view: e }) => (requestAnimationFrame(() => {
|
|
|
197
197
|
for (let s = o.depth; s > 0; s -= 1)
|
|
198
198
|
if (o.node(s).type === r.type) {
|
|
199
199
|
if (e) {
|
|
200
|
-
const
|
|
201
|
-
t.delete(
|
|
200
|
+
const a = o.before(s), c = o.after(s);
|
|
201
|
+
t.delete(a, c).scrollIntoView();
|
|
202
202
|
}
|
|
203
203
|
return !0;
|
|
204
204
|
}
|
|
@@ -219,8 +219,8 @@ var sn = (t) => ({ tr: e, state: n, dispatch: r }) => {
|
|
|
219
219
|
for (let i = s.depth; i > 0; i -= 1)
|
|
220
220
|
if (s.node(i).type === o) {
|
|
221
221
|
if (r) {
|
|
222
|
-
const
|
|
223
|
-
e.delete(
|
|
222
|
+
const c = s.before(i), l = s.after(i);
|
|
223
|
+
e.delete(c, l).scrollIntoView();
|
|
224
224
|
}
|
|
225
225
|
return !0;
|
|
226
226
|
}
|
|
@@ -272,17 +272,17 @@ function wt(t, e, n) {
|
|
|
272
272
|
}
|
|
273
273
|
if (!Ht([...r.node.marks], e, n))
|
|
274
274
|
return;
|
|
275
|
-
let s = r.index, i = t.start() + r.offset,
|
|
275
|
+
let s = r.index, i = t.start() + r.offset, a = s + 1, c = i + r.node.nodeSize;
|
|
276
276
|
for (; s > 0 && $t([...t.parent.child(s - 1).marks], e, n); )
|
|
277
277
|
s -= 1, i -= t.parent.child(s).nodeSize;
|
|
278
|
-
for (;
|
|
279
|
-
|
|
278
|
+
for (; a < t.parent.childCount && $t([...t.parent.child(a).marks], e, n); )
|
|
279
|
+
c += t.parent.child(a).nodeSize, a += 1;
|
|
280
280
|
return {
|
|
281
281
|
from: i,
|
|
282
|
-
to:
|
|
282
|
+
to: c
|
|
283
283
|
};
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function B(t, e) {
|
|
286
286
|
if (typeof t == "string") {
|
|
287
287
|
if (!e.marks[t])
|
|
288
288
|
throw Error(
|
|
@@ -293,11 +293,11 @@ function D(t, e) {
|
|
|
293
293
|
return t;
|
|
294
294
|
}
|
|
295
295
|
var pn = (t, e) => ({ tr: n, state: r, dispatch: o }) => {
|
|
296
|
-
const s =
|
|
296
|
+
const s = B(t, r.schema), { doc: i, selection: a } = n, { $from: c, from: l, to: f } = a;
|
|
297
297
|
if (o) {
|
|
298
|
-
const u = wt(
|
|
298
|
+
const u = wt(c, s, e);
|
|
299
299
|
if (u && u.from <= l && u.to >= f) {
|
|
300
|
-
const p =
|
|
300
|
+
const p = R.create(i, u.from, u.to);
|
|
301
301
|
n.setSelection(p);
|
|
302
302
|
}
|
|
303
303
|
}
|
|
@@ -310,7 +310,7 @@ var pn = (t, e) => ({ tr: n, state: r, dispatch: o }) => {
|
|
|
310
310
|
return !1;
|
|
311
311
|
};
|
|
312
312
|
function Wt(t) {
|
|
313
|
-
return t instanceof
|
|
313
|
+
return t instanceof R;
|
|
314
314
|
}
|
|
315
315
|
function z(t = 0, e = 0, n = 0) {
|
|
316
316
|
return Math.min(Math.max(t, e), n);
|
|
@@ -324,11 +324,11 @@ function Ut(t, e = null) {
|
|
|
324
324
|
if (e === "end")
|
|
325
325
|
return r;
|
|
326
326
|
const o = n.from, s = r.to;
|
|
327
|
-
return e === "all" ?
|
|
327
|
+
return e === "all" ? R.create(
|
|
328
328
|
t,
|
|
329
329
|
z(0, o, s),
|
|
330
330
|
z(t.content.size, o, s)
|
|
331
|
-
) :
|
|
331
|
+
) : R.create(
|
|
332
332
|
t,
|
|
333
333
|
z(e, o, s),
|
|
334
334
|
z(e, o, s)
|
|
@@ -364,8 +364,8 @@ var gn = (t = null, e = {}) => ({ editor: n, view: r, tr: o, dispatch: s }) => {
|
|
|
364
364
|
}
|
|
365
365
|
if (s && t === null && !Wt(n.state.selection))
|
|
366
366
|
return i(), !0;
|
|
367
|
-
const
|
|
368
|
-
return s && (
|
|
367
|
+
const a = Ut(o.doc, t) || n.state.selection, c = n.state.selection.eq(a);
|
|
368
|
+
return s && (c || o.setSelection(a), c && o.storedMarks && o.setStoredMarks(o.storedMarks), i()), !0;
|
|
369
369
|
}, vn = (t, e) => (n) => t.every((r, o) => e(r, { ...n, index: o })), bn = (t, e) => ({ tr: n, commands: r }) => r.insertContentAt(
|
|
370
370
|
{ from: n.selection.from, to: n.selection.to },
|
|
371
371
|
t,
|
|
@@ -387,7 +387,7 @@ function U(t) {
|
|
|
387
387
|
return qt(n);
|
|
388
388
|
}
|
|
389
389
|
function K(t, e, n) {
|
|
390
|
-
if (t instanceof zt || t instanceof
|
|
390
|
+
if (t instanceof zt || t instanceof D)
|
|
391
391
|
return t;
|
|
392
392
|
n = {
|
|
393
393
|
slice: !0,
|
|
@@ -398,7 +398,7 @@ function K(t, e, n) {
|
|
|
398
398
|
if (r)
|
|
399
399
|
try {
|
|
400
400
|
if (Array.isArray(t) && t.length > 0)
|
|
401
|
-
return
|
|
401
|
+
return D.fromArray(t.map((a) => e.nodeFromJSON(a)));
|
|
402
402
|
const i = e.nodeFromJSON(t);
|
|
403
403
|
return n.errorOnInvalidContent && i.check(), i;
|
|
404
404
|
} catch (s) {
|
|
@@ -408,8 +408,8 @@ function K(t, e, n) {
|
|
|
408
408
|
}
|
|
409
409
|
if (o) {
|
|
410
410
|
if (n.errorOnInvalidContent) {
|
|
411
|
-
let i = !1,
|
|
412
|
-
const
|
|
411
|
+
let i = !1, a = "";
|
|
412
|
+
const c = new Ft({
|
|
413
413
|
topNode: e.spec.topNode,
|
|
414
414
|
marks: e.spec.marks,
|
|
415
415
|
// Prosemirror's schemas are executed such that: the last to execute, matches last
|
|
@@ -421,21 +421,21 @@ function K(t, e, n) {
|
|
|
421
421
|
parseDOM: [
|
|
422
422
|
{
|
|
423
423
|
tag: "*",
|
|
424
|
-
getAttrs: (l) => (i = !0,
|
|
424
|
+
getAttrs: (l) => (i = !0, a = typeof l == "string" ? l : l.outerHTML, null)
|
|
425
425
|
}
|
|
426
426
|
]
|
|
427
427
|
}
|
|
428
428
|
})
|
|
429
429
|
});
|
|
430
|
-
if (n.slice ? tt.fromSchema(
|
|
430
|
+
if (n.slice ? tt.fromSchema(c).parseSlice(
|
|
431
431
|
U(t),
|
|
432
432
|
n.parseOptions
|
|
433
|
-
) : tt.fromSchema(
|
|
433
|
+
) : tt.fromSchema(c).parse(
|
|
434
434
|
U(t),
|
|
435
435
|
n.parseOptions
|
|
436
436
|
), n.errorOnInvalidContent && i)
|
|
437
437
|
throw new Error("[tiptap error]: Invalid HTML content", {
|
|
438
|
-
cause: new Error(`Invalid element found: ${
|
|
438
|
+
cause: new Error(`Invalid element found: ${a}`)
|
|
439
439
|
});
|
|
440
440
|
}
|
|
441
441
|
const s = tt.fromSchema(e);
|
|
@@ -448,11 +448,11 @@ function yn(t, e, n) {
|
|
|
448
448
|
if (r < e)
|
|
449
449
|
return;
|
|
450
450
|
const o = t.steps[r];
|
|
451
|
-
if (!(o instanceof
|
|
451
|
+
if (!(o instanceof xe || o instanceof Se))
|
|
452
452
|
return;
|
|
453
453
|
const s = t.mapping.maps[r];
|
|
454
454
|
let i = 0;
|
|
455
|
-
s.forEach((
|
|
455
|
+
s.forEach((a, c, l, f) => {
|
|
456
456
|
i === 0 && (i = f);
|
|
457
457
|
}), t.setSelection(F.near(t.doc.resolve(i), n));
|
|
458
458
|
}
|
|
@@ -466,8 +466,8 @@ var kn = (t) => !("type" in t), wn = (t, e, n) => ({ tr: r, dispatch: o, editor:
|
|
|
466
466
|
applyPasteRules: !1,
|
|
467
467
|
...n
|
|
468
468
|
};
|
|
469
|
-
let
|
|
470
|
-
const
|
|
469
|
+
let a;
|
|
470
|
+
const c = (g) => {
|
|
471
471
|
s.emit("contentError", {
|
|
472
472
|
editor: s,
|
|
473
473
|
error: g,
|
|
@@ -486,18 +486,18 @@ var kn = (t) => !("type" in t), wn = (t, e, n) => ({ tr: r, dispatch: o, editor:
|
|
|
486
486
|
errorOnInvalidContent: !0
|
|
487
487
|
});
|
|
488
488
|
} catch (g) {
|
|
489
|
-
|
|
489
|
+
c(g);
|
|
490
490
|
}
|
|
491
491
|
try {
|
|
492
|
-
|
|
492
|
+
a = K(e, s.schema, {
|
|
493
493
|
parseOptions: l,
|
|
494
494
|
errorOnInvalidContent: (i = n.errorOnInvalidContent) != null ? i : s.options.enableContentCheck
|
|
495
495
|
});
|
|
496
496
|
} catch (g) {
|
|
497
|
-
return
|
|
497
|
+
return c(g), !1;
|
|
498
498
|
}
|
|
499
499
|
let { from: f, to: u } = typeof t == "number" ? { from: t, to: t } : { from: t.from, to: t.to }, p = !0, d = !0;
|
|
500
|
-
if ((kn(
|
|
500
|
+
if ((kn(a) ? a : [a]).forEach((g) => {
|
|
501
501
|
g.check(), p = p ? g.isText && g.marks.length === 0 : !1, d = d ? g.isBlock : !1;
|
|
502
502
|
}), f === u && d) {
|
|
503
503
|
const { parent: g } = r.doc.resolve(f);
|
|
@@ -507,7 +507,7 @@ var kn = (t) => !("type" in t), wn = (t, e, n) => ({ tr: r, dispatch: o, editor:
|
|
|
507
507
|
if (p) {
|
|
508
508
|
if (Array.isArray(e))
|
|
509
509
|
m = e.map((g) => g.text || "").join("");
|
|
510
|
-
else if (e instanceof
|
|
510
|
+
else if (e instanceof D) {
|
|
511
511
|
let g = "";
|
|
512
512
|
e.forEach((v) => {
|
|
513
513
|
v.text && (g += v.text);
|
|
@@ -515,14 +515,14 @@ var kn = (t) => !("type" in t), wn = (t, e, n) => ({ tr: r, dispatch: o, editor:
|
|
|
515
515
|
} else typeof e == "object" && e && e.text ? m = e.text : m = e;
|
|
516
516
|
r.insertText(m, f, u);
|
|
517
517
|
} else {
|
|
518
|
-
m =
|
|
519
|
-
const g = r.doc.resolve(f), v = g.node(), y = g.parentOffset === 0, w = v.isText || v.isTextblock,
|
|
520
|
-
y && w &&
|
|
518
|
+
m = a;
|
|
519
|
+
const g = r.doc.resolve(f), v = g.node(), y = g.parentOffset === 0, w = v.isText || v.isTextblock, M = v.content.size > 0;
|
|
520
|
+
y && w && M && d && (f = Math.max(0, f - 1)), r.replaceWith(f, u, m);
|
|
521
521
|
}
|
|
522
522
|
n.updateSelection && yn(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: f, text: m }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: f, text: m });
|
|
523
523
|
}
|
|
524
524
|
return !0;
|
|
525
|
-
},
|
|
525
|
+
}, Mn = () => ({ state: t, dispatch: e }) => Ae(t, e), xn = () => ({ state: t, dispatch: e }) => Ce(t, e), Sn = () => ({ state: t, dispatch: e }) => Pe(t, e), En = () => ({ state: t, dispatch: e }) => $e(t, e), Tn = () => ({ state: t, dispatch: e, tr: n }) => {
|
|
526
526
|
try {
|
|
527
527
|
const r = Lt(t.doc, t.selection.$from.pos, -1);
|
|
528
528
|
return r == null ? !1 : (n.join(r, 2), e && e(n), !0);
|
|
@@ -545,25 +545,25 @@ function $n(t) {
|
|
|
545
545
|
let n = e[e.length - 1];
|
|
546
546
|
n === "Space" && (n = " ");
|
|
547
547
|
let r, o, s, i;
|
|
548
|
-
for (let
|
|
549
|
-
const
|
|
550
|
-
if (/^(cmd|meta|m)$/i.test(
|
|
548
|
+
for (let a = 0; a < e.length - 1; a += 1) {
|
|
549
|
+
const c = e[a];
|
|
550
|
+
if (/^(cmd|meta|m)$/i.test(c))
|
|
551
551
|
i = !0;
|
|
552
|
-
else if (/^a(lt)?$/i.test(
|
|
552
|
+
else if (/^a(lt)?$/i.test(c))
|
|
553
553
|
r = !0;
|
|
554
|
-
else if (/^(c|ctrl|control)$/i.test(
|
|
554
|
+
else if (/^(c|ctrl|control)$/i.test(c))
|
|
555
555
|
o = !0;
|
|
556
|
-
else if (/^s(hift)?$/i.test(
|
|
556
|
+
else if (/^s(hift)?$/i.test(c))
|
|
557
557
|
s = !0;
|
|
558
|
-
else if (/^mod$/i.test(
|
|
558
|
+
else if (/^mod$/i.test(c))
|
|
559
559
|
rt() || Jt() ? i = !0 : o = !0;
|
|
560
560
|
else
|
|
561
|
-
throw new Error(`Unrecognized modifier name: ${
|
|
561
|
+
throw new Error(`Unrecognized modifier name: ${c}`);
|
|
562
562
|
}
|
|
563
563
|
return r && (n = `Alt-${n}`), o && (n = `Ctrl-${n}`), i && (n = `Meta-${n}`), s && (n = `Shift-${n}`), n;
|
|
564
564
|
}
|
|
565
565
|
var Nn = (t) => ({ editor: e, view: n, tr: r, dispatch: o }) => {
|
|
566
|
-
const s = $n(t).split(/-(?!$)/), i = s.find((l) => !["Alt", "Ctrl", "Meta", "Shift"].includes(l)),
|
|
566
|
+
const s = $n(t).split(/-(?!$)/), i = s.find((l) => !["Alt", "Ctrl", "Meta", "Shift"].includes(l)), a = new KeyboardEvent("keydown", {
|
|
567
567
|
key: i === "Space" ? " " : i,
|
|
568
568
|
altKey: s.includes("Alt"),
|
|
569
569
|
ctrlKey: s.includes("Ctrl"),
|
|
@@ -571,36 +571,36 @@ var Nn = (t) => ({ editor: e, view: n, tr: r, dispatch: o }) => {
|
|
|
571
571
|
shiftKey: s.includes("Shift"),
|
|
572
572
|
bubbles: !0,
|
|
573
573
|
cancelable: !0
|
|
574
|
-
}),
|
|
575
|
-
n.someProp("handleKeyDown", (l) => l(n,
|
|
574
|
+
}), c = e.captureTransaction(() => {
|
|
575
|
+
n.someProp("handleKeyDown", (l) => l(n, a));
|
|
576
576
|
});
|
|
577
|
-
return
|
|
577
|
+
return c?.steps.forEach((l) => {
|
|
578
578
|
const f = l.map(r.mapping);
|
|
579
579
|
f && o && r.maybeStep(f);
|
|
580
580
|
}), !0;
|
|
581
581
|
};
|
|
582
582
|
function Q(t, e, n = {}) {
|
|
583
|
-
const { from: r, to: o, empty: s } = t.selection, i = e ? T(e, t.schema) : null,
|
|
583
|
+
const { from: r, to: o, empty: s } = t.selection, i = e ? T(e, t.schema) : null, a = [];
|
|
584
584
|
t.doc.nodesBetween(r, o, (u, p) => {
|
|
585
585
|
if (u.isText)
|
|
586
586
|
return;
|
|
587
587
|
const d = Math.max(r, p), h = Math.min(o, p + u.nodeSize);
|
|
588
|
-
|
|
588
|
+
a.push({
|
|
589
589
|
node: u,
|
|
590
590
|
from: d,
|
|
591
591
|
to: h
|
|
592
592
|
});
|
|
593
593
|
});
|
|
594
|
-
const
|
|
595
|
-
return s ? !!l.length : l.reduce((u, p) => u + p.to - p.from, 0) >=
|
|
594
|
+
const c = o - r, l = a.filter((u) => i ? i.name === u.node.type.name : !0).filter((u) => nt(u.node.attrs, n, { strict: !1 }));
|
|
595
|
+
return s ? !!l.length : l.reduce((u, p) => u + p.to - p.from, 0) >= c;
|
|
596
596
|
}
|
|
597
597
|
var In = (t, e = {}) => ({ state: n, dispatch: r }) => {
|
|
598
598
|
const o = T(t, n.schema);
|
|
599
|
-
return Q(n, o, e) ?
|
|
600
|
-
},
|
|
599
|
+
return Q(n, o, e) ? Re(n, r) : !1;
|
|
600
|
+
}, Rn = () => ({ state: t, dispatch: e }) => Oe(t, e), On = (t) => ({ state: e, dispatch: n }) => {
|
|
601
601
|
const r = T(t, e.schema);
|
|
602
602
|
return qe(r)(e, n);
|
|
603
|
-
},
|
|
603
|
+
}, jn = () => ({ state: t, dispatch: e }) => je(t, e);
|
|
604
604
|
function ct(t, e) {
|
|
605
605
|
return e.nodes[t] ? "node" : e.marks[t] ? "mark" : null;
|
|
606
606
|
}
|
|
@@ -608,34 +608,34 @@ function It(t, e) {
|
|
|
608
608
|
const n = typeof e == "string" ? [e] : e;
|
|
609
609
|
return Object.keys(t).reduce((r, o) => (n.includes(o) || (r[o] = t[o]), r), {});
|
|
610
610
|
}
|
|
611
|
-
var
|
|
611
|
+
var Bn = (t, e) => ({ tr: n, state: r, dispatch: o }) => {
|
|
612
612
|
let s = null, i = null;
|
|
613
|
-
const
|
|
613
|
+
const a = ct(
|
|
614
614
|
typeof t == "string" ? t : t.name,
|
|
615
615
|
r.schema
|
|
616
616
|
);
|
|
617
|
-
if (!
|
|
617
|
+
if (!a)
|
|
618
618
|
return !1;
|
|
619
|
-
|
|
620
|
-
let
|
|
619
|
+
a === "node" && (s = T(t, r.schema)), a === "mark" && (i = B(t, r.schema));
|
|
620
|
+
let c = !1;
|
|
621
621
|
return n.selection.ranges.forEach((l) => {
|
|
622
622
|
r.doc.nodesBetween(l.$from.pos, l.$to.pos, (f, u) => {
|
|
623
|
-
s && s === f.type && (
|
|
624
|
-
i === p.type && (
|
|
623
|
+
s && s === f.type && (c = !0, o && n.setNodeMarkup(u, void 0, It(f.attrs, e))), i && f.marks.length && f.marks.forEach((p) => {
|
|
624
|
+
i === p.type && (c = !0, o && n.addMark(
|
|
625
625
|
u,
|
|
626
626
|
u + f.nodeSize,
|
|
627
627
|
i.create(It(p.attrs, e))
|
|
628
628
|
));
|
|
629
629
|
});
|
|
630
630
|
});
|
|
631
|
-
}),
|
|
632
|
-
},
|
|
631
|
+
}), c;
|
|
632
|
+
}, Dn = () => ({ tr: t, dispatch: e }) => (e && t.scrollIntoView(), !0), _n = () => ({ tr: t, dispatch: e }) => {
|
|
633
633
|
if (e) {
|
|
634
634
|
const n = new He(t.doc);
|
|
635
635
|
t.setSelection(n);
|
|
636
636
|
}
|
|
637
637
|
return !0;
|
|
638
|
-
}, Ln = () => ({ state: t, dispatch: e }) =>
|
|
638
|
+
}, Ln = () => ({ state: t, dispatch: e }) => Be(t, e), zn = () => ({ state: t, dispatch: e }) => De(t, e), Fn = () => ({ state: t, dispatch: e }) => _e(t, e), Vn = () => ({ state: t, dispatch: e }) => Le(t, e), Hn = () => ({ state: t, dispatch: e }) => ze(t, e);
|
|
639
639
|
function gt(t, e, n = {}, r = {}) {
|
|
640
640
|
return K(t, e, {
|
|
641
641
|
slice: !1,
|
|
@@ -643,26 +643,26 @@ function gt(t, e, n = {}, r = {}) {
|
|
|
643
643
|
errorOnInvalidContent: r.errorOnInvalidContent
|
|
644
644
|
});
|
|
645
645
|
}
|
|
646
|
-
var Wn = (t, { errorOnInvalidContent: e, emitUpdate: n = !0, parseOptions: r = {} } = {}) => ({ editor: o, tr: s, dispatch: i, commands:
|
|
647
|
-
const { doc:
|
|
646
|
+
var Wn = (t, { errorOnInvalidContent: e, emitUpdate: n = !0, parseOptions: r = {} } = {}) => ({ editor: o, tr: s, dispatch: i, commands: a }) => {
|
|
647
|
+
const { doc: c } = s;
|
|
648
648
|
if (r.preserveWhitespace !== "full") {
|
|
649
649
|
const l = gt(t, o.schema, r, {
|
|
650
650
|
errorOnInvalidContent: e ?? o.options.enableContentCheck
|
|
651
651
|
});
|
|
652
|
-
return i && s.replaceWith(0,
|
|
652
|
+
return i && s.replaceWith(0, c.content.size, l).setMeta("preventUpdate", !n), !0;
|
|
653
653
|
}
|
|
654
|
-
return i && s.setMeta("preventUpdate", !n),
|
|
654
|
+
return i && s.setMeta("preventUpdate", !n), a.insertContentAt({ from: 0, to: c.content.size }, t, {
|
|
655
655
|
parseOptions: r,
|
|
656
656
|
errorOnInvalidContent: e ?? o.options.enableContentCheck
|
|
657
657
|
});
|
|
658
658
|
};
|
|
659
659
|
function Kt(t, e) {
|
|
660
|
-
const n =
|
|
661
|
-
s ? (t.storedMarks && i.push(...t.storedMarks), i.push(...t.selection.$head.marks())) : t.doc.nodesBetween(r, o, (
|
|
662
|
-
i.push(...
|
|
660
|
+
const n = B(e, t.schema), { from: r, to: o, empty: s } = t.selection, i = [];
|
|
661
|
+
s ? (t.storedMarks && i.push(...t.storedMarks), i.push(...t.selection.$head.marks())) : t.doc.nodesBetween(r, o, (c) => {
|
|
662
|
+
i.push(...c.marks);
|
|
663
663
|
});
|
|
664
|
-
const
|
|
665
|
-
return
|
|
664
|
+
const a = i.find((c) => c.type.name === n.name);
|
|
665
|
+
return a ? { ...a.attrs } : {};
|
|
666
666
|
}
|
|
667
667
|
function Un(t, e) {
|
|
668
668
|
const n = new ke(t);
|
|
@@ -710,7 +710,7 @@ function b(t, e, n) {
|
|
|
710
710
|
parent: t.parent ? b(t.parent, e, n) : null
|
|
711
711
|
}) : t.config[e];
|
|
712
712
|
}
|
|
713
|
-
function
|
|
713
|
+
function Mt(t) {
|
|
714
714
|
return t.map((e) => {
|
|
715
715
|
const n = {
|
|
716
716
|
name: e.name,
|
|
@@ -721,7 +721,7 @@ function xt(t) {
|
|
|
721
721
|
"addExtensions",
|
|
722
722
|
n
|
|
723
723
|
);
|
|
724
|
-
return r ? [e, ...
|
|
724
|
+
return r ? [e, ...Mt(r())] : e;
|
|
725
725
|
}).flat(10);
|
|
726
726
|
}
|
|
727
727
|
function ut(t, e) {
|
|
@@ -731,7 +731,7 @@ function ut(t, e) {
|
|
|
731
731
|
function Qt(t) {
|
|
732
732
|
return typeof t == "function";
|
|
733
733
|
}
|
|
734
|
-
function
|
|
734
|
+
function x(t, e = void 0, ...n) {
|
|
735
735
|
return Qt(t) ? e ? t.bind(e)(...n) : t(...n) : t;
|
|
736
736
|
}
|
|
737
737
|
function Kn(t = {}) {
|
|
@@ -756,7 +756,7 @@ function Zt(t) {
|
|
|
756
756
|
parseHTML: null,
|
|
757
757
|
keepOnSplit: !0,
|
|
758
758
|
isRequired: !1
|
|
759
|
-
}, i = n.filter((l) => l.name !== "text").map((l) => l.name),
|
|
759
|
+
}, i = n.filter((l) => l.name !== "text").map((l) => l.name), a = r.map((l) => l.name), c = [...i, ...a];
|
|
760
760
|
return t.forEach((l) => {
|
|
761
761
|
const f = {
|
|
762
762
|
name: l.name,
|
|
@@ -772,7 +772,7 @@ function Zt(t) {
|
|
|
772
772
|
return;
|
|
773
773
|
u().forEach((d) => {
|
|
774
774
|
let h;
|
|
775
|
-
Array.isArray(d.types) ? h = d.types : d.types === "*" ? h =
|
|
775
|
+
Array.isArray(d.types) ? h = d.types : d.types === "*" ? h = c : d.types === "nodes" ? h = i : d.types === "marks" ? h = a : h = [], h.forEach((m) => {
|
|
776
776
|
Object.entries(d.attributes).forEach(([g, v]) => {
|
|
777
777
|
e.push({
|
|
778
778
|
type: m,
|
|
@@ -811,42 +811,42 @@ function Qn(t) {
|
|
|
811
811
|
const e = [];
|
|
812
812
|
let n = "", r = !1, o = !1, s = 0;
|
|
813
813
|
const i = t.length;
|
|
814
|
-
for (let
|
|
815
|
-
const
|
|
816
|
-
if (
|
|
817
|
-
r = !r, n +=
|
|
814
|
+
for (let a = 0; a < i; a += 1) {
|
|
815
|
+
const c = t[a];
|
|
816
|
+
if (c === "'" && !o) {
|
|
817
|
+
r = !r, n += c;
|
|
818
818
|
continue;
|
|
819
819
|
}
|
|
820
|
-
if (
|
|
821
|
-
o = !o, n +=
|
|
820
|
+
if (c === '"' && !r) {
|
|
821
|
+
o = !o, n += c;
|
|
822
822
|
continue;
|
|
823
823
|
}
|
|
824
824
|
if (!r && !o) {
|
|
825
|
-
if (
|
|
826
|
-
s += 1, n +=
|
|
825
|
+
if (c === "(") {
|
|
826
|
+
s += 1, n += c;
|
|
827
827
|
continue;
|
|
828
828
|
}
|
|
829
|
-
if (
|
|
830
|
-
s -= 1, n +=
|
|
829
|
+
if (c === ")" && s > 0) {
|
|
830
|
+
s -= 1, n += c;
|
|
831
831
|
continue;
|
|
832
832
|
}
|
|
833
|
-
if (
|
|
833
|
+
if (c === ";" && s === 0) {
|
|
834
834
|
e.push(n), n = "";
|
|
835
835
|
continue;
|
|
836
836
|
}
|
|
837
837
|
}
|
|
838
|
-
n +=
|
|
838
|
+
n += c;
|
|
839
839
|
}
|
|
840
840
|
return n && e.push(n), e;
|
|
841
841
|
}
|
|
842
|
-
function
|
|
842
|
+
function Rt(t) {
|
|
843
843
|
const e = [], n = Qn(t || ""), r = n.length;
|
|
844
844
|
for (let o = 0; o < r; o += 1) {
|
|
845
845
|
const s = n[o], i = s.indexOf(":");
|
|
846
846
|
if (i === -1)
|
|
847
847
|
continue;
|
|
848
|
-
const
|
|
849
|
-
|
|
848
|
+
const a = s.slice(0, i).trim(), c = s.slice(i + 1).trim();
|
|
849
|
+
a && c && e.push([a, c]);
|
|
850
850
|
}
|
|
851
851
|
return e;
|
|
852
852
|
}
|
|
@@ -859,16 +859,16 @@ function Zn(...t) {
|
|
|
859
859
|
return;
|
|
860
860
|
}
|
|
861
861
|
if (o === "class") {
|
|
862
|
-
const
|
|
863
|
-
(f) => !
|
|
862
|
+
const a = s ? String(s).split(" ") : [], c = r[o] ? r[o].split(" ") : [], l = a.filter(
|
|
863
|
+
(f) => !c.includes(f)
|
|
864
864
|
);
|
|
865
|
-
r[o] = [...
|
|
865
|
+
r[o] = [...c, ...l].join(" ");
|
|
866
866
|
} else if (o === "style") {
|
|
867
|
-
const
|
|
868
|
-
...
|
|
869
|
-
...
|
|
867
|
+
const a = new Map([
|
|
868
|
+
...Rt(r[o]),
|
|
869
|
+
...Rt(s)
|
|
870
870
|
]);
|
|
871
|
-
r[o] = Array.from(
|
|
871
|
+
r[o] = Array.from(a.entries()).map(([c, l]) => `${c}: ${l}`).join("; ");
|
|
872
872
|
} else
|
|
873
873
|
r[o] = s;
|
|
874
874
|
}), r;
|
|
@@ -882,7 +882,7 @@ function ot(t, e) {
|
|
|
882
882
|
function Gn(t) {
|
|
883
883
|
return typeof t != "string" ? t : t.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(t) : t === "true" ? !0 : t === "false" ? !1 : t;
|
|
884
884
|
}
|
|
885
|
-
function
|
|
885
|
+
function Ot(t, e) {
|
|
886
886
|
return "style" in t ? t : {
|
|
887
887
|
...t,
|
|
888
888
|
getAttrs: (n) => {
|
|
@@ -890,30 +890,30 @@ function Rt(t, e) {
|
|
|
890
890
|
if (r === !1)
|
|
891
891
|
return !1;
|
|
892
892
|
const o = e.reduce((s, i) => {
|
|
893
|
-
const
|
|
894
|
-
return
|
|
893
|
+
const a = i.attribute.parseHTML ? i.attribute.parseHTML(n) : Gn(n.getAttribute(i.name));
|
|
894
|
+
return a == null ? s : {
|
|
895
895
|
...s,
|
|
896
|
-
[i.name]:
|
|
896
|
+
[i.name]: a
|
|
897
897
|
};
|
|
898
898
|
}, {});
|
|
899
899
|
return { ...r, ...o };
|
|
900
900
|
}
|
|
901
901
|
};
|
|
902
902
|
}
|
|
903
|
-
function
|
|
903
|
+
function jt(t) {
|
|
904
904
|
return Object.fromEntries(
|
|
905
905
|
// @ts-ignore
|
|
906
906
|
Object.entries(t).filter(([e, n]) => e === "attrs" && Kn(n) ? !1 : n != null)
|
|
907
907
|
);
|
|
908
908
|
}
|
|
909
|
-
function
|
|
909
|
+
function Bt(t) {
|
|
910
910
|
var e, n;
|
|
911
911
|
const r = {};
|
|
912
912
|
return !((e = t?.attribute) != null && e.isRequired) && "default" in (t?.attribute || {}) && (r.default = t.attribute.default), ((n = t?.attribute) == null ? void 0 : n.validate) !== void 0 && (r.validate = t.attribute.validate), [t.name, r];
|
|
913
913
|
}
|
|
914
914
|
function Gt(t, e) {
|
|
915
915
|
var n;
|
|
916
|
-
const r = Zt(t), { nodeExtensions: o, markExtensions: s } = V(t), i = (n = o.find((l) => b(l, "topNode"))) == null ? void 0 : n.name,
|
|
916
|
+
const r = Zt(t), { nodeExtensions: o, markExtensions: s } = V(t), i = (n = o.find((l) => b(l, "topNode"))) == null ? void 0 : n.name, a = Object.fromEntries(
|
|
917
917
|
o.map((l) => {
|
|
918
918
|
const f = r.filter(
|
|
919
919
|
(v) => v.type === l.name
|
|
@@ -932,44 +932,44 @@ function Gt(t, e) {
|
|
|
932
932
|
...v,
|
|
933
933
|
...w ? w(l) : {}
|
|
934
934
|
};
|
|
935
|
-
}, {}), d =
|
|
935
|
+
}, {}), d = jt({
|
|
936
936
|
...p,
|
|
937
|
-
content:
|
|
937
|
+
content: x(
|
|
938
938
|
b(l, "content", u)
|
|
939
939
|
),
|
|
940
|
-
marks:
|
|
941
|
-
group:
|
|
942
|
-
inline:
|
|
943
|
-
atom:
|
|
944
|
-
selectable:
|
|
940
|
+
marks: x(b(l, "marks", u)),
|
|
941
|
+
group: x(b(l, "group", u)),
|
|
942
|
+
inline: x(b(l, "inline", u)),
|
|
943
|
+
atom: x(b(l, "atom", u)),
|
|
944
|
+
selectable: x(
|
|
945
945
|
b(l, "selectable", u)
|
|
946
946
|
),
|
|
947
|
-
draggable:
|
|
947
|
+
draggable: x(
|
|
948
948
|
b(l, "draggable", u)
|
|
949
949
|
),
|
|
950
|
-
code:
|
|
951
|
-
whitespace:
|
|
950
|
+
code: x(b(l, "code", u)),
|
|
951
|
+
whitespace: x(
|
|
952
952
|
b(l, "whitespace", u)
|
|
953
953
|
),
|
|
954
|
-
linebreakReplacement:
|
|
954
|
+
linebreakReplacement: x(
|
|
955
955
|
b(
|
|
956
956
|
l,
|
|
957
957
|
"linebreakReplacement",
|
|
958
958
|
u
|
|
959
959
|
)
|
|
960
960
|
),
|
|
961
|
-
defining:
|
|
961
|
+
defining: x(
|
|
962
962
|
b(l, "defining", u)
|
|
963
963
|
),
|
|
964
|
-
isolating:
|
|
964
|
+
isolating: x(
|
|
965
965
|
b(l, "isolating", u)
|
|
966
966
|
),
|
|
967
|
-
attrs: Object.fromEntries(f.map(
|
|
968
|
-
}), h =
|
|
967
|
+
attrs: Object.fromEntries(f.map(Bt))
|
|
968
|
+
}), h = x(
|
|
969
969
|
b(l, "parseHTML", u)
|
|
970
970
|
);
|
|
971
971
|
h && (d.parseDOM = h.map(
|
|
972
|
-
(v) =>
|
|
972
|
+
(v) => Ot(v, f)
|
|
973
973
|
));
|
|
974
974
|
const m = b(
|
|
975
975
|
l,
|
|
@@ -987,7 +987,7 @@ function Gt(t, e) {
|
|
|
987
987
|
);
|
|
988
988
|
return g && (d.toText = g), [l.name, d];
|
|
989
989
|
})
|
|
990
|
-
),
|
|
990
|
+
), c = Object.fromEntries(
|
|
991
991
|
s.map((l) => {
|
|
992
992
|
const f = r.filter(
|
|
993
993
|
(g) => g.type === l.name
|
|
@@ -1006,25 +1006,25 @@ function Gt(t, e) {
|
|
|
1006
1006
|
...g,
|
|
1007
1007
|
...y ? y(l) : {}
|
|
1008
1008
|
};
|
|
1009
|
-
}, {}), d =
|
|
1009
|
+
}, {}), d = jt({
|
|
1010
1010
|
...p,
|
|
1011
|
-
inclusive:
|
|
1011
|
+
inclusive: x(
|
|
1012
1012
|
b(l, "inclusive", u)
|
|
1013
1013
|
),
|
|
1014
|
-
excludes:
|
|
1014
|
+
excludes: x(
|
|
1015
1015
|
b(l, "excludes", u)
|
|
1016
1016
|
),
|
|
1017
|
-
group:
|
|
1018
|
-
spanning:
|
|
1017
|
+
group: x(b(l, "group", u)),
|
|
1018
|
+
spanning: x(
|
|
1019
1019
|
b(l, "spanning", u)
|
|
1020
1020
|
),
|
|
1021
|
-
code:
|
|
1022
|
-
attrs: Object.fromEntries(f.map(
|
|
1023
|
-
}), h =
|
|
1021
|
+
code: x(b(l, "code", u)),
|
|
1022
|
+
attrs: Object.fromEntries(f.map(Bt))
|
|
1023
|
+
}), h = x(
|
|
1024
1024
|
b(l, "parseHTML", u)
|
|
1025
1025
|
);
|
|
1026
1026
|
h && (d.parseDOM = h.map(
|
|
1027
|
-
(g) =>
|
|
1027
|
+
(g) => Ot(g, f)
|
|
1028
1028
|
));
|
|
1029
1029
|
const m = b(
|
|
1030
1030
|
l,
|
|
@@ -1039,8 +1039,8 @@ function Gt(t, e) {
|
|
|
1039
1039
|
);
|
|
1040
1040
|
return new Ft({
|
|
1041
1041
|
topNode: i,
|
|
1042
|
-
nodes:
|
|
1043
|
-
marks:
|
|
1042
|
+
nodes: a,
|
|
1043
|
+
marks: c
|
|
1044
1044
|
});
|
|
1045
1045
|
}
|
|
1046
1046
|
function Yn(t) {
|
|
@@ -1053,14 +1053,14 @@ function J(t) {
|
|
|
1053
1053
|
return o > s ? -1 : o < s ? 1 : 0;
|
|
1054
1054
|
});
|
|
1055
1055
|
}
|
|
1056
|
-
function
|
|
1057
|
-
const e = J(
|
|
1056
|
+
function xt(t) {
|
|
1057
|
+
const e = J(Mt(t)), n = Yn(e.map((r) => r.name));
|
|
1058
1058
|
return n.length && console.warn(
|
|
1059
1059
|
`[tiptap warn]: Duplicate extension names found: [${n.map((r) => `'${r}'`).join(", ")}]. This can lead to issues.`
|
|
1060
1060
|
), e;
|
|
1061
1061
|
}
|
|
1062
1062
|
function Yt(t, e) {
|
|
1063
|
-
const n =
|
|
1063
|
+
const n = xt(t);
|
|
1064
1064
|
return Gt(n, e);
|
|
1065
1065
|
}
|
|
1066
1066
|
function lo(t, e) {
|
|
@@ -1075,21 +1075,21 @@ function Xt(t, e, n) {
|
|
|
1075
1075
|
const { from: r, to: o } = e, { blockSeparator: s = `
|
|
1076
1076
|
|
|
1077
1077
|
`, textSerializers: i = {} } = n || {};
|
|
1078
|
-
let
|
|
1079
|
-
return t.nodesBetween(r, o, (
|
|
1078
|
+
let a = "";
|
|
1079
|
+
return t.nodesBetween(r, o, (c, l, f, u) => {
|
|
1080
1080
|
var p;
|
|
1081
|
-
|
|
1082
|
-
const d = i?.[
|
|
1081
|
+
c.isBlock && l > r && (a += s);
|
|
1082
|
+
const d = i?.[c.type.name];
|
|
1083
1083
|
if (d)
|
|
1084
|
-
return f && (
|
|
1085
|
-
node:
|
|
1084
|
+
return f && (a += d({
|
|
1085
|
+
node: c,
|
|
1086
1086
|
pos: l,
|
|
1087
1087
|
parent: f,
|
|
1088
1088
|
index: u,
|
|
1089
1089
|
range: e
|
|
1090
1090
|
})), !1;
|
|
1091
|
-
|
|
1092
|
-
}),
|
|
1091
|
+
c.isText && (a += (p = c?.text) == null ? void 0 : p.slice(Math.max(r, l) - l, o - l));
|
|
1092
|
+
}), a;
|
|
1093
1093
|
}
|
|
1094
1094
|
function Xn(t, e) {
|
|
1095
1095
|
const n = {
|
|
@@ -1105,10 +1105,10 @@ function te(t) {
|
|
|
1105
1105
|
}
|
|
1106
1106
|
function tr(t, e) {
|
|
1107
1107
|
const n = T(e, t.schema), { from: r, to: o } = t.selection, s = [];
|
|
1108
|
-
t.doc.nodesBetween(r, o, (
|
|
1109
|
-
s.push(
|
|
1108
|
+
t.doc.nodesBetween(r, o, (a) => {
|
|
1109
|
+
s.push(a);
|
|
1110
1110
|
});
|
|
1111
|
-
const i = s.reverse().find((
|
|
1111
|
+
const i = s.reverse().find((a) => a.type.name === n.name);
|
|
1112
1112
|
return i ? { ...i.attrs } : {};
|
|
1113
1113
|
}
|
|
1114
1114
|
function er(t, e) {
|
|
@@ -1134,17 +1134,17 @@ function or(t) {
|
|
|
1134
1134
|
return e.maps.forEach((o, s) => {
|
|
1135
1135
|
const i = [];
|
|
1136
1136
|
if (o.ranges.length)
|
|
1137
|
-
o.forEach((
|
|
1138
|
-
i.push({ from:
|
|
1137
|
+
o.forEach((a, c) => {
|
|
1138
|
+
i.push({ from: a, to: c });
|
|
1139
1139
|
});
|
|
1140
1140
|
else {
|
|
1141
|
-
const { from:
|
|
1142
|
-
if (
|
|
1141
|
+
const { from: a, to: c } = n[s];
|
|
1142
|
+
if (a === void 0 || c === void 0)
|
|
1143
1143
|
return;
|
|
1144
|
-
i.push({ from:
|
|
1144
|
+
i.push({ from: a, to: c });
|
|
1145
1145
|
}
|
|
1146
|
-
i.forEach(({ from:
|
|
1147
|
-
const l = e.slice(s).map(
|
|
1146
|
+
i.forEach(({ from: a, to: c }) => {
|
|
1147
|
+
const l = e.slice(s).map(a, -1), f = e.slice(s).map(c), u = e.invert().map(l, -1), p = e.invert().map(f);
|
|
1148
1148
|
r.push({
|
|
1149
1149
|
oldRange: {
|
|
1150
1150
|
from: u,
|
|
@@ -1180,8 +1180,8 @@ var fo = (t, e, n, r = 20) => {
|
|
|
1180
1180
|
const o = t.doc.resolve(n);
|
|
1181
1181
|
let s = r, i = null;
|
|
1182
1182
|
for (; s > 0 && i === null; ) {
|
|
1183
|
-
const
|
|
1184
|
-
|
|
1183
|
+
const a = o.node(s);
|
|
1184
|
+
a?.type.name === e ? i = a : s -= 1;
|
|
1185
1185
|
}
|
|
1186
1186
|
return [i, s];
|
|
1187
1187
|
};
|
|
@@ -1202,24 +1202,24 @@ var sr = (t, e = 500) => {
|
|
|
1202
1202
|
return t.parent.nodesBetween(
|
|
1203
1203
|
Math.max(0, r - e),
|
|
1204
1204
|
r,
|
|
1205
|
-
(o, s, i,
|
|
1206
|
-
var
|
|
1207
|
-
const f = ((l = (
|
|
1205
|
+
(o, s, i, a) => {
|
|
1206
|
+
var c, l;
|
|
1207
|
+
const f = ((l = (c = o.type.spec).toText) == null ? void 0 : l.call(c, {
|
|
1208
1208
|
node: o,
|
|
1209
1209
|
pos: s,
|
|
1210
1210
|
parent: i,
|
|
1211
|
-
index:
|
|
1211
|
+
index: a
|
|
1212
1212
|
})) || o.textContent || "%leaf%";
|
|
1213
1213
|
n += o.isAtom && !o.isText ? f : f.slice(0, Math.max(0, r - s));
|
|
1214
1214
|
}
|
|
1215
1215
|
), n;
|
|
1216
1216
|
};
|
|
1217
1217
|
function vt(t, e, n = {}) {
|
|
1218
|
-
const { empty: r, ranges: o } = t.selection, s = e ?
|
|
1218
|
+
const { empty: r, ranges: o } = t.selection, s = e ? B(e, t.schema) : null;
|
|
1219
1219
|
if (r)
|
|
1220
1220
|
return !!(t.storedMarks || t.selection.$from.marks()).filter((u) => s ? s.name === u.type.name : !0).find((u) => nt(u.attrs, n, { strict: !1 }));
|
|
1221
1221
|
let i = 0;
|
|
1222
|
-
const
|
|
1222
|
+
const a = [];
|
|
1223
1223
|
if (o.forEach(({ $from: u, $to: p }) => {
|
|
1224
1224
|
const d = u.pos, h = p.pos;
|
|
1225
1225
|
t.doc.nodesBetween(d, h, (m, g) => {
|
|
@@ -1228,9 +1228,9 @@ function vt(t, e, n = {}) {
|
|
|
1228
1228
|
if (!m.isText && !m.marks.length)
|
|
1229
1229
|
return;
|
|
1230
1230
|
const v = Math.max(d, g), y = Math.min(h, g + m.nodeSize), w = y - v;
|
|
1231
|
-
i += w,
|
|
1232
|
-
...m.marks.map((
|
|
1233
|
-
mark:
|
|
1231
|
+
i += w, a.push(
|
|
1232
|
+
...m.marks.map((M) => ({
|
|
1233
|
+
mark: M,
|
|
1234
1234
|
from: v,
|
|
1235
1235
|
to: y
|
|
1236
1236
|
}))
|
|
@@ -1238,8 +1238,8 @@ function vt(t, e, n = {}) {
|
|
|
1238
1238
|
});
|
|
1239
1239
|
}), i === 0)
|
|
1240
1240
|
return !1;
|
|
1241
|
-
const
|
|
1242
|
-
return (
|
|
1241
|
+
const c = a.filter((u) => s ? s.name === u.mark.type.name : !0).filter((u) => nt(u.mark.attrs, n, { strict: !1 })).reduce((u, p) => u + p.to - p.from, 0), l = a.filter((u) => s ? u.mark.type !== s && u.mark.type.excludes(s) : !0).reduce((u, p) => u + p.to - p.from, 0);
|
|
1242
|
+
return (c > 0 ? c + l : c) >= i;
|
|
1243
1243
|
}
|
|
1244
1244
|
function ir(t, e, n = {}) {
|
|
1245
1245
|
if (!e)
|
|
@@ -1250,7 +1250,7 @@ function ir(t, e, n = {}) {
|
|
|
1250
1250
|
var po = (t, e) => {
|
|
1251
1251
|
const { $from: n, $to: r, $anchor: o } = t.selection;
|
|
1252
1252
|
if (e) {
|
|
1253
|
-
const s = lt((
|
|
1253
|
+
const s = lt((a) => a.type.name === e)(t.selection);
|
|
1254
1254
|
if (!s)
|
|
1255
1255
|
return !1;
|
|
1256
1256
|
const i = t.doc.resolve(s.pos + 1);
|
|
@@ -1261,7 +1261,7 @@ var po = (t, e) => {
|
|
|
1261
1261
|
const { $from: e, $to: n } = t.selection;
|
|
1262
1262
|
return !(e.parentOffset > 0 || e.pos !== n.pos);
|
|
1263
1263
|
};
|
|
1264
|
-
function
|
|
1264
|
+
function Dt(t, e) {
|
|
1265
1265
|
return Array.isArray(e) ? e.some((n) => (typeof n == "string" ? n : n.name) === t.name) : e;
|
|
1266
1266
|
}
|
|
1267
1267
|
function pt(t, e) {
|
|
@@ -1272,7 +1272,7 @@ function pt(t, e) {
|
|
|
1272
1272
|
name: r.name,
|
|
1273
1273
|
options: r.options,
|
|
1274
1274
|
storage: r.storage
|
|
1275
|
-
}, s =
|
|
1275
|
+
}, s = x(b(r, "group", o));
|
|
1276
1276
|
return typeof s != "string" ? !1 : s.split(" ").includes("list");
|
|
1277
1277
|
}
|
|
1278
1278
|
function St(t, {
|
|
@@ -1337,13 +1337,13 @@ function lr(t, e, n) {
|
|
|
1337
1337
|
const { selection: o } = e;
|
|
1338
1338
|
let s = null;
|
|
1339
1339
|
if (Wt(o) && (s = o.$cursor), s) {
|
|
1340
|
-
const
|
|
1341
|
-
return s.parent.type.allowsMarkType(n) && (!!n.isInSet(
|
|
1340
|
+
const a = (r = t.storedMarks) != null ? r : s.marks();
|
|
1341
|
+
return s.parent.type.allowsMarkType(n) && (!!n.isInSet(a) || !a.some((l) => l.type.excludes(n)));
|
|
1342
1342
|
}
|
|
1343
1343
|
const { ranges: i } = o;
|
|
1344
|
-
return i.some(({ $from:
|
|
1345
|
-
let l =
|
|
1346
|
-
return t.doc.nodesBetween(
|
|
1344
|
+
return i.some(({ $from: a, $to: c }) => {
|
|
1345
|
+
let l = a.depth === 0 ? t.doc.inlineContent && t.doc.type.allowsMarkType(n) : !1;
|
|
1346
|
+
return t.doc.nodesBetween(a.pos, c.pos, (f, u, p) => {
|
|
1347
1347
|
if (l)
|
|
1348
1348
|
return !1;
|
|
1349
1349
|
if (f.isInline) {
|
|
@@ -1355,38 +1355,38 @@ function lr(t, e, n) {
|
|
|
1355
1355
|
});
|
|
1356
1356
|
}
|
|
1357
1357
|
var ur = (t, e = {}) => ({ tr: n, state: r, dispatch: o }) => {
|
|
1358
|
-
const { selection: s } = n, { empty: i, ranges:
|
|
1358
|
+
const { selection: s } = n, { empty: i, ranges: a } = s, c = B(t, r.schema);
|
|
1359
1359
|
if (o)
|
|
1360
1360
|
if (i) {
|
|
1361
|
-
const l = Kt(r,
|
|
1361
|
+
const l = Kt(r, c);
|
|
1362
1362
|
n.addStoredMark(
|
|
1363
|
-
|
|
1363
|
+
c.create({
|
|
1364
1364
|
...l,
|
|
1365
1365
|
...e
|
|
1366
1366
|
})
|
|
1367
1367
|
);
|
|
1368
1368
|
} else
|
|
1369
|
-
|
|
1369
|
+
a.forEach((l) => {
|
|
1370
1370
|
const f = l.$from.pos, u = l.$to.pos;
|
|
1371
1371
|
r.doc.nodesBetween(f, u, (p, d) => {
|
|
1372
1372
|
const h = Math.max(d, f), m = Math.min(d + p.nodeSize, u);
|
|
1373
|
-
p.marks.find((v) => v.type ===
|
|
1374
|
-
|
|
1373
|
+
p.marks.find((v) => v.type === c) ? p.marks.forEach((v) => {
|
|
1374
|
+
c === v.type && n.addMark(
|
|
1375
1375
|
h,
|
|
1376
1376
|
m,
|
|
1377
|
-
|
|
1377
|
+
c.create({
|
|
1378
1378
|
...v.attrs,
|
|
1379
1379
|
...e
|
|
1380
1380
|
})
|
|
1381
1381
|
);
|
|
1382
|
-
}) : n.addMark(h, m,
|
|
1382
|
+
}) : n.addMark(h, m, c.create(e));
|
|
1383
1383
|
});
|
|
1384
1384
|
});
|
|
1385
|
-
return lr(r, n,
|
|
1385
|
+
return lr(r, n, c);
|
|
1386
1386
|
}, dr = (t, e) => ({ tr: n }) => (n.setMeta(t, e), !0), fr = (t, e = {}) => ({ state: n, dispatch: r, chain: o }) => {
|
|
1387
1387
|
const s = T(t, n.schema);
|
|
1388
1388
|
let i;
|
|
1389
|
-
return n.selection.$anchor.sameParent(n.selection.$head) && (i = n.selection.$anchor.parent.attrs), s.isTextblock ? o().command(({ commands:
|
|
1389
|
+
return n.selection.$anchor.sameParent(n.selection.$head) && (i = n.selection.$anchor.parent.attrs), s.isTextblock ? o().command(({ commands: a }) => Ct(s, { ...i, ...e })(n) ? !0 : a.clearNodes()).command(({ state: a }) => Ct(s, { ...i, ...e })(a, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
|
|
1390
1390
|
}, pr = (t) => ({ tr: e, dispatch: n }) => {
|
|
1391
1391
|
if (n) {
|
|
1392
1392
|
const { doc: r } = e, o = z(t, 0, r.content.size), s = st.create(r, o);
|
|
@@ -1395,16 +1395,16 @@ var ur = (t, e = {}) => ({ tr: n, state: r, dispatch: o }) => {
|
|
|
1395
1395
|
return !0;
|
|
1396
1396
|
}, mr = (t, e) => ({ tr: n, state: r, dispatch: o }) => {
|
|
1397
1397
|
const { selection: s } = r;
|
|
1398
|
-
let i,
|
|
1399
|
-
return typeof e == "number" ? (i = e,
|
|
1400
|
-
|
|
1401
|
-
...
|
|
1398
|
+
let i, a;
|
|
1399
|
+
return typeof e == "number" ? (i = e, a = e) : e && "from" in e && "to" in e ? (i = e.from, a = e.to) : (i = s.from, a = s.to), o && n.doc.nodesBetween(i, a, (c, l) => {
|
|
1400
|
+
c.isText || n.setNodeMarkup(l, void 0, {
|
|
1401
|
+
...c.attrs,
|
|
1402
1402
|
dir: t
|
|
1403
1403
|
});
|
|
1404
1404
|
}), !0;
|
|
1405
1405
|
}, hr = (t) => ({ tr: e, dispatch: n }) => {
|
|
1406
1406
|
if (n) {
|
|
1407
|
-
const { doc: r } = e, { from: o, to: s } = typeof t == "number" ? { from: t, to: t } : t, i =
|
|
1407
|
+
const { doc: r } = e, { from: o, to: s } = typeof t == "number" ? { from: t, to: t } : t, i = R.atStart(r).from, a = R.atEnd(r).to, c = z(o, i, a), l = z(s, i, a), f = R.create(r, c, l);
|
|
1408
1408
|
e.setSelection(f);
|
|
1409
1409
|
}
|
|
1410
1410
|
return !0;
|
|
@@ -1420,90 +1420,90 @@ function _t(t, e) {
|
|
|
1420
1420
|
}
|
|
1421
1421
|
}
|
|
1422
1422
|
var vr = ({ keepMarks: t = !0 } = {}) => ({ tr: e, state: n, dispatch: r, editor: o }) => {
|
|
1423
|
-
const { selection: s, doc: i } = e, { $from:
|
|
1423
|
+
const { selection: s, doc: i } = e, { $from: a, $to: c } = s, l = o.extensionManager.attributes, f = et(
|
|
1424
1424
|
l,
|
|
1425
|
-
|
|
1426
|
-
|
|
1425
|
+
a.node().type.name,
|
|
1426
|
+
a.node().attrs
|
|
1427
1427
|
);
|
|
1428
1428
|
if (s instanceof st && s.node.isBlock)
|
|
1429
|
-
return !
|
|
1430
|
-
if (!
|
|
1429
|
+
return !a.parentOffset || !X(i, a.pos) ? !1 : (r && (t && _t(n, o.extensionManager.splittableMarks), e.split(a.pos).scrollIntoView()), !0);
|
|
1430
|
+
if (!a.parent.isBlock)
|
|
1431
1431
|
return !1;
|
|
1432
|
-
const u =
|
|
1432
|
+
const u = c.parentOffset === c.parent.content.size, p = a.depth === 0 ? void 0 : qn(a.node(-1).contentMatchAt(a.indexAfter(-1)));
|
|
1433
1433
|
let d = u && p ? [
|
|
1434
1434
|
{
|
|
1435
1435
|
type: p,
|
|
1436
1436
|
attrs: f
|
|
1437
1437
|
}
|
|
1438
|
-
] : void 0, h = X(e.doc, e.mapping.map(
|
|
1439
|
-
if (!d && !h && X(e.doc, e.mapping.map(
|
|
1438
|
+
] : void 0, h = X(e.doc, e.mapping.map(a.pos), 1, d);
|
|
1439
|
+
if (!d && !h && X(e.doc, e.mapping.map(a.pos), 1, p ? [{ type: p }] : void 0) && (h = !0, d = p ? [
|
|
1440
1440
|
{
|
|
1441
1441
|
type: p,
|
|
1442
1442
|
attrs: f
|
|
1443
1443
|
}
|
|
1444
1444
|
] : void 0), r) {
|
|
1445
|
-
if (h && (s instanceof
|
|
1446
|
-
const m = e.mapping.map(
|
|
1447
|
-
|
|
1445
|
+
if (h && (s instanceof R && e.deleteSelection(), e.split(e.mapping.map(a.pos), 1, d), p && !u && !a.parentOffset && a.parent.type !== p)) {
|
|
1446
|
+
const m = e.mapping.map(a.before()), g = e.doc.resolve(m);
|
|
1447
|
+
a.node(-1).canReplaceWith(g.index(), g.index() + 1, p) && e.setNodeMarkup(e.mapping.map(a.before()), p);
|
|
1448
1448
|
}
|
|
1449
1449
|
t && _t(n, o.extensionManager.splittableMarks), e.scrollIntoView();
|
|
1450
1450
|
}
|
|
1451
1451
|
return h;
|
|
1452
1452
|
}, br = (t, e = {}) => ({ tr: n, state: r, dispatch: o, editor: s }) => {
|
|
1453
1453
|
var i;
|
|
1454
|
-
const
|
|
1455
|
-
if (f && f.isBlock ||
|
|
1454
|
+
const a = T(t, r.schema), { $from: c, $to: l } = r.selection, f = r.selection.node;
|
|
1455
|
+
if (f && f.isBlock || c.depth < 2 || !c.sameParent(l))
|
|
1456
1456
|
return !1;
|
|
1457
|
-
const u =
|
|
1458
|
-
if (u.type !==
|
|
1457
|
+
const u = c.node(-1);
|
|
1458
|
+
if (u.type !== a)
|
|
1459
1459
|
return !1;
|
|
1460
1460
|
const p = s.extensionManager.attributes;
|
|
1461
|
-
if (
|
|
1462
|
-
if (
|
|
1461
|
+
if (c.parent.content.size === 0 && c.node(-1).childCount === c.indexAfter(-1)) {
|
|
1462
|
+
if (c.depth === 2 || c.node(-3).type !== a || c.index(-2) !== c.node(-2).childCount - 1)
|
|
1463
1463
|
return !1;
|
|
1464
1464
|
if (o) {
|
|
1465
|
-
let v =
|
|
1466
|
-
const y =
|
|
1467
|
-
for (let A =
|
|
1468
|
-
v =
|
|
1465
|
+
let v = D.empty;
|
|
1466
|
+
const y = c.index(-1) ? 1 : c.index(-2) ? 2 : 3;
|
|
1467
|
+
for (let A = c.depth - y; A >= c.depth - 3; A -= 1)
|
|
1468
|
+
v = D.from(c.node(A).copy(v));
|
|
1469
1469
|
const w = (
|
|
1470
1470
|
// oxlint-disable-next-line no-nested-ternary
|
|
1471
|
-
|
|
1472
|
-
),
|
|
1473
|
-
...et(p,
|
|
1471
|
+
c.indexAfter(-1) < c.node(-2).childCount ? 1 : c.indexAfter(-2) < c.node(-3).childCount ? 2 : 3
|
|
1472
|
+
), M = {
|
|
1473
|
+
...et(p, c.node().type.name, c.node().attrs),
|
|
1474
1474
|
...e
|
|
1475
|
-
}, k = ((i =
|
|
1476
|
-
v = v.append(
|
|
1477
|
-
const S =
|
|
1478
|
-
n.replace(S,
|
|
1475
|
+
}, k = ((i = a.contentMatch.defaultType) == null ? void 0 : i.createAndFill(M)) || void 0;
|
|
1476
|
+
v = v.append(D.from(a.createAndFill(null, k) || void 0));
|
|
1477
|
+
const S = c.before(c.depth - (y - 1));
|
|
1478
|
+
n.replace(S, c.after(-w), new Ue(v, 4 - y, 0));
|
|
1479
1479
|
let E = -1;
|
|
1480
1480
|
n.doc.nodesBetween(S, n.doc.content.size, (A, C) => {
|
|
1481
1481
|
if (E > -1)
|
|
1482
1482
|
return !1;
|
|
1483
1483
|
A.isTextblock && A.content.size === 0 && (E = C + 1);
|
|
1484
|
-
}), E > -1 && n.setSelection(
|
|
1484
|
+
}), E > -1 && n.setSelection(R.near(n.doc.resolve(E))), n.scrollIntoView();
|
|
1485
1485
|
}
|
|
1486
1486
|
return !0;
|
|
1487
1487
|
}
|
|
1488
|
-
const d = l.pos ===
|
|
1488
|
+
const d = l.pos === c.end() ? u.contentMatchAt(0).defaultType : null, h = {
|
|
1489
1489
|
...et(p, u.type.name, u.attrs),
|
|
1490
1490
|
...e
|
|
1491
1491
|
}, m = {
|
|
1492
|
-
...et(p,
|
|
1492
|
+
...et(p, c.node().type.name, c.node().attrs),
|
|
1493
1493
|
...e
|
|
1494
1494
|
};
|
|
1495
|
-
n.delete(
|
|
1495
|
+
n.delete(c.pos, l.pos);
|
|
1496
1496
|
const g = d ? [
|
|
1497
|
-
{ type:
|
|
1497
|
+
{ type: a, attrs: h },
|
|
1498
1498
|
{ type: d, attrs: m }
|
|
1499
|
-
] : [{ type:
|
|
1500
|
-
if (!X(n.doc,
|
|
1499
|
+
] : [{ type: a, attrs: h }];
|
|
1500
|
+
if (!X(n.doc, c.pos, 2))
|
|
1501
1501
|
return !1;
|
|
1502
1502
|
if (o) {
|
|
1503
|
-
const { selection: v, storedMarks: y } = r, { splittableMarks: w } = s.extensionManager,
|
|
1504
|
-
if (n.split(
|
|
1503
|
+
const { selection: v, storedMarks: y } = r, { splittableMarks: w } = s.extensionManager, M = y || v.$to.parentOffset && v.$from.marks();
|
|
1504
|
+
if (n.split(c.pos, 2, g).scrollIntoView(), !M || !o)
|
|
1505
1505
|
return !0;
|
|
1506
|
-
const k =
|
|
1506
|
+
const k = M.filter((S) => w.includes(S.type.name));
|
|
1507
1507
|
n.ensureMarks(k);
|
|
1508
1508
|
}
|
|
1509
1509
|
return !0;
|
|
@@ -1531,10 +1531,10 @@ function yr(t) {
|
|
|
1531
1531
|
if (!n)
|
|
1532
1532
|
return null;
|
|
1533
1533
|
const r = e.resolve(1), o = e.resolve(n.nodeSize - 1);
|
|
1534
|
-
return
|
|
1534
|
+
return R.between(r, o);
|
|
1535
1535
|
}
|
|
1536
|
-
var kr = (t, e, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch:
|
|
1537
|
-
const { extensions: u, splittableMarks: p } = o.extensionManager, d = T(t, i.schema), h = T(e, i.schema), { selection: m, storedMarks: g } = i, { $from: v, $to: y } = m, w = v.blockRange(y),
|
|
1536
|
+
var kr = (t, e, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: a, chain: c, commands: l, can: f }) => {
|
|
1537
|
+
const { extensions: u, splittableMarks: p } = o.extensionManager, d = T(t, i.schema), h = T(e, i.schema), { selection: m, storedMarks: g } = i, { $from: v, $to: y } = m, w = v.blockRange(y), M = g || m.$to.parentOffset && m.$from.marks();
|
|
1538
1538
|
if (!w)
|
|
1539
1539
|
return !1;
|
|
1540
1540
|
const k = lt((I) => pt(I.type.name, u))(m), S = m.from === 0 && m.to === i.doc.content.size, E = i.doc.content.content, A = E.length === 1 ? E[0] : null, C = S && A && pt(A.type.name, u) ? {
|
|
@@ -1543,25 +1543,25 @@ var kr = (t, e, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: c, chain:
|
|
|
1543
1543
|
} : null, $ = k ?? C, H = !!k && w.depth >= 1 && w.depth - k.depth <= 1, L = !!C;
|
|
1544
1544
|
if ((H || L) && $) {
|
|
1545
1545
|
if ($.node.type === d)
|
|
1546
|
-
return S && L ?
|
|
1546
|
+
return S && L ? c().command(({ tr: I, dispatch: N }) => {
|
|
1547
1547
|
const P = yr(I);
|
|
1548
1548
|
return P ? (I.setSelection(P), N && N(I), !0) : !1;
|
|
1549
1549
|
}).liftListItem(h).run() : l.liftListItem(h);
|
|
1550
1550
|
if (pt($.node.type.name, u) && d.validContent($.node.content))
|
|
1551
|
-
return
|
|
1551
|
+
return c().command(() => (s.setNodeMarkup($.pos, d), !0)).command(() => mt(s, d)).command(() => ht(s, d)).run();
|
|
1552
1552
|
}
|
|
1553
|
-
return !n || !
|
|
1554
|
-
const I = f().wrapInList(d, r), N =
|
|
1553
|
+
return !n || !M || !a ? c().command(() => f().wrapInList(d, r) ? !0 : l.clearNodes()).wrapInList(d, r).command(() => mt(s, d)).command(() => ht(s, d)).run() : c().command(() => {
|
|
1554
|
+
const I = f().wrapInList(d, r), N = M.filter((P) => p.includes(P.type.name));
|
|
1555
1555
|
return s.ensureMarks(N), I ? !0 : l.clearNodes();
|
|
1556
1556
|
}).wrapInList(d, r).command(() => mt(s, d)).command(() => ht(s, d)).run();
|
|
1557
1557
|
}, wr = (t, e = {}, n = {}) => ({ state: r, commands: o }) => {
|
|
1558
|
-
const { extendEmptyMarkRange: s = !1 } = n, i =
|
|
1558
|
+
const { extendEmptyMarkRange: s = !1 } = n, i = B(t, r.schema);
|
|
1559
1559
|
return vt(r, i, e) ? o.unsetMark(i, { extendEmptyMarkRange: s }) : o.setMark(i, e);
|
|
1560
|
-
},
|
|
1561
|
-
const s = T(t, r.schema), i = T(e, r.schema),
|
|
1562
|
-
let
|
|
1563
|
-
return r.selection.$anchor.sameParent(r.selection.$head) && (
|
|
1564
|
-
},
|
|
1560
|
+
}, Mr = (t, e, n = {}) => ({ state: r, commands: o }) => {
|
|
1561
|
+
const s = T(t, r.schema), i = T(e, r.schema), a = Q(r, s, n);
|
|
1562
|
+
let c;
|
|
1563
|
+
return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), a ? o.setNode(i, c) : o.setNode(s, { ...c, ...n });
|
|
1564
|
+
}, xr = (t, e = {}) => ({ state: n, commands: r }) => {
|
|
1565
1565
|
const o = T(t, n.schema);
|
|
1566
1566
|
return Q(n, o, e) ? r.lift(o) : r.wrapIn(o, e);
|
|
1567
1567
|
}, Sr = () => ({ state: t, dispatch: e }) => {
|
|
@@ -1571,12 +1571,12 @@ var kr = (t, e, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: c, chain:
|
|
|
1571
1571
|
let s;
|
|
1572
1572
|
if (o.spec.isInputRules && (s = o.getState(t))) {
|
|
1573
1573
|
if (e) {
|
|
1574
|
-
const i = t.tr,
|
|
1575
|
-
for (let
|
|
1576
|
-
i.step(
|
|
1574
|
+
const i = t.tr, a = s.transform;
|
|
1575
|
+
for (let c = a.steps.length - 1; c >= 0; c -= 1)
|
|
1576
|
+
i.step(a.steps[c].invert(a.docs[c]));
|
|
1577
1577
|
if (s.text) {
|
|
1578
|
-
const
|
|
1579
|
-
i.replaceWith(s.from, s.to, t.schema.text(s.text,
|
|
1578
|
+
const c = i.doc.resolve(s.from).marks();
|
|
1579
|
+
i.replaceWith(s.from, s.to, t.schema.text(s.text, c));
|
|
1580
1580
|
} else
|
|
1581
1581
|
i.delete(s.from, s.to);
|
|
1582
1582
|
}
|
|
@@ -1584,59 +1584,69 @@ var kr = (t, e, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: c, chain:
|
|
|
1584
1584
|
}
|
|
1585
1585
|
}
|
|
1586
1586
|
return !1;
|
|
1587
|
-
}, Er = () => ({ tr:
|
|
1588
|
-
const {
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
}
|
|
1587
|
+
}, Er = (t = {}) => ({ tr: e, dispatch: n, editor: r }) => {
|
|
1588
|
+
const { ignoreClearable: o = !1 } = t, { selection: s } = e, { empty: i, ranges: a } = s;
|
|
1589
|
+
if (i)
|
|
1590
|
+
return !0;
|
|
1591
|
+
const { nonClearableMarks: c } = r.extensionManager;
|
|
1592
|
+
if (n) {
|
|
1593
|
+
const l = Object.values(r.schema.marks).filter(
|
|
1594
|
+
(f) => o || !c.includes(f.name)
|
|
1595
|
+
);
|
|
1596
|
+
a.forEach((f) => {
|
|
1597
|
+
for (const u of l)
|
|
1598
|
+
e.removeMark(f.$from.pos, f.$to.pos, u);
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
return !0;
|
|
1592
1602
|
}, Tr = (t, e = {}) => ({ tr: n, state: r, dispatch: o }) => {
|
|
1593
1603
|
var s;
|
|
1594
|
-
const { extendEmptyMarkRange: i = !1 } = e, { selection:
|
|
1604
|
+
const { extendEmptyMarkRange: i = !1 } = e, { selection: a } = n, c = B(t, r.schema), { $from: l, empty: f, ranges: u } = a;
|
|
1595
1605
|
if (!o)
|
|
1596
1606
|
return !0;
|
|
1597
1607
|
if (f && i) {
|
|
1598
|
-
let { from: p, to: d } =
|
|
1599
|
-
const h = (s = l.marks().find((g) => g.type ===
|
|
1600
|
-
m && (p = m.from, d = m.to), n.removeMark(p, d,
|
|
1608
|
+
let { from: p, to: d } = a;
|
|
1609
|
+
const h = (s = l.marks().find((g) => g.type === c)) == null ? void 0 : s.attrs, m = wt(l, c, h);
|
|
1610
|
+
m && (p = m.from, d = m.to), n.removeMark(p, d, c);
|
|
1601
1611
|
} else
|
|
1602
1612
|
u.forEach((p) => {
|
|
1603
|
-
n.removeMark(p.$from.pos, p.$to.pos,
|
|
1613
|
+
n.removeMark(p.$from.pos, p.$to.pos, c);
|
|
1604
1614
|
});
|
|
1605
|
-
return n.removeStoredMark(
|
|
1615
|
+
return n.removeStoredMark(c), !0;
|
|
1606
1616
|
}, Ar = (t) => ({ tr: e, state: n, dispatch: r }) => {
|
|
1607
1617
|
const { selection: o } = n;
|
|
1608
1618
|
let s, i;
|
|
1609
|
-
return typeof t == "number" ? (s = t, i = t) : t && "from" in t && "to" in t ? (s = t.from, i = t.to) : (s = o.from, i = o.to), r && e.doc.nodesBetween(s, i, (
|
|
1610
|
-
if (
|
|
1619
|
+
return typeof t == "number" ? (s = t, i = t) : t && "from" in t && "to" in t ? (s = t.from, i = t.to) : (s = o.from, i = o.to), r && e.doc.nodesBetween(s, i, (a, c) => {
|
|
1620
|
+
if (a.isText)
|
|
1611
1621
|
return;
|
|
1612
|
-
const l = { ...
|
|
1613
|
-
delete l.dir, e.setNodeMarkup(
|
|
1622
|
+
const l = { ...a.attrs };
|
|
1623
|
+
delete l.dir, e.setNodeMarkup(c, void 0, l);
|
|
1614
1624
|
}), !0;
|
|
1615
1625
|
}, Cr = (t, e = {}) => ({ tr: n, state: r, dispatch: o }) => {
|
|
1616
1626
|
let s = null, i = null;
|
|
1617
|
-
const
|
|
1627
|
+
const a = ct(
|
|
1618
1628
|
typeof t == "string" ? t : t.name,
|
|
1619
1629
|
r.schema
|
|
1620
1630
|
);
|
|
1621
|
-
if (!
|
|
1631
|
+
if (!a)
|
|
1622
1632
|
return !1;
|
|
1623
|
-
|
|
1624
|
-
let
|
|
1633
|
+
a === "node" && (s = T(t, r.schema)), a === "mark" && (i = B(t, r.schema));
|
|
1634
|
+
let c = !1;
|
|
1625
1635
|
return n.selection.ranges.forEach((l) => {
|
|
1626
1636
|
const f = l.$from.pos, u = l.$to.pos;
|
|
1627
1637
|
let p, d, h, m;
|
|
1628
1638
|
n.selection.empty ? r.doc.nodesBetween(f, u, (g, v) => {
|
|
1629
|
-
s && s === g.type && (
|
|
1639
|
+
s && s === g.type && (c = !0, h = Math.max(v, f), m = Math.min(v + g.nodeSize, u), p = v, d = g);
|
|
1630
1640
|
}) : r.doc.nodesBetween(f, u, (g, v) => {
|
|
1631
|
-
v < f && s && s === g.type && (
|
|
1641
|
+
v < f && s && s === g.type && (c = !0, h = Math.max(v, f), m = Math.min(v + g.nodeSize, u), p = v, d = g), v >= f && v <= u && (s && s === g.type && (c = !0, o && n.setNodeMarkup(v, void 0, {
|
|
1632
1642
|
...g.attrs,
|
|
1633
1643
|
...e
|
|
1634
1644
|
})), i && g.marks.length && g.marks.forEach((y) => {
|
|
1635
|
-
if (i === y.type && (
|
|
1636
|
-
const w = Math.max(v, f),
|
|
1645
|
+
if (i === y.type && (c = !0, o)) {
|
|
1646
|
+
const w = Math.max(v, f), M = Math.min(v + g.nodeSize, u);
|
|
1637
1647
|
n.addMark(
|
|
1638
1648
|
w,
|
|
1639
|
-
|
|
1649
|
+
M,
|
|
1640
1650
|
i.create({
|
|
1641
1651
|
...y.attrs,
|
|
1642
1652
|
...e
|
|
@@ -1657,7 +1667,7 @@ var kr = (t, e, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: c, chain:
|
|
|
1657
1667
|
})
|
|
1658
1668
|
);
|
|
1659
1669
|
}));
|
|
1660
|
-
}),
|
|
1670
|
+
}), c;
|
|
1661
1671
|
}, Pr = (t, e = {}) => ({ state: n, dispatch: r }) => {
|
|
1662
1672
|
const o = T(t, n.schema);
|
|
1663
1673
|
return Fe(o, e)(n, r);
|
|
@@ -1706,10 +1716,10 @@ var kr = (t, e, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: c, chain:
|
|
|
1706
1716
|
};
|
|
1707
1717
|
function Z(t) {
|
|
1708
1718
|
var e;
|
|
1709
|
-
const { editor: n, from: r, to: o, text: s, rules: i, plugin:
|
|
1710
|
-
if (
|
|
1719
|
+
const { editor: n, from: r, to: o, text: s, rules: i, plugin: a } = t, { view: c } = n;
|
|
1720
|
+
if (c.composing)
|
|
1711
1721
|
return !1;
|
|
1712
|
-
const l =
|
|
1722
|
+
const l = c.state.doc.resolve(r);
|
|
1713
1723
|
if (
|
|
1714
1724
|
// check for code node
|
|
1715
1725
|
l.parent.type.spec.code || (e = l.nodeBefore || l.nodeAfter) != null && e.marks.find((p) => p.type.spec.code)
|
|
@@ -1723,8 +1733,8 @@ function Z(t) {
|
|
|
1723
1733
|
const d = Ir(u, p.find);
|
|
1724
1734
|
if (!d)
|
|
1725
1735
|
return;
|
|
1726
|
-
const h =
|
|
1727
|
-
state:
|
|
1736
|
+
const h = c.state.tr, m = it({
|
|
1737
|
+
state: c.state,
|
|
1728
1738
|
transaction: h
|
|
1729
1739
|
}), g = {
|
|
1730
1740
|
from: r - (d[0].length - s.length),
|
|
@@ -1740,29 +1750,29 @@ function Z(t) {
|
|
|
1740
1750
|
commands: v,
|
|
1741
1751
|
chain: y,
|
|
1742
1752
|
can: w
|
|
1743
|
-
}) === null || !h.steps.length || (p.undoable && h.setMeta(
|
|
1753
|
+
}) === null || !h.steps.length || (p.undoable && h.setMeta(a, {
|
|
1744
1754
|
transform: h,
|
|
1745
1755
|
from: r,
|
|
1746
1756
|
to: o,
|
|
1747
1757
|
text: s
|
|
1748
|
-
}),
|
|
1758
|
+
}), c.dispatch(h), f = !0);
|
|
1749
1759
|
}), f;
|
|
1750
1760
|
}
|
|
1751
|
-
function
|
|
1752
|
-
const { editor: e, rules: n } = t, r = new
|
|
1761
|
+
function Rr(t) {
|
|
1762
|
+
const { editor: e, rules: n } = t, r = new O({
|
|
1753
1763
|
state: {
|
|
1754
1764
|
init() {
|
|
1755
1765
|
return null;
|
|
1756
1766
|
},
|
|
1757
1767
|
apply(o, s, i) {
|
|
1758
|
-
const
|
|
1759
|
-
if (
|
|
1760
|
-
return
|
|
1761
|
-
const
|
|
1762
|
-
return
|
|
1763
|
-
let { text: f } =
|
|
1764
|
-
typeof f == "string" ? f = f : f = ut(
|
|
1765
|
-
const { from: u } =
|
|
1768
|
+
const a = o.getMeta(r);
|
|
1769
|
+
if (a)
|
|
1770
|
+
return a;
|
|
1771
|
+
const c = o.getMeta("applyInputRules");
|
|
1772
|
+
return c && setTimeout(() => {
|
|
1773
|
+
let { text: f } = c;
|
|
1774
|
+
typeof f == "string" ? f = f : f = ut(D.from(f), i.schema);
|
|
1775
|
+
const { from: u } = c, p = u + f.length;
|
|
1766
1776
|
Z({
|
|
1767
1777
|
editor: e,
|
|
1768
1778
|
from: u,
|
|
@@ -1775,12 +1785,12 @@ function Or(t) {
|
|
|
1775
1785
|
}
|
|
1776
1786
|
},
|
|
1777
1787
|
props: {
|
|
1778
|
-
handleTextInput(o, s, i,
|
|
1788
|
+
handleTextInput(o, s, i, a) {
|
|
1779
1789
|
return Z({
|
|
1780
1790
|
editor: e,
|
|
1781
1791
|
from: s,
|
|
1782
1792
|
to: i,
|
|
1783
|
-
text:
|
|
1793
|
+
text: a,
|
|
1784
1794
|
rules: n,
|
|
1785
1795
|
plugin: r
|
|
1786
1796
|
});
|
|
@@ -1820,11 +1830,11 @@ function Or(t) {
|
|
|
1820
1830
|
});
|
|
1821
1831
|
return r;
|
|
1822
1832
|
}
|
|
1823
|
-
function
|
|
1833
|
+
function Or(t) {
|
|
1824
1834
|
return Object.prototype.toString.call(t).slice(8, -1);
|
|
1825
1835
|
}
|
|
1826
1836
|
function G(t) {
|
|
1827
|
-
return
|
|
1837
|
+
return Or(t) !== "Object" ? !1 : t.constructor === Object && Object.getPrototypeOf(t) === Object.prototype;
|
|
1828
1838
|
}
|
|
1829
1839
|
function oe(t, e) {
|
|
1830
1840
|
const n = { ...t };
|
|
@@ -1843,7 +1853,7 @@ var Et = class {
|
|
|
1843
1853
|
}
|
|
1844
1854
|
get options() {
|
|
1845
1855
|
return {
|
|
1846
|
-
...
|
|
1856
|
+
...x(
|
|
1847
1857
|
b(this, "addOptions", {
|
|
1848
1858
|
name: this.name
|
|
1849
1859
|
})
|
|
@@ -1852,7 +1862,7 @@ var Et = class {
|
|
|
1852
1862
|
}
|
|
1853
1863
|
get storage() {
|
|
1854
1864
|
return {
|
|
1855
|
-
...
|
|
1865
|
+
...x(
|
|
1856
1866
|
b(this, "addStorage", {
|
|
1857
1867
|
name: this.name,
|
|
1858
1868
|
options: this.options
|
|
@@ -1871,7 +1881,7 @@ var Et = class {
|
|
|
1871
1881
|
const e = new this.constructor({ ...this.config, ...t });
|
|
1872
1882
|
return e.parent = this, this.child = e, e.name = "name" in t ? t.name : e.parent.name, e;
|
|
1873
1883
|
}
|
|
1874
|
-
},
|
|
1884
|
+
}, jr = class se extends Et {
|
|
1875
1885
|
constructor() {
|
|
1876
1886
|
super(...arguments), this.type = "mark";
|
|
1877
1887
|
}
|
|
@@ -1889,8 +1899,8 @@ var Et = class {
|
|
|
1889
1899
|
const i = o.marks();
|
|
1890
1900
|
if (!!!i.find((l) => l?.type.name === n.name))
|
|
1891
1901
|
return !1;
|
|
1892
|
-
const
|
|
1893
|
-
return
|
|
1902
|
+
const c = i.find((l) => l?.type.name === n.name);
|
|
1903
|
+
return c && r.removeStoredMark(c), r.insertText(" ", o.pos), e.view.dispatch(r), !0;
|
|
1894
1904
|
}
|
|
1895
1905
|
return !1;
|
|
1896
1906
|
}
|
|
@@ -1902,10 +1912,10 @@ var Et = class {
|
|
|
1902
1912
|
return super.extend(n);
|
|
1903
1913
|
}
|
|
1904
1914
|
};
|
|
1905
|
-
function
|
|
1915
|
+
function Br(t) {
|
|
1906
1916
|
return typeof t == "number";
|
|
1907
1917
|
}
|
|
1908
|
-
var
|
|
1918
|
+
var Dr = class {
|
|
1909
1919
|
constructor(t) {
|
|
1910
1920
|
this.find = t.find, this.handler = t.handler;
|
|
1911
1921
|
}
|
|
@@ -1921,7 +1931,7 @@ var jr = class {
|
|
|
1921
1931
|
}) : [];
|
|
1922
1932
|
};
|
|
1923
1933
|
function Lr(t) {
|
|
1924
|
-
const { editor: e, state: n, from: r, to: o, rule: s, pasteEvent: i, dropEvent:
|
|
1934
|
+
const { editor: e, state: n, from: r, to: o, rule: s, pasteEvent: i, dropEvent: a } = t, { commands: c, chain: l, can: f } = new at({
|
|
1925
1935
|
editor: e,
|
|
1926
1936
|
state: n
|
|
1927
1937
|
}), u = [];
|
|
@@ -1929,7 +1939,7 @@ function Lr(t) {
|
|
|
1929
1939
|
var m, g, v, y, w;
|
|
1930
1940
|
if ((g = (m = d.type) == null ? void 0 : m.spec) != null && g.code || !(d.isText || d.isTextblock || d.isInline))
|
|
1931
1941
|
return;
|
|
1932
|
-
const
|
|
1942
|
+
const M = (w = (y = (v = d.content) == null ? void 0 : v.size) != null ? y : d.nodeSize) != null ? w : 0, k = Math.max(r, h), S = Math.min(o, h + M);
|
|
1933
1943
|
if (k >= S)
|
|
1934
1944
|
return;
|
|
1935
1945
|
const E = d.isText ? d.text || "" : d.textBetween(k - h, S - h, void 0, "");
|
|
@@ -1943,11 +1953,11 @@ function Lr(t) {
|
|
|
1943
1953
|
state: n,
|
|
1944
1954
|
range: L,
|
|
1945
1955
|
match: C,
|
|
1946
|
-
commands:
|
|
1956
|
+
commands: c,
|
|
1947
1957
|
chain: l,
|
|
1948
1958
|
can: f,
|
|
1949
1959
|
pasteEvent: i,
|
|
1950
|
-
dropEvent:
|
|
1960
|
+
dropEvent: a
|
|
1951
1961
|
});
|
|
1952
1962
|
u.push(I);
|
|
1953
1963
|
});
|
|
@@ -1962,13 +1972,13 @@ var Y = null, zr = (t) => {
|
|
|
1962
1972
|
};
|
|
1963
1973
|
function Fr(t) {
|
|
1964
1974
|
const { editor: e, rules: n } = t;
|
|
1965
|
-
let r = null, o = !1, s = !1, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null,
|
|
1975
|
+
let r = null, o = !1, s = !1, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, a;
|
|
1966
1976
|
try {
|
|
1967
|
-
|
|
1977
|
+
a = typeof DragEvent < "u" ? new DragEvent("drop") : null;
|
|
1968
1978
|
} catch {
|
|
1969
|
-
|
|
1979
|
+
a = null;
|
|
1970
1980
|
}
|
|
1971
|
-
const
|
|
1981
|
+
const c = ({
|
|
1972
1982
|
state: f,
|
|
1973
1983
|
from: u,
|
|
1974
1984
|
to: p,
|
|
@@ -1986,17 +1996,17 @@ function Fr(t) {
|
|
|
1986
1996
|
to: p.b - 1,
|
|
1987
1997
|
rule: d,
|
|
1988
1998
|
pasteEvent: h,
|
|
1989
|
-
dropEvent:
|
|
1999
|
+
dropEvent: a
|
|
1990
2000
|
}) || !m.steps.length)) {
|
|
1991
2001
|
try {
|
|
1992
|
-
|
|
2002
|
+
a = typeof DragEvent < "u" ? new DragEvent("drop") : null;
|
|
1993
2003
|
} catch {
|
|
1994
|
-
|
|
2004
|
+
a = null;
|
|
1995
2005
|
}
|
|
1996
2006
|
return i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, m;
|
|
1997
2007
|
}
|
|
1998
2008
|
};
|
|
1999
|
-
return n.map((f) => new
|
|
2009
|
+
return n.map((f) => new O({
|
|
2000
2010
|
// we register a global drag handler to track the current drag source element
|
|
2001
2011
|
view(u) {
|
|
2002
2012
|
const p = (h) => {
|
|
@@ -2014,7 +2024,7 @@ function Fr(t) {
|
|
|
2014
2024
|
props: {
|
|
2015
2025
|
handleDOMEvents: {
|
|
2016
2026
|
drop: (u, p) => {
|
|
2017
|
-
if (s = r === u.dom.parentElement,
|
|
2027
|
+
if (s = r === u.dom.parentElement, a = p, !s) {
|
|
2018
2028
|
const d = Y;
|
|
2019
2029
|
d?.isEditable && setTimeout(() => {
|
|
2020
2030
|
const h = d.state.selection;
|
|
@@ -2039,9 +2049,9 @@ function Fr(t) {
|
|
|
2039
2049
|
return;
|
|
2040
2050
|
if (y) {
|
|
2041
2051
|
let { text: k } = v;
|
|
2042
|
-
typeof k == "string" ? k = k : k = ut(
|
|
2052
|
+
typeof k == "string" ? k = k : k = ut(D.from(k), d.schema);
|
|
2043
2053
|
const { from: S } = v, E = S + k.length, A = zr(k);
|
|
2044
|
-
return
|
|
2054
|
+
return c({
|
|
2045
2055
|
rule: f,
|
|
2046
2056
|
state: d,
|
|
2047
2057
|
from: S,
|
|
@@ -2049,13 +2059,13 @@ function Fr(t) {
|
|
|
2049
2059
|
pasteEvt: A
|
|
2050
2060
|
});
|
|
2051
2061
|
}
|
|
2052
|
-
const w = p.doc.content.findDiffStart(d.doc.content),
|
|
2053
|
-
if (!(!
|
|
2054
|
-
return
|
|
2062
|
+
const w = p.doc.content.findDiffStart(d.doc.content), M = p.doc.content.findDiffEnd(d.doc.content);
|
|
2063
|
+
if (!(!Br(w) || !M || w === M.b))
|
|
2064
|
+
return c({
|
|
2055
2065
|
rule: f,
|
|
2056
2066
|
state: d,
|
|
2057
2067
|
from: w,
|
|
2058
|
-
to:
|
|
2068
|
+
to: M,
|
|
2059
2069
|
pasteEvt: i
|
|
2060
2070
|
});
|
|
2061
2071
|
}
|
|
@@ -2063,7 +2073,7 @@ function Fr(t) {
|
|
|
2063
2073
|
}
|
|
2064
2074
|
var ft = class {
|
|
2065
2075
|
constructor(t, e) {
|
|
2066
|
-
this.splittableMarks = [], this.editor = e, this.baseExtensions = t, this.extensions =
|
|
2076
|
+
this.splittableMarks = [], this.nonClearableMarks = [], this.editor = e, this.baseExtensions = t, this.extensions = xt(t), this.schema = Gt(this.extensions, e), this.setupExtensions();
|
|
2067
2077
|
}
|
|
2068
2078
|
/**
|
|
2069
2079
|
* Get all commands from the extensions.
|
|
@@ -2106,24 +2116,24 @@ var ft = class {
|
|
|
2106
2116
|
"addKeyboardShortcuts",
|
|
2107
2117
|
o
|
|
2108
2118
|
);
|
|
2109
|
-
let
|
|
2110
|
-
if (r.type === "mark" && b(r, "exitable", o) && (
|
|
2119
|
+
let a = {};
|
|
2120
|
+
if (r.type === "mark" && b(r, "exitable", o) && (a.ArrowRight = () => jr.handleExit({ editor: t, mark: r })), i) {
|
|
2111
2121
|
const p = Object.fromEntries(
|
|
2112
2122
|
Object.entries(i()).map(([d, h]) => [d, () => h({ editor: t })])
|
|
2113
2123
|
);
|
|
2114
|
-
|
|
2124
|
+
a = { ...a, ...p };
|
|
2115
2125
|
}
|
|
2116
|
-
const
|
|
2117
|
-
s.push(
|
|
2126
|
+
const c = Ze(a);
|
|
2127
|
+
s.push(c);
|
|
2118
2128
|
const l = b(
|
|
2119
2129
|
r,
|
|
2120
2130
|
"addInputRules",
|
|
2121
2131
|
o
|
|
2122
2132
|
);
|
|
2123
|
-
if (
|
|
2133
|
+
if (Dt(r, t.options.enableInputRules) && l) {
|
|
2124
2134
|
const p = l();
|
|
2125
2135
|
if (p && p.length) {
|
|
2126
|
-
const d =
|
|
2136
|
+
const d = Rr({
|
|
2127
2137
|
editor: t,
|
|
2128
2138
|
rules: p
|
|
2129
2139
|
}), h = Array.isArray(d) ? d : [d];
|
|
@@ -2135,7 +2145,7 @@ var ft = class {
|
|
|
2135
2145
|
"addPasteRules",
|
|
2136
2146
|
o
|
|
2137
2147
|
);
|
|
2138
|
-
if (
|
|
2148
|
+
if (Dt(r, t.options.enablePasteRules) && f) {
|
|
2139
2149
|
const p = f();
|
|
2140
2150
|
if (p && p.length) {
|
|
2141
2151
|
const d = Fr({ editor: t, rules: p });
|
|
@@ -2170,7 +2180,7 @@ var ft = class {
|
|
|
2170
2180
|
return Object.fromEntries(
|
|
2171
2181
|
e.filter((n) => !!b(n, "addNodeView")).map((n) => {
|
|
2172
2182
|
const r = this.attributes.filter(
|
|
2173
|
-
(
|
|
2183
|
+
(c) => c.type === n.name
|
|
2174
2184
|
), o = {
|
|
2175
2185
|
name: n.name,
|
|
2176
2186
|
options: n.options,
|
|
@@ -2187,11 +2197,11 @@ var ft = class {
|
|
|
2187
2197
|
const i = s();
|
|
2188
2198
|
if (!i)
|
|
2189
2199
|
return [];
|
|
2190
|
-
const
|
|
2191
|
-
const d = ot(
|
|
2200
|
+
const a = (c, l, f, u, p) => {
|
|
2201
|
+
const d = ot(c, r);
|
|
2192
2202
|
return i({
|
|
2193
2203
|
// pass-through
|
|
2194
|
-
node:
|
|
2204
|
+
node: c,
|
|
2195
2205
|
view: l,
|
|
2196
2206
|
getPos: f,
|
|
2197
2207
|
decorations: u,
|
|
@@ -2202,7 +2212,7 @@ var ft = class {
|
|
|
2202
2212
|
HTMLAttributes: d
|
|
2203
2213
|
});
|
|
2204
2214
|
};
|
|
2205
|
-
return [n.name,
|
|
2215
|
+
return [n.name, a];
|
|
2206
2216
|
})
|
|
2207
2217
|
);
|
|
2208
2218
|
}
|
|
@@ -2225,8 +2235,8 @@ var ft = class {
|
|
|
2225
2235
|
"dispatchTransaction",
|
|
2226
2236
|
s
|
|
2227
2237
|
);
|
|
2228
|
-
return i ? (
|
|
2229
|
-
i.call(s, { transaction:
|
|
2238
|
+
return i ? (a) => {
|
|
2239
|
+
i.call(s, { transaction: a, next: r });
|
|
2230
2240
|
} : r;
|
|
2231
2241
|
}, t);
|
|
2232
2242
|
}
|
|
@@ -2250,8 +2260,8 @@ var ft = class {
|
|
|
2250
2260
|
"transformPastedHTML",
|
|
2251
2261
|
s
|
|
2252
2262
|
);
|
|
2253
|
-
return i ? (
|
|
2254
|
-
const l = r(
|
|
2263
|
+
return i ? (a, c) => {
|
|
2264
|
+
const l = r(a, c);
|
|
2255
2265
|
return i.call(s, l);
|
|
2256
2266
|
} : r;
|
|
2257
2267
|
},
|
|
@@ -2263,13 +2273,13 @@ var ft = class {
|
|
|
2263
2273
|
return Object.fromEntries(
|
|
2264
2274
|
e.filter((n) => !!b(n, "addMarkView")).map((n) => {
|
|
2265
2275
|
const r = this.attributes.filter(
|
|
2266
|
-
(
|
|
2276
|
+
(a) => a.type === n.name
|
|
2267
2277
|
), o = {
|
|
2268
2278
|
name: n.name,
|
|
2269
2279
|
options: n.options,
|
|
2270
2280
|
storage: this.editor.extensionStorage[n.name],
|
|
2271
2281
|
editor: t,
|
|
2272
|
-
type:
|
|
2282
|
+
type: B(n.name, this.schema)
|
|
2273
2283
|
}, s = b(
|
|
2274
2284
|
n,
|
|
2275
2285
|
"addMarkView",
|
|
@@ -2277,19 +2287,19 @@ var ft = class {
|
|
|
2277
2287
|
);
|
|
2278
2288
|
if (!s)
|
|
2279
2289
|
return [];
|
|
2280
|
-
const i = (
|
|
2281
|
-
const f = ot(
|
|
2290
|
+
const i = (a, c, l) => {
|
|
2291
|
+
const f = ot(a, r);
|
|
2282
2292
|
return s()({
|
|
2283
2293
|
// pass-through
|
|
2284
|
-
mark:
|
|
2285
|
-
view:
|
|
2294
|
+
mark: a,
|
|
2295
|
+
view: c,
|
|
2286
2296
|
inline: l,
|
|
2287
2297
|
// tiptap-specific
|
|
2288
2298
|
editor: t,
|
|
2289
2299
|
extension: n,
|
|
2290
2300
|
HTMLAttributes: f,
|
|
2291
2301
|
updateAttributes: (u) => {
|
|
2292
|
-
to(
|
|
2302
|
+
to(a, t, u);
|
|
2293
2303
|
}
|
|
2294
2304
|
});
|
|
2295
2305
|
};
|
|
@@ -2329,35 +2339,37 @@ var ft = class {
|
|
|
2329
2339
|
this.editor.extensionStorage = Object.fromEntries(
|
|
2330
2340
|
t.map((e) => [e.name, e.storage])
|
|
2331
2341
|
), t.forEach((e) => {
|
|
2332
|
-
var n;
|
|
2333
|
-
const
|
|
2342
|
+
var n, r;
|
|
2343
|
+
const o = {
|
|
2334
2344
|
name: e.name,
|
|
2335
2345
|
options: e.options,
|
|
2336
2346
|
storage: this.editor.extensionStorage[e.name],
|
|
2337
2347
|
editor: this.editor,
|
|
2338
2348
|
type: W(e.name, this.schema)
|
|
2339
2349
|
};
|
|
2340
|
-
e.type === "mark" && ((n =
|
|
2341
|
-
|
|
2350
|
+
e.type === "mark" && (((n = x(b(e, "keepOnSplit", o))) == null || n) && this.splittableMarks.push(e.name), (r = x(
|
|
2351
|
+
b(e, "clearable", o)
|
|
2352
|
+
)) == null || r || this.nonClearableMarks.push(e.name));
|
|
2353
|
+
const s = b(
|
|
2342
2354
|
e,
|
|
2343
2355
|
"onBeforeCreate",
|
|
2344
|
-
|
|
2345
|
-
),
|
|
2356
|
+
o
|
|
2357
|
+
), i = b(e, "onCreate", o), a = b(e, "onUpdate", o), c = b(
|
|
2346
2358
|
e,
|
|
2347
2359
|
"onSelectionUpdate",
|
|
2348
|
-
|
|
2349
|
-
),
|
|
2360
|
+
o
|
|
2361
|
+
), l = b(
|
|
2350
2362
|
e,
|
|
2351
2363
|
"onTransaction",
|
|
2352
|
-
|
|
2353
|
-
),
|
|
2354
|
-
|
|
2364
|
+
o
|
|
2365
|
+
), f = b(e, "onFocus", o), u = b(e, "onBlur", o), p = b(e, "onDestroy", o);
|
|
2366
|
+
s && this.editor.on("beforeCreate", s), i && this.editor.on("create", i), a && this.editor.on("update", a), c && this.editor.on("selectionUpdate", c), l && this.editor.on("transaction", l), f && this.editor.on("focus", f), u && this.editor.on("blur", u), p && this.editor.on("destroy", p);
|
|
2355
2367
|
});
|
|
2356
2368
|
}
|
|
2357
2369
|
};
|
|
2358
|
-
ft.resolve =
|
|
2370
|
+
ft.resolve = xt;
|
|
2359
2371
|
ft.sort = J;
|
|
2360
|
-
ft.flatten =
|
|
2372
|
+
ft.flatten = Mt;
|
|
2361
2373
|
var Vr = {};
|
|
2362
2374
|
yt(Vr, {
|
|
2363
2375
|
ClipboardTextSerializer: () => ae,
|
|
@@ -2372,7 +2384,7 @@ yt(Vr, {
|
|
|
2372
2384
|
TextDirection: () => ve,
|
|
2373
2385
|
focusEventsPluginKey: () => fe
|
|
2374
2386
|
});
|
|
2375
|
-
var
|
|
2387
|
+
var j = class ie extends Et {
|
|
2376
2388
|
constructor() {
|
|
2377
2389
|
super(...arguments), this.type = "extension";
|
|
2378
2390
|
}
|
|
@@ -2391,7 +2403,7 @@ var B = class ie extends Et {
|
|
|
2391
2403
|
const n = typeof e == "function" ? e() : e;
|
|
2392
2404
|
return super.extend(n);
|
|
2393
2405
|
}
|
|
2394
|
-
}, ae =
|
|
2406
|
+
}, ae = j.create({
|
|
2395
2407
|
name: "clipboardTextSerializer",
|
|
2396
2408
|
addOptions() {
|
|
2397
2409
|
return {
|
|
@@ -2400,34 +2412,38 @@ var B = class ie extends Et {
|
|
|
2400
2412
|
},
|
|
2401
2413
|
addProseMirrorPlugins() {
|
|
2402
2414
|
return [
|
|
2403
|
-
new
|
|
2415
|
+
new O({
|
|
2404
2416
|
key: new _("clipboardTextSerializer"),
|
|
2405
2417
|
props: {
|
|
2406
2418
|
clipboardTextSerializer: () => {
|
|
2407
|
-
const { editor: t } = this, { state: e, schema: n } = t, { doc: r, selection: o } = e,
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2419
|
+
const { editor: t } = this, { state: e, schema: n } = t, { doc: r, selection: o } = e, s = te(n), { blockSeparator: i } = this.options, a = {
|
|
2420
|
+
...i !== void 0 ? { blockSeparator: i } : {},
|
|
2421
|
+
textSerializers: s
|
|
2422
|
+
};
|
|
2423
|
+
return [...o.ranges].sort((l, f) => l.$from.pos - f.$from.pos).map(
|
|
2424
|
+
({ $from: l, $to: f }) => Xt(r, { from: l.pos, to: f.pos }, a)
|
|
2425
|
+
).join(i ?? `
|
|
2426
|
+
|
|
2427
|
+
`);
|
|
2412
2428
|
}
|
|
2413
2429
|
}
|
|
2414
2430
|
})
|
|
2415
2431
|
];
|
|
2416
2432
|
}
|
|
2417
|
-
}), ce =
|
|
2433
|
+
}), ce = j.create({
|
|
2418
2434
|
name: "commands",
|
|
2419
2435
|
addCommands() {
|
|
2420
2436
|
return {
|
|
2421
2437
|
...Vt
|
|
2422
2438
|
};
|
|
2423
2439
|
}
|
|
2424
|
-
}), le =
|
|
2440
|
+
}), le = j.create({
|
|
2425
2441
|
name: "delete",
|
|
2426
2442
|
onUpdate({ transaction: t, appendedTransactions: e }) {
|
|
2427
2443
|
var n, r, o;
|
|
2428
2444
|
const s = () => {
|
|
2429
|
-
var i,
|
|
2430
|
-
if ((l = (
|
|
2445
|
+
var i, a, c, l;
|
|
2446
|
+
if ((l = (c = (a = (i = this.editor.options.coreExtensionOptions) == null ? void 0 : i.delete) == null ? void 0 : a.filterTransaction) == null ? void 0 : c.call(a, t)) != null ? l : t.getMeta("y-sync$"))
|
|
2431
2447
|
return;
|
|
2432
2448
|
const f = Un(t.before, [
|
|
2433
2449
|
t,
|
|
@@ -2460,7 +2476,7 @@ var B = class ie extends Et {
|
|
|
2460
2476
|
f.steps.forEach((d, h) => {
|
|
2461
2477
|
var m, g;
|
|
2462
2478
|
if (d instanceof we) {
|
|
2463
|
-
const v = p.slice(h).map(d.from, -1), y = p.slice(h).map(d.to), w = p.invert().map(v, -1),
|
|
2479
|
+
const v = p.slice(h).map(d.from, -1), y = p.slice(h).map(d.to), w = p.invert().map(v, -1), M = p.invert().map(y), k = v > 0 ? (m = f.doc.nodeAt(v - 1)) == null ? void 0 : m.marks.some((E) => E.eq(d.mark)) : !1, S = (g = f.doc.nodeAt(y)) == null ? void 0 : g.marks.some((E) => E.eq(d.mark));
|
|
2464
2480
|
this.editor.emit("delete", {
|
|
2465
2481
|
type: "mark",
|
|
2466
2482
|
mark: d.mark,
|
|
@@ -2468,7 +2484,7 @@ var B = class ie extends Et {
|
|
|
2468
2484
|
to: d.to,
|
|
2469
2485
|
deletedRange: {
|
|
2470
2486
|
from: w,
|
|
2471
|
-
to:
|
|
2487
|
+
to: M
|
|
2472
2488
|
},
|
|
2473
2489
|
newRange: {
|
|
2474
2490
|
from: v,
|
|
@@ -2484,11 +2500,11 @@ var B = class ie extends Et {
|
|
|
2484
2500
|
};
|
|
2485
2501
|
(o = (r = (n = this.editor.options.coreExtensionOptions) == null ? void 0 : n.delete) == null ? void 0 : r.async) == null || o ? setTimeout(s, 0) : s();
|
|
2486
2502
|
}
|
|
2487
|
-
}), ue =
|
|
2503
|
+
}), ue = j.create({
|
|
2488
2504
|
name: "drop",
|
|
2489
2505
|
addProseMirrorPlugins() {
|
|
2490
2506
|
return [
|
|
2491
|
-
new
|
|
2507
|
+
new O({
|
|
2492
2508
|
key: new _("tiptapDrop"),
|
|
2493
2509
|
props: {
|
|
2494
2510
|
handleDrop: (t, e, n, r) => {
|
|
@@ -2503,11 +2519,11 @@ var B = class ie extends Et {
|
|
|
2503
2519
|
})
|
|
2504
2520
|
];
|
|
2505
2521
|
}
|
|
2506
|
-
}), de =
|
|
2522
|
+
}), de = j.create({
|
|
2507
2523
|
name: "editable",
|
|
2508
2524
|
addProseMirrorPlugins() {
|
|
2509
2525
|
return [
|
|
2510
|
-
new
|
|
2526
|
+
new O({
|
|
2511
2527
|
key: new _("editable"),
|
|
2512
2528
|
props: {
|
|
2513
2529
|
editable: () => this.editor.options.editable
|
|
@@ -2515,12 +2531,12 @@ var B = class ie extends Et {
|
|
|
2515
2531
|
})
|
|
2516
2532
|
];
|
|
2517
2533
|
}
|
|
2518
|
-
}), fe = new _("focusEvents"), pe =
|
|
2534
|
+
}), fe = new _("focusEvents"), pe = j.create({
|
|
2519
2535
|
name: "focusEvents",
|
|
2520
2536
|
addProseMirrorPlugins() {
|
|
2521
2537
|
const { editor: t } = this;
|
|
2522
2538
|
return [
|
|
2523
|
-
new
|
|
2539
|
+
new O({
|
|
2524
2540
|
key: fe,
|
|
2525
2541
|
props: {
|
|
2526
2542
|
handleDOMEvents: {
|
|
@@ -2539,14 +2555,14 @@ var B = class ie extends Et {
|
|
|
2539
2555
|
})
|
|
2540
2556
|
];
|
|
2541
2557
|
}
|
|
2542
|
-
}), me =
|
|
2558
|
+
}), me = j.create({
|
|
2543
2559
|
name: "keymap",
|
|
2544
2560
|
addKeyboardShortcuts() {
|
|
2545
2561
|
const t = () => this.editor.commands.first(({ commands: i }) => [
|
|
2546
2562
|
() => i.undoInputRule(),
|
|
2547
2563
|
// maybe convert first text block node to default node
|
|
2548
|
-
() => i.command(({ tr:
|
|
2549
|
-
const { selection:
|
|
2564
|
+
() => i.command(({ tr: a }) => {
|
|
2565
|
+
const { selection: c, doc: l } = a, { empty: f, $anchor: u } = c, { pos: p, parent: d } = u, h = u.parent.isTextblock && p > 0 ? a.doc.resolve(p - 1) : u, m = h.parent.type.spec.isolating, g = u.pos - u.parentOffset, v = m && h.parent.childCount === 1 ? g === u.pos : F.atStart(l).from === p;
|
|
2550
2566
|
return !f || !d.type.isTextblock || d.textContent.length || !v || v && u.parent.type.name === "paragraph" ? !1 : i.clearNodes();
|
|
2551
2567
|
}),
|
|
2552
2568
|
() => i.deleteSelection(),
|
|
@@ -2593,7 +2609,7 @@ var B = class ie extends Et {
|
|
|
2593
2609
|
// to a paragraph if necessary.
|
|
2594
2610
|
// This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well
|
|
2595
2611
|
// with many other commands.
|
|
2596
|
-
new
|
|
2612
|
+
new O({
|
|
2597
2613
|
key: new _("clearDocument"),
|
|
2598
2614
|
appendTransaction: (t, e, n) => {
|
|
2599
2615
|
if (t.some((m) => m.getMeta("composition")))
|
|
@@ -2603,8 +2619,8 @@ var B = class ie extends Et {
|
|
|
2603
2619
|
);
|
|
2604
2620
|
if (!r || o)
|
|
2605
2621
|
return;
|
|
2606
|
-
const { empty: s, from: i, to:
|
|
2607
|
-
if (s || !(i ===
|
|
2622
|
+
const { empty: s, from: i, to: a } = e.selection, c = F.atStart(e.doc).from, l = F.atEnd(e.doc).to;
|
|
2623
|
+
if (s || !(i === c && a === l) || !St(n.doc))
|
|
2608
2624
|
return;
|
|
2609
2625
|
const p = n.tr, d = it({
|
|
2610
2626
|
state: n,
|
|
@@ -2619,11 +2635,11 @@ var B = class ie extends Et {
|
|
|
2619
2635
|
})
|
|
2620
2636
|
];
|
|
2621
2637
|
}
|
|
2622
|
-
}), he =
|
|
2638
|
+
}), he = j.create({
|
|
2623
2639
|
name: "paste",
|
|
2624
2640
|
addProseMirrorPlugins() {
|
|
2625
2641
|
return [
|
|
2626
|
-
new
|
|
2642
|
+
new O({
|
|
2627
2643
|
key: new _("tiptapPaste"),
|
|
2628
2644
|
props: {
|
|
2629
2645
|
handlePaste: (t, e, n) => {
|
|
@@ -2637,7 +2653,7 @@ var B = class ie extends Et {
|
|
|
2637
2653
|
})
|
|
2638
2654
|
];
|
|
2639
2655
|
}
|
|
2640
|
-
}), ge =
|
|
2656
|
+
}), ge = j.create({
|
|
2641
2657
|
name: "tabindex",
|
|
2642
2658
|
addOptions() {
|
|
2643
2659
|
return {
|
|
@@ -2646,7 +2662,7 @@ var B = class ie extends Et {
|
|
|
2646
2662
|
},
|
|
2647
2663
|
addProseMirrorPlugins() {
|
|
2648
2664
|
return [
|
|
2649
|
-
new
|
|
2665
|
+
new O({
|
|
2650
2666
|
key: new _("tabindex"),
|
|
2651
2667
|
props: {
|
|
2652
2668
|
attributes: () => {
|
|
@@ -2657,7 +2673,7 @@ var B = class ie extends Et {
|
|
|
2657
2673
|
})
|
|
2658
2674
|
];
|
|
2659
2675
|
}
|
|
2660
|
-
}), ve =
|
|
2676
|
+
}), ve = j.create({
|
|
2661
2677
|
name: "textDirection",
|
|
2662
2678
|
addOptions() {
|
|
2663
2679
|
return {
|
|
@@ -2688,7 +2704,7 @@ var B = class ie extends Et {
|
|
|
2688
2704
|
},
|
|
2689
2705
|
addProseMirrorPlugins() {
|
|
2690
2706
|
return [
|
|
2691
|
-
new
|
|
2707
|
+
new O({
|
|
2692
2708
|
key: new _("textDirection"),
|
|
2693
2709
|
props: {
|
|
2694
2710
|
attributes: () => {
|
|
@@ -2775,14 +2791,14 @@ var B = class ie extends Et {
|
|
|
2775
2791
|
get children() {
|
|
2776
2792
|
const e = [];
|
|
2777
2793
|
return this.node.content.forEach((n, r) => {
|
|
2778
|
-
const o = n.isBlock && !n.isTextblock, s = n.isAtom && !n.isText, i = n.isInline,
|
|
2779
|
-
if (
|
|
2794
|
+
const o = n.isBlock && !n.isTextblock, s = n.isAtom && !n.isText, i = n.isInline, a = this.pos + r + (s ? 0 : 1);
|
|
2795
|
+
if (a < 0 || a > this.resolvedPos.doc.nodeSize - 2)
|
|
2780
2796
|
return;
|
|
2781
|
-
const
|
|
2782
|
-
if (!o && !i &&
|
|
2797
|
+
const c = this.resolvedPos.doc.resolve(a);
|
|
2798
|
+
if (!o && !i && c.depth <= this.depth)
|
|
2783
2799
|
return;
|
|
2784
2800
|
const l = new q(
|
|
2785
|
-
|
|
2801
|
+
c,
|
|
2786
2802
|
this.editor,
|
|
2787
2803
|
o,
|
|
2788
2804
|
o || i ? n : null
|
|
@@ -2803,9 +2819,9 @@ var B = class ie extends Et {
|
|
|
2803
2819
|
if (o.node.type.name === e)
|
|
2804
2820
|
if (Object.keys(n).length > 0) {
|
|
2805
2821
|
const s = o.node.attrs, i = Object.keys(n);
|
|
2806
|
-
for (let
|
|
2807
|
-
const
|
|
2808
|
-
if (s[
|
|
2822
|
+
for (let a = 0; a < i.length; a += 1) {
|
|
2823
|
+
const c = i[a];
|
|
2824
|
+
if (s[c] !== n[c])
|
|
2809
2825
|
break;
|
|
2810
2826
|
}
|
|
2811
2827
|
} else
|
|
@@ -2824,7 +2840,7 @@ var B = class ie extends Et {
|
|
|
2824
2840
|
const s = Object.keys(n);
|
|
2825
2841
|
return this.children.forEach((i) => {
|
|
2826
2842
|
r && o.length > 0 || (i.node.type.name === e && s.every(
|
|
2827
|
-
(
|
|
2843
|
+
(c) => n[c] === i.node.attrs[c]
|
|
2828
2844
|
) && o.push(i), !(r && o.length > 0) && (o = o.concat(i.querySelectorAll(e, n, r))));
|
|
2829
2845
|
}), o;
|
|
2830
2846
|
}
|
|
@@ -2907,11 +2923,11 @@ img.ProseMirror-separator {
|
|
|
2907
2923
|
display: block;
|
|
2908
2924
|
}`;
|
|
2909
2925
|
function Ur(t, e, n) {
|
|
2910
|
-
const r = document.querySelector(
|
|
2926
|
+
const r = document.querySelector(`style[data-tiptap-style${n ? `-${n}` : ""}]`);
|
|
2911
2927
|
if (r !== null)
|
|
2912
2928
|
return r;
|
|
2913
2929
|
const o = document.createElement("style");
|
|
2914
|
-
return e && o.setAttribute("nonce", e), o.setAttribute(
|
|
2930
|
+
return e && o.setAttribute("nonce", e), o.setAttribute(`data-tiptap-style${n ? `-${n}` : ""}`, ""), o.innerHTML = t, document.getElementsByTagName("head")[0].appendChild(o), o;
|
|
2915
2931
|
}
|
|
2916
2932
|
var go = class extends Nr {
|
|
2917
2933
|
constructor(t = {}) {
|
|
@@ -3198,12 +3214,12 @@ var go = class extends Nr {
|
|
|
3198
3214
|
markViews: this.extensionManager.markViews,
|
|
3199
3215
|
nodeViews: this.extensionManager.nodeViews
|
|
3200
3216
|
});
|
|
3201
|
-
const
|
|
3217
|
+
const a = this.state.reconfigure({
|
|
3202
3218
|
plugins: this.extensionManager.plugins
|
|
3203
3219
|
});
|
|
3204
|
-
this.view.updateState(
|
|
3205
|
-
const
|
|
3206
|
-
|
|
3220
|
+
this.view.updateState(a), this.prependClass(), this.injectCSS();
|
|
3221
|
+
const c = this.view.dom;
|
|
3222
|
+
c.editor = this;
|
|
3207
3223
|
}
|
|
3208
3224
|
/**
|
|
3209
3225
|
* Creates all node and mark views.
|
|
@@ -3259,15 +3275,15 @@ var go = class extends Nr {
|
|
|
3259
3275
|
editor: this,
|
|
3260
3276
|
transaction: t
|
|
3261
3277
|
});
|
|
3262
|
-
const i = n.findLast((l) => l.getMeta("focus") || l.getMeta("blur")),
|
|
3263
|
-
|
|
3278
|
+
const i = n.findLast((l) => l.getMeta("focus") || l.getMeta("blur")), a = i?.getMeta("focus"), c = i?.getMeta("blur");
|
|
3279
|
+
a && this.emit("focus", {
|
|
3264
3280
|
editor: this,
|
|
3265
|
-
event:
|
|
3281
|
+
event: a.event,
|
|
3266
3282
|
// oxlint-disable-next-lineno-non-null-assertion
|
|
3267
3283
|
transaction: i
|
|
3268
|
-
}),
|
|
3284
|
+
}), c && this.emit("blur", {
|
|
3269
3285
|
editor: this,
|
|
3270
|
-
event:
|
|
3286
|
+
event: c.event,
|
|
3271
3287
|
// oxlint-disable-next-lineno-non-null-assertion
|
|
3272
3288
|
transaction: i
|
|
3273
3289
|
}), !(t.getMeta("preventUpdate") || !n.some((l) => l.docChanged) || s.doc.eq(e.doc)) && this.emit("update", {
|
|
@@ -3352,17 +3368,17 @@ function vo(t) {
|
|
|
3352
3368
|
return new dt({
|
|
3353
3369
|
find: t.find,
|
|
3354
3370
|
handler: ({ state: e, range: n, match: r }) => {
|
|
3355
|
-
const o =
|
|
3371
|
+
const o = x(t.getAttributes, void 0, r);
|
|
3356
3372
|
if (o === !1 || o === null)
|
|
3357
3373
|
return null;
|
|
3358
|
-
const { tr: s } = e, i = r[r.length - 1],
|
|
3374
|
+
const { tr: s } = e, i = r[r.length - 1], a = r[0];
|
|
3359
3375
|
if (i) {
|
|
3360
|
-
const
|
|
3376
|
+
const c = a.search(/\S/), l = n.from + a.indexOf(i), f = l + i.length;
|
|
3361
3377
|
if (ee(n.from, n.to, e.doc).filter((d) => d.mark.type.excluded.find((m) => m === t.type && m !== d.mark.type)).filter((d) => d.to > l).length)
|
|
3362
3378
|
return null;
|
|
3363
|
-
f < n.to && s.delete(f, n.to), l > n.from && s.delete(n.from +
|
|
3364
|
-
const p = n.from +
|
|
3365
|
-
s.addMark(n.from +
|
|
3379
|
+
f < n.to && s.delete(f, n.to), l > n.from && s.delete(n.from + c, l);
|
|
3380
|
+
const p = n.from + c + i.length;
|
|
3381
|
+
s.addMark(n.from + c, p, t.type.create(o || {})), s.removeStoredMark(t.type);
|
|
3366
3382
|
}
|
|
3367
3383
|
},
|
|
3368
3384
|
undoable: t.undoable
|
|
@@ -3372,20 +3388,20 @@ function bo(t) {
|
|
|
3372
3388
|
return new dt({
|
|
3373
3389
|
find: t.find,
|
|
3374
3390
|
handler: ({ state: e, range: n, match: r }) => {
|
|
3375
|
-
const o =
|
|
3376
|
-
let
|
|
3377
|
-
const
|
|
3391
|
+
const o = x(t.getAttributes, void 0, r) || {}, { tr: s } = e, i = n.from;
|
|
3392
|
+
let a = n.to;
|
|
3393
|
+
const c = t.type.create(o);
|
|
3378
3394
|
if (r[1]) {
|
|
3379
3395
|
const l = r[0].lastIndexOf(r[1]);
|
|
3380
3396
|
let f = i + l;
|
|
3381
|
-
f >
|
|
3397
|
+
f > a ? f = a : a = f + r[1].length;
|
|
3382
3398
|
const u = r[0][r[0].length - 1];
|
|
3383
|
-
s.insertText(u, i + r[0].length - 1), s.replaceWith(f,
|
|
3399
|
+
s.insertText(u, i + r[0].length - 1), s.replaceWith(f, a, c);
|
|
3384
3400
|
} else if (r[0]) {
|
|
3385
3401
|
const l = t.type.isInline ? i : i - 1;
|
|
3386
3402
|
s.insert(l, t.type.create(o)).delete(
|
|
3387
3403
|
s.mapping.map(i),
|
|
3388
|
-
s.mapping.map(
|
|
3404
|
+
s.mapping.map(a)
|
|
3389
3405
|
);
|
|
3390
3406
|
}
|
|
3391
3407
|
s.scrollIntoView();
|
|
@@ -3397,7 +3413,7 @@ function yo(t) {
|
|
|
3397
3413
|
return new dt({
|
|
3398
3414
|
find: t.find,
|
|
3399
3415
|
handler: ({ state: e, range: n, match: r }) => {
|
|
3400
|
-
const o = e.doc.resolve(n.from), s =
|
|
3416
|
+
const o = e.doc.resolve(n.from), s = x(t.getAttributes, void 0, r) || {};
|
|
3401
3417
|
if (!o.node(-1).canReplaceWith(o.index(-1), o.indexAfter(-1), t.type))
|
|
3402
3418
|
return null;
|
|
3403
3419
|
e.tr.delete(n.from, n.to).setBlockType(n.from, n.from, t.type, s);
|
|
@@ -3409,10 +3425,10 @@ function ko(t) {
|
|
|
3409
3425
|
return new dt({
|
|
3410
3426
|
find: t.find,
|
|
3411
3427
|
handler: ({ state: e, range: n, match: r, chain: o }) => {
|
|
3412
|
-
const s =
|
|
3428
|
+
const s = x(t.getAttributes, void 0, r) || {}, i = e.tr.delete(n.from, n.to), c = i.doc.resolve(n.from).blockRange(), l = c && ye(c, t.type, s);
|
|
3413
3429
|
if (!l)
|
|
3414
3430
|
return null;
|
|
3415
|
-
if (i.wrap(
|
|
3431
|
+
if (i.wrap(c, l), t.keepMarks && t.editor) {
|
|
3416
3432
|
const { selection: u, storedMarks: p } = e, { splittableMarks: d } = t.editor.extensionManager, h = p || u.$to.parentOffset && u.$from.marks();
|
|
3417
3433
|
if (h) {
|
|
3418
3434
|
const m = h.filter((g) => d.includes(g.type.name));
|
|
@@ -3470,8 +3486,8 @@ function Tt(t) {
|
|
|
3470
3486
|
const p = parseInt(((u = f.match(/__QUOTED_(\d+)__/)) == null ? void 0 : u[1]) || "0", 10), d = n[p];
|
|
3471
3487
|
d && (e[l] = d.slice(1, -1));
|
|
3472
3488
|
});
|
|
3473
|
-
const
|
|
3474
|
-
return
|
|
3489
|
+
const c = r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g, "").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g, "").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g, "").trim();
|
|
3490
|
+
return c && c.split(/\s+/).filter(Boolean).forEach((f) => {
|
|
3475
3491
|
f.match(/^[a-zA-Z][\w-]*$/) && (e[f] = !0);
|
|
3476
3492
|
}), e;
|
|
3477
3493
|
}
|
|
@@ -3491,12 +3507,12 @@ function Jr(t) {
|
|
|
3491
3507
|
serializeAttributes: o = At,
|
|
3492
3508
|
defaultAttributes: s = {},
|
|
3493
3509
|
requiredAttributes: i = [],
|
|
3494
|
-
allowedAttributes:
|
|
3495
|
-
} = t,
|
|
3496
|
-
if (!
|
|
3510
|
+
allowedAttributes: a
|
|
3511
|
+
} = t, c = n || e, l = (f) => {
|
|
3512
|
+
if (!a)
|
|
3497
3513
|
return f;
|
|
3498
3514
|
const u = {};
|
|
3499
|
-
return
|
|
3515
|
+
return a.forEach((p) => {
|
|
3500
3516
|
p in f && (u[p] = f[p]);
|
|
3501
3517
|
}), u;
|
|
3502
3518
|
};
|
|
@@ -3510,11 +3526,11 @@ function Jr(t) {
|
|
|
3510
3526
|
level: "block",
|
|
3511
3527
|
start(f) {
|
|
3512
3528
|
var u;
|
|
3513
|
-
const p = new RegExp(`^:::${
|
|
3529
|
+
const p = new RegExp(`^:::${c}(?:\\s|$)`, "m"), d = (u = f.match(p)) == null ? void 0 : u.index;
|
|
3514
3530
|
return d !== void 0 ? d : -1;
|
|
3515
3531
|
},
|
|
3516
3532
|
tokenize(f, u, p) {
|
|
3517
|
-
const d = new RegExp(`^:::${
|
|
3533
|
+
const d = new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`), h = f.match(d);
|
|
3518
3534
|
if (!h)
|
|
3519
3535
|
return;
|
|
3520
3536
|
const m = h[1] || "", g = r(m);
|
|
@@ -3528,7 +3544,7 @@ function Jr(t) {
|
|
|
3528
3544
|
},
|
|
3529
3545
|
renderMarkdown: (f) => {
|
|
3530
3546
|
const u = l(f.attrs || {}), p = o(u), d = p ? ` {${p}}` : "";
|
|
3531
|
-
return `:::${
|
|
3547
|
+
return `:::${c}${d} :::`;
|
|
3532
3548
|
}
|
|
3533
3549
|
};
|
|
3534
3550
|
}
|
|
@@ -3540,13 +3556,13 @@ function Kr(t) {
|
|
|
3540
3556
|
parseAttributes: o = Tt,
|
|
3541
3557
|
serializeAttributes: s = At,
|
|
3542
3558
|
defaultAttributes: i = {},
|
|
3543
|
-
content:
|
|
3544
|
-
allowedAttributes:
|
|
3559
|
+
content: a = "block",
|
|
3560
|
+
allowedAttributes: c
|
|
3545
3561
|
} = t, l = n || e, f = (u) => {
|
|
3546
|
-
if (!
|
|
3562
|
+
if (!c)
|
|
3547
3563
|
return u;
|
|
3548
3564
|
const p = {};
|
|
3549
|
-
return
|
|
3565
|
+
return c.forEach((d) => {
|
|
3550
3566
|
d in u && (p[d] = u[d]);
|
|
3551
3567
|
}), p;
|
|
3552
3568
|
};
|
|
@@ -3556,7 +3572,7 @@ function Kr(t) {
|
|
|
3556
3572
|
if (r) {
|
|
3557
3573
|
const m = r(u);
|
|
3558
3574
|
d = typeof m == "string" ? [{ type: "text", text: m }] : m;
|
|
3559
|
-
} else
|
|
3575
|
+
} else a === "block" ? d = p.parseChildren(u.tokens || []) : d = p.parseInline(u.tokens || []);
|
|
3560
3576
|
const h = { ...i, ...u.attributes };
|
|
3561
3577
|
return p.createNode(e, h, d);
|
|
3562
3578
|
},
|
|
@@ -3574,7 +3590,7 @@ function Kr(t) {
|
|
|
3574
3590
|
if (!g)
|
|
3575
3591
|
return;
|
|
3576
3592
|
const [v, y = ""] = g, w = o(y);
|
|
3577
|
-
let
|
|
3593
|
+
let M = 1;
|
|
3578
3594
|
const k = v.length;
|
|
3579
3595
|
let S = "";
|
|
3580
3596
|
const E = /^:::([\w-]*)(\s.*)?/gm, A = u.slice(k);
|
|
@@ -3585,14 +3601,14 @@ function Kr(t) {
|
|
|
3585
3601
|
const $ = C.index, H = C[1];
|
|
3586
3602
|
if (!((h = C[2]) != null && h.endsWith(":::"))) {
|
|
3587
3603
|
if (H)
|
|
3588
|
-
|
|
3589
|
-
else if (
|
|
3604
|
+
M += 1;
|
|
3605
|
+
else if (M -= 1, M === 0) {
|
|
3590
3606
|
const L = A.slice(0, $);
|
|
3591
3607
|
S = L.trim();
|
|
3592
3608
|
const I = u.slice(0, k + $ + C[0].length);
|
|
3593
3609
|
let N = [];
|
|
3594
3610
|
if (S)
|
|
3595
|
-
if (
|
|
3611
|
+
if (a === "block")
|
|
3596
3612
|
for (N = d.blockTokens(L), N.forEach((P) => {
|
|
3597
3613
|
P.text && (!P.tokens || P.tokens.length === 0) && (P.tokens = d.inlineTokens(P.text));
|
|
3598
3614
|
}); N.length > 0; ) {
|
|
@@ -3650,13 +3666,13 @@ function Gr(t) {
|
|
|
3650
3666
|
parseAttributes: o = Qr,
|
|
3651
3667
|
serializeAttributes: s = Zr,
|
|
3652
3668
|
defaultAttributes: i = {},
|
|
3653
|
-
selfClosing:
|
|
3654
|
-
allowedAttributes:
|
|
3669
|
+
selfClosing: a = !1,
|
|
3670
|
+
allowedAttributes: c
|
|
3655
3671
|
} = t, l = n || e, f = (p) => {
|
|
3656
|
-
if (!
|
|
3672
|
+
if (!c)
|
|
3657
3673
|
return p;
|
|
3658
3674
|
const d = {};
|
|
3659
|
-
return
|
|
3675
|
+
return c.forEach((h) => {
|
|
3660
3676
|
const m = typeof h == "string" ? h : h.name, g = typeof h == "string" ? void 0 : h.skipIfDefault;
|
|
3661
3677
|
if (m in p) {
|
|
3662
3678
|
const v = p[m];
|
|
@@ -3669,7 +3685,7 @@ function Gr(t) {
|
|
|
3669
3685
|
return {
|
|
3670
3686
|
parseMarkdown: (p, d) => {
|
|
3671
3687
|
const h = { ...i, ...p.attributes };
|
|
3672
|
-
if (
|
|
3688
|
+
if (a)
|
|
3673
3689
|
return d.createNode(e, h);
|
|
3674
3690
|
const m = r ? r(p) : p.content || "";
|
|
3675
3691
|
return m ? d.createNode(e, h, [d.createTextNode(m)]) : d.createNode(e, h, []);
|
|
@@ -3678,22 +3694,22 @@ function Gr(t) {
|
|
|
3678
3694
|
name: e,
|
|
3679
3695
|
level: "inline",
|
|
3680
3696
|
start(p) {
|
|
3681
|
-
const d =
|
|
3697
|
+
const d = a ? new RegExp(`\\[${u}\\s*[^\\]]*\\]`) : new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`), h = p.match(d), m = h?.index;
|
|
3682
3698
|
return m !== void 0 ? m : -1;
|
|
3683
3699
|
},
|
|
3684
3700
|
tokenize(p, d, h) {
|
|
3685
|
-
const m =
|
|
3701
|
+
const m = a ? new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`) : new RegExp(
|
|
3686
3702
|
`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`
|
|
3687
3703
|
), g = p.match(m);
|
|
3688
3704
|
if (!g)
|
|
3689
3705
|
return;
|
|
3690
3706
|
let v = "", y = "";
|
|
3691
|
-
if (
|
|
3692
|
-
const [,
|
|
3693
|
-
y =
|
|
3707
|
+
if (a) {
|
|
3708
|
+
const [, M] = g;
|
|
3709
|
+
y = M;
|
|
3694
3710
|
} else {
|
|
3695
|
-
const [,
|
|
3696
|
-
y =
|
|
3711
|
+
const [, M, k] = g;
|
|
3712
|
+
y = M, v = k || "";
|
|
3697
3713
|
}
|
|
3698
3714
|
const w = o(y.trim());
|
|
3699
3715
|
return {
|
|
@@ -3708,20 +3724,20 @@ function Gr(t) {
|
|
|
3708
3724
|
let d = "";
|
|
3709
3725
|
r ? d = r(p) : p.content && p.content.length > 0 && (d = p.content.filter((v) => v.type === "text").map((v) => v.text).join(""));
|
|
3710
3726
|
const h = f(p.attrs || {}), m = s(h), g = m ? ` ${m}` : "";
|
|
3711
|
-
return
|
|
3727
|
+
return a ? `[${l}${g}]` : `[${l}${g}]${d}[/${l}]`;
|
|
3712
3728
|
}
|
|
3713
3729
|
};
|
|
3714
3730
|
}
|
|
3715
3731
|
function Yr(t, e, n) {
|
|
3716
3732
|
var r, o, s, i;
|
|
3717
|
-
const
|
|
3718
|
-
`),
|
|
3733
|
+
const a = t.split(`
|
|
3734
|
+
`), c = [];
|
|
3719
3735
|
let l = "", f = 0;
|
|
3720
3736
|
const u = e.baseIndentSize || 2;
|
|
3721
|
-
for (; f <
|
|
3722
|
-
const p =
|
|
3737
|
+
for (; f < a.length; ) {
|
|
3738
|
+
const p = a[f], d = p.match(e.itemPattern);
|
|
3723
3739
|
if (!d) {
|
|
3724
|
-
if (
|
|
3740
|
+
if (c.length > 0)
|
|
3725
3741
|
break;
|
|
3726
3742
|
if (p.trim() === "") {
|
|
3727
3743
|
f += 1, l = `${l}${p}
|
|
@@ -3734,13 +3750,13 @@ function Yr(t, e, n) {
|
|
|
3734
3750
|
l = `${l}${p}
|
|
3735
3751
|
`;
|
|
3736
3752
|
const v = [g];
|
|
3737
|
-
for (f += 1; f <
|
|
3738
|
-
const k =
|
|
3753
|
+
for (f += 1; f < a.length; ) {
|
|
3754
|
+
const k = a[f];
|
|
3739
3755
|
if (k.trim() === "") {
|
|
3740
|
-
const E =
|
|
3756
|
+
const E = a.slice(f + 1).findIndex(($) => $.trim() !== "");
|
|
3741
3757
|
if (E === -1)
|
|
3742
3758
|
break;
|
|
3743
|
-
if ((((o = (r =
|
|
3759
|
+
if ((((o = (r = a[f + 1 + E].match(/^(\s*)/)) == null ? void 0 : r[1]) == null ? void 0 : o.length) || 0) > m) {
|
|
3744
3760
|
v.push(k), l = `${l}${k}
|
|
3745
3761
|
`, f += 1;
|
|
3746
3762
|
continue;
|
|
@@ -3760,20 +3776,20 @@ function Yr(t, e, n) {
|
|
|
3760
3776
|
`);
|
|
3761
3777
|
k.trim() && (e.customNestedParser ? y = e.customNestedParser(k) : y = n.blockTokens(k));
|
|
3762
3778
|
}
|
|
3763
|
-
const
|
|
3764
|
-
|
|
3779
|
+
const M = e.createToken(h, y);
|
|
3780
|
+
c.push(M);
|
|
3765
3781
|
}
|
|
3766
|
-
if (
|
|
3782
|
+
if (c.length !== 0)
|
|
3767
3783
|
return {
|
|
3768
|
-
items:
|
|
3784
|
+
items: c,
|
|
3769
3785
|
raw: l
|
|
3770
3786
|
};
|
|
3771
3787
|
}
|
|
3772
3788
|
function Xr(t, e, n, r) {
|
|
3773
3789
|
if (!t || !Array.isArray(t.content))
|
|
3774
3790
|
return "";
|
|
3775
|
-
const o = typeof n == "function" ? n(r) : n, [s, ...i] = t.content,
|
|
3776
|
-
let
|
|
3791
|
+
const o = typeof n == "function" ? n(r) : n, [s, ...i] = t.content, a = e.renderChildren([s]);
|
|
3792
|
+
let c = `${o}${a}`;
|
|
3777
3793
|
return i && i.length > 0 && i.forEach((l, f) => {
|
|
3778
3794
|
var u, p;
|
|
3779
3795
|
const d = (p = (u = e.renderChild) == null ? void 0 : u.call(e, l, f + 1)) != null ? p : e.renderChildren([l]);
|
|
@@ -3781,19 +3797,19 @@ function Xr(t, e, n, r) {
|
|
|
3781
3797
|
const h = d.split(`
|
|
3782
3798
|
`).map((m) => m ? e.indent(m) : e.indent("")).join(`
|
|
3783
3799
|
`);
|
|
3784
|
-
|
|
3800
|
+
c += l.type === "paragraph" ? `
|
|
3785
3801
|
|
|
3786
3802
|
${h}` : `
|
|
3787
3803
|
${h}`;
|
|
3788
3804
|
}
|
|
3789
|
-
}),
|
|
3805
|
+
}), c;
|
|
3790
3806
|
}
|
|
3791
3807
|
function to(t, e, n = {}) {
|
|
3792
3808
|
const { state: r } = e, { doc: o, tr: s } = r, i = t;
|
|
3793
|
-
o.descendants((
|
|
3794
|
-
const l = s.mapping.map(
|
|
3809
|
+
o.descendants((a, c) => {
|
|
3810
|
+
const l = s.mapping.map(c), f = s.mapping.map(c) + a.nodeSize;
|
|
3795
3811
|
let u = null;
|
|
3796
|
-
if (
|
|
3812
|
+
if (a.marks.forEach((d) => {
|
|
3797
3813
|
if (d !== i)
|
|
3798
3814
|
return !1;
|
|
3799
3815
|
u = d;
|
|
@@ -3811,7 +3827,7 @@ function to(t, e, n = {}) {
|
|
|
3811
3827
|
}
|
|
3812
3828
|
}), s.docChanged && e.view.dispatch(s);
|
|
3813
3829
|
}
|
|
3814
|
-
var
|
|
3830
|
+
var Mo = class be extends Et {
|
|
3815
3831
|
constructor() {
|
|
3816
3832
|
super(...arguments), this.type = "node";
|
|
3817
3833
|
}
|
|
@@ -3831,20 +3847,20 @@ var xo = class be extends Et {
|
|
|
3831
3847
|
return super.extend(n);
|
|
3832
3848
|
}
|
|
3833
3849
|
};
|
|
3834
|
-
function
|
|
3835
|
-
return new
|
|
3850
|
+
function xo(t) {
|
|
3851
|
+
return new Dr({
|
|
3836
3852
|
find: t.find,
|
|
3837
3853
|
handler: ({ state: e, range: n, match: r, pasteEvent: o }) => {
|
|
3838
|
-
const s =
|
|
3854
|
+
const s = x(t.getAttributes, void 0, r, o);
|
|
3839
3855
|
if (s === !1 || s === null)
|
|
3840
3856
|
return null;
|
|
3841
|
-
const { tr: i } = e,
|
|
3857
|
+
const { tr: i } = e, a = r[r.length - 1], c = r[0];
|
|
3842
3858
|
let l = n.to;
|
|
3843
|
-
if (
|
|
3844
|
-
const f =
|
|
3859
|
+
if (a) {
|
|
3860
|
+
const f = c.search(/\S/), u = n.from + c.indexOf(a), p = u + a.length;
|
|
3845
3861
|
if (ee(n.from, n.to, e.doc).filter((m) => m.mark.type.excluded.find((v) => v === t.type && v !== m.mark.type)).filter((m) => m.to > u).length)
|
|
3846
3862
|
return null;
|
|
3847
|
-
p < n.to && i.delete(p, n.to), u > n.from && i.delete(n.from + f, u), l = n.from + f +
|
|
3863
|
+
p < n.to && i.delete(p, n.to), u > n.from && i.delete(n.from + f, u), l = n.from + f + a.length, i.addMark(n.from + f, l, t.type.create(s || {})), r.index !== void 0 && r.input !== void 0 && r.index + r[0].length >= r.input.length || i.removeStoredMark(t.type);
|
|
3848
3864
|
}
|
|
3849
3865
|
}
|
|
3850
3866
|
});
|
|
@@ -3853,14 +3869,14 @@ export {
|
|
|
3853
3869
|
at as CommandManager,
|
|
3854
3870
|
go as Editor,
|
|
3855
3871
|
Et as Extendable,
|
|
3856
|
-
|
|
3872
|
+
j as Extension,
|
|
3857
3873
|
dt as InputRule,
|
|
3858
3874
|
ne as MappablePosition,
|
|
3859
|
-
|
|
3860
|
-
|
|
3875
|
+
jr as Mark,
|
|
3876
|
+
Mo as Node,
|
|
3861
3877
|
Hr as NodePos,
|
|
3862
|
-
|
|
3863
|
-
|
|
3878
|
+
Dr as PasteRule,
|
|
3879
|
+
x as callOrReturn,
|
|
3864
3880
|
wo as canInsertNode,
|
|
3865
3881
|
Un as combineTransactionSteps,
|
|
3866
3882
|
Vt as commands,
|
|
@@ -3880,7 +3896,7 @@ export {
|
|
|
3880
3896
|
Yn as findDuplicates,
|
|
3881
3897
|
lt as findParentNode,
|
|
3882
3898
|
Jn as findParentNodeClosestToPos,
|
|
3883
|
-
|
|
3899
|
+
Mt as flattenExtensions,
|
|
3884
3900
|
Gn as fromString,
|
|
3885
3901
|
lo as generateHTML,
|
|
3886
3902
|
uo as generateJSON,
|
|
@@ -3891,7 +3907,7 @@ export {
|
|
|
3891
3907
|
ut as getHTMLFromFragment,
|
|
3892
3908
|
Kt as getMarkAttributes,
|
|
3893
3909
|
wt as getMarkRange,
|
|
3894
|
-
|
|
3910
|
+
B as getMarkType,
|
|
3895
3911
|
ee as getMarksBetween,
|
|
3896
3912
|
fo as getNodeAtPosition,
|
|
3897
3913
|
tr as getNodeAttributes,
|
|
@@ -3907,14 +3923,14 @@ export {
|
|
|
3907
3923
|
sr as getTextContentFromNodes,
|
|
3908
3924
|
te as getTextSerializersFromSchema,
|
|
3909
3925
|
ar as getUpdatedPosition,
|
|
3910
|
-
|
|
3911
|
-
|
|
3926
|
+
Ot as injectExtensionAttributesToParseRule,
|
|
3927
|
+
Rr as inputRulesPlugin,
|
|
3912
3928
|
ir as isActive,
|
|
3913
3929
|
Nt as isAndroid,
|
|
3914
3930
|
po as isAtEndOfNode,
|
|
3915
3931
|
mo as isAtStartOfNode,
|
|
3916
3932
|
Kn as isEmptyObject,
|
|
3917
|
-
|
|
3933
|
+
Dt as isExtensionRulesEnabled,
|
|
3918
3934
|
Qt as isFunction,
|
|
3919
3935
|
pt as isList,
|
|
3920
3936
|
Jt as isMacOS,
|
|
@@ -3922,14 +3938,14 @@ export {
|
|
|
3922
3938
|
Q as isNodeActive,
|
|
3923
3939
|
St as isNodeEmpty,
|
|
3924
3940
|
ho as isNodeSelection,
|
|
3925
|
-
|
|
3941
|
+
Br as isNumber,
|
|
3926
3942
|
G as isPlainObject,
|
|
3927
3943
|
kt as isRegExp,
|
|
3928
3944
|
hn as isSafari,
|
|
3929
3945
|
Wt as isTextSelection,
|
|
3930
3946
|
rt as isiOS,
|
|
3931
3947
|
vo as markInputRule,
|
|
3932
|
-
|
|
3948
|
+
xo as markPasteRule,
|
|
3933
3949
|
qr as markdown,
|
|
3934
3950
|
Zn as mergeAttributes,
|
|
3935
3951
|
oe as mergeDeep,
|
|
@@ -3941,7 +3957,7 @@ export {
|
|
|
3941
3957
|
Fr as pasteRulesPlugin,
|
|
3942
3958
|
nr as removeDuplicates,
|
|
3943
3959
|
Xr as renderNestedMarkdownContent,
|
|
3944
|
-
|
|
3960
|
+
xt as resolveExtensions,
|
|
3945
3961
|
Ut as resolveFocusPosition,
|
|
3946
3962
|
yn as selectionToInsertionEnd,
|
|
3947
3963
|
At as serializeAttributes,
|