reactjs-tiptap-editor 0.0.54 → 0.0.56
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 +70 -94
- package/lib/index.d.ts +70 -94
- package/lib/locales-CLNCJZPj.cjs +1 -0
- package/lib/{locales-Ct86Kf3R.js → locales-E7ejmU-m.js} +7 -3
- package/lib/reactjs-tiptap-editor.cjs +1 -1
- package/lib/reactjs-tiptap-editor.js +38 -40
- package/lib/style.css +1 -1
- package/lib/tiptap-BFNxun5r.cjs +116 -0
- package/lib/{tiptap-BjeL17_y.js → tiptap-Mwj1-K_2.js} +453 -432
- package/lib/utils-BO7sFdSV.cjs +151 -0
- package/lib/{utils-DDaZuw5x.js → utils-CJjl6DGr.js} +2308 -2404
- package/lib/{vendor-CXgFM3bq.js → vendor-BrYdTHr0.js} +1565 -1549
- package/lib/{vendor-LpRkiQE5.cjs → vendor-CKt2gBNV.cjs} +13 -13
- package/package.json +62 -60
- package/lib/locales-BH0zr7-f.cjs +0 -1
- package/lib/tiptap-C4ncZOhh.cjs +0 -116
- package/lib/utils-D-BYJxOw.cjs +0 -151
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Ve from "tippy.js";
|
|
2
|
-
import { P, a as I, N as Z, S as G, f as We, c as
|
|
3
|
-
import O, { forwardRef as Fn, useRef as zn, useState as
|
|
2
|
+
import { P, a as I, N as Z, S as G, f as We, c as Bt, T as Ke, l as Ue, b as qe, d as $, 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 at, F as lt, B as hn, C as fn, D as mn, E as gn, G as yn, H as bn, I as Se, J as Et, R as vn, K as Mn, L as Sn, M as Xt, O as ke, Q as kn, U as wn, V as En, W as Tn, X as Cn, Y as xn, Z as dt, _ as jt, $ as An, a0 as On, a1 as Ln, a2 as _n, a3 as Rn, a4 as Hn, a5 as Pn, a6 as In, a7 as Qt, a8 as Zt, a9 as te, aa as $n, ab as Dn, ac as ee, ad as Nn, ae as we, af as Bn, ag as jn } from "./vendor-BrYdTHr0.js";
|
|
3
|
+
import O, { forwardRef as Fn, useRef as zn, useState as Ft, useDebugValue as Ee, useEffect as zt, createContext as Te, useContext as Ce } from "react";
|
|
4
4
|
import Vn, { flushSync as Wn } from "react-dom";
|
|
5
|
-
function
|
|
5
|
+
function ft(e) {
|
|
6
6
|
const { state: t, transaction: n } = e;
|
|
7
7
|
let { selection: r } = n, { doc: s } = n, { storedMarks: o } = n;
|
|
8
8
|
return {
|
|
@@ -27,7 +27,7 @@ function mt(e) {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
class
|
|
30
|
+
class mt {
|
|
31
31
|
constructor(t) {
|
|
32
32
|
this.editor = t.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = t.state;
|
|
33
33
|
}
|
|
@@ -72,7 +72,7 @@ class gt {
|
|
|
72
72
|
tr: t,
|
|
73
73
|
editor: s,
|
|
74
74
|
view: i,
|
|
75
|
-
state:
|
|
75
|
+
state: ft({
|
|
76
76
|
state: o,
|
|
77
77
|
transaction: t
|
|
78
78
|
}),
|
|
@@ -112,7 +112,7 @@ function v(e, t, n) {
|
|
|
112
112
|
parent: e.parent ? v(e.parent, t, n) : null
|
|
113
113
|
}) : e.config[t];
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function gt(e) {
|
|
116
116
|
const t = e.filter((s) => s.type === "extension"), n = e.filter((s) => s.type === "node"), r = e.filter((s) => s.type === "mark");
|
|
117
117
|
return {
|
|
118
118
|
baseExtensions: t,
|
|
@@ -120,8 +120,8 @@ function yt(e) {
|
|
|
120
120
|
markExtensions: r
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
const t = [], { nodeExtensions: n, markExtensions: r } =
|
|
123
|
+
function xe(e) {
|
|
124
|
+
const t = [], { nodeExtensions: n, markExtensions: r } = gt(e), s = [...n, ...r], o = {
|
|
125
125
|
default: null,
|
|
126
126
|
rendered: !0,
|
|
127
127
|
renderHTML: null,
|
|
@@ -174,7 +174,7 @@ function Ce(e) {
|
|
|
174
174
|
});
|
|
175
175
|
}), t;
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function H(e, t) {
|
|
178
178
|
if (typeof e == "string") {
|
|
179
179
|
if (!t.nodes[e])
|
|
180
180
|
throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);
|
|
@@ -212,11 +212,11 @@ function ut(e, t) {
|
|
|
212
212
|
[n.name]: e.attrs[n.name]
|
|
213
213
|
}).reduce((n, r) => x(n, r), {});
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function Ae(e) {
|
|
216
216
|
return typeof e == "function";
|
|
217
217
|
}
|
|
218
218
|
function E(e, t = void 0, ...n) {
|
|
219
|
-
return
|
|
219
|
+
return Ae(e) ? t ? e.bind(t)(...n) : e(...n) : e;
|
|
220
220
|
}
|
|
221
221
|
function Un(e = {}) {
|
|
222
222
|
return Object.keys(e).length === 0 && e.constructor === Object;
|
|
@@ -224,7 +224,7 @@ function Un(e = {}) {
|
|
|
224
224
|
function qn(e) {
|
|
225
225
|
return typeof e != "string" ? e : e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" ? !0 : e === "false" ? !1 : e;
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function ne(e, t) {
|
|
228
228
|
return "style" in e ? e : {
|
|
229
229
|
...e,
|
|
230
230
|
getAttrs: (n) => {
|
|
@@ -242,7 +242,7 @@ function re(e, t) {
|
|
|
242
242
|
}
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function re(e) {
|
|
246
246
|
return Object.fromEntries(
|
|
247
247
|
// @ts-ignore
|
|
248
248
|
Object.entries(e).filter(([t, n]) => t === "attrs" && Un(n) ? !1 : n != null)
|
|
@@ -250,7 +250,7 @@ function se(e) {
|
|
|
250
250
|
}
|
|
251
251
|
function Gn(e, t) {
|
|
252
252
|
var n;
|
|
253
|
-
const r =
|
|
253
|
+
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) => {
|
|
254
254
|
const u = r.filter((g) => g.type === c.name), d = {
|
|
255
255
|
name: c.name,
|
|
256
256
|
options: c.options,
|
|
@@ -262,7 +262,7 @@ function Gn(e, t) {
|
|
|
262
262
|
...g,
|
|
263
263
|
...b ? b(c) : {}
|
|
264
264
|
};
|
|
265
|
-
}, {}), h =
|
|
265
|
+
}, {}), h = re({
|
|
266
266
|
...p,
|
|
267
267
|
content: E(v(c, "content", d)),
|
|
268
268
|
marks: E(v(c, "marks", d)),
|
|
@@ -280,7 +280,7 @@ function Gn(e, t) {
|
|
|
280
280
|
return [g.name, { default: (k = g == null ? void 0 : g.attribute) === null || k === void 0 ? void 0 : k.default }];
|
|
281
281
|
}))
|
|
282
282
|
}), f = E(v(c, "parseHTML", d));
|
|
283
|
-
f && (h.parseDOM = f.map((g) =>
|
|
283
|
+
f && (h.parseDOM = f.map((g) => ne(g, u)));
|
|
284
284
|
const m = v(c, "renderHTML", d);
|
|
285
285
|
m && (h.toDOM = (g) => m({
|
|
286
286
|
node: g,
|
|
@@ -300,7 +300,7 @@ function Gn(e, t) {
|
|
|
300
300
|
...y,
|
|
301
301
|
...k ? k(c) : {}
|
|
302
302
|
};
|
|
303
|
-
}, {}), h =
|
|
303
|
+
}, {}), h = re({
|
|
304
304
|
...p,
|
|
305
305
|
inclusive: E(v(c, "inclusive", d)),
|
|
306
306
|
excludes: E(v(c, "excludes", d)),
|
|
@@ -312,23 +312,23 @@ function Gn(e, t) {
|
|
|
312
312
|
return [y.name, { default: (g = y == null ? void 0 : y.attribute) === null || g === void 0 ? void 0 : g.default }];
|
|
313
313
|
}))
|
|
314
314
|
}), f = E(v(c, "parseHTML", d));
|
|
315
|
-
f && (h.parseDOM = f.map((y) =>
|
|
315
|
+
f && (h.parseDOM = f.map((y) => ne(y, u)));
|
|
316
316
|
const m = v(c, "renderHTML", d);
|
|
317
317
|
return m && (h.toDOM = (y) => m({
|
|
318
318
|
mark: y,
|
|
319
319
|
HTMLAttributes: ut(y, u)
|
|
320
320
|
})), [c.name, h];
|
|
321
321
|
}));
|
|
322
|
-
return new
|
|
322
|
+
return new Se({
|
|
323
323
|
topNode: i,
|
|
324
324
|
nodes: a,
|
|
325
325
|
marks: l
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function Tt(e, t) {
|
|
329
329
|
return t.nodes[e] || t.marks[e] || null;
|
|
330
330
|
}
|
|
331
|
-
function
|
|
331
|
+
function se(e, t) {
|
|
332
332
|
return Array.isArray(t) ? t.some((n) => (typeof n == "string" ? n : n.name) === e.name) : t;
|
|
333
333
|
}
|
|
334
334
|
const Jn = (e, t = 500) => {
|
|
@@ -345,16 +345,16 @@ const Jn = (e, t = 500) => {
|
|
|
345
345
|
n += s.isAtom && !s.isText ? u : u.slice(0, Math.max(0, r - o));
|
|
346
346
|
}), n;
|
|
347
347
|
};
|
|
348
|
-
function
|
|
348
|
+
function Vt(e) {
|
|
349
349
|
return Object.prototype.toString.call(e) === "[object RegExp]";
|
|
350
350
|
}
|
|
351
|
-
class
|
|
351
|
+
class yt {
|
|
352
352
|
constructor(t) {
|
|
353
353
|
this.find = t.find, this.handler = t.handler;
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
const Yn = (e, t) => {
|
|
357
|
-
if (
|
|
357
|
+
if (Vt(t))
|
|
358
358
|
return t.exec(e);
|
|
359
359
|
const n = t(e);
|
|
360
360
|
if (!n)
|
|
@@ -381,13 +381,13 @@ function rt(e) {
|
|
|
381
381
|
const h = Yn(d, p.find);
|
|
382
382
|
if (!h)
|
|
383
383
|
return;
|
|
384
|
-
const f = l.state.tr, m =
|
|
384
|
+
const f = l.state.tr, m = ft({
|
|
385
385
|
state: l.state,
|
|
386
386
|
transaction: f
|
|
387
387
|
}), y = {
|
|
388
388
|
from: r - (h[0].length - o.length),
|
|
389
389
|
to: s
|
|
390
|
-
}, { commands: g, chain: k, can: b } = new
|
|
390
|
+
}, { commands: g, chain: k, can: b } = new mt({
|
|
391
391
|
editor: n,
|
|
392
392
|
state: m
|
|
393
393
|
});
|
|
@@ -482,10 +482,10 @@ function Qn(e) {
|
|
|
482
482
|
function st(e) {
|
|
483
483
|
return Qn(e) !== "Object" ? !1 : e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
|
|
484
484
|
}
|
|
485
|
-
function
|
|
485
|
+
function bt(e, t) {
|
|
486
486
|
const n = { ...e };
|
|
487
487
|
return st(e) && st(t) && Object.keys(t).forEach((r) => {
|
|
488
|
-
st(t[r]) && st(e[r]) ? n[r] =
|
|
488
|
+
st(t[r]) && st(e[r]) ? n[r] = bt(e[r], t[r]) : n[r] = t[r];
|
|
489
489
|
}), n;
|
|
490
490
|
}
|
|
491
491
|
class D {
|
|
@@ -509,7 +509,7 @@ class D {
|
|
|
509
509
|
configure(t = {}) {
|
|
510
510
|
const n = this.extend({
|
|
511
511
|
...this.config,
|
|
512
|
-
addOptions: () =>
|
|
512
|
+
addOptions: () => bt(this.options, t)
|
|
513
513
|
});
|
|
514
514
|
return n.name = this.name, n.parent = this.parent, n;
|
|
515
515
|
}
|
|
@@ -543,7 +543,7 @@ class tr {
|
|
|
543
543
|
}
|
|
544
544
|
}
|
|
545
545
|
const er = (e, t, n) => {
|
|
546
|
-
if (
|
|
546
|
+
if (Vt(t))
|
|
547
547
|
return [...e.matchAll(t)];
|
|
548
548
|
const r = t(e, n);
|
|
549
549
|
return r ? r.map((s) => {
|
|
@@ -552,7 +552,7 @@ const er = (e, t, n) => {
|
|
|
552
552
|
}) : [];
|
|
553
553
|
};
|
|
554
554
|
function nr(e) {
|
|
555
|
-
const { editor: t, state: n, from: r, to: s, rule: o, pasteEvent: i, dropEvent: a } = e, { commands: l, chain: c, can: u } = new
|
|
555
|
+
const { editor: t, state: n, from: r, to: s, rule: o, pasteEvent: i, dropEvent: a } = e, { commands: l, chain: c, can: u } = new mt({
|
|
556
556
|
editor: t,
|
|
557
557
|
state: n
|
|
558
558
|
}), d = [];
|
|
@@ -591,7 +591,7 @@ function sr(e) {
|
|
|
591
591
|
const { editor: t, rules: n } = e;
|
|
592
592
|
let r = null, s = !1, o = !1, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, a = typeof DragEvent < "u" ? new DragEvent("drop") : null;
|
|
593
593
|
const l = ({ state: u, from: d, to: p, rule: h, pasteEvt: f }) => {
|
|
594
|
-
const m = u.tr, y =
|
|
594
|
+
const m = u.tr, y = ft({
|
|
595
595
|
state: u,
|
|
596
596
|
transaction: m
|
|
597
597
|
});
|
|
@@ -710,7 +710,7 @@ class Q {
|
|
|
710
710
|
options: n.options,
|
|
711
711
|
storage: n.storage,
|
|
712
712
|
editor: this.editor,
|
|
713
|
-
type:
|
|
713
|
+
type: Tt(n.name, this.schema)
|
|
714
714
|
}, s = v(n, "addCommands", r);
|
|
715
715
|
return s ? {
|
|
716
716
|
...t,
|
|
@@ -729,7 +729,7 @@ class Q {
|
|
|
729
729
|
options: i.options,
|
|
730
730
|
storage: i.storage,
|
|
731
731
|
editor: t,
|
|
732
|
-
type:
|
|
732
|
+
type: Tt(i.name, this.schema)
|
|
733
733
|
}, l = [], c = v(i, "addKeyboardShortcuts", a);
|
|
734
734
|
let u = {};
|
|
735
735
|
if (i.type === "mark" && v(i, "exitable", a) && (u.ArrowRight = () => D.handleExit({ editor: t, mark: i })), c) {
|
|
@@ -739,9 +739,9 @@ class Q {
|
|
|
739
739
|
const d = bn(u);
|
|
740
740
|
l.push(d);
|
|
741
741
|
const p = v(i, "addInputRules", a);
|
|
742
|
-
|
|
742
|
+
se(i, t.options.enableInputRules) && p && r.push(...p());
|
|
743
743
|
const h = v(i, "addPasteRules", a);
|
|
744
|
-
|
|
744
|
+
se(i, t.options.enablePasteRules) && h && s.push(...h());
|
|
745
745
|
const f = v(i, "addProseMirrorPlugins", a);
|
|
746
746
|
if (f) {
|
|
747
747
|
const m = f();
|
|
@@ -766,21 +766,21 @@ class Q {
|
|
|
766
766
|
* @returns An array of attributes
|
|
767
767
|
*/
|
|
768
768
|
get attributes() {
|
|
769
|
-
return
|
|
769
|
+
return xe(this.extensions);
|
|
770
770
|
}
|
|
771
771
|
/**
|
|
772
772
|
* Get all node views from the extensions.
|
|
773
773
|
* @returns An object with all node views where the key is the node name and the value is the node view function
|
|
774
774
|
*/
|
|
775
775
|
get nodeViews() {
|
|
776
|
-
const { editor: t } = this, { nodeExtensions: n } =
|
|
776
|
+
const { editor: t } = this, { nodeExtensions: n } = gt(this.extensions);
|
|
777
777
|
return Object.fromEntries(n.filter((r) => !!v(r, "addNodeView")).map((r) => {
|
|
778
778
|
const s = this.attributes.filter((l) => l.type === r.name), o = {
|
|
779
779
|
name: r.name,
|
|
780
780
|
options: r.options,
|
|
781
781
|
storage: r.storage,
|
|
782
782
|
editor: t,
|
|
783
|
-
type:
|
|
783
|
+
type: H(r.name, this.schema)
|
|
784
784
|
}, i = v(r, "addNodeView", o);
|
|
785
785
|
if (!i)
|
|
786
786
|
return [];
|
|
@@ -815,7 +815,7 @@ class Q {
|
|
|
815
815
|
options: t.options,
|
|
816
816
|
storage: t.storage,
|
|
817
817
|
editor: this.editor,
|
|
818
|
-
type:
|
|
818
|
+
type: Tt(t.name, this.schema)
|
|
819
819
|
};
|
|
820
820
|
t.type === "mark" && (!((n = E(v(t, "keepOnSplit", r))) !== null && n !== void 0) || n) && this.splittableMarks.push(t.name);
|
|
821
821
|
const s = v(t, "onBeforeCreate", r), o = v(t, "onCreate", r), i = v(t, "onUpdate", r), a = v(t, "onSelectionUpdate", r), l = v(t, "onTransaction", r), c = v(t, "onFocus", r), u = v(t, "onBlur", r), d = v(t, "onDestroy", r);
|
|
@@ -844,7 +844,7 @@ class _ {
|
|
|
844
844
|
configure(t = {}) {
|
|
845
845
|
const n = this.extend({
|
|
846
846
|
...this.config,
|
|
847
|
-
addOptions: () =>
|
|
847
|
+
addOptions: () => bt(this.options, t)
|
|
848
848
|
});
|
|
849
849
|
return n.name = this.name, n.parent = this.parent, n;
|
|
850
850
|
}
|
|
@@ -858,7 +858,7 @@ class _ {
|
|
|
858
858
|
})), n;
|
|
859
859
|
}
|
|
860
860
|
}
|
|
861
|
-
function
|
|
861
|
+
function Oe(e, t, n) {
|
|
862
862
|
const { from: r, to: s } = t, { blockSeparator: o = `
|
|
863
863
|
|
|
864
864
|
`, textSerializers: i = {} } = n || {};
|
|
@@ -878,7 +878,7 @@ function Ae(e, t, n) {
|
|
|
878
878
|
l.isText && (a += (p = l == null ? void 0 : l.text) === null || p === void 0 ? void 0 : p.slice(Math.max(r, c) - c, s - c));
|
|
879
879
|
}), a;
|
|
880
880
|
}
|
|
881
|
-
function
|
|
881
|
+
function Le(e) {
|
|
882
882
|
return Object.fromEntries(Object.entries(e.nodes).filter(([, t]) => t.spec.toText).map(([t, n]) => [t, n.spec.toText]));
|
|
883
883
|
}
|
|
884
884
|
const ir = _.create({
|
|
@@ -894,8 +894,8 @@ const ir = _.create({
|
|
|
894
894
|
key: new I("clipboardTextSerializer"),
|
|
895
895
|
props: {
|
|
896
896
|
clipboardTextSerializer: () => {
|
|
897
|
-
const { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: s } = t, { ranges: o } = s, i = Math.min(...o.map((u) => u.$from.pos)), a = Math.max(...o.map((u) => u.$to.pos)), l =
|
|
898
|
-
return
|
|
897
|
+
const { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: s } = t, { ranges: o } = s, i = Math.min(...o.map((u) => u.$from.pos)), a = Math.max(...o.map((u) => u.$to.pos)), l = Le(n);
|
|
898
|
+
return Oe(r, { from: i, to: a }, {
|
|
899
899
|
...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
|
|
900
900
|
textSerializers: l
|
|
901
901
|
});
|
|
@@ -944,7 +944,7 @@ const ir = _.create({
|
|
|
944
944
|
}
|
|
945
945
|
return !1;
|
|
946
946
|
}, fr = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
947
|
-
const s =
|
|
947
|
+
const s = H(e, n.schema), o = t.selection.$anchor;
|
|
948
948
|
for (let i = o.depth; i > 0; i -= 1)
|
|
949
949
|
if (o.node(i).type === s) {
|
|
950
950
|
if (r) {
|
|
@@ -960,7 +960,7 @@ const ir = _.create({
|
|
|
960
960
|
}, gr = () => ({ state: e, dispatch: t }) => Ge(e, t), yr = () => ({ commands: e }) => e.keyboardShortcut("Enter"), br = () => ({ state: e, dispatch: t }) => Je(e, t);
|
|
961
961
|
function pt(e, t, n = { strict: !0 }) {
|
|
962
962
|
const r = Object.keys(t);
|
|
963
|
-
return r.length ? r.every((s) => n.strict ? t[s] === e[s] :
|
|
963
|
+
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;
|
|
964
964
|
}
|
|
965
965
|
function Rt(e, t, n = {}) {
|
|
966
966
|
return e.find((r) => r.type === t && pt(r.attrs, n));
|
|
@@ -968,11 +968,11 @@ function Rt(e, t, n = {}) {
|
|
|
968
968
|
function vr(e, t, n = {}) {
|
|
969
969
|
return !!Rt(e, t, n);
|
|
970
970
|
}
|
|
971
|
-
function
|
|
971
|
+
function Wt(e, t, n = {}) {
|
|
972
972
|
if (!e || !t)
|
|
973
973
|
return;
|
|
974
974
|
let r = e.parent.childAfter(e.parentOffset);
|
|
975
|
-
if (
|
|
975
|
+
if ((!r.node || !r.node.marks.some((c) => c.type === t)) && (r = e.parent.childBefore(e.parentOffset)), !r.node || !r.node.marks.some((c) => c.type === t))
|
|
976
976
|
return;
|
|
977
977
|
const s = Rt([...r.node.marks], t, n);
|
|
978
978
|
if (!s)
|
|
@@ -998,7 +998,7 @@ function V(e, t) {
|
|
|
998
998
|
const Mr = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
999
999
|
const o = V(e, r.schema), { doc: i, selection: a } = n, { $from: l, from: c, to: u } = a;
|
|
1000
1000
|
if (s) {
|
|
1001
|
-
const d =
|
|
1001
|
+
const d = Wt(l, o, t);
|
|
1002
1002
|
if (d && d.from <= c && d.to >= u) {
|
|
1003
1003
|
const p = $.create(i, d.from, d.to);
|
|
1004
1004
|
n.setSelection(p);
|
|
@@ -1012,13 +1012,13 @@ const Mr = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
|
1012
1012
|
return !0;
|
|
1013
1013
|
return !1;
|
|
1014
1014
|
};
|
|
1015
|
-
function
|
|
1015
|
+
function Kt(e) {
|
|
1016
1016
|
return e instanceof $;
|
|
1017
1017
|
}
|
|
1018
1018
|
function B(e = 0, t = 0, n = 0) {
|
|
1019
1019
|
return Math.min(Math.max(e, t), n);
|
|
1020
1020
|
}
|
|
1021
|
-
function
|
|
1021
|
+
function _e(e, t = null) {
|
|
1022
1022
|
if (!t)
|
|
1023
1023
|
return null;
|
|
1024
1024
|
const n = G.atStart(e), r = G.atEnd(e);
|
|
@@ -1029,7 +1029,7 @@ function Le(e, t = null) {
|
|
|
1029
1029
|
const s = n.from, o = r.to;
|
|
1030
1030
|
return t === "all" ? $.create(e, B(0, s, o), B(e.content.size, s, o)) : $.create(e, B(t, s, o), B(t, s, o));
|
|
1031
1031
|
}
|
|
1032
|
-
function
|
|
1032
|
+
function vt() {
|
|
1033
1033
|
return [
|
|
1034
1034
|
"iPad Simulator",
|
|
1035
1035
|
"iPhone Simulator",
|
|
@@ -1045,27 +1045,27 @@ const kr = (e = null, t = {}) => ({ editor: n, view: r, tr: s, dispatch: o }) =>
|
|
|
1045
1045
|
...t
|
|
1046
1046
|
};
|
|
1047
1047
|
const i = () => {
|
|
1048
|
-
|
|
1048
|
+
vt() && r.dom.focus(), requestAnimationFrame(() => {
|
|
1049
1049
|
n.isDestroyed || (r.focus(), t != null && t.scrollIntoView && n.commands.scrollIntoView());
|
|
1050
1050
|
});
|
|
1051
1051
|
};
|
|
1052
1052
|
if (r.hasFocus() && e === null || e === !1)
|
|
1053
1053
|
return !0;
|
|
1054
|
-
if (o && e === null && !
|
|
1054
|
+
if (o && e === null && !Kt(n.state.selection))
|
|
1055
1055
|
return i(), !0;
|
|
1056
|
-
const a =
|
|
1056
|
+
const a = _e(s.doc, e) || n.state.selection, l = n.state.selection.eq(a);
|
|
1057
1057
|
return o && (l || s.setSelection(a), l && s.storedMarks && s.setStoredMarks(s.storedMarks), i()), !0;
|
|
1058
|
-
}, wr = (e, t) => (n) => e.every((r, s) => t(r, { ...n, index: s })), Er = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({ from: n.selection.from, to: n.selection.to }, e, t),
|
|
1058
|
+
}, wr = (e, t) => (n) => e.every((r, s) => t(r, { ...n, index: s })), Er = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({ from: n.selection.from, to: n.selection.to }, e, t), Re = (e) => {
|
|
1059
1059
|
const t = e.childNodes;
|
|
1060
1060
|
for (let n = t.length - 1; n >= 0; n -= 1) {
|
|
1061
1061
|
const r = t[n];
|
|
1062
|
-
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 &&
|
|
1062
|
+
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Re(r);
|
|
1063
1063
|
}
|
|
1064
1064
|
return e;
|
|
1065
1065
|
};
|
|
1066
1066
|
function ot(e) {
|
|
1067
1067
|
const t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
|
|
1068
|
-
return
|
|
1068
|
+
return Re(n);
|
|
1069
1069
|
}
|
|
1070
1070
|
function ht(e, t, n) {
|
|
1071
1071
|
n = {
|
|
@@ -1088,7 +1088,7 @@ function ht(e, t, n) {
|
|
|
1088
1088
|
if (s) {
|
|
1089
1089
|
if (n.errorOnInvalidContent) {
|
|
1090
1090
|
let i = !1, a = "";
|
|
1091
|
-
const l = new
|
|
1091
|
+
const l = new Se({
|
|
1092
1092
|
topNode: t.spec.topNode,
|
|
1093
1093
|
marks: t.spec.marks,
|
|
1094
1094
|
// Prosemirror's schemas are executed such that: the last to execute, matches last
|
|
@@ -1106,10 +1106,10 @@ function ht(e, t, n) {
|
|
|
1106
1106
|
}
|
|
1107
1107
|
})
|
|
1108
1108
|
});
|
|
1109
|
-
if (n.slice ?
|
|
1109
|
+
if (n.slice ? Et.fromSchema(l).parseSlice(ot(e), n.parseOptions) : Et.fromSchema(l).parse(ot(e), n.parseOptions), n.errorOnInvalidContent && i)
|
|
1110
1110
|
throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${a}`) });
|
|
1111
1111
|
}
|
|
1112
|
-
const o =
|
|
1112
|
+
const o = Et.fromSchema(t);
|
|
1113
1113
|
return n.slice ? o.parseSlice(ot(e), n.parseOptions).content : o.parse(ot(e), n.parseOptions);
|
|
1114
1114
|
}
|
|
1115
1115
|
return ht("", t, n);
|
|
@@ -1131,7 +1131,7 @@ const Cr = (e) => !("type" in e), xr = (e, t, n) => ({ tr: r, dispatch: s, edito
|
|
|
1131
1131
|
var i;
|
|
1132
1132
|
if (s) {
|
|
1133
1133
|
n = {
|
|
1134
|
-
parseOptions:
|
|
1134
|
+
parseOptions: o.options.parseOptions,
|
|
1135
1135
|
updateSelection: !0,
|
|
1136
1136
|
applyInputRules: !1,
|
|
1137
1137
|
applyPasteRules: !1,
|
|
@@ -1151,7 +1151,7 @@ const Cr = (e) => !("type" in e), xr = (e, t, n) => ({ tr: r, dispatch: s, edito
|
|
|
1151
1151
|
editor: o,
|
|
1152
1152
|
error: f,
|
|
1153
1153
|
disableCollaboration: () => {
|
|
1154
|
-
|
|
1154
|
+
o.storage.collaboration && (o.storage.collaboration.isDisabled = !0);
|
|
1155
1155
|
}
|
|
1156
1156
|
}), !1;
|
|
1157
1157
|
}
|
|
@@ -1166,16 +1166,16 @@ const Cr = (e) => !("type" in e), xr = (e, t, n) => ({ tr: r, dispatch: s, edito
|
|
|
1166
1166
|
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 && Tr(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: l, text: h }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: l, text: h });
|
|
1167
1167
|
}
|
|
1168
1168
|
return !0;
|
|
1169
|
-
}, Ar = () => ({ state: e, dispatch: t }) => Ye(e, t), Or = () => ({ state: e, dispatch: t }) => Xe(e, t), Lr = () => ({ state: e, dispatch: t }) => Qe(e, t), _r = () => ({ state: e, dispatch: t }) => Ze(e, t),
|
|
1169
|
+
}, Ar = () => ({ state: e, dispatch: t }) => Ye(e, t), Or = () => ({ state: e, dispatch: t }) => Xe(e, t), Lr = () => ({ state: e, dispatch: t }) => Qe(e, t), _r = () => ({ state: e, dispatch: t }) => Ze(e, t), Rr = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
1170
1170
|
try {
|
|
1171
|
-
const r =
|
|
1171
|
+
const r = Me(e.doc, e.selection.$from.pos, -1);
|
|
1172
1172
|
return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
1173
1173
|
} catch {
|
|
1174
1174
|
return !1;
|
|
1175
1175
|
}
|
|
1176
|
-
},
|
|
1176
|
+
}, Hr = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
1177
1177
|
try {
|
|
1178
|
-
const r =
|
|
1178
|
+
const r = Me(e.doc, e.selection.$from.pos, 1);
|
|
1179
1179
|
return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
1180
1180
|
} catch {
|
|
1181
1181
|
return !1;
|
|
@@ -1200,7 +1200,7 @@ function $r(e) {
|
|
|
1200
1200
|
else if (/^s(hift)?$/i.test(l))
|
|
1201
1201
|
o = !0;
|
|
1202
1202
|
else if (/^mod$/i.test(l))
|
|
1203
|
-
|
|
1203
|
+
vt() || He() ? i = !0 : s = !0;
|
|
1204
1204
|
else
|
|
1205
1205
|
throw new Error(`Unrecognized modifier name: ${l}`);
|
|
1206
1206
|
}
|
|
@@ -1224,7 +1224,7 @@ const Dr = (e) => ({ editor: t, view: n, tr: r, dispatch: s }) => {
|
|
|
1224
1224
|
}), !0;
|
|
1225
1225
|
};
|
|
1226
1226
|
function nt(e, t, n = {}) {
|
|
1227
|
-
const { from: r, to: s, empty: o } = e.selection, i = t ?
|
|
1227
|
+
const { from: r, to: s, empty: o } = e.selection, i = t ? H(t, e.schema) : null, a = [];
|
|
1228
1228
|
e.doc.nodesBetween(r, s, (d, p) => {
|
|
1229
1229
|
if (d.isText)
|
|
1230
1230
|
return;
|
|
@@ -1239,26 +1239,26 @@ function nt(e, t, n = {}) {
|
|
|
1239
1239
|
return o ? !!c.length : c.reduce((d, p) => d + p.to - p.from, 0) >= l;
|
|
1240
1240
|
}
|
|
1241
1241
|
const Nr = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1242
|
-
const s =
|
|
1242
|
+
const s = H(e, n.schema);
|
|
1243
1243
|
return nt(n, s, t) ? nn(n, r) : !1;
|
|
1244
1244
|
}, Br = () => ({ state: e, dispatch: t }) => rn(e, t), jr = (e) => ({ state: t, dispatch: n }) => {
|
|
1245
|
-
const r =
|
|
1245
|
+
const r = H(e, t.schema);
|
|
1246
1246
|
return sn(r)(t, n);
|
|
1247
1247
|
}, Fr = () => ({ state: e, dispatch: t }) => on(e, t);
|
|
1248
|
-
function
|
|
1248
|
+
function Mt(e, t) {
|
|
1249
1249
|
return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
|
|
1250
1250
|
}
|
|
1251
|
-
function
|
|
1251
|
+
function oe(e, t) {
|
|
1252
1252
|
const n = typeof t == "string" ? [t] : t;
|
|
1253
1253
|
return Object.keys(e).reduce((r, s) => (n.includes(s) || (r[s] = e[s]), r), {});
|
|
1254
1254
|
}
|
|
1255
1255
|
const zr = (e, t) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1256
1256
|
let o = null, i = null;
|
|
1257
|
-
const a =
|
|
1258
|
-
return a ? (a === "node" && (o =
|
|
1257
|
+
const a = Mt(typeof e == "string" ? e : e.name, r.schema);
|
|
1258
|
+
return a ? (a === "node" && (o = H(e, r.schema)), a === "mark" && (i = V(e, r.schema)), s && n.selection.ranges.forEach((l) => {
|
|
1259
1259
|
r.doc.nodesBetween(l.$from.pos, l.$to.pos, (c, u) => {
|
|
1260
|
-
o && o === c.type && n.setNodeMarkup(u, void 0,
|
|
1261
|
-
i === d.type && n.addMark(u, u + c.nodeSize, i.create(
|
|
1260
|
+
o && o === c.type && n.setNodeMarkup(u, void 0, oe(c.attrs, t)), i && c.marks.length && c.marks.forEach((d) => {
|
|
1261
|
+
i === d.type && n.addMark(u, u + c.nodeSize, i.create(oe(d.attrs, t)));
|
|
1262
1262
|
});
|
|
1263
1263
|
});
|
|
1264
1264
|
}), !0) : !1;
|
|
@@ -1266,7 +1266,7 @@ const zr = (e, t) => ({ tr: n, state: r, dispatch: s }) => {
|
|
|
1266
1266
|
from: 0,
|
|
1267
1267
|
to: e.doc.content.size
|
|
1268
1268
|
}), 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);
|
|
1269
|
-
function
|
|
1269
|
+
function Ht(e, t, n = {}, r = {}) {
|
|
1270
1270
|
return ht(e, t, {
|
|
1271
1271
|
slice: !1,
|
|
1272
1272
|
parseOptions: n,
|
|
@@ -1277,7 +1277,7 @@ const Yr = (e, t = !1, n = {}, r = {}) => ({ editor: s, tr: o, dispatch: i, comm
|
|
|
1277
1277
|
var l, c;
|
|
1278
1278
|
const { doc: u } = o;
|
|
1279
1279
|
if (n.preserveWhitespace !== "full") {
|
|
1280
|
-
const d =
|
|
1280
|
+
const d = Ht(e, s.schema, n, {
|
|
1281
1281
|
errorOnInvalidContent: (l = r.errorOnInvalidContent) !== null && l !== void 0 ? l : s.options.enableContentCheck
|
|
1282
1282
|
});
|
|
1283
1283
|
return i && o.replaceWith(0, u.content.size, d).setMeta("preventUpdate", !t), !0;
|
|
@@ -1287,7 +1287,7 @@ const Yr = (e, t = !1, n = {}, r = {}) => ({ editor: s, tr: o, dispatch: i, comm
|
|
|
1287
1287
|
errorOnInvalidContent: (c = r.errorOnInvalidContent) !== null && c !== void 0 ? c : s.options.enableContentCheck
|
|
1288
1288
|
});
|
|
1289
1289
|
};
|
|
1290
|
-
function
|
|
1290
|
+
function Ut(e, t) {
|
|
1291
1291
|
const n = V(t, e.schema), { from: r, to: s, empty: o } = e.selection, i = [];
|
|
1292
1292
|
o ? (e.storedMarks && i.push(...e.storedMarks), i.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, s, (l) => {
|
|
1293
1293
|
i.push(...l.marks);
|
|
@@ -1311,7 +1311,7 @@ function Qr(e) {
|
|
|
1311
1311
|
}
|
|
1312
1312
|
return null;
|
|
1313
1313
|
}
|
|
1314
|
-
function
|
|
1314
|
+
function Yo(e, t) {
|
|
1315
1315
|
const n = [];
|
|
1316
1316
|
return e.descendants((r, s) => {
|
|
1317
1317
|
t(r) && n.push({
|
|
@@ -1329,7 +1329,7 @@ function Zr(e, t, n) {
|
|
|
1329
1329
|
});
|
|
1330
1330
|
}), r;
|
|
1331
1331
|
}
|
|
1332
|
-
function
|
|
1332
|
+
function Pe(e, t) {
|
|
1333
1333
|
for (let n = e.depth; n > 0; n -= 1) {
|
|
1334
1334
|
const r = e.node(n);
|
|
1335
1335
|
if (t(r))
|
|
@@ -1341,8 +1341,8 @@ function Re(e, t) {
|
|
|
1341
1341
|
};
|
|
1342
1342
|
}
|
|
1343
1343
|
}
|
|
1344
|
-
function
|
|
1345
|
-
return (t) =>
|
|
1344
|
+
function qt(e) {
|
|
1345
|
+
return (t) => Pe(t.$from, e);
|
|
1346
1346
|
}
|
|
1347
1347
|
function ts(e, t) {
|
|
1348
1348
|
const n = Sn.fromSchema(t).serializeFragment(e), s = document.implementation.createHTMLDocument().createElement("div");
|
|
@@ -1353,19 +1353,19 @@ function es(e, t) {
|
|
|
1353
1353
|
from: 0,
|
|
1354
1354
|
to: e.content.size
|
|
1355
1355
|
};
|
|
1356
|
-
return
|
|
1356
|
+
return Oe(e, n, t);
|
|
1357
1357
|
}
|
|
1358
1358
|
function ns(e, t) {
|
|
1359
|
-
const n =
|
|
1359
|
+
const n = H(t, e.schema), { from: r, to: s } = e.selection, o = [];
|
|
1360
1360
|
e.doc.nodesBetween(r, s, (a) => {
|
|
1361
1361
|
o.push(a);
|
|
1362
1362
|
});
|
|
1363
1363
|
const i = o.reverse().find((a) => a.type.name === n.name);
|
|
1364
1364
|
return i ? { ...i.attrs } : {};
|
|
1365
1365
|
}
|
|
1366
|
-
function
|
|
1367
|
-
const n =
|
|
1368
|
-
return n === "node" ? ns(e, t) : n === "mark" ?
|
|
1366
|
+
function Ie(e, t) {
|
|
1367
|
+
const n = Mt(typeof t == "string" ? t : t.name, e.schema);
|
|
1368
|
+
return n === "node" ? ns(e, t) : n === "mark" ? Ut(e, t) : {};
|
|
1369
1369
|
}
|
|
1370
1370
|
function rs(e, t = JSON.stringify) {
|
|
1371
1371
|
const n = {};
|
|
@@ -1407,10 +1407,10 @@ function os(e) {
|
|
|
1407
1407
|
});
|
|
1408
1408
|
}), ss(r);
|
|
1409
1409
|
}
|
|
1410
|
-
function
|
|
1410
|
+
function Gt(e, t, n) {
|
|
1411
1411
|
const r = [];
|
|
1412
1412
|
return e === t ? n.resolve(e).marks().forEach((s) => {
|
|
1413
|
-
const o = n.resolve(e), i =
|
|
1413
|
+
const o = n.resolve(e), i = Wt(o, s.type);
|
|
1414
1414
|
i && r.push({
|
|
1415
1415
|
mark: s,
|
|
1416
1416
|
...i
|
|
@@ -1429,7 +1429,7 @@ function ct(e, t, n) {
|
|
|
1429
1429
|
return s ? s.attribute.keepOnSplit : !1;
|
|
1430
1430
|
}));
|
|
1431
1431
|
}
|
|
1432
|
-
function
|
|
1432
|
+
function Pt(e, t, n = {}) {
|
|
1433
1433
|
const { empty: r, ranges: s } = e.selection, o = t ? V(t, e.schema) : null;
|
|
1434
1434
|
if (r)
|
|
1435
1435
|
return !!(e.storedMarks || e.selection.$from.marks()).filter((d) => o ? o.name === d.type.name : !0).find((d) => pt(d.attrs, n, { strict: !1 }));
|
|
@@ -1454,12 +1454,12 @@ function It(e, t, n = {}) {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
function is(e, t, n = {}) {
|
|
1456
1456
|
if (!t)
|
|
1457
|
-
return nt(e, null, n) ||
|
|
1458
|
-
const r =
|
|
1459
|
-
return r === "node" ? nt(e, t, n) : r === "mark" ?
|
|
1457
|
+
return nt(e, null, n) || Pt(e, null, n);
|
|
1458
|
+
const r = Mt(t, e.schema);
|
|
1459
|
+
return r === "node" ? nt(e, t, n) : r === "mark" ? Pt(e, t, n) : !1;
|
|
1460
1460
|
}
|
|
1461
|
-
function
|
|
1462
|
-
const { nodeExtensions: n } =
|
|
1461
|
+
function ie(e, t) {
|
|
1462
|
+
const { nodeExtensions: n } = gt(t), r = n.find((i) => i.name === e);
|
|
1463
1463
|
if (!r)
|
|
1464
1464
|
return !1;
|
|
1465
1465
|
const s = {
|
|
@@ -1469,7 +1469,7 @@ function ae(e, t) {
|
|
|
1469
1469
|
}, o = E(v(r, "group", s));
|
|
1470
1470
|
return typeof o != "string" ? !1 : o.split(" ").includes("list");
|
|
1471
1471
|
}
|
|
1472
|
-
function
|
|
1472
|
+
function St(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
1473
1473
|
var r;
|
|
1474
1474
|
if (n) {
|
|
1475
1475
|
if (e.type.name === "hardBreak")
|
|
@@ -1486,12 +1486,12 @@ function kt(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1486
1486
|
if (t) {
|
|
1487
1487
|
let s = !0;
|
|
1488
1488
|
return e.content.forEach((o) => {
|
|
1489
|
-
s !== !1 && (
|
|
1489
|
+
s !== !1 && (St(o, { ignoreWhitespace: n, checkChildren: t }) || (s = !1));
|
|
1490
1490
|
}), s;
|
|
1491
1491
|
}
|
|
1492
1492
|
return !1;
|
|
1493
1493
|
}
|
|
1494
|
-
function
|
|
1494
|
+
function $e(e) {
|
|
1495
1495
|
return e instanceof Z;
|
|
1496
1496
|
}
|
|
1497
1497
|
function as(e, t, n) {
|
|
@@ -1514,7 +1514,7 @@ function ls(e, t, n) {
|
|
|
1514
1514
|
var r;
|
|
1515
1515
|
const { selection: s } = t;
|
|
1516
1516
|
let o = null;
|
|
1517
|
-
if (
|
|
1517
|
+
if (Kt(s) && (o = s.$cursor), o) {
|
|
1518
1518
|
const a = (r = e.storedMarks) !== null && r !== void 0 ? r : o.marks();
|
|
1519
1519
|
return !!n.isInSet(a) || !a.some((l) => l.type.excludes(n));
|
|
1520
1520
|
}
|
|
@@ -1536,7 +1536,7 @@ const cs = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
|
1536
1536
|
const { selection: o } = n, { empty: i, ranges: a } = o, l = V(e, r.schema);
|
|
1537
1537
|
if (s)
|
|
1538
1538
|
if (i) {
|
|
1539
|
-
const c =
|
|
1539
|
+
const c = Ut(r, l);
|
|
1540
1540
|
n.addStoredMark(l.create({
|
|
1541
1541
|
...c,
|
|
1542
1542
|
...t
|
|
@@ -1556,8 +1556,8 @@ const cs = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
|
1556
1556
|
});
|
|
1557
1557
|
return ls(r, n, l);
|
|
1558
1558
|
}, ds = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), us = (e, t = {}) => ({ state: n, dispatch: r, chain: s }) => {
|
|
1559
|
-
const o =
|
|
1560
|
-
return o.isTextblock ? s().command(({ commands: i }) =>
|
|
1559
|
+
const o = H(e, n.schema);
|
|
1560
|
+
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);
|
|
1561
1561
|
}, ps = (e) => ({ tr: t, dispatch: n }) => {
|
|
1562
1562
|
if (n) {
|
|
1563
1563
|
const { doc: r } = t, s = B(e, 0, r.content.size), o = Z.create(r, s);
|
|
@@ -1571,10 +1571,10 @@ const cs = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
|
1571
1571
|
}
|
|
1572
1572
|
return !0;
|
|
1573
1573
|
}, fs = (e) => ({ state: t, dispatch: n }) => {
|
|
1574
|
-
const r =
|
|
1574
|
+
const r = H(e, t.schema);
|
|
1575
1575
|
return pn(r)(t, n);
|
|
1576
1576
|
};
|
|
1577
|
-
function
|
|
1577
|
+
function ae(e, t) {
|
|
1578
1578
|
const n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
|
|
1579
1579
|
if (n) {
|
|
1580
1580
|
const r = n.filter((s) => t == null ? void 0 : t.includes(s.type.name));
|
|
@@ -1584,7 +1584,7 @@ function le(e, t) {
|
|
|
1584
1584
|
const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: s }) => {
|
|
1585
1585
|
const { selection: o, doc: i } = t, { $from: a, $to: l } = o, c = s.extensionManager.attributes, u = ct(c, a.node().type.name, a.node().attrs);
|
|
1586
1586
|
if (o instanceof Z && o.node.isBlock)
|
|
1587
|
-
return !a.parentOffset || !at(i, a.pos) ? !1 : (r && (e &&
|
|
1587
|
+
return !a.parentOffset || !at(i, a.pos) ? !1 : (r && (e && ae(n, s.extensionManager.splittableMarks), t.split(a.pos).scrollIntoView()), !0);
|
|
1588
1588
|
if (!a.parent.isBlock)
|
|
1589
1589
|
return !1;
|
|
1590
1590
|
const d = l.parentOffset === l.parent.content.size, p = a.depth === 0 ? void 0 : Qr(a.node(-1).contentMatchAt(a.indexAfter(-1)));
|
|
@@ -1604,12 +1604,12 @@ const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1604
1604
|
const m = t.mapping.map(a.before()), y = t.doc.resolve(m);
|
|
1605
1605
|
a.node(-1).canReplaceWith(y.index(), y.index() + 1, p) && t.setNodeMarkup(t.mapping.map(a.before()), p);
|
|
1606
1606
|
}
|
|
1607
|
-
e &&
|
|
1607
|
+
e && ae(n, s.extensionManager.splittableMarks), t.scrollIntoView();
|
|
1608
1608
|
}
|
|
1609
1609
|
return f;
|
|
1610
1610
|
}, gs = (e, t = {}) => ({ tr: n, state: r, dispatch: s, editor: o }) => {
|
|
1611
1611
|
var i;
|
|
1612
|
-
const a =
|
|
1612
|
+
const a = H(e, r.schema), { $from: l, $to: c } = r.selection, u = r.selection.node;
|
|
1613
1613
|
if (u && u.isBlock || l.depth < 2 || !l.sameParent(c))
|
|
1614
1614
|
return !1;
|
|
1615
1615
|
const d = l.node(-1);
|
|
@@ -1662,48 +1662,48 @@ const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1662
1662
|
n.ensureMarks(w);
|
|
1663
1663
|
}
|
|
1664
1664
|
return !0;
|
|
1665
|
-
},
|
|
1666
|
-
const n =
|
|
1665
|
+
}, Ct = (e, t) => {
|
|
1666
|
+
const n = qt((i) => i.type === t)(e.selection);
|
|
1667
1667
|
if (!n)
|
|
1668
1668
|
return !0;
|
|
1669
1669
|
const r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
|
|
1670
1670
|
if (r === void 0)
|
|
1671
1671
|
return !0;
|
|
1672
1672
|
const s = e.doc.nodeAt(r);
|
|
1673
|
-
return n.node.type === (s == null ? void 0 : s.type) &&
|
|
1674
|
-
},
|
|
1675
|
-
const n =
|
|
1673
|
+
return n.node.type === (s == null ? void 0 : s.type) && Bt(e.doc, n.pos) && e.join(n.pos), !0;
|
|
1674
|
+
}, xt = (e, t) => {
|
|
1675
|
+
const n = qt((i) => i.type === t)(e.selection);
|
|
1676
1676
|
if (!n)
|
|
1677
1677
|
return !0;
|
|
1678
1678
|
const r = e.doc.resolve(n.start).after(n.depth);
|
|
1679
1679
|
if (r === void 0)
|
|
1680
1680
|
return !0;
|
|
1681
1681
|
const s = e.doc.nodeAt(r);
|
|
1682
|
-
return n.node.type === (s == null ? void 0 : s.type) &&
|
|
1682
|
+
return n.node.type === (s == null ? void 0 : s.type) && Bt(e.doc, r) && e.join(r), !0;
|
|
1683
1683
|
}, ys = (e, t, n, r = {}) => ({ editor: s, tr: o, state: i, dispatch: a, chain: l, commands: c, can: u }) => {
|
|
1684
|
-
const { extensions: d, splittableMarks: p } = s.extensionManager, h =
|
|
1684
|
+
const { extensions: d, splittableMarks: p } = s.extensionManager, h = H(e, i.schema), f = H(t, i.schema), { selection: m, storedMarks: y } = i, { $from: g, $to: k } = m, b = g.blockRange(k), M = y || m.$to.parentOffset && m.$from.marks();
|
|
1685
1685
|
if (!b)
|
|
1686
1686
|
return !1;
|
|
1687
|
-
const w =
|
|
1687
|
+
const w = qt((S) => ie(S.type.name, d))(m);
|
|
1688
1688
|
if (b.depth >= 1 && w && b.depth - w.depth <= 1) {
|
|
1689
1689
|
if (w.node.type === h)
|
|
1690
1690
|
return c.liftListItem(f);
|
|
1691
|
-
if (
|
|
1692
|
-
return l().command(() => (o.setNodeMarkup(w.pos, h), !0)).command(() =>
|
|
1691
|
+
if (ie(w.node.type.name, d) && h.validContent(w.node.content) && a)
|
|
1692
|
+
return l().command(() => (o.setNodeMarkup(w.pos, h), !0)).command(() => Ct(o, h)).command(() => xt(o, h)).run();
|
|
1693
1693
|
}
|
|
1694
|
-
return !n || !M || !a ? l().command(() => u().wrapInList(h, r) ? !0 : c.clearNodes()).wrapInList(h, r).command(() =>
|
|
1694
|
+
return !n || !M || !a ? l().command(() => u().wrapInList(h, r) ? !0 : c.clearNodes()).wrapInList(h, r).command(() => Ct(o, h)).command(() => xt(o, h)).run() : l().command(() => {
|
|
1695
1695
|
const S = u().wrapInList(h, r), C = M.filter((A) => p.includes(A.type.name));
|
|
1696
1696
|
return o.ensureMarks(C), S ? !0 : c.clearNodes();
|
|
1697
|
-
}).wrapInList(h, r).command(() =>
|
|
1697
|
+
}).wrapInList(h, r).command(() => Ct(o, h)).command(() => xt(o, h)).run();
|
|
1698
1698
|
}, bs = (e, t = {}, n = {}) => ({ state: r, commands: s }) => {
|
|
1699
1699
|
const { extendEmptyMarkRange: o = !1 } = n, i = V(e, r.schema);
|
|
1700
|
-
return
|
|
1700
|
+
return Pt(r, i, t) ? s.unsetMark(i, { extendEmptyMarkRange: o }) : s.setMark(i, t);
|
|
1701
1701
|
}, vs = (e, t, n = {}) => ({ state: r, commands: s }) => {
|
|
1702
|
-
const o =
|
|
1702
|
+
const o = H(e, r.schema), i = H(t, r.schema), a = nt(r, o, n);
|
|
1703
1703
|
let l;
|
|
1704
1704
|
return r.selection.$anchor.sameParent(r.selection.$head) && (l = r.selection.$anchor.parent.attrs), a ? s.setNode(i, l) : s.setNode(o, { ...l, ...n });
|
|
1705
1705
|
}, Ms = (e, t = {}) => ({ state: n, commands: r }) => {
|
|
1706
|
-
const s =
|
|
1706
|
+
const s = H(e, n.schema);
|
|
1707
1707
|
return nt(n, s, t) ? r.lift(s) : r.wrapIn(s, t);
|
|
1708
1708
|
}, Ss = () => ({ state: e, dispatch: t }) => {
|
|
1709
1709
|
const n = e.plugins;
|
|
@@ -1737,7 +1737,7 @@ const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1737
1737
|
return !0;
|
|
1738
1738
|
if (u && i) {
|
|
1739
1739
|
let { from: p, to: h } = a;
|
|
1740
|
-
const f = (o = c.marks().find((y) => y.type === l)) === null || o === void 0 ? void 0 : o.attrs, m =
|
|
1740
|
+
const f = (o = c.marks().find((y) => y.type === l)) === null || o === void 0 ? void 0 : o.attrs, m = Wt(c, l, f);
|
|
1741
1741
|
m && (p = m.from, h = m.to), n.removeMark(p, h, l);
|
|
1742
1742
|
} else
|
|
1743
1743
|
d.forEach((p) => {
|
|
@@ -1746,8 +1746,8 @@ const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1746
1746
|
return n.removeStoredMark(l), !0;
|
|
1747
1747
|
}, Es = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1748
1748
|
let o = null, i = null;
|
|
1749
|
-
const a =
|
|
1750
|
-
return a ? (a === "node" && (o =
|
|
1749
|
+
const a = Mt(typeof e == "string" ? e : e.name, r.schema);
|
|
1750
|
+
return a ? (a === "node" && (o = H(e, r.schema)), a === "mark" && (i = V(e, r.schema)), s && n.selection.ranges.forEach((l) => {
|
|
1751
1751
|
const c = l.$from.pos, u = l.$to.pos;
|
|
1752
1752
|
r.doc.nodesBetween(c, u, (d, p) => {
|
|
1753
1753
|
o && o === d.type && n.setNodeMarkup(p, void 0, {
|
|
@@ -1765,10 +1765,10 @@ const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1765
1765
|
});
|
|
1766
1766
|
}), !0) : !1;
|
|
1767
1767
|
}, Ts = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1768
|
-
const s =
|
|
1768
|
+
const s = H(e, n.schema);
|
|
1769
1769
|
return fn(s, t)(n, r);
|
|
1770
1770
|
}, Cs = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1771
|
-
const s =
|
|
1771
|
+
const s = H(e, n.schema);
|
|
1772
1772
|
return mn(s, t)(n, r);
|
|
1773
1773
|
};
|
|
1774
1774
|
var xs = /* @__PURE__ */ Object.freeze({
|
|
@@ -1794,8 +1794,8 @@ var xs = /* @__PURE__ */ Object.freeze({
|
|
|
1794
1794
|
joinBackward: Lr,
|
|
1795
1795
|
joinDown: Or,
|
|
1796
1796
|
joinForward: _r,
|
|
1797
|
-
joinItemBackward:
|
|
1798
|
-
joinItemForward:
|
|
1797
|
+
joinItemBackward: Rr,
|
|
1798
|
+
joinItemForward: Hr,
|
|
1799
1799
|
joinTextblockBackward: Pr,
|
|
1800
1800
|
joinTextblockForward: Ir,
|
|
1801
1801
|
joinUp: Ar,
|
|
@@ -1894,7 +1894,7 @@ const As = _.create({
|
|
|
1894
1894
|
})
|
|
1895
1895
|
];
|
|
1896
1896
|
}
|
|
1897
|
-
}),
|
|
1897
|
+
}), Rs = _.create({
|
|
1898
1898
|
name: "keymap",
|
|
1899
1899
|
addKeyboardShortcuts() {
|
|
1900
1900
|
const e = () => this.editor.commands.first(({ commands: i }) => [
|
|
@@ -1939,7 +1939,7 @@ const As = _.create({
|
|
|
1939
1939
|
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
1940
1940
|
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
1941
1941
|
};
|
|
1942
|
-
return
|
|
1942
|
+
return vt() || He() ? o : s;
|
|
1943
1943
|
},
|
|
1944
1944
|
addProseMirrorPlugins() {
|
|
1945
1945
|
return [
|
|
@@ -1955,12 +1955,12 @@ const As = _.create({
|
|
|
1955
1955
|
if (!r || s)
|
|
1956
1956
|
return;
|
|
1957
1957
|
const { empty: o, from: i, to: a } = t.selection, l = G.atStart(t.doc).from, c = G.atEnd(t.doc).to;
|
|
1958
|
-
if (o || !(i === l && a === c) || !
|
|
1958
|
+
if (o || !(i === l && a === c) || !St(n.doc))
|
|
1959
1959
|
return;
|
|
1960
|
-
const p = n.tr, h =
|
|
1960
|
+
const p = n.tr, h = ft({
|
|
1961
1961
|
state: n,
|
|
1962
1962
|
transaction: p
|
|
1963
|
-
}), { commands: f } = new
|
|
1963
|
+
}), { commands: f } = new mt({
|
|
1964
1964
|
editor: this.editor,
|
|
1965
1965
|
state: h
|
|
1966
1966
|
});
|
|
@@ -1970,7 +1970,7 @@ const As = _.create({
|
|
|
1970
1970
|
})
|
|
1971
1971
|
];
|
|
1972
1972
|
}
|
|
1973
|
-
}),
|
|
1973
|
+
}), Hs = _.create({
|
|
1974
1974
|
name: "paste",
|
|
1975
1975
|
addProseMirrorPlugins() {
|
|
1976
1976
|
return [
|
|
@@ -2073,11 +2073,11 @@ class q {
|
|
|
2073
2073
|
get children() {
|
|
2074
2074
|
const t = [];
|
|
2075
2075
|
return this.node.content.forEach((n, r) => {
|
|
2076
|
-
const s = n.isBlock && !n.isTextblock, o = this.pos + r + 1,
|
|
2077
|
-
if (!s &&
|
|
2076
|
+
const s = n.isBlock && !n.isTextblock, o = n.isAtom && !n.isText, i = this.pos + r + (o ? 0 : 1), a = this.resolvedPos.doc.resolve(i);
|
|
2077
|
+
if (!s && a.depth <= this.depth)
|
|
2078
2078
|
return;
|
|
2079
|
-
const
|
|
2080
|
-
s && (
|
|
2079
|
+
const l = new q(a, this.editor, s, s ? n : null);
|
|
2080
|
+
s && (l.actualDepth = this.depth + 1), t.push(new q(a, this.editor, s, s ? n : null));
|
|
2081
2081
|
}), t;
|
|
2082
2082
|
}
|
|
2083
2083
|
get firstChild() {
|
|
@@ -2117,8 +2117,11 @@ class q {
|
|
|
2117
2117
|
}), s;
|
|
2118
2118
|
}
|
|
2119
2119
|
setAttribute(t) {
|
|
2120
|
-
const n = this.editor.state
|
|
2121
|
-
|
|
2120
|
+
const { tr: n } = this.editor.state;
|
|
2121
|
+
n.setNodeMarkup(this.from, void 0, {
|
|
2122
|
+
...this.node.attrs,
|
|
2123
|
+
...t
|
|
2124
|
+
}), this.editor.view.dispatch(n);
|
|
2122
2125
|
}
|
|
2123
2126
|
}
|
|
2124
2127
|
const Is = `.ProseMirror {
|
|
@@ -2304,23 +2307,29 @@ class Ds extends Kn {
|
|
|
2304
2307
|
* @returns The new editor state
|
|
2305
2308
|
*/
|
|
2306
2309
|
registerPlugin(t, n) {
|
|
2307
|
-
const r =
|
|
2310
|
+
const r = Ae(n) ? n(t, [...this.state.plugins]) : [...this.state.plugins, t], s = this.state.reconfigure({ plugins: r });
|
|
2308
2311
|
return this.view.updateState(s), s;
|
|
2309
2312
|
}
|
|
2310
2313
|
/**
|
|
2311
2314
|
* Unregister a ProseMirror plugin.
|
|
2312
2315
|
*
|
|
2313
|
-
* @param
|
|
2316
|
+
* @param nameOrPluginKeyToRemove The plugins name
|
|
2314
2317
|
* @returns The new editor state or undefined if the editor is destroyed
|
|
2315
2318
|
*/
|
|
2316
2319
|
unregisterPlugin(t) {
|
|
2317
2320
|
if (this.isDestroyed)
|
|
2318
2321
|
return;
|
|
2319
|
-
const n =
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
+
const n = this.state.plugins;
|
|
2323
|
+
let r = n;
|
|
2324
|
+
if ([].concat(t).forEach((o) => {
|
|
2325
|
+
const i = typeof o == "string" ? `${o}$` : o.key;
|
|
2326
|
+
r = n.filter((a) => !a.key.startsWith(i));
|
|
2327
|
+
}), n.length === r.length)
|
|
2328
|
+
return;
|
|
2329
|
+
const s = this.state.reconfigure({
|
|
2330
|
+
plugins: r
|
|
2322
2331
|
});
|
|
2323
|
-
return this.view.updateState(
|
|
2332
|
+
return this.view.updateState(s), s;
|
|
2324
2333
|
}
|
|
2325
2334
|
/**
|
|
2326
2335
|
* Creates an extension manager.
|
|
@@ -2334,10 +2343,10 @@ class Ds extends Kn {
|
|
|
2334
2343
|
}),
|
|
2335
2344
|
As,
|
|
2336
2345
|
_s,
|
|
2337
|
-
|
|
2346
|
+
Rs,
|
|
2338
2347
|
Ps,
|
|
2339
2348
|
Os,
|
|
2340
|
-
|
|
2349
|
+
Hs
|
|
2341
2350
|
].filter((o) => typeof this.options.enableCoreExtensions == "object" ? this.options.enableCoreExtensions[o.name] !== !1 : !0) : [], ...this.options.extensions].filter((o) => ["extension", "node", "mark"].includes(o == null ? void 0 : o.type));
|
|
2342
2351
|
this.extensionManager = new Q(s, this);
|
|
2343
2352
|
}
|
|
@@ -2345,7 +2354,7 @@ class Ds extends Kn {
|
|
|
2345
2354
|
* Creates an command manager.
|
|
2346
2355
|
*/
|
|
2347
2356
|
createCommandManager() {
|
|
2348
|
-
this.commandManager = new
|
|
2357
|
+
this.commandManager = new mt({
|
|
2349
2358
|
editor: this
|
|
2350
2359
|
});
|
|
2351
2360
|
}
|
|
@@ -2361,7 +2370,7 @@ class Ds extends Kn {
|
|
|
2361
2370
|
createView() {
|
|
2362
2371
|
let t;
|
|
2363
2372
|
try {
|
|
2364
|
-
t =
|
|
2373
|
+
t = Ht(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
|
|
2365
2374
|
} catch (o) {
|
|
2366
2375
|
if (!(o instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(o.message))
|
|
2367
2376
|
throw o;
|
|
@@ -2369,11 +2378,11 @@ class Ds extends Kn {
|
|
|
2369
2378
|
editor: this,
|
|
2370
2379
|
error: o,
|
|
2371
2380
|
disableCollaboration: () => {
|
|
2372
|
-
this.options.extensions = this.options.extensions.filter((i) => i.name !== "collaboration"), this.createExtensionManager();
|
|
2381
|
+
this.storage.collaboration && (this.storage.collaboration.isDisabled = !0), this.options.extensions = this.options.extensions.filter((i) => i.name !== "collaboration"), this.createExtensionManager();
|
|
2373
2382
|
}
|
|
2374
|
-
}), t =
|
|
2383
|
+
}), t = Ht(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
|
|
2375
2384
|
}
|
|
2376
|
-
const n =
|
|
2385
|
+
const n = _e(t, this.options.autofocus);
|
|
2377
2386
|
this.view = new gn(this.options.element, {
|
|
2378
2387
|
...this.options.editorProps,
|
|
2379
2388
|
dispatchTransaction: this.dispatchTransaction.bind(this),
|
|
@@ -2381,7 +2390,7 @@ class Ds extends Kn {
|
|
|
2381
2390
|
doc: t,
|
|
2382
2391
|
selection: n || void 0
|
|
2383
2392
|
})
|
|
2384
|
-
});
|
|
2393
|
+
}), this.view.dom.setAttribute("role", "textbox"), this.view.dom.getAttribute("aria-label") || this.view.dom.setAttribute("aria-label", "Rich-Text Editor");
|
|
2385
2394
|
const r = this.state.reconfigure({
|
|
2386
2395
|
plugins: this.extensionManager.plugins
|
|
2387
2396
|
});
|
|
@@ -2457,7 +2466,7 @@ class Ds extends Kn {
|
|
|
2457
2466
|
* Get attributes of the currently selected node or mark.
|
|
2458
2467
|
*/
|
|
2459
2468
|
getAttributes(t) {
|
|
2460
|
-
return
|
|
2469
|
+
return Ie(this.state, t);
|
|
2461
2470
|
}
|
|
2462
2471
|
isActive(t, n) {
|
|
2463
2472
|
const r = typeof t == "string" ? t : null, s = typeof t == "string" ? n : t;
|
|
@@ -2485,7 +2494,7 @@ class Ds extends Kn {
|
|
|
2485
2494
|
return es(this.state.doc, {
|
|
2486
2495
|
blockSeparator: n,
|
|
2487
2496
|
textSerializers: {
|
|
2488
|
-
...
|
|
2497
|
+
...Le(this.schema),
|
|
2489
2498
|
...r
|
|
2490
2499
|
}
|
|
2491
2500
|
});
|
|
@@ -2494,7 +2503,7 @@ class Ds extends Kn {
|
|
|
2494
2503
|
* Check if there is no content.
|
|
2495
2504
|
*/
|
|
2496
2505
|
get isEmpty() {
|
|
2497
|
-
return
|
|
2506
|
+
return St(this.state.doc);
|
|
2498
2507
|
}
|
|
2499
2508
|
/**
|
|
2500
2509
|
* Get the number of characters for the current document.
|
|
@@ -2538,7 +2547,7 @@ class Ds extends Kn {
|
|
|
2538
2547
|
}
|
|
2539
2548
|
}
|
|
2540
2549
|
function J(e) {
|
|
2541
|
-
return new
|
|
2550
|
+
return new yt({
|
|
2542
2551
|
find: e.find,
|
|
2543
2552
|
handler: ({ state: t, range: n, match: r }) => {
|
|
2544
2553
|
const s = E(e.getAttributes, void 0, r);
|
|
@@ -2547,7 +2556,7 @@ function J(e) {
|
|
|
2547
2556
|
const { tr: o } = t, i = r[r.length - 1], a = r[0];
|
|
2548
2557
|
if (i) {
|
|
2549
2558
|
const l = a.search(/\S/), c = n.from + a.indexOf(i), u = c + i.length;
|
|
2550
|
-
if (
|
|
2559
|
+
if (Gt(n.from, n.to, t.doc).filter((h) => h.mark.type.excluded.find((m) => m === e.type && m !== h.mark.type)).filter((h) => h.to > c).length)
|
|
2551
2560
|
return null;
|
|
2552
2561
|
u < n.to && o.delete(u, n.to), c > n.from && o.delete(n.from + l, c);
|
|
2553
2562
|
const p = n.from + l + i.length;
|
|
@@ -2556,8 +2565,8 @@ function J(e) {
|
|
|
2556
2565
|
}
|
|
2557
2566
|
});
|
|
2558
2567
|
}
|
|
2559
|
-
function
|
|
2560
|
-
return new
|
|
2568
|
+
function De(e) {
|
|
2569
|
+
return new yt({
|
|
2561
2570
|
find: e.find,
|
|
2562
2571
|
handler: ({ state: t, range: n, match: r }) => {
|
|
2563
2572
|
const s = E(e.getAttributes, void 0, r) || {}, { tr: o } = t, i = n.from;
|
|
@@ -2577,8 +2586,8 @@ function $e(e) {
|
|
|
2577
2586
|
}
|
|
2578
2587
|
});
|
|
2579
2588
|
}
|
|
2580
|
-
function
|
|
2581
|
-
return new
|
|
2589
|
+
function It(e) {
|
|
2590
|
+
return new yt({
|
|
2582
2591
|
find: e.find,
|
|
2583
2592
|
handler: ({ state: t, range: n, match: r }) => {
|
|
2584
2593
|
const s = t.doc.resolve(n.from), o = E(e.getAttributes, void 0, r) || {};
|
|
@@ -2589,7 +2598,7 @@ function $t(e) {
|
|
|
2589
2598
|
});
|
|
2590
2599
|
}
|
|
2591
2600
|
function tt(e) {
|
|
2592
|
-
return new
|
|
2601
|
+
return new yt({
|
|
2593
2602
|
find: e.find,
|
|
2594
2603
|
handler: ({ state: t, range: n, match: r, chain: s }) => {
|
|
2595
2604
|
const o = E(e.getAttributes, void 0, r) || {}, i = t.tr.delete(n.from, n.to), l = i.doc.resolve(n.from).blockRange(), c = l && We(l, e.type, o);
|
|
@@ -2607,7 +2616,7 @@ function tt(e) {
|
|
|
2607
2616
|
s().updateAttributes(d, o).run();
|
|
2608
2617
|
}
|
|
2609
2618
|
const u = i.doc.resolve(n.from - 1).nodeBefore;
|
|
2610
|
-
u && u.type === e.type &&
|
|
2619
|
+
u && u.type === e.type && Bt(i.doc, n.from - 1) && (!e.joinPredicate || e.joinPredicate(r, u)) && i.join(n.from - 1);
|
|
2611
2620
|
}
|
|
2612
2621
|
});
|
|
2613
2622
|
}
|
|
@@ -2632,7 +2641,7 @@ class L {
|
|
|
2632
2641
|
configure(t = {}) {
|
|
2633
2642
|
const n = this.extend({
|
|
2634
2643
|
...this.config,
|
|
2635
|
-
addOptions: () =>
|
|
2644
|
+
addOptions: () => bt(this.options, t)
|
|
2636
2645
|
});
|
|
2637
2646
|
return n.name = this.name, n.parent = this.parent, n;
|
|
2638
2647
|
}
|
|
@@ -2715,7 +2724,7 @@ class Bs {
|
|
|
2715
2724
|
* @return `true` if it can safely be ignored.
|
|
2716
2725
|
*/
|
|
2717
2726
|
ignoreMutation(t) {
|
|
2718
|
-
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" && (
|
|
2727
|
+
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 && [
|
|
2719
2728
|
...Array.from(t.addedNodes),
|
|
2720
2729
|
...Array.from(t.removedNodes)
|
|
2721
2730
|
].every((r) => r.isContentEditable) ? !1 : this.contentDOM === t.target && t.type === "attributes" ? !0 : !this.contentDOM.contains(t.target);
|
|
@@ -2754,7 +2763,7 @@ function z(e) {
|
|
|
2754
2763
|
let c = n.to;
|
|
2755
2764
|
if (a) {
|
|
2756
2765
|
const u = l.search(/\S/), d = n.from + l.indexOf(a), p = d + a.length;
|
|
2757
|
-
if (
|
|
2766
|
+
if (Gt(n.from, n.to, t.doc).filter((f) => f.mark.type.excluded.find((y) => y === e.type && y !== f.mark.type)).filter((f) => f.to > d).length)
|
|
2758
2767
|
return null;
|
|
2759
2768
|
p < n.to && i.delete(p, n.to), d > n.from && i.delete(n.from + u, d), c = n.from + u + a.length, i.addMark(n.from + u, c, e.type.create(o || {})), i.removeStoredMark(e.type);
|
|
2760
2769
|
}
|
|
@@ -2764,7 +2773,7 @@ function z(e) {
|
|
|
2764
2773
|
function js(e) {
|
|
2765
2774
|
return e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
2766
2775
|
}
|
|
2767
|
-
const Fs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, zs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, Vs = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, Ws = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,
|
|
2776
|
+
const Fs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, zs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, Vs = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, Ws = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, Xo = D.create({
|
|
2768
2777
|
name: "bold",
|
|
2769
2778
|
addOptions() {
|
|
2770
2779
|
return {
|
|
@@ -2780,6 +2789,10 @@ const Fs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, zs = /(?:^|\s
|
|
|
2780
2789
|
tag: "b",
|
|
2781
2790
|
getAttrs: (e) => e.style.fontWeight !== "normal" && null
|
|
2782
2791
|
},
|
|
2792
|
+
{
|
|
2793
|
+
style: "font-weight=400",
|
|
2794
|
+
clearMark: (e) => e.type.name === this.name
|
|
2795
|
+
},
|
|
2783
2796
|
{
|
|
2784
2797
|
style: "font-weight",
|
|
2785
2798
|
getAttrs: (e) => /^(bold(er)?|[5-9]\d{2,})$/.test(e) && null
|
|
@@ -2830,7 +2843,7 @@ const Fs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, zs = /(?:^|\s
|
|
|
2830
2843
|
class Ks {
|
|
2831
2844
|
constructor({ editor: t, element: n, view: r, tippyOptions: s = {}, updateDelay: o = 250, shouldShow: i }) {
|
|
2832
2845
|
this.preventHide = !1, this.shouldShow = ({ view: a, state: l, from: c, to: u }) => {
|
|
2833
|
-
const { doc: d, selection: p } = l, { empty: h } = p, f = !d.textBetween(c, u).length &&
|
|
2846
|
+
const { doc: d, selection: p } = l, { empty: h } = p, f = !d.textBetween(c, u).length && Kt(l.selection), m = this.element.contains(document.activeElement);
|
|
2834
2847
|
return !(!(a.hasFocus() || m) || h || f || !this.editor.isEditable);
|
|
2835
2848
|
}, this.mousedownHandler = () => {
|
|
2836
2849
|
this.preventHide = !0;
|
|
@@ -2872,7 +2885,7 @@ class Ks {
|
|
|
2872
2885
|
}
|
|
2873
2886
|
(p = this.tippy) === null || p === void 0 || p.setProps({
|
|
2874
2887
|
getReferenceClientRect: ((h = this.tippyOptions) === null || h === void 0 ? void 0 : h.getReferenceClientRect) || (() => {
|
|
2875
|
-
if (
|
|
2888
|
+
if ($e(f.selection)) {
|
|
2876
2889
|
let S = a.nodeDOM(b);
|
|
2877
2890
|
const C = S.dataset.nodeViewWrapper ? S : S.querySelector("[data-node-view-wrapper]");
|
|
2878
2891
|
if (C && (S = C.firstChild), S)
|
|
@@ -2918,7 +2931,7 @@ class Ks {
|
|
|
2918
2931
|
!((t = this.tippy) === null || t === void 0) && t.popper.firstChild && this.tippy.popper.firstChild.removeEventListener("blur", this.tippyBlurHandler), (n = this.tippy) === null || n === void 0 || n.destroy(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler);
|
|
2919
2932
|
}
|
|
2920
2933
|
}
|
|
2921
|
-
const
|
|
2934
|
+
const Ne = (e) => new P({
|
|
2922
2935
|
key: typeof e.pluginKey == "string" ? new I(e.pluginKey) : e.pluginKey,
|
|
2923
2936
|
view: (t) => new Ks({ view: t, ...e })
|
|
2924
2937
|
});
|
|
@@ -2935,7 +2948,7 @@ _.create({
|
|
|
2935
2948
|
},
|
|
2936
2949
|
addProseMirrorPlugins() {
|
|
2937
2950
|
return this.options.element ? [
|
|
2938
|
-
|
|
2951
|
+
Ne({
|
|
2939
2952
|
pluginKey: this.options.pluginKey,
|
|
2940
2953
|
editor: this.editor,
|
|
2941
2954
|
element: this.options.element,
|
|
@@ -2949,7 +2962,7 @@ _.create({
|
|
|
2949
2962
|
function Us(e) {
|
|
2950
2963
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
2951
2964
|
}
|
|
2952
|
-
var
|
|
2965
|
+
var $t = { exports: {} }, At = {};
|
|
2953
2966
|
/**
|
|
2954
2967
|
* @license React
|
|
2955
2968
|
* use-sync-external-store-shim.production.min.js
|
|
@@ -2959,10 +2972,10 @@ var Dt = { exports: {} }, Ot = {};
|
|
|
2959
2972
|
* This source code is licensed under the MIT license found in the
|
|
2960
2973
|
* LICENSE file in the root directory of this source tree.
|
|
2961
2974
|
*/
|
|
2962
|
-
var
|
|
2975
|
+
var le;
|
|
2963
2976
|
function qs() {
|
|
2964
|
-
if (
|
|
2965
|
-
|
|
2977
|
+
if (le) return At;
|
|
2978
|
+
le = 1;
|
|
2966
2979
|
var e = O;
|
|
2967
2980
|
function t(d, p) {
|
|
2968
2981
|
return d === p && (d !== 0 || 1 / d === 1 / p) || d !== d && p !== p;
|
|
@@ -2992,9 +3005,9 @@ function qs() {
|
|
|
2992
3005
|
return p();
|
|
2993
3006
|
}
|
|
2994
3007
|
var u = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? c : a;
|
|
2995
|
-
return
|
|
3008
|
+
return At.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : u, At;
|
|
2996
3009
|
}
|
|
2997
|
-
var
|
|
3010
|
+
var Ot = {};
|
|
2998
3011
|
/**
|
|
2999
3012
|
* @license React
|
|
3000
3013
|
* use-sync-external-store-shim.development.js
|
|
@@ -3004,9 +3017,9 @@ var Lt = {};
|
|
|
3004
3017
|
* This source code is licensed under the MIT license found in the
|
|
3005
3018
|
* LICENSE file in the root directory of this source tree.
|
|
3006
3019
|
*/
|
|
3007
|
-
var
|
|
3020
|
+
var ce;
|
|
3008
3021
|
function Gs() {
|
|
3009
|
-
return
|
|
3022
|
+
return ce || (ce = 1, process.env.NODE_ENV !== "production" && function() {
|
|
3010
3023
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
3011
3024
|
var e = O, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
3012
3025
|
function n(b) {
|
|
@@ -3042,17 +3055,17 @@ function Gs() {
|
|
|
3042
3055
|
value: S,
|
|
3043
3056
|
getSnapshot: M
|
|
3044
3057
|
}
|
|
3045
|
-
}), T = A[0].inst,
|
|
3058
|
+
}), T = A[0].inst, R = A[1];
|
|
3046
3059
|
return l(function() {
|
|
3047
|
-
T.value = S, T.getSnapshot = M, h(T) &&
|
|
3060
|
+
T.value = S, T.getSnapshot = M, h(T) && R({
|
|
3048
3061
|
inst: T
|
|
3049
3062
|
});
|
|
3050
3063
|
}, [b, S, M]), a(function() {
|
|
3051
|
-
h(T) &&
|
|
3064
|
+
h(T) && R({
|
|
3052
3065
|
inst: T
|
|
3053
3066
|
});
|
|
3054
3067
|
var N = function() {
|
|
3055
|
-
h(T) &&
|
|
3068
|
+
h(T) && R({
|
|
3056
3069
|
inst: T
|
|
3057
3070
|
});
|
|
3058
3071
|
};
|
|
@@ -3072,17 +3085,17 @@ function Gs() {
|
|
|
3072
3085
|
return M();
|
|
3073
3086
|
}
|
|
3074
3087
|
var m = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", y = !m, g = y ? f : p, k = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : g;
|
|
3075
|
-
|
|
3076
|
-
}()),
|
|
3088
|
+
Ot.useSyncExternalStore = k, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
3089
|
+
}()), Ot;
|
|
3077
3090
|
}
|
|
3078
|
-
process.env.NODE_ENV === "production" ?
|
|
3079
|
-
var
|
|
3091
|
+
process.env.NODE_ENV === "production" ? $t.exports = qs() : $t.exports = Gs();
|
|
3092
|
+
var kt = $t.exports;
|
|
3080
3093
|
const Js = (...e) => (t) => {
|
|
3081
3094
|
e.forEach((n) => {
|
|
3082
3095
|
typeof n == "function" ? n(t) : n && (n.current = t);
|
|
3083
3096
|
});
|
|
3084
3097
|
}, Ys = ({ contentComponent: e }) => {
|
|
3085
|
-
const t =
|
|
3098
|
+
const t = kt.useSyncExternalStore(e.subscribe, e.getSnapshot, e.getServerSnapshot);
|
|
3086
3099
|
return O.createElement(O.Fragment, null, Object.values(t));
|
|
3087
3100
|
};
|
|
3088
3101
|
function Xs() {
|
|
@@ -3177,7 +3190,7 @@ const Zs = Fn((e, t) => {
|
|
|
3177
3190
|
innerRef: t,
|
|
3178
3191
|
...e
|
|
3179
3192
|
});
|
|
3180
|
-
}),
|
|
3193
|
+
}), Qo = O.memo(Zs);
|
|
3181
3194
|
var to = function e(t, n) {
|
|
3182
3195
|
if (t === n) return !0;
|
|
3183
3196
|
if (t && n && typeof t == "object" && typeof n == "object") {
|
|
@@ -3223,7 +3236,7 @@ var to = function e(t, n) {
|
|
|
3223
3236
|
return !0;
|
|
3224
3237
|
}
|
|
3225
3238
|
return t !== t && n !== n;
|
|
3226
|
-
}, eo = /* @__PURE__ */ Us(to),
|
|
3239
|
+
}, eo = /* @__PURE__ */ Us(to), Dt = { exports: {} }, Lt = {};
|
|
3227
3240
|
/**
|
|
3228
3241
|
* @license React
|
|
3229
3242
|
* use-sync-external-store-shim/with-selector.production.min.js
|
|
@@ -3233,16 +3246,16 @@ var to = function e(t, n) {
|
|
|
3233
3246
|
* This source code is licensed under the MIT license found in the
|
|
3234
3247
|
* LICENSE file in the root directory of this source tree.
|
|
3235
3248
|
*/
|
|
3236
|
-
var
|
|
3249
|
+
var de;
|
|
3237
3250
|
function no() {
|
|
3238
|
-
if (
|
|
3239
|
-
|
|
3240
|
-
var e = O, t =
|
|
3251
|
+
if (de) return Lt;
|
|
3252
|
+
de = 1;
|
|
3253
|
+
var e = O, t = kt;
|
|
3241
3254
|
function n(c, u) {
|
|
3242
3255
|
return c === u && (c !== 0 || 1 / c === 1 / u) || c !== c && u !== u;
|
|
3243
3256
|
}
|
|
3244
3257
|
var r = typeof Object.is == "function" ? Object.is : n, s = t.useSyncExternalStore, o = e.useRef, i = e.useEffect, a = e.useMemo, l = e.useDebugValue;
|
|
3245
|
-
return
|
|
3258
|
+
return Lt.useSyncExternalStoreWithSelector = function(c, u, d, p, h) {
|
|
3246
3259
|
var f = o(null);
|
|
3247
3260
|
if (f.current === null) {
|
|
3248
3261
|
var m = { hasValue: !1, value: null };
|
|
@@ -3272,9 +3285,9 @@ function no() {
|
|
|
3272
3285
|
return i(function() {
|
|
3273
3286
|
m.hasValue = !0, m.value = y;
|
|
3274
3287
|
}, [y]), l(y), y;
|
|
3275
|
-
},
|
|
3288
|
+
}, Lt;
|
|
3276
3289
|
}
|
|
3277
|
-
var
|
|
3290
|
+
var _t = {};
|
|
3278
3291
|
/**
|
|
3279
3292
|
* @license React
|
|
3280
3293
|
* use-sync-external-store-shim/with-selector.development.js
|
|
@@ -3284,11 +3297,11 @@ var Ht = {};
|
|
|
3284
3297
|
* This source code is licensed under the MIT license found in the
|
|
3285
3298
|
* LICENSE file in the root directory of this source tree.
|
|
3286
3299
|
*/
|
|
3287
|
-
var
|
|
3300
|
+
var ue;
|
|
3288
3301
|
function ro() {
|
|
3289
|
-
return
|
|
3302
|
+
return ue || (ue = 1, process.env.NODE_ENV !== "production" && function() {
|
|
3290
3303
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
3291
|
-
var e = O, t =
|
|
3304
|
+
var e = O, t = kt;
|
|
3292
3305
|
function n(u, d) {
|
|
3293
3306
|
return u === d && (u !== 0 || 1 / u === 1 / d) || u !== u && d !== d;
|
|
3294
3307
|
}
|
|
@@ -3316,22 +3329,22 @@ function ro() {
|
|
|
3316
3329
|
return F;
|
|
3317
3330
|
var U = h(j);
|
|
3318
3331
|
return f !== void 0 && f(F, U) ? F : (S = j, C = U, U);
|
|
3319
|
-
}, T = p === void 0 ? null : p,
|
|
3332
|
+
}, T = p === void 0 ? null : p, R = function() {
|
|
3320
3333
|
return A(d());
|
|
3321
3334
|
}, N = T === null ? void 0 : function() {
|
|
3322
3335
|
return A(T());
|
|
3323
3336
|
};
|
|
3324
|
-
return [
|
|
3337
|
+
return [R, N];
|
|
3325
3338
|
}, [d, p, h, f]), k = g[0], b = g[1], M = s(u, k, b);
|
|
3326
3339
|
return i(function() {
|
|
3327
3340
|
y.hasValue = !0, y.value = M;
|
|
3328
3341
|
}, [M]), l(M), M;
|
|
3329
3342
|
}
|
|
3330
|
-
|
|
3331
|
-
}()),
|
|
3343
|
+
_t.useSyncExternalStoreWithSelector = c, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
3344
|
+
}()), _t;
|
|
3332
3345
|
}
|
|
3333
|
-
process.env.NODE_ENV === "production" ?
|
|
3334
|
-
var so =
|
|
3346
|
+
process.env.NODE_ENV === "production" ? Dt.exports = no() : Dt.exports = ro();
|
|
3347
|
+
var so = Dt.exports;
|
|
3335
3348
|
class oo {
|
|
3336
3349
|
constructor(t) {
|
|
3337
3350
|
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);
|
|
@@ -3372,10 +3385,10 @@ class oo {
|
|
|
3372
3385
|
}
|
|
3373
3386
|
function io(e) {
|
|
3374
3387
|
var t;
|
|
3375
|
-
const [n] =
|
|
3376
|
-
return
|
|
3388
|
+
const [n] = Ft(() => new oo(e.editor)), r = so.useSyncExternalStoreWithSelector(n.subscribe, n.getSnapshot, n.getServerSnapshot, e.selector, (t = e.equalityFn) !== null && t !== void 0 ? t : eo);
|
|
3389
|
+
return zt(() => n.watch(e.editor), [e.editor, n]), Ee(r), r;
|
|
3377
3390
|
}
|
|
3378
|
-
const
|
|
3391
|
+
const pe = process.env.NODE_ENV !== "production", Nt = typeof window > "u", ao = Nt || !!(typeof window < "u" && window.next);
|
|
3379
3392
|
class lo {
|
|
3380
3393
|
constructor(t) {
|
|
3381
3394
|
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);
|
|
@@ -3385,8 +3398,8 @@ class lo {
|
|
|
3385
3398
|
}
|
|
3386
3399
|
getInitialEditor() {
|
|
3387
3400
|
if (this.options.current.immediatelyRender === void 0)
|
|
3388
|
-
return
|
|
3389
|
-
if (this.options.current.immediatelyRender &&
|
|
3401
|
+
return Nt || ao ? (pe && console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."), null) : this.createEditor();
|
|
3402
|
+
if (this.options.current.immediatelyRender && Nt && pe)
|
|
3390
3403
|
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.");
|
|
3391
3404
|
return this.options.current.immediatelyRender ? this.createEditor() : null;
|
|
3392
3405
|
}
|
|
@@ -3470,7 +3483,10 @@ class lo {
|
|
|
3470
3483
|
* @returns A cleanup function
|
|
3471
3484
|
*/
|
|
3472
3485
|
onRender(t) {
|
|
3473
|
-
return () => (this.isComponentMounted = !0, clearTimeout(this.scheduledDestructionTimeout), this.editor && !this.editor.isDestroyed && t.length === 0 ? this.editor.setOptions(
|
|
3486
|
+
return () => (this.isComponentMounted = !0, clearTimeout(this.scheduledDestructionTimeout), this.editor && !this.editor.isDestroyed && t.length === 0 ? this.editor.setOptions({
|
|
3487
|
+
...this.options.current,
|
|
3488
|
+
editable: this.editor.isEditable
|
|
3489
|
+
}) : this.refreshEditorInstance(t), () => {
|
|
3474
3490
|
this.isComponentMounted = !1, this.scheduleDestroy();
|
|
3475
3491
|
});
|
|
3476
3492
|
}
|
|
@@ -3504,22 +3520,22 @@ class lo {
|
|
|
3504
3520
|
}, 1);
|
|
3505
3521
|
}
|
|
3506
3522
|
}
|
|
3507
|
-
function
|
|
3523
|
+
function Zo(e = {}, t = []) {
|
|
3508
3524
|
const n = zn(e);
|
|
3509
3525
|
n.current = e;
|
|
3510
|
-
const [r] =
|
|
3511
|
-
return
|
|
3526
|
+
const [r] = Ft(() => new lo(n)), s = kt.useSyncExternalStore(r.subscribe, r.getEditor, r.getServerSnapshot);
|
|
3527
|
+
return Ee(s), zt(r.onRender(t)), io({
|
|
3512
3528
|
editor: s,
|
|
3513
3529
|
selector: ({ transactionNumber: o }) => e.shouldRerenderOnTransaction === !1 ? null : e.immediatelyRender && o === 0 ? 0 : o + 1
|
|
3514
3530
|
}), s;
|
|
3515
3531
|
}
|
|
3516
|
-
const
|
|
3532
|
+
const Be = Te({
|
|
3517
3533
|
editor: null
|
|
3518
3534
|
});
|
|
3519
|
-
|
|
3520
|
-
const co = () =>
|
|
3521
|
-
const [t, n] =
|
|
3522
|
-
return
|
|
3535
|
+
Be.Consumer;
|
|
3536
|
+
const co = () => Ce(Be), ti = (e) => {
|
|
3537
|
+
const [t, n] = Ft(null), { editor: r } = co();
|
|
3538
|
+
return zt(() => {
|
|
3523
3539
|
var s;
|
|
3524
3540
|
if (!t || !((s = e.editor) === null || s === void 0) && s.isDestroyed || r != null && r.isDestroyed)
|
|
3525
3541
|
return;
|
|
@@ -3528,7 +3544,7 @@ const co = () => Te(Ne), Qo = (e) => {
|
|
|
3528
3544
|
console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
|
|
3529
3545
|
return;
|
|
3530
3546
|
}
|
|
3531
|
-
const d =
|
|
3547
|
+
const d = Ne({
|
|
3532
3548
|
updateDelay: l,
|
|
3533
3549
|
editor: u,
|
|
3534
3550
|
element: t,
|
|
@@ -3540,10 +3556,10 @@ const co = () => Te(Ne), Qo = (e) => {
|
|
|
3540
3556
|
u.unregisterPlugin(o);
|
|
3541
3557
|
};
|
|
3542
3558
|
}, [e.editor, r, t]), O.createElement("div", { ref: n, className: e.className, style: { visibility: "hidden" } }, e.children);
|
|
3543
|
-
},
|
|
3559
|
+
}, je = Te({
|
|
3544
3560
|
onDragStart: void 0
|
|
3545
|
-
}),
|
|
3546
|
-
const t = e.as || "div", { nodeViewContentRef: n } =
|
|
3561
|
+
}), Fe = () => Ce(je), ei = (e) => {
|
|
3562
|
+
const t = e.as || "div", { nodeViewContentRef: n } = Fe();
|
|
3547
3563
|
return (
|
|
3548
3564
|
// @ts-ignore
|
|
3549
3565
|
O.createElement(t, { ...e, ref: n, "data-node-view-content": "", style: {
|
|
@@ -3551,8 +3567,8 @@ const co = () => Te(Ne), Qo = (e) => {
|
|
|
3551
3567
|
...e.style
|
|
3552
3568
|
} })
|
|
3553
3569
|
);
|
|
3554
|
-
},
|
|
3555
|
-
const { onDragStart: n } =
|
|
3570
|
+
}, ni = O.forwardRef((e, t) => {
|
|
3571
|
+
const { onDragStart: n } = Fe(), r = e.as || "div";
|
|
3556
3572
|
return (
|
|
3557
3573
|
// @ts-ignore
|
|
3558
3574
|
O.createElement(r, { ...e, ref: t, "data-node-view-wrapper": "", onDragStart: n, style: {
|
|
@@ -3638,7 +3654,7 @@ class fo extends Bs {
|
|
|
3638
3654
|
}
|
|
3639
3655
|
const s = { onDragStart: this.onDragStart.bind(this), nodeViewContentRef: (c) => {
|
|
3640
3656
|
c && this.contentDOMElement && c.firstChild !== this.contentDOMElement && c.appendChild(this.contentDOMElement);
|
|
3641
|
-
} }, o = this.component, i = O.memo((c) => O.createElement(
|
|
3657
|
+
} }, o = this.component, i = O.memo((c) => O.createElement(je.Provider, { value: s }, O.createElement(o, c)));
|
|
3642
3658
|
i.displayName = "ReactNodeView", this.node.isLeaf ? this.contentDOMElement = null : this.options.contentDOMElementTag ? this.contentDOMElement = document.createElement(this.options.contentDOMElementTag) : this.contentDOMElement = document.createElement(this.node.isInline ? "span" : "div"), this.contentDOMElement && (this.contentDOMElement.dataset.nodeViewContentReact = "", this.contentDOMElement.style.whiteSpace = "inherit");
|
|
3643
3659
|
let a = this.node.isInline ? "span" : "div";
|
|
3644
3660
|
this.options.as && (a = this.options.as);
|
|
@@ -3748,10 +3764,10 @@ class fo extends Bs {
|
|
|
3748
3764
|
}
|
|
3749
3765
|
}
|
|
3750
3766
|
}
|
|
3751
|
-
function
|
|
3767
|
+
function ri(e, t) {
|
|
3752
3768
|
return (n) => n.editor.contentComponent ? new fo(e, n, t) : {};
|
|
3753
3769
|
}
|
|
3754
|
-
const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, yo = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, bo = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,
|
|
3770
|
+
const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, yo = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, bo = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, si = D.create({
|
|
3755
3771
|
name: "italic",
|
|
3756
3772
|
addOptions() {
|
|
3757
3773
|
return {
|
|
@@ -3767,6 +3783,10 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
3767
3783
|
tag: "i",
|
|
3768
3784
|
getAttrs: (e) => e.style.fontStyle !== "normal" && null
|
|
3769
3785
|
},
|
|
3786
|
+
{
|
|
3787
|
+
style: "font-style=normal",
|
|
3788
|
+
clearMark: (e) => e.type.name === this.name
|
|
3789
|
+
},
|
|
3770
3790
|
{
|
|
3771
3791
|
style: "font-style=italic"
|
|
3772
3792
|
}
|
|
@@ -3812,7 +3832,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
3812
3832
|
})
|
|
3813
3833
|
];
|
|
3814
3834
|
}
|
|
3815
|
-
}),
|
|
3835
|
+
}), oi = D.create({
|
|
3816
3836
|
name: "underline",
|
|
3817
3837
|
addOptions() {
|
|
3818
3838
|
return {
|
|
@@ -3847,7 +3867,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
3847
3867
|
"Mod-U": () => this.editor.commands.toggleUnderline()
|
|
3848
3868
|
};
|
|
3849
3869
|
}
|
|
3850
|
-
}), vo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, Mo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,
|
|
3870
|
+
}), vo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, Mo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, ii = D.create({
|
|
3851
3871
|
name: "strike",
|
|
3852
3872
|
addOptions() {
|
|
3853
3873
|
return {
|
|
@@ -3903,7 +3923,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
3903
3923
|
})
|
|
3904
3924
|
];
|
|
3905
3925
|
}
|
|
3906
|
-
}), So = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/, ko = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g,
|
|
3926
|
+
}), So = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/, ko = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g, ai = D.create({
|
|
3907
3927
|
name: "code",
|
|
3908
3928
|
addOptions() {
|
|
3909
3929
|
return {
|
|
@@ -3949,7 +3969,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
3949
3969
|
})
|
|
3950
3970
|
];
|
|
3951
3971
|
}
|
|
3952
|
-
}), wo = /^```([a-z]+)?[\s\n]$/, Eo = /^~~~([a-z]+)?[\s\n]$/,
|
|
3972
|
+
}), wo = /^```([a-z]+)?[\s\n]$/, Eo = /^~~~([a-z]+)?[\s\n]$/, li = L.create({
|
|
3953
3973
|
name: "codeBlock",
|
|
3954
3974
|
addOptions() {
|
|
3955
3975
|
return {
|
|
@@ -4039,14 +4059,14 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4039
4059
|
},
|
|
4040
4060
|
addInputRules() {
|
|
4041
4061
|
return [
|
|
4042
|
-
|
|
4062
|
+
It({
|
|
4043
4063
|
find: wo,
|
|
4044
4064
|
type: this.type,
|
|
4045
4065
|
getAttributes: (e) => ({
|
|
4046
4066
|
language: e[1]
|
|
4047
4067
|
})
|
|
4048
4068
|
}),
|
|
4049
|
-
|
|
4069
|
+
It({
|
|
4050
4070
|
find: Eo,
|
|
4051
4071
|
type: this.type,
|
|
4052
4072
|
getAttributes: (e) => ({
|
|
@@ -4076,7 +4096,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4076
4096
|
})
|
|
4077
4097
|
];
|
|
4078
4098
|
}
|
|
4079
|
-
}),
|
|
4099
|
+
}), ci = D.create({
|
|
4080
4100
|
name: "textStyle",
|
|
4081
4101
|
priority: 101,
|
|
4082
4102
|
addOptions() {
|
|
@@ -4098,12 +4118,12 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4098
4118
|
addCommands() {
|
|
4099
4119
|
return {
|
|
4100
4120
|
removeEmptyTextStyle: () => ({ state: e, commands: t }) => {
|
|
4101
|
-
const n =
|
|
4121
|
+
const n = Ut(e, this.type);
|
|
4102
4122
|
return Object.entries(n).some(([, s]) => !!s) ? !0 : t.unsetMark(this.name);
|
|
4103
4123
|
}
|
|
4104
4124
|
};
|
|
4105
4125
|
}
|
|
4106
|
-
}),
|
|
4126
|
+
}), di = _.create({
|
|
4107
4127
|
name: "fontFamily",
|
|
4108
4128
|
addOptions() {
|
|
4109
4129
|
return {
|
|
@@ -4135,7 +4155,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4135
4155
|
unsetFontFamily: () => ({ chain: e }) => e().setMark("textStyle", { fontFamily: null }).removeEmptyTextStyle().run()
|
|
4136
4156
|
};
|
|
4137
4157
|
}
|
|
4138
|
-
}),
|
|
4158
|
+
}), ui = L.create({
|
|
4139
4159
|
name: "heading",
|
|
4140
4160
|
addOptions() {
|
|
4141
4161
|
return {
|
|
@@ -4176,7 +4196,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4176
4196
|
}), {});
|
|
4177
4197
|
},
|
|
4178
4198
|
addInputRules() {
|
|
4179
|
-
return this.options.levels.map((e) =>
|
|
4199
|
+
return this.options.levels.map((e) => It({
|
|
4180
4200
|
find: new RegExp(`^(#{1,${e}})\\s$`),
|
|
4181
4201
|
type: this.type,
|
|
4182
4202
|
getAttributes: {
|
|
@@ -4184,7 +4204,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4184
4204
|
}
|
|
4185
4205
|
}));
|
|
4186
4206
|
}
|
|
4187
|
-
}),
|
|
4207
|
+
}), pi = _.create({
|
|
4188
4208
|
name: "textAlign",
|
|
4189
4209
|
addOptions() {
|
|
4190
4210
|
return {
|
|
@@ -4224,7 +4244,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4224
4244
|
"Mod-Shift-j": () => this.editor.commands.setTextAlign("justify")
|
|
4225
4245
|
};
|
|
4226
4246
|
}
|
|
4227
|
-
}),
|
|
4247
|
+
}), hi = _.create({
|
|
4228
4248
|
name: "color",
|
|
4229
4249
|
addOptions() {
|
|
4230
4250
|
return {
|
|
@@ -4256,7 +4276,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4256
4276
|
unsetColor: () => ({ chain: e }) => e().setMark("textStyle", { color: null }).removeEmptyTextStyle().run()
|
|
4257
4277
|
};
|
|
4258
4278
|
}
|
|
4259
|
-
}), To = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, Co = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,
|
|
4279
|
+
}), To = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, Co = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, fi = D.create({
|
|
4260
4280
|
name: "highlight",
|
|
4261
4281
|
addOptions() {
|
|
4262
4282
|
return {
|
|
@@ -4314,35 +4334,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4314
4334
|
})
|
|
4315
4335
|
];
|
|
4316
4336
|
}
|
|
4317
|
-
}),
|
|
4318
|
-
name: "listItem",
|
|
4319
|
-
addOptions() {
|
|
4320
|
-
return {
|
|
4321
|
-
HTMLAttributes: {},
|
|
4322
|
-
bulletListTypeName: "bulletList",
|
|
4323
|
-
orderedListTypeName: "orderedList"
|
|
4324
|
-
};
|
|
4325
|
-
},
|
|
4326
|
-
content: "paragraph block*",
|
|
4327
|
-
defining: !0,
|
|
4328
|
-
parseHTML() {
|
|
4329
|
-
return [
|
|
4330
|
-
{
|
|
4331
|
-
tag: "li"
|
|
4332
|
-
}
|
|
4333
|
-
];
|
|
4334
|
-
},
|
|
4335
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
4336
|
-
return ["li", x(this.options.HTMLAttributes, e), 0];
|
|
4337
|
-
},
|
|
4338
|
-
addKeyboardShortcuts() {
|
|
4339
|
-
return {
|
|
4340
|
-
Enter: () => this.editor.commands.splitListItem(this.name),
|
|
4341
|
-
Tab: () => this.editor.commands.sinkListItem(this.name),
|
|
4342
|
-
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
4343
|
-
};
|
|
4344
|
-
}
|
|
4345
|
-
}), fe = /^\s*([-+*])\s$/, pi = L.create({
|
|
4337
|
+
}), xo = "listItem", he = "textStyle", fe = /^\s*([-+*])\s$/, mi = L.create({
|
|
4346
4338
|
name: "bulletList",
|
|
4347
4339
|
addOptions() {
|
|
4348
4340
|
return {
|
|
@@ -4366,7 +4358,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4366
4358
|
},
|
|
4367
4359
|
addCommands() {
|
|
4368
4360
|
return {
|
|
4369
|
-
toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
4361
|
+
toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(xo, this.editor.getAttributes(he)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
4370
4362
|
};
|
|
4371
4363
|
},
|
|
4372
4364
|
addKeyboardShortcuts() {
|
|
@@ -4384,13 +4376,13 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4384
4376
|
type: this.type,
|
|
4385
4377
|
keepMarks: this.options.keepMarks,
|
|
4386
4378
|
keepAttributes: this.options.keepAttributes,
|
|
4387
|
-
getAttributes: () => this.editor.getAttributes(
|
|
4379
|
+
getAttributes: () => this.editor.getAttributes(he),
|
|
4388
4380
|
editor: this.editor
|
|
4389
4381
|
})), [
|
|
4390
4382
|
e
|
|
4391
4383
|
];
|
|
4392
4384
|
}
|
|
4393
|
-
}), me = /^(\d+)\.\s$/,
|
|
4385
|
+
}), Ao = "listItem", me = "textStyle", ge = /^(\d+)\.\s$/, gi = L.create({
|
|
4394
4386
|
name: "orderedList",
|
|
4395
4387
|
addOptions() {
|
|
4396
4388
|
return {
|
|
@@ -4429,7 +4421,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4429
4421
|
},
|
|
4430
4422
|
addCommands() {
|
|
4431
4423
|
return {
|
|
4432
|
-
toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
4424
|
+
toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Ao, this.editor.getAttributes(me)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
4433
4425
|
};
|
|
4434
4426
|
},
|
|
4435
4427
|
addKeyboardShortcuts() {
|
|
@@ -4439,24 +4431,24 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4439
4431
|
},
|
|
4440
4432
|
addInputRules() {
|
|
4441
4433
|
let e = tt({
|
|
4442
|
-
find:
|
|
4434
|
+
find: ge,
|
|
4443
4435
|
type: this.type,
|
|
4444
4436
|
getAttributes: (t) => ({ start: +t[1] }),
|
|
4445
4437
|
joinPredicate: (t, n) => n.childCount + n.attrs.start === +t[1]
|
|
4446
4438
|
});
|
|
4447
4439
|
return (this.options.keepMarks || this.options.keepAttributes) && (e = tt({
|
|
4448
|
-
find:
|
|
4440
|
+
find: ge,
|
|
4449
4441
|
type: this.type,
|
|
4450
4442
|
keepMarks: this.options.keepMarks,
|
|
4451
4443
|
keepAttributes: this.options.keepAttributes,
|
|
4452
|
-
getAttributes: (t) => ({ start: +t[1], ...this.editor.getAttributes(
|
|
4444
|
+
getAttributes: (t) => ({ start: +t[1], ...this.editor.getAttributes(me) }),
|
|
4453
4445
|
joinPredicate: (t, n) => n.childCount + n.attrs.start === +t[1],
|
|
4454
4446
|
editor: this.editor
|
|
4455
4447
|
})), [
|
|
4456
4448
|
e
|
|
4457
4449
|
];
|
|
4458
4450
|
}
|
|
4459
|
-
}),
|
|
4451
|
+
}), Oo = /^\s*(\[([( |x])?\])\s$/, yi = L.create({
|
|
4460
4452
|
name: "taskItem",
|
|
4461
4453
|
addOptions() {
|
|
4462
4454
|
return {
|
|
@@ -4555,7 +4547,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4555
4547
|
addInputRules() {
|
|
4556
4548
|
return [
|
|
4557
4549
|
tt({
|
|
4558
|
-
find:
|
|
4550
|
+
find: Oo,
|
|
4559
4551
|
type: this.type,
|
|
4560
4552
|
getAttributes: (e) => ({
|
|
4561
4553
|
checked: e[e.length - 1] === "x"
|
|
@@ -4563,7 +4555,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4563
4555
|
})
|
|
4564
4556
|
];
|
|
4565
4557
|
}
|
|
4566
|
-
}),
|
|
4558
|
+
}), bi = L.create({
|
|
4567
4559
|
name: "taskList",
|
|
4568
4560
|
addOptions() {
|
|
4569
4561
|
return {
|
|
@@ -4596,7 +4588,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4596
4588
|
"Mod-Shift-9": () => this.editor.commands.toggleTaskList()
|
|
4597
4589
|
};
|
|
4598
4590
|
}
|
|
4599
|
-
}),
|
|
4591
|
+
}), Lo = /^\s*>\s$/, vi = L.create({
|
|
4600
4592
|
name: "blockquote",
|
|
4601
4593
|
addOptions() {
|
|
4602
4594
|
return {
|
|
@@ -4629,16 +4621,16 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4629
4621
|
addInputRules() {
|
|
4630
4622
|
return [
|
|
4631
4623
|
tt({
|
|
4632
|
-
find:
|
|
4624
|
+
find: Lo,
|
|
4633
4625
|
type: this.type
|
|
4634
4626
|
})
|
|
4635
4627
|
];
|
|
4636
4628
|
}
|
|
4637
4629
|
});
|
|
4638
|
-
function
|
|
4630
|
+
function _o(e) {
|
|
4639
4631
|
return e.length === 1 ? e[0].isLink : e.length === 3 && e[1].isLink ? ["()", "[]"].includes(e[0].value + e[2].value) : !1;
|
|
4640
4632
|
}
|
|
4641
|
-
function
|
|
4633
|
+
function Ro(e) {
|
|
4642
4634
|
return new P({
|
|
4643
4635
|
key: new I("autolink"),
|
|
4644
4636
|
appendTransaction: (t, n, r) => {
|
|
@@ -4657,14 +4649,14 @@ function Lo(e) {
|
|
|
4657
4649
|
if (!f)
|
|
4658
4650
|
return !1;
|
|
4659
4651
|
const y = kn(f).map((g) => g.toObject(e.defaultProtocol));
|
|
4660
|
-
if (!
|
|
4652
|
+
if (!_o(y))
|
|
4661
4653
|
return !1;
|
|
4662
4654
|
y.filter((g) => g.isLink).map((g) => ({
|
|
4663
4655
|
...g,
|
|
4664
4656
|
from: m + g.start + 1,
|
|
4665
4657
|
to: m + g.end + 1
|
|
4666
4658
|
})).filter((g) => r.schema.marks.code ? !r.doc.rangeHasMark(g.from, g.to, r.schema.marks.code) : !0).filter((g) => e.validate(g.value)).forEach((g) => {
|
|
4667
|
-
|
|
4659
|
+
Gt(g.from, g.to, r.doc).some((k) => k.mark.type === e.type) || i.addMark(g.from, g.to, e.type.create({
|
|
4668
4660
|
href: g.href
|
|
4669
4661
|
}));
|
|
4670
4662
|
});
|
|
@@ -4674,7 +4666,7 @@ function Lo(e) {
|
|
|
4674
4666
|
}
|
|
4675
4667
|
});
|
|
4676
4668
|
}
|
|
4677
|
-
function
|
|
4669
|
+
function Ho(e) {
|
|
4678
4670
|
return new P({
|
|
4679
4671
|
key: new I("handleClickLink"),
|
|
4680
4672
|
props: {
|
|
@@ -4688,13 +4680,13 @@ function _o(e) {
|
|
|
4688
4680
|
a.push(i), i = i.parentNode;
|
|
4689
4681
|
if (!a.find((p) => p.nodeName === "A"))
|
|
4690
4682
|
return !1;
|
|
4691
|
-
const l =
|
|
4683
|
+
const l = Ie(t.state, e.type.name), c = r.target, u = (s = c == null ? void 0 : c.href) !== null && s !== void 0 ? s : l.href, d = (o = c == null ? void 0 : c.target) !== null && o !== void 0 ? o : l.target;
|
|
4692
4684
|
return c && u ? (window.open(u, d), !0) : !1;
|
|
4693
4685
|
}
|
|
4694
4686
|
}
|
|
4695
4687
|
});
|
|
4696
4688
|
}
|
|
4697
|
-
function
|
|
4689
|
+
function Po(e) {
|
|
4698
4690
|
return new P({
|
|
4699
4691
|
key: new I("handlePasteLink"),
|
|
4700
4692
|
props: {
|
|
@@ -4706,7 +4698,7 @@ function Ho(e) {
|
|
|
4706
4698
|
r.content.forEach((c) => {
|
|
4707
4699
|
a += c.textContent;
|
|
4708
4700
|
});
|
|
4709
|
-
const l =
|
|
4701
|
+
const l = ke(a, { defaultProtocol: e.defaultProtocol }).find((c) => c.isLink && c.value === a);
|
|
4710
4702
|
return !a || !l ? !1 : (e.editor.commands.setMark(e.type, {
|
|
4711
4703
|
href: l.href
|
|
4712
4704
|
}), !0);
|
|
@@ -4714,15 +4706,15 @@ function Ho(e) {
|
|
|
4714
4706
|
}
|
|
4715
4707
|
});
|
|
4716
4708
|
}
|
|
4717
|
-
const
|
|
4718
|
-
function
|
|
4709
|
+
const Io = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;
|
|
4710
|
+
function ye(e, t) {
|
|
4719
4711
|
const n = ["http", "https", "ftp", "ftps", "mailto", "tel", "callto", "sms", "cid", "xmpp"];
|
|
4720
4712
|
return t && t.forEach((r) => {
|
|
4721
4713
|
const s = typeof r == "string" ? r : r.scheme;
|
|
4722
4714
|
s && n.push(s);
|
|
4723
|
-
}), !e || e.replace(
|
|
4715
|
+
}), !e || e.replace(Io, "").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`, "i"));
|
|
4724
4716
|
}
|
|
4725
|
-
const
|
|
4717
|
+
const Mi = D.create({
|
|
4726
4718
|
name: "link",
|
|
4727
4719
|
priority: 1e3,
|
|
4728
4720
|
keepOnSplit: !1,
|
|
@@ -4730,10 +4722,10 @@ const yi = D.create({
|
|
|
4730
4722
|
onCreate() {
|
|
4731
4723
|
this.options.protocols.forEach((e) => {
|
|
4732
4724
|
if (typeof e == "string") {
|
|
4733
|
-
|
|
4725
|
+
Xt(e);
|
|
4734
4726
|
return;
|
|
4735
4727
|
}
|
|
4736
|
-
|
|
4728
|
+
Xt(e.scheme, e.optionalSlashes);
|
|
4737
4729
|
});
|
|
4738
4730
|
},
|
|
4739
4731
|
onDestroy() {
|
|
@@ -4781,12 +4773,12 @@ const yi = D.create({
|
|
|
4781
4773
|
tag: "a[href]",
|
|
4782
4774
|
getAttrs: (e) => {
|
|
4783
4775
|
const t = e.getAttribute("href");
|
|
4784
|
-
return !t || !
|
|
4776
|
+
return !t || !ye(t, this.options.protocols) ? !1 : null;
|
|
4785
4777
|
}
|
|
4786
4778
|
}];
|
|
4787
4779
|
},
|
|
4788
4780
|
renderHTML({ HTMLAttributes: e }) {
|
|
4789
|
-
return
|
|
4781
|
+
return ye(e.href, this.options.protocols) ? ["a", x(this.options.HTMLAttributes, e), 0] : ["a", x(this.options.HTMLAttributes, { ...e, href: "" }), 0];
|
|
4790
4782
|
},
|
|
4791
4783
|
addCommands() {
|
|
4792
4784
|
return {
|
|
@@ -4801,7 +4793,7 @@ const yi = D.create({
|
|
|
4801
4793
|
find: (e) => {
|
|
4802
4794
|
const t = [];
|
|
4803
4795
|
if (e) {
|
|
4804
|
-
const { validate: n } = this.options, r =
|
|
4796
|
+
const { validate: n } = this.options, r = ke(e).filter((s) => s.isLink && n(s.value));
|
|
4805
4797
|
r.length && r.forEach((s) => t.push({
|
|
4806
4798
|
text: s.value,
|
|
4807
4799
|
data: {
|
|
@@ -4824,19 +4816,19 @@ const yi = D.create({
|
|
|
4824
4816
|
},
|
|
4825
4817
|
addProseMirrorPlugins() {
|
|
4826
4818
|
const e = [];
|
|
4827
|
-
return this.options.autolink && e.push(
|
|
4819
|
+
return this.options.autolink && e.push(Ro({
|
|
4828
4820
|
type: this.type,
|
|
4829
4821
|
defaultProtocol: this.options.defaultProtocol,
|
|
4830
4822
|
validate: this.options.validate
|
|
4831
|
-
})), this.options.openOnClick === !0 && e.push(
|
|
4823
|
+
})), this.options.openOnClick === !0 && e.push(Ho({
|
|
4832
4824
|
type: this.type
|
|
4833
|
-
})), this.options.linkOnPaste && e.push(
|
|
4825
|
+
})), this.options.linkOnPaste && e.push(Po({
|
|
4834
4826
|
editor: this.editor,
|
|
4835
4827
|
defaultProtocol: this.options.defaultProtocol,
|
|
4836
4828
|
type: this.type
|
|
4837
4829
|
})), e;
|
|
4838
4830
|
}
|
|
4839
|
-
}),
|
|
4831
|
+
}), Si = L.create({
|
|
4840
4832
|
name: "horizontalRule",
|
|
4841
4833
|
addOptions() {
|
|
4842
4834
|
return {
|
|
@@ -4859,7 +4851,7 @@ const yi = D.create({
|
|
|
4859
4851
|
to: s.pos
|
|
4860
4852
|
}, {
|
|
4861
4853
|
type: this.name
|
|
4862
|
-
}) :
|
|
4854
|
+
}) : $e(n) ? o.insertContentAt(s.pos, {
|
|
4863
4855
|
type: this.name
|
|
4864
4856
|
}) : o.insertContent({ type: this.name }), o.command(({ tr: i, dispatch: a }) => {
|
|
4865
4857
|
var l;
|
|
@@ -4880,13 +4872,13 @@ const yi = D.create({
|
|
|
4880
4872
|
},
|
|
4881
4873
|
addInputRules() {
|
|
4882
4874
|
return [
|
|
4883
|
-
|
|
4875
|
+
De({
|
|
4884
4876
|
find: /^(?:---|—-|___\s|\*\*\*\s)$/,
|
|
4885
4877
|
type: this.type
|
|
4886
4878
|
})
|
|
4887
4879
|
];
|
|
4888
4880
|
}
|
|
4889
|
-
}),
|
|
4881
|
+
}), ki = _.create({
|
|
4890
4882
|
name: "history",
|
|
4891
4883
|
addOptions() {
|
|
4892
4884
|
return {
|
|
@@ -4915,7 +4907,7 @@ const yi = D.create({
|
|
|
4915
4907
|
"Shift-Mod-я": () => this.editor.commands.redo()
|
|
4916
4908
|
};
|
|
4917
4909
|
}
|
|
4918
|
-
}),
|
|
4910
|
+
}), wi = _.create({
|
|
4919
4911
|
name: "characterCount",
|
|
4920
4912
|
addOptions() {
|
|
4921
4913
|
return {
|
|
@@ -4963,7 +4955,7 @@ const yi = D.create({
|
|
|
4963
4955
|
})
|
|
4964
4956
|
];
|
|
4965
4957
|
}
|
|
4966
|
-
}),
|
|
4958
|
+
}), Ei = _.create({
|
|
4967
4959
|
name: "dropCursor",
|
|
4968
4960
|
addOptions() {
|
|
4969
4961
|
return {
|
|
@@ -4977,7 +4969,7 @@ const yi = D.create({
|
|
|
4977
4969
|
xn(this.options)
|
|
4978
4970
|
];
|
|
4979
4971
|
}
|
|
4980
|
-
}),
|
|
4972
|
+
}), Ti = _.create({
|
|
4981
4973
|
name: "focus",
|
|
4982
4974
|
addOptions() {
|
|
4983
4975
|
return {
|
|
@@ -5008,7 +5000,7 @@ const yi = D.create({
|
|
|
5008
5000
|
return !1;
|
|
5009
5001
|
if (a += 1, this.options.mode === "deepest" && i - a > 0 || this.options.mode === "shallowest" && a > 1)
|
|
5010
5002
|
return this.options.mode === "deepest";
|
|
5011
|
-
o.push(
|
|
5003
|
+
o.push(jt.node(c, c + l.nodeSize, {
|
|
5012
5004
|
class: this.options.className
|
|
5013
5005
|
}));
|
|
5014
5006
|
}), dt.create(e, o);
|
|
@@ -5017,7 +5009,7 @@ const yi = D.create({
|
|
|
5017
5009
|
})
|
|
5018
5010
|
];
|
|
5019
5011
|
}
|
|
5020
|
-
}),
|
|
5012
|
+
}), Ci = _.create({
|
|
5021
5013
|
name: "gapCursor",
|
|
5022
5014
|
addProseMirrorPlugins() {
|
|
5023
5015
|
return [
|
|
@@ -5035,7 +5027,7 @@ const yi = D.create({
|
|
|
5035
5027
|
allowGapCursor: (t = E(v(e, "allowGapCursor", n))) !== null && t !== void 0 ? t : null
|
|
5036
5028
|
};
|
|
5037
5029
|
}
|
|
5038
|
-
}),
|
|
5030
|
+
}), xi = L.create({
|
|
5039
5031
|
name: "hardBreak",
|
|
5040
5032
|
addOptions() {
|
|
5041
5033
|
return {
|
|
@@ -5084,7 +5076,35 @@ const yi = D.create({
|
|
|
5084
5076
|
"Shift-Enter": () => this.editor.commands.setHardBreak()
|
|
5085
5077
|
};
|
|
5086
5078
|
}
|
|
5087
|
-
}),
|
|
5079
|
+
}), Ai = L.create({
|
|
5080
|
+
name: "listItem",
|
|
5081
|
+
addOptions() {
|
|
5082
|
+
return {
|
|
5083
|
+
HTMLAttributes: {},
|
|
5084
|
+
bulletListTypeName: "bulletList",
|
|
5085
|
+
orderedListTypeName: "orderedList"
|
|
5086
|
+
};
|
|
5087
|
+
},
|
|
5088
|
+
content: "paragraph block*",
|
|
5089
|
+
defining: !0,
|
|
5090
|
+
parseHTML() {
|
|
5091
|
+
return [
|
|
5092
|
+
{
|
|
5093
|
+
tag: "li"
|
|
5094
|
+
}
|
|
5095
|
+
];
|
|
5096
|
+
},
|
|
5097
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
5098
|
+
return ["li", x(this.options.HTMLAttributes, e), 0];
|
|
5099
|
+
},
|
|
5100
|
+
addKeyboardShortcuts() {
|
|
5101
|
+
return {
|
|
5102
|
+
Enter: () => this.editor.commands.splitListItem(this.name),
|
|
5103
|
+
Tab: () => this.editor.commands.sinkListItem(this.name),
|
|
5104
|
+
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
5105
|
+
};
|
|
5106
|
+
}
|
|
5107
|
+
}), Oi = L.create({
|
|
5088
5108
|
name: "paragraph",
|
|
5089
5109
|
priority: 1e3,
|
|
5090
5110
|
addOptions() {
|
|
@@ -5112,7 +5132,7 @@ const yi = D.create({
|
|
|
5112
5132
|
"Mod-Alt-0": () => this.editor.commands.setParagraph()
|
|
5113
5133
|
};
|
|
5114
5134
|
}
|
|
5115
|
-
}),
|
|
5135
|
+
}), Li = _.create({
|
|
5116
5136
|
name: "placeholder",
|
|
5117
5137
|
addOptions() {
|
|
5118
5138
|
return {
|
|
@@ -5135,11 +5155,11 @@ const yi = D.create({
|
|
|
5135
5155
|
return null;
|
|
5136
5156
|
const o = this.editor.isEmpty;
|
|
5137
5157
|
return e.descendants((i, a) => {
|
|
5138
|
-
const l = r >= a && r <= a + i.nodeSize, c = !i.isLeaf &&
|
|
5158
|
+
const l = r >= a && r <= a + i.nodeSize, c = !i.isLeaf && St(i);
|
|
5139
5159
|
if ((l || !this.options.showOnlyCurrent) && c) {
|
|
5140
5160
|
const u = [this.options.emptyNodeClass];
|
|
5141
5161
|
o && u.push(this.options.emptyEditorClass);
|
|
5142
|
-
const d =
|
|
5162
|
+
const d = jt.node(a, a + i.nodeSize, {
|
|
5143
5163
|
class: u.join(" "),
|
|
5144
5164
|
"data-placeholder": typeof this.options.placeholder == "function" ? this.options.placeholder({
|
|
5145
5165
|
editor: this.editor,
|
|
@@ -5157,14 +5177,14 @@ const yi = D.create({
|
|
|
5157
5177
|
})
|
|
5158
5178
|
];
|
|
5159
5179
|
}
|
|
5160
|
-
}),
|
|
5180
|
+
}), _i = L.create({
|
|
5161
5181
|
name: "text",
|
|
5162
5182
|
group: "inline"
|
|
5163
|
-
}),
|
|
5183
|
+
}), Ri = L.create({
|
|
5164
5184
|
name: "doc",
|
|
5165
5185
|
topNode: !0,
|
|
5166
5186
|
content: "block+"
|
|
5167
|
-
}),
|
|
5187
|
+
}), Hi = D.create({
|
|
5168
5188
|
name: "subscript",
|
|
5169
5189
|
addOptions() {
|
|
5170
5190
|
return {
|
|
@@ -5199,7 +5219,7 @@ const yi = D.create({
|
|
|
5199
5219
|
"Mod-,": () => this.editor.commands.toggleSubscript()
|
|
5200
5220
|
};
|
|
5201
5221
|
}
|
|
5202
|
-
}),
|
|
5222
|
+
}), Pi = D.create({
|
|
5203
5223
|
name: "superscript",
|
|
5204
5224
|
addOptions() {
|
|
5205
5225
|
return {
|
|
@@ -5235,7 +5255,7 @@ const yi = D.create({
|
|
|
5235
5255
|
};
|
|
5236
5256
|
}
|
|
5237
5257
|
});
|
|
5238
|
-
function
|
|
5258
|
+
function $o(e) {
|
|
5239
5259
|
var t;
|
|
5240
5260
|
const { char: n, allowSpaces: r, allowedPrefixes: s, startOfLine: o, $position: i } = e, a = js(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;
|
|
5241
5261
|
if (!d)
|
|
@@ -5257,8 +5277,8 @@ function Po(e) {
|
|
|
5257
5277
|
text: h[0]
|
|
5258
5278
|
} : null;
|
|
5259
5279
|
}
|
|
5260
|
-
const
|
|
5261
|
-
function
|
|
5280
|
+
const Do = new I("suggestion");
|
|
5281
|
+
function No({ pluginKey: e = Do, 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 = $o }) {
|
|
5262
5282
|
let h;
|
|
5263
5283
|
const f = u == null ? void 0 : u(), m = new P({
|
|
5264
5284
|
key: e,
|
|
@@ -5266,10 +5286,10 @@ function $o({ pluginKey: e = Io, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5266
5286
|
return {
|
|
5267
5287
|
update: async (y, g) => {
|
|
5268
5288
|
var k, b, M, w, S, C, A;
|
|
5269
|
-
const T = (k = this.key) === null || k === void 0 ? void 0 : k.getState(g),
|
|
5289
|
+
const T = (k = this.key) === null || k === void 0 ? void 0 : k.getState(g), R = (b = this.key) === null || b === void 0 ? void 0 : b.getState(y.state), N = T.active && R.active && T.range.from !== R.range.from, j = !T.active && R.active, Y = T.active && !R.active, W = !j && !Y && T.query !== R.query, K = j || N && W, F = W || N, U = Y || N && W;
|
|
5270
5290
|
if (!K && !F && !U)
|
|
5271
5291
|
return;
|
|
5272
|
-
const X = U && !K ? T :
|
|
5292
|
+
const X = U && !K ? T : R, Jt = y.dom.querySelector(`[data-decoration-id="${X.decorationId}"]`);
|
|
5273
5293
|
h = {
|
|
5274
5294
|
editor: t,
|
|
5275
5295
|
range: X.range,
|
|
@@ -5281,13 +5301,13 @@ function $o({ pluginKey: e = Io, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5281
5301
|
range: X.range,
|
|
5282
5302
|
props: et
|
|
5283
5303
|
}),
|
|
5284
|
-
decorationNode:
|
|
5304
|
+
decorationNode: Jt,
|
|
5285
5305
|
// virtual node for popper.js or tippy.js
|
|
5286
5306
|
// this can be used for building popups without a DOM node
|
|
5287
|
-
clientRect:
|
|
5307
|
+
clientRect: Jt ? () => {
|
|
5288
5308
|
var et;
|
|
5289
|
-
const { decorationId: ze } = (et = this.key) === null || et === void 0 ? void 0 : et.getState(t.state),
|
|
5290
|
-
return (
|
|
5309
|
+
const { decorationId: ze } = (et = this.key) === null || et === void 0 ? void 0 : et.getState(t.state), wt = y.dom.querySelector(`[data-decoration-id="${ze}"]`);
|
|
5310
|
+
return (wt == null ? void 0 : wt.getBoundingClientRect()) || null;
|
|
5291
5311
|
} : null
|
|
5292
5312
|
}, K && ((M = f == null ? void 0 : f.onBeforeStart) === null || M === void 0 || M.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({
|
|
5293
5313
|
editor: t,
|
|
@@ -5319,19 +5339,19 @@ function $o({ pluginKey: e = Io, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5319
5339
|
const { isEditable: M } = t, { composing: w } = t.view, { selection: S } = y, { empty: C, from: A } = S, T = { ...g };
|
|
5320
5340
|
if (T.composing = w, M && (C || t.view.composing)) {
|
|
5321
5341
|
(A < g.range.from || A > g.range.to) && !w && !g.composing && (T.active = !1);
|
|
5322
|
-
const
|
|
5342
|
+
const R = p({
|
|
5323
5343
|
char: n,
|
|
5324
5344
|
allowSpaces: r,
|
|
5325
5345
|
allowedPrefixes: s,
|
|
5326
5346
|
startOfLine: o,
|
|
5327
5347
|
$position: S.$from
|
|
5328
5348
|
}), N = `id_${Math.floor(Math.random() * 4294967295)}`;
|
|
5329
|
-
|
|
5349
|
+
R && d({
|
|
5330
5350
|
editor: t,
|
|
5331
5351
|
state: b,
|
|
5332
|
-
range:
|
|
5352
|
+
range: R.range,
|
|
5333
5353
|
isActive: g.active
|
|
5334
|
-
}) ? (T.active = !0, T.decorationId = g.decorationId ? g.decorationId : N, T.range =
|
|
5354
|
+
}) ? (T.active = !0, T.decorationId = g.decorationId ? g.decorationId : N, T.range = R.range, T.query = R.query, T.text = R.text) : T.active = !1;
|
|
5335
5355
|
} else
|
|
5336
5356
|
T.active = !1;
|
|
5337
5357
|
return T.active || (T.decorationId = null, T.range = { from: 0, to: 0 }, T.query = null, T.text = null), T;
|
|
@@ -5348,7 +5368,7 @@ function $o({ pluginKey: e = Io, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5348
5368
|
decorations(y) {
|
|
5349
5369
|
const { active: g, range: k, decorationId: b } = m.getState(y);
|
|
5350
5370
|
return g ? dt.create(y.doc, [
|
|
5351
|
-
|
|
5371
|
+
jt.inline(k.from, k.to, {
|
|
5352
5372
|
nodeName: i,
|
|
5353
5373
|
class: a,
|
|
5354
5374
|
"data-decoration-id": b
|
|
@@ -5359,7 +5379,7 @@ function $o({ pluginKey: e = Io, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5359
5379
|
});
|
|
5360
5380
|
return m;
|
|
5361
5381
|
}
|
|
5362
|
-
const
|
|
5382
|
+
const Bo = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Ii = L.create({
|
|
5363
5383
|
name: "image",
|
|
5364
5384
|
addOptions() {
|
|
5365
5385
|
return {
|
|
@@ -5408,8 +5428,8 @@ const Do = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, _i = L.cr
|
|
|
5408
5428
|
},
|
|
5409
5429
|
addInputRules() {
|
|
5410
5430
|
return [
|
|
5411
|
-
|
|
5412
|
-
find:
|
|
5431
|
+
De({
|
|
5432
|
+
find: Bo,
|
|
5413
5433
|
type: this.type,
|
|
5414
5434
|
getAttributes: (e) => {
|
|
5415
5435
|
const [, , t, n, r] = e;
|
|
@@ -5418,7 +5438,7 @@ const Do = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, _i = L.cr
|
|
|
5418
5438
|
})
|
|
5419
5439
|
];
|
|
5420
5440
|
}
|
|
5421
|
-
}),
|
|
5441
|
+
}), $i = L.create({
|
|
5422
5442
|
name: "tableRow",
|
|
5423
5443
|
addOptions() {
|
|
5424
5444
|
return {
|
|
@@ -5436,7 +5456,7 @@ const Do = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, _i = L.cr
|
|
|
5436
5456
|
return ["tr", x(this.options.HTMLAttributes, e), 0];
|
|
5437
5457
|
}
|
|
5438
5458
|
});
|
|
5439
|
-
function
|
|
5459
|
+
function be(e, t, n, r, s, o) {
|
|
5440
5460
|
let i = 0, a = !0, l = t.firstChild;
|
|
5441
5461
|
const c = e.firstChild;
|
|
5442
5462
|
for (let u = 0, d = 0; u < c.childCount; u += 1) {
|
|
@@ -5452,18 +5472,18 @@ function ye(e, t, n, r, s, o) {
|
|
|
5452
5472
|
}
|
|
5453
5473
|
a ? (n.style.width = `${i}px`, n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = `${i}px`);
|
|
5454
5474
|
}
|
|
5455
|
-
class
|
|
5475
|
+
class jo {
|
|
5456
5476
|
constructor(t, n) {
|
|
5457
|
-
this.node = t, this.cellMinWidth = n, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.colgroup = this.table.appendChild(document.createElement("colgroup")),
|
|
5477
|
+
this.node = t, this.cellMinWidth = n, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.colgroup = this.table.appendChild(document.createElement("colgroup")), be(t, this.colgroup, this.table, n), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
5458
5478
|
}
|
|
5459
5479
|
update(t) {
|
|
5460
|
-
return t.type !== this.node.type ? !1 : (this.node = t,
|
|
5480
|
+
return t.type !== this.node.type ? !1 : (this.node = t, be(t, this.colgroup, this.table, this.cellMinWidth), !0);
|
|
5461
5481
|
}
|
|
5462
5482
|
ignoreMutation(t) {
|
|
5463
5483
|
return t.type === "attributes" && (t.target === this.table || this.colgroup.contains(t.target));
|
|
5464
5484
|
}
|
|
5465
5485
|
}
|
|
5466
|
-
function
|
|
5486
|
+
function Fo(e, t, n, r) {
|
|
5467
5487
|
let s = 0, o = !0;
|
|
5468
5488
|
const i = [], a = e.firstChild;
|
|
5469
5489
|
if (!a)
|
|
@@ -5478,10 +5498,10 @@ function Bo(e, t, n, r) {
|
|
|
5478
5498
|
const l = o ? `${s}px` : "", c = o ? "" : `${s}px`;
|
|
5479
5499
|
return { colgroup: ["colgroup", {}, ...i], tableWidth: l, tableMinWidth: c };
|
|
5480
5500
|
}
|
|
5481
|
-
function
|
|
5501
|
+
function ve(e, t) {
|
|
5482
5502
|
return e.createAndFill();
|
|
5483
5503
|
}
|
|
5484
|
-
function
|
|
5504
|
+
function zo(e) {
|
|
5485
5505
|
if (e.cached.tableNodeTypes)
|
|
5486
5506
|
return e.cached.tableNodeTypes;
|
|
5487
5507
|
const t = {};
|
|
@@ -5490,12 +5510,12 @@ function jo(e) {
|
|
|
5490
5510
|
r.spec.tableRole && (t[r.spec.tableRole] = r);
|
|
5491
5511
|
}), e.cached.tableNodeTypes = t, t;
|
|
5492
5512
|
}
|
|
5493
|
-
function
|
|
5494
|
-
const o =
|
|
5513
|
+
function Vo(e, t, n, r, s) {
|
|
5514
|
+
const o = zo(e), i = [], a = [];
|
|
5495
5515
|
for (let c = 0; c < n; c += 1) {
|
|
5496
|
-
const u =
|
|
5516
|
+
const u = ve(o.cell);
|
|
5497
5517
|
if (u && a.push(u), r) {
|
|
5498
|
-
const d =
|
|
5518
|
+
const d = ve(o.header_cell);
|
|
5499
5519
|
d && i.push(d);
|
|
5500
5520
|
}
|
|
5501
5521
|
}
|
|
@@ -5504,21 +5524,21 @@ function Fo(e, t, n, r, s) {
|
|
|
5504
5524
|
l.push(o.row.createChecked(null, r && c === 0 ? i : a));
|
|
5505
5525
|
return o.table.createChecked(null, l);
|
|
5506
5526
|
}
|
|
5507
|
-
function
|
|
5508
|
-
return e instanceof
|
|
5527
|
+
function Wo(e) {
|
|
5528
|
+
return e instanceof we;
|
|
5509
5529
|
}
|
|
5510
5530
|
const it = ({ editor: e }) => {
|
|
5511
5531
|
const { selection: t } = e.state;
|
|
5512
|
-
if (!
|
|
5532
|
+
if (!Wo(t))
|
|
5513
5533
|
return !1;
|
|
5514
5534
|
let n = 0;
|
|
5515
|
-
const r =
|
|
5535
|
+
const r = Pe(t.ranges[0].$from, (o) => o.type.name === "table");
|
|
5516
5536
|
return r == null || r.node.descendants((o) => {
|
|
5517
5537
|
if (o.type.name === "table")
|
|
5518
5538
|
return !1;
|
|
5519
5539
|
["tableCell", "tableHeader"].includes(o.type.name) && (n += 1);
|
|
5520
5540
|
}), n === t.ranges.length ? (e.commands.deleteTable(), !0) : !1;
|
|
5521
|
-
},
|
|
5541
|
+
}, Di = L.create({
|
|
5522
5542
|
name: "table",
|
|
5523
5543
|
// @ts-ignore
|
|
5524
5544
|
addOptions() {
|
|
@@ -5528,7 +5548,7 @@ const it = ({ editor: e }) => {
|
|
|
5528
5548
|
handleWidth: 5,
|
|
5529
5549
|
cellMinWidth: 25,
|
|
5530
5550
|
// TODO: fix
|
|
5531
|
-
View:
|
|
5551
|
+
View: jo,
|
|
5532
5552
|
lastColumnResizable: !0,
|
|
5533
5553
|
allowTableNodeSelection: !1
|
|
5534
5554
|
};
|
|
@@ -5541,7 +5561,7 @@ const it = ({ editor: e }) => {
|
|
|
5541
5561
|
return [{ tag: "table" }];
|
|
5542
5562
|
},
|
|
5543
5563
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
5544
|
-
const { colgroup: n, tableWidth: r, tableMinWidth: s } =
|
|
5564
|
+
const { colgroup: n, tableWidth: r, tableMinWidth: s } = Fo(e, this.options.cellMinWidth);
|
|
5545
5565
|
return [
|
|
5546
5566
|
"table",
|
|
5547
5567
|
x(this.options.HTMLAttributes, t, {
|
|
@@ -5554,7 +5574,7 @@ const it = ({ editor: e }) => {
|
|
|
5554
5574
|
addCommands() {
|
|
5555
5575
|
return {
|
|
5556
5576
|
insertTable: ({ rows: e = 3, cols: t = 3, withHeaderRow: n = !0 } = {}) => ({ tr: r, dispatch: s, editor: o }) => {
|
|
5557
|
-
const i =
|
|
5577
|
+
const i = Vo(o.schema, e, t, n);
|
|
5558
5578
|
if (s) {
|
|
5559
5579
|
const a = r.selection.from + 1;
|
|
5560
5580
|
r.replaceSelectionWith(i).scrollIntoView().setSelection($.near(r.doc.resolve(a)));
|
|
@@ -5564,23 +5584,23 @@ const it = ({ editor: e }) => {
|
|
|
5564
5584
|
addColumnBefore: () => ({ state: e, dispatch: t }) => On(e, t),
|
|
5565
5585
|
addColumnAfter: () => ({ state: e, dispatch: t }) => Ln(e, t),
|
|
5566
5586
|
deleteColumn: () => ({ state: e, dispatch: t }) => _n(e, t),
|
|
5567
|
-
addRowBefore: () => ({ state: e, dispatch: t }) =>
|
|
5568
|
-
addRowAfter: () => ({ state: e, dispatch: t }) =>
|
|
5587
|
+
addRowBefore: () => ({ state: e, dispatch: t }) => Rn(e, t),
|
|
5588
|
+
addRowAfter: () => ({ state: e, dispatch: t }) => Hn(e, t),
|
|
5569
5589
|
deleteRow: () => ({ state: e, dispatch: t }) => Pn(e, t),
|
|
5570
5590
|
deleteTable: () => ({ state: e, dispatch: t }) => In(e, t),
|
|
5571
|
-
mergeCells: () => ({ state: e, dispatch: t }) =>
|
|
5572
|
-
splitCell: () => ({ state: e, dispatch: t }) =>
|
|
5573
|
-
toggleHeaderColumn: () => ({ state: e, dispatch: t }) =>
|
|
5574
|
-
toggleHeaderRow: () => ({ state: e, dispatch: t }) =>
|
|
5591
|
+
mergeCells: () => ({ state: e, dispatch: t }) => Qt(e, t),
|
|
5592
|
+
splitCell: () => ({ state: e, dispatch: t }) => Zt(e, t),
|
|
5593
|
+
toggleHeaderColumn: () => ({ state: e, dispatch: t }) => te("column")(e, t),
|
|
5594
|
+
toggleHeaderRow: () => ({ state: e, dispatch: t }) => te("row")(e, t),
|
|
5575
5595
|
toggleHeaderCell: () => ({ state: e, dispatch: t }) => $n(e, t),
|
|
5576
|
-
mergeOrSplit: () => ({ state: e, dispatch: t }) =>
|
|
5596
|
+
mergeOrSplit: () => ({ state: e, dispatch: t }) => Qt(e, t) ? !0 : Zt(e, t),
|
|
5577
5597
|
setCellAttribute: (e, t) => ({ state: n, dispatch: r }) => Dn(e, t)(n, r),
|
|
5578
|
-
goToNextCell: () => ({ state: e, dispatch: t }) =>
|
|
5579
|
-
goToPreviousCell: () => ({ state: e, dispatch: t }) =>
|
|
5598
|
+
goToNextCell: () => ({ state: e, dispatch: t }) => ee(1)(e, t),
|
|
5599
|
+
goToPreviousCell: () => ({ state: e, dispatch: t }) => ee(-1)(e, t),
|
|
5580
5600
|
fixTables: () => ({ state: e, dispatch: t }) => (t && Nn(e), !0),
|
|
5581
5601
|
setCellSelection: (e) => ({ tr: t, dispatch: n }) => {
|
|
5582
5602
|
if (n) {
|
|
5583
|
-
const r =
|
|
5603
|
+
const r = we.create(t.doc, e.anchorCell, e.headCell);
|
|
5584
5604
|
t.setSelection(r);
|
|
5585
5605
|
}
|
|
5586
5606
|
return !0;
|
|
@@ -5622,7 +5642,7 @@ const it = ({ editor: e }) => {
|
|
|
5622
5642
|
tableRole: E(v(e, "tableRole", t))
|
|
5623
5643
|
};
|
|
5624
5644
|
}
|
|
5625
|
-
}),
|
|
5645
|
+
}), Ni = L.create({
|
|
5626
5646
|
name: "tableCell",
|
|
5627
5647
|
addOptions() {
|
|
5628
5648
|
return {
|
|
@@ -5642,7 +5662,7 @@ const it = ({ editor: e }) => {
|
|
|
5642
5662
|
default: null,
|
|
5643
5663
|
parseHTML: (e) => {
|
|
5644
5664
|
const t = e.getAttribute("colwidth");
|
|
5645
|
-
return t ?
|
|
5665
|
+
return t ? t.split(",").map((r) => parseInt(r, 10)) : null;
|
|
5646
5666
|
}
|
|
5647
5667
|
}
|
|
5648
5668
|
};
|
|
@@ -5657,7 +5677,7 @@ const it = ({ editor: e }) => {
|
|
|
5657
5677
|
renderHTML({ HTMLAttributes: e }) {
|
|
5658
5678
|
return ["td", x(this.options.HTMLAttributes, e), 0];
|
|
5659
5679
|
}
|
|
5660
|
-
}),
|
|
5680
|
+
}), Bi = L.create({
|
|
5661
5681
|
name: "tableHeader",
|
|
5662
5682
|
addOptions() {
|
|
5663
5683
|
return {
|
|
@@ -5677,7 +5697,7 @@ const it = ({ editor: e }) => {
|
|
|
5677
5697
|
default: null,
|
|
5678
5698
|
parseHTML: (e) => {
|
|
5679
5699
|
const t = e.getAttribute("colwidth");
|
|
5680
|
-
return t ?
|
|
5700
|
+
return t ? t.split(",").map((r) => parseInt(r, 10)) : null;
|
|
5681
5701
|
}
|
|
5682
5702
|
}
|
|
5683
5703
|
};
|
|
@@ -5692,8 +5712,9 @@ const it = ({ editor: e }) => {
|
|
|
5692
5712
|
renderHTML({ HTMLAttributes: e }) {
|
|
5693
5713
|
return ["th", x(this.options.HTMLAttributes, e), 0];
|
|
5694
5714
|
}
|
|
5695
|
-
}),
|
|
5715
|
+
}), Ko = new I("mention"), ji = L.create({
|
|
5696
5716
|
name: "mention",
|
|
5717
|
+
priority: 101,
|
|
5697
5718
|
addOptions() {
|
|
5698
5719
|
return {
|
|
5699
5720
|
HTMLAttributes: {},
|
|
@@ -5712,7 +5733,7 @@ const it = ({ editor: e }) => {
|
|
|
5712
5733
|
},
|
|
5713
5734
|
suggestion: {
|
|
5714
5735
|
char: "@",
|
|
5715
|
-
pluginKey:
|
|
5736
|
+
pluginKey: Ko,
|
|
5716
5737
|
command: ({ editor: e, range: t, props: n }) => {
|
|
5717
5738
|
var r, s, o;
|
|
5718
5739
|
const i = e.view.state.selection.$to.nodeAfter;
|
|
@@ -5808,7 +5829,7 @@ const it = ({ editor: e }) => {
|
|
|
5808
5829
|
},
|
|
5809
5830
|
addProseMirrorPlugins() {
|
|
5810
5831
|
return [
|
|
5811
|
-
|
|
5832
|
+
No({
|
|
5812
5833
|
editor: this.editor,
|
|
5813
5834
|
...this.options.suggestion
|
|
5814
5835
|
})
|
|
@@ -5816,60 +5837,60 @@ const it = ({ editor: e }) => {
|
|
|
5816
5837
|
}
|
|
5817
5838
|
});
|
|
5818
5839
|
export {
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5840
|
+
Ni as $,
|
|
5841
|
+
xi as A,
|
|
5842
|
+
ti as B,
|
|
5843
|
+
ai as C,
|
|
5844
|
+
Ri as D,
|
|
5845
|
+
Qo as E,
|
|
5846
|
+
di as F,
|
|
5847
|
+
Ci as G,
|
|
5848
|
+
ui as H,
|
|
5849
|
+
si as I,
|
|
5850
|
+
Ai as J,
|
|
5851
|
+
ci as K,
|
|
5852
|
+
Mi as L,
|
|
5853
|
+
Hi as M,
|
|
5854
|
+
ni as N,
|
|
5855
|
+
gi as O,
|
|
5856
|
+
Li as P,
|
|
5857
|
+
Pi as Q,
|
|
5858
|
+
ri as R,
|
|
5859
|
+
ii as S,
|
|
5860
|
+
pi as T,
|
|
5861
|
+
oi as U,
|
|
5862
|
+
No as V,
|
|
5842
5863
|
ho as W,
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5864
|
+
Ii as X,
|
|
5865
|
+
Di as Y,
|
|
5866
|
+
$i as Z,
|
|
5867
|
+
Bi as _,
|
|
5847
5868
|
L as a,
|
|
5848
|
-
|
|
5869
|
+
ji as a0,
|
|
5849
5870
|
Zn as a1,
|
|
5850
5871
|
is as b,
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5872
|
+
Xo as c,
|
|
5873
|
+
ei as d,
|
|
5874
|
+
li as e,
|
|
5875
|
+
Yo as f,
|
|
5855
5876
|
_ as g,
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5877
|
+
hi as h,
|
|
5878
|
+
ie as i,
|
|
5879
|
+
fi as j,
|
|
5880
|
+
mi as k,
|
|
5881
|
+
bi as l,
|
|
5861
5882
|
x as m,
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5883
|
+
De as n,
|
|
5884
|
+
yi as o,
|
|
5885
|
+
vi as p,
|
|
5886
|
+
Wt as q,
|
|
5887
|
+
Si as r,
|
|
5888
|
+
ki as s,
|
|
5889
|
+
qt as t,
|
|
5890
|
+
Zo as u,
|
|
5891
|
+
Ti as v,
|
|
5892
|
+
_i as w,
|
|
5893
|
+
Ei as x,
|
|
5894
|
+
wi as y,
|
|
5895
|
+
Oi as z
|
|
5875
5896
|
};
|