reactjs-tiptap-editor 0.1.16 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{RichTextEditor-BkhQvEYE.js → RichTextEditor-CC602P8F.js} +860 -657
- package/lib/RichTextEditor-abeFC8IX.cjs +138 -0
- package/lib/extension-bundle.cjs +2 -2
- package/lib/extension-bundle.d.cts +76 -78
- package/lib/extension-bundle.d.ts +76 -78
- package/lib/extension-bundle.js +4780 -4562
- package/lib/{index-ss0v5xR4.js → index-C0LiugNd.js} +3 -1
- package/lib/{index-jhhV09no.cjs → index-D9RG-bm0.cjs} +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.d.cts +76 -76
- package/lib/index.d.ts +76 -76
- package/lib/index.js +2 -2
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.d.cts +75 -75
- package/lib/locale-bundle.d.ts +75 -75
- package/lib/locale-bundle.js +1 -1
- package/lib/style.css +1 -1
- package/lib/{tiptap-OmOggkHK.js → tiptap-BAutNX9u.js} +727 -726
- package/lib/{tiptap-CTEGMe7x.cjs → tiptap-ktk3za0X.cjs} +12 -12
- package/lib/vendor-CFOlvngC.js +60442 -0
- package/lib/vendor-CY5IU8Xa.cjs +457 -0
- package/package.json +56 -58
- package/lib/RichTextEditor-Da_h65eW.cjs +0 -138
- package/lib/vendor-C9AD9FTJ.js +0 -50660
- package/lib/vendor-CEvER8Ns.cjs +0 -370
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
import { E as
|
|
6
|
-
import L, { useRef as
|
|
7
|
-
import
|
|
8
|
-
function
|
|
1
|
+
var un = Object.defineProperty;
|
|
2
|
+
var pn = (e, t, n) => t in e ? un(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var at = (e, t, n) => pn(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import He from "tippy.js";
|
|
5
|
+
import { E as hn, a as fn, P as $, b as _, S as W, k as mn, T as I, D as gn, c as De, F as K, N as yn, d as Pt, w as vn, e as bn, f as Mn, g as ft, h as et, s as Sn, i as ae, j as wn, l as kn, m as En, n as Tn, o as Cn, A as xn, p as An, q as On, r as Ln, t as Pn, u as Rn, v as $n, x as _n, y as Ie, z as Hn, B as Dn, C as In, G as Nn, H as Bn, I as jn, J as zn, K as qt, R as Fn, L as Vn, M as Wn, O as Kn, Q as le, U as Un, V as Ne, W as qn, X as Gn, Y as Jn, Z as Yn, _ as Xn, $ as gt, a0 as Gt, a1 as Qn, a2 as Zn, a3 as tr, a4 as Be, a5 as er, a6 as ce, a7 as nr, a8 as de, a9 as ue, aa as rr, ab as pe, ac as sr, ad as or, ae as ir, af as ar, ag as lr, ah as cr, ai as dr, aj as ur, ak as pr, al as hr, am as fr } from "./vendor-CFOlvngC.js";
|
|
6
|
+
import L, { useRef as mr, useState as Jt, useDebugValue as je, useEffect as Yt, forwardRef as gr, useLayoutEffect as yr, useContext as ze, createContext as Fe } from "react";
|
|
7
|
+
import vr, { flushSync as br } from "react-dom";
|
|
8
|
+
function Mt(e) {
|
|
9
9
|
const { state: t, transaction: n } = e;
|
|
10
10
|
let { selection: r } = n, { doc: s } = n, { storedMarks: o } = n;
|
|
11
11
|
return {
|
|
@@ -30,7 +30,7 @@ function bt(e) {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
class
|
|
33
|
+
class St {
|
|
34
34
|
constructor(t) {
|
|
35
35
|
this.editor = t.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = t.state;
|
|
36
36
|
}
|
|
@@ -75,7 +75,7 @@ class Mt {
|
|
|
75
75
|
tr: t,
|
|
76
76
|
editor: s,
|
|
77
77
|
view: i,
|
|
78
|
-
state:
|
|
78
|
+
state: Mt({
|
|
79
79
|
state: o,
|
|
80
80
|
transaction: t
|
|
81
81
|
}),
|
|
@@ -90,7 +90,7 @@ class Mt {
|
|
|
90
90
|
return a;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
class
|
|
93
|
+
class Mr {
|
|
94
94
|
constructor() {
|
|
95
95
|
this.callbacks = {};
|
|
96
96
|
}
|
|
@@ -121,7 +121,7 @@ function w(e, t, n) {
|
|
|
121
121
|
parent: e.parent ? w(e.parent, t, n) : null
|
|
122
122
|
}) : e.config[t];
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function wt(e) {
|
|
125
125
|
const t = e.filter((s) => s.type === "extension"), n = e.filter((s) => s.type === "node"), r = e.filter((s) => s.type === "mark");
|
|
126
126
|
return {
|
|
127
127
|
baseExtensions: t,
|
|
@@ -129,8 +129,8 @@ function St(e) {
|
|
|
129
129
|
markExtensions: r
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
const t = [], { nodeExtensions: n, markExtensions: r } =
|
|
132
|
+
function Ve(e) {
|
|
133
|
+
const t = [], { nodeExtensions: n, markExtensions: r } = wt(e), s = [...n, ...r], o = {
|
|
134
134
|
default: null,
|
|
135
135
|
rendered: !0,
|
|
136
136
|
renderHTML: null,
|
|
@@ -216,24 +216,24 @@ function x(...e) {
|
|
|
216
216
|
}), r;
|
|
217
217
|
}, {});
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function yt(e, t) {
|
|
220
220
|
return t.filter((n) => n.type === e.type.name).filter((n) => n.attribute.rendered).map((n) => n.attribute.renderHTML ? n.attribute.renderHTML(e.attrs) || {} : {
|
|
221
221
|
[n.name]: e.attrs[n.name]
|
|
222
222
|
}).reduce((n, r) => x(n, r), {});
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function We(e) {
|
|
225
225
|
return typeof e == "function";
|
|
226
226
|
}
|
|
227
227
|
function E(e, t = void 0, ...n) {
|
|
228
|
-
return
|
|
228
|
+
return We(e) ? t ? e.bind(t)(...n) : e(...n) : e;
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function Sr(e = {}) {
|
|
231
231
|
return Object.keys(e).length === 0 && e.constructor === Object;
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function wr(e) {
|
|
234
234
|
return typeof e != "string" ? e : e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" ? !0 : e === "false" ? !1 : e;
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function he(e, t) {
|
|
237
237
|
return "style" in e ? e : {
|
|
238
238
|
...e,
|
|
239
239
|
getAttrs: (n) => {
|
|
@@ -241,7 +241,7 @@ function pe(e, t) {
|
|
|
241
241
|
if (r === !1)
|
|
242
242
|
return !1;
|
|
243
243
|
const s = t.reduce((o, i) => {
|
|
244
|
-
const a = i.attribute.parseHTML ? i.attribute.parseHTML(n) :
|
|
244
|
+
const a = i.attribute.parseHTML ? i.attribute.parseHTML(n) : wr(n.getAttribute(i.name));
|
|
245
245
|
return a == null ? o : {
|
|
246
246
|
...o,
|
|
247
247
|
[i.name]: a
|
|
@@ -251,15 +251,15 @@ function pe(e, t) {
|
|
|
251
251
|
}
|
|
252
252
|
};
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function fe(e) {
|
|
255
255
|
return Object.fromEntries(
|
|
256
256
|
// @ts-ignore
|
|
257
|
-
Object.entries(e).filter(([t, n]) => t === "attrs" &&
|
|
257
|
+
Object.entries(e).filter(([t, n]) => t === "attrs" && Sr(n) ? !1 : n != null)
|
|
258
258
|
);
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function kr(e, t) {
|
|
261
261
|
var n;
|
|
262
|
-
const r =
|
|
262
|
+
const r = Ve(e), { nodeExtensions: s, markExtensions: o } = wt(e), i = (n = s.find((l) => w(l, "topNode"))) === null || n === void 0 ? void 0 : n.name, a = Object.fromEntries(s.map((l) => {
|
|
263
263
|
const u = r.filter((y) => y.type === l.name), d = {
|
|
264
264
|
name: l.name,
|
|
265
265
|
options: l.options,
|
|
@@ -271,7 +271,7 @@ function wr(e, t) {
|
|
|
271
271
|
...y,
|
|
272
272
|
...b ? b(l) : {}
|
|
273
273
|
};
|
|
274
|
-
}, {}), h =
|
|
274
|
+
}, {}), h = fe({
|
|
275
275
|
...p,
|
|
276
276
|
content: E(w(l, "content", d)),
|
|
277
277
|
marks: E(w(l, "marks", d)),
|
|
@@ -290,11 +290,11 @@ function wr(e, t) {
|
|
|
290
290
|
return [y.name, { default: (M = y == null ? void 0 : y.attribute) === null || M === void 0 ? void 0 : M.default }];
|
|
291
291
|
}))
|
|
292
292
|
}), m = E(w(l, "parseHTML", d));
|
|
293
|
-
m && (h.parseDOM = m.map((y) =>
|
|
293
|
+
m && (h.parseDOM = m.map((y) => he(y, u)));
|
|
294
294
|
const f = w(l, "renderHTML", d);
|
|
295
295
|
f && (h.toDOM = (y) => f({
|
|
296
296
|
node: y,
|
|
297
|
-
HTMLAttributes:
|
|
297
|
+
HTMLAttributes: yt(y, u)
|
|
298
298
|
}));
|
|
299
299
|
const g = w(l, "renderText", d);
|
|
300
300
|
return g && (h.toText = g), [l.name, h];
|
|
@@ -310,7 +310,7 @@ function wr(e, t) {
|
|
|
310
310
|
...g,
|
|
311
311
|
...M ? M(l) : {}
|
|
312
312
|
};
|
|
313
|
-
}, {}), h =
|
|
313
|
+
}, {}), h = fe({
|
|
314
314
|
...p,
|
|
315
315
|
inclusive: E(w(l, "inclusive", d)),
|
|
316
316
|
excludes: E(w(l, "excludes", d)),
|
|
@@ -322,30 +322,30 @@ function wr(e, t) {
|
|
|
322
322
|
return [g.name, { default: (y = g == null ? void 0 : g.attribute) === null || y === void 0 ? void 0 : y.default }];
|
|
323
323
|
}))
|
|
324
324
|
}), m = E(w(l, "parseHTML", d));
|
|
325
|
-
m && (h.parseDOM = m.map((g) =>
|
|
325
|
+
m && (h.parseDOM = m.map((g) => he(g, u)));
|
|
326
326
|
const f = w(l, "renderHTML", d);
|
|
327
327
|
return f && (h.toDOM = (g) => f({
|
|
328
328
|
mark: g,
|
|
329
|
-
HTMLAttributes:
|
|
329
|
+
HTMLAttributes: yt(g, u)
|
|
330
330
|
})), [l.name, h];
|
|
331
331
|
}));
|
|
332
|
-
return new
|
|
332
|
+
return new De({
|
|
333
333
|
topNode: i,
|
|
334
334
|
nodes: a,
|
|
335
335
|
marks: c
|
|
336
336
|
});
|
|
337
337
|
}
|
|
338
|
-
function
|
|
338
|
+
function Rt(e, t) {
|
|
339
339
|
return t.nodes[e] || t.marks[e] || null;
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function me(e, t) {
|
|
342
342
|
return Array.isArray(t) ? t.some((n) => (typeof n == "string" ? n : n.name) === e.name) : t;
|
|
343
343
|
}
|
|
344
|
-
function
|
|
345
|
-
const n =
|
|
344
|
+
function Xt(e, t) {
|
|
345
|
+
const n = gn.fromSchema(t).serializeFragment(e), s = document.implementation.createHTMLDocument().createElement("div");
|
|
346
346
|
return s.appendChild(n), s.innerHTML;
|
|
347
347
|
}
|
|
348
|
-
const
|
|
348
|
+
const Er = (e, t = 500) => {
|
|
349
349
|
let n = "";
|
|
350
350
|
const r = e.parentOffset;
|
|
351
351
|
return e.parent.nodesBetween(Math.max(0, r - t), r, (s, o, i, a) => {
|
|
@@ -359,16 +359,16 @@ const kr = (e, t = 500) => {
|
|
|
359
359
|
n += s.isAtom && !s.isText ? u : u.slice(0, Math.max(0, r - o));
|
|
360
360
|
}), n;
|
|
361
361
|
};
|
|
362
|
-
function
|
|
362
|
+
function Qt(e) {
|
|
363
363
|
return Object.prototype.toString.call(e) === "[object RegExp]";
|
|
364
364
|
}
|
|
365
|
-
class
|
|
365
|
+
class kt {
|
|
366
366
|
constructor(t) {
|
|
367
367
|
this.find = t.find, this.handler = t.handler;
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
const
|
|
371
|
-
if (
|
|
370
|
+
const Tr = (e, t) => {
|
|
371
|
+
if (Qt(t))
|
|
372
372
|
return t.exec(e);
|
|
373
373
|
const n = t(e);
|
|
374
374
|
if (!n)
|
|
@@ -376,7 +376,7 @@ const Er = (e, t) => {
|
|
|
376
376
|
const r = [n.text];
|
|
377
377
|
return r.index = n.index, r.input = e, r.data = n.data, n.replaceWith && (n.text.includes(n.replaceWith) || console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'), r.push(n.replaceWith)), r;
|
|
378
378
|
};
|
|
379
|
-
function
|
|
379
|
+
function lt(e) {
|
|
380
380
|
var t;
|
|
381
381
|
const { editor: n, from: r, to: s, text: o, rules: i, plugin: a } = e, { view: c } = n;
|
|
382
382
|
if (c.composing)
|
|
@@ -388,20 +388,20 @@ function at(e) {
|
|
|
388
388
|
)
|
|
389
389
|
return !1;
|
|
390
390
|
let u = !1;
|
|
391
|
-
const d =
|
|
391
|
+
const d = Er(l) + o;
|
|
392
392
|
return i.forEach((p) => {
|
|
393
393
|
if (u)
|
|
394
394
|
return;
|
|
395
|
-
const h =
|
|
395
|
+
const h = Tr(d, p.find);
|
|
396
396
|
if (!h)
|
|
397
397
|
return;
|
|
398
|
-
const m = c.state.tr, f =
|
|
398
|
+
const m = c.state.tr, f = Mt({
|
|
399
399
|
state: c.state,
|
|
400
400
|
transaction: m
|
|
401
401
|
}), g = {
|
|
402
402
|
from: r - (h[0].length - o.length),
|
|
403
403
|
to: s
|
|
404
|
-
}, { commands: y, chain: M, can: b } = new
|
|
404
|
+
}, { commands: y, chain: M, can: b } = new St({
|
|
405
405
|
editor: n,
|
|
406
406
|
state: f
|
|
407
407
|
});
|
|
@@ -420,7 +420,7 @@ function at(e) {
|
|
|
420
420
|
}), c.dispatch(m), u = !0);
|
|
421
421
|
}), u;
|
|
422
422
|
}
|
|
423
|
-
function
|
|
423
|
+
function Cr(e) {
|
|
424
424
|
const { editor: t, rules: n } = e, r = new $({
|
|
425
425
|
state: {
|
|
426
426
|
init() {
|
|
@@ -433,9 +433,9 @@ function Tr(e) {
|
|
|
433
433
|
const c = s.getMeta("applyInputRules");
|
|
434
434
|
return !!c && setTimeout(() => {
|
|
435
435
|
let { text: u } = c;
|
|
436
|
-
typeof u == "string" ? u = u : u =
|
|
436
|
+
typeof u == "string" ? u = u : u = Xt(K.from(u), i.schema);
|
|
437
437
|
const { from: d } = c, p = d + u.length;
|
|
438
|
-
|
|
438
|
+
lt({
|
|
439
439
|
editor: t,
|
|
440
440
|
from: d,
|
|
441
441
|
to: p,
|
|
@@ -448,7 +448,7 @@ function Tr(e) {
|
|
|
448
448
|
},
|
|
449
449
|
props: {
|
|
450
450
|
handleTextInput(s, o, i, a) {
|
|
451
|
-
return
|
|
451
|
+
return lt({
|
|
452
452
|
editor: t,
|
|
453
453
|
from: o,
|
|
454
454
|
to: i,
|
|
@@ -460,7 +460,7 @@ function Tr(e) {
|
|
|
460
460
|
handleDOMEvents: {
|
|
461
461
|
compositionend: (s) => (setTimeout(() => {
|
|
462
462
|
const { $cursor: o } = s.state.selection;
|
|
463
|
-
o &&
|
|
463
|
+
o && lt({
|
|
464
464
|
editor: t,
|
|
465
465
|
from: o.pos,
|
|
466
466
|
to: o.pos,
|
|
@@ -476,7 +476,7 @@ function Tr(e) {
|
|
|
476
476
|
if (o.key !== "Enter")
|
|
477
477
|
return !1;
|
|
478
478
|
const { $cursor: i } = s.state.selection;
|
|
479
|
-
return i ?
|
|
479
|
+
return i ? lt({
|
|
480
480
|
editor: t,
|
|
481
481
|
from: i.pos,
|
|
482
482
|
to: i.pos,
|
|
@@ -492,16 +492,16 @@ function Tr(e) {
|
|
|
492
492
|
});
|
|
493
493
|
return r;
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function xr(e) {
|
|
496
496
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
497
497
|
}
|
|
498
|
-
function
|
|
499
|
-
return
|
|
498
|
+
function ct(e) {
|
|
499
|
+
return xr(e) !== "Object" ? !1 : e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
|
|
500
500
|
}
|
|
501
|
-
function
|
|
501
|
+
function Et(e, t) {
|
|
502
502
|
const n = { ...e };
|
|
503
|
-
return
|
|
504
|
-
|
|
503
|
+
return ct(e) && ct(t) && Object.keys(t).forEach((r) => {
|
|
504
|
+
ct(t[r]) && ct(e[r]) ? n[r] = Et(e[r], t[r]) : n[r] = t[r];
|
|
505
505
|
}), n;
|
|
506
506
|
}
|
|
507
507
|
class N {
|
|
@@ -525,7 +525,7 @@ class N {
|
|
|
525
525
|
configure(t = {}) {
|
|
526
526
|
const n = this.extend({
|
|
527
527
|
...this.config,
|
|
528
|
-
addOptions: () =>
|
|
528
|
+
addOptions: () => Et(this.options, t)
|
|
529
529
|
});
|
|
530
530
|
return n.name = this.name, n.parent = this.parent, n;
|
|
531
531
|
}
|
|
@@ -550,16 +550,16 @@ class N {
|
|
|
550
550
|
return !1;
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
|
-
function
|
|
553
|
+
function Ar(e) {
|
|
554
554
|
return typeof e == "number";
|
|
555
555
|
}
|
|
556
|
-
class
|
|
556
|
+
class Ke {
|
|
557
557
|
constructor(t) {
|
|
558
558
|
this.find = t.find, this.handler = t.handler;
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
|
-
const
|
|
562
|
-
if (
|
|
561
|
+
const Or = (e, t, n) => {
|
|
562
|
+
if (Qt(t))
|
|
563
563
|
return [...e.matchAll(t)];
|
|
564
564
|
const r = t(e, n);
|
|
565
565
|
return r ? r.map((s) => {
|
|
@@ -567,8 +567,8 @@ const Ar = (e, t, n) => {
|
|
|
567
567
|
return o.index = s.index, o.input = e, o.data = s.data, s.replaceWith && (s.text.includes(s.replaceWith) || console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'), o.push(s.replaceWith)), o;
|
|
568
568
|
}) : [];
|
|
569
569
|
};
|
|
570
|
-
function
|
|
571
|
-
const { editor: t, state: n, from: r, to: s, rule: o, pasteEvent: i, dropEvent: a } = e, { commands: c, chain: l, can: u } = new
|
|
570
|
+
function Lr(e) {
|
|
571
|
+
const { editor: t, state: n, from: r, to: s, rule: o, pasteEvent: i, dropEvent: a } = e, { commands: c, chain: l, can: u } = new St({
|
|
572
572
|
editor: t,
|
|
573
573
|
state: n
|
|
574
574
|
}), d = [];
|
|
@@ -576,7 +576,7 @@ function Or(e) {
|
|
|
576
576
|
if (!h.isTextblock || h.type.spec.code)
|
|
577
577
|
return;
|
|
578
578
|
const f = Math.max(r, m), g = Math.min(s, m + h.content.size), y = h.textBetween(f - m, g - m, void 0, "");
|
|
579
|
-
|
|
579
|
+
Or(y, o.find, i).forEach((b) => {
|
|
580
580
|
if (b.index === void 0)
|
|
581
581
|
return;
|
|
582
582
|
const v = f + b.index + 1, k = v + b[0].length, S = {
|
|
@@ -596,15 +596,15 @@ function Or(e) {
|
|
|
596
596
|
});
|
|
597
597
|
}), d.every((h) => h !== null);
|
|
598
598
|
}
|
|
599
|
-
let
|
|
600
|
-
const
|
|
599
|
+
let dt = null;
|
|
600
|
+
const Pr = (e) => {
|
|
601
601
|
var t;
|
|
602
602
|
const n = new ClipboardEvent("paste", {
|
|
603
603
|
clipboardData: new DataTransfer()
|
|
604
604
|
});
|
|
605
605
|
return (t = n.clipboardData) === null || t === void 0 || t.setData("text/html", e), n;
|
|
606
606
|
};
|
|
607
|
-
function
|
|
607
|
+
function Rr(e) {
|
|
608
608
|
const { editor: t, rules: n } = e;
|
|
609
609
|
let r = null, s = !1, o = !1, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, a;
|
|
610
610
|
try {
|
|
@@ -613,11 +613,11 @@ function Pr(e) {
|
|
|
613
613
|
a = null;
|
|
614
614
|
}
|
|
615
615
|
const c = ({ state: u, from: d, to: p, rule: h, pasteEvt: m }) => {
|
|
616
|
-
const f = u.tr, g =
|
|
616
|
+
const f = u.tr, g = Mt({
|
|
617
617
|
state: u,
|
|
618
618
|
transaction: f
|
|
619
619
|
});
|
|
620
|
-
if (!(!
|
|
620
|
+
if (!(!Lr({
|
|
621
621
|
editor: t,
|
|
622
622
|
state: g,
|
|
623
623
|
from: Math.max(d - 1, 0),
|
|
@@ -639,9 +639,9 @@ function Pr(e) {
|
|
|
639
639
|
view(d) {
|
|
640
640
|
const p = (m) => {
|
|
641
641
|
var f;
|
|
642
|
-
r = !((f = d.dom.parentElement) === null || f === void 0) && f.contains(m.target) ? d.dom.parentElement : null, r && (
|
|
642
|
+
r = !((f = d.dom.parentElement) === null || f === void 0) && f.contains(m.target) ? d.dom.parentElement : null, r && (dt = t);
|
|
643
643
|
}, h = () => {
|
|
644
|
-
|
|
644
|
+
dt && (dt = null);
|
|
645
645
|
};
|
|
646
646
|
return window.addEventListener("dragstart", p), window.addEventListener("dragend", h), {
|
|
647
647
|
destroy() {
|
|
@@ -653,7 +653,7 @@ function Pr(e) {
|
|
|
653
653
|
handleDOMEvents: {
|
|
654
654
|
drop: (d, p) => {
|
|
655
655
|
if (o = r === d.dom.parentElement, a = p, !o) {
|
|
656
|
-
const h =
|
|
656
|
+
const h = dt;
|
|
657
657
|
h && setTimeout(() => {
|
|
658
658
|
const m = h.state.selection;
|
|
659
659
|
m && h.commands.deleteRange({ from: m.from, to: m.to });
|
|
@@ -674,8 +674,8 @@ function Pr(e) {
|
|
|
674
674
|
return;
|
|
675
675
|
if (M) {
|
|
676
676
|
let { text: k } = y;
|
|
677
|
-
typeof k == "string" ? k = k : k =
|
|
678
|
-
const { from: S } = y, T = S + k.length, A =
|
|
677
|
+
typeof k == "string" ? k = k : k = Xt(K.from(k), h.schema);
|
|
678
|
+
const { from: S } = y, T = S + k.length, A = Pr(k);
|
|
679
679
|
return c({
|
|
680
680
|
rule: u,
|
|
681
681
|
state: h,
|
|
@@ -685,7 +685,7 @@ function Pr(e) {
|
|
|
685
685
|
});
|
|
686
686
|
}
|
|
687
687
|
const b = p.doc.content.findDiffStart(h.doc.content), v = p.doc.content.findDiffEnd(h.doc.content);
|
|
688
|
-
if (!(!
|
|
688
|
+
if (!(!Ar(b) || !v || b === v.b))
|
|
689
689
|
return c({
|
|
690
690
|
rule: u,
|
|
691
691
|
state: h,
|
|
@@ -696,13 +696,13 @@ function Pr(e) {
|
|
|
696
696
|
}
|
|
697
697
|
}));
|
|
698
698
|
}
|
|
699
|
-
function
|
|
699
|
+
function $r(e) {
|
|
700
700
|
const t = e.filter((n, r) => e.indexOf(n) !== r);
|
|
701
701
|
return Array.from(new Set(t));
|
|
702
702
|
}
|
|
703
703
|
class tt {
|
|
704
704
|
constructor(t, n) {
|
|
705
|
-
this.splittableMarks = [], this.editor = n, this.extensions = tt.resolve(t), this.schema =
|
|
705
|
+
this.splittableMarks = [], this.editor = n, this.extensions = tt.resolve(t), this.schema = kr(this.extensions, n), this.setupExtensions();
|
|
706
706
|
}
|
|
707
707
|
/**
|
|
708
708
|
* Returns a flattened and sorted extension list while
|
|
@@ -711,7 +711,7 @@ class tt {
|
|
|
711
711
|
* @returns An flattened and sorted array of Tiptap extensions
|
|
712
712
|
*/
|
|
713
713
|
static resolve(t) {
|
|
714
|
-
const n = tt.sort(tt.flatten(t)), r =
|
|
714
|
+
const n = tt.sort(tt.flatten(t)), r = $r(n.map((s) => s.name));
|
|
715
715
|
return r.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map((s) => `'${s}'`).join(", ")}]. This can lead to issues.`), n;
|
|
716
716
|
}
|
|
717
717
|
/**
|
|
@@ -751,7 +751,7 @@ class tt {
|
|
|
751
751
|
options: n.options,
|
|
752
752
|
storage: n.storage,
|
|
753
753
|
editor: this.editor,
|
|
754
|
-
type:
|
|
754
|
+
type: Rt(n.name, this.schema)
|
|
755
755
|
}, s = w(n, "addCommands", r);
|
|
756
756
|
return s ? {
|
|
757
757
|
...t,
|
|
@@ -770,19 +770,19 @@ class tt {
|
|
|
770
770
|
options: i.options,
|
|
771
771
|
storage: i.storage,
|
|
772
772
|
editor: t,
|
|
773
|
-
type:
|
|
773
|
+
type: Rt(i.name, this.schema)
|
|
774
774
|
}, c = [], l = w(i, "addKeyboardShortcuts", a);
|
|
775
775
|
let u = {};
|
|
776
776
|
if (i.type === "mark" && w(i, "exitable", a) && (u.ArrowRight = () => N.handleExit({ editor: t, mark: i })), l) {
|
|
777
777
|
const f = Object.fromEntries(Object.entries(l()).map(([g, y]) => [g, () => y({ editor: t })]));
|
|
778
778
|
u = { ...u, ...f };
|
|
779
779
|
}
|
|
780
|
-
const d =
|
|
780
|
+
const d = mn(u);
|
|
781
781
|
c.push(d);
|
|
782
782
|
const p = w(i, "addInputRules", a);
|
|
783
|
-
|
|
783
|
+
me(i, t.options.enableInputRules) && p && r.push(...p());
|
|
784
784
|
const h = w(i, "addPasteRules", a);
|
|
785
|
-
|
|
785
|
+
me(i, t.options.enablePasteRules) && h && s.push(...h());
|
|
786
786
|
const m = w(i, "addProseMirrorPlugins", a);
|
|
787
787
|
if (m) {
|
|
788
788
|
const f = m();
|
|
@@ -791,11 +791,11 @@ class tt {
|
|
|
791
791
|
return c;
|
|
792
792
|
}).flat();
|
|
793
793
|
return [
|
|
794
|
-
|
|
794
|
+
Cr({
|
|
795
795
|
editor: t,
|
|
796
796
|
rules: r
|
|
797
797
|
}),
|
|
798
|
-
...
|
|
798
|
+
...Rr({
|
|
799
799
|
editor: t,
|
|
800
800
|
rules: s
|
|
801
801
|
}),
|
|
@@ -807,14 +807,14 @@ class tt {
|
|
|
807
807
|
* @returns An array of attributes
|
|
808
808
|
*/
|
|
809
809
|
get attributes() {
|
|
810
|
-
return
|
|
810
|
+
return Ve(this.extensions);
|
|
811
811
|
}
|
|
812
812
|
/**
|
|
813
813
|
* Get all node views from the extensions.
|
|
814
814
|
* @returns An object with all node views where the key is the node name and the value is the node view function
|
|
815
815
|
*/
|
|
816
816
|
get nodeViews() {
|
|
817
|
-
const { editor: t } = this, { nodeExtensions: n } =
|
|
817
|
+
const { editor: t } = this, { nodeExtensions: n } = wt(this.extensions);
|
|
818
818
|
return Object.fromEntries(n.filter((r) => !!w(r, "addNodeView")).map((r) => {
|
|
819
819
|
const s = this.attributes.filter((c) => c.type === r.name), o = {
|
|
820
820
|
name: r.name,
|
|
@@ -826,7 +826,7 @@ class tt {
|
|
|
826
826
|
if (!i)
|
|
827
827
|
return [];
|
|
828
828
|
const a = (c, l, u, d, p) => {
|
|
829
|
-
const h =
|
|
829
|
+
const h = yt(c, s);
|
|
830
830
|
return i()({
|
|
831
831
|
// pass-through
|
|
832
832
|
node: c,
|
|
@@ -856,7 +856,7 @@ class tt {
|
|
|
856
856
|
options: t.options,
|
|
857
857
|
storage: t.storage,
|
|
858
858
|
editor: this.editor,
|
|
859
|
-
type:
|
|
859
|
+
type: Rt(t.name, this.schema)
|
|
860
860
|
};
|
|
861
861
|
t.type === "mark" && (!((n = E(w(t, "keepOnSplit", r))) !== null && n !== void 0) || n) && this.splittableMarks.push(t.name);
|
|
862
862
|
const s = w(t, "onBeforeCreate", r), o = w(t, "onCreate", r), i = w(t, "onUpdate", r), a = w(t, "onSelectionUpdate", r), c = w(t, "onTransaction", r), l = w(t, "onFocus", r), u = w(t, "onBlur", r), d = w(t, "onDestroy", r);
|
|
@@ -885,7 +885,7 @@ class R {
|
|
|
885
885
|
configure(t = {}) {
|
|
886
886
|
const n = this.extend({
|
|
887
887
|
...this.config,
|
|
888
|
-
addOptions: () =>
|
|
888
|
+
addOptions: () => Et(this.options, t)
|
|
889
889
|
});
|
|
890
890
|
return n.name = this.name, n.parent = this.parent, n;
|
|
891
891
|
}
|
|
@@ -899,7 +899,7 @@ class R {
|
|
|
899
899
|
})), n;
|
|
900
900
|
}
|
|
901
901
|
}
|
|
902
|
-
function
|
|
902
|
+
function Ue(e, t, n) {
|
|
903
903
|
const { from: r, to: s } = t, { blockSeparator: o = `
|
|
904
904
|
|
|
905
905
|
`, textSerializers: i = {} } = n || {};
|
|
@@ -919,10 +919,10 @@ function Ke(e, t, n) {
|
|
|
919
919
|
c.isText && (a += (p = c == null ? void 0 : c.text) === null || p === void 0 ? void 0 : p.slice(Math.max(r, l) - l, s - l));
|
|
920
920
|
}), a;
|
|
921
921
|
}
|
|
922
|
-
function
|
|
922
|
+
function qe(e) {
|
|
923
923
|
return Object.fromEntries(Object.entries(e.nodes).filter(([, t]) => t.spec.toText).map(([t, n]) => [t, n.spec.toText]));
|
|
924
924
|
}
|
|
925
|
-
const
|
|
925
|
+
const _r = R.create({
|
|
926
926
|
name: "clipboardTextSerializer",
|
|
927
927
|
addOptions() {
|
|
928
928
|
return {
|
|
@@ -935,8 +935,8 @@ const $r = R.create({
|
|
|
935
935
|
key: new _("clipboardTextSerializer"),
|
|
936
936
|
props: {
|
|
937
937
|
clipboardTextSerializer: () => {
|
|
938
|
-
const { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: s } = t, { ranges: o } = s, i = Math.min(...o.map((u) => u.$from.pos)), a = Math.max(...o.map((u) => u.$to.pos)), c =
|
|
939
|
-
return
|
|
938
|
+
const { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: s } = t, { ranges: o } = s, i = Math.min(...o.map((u) => u.$from.pos)), a = Math.max(...o.map((u) => u.$to.pos)), c = qe(n);
|
|
939
|
+
return Ue(r, { from: i, to: a }, {
|
|
940
940
|
...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
|
|
941
941
|
textSerializers: c
|
|
942
942
|
});
|
|
@@ -945,10 +945,10 @@ const $r = R.create({
|
|
|
945
945
|
})
|
|
946
946
|
];
|
|
947
947
|
}
|
|
948
|
-
}),
|
|
948
|
+
}), Hr = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
|
|
949
949
|
var n;
|
|
950
950
|
e.isDestroyed || (t.dom.blur(), (n = window == null ? void 0 : window.getSelection()) === null || n === void 0 || n.removeAllRanges());
|
|
951
|
-
}), !0),
|
|
951
|
+
}), !0), Dr = (e = !1) => ({ commands: t }) => t.setContent("", e), Ir = () => ({ state: e, tr: t, dispatch: n }) => {
|
|
952
952
|
const { selection: r } = t, { ranges: s } = r;
|
|
953
953
|
return n && s.forEach(({ $from: o, $to: i }) => {
|
|
954
954
|
e.doc.nodesBetween(o.pos, i.pos, (a, c) => {
|
|
@@ -957,7 +957,7 @@ const $r = R.create({
|
|
|
957
957
|
const { doc: l, mapping: u } = t, d = l.resolve(u.map(c)), p = l.resolve(u.map(c + a.nodeSize)), h = d.blockRange(p);
|
|
958
958
|
if (!h)
|
|
959
959
|
return;
|
|
960
|
-
const m =
|
|
960
|
+
const m = zn(h);
|
|
961
961
|
if (a.type.isTextblock) {
|
|
962
962
|
const { defaultType: f } = d.parent.contentMatchAt(d.index());
|
|
963
963
|
t.setNodeMarkup(h.start, f);
|
|
@@ -965,12 +965,12 @@ const $r = R.create({
|
|
|
965
965
|
(m || m === 0) && t.lift(h, m);
|
|
966
966
|
});
|
|
967
967
|
}), !0;
|
|
968
|
-
},
|
|
968
|
+
}, Nr = (e) => (t) => e(t), Br = () => ({ state: e, dispatch: t }) => jn(e, t), jr = (e, t) => ({ editor: n, tr: r }) => {
|
|
969
969
|
const { state: s } = n, o = s.doc.slice(e.from, e.to);
|
|
970
970
|
r.deleteRange(e.from, e.to);
|
|
971
971
|
const i = r.mapping.map(t);
|
|
972
972
|
return r.insert(i, o.content), r.setSelection(new I(r.doc.resolve(i - 1))), !0;
|
|
973
|
-
},
|
|
973
|
+
}, zr = () => ({ tr: e, dispatch: t }) => {
|
|
974
974
|
const { selection: n } = e, r = n.$anchor.node();
|
|
975
975
|
if (r.content.size > 0)
|
|
976
976
|
return !1;
|
|
@@ -995,35 +995,35 @@ const $r = R.create({
|
|
|
995
995
|
return !0;
|
|
996
996
|
}
|
|
997
997
|
return !1;
|
|
998
|
-
},
|
|
998
|
+
}, Vr = (e) => ({ tr: t, dispatch: n }) => {
|
|
999
999
|
const { from: r, to: s } = e;
|
|
1000
1000
|
return n && t.delete(r, s), !0;
|
|
1001
|
-
},
|
|
1002
|
-
function
|
|
1001
|
+
}, Wr = () => ({ state: e, dispatch: t }) => Bn(e, t), Kr = () => ({ commands: e }) => e.keyboardShortcut("Enter"), Ur = () => ({ state: e, dispatch: t }) => Nn(e, t);
|
|
1002
|
+
function vt(e, t, n = { strict: !0 }) {
|
|
1003
1003
|
const r = Object.keys(t);
|
|
1004
|
-
return r.length ? r.every((s) => n.strict ? t[s] === e[s] :
|
|
1004
|
+
return r.length ? r.every((s) => n.strict ? t[s] === e[s] : Qt(t[s]) ? t[s].test(e[s]) : t[s] === e[s]) : !0;
|
|
1005
1005
|
}
|
|
1006
|
-
function
|
|
1007
|
-
return e.find((r) => r.type === t &&
|
|
1006
|
+
function Ge(e, t, n = {}) {
|
|
1007
|
+
return e.find((r) => r.type === t && vt(
|
|
1008
1008
|
// Only check equality for the attributes that are provided
|
|
1009
1009
|
Object.fromEntries(Object.keys(n).map((s) => [s, r.attrs[s]])),
|
|
1010
1010
|
n
|
|
1011
1011
|
));
|
|
1012
1012
|
}
|
|
1013
|
-
function
|
|
1014
|
-
return !!
|
|
1013
|
+
function ge(e, t, n = {}) {
|
|
1014
|
+
return !!Ge(e, t, n);
|
|
1015
1015
|
}
|
|
1016
|
-
function
|
|
1016
|
+
function Zt(e, t, n) {
|
|
1017
1017
|
var r;
|
|
1018
1018
|
if (!e || !t)
|
|
1019
1019
|
return;
|
|
1020
1020
|
let s = e.parent.childAfter(e.parentOffset);
|
|
1021
|
-
if ((!s.node || !s.node.marks.some((u) => u.type === t)) && (s = e.parent.childBefore(e.parentOffset)), !s.node || !s.node.marks.some((u) => u.type === t) || (n = n || ((r = s.node.marks[0]) === null || r === void 0 ? void 0 : r.attrs), !
|
|
1021
|
+
if ((!s.node || !s.node.marks.some((u) => u.type === t)) && (s = e.parent.childBefore(e.parentOffset)), !s.node || !s.node.marks.some((u) => u.type === t) || (n = n || ((r = s.node.marks[0]) === null || r === void 0 ? void 0 : r.attrs), !Ge([...s.node.marks], t, n)))
|
|
1022
1022
|
return;
|
|
1023
1023
|
let i = s.index, a = e.start() + s.offset, c = i + 1, l = a + s.node.nodeSize;
|
|
1024
|
-
for (; i > 0 &&
|
|
1024
|
+
for (; i > 0 && ge([...e.parent.child(i - 1).marks], t, n); )
|
|
1025
1025
|
i -= 1, a -= e.parent.child(i).nodeSize;
|
|
1026
|
-
for (; c < e.parent.childCount &&
|
|
1026
|
+
for (; c < e.parent.childCount && ge([...e.parent.child(c).marks], t, n); )
|
|
1027
1027
|
l += e.parent.child(c).nodeSize, c += 1;
|
|
1028
1028
|
return {
|
|
1029
1029
|
from: a,
|
|
@@ -1038,30 +1038,30 @@ function q(e, t) {
|
|
|
1038
1038
|
}
|
|
1039
1039
|
return e;
|
|
1040
1040
|
}
|
|
1041
|
-
const
|
|
1041
|
+
const qr = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1042
1042
|
const o = q(e, r.schema), { doc: i, selection: a } = n, { $from: c, from: l, to: u } = a;
|
|
1043
1043
|
if (s) {
|
|
1044
|
-
const d =
|
|
1044
|
+
const d = Zt(c, o, t);
|
|
1045
1045
|
if (d && d.from <= l && d.to >= u) {
|
|
1046
1046
|
const p = I.create(i, d.from, d.to);
|
|
1047
1047
|
n.setSelection(p);
|
|
1048
1048
|
}
|
|
1049
1049
|
}
|
|
1050
1050
|
return !0;
|
|
1051
|
-
},
|
|
1051
|
+
}, Gr = (e) => (t) => {
|
|
1052
1052
|
const n = typeof e == "function" ? e(t) : e;
|
|
1053
1053
|
for (let r = 0; r < n.length; r += 1)
|
|
1054
1054
|
if (n[r](t))
|
|
1055
1055
|
return !0;
|
|
1056
1056
|
return !1;
|
|
1057
1057
|
};
|
|
1058
|
-
function
|
|
1058
|
+
function te(e) {
|
|
1059
1059
|
return e instanceof I;
|
|
1060
1060
|
}
|
|
1061
|
-
function
|
|
1061
|
+
function F(e = 0, t = 0, n = 0) {
|
|
1062
1062
|
return Math.min(Math.max(e, t), n);
|
|
1063
1063
|
}
|
|
1064
|
-
function
|
|
1064
|
+
function Je(e, t = null) {
|
|
1065
1065
|
if (!t)
|
|
1066
1066
|
return null;
|
|
1067
1067
|
const n = W.atStart(e), r = W.atEnd(e);
|
|
@@ -1070,12 +1070,12 @@ function Ge(e, t = null) {
|
|
|
1070
1070
|
if (t === "end")
|
|
1071
1071
|
return r;
|
|
1072
1072
|
const s = n.from, o = r.to;
|
|
1073
|
-
return t === "all" ? I.create(e,
|
|
1073
|
+
return t === "all" ? I.create(e, F(0, s, o), F(e.content.size, s, o)) : I.create(e, F(t, s, o), F(t, s, o));
|
|
1074
1074
|
}
|
|
1075
|
-
function
|
|
1075
|
+
function Ye() {
|
|
1076
1076
|
return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1078
|
+
function Tt() {
|
|
1079
1079
|
return [
|
|
1080
1080
|
"iPad Simulator",
|
|
1081
1081
|
"iPhone Simulator",
|
|
@@ -1085,36 +1085,36 @@ function Et() {
|
|
|
1085
1085
|
"iPod"
|
|
1086
1086
|
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
1087
1087
|
}
|
|
1088
|
-
const
|
|
1088
|
+
const Jr = (e = null, t = {}) => ({ editor: n, view: r, tr: s, dispatch: o }) => {
|
|
1089
1089
|
t = {
|
|
1090
1090
|
scrollIntoView: !0,
|
|
1091
1091
|
...t
|
|
1092
1092
|
};
|
|
1093
1093
|
const i = () => {
|
|
1094
|
-
(
|
|
1094
|
+
(Tt() || Ye()) && r.dom.focus(), requestAnimationFrame(() => {
|
|
1095
1095
|
n.isDestroyed || (r.focus(), t != null && t.scrollIntoView && n.commands.scrollIntoView());
|
|
1096
1096
|
});
|
|
1097
1097
|
};
|
|
1098
1098
|
if (r.hasFocus() && e === null || e === !1)
|
|
1099
1099
|
return !0;
|
|
1100
|
-
if (o && e === null && !
|
|
1100
|
+
if (o && e === null && !te(n.state.selection))
|
|
1101
1101
|
return i(), !0;
|
|
1102
|
-
const a =
|
|
1102
|
+
const a = Je(s.doc, e) || n.state.selection, c = n.state.selection.eq(a);
|
|
1103
1103
|
return o && (c || s.setSelection(a), c && s.storedMarks && s.setStoredMarks(s.storedMarks), i()), !0;
|
|
1104
|
-
},
|
|
1104
|
+
}, Yr = (e, t) => (n) => e.every((r, s) => t(r, { ...n, index: s })), Xr = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({ from: n.selection.from, to: n.selection.to }, e, t), Xe = (e) => {
|
|
1105
1105
|
const t = e.childNodes;
|
|
1106
1106
|
for (let n = t.length - 1; n >= 0; n -= 1) {
|
|
1107
1107
|
const r = t[n];
|
|
1108
|
-
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 &&
|
|
1108
|
+
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Xe(r);
|
|
1109
1109
|
}
|
|
1110
1110
|
return e;
|
|
1111
1111
|
};
|
|
1112
|
-
function
|
|
1112
|
+
function ut(e) {
|
|
1113
1113
|
const t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
|
|
1114
|
-
return
|
|
1114
|
+
return Xe(n);
|
|
1115
1115
|
}
|
|
1116
|
-
function
|
|
1117
|
-
if (e instanceof
|
|
1116
|
+
function bt(e, t, n) {
|
|
1117
|
+
if (e instanceof yn || e instanceof K)
|
|
1118
1118
|
return e;
|
|
1119
1119
|
n = {
|
|
1120
1120
|
slice: !0,
|
|
@@ -1131,12 +1131,12 @@ function vt(e, t, n) {
|
|
|
1131
1131
|
} catch (o) {
|
|
1132
1132
|
if (n.errorOnInvalidContent)
|
|
1133
1133
|
throw new Error("[tiptap error]: Invalid JSON content", { cause: o });
|
|
1134
|
-
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", o),
|
|
1134
|
+
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", o), bt("", t, n);
|
|
1135
1135
|
}
|
|
1136
1136
|
if (s) {
|
|
1137
1137
|
if (n.errorOnInvalidContent) {
|
|
1138
1138
|
let i = !1, a = "";
|
|
1139
|
-
const c = new
|
|
1139
|
+
const c = new De({
|
|
1140
1140
|
topNode: t.spec.topNode,
|
|
1141
1141
|
marks: t.spec.marks,
|
|
1142
1142
|
// Prosemirror's schemas are executed such that: the last to execute, matches last
|
|
@@ -1154,20 +1154,20 @@ function vt(e, t, n) {
|
|
|
1154
1154
|
}
|
|
1155
1155
|
})
|
|
1156
1156
|
});
|
|
1157
|
-
if (n.slice ?
|
|
1157
|
+
if (n.slice ? Pt.fromSchema(c).parseSlice(ut(e), n.parseOptions) : Pt.fromSchema(c).parse(ut(e), n.parseOptions), n.errorOnInvalidContent && i)
|
|
1158
1158
|
throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${a}`) });
|
|
1159
1159
|
}
|
|
1160
|
-
const o =
|
|
1161
|
-
return n.slice ? o.parseSlice(
|
|
1160
|
+
const o = Pt.fromSchema(t);
|
|
1161
|
+
return n.slice ? o.parseSlice(ut(e), n.parseOptions).content : o.parse(ut(e), n.parseOptions);
|
|
1162
1162
|
}
|
|
1163
|
-
return
|
|
1163
|
+
return bt("", t, n);
|
|
1164
1164
|
}
|
|
1165
|
-
function
|
|
1165
|
+
function Qr(e, t, n) {
|
|
1166
1166
|
const r = e.steps.length - 1;
|
|
1167
1167
|
if (r < t)
|
|
1168
1168
|
return;
|
|
1169
1169
|
const s = e.steps[r];
|
|
1170
|
-
if (!(s instanceof Fn || s instanceof
|
|
1170
|
+
if (!(s instanceof Fn || s instanceof Vn))
|
|
1171
1171
|
return;
|
|
1172
1172
|
const o = e.mapping.maps[r];
|
|
1173
1173
|
let i = 0;
|
|
@@ -1175,7 +1175,7 @@ function Xr(e, t, n) {
|
|
|
1175
1175
|
i === 0 && (i = u);
|
|
1176
1176
|
}), e.setSelection(W.near(e.doc.resolve(i), n));
|
|
1177
1177
|
}
|
|
1178
|
-
const
|
|
1178
|
+
const Zr = (e) => !("type" in e), ts = (e, t, n) => ({ tr: r, dispatch: s, editor: o }) => {
|
|
1179
1179
|
var i;
|
|
1180
1180
|
if (s) {
|
|
1181
1181
|
n = {
|
|
@@ -1187,7 +1187,7 @@ const Qr = (e) => !("type" in e), Zr = (e, t, n) => ({ tr: r, dispatch: s, edito
|
|
|
1187
1187
|
};
|
|
1188
1188
|
let a;
|
|
1189
1189
|
try {
|
|
1190
|
-
a =
|
|
1190
|
+
a = bt(t, o.schema, {
|
|
1191
1191
|
parseOptions: {
|
|
1192
1192
|
preserveWhitespace: "full",
|
|
1193
1193
|
...n.parseOptions
|
|
@@ -1204,7 +1204,7 @@ const Qr = (e) => !("type" in e), Zr = (e, t, n) => ({ tr: r, dispatch: s, edito
|
|
|
1204
1204
|
}), !1;
|
|
1205
1205
|
}
|
|
1206
1206
|
let { from: c, to: l } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, u = !0, d = !0;
|
|
1207
|
-
if ((
|
|
1207
|
+
if ((Zr(a) ? a : [a]).forEach((m) => {
|
|
1208
1208
|
m.check(), u = u ? m.isText && m.marks.length === 0 : !1, d = d ? m.isBlock : !1;
|
|
1209
1209
|
}), c === l && d) {
|
|
1210
1210
|
const { parent: m } = r.doc.resolve(c);
|
|
@@ -1223,28 +1223,28 @@ const Qr = (e) => !("type" in e), Zr = (e, t, n) => ({ tr: r, dispatch: s, edito
|
|
|
1223
1223
|
r.insertText(h, c, l);
|
|
1224
1224
|
} else
|
|
1225
1225
|
h = a, r.replaceWith(c, l, h);
|
|
1226
|
-
n.updateSelection &&
|
|
1226
|
+
n.updateSelection && Qr(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: c, text: h }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: c, text: h });
|
|
1227
1227
|
}
|
|
1228
1228
|
return !0;
|
|
1229
|
-
},
|
|
1229
|
+
}, es = () => ({ state: e, dispatch: t }) => Rn(e, t), ns = () => ({ state: e, dispatch: t }) => Dn(e, t), rs = () => ({ state: e, dispatch: t }) => In(e, t), ss = () => ({ state: e, dispatch: t }) => Hn(e, t), os = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
1230
1230
|
try {
|
|
1231
|
-
const r =
|
|
1231
|
+
const r = Ie(e.doc, e.selection.$from.pos, -1);
|
|
1232
1232
|
return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
1233
1233
|
} catch {
|
|
1234
1234
|
return !1;
|
|
1235
1235
|
}
|
|
1236
|
-
},
|
|
1236
|
+
}, is = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
1237
1237
|
try {
|
|
1238
|
-
const r =
|
|
1238
|
+
const r = Ie(e.doc, e.selection.$from.pos, 1);
|
|
1239
1239
|
return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
1240
1240
|
} catch {
|
|
1241
1241
|
return !1;
|
|
1242
1242
|
}
|
|
1243
|
-
},
|
|
1244
|
-
function
|
|
1243
|
+
}, as = () => ({ state: e, dispatch: t }) => _n(e, t), ls = () => ({ state: e, dispatch: t }) => $n(e, t);
|
|
1244
|
+
function Qe() {
|
|
1245
1245
|
return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
|
|
1246
1246
|
}
|
|
1247
|
-
function
|
|
1247
|
+
function cs(e) {
|
|
1248
1248
|
const t = e.split(/-(?!$)/);
|
|
1249
1249
|
let n = t[t.length - 1];
|
|
1250
1250
|
n === "Space" && (n = " ");
|
|
@@ -1260,14 +1260,14 @@ function ls(e) {
|
|
|
1260
1260
|
else if (/^s(hift)?$/i.test(c))
|
|
1261
1261
|
o = !0;
|
|
1262
1262
|
else if (/^mod$/i.test(c))
|
|
1263
|
-
|
|
1263
|
+
Tt() || Qe() ? i = !0 : s = !0;
|
|
1264
1264
|
else
|
|
1265
1265
|
throw new Error(`Unrecognized modifier name: ${c}`);
|
|
1266
1266
|
}
|
|
1267
1267
|
return r && (n = `Alt-${n}`), s && (n = `Ctrl-${n}`), i && (n = `Meta-${n}`), o && (n = `Shift-${n}`), n;
|
|
1268
1268
|
}
|
|
1269
|
-
const
|
|
1270
|
-
const o =
|
|
1269
|
+
const ds = (e) => ({ editor: t, view: n, tr: r, dispatch: s }) => {
|
|
1270
|
+
const o = cs(e).split(/-(?!$)/), i = o.find((l) => !["Alt", "Ctrl", "Meta", "Shift"].includes(l)), a = new KeyboardEvent("keydown", {
|
|
1271
1271
|
key: i === "Space" ? " " : i,
|
|
1272
1272
|
altKey: o.includes("Alt"),
|
|
1273
1273
|
ctrlKey: o.includes("Ctrl"),
|
|
@@ -1295,52 +1295,52 @@ function ot(e, t, n = {}) {
|
|
|
1295
1295
|
to: m
|
|
1296
1296
|
});
|
|
1297
1297
|
});
|
|
1298
|
-
const c = s - r, l = a.filter((d) => i ? i.name === d.node.type.name : !0).filter((d) =>
|
|
1298
|
+
const c = s - r, l = a.filter((d) => i ? i.name === d.node.type.name : !0).filter((d) => vt(d.node.attrs, n, { strict: !1 }));
|
|
1299
1299
|
return o ? !!l.length : l.reduce((d, p) => d + p.to - p.from, 0) >= c;
|
|
1300
1300
|
}
|
|
1301
|
-
const
|
|
1301
|
+
const us = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1302
1302
|
const s = H(e, n.schema);
|
|
1303
|
-
return ot(n, s, t) ?
|
|
1304
|
-
},
|
|
1303
|
+
return ot(n, s, t) ? Pn(n, r) : !1;
|
|
1304
|
+
}, ps = () => ({ state: e, dispatch: t }) => Ln(e, t), hs = (e) => ({ state: t, dispatch: n }) => {
|
|
1305
1305
|
const r = H(e, t.schema);
|
|
1306
|
-
return
|
|
1307
|
-
},
|
|
1308
|
-
function
|
|
1306
|
+
return On(r)(t, n);
|
|
1307
|
+
}, fs = () => ({ state: e, dispatch: t }) => An(e, t);
|
|
1308
|
+
function Ct(e, t) {
|
|
1309
1309
|
return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
|
|
1310
1310
|
}
|
|
1311
|
-
function
|
|
1311
|
+
function ye(e, t) {
|
|
1312
1312
|
const n = typeof t == "string" ? [t] : t;
|
|
1313
1313
|
return Object.keys(e).reduce((r, s) => (n.includes(s) || (r[s] = e[s]), r), {});
|
|
1314
1314
|
}
|
|
1315
|
-
const
|
|
1315
|
+
const ms = (e, t) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1316
1316
|
let o = null, i = null;
|
|
1317
|
-
const a =
|
|
1317
|
+
const a = Ct(typeof e == "string" ? e : e.name, r.schema);
|
|
1318
1318
|
return a ? (a === "node" && (o = H(e, r.schema)), a === "mark" && (i = q(e, r.schema)), s && n.selection.ranges.forEach((c) => {
|
|
1319
1319
|
r.doc.nodesBetween(c.$from.pos, c.$to.pos, (l, u) => {
|
|
1320
|
-
o && o === l.type && n.setNodeMarkup(u, void 0,
|
|
1321
|
-
i === d.type && n.addMark(u, u + l.nodeSize, i.create(
|
|
1320
|
+
o && o === l.type && n.setNodeMarkup(u, void 0, ye(l.attrs, t)), i && l.marks.length && l.marks.forEach((d) => {
|
|
1321
|
+
i === d.type && n.addMark(u, u + l.nodeSize, i.create(ye(d.attrs, t)));
|
|
1322
1322
|
});
|
|
1323
1323
|
});
|
|
1324
1324
|
}), !0) : !1;
|
|
1325
|
-
},
|
|
1325
|
+
}, gs = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), ys = () => ({ tr: e, dispatch: t }) => {
|
|
1326
1326
|
if (t) {
|
|
1327
|
-
const n = new
|
|
1327
|
+
const n = new xn(e.doc);
|
|
1328
1328
|
e.setSelection(n);
|
|
1329
1329
|
}
|
|
1330
1330
|
return !0;
|
|
1331
|
-
},
|
|
1332
|
-
function
|
|
1333
|
-
return
|
|
1331
|
+
}, vs = () => ({ state: e, dispatch: t }) => Cn(e, t), bs = () => ({ state: e, dispatch: t }) => Tn(e, t), Ms = () => ({ state: e, dispatch: t }) => En(e, t), Ss = () => ({ state: e, dispatch: t }) => kn(e, t), ws = () => ({ state: e, dispatch: t }) => wn(e, t);
|
|
1332
|
+
function jt(e, t, n = {}, r = {}) {
|
|
1333
|
+
return bt(e, t, {
|
|
1334
1334
|
slice: !1,
|
|
1335
1335
|
parseOptions: n,
|
|
1336
1336
|
errorOnInvalidContent: r.errorOnInvalidContent
|
|
1337
1337
|
});
|
|
1338
1338
|
}
|
|
1339
|
-
const
|
|
1339
|
+
const ks = (e, t = !1, n = {}, r = {}) => ({ editor: s, tr: o, dispatch: i, commands: a }) => {
|
|
1340
1340
|
var c, l;
|
|
1341
1341
|
const { doc: u } = o;
|
|
1342
1342
|
if (n.preserveWhitespace !== "full") {
|
|
1343
|
-
const d =
|
|
1343
|
+
const d = jt(e, s.schema, n, {
|
|
1344
1344
|
errorOnInvalidContent: (c = r.errorOnInvalidContent) !== null && c !== void 0 ? c : s.options.enableContentCheck
|
|
1345
1345
|
});
|
|
1346
1346
|
return i && o.replaceWith(0, u.content.size, d).setMeta("preventUpdate", !t), !0;
|
|
@@ -1350,7 +1350,7 @@ const ws = (e, t = !1, n = {}, r = {}) => ({ editor: s, tr: o, dispatch: i, comm
|
|
|
1350
1350
|
errorOnInvalidContent: (l = r.errorOnInvalidContent) !== null && l !== void 0 ? l : s.options.enableContentCheck
|
|
1351
1351
|
});
|
|
1352
1352
|
};
|
|
1353
|
-
function
|
|
1353
|
+
function Ze(e, t) {
|
|
1354
1354
|
const n = q(t, e.schema), { from: r, to: s, empty: o } = e.selection, i = [];
|
|
1355
1355
|
o ? (e.storedMarks && i.push(...e.storedMarks), i.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, s, (c) => {
|
|
1356
1356
|
i.push(...c.marks);
|
|
@@ -1358,15 +1358,15 @@ function Qe(e, t) {
|
|
|
1358
1358
|
const a = i.find((c) => c.type.name === n.name);
|
|
1359
1359
|
return a ? { ...a.attrs } : {};
|
|
1360
1360
|
}
|
|
1361
|
-
function
|
|
1362
|
-
const n = new
|
|
1361
|
+
function Es(e, t) {
|
|
1362
|
+
const n = new Kn(e);
|
|
1363
1363
|
return t.forEach((r) => {
|
|
1364
1364
|
r.steps.forEach((s) => {
|
|
1365
1365
|
n.step(s);
|
|
1366
1366
|
});
|
|
1367
1367
|
}), n;
|
|
1368
1368
|
}
|
|
1369
|
-
function
|
|
1369
|
+
function Ts(e) {
|
|
1370
1370
|
for (let t = 0; t < e.edgeCount; t += 1) {
|
|
1371
1371
|
const { type: n } = e.edge(t);
|
|
1372
1372
|
if (n.isTextblock && !n.hasRequiredAttrs())
|
|
@@ -1374,7 +1374,7 @@ function Es(e) {
|
|
|
1374
1374
|
}
|
|
1375
1375
|
return null;
|
|
1376
1376
|
}
|
|
1377
|
-
function
|
|
1377
|
+
function xi(e, t) {
|
|
1378
1378
|
const n = [];
|
|
1379
1379
|
return e.descendants((r, s) => {
|
|
1380
1380
|
t(r) && n.push({
|
|
@@ -1383,7 +1383,7 @@ function Ci(e, t) {
|
|
|
1383
1383
|
});
|
|
1384
1384
|
}), n;
|
|
1385
1385
|
}
|
|
1386
|
-
function
|
|
1386
|
+
function Cs(e, t, n) {
|
|
1387
1387
|
const r = [];
|
|
1388
1388
|
return e.nodesBetween(t.from, t.to, (s, o) => {
|
|
1389
1389
|
n(s) && r.push({
|
|
@@ -1392,7 +1392,7 @@ function Ts(e, t, n) {
|
|
|
1392
1392
|
});
|
|
1393
1393
|
}), r;
|
|
1394
1394
|
}
|
|
1395
|
-
function
|
|
1395
|
+
function tn(e, t) {
|
|
1396
1396
|
for (let n = e.depth; n > 0; n -= 1) {
|
|
1397
1397
|
const r = e.node(n);
|
|
1398
1398
|
if (t(r))
|
|
@@ -1404,17 +1404,17 @@ function Ze(e, t) {
|
|
|
1404
1404
|
};
|
|
1405
1405
|
}
|
|
1406
1406
|
}
|
|
1407
|
-
function
|
|
1408
|
-
return (t) =>
|
|
1407
|
+
function ee(e) {
|
|
1408
|
+
return (t) => tn(t.$from, e);
|
|
1409
1409
|
}
|
|
1410
|
-
function
|
|
1410
|
+
function xs(e, t) {
|
|
1411
1411
|
const n = {
|
|
1412
1412
|
from: 0,
|
|
1413
1413
|
to: e.content.size
|
|
1414
1414
|
};
|
|
1415
|
-
return
|
|
1415
|
+
return Ue(e, n, t);
|
|
1416
1416
|
}
|
|
1417
|
-
function
|
|
1417
|
+
function As(e, t) {
|
|
1418
1418
|
const n = H(t, e.schema), { from: r, to: s } = e.selection, o = [];
|
|
1419
1419
|
e.doc.nodesBetween(r, s, (a) => {
|
|
1420
1420
|
o.push(a);
|
|
@@ -1422,22 +1422,22 @@ function xs(e, t) {
|
|
|
1422
1422
|
const i = o.reverse().find((a) => a.type.name === n.name);
|
|
1423
1423
|
return i ? { ...i.attrs } : {};
|
|
1424
1424
|
}
|
|
1425
|
-
function
|
|
1426
|
-
const n =
|
|
1427
|
-
return n === "node" ?
|
|
1425
|
+
function en(e, t) {
|
|
1426
|
+
const n = Ct(typeof t == "string" ? t : t.name, e.schema);
|
|
1427
|
+
return n === "node" ? As(e, t) : n === "mark" ? Ze(e, t) : {};
|
|
1428
1428
|
}
|
|
1429
|
-
function
|
|
1429
|
+
function Os(e, t = JSON.stringify) {
|
|
1430
1430
|
const n = {};
|
|
1431
1431
|
return e.filter((r) => {
|
|
1432
1432
|
const s = t(r);
|
|
1433
1433
|
return Object.prototype.hasOwnProperty.call(n, s) ? !1 : n[s] = !0;
|
|
1434
1434
|
});
|
|
1435
1435
|
}
|
|
1436
|
-
function
|
|
1437
|
-
const t =
|
|
1436
|
+
function Ls(e) {
|
|
1437
|
+
const t = Os(e);
|
|
1438
1438
|
return t.length === 1 ? t : t.filter((n, r) => !t.filter((o, i) => i !== r).some((o) => n.oldRange.from >= o.oldRange.from && n.oldRange.to <= o.oldRange.to && n.newRange.from >= o.newRange.from && n.newRange.to <= o.newRange.to));
|
|
1439
1439
|
}
|
|
1440
|
-
function
|
|
1440
|
+
function Ps(e) {
|
|
1441
1441
|
const { mapping: t, steps: n } = e, r = [];
|
|
1442
1442
|
return t.maps.forEach((s, o) => {
|
|
1443
1443
|
const i = [];
|
|
@@ -1464,12 +1464,12 @@ function Ls(e) {
|
|
|
1464
1464
|
}
|
|
1465
1465
|
});
|
|
1466
1466
|
});
|
|
1467
|
-
}),
|
|
1467
|
+
}), Ls(r);
|
|
1468
1468
|
}
|
|
1469
|
-
function
|
|
1469
|
+
function ne(e, t, n) {
|
|
1470
1470
|
const r = [];
|
|
1471
1471
|
return e === t ? n.resolve(e).marks().forEach((s) => {
|
|
1472
|
-
const o = n.resolve(e), i =
|
|
1472
|
+
const o = n.resolve(e), i = Zt(o, s.type);
|
|
1473
1473
|
i && r.push({
|
|
1474
1474
|
mark: s,
|
|
1475
1475
|
...i
|
|
@@ -1482,16 +1482,16 @@ function ee(e, t, n) {
|
|
|
1482
1482
|
})));
|
|
1483
1483
|
}), r;
|
|
1484
1484
|
}
|
|
1485
|
-
function
|
|
1485
|
+
function mt(e, t, n) {
|
|
1486
1486
|
return Object.fromEntries(Object.entries(n).filter(([r]) => {
|
|
1487
1487
|
const s = e.find((o) => o.type === t && o.name === r);
|
|
1488
1488
|
return s ? s.attribute.keepOnSplit : !1;
|
|
1489
1489
|
}));
|
|
1490
1490
|
}
|
|
1491
|
-
function
|
|
1491
|
+
function zt(e, t, n = {}) {
|
|
1492
1492
|
const { empty: r, ranges: s } = e.selection, o = t ? q(t, e.schema) : null;
|
|
1493
1493
|
if (r)
|
|
1494
|
-
return !!(e.storedMarks || e.selection.$from.marks()).filter((d) => o ? o.name === d.type.name : !0).find((d) =>
|
|
1494
|
+
return !!(e.storedMarks || e.selection.$from.marks()).filter((d) => o ? o.name === d.type.name : !0).find((d) => vt(d.attrs, n, { strict: !1 }));
|
|
1495
1495
|
let i = 0;
|
|
1496
1496
|
const a = [];
|
|
1497
1497
|
if (s.forEach(({ $from: d, $to: p }) => {
|
|
@@ -1508,17 +1508,17 @@ function jt(e, t, n = {}) {
|
|
|
1508
1508
|
});
|
|
1509
1509
|
}), i === 0)
|
|
1510
1510
|
return !1;
|
|
1511
|
-
const c = a.filter((d) => o ? o.name === d.mark.type.name : !0).filter((d) =>
|
|
1511
|
+
const c = a.filter((d) => o ? o.name === d.mark.type.name : !0).filter((d) => vt(d.mark.attrs, n, { strict: !1 })).reduce((d, p) => d + p.to - p.from, 0), l = a.filter((d) => o ? d.mark.type !== o && d.mark.type.excludes(o) : !0).reduce((d, p) => d + p.to - p.from, 0);
|
|
1512
1512
|
return (c > 0 ? c + l : c) >= i;
|
|
1513
1513
|
}
|
|
1514
|
-
function
|
|
1514
|
+
function Rs(e, t, n = {}) {
|
|
1515
1515
|
if (!t)
|
|
1516
|
-
return ot(e, null, n) ||
|
|
1517
|
-
const r =
|
|
1518
|
-
return r === "node" ? ot(e, t, n) : r === "mark" ?
|
|
1516
|
+
return ot(e, null, n) || zt(e, null, n);
|
|
1517
|
+
const r = Ct(t, e.schema);
|
|
1518
|
+
return r === "node" ? ot(e, t, n) : r === "mark" ? zt(e, t, n) : !1;
|
|
1519
1519
|
}
|
|
1520
|
-
function
|
|
1521
|
-
const { nodeExtensions: n } =
|
|
1520
|
+
function ve(e, t) {
|
|
1521
|
+
const { nodeExtensions: n } = wt(t), r = n.find((i) => i.name === e);
|
|
1522
1522
|
if (!r)
|
|
1523
1523
|
return !1;
|
|
1524
1524
|
const s = {
|
|
@@ -1528,7 +1528,7 @@ function ye(e, t) {
|
|
|
1528
1528
|
}, o = E(w(r, "group", s));
|
|
1529
1529
|
return typeof o != "string" ? !1 : o.split(" ").includes("list");
|
|
1530
1530
|
}
|
|
1531
|
-
function
|
|
1531
|
+
function xt(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
1532
1532
|
var r;
|
|
1533
1533
|
if (n) {
|
|
1534
1534
|
if (e.type.name === "hardBreak")
|
|
@@ -1545,16 +1545,16 @@ function Ct(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1545
1545
|
if (t) {
|
|
1546
1546
|
let s = !0;
|
|
1547
1547
|
return e.content.forEach((o) => {
|
|
1548
|
-
s !== !1 && (
|
|
1548
|
+
s !== !1 && (xt(o, { ignoreWhitespace: n, checkChildren: t }) || (s = !1));
|
|
1549
1549
|
}), s;
|
|
1550
1550
|
}
|
|
1551
1551
|
return !1;
|
|
1552
1552
|
}
|
|
1553
|
-
function
|
|
1553
|
+
function nn(e) {
|
|
1554
1554
|
return e instanceof et;
|
|
1555
1555
|
}
|
|
1556
|
-
function
|
|
1557
|
-
const s = e.state.doc.content.size, o =
|
|
1556
|
+
function $s(e, t, n) {
|
|
1557
|
+
const s = e.state.doc.content.size, o = F(t, 0, s), i = F(n, 0, s), a = e.coordsAtPos(o), c = e.coordsAtPos(i, -1), l = Math.min(a.top, c.top), u = Math.max(a.bottom, c.bottom), d = Math.min(a.left, c.left), p = Math.max(a.right, c.right), h = p - d, m = u - l, y = {
|
|
1558
1558
|
top: l,
|
|
1559
1559
|
bottom: u,
|
|
1560
1560
|
left: d,
|
|
@@ -1569,11 +1569,11 @@ function Rs(e, t, n) {
|
|
|
1569
1569
|
toJSON: () => y
|
|
1570
1570
|
};
|
|
1571
1571
|
}
|
|
1572
|
-
function
|
|
1572
|
+
function _s(e, t, n) {
|
|
1573
1573
|
var r;
|
|
1574
1574
|
const { selection: s } = t;
|
|
1575
1575
|
let o = null;
|
|
1576
|
-
if (
|
|
1576
|
+
if (te(s) && (o = s.$cursor), o) {
|
|
1577
1577
|
const a = (r = e.storedMarks) !== null && r !== void 0 ? r : o.marks();
|
|
1578
1578
|
return !!n.isInSet(a) || !a.some((c) => c.type.excludes(n));
|
|
1579
1579
|
}
|
|
@@ -1591,11 +1591,11 @@ function $s(e, t, n) {
|
|
|
1591
1591
|
}), l;
|
|
1592
1592
|
});
|
|
1593
1593
|
}
|
|
1594
|
-
const
|
|
1594
|
+
const Hs = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1595
1595
|
const { selection: o } = n, { empty: i, ranges: a } = o, c = q(e, r.schema);
|
|
1596
1596
|
if (s)
|
|
1597
1597
|
if (i) {
|
|
1598
|
-
const l =
|
|
1598
|
+
const l = Ze(r, c);
|
|
1599
1599
|
n.addStoredMark(c.create({
|
|
1600
1600
|
...l,
|
|
1601
1601
|
...t
|
|
@@ -1613,48 +1613,48 @@ const _s = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
|
1613
1613
|
}) : n.addMark(m, f, c.create(t));
|
|
1614
1614
|
});
|
|
1615
1615
|
});
|
|
1616
|
-
return
|
|
1617
|
-
},
|
|
1616
|
+
return _s(r, n, c);
|
|
1617
|
+
}, Ds = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), Is = (e, t = {}) => ({ state: n, dispatch: r, chain: s }) => {
|
|
1618
1618
|
const o = H(e, n.schema);
|
|
1619
1619
|
let i;
|
|
1620
|
-
return n.selection.$anchor.sameParent(n.selection.$head) && (i = n.selection.$anchor.parent.attrs), o.isTextblock ? s().command(({ commands: a }) =>
|
|
1621
|
-
},
|
|
1620
|
+
return n.selection.$anchor.sameParent(n.selection.$head) && (i = n.selection.$anchor.parent.attrs), o.isTextblock ? s().command(({ commands: a }) => ae(o, { ...i, ...t })(n) ? !0 : a.clearNodes()).command(({ state: a }) => ae(o, { ...i, ...t })(a, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
|
|
1621
|
+
}, Ns = (e) => ({ tr: t, dispatch: n }) => {
|
|
1622
1622
|
if (n) {
|
|
1623
|
-
const { doc: r } = t, s =
|
|
1623
|
+
const { doc: r } = t, s = F(e, 0, r.content.size), o = et.create(r, s);
|
|
1624
1624
|
t.setSelection(o);
|
|
1625
1625
|
}
|
|
1626
1626
|
return !0;
|
|
1627
|
-
},
|
|
1627
|
+
}, Bs = (e) => ({ tr: t, dispatch: n }) => {
|
|
1628
1628
|
if (n) {
|
|
1629
|
-
const { doc: r } = t, { from: s, to: o } = typeof e == "number" ? { from: e, to: e } : e, i = I.atStart(r).from, a = I.atEnd(r).to, c =
|
|
1629
|
+
const { doc: r } = t, { from: s, to: o } = typeof e == "number" ? { from: e, to: e } : e, i = I.atStart(r).from, a = I.atEnd(r).to, c = F(s, i, a), l = F(o, i, a), u = I.create(r, c, l);
|
|
1630
1630
|
t.setSelection(u);
|
|
1631
1631
|
}
|
|
1632
1632
|
return !0;
|
|
1633
|
-
},
|
|
1633
|
+
}, js = (e) => ({ state: t, dispatch: n }) => {
|
|
1634
1634
|
const r = H(e, t.schema);
|
|
1635
|
-
return
|
|
1635
|
+
return Sn(r)(t, n);
|
|
1636
1636
|
};
|
|
1637
|
-
function
|
|
1637
|
+
function be(e, t) {
|
|
1638
1638
|
const n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
|
|
1639
1639
|
if (n) {
|
|
1640
1640
|
const r = n.filter((s) => t == null ? void 0 : t.includes(s.type.name));
|
|
1641
1641
|
e.tr.ensureMarks(r);
|
|
1642
1642
|
}
|
|
1643
1643
|
}
|
|
1644
|
-
const
|
|
1645
|
-
const { selection: o, doc: i } = t, { $from: a, $to: c } = o, l = s.extensionManager.attributes, u =
|
|
1644
|
+
const zs = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: s }) => {
|
|
1645
|
+
const { selection: o, doc: i } = t, { $from: a, $to: c } = o, l = s.extensionManager.attributes, u = mt(l, a.node().type.name, a.node().attrs);
|
|
1646
1646
|
if (o instanceof et && o.node.isBlock)
|
|
1647
|
-
return !a.parentOffset || !
|
|
1647
|
+
return !a.parentOffset || !ft(i, a.pos) ? !1 : (r && (e && be(n, s.extensionManager.splittableMarks), t.split(a.pos).scrollIntoView()), !0);
|
|
1648
1648
|
if (!a.parent.isBlock)
|
|
1649
1649
|
return !1;
|
|
1650
|
-
const d = c.parentOffset === c.parent.content.size, p = a.depth === 0 ? void 0 :
|
|
1650
|
+
const d = c.parentOffset === c.parent.content.size, p = a.depth === 0 ? void 0 : Ts(a.node(-1).contentMatchAt(a.indexAfter(-1)));
|
|
1651
1651
|
let h = d && p ? [
|
|
1652
1652
|
{
|
|
1653
1653
|
type: p,
|
|
1654
1654
|
attrs: u
|
|
1655
1655
|
}
|
|
1656
|
-
] : void 0, m =
|
|
1657
|
-
if (!h && !m &&
|
|
1656
|
+
] : void 0, m = ft(t.doc, t.mapping.map(a.pos), 1, h);
|
|
1657
|
+
if (!h && !m && ft(t.doc, t.mapping.map(a.pos), 1, p ? [{ type: p }] : void 0) && (m = !0, h = p ? [
|
|
1658
1658
|
{
|
|
1659
1659
|
type: p,
|
|
1660
1660
|
attrs: u
|
|
@@ -1664,7 +1664,7 @@ const js = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1664
1664
|
const f = t.mapping.map(a.before()), g = t.doc.resolve(f);
|
|
1665
1665
|
a.node(-1).canReplaceWith(g.index(), g.index() + 1, p) && t.setNodeMarkup(t.mapping.map(a.before()), p);
|
|
1666
1666
|
}
|
|
1667
|
-
e &&
|
|
1667
|
+
e && be(n, s.extensionManager.splittableMarks), t.scrollIntoView();
|
|
1668
1668
|
}
|
|
1669
1669
|
return m;
|
|
1670
1670
|
}, Fs = (e, t = {}) => ({ tr: n, state: r, dispatch: s, editor: o }) => {
|
|
@@ -1685,12 +1685,12 @@ const js = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1685
1685
|
for (let A = c.depth - M; A >= c.depth - 3; A -= 1)
|
|
1686
1686
|
y = K.from(c.node(A).copy(y));
|
|
1687
1687
|
const b = c.indexAfter(-1) < c.node(-2).childCount ? 1 : c.indexAfter(-2) < c.node(-3).childCount ? 2 : 3, v = {
|
|
1688
|
-
...
|
|
1688
|
+
...mt(p, c.node().type.name, c.node().attrs),
|
|
1689
1689
|
...t
|
|
1690
1690
|
}, k = ((i = a.contentMatch.defaultType) === null || i === void 0 ? void 0 : i.createAndFill(v)) || void 0;
|
|
1691
1691
|
y = y.append(K.from(a.createAndFill(null, k) || void 0));
|
|
1692
1692
|
const S = c.before(c.depth - (M - 1));
|
|
1693
|
-
n.replace(S, c.after(-b), new
|
|
1693
|
+
n.replace(S, c.after(-b), new Mn(y, 4 - M, 0));
|
|
1694
1694
|
let T = -1;
|
|
1695
1695
|
n.doc.nodesBetween(S, n.doc.content.size, (A, O) => {
|
|
1696
1696
|
if (T > -1)
|
|
@@ -1701,10 +1701,10 @@ const js = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1701
1701
|
return !0;
|
|
1702
1702
|
}
|
|
1703
1703
|
const h = l.pos === c.end() ? d.contentMatchAt(0).defaultType : null, m = {
|
|
1704
|
-
...
|
|
1704
|
+
...mt(p, d.type.name, d.attrs),
|
|
1705
1705
|
...t
|
|
1706
1706
|
}, f = {
|
|
1707
|
-
...
|
|
1707
|
+
...mt(p, c.node().type.name, c.node().attrs),
|
|
1708
1708
|
...t
|
|
1709
1709
|
};
|
|
1710
1710
|
n.delete(c.pos, l.pos);
|
|
@@ -1712,7 +1712,7 @@ const js = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1712
1712
|
{ type: a, attrs: m },
|
|
1713
1713
|
{ type: h, attrs: f }
|
|
1714
1714
|
] : [{ type: a, attrs: m }];
|
|
1715
|
-
if (!
|
|
1715
|
+
if (!ft(n.doc, c.pos, 2))
|
|
1716
1716
|
return !1;
|
|
1717
1717
|
if (s) {
|
|
1718
1718
|
const { selection: y, storedMarks: M } = r, { splittableMarks: b } = o.extensionManager, v = M || y.$to.parentOffset && y.$from.marks();
|
|
@@ -1722,50 +1722,50 @@ const js = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1722
1722
|
n.ensureMarks(k);
|
|
1723
1723
|
}
|
|
1724
1724
|
return !0;
|
|
1725
|
-
},
|
|
1726
|
-
const n =
|
|
1725
|
+
}, $t = (e, t) => {
|
|
1726
|
+
const n = ee((i) => i.type === t)(e.selection);
|
|
1727
1727
|
if (!n)
|
|
1728
1728
|
return !0;
|
|
1729
1729
|
const r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
|
|
1730
1730
|
if (r === void 0)
|
|
1731
1731
|
return !0;
|
|
1732
1732
|
const s = e.doc.nodeAt(r);
|
|
1733
|
-
return n.node.type === (s == null ? void 0 : s.type) &&
|
|
1734
|
-
},
|
|
1735
|
-
const n =
|
|
1733
|
+
return n.node.type === (s == null ? void 0 : s.type) && qt(e.doc, n.pos) && e.join(n.pos), !0;
|
|
1734
|
+
}, _t = (e, t) => {
|
|
1735
|
+
const n = ee((i) => i.type === t)(e.selection);
|
|
1736
1736
|
if (!n)
|
|
1737
1737
|
return !0;
|
|
1738
1738
|
const r = e.doc.resolve(n.start).after(n.depth);
|
|
1739
1739
|
if (r === void 0)
|
|
1740
1740
|
return !0;
|
|
1741
1741
|
const s = e.doc.nodeAt(r);
|
|
1742
|
-
return n.node.type === (s == null ? void 0 : s.type) &&
|
|
1743
|
-
},
|
|
1742
|
+
return n.node.type === (s == null ? void 0 : s.type) && qt(e.doc, r) && e.join(r), !0;
|
|
1743
|
+
}, Vs = (e, t, n, r = {}) => ({ editor: s, tr: o, state: i, dispatch: a, chain: c, commands: l, can: u }) => {
|
|
1744
1744
|
const { extensions: d, splittableMarks: p } = s.extensionManager, h = H(e, i.schema), m = H(t, i.schema), { selection: f, storedMarks: g } = i, { $from: y, $to: M } = f, b = y.blockRange(M), v = g || f.$to.parentOffset && f.$from.marks();
|
|
1745
1745
|
if (!b)
|
|
1746
1746
|
return !1;
|
|
1747
|
-
const k =
|
|
1747
|
+
const k = ee((S) => ve(S.type.name, d))(f);
|
|
1748
1748
|
if (b.depth >= 1 && k && b.depth - k.depth <= 1) {
|
|
1749
1749
|
if (k.node.type === h)
|
|
1750
1750
|
return l.liftListItem(m);
|
|
1751
|
-
if (
|
|
1752
|
-
return c().command(() => (o.setNodeMarkup(k.pos, h), !0)).command(() =>
|
|
1751
|
+
if (ve(k.node.type.name, d) && h.validContent(k.node.content) && a)
|
|
1752
|
+
return c().command(() => (o.setNodeMarkup(k.pos, h), !0)).command(() => $t(o, h)).command(() => _t(o, h)).run();
|
|
1753
1753
|
}
|
|
1754
|
-
return !n || !v || !a ? c().command(() => u().wrapInList(h, r) ? !0 : l.clearNodes()).wrapInList(h, r).command(() =>
|
|
1754
|
+
return !n || !v || !a ? c().command(() => u().wrapInList(h, r) ? !0 : l.clearNodes()).wrapInList(h, r).command(() => $t(o, h)).command(() => _t(o, h)).run() : c().command(() => {
|
|
1755
1755
|
const S = u().wrapInList(h, r), T = v.filter((A) => p.includes(A.type.name));
|
|
1756
1756
|
return o.ensureMarks(T), S ? !0 : l.clearNodes();
|
|
1757
|
-
}).wrapInList(h, r).command(() =>
|
|
1758
|
-
},
|
|
1757
|
+
}).wrapInList(h, r).command(() => $t(o, h)).command(() => _t(o, h)).run();
|
|
1758
|
+
}, Ws = (e, t = {}, n = {}) => ({ state: r, commands: s }) => {
|
|
1759
1759
|
const { extendEmptyMarkRange: o = !1 } = n, i = q(e, r.schema);
|
|
1760
|
-
return
|
|
1761
|
-
},
|
|
1760
|
+
return zt(r, i, t) ? s.unsetMark(i, { extendEmptyMarkRange: o }) : s.setMark(i, t);
|
|
1761
|
+
}, Ks = (e, t, n = {}) => ({ state: r, commands: s }) => {
|
|
1762
1762
|
const o = H(e, r.schema), i = H(t, r.schema), a = ot(r, o, n);
|
|
1763
1763
|
let c;
|
|
1764
1764
|
return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), a ? s.setNode(i, c) : s.setNode(o, { ...c, ...n });
|
|
1765
|
-
},
|
|
1765
|
+
}, Us = (e, t = {}) => ({ state: n, commands: r }) => {
|
|
1766
1766
|
const s = H(e, n.schema);
|
|
1767
1767
|
return ot(n, s, t) ? r.lift(s) : r.wrapIn(s, t);
|
|
1768
|
-
},
|
|
1768
|
+
}, qs = () => ({ state: e, dispatch: t }) => {
|
|
1769
1769
|
const n = e.plugins;
|
|
1770
1770
|
for (let r = 0; r < n.length; r += 1) {
|
|
1771
1771
|
const s = n[r];
|
|
@@ -1785,28 +1785,28 @@ const js = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1785
1785
|
}
|
|
1786
1786
|
}
|
|
1787
1787
|
return !1;
|
|
1788
|
-
},
|
|
1788
|
+
}, Gs = () => ({ tr: e, dispatch: t }) => {
|
|
1789
1789
|
const { selection: n } = e, { empty: r, ranges: s } = n;
|
|
1790
1790
|
return r || t && s.forEach((o) => {
|
|
1791
1791
|
e.removeMark(o.$from.pos, o.$to.pos);
|
|
1792
1792
|
}), !0;
|
|
1793
|
-
},
|
|
1793
|
+
}, Js = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1794
1794
|
var o;
|
|
1795
1795
|
const { extendEmptyMarkRange: i = !1 } = t, { selection: a } = n, c = q(e, r.schema), { $from: l, empty: u, ranges: d } = a;
|
|
1796
1796
|
if (!s)
|
|
1797
1797
|
return !0;
|
|
1798
1798
|
if (u && i) {
|
|
1799
1799
|
let { from: p, to: h } = a;
|
|
1800
|
-
const m = (o = l.marks().find((g) => g.type === c)) === null || o === void 0 ? void 0 : o.attrs, f =
|
|
1800
|
+
const m = (o = l.marks().find((g) => g.type === c)) === null || o === void 0 ? void 0 : o.attrs, f = Zt(l, c, m);
|
|
1801
1801
|
f && (p = f.from, h = f.to), n.removeMark(p, h, c);
|
|
1802
1802
|
} else
|
|
1803
1803
|
d.forEach((p) => {
|
|
1804
1804
|
n.removeMark(p.$from.pos, p.$to.pos, c);
|
|
1805
1805
|
});
|
|
1806
1806
|
return n.removeStoredMark(c), !0;
|
|
1807
|
-
},
|
|
1807
|
+
}, Ys = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1808
1808
|
let o = null, i = null;
|
|
1809
|
-
const a =
|
|
1809
|
+
const a = Ct(typeof e == "string" ? e : e.name, r.schema);
|
|
1810
1810
|
return a ? (a === "node" && (o = H(e, r.schema)), a === "mark" && (i = q(e, r.schema)), s && n.selection.ranges.forEach((c) => {
|
|
1811
1811
|
const l = c.$from.pos, u = c.$to.pos;
|
|
1812
1812
|
let d, p, h, m;
|
|
@@ -1835,82 +1835,82 @@ const js = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1835
1835
|
}));
|
|
1836
1836
|
}));
|
|
1837
1837
|
}), !0) : !1;
|
|
1838
|
-
}, Ys = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1839
|
-
const s = H(e, n.schema);
|
|
1840
|
-
return vn(s, t)(n, r);
|
|
1841
1838
|
}, Xs = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1842
1839
|
const s = H(e, n.schema);
|
|
1843
|
-
return
|
|
1840
|
+
return bn(s, t)(n, r);
|
|
1841
|
+
}, Qs = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1842
|
+
const s = H(e, n.schema);
|
|
1843
|
+
return vn(s, t)(n, r);
|
|
1844
1844
|
};
|
|
1845
|
-
var
|
|
1845
|
+
var Zs = /* @__PURE__ */ Object.freeze({
|
|
1846
1846
|
__proto__: null,
|
|
1847
|
-
blur:
|
|
1848
|
-
clearContent:
|
|
1849
|
-
clearNodes:
|
|
1850
|
-
command:
|
|
1851
|
-
createParagraphNear:
|
|
1852
|
-
cut:
|
|
1853
|
-
deleteCurrentNode:
|
|
1847
|
+
blur: Hr,
|
|
1848
|
+
clearContent: Dr,
|
|
1849
|
+
clearNodes: Ir,
|
|
1850
|
+
command: Nr,
|
|
1851
|
+
createParagraphNear: Br,
|
|
1852
|
+
cut: jr,
|
|
1853
|
+
deleteCurrentNode: zr,
|
|
1854
1854
|
deleteNode: Fr,
|
|
1855
|
-
deleteRange:
|
|
1856
|
-
deleteSelection:
|
|
1857
|
-
enter:
|
|
1858
|
-
exitCode:
|
|
1859
|
-
extendMarkRange:
|
|
1860
|
-
first:
|
|
1861
|
-
focus:
|
|
1862
|
-
forEach:
|
|
1863
|
-
insertContent:
|
|
1864
|
-
insertContentAt:
|
|
1865
|
-
joinBackward:
|
|
1866
|
-
joinDown:
|
|
1867
|
-
joinForward:
|
|
1868
|
-
joinItemBackward:
|
|
1869
|
-
joinItemForward:
|
|
1870
|
-
joinTextblockBackward:
|
|
1871
|
-
joinTextblockForward:
|
|
1872
|
-
joinUp:
|
|
1873
|
-
keyboardShortcut:
|
|
1874
|
-
lift:
|
|
1875
|
-
liftEmptyBlock:
|
|
1876
|
-
liftListItem:
|
|
1877
|
-
newlineInCode:
|
|
1878
|
-
resetAttributes:
|
|
1879
|
-
scrollIntoView:
|
|
1880
|
-
selectAll:
|
|
1881
|
-
selectNodeBackward:
|
|
1882
|
-
selectNodeForward:
|
|
1883
|
-
selectParentNode:
|
|
1884
|
-
selectTextblockEnd:
|
|
1885
|
-
selectTextblockStart:
|
|
1886
|
-
setContent:
|
|
1887
|
-
setMark:
|
|
1888
|
-
setMeta:
|
|
1889
|
-
setNode:
|
|
1890
|
-
setNodeSelection:
|
|
1891
|
-
setTextSelection:
|
|
1892
|
-
sinkListItem:
|
|
1893
|
-
splitBlock:
|
|
1855
|
+
deleteRange: Vr,
|
|
1856
|
+
deleteSelection: Wr,
|
|
1857
|
+
enter: Kr,
|
|
1858
|
+
exitCode: Ur,
|
|
1859
|
+
extendMarkRange: qr,
|
|
1860
|
+
first: Gr,
|
|
1861
|
+
focus: Jr,
|
|
1862
|
+
forEach: Yr,
|
|
1863
|
+
insertContent: Xr,
|
|
1864
|
+
insertContentAt: ts,
|
|
1865
|
+
joinBackward: rs,
|
|
1866
|
+
joinDown: ns,
|
|
1867
|
+
joinForward: ss,
|
|
1868
|
+
joinItemBackward: os,
|
|
1869
|
+
joinItemForward: is,
|
|
1870
|
+
joinTextblockBackward: as,
|
|
1871
|
+
joinTextblockForward: ls,
|
|
1872
|
+
joinUp: es,
|
|
1873
|
+
keyboardShortcut: ds,
|
|
1874
|
+
lift: us,
|
|
1875
|
+
liftEmptyBlock: ps,
|
|
1876
|
+
liftListItem: hs,
|
|
1877
|
+
newlineInCode: fs,
|
|
1878
|
+
resetAttributes: ms,
|
|
1879
|
+
scrollIntoView: gs,
|
|
1880
|
+
selectAll: ys,
|
|
1881
|
+
selectNodeBackward: vs,
|
|
1882
|
+
selectNodeForward: bs,
|
|
1883
|
+
selectParentNode: Ms,
|
|
1884
|
+
selectTextblockEnd: Ss,
|
|
1885
|
+
selectTextblockStart: ws,
|
|
1886
|
+
setContent: ks,
|
|
1887
|
+
setMark: Hs,
|
|
1888
|
+
setMeta: Ds,
|
|
1889
|
+
setNode: Is,
|
|
1890
|
+
setNodeSelection: Ns,
|
|
1891
|
+
setTextSelection: Bs,
|
|
1892
|
+
sinkListItem: js,
|
|
1893
|
+
splitBlock: zs,
|
|
1894
1894
|
splitListItem: Fs,
|
|
1895
|
-
toggleList:
|
|
1896
|
-
toggleMark:
|
|
1897
|
-
toggleNode:
|
|
1898
|
-
toggleWrap:
|
|
1899
|
-
undoInputRule:
|
|
1900
|
-
unsetAllMarks:
|
|
1901
|
-
unsetMark:
|
|
1902
|
-
updateAttributes:
|
|
1903
|
-
wrapIn:
|
|
1904
|
-
wrapInList:
|
|
1895
|
+
toggleList: Vs,
|
|
1896
|
+
toggleMark: Ws,
|
|
1897
|
+
toggleNode: Ks,
|
|
1898
|
+
toggleWrap: Us,
|
|
1899
|
+
undoInputRule: qs,
|
|
1900
|
+
unsetAllMarks: Gs,
|
|
1901
|
+
unsetMark: Js,
|
|
1902
|
+
updateAttributes: Ys,
|
|
1903
|
+
wrapIn: Xs,
|
|
1904
|
+
wrapInList: Qs
|
|
1905
1905
|
});
|
|
1906
|
-
const
|
|
1906
|
+
const to = R.create({
|
|
1907
1907
|
name: "commands",
|
|
1908
1908
|
addCommands() {
|
|
1909
1909
|
return {
|
|
1910
|
-
...
|
|
1910
|
+
...Zs
|
|
1911
1911
|
};
|
|
1912
1912
|
}
|
|
1913
|
-
}),
|
|
1913
|
+
}), eo = R.create({
|
|
1914
1914
|
name: "drop",
|
|
1915
1915
|
addProseMirrorPlugins() {
|
|
1916
1916
|
return [
|
|
@@ -1929,7 +1929,7 @@ const Zs = R.create({
|
|
|
1929
1929
|
})
|
|
1930
1930
|
];
|
|
1931
1931
|
}
|
|
1932
|
-
}),
|
|
1932
|
+
}), no = R.create({
|
|
1933
1933
|
name: "editable",
|
|
1934
1934
|
addProseMirrorPlugins() {
|
|
1935
1935
|
return [
|
|
@@ -1941,7 +1941,7 @@ const Zs = R.create({
|
|
|
1941
1941
|
})
|
|
1942
1942
|
];
|
|
1943
1943
|
}
|
|
1944
|
-
}),
|
|
1944
|
+
}), ro = R.create({
|
|
1945
1945
|
name: "focusEvents",
|
|
1946
1946
|
addProseMirrorPlugins() {
|
|
1947
1947
|
const { editor: e } = this;
|
|
@@ -1965,7 +1965,7 @@ const Zs = R.create({
|
|
|
1965
1965
|
})
|
|
1966
1966
|
];
|
|
1967
1967
|
}
|
|
1968
|
-
}),
|
|
1968
|
+
}), so = R.create({
|
|
1969
1969
|
name: "keymap",
|
|
1970
1970
|
addKeyboardShortcuts() {
|
|
1971
1971
|
const e = () => this.editor.commands.first(({ commands: i }) => [
|
|
@@ -2010,7 +2010,7 @@ const Zs = R.create({
|
|
|
2010
2010
|
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
2011
2011
|
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
2012
2012
|
};
|
|
2013
|
-
return
|
|
2013
|
+
return Tt() || Qe() ? o : s;
|
|
2014
2014
|
},
|
|
2015
2015
|
addProseMirrorPlugins() {
|
|
2016
2016
|
return [
|
|
@@ -2028,12 +2028,12 @@ const Zs = R.create({
|
|
|
2028
2028
|
if (!r || s)
|
|
2029
2029
|
return;
|
|
2030
2030
|
const { empty: o, from: i, to: a } = t.selection, c = W.atStart(t.doc).from, l = W.atEnd(t.doc).to;
|
|
2031
|
-
if (o || !(i === c && a === l) || !
|
|
2031
|
+
if (o || !(i === c && a === l) || !xt(n.doc))
|
|
2032
2032
|
return;
|
|
2033
|
-
const p = n.tr, h =
|
|
2033
|
+
const p = n.tr, h = Mt({
|
|
2034
2034
|
state: n,
|
|
2035
2035
|
transaction: p
|
|
2036
|
-
}), { commands: m } = new
|
|
2036
|
+
}), { commands: m } = new St({
|
|
2037
2037
|
editor: this.editor,
|
|
2038
2038
|
state: h
|
|
2039
2039
|
});
|
|
@@ -2043,7 +2043,7 @@ const Zs = R.create({
|
|
|
2043
2043
|
})
|
|
2044
2044
|
];
|
|
2045
2045
|
}
|
|
2046
|
-
}),
|
|
2046
|
+
}), oo = R.create({
|
|
2047
2047
|
name: "paste",
|
|
2048
2048
|
addProseMirrorPlugins() {
|
|
2049
2049
|
return [
|
|
@@ -2061,7 +2061,7 @@ const Zs = R.create({
|
|
|
2061
2061
|
})
|
|
2062
2062
|
];
|
|
2063
2063
|
}
|
|
2064
|
-
}),
|
|
2064
|
+
}), io = R.create({
|
|
2065
2065
|
name: "tabindex",
|
|
2066
2066
|
addProseMirrorPlugins() {
|
|
2067
2067
|
return [
|
|
@@ -2197,7 +2197,7 @@ class J {
|
|
|
2197
2197
|
}), this.editor.view.dispatch(n);
|
|
2198
2198
|
}
|
|
2199
2199
|
}
|
|
2200
|
-
const
|
|
2200
|
+
const ao = `.ProseMirror {
|
|
2201
2201
|
position: relative;
|
|
2202
2202
|
}
|
|
2203
2203
|
|
|
@@ -2272,14 +2272,14 @@ img.ProseMirror-separator {
|
|
|
2272
2272
|
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
2273
2273
|
opacity: 0
|
|
2274
2274
|
}`;
|
|
2275
|
-
function
|
|
2275
|
+
function lo(e, t, n) {
|
|
2276
2276
|
const r = document.querySelector("style[data-tiptap-style]");
|
|
2277
2277
|
if (r !== null)
|
|
2278
2278
|
return r;
|
|
2279
2279
|
const s = document.createElement("style");
|
|
2280
2280
|
return t && s.setAttribute("nonce", t), s.setAttribute("data-tiptap-style", ""), s.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(s), s;
|
|
2281
2281
|
}
|
|
2282
|
-
class
|
|
2282
|
+
class co extends Mr {
|
|
2283
2283
|
constructor(t = {}) {
|
|
2284
2284
|
super(), this.isFocused = !1, this.isInitialized = !1, this.extensionStorage = {}, this.options = {
|
|
2285
2285
|
element: document.createElement("div"),
|
|
@@ -2341,7 +2341,7 @@ class lo extends br {
|
|
|
2341
2341
|
* Inject CSS styles.
|
|
2342
2342
|
*/
|
|
2343
2343
|
injectCSS() {
|
|
2344
|
-
this.options.injectCSS && document && (this.css = ao
|
|
2344
|
+
this.options.injectCSS && document && (this.css = lo(ao, this.options.injectNonce));
|
|
2345
2345
|
}
|
|
2346
2346
|
/**
|
|
2347
2347
|
* Update editor options.
|
|
@@ -2380,7 +2380,7 @@ class lo extends br {
|
|
|
2380
2380
|
* @returns The new editor state
|
|
2381
2381
|
*/
|
|
2382
2382
|
registerPlugin(t, n) {
|
|
2383
|
-
const r =
|
|
2383
|
+
const r = We(n) ? n(t, [...this.state.plugins]) : [...this.state.plugins, t], s = this.state.reconfigure({ plugins: r });
|
|
2384
2384
|
return this.view.updateState(s), s;
|
|
2385
2385
|
}
|
|
2386
2386
|
/**
|
|
@@ -2410,16 +2410,16 @@ class lo extends br {
|
|
|
2410
2410
|
createExtensionManager() {
|
|
2411
2411
|
var t, n;
|
|
2412
2412
|
const s = [...this.options.enableCoreExtensions ? [
|
|
2413
|
-
|
|
2414
|
-
|
|
2413
|
+
no,
|
|
2414
|
+
_r.configure({
|
|
2415
2415
|
blockSeparator: (n = (t = this.options.coreExtensionOptions) === null || t === void 0 ? void 0 : t.clipboardTextSerializer) === null || n === void 0 ? void 0 : n.blockSeparator
|
|
2416
2416
|
}),
|
|
2417
|
-
Zs,
|
|
2418
|
-
no,
|
|
2419
|
-
ro,
|
|
2420
|
-
oo,
|
|
2421
2417
|
to,
|
|
2422
|
-
|
|
2418
|
+
ro,
|
|
2419
|
+
so,
|
|
2420
|
+
io,
|
|
2421
|
+
eo,
|
|
2422
|
+
oo
|
|
2423
2423
|
].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));
|
|
2424
2424
|
this.extensionManager = new tt(s, this);
|
|
2425
2425
|
}
|
|
@@ -2427,7 +2427,7 @@ class lo extends br {
|
|
|
2427
2427
|
* Creates an command manager.
|
|
2428
2428
|
*/
|
|
2429
2429
|
createCommandManager() {
|
|
2430
|
-
this.commandManager = new
|
|
2430
|
+
this.commandManager = new St({
|
|
2431
2431
|
editor: this
|
|
2432
2432
|
});
|
|
2433
2433
|
}
|
|
@@ -2444,7 +2444,7 @@ class lo extends br {
|
|
|
2444
2444
|
var t;
|
|
2445
2445
|
let n;
|
|
2446
2446
|
try {
|
|
2447
|
-
n =
|
|
2447
|
+
n = jt(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
|
|
2448
2448
|
} catch (i) {
|
|
2449
2449
|
if (!(i instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(i.message))
|
|
2450
2450
|
throw i;
|
|
@@ -2454,10 +2454,10 @@ class lo extends br {
|
|
|
2454
2454
|
disableCollaboration: () => {
|
|
2455
2455
|
this.storage.collaboration && (this.storage.collaboration.isDisabled = !0), this.options.extensions = this.options.extensions.filter((a) => a.name !== "collaboration"), this.createExtensionManager();
|
|
2456
2456
|
}
|
|
2457
|
-
}), n =
|
|
2457
|
+
}), n = jt(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
|
|
2458
2458
|
}
|
|
2459
|
-
const r =
|
|
2460
|
-
this.view = new
|
|
2459
|
+
const r = Je(n, this.options.autofocus);
|
|
2460
|
+
this.view = new hn(this.options.element, {
|
|
2461
2461
|
...this.options.editorProps,
|
|
2462
2462
|
attributes: {
|
|
2463
2463
|
// add `role="textbox"` to the editor element
|
|
@@ -2465,7 +2465,7 @@ class lo extends br {
|
|
|
2465
2465
|
...(t = this.options.editorProps) === null || t === void 0 ? void 0 : t.attributes
|
|
2466
2466
|
},
|
|
2467
2467
|
dispatchTransaction: this.dispatchTransaction.bind(this),
|
|
2468
|
-
state:
|
|
2468
|
+
state: fn.create({
|
|
2469
2469
|
doc: n,
|
|
2470
2470
|
selection: r || void 0
|
|
2471
2471
|
})
|
|
@@ -2545,11 +2545,11 @@ class lo extends br {
|
|
|
2545
2545
|
* Get attributes of the currently selected node or mark.
|
|
2546
2546
|
*/
|
|
2547
2547
|
getAttributes(t) {
|
|
2548
|
-
return
|
|
2548
|
+
return en(this.state, t);
|
|
2549
2549
|
}
|
|
2550
2550
|
isActive(t, n) {
|
|
2551
2551
|
const r = typeof t == "string" ? t : null, s = typeof t == "string" ? n : t;
|
|
2552
|
-
return
|
|
2552
|
+
return Rs(this.state, r, s);
|
|
2553
2553
|
}
|
|
2554
2554
|
/**
|
|
2555
2555
|
* Get the document as JSON.
|
|
@@ -2561,7 +2561,7 @@ class lo extends br {
|
|
|
2561
2561
|
* Get the document as HTML.
|
|
2562
2562
|
*/
|
|
2563
2563
|
getHTML() {
|
|
2564
|
-
return
|
|
2564
|
+
return Xt(this.state.doc.content, this.schema);
|
|
2565
2565
|
}
|
|
2566
2566
|
/**
|
|
2567
2567
|
* Get the document as text.
|
|
@@ -2570,10 +2570,10 @@ class lo extends br {
|
|
|
2570
2570
|
const { blockSeparator: n = `
|
|
2571
2571
|
|
|
2572
2572
|
`, textSerializers: r = {} } = t || {};
|
|
2573
|
-
return
|
|
2573
|
+
return xs(this.state.doc, {
|
|
2574
2574
|
blockSeparator: n,
|
|
2575
2575
|
textSerializers: {
|
|
2576
|
-
...
|
|
2576
|
+
...qe(this.schema),
|
|
2577
2577
|
...r
|
|
2578
2578
|
}
|
|
2579
2579
|
});
|
|
@@ -2582,7 +2582,7 @@ class lo extends br {
|
|
|
2582
2582
|
* Check if there is no content.
|
|
2583
2583
|
*/
|
|
2584
2584
|
get isEmpty() {
|
|
2585
|
-
return
|
|
2585
|
+
return xt(this.state.doc);
|
|
2586
2586
|
}
|
|
2587
2587
|
/**
|
|
2588
2588
|
* Get the number of characters for the current document.
|
|
@@ -2626,7 +2626,7 @@ class lo extends br {
|
|
|
2626
2626
|
}
|
|
2627
2627
|
}
|
|
2628
2628
|
function Y(e) {
|
|
2629
|
-
return new
|
|
2629
|
+
return new kt({
|
|
2630
2630
|
find: e.find,
|
|
2631
2631
|
handler: ({ state: t, range: n, match: r }) => {
|
|
2632
2632
|
const s = E(e.getAttributes, void 0, r);
|
|
@@ -2635,7 +2635,7 @@ function Y(e) {
|
|
|
2635
2635
|
const { tr: o } = t, i = r[r.length - 1], a = r[0];
|
|
2636
2636
|
if (i) {
|
|
2637
2637
|
const c = a.search(/\S/), l = n.from + a.indexOf(i), u = l + i.length;
|
|
2638
|
-
if (
|
|
2638
|
+
if (ne(n.from, n.to, t.doc).filter((h) => h.mark.type.excluded.find((f) => f === e.type && f !== h.mark.type)).filter((h) => h.to > l).length)
|
|
2639
2639
|
return null;
|
|
2640
2640
|
u < n.to && o.delete(u, n.to), l > n.from && o.delete(n.from + c, l);
|
|
2641
2641
|
const p = n.from + c + i.length;
|
|
@@ -2644,8 +2644,8 @@ function Y(e) {
|
|
|
2644
2644
|
}
|
|
2645
2645
|
});
|
|
2646
2646
|
}
|
|
2647
|
-
function
|
|
2648
|
-
return new
|
|
2647
|
+
function rn(e) {
|
|
2648
|
+
return new kt({
|
|
2649
2649
|
find: e.find,
|
|
2650
2650
|
handler: ({ state: t, range: n, match: r }) => {
|
|
2651
2651
|
const s = E(e.getAttributes, void 0, r) || {}, { tr: o } = t, i = n.from;
|
|
@@ -2666,7 +2666,7 @@ function nn(e) {
|
|
|
2666
2666
|
});
|
|
2667
2667
|
}
|
|
2668
2668
|
function Ft(e) {
|
|
2669
|
-
return new
|
|
2669
|
+
return new kt({
|
|
2670
2670
|
find: e.find,
|
|
2671
2671
|
handler: ({ state: t, range: n, match: r }) => {
|
|
2672
2672
|
const s = t.doc.resolve(n.from), o = E(e.getAttributes, void 0, r) || {};
|
|
@@ -2677,10 +2677,10 @@ function Ft(e) {
|
|
|
2677
2677
|
});
|
|
2678
2678
|
}
|
|
2679
2679
|
function nt(e) {
|
|
2680
|
-
return new
|
|
2680
|
+
return new kt({
|
|
2681
2681
|
find: e.find,
|
|
2682
2682
|
handler: ({ state: t, range: n, match: r, chain: s }) => {
|
|
2683
|
-
const o = E(e.getAttributes, void 0, r) || {}, i = t.tr.delete(n.from, n.to), c = i.doc.resolve(n.from).blockRange(), l = c &&
|
|
2683
|
+
const o = E(e.getAttributes, void 0, r) || {}, i = t.tr.delete(n.from, n.to), c = i.doc.resolve(n.from).blockRange(), l = c && Wn(c, e.type, o);
|
|
2684
2684
|
if (!l)
|
|
2685
2685
|
return null;
|
|
2686
2686
|
if (i.wrap(c, l), e.keepMarks && e.editor) {
|
|
@@ -2695,7 +2695,7 @@ function nt(e) {
|
|
|
2695
2695
|
s().updateAttributes(d, o).run();
|
|
2696
2696
|
}
|
|
2697
2697
|
const u = i.doc.resolve(n.from - 1).nodeBefore;
|
|
2698
|
-
u && u.type === e.type &&
|
|
2698
|
+
u && u.type === e.type && qt(i.doc, n.from - 1) && (!e.joinPredicate || e.joinPredicate(r, u)) && i.join(n.from - 1);
|
|
2699
2699
|
}
|
|
2700
2700
|
});
|
|
2701
2701
|
}
|
|
@@ -2720,7 +2720,7 @@ class P {
|
|
|
2720
2720
|
configure(t = {}) {
|
|
2721
2721
|
const n = this.extend({
|
|
2722
2722
|
...this.config,
|
|
2723
|
-
addOptions: () =>
|
|
2723
|
+
addOptions: () => Et(this.options, t)
|
|
2724
2724
|
});
|
|
2725
2725
|
return n.name = this.name, n.parent = this.parent, n;
|
|
2726
2726
|
}
|
|
@@ -2734,7 +2734,7 @@ class P {
|
|
|
2734
2734
|
})), n;
|
|
2735
2735
|
}
|
|
2736
2736
|
}
|
|
2737
|
-
class
|
|
2737
|
+
class uo {
|
|
2738
2738
|
constructor(t, n, r) {
|
|
2739
2739
|
this.isDragging = !1, this.component = t, this.editor = n.editor, this.options = {
|
|
2740
2740
|
stopEvent: null,
|
|
@@ -2800,7 +2800,7 @@ class co {
|
|
|
2800
2800
|
* @return `true` if it can safely be ignored.
|
|
2801
2801
|
*/
|
|
2802
2802
|
ignoreMutation(t) {
|
|
2803
|
-
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" && (
|
|
2803
|
+
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" && (Tt() || Ye()) && this.editor.isFocused && [
|
|
2804
2804
|
...Array.from(t.addedNodes),
|
|
2805
2805
|
...Array.from(t.removedNodes)
|
|
2806
2806
|
].every((r) => r.isContentEditable) ? !1 : this.contentDOM === t.target && t.type === "attributes" ? !0 : !this.contentDOM.contains(t.target);
|
|
@@ -2829,7 +2829,7 @@ class co {
|
|
|
2829
2829
|
}
|
|
2830
2830
|
}
|
|
2831
2831
|
function U(e) {
|
|
2832
|
-
return new
|
|
2832
|
+
return new Ke({
|
|
2833
2833
|
find: e.find,
|
|
2834
2834
|
handler: ({ state: t, range: n, match: r, pasteEvent: s }) => {
|
|
2835
2835
|
const o = E(e.getAttributes, void 0, r, s);
|
|
@@ -2839,18 +2839,18 @@ function U(e) {
|
|
|
2839
2839
|
let l = n.to;
|
|
2840
2840
|
if (a) {
|
|
2841
2841
|
const u = c.search(/\S/), d = n.from + c.indexOf(a), p = d + a.length;
|
|
2842
|
-
if (
|
|
2842
|
+
if (ne(n.from, n.to, t.doc).filter((m) => m.mark.type.excluded.find((g) => g === e.type && g !== m.mark.type)).filter((m) => m.to > d).length)
|
|
2843
2843
|
return null;
|
|
2844
2844
|
p < n.to && i.delete(p, n.to), d > n.from && i.delete(n.from + u, d), l = n.from + u + a.length, i.addMark(n.from + u, l, e.type.create(o || {})), i.removeStoredMark(e.type);
|
|
2845
2845
|
}
|
|
2846
2846
|
}
|
|
2847
2847
|
});
|
|
2848
2848
|
}
|
|
2849
|
-
function
|
|
2849
|
+
function po(e) {
|
|
2850
2850
|
return e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
2851
2851
|
}
|
|
2852
|
-
function
|
|
2853
|
-
return new
|
|
2852
|
+
function Ai(e) {
|
|
2853
|
+
return new Ke({
|
|
2854
2854
|
find: e.find,
|
|
2855
2855
|
handler({ match: t, chain: n, range: r, pasteEvent: s }) {
|
|
2856
2856
|
const o = E(e.getAttributes, void 0, t, s), i = E(e.getContent, void 0, o);
|
|
@@ -2861,10 +2861,10 @@ function xi(e) {
|
|
|
2861
2861
|
}
|
|
2862
2862
|
});
|
|
2863
2863
|
}
|
|
2864
|
-
class
|
|
2864
|
+
class ho {
|
|
2865
2865
|
constructor({ editor: t, element: n, view: r, tippyOptions: s = {}, updateDelay: o = 250, shouldShow: i }) {
|
|
2866
2866
|
this.preventHide = !1, this.shouldShow = ({ view: a, state: c, from: l, to: u }) => {
|
|
2867
|
-
const { doc: d, selection: p } = c, { empty: h } = p, m = !d.textBetween(l, u).length &&
|
|
2867
|
+
const { doc: d, selection: p } = c, { empty: h } = p, m = !d.textBetween(l, u).length && te(c.selection), f = this.element.contains(document.activeElement);
|
|
2868
2868
|
return !(!(a.hasFocus() || f) || h || m || !this.editor.isEditable);
|
|
2869
2869
|
}, this.mousedownHandler = () => {
|
|
2870
2870
|
this.preventHide = !0;
|
|
@@ -2907,7 +2907,7 @@ class po {
|
|
|
2907
2907
|
}
|
|
2908
2908
|
(p = this.tippy) === null || p === void 0 || p.setProps({
|
|
2909
2909
|
getReferenceClientRect: ((h = this.tippyOptions) === null || h === void 0 ? void 0 : h.getReferenceClientRect) || (() => {
|
|
2910
|
-
if (
|
|
2910
|
+
if (nn(m.selection)) {
|
|
2911
2911
|
let S = a.nodeDOM(b);
|
|
2912
2912
|
if (S) {
|
|
2913
2913
|
const T = S.dataset.nodeViewWrapper ? S : S.querySelector("[data-node-view-wrapper]");
|
|
@@ -2915,14 +2915,14 @@ class po {
|
|
|
2915
2915
|
return S.getBoundingClientRect();
|
|
2916
2916
|
}
|
|
2917
2917
|
}
|
|
2918
|
-
return
|
|
2918
|
+
return $s(a, b, v);
|
|
2919
2919
|
})
|
|
2920
2920
|
}), this.show();
|
|
2921
2921
|
}, this.editor = t, this.element = n, this.view = r, this.updateDelay = o, i && (this.shouldShow = i), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.tippyOptions = s, this.element.remove(), this.element.style.visibility = "visible";
|
|
2922
2922
|
}
|
|
2923
2923
|
createTooltip() {
|
|
2924
2924
|
const { element: t } = this.editor.options, n = !!t.parentElement;
|
|
2925
|
-
this.tippy || !n || (this.tippy =
|
|
2925
|
+
this.tippy || !n || (this.tippy = He(t, {
|
|
2926
2926
|
duration: 0,
|
|
2927
2927
|
getReferenceClientRect: null,
|
|
2928
2928
|
content: this.element,
|
|
@@ -2955,9 +2955,9 @@ class po {
|
|
|
2955
2955
|
!((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);
|
|
2956
2956
|
}
|
|
2957
2957
|
}
|
|
2958
|
-
const
|
|
2958
|
+
const sn = (e) => new $({
|
|
2959
2959
|
key: typeof e.pluginKey == "string" ? new _(e.pluginKey) : e.pluginKey,
|
|
2960
|
-
view: (t) => new
|
|
2960
|
+
view: (t) => new ho({ view: t, ...e })
|
|
2961
2961
|
});
|
|
2962
2962
|
R.create({
|
|
2963
2963
|
name: "bubbleMenu",
|
|
@@ -2972,7 +2972,7 @@ R.create({
|
|
|
2972
2972
|
},
|
|
2973
2973
|
addProseMirrorPlugins() {
|
|
2974
2974
|
return this.options.element ? [
|
|
2975
|
-
|
|
2975
|
+
sn({
|
|
2976
2976
|
pluginKey: this.options.pluginKey,
|
|
2977
2977
|
editor: this.editor,
|
|
2978
2978
|
element: this.options.element,
|
|
@@ -2983,10 +2983,11 @@ R.create({
|
|
|
2983
2983
|
] : [];
|
|
2984
2984
|
}
|
|
2985
2985
|
});
|
|
2986
|
-
|
|
2986
|
+
var it = {};
|
|
2987
|
+
function fo(e) {
|
|
2987
2988
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
2988
2989
|
}
|
|
2989
|
-
var
|
|
2990
|
+
var Vt = { exports: {} }, Ht = {};
|
|
2990
2991
|
/**
|
|
2991
2992
|
* @license React
|
|
2992
2993
|
* use-sync-external-store-shim.production.min.js
|
|
@@ -2996,10 +2997,10 @@ var zt = { exports: {} }, _t = {};
|
|
|
2996
2997
|
* This source code is licensed under the MIT license found in the
|
|
2997
2998
|
* LICENSE file in the root directory of this source tree.
|
|
2998
2999
|
*/
|
|
2999
|
-
var
|
|
3000
|
-
function
|
|
3001
|
-
if (
|
|
3002
|
-
|
|
3000
|
+
var Me;
|
|
3001
|
+
function mo() {
|
|
3002
|
+
if (Me) return Ht;
|
|
3003
|
+
Me = 1;
|
|
3003
3004
|
var e = L;
|
|
3004
3005
|
function t(d, p) {
|
|
3005
3006
|
return d === p && (d !== 0 || 1 / d === 1 / p) || d !== d && p !== p;
|
|
@@ -3029,9 +3030,9 @@ function fo() {
|
|
|
3029
3030
|
return p();
|
|
3030
3031
|
}
|
|
3031
3032
|
var u = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? l : a;
|
|
3032
|
-
return
|
|
3033
|
+
return Ht.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : u, Ht;
|
|
3033
3034
|
}
|
|
3034
|
-
var
|
|
3035
|
+
var Dt = {};
|
|
3035
3036
|
/**
|
|
3036
3037
|
* @license React
|
|
3037
3038
|
* use-sync-external-store-shim.development.js
|
|
@@ -3041,9 +3042,9 @@ var Ht = {};
|
|
|
3041
3042
|
* This source code is licensed under the MIT license found in the
|
|
3042
3043
|
* LICENSE file in the root directory of this source tree.
|
|
3043
3044
|
*/
|
|
3044
|
-
var
|
|
3045
|
-
function
|
|
3046
|
-
return
|
|
3045
|
+
var Se;
|
|
3046
|
+
function go() {
|
|
3047
|
+
return Se || (Se = 1, it.NODE_ENV !== "production" && function() {
|
|
3047
3048
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
3048
3049
|
var e = L, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
3049
3050
|
function n(b) {
|
|
@@ -3109,20 +3110,20 @@ function mo() {
|
|
|
3109
3110
|
return v();
|
|
3110
3111
|
}
|
|
3111
3112
|
var f = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", g = !f, y = g ? m : p, M = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : y;
|
|
3112
|
-
|
|
3113
|
-
}()),
|
|
3113
|
+
Dt.useSyncExternalStore = M, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
3114
|
+
}()), Dt;
|
|
3114
3115
|
}
|
|
3115
|
-
|
|
3116
|
-
var
|
|
3117
|
-
const
|
|
3116
|
+
it.NODE_ENV === "production" ? Vt.exports = mo() : Vt.exports = go();
|
|
3117
|
+
var At = Vt.exports;
|
|
3118
|
+
const yo = (...e) => (t) => {
|
|
3118
3119
|
e.forEach((n) => {
|
|
3119
3120
|
typeof n == "function" ? n(t) : n && (n.current = t);
|
|
3120
3121
|
});
|
|
3121
|
-
},
|
|
3122
|
-
const t =
|
|
3122
|
+
}, vo = ({ contentComponent: e }) => {
|
|
3123
|
+
const t = At.useSyncExternalStore(e.subscribe, e.getSnapshot, e.getServerSnapshot);
|
|
3123
3124
|
return L.createElement(L.Fragment, null, Object.values(t));
|
|
3124
3125
|
};
|
|
3125
|
-
function
|
|
3126
|
+
function bo() {
|
|
3126
3127
|
const e = /* @__PURE__ */ new Set();
|
|
3127
3128
|
let t = {};
|
|
3128
3129
|
return {
|
|
@@ -3146,7 +3147,7 @@ function vo() {
|
|
|
3146
3147
|
setRenderer(n, r) {
|
|
3147
3148
|
t = {
|
|
3148
3149
|
...t,
|
|
3149
|
-
[n]:
|
|
3150
|
+
[n]: vr.createPortal(r.reactElement, r.element, n)
|
|
3150
3151
|
}, e.forEach((s) => s());
|
|
3151
3152
|
},
|
|
3152
3153
|
/**
|
|
@@ -3158,7 +3159,7 @@ function vo() {
|
|
|
3158
3159
|
}
|
|
3159
3160
|
};
|
|
3160
3161
|
}
|
|
3161
|
-
class
|
|
3162
|
+
class Mo extends L.Component {
|
|
3162
3163
|
constructor(t) {
|
|
3163
3164
|
var n;
|
|
3164
3165
|
super(t), this.editorContentRef = L.createRef(), this.initialized = !1, this.state = {
|
|
@@ -3179,7 +3180,7 @@ class bo extends L.Component {
|
|
|
3179
3180
|
const n = this.editorContentRef.current;
|
|
3180
3181
|
n.append(...t.options.element.childNodes), t.setOptions({
|
|
3181
3182
|
element: n
|
|
3182
|
-
}), t.contentComponent =
|
|
3183
|
+
}), t.contentComponent = bo(), this.state.hasContentComponentInitialized || (this.unsubscribeToContentComponent = t.contentComponent.subscribe(() => {
|
|
3183
3184
|
this.setState((r) => r.hasContentComponentInitialized ? r : {
|
|
3184
3185
|
hasContentComponentInitialized: !0
|
|
3185
3186
|
}), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent();
|
|
@@ -3202,20 +3203,20 @@ class bo extends L.Component {
|
|
|
3202
3203
|
return L.createElement(
|
|
3203
3204
|
L.Fragment,
|
|
3204
3205
|
null,
|
|
3205
|
-
L.createElement("div", { ref:
|
|
3206
|
-
(t == null ? void 0 : t.contentComponent) && L.createElement(
|
|
3206
|
+
L.createElement("div", { ref: yo(n, this.editorContentRef), ...r }),
|
|
3207
|
+
(t == null ? void 0 : t.contentComponent) && L.createElement(vo, { contentComponent: t.contentComponent })
|
|
3207
3208
|
);
|
|
3208
3209
|
}
|
|
3209
3210
|
}
|
|
3210
|
-
const
|
|
3211
|
+
const So = gr((e, t) => {
|
|
3211
3212
|
const n = L.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [e.editor]);
|
|
3212
|
-
return L.createElement(
|
|
3213
|
+
return L.createElement(Mo, {
|
|
3213
3214
|
key: n,
|
|
3214
3215
|
innerRef: t,
|
|
3215
3216
|
...e
|
|
3216
3217
|
});
|
|
3217
|
-
}),
|
|
3218
|
-
var
|
|
3218
|
+
}), Oi = L.memo(So);
|
|
3219
|
+
var wo = function e(t, n) {
|
|
3219
3220
|
if (t === n) return !0;
|
|
3220
3221
|
if (t && n && typeof t == "object" && typeof n == "object") {
|
|
3221
3222
|
if (t.constructor !== n.constructor) return !1;
|
|
@@ -3260,7 +3261,7 @@ var So = function e(t, n) {
|
|
|
3260
3261
|
return !0;
|
|
3261
3262
|
}
|
|
3262
3263
|
return t !== t && n !== n;
|
|
3263
|
-
},
|
|
3264
|
+
}, ko = /* @__PURE__ */ fo(wo), Wt = { exports: {} }, It = {};
|
|
3264
3265
|
/**
|
|
3265
3266
|
* @license React
|
|
3266
3267
|
* use-sync-external-store-shim/with-selector.production.min.js
|
|
@@ -3270,16 +3271,16 @@ var So = function e(t, n) {
|
|
|
3270
3271
|
* This source code is licensed under the MIT license found in the
|
|
3271
3272
|
* LICENSE file in the root directory of this source tree.
|
|
3272
3273
|
*/
|
|
3273
|
-
var
|
|
3274
|
-
function
|
|
3275
|
-
if (
|
|
3276
|
-
|
|
3277
|
-
var e = L, t =
|
|
3274
|
+
var we;
|
|
3275
|
+
function Eo() {
|
|
3276
|
+
if (we) return It;
|
|
3277
|
+
we = 1;
|
|
3278
|
+
var e = L, t = At;
|
|
3278
3279
|
function n(l, u) {
|
|
3279
3280
|
return l === u && (l !== 0 || 1 / l === 1 / u) || l !== l && u !== u;
|
|
3280
3281
|
}
|
|
3281
3282
|
var r = typeof Object.is == "function" ? Object.is : n, s = t.useSyncExternalStore, o = e.useRef, i = e.useEffect, a = e.useMemo, c = e.useDebugValue;
|
|
3282
|
-
return
|
|
3283
|
+
return It.useSyncExternalStoreWithSelector = function(l, u, d, p, h) {
|
|
3283
3284
|
var m = o(null);
|
|
3284
3285
|
if (m.current === null) {
|
|
3285
3286
|
var f = { hasValue: !1, value: null };
|
|
@@ -3309,9 +3310,9 @@ function ko() {
|
|
|
3309
3310
|
return i(function() {
|
|
3310
3311
|
f.hasValue = !0, f.value = g;
|
|
3311
3312
|
}, [g]), c(g), g;
|
|
3312
|
-
},
|
|
3313
|
+
}, It;
|
|
3313
3314
|
}
|
|
3314
|
-
var
|
|
3315
|
+
var Nt = {};
|
|
3315
3316
|
/**
|
|
3316
3317
|
* @license React
|
|
3317
3318
|
* use-sync-external-store-shim/with-selector.development.js
|
|
@@ -3321,11 +3322,11 @@ var It = {};
|
|
|
3321
3322
|
* This source code is licensed under the MIT license found in the
|
|
3322
3323
|
* LICENSE file in the root directory of this source tree.
|
|
3323
3324
|
*/
|
|
3324
|
-
var
|
|
3325
|
-
function
|
|
3326
|
-
return
|
|
3325
|
+
var ke;
|
|
3326
|
+
function To() {
|
|
3327
|
+
return ke || (ke = 1, it.NODE_ENV !== "production" && function() {
|
|
3327
3328
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
3328
|
-
var e = L, t =
|
|
3329
|
+
var e = L, t = At;
|
|
3329
3330
|
function n(u, d) {
|
|
3330
3331
|
return u === d && (u !== 0 || 1 / u === 1 / d) || u !== u && d !== d;
|
|
3331
3332
|
}
|
|
@@ -3348,11 +3349,11 @@ function Eo() {
|
|
|
3348
3349
|
}
|
|
3349
3350
|
return T = X, X;
|
|
3350
3351
|
}
|
|
3351
|
-
var rt = S,
|
|
3352
|
+
var rt = S, z = T;
|
|
3352
3353
|
if (r(rt, B))
|
|
3353
|
-
return
|
|
3354
|
+
return z;
|
|
3354
3355
|
var V = h(B);
|
|
3355
|
-
return m !== void 0 && m(
|
|
3356
|
+
return m !== void 0 && m(z, V) ? z : (S = B, T = V, V);
|
|
3356
3357
|
}, O = p === void 0 ? null : p, C = function() {
|
|
3357
3358
|
return A(d());
|
|
3358
3359
|
}, D = O === null ? void 0 : function() {
|
|
@@ -3364,13 +3365,13 @@ function Eo() {
|
|
|
3364
3365
|
g.hasValue = !0, g.value = v;
|
|
3365
3366
|
}, [v]), c(v), v;
|
|
3366
3367
|
}
|
|
3367
|
-
|
|
3368
|
-
}()),
|
|
3368
|
+
Nt.useSyncExternalStoreWithSelector = l, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
3369
|
+
}()), Nt;
|
|
3369
3370
|
}
|
|
3370
|
-
|
|
3371
|
-
var
|
|
3372
|
-
const
|
|
3373
|
-
class
|
|
3371
|
+
it.NODE_ENV === "production" ? Wt.exports = Eo() : Wt.exports = To();
|
|
3372
|
+
var Co = Wt.exports;
|
|
3373
|
+
const xo = typeof window < "u" ? yr : Yt;
|
|
3374
|
+
class Ao {
|
|
3374
3375
|
constructor(t) {
|
|
3375
3376
|
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);
|
|
3376
3377
|
}
|
|
@@ -3408,13 +3409,13 @@ class xo {
|
|
|
3408
3409
|
}
|
|
3409
3410
|
}
|
|
3410
3411
|
}
|
|
3411
|
-
function
|
|
3412
|
+
function Oo(e) {
|
|
3412
3413
|
var t;
|
|
3413
|
-
const [n] =
|
|
3414
|
-
return
|
|
3414
|
+
const [n] = Jt(() => new Ao(e.editor)), r = Co.useSyncExternalStoreWithSelector(n.subscribe, n.getSnapshot, n.getServerSnapshot, e.selector, (t = e.equalityFn) !== null && t !== void 0 ? t : ko);
|
|
3415
|
+
return xo(() => n.watch(e.editor), [e.editor, n]), je(r), r;
|
|
3415
3416
|
}
|
|
3416
|
-
const
|
|
3417
|
-
class
|
|
3417
|
+
const Ee = it.NODE_ENV !== "production", Kt = typeof window > "u", Lo = Kt || !!(typeof window < "u" && window.next);
|
|
3418
|
+
class re {
|
|
3418
3419
|
constructor(t) {
|
|
3419
3420
|
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);
|
|
3420
3421
|
}
|
|
@@ -3423,8 +3424,8 @@ class ne {
|
|
|
3423
3424
|
}
|
|
3424
3425
|
getInitialEditor() {
|
|
3425
3426
|
if (this.options.current.immediatelyRender === void 0)
|
|
3426
|
-
return
|
|
3427
|
-
if (this.options.current.immediatelyRender &&
|
|
3427
|
+
return Kt || Lo ? (Ee && console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."), null) : this.createEditor();
|
|
3428
|
+
if (this.options.current.immediatelyRender && Kt && Ee)
|
|
3428
3429
|
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.");
|
|
3429
3430
|
return this.options.current.immediatelyRender ? this.createEditor() : null;
|
|
3430
3431
|
}
|
|
@@ -3480,7 +3481,7 @@ class ne {
|
|
|
3480
3481
|
return (o = (s = this.options.current).onPaste) === null || o === void 0 ? void 0 : o.call(s, ...r);
|
|
3481
3482
|
}
|
|
3482
3483
|
};
|
|
3483
|
-
return new
|
|
3484
|
+
return new co(t);
|
|
3484
3485
|
}
|
|
3485
3486
|
/**
|
|
3486
3487
|
* Get the current editor instance.
|
|
@@ -3514,7 +3515,7 @@ class ne {
|
|
|
3514
3515
|
* @returns A cleanup function
|
|
3515
3516
|
*/
|
|
3516
3517
|
onRender(t) {
|
|
3517
|
-
return () => (this.isComponentMounted = !0, clearTimeout(this.scheduledDestructionTimeout), this.editor && !this.editor.isDestroyed && t.length === 0 ?
|
|
3518
|
+
return () => (this.isComponentMounted = !0, clearTimeout(this.scheduledDestructionTimeout), this.editor && !this.editor.isDestroyed && t.length === 0 ? re.compareOptions(this.options.current, this.editor.options) || this.editor.setOptions({
|
|
3518
3519
|
...this.options.current,
|
|
3519
3520
|
editable: this.editor.isEditable
|
|
3520
3521
|
}) : this.refreshEditorInstance(t), () => {
|
|
@@ -3551,22 +3552,22 @@ class ne {
|
|
|
3551
3552
|
}, 1);
|
|
3552
3553
|
}
|
|
3553
3554
|
}
|
|
3554
|
-
function
|
|
3555
|
-
const n =
|
|
3555
|
+
function Li(e = {}, t = []) {
|
|
3556
|
+
const n = mr(e);
|
|
3556
3557
|
n.current = e;
|
|
3557
|
-
const [r] =
|
|
3558
|
-
return
|
|
3558
|
+
const [r] = Jt(() => new re(n)), s = At.useSyncExternalStore(r.subscribe, r.getEditor, r.getServerSnapshot);
|
|
3559
|
+
return je(s), Yt(r.onRender(t)), Oo({
|
|
3559
3560
|
editor: s,
|
|
3560
3561
|
selector: ({ transactionNumber: o }) => e.shouldRerenderOnTransaction === !1 ? null : e.immediatelyRender && o === 0 ? 0 : o + 1
|
|
3561
3562
|
}), s;
|
|
3562
3563
|
}
|
|
3563
|
-
const
|
|
3564
|
+
const on = Fe({
|
|
3564
3565
|
editor: null
|
|
3565
3566
|
});
|
|
3566
|
-
|
|
3567
|
-
const
|
|
3568
|
-
const [t, n] =
|
|
3569
|
-
return
|
|
3567
|
+
on.Consumer;
|
|
3568
|
+
const Po = () => ze(on), Pi = (e) => {
|
|
3569
|
+
const [t, n] = Jt(null), { editor: r } = Po();
|
|
3570
|
+
return Yt(() => {
|
|
3570
3571
|
var s;
|
|
3571
3572
|
if (!t || !((s = e.editor) === null || s === void 0) && s.isDestroyed || r != null && r.isDestroyed)
|
|
3572
3573
|
return;
|
|
@@ -3575,7 +3576,7 @@ const Lo = () => je(sn), Li = (e) => {
|
|
|
3575
3576
|
console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
|
|
3576
3577
|
return;
|
|
3577
3578
|
}
|
|
3578
|
-
const d =
|
|
3579
|
+
const d = sn({
|
|
3579
3580
|
updateDelay: c,
|
|
3580
3581
|
editor: u,
|
|
3581
3582
|
element: t,
|
|
@@ -3587,10 +3588,10 @@ const Lo = () => je(sn), Li = (e) => {
|
|
|
3587
3588
|
u.unregisterPlugin(o);
|
|
3588
3589
|
};
|
|
3589
3590
|
}, [e.editor, r, t]), L.createElement("div", { ref: n, className: e.className, style: { visibility: "hidden" } }, e.children);
|
|
3590
|
-
},
|
|
3591
|
+
}, an = Fe({
|
|
3591
3592
|
onDragStart: void 0
|
|
3592
|
-
}),
|
|
3593
|
-
const t = e.as || "div", { nodeViewContentRef: n } =
|
|
3593
|
+
}), ln = () => ze(an), Ri = (e) => {
|
|
3594
|
+
const t = e.as || "div", { nodeViewContentRef: n } = ln();
|
|
3594
3595
|
return (
|
|
3595
3596
|
// @ts-ignore
|
|
3596
3597
|
L.createElement(t, { ...e, ref: n, "data-node-view-content": "", style: {
|
|
@@ -3598,8 +3599,8 @@ const Lo = () => je(sn), Li = (e) => {
|
|
|
3598
3599
|
...e.style
|
|
3599
3600
|
} })
|
|
3600
3601
|
);
|
|
3601
|
-
},
|
|
3602
|
-
const { onDragStart: n } =
|
|
3602
|
+
}, $i = L.forwardRef((e, t) => {
|
|
3603
|
+
const { onDragStart: n } = ln(), r = e.as || "div";
|
|
3603
3604
|
return (
|
|
3604
3605
|
// @ts-ignore
|
|
3605
3606
|
L.createElement(r, { ...e, ref: t, "data-node-view-wrapper": "", onDragStart: n, style: {
|
|
@@ -3608,19 +3609,19 @@ const Lo = () => je(sn), Li = (e) => {
|
|
|
3608
3609
|
} })
|
|
3609
3610
|
);
|
|
3610
3611
|
});
|
|
3611
|
-
function
|
|
3612
|
+
function Ro(e) {
|
|
3612
3613
|
return !!(typeof e == "function" && e.prototype && e.prototype.isReactComponent);
|
|
3613
3614
|
}
|
|
3614
|
-
function
|
|
3615
|
+
function $o(e) {
|
|
3615
3616
|
var t;
|
|
3616
3617
|
return typeof e == "object" && ((t = e.$$typeof) === null || t === void 0 ? void 0 : t.toString()) === "Symbol(react.forward_ref)";
|
|
3617
3618
|
}
|
|
3618
|
-
class
|
|
3619
|
+
class _o {
|
|
3619
3620
|
/**
|
|
3620
3621
|
* Immediately creates element and renders the provided React component.
|
|
3621
3622
|
*/
|
|
3622
3623
|
constructor(t, { editor: n, props: r = {}, as: s = "div", className: o = "" }) {
|
|
3623
|
-
this.ref = null, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = t, this.editor = n, this.props = r, this.element = document.createElement(s), this.element.classList.add("react-renderer"), o && this.element.classList.add(...o.split(" ")), this.editor.isInitialized ?
|
|
3624
|
+
this.ref = null, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = t, this.editor = n, this.props = r, this.element = document.createElement(s), this.element.classList.add("react-renderer"), o && this.element.classList.add(...o.split(" ")), this.editor.isInitialized ? br(() => {
|
|
3624
3625
|
this.render();
|
|
3625
3626
|
}) : this.render();
|
|
3626
3627
|
}
|
|
@@ -3630,7 +3631,7 @@ class $o {
|
|
|
3630
3631
|
render() {
|
|
3631
3632
|
var t;
|
|
3632
3633
|
const n = this.component, r = this.props, s = this.editor;
|
|
3633
|
-
(
|
|
3634
|
+
(Ro(n) || $o(n)) && (r.ref = (o) => {
|
|
3634
3635
|
this.ref = o;
|
|
3635
3636
|
}), this.reactElement = L.createElement(n, { ...r }), (t = s == null ? void 0 : s.contentComponent) === null || t === void 0 || t.setRenderer(this.id, this);
|
|
3636
3637
|
}
|
|
@@ -3660,7 +3661,7 @@ class $o {
|
|
|
3660
3661
|
});
|
|
3661
3662
|
}
|
|
3662
3663
|
}
|
|
3663
|
-
class
|
|
3664
|
+
class Ho extends uo {
|
|
3664
3665
|
/**
|
|
3665
3666
|
* Setup the React component.
|
|
3666
3667
|
* Called on initialization.
|
|
@@ -3685,12 +3686,12 @@ class _o extends co {
|
|
|
3685
3686
|
}
|
|
3686
3687
|
const s = { onDragStart: this.onDragStart.bind(this), nodeViewContentRef: (l) => {
|
|
3687
3688
|
l && this.contentDOMElement && l.firstChild !== this.contentDOMElement && l.appendChild(this.contentDOMElement);
|
|
3688
|
-
} }, o = this.component, i = L.memo((l) => L.createElement(
|
|
3689
|
+
} }, o = this.component, i = L.memo((l) => L.createElement(an.Provider, { value: s }, L.createElement(o, l)));
|
|
3689
3690
|
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");
|
|
3690
3691
|
let a = this.node.isInline ? "span" : "div";
|
|
3691
3692
|
this.options.as && (a = this.options.as);
|
|
3692
3693
|
const { className: c = "" } = this.options;
|
|
3693
|
-
this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.renderer = new
|
|
3694
|
+
this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.renderer = new _o(i, {
|
|
3694
3695
|
editor: this.editor,
|
|
3695
3696
|
props: t,
|
|
3696
3697
|
as: a,
|
|
@@ -3787,7 +3788,7 @@ class _o extends co {
|
|
|
3787
3788
|
if (this.options.attrs) {
|
|
3788
3789
|
let t = {};
|
|
3789
3790
|
if (typeof this.options.attrs == "function") {
|
|
3790
|
-
const n = this.editor.extensionManager.attributes, r =
|
|
3791
|
+
const n = this.editor.extensionManager.attributes, r = yt(this.node, n);
|
|
3791
3792
|
t = this.options.attrs({ node: this.node, HTMLAttributes: r });
|
|
3792
3793
|
} else
|
|
3793
3794
|
t = this.options.attrs;
|
|
@@ -3795,10 +3796,10 @@ class _o extends co {
|
|
|
3795
3796
|
}
|
|
3796
3797
|
}
|
|
3797
3798
|
}
|
|
3798
|
-
function
|
|
3799
|
-
return (n) => n.editor.contentComponent ? new
|
|
3799
|
+
function _i(e, t) {
|
|
3800
|
+
return (n) => n.editor.contentComponent ? new Ho(e, n, t) : {};
|
|
3800
3801
|
}
|
|
3801
|
-
const
|
|
3802
|
+
const Do = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Io = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, No = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, Bo = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, Hi = N.create({
|
|
3802
3803
|
name: "bold",
|
|
3803
3804
|
addOptions() {
|
|
3804
3805
|
return {
|
|
@@ -3843,11 +3844,11 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
3843
3844
|
addInputRules() {
|
|
3844
3845
|
return [
|
|
3845
3846
|
Y({
|
|
3846
|
-
find:
|
|
3847
|
+
find: Do,
|
|
3847
3848
|
type: this.type
|
|
3848
3849
|
}),
|
|
3849
3850
|
Y({
|
|
3850
|
-
find:
|
|
3851
|
+
find: No,
|
|
3851
3852
|
type: this.type
|
|
3852
3853
|
})
|
|
3853
3854
|
];
|
|
@@ -3855,16 +3856,16 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
3855
3856
|
addPasteRules() {
|
|
3856
3857
|
return [
|
|
3857
3858
|
U({
|
|
3858
|
-
find:
|
|
3859
|
+
find: Io,
|
|
3859
3860
|
type: this.type
|
|
3860
3861
|
}),
|
|
3861
3862
|
U({
|
|
3862
|
-
find:
|
|
3863
|
+
find: Bo,
|
|
3863
3864
|
type: this.type
|
|
3864
3865
|
})
|
|
3865
3866
|
];
|
|
3866
3867
|
}
|
|
3867
|
-
}),
|
|
3868
|
+
}), jo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, zo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, Fo = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, Vo = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, Di = N.create({
|
|
3868
3869
|
name: "italic",
|
|
3869
3870
|
addOptions() {
|
|
3870
3871
|
return {
|
|
@@ -3908,7 +3909,7 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
3908
3909
|
addInputRules() {
|
|
3909
3910
|
return [
|
|
3910
3911
|
Y({
|
|
3911
|
-
find:
|
|
3912
|
+
find: jo,
|
|
3912
3913
|
type: this.type
|
|
3913
3914
|
}),
|
|
3914
3915
|
Y({
|
|
@@ -3920,16 +3921,16 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
3920
3921
|
addPasteRules() {
|
|
3921
3922
|
return [
|
|
3922
3923
|
U({
|
|
3923
|
-
find:
|
|
3924
|
+
find: zo,
|
|
3924
3925
|
type: this.type
|
|
3925
3926
|
}),
|
|
3926
3927
|
U({
|
|
3927
|
-
find:
|
|
3928
|
+
find: Vo,
|
|
3928
3929
|
type: this.type
|
|
3929
3930
|
})
|
|
3930
3931
|
];
|
|
3931
3932
|
}
|
|
3932
|
-
}),
|
|
3933
|
+
}), Ii = N.create({
|
|
3933
3934
|
name: "underline",
|
|
3934
3935
|
addOptions() {
|
|
3935
3936
|
return {
|
|
@@ -3964,7 +3965,7 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
3964
3965
|
"Mod-U": () => this.editor.commands.toggleUnderline()
|
|
3965
3966
|
};
|
|
3966
3967
|
}
|
|
3967
|
-
}),
|
|
3968
|
+
}), Wo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, Ko = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, Ni = N.create({
|
|
3968
3969
|
name: "strike",
|
|
3969
3970
|
addOptions() {
|
|
3970
3971
|
return {
|
|
@@ -4007,7 +4008,7 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4007
4008
|
addInputRules() {
|
|
4008
4009
|
return [
|
|
4009
4010
|
Y({
|
|
4010
|
-
find:
|
|
4011
|
+
find: Wo,
|
|
4011
4012
|
type: this.type
|
|
4012
4013
|
})
|
|
4013
4014
|
];
|
|
@@ -4015,12 +4016,12 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4015
4016
|
addPasteRules() {
|
|
4016
4017
|
return [
|
|
4017
4018
|
U({
|
|
4018
|
-
find:
|
|
4019
|
+
find: Ko,
|
|
4019
4020
|
type: this.type
|
|
4020
4021
|
})
|
|
4021
4022
|
];
|
|
4022
4023
|
}
|
|
4023
|
-
}),
|
|
4024
|
+
}), Uo = /(^|[^`])`([^`]+)`(?!`)/, qo = /(^|[^`])`([^`]+)`(?!`)/g, Bi = N.create({
|
|
4024
4025
|
name: "code",
|
|
4025
4026
|
addOptions() {
|
|
4026
4027
|
return {
|
|
@@ -4053,7 +4054,7 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4053
4054
|
addInputRules() {
|
|
4054
4055
|
return [
|
|
4055
4056
|
Y({
|
|
4056
|
-
find:
|
|
4057
|
+
find: Uo,
|
|
4057
4058
|
type: this.type
|
|
4058
4059
|
})
|
|
4059
4060
|
];
|
|
@@ -4061,12 +4062,12 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4061
4062
|
addPasteRules() {
|
|
4062
4063
|
return [
|
|
4063
4064
|
U({
|
|
4064
|
-
find:
|
|
4065
|
+
find: qo,
|
|
4065
4066
|
type: this.type
|
|
4066
4067
|
})
|
|
4067
4068
|
];
|
|
4068
4069
|
}
|
|
4069
|
-
}),
|
|
4070
|
+
}), Go = /^```([a-z]+)?[\s\n]$/, Jo = /^~~~([a-z]+)?[\s\n]$/, ji = P.create({
|
|
4070
4071
|
name: "codeBlock",
|
|
4071
4072
|
addOptions() {
|
|
4072
4073
|
return {
|
|
@@ -4157,14 +4158,14 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4157
4158
|
addInputRules() {
|
|
4158
4159
|
return [
|
|
4159
4160
|
Ft({
|
|
4160
|
-
find:
|
|
4161
|
+
find: Go,
|
|
4161
4162
|
type: this.type,
|
|
4162
4163
|
getAttributes: (e) => ({
|
|
4163
4164
|
language: e[1]
|
|
4164
4165
|
})
|
|
4165
4166
|
}),
|
|
4166
4167
|
Ft({
|
|
4167
|
-
find:
|
|
4168
|
+
find: Jo,
|
|
4168
4169
|
type: this.type,
|
|
4169
4170
|
getAttributes: (e) => ({
|
|
4170
4171
|
language: e[1]
|
|
@@ -4193,7 +4194,7 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4193
4194
|
})
|
|
4194
4195
|
];
|
|
4195
4196
|
}
|
|
4196
|
-
}),
|
|
4197
|
+
}), Yo = (e) => {
|
|
4197
4198
|
if (!e.children.length)
|
|
4198
4199
|
return;
|
|
4199
4200
|
const t = e.querySelectorAll("span");
|
|
@@ -4202,7 +4203,7 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4202
4203
|
const o = n.getAttribute("style"), i = (s = (r = n.parentElement) === null || r === void 0 ? void 0 : r.closest("span")) === null || s === void 0 ? void 0 : s.getAttribute("style");
|
|
4203
4204
|
n.setAttribute("style", `${i};${o}`);
|
|
4204
4205
|
});
|
|
4205
|
-
},
|
|
4206
|
+
}, zi = N.create({
|
|
4206
4207
|
name: "textStyle",
|
|
4207
4208
|
priority: 101,
|
|
4208
4209
|
addOptions() {
|
|
@@ -4215,7 +4216,7 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4215
4216
|
return [
|
|
4216
4217
|
{
|
|
4217
4218
|
tag: "span",
|
|
4218
|
-
getAttrs: (e) => e.hasAttribute("style") ? (this.options.mergeNestedSpanStyles &&
|
|
4219
|
+
getAttrs: (e) => e.hasAttribute("style") ? (this.options.mergeNestedSpanStyles && Yo(e), {}) : !1
|
|
4219
4220
|
}
|
|
4220
4221
|
];
|
|
4221
4222
|
},
|
|
@@ -4263,7 +4264,7 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4263
4264
|
unsetFontFamily: () => ({ chain: e }) => e().setMark("textStyle", { fontFamily: null }).removeEmptyTextStyle().run()
|
|
4264
4265
|
};
|
|
4265
4266
|
}
|
|
4266
|
-
}),
|
|
4267
|
+
}), Vi = P.create({
|
|
4267
4268
|
name: "heading",
|
|
4268
4269
|
addOptions() {
|
|
4269
4270
|
return {
|
|
@@ -4312,7 +4313,7 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4312
4313
|
}
|
|
4313
4314
|
}));
|
|
4314
4315
|
}
|
|
4315
|
-
}),
|
|
4316
|
+
}), Wi = R.create({
|
|
4316
4317
|
name: "textAlign",
|
|
4317
4318
|
addOptions() {
|
|
4318
4319
|
return {
|
|
@@ -4352,7 +4353,7 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4352
4353
|
"Mod-Shift-j": () => this.editor.commands.setTextAlign("justify")
|
|
4353
4354
|
};
|
|
4354
4355
|
}
|
|
4355
|
-
}),
|
|
4356
|
+
}), Ki = R.create({
|
|
4356
4357
|
name: "color",
|
|
4357
4358
|
addOptions() {
|
|
4358
4359
|
return {
|
|
@@ -4384,7 +4385,7 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4384
4385
|
unsetColor: () => ({ chain: e }) => e().setMark("textStyle", { color: null }).removeEmptyTextStyle().run()
|
|
4385
4386
|
};
|
|
4386
4387
|
}
|
|
4387
|
-
}),
|
|
4388
|
+
}), Xo = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, Qo = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, Ui = N.create({
|
|
4388
4389
|
name: "highlight",
|
|
4389
4390
|
addOptions() {
|
|
4390
4391
|
return {
|
|
@@ -4429,7 +4430,7 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4429
4430
|
addInputRules() {
|
|
4430
4431
|
return [
|
|
4431
4432
|
Y({
|
|
4432
|
-
find:
|
|
4433
|
+
find: Xo,
|
|
4433
4434
|
type: this.type
|
|
4434
4435
|
})
|
|
4435
4436
|
];
|
|
@@ -4437,12 +4438,12 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4437
4438
|
addPasteRules() {
|
|
4438
4439
|
return [
|
|
4439
4440
|
U({
|
|
4440
|
-
find:
|
|
4441
|
+
find: Qo,
|
|
4441
4442
|
type: this.type
|
|
4442
4443
|
})
|
|
4443
4444
|
];
|
|
4444
4445
|
}
|
|
4445
|
-
}),
|
|
4446
|
+
}), Zo = "listItem", Te = "textStyle", Ce = /^\s*([-+*])\s$/, qi = P.create({
|
|
4446
4447
|
name: "bulletList",
|
|
4447
4448
|
addOptions() {
|
|
4448
4449
|
return {
|
|
@@ -4466,7 +4467,7 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4466
4467
|
},
|
|
4467
4468
|
addCommands() {
|
|
4468
4469
|
return {
|
|
4469
|
-
toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
4470
|
+
toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Zo, this.editor.getAttributes(Te)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
4470
4471
|
};
|
|
4471
4472
|
},
|
|
4472
4473
|
addKeyboardShortcuts() {
|
|
@@ -4476,21 +4477,21 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4476
4477
|
},
|
|
4477
4478
|
addInputRules() {
|
|
4478
4479
|
let e = nt({
|
|
4479
|
-
find:
|
|
4480
|
+
find: Ce,
|
|
4480
4481
|
type: this.type
|
|
4481
4482
|
});
|
|
4482
4483
|
return (this.options.keepMarks || this.options.keepAttributes) && (e = nt({
|
|
4483
|
-
find:
|
|
4484
|
+
find: Ce,
|
|
4484
4485
|
type: this.type,
|
|
4485
4486
|
keepMarks: this.options.keepMarks,
|
|
4486
4487
|
keepAttributes: this.options.keepAttributes,
|
|
4487
|
-
getAttributes: () => this.editor.getAttributes(
|
|
4488
|
+
getAttributes: () => this.editor.getAttributes(Te),
|
|
4488
4489
|
editor: this.editor
|
|
4489
4490
|
})), [
|
|
4490
4491
|
e
|
|
4491
4492
|
];
|
|
4492
4493
|
}
|
|
4493
|
-
}),
|
|
4494
|
+
}), ti = "listItem", xe = "textStyle", Ae = /^(\d+)\.\s$/, Gi = P.create({
|
|
4494
4495
|
name: "orderedList",
|
|
4495
4496
|
addOptions() {
|
|
4496
4497
|
return {
|
|
@@ -4529,7 +4530,7 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4529
4530
|
},
|
|
4530
4531
|
addCommands() {
|
|
4531
4532
|
return {
|
|
4532
|
-
toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
4533
|
+
toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ti, this.editor.getAttributes(xe)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
4533
4534
|
};
|
|
4534
4535
|
},
|
|
4535
4536
|
addKeyboardShortcuts() {
|
|
@@ -4539,24 +4540,24 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4539
4540
|
},
|
|
4540
4541
|
addInputRules() {
|
|
4541
4542
|
let e = nt({
|
|
4542
|
-
find:
|
|
4543
|
+
find: Ae,
|
|
4543
4544
|
type: this.type,
|
|
4544
4545
|
getAttributes: (t) => ({ start: +t[1] }),
|
|
4545
4546
|
joinPredicate: (t, n) => n.childCount + n.attrs.start === +t[1]
|
|
4546
4547
|
});
|
|
4547
4548
|
return (this.options.keepMarks || this.options.keepAttributes) && (e = nt({
|
|
4548
|
-
find:
|
|
4549
|
+
find: Ae,
|
|
4549
4550
|
type: this.type,
|
|
4550
4551
|
keepMarks: this.options.keepMarks,
|
|
4551
4552
|
keepAttributes: this.options.keepAttributes,
|
|
4552
|
-
getAttributes: (t) => ({ start: +t[1], ...this.editor.getAttributes(
|
|
4553
|
+
getAttributes: (t) => ({ start: +t[1], ...this.editor.getAttributes(xe) }),
|
|
4553
4554
|
joinPredicate: (t, n) => n.childCount + n.attrs.start === +t[1],
|
|
4554
4555
|
editor: this.editor
|
|
4555
4556
|
})), [
|
|
4556
4557
|
e
|
|
4557
4558
|
];
|
|
4558
4559
|
}
|
|
4559
|
-
}),
|
|
4560
|
+
}), ei = /^\s*(\[([( |x])?\])\s$/, Ji = P.create({
|
|
4560
4561
|
name: "taskItem",
|
|
4561
4562
|
addOptions() {
|
|
4562
4563
|
return {
|
|
@@ -4655,7 +4656,7 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4655
4656
|
addInputRules() {
|
|
4656
4657
|
return [
|
|
4657
4658
|
nt({
|
|
4658
|
-
find:
|
|
4659
|
+
find: ei,
|
|
4659
4660
|
type: this.type,
|
|
4660
4661
|
getAttributes: (e) => ({
|
|
4661
4662
|
checked: e[e.length - 1] === "x"
|
|
@@ -4663,7 +4664,7 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4663
4664
|
})
|
|
4664
4665
|
];
|
|
4665
4666
|
}
|
|
4666
|
-
}),
|
|
4667
|
+
}), Yi = P.create({
|
|
4667
4668
|
name: "taskList",
|
|
4668
4669
|
addOptions() {
|
|
4669
4670
|
return {
|
|
@@ -4696,7 +4697,7 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4696
4697
|
"Mod-Shift-9": () => this.editor.commands.toggleTaskList()
|
|
4697
4698
|
};
|
|
4698
4699
|
}
|
|
4699
|
-
}),
|
|
4700
|
+
}), ni = /^\s*>\s$/, Xi = P.create({
|
|
4700
4701
|
name: "blockquote",
|
|
4701
4702
|
addOptions() {
|
|
4702
4703
|
return {
|
|
@@ -4729,25 +4730,25 @@ const Ho = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Do = /(?:^|\s
|
|
|
4729
4730
|
addInputRules() {
|
|
4730
4731
|
return [
|
|
4731
4732
|
nt({
|
|
4732
|
-
find:
|
|
4733
|
+
find: ni,
|
|
4733
4734
|
type: this.type
|
|
4734
4735
|
})
|
|
4735
4736
|
];
|
|
4736
4737
|
}
|
|
4737
4738
|
});
|
|
4738
|
-
function
|
|
4739
|
+
function ri(e) {
|
|
4739
4740
|
return e.length === 1 ? e[0].isLink : e.length === 3 && e[1].isLink ? ["()", "[]"].includes(e[0].value + e[2].value) : !1;
|
|
4740
4741
|
}
|
|
4741
|
-
function
|
|
4742
|
+
function si(e) {
|
|
4742
4743
|
return new $({
|
|
4743
4744
|
key: new _("autolink"),
|
|
4744
4745
|
appendTransaction: (t, n, r) => {
|
|
4745
4746
|
const s = t.some((l) => l.docChanged) && !n.doc.eq(r.doc), o = t.some((l) => l.getMeta("preventAutolink"));
|
|
4746
4747
|
if (!s || o)
|
|
4747
4748
|
return;
|
|
4748
|
-
const { tr: i } = r, a =
|
|
4749
|
-
if (
|
|
4750
|
-
const u =
|
|
4749
|
+
const { tr: i } = r, a = Es(n.doc, [...t]);
|
|
4750
|
+
if (Ps(a).forEach(({ newRange: l }) => {
|
|
4751
|
+
const u = Cs(r.doc, l, (h) => h.isTextblock);
|
|
4751
4752
|
let d, p;
|
|
4752
4753
|
if (u.length > 1 ? (d = u[0], p = r.doc.textBetween(d.pos, d.pos + d.node.nodeSize, void 0, " ")) : u.length && r.doc.textBetween(l.from, l.to, " ", " ").endsWith(" ") && (d = u[0], p = r.doc.textBetween(d.pos, l.to, void 0, " ")), d && p) {
|
|
4753
4754
|
const h = p.split(" ").filter((y) => y !== "");
|
|
@@ -4756,15 +4757,15 @@ function ri(e) {
|
|
|
4756
4757
|
const m = h[h.length - 1], f = d.pos + p.lastIndexOf(m);
|
|
4757
4758
|
if (!m)
|
|
4758
4759
|
return !1;
|
|
4759
|
-
const g =
|
|
4760
|
-
if (!
|
|
4760
|
+
const g = Un(m).map((y) => y.toObject(e.defaultProtocol));
|
|
4761
|
+
if (!ri(g))
|
|
4761
4762
|
return !1;
|
|
4762
4763
|
g.filter((y) => y.isLink).map((y) => ({
|
|
4763
4764
|
...y,
|
|
4764
4765
|
from: f + y.start + 1,
|
|
4765
4766
|
to: f + y.end + 1
|
|
4766
4767
|
})).filter((y) => r.schema.marks.code ? !r.doc.rangeHasMark(y.from, y.to, r.schema.marks.code) : !0).filter((y) => e.validate(y.value)).filter((y) => e.shouldAutoLink(y.value)).forEach((y) => {
|
|
4767
|
-
|
|
4768
|
+
ne(y.from, y.to, r.doc).some((M) => M.mark.type === e.type) || i.addMark(y.from, y.to, e.type.create({
|
|
4768
4769
|
href: y.href
|
|
4769
4770
|
}));
|
|
4770
4771
|
});
|
|
@@ -4774,7 +4775,7 @@ function ri(e) {
|
|
|
4774
4775
|
}
|
|
4775
4776
|
});
|
|
4776
4777
|
}
|
|
4777
|
-
function
|
|
4778
|
+
function oi(e) {
|
|
4778
4779
|
return new $({
|
|
4779
4780
|
key: new _("handleClickLink"),
|
|
4780
4781
|
props: {
|
|
@@ -4788,13 +4789,13 @@ function si(e) {
|
|
|
4788
4789
|
a.push(i), i = i.parentNode;
|
|
4789
4790
|
if (!a.find((p) => p.nodeName === "A"))
|
|
4790
4791
|
return !1;
|
|
4791
|
-
const c =
|
|
4792
|
+
const c = en(t.state, e.type.name), l = r.target, u = (s = l == null ? void 0 : l.href) !== null && s !== void 0 ? s : c.href, d = (o = l == null ? void 0 : l.target) !== null && o !== void 0 ? o : c.target;
|
|
4792
4793
|
return l && u ? (window.open(u, d), !0) : !1;
|
|
4793
4794
|
}
|
|
4794
4795
|
}
|
|
4795
4796
|
});
|
|
4796
4797
|
}
|
|
4797
|
-
function
|
|
4798
|
+
function ii(e) {
|
|
4798
4799
|
return new $({
|
|
4799
4800
|
key: new _("handlePasteLink"),
|
|
4800
4801
|
props: {
|
|
@@ -4806,7 +4807,7 @@ function oi(e) {
|
|
|
4806
4807
|
r.content.forEach((l) => {
|
|
4807
4808
|
a += l.textContent;
|
|
4808
4809
|
});
|
|
4809
|
-
const c =
|
|
4810
|
+
const c = Ne(a, { defaultProtocol: e.defaultProtocol }).find((l) => l.isLink && l.value === a);
|
|
4810
4811
|
return !a || !c ? !1 : e.editor.commands.setMark(e.type, {
|
|
4811
4812
|
href: c.href
|
|
4812
4813
|
});
|
|
@@ -4814,7 +4815,7 @@ function oi(e) {
|
|
|
4814
4815
|
}
|
|
4815
4816
|
});
|
|
4816
4817
|
}
|
|
4817
|
-
const
|
|
4818
|
+
const ai = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;
|
|
4818
4819
|
function G(e, t) {
|
|
4819
4820
|
const n = [
|
|
4820
4821
|
"http",
|
|
@@ -4831,13 +4832,13 @@ function G(e, t) {
|
|
|
4831
4832
|
return t && t.forEach((r) => {
|
|
4832
4833
|
const s = typeof r == "string" ? r : r.scheme;
|
|
4833
4834
|
s && n.push(s);
|
|
4834
|
-
}), !e || e.replace(
|
|
4835
|
+
}), !e || e.replace(ai, "").match(new RegExp(
|
|
4835
4836
|
// eslint-disable-next-line no-useless-escape
|
|
4836
4837
|
`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,
|
|
4837
4838
|
"i"
|
|
4838
4839
|
));
|
|
4839
4840
|
}
|
|
4840
|
-
const
|
|
4841
|
+
const Qi = N.create({
|
|
4841
4842
|
name: "link",
|
|
4842
4843
|
priority: 1e3,
|
|
4843
4844
|
keepOnSplit: !1,
|
|
@@ -4845,14 +4846,14 @@ const Xi = N.create({
|
|
|
4845
4846
|
onCreate() {
|
|
4846
4847
|
this.options.validate && !this.options.shouldAutoLink && (this.options.shouldAutoLink = this.options.validate, console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")), this.options.protocols.forEach((e) => {
|
|
4847
4848
|
if (typeof e == "string") {
|
|
4848
|
-
|
|
4849
|
+
le(e);
|
|
4849
4850
|
return;
|
|
4850
4851
|
}
|
|
4851
|
-
|
|
4852
|
+
le(e.scheme, e.optionalSlashes);
|
|
4852
4853
|
});
|
|
4853
4854
|
},
|
|
4854
4855
|
onDestroy() {
|
|
4855
|
-
|
|
4856
|
+
qn();
|
|
4856
4857
|
},
|
|
4857
4858
|
inclusive() {
|
|
4858
4859
|
return this.options.autolink;
|
|
@@ -4946,7 +4947,7 @@ const Xi = N.create({
|
|
|
4946
4947
|
find: (e) => {
|
|
4947
4948
|
const t = [];
|
|
4948
4949
|
if (e) {
|
|
4949
|
-
const { protocols: n, defaultProtocol: r } = this.options, s =
|
|
4950
|
+
const { protocols: n, defaultProtocol: r } = this.options, s = Ne(e).filter((o) => o.isLink && this.options.isAllowedUri(o.value, {
|
|
4950
4951
|
defaultValidate: (i) => !!G(i, n),
|
|
4951
4952
|
protocols: n,
|
|
4952
4953
|
defaultProtocol: r
|
|
@@ -4973,7 +4974,7 @@ const Xi = N.create({
|
|
|
4973
4974
|
},
|
|
4974
4975
|
addProseMirrorPlugins() {
|
|
4975
4976
|
const e = [], { protocols: t, defaultProtocol: n } = this.options;
|
|
4976
|
-
return this.options.autolink && e.push(
|
|
4977
|
+
return this.options.autolink && e.push(si({
|
|
4977
4978
|
type: this.type,
|
|
4978
4979
|
defaultProtocol: this.options.defaultProtocol,
|
|
4979
4980
|
validate: (r) => this.options.isAllowedUri(r, {
|
|
@@ -4982,15 +4983,15 @@ const Xi = N.create({
|
|
|
4982
4983
|
defaultProtocol: n
|
|
4983
4984
|
}),
|
|
4984
4985
|
shouldAutoLink: this.options.shouldAutoLink
|
|
4985
|
-
})), this.options.openOnClick === !0 && e.push(
|
|
4986
|
+
})), this.options.openOnClick === !0 && e.push(oi({
|
|
4986
4987
|
type: this.type
|
|
4987
|
-
})), this.options.linkOnPaste && e.push(
|
|
4988
|
+
})), this.options.linkOnPaste && e.push(ii({
|
|
4988
4989
|
editor: this.editor,
|
|
4989
4990
|
defaultProtocol: this.options.defaultProtocol,
|
|
4990
4991
|
type: this.type
|
|
4991
4992
|
})), e;
|
|
4992
4993
|
}
|
|
4993
|
-
}),
|
|
4994
|
+
}), Zi = P.create({
|
|
4994
4995
|
name: "horizontalRule",
|
|
4995
4996
|
addOptions() {
|
|
4996
4997
|
return {
|
|
@@ -5013,7 +5014,7 @@ const Xi = N.create({
|
|
|
5013
5014
|
to: s.pos
|
|
5014
5015
|
}, {
|
|
5015
5016
|
type: this.name
|
|
5016
|
-
}) :
|
|
5017
|
+
}) : nn(n) ? o.insertContentAt(s.pos, {
|
|
5017
5018
|
type: this.name
|
|
5018
5019
|
}) : o.insertContent({ type: this.name }), o.command(({ tr: i, dispatch: a }) => {
|
|
5019
5020
|
var c;
|
|
@@ -5034,13 +5035,13 @@ const Xi = N.create({
|
|
|
5034
5035
|
},
|
|
5035
5036
|
addInputRules() {
|
|
5036
5037
|
return [
|
|
5037
|
-
|
|
5038
|
+
rn({
|
|
5038
5039
|
find: /^(?:---|—-|___\s|\*\*\*\s)$/,
|
|
5039
5040
|
type: this.type
|
|
5040
5041
|
})
|
|
5041
5042
|
];
|
|
5042
5043
|
}
|
|
5043
|
-
}),
|
|
5044
|
+
}), ta = R.create({
|
|
5044
5045
|
name: "history",
|
|
5045
5046
|
addOptions() {
|
|
5046
5047
|
return {
|
|
@@ -5050,13 +5051,13 @@ const Xi = N.create({
|
|
|
5050
5051
|
},
|
|
5051
5052
|
addCommands() {
|
|
5052
5053
|
return {
|
|
5053
|
-
undo: () => ({ state: e, dispatch: t }) =>
|
|
5054
|
-
redo: () => ({ state: e, dispatch: t }) =>
|
|
5054
|
+
undo: () => ({ state: e, dispatch: t }) => Yn(e, t),
|
|
5055
|
+
redo: () => ({ state: e, dispatch: t }) => Jn(e, t)
|
|
5055
5056
|
};
|
|
5056
5057
|
},
|
|
5057
5058
|
addProseMirrorPlugins() {
|
|
5058
5059
|
return [
|
|
5059
|
-
|
|
5060
|
+
Gn(this.options)
|
|
5060
5061
|
];
|
|
5061
5062
|
},
|
|
5062
5063
|
addKeyboardShortcuts() {
|
|
@@ -5069,7 +5070,7 @@ const Xi = N.create({
|
|
|
5069
5070
|
"Shift-Mod-я": () => this.editor.commands.redo()
|
|
5070
5071
|
};
|
|
5071
5072
|
}
|
|
5072
|
-
}),
|
|
5073
|
+
}), ea = R.create({
|
|
5073
5074
|
name: "characterCount",
|
|
5074
5075
|
addOptions() {
|
|
5075
5076
|
return {
|
|
@@ -5135,7 +5136,7 @@ const Xi = N.create({
|
|
|
5135
5136
|
})
|
|
5136
5137
|
];
|
|
5137
5138
|
}
|
|
5138
|
-
}),
|
|
5139
|
+
}), na = R.create({
|
|
5139
5140
|
name: "dropCursor",
|
|
5140
5141
|
addOptions() {
|
|
5141
5142
|
return {
|
|
@@ -5146,10 +5147,10 @@ const Xi = N.create({
|
|
|
5146
5147
|
},
|
|
5147
5148
|
addProseMirrorPlugins() {
|
|
5148
5149
|
return [
|
|
5149
|
-
|
|
5150
|
+
Xn(this.options)
|
|
5150
5151
|
];
|
|
5151
5152
|
}
|
|
5152
|
-
}),
|
|
5153
|
+
}), ra = R.create({
|
|
5153
5154
|
name: "focus",
|
|
5154
5155
|
addOptions() {
|
|
5155
5156
|
return {
|
|
@@ -5165,7 +5166,7 @@ const Xi = N.create({
|
|
|
5165
5166
|
decorations: ({ doc: e, selection: t }) => {
|
|
5166
5167
|
const { isEditable: n, isFocused: r } = this.editor, { anchor: s } = t, o = [];
|
|
5167
5168
|
if (!n || !r)
|
|
5168
|
-
return
|
|
5169
|
+
return gt.create(e, []);
|
|
5169
5170
|
let i = 0;
|
|
5170
5171
|
this.options.mode === "deepest" && e.descendants((c, l) => {
|
|
5171
5172
|
if (c.isText)
|
|
@@ -5180,20 +5181,20 @@ const Xi = N.create({
|
|
|
5180
5181
|
return !1;
|
|
5181
5182
|
if (a += 1, this.options.mode === "deepest" && i - a > 0 || this.options.mode === "shallowest" && a > 1)
|
|
5182
5183
|
return this.options.mode === "deepest";
|
|
5183
|
-
o.push(
|
|
5184
|
+
o.push(Gt.node(l, l + c.nodeSize, {
|
|
5184
5185
|
class: this.options.className
|
|
5185
5186
|
}));
|
|
5186
|
-
}),
|
|
5187
|
+
}), gt.create(e, o);
|
|
5187
5188
|
}
|
|
5188
5189
|
}
|
|
5189
5190
|
})
|
|
5190
5191
|
];
|
|
5191
5192
|
}
|
|
5192
|
-
}),
|
|
5193
|
+
}), sa = R.create({
|
|
5193
5194
|
name: "gapCursor",
|
|
5194
5195
|
addProseMirrorPlugins() {
|
|
5195
5196
|
return [
|
|
5196
|
-
|
|
5197
|
+
Qn()
|
|
5197
5198
|
];
|
|
5198
5199
|
},
|
|
5199
5200
|
extendNodeSchema(e) {
|
|
@@ -5207,7 +5208,7 @@ const Xi = N.create({
|
|
|
5207
5208
|
allowGapCursor: (t = E(w(e, "allowGapCursor", n))) !== null && t !== void 0 ? t : null
|
|
5208
5209
|
};
|
|
5209
5210
|
}
|
|
5210
|
-
}),
|
|
5211
|
+
}), oa = P.create({
|
|
5211
5212
|
name: "hardBreak",
|
|
5212
5213
|
addOptions() {
|
|
5213
5214
|
return {
|
|
@@ -5257,7 +5258,7 @@ const Xi = N.create({
|
|
|
5257
5258
|
"Shift-Enter": () => this.editor.commands.setHardBreak()
|
|
5258
5259
|
};
|
|
5259
5260
|
}
|
|
5260
|
-
}),
|
|
5261
|
+
}), ia = P.create({
|
|
5261
5262
|
name: "listItem",
|
|
5262
5263
|
addOptions() {
|
|
5263
5264
|
return {
|
|
@@ -5285,7 +5286,7 @@ const Xi = N.create({
|
|
|
5285
5286
|
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
5286
5287
|
};
|
|
5287
5288
|
}
|
|
5288
|
-
}),
|
|
5289
|
+
}), aa = P.create({
|
|
5289
5290
|
name: "paragraph",
|
|
5290
5291
|
priority: 1e3,
|
|
5291
5292
|
addOptions() {
|
|
@@ -5313,7 +5314,7 @@ const Xi = N.create({
|
|
|
5313
5314
|
"Mod-Alt-0": () => this.editor.commands.setParagraph()
|
|
5314
5315
|
};
|
|
5315
5316
|
}
|
|
5316
|
-
}),
|
|
5317
|
+
}), la = R.create({
|
|
5317
5318
|
name: "placeholder",
|
|
5318
5319
|
addOptions() {
|
|
5319
5320
|
return {
|
|
@@ -5336,11 +5337,11 @@ const Xi = N.create({
|
|
|
5336
5337
|
return null;
|
|
5337
5338
|
const o = this.editor.isEmpty;
|
|
5338
5339
|
return e.descendants((i, a) => {
|
|
5339
|
-
const c = r >= a && r <= a + i.nodeSize, l = !i.isLeaf &&
|
|
5340
|
+
const c = r >= a && r <= a + i.nodeSize, l = !i.isLeaf && xt(i);
|
|
5340
5341
|
if ((c || !this.options.showOnlyCurrent) && l) {
|
|
5341
5342
|
const u = [this.options.emptyNodeClass];
|
|
5342
5343
|
o && u.push(this.options.emptyEditorClass);
|
|
5343
|
-
const d =
|
|
5344
|
+
const d = Gt.node(a, a + i.nodeSize, {
|
|
5344
5345
|
class: u.join(" "),
|
|
5345
5346
|
"data-placeholder": typeof this.options.placeholder == "function" ? this.options.placeholder({
|
|
5346
5347
|
editor: this.editor,
|
|
@@ -5352,20 +5353,20 @@ const Xi = N.create({
|
|
|
5352
5353
|
s.push(d);
|
|
5353
5354
|
}
|
|
5354
5355
|
return this.options.includeChildren;
|
|
5355
|
-
}),
|
|
5356
|
+
}), gt.create(e, s);
|
|
5356
5357
|
}
|
|
5357
5358
|
}
|
|
5358
5359
|
})
|
|
5359
5360
|
];
|
|
5360
5361
|
}
|
|
5361
|
-
}),
|
|
5362
|
+
}), ca = P.create({
|
|
5362
5363
|
name: "text",
|
|
5363
5364
|
group: "inline"
|
|
5364
|
-
}),
|
|
5365
|
+
}), da = P.create({
|
|
5365
5366
|
name: "doc",
|
|
5366
5367
|
topNode: !0,
|
|
5367
5368
|
content: "block+"
|
|
5368
|
-
}),
|
|
5369
|
+
}), ua = N.create({
|
|
5369
5370
|
name: "subscript",
|
|
5370
5371
|
addOptions() {
|
|
5371
5372
|
return {
|
|
@@ -5400,7 +5401,7 @@ const Xi = N.create({
|
|
|
5400
5401
|
"Mod-,": () => this.editor.commands.toggleSubscript()
|
|
5401
5402
|
};
|
|
5402
5403
|
}
|
|
5403
|
-
}),
|
|
5404
|
+
}), pa = N.create({
|
|
5404
5405
|
name: "superscript",
|
|
5405
5406
|
addOptions() {
|
|
5406
5407
|
return {
|
|
@@ -5436,9 +5437,9 @@ const Xi = N.create({
|
|
|
5436
5437
|
};
|
|
5437
5438
|
}
|
|
5438
5439
|
});
|
|
5439
|
-
function
|
|
5440
|
+
function li(e) {
|
|
5440
5441
|
var t;
|
|
5441
|
-
const { char: n, allowSpaces: r, allowToIncludeChar: s, allowedPrefixes: o, startOfLine: i, $position: a } = e, c = r && !s, l =
|
|
5442
|
+
const { char: n, allowSpaces: r, allowToIncludeChar: s, allowedPrefixes: o, startOfLine: i, $position: a } = e, c = r && !s, l = po(n), u = new RegExp(`\\s${l}$`), d = i ? "^" : "", p = s ? "" : l, h = c ? new RegExp(`${d}${l}.*?(?=\\s${p}|$)`, "gm") : new RegExp(`${d}(?:^)?${l}[^\\s${p}]*`, "gm"), m = ((t = a.nodeBefore) === null || t === void 0 ? void 0 : t.isText) && a.nodeBefore.text;
|
|
5442
5443
|
if (!m)
|
|
5443
5444
|
return null;
|
|
5444
5445
|
const f = a.pos - m.length, g = Array.from(m.matchAll(h)).pop();
|
|
@@ -5458,8 +5459,8 @@ function ai(e) {
|
|
|
5458
5459
|
text: g[0]
|
|
5459
5460
|
} : null;
|
|
5460
5461
|
}
|
|
5461
|
-
const
|
|
5462
|
-
function
|
|
5462
|
+
const ci = new _("suggestion");
|
|
5463
|
+
function di({ pluginKey: e = ci, editor: t, char: n = "@", allowSpaces: r = !1, allowToIncludeChar: s = !1, allowedPrefixes: o = [" "], startOfLine: i = !1, decorationTag: a = "span", decorationClass: c = "suggestion", command: l = () => null, items: u = () => [], render: d = () => ({}), allow: p = () => !0, findSuggestionMatch: h = li }) {
|
|
5463
5464
|
let m;
|
|
5464
5465
|
const f = d == null ? void 0 : d(), g = new $({
|
|
5465
5466
|
key: e,
|
|
@@ -5467,10 +5468,10 @@ function ci({ pluginKey: e = li, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5467
5468
|
return {
|
|
5468
5469
|
update: async (y, M) => {
|
|
5469
5470
|
var b, v, k, S, T, A, O;
|
|
5470
|
-
const C = (b = this.key) === null || b === void 0 ? void 0 : b.getState(M), D = (v = this.key) === null || v === void 0 ? void 0 : v.getState(y.state), B = C.active && D.active && C.range.from !== D.range.from, X = !C.active && D.active, Q = C.active && !D.active, rt = !X && !Q && C.query !== D.query,
|
|
5471
|
-
if (!
|
|
5471
|
+
const C = (b = this.key) === null || b === void 0 ? void 0 : b.getState(M), D = (v = this.key) === null || v === void 0 ? void 0 : v.getState(y.state), B = C.active && D.active && C.range.from !== D.range.from, X = !C.active && D.active, Q = C.active && !D.active, rt = !X && !Q && C.query !== D.query, z = X || B && rt, V = rt || B, Ot = Q || B && rt;
|
|
5472
|
+
if (!z && !V && !Ot)
|
|
5472
5473
|
return;
|
|
5473
|
-
const Z =
|
|
5474
|
+
const Z = Ot && !z ? C : D, ie = y.dom.querySelector(`[data-decoration-id="${Z.decorationId}"]`);
|
|
5474
5475
|
m = {
|
|
5475
5476
|
editor: t,
|
|
5476
5477
|
range: Z.range,
|
|
@@ -5482,18 +5483,18 @@ function ci({ pluginKey: e = li, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5482
5483
|
range: Z.range,
|
|
5483
5484
|
props: st
|
|
5484
5485
|
}),
|
|
5485
|
-
decorationNode:
|
|
5486
|
+
decorationNode: ie,
|
|
5486
5487
|
// virtual node for popper.js or tippy.js
|
|
5487
5488
|
// this can be used for building popups without a DOM node
|
|
5488
|
-
clientRect:
|
|
5489
|
+
clientRect: ie ? () => {
|
|
5489
5490
|
var st;
|
|
5490
|
-
const { decorationId:
|
|
5491
|
-
return (
|
|
5491
|
+
const { decorationId: dn } = (st = this.key) === null || st === void 0 ? void 0 : st.getState(t.state), Lt = y.dom.querySelector(`[data-decoration-id="${dn}"]`);
|
|
5492
|
+
return (Lt == null ? void 0 : Lt.getBoundingClientRect()) || null;
|
|
5492
5493
|
} : null
|
|
5493
|
-
},
|
|
5494
|
+
}, z && ((k = f == null ? void 0 : f.onBeforeStart) === null || k === void 0 || k.call(f, m)), V && ((S = f == null ? void 0 : f.onBeforeUpdate) === null || S === void 0 || S.call(f, m)), (V || z) && (m.items = await u({
|
|
5494
5495
|
editor: t,
|
|
5495
5496
|
query: Z.query
|
|
5496
|
-
})),
|
|
5497
|
+
})), Ot && ((T = f == null ? void 0 : f.onExit) === null || T === void 0 || T.call(f, m)), V && ((A = f == null ? void 0 : f.onUpdate) === null || A === void 0 || A.call(f, m)), z && ((O = f == null ? void 0 : f.onStart) === null || O === void 0 || O.call(f, m));
|
|
5497
5498
|
},
|
|
5498
5499
|
destroy: () => {
|
|
5499
5500
|
var y;
|
|
@@ -5549,8 +5550,8 @@ function ci({ pluginKey: e = li, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5549
5550
|
// Setup decorator on the currently active suggestion.
|
|
5550
5551
|
decorations(y) {
|
|
5551
5552
|
const { active: M, range: b, decorationId: v } = g.getState(y);
|
|
5552
|
-
return M ?
|
|
5553
|
-
|
|
5553
|
+
return M ? gt.create(y.doc, [
|
|
5554
|
+
Gt.inline(b.from, b.to, {
|
|
5554
5555
|
nodeName: a,
|
|
5555
5556
|
class: c,
|
|
5556
5557
|
"data-decoration-id": v
|
|
@@ -5561,7 +5562,7 @@ function ci({ pluginKey: e = li, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5561
5562
|
});
|
|
5562
5563
|
return g;
|
|
5563
5564
|
}
|
|
5564
|
-
const
|
|
5565
|
+
const ui = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, ha = P.create({
|
|
5565
5566
|
name: "image",
|
|
5566
5567
|
addOptions() {
|
|
5567
5568
|
return {
|
|
@@ -5610,8 +5611,8 @@ const di = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, pa = P.cr
|
|
|
5610
5611
|
},
|
|
5611
5612
|
addInputRules() {
|
|
5612
5613
|
return [
|
|
5613
|
-
|
|
5614
|
-
find:
|
|
5614
|
+
rn({
|
|
5615
|
+
find: ui,
|
|
5615
5616
|
type: this.type,
|
|
5616
5617
|
getAttributes: (e) => {
|
|
5617
5618
|
const [, , t, n, r] = e;
|
|
@@ -5620,7 +5621,7 @@ const di = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, pa = P.cr
|
|
|
5620
5621
|
})
|
|
5621
5622
|
];
|
|
5622
5623
|
}
|
|
5623
|
-
}),
|
|
5624
|
+
}), fa = P.create({
|
|
5624
5625
|
name: "tableRow",
|
|
5625
5626
|
addOptions() {
|
|
5626
5627
|
return {
|
|
@@ -5638,10 +5639,10 @@ const di = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, pa = P.cr
|
|
|
5638
5639
|
return ["tr", x(this.options.HTMLAttributes, e), 0];
|
|
5639
5640
|
}
|
|
5640
5641
|
});
|
|
5641
|
-
function
|
|
5642
|
+
function Ut(e, t) {
|
|
5642
5643
|
return t ? ["width", `${Math.max(t, e)}px`] : ["min-width", `${e}px`];
|
|
5643
5644
|
}
|
|
5644
|
-
function
|
|
5645
|
+
function Oe(e, t, n, r, s, o) {
|
|
5645
5646
|
var i;
|
|
5646
5647
|
let a = 0, c = !0, l = t.firstChild;
|
|
5647
5648
|
const u = e.firstChild;
|
|
@@ -5652,12 +5653,12 @@ function Ae(e, t, n, r, s, o) {
|
|
|
5652
5653
|
const g = s === p ? o : m && m[f], y = g ? `${g}px` : "";
|
|
5653
5654
|
if (a += g || r, g || (c = !1), l) {
|
|
5654
5655
|
if (l.style.width !== y) {
|
|
5655
|
-
const [M, b] =
|
|
5656
|
+
const [M, b] = Ut(r, g);
|
|
5656
5657
|
l.style.setProperty(M, b);
|
|
5657
5658
|
}
|
|
5658
5659
|
l = l.nextSibling;
|
|
5659
5660
|
} else {
|
|
5660
|
-
const M = document.createElement("col"), [b, v] =
|
|
5661
|
+
const M = document.createElement("col"), [b, v] = Ut(r, g);
|
|
5661
5662
|
M.style.setProperty(b, v), t.appendChild(M);
|
|
5662
5663
|
}
|
|
5663
5664
|
}
|
|
@@ -5668,18 +5669,18 @@ function Ae(e, t, n, r, s, o) {
|
|
|
5668
5669
|
}
|
|
5669
5670
|
c ? (n.style.width = `${a}px`, n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = `${a}px`);
|
|
5670
5671
|
}
|
|
5671
|
-
class
|
|
5672
|
+
class pi {
|
|
5672
5673
|
constructor(t, n) {
|
|
5673
|
-
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")),
|
|
5674
|
+
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")), Oe(t, this.colgroup, this.table, n), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
5674
5675
|
}
|
|
5675
5676
|
update(t) {
|
|
5676
|
-
return t.type !== this.node.type ? !1 : (this.node = t,
|
|
5677
|
+
return t.type !== this.node.type ? !1 : (this.node = t, Oe(t, this.colgroup, this.table, this.cellMinWidth), !0);
|
|
5677
5678
|
}
|
|
5678
5679
|
ignoreMutation(t) {
|
|
5679
5680
|
return t.type === "attributes" && (t.target === this.table || this.colgroup.contains(t.target));
|
|
5680
5681
|
}
|
|
5681
5682
|
}
|
|
5682
|
-
function
|
|
5683
|
+
function hi(e, t, n, r) {
|
|
5683
5684
|
let s = 0, o = !0;
|
|
5684
5685
|
const i = [], a = e.firstChild;
|
|
5685
5686
|
if (!a)
|
|
@@ -5689,7 +5690,7 @@ function pi(e, t, n, r) {
|
|
|
5689
5690
|
for (let f = 0; f < h; f += 1, p += 1) {
|
|
5690
5691
|
const g = n === p ? r : m && m[f];
|
|
5691
5692
|
s += g || t, g || (o = !1);
|
|
5692
|
-
const [y, M] =
|
|
5693
|
+
const [y, M] = Ut(t, g);
|
|
5693
5694
|
i.push([
|
|
5694
5695
|
"col",
|
|
5695
5696
|
{ style: `${y}: ${M}` }
|
|
@@ -5699,10 +5700,10 @@ function pi(e, t, n, r) {
|
|
|
5699
5700
|
const c = o ? `${s}px` : "", l = o ? "" : `${s}px`;
|
|
5700
5701
|
return { colgroup: ["colgroup", {}, ...i], tableWidth: c, tableMinWidth: l };
|
|
5701
5702
|
}
|
|
5702
|
-
function
|
|
5703
|
+
function Le(e, t) {
|
|
5703
5704
|
return e.createAndFill();
|
|
5704
5705
|
}
|
|
5705
|
-
function
|
|
5706
|
+
function fi(e) {
|
|
5706
5707
|
if (e.cached.tableNodeTypes)
|
|
5707
5708
|
return e.cached.tableNodeTypes;
|
|
5708
5709
|
const t = {};
|
|
@@ -5711,12 +5712,12 @@ function hi(e) {
|
|
|
5711
5712
|
r.spec.tableRole && (t[r.spec.tableRole] = r);
|
|
5712
5713
|
}), e.cached.tableNodeTypes = t, t;
|
|
5713
5714
|
}
|
|
5714
|
-
function
|
|
5715
|
-
const o =
|
|
5715
|
+
function mi(e, t, n, r, s) {
|
|
5716
|
+
const o = fi(e), i = [], a = [];
|
|
5716
5717
|
for (let l = 0; l < n; l += 1) {
|
|
5717
|
-
const u =
|
|
5718
|
+
const u = Le(o.cell);
|
|
5718
5719
|
if (u && a.push(u), r) {
|
|
5719
|
-
const d =
|
|
5720
|
+
const d = Le(o.header_cell);
|
|
5720
5721
|
d && i.push(d);
|
|
5721
5722
|
}
|
|
5722
5723
|
}
|
|
@@ -5725,21 +5726,21 @@ function fi(e, t, n, r, s) {
|
|
|
5725
5726
|
c.push(o.row.createChecked(null, r && l === 0 ? i : a));
|
|
5726
5727
|
return o.table.createChecked(null, c);
|
|
5727
5728
|
}
|
|
5728
|
-
function
|
|
5729
|
-
return e instanceof
|
|
5729
|
+
function gi(e) {
|
|
5730
|
+
return e instanceof Be;
|
|
5730
5731
|
}
|
|
5731
|
-
const
|
|
5732
|
+
const pt = ({ editor: e }) => {
|
|
5732
5733
|
const { selection: t } = e.state;
|
|
5733
|
-
if (!
|
|
5734
|
+
if (!gi(t))
|
|
5734
5735
|
return !1;
|
|
5735
5736
|
let n = 0;
|
|
5736
|
-
const r =
|
|
5737
|
+
const r = tn(t.ranges[0].$from, (o) => o.type.name === "table");
|
|
5737
5738
|
return r == null || r.node.descendants((o) => {
|
|
5738
5739
|
if (o.type.name === "table")
|
|
5739
5740
|
return !1;
|
|
5740
5741
|
["tableCell", "tableHeader"].includes(o.type.name) && (n += 1);
|
|
5741
5742
|
}), n === t.ranges.length ? (e.commands.deleteTable(), !0) : !1;
|
|
5742
|
-
},
|
|
5743
|
+
}, ma = P.create({
|
|
5743
5744
|
name: "table",
|
|
5744
5745
|
// @ts-ignore
|
|
5745
5746
|
addOptions() {
|
|
@@ -5749,7 +5750,7 @@ const ut = ({ editor: e }) => {
|
|
|
5749
5750
|
handleWidth: 5,
|
|
5750
5751
|
cellMinWidth: 25,
|
|
5751
5752
|
// TODO: fix
|
|
5752
|
-
View:
|
|
5753
|
+
View: pi,
|
|
5753
5754
|
lastColumnResizable: !0,
|
|
5754
5755
|
allowTableNodeSelection: !1
|
|
5755
5756
|
};
|
|
@@ -5762,7 +5763,7 @@ const ut = ({ editor: e }) => {
|
|
|
5762
5763
|
return [{ tag: "table" }];
|
|
5763
5764
|
},
|
|
5764
5765
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
5765
|
-
const { colgroup: n, tableWidth: r, tableMinWidth: s } =
|
|
5766
|
+
const { colgroup: n, tableWidth: r, tableMinWidth: s } = hi(e, this.options.cellMinWidth);
|
|
5766
5767
|
return [
|
|
5767
5768
|
"table",
|
|
5768
5769
|
x(this.options.HTMLAttributes, t, {
|
|
@@ -5775,33 +5776,33 @@ const ut = ({ editor: e }) => {
|
|
|
5775
5776
|
addCommands() {
|
|
5776
5777
|
return {
|
|
5777
5778
|
insertTable: ({ rows: e = 3, cols: t = 3, withHeaderRow: n = !0 } = {}) => ({ tr: r, dispatch: s, editor: o }) => {
|
|
5778
|
-
const i =
|
|
5779
|
+
const i = mi(o.schema, e, t, n);
|
|
5779
5780
|
if (s) {
|
|
5780
5781
|
const a = r.selection.from + 1;
|
|
5781
5782
|
r.replaceSelectionWith(i).scrollIntoView().setSelection(I.near(r.doc.resolve(a)));
|
|
5782
5783
|
}
|
|
5783
5784
|
return !0;
|
|
5784
5785
|
},
|
|
5785
|
-
addColumnBefore: () => ({ state: e, dispatch: t }) =>
|
|
5786
|
-
addColumnAfter: () => ({ state: e, dispatch: t }) =>
|
|
5787
|
-
deleteColumn: () => ({ state: e, dispatch: t }) =>
|
|
5788
|
-
addRowBefore: () => ({ state: e, dispatch: t }) =>
|
|
5789
|
-
addRowAfter: () => ({ state: e, dispatch: t }) =>
|
|
5790
|
-
deleteRow: () => ({ state: e, dispatch: t }) =>
|
|
5791
|
-
deleteTable: () => ({ state: e, dispatch: t }) =>
|
|
5792
|
-
mergeCells: () => ({ state: e, dispatch: t }) =>
|
|
5793
|
-
splitCell: () => ({ state: e, dispatch: t }) =>
|
|
5794
|
-
toggleHeaderColumn: () => ({ state: e, dispatch: t }) =>
|
|
5795
|
-
toggleHeaderRow: () => ({ state: e, dispatch: t }) =>
|
|
5796
|
-
toggleHeaderCell: () => ({ state: e, dispatch: t }) =>
|
|
5797
|
-
mergeOrSplit: () => ({ state: e, dispatch: t }) =>
|
|
5798
|
-
setCellAttribute: (e, t) => ({ state: n, dispatch: r }) =>
|
|
5799
|
-
goToNextCell: () => ({ state: e, dispatch: t }) =>
|
|
5800
|
-
goToPreviousCell: () => ({ state: e, dispatch: t }) =>
|
|
5801
|
-
fixTables: () => ({ state: e, dispatch: t }) => (t &&
|
|
5786
|
+
addColumnBefore: () => ({ state: e, dispatch: t }) => dr(e, t),
|
|
5787
|
+
addColumnAfter: () => ({ state: e, dispatch: t }) => cr(e, t),
|
|
5788
|
+
deleteColumn: () => ({ state: e, dispatch: t }) => lr(e, t),
|
|
5789
|
+
addRowBefore: () => ({ state: e, dispatch: t }) => ar(e, t),
|
|
5790
|
+
addRowAfter: () => ({ state: e, dispatch: t }) => ir(e, t),
|
|
5791
|
+
deleteRow: () => ({ state: e, dispatch: t }) => or(e, t),
|
|
5792
|
+
deleteTable: () => ({ state: e, dispatch: t }) => sr(e, t),
|
|
5793
|
+
mergeCells: () => ({ state: e, dispatch: t }) => de(e, t),
|
|
5794
|
+
splitCell: () => ({ state: e, dispatch: t }) => ue(e, t),
|
|
5795
|
+
toggleHeaderColumn: () => ({ state: e, dispatch: t }) => pe("column")(e, t),
|
|
5796
|
+
toggleHeaderRow: () => ({ state: e, dispatch: t }) => pe("row")(e, t),
|
|
5797
|
+
toggleHeaderCell: () => ({ state: e, dispatch: t }) => rr(e, t),
|
|
5798
|
+
mergeOrSplit: () => ({ state: e, dispatch: t }) => de(e, t) ? !0 : ue(e, t),
|
|
5799
|
+
setCellAttribute: (e, t) => ({ state: n, dispatch: r }) => nr(e, t)(n, r),
|
|
5800
|
+
goToNextCell: () => ({ state: e, dispatch: t }) => ce(1)(e, t),
|
|
5801
|
+
goToPreviousCell: () => ({ state: e, dispatch: t }) => ce(-1)(e, t),
|
|
5802
|
+
fixTables: () => ({ state: e, dispatch: t }) => (t && er(e), !0),
|
|
5802
5803
|
setCellSelection: (e) => ({ tr: t, dispatch: n }) => {
|
|
5803
5804
|
if (n) {
|
|
5804
|
-
const r =
|
|
5805
|
+
const r = Be.create(t.doc, e.anchorCell, e.headCell);
|
|
5805
5806
|
t.setSelection(r);
|
|
5806
5807
|
}
|
|
5807
5808
|
return !0;
|
|
@@ -5812,16 +5813,16 @@ const ut = ({ editor: e }) => {
|
|
|
5812
5813
|
return {
|
|
5813
5814
|
Tab: () => this.editor.commands.goToNextCell() ? !0 : this.editor.can().addRowAfter() ? this.editor.chain().addRowAfter().goToNextCell().run() : !1,
|
|
5814
5815
|
"Shift-Tab": () => this.editor.commands.goToPreviousCell(),
|
|
5815
|
-
Backspace:
|
|
5816
|
-
"Mod-Backspace":
|
|
5817
|
-
Delete:
|
|
5818
|
-
"Mod-Delete":
|
|
5816
|
+
Backspace: pt,
|
|
5817
|
+
"Mod-Backspace": pt,
|
|
5818
|
+
Delete: pt,
|
|
5819
|
+
"Mod-Delete": pt
|
|
5819
5820
|
};
|
|
5820
5821
|
},
|
|
5821
5822
|
addProseMirrorPlugins() {
|
|
5822
5823
|
return [
|
|
5823
5824
|
...this.options.resizable && this.editor.isEditable ? [
|
|
5824
|
-
|
|
5825
|
+
Zn({
|
|
5825
5826
|
handleWidth: this.options.handleWidth,
|
|
5826
5827
|
cellMinWidth: this.options.cellMinWidth,
|
|
5827
5828
|
defaultCellMinWidth: this.options.cellMinWidth,
|
|
@@ -5829,7 +5830,7 @@ const ut = ({ editor: e }) => {
|
|
|
5829
5830
|
lastColumnResizable: this.options.lastColumnResizable
|
|
5830
5831
|
})
|
|
5831
5832
|
] : [],
|
|
5832
|
-
|
|
5833
|
+
tr({
|
|
5833
5834
|
allowTableNodeSelection: this.options.allowTableNodeSelection
|
|
5834
5835
|
})
|
|
5835
5836
|
];
|
|
@@ -5844,7 +5845,7 @@ const ut = ({ editor: e }) => {
|
|
|
5844
5845
|
tableRole: E(w(e, "tableRole", t))
|
|
5845
5846
|
};
|
|
5846
5847
|
}
|
|
5847
|
-
}),
|
|
5848
|
+
}), ga = P.create({
|
|
5848
5849
|
name: "tableCell",
|
|
5849
5850
|
addOptions() {
|
|
5850
5851
|
return {
|
|
@@ -5879,7 +5880,7 @@ const ut = ({ editor: e }) => {
|
|
|
5879
5880
|
renderHTML({ HTMLAttributes: e }) {
|
|
5880
5881
|
return ["td", x(this.options.HTMLAttributes, e), 0];
|
|
5881
5882
|
}
|
|
5882
|
-
}),
|
|
5883
|
+
}), ya = P.create({
|
|
5883
5884
|
name: "tableHeader",
|
|
5884
5885
|
addOptions() {
|
|
5885
5886
|
return {
|
|
@@ -5914,7 +5915,7 @@ const ut = ({ editor: e }) => {
|
|
|
5914
5915
|
renderHTML({ HTMLAttributes: e }) {
|
|
5915
5916
|
return ["th", x(this.options.HTMLAttributes, e), 0];
|
|
5916
5917
|
}
|
|
5917
|
-
}),
|
|
5918
|
+
}), yi = new _("mention"), va = P.create({
|
|
5918
5919
|
name: "mention",
|
|
5919
5920
|
priority: 101,
|
|
5920
5921
|
addOptions() {
|
|
@@ -5935,7 +5936,7 @@ const ut = ({ editor: e }) => {
|
|
|
5935
5936
|
},
|
|
5936
5937
|
suggestion: {
|
|
5937
5938
|
char: "@",
|
|
5938
|
-
pluginKey:
|
|
5939
|
+
pluginKey: yi,
|
|
5939
5940
|
command: ({ editor: e, range: t, props: n }) => {
|
|
5940
5941
|
var r, s, o;
|
|
5941
5942
|
const i = e.view.state.selection.$to.nodeAfter;
|
|
@@ -6031,33 +6032,33 @@ const ut = ({ editor: e }) => {
|
|
|
6031
6032
|
},
|
|
6032
6033
|
addProseMirrorPlugins() {
|
|
6033
6034
|
return [
|
|
6034
|
-
|
|
6035
|
+
di({
|
|
6035
6036
|
editor: this.editor,
|
|
6036
6037
|
...this.options.suggestion
|
|
6037
6038
|
})
|
|
6038
6039
|
];
|
|
6039
6040
|
}
|
|
6040
6041
|
});
|
|
6041
|
-
function
|
|
6042
|
+
function se(e, t, n) {
|
|
6042
6043
|
const r = [], s = e.node(0);
|
|
6043
6044
|
n = typeof n == "number" && n >= 0 ? n : e.sameParent(t) ? Math.max(0, e.sharedDepth(t.pos) - 1) : e.sharedDepth(t.pos);
|
|
6044
|
-
const o = new
|
|
6045
|
+
const o = new ur(e, t, n), i = o.depth === 0 ? 0 : s.resolve(o.start).posAtIndex(0);
|
|
6045
6046
|
return o.parent.forEach((a, c) => {
|
|
6046
6047
|
const l = i + c, u = l + a.nodeSize;
|
|
6047
6048
|
if (l < o.start || l >= o.end)
|
|
6048
6049
|
return;
|
|
6049
|
-
const d = new
|
|
6050
|
+
const d = new pr(s.resolve(l), s.resolve(u));
|
|
6050
6051
|
r.push(d);
|
|
6051
6052
|
}), r;
|
|
6052
6053
|
}
|
|
6053
|
-
class
|
|
6054
|
+
class oe {
|
|
6054
6055
|
constructor(t, n) {
|
|
6055
|
-
|
|
6056
|
-
|
|
6056
|
+
at(this, "anchor");
|
|
6057
|
+
at(this, "head");
|
|
6057
6058
|
this.anchor = t, this.head = n;
|
|
6058
6059
|
}
|
|
6059
6060
|
map(t) {
|
|
6060
|
-
return new
|
|
6061
|
+
return new oe(t.map(this.anchor), t.map(this.head));
|
|
6061
6062
|
}
|
|
6062
6063
|
resolve(t) {
|
|
6063
6064
|
const n = t.resolve(this.anchor), r = t.resolve(this.head);
|
|
@@ -6066,9 +6067,9 @@ class se {
|
|
|
6066
6067
|
}
|
|
6067
6068
|
class j extends W {
|
|
6068
6069
|
constructor(n, r, s, o = 1) {
|
|
6069
|
-
const { doc: i } = n, a = n === r, c = n.pos === i.content.size && r.pos === i.content.size, l = a && !c ? i.resolve(r.pos + (o > 0 ? 1 : -1)) : r, u = a && c ? i.resolve(n.pos - (o > 0 ? 1 : -1)) : n, d =
|
|
6070
|
+
const { doc: i } = n, a = n === r, c = n.pos === i.content.size && r.pos === i.content.size, l = a && !c ? i.resolve(r.pos + (o > 0 ? 1 : -1)) : r, u = a && c ? i.resolve(n.pos - (o > 0 ? 1 : -1)) : n, d = se(u.min(l), u.max(l), s);
|
|
6070
6071
|
super(l.pos >= n.pos ? d[0].$from : d[d.length - 1].$to, l.pos >= n.pos ? d[d.length - 1].$to : d[0].$from, d);
|
|
6071
|
-
|
|
6072
|
+
at(this, "depth");
|
|
6072
6073
|
this.depth = s;
|
|
6073
6074
|
}
|
|
6074
6075
|
get $to() {
|
|
@@ -6115,10 +6116,10 @@ class j extends W {
|
|
|
6115
6116
|
return new this(n.resolve(r), n.resolve(s), o, i);
|
|
6116
6117
|
}
|
|
6117
6118
|
getBookmark() {
|
|
6118
|
-
return new
|
|
6119
|
+
return new oe(this.anchor, this.head);
|
|
6119
6120
|
}
|
|
6120
6121
|
}
|
|
6121
|
-
function
|
|
6122
|
+
function vi(e) {
|
|
6122
6123
|
const t = e.cloneNode(!0), n = [e, ...Array.from(e.getElementsByTagName("*"))], r = [t, ...Array.from(t.getElementsByTagName("*"))];
|
|
6123
6124
|
return n.forEach((s, o) => {
|
|
6124
6125
|
r[o].style.cssText = function(i) {
|
|
@@ -6130,16 +6131,16 @@ function yi(e) {
|
|
|
6130
6131
|
}(s);
|
|
6131
6132
|
}), t;
|
|
6132
6133
|
}
|
|
6133
|
-
function
|
|
6134
|
+
function ht(e, t) {
|
|
6134
6135
|
return window.getComputedStyle(e)[t];
|
|
6135
6136
|
}
|
|
6136
|
-
function
|
|
6137
|
+
function bi(e = 0, t = 0, n = 0) {
|
|
6137
6138
|
return Math.min(Math.max(e, t), n);
|
|
6138
6139
|
}
|
|
6139
|
-
function
|
|
6140
|
+
function Pe(e) {
|
|
6140
6141
|
e.parentNode !== null && e.parentNode !== void 0 && e.parentNode.removeChild(e);
|
|
6141
6142
|
}
|
|
6142
|
-
const
|
|
6143
|
+
const cn = (e) => {
|
|
6143
6144
|
const { x: t, y: n, direction: r, editor: s } = e;
|
|
6144
6145
|
let o = null, i = null, a = null, c = t;
|
|
6145
6146
|
for (; i === null && c < window.innerWidth && c > 0; ) {
|
|
@@ -6155,13 +6156,13 @@ const ln = (e) => {
|
|
|
6155
6156
|
}
|
|
6156
6157
|
return { resultElement: o, resultNode: i, pos: a !== null ? a : null };
|
|
6157
6158
|
};
|
|
6158
|
-
function
|
|
6159
|
-
const { doc: n } = t.view.state, r =
|
|
6159
|
+
function Mi(e, t) {
|
|
6160
|
+
const { doc: n } = t.view.state, r = cn({ editor: t, x: e.clientX, y: e.clientY, direction: "right" });
|
|
6160
6161
|
if (!r.resultNode || r.pos === null)
|
|
6161
6162
|
return [];
|
|
6162
6163
|
const s = e.clientX, o = function(u, d, p) {
|
|
6163
|
-
const h = parseInt(
|
|
6164
|
-
return { left:
|
|
6164
|
+
const h = parseInt(ht(u.dom, "paddingLeft"), 10), m = parseInt(ht(u.dom, "paddingRight"), 10), f = parseInt(ht(u.dom, "borderLeftWidth"), 10), g = parseInt(ht(u.dom, "borderLeftWidth"), 10), y = u.dom.getBoundingClientRect();
|
|
6165
|
+
return { left: bi(d, y.left + h + f, y.right - m - g), top: p };
|
|
6165
6166
|
}(t.view, s, e.clientY), i = t.view.posAtCoords(o);
|
|
6166
6167
|
if (!i)
|
|
6167
6168
|
return [];
|
|
@@ -6169,12 +6170,12 @@ function bi(e, t) {
|
|
|
6169
6170
|
if (!n.resolve(a).parent)
|
|
6170
6171
|
return [];
|
|
6171
6172
|
const c = n.resolve(r.pos), l = n.resolve(r.pos + 1);
|
|
6172
|
-
return
|
|
6173
|
+
return se(c, l, 0);
|
|
6173
6174
|
}
|
|
6174
|
-
const
|
|
6175
|
+
const Re = (e, t) => {
|
|
6175
6176
|
const n = e.resolve(t), { depth: r } = n;
|
|
6176
6177
|
return r === 0 ? t : n.pos - n.parentOffset - 1;
|
|
6177
|
-
},
|
|
6178
|
+
}, $e = (e, t) => {
|
|
6178
6179
|
const n = e.nodeAt(t), r = e.resolve(t);
|
|
6179
6180
|
let { depth: s } = r, o = n;
|
|
6180
6181
|
for (; s > 0; ) {
|
|
@@ -6182,29 +6183,29 @@ const Pe = (e, t) => {
|
|
|
6182
6183
|
s -= 1, s === 0 && (o = i);
|
|
6183
6184
|
}
|
|
6184
6185
|
return o;
|
|
6185
|
-
},
|
|
6186
|
-
const n =
|
|
6187
|
-
return n ?
|
|
6188
|
-
},
|
|
6186
|
+
}, Bt = (e, t) => {
|
|
6187
|
+
const n = hr.getState(e);
|
|
6188
|
+
return n ? fr(t, n.type, n.binding.mapping) : null;
|
|
6189
|
+
}, _e = (e, t) => {
|
|
6189
6190
|
let n = t;
|
|
6190
6191
|
for (; n && n.parentNode && n.parentNode !== e.dom; )
|
|
6191
6192
|
n = n.parentNode;
|
|
6192
6193
|
return n;
|
|
6193
|
-
},
|
|
6194
|
+
}, Si = new _("dragHandle"), ba = ({ pluginKey: e = Si, element: t, editor: n, tippyOptions: r, onNodeChange: s }) => {
|
|
6194
6195
|
const o = document.createElement("div");
|
|
6195
6196
|
let i = null, a = !1, c = null, l = -1;
|
|
6196
6197
|
return t.addEventListener("dragstart", (u) => {
|
|
6197
6198
|
const { view: d } = n;
|
|
6198
6199
|
if (!u.dataTransfer)
|
|
6199
6200
|
return;
|
|
6200
|
-
const { empty: p, $from: h, $to: m } = d.state.selection, f =
|
|
6201
|
+
const { empty: p, $from: h, $to: m } = d.state.selection, f = Mi(u, n), g = se(h, m, 0), y = g.some((O) => f.find((C) => C.$from === O.$from && C.$to === O.$to)), M = p || !y ? f : g;
|
|
6201
6202
|
if (!M.length)
|
|
6202
6203
|
return;
|
|
6203
6204
|
const { tr: b } = d.state, v = document.createElement("div"), k = M[0].$from.pos, S = M[M.length - 1].$to.pos, T = j.create(d.state.doc, k, S), A = T.content();
|
|
6204
6205
|
M.forEach((O) => {
|
|
6205
|
-
const C =
|
|
6206
|
+
const C = vi(d.nodeDOM(O.$from.pos));
|
|
6206
6207
|
v.append(C);
|
|
6207
|
-
}), v.style.position = "absolute", v.style.top = "-10000px", document.body.append(v), u.dataTransfer.clearData(), u.dataTransfer.setDragImage(v, 0, 0), d.dragging = { slice: A, move: !0 }, b.setSelection(T), d.dispatch(b), document.addEventListener("drop", () =>
|
|
6208
|
+
}), v.style.position = "absolute", v.style.top = "-10000px", document.body.append(v), u.dataTransfer.clearData(), u.dataTransfer.setDragImage(v, 0, 0), d.dragging = { slice: A, move: !0 }, b.setSelection(T), d.dispatch(b), document.addEventListener("drop", () => Pe(v), { once: !0 }), setTimeout(() => {
|
|
6208
6209
|
t && (t.style.pointerEvents = "none");
|
|
6209
6210
|
}, 0);
|
|
6210
6211
|
}), t.addEventListener("dragend", () => {
|
|
@@ -6219,14 +6220,14 @@ const Pe = (e, t) => {
|
|
|
6219
6220
|
return i.hide(), a = !1, c = null, l = -1, s == null || s({ editor: n, node: null, pos: -1 }), d;
|
|
6220
6221
|
if (u.docChanged && l !== -1 && t && i) {
|
|
6221
6222
|
const g = u.mapping.map(l);
|
|
6222
|
-
g !== l && (l = g,
|
|
6223
|
+
g !== l && (l = g, Bt(h, l));
|
|
6223
6224
|
}
|
|
6224
6225
|
return d;
|
|
6225
6226
|
}
|
|
6226
6227
|
},
|
|
6227
6228
|
view: (u) => {
|
|
6228
6229
|
var d;
|
|
6229
|
-
return t.draggable = !0, t.style.pointerEvents = "auto", (d = n.view.dom.parentElement) === null || d === void 0 || d.appendChild(o), o.appendChild(t), o.style.pointerEvents = "none", o.style.position = "absolute", o.style.top = "0", o.style.left = "0", i =
|
|
6230
|
+
return t.draggable = !0, t.style.pointerEvents = "auto", (d = n.view.dom.parentElement) === null || d === void 0 || d.appendChild(o), o.appendChild(t), o.style.pointerEvents = "none", o.style.position = "absolute", o.style.top = "0", o.style.left = "0", i = He(u.dom, {
|
|
6230
6231
|
getReferenceClientRect: null,
|
|
6231
6232
|
interactive: !0,
|
|
6232
6233
|
trigger: "manual",
|
|
@@ -6248,16 +6249,16 @@ const Pe = (e, t) => {
|
|
|
6248
6249
|
if (!t || !i || (t.draggable = !a, u.state.doc.eq(h.doc) || l === -1))
|
|
6249
6250
|
return;
|
|
6250
6251
|
let m = u.nodeDOM(l);
|
|
6251
|
-
if (m =
|
|
6252
|
+
if (m = _e(u, m), m === u.dom || (m == null ? void 0 : m.nodeType) !== 1)
|
|
6252
6253
|
return;
|
|
6253
|
-
const f = u.posAtDOM(m, 0), g =
|
|
6254
|
+
const f = u.posAtDOM(m, 0), g = $e(n.state.doc, f);
|
|
6254
6255
|
if (g !== c) {
|
|
6255
|
-
const y =
|
|
6256
|
-
c = g, l = y,
|
|
6256
|
+
const y = Re(n.state.doc, f);
|
|
6257
|
+
c = g, l = y, Bt(u.state, l), s == null || s({ editor: n, node: c, pos: l }), i.setProps({ getReferenceClientRect: () => m.getBoundingClientRect() }), i.show();
|
|
6257
6258
|
}
|
|
6258
6259
|
},
|
|
6259
6260
|
destroy() {
|
|
6260
|
-
i == null || i.destroy(), t &&
|
|
6261
|
+
i == null || i.destroy(), t && Pe(o);
|
|
6261
6262
|
}
|
|
6262
6263
|
};
|
|
6263
6264
|
},
|
|
@@ -6267,16 +6268,16 @@ const Pe = (e, t) => {
|
|
|
6267
6268
|
mousemove(u, d) {
|
|
6268
6269
|
if (!t || !i || a)
|
|
6269
6270
|
return !1;
|
|
6270
|
-
const p =
|
|
6271
|
+
const p = cn({ x: d.clientX, y: d.clientY, direction: "right", editor: n });
|
|
6271
6272
|
if (!p.resultElement)
|
|
6272
6273
|
return !1;
|
|
6273
6274
|
let h = p.resultElement;
|
|
6274
|
-
if (h =
|
|
6275
|
+
if (h = _e(u, h), h === u.dom || (h == null ? void 0 : h.nodeType) !== 1)
|
|
6275
6276
|
return !1;
|
|
6276
|
-
const m = u.posAtDOM(h, 0), f =
|
|
6277
|
+
const m = u.posAtDOM(h, 0), f = $e(n.state.doc, m);
|
|
6277
6278
|
if (f !== c) {
|
|
6278
|
-
const g =
|
|
6279
|
-
c = f, l = g,
|
|
6279
|
+
const g = Re(n.state.doc, m);
|
|
6280
|
+
c = f, l = g, Bt(u.state, l), s == null || s({ editor: n, node: c, pos: l }), i.setProps({ getReferenceClientRect: () => h.getBoundingClientRect() }), i.show();
|
|
6280
6281
|
}
|
|
6281
6282
|
return !1;
|
|
6282
6283
|
}
|
|
@@ -6285,63 +6286,63 @@ const Pe = (e, t) => {
|
|
|
6285
6286
|
});
|
|
6286
6287
|
};
|
|
6287
6288
|
export {
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6289
|
+
_o as $,
|
|
6290
|
+
ra as A,
|
|
6291
|
+
Pi as B,
|
|
6292
|
+
Bi as C,
|
|
6293
|
+
ba as D,
|
|
6294
|
+
Oi as E,
|
|
6294
6295
|
Fi as F,
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6296
|
+
ca as G,
|
|
6297
|
+
Vi as H,
|
|
6298
|
+
ha as I,
|
|
6299
|
+
sa as J,
|
|
6300
|
+
na as K,
|
|
6301
|
+
Qi as L,
|
|
6302
|
+
ea as M,
|
|
6302
6303
|
P as N,
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6304
|
+
Gi as O,
|
|
6305
|
+
la as P,
|
|
6306
|
+
aa as Q,
|
|
6307
|
+
_i as R,
|
|
6308
|
+
Ni as S,
|
|
6309
|
+
Wi as T,
|
|
6310
|
+
Ii as U,
|
|
6311
|
+
oa as V,
|
|
6312
|
+
ia as W,
|
|
6313
|
+
zi as X,
|
|
6314
|
+
ua as Y,
|
|
6315
|
+
pa as Z,
|
|
6316
|
+
di as _,
|
|
6317
|
+
$i as a,
|
|
6318
|
+
ma as a0,
|
|
6319
|
+
fa as a1,
|
|
6320
|
+
ya as a2,
|
|
6321
|
+
ga as a3,
|
|
6322
|
+
va as a4,
|
|
6323
|
+
Ar as b,
|
|
6324
|
+
Ai as c,
|
|
6325
|
+
Si as d,
|
|
6326
|
+
Rs as e,
|
|
6327
|
+
ee as f,
|
|
6328
|
+
Hi as g,
|
|
6329
|
+
Di as h,
|
|
6330
|
+
ve as i,
|
|
6331
|
+
xi as j,
|
|
6332
|
+
Ri as k,
|
|
6333
|
+
ji as l,
|
|
6333
6334
|
x as m,
|
|
6334
|
-
|
|
6335
|
+
rn as n,
|
|
6335
6336
|
R as o,
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6337
|
+
Ki as p,
|
|
6338
|
+
Ui as q,
|
|
6339
|
+
qi as r,
|
|
6340
|
+
Yi as s,
|
|
6341
|
+
Ji as t,
|
|
6342
|
+
Li as u,
|
|
6343
|
+
Xi as v,
|
|
6344
|
+
Zt as w,
|
|
6345
|
+
Zi as x,
|
|
6346
|
+
ta as y,
|
|
6347
|
+
da as z
|
|
6347
6348
|
};
|