reactjs-tiptap-editor 0.2.21 → 0.2.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/RichTextEditor-CIhslsGV.cjs +141 -0
- package/lib/{RichTextEditor-aaUynZc2.js → RichTextEditor-C_dIT2FZ.js} +1582 -1556
- package/lib/extension-bundle.cjs +3 -3
- package/lib/extension-bundle.d.cts +88 -84
- package/lib/extension-bundle.d.ts +88 -84
- package/lib/extension-bundle.js +1275 -1217
- package/lib/{index-8id9bPv5.js → index-BlV5SJJW.js} +28 -42
- package/lib/index-CJ6Hb9MN.cjs +1 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.cts +133 -84
- package/lib/index.d.ts +133 -84
- package/lib/index.js +2 -2
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.d.cts +86 -77
- package/lib/locale-bundle.d.ts +86 -77
- package/lib/locale-bundle.js +1 -1
- package/lib/style.css +1 -1
- package/lib/{tiptap-BV9BUpUC.js → tiptap-CXio79KB.js} +621 -768
- package/lib/tiptap-Dq62HiQ9.cjs +113 -0
- package/lib/vendor-DdwtMmSr.cjs +302 -0
- package/lib/{vendor-DyAqAGVt.js → vendor-VlEklMUJ.js} +15128 -11919
- package/package.json +23 -24
- package/lib/RichTextEditor-DAqU7JiB.cjs +0 -141
- package/lib/index-CYg22iLG.cjs +0 -1
- package/lib/tiptap-Ufn12SjW.cjs +0 -116
- package/lib/vendor-CRmKyn1B.cjs +0 -264
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { E as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import Je from "tippy.js";
|
|
2
|
+
import { E as Ye, a as Xe, P as H, b as I, S as Z, k as Qe, T as D, D as Ze, c as we, F as V, N as tn, d as xt, w as en, e as nn, f as rn, g as dt, h as tt, s as sn, i as Zt, j as on, l as an, m as ln, n as cn, o as dn, A as un, p as pn, q as hn, r as fn, t as mn, u as gn, v as yn, x as vn, y as Ee, z as bn, B as Mn, C as Sn, G as kn, H as wn, I as En, J as Tn, K as Ft, R as Cn, L as xn, M as An, O as On, Q as te, U as Ln, V as Te, W as _n, X as Pn, Y as Rn, Z as Hn, _ as $n, $ as pt, a0 as zt, a1 as In, a2 as Dn, a3 as Nn, a4 as Ce, a5 as Bn, a6 as ee, a7 as jn, a8 as ne, a9 as re, aa as Fn, ab as se, ac as zn, ad as Vn, ae as Wn, af as Kn, ag as Un, ah as qn, ai as Gn } from "./vendor-VlEklMUJ.js";
|
|
3
|
+
import L, { useRef as Jn, useState as Vt, useDebugValue as xe, useEffect as Wt, forwardRef as Yn, useLayoutEffect as Xn, useContext as Ae, createContext as Oe } from "react";
|
|
4
|
+
import Qn, { flushSync as Zn } from "react-dom";
|
|
5
5
|
function gt(e) {
|
|
6
6
|
const { state: t, transaction: n } = e;
|
|
7
7
|
let { selection: r } = n, { doc: s } = n, { storedMarks: o } = n;
|
|
@@ -87,7 +87,7 @@ class yt {
|
|
|
87
87
|
return a;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
class
|
|
90
|
+
class tr {
|
|
91
91
|
constructor() {
|
|
92
92
|
this.callbacks = {};
|
|
93
93
|
}
|
|
@@ -126,7 +126,7 @@ function vt(e) {
|
|
|
126
126
|
markExtensions: r
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function Le(e) {
|
|
130
130
|
const t = [], { nodeExtensions: n, markExtensions: r } = vt(e), s = [...n, ...r], o = {
|
|
131
131
|
default: null,
|
|
132
132
|
rendered: !0,
|
|
@@ -218,19 +218,19 @@ function ht(e, t) {
|
|
|
218
218
|
[n.name]: e.attrs[n.name]
|
|
219
219
|
}).reduce((n, r) => C(n, r), {});
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function _e(e) {
|
|
222
222
|
return typeof e == "function";
|
|
223
223
|
}
|
|
224
224
|
function E(e, t = void 0, ...n) {
|
|
225
|
-
return
|
|
225
|
+
return _e(e) ? t ? e.bind(t)(...n) : e(...n) : e;
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function er(e = {}) {
|
|
228
228
|
return Object.keys(e).length === 0 && e.constructor === Object;
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function nr(e) {
|
|
231
231
|
return typeof e != "string" ? e : e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" ? !0 : e === "false" ? !1 : e;
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function oe(e, t) {
|
|
234
234
|
return "style" in e ? e : {
|
|
235
235
|
...e,
|
|
236
236
|
getAttrs: (n) => {
|
|
@@ -238,7 +238,7 @@ function ie(e, t) {
|
|
|
238
238
|
if (r === !1)
|
|
239
239
|
return !1;
|
|
240
240
|
const s = t.reduce((o, i) => {
|
|
241
|
-
const a = i.attribute.parseHTML ? i.attribute.parseHTML(n) :
|
|
241
|
+
const a = i.attribute.parseHTML ? i.attribute.parseHTML(n) : nr(n.getAttribute(i.name));
|
|
242
242
|
return a == null ? o : {
|
|
243
243
|
...o,
|
|
244
244
|
[i.name]: a
|
|
@@ -248,15 +248,15 @@ function ie(e, t) {
|
|
|
248
248
|
}
|
|
249
249
|
};
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function ie(e) {
|
|
252
252
|
return Object.fromEntries(
|
|
253
253
|
// @ts-ignore
|
|
254
|
-
Object.entries(e).filter(([t, n]) => t === "attrs" &&
|
|
254
|
+
Object.entries(e).filter(([t, n]) => t === "attrs" && er(n) ? !1 : n != null)
|
|
255
255
|
);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function rr(e, t) {
|
|
258
258
|
var n;
|
|
259
|
-
const r =
|
|
259
|
+
const r = Le(e), { nodeExtensions: s, markExtensions: o } = vt(e), i = (n = s.find((l) => S(l, "topNode"))) === null || n === void 0 ? void 0 : n.name, a = Object.fromEntries(s.map((l) => {
|
|
260
260
|
const u = r.filter((y) => y.type === l.name), d = {
|
|
261
261
|
name: l.name,
|
|
262
262
|
options: l.options,
|
|
@@ -268,7 +268,7 @@ function or(e, t) {
|
|
|
268
268
|
...y,
|
|
269
269
|
...v ? v(l) : {}
|
|
270
270
|
};
|
|
271
|
-
}, {}), h =
|
|
271
|
+
}, {}), h = ie({
|
|
272
272
|
...p,
|
|
273
273
|
content: E(S(l, "content", d)),
|
|
274
274
|
marks: E(S(l, "marks", d)),
|
|
@@ -287,7 +287,7 @@ function or(e, t) {
|
|
|
287
287
|
return [y.name, { default: (M = y == null ? void 0 : y.attribute) === null || M === void 0 ? void 0 : M.default }];
|
|
288
288
|
}))
|
|
289
289
|
}), m = E(S(l, "parseHTML", d));
|
|
290
|
-
m && (h.parseDOM = m.map((y) =>
|
|
290
|
+
m && (h.parseDOM = m.map((y) => oe(y, u)));
|
|
291
291
|
const f = S(l, "renderHTML", d);
|
|
292
292
|
f && (h.toDOM = (y) => f({
|
|
293
293
|
node: y,
|
|
@@ -307,7 +307,7 @@ function or(e, t) {
|
|
|
307
307
|
...g,
|
|
308
308
|
...M ? M(l) : {}
|
|
309
309
|
};
|
|
310
|
-
}, {}), h =
|
|
310
|
+
}, {}), h = ie({
|
|
311
311
|
...p,
|
|
312
312
|
inclusive: E(S(l, "inclusive", d)),
|
|
313
313
|
excludes: E(S(l, "excludes", d)),
|
|
@@ -319,14 +319,14 @@ function or(e, t) {
|
|
|
319
319
|
return [g.name, { default: (y = g == null ? void 0 : g.attribute) === null || y === void 0 ? void 0 : y.default }];
|
|
320
320
|
}))
|
|
321
321
|
}), m = E(S(l, "parseHTML", d));
|
|
322
|
-
m && (h.parseDOM = m.map((g) =>
|
|
322
|
+
m && (h.parseDOM = m.map((g) => oe(g, u)));
|
|
323
323
|
const f = S(l, "renderHTML", d);
|
|
324
324
|
return f && (h.toDOM = (g) => f({
|
|
325
325
|
mark: g,
|
|
326
326
|
HTMLAttributes: ht(g, u)
|
|
327
327
|
})), [l.name, h];
|
|
328
328
|
}));
|
|
329
|
-
return new
|
|
329
|
+
return new we({
|
|
330
330
|
topNode: i,
|
|
331
331
|
nodes: a,
|
|
332
332
|
marks: c
|
|
@@ -335,14 +335,14 @@ function or(e, t) {
|
|
|
335
335
|
function At(e, t) {
|
|
336
336
|
return t.nodes[e] || t.marks[e] || null;
|
|
337
337
|
}
|
|
338
|
-
function
|
|
338
|
+
function ae(e, t) {
|
|
339
339
|
return Array.isArray(t) ? t.some((n) => (typeof n == "string" ? n : n.name) === e.name) : t;
|
|
340
340
|
}
|
|
341
|
-
function
|
|
342
|
-
const n =
|
|
341
|
+
function Kt(e, t) {
|
|
342
|
+
const n = Ze.fromSchema(t).serializeFragment(e), s = document.implementation.createHTMLDocument().createElement("div");
|
|
343
343
|
return s.appendChild(n), s.innerHTML;
|
|
344
344
|
}
|
|
345
|
-
const
|
|
345
|
+
const sr = (e, t = 500) => {
|
|
346
346
|
let n = "";
|
|
347
347
|
const r = e.parentOffset;
|
|
348
348
|
return e.parent.nodesBetween(Math.max(0, r - t), r, (s, o, i, a) => {
|
|
@@ -356,7 +356,7 @@ const ir = (e, t = 500) => {
|
|
|
356
356
|
n += s.isAtom && !s.isText ? u : u.slice(0, Math.max(0, r - o));
|
|
357
357
|
}), n;
|
|
358
358
|
};
|
|
359
|
-
function
|
|
359
|
+
function Ut(e) {
|
|
360
360
|
return Object.prototype.toString.call(e) === "[object RegExp]";
|
|
361
361
|
}
|
|
362
362
|
class bt {
|
|
@@ -364,8 +364,8 @@ class bt {
|
|
|
364
364
|
this.find = t.find, this.handler = t.handler;
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
|
-
const
|
|
368
|
-
if (
|
|
367
|
+
const or = (e, t) => {
|
|
368
|
+
if (Ut(t))
|
|
369
369
|
return t.exec(e);
|
|
370
370
|
const n = t(e);
|
|
371
371
|
if (!n)
|
|
@@ -385,11 +385,11 @@ function ot(e) {
|
|
|
385
385
|
)
|
|
386
386
|
return !1;
|
|
387
387
|
let u = !1;
|
|
388
|
-
const d =
|
|
388
|
+
const d = sr(l) + o;
|
|
389
389
|
return i.forEach((p) => {
|
|
390
390
|
if (u)
|
|
391
391
|
return;
|
|
392
|
-
const h =
|
|
392
|
+
const h = or(d, p.find);
|
|
393
393
|
if (!h)
|
|
394
394
|
return;
|
|
395
395
|
const m = c.state.tr, f = gt({
|
|
@@ -417,7 +417,7 @@ function ot(e) {
|
|
|
417
417
|
}), c.dispatch(m), u = !0);
|
|
418
418
|
}), u;
|
|
419
419
|
}
|
|
420
|
-
function
|
|
420
|
+
function ir(e) {
|
|
421
421
|
const { editor: t, rules: n } = e, r = new H({
|
|
422
422
|
state: {
|
|
423
423
|
init() {
|
|
@@ -430,7 +430,7 @@ function lr(e) {
|
|
|
430
430
|
const c = s.getMeta("applyInputRules");
|
|
431
431
|
return !!c && setTimeout(() => {
|
|
432
432
|
let { text: u } = c;
|
|
433
|
-
typeof u == "string" ? u = u : u =
|
|
433
|
+
typeof u == "string" ? u = u : u = Kt(V.from(u), i.schema);
|
|
434
434
|
const { from: d } = c, p = d + u.length;
|
|
435
435
|
ot({
|
|
436
436
|
editor: t,
|
|
@@ -489,11 +489,11 @@ function lr(e) {
|
|
|
489
489
|
});
|
|
490
490
|
return r;
|
|
491
491
|
}
|
|
492
|
-
function
|
|
492
|
+
function ar(e) {
|
|
493
493
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
494
494
|
}
|
|
495
495
|
function it(e) {
|
|
496
|
-
return
|
|
496
|
+
return ar(e) !== "Object" ? !1 : e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
|
|
497
497
|
}
|
|
498
498
|
function Mt(e, t) {
|
|
499
499
|
const n = { ...e };
|
|
@@ -547,16 +547,16 @@ class N {
|
|
|
547
547
|
return !1;
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
|
-
function
|
|
550
|
+
function lr(e) {
|
|
551
551
|
return typeof e == "number";
|
|
552
552
|
}
|
|
553
|
-
class
|
|
553
|
+
class Pe {
|
|
554
554
|
constructor(t) {
|
|
555
555
|
this.find = t.find, this.handler = t.handler;
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
|
-
const
|
|
559
|
-
if (
|
|
558
|
+
const cr = (e, t, n) => {
|
|
559
|
+
if (Ut(t))
|
|
560
560
|
return [...e.matchAll(t)];
|
|
561
561
|
const r = t(e, n);
|
|
562
562
|
return r ? r.map((s) => {
|
|
@@ -564,7 +564,7 @@ const ur = (e, t, n) => {
|
|
|
564
564
|
return o.index = s.index, o.input = e, o.data = s.data, s.replaceWith && (s.text.includes(s.replaceWith) || console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'), o.push(s.replaceWith)), o;
|
|
565
565
|
}) : [];
|
|
566
566
|
};
|
|
567
|
-
function
|
|
567
|
+
function dr(e) {
|
|
568
568
|
const { editor: t, state: n, from: r, to: s, rule: o, pasteEvent: i, dropEvent: a } = e, { commands: c, chain: l, can: u } = new yt({
|
|
569
569
|
editor: t,
|
|
570
570
|
state: n
|
|
@@ -573,7 +573,7 @@ function pr(e) {
|
|
|
573
573
|
if (!h.isTextblock || h.type.spec.code)
|
|
574
574
|
return;
|
|
575
575
|
const f = Math.max(r, m), g = Math.min(s, m + h.content.size), y = h.textBetween(f - m, g - m, void 0, "");
|
|
576
|
-
|
|
576
|
+
cr(y, o.find, i).forEach((v) => {
|
|
577
577
|
if (v.index === void 0)
|
|
578
578
|
return;
|
|
579
579
|
const b = f + v.index + 1, w = b + v[0].length, k = {
|
|
@@ -594,14 +594,14 @@ function pr(e) {
|
|
|
594
594
|
}), d.every((h) => h !== null);
|
|
595
595
|
}
|
|
596
596
|
let at = null;
|
|
597
|
-
const
|
|
597
|
+
const ur = (e) => {
|
|
598
598
|
var t;
|
|
599
599
|
const n = new ClipboardEvent("paste", {
|
|
600
600
|
clipboardData: new DataTransfer()
|
|
601
601
|
});
|
|
602
602
|
return (t = n.clipboardData) === null || t === void 0 || t.setData("text/html", e), n;
|
|
603
603
|
};
|
|
604
|
-
function
|
|
604
|
+
function pr(e) {
|
|
605
605
|
const { editor: t, rules: n } = e;
|
|
606
606
|
let r = null, s = !1, o = !1, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, a;
|
|
607
607
|
try {
|
|
@@ -614,7 +614,7 @@ function fr(e) {
|
|
|
614
614
|
state: u,
|
|
615
615
|
transaction: f
|
|
616
616
|
});
|
|
617
|
-
if (!(!
|
|
617
|
+
if (!(!dr({
|
|
618
618
|
editor: t,
|
|
619
619
|
state: g,
|
|
620
620
|
from: Math.max(d - 1, 0),
|
|
@@ -671,8 +671,8 @@ function fr(e) {
|
|
|
671
671
|
return;
|
|
672
672
|
if (M) {
|
|
673
673
|
let { text: w } = y;
|
|
674
|
-
typeof w == "string" ? w = w : w =
|
|
675
|
-
const { from: k } = y, T = k + w.length, x =
|
|
674
|
+
typeof w == "string" ? w = w : w = Kt(V.from(w), h.schema);
|
|
675
|
+
const { from: k } = y, T = k + w.length, x = ur(w);
|
|
676
676
|
return c({
|
|
677
677
|
rule: u,
|
|
678
678
|
state: h,
|
|
@@ -682,7 +682,7 @@ function fr(e) {
|
|
|
682
682
|
});
|
|
683
683
|
}
|
|
684
684
|
const v = p.doc.content.findDiffStart(h.doc.content), b = p.doc.content.findDiffEnd(h.doc.content);
|
|
685
|
-
if (!(!
|
|
685
|
+
if (!(!lr(v) || !b || v === b.b))
|
|
686
686
|
return c({
|
|
687
687
|
rule: u,
|
|
688
688
|
state: h,
|
|
@@ -693,13 +693,13 @@ function fr(e) {
|
|
|
693
693
|
}
|
|
694
694
|
}));
|
|
695
695
|
}
|
|
696
|
-
function
|
|
696
|
+
function hr(e) {
|
|
697
697
|
const t = e.filter((n, r) => e.indexOf(n) !== r);
|
|
698
698
|
return Array.from(new Set(t));
|
|
699
699
|
}
|
|
700
|
-
class
|
|
700
|
+
class Q {
|
|
701
701
|
constructor(t, n) {
|
|
702
|
-
this.splittableMarks = [], this.editor = n, this.extensions =
|
|
702
|
+
this.splittableMarks = [], this.editor = n, this.extensions = Q.resolve(t), this.schema = rr(this.extensions, n), this.setupExtensions();
|
|
703
703
|
}
|
|
704
704
|
/**
|
|
705
705
|
* Returns a flattened and sorted extension list while
|
|
@@ -708,7 +708,7 @@ class Z {
|
|
|
708
708
|
* @returns An flattened and sorted array of Tiptap extensions
|
|
709
709
|
*/
|
|
710
710
|
static resolve(t) {
|
|
711
|
-
const n =
|
|
711
|
+
const n = Q.sort(Q.flatten(t)), r = hr(n.map((s) => s.name));
|
|
712
712
|
return r.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map((s) => `'${s}'`).join(", ")}]. This can lead to issues.`), n;
|
|
713
713
|
}
|
|
714
714
|
/**
|
|
@@ -761,7 +761,7 @@ class Z {
|
|
|
761
761
|
* @returns An array of Prosemirror plugins
|
|
762
762
|
*/
|
|
763
763
|
get plugins() {
|
|
764
|
-
const { editor: t } = this, n =
|
|
764
|
+
const { editor: t } = this, n = Q.sort([...this.extensions].reverse()), r = [], s = [], o = n.map((i) => {
|
|
765
765
|
const a = {
|
|
766
766
|
name: i.name,
|
|
767
767
|
options: i.options,
|
|
@@ -774,12 +774,12 @@ class Z {
|
|
|
774
774
|
const f = Object.fromEntries(Object.entries(l()).map(([g, y]) => [g, () => y({ editor: t })]));
|
|
775
775
|
u = { ...u, ...f };
|
|
776
776
|
}
|
|
777
|
-
const d =
|
|
777
|
+
const d = Qe(u);
|
|
778
778
|
c.push(d);
|
|
779
779
|
const p = S(i, "addInputRules", a);
|
|
780
|
-
|
|
780
|
+
ae(i, t.options.enableInputRules) && p && r.push(...p());
|
|
781
781
|
const h = S(i, "addPasteRules", a);
|
|
782
|
-
|
|
782
|
+
ae(i, t.options.enablePasteRules) && h && s.push(...h());
|
|
783
783
|
const m = S(i, "addProseMirrorPlugins", a);
|
|
784
784
|
if (m) {
|
|
785
785
|
const f = m();
|
|
@@ -788,11 +788,11 @@ class Z {
|
|
|
788
788
|
return c;
|
|
789
789
|
}).flat();
|
|
790
790
|
return [
|
|
791
|
-
|
|
791
|
+
ir({
|
|
792
792
|
editor: t,
|
|
793
793
|
rules: r
|
|
794
794
|
}),
|
|
795
|
-
...
|
|
795
|
+
...pr({
|
|
796
796
|
editor: t,
|
|
797
797
|
rules: s
|
|
798
798
|
}),
|
|
@@ -804,7 +804,7 @@ class Z {
|
|
|
804
804
|
* @returns An array of attributes
|
|
805
805
|
*/
|
|
806
806
|
get attributes() {
|
|
807
|
-
return
|
|
807
|
+
return Le(this.extensions);
|
|
808
808
|
}
|
|
809
809
|
/**
|
|
810
810
|
* Get all node views from the extensions.
|
|
@@ -861,7 +861,7 @@ class Z {
|
|
|
861
861
|
});
|
|
862
862
|
}
|
|
863
863
|
}
|
|
864
|
-
class
|
|
864
|
+
class _ {
|
|
865
865
|
constructor(t = {}) {
|
|
866
866
|
this.type = "extension", this.name = "extension", this.parent = null, this.child = null, this.config = {
|
|
867
867
|
name: this.name,
|
|
@@ -877,7 +877,7 @@ class P {
|
|
|
877
877
|
})) || {};
|
|
878
878
|
}
|
|
879
879
|
static create(t = {}) {
|
|
880
|
-
return new
|
|
880
|
+
return new _(t);
|
|
881
881
|
}
|
|
882
882
|
configure(t = {}) {
|
|
883
883
|
const n = this.extend({
|
|
@@ -887,7 +887,7 @@ class P {
|
|
|
887
887
|
return n.name = this.name, n.parent = this.parent, n;
|
|
888
888
|
}
|
|
889
889
|
extend(t = {}) {
|
|
890
|
-
const n = new
|
|
890
|
+
const n = new _({ ...this.config, ...t });
|
|
891
891
|
return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = E(S(n, "addOptions", {
|
|
892
892
|
name: n.name
|
|
893
893
|
})), n.storage = E(S(n, "addStorage", {
|
|
@@ -896,7 +896,7 @@ class P {
|
|
|
896
896
|
})), n;
|
|
897
897
|
}
|
|
898
898
|
}
|
|
899
|
-
function
|
|
899
|
+
function Re(e, t, n) {
|
|
900
900
|
const { from: r, to: s } = t, { blockSeparator: o = `
|
|
901
901
|
|
|
902
902
|
`, textSerializers: i = {} } = n || {};
|
|
@@ -916,10 +916,10 @@ function He(e, t, n) {
|
|
|
916
916
|
c.isText && (a += (p = c == null ? void 0 : c.text) === null || p === void 0 ? void 0 : p.slice(Math.max(r, l) - l, s - l));
|
|
917
917
|
}), a;
|
|
918
918
|
}
|
|
919
|
-
function
|
|
919
|
+
function He(e) {
|
|
920
920
|
return Object.fromEntries(Object.entries(e.nodes).filter(([, t]) => t.spec.toText).map(([t, n]) => [t, n.spec.toText]));
|
|
921
921
|
}
|
|
922
|
-
const
|
|
922
|
+
const fr = _.create({
|
|
923
923
|
name: "clipboardTextSerializer",
|
|
924
924
|
addOptions() {
|
|
925
925
|
return {
|
|
@@ -929,11 +929,11 @@ const gr = P.create({
|
|
|
929
929
|
addProseMirrorPlugins() {
|
|
930
930
|
return [
|
|
931
931
|
new H({
|
|
932
|
-
key: new
|
|
932
|
+
key: new I("clipboardTextSerializer"),
|
|
933
933
|
props: {
|
|
934
934
|
clipboardTextSerializer: () => {
|
|
935
|
-
const { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: s } = t, { ranges: o } = s, i = Math.min(...o.map((u) => u.$from.pos)), a = Math.max(...o.map((u) => u.$to.pos)), c =
|
|
936
|
-
return
|
|
935
|
+
const { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: s } = t, { ranges: o } = s, i = Math.min(...o.map((u) => u.$from.pos)), a = Math.max(...o.map((u) => u.$to.pos)), c = He(n);
|
|
936
|
+
return Re(r, { from: i, to: a }, {
|
|
937
937
|
...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
|
|
938
938
|
textSerializers: c
|
|
939
939
|
});
|
|
@@ -942,10 +942,10 @@ const gr = P.create({
|
|
|
942
942
|
})
|
|
943
943
|
];
|
|
944
944
|
}
|
|
945
|
-
}),
|
|
945
|
+
}), mr = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
|
|
946
946
|
var n;
|
|
947
947
|
e.isDestroyed || (t.dom.blur(), (n = window == null ? void 0 : window.getSelection()) === null || n === void 0 || n.removeAllRanges());
|
|
948
|
-
}), !0),
|
|
948
|
+
}), !0), gr = (e = !1) => ({ commands: t }) => t.setContent("", e), yr = () => ({ state: e, tr: t, dispatch: n }) => {
|
|
949
949
|
const { selection: r } = t, { ranges: s } = r;
|
|
950
950
|
return n && s.forEach(({ $from: o, $to: i }) => {
|
|
951
951
|
e.doc.nodesBetween(o.pos, i.pos, (a, c) => {
|
|
@@ -954,7 +954,7 @@ const gr = P.create({
|
|
|
954
954
|
const { doc: l, mapping: u } = t, d = l.resolve(u.map(c)), p = l.resolve(u.map(c + a.nodeSize)), h = d.blockRange(p);
|
|
955
955
|
if (!h)
|
|
956
956
|
return;
|
|
957
|
-
const m =
|
|
957
|
+
const m = Tn(h);
|
|
958
958
|
if (a.type.isTextblock) {
|
|
959
959
|
const { defaultType: f } = d.parent.contentMatchAt(d.index());
|
|
960
960
|
t.setNodeMarkup(h.start, f);
|
|
@@ -962,12 +962,12 @@ const gr = P.create({
|
|
|
962
962
|
(m || m === 0) && t.lift(h, m);
|
|
963
963
|
});
|
|
964
964
|
}), !0;
|
|
965
|
-
},
|
|
965
|
+
}, vr = (e) => (t) => e(t), br = () => ({ state: e, dispatch: t }) => En(e, t), Mr = (e, t) => ({ editor: n, tr: r }) => {
|
|
966
966
|
const { state: s } = n, o = s.doc.slice(e.from, e.to);
|
|
967
967
|
r.deleteRange(e.from, e.to);
|
|
968
968
|
const i = r.mapping.map(t);
|
|
969
969
|
return r.insert(i, o.content), r.setSelection(new D(r.doc.resolve(i - 1))), !0;
|
|
970
|
-
},
|
|
970
|
+
}, Sr = () => ({ tr: e, dispatch: t }) => {
|
|
971
971
|
const { selection: n } = e, r = n.$anchor.node();
|
|
972
972
|
if (r.content.size > 0)
|
|
973
973
|
return !1;
|
|
@@ -981,7 +981,7 @@ const gr = P.create({
|
|
|
981
981
|
return !0;
|
|
982
982
|
}
|
|
983
983
|
return !1;
|
|
984
|
-
},
|
|
984
|
+
}, kr = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
985
985
|
const s = R(e, n.schema), o = t.selection.$anchor;
|
|
986
986
|
for (let i = o.depth; i > 0; i -= 1)
|
|
987
987
|
if (o.node(i).type === s) {
|
|
@@ -992,35 +992,35 @@ const gr = P.create({
|
|
|
992
992
|
return !0;
|
|
993
993
|
}
|
|
994
994
|
return !1;
|
|
995
|
-
},
|
|
995
|
+
}, wr = (e) => ({ tr: t, dispatch: n }) => {
|
|
996
996
|
const { from: r, to: s } = e;
|
|
997
997
|
return n && t.delete(r, s), !0;
|
|
998
|
-
},
|
|
998
|
+
}, Er = () => ({ state: e, dispatch: t }) => wn(e, t), Tr = () => ({ commands: e }) => e.keyboardShortcut("Enter"), Cr = () => ({ state: e, dispatch: t }) => kn(e, t);
|
|
999
999
|
function ft(e, t, n = { strict: !0 }) {
|
|
1000
1000
|
const r = Object.keys(t);
|
|
1001
|
-
return r.length ? r.every((s) => n.strict ? t[s] === e[s] :
|
|
1001
|
+
return r.length ? r.every((s) => n.strict ? t[s] === e[s] : Ut(t[s]) ? t[s].test(e[s]) : t[s] === e[s]) : !0;
|
|
1002
1002
|
}
|
|
1003
|
-
function
|
|
1003
|
+
function $e(e, t, n = {}) {
|
|
1004
1004
|
return e.find((r) => r.type === t && ft(
|
|
1005
1005
|
// Only check equality for the attributes that are provided
|
|
1006
1006
|
Object.fromEntries(Object.keys(n).map((s) => [s, r.attrs[s]])),
|
|
1007
1007
|
n
|
|
1008
1008
|
));
|
|
1009
1009
|
}
|
|
1010
|
-
function
|
|
1011
|
-
return
|
|
1010
|
+
function le(e, t, n = {}) {
|
|
1011
|
+
return !!$e(e, t, n);
|
|
1012
1012
|
}
|
|
1013
|
-
function
|
|
1013
|
+
function qt(e, t, n) {
|
|
1014
1014
|
var r;
|
|
1015
1015
|
if (!e || !t)
|
|
1016
1016
|
return;
|
|
1017
1017
|
let s = e.parent.childAfter(e.parentOffset);
|
|
1018
|
-
if ((!s.node || !s.node.marks.some((u) => u.type === t)) && (s = e.parent.childBefore(e.parentOffset)), !s.node || !s.node.marks.some((u) => u.type === t) || (n = n || ((r = s.node.marks[0]) === null || r === void 0 ? void 0 : r.attrs),
|
|
1018
|
+
if ((!s.node || !s.node.marks.some((u) => u.type === t)) && (s = e.parent.childBefore(e.parentOffset)), !s.node || !s.node.marks.some((u) => u.type === t) || (n = n || ((r = s.node.marks[0]) === null || r === void 0 ? void 0 : r.attrs), !$e([...s.node.marks], t, n)))
|
|
1019
1019
|
return;
|
|
1020
1020
|
let i = s.index, a = e.start() + s.offset, c = i + 1, l = a + s.node.nodeSize;
|
|
1021
|
-
for (; i > 0 &&
|
|
1021
|
+
for (; i > 0 && le([...e.parent.child(i - 1).marks], t, n); )
|
|
1022
1022
|
i -= 1, a -= e.parent.child(i).nodeSize;
|
|
1023
|
-
for (; c < e.parent.childCount &&
|
|
1023
|
+
for (; c < e.parent.childCount && le([...e.parent.child(c).marks], t, n); )
|
|
1024
1024
|
l += e.parent.child(c).nodeSize, c += 1;
|
|
1025
1025
|
return {
|
|
1026
1026
|
from: a,
|
|
@@ -1035,33 +1035,33 @@ function K(e, t) {
|
|
|
1035
1035
|
}
|
|
1036
1036
|
return e;
|
|
1037
1037
|
}
|
|
1038
|
-
const
|
|
1038
|
+
const xr = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1039
1039
|
const o = K(e, r.schema), { doc: i, selection: a } = n, { $from: c, from: l, to: u } = a;
|
|
1040
1040
|
if (s) {
|
|
1041
|
-
const d =
|
|
1041
|
+
const d = qt(c, o, t);
|
|
1042
1042
|
if (d && d.from <= l && d.to >= u) {
|
|
1043
1043
|
const p = D.create(i, d.from, d.to);
|
|
1044
1044
|
n.setSelection(p);
|
|
1045
1045
|
}
|
|
1046
1046
|
}
|
|
1047
1047
|
return !0;
|
|
1048
|
-
},
|
|
1048
|
+
}, Ar = (e) => (t) => {
|
|
1049
1049
|
const n = typeof e == "function" ? e(t) : e;
|
|
1050
1050
|
for (let r = 0; r < n.length; r += 1)
|
|
1051
1051
|
if (n[r](t))
|
|
1052
1052
|
return !0;
|
|
1053
1053
|
return !1;
|
|
1054
1054
|
};
|
|
1055
|
-
function
|
|
1055
|
+
function Gt(e) {
|
|
1056
1056
|
return e instanceof D;
|
|
1057
1057
|
}
|
|
1058
1058
|
function F(e = 0, t = 0, n = 0) {
|
|
1059
1059
|
return Math.min(Math.max(e, t), n);
|
|
1060
1060
|
}
|
|
1061
|
-
function
|
|
1061
|
+
function Ie(e, t = null) {
|
|
1062
1062
|
if (!t)
|
|
1063
1063
|
return null;
|
|
1064
|
-
const n =
|
|
1064
|
+
const n = Z.atStart(e), r = Z.atEnd(e);
|
|
1065
1065
|
if (t === "start" || t === !0)
|
|
1066
1066
|
return n;
|
|
1067
1067
|
if (t === "end")
|
|
@@ -1069,7 +1069,7 @@ function De(e, t = null) {
|
|
|
1069
1069
|
const s = n.from, o = r.to;
|
|
1070
1070
|
return t === "all" ? D.create(e, F(0, s, o), F(e.content.size, s, o)) : D.create(e, F(t, s, o), F(t, s, o));
|
|
1071
1071
|
}
|
|
1072
|
-
function
|
|
1072
|
+
function De() {
|
|
1073
1073
|
return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
|
|
1074
1074
|
}
|
|
1075
1075
|
function St() {
|
|
@@ -1082,36 +1082,36 @@ function St() {
|
|
|
1082
1082
|
"iPod"
|
|
1083
1083
|
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
1084
1084
|
}
|
|
1085
|
-
const
|
|
1085
|
+
const Or = (e = null, t = {}) => ({ editor: n, view: r, tr: s, dispatch: o }) => {
|
|
1086
1086
|
t = {
|
|
1087
1087
|
scrollIntoView: !0,
|
|
1088
1088
|
...t
|
|
1089
1089
|
};
|
|
1090
1090
|
const i = () => {
|
|
1091
|
-
(St() ||
|
|
1091
|
+
(St() || De()) && r.dom.focus(), requestAnimationFrame(() => {
|
|
1092
1092
|
n.isDestroyed || (r.focus(), t != null && t.scrollIntoView && n.commands.scrollIntoView());
|
|
1093
1093
|
});
|
|
1094
1094
|
};
|
|
1095
1095
|
if (r.hasFocus() && e === null || e === !1)
|
|
1096
1096
|
return !0;
|
|
1097
|
-
if (o && e === null && !
|
|
1097
|
+
if (o && e === null && !Gt(n.state.selection))
|
|
1098
1098
|
return i(), !0;
|
|
1099
|
-
const a =
|
|
1099
|
+
const a = Ie(s.doc, e) || n.state.selection, c = n.state.selection.eq(a);
|
|
1100
1100
|
return o && (c || s.setSelection(a), c && s.storedMarks && s.setStoredMarks(s.storedMarks), i()), !0;
|
|
1101
|
-
},
|
|
1101
|
+
}, Lr = (e, t) => (n) => e.every((r, s) => t(r, { ...n, index: s })), _r = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({ from: n.selection.from, to: n.selection.to }, e, t), Ne = (e) => {
|
|
1102
1102
|
const t = e.childNodes;
|
|
1103
1103
|
for (let n = t.length - 1; n >= 0; n -= 1) {
|
|
1104
1104
|
const r = t[n];
|
|
1105
|
-
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 &&
|
|
1105
|
+
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Ne(r);
|
|
1106
1106
|
}
|
|
1107
1107
|
return e;
|
|
1108
1108
|
};
|
|
1109
1109
|
function lt(e) {
|
|
1110
1110
|
const t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
|
|
1111
|
-
return
|
|
1111
|
+
return Ne(n);
|
|
1112
1112
|
}
|
|
1113
1113
|
function mt(e, t, n) {
|
|
1114
|
-
if (e instanceof
|
|
1114
|
+
if (e instanceof tn || e instanceof V)
|
|
1115
1115
|
return e;
|
|
1116
1116
|
n = {
|
|
1117
1117
|
slice: !0,
|
|
@@ -1133,7 +1133,7 @@ function mt(e, t, n) {
|
|
|
1133
1133
|
if (s) {
|
|
1134
1134
|
if (n.errorOnInvalidContent) {
|
|
1135
1135
|
let i = !1, a = "";
|
|
1136
|
-
const c = new
|
|
1136
|
+
const c = new we({
|
|
1137
1137
|
topNode: t.spec.topNode,
|
|
1138
1138
|
marks: t.spec.marks,
|
|
1139
1139
|
// Prosemirror's schemas are executed such that: the last to execute, matches last
|
|
@@ -1159,20 +1159,20 @@ function mt(e, t, n) {
|
|
|
1159
1159
|
}
|
|
1160
1160
|
return mt("", t, n);
|
|
1161
1161
|
}
|
|
1162
|
-
function
|
|
1162
|
+
function Pr(e, t, n) {
|
|
1163
1163
|
const r = e.steps.length - 1;
|
|
1164
1164
|
if (r < t)
|
|
1165
1165
|
return;
|
|
1166
1166
|
const s = e.steps[r];
|
|
1167
|
-
if (!(s instanceof
|
|
1167
|
+
if (!(s instanceof Cn || s instanceof xn))
|
|
1168
1168
|
return;
|
|
1169
1169
|
const o = e.mapping.maps[r];
|
|
1170
1170
|
let i = 0;
|
|
1171
1171
|
o.forEach((a, c, l, u) => {
|
|
1172
1172
|
i === 0 && (i = u);
|
|
1173
|
-
}), e.setSelection(
|
|
1173
|
+
}), e.setSelection(Z.near(e.doc.resolve(i), n));
|
|
1174
1174
|
}
|
|
1175
|
-
const
|
|
1175
|
+
const Rr = (e) => !("type" in e), Hr = (e, t, n) => ({ tr: r, dispatch: s, editor: o }) => {
|
|
1176
1176
|
var i;
|
|
1177
1177
|
if (s) {
|
|
1178
1178
|
n = {
|
|
@@ -1201,7 +1201,7 @@ const $r = (e) => !("type" in e), Ir = (e, t, n) => ({ tr: r, dispatch: s, edito
|
|
|
1201
1201
|
}), !1;
|
|
1202
1202
|
}
|
|
1203
1203
|
let { from: c, to: l } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, u = !0, d = !0;
|
|
1204
|
-
if ((
|
|
1204
|
+
if ((Rr(a) ? a : [a]).forEach((m) => {
|
|
1205
1205
|
m.check(), u = u ? m.isText && m.marks.length === 0 : !1, d = d ? m.isBlock : !1;
|
|
1206
1206
|
}), c === l && d) {
|
|
1207
1207
|
const { parent: m } = r.doc.resolve(c);
|
|
@@ -1220,28 +1220,28 @@ const $r = (e) => !("type" in e), Ir = (e, t, n) => ({ tr: r, dispatch: s, edito
|
|
|
1220
1220
|
r.insertText(h, c, l);
|
|
1221
1221
|
} else
|
|
1222
1222
|
h = a, r.replaceWith(c, l, h);
|
|
1223
|
-
n.updateSelection &&
|
|
1223
|
+
n.updateSelection && Pr(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: c, text: h }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: c, text: h });
|
|
1224
1224
|
}
|
|
1225
1225
|
return !0;
|
|
1226
|
-
},
|
|
1226
|
+
}, $r = () => ({ state: e, dispatch: t }) => gn(e, t), Ir = () => ({ state: e, dispatch: t }) => Mn(e, t), Dr = () => ({ state: e, dispatch: t }) => Sn(e, t), Nr = () => ({ state: e, dispatch: t }) => bn(e, t), Br = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
1227
1227
|
try {
|
|
1228
|
-
const r =
|
|
1228
|
+
const r = Ee(e.doc, e.selection.$from.pos, -1);
|
|
1229
1229
|
return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
1230
1230
|
} catch {
|
|
1231
1231
|
return !1;
|
|
1232
1232
|
}
|
|
1233
|
-
},
|
|
1233
|
+
}, jr = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
1234
1234
|
try {
|
|
1235
|
-
const r =
|
|
1235
|
+
const r = Ee(e.doc, e.selection.$from.pos, 1);
|
|
1236
1236
|
return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
1237
1237
|
} catch {
|
|
1238
1238
|
return !1;
|
|
1239
1239
|
}
|
|
1240
|
-
},
|
|
1241
|
-
function
|
|
1240
|
+
}, Fr = () => ({ state: e, dispatch: t }) => vn(e, t), zr = () => ({ state: e, dispatch: t }) => yn(e, t);
|
|
1241
|
+
function Be() {
|
|
1242
1242
|
return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
|
|
1243
1243
|
}
|
|
1244
|
-
function
|
|
1244
|
+
function Vr(e) {
|
|
1245
1245
|
const t = e.split(/-(?!$)/);
|
|
1246
1246
|
let n = t[t.length - 1];
|
|
1247
1247
|
n === "Space" && (n = " ");
|
|
@@ -1257,14 +1257,14 @@ function Kr(e) {
|
|
|
1257
1257
|
else if (/^s(hift)?$/i.test(c))
|
|
1258
1258
|
o = !0;
|
|
1259
1259
|
else if (/^mod$/i.test(c))
|
|
1260
|
-
St() ||
|
|
1260
|
+
St() || Be() ? i = !0 : s = !0;
|
|
1261
1261
|
else
|
|
1262
1262
|
throw new Error(`Unrecognized modifier name: ${c}`);
|
|
1263
1263
|
}
|
|
1264
1264
|
return r && (n = `Alt-${n}`), s && (n = `Ctrl-${n}`), i && (n = `Meta-${n}`), o && (n = `Shift-${n}`), n;
|
|
1265
1265
|
}
|
|
1266
|
-
const
|
|
1267
|
-
const o =
|
|
1266
|
+
const Wr = (e) => ({ editor: t, view: n, tr: r, dispatch: s }) => {
|
|
1267
|
+
const o = Vr(e).split(/-(?!$)/), i = o.find((l) => !["Alt", "Ctrl", "Meta", "Shift"].includes(l)), a = new KeyboardEvent("keydown", {
|
|
1268
1268
|
key: i === "Space" ? " " : i,
|
|
1269
1269
|
altKey: o.includes("Alt"),
|
|
1270
1270
|
ctrlKey: o.includes("Ctrl"),
|
|
@@ -1295,37 +1295,37 @@ function st(e, t, n = {}) {
|
|
|
1295
1295
|
const c = s - r, l = a.filter((d) => i ? i.name === d.node.type.name : !0).filter((d) => ft(d.node.attrs, n, { strict: !1 }));
|
|
1296
1296
|
return o ? !!l.length : l.reduce((d, p) => d + p.to - p.from, 0) >= c;
|
|
1297
1297
|
}
|
|
1298
|
-
const
|
|
1298
|
+
const Kr = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1299
1299
|
const s = R(e, n.schema);
|
|
1300
|
-
return st(n, s, t) ?
|
|
1301
|
-
},
|
|
1300
|
+
return st(n, s, t) ? mn(n, r) : !1;
|
|
1301
|
+
}, Ur = () => ({ state: e, dispatch: t }) => fn(e, t), qr = (e) => ({ state: t, dispatch: n }) => {
|
|
1302
1302
|
const r = R(e, t.schema);
|
|
1303
|
-
return
|
|
1304
|
-
},
|
|
1303
|
+
return hn(r)(t, n);
|
|
1304
|
+
}, Gr = () => ({ state: e, dispatch: t }) => pn(e, t);
|
|
1305
1305
|
function kt(e, t) {
|
|
1306
1306
|
return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
|
|
1307
1307
|
}
|
|
1308
|
-
function
|
|
1308
|
+
function ce(e, t) {
|
|
1309
1309
|
const n = typeof t == "string" ? [t] : t;
|
|
1310
1310
|
return Object.keys(e).reduce((r, s) => (n.includes(s) || (r[s] = e[s]), r), {});
|
|
1311
1311
|
}
|
|
1312
|
-
const
|
|
1312
|
+
const Jr = (e, t) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1313
1313
|
let o = null, i = null;
|
|
1314
1314
|
const a = kt(typeof e == "string" ? e : e.name, r.schema);
|
|
1315
1315
|
return a ? (a === "node" && (o = R(e, r.schema)), a === "mark" && (i = K(e, r.schema)), s && n.selection.ranges.forEach((c) => {
|
|
1316
1316
|
r.doc.nodesBetween(c.$from.pos, c.$to.pos, (l, u) => {
|
|
1317
|
-
o && o === l.type && n.setNodeMarkup(u, void 0,
|
|
1318
|
-
i === d.type && n.addMark(u, u + l.nodeSize, i.create(
|
|
1317
|
+
o && o === l.type && n.setNodeMarkup(u, void 0, ce(l.attrs, t)), i && l.marks.length && l.marks.forEach((d) => {
|
|
1318
|
+
i === d.type && n.addMark(u, u + l.nodeSize, i.create(ce(d.attrs, t)));
|
|
1319
1319
|
});
|
|
1320
1320
|
});
|
|
1321
1321
|
}), !0) : !1;
|
|
1322
|
-
},
|
|
1322
|
+
}, Yr = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), Xr = () => ({ tr: e, dispatch: t }) => {
|
|
1323
1323
|
if (t) {
|
|
1324
|
-
const n = new
|
|
1324
|
+
const n = new un(e.doc);
|
|
1325
1325
|
e.setSelection(n);
|
|
1326
1326
|
}
|
|
1327
1327
|
return !0;
|
|
1328
|
-
},
|
|
1328
|
+
}, Qr = () => ({ state: e, dispatch: t }) => dn(e, t), Zr = () => ({ state: e, dispatch: t }) => cn(e, t), ts = () => ({ state: e, dispatch: t }) => ln(e, t), es = () => ({ state: e, dispatch: t }) => an(e, t), ns = () => ({ state: e, dispatch: t }) => on(e, t);
|
|
1329
1329
|
function $t(e, t, n = {}, r = {}) {
|
|
1330
1330
|
return mt(e, t, {
|
|
1331
1331
|
slice: !1,
|
|
@@ -1333,7 +1333,7 @@ function $t(e, t, n = {}, r = {}) {
|
|
|
1333
1333
|
errorOnInvalidContent: r.errorOnInvalidContent
|
|
1334
1334
|
});
|
|
1335
1335
|
}
|
|
1336
|
-
const
|
|
1336
|
+
const rs = (e, t = !1, n = {}, r = {}) => ({ editor: s, tr: o, dispatch: i, commands: a }) => {
|
|
1337
1337
|
var c, l;
|
|
1338
1338
|
const { doc: u } = o;
|
|
1339
1339
|
if (n.preserveWhitespace !== "full") {
|
|
@@ -1347,7 +1347,7 @@ const os = (e, t = !1, n = {}, r = {}) => ({ editor: s, tr: o, dispatch: i, comm
|
|
|
1347
1347
|
errorOnInvalidContent: (l = r.errorOnInvalidContent) !== null && l !== void 0 ? l : s.options.enableContentCheck
|
|
1348
1348
|
});
|
|
1349
1349
|
};
|
|
1350
|
-
function
|
|
1350
|
+
function je(e, t) {
|
|
1351
1351
|
const n = K(t, e.schema), { from: r, to: s, empty: o } = e.selection, i = [];
|
|
1352
1352
|
o ? (e.storedMarks && i.push(...e.storedMarks), i.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, s, (c) => {
|
|
1353
1353
|
i.push(...c.marks);
|
|
@@ -1355,15 +1355,15 @@ function Fe(e, t) {
|
|
|
1355
1355
|
const a = i.find((c) => c.type.name === n.name);
|
|
1356
1356
|
return a ? { ...a.attrs } : {};
|
|
1357
1357
|
}
|
|
1358
|
-
function
|
|
1359
|
-
const n = new
|
|
1358
|
+
function ss(e, t) {
|
|
1359
|
+
const n = new On(e);
|
|
1360
1360
|
return t.forEach((r) => {
|
|
1361
1361
|
r.steps.forEach((s) => {
|
|
1362
1362
|
n.step(s);
|
|
1363
1363
|
});
|
|
1364
1364
|
}), n;
|
|
1365
1365
|
}
|
|
1366
|
-
function
|
|
1366
|
+
function os(e) {
|
|
1367
1367
|
for (let t = 0; t < e.edgeCount; t += 1) {
|
|
1368
1368
|
const { type: n } = e.edge(t);
|
|
1369
1369
|
if (n.isTextblock && !n.hasRequiredAttrs())
|
|
@@ -1371,16 +1371,7 @@ function as(e) {
|
|
|
1371
1371
|
}
|
|
1372
1372
|
return null;
|
|
1373
1373
|
}
|
|
1374
|
-
function
|
|
1375
|
-
const n = [];
|
|
1376
|
-
return e.descendants((r, s) => {
|
|
1377
|
-
t(r) && n.push({
|
|
1378
|
-
node: r,
|
|
1379
|
-
pos: s
|
|
1380
|
-
});
|
|
1381
|
-
}), n;
|
|
1382
|
-
}
|
|
1383
|
-
function ls(e, t, n) {
|
|
1374
|
+
function is(e, t, n) {
|
|
1384
1375
|
const r = [];
|
|
1385
1376
|
return e.nodesBetween(t.from, t.to, (s, o) => {
|
|
1386
1377
|
n(s) && r.push({
|
|
@@ -1389,7 +1380,7 @@ function ls(e, t, n) {
|
|
|
1389
1380
|
});
|
|
1390
1381
|
}), r;
|
|
1391
1382
|
}
|
|
1392
|
-
function
|
|
1383
|
+
function Fe(e, t) {
|
|
1393
1384
|
for (let n = e.depth; n > 0; n -= 1) {
|
|
1394
1385
|
const r = e.node(n);
|
|
1395
1386
|
if (t(r))
|
|
@@ -1401,17 +1392,17 @@ function ze(e, t) {
|
|
|
1401
1392
|
};
|
|
1402
1393
|
}
|
|
1403
1394
|
}
|
|
1404
|
-
function
|
|
1405
|
-
return (t) =>
|
|
1395
|
+
function Jt(e) {
|
|
1396
|
+
return (t) => Fe(t.$from, e);
|
|
1406
1397
|
}
|
|
1407
|
-
function
|
|
1398
|
+
function as(e, t) {
|
|
1408
1399
|
const n = {
|
|
1409
1400
|
from: 0,
|
|
1410
1401
|
to: e.content.size
|
|
1411
1402
|
};
|
|
1412
|
-
return
|
|
1403
|
+
return Re(e, n, t);
|
|
1413
1404
|
}
|
|
1414
|
-
function
|
|
1405
|
+
function ls(e, t) {
|
|
1415
1406
|
const n = R(t, e.schema), { from: r, to: s } = e.selection, o = [];
|
|
1416
1407
|
e.doc.nodesBetween(r, s, (a) => {
|
|
1417
1408
|
o.push(a);
|
|
@@ -1419,22 +1410,22 @@ function ds(e, t) {
|
|
|
1419
1410
|
const i = o.reverse().find((a) => a.type.name === n.name);
|
|
1420
1411
|
return i ? { ...i.attrs } : {};
|
|
1421
1412
|
}
|
|
1422
|
-
function
|
|
1413
|
+
function ze(e, t) {
|
|
1423
1414
|
const n = kt(typeof t == "string" ? t : t.name, e.schema);
|
|
1424
|
-
return n === "node" ?
|
|
1415
|
+
return n === "node" ? ls(e, t) : n === "mark" ? je(e, t) : {};
|
|
1425
1416
|
}
|
|
1426
|
-
function
|
|
1417
|
+
function cs(e, t = JSON.stringify) {
|
|
1427
1418
|
const n = {};
|
|
1428
1419
|
return e.filter((r) => {
|
|
1429
1420
|
const s = t(r);
|
|
1430
1421
|
return Object.prototype.hasOwnProperty.call(n, s) ? !1 : n[s] = !0;
|
|
1431
1422
|
});
|
|
1432
1423
|
}
|
|
1433
|
-
function
|
|
1434
|
-
const t =
|
|
1424
|
+
function ds(e) {
|
|
1425
|
+
const t = cs(e);
|
|
1435
1426
|
return t.length === 1 ? t : t.filter((n, r) => !t.filter((o, i) => i !== r).some((o) => n.oldRange.from >= o.oldRange.from && n.oldRange.to <= o.oldRange.to && n.newRange.from >= o.newRange.from && n.newRange.to <= o.newRange.to));
|
|
1436
1427
|
}
|
|
1437
|
-
function
|
|
1428
|
+
function us(e) {
|
|
1438
1429
|
const { mapping: t, steps: n } = e, r = [];
|
|
1439
1430
|
return t.maps.forEach((s, o) => {
|
|
1440
1431
|
const i = [];
|
|
@@ -1461,12 +1452,12 @@ function hs(e) {
|
|
|
1461
1452
|
}
|
|
1462
1453
|
});
|
|
1463
1454
|
});
|
|
1464
|
-
}),
|
|
1455
|
+
}), ds(r);
|
|
1465
1456
|
}
|
|
1466
|
-
function
|
|
1457
|
+
function Yt(e, t, n) {
|
|
1467
1458
|
const r = [];
|
|
1468
1459
|
return e === t ? n.resolve(e).marks().forEach((s) => {
|
|
1469
|
-
const o = n.resolve(e), i =
|
|
1460
|
+
const o = n.resolve(e), i = qt(o, s.type);
|
|
1470
1461
|
i && r.push({
|
|
1471
1462
|
mark: s,
|
|
1472
1463
|
...i
|
|
@@ -1508,13 +1499,13 @@ function It(e, t, n = {}) {
|
|
|
1508
1499
|
const c = a.filter((d) => o ? o.name === d.mark.type.name : !0).filter((d) => ft(d.mark.attrs, n, { strict: !1 })).reduce((d, p) => d + p.to - p.from, 0), l = a.filter((d) => o ? d.mark.type !== o && d.mark.type.excludes(o) : !0).reduce((d, p) => d + p.to - p.from, 0);
|
|
1509
1500
|
return (c > 0 ? c + l : c) >= i;
|
|
1510
1501
|
}
|
|
1511
|
-
function
|
|
1502
|
+
function ps(e, t, n = {}) {
|
|
1512
1503
|
if (!t)
|
|
1513
1504
|
return st(e, null, n) || It(e, null, n);
|
|
1514
1505
|
const r = kt(t, e.schema);
|
|
1515
1506
|
return r === "node" ? st(e, t, n) : r === "mark" ? It(e, t, n) : !1;
|
|
1516
1507
|
}
|
|
1517
|
-
function
|
|
1508
|
+
function de(e, t) {
|
|
1518
1509
|
const { nodeExtensions: n } = vt(t), r = n.find((i) => i.name === e);
|
|
1519
1510
|
if (!r)
|
|
1520
1511
|
return !1;
|
|
@@ -1547,10 +1538,10 @@ function wt(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1547
1538
|
}
|
|
1548
1539
|
return !1;
|
|
1549
1540
|
}
|
|
1550
|
-
function
|
|
1541
|
+
function Ve(e) {
|
|
1551
1542
|
return e instanceof tt;
|
|
1552
1543
|
}
|
|
1553
|
-
function
|
|
1544
|
+
function hs(e, t, n) {
|
|
1554
1545
|
const s = e.state.doc.content.size, o = F(t, 0, s), i = F(n, 0, s), a = e.coordsAtPos(o), c = e.coordsAtPos(i, -1), l = Math.min(a.top, c.top), u = Math.max(a.bottom, c.bottom), d = Math.min(a.left, c.left), p = Math.max(a.right, c.right), h = p - d, m = u - l, y = {
|
|
1555
1546
|
top: l,
|
|
1556
1547
|
bottom: u,
|
|
@@ -1566,11 +1557,11 @@ function ms(e, t, n) {
|
|
|
1566
1557
|
toJSON: () => y
|
|
1567
1558
|
};
|
|
1568
1559
|
}
|
|
1569
|
-
function
|
|
1560
|
+
function fs(e, t, n) {
|
|
1570
1561
|
var r;
|
|
1571
1562
|
const { selection: s } = t;
|
|
1572
1563
|
let o = null;
|
|
1573
|
-
if (
|
|
1564
|
+
if (Gt(s) && (o = s.$cursor), o) {
|
|
1574
1565
|
const a = (r = e.storedMarks) !== null && r !== void 0 ? r : o.marks();
|
|
1575
1566
|
return !!n.isInSet(a) || !a.some((c) => c.type.excludes(n));
|
|
1576
1567
|
}
|
|
@@ -1588,11 +1579,11 @@ function gs(e, t, n) {
|
|
|
1588
1579
|
}), l;
|
|
1589
1580
|
});
|
|
1590
1581
|
}
|
|
1591
|
-
const
|
|
1582
|
+
const ms = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1592
1583
|
const { selection: o } = n, { empty: i, ranges: a } = o, c = K(e, r.schema);
|
|
1593
1584
|
if (s)
|
|
1594
1585
|
if (i) {
|
|
1595
|
-
const l =
|
|
1586
|
+
const l = je(r, c);
|
|
1596
1587
|
n.addStoredMark(c.create({
|
|
1597
1588
|
...l,
|
|
1598
1589
|
...t
|
|
@@ -1610,41 +1601,41 @@ const ys = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
|
1610
1601
|
}) : n.addMark(m, f, c.create(t));
|
|
1611
1602
|
});
|
|
1612
1603
|
});
|
|
1613
|
-
return
|
|
1614
|
-
},
|
|
1604
|
+
return fs(r, n, c);
|
|
1605
|
+
}, gs = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), ys = (e, t = {}) => ({ state: n, dispatch: r, chain: s }) => {
|
|
1615
1606
|
const o = R(e, n.schema);
|
|
1616
1607
|
let i;
|
|
1617
|
-
return n.selection.$anchor.sameParent(n.selection.$head) && (i = n.selection.$anchor.parent.attrs), o.isTextblock ? s().command(({ commands: a }) =>
|
|
1618
|
-
},
|
|
1608
|
+
return n.selection.$anchor.sameParent(n.selection.$head) && (i = n.selection.$anchor.parent.attrs), o.isTextblock ? s().command(({ commands: a }) => Zt(o, { ...i, ...t })(n) ? !0 : a.clearNodes()).command(({ state: a }) => Zt(o, { ...i, ...t })(a, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
|
|
1609
|
+
}, vs = (e) => ({ tr: t, dispatch: n }) => {
|
|
1619
1610
|
if (n) {
|
|
1620
1611
|
const { doc: r } = t, s = F(e, 0, r.content.size), o = tt.create(r, s);
|
|
1621
1612
|
t.setSelection(o);
|
|
1622
1613
|
}
|
|
1623
1614
|
return !0;
|
|
1624
|
-
},
|
|
1615
|
+
}, bs = (e) => ({ tr: t, dispatch: n }) => {
|
|
1625
1616
|
if (n) {
|
|
1626
1617
|
const { doc: r } = t, { from: s, to: o } = typeof e == "number" ? { from: e, to: e } : e, i = D.atStart(r).from, a = D.atEnd(r).to, c = F(s, i, a), l = F(o, i, a), u = D.create(r, c, l);
|
|
1627
1618
|
t.setSelection(u);
|
|
1628
1619
|
}
|
|
1629
1620
|
return !0;
|
|
1630
|
-
},
|
|
1621
|
+
}, Ms = (e) => ({ state: t, dispatch: n }) => {
|
|
1631
1622
|
const r = R(e, t.schema);
|
|
1632
|
-
return
|
|
1623
|
+
return sn(r)(t, n);
|
|
1633
1624
|
};
|
|
1634
|
-
function
|
|
1625
|
+
function ue(e, t) {
|
|
1635
1626
|
const n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
|
|
1636
1627
|
if (n) {
|
|
1637
1628
|
const r = n.filter((s) => t == null ? void 0 : t.includes(s.type.name));
|
|
1638
1629
|
e.tr.ensureMarks(r);
|
|
1639
1630
|
}
|
|
1640
1631
|
}
|
|
1641
|
-
const
|
|
1632
|
+
const Ss = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: s }) => {
|
|
1642
1633
|
const { selection: o, doc: i } = t, { $from: a, $to: c } = o, l = s.extensionManager.attributes, u = ut(l, a.node().type.name, a.node().attrs);
|
|
1643
1634
|
if (o instanceof tt && o.node.isBlock)
|
|
1644
|
-
return !a.parentOffset || !dt(i, a.pos) ? !1 : (r && (e &&
|
|
1635
|
+
return !a.parentOffset || !dt(i, a.pos) ? !1 : (r && (e && ue(n, s.extensionManager.splittableMarks), t.split(a.pos).scrollIntoView()), !0);
|
|
1645
1636
|
if (!a.parent.isBlock)
|
|
1646
1637
|
return !1;
|
|
1647
|
-
const d = c.parentOffset === c.parent.content.size, p = a.depth === 0 ? void 0 :
|
|
1638
|
+
const d = c.parentOffset === c.parent.content.size, p = a.depth === 0 ? void 0 : os(a.node(-1).contentMatchAt(a.indexAfter(-1)));
|
|
1648
1639
|
let h = d && p ? [
|
|
1649
1640
|
{
|
|
1650
1641
|
type: p,
|
|
@@ -1661,10 +1652,10 @@ const ws = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1661
1652
|
const f = t.mapping.map(a.before()), g = t.doc.resolve(f);
|
|
1662
1653
|
a.node(-1).canReplaceWith(g.index(), g.index() + 1, p) && t.setNodeMarkup(t.mapping.map(a.before()), p);
|
|
1663
1654
|
}
|
|
1664
|
-
e &&
|
|
1655
|
+
e && ue(n, s.extensionManager.splittableMarks), t.scrollIntoView();
|
|
1665
1656
|
}
|
|
1666
1657
|
return m;
|
|
1667
|
-
},
|
|
1658
|
+
}, ks = (e, t = {}) => ({ tr: n, state: r, dispatch: s, editor: o }) => {
|
|
1668
1659
|
var i;
|
|
1669
1660
|
const a = R(e, r.schema), { $from: c, $to: l } = r.selection, u = r.selection.node;
|
|
1670
1661
|
if (u && u.isBlock || c.depth < 2 || !c.sameParent(l))
|
|
@@ -1687,12 +1678,12 @@ const ws = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1687
1678
|
}, w = ((i = a.contentMatch.defaultType) === null || i === void 0 ? void 0 : i.createAndFill(b)) || void 0;
|
|
1688
1679
|
y = y.append(V.from(a.createAndFill(null, w) || void 0));
|
|
1689
1680
|
const k = c.before(c.depth - (M - 1));
|
|
1690
|
-
n.replace(k, c.after(-v), new
|
|
1681
|
+
n.replace(k, c.after(-v), new rn(y, 4 - M, 0));
|
|
1691
1682
|
let T = -1;
|
|
1692
|
-
n.doc.nodesBetween(k, n.doc.content.size, (x,
|
|
1683
|
+
n.doc.nodesBetween(k, n.doc.content.size, (x, O) => {
|
|
1693
1684
|
if (T > -1)
|
|
1694
1685
|
return !1;
|
|
1695
|
-
x.isTextblock && x.content.size === 0 && (T =
|
|
1686
|
+
x.isTextblock && x.content.size === 0 && (T = O + 1);
|
|
1696
1687
|
}), T > -1 && n.setSelection(D.near(n.doc.resolve(T))), n.scrollIntoView();
|
|
1697
1688
|
}
|
|
1698
1689
|
return !0;
|
|
@@ -1720,49 +1711,49 @@ const ws = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1720
1711
|
}
|
|
1721
1712
|
return !0;
|
|
1722
1713
|
}, Ot = (e, t) => {
|
|
1723
|
-
const n =
|
|
1714
|
+
const n = Jt((i) => i.type === t)(e.selection);
|
|
1724
1715
|
if (!n)
|
|
1725
1716
|
return !0;
|
|
1726
1717
|
const r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
|
|
1727
1718
|
if (r === void 0)
|
|
1728
1719
|
return !0;
|
|
1729
1720
|
const s = e.doc.nodeAt(r);
|
|
1730
|
-
return n.node.type === (s == null ? void 0 : s.type) &&
|
|
1721
|
+
return n.node.type === (s == null ? void 0 : s.type) && Ft(e.doc, n.pos) && e.join(n.pos), !0;
|
|
1731
1722
|
}, Lt = (e, t) => {
|
|
1732
|
-
const n =
|
|
1723
|
+
const n = Jt((i) => i.type === t)(e.selection);
|
|
1733
1724
|
if (!n)
|
|
1734
1725
|
return !0;
|
|
1735
1726
|
const r = e.doc.resolve(n.start).after(n.depth);
|
|
1736
1727
|
if (r === void 0)
|
|
1737
1728
|
return !0;
|
|
1738
1729
|
const s = e.doc.nodeAt(r);
|
|
1739
|
-
return n.node.type === (s == null ? void 0 : s.type) &&
|
|
1740
|
-
},
|
|
1730
|
+
return n.node.type === (s == null ? void 0 : s.type) && Ft(e.doc, r) && e.join(r), !0;
|
|
1731
|
+
}, ws = (e, t, n, r = {}) => ({ editor: s, tr: o, state: i, dispatch: a, chain: c, commands: l, can: u }) => {
|
|
1741
1732
|
const { extensions: d, splittableMarks: p } = s.extensionManager, h = R(e, i.schema), m = R(t, i.schema), { selection: f, storedMarks: g } = i, { $from: y, $to: M } = f, v = y.blockRange(M), b = g || f.$to.parentOffset && f.$from.marks();
|
|
1742
1733
|
if (!v)
|
|
1743
1734
|
return !1;
|
|
1744
|
-
const w =
|
|
1735
|
+
const w = Jt((k) => de(k.type.name, d))(f);
|
|
1745
1736
|
if (v.depth >= 1 && w && v.depth - w.depth <= 1) {
|
|
1746
1737
|
if (w.node.type === h)
|
|
1747
1738
|
return l.liftListItem(m);
|
|
1748
|
-
if (
|
|
1739
|
+
if (de(w.node.type.name, d) && h.validContent(w.node.content) && a)
|
|
1749
1740
|
return c().command(() => (o.setNodeMarkup(w.pos, h), !0)).command(() => Ot(o, h)).command(() => Lt(o, h)).run();
|
|
1750
1741
|
}
|
|
1751
1742
|
return !n || !b || !a ? c().command(() => u().wrapInList(h, r) ? !0 : l.clearNodes()).wrapInList(h, r).command(() => Ot(o, h)).command(() => Lt(o, h)).run() : c().command(() => {
|
|
1752
1743
|
const k = u().wrapInList(h, r), T = b.filter((x) => p.includes(x.type.name));
|
|
1753
1744
|
return o.ensureMarks(T), k ? !0 : l.clearNodes();
|
|
1754
1745
|
}).wrapInList(h, r).command(() => Ot(o, h)).command(() => Lt(o, h)).run();
|
|
1755
|
-
},
|
|
1746
|
+
}, Es = (e, t = {}, n = {}) => ({ state: r, commands: s }) => {
|
|
1756
1747
|
const { extendEmptyMarkRange: o = !1 } = n, i = K(e, r.schema);
|
|
1757
1748
|
return It(r, i, t) ? s.unsetMark(i, { extendEmptyMarkRange: o }) : s.setMark(i, t);
|
|
1758
|
-
},
|
|
1749
|
+
}, Ts = (e, t, n = {}) => ({ state: r, commands: s }) => {
|
|
1759
1750
|
const o = R(e, r.schema), i = R(t, r.schema), a = st(r, o, n);
|
|
1760
1751
|
let c;
|
|
1761
1752
|
return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), a ? s.setNode(i, c) : s.setNode(o, { ...c, ...n });
|
|
1762
|
-
},
|
|
1753
|
+
}, Cs = (e, t = {}) => ({ state: n, commands: r }) => {
|
|
1763
1754
|
const s = R(e, n.schema);
|
|
1764
1755
|
return st(n, s, t) ? r.lift(s) : r.wrapIn(s, t);
|
|
1765
|
-
},
|
|
1756
|
+
}, xs = () => ({ state: e, dispatch: t }) => {
|
|
1766
1757
|
const n = e.plugins;
|
|
1767
1758
|
for (let r = 0; r < n.length; r += 1) {
|
|
1768
1759
|
const s = n[r];
|
|
@@ -1782,26 +1773,26 @@ const ws = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1782
1773
|
}
|
|
1783
1774
|
}
|
|
1784
1775
|
return !1;
|
|
1785
|
-
},
|
|
1776
|
+
}, As = () => ({ tr: e, dispatch: t }) => {
|
|
1786
1777
|
const { selection: n } = e, { empty: r, ranges: s } = n;
|
|
1787
1778
|
return r || t && s.forEach((o) => {
|
|
1788
1779
|
e.removeMark(o.$from.pos, o.$to.pos);
|
|
1789
1780
|
}), !0;
|
|
1790
|
-
},
|
|
1781
|
+
}, Os = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1791
1782
|
var o;
|
|
1792
1783
|
const { extendEmptyMarkRange: i = !1 } = t, { selection: a } = n, c = K(e, r.schema), { $from: l, empty: u, ranges: d } = a;
|
|
1793
1784
|
if (!s)
|
|
1794
1785
|
return !0;
|
|
1795
1786
|
if (u && i) {
|
|
1796
1787
|
let { from: p, to: h } = a;
|
|
1797
|
-
const m = (o = l.marks().find((g) => g.type === c)) === null || o === void 0 ? void 0 : o.attrs, f =
|
|
1788
|
+
const m = (o = l.marks().find((g) => g.type === c)) === null || o === void 0 ? void 0 : o.attrs, f = qt(l, c, m);
|
|
1798
1789
|
f && (p = f.from, h = f.to), n.removeMark(p, h, c);
|
|
1799
1790
|
} else
|
|
1800
1791
|
d.forEach((p) => {
|
|
1801
1792
|
n.removeMark(p.$from.pos, p.$to.pos, c);
|
|
1802
1793
|
});
|
|
1803
1794
|
return n.removeStoredMark(c), !0;
|
|
1804
|
-
},
|
|
1795
|
+
}, Ls = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1805
1796
|
let o = null, i = null;
|
|
1806
1797
|
const a = kt(typeof e == "string" ? e : e.name, r.schema);
|
|
1807
1798
|
return a ? (a === "node" && (o = R(e, r.schema)), a === "mark" && (i = K(e, r.schema)), s && n.selection.ranges.forEach((c) => {
|
|
@@ -1832,87 +1823,87 @@ const ws = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1832
1823
|
}));
|
|
1833
1824
|
}));
|
|
1834
1825
|
}), !0) : !1;
|
|
1835
|
-
},
|
|
1826
|
+
}, _s = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1836
1827
|
const s = R(e, n.schema);
|
|
1837
|
-
return
|
|
1838
|
-
},
|
|
1828
|
+
return nn(s, t)(n, r);
|
|
1829
|
+
}, Ps = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1839
1830
|
const s = R(e, n.schema);
|
|
1840
|
-
return
|
|
1831
|
+
return en(s, t)(n, r);
|
|
1841
1832
|
};
|
|
1842
|
-
var
|
|
1833
|
+
var Rs = /* @__PURE__ */ Object.freeze({
|
|
1843
1834
|
__proto__: null,
|
|
1844
|
-
blur:
|
|
1845
|
-
clearContent:
|
|
1846
|
-
clearNodes:
|
|
1847
|
-
command:
|
|
1848
|
-
createParagraphNear:
|
|
1849
|
-
cut:
|
|
1850
|
-
deleteCurrentNode:
|
|
1851
|
-
deleteNode:
|
|
1852
|
-
deleteRange:
|
|
1853
|
-
deleteSelection:
|
|
1854
|
-
enter:
|
|
1855
|
-
exitCode:
|
|
1856
|
-
extendMarkRange:
|
|
1857
|
-
first:
|
|
1858
|
-
focus:
|
|
1859
|
-
forEach:
|
|
1860
|
-
insertContent:
|
|
1861
|
-
insertContentAt:
|
|
1862
|
-
joinBackward:
|
|
1863
|
-
joinDown:
|
|
1864
|
-
joinForward:
|
|
1865
|
-
joinItemBackward:
|
|
1866
|
-
joinItemForward:
|
|
1867
|
-
joinTextblockBackward:
|
|
1868
|
-
joinTextblockForward:
|
|
1869
|
-
joinUp:
|
|
1870
|
-
keyboardShortcut:
|
|
1871
|
-
lift:
|
|
1872
|
-
liftEmptyBlock:
|
|
1873
|
-
liftListItem:
|
|
1874
|
-
newlineInCode:
|
|
1875
|
-
resetAttributes:
|
|
1876
|
-
scrollIntoView:
|
|
1877
|
-
selectAll:
|
|
1878
|
-
selectNodeBackward:
|
|
1879
|
-
selectNodeForward:
|
|
1880
|
-
selectParentNode:
|
|
1881
|
-
selectTextblockEnd:
|
|
1882
|
-
selectTextblockStart:
|
|
1883
|
-
setContent:
|
|
1884
|
-
setMark:
|
|
1885
|
-
setMeta:
|
|
1886
|
-
setNode:
|
|
1887
|
-
setNodeSelection:
|
|
1888
|
-
setTextSelection:
|
|
1889
|
-
sinkListItem:
|
|
1890
|
-
splitBlock:
|
|
1891
|
-
splitListItem:
|
|
1892
|
-
toggleList:
|
|
1893
|
-
toggleMark:
|
|
1894
|
-
toggleNode:
|
|
1895
|
-
toggleWrap:
|
|
1896
|
-
undoInputRule:
|
|
1897
|
-
unsetAllMarks:
|
|
1898
|
-
unsetMark:
|
|
1899
|
-
updateAttributes:
|
|
1900
|
-
wrapIn:
|
|
1901
|
-
wrapInList:
|
|
1835
|
+
blur: mr,
|
|
1836
|
+
clearContent: gr,
|
|
1837
|
+
clearNodes: yr,
|
|
1838
|
+
command: vr,
|
|
1839
|
+
createParagraphNear: br,
|
|
1840
|
+
cut: Mr,
|
|
1841
|
+
deleteCurrentNode: Sr,
|
|
1842
|
+
deleteNode: kr,
|
|
1843
|
+
deleteRange: wr,
|
|
1844
|
+
deleteSelection: Er,
|
|
1845
|
+
enter: Tr,
|
|
1846
|
+
exitCode: Cr,
|
|
1847
|
+
extendMarkRange: xr,
|
|
1848
|
+
first: Ar,
|
|
1849
|
+
focus: Or,
|
|
1850
|
+
forEach: Lr,
|
|
1851
|
+
insertContent: _r,
|
|
1852
|
+
insertContentAt: Hr,
|
|
1853
|
+
joinBackward: Dr,
|
|
1854
|
+
joinDown: Ir,
|
|
1855
|
+
joinForward: Nr,
|
|
1856
|
+
joinItemBackward: Br,
|
|
1857
|
+
joinItemForward: jr,
|
|
1858
|
+
joinTextblockBackward: Fr,
|
|
1859
|
+
joinTextblockForward: zr,
|
|
1860
|
+
joinUp: $r,
|
|
1861
|
+
keyboardShortcut: Wr,
|
|
1862
|
+
lift: Kr,
|
|
1863
|
+
liftEmptyBlock: Ur,
|
|
1864
|
+
liftListItem: qr,
|
|
1865
|
+
newlineInCode: Gr,
|
|
1866
|
+
resetAttributes: Jr,
|
|
1867
|
+
scrollIntoView: Yr,
|
|
1868
|
+
selectAll: Xr,
|
|
1869
|
+
selectNodeBackward: Qr,
|
|
1870
|
+
selectNodeForward: Zr,
|
|
1871
|
+
selectParentNode: ts,
|
|
1872
|
+
selectTextblockEnd: es,
|
|
1873
|
+
selectTextblockStart: ns,
|
|
1874
|
+
setContent: rs,
|
|
1875
|
+
setMark: ms,
|
|
1876
|
+
setMeta: gs,
|
|
1877
|
+
setNode: ys,
|
|
1878
|
+
setNodeSelection: vs,
|
|
1879
|
+
setTextSelection: bs,
|
|
1880
|
+
sinkListItem: Ms,
|
|
1881
|
+
splitBlock: Ss,
|
|
1882
|
+
splitListItem: ks,
|
|
1883
|
+
toggleList: ws,
|
|
1884
|
+
toggleMark: Es,
|
|
1885
|
+
toggleNode: Ts,
|
|
1886
|
+
toggleWrap: Cs,
|
|
1887
|
+
undoInputRule: xs,
|
|
1888
|
+
unsetAllMarks: As,
|
|
1889
|
+
unsetMark: Os,
|
|
1890
|
+
updateAttributes: Ls,
|
|
1891
|
+
wrapIn: _s,
|
|
1892
|
+
wrapInList: Ps
|
|
1902
1893
|
});
|
|
1903
|
-
const
|
|
1894
|
+
const Hs = _.create({
|
|
1904
1895
|
name: "commands",
|
|
1905
1896
|
addCommands() {
|
|
1906
1897
|
return {
|
|
1907
|
-
|
|
1898
|
+
...Rs
|
|
1908
1899
|
};
|
|
1909
1900
|
}
|
|
1910
|
-
}),
|
|
1901
|
+
}), $s = _.create({
|
|
1911
1902
|
name: "drop",
|
|
1912
1903
|
addProseMirrorPlugins() {
|
|
1913
1904
|
return [
|
|
1914
1905
|
new H({
|
|
1915
|
-
key: new
|
|
1906
|
+
key: new I("tiptapDrop"),
|
|
1916
1907
|
props: {
|
|
1917
1908
|
handleDrop: (e, t, n, r) => {
|
|
1918
1909
|
this.editor.emit("drop", {
|
|
@@ -1926,25 +1917,25 @@ const Is = P.create({
|
|
|
1926
1917
|
})
|
|
1927
1918
|
];
|
|
1928
1919
|
}
|
|
1929
|
-
}),
|
|
1920
|
+
}), Is = _.create({
|
|
1930
1921
|
name: "editable",
|
|
1931
1922
|
addProseMirrorPlugins() {
|
|
1932
1923
|
return [
|
|
1933
1924
|
new H({
|
|
1934
|
-
key: new
|
|
1925
|
+
key: new I("editable"),
|
|
1935
1926
|
props: {
|
|
1936
1927
|
editable: () => this.editor.options.editable
|
|
1937
1928
|
}
|
|
1938
1929
|
})
|
|
1939
1930
|
];
|
|
1940
1931
|
}
|
|
1941
|
-
}),
|
|
1932
|
+
}), Ds = new I("focusEvents"), Ns = _.create({
|
|
1942
1933
|
name: "focusEvents",
|
|
1943
1934
|
addProseMirrorPlugins() {
|
|
1944
1935
|
const { editor: e } = this;
|
|
1945
1936
|
return [
|
|
1946
1937
|
new H({
|
|
1947
|
-
key:
|
|
1938
|
+
key: Ds,
|
|
1948
1939
|
props: {
|
|
1949
1940
|
handleDOMEvents: {
|
|
1950
1941
|
focus: (t, n) => {
|
|
@@ -1962,14 +1953,14 @@ const Is = P.create({
|
|
|
1962
1953
|
})
|
|
1963
1954
|
];
|
|
1964
1955
|
}
|
|
1965
|
-
}),
|
|
1956
|
+
}), Bs = _.create({
|
|
1966
1957
|
name: "keymap",
|
|
1967
1958
|
addKeyboardShortcuts() {
|
|
1968
1959
|
const e = () => this.editor.commands.first(({ commands: i }) => [
|
|
1969
1960
|
() => i.undoInputRule(),
|
|
1970
1961
|
// maybe convert first text block node to default node
|
|
1971
1962
|
() => i.command(({ tr: a }) => {
|
|
1972
|
-
const { selection: c, doc: l } = a, { empty: u, $anchor: d } = c, { pos: p, parent: h } = d, m = d.parent.isTextblock && p > 0 ? a.doc.resolve(p - 1) : d, f = m.parent.type.spec.isolating, g = d.pos - d.parentOffset, y = f && m.parent.childCount === 1 ? g === d.pos :
|
|
1963
|
+
const { selection: c, doc: l } = a, { empty: u, $anchor: d } = c, { pos: p, parent: h } = d, m = d.parent.isTextblock && p > 0 ? a.doc.resolve(p - 1) : d, f = m.parent.type.spec.isolating, g = d.pos - d.parentOffset, y = f && m.parent.childCount === 1 ? g === d.pos : Z.atStart(l).from === p;
|
|
1973
1964
|
return !u || !h.type.isTextblock || h.textContent.length || !y || y && d.parent.type.name === "paragraph" ? !1 : i.clearNodes();
|
|
1974
1965
|
}),
|
|
1975
1966
|
() => i.deleteSelection(),
|
|
@@ -2007,7 +1998,7 @@ const Is = P.create({
|
|
|
2007
1998
|
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
2008
1999
|
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
2009
2000
|
};
|
|
2010
|
-
return St() ||
|
|
2001
|
+
return St() || Be() ? o : s;
|
|
2011
2002
|
},
|
|
2012
2003
|
addProseMirrorPlugins() {
|
|
2013
2004
|
return [
|
|
@@ -2017,14 +2008,14 @@ const Is = P.create({
|
|
|
2017
2008
|
// This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well
|
|
2018
2009
|
// with many other commands.
|
|
2019
2010
|
new H({
|
|
2020
|
-
key: new
|
|
2011
|
+
key: new I("clearDocument"),
|
|
2021
2012
|
appendTransaction: (e, t, n) => {
|
|
2022
2013
|
if (e.some((f) => f.getMeta("composition")))
|
|
2023
2014
|
return;
|
|
2024
2015
|
const r = e.some((f) => f.docChanged) && !t.doc.eq(n.doc), s = e.some((f) => f.getMeta("preventClearDocument"));
|
|
2025
2016
|
if (!r || s)
|
|
2026
2017
|
return;
|
|
2027
|
-
const { empty: o, from: i, to: a } = t.selection, c =
|
|
2018
|
+
const { empty: o, from: i, to: a } = t.selection, c = Z.atStart(t.doc).from, l = Z.atEnd(t.doc).to;
|
|
2028
2019
|
if (o || !(i === c && a === l) || !wt(n.doc))
|
|
2029
2020
|
return;
|
|
2030
2021
|
const p = n.tr, h = gt({
|
|
@@ -2040,12 +2031,12 @@ const Is = P.create({
|
|
|
2040
2031
|
})
|
|
2041
2032
|
];
|
|
2042
2033
|
}
|
|
2043
|
-
}),
|
|
2034
|
+
}), js = _.create({
|
|
2044
2035
|
name: "paste",
|
|
2045
2036
|
addProseMirrorPlugins() {
|
|
2046
2037
|
return [
|
|
2047
2038
|
new H({
|
|
2048
|
-
key: new
|
|
2039
|
+
key: new I("tiptapPaste"),
|
|
2049
2040
|
props: {
|
|
2050
2041
|
handlePaste: (e, t, n) => {
|
|
2051
2042
|
this.editor.emit("paste", {
|
|
@@ -2058,12 +2049,12 @@ const Is = P.create({
|
|
|
2058
2049
|
})
|
|
2059
2050
|
];
|
|
2060
2051
|
}
|
|
2061
|
-
}),
|
|
2052
|
+
}), Fs = _.create({
|
|
2062
2053
|
name: "tabindex",
|
|
2063
2054
|
addProseMirrorPlugins() {
|
|
2064
2055
|
return [
|
|
2065
2056
|
new H({
|
|
2066
|
-
key: new
|
|
2057
|
+
key: new I("tabindex"),
|
|
2067
2058
|
props: {
|
|
2068
2059
|
attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
|
|
2069
2060
|
}
|
|
@@ -2194,7 +2185,7 @@ class q {
|
|
|
2194
2185
|
}), this.editor.view.dispatch(n);
|
|
2195
2186
|
}
|
|
2196
2187
|
}
|
|
2197
|
-
const
|
|
2188
|
+
const zs = `.ProseMirror {
|
|
2198
2189
|
position: relative;
|
|
2199
2190
|
}
|
|
2200
2191
|
|
|
@@ -2269,14 +2260,14 @@ img.ProseMirror-separator {
|
|
|
2269
2260
|
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
2270
2261
|
opacity: 0
|
|
2271
2262
|
}`;
|
|
2272
|
-
function
|
|
2263
|
+
function Vs(e, t, n) {
|
|
2273
2264
|
const r = document.querySelector("style[data-tiptap-style]");
|
|
2274
2265
|
if (r !== null)
|
|
2275
2266
|
return r;
|
|
2276
2267
|
const s = document.createElement("style");
|
|
2277
2268
|
return t && s.setAttribute("nonce", t), s.setAttribute("data-tiptap-style", ""), s.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(s), s;
|
|
2278
2269
|
}
|
|
2279
|
-
class
|
|
2270
|
+
class Ws extends tr {
|
|
2280
2271
|
constructor(t = {}) {
|
|
2281
2272
|
super(), this.isFocused = !1, this.isInitialized = !1, this.extensionStorage = {}, this.options = {
|
|
2282
2273
|
element: document.createElement("div"),
|
|
@@ -2338,7 +2329,7 @@ class Us extends nr {
|
|
|
2338
2329
|
* Inject CSS styles.
|
|
2339
2330
|
*/
|
|
2340
2331
|
injectCSS() {
|
|
2341
|
-
this.options.injectCSS && document && (this.css =
|
|
2332
|
+
this.options.injectCSS && document && (this.css = Vs(zs, this.options.injectNonce));
|
|
2342
2333
|
}
|
|
2343
2334
|
/**
|
|
2344
2335
|
* Update editor options.
|
|
@@ -2377,7 +2368,7 @@ class Us extends nr {
|
|
|
2377
2368
|
* @returns The new editor state
|
|
2378
2369
|
*/
|
|
2379
2370
|
registerPlugin(t, n) {
|
|
2380
|
-
const r =
|
|
2371
|
+
const r = _e(n) ? n(t, [...this.state.plugins]) : [...this.state.plugins, t], s = this.state.reconfigure({ plugins: r });
|
|
2381
2372
|
return this.view.updateState(s), s;
|
|
2382
2373
|
}
|
|
2383
2374
|
/**
|
|
@@ -2407,18 +2398,18 @@ class Us extends nr {
|
|
|
2407
2398
|
createExtensionManager() {
|
|
2408
2399
|
var t, n;
|
|
2409
2400
|
const s = [...this.options.enableCoreExtensions ? [
|
|
2410
|
-
|
|
2411
|
-
|
|
2401
|
+
Is,
|
|
2402
|
+
fr.configure({
|
|
2412
2403
|
blockSeparator: (n = (t = this.options.coreExtensionOptions) === null || t === void 0 ? void 0 : t.clipboardTextSerializer) === null || n === void 0 ? void 0 : n.blockSeparator
|
|
2413
2404
|
}),
|
|
2414
|
-
|
|
2415
|
-
|
|
2405
|
+
Hs,
|
|
2406
|
+
Ns,
|
|
2407
|
+
Bs,
|
|
2416
2408
|
Fs,
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
zs
|
|
2409
|
+
$s,
|
|
2410
|
+
js
|
|
2420
2411
|
].filter((o) => typeof this.options.enableCoreExtensions == "object" ? this.options.enableCoreExtensions[o.name] !== !1 : !0) : [], ...this.options.extensions].filter((o) => ["extension", "node", "mark"].includes(o == null ? void 0 : o.type));
|
|
2421
|
-
this.extensionManager = new
|
|
2412
|
+
this.extensionManager = new Q(s, this);
|
|
2422
2413
|
}
|
|
2423
2414
|
/**
|
|
2424
2415
|
* Creates an command manager.
|
|
@@ -2453,8 +2444,8 @@ class Us extends nr {
|
|
|
2453
2444
|
}
|
|
2454
2445
|
}), n = $t(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
|
|
2455
2446
|
}
|
|
2456
|
-
const r =
|
|
2457
|
-
this.view = new
|
|
2447
|
+
const r = Ie(n, this.options.autofocus);
|
|
2448
|
+
this.view = new Ye(this.options.element, {
|
|
2458
2449
|
...this.options.editorProps,
|
|
2459
2450
|
attributes: {
|
|
2460
2451
|
// add `role="textbox"` to the editor element
|
|
@@ -2462,7 +2453,7 @@ class Us extends nr {
|
|
|
2462
2453
|
...(t = this.options.editorProps) === null || t === void 0 ? void 0 : t.attributes
|
|
2463
2454
|
},
|
|
2464
2455
|
dispatchTransaction: this.dispatchTransaction.bind(this),
|
|
2465
|
-
state:
|
|
2456
|
+
state: Xe.create({
|
|
2466
2457
|
doc: n,
|
|
2467
2458
|
selection: r || void 0
|
|
2468
2459
|
})
|
|
@@ -2542,11 +2533,11 @@ class Us extends nr {
|
|
|
2542
2533
|
* Get attributes of the currently selected node or mark.
|
|
2543
2534
|
*/
|
|
2544
2535
|
getAttributes(t) {
|
|
2545
|
-
return
|
|
2536
|
+
return ze(this.state, t);
|
|
2546
2537
|
}
|
|
2547
2538
|
isActive(t, n) {
|
|
2548
2539
|
const r = typeof t == "string" ? t : null, s = typeof t == "string" ? n : t;
|
|
2549
|
-
return
|
|
2540
|
+
return ps(this.state, r, s);
|
|
2550
2541
|
}
|
|
2551
2542
|
/**
|
|
2552
2543
|
* Get the document as JSON.
|
|
@@ -2558,7 +2549,7 @@ class Us extends nr {
|
|
|
2558
2549
|
* Get the document as HTML.
|
|
2559
2550
|
*/
|
|
2560
2551
|
getHTML() {
|
|
2561
|
-
return
|
|
2552
|
+
return Kt(this.state.doc.content, this.schema);
|
|
2562
2553
|
}
|
|
2563
2554
|
/**
|
|
2564
2555
|
* Get the document as text.
|
|
@@ -2567,10 +2558,10 @@ class Us extends nr {
|
|
|
2567
2558
|
const { blockSeparator: n = `
|
|
2568
2559
|
|
|
2569
2560
|
`, textSerializers: r = {} } = t || {};
|
|
2570
|
-
return
|
|
2561
|
+
return as(this.state.doc, {
|
|
2571
2562
|
blockSeparator: n,
|
|
2572
2563
|
textSerializers: {
|
|
2573
|
-
|
|
2564
|
+
...He(this.schema),
|
|
2574
2565
|
...r
|
|
2575
2566
|
}
|
|
2576
2567
|
});
|
|
@@ -2622,7 +2613,7 @@ class Us extends nr {
|
|
|
2622
2613
|
return this.$pos(0);
|
|
2623
2614
|
}
|
|
2624
2615
|
}
|
|
2625
|
-
function
|
|
2616
|
+
function G(e) {
|
|
2626
2617
|
return new bt({
|
|
2627
2618
|
find: e.find,
|
|
2628
2619
|
handler: ({ state: t, range: n, match: r }) => {
|
|
@@ -2632,7 +2623,7 @@ function J(e) {
|
|
|
2632
2623
|
const { tr: o } = t, i = r[r.length - 1], a = r[0];
|
|
2633
2624
|
if (i) {
|
|
2634
2625
|
const c = a.search(/\S/), l = n.from + a.indexOf(i), u = l + i.length;
|
|
2635
|
-
if (
|
|
2626
|
+
if (Yt(n.from, n.to, t.doc).filter((h) => h.mark.type.excluded.find((f) => f === e.type && f !== h.mark.type)).filter((h) => h.to > l).length)
|
|
2636
2627
|
return null;
|
|
2637
2628
|
u < n.to && o.delete(u, n.to), l > n.from && o.delete(n.from + c, l);
|
|
2638
2629
|
const p = n.from + c + i.length;
|
|
@@ -2641,7 +2632,7 @@ function J(e) {
|
|
|
2641
2632
|
}
|
|
2642
2633
|
});
|
|
2643
2634
|
}
|
|
2644
|
-
function
|
|
2635
|
+
function We(e) {
|
|
2645
2636
|
return new bt({
|
|
2646
2637
|
find: e.find,
|
|
2647
2638
|
handler: ({ state: t, range: n, match: r }) => {
|
|
@@ -2662,7 +2653,7 @@ function Ke(e) {
|
|
|
2662
2653
|
}
|
|
2663
2654
|
});
|
|
2664
2655
|
}
|
|
2665
|
-
function
|
|
2656
|
+
function Ks(e) {
|
|
2666
2657
|
return new bt({
|
|
2667
2658
|
find: e.find,
|
|
2668
2659
|
handler: ({ state: t, range: n, match: r }) => {
|
|
@@ -2677,7 +2668,7 @@ function et(e) {
|
|
|
2677
2668
|
return new bt({
|
|
2678
2669
|
find: e.find,
|
|
2679
2670
|
handler: ({ state: t, range: n, match: r, chain: s }) => {
|
|
2680
|
-
const o = E(e.getAttributes, void 0, r) || {}, i = t.tr.delete(n.from, n.to), c = i.doc.resolve(n.from).blockRange(), l = c &&
|
|
2671
|
+
const o = E(e.getAttributes, void 0, r) || {}, i = t.tr.delete(n.from, n.to), c = i.doc.resolve(n.from).blockRange(), l = c && An(c, e.type, o);
|
|
2681
2672
|
if (!l)
|
|
2682
2673
|
return null;
|
|
2683
2674
|
if (i.wrap(c, l), e.keepMarks && e.editor) {
|
|
@@ -2692,11 +2683,11 @@ function et(e) {
|
|
|
2692
2683
|
s().updateAttributes(d, o).run();
|
|
2693
2684
|
}
|
|
2694
2685
|
const u = i.doc.resolve(n.from - 1).nodeBefore;
|
|
2695
|
-
u && u.type === e.type &&
|
|
2686
|
+
u && u.type === e.type && Ft(i.doc, n.from - 1) && (!e.joinPredicate || e.joinPredicate(r, u)) && i.join(n.from - 1);
|
|
2696
2687
|
}
|
|
2697
2688
|
});
|
|
2698
2689
|
}
|
|
2699
|
-
class
|
|
2690
|
+
class P {
|
|
2700
2691
|
constructor(t = {}) {
|
|
2701
2692
|
this.type = "node", this.name = "node", this.parent = null, this.child = null, this.config = {
|
|
2702
2693
|
name: this.name,
|
|
@@ -2712,7 +2703,7 @@ class _ {
|
|
|
2712
2703
|
})) || {};
|
|
2713
2704
|
}
|
|
2714
2705
|
static create(t = {}) {
|
|
2715
|
-
return new
|
|
2706
|
+
return new P(t);
|
|
2716
2707
|
}
|
|
2717
2708
|
configure(t = {}) {
|
|
2718
2709
|
const n = this.extend({
|
|
@@ -2722,7 +2713,7 @@ class _ {
|
|
|
2722
2713
|
return n.name = this.name, n.parent = this.parent, n;
|
|
2723
2714
|
}
|
|
2724
2715
|
extend(t = {}) {
|
|
2725
|
-
const n = new
|
|
2716
|
+
const n = new P(t);
|
|
2726
2717
|
return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = E(S(n, "addOptions", {
|
|
2727
2718
|
name: n.name
|
|
2728
2719
|
})), n.storage = E(S(n, "addStorage", {
|
|
@@ -2731,7 +2722,7 @@ class _ {
|
|
|
2731
2722
|
})), n;
|
|
2732
2723
|
}
|
|
2733
2724
|
}
|
|
2734
|
-
class
|
|
2725
|
+
class Us {
|
|
2735
2726
|
constructor(t, n, r) {
|
|
2736
2727
|
this.isDragging = !1, this.component = t, this.editor = n.editor, this.options = {
|
|
2737
2728
|
stopEvent: null,
|
|
@@ -2798,7 +2789,7 @@ class qs {
|
|
|
2798
2789
|
* @return `true` if it can safely be ignored.
|
|
2799
2790
|
*/
|
|
2800
2791
|
ignoreMutation(t) {
|
|
2801
|
-
return !this.dom || !this.contentDOM ? !0 : typeof this.options.ignoreMutation == "function" ? this.options.ignoreMutation({ mutation: t }) : this.node.isLeaf || this.node.isAtom ? !0 : t.type === "selection" || this.dom.contains(t.target) && t.type === "childList" && (St() ||
|
|
2792
|
+
return !this.dom || !this.contentDOM ? !0 : typeof this.options.ignoreMutation == "function" ? this.options.ignoreMutation({ mutation: t }) : this.node.isLeaf || this.node.isAtom ? !0 : t.type === "selection" || this.dom.contains(t.target) && t.type === "childList" && (St() || De()) && this.editor.isFocused && [
|
|
2802
2793
|
...Array.from(t.addedNodes),
|
|
2803
2794
|
...Array.from(t.removedNodes)
|
|
2804
2795
|
].every((r) => r.isContentEditable) ? !1 : this.contentDOM === t.target && t.type === "attributes" ? !0 : !this.contentDOM.contains(t.target);
|
|
@@ -2827,7 +2818,7 @@ class qs {
|
|
|
2827
2818
|
}
|
|
2828
2819
|
}
|
|
2829
2820
|
function W(e) {
|
|
2830
|
-
return new
|
|
2821
|
+
return new Pe({
|
|
2831
2822
|
find: e.find,
|
|
2832
2823
|
handler: ({ state: t, range: n, match: r, pasteEvent: s }) => {
|
|
2833
2824
|
const o = E(e.getAttributes, void 0, r, s);
|
|
@@ -2837,18 +2828,18 @@ function W(e) {
|
|
|
2837
2828
|
let l = n.to;
|
|
2838
2829
|
if (a) {
|
|
2839
2830
|
const u = c.search(/\S/), d = n.from + c.indexOf(a), p = d + a.length;
|
|
2840
|
-
if (
|
|
2831
|
+
if (Yt(n.from, n.to, t.doc).filter((m) => m.mark.type.excluded.find((g) => g === e.type && g !== m.mark.type)).filter((m) => m.to > d).length)
|
|
2841
2832
|
return null;
|
|
2842
2833
|
p < n.to && i.delete(p, n.to), d > n.from && i.delete(n.from + u, d), l = n.from + u + a.length, i.addMark(n.from + u, l, e.type.create(o || {})), i.removeStoredMark(e.type);
|
|
2843
2834
|
}
|
|
2844
2835
|
}
|
|
2845
2836
|
});
|
|
2846
2837
|
}
|
|
2847
|
-
function
|
|
2838
|
+
function qs(e) {
|
|
2848
2839
|
return e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
2849
2840
|
}
|
|
2850
|
-
function
|
|
2851
|
-
return new
|
|
2841
|
+
function ri(e) {
|
|
2842
|
+
return new Pe({
|
|
2852
2843
|
find: e.find,
|
|
2853
2844
|
handler({ match: t, chain: n, range: r, pasteEvent: s }) {
|
|
2854
2845
|
const o = E(e.getAttributes, void 0, t, s), i = E(e.getContent, void 0, o);
|
|
@@ -2859,10 +2850,10 @@ function ii(e) {
|
|
|
2859
2850
|
}
|
|
2860
2851
|
});
|
|
2861
2852
|
}
|
|
2862
|
-
class
|
|
2853
|
+
class Gs {
|
|
2863
2854
|
constructor({ editor: t, element: n, view: r, tippyOptions: s = {}, updateDelay: o = 250, shouldShow: i }) {
|
|
2864
2855
|
this.preventHide = !1, this.shouldShow = ({ view: a, state: c, from: l, to: u }) => {
|
|
2865
|
-
const { doc: d, selection: p } = c, { empty: h } = p, m = !d.textBetween(l, u).length &&
|
|
2856
|
+
const { doc: d, selection: p } = c, { empty: h } = p, m = !d.textBetween(l, u).length && Gt(c.selection), f = this.element.contains(document.activeElement);
|
|
2866
2857
|
return !(!(a.hasFocus() || f) || h || m || !this.editor.isEditable);
|
|
2867
2858
|
}, this.mousedownHandler = () => {
|
|
2868
2859
|
this.preventHide = !0;
|
|
@@ -2905,7 +2896,7 @@ class Js {
|
|
|
2905
2896
|
}
|
|
2906
2897
|
(p = this.tippy) === null || p === void 0 || p.setProps({
|
|
2907
2898
|
getReferenceClientRect: ((h = this.tippyOptions) === null || h === void 0 ? void 0 : h.getReferenceClientRect) || (() => {
|
|
2908
|
-
if (
|
|
2899
|
+
if (Ve(m.selection)) {
|
|
2909
2900
|
let k = a.nodeDOM(v);
|
|
2910
2901
|
if (k) {
|
|
2911
2902
|
const T = k.dataset.nodeViewWrapper ? k : k.querySelector("[data-node-view-wrapper]");
|
|
@@ -2913,14 +2904,14 @@ class Js {
|
|
|
2913
2904
|
return k.getBoundingClientRect();
|
|
2914
2905
|
}
|
|
2915
2906
|
}
|
|
2916
|
-
return
|
|
2907
|
+
return hs(a, v, b);
|
|
2917
2908
|
})
|
|
2918
2909
|
}), this.show();
|
|
2919
2910
|
}, this.editor = t, this.element = n, this.view = r, this.updateDelay = o, i && (this.shouldShow = i), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.tippyOptions = s, this.element.remove(), this.element.style.visibility = "visible";
|
|
2920
2911
|
}
|
|
2921
2912
|
createTooltip() {
|
|
2922
2913
|
const { element: t } = this.editor.options, n = !!t.parentElement;
|
|
2923
|
-
this.tippy || !n || (this.tippy =
|
|
2914
|
+
this.tippy || !n || (this.tippy = Je(t, {
|
|
2924
2915
|
duration: 0,
|
|
2925
2916
|
getReferenceClientRect: null,
|
|
2926
2917
|
content: this.element,
|
|
@@ -2953,11 +2944,11 @@ class Js {
|
|
|
2953
2944
|
!((t = this.tippy) === null || t === void 0) && t.popper.firstChild && this.tippy.popper.firstChild.removeEventListener("blur", this.tippyBlurHandler), (n = this.tippy) === null || n === void 0 || n.destroy(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler);
|
|
2954
2945
|
}
|
|
2955
2946
|
}
|
|
2956
|
-
const
|
|
2957
|
-
key: typeof e.pluginKey == "string" ? new
|
|
2958
|
-
view: (t) => new
|
|
2947
|
+
const Ke = (e) => new H({
|
|
2948
|
+
key: typeof e.pluginKey == "string" ? new I(e.pluginKey) : e.pluginKey,
|
|
2949
|
+
view: (t) => new Gs({ view: t, ...e })
|
|
2959
2950
|
});
|
|
2960
|
-
|
|
2951
|
+
_.create({
|
|
2961
2952
|
name: "bubbleMenu",
|
|
2962
2953
|
addOptions() {
|
|
2963
2954
|
return {
|
|
@@ -2970,7 +2961,7 @@ P.create({
|
|
|
2970
2961
|
},
|
|
2971
2962
|
addProseMirrorPlugins() {
|
|
2972
2963
|
return this.options.element ? [
|
|
2973
|
-
|
|
2964
|
+
Ke({
|
|
2974
2965
|
pluginKey: this.options.pluginKey,
|
|
2975
2966
|
editor: this.editor,
|
|
2976
2967
|
element: this.options.element,
|
|
@@ -2981,10 +2972,10 @@ P.create({
|
|
|
2981
2972
|
] : [];
|
|
2982
2973
|
}
|
|
2983
2974
|
});
|
|
2984
|
-
function
|
|
2975
|
+
function Js(e) {
|
|
2985
2976
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
2986
2977
|
}
|
|
2987
|
-
var
|
|
2978
|
+
var Dt = { exports: {} }, _t = {};
|
|
2988
2979
|
/**
|
|
2989
2980
|
* @license React
|
|
2990
2981
|
* use-sync-external-store-shim.production.min.js
|
|
@@ -2994,11 +2985,11 @@ var Nt = { exports: {} }, _t = {};
|
|
|
2994
2985
|
* This source code is licensed under the MIT license found in the
|
|
2995
2986
|
* LICENSE file in the root directory of this source tree.
|
|
2996
2987
|
*/
|
|
2997
|
-
var
|
|
2998
|
-
function
|
|
2999
|
-
if (
|
|
3000
|
-
|
|
3001
|
-
var e =
|
|
2988
|
+
var pe;
|
|
2989
|
+
function Ys() {
|
|
2990
|
+
if (pe) return _t;
|
|
2991
|
+
pe = 1;
|
|
2992
|
+
var e = L;
|
|
3002
2993
|
function t(d, p) {
|
|
3003
2994
|
return d === p && (d !== 0 || 1 / d === 1 / p) || d !== d && p !== p;
|
|
3004
2995
|
}
|
|
@@ -3039,11 +3030,11 @@ var Pt = {};
|
|
|
3039
3030
|
* This source code is licensed under the MIT license found in the
|
|
3040
3031
|
* LICENSE file in the root directory of this source tree.
|
|
3041
3032
|
*/
|
|
3042
|
-
var
|
|
3043
|
-
function
|
|
3044
|
-
return
|
|
3033
|
+
var he;
|
|
3034
|
+
function Xs() {
|
|
3035
|
+
return he || (he = 1, process.env.NODE_ENV !== "production" && function() {
|
|
3045
3036
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
3046
|
-
var e =
|
|
3037
|
+
var e = L, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
3047
3038
|
function n(v) {
|
|
3048
3039
|
{
|
|
3049
3040
|
for (var b = arguments.length, w = new Array(b > 1 ? b - 1 : 0), k = 1; k < b; k++)
|
|
@@ -3055,8 +3046,8 @@ function Qs() {
|
|
|
3055
3046
|
{
|
|
3056
3047
|
var k = t.ReactDebugCurrentFrame, T = k.getStackAddendum();
|
|
3057
3048
|
T !== "" && (b += "%s", w = w.concat([T]));
|
|
3058
|
-
var x = w.map(function(
|
|
3059
|
-
return String(
|
|
3049
|
+
var x = w.map(function(O) {
|
|
3050
|
+
return String(O);
|
|
3060
3051
|
});
|
|
3061
3052
|
x.unshift("Warning: " + b), Function.prototype.apply.call(console[v], console, x);
|
|
3062
3053
|
}
|
|
@@ -3077,21 +3068,21 @@ function Qs() {
|
|
|
3077
3068
|
value: k,
|
|
3078
3069
|
getSnapshot: b
|
|
3079
3070
|
}
|
|
3080
|
-
}),
|
|
3071
|
+
}), O = x[0].inst, A = x[1];
|
|
3081
3072
|
return c(function() {
|
|
3082
|
-
|
|
3083
|
-
inst:
|
|
3073
|
+
O.value = k, O.getSnapshot = b, h(O) && A({
|
|
3074
|
+
inst: O
|
|
3084
3075
|
});
|
|
3085
3076
|
}, [v, k, b]), a(function() {
|
|
3086
|
-
h(
|
|
3087
|
-
inst:
|
|
3077
|
+
h(O) && A({
|
|
3078
|
+
inst: O
|
|
3088
3079
|
});
|
|
3089
|
-
var
|
|
3090
|
-
h(
|
|
3091
|
-
inst:
|
|
3080
|
+
var $ = function() {
|
|
3081
|
+
h(O) && A({
|
|
3082
|
+
inst: O
|
|
3092
3083
|
});
|
|
3093
3084
|
};
|
|
3094
|
-
return v(
|
|
3085
|
+
return v($);
|
|
3095
3086
|
}, [v]), l(k), k;
|
|
3096
3087
|
}
|
|
3097
3088
|
function h(v) {
|
|
@@ -3110,17 +3101,17 @@ function Qs() {
|
|
|
3110
3101
|
Pt.useSyncExternalStore = M, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
3111
3102
|
}()), Pt;
|
|
3112
3103
|
}
|
|
3113
|
-
process.env.NODE_ENV === "production" ?
|
|
3114
|
-
var Et =
|
|
3115
|
-
const
|
|
3104
|
+
process.env.NODE_ENV === "production" ? Dt.exports = Ys() : Dt.exports = Xs();
|
|
3105
|
+
var Et = Dt.exports;
|
|
3106
|
+
const Qs = (...e) => (t) => {
|
|
3116
3107
|
e.forEach((n) => {
|
|
3117
3108
|
typeof n == "function" ? n(t) : n && (n.current = t);
|
|
3118
3109
|
});
|
|
3119
|
-
},
|
|
3110
|
+
}, Zs = ({ contentComponent: e }) => {
|
|
3120
3111
|
const t = Et.useSyncExternalStore(e.subscribe, e.getSnapshot, e.getServerSnapshot);
|
|
3121
|
-
return
|
|
3112
|
+
return L.createElement(L.Fragment, null, Object.values(t));
|
|
3122
3113
|
};
|
|
3123
|
-
function
|
|
3114
|
+
function to() {
|
|
3124
3115
|
const e = /* @__PURE__ */ new Set();
|
|
3125
3116
|
let t = {};
|
|
3126
3117
|
return {
|
|
@@ -3144,7 +3135,7 @@ function eo() {
|
|
|
3144
3135
|
setRenderer(n, r) {
|
|
3145
3136
|
t = {
|
|
3146
3137
|
...t,
|
|
3147
|
-
[n]:
|
|
3138
|
+
[n]: Qn.createPortal(r.reactElement, r.element, n)
|
|
3148
3139
|
}, e.forEach((s) => s());
|
|
3149
3140
|
},
|
|
3150
3141
|
/**
|
|
@@ -3156,10 +3147,10 @@ function eo() {
|
|
|
3156
3147
|
}
|
|
3157
3148
|
};
|
|
3158
3149
|
}
|
|
3159
|
-
class
|
|
3150
|
+
class eo extends L.Component {
|
|
3160
3151
|
constructor(t) {
|
|
3161
3152
|
var n;
|
|
3162
|
-
super(t), this.editorContentRef =
|
|
3153
|
+
super(t), this.editorContentRef = L.createRef(), this.initialized = !1, this.state = {
|
|
3163
3154
|
hasContentComponentInitialized: !!(!((n = t.editor) === null || n === void 0) && n.contentComponent)
|
|
3164
3155
|
};
|
|
3165
3156
|
}
|
|
@@ -3177,7 +3168,7 @@ class no extends O.Component {
|
|
|
3177
3168
|
const n = this.editorContentRef.current;
|
|
3178
3169
|
n.append(...t.options.element.childNodes), t.setOptions({
|
|
3179
3170
|
element: n
|
|
3180
|
-
}), t.contentComponent =
|
|
3171
|
+
}), t.contentComponent = to(), this.state.hasContentComponentInitialized || (this.unsubscribeToContentComponent = t.contentComponent.subscribe(() => {
|
|
3181
3172
|
this.setState((r) => r.hasContentComponentInitialized ? r : {
|
|
3182
3173
|
hasContentComponentInitialized: !0
|
|
3183
3174
|
}), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent();
|
|
@@ -3197,23 +3188,23 @@ class no extends O.Component {
|
|
|
3197
3188
|
}
|
|
3198
3189
|
render() {
|
|
3199
3190
|
const { editor: t, innerRef: n, ...r } = this.props;
|
|
3200
|
-
return
|
|
3201
|
-
|
|
3191
|
+
return L.createElement(
|
|
3192
|
+
L.Fragment,
|
|
3202
3193
|
null,
|
|
3203
|
-
|
|
3204
|
-
(t == null ? void 0 : t.contentComponent) &&
|
|
3194
|
+
L.createElement("div", { ref: Qs(n, this.editorContentRef), ...r }),
|
|
3195
|
+
(t == null ? void 0 : t.contentComponent) && L.createElement(Zs, { contentComponent: t.contentComponent })
|
|
3205
3196
|
);
|
|
3206
3197
|
}
|
|
3207
3198
|
}
|
|
3208
|
-
const
|
|
3209
|
-
const n =
|
|
3210
|
-
return
|
|
3199
|
+
const no = Yn((e, t) => {
|
|
3200
|
+
const n = L.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [e.editor]);
|
|
3201
|
+
return L.createElement(eo, {
|
|
3211
3202
|
key: n,
|
|
3212
3203
|
innerRef: t,
|
|
3213
3204
|
...e
|
|
3214
3205
|
});
|
|
3215
|
-
}),
|
|
3216
|
-
var
|
|
3206
|
+
}), si = L.memo(no);
|
|
3207
|
+
var ro = function e(t, n) {
|
|
3217
3208
|
if (t === n) return !0;
|
|
3218
3209
|
if (t && n && typeof t == "object" && typeof n == "object") {
|
|
3219
3210
|
if (t.constructor !== n.constructor) return !1;
|
|
@@ -3258,7 +3249,7 @@ var so = function e(t, n) {
|
|
|
3258
3249
|
return !0;
|
|
3259
3250
|
}
|
|
3260
3251
|
return t !== t && n !== n;
|
|
3261
|
-
},
|
|
3252
|
+
}, so = /* @__PURE__ */ Js(ro), Nt = { exports: {} }, Rt = {};
|
|
3262
3253
|
/**
|
|
3263
3254
|
* @license React
|
|
3264
3255
|
* use-sync-external-store-shim/with-selector.production.min.js
|
|
@@ -3268,11 +3259,11 @@ var so = function e(t, n) {
|
|
|
3268
3259
|
* This source code is licensed under the MIT license found in the
|
|
3269
3260
|
* LICENSE file in the root directory of this source tree.
|
|
3270
3261
|
*/
|
|
3271
|
-
var
|
|
3272
|
-
function
|
|
3273
|
-
if (
|
|
3274
|
-
|
|
3275
|
-
var e =
|
|
3262
|
+
var fe;
|
|
3263
|
+
function oo() {
|
|
3264
|
+
if (fe) return Rt;
|
|
3265
|
+
fe = 1;
|
|
3266
|
+
var e = L, t = Et;
|
|
3276
3267
|
function n(l, u) {
|
|
3277
3268
|
return l === u && (l !== 0 || 1 / l === 1 / u) || l !== l && u !== u;
|
|
3278
3269
|
}
|
|
@@ -3319,11 +3310,11 @@ var Ht = {};
|
|
|
3319
3310
|
* This source code is licensed under the MIT license found in the
|
|
3320
3311
|
* LICENSE file in the root directory of this source tree.
|
|
3321
3312
|
*/
|
|
3322
|
-
var
|
|
3323
|
-
function
|
|
3324
|
-
return
|
|
3313
|
+
var me;
|
|
3314
|
+
function io() {
|
|
3315
|
+
return me || (me = 1, process.env.NODE_ENV !== "production" && function() {
|
|
3325
3316
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
3326
|
-
var e =
|
|
3317
|
+
var e = L, t = Et;
|
|
3327
3318
|
function n(u, d) {
|
|
3328
3319
|
return u === d && (u !== 0 || 1 / u === 1 / d) || u !== u && d !== d;
|
|
3329
3320
|
}
|
|
@@ -3338,25 +3329,25 @@ function ao() {
|
|
|
3338
3329
|
var w = !1, k, T, x = function(B) {
|
|
3339
3330
|
if (!w) {
|
|
3340
3331
|
w = !0, k = B;
|
|
3341
|
-
var
|
|
3332
|
+
var J = h(B);
|
|
3342
3333
|
if (m !== void 0 && g.hasValue) {
|
|
3343
|
-
var
|
|
3344
|
-
if (m(
|
|
3345
|
-
return T =
|
|
3334
|
+
var Y = g.value;
|
|
3335
|
+
if (m(Y, J))
|
|
3336
|
+
return T = Y, Y;
|
|
3346
3337
|
}
|
|
3347
|
-
return T =
|
|
3338
|
+
return T = J, J;
|
|
3348
3339
|
}
|
|
3349
3340
|
var nt = k, j = T;
|
|
3350
3341
|
if (r(nt, B))
|
|
3351
3342
|
return j;
|
|
3352
3343
|
var z = h(B);
|
|
3353
3344
|
return m !== void 0 && m(j, z) ? j : (k = B, T = z, z);
|
|
3354
|
-
},
|
|
3345
|
+
}, O = p === void 0 ? null : p, A = function() {
|
|
3355
3346
|
return x(d());
|
|
3356
|
-
},
|
|
3357
|
-
return x(
|
|
3347
|
+
}, $ = O === null ? void 0 : function() {
|
|
3348
|
+
return x(O());
|
|
3358
3349
|
};
|
|
3359
|
-
return [A,
|
|
3350
|
+
return [A, $];
|
|
3360
3351
|
}, [d, p, h, m]), M = y[0], v = y[1], b = s(u, M, v);
|
|
3361
3352
|
return i(function() {
|
|
3362
3353
|
g.hasValue = !0, g.value = b;
|
|
@@ -3365,10 +3356,10 @@ function ao() {
|
|
|
3365
3356
|
Ht.useSyncExternalStoreWithSelector = l, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
3366
3357
|
}()), Ht;
|
|
3367
3358
|
}
|
|
3368
|
-
process.env.NODE_ENV === "production" ?
|
|
3369
|
-
var
|
|
3370
|
-
const
|
|
3371
|
-
class
|
|
3359
|
+
process.env.NODE_ENV === "production" ? Nt.exports = oo() : Nt.exports = io();
|
|
3360
|
+
var ao = Nt.exports;
|
|
3361
|
+
const lo = typeof window < "u" ? Xn : Wt;
|
|
3362
|
+
class co {
|
|
3372
3363
|
constructor(t) {
|
|
3373
3364
|
this.transactionNumber = 0, this.lastTransactionNumber = 0, this.subscribers = /* @__PURE__ */ new Set(), this.editor = t, this.lastSnapshot = { editor: t, transactionNumber: 0 }, this.getSnapshot = this.getSnapshot.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.watch = this.watch.bind(this), this.subscribe = this.subscribe.bind(this);
|
|
3374
3365
|
}
|
|
@@ -3406,13 +3397,13 @@ class uo {
|
|
|
3406
3397
|
}
|
|
3407
3398
|
}
|
|
3408
3399
|
}
|
|
3409
|
-
function
|
|
3400
|
+
function uo(e) {
|
|
3410
3401
|
var t;
|
|
3411
|
-
const [n] =
|
|
3412
|
-
return
|
|
3402
|
+
const [n] = Vt(() => new co(e.editor)), r = ao.useSyncExternalStoreWithSelector(n.subscribe, n.getSnapshot, n.getServerSnapshot, e.selector, (t = e.equalityFn) !== null && t !== void 0 ? t : so);
|
|
3403
|
+
return lo(() => n.watch(e.editor), [e.editor, n]), xe(r), r;
|
|
3413
3404
|
}
|
|
3414
|
-
const
|
|
3415
|
-
class
|
|
3405
|
+
const ge = process.env.NODE_ENV !== "production", Bt = typeof window > "u", po = Bt || !!(typeof window < "u" && window.next);
|
|
3406
|
+
class Xt {
|
|
3416
3407
|
constructor(t) {
|
|
3417
3408
|
this.editor = null, this.subscriptions = /* @__PURE__ */ new Set(), this.isComponentMounted = !1, this.previousDeps = null, this.instanceId = "", this.options = t, this.subscriptions = /* @__PURE__ */ new Set(), this.setEditor(this.getInitialEditor()), this.scheduleDestroy(), this.getEditor = this.getEditor.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.subscribe = this.subscribe.bind(this), this.refreshEditorInstance = this.refreshEditorInstance.bind(this), this.scheduleDestroy = this.scheduleDestroy.bind(this), this.onRender = this.onRender.bind(this), this.createEditor = this.createEditor.bind(this);
|
|
3418
3409
|
}
|
|
@@ -3421,8 +3412,8 @@ class Qt {
|
|
|
3421
3412
|
}
|
|
3422
3413
|
getInitialEditor() {
|
|
3423
3414
|
if (this.options.current.immediatelyRender === void 0)
|
|
3424
|
-
return
|
|
3425
|
-
if (this.options.current.immediatelyRender &&
|
|
3415
|
+
return Bt || po ? (ge && console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."), null) : this.createEditor();
|
|
3416
|
+
if (this.options.current.immediatelyRender && Bt && ge)
|
|
3426
3417
|
throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");
|
|
3427
3418
|
return this.options.current.immediatelyRender ? this.createEditor() : null;
|
|
3428
3419
|
}
|
|
@@ -3478,7 +3469,7 @@ class Qt {
|
|
|
3478
3469
|
return (o = (s = this.options.current).onPaste) === null || o === void 0 ? void 0 : o.call(s, ...r);
|
|
3479
3470
|
}
|
|
3480
3471
|
};
|
|
3481
|
-
return new
|
|
3472
|
+
return new Ws(t);
|
|
3482
3473
|
}
|
|
3483
3474
|
/**
|
|
3484
3475
|
* Get the current editor instance.
|
|
@@ -3512,7 +3503,7 @@ class Qt {
|
|
|
3512
3503
|
* @returns A cleanup function
|
|
3513
3504
|
*/
|
|
3514
3505
|
onRender(t) {
|
|
3515
|
-
return () => (this.isComponentMounted = !0, clearTimeout(this.scheduledDestructionTimeout), this.editor && !this.editor.isDestroyed && t.length === 0 ?
|
|
3506
|
+
return () => (this.isComponentMounted = !0, clearTimeout(this.scheduledDestructionTimeout), this.editor && !this.editor.isDestroyed && t.length === 0 ? Xt.compareOptions(this.options.current, this.editor.options) || this.editor.setOptions({
|
|
3516
3507
|
...this.options.current,
|
|
3517
3508
|
editable: this.editor.isEditable
|
|
3518
3509
|
}) : this.refreshEditorInstance(t), () => {
|
|
@@ -3549,22 +3540,22 @@ class Qt {
|
|
|
3549
3540
|
}, 1);
|
|
3550
3541
|
}
|
|
3551
3542
|
}
|
|
3552
|
-
function
|
|
3553
|
-
const n =
|
|
3543
|
+
function oi(e = {}, t = []) {
|
|
3544
|
+
const n = Jn(e);
|
|
3554
3545
|
n.current = e;
|
|
3555
|
-
const [r] =
|
|
3556
|
-
return
|
|
3546
|
+
const [r] = Vt(() => new Xt(n)), s = Et.useSyncExternalStore(r.subscribe, r.getEditor, r.getServerSnapshot);
|
|
3547
|
+
return xe(s), Wt(r.onRender(t)), uo({
|
|
3557
3548
|
editor: s,
|
|
3558
3549
|
selector: ({ transactionNumber: o }) => e.shouldRerenderOnTransaction === !1 ? null : e.immediatelyRender && o === 0 ? 0 : o + 1
|
|
3559
3550
|
}), s;
|
|
3560
3551
|
}
|
|
3561
|
-
const
|
|
3552
|
+
const Ue = Oe({
|
|
3562
3553
|
editor: null
|
|
3563
3554
|
});
|
|
3564
|
-
|
|
3565
|
-
const
|
|
3566
|
-
const [t, n] =
|
|
3567
|
-
return
|
|
3555
|
+
Ue.Consumer;
|
|
3556
|
+
const ho = () => Ae(Ue), ii = (e) => {
|
|
3557
|
+
const [t, n] = Vt(null), { editor: r } = ho();
|
|
3558
|
+
return Wt(() => {
|
|
3568
3559
|
var s;
|
|
3569
3560
|
if (!t || !((s = e.editor) === null || s === void 0) && s.isDestroyed || r != null && r.isDestroyed)
|
|
3570
3561
|
return;
|
|
@@ -3573,7 +3564,7 @@ const fo = () => Oe(qe), ci = (e) => {
|
|
|
3573
3564
|
console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
|
|
3574
3565
|
return;
|
|
3575
3566
|
}
|
|
3576
|
-
const d =
|
|
3567
|
+
const d = Ke({
|
|
3577
3568
|
updateDelay: c,
|
|
3578
3569
|
editor: u,
|
|
3579
3570
|
element: t,
|
|
@@ -3584,23 +3575,14 @@ const fo = () => Oe(qe), ci = (e) => {
|
|
|
3584
3575
|
return u.registerPlugin(d), () => {
|
|
3585
3576
|
u.unregisterPlugin(o);
|
|
3586
3577
|
};
|
|
3587
|
-
}, [e.editor, r, t]),
|
|
3588
|
-
},
|
|
3578
|
+
}, [e.editor, r, t]), L.createElement("div", { ref: n, className: e.className, style: { visibility: "hidden" } }, e.children);
|
|
3579
|
+
}, qe = Oe({
|
|
3589
3580
|
onDragStart: void 0
|
|
3590
|
-
}),
|
|
3591
|
-
const
|
|
3581
|
+
}), fo = () => Ae(qe), ai = L.forwardRef((e, t) => {
|
|
3582
|
+
const { onDragStart: n } = fo(), r = e.as || "div";
|
|
3592
3583
|
return (
|
|
3593
3584
|
// @ts-ignore
|
|
3594
|
-
|
|
3595
|
-
whiteSpace: "pre-wrap",
|
|
3596
|
-
...e.style
|
|
3597
|
-
} })
|
|
3598
|
-
);
|
|
3599
|
-
}, ui = O.forwardRef((e, t) => {
|
|
3600
|
-
const { onDragStart: n } = Je(), r = e.as || "div";
|
|
3601
|
-
return (
|
|
3602
|
-
// @ts-ignore
|
|
3603
|
-
O.createElement(r, { ...e, ref: t, "data-node-view-wrapper": "", onDragStart: n, style: {
|
|
3585
|
+
L.createElement(r, { ...e, ref: t, "data-node-view-wrapper": "", onDragStart: n, style: {
|
|
3604
3586
|
whiteSpace: "normal",
|
|
3605
3587
|
...e.style
|
|
3606
3588
|
} })
|
|
@@ -3618,7 +3600,7 @@ class yo {
|
|
|
3618
3600
|
* Immediately creates element and renders the provided React component.
|
|
3619
3601
|
*/
|
|
3620
3602
|
constructor(t, { editor: n, props: r = {}, as: s = "div", className: o = "" }) {
|
|
3621
|
-
this.ref = null, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = t, this.editor = n, this.props = r, this.element = document.createElement(s), this.element.classList.add("react-renderer"), o && this.element.classList.add(...o.split(" ")), this.editor.isInitialized ?
|
|
3603
|
+
this.ref = null, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = t, this.editor = n, this.props = r, this.element = document.createElement(s), this.element.classList.add("react-renderer"), o && this.element.classList.add(...o.split(" ")), this.editor.isInitialized ? Zn(() => {
|
|
3622
3604
|
this.render();
|
|
3623
3605
|
}) : this.render();
|
|
3624
3606
|
}
|
|
@@ -3630,7 +3612,7 @@ class yo {
|
|
|
3630
3612
|
const n = this.component, r = this.props, s = this.editor;
|
|
3631
3613
|
(mo(n) || go(n)) && (r.ref = (o) => {
|
|
3632
3614
|
this.ref = o;
|
|
3633
|
-
}), this.reactElement =
|
|
3615
|
+
}), this.reactElement = L.createElement(n, { ...r }), (t = s == null ? void 0 : s.contentComponent) === null || t === void 0 || t.setRenderer(this.id, this);
|
|
3634
3616
|
}
|
|
3635
3617
|
/**
|
|
3636
3618
|
* Re-renders the React component with new props.
|
|
@@ -3658,7 +3640,7 @@ class yo {
|
|
|
3658
3640
|
});
|
|
3659
3641
|
}
|
|
3660
3642
|
}
|
|
3661
|
-
class vo extends
|
|
3643
|
+
class vo extends Us {
|
|
3662
3644
|
/**
|
|
3663
3645
|
* Setup the React component.
|
|
3664
3646
|
* Called on initialization.
|
|
@@ -3683,7 +3665,7 @@ class vo extends qs {
|
|
|
3683
3665
|
}
|
|
3684
3666
|
const s = { onDragStart: this.onDragStart.bind(this), nodeViewContentRef: (l) => {
|
|
3685
3667
|
l && this.contentDOMElement && l.firstChild !== this.contentDOMElement && l.appendChild(this.contentDOMElement);
|
|
3686
|
-
} }, o = this.component, i =
|
|
3668
|
+
} }, o = this.component, i = L.memo((l) => L.createElement(qe.Provider, { value: s }, L.createElement(o, l)));
|
|
3687
3669
|
i.displayName = "ReactNodeView", this.node.isLeaf ? this.contentDOMElement = null : this.options.contentDOMElementTag ? this.contentDOMElement = document.createElement(this.options.contentDOMElementTag) : this.contentDOMElement = document.createElement(this.node.isInline ? "span" : "div"), this.contentDOMElement && (this.contentDOMElement.dataset.nodeViewContentReact = "", this.contentDOMElement.style.whiteSpace = "inherit");
|
|
3688
3670
|
let a = this.node.isInline ? "span" : "div";
|
|
3689
3671
|
this.options.as && (a = this.options.as);
|
|
@@ -3793,10 +3775,10 @@ class vo extends qs {
|
|
|
3793
3775
|
}
|
|
3794
3776
|
}
|
|
3795
3777
|
}
|
|
3796
|
-
function
|
|
3778
|
+
function li(e, t) {
|
|
3797
3779
|
return (n) => n.editor.contentComponent ? new vo(e, n, t) : {};
|
|
3798
3780
|
}
|
|
3799
|
-
const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, So = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, ko = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,
|
|
3781
|
+
const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, So = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, ko = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, ci = N.create({
|
|
3800
3782
|
name: "bold",
|
|
3801
3783
|
addOptions() {
|
|
3802
3784
|
return {
|
|
@@ -3840,11 +3822,11 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
3840
3822
|
},
|
|
3841
3823
|
addInputRules() {
|
|
3842
3824
|
return [
|
|
3843
|
-
|
|
3825
|
+
G({
|
|
3844
3826
|
find: bo,
|
|
3845
3827
|
type: this.type
|
|
3846
3828
|
}),
|
|
3847
|
-
|
|
3829
|
+
G({
|
|
3848
3830
|
find: So,
|
|
3849
3831
|
type: this.type
|
|
3850
3832
|
})
|
|
@@ -3862,7 +3844,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
3862
3844
|
})
|
|
3863
3845
|
];
|
|
3864
3846
|
}
|
|
3865
|
-
}), wo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, Eo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, To = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, Co = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,
|
|
3847
|
+
}), wo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, Eo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, To = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, Co = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, di = N.create({
|
|
3866
3848
|
name: "italic",
|
|
3867
3849
|
addOptions() {
|
|
3868
3850
|
return {
|
|
@@ -3905,11 +3887,11 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
3905
3887
|
},
|
|
3906
3888
|
addInputRules() {
|
|
3907
3889
|
return [
|
|
3908
|
-
|
|
3890
|
+
G({
|
|
3909
3891
|
find: wo,
|
|
3910
3892
|
type: this.type
|
|
3911
3893
|
}),
|
|
3912
|
-
|
|
3894
|
+
G({
|
|
3913
3895
|
find: To,
|
|
3914
3896
|
type: this.type
|
|
3915
3897
|
})
|
|
@@ -3927,7 +3909,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
3927
3909
|
})
|
|
3928
3910
|
];
|
|
3929
3911
|
}
|
|
3930
|
-
}),
|
|
3912
|
+
}), ui = N.create({
|
|
3931
3913
|
name: "underline",
|
|
3932
3914
|
addOptions() {
|
|
3933
3915
|
return {
|
|
@@ -3962,7 +3944,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
3962
3944
|
"Mod-U": () => this.editor.commands.toggleUnderline()
|
|
3963
3945
|
};
|
|
3964
3946
|
}
|
|
3965
|
-
}), xo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, Ao = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,
|
|
3947
|
+
}), xo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, Ao = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, pi = N.create({
|
|
3966
3948
|
name: "strike",
|
|
3967
3949
|
addOptions() {
|
|
3968
3950
|
return {
|
|
@@ -4004,7 +3986,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4004
3986
|
},
|
|
4005
3987
|
addInputRules() {
|
|
4006
3988
|
return [
|
|
4007
|
-
|
|
3989
|
+
G({
|
|
4008
3990
|
find: xo,
|
|
4009
3991
|
type: this.type
|
|
4010
3992
|
})
|
|
@@ -4018,7 +4000,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4018
4000
|
})
|
|
4019
4001
|
];
|
|
4020
4002
|
}
|
|
4021
|
-
}), Oo = /(^|[^`])`([^`]+)`(?!`)/, Lo = /(^|[^`])`([^`]+)`(?!`)/g,
|
|
4003
|
+
}), Oo = /(^|[^`])`([^`]+)`(?!`)/, Lo = /(^|[^`])`([^`]+)`(?!`)/g, hi = N.create({
|
|
4022
4004
|
name: "code",
|
|
4023
4005
|
addOptions() {
|
|
4024
4006
|
return {
|
|
@@ -4050,7 +4032,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4050
4032
|
},
|
|
4051
4033
|
addInputRules() {
|
|
4052
4034
|
return [
|
|
4053
|
-
|
|
4035
|
+
G({
|
|
4054
4036
|
find: Oo,
|
|
4055
4037
|
type: this.type
|
|
4056
4038
|
})
|
|
@@ -4064,134 +4046,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4064
4046
|
})
|
|
4065
4047
|
];
|
|
4066
4048
|
}
|
|
4067
|
-
}), _o =
|
|
4068
|
-
name: "codeBlock",
|
|
4069
|
-
addOptions() {
|
|
4070
|
-
return {
|
|
4071
|
-
languageClassPrefix: "language-",
|
|
4072
|
-
exitOnTripleEnter: !0,
|
|
4073
|
-
exitOnArrowDown: !0,
|
|
4074
|
-
defaultLanguage: null,
|
|
4075
|
-
HTMLAttributes: {}
|
|
4076
|
-
};
|
|
4077
|
-
},
|
|
4078
|
-
content: "text*",
|
|
4079
|
-
marks: "",
|
|
4080
|
-
group: "block",
|
|
4081
|
-
code: !0,
|
|
4082
|
-
defining: !0,
|
|
4083
|
-
addAttributes() {
|
|
4084
|
-
return {
|
|
4085
|
-
language: {
|
|
4086
|
-
default: this.options.defaultLanguage,
|
|
4087
|
-
parseHTML: (e) => {
|
|
4088
|
-
var t;
|
|
4089
|
-
const { languageClassPrefix: n } = this.options, o = [...((t = e.firstElementChild) === null || t === void 0 ? void 0 : t.classList) || []].filter((i) => i.startsWith(n)).map((i) => i.replace(n, ""))[0];
|
|
4090
|
-
return o || null;
|
|
4091
|
-
},
|
|
4092
|
-
rendered: !1
|
|
4093
|
-
}
|
|
4094
|
-
};
|
|
4095
|
-
},
|
|
4096
|
-
parseHTML() {
|
|
4097
|
-
return [
|
|
4098
|
-
{
|
|
4099
|
-
tag: "pre",
|
|
4100
|
-
preserveWhitespace: "full"
|
|
4101
|
-
}
|
|
4102
|
-
];
|
|
4103
|
-
},
|
|
4104
|
-
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
4105
|
-
return [
|
|
4106
|
-
"pre",
|
|
4107
|
-
C(this.options.HTMLAttributes, t),
|
|
4108
|
-
[
|
|
4109
|
-
"code",
|
|
4110
|
-
{
|
|
4111
|
-
class: e.attrs.language ? this.options.languageClassPrefix + e.attrs.language : null
|
|
4112
|
-
},
|
|
4113
|
-
0
|
|
4114
|
-
]
|
|
4115
|
-
];
|
|
4116
|
-
},
|
|
4117
|
-
addCommands() {
|
|
4118
|
-
return {
|
|
4119
|
-
setCodeBlock: (e) => ({ commands: t }) => t.setNode(this.name, e),
|
|
4120
|
-
toggleCodeBlock: (e) => ({ commands: t }) => t.toggleNode(this.name, "paragraph", e)
|
|
4121
|
-
};
|
|
4122
|
-
},
|
|
4123
|
-
addKeyboardShortcuts() {
|
|
4124
|
-
return {
|
|
4125
|
-
"Mod-Alt-c": () => this.editor.commands.toggleCodeBlock(),
|
|
4126
|
-
// remove code block when at start of document or code block is empty
|
|
4127
|
-
Backspace: () => {
|
|
4128
|
-
const { empty: e, $anchor: t } = this.editor.state.selection, n = t.pos === 1;
|
|
4129
|
-
return !e || t.parent.type.name !== this.name ? !1 : n || !t.parent.textContent.length ? this.editor.commands.clearNodes() : !1;
|
|
4130
|
-
},
|
|
4131
|
-
// exit node on triple enter
|
|
4132
|
-
Enter: ({ editor: e }) => {
|
|
4133
|
-
if (!this.options.exitOnTripleEnter)
|
|
4134
|
-
return !1;
|
|
4135
|
-
const { state: t } = e, { selection: n } = t, { $from: r, empty: s } = n;
|
|
4136
|
-
if (!s || r.parent.type !== this.type)
|
|
4137
|
-
return !1;
|
|
4138
|
-
const o = r.parentOffset === r.parent.nodeSize - 2, i = r.parent.textContent.endsWith(`
|
|
4139
|
-
|
|
4140
|
-
`);
|
|
4141
|
-
return !o || !i ? !1 : e.chain().command(({ tr: a }) => (a.delete(r.pos - 2, r.pos), !0)).exitCode().run();
|
|
4142
|
-
},
|
|
4143
|
-
// exit node on arrow down
|
|
4144
|
-
ArrowDown: ({ editor: e }) => {
|
|
4145
|
-
if (!this.options.exitOnArrowDown)
|
|
4146
|
-
return !1;
|
|
4147
|
-
const { state: t } = e, { selection: n, doc: r } = t, { $from: s, empty: o } = n;
|
|
4148
|
-
if (!o || s.parent.type !== this.type || !(s.parentOffset === s.parent.nodeSize - 2))
|
|
4149
|
-
return !1;
|
|
4150
|
-
const a = s.after();
|
|
4151
|
-
return a === void 0 ? !1 : r.nodeAt(a) ? e.commands.command(({ tr: l }) => (l.setSelection(G.near(r.resolve(a))), !0)) : e.commands.exitCode();
|
|
4152
|
-
}
|
|
4153
|
-
};
|
|
4154
|
-
},
|
|
4155
|
-
addInputRules() {
|
|
4156
|
-
return [
|
|
4157
|
-
Dt({
|
|
4158
|
-
find: _o,
|
|
4159
|
-
type: this.type,
|
|
4160
|
-
getAttributes: (e) => ({
|
|
4161
|
-
language: e[1]
|
|
4162
|
-
})
|
|
4163
|
-
}),
|
|
4164
|
-
Dt({
|
|
4165
|
-
find: Po,
|
|
4166
|
-
type: this.type,
|
|
4167
|
-
getAttributes: (e) => ({
|
|
4168
|
-
language: e[1]
|
|
4169
|
-
})
|
|
4170
|
-
})
|
|
4171
|
-
];
|
|
4172
|
-
},
|
|
4173
|
-
addProseMirrorPlugins() {
|
|
4174
|
-
return [
|
|
4175
|
-
// this plugin creates a code block for pasted content from VS Code
|
|
4176
|
-
// we can also detect the copied code language
|
|
4177
|
-
new H({
|
|
4178
|
-
key: new $("codeBlockVSCodeHandler"),
|
|
4179
|
-
props: {
|
|
4180
|
-
handlePaste: (e, t) => {
|
|
4181
|
-
if (!t.clipboardData || this.editor.isActive(this.type.name))
|
|
4182
|
-
return !1;
|
|
4183
|
-
const n = t.clipboardData.getData("text/plain"), r = t.clipboardData.getData("vscode-editor-data"), s = r ? JSON.parse(r) : void 0, o = s == null ? void 0 : s.mode;
|
|
4184
|
-
if (!n || !o)
|
|
4185
|
-
return !1;
|
|
4186
|
-
const { tr: i, schema: a } = e.state, c = a.text(n.replace(/\r\n?/g, `
|
|
4187
|
-
`));
|
|
4188
|
-
return i.replaceSelectionWith(this.type.create({ language: o }, c)), i.selection.$from.parent.type !== this.type && i.setSelection(D.near(i.doc.resolve(Math.max(0, i.selection.from - 2)))), i.setMeta("paste", !0), e.dispatch(i), !0;
|
|
4189
|
-
}
|
|
4190
|
-
}
|
|
4191
|
-
})
|
|
4192
|
-
];
|
|
4193
|
-
}
|
|
4194
|
-
}), Ro = (e) => {
|
|
4049
|
+
}), _o = (e) => {
|
|
4195
4050
|
if (!e.children.length)
|
|
4196
4051
|
return;
|
|
4197
4052
|
const t = e.querySelectorAll("span");
|
|
@@ -4200,7 +4055,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4200
4055
|
const o = n.getAttribute("style"), i = (s = (r = n.parentElement) === null || r === void 0 ? void 0 : r.closest("span")) === null || s === void 0 ? void 0 : s.getAttribute("style");
|
|
4201
4056
|
n.setAttribute("style", `${i};${o}`);
|
|
4202
4057
|
});
|
|
4203
|
-
},
|
|
4058
|
+
}, fi = N.create({
|
|
4204
4059
|
name: "textStyle",
|
|
4205
4060
|
priority: 101,
|
|
4206
4061
|
addOptions() {
|
|
@@ -4213,7 +4068,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4213
4068
|
return [
|
|
4214
4069
|
{
|
|
4215
4070
|
tag: "span",
|
|
4216
|
-
getAttrs: (e) => e.hasAttribute("style") ? (this.options.mergeNestedSpanStyles &&
|
|
4071
|
+
getAttrs: (e) => e.hasAttribute("style") ? (this.options.mergeNestedSpanStyles && _o(e), {}) : !1
|
|
4217
4072
|
}
|
|
4218
4073
|
];
|
|
4219
4074
|
},
|
|
@@ -4232,7 +4087,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4232
4087
|
}
|
|
4233
4088
|
};
|
|
4234
4089
|
}
|
|
4235
|
-
}),
|
|
4090
|
+
}), mi = _.create({
|
|
4236
4091
|
name: "fontFamily",
|
|
4237
4092
|
addOptions() {
|
|
4238
4093
|
return {
|
|
@@ -4261,7 +4116,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4261
4116
|
unsetFontFamily: () => ({ chain: e }) => e().setMark("textStyle", { fontFamily: null }).removeEmptyTextStyle().run()
|
|
4262
4117
|
};
|
|
4263
4118
|
}
|
|
4264
|
-
}),
|
|
4119
|
+
}), gi = P.create({
|
|
4265
4120
|
name: "heading",
|
|
4266
4121
|
addOptions() {
|
|
4267
4122
|
return {
|
|
@@ -4302,7 +4157,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4302
4157
|
}), {});
|
|
4303
4158
|
},
|
|
4304
4159
|
addInputRules() {
|
|
4305
|
-
return this.options.levels.map((e) =>
|
|
4160
|
+
return this.options.levels.map((e) => Ks({
|
|
4306
4161
|
find: new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),
|
|
4307
4162
|
type: this.type,
|
|
4308
4163
|
getAttributes: {
|
|
@@ -4310,7 +4165,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4310
4165
|
}
|
|
4311
4166
|
}));
|
|
4312
4167
|
}
|
|
4313
|
-
}),
|
|
4168
|
+
}), yi = _.create({
|
|
4314
4169
|
name: "textAlign",
|
|
4315
4170
|
addOptions() {
|
|
4316
4171
|
return {
|
|
@@ -4350,7 +4205,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4350
4205
|
"Mod-Shift-j": () => this.editor.commands.setTextAlign("justify")
|
|
4351
4206
|
};
|
|
4352
4207
|
}
|
|
4353
|
-
}),
|
|
4208
|
+
}), vi = _.create({
|
|
4354
4209
|
name: "color",
|
|
4355
4210
|
addOptions() {
|
|
4356
4211
|
return {
|
|
@@ -4382,7 +4237,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4382
4237
|
unsetColor: () => ({ chain: e }) => e().setMark("textStyle", { color: null }).removeEmptyTextStyle().run()
|
|
4383
4238
|
};
|
|
4384
4239
|
}
|
|
4385
|
-
}),
|
|
4240
|
+
}), Po = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, Ro = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, bi = N.create({
|
|
4386
4241
|
name: "highlight",
|
|
4387
4242
|
addOptions() {
|
|
4388
4243
|
return {
|
|
@@ -4426,8 +4281,8 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4426
4281
|
},
|
|
4427
4282
|
addInputRules() {
|
|
4428
4283
|
return [
|
|
4429
|
-
|
|
4430
|
-
find:
|
|
4284
|
+
G({
|
|
4285
|
+
find: Po,
|
|
4431
4286
|
type: this.type
|
|
4432
4287
|
})
|
|
4433
4288
|
];
|
|
@@ -4435,12 +4290,12 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4435
4290
|
addPasteRules() {
|
|
4436
4291
|
return [
|
|
4437
4292
|
W({
|
|
4438
|
-
find:
|
|
4293
|
+
find: Ro,
|
|
4439
4294
|
type: this.type
|
|
4440
4295
|
})
|
|
4441
4296
|
];
|
|
4442
4297
|
}
|
|
4443
|
-
}),
|
|
4298
|
+
}), Ho = "listItem", ye = "textStyle", ve = /^\s*([-+*])\s$/, Mi = P.create({
|
|
4444
4299
|
name: "bulletList",
|
|
4445
4300
|
addOptions() {
|
|
4446
4301
|
return {
|
|
@@ -4464,7 +4319,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4464
4319
|
},
|
|
4465
4320
|
addCommands() {
|
|
4466
4321
|
return {
|
|
4467
|
-
toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
4322
|
+
toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Ho, this.editor.getAttributes(ye)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
4468
4323
|
};
|
|
4469
4324
|
},
|
|
4470
4325
|
addKeyboardShortcuts() {
|
|
@@ -4474,21 +4329,21 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4474
4329
|
},
|
|
4475
4330
|
addInputRules() {
|
|
4476
4331
|
let e = et({
|
|
4477
|
-
find:
|
|
4332
|
+
find: ve,
|
|
4478
4333
|
type: this.type
|
|
4479
4334
|
});
|
|
4480
4335
|
return (this.options.keepMarks || this.options.keepAttributes) && (e = et({
|
|
4481
|
-
find:
|
|
4336
|
+
find: ve,
|
|
4482
4337
|
type: this.type,
|
|
4483
4338
|
keepMarks: this.options.keepMarks,
|
|
4484
4339
|
keepAttributes: this.options.keepAttributes,
|
|
4485
|
-
getAttributes: () => this.editor.getAttributes(
|
|
4340
|
+
getAttributes: () => this.editor.getAttributes(ye),
|
|
4486
4341
|
editor: this.editor
|
|
4487
4342
|
})), [
|
|
4488
4343
|
e
|
|
4489
4344
|
];
|
|
4490
4345
|
}
|
|
4491
|
-
}),
|
|
4346
|
+
}), $o = "listItem", be = "textStyle", Me = /^(\d+)\.\s$/, Si = P.create({
|
|
4492
4347
|
name: "orderedList",
|
|
4493
4348
|
addOptions() {
|
|
4494
4349
|
return {
|
|
@@ -4527,7 +4382,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4527
4382
|
},
|
|
4528
4383
|
addCommands() {
|
|
4529
4384
|
return {
|
|
4530
|
-
toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
4385
|
+
toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes($o, this.editor.getAttributes(be)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
4531
4386
|
};
|
|
4532
4387
|
},
|
|
4533
4388
|
addKeyboardShortcuts() {
|
|
@@ -4537,24 +4392,24 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4537
4392
|
},
|
|
4538
4393
|
addInputRules() {
|
|
4539
4394
|
let e = et({
|
|
4540
|
-
find:
|
|
4395
|
+
find: Me,
|
|
4541
4396
|
type: this.type,
|
|
4542
4397
|
getAttributes: (t) => ({ start: +t[1] }),
|
|
4543
4398
|
joinPredicate: (t, n) => n.childCount + n.attrs.start === +t[1]
|
|
4544
4399
|
});
|
|
4545
4400
|
return (this.options.keepMarks || this.options.keepAttributes) && (e = et({
|
|
4546
|
-
find:
|
|
4401
|
+
find: Me,
|
|
4547
4402
|
type: this.type,
|
|
4548
4403
|
keepMarks: this.options.keepMarks,
|
|
4549
4404
|
keepAttributes: this.options.keepAttributes,
|
|
4550
|
-
getAttributes: (t) => ({ start: +t[1], ...this.editor.getAttributes(
|
|
4405
|
+
getAttributes: (t) => ({ start: +t[1], ...this.editor.getAttributes(be) }),
|
|
4551
4406
|
joinPredicate: (t, n) => n.childCount + n.attrs.start === +t[1],
|
|
4552
4407
|
editor: this.editor
|
|
4553
4408
|
})), [
|
|
4554
4409
|
e
|
|
4555
4410
|
];
|
|
4556
4411
|
}
|
|
4557
|
-
}),
|
|
4412
|
+
}), Io = /^\s*(\[([( |x])?\])\s$/, ki = P.create({
|
|
4558
4413
|
name: "taskItem",
|
|
4559
4414
|
addOptions() {
|
|
4560
4415
|
return {
|
|
@@ -4653,7 +4508,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4653
4508
|
addInputRules() {
|
|
4654
4509
|
return [
|
|
4655
4510
|
et({
|
|
4656
|
-
find:
|
|
4511
|
+
find: Io,
|
|
4657
4512
|
type: this.type,
|
|
4658
4513
|
getAttributes: (e) => ({
|
|
4659
4514
|
checked: e[e.length - 1] === "x"
|
|
@@ -4661,7 +4516,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4661
4516
|
})
|
|
4662
4517
|
];
|
|
4663
4518
|
}
|
|
4664
|
-
}),
|
|
4519
|
+
}), wi = P.create({
|
|
4665
4520
|
name: "taskList",
|
|
4666
4521
|
addOptions() {
|
|
4667
4522
|
return {
|
|
@@ -4694,7 +4549,7 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4694
4549
|
"Mod-Shift-9": () => this.editor.commands.toggleTaskList()
|
|
4695
4550
|
};
|
|
4696
4551
|
}
|
|
4697
|
-
}),
|
|
4552
|
+
}), Do = /^\s*>\s$/, Ei = P.create({
|
|
4698
4553
|
name: "blockquote",
|
|
4699
4554
|
addOptions() {
|
|
4700
4555
|
return {
|
|
@@ -4727,25 +4582,25 @@ const bo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Mo = /(?:^|\s
|
|
|
4727
4582
|
addInputRules() {
|
|
4728
4583
|
return [
|
|
4729
4584
|
et({
|
|
4730
|
-
find:
|
|
4585
|
+
find: Do,
|
|
4731
4586
|
type: this.type
|
|
4732
4587
|
})
|
|
4733
4588
|
];
|
|
4734
4589
|
}
|
|
4735
4590
|
});
|
|
4736
|
-
function
|
|
4591
|
+
function No(e) {
|
|
4737
4592
|
return e.length === 1 ? e[0].isLink : e.length === 3 && e[1].isLink ? ["()", "[]"].includes(e[0].value + e[2].value) : !1;
|
|
4738
4593
|
}
|
|
4739
|
-
function
|
|
4594
|
+
function Bo(e) {
|
|
4740
4595
|
return new H({
|
|
4741
|
-
key: new
|
|
4596
|
+
key: new I("autolink"),
|
|
4742
4597
|
appendTransaction: (t, n, r) => {
|
|
4743
4598
|
const s = t.some((l) => l.docChanged) && !n.doc.eq(r.doc), o = t.some((l) => l.getMeta("preventAutolink"));
|
|
4744
4599
|
if (!s || o)
|
|
4745
4600
|
return;
|
|
4746
|
-
const { tr: i } = r, a =
|
|
4747
|
-
if (
|
|
4748
|
-
const u =
|
|
4601
|
+
const { tr: i } = r, a = ss(n.doc, [...t]);
|
|
4602
|
+
if (us(a).forEach(({ newRange: l }) => {
|
|
4603
|
+
const u = is(r.doc, l, (h) => h.isTextblock);
|
|
4749
4604
|
let d, p;
|
|
4750
4605
|
if (u.length > 1 ? (d = u[0], p = r.doc.textBetween(d.pos, d.pos + d.node.nodeSize, void 0, " ")) : u.length && r.doc.textBetween(l.from, l.to, " ", " ").endsWith(" ") && (d = u[0], p = r.doc.textBetween(d.pos, l.to, void 0, " ")), d && p) {
|
|
4751
4606
|
const h = p.split(" ").filter((y) => y !== "");
|
|
@@ -4754,15 +4609,15 @@ function Fo(e) {
|
|
|
4754
4609
|
const m = h[h.length - 1], f = d.pos + p.lastIndexOf(m);
|
|
4755
4610
|
if (!m)
|
|
4756
4611
|
return !1;
|
|
4757
|
-
const g =
|
|
4758
|
-
if (!
|
|
4612
|
+
const g = Ln(m).map((y) => y.toObject(e.defaultProtocol));
|
|
4613
|
+
if (!No(g))
|
|
4759
4614
|
return !1;
|
|
4760
4615
|
g.filter((y) => y.isLink).map((y) => ({
|
|
4761
4616
|
...y,
|
|
4762
4617
|
from: f + y.start + 1,
|
|
4763
4618
|
to: f + y.end + 1
|
|
4764
4619
|
})).filter((y) => r.schema.marks.code ? !r.doc.rangeHasMark(y.from, y.to, r.schema.marks.code) : !0).filter((y) => e.validate(y.value)).filter((y) => e.shouldAutoLink(y.value)).forEach((y) => {
|
|
4765
|
-
|
|
4620
|
+
Yt(y.from, y.to, r.doc).some((M) => M.mark.type === e.type) || i.addMark(y.from, y.to, e.type.create({
|
|
4766
4621
|
href: y.href
|
|
4767
4622
|
}));
|
|
4768
4623
|
});
|
|
@@ -4772,9 +4627,9 @@ function Fo(e) {
|
|
|
4772
4627
|
}
|
|
4773
4628
|
});
|
|
4774
4629
|
}
|
|
4775
|
-
function
|
|
4630
|
+
function jo(e) {
|
|
4776
4631
|
return new H({
|
|
4777
|
-
key: new
|
|
4632
|
+
key: new I("handleClickLink"),
|
|
4778
4633
|
props: {
|
|
4779
4634
|
handleClick: (t, n, r) => {
|
|
4780
4635
|
var s, o;
|
|
@@ -4786,15 +4641,15 @@ function zo(e) {
|
|
|
4786
4641
|
a.push(i), i = i.parentNode;
|
|
4787
4642
|
if (!a.find((p) => p.nodeName === "A"))
|
|
4788
4643
|
return !1;
|
|
4789
|
-
const c =
|
|
4644
|
+
const c = ze(t.state, e.type.name), l = r.target, u = (s = l == null ? void 0 : l.href) !== null && s !== void 0 ? s : c.href, d = (o = l == null ? void 0 : l.target) !== null && o !== void 0 ? o : c.target;
|
|
4790
4645
|
return l && u ? (window.open(u, d), !0) : !1;
|
|
4791
4646
|
}
|
|
4792
4647
|
}
|
|
4793
4648
|
});
|
|
4794
4649
|
}
|
|
4795
|
-
function
|
|
4650
|
+
function Fo(e) {
|
|
4796
4651
|
return new H({
|
|
4797
|
-
key: new
|
|
4652
|
+
key: new I("handlePasteLink"),
|
|
4798
4653
|
props: {
|
|
4799
4654
|
handlePaste: (t, n, r) => {
|
|
4800
4655
|
const { state: s } = t, { selection: o } = s, { empty: i } = o;
|
|
@@ -4804,7 +4659,7 @@ function Vo(e) {
|
|
|
4804
4659
|
r.content.forEach((l) => {
|
|
4805
4660
|
a += l.textContent;
|
|
4806
4661
|
});
|
|
4807
|
-
const c =
|
|
4662
|
+
const c = Te(a, { defaultProtocol: e.defaultProtocol }).find((l) => l.isLink && l.value === a);
|
|
4808
4663
|
return !a || !c ? !1 : e.editor.commands.setMark(e.type, {
|
|
4809
4664
|
href: c.href
|
|
4810
4665
|
});
|
|
@@ -4812,7 +4667,7 @@ function Vo(e) {
|
|
|
4812
4667
|
}
|
|
4813
4668
|
});
|
|
4814
4669
|
}
|
|
4815
|
-
const
|
|
4670
|
+
const zo = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;
|
|
4816
4671
|
function U(e, t) {
|
|
4817
4672
|
const n = [
|
|
4818
4673
|
"http",
|
|
@@ -4829,13 +4684,13 @@ function U(e, t) {
|
|
|
4829
4684
|
return t && t.forEach((r) => {
|
|
4830
4685
|
const s = typeof r == "string" ? r : r.scheme;
|
|
4831
4686
|
s && n.push(s);
|
|
4832
|
-
}), !e || e.replace(
|
|
4687
|
+
}), !e || e.replace(zo, "").match(new RegExp(
|
|
4833
4688
|
// eslint-disable-next-line no-useless-escape
|
|
4834
4689
|
`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,
|
|
4835
4690
|
"i"
|
|
4836
4691
|
));
|
|
4837
4692
|
}
|
|
4838
|
-
const
|
|
4693
|
+
const Ti = N.create({
|
|
4839
4694
|
name: "link",
|
|
4840
4695
|
priority: 1e3,
|
|
4841
4696
|
keepOnSplit: !1,
|
|
@@ -4843,14 +4698,14 @@ const Li = N.create({
|
|
|
4843
4698
|
onCreate() {
|
|
4844
4699
|
this.options.validate && !this.options.shouldAutoLink && (this.options.shouldAutoLink = this.options.validate, console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")), this.options.protocols.forEach((e) => {
|
|
4845
4700
|
if (typeof e == "string") {
|
|
4846
|
-
|
|
4701
|
+
te(e);
|
|
4847
4702
|
return;
|
|
4848
4703
|
}
|
|
4849
|
-
|
|
4704
|
+
te(e.scheme, e.optionalSlashes);
|
|
4850
4705
|
});
|
|
4851
4706
|
},
|
|
4852
4707
|
onDestroy() {
|
|
4853
|
-
|
|
4708
|
+
_n();
|
|
4854
4709
|
},
|
|
4855
4710
|
inclusive() {
|
|
4856
4711
|
return this.options.autolink;
|
|
@@ -4944,7 +4799,7 @@ const Li = N.create({
|
|
|
4944
4799
|
find: (e) => {
|
|
4945
4800
|
const t = [];
|
|
4946
4801
|
if (e) {
|
|
4947
|
-
const { protocols: n, defaultProtocol: r } = this.options, s =
|
|
4802
|
+
const { protocols: n, defaultProtocol: r } = this.options, s = Te(e).filter((o) => o.isLink && this.options.isAllowedUri(o.value, {
|
|
4948
4803
|
defaultValidate: (i) => !!U(i, n),
|
|
4949
4804
|
protocols: n,
|
|
4950
4805
|
defaultProtocol: r
|
|
@@ -4971,7 +4826,7 @@ const Li = N.create({
|
|
|
4971
4826
|
},
|
|
4972
4827
|
addProseMirrorPlugins() {
|
|
4973
4828
|
const e = [], { protocols: t, defaultProtocol: n } = this.options;
|
|
4974
|
-
return this.options.autolink && e.push(
|
|
4829
|
+
return this.options.autolink && e.push(Bo({
|
|
4975
4830
|
type: this.type,
|
|
4976
4831
|
defaultProtocol: this.options.defaultProtocol,
|
|
4977
4832
|
validate: (r) => this.options.isAllowedUri(r, {
|
|
@@ -4980,15 +4835,15 @@ const Li = N.create({
|
|
|
4980
4835
|
defaultProtocol: n
|
|
4981
4836
|
}),
|
|
4982
4837
|
shouldAutoLink: this.options.shouldAutoLink
|
|
4983
|
-
})), this.options.openOnClick === !0 && e.push(
|
|
4838
|
+
})), this.options.openOnClick === !0 && e.push(jo({
|
|
4984
4839
|
type: this.type
|
|
4985
|
-
})), this.options.linkOnPaste && e.push(
|
|
4840
|
+
})), this.options.linkOnPaste && e.push(Fo({
|
|
4986
4841
|
editor: this.editor,
|
|
4987
4842
|
defaultProtocol: this.options.defaultProtocol,
|
|
4988
4843
|
type: this.type
|
|
4989
4844
|
})), e;
|
|
4990
4845
|
}
|
|
4991
|
-
}),
|
|
4846
|
+
}), Ci = P.create({
|
|
4992
4847
|
name: "horizontalRule",
|
|
4993
4848
|
addOptions() {
|
|
4994
4849
|
return {
|
|
@@ -5011,7 +4866,7 @@ const Li = N.create({
|
|
|
5011
4866
|
to: s.pos
|
|
5012
4867
|
}, {
|
|
5013
4868
|
type: this.name
|
|
5014
|
-
}) :
|
|
4869
|
+
}) : Ve(n) ? o.insertContentAt(s.pos, {
|
|
5015
4870
|
type: this.name
|
|
5016
4871
|
}) : o.insertContent({ type: this.name }), o.command(({ tr: i, dispatch: a }) => {
|
|
5017
4872
|
var c;
|
|
@@ -5032,13 +4887,13 @@ const Li = N.create({
|
|
|
5032
4887
|
},
|
|
5033
4888
|
addInputRules() {
|
|
5034
4889
|
return [
|
|
5035
|
-
|
|
4890
|
+
We({
|
|
5036
4891
|
find: /^(?:---|—-|___\s|\*\*\*\s)$/,
|
|
5037
4892
|
type: this.type
|
|
5038
4893
|
})
|
|
5039
4894
|
];
|
|
5040
4895
|
}
|
|
5041
|
-
}),
|
|
4896
|
+
}), xi = _.create({
|
|
5042
4897
|
name: "history",
|
|
5043
4898
|
addOptions() {
|
|
5044
4899
|
return {
|
|
@@ -5048,13 +4903,13 @@ const Li = N.create({
|
|
|
5048
4903
|
},
|
|
5049
4904
|
addCommands() {
|
|
5050
4905
|
return {
|
|
5051
|
-
undo: () => ({ state: e, dispatch: t }) =>
|
|
5052
|
-
redo: () => ({ state: e, dispatch: t }) =>
|
|
4906
|
+
undo: () => ({ state: e, dispatch: t }) => Hn(e, t),
|
|
4907
|
+
redo: () => ({ state: e, dispatch: t }) => Rn(e, t)
|
|
5053
4908
|
};
|
|
5054
4909
|
},
|
|
5055
4910
|
addProseMirrorPlugins() {
|
|
5056
4911
|
return [
|
|
5057
|
-
|
|
4912
|
+
Pn(this.options)
|
|
5058
4913
|
];
|
|
5059
4914
|
},
|
|
5060
4915
|
addKeyboardShortcuts() {
|
|
@@ -5067,7 +4922,7 @@ const Li = N.create({
|
|
|
5067
4922
|
"Shift-Mod-я": () => this.editor.commands.redo()
|
|
5068
4923
|
};
|
|
5069
4924
|
}
|
|
5070
|
-
}),
|
|
4925
|
+
}), Ai = _.create({
|
|
5071
4926
|
name: "characterCount",
|
|
5072
4927
|
addOptions() {
|
|
5073
4928
|
return {
|
|
@@ -5100,7 +4955,7 @@ const Li = N.create({
|
|
|
5100
4955
|
let e = !1;
|
|
5101
4956
|
return [
|
|
5102
4957
|
new H({
|
|
5103
|
-
key: new
|
|
4958
|
+
key: new I("characterCount"),
|
|
5104
4959
|
appendTransaction: (t, n, r) => {
|
|
5105
4960
|
if (e)
|
|
5106
4961
|
return;
|
|
@@ -5133,7 +4988,7 @@ const Li = N.create({
|
|
|
5133
4988
|
})
|
|
5134
4989
|
];
|
|
5135
4990
|
}
|
|
5136
|
-
}),
|
|
4991
|
+
}), Oi = _.create({
|
|
5137
4992
|
name: "dropCursor",
|
|
5138
4993
|
addOptions() {
|
|
5139
4994
|
return {
|
|
@@ -5144,10 +4999,10 @@ const Li = N.create({
|
|
|
5144
4999
|
},
|
|
5145
5000
|
addProseMirrorPlugins() {
|
|
5146
5001
|
return [
|
|
5147
|
-
|
|
5002
|
+
$n(this.options)
|
|
5148
5003
|
];
|
|
5149
5004
|
}
|
|
5150
|
-
}),
|
|
5005
|
+
}), Li = _.create({
|
|
5151
5006
|
name: "focus",
|
|
5152
5007
|
addOptions() {
|
|
5153
5008
|
return {
|
|
@@ -5158,7 +5013,7 @@ const Li = N.create({
|
|
|
5158
5013
|
addProseMirrorPlugins() {
|
|
5159
5014
|
return [
|
|
5160
5015
|
new H({
|
|
5161
|
-
key: new
|
|
5016
|
+
key: new I("focus"),
|
|
5162
5017
|
props: {
|
|
5163
5018
|
decorations: ({ doc: e, selection: t }) => {
|
|
5164
5019
|
const { isEditable: n, isFocused: r } = this.editor, { anchor: s } = t, o = [];
|
|
@@ -5178,7 +5033,7 @@ const Li = N.create({
|
|
|
5178
5033
|
return !1;
|
|
5179
5034
|
if (a += 1, this.options.mode === "deepest" && i - a > 0 || this.options.mode === "shallowest" && a > 1)
|
|
5180
5035
|
return this.options.mode === "deepest";
|
|
5181
|
-
o.push(
|
|
5036
|
+
o.push(zt.node(l, l + c.nodeSize, {
|
|
5182
5037
|
class: this.options.className
|
|
5183
5038
|
}));
|
|
5184
5039
|
}), pt.create(e, o);
|
|
@@ -5187,11 +5042,11 @@ const Li = N.create({
|
|
|
5187
5042
|
})
|
|
5188
5043
|
];
|
|
5189
5044
|
}
|
|
5190
|
-
}),
|
|
5045
|
+
}), _i = _.create({
|
|
5191
5046
|
name: "gapCursor",
|
|
5192
5047
|
addProseMirrorPlugins() {
|
|
5193
5048
|
return [
|
|
5194
|
-
|
|
5049
|
+
In()
|
|
5195
5050
|
];
|
|
5196
5051
|
},
|
|
5197
5052
|
extendNodeSchema(e) {
|
|
@@ -5205,7 +5060,7 @@ const Li = N.create({
|
|
|
5205
5060
|
allowGapCursor: (t = E(S(e, "allowGapCursor", n))) !== null && t !== void 0 ? t : null
|
|
5206
5061
|
};
|
|
5207
5062
|
}
|
|
5208
|
-
}),
|
|
5063
|
+
}), Pi = P.create({
|
|
5209
5064
|
name: "hardBreak",
|
|
5210
5065
|
addOptions() {
|
|
5211
5066
|
return {
|
|
@@ -5255,7 +5110,7 @@ const Li = N.create({
|
|
|
5255
5110
|
"Shift-Enter": () => this.editor.commands.setHardBreak()
|
|
5256
5111
|
};
|
|
5257
5112
|
}
|
|
5258
|
-
}),
|
|
5113
|
+
}), Ri = P.create({
|
|
5259
5114
|
name: "listItem",
|
|
5260
5115
|
addOptions() {
|
|
5261
5116
|
return {
|
|
@@ -5283,7 +5138,7 @@ const Li = N.create({
|
|
|
5283
5138
|
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
5284
5139
|
};
|
|
5285
5140
|
}
|
|
5286
|
-
}),
|
|
5141
|
+
}), Hi = P.create({
|
|
5287
5142
|
name: "paragraph",
|
|
5288
5143
|
priority: 1e3,
|
|
5289
5144
|
addOptions() {
|
|
@@ -5311,7 +5166,7 @@ const Li = N.create({
|
|
|
5311
5166
|
"Mod-Alt-0": () => this.editor.commands.setParagraph()
|
|
5312
5167
|
};
|
|
5313
5168
|
}
|
|
5314
|
-
}),
|
|
5169
|
+
}), $i = _.create({
|
|
5315
5170
|
name: "placeholder",
|
|
5316
5171
|
addOptions() {
|
|
5317
5172
|
return {
|
|
@@ -5326,7 +5181,7 @@ const Li = N.create({
|
|
|
5326
5181
|
addProseMirrorPlugins() {
|
|
5327
5182
|
return [
|
|
5328
5183
|
new H({
|
|
5329
|
-
key: new
|
|
5184
|
+
key: new I("placeholder"),
|
|
5330
5185
|
props: {
|
|
5331
5186
|
decorations: ({ doc: e, selection: t }) => {
|
|
5332
5187
|
const n = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: r } = t, s = [];
|
|
@@ -5338,7 +5193,7 @@ const Li = N.create({
|
|
|
5338
5193
|
if ((c || !this.options.showOnlyCurrent) && l) {
|
|
5339
5194
|
const u = [this.options.emptyNodeClass];
|
|
5340
5195
|
o && u.push(this.options.emptyEditorClass);
|
|
5341
|
-
const d =
|
|
5196
|
+
const d = zt.node(a, a + i.nodeSize, {
|
|
5342
5197
|
class: u.join(" "),
|
|
5343
5198
|
"data-placeholder": typeof this.options.placeholder == "function" ? this.options.placeholder({
|
|
5344
5199
|
editor: this.editor,
|
|
@@ -5356,14 +5211,14 @@ const Li = N.create({
|
|
|
5356
5211
|
})
|
|
5357
5212
|
];
|
|
5358
5213
|
}
|
|
5359
|
-
}),
|
|
5214
|
+
}), Ii = P.create({
|
|
5360
5215
|
name: "text",
|
|
5361
5216
|
group: "inline"
|
|
5362
|
-
}),
|
|
5217
|
+
}), Di = P.create({
|
|
5363
5218
|
name: "doc",
|
|
5364
5219
|
topNode: !0,
|
|
5365
5220
|
content: "block+"
|
|
5366
|
-
}),
|
|
5221
|
+
}), Ni = N.create({
|
|
5367
5222
|
name: "subscript",
|
|
5368
5223
|
addOptions() {
|
|
5369
5224
|
return {
|
|
@@ -5398,7 +5253,7 @@ const Li = N.create({
|
|
|
5398
5253
|
"Mod-,": () => this.editor.commands.toggleSubscript()
|
|
5399
5254
|
};
|
|
5400
5255
|
}
|
|
5401
|
-
}),
|
|
5256
|
+
}), Bi = N.create({
|
|
5402
5257
|
name: "superscript",
|
|
5403
5258
|
addOptions() {
|
|
5404
5259
|
return {
|
|
@@ -5434,9 +5289,9 @@ const Li = N.create({
|
|
|
5434
5289
|
};
|
|
5435
5290
|
}
|
|
5436
5291
|
});
|
|
5437
|
-
function
|
|
5292
|
+
function Vo(e) {
|
|
5438
5293
|
var t;
|
|
5439
|
-
const { char: n, allowSpaces: r, allowToIncludeChar: s, allowedPrefixes: o, startOfLine: i, $position: a } = e, c = r && !s, l =
|
|
5294
|
+
const { char: n, allowSpaces: r, allowToIncludeChar: s, allowedPrefixes: o, startOfLine: i, $position: a } = e, c = r && !s, l = qs(n), u = new RegExp(`\\s${l}$`), d = i ? "^" : "", p = s ? "" : l, h = c ? new RegExp(`${d}${l}.*?(?=\\s${p}|$)`, "gm") : new RegExp(`${d}(?:^)?${l}[^\\s${p}]*`, "gm"), m = ((t = a.nodeBefore) === null || t === void 0 ? void 0 : t.isText) && a.nodeBefore.text;
|
|
5440
5295
|
if (!m)
|
|
5441
5296
|
return null;
|
|
5442
5297
|
const f = a.pos - m.length, g = Array.from(m.matchAll(h)).pop();
|
|
@@ -5456,42 +5311,42 @@ function Ko(e) {
|
|
|
5456
5311
|
text: g[0]
|
|
5457
5312
|
} : null;
|
|
5458
5313
|
}
|
|
5459
|
-
const
|
|
5460
|
-
function
|
|
5314
|
+
const Wo = new I("suggestion");
|
|
5315
|
+
function Ko({ pluginKey: e = Wo, editor: t, char: n = "@", allowSpaces: r = !1, allowToIncludeChar: s = !1, allowedPrefixes: o = [" "], startOfLine: i = !1, decorationTag: a = "span", decorationClass: c = "suggestion", command: l = () => null, items: u = () => [], render: d = () => ({}), allow: p = () => !0, findSuggestionMatch: h = Vo }) {
|
|
5461
5316
|
let m;
|
|
5462
5317
|
const f = d == null ? void 0 : d(), g = new H({
|
|
5463
5318
|
key: e,
|
|
5464
5319
|
view() {
|
|
5465
5320
|
return {
|
|
5466
5321
|
update: async (y, M) => {
|
|
5467
|
-
var v, b, w, k, T, x,
|
|
5468
|
-
const A = (v = this.key) === null || v === void 0 ? void 0 : v.getState(M),
|
|
5322
|
+
var v, b, w, k, T, x, O;
|
|
5323
|
+
const A = (v = this.key) === null || v === void 0 ? void 0 : v.getState(M), $ = (b = this.key) === null || b === void 0 ? void 0 : b.getState(y.state), B = A.active && $.active && A.range.from !== $.range.from, J = !A.active && $.active, Y = A.active && !$.active, nt = !J && !Y && A.query !== $.query, j = J || B && nt, z = nt || B, Tt = Y || B && nt;
|
|
5469
5324
|
if (!j && !z && !Tt)
|
|
5470
5325
|
return;
|
|
5471
|
-
const
|
|
5326
|
+
const X = Tt && !j ? A : $, Qt = y.dom.querySelector(`[data-decoration-id="${X.decorationId}"]`);
|
|
5472
5327
|
m = {
|
|
5473
5328
|
editor: t,
|
|
5474
|
-
range:
|
|
5475
|
-
query:
|
|
5476
|
-
text:
|
|
5329
|
+
range: X.range,
|
|
5330
|
+
query: X.query,
|
|
5331
|
+
text: X.text,
|
|
5477
5332
|
items: [],
|
|
5478
5333
|
command: (rt) => l({
|
|
5479
5334
|
editor: t,
|
|
5480
|
-
range:
|
|
5335
|
+
range: X.range,
|
|
5481
5336
|
props: rt
|
|
5482
5337
|
}),
|
|
5483
|
-
decorationNode:
|
|
5338
|
+
decorationNode: Qt,
|
|
5484
5339
|
// virtual node for popper.js or tippy.js
|
|
5485
5340
|
// this can be used for building popups without a DOM node
|
|
5486
|
-
clientRect:
|
|
5341
|
+
clientRect: Qt ? () => {
|
|
5487
5342
|
var rt;
|
|
5488
|
-
const { decorationId:
|
|
5343
|
+
const { decorationId: Ge } = (rt = this.key) === null || rt === void 0 ? void 0 : rt.getState(t.state), Ct = y.dom.querySelector(`[data-decoration-id="${Ge}"]`);
|
|
5489
5344
|
return (Ct == null ? void 0 : Ct.getBoundingClientRect()) || null;
|
|
5490
5345
|
} : null
|
|
5491
5346
|
}, j && ((w = f == null ? void 0 : f.onBeforeStart) === null || w === void 0 || w.call(f, m)), z && ((k = f == null ? void 0 : f.onBeforeUpdate) === null || k === void 0 || k.call(f, m)), (z || j) && (m.items = await u({
|
|
5492
5347
|
editor: t,
|
|
5493
|
-
query:
|
|
5494
|
-
})), Tt && ((T = f == null ? void 0 : f.onExit) === null || T === void 0 || T.call(f, m)), z && ((x = f == null ? void 0 : f.onUpdate) === null || x === void 0 || x.call(f, m)), j && ((
|
|
5348
|
+
query: X.query
|
|
5349
|
+
})), Tt && ((T = f == null ? void 0 : f.onExit) === null || T === void 0 || T.call(f, m)), z && ((x = f == null ? void 0 : f.onUpdate) === null || x === void 0 || x.call(f, m)), j && ((O = f == null ? void 0 : f.onStart) === null || O === void 0 || O.call(f, m));
|
|
5495
5350
|
},
|
|
5496
5351
|
destroy: () => {
|
|
5497
5352
|
var y;
|
|
@@ -5515,10 +5370,10 @@ function qo({ pluginKey: e = Uo, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5515
5370
|
},
|
|
5516
5371
|
// Apply changes to the plugin state from a view transaction.
|
|
5517
5372
|
apply(y, M, v, b) {
|
|
5518
|
-
const { isEditable: w } = t, { composing: k } = t.view, { selection: T } = y, { empty: x, from:
|
|
5373
|
+
const { isEditable: w } = t, { composing: k } = t.view, { selection: T } = y, { empty: x, from: O } = T, A = { ...M };
|
|
5519
5374
|
if (A.composing = k, w && (x || t.view.composing)) {
|
|
5520
|
-
(
|
|
5521
|
-
const
|
|
5375
|
+
(O < M.range.from || O > M.range.to) && !k && !M.composing && (A.active = !1);
|
|
5376
|
+
const $ = h({
|
|
5522
5377
|
char: n,
|
|
5523
5378
|
allowSpaces: r,
|
|
5524
5379
|
allowToIncludeChar: s,
|
|
@@ -5526,12 +5381,12 @@ function qo({ pluginKey: e = Uo, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5526
5381
|
startOfLine: i,
|
|
5527
5382
|
$position: T.$from
|
|
5528
5383
|
}), B = `id_${Math.floor(Math.random() * 4294967295)}`;
|
|
5529
|
-
|
|
5384
|
+
$ && p({
|
|
5530
5385
|
editor: t,
|
|
5531
5386
|
state: b,
|
|
5532
|
-
range:
|
|
5387
|
+
range: $.range,
|
|
5533
5388
|
isActive: M.active
|
|
5534
|
-
}) ? (A.active = !0, A.decorationId = M.decorationId ? M.decorationId : B, A.range =
|
|
5389
|
+
}) ? (A.active = !0, A.decorationId = M.decorationId ? M.decorationId : B, A.range = $.range, A.query = $.query, A.text = $.text) : A.active = !1;
|
|
5535
5390
|
} else
|
|
5536
5391
|
A.active = !1;
|
|
5537
5392
|
return A.active || (A.decorationId = null, A.range = { from: 0, to: 0 }, A.query = null, A.text = null), A;
|
|
@@ -5548,7 +5403,7 @@ function qo({ pluginKey: e = Uo, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5548
5403
|
decorations(y) {
|
|
5549
5404
|
const { active: M, range: v, decorationId: b } = g.getState(y);
|
|
5550
5405
|
return M ? pt.create(y.doc, [
|
|
5551
|
-
|
|
5406
|
+
zt.inline(v.from, v.to, {
|
|
5552
5407
|
nodeName: a,
|
|
5553
5408
|
class: c,
|
|
5554
5409
|
"data-decoration-id": b
|
|
@@ -5559,7 +5414,7 @@ function qo({ pluginKey: e = Uo, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5559
5414
|
});
|
|
5560
5415
|
return g;
|
|
5561
5416
|
}
|
|
5562
|
-
const
|
|
5417
|
+
const Uo = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, ji = P.create({
|
|
5563
5418
|
name: "image",
|
|
5564
5419
|
addOptions() {
|
|
5565
5420
|
return {
|
|
@@ -5608,8 +5463,8 @@ const Go = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Ki = _.cr
|
|
|
5608
5463
|
},
|
|
5609
5464
|
addInputRules() {
|
|
5610
5465
|
return [
|
|
5611
|
-
|
|
5612
|
-
find:
|
|
5466
|
+
We({
|
|
5467
|
+
find: Uo,
|
|
5613
5468
|
type: this.type,
|
|
5614
5469
|
getAttributes: (e) => {
|
|
5615
5470
|
const [, , t, n, r] = e;
|
|
@@ -5618,7 +5473,7 @@ const Go = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Ki = _.cr
|
|
|
5618
5473
|
})
|
|
5619
5474
|
];
|
|
5620
5475
|
}
|
|
5621
|
-
}),
|
|
5476
|
+
}), Fi = P.create({
|
|
5622
5477
|
name: "tableRow",
|
|
5623
5478
|
addOptions() {
|
|
5624
5479
|
return {
|
|
@@ -5636,10 +5491,10 @@ const Go = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Ki = _.cr
|
|
|
5636
5491
|
return ["tr", C(this.options.HTMLAttributes, e), 0];
|
|
5637
5492
|
}
|
|
5638
5493
|
});
|
|
5639
|
-
function
|
|
5494
|
+
function jt(e, t) {
|
|
5640
5495
|
return t ? ["width", `${Math.max(t, e)}px`] : ["min-width", `${e}px`];
|
|
5641
5496
|
}
|
|
5642
|
-
function
|
|
5497
|
+
function Se(e, t, n, r, s, o) {
|
|
5643
5498
|
var i;
|
|
5644
5499
|
let a = 0, c = !0, l = t.firstChild;
|
|
5645
5500
|
const u = e.firstChild;
|
|
@@ -5650,12 +5505,12 @@ function ke(e, t, n, r, s, o) {
|
|
|
5650
5505
|
const g = s === p ? o : m && m[f], y = g ? `${g}px` : "";
|
|
5651
5506
|
if (a += g || r, g || (c = !1), l) {
|
|
5652
5507
|
if (l.style.width !== y) {
|
|
5653
|
-
const [M, v] =
|
|
5508
|
+
const [M, v] = jt(r, g);
|
|
5654
5509
|
l.style.setProperty(M, v);
|
|
5655
5510
|
}
|
|
5656
5511
|
l = l.nextSibling;
|
|
5657
5512
|
} else {
|
|
5658
|
-
const M = document.createElement("col"), [v, b] =
|
|
5513
|
+
const M = document.createElement("col"), [v, b] = jt(r, g);
|
|
5659
5514
|
M.style.setProperty(v, b), t.appendChild(M);
|
|
5660
5515
|
}
|
|
5661
5516
|
}
|
|
@@ -5666,18 +5521,18 @@ function ke(e, t, n, r, s, o) {
|
|
|
5666
5521
|
}
|
|
5667
5522
|
c ? (n.style.width = `${a}px`, n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = `${a}px`);
|
|
5668
5523
|
}
|
|
5669
|
-
class
|
|
5524
|
+
class qo {
|
|
5670
5525
|
constructor(t, n) {
|
|
5671
|
-
this.node = t, this.cellMinWidth = n, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.colgroup = this.table.appendChild(document.createElement("colgroup")),
|
|
5526
|
+
this.node = t, this.cellMinWidth = n, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.colgroup = this.table.appendChild(document.createElement("colgroup")), Se(t, this.colgroup, this.table, n), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
5672
5527
|
}
|
|
5673
5528
|
update(t) {
|
|
5674
|
-
return t.type !== this.node.type ? !1 : (this.node = t,
|
|
5529
|
+
return t.type !== this.node.type ? !1 : (this.node = t, Se(t, this.colgroup, this.table, this.cellMinWidth), !0);
|
|
5675
5530
|
}
|
|
5676
5531
|
ignoreMutation(t) {
|
|
5677
5532
|
return t.type === "attributes" && (t.target === this.table || this.colgroup.contains(t.target));
|
|
5678
5533
|
}
|
|
5679
5534
|
}
|
|
5680
|
-
function
|
|
5535
|
+
function Go(e, t, n, r) {
|
|
5681
5536
|
let s = 0, o = !0;
|
|
5682
5537
|
const i = [], a = e.firstChild;
|
|
5683
5538
|
if (!a)
|
|
@@ -5687,7 +5542,7 @@ function Yo(e, t, n, r) {
|
|
|
5687
5542
|
for (let f = 0; f < h; f += 1, p += 1) {
|
|
5688
5543
|
const g = n === p ? r : m && m[f];
|
|
5689
5544
|
s += g || t, g || (o = !1);
|
|
5690
|
-
const [y, M] =
|
|
5545
|
+
const [y, M] = jt(t, g);
|
|
5691
5546
|
i.push([
|
|
5692
5547
|
"col",
|
|
5693
5548
|
{ style: `${y}: ${M}` }
|
|
@@ -5697,10 +5552,10 @@ function Yo(e, t, n, r) {
|
|
|
5697
5552
|
const c = o ? `${s}px` : "", l = o ? "" : `${s}px`;
|
|
5698
5553
|
return { colgroup: ["colgroup", {}, ...i], tableWidth: c, tableMinWidth: l };
|
|
5699
5554
|
}
|
|
5700
|
-
function
|
|
5555
|
+
function ke(e, t) {
|
|
5701
5556
|
return e.createAndFill();
|
|
5702
5557
|
}
|
|
5703
|
-
function
|
|
5558
|
+
function Jo(e) {
|
|
5704
5559
|
if (e.cached.tableNodeTypes)
|
|
5705
5560
|
return e.cached.tableNodeTypes;
|
|
5706
5561
|
const t = {};
|
|
@@ -5709,12 +5564,12 @@ function Xo(e) {
|
|
|
5709
5564
|
r.spec.tableRole && (t[r.spec.tableRole] = r);
|
|
5710
5565
|
}), e.cached.tableNodeTypes = t, t;
|
|
5711
5566
|
}
|
|
5712
|
-
function
|
|
5713
|
-
const o =
|
|
5567
|
+
function Yo(e, t, n, r, s) {
|
|
5568
|
+
const o = Jo(e), i = [], a = [];
|
|
5714
5569
|
for (let l = 0; l < n; l += 1) {
|
|
5715
|
-
const u =
|
|
5570
|
+
const u = ke(o.cell);
|
|
5716
5571
|
if (u && a.push(u), r) {
|
|
5717
|
-
const d =
|
|
5572
|
+
const d = ke(o.header_cell);
|
|
5718
5573
|
d && i.push(d);
|
|
5719
5574
|
}
|
|
5720
5575
|
}
|
|
@@ -5723,21 +5578,21 @@ function Qo(e, t, n, r, s) {
|
|
|
5723
5578
|
c.push(o.row.createChecked(null, r && l === 0 ? i : a));
|
|
5724
5579
|
return o.table.createChecked(null, c);
|
|
5725
5580
|
}
|
|
5726
|
-
function
|
|
5727
|
-
return e instanceof
|
|
5581
|
+
function Xo(e) {
|
|
5582
|
+
return e instanceof Ce;
|
|
5728
5583
|
}
|
|
5729
5584
|
const ct = ({ editor: e }) => {
|
|
5730
5585
|
const { selection: t } = e.state;
|
|
5731
|
-
if (!
|
|
5586
|
+
if (!Xo(t))
|
|
5732
5587
|
return !1;
|
|
5733
5588
|
let n = 0;
|
|
5734
|
-
const r =
|
|
5589
|
+
const r = Fe(t.ranges[0].$from, (o) => o.type.name === "table");
|
|
5735
5590
|
return r == null || r.node.descendants((o) => {
|
|
5736
5591
|
if (o.type.name === "table")
|
|
5737
5592
|
return !1;
|
|
5738
5593
|
["tableCell", "tableHeader"].includes(o.type.name) && (n += 1);
|
|
5739
5594
|
}), n === t.ranges.length ? (e.commands.deleteTable(), !0) : !1;
|
|
5740
|
-
},
|
|
5595
|
+
}, zi = P.create({
|
|
5741
5596
|
name: "table",
|
|
5742
5597
|
// @ts-ignore
|
|
5743
5598
|
addOptions() {
|
|
@@ -5747,7 +5602,7 @@ const ct = ({ editor: e }) => {
|
|
|
5747
5602
|
handleWidth: 5,
|
|
5748
5603
|
cellMinWidth: 25,
|
|
5749
5604
|
// TODO: fix
|
|
5750
|
-
View:
|
|
5605
|
+
View: qo,
|
|
5751
5606
|
lastColumnResizable: !0,
|
|
5752
5607
|
allowTableNodeSelection: !1
|
|
5753
5608
|
};
|
|
@@ -5760,7 +5615,7 @@ const ct = ({ editor: e }) => {
|
|
|
5760
5615
|
return [{ tag: "table" }];
|
|
5761
5616
|
},
|
|
5762
5617
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
5763
|
-
const { colgroup: n, tableWidth: r, tableMinWidth: s } =
|
|
5618
|
+
const { colgroup: n, tableWidth: r, tableMinWidth: s } = Go(e, this.options.cellMinWidth);
|
|
5764
5619
|
return [
|
|
5765
5620
|
"table",
|
|
5766
5621
|
C(this.options.HTMLAttributes, t, {
|
|
@@ -5773,33 +5628,33 @@ const ct = ({ editor: e }) => {
|
|
|
5773
5628
|
addCommands() {
|
|
5774
5629
|
return {
|
|
5775
5630
|
insertTable: ({ rows: e = 3, cols: t = 3, withHeaderRow: n = !0 } = {}) => ({ tr: r, dispatch: s, editor: o }) => {
|
|
5776
|
-
const i =
|
|
5631
|
+
const i = Yo(o.schema, e, t, n);
|
|
5777
5632
|
if (s) {
|
|
5778
5633
|
const a = r.selection.from + 1;
|
|
5779
5634
|
r.replaceSelectionWith(i).scrollIntoView().setSelection(D.near(r.doc.resolve(a)));
|
|
5780
5635
|
}
|
|
5781
5636
|
return !0;
|
|
5782
5637
|
},
|
|
5783
|
-
addColumnBefore: () => ({ state: e, dispatch: t }) =>
|
|
5784
|
-
addColumnAfter: () => ({ state: e, dispatch: t }) =>
|
|
5785
|
-
deleteColumn: () => ({ state: e, dispatch: t }) =>
|
|
5786
|
-
addRowBefore: () => ({ state: e, dispatch: t }) =>
|
|
5787
|
-
addRowAfter: () => ({ state: e, dispatch: t }) =>
|
|
5788
|
-
deleteRow: () => ({ state: e, dispatch: t }) =>
|
|
5789
|
-
deleteTable: () => ({ state: e, dispatch: t }) =>
|
|
5790
|
-
mergeCells: () => ({ state: e, dispatch: t }) =>
|
|
5791
|
-
splitCell: () => ({ state: e, dispatch: t }) =>
|
|
5792
|
-
toggleHeaderColumn: () => ({ state: e, dispatch: t }) =>
|
|
5793
|
-
toggleHeaderRow: () => ({ state: e, dispatch: t }) =>
|
|
5794
|
-
toggleHeaderCell: () => ({ state: e, dispatch: t }) =>
|
|
5795
|
-
mergeOrSplit: () => ({ state: e, dispatch: t }) =>
|
|
5796
|
-
setCellAttribute: (e, t) => ({ state: n, dispatch: r }) =>
|
|
5797
|
-
goToNextCell: () => ({ state: e, dispatch: t }) =>
|
|
5798
|
-
goToPreviousCell: () => ({ state: e, dispatch: t }) =>
|
|
5799
|
-
fixTables: () => ({ state: e, dispatch: t }) => (t &&
|
|
5638
|
+
addColumnBefore: () => ({ state: e, dispatch: t }) => Gn(e, t),
|
|
5639
|
+
addColumnAfter: () => ({ state: e, dispatch: t }) => qn(e, t),
|
|
5640
|
+
deleteColumn: () => ({ state: e, dispatch: t }) => Un(e, t),
|
|
5641
|
+
addRowBefore: () => ({ state: e, dispatch: t }) => Kn(e, t),
|
|
5642
|
+
addRowAfter: () => ({ state: e, dispatch: t }) => Wn(e, t),
|
|
5643
|
+
deleteRow: () => ({ state: e, dispatch: t }) => Vn(e, t),
|
|
5644
|
+
deleteTable: () => ({ state: e, dispatch: t }) => zn(e, t),
|
|
5645
|
+
mergeCells: () => ({ state: e, dispatch: t }) => ne(e, t),
|
|
5646
|
+
splitCell: () => ({ state: e, dispatch: t }) => re(e, t),
|
|
5647
|
+
toggleHeaderColumn: () => ({ state: e, dispatch: t }) => se("column")(e, t),
|
|
5648
|
+
toggleHeaderRow: () => ({ state: e, dispatch: t }) => se("row")(e, t),
|
|
5649
|
+
toggleHeaderCell: () => ({ state: e, dispatch: t }) => Fn(e, t),
|
|
5650
|
+
mergeOrSplit: () => ({ state: e, dispatch: t }) => ne(e, t) ? !0 : re(e, t),
|
|
5651
|
+
setCellAttribute: (e, t) => ({ state: n, dispatch: r }) => jn(e, t)(n, r),
|
|
5652
|
+
goToNextCell: () => ({ state: e, dispatch: t }) => ee(1)(e, t),
|
|
5653
|
+
goToPreviousCell: () => ({ state: e, dispatch: t }) => ee(-1)(e, t),
|
|
5654
|
+
fixTables: () => ({ state: e, dispatch: t }) => (t && Bn(e), !0),
|
|
5800
5655
|
setCellSelection: (e) => ({ tr: t, dispatch: n }) => {
|
|
5801
5656
|
if (n) {
|
|
5802
|
-
const r =
|
|
5657
|
+
const r = Ce.create(t.doc, e.anchorCell, e.headCell);
|
|
5803
5658
|
t.setSelection(r);
|
|
5804
5659
|
}
|
|
5805
5660
|
return !0;
|
|
@@ -5819,7 +5674,7 @@ const ct = ({ editor: e }) => {
|
|
|
5819
5674
|
addProseMirrorPlugins() {
|
|
5820
5675
|
return [
|
|
5821
5676
|
...this.options.resizable && this.editor.isEditable ? [
|
|
5822
|
-
|
|
5677
|
+
Dn({
|
|
5823
5678
|
handleWidth: this.options.handleWidth,
|
|
5824
5679
|
cellMinWidth: this.options.cellMinWidth,
|
|
5825
5680
|
defaultCellMinWidth: this.options.cellMinWidth,
|
|
@@ -5827,7 +5682,7 @@ const ct = ({ editor: e }) => {
|
|
|
5827
5682
|
lastColumnResizable: this.options.lastColumnResizable
|
|
5828
5683
|
})
|
|
5829
5684
|
] : [],
|
|
5830
|
-
|
|
5685
|
+
Nn({
|
|
5831
5686
|
allowTableNodeSelection: this.options.allowTableNodeSelection
|
|
5832
5687
|
})
|
|
5833
5688
|
];
|
|
@@ -5842,7 +5697,7 @@ const ct = ({ editor: e }) => {
|
|
|
5842
5697
|
tableRole: E(S(e, "tableRole", t))
|
|
5843
5698
|
};
|
|
5844
5699
|
}
|
|
5845
|
-
}),
|
|
5700
|
+
}), Vi = P.create({
|
|
5846
5701
|
name: "tableCell",
|
|
5847
5702
|
addOptions() {
|
|
5848
5703
|
return {
|
|
@@ -5877,7 +5732,7 @@ const ct = ({ editor: e }) => {
|
|
|
5877
5732
|
renderHTML({ HTMLAttributes: e }) {
|
|
5878
5733
|
return ["td", C(this.options.HTMLAttributes, e), 0];
|
|
5879
5734
|
}
|
|
5880
|
-
}),
|
|
5735
|
+
}), Wi = P.create({
|
|
5881
5736
|
name: "tableHeader",
|
|
5882
5737
|
addOptions() {
|
|
5883
5738
|
return {
|
|
@@ -5912,7 +5767,7 @@ const ct = ({ editor: e }) => {
|
|
|
5912
5767
|
renderHTML({ HTMLAttributes: e }) {
|
|
5913
5768
|
return ["th", C(this.options.HTMLAttributes, e), 0];
|
|
5914
5769
|
}
|
|
5915
|
-
}),
|
|
5770
|
+
}), Qo = new I("mention"), Ki = P.create({
|
|
5916
5771
|
name: "mention",
|
|
5917
5772
|
priority: 101,
|
|
5918
5773
|
addOptions() {
|
|
@@ -5933,7 +5788,7 @@ const ct = ({ editor: e }) => {
|
|
|
5933
5788
|
},
|
|
5934
5789
|
suggestion: {
|
|
5935
5790
|
char: "@",
|
|
5936
|
-
pluginKey:
|
|
5791
|
+
pluginKey: Qo,
|
|
5937
5792
|
command: ({ editor: e, range: t, props: n }) => {
|
|
5938
5793
|
var r, s, o;
|
|
5939
5794
|
const i = e.view.state.selection.$to.nodeAfter;
|
|
@@ -6029,7 +5884,7 @@ const ct = ({ editor: e }) => {
|
|
|
6029
5884
|
},
|
|
6030
5885
|
addProseMirrorPlugins() {
|
|
6031
5886
|
return [
|
|
6032
|
-
|
|
5887
|
+
Ko({
|
|
6033
5888
|
editor: this.editor,
|
|
6034
5889
|
...this.options.suggestion
|
|
6035
5890
|
})
|
|
@@ -6037,61 +5892,59 @@ const ct = ({ editor: e }) => {
|
|
|
6037
5892
|
}
|
|
6038
5893
|
});
|
|
6039
5894
|
export {
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
ai as a2,
|
|
6072
|
-
di as b,
|
|
5895
|
+
oi as $,
|
|
5896
|
+
Fi as A,
|
|
5897
|
+
ii as B,
|
|
5898
|
+
hi as C,
|
|
5899
|
+
Di as D,
|
|
5900
|
+
_ as E,
|
|
5901
|
+
mi as F,
|
|
5902
|
+
_i as G,
|
|
5903
|
+
gi as H,
|
|
5904
|
+
di as I,
|
|
5905
|
+
Wi as J,
|
|
5906
|
+
Vi as K,
|
|
5907
|
+
Ti as L,
|
|
5908
|
+
Ki as M,
|
|
5909
|
+
ai as N,
|
|
5910
|
+
Si as O,
|
|
5911
|
+
$i as P,
|
|
5912
|
+
Jt as Q,
|
|
5913
|
+
li as R,
|
|
5914
|
+
pi as S,
|
|
5915
|
+
yi as T,
|
|
5916
|
+
ui as U,
|
|
5917
|
+
de as V,
|
|
5918
|
+
ji as W,
|
|
5919
|
+
We as X,
|
|
5920
|
+
lr as Y,
|
|
5921
|
+
ri as Z,
|
|
5922
|
+
ps as _,
|
|
5923
|
+
ci as a,
|
|
5924
|
+
si as a0,
|
|
5925
|
+
P as b,
|
|
6073
5926
|
vi as c,
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
5927
|
+
bi as d,
|
|
5928
|
+
Mi as e,
|
|
5929
|
+
wi as f,
|
|
5930
|
+
ki as g,
|
|
5931
|
+
Ei as h,
|
|
5932
|
+
qt as i,
|
|
5933
|
+
Ci as j,
|
|
5934
|
+
xi as k,
|
|
5935
|
+
Li as l,
|
|
6083
5936
|
C as m,
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
5937
|
+
Ii as n,
|
|
5938
|
+
Oi as o,
|
|
5939
|
+
Ai as p,
|
|
5940
|
+
Hi as q,
|
|
5941
|
+
Pi as r,
|
|
6089
5942
|
Ri as s,
|
|
6090
|
-
|
|
6091
|
-
|
|
5943
|
+
Ks as t,
|
|
5944
|
+
fi as u,
|
|
6092
5945
|
Ni as v,
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
5946
|
+
Bi as w,
|
|
5947
|
+
Ko as x,
|
|
5948
|
+
yo as y,
|
|
5949
|
+
zi as z
|
|
6097
5950
|
};
|