reactjs-tiptap-editor 0.0.45 → 0.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.cts +41 -41
- package/lib/index.d.ts +41 -41
- package/lib/{locales-QV4-bvb6.cjs → locales-BtK2MfTC.cjs} +1 -1
- package/lib/{locales-BWnJn4at.js → locales-ehmIsx4D.js} +1 -1
- package/lib/reactjs-tiptap-editor.cjs +1 -1
- package/lib/reactjs-tiptap-editor.js +2 -2
- package/lib/tiptap-D3x-5t_9.cjs +116 -0
- package/lib/{tiptap-DR0UF0u4.js → tiptap-ocrlqn2l.js} +586 -661
- package/lib/{utils-CI1TaU6F.cjs → utils-C27Z4RJp.cjs} +2 -2
- package/lib/{utils-BGidOjdA.js → utils-W3zcD8lD.js} +573 -563
- package/lib/{vendor-BHlXBvPI.cjs → vendor-BO9DCkYQ.cjs} +13 -13
- package/lib/{vendor-BU8RNhp0.js → vendor-DqXtrdHd.js} +1351 -1343
- package/package.json +64 -66
- package/lib/tiptap-C6GJy6Jo.cjs +0 -116
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Ve from "tippy.js";
|
|
2
|
-
import { P, a as I, N as Z, S as G, f as We, c as jt, T as Ke, l as Ue, b as qe, d as
|
|
3
|
-
import O, { forwardRef as Fn, useRef as zn, useState as zt, useDebugValue as
|
|
2
|
+
import { P, a as I, N as Z, S as G, f as We, c as jt, T as Ke, l as Ue, b as qe, d as $, e as Ge, g as Je, j as Ye, h as Xe, i as Qe, k as Ze, m as ve, n as tn, o as en, p as nn, q as rn, r as sn, s as on, t as an, u as ln, v as cn, w as dn, x as un, y as Xt, z as pn, A as at, F as lt, B as hn, C as fn, D as mn, E as gn, G as yn, H as bn, I as Me, J as Tt, R as vn, K as Mn, L as Sn, M as Qt, O as Se, Q as kn, U as wn, V as En, W as Tn, X as Cn, Y as xn, Z as dt, _ as Ft, $ as An, a0 as On, a1 as Ln, a2 as _n, a3 as Hn, a4 as Rn, a5 as Pn, a6 as In, a7 as Zt, a8 as te, a9 as ee, aa as $n, ab as Dn, ac as ne, ad as Nn, ae as ke, af as Bn, ag as jn } from "./vendor-DqXtrdHd.js";
|
|
3
|
+
import O, { forwardRef as Fn, useRef as zn, useState as zt, useDebugValue as we, useEffect as Vt, createContext as Ee, useContext as Te } from "react";
|
|
4
4
|
import Vn, { flushSync as Wn } from "react-dom";
|
|
5
5
|
function mt(e) {
|
|
6
6
|
const { state: t, transaction: n } = e;
|
|
@@ -120,7 +120,7 @@ function yt(e) {
|
|
|
120
120
|
markExtensions: r
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function Ce(e) {
|
|
124
124
|
const t = [], { nodeExtensions: n, markExtensions: r } = yt(e), s = [...n, ...r], o = {
|
|
125
125
|
default: null,
|
|
126
126
|
rendered: !0,
|
|
@@ -182,7 +182,7 @@ function R(e, t) {
|
|
|
182
182
|
}
|
|
183
183
|
return e;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function x(...e) {
|
|
186
186
|
return e.filter((t) => !!t).reduce((t, n) => {
|
|
187
187
|
const r = { ...t };
|
|
188
188
|
return Object.entries(n).forEach(([s, o]) => {
|
|
@@ -207,15 +207,15 @@ function A(...e) {
|
|
|
207
207
|
}), r;
|
|
208
208
|
}, {});
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
return t.filter((n) => n.attribute.rendered).map((n) => n.attribute.renderHTML ? n.attribute.renderHTML(e.attrs) || {} : {
|
|
210
|
+
function ut(e, t) {
|
|
211
|
+
return t.filter((n) => n.type === e.type.name).filter((n) => n.attribute.rendered).map((n) => n.attribute.renderHTML ? n.attribute.renderHTML(e.attrs) || {} : {
|
|
212
212
|
[n.name]: e.attrs[n.name]
|
|
213
|
-
}).reduce((n, r) =>
|
|
213
|
+
}).reduce((n, r) => x(n, r), {});
|
|
214
214
|
}
|
|
215
215
|
function xe(e) {
|
|
216
216
|
return typeof e == "function";
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function E(e, t = void 0, ...n) {
|
|
219
219
|
return xe(e) ? t ? e.bind(t)(...n) : e(...n) : e;
|
|
220
220
|
}
|
|
221
221
|
function Un(e = {}) {
|
|
@@ -224,7 +224,7 @@ function Un(e = {}) {
|
|
|
224
224
|
function qn(e) {
|
|
225
225
|
return typeof e != "string" ? e : e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" ? !0 : e === "false" ? !1 : e;
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function re(e, t) {
|
|
228
228
|
return "style" in e ? e : {
|
|
229
229
|
...e,
|
|
230
230
|
getAttrs: (n) => {
|
|
@@ -242,7 +242,7 @@ function ne(e, t) {
|
|
|
242
242
|
}
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function se(e) {
|
|
246
246
|
return Object.fromEntries(
|
|
247
247
|
// @ts-ignore
|
|
248
248
|
Object.entries(e).filter(([t, n]) => t === "attrs" && Un(n) ? !1 : n != null)
|
|
@@ -250,7 +250,7 @@ function re(e) {
|
|
|
250
250
|
}
|
|
251
251
|
function Gn(e, t) {
|
|
252
252
|
var n;
|
|
253
|
-
const r =
|
|
253
|
+
const r = Ce(e), { nodeExtensions: s, markExtensions: o } = yt(e), i = (n = s.find((c) => v(c, "topNode"))) === null || n === void 0 ? void 0 : n.name, a = Object.fromEntries(s.map((c) => {
|
|
254
254
|
const u = r.filter((g) => g.type === c.name), d = {
|
|
255
255
|
name: c.name,
|
|
256
256
|
options: c.options,
|
|
@@ -262,29 +262,29 @@ function Gn(e, t) {
|
|
|
262
262
|
...g,
|
|
263
263
|
...b ? b(c) : {}
|
|
264
264
|
};
|
|
265
|
-
}, {}), h =
|
|
265
|
+
}, {}), h = se({
|
|
266
266
|
...p,
|
|
267
|
-
content:
|
|
268
|
-
marks:
|
|
269
|
-
group:
|
|
270
|
-
inline:
|
|
271
|
-
atom:
|
|
272
|
-
selectable:
|
|
273
|
-
draggable:
|
|
274
|
-
code:
|
|
275
|
-
whitespace:
|
|
276
|
-
defining:
|
|
277
|
-
isolating:
|
|
267
|
+
content: E(v(c, "content", d)),
|
|
268
|
+
marks: E(v(c, "marks", d)),
|
|
269
|
+
group: E(v(c, "group", d)),
|
|
270
|
+
inline: E(v(c, "inline", d)),
|
|
271
|
+
atom: E(v(c, "atom", d)),
|
|
272
|
+
selectable: E(v(c, "selectable", d)),
|
|
273
|
+
draggable: E(v(c, "draggable", d)),
|
|
274
|
+
code: E(v(c, "code", d)),
|
|
275
|
+
whitespace: E(v(c, "whitespace", d)),
|
|
276
|
+
defining: E(v(c, "defining", d)),
|
|
277
|
+
isolating: E(v(c, "isolating", d)),
|
|
278
278
|
attrs: Object.fromEntries(u.map((g) => {
|
|
279
279
|
var k;
|
|
280
280
|
return [g.name, { default: (k = g == null ? void 0 : g.attribute) === null || k === void 0 ? void 0 : k.default }];
|
|
281
281
|
}))
|
|
282
|
-
}), f =
|
|
283
|
-
f && (h.parseDOM = f.map((g) =>
|
|
282
|
+
}), f = E(v(c, "parseHTML", d));
|
|
283
|
+
f && (h.parseDOM = f.map((g) => re(g, u)));
|
|
284
284
|
const m = v(c, "renderHTML", d);
|
|
285
285
|
m && (h.toDOM = (g) => m({
|
|
286
286
|
node: g,
|
|
287
|
-
HTMLAttributes:
|
|
287
|
+
HTMLAttributes: ut(g, u)
|
|
288
288
|
}));
|
|
289
289
|
const y = v(c, "renderText", d);
|
|
290
290
|
return y && (h.toText = y), [c.name, h];
|
|
@@ -300,26 +300,26 @@ function Gn(e, t) {
|
|
|
300
300
|
...y,
|
|
301
301
|
...k ? k(c) : {}
|
|
302
302
|
};
|
|
303
|
-
}, {}), h =
|
|
303
|
+
}, {}), h = se({
|
|
304
304
|
...p,
|
|
305
|
-
inclusive:
|
|
306
|
-
excludes:
|
|
307
|
-
group:
|
|
308
|
-
spanning:
|
|
309
|
-
code:
|
|
305
|
+
inclusive: E(v(c, "inclusive", d)),
|
|
306
|
+
excludes: E(v(c, "excludes", d)),
|
|
307
|
+
group: E(v(c, "group", d)),
|
|
308
|
+
spanning: E(v(c, "spanning", d)),
|
|
309
|
+
code: E(v(c, "code", d)),
|
|
310
310
|
attrs: Object.fromEntries(u.map((y) => {
|
|
311
311
|
var g;
|
|
312
312
|
return [y.name, { default: (g = y == null ? void 0 : y.attribute) === null || g === void 0 ? void 0 : g.default }];
|
|
313
313
|
}))
|
|
314
|
-
}), f =
|
|
315
|
-
f && (h.parseDOM = f.map((y) =>
|
|
314
|
+
}), f = E(v(c, "parseHTML", d));
|
|
315
|
+
f && (h.parseDOM = f.map((y) => re(y, u)));
|
|
316
316
|
const m = v(c, "renderHTML", d);
|
|
317
317
|
return m && (h.toDOM = (y) => m({
|
|
318
318
|
mark: y,
|
|
319
|
-
HTMLAttributes:
|
|
319
|
+
HTMLAttributes: ut(y, u)
|
|
320
320
|
})), [c.name, h];
|
|
321
321
|
}));
|
|
322
|
-
return new
|
|
322
|
+
return new Me({
|
|
323
323
|
topNode: i,
|
|
324
324
|
nodes: a,
|
|
325
325
|
marks: l
|
|
@@ -328,7 +328,7 @@ function Gn(e, t) {
|
|
|
328
328
|
function Ct(e, t) {
|
|
329
329
|
return t.nodes[e] || t.marks[e] || null;
|
|
330
330
|
}
|
|
331
|
-
function
|
|
331
|
+
function oe(e, t) {
|
|
332
332
|
return Array.isArray(t) ? t.some((n) => (typeof n == "string" ? n : n.name) === e.name) : t;
|
|
333
333
|
}
|
|
334
334
|
const Jn = (e, t = 500) => {
|
|
@@ -362,7 +362,7 @@ const Yn = (e, t) => {
|
|
|
362
362
|
const r = [n.text];
|
|
363
363
|
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;
|
|
364
364
|
};
|
|
365
|
-
function
|
|
365
|
+
function rt(e) {
|
|
366
366
|
var t;
|
|
367
367
|
const { editor: n, from: r, to: s, text: o, rules: i, plugin: a } = e, { view: l } = n;
|
|
368
368
|
if (l.composing)
|
|
@@ -419,7 +419,7 @@ function Xn(e) {
|
|
|
419
419
|
const a = s.getMeta("applyInputRules");
|
|
420
420
|
return !!a && setTimeout(() => {
|
|
421
421
|
const { from: c, text: u } = a, d = c + u.length;
|
|
422
|
-
|
|
422
|
+
rt({
|
|
423
423
|
editor: t,
|
|
424
424
|
from: c,
|
|
425
425
|
to: d,
|
|
@@ -432,7 +432,7 @@ function Xn(e) {
|
|
|
432
432
|
},
|
|
433
433
|
props: {
|
|
434
434
|
handleTextInput(s, o, i, a) {
|
|
435
|
-
return
|
|
435
|
+
return rt({
|
|
436
436
|
editor: t,
|
|
437
437
|
from: o,
|
|
438
438
|
to: i,
|
|
@@ -444,7 +444,7 @@ function Xn(e) {
|
|
|
444
444
|
handleDOMEvents: {
|
|
445
445
|
compositionend: (s) => (setTimeout(() => {
|
|
446
446
|
const { $cursor: o } = s.state.selection;
|
|
447
|
-
o &&
|
|
447
|
+
o && rt({
|
|
448
448
|
editor: t,
|
|
449
449
|
from: o.pos,
|
|
450
450
|
to: o.pos,
|
|
@@ -460,7 +460,7 @@ function Xn(e) {
|
|
|
460
460
|
if (o.key !== "Enter")
|
|
461
461
|
return !1;
|
|
462
462
|
const { $cursor: i } = s.state.selection;
|
|
463
|
-
return i ?
|
|
463
|
+
return i ? rt({
|
|
464
464
|
editor: t,
|
|
465
465
|
from: i.pos,
|
|
466
466
|
to: i.pos,
|
|
@@ -477,14 +477,72 @@ function Xn(e) {
|
|
|
477
477
|
return r;
|
|
478
478
|
}
|
|
479
479
|
function Qn(e) {
|
|
480
|
+
return Object.prototype.toString.call(e).slice(8, -1);
|
|
481
|
+
}
|
|
482
|
+
function st(e) {
|
|
483
|
+
return Qn(e) !== "Object" ? !1 : e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
|
|
484
|
+
}
|
|
485
|
+
function vt(e, t) {
|
|
486
|
+
const n = { ...e };
|
|
487
|
+
return st(e) && st(t) && Object.keys(t).forEach((r) => {
|
|
488
|
+
st(t[r]) && st(e[r]) ? n[r] = vt(e[r], t[r]) : n[r] = t[r];
|
|
489
|
+
}), n;
|
|
490
|
+
}
|
|
491
|
+
class D {
|
|
492
|
+
constructor(t = {}) {
|
|
493
|
+
this.type = "mark", this.name = "mark", this.parent = null, this.child = null, this.config = {
|
|
494
|
+
name: this.name,
|
|
495
|
+
defaultOptions: {}
|
|
496
|
+
}, this.config = {
|
|
497
|
+
...this.config,
|
|
498
|
+
...t
|
|
499
|
+
}, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = E(v(this, "addOptions", {
|
|
500
|
+
name: this.name
|
|
501
|
+
}))), this.storage = E(v(this, "addStorage", {
|
|
502
|
+
name: this.name,
|
|
503
|
+
options: this.options
|
|
504
|
+
})) || {};
|
|
505
|
+
}
|
|
506
|
+
static create(t = {}) {
|
|
507
|
+
return new D(t);
|
|
508
|
+
}
|
|
509
|
+
configure(t = {}) {
|
|
510
|
+
const n = this.extend({
|
|
511
|
+
...this.config,
|
|
512
|
+
addOptions: () => vt(this.options, t)
|
|
513
|
+
});
|
|
514
|
+
return n.name = this.name, n.parent = this.parent, n;
|
|
515
|
+
}
|
|
516
|
+
extend(t = {}) {
|
|
517
|
+
const n = new D(t);
|
|
518
|
+
return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = E(v(n, "addOptions", {
|
|
519
|
+
name: n.name
|
|
520
|
+
})), n.storage = E(v(n, "addStorage", {
|
|
521
|
+
name: n.name,
|
|
522
|
+
options: n.options
|
|
523
|
+
})), n;
|
|
524
|
+
}
|
|
525
|
+
static handleExit({ editor: t, mark: n }) {
|
|
526
|
+
const { tr: r } = t.state, s = t.state.selection.$from;
|
|
527
|
+
if (s.pos === s.end()) {
|
|
528
|
+
const i = s.marks();
|
|
529
|
+
if (!!!i.find((c) => (c == null ? void 0 : c.type.name) === n.name))
|
|
530
|
+
return !1;
|
|
531
|
+
const l = i.find((c) => (c == null ? void 0 : c.type.name) === n.name);
|
|
532
|
+
return l && r.removeStoredMark(l), r.insertText(" ", s.pos), t.view.dispatch(r), !0;
|
|
533
|
+
}
|
|
534
|
+
return !1;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
function Zn(e) {
|
|
480
538
|
return typeof e == "number";
|
|
481
539
|
}
|
|
482
|
-
class
|
|
540
|
+
class tr {
|
|
483
541
|
constructor(t) {
|
|
484
542
|
this.find = t.find, this.handler = t.handler;
|
|
485
543
|
}
|
|
486
544
|
}
|
|
487
|
-
const
|
|
545
|
+
const er = (e, t, n) => {
|
|
488
546
|
if (Wt(t))
|
|
489
547
|
return [...e.matchAll(t)];
|
|
490
548
|
const r = t(e, n);
|
|
@@ -493,7 +551,7 @@ const tr = (e, t, n) => {
|
|
|
493
551
|
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;
|
|
494
552
|
}) : [];
|
|
495
553
|
};
|
|
496
|
-
function
|
|
554
|
+
function nr(e) {
|
|
497
555
|
const { editor: t, state: n, from: r, to: s, rule: o, pasteEvent: i, dropEvent: a } = e, { commands: l, chain: c, can: u } = new gt({
|
|
498
556
|
editor: t,
|
|
499
557
|
state: n
|
|
@@ -502,7 +560,7 @@ function er(e) {
|
|
|
502
560
|
if (!h.isTextblock || h.type.spec.code)
|
|
503
561
|
return;
|
|
504
562
|
const m = Math.max(r, f), y = Math.min(s, f + h.content.size), g = h.textBetween(m - f, y - f, void 0, "");
|
|
505
|
-
|
|
563
|
+
er(g, o.find, i).forEach((b) => {
|
|
506
564
|
if (b.index === void 0)
|
|
507
565
|
return;
|
|
508
566
|
const M = m + b.index + 1, w = M + b[0].length, S = {
|
|
@@ -522,14 +580,14 @@ function er(e) {
|
|
|
522
580
|
});
|
|
523
581
|
}), d.every((h) => h !== null);
|
|
524
582
|
}
|
|
525
|
-
const
|
|
583
|
+
const rr = (e) => {
|
|
526
584
|
var t;
|
|
527
585
|
const n = new ClipboardEvent("paste", {
|
|
528
586
|
clipboardData: new DataTransfer()
|
|
529
587
|
});
|
|
530
588
|
return (t = n.clipboardData) === null || t === void 0 || t.setData("text/html", e), n;
|
|
531
589
|
};
|
|
532
|
-
function
|
|
590
|
+
function sr(e) {
|
|
533
591
|
const { editor: t, rules: n } = e;
|
|
534
592
|
let r = null, s = !1, o = !1, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, a = typeof DragEvent < "u" ? new DragEvent("drop") : null;
|
|
535
593
|
const l = ({ state: u, from: d, to: p, rule: h, pasteEvt: f }) => {
|
|
@@ -537,7 +595,7 @@ function rr(e) {
|
|
|
537
595
|
state: u,
|
|
538
596
|
transaction: m
|
|
539
597
|
});
|
|
540
|
-
if (!(!
|
|
598
|
+
if (!(!nr({
|
|
541
599
|
editor: t,
|
|
542
600
|
state: y,
|
|
543
601
|
from: Math.max(d - 1, 0),
|
|
@@ -576,17 +634,17 @@ function rr(e) {
|
|
|
576
634
|
if (!m && !y && !k)
|
|
577
635
|
return;
|
|
578
636
|
if (k) {
|
|
579
|
-
const { from: w, text: S } = g, C = w + S.length,
|
|
637
|
+
const { from: w, text: S } = g, C = w + S.length, A = rr(S);
|
|
580
638
|
return l({
|
|
581
639
|
rule: u,
|
|
582
640
|
state: h,
|
|
583
641
|
from: w,
|
|
584
642
|
to: { b: C },
|
|
585
|
-
pasteEvt:
|
|
643
|
+
pasteEvt: A
|
|
586
644
|
});
|
|
587
645
|
}
|
|
588
646
|
const b = p.doc.content.findDiffStart(h.doc.content), M = p.doc.content.findDiffEnd(h.doc.content);
|
|
589
|
-
if (!(!
|
|
647
|
+
if (!(!Zn(b) || !M || b === M.b))
|
|
590
648
|
return l({
|
|
591
649
|
rule: u,
|
|
592
650
|
state: h,
|
|
@@ -597,7 +655,7 @@ function rr(e) {
|
|
|
597
655
|
}
|
|
598
656
|
}));
|
|
599
657
|
}
|
|
600
|
-
function
|
|
658
|
+
function or(e) {
|
|
601
659
|
const t = e.filter((n, r) => e.indexOf(n) !== r);
|
|
602
660
|
return Array.from(new Set(t));
|
|
603
661
|
}
|
|
@@ -612,7 +670,7 @@ class Q {
|
|
|
612
670
|
* @returns An flattened and sorted array of Tiptap extensions
|
|
613
671
|
*/
|
|
614
672
|
static resolve(t) {
|
|
615
|
-
const n = Q.sort(Q.flatten(t)), r =
|
|
673
|
+
const n = Q.sort(Q.flatten(t)), r = or(n.map((s) => s.name));
|
|
616
674
|
return r.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map((s) => `'${s}'`).join(", ")}]. This can lead to issues.`), n;
|
|
617
675
|
}
|
|
618
676
|
/**
|
|
@@ -674,16 +732,16 @@ class Q {
|
|
|
674
732
|
type: Ct(i.name, this.schema)
|
|
675
733
|
}, l = [], c = v(i, "addKeyboardShortcuts", a);
|
|
676
734
|
let u = {};
|
|
677
|
-
if (i.type === "mark" && v(i, "exitable", a) && (u.ArrowRight = () =>
|
|
735
|
+
if (i.type === "mark" && v(i, "exitable", a) && (u.ArrowRight = () => D.handleExit({ editor: t, mark: i })), c) {
|
|
678
736
|
const m = Object.fromEntries(Object.entries(c()).map(([y, g]) => [y, () => g({ editor: t })]));
|
|
679
737
|
u = { ...u, ...m };
|
|
680
738
|
}
|
|
681
739
|
const d = bn(u);
|
|
682
740
|
l.push(d);
|
|
683
741
|
const p = v(i, "addInputRules", a);
|
|
684
|
-
|
|
742
|
+
oe(i, t.options.enableInputRules) && p && r.push(...p());
|
|
685
743
|
const h = v(i, "addPasteRules", a);
|
|
686
|
-
|
|
744
|
+
oe(i, t.options.enablePasteRules) && h && s.push(...h());
|
|
687
745
|
const f = v(i, "addProseMirrorPlugins", a);
|
|
688
746
|
if (f) {
|
|
689
747
|
const m = f();
|
|
@@ -696,7 +754,7 @@ class Q {
|
|
|
696
754
|
editor: t,
|
|
697
755
|
rules: r
|
|
698
756
|
}),
|
|
699
|
-
...
|
|
757
|
+
...sr({
|
|
700
758
|
editor: t,
|
|
701
759
|
rules: s
|
|
702
760
|
}),
|
|
@@ -708,7 +766,7 @@ class Q {
|
|
|
708
766
|
* @returns An array of attributes
|
|
709
767
|
*/
|
|
710
768
|
get attributes() {
|
|
711
|
-
return
|
|
769
|
+
return Ce(this.extensions);
|
|
712
770
|
}
|
|
713
771
|
/**
|
|
714
772
|
* Get all node views from the extensions.
|
|
@@ -727,7 +785,7 @@ class Q {
|
|
|
727
785
|
if (!i)
|
|
728
786
|
return [];
|
|
729
787
|
const a = (l, c, u, d, p) => {
|
|
730
|
-
const h =
|
|
788
|
+
const h = ut(l, s);
|
|
731
789
|
return i()({
|
|
732
790
|
// pass-through
|
|
733
791
|
node: l,
|
|
@@ -759,25 +817,13 @@ class Q {
|
|
|
759
817
|
editor: this.editor,
|
|
760
818
|
type: Ct(t.name, this.schema)
|
|
761
819
|
};
|
|
762
|
-
t.type === "mark" && (!((n =
|
|
820
|
+
t.type === "mark" && (!((n = E(v(t, "keepOnSplit", r))) !== null && n !== void 0) || n) && this.splittableMarks.push(t.name);
|
|
763
821
|
const s = v(t, "onBeforeCreate", r), o = v(t, "onCreate", r), i = v(t, "onUpdate", r), a = v(t, "onSelectionUpdate", r), l = v(t, "onTransaction", r), c = v(t, "onFocus", r), u = v(t, "onBlur", r), d = v(t, "onDestroy", r);
|
|
764
822
|
s && this.editor.on("beforeCreate", s), o && this.editor.on("create", o), i && this.editor.on("update", i), a && this.editor.on("selectionUpdate", a), l && this.editor.on("transaction", l), c && this.editor.on("focus", c), u && this.editor.on("blur", u), d && this.editor.on("destroy", d);
|
|
765
823
|
});
|
|
766
824
|
}
|
|
767
825
|
}
|
|
768
|
-
|
|
769
|
-
return Object.prototype.toString.call(e).slice(8, -1);
|
|
770
|
-
}
|
|
771
|
-
function ot(e) {
|
|
772
|
-
return or(e) !== "Object" ? !1 : e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
|
|
773
|
-
}
|
|
774
|
-
function vt(e, t) {
|
|
775
|
-
const n = { ...e };
|
|
776
|
-
return ot(e) && ot(t) && Object.keys(t).forEach((r) => {
|
|
777
|
-
ot(t[r]) && ot(e[r]) ? n[r] = vt(e[r], t[r]) : n[r] = t[r];
|
|
778
|
-
}), n;
|
|
779
|
-
}
|
|
780
|
-
class H {
|
|
826
|
+
class _ {
|
|
781
827
|
constructor(t = {}) {
|
|
782
828
|
this.type = "extension", this.name = "extension", this.parent = null, this.child = null, this.config = {
|
|
783
829
|
name: this.name,
|
|
@@ -785,15 +831,15 @@ class H {
|
|
|
785
831
|
}, this.config = {
|
|
786
832
|
...this.config,
|
|
787
833
|
...t
|
|
788
|
-
}, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options =
|
|
834
|
+
}, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = E(v(this, "addOptions", {
|
|
789
835
|
name: this.name
|
|
790
|
-
}))), this.storage =
|
|
836
|
+
}))), this.storage = E(v(this, "addStorage", {
|
|
791
837
|
name: this.name,
|
|
792
838
|
options: this.options
|
|
793
839
|
})) || {};
|
|
794
840
|
}
|
|
795
841
|
static create(t = {}) {
|
|
796
|
-
return new
|
|
842
|
+
return new _(t);
|
|
797
843
|
}
|
|
798
844
|
configure(t = {}) {
|
|
799
845
|
const n = this.extend({
|
|
@@ -803,16 +849,16 @@ class H {
|
|
|
803
849
|
return n.name = this.name, n.parent = this.parent, n;
|
|
804
850
|
}
|
|
805
851
|
extend(t = {}) {
|
|
806
|
-
const n = new
|
|
807
|
-
return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options =
|
|
852
|
+
const n = new _({ ...this.config, ...t });
|
|
853
|
+
return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = E(v(n, "addOptions", {
|
|
808
854
|
name: n.name
|
|
809
|
-
})), n.storage =
|
|
855
|
+
})), n.storage = E(v(n, "addStorage", {
|
|
810
856
|
name: n.name,
|
|
811
857
|
options: n.options
|
|
812
858
|
})), n;
|
|
813
859
|
}
|
|
814
860
|
}
|
|
815
|
-
function
|
|
861
|
+
function Ae(e, t, n) {
|
|
816
862
|
const { from: r, to: s } = t, { blockSeparator: o = `
|
|
817
863
|
|
|
818
864
|
`, textSerializers: i = {} } = n || {};
|
|
@@ -835,7 +881,7 @@ function Le(e, t, n) {
|
|
|
835
881
|
function Oe(e) {
|
|
836
882
|
return Object.fromEntries(Object.entries(e.nodes).filter(([, t]) => t.spec.toText).map(([t, n]) => [t, n.spec.toText]));
|
|
837
883
|
}
|
|
838
|
-
const ir =
|
|
884
|
+
const ir = _.create({
|
|
839
885
|
name: "clipboardTextSerializer",
|
|
840
886
|
addOptions() {
|
|
841
887
|
return {
|
|
@@ -849,7 +895,7 @@ const ir = H.create({
|
|
|
849
895
|
props: {
|
|
850
896
|
clipboardTextSerializer: () => {
|
|
851
897
|
const { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: s } = t, { ranges: o } = s, i = Math.min(...o.map((u) => u.$from.pos)), a = Math.max(...o.map((u) => u.$to.pos)), l = Oe(n);
|
|
852
|
-
return
|
|
898
|
+
return Ae(r, { from: i, to: a }, {
|
|
853
899
|
...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
|
|
854
900
|
textSerializers: l
|
|
855
901
|
});
|
|
@@ -882,7 +928,7 @@ const ir = H.create({
|
|
|
882
928
|
const { state: s } = n, o = s.doc.slice(e.from, e.to);
|
|
883
929
|
r.deleteRange(e.from, e.to);
|
|
884
930
|
const i = r.mapping.map(t);
|
|
885
|
-
return r.insert(i, o.content), r.setSelection(new
|
|
931
|
+
return r.insert(i, o.content), r.setSelection(new $(r.doc.resolve(i - 1))), !0;
|
|
886
932
|
}, hr = () => ({ tr: e, dispatch: t }) => {
|
|
887
933
|
const { selection: n } = e, r = n.$anchor.node();
|
|
888
934
|
if (r.content.size > 0)
|
|
@@ -912,12 +958,12 @@ const ir = H.create({
|
|
|
912
958
|
const { from: r, to: s } = e;
|
|
913
959
|
return n && t.delete(r, s), !0;
|
|
914
960
|
}, gr = () => ({ state: e, dispatch: t }) => Ge(e, t), yr = () => ({ commands: e }) => e.keyboardShortcut("Enter"), br = () => ({ state: e, dispatch: t }) => Je(e, t);
|
|
915
|
-
function
|
|
961
|
+
function pt(e, t, n = { strict: !0 }) {
|
|
916
962
|
const r = Object.keys(t);
|
|
917
963
|
return r.length ? r.every((s) => n.strict ? t[s] === e[s] : Wt(t[s]) ? t[s].test(e[s]) : t[s] === e[s]) : !0;
|
|
918
964
|
}
|
|
919
965
|
function Rt(e, t, n = {}) {
|
|
920
|
-
return e.find((r) => r.type === t &&
|
|
966
|
+
return e.find((r) => r.type === t && pt(r.attrs, n));
|
|
921
967
|
}
|
|
922
968
|
function vr(e, t, n = {}) {
|
|
923
969
|
return !!Rt(e, t, n);
|
|
@@ -954,7 +1000,7 @@ const Mr = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
|
954
1000
|
if (s) {
|
|
955
1001
|
const d = Kt(l, o, t);
|
|
956
1002
|
if (d && d.from <= c && d.to >= u) {
|
|
957
|
-
const p =
|
|
1003
|
+
const p = $.create(i, d.from, d.to);
|
|
958
1004
|
n.setSelection(p);
|
|
959
1005
|
}
|
|
960
1006
|
}
|
|
@@ -967,12 +1013,12 @@ const Mr = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
|
967
1013
|
return !1;
|
|
968
1014
|
};
|
|
969
1015
|
function Ut(e) {
|
|
970
|
-
return e instanceof
|
|
1016
|
+
return e instanceof $;
|
|
971
1017
|
}
|
|
972
1018
|
function B(e = 0, t = 0, n = 0) {
|
|
973
1019
|
return Math.min(Math.max(e, t), n);
|
|
974
1020
|
}
|
|
975
|
-
function
|
|
1021
|
+
function Le(e, t = null) {
|
|
976
1022
|
if (!t)
|
|
977
1023
|
return null;
|
|
978
1024
|
const n = G.atStart(e), r = G.atEnd(e);
|
|
@@ -981,7 +1027,7 @@ function He(e, t = null) {
|
|
|
981
1027
|
if (t === "end")
|
|
982
1028
|
return r;
|
|
983
1029
|
const s = n.from, o = r.to;
|
|
984
|
-
return t === "all" ?
|
|
1030
|
+
return t === "all" ? $.create(e, B(0, s, o), B(e.content.size, s, o)) : $.create(e, B(t, s, o), B(t, s, o));
|
|
985
1031
|
}
|
|
986
1032
|
function Mt() {
|
|
987
1033
|
return [
|
|
@@ -1007,9 +1053,9 @@ const kr = (e = null, t = {}) => ({ editor: n, view: r, tr: s, dispatch: o }) =>
|
|
|
1007
1053
|
return !0;
|
|
1008
1054
|
if (o && e === null && !Ut(n.state.selection))
|
|
1009
1055
|
return i(), !0;
|
|
1010
|
-
const a =
|
|
1056
|
+
const a = Le(s.doc, e) || n.state.selection, l = n.state.selection.eq(a);
|
|
1011
1057
|
return o && (l || s.setSelection(a), l && s.storedMarks && s.setStoredMarks(s.storedMarks), i()), !0;
|
|
1012
|
-
}, wr = (e, t) => (n) => e.every((r, s) => t(r, { ...n, index: s })),
|
|
1058
|
+
}, wr = (e, t) => (n) => e.every((r, s) => t(r, { ...n, index: s })), Er = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({ from: n.selection.from, to: n.selection.to }, e, t), _e = (e) => {
|
|
1013
1059
|
const t = e.childNodes;
|
|
1014
1060
|
for (let n = t.length - 1; n >= 0; n -= 1) {
|
|
1015
1061
|
const r = t[n];
|
|
@@ -1017,11 +1063,11 @@ const kr = (e = null, t = {}) => ({ editor: n, view: r, tr: s, dispatch: o }) =>
|
|
|
1017
1063
|
}
|
|
1018
1064
|
return e;
|
|
1019
1065
|
};
|
|
1020
|
-
function
|
|
1066
|
+
function ot(e) {
|
|
1021
1067
|
const t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
|
|
1022
1068
|
return _e(n);
|
|
1023
1069
|
}
|
|
1024
|
-
function
|
|
1070
|
+
function ht(e, t, n) {
|
|
1025
1071
|
n = {
|
|
1026
1072
|
slice: !0,
|
|
1027
1073
|
parseOptions: {},
|
|
@@ -1031,18 +1077,18 @@ function ft(e, t, n) {
|
|
|
1031
1077
|
if (r)
|
|
1032
1078
|
try {
|
|
1033
1079
|
if (Array.isArray(e) && e.length > 0)
|
|
1034
|
-
return
|
|
1080
|
+
return lt.fromArray(e.map((a) => t.nodeFromJSON(a)));
|
|
1035
1081
|
const i = t.nodeFromJSON(e);
|
|
1036
1082
|
return n.errorOnInvalidContent && i.check(), i;
|
|
1037
1083
|
} catch (o) {
|
|
1038
1084
|
if (n.errorOnInvalidContent)
|
|
1039
1085
|
throw new Error("[tiptap error]: Invalid JSON content", { cause: o });
|
|
1040
|
-
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", o),
|
|
1086
|
+
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", o), ht("", t, n);
|
|
1041
1087
|
}
|
|
1042
1088
|
if (s) {
|
|
1043
1089
|
if (n.errorOnInvalidContent) {
|
|
1044
1090
|
let i = !1, a = "";
|
|
1045
|
-
const l = new
|
|
1091
|
+
const l = new Me({
|
|
1046
1092
|
topNode: t.spec.topNode,
|
|
1047
1093
|
marks: t.spec.marks,
|
|
1048
1094
|
// Prosemirror's schemas are executed such that: the last to execute, matches last
|
|
@@ -1060,15 +1106,15 @@ function ft(e, t, n) {
|
|
|
1060
1106
|
}
|
|
1061
1107
|
})
|
|
1062
1108
|
});
|
|
1063
|
-
if (n.slice ?
|
|
1109
|
+
if (n.slice ? Tt.fromSchema(l).parseSlice(ot(e), n.parseOptions) : Tt.fromSchema(l).parse(ot(e), n.parseOptions), n.errorOnInvalidContent && i)
|
|
1064
1110
|
throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${a}`) });
|
|
1065
1111
|
}
|
|
1066
|
-
const o =
|
|
1067
|
-
return n.slice ? o.parseSlice(
|
|
1112
|
+
const o = Tt.fromSchema(t);
|
|
1113
|
+
return n.slice ? o.parseSlice(ot(e), n.parseOptions).content : o.parse(ot(e), n.parseOptions);
|
|
1068
1114
|
}
|
|
1069
|
-
return
|
|
1115
|
+
return ht("", t, n);
|
|
1070
1116
|
}
|
|
1071
|
-
function
|
|
1117
|
+
function Tr(e, t, n) {
|
|
1072
1118
|
const r = e.steps.length - 1;
|
|
1073
1119
|
if (r < t)
|
|
1074
1120
|
return;
|
|
@@ -1081,7 +1127,7 @@ function Er(e, t, n) {
|
|
|
1081
1127
|
i === 0 && (i = u);
|
|
1082
1128
|
}), e.setSelection(G.near(e.doc.resolve(i), n));
|
|
1083
1129
|
}
|
|
1084
|
-
const Cr = (e) => !("type" in e),
|
|
1130
|
+
const Cr = (e) => !("type" in e), xr = (e, t, n) => ({ tr: r, dispatch: s, editor: o }) => {
|
|
1085
1131
|
var i;
|
|
1086
1132
|
if (s) {
|
|
1087
1133
|
n = {
|
|
@@ -1093,7 +1139,7 @@ const Cr = (e) => !("type" in e), Ar = (e, t, n) => ({ tr: r, dispatch: s, edito
|
|
|
1093
1139
|
};
|
|
1094
1140
|
let a;
|
|
1095
1141
|
try {
|
|
1096
|
-
a =
|
|
1142
|
+
a = ht(t, o.schema, {
|
|
1097
1143
|
parseOptions: {
|
|
1098
1144
|
preserveWhitespace: "full",
|
|
1099
1145
|
...n.parseOptions
|
|
@@ -1117,25 +1163,25 @@ const Cr = (e) => !("type" in e), Ar = (e, t, n) => ({ tr: r, dispatch: s, edito
|
|
|
1117
1163
|
f.isTextblock && !f.type.spec.code && !f.childCount && (l -= 1, c += 1);
|
|
1118
1164
|
}
|
|
1119
1165
|
let h;
|
|
1120
|
-
u ? (Array.isArray(t) ? h = t.map((f) => f.text || "").join("") : typeof t == "object" && t && t.text ? h = t.text : h = t, r.insertText(h, l, c)) : (h = a, r.replaceWith(l, c, h)), n.updateSelection &&
|
|
1166
|
+
u ? (Array.isArray(t) ? h = t.map((f) => f.text || "").join("") : typeof t == "object" && t && t.text ? h = t.text : h = t, r.insertText(h, l, c)) : (h = a, r.replaceWith(l, c, h)), n.updateSelection && Tr(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: l, text: h }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: l, text: h });
|
|
1121
1167
|
}
|
|
1122
1168
|
return !0;
|
|
1123
|
-
},
|
|
1169
|
+
}, Ar = () => ({ state: e, dispatch: t }) => Ye(e, t), Or = () => ({ state: e, dispatch: t }) => Xe(e, t), Lr = () => ({ state: e, dispatch: t }) => Qe(e, t), _r = () => ({ state: e, dispatch: t }) => Ze(e, t), Hr = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
1124
1170
|
try {
|
|
1125
|
-
const r =
|
|
1171
|
+
const r = ve(e.doc, e.selection.$from.pos, -1);
|
|
1126
1172
|
return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
1127
1173
|
} catch {
|
|
1128
1174
|
return !1;
|
|
1129
1175
|
}
|
|
1130
1176
|
}, Rr = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
1131
1177
|
try {
|
|
1132
|
-
const r =
|
|
1178
|
+
const r = ve(e.doc, e.selection.$from.pos, 1);
|
|
1133
1179
|
return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
1134
1180
|
} catch {
|
|
1135
1181
|
return !1;
|
|
1136
1182
|
}
|
|
1137
1183
|
}, Pr = () => ({ state: e, dispatch: t }) => tn(e, t), Ir = () => ({ state: e, dispatch: t }) => en(e, t);
|
|
1138
|
-
function
|
|
1184
|
+
function He() {
|
|
1139
1185
|
return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
|
|
1140
1186
|
}
|
|
1141
1187
|
function $r(e) {
|
|
@@ -1154,7 +1200,7 @@ function $r(e) {
|
|
|
1154
1200
|
else if (/^s(hift)?$/i.test(l))
|
|
1155
1201
|
o = !0;
|
|
1156
1202
|
else if (/^mod$/i.test(l))
|
|
1157
|
-
Mt() ||
|
|
1203
|
+
Mt() || He() ? i = !0 : s = !0;
|
|
1158
1204
|
else
|
|
1159
1205
|
throw new Error(`Unrecognized modifier name: ${l}`);
|
|
1160
1206
|
}
|
|
@@ -1189,7 +1235,7 @@ function nt(e, t, n = {}) {
|
|
|
1189
1235
|
to: f
|
|
1190
1236
|
});
|
|
1191
1237
|
});
|
|
1192
|
-
const l = s - r, c = a.filter((d) => i ? i.name === d.node.type.name : !0).filter((d) =>
|
|
1238
|
+
const l = s - r, c = a.filter((d) => i ? i.name === d.node.type.name : !0).filter((d) => pt(d.node.attrs, n, { strict: !1 }));
|
|
1193
1239
|
return o ? !!c.length : c.reduce((d, p) => d + p.to - p.from, 0) >= l;
|
|
1194
1240
|
}
|
|
1195
1241
|
const Nr = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
@@ -1202,7 +1248,7 @@ const Nr = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
|
1202
1248
|
function St(e, t) {
|
|
1203
1249
|
return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
|
|
1204
1250
|
}
|
|
1205
|
-
function
|
|
1251
|
+
function ie(e, t) {
|
|
1206
1252
|
const n = typeof t == "string" ? [t] : t;
|
|
1207
1253
|
return Object.keys(e).reduce((r, s) => (n.includes(s) || (r[s] = e[s]), r), {});
|
|
1208
1254
|
}
|
|
@@ -1211,8 +1257,8 @@ const zr = (e, t) => ({ tr: n, state: r, dispatch: s }) => {
|
|
|
1211
1257
|
const a = St(typeof e == "string" ? e : e.name, r.schema);
|
|
1212
1258
|
return a ? (a === "node" && (o = R(e, r.schema)), a === "mark" && (i = V(e, r.schema)), s && n.selection.ranges.forEach((l) => {
|
|
1213
1259
|
r.doc.nodesBetween(l.$from.pos, l.$to.pos, (c, u) => {
|
|
1214
|
-
o && o === c.type && n.setNodeMarkup(u, void 0,
|
|
1215
|
-
i === d.type && n.addMark(u, u + c.nodeSize, i.create(
|
|
1260
|
+
o && o === c.type && n.setNodeMarkup(u, void 0, ie(c.attrs, t)), i && c.marks.length && c.marks.forEach((d) => {
|
|
1261
|
+
i === d.type && n.addMark(u, u + c.nodeSize, i.create(ie(d.attrs, t)));
|
|
1216
1262
|
});
|
|
1217
1263
|
});
|
|
1218
1264
|
}), !0) : !1;
|
|
@@ -1221,7 +1267,7 @@ const zr = (e, t) => ({ tr: n, state: r, dispatch: s }) => {
|
|
|
1221
1267
|
to: e.doc.content.size
|
|
1222
1268
|
}), Kr = () => ({ state: e, dispatch: t }) => an(e, t), Ur = () => ({ state: e, dispatch: t }) => ln(e, t), qr = () => ({ state: e, dispatch: t }) => cn(e, t), Gr = () => ({ state: e, dispatch: t }) => dn(e, t), Jr = () => ({ state: e, dispatch: t }) => un(e, t);
|
|
1223
1269
|
function Pt(e, t, n = {}, r = {}) {
|
|
1224
|
-
return
|
|
1270
|
+
return ht(e, t, {
|
|
1225
1271
|
slice: !1,
|
|
1226
1272
|
parseOptions: n,
|
|
1227
1273
|
errorOnInvalidContent: r.errorOnInvalidContent
|
|
@@ -1241,7 +1287,7 @@ const Yr = (e, t = !1, n = {}, r = {}) => ({ editor: s, tr: o, dispatch: i, comm
|
|
|
1241
1287
|
errorOnInvalidContent: (c = r.errorOnInvalidContent) !== null && c !== void 0 ? c : s.options.enableContentCheck
|
|
1242
1288
|
});
|
|
1243
1289
|
};
|
|
1244
|
-
function
|
|
1290
|
+
function qt(e, t) {
|
|
1245
1291
|
const n = V(t, e.schema), { from: r, to: s, empty: o } = e.selection, i = [];
|
|
1246
1292
|
o ? (e.storedMarks && i.push(...e.storedMarks), i.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, s, (l) => {
|
|
1247
1293
|
i.push(...l.marks);
|
|
@@ -1265,7 +1311,7 @@ function Qr(e) {
|
|
|
1265
1311
|
}
|
|
1266
1312
|
return null;
|
|
1267
1313
|
}
|
|
1268
|
-
function
|
|
1314
|
+
function Go(e, t) {
|
|
1269
1315
|
const n = [];
|
|
1270
1316
|
return e.descendants((r, s) => {
|
|
1271
1317
|
t(r) && n.push({
|
|
@@ -1283,7 +1329,7 @@ function Zr(e, t, n) {
|
|
|
1283
1329
|
});
|
|
1284
1330
|
}), r;
|
|
1285
1331
|
}
|
|
1286
|
-
function
|
|
1332
|
+
function Re(e, t) {
|
|
1287
1333
|
for (let n = e.depth; n > 0; n -= 1) {
|
|
1288
1334
|
const r = e.node(n);
|
|
1289
1335
|
if (t(r))
|
|
@@ -1295,8 +1341,8 @@ function Pe(e, t) {
|
|
|
1295
1341
|
};
|
|
1296
1342
|
}
|
|
1297
1343
|
}
|
|
1298
|
-
function
|
|
1299
|
-
return (t) =>
|
|
1344
|
+
function Gt(e) {
|
|
1345
|
+
return (t) => Re(t.$from, e);
|
|
1300
1346
|
}
|
|
1301
1347
|
function ts(e, t) {
|
|
1302
1348
|
const n = Sn.fromSchema(t).serializeFragment(e), s = document.implementation.createHTMLDocument().createElement("div");
|
|
@@ -1307,7 +1353,7 @@ function es(e, t) {
|
|
|
1307
1353
|
from: 0,
|
|
1308
1354
|
to: e.content.size
|
|
1309
1355
|
};
|
|
1310
|
-
return
|
|
1356
|
+
return Ae(e, n, t);
|
|
1311
1357
|
}
|
|
1312
1358
|
function ns(e, t) {
|
|
1313
1359
|
const n = R(t, e.schema), { from: r, to: s } = e.selection, o = [];
|
|
@@ -1317,9 +1363,9 @@ function ns(e, t) {
|
|
|
1317
1363
|
const i = o.reverse().find((a) => a.type.name === n.name);
|
|
1318
1364
|
return i ? { ...i.attrs } : {};
|
|
1319
1365
|
}
|
|
1320
|
-
function
|
|
1366
|
+
function Pe(e, t) {
|
|
1321
1367
|
const n = St(typeof t == "string" ? t : t.name, e.schema);
|
|
1322
|
-
return n === "node" ? ns(e, t) : n === "mark" ?
|
|
1368
|
+
return n === "node" ? ns(e, t) : n === "mark" ? qt(e, t) : {};
|
|
1323
1369
|
}
|
|
1324
1370
|
function rs(e, t = JSON.stringify) {
|
|
1325
1371
|
const n = {};
|
|
@@ -1361,7 +1407,7 @@ function os(e) {
|
|
|
1361
1407
|
});
|
|
1362
1408
|
}), ss(r);
|
|
1363
1409
|
}
|
|
1364
|
-
function
|
|
1410
|
+
function Jt(e, t, n) {
|
|
1365
1411
|
const r = [];
|
|
1366
1412
|
return e === t ? n.resolve(e).marks().forEach((s) => {
|
|
1367
1413
|
const o = n.resolve(e), i = Kt(o, s.type);
|
|
@@ -1377,7 +1423,7 @@ function Gt(e, t, n) {
|
|
|
1377
1423
|
})));
|
|
1378
1424
|
}), r;
|
|
1379
1425
|
}
|
|
1380
|
-
function
|
|
1426
|
+
function ct(e, t, n) {
|
|
1381
1427
|
return Object.fromEntries(Object.entries(n).filter(([r]) => {
|
|
1382
1428
|
const s = e.find((o) => o.type === t && o.name === r);
|
|
1383
1429
|
return s ? s.attribute.keepOnSplit : !1;
|
|
@@ -1386,7 +1432,7 @@ function dt(e, t, n) {
|
|
|
1386
1432
|
function It(e, t, n = {}) {
|
|
1387
1433
|
const { empty: r, ranges: s } = e.selection, o = t ? V(t, e.schema) : null;
|
|
1388
1434
|
if (r)
|
|
1389
|
-
return !!(e.storedMarks || e.selection.$from.marks()).filter((d) => o ? o.name === d.type.name : !0).find((d) =>
|
|
1435
|
+
return !!(e.storedMarks || e.selection.$from.marks()).filter((d) => o ? o.name === d.type.name : !0).find((d) => pt(d.attrs, n, { strict: !1 }));
|
|
1390
1436
|
let i = 0;
|
|
1391
1437
|
const a = [];
|
|
1392
1438
|
if (s.forEach(({ $from: d, $to: p }) => {
|
|
@@ -1403,7 +1449,7 @@ function It(e, t, n = {}) {
|
|
|
1403
1449
|
});
|
|
1404
1450
|
}), i === 0)
|
|
1405
1451
|
return !1;
|
|
1406
|
-
const l = a.filter((d) => o ? o.name === d.mark.type.name : !0).filter((d) =>
|
|
1452
|
+
const l = a.filter((d) => o ? o.name === d.mark.type.name : !0).filter((d) => pt(d.mark.attrs, n, { strict: !1 })).reduce((d, p) => d + p.to - p.from, 0), c = a.filter((d) => o ? d.mark.type !== o && d.mark.type.excludes(o) : !0).reduce((d, p) => d + p.to - p.from, 0);
|
|
1407
1453
|
return (l > 0 ? l + c : l) >= i;
|
|
1408
1454
|
}
|
|
1409
1455
|
function is(e, t, n = {}) {
|
|
@@ -1412,7 +1458,7 @@ function is(e, t, n = {}) {
|
|
|
1412
1458
|
const r = St(t, e.schema);
|
|
1413
1459
|
return r === "node" ? nt(e, t, n) : r === "mark" ? It(e, t, n) : !1;
|
|
1414
1460
|
}
|
|
1415
|
-
function
|
|
1461
|
+
function ae(e, t) {
|
|
1416
1462
|
const { nodeExtensions: n } = yt(t), r = n.find((i) => i.name === e);
|
|
1417
1463
|
if (!r)
|
|
1418
1464
|
return !1;
|
|
@@ -1420,7 +1466,7 @@ function ie(e, t) {
|
|
|
1420
1466
|
name: r.name,
|
|
1421
1467
|
options: r.options,
|
|
1422
1468
|
storage: r.storage
|
|
1423
|
-
}, o =
|
|
1469
|
+
}, o = E(v(r, "group", s));
|
|
1424
1470
|
return typeof o != "string" ? !1 : o.split(" ").includes("list");
|
|
1425
1471
|
}
|
|
1426
1472
|
function kt(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
@@ -1445,7 +1491,7 @@ function kt(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1445
1491
|
}
|
|
1446
1492
|
return !1;
|
|
1447
1493
|
}
|
|
1448
|
-
function
|
|
1494
|
+
function Ie(e) {
|
|
1449
1495
|
return e instanceof Z;
|
|
1450
1496
|
}
|
|
1451
1497
|
function as(e, t, n) {
|
|
@@ -1490,7 +1536,7 @@ const cs = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
|
1490
1536
|
const { selection: o } = n, { empty: i, ranges: a } = o, l = V(e, r.schema);
|
|
1491
1537
|
if (s)
|
|
1492
1538
|
if (i) {
|
|
1493
|
-
const c =
|
|
1539
|
+
const c = qt(r, l);
|
|
1494
1540
|
n.addStoredMark(l.create({
|
|
1495
1541
|
...c,
|
|
1496
1542
|
...t
|
|
@@ -1511,7 +1557,7 @@ const cs = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
|
1511
1557
|
return ls(r, n, l);
|
|
1512
1558
|
}, ds = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), us = (e, t = {}) => ({ state: n, dispatch: r, chain: s }) => {
|
|
1513
1559
|
const o = R(e, n.schema);
|
|
1514
|
-
return o.isTextblock ? s().command(({ commands: i }) =>
|
|
1560
|
+
return o.isTextblock ? s().command(({ commands: i }) => Xt(o, t)(n) ? !0 : i.clearNodes()).command(({ state: i }) => Xt(o, t)(i, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
|
|
1515
1561
|
}, ps = (e) => ({ tr: t, dispatch: n }) => {
|
|
1516
1562
|
if (n) {
|
|
1517
1563
|
const { doc: r } = t, s = B(e, 0, r.content.size), o = Z.create(r, s);
|
|
@@ -1520,7 +1566,7 @@ const cs = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
|
1520
1566
|
return !0;
|
|
1521
1567
|
}, hs = (e) => ({ tr: t, dispatch: n }) => {
|
|
1522
1568
|
if (n) {
|
|
1523
|
-
const { doc: r } = t, { from: s, to: o } = typeof e == "number" ? { from: e, to: e } : e, i =
|
|
1569
|
+
const { doc: r } = t, { from: s, to: o } = typeof e == "number" ? { from: e, to: e } : e, i = $.atStart(r).from, a = $.atEnd(r).to, l = B(s, i, a), c = B(o, i, a), u = $.create(r, l, c);
|
|
1524
1570
|
t.setSelection(u);
|
|
1525
1571
|
}
|
|
1526
1572
|
return !0;
|
|
@@ -1528,7 +1574,7 @@ const cs = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
|
1528
1574
|
const r = R(e, t.schema);
|
|
1529
1575
|
return pn(r)(t, n);
|
|
1530
1576
|
};
|
|
1531
|
-
function
|
|
1577
|
+
function le(e, t) {
|
|
1532
1578
|
const n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
|
|
1533
1579
|
if (n) {
|
|
1534
1580
|
const r = n.filter((s) => t == null ? void 0 : t.includes(s.type.name));
|
|
@@ -1536,9 +1582,9 @@ function ae(e, t) {
|
|
|
1536
1582
|
}
|
|
1537
1583
|
}
|
|
1538
1584
|
const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: s }) => {
|
|
1539
|
-
const { selection: o, doc: i } = t, { $from: a, $to: l } = o, c = s.extensionManager.attributes, u =
|
|
1585
|
+
const { selection: o, doc: i } = t, { $from: a, $to: l } = o, c = s.extensionManager.attributes, u = ct(c, a.node().type.name, a.node().attrs);
|
|
1540
1586
|
if (o instanceof Z && o.node.isBlock)
|
|
1541
|
-
return !a.parentOffset || !
|
|
1587
|
+
return !a.parentOffset || !at(i, a.pos) ? !1 : (r && (e && le(n, s.extensionManager.splittableMarks), t.split(a.pos).scrollIntoView()), !0);
|
|
1542
1588
|
if (!a.parent.isBlock)
|
|
1543
1589
|
return !1;
|
|
1544
1590
|
const d = l.parentOffset === l.parent.content.size, p = a.depth === 0 ? void 0 : Qr(a.node(-1).contentMatchAt(a.indexAfter(-1)));
|
|
@@ -1547,18 +1593,18 @@ const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1547
1593
|
type: p,
|
|
1548
1594
|
attrs: u
|
|
1549
1595
|
}
|
|
1550
|
-
] : void 0, f =
|
|
1551
|
-
if (!h && !f &&
|
|
1596
|
+
] : void 0, f = at(t.doc, t.mapping.map(a.pos), 1, h);
|
|
1597
|
+
if (!h && !f && at(t.doc, t.mapping.map(a.pos), 1, p ? [{ type: p }] : void 0) && (f = !0, h = p ? [
|
|
1552
1598
|
{
|
|
1553
1599
|
type: p,
|
|
1554
1600
|
attrs: u
|
|
1555
1601
|
}
|
|
1556
1602
|
] : void 0), r) {
|
|
1557
|
-
if (f && (o instanceof
|
|
1603
|
+
if (f && (o instanceof $ && t.deleteSelection(), t.split(t.mapping.map(a.pos), 1, h), p && !d && !a.parentOffset && a.parent.type !== p)) {
|
|
1558
1604
|
const m = t.mapping.map(a.before()), y = t.doc.resolve(m);
|
|
1559
1605
|
a.node(-1).canReplaceWith(y.index(), y.index() + 1, p) && t.setNodeMarkup(t.mapping.map(a.before()), p);
|
|
1560
1606
|
}
|
|
1561
|
-
e &&
|
|
1607
|
+
e && le(n, s.extensionManager.splittableMarks), t.scrollIntoView();
|
|
1562
1608
|
}
|
|
1563
1609
|
return f;
|
|
1564
1610
|
}, gs = (e, t = {}) => ({ tr: n, state: r, dispatch: s, editor: o }) => {
|
|
@@ -1574,31 +1620,31 @@ const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1574
1620
|
if (l.depth === 2 || l.node(-3).type !== a || l.index(-2) !== l.node(-2).childCount - 1)
|
|
1575
1621
|
return !1;
|
|
1576
1622
|
if (s) {
|
|
1577
|
-
let g =
|
|
1623
|
+
let g = lt.empty;
|
|
1578
1624
|
const k = l.index(-1) ? 1 : l.index(-2) ? 2 : 3;
|
|
1579
|
-
for (let
|
|
1580
|
-
g =
|
|
1625
|
+
for (let A = l.depth - k; A >= l.depth - 3; A -= 1)
|
|
1626
|
+
g = lt.from(l.node(A).copy(g));
|
|
1581
1627
|
const b = l.indexAfter(-1) < l.node(-2).childCount ? 1 : l.indexAfter(-2) < l.node(-3).childCount ? 2 : 3, M = {
|
|
1582
|
-
...
|
|
1628
|
+
...ct(p, l.node().type.name, l.node().attrs),
|
|
1583
1629
|
...t
|
|
1584
1630
|
}, w = ((i = a.contentMatch.defaultType) === null || i === void 0 ? void 0 : i.createAndFill(M)) || void 0;
|
|
1585
|
-
g = g.append(
|
|
1631
|
+
g = g.append(lt.from(a.createAndFill(null, w) || void 0));
|
|
1586
1632
|
const S = l.before(l.depth - (k - 1));
|
|
1587
1633
|
n.replace(S, l.after(-b), new hn(g, 4 - k, 0));
|
|
1588
1634
|
let C = -1;
|
|
1589
|
-
n.doc.nodesBetween(S, n.doc.content.size, (
|
|
1635
|
+
n.doc.nodesBetween(S, n.doc.content.size, (A, T) => {
|
|
1590
1636
|
if (C > -1)
|
|
1591
1637
|
return !1;
|
|
1592
|
-
|
|
1593
|
-
}), C > -1 && n.setSelection(
|
|
1638
|
+
A.isTextblock && A.content.size === 0 && (C = T + 1);
|
|
1639
|
+
}), C > -1 && n.setSelection($.near(n.doc.resolve(C))), n.scrollIntoView();
|
|
1594
1640
|
}
|
|
1595
1641
|
return !0;
|
|
1596
1642
|
}
|
|
1597
1643
|
const h = c.pos === l.end() ? d.contentMatchAt(0).defaultType : null, f = {
|
|
1598
|
-
...
|
|
1644
|
+
...ct(p, d.type.name, d.attrs),
|
|
1599
1645
|
...t
|
|
1600
1646
|
}, m = {
|
|
1601
|
-
...
|
|
1647
|
+
...ct(p, l.node().type.name, l.node().attrs),
|
|
1602
1648
|
...t
|
|
1603
1649
|
};
|
|
1604
1650
|
n.delete(l.pos, c.pos);
|
|
@@ -1606,7 +1652,7 @@ const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1606
1652
|
{ type: a, attrs: f },
|
|
1607
1653
|
{ type: h, attrs: m }
|
|
1608
1654
|
] : [{ type: a, attrs: f }];
|
|
1609
|
-
if (!
|
|
1655
|
+
if (!at(n.doc, l.pos, 2))
|
|
1610
1656
|
return !1;
|
|
1611
1657
|
if (s) {
|
|
1612
1658
|
const { selection: g, storedMarks: k } = r, { splittableMarks: b } = o.extensionManager, M = k || g.$to.parentOffset && g.$from.marks();
|
|
@@ -1616,8 +1662,8 @@ const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1616
1662
|
n.ensureMarks(w);
|
|
1617
1663
|
}
|
|
1618
1664
|
return !0;
|
|
1619
|
-
},
|
|
1620
|
-
const n =
|
|
1665
|
+
}, xt = (e, t) => {
|
|
1666
|
+
const n = Gt((i) => i.type === t)(e.selection);
|
|
1621
1667
|
if (!n)
|
|
1622
1668
|
return !0;
|
|
1623
1669
|
const r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
|
|
@@ -1625,8 +1671,8 @@ const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1625
1671
|
return !0;
|
|
1626
1672
|
const s = e.doc.nodeAt(r);
|
|
1627
1673
|
return n.node.type === (s == null ? void 0 : s.type) && jt(e.doc, n.pos) && e.join(n.pos), !0;
|
|
1628
|
-
},
|
|
1629
|
-
const n =
|
|
1674
|
+
}, At = (e, t) => {
|
|
1675
|
+
const n = Gt((i) => i.type === t)(e.selection);
|
|
1630
1676
|
if (!n)
|
|
1631
1677
|
return !0;
|
|
1632
1678
|
const r = e.doc.resolve(n.start).after(n.depth);
|
|
@@ -1638,17 +1684,17 @@ const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1638
1684
|
const { extensions: d, splittableMarks: p } = s.extensionManager, h = R(e, i.schema), f = R(t, i.schema), { selection: m, storedMarks: y } = i, { $from: g, $to: k } = m, b = g.blockRange(k), M = y || m.$to.parentOffset && m.$from.marks();
|
|
1639
1685
|
if (!b)
|
|
1640
1686
|
return !1;
|
|
1641
|
-
const w =
|
|
1687
|
+
const w = Gt((S) => ae(S.type.name, d))(m);
|
|
1642
1688
|
if (b.depth >= 1 && w && b.depth - w.depth <= 1) {
|
|
1643
1689
|
if (w.node.type === h)
|
|
1644
1690
|
return c.liftListItem(f);
|
|
1645
|
-
if (
|
|
1646
|
-
return l().command(() => (o.setNodeMarkup(w.pos, h), !0)).command(() =>
|
|
1691
|
+
if (ae(w.node.type.name, d) && h.validContent(w.node.content) && a)
|
|
1692
|
+
return l().command(() => (o.setNodeMarkup(w.pos, h), !0)).command(() => xt(o, h)).command(() => At(o, h)).run();
|
|
1647
1693
|
}
|
|
1648
|
-
return !n || !M || !a ? l().command(() => u().wrapInList(h, r) ? !0 : c.clearNodes()).wrapInList(h, r).command(() =>
|
|
1649
|
-
const S = u().wrapInList(h, r), C = M.filter((
|
|
1694
|
+
return !n || !M || !a ? l().command(() => u().wrapInList(h, r) ? !0 : c.clearNodes()).wrapInList(h, r).command(() => xt(o, h)).command(() => At(o, h)).run() : l().command(() => {
|
|
1695
|
+
const S = u().wrapInList(h, r), C = M.filter((A) => p.includes(A.type.name));
|
|
1650
1696
|
return o.ensureMarks(C), S ? !0 : c.clearNodes();
|
|
1651
|
-
}).wrapInList(h, r).command(() =>
|
|
1697
|
+
}).wrapInList(h, r).command(() => xt(o, h)).command(() => At(o, h)).run();
|
|
1652
1698
|
}, bs = (e, t = {}, n = {}) => ({ state: r, commands: s }) => {
|
|
1653
1699
|
const { extendEmptyMarkRange: o = !1 } = n, i = V(e, r.schema);
|
|
1654
1700
|
return It(r, i, t) ? s.unsetMark(i, { extendEmptyMarkRange: o }) : s.setMark(i, t);
|
|
@@ -1698,7 +1744,7 @@ const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1698
1744
|
n.removeMark(p.$from.pos, p.$to.pos, l);
|
|
1699
1745
|
});
|
|
1700
1746
|
return n.removeStoredMark(l), !0;
|
|
1701
|
-
},
|
|
1747
|
+
}, Es = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1702
1748
|
let o = null, i = null;
|
|
1703
1749
|
const a = St(typeof e == "string" ? e : e.name, r.schema);
|
|
1704
1750
|
return a ? (a === "node" && (o = R(e, r.schema)), a === "mark" && (i = V(e, r.schema)), s && n.selection.ranges.forEach((l) => {
|
|
@@ -1718,14 +1764,14 @@ const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1718
1764
|
});
|
|
1719
1765
|
});
|
|
1720
1766
|
}), !0) : !1;
|
|
1721
|
-
},
|
|
1767
|
+
}, Ts = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1722
1768
|
const s = R(e, n.schema);
|
|
1723
1769
|
return fn(s, t)(n, r);
|
|
1724
1770
|
}, Cs = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1725
1771
|
const s = R(e, n.schema);
|
|
1726
1772
|
return mn(s, t)(n, r);
|
|
1727
1773
|
};
|
|
1728
|
-
var
|
|
1774
|
+
var xs = /* @__PURE__ */ Object.freeze({
|
|
1729
1775
|
__proto__: null,
|
|
1730
1776
|
blur: ar,
|
|
1731
1777
|
clearContent: lr,
|
|
@@ -1743,16 +1789,16 @@ var As = /* @__PURE__ */ Object.freeze({
|
|
|
1743
1789
|
first: Sr,
|
|
1744
1790
|
focus: kr,
|
|
1745
1791
|
forEach: wr,
|
|
1746
|
-
insertContent:
|
|
1747
|
-
insertContentAt:
|
|
1748
|
-
joinBackward:
|
|
1749
|
-
joinDown:
|
|
1750
|
-
joinForward:
|
|
1751
|
-
joinItemBackward:
|
|
1792
|
+
insertContent: Er,
|
|
1793
|
+
insertContentAt: xr,
|
|
1794
|
+
joinBackward: Lr,
|
|
1795
|
+
joinDown: Or,
|
|
1796
|
+
joinForward: _r,
|
|
1797
|
+
joinItemBackward: Hr,
|
|
1752
1798
|
joinItemForward: Rr,
|
|
1753
1799
|
joinTextblockBackward: Pr,
|
|
1754
1800
|
joinTextblockForward: Ir,
|
|
1755
|
-
joinUp:
|
|
1801
|
+
joinUp: Ar,
|
|
1756
1802
|
keyboardShortcut: Dr,
|
|
1757
1803
|
lift: Nr,
|
|
1758
1804
|
liftEmptyBlock: Br,
|
|
@@ -1782,18 +1828,37 @@ var As = /* @__PURE__ */ Object.freeze({
|
|
|
1782
1828
|
undoInputRule: Ss,
|
|
1783
1829
|
unsetAllMarks: ks,
|
|
1784
1830
|
unsetMark: ws,
|
|
1785
|
-
updateAttributes:
|
|
1786
|
-
wrapIn:
|
|
1831
|
+
updateAttributes: Es,
|
|
1832
|
+
wrapIn: Ts,
|
|
1787
1833
|
wrapInList: Cs
|
|
1788
1834
|
});
|
|
1789
|
-
const
|
|
1835
|
+
const As = _.create({
|
|
1790
1836
|
name: "commands",
|
|
1791
1837
|
addCommands() {
|
|
1792
1838
|
return {
|
|
1793
|
-
...
|
|
1839
|
+
...xs
|
|
1794
1840
|
};
|
|
1795
1841
|
}
|
|
1796
|
-
}),
|
|
1842
|
+
}), Os = _.create({
|
|
1843
|
+
name: "drop",
|
|
1844
|
+
addProseMirrorPlugins() {
|
|
1845
|
+
return [
|
|
1846
|
+
new P({
|
|
1847
|
+
key: new I("tiptapDrop"),
|
|
1848
|
+
props: {
|
|
1849
|
+
handleDrop: (e, t, n, r) => {
|
|
1850
|
+
this.editor.emit("drop", {
|
|
1851
|
+
editor: this.editor,
|
|
1852
|
+
event: t,
|
|
1853
|
+
slice: n,
|
|
1854
|
+
moved: r
|
|
1855
|
+
});
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
})
|
|
1859
|
+
];
|
|
1860
|
+
}
|
|
1861
|
+
}), Ls = _.create({
|
|
1797
1862
|
name: "editable",
|
|
1798
1863
|
addProseMirrorPlugins() {
|
|
1799
1864
|
return [
|
|
@@ -1805,7 +1870,7 @@ const xs = H.create({
|
|
|
1805
1870
|
})
|
|
1806
1871
|
];
|
|
1807
1872
|
}
|
|
1808
|
-
}),
|
|
1873
|
+
}), _s = _.create({
|
|
1809
1874
|
name: "focusEvents",
|
|
1810
1875
|
addProseMirrorPlugins() {
|
|
1811
1876
|
const { editor: e } = this;
|
|
@@ -1829,7 +1894,7 @@ const xs = H.create({
|
|
|
1829
1894
|
})
|
|
1830
1895
|
];
|
|
1831
1896
|
}
|
|
1832
|
-
}), Hs =
|
|
1897
|
+
}), Hs = _.create({
|
|
1833
1898
|
name: "keymap",
|
|
1834
1899
|
addKeyboardShortcuts() {
|
|
1835
1900
|
const e = () => this.editor.commands.first(({ commands: i }) => [
|
|
@@ -1874,7 +1939,7 @@ const xs = H.create({
|
|
|
1874
1939
|
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
1875
1940
|
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
1876
1941
|
};
|
|
1877
|
-
return Mt() ||
|
|
1942
|
+
return Mt() || He() ? o : s;
|
|
1878
1943
|
},
|
|
1879
1944
|
addProseMirrorPlugins() {
|
|
1880
1945
|
return [
|
|
@@ -1905,7 +1970,25 @@ const xs = H.create({
|
|
|
1905
1970
|
})
|
|
1906
1971
|
];
|
|
1907
1972
|
}
|
|
1908
|
-
}),
|
|
1973
|
+
}), Rs = _.create({
|
|
1974
|
+
name: "paste",
|
|
1975
|
+
addProseMirrorPlugins() {
|
|
1976
|
+
return [
|
|
1977
|
+
new P({
|
|
1978
|
+
key: new I("tiptapPaste"),
|
|
1979
|
+
props: {
|
|
1980
|
+
handlePaste: (e, t, n) => {
|
|
1981
|
+
this.editor.emit("paste", {
|
|
1982
|
+
editor: this.editor,
|
|
1983
|
+
event: t,
|
|
1984
|
+
slice: n
|
|
1985
|
+
});
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
})
|
|
1989
|
+
];
|
|
1990
|
+
}
|
|
1991
|
+
}), Ps = _.create({
|
|
1909
1992
|
name: "tabindex",
|
|
1910
1993
|
addProseMirrorPlugins() {
|
|
1911
1994
|
return [
|
|
@@ -2038,21 +2121,7 @@ class q {
|
|
|
2038
2121
|
this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name, t).setTextSelection(n.from).run();
|
|
2039
2122
|
}
|
|
2040
2123
|
}
|
|
2041
|
-
const
|
|
2042
|
-
key: new I("tiptapDrop"),
|
|
2043
|
-
props: {
|
|
2044
|
-
handleDrop: (t, n, r, s) => {
|
|
2045
|
-
e(n, r, s);
|
|
2046
|
-
}
|
|
2047
|
-
}
|
|
2048
|
-
}), Ps = (e) => new P({
|
|
2049
|
-
key: new I("tiptapPaste"),
|
|
2050
|
-
props: {
|
|
2051
|
-
handlePaste: (t, n, r) => {
|
|
2052
|
-
e(n, r);
|
|
2053
|
-
}
|
|
2054
|
-
}
|
|
2055
|
-
}), Is = `.ProseMirror {
|
|
2124
|
+
const Is = `.ProseMirror {
|
|
2056
2125
|
position: relative;
|
|
2057
2126
|
}
|
|
2058
2127
|
|
|
@@ -2164,7 +2233,7 @@ class Ds extends Kn {
|
|
|
2164
2233
|
},
|
|
2165
2234
|
onPaste: () => null,
|
|
2166
2235
|
onDrop: () => null
|
|
2167
|
-
}, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.setOptions(t), this.createExtensionManager(), this.createCommandManager(), this.createSchema(), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("contentError", this.options.onContentError), this.createView(), this.injectCSS(), this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", this.options.onFocus), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), this.
|
|
2236
|
+
}, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.setOptions(t), this.createExtensionManager(), this.createCommandManager(), this.createSchema(), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("contentError", this.options.onContentError), this.createView(), this.injectCSS(), this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", this.options.onFocus), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), this.on("drop", ({ event: n, slice: r, moved: s }) => this.options.onDrop(n, r, s)), this.on("paste", ({ event: n, slice: r }) => this.options.onPaste(n, r)), window.setTimeout(() => {
|
|
2168
2237
|
this.isDestroyed || (this.commands.focus(this.options.autofocus), this.emit("create", { editor: this }), this.isInitialized = !0);
|
|
2169
2238
|
}, 0);
|
|
2170
2239
|
}
|
|
@@ -2263,10 +2332,12 @@ class Ds extends Kn {
|
|
|
2263
2332
|
ir.configure({
|
|
2264
2333
|
blockSeparator: (n = (t = this.options.coreExtensionOptions) === null || t === void 0 ? void 0 : t.clipboardTextSerializer) === null || n === void 0 ? void 0 : n.blockSeparator
|
|
2265
2334
|
}),
|
|
2266
|
-
|
|
2267
|
-
|
|
2335
|
+
As,
|
|
2336
|
+
_s,
|
|
2268
2337
|
Hs,
|
|
2269
|
-
|
|
2338
|
+
Ps,
|
|
2339
|
+
Os,
|
|
2340
|
+
Rs
|
|
2270
2341
|
].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));
|
|
2271
2342
|
this.extensionManager = new Q(s, this);
|
|
2272
2343
|
}
|
|
@@ -2302,7 +2373,7 @@ class Ds extends Kn {
|
|
|
2302
2373
|
}
|
|
2303
2374
|
}), t = Pt(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
|
|
2304
2375
|
}
|
|
2305
|
-
const n =
|
|
2376
|
+
const n = Le(t, this.options.autofocus);
|
|
2306
2377
|
this.view = new gn(this.options.element, {
|
|
2307
2378
|
...this.options.editorProps,
|
|
2308
2379
|
dispatchTransaction: this.dispatchTransaction.bind(this),
|
|
@@ -2386,7 +2457,7 @@ class Ds extends Kn {
|
|
|
2386
2457
|
* Get attributes of the currently selected node or mark.
|
|
2387
2458
|
*/
|
|
2388
2459
|
getAttributes(t) {
|
|
2389
|
-
return
|
|
2460
|
+
return Pe(this.state, t);
|
|
2390
2461
|
}
|
|
2391
2462
|
isActive(t, n) {
|
|
2392
2463
|
const r = typeof t == "string" ? t : null, s = typeof t == "string" ? n : t;
|
|
@@ -2437,7 +2508,11 @@ class Ds extends Kn {
|
|
|
2437
2508
|
* Destroy the editor.
|
|
2438
2509
|
*/
|
|
2439
2510
|
destroy() {
|
|
2440
|
-
this.emit("destroy"), this.view
|
|
2511
|
+
if (this.emit("destroy"), this.view) {
|
|
2512
|
+
const t = this.view.dom;
|
|
2513
|
+
t && t.editor && delete t.editor, this.view.destroy();
|
|
2514
|
+
}
|
|
2515
|
+
this.removeAllListeners();
|
|
2441
2516
|
}
|
|
2442
2517
|
/**
|
|
2443
2518
|
* Check if the editor is already destroyed.
|
|
@@ -2466,13 +2541,13 @@ function J(e) {
|
|
|
2466
2541
|
return new bt({
|
|
2467
2542
|
find: e.find,
|
|
2468
2543
|
handler: ({ state: t, range: n, match: r }) => {
|
|
2469
|
-
const s =
|
|
2544
|
+
const s = E(e.getAttributes, void 0, r);
|
|
2470
2545
|
if (s === !1 || s === null)
|
|
2471
2546
|
return null;
|
|
2472
2547
|
const { tr: o } = t, i = r[r.length - 1], a = r[0];
|
|
2473
2548
|
if (i) {
|
|
2474
2549
|
const l = a.search(/\S/), c = n.from + a.indexOf(i), u = c + i.length;
|
|
2475
|
-
if (
|
|
2550
|
+
if (Jt(n.from, n.to, t.doc).filter((h) => h.mark.type.excluded.find((m) => m === e.type && m !== h.mark.type)).filter((h) => h.to > c).length)
|
|
2476
2551
|
return null;
|
|
2477
2552
|
u < n.to && o.delete(u, n.to), c > n.from && o.delete(n.from + l, c);
|
|
2478
2553
|
const p = n.from + l + i.length;
|
|
@@ -2481,11 +2556,11 @@ function J(e) {
|
|
|
2481
2556
|
}
|
|
2482
2557
|
});
|
|
2483
2558
|
}
|
|
2484
|
-
function
|
|
2559
|
+
function $e(e) {
|
|
2485
2560
|
return new bt({
|
|
2486
2561
|
find: e.find,
|
|
2487
2562
|
handler: ({ state: t, range: n, match: r }) => {
|
|
2488
|
-
const s =
|
|
2563
|
+
const s = E(e.getAttributes, void 0, r) || {}, { tr: o } = t, i = n.from;
|
|
2489
2564
|
let a = n.to;
|
|
2490
2565
|
const l = e.type.create(s);
|
|
2491
2566
|
if (r[1]) {
|
|
@@ -2506,7 +2581,7 @@ function $t(e) {
|
|
|
2506
2581
|
return new bt({
|
|
2507
2582
|
find: e.find,
|
|
2508
2583
|
handler: ({ state: t, range: n, match: r }) => {
|
|
2509
|
-
const s = t.doc.resolve(n.from), o =
|
|
2584
|
+
const s = t.doc.resolve(n.from), o = E(e.getAttributes, void 0, r) || {};
|
|
2510
2585
|
if (!s.node(-1).canReplaceWith(s.index(-1), s.indexAfter(-1), e.type))
|
|
2511
2586
|
return null;
|
|
2512
2587
|
t.tr.delete(n.from, n.to).setBlockType(n.from, n.from, e.type, o);
|
|
@@ -2517,7 +2592,7 @@ function tt(e) {
|
|
|
2517
2592
|
return new bt({
|
|
2518
2593
|
find: e.find,
|
|
2519
2594
|
handler: ({ state: t, range: n, match: r, chain: s }) => {
|
|
2520
|
-
const o =
|
|
2595
|
+
const o = E(e.getAttributes, void 0, r) || {}, i = t.tr.delete(n.from, n.to), l = i.doc.resolve(n.from).blockRange(), c = l && We(l, e.type, o);
|
|
2521
2596
|
if (!c)
|
|
2522
2597
|
return null;
|
|
2523
2598
|
if (i.wrap(l, c), e.keepMarks && e.editor) {
|
|
@@ -2536,52 +2611,6 @@ function tt(e) {
|
|
|
2536
2611
|
}
|
|
2537
2612
|
});
|
|
2538
2613
|
}
|
|
2539
|
-
class $ {
|
|
2540
|
-
constructor(t = {}) {
|
|
2541
|
-
this.type = "mark", this.name = "mark", this.parent = null, this.child = null, this.config = {
|
|
2542
|
-
name: this.name,
|
|
2543
|
-
defaultOptions: {}
|
|
2544
|
-
}, this.config = {
|
|
2545
|
-
...this.config,
|
|
2546
|
-
...t
|
|
2547
|
-
}, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = T(v(this, "addOptions", {
|
|
2548
|
-
name: this.name
|
|
2549
|
-
}))), this.storage = T(v(this, "addStorage", {
|
|
2550
|
-
name: this.name,
|
|
2551
|
-
options: this.options
|
|
2552
|
-
})) || {};
|
|
2553
|
-
}
|
|
2554
|
-
static create(t = {}) {
|
|
2555
|
-
return new $(t);
|
|
2556
|
-
}
|
|
2557
|
-
configure(t = {}) {
|
|
2558
|
-
const n = this.extend({
|
|
2559
|
-
...this.config,
|
|
2560
|
-
addOptions: () => vt(this.options, t)
|
|
2561
|
-
});
|
|
2562
|
-
return n.name = this.name, n.parent = this.parent, n;
|
|
2563
|
-
}
|
|
2564
|
-
extend(t = {}) {
|
|
2565
|
-
const n = new $(t);
|
|
2566
|
-
return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = T(v(n, "addOptions", {
|
|
2567
|
-
name: n.name
|
|
2568
|
-
})), n.storage = T(v(n, "addStorage", {
|
|
2569
|
-
name: n.name,
|
|
2570
|
-
options: n.options
|
|
2571
|
-
})), n;
|
|
2572
|
-
}
|
|
2573
|
-
static handleExit({ editor: t, mark: n }) {
|
|
2574
|
-
const { tr: r } = t.state, s = t.state.selection.$from;
|
|
2575
|
-
if (s.pos === s.end()) {
|
|
2576
|
-
const i = s.marks();
|
|
2577
|
-
if (!!!i.find((c) => (c == null ? void 0 : c.type.name) === n.name))
|
|
2578
|
-
return !1;
|
|
2579
|
-
const l = i.find((c) => (c == null ? void 0 : c.type.name) === n.name);
|
|
2580
|
-
return l && r.removeStoredMark(l), r.insertText(" ", s.pos), t.view.dispatch(r), !0;
|
|
2581
|
-
}
|
|
2582
|
-
return !1;
|
|
2583
|
-
}
|
|
2584
|
-
}
|
|
2585
2614
|
class L {
|
|
2586
2615
|
constructor(t = {}) {
|
|
2587
2616
|
this.type = "node", this.name = "node", this.parent = null, this.child = null, this.config = {
|
|
@@ -2590,9 +2619,9 @@ class L {
|
|
|
2590
2619
|
}, this.config = {
|
|
2591
2620
|
...this.config,
|
|
2592
2621
|
...t
|
|
2593
|
-
}, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options =
|
|
2622
|
+
}, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = E(v(this, "addOptions", {
|
|
2594
2623
|
name: this.name
|
|
2595
|
-
}))), this.storage =
|
|
2624
|
+
}))), this.storage = E(v(this, "addStorage", {
|
|
2596
2625
|
name: this.name,
|
|
2597
2626
|
options: this.options
|
|
2598
2627
|
})) || {};
|
|
@@ -2609,9 +2638,9 @@ class L {
|
|
|
2609
2638
|
}
|
|
2610
2639
|
extend(t = {}) {
|
|
2611
2640
|
const n = new L(t);
|
|
2612
|
-
return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options =
|
|
2641
|
+
return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = E(v(n, "addOptions", {
|
|
2613
2642
|
name: n.name
|
|
2614
|
-
})), n.storage =
|
|
2643
|
+
})), n.storage = E(v(n, "addStorage", {
|
|
2615
2644
|
name: n.name,
|
|
2616
2645
|
options: n.options
|
|
2617
2646
|
})), n;
|
|
@@ -2715,17 +2744,17 @@ class Bs {
|
|
|
2715
2744
|
}
|
|
2716
2745
|
}
|
|
2717
2746
|
function z(e) {
|
|
2718
|
-
return new
|
|
2747
|
+
return new tr({
|
|
2719
2748
|
find: e.find,
|
|
2720
2749
|
handler: ({ state: t, range: n, match: r, pasteEvent: s }) => {
|
|
2721
|
-
const o =
|
|
2750
|
+
const o = E(e.getAttributes, void 0, r, s);
|
|
2722
2751
|
if (o === !1 || o === null)
|
|
2723
2752
|
return null;
|
|
2724
2753
|
const { tr: i } = t, a = r[r.length - 1], l = r[0];
|
|
2725
2754
|
let c = n.to;
|
|
2726
2755
|
if (a) {
|
|
2727
2756
|
const u = l.search(/\S/), d = n.from + l.indexOf(a), p = d + a.length;
|
|
2728
|
-
if (
|
|
2757
|
+
if (Jt(n.from, n.to, t.doc).filter((f) => f.mark.type.excluded.find((y) => y === e.type && y !== f.mark.type)).filter((f) => f.to > d).length)
|
|
2729
2758
|
return null;
|
|
2730
2759
|
p < n.to && i.delete(p, n.to), d > n.from && i.delete(n.from + u, d), c = n.from + u + a.length, i.addMark(n.from + u, c, e.type.create(o || {})), i.removeStoredMark(e.type);
|
|
2731
2760
|
}
|
|
@@ -2735,7 +2764,7 @@ function z(e) {
|
|
|
2735
2764
|
function js(e) {
|
|
2736
2765
|
return e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
2737
2766
|
}
|
|
2738
|
-
const Fs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, zs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, Vs = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, Ws = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,
|
|
2767
|
+
const Fs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, zs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, Vs = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, Ws = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, Jo = D.create({
|
|
2739
2768
|
name: "bold",
|
|
2740
2769
|
addOptions() {
|
|
2741
2770
|
return {
|
|
@@ -2758,7 +2787,7 @@ const Fs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, zs = /(?:^|\s
|
|
|
2758
2787
|
];
|
|
2759
2788
|
},
|
|
2760
2789
|
renderHTML({ HTMLAttributes: e }) {
|
|
2761
|
-
return ["strong",
|
|
2790
|
+
return ["strong", x(this.options.HTMLAttributes, e), 0];
|
|
2762
2791
|
},
|
|
2763
2792
|
addCommands() {
|
|
2764
2793
|
return {
|
|
@@ -2843,7 +2872,7 @@ class Ks {
|
|
|
2843
2872
|
}
|
|
2844
2873
|
(p = this.tippy) === null || p === void 0 || p.setProps({
|
|
2845
2874
|
getReferenceClientRect: ((h = this.tippyOptions) === null || h === void 0 ? void 0 : h.getReferenceClientRect) || (() => {
|
|
2846
|
-
if (
|
|
2875
|
+
if (Ie(f.selection)) {
|
|
2847
2876
|
let S = a.nodeDOM(b);
|
|
2848
2877
|
const C = S.dataset.nodeViewWrapper ? S : S.querySelector("[data-node-view-wrapper]");
|
|
2849
2878
|
if (C && (S = C.firstChild), S)
|
|
@@ -2889,11 +2918,11 @@ class Ks {
|
|
|
2889
2918
|
!((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);
|
|
2890
2919
|
}
|
|
2891
2920
|
}
|
|
2892
|
-
const
|
|
2921
|
+
const De = (e) => new P({
|
|
2893
2922
|
key: typeof e.pluginKey == "string" ? new I(e.pluginKey) : e.pluginKey,
|
|
2894
2923
|
view: (t) => new Ks({ view: t, ...e })
|
|
2895
2924
|
});
|
|
2896
|
-
|
|
2925
|
+
_.create({
|
|
2897
2926
|
name: "bubbleMenu",
|
|
2898
2927
|
addOptions() {
|
|
2899
2928
|
return {
|
|
@@ -2906,7 +2935,7 @@ H.create({
|
|
|
2906
2935
|
},
|
|
2907
2936
|
addProseMirrorPlugins() {
|
|
2908
2937
|
return this.options.element ? [
|
|
2909
|
-
|
|
2938
|
+
De({
|
|
2910
2939
|
pluginKey: this.options.pluginKey,
|
|
2911
2940
|
editor: this.editor,
|
|
2912
2941
|
element: this.options.element,
|
|
@@ -2920,7 +2949,7 @@ H.create({
|
|
|
2920
2949
|
function Us(e) {
|
|
2921
2950
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
2922
2951
|
}
|
|
2923
|
-
var Dt = { exports: {} },
|
|
2952
|
+
var Dt = { exports: {} }, Ot = {};
|
|
2924
2953
|
/**
|
|
2925
2954
|
* @license React
|
|
2926
2955
|
* use-sync-external-store-shim.production.min.js
|
|
@@ -2930,10 +2959,10 @@ var Dt = { exports: {} }, Lt = {};
|
|
|
2930
2959
|
* This source code is licensed under the MIT license found in the
|
|
2931
2960
|
* LICENSE file in the root directory of this source tree.
|
|
2932
2961
|
*/
|
|
2933
|
-
var
|
|
2962
|
+
var ce;
|
|
2934
2963
|
function qs() {
|
|
2935
|
-
if (
|
|
2936
|
-
|
|
2964
|
+
if (ce) return Ot;
|
|
2965
|
+
ce = 1;
|
|
2937
2966
|
var e = O;
|
|
2938
2967
|
function t(d, p) {
|
|
2939
2968
|
return d === p && (d !== 0 || 1 / d === 1 / p) || d !== d && p !== p;
|
|
@@ -2963,9 +2992,9 @@ function qs() {
|
|
|
2963
2992
|
return p();
|
|
2964
2993
|
}
|
|
2965
2994
|
var u = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? c : a;
|
|
2966
|
-
return
|
|
2995
|
+
return Ot.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : u, Ot;
|
|
2967
2996
|
}
|
|
2968
|
-
var
|
|
2997
|
+
var Lt = {};
|
|
2969
2998
|
/**
|
|
2970
2999
|
* @license React
|
|
2971
3000
|
* use-sync-external-store-shim.development.js
|
|
@@ -2975,9 +3004,9 @@ var Ot = {};
|
|
|
2975
3004
|
* This source code is licensed under the MIT license found in the
|
|
2976
3005
|
* LICENSE file in the root directory of this source tree.
|
|
2977
3006
|
*/
|
|
2978
|
-
var
|
|
3007
|
+
var de;
|
|
2979
3008
|
function Gs() {
|
|
2980
|
-
return
|
|
3009
|
+
return de || (de = 1, process.env.NODE_ENV !== "production" && function() {
|
|
2981
3010
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
2982
3011
|
var e = O, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
2983
3012
|
function n(b) {
|
|
@@ -2991,10 +3020,10 @@ function Gs() {
|
|
|
2991
3020
|
{
|
|
2992
3021
|
var S = t.ReactDebugCurrentFrame, C = S.getStackAddendum();
|
|
2993
3022
|
C !== "" && (M += "%s", w = w.concat([C]));
|
|
2994
|
-
var
|
|
2995
|
-
return String(
|
|
3023
|
+
var A = w.map(function(T) {
|
|
3024
|
+
return String(T);
|
|
2996
3025
|
});
|
|
2997
|
-
|
|
3026
|
+
A.unshift("Warning: " + M), Function.prototype.apply.call(console[b], console, A);
|
|
2998
3027
|
}
|
|
2999
3028
|
}
|
|
3000
3029
|
function s(b, M) {
|
|
@@ -3008,23 +3037,23 @@ function Gs() {
|
|
|
3008
3037
|
var C = M();
|
|
3009
3038
|
o(S, C) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), d = !0);
|
|
3010
3039
|
}
|
|
3011
|
-
var
|
|
3040
|
+
var A = i({
|
|
3012
3041
|
inst: {
|
|
3013
3042
|
value: S,
|
|
3014
3043
|
getSnapshot: M
|
|
3015
3044
|
}
|
|
3016
|
-
}),
|
|
3045
|
+
}), T = A[0].inst, H = A[1];
|
|
3017
3046
|
return l(function() {
|
|
3018
|
-
|
|
3019
|
-
inst:
|
|
3047
|
+
T.value = S, T.getSnapshot = M, h(T) && H({
|
|
3048
|
+
inst: T
|
|
3020
3049
|
});
|
|
3021
3050
|
}, [b, S, M]), a(function() {
|
|
3022
|
-
h(
|
|
3023
|
-
inst:
|
|
3051
|
+
h(T) && H({
|
|
3052
|
+
inst: T
|
|
3024
3053
|
});
|
|
3025
3054
|
var N = function() {
|
|
3026
|
-
h(
|
|
3027
|
-
inst:
|
|
3055
|
+
h(T) && H({
|
|
3056
|
+
inst: T
|
|
3028
3057
|
});
|
|
3029
3058
|
};
|
|
3030
3059
|
return b(N);
|
|
@@ -3043,8 +3072,8 @@ function Gs() {
|
|
|
3043
3072
|
return M();
|
|
3044
3073
|
}
|
|
3045
3074
|
var m = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", y = !m, g = y ? f : p, k = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : g;
|
|
3046
|
-
|
|
3047
|
-
}()),
|
|
3075
|
+
Lt.useSyncExternalStore = k, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
3076
|
+
}()), Lt;
|
|
3048
3077
|
}
|
|
3049
3078
|
process.env.NODE_ENV === "production" ? Dt.exports = qs() : Dt.exports = Gs();
|
|
3050
3079
|
var wt = Dt.exports;
|
|
@@ -3148,7 +3177,7 @@ const Zs = Fn((e, t) => {
|
|
|
3148
3177
|
innerRef: t,
|
|
3149
3178
|
...e
|
|
3150
3179
|
});
|
|
3151
|
-
}),
|
|
3180
|
+
}), Yo = O.memo(Zs);
|
|
3152
3181
|
var to = function e(t, n) {
|
|
3153
3182
|
if (t === n) return !0;
|
|
3154
3183
|
if (t && n && typeof t == "object" && typeof n == "object") {
|
|
@@ -3194,7 +3223,7 @@ var to = function e(t, n) {
|
|
|
3194
3223
|
return !0;
|
|
3195
3224
|
}
|
|
3196
3225
|
return t !== t && n !== n;
|
|
3197
|
-
}, eo = /* @__PURE__ */ Us(to), Nt = { exports: {} },
|
|
3226
|
+
}, eo = /* @__PURE__ */ Us(to), Nt = { exports: {} }, _t = {};
|
|
3198
3227
|
/**
|
|
3199
3228
|
* @license React
|
|
3200
3229
|
* use-sync-external-store-shim/with-selector.production.min.js
|
|
@@ -3204,16 +3233,16 @@ var to = function e(t, n) {
|
|
|
3204
3233
|
* This source code is licensed under the MIT license found in the
|
|
3205
3234
|
* LICENSE file in the root directory of this source tree.
|
|
3206
3235
|
*/
|
|
3207
|
-
var
|
|
3236
|
+
var ue;
|
|
3208
3237
|
function no() {
|
|
3209
|
-
if (
|
|
3210
|
-
|
|
3238
|
+
if (ue) return _t;
|
|
3239
|
+
ue = 1;
|
|
3211
3240
|
var e = O, t = wt;
|
|
3212
3241
|
function n(c, u) {
|
|
3213
3242
|
return c === u && (c !== 0 || 1 / c === 1 / u) || c !== c && u !== u;
|
|
3214
3243
|
}
|
|
3215
3244
|
var r = typeof Object.is == "function" ? Object.is : n, s = t.useSyncExternalStore, o = e.useRef, i = e.useEffect, a = e.useMemo, l = e.useDebugValue;
|
|
3216
|
-
return
|
|
3245
|
+
return _t.useSyncExternalStoreWithSelector = function(c, u, d, p, h) {
|
|
3217
3246
|
var f = o(null);
|
|
3218
3247
|
if (f.current === null) {
|
|
3219
3248
|
var m = { hasValue: !1, value: null };
|
|
@@ -3229,8 +3258,8 @@ function no() {
|
|
|
3229
3258
|
return M = S;
|
|
3230
3259
|
}
|
|
3231
3260
|
if (C = M, r(b, S)) return C;
|
|
3232
|
-
var
|
|
3233
|
-
return h !== void 0 && h(C,
|
|
3261
|
+
var A = p(S);
|
|
3262
|
+
return h !== void 0 && h(C, A) ? C : (b = S, M = A);
|
|
3234
3263
|
}
|
|
3235
3264
|
var k = !1, b, M, w = d === void 0 ? null : d;
|
|
3236
3265
|
return [function() {
|
|
@@ -3243,9 +3272,9 @@ function no() {
|
|
|
3243
3272
|
return i(function() {
|
|
3244
3273
|
m.hasValue = !0, m.value = y;
|
|
3245
3274
|
}, [y]), l(y), y;
|
|
3246
|
-
},
|
|
3275
|
+
}, _t;
|
|
3247
3276
|
}
|
|
3248
|
-
var
|
|
3277
|
+
var Ht = {};
|
|
3249
3278
|
/**
|
|
3250
3279
|
* @license React
|
|
3251
3280
|
* use-sync-external-store-shim/with-selector.development.js
|
|
@@ -3255,9 +3284,9 @@ var _t = {};
|
|
|
3255
3284
|
* This source code is licensed under the MIT license found in the
|
|
3256
3285
|
* LICENSE file in the root directory of this source tree.
|
|
3257
3286
|
*/
|
|
3258
|
-
var
|
|
3287
|
+
var pe;
|
|
3259
3288
|
function ro() {
|
|
3260
|
-
return
|
|
3289
|
+
return pe || (pe = 1, process.env.NODE_ENV !== "production" && function() {
|
|
3261
3290
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
3262
3291
|
var e = O, t = wt;
|
|
3263
3292
|
function n(u, d) {
|
|
@@ -3271,7 +3300,7 @@ function ro() {
|
|
|
3271
3300
|
value: null
|
|
3272
3301
|
}, m.current = y) : y = m.current;
|
|
3273
3302
|
var g = a(function() {
|
|
3274
|
-
var w = !1, S, C,
|
|
3303
|
+
var w = !1, S, C, A = function(j) {
|
|
3275
3304
|
if (!w) {
|
|
3276
3305
|
w = !0, S = j;
|
|
3277
3306
|
var Y = h(j);
|
|
@@ -3287,19 +3316,19 @@ function ro() {
|
|
|
3287
3316
|
return F;
|
|
3288
3317
|
var U = h(j);
|
|
3289
3318
|
return f !== void 0 && f(F, U) ? F : (S = j, C = U, U);
|
|
3290
|
-
},
|
|
3291
|
-
return
|
|
3292
|
-
}, N =
|
|
3293
|
-
return
|
|
3319
|
+
}, T = p === void 0 ? null : p, H = function() {
|
|
3320
|
+
return A(d());
|
|
3321
|
+
}, N = T === null ? void 0 : function() {
|
|
3322
|
+
return A(T());
|
|
3294
3323
|
};
|
|
3295
|
-
return [
|
|
3324
|
+
return [H, N];
|
|
3296
3325
|
}, [d, p, h, f]), k = g[0], b = g[1], M = s(u, k, b);
|
|
3297
3326
|
return i(function() {
|
|
3298
3327
|
y.hasValue = !0, y.value = M;
|
|
3299
3328
|
}, [M]), l(M), M;
|
|
3300
3329
|
}
|
|
3301
|
-
|
|
3302
|
-
}()),
|
|
3330
|
+
Ht.useSyncExternalStoreWithSelector = c, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
3331
|
+
}()), Ht;
|
|
3303
3332
|
}
|
|
3304
3333
|
process.env.NODE_ENV === "production" ? Nt.exports = no() : Nt.exports = ro();
|
|
3305
3334
|
var so = Nt.exports;
|
|
@@ -3344,9 +3373,9 @@ class oo {
|
|
|
3344
3373
|
function io(e) {
|
|
3345
3374
|
var t;
|
|
3346
3375
|
const [n] = zt(() => new oo(e.editor)), r = so.useSyncExternalStoreWithSelector(n.subscribe, n.getSnapshot, n.getServerSnapshot, e.selector, (t = e.equalityFn) !== null && t !== void 0 ? t : eo);
|
|
3347
|
-
return Vt(() => n.watch(e.editor), [e.editor, n]),
|
|
3376
|
+
return Vt(() => n.watch(e.editor), [e.editor, n]), we(r), r;
|
|
3348
3377
|
}
|
|
3349
|
-
const
|
|
3378
|
+
const he = process.env.NODE_ENV !== "production", Bt = typeof window > "u", ao = Bt || !!(typeof window < "u" && window.next);
|
|
3350
3379
|
class lo {
|
|
3351
3380
|
constructor(t) {
|
|
3352
3381
|
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);
|
|
@@ -3356,8 +3385,8 @@ class lo {
|
|
|
3356
3385
|
}
|
|
3357
3386
|
getInitialEditor() {
|
|
3358
3387
|
if (this.options.current.immediatelyRender === void 0)
|
|
3359
|
-
return Bt || ao ? (
|
|
3360
|
-
if (this.options.current.immediatelyRender && Bt &&
|
|
3388
|
+
return Bt || ao ? (he && console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."), null) : this.createEditor();
|
|
3389
|
+
if (this.options.current.immediatelyRender && Bt && he)
|
|
3361
3390
|
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.");
|
|
3362
3391
|
return this.options.current.immediatelyRender ? this.createEditor() : null;
|
|
3363
3392
|
}
|
|
@@ -3475,20 +3504,20 @@ class lo {
|
|
|
3475
3504
|
}, 1);
|
|
3476
3505
|
}
|
|
3477
3506
|
}
|
|
3478
|
-
function
|
|
3507
|
+
function Xo(e = {}, t = []) {
|
|
3479
3508
|
const n = zn(e);
|
|
3480
3509
|
n.current = e;
|
|
3481
3510
|
const [r] = zt(() => new lo(n)), s = wt.useSyncExternalStore(r.subscribe, r.getEditor, r.getServerSnapshot);
|
|
3482
|
-
return
|
|
3511
|
+
return we(s), Vt(r.onRender(t)), io({
|
|
3483
3512
|
editor: s,
|
|
3484
3513
|
selector: ({ transactionNumber: o }) => e.shouldRerenderOnTransaction === !1 ? null : e.immediatelyRender && o === 0 ? 0 : o + 1
|
|
3485
3514
|
}), s;
|
|
3486
3515
|
}
|
|
3487
|
-
const
|
|
3516
|
+
const Ne = Ee({
|
|
3488
3517
|
editor: null
|
|
3489
3518
|
});
|
|
3490
|
-
|
|
3491
|
-
const co = () =>
|
|
3519
|
+
Ne.Consumer;
|
|
3520
|
+
const co = () => Te(Ne), Qo = (e) => {
|
|
3492
3521
|
const [t, n] = zt(null), { editor: r } = co();
|
|
3493
3522
|
return Vt(() => {
|
|
3494
3523
|
var s;
|
|
@@ -3499,7 +3528,7 @@ const co = () => Ce(Be), ti = (e) => {
|
|
|
3499
3528
|
console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
|
|
3500
3529
|
return;
|
|
3501
3530
|
}
|
|
3502
|
-
const d =
|
|
3531
|
+
const d = De({
|
|
3503
3532
|
updateDelay: l,
|
|
3504
3533
|
editor: u,
|
|
3505
3534
|
element: t,
|
|
@@ -3511,10 +3540,10 @@ const co = () => Ce(Be), ti = (e) => {
|
|
|
3511
3540
|
u.unregisterPlugin(o);
|
|
3512
3541
|
};
|
|
3513
3542
|
}, [e.editor, r, t]), O.createElement("div", { ref: n, className: e.className, style: { visibility: "hidden" } }, e.children);
|
|
3514
|
-
},
|
|
3543
|
+
}, Be = Ee({
|
|
3515
3544
|
onDragStart: void 0
|
|
3516
|
-
}),
|
|
3517
|
-
const t = e.as || "div", { nodeViewContentRef: n } =
|
|
3545
|
+
}), je = () => Te(Be), Zo = (e) => {
|
|
3546
|
+
const t = e.as || "div", { nodeViewContentRef: n } = je();
|
|
3518
3547
|
return (
|
|
3519
3548
|
// @ts-ignore
|
|
3520
3549
|
O.createElement(t, { ...e, ref: n, "data-node-view-content": "", style: {
|
|
@@ -3522,8 +3551,8 @@ const co = () => Ce(Be), ti = (e) => {
|
|
|
3522
3551
|
...e.style
|
|
3523
3552
|
} })
|
|
3524
3553
|
);
|
|
3525
|
-
},
|
|
3526
|
-
const { onDragStart: n } =
|
|
3554
|
+
}, ti = O.forwardRef((e, t) => {
|
|
3555
|
+
const { onDragStart: n } = je(), r = e.as || "div";
|
|
3527
3556
|
return (
|
|
3528
3557
|
// @ts-ignore
|
|
3529
3558
|
O.createElement(r, { ...e, ref: t, "data-node-view-wrapper": "", onDragStart: n, style: {
|
|
@@ -3609,7 +3638,7 @@ class fo extends Bs {
|
|
|
3609
3638
|
}
|
|
3610
3639
|
const s = { onDragStart: this.onDragStart.bind(this), nodeViewContentRef: (c) => {
|
|
3611
3640
|
c && this.contentDOMElement && c.firstChild !== this.contentDOMElement && c.appendChild(this.contentDOMElement);
|
|
3612
|
-
} }, o = this.component, i = O.memo((c) => O.createElement(
|
|
3641
|
+
} }, o = this.component, i = O.memo((c) => O.createElement(Be.Provider, { value: s }, O.createElement(o, c)));
|
|
3613
3642
|
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");
|
|
3614
3643
|
let a = this.node.isInline ? "span" : "div";
|
|
3615
3644
|
this.options.as && (a = this.options.as);
|
|
@@ -3711,7 +3740,7 @@ class fo extends Bs {
|
|
|
3711
3740
|
if (this.options.attrs) {
|
|
3712
3741
|
let t = {};
|
|
3713
3742
|
if (typeof this.options.attrs == "function") {
|
|
3714
|
-
const n = this.editor.extensionManager.attributes, r =
|
|
3743
|
+
const n = this.editor.extensionManager.attributes, r = ut(this.node, n);
|
|
3715
3744
|
t = this.options.attrs({ node: this.node, HTMLAttributes: r });
|
|
3716
3745
|
} else
|
|
3717
3746
|
t = this.options.attrs;
|
|
@@ -3719,10 +3748,10 @@ class fo extends Bs {
|
|
|
3719
3748
|
}
|
|
3720
3749
|
}
|
|
3721
3750
|
}
|
|
3722
|
-
function
|
|
3751
|
+
function ei(e, t) {
|
|
3723
3752
|
return (n) => n.editor.contentComponent ? new fo(e, n, t) : {};
|
|
3724
3753
|
}
|
|
3725
|
-
const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, yo = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, bo = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,
|
|
3754
|
+
const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, yo = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, bo = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, ni = D.create({
|
|
3726
3755
|
name: "italic",
|
|
3727
3756
|
addOptions() {
|
|
3728
3757
|
return {
|
|
@@ -3744,7 +3773,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
3744
3773
|
];
|
|
3745
3774
|
},
|
|
3746
3775
|
renderHTML({ HTMLAttributes: e }) {
|
|
3747
|
-
return ["em",
|
|
3776
|
+
return ["em", x(this.options.HTMLAttributes, e), 0];
|
|
3748
3777
|
},
|
|
3749
3778
|
addCommands() {
|
|
3750
3779
|
return {
|
|
@@ -3783,7 +3812,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
3783
3812
|
})
|
|
3784
3813
|
];
|
|
3785
3814
|
}
|
|
3786
|
-
}),
|
|
3815
|
+
}), ri = D.create({
|
|
3787
3816
|
name: "underline",
|
|
3788
3817
|
addOptions() {
|
|
3789
3818
|
return {
|
|
@@ -3803,7 +3832,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
3803
3832
|
];
|
|
3804
3833
|
},
|
|
3805
3834
|
renderHTML({ HTMLAttributes: e }) {
|
|
3806
|
-
return ["u",
|
|
3835
|
+
return ["u", x(this.options.HTMLAttributes, e), 0];
|
|
3807
3836
|
},
|
|
3808
3837
|
addCommands() {
|
|
3809
3838
|
return {
|
|
@@ -3818,7 +3847,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
3818
3847
|
"Mod-U": () => this.editor.commands.toggleUnderline()
|
|
3819
3848
|
};
|
|
3820
3849
|
}
|
|
3821
|
-
}), vo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, Mo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,
|
|
3850
|
+
}), vo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, Mo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, si = D.create({
|
|
3822
3851
|
name: "strike",
|
|
3823
3852
|
addOptions() {
|
|
3824
3853
|
return {
|
|
@@ -3844,7 +3873,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
3844
3873
|
];
|
|
3845
3874
|
},
|
|
3846
3875
|
renderHTML({ HTMLAttributes: e }) {
|
|
3847
|
-
return ["s",
|
|
3876
|
+
return ["s", x(this.options.HTMLAttributes, e), 0];
|
|
3848
3877
|
},
|
|
3849
3878
|
addCommands() {
|
|
3850
3879
|
return {
|
|
@@ -3874,7 +3903,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
3874
3903
|
})
|
|
3875
3904
|
];
|
|
3876
3905
|
}
|
|
3877
|
-
}), So = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/, ko = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g,
|
|
3906
|
+
}), So = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/, ko = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g, oi = D.create({
|
|
3878
3907
|
name: "code",
|
|
3879
3908
|
addOptions() {
|
|
3880
3909
|
return {
|
|
@@ -3890,7 +3919,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
3890
3919
|
];
|
|
3891
3920
|
},
|
|
3892
3921
|
renderHTML({ HTMLAttributes: e }) {
|
|
3893
|
-
return ["code",
|
|
3922
|
+
return ["code", x(this.options.HTMLAttributes, e), 0];
|
|
3894
3923
|
},
|
|
3895
3924
|
addCommands() {
|
|
3896
3925
|
return {
|
|
@@ -3920,7 +3949,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
3920
3949
|
})
|
|
3921
3950
|
];
|
|
3922
3951
|
}
|
|
3923
|
-
}), wo = /^```([a-z]+)?[\s\n]$/,
|
|
3952
|
+
}), wo = /^```([a-z]+)?[\s\n]$/, Eo = /^~~~([a-z]+)?[\s\n]$/, ii = L.create({
|
|
3924
3953
|
name: "codeBlock",
|
|
3925
3954
|
addOptions() {
|
|
3926
3955
|
return {
|
|
@@ -3960,7 +3989,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
3960
3989
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
3961
3990
|
return [
|
|
3962
3991
|
"pre",
|
|
3963
|
-
|
|
3992
|
+
x(this.options.HTMLAttributes, t),
|
|
3964
3993
|
[
|
|
3965
3994
|
"code",
|
|
3966
3995
|
{
|
|
@@ -4018,7 +4047,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4018
4047
|
})
|
|
4019
4048
|
}),
|
|
4020
4049
|
$t({
|
|
4021
|
-
find:
|
|
4050
|
+
find: Eo,
|
|
4022
4051
|
type: this.type,
|
|
4023
4052
|
getAttributes: (e) => ({
|
|
4024
4053
|
language: e[1]
|
|
@@ -4041,13 +4070,13 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4041
4070
|
return !1;
|
|
4042
4071
|
const { tr: i, schema: a } = e.state, l = a.text(n.replace(/\r\n?/g, `
|
|
4043
4072
|
`));
|
|
4044
|
-
return i.replaceSelectionWith(this.type.create({ language: o }, l)), i.selection.$from.parent.type !== this.type && i.setSelection(
|
|
4073
|
+
return i.replaceSelectionWith(this.type.create({ language: o }, l)), i.selection.$from.parent.type !== this.type && i.setSelection($.near(i.doc.resolve(Math.max(0, i.selection.from - 2)))), i.setMeta("paste", !0), e.dispatch(i), !0;
|
|
4045
4074
|
}
|
|
4046
4075
|
}
|
|
4047
4076
|
})
|
|
4048
4077
|
];
|
|
4049
4078
|
}
|
|
4050
|
-
}),
|
|
4079
|
+
}), ft = D.create({
|
|
4051
4080
|
name: "textStyle",
|
|
4052
4081
|
priority: 101,
|
|
4053
4082
|
addOptions() {
|
|
@@ -4064,17 +4093,17 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4064
4093
|
];
|
|
4065
4094
|
},
|
|
4066
4095
|
renderHTML({ HTMLAttributes: e }) {
|
|
4067
|
-
return ["span",
|
|
4096
|
+
return ["span", x(this.options.HTMLAttributes, e), 0];
|
|
4068
4097
|
},
|
|
4069
4098
|
addCommands() {
|
|
4070
4099
|
return {
|
|
4071
4100
|
removeEmptyTextStyle: () => ({ state: e, commands: t }) => {
|
|
4072
|
-
const n =
|
|
4101
|
+
const n = qt(e, this.type);
|
|
4073
4102
|
return Object.entries(n).some(([, s]) => !!s) ? !0 : t.unsetMark(this.name);
|
|
4074
4103
|
}
|
|
4075
4104
|
};
|
|
4076
4105
|
}
|
|
4077
|
-
}),
|
|
4106
|
+
}), ai = _.create({
|
|
4078
4107
|
name: "fontFamily",
|
|
4079
4108
|
addOptions() {
|
|
4080
4109
|
return {
|
|
@@ -4106,7 +4135,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4106
4135
|
unsetFontFamily: () => ({ chain: e }) => e().setMark("textStyle", { fontFamily: null }).removeEmptyTextStyle().run()
|
|
4107
4136
|
};
|
|
4108
4137
|
}
|
|
4109
|
-
}),
|
|
4138
|
+
}), li = L.create({
|
|
4110
4139
|
name: "heading",
|
|
4111
4140
|
addOptions() {
|
|
4112
4141
|
return {
|
|
@@ -4132,7 +4161,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4132
4161
|
}));
|
|
4133
4162
|
},
|
|
4134
4163
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
4135
|
-
return [`h${this.options.levels.includes(e.attrs.level) ? e.attrs.level : this.options.levels[0]}`,
|
|
4164
|
+
return [`h${this.options.levels.includes(e.attrs.level) ? e.attrs.level : this.options.levels[0]}`, x(this.options.HTMLAttributes, t), 0];
|
|
4136
4165
|
},
|
|
4137
4166
|
addCommands() {
|
|
4138
4167
|
return {
|
|
@@ -4155,7 +4184,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4155
4184
|
}
|
|
4156
4185
|
}));
|
|
4157
4186
|
}
|
|
4158
|
-
}),
|
|
4187
|
+
}), ci = _.create({
|
|
4159
4188
|
name: "textAlign",
|
|
4160
4189
|
addOptions() {
|
|
4161
4190
|
return {
|
|
@@ -4195,7 +4224,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4195
4224
|
"Mod-Shift-j": () => this.editor.commands.setTextAlign("justify")
|
|
4196
4225
|
};
|
|
4197
4226
|
}
|
|
4198
|
-
}),
|
|
4227
|
+
}), di = _.create({
|
|
4199
4228
|
name: "color",
|
|
4200
4229
|
addOptions() {
|
|
4201
4230
|
return {
|
|
@@ -4227,7 +4256,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4227
4256
|
unsetColor: () => ({ chain: e }) => e().setMark("textStyle", { color: null }).removeEmptyTextStyle().run()
|
|
4228
4257
|
};
|
|
4229
4258
|
}
|
|
4230
|
-
}),
|
|
4259
|
+
}), To = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, Co = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, ui = D.create({
|
|
4231
4260
|
name: "highlight",
|
|
4232
4261
|
addOptions() {
|
|
4233
4262
|
return {
|
|
@@ -4255,7 +4284,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4255
4284
|
];
|
|
4256
4285
|
},
|
|
4257
4286
|
renderHTML({ HTMLAttributes: e }) {
|
|
4258
|
-
return ["mark",
|
|
4287
|
+
return ["mark", x(this.options.HTMLAttributes, e), 0];
|
|
4259
4288
|
},
|
|
4260
4289
|
addCommands() {
|
|
4261
4290
|
return {
|
|
@@ -4272,7 +4301,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4272
4301
|
addInputRules() {
|
|
4273
4302
|
return [
|
|
4274
4303
|
J({
|
|
4275
|
-
find:
|
|
4304
|
+
find: To,
|
|
4276
4305
|
type: this.type
|
|
4277
4306
|
})
|
|
4278
4307
|
];
|
|
@@ -4285,7 +4314,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4285
4314
|
})
|
|
4286
4315
|
];
|
|
4287
4316
|
}
|
|
4288
|
-
}),
|
|
4317
|
+
}), Fe = L.create({
|
|
4289
4318
|
name: "listItem",
|
|
4290
4319
|
addOptions() {
|
|
4291
4320
|
return {
|
|
@@ -4304,7 +4333,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4304
4333
|
];
|
|
4305
4334
|
},
|
|
4306
4335
|
renderHTML({ HTMLAttributes: e }) {
|
|
4307
|
-
return ["li",
|
|
4336
|
+
return ["li", x(this.options.HTMLAttributes, e), 0];
|
|
4308
4337
|
},
|
|
4309
4338
|
addKeyboardShortcuts() {
|
|
4310
4339
|
return {
|
|
@@ -4313,34 +4342,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4313
4342
|
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
4314
4343
|
};
|
|
4315
4344
|
}
|
|
4316
|
-
}),
|
|
4317
|
-
name: "textStyle",
|
|
4318
|
-
priority: 101,
|
|
4319
|
-
addOptions() {
|
|
4320
|
-
return {
|
|
4321
|
-
HTMLAttributes: {}
|
|
4322
|
-
};
|
|
4323
|
-
},
|
|
4324
|
-
parseHTML() {
|
|
4325
|
-
return [
|
|
4326
|
-
{
|
|
4327
|
-
tag: "span",
|
|
4328
|
-
getAttrs: (e) => e.hasAttribute("style") ? {} : !1
|
|
4329
|
-
}
|
|
4330
|
-
];
|
|
4331
|
-
},
|
|
4332
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
4333
|
-
return ["span", A(this.options.HTMLAttributes, e), 0];
|
|
4334
|
-
},
|
|
4335
|
-
addCommands() {
|
|
4336
|
-
return {
|
|
4337
|
-
removeEmptyTextStyle: () => ({ state: e, commands: t }) => {
|
|
4338
|
-
const n = rt(e, this.type);
|
|
4339
|
-
return Object.entries(n).some(([, s]) => !!s) ? !0 : t.unsetMark(this.name);
|
|
4340
|
-
}
|
|
4341
|
-
};
|
|
4342
|
-
}
|
|
4343
|
-
}), fe = /^\s*([-+*])\s$/, mi = L.create({
|
|
4345
|
+
}), fe = /^\s*([-+*])\s$/, pi = L.create({
|
|
4344
4346
|
name: "bulletList",
|
|
4345
4347
|
addOptions() {
|
|
4346
4348
|
return {
|
|
@@ -4360,11 +4362,11 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4360
4362
|
];
|
|
4361
4363
|
},
|
|
4362
4364
|
renderHTML({ HTMLAttributes: e }) {
|
|
4363
|
-
return ["ul",
|
|
4365
|
+
return ["ul", x(this.options.HTMLAttributes, e), 0];
|
|
4364
4366
|
},
|
|
4365
4367
|
addCommands() {
|
|
4366
4368
|
return {
|
|
4367
|
-
toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
4369
|
+
toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Fe.name, this.editor.getAttributes(ft.name)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
4368
4370
|
};
|
|
4369
4371
|
},
|
|
4370
4372
|
addKeyboardShortcuts() {
|
|
@@ -4382,68 +4384,13 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4382
4384
|
type: this.type,
|
|
4383
4385
|
keepMarks: this.options.keepMarks,
|
|
4384
4386
|
keepAttributes: this.options.keepAttributes,
|
|
4385
|
-
getAttributes: () => this.editor.getAttributes(
|
|
4387
|
+
getAttributes: () => this.editor.getAttributes(ft.name),
|
|
4386
4388
|
editor: this.editor
|
|
4387
4389
|
})), [
|
|
4388
4390
|
e
|
|
4389
4391
|
];
|
|
4390
4392
|
}
|
|
4391
|
-
}),
|
|
4392
|
-
name: "listItem",
|
|
4393
|
-
addOptions() {
|
|
4394
|
-
return {
|
|
4395
|
-
HTMLAttributes: {},
|
|
4396
|
-
bulletListTypeName: "bulletList",
|
|
4397
|
-
orderedListTypeName: "orderedList"
|
|
4398
|
-
};
|
|
4399
|
-
},
|
|
4400
|
-
content: "paragraph block*",
|
|
4401
|
-
defining: !0,
|
|
4402
|
-
parseHTML() {
|
|
4403
|
-
return [
|
|
4404
|
-
{
|
|
4405
|
-
tag: "li"
|
|
4406
|
-
}
|
|
4407
|
-
];
|
|
4408
|
-
},
|
|
4409
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
4410
|
-
return ["li", A(this.options.HTMLAttributes, e), 0];
|
|
4411
|
-
},
|
|
4412
|
-
addKeyboardShortcuts() {
|
|
4413
|
-
return {
|
|
4414
|
-
Enter: () => this.editor.commands.splitListItem(this.name),
|
|
4415
|
-
Tab: () => this.editor.commands.sinkListItem(this.name),
|
|
4416
|
-
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
4417
|
-
};
|
|
4418
|
-
}
|
|
4419
|
-
}), me = $.create({
|
|
4420
|
-
name: "textStyle",
|
|
4421
|
-
priority: 101,
|
|
4422
|
-
addOptions() {
|
|
4423
|
-
return {
|
|
4424
|
-
HTMLAttributes: {}
|
|
4425
|
-
};
|
|
4426
|
-
},
|
|
4427
|
-
parseHTML() {
|
|
4428
|
-
return [
|
|
4429
|
-
{
|
|
4430
|
-
tag: "span",
|
|
4431
|
-
getAttrs: (e) => e.hasAttribute("style") ? {} : !1
|
|
4432
|
-
}
|
|
4433
|
-
];
|
|
4434
|
-
},
|
|
4435
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
4436
|
-
return ["span", A(this.options.HTMLAttributes, e), 0];
|
|
4437
|
-
},
|
|
4438
|
-
addCommands() {
|
|
4439
|
-
return {
|
|
4440
|
-
removeEmptyTextStyle: () => ({ state: e, commands: t }) => {
|
|
4441
|
-
const n = rt(e, this.type);
|
|
4442
|
-
return Object.entries(n).some(([, s]) => !!s) ? !0 : t.unsetMark(this.name);
|
|
4443
|
-
}
|
|
4444
|
-
};
|
|
4445
|
-
}
|
|
4446
|
-
}), ge = /^(\d+)\.\s$/, gi = L.create({
|
|
4393
|
+
}), me = /^(\d+)\.\s$/, hi = L.create({
|
|
4447
4394
|
name: "orderedList",
|
|
4448
4395
|
addOptions() {
|
|
4449
4396
|
return {
|
|
@@ -4478,11 +4425,11 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4478
4425
|
},
|
|
4479
4426
|
renderHTML({ HTMLAttributes: e }) {
|
|
4480
4427
|
const { start: t, ...n } = e;
|
|
4481
|
-
return t === 1 ? ["ol",
|
|
4428
|
+
return t === 1 ? ["ol", x(this.options.HTMLAttributes, n), 0] : ["ol", x(this.options.HTMLAttributes, e), 0];
|
|
4482
4429
|
},
|
|
4483
4430
|
addCommands() {
|
|
4484
4431
|
return {
|
|
4485
|
-
toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
4432
|
+
toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Fe.name, this.editor.getAttributes(ft.name)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
4486
4433
|
};
|
|
4487
4434
|
},
|
|
4488
4435
|
addKeyboardShortcuts() {
|
|
@@ -4492,24 +4439,24 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4492
4439
|
},
|
|
4493
4440
|
addInputRules() {
|
|
4494
4441
|
let e = tt({
|
|
4495
|
-
find:
|
|
4442
|
+
find: me,
|
|
4496
4443
|
type: this.type,
|
|
4497
4444
|
getAttributes: (t) => ({ start: +t[1] }),
|
|
4498
4445
|
joinPredicate: (t, n) => n.childCount + n.attrs.start === +t[1]
|
|
4499
4446
|
});
|
|
4500
4447
|
return (this.options.keepMarks || this.options.keepAttributes) && (e = tt({
|
|
4501
|
-
find:
|
|
4448
|
+
find: me,
|
|
4502
4449
|
type: this.type,
|
|
4503
4450
|
keepMarks: this.options.keepMarks,
|
|
4504
4451
|
keepAttributes: this.options.keepAttributes,
|
|
4505
|
-
getAttributes: (t) => ({ start: +t[1], ...this.editor.getAttributes(
|
|
4452
|
+
getAttributes: (t) => ({ start: +t[1], ...this.editor.getAttributes(ft.name) }),
|
|
4506
4453
|
joinPredicate: (t, n) => n.childCount + n.attrs.start === +t[1],
|
|
4507
4454
|
editor: this.editor
|
|
4508
4455
|
})), [
|
|
4509
4456
|
e
|
|
4510
4457
|
];
|
|
4511
4458
|
}
|
|
4512
|
-
}),
|
|
4459
|
+
}), xo = /^\s*(\[([( |x])?\])\s$/, fi = L.create({
|
|
4513
4460
|
name: "taskItem",
|
|
4514
4461
|
addOptions() {
|
|
4515
4462
|
return {
|
|
@@ -4548,7 +4495,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4548
4495
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
4549
4496
|
return [
|
|
4550
4497
|
"li",
|
|
4551
|
-
|
|
4498
|
+
x(this.options.HTMLAttributes, t, {
|
|
4552
4499
|
"data-type": this.name
|
|
4553
4500
|
}),
|
|
4554
4501
|
[
|
|
@@ -4608,7 +4555,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4608
4555
|
addInputRules() {
|
|
4609
4556
|
return [
|
|
4610
4557
|
tt({
|
|
4611
|
-
find:
|
|
4558
|
+
find: xo,
|
|
4612
4559
|
type: this.type,
|
|
4613
4560
|
getAttributes: (e) => ({
|
|
4614
4561
|
checked: e[e.length - 1] === "x"
|
|
@@ -4616,7 +4563,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4616
4563
|
})
|
|
4617
4564
|
];
|
|
4618
4565
|
}
|
|
4619
|
-
}),
|
|
4566
|
+
}), mi = L.create({
|
|
4620
4567
|
name: "taskList",
|
|
4621
4568
|
addOptions() {
|
|
4622
4569
|
return {
|
|
@@ -4637,7 +4584,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4637
4584
|
];
|
|
4638
4585
|
},
|
|
4639
4586
|
renderHTML({ HTMLAttributes: e }) {
|
|
4640
|
-
return ["ul",
|
|
4587
|
+
return ["ul", x(this.options.HTMLAttributes, e, { "data-type": this.name }), 0];
|
|
4641
4588
|
},
|
|
4642
4589
|
addCommands() {
|
|
4643
4590
|
return {
|
|
@@ -4649,7 +4596,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4649
4596
|
"Mod-Shift-9": () => this.editor.commands.toggleTaskList()
|
|
4650
4597
|
};
|
|
4651
4598
|
}
|
|
4652
|
-
}),
|
|
4599
|
+
}), Ao = /^\s*>\s$/, gi = L.create({
|
|
4653
4600
|
name: "blockquote",
|
|
4654
4601
|
addOptions() {
|
|
4655
4602
|
return {
|
|
@@ -4665,7 +4612,7 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4665
4612
|
];
|
|
4666
4613
|
},
|
|
4667
4614
|
renderHTML({ HTMLAttributes: e }) {
|
|
4668
|
-
return ["blockquote",
|
|
4615
|
+
return ["blockquote", x(this.options.HTMLAttributes, e), 0];
|
|
4669
4616
|
},
|
|
4670
4617
|
addCommands() {
|
|
4671
4618
|
return {
|
|
@@ -4682,16 +4629,16 @@ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\
|
|
|
4682
4629
|
addInputRules() {
|
|
4683
4630
|
return [
|
|
4684
4631
|
tt({
|
|
4685
|
-
find:
|
|
4632
|
+
find: Ao,
|
|
4686
4633
|
type: this.type
|
|
4687
4634
|
})
|
|
4688
4635
|
];
|
|
4689
4636
|
}
|
|
4690
4637
|
});
|
|
4691
|
-
function
|
|
4638
|
+
function Oo(e) {
|
|
4692
4639
|
return e.length === 1 ? e[0].isLink : e.length === 3 && e[1].isLink ? ["()", "[]"].includes(e[0].value + e[2].value) : !1;
|
|
4693
4640
|
}
|
|
4694
|
-
function
|
|
4641
|
+
function Lo(e) {
|
|
4695
4642
|
return new P({
|
|
4696
4643
|
key: new I("autolink"),
|
|
4697
4644
|
appendTransaction: (t, n, r) => {
|
|
@@ -4710,14 +4657,14 @@ function _o(e) {
|
|
|
4710
4657
|
if (!f)
|
|
4711
4658
|
return !1;
|
|
4712
4659
|
const y = kn(f).map((g) => g.toObject(e.defaultProtocol));
|
|
4713
|
-
if (!
|
|
4660
|
+
if (!Oo(y))
|
|
4714
4661
|
return !1;
|
|
4715
4662
|
y.filter((g) => g.isLink).map((g) => ({
|
|
4716
4663
|
...g,
|
|
4717
4664
|
from: m + g.start + 1,
|
|
4718
4665
|
to: m + g.end + 1
|
|
4719
4666
|
})).filter((g) => r.schema.marks.code ? !r.doc.rangeHasMark(g.from, g.to, r.schema.marks.code) : !0).filter((g) => e.validate(g.value)).forEach((g) => {
|
|
4720
|
-
|
|
4667
|
+
Jt(g.from, g.to, r.doc).some((k) => k.mark.type === e.type) || i.addMark(g.from, g.to, e.type.create({
|
|
4721
4668
|
href: g.href
|
|
4722
4669
|
}));
|
|
4723
4670
|
});
|
|
@@ -4727,7 +4674,7 @@ function _o(e) {
|
|
|
4727
4674
|
}
|
|
4728
4675
|
});
|
|
4729
4676
|
}
|
|
4730
|
-
function
|
|
4677
|
+
function _o(e) {
|
|
4731
4678
|
return new P({
|
|
4732
4679
|
key: new I("handleClickLink"),
|
|
4733
4680
|
props: {
|
|
@@ -4741,13 +4688,13 @@ function Ro(e) {
|
|
|
4741
4688
|
a.push(i), i = i.parentNode;
|
|
4742
4689
|
if (!a.find((p) => p.nodeName === "A"))
|
|
4743
4690
|
return !1;
|
|
4744
|
-
const l =
|
|
4691
|
+
const l = Pe(t.state, e.type.name), c = r.target, u = (s = c == null ? void 0 : c.href) !== null && s !== void 0 ? s : l.href, d = (o = c == null ? void 0 : c.target) !== null && o !== void 0 ? o : l.target;
|
|
4745
4692
|
return c && u ? (window.open(u, d), !0) : !1;
|
|
4746
4693
|
}
|
|
4747
4694
|
}
|
|
4748
4695
|
});
|
|
4749
4696
|
}
|
|
4750
|
-
function
|
|
4697
|
+
function Ho(e) {
|
|
4751
4698
|
return new P({
|
|
4752
4699
|
key: new I("handlePasteLink"),
|
|
4753
4700
|
props: {
|
|
@@ -4759,7 +4706,7 @@ function Po(e) {
|
|
|
4759
4706
|
r.content.forEach((c) => {
|
|
4760
4707
|
a += c.textContent;
|
|
4761
4708
|
});
|
|
4762
|
-
const l =
|
|
4709
|
+
const l = Se(a, { defaultProtocol: e.defaultProtocol }).find((c) => c.isLink && c.value === a);
|
|
4763
4710
|
return !a || !l ? !1 : (e.editor.commands.setMark(e.type, {
|
|
4764
4711
|
href: l.href
|
|
4765
4712
|
}), !0);
|
|
@@ -4767,15 +4714,15 @@ function Po(e) {
|
|
|
4767
4714
|
}
|
|
4768
4715
|
});
|
|
4769
4716
|
}
|
|
4770
|
-
const
|
|
4771
|
-
function
|
|
4717
|
+
const Ro = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;
|
|
4718
|
+
function ge(e, t) {
|
|
4772
4719
|
const n = ["http", "https", "ftp", "ftps", "mailto", "tel", "callto", "sms", "cid", "xmpp"];
|
|
4773
4720
|
return t && t.forEach((r) => {
|
|
4774
4721
|
const s = typeof r == "string" ? r : r.scheme;
|
|
4775
4722
|
s && n.push(s);
|
|
4776
|
-
}), !e || e.replace(
|
|
4723
|
+
}), !e || e.replace(Ro, "").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`, "i"));
|
|
4777
4724
|
}
|
|
4778
|
-
const
|
|
4725
|
+
const yi = D.create({
|
|
4779
4726
|
name: "link",
|
|
4780
4727
|
priority: 1e3,
|
|
4781
4728
|
keepOnSplit: !1,
|
|
@@ -4783,10 +4730,10 @@ const Mi = $.create({
|
|
|
4783
4730
|
onCreate() {
|
|
4784
4731
|
this.options.protocols.forEach((e) => {
|
|
4785
4732
|
if (typeof e == "string") {
|
|
4786
|
-
|
|
4733
|
+
Qt(e);
|
|
4787
4734
|
return;
|
|
4788
4735
|
}
|
|
4789
|
-
|
|
4736
|
+
Qt(e.scheme, e.optionalSlashes);
|
|
4790
4737
|
});
|
|
4791
4738
|
},
|
|
4792
4739
|
onDestroy() {
|
|
@@ -4834,12 +4781,12 @@ const Mi = $.create({
|
|
|
4834
4781
|
tag: "a[href]",
|
|
4835
4782
|
getAttrs: (e) => {
|
|
4836
4783
|
const t = e.getAttribute("href");
|
|
4837
|
-
return !t || !
|
|
4784
|
+
return !t || !ge(t, this.options.protocols) ? !1 : null;
|
|
4838
4785
|
}
|
|
4839
4786
|
}];
|
|
4840
4787
|
},
|
|
4841
4788
|
renderHTML({ HTMLAttributes: e }) {
|
|
4842
|
-
return
|
|
4789
|
+
return ge(e.href, this.options.protocols) ? ["a", x(this.options.HTMLAttributes, e), 0] : ["a", x(this.options.HTMLAttributes, { ...e, href: "" }), 0];
|
|
4843
4790
|
},
|
|
4844
4791
|
addCommands() {
|
|
4845
4792
|
return {
|
|
@@ -4854,7 +4801,7 @@ const Mi = $.create({
|
|
|
4854
4801
|
find: (e) => {
|
|
4855
4802
|
const t = [];
|
|
4856
4803
|
if (e) {
|
|
4857
|
-
const { validate: n } = this.options, r =
|
|
4804
|
+
const { validate: n } = this.options, r = Se(e).filter((s) => s.isLink && n(s.value));
|
|
4858
4805
|
r.length && r.forEach((s) => t.push({
|
|
4859
4806
|
text: s.value,
|
|
4860
4807
|
data: {
|
|
@@ -4877,19 +4824,19 @@ const Mi = $.create({
|
|
|
4877
4824
|
},
|
|
4878
4825
|
addProseMirrorPlugins() {
|
|
4879
4826
|
const e = [];
|
|
4880
|
-
return this.options.autolink && e.push(
|
|
4827
|
+
return this.options.autolink && e.push(Lo({
|
|
4881
4828
|
type: this.type,
|
|
4882
4829
|
defaultProtocol: this.options.defaultProtocol,
|
|
4883
4830
|
validate: this.options.validate
|
|
4884
|
-
})), this.options.openOnClick === !0 && e.push(
|
|
4831
|
+
})), this.options.openOnClick === !0 && e.push(_o({
|
|
4885
4832
|
type: this.type
|
|
4886
|
-
})), this.options.linkOnPaste && e.push(
|
|
4833
|
+
})), this.options.linkOnPaste && e.push(Ho({
|
|
4887
4834
|
editor: this.editor,
|
|
4888
4835
|
defaultProtocol: this.options.defaultProtocol,
|
|
4889
4836
|
type: this.type
|
|
4890
4837
|
})), e;
|
|
4891
4838
|
}
|
|
4892
|
-
}),
|
|
4839
|
+
}), bi = L.create({
|
|
4893
4840
|
name: "horizontalRule",
|
|
4894
4841
|
addOptions() {
|
|
4895
4842
|
return {
|
|
@@ -4901,7 +4848,7 @@ const Mi = $.create({
|
|
|
4901
4848
|
return [{ tag: "hr" }];
|
|
4902
4849
|
},
|
|
4903
4850
|
renderHTML({ HTMLAttributes: e }) {
|
|
4904
|
-
return ["hr",
|
|
4851
|
+
return ["hr", x(this.options.HTMLAttributes, e)];
|
|
4905
4852
|
},
|
|
4906
4853
|
addCommands() {
|
|
4907
4854
|
return {
|
|
@@ -4912,17 +4859,17 @@ const Mi = $.create({
|
|
|
4912
4859
|
to: s.pos
|
|
4913
4860
|
}, {
|
|
4914
4861
|
type: this.name
|
|
4915
|
-
}) :
|
|
4862
|
+
}) : Ie(n) ? o.insertContentAt(s.pos, {
|
|
4916
4863
|
type: this.name
|
|
4917
4864
|
}) : o.insertContent({ type: this.name }), o.command(({ tr: i, dispatch: a }) => {
|
|
4918
4865
|
var l;
|
|
4919
4866
|
if (a) {
|
|
4920
4867
|
const { $to: c } = i.selection, u = c.end();
|
|
4921
4868
|
if (c.nodeAfter)
|
|
4922
|
-
c.nodeAfter.isTextblock ? i.setSelection(
|
|
4869
|
+
c.nodeAfter.isTextblock ? i.setSelection($.create(i.doc, c.pos + 1)) : c.nodeAfter.isBlock ? i.setSelection(Z.create(i.doc, c.pos)) : i.setSelection($.create(i.doc, c.pos));
|
|
4923
4870
|
else {
|
|
4924
4871
|
const d = (l = c.parent.type.contentMatch.defaultType) === null || l === void 0 ? void 0 : l.create();
|
|
4925
|
-
d && (i.insert(u, d), i.setSelection(
|
|
4872
|
+
d && (i.insert(u, d), i.setSelection($.create(i.doc, u + 1)));
|
|
4926
4873
|
}
|
|
4927
4874
|
i.scrollIntoView();
|
|
4928
4875
|
}
|
|
@@ -4933,13 +4880,13 @@ const Mi = $.create({
|
|
|
4933
4880
|
},
|
|
4934
4881
|
addInputRules() {
|
|
4935
4882
|
return [
|
|
4936
|
-
|
|
4883
|
+
$e({
|
|
4937
4884
|
find: /^(?:---|—-|___\s|\*\*\*\s)$/,
|
|
4938
4885
|
type: this.type
|
|
4939
4886
|
})
|
|
4940
4887
|
];
|
|
4941
4888
|
}
|
|
4942
|
-
}),
|
|
4889
|
+
}), vi = _.create({
|
|
4943
4890
|
name: "history",
|
|
4944
4891
|
addOptions() {
|
|
4945
4892
|
return {
|
|
@@ -4949,8 +4896,8 @@ const Mi = $.create({
|
|
|
4949
4896
|
},
|
|
4950
4897
|
addCommands() {
|
|
4951
4898
|
return {
|
|
4952
|
-
undo: () => ({ state: e, dispatch: t }) =>
|
|
4953
|
-
redo: () => ({ state: e, dispatch: t }) =>
|
|
4899
|
+
undo: () => ({ state: e, dispatch: t }) => En(e, t),
|
|
4900
|
+
redo: () => ({ state: e, dispatch: t }) => Tn(e, t)
|
|
4954
4901
|
};
|
|
4955
4902
|
},
|
|
4956
4903
|
addProseMirrorPlugins() {
|
|
@@ -4968,12 +4915,14 @@ const Mi = $.create({
|
|
|
4968
4915
|
"Shift-Mod-я": () => this.editor.commands.redo()
|
|
4969
4916
|
};
|
|
4970
4917
|
}
|
|
4971
|
-
}),
|
|
4918
|
+
}), Mi = _.create({
|
|
4972
4919
|
name: "characterCount",
|
|
4973
4920
|
addOptions() {
|
|
4974
4921
|
return {
|
|
4975
4922
|
limit: null,
|
|
4976
|
-
mode: "textSize"
|
|
4923
|
+
mode: "textSize",
|
|
4924
|
+
textCounter: (e) => e.length,
|
|
4925
|
+
wordCounter: (e) => e.split(" ").filter((t) => t !== "").length
|
|
4977
4926
|
};
|
|
4978
4927
|
},
|
|
4979
4928
|
addStorage() {
|
|
@@ -4985,10 +4934,14 @@ const Mi = $.create({
|
|
|
4985
4934
|
onBeforeCreate() {
|
|
4986
4935
|
this.storage.characters = (e) => {
|
|
4987
4936
|
const t = (e == null ? void 0 : e.node) || this.editor.state.doc;
|
|
4988
|
-
|
|
4937
|
+
if (((e == null ? void 0 : e.mode) || this.options.mode) === "textSize") {
|
|
4938
|
+
const r = t.textBetween(0, t.content.size, void 0, " ");
|
|
4939
|
+
return this.options.textCounter(r);
|
|
4940
|
+
}
|
|
4941
|
+
return t.nodeSize;
|
|
4989
4942
|
}, this.storage.words = (e) => {
|
|
4990
|
-
const t = (e == null ? void 0 : e.node) || this.editor.state.doc;
|
|
4991
|
-
return
|
|
4943
|
+
const t = (e == null ? void 0 : e.node) || this.editor.state.doc, n = t.textBetween(0, t.content.size, " ", " ");
|
|
4944
|
+
return this.options.wordCounter(n);
|
|
4992
4945
|
};
|
|
4993
4946
|
},
|
|
4994
4947
|
addProseMirrorPlugins() {
|
|
@@ -5010,7 +4963,7 @@ const Mi = $.create({
|
|
|
5010
4963
|
})
|
|
5011
4964
|
];
|
|
5012
4965
|
}
|
|
5013
|
-
}),
|
|
4966
|
+
}), Si = _.create({
|
|
5014
4967
|
name: "dropCursor",
|
|
5015
4968
|
addOptions() {
|
|
5016
4969
|
return {
|
|
@@ -5021,10 +4974,10 @@ const Mi = $.create({
|
|
|
5021
4974
|
},
|
|
5022
4975
|
addProseMirrorPlugins() {
|
|
5023
4976
|
return [
|
|
5024
|
-
|
|
4977
|
+
xn(this.options)
|
|
5025
4978
|
];
|
|
5026
4979
|
}
|
|
5027
|
-
}),
|
|
4980
|
+
}), ki = _.create({
|
|
5028
4981
|
name: "focus",
|
|
5029
4982
|
addOptions() {
|
|
5030
4983
|
return {
|
|
@@ -5040,7 +4993,7 @@ const Mi = $.create({
|
|
|
5040
4993
|
decorations: ({ doc: e, selection: t }) => {
|
|
5041
4994
|
const { isEditable: n, isFocused: r } = this.editor, { anchor: s } = t, o = [];
|
|
5042
4995
|
if (!n || !r)
|
|
5043
|
-
return
|
|
4996
|
+
return dt.create(e, []);
|
|
5044
4997
|
let i = 0;
|
|
5045
4998
|
this.options.mode === "deepest" && e.descendants((l, c) => {
|
|
5046
4999
|
if (l.isText)
|
|
@@ -5058,17 +5011,17 @@ const Mi = $.create({
|
|
|
5058
5011
|
o.push(Ft.node(c, c + l.nodeSize, {
|
|
5059
5012
|
class: this.options.className
|
|
5060
5013
|
}));
|
|
5061
|
-
}),
|
|
5014
|
+
}), dt.create(e, o);
|
|
5062
5015
|
}
|
|
5063
5016
|
}
|
|
5064
5017
|
})
|
|
5065
5018
|
];
|
|
5066
5019
|
}
|
|
5067
|
-
}),
|
|
5020
|
+
}), wi = _.create({
|
|
5068
5021
|
name: "gapCursor",
|
|
5069
5022
|
addProseMirrorPlugins() {
|
|
5070
5023
|
return [
|
|
5071
|
-
|
|
5024
|
+
An()
|
|
5072
5025
|
];
|
|
5073
5026
|
},
|
|
5074
5027
|
extendNodeSchema(e) {
|
|
@@ -5079,10 +5032,10 @@ const Mi = $.create({
|
|
|
5079
5032
|
storage: e.storage
|
|
5080
5033
|
};
|
|
5081
5034
|
return {
|
|
5082
|
-
allowGapCursor: (t =
|
|
5035
|
+
allowGapCursor: (t = E(v(e, "allowGapCursor", n))) !== null && t !== void 0 ? t : null
|
|
5083
5036
|
};
|
|
5084
5037
|
}
|
|
5085
|
-
}),
|
|
5038
|
+
}), Ei = L.create({
|
|
5086
5039
|
name: "hardBreak",
|
|
5087
5040
|
addOptions() {
|
|
5088
5041
|
return {
|
|
@@ -5099,7 +5052,7 @@ const Mi = $.create({
|
|
|
5099
5052
|
];
|
|
5100
5053
|
},
|
|
5101
5054
|
renderHTML({ HTMLAttributes: e }) {
|
|
5102
|
-
return ["br",
|
|
5055
|
+
return ["br", x(this.options.HTMLAttributes, e)];
|
|
5103
5056
|
},
|
|
5104
5057
|
renderText() {
|
|
5105
5058
|
return `
|
|
@@ -5131,35 +5084,7 @@ const Mi = $.create({
|
|
|
5131
5084
|
"Shift-Enter": () => this.editor.commands.setHardBreak()
|
|
5132
5085
|
};
|
|
5133
5086
|
}
|
|
5134
|
-
}),
|
|
5135
|
-
name: "listItem",
|
|
5136
|
-
addOptions() {
|
|
5137
|
-
return {
|
|
5138
|
-
HTMLAttributes: {},
|
|
5139
|
-
bulletListTypeName: "bulletList",
|
|
5140
|
-
orderedListTypeName: "orderedList"
|
|
5141
|
-
};
|
|
5142
|
-
},
|
|
5143
|
-
content: "paragraph block*",
|
|
5144
|
-
defining: !0,
|
|
5145
|
-
parseHTML() {
|
|
5146
|
-
return [
|
|
5147
|
-
{
|
|
5148
|
-
tag: "li"
|
|
5149
|
-
}
|
|
5150
|
-
];
|
|
5151
|
-
},
|
|
5152
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
5153
|
-
return ["li", A(this.options.HTMLAttributes, e), 0];
|
|
5154
|
-
},
|
|
5155
|
-
addKeyboardShortcuts() {
|
|
5156
|
-
return {
|
|
5157
|
-
Enter: () => this.editor.commands.splitListItem(this.name),
|
|
5158
|
-
Tab: () => this.editor.commands.sinkListItem(this.name),
|
|
5159
|
-
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
5160
|
-
};
|
|
5161
|
-
}
|
|
5162
|
-
}), Li = L.create({
|
|
5087
|
+
}), Ti = L.create({
|
|
5163
5088
|
name: "paragraph",
|
|
5164
5089
|
priority: 1e3,
|
|
5165
5090
|
addOptions() {
|
|
@@ -5175,7 +5100,7 @@ const Mi = $.create({
|
|
|
5175
5100
|
];
|
|
5176
5101
|
},
|
|
5177
5102
|
renderHTML({ HTMLAttributes: e }) {
|
|
5178
|
-
return ["p",
|
|
5103
|
+
return ["p", x(this.options.HTMLAttributes, e), 0];
|
|
5179
5104
|
},
|
|
5180
5105
|
addCommands() {
|
|
5181
5106
|
return {
|
|
@@ -5187,7 +5112,7 @@ const Mi = $.create({
|
|
|
5187
5112
|
"Mod-Alt-0": () => this.editor.commands.setParagraph()
|
|
5188
5113
|
};
|
|
5189
5114
|
}
|
|
5190
|
-
}),
|
|
5115
|
+
}), Ci = _.create({
|
|
5191
5116
|
name: "placeholder",
|
|
5192
5117
|
addOptions() {
|
|
5193
5118
|
return {
|
|
@@ -5226,20 +5151,20 @@ const Mi = $.create({
|
|
|
5226
5151
|
s.push(d);
|
|
5227
5152
|
}
|
|
5228
5153
|
return this.options.includeChildren;
|
|
5229
|
-
}),
|
|
5154
|
+
}), dt.create(e, s);
|
|
5230
5155
|
}
|
|
5231
5156
|
}
|
|
5232
5157
|
})
|
|
5233
5158
|
];
|
|
5234
5159
|
}
|
|
5235
|
-
}),
|
|
5160
|
+
}), xi = L.create({
|
|
5236
5161
|
name: "text",
|
|
5237
5162
|
group: "inline"
|
|
5238
|
-
}),
|
|
5163
|
+
}), Ai = L.create({
|
|
5239
5164
|
name: "doc",
|
|
5240
5165
|
topNode: !0,
|
|
5241
5166
|
content: "block+"
|
|
5242
|
-
}),
|
|
5167
|
+
}), Oi = D.create({
|
|
5243
5168
|
name: "subscript",
|
|
5244
5169
|
addOptions() {
|
|
5245
5170
|
return {
|
|
@@ -5260,7 +5185,7 @@ const Mi = $.create({
|
|
|
5260
5185
|
];
|
|
5261
5186
|
},
|
|
5262
5187
|
renderHTML({ HTMLAttributes: e }) {
|
|
5263
|
-
return ["sub",
|
|
5188
|
+
return ["sub", x(this.options.HTMLAttributes, e), 0];
|
|
5264
5189
|
},
|
|
5265
5190
|
addCommands() {
|
|
5266
5191
|
return {
|
|
@@ -5274,7 +5199,7 @@ const Mi = $.create({
|
|
|
5274
5199
|
"Mod-,": () => this.editor.commands.toggleSubscript()
|
|
5275
5200
|
};
|
|
5276
5201
|
}
|
|
5277
|
-
}),
|
|
5202
|
+
}), Li = D.create({
|
|
5278
5203
|
name: "superscript",
|
|
5279
5204
|
addOptions() {
|
|
5280
5205
|
return {
|
|
@@ -5295,7 +5220,7 @@ const Mi = $.create({
|
|
|
5295
5220
|
];
|
|
5296
5221
|
},
|
|
5297
5222
|
renderHTML({ HTMLAttributes: e }) {
|
|
5298
|
-
return ["sup",
|
|
5223
|
+
return ["sup", x(this.options.HTMLAttributes, e), 0];
|
|
5299
5224
|
},
|
|
5300
5225
|
addCommands() {
|
|
5301
5226
|
return {
|
|
@@ -5310,7 +5235,7 @@ const Mi = $.create({
|
|
|
5310
5235
|
};
|
|
5311
5236
|
}
|
|
5312
5237
|
});
|
|
5313
|
-
function
|
|
5238
|
+
function Po(e) {
|
|
5314
5239
|
var t;
|
|
5315
5240
|
const { char: n, allowSpaces: r, allowedPrefixes: s, startOfLine: o, $position: i } = e, a = js(n), l = new RegExp(`\\s${a}$`), c = o ? "^" : "", u = r ? new RegExp(`${c}${a}.*?(?=\\s${a}|$)`, "gm") : new RegExp(`${c}(?:^)?${a}[^\\s${a}]*`, "gm"), d = ((t = i.nodeBefore) === null || t === void 0 ? void 0 : t.isText) && i.nodeBefore.text;
|
|
5316
5241
|
if (!d)
|
|
@@ -5332,19 +5257,19 @@ function $o(e) {
|
|
|
5332
5257
|
text: h[0]
|
|
5333
5258
|
} : null;
|
|
5334
5259
|
}
|
|
5335
|
-
const
|
|
5336
|
-
function
|
|
5260
|
+
const Io = new I("suggestion");
|
|
5261
|
+
function $o({ pluginKey: e = Io, editor: t, char: n = "@", allowSpaces: r = !1, allowedPrefixes: s = [" "], startOfLine: o = !1, decorationTag: i = "span", decorationClass: a = "suggestion", command: l = () => null, items: c = () => [], render: u = () => ({}), allow: d = () => !0, findSuggestionMatch: p = Po }) {
|
|
5337
5262
|
let h;
|
|
5338
5263
|
const f = u == null ? void 0 : u(), m = new P({
|
|
5339
5264
|
key: e,
|
|
5340
5265
|
view() {
|
|
5341
5266
|
return {
|
|
5342
5267
|
update: async (y, g) => {
|
|
5343
|
-
var k, b, M, w, S, C,
|
|
5344
|
-
const
|
|
5268
|
+
var k, b, M, w, S, C, A;
|
|
5269
|
+
const T = (k = this.key) === null || k === void 0 ? void 0 : k.getState(g), H = (b = this.key) === null || b === void 0 ? void 0 : b.getState(y.state), N = T.active && H.active && T.range.from !== H.range.from, j = !T.active && H.active, Y = T.active && !H.active, W = !j && !Y && T.query !== H.query, K = j || N && W, F = W || N, U = Y || N && W;
|
|
5345
5270
|
if (!K && !F && !U)
|
|
5346
5271
|
return;
|
|
5347
|
-
const X = U && !K ?
|
|
5272
|
+
const X = U && !K ? T : H, Yt = y.dom.querySelector(`[data-decoration-id="${X.decorationId}"]`);
|
|
5348
5273
|
h = {
|
|
5349
5274
|
editor: t,
|
|
5350
5275
|
range: X.range,
|
|
@@ -5356,18 +5281,18 @@ function No({ pluginKey: e = Do, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5356
5281
|
range: X.range,
|
|
5357
5282
|
props: et
|
|
5358
5283
|
}),
|
|
5359
|
-
decorationNode:
|
|
5284
|
+
decorationNode: Yt,
|
|
5360
5285
|
// virtual node for popper.js or tippy.js
|
|
5361
5286
|
// this can be used for building popups without a DOM node
|
|
5362
|
-
clientRect:
|
|
5287
|
+
clientRect: Yt ? () => {
|
|
5363
5288
|
var et;
|
|
5364
|
-
const { decorationId: ze } = (et = this.key) === null || et === void 0 ? void 0 : et.getState(t.state),
|
|
5365
|
-
return (
|
|
5289
|
+
const { decorationId: ze } = (et = this.key) === null || et === void 0 ? void 0 : et.getState(t.state), Et = y.dom.querySelector(`[data-decoration-id="${ze}"]`);
|
|
5290
|
+
return (Et == null ? void 0 : Et.getBoundingClientRect()) || null;
|
|
5366
5291
|
} : null
|
|
5367
5292
|
}, K && ((M = f == null ? void 0 : f.onBeforeStart) === null || M === void 0 || M.call(f, h)), F && ((w = f == null ? void 0 : f.onBeforeUpdate) === null || w === void 0 || w.call(f, h)), (F || K) && (h.items = await c({
|
|
5368
5293
|
editor: t,
|
|
5369
5294
|
query: X.query
|
|
5370
|
-
})), U && ((S = f == null ? void 0 : f.onExit) === null || S === void 0 || S.call(f, h)), F && ((C = f == null ? void 0 : f.onUpdate) === null || C === void 0 || C.call(f, h)), K && ((
|
|
5295
|
+
})), U && ((S = f == null ? void 0 : f.onExit) === null || S === void 0 || S.call(f, h)), F && ((C = f == null ? void 0 : f.onUpdate) === null || C === void 0 || C.call(f, h)), K && ((A = f == null ? void 0 : f.onStart) === null || A === void 0 || A.call(f, h));
|
|
5371
5296
|
},
|
|
5372
5297
|
destroy: () => {
|
|
5373
5298
|
var y;
|
|
@@ -5391,25 +5316,25 @@ function No({ pluginKey: e = Do, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5391
5316
|
},
|
|
5392
5317
|
// Apply changes to the plugin state from a view transaction.
|
|
5393
5318
|
apply(y, g, k, b) {
|
|
5394
|
-
const { isEditable: M } = t, { composing: w } = t.view, { selection: S } = y, { empty: C, from:
|
|
5395
|
-
if (
|
|
5396
|
-
(
|
|
5397
|
-
const
|
|
5319
|
+
const { isEditable: M } = t, { composing: w } = t.view, { selection: S } = y, { empty: C, from: A } = S, T = { ...g };
|
|
5320
|
+
if (T.composing = w, M && (C || t.view.composing)) {
|
|
5321
|
+
(A < g.range.from || A > g.range.to) && !w && !g.composing && (T.active = !1);
|
|
5322
|
+
const H = p({
|
|
5398
5323
|
char: n,
|
|
5399
5324
|
allowSpaces: r,
|
|
5400
5325
|
allowedPrefixes: s,
|
|
5401
5326
|
startOfLine: o,
|
|
5402
5327
|
$position: S.$from
|
|
5403
5328
|
}), N = `id_${Math.floor(Math.random() * 4294967295)}`;
|
|
5404
|
-
|
|
5329
|
+
H && d({
|
|
5405
5330
|
editor: t,
|
|
5406
5331
|
state: b,
|
|
5407
|
-
range:
|
|
5332
|
+
range: H.range,
|
|
5408
5333
|
isActive: g.active
|
|
5409
|
-
}) ? (
|
|
5334
|
+
}) ? (T.active = !0, T.decorationId = g.decorationId ? g.decorationId : N, T.range = H.range, T.query = H.query, T.text = H.text) : T.active = !1;
|
|
5410
5335
|
} else
|
|
5411
|
-
|
|
5412
|
-
return
|
|
5336
|
+
T.active = !1;
|
|
5337
|
+
return T.active || (T.decorationId = null, T.range = { from: 0, to: 0 }, T.query = null, T.text = null), T;
|
|
5413
5338
|
}
|
|
5414
5339
|
},
|
|
5415
5340
|
props: {
|
|
@@ -5422,7 +5347,7 @@ function No({ pluginKey: e = Do, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5422
5347
|
// Setup decorator on the currently active suggestion.
|
|
5423
5348
|
decorations(y) {
|
|
5424
5349
|
const { active: g, range: k, decorationId: b } = m.getState(y);
|
|
5425
|
-
return g ?
|
|
5350
|
+
return g ? dt.create(y.doc, [
|
|
5426
5351
|
Ft.inline(k.from, k.to, {
|
|
5427
5352
|
nodeName: i,
|
|
5428
5353
|
class: a,
|
|
@@ -5434,7 +5359,7 @@ function No({ pluginKey: e = Do, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5434
5359
|
});
|
|
5435
5360
|
return m;
|
|
5436
5361
|
}
|
|
5437
|
-
const
|
|
5362
|
+
const Do = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, _i = L.create({
|
|
5438
5363
|
name: "image",
|
|
5439
5364
|
addOptions() {
|
|
5440
5365
|
return {
|
|
@@ -5471,7 +5396,7 @@ const Bo = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Ii = L.cr
|
|
|
5471
5396
|
];
|
|
5472
5397
|
},
|
|
5473
5398
|
renderHTML({ HTMLAttributes: e }) {
|
|
5474
|
-
return ["img",
|
|
5399
|
+
return ["img", x(this.options.HTMLAttributes, e)];
|
|
5475
5400
|
},
|
|
5476
5401
|
addCommands() {
|
|
5477
5402
|
return {
|
|
@@ -5483,8 +5408,8 @@ const Bo = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Ii = L.cr
|
|
|
5483
5408
|
},
|
|
5484
5409
|
addInputRules() {
|
|
5485
5410
|
return [
|
|
5486
|
-
|
|
5487
|
-
find:
|
|
5411
|
+
$e({
|
|
5412
|
+
find: Do,
|
|
5488
5413
|
type: this.type,
|
|
5489
5414
|
getAttributes: (e) => {
|
|
5490
5415
|
const [, , t, n, r] = e;
|
|
@@ -5493,7 +5418,7 @@ const Bo = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Ii = L.cr
|
|
|
5493
5418
|
})
|
|
5494
5419
|
];
|
|
5495
5420
|
}
|
|
5496
|
-
}),
|
|
5421
|
+
}), Hi = L.create({
|
|
5497
5422
|
name: "tableRow",
|
|
5498
5423
|
addOptions() {
|
|
5499
5424
|
return {
|
|
@@ -5508,10 +5433,10 @@ const Bo = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Ii = L.cr
|
|
|
5508
5433
|
];
|
|
5509
5434
|
},
|
|
5510
5435
|
renderHTML({ HTMLAttributes: e }) {
|
|
5511
|
-
return ["tr",
|
|
5436
|
+
return ["tr", x(this.options.HTMLAttributes, e), 0];
|
|
5512
5437
|
}
|
|
5513
5438
|
});
|
|
5514
|
-
function
|
|
5439
|
+
function ye(e, t, n, r, s, o) {
|
|
5515
5440
|
let i = 0, a = !0, l = t.firstChild;
|
|
5516
5441
|
const c = e.firstChild;
|
|
5517
5442
|
for (let u = 0, d = 0; u < c.childCount; u += 1) {
|
|
@@ -5527,18 +5452,18 @@ function be(e, t, n, r, s, o) {
|
|
|
5527
5452
|
}
|
|
5528
5453
|
a ? (n.style.width = `${i}px`, n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = `${i}px`);
|
|
5529
5454
|
}
|
|
5530
|
-
class
|
|
5455
|
+
class No {
|
|
5531
5456
|
constructor(t, n) {
|
|
5532
|
-
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")),
|
|
5457
|
+
this.node = t, this.cellMinWidth = n, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.colgroup = this.table.appendChild(document.createElement("colgroup")), ye(t, this.colgroup, this.table, n), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
5533
5458
|
}
|
|
5534
5459
|
update(t) {
|
|
5535
|
-
return t.type !== this.node.type ? !1 : (this.node = t,
|
|
5460
|
+
return t.type !== this.node.type ? !1 : (this.node = t, ye(t, this.colgroup, this.table, this.cellMinWidth), !0);
|
|
5536
5461
|
}
|
|
5537
5462
|
ignoreMutation(t) {
|
|
5538
5463
|
return t.type === "attributes" && (t.target === this.table || this.colgroup.contains(t.target));
|
|
5539
5464
|
}
|
|
5540
5465
|
}
|
|
5541
|
-
function
|
|
5466
|
+
function Bo(e, t, n, r) {
|
|
5542
5467
|
let s = 0, o = !0;
|
|
5543
5468
|
const i = [], a = e.firstChild;
|
|
5544
5469
|
if (!a)
|
|
@@ -5553,10 +5478,10 @@ function Fo(e, t, n, r) {
|
|
|
5553
5478
|
const l = o ? `${s}px` : "", c = o ? "" : `${s}px`;
|
|
5554
5479
|
return { colgroup: ["colgroup", {}, ...i], tableWidth: l, tableMinWidth: c };
|
|
5555
5480
|
}
|
|
5556
|
-
function
|
|
5481
|
+
function be(e, t) {
|
|
5557
5482
|
return e.createAndFill();
|
|
5558
5483
|
}
|
|
5559
|
-
function
|
|
5484
|
+
function jo(e) {
|
|
5560
5485
|
if (e.cached.tableNodeTypes)
|
|
5561
5486
|
return e.cached.tableNodeTypes;
|
|
5562
5487
|
const t = {};
|
|
@@ -5565,12 +5490,12 @@ function zo(e) {
|
|
|
5565
5490
|
r.spec.tableRole && (t[r.spec.tableRole] = r);
|
|
5566
5491
|
}), e.cached.tableNodeTypes = t, t;
|
|
5567
5492
|
}
|
|
5568
|
-
function
|
|
5569
|
-
const o =
|
|
5493
|
+
function Fo(e, t, n, r, s) {
|
|
5494
|
+
const o = jo(e), i = [], a = [];
|
|
5570
5495
|
for (let c = 0; c < n; c += 1) {
|
|
5571
|
-
const u =
|
|
5496
|
+
const u = be(o.cell);
|
|
5572
5497
|
if (u && a.push(u), r) {
|
|
5573
|
-
const d =
|
|
5498
|
+
const d = be(o.header_cell);
|
|
5574
5499
|
d && i.push(d);
|
|
5575
5500
|
}
|
|
5576
5501
|
}
|
|
@@ -5579,21 +5504,21 @@ function Vo(e, t, n, r, s) {
|
|
|
5579
5504
|
l.push(o.row.createChecked(null, r && c === 0 ? i : a));
|
|
5580
5505
|
return o.table.createChecked(null, l);
|
|
5581
5506
|
}
|
|
5582
|
-
function
|
|
5583
|
-
return e instanceof
|
|
5507
|
+
function zo(e) {
|
|
5508
|
+
return e instanceof ke;
|
|
5584
5509
|
}
|
|
5585
|
-
const
|
|
5510
|
+
const it = ({ editor: e }) => {
|
|
5586
5511
|
const { selection: t } = e.state;
|
|
5587
|
-
if (!
|
|
5512
|
+
if (!zo(t))
|
|
5588
5513
|
return !1;
|
|
5589
5514
|
let n = 0;
|
|
5590
|
-
const r =
|
|
5515
|
+
const r = Re(t.ranges[0].$from, (o) => o.type.name === "table");
|
|
5591
5516
|
return r == null || r.node.descendants((o) => {
|
|
5592
5517
|
if (o.type.name === "table")
|
|
5593
5518
|
return !1;
|
|
5594
5519
|
["tableCell", "tableHeader"].includes(o.type.name) && (n += 1);
|
|
5595
5520
|
}), n === t.ranges.length ? (e.commands.deleteTable(), !0) : !1;
|
|
5596
|
-
},
|
|
5521
|
+
}, Ri = L.create({
|
|
5597
5522
|
name: "table",
|
|
5598
5523
|
// @ts-ignore
|
|
5599
5524
|
addOptions() {
|
|
@@ -5603,7 +5528,7 @@ const at = ({ editor: e }) => {
|
|
|
5603
5528
|
handleWidth: 5,
|
|
5604
5529
|
cellMinWidth: 25,
|
|
5605
5530
|
// TODO: fix
|
|
5606
|
-
View:
|
|
5531
|
+
View: No,
|
|
5607
5532
|
lastColumnResizable: !0,
|
|
5608
5533
|
allowTableNodeSelection: !1
|
|
5609
5534
|
};
|
|
@@ -5616,10 +5541,10 @@ const at = ({ editor: e }) => {
|
|
|
5616
5541
|
return [{ tag: "table" }];
|
|
5617
5542
|
},
|
|
5618
5543
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
5619
|
-
const { colgroup: n, tableWidth: r, tableMinWidth: s } =
|
|
5544
|
+
const { colgroup: n, tableWidth: r, tableMinWidth: s } = Bo(e, this.options.cellMinWidth);
|
|
5620
5545
|
return [
|
|
5621
5546
|
"table",
|
|
5622
|
-
|
|
5547
|
+
x(this.options.HTMLAttributes, t, {
|
|
5623
5548
|
style: r ? `width: ${r}` : `min-width: ${s}`
|
|
5624
5549
|
}),
|
|
5625
5550
|
n,
|
|
@@ -5629,33 +5554,33 @@ const at = ({ editor: e }) => {
|
|
|
5629
5554
|
addCommands() {
|
|
5630
5555
|
return {
|
|
5631
5556
|
insertTable: ({ rows: e = 3, cols: t = 3, withHeaderRow: n = !0 } = {}) => ({ tr: r, dispatch: s, editor: o }) => {
|
|
5632
|
-
const i =
|
|
5557
|
+
const i = Fo(o.schema, e, t, n);
|
|
5633
5558
|
if (s) {
|
|
5634
5559
|
const a = r.selection.from + 1;
|
|
5635
|
-
r.replaceSelectionWith(i).scrollIntoView().setSelection(
|
|
5560
|
+
r.replaceSelectionWith(i).scrollIntoView().setSelection($.near(r.doc.resolve(a)));
|
|
5636
5561
|
}
|
|
5637
5562
|
return !0;
|
|
5638
5563
|
},
|
|
5639
|
-
addColumnBefore: () => ({ state: e, dispatch: t }) =>
|
|
5640
|
-
addColumnAfter: () => ({ state: e, dispatch: t }) =>
|
|
5641
|
-
deleteColumn: () => ({ state: e, dispatch: t }) =>
|
|
5642
|
-
addRowBefore: () => ({ state: e, dispatch: t }) =>
|
|
5564
|
+
addColumnBefore: () => ({ state: e, dispatch: t }) => On(e, t),
|
|
5565
|
+
addColumnAfter: () => ({ state: e, dispatch: t }) => Ln(e, t),
|
|
5566
|
+
deleteColumn: () => ({ state: e, dispatch: t }) => _n(e, t),
|
|
5567
|
+
addRowBefore: () => ({ state: e, dispatch: t }) => Hn(e, t),
|
|
5643
5568
|
addRowAfter: () => ({ state: e, dispatch: t }) => Rn(e, t),
|
|
5644
5569
|
deleteRow: () => ({ state: e, dispatch: t }) => Pn(e, t),
|
|
5645
5570
|
deleteTable: () => ({ state: e, dispatch: t }) => In(e, t),
|
|
5646
|
-
mergeCells: () => ({ state: e, dispatch: t }) =>
|
|
5647
|
-
splitCell: () => ({ state: e, dispatch: t }) =>
|
|
5648
|
-
toggleHeaderColumn: () => ({ state: e, dispatch: t }) =>
|
|
5649
|
-
toggleHeaderRow: () => ({ state: e, dispatch: t }) =>
|
|
5571
|
+
mergeCells: () => ({ state: e, dispatch: t }) => Zt(e, t),
|
|
5572
|
+
splitCell: () => ({ state: e, dispatch: t }) => te(e, t),
|
|
5573
|
+
toggleHeaderColumn: () => ({ state: e, dispatch: t }) => ee("column")(e, t),
|
|
5574
|
+
toggleHeaderRow: () => ({ state: e, dispatch: t }) => ee("row")(e, t),
|
|
5650
5575
|
toggleHeaderCell: () => ({ state: e, dispatch: t }) => $n(e, t),
|
|
5651
|
-
mergeOrSplit: () => ({ state: e, dispatch: t }) =>
|
|
5576
|
+
mergeOrSplit: () => ({ state: e, dispatch: t }) => Zt(e, t) ? !0 : te(e, t),
|
|
5652
5577
|
setCellAttribute: (e, t) => ({ state: n, dispatch: r }) => Dn(e, t)(n, r),
|
|
5653
|
-
goToNextCell: () => ({ state: e, dispatch: t }) =>
|
|
5654
|
-
goToPreviousCell: () => ({ state: e, dispatch: t }) =>
|
|
5578
|
+
goToNextCell: () => ({ state: e, dispatch: t }) => ne(1)(e, t),
|
|
5579
|
+
goToPreviousCell: () => ({ state: e, dispatch: t }) => ne(-1)(e, t),
|
|
5655
5580
|
fixTables: () => ({ state: e, dispatch: t }) => (t && Nn(e), !0),
|
|
5656
5581
|
setCellSelection: (e) => ({ tr: t, dispatch: n }) => {
|
|
5657
5582
|
if (n) {
|
|
5658
|
-
const r =
|
|
5583
|
+
const r = ke.create(t.doc, e.anchorCell, e.headCell);
|
|
5659
5584
|
t.setSelection(r);
|
|
5660
5585
|
}
|
|
5661
5586
|
return !0;
|
|
@@ -5666,10 +5591,10 @@ const at = ({ editor: e }) => {
|
|
|
5666
5591
|
return {
|
|
5667
5592
|
Tab: () => this.editor.commands.goToNextCell() ? !0 : this.editor.can().addRowAfter() ? this.editor.chain().addRowAfter().goToNextCell().run() : !1,
|
|
5668
5593
|
"Shift-Tab": () => this.editor.commands.goToPreviousCell(),
|
|
5669
|
-
Backspace:
|
|
5670
|
-
"Mod-Backspace":
|
|
5671
|
-
Delete:
|
|
5672
|
-
"Mod-Delete":
|
|
5594
|
+
Backspace: it,
|
|
5595
|
+
"Mod-Backspace": it,
|
|
5596
|
+
Delete: it,
|
|
5597
|
+
"Mod-Delete": it
|
|
5673
5598
|
};
|
|
5674
5599
|
},
|
|
5675
5600
|
addProseMirrorPlugins() {
|
|
@@ -5694,10 +5619,10 @@ const at = ({ editor: e }) => {
|
|
|
5694
5619
|
storage: e.storage
|
|
5695
5620
|
};
|
|
5696
5621
|
return {
|
|
5697
|
-
tableRole:
|
|
5622
|
+
tableRole: E(v(e, "tableRole", t))
|
|
5698
5623
|
};
|
|
5699
5624
|
}
|
|
5700
|
-
}),
|
|
5625
|
+
}), Pi = L.create({
|
|
5701
5626
|
name: "tableCell",
|
|
5702
5627
|
addOptions() {
|
|
5703
5628
|
return {
|
|
@@ -5730,9 +5655,9 @@ const at = ({ editor: e }) => {
|
|
|
5730
5655
|
];
|
|
5731
5656
|
},
|
|
5732
5657
|
renderHTML({ HTMLAttributes: e }) {
|
|
5733
|
-
return ["td",
|
|
5658
|
+
return ["td", x(this.options.HTMLAttributes, e), 0];
|
|
5734
5659
|
}
|
|
5735
|
-
}),
|
|
5660
|
+
}), Ii = L.create({
|
|
5736
5661
|
name: "tableHeader",
|
|
5737
5662
|
addOptions() {
|
|
5738
5663
|
return {
|
|
@@ -5765,9 +5690,9 @@ const at = ({ editor: e }) => {
|
|
|
5765
5690
|
];
|
|
5766
5691
|
},
|
|
5767
5692
|
renderHTML({ HTMLAttributes: e }) {
|
|
5768
|
-
return ["th",
|
|
5693
|
+
return ["th", x(this.options.HTMLAttributes, e), 0];
|
|
5769
5694
|
}
|
|
5770
|
-
}),
|
|
5695
|
+
}), Vo = new I("mention"), $i = L.create({
|
|
5771
5696
|
name: "mention",
|
|
5772
5697
|
addOptions() {
|
|
5773
5698
|
return {
|
|
@@ -5781,13 +5706,13 @@ const at = ({ editor: e }) => {
|
|
|
5781
5706
|
var n;
|
|
5782
5707
|
return [
|
|
5783
5708
|
"span",
|
|
5784
|
-
|
|
5709
|
+
x(this.HTMLAttributes, e.HTMLAttributes),
|
|
5785
5710
|
`${e.suggestion.char}${(n = t.attrs.label) !== null && n !== void 0 ? n : t.attrs.id}`
|
|
5786
5711
|
];
|
|
5787
5712
|
},
|
|
5788
5713
|
suggestion: {
|
|
5789
5714
|
char: "@",
|
|
5790
|
-
pluginKey:
|
|
5715
|
+
pluginKey: Vo,
|
|
5791
5716
|
command: ({ editor: e, range: t, props: n }) => {
|
|
5792
5717
|
var r, s, o;
|
|
5793
5718
|
const i = e.view.state.selection.$to.nodeAfter;
|
|
@@ -5842,21 +5767,21 @@ const at = ({ editor: e }) => {
|
|
|
5842
5767
|
if (this.options.renderLabel !== void 0)
|
|
5843
5768
|
return console.warn("renderLabel is deprecated use renderText and renderHTML instead"), [
|
|
5844
5769
|
"span",
|
|
5845
|
-
|
|
5770
|
+
x({ "data-type": this.name }, this.options.HTMLAttributes, t),
|
|
5846
5771
|
this.options.renderLabel({
|
|
5847
5772
|
options: this.options,
|
|
5848
5773
|
node: e
|
|
5849
5774
|
})
|
|
5850
5775
|
];
|
|
5851
5776
|
const n = { ...this.options };
|
|
5852
|
-
n.HTMLAttributes =
|
|
5777
|
+
n.HTMLAttributes = x({ "data-type": this.name }, this.options.HTMLAttributes, t);
|
|
5853
5778
|
const r = this.options.renderHTML({
|
|
5854
5779
|
options: n,
|
|
5855
5780
|
node: e
|
|
5856
5781
|
});
|
|
5857
5782
|
return typeof r == "string" ? [
|
|
5858
5783
|
"span",
|
|
5859
|
-
|
|
5784
|
+
x({ "data-type": this.name }, this.options.HTMLAttributes, t),
|
|
5860
5785
|
r
|
|
5861
5786
|
] : r;
|
|
5862
5787
|
},
|
|
@@ -5883,7 +5808,7 @@ const at = ({ editor: e }) => {
|
|
|
5883
5808
|
},
|
|
5884
5809
|
addProseMirrorPlugins() {
|
|
5885
5810
|
return [
|
|
5886
|
-
|
|
5811
|
+
$o({
|
|
5887
5812
|
editor: this.editor,
|
|
5888
5813
|
...this.options.suggestion
|
|
5889
5814
|
})
|
|
@@ -5891,59 +5816,59 @@ const at = ({ editor: e }) => {
|
|
|
5891
5816
|
}
|
|
5892
5817
|
});
|
|
5893
5818
|
export {
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5819
|
+
Pi as $,
|
|
5820
|
+
Ei as A,
|
|
5821
|
+
Qo as B,
|
|
5822
|
+
oi as C,
|
|
5823
|
+
Ai as D,
|
|
5824
|
+
Yo as E,
|
|
5825
|
+
ai as F,
|
|
5826
|
+
wi as G,
|
|
5827
|
+
li as H,
|
|
5828
|
+
ni as I,
|
|
5829
|
+
Fe as J,
|
|
5830
|
+
ft as K,
|
|
5831
|
+
yi as L,
|
|
5832
|
+
Oi as M,
|
|
5833
|
+
ti as N,
|
|
5834
|
+
hi as O,
|
|
5835
|
+
Ci as P,
|
|
5836
|
+
Li as Q,
|
|
5837
|
+
ei as R,
|
|
5838
|
+
si as S,
|
|
5839
|
+
ci as T,
|
|
5840
|
+
ri as U,
|
|
5841
|
+
$o as V,
|
|
5917
5842
|
ho as W,
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5843
|
+
_i as X,
|
|
5844
|
+
Ri as Y,
|
|
5845
|
+
Hi as Z,
|
|
5846
|
+
Ii as _,
|
|
5922
5847
|
L as a,
|
|
5923
|
-
|
|
5848
|
+
$i as a0,
|
|
5924
5849
|
is as b,
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5850
|
+
Jo as c,
|
|
5851
|
+
Zo as d,
|
|
5852
|
+
ii as e,
|
|
5853
|
+
Go as f,
|
|
5854
|
+
_ as g,
|
|
5855
|
+
di as h,
|
|
5856
|
+
ae as i,
|
|
5857
|
+
ui as j,
|
|
5858
|
+
pi as k,
|
|
5859
|
+
mi as l,
|
|
5860
|
+
x as m,
|
|
5861
|
+
$e as n,
|
|
5862
|
+
fi as o,
|
|
5863
|
+
gi as p,
|
|
5939
5864
|
Kt as q,
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5865
|
+
bi as r,
|
|
5866
|
+
vi as s,
|
|
5867
|
+
Gt as t,
|
|
5868
|
+
Xo as u,
|
|
5869
|
+
ki as v,
|
|
5870
|
+
xi as w,
|
|
5871
|
+
Si as x,
|
|
5872
|
+
Mi as y,
|
|
5873
|
+
Ti as z
|
|
5949
5874
|
};
|