reactjs-tiptap-editor 0.0.30 → 0.0.32
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/index.d.cts +109 -79
- package/lib/index.d.ts +109 -79
- package/lib/locales-CNDUZakH.cjs +1 -0
- package/lib/{locales-D767TIQP.js → locales-RKFY1Hr_.js} +143 -132
- package/lib/reactjs-tiptap-editor.cjs +1 -1
- package/lib/reactjs-tiptap-editor.js +32 -31
- package/lib/style.css +1 -1
- package/lib/{tiptap-Dr2jJgw-.cjs → tiptap-Bskeq9lj.cjs} +12 -12
- package/lib/{tiptap-CK44C-2f.js → tiptap-CBhddmxi.js} +389 -379
- package/lib/{utils-DrrJak96.js → utils-B-vBjKHn.js} +3052 -2555
- package/lib/utils-DoNOKFuh.cjs +135 -0
- package/lib/{vendor-D533qV8r.js → vendor-CnblLvXI.js} +4288 -3922
- package/lib/vendor-xLJPanGi.cjs +17 -0
- package/package.json +6 -1
- package/lib/locales-CIjswkre.cjs +0 -1
- package/lib/utils-DW_zDPZv.cjs +0 -135
- package/lib/vendor-JmPfJfTA.cjs +0 -17
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { P, a as $, N as Z, S as G, f as We, c as Bt, T as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import Ve from "tippy.js";
|
|
2
|
+
import { P, a as $, N as Z, S as G, f as We, c as Bt, T as Ke, l as Ue, b as qe, d as N, e as Ge, g as Je, j as Ye, h as Xe, i as Qe, k as Ze, m as Me, n as tn, o as en, p as nn, q as rn, r as sn, s as on, t as an, u as ln, v as cn, w as dn, x as un, y as Yt, z as pn, A as lt, F as ct, B as hn, C as fn, D as mn, E as gn, G as yn, H as bn, I as Se, J as wt, R as vn, K as Mn, L as Sn, M as Xt, O as ke, Q as kn, U as wn, V as Tn, W as En, X as Cn, Y as xn, Z as ut, _ as jt, $ as An, a0 as On, a1 as Ln, a2 as Rn, a3 as _n, a4 as Hn, a5 as In, a6 as Pn, a7 as Qt, a8 as Zt, a9 as te, aa as Nn, ab as $n, ac as ee, ad as Dn, ae as we, af as Bn, ag as jn } from "./vendor-CnblLvXI.js";
|
|
3
|
+
import O, { forwardRef as Fn, useRef as zn, useState as Ft, useDebugValue as Te, useEffect as zt, createContext as Ee, useContext as Ce } from "react";
|
|
4
|
+
import Vn, { flushSync as Wn } from "react-dom";
|
|
5
5
|
function ft(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 mt {
|
|
|
87
87
|
return a;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
class
|
|
90
|
+
class Kn {
|
|
91
91
|
constructor() {
|
|
92
92
|
this.callbacks = {};
|
|
93
93
|
}
|
|
@@ -208,10 +208,10 @@ function Ae(e) {
|
|
|
208
208
|
function T(e, t = void 0, ...n) {
|
|
209
209
|
return Ae(e) ? t ? e.bind(t)(...n) : e(...n) : e;
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function Un(e = {}) {
|
|
212
212
|
return Object.keys(e).length === 0 && e.constructor === Object;
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function qn(e) {
|
|
215
215
|
return typeof e != "string" ? e : e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" ? !0 : e === "false" ? !1 : e;
|
|
216
216
|
}
|
|
217
217
|
function ne(e, t) {
|
|
@@ -222,7 +222,7 @@ function ne(e, t) {
|
|
|
222
222
|
if (r === !1)
|
|
223
223
|
return !1;
|
|
224
224
|
const s = t.reduce((o, i) => {
|
|
225
|
-
const a = i.attribute.parseHTML ? i.attribute.parseHTML(n) :
|
|
225
|
+
const a = i.attribute.parseHTML ? i.attribute.parseHTML(n) : qn(n.getAttribute(i.name));
|
|
226
226
|
return a == null ? o : {
|
|
227
227
|
...o,
|
|
228
228
|
[i.name]: a
|
|
@@ -235,10 +235,10 @@ function ne(e, t) {
|
|
|
235
235
|
function re(e) {
|
|
236
236
|
return Object.fromEntries(
|
|
237
237
|
// @ts-ignore
|
|
238
|
-
Object.entries(e).filter(([t, n]) => t === "attrs" &&
|
|
238
|
+
Object.entries(e).filter(([t, n]) => t === "attrs" && Un(n) ? !1 : n != null)
|
|
239
239
|
);
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function Gn(e, t) {
|
|
242
242
|
var n;
|
|
243
243
|
const r = xe(e), { nodeExtensions: s, markExtensions: o } = gt(e), i = (n = s.find((c) => v(c, "topNode"))) === null || n === void 0 ? void 0 : n.name, a = Object.fromEntries(s.map((c) => {
|
|
244
244
|
const u = r.filter((m) => m.type === c.name), d = {
|
|
@@ -321,7 +321,7 @@ function Tt(e, t) {
|
|
|
321
321
|
function se(e, t) {
|
|
322
322
|
return Array.isArray(t) ? t.some((n) => (typeof n == "string" ? n : n.name) === e.name) : t;
|
|
323
323
|
}
|
|
324
|
-
const
|
|
324
|
+
const Jn = (e, t = 500) => {
|
|
325
325
|
let n = "";
|
|
326
326
|
const r = e.parentOffset;
|
|
327
327
|
return e.parent.nodesBetween(Math.max(0, r - t), r, (s, o, i, a) => {
|
|
@@ -335,7 +335,7 @@ const Gn = (e, t = 500) => {
|
|
|
335
335
|
n += s.isAtom && !s.isText ? u : u.slice(0, Math.max(0, r - o));
|
|
336
336
|
}), n;
|
|
337
337
|
};
|
|
338
|
-
function
|
|
338
|
+
function Vt(e) {
|
|
339
339
|
return Object.prototype.toString.call(e) === "[object RegExp]";
|
|
340
340
|
}
|
|
341
341
|
class yt {
|
|
@@ -343,8 +343,8 @@ class yt {
|
|
|
343
343
|
this.find = t.find, this.handler = t.handler;
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
|
-
const
|
|
347
|
-
if (
|
|
346
|
+
const Yn = (e, t) => {
|
|
347
|
+
if (Vt(t))
|
|
348
348
|
return t.exec(e);
|
|
349
349
|
const n = t(e);
|
|
350
350
|
if (!n)
|
|
@@ -364,11 +364,11 @@ function st(e) {
|
|
|
364
364
|
)
|
|
365
365
|
return !1;
|
|
366
366
|
let u = !1;
|
|
367
|
-
const d =
|
|
367
|
+
const d = Jn(c) + o;
|
|
368
368
|
return i.forEach((p) => {
|
|
369
369
|
if (u)
|
|
370
370
|
return;
|
|
371
|
-
const h =
|
|
371
|
+
const h = Yn(d, p.find);
|
|
372
372
|
if (!h)
|
|
373
373
|
return;
|
|
374
374
|
const f = l.state.tr, y = ft({
|
|
@@ -396,7 +396,7 @@ function st(e) {
|
|
|
396
396
|
}), l.dispatch(f), u = !0);
|
|
397
397
|
}), u;
|
|
398
398
|
}
|
|
399
|
-
function
|
|
399
|
+
function Xn(e) {
|
|
400
400
|
const { editor: t, rules: n } = e, r = new P({
|
|
401
401
|
state: {
|
|
402
402
|
init() {
|
|
@@ -466,16 +466,16 @@ function Yn(e) {
|
|
|
466
466
|
});
|
|
467
467
|
return r;
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function Qn(e) {
|
|
470
470
|
return typeof e == "number";
|
|
471
471
|
}
|
|
472
|
-
class
|
|
472
|
+
class Zn {
|
|
473
473
|
constructor(t) {
|
|
474
474
|
this.find = t.find, this.handler = t.handler;
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
|
-
const
|
|
478
|
-
if (
|
|
477
|
+
const tr = (e, t, n) => {
|
|
478
|
+
if (Vt(t))
|
|
479
479
|
return [...e.matchAll(t)];
|
|
480
480
|
const r = t(e, n);
|
|
481
481
|
return r ? r.map((s) => {
|
|
@@ -483,7 +483,7 @@ const Zn = (e, t, n) => {
|
|
|
483
483
|
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;
|
|
484
484
|
}) : [];
|
|
485
485
|
};
|
|
486
|
-
function
|
|
486
|
+
function er(e) {
|
|
487
487
|
const { editor: t, state: n, from: r, to: s, rule: o, pasteEvent: i, dropEvent: a } = e, { commands: l, chain: c, can: u } = new mt({
|
|
488
488
|
editor: t,
|
|
489
489
|
state: n
|
|
@@ -492,7 +492,7 @@ function tr(e) {
|
|
|
492
492
|
if (!h.isTextblock || h.type.spec.code)
|
|
493
493
|
return;
|
|
494
494
|
const y = Math.max(r, f), g = Math.min(s, f + h.content.size), m = h.textBetween(y - f, g - f, void 0, "");
|
|
495
|
-
|
|
495
|
+
tr(m, o.find, i).forEach((b) => {
|
|
496
496
|
if (b.index === void 0)
|
|
497
497
|
return;
|
|
498
498
|
const S = y + b.index + 1, w = S + b[0].length, M = {
|
|
@@ -512,14 +512,14 @@ function tr(e) {
|
|
|
512
512
|
});
|
|
513
513
|
}), d.every((h) => h !== null);
|
|
514
514
|
}
|
|
515
|
-
const
|
|
515
|
+
const nr = (e) => {
|
|
516
516
|
var t;
|
|
517
517
|
const n = new ClipboardEvent("paste", {
|
|
518
518
|
clipboardData: new DataTransfer()
|
|
519
519
|
});
|
|
520
520
|
return (t = n.clipboardData) === null || t === void 0 || t.setData("text/html", e), n;
|
|
521
521
|
};
|
|
522
|
-
function
|
|
522
|
+
function rr(e) {
|
|
523
523
|
const { editor: t, rules: n } = e;
|
|
524
524
|
let r = null, s = !1, o = !1, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, a = typeof DragEvent < "u" ? new DragEvent("drop") : null;
|
|
525
525
|
const l = ({ state: u, from: d, to: p, rule: h, pasteEvt: f }) => {
|
|
@@ -527,7 +527,7 @@ function nr(e) {
|
|
|
527
527
|
state: u,
|
|
528
528
|
transaction: y
|
|
529
529
|
});
|
|
530
|
-
if (!(!
|
|
530
|
+
if (!(!er({
|
|
531
531
|
editor: t,
|
|
532
532
|
state: g,
|
|
533
533
|
from: Math.max(d - 1, 0),
|
|
@@ -566,7 +566,7 @@ function nr(e) {
|
|
|
566
566
|
if (!y && !g && !k)
|
|
567
567
|
return;
|
|
568
568
|
if (k) {
|
|
569
|
-
const { from: w, text: M } = m, C = w + M.length, A =
|
|
569
|
+
const { from: w, text: M } = m, C = w + M.length, A = nr(M);
|
|
570
570
|
return l({
|
|
571
571
|
rule: u,
|
|
572
572
|
state: h,
|
|
@@ -576,7 +576,7 @@ function nr(e) {
|
|
|
576
576
|
});
|
|
577
577
|
}
|
|
578
578
|
const b = p.doc.content.findDiffStart(h.doc.content), S = p.doc.content.findDiffEnd(h.doc.content);
|
|
579
|
-
if (!(!
|
|
579
|
+
if (!(!Qn(b) || !S || b === S.b))
|
|
580
580
|
return l({
|
|
581
581
|
rule: u,
|
|
582
582
|
state: h,
|
|
@@ -587,13 +587,13 @@ function nr(e) {
|
|
|
587
587
|
}
|
|
588
588
|
}));
|
|
589
589
|
}
|
|
590
|
-
function
|
|
590
|
+
function sr(e) {
|
|
591
591
|
const t = e.filter((n, r) => e.indexOf(n) !== r);
|
|
592
592
|
return Array.from(new Set(t));
|
|
593
593
|
}
|
|
594
594
|
class Q {
|
|
595
595
|
constructor(t, n) {
|
|
596
|
-
this.splittableMarks = [], this.editor = n, this.extensions = Q.resolve(t), this.schema =
|
|
596
|
+
this.splittableMarks = [], this.editor = n, this.extensions = Q.resolve(t), this.schema = Gn(this.extensions, n), this.setupExtensions();
|
|
597
597
|
}
|
|
598
598
|
/**
|
|
599
599
|
* Returns a flattened and sorted extension list while
|
|
@@ -602,7 +602,7 @@ class Q {
|
|
|
602
602
|
* @returns An flattened and sorted array of Tiptap extensions
|
|
603
603
|
*/
|
|
604
604
|
static resolve(t) {
|
|
605
|
-
const n = Q.sort(Q.flatten(t)), r =
|
|
605
|
+
const n = Q.sort(Q.flatten(t)), r = sr(n.map((s) => s.name));
|
|
606
606
|
return r.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map((s) => `'${s}'`).join(", ")}]. This can lead to issues.`), n;
|
|
607
607
|
}
|
|
608
608
|
/**
|
|
@@ -668,7 +668,7 @@ class Q {
|
|
|
668
668
|
const y = Object.fromEntries(Object.entries(c()).map(([g, m]) => [g, () => m({ editor: t })]));
|
|
669
669
|
u = { ...u, ...y };
|
|
670
670
|
}
|
|
671
|
-
const d =
|
|
671
|
+
const d = bn(u);
|
|
672
672
|
l.push(d);
|
|
673
673
|
const p = v(i, "addInputRules", a);
|
|
674
674
|
se(i, t.options.enableInputRules) && p && r.push(...p());
|
|
@@ -682,11 +682,11 @@ class Q {
|
|
|
682
682
|
return l;
|
|
683
683
|
}).flat();
|
|
684
684
|
return [
|
|
685
|
-
|
|
685
|
+
Xn({
|
|
686
686
|
editor: t,
|
|
687
687
|
rules: r
|
|
688
688
|
}),
|
|
689
|
-
...
|
|
689
|
+
...rr({
|
|
690
690
|
editor: t,
|
|
691
691
|
rules: s
|
|
692
692
|
}),
|
|
@@ -751,11 +751,11 @@ class Q {
|
|
|
751
751
|
});
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function or(e) {
|
|
755
755
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
756
756
|
}
|
|
757
757
|
function ot(e) {
|
|
758
|
-
return
|
|
758
|
+
return or(e) !== "Object" ? !1 : e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
|
|
759
759
|
}
|
|
760
760
|
function bt(e, t) {
|
|
761
761
|
const n = { ...e };
|
|
@@ -821,7 +821,7 @@ function Oe(e, t, n) {
|
|
|
821
821
|
function Le(e) {
|
|
822
822
|
return Object.fromEntries(Object.entries(e.nodes).filter(([, t]) => t.spec.toText).map(([t, n]) => [t, n.spec.toText]));
|
|
823
823
|
}
|
|
824
|
-
const
|
|
824
|
+
const ir = R.create({
|
|
825
825
|
name: "clipboardTextSerializer",
|
|
826
826
|
addOptions() {
|
|
827
827
|
return {
|
|
@@ -844,10 +844,10 @@ const or = R.create({
|
|
|
844
844
|
})
|
|
845
845
|
];
|
|
846
846
|
}
|
|
847
|
-
}),
|
|
847
|
+
}), ar = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
|
|
848
848
|
var n;
|
|
849
849
|
e.isDestroyed || (t.dom.blur(), (n = window == null ? void 0 : window.getSelection()) === null || n === void 0 || n.removeAllRanges());
|
|
850
|
-
}), !0),
|
|
850
|
+
}), !0), lr = (e = !1) => ({ commands: t }) => t.setContent("", e), cr = () => ({ state: e, tr: t, dispatch: n }) => {
|
|
851
851
|
const { selection: r } = t, { ranges: s } = r;
|
|
852
852
|
return n && s.forEach(({ $from: o, $to: i }) => {
|
|
853
853
|
e.doc.nodesBetween(o.pos, i.pos, (a, l) => {
|
|
@@ -856,7 +856,7 @@ const or = R.create({
|
|
|
856
856
|
const { doc: c, mapping: u } = t, d = c.resolve(u.map(l)), p = c.resolve(u.map(l + a.nodeSize)), h = d.blockRange(p);
|
|
857
857
|
if (!h)
|
|
858
858
|
return;
|
|
859
|
-
const f =
|
|
859
|
+
const f = Ue(h);
|
|
860
860
|
if (a.type.isTextblock) {
|
|
861
861
|
const { defaultType: y } = d.parent.contentMatchAt(d.index());
|
|
862
862
|
t.setNodeMarkup(h.start, y);
|
|
@@ -864,12 +864,12 @@ const or = R.create({
|
|
|
864
864
|
(f || f === 0) && t.lift(h, f);
|
|
865
865
|
});
|
|
866
866
|
}), !0;
|
|
867
|
-
},
|
|
867
|
+
}, dr = (e) => (t) => e(t), ur = () => ({ state: e, dispatch: t }) => qe(e, t), pr = (e, t) => ({ editor: n, tr: r }) => {
|
|
868
868
|
const { state: s } = n, o = s.doc.slice(e.from, e.to);
|
|
869
869
|
r.deleteRange(e.from, e.to);
|
|
870
870
|
const i = r.mapping.map(t);
|
|
871
871
|
return r.insert(i, o.content), r.setSelection(new N(r.doc.resolve(i - 1))), !0;
|
|
872
|
-
},
|
|
872
|
+
}, hr = () => ({ tr: e, dispatch: t }) => {
|
|
873
873
|
const { selection: n } = e, r = n.$anchor.node();
|
|
874
874
|
if (r.content.size > 0)
|
|
875
875
|
return !1;
|
|
@@ -883,7 +883,7 @@ const or = R.create({
|
|
|
883
883
|
return !0;
|
|
884
884
|
}
|
|
885
885
|
return !1;
|
|
886
|
-
},
|
|
886
|
+
}, fr = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
887
887
|
const s = H(e, n.schema), o = t.selection.$anchor;
|
|
888
888
|
for (let i = o.depth; i > 0; i -= 1)
|
|
889
889
|
if (o.node(i).type === s) {
|
|
@@ -894,21 +894,21 @@ const or = R.create({
|
|
|
894
894
|
return !0;
|
|
895
895
|
}
|
|
896
896
|
return !1;
|
|
897
|
-
},
|
|
897
|
+
}, mr = (e) => ({ tr: t, dispatch: n }) => {
|
|
898
898
|
const { from: r, to: s } = e;
|
|
899
899
|
return n && t.delete(r, s), !0;
|
|
900
|
-
},
|
|
900
|
+
}, gr = () => ({ state: e, dispatch: t }) => Ge(e, t), yr = () => ({ commands: e }) => e.keyboardShortcut("Enter"), br = () => ({ state: e, dispatch: t }) => Je(e, t);
|
|
901
901
|
function pt(e, t, n = { strict: !0 }) {
|
|
902
902
|
const r = Object.keys(t);
|
|
903
|
-
return r.length ? r.every((s) => n.strict ? t[s] === e[s] :
|
|
903
|
+
return r.length ? r.every((s) => n.strict ? t[s] === e[s] : Vt(t[s]) ? t[s].test(e[s]) : t[s] === e[s]) : !0;
|
|
904
904
|
}
|
|
905
905
|
function _t(e, t, n = {}) {
|
|
906
906
|
return e.find((r) => r.type === t && pt(r.attrs, n));
|
|
907
907
|
}
|
|
908
|
-
function
|
|
908
|
+
function vr(e, t, n = {}) {
|
|
909
909
|
return !!_t(e, t, n);
|
|
910
910
|
}
|
|
911
|
-
function
|
|
911
|
+
function Wt(e, t, n = {}) {
|
|
912
912
|
if (!e || !t)
|
|
913
913
|
return;
|
|
914
914
|
let r = e.parent.childAfter(e.parentOffset);
|
|
@@ -920,14 +920,14 @@ function Vt(e, t, n = {}) {
|
|
|
920
920
|
let o = r.index, i = e.start() + r.offset, a = o + 1, l = i + r.node.nodeSize;
|
|
921
921
|
for (_t([...r.node.marks], t, n); o > 0 && s.isInSet(e.parent.child(o - 1).marks); )
|
|
922
922
|
o -= 1, i -= e.parent.child(o).nodeSize;
|
|
923
|
-
for (; a < e.parent.childCount &&
|
|
923
|
+
for (; a < e.parent.childCount && vr([...e.parent.child(a).marks], t, n); )
|
|
924
924
|
l += e.parent.child(a).nodeSize, a += 1;
|
|
925
925
|
return {
|
|
926
926
|
from: i,
|
|
927
927
|
to: l
|
|
928
928
|
};
|
|
929
929
|
}
|
|
930
|
-
function
|
|
930
|
+
function V(e, t) {
|
|
931
931
|
if (typeof e == "string") {
|
|
932
932
|
if (!t.marks[e])
|
|
933
933
|
throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);
|
|
@@ -935,17 +935,17 @@ function W(e, t) {
|
|
|
935
935
|
}
|
|
936
936
|
return e;
|
|
937
937
|
}
|
|
938
|
-
const
|
|
939
|
-
const o =
|
|
938
|
+
const Mr = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
939
|
+
const o = V(e, r.schema), { doc: i, selection: a } = n, { $from: l, from: c, to: u } = a;
|
|
940
940
|
if (s) {
|
|
941
|
-
const d =
|
|
941
|
+
const d = Wt(l, o, t);
|
|
942
942
|
if (d && d.from <= c && d.to >= u) {
|
|
943
943
|
const p = N.create(i, d.from, d.to);
|
|
944
944
|
n.setSelection(p);
|
|
945
945
|
}
|
|
946
946
|
}
|
|
947
947
|
return !0;
|
|
948
|
-
},
|
|
948
|
+
}, Sr = (e) => (t) => {
|
|
949
949
|
const n = typeof e == "function" ? e(t) : e;
|
|
950
950
|
for (let r = 0; r < n.length; r += 1)
|
|
951
951
|
if (n[r](t))
|
|
@@ -979,7 +979,7 @@ function vt() {
|
|
|
979
979
|
"iPod"
|
|
980
980
|
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
981
981
|
}
|
|
982
|
-
const
|
|
982
|
+
const kr = (e = null, t = {}) => ({ editor: n, view: r, tr: s, dispatch: o }) => {
|
|
983
983
|
t = {
|
|
984
984
|
scrollIntoView: !0,
|
|
985
985
|
...t
|
|
@@ -995,7 +995,7 @@ const Sr = (e = null, t = {}) => ({ editor: n, view: r, tr: s, dispatch: o }) =>
|
|
|
995
995
|
return i(), !0;
|
|
996
996
|
const a = Re(s.doc, e) || n.state.selection, l = n.state.selection.eq(a);
|
|
997
997
|
return o && (l || s.setSelection(a), l && s.storedMarks && s.setStoredMarks(s.storedMarks), i()), !0;
|
|
998
|
-
},
|
|
998
|
+
}, wr = (e, t) => (n) => e.every((r, s) => t(r, { ...n, index: s })), Tr = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({ from: n.selection.from, to: n.selection.to }, e, t), _e = (e) => {
|
|
999
999
|
const t = e.childNodes;
|
|
1000
1000
|
for (let n = t.length - 1; n >= 0; n -= 1) {
|
|
1001
1001
|
const r = t[n];
|
|
@@ -1054,12 +1054,12 @@ function ht(e, t, n) {
|
|
|
1054
1054
|
}
|
|
1055
1055
|
return ht("", t, n);
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1057
|
+
function Er(e, t, n) {
|
|
1058
1058
|
const r = e.steps.length - 1;
|
|
1059
1059
|
if (r < t)
|
|
1060
1060
|
return;
|
|
1061
1061
|
const s = e.steps[r];
|
|
1062
|
-
if (!(s instanceof
|
|
1062
|
+
if (!(s instanceof vn || s instanceof Mn))
|
|
1063
1063
|
return;
|
|
1064
1064
|
const o = e.mapping.maps[r];
|
|
1065
1065
|
let i = 0;
|
|
@@ -1067,7 +1067,7 @@ function Tr(e, t, n) {
|
|
|
1067
1067
|
i === 0 && (i = u);
|
|
1068
1068
|
}), e.setSelection(G.near(e.doc.resolve(i), n));
|
|
1069
1069
|
}
|
|
1070
|
-
const
|
|
1070
|
+
const Cr = (e) => !("type" in e), xr = (e, t, n) => ({ tr: r, dispatch: s, editor: o }) => {
|
|
1071
1071
|
var i;
|
|
1072
1072
|
if (s) {
|
|
1073
1073
|
n = {
|
|
@@ -1096,35 +1096,35 @@ const Er = (e) => !("type" in e), Cr = (e, t, n) => ({ tr: r, dispatch: s, edito
|
|
|
1096
1096
|
}), !1;
|
|
1097
1097
|
}
|
|
1098
1098
|
let { from: l, to: c } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, u = !0, d = !0;
|
|
1099
|
-
if ((
|
|
1099
|
+
if ((Cr(a) ? a : [a]).forEach((f) => {
|
|
1100
1100
|
f.check(), u = u ? f.isText && f.marks.length === 0 : !1, d = d ? f.isBlock : !1;
|
|
1101
1101
|
}), l === c && d) {
|
|
1102
1102
|
const { parent: f } = r.doc.resolve(l);
|
|
1103
1103
|
f.isTextblock && !f.type.spec.code && !f.childCount && (l -= 1, c += 1);
|
|
1104
1104
|
}
|
|
1105
1105
|
let h;
|
|
1106
|
-
u ? (Array.isArray(t) ? h = t.map((f) => f.text || "").join("") : typeof t == "object" && t && t.text ? h = t.text : h = t, r.insertText(h, l, c)) : (h = a, r.replaceWith(l, c, h)), n.updateSelection &&
|
|
1106
|
+
u ? (Array.isArray(t) ? h = t.map((f) => f.text || "").join("") : typeof t == "object" && t && t.text ? h = t.text : h = t, r.insertText(h, l, c)) : (h = a, r.replaceWith(l, c, h)), n.updateSelection && Er(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: l, text: h }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: l, text: h });
|
|
1107
1107
|
}
|
|
1108
1108
|
return !0;
|
|
1109
|
-
},
|
|
1109
|
+
}, Ar = () => ({ state: e, dispatch: t }) => Ye(e, t), Or = () => ({ state: e, dispatch: t }) => Xe(e, t), Lr = () => ({ state: e, dispatch: t }) => Qe(e, t), Rr = () => ({ state: e, dispatch: t }) => Ze(e, t), _r = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
1110
1110
|
try {
|
|
1111
1111
|
const r = Me(e.doc, e.selection.$from.pos, -1);
|
|
1112
1112
|
return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
1113
1113
|
} catch {
|
|
1114
1114
|
return !1;
|
|
1115
1115
|
}
|
|
1116
|
-
},
|
|
1116
|
+
}, Hr = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
1117
1117
|
try {
|
|
1118
1118
|
const r = Me(e.doc, e.selection.$from.pos, 1);
|
|
1119
1119
|
return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
1120
1120
|
} catch {
|
|
1121
1121
|
return !1;
|
|
1122
1122
|
}
|
|
1123
|
-
},
|
|
1123
|
+
}, Ir = () => ({ state: e, dispatch: t }) => tn(e, t), Pr = () => ({ state: e, dispatch: t }) => en(e, t);
|
|
1124
1124
|
function He() {
|
|
1125
1125
|
return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
|
|
1126
1126
|
}
|
|
1127
|
-
function
|
|
1127
|
+
function Nr(e) {
|
|
1128
1128
|
const t = e.split(/-(?!$)/);
|
|
1129
1129
|
let n = t[t.length - 1];
|
|
1130
1130
|
n === "Space" && (n = " ");
|
|
@@ -1146,8 +1146,8 @@ function Pr(e) {
|
|
|
1146
1146
|
}
|
|
1147
1147
|
return r && (n = `Alt-${n}`), s && (n = `Ctrl-${n}`), i && (n = `Meta-${n}`), o && (n = `Shift-${n}`), n;
|
|
1148
1148
|
}
|
|
1149
|
-
const
|
|
1150
|
-
const o =
|
|
1149
|
+
const $r = (e) => ({ editor: t, view: n, tr: r, dispatch: s }) => {
|
|
1150
|
+
const o = Nr(e).split(/-(?!$)/), i = o.find((c) => !["Alt", "Ctrl", "Meta", "Shift"].includes(c)), a = new KeyboardEvent("keydown", {
|
|
1151
1151
|
key: i === "Space" ? " " : i,
|
|
1152
1152
|
altKey: o.includes("Alt"),
|
|
1153
1153
|
ctrlKey: o.includes("Ctrl"),
|
|
@@ -1178,13 +1178,13 @@ function nt(e, t, n = {}) {
|
|
|
1178
1178
|
const l = s - r, c = a.filter((d) => i ? i.name === d.node.type.name : !0).filter((d) => pt(d.node.attrs, n, { strict: !1 }));
|
|
1179
1179
|
return o ? !!c.length : c.reduce((d, p) => d + p.to - p.from, 0) >= l;
|
|
1180
1180
|
}
|
|
1181
|
-
const
|
|
1181
|
+
const Dr = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1182
1182
|
const s = H(e, n.schema);
|
|
1183
|
-
return nt(n, s, t) ?
|
|
1184
|
-
},
|
|
1183
|
+
return nt(n, s, t) ? nn(n, r) : !1;
|
|
1184
|
+
}, Br = () => ({ state: e, dispatch: t }) => rn(e, t), jr = (e) => ({ state: t, dispatch: n }) => {
|
|
1185
1185
|
const r = H(e, t.schema);
|
|
1186
|
-
return
|
|
1187
|
-
},
|
|
1186
|
+
return sn(r)(t, n);
|
|
1187
|
+
}, Fr = () => ({ state: e, dispatch: t }) => on(e, t);
|
|
1188
1188
|
function Mt(e, t) {
|
|
1189
1189
|
return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
|
|
1190
1190
|
}
|
|
@@ -1192,20 +1192,20 @@ function oe(e, t) {
|
|
|
1192
1192
|
const n = typeof t == "string" ? [t] : t;
|
|
1193
1193
|
return Object.keys(e).reduce((r, s) => (n.includes(s) || (r[s] = e[s]), r), {});
|
|
1194
1194
|
}
|
|
1195
|
-
const
|
|
1195
|
+
const zr = (e, t) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1196
1196
|
let o = null, i = null;
|
|
1197
1197
|
const a = Mt(typeof e == "string" ? e : e.name, r.schema);
|
|
1198
|
-
return a ? (a === "node" && (o = H(e, r.schema)), a === "mark" && (i =
|
|
1198
|
+
return a ? (a === "node" && (o = H(e, r.schema)), a === "mark" && (i = V(e, r.schema)), s && n.selection.ranges.forEach((l) => {
|
|
1199
1199
|
r.doc.nodesBetween(l.$from.pos, l.$to.pos, (c, u) => {
|
|
1200
1200
|
o && o === c.type && n.setNodeMarkup(u, void 0, oe(c.attrs, t)), i && c.marks.length && c.marks.forEach((d) => {
|
|
1201
1201
|
i === d.type && n.addMark(u, u + c.nodeSize, i.create(oe(d.attrs, t)));
|
|
1202
1202
|
});
|
|
1203
1203
|
});
|
|
1204
1204
|
}), !0) : !1;
|
|
1205
|
-
},
|
|
1205
|
+
}, Vr = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), Wr = () => ({ tr: e, commands: t }) => t.setTextSelection({
|
|
1206
1206
|
from: 0,
|
|
1207
1207
|
to: e.doc.content.size
|
|
1208
|
-
}),
|
|
1208
|
+
}), Kr = () => ({ state: e, dispatch: t }) => an(e, t), Ur = () => ({ state: e, dispatch: t }) => ln(e, t), qr = () => ({ state: e, dispatch: t }) => cn(e, t), Gr = () => ({ state: e, dispatch: t }) => dn(e, t), Jr = () => ({ state: e, dispatch: t }) => un(e, t);
|
|
1209
1209
|
function Ht(e, t, n = {}, r = {}) {
|
|
1210
1210
|
return ht(e, t, {
|
|
1211
1211
|
slice: !1,
|
|
@@ -1213,7 +1213,7 @@ function Ht(e, t, n = {}, r = {}) {
|
|
|
1213
1213
|
errorOnInvalidContent: r.errorOnInvalidContent
|
|
1214
1214
|
});
|
|
1215
1215
|
}
|
|
1216
|
-
const
|
|
1216
|
+
const Yr = (e, t = !1, n = {}, r = {}) => ({ editor: s, tr: o, dispatch: i, commands: a }) => {
|
|
1217
1217
|
var l, c;
|
|
1218
1218
|
const { doc: u } = o;
|
|
1219
1219
|
if (n.preserveWhitespace !== "full") {
|
|
@@ -1228,22 +1228,22 @@ const Jr = (e, t = !1, n = {}, r = {}) => ({ editor: s, tr: o, dispatch: i, comm
|
|
|
1228
1228
|
});
|
|
1229
1229
|
};
|
|
1230
1230
|
function rt(e, t) {
|
|
1231
|
-
const n =
|
|
1231
|
+
const n = V(t, e.schema), { from: r, to: s, empty: o } = e.selection, i = [];
|
|
1232
1232
|
o ? (e.storedMarks && i.push(...e.storedMarks), i.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, s, (l) => {
|
|
1233
1233
|
i.push(...l.marks);
|
|
1234
1234
|
});
|
|
1235
1235
|
const a = i.find((l) => l.type.name === n.name);
|
|
1236
1236
|
return a ? { ...a.attrs } : {};
|
|
1237
1237
|
}
|
|
1238
|
-
function
|
|
1239
|
-
const n = new
|
|
1238
|
+
function Xr(e, t) {
|
|
1239
|
+
const n = new Ke(e);
|
|
1240
1240
|
return t.forEach((r) => {
|
|
1241
1241
|
r.steps.forEach((s) => {
|
|
1242
1242
|
n.step(s);
|
|
1243
1243
|
});
|
|
1244
1244
|
}), n;
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1246
|
+
function Qr(e) {
|
|
1247
1247
|
for (let t = 0; t < e.edgeCount; t += 1) {
|
|
1248
1248
|
const { type: n } = e.edge(t);
|
|
1249
1249
|
if (n.isTextblock && !n.hasRequiredAttrs())
|
|
@@ -1251,7 +1251,7 @@ function Xr(e) {
|
|
|
1251
1251
|
}
|
|
1252
1252
|
return null;
|
|
1253
1253
|
}
|
|
1254
|
-
function
|
|
1254
|
+
function Vo(e, t) {
|
|
1255
1255
|
const n = [];
|
|
1256
1256
|
return e.descendants((r, s) => {
|
|
1257
1257
|
t(r) && n.push({
|
|
@@ -1260,7 +1260,7 @@ function Wo(e, t) {
|
|
|
1260
1260
|
});
|
|
1261
1261
|
}), n;
|
|
1262
1262
|
}
|
|
1263
|
-
function
|
|
1263
|
+
function Zr(e, t, n) {
|
|
1264
1264
|
const r = [];
|
|
1265
1265
|
return e.nodesBetween(t.from, t.to, (s, o) => {
|
|
1266
1266
|
n(s) && r.push({
|
|
@@ -1284,18 +1284,18 @@ function Ie(e, t) {
|
|
|
1284
1284
|
function Ut(e) {
|
|
1285
1285
|
return (t) => Ie(t.$from, e);
|
|
1286
1286
|
}
|
|
1287
|
-
function
|
|
1288
|
-
const n =
|
|
1287
|
+
function ts(e, t) {
|
|
1288
|
+
const n = Sn.fromSchema(t).serializeFragment(e), s = document.implementation.createHTMLDocument().createElement("div");
|
|
1289
1289
|
return s.appendChild(n), s.innerHTML;
|
|
1290
1290
|
}
|
|
1291
|
-
function
|
|
1291
|
+
function es(e, t) {
|
|
1292
1292
|
const n = {
|
|
1293
1293
|
from: 0,
|
|
1294
1294
|
to: e.content.size
|
|
1295
1295
|
};
|
|
1296
1296
|
return Oe(e, n, t);
|
|
1297
1297
|
}
|
|
1298
|
-
function
|
|
1298
|
+
function ns(e, t) {
|
|
1299
1299
|
const n = H(t, e.schema), { from: r, to: s } = e.selection, o = [];
|
|
1300
1300
|
e.doc.nodesBetween(r, s, (a) => {
|
|
1301
1301
|
o.push(a);
|
|
@@ -1305,20 +1305,20 @@ function es(e, t) {
|
|
|
1305
1305
|
}
|
|
1306
1306
|
function Pe(e, t) {
|
|
1307
1307
|
const n = Mt(typeof t == "string" ? t : t.name, e.schema);
|
|
1308
|
-
return n === "node" ?
|
|
1308
|
+
return n === "node" ? ns(e, t) : n === "mark" ? rt(e, t) : {};
|
|
1309
1309
|
}
|
|
1310
|
-
function
|
|
1310
|
+
function rs(e, t = JSON.stringify) {
|
|
1311
1311
|
const n = {};
|
|
1312
1312
|
return e.filter((r) => {
|
|
1313
1313
|
const s = t(r);
|
|
1314
1314
|
return Object.prototype.hasOwnProperty.call(n, s) ? !1 : n[s] = !0;
|
|
1315
1315
|
});
|
|
1316
1316
|
}
|
|
1317
|
-
function
|
|
1318
|
-
const t =
|
|
1317
|
+
function ss(e) {
|
|
1318
|
+
const t = rs(e);
|
|
1319
1319
|
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));
|
|
1320
1320
|
}
|
|
1321
|
-
function
|
|
1321
|
+
function os(e) {
|
|
1322
1322
|
const { mapping: t, steps: n } = e, r = [];
|
|
1323
1323
|
return t.maps.forEach((s, o) => {
|
|
1324
1324
|
const i = [];
|
|
@@ -1345,12 +1345,12 @@ function ss(e) {
|
|
|
1345
1345
|
}
|
|
1346
1346
|
});
|
|
1347
1347
|
});
|
|
1348
|
-
}),
|
|
1348
|
+
}), ss(r);
|
|
1349
1349
|
}
|
|
1350
1350
|
function qt(e, t, n) {
|
|
1351
1351
|
const r = [];
|
|
1352
1352
|
return e === t ? n.resolve(e).marks().forEach((s) => {
|
|
1353
|
-
const o = n.resolve(e), i =
|
|
1353
|
+
const o = n.resolve(e), i = Wt(o, s.type);
|
|
1354
1354
|
i && r.push({
|
|
1355
1355
|
mark: s,
|
|
1356
1356
|
...i
|
|
@@ -1370,7 +1370,7 @@ function dt(e, t, n) {
|
|
|
1370
1370
|
}));
|
|
1371
1371
|
}
|
|
1372
1372
|
function It(e, t, n = {}) {
|
|
1373
|
-
const { empty: r, ranges: s } = e.selection, o = t ?
|
|
1373
|
+
const { empty: r, ranges: s } = e.selection, o = t ? V(t, e.schema) : null;
|
|
1374
1374
|
if (r)
|
|
1375
1375
|
return !!(e.storedMarks || e.selection.$from.marks()).filter((d) => o ? o.name === d.type.name : !0).find((d) => pt(d.attrs, n, { strict: !1 }));
|
|
1376
1376
|
let i = 0;
|
|
@@ -1392,7 +1392,7 @@ function It(e, t, n = {}) {
|
|
|
1392
1392
|
const l = a.filter((d) => o ? o.name === d.mark.type.name : !0).filter((d) => pt(d.mark.attrs, n, { strict: !1 })).reduce((d, p) => d + p.to - p.from, 0), c = a.filter((d) => o ? d.mark.type !== o && d.mark.type.excludes(o) : !0).reduce((d, p) => d + p.to - p.from, 0);
|
|
1393
1393
|
return (l > 0 ? l + c : l) >= i;
|
|
1394
1394
|
}
|
|
1395
|
-
function
|
|
1395
|
+
function is(e, t, n = {}) {
|
|
1396
1396
|
if (!t)
|
|
1397
1397
|
return nt(e, null, n) || It(e, null, n);
|
|
1398
1398
|
const r = Mt(t, e.schema);
|
|
@@ -1434,7 +1434,7 @@ function Gt(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1434
1434
|
function Ne(e) {
|
|
1435
1435
|
return e instanceof Z;
|
|
1436
1436
|
}
|
|
1437
|
-
function
|
|
1437
|
+
function as(e, t, n) {
|
|
1438
1438
|
const s = e.state.doc.content.size, o = B(t, 0, s), i = B(n, 0, s), a = e.coordsAtPos(o), l = e.coordsAtPos(i, -1), c = Math.min(a.top, l.top), u = Math.max(a.bottom, l.bottom), d = Math.min(a.left, l.left), p = Math.max(a.right, l.right), h = p - d, f = u - c, m = {
|
|
1439
1439
|
top: c,
|
|
1440
1440
|
bottom: u,
|
|
@@ -1450,7 +1450,7 @@ function is(e, t, n) {
|
|
|
1450
1450
|
toJSON: () => m
|
|
1451
1451
|
};
|
|
1452
1452
|
}
|
|
1453
|
-
function
|
|
1453
|
+
function ls(e, t, n) {
|
|
1454
1454
|
var r;
|
|
1455
1455
|
const { selection: s } = t;
|
|
1456
1456
|
let o = null;
|
|
@@ -1472,8 +1472,8 @@ function as(e, t, n) {
|
|
|
1472
1472
|
}), c;
|
|
1473
1473
|
});
|
|
1474
1474
|
}
|
|
1475
|
-
const
|
|
1476
|
-
const { selection: o } = n, { empty: i, ranges: a } = o, l =
|
|
1475
|
+
const cs = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1476
|
+
const { selection: o } = n, { empty: i, ranges: a } = o, l = V(e, r.schema);
|
|
1477
1477
|
if (s)
|
|
1478
1478
|
if (i) {
|
|
1479
1479
|
const c = rt(r, l);
|
|
@@ -1494,25 +1494,25 @@ const ls = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
|
1494
1494
|
}) : n.addMark(f, y, l.create(t));
|
|
1495
1495
|
});
|
|
1496
1496
|
});
|
|
1497
|
-
return
|
|
1498
|
-
},
|
|
1497
|
+
return ls(r, n, l);
|
|
1498
|
+
}, ds = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), us = (e, t = {}) => ({ state: n, dispatch: r, chain: s }) => {
|
|
1499
1499
|
const o = H(e, n.schema);
|
|
1500
1500
|
return o.isTextblock ? s().command(({ commands: i }) => Yt(o, t)(n) ? !0 : i.clearNodes()).command(({ state: i }) => Yt(o, t)(i, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
|
|
1501
|
-
},
|
|
1501
|
+
}, ps = (e) => ({ tr: t, dispatch: n }) => {
|
|
1502
1502
|
if (n) {
|
|
1503
1503
|
const { doc: r } = t, s = B(e, 0, r.content.size), o = Z.create(r, s);
|
|
1504
1504
|
t.setSelection(o);
|
|
1505
1505
|
}
|
|
1506
1506
|
return !0;
|
|
1507
|
-
},
|
|
1507
|
+
}, hs = (e) => ({ tr: t, dispatch: n }) => {
|
|
1508
1508
|
if (n) {
|
|
1509
1509
|
const { doc: r } = t, { from: s, to: o } = typeof e == "number" ? { from: e, to: e } : e, i = N.atStart(r).from, a = N.atEnd(r).to, l = B(s, i, a), c = B(o, i, a), u = N.create(r, l, c);
|
|
1510
1510
|
t.setSelection(u);
|
|
1511
1511
|
}
|
|
1512
1512
|
return !0;
|
|
1513
|
-
},
|
|
1513
|
+
}, fs = (e) => ({ state: t, dispatch: n }) => {
|
|
1514
1514
|
const r = H(e, t.schema);
|
|
1515
|
-
return
|
|
1515
|
+
return pn(r)(t, n);
|
|
1516
1516
|
};
|
|
1517
1517
|
function ae(e, t) {
|
|
1518
1518
|
const n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
|
|
@@ -1521,13 +1521,13 @@ function ae(e, t) {
|
|
|
1521
1521
|
e.tr.ensureMarks(r);
|
|
1522
1522
|
}
|
|
1523
1523
|
}
|
|
1524
|
-
const
|
|
1524
|
+
const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: s }) => {
|
|
1525
1525
|
const { selection: o, doc: i } = t, { $from: a, $to: l } = o, c = s.extensionManager.attributes, u = dt(c, a.node().type.name, a.node().attrs);
|
|
1526
1526
|
if (o instanceof Z && o.node.isBlock)
|
|
1527
1527
|
return !a.parentOffset || !lt(i, a.pos) ? !1 : (r && (e && ae(n, s.extensionManager.splittableMarks), t.split(a.pos).scrollIntoView()), !0);
|
|
1528
1528
|
if (!a.parent.isBlock)
|
|
1529
1529
|
return !1;
|
|
1530
|
-
const d = l.parentOffset === l.parent.content.size, p = a.depth === 0 ? void 0 :
|
|
1530
|
+
const d = l.parentOffset === l.parent.content.size, p = a.depth === 0 ? void 0 : Qr(a.node(-1).contentMatchAt(a.indexAfter(-1)));
|
|
1531
1531
|
let h = d && p ? [
|
|
1532
1532
|
{
|
|
1533
1533
|
type: p,
|
|
@@ -1547,7 +1547,7 @@ const fs = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1547
1547
|
e && ae(n, s.extensionManager.splittableMarks), t.scrollIntoView();
|
|
1548
1548
|
}
|
|
1549
1549
|
return f;
|
|
1550
|
-
},
|
|
1550
|
+
}, gs = (e, t = {}) => ({ tr: n, state: r, dispatch: s, editor: o }) => {
|
|
1551
1551
|
var i;
|
|
1552
1552
|
const a = H(e, r.schema), { $from: l, $to: c } = r.selection, u = r.selection.node;
|
|
1553
1553
|
if (u && u.isBlock || l.depth < 2 || !l.sameParent(c))
|
|
@@ -1570,7 +1570,7 @@ const fs = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1570
1570
|
}, w = ((i = a.contentMatch.defaultType) === null || i === void 0 ? void 0 : i.createAndFill(S)) || void 0;
|
|
1571
1571
|
m = m.append(ct.from(a.createAndFill(null, w) || void 0));
|
|
1572
1572
|
const M = l.before(l.depth - (k - 1));
|
|
1573
|
-
n.replace(M, l.after(-b), new
|
|
1573
|
+
n.replace(M, l.after(-b), new hn(m, 4 - k, 0));
|
|
1574
1574
|
let C = -1;
|
|
1575
1575
|
n.doc.nodesBetween(M, n.doc.content.size, (A, E) => {
|
|
1576
1576
|
if (C > -1)
|
|
@@ -1620,7 +1620,7 @@ const fs = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1620
1620
|
return !0;
|
|
1621
1621
|
const s = e.doc.nodeAt(r);
|
|
1622
1622
|
return n.node.type === (s == null ? void 0 : s.type) && Bt(e.doc, r) && e.join(r), !0;
|
|
1623
|
-
},
|
|
1623
|
+
}, ys = (e, t, n, r = {}) => ({ editor: s, tr: o, state: i, dispatch: a, chain: l, commands: c, can: u }) => {
|
|
1624
1624
|
const { extensions: d, splittableMarks: p } = s.extensionManager, h = H(e, i.schema), f = H(t, i.schema), { selection: y, storedMarks: g } = i, { $from: m, $to: k } = y, b = m.blockRange(k), S = g || y.$to.parentOffset && y.$from.marks();
|
|
1625
1625
|
if (!b)
|
|
1626
1626
|
return !1;
|
|
@@ -1635,16 +1635,16 @@ const fs = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1635
1635
|
const M = u().wrapInList(h, r), C = S.filter((A) => p.includes(A.type.name));
|
|
1636
1636
|
return o.ensureMarks(C), M ? !0 : c.clearNodes();
|
|
1637
1637
|
}).wrapInList(h, r).command(() => Et(o, h)).command(() => Ct(o, h)).run();
|
|
1638
|
-
},
|
|
1639
|
-
const { extendEmptyMarkRange: o = !1 } = n, i =
|
|
1638
|
+
}, bs = (e, t = {}, n = {}) => ({ state: r, commands: s }) => {
|
|
1639
|
+
const { extendEmptyMarkRange: o = !1 } = n, i = V(e, r.schema);
|
|
1640
1640
|
return It(r, i, t) ? s.unsetMark(i, { extendEmptyMarkRange: o }) : s.setMark(i, t);
|
|
1641
|
-
},
|
|
1641
|
+
}, vs = (e, t, n = {}) => ({ state: r, commands: s }) => {
|
|
1642
1642
|
const o = H(e, r.schema), i = H(t, r.schema);
|
|
1643
1643
|
return nt(r, o, n) ? s.setNode(i) : s.setNode(o, n);
|
|
1644
|
-
},
|
|
1644
|
+
}, Ms = (e, t = {}) => ({ state: n, commands: r }) => {
|
|
1645
1645
|
const s = H(e, n.schema);
|
|
1646
1646
|
return nt(n, s, t) ? r.lift(s) : r.wrapIn(s, t);
|
|
1647
|
-
},
|
|
1647
|
+
}, Ss = () => ({ state: e, dispatch: t }) => {
|
|
1648
1648
|
const n = e.plugins;
|
|
1649
1649
|
for (let r = 0; r < n.length; r += 1) {
|
|
1650
1650
|
const s = n[r];
|
|
@@ -1664,29 +1664,29 @@ const fs = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1664
1664
|
}
|
|
1665
1665
|
}
|
|
1666
1666
|
return !1;
|
|
1667
|
-
},
|
|
1667
|
+
}, ks = () => ({ tr: e, dispatch: t }) => {
|
|
1668
1668
|
const { selection: n } = e, { empty: r, ranges: s } = n;
|
|
1669
1669
|
return r || t && s.forEach((o) => {
|
|
1670
1670
|
e.removeMark(o.$from.pos, o.$to.pos);
|
|
1671
1671
|
}), !0;
|
|
1672
|
-
},
|
|
1672
|
+
}, ws = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1673
1673
|
var o;
|
|
1674
|
-
const { extendEmptyMarkRange: i = !1 } = t, { selection: a } = n, l =
|
|
1674
|
+
const { extendEmptyMarkRange: i = !1 } = t, { selection: a } = n, l = V(e, r.schema), { $from: c, empty: u, ranges: d } = a;
|
|
1675
1675
|
if (!s)
|
|
1676
1676
|
return !0;
|
|
1677
1677
|
if (u && i) {
|
|
1678
1678
|
let { from: p, to: h } = a;
|
|
1679
|
-
const f = (o = c.marks().find((g) => g.type === l)) === null || o === void 0 ? void 0 : o.attrs, y =
|
|
1679
|
+
const f = (o = c.marks().find((g) => g.type === l)) === null || o === void 0 ? void 0 : o.attrs, y = Wt(c, l, f);
|
|
1680
1680
|
y && (p = y.from, h = y.to), n.removeMark(p, h, l);
|
|
1681
1681
|
} else
|
|
1682
1682
|
d.forEach((p) => {
|
|
1683
1683
|
n.removeMark(p.$from.pos, p.$to.pos, l);
|
|
1684
1684
|
});
|
|
1685
1685
|
return n.removeStoredMark(l), !0;
|
|
1686
|
-
},
|
|
1686
|
+
}, Ts = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1687
1687
|
let o = null, i = null;
|
|
1688
1688
|
const a = Mt(typeof e == "string" ? e : e.name, r.schema);
|
|
1689
|
-
return a ? (a === "node" && (o = H(e, r.schema)), a === "mark" && (i =
|
|
1689
|
+
return a ? (a === "node" && (o = H(e, r.schema)), a === "mark" && (i = V(e, r.schema)), s && n.selection.ranges.forEach((l) => {
|
|
1690
1690
|
const c = l.$from.pos, u = l.$to.pos;
|
|
1691
1691
|
r.doc.nodesBetween(c, u, (d, p) => {
|
|
1692
1692
|
o && o === d.type && n.setNodeMarkup(p, void 0, {
|
|
@@ -1703,82 +1703,82 @@ const fs = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1703
1703
|
});
|
|
1704
1704
|
});
|
|
1705
1705
|
}), !0) : !1;
|
|
1706
|
-
}, Ts = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1707
|
-
const s = H(e, n.schema);
|
|
1708
|
-
return hn(s, t)(n, r);
|
|
1709
1706
|
}, Es = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1710
1707
|
const s = H(e, n.schema);
|
|
1711
1708
|
return fn(s, t)(n, r);
|
|
1709
|
+
}, Cs = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1710
|
+
const s = H(e, n.schema);
|
|
1711
|
+
return mn(s, t)(n, r);
|
|
1712
1712
|
};
|
|
1713
|
-
var
|
|
1713
|
+
var xs = /* @__PURE__ */ Object.freeze({
|
|
1714
1714
|
__proto__: null,
|
|
1715
|
-
blur:
|
|
1716
|
-
clearContent:
|
|
1717
|
-
clearNodes:
|
|
1718
|
-
command:
|
|
1719
|
-
createParagraphNear:
|
|
1720
|
-
cut:
|
|
1721
|
-
deleteCurrentNode:
|
|
1722
|
-
deleteNode:
|
|
1723
|
-
deleteRange:
|
|
1724
|
-
deleteSelection:
|
|
1725
|
-
enter:
|
|
1726
|
-
exitCode:
|
|
1727
|
-
extendMarkRange:
|
|
1728
|
-
first:
|
|
1729
|
-
focus:
|
|
1730
|
-
forEach:
|
|
1731
|
-
insertContent:
|
|
1732
|
-
insertContentAt:
|
|
1733
|
-
joinBackward:
|
|
1734
|
-
joinDown:
|
|
1735
|
-
joinForward:
|
|
1736
|
-
joinItemBackward:
|
|
1737
|
-
joinItemForward:
|
|
1738
|
-
joinTextblockBackward:
|
|
1739
|
-
joinTextblockForward:
|
|
1740
|
-
joinUp:
|
|
1741
|
-
keyboardShortcut:
|
|
1742
|
-
lift:
|
|
1743
|
-
liftEmptyBlock:
|
|
1744
|
-
liftListItem:
|
|
1745
|
-
newlineInCode:
|
|
1746
|
-
resetAttributes:
|
|
1747
|
-
scrollIntoView:
|
|
1715
|
+
blur: ar,
|
|
1716
|
+
clearContent: lr,
|
|
1717
|
+
clearNodes: cr,
|
|
1718
|
+
command: dr,
|
|
1719
|
+
createParagraphNear: ur,
|
|
1720
|
+
cut: pr,
|
|
1721
|
+
deleteCurrentNode: hr,
|
|
1722
|
+
deleteNode: fr,
|
|
1723
|
+
deleteRange: mr,
|
|
1724
|
+
deleteSelection: gr,
|
|
1725
|
+
enter: yr,
|
|
1726
|
+
exitCode: br,
|
|
1727
|
+
extendMarkRange: Mr,
|
|
1728
|
+
first: Sr,
|
|
1729
|
+
focus: kr,
|
|
1730
|
+
forEach: wr,
|
|
1731
|
+
insertContent: Tr,
|
|
1732
|
+
insertContentAt: xr,
|
|
1733
|
+
joinBackward: Lr,
|
|
1734
|
+
joinDown: Or,
|
|
1735
|
+
joinForward: Rr,
|
|
1736
|
+
joinItemBackward: _r,
|
|
1737
|
+
joinItemForward: Hr,
|
|
1738
|
+
joinTextblockBackward: Ir,
|
|
1739
|
+
joinTextblockForward: Pr,
|
|
1740
|
+
joinUp: Ar,
|
|
1741
|
+
keyboardShortcut: $r,
|
|
1742
|
+
lift: Dr,
|
|
1743
|
+
liftEmptyBlock: Br,
|
|
1744
|
+
liftListItem: jr,
|
|
1745
|
+
newlineInCode: Fr,
|
|
1746
|
+
resetAttributes: zr,
|
|
1747
|
+
scrollIntoView: Vr,
|
|
1748
1748
|
selectAll: Wr,
|
|
1749
|
-
selectNodeBackward:
|
|
1750
|
-
selectNodeForward:
|
|
1751
|
-
selectParentNode:
|
|
1752
|
-
selectTextblockEnd:
|
|
1753
|
-
selectTextblockStart:
|
|
1754
|
-
setContent:
|
|
1755
|
-
setMark:
|
|
1756
|
-
setMeta:
|
|
1757
|
-
setNode:
|
|
1758
|
-
setNodeSelection:
|
|
1759
|
-
setTextSelection:
|
|
1760
|
-
sinkListItem:
|
|
1761
|
-
splitBlock:
|
|
1762
|
-
splitListItem:
|
|
1763
|
-
toggleList:
|
|
1764
|
-
toggleMark:
|
|
1765
|
-
toggleNode:
|
|
1766
|
-
toggleWrap:
|
|
1767
|
-
undoInputRule:
|
|
1768
|
-
unsetAllMarks:
|
|
1769
|
-
unsetMark:
|
|
1770
|
-
updateAttributes:
|
|
1771
|
-
wrapIn:
|
|
1772
|
-
wrapInList:
|
|
1749
|
+
selectNodeBackward: Kr,
|
|
1750
|
+
selectNodeForward: Ur,
|
|
1751
|
+
selectParentNode: qr,
|
|
1752
|
+
selectTextblockEnd: Gr,
|
|
1753
|
+
selectTextblockStart: Jr,
|
|
1754
|
+
setContent: Yr,
|
|
1755
|
+
setMark: cs,
|
|
1756
|
+
setMeta: ds,
|
|
1757
|
+
setNode: us,
|
|
1758
|
+
setNodeSelection: ps,
|
|
1759
|
+
setTextSelection: hs,
|
|
1760
|
+
sinkListItem: fs,
|
|
1761
|
+
splitBlock: ms,
|
|
1762
|
+
splitListItem: gs,
|
|
1763
|
+
toggleList: ys,
|
|
1764
|
+
toggleMark: bs,
|
|
1765
|
+
toggleNode: vs,
|
|
1766
|
+
toggleWrap: Ms,
|
|
1767
|
+
undoInputRule: Ss,
|
|
1768
|
+
unsetAllMarks: ks,
|
|
1769
|
+
unsetMark: ws,
|
|
1770
|
+
updateAttributes: Ts,
|
|
1771
|
+
wrapIn: Es,
|
|
1772
|
+
wrapInList: Cs
|
|
1773
1773
|
});
|
|
1774
|
-
const
|
|
1774
|
+
const As = R.create({
|
|
1775
1775
|
name: "commands",
|
|
1776
1776
|
addCommands() {
|
|
1777
1777
|
return {
|
|
1778
|
-
...
|
|
1778
|
+
...xs
|
|
1779
1779
|
};
|
|
1780
1780
|
}
|
|
1781
|
-
}),
|
|
1781
|
+
}), Os = R.create({
|
|
1782
1782
|
name: "editable",
|
|
1783
1783
|
addProseMirrorPlugins() {
|
|
1784
1784
|
return [
|
|
@@ -1790,7 +1790,7 @@ const xs = R.create({
|
|
|
1790
1790
|
})
|
|
1791
1791
|
];
|
|
1792
1792
|
}
|
|
1793
|
-
}),
|
|
1793
|
+
}), Ls = R.create({
|
|
1794
1794
|
name: "focusEvents",
|
|
1795
1795
|
addProseMirrorPlugins() {
|
|
1796
1796
|
const { editor: e } = this;
|
|
@@ -1814,7 +1814,7 @@ const xs = R.create({
|
|
|
1814
1814
|
})
|
|
1815
1815
|
];
|
|
1816
1816
|
}
|
|
1817
|
-
}),
|
|
1817
|
+
}), Rs = R.create({
|
|
1818
1818
|
name: "keymap",
|
|
1819
1819
|
addKeyboardShortcuts() {
|
|
1820
1820
|
const e = () => this.editor.commands.first(({ commands: i }) => [
|
|
@@ -1889,7 +1889,7 @@ const xs = R.create({
|
|
|
1889
1889
|
})
|
|
1890
1890
|
];
|
|
1891
1891
|
}
|
|
1892
|
-
}),
|
|
1892
|
+
}), _s = R.create({
|
|
1893
1893
|
name: "tabindex",
|
|
1894
1894
|
addProseMirrorPlugins() {
|
|
1895
1895
|
return [
|
|
@@ -2022,7 +2022,7 @@ class q {
|
|
|
2022
2022
|
this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name, t).setTextSelection(n.from).run();
|
|
2023
2023
|
}
|
|
2024
2024
|
}
|
|
2025
|
-
const
|
|
2025
|
+
const Hs = `.ProseMirror {
|
|
2026
2026
|
position: relative;
|
|
2027
2027
|
}
|
|
2028
2028
|
|
|
@@ -2097,14 +2097,14 @@ img.ProseMirror-separator {
|
|
|
2097
2097
|
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
2098
2098
|
opacity: 0
|
|
2099
2099
|
}`;
|
|
2100
|
-
function
|
|
2100
|
+
function Is(e, t, n) {
|
|
2101
2101
|
const r = document.querySelector("style[data-tiptap-style]");
|
|
2102
2102
|
if (r !== null)
|
|
2103
2103
|
return r;
|
|
2104
2104
|
const s = document.createElement("style");
|
|
2105
2105
|
return t && s.setAttribute("nonce", t), s.setAttribute("data-tiptap-style", ""), s.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(s), s;
|
|
2106
2106
|
}
|
|
2107
|
-
class
|
|
2107
|
+
class Ps extends Kn {
|
|
2108
2108
|
constructor(t = {}) {
|
|
2109
2109
|
super(), this.isFocused = !1, this.isInitialized = !1, this.extensionStorage = {}, this.options = {
|
|
2110
2110
|
element: document.createElement("div"),
|
|
@@ -2164,7 +2164,7 @@ class Is extends Vn {
|
|
|
2164
2164
|
* Inject CSS styles.
|
|
2165
2165
|
*/
|
|
2166
2166
|
injectCSS() {
|
|
2167
|
-
this.options.injectCSS && document && (this.css = Hs
|
|
2167
|
+
this.options.injectCSS && document && (this.css = Is(Hs, this.options.injectNonce));
|
|
2168
2168
|
}
|
|
2169
2169
|
/**
|
|
2170
2170
|
* Update editor options.
|
|
@@ -2225,14 +2225,14 @@ class Is extends Vn {
|
|
|
2225
2225
|
createExtensionManager() {
|
|
2226
2226
|
var t, n;
|
|
2227
2227
|
const s = [...this.options.enableCoreExtensions ? [
|
|
2228
|
-
|
|
2229
|
-
|
|
2228
|
+
Os,
|
|
2229
|
+
ir.configure({
|
|
2230
2230
|
blockSeparator: (n = (t = this.options.coreExtensionOptions) === null || t === void 0 ? void 0 : t.clipboardTextSerializer) === null || n === void 0 ? void 0 : n.blockSeparator
|
|
2231
2231
|
}),
|
|
2232
|
-
|
|
2233
|
-
Os,
|
|
2232
|
+
As,
|
|
2234
2233
|
Ls,
|
|
2235
|
-
Rs
|
|
2234
|
+
Rs,
|
|
2235
|
+
_s
|
|
2236
2236
|
] : [], ...this.options.extensions].filter((o) => ["extension", "node", "mark"].includes(o == null ? void 0 : o.type));
|
|
2237
2237
|
this.extensionManager = new Q(s, this);
|
|
2238
2238
|
}
|
|
@@ -2269,10 +2269,10 @@ class Is extends Vn {
|
|
|
2269
2269
|
}), t = Ht(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
|
|
2270
2270
|
}
|
|
2271
2271
|
const n = Re(t, this.options.autofocus);
|
|
2272
|
-
this.view = new
|
|
2272
|
+
this.view = new gn(this.options.element, {
|
|
2273
2273
|
...this.options.editorProps,
|
|
2274
2274
|
dispatchTransaction: this.dispatchTransaction.bind(this),
|
|
2275
|
-
state:
|
|
2275
|
+
state: yn.create({
|
|
2276
2276
|
doc: t,
|
|
2277
2277
|
selection: n || void 0
|
|
2278
2278
|
})
|
|
@@ -2356,7 +2356,7 @@ class Is extends Vn {
|
|
|
2356
2356
|
}
|
|
2357
2357
|
isActive(t, n) {
|
|
2358
2358
|
const r = typeof t == "string" ? t : null, s = typeof t == "string" ? n : t;
|
|
2359
|
-
return
|
|
2359
|
+
return is(this.state, r, s);
|
|
2360
2360
|
}
|
|
2361
2361
|
/**
|
|
2362
2362
|
* Get the document as JSON.
|
|
@@ -2368,7 +2368,7 @@ class Is extends Vn {
|
|
|
2368
2368
|
* Get the document as HTML.
|
|
2369
2369
|
*/
|
|
2370
2370
|
getHTML() {
|
|
2371
|
-
return
|
|
2371
|
+
return ts(this.state.doc.content, this.schema);
|
|
2372
2372
|
}
|
|
2373
2373
|
/**
|
|
2374
2374
|
* Get the document as text.
|
|
@@ -2377,7 +2377,7 @@ class Is extends Vn {
|
|
|
2377
2377
|
const { blockSeparator: n = `
|
|
2378
2378
|
|
|
2379
2379
|
`, textSerializers: r = {} } = t || {};
|
|
2380
|
-
return
|
|
2380
|
+
return es(this.state.doc, {
|
|
2381
2381
|
blockSeparator: n,
|
|
2382
2382
|
textSerializers: {
|
|
2383
2383
|
...Le(this.schema),
|
|
@@ -2548,7 +2548,7 @@ class I {
|
|
|
2548
2548
|
return !1;
|
|
2549
2549
|
}
|
|
2550
2550
|
}
|
|
2551
|
-
class
|
|
2551
|
+
class L {
|
|
2552
2552
|
constructor(t = {}) {
|
|
2553
2553
|
this.type = "node", this.name = "node", this.parent = null, this.child = null, this.config = {
|
|
2554
2554
|
name: this.name,
|
|
@@ -2564,7 +2564,7 @@ class O {
|
|
|
2564
2564
|
})) || {};
|
|
2565
2565
|
}
|
|
2566
2566
|
static create(t = {}) {
|
|
2567
|
-
return new
|
|
2567
|
+
return new L(t);
|
|
2568
2568
|
}
|
|
2569
2569
|
configure(t = {}) {
|
|
2570
2570
|
const n = this.extend({
|
|
@@ -2574,7 +2574,7 @@ class O {
|
|
|
2574
2574
|
return n.name = this.name, n.parent = this.parent, n;
|
|
2575
2575
|
}
|
|
2576
2576
|
extend(t = {}) {
|
|
2577
|
-
const n = new
|
|
2577
|
+
const n = new L(t);
|
|
2578
2578
|
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 = T(v(n, "addOptions", {
|
|
2579
2579
|
name: n.name
|
|
2580
2580
|
})), n.storage = T(v(n, "addStorage", {
|
|
@@ -2583,10 +2583,10 @@ class O {
|
|
|
2583
2583
|
})), n;
|
|
2584
2584
|
}
|
|
2585
2585
|
}
|
|
2586
|
-
function
|
|
2586
|
+
function Ns() {
|
|
2587
2587
|
return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
|
|
2588
2588
|
}
|
|
2589
|
-
class
|
|
2589
|
+
class $s {
|
|
2590
2590
|
constructor(t, n, r) {
|
|
2591
2591
|
this.isDragging = !1, this.component = t, this.editor = n.editor, this.options = {
|
|
2592
2592
|
stopEvent: null,
|
|
@@ -2644,7 +2644,7 @@ class Ns {
|
|
|
2644
2644
|
return !(c || i || p || h || f || y && d);
|
|
2645
2645
|
}
|
|
2646
2646
|
ignoreMutation(t) {
|
|
2647
|
-
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" && (vt() ||
|
|
2647
|
+
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" && (vt() || Ns()) && this.editor.isFocused && [
|
|
2648
2648
|
...Array.from(t.addedNodes),
|
|
2649
2649
|
...Array.from(t.removedNodes)
|
|
2650
2650
|
].every((r) => r.isContentEditable) ? !1 : this.contentDOM === t.target && t.type === "attributes" ? !0 : !this.contentDOM.contains(t.target);
|
|
@@ -2664,7 +2664,7 @@ class Ns {
|
|
|
2664
2664
|
}
|
|
2665
2665
|
}
|
|
2666
2666
|
function z(e) {
|
|
2667
|
-
return new
|
|
2667
|
+
return new Zn({
|
|
2668
2668
|
find: e.find,
|
|
2669
2669
|
handler: ({ state: t, range: n, match: r, pasteEvent: s }) => {
|
|
2670
2670
|
const o = T(e.getAttributes, void 0, r, s);
|
|
@@ -2681,10 +2681,10 @@ function z(e) {
|
|
|
2681
2681
|
}
|
|
2682
2682
|
});
|
|
2683
2683
|
}
|
|
2684
|
-
function
|
|
2684
|
+
function Ds(e) {
|
|
2685
2685
|
return e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
2686
2686
|
}
|
|
2687
|
-
const
|
|
2687
|
+
const Bs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, js = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, Fs = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, zs = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, Wo = I.create({
|
|
2688
2688
|
name: "bold",
|
|
2689
2689
|
addOptions() {
|
|
2690
2690
|
return {
|
|
@@ -2725,11 +2725,11 @@ const Ds = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Bs = /(?:^|\s
|
|
|
2725
2725
|
addInputRules() {
|
|
2726
2726
|
return [
|
|
2727
2727
|
J({
|
|
2728
|
-
find:
|
|
2728
|
+
find: Bs,
|
|
2729
2729
|
type: this.type
|
|
2730
2730
|
}),
|
|
2731
2731
|
J({
|
|
2732
|
-
find:
|
|
2732
|
+
find: Fs,
|
|
2733
2733
|
type: this.type
|
|
2734
2734
|
})
|
|
2735
2735
|
];
|
|
@@ -2737,17 +2737,17 @@ const Ds = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Bs = /(?:^|\s
|
|
|
2737
2737
|
addPasteRules() {
|
|
2738
2738
|
return [
|
|
2739
2739
|
z({
|
|
2740
|
-
find:
|
|
2740
|
+
find: js,
|
|
2741
2741
|
type: this.type
|
|
2742
2742
|
}),
|
|
2743
2743
|
z({
|
|
2744
|
-
find:
|
|
2744
|
+
find: zs,
|
|
2745
2745
|
type: this.type
|
|
2746
2746
|
})
|
|
2747
2747
|
];
|
|
2748
2748
|
}
|
|
2749
2749
|
});
|
|
2750
|
-
class
|
|
2750
|
+
class Vs {
|
|
2751
2751
|
constructor({ editor: t, element: n, view: r, tippyOptions: s = {}, updateDelay: o = 250, shouldShow: i }) {
|
|
2752
2752
|
this.preventHide = !1, this.shouldShow = ({ view: a, state: l, from: c, to: u }) => {
|
|
2753
2753
|
const { doc: d, selection: p } = l, { empty: h } = p, f = !d.textBetween(c, u).length && Kt(l.selection), y = this.element.contains(document.activeElement);
|
|
@@ -2798,14 +2798,14 @@ class zs {
|
|
|
2798
2798
|
if (C && (M = C.firstChild), M)
|
|
2799
2799
|
return M.getBoundingClientRect();
|
|
2800
2800
|
}
|
|
2801
|
-
return
|
|
2801
|
+
return as(a, b, S);
|
|
2802
2802
|
})
|
|
2803
2803
|
}), this.show();
|
|
2804
2804
|
}, 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";
|
|
2805
2805
|
}
|
|
2806
2806
|
createTooltip() {
|
|
2807
2807
|
const { element: t } = this.editor.options, n = !!t.parentElement;
|
|
2808
|
-
this.tippy || !n || (this.tippy =
|
|
2808
|
+
this.tippy || !n || (this.tippy = Ve(t, {
|
|
2809
2809
|
duration: 0,
|
|
2810
2810
|
getReferenceClientRect: null,
|
|
2811
2811
|
content: this.element,
|
|
@@ -2840,7 +2840,7 @@ class zs {
|
|
|
2840
2840
|
}
|
|
2841
2841
|
const De = (e) => new P({
|
|
2842
2842
|
key: typeof e.pluginKey == "string" ? new $(e.pluginKey) : e.pluginKey,
|
|
2843
|
-
view: (t) => new
|
|
2843
|
+
view: (t) => new Vs({ view: t, ...e })
|
|
2844
2844
|
});
|
|
2845
2845
|
R.create({
|
|
2846
2846
|
name: "bubbleMenu",
|
|
@@ -2880,7 +2880,7 @@ var le;
|
|
|
2880
2880
|
function Ws() {
|
|
2881
2881
|
if (le) return xt;
|
|
2882
2882
|
le = 1;
|
|
2883
|
-
var e =
|
|
2883
|
+
var e = O;
|
|
2884
2884
|
function t(d, p) {
|
|
2885
2885
|
return d === p && (d !== 0 || 1 / d === 1 / p) || d !== d && p !== p;
|
|
2886
2886
|
}
|
|
@@ -2922,10 +2922,10 @@ var At = {};
|
|
|
2922
2922
|
* LICENSE file in the root directory of this source tree.
|
|
2923
2923
|
*/
|
|
2924
2924
|
var ce;
|
|
2925
|
-
function
|
|
2925
|
+
function Ks() {
|
|
2926
2926
|
return ce || (ce = 1, process.env.NODE_ENV !== "production" && function() {
|
|
2927
2927
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
2928
|
-
var e =
|
|
2928
|
+
var e = O, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
2929
2929
|
function n(b) {
|
|
2930
2930
|
{
|
|
2931
2931
|
for (var S = arguments.length, w = new Array(S > 1 ? S - 1 : 0), M = 1; M < S; M++)
|
|
@@ -2992,17 +2992,17 @@ function Vs() {
|
|
|
2992
2992
|
At.useSyncExternalStore = k, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
2993
2993
|
}()), At;
|
|
2994
2994
|
}
|
|
2995
|
-
process.env.NODE_ENV === "production" ? Nt.exports = Ws() : Nt.exports =
|
|
2995
|
+
process.env.NODE_ENV === "production" ? Nt.exports = Ws() : Nt.exports = Ks();
|
|
2996
2996
|
var St = Nt.exports;
|
|
2997
|
-
const
|
|
2997
|
+
const Us = (...e) => (t) => {
|
|
2998
2998
|
e.forEach((n) => {
|
|
2999
2999
|
typeof n == "function" ? n(t) : n && (n.current = t);
|
|
3000
3000
|
});
|
|
3001
|
-
},
|
|
3001
|
+
}, qs = ({ contentComponent: e }) => {
|
|
3002
3002
|
const t = St.useSyncExternalStore(e.subscribe, e.getSnapshot, e.getServerSnapshot);
|
|
3003
|
-
return
|
|
3003
|
+
return O.createElement(O.Fragment, null, Object.values(t));
|
|
3004
3004
|
};
|
|
3005
|
-
function
|
|
3005
|
+
function Gs() {
|
|
3006
3006
|
const e = /* @__PURE__ */ new Set();
|
|
3007
3007
|
let t = {};
|
|
3008
3008
|
return {
|
|
@@ -3026,7 +3026,7 @@ function qs() {
|
|
|
3026
3026
|
setRenderer(n, r) {
|
|
3027
3027
|
t = {
|
|
3028
3028
|
...t,
|
|
3029
|
-
[n]:
|
|
3029
|
+
[n]: Vn.createPortal(r.reactElement, r.element, n)
|
|
3030
3030
|
}, e.forEach((s) => s());
|
|
3031
3031
|
},
|
|
3032
3032
|
/**
|
|
@@ -3038,10 +3038,10 @@ function qs() {
|
|
|
3038
3038
|
}
|
|
3039
3039
|
};
|
|
3040
3040
|
}
|
|
3041
|
-
class
|
|
3041
|
+
class Js extends O.Component {
|
|
3042
3042
|
constructor(t) {
|
|
3043
3043
|
var n;
|
|
3044
|
-
super(t), this.editorContentRef =
|
|
3044
|
+
super(t), this.editorContentRef = O.createRef(), this.initialized = !1, this.state = {
|
|
3045
3045
|
hasContentComponentInitialized: !!(!((n = t.editor) === null || n === void 0) && n.contentComponent)
|
|
3046
3046
|
};
|
|
3047
3047
|
}
|
|
@@ -3059,7 +3059,7 @@ class Gs extends L.Component {
|
|
|
3059
3059
|
const n = this.editorContentRef.current;
|
|
3060
3060
|
n.append(...t.options.element.childNodes), t.setOptions({
|
|
3061
3061
|
element: n
|
|
3062
|
-
}), t.contentComponent =
|
|
3062
|
+
}), t.contentComponent = Gs(), this.state.hasContentComponentInitialized || (this.unsubscribeToContentComponent = t.contentComponent.subscribe(() => {
|
|
3063
3063
|
this.setState((r) => r.hasContentComponentInitialized ? r : {
|
|
3064
3064
|
hasContentComponentInitialized: !0
|
|
3065
3065
|
}), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent();
|
|
@@ -3079,22 +3079,22 @@ class Gs extends L.Component {
|
|
|
3079
3079
|
}
|
|
3080
3080
|
render() {
|
|
3081
3081
|
const { editor: t, innerRef: n, ...r } = this.props;
|
|
3082
|
-
return
|
|
3083
|
-
|
|
3082
|
+
return O.createElement(
|
|
3083
|
+
O.Fragment,
|
|
3084
3084
|
null,
|
|
3085
|
-
|
|
3086
|
-
(t == null ? void 0 : t.contentComponent) &&
|
|
3085
|
+
O.createElement("div", { ref: Us(n, this.editorContentRef), ...r }),
|
|
3086
|
+
(t == null ? void 0 : t.contentComponent) && O.createElement(qs, { contentComponent: t.contentComponent })
|
|
3087
3087
|
);
|
|
3088
3088
|
}
|
|
3089
3089
|
}
|
|
3090
|
-
const
|
|
3091
|
-
const n =
|
|
3092
|
-
return
|
|
3090
|
+
const Ys = Fn((e, t) => {
|
|
3091
|
+
const n = O.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [e.editor]);
|
|
3092
|
+
return O.createElement(Js, {
|
|
3093
3093
|
key: n,
|
|
3094
3094
|
innerRef: t,
|
|
3095
3095
|
...e
|
|
3096
3096
|
});
|
|
3097
|
-
}), Ko =
|
|
3097
|
+
}), Ko = O.memo(Ys);
|
|
3098
3098
|
var $t = { exports: {} }, Ot = {};
|
|
3099
3099
|
/**
|
|
3100
3100
|
* @license React
|
|
@@ -3106,10 +3106,10 @@ var $t = { exports: {} }, Ot = {};
|
|
|
3106
3106
|
* LICENSE file in the root directory of this source tree.
|
|
3107
3107
|
*/
|
|
3108
3108
|
var de;
|
|
3109
|
-
function
|
|
3109
|
+
function Xs() {
|
|
3110
3110
|
if (de) return Ot;
|
|
3111
3111
|
de = 1;
|
|
3112
|
-
var e =
|
|
3112
|
+
var e = O, t = St;
|
|
3113
3113
|
function n(c, u) {
|
|
3114
3114
|
return c === u && (c !== 0 || 1 / c === 1 / u) || c !== c && u !== u;
|
|
3115
3115
|
}
|
|
@@ -3157,10 +3157,10 @@ var Lt = {};
|
|
|
3157
3157
|
* LICENSE file in the root directory of this source tree.
|
|
3158
3158
|
*/
|
|
3159
3159
|
var ue;
|
|
3160
|
-
function
|
|
3160
|
+
function Qs() {
|
|
3161
3161
|
return ue || (ue = 1, process.env.NODE_ENV !== "production" && function() {
|
|
3162
3162
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
3163
|
-
var e =
|
|
3163
|
+
var e = O, t = St;
|
|
3164
3164
|
function n(u, d) {
|
|
3165
3165
|
return u === d && (u !== 0 || 1 / u === 1 / d) || u !== u && d !== d;
|
|
3166
3166
|
}
|
|
@@ -3177,9 +3177,9 @@ function Xs() {
|
|
|
3177
3177
|
w = !0, M = j;
|
|
3178
3178
|
var Y = h(j);
|
|
3179
3179
|
if (f !== void 0 && g.hasValue) {
|
|
3180
|
-
var
|
|
3181
|
-
if (f(
|
|
3182
|
-
return C =
|
|
3180
|
+
var W = g.value;
|
|
3181
|
+
if (f(W, Y))
|
|
3182
|
+
return C = W, W;
|
|
3183
3183
|
}
|
|
3184
3184
|
return C = Y, Y;
|
|
3185
3185
|
}
|
|
@@ -3202,9 +3202,9 @@ function Xs() {
|
|
|
3202
3202
|
Lt.useSyncExternalStoreWithSelector = c, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
3203
3203
|
}()), Lt;
|
|
3204
3204
|
}
|
|
3205
|
-
process.env.NODE_ENV === "production" ? $t.exports =
|
|
3206
|
-
var
|
|
3207
|
-
class
|
|
3205
|
+
process.env.NODE_ENV === "production" ? $t.exports = Xs() : $t.exports = Qs();
|
|
3206
|
+
var Zs = $t.exports;
|
|
3207
|
+
class to {
|
|
3208
3208
|
constructor(t) {
|
|
3209
3209
|
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);
|
|
3210
3210
|
}
|
|
@@ -3242,12 +3242,12 @@ class Zs {
|
|
|
3242
3242
|
}
|
|
3243
3243
|
}
|
|
3244
3244
|
}
|
|
3245
|
-
function
|
|
3246
|
-
const [t] = Ft(() => new
|
|
3245
|
+
function eo(e) {
|
|
3246
|
+
const [t] = Ft(() => new to(e.editor)), n = Zs.useSyncExternalStoreWithSelector(t.subscribe, t.getSnapshot, t.getServerSnapshot, e.selector, e.equalityFn);
|
|
3247
3247
|
return zt(() => t.watch(e.editor), [e.editor, t]), Te(n), n;
|
|
3248
3248
|
}
|
|
3249
|
-
const pe = process.env.NODE_ENV !== "production", Dt = typeof window > "u",
|
|
3250
|
-
class
|
|
3249
|
+
const pe = process.env.NODE_ENV !== "production", Dt = typeof window > "u", no = Dt || !!(typeof window < "u" && window.next);
|
|
3250
|
+
class ro {
|
|
3251
3251
|
constructor(t) {
|
|
3252
3252
|
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);
|
|
3253
3253
|
}
|
|
@@ -3256,7 +3256,7 @@ class no {
|
|
|
3256
3256
|
}
|
|
3257
3257
|
getInitialEditor() {
|
|
3258
3258
|
if (this.options.current.immediatelyRender === void 0)
|
|
3259
|
-
return Dt ||
|
|
3259
|
+
return Dt || no ? (pe && console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."), null) : this.createEditor();
|
|
3260
3260
|
if (this.options.current.immediatelyRender && Dt && pe)
|
|
3261
3261
|
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.");
|
|
3262
3262
|
return this.options.current.immediatelyRender ? this.createEditor() : null;
|
|
@@ -3305,7 +3305,7 @@ class no {
|
|
|
3305
3305
|
return (o = (s = this.options.current).onContentError) === null || o === void 0 ? void 0 : o.call(s, ...r);
|
|
3306
3306
|
}
|
|
3307
3307
|
};
|
|
3308
|
-
return new
|
|
3308
|
+
return new Ps(t);
|
|
3309
3309
|
}
|
|
3310
3310
|
/**
|
|
3311
3311
|
* Get the current editor instance.
|
|
@@ -3368,10 +3368,10 @@ class no {
|
|
|
3368
3368
|
}
|
|
3369
3369
|
}
|
|
3370
3370
|
function Uo(e = {}, t = []) {
|
|
3371
|
-
const n =
|
|
3371
|
+
const n = zn(e);
|
|
3372
3372
|
n.current = e;
|
|
3373
|
-
const [r] = Ft(() => new
|
|
3374
|
-
return Te(s), zt(r.onRender(t)),
|
|
3373
|
+
const [r] = Ft(() => new ro(n)), s = St.useSyncExternalStore(r.subscribe, r.getEditor, r.getServerSnapshot);
|
|
3374
|
+
return Te(s), zt(r.onRender(t)), eo({
|
|
3375
3375
|
editor: s,
|
|
3376
3376
|
selector: ({ transactionNumber: o }) => e.shouldRerenderOnTransaction === !1 ? null : e.immediatelyRender && o === 0 ? 0 : o + 1
|
|
3377
3377
|
}), s;
|
|
@@ -3380,8 +3380,8 @@ const Be = Ee({
|
|
|
3380
3380
|
editor: null
|
|
3381
3381
|
});
|
|
3382
3382
|
Be.Consumer;
|
|
3383
|
-
const
|
|
3384
|
-
const [t, n] = Ft(null), { editor: r } =
|
|
3383
|
+
const so = () => Ce(Be), qo = (e) => {
|
|
3384
|
+
const [t, n] = Ft(null), { editor: r } = so();
|
|
3385
3385
|
return zt(() => {
|
|
3386
3386
|
var s;
|
|
3387
3387
|
if (!t || !((s = e.editor) === null || s === void 0) && s.isDestroyed || r != null && r.isDestroyed)
|
|
@@ -3400,14 +3400,23 @@ const ro = () => Ce(Be), qo = (e) => {
|
|
|
3400
3400
|
tippyOptions: a
|
|
3401
3401
|
});
|
|
3402
3402
|
return u.registerPlugin(d), () => u.unregisterPlugin(o);
|
|
3403
|
-
}, [e.editor, r, t]),
|
|
3403
|
+
}, [e.editor, r, t]), O.createElement("div", { ref: n, className: e.className, style: { visibility: "hidden" } }, e.children);
|
|
3404
3404
|
}, je = Ee({
|
|
3405
3405
|
onDragStart: void 0
|
|
3406
|
-
}),
|
|
3407
|
-
const {
|
|
3406
|
+
}), Fe = () => Ce(je), Go = (e) => {
|
|
3407
|
+
const t = e.as || "div", { nodeViewContentRef: n } = Fe();
|
|
3408
|
+
return (
|
|
3409
|
+
// @ts-ignore
|
|
3410
|
+
O.createElement(t, { ...e, ref: n, "data-node-view-content": "", style: {
|
|
3411
|
+
whiteSpace: "pre-wrap",
|
|
3412
|
+
...e.style
|
|
3413
|
+
} })
|
|
3414
|
+
);
|
|
3415
|
+
}, Jo = O.forwardRef((e, t) => {
|
|
3416
|
+
const { onDragStart: n } = Fe(), r = e.as || "div";
|
|
3408
3417
|
return (
|
|
3409
3418
|
// @ts-ignore
|
|
3410
|
-
|
|
3419
|
+
O.createElement(r, { ...e, ref: t, "data-node-view-wrapper": "", onDragStart: n, style: {
|
|
3411
3420
|
whiteSpace: "normal",
|
|
3412
3421
|
...e.style
|
|
3413
3422
|
} })
|
|
@@ -3433,7 +3442,7 @@ class ao {
|
|
|
3433
3442
|
const n = this.component, r = this.props, s = this.editor;
|
|
3434
3443
|
(oo(n) || io(n)) && (r.ref = (o) => {
|
|
3435
3444
|
this.ref = o;
|
|
3436
|
-
}), this.reactElement =
|
|
3445
|
+
}), this.reactElement = O.createElement(n, r), (t = s == null ? void 0 : s.contentComponent) === null || t === void 0 || t.setRenderer(this.id, this);
|
|
3437
3446
|
}
|
|
3438
3447
|
updateProps(t = {}) {
|
|
3439
3448
|
this.props = {
|
|
@@ -3447,7 +3456,7 @@ class ao {
|
|
|
3447
3456
|
(t = n == null ? void 0 : n.contentComponent) === null || t === void 0 || t.removeRenderer(this.id);
|
|
3448
3457
|
}
|
|
3449
3458
|
}
|
|
3450
|
-
class lo extends
|
|
3459
|
+
class lo extends $s {
|
|
3451
3460
|
mount() {
|
|
3452
3461
|
const t = {
|
|
3453
3462
|
editor: this.editor,
|
|
@@ -3465,7 +3474,7 @@ class lo extends Ns {
|
|
|
3465
3474
|
}
|
|
3466
3475
|
const s = { onDragStart: this.onDragStart.bind(this), nodeViewContentRef: (c) => {
|
|
3467
3476
|
c && this.contentDOMElement && c.firstChild !== this.contentDOMElement && c.appendChild(this.contentDOMElement);
|
|
3468
|
-
} }, o = this.component, i =
|
|
3477
|
+
} }, o = this.component, i = O.memo((c) => O.createElement(je.Provider, { value: s }, O.createElement(o, c)));
|
|
3469
3478
|
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.style.whiteSpace = "inherit");
|
|
3470
3479
|
let a = this.node.isInline ? "span" : "div";
|
|
3471
3480
|
this.options.as && (a = this.options.as);
|
|
@@ -3531,10 +3540,10 @@ class lo extends Ns {
|
|
|
3531
3540
|
this.renderer.destroy(), this.editor.off("selectionUpdate", this.handleSelectionUpdate), this.contentDOMElement = null;
|
|
3532
3541
|
}
|
|
3533
3542
|
}
|
|
3534
|
-
function
|
|
3543
|
+
function Yo(e, t) {
|
|
3535
3544
|
return (n) => n.editor.contentComponent ? new lo(e, n, t) : {};
|
|
3536
3545
|
}
|
|
3537
|
-
const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, po = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, ho = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,
|
|
3546
|
+
const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, po = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, ho = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, Xo = I.create({
|
|
3538
3547
|
name: "italic",
|
|
3539
3548
|
addOptions() {
|
|
3540
3549
|
return {
|
|
@@ -3595,7 +3604,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
|
|
|
3595
3604
|
})
|
|
3596
3605
|
];
|
|
3597
3606
|
}
|
|
3598
|
-
}),
|
|
3607
|
+
}), Qo = I.create({
|
|
3599
3608
|
name: "underline",
|
|
3600
3609
|
addOptions() {
|
|
3601
3610
|
return {
|
|
@@ -3630,7 +3639,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
|
|
|
3630
3639
|
"Mod-U": () => this.editor.commands.toggleUnderline()
|
|
3631
3640
|
};
|
|
3632
3641
|
}
|
|
3633
|
-
}), fo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, mo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,
|
|
3642
|
+
}), fo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, mo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, Zo = I.create({
|
|
3634
3643
|
name: "strike",
|
|
3635
3644
|
addOptions() {
|
|
3636
3645
|
return {
|
|
@@ -3686,7 +3695,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
|
|
|
3686
3695
|
})
|
|
3687
3696
|
];
|
|
3688
3697
|
}
|
|
3689
|
-
}), go = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/, yo = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g,
|
|
3698
|
+
}), go = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/, yo = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g, ti = I.create({
|
|
3690
3699
|
name: "code",
|
|
3691
3700
|
addOptions() {
|
|
3692
3701
|
return {
|
|
@@ -3732,7 +3741,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
|
|
|
3732
3741
|
})
|
|
3733
3742
|
];
|
|
3734
3743
|
}
|
|
3735
|
-
}), bo = /^```([a-z]+)?[\s\n]$/, vo = /^~~~([a-z]+)?[\s\n]$/,
|
|
3744
|
+
}), bo = /^```([a-z]+)?[\s\n]$/, vo = /^~~~([a-z]+)?[\s\n]$/, ei = L.create({
|
|
3736
3745
|
name: "codeBlock",
|
|
3737
3746
|
addOptions() {
|
|
3738
3747
|
return {
|
|
@@ -3859,7 +3868,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
|
|
|
3859
3868
|
})
|
|
3860
3869
|
];
|
|
3861
3870
|
}
|
|
3862
|
-
}),
|
|
3871
|
+
}), ni = I.create({
|
|
3863
3872
|
name: "textStyle",
|
|
3864
3873
|
priority: 101,
|
|
3865
3874
|
addOptions() {
|
|
@@ -3886,7 +3895,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
|
|
|
3886
3895
|
}
|
|
3887
3896
|
};
|
|
3888
3897
|
}
|
|
3889
|
-
}),
|
|
3898
|
+
}), ri = R.create({
|
|
3890
3899
|
name: "fontFamily",
|
|
3891
3900
|
addOptions() {
|
|
3892
3901
|
return {
|
|
@@ -3918,7 +3927,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
|
|
|
3918
3927
|
unsetFontFamily: () => ({ chain: e }) => e().setMark("textStyle", { fontFamily: null }).removeEmptyTextStyle().run()
|
|
3919
3928
|
};
|
|
3920
3929
|
}
|
|
3921
|
-
}),
|
|
3930
|
+
}), si = L.create({
|
|
3922
3931
|
name: "heading",
|
|
3923
3932
|
addOptions() {
|
|
3924
3933
|
return {
|
|
@@ -3967,7 +3976,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
|
|
|
3967
3976
|
}
|
|
3968
3977
|
}));
|
|
3969
3978
|
}
|
|
3970
|
-
}),
|
|
3979
|
+
}), oi = R.create({
|
|
3971
3980
|
name: "textAlign",
|
|
3972
3981
|
addOptions() {
|
|
3973
3982
|
return {
|
|
@@ -4007,7 +4016,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
|
|
|
4007
4016
|
"Mod-Shift-j": () => this.editor.commands.setTextAlign("justify")
|
|
4008
4017
|
};
|
|
4009
4018
|
}
|
|
4010
|
-
}),
|
|
4019
|
+
}), ii = R.create({
|
|
4011
4020
|
name: "color",
|
|
4012
4021
|
addOptions() {
|
|
4013
4022
|
return {
|
|
@@ -4039,7 +4048,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
|
|
|
4039
4048
|
unsetColor: () => ({ chain: e }) => e().setMark("textStyle", { color: null }).removeEmptyTextStyle().run()
|
|
4040
4049
|
};
|
|
4041
4050
|
}
|
|
4042
|
-
}), Mo = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, So = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,
|
|
4051
|
+
}), Mo = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, So = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, ai = I.create({
|
|
4043
4052
|
name: "highlight",
|
|
4044
4053
|
addOptions() {
|
|
4045
4054
|
return {
|
|
@@ -4097,7 +4106,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
|
|
|
4097
4106
|
})
|
|
4098
4107
|
];
|
|
4099
4108
|
}
|
|
4100
|
-
}), ko =
|
|
4109
|
+
}), ko = L.create({
|
|
4101
4110
|
name: "listItem",
|
|
4102
4111
|
addOptions() {
|
|
4103
4112
|
return {
|
|
@@ -4152,7 +4161,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
|
|
|
4152
4161
|
}
|
|
4153
4162
|
};
|
|
4154
4163
|
}
|
|
4155
|
-
}), fe = /^\s*([-+*])\s$/,
|
|
4164
|
+
}), fe = /^\s*([-+*])\s$/, li = L.create({
|
|
4156
4165
|
name: "bulletList",
|
|
4157
4166
|
addOptions() {
|
|
4158
4167
|
return {
|
|
@@ -4200,7 +4209,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
|
|
|
4200
4209
|
e
|
|
4201
4210
|
];
|
|
4202
4211
|
}
|
|
4203
|
-
}), wo =
|
|
4212
|
+
}), wo = L.create({
|
|
4204
4213
|
name: "listItem",
|
|
4205
4214
|
addOptions() {
|
|
4206
4215
|
return {
|
|
@@ -4255,7 +4264,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
|
|
|
4255
4264
|
}
|
|
4256
4265
|
};
|
|
4257
4266
|
}
|
|
4258
|
-
}), ge = /^(\d+)\.\s$/,
|
|
4267
|
+
}), ge = /^(\d+)\.\s$/, ci = L.create({
|
|
4259
4268
|
name: "orderedList",
|
|
4260
4269
|
addOptions() {
|
|
4261
4270
|
return {
|
|
@@ -4321,7 +4330,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
|
|
|
4321
4330
|
e
|
|
4322
4331
|
];
|
|
4323
4332
|
}
|
|
4324
|
-
}), To = /^\s*(\[([( |x])?\])\s$/,
|
|
4333
|
+
}), To = /^\s*(\[([( |x])?\])\s$/, di = L.create({
|
|
4325
4334
|
name: "taskItem",
|
|
4326
4335
|
addOptions() {
|
|
4327
4336
|
return {
|
|
@@ -4425,7 +4434,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
|
|
|
4425
4434
|
})
|
|
4426
4435
|
];
|
|
4427
4436
|
}
|
|
4428
|
-
}),
|
|
4437
|
+
}), ui = L.create({
|
|
4429
4438
|
name: "taskList",
|
|
4430
4439
|
addOptions() {
|
|
4431
4440
|
return {
|
|
@@ -4458,7 +4467,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
|
|
|
4458
4467
|
"Mod-Shift-9": () => this.editor.commands.toggleTaskList()
|
|
4459
4468
|
};
|
|
4460
4469
|
}
|
|
4461
|
-
}), Eo = /^\s*>\s$/,
|
|
4470
|
+
}), Eo = /^\s*>\s$/, pi = L.create({
|
|
4462
4471
|
name: "blockquote",
|
|
4463
4472
|
addOptions() {
|
|
4464
4473
|
return {
|
|
@@ -4507,9 +4516,9 @@ function xo(e) {
|
|
|
4507
4516
|
const s = t.some((c) => c.docChanged) && !n.doc.eq(r.doc), o = t.some((c) => c.getMeta("preventAutolink"));
|
|
4508
4517
|
if (!s || o)
|
|
4509
4518
|
return;
|
|
4510
|
-
const { tr: i } = r, a =
|
|
4511
|
-
if (
|
|
4512
|
-
const u =
|
|
4519
|
+
const { tr: i } = r, a = Xr(n.doc, [...t]);
|
|
4520
|
+
if (os(a).forEach(({ newRange: c }) => {
|
|
4521
|
+
const u = Zr(r.doc, c, (h) => h.isTextblock);
|
|
4513
4522
|
let d, p;
|
|
4514
4523
|
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(c.from, c.to, " ", " ").endsWith(" ") && (d = u[0], p = r.doc.textBetween(d.pos, c.to, void 0, " ")), d && p) {
|
|
4515
4524
|
const h = p.split(" ").filter((m) => m !== "");
|
|
@@ -4518,7 +4527,7 @@ function xo(e) {
|
|
|
4518
4527
|
const f = h[h.length - 1], y = d.pos + p.lastIndexOf(f);
|
|
4519
4528
|
if (!f)
|
|
4520
4529
|
return !1;
|
|
4521
|
-
const g =
|
|
4530
|
+
const g = kn(f).map((m) => m.toObject(e.defaultProtocol));
|
|
4522
4531
|
if (!Co(g))
|
|
4523
4532
|
return !1;
|
|
4524
4533
|
g.filter((m) => m.isLink).map((m) => ({
|
|
@@ -4584,7 +4593,7 @@ function ye(e, t) {
|
|
|
4584
4593
|
s && n.push(s);
|
|
4585
4594
|
}), !e || e.replace(Lo, "").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`, "i"));
|
|
4586
4595
|
}
|
|
4587
|
-
const
|
|
4596
|
+
const hi = I.create({
|
|
4588
4597
|
name: "link",
|
|
4589
4598
|
priority: 1e3,
|
|
4590
4599
|
keepOnSplit: !1,
|
|
@@ -4599,7 +4608,7 @@ const pi = I.create({
|
|
|
4599
4608
|
});
|
|
4600
4609
|
},
|
|
4601
4610
|
onDestroy() {
|
|
4602
|
-
|
|
4611
|
+
wn();
|
|
4603
4612
|
},
|
|
4604
4613
|
inclusive() {
|
|
4605
4614
|
return this.options.autolink;
|
|
@@ -4698,7 +4707,7 @@ const pi = I.create({
|
|
|
4698
4707
|
type: this.type
|
|
4699
4708
|
})), e;
|
|
4700
4709
|
}
|
|
4701
|
-
}),
|
|
4710
|
+
}), fi = L.create({
|
|
4702
4711
|
name: "horizontalRule",
|
|
4703
4712
|
addOptions() {
|
|
4704
4713
|
return {
|
|
@@ -4748,7 +4757,7 @@ const pi = I.create({
|
|
|
4748
4757
|
})
|
|
4749
4758
|
];
|
|
4750
4759
|
}
|
|
4751
|
-
}),
|
|
4760
|
+
}), mi = R.create({
|
|
4752
4761
|
name: "history",
|
|
4753
4762
|
addOptions() {
|
|
4754
4763
|
return {
|
|
@@ -4758,13 +4767,13 @@ const pi = I.create({
|
|
|
4758
4767
|
},
|
|
4759
4768
|
addCommands() {
|
|
4760
4769
|
return {
|
|
4761
|
-
undo: () => ({ state: e, dispatch: t }) =>
|
|
4762
|
-
redo: () => ({ state: e, dispatch: t }) =>
|
|
4770
|
+
undo: () => ({ state: e, dispatch: t }) => Tn(e, t),
|
|
4771
|
+
redo: () => ({ state: e, dispatch: t }) => En(e, t)
|
|
4763
4772
|
};
|
|
4764
4773
|
},
|
|
4765
4774
|
addProseMirrorPlugins() {
|
|
4766
4775
|
return [
|
|
4767
|
-
|
|
4776
|
+
Cn(this.options)
|
|
4768
4777
|
];
|
|
4769
4778
|
},
|
|
4770
4779
|
addKeyboardShortcuts() {
|
|
@@ -4777,7 +4786,7 @@ const pi = I.create({
|
|
|
4777
4786
|
"Shift-Mod-я": () => this.editor.commands.redo()
|
|
4778
4787
|
};
|
|
4779
4788
|
}
|
|
4780
|
-
}),
|
|
4789
|
+
}), gi = R.create({
|
|
4781
4790
|
name: "characterCount",
|
|
4782
4791
|
addOptions() {
|
|
4783
4792
|
return {
|
|
@@ -4819,7 +4828,7 @@ const pi = I.create({
|
|
|
4819
4828
|
})
|
|
4820
4829
|
];
|
|
4821
4830
|
}
|
|
4822
|
-
}),
|
|
4831
|
+
}), yi = R.create({
|
|
4823
4832
|
name: "dropCursor",
|
|
4824
4833
|
addOptions() {
|
|
4825
4834
|
return {
|
|
@@ -4830,10 +4839,10 @@ const pi = I.create({
|
|
|
4830
4839
|
},
|
|
4831
4840
|
addProseMirrorPlugins() {
|
|
4832
4841
|
return [
|
|
4833
|
-
|
|
4842
|
+
xn(this.options)
|
|
4834
4843
|
];
|
|
4835
4844
|
}
|
|
4836
|
-
}),
|
|
4845
|
+
}), bi = R.create({
|
|
4837
4846
|
name: "focus",
|
|
4838
4847
|
addOptions() {
|
|
4839
4848
|
return {
|
|
@@ -4873,11 +4882,11 @@ const pi = I.create({
|
|
|
4873
4882
|
})
|
|
4874
4883
|
];
|
|
4875
4884
|
}
|
|
4876
|
-
}),
|
|
4885
|
+
}), vi = R.create({
|
|
4877
4886
|
name: "gapCursor",
|
|
4878
4887
|
addProseMirrorPlugins() {
|
|
4879
4888
|
return [
|
|
4880
|
-
|
|
4889
|
+
An()
|
|
4881
4890
|
];
|
|
4882
4891
|
},
|
|
4883
4892
|
extendNodeSchema(e) {
|
|
@@ -4891,7 +4900,7 @@ const pi = I.create({
|
|
|
4891
4900
|
allowGapCursor: (t = T(v(e, "allowGapCursor", n))) !== null && t !== void 0 ? t : null
|
|
4892
4901
|
};
|
|
4893
4902
|
}
|
|
4894
|
-
}),
|
|
4903
|
+
}), Mi = L.create({
|
|
4895
4904
|
name: "hardBreak",
|
|
4896
4905
|
addOptions() {
|
|
4897
4906
|
return {
|
|
@@ -4940,7 +4949,7 @@ const pi = I.create({
|
|
|
4940
4949
|
"Shift-Enter": () => this.editor.commands.setHardBreak()
|
|
4941
4950
|
};
|
|
4942
4951
|
}
|
|
4943
|
-
}),
|
|
4952
|
+
}), Si = L.create({
|
|
4944
4953
|
name: "listItem",
|
|
4945
4954
|
addOptions() {
|
|
4946
4955
|
return {
|
|
@@ -4968,7 +4977,7 @@ const pi = I.create({
|
|
|
4968
4977
|
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
4969
4978
|
};
|
|
4970
4979
|
}
|
|
4971
|
-
}),
|
|
4980
|
+
}), ki = L.create({
|
|
4972
4981
|
name: "paragraph",
|
|
4973
4982
|
priority: 1e3,
|
|
4974
4983
|
addOptions() {
|
|
@@ -4996,7 +5005,7 @@ const pi = I.create({
|
|
|
4996
5005
|
"Mod-Alt-0": () => this.editor.commands.setParagraph()
|
|
4997
5006
|
};
|
|
4998
5007
|
}
|
|
4999
|
-
}),
|
|
5008
|
+
}), wi = R.create({
|
|
5000
5009
|
name: "placeholder",
|
|
5001
5010
|
addOptions() {
|
|
5002
5011
|
return {
|
|
@@ -5041,14 +5050,14 @@ const pi = I.create({
|
|
|
5041
5050
|
})
|
|
5042
5051
|
];
|
|
5043
5052
|
}
|
|
5044
|
-
}),
|
|
5053
|
+
}), Ti = L.create({
|
|
5045
5054
|
name: "text",
|
|
5046
5055
|
group: "inline"
|
|
5047
|
-
}),
|
|
5056
|
+
}), Ei = L.create({
|
|
5048
5057
|
name: "doc",
|
|
5049
5058
|
topNode: !0,
|
|
5050
5059
|
content: "block+"
|
|
5051
|
-
}),
|
|
5060
|
+
}), Ci = I.create({
|
|
5052
5061
|
name: "subscript",
|
|
5053
5062
|
addOptions() {
|
|
5054
5063
|
return {
|
|
@@ -5083,7 +5092,7 @@ const pi = I.create({
|
|
|
5083
5092
|
"Mod-,": () => this.editor.commands.toggleSubscript()
|
|
5084
5093
|
};
|
|
5085
5094
|
}
|
|
5086
|
-
}),
|
|
5095
|
+
}), xi = I.create({
|
|
5087
5096
|
name: "superscript",
|
|
5088
5097
|
addOptions() {
|
|
5089
5098
|
return {
|
|
@@ -5121,7 +5130,7 @@ const pi = I.create({
|
|
|
5121
5130
|
});
|
|
5122
5131
|
function Ro(e) {
|
|
5123
5132
|
var t;
|
|
5124
|
-
const { char: n, allowSpaces: r, allowedPrefixes: s, startOfLine: o, $position: i } = e, a =
|
|
5133
|
+
const { char: n, allowSpaces: r, allowedPrefixes: s, startOfLine: o, $position: i } = e, a = Ds(n), l = new RegExp(`\\s${a}$`), c = o ? "^" : "", u = r ? new RegExp(`${c}${a}.*?(?=\\s${a}|$)`, "gm") : new RegExp(`${c}(?:^)?${a}[^\\s${a}]*`, "gm"), d = ((t = i.nodeBefore) === null || t === void 0 ? void 0 : t.isText) && i.nodeBefore.text;
|
|
5125
5134
|
if (!d)
|
|
5126
5135
|
return null;
|
|
5127
5136
|
const p = i.pos - d.length, h = Array.from(d.matchAll(u)).pop();
|
|
@@ -5142,7 +5151,7 @@ function Ro(e) {
|
|
|
5142
5151
|
} : null;
|
|
5143
5152
|
}
|
|
5144
5153
|
const _o = new $("suggestion");
|
|
5145
|
-
function
|
|
5154
|
+
function Ai({ pluginKey: e = _o, editor: t, char: n = "@", allowSpaces: r = !1, allowedPrefixes: s = [" "], startOfLine: o = !1, decorationTag: i = "span", decorationClass: a = "suggestion", command: l = () => null, items: c = () => [], render: u = () => ({}), allow: d = () => !0, findSuggestionMatch: p = Ro }) {
|
|
5146
5155
|
let h;
|
|
5147
5156
|
const f = u == null ? void 0 : u(), y = new P({
|
|
5148
5157
|
key: e,
|
|
@@ -5150,7 +5159,7 @@ function xi({ pluginKey: e = _o, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5150
5159
|
return {
|
|
5151
5160
|
update: async (g, m) => {
|
|
5152
5161
|
var k, b, S, w, M, C, A;
|
|
5153
|
-
const E = (k = this.key) === null || k === void 0 ? void 0 : k.getState(m), _ = (b = this.key) === null || b === void 0 ? void 0 : b.getState(g.state), D = E.active && _.active && E.range.from !== _.range.from, j = !E.active && _.active, Y = E.active && !_.active,
|
|
5162
|
+
const E = (k = this.key) === null || k === void 0 ? void 0 : k.getState(m), _ = (b = this.key) === null || b === void 0 ? void 0 : b.getState(g.state), D = E.active && _.active && E.range.from !== _.range.from, j = !E.active && _.active, Y = E.active && !_.active, W = !j && !Y && E.query !== _.query, K = j || D && W, F = W || D, U = Y || D && W;
|
|
5154
5163
|
if (!K && !F && !U)
|
|
5155
5164
|
return;
|
|
5156
5165
|
const X = U && !K ? E : _, Jt = g.dom.querySelector(`[data-decoration-id="${X.decorationId}"]`);
|
|
@@ -5170,7 +5179,7 @@ function xi({ pluginKey: e = _o, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5170
5179
|
// this can be used for building popups without a DOM node
|
|
5171
5180
|
clientRect: Jt ? () => {
|
|
5172
5181
|
var et;
|
|
5173
|
-
const { decorationId:
|
|
5182
|
+
const { decorationId: ze } = (et = this.key) === null || et === void 0 ? void 0 : et.getState(t.state), kt = g.dom.querySelector(`[data-decoration-id="${ze}"]`);
|
|
5174
5183
|
return (kt == null ? void 0 : kt.getBoundingClientRect()) || null;
|
|
5175
5184
|
} : null
|
|
5176
5185
|
}, K && ((S = f == null ? void 0 : f.onBeforeStart) === null || S === void 0 || S.call(f, h)), F && ((w = f == null ? void 0 : f.onBeforeUpdate) === null || w === void 0 || w.call(f, h)), (F || K) && (h.items = await c({
|
|
@@ -5243,7 +5252,7 @@ function xi({ pluginKey: e = _o, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5243
5252
|
});
|
|
5244
5253
|
return y;
|
|
5245
5254
|
}
|
|
5246
|
-
const Ho = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,
|
|
5255
|
+
const Ho = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Oi = L.create({
|
|
5247
5256
|
name: "image",
|
|
5248
5257
|
addOptions() {
|
|
5249
5258
|
return {
|
|
@@ -5302,7 +5311,7 @@ const Ho = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Ai = O.cr
|
|
|
5302
5311
|
})
|
|
5303
5312
|
];
|
|
5304
5313
|
}
|
|
5305
|
-
}),
|
|
5314
|
+
}), Li = L.create({
|
|
5306
5315
|
name: "tableRow",
|
|
5307
5316
|
addOptions() {
|
|
5308
5317
|
return {
|
|
@@ -5402,7 +5411,7 @@ const at = ({ editor: e }) => {
|
|
|
5402
5411
|
return !1;
|
|
5403
5412
|
["tableCell", "tableHeader"].includes(o.type.name) && (n += 1);
|
|
5404
5413
|
}), n === t.ranges.length ? (e.commands.deleteTable(), !0) : !1;
|
|
5405
|
-
},
|
|
5414
|
+
}, Ri = L.create({
|
|
5406
5415
|
name: "table",
|
|
5407
5416
|
// @ts-ignore
|
|
5408
5417
|
addOptions() {
|
|
@@ -5445,23 +5454,23 @@ const at = ({ editor: e }) => {
|
|
|
5445
5454
|
}
|
|
5446
5455
|
return !0;
|
|
5447
5456
|
},
|
|
5448
|
-
addColumnBefore: () => ({ state: e, dispatch: t }) =>
|
|
5449
|
-
addColumnAfter: () => ({ state: e, dispatch: t }) =>
|
|
5450
|
-
deleteColumn: () => ({ state: e, dispatch: t }) =>
|
|
5451
|
-
addRowBefore: () => ({ state: e, dispatch: t }) =>
|
|
5452
|
-
addRowAfter: () => ({ state: e, dispatch: t }) =>
|
|
5453
|
-
deleteRow: () => ({ state: e, dispatch: t }) =>
|
|
5454
|
-
deleteTable: () => ({ state: e, dispatch: t }) =>
|
|
5457
|
+
addColumnBefore: () => ({ state: e, dispatch: t }) => On(e, t),
|
|
5458
|
+
addColumnAfter: () => ({ state: e, dispatch: t }) => Ln(e, t),
|
|
5459
|
+
deleteColumn: () => ({ state: e, dispatch: t }) => Rn(e, t),
|
|
5460
|
+
addRowBefore: () => ({ state: e, dispatch: t }) => _n(e, t),
|
|
5461
|
+
addRowAfter: () => ({ state: e, dispatch: t }) => Hn(e, t),
|
|
5462
|
+
deleteRow: () => ({ state: e, dispatch: t }) => In(e, t),
|
|
5463
|
+
deleteTable: () => ({ state: e, dispatch: t }) => Pn(e, t),
|
|
5455
5464
|
mergeCells: () => ({ state: e, dispatch: t }) => Qt(e, t),
|
|
5456
5465
|
splitCell: () => ({ state: e, dispatch: t }) => Zt(e, t),
|
|
5457
5466
|
toggleHeaderColumn: () => ({ state: e, dispatch: t }) => te("column")(e, t),
|
|
5458
5467
|
toggleHeaderRow: () => ({ state: e, dispatch: t }) => te("row")(e, t),
|
|
5459
|
-
toggleHeaderCell: () => ({ state: e, dispatch: t }) =>
|
|
5468
|
+
toggleHeaderCell: () => ({ state: e, dispatch: t }) => Nn(e, t),
|
|
5460
5469
|
mergeOrSplit: () => ({ state: e, dispatch: t }) => Qt(e, t) ? !0 : Zt(e, t),
|
|
5461
|
-
setCellAttribute: (e, t) => ({ state: n, dispatch: r }) =>
|
|
5470
|
+
setCellAttribute: (e, t) => ({ state: n, dispatch: r }) => $n(e, t)(n, r),
|
|
5462
5471
|
goToNextCell: () => ({ state: e, dispatch: t }) => ee(1)(e, t),
|
|
5463
5472
|
goToPreviousCell: () => ({ state: e, dispatch: t }) => ee(-1)(e, t),
|
|
5464
|
-
fixTables: () => ({ state: e, dispatch: t }) => (t &&
|
|
5473
|
+
fixTables: () => ({ state: e, dispatch: t }) => (t && Dn(e), !0),
|
|
5465
5474
|
setCellSelection: (e) => ({ tr: t, dispatch: n }) => {
|
|
5466
5475
|
if (n) {
|
|
5467
5476
|
const r = we.create(t.doc, e.anchorCell, e.headCell);
|
|
@@ -5484,14 +5493,14 @@ const at = ({ editor: e }) => {
|
|
|
5484
5493
|
addProseMirrorPlugins() {
|
|
5485
5494
|
return [
|
|
5486
5495
|
...this.options.resizable && this.editor.isEditable ? [
|
|
5487
|
-
|
|
5496
|
+
Bn({
|
|
5488
5497
|
handleWidth: this.options.handleWidth,
|
|
5489
5498
|
cellMinWidth: this.options.cellMinWidth,
|
|
5490
5499
|
View: this.options.View,
|
|
5491
5500
|
lastColumnResizable: this.options.lastColumnResizable
|
|
5492
5501
|
})
|
|
5493
5502
|
] : [],
|
|
5494
|
-
|
|
5503
|
+
jn({
|
|
5495
5504
|
allowTableNodeSelection: this.options.allowTableNodeSelection
|
|
5496
5505
|
})
|
|
5497
5506
|
];
|
|
@@ -5506,7 +5515,7 @@ const at = ({ editor: e }) => {
|
|
|
5506
5515
|
tableRole: T(v(e, "tableRole", t))
|
|
5507
5516
|
};
|
|
5508
5517
|
}
|
|
5509
|
-
}),
|
|
5518
|
+
}), _i = L.create({
|
|
5510
5519
|
name: "tableCell",
|
|
5511
5520
|
addOptions() {
|
|
5512
5521
|
return {
|
|
@@ -5541,7 +5550,7 @@ const at = ({ editor: e }) => {
|
|
|
5541
5550
|
renderHTML({ HTMLAttributes: e }) {
|
|
5542
5551
|
return ["td", x(this.options.HTMLAttributes, e), 0];
|
|
5543
5552
|
}
|
|
5544
|
-
}),
|
|
5553
|
+
}), Hi = L.create({
|
|
5545
5554
|
name: "tableHeader",
|
|
5546
5555
|
addOptions() {
|
|
5547
5556
|
return {
|
|
@@ -5578,57 +5587,58 @@ const at = ({ editor: e }) => {
|
|
|
5578
5587
|
}
|
|
5579
5588
|
});
|
|
5580
5589
|
export {
|
|
5581
|
-
|
|
5590
|
+
_i as $,
|
|
5591
|
+
Mi as A,
|
|
5582
5592
|
qo as B,
|
|
5583
|
-
|
|
5584
|
-
|
|
5593
|
+
ti as C,
|
|
5594
|
+
Ei as D,
|
|
5585
5595
|
Ko as E,
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5596
|
+
ri as F,
|
|
5597
|
+
vi as G,
|
|
5598
|
+
si as H,
|
|
5599
|
+
Xo as I,
|
|
5600
|
+
Si as J,
|
|
5601
|
+
ni as K,
|
|
5602
|
+
hi as L,
|
|
5603
|
+
Ci as M,
|
|
5604
|
+
Jo as N,
|
|
5605
|
+
ci as O,
|
|
5606
|
+
wi as P,
|
|
5607
|
+
xi as Q,
|
|
5608
|
+
Yo as R,
|
|
5609
|
+
Zo as S,
|
|
5610
|
+
oi as T,
|
|
5611
|
+
Qo as U,
|
|
5612
|
+
Ai as V,
|
|
5613
|
+
ao as W,
|
|
5604
5614
|
Oi as X,
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5615
|
+
Ri as Y,
|
|
5616
|
+
Li as Z,
|
|
5617
|
+
Hi as _,
|
|
5618
|
+
L as a,
|
|
5619
|
+
is as b,
|
|
5620
|
+
Wo as c,
|
|
5621
|
+
Go as d,
|
|
5622
|
+
ei as e,
|
|
5623
|
+
Vo as f,
|
|
5624
|
+
R as g,
|
|
5625
|
+
ii as h,
|
|
5616
5626
|
ie as i,
|
|
5617
|
-
|
|
5618
|
-
|
|
5627
|
+
ai as j,
|
|
5628
|
+
li as k,
|
|
5619
5629
|
ui as l,
|
|
5620
5630
|
x as m,
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5631
|
+
$e as n,
|
|
5632
|
+
di as o,
|
|
5633
|
+
pi as p,
|
|
5634
|
+
Wt as q,
|
|
5635
|
+
fi as r,
|
|
5636
|
+
mi as s,
|
|
5637
|
+
Ut as t,
|
|
5628
5638
|
Uo as u,
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5639
|
+
bi as v,
|
|
5640
|
+
Ti as w,
|
|
5641
|
+
yi as x,
|
|
5642
|
+
gi as y,
|
|
5643
|
+
ki as z
|
|
5634
5644
|
};
|