reactjs-tiptap-editor 0.1.9 → 0.1.11
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/README.md +4 -0
- package/lib/index.d.cts +50 -46
- package/lib/index.d.ts +50 -46
- package/lib/{locales-BrbC7gGY.js → locales-CAZfnzv4.js} +10 -10
- package/lib/{locales-DBDSyO37.cjs → locales-CO2wcFqJ.cjs} +1 -1
- package/lib/reactjs-tiptap-editor.cjs +1 -1
- package/lib/reactjs-tiptap-editor.js +3 -3
- package/lib/style.css +1 -1
- package/lib/{tiptap-BGOnVdZm.js → tiptap-BSVYcz58.js} +1166 -1030
- package/lib/tiptap-z5OraroY.cjs +116 -0
- package/lib/{utils-CLv76C-_.js → utils-B0SMxWW-.js} +1539 -1493
- package/lib/utils-BG7adOxz.cjs +152 -0
- package/lib/vendor-BmwuOKTu.cjs +124 -0
- package/lib/vendor-C2GXVsjz.js +32135 -0
- package/package.json +66 -66
- package/lib/tiptap-BS6QuLRv.cjs +0 -116
- package/lib/utils-BUTXoeL7.cjs +0 -152
- package/lib/vendor-BzT-edVs.cjs +0 -20
- package/lib/vendor-wdh2A0rt.js +0 -22456
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
import { P as
|
|
6
|
-
import L, { forwardRef as
|
|
7
|
-
import
|
|
8
|
-
function
|
|
1
|
+
var on = Object.defineProperty;
|
|
2
|
+
var an = (e, t, n) => t in e ? on(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var it = (e, t, n) => an(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import Re from "tippy.js";
|
|
5
|
+
import { P as $, a as _, N as et, S as V, f as ln, c as Wt, T as cn, l as dn, b as un, d as I, e as pn, g as hn, F as W, j as fn, h as mn, i as gn, k as yn, m as $e, n as vn, o as bn, p as Mn, q as kn, r as Sn, s as wn, t as En, u as Tn, v as Cn, w as xn, x as An, y as se, z as On, A as pt, B as Ln, C as Pn, D as Rn, E as $n, G as _n, H as Hn, I as In, J as Dn, K as _e, L as At, R as Nn, M as Bn, O as jn, Q as Fn, U as zn, V as Vn, W as oe, X as He, Y as Wn, Z as Kn, _ as Un, $ as qn, a0 as Gn, a1 as Jn, a2 as ft, a3 as Kt, a4 as Yn, a5 as Xn, a6 as Qn, a7 as Zn, a8 as tr, a9 as er, aa as nr, ab as rr, ac as ie, ad as ae, ae as le, af as sr, ag as or, ah as ce, ai as ir, aj as Ie, ak as ar, al as lr } from "./vendor-C2GXVsjz.js";
|
|
6
|
+
import L, { forwardRef as cr, createContext as De, useState as Ut, useEffect as qt, useRef as dr, useDebugValue as Ne, useContext as Be, useLayoutEffect as ur } from "react";
|
|
7
|
+
import pr, { flushSync as hr } from "react-dom";
|
|
8
|
+
function vt(e) {
|
|
9
9
|
const { state: t, transaction: n } = e;
|
|
10
10
|
let { selection: r } = n, { doc: s } = n, { storedMarks: o } = n;
|
|
11
11
|
return {
|
|
@@ -30,7 +30,7 @@ function yt(e) {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
class
|
|
33
|
+
class bt {
|
|
34
34
|
constructor(t) {
|
|
35
35
|
this.editor = t.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = t.state;
|
|
36
36
|
}
|
|
@@ -75,7 +75,7 @@ class vt {
|
|
|
75
75
|
tr: t,
|
|
76
76
|
editor: s,
|
|
77
77
|
view: i,
|
|
78
|
-
state:
|
|
78
|
+
state: vt({
|
|
79
79
|
state: o,
|
|
80
80
|
transaction: t
|
|
81
81
|
}),
|
|
@@ -90,7 +90,7 @@ class vt {
|
|
|
90
90
|
return a;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
class
|
|
93
|
+
class fr {
|
|
94
94
|
constructor() {
|
|
95
95
|
this.callbacks = {};
|
|
96
96
|
}
|
|
@@ -105,6 +105,12 @@ class cr {
|
|
|
105
105
|
const r = this.callbacks[t];
|
|
106
106
|
return r && (n ? this.callbacks[t] = r.filter((s) => s !== n) : delete this.callbacks[t]), this;
|
|
107
107
|
}
|
|
108
|
+
once(t, n) {
|
|
109
|
+
const r = (...s) => {
|
|
110
|
+
this.off(t, r), n.apply(this, s);
|
|
111
|
+
};
|
|
112
|
+
return this.on(t, r);
|
|
113
|
+
}
|
|
108
114
|
removeAllListeners() {
|
|
109
115
|
this.callbacks = {};
|
|
110
116
|
}
|
|
@@ -115,7 +121,7 @@ function S(e, t, n) {
|
|
|
115
121
|
parent: e.parent ? S(e.parent, t, n) : null
|
|
116
122
|
}) : e.config[t];
|
|
117
123
|
}
|
|
118
|
-
function
|
|
124
|
+
function Mt(e) {
|
|
119
125
|
const t = e.filter((s) => s.type === "extension"), n = e.filter((s) => s.type === "node"), r = e.filter((s) => s.type === "mark");
|
|
120
126
|
return {
|
|
121
127
|
baseExtensions: t,
|
|
@@ -123,8 +129,8 @@ function bt(e) {
|
|
|
123
129
|
markExtensions: r
|
|
124
130
|
};
|
|
125
131
|
}
|
|
126
|
-
function
|
|
127
|
-
const t = [], { nodeExtensions: n, markExtensions: r } =
|
|
132
|
+
function je(e) {
|
|
133
|
+
const t = [], { nodeExtensions: n, markExtensions: r } = Mt(e), s = [...n, ...r], o = {
|
|
128
134
|
default: null,
|
|
129
135
|
rendered: !0,
|
|
130
136
|
renderHTML: null,
|
|
@@ -177,7 +183,7 @@ function Ne(e) {
|
|
|
177
183
|
});
|
|
178
184
|
}), t;
|
|
179
185
|
}
|
|
180
|
-
function
|
|
186
|
+
function H(e, t) {
|
|
181
187
|
if (typeof e == "string") {
|
|
182
188
|
if (!t.nodes[e])
|
|
183
189
|
throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);
|
|
@@ -210,24 +216,24 @@ function x(...e) {
|
|
|
210
216
|
}), r;
|
|
211
217
|
}, {});
|
|
212
218
|
}
|
|
213
|
-
function
|
|
219
|
+
function mt(e, t) {
|
|
214
220
|
return t.filter((n) => n.type === e.type.name).filter((n) => n.attribute.rendered).map((n) => n.attribute.renderHTML ? n.attribute.renderHTML(e.attrs) || {} : {
|
|
215
221
|
[n.name]: e.attrs[n.name]
|
|
216
222
|
}).reduce((n, r) => x(n, r), {});
|
|
217
223
|
}
|
|
218
|
-
function
|
|
224
|
+
function Fe(e) {
|
|
219
225
|
return typeof e == "function";
|
|
220
226
|
}
|
|
221
227
|
function T(e, t = void 0, ...n) {
|
|
222
|
-
return
|
|
228
|
+
return Fe(e) ? t ? e.bind(t)(...n) : e(...n) : e;
|
|
223
229
|
}
|
|
224
|
-
function
|
|
230
|
+
function mr(e = {}) {
|
|
225
231
|
return Object.keys(e).length === 0 && e.constructor === Object;
|
|
226
232
|
}
|
|
227
|
-
function
|
|
233
|
+
function gr(e) {
|
|
228
234
|
return typeof e != "string" ? e : e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" ? !0 : e === "false" ? !1 : e;
|
|
229
235
|
}
|
|
230
|
-
function
|
|
236
|
+
function de(e, t) {
|
|
231
237
|
return "style" in e ? e : {
|
|
232
238
|
...e,
|
|
233
239
|
getAttrs: (n) => {
|
|
@@ -235,7 +241,7 @@ function le(e, t) {
|
|
|
235
241
|
if (r === !1)
|
|
236
242
|
return !1;
|
|
237
243
|
const s = t.reduce((o, i) => {
|
|
238
|
-
const a = i.attribute.parseHTML ? i.attribute.parseHTML(n) :
|
|
244
|
+
const a = i.attribute.parseHTML ? i.attribute.parseHTML(n) : gr(n.getAttribute(i.name));
|
|
239
245
|
return a == null ? o : {
|
|
240
246
|
...o,
|
|
241
247
|
[i.name]: a
|
|
@@ -245,27 +251,27 @@ function le(e, t) {
|
|
|
245
251
|
}
|
|
246
252
|
};
|
|
247
253
|
}
|
|
248
|
-
function
|
|
254
|
+
function ue(e) {
|
|
249
255
|
return Object.fromEntries(
|
|
250
256
|
// @ts-ignore
|
|
251
|
-
Object.entries(e).filter(([t, n]) => t === "attrs" &&
|
|
257
|
+
Object.entries(e).filter(([t, n]) => t === "attrs" && mr(n) ? !1 : n != null)
|
|
252
258
|
);
|
|
253
259
|
}
|
|
254
|
-
function
|
|
260
|
+
function yr(e, t) {
|
|
255
261
|
var n;
|
|
256
|
-
const r =
|
|
262
|
+
const r = je(e), { nodeExtensions: s, markExtensions: o } = Mt(e), i = (n = s.find((l) => S(l, "topNode"))) === null || n === void 0 ? void 0 : n.name, a = Object.fromEntries(s.map((l) => {
|
|
257
263
|
const u = r.filter((y) => y.type === l.name), d = {
|
|
258
264
|
name: l.name,
|
|
259
265
|
options: l.options,
|
|
260
266
|
storage: l.storage,
|
|
261
267
|
editor: t
|
|
262
|
-
}, p = e.reduce((y,
|
|
263
|
-
const
|
|
268
|
+
}, p = e.reduce((y, M) => {
|
|
269
|
+
const v = S(M, "extendNodeSchema", d);
|
|
264
270
|
return {
|
|
265
271
|
...y,
|
|
266
|
-
...
|
|
272
|
+
...v ? v(l) : {}
|
|
267
273
|
};
|
|
268
|
-
}, {}), h =
|
|
274
|
+
}, {}), h = ue({
|
|
269
275
|
...p,
|
|
270
276
|
content: T(S(l, "content", d)),
|
|
271
277
|
marks: T(S(l, "marks", d)),
|
|
@@ -276,18 +282,19 @@ function pr(e, t) {
|
|
|
276
282
|
draggable: T(S(l, "draggable", d)),
|
|
277
283
|
code: T(S(l, "code", d)),
|
|
278
284
|
whitespace: T(S(l, "whitespace", d)),
|
|
285
|
+
linebreakReplacement: T(S(l, "linebreakReplacement", d)),
|
|
279
286
|
defining: T(S(l, "defining", d)),
|
|
280
287
|
isolating: T(S(l, "isolating", d)),
|
|
281
288
|
attrs: Object.fromEntries(u.map((y) => {
|
|
282
|
-
var
|
|
283
|
-
return [y.name, { default: (
|
|
289
|
+
var M;
|
|
290
|
+
return [y.name, { default: (M = y == null ? void 0 : y.attribute) === null || M === void 0 ? void 0 : M.default }];
|
|
284
291
|
}))
|
|
285
292
|
}), f = T(S(l, "parseHTML", d));
|
|
286
|
-
f && (h.parseDOM = f.map((y) =>
|
|
293
|
+
f && (h.parseDOM = f.map((y) => de(y, u)));
|
|
287
294
|
const m = S(l, "renderHTML", d);
|
|
288
295
|
m && (h.toDOM = (y) => m({
|
|
289
296
|
node: y,
|
|
290
|
-
HTMLAttributes:
|
|
297
|
+
HTMLAttributes: mt(y, u)
|
|
291
298
|
}));
|
|
292
299
|
const g = S(l, "renderText", d);
|
|
293
300
|
return g && (h.toText = g), [l.name, h];
|
|
@@ -298,12 +305,12 @@ function pr(e, t) {
|
|
|
298
305
|
storage: l.storage,
|
|
299
306
|
editor: t
|
|
300
307
|
}, p = e.reduce((g, y) => {
|
|
301
|
-
const
|
|
308
|
+
const M = S(y, "extendMarkSchema", d);
|
|
302
309
|
return {
|
|
303
310
|
...g,
|
|
304
|
-
...
|
|
311
|
+
...M ? M(l) : {}
|
|
305
312
|
};
|
|
306
|
-
}, {}), h =
|
|
313
|
+
}, {}), h = ue({
|
|
307
314
|
...p,
|
|
308
315
|
inclusive: T(S(l, "inclusive", d)),
|
|
309
316
|
excludes: T(S(l, "excludes", d)),
|
|
@@ -315,26 +322,30 @@ function pr(e, t) {
|
|
|
315
322
|
return [g.name, { default: (y = g == null ? void 0 : g.attribute) === null || y === void 0 ? void 0 : y.default }];
|
|
316
323
|
}))
|
|
317
324
|
}), f = T(S(l, "parseHTML", d));
|
|
318
|
-
f && (h.parseDOM = f.map((g) =>
|
|
325
|
+
f && (h.parseDOM = f.map((g) => de(g, u)));
|
|
319
326
|
const m = S(l, "renderHTML", d);
|
|
320
327
|
return m && (h.toDOM = (g) => m({
|
|
321
328
|
mark: g,
|
|
322
|
-
HTMLAttributes:
|
|
329
|
+
HTMLAttributes: mt(g, u)
|
|
323
330
|
})), [l.name, h];
|
|
324
331
|
}));
|
|
325
|
-
return new
|
|
332
|
+
return new _e({
|
|
326
333
|
topNode: i,
|
|
327
334
|
nodes: a,
|
|
328
335
|
marks: c
|
|
329
336
|
});
|
|
330
337
|
}
|
|
331
|
-
function
|
|
338
|
+
function Ot(e, t) {
|
|
332
339
|
return t.nodes[e] || t.marks[e] || null;
|
|
333
340
|
}
|
|
334
|
-
function
|
|
341
|
+
function pe(e, t) {
|
|
335
342
|
return Array.isArray(t) ? t.some((n) => (typeof n == "string" ? n : n.name) === e.name) : t;
|
|
336
343
|
}
|
|
337
|
-
|
|
344
|
+
function Gt(e, t) {
|
|
345
|
+
const n = Hn.fromSchema(t).serializeFragment(e), s = document.implementation.createHTMLDocument().createElement("div");
|
|
346
|
+
return s.appendChild(n), s.innerHTML;
|
|
347
|
+
}
|
|
348
|
+
const vr = (e, t = 500) => {
|
|
338
349
|
let n = "";
|
|
339
350
|
const r = e.parentOffset;
|
|
340
351
|
return e.parent.nodesBetween(Math.max(0, r - t), r, (s, o, i, a) => {
|
|
@@ -348,16 +359,16 @@ const hr = (e, t = 500) => {
|
|
|
348
359
|
n += s.isAtom && !s.isText ? u : u.slice(0, Math.max(0, r - o));
|
|
349
360
|
}), n;
|
|
350
361
|
};
|
|
351
|
-
function
|
|
362
|
+
function Jt(e) {
|
|
352
363
|
return Object.prototype.toString.call(e) === "[object RegExp]";
|
|
353
364
|
}
|
|
354
|
-
class
|
|
365
|
+
class kt {
|
|
355
366
|
constructor(t) {
|
|
356
367
|
this.find = t.find, this.handler = t.handler;
|
|
357
368
|
}
|
|
358
369
|
}
|
|
359
|
-
const
|
|
360
|
-
if (
|
|
370
|
+
const br = (e, t) => {
|
|
371
|
+
if (Jt(t))
|
|
361
372
|
return t.exec(e);
|
|
362
373
|
const n = t(e);
|
|
363
374
|
if (!n)
|
|
@@ -365,7 +376,7 @@ const fr = (e, t) => {
|
|
|
365
376
|
const r = [n.text];
|
|
366
377
|
return r.index = n.index, r.input = e, r.data = n.data, n.replaceWith && (n.text.includes(n.replaceWith) || console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'), r.push(n.replaceWith)), r;
|
|
367
378
|
};
|
|
368
|
-
function
|
|
379
|
+
function at(e) {
|
|
369
380
|
var t;
|
|
370
381
|
const { editor: n, from: r, to: s, text: o, rules: i, plugin: a } = e, { view: c } = n;
|
|
371
382
|
if (c.composing)
|
|
@@ -377,20 +388,20 @@ function ot(e) {
|
|
|
377
388
|
)
|
|
378
389
|
return !1;
|
|
379
390
|
let u = !1;
|
|
380
|
-
const d =
|
|
391
|
+
const d = vr(l) + o;
|
|
381
392
|
return i.forEach((p) => {
|
|
382
393
|
if (u)
|
|
383
394
|
return;
|
|
384
|
-
const h =
|
|
395
|
+
const h = br(d, p.find);
|
|
385
396
|
if (!h)
|
|
386
397
|
return;
|
|
387
|
-
const f = c.state.tr, m =
|
|
398
|
+
const f = c.state.tr, m = vt({
|
|
388
399
|
state: c.state,
|
|
389
400
|
transaction: f
|
|
390
401
|
}), g = {
|
|
391
402
|
from: r - (h[0].length - o.length),
|
|
392
403
|
to: s
|
|
393
|
-
}, { commands: y, chain:
|
|
404
|
+
}, { commands: y, chain: M, can: v } = new bt({
|
|
394
405
|
editor: n,
|
|
395
406
|
state: m
|
|
396
407
|
});
|
|
@@ -399,8 +410,8 @@ function ot(e) {
|
|
|
399
410
|
range: g,
|
|
400
411
|
match: h,
|
|
401
412
|
commands: y,
|
|
402
|
-
chain:
|
|
403
|
-
can:
|
|
413
|
+
chain: M,
|
|
414
|
+
can: v
|
|
404
415
|
}) === null || !f.steps.length || (f.setMeta(a, {
|
|
405
416
|
transform: f,
|
|
406
417
|
from: r,
|
|
@@ -409,23 +420,25 @@ function ot(e) {
|
|
|
409
420
|
}), c.dispatch(f), u = !0);
|
|
410
421
|
}), u;
|
|
411
422
|
}
|
|
412
|
-
function
|
|
413
|
-
const { editor: t, rules: n } = e, r = new
|
|
423
|
+
function Mr(e) {
|
|
424
|
+
const { editor: t, rules: n } = e, r = new $({
|
|
414
425
|
state: {
|
|
415
426
|
init() {
|
|
416
427
|
return null;
|
|
417
428
|
},
|
|
418
|
-
apply(s, o) {
|
|
419
|
-
const
|
|
420
|
-
if (
|
|
421
|
-
return
|
|
422
|
-
const
|
|
423
|
-
return !!
|
|
424
|
-
|
|
425
|
-
|
|
429
|
+
apply(s, o, i) {
|
|
430
|
+
const a = s.getMeta(r);
|
|
431
|
+
if (a)
|
|
432
|
+
return a;
|
|
433
|
+
const c = s.getMeta("applyInputRules");
|
|
434
|
+
return !!c && setTimeout(() => {
|
|
435
|
+
let { text: u } = c;
|
|
436
|
+
typeof u == "string" ? u = u : u = Gt(W.from(u), i.schema);
|
|
437
|
+
const { from: d } = c, p = d + u.length;
|
|
438
|
+
at({
|
|
426
439
|
editor: t,
|
|
427
|
-
from:
|
|
428
|
-
to:
|
|
440
|
+
from: d,
|
|
441
|
+
to: p,
|
|
429
442
|
text: u,
|
|
430
443
|
rules: n,
|
|
431
444
|
plugin: r
|
|
@@ -435,7 +448,7 @@ function mr(e) {
|
|
|
435
448
|
},
|
|
436
449
|
props: {
|
|
437
450
|
handleTextInput(s, o, i, a) {
|
|
438
|
-
return
|
|
451
|
+
return at({
|
|
439
452
|
editor: t,
|
|
440
453
|
from: o,
|
|
441
454
|
to: i,
|
|
@@ -447,7 +460,7 @@ function mr(e) {
|
|
|
447
460
|
handleDOMEvents: {
|
|
448
461
|
compositionend: (s) => (setTimeout(() => {
|
|
449
462
|
const { $cursor: o } = s.state.selection;
|
|
450
|
-
o &&
|
|
463
|
+
o && at({
|
|
451
464
|
editor: t,
|
|
452
465
|
from: o.pos,
|
|
453
466
|
to: o.pos,
|
|
@@ -463,7 +476,7 @@ function mr(e) {
|
|
|
463
476
|
if (o.key !== "Enter")
|
|
464
477
|
return !1;
|
|
465
478
|
const { $cursor: i } = s.state.selection;
|
|
466
|
-
return i ?
|
|
479
|
+
return i ? at({
|
|
467
480
|
editor: t,
|
|
468
481
|
from: i.pos,
|
|
469
482
|
to: i.pos,
|
|
@@ -479,16 +492,16 @@ function mr(e) {
|
|
|
479
492
|
});
|
|
480
493
|
return r;
|
|
481
494
|
}
|
|
482
|
-
function
|
|
495
|
+
function kr(e) {
|
|
483
496
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
484
497
|
}
|
|
485
|
-
function
|
|
486
|
-
return
|
|
498
|
+
function lt(e) {
|
|
499
|
+
return kr(e) !== "Object" ? !1 : e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
|
|
487
500
|
}
|
|
488
501
|
function St(e, t) {
|
|
489
502
|
const n = { ...e };
|
|
490
|
-
return
|
|
491
|
-
|
|
503
|
+
return lt(e) && lt(t) && Object.keys(t).forEach((r) => {
|
|
504
|
+
lt(t[r]) && lt(e[r]) ? n[r] = St(e[r], t[r]) : n[r] = t[r];
|
|
492
505
|
}), n;
|
|
493
506
|
}
|
|
494
507
|
class D {
|
|
@@ -537,16 +550,16 @@ class D {
|
|
|
537
550
|
return !1;
|
|
538
551
|
}
|
|
539
552
|
}
|
|
540
|
-
function
|
|
553
|
+
function Sr(e) {
|
|
541
554
|
return typeof e == "number";
|
|
542
555
|
}
|
|
543
|
-
class
|
|
556
|
+
class ze {
|
|
544
557
|
constructor(t) {
|
|
545
558
|
this.find = t.find, this.handler = t.handler;
|
|
546
559
|
}
|
|
547
560
|
}
|
|
548
|
-
const
|
|
549
|
-
if (
|
|
561
|
+
const wr = (e, t, n) => {
|
|
562
|
+
if (Jt(t))
|
|
550
563
|
return [...e.matchAll(t)];
|
|
551
564
|
const r = t(e, n);
|
|
552
565
|
return r ? r.map((s) => {
|
|
@@ -554,8 +567,8 @@ const vr = (e, t, n) => {
|
|
|
554
567
|
return o.index = s.index, o.input = e, o.data = s.data, s.replaceWith && (s.text.includes(s.replaceWith) || console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'), o.push(s.replaceWith)), o;
|
|
555
568
|
}) : [];
|
|
556
569
|
};
|
|
557
|
-
function
|
|
558
|
-
const { editor: t, state: n, from: r, to: s, rule: o, pasteEvent: i, dropEvent: a } = e, { commands: c, chain: l, can: u } = new
|
|
570
|
+
function Er(e) {
|
|
571
|
+
const { editor: t, state: n, from: r, to: s, rule: o, pasteEvent: i, dropEvent: a } = e, { commands: c, chain: l, can: u } = new bt({
|
|
559
572
|
editor: t,
|
|
560
573
|
state: n
|
|
561
574
|
}), d = [];
|
|
@@ -563,16 +576,16 @@ function br(e) {
|
|
|
563
576
|
if (!h.isTextblock || h.type.spec.code)
|
|
564
577
|
return;
|
|
565
578
|
const m = Math.max(r, f), g = Math.min(s, f + h.content.size), y = h.textBetween(m - f, g - f, void 0, "");
|
|
566
|
-
|
|
567
|
-
if (
|
|
579
|
+
wr(y, o.find, i).forEach((v) => {
|
|
580
|
+
if (v.index === void 0)
|
|
568
581
|
return;
|
|
569
|
-
const
|
|
570
|
-
from: n.tr.mapping.map(
|
|
571
|
-
to: n.tr.mapping.map(
|
|
582
|
+
const b = m + v.index + 1, w = b + v[0].length, k = {
|
|
583
|
+
from: n.tr.mapping.map(b),
|
|
584
|
+
to: n.tr.mapping.map(w)
|
|
572
585
|
}, C = o.handler({
|
|
573
586
|
state: n,
|
|
574
|
-
range:
|
|
575
|
-
match:
|
|
587
|
+
range: k,
|
|
588
|
+
match: v,
|
|
576
589
|
commands: c,
|
|
577
590
|
chain: l,
|
|
578
591
|
can: u,
|
|
@@ -583,22 +596,27 @@ function br(e) {
|
|
|
583
596
|
});
|
|
584
597
|
}), d.every((h) => h !== null);
|
|
585
598
|
}
|
|
586
|
-
const
|
|
599
|
+
const Tr = (e) => {
|
|
587
600
|
var t;
|
|
588
601
|
const n = new ClipboardEvent("paste", {
|
|
589
602
|
clipboardData: new DataTransfer()
|
|
590
603
|
});
|
|
591
604
|
return (t = n.clipboardData) === null || t === void 0 || t.setData("text/html", e), n;
|
|
592
605
|
};
|
|
593
|
-
function
|
|
606
|
+
function Cr(e) {
|
|
594
607
|
const { editor: t, rules: n } = e;
|
|
595
|
-
let r = null, s = !1, o = !1, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, a
|
|
608
|
+
let r = null, s = !1, o = !1, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, a;
|
|
609
|
+
try {
|
|
610
|
+
a = typeof DragEvent < "u" ? new DragEvent("drop") : null;
|
|
611
|
+
} catch {
|
|
612
|
+
a = null;
|
|
613
|
+
}
|
|
596
614
|
const c = ({ state: u, from: d, to: p, rule: h, pasteEvt: f }) => {
|
|
597
|
-
const m = u.tr, g =
|
|
615
|
+
const m = u.tr, g = vt({
|
|
598
616
|
state: u,
|
|
599
617
|
transaction: m
|
|
600
618
|
});
|
|
601
|
-
if (!(!
|
|
619
|
+
if (!(!Er({
|
|
602
620
|
editor: t,
|
|
603
621
|
state: g,
|
|
604
622
|
from: Math.max(d - 1, 0),
|
|
@@ -606,10 +624,16 @@ function Sr(e) {
|
|
|
606
624
|
rule: h,
|
|
607
625
|
pasteEvent: f,
|
|
608
626
|
dropEvent: a
|
|
609
|
-
}) || !m.steps.length))
|
|
610
|
-
|
|
627
|
+
}) || !m.steps.length)) {
|
|
628
|
+
try {
|
|
629
|
+
a = typeof DragEvent < "u" ? new DragEvent("drop") : null;
|
|
630
|
+
} catch {
|
|
631
|
+
a = null;
|
|
632
|
+
}
|
|
633
|
+
return i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, m;
|
|
634
|
+
}
|
|
611
635
|
};
|
|
612
|
-
return n.map((u) => new
|
|
636
|
+
return n.map((u) => new $({
|
|
613
637
|
// we register a global drag handler to track the current drag source element
|
|
614
638
|
view(d) {
|
|
615
639
|
const p = (h) => {
|
|
@@ -633,38 +657,40 @@ function Sr(e) {
|
|
|
633
657
|
}
|
|
634
658
|
},
|
|
635
659
|
appendTransaction: (d, p, h) => {
|
|
636
|
-
const f = d[0], m = f.getMeta("uiEvent") === "paste" && !s, g = f.getMeta("uiEvent") === "drop" && !o, y = f.getMeta("applyPasteRules"),
|
|
637
|
-
if (!m && !g && !
|
|
660
|
+
const f = d[0], m = f.getMeta("uiEvent") === "paste" && !s, g = f.getMeta("uiEvent") === "drop" && !o, y = f.getMeta("applyPasteRules"), M = !!y;
|
|
661
|
+
if (!m && !g && !M)
|
|
638
662
|
return;
|
|
639
|
-
if (
|
|
640
|
-
|
|
663
|
+
if (M) {
|
|
664
|
+
let { text: w } = y;
|
|
665
|
+
typeof w == "string" ? w = w : w = Gt(W.from(w), h.schema);
|
|
666
|
+
const { from: k } = y, C = k + w.length, A = Tr(w);
|
|
641
667
|
return c({
|
|
642
668
|
rule: u,
|
|
643
669
|
state: h,
|
|
644
|
-
from:
|
|
670
|
+
from: k,
|
|
645
671
|
to: { b: C },
|
|
646
672
|
pasteEvt: A
|
|
647
673
|
});
|
|
648
674
|
}
|
|
649
|
-
const
|
|
650
|
-
if (!(!
|
|
675
|
+
const v = p.doc.content.findDiffStart(h.doc.content), b = p.doc.content.findDiffEnd(h.doc.content);
|
|
676
|
+
if (!(!Sr(v) || !b || v === b.b))
|
|
651
677
|
return c({
|
|
652
678
|
rule: u,
|
|
653
679
|
state: h,
|
|
654
|
-
from:
|
|
655
|
-
to:
|
|
680
|
+
from: v,
|
|
681
|
+
to: b,
|
|
656
682
|
pasteEvt: i
|
|
657
683
|
});
|
|
658
684
|
}
|
|
659
685
|
}));
|
|
660
686
|
}
|
|
661
|
-
function
|
|
687
|
+
function xr(e) {
|
|
662
688
|
const t = e.filter((n, r) => e.indexOf(n) !== r);
|
|
663
689
|
return Array.from(new Set(t));
|
|
664
690
|
}
|
|
665
|
-
class
|
|
691
|
+
class tt {
|
|
666
692
|
constructor(t, n) {
|
|
667
|
-
this.splittableMarks = [], this.editor = n, this.extensions =
|
|
693
|
+
this.splittableMarks = [], this.editor = n, this.extensions = tt.resolve(t), this.schema = yr(this.extensions, n), this.setupExtensions();
|
|
668
694
|
}
|
|
669
695
|
/**
|
|
670
696
|
* Returns a flattened and sorted extension list while
|
|
@@ -673,7 +699,7 @@ class Z {
|
|
|
673
699
|
* @returns An flattened and sorted array of Tiptap extensions
|
|
674
700
|
*/
|
|
675
701
|
static resolve(t) {
|
|
676
|
-
const n =
|
|
702
|
+
const n = tt.sort(tt.flatten(t)), r = xr(n.map((s) => s.name));
|
|
677
703
|
return r.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map((s) => `'${s}'`).join(", ")}]. This can lead to issues.`), n;
|
|
678
704
|
}
|
|
679
705
|
/**
|
|
@@ -713,7 +739,7 @@ class Z {
|
|
|
713
739
|
options: n.options,
|
|
714
740
|
storage: n.storage,
|
|
715
741
|
editor: this.editor,
|
|
716
|
-
type:
|
|
742
|
+
type: Ot(n.name, this.schema)
|
|
717
743
|
}, s = S(n, "addCommands", r);
|
|
718
744
|
return s ? {
|
|
719
745
|
...t,
|
|
@@ -726,25 +752,25 @@ class Z {
|
|
|
726
752
|
* @returns An array of Prosemirror plugins
|
|
727
753
|
*/
|
|
728
754
|
get plugins() {
|
|
729
|
-
const { editor: t } = this, n =
|
|
755
|
+
const { editor: t } = this, n = tt.sort([...this.extensions].reverse()), r = [], s = [], o = n.map((i) => {
|
|
730
756
|
const a = {
|
|
731
757
|
name: i.name,
|
|
732
758
|
options: i.options,
|
|
733
759
|
storage: i.storage,
|
|
734
760
|
editor: t,
|
|
735
|
-
type:
|
|
761
|
+
type: Ot(i.name, this.schema)
|
|
736
762
|
}, c = [], l = S(i, "addKeyboardShortcuts", a);
|
|
737
763
|
let u = {};
|
|
738
764
|
if (i.type === "mark" && S(i, "exitable", a) && (u.ArrowRight = () => D.handleExit({ editor: t, mark: i })), l) {
|
|
739
765
|
const m = Object.fromEntries(Object.entries(l()).map(([g, y]) => [g, () => y({ editor: t })]));
|
|
740
766
|
u = { ...u, ...m };
|
|
741
767
|
}
|
|
742
|
-
const d =
|
|
768
|
+
const d = In(u);
|
|
743
769
|
c.push(d);
|
|
744
770
|
const p = S(i, "addInputRules", a);
|
|
745
|
-
|
|
771
|
+
pe(i, t.options.enableInputRules) && p && r.push(...p());
|
|
746
772
|
const h = S(i, "addPasteRules", a);
|
|
747
|
-
|
|
773
|
+
pe(i, t.options.enablePasteRules) && h && s.push(...h());
|
|
748
774
|
const f = S(i, "addProseMirrorPlugins", a);
|
|
749
775
|
if (f) {
|
|
750
776
|
const m = f();
|
|
@@ -753,11 +779,11 @@ class Z {
|
|
|
753
779
|
return c;
|
|
754
780
|
}).flat();
|
|
755
781
|
return [
|
|
756
|
-
|
|
782
|
+
Mr({
|
|
757
783
|
editor: t,
|
|
758
784
|
rules: r
|
|
759
785
|
}),
|
|
760
|
-
...
|
|
786
|
+
...Cr({
|
|
761
787
|
editor: t,
|
|
762
788
|
rules: s
|
|
763
789
|
}),
|
|
@@ -769,26 +795,26 @@ class Z {
|
|
|
769
795
|
* @returns An array of attributes
|
|
770
796
|
*/
|
|
771
797
|
get attributes() {
|
|
772
|
-
return
|
|
798
|
+
return je(this.extensions);
|
|
773
799
|
}
|
|
774
800
|
/**
|
|
775
801
|
* Get all node views from the extensions.
|
|
776
802
|
* @returns An object with all node views where the key is the node name and the value is the node view function
|
|
777
803
|
*/
|
|
778
804
|
get nodeViews() {
|
|
779
|
-
const { editor: t } = this, { nodeExtensions: n } =
|
|
805
|
+
const { editor: t } = this, { nodeExtensions: n } = Mt(this.extensions);
|
|
780
806
|
return Object.fromEntries(n.filter((r) => !!S(r, "addNodeView")).map((r) => {
|
|
781
807
|
const s = this.attributes.filter((c) => c.type === r.name), o = {
|
|
782
808
|
name: r.name,
|
|
783
809
|
options: r.options,
|
|
784
810
|
storage: r.storage,
|
|
785
811
|
editor: t,
|
|
786
|
-
type:
|
|
812
|
+
type: H(r.name, this.schema)
|
|
787
813
|
}, i = S(r, "addNodeView", o);
|
|
788
814
|
if (!i)
|
|
789
815
|
return [];
|
|
790
816
|
const a = (c, l, u, d, p) => {
|
|
791
|
-
const h =
|
|
817
|
+
const h = mt(c, s);
|
|
792
818
|
return i()({
|
|
793
819
|
// pass-through
|
|
794
820
|
node: c,
|
|
@@ -818,7 +844,7 @@ class Z {
|
|
|
818
844
|
options: t.options,
|
|
819
845
|
storage: t.storage,
|
|
820
846
|
editor: this.editor,
|
|
821
|
-
type:
|
|
847
|
+
type: Ot(t.name, this.schema)
|
|
822
848
|
};
|
|
823
849
|
t.type === "mark" && (!((n = T(S(t, "keepOnSplit", r))) !== null && n !== void 0) || n) && this.splittableMarks.push(t.name);
|
|
824
850
|
const s = S(t, "onBeforeCreate", r), o = S(t, "onCreate", r), i = S(t, "onUpdate", r), a = S(t, "onSelectionUpdate", r), c = S(t, "onTransaction", r), l = S(t, "onFocus", r), u = S(t, "onBlur", r), d = S(t, "onDestroy", r);
|
|
@@ -826,7 +852,7 @@ class Z {
|
|
|
826
852
|
});
|
|
827
853
|
}
|
|
828
854
|
}
|
|
829
|
-
class
|
|
855
|
+
class R {
|
|
830
856
|
constructor(t = {}) {
|
|
831
857
|
this.type = "extension", this.name = "extension", this.parent = null, this.child = null, this.config = {
|
|
832
858
|
name: this.name,
|
|
@@ -842,7 +868,7 @@ class P {
|
|
|
842
868
|
})) || {};
|
|
843
869
|
}
|
|
844
870
|
static create(t = {}) {
|
|
845
|
-
return new
|
|
871
|
+
return new R(t);
|
|
846
872
|
}
|
|
847
873
|
configure(t = {}) {
|
|
848
874
|
const n = this.extend({
|
|
@@ -852,7 +878,7 @@ class P {
|
|
|
852
878
|
return n.name = this.name, n.parent = this.parent, n;
|
|
853
879
|
}
|
|
854
880
|
extend(t = {}) {
|
|
855
|
-
const n = new
|
|
881
|
+
const n = new R({ ...this.config, ...t });
|
|
856
882
|
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(S(n, "addOptions", {
|
|
857
883
|
name: n.name
|
|
858
884
|
})), n.storage = T(S(n, "addStorage", {
|
|
@@ -861,7 +887,7 @@ class P {
|
|
|
861
887
|
})), n;
|
|
862
888
|
}
|
|
863
889
|
}
|
|
864
|
-
function
|
|
890
|
+
function Ve(e, t, n) {
|
|
865
891
|
const { from: r, to: s } = t, { blockSeparator: o = `
|
|
866
892
|
|
|
867
893
|
`, textSerializers: i = {} } = n || {};
|
|
@@ -881,10 +907,10 @@ function Fe(e, t, n) {
|
|
|
881
907
|
c.isText && (a += (p = c == null ? void 0 : c.text) === null || p === void 0 ? void 0 : p.slice(Math.max(r, l) - l, s - l));
|
|
882
908
|
}), a;
|
|
883
909
|
}
|
|
884
|
-
function
|
|
910
|
+
function We(e) {
|
|
885
911
|
return Object.fromEntries(Object.entries(e.nodes).filter(([, t]) => t.spec.toText).map(([t, n]) => [t, n.spec.toText]));
|
|
886
912
|
}
|
|
887
|
-
const
|
|
913
|
+
const Ar = R.create({
|
|
888
914
|
name: "clipboardTextSerializer",
|
|
889
915
|
addOptions() {
|
|
890
916
|
return {
|
|
@@ -893,12 +919,12 @@ const wr = P.create({
|
|
|
893
919
|
},
|
|
894
920
|
addProseMirrorPlugins() {
|
|
895
921
|
return [
|
|
896
|
-
new
|
|
922
|
+
new $({
|
|
897
923
|
key: new _("clipboardTextSerializer"),
|
|
898
924
|
props: {
|
|
899
925
|
clipboardTextSerializer: () => {
|
|
900
|
-
const { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: s } = t, { ranges: o } = s, i = Math.min(...o.map((u) => u.$from.pos)), a = Math.max(...o.map((u) => u.$to.pos)), c =
|
|
901
|
-
return
|
|
926
|
+
const { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: s } = t, { ranges: o } = s, i = Math.min(...o.map((u) => u.$from.pos)), a = Math.max(...o.map((u) => u.$to.pos)), c = We(n);
|
|
927
|
+
return Ve(r, { from: i, to: a }, {
|
|
902
928
|
...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
|
|
903
929
|
textSerializers: c
|
|
904
930
|
});
|
|
@@ -907,10 +933,10 @@ const wr = P.create({
|
|
|
907
933
|
})
|
|
908
934
|
];
|
|
909
935
|
}
|
|
910
|
-
}),
|
|
936
|
+
}), Or = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
|
|
911
937
|
var n;
|
|
912
938
|
e.isDestroyed || (t.dom.blur(), (n = window == null ? void 0 : window.getSelection()) === null || n === void 0 || n.removeAllRanges());
|
|
913
|
-
}), !0),
|
|
939
|
+
}), !0), Lr = (e = !1) => ({ commands: t }) => t.setContent("", e), Pr = () => ({ state: e, tr: t, dispatch: n }) => {
|
|
914
940
|
const { selection: r } = t, { ranges: s } = r;
|
|
915
941
|
return n && s.forEach(({ $from: o, $to: i }) => {
|
|
916
942
|
e.doc.nodesBetween(o.pos, i.pos, (a, c) => {
|
|
@@ -919,7 +945,7 @@ const wr = P.create({
|
|
|
919
945
|
const { doc: l, mapping: u } = t, d = l.resolve(u.map(c)), p = l.resolve(u.map(c + a.nodeSize)), h = d.blockRange(p);
|
|
920
946
|
if (!h)
|
|
921
947
|
return;
|
|
922
|
-
const f =
|
|
948
|
+
const f = dn(h);
|
|
923
949
|
if (a.type.isTextblock) {
|
|
924
950
|
const { defaultType: m } = d.parent.contentMatchAt(d.index());
|
|
925
951
|
t.setNodeMarkup(h.start, m);
|
|
@@ -927,12 +953,12 @@ const wr = P.create({
|
|
|
927
953
|
(f || f === 0) && t.lift(h, f);
|
|
928
954
|
});
|
|
929
955
|
}), !0;
|
|
930
|
-
},
|
|
956
|
+
}, Rr = (e) => (t) => e(t), $r = () => ({ state: e, dispatch: t }) => un(e, t), _r = (e, t) => ({ editor: n, tr: r }) => {
|
|
931
957
|
const { state: s } = n, o = s.doc.slice(e.from, e.to);
|
|
932
958
|
r.deleteRange(e.from, e.to);
|
|
933
959
|
const i = r.mapping.map(t);
|
|
934
960
|
return r.insert(i, o.content), r.setSelection(new I(r.doc.resolve(i - 1))), !0;
|
|
935
|
-
},
|
|
961
|
+
}, Hr = () => ({ tr: e, dispatch: t }) => {
|
|
936
962
|
const { selection: n } = e, r = n.$anchor.node();
|
|
937
963
|
if (r.content.size > 0)
|
|
938
964
|
return !1;
|
|
@@ -946,8 +972,8 @@ const wr = P.create({
|
|
|
946
972
|
return !0;
|
|
947
973
|
}
|
|
948
974
|
return !1;
|
|
949
|
-
},
|
|
950
|
-
const s =
|
|
975
|
+
}, Ir = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
976
|
+
const s = H(e, n.schema), o = t.selection.$anchor;
|
|
951
977
|
for (let i = o.depth; i > 0; i -= 1)
|
|
952
978
|
if (o.node(i).type === s) {
|
|
953
979
|
if (r) {
|
|
@@ -957,40 +983,42 @@ const wr = P.create({
|
|
|
957
983
|
return !0;
|
|
958
984
|
}
|
|
959
985
|
return !1;
|
|
960
|
-
},
|
|
986
|
+
}, Dr = (e) => ({ tr: t, dispatch: n }) => {
|
|
961
987
|
const { from: r, to: s } = e;
|
|
962
988
|
return n && t.delete(r, s), !0;
|
|
963
|
-
},
|
|
964
|
-
function
|
|
989
|
+
}, Nr = () => ({ state: e, dispatch: t }) => pn(e, t), Br = () => ({ commands: e }) => e.keyboardShortcut("Enter"), jr = () => ({ state: e, dispatch: t }) => hn(e, t);
|
|
990
|
+
function gt(e, t, n = { strict: !0 }) {
|
|
965
991
|
const r = Object.keys(t);
|
|
966
|
-
return r.length ? r.every((s) => n.strict ? t[s] === e[s] :
|
|
992
|
+
return r.length ? r.every((s) => n.strict ? t[s] === e[s] : Jt(t[s]) ? t[s].test(e[s]) : t[s] === e[s]) : !0;
|
|
967
993
|
}
|
|
968
|
-
function
|
|
969
|
-
return e.find((r) => r.type === t &&
|
|
994
|
+
function Ke(e, t, n = {}) {
|
|
995
|
+
return e.find((r) => r.type === t && gt(
|
|
996
|
+
// Only check equality for the attributes that are provided
|
|
997
|
+
Object.fromEntries(Object.keys(n).map((s) => [s, r.attrs[s]])),
|
|
998
|
+
n
|
|
999
|
+
));
|
|
970
1000
|
}
|
|
971
|
-
function
|
|
972
|
-
return !!
|
|
1001
|
+
function he(e, t, n = {}) {
|
|
1002
|
+
return !!Ke(e, t, n);
|
|
973
1003
|
}
|
|
974
|
-
function
|
|
1004
|
+
function Yt(e, t, n) {
|
|
1005
|
+
var r;
|
|
975
1006
|
if (!e || !t)
|
|
976
1007
|
return;
|
|
977
|
-
let
|
|
978
|
-
if ((!
|
|
1008
|
+
let s = e.parent.childAfter(e.parentOffset);
|
|
1009
|
+
if ((!s.node || !s.node.marks.some((u) => u.type === t)) && (s = e.parent.childBefore(e.parentOffset)), !s.node || !s.node.marks.some((u) => u.type === t) || (n = n || ((r = s.node.marks[0]) === null || r === void 0 ? void 0 : r.attrs), !Ke([...s.node.marks], t, n)))
|
|
979
1010
|
return;
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
o -= 1, i -= e.parent.child(o).nodeSize;
|
|
986
|
-
for (; a < e.parent.childCount && Ir([...e.parent.child(a).marks], t, n); )
|
|
987
|
-
c += e.parent.child(a).nodeSize, a += 1;
|
|
1011
|
+
let i = s.index, a = e.start() + s.offset, c = i + 1, l = a + s.node.nodeSize;
|
|
1012
|
+
for (; i > 0 && he([...e.parent.child(i - 1).marks], t, n); )
|
|
1013
|
+
i -= 1, a -= e.parent.child(i).nodeSize;
|
|
1014
|
+
for (; c < e.parent.childCount && he([...e.parent.child(c).marks], t, n); )
|
|
1015
|
+
l += e.parent.child(c).nodeSize, c += 1;
|
|
988
1016
|
return {
|
|
989
|
-
from:
|
|
990
|
-
to:
|
|
1017
|
+
from: a,
|
|
1018
|
+
to: l
|
|
991
1019
|
};
|
|
992
1020
|
}
|
|
993
|
-
function
|
|
1021
|
+
function U(e, t) {
|
|
994
1022
|
if (typeof e == "string") {
|
|
995
1023
|
if (!t.marks[e])
|
|
996
1024
|
throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);
|
|
@@ -998,33 +1026,33 @@ function K(e, t) {
|
|
|
998
1026
|
}
|
|
999
1027
|
return e;
|
|
1000
1028
|
}
|
|
1001
|
-
const
|
|
1002
|
-
const o =
|
|
1029
|
+
const Fr = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1030
|
+
const o = U(e, r.schema), { doc: i, selection: a } = n, { $from: c, from: l, to: u } = a;
|
|
1003
1031
|
if (s) {
|
|
1004
|
-
const d =
|
|
1032
|
+
const d = Yt(c, o, t);
|
|
1005
1033
|
if (d && d.from <= l && d.to >= u) {
|
|
1006
1034
|
const p = I.create(i, d.from, d.to);
|
|
1007
1035
|
n.setSelection(p);
|
|
1008
1036
|
}
|
|
1009
1037
|
}
|
|
1010
1038
|
return !0;
|
|
1011
|
-
},
|
|
1039
|
+
}, zr = (e) => (t) => {
|
|
1012
1040
|
const n = typeof e == "function" ? e(t) : e;
|
|
1013
1041
|
for (let r = 0; r < n.length; r += 1)
|
|
1014
1042
|
if (n[r](t))
|
|
1015
1043
|
return !0;
|
|
1016
1044
|
return !1;
|
|
1017
1045
|
};
|
|
1018
|
-
function
|
|
1046
|
+
function Xt(e) {
|
|
1019
1047
|
return e instanceof I;
|
|
1020
1048
|
}
|
|
1021
1049
|
function j(e = 0, t = 0, n = 0) {
|
|
1022
1050
|
return Math.min(Math.max(e, t), n);
|
|
1023
1051
|
}
|
|
1024
|
-
function
|
|
1052
|
+
function Ue(e, t = null) {
|
|
1025
1053
|
if (!t)
|
|
1026
1054
|
return null;
|
|
1027
|
-
const n =
|
|
1055
|
+
const n = V.atStart(e), r = V.atEnd(e);
|
|
1028
1056
|
if (t === "start" || t === !0)
|
|
1029
1057
|
return n;
|
|
1030
1058
|
if (t === "end")
|
|
@@ -1032,7 +1060,7 @@ function We(e, t = null) {
|
|
|
1032
1060
|
const s = n.from, o = r.to;
|
|
1033
1061
|
return t === "all" ? I.create(e, j(0, s, o), j(e.content.size, s, o)) : I.create(e, j(t, s, o), j(t, s, o));
|
|
1034
1062
|
}
|
|
1035
|
-
function
|
|
1063
|
+
function wt() {
|
|
1036
1064
|
return [
|
|
1037
1065
|
"iPad Simulator",
|
|
1038
1066
|
"iPhone Simulator",
|
|
@@ -1042,35 +1070,37 @@ function kt() {
|
|
|
1042
1070
|
"iPod"
|
|
1043
1071
|
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
1044
1072
|
}
|
|
1045
|
-
const
|
|
1073
|
+
const Vr = (e = null, t = {}) => ({ editor: n, view: r, tr: s, dispatch: o }) => {
|
|
1046
1074
|
t = {
|
|
1047
1075
|
scrollIntoView: !0,
|
|
1048
1076
|
...t
|
|
1049
1077
|
};
|
|
1050
1078
|
const i = () => {
|
|
1051
|
-
|
|
1079
|
+
wt() && r.dom.focus(), requestAnimationFrame(() => {
|
|
1052
1080
|
n.isDestroyed || (r.focus(), t != null && t.scrollIntoView && n.commands.scrollIntoView());
|
|
1053
1081
|
});
|
|
1054
1082
|
};
|
|
1055
1083
|
if (r.hasFocus() && e === null || e === !1)
|
|
1056
1084
|
return !0;
|
|
1057
|
-
if (o && e === null && !
|
|
1085
|
+
if (o && e === null && !Xt(n.state.selection))
|
|
1058
1086
|
return i(), !0;
|
|
1059
|
-
const a =
|
|
1087
|
+
const a = Ue(s.doc, e) || n.state.selection, c = n.state.selection.eq(a);
|
|
1060
1088
|
return o && (c || s.setSelection(a), c && s.storedMarks && s.setStoredMarks(s.storedMarks), i()), !0;
|
|
1061
|
-
},
|
|
1089
|
+
}, Wr = (e, t) => (n) => e.every((r, s) => t(r, { ...n, index: s })), Kr = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({ from: n.selection.from, to: n.selection.to }, e, t), qe = (e) => {
|
|
1062
1090
|
const t = e.childNodes;
|
|
1063
1091
|
for (let n = t.length - 1; n >= 0; n -= 1) {
|
|
1064
1092
|
const r = t[n];
|
|
1065
|
-
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 &&
|
|
1093
|
+
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && qe(r);
|
|
1066
1094
|
}
|
|
1067
1095
|
return e;
|
|
1068
1096
|
};
|
|
1069
|
-
function
|
|
1097
|
+
function ct(e) {
|
|
1070
1098
|
const t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
|
|
1071
|
-
return
|
|
1099
|
+
return qe(n);
|
|
1072
1100
|
}
|
|
1073
|
-
function
|
|
1101
|
+
function yt(e, t, n) {
|
|
1102
|
+
if (e instanceof Dn || e instanceof W)
|
|
1103
|
+
return e;
|
|
1074
1104
|
n = {
|
|
1075
1105
|
slice: !0,
|
|
1076
1106
|
parseOptions: {},
|
|
@@ -1080,18 +1110,18 @@ function gt(e, t, n) {
|
|
|
1080
1110
|
if (r)
|
|
1081
1111
|
try {
|
|
1082
1112
|
if (Array.isArray(e) && e.length > 0)
|
|
1083
|
-
return
|
|
1113
|
+
return W.fromArray(e.map((a) => t.nodeFromJSON(a)));
|
|
1084
1114
|
const i = t.nodeFromJSON(e);
|
|
1085
1115
|
return n.errorOnInvalidContent && i.check(), i;
|
|
1086
1116
|
} catch (o) {
|
|
1087
1117
|
if (n.errorOnInvalidContent)
|
|
1088
1118
|
throw new Error("[tiptap error]: Invalid JSON content", { cause: o });
|
|
1089
|
-
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", o),
|
|
1119
|
+
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", o), yt("", t, n);
|
|
1090
1120
|
}
|
|
1091
1121
|
if (s) {
|
|
1092
1122
|
if (n.errorOnInvalidContent) {
|
|
1093
1123
|
let i = !1, a = "";
|
|
1094
|
-
const c = new
|
|
1124
|
+
const c = new _e({
|
|
1095
1125
|
topNode: t.spec.topNode,
|
|
1096
1126
|
marks: t.spec.marks,
|
|
1097
1127
|
// Prosemirror's schemas are executed such that: the last to execute, matches last
|
|
@@ -1109,28 +1139,28 @@ function gt(e, t, n) {
|
|
|
1109
1139
|
}
|
|
1110
1140
|
})
|
|
1111
1141
|
});
|
|
1112
|
-
if (n.slice ?
|
|
1142
|
+
if (n.slice ? At.fromSchema(c).parseSlice(ct(e), n.parseOptions) : At.fromSchema(c).parse(ct(e), n.parseOptions), n.errorOnInvalidContent && i)
|
|
1113
1143
|
throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${a}`) });
|
|
1114
1144
|
}
|
|
1115
|
-
const o =
|
|
1116
|
-
return n.slice ? o.parseSlice(
|
|
1145
|
+
const o = At.fromSchema(t);
|
|
1146
|
+
return n.slice ? o.parseSlice(ct(e), n.parseOptions).content : o.parse(ct(e), n.parseOptions);
|
|
1117
1147
|
}
|
|
1118
|
-
return
|
|
1148
|
+
return yt("", t, n);
|
|
1119
1149
|
}
|
|
1120
|
-
function
|
|
1150
|
+
function Ur(e, t, n) {
|
|
1121
1151
|
const r = e.steps.length - 1;
|
|
1122
1152
|
if (r < t)
|
|
1123
1153
|
return;
|
|
1124
1154
|
const s = e.steps[r];
|
|
1125
|
-
if (!(s instanceof
|
|
1155
|
+
if (!(s instanceof Nn || s instanceof Bn))
|
|
1126
1156
|
return;
|
|
1127
1157
|
const o = e.mapping.maps[r];
|
|
1128
1158
|
let i = 0;
|
|
1129
1159
|
o.forEach((a, c, l, u) => {
|
|
1130
1160
|
i === 0 && (i = u);
|
|
1131
|
-
}), e.setSelection(
|
|
1161
|
+
}), e.setSelection(V.near(e.doc.resolve(i), n));
|
|
1132
1162
|
}
|
|
1133
|
-
const
|
|
1163
|
+
const qr = (e) => !("type" in e), Gr = (e, t, n) => ({ tr: r, dispatch: s, editor: o }) => {
|
|
1134
1164
|
var i;
|
|
1135
1165
|
if (s) {
|
|
1136
1166
|
n = {
|
|
@@ -1142,7 +1172,7 @@ const Wr = (e) => !("type" in e), Vr = (e, t, n) => ({ tr: r, dispatch: s, edito
|
|
|
1142
1172
|
};
|
|
1143
1173
|
let a;
|
|
1144
1174
|
try {
|
|
1145
|
-
a =
|
|
1175
|
+
a = yt(t, o.schema, {
|
|
1146
1176
|
parseOptions: {
|
|
1147
1177
|
preserveWhitespace: "full",
|
|
1148
1178
|
...n.parseOptions
|
|
@@ -1159,35 +1189,47 @@ const Wr = (e) => !("type" in e), Vr = (e, t, n) => ({ tr: r, dispatch: s, edito
|
|
|
1159
1189
|
}), !1;
|
|
1160
1190
|
}
|
|
1161
1191
|
let { from: c, to: l } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, u = !0, d = !0;
|
|
1162
|
-
if ((
|
|
1192
|
+
if ((qr(a) ? a : [a]).forEach((f) => {
|
|
1163
1193
|
f.check(), u = u ? f.isText && f.marks.length === 0 : !1, d = d ? f.isBlock : !1;
|
|
1164
1194
|
}), c === l && d) {
|
|
1165
1195
|
const { parent: f } = r.doc.resolve(c);
|
|
1166
1196
|
f.isTextblock && !f.type.spec.code && !f.childCount && (c -= 1, l += 1);
|
|
1167
1197
|
}
|
|
1168
1198
|
let h;
|
|
1169
|
-
|
|
1199
|
+
if (u) {
|
|
1200
|
+
if (Array.isArray(t))
|
|
1201
|
+
h = t.map((f) => f.text || "").join("");
|
|
1202
|
+
else if (t instanceof W) {
|
|
1203
|
+
let f = "";
|
|
1204
|
+
t.forEach((m) => {
|
|
1205
|
+
m.text && (f += m.text);
|
|
1206
|
+
}), h = f;
|
|
1207
|
+
} else typeof t == "object" && t && t.text ? h = t.text : h = t;
|
|
1208
|
+
r.insertText(h, c, l);
|
|
1209
|
+
} else
|
|
1210
|
+
h = a, r.replaceWith(c, l, h);
|
|
1211
|
+
n.updateSelection && Ur(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: c, text: h }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: c, text: h });
|
|
1170
1212
|
}
|
|
1171
1213
|
return !0;
|
|
1172
|
-
},
|
|
1214
|
+
}, Jr = () => ({ state: e, dispatch: t }) => fn(e, t), Yr = () => ({ state: e, dispatch: t }) => mn(e, t), Xr = () => ({ state: e, dispatch: t }) => gn(e, t), Qr = () => ({ state: e, dispatch: t }) => yn(e, t), Zr = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
1173
1215
|
try {
|
|
1174
|
-
const r =
|
|
1216
|
+
const r = $e(e.doc, e.selection.$from.pos, -1);
|
|
1175
1217
|
return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
1176
1218
|
} catch {
|
|
1177
1219
|
return !1;
|
|
1178
1220
|
}
|
|
1179
|
-
},
|
|
1221
|
+
}, ts = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
1180
1222
|
try {
|
|
1181
|
-
const r =
|
|
1223
|
+
const r = $e(e.doc, e.selection.$from.pos, 1);
|
|
1182
1224
|
return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
1183
1225
|
} catch {
|
|
1184
1226
|
return !1;
|
|
1185
1227
|
}
|
|
1186
|
-
},
|
|
1187
|
-
function
|
|
1228
|
+
}, es = () => ({ state: e, dispatch: t }) => vn(e, t), ns = () => ({ state: e, dispatch: t }) => bn(e, t);
|
|
1229
|
+
function Ge() {
|
|
1188
1230
|
return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
|
|
1189
1231
|
}
|
|
1190
|
-
function
|
|
1232
|
+
function rs(e) {
|
|
1191
1233
|
const t = e.split(/-(?!$)/);
|
|
1192
1234
|
let n = t[t.length - 1];
|
|
1193
1235
|
n === "Space" && (n = " ");
|
|
@@ -1203,14 +1245,14 @@ function Zr(e) {
|
|
|
1203
1245
|
else if (/^s(hift)?$/i.test(c))
|
|
1204
1246
|
o = !0;
|
|
1205
1247
|
else if (/^mod$/i.test(c))
|
|
1206
|
-
|
|
1248
|
+
wt() || Ge() ? i = !0 : s = !0;
|
|
1207
1249
|
else
|
|
1208
1250
|
throw new Error(`Unrecognized modifier name: ${c}`);
|
|
1209
1251
|
}
|
|
1210
1252
|
return r && (n = `Alt-${n}`), s && (n = `Ctrl-${n}`), i && (n = `Meta-${n}`), o && (n = `Shift-${n}`), n;
|
|
1211
1253
|
}
|
|
1212
|
-
const
|
|
1213
|
-
const o =
|
|
1254
|
+
const ss = (e) => ({ editor: t, view: n, tr: r, dispatch: s }) => {
|
|
1255
|
+
const o = rs(e).split(/-(?!$)/), i = o.find((l) => !["Alt", "Ctrl", "Meta", "Shift"].includes(l)), a = new KeyboardEvent("keydown", {
|
|
1214
1256
|
key: i === "Space" ? " " : i,
|
|
1215
1257
|
altKey: o.includes("Alt"),
|
|
1216
1258
|
ctrlKey: o.includes("Ctrl"),
|
|
@@ -1226,8 +1268,8 @@ const ts = (e) => ({ editor: t, view: n, tr: r, dispatch: s }) => {
|
|
|
1226
1268
|
u && s && r.maybeStep(u);
|
|
1227
1269
|
}), !0;
|
|
1228
1270
|
};
|
|
1229
|
-
function
|
|
1230
|
-
const { from: r, to: s, empty: o } = e.selection, i = t ?
|
|
1271
|
+
function ot(e, t, n = {}) {
|
|
1272
|
+
const { from: r, to: s, empty: o } = e.selection, i = t ? H(t, e.schema) : null, a = [];
|
|
1231
1273
|
e.doc.nodesBetween(r, s, (d, p) => {
|
|
1232
1274
|
if (d.isText)
|
|
1233
1275
|
return;
|
|
@@ -1238,45 +1280,45 @@ function rt(e, t, n = {}) {
|
|
|
1238
1280
|
to: f
|
|
1239
1281
|
});
|
|
1240
1282
|
});
|
|
1241
|
-
const c = s - r, l = a.filter((d) => i ? i.name === d.node.type.name : !0).filter((d) =>
|
|
1283
|
+
const c = s - r, l = a.filter((d) => i ? i.name === d.node.type.name : !0).filter((d) => gt(d.node.attrs, n, { strict: !1 }));
|
|
1242
1284
|
return o ? !!l.length : l.reduce((d, p) => d + p.to - p.from, 0) >= c;
|
|
1243
1285
|
}
|
|
1244
|
-
const
|
|
1245
|
-
const s =
|
|
1246
|
-
return
|
|
1247
|
-
},
|
|
1248
|
-
const r =
|
|
1249
|
-
return
|
|
1250
|
-
},
|
|
1251
|
-
function
|
|
1286
|
+
const os = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1287
|
+
const s = H(e, n.schema);
|
|
1288
|
+
return ot(n, s, t) ? Mn(n, r) : !1;
|
|
1289
|
+
}, is = () => ({ state: e, dispatch: t }) => kn(e, t), as = (e) => ({ state: t, dispatch: n }) => {
|
|
1290
|
+
const r = H(e, t.schema);
|
|
1291
|
+
return Sn(r)(t, n);
|
|
1292
|
+
}, ls = () => ({ state: e, dispatch: t }) => wn(e, t);
|
|
1293
|
+
function Et(e, t) {
|
|
1252
1294
|
return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
|
|
1253
1295
|
}
|
|
1254
|
-
function
|
|
1296
|
+
function fe(e, t) {
|
|
1255
1297
|
const n = typeof t == "string" ? [t] : t;
|
|
1256
1298
|
return Object.keys(e).reduce((r, s) => (n.includes(s) || (r[s] = e[s]), r), {});
|
|
1257
1299
|
}
|
|
1258
|
-
const
|
|
1300
|
+
const cs = (e, t) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1259
1301
|
let o = null, i = null;
|
|
1260
|
-
const a =
|
|
1261
|
-
return a ? (a === "node" && (o =
|
|
1302
|
+
const a = Et(typeof e == "string" ? e : e.name, r.schema);
|
|
1303
|
+
return a ? (a === "node" && (o = H(e, r.schema)), a === "mark" && (i = U(e, r.schema)), s && n.selection.ranges.forEach((c) => {
|
|
1262
1304
|
r.doc.nodesBetween(c.$from.pos, c.$to.pos, (l, u) => {
|
|
1263
|
-
o && o === l.type && n.setNodeMarkup(u, void 0,
|
|
1264
|
-
i === d.type && n.addMark(u, u + l.nodeSize, i.create(
|
|
1305
|
+
o && o === l.type && n.setNodeMarkup(u, void 0, fe(l.attrs, t)), i && l.marks.length && l.marks.forEach((d) => {
|
|
1306
|
+
i === d.type && n.addMark(u, u + l.nodeSize, i.create(fe(d.attrs, t)));
|
|
1265
1307
|
});
|
|
1266
1308
|
});
|
|
1267
1309
|
}), !0) : !1;
|
|
1268
|
-
},
|
|
1310
|
+
}, ds = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), us = () => ({ tr: e, commands: t }) => t.setTextSelection({
|
|
1269
1311
|
from: 0,
|
|
1270
1312
|
to: e.doc.content.size
|
|
1271
|
-
}),
|
|
1313
|
+
}), ps = () => ({ state: e, dispatch: t }) => En(e, t), hs = () => ({ state: e, dispatch: t }) => Tn(e, t), fs = () => ({ state: e, dispatch: t }) => Cn(e, t), ms = () => ({ state: e, dispatch: t }) => xn(e, t), gs = () => ({ state: e, dispatch: t }) => An(e, t);
|
|
1272
1314
|
function Dt(e, t, n = {}, r = {}) {
|
|
1273
|
-
return
|
|
1315
|
+
return yt(e, t, {
|
|
1274
1316
|
slice: !1,
|
|
1275
1317
|
parseOptions: n,
|
|
1276
1318
|
errorOnInvalidContent: r.errorOnInvalidContent
|
|
1277
1319
|
});
|
|
1278
1320
|
}
|
|
1279
|
-
const
|
|
1321
|
+
const ys = (e, t = !1, n = {}, r = {}) => ({ editor: s, tr: o, dispatch: i, commands: a }) => {
|
|
1280
1322
|
var c, l;
|
|
1281
1323
|
const { doc: u } = o;
|
|
1282
1324
|
if (n.preserveWhitespace !== "full") {
|
|
@@ -1290,23 +1332,23 @@ const hs = (e, t = !1, n = {}, r = {}) => ({ editor: s, tr: o, dispatch: i, comm
|
|
|
1290
1332
|
errorOnInvalidContent: (l = r.errorOnInvalidContent) !== null && l !== void 0 ? l : s.options.enableContentCheck
|
|
1291
1333
|
});
|
|
1292
1334
|
};
|
|
1293
|
-
function
|
|
1294
|
-
const n =
|
|
1335
|
+
function Qt(e, t) {
|
|
1336
|
+
const n = U(t, e.schema), { from: r, to: s, empty: o } = e.selection, i = [];
|
|
1295
1337
|
o ? (e.storedMarks && i.push(...e.storedMarks), i.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, s, (c) => {
|
|
1296
1338
|
i.push(...c.marks);
|
|
1297
1339
|
});
|
|
1298
1340
|
const a = i.find((c) => c.type.name === n.name);
|
|
1299
1341
|
return a ? { ...a.attrs } : {};
|
|
1300
1342
|
}
|
|
1301
|
-
function
|
|
1302
|
-
const n = new
|
|
1343
|
+
function vs(e, t) {
|
|
1344
|
+
const n = new cn(e);
|
|
1303
1345
|
return t.forEach((r) => {
|
|
1304
1346
|
r.steps.forEach((s) => {
|
|
1305
1347
|
n.step(s);
|
|
1306
1348
|
});
|
|
1307
1349
|
}), n;
|
|
1308
1350
|
}
|
|
1309
|
-
function
|
|
1351
|
+
function bs(e) {
|
|
1310
1352
|
for (let t = 0; t < e.edgeCount; t += 1) {
|
|
1311
1353
|
const { type: n } = e.edge(t);
|
|
1312
1354
|
if (n.isTextblock && !n.hasRequiredAttrs())
|
|
@@ -1314,7 +1356,7 @@ function ms(e) {
|
|
|
1314
1356
|
}
|
|
1315
1357
|
return null;
|
|
1316
1358
|
}
|
|
1317
|
-
function
|
|
1359
|
+
function Si(e, t) {
|
|
1318
1360
|
const n = [];
|
|
1319
1361
|
return e.descendants((r, s) => {
|
|
1320
1362
|
t(r) && n.push({
|
|
@@ -1323,7 +1365,7 @@ function vi(e, t) {
|
|
|
1323
1365
|
});
|
|
1324
1366
|
}), n;
|
|
1325
1367
|
}
|
|
1326
|
-
function
|
|
1368
|
+
function Ms(e, t, n) {
|
|
1327
1369
|
const r = [];
|
|
1328
1370
|
return e.nodesBetween(t.from, t.to, (s, o) => {
|
|
1329
1371
|
n(s) && r.push({
|
|
@@ -1332,7 +1374,7 @@ function gs(e, t, n) {
|
|
|
1332
1374
|
});
|
|
1333
1375
|
}), r;
|
|
1334
1376
|
}
|
|
1335
|
-
function
|
|
1377
|
+
function Je(e, t) {
|
|
1336
1378
|
for (let n = e.depth; n > 0; n -= 1) {
|
|
1337
1379
|
const r = e.node(n);
|
|
1338
1380
|
if (t(r))
|
|
@@ -1344,44 +1386,40 @@ function qe(e, t) {
|
|
|
1344
1386
|
};
|
|
1345
1387
|
}
|
|
1346
1388
|
}
|
|
1347
|
-
function
|
|
1348
|
-
return (t) =>
|
|
1349
|
-
}
|
|
1350
|
-
function ys(e, t) {
|
|
1351
|
-
const n = $n.fromSchema(t).serializeFragment(e), s = document.implementation.createHTMLDocument().createElement("div");
|
|
1352
|
-
return s.appendChild(n), s.innerHTML;
|
|
1389
|
+
function Zt(e) {
|
|
1390
|
+
return (t) => Je(t.$from, e);
|
|
1353
1391
|
}
|
|
1354
|
-
function
|
|
1392
|
+
function ks(e, t) {
|
|
1355
1393
|
const n = {
|
|
1356
1394
|
from: 0,
|
|
1357
1395
|
to: e.content.size
|
|
1358
1396
|
};
|
|
1359
|
-
return
|
|
1397
|
+
return Ve(e, n, t);
|
|
1360
1398
|
}
|
|
1361
|
-
function
|
|
1362
|
-
const n =
|
|
1399
|
+
function Ss(e, t) {
|
|
1400
|
+
const n = H(t, e.schema), { from: r, to: s } = e.selection, o = [];
|
|
1363
1401
|
e.doc.nodesBetween(r, s, (a) => {
|
|
1364
1402
|
o.push(a);
|
|
1365
1403
|
});
|
|
1366
1404
|
const i = o.reverse().find((a) => a.type.name === n.name);
|
|
1367
1405
|
return i ? { ...i.attrs } : {};
|
|
1368
1406
|
}
|
|
1369
|
-
function
|
|
1370
|
-
const n =
|
|
1371
|
-
return n === "node" ?
|
|
1407
|
+
function Ye(e, t) {
|
|
1408
|
+
const n = Et(typeof t == "string" ? t : t.name, e.schema);
|
|
1409
|
+
return n === "node" ? Ss(e, t) : n === "mark" ? Qt(e, t) : {};
|
|
1372
1410
|
}
|
|
1373
|
-
function
|
|
1411
|
+
function ws(e, t = JSON.stringify) {
|
|
1374
1412
|
const n = {};
|
|
1375
1413
|
return e.filter((r) => {
|
|
1376
1414
|
const s = t(r);
|
|
1377
1415
|
return Object.prototype.hasOwnProperty.call(n, s) ? !1 : n[s] = !0;
|
|
1378
1416
|
});
|
|
1379
1417
|
}
|
|
1380
|
-
function
|
|
1381
|
-
const t =
|
|
1418
|
+
function Es(e) {
|
|
1419
|
+
const t = ws(e);
|
|
1382
1420
|
return t.length === 1 ? t : t.filter((n, r) => !t.filter((o, i) => i !== r).some((o) => n.oldRange.from >= o.oldRange.from && n.oldRange.to <= o.oldRange.to && n.newRange.from >= o.newRange.from && n.newRange.to <= o.newRange.to));
|
|
1383
1421
|
}
|
|
1384
|
-
function
|
|
1422
|
+
function Ts(e) {
|
|
1385
1423
|
const { mapping: t, steps: n } = e, r = [];
|
|
1386
1424
|
return t.maps.forEach((s, o) => {
|
|
1387
1425
|
const i = [];
|
|
@@ -1408,12 +1446,12 @@ function ks(e) {
|
|
|
1408
1446
|
}
|
|
1409
1447
|
});
|
|
1410
1448
|
});
|
|
1411
|
-
}),
|
|
1449
|
+
}), Es(r);
|
|
1412
1450
|
}
|
|
1413
|
-
function
|
|
1451
|
+
function te(e, t, n) {
|
|
1414
1452
|
const r = [];
|
|
1415
1453
|
return e === t ? n.resolve(e).marks().forEach((s) => {
|
|
1416
|
-
const o = n.resolve(e), i =
|
|
1454
|
+
const o = n.resolve(e), i = Yt(o, s.type);
|
|
1417
1455
|
i && r.push({
|
|
1418
1456
|
mark: s,
|
|
1419
1457
|
...i
|
|
@@ -1426,16 +1464,16 @@ function Qt(e, t, n) {
|
|
|
1426
1464
|
})));
|
|
1427
1465
|
}), r;
|
|
1428
1466
|
}
|
|
1429
|
-
function
|
|
1467
|
+
function ht(e, t, n) {
|
|
1430
1468
|
return Object.fromEntries(Object.entries(n).filter(([r]) => {
|
|
1431
1469
|
const s = e.find((o) => o.type === t && o.name === r);
|
|
1432
1470
|
return s ? s.attribute.keepOnSplit : !1;
|
|
1433
1471
|
}));
|
|
1434
1472
|
}
|
|
1435
1473
|
function Nt(e, t, n = {}) {
|
|
1436
|
-
const { empty: r, ranges: s } = e.selection, o = t ?
|
|
1474
|
+
const { empty: r, ranges: s } = e.selection, o = t ? U(t, e.schema) : null;
|
|
1437
1475
|
if (r)
|
|
1438
|
-
return !!(e.storedMarks || e.selection.$from.marks()).filter((d) => o ? o.name === d.type.name : !0).find((d) =>
|
|
1476
|
+
return !!(e.storedMarks || e.selection.$from.marks()).filter((d) => o ? o.name === d.type.name : !0).find((d) => gt(d.attrs, n, { strict: !1 }));
|
|
1439
1477
|
let i = 0;
|
|
1440
1478
|
const a = [];
|
|
1441
1479
|
if (s.forEach(({ $from: d, $to: p }) => {
|
|
@@ -1443,26 +1481,26 @@ function Nt(e, t, n = {}) {
|
|
|
1443
1481
|
e.doc.nodesBetween(h, f, (m, g) => {
|
|
1444
1482
|
if (!m.isText && !m.marks.length)
|
|
1445
1483
|
return;
|
|
1446
|
-
const y = Math.max(h, g),
|
|
1447
|
-
i +=
|
|
1448
|
-
mark:
|
|
1484
|
+
const y = Math.max(h, g), M = Math.min(f, g + m.nodeSize), v = M - y;
|
|
1485
|
+
i += v, a.push(...m.marks.map((b) => ({
|
|
1486
|
+
mark: b,
|
|
1449
1487
|
from: y,
|
|
1450
|
-
to:
|
|
1488
|
+
to: M
|
|
1451
1489
|
})));
|
|
1452
1490
|
});
|
|
1453
1491
|
}), i === 0)
|
|
1454
1492
|
return !1;
|
|
1455
|
-
const c = a.filter((d) => o ? o.name === d.mark.type.name : !0).filter((d) =>
|
|
1493
|
+
const c = a.filter((d) => o ? o.name === d.mark.type.name : !0).filter((d) => gt(d.mark.attrs, n, { strict: !1 })).reduce((d, p) => d + p.to - p.from, 0), l = a.filter((d) => o ? d.mark.type !== o && d.mark.type.excludes(o) : !0).reduce((d, p) => d + p.to - p.from, 0);
|
|
1456
1494
|
return (c > 0 ? c + l : c) >= i;
|
|
1457
1495
|
}
|
|
1458
|
-
function
|
|
1496
|
+
function Cs(e, t, n = {}) {
|
|
1459
1497
|
if (!t)
|
|
1460
|
-
return
|
|
1461
|
-
const r =
|
|
1462
|
-
return r === "node" ?
|
|
1498
|
+
return ot(e, null, n) || Nt(e, null, n);
|
|
1499
|
+
const r = Et(t, e.schema);
|
|
1500
|
+
return r === "node" ? ot(e, t, n) : r === "mark" ? Nt(e, t, n) : !1;
|
|
1463
1501
|
}
|
|
1464
|
-
function
|
|
1465
|
-
const { nodeExtensions: n } =
|
|
1502
|
+
function me(e, t) {
|
|
1503
|
+
const { nodeExtensions: n } = Mt(t), r = n.find((i) => i.name === e);
|
|
1466
1504
|
if (!r)
|
|
1467
1505
|
return !1;
|
|
1468
1506
|
const s = {
|
|
@@ -1472,7 +1510,7 @@ function pe(e, t) {
|
|
|
1472
1510
|
}, o = T(S(r, "group", s));
|
|
1473
1511
|
return typeof o != "string" ? !1 : o.split(" ").includes("list");
|
|
1474
1512
|
}
|
|
1475
|
-
function
|
|
1513
|
+
function Tt(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
1476
1514
|
var r;
|
|
1477
1515
|
if (n) {
|
|
1478
1516
|
if (e.type.name === "hardBreak")
|
|
@@ -1489,15 +1527,15 @@ function Et(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1489
1527
|
if (t) {
|
|
1490
1528
|
let s = !0;
|
|
1491
1529
|
return e.content.forEach((o) => {
|
|
1492
|
-
s !== !1 && (
|
|
1530
|
+
s !== !1 && (Tt(o, { ignoreWhitespace: n, checkChildren: t }) || (s = !1));
|
|
1493
1531
|
}), s;
|
|
1494
1532
|
}
|
|
1495
1533
|
return !1;
|
|
1496
1534
|
}
|
|
1497
|
-
function
|
|
1498
|
-
return e instanceof
|
|
1535
|
+
function Xe(e) {
|
|
1536
|
+
return e instanceof et;
|
|
1499
1537
|
}
|
|
1500
|
-
function
|
|
1538
|
+
function xs(e, t, n) {
|
|
1501
1539
|
const s = e.state.doc.content.size, o = j(t, 0, s), i = j(n, 0, s), a = e.coordsAtPos(o), c = e.coordsAtPos(i, -1), l = Math.min(a.top, c.top), u = Math.max(a.bottom, c.bottom), d = Math.min(a.left, c.left), p = Math.max(a.right, c.right), h = p - d, f = u - l, y = {
|
|
1502
1540
|
top: l,
|
|
1503
1541
|
bottom: u,
|
|
@@ -1513,11 +1551,11 @@ function Es(e, t, n) {
|
|
|
1513
1551
|
toJSON: () => y
|
|
1514
1552
|
};
|
|
1515
1553
|
}
|
|
1516
|
-
function
|
|
1554
|
+
function As(e, t, n) {
|
|
1517
1555
|
var r;
|
|
1518
1556
|
const { selection: s } = t;
|
|
1519
1557
|
let o = null;
|
|
1520
|
-
if (
|
|
1558
|
+
if (Xt(s) && (o = s.$cursor), o) {
|
|
1521
1559
|
const a = (r = e.storedMarks) !== null && r !== void 0 ? r : o.marks();
|
|
1522
1560
|
return !!n.isInSet(a) || !a.some((c) => c.type.excludes(n));
|
|
1523
1561
|
}
|
|
@@ -1535,11 +1573,11 @@ function Ts(e, t, n) {
|
|
|
1535
1573
|
}), l;
|
|
1536
1574
|
});
|
|
1537
1575
|
}
|
|
1538
|
-
const
|
|
1539
|
-
const { selection: o } = n, { empty: i, ranges: a } = o, c =
|
|
1576
|
+
const Os = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1577
|
+
const { selection: o } = n, { empty: i, ranges: a } = o, c = U(e, r.schema);
|
|
1540
1578
|
if (s)
|
|
1541
1579
|
if (i) {
|
|
1542
|
-
const l =
|
|
1580
|
+
const l = Qt(r, c);
|
|
1543
1581
|
n.addStoredMark(c.create({
|
|
1544
1582
|
...l,
|
|
1545
1583
|
...t
|
|
@@ -1557,47 +1595,48 @@ const Cs = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
|
1557
1595
|
}) : n.addMark(f, m, c.create(t));
|
|
1558
1596
|
});
|
|
1559
1597
|
});
|
|
1560
|
-
return
|
|
1561
|
-
},
|
|
1562
|
-
const o =
|
|
1563
|
-
|
|
1564
|
-
|
|
1598
|
+
return As(r, n, c);
|
|
1599
|
+
}, Ls = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), Ps = (e, t = {}) => ({ state: n, dispatch: r, chain: s }) => {
|
|
1600
|
+
const o = H(e, n.schema);
|
|
1601
|
+
let i;
|
|
1602
|
+
return n.selection.$anchor.sameParent(n.selection.$head) && (i = n.selection.$anchor.parent.attrs), o.isTextblock ? s().command(({ commands: a }) => se(o, { ...i, ...t })(n) ? !0 : a.clearNodes()).command(({ state: a }) => se(o, { ...i, ...t })(a, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
|
|
1603
|
+
}, Rs = (e) => ({ tr: t, dispatch: n }) => {
|
|
1565
1604
|
if (n) {
|
|
1566
|
-
const { doc: r } = t, s = j(e, 0, r.content.size), o =
|
|
1605
|
+
const { doc: r } = t, s = j(e, 0, r.content.size), o = et.create(r, s);
|
|
1567
1606
|
t.setSelection(o);
|
|
1568
1607
|
}
|
|
1569
1608
|
return !0;
|
|
1570
|
-
},
|
|
1609
|
+
}, $s = (e) => ({ tr: t, dispatch: n }) => {
|
|
1571
1610
|
if (n) {
|
|
1572
1611
|
const { doc: r } = t, { from: s, to: o } = typeof e == "number" ? { from: e, to: e } : e, i = I.atStart(r).from, a = I.atEnd(r).to, c = j(s, i, a), l = j(o, i, a), u = I.create(r, c, l);
|
|
1573
1612
|
t.setSelection(u);
|
|
1574
1613
|
}
|
|
1575
1614
|
return !0;
|
|
1576
|
-
},
|
|
1577
|
-
const r =
|
|
1578
|
-
return
|
|
1615
|
+
}, _s = (e) => ({ state: t, dispatch: n }) => {
|
|
1616
|
+
const r = H(e, t.schema);
|
|
1617
|
+
return On(r)(t, n);
|
|
1579
1618
|
};
|
|
1580
|
-
function
|
|
1619
|
+
function ge(e, t) {
|
|
1581
1620
|
const n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
|
|
1582
1621
|
if (n) {
|
|
1583
1622
|
const r = n.filter((s) => t == null ? void 0 : t.includes(s.type.name));
|
|
1584
1623
|
e.tr.ensureMarks(r);
|
|
1585
1624
|
}
|
|
1586
1625
|
}
|
|
1587
|
-
const
|
|
1588
|
-
const { selection: o, doc: i } = t, { $from: a, $to: c } = o, l = s.extensionManager.attributes, u =
|
|
1589
|
-
if (o instanceof
|
|
1590
|
-
return !a.parentOffset || !
|
|
1626
|
+
const Hs = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: s }) => {
|
|
1627
|
+
const { selection: o, doc: i } = t, { $from: a, $to: c } = o, l = s.extensionManager.attributes, u = ht(l, a.node().type.name, a.node().attrs);
|
|
1628
|
+
if (o instanceof et && o.node.isBlock)
|
|
1629
|
+
return !a.parentOffset || !pt(i, a.pos) ? !1 : (r && (e && ge(n, s.extensionManager.splittableMarks), t.split(a.pos).scrollIntoView()), !0);
|
|
1591
1630
|
if (!a.parent.isBlock)
|
|
1592
1631
|
return !1;
|
|
1593
|
-
const d = c.parentOffset === c.parent.content.size, p = a.depth === 0 ? void 0 :
|
|
1632
|
+
const d = c.parentOffset === c.parent.content.size, p = a.depth === 0 ? void 0 : bs(a.node(-1).contentMatchAt(a.indexAfter(-1)));
|
|
1594
1633
|
let h = d && p ? [
|
|
1595
1634
|
{
|
|
1596
1635
|
type: p,
|
|
1597
1636
|
attrs: u
|
|
1598
1637
|
}
|
|
1599
|
-
] : void 0, f =
|
|
1600
|
-
if (!h && !f &&
|
|
1638
|
+
] : void 0, f = pt(t.doc, t.mapping.map(a.pos), 1, h);
|
|
1639
|
+
if (!h && !f && pt(t.doc, t.mapping.map(a.pos), 1, p ? [{ type: p }] : void 0) && (f = !0, h = p ? [
|
|
1601
1640
|
{
|
|
1602
1641
|
type: p,
|
|
1603
1642
|
attrs: u
|
|
@@ -1607,12 +1646,12 @@ const Ps = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1607
1646
|
const m = t.mapping.map(a.before()), g = t.doc.resolve(m);
|
|
1608
1647
|
a.node(-1).canReplaceWith(g.index(), g.index() + 1, p) && t.setNodeMarkup(t.mapping.map(a.before()), p);
|
|
1609
1648
|
}
|
|
1610
|
-
e &&
|
|
1649
|
+
e && ge(n, s.extensionManager.splittableMarks), t.scrollIntoView();
|
|
1611
1650
|
}
|
|
1612
1651
|
return f;
|
|
1613
|
-
},
|
|
1652
|
+
}, Is = (e, t = {}) => ({ tr: n, state: r, dispatch: s, editor: o }) => {
|
|
1614
1653
|
var i;
|
|
1615
|
-
const a =
|
|
1654
|
+
const a = H(e, r.schema), { $from: c, $to: l } = r.selection, u = r.selection.node;
|
|
1616
1655
|
if (u && u.isBlock || c.depth < 2 || !c.sameParent(l))
|
|
1617
1656
|
return !1;
|
|
1618
1657
|
const d = c.node(-1);
|
|
@@ -1623,31 +1662,31 @@ const Ps = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1623
1662
|
if (c.depth === 2 || c.node(-3).type !== a || c.index(-2) !== c.node(-2).childCount - 1)
|
|
1624
1663
|
return !1;
|
|
1625
1664
|
if (s) {
|
|
1626
|
-
let y =
|
|
1627
|
-
const
|
|
1628
|
-
for (let A = c.depth -
|
|
1629
|
-
y =
|
|
1630
|
-
const
|
|
1631
|
-
...
|
|
1665
|
+
let y = W.empty;
|
|
1666
|
+
const M = c.index(-1) ? 1 : c.index(-2) ? 2 : 3;
|
|
1667
|
+
for (let A = c.depth - M; A >= c.depth - 3; A -= 1)
|
|
1668
|
+
y = W.from(c.node(A).copy(y));
|
|
1669
|
+
const v = c.indexAfter(-1) < c.node(-2).childCount ? 1 : c.indexAfter(-2) < c.node(-3).childCount ? 2 : 3, b = {
|
|
1670
|
+
...ht(p, c.node().type.name, c.node().attrs),
|
|
1632
1671
|
...t
|
|
1633
|
-
},
|
|
1634
|
-
y = y.append(
|
|
1635
|
-
const
|
|
1636
|
-
n.replace(
|
|
1672
|
+
}, w = ((i = a.contentMatch.defaultType) === null || i === void 0 ? void 0 : i.createAndFill(b)) || void 0;
|
|
1673
|
+
y = y.append(W.from(a.createAndFill(null, w) || void 0));
|
|
1674
|
+
const k = c.before(c.depth - (M - 1));
|
|
1675
|
+
n.replace(k, c.after(-v), new Ln(y, 4 - M, 0));
|
|
1637
1676
|
let C = -1;
|
|
1638
|
-
n.doc.nodesBetween(
|
|
1677
|
+
n.doc.nodesBetween(k, n.doc.content.size, (A, E) => {
|
|
1639
1678
|
if (C > -1)
|
|
1640
1679
|
return !1;
|
|
1641
|
-
A.isTextblock && A.content.size === 0 && (C =
|
|
1680
|
+
A.isTextblock && A.content.size === 0 && (C = E + 1);
|
|
1642
1681
|
}), C > -1 && n.setSelection(I.near(n.doc.resolve(C))), n.scrollIntoView();
|
|
1643
1682
|
}
|
|
1644
1683
|
return !0;
|
|
1645
1684
|
}
|
|
1646
1685
|
const h = l.pos === c.end() ? d.contentMatchAt(0).defaultType : null, f = {
|
|
1647
|
-
...
|
|
1686
|
+
...ht(p, d.type.name, d.attrs),
|
|
1648
1687
|
...t
|
|
1649
1688
|
}, m = {
|
|
1650
|
-
...
|
|
1689
|
+
...ht(p, c.node().type.name, c.node().attrs),
|
|
1651
1690
|
...t
|
|
1652
1691
|
};
|
|
1653
1692
|
n.delete(c.pos, l.pos);
|
|
@@ -1655,18 +1694,18 @@ const Ps = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1655
1694
|
{ type: a, attrs: f },
|
|
1656
1695
|
{ type: h, attrs: m }
|
|
1657
1696
|
] : [{ type: a, attrs: f }];
|
|
1658
|
-
if (!
|
|
1697
|
+
if (!pt(n.doc, c.pos, 2))
|
|
1659
1698
|
return !1;
|
|
1660
1699
|
if (s) {
|
|
1661
|
-
const { selection: y, storedMarks:
|
|
1662
|
-
if (n.split(c.pos, 2, g).scrollIntoView(), !
|
|
1700
|
+
const { selection: y, storedMarks: M } = r, { splittableMarks: v } = o.extensionManager, b = M || y.$to.parentOffset && y.$from.marks();
|
|
1701
|
+
if (n.split(c.pos, 2, g).scrollIntoView(), !b || !s)
|
|
1663
1702
|
return !0;
|
|
1664
|
-
const
|
|
1665
|
-
n.ensureMarks(
|
|
1703
|
+
const w = b.filter((k) => v.includes(k.type.name));
|
|
1704
|
+
n.ensureMarks(w);
|
|
1666
1705
|
}
|
|
1667
1706
|
return !0;
|
|
1668
|
-
},
|
|
1669
|
-
const n =
|
|
1707
|
+
}, Lt = (e, t) => {
|
|
1708
|
+
const n = Zt((i) => i.type === t)(e.selection);
|
|
1670
1709
|
if (!n)
|
|
1671
1710
|
return !0;
|
|
1672
1711
|
const r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
|
|
@@ -1674,8 +1713,8 @@ const Ps = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1674
1713
|
return !0;
|
|
1675
1714
|
const s = e.doc.nodeAt(r);
|
|
1676
1715
|
return n.node.type === (s == null ? void 0 : s.type) && Wt(e.doc, n.pos) && e.join(n.pos), !0;
|
|
1677
|
-
},
|
|
1678
|
-
const n =
|
|
1716
|
+
}, Pt = (e, t) => {
|
|
1717
|
+
const n = Zt((i) => i.type === t)(e.selection);
|
|
1679
1718
|
if (!n)
|
|
1680
1719
|
return !0;
|
|
1681
1720
|
const r = e.doc.resolve(n.start).after(n.depth);
|
|
@@ -1683,32 +1722,32 @@ const Ps = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1683
1722
|
return !0;
|
|
1684
1723
|
const s = e.doc.nodeAt(r);
|
|
1685
1724
|
return n.node.type === (s == null ? void 0 : s.type) && Wt(e.doc, r) && e.join(r), !0;
|
|
1686
|
-
},
|
|
1687
|
-
const { extensions: d, splittableMarks: p } = s.extensionManager, h =
|
|
1688
|
-
if (!
|
|
1725
|
+
}, Ds = (e, t, n, r = {}) => ({ editor: s, tr: o, state: i, dispatch: a, chain: c, commands: l, can: u }) => {
|
|
1726
|
+
const { extensions: d, splittableMarks: p } = s.extensionManager, h = H(e, i.schema), f = H(t, i.schema), { selection: m, storedMarks: g } = i, { $from: y, $to: M } = m, v = y.blockRange(M), b = g || m.$to.parentOffset && m.$from.marks();
|
|
1727
|
+
if (!v)
|
|
1689
1728
|
return !1;
|
|
1690
|
-
const
|
|
1691
|
-
if (
|
|
1692
|
-
if (
|
|
1729
|
+
const w = Zt((k) => me(k.type.name, d))(m);
|
|
1730
|
+
if (v.depth >= 1 && w && v.depth - w.depth <= 1) {
|
|
1731
|
+
if (w.node.type === h)
|
|
1693
1732
|
return l.liftListItem(f);
|
|
1694
|
-
if (
|
|
1695
|
-
return c().command(() => (o.setNodeMarkup(
|
|
1696
|
-
}
|
|
1697
|
-
return !n || !
|
|
1698
|
-
const
|
|
1699
|
-
return o.ensureMarks(C),
|
|
1700
|
-
}).wrapInList(h, r).command(() =>
|
|
1701
|
-
},
|
|
1702
|
-
const { extendEmptyMarkRange: o = !1 } = n, i =
|
|
1733
|
+
if (me(w.node.type.name, d) && h.validContent(w.node.content) && a)
|
|
1734
|
+
return c().command(() => (o.setNodeMarkup(w.pos, h), !0)).command(() => Lt(o, h)).command(() => Pt(o, h)).run();
|
|
1735
|
+
}
|
|
1736
|
+
return !n || !b || !a ? c().command(() => u().wrapInList(h, r) ? !0 : l.clearNodes()).wrapInList(h, r).command(() => Lt(o, h)).command(() => Pt(o, h)).run() : c().command(() => {
|
|
1737
|
+
const k = u().wrapInList(h, r), C = b.filter((A) => p.includes(A.type.name));
|
|
1738
|
+
return o.ensureMarks(C), k ? !0 : l.clearNodes();
|
|
1739
|
+
}).wrapInList(h, r).command(() => Lt(o, h)).command(() => Pt(o, h)).run();
|
|
1740
|
+
}, Ns = (e, t = {}, n = {}) => ({ state: r, commands: s }) => {
|
|
1741
|
+
const { extendEmptyMarkRange: o = !1 } = n, i = U(e, r.schema);
|
|
1703
1742
|
return Nt(r, i, t) ? s.unsetMark(i, { extendEmptyMarkRange: o }) : s.setMark(i, t);
|
|
1704
|
-
},
|
|
1705
|
-
const o =
|
|
1743
|
+
}, Bs = (e, t, n = {}) => ({ state: r, commands: s }) => {
|
|
1744
|
+
const o = H(e, r.schema), i = H(t, r.schema), a = ot(r, o, n);
|
|
1706
1745
|
let c;
|
|
1707
1746
|
return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), a ? s.setNode(i, c) : s.setNode(o, { ...c, ...n });
|
|
1708
|
-
},
|
|
1709
|
-
const s =
|
|
1710
|
-
return
|
|
1711
|
-
},
|
|
1747
|
+
}, js = (e, t = {}) => ({ state: n, commands: r }) => {
|
|
1748
|
+
const s = H(e, n.schema);
|
|
1749
|
+
return ot(n, s, t) ? r.lift(s) : r.wrapIn(s, t);
|
|
1750
|
+
}, Fs = () => ({ state: e, dispatch: t }) => {
|
|
1712
1751
|
const n = e.plugins;
|
|
1713
1752
|
for (let r = 0; r < n.length; r += 1) {
|
|
1714
1753
|
const s = n[r];
|
|
@@ -1728,125 +1767,136 @@ const Ps = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
|
|
|
1728
1767
|
}
|
|
1729
1768
|
}
|
|
1730
1769
|
return !1;
|
|
1731
|
-
},
|
|
1770
|
+
}, zs = () => ({ tr: e, dispatch: t }) => {
|
|
1732
1771
|
const { selection: n } = e, { empty: r, ranges: s } = n;
|
|
1733
1772
|
return r || t && s.forEach((o) => {
|
|
1734
1773
|
e.removeMark(o.$from.pos, o.$to.pos);
|
|
1735
1774
|
}), !0;
|
|
1736
|
-
},
|
|
1775
|
+
}, Vs = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1737
1776
|
var o;
|
|
1738
|
-
const { extendEmptyMarkRange: i = !1 } = t, { selection: a } = n, c =
|
|
1777
|
+
const { extendEmptyMarkRange: i = !1 } = t, { selection: a } = n, c = U(e, r.schema), { $from: l, empty: u, ranges: d } = a;
|
|
1739
1778
|
if (!s)
|
|
1740
1779
|
return !0;
|
|
1741
1780
|
if (u && i) {
|
|
1742
1781
|
let { from: p, to: h } = a;
|
|
1743
|
-
const f = (o = l.marks().find((g) => g.type === c)) === null || o === void 0 ? void 0 : o.attrs, m =
|
|
1782
|
+
const f = (o = l.marks().find((g) => g.type === c)) === null || o === void 0 ? void 0 : o.attrs, m = Yt(l, c, f);
|
|
1744
1783
|
m && (p = m.from, h = m.to), n.removeMark(p, h, c);
|
|
1745
1784
|
} else
|
|
1746
1785
|
d.forEach((p) => {
|
|
1747
1786
|
n.removeMark(p.$from.pos, p.$to.pos, c);
|
|
1748
1787
|
});
|
|
1749
1788
|
return n.removeStoredMark(c), !0;
|
|
1750
|
-
},
|
|
1789
|
+
}, Ws = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
|
|
1751
1790
|
let o = null, i = null;
|
|
1752
|
-
const a =
|
|
1753
|
-
return a ? (a === "node" && (o =
|
|
1791
|
+
const a = Et(typeof e == "string" ? e : e.name, r.schema);
|
|
1792
|
+
return a ? (a === "node" && (o = H(e, r.schema)), a === "mark" && (i = U(e, r.schema)), s && n.selection.ranges.forEach((c) => {
|
|
1754
1793
|
const l = c.$from.pos, u = c.$to.pos;
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1794
|
+
let d, p, h, f;
|
|
1795
|
+
n.selection.empty ? r.doc.nodesBetween(l, u, (m, g) => {
|
|
1796
|
+
o && o === m.type && (h = Math.max(g, l), f = Math.min(g + m.nodeSize, u), d = g, p = m);
|
|
1797
|
+
}) : r.doc.nodesBetween(l, u, (m, g) => {
|
|
1798
|
+
g < l && o && o === m.type && (h = Math.max(g, l), f = Math.min(g + m.nodeSize, u), d = g, p = m), g >= l && g <= u && (o && o === m.type && n.setNodeMarkup(g, void 0, {
|
|
1799
|
+
...m.attrs,
|
|
1758
1800
|
...t
|
|
1759
|
-
}), i &&
|
|
1760
|
-
if (i ===
|
|
1761
|
-
const
|
|
1762
|
-
n.addMark(
|
|
1763
|
-
...
|
|
1801
|
+
}), i && m.marks.length && m.marks.forEach((y) => {
|
|
1802
|
+
if (i === y.type) {
|
|
1803
|
+
const M = Math.max(g, l), v = Math.min(g + m.nodeSize, u);
|
|
1804
|
+
n.addMark(M, v, i.create({
|
|
1805
|
+
...y.attrs,
|
|
1764
1806
|
...t
|
|
1765
1807
|
}));
|
|
1766
1808
|
}
|
|
1767
|
-
});
|
|
1768
|
-
})
|
|
1809
|
+
}));
|
|
1810
|
+
}), p && (d !== void 0 && n.setNodeMarkup(d, void 0, {
|
|
1811
|
+
...p.attrs,
|
|
1812
|
+
...t
|
|
1813
|
+
}), i && p.marks.length && p.marks.forEach((m) => {
|
|
1814
|
+
i === m.type && n.addMark(h, f, i.create({
|
|
1815
|
+
...m.attrs,
|
|
1816
|
+
...t
|
|
1817
|
+
}));
|
|
1818
|
+
}));
|
|
1769
1819
|
}), !0) : !1;
|
|
1770
|
-
},
|
|
1771
|
-
const s =
|
|
1772
|
-
return
|
|
1773
|
-
},
|
|
1774
|
-
const s =
|
|
1775
|
-
return
|
|
1820
|
+
}, Ks = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1821
|
+
const s = H(e, n.schema);
|
|
1822
|
+
return Pn(s, t)(n, r);
|
|
1823
|
+
}, Us = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1824
|
+
const s = H(e, n.schema);
|
|
1825
|
+
return Rn(s, t)(n, r);
|
|
1776
1826
|
};
|
|
1777
|
-
var
|
|
1827
|
+
var qs = /* @__PURE__ */ Object.freeze({
|
|
1778
1828
|
__proto__: null,
|
|
1779
|
-
blur:
|
|
1780
|
-
clearContent:
|
|
1781
|
-
clearNodes:
|
|
1782
|
-
command:
|
|
1783
|
-
createParagraphNear:
|
|
1784
|
-
cut:
|
|
1785
|
-
deleteCurrentNode:
|
|
1786
|
-
deleteNode:
|
|
1787
|
-
deleteRange:
|
|
1788
|
-
deleteSelection:
|
|
1789
|
-
enter:
|
|
1790
|
-
exitCode:
|
|
1791
|
-
extendMarkRange:
|
|
1792
|
-
first:
|
|
1793
|
-
focus:
|
|
1794
|
-
forEach:
|
|
1795
|
-
insertContent:
|
|
1796
|
-
insertContentAt:
|
|
1797
|
-
joinBackward:
|
|
1798
|
-
joinDown:
|
|
1799
|
-
joinForward:
|
|
1800
|
-
joinItemBackward:
|
|
1801
|
-
joinItemForward:
|
|
1802
|
-
joinTextblockBackward:
|
|
1803
|
-
joinTextblockForward:
|
|
1804
|
-
joinUp:
|
|
1805
|
-
keyboardShortcut:
|
|
1806
|
-
lift:
|
|
1807
|
-
liftEmptyBlock:
|
|
1808
|
-
liftListItem:
|
|
1809
|
-
newlineInCode:
|
|
1810
|
-
resetAttributes:
|
|
1811
|
-
scrollIntoView:
|
|
1812
|
-
selectAll:
|
|
1813
|
-
selectNodeBackward:
|
|
1814
|
-
selectNodeForward:
|
|
1815
|
-
selectParentNode:
|
|
1816
|
-
selectTextblockEnd:
|
|
1817
|
-
selectTextblockStart:
|
|
1818
|
-
setContent:
|
|
1819
|
-
setMark:
|
|
1820
|
-
setMeta:
|
|
1821
|
-
setNode:
|
|
1822
|
-
setNodeSelection:
|
|
1823
|
-
setTextSelection:
|
|
1824
|
-
sinkListItem:
|
|
1825
|
-
splitBlock:
|
|
1826
|
-
splitListItem:
|
|
1827
|
-
toggleList:
|
|
1828
|
-
toggleMark:
|
|
1829
|
-
toggleNode:
|
|
1830
|
-
toggleWrap:
|
|
1831
|
-
undoInputRule:
|
|
1832
|
-
unsetAllMarks:
|
|
1833
|
-
unsetMark:
|
|
1834
|
-
updateAttributes:
|
|
1835
|
-
wrapIn:
|
|
1836
|
-
wrapInList:
|
|
1829
|
+
blur: Or,
|
|
1830
|
+
clearContent: Lr,
|
|
1831
|
+
clearNodes: Pr,
|
|
1832
|
+
command: Rr,
|
|
1833
|
+
createParagraphNear: $r,
|
|
1834
|
+
cut: _r,
|
|
1835
|
+
deleteCurrentNode: Hr,
|
|
1836
|
+
deleteNode: Ir,
|
|
1837
|
+
deleteRange: Dr,
|
|
1838
|
+
deleteSelection: Nr,
|
|
1839
|
+
enter: Br,
|
|
1840
|
+
exitCode: jr,
|
|
1841
|
+
extendMarkRange: Fr,
|
|
1842
|
+
first: zr,
|
|
1843
|
+
focus: Vr,
|
|
1844
|
+
forEach: Wr,
|
|
1845
|
+
insertContent: Kr,
|
|
1846
|
+
insertContentAt: Gr,
|
|
1847
|
+
joinBackward: Xr,
|
|
1848
|
+
joinDown: Yr,
|
|
1849
|
+
joinForward: Qr,
|
|
1850
|
+
joinItemBackward: Zr,
|
|
1851
|
+
joinItemForward: ts,
|
|
1852
|
+
joinTextblockBackward: es,
|
|
1853
|
+
joinTextblockForward: ns,
|
|
1854
|
+
joinUp: Jr,
|
|
1855
|
+
keyboardShortcut: ss,
|
|
1856
|
+
lift: os,
|
|
1857
|
+
liftEmptyBlock: is,
|
|
1858
|
+
liftListItem: as,
|
|
1859
|
+
newlineInCode: ls,
|
|
1860
|
+
resetAttributes: cs,
|
|
1861
|
+
scrollIntoView: ds,
|
|
1862
|
+
selectAll: us,
|
|
1863
|
+
selectNodeBackward: ps,
|
|
1864
|
+
selectNodeForward: hs,
|
|
1865
|
+
selectParentNode: fs,
|
|
1866
|
+
selectTextblockEnd: ms,
|
|
1867
|
+
selectTextblockStart: gs,
|
|
1868
|
+
setContent: ys,
|
|
1869
|
+
setMark: Os,
|
|
1870
|
+
setMeta: Ls,
|
|
1871
|
+
setNode: Ps,
|
|
1872
|
+
setNodeSelection: Rs,
|
|
1873
|
+
setTextSelection: $s,
|
|
1874
|
+
sinkListItem: _s,
|
|
1875
|
+
splitBlock: Hs,
|
|
1876
|
+
splitListItem: Is,
|
|
1877
|
+
toggleList: Ds,
|
|
1878
|
+
toggleMark: Ns,
|
|
1879
|
+
toggleNode: Bs,
|
|
1880
|
+
toggleWrap: js,
|
|
1881
|
+
undoInputRule: Fs,
|
|
1882
|
+
unsetAllMarks: zs,
|
|
1883
|
+
unsetMark: Vs,
|
|
1884
|
+
updateAttributes: Ws,
|
|
1885
|
+
wrapIn: Ks,
|
|
1886
|
+
wrapInList: Us
|
|
1837
1887
|
});
|
|
1838
|
-
const
|
|
1888
|
+
const Gs = R.create({
|
|
1839
1889
|
name: "commands",
|
|
1840
1890
|
addCommands() {
|
|
1841
1891
|
return {
|
|
1842
|
-
...
|
|
1892
|
+
...qs
|
|
1843
1893
|
};
|
|
1844
1894
|
}
|
|
1845
|
-
}),
|
|
1895
|
+
}), Js = R.create({
|
|
1846
1896
|
name: "drop",
|
|
1847
1897
|
addProseMirrorPlugins() {
|
|
1848
1898
|
return [
|
|
1849
|
-
new
|
|
1899
|
+
new $({
|
|
1850
1900
|
key: new _("tiptapDrop"),
|
|
1851
1901
|
props: {
|
|
1852
1902
|
handleDrop: (e, t, n, r) => {
|
|
@@ -1861,11 +1911,11 @@ const Ks = P.create({
|
|
|
1861
1911
|
})
|
|
1862
1912
|
];
|
|
1863
1913
|
}
|
|
1864
|
-
}),
|
|
1914
|
+
}), Ys = R.create({
|
|
1865
1915
|
name: "editable",
|
|
1866
1916
|
addProseMirrorPlugins() {
|
|
1867
1917
|
return [
|
|
1868
|
-
new
|
|
1918
|
+
new $({
|
|
1869
1919
|
key: new _("editable"),
|
|
1870
1920
|
props: {
|
|
1871
1921
|
editable: () => this.editor.options.editable
|
|
@@ -1873,12 +1923,12 @@ const Ks = P.create({
|
|
|
1873
1923
|
})
|
|
1874
1924
|
];
|
|
1875
1925
|
}
|
|
1876
|
-
}),
|
|
1926
|
+
}), Xs = R.create({
|
|
1877
1927
|
name: "focusEvents",
|
|
1878
1928
|
addProseMirrorPlugins() {
|
|
1879
1929
|
const { editor: e } = this;
|
|
1880
1930
|
return [
|
|
1881
|
-
new
|
|
1931
|
+
new $({
|
|
1882
1932
|
key: new _("focusEvents"),
|
|
1883
1933
|
props: {
|
|
1884
1934
|
handleDOMEvents: {
|
|
@@ -1897,14 +1947,14 @@ const Ks = P.create({
|
|
|
1897
1947
|
})
|
|
1898
1948
|
];
|
|
1899
1949
|
}
|
|
1900
|
-
}),
|
|
1950
|
+
}), Qs = R.create({
|
|
1901
1951
|
name: "keymap",
|
|
1902
1952
|
addKeyboardShortcuts() {
|
|
1903
1953
|
const e = () => this.editor.commands.first(({ commands: i }) => [
|
|
1904
1954
|
() => i.undoInputRule(),
|
|
1905
1955
|
// maybe convert first text block node to default node
|
|
1906
1956
|
() => i.command(({ tr: a }) => {
|
|
1907
|
-
const { selection: c, doc: l } = a, { empty: u, $anchor: d } = c, { pos: p, parent: h } = d, f = d.parent.isTextblock && p > 0 ? a.doc.resolve(p - 1) : d, m = f.parent.type.spec.isolating, g = d.pos - d.parentOffset, y = m && f.parent.childCount === 1 ? g === d.pos :
|
|
1957
|
+
const { selection: c, doc: l } = a, { empty: u, $anchor: d } = c, { pos: p, parent: h } = d, f = d.parent.isTextblock && p > 0 ? a.doc.resolve(p - 1) : d, m = f.parent.type.spec.isolating, g = d.pos - d.parentOffset, y = m && f.parent.childCount === 1 ? g === d.pos : V.atStart(l).from === p;
|
|
1908
1958
|
return !u || !h.type.isTextblock || h.textContent.length || !y || y && d.parent.type.name === "paragraph" ? !1 : i.clearNodes();
|
|
1909
1959
|
}),
|
|
1910
1960
|
() => i.deleteSelection(),
|
|
@@ -1942,7 +1992,7 @@ const Ks = P.create({
|
|
|
1942
1992
|
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
1943
1993
|
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
1944
1994
|
};
|
|
1945
|
-
return
|
|
1995
|
+
return wt() || Ge() ? o : s;
|
|
1946
1996
|
},
|
|
1947
1997
|
addProseMirrorPlugins() {
|
|
1948
1998
|
return [
|
|
@@ -1951,19 +2001,19 @@ const Ks = P.create({
|
|
|
1951
2001
|
// to a paragraph if necessary.
|
|
1952
2002
|
// This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well
|
|
1953
2003
|
// with many other commands.
|
|
1954
|
-
new
|
|
2004
|
+
new $({
|
|
1955
2005
|
key: new _("clearDocument"),
|
|
1956
2006
|
appendTransaction: (e, t, n) => {
|
|
1957
2007
|
const r = e.some((m) => m.docChanged) && !t.doc.eq(n.doc), s = e.some((m) => m.getMeta("preventClearDocument"));
|
|
1958
2008
|
if (!r || s)
|
|
1959
2009
|
return;
|
|
1960
|
-
const { empty: o, from: i, to: a } = t.selection, c =
|
|
1961
|
-
if (o || !(i === c && a === l) || !
|
|
2010
|
+
const { empty: o, from: i, to: a } = t.selection, c = V.atStart(t.doc).from, l = V.atEnd(t.doc).to;
|
|
2011
|
+
if (o || !(i === c && a === l) || !Tt(n.doc))
|
|
1962
2012
|
return;
|
|
1963
|
-
const p = n.tr, h =
|
|
2013
|
+
const p = n.tr, h = vt({
|
|
1964
2014
|
state: n,
|
|
1965
2015
|
transaction: p
|
|
1966
|
-
}), { commands: f } = new
|
|
2016
|
+
}), { commands: f } = new bt({
|
|
1967
2017
|
editor: this.editor,
|
|
1968
2018
|
state: h
|
|
1969
2019
|
});
|
|
@@ -1973,11 +2023,11 @@ const Ks = P.create({
|
|
|
1973
2023
|
})
|
|
1974
2024
|
];
|
|
1975
2025
|
}
|
|
1976
|
-
}),
|
|
2026
|
+
}), Zs = R.create({
|
|
1977
2027
|
name: "paste",
|
|
1978
2028
|
addProseMirrorPlugins() {
|
|
1979
2029
|
return [
|
|
1980
|
-
new
|
|
2030
|
+
new $({
|
|
1981
2031
|
key: new _("tiptapPaste"),
|
|
1982
2032
|
props: {
|
|
1983
2033
|
handlePaste: (e, t, n) => {
|
|
@@ -1991,11 +2041,11 @@ const Ks = P.create({
|
|
|
1991
2041
|
})
|
|
1992
2042
|
];
|
|
1993
2043
|
}
|
|
1994
|
-
}),
|
|
2044
|
+
}), to = R.create({
|
|
1995
2045
|
name: "tabindex",
|
|
1996
2046
|
addProseMirrorPlugins() {
|
|
1997
2047
|
return [
|
|
1998
|
-
new
|
|
2048
|
+
new $({
|
|
1999
2049
|
key: new _("tabindex"),
|
|
2000
2050
|
props: {
|
|
2001
2051
|
attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
|
|
@@ -2004,7 +2054,7 @@ const Ks = P.create({
|
|
|
2004
2054
|
];
|
|
2005
2055
|
}
|
|
2006
2056
|
});
|
|
2007
|
-
class
|
|
2057
|
+
class Y {
|
|
2008
2058
|
get name() {
|
|
2009
2059
|
return this.node.type.name;
|
|
2010
2060
|
}
|
|
@@ -2063,15 +2113,15 @@ class J {
|
|
|
2063
2113
|
if (this.depth === 0)
|
|
2064
2114
|
return null;
|
|
2065
2115
|
const t = this.resolvedPos.start(this.resolvedPos.depth - 1), n = this.resolvedPos.doc.resolve(t);
|
|
2066
|
-
return new
|
|
2116
|
+
return new Y(n, this.editor);
|
|
2067
2117
|
}
|
|
2068
2118
|
get before() {
|
|
2069
2119
|
let t = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));
|
|
2070
|
-
return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.from - 3)), new
|
|
2120
|
+
return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.from - 3)), new Y(t, this.editor);
|
|
2071
2121
|
}
|
|
2072
2122
|
get after() {
|
|
2073
2123
|
let t = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));
|
|
2074
|
-
return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.to + 3)), new
|
|
2124
|
+
return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.to + 3)), new Y(t, this.editor);
|
|
2075
2125
|
}
|
|
2076
2126
|
get children() {
|
|
2077
2127
|
const t = [];
|
|
@@ -2079,8 +2129,8 @@ class J {
|
|
|
2079
2129
|
const s = n.isBlock && !n.isTextblock, o = n.isAtom && !n.isText, i = this.pos + r + (o ? 0 : 1), a = this.resolvedPos.doc.resolve(i);
|
|
2080
2130
|
if (!s && a.depth <= this.depth)
|
|
2081
2131
|
return;
|
|
2082
|
-
const c = new
|
|
2083
|
-
s && (c.actualDepth = this.depth + 1), t.push(new
|
|
2132
|
+
const c = new Y(a, this.editor, s, s ? n : null);
|
|
2133
|
+
s && (c.actualDepth = this.depth + 1), t.push(new Y(a, this.editor, s, s ? n : null));
|
|
2084
2134
|
}), t;
|
|
2085
2135
|
}
|
|
2086
2136
|
get firstChild() {
|
|
@@ -2127,7 +2177,7 @@ class J {
|
|
|
2127
2177
|
}), this.editor.view.dispatch(n);
|
|
2128
2178
|
}
|
|
2129
2179
|
}
|
|
2130
|
-
const
|
|
2180
|
+
const eo = `.ProseMirror {
|
|
2131
2181
|
position: relative;
|
|
2132
2182
|
}
|
|
2133
2183
|
|
|
@@ -2202,14 +2252,14 @@ img.ProseMirror-separator {
|
|
|
2202
2252
|
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
2203
2253
|
opacity: 0
|
|
2204
2254
|
}`;
|
|
2205
|
-
function
|
|
2255
|
+
function no(e, t, n) {
|
|
2206
2256
|
const r = document.querySelector("style[data-tiptap-style]");
|
|
2207
2257
|
if (r !== null)
|
|
2208
2258
|
return r;
|
|
2209
2259
|
const s = document.createElement("style");
|
|
2210
2260
|
return t && s.setAttribute("nonce", t), s.setAttribute("data-tiptap-style", ""), s.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(s), s;
|
|
2211
2261
|
}
|
|
2212
|
-
class
|
|
2262
|
+
class ro extends fr {
|
|
2213
2263
|
constructor(t = {}) {
|
|
2214
2264
|
super(), this.isFocused = !1, this.isInitialized = !1, this.extensionStorage = {}, this.options = {
|
|
2215
2265
|
element: document.createElement("div"),
|
|
@@ -2271,7 +2321,7 @@ class to extends cr {
|
|
|
2271
2321
|
* Inject CSS styles.
|
|
2272
2322
|
*/
|
|
2273
2323
|
injectCSS() {
|
|
2274
|
-
this.options.injectCSS && document && (this.css =
|
|
2324
|
+
this.options.injectCSS && document && (this.css = no(eo, this.options.injectNonce));
|
|
2275
2325
|
}
|
|
2276
2326
|
/**
|
|
2277
2327
|
* Update editor options.
|
|
@@ -2310,7 +2360,7 @@ class to extends cr {
|
|
|
2310
2360
|
* @returns The new editor state
|
|
2311
2361
|
*/
|
|
2312
2362
|
registerPlugin(t, n) {
|
|
2313
|
-
const r =
|
|
2363
|
+
const r = Fe(n) ? n(t, [...this.state.plugins]) : [...this.state.plugins, t], s = this.state.reconfigure({ plugins: r });
|
|
2314
2364
|
return this.view.updateState(s), s;
|
|
2315
2365
|
}
|
|
2316
2366
|
/**
|
|
@@ -2340,24 +2390,24 @@ class to extends cr {
|
|
|
2340
2390
|
createExtensionManager() {
|
|
2341
2391
|
var t, n;
|
|
2342
2392
|
const s = [...this.options.enableCoreExtensions ? [
|
|
2343
|
-
|
|
2344
|
-
|
|
2393
|
+
Ys,
|
|
2394
|
+
Ar.configure({
|
|
2345
2395
|
blockSeparator: (n = (t = this.options.coreExtensionOptions) === null || t === void 0 ? void 0 : t.clipboardTextSerializer) === null || n === void 0 ? void 0 : n.blockSeparator
|
|
2346
2396
|
}),
|
|
2347
|
-
Ks,
|
|
2348
2397
|
Gs,
|
|
2349
|
-
Js,
|
|
2350
2398
|
Xs,
|
|
2351
|
-
|
|
2352
|
-
|
|
2399
|
+
Qs,
|
|
2400
|
+
to,
|
|
2401
|
+
Js,
|
|
2402
|
+
Zs
|
|
2353
2403
|
].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));
|
|
2354
|
-
this.extensionManager = new
|
|
2404
|
+
this.extensionManager = new tt(s, this);
|
|
2355
2405
|
}
|
|
2356
2406
|
/**
|
|
2357
2407
|
* Creates an command manager.
|
|
2358
2408
|
*/
|
|
2359
2409
|
createCommandManager() {
|
|
2360
|
-
this.commandManager = new
|
|
2410
|
+
this.commandManager = new bt({
|
|
2361
2411
|
editor: this
|
|
2362
2412
|
});
|
|
2363
2413
|
}
|
|
@@ -2371,35 +2421,41 @@ class to extends cr {
|
|
|
2371
2421
|
* Creates a ProseMirror view.
|
|
2372
2422
|
*/
|
|
2373
2423
|
createView() {
|
|
2374
|
-
|
|
2424
|
+
var t;
|
|
2425
|
+
let n;
|
|
2375
2426
|
try {
|
|
2376
|
-
|
|
2377
|
-
} catch (
|
|
2378
|
-
if (!(
|
|
2379
|
-
throw
|
|
2427
|
+
n = Dt(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
|
|
2428
|
+
} catch (i) {
|
|
2429
|
+
if (!(i instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(i.message))
|
|
2430
|
+
throw i;
|
|
2380
2431
|
this.emit("contentError", {
|
|
2381
2432
|
editor: this,
|
|
2382
|
-
error:
|
|
2433
|
+
error: i,
|
|
2383
2434
|
disableCollaboration: () => {
|
|
2384
|
-
this.storage.collaboration && (this.storage.collaboration.isDisabled = !0), this.options.extensions = this.options.extensions.filter((
|
|
2435
|
+
this.storage.collaboration && (this.storage.collaboration.isDisabled = !0), this.options.extensions = this.options.extensions.filter((a) => a.name !== "collaboration"), this.createExtensionManager();
|
|
2385
2436
|
}
|
|
2386
|
-
}),
|
|
2437
|
+
}), n = Dt(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
|
|
2387
2438
|
}
|
|
2388
|
-
const
|
|
2389
|
-
this.view = new
|
|
2439
|
+
const r = Ue(n, this.options.autofocus);
|
|
2440
|
+
this.view = new $n(this.options.element, {
|
|
2390
2441
|
...this.options.editorProps,
|
|
2442
|
+
attributes: {
|
|
2443
|
+
// add `role="textbox"` to the editor element
|
|
2444
|
+
role: "textbox",
|
|
2445
|
+
...(t = this.options.editorProps) === null || t === void 0 ? void 0 : t.attributes
|
|
2446
|
+
},
|
|
2391
2447
|
dispatchTransaction: this.dispatchTransaction.bind(this),
|
|
2392
|
-
state:
|
|
2393
|
-
doc:
|
|
2394
|
-
selection:
|
|
2448
|
+
state: _n.create({
|
|
2449
|
+
doc: n,
|
|
2450
|
+
selection: r || void 0
|
|
2395
2451
|
})
|
|
2396
|
-
})
|
|
2397
|
-
const
|
|
2452
|
+
});
|
|
2453
|
+
const s = this.state.reconfigure({
|
|
2398
2454
|
plugins: this.extensionManager.plugins
|
|
2399
2455
|
});
|
|
2400
|
-
this.view.updateState(
|
|
2401
|
-
const
|
|
2402
|
-
|
|
2456
|
+
this.view.updateState(s), this.createNodeViews(), this.prependClass();
|
|
2457
|
+
const o = this.view.dom;
|
|
2458
|
+
o.editor = this;
|
|
2403
2459
|
}
|
|
2404
2460
|
/**
|
|
2405
2461
|
* Creates all node views.
|
|
@@ -2469,11 +2525,11 @@ class to extends cr {
|
|
|
2469
2525
|
* Get attributes of the currently selected node or mark.
|
|
2470
2526
|
*/
|
|
2471
2527
|
getAttributes(t) {
|
|
2472
|
-
return
|
|
2528
|
+
return Ye(this.state, t);
|
|
2473
2529
|
}
|
|
2474
2530
|
isActive(t, n) {
|
|
2475
2531
|
const r = typeof t == "string" ? t : null, s = typeof t == "string" ? n : t;
|
|
2476
|
-
return
|
|
2532
|
+
return Cs(this.state, r, s);
|
|
2477
2533
|
}
|
|
2478
2534
|
/**
|
|
2479
2535
|
* Get the document as JSON.
|
|
@@ -2485,7 +2541,7 @@ class to extends cr {
|
|
|
2485
2541
|
* Get the document as HTML.
|
|
2486
2542
|
*/
|
|
2487
2543
|
getHTML() {
|
|
2488
|
-
return
|
|
2544
|
+
return Gt(this.state.doc.content, this.schema);
|
|
2489
2545
|
}
|
|
2490
2546
|
/**
|
|
2491
2547
|
* Get the document as text.
|
|
@@ -2494,10 +2550,10 @@ class to extends cr {
|
|
|
2494
2550
|
const { blockSeparator: n = `
|
|
2495
2551
|
|
|
2496
2552
|
`, textSerializers: r = {} } = t || {};
|
|
2497
|
-
return
|
|
2553
|
+
return ks(this.state.doc, {
|
|
2498
2554
|
blockSeparator: n,
|
|
2499
2555
|
textSerializers: {
|
|
2500
|
-
...
|
|
2556
|
+
...We(this.schema),
|
|
2501
2557
|
...r
|
|
2502
2558
|
}
|
|
2503
2559
|
});
|
|
@@ -2506,7 +2562,7 @@ class to extends cr {
|
|
|
2506
2562
|
* Check if there is no content.
|
|
2507
2563
|
*/
|
|
2508
2564
|
get isEmpty() {
|
|
2509
|
-
return
|
|
2565
|
+
return Tt(this.state.doc);
|
|
2510
2566
|
}
|
|
2511
2567
|
/**
|
|
2512
2568
|
* Get the number of characters for the current document.
|
|
@@ -2543,14 +2599,14 @@ class to extends cr {
|
|
|
2543
2599
|
}
|
|
2544
2600
|
$pos(t) {
|
|
2545
2601
|
const n = this.state.doc.resolve(t);
|
|
2546
|
-
return new
|
|
2602
|
+
return new Y(n, this);
|
|
2547
2603
|
}
|
|
2548
2604
|
get $doc() {
|
|
2549
2605
|
return this.$pos(0);
|
|
2550
2606
|
}
|
|
2551
2607
|
}
|
|
2552
|
-
function
|
|
2553
|
-
return new
|
|
2608
|
+
function X(e) {
|
|
2609
|
+
return new kt({
|
|
2554
2610
|
find: e.find,
|
|
2555
2611
|
handler: ({ state: t, range: n, match: r }) => {
|
|
2556
2612
|
const s = T(e.getAttributes, void 0, r);
|
|
@@ -2559,7 +2615,7 @@ function Y(e) {
|
|
|
2559
2615
|
const { tr: o } = t, i = r[r.length - 1], a = r[0];
|
|
2560
2616
|
if (i) {
|
|
2561
2617
|
const c = a.search(/\S/), l = n.from + a.indexOf(i), u = l + i.length;
|
|
2562
|
-
if (
|
|
2618
|
+
if (te(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 > l).length)
|
|
2563
2619
|
return null;
|
|
2564
2620
|
u < n.to && o.delete(u, n.to), l > n.from && o.delete(n.from + c, l);
|
|
2565
2621
|
const p = n.from + c + i.length;
|
|
@@ -2568,8 +2624,8 @@ function Y(e) {
|
|
|
2568
2624
|
}
|
|
2569
2625
|
});
|
|
2570
2626
|
}
|
|
2571
|
-
function
|
|
2572
|
-
return new
|
|
2627
|
+
function Qe(e) {
|
|
2628
|
+
return new kt({
|
|
2573
2629
|
find: e.find,
|
|
2574
2630
|
handler: ({ state: t, range: n, match: r }) => {
|
|
2575
2631
|
const s = T(e.getAttributes, void 0, r) || {}, { tr: o } = t, i = n.from;
|
|
@@ -2590,7 +2646,7 @@ function Je(e) {
|
|
|
2590
2646
|
});
|
|
2591
2647
|
}
|
|
2592
2648
|
function Bt(e) {
|
|
2593
|
-
return new
|
|
2649
|
+
return new kt({
|
|
2594
2650
|
find: e.find,
|
|
2595
2651
|
handler: ({ state: t, range: n, match: r }) => {
|
|
2596
2652
|
const s = t.doc.resolve(n.from), o = T(e.getAttributes, void 0, r) || {};
|
|
@@ -2600,11 +2656,11 @@ function Bt(e) {
|
|
|
2600
2656
|
}
|
|
2601
2657
|
});
|
|
2602
2658
|
}
|
|
2603
|
-
function
|
|
2604
|
-
return new
|
|
2659
|
+
function nt(e) {
|
|
2660
|
+
return new kt({
|
|
2605
2661
|
find: e.find,
|
|
2606
2662
|
handler: ({ state: t, range: n, match: r, chain: s }) => {
|
|
2607
|
-
const o = T(e.getAttributes, void 0, r) || {}, i = t.tr.delete(n.from, n.to), c = i.doc.resolve(n.from).blockRange(), l = c &&
|
|
2663
|
+
const o = T(e.getAttributes, void 0, r) || {}, i = t.tr.delete(n.from, n.to), c = i.doc.resolve(n.from).blockRange(), l = c && ln(c, e.type, o);
|
|
2608
2664
|
if (!l)
|
|
2609
2665
|
return null;
|
|
2610
2666
|
if (i.wrap(c, l), e.keepMarks && e.editor) {
|
|
@@ -2623,7 +2679,7 @@ function et(e) {
|
|
|
2623
2679
|
}
|
|
2624
2680
|
});
|
|
2625
2681
|
}
|
|
2626
|
-
class
|
|
2682
|
+
class P {
|
|
2627
2683
|
constructor(t = {}) {
|
|
2628
2684
|
this.type = "node", this.name = "node", this.parent = null, this.child = null, this.config = {
|
|
2629
2685
|
name: this.name,
|
|
@@ -2639,7 +2695,7 @@ class R {
|
|
|
2639
2695
|
})) || {};
|
|
2640
2696
|
}
|
|
2641
2697
|
static create(t = {}) {
|
|
2642
|
-
return new
|
|
2698
|
+
return new P(t);
|
|
2643
2699
|
}
|
|
2644
2700
|
configure(t = {}) {
|
|
2645
2701
|
const n = this.extend({
|
|
@@ -2649,7 +2705,7 @@ class R {
|
|
|
2649
2705
|
return n.name = this.name, n.parent = this.parent, n;
|
|
2650
2706
|
}
|
|
2651
2707
|
extend(t = {}) {
|
|
2652
|
-
const n = new
|
|
2708
|
+
const n = new P(t);
|
|
2653
2709
|
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(S(n, "addOptions", {
|
|
2654
2710
|
name: n.name
|
|
2655
2711
|
})), n.storage = T(S(n, "addStorage", {
|
|
@@ -2658,10 +2714,10 @@ class R {
|
|
|
2658
2714
|
})), n;
|
|
2659
2715
|
}
|
|
2660
2716
|
}
|
|
2661
|
-
function
|
|
2717
|
+
function so() {
|
|
2662
2718
|
return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
|
|
2663
2719
|
}
|
|
2664
|
-
class
|
|
2720
|
+
class oo {
|
|
2665
2721
|
constructor(t, n, r) {
|
|
2666
2722
|
this.isDragging = !1, this.component = t, this.editor = n.editor, this.options = {
|
|
2667
2723
|
stopEvent: null,
|
|
@@ -2684,14 +2740,14 @@ class no {
|
|
|
2684
2740
|
return;
|
|
2685
2741
|
let p = 0, h = 0;
|
|
2686
2742
|
if (this.dom !== d) {
|
|
2687
|
-
const y = this.dom.getBoundingClientRect(),
|
|
2688
|
-
p =
|
|
2743
|
+
const y = this.dom.getBoundingClientRect(), M = d.getBoundingClientRect(), v = (s = t.offsetX) !== null && s !== void 0 ? s : (o = t.nativeEvent) === null || o === void 0 ? void 0 : o.offsetX, b = (i = t.offsetY) !== null && i !== void 0 ? i : (a = t.nativeEvent) === null || a === void 0 ? void 0 : a.offsetY;
|
|
2744
|
+
p = M.x - y.x + v, h = M.y - y.y + b;
|
|
2689
2745
|
}
|
|
2690
2746
|
(c = t.dataTransfer) === null || c === void 0 || c.setDragImage(this.dom, p, h);
|
|
2691
2747
|
const f = this.getPos();
|
|
2692
2748
|
if (typeof f != "number")
|
|
2693
2749
|
return;
|
|
2694
|
-
const m =
|
|
2750
|
+
const m = et.create(l.state.doc, f), g = l.state.tr.setSelection(m);
|
|
2695
2751
|
l.dispatch(g);
|
|
2696
2752
|
}
|
|
2697
2753
|
stopEvent(t) {
|
|
@@ -2706,7 +2762,7 @@ class no {
|
|
|
2706
2762
|
const o = t.type.startsWith("drag"), i = t.type === "drop";
|
|
2707
2763
|
if ((["INPUT", "BUTTON", "SELECT", "TEXTAREA"].includes(r.tagName) || r.isContentEditable) && !i && !o)
|
|
2708
2764
|
return !0;
|
|
2709
|
-
const { isEditable: c } = this.editor, { isDragging: l } = this, u = !!this.node.type.spec.draggable, d =
|
|
2765
|
+
const { isEditable: c } = this.editor, { isDragging: l } = this, u = !!this.node.type.spec.draggable, d = et.isSelectable(this.node), p = t.type === "copy", h = t.type === "paste", f = t.type === "cut", m = t.type === "mousedown";
|
|
2710
2766
|
if (!u && d && o && t.preventDefault(), u && o && !l)
|
|
2711
2767
|
return t.preventDefault(), !1;
|
|
2712
2768
|
if (u && c && !l && m) {
|
|
@@ -2727,7 +2783,7 @@ class no {
|
|
|
2727
2783
|
* @return `true` if it can safely be ignored.
|
|
2728
2784
|
*/
|
|
2729
2785
|
ignoreMutation(t) {
|
|
2730
|
-
return !this.dom || !this.contentDOM ? !0 : typeof this.options.ignoreMutation == "function" ? this.options.ignoreMutation({ mutation: t }) : this.node.isLeaf || this.node.isAtom ? !0 : t.type === "selection" || this.dom.contains(t.target) && t.type === "childList" && (
|
|
2786
|
+
return !this.dom || !this.contentDOM ? !0 : typeof this.options.ignoreMutation == "function" ? this.options.ignoreMutation({ mutation: t }) : this.node.isLeaf || this.node.isAtom ? !0 : t.type === "selection" || this.dom.contains(t.target) && t.type === "childList" && (wt() || so()) && this.editor.isFocused && [
|
|
2731
2787
|
...Array.from(t.addedNodes),
|
|
2732
2788
|
...Array.from(t.removedNodes)
|
|
2733
2789
|
].every((r) => r.isContentEditable) ? !1 : this.contentDOM === t.target && t.type === "attributes" ? !0 : !this.contentDOM.contains(t.target);
|
|
@@ -2755,8 +2811,8 @@ class no {
|
|
|
2755
2811
|
this.editor.commands.deleteRange({ from: t, to: n });
|
|
2756
2812
|
}
|
|
2757
2813
|
}
|
|
2758
|
-
function
|
|
2759
|
-
return new
|
|
2814
|
+
function K(e) {
|
|
2815
|
+
return new ze({
|
|
2760
2816
|
find: e.find,
|
|
2761
2817
|
handler: ({ state: t, range: n, match: r, pasteEvent: s }) => {
|
|
2762
2818
|
const o = T(e.getAttributes, void 0, r, s);
|
|
@@ -2766,18 +2822,18 @@ function V(e) {
|
|
|
2766
2822
|
let l = n.to;
|
|
2767
2823
|
if (a) {
|
|
2768
2824
|
const u = c.search(/\S/), d = n.from + c.indexOf(a), p = d + a.length;
|
|
2769
|
-
if (
|
|
2825
|
+
if (te(n.from, n.to, t.doc).filter((f) => f.mark.type.excluded.find((g) => g === e.type && g !== f.mark.type)).filter((f) => f.to > d).length)
|
|
2770
2826
|
return null;
|
|
2771
2827
|
p < n.to && i.delete(p, n.to), d > n.from && i.delete(n.from + u, d), l = n.from + u + a.length, i.addMark(n.from + u, l, e.type.create(o || {})), i.removeStoredMark(e.type);
|
|
2772
2828
|
}
|
|
2773
2829
|
}
|
|
2774
2830
|
});
|
|
2775
2831
|
}
|
|
2776
|
-
function
|
|
2832
|
+
function io(e) {
|
|
2777
2833
|
return e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
2778
2834
|
}
|
|
2779
|
-
function
|
|
2780
|
-
return new
|
|
2835
|
+
function wi(e) {
|
|
2836
|
+
return new ze({
|
|
2781
2837
|
find: e.find,
|
|
2782
2838
|
handler({ match: t, chain: n, range: r, pasteEvent: s }) {
|
|
2783
2839
|
const o = T(e.getAttributes, void 0, t, s), i = T(e.getContent, void 0, o);
|
|
@@ -2788,7 +2844,7 @@ function bi(e) {
|
|
|
2788
2844
|
}
|
|
2789
2845
|
});
|
|
2790
2846
|
}
|
|
2791
|
-
const
|
|
2847
|
+
const ao = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, lo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, co = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, uo = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, Ei = D.create({
|
|
2792
2848
|
name: "bold",
|
|
2793
2849
|
addOptions() {
|
|
2794
2850
|
return {
|
|
@@ -2832,33 +2888,33 @@ const so = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, oo = /(?:^|\s
|
|
|
2832
2888
|
},
|
|
2833
2889
|
addInputRules() {
|
|
2834
2890
|
return [
|
|
2835
|
-
|
|
2836
|
-
find:
|
|
2891
|
+
X({
|
|
2892
|
+
find: ao,
|
|
2837
2893
|
type: this.type
|
|
2838
2894
|
}),
|
|
2839
|
-
|
|
2840
|
-
find:
|
|
2895
|
+
X({
|
|
2896
|
+
find: co,
|
|
2841
2897
|
type: this.type
|
|
2842
2898
|
})
|
|
2843
2899
|
];
|
|
2844
2900
|
},
|
|
2845
2901
|
addPasteRules() {
|
|
2846
2902
|
return [
|
|
2847
|
-
|
|
2848
|
-
find:
|
|
2903
|
+
K({
|
|
2904
|
+
find: lo,
|
|
2849
2905
|
type: this.type
|
|
2850
2906
|
}),
|
|
2851
|
-
|
|
2852
|
-
find:
|
|
2907
|
+
K({
|
|
2908
|
+
find: uo,
|
|
2853
2909
|
type: this.type
|
|
2854
2910
|
})
|
|
2855
2911
|
];
|
|
2856
2912
|
}
|
|
2857
2913
|
});
|
|
2858
|
-
class
|
|
2914
|
+
class po {
|
|
2859
2915
|
constructor({ editor: t, element: n, view: r, tippyOptions: s = {}, updateDelay: o = 250, shouldShow: i }) {
|
|
2860
2916
|
this.preventHide = !1, this.shouldShow = ({ view: a, state: c, from: l, to: u }) => {
|
|
2861
|
-
const { doc: d, selection: p } = c, { empty: h } = p, f = !d.textBetween(l, u).length &&
|
|
2917
|
+
const { doc: d, selection: p } = c, { empty: h } = p, f = !d.textBetween(l, u).length && Xt(c.selection), m = this.element.contains(document.activeElement);
|
|
2862
2918
|
return !(!(a.hasFocus() || m) || h || f || !this.editor.isEditable);
|
|
2863
2919
|
}, this.mousedownHandler = () => {
|
|
2864
2920
|
this.preventHide = !0;
|
|
@@ -2872,7 +2928,7 @@ class lo {
|
|
|
2872
2928
|
this.preventHide = !1;
|
|
2873
2929
|
return;
|
|
2874
2930
|
}
|
|
2875
|
-
a != null && a.relatedTarget && (!((c = this.element.parentNode) === null || c === void 0) && c.contains(a.relatedTarget)) || this.hide();
|
|
2931
|
+
a != null && a.relatedTarget && (!((c = this.element.parentNode) === null || c === void 0) && c.contains(a.relatedTarget)) || (a == null ? void 0 : a.relatedTarget) !== this.editor.view.dom && this.hide();
|
|
2876
2932
|
}, this.tippyBlurHandler = (a) => {
|
|
2877
2933
|
this.blurHandler({ event: a });
|
|
2878
2934
|
}, this.handleDebouncedUpdate = (a, c) => {
|
|
@@ -2886,34 +2942,37 @@ class lo {
|
|
|
2886
2942
|
if (m || !c && !l)
|
|
2887
2943
|
return;
|
|
2888
2944
|
this.createTooltip();
|
|
2889
|
-
const { ranges:
|
|
2945
|
+
const { ranges: M } = g, v = Math.min(...M.map((k) => k.$from.pos)), b = Math.max(...M.map((k) => k.$to.pos));
|
|
2890
2946
|
if (!((d = this.shouldShow) === null || d === void 0 ? void 0 : d.call(this, {
|
|
2891
2947
|
editor: this.editor,
|
|
2948
|
+
element: this.element,
|
|
2892
2949
|
view: a,
|
|
2893
2950
|
state: f,
|
|
2894
2951
|
oldState: u,
|
|
2895
|
-
from:
|
|
2896
|
-
to:
|
|
2952
|
+
from: v,
|
|
2953
|
+
to: b
|
|
2897
2954
|
}))) {
|
|
2898
2955
|
this.hide();
|
|
2899
2956
|
return;
|
|
2900
2957
|
}
|
|
2901
2958
|
(p = this.tippy) === null || p === void 0 || p.setProps({
|
|
2902
2959
|
getReferenceClientRect: ((h = this.tippyOptions) === null || h === void 0 ? void 0 : h.getReferenceClientRect) || (() => {
|
|
2903
|
-
if (
|
|
2904
|
-
let
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2960
|
+
if (Xe(f.selection)) {
|
|
2961
|
+
let k = a.nodeDOM(v);
|
|
2962
|
+
if (k) {
|
|
2963
|
+
const C = k.dataset.nodeViewWrapper ? k : k.querySelector("[data-node-view-wrapper]");
|
|
2964
|
+
if (C && (k = C.firstChild), k)
|
|
2965
|
+
return k.getBoundingClientRect();
|
|
2966
|
+
}
|
|
2908
2967
|
}
|
|
2909
|
-
return
|
|
2968
|
+
return xs(a, v, b);
|
|
2910
2969
|
})
|
|
2911
2970
|
}), this.show();
|
|
2912
2971
|
}, this.editor = t, this.element = n, this.view = r, this.updateDelay = o, i && (this.shouldShow = i), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.tippyOptions = s, this.element.remove(), this.element.style.visibility = "visible";
|
|
2913
2972
|
}
|
|
2914
2973
|
createTooltip() {
|
|
2915
2974
|
const { element: t } = this.editor.options, n = !!t.parentElement;
|
|
2916
|
-
this.tippy || !n || (this.tippy =
|
|
2975
|
+
this.tippy || !n || (this.tippy = Re(t, {
|
|
2917
2976
|
duration: 0,
|
|
2918
2977
|
getReferenceClientRect: null,
|
|
2919
2978
|
content: this.element,
|
|
@@ -2946,11 +3005,11 @@ class lo {
|
|
|
2946
3005
|
!((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);
|
|
2947
3006
|
}
|
|
2948
3007
|
}
|
|
2949
|
-
const
|
|
3008
|
+
const Ze = (e) => new $({
|
|
2950
3009
|
key: typeof e.pluginKey == "string" ? new _(e.pluginKey) : e.pluginKey,
|
|
2951
|
-
view: (t) => new
|
|
3010
|
+
view: (t) => new po({ view: t, ...e })
|
|
2952
3011
|
});
|
|
2953
|
-
|
|
3012
|
+
R.create({
|
|
2954
3013
|
name: "bubbleMenu",
|
|
2955
3014
|
addOptions() {
|
|
2956
3015
|
return {
|
|
@@ -2963,7 +3022,7 @@ P.create({
|
|
|
2963
3022
|
},
|
|
2964
3023
|
addProseMirrorPlugins() {
|
|
2965
3024
|
return this.options.element ? [
|
|
2966
|
-
|
|
3025
|
+
Ze({
|
|
2967
3026
|
pluginKey: this.options.pluginKey,
|
|
2968
3027
|
editor: this.editor,
|
|
2969
3028
|
element: this.options.element,
|
|
@@ -2974,7 +3033,7 @@ P.create({
|
|
|
2974
3033
|
] : [];
|
|
2975
3034
|
}
|
|
2976
3035
|
});
|
|
2977
|
-
function
|
|
3036
|
+
function ho(e) {
|
|
2978
3037
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
2979
3038
|
}
|
|
2980
3039
|
var jt = { exports: {} }, Rt = {};
|
|
@@ -2987,10 +3046,10 @@ var jt = { exports: {} }, Rt = {};
|
|
|
2987
3046
|
* This source code is licensed under the MIT license found in the
|
|
2988
3047
|
* LICENSE file in the root directory of this source tree.
|
|
2989
3048
|
*/
|
|
2990
|
-
var
|
|
2991
|
-
function
|
|
2992
|
-
if (
|
|
2993
|
-
|
|
3049
|
+
var ye;
|
|
3050
|
+
function fo() {
|
|
3051
|
+
if (ye) return Rt;
|
|
3052
|
+
ye = 1;
|
|
2994
3053
|
var e = L;
|
|
2995
3054
|
function t(d, p) {
|
|
2996
3055
|
return d === p && (d !== 0 || 1 / d === 1 / p) || d !== d && p !== p;
|
|
@@ -3022,7 +3081,7 @@ function uo() {
|
|
|
3022
3081
|
var u = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? l : a;
|
|
3023
3082
|
return Rt.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : u, Rt;
|
|
3024
3083
|
}
|
|
3025
|
-
var
|
|
3084
|
+
var $t = {};
|
|
3026
3085
|
/**
|
|
3027
3086
|
* @license React
|
|
3028
3087
|
* use-sync-external-store-shim.development.js
|
|
@@ -3032,88 +3091,88 @@ var Pt = {};
|
|
|
3032
3091
|
* This source code is licensed under the MIT license found in the
|
|
3033
3092
|
* LICENSE file in the root directory of this source tree.
|
|
3034
3093
|
*/
|
|
3035
|
-
var
|
|
3036
|
-
function
|
|
3037
|
-
return
|
|
3094
|
+
var ve;
|
|
3095
|
+
function mo() {
|
|
3096
|
+
return ve || (ve = 1, process.env.NODE_ENV !== "production" && function() {
|
|
3038
3097
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
3039
3098
|
var e = L, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
3040
|
-
function n(
|
|
3099
|
+
function n(v) {
|
|
3041
3100
|
{
|
|
3042
|
-
for (var
|
|
3043
|
-
|
|
3044
|
-
r("error",
|
|
3101
|
+
for (var b = arguments.length, w = new Array(b > 1 ? b - 1 : 0), k = 1; k < b; k++)
|
|
3102
|
+
w[k - 1] = arguments[k];
|
|
3103
|
+
r("error", v, w);
|
|
3045
3104
|
}
|
|
3046
3105
|
}
|
|
3047
|
-
function r(
|
|
3106
|
+
function r(v, b, w) {
|
|
3048
3107
|
{
|
|
3049
|
-
var
|
|
3050
|
-
C !== "" && (
|
|
3051
|
-
var A =
|
|
3052
|
-
return String(
|
|
3108
|
+
var k = t.ReactDebugCurrentFrame, C = k.getStackAddendum();
|
|
3109
|
+
C !== "" && (b += "%s", w = w.concat([C]));
|
|
3110
|
+
var A = w.map(function(E) {
|
|
3111
|
+
return String(E);
|
|
3053
3112
|
});
|
|
3054
|
-
A.unshift("Warning: " +
|
|
3113
|
+
A.unshift("Warning: " + b), Function.prototype.apply.call(console[v], console, A);
|
|
3055
3114
|
}
|
|
3056
3115
|
}
|
|
3057
|
-
function s(
|
|
3058
|
-
return
|
|
3116
|
+
function s(v, b) {
|
|
3117
|
+
return v === b && (v !== 0 || 1 / v === 1 / b) || v !== v && b !== b;
|
|
3059
3118
|
}
|
|
3060
3119
|
var o = typeof Object.is == "function" ? Object.is : s, i = e.useState, a = e.useEffect, c = e.useLayoutEffect, l = e.useDebugValue, u = !1, d = !1;
|
|
3061
|
-
function p(
|
|
3120
|
+
function p(v, b, w) {
|
|
3062
3121
|
u || e.startTransition !== void 0 && (u = !0, n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
|
|
3063
|
-
var
|
|
3122
|
+
var k = b();
|
|
3064
3123
|
if (!d) {
|
|
3065
|
-
var C =
|
|
3066
|
-
o(
|
|
3124
|
+
var C = b();
|
|
3125
|
+
o(k, C) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), d = !0);
|
|
3067
3126
|
}
|
|
3068
3127
|
var A = i({
|
|
3069
3128
|
inst: {
|
|
3070
|
-
value:
|
|
3071
|
-
getSnapshot:
|
|
3129
|
+
value: k,
|
|
3130
|
+
getSnapshot: b
|
|
3072
3131
|
}
|
|
3073
|
-
}),
|
|
3132
|
+
}), E = A[0].inst, O = A[1];
|
|
3074
3133
|
return c(function() {
|
|
3075
|
-
|
|
3076
|
-
inst:
|
|
3134
|
+
E.value = k, E.getSnapshot = b, h(E) && O({
|
|
3135
|
+
inst: E
|
|
3077
3136
|
});
|
|
3078
|
-
}, [
|
|
3079
|
-
h(
|
|
3080
|
-
inst:
|
|
3137
|
+
}, [v, k, b]), a(function() {
|
|
3138
|
+
h(E) && O({
|
|
3139
|
+
inst: E
|
|
3081
3140
|
});
|
|
3082
3141
|
var B = function() {
|
|
3083
|
-
h(
|
|
3084
|
-
inst:
|
|
3142
|
+
h(E) && O({
|
|
3143
|
+
inst: E
|
|
3085
3144
|
});
|
|
3086
3145
|
};
|
|
3087
|
-
return
|
|
3088
|
-
}, [
|
|
3146
|
+
return v(B);
|
|
3147
|
+
}, [v]), l(k), k;
|
|
3089
3148
|
}
|
|
3090
|
-
function h(
|
|
3091
|
-
var
|
|
3149
|
+
function h(v) {
|
|
3150
|
+
var b = v.getSnapshot, w = v.value;
|
|
3092
3151
|
try {
|
|
3093
|
-
var
|
|
3094
|
-
return !o(
|
|
3152
|
+
var k = b();
|
|
3153
|
+
return !o(w, k);
|
|
3095
3154
|
} catch {
|
|
3096
3155
|
return !0;
|
|
3097
3156
|
}
|
|
3098
3157
|
}
|
|
3099
|
-
function f(
|
|
3100
|
-
return
|
|
3158
|
+
function f(v, b, w) {
|
|
3159
|
+
return b();
|
|
3101
3160
|
}
|
|
3102
|
-
var m = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", g = !m, y = g ? f : p,
|
|
3103
|
-
|
|
3104
|
-
}()),
|
|
3161
|
+
var m = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", g = !m, y = g ? f : p, M = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : y;
|
|
3162
|
+
$t.useSyncExternalStore = M, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
3163
|
+
}()), $t;
|
|
3105
3164
|
}
|
|
3106
|
-
process.env.NODE_ENV === "production" ? jt.exports =
|
|
3107
|
-
var
|
|
3108
|
-
const
|
|
3165
|
+
process.env.NODE_ENV === "production" ? jt.exports = fo() : jt.exports = mo();
|
|
3166
|
+
var Ct = jt.exports;
|
|
3167
|
+
const go = (...e) => (t) => {
|
|
3109
3168
|
e.forEach((n) => {
|
|
3110
3169
|
typeof n == "function" ? n(t) : n && (n.current = t);
|
|
3111
3170
|
});
|
|
3112
|
-
},
|
|
3113
|
-
const t =
|
|
3171
|
+
}, yo = ({ contentComponent: e }) => {
|
|
3172
|
+
const t = Ct.useSyncExternalStore(e.subscribe, e.getSnapshot, e.getServerSnapshot);
|
|
3114
3173
|
return L.createElement(L.Fragment, null, Object.values(t));
|
|
3115
3174
|
};
|
|
3116
|
-
function
|
|
3175
|
+
function vo() {
|
|
3117
3176
|
const e = /* @__PURE__ */ new Set();
|
|
3118
3177
|
let t = {};
|
|
3119
3178
|
return {
|
|
@@ -3137,7 +3196,7 @@ function mo() {
|
|
|
3137
3196
|
setRenderer(n, r) {
|
|
3138
3197
|
t = {
|
|
3139
3198
|
...t,
|
|
3140
|
-
[n]:
|
|
3199
|
+
[n]: pr.createPortal(r.reactElement, r.element, n)
|
|
3141
3200
|
}, e.forEach((s) => s());
|
|
3142
3201
|
},
|
|
3143
3202
|
/**
|
|
@@ -3149,7 +3208,7 @@ function mo() {
|
|
|
3149
3208
|
}
|
|
3150
3209
|
};
|
|
3151
3210
|
}
|
|
3152
|
-
class
|
|
3211
|
+
class bo extends L.Component {
|
|
3153
3212
|
constructor(t) {
|
|
3154
3213
|
var n;
|
|
3155
3214
|
super(t), this.editorContentRef = L.createRef(), this.initialized = !1, this.state = {
|
|
@@ -3170,7 +3229,7 @@ class go extends L.Component {
|
|
|
3170
3229
|
const n = this.editorContentRef.current;
|
|
3171
3230
|
n.append(...t.options.element.childNodes), t.setOptions({
|
|
3172
3231
|
element: n
|
|
3173
|
-
}), t.contentComponent =
|
|
3232
|
+
}), t.contentComponent = vo(), this.state.hasContentComponentInitialized || (this.unsubscribeToContentComponent = t.contentComponent.subscribe(() => {
|
|
3174
3233
|
this.setState((r) => r.hasContentComponentInitialized ? r : {
|
|
3175
3234
|
hasContentComponentInitialized: !0
|
|
3176
3235
|
}), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent();
|
|
@@ -3193,20 +3252,20 @@ class go extends L.Component {
|
|
|
3193
3252
|
return L.createElement(
|
|
3194
3253
|
L.Fragment,
|
|
3195
3254
|
null,
|
|
3196
|
-
L.createElement("div", { ref:
|
|
3197
|
-
(t == null ? void 0 : t.contentComponent) && L.createElement(
|
|
3255
|
+
L.createElement("div", { ref: go(n, this.editorContentRef), ...r }),
|
|
3256
|
+
(t == null ? void 0 : t.contentComponent) && L.createElement(yo, { contentComponent: t.contentComponent })
|
|
3198
3257
|
);
|
|
3199
3258
|
}
|
|
3200
3259
|
}
|
|
3201
|
-
const
|
|
3260
|
+
const Mo = cr((e, t) => {
|
|
3202
3261
|
const n = L.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [e.editor]);
|
|
3203
|
-
return L.createElement(
|
|
3262
|
+
return L.createElement(bo, {
|
|
3204
3263
|
key: n,
|
|
3205
3264
|
innerRef: t,
|
|
3206
3265
|
...e
|
|
3207
3266
|
});
|
|
3208
|
-
}),
|
|
3209
|
-
var
|
|
3267
|
+
}), Ti = L.memo(Mo);
|
|
3268
|
+
var ko = function e(t, n) {
|
|
3210
3269
|
if (t === n) return !0;
|
|
3211
3270
|
if (t && n && typeof t == "object" && typeof n == "object") {
|
|
3212
3271
|
if (t.constructor !== n.constructor) return !1;
|
|
@@ -3251,7 +3310,7 @@ var vo = function e(t, n) {
|
|
|
3251
3310
|
return !0;
|
|
3252
3311
|
}
|
|
3253
3312
|
return t !== t && n !== n;
|
|
3254
|
-
},
|
|
3313
|
+
}, So = /* @__PURE__ */ ho(ko), Ft = { exports: {} }, _t = {};
|
|
3255
3314
|
/**
|
|
3256
3315
|
* @license React
|
|
3257
3316
|
* use-sync-external-store-shim/with-selector.production.min.js
|
|
@@ -3261,48 +3320,48 @@ var vo = function e(t, n) {
|
|
|
3261
3320
|
* This source code is licensed under the MIT license found in the
|
|
3262
3321
|
* LICENSE file in the root directory of this source tree.
|
|
3263
3322
|
*/
|
|
3264
|
-
var
|
|
3265
|
-
function
|
|
3266
|
-
if (
|
|
3267
|
-
|
|
3268
|
-
var e = L, t =
|
|
3323
|
+
var be;
|
|
3324
|
+
function wo() {
|
|
3325
|
+
if (be) return _t;
|
|
3326
|
+
be = 1;
|
|
3327
|
+
var e = L, t = Ct;
|
|
3269
3328
|
function n(l, u) {
|
|
3270
3329
|
return l === u && (l !== 0 || 1 / l === 1 / u) || l !== l && u !== u;
|
|
3271
3330
|
}
|
|
3272
3331
|
var r = typeof Object.is == "function" ? Object.is : n, s = t.useSyncExternalStore, o = e.useRef, i = e.useEffect, a = e.useMemo, c = e.useDebugValue;
|
|
3273
|
-
return
|
|
3332
|
+
return _t.useSyncExternalStoreWithSelector = function(l, u, d, p, h) {
|
|
3274
3333
|
var f = o(null);
|
|
3275
3334
|
if (f.current === null) {
|
|
3276
3335
|
var m = { hasValue: !1, value: null };
|
|
3277
3336
|
f.current = m;
|
|
3278
3337
|
} else m = f.current;
|
|
3279
3338
|
f = a(function() {
|
|
3280
|
-
function y(
|
|
3281
|
-
if (!
|
|
3282
|
-
if (
|
|
3339
|
+
function y(k) {
|
|
3340
|
+
if (!M) {
|
|
3341
|
+
if (M = !0, v = k, k = p(k), h !== void 0 && m.hasValue) {
|
|
3283
3342
|
var C = m.value;
|
|
3284
|
-
if (h(C,
|
|
3343
|
+
if (h(C, k)) return b = C;
|
|
3285
3344
|
}
|
|
3286
|
-
return
|
|
3345
|
+
return b = k;
|
|
3287
3346
|
}
|
|
3288
|
-
if (C =
|
|
3289
|
-
var A = p(
|
|
3290
|
-
return h !== void 0 && h(C, A) ? C : (
|
|
3347
|
+
if (C = b, r(v, k)) return C;
|
|
3348
|
+
var A = p(k);
|
|
3349
|
+
return h !== void 0 && h(C, A) ? C : (v = k, b = A);
|
|
3291
3350
|
}
|
|
3292
|
-
var
|
|
3351
|
+
var M = !1, v, b, w = d === void 0 ? null : d;
|
|
3293
3352
|
return [function() {
|
|
3294
3353
|
return y(u());
|
|
3295
|
-
},
|
|
3296
|
-
return y(
|
|
3354
|
+
}, w === null ? void 0 : function() {
|
|
3355
|
+
return y(w());
|
|
3297
3356
|
}];
|
|
3298
3357
|
}, [u, d, p, h]);
|
|
3299
3358
|
var g = s(l, f[0], f[1]);
|
|
3300
3359
|
return i(function() {
|
|
3301
3360
|
m.hasValue = !0, m.value = g;
|
|
3302
3361
|
}, [g]), c(g), g;
|
|
3303
|
-
},
|
|
3362
|
+
}, _t;
|
|
3304
3363
|
}
|
|
3305
|
-
var
|
|
3364
|
+
var Ht = {};
|
|
3306
3365
|
/**
|
|
3307
3366
|
* @license React
|
|
3308
3367
|
* use-sync-external-store-shim/with-selector.development.js
|
|
@@ -3312,11 +3371,11 @@ var _t = {};
|
|
|
3312
3371
|
* This source code is licensed under the MIT license found in the
|
|
3313
3372
|
* LICENSE file in the root directory of this source tree.
|
|
3314
3373
|
*/
|
|
3315
|
-
var
|
|
3316
|
-
function
|
|
3317
|
-
return
|
|
3374
|
+
var Me;
|
|
3375
|
+
function Eo() {
|
|
3376
|
+
return Me || (Me = 1, process.env.NODE_ENV !== "production" && function() {
|
|
3318
3377
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
3319
|
-
var e = L, t =
|
|
3378
|
+
var e = L, t = Ct;
|
|
3320
3379
|
function n(u, d) {
|
|
3321
3380
|
return u === d && (u !== 0 || 1 / u === 1 / d) || u !== u && d !== d;
|
|
3322
3381
|
}
|
|
@@ -3328,39 +3387,40 @@ function So() {
|
|
|
3328
3387
|
value: null
|
|
3329
3388
|
}, m.current = g) : g = m.current;
|
|
3330
3389
|
var y = a(function() {
|
|
3331
|
-
var
|
|
3332
|
-
if (!
|
|
3333
|
-
|
|
3334
|
-
var
|
|
3390
|
+
var w = !1, k, C, A = function(F) {
|
|
3391
|
+
if (!w) {
|
|
3392
|
+
w = !0, k = F;
|
|
3393
|
+
var Q = h(F);
|
|
3335
3394
|
if (f !== void 0 && g.hasValue) {
|
|
3336
3395
|
var q = g.value;
|
|
3337
|
-
if (f(q,
|
|
3396
|
+
if (f(q, Q))
|
|
3338
3397
|
return C = q, q;
|
|
3339
3398
|
}
|
|
3340
|
-
return C =
|
|
3399
|
+
return C = Q, Q;
|
|
3341
3400
|
}
|
|
3342
|
-
var
|
|
3343
|
-
if (r(
|
|
3401
|
+
var G = k, z = C;
|
|
3402
|
+
if (r(G, F))
|
|
3344
3403
|
return z;
|
|
3345
|
-
var
|
|
3346
|
-
return f !== void 0 && f(z,
|
|
3347
|
-
},
|
|
3404
|
+
var J = h(F);
|
|
3405
|
+
return f !== void 0 && f(z, J) ? z : (k = F, C = J, J);
|
|
3406
|
+
}, E = p === void 0 ? null : p, O = function() {
|
|
3348
3407
|
return A(d());
|
|
3349
|
-
}, B =
|
|
3350
|
-
return A(
|
|
3408
|
+
}, B = E === null ? void 0 : function() {
|
|
3409
|
+
return A(E());
|
|
3351
3410
|
};
|
|
3352
3411
|
return [O, B];
|
|
3353
|
-
}, [d, p, h, f]),
|
|
3412
|
+
}, [d, p, h, f]), M = y[0], v = y[1], b = s(u, M, v);
|
|
3354
3413
|
return i(function() {
|
|
3355
|
-
g.hasValue = !0, g.value =
|
|
3356
|
-
}, [
|
|
3414
|
+
g.hasValue = !0, g.value = b;
|
|
3415
|
+
}, [b]), c(b), b;
|
|
3357
3416
|
}
|
|
3358
|
-
|
|
3359
|
-
}()),
|
|
3417
|
+
Ht.useSyncExternalStoreWithSelector = l, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
3418
|
+
}()), Ht;
|
|
3360
3419
|
}
|
|
3361
|
-
process.env.NODE_ENV === "production" ? Ft.exports =
|
|
3362
|
-
var
|
|
3363
|
-
|
|
3420
|
+
process.env.NODE_ENV === "production" ? Ft.exports = wo() : Ft.exports = Eo();
|
|
3421
|
+
var To = Ft.exports;
|
|
3422
|
+
const Co = typeof window < "u" ? ur : qt;
|
|
3423
|
+
class xo {
|
|
3364
3424
|
constructor(t) {
|
|
3365
3425
|
this.transactionNumber = 0, this.lastTransactionNumber = 0, this.subscribers = /* @__PURE__ */ new Set(), this.editor = t, this.lastSnapshot = { editor: t, transactionNumber: 0 }, this.getSnapshot = this.getSnapshot.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.watch = this.watch.bind(this), this.subscribe = this.subscribe.bind(this);
|
|
3366
3426
|
}
|
|
@@ -3398,13 +3458,13 @@ class wo {
|
|
|
3398
3458
|
}
|
|
3399
3459
|
}
|
|
3400
3460
|
}
|
|
3401
|
-
function
|
|
3461
|
+
function Ao(e) {
|
|
3402
3462
|
var t;
|
|
3403
|
-
const [n] =
|
|
3404
|
-
return
|
|
3463
|
+
const [n] = Ut(() => new xo(e.editor)), r = To.useSyncExternalStoreWithSelector(n.subscribe, n.getSnapshot, n.getServerSnapshot, e.selector, (t = e.equalityFn) !== null && t !== void 0 ? t : So);
|
|
3464
|
+
return Co(() => n.watch(e.editor), [e.editor, n]), Ne(r), r;
|
|
3405
3465
|
}
|
|
3406
|
-
const
|
|
3407
|
-
class
|
|
3466
|
+
const ke = process.env.NODE_ENV !== "production", zt = typeof window > "u", Oo = zt || !!(typeof window < "u" && window.next);
|
|
3467
|
+
class Lo {
|
|
3408
3468
|
constructor(t) {
|
|
3409
3469
|
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);
|
|
3410
3470
|
}
|
|
@@ -3413,8 +3473,8 @@ class Co {
|
|
|
3413
3473
|
}
|
|
3414
3474
|
getInitialEditor() {
|
|
3415
3475
|
if (this.options.current.immediatelyRender === void 0)
|
|
3416
|
-
return zt ||
|
|
3417
|
-
if (this.options.current.immediatelyRender && zt &&
|
|
3476
|
+
return zt || Oo ? (ke && console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."), null) : this.createEditor();
|
|
3477
|
+
if (this.options.current.immediatelyRender && zt && ke)
|
|
3418
3478
|
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.");
|
|
3419
3479
|
return this.options.current.immediatelyRender ? this.createEditor() : null;
|
|
3420
3480
|
}
|
|
@@ -3470,7 +3530,7 @@ class Co {
|
|
|
3470
3530
|
return (o = (s = this.options.current).onPaste) === null || o === void 0 ? void 0 : o.call(s, ...r);
|
|
3471
3531
|
}
|
|
3472
3532
|
};
|
|
3473
|
-
return new
|
|
3533
|
+
return new ro(t);
|
|
3474
3534
|
}
|
|
3475
3535
|
/**
|
|
3476
3536
|
* Get the current editor instance.
|
|
@@ -3535,21 +3595,21 @@ class Co {
|
|
|
3535
3595
|
}, 1);
|
|
3536
3596
|
}
|
|
3537
3597
|
}
|
|
3538
|
-
function
|
|
3539
|
-
const n =
|
|
3598
|
+
function Ci(e = {}, t = []) {
|
|
3599
|
+
const n = dr(e);
|
|
3540
3600
|
n.current = e;
|
|
3541
|
-
const [r] =
|
|
3542
|
-
return
|
|
3601
|
+
const [r] = Ut(() => new Lo(n)), s = Ct.useSyncExternalStore(r.subscribe, r.getEditor, r.getServerSnapshot);
|
|
3602
|
+
return Ne(s), qt(r.onRender(t)), Ao({
|
|
3543
3603
|
editor: s,
|
|
3544
3604
|
selector: ({ transactionNumber: o }) => e.shouldRerenderOnTransaction === !1 ? null : e.immediatelyRender && o === 0 ? 0 : o + 1
|
|
3545
3605
|
}), s;
|
|
3546
3606
|
}
|
|
3547
|
-
const
|
|
3607
|
+
const tn = De({
|
|
3548
3608
|
editor: null
|
|
3549
3609
|
});
|
|
3550
|
-
|
|
3551
|
-
const
|
|
3552
|
-
const [t, n] =
|
|
3610
|
+
tn.Consumer;
|
|
3611
|
+
const Po = () => Be(tn), xi = (e) => {
|
|
3612
|
+
const [t, n] = Ut(null), { editor: r } = Po();
|
|
3553
3613
|
return qt(() => {
|
|
3554
3614
|
var s;
|
|
3555
3615
|
if (!t || !((s = e.editor) === null || s === void 0) && s.isDestroyed || r != null && r.isDestroyed)
|
|
@@ -3559,7 +3619,7 @@ const xo = () => De(Xe), wi = (e) => {
|
|
|
3559
3619
|
console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
|
|
3560
3620
|
return;
|
|
3561
3621
|
}
|
|
3562
|
-
const d =
|
|
3622
|
+
const d = Ze({
|
|
3563
3623
|
updateDelay: c,
|
|
3564
3624
|
editor: u,
|
|
3565
3625
|
element: t,
|
|
@@ -3571,10 +3631,10 @@ const xo = () => De(Xe), wi = (e) => {
|
|
|
3571
3631
|
u.unregisterPlugin(o);
|
|
3572
3632
|
};
|
|
3573
3633
|
}, [e.editor, r, t]), L.createElement("div", { ref: n, className: e.className, style: { visibility: "hidden" } }, e.children);
|
|
3574
|
-
},
|
|
3634
|
+
}, en = De({
|
|
3575
3635
|
onDragStart: void 0
|
|
3576
|
-
}),
|
|
3577
|
-
const t = e.as || "div", { nodeViewContentRef: n } =
|
|
3636
|
+
}), nn = () => Be(en), Ai = (e) => {
|
|
3637
|
+
const t = e.as || "div", { nodeViewContentRef: n } = nn();
|
|
3578
3638
|
return (
|
|
3579
3639
|
// @ts-ignore
|
|
3580
3640
|
L.createElement(t, { ...e, ref: n, "data-node-view-content": "", style: {
|
|
@@ -3582,8 +3642,8 @@ const xo = () => De(Xe), wi = (e) => {
|
|
|
3582
3642
|
...e.style
|
|
3583
3643
|
} })
|
|
3584
3644
|
);
|
|
3585
|
-
},
|
|
3586
|
-
const { onDragStart: n } =
|
|
3645
|
+
}, Oi = L.forwardRef((e, t) => {
|
|
3646
|
+
const { onDragStart: n } = nn(), r = e.as || "div";
|
|
3587
3647
|
return (
|
|
3588
3648
|
// @ts-ignore
|
|
3589
3649
|
L.createElement(r, { ...e, ref: t, "data-node-view-wrapper": "", onDragStart: n, style: {
|
|
@@ -3592,19 +3652,19 @@ const xo = () => De(Xe), wi = (e) => {
|
|
|
3592
3652
|
} })
|
|
3593
3653
|
);
|
|
3594
3654
|
});
|
|
3595
|
-
function
|
|
3655
|
+
function Ro(e) {
|
|
3596
3656
|
return !!(typeof e == "function" && e.prototype && e.prototype.isReactComponent);
|
|
3597
3657
|
}
|
|
3598
|
-
function
|
|
3658
|
+
function $o(e) {
|
|
3599
3659
|
var t;
|
|
3600
3660
|
return typeof e == "object" && ((t = e.$$typeof) === null || t === void 0 ? void 0 : t.toString()) === "Symbol(react.forward_ref)";
|
|
3601
3661
|
}
|
|
3602
|
-
class
|
|
3662
|
+
class _o {
|
|
3603
3663
|
/**
|
|
3604
3664
|
* Immediately creates element and renders the provided React component.
|
|
3605
3665
|
*/
|
|
3606
3666
|
constructor(t, { editor: n, props: r = {}, as: s = "div", className: o = "" }) {
|
|
3607
|
-
this.ref = null, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = t, this.editor = n, this.props = r, this.element = document.createElement(s), this.element.classList.add("react-renderer"), o && this.element.classList.add(...o.split(" ")), this.editor.isInitialized ?
|
|
3667
|
+
this.ref = null, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = t, this.editor = n, this.props = r, this.element = document.createElement(s), this.element.classList.add("react-renderer"), o && this.element.classList.add(...o.split(" ")), this.editor.isInitialized ? hr(() => {
|
|
3608
3668
|
this.render();
|
|
3609
3669
|
}) : this.render();
|
|
3610
3670
|
}
|
|
@@ -3614,9 +3674,9 @@ class Lo {
|
|
|
3614
3674
|
render() {
|
|
3615
3675
|
var t;
|
|
3616
3676
|
const n = this.component, r = this.props, s = this.editor;
|
|
3617
|
-
(
|
|
3677
|
+
(Ro(n) || $o(n)) && (r.ref = (o) => {
|
|
3618
3678
|
this.ref = o;
|
|
3619
|
-
}), this.reactElement = L.createElement(n, r), (t = s == null ? void 0 : s.contentComponent) === null || t === void 0 || t.setRenderer(this.id, this);
|
|
3679
|
+
}), this.reactElement = L.createElement(n, { ...r }), (t = s == null ? void 0 : s.contentComponent) === null || t === void 0 || t.setRenderer(this.id, this);
|
|
3620
3680
|
}
|
|
3621
3681
|
/**
|
|
3622
3682
|
* Re-renders the React component with new props.
|
|
@@ -3644,7 +3704,7 @@ class Lo {
|
|
|
3644
3704
|
});
|
|
3645
3705
|
}
|
|
3646
3706
|
}
|
|
3647
|
-
class
|
|
3707
|
+
class Ho extends oo {
|
|
3648
3708
|
/**
|
|
3649
3709
|
* Setup the React component.
|
|
3650
3710
|
* Called on initialization.
|
|
@@ -3669,12 +3729,12 @@ class Ro extends no {
|
|
|
3669
3729
|
}
|
|
3670
3730
|
const s = { onDragStart: this.onDragStart.bind(this), nodeViewContentRef: (l) => {
|
|
3671
3731
|
l && this.contentDOMElement && l.firstChild !== this.contentDOMElement && l.appendChild(this.contentDOMElement);
|
|
3672
|
-
} }, o = this.component, i = L.memo((l) => L.createElement(
|
|
3732
|
+
} }, o = this.component, i = L.memo((l) => L.createElement(en.Provider, { value: s }, L.createElement(o, l)));
|
|
3673
3733
|
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");
|
|
3674
3734
|
let a = this.node.isInline ? "span" : "div";
|
|
3675
3735
|
this.options.as && (a = this.options.as);
|
|
3676
3736
|
const { className: c = "" } = this.options;
|
|
3677
|
-
this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.renderer = new
|
|
3737
|
+
this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.renderer = new _o(i, {
|
|
3678
3738
|
editor: this.editor,
|
|
3679
3739
|
props: t,
|
|
3680
3740
|
as: a,
|
|
@@ -3771,7 +3831,7 @@ class Ro extends no {
|
|
|
3771
3831
|
if (this.options.attrs) {
|
|
3772
3832
|
let t = {};
|
|
3773
3833
|
if (typeof this.options.attrs == "function") {
|
|
3774
|
-
const n = this.editor.extensionManager.attributes, r =
|
|
3834
|
+
const n = this.editor.extensionManager.attributes, r = mt(this.node, n);
|
|
3775
3835
|
t = this.options.attrs({ node: this.node, HTMLAttributes: r });
|
|
3776
3836
|
} else
|
|
3777
3837
|
t = this.options.attrs;
|
|
@@ -3779,40 +3839,40 @@ class Ro extends no {
|
|
|
3779
3839
|
}
|
|
3780
3840
|
}
|
|
3781
3841
|
}
|
|
3782
|
-
function
|
|
3783
|
-
return (n) => n.editor.contentComponent ? new
|
|
3842
|
+
function Li(e, t) {
|
|
3843
|
+
return (n) => n.editor.contentComponent ? new Ho(e, n, t) : {};
|
|
3784
3844
|
}
|
|
3785
|
-
function
|
|
3845
|
+
function ee(e, t, n) {
|
|
3786
3846
|
const r = [], s = e.node(0);
|
|
3787
3847
|
n = typeof n == "number" && n >= 0 ? n : e.sameParent(t) ? Math.max(0, e.sharedDepth(t.pos) - 1) : e.sharedDepth(t.pos);
|
|
3788
|
-
const o = new
|
|
3848
|
+
const o = new Vn(e, t, n), i = o.depth === 0 ? 0 : s.resolve(o.start).posAtIndex(0);
|
|
3789
3849
|
return o.parent.forEach((a, c) => {
|
|
3790
3850
|
const l = i + c, u = l + a.nodeSize;
|
|
3791
3851
|
if (l < o.start || l >= o.end)
|
|
3792
3852
|
return;
|
|
3793
|
-
const d = new
|
|
3853
|
+
const d = new jn(s.resolve(l), s.resolve(u));
|
|
3794
3854
|
r.push(d);
|
|
3795
3855
|
}), r;
|
|
3796
3856
|
}
|
|
3797
|
-
class
|
|
3857
|
+
class ne {
|
|
3798
3858
|
constructor(t, n) {
|
|
3799
|
-
|
|
3800
|
-
|
|
3859
|
+
it(this, "anchor");
|
|
3860
|
+
it(this, "head");
|
|
3801
3861
|
this.anchor = t, this.head = n;
|
|
3802
3862
|
}
|
|
3803
3863
|
map(t) {
|
|
3804
|
-
return new
|
|
3864
|
+
return new ne(t.map(this.anchor), t.map(this.head));
|
|
3805
3865
|
}
|
|
3806
3866
|
resolve(t) {
|
|
3807
3867
|
const n = t.resolve(this.anchor), r = t.resolve(this.head);
|
|
3808
3868
|
return new N(n, r);
|
|
3809
3869
|
}
|
|
3810
3870
|
}
|
|
3811
|
-
class N extends
|
|
3871
|
+
class N extends V {
|
|
3812
3872
|
constructor(n, r, s, o = 1) {
|
|
3813
|
-
const { doc: i } = n, a = n === r, c = n.pos === i.content.size && r.pos === i.content.size, l = a && !c ? i.resolve(r.pos + (o > 0 ? 1 : -1)) : r, u = a && c ? i.resolve(n.pos - (o > 0 ? 1 : -1)) : n, d =
|
|
3873
|
+
const { doc: i } = n, a = n === r, c = n.pos === i.content.size && r.pos === i.content.size, l = a && !c ? i.resolve(r.pos + (o > 0 ? 1 : -1)) : r, u = a && c ? i.resolve(n.pos - (o > 0 ? 1 : -1)) : n, d = ee(u.min(l), u.max(l), s);
|
|
3814
3874
|
super(l.pos >= n.pos ? d[0].$from : d[d.length - 1].$to, l.pos >= n.pos ? d[d.length - 1].$to : d[0].$from, d);
|
|
3815
|
-
|
|
3875
|
+
it(this, "depth");
|
|
3816
3876
|
this.depth = s;
|
|
3817
3877
|
}
|
|
3818
3878
|
get $to() {
|
|
@@ -3859,10 +3919,10 @@ class N extends W {
|
|
|
3859
3919
|
return new this(n.resolve(r), n.resolve(s), o, i);
|
|
3860
3920
|
}
|
|
3861
3921
|
getBookmark() {
|
|
3862
|
-
return new
|
|
3922
|
+
return new ne(this.anchor, this.head);
|
|
3863
3923
|
}
|
|
3864
3924
|
}
|
|
3865
|
-
function
|
|
3925
|
+
function Io(e) {
|
|
3866
3926
|
const t = e.cloneNode(!0), n = [e, ...Array.from(e.getElementsByTagName("*"))], r = [t, ...Array.from(t.getElementsByTagName("*"))];
|
|
3867
3927
|
return n.forEach((s, o) => {
|
|
3868
3928
|
r[o].style.cssText = function(i) {
|
|
@@ -3874,16 +3934,16 @@ function Po(e) {
|
|
|
3874
3934
|
}(s);
|
|
3875
3935
|
}), t;
|
|
3876
3936
|
}
|
|
3877
|
-
function
|
|
3937
|
+
function dt(e, t) {
|
|
3878
3938
|
return window.getComputedStyle(e)[t];
|
|
3879
3939
|
}
|
|
3880
|
-
function
|
|
3940
|
+
function Do(e = 0, t = 0, n = 0) {
|
|
3881
3941
|
return Math.min(Math.max(e, t), n);
|
|
3882
3942
|
}
|
|
3883
|
-
function
|
|
3943
|
+
function Se(e) {
|
|
3884
3944
|
e.parentNode !== null && e.parentNode !== void 0 && e.parentNode.removeChild(e);
|
|
3885
3945
|
}
|
|
3886
|
-
const
|
|
3946
|
+
const rn = (e) => {
|
|
3887
3947
|
const { x: t, y: n, direction: r, editor: s } = e;
|
|
3888
3948
|
let o = null, i = null, a = null, c = t;
|
|
3889
3949
|
for (; i === null && c < window.innerWidth && c > 0; ) {
|
|
@@ -3899,13 +3959,13 @@ const tn = (e) => {
|
|
|
3899
3959
|
}
|
|
3900
3960
|
return { resultElement: o, resultNode: i, pos: a !== null ? a : null };
|
|
3901
3961
|
};
|
|
3902
|
-
function
|
|
3903
|
-
const { doc: n } = t.view.state, r =
|
|
3962
|
+
function No(e, t) {
|
|
3963
|
+
const { doc: n } = t.view.state, r = rn({ editor: t, x: e.clientX, y: e.clientY, direction: "right" });
|
|
3904
3964
|
if (!r.resultNode || r.pos === null)
|
|
3905
3965
|
return [];
|
|
3906
3966
|
const s = e.clientX, o = function(u, d, p) {
|
|
3907
|
-
const h = parseInt(
|
|
3908
|
-
return { left:
|
|
3967
|
+
const h = parseInt(dt(u.dom, "paddingLeft"), 10), f = parseInt(dt(u.dom, "paddingRight"), 10), m = parseInt(dt(u.dom, "borderLeftWidth"), 10), g = parseInt(dt(u.dom, "borderLeftWidth"), 10), y = u.dom.getBoundingClientRect();
|
|
3968
|
+
return { left: Do(d, y.left + h + m, y.right - f - g), top: p };
|
|
3909
3969
|
}(t.view, s, e.clientY), i = t.view.posAtCoords(o);
|
|
3910
3970
|
if (!i)
|
|
3911
3971
|
return [];
|
|
@@ -3913,12 +3973,12 @@ function _o(e, t) {
|
|
|
3913
3973
|
if (!n.resolve(a).parent)
|
|
3914
3974
|
return [];
|
|
3915
3975
|
const c = n.resolve(r.pos), l = n.resolve(r.pos + 1);
|
|
3916
|
-
return
|
|
3976
|
+
return ee(c, l, 0);
|
|
3917
3977
|
}
|
|
3918
|
-
const
|
|
3978
|
+
const we = (e, t) => {
|
|
3919
3979
|
const n = e.resolve(t), { depth: r } = n;
|
|
3920
3980
|
return r === 0 ? t : n.pos - n.parentOffset - 1;
|
|
3921
|
-
},
|
|
3981
|
+
}, Ee = (e, t) => {
|
|
3922
3982
|
const n = e.nodeAt(t), r = e.resolve(t);
|
|
3923
3983
|
let { depth: s } = r, o = n;
|
|
3924
3984
|
for (; s > 0; ) {
|
|
@@ -3926,34 +3986,34 @@ const Me = (e, t) => {
|
|
|
3926
3986
|
s -= 1, s === 0 && (o = i);
|
|
3927
3987
|
}
|
|
3928
3988
|
return o;
|
|
3929
|
-
},
|
|
3930
|
-
const n =
|
|
3931
|
-
return n ?
|
|
3932
|
-
},
|
|
3989
|
+
}, It = (e, t) => {
|
|
3990
|
+
const n = Fn.getState(e);
|
|
3991
|
+
return n ? zn(t, n.type, n.binding.mapping) : null;
|
|
3992
|
+
}, Te = (e, t) => {
|
|
3933
3993
|
let n = t;
|
|
3934
3994
|
for (; n && n.parentNode && n.parentNode !== e.dom; )
|
|
3935
3995
|
n = n.parentNode;
|
|
3936
3996
|
return n;
|
|
3937
|
-
},
|
|
3997
|
+
}, Bo = new _("dragHandle"), Pi = ({ pluginKey: e = Bo, element: t, editor: n, tippyOptions: r, onNodeChange: s }) => {
|
|
3938
3998
|
const o = document.createElement("div");
|
|
3939
3999
|
let i = null, a = !1, c = null, l = -1;
|
|
3940
4000
|
return t.addEventListener("dragstart", (u) => {
|
|
3941
4001
|
const { view: d } = n;
|
|
3942
4002
|
if (!u.dataTransfer)
|
|
3943
4003
|
return;
|
|
3944
|
-
const { empty: p, $from: h, $to: f } = d.state.selection, m =
|
|
3945
|
-
if (!
|
|
4004
|
+
const { empty: p, $from: h, $to: f } = d.state.selection, m = No(u, n), g = ee(h, f, 0), y = g.some((E) => m.find((O) => O.$from === E.$from && O.$to === E.$to)), M = p || !y ? m : g;
|
|
4005
|
+
if (!M.length)
|
|
3946
4006
|
return;
|
|
3947
|
-
const { tr:
|
|
3948
|
-
|
|
3949
|
-
const O =
|
|
3950
|
-
|
|
3951
|
-
}),
|
|
4007
|
+
const { tr: v } = d.state, b = document.createElement("div"), w = M[0].$from.pos, k = M[M.length - 1].$to.pos, C = N.create(d.state.doc, w, k), A = C.content();
|
|
4008
|
+
M.forEach((E) => {
|
|
4009
|
+
const O = Io(d.nodeDOM(E.$from.pos));
|
|
4010
|
+
b.append(O);
|
|
4011
|
+
}), b.style.position = "absolute", b.style.top = "-10000px", document.body.append(b), u.dataTransfer.clearData(), u.dataTransfer.setDragImage(b, 0, 0), d.dragging = { slice: A, move: !0 }, v.setSelection(C), d.dispatch(v), document.addEventListener("drop", () => Se(b), { once: !0 }), setTimeout(() => {
|
|
3952
4012
|
t && (t.style.pointerEvents = "none");
|
|
3953
4013
|
}, 0);
|
|
3954
4014
|
}), t.addEventListener("dragend", () => {
|
|
3955
4015
|
t && (t.style.pointerEvents = "auto");
|
|
3956
|
-
}), new
|
|
4016
|
+
}), new $({
|
|
3957
4017
|
key: typeof e == "string" ? new _(e) : e,
|
|
3958
4018
|
state: {
|
|
3959
4019
|
init: () => ({ locked: !1 }),
|
|
@@ -3963,14 +4023,14 @@ const Me = (e, t) => {
|
|
|
3963
4023
|
return i.hide(), a = !1, c = null, l = -1, s == null || s({ editor: n, node: null, pos: -1 }), d;
|
|
3964
4024
|
if (u.docChanged && l !== -1 && t && i) {
|
|
3965
4025
|
const g = u.mapping.map(l);
|
|
3966
|
-
g !== l && (l = g,
|
|
4026
|
+
g !== l && (l = g, It(h, l));
|
|
3967
4027
|
}
|
|
3968
4028
|
return d;
|
|
3969
4029
|
}
|
|
3970
4030
|
},
|
|
3971
4031
|
view: (u) => {
|
|
3972
4032
|
var d;
|
|
3973
|
-
return t.draggable = !0, t.style.pointerEvents = "auto", (d = n.view.dom.parentElement) === null || d === void 0 || d.appendChild(o), o.appendChild(t), o.style.pointerEvents = "none", o.style.position = "absolute", o.style.top = "0", o.style.left = "0", i =
|
|
4033
|
+
return t.draggable = !0, t.style.pointerEvents = "auto", (d = n.view.dom.parentElement) === null || d === void 0 || d.appendChild(o), o.appendChild(t), o.style.pointerEvents = "none", o.style.position = "absolute", o.style.top = "0", o.style.left = "0", i = Re(u.dom, {
|
|
3974
4034
|
getReferenceClientRect: null,
|
|
3975
4035
|
interactive: !0,
|
|
3976
4036
|
trigger: "manual",
|
|
@@ -3992,16 +4052,16 @@ const Me = (e, t) => {
|
|
|
3992
4052
|
if (!t || !i || (t.draggable = !a, u.state.doc.eq(h.doc) || l === -1))
|
|
3993
4053
|
return;
|
|
3994
4054
|
let f = u.nodeDOM(l);
|
|
3995
|
-
if (f =
|
|
4055
|
+
if (f = Te(u, f), f === u.dom || (f == null ? void 0 : f.nodeType) !== 1)
|
|
3996
4056
|
return;
|
|
3997
|
-
const m = u.posAtDOM(f, 0), g =
|
|
4057
|
+
const m = u.posAtDOM(f, 0), g = Ee(n.state.doc, m);
|
|
3998
4058
|
if (g !== c) {
|
|
3999
|
-
const y =
|
|
4000
|
-
c = g, l = y,
|
|
4059
|
+
const y = we(n.state.doc, m);
|
|
4060
|
+
c = g, l = y, It(u.state, l), s == null || s({ editor: n, node: c, pos: l }), i.setProps({ getReferenceClientRect: () => f.getBoundingClientRect() }), i.show();
|
|
4001
4061
|
}
|
|
4002
4062
|
},
|
|
4003
4063
|
destroy() {
|
|
4004
|
-
i == null || i.destroy(), t &&
|
|
4064
|
+
i == null || i.destroy(), t && Se(o);
|
|
4005
4065
|
}
|
|
4006
4066
|
};
|
|
4007
4067
|
},
|
|
@@ -4011,23 +4071,23 @@ const Me = (e, t) => {
|
|
|
4011
4071
|
mousemove(u, d) {
|
|
4012
4072
|
if (!t || !i || a)
|
|
4013
4073
|
return !1;
|
|
4014
|
-
const p =
|
|
4074
|
+
const p = rn({ x: d.clientX, y: d.clientY, direction: "right", editor: n });
|
|
4015
4075
|
if (!p.resultElement)
|
|
4016
4076
|
return !1;
|
|
4017
4077
|
let h = p.resultElement;
|
|
4018
|
-
if (h =
|
|
4078
|
+
if (h = Te(u, h), h === u.dom || (h == null ? void 0 : h.nodeType) !== 1)
|
|
4019
4079
|
return !1;
|
|
4020
|
-
const f = u.posAtDOM(h, 0), m =
|
|
4080
|
+
const f = u.posAtDOM(h, 0), m = Ee(n.state.doc, f);
|
|
4021
4081
|
if (m !== c) {
|
|
4022
|
-
const g =
|
|
4023
|
-
c = m, l = g,
|
|
4082
|
+
const g = we(n.state.doc, f);
|
|
4083
|
+
c = m, l = g, It(u.state, l), s == null || s({ editor: n, node: c, pos: l }), i.setProps({ getReferenceClientRect: () => h.getBoundingClientRect() }), i.show();
|
|
4024
4084
|
}
|
|
4025
4085
|
return !1;
|
|
4026
4086
|
}
|
|
4027
4087
|
}
|
|
4028
4088
|
}
|
|
4029
4089
|
});
|
|
4030
|
-
},
|
|
4090
|
+
}, jo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, Fo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, zo = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, Vo = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, Ri = D.create({
|
|
4031
4091
|
name: "italic",
|
|
4032
4092
|
addOptions() {
|
|
4033
4093
|
return {
|
|
@@ -4070,29 +4130,29 @@ const Me = (e, t) => {
|
|
|
4070
4130
|
},
|
|
4071
4131
|
addInputRules() {
|
|
4072
4132
|
return [
|
|
4073
|
-
|
|
4074
|
-
find:
|
|
4133
|
+
X({
|
|
4134
|
+
find: jo,
|
|
4075
4135
|
type: this.type
|
|
4076
4136
|
}),
|
|
4077
|
-
|
|
4078
|
-
find:
|
|
4137
|
+
X({
|
|
4138
|
+
find: zo,
|
|
4079
4139
|
type: this.type
|
|
4080
4140
|
})
|
|
4081
4141
|
];
|
|
4082
4142
|
},
|
|
4083
4143
|
addPasteRules() {
|
|
4084
4144
|
return [
|
|
4085
|
-
|
|
4086
|
-
find:
|
|
4145
|
+
K({
|
|
4146
|
+
find: Fo,
|
|
4087
4147
|
type: this.type
|
|
4088
4148
|
}),
|
|
4089
|
-
|
|
4090
|
-
find:
|
|
4149
|
+
K({
|
|
4150
|
+
find: Vo,
|
|
4091
4151
|
type: this.type
|
|
4092
4152
|
})
|
|
4093
4153
|
];
|
|
4094
4154
|
}
|
|
4095
|
-
}),
|
|
4155
|
+
}), $i = D.create({
|
|
4096
4156
|
name: "underline",
|
|
4097
4157
|
addOptions() {
|
|
4098
4158
|
return {
|
|
@@ -4127,7 +4187,7 @@ const Me = (e, t) => {
|
|
|
4127
4187
|
"Mod-U": () => this.editor.commands.toggleUnderline()
|
|
4128
4188
|
};
|
|
4129
4189
|
}
|
|
4130
|
-
}),
|
|
4190
|
+
}), Wo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, Ko = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, _i = D.create({
|
|
4131
4191
|
name: "strike",
|
|
4132
4192
|
addOptions() {
|
|
4133
4193
|
return {
|
|
@@ -4169,21 +4229,21 @@ const Me = (e, t) => {
|
|
|
4169
4229
|
},
|
|
4170
4230
|
addInputRules() {
|
|
4171
4231
|
return [
|
|
4172
|
-
|
|
4173
|
-
find:
|
|
4232
|
+
X({
|
|
4233
|
+
find: Wo,
|
|
4174
4234
|
type: this.type
|
|
4175
4235
|
})
|
|
4176
4236
|
];
|
|
4177
4237
|
},
|
|
4178
4238
|
addPasteRules() {
|
|
4179
4239
|
return [
|
|
4180
|
-
|
|
4181
|
-
find:
|
|
4240
|
+
K({
|
|
4241
|
+
find: Ko,
|
|
4182
4242
|
type: this.type
|
|
4183
4243
|
})
|
|
4184
4244
|
];
|
|
4185
4245
|
}
|
|
4186
|
-
}),
|
|
4246
|
+
}), Uo = new RegExp("(?<!`)`([^`]+)`(?!`)"), qo = new RegExp("(?<!`)`([^`]+)`(?!`)", "g"), Hi = D.create({
|
|
4187
4247
|
name: "code",
|
|
4188
4248
|
addOptions() {
|
|
4189
4249
|
return {
|
|
@@ -4215,21 +4275,21 @@ const Me = (e, t) => {
|
|
|
4215
4275
|
},
|
|
4216
4276
|
addInputRules() {
|
|
4217
4277
|
return [
|
|
4218
|
-
|
|
4219
|
-
find:
|
|
4278
|
+
X({
|
|
4279
|
+
find: Uo,
|
|
4220
4280
|
type: this.type
|
|
4221
4281
|
})
|
|
4222
4282
|
];
|
|
4223
4283
|
},
|
|
4224
4284
|
addPasteRules() {
|
|
4225
4285
|
return [
|
|
4226
|
-
|
|
4227
|
-
find:
|
|
4286
|
+
K({
|
|
4287
|
+
find: qo,
|
|
4228
4288
|
type: this.type
|
|
4229
4289
|
})
|
|
4230
4290
|
];
|
|
4231
4291
|
}
|
|
4232
|
-
}),
|
|
4292
|
+
}), Go = /^```([a-z]+)?[\s\n]$/, Jo = /^~~~([a-z]+)?[\s\n]$/, Ii = P.create({
|
|
4233
4293
|
name: "codeBlock",
|
|
4234
4294
|
addOptions() {
|
|
4235
4295
|
return {
|
|
@@ -4313,21 +4373,21 @@ const Me = (e, t) => {
|
|
|
4313
4373
|
if (!o || s.parent.type !== this.type || !(s.parentOffset === s.parent.nodeSize - 2))
|
|
4314
4374
|
return !1;
|
|
4315
4375
|
const a = s.after();
|
|
4316
|
-
return a === void 0 ? !1 : r.nodeAt(a) ? e.commands.command(({ tr: l }) => (l.setSelection(
|
|
4376
|
+
return a === void 0 ? !1 : r.nodeAt(a) ? e.commands.command(({ tr: l }) => (l.setSelection(V.near(r.resolve(a))), !0)) : e.commands.exitCode();
|
|
4317
4377
|
}
|
|
4318
4378
|
};
|
|
4319
4379
|
},
|
|
4320
4380
|
addInputRules() {
|
|
4321
4381
|
return [
|
|
4322
4382
|
Bt({
|
|
4323
|
-
find:
|
|
4383
|
+
find: Go,
|
|
4324
4384
|
type: this.type,
|
|
4325
4385
|
getAttributes: (e) => ({
|
|
4326
4386
|
language: e[1]
|
|
4327
4387
|
})
|
|
4328
4388
|
}),
|
|
4329
4389
|
Bt({
|
|
4330
|
-
find:
|
|
4390
|
+
find: Jo,
|
|
4331
4391
|
type: this.type,
|
|
4332
4392
|
getAttributes: (e) => ({
|
|
4333
4393
|
language: e[1]
|
|
@@ -4339,7 +4399,7 @@ const Me = (e, t) => {
|
|
|
4339
4399
|
return [
|
|
4340
4400
|
// this plugin creates a code block for pasted content from VS Code
|
|
4341
4401
|
// we can also detect the copied code language
|
|
4342
|
-
new
|
|
4402
|
+
new $({
|
|
4343
4403
|
key: new _("codeBlockVSCodeHandler"),
|
|
4344
4404
|
props: {
|
|
4345
4405
|
handlePaste: (e, t) => {
|
|
@@ -4356,7 +4416,7 @@ const Me = (e, t) => {
|
|
|
4356
4416
|
})
|
|
4357
4417
|
];
|
|
4358
4418
|
}
|
|
4359
|
-
}),
|
|
4419
|
+
}), Di = D.create({
|
|
4360
4420
|
name: "textStyle",
|
|
4361
4421
|
priority: 101,
|
|
4362
4422
|
addOptions() {
|
|
@@ -4378,12 +4438,12 @@ const Me = (e, t) => {
|
|
|
4378
4438
|
addCommands() {
|
|
4379
4439
|
return {
|
|
4380
4440
|
removeEmptyTextStyle: () => ({ state: e, commands: t }) => {
|
|
4381
|
-
const n =
|
|
4441
|
+
const n = Qt(e, this.type);
|
|
4382
4442
|
return Object.entries(n).some(([, s]) => !!s) ? !0 : t.unsetMark(this.name);
|
|
4383
4443
|
}
|
|
4384
4444
|
};
|
|
4385
4445
|
}
|
|
4386
|
-
}),
|
|
4446
|
+
}), Ni = R.create({
|
|
4387
4447
|
name: "fontFamily",
|
|
4388
4448
|
addOptions() {
|
|
4389
4449
|
return {
|
|
@@ -4397,10 +4457,7 @@ const Me = (e, t) => {
|
|
|
4397
4457
|
attributes: {
|
|
4398
4458
|
fontFamily: {
|
|
4399
4459
|
default: null,
|
|
4400
|
-
parseHTML: (e) =>
|
|
4401
|
-
var t;
|
|
4402
|
-
return (t = e.style.fontFamily) === null || t === void 0 ? void 0 : t.replace(/['"]+/g, "");
|
|
4403
|
-
},
|
|
4460
|
+
parseHTML: (e) => e.style.fontFamily,
|
|
4404
4461
|
renderHTML: (e) => e.fontFamily ? {
|
|
4405
4462
|
style: `font-family: ${e.fontFamily}`
|
|
4406
4463
|
} : {}
|
|
@@ -4415,7 +4472,7 @@ const Me = (e, t) => {
|
|
|
4415
4472
|
unsetFontFamily: () => ({ chain: e }) => e().setMark("textStyle", { fontFamily: null }).removeEmptyTextStyle().run()
|
|
4416
4473
|
};
|
|
4417
4474
|
}
|
|
4418
|
-
}),
|
|
4475
|
+
}), Bi = P.create({
|
|
4419
4476
|
name: "heading",
|
|
4420
4477
|
addOptions() {
|
|
4421
4478
|
return {
|
|
@@ -4464,7 +4521,7 @@ const Me = (e, t) => {
|
|
|
4464
4521
|
}
|
|
4465
4522
|
}));
|
|
4466
4523
|
}
|
|
4467
|
-
}),
|
|
4524
|
+
}), ji = R.create({
|
|
4468
4525
|
name: "textAlign",
|
|
4469
4526
|
addOptions() {
|
|
4470
4527
|
return {
|
|
@@ -4504,7 +4561,7 @@ const Me = (e, t) => {
|
|
|
4504
4561
|
"Mod-Shift-j": () => this.editor.commands.setTextAlign("justify")
|
|
4505
4562
|
};
|
|
4506
4563
|
}
|
|
4507
|
-
}),
|
|
4564
|
+
}), Fi = R.create({
|
|
4508
4565
|
name: "color",
|
|
4509
4566
|
addOptions() {
|
|
4510
4567
|
return {
|
|
@@ -4536,7 +4593,7 @@ const Me = (e, t) => {
|
|
|
4536
4593
|
unsetColor: () => ({ chain: e }) => e().setMark("textStyle", { color: null }).removeEmptyTextStyle().run()
|
|
4537
4594
|
};
|
|
4538
4595
|
}
|
|
4539
|
-
}),
|
|
4596
|
+
}), Yo = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, Xo = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, zi = D.create({
|
|
4540
4597
|
name: "highlight",
|
|
4541
4598
|
addOptions() {
|
|
4542
4599
|
return {
|
|
@@ -4580,21 +4637,21 @@ const Me = (e, t) => {
|
|
|
4580
4637
|
},
|
|
4581
4638
|
addInputRules() {
|
|
4582
4639
|
return [
|
|
4583
|
-
|
|
4584
|
-
find:
|
|
4640
|
+
X({
|
|
4641
|
+
find: Yo,
|
|
4585
4642
|
type: this.type
|
|
4586
4643
|
})
|
|
4587
4644
|
];
|
|
4588
4645
|
},
|
|
4589
4646
|
addPasteRules() {
|
|
4590
4647
|
return [
|
|
4591
|
-
|
|
4592
|
-
find:
|
|
4648
|
+
K({
|
|
4649
|
+
find: Xo,
|
|
4593
4650
|
type: this.type
|
|
4594
4651
|
})
|
|
4595
4652
|
];
|
|
4596
4653
|
}
|
|
4597
|
-
}),
|
|
4654
|
+
}), Qo = "listItem", Ce = "textStyle", xe = /^\s*([-+*])\s$/, Vi = P.create({
|
|
4598
4655
|
name: "bulletList",
|
|
4599
4656
|
addOptions() {
|
|
4600
4657
|
return {
|
|
@@ -4618,7 +4675,7 @@ const Me = (e, t) => {
|
|
|
4618
4675
|
},
|
|
4619
4676
|
addCommands() {
|
|
4620
4677
|
return {
|
|
4621
|
-
toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
4678
|
+
toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Qo, this.editor.getAttributes(Ce)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
4622
4679
|
};
|
|
4623
4680
|
},
|
|
4624
4681
|
addKeyboardShortcuts() {
|
|
@@ -4627,22 +4684,22 @@ const Me = (e, t) => {
|
|
|
4627
4684
|
};
|
|
4628
4685
|
},
|
|
4629
4686
|
addInputRules() {
|
|
4630
|
-
let e =
|
|
4631
|
-
find:
|
|
4687
|
+
let e = nt({
|
|
4688
|
+
find: xe,
|
|
4632
4689
|
type: this.type
|
|
4633
4690
|
});
|
|
4634
|
-
return (this.options.keepMarks || this.options.keepAttributes) && (e =
|
|
4635
|
-
find:
|
|
4691
|
+
return (this.options.keepMarks || this.options.keepAttributes) && (e = nt({
|
|
4692
|
+
find: xe,
|
|
4636
4693
|
type: this.type,
|
|
4637
4694
|
keepMarks: this.options.keepMarks,
|
|
4638
4695
|
keepAttributes: this.options.keepAttributes,
|
|
4639
|
-
getAttributes: () => this.editor.getAttributes(
|
|
4696
|
+
getAttributes: () => this.editor.getAttributes(Ce),
|
|
4640
4697
|
editor: this.editor
|
|
4641
4698
|
})), [
|
|
4642
4699
|
e
|
|
4643
4700
|
];
|
|
4644
4701
|
}
|
|
4645
|
-
}),
|
|
4702
|
+
}), Zo = "listItem", Ae = "textStyle", Oe = /^(\d+)\.\s$/, Wi = P.create({
|
|
4646
4703
|
name: "orderedList",
|
|
4647
4704
|
addOptions() {
|
|
4648
4705
|
return {
|
|
@@ -4681,7 +4738,7 @@ const Me = (e, t) => {
|
|
|
4681
4738
|
},
|
|
4682
4739
|
addCommands() {
|
|
4683
4740
|
return {
|
|
4684
|
-
toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
4741
|
+
toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Zo, this.editor.getAttributes(Ae)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
4685
4742
|
};
|
|
4686
4743
|
},
|
|
4687
4744
|
addKeyboardShortcuts() {
|
|
@@ -4690,25 +4747,25 @@ const Me = (e, t) => {
|
|
|
4690
4747
|
};
|
|
4691
4748
|
},
|
|
4692
4749
|
addInputRules() {
|
|
4693
|
-
let e =
|
|
4694
|
-
find:
|
|
4750
|
+
let e = nt({
|
|
4751
|
+
find: Oe,
|
|
4695
4752
|
type: this.type,
|
|
4696
4753
|
getAttributes: (t) => ({ start: +t[1] }),
|
|
4697
4754
|
joinPredicate: (t, n) => n.childCount + n.attrs.start === +t[1]
|
|
4698
4755
|
});
|
|
4699
|
-
return (this.options.keepMarks || this.options.keepAttributes) && (e =
|
|
4700
|
-
find:
|
|
4756
|
+
return (this.options.keepMarks || this.options.keepAttributes) && (e = nt({
|
|
4757
|
+
find: Oe,
|
|
4701
4758
|
type: this.type,
|
|
4702
4759
|
keepMarks: this.options.keepMarks,
|
|
4703
4760
|
keepAttributes: this.options.keepAttributes,
|
|
4704
|
-
getAttributes: (t) => ({ start: +t[1], ...this.editor.getAttributes(
|
|
4761
|
+
getAttributes: (t) => ({ start: +t[1], ...this.editor.getAttributes(Ae) }),
|
|
4705
4762
|
joinPredicate: (t, n) => n.childCount + n.attrs.start === +t[1],
|
|
4706
4763
|
editor: this.editor
|
|
4707
4764
|
})), [
|
|
4708
4765
|
e
|
|
4709
4766
|
];
|
|
4710
4767
|
}
|
|
4711
|
-
}),
|
|
4768
|
+
}), ti = /^\s*(\[([( |x])?\])\s$/, Ki = P.create({
|
|
4712
4769
|
name: "taskItem",
|
|
4713
4770
|
addOptions() {
|
|
4714
4771
|
return {
|
|
@@ -4806,8 +4863,8 @@ const Me = (e, t) => {
|
|
|
4806
4863
|
},
|
|
4807
4864
|
addInputRules() {
|
|
4808
4865
|
return [
|
|
4809
|
-
|
|
4810
|
-
find:
|
|
4866
|
+
nt({
|
|
4867
|
+
find: ti,
|
|
4811
4868
|
type: this.type,
|
|
4812
4869
|
getAttributes: (e) => ({
|
|
4813
4870
|
checked: e[e.length - 1] === "x"
|
|
@@ -4815,7 +4872,7 @@ const Me = (e, t) => {
|
|
|
4815
4872
|
})
|
|
4816
4873
|
];
|
|
4817
4874
|
}
|
|
4818
|
-
}),
|
|
4875
|
+
}), Ui = P.create({
|
|
4819
4876
|
name: "taskList",
|
|
4820
4877
|
addOptions() {
|
|
4821
4878
|
return {
|
|
@@ -4848,7 +4905,7 @@ const Me = (e, t) => {
|
|
|
4848
4905
|
"Mod-Shift-9": () => this.editor.commands.toggleTaskList()
|
|
4849
4906
|
};
|
|
4850
4907
|
}
|
|
4851
|
-
}),
|
|
4908
|
+
}), ei = /^\s*>\s$/, qi = P.create({
|
|
4852
4909
|
name: "blockquote",
|
|
4853
4910
|
addOptions() {
|
|
4854
4911
|
return {
|
|
@@ -4880,26 +4937,26 @@ const Me = (e, t) => {
|
|
|
4880
4937
|
},
|
|
4881
4938
|
addInputRules() {
|
|
4882
4939
|
return [
|
|
4883
|
-
|
|
4884
|
-
find:
|
|
4940
|
+
nt({
|
|
4941
|
+
find: ei,
|
|
4885
4942
|
type: this.type
|
|
4886
4943
|
})
|
|
4887
4944
|
];
|
|
4888
4945
|
}
|
|
4889
4946
|
});
|
|
4890
|
-
function
|
|
4947
|
+
function ni(e) {
|
|
4891
4948
|
return e.length === 1 ? e[0].isLink : e.length === 3 && e[1].isLink ? ["()", "[]"].includes(e[0].value + e[2].value) : !1;
|
|
4892
4949
|
}
|
|
4893
|
-
function
|
|
4894
|
-
return new
|
|
4950
|
+
function ri(e) {
|
|
4951
|
+
return new $({
|
|
4895
4952
|
key: new _("autolink"),
|
|
4896
4953
|
appendTransaction: (t, n, r) => {
|
|
4897
4954
|
const s = t.some((l) => l.docChanged) && !n.doc.eq(r.doc), o = t.some((l) => l.getMeta("preventAutolink"));
|
|
4898
4955
|
if (!s || o)
|
|
4899
4956
|
return;
|
|
4900
|
-
const { tr: i } = r, a =
|
|
4901
|
-
if (
|
|
4902
|
-
const u =
|
|
4957
|
+
const { tr: i } = r, a = vs(n.doc, [...t]);
|
|
4958
|
+
if (Ts(a).forEach(({ newRange: l }) => {
|
|
4959
|
+
const u = Ms(r.doc, l, (h) => h.isTextblock);
|
|
4903
4960
|
let d, p;
|
|
4904
4961
|
if (u.length > 1 ? (d = u[0], p = r.doc.textBetween(d.pos, d.pos + d.node.nodeSize, void 0, " ")) : u.length && r.doc.textBetween(l.from, l.to, " ", " ").endsWith(" ") && (d = u[0], p = r.doc.textBetween(d.pos, l.to, void 0, " ")), d && p) {
|
|
4905
4962
|
const h = p.split(" ").filter((y) => y !== "");
|
|
@@ -4908,15 +4965,15 @@ function Zo(e) {
|
|
|
4908
4965
|
const f = h[h.length - 1], m = d.pos + p.lastIndexOf(f);
|
|
4909
4966
|
if (!f)
|
|
4910
4967
|
return !1;
|
|
4911
|
-
const g =
|
|
4912
|
-
if (!
|
|
4968
|
+
const g = Wn(f).map((y) => y.toObject(e.defaultProtocol));
|
|
4969
|
+
if (!ni(g))
|
|
4913
4970
|
return !1;
|
|
4914
4971
|
g.filter((y) => y.isLink).map((y) => ({
|
|
4915
4972
|
...y,
|
|
4916
4973
|
from: m + y.start + 1,
|
|
4917
4974
|
to: m + y.end + 1
|
|
4918
|
-
})).filter((y) => r.schema.marks.code ? !r.doc.rangeHasMark(y.from, y.to, r.schema.marks.code) : !0).filter((y) => e.validate(y.value)).forEach((y) => {
|
|
4919
|
-
|
|
4975
|
+
})).filter((y) => r.schema.marks.code ? !r.doc.rangeHasMark(y.from, y.to, r.schema.marks.code) : !0).filter((y) => e.validate(y.value)).filter((y) => e.shouldAutoLink(y.value)).forEach((y) => {
|
|
4976
|
+
te(y.from, y.to, r.doc).some((M) => M.mark.type === e.type) || i.addMark(y.from, y.to, e.type.create({
|
|
4920
4977
|
href: y.href
|
|
4921
4978
|
}));
|
|
4922
4979
|
});
|
|
@@ -4926,8 +4983,8 @@ function Zo(e) {
|
|
|
4926
4983
|
}
|
|
4927
4984
|
});
|
|
4928
4985
|
}
|
|
4929
|
-
function
|
|
4930
|
-
return new
|
|
4986
|
+
function si(e) {
|
|
4987
|
+
return new $({
|
|
4931
4988
|
key: new _("handleClickLink"),
|
|
4932
4989
|
props: {
|
|
4933
4990
|
handleClick: (t, n, r) => {
|
|
@@ -4940,14 +4997,14 @@ function ti(e) {
|
|
|
4940
4997
|
a.push(i), i = i.parentNode;
|
|
4941
4998
|
if (!a.find((p) => p.nodeName === "A"))
|
|
4942
4999
|
return !1;
|
|
4943
|
-
const c =
|
|
5000
|
+
const c = Ye(t.state, e.type.name), l = r.target, u = (s = l == null ? void 0 : l.href) !== null && s !== void 0 ? s : c.href, d = (o = l == null ? void 0 : l.target) !== null && o !== void 0 ? o : c.target;
|
|
4944
5001
|
return l && u ? (window.open(u, d), !0) : !1;
|
|
4945
5002
|
}
|
|
4946
5003
|
}
|
|
4947
5004
|
});
|
|
4948
5005
|
}
|
|
4949
|
-
function
|
|
4950
|
-
return new
|
|
5006
|
+
function oi(e) {
|
|
5007
|
+
return new $({
|
|
4951
5008
|
key: new _("handlePasteLink"),
|
|
4952
5009
|
props: {
|
|
4953
5010
|
handlePaste: (t, n, r) => {
|
|
@@ -4966,30 +5023,45 @@ function ei(e) {
|
|
|
4966
5023
|
}
|
|
4967
5024
|
});
|
|
4968
5025
|
}
|
|
4969
|
-
const
|
|
4970
|
-
function
|
|
4971
|
-
const n = [
|
|
5026
|
+
const ii = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;
|
|
5027
|
+
function st(e, t) {
|
|
5028
|
+
const n = [
|
|
5029
|
+
"http",
|
|
5030
|
+
"https",
|
|
5031
|
+
"ftp",
|
|
5032
|
+
"ftps",
|
|
5033
|
+
"mailto",
|
|
5034
|
+
"tel",
|
|
5035
|
+
"callto",
|
|
5036
|
+
"sms",
|
|
5037
|
+
"cid",
|
|
5038
|
+
"xmpp"
|
|
5039
|
+
];
|
|
4972
5040
|
return t && t.forEach((r) => {
|
|
4973
5041
|
const s = typeof r == "string" ? r : r.scheme;
|
|
4974
5042
|
s && n.push(s);
|
|
4975
|
-
}), !e || e.replace(
|
|
5043
|
+
}), !e || e.replace(ii, "").match(new RegExp(
|
|
5044
|
+
// eslint-disable-next-line no-useless-escape
|
|
5045
|
+
`^(?:(?:${n.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`,
|
|
5046
|
+
"i"
|
|
5047
|
+
));
|
|
4976
5048
|
}
|
|
4977
|
-
const
|
|
5049
|
+
const Gi = D.create({
|
|
4978
5050
|
name: "link",
|
|
4979
5051
|
priority: 1e3,
|
|
4980
5052
|
keepOnSplit: !1,
|
|
4981
5053
|
exitable: !0,
|
|
4982
5054
|
onCreate() {
|
|
4983
|
-
this.options.protocols.forEach((e) => {
|
|
5055
|
+
this.options.validate && !this.options.shouldAutoLink && (this.options.shouldAutoLink = this.options.validate, console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")), this.options.protocols.forEach((e) => {
|
|
4984
5056
|
if (typeof e == "string") {
|
|
4985
|
-
|
|
5057
|
+
oe(e);
|
|
4986
5058
|
return;
|
|
4987
5059
|
}
|
|
4988
|
-
|
|
5060
|
+
oe(e.scheme, e.optionalSlashes);
|
|
4989
5061
|
});
|
|
4990
5062
|
},
|
|
4991
5063
|
onDestroy() {
|
|
4992
|
-
|
|
5064
|
+
Kn();
|
|
4993
5065
|
},
|
|
4994
5066
|
inclusive() {
|
|
4995
5067
|
return this.options.autolink;
|
|
@@ -5006,7 +5078,9 @@ const Vi = D.create({
|
|
|
5006
5078
|
rel: "noopener noreferrer nofollow",
|
|
5007
5079
|
class: null
|
|
5008
5080
|
},
|
|
5009
|
-
|
|
5081
|
+
isAllowedUri: (e, t) => !!st(e, t.protocols),
|
|
5082
|
+
validate: (e) => !!e,
|
|
5083
|
+
shouldAutoLink: (e) => !!e
|
|
5010
5084
|
};
|
|
5011
5085
|
},
|
|
5012
5086
|
addAttributes() {
|
|
@@ -5029,16 +5103,30 @@ const Vi = D.create({
|
|
|
5029
5103
|
};
|
|
5030
5104
|
},
|
|
5031
5105
|
parseHTML() {
|
|
5032
|
-
return [
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5106
|
+
return [
|
|
5107
|
+
{
|
|
5108
|
+
tag: "a[href]",
|
|
5109
|
+
getAttrs: (e) => {
|
|
5110
|
+
const t = e.getAttribute("href");
|
|
5111
|
+
return !t || !this.options.isAllowedUri(t, {
|
|
5112
|
+
defaultValidate: (n) => !!st(n, this.options.protocols),
|
|
5113
|
+
protocols: this.options.protocols,
|
|
5114
|
+
defaultProtocol: this.options.defaultProtocol
|
|
5115
|
+
}) ? !1 : null;
|
|
5116
|
+
}
|
|
5037
5117
|
}
|
|
5038
|
-
|
|
5118
|
+
];
|
|
5039
5119
|
},
|
|
5040
5120
|
renderHTML({ HTMLAttributes: e }) {
|
|
5041
|
-
return
|
|
5121
|
+
return this.options.isAllowedUri(e.href, {
|
|
5122
|
+
defaultValidate: (t) => !!st(t, this.options.protocols),
|
|
5123
|
+
protocols: this.options.protocols,
|
|
5124
|
+
defaultProtocol: this.options.defaultProtocol
|
|
5125
|
+
}) ? ["a", x(this.options.HTMLAttributes, e), 0] : [
|
|
5126
|
+
"a",
|
|
5127
|
+
x(this.options.HTMLAttributes, { ...e, href: "" }),
|
|
5128
|
+
0
|
|
5129
|
+
];
|
|
5042
5130
|
},
|
|
5043
5131
|
addCommands() {
|
|
5044
5132
|
return {
|
|
@@ -5049,17 +5137,21 @@ const Vi = D.create({
|
|
|
5049
5137
|
},
|
|
5050
5138
|
addPasteRules() {
|
|
5051
5139
|
return [
|
|
5052
|
-
|
|
5140
|
+
K({
|
|
5053
5141
|
find: (e) => {
|
|
5054
5142
|
const t = [];
|
|
5055
5143
|
if (e) {
|
|
5056
|
-
const {
|
|
5057
|
-
|
|
5058
|
-
|
|
5144
|
+
const { protocols: n, defaultProtocol: r } = this.options, s = He(e).filter((o) => o.isLink && this.options.isAllowedUri(o.value, {
|
|
5145
|
+
defaultValidate: (i) => !!st(i, n),
|
|
5146
|
+
protocols: n,
|
|
5147
|
+
defaultProtocol: r
|
|
5148
|
+
}));
|
|
5149
|
+
s.length && s.forEach((o) => t.push({
|
|
5150
|
+
text: o.value,
|
|
5059
5151
|
data: {
|
|
5060
|
-
href:
|
|
5152
|
+
href: o.href
|
|
5061
5153
|
},
|
|
5062
|
-
index:
|
|
5154
|
+
index: o.start
|
|
5063
5155
|
}));
|
|
5064
5156
|
}
|
|
5065
5157
|
return t;
|
|
@@ -5075,20 +5167,25 @@ const Vi = D.create({
|
|
|
5075
5167
|
];
|
|
5076
5168
|
},
|
|
5077
5169
|
addProseMirrorPlugins() {
|
|
5078
|
-
const e = [];
|
|
5079
|
-
return this.options.autolink && e.push(
|
|
5170
|
+
const e = [], { protocols: t, defaultProtocol: n } = this.options;
|
|
5171
|
+
return this.options.autolink && e.push(ri({
|
|
5080
5172
|
type: this.type,
|
|
5081
5173
|
defaultProtocol: this.options.defaultProtocol,
|
|
5082
|
-
validate: this.options.
|
|
5083
|
-
|
|
5174
|
+
validate: (r) => this.options.isAllowedUri(r, {
|
|
5175
|
+
defaultValidate: (s) => !!st(s, t),
|
|
5176
|
+
protocols: t,
|
|
5177
|
+
defaultProtocol: n
|
|
5178
|
+
}),
|
|
5179
|
+
shouldAutoLink: this.options.shouldAutoLink
|
|
5180
|
+
})), this.options.openOnClick === !0 && e.push(si({
|
|
5084
5181
|
type: this.type
|
|
5085
|
-
})), this.options.linkOnPaste && e.push(
|
|
5182
|
+
})), this.options.linkOnPaste && e.push(oi({
|
|
5086
5183
|
editor: this.editor,
|
|
5087
5184
|
defaultProtocol: this.options.defaultProtocol,
|
|
5088
5185
|
type: this.type
|
|
5089
5186
|
})), e;
|
|
5090
5187
|
}
|
|
5091
|
-
}),
|
|
5188
|
+
}), Ji = P.create({
|
|
5092
5189
|
name: "horizontalRule",
|
|
5093
5190
|
addOptions() {
|
|
5094
5191
|
return {
|
|
@@ -5111,14 +5208,14 @@ const Vi = D.create({
|
|
|
5111
5208
|
to: s.pos
|
|
5112
5209
|
}, {
|
|
5113
5210
|
type: this.name
|
|
5114
|
-
}) :
|
|
5211
|
+
}) : Xe(n) ? o.insertContentAt(s.pos, {
|
|
5115
5212
|
type: this.name
|
|
5116
5213
|
}) : o.insertContent({ type: this.name }), o.command(({ tr: i, dispatch: a }) => {
|
|
5117
5214
|
var c;
|
|
5118
5215
|
if (a) {
|
|
5119
5216
|
const { $to: l } = i.selection, u = l.end();
|
|
5120
5217
|
if (l.nodeAfter)
|
|
5121
|
-
l.nodeAfter.isTextblock ? i.setSelection(I.create(i.doc, l.pos + 1)) : l.nodeAfter.isBlock ? i.setSelection(
|
|
5218
|
+
l.nodeAfter.isTextblock ? i.setSelection(I.create(i.doc, l.pos + 1)) : l.nodeAfter.isBlock ? i.setSelection(et.create(i.doc, l.pos)) : i.setSelection(I.create(i.doc, l.pos));
|
|
5122
5219
|
else {
|
|
5123
5220
|
const d = (c = l.parent.type.contentMatch.defaultType) === null || c === void 0 ? void 0 : c.create();
|
|
5124
5221
|
d && (i.insert(u, d), i.setSelection(I.create(i.doc, u + 1)));
|
|
@@ -5132,13 +5229,13 @@ const Vi = D.create({
|
|
|
5132
5229
|
},
|
|
5133
5230
|
addInputRules() {
|
|
5134
5231
|
return [
|
|
5135
|
-
|
|
5232
|
+
Qe({
|
|
5136
5233
|
find: /^(?:---|—-|___\s|\*\*\*\s)$/,
|
|
5137
5234
|
type: this.type
|
|
5138
5235
|
})
|
|
5139
5236
|
];
|
|
5140
5237
|
}
|
|
5141
|
-
}),
|
|
5238
|
+
}), Yi = R.create({
|
|
5142
5239
|
name: "history",
|
|
5143
5240
|
addOptions() {
|
|
5144
5241
|
return {
|
|
@@ -5148,13 +5245,13 @@ const Vi = D.create({
|
|
|
5148
5245
|
},
|
|
5149
5246
|
addCommands() {
|
|
5150
5247
|
return {
|
|
5151
|
-
undo: () => ({ state: e, dispatch: t }) =>
|
|
5152
|
-
redo: () => ({ state: e, dispatch: t }) =>
|
|
5248
|
+
undo: () => ({ state: e, dispatch: t }) => Un(e, t),
|
|
5249
|
+
redo: () => ({ state: e, dispatch: t }) => qn(e, t)
|
|
5153
5250
|
};
|
|
5154
5251
|
},
|
|
5155
5252
|
addProseMirrorPlugins() {
|
|
5156
5253
|
return [
|
|
5157
|
-
|
|
5254
|
+
Gn(this.options)
|
|
5158
5255
|
];
|
|
5159
5256
|
},
|
|
5160
5257
|
addKeyboardShortcuts() {
|
|
@@ -5167,7 +5264,7 @@ const Vi = D.create({
|
|
|
5167
5264
|
"Shift-Mod-я": () => this.editor.commands.redo()
|
|
5168
5265
|
};
|
|
5169
5266
|
}
|
|
5170
|
-
}),
|
|
5267
|
+
}), Xi = R.create({
|
|
5171
5268
|
name: "characterCount",
|
|
5172
5269
|
addOptions() {
|
|
5173
5270
|
return {
|
|
@@ -5197,25 +5294,43 @@ const Vi = D.create({
|
|
|
5197
5294
|
};
|
|
5198
5295
|
},
|
|
5199
5296
|
addProseMirrorPlugins() {
|
|
5297
|
+
let e = !1;
|
|
5200
5298
|
return [
|
|
5201
|
-
new
|
|
5299
|
+
new $({
|
|
5202
5300
|
key: new _("characterCount"),
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5301
|
+
appendTransaction: (t, n, r) => {
|
|
5302
|
+
if (e)
|
|
5303
|
+
return;
|
|
5304
|
+
const s = this.options.limit;
|
|
5305
|
+
if (s == null || s === 0) {
|
|
5306
|
+
e = !0;
|
|
5307
|
+
return;
|
|
5308
|
+
}
|
|
5309
|
+
const o = this.storage.characters({ node: r.doc });
|
|
5310
|
+
if (o > s) {
|
|
5311
|
+
const i = o - s, a = 0, c = i;
|
|
5312
|
+
console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);
|
|
5313
|
+
const l = r.tr.deleteRange(a, c);
|
|
5314
|
+
return e = !0, l;
|
|
5315
|
+
}
|
|
5316
|
+
e = !0;
|
|
5317
|
+
},
|
|
5318
|
+
filterTransaction: (t, n) => {
|
|
5319
|
+
const r = this.options.limit;
|
|
5320
|
+
if (!t.docChanged || r === 0 || r === null || r === void 0)
|
|
5206
5321
|
return !0;
|
|
5207
|
-
const
|
|
5208
|
-
if (
|
|
5322
|
+
const s = this.storage.characters({ node: n.doc }), o = this.storage.characters({ node: t.doc });
|
|
5323
|
+
if (o <= r || s > r && o > r && o <= s)
|
|
5209
5324
|
return !0;
|
|
5210
|
-
if (
|
|
5325
|
+
if (s > r && o > r && o > s || !t.getMeta("paste"))
|
|
5211
5326
|
return !1;
|
|
5212
|
-
const
|
|
5213
|
-
return
|
|
5327
|
+
const a = t.selection.$head.pos, c = o - r, l = a - c, u = a;
|
|
5328
|
+
return t.deleteRange(l, u), !(this.storage.characters({ node: t.doc }) > r);
|
|
5214
5329
|
}
|
|
5215
5330
|
})
|
|
5216
5331
|
];
|
|
5217
5332
|
}
|
|
5218
|
-
}),
|
|
5333
|
+
}), Qi = R.create({
|
|
5219
5334
|
name: "dropCursor",
|
|
5220
5335
|
addOptions() {
|
|
5221
5336
|
return {
|
|
@@ -5226,10 +5341,10 @@ const Vi = D.create({
|
|
|
5226
5341
|
},
|
|
5227
5342
|
addProseMirrorPlugins() {
|
|
5228
5343
|
return [
|
|
5229
|
-
|
|
5344
|
+
Jn(this.options)
|
|
5230
5345
|
];
|
|
5231
5346
|
}
|
|
5232
|
-
}),
|
|
5347
|
+
}), Zi = R.create({
|
|
5233
5348
|
name: "focus",
|
|
5234
5349
|
addOptions() {
|
|
5235
5350
|
return {
|
|
@@ -5239,13 +5354,13 @@ const Vi = D.create({
|
|
|
5239
5354
|
},
|
|
5240
5355
|
addProseMirrorPlugins() {
|
|
5241
5356
|
return [
|
|
5242
|
-
new
|
|
5357
|
+
new $({
|
|
5243
5358
|
key: new _("focus"),
|
|
5244
5359
|
props: {
|
|
5245
5360
|
decorations: ({ doc: e, selection: t }) => {
|
|
5246
5361
|
const { isEditable: n, isFocused: r } = this.editor, { anchor: s } = t, o = [];
|
|
5247
5362
|
if (!n || !r)
|
|
5248
|
-
return
|
|
5363
|
+
return ft.create(e, []);
|
|
5249
5364
|
let i = 0;
|
|
5250
5365
|
this.options.mode === "deepest" && e.descendants((c, l) => {
|
|
5251
5366
|
if (c.isText)
|
|
@@ -5260,20 +5375,20 @@ const Vi = D.create({
|
|
|
5260
5375
|
return !1;
|
|
5261
5376
|
if (a += 1, this.options.mode === "deepest" && i - a > 0 || this.options.mode === "shallowest" && a > 1)
|
|
5262
5377
|
return this.options.mode === "deepest";
|
|
5263
|
-
o.push(
|
|
5378
|
+
o.push(Kt.node(l, l + c.nodeSize, {
|
|
5264
5379
|
class: this.options.className
|
|
5265
5380
|
}));
|
|
5266
|
-
}),
|
|
5381
|
+
}), ft.create(e, o);
|
|
5267
5382
|
}
|
|
5268
5383
|
}
|
|
5269
5384
|
})
|
|
5270
5385
|
];
|
|
5271
5386
|
}
|
|
5272
|
-
}),
|
|
5387
|
+
}), ta = R.create({
|
|
5273
5388
|
name: "gapCursor",
|
|
5274
5389
|
addProseMirrorPlugins() {
|
|
5275
5390
|
return [
|
|
5276
|
-
|
|
5391
|
+
Yn()
|
|
5277
5392
|
];
|
|
5278
5393
|
},
|
|
5279
5394
|
extendNodeSchema(e) {
|
|
@@ -5287,7 +5402,7 @@ const Vi = D.create({
|
|
|
5287
5402
|
allowGapCursor: (t = T(S(e, "allowGapCursor", n))) !== null && t !== void 0 ? t : null
|
|
5288
5403
|
};
|
|
5289
5404
|
}
|
|
5290
|
-
}),
|
|
5405
|
+
}), ea = P.create({
|
|
5291
5406
|
name: "hardBreak",
|
|
5292
5407
|
addOptions() {
|
|
5293
5408
|
return {
|
|
@@ -5298,6 +5413,7 @@ const Vi = D.create({
|
|
|
5298
5413
|
inline: !0,
|
|
5299
5414
|
group: "inline",
|
|
5300
5415
|
selectable: !1,
|
|
5416
|
+
linebreakReplacement: !0,
|
|
5301
5417
|
parseHTML() {
|
|
5302
5418
|
return [
|
|
5303
5419
|
{ tag: "br" }
|
|
@@ -5336,7 +5452,7 @@ const Vi = D.create({
|
|
|
5336
5452
|
"Shift-Enter": () => this.editor.commands.setHardBreak()
|
|
5337
5453
|
};
|
|
5338
5454
|
}
|
|
5339
|
-
}),
|
|
5455
|
+
}), na = P.create({
|
|
5340
5456
|
name: "listItem",
|
|
5341
5457
|
addOptions() {
|
|
5342
5458
|
return {
|
|
@@ -5364,7 +5480,7 @@ const Vi = D.create({
|
|
|
5364
5480
|
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
5365
5481
|
};
|
|
5366
5482
|
}
|
|
5367
|
-
}),
|
|
5483
|
+
}), ra = P.create({
|
|
5368
5484
|
name: "paragraph",
|
|
5369
5485
|
priority: 1e3,
|
|
5370
5486
|
addOptions() {
|
|
@@ -5392,7 +5508,7 @@ const Vi = D.create({
|
|
|
5392
5508
|
"Mod-Alt-0": () => this.editor.commands.setParagraph()
|
|
5393
5509
|
};
|
|
5394
5510
|
}
|
|
5395
|
-
}),
|
|
5511
|
+
}), sa = R.create({
|
|
5396
5512
|
name: "placeholder",
|
|
5397
5513
|
addOptions() {
|
|
5398
5514
|
return {
|
|
@@ -5406,7 +5522,7 @@ const Vi = D.create({
|
|
|
5406
5522
|
},
|
|
5407
5523
|
addProseMirrorPlugins() {
|
|
5408
5524
|
return [
|
|
5409
|
-
new
|
|
5525
|
+
new $({
|
|
5410
5526
|
key: new _("placeholder"),
|
|
5411
5527
|
props: {
|
|
5412
5528
|
decorations: ({ doc: e, selection: t }) => {
|
|
@@ -5415,11 +5531,11 @@ const Vi = D.create({
|
|
|
5415
5531
|
return null;
|
|
5416
5532
|
const o = this.editor.isEmpty;
|
|
5417
5533
|
return e.descendants((i, a) => {
|
|
5418
|
-
const c = r >= a && r <= a + i.nodeSize, l = !i.isLeaf &&
|
|
5534
|
+
const c = r >= a && r <= a + i.nodeSize, l = !i.isLeaf && Tt(i);
|
|
5419
5535
|
if ((c || !this.options.showOnlyCurrent) && l) {
|
|
5420
5536
|
const u = [this.options.emptyNodeClass];
|
|
5421
5537
|
o && u.push(this.options.emptyEditorClass);
|
|
5422
|
-
const d =
|
|
5538
|
+
const d = Kt.node(a, a + i.nodeSize, {
|
|
5423
5539
|
class: u.join(" "),
|
|
5424
5540
|
"data-placeholder": typeof this.options.placeholder == "function" ? this.options.placeholder({
|
|
5425
5541
|
editor: this.editor,
|
|
@@ -5431,20 +5547,20 @@ const Vi = D.create({
|
|
|
5431
5547
|
s.push(d);
|
|
5432
5548
|
}
|
|
5433
5549
|
return this.options.includeChildren;
|
|
5434
|
-
}),
|
|
5550
|
+
}), ft.create(e, s);
|
|
5435
5551
|
}
|
|
5436
5552
|
}
|
|
5437
5553
|
})
|
|
5438
5554
|
];
|
|
5439
5555
|
}
|
|
5440
|
-
}),
|
|
5556
|
+
}), oa = P.create({
|
|
5441
5557
|
name: "text",
|
|
5442
5558
|
group: "inline"
|
|
5443
|
-
}),
|
|
5559
|
+
}), ia = P.create({
|
|
5444
5560
|
name: "doc",
|
|
5445
5561
|
topNode: !0,
|
|
5446
5562
|
content: "block+"
|
|
5447
|
-
}),
|
|
5563
|
+
}), aa = D.create({
|
|
5448
5564
|
name: "subscript",
|
|
5449
5565
|
addOptions() {
|
|
5450
5566
|
return {
|
|
@@ -5479,7 +5595,7 @@ const Vi = D.create({
|
|
|
5479
5595
|
"Mod-,": () => this.editor.commands.toggleSubscript()
|
|
5480
5596
|
};
|
|
5481
5597
|
}
|
|
5482
|
-
}),
|
|
5598
|
+
}), la = D.create({
|
|
5483
5599
|
name: "superscript",
|
|
5484
5600
|
addOptions() {
|
|
5485
5601
|
return {
|
|
@@ -5515,9 +5631,9 @@ const Vi = D.create({
|
|
|
5515
5631
|
};
|
|
5516
5632
|
}
|
|
5517
5633
|
});
|
|
5518
|
-
function
|
|
5634
|
+
function ai(e) {
|
|
5519
5635
|
var t;
|
|
5520
|
-
const { char: n, allowSpaces: r, allowedPrefixes: s, startOfLine: o, $position: i } = e, a =
|
|
5636
|
+
const { char: n, allowSpaces: r, allowedPrefixes: s, startOfLine: o, $position: i } = e, a = io(n), c = new RegExp(`\\s${a}$`), l = o ? "^" : "", u = r ? new RegExp(`${l}${a}.*?(?=\\s${a}|$)`, "gm") : new RegExp(`${l}(?:^)?${a}[^\\s${a}]*`, "gm"), d = ((t = i.nodeBefore) === null || t === void 0 ? void 0 : t.isText) && i.nodeBefore.text;
|
|
5521
5637
|
if (!d)
|
|
5522
5638
|
return null;
|
|
5523
5639
|
const p = i.pos - d.length, h = Array.from(d.matchAll(u)).pop();
|
|
@@ -5537,42 +5653,42 @@ function ri(e) {
|
|
|
5537
5653
|
text: h[0]
|
|
5538
5654
|
} : null;
|
|
5539
5655
|
}
|
|
5540
|
-
const
|
|
5541
|
-
function
|
|
5656
|
+
const li = new _("suggestion");
|
|
5657
|
+
function ci({ pluginKey: e = li, editor: t, char: n = "@", allowSpaces: r = !1, allowedPrefixes: s = [" "], startOfLine: o = !1, decorationTag: i = "span", decorationClass: a = "suggestion", command: c = () => null, items: l = () => [], render: u = () => ({}), allow: d = () => !0, findSuggestionMatch: p = ai }) {
|
|
5542
5658
|
let h;
|
|
5543
|
-
const f = u == null ? void 0 : u(), m = new
|
|
5659
|
+
const f = u == null ? void 0 : u(), m = new $({
|
|
5544
5660
|
key: e,
|
|
5545
5661
|
view() {
|
|
5546
5662
|
return {
|
|
5547
5663
|
update: async (g, y) => {
|
|
5548
|
-
var
|
|
5549
|
-
const
|
|
5550
|
-
if (!
|
|
5664
|
+
var M, v, b, w, k, C, A;
|
|
5665
|
+
const E = (M = this.key) === null || M === void 0 ? void 0 : M.getState(y), O = (v = this.key) === null || v === void 0 ? void 0 : v.getState(g.state), B = E.active && O.active && E.range.from !== O.range.from, F = !E.active && O.active, Q = E.active && !O.active, q = !F && !Q && E.query !== O.query, G = F || B && q, z = q || B, J = Q || B && q;
|
|
5666
|
+
if (!G && !z && !J)
|
|
5551
5667
|
return;
|
|
5552
|
-
const
|
|
5668
|
+
const Z = J && !G ? E : O, re = g.dom.querySelector(`[data-decoration-id="${Z.decorationId}"]`);
|
|
5553
5669
|
h = {
|
|
5554
5670
|
editor: t,
|
|
5555
|
-
range:
|
|
5556
|
-
query:
|
|
5557
|
-
text:
|
|
5671
|
+
range: Z.range,
|
|
5672
|
+
query: Z.query,
|
|
5673
|
+
text: Z.text,
|
|
5558
5674
|
items: [],
|
|
5559
|
-
command: (
|
|
5675
|
+
command: (rt) => c({
|
|
5560
5676
|
editor: t,
|
|
5561
|
-
range:
|
|
5562
|
-
props:
|
|
5677
|
+
range: Z.range,
|
|
5678
|
+
props: rt
|
|
5563
5679
|
}),
|
|
5564
|
-
decorationNode:
|
|
5680
|
+
decorationNode: re,
|
|
5565
5681
|
// virtual node for popper.js or tippy.js
|
|
5566
5682
|
// this can be used for building popups without a DOM node
|
|
5567
|
-
clientRect:
|
|
5568
|
-
var
|
|
5569
|
-
const { decorationId:
|
|
5570
|
-
return (
|
|
5683
|
+
clientRect: re ? () => {
|
|
5684
|
+
var rt;
|
|
5685
|
+
const { decorationId: sn } = (rt = this.key) === null || rt === void 0 ? void 0 : rt.getState(t.state), xt = g.dom.querySelector(`[data-decoration-id="${sn}"]`);
|
|
5686
|
+
return (xt == null ? void 0 : xt.getBoundingClientRect()) || null;
|
|
5571
5687
|
} : null
|
|
5572
|
-
},
|
|
5688
|
+
}, G && ((b = f == null ? void 0 : f.onBeforeStart) === null || b === void 0 || b.call(f, h)), z && ((w = f == null ? void 0 : f.onBeforeUpdate) === null || w === void 0 || w.call(f, h)), (z || G) && (h.items = await l({
|
|
5573
5689
|
editor: t,
|
|
5574
|
-
query:
|
|
5575
|
-
})),
|
|
5690
|
+
query: Z.query
|
|
5691
|
+
})), J && ((k = f == null ? void 0 : f.onExit) === null || k === void 0 || k.call(f, h)), z && ((C = f == null ? void 0 : f.onUpdate) === null || C === void 0 || C.call(f, h)), G && ((A = f == null ? void 0 : f.onStart) === null || A === void 0 || A.call(f, h));
|
|
5576
5692
|
},
|
|
5577
5693
|
destroy: () => {
|
|
5578
5694
|
var g;
|
|
@@ -5595,43 +5711,43 @@ function oi({ pluginKey: e = si, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5595
5711
|
};
|
|
5596
5712
|
},
|
|
5597
5713
|
// Apply changes to the plugin state from a view transaction.
|
|
5598
|
-
apply(g, y,
|
|
5599
|
-
const { isEditable:
|
|
5600
|
-
if (
|
|
5601
|
-
(A < y.range.from || A > y.range.to) && !
|
|
5714
|
+
apply(g, y, M, v) {
|
|
5715
|
+
const { isEditable: b } = t, { composing: w } = t.view, { selection: k } = g, { empty: C, from: A } = k, E = { ...y };
|
|
5716
|
+
if (E.composing = w, b && (C || t.view.composing)) {
|
|
5717
|
+
(A < y.range.from || A > y.range.to) && !w && !y.composing && (E.active = !1);
|
|
5602
5718
|
const O = p({
|
|
5603
5719
|
char: n,
|
|
5604
5720
|
allowSpaces: r,
|
|
5605
5721
|
allowedPrefixes: s,
|
|
5606
5722
|
startOfLine: o,
|
|
5607
|
-
$position:
|
|
5723
|
+
$position: k.$from
|
|
5608
5724
|
}), B = `id_${Math.floor(Math.random() * 4294967295)}`;
|
|
5609
5725
|
O && d({
|
|
5610
5726
|
editor: t,
|
|
5611
|
-
state:
|
|
5727
|
+
state: v,
|
|
5612
5728
|
range: O.range,
|
|
5613
5729
|
isActive: y.active
|
|
5614
|
-
}) ? (
|
|
5730
|
+
}) ? (E.active = !0, E.decorationId = y.decorationId ? y.decorationId : B, E.range = O.range, E.query = O.query, E.text = O.text) : E.active = !1;
|
|
5615
5731
|
} else
|
|
5616
|
-
|
|
5617
|
-
return
|
|
5732
|
+
E.active = !1;
|
|
5733
|
+
return E.active || (E.decorationId = null, E.range = { from: 0, to: 0 }, E.query = null, E.text = null), E;
|
|
5618
5734
|
}
|
|
5619
5735
|
},
|
|
5620
5736
|
props: {
|
|
5621
5737
|
// Call the keydown hook if suggestion is active.
|
|
5622
5738
|
handleKeyDown(g, y) {
|
|
5623
|
-
var
|
|
5624
|
-
const { active:
|
|
5625
|
-
return
|
|
5739
|
+
var M;
|
|
5740
|
+
const { active: v, range: b } = m.getState(g.state);
|
|
5741
|
+
return v && ((M = f == null ? void 0 : f.onKeyDown) === null || M === void 0 ? void 0 : M.call(f, { view: g, event: y, range: b })) || !1;
|
|
5626
5742
|
},
|
|
5627
5743
|
// Setup decorator on the currently active suggestion.
|
|
5628
5744
|
decorations(g) {
|
|
5629
|
-
const { active: y, range:
|
|
5630
|
-
return y ?
|
|
5631
|
-
|
|
5745
|
+
const { active: y, range: M, decorationId: v } = m.getState(g);
|
|
5746
|
+
return y ? ft.create(g.doc, [
|
|
5747
|
+
Kt.inline(M.from, M.to, {
|
|
5632
5748
|
nodeName: i,
|
|
5633
5749
|
class: a,
|
|
5634
|
-
"data-decoration-id":
|
|
5750
|
+
"data-decoration-id": v
|
|
5635
5751
|
})
|
|
5636
5752
|
]) : null;
|
|
5637
5753
|
}
|
|
@@ -5639,7 +5755,7 @@ function oi({ pluginKey: e = si, editor: t, char: n = "@", allowSpaces: r = !1,
|
|
|
5639
5755
|
});
|
|
5640
5756
|
return m;
|
|
5641
5757
|
}
|
|
5642
|
-
const
|
|
5758
|
+
const di = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, ca = P.create({
|
|
5643
5759
|
name: "image",
|
|
5644
5760
|
addOptions() {
|
|
5645
5761
|
return {
|
|
@@ -5688,8 +5804,8 @@ const ii = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, oa = R.cr
|
|
|
5688
5804
|
},
|
|
5689
5805
|
addInputRules() {
|
|
5690
5806
|
return [
|
|
5691
|
-
|
|
5692
|
-
find:
|
|
5807
|
+
Qe({
|
|
5808
|
+
find: di,
|
|
5693
5809
|
type: this.type,
|
|
5694
5810
|
getAttributes: (e) => {
|
|
5695
5811
|
const [, , t, n, r] = e;
|
|
@@ -5698,7 +5814,7 @@ const ii = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, oa = R.cr
|
|
|
5698
5814
|
})
|
|
5699
5815
|
];
|
|
5700
5816
|
}
|
|
5701
|
-
}),
|
|
5817
|
+
}), da = P.create({
|
|
5702
5818
|
name: "tableRow",
|
|
5703
5819
|
addOptions() {
|
|
5704
5820
|
return {
|
|
@@ -5716,34 +5832,48 @@ const ii = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, oa = R.cr
|
|
|
5716
5832
|
return ["tr", x(this.options.HTMLAttributes, e), 0];
|
|
5717
5833
|
}
|
|
5718
5834
|
});
|
|
5719
|
-
function
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5835
|
+
function Vt(e, t) {
|
|
5836
|
+
return t ? ["width", `${Math.max(t, e)}px`] : ["min-width", `${e}px`];
|
|
5837
|
+
}
|
|
5838
|
+
function Le(e, t, n, r, s, o) {
|
|
5839
|
+
var i;
|
|
5840
|
+
let a = 0, c = !0, l = t.firstChild;
|
|
5841
|
+
const u = e.firstChild;
|
|
5842
|
+
if (u !== null)
|
|
5843
|
+
for (let d = 0, p = 0; d < u.childCount; d += 1) {
|
|
5844
|
+
const { colspan: h, colwidth: f } = u.child(d).attrs;
|
|
5845
|
+
for (let m = 0; m < h; m += 1, p += 1) {
|
|
5846
|
+
const g = s === p ? o : f && f[m], y = g ? `${g}px` : "";
|
|
5847
|
+
if (a += g || r, g || (c = !1), l) {
|
|
5848
|
+
if (l.style.width !== y) {
|
|
5849
|
+
const [M, v] = Vt(r, g);
|
|
5850
|
+
l.style.setProperty(M, v);
|
|
5851
|
+
}
|
|
5852
|
+
l = l.nextSibling;
|
|
5853
|
+
} else {
|
|
5854
|
+
const M = document.createElement("col"), [v, b] = Vt(r, g);
|
|
5855
|
+
M.style.setProperty(v, b), t.appendChild(M);
|
|
5856
|
+
}
|
|
5857
|
+
}
|
|
5727
5858
|
}
|
|
5859
|
+
for (; l; ) {
|
|
5860
|
+
const d = l.nextSibling;
|
|
5861
|
+
(i = l.parentNode) === null || i === void 0 || i.removeChild(l), l = d;
|
|
5728
5862
|
}
|
|
5729
|
-
|
|
5730
|
-
const u = c.nextSibling;
|
|
5731
|
-
c.parentNode.removeChild(c), c = u;
|
|
5732
|
-
}
|
|
5733
|
-
a ? (n.style.width = `${i}px`, n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = `${i}px`);
|
|
5863
|
+
c ? (n.style.width = `${a}px`, n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = `${a}px`);
|
|
5734
5864
|
}
|
|
5735
|
-
class
|
|
5865
|
+
class ui {
|
|
5736
5866
|
constructor(t, n) {
|
|
5737
|
-
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")),
|
|
5867
|
+
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")), Le(t, this.colgroup, this.table, n), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
5738
5868
|
}
|
|
5739
5869
|
update(t) {
|
|
5740
|
-
return t.type !== this.node.type ? !1 : (this.node = t,
|
|
5870
|
+
return t.type !== this.node.type ? !1 : (this.node = t, Le(t, this.colgroup, this.table, this.cellMinWidth), !0);
|
|
5741
5871
|
}
|
|
5742
5872
|
ignoreMutation(t) {
|
|
5743
5873
|
return t.type === "attributes" && (t.target === this.table || this.colgroup.contains(t.target));
|
|
5744
5874
|
}
|
|
5745
5875
|
}
|
|
5746
|
-
function
|
|
5876
|
+
function pi(e, t, n, r) {
|
|
5747
5877
|
let s = 0, o = !0;
|
|
5748
5878
|
const i = [], a = e.firstChild;
|
|
5749
5879
|
if (!a)
|
|
@@ -5751,17 +5881,22 @@ function li(e, t, n, r) {
|
|
|
5751
5881
|
for (let d = 0, p = 0; d < a.childCount; d += 1) {
|
|
5752
5882
|
const { colspan: h, colwidth: f } = a.child(d).attrs;
|
|
5753
5883
|
for (let m = 0; m < h; m += 1, p += 1) {
|
|
5754
|
-
const g = n === p ? r : f && f[m]
|
|
5755
|
-
s += g || t, g || (o = !1)
|
|
5884
|
+
const g = n === p ? r : f && f[m];
|
|
5885
|
+
s += g || t, g || (o = !1);
|
|
5886
|
+
const [y, M] = Vt(t, g);
|
|
5887
|
+
i.push([
|
|
5888
|
+
"col",
|
|
5889
|
+
{ style: `${y}: ${M}` }
|
|
5890
|
+
]);
|
|
5756
5891
|
}
|
|
5757
5892
|
}
|
|
5758
5893
|
const c = o ? `${s}px` : "", l = o ? "" : `${s}px`;
|
|
5759
5894
|
return { colgroup: ["colgroup", {}, ...i], tableWidth: c, tableMinWidth: l };
|
|
5760
5895
|
}
|
|
5761
|
-
function
|
|
5896
|
+
function Pe(e, t) {
|
|
5762
5897
|
return e.createAndFill();
|
|
5763
5898
|
}
|
|
5764
|
-
function
|
|
5899
|
+
function hi(e) {
|
|
5765
5900
|
if (e.cached.tableNodeTypes)
|
|
5766
5901
|
return e.cached.tableNodeTypes;
|
|
5767
5902
|
const t = {};
|
|
@@ -5770,12 +5905,12 @@ function ci(e) {
|
|
|
5770
5905
|
r.spec.tableRole && (t[r.spec.tableRole] = r);
|
|
5771
5906
|
}), e.cached.tableNodeTypes = t, t;
|
|
5772
5907
|
}
|
|
5773
|
-
function
|
|
5774
|
-
const o =
|
|
5908
|
+
function fi(e, t, n, r, s) {
|
|
5909
|
+
const o = hi(e), i = [], a = [];
|
|
5775
5910
|
for (let l = 0; l < n; l += 1) {
|
|
5776
|
-
const u =
|
|
5911
|
+
const u = Pe(o.cell);
|
|
5777
5912
|
if (u && a.push(u), r) {
|
|
5778
|
-
const d =
|
|
5913
|
+
const d = Pe(o.header_cell);
|
|
5779
5914
|
d && i.push(d);
|
|
5780
5915
|
}
|
|
5781
5916
|
}
|
|
@@ -5784,21 +5919,21 @@ function di(e, t, n, r, s) {
|
|
|
5784
5919
|
c.push(o.row.createChecked(null, r && l === 0 ? i : a));
|
|
5785
5920
|
return o.table.createChecked(null, c);
|
|
5786
5921
|
}
|
|
5787
|
-
function
|
|
5788
|
-
return e instanceof
|
|
5922
|
+
function mi(e) {
|
|
5923
|
+
return e instanceof Ie;
|
|
5789
5924
|
}
|
|
5790
|
-
const
|
|
5925
|
+
const ut = ({ editor: e }) => {
|
|
5791
5926
|
const { selection: t } = e.state;
|
|
5792
|
-
if (!
|
|
5927
|
+
if (!mi(t))
|
|
5793
5928
|
return !1;
|
|
5794
5929
|
let n = 0;
|
|
5795
|
-
const r =
|
|
5930
|
+
const r = Je(t.ranges[0].$from, (o) => o.type.name === "table");
|
|
5796
5931
|
return r == null || r.node.descendants((o) => {
|
|
5797
5932
|
if (o.type.name === "table")
|
|
5798
5933
|
return !1;
|
|
5799
5934
|
["tableCell", "tableHeader"].includes(o.type.name) && (n += 1);
|
|
5800
5935
|
}), n === t.ranges.length ? (e.commands.deleteTable(), !0) : !1;
|
|
5801
|
-
},
|
|
5936
|
+
}, ua = P.create({
|
|
5802
5937
|
name: "table",
|
|
5803
5938
|
// @ts-ignore
|
|
5804
5939
|
addOptions() {
|
|
@@ -5808,7 +5943,7 @@ const ct = ({ editor: e }) => {
|
|
|
5808
5943
|
handleWidth: 5,
|
|
5809
5944
|
cellMinWidth: 25,
|
|
5810
5945
|
// TODO: fix
|
|
5811
|
-
View:
|
|
5946
|
+
View: ui,
|
|
5812
5947
|
lastColumnResizable: !0,
|
|
5813
5948
|
allowTableNodeSelection: !1
|
|
5814
5949
|
};
|
|
@@ -5821,7 +5956,7 @@ const ct = ({ editor: e }) => {
|
|
|
5821
5956
|
return [{ tag: "table" }];
|
|
5822
5957
|
},
|
|
5823
5958
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
5824
|
-
const { colgroup: n, tableWidth: r, tableMinWidth: s } =
|
|
5959
|
+
const { colgroup: n, tableWidth: r, tableMinWidth: s } = pi(e, this.options.cellMinWidth);
|
|
5825
5960
|
return [
|
|
5826
5961
|
"table",
|
|
5827
5962
|
x(this.options.HTMLAttributes, t, {
|
|
@@ -5834,33 +5969,33 @@ const ct = ({ editor: e }) => {
|
|
|
5834
5969
|
addCommands() {
|
|
5835
5970
|
return {
|
|
5836
5971
|
insertTable: ({ rows: e = 3, cols: t = 3, withHeaderRow: n = !0 } = {}) => ({ tr: r, dispatch: s, editor: o }) => {
|
|
5837
|
-
const i =
|
|
5972
|
+
const i = fi(o.schema, e, t, n);
|
|
5838
5973
|
if (s) {
|
|
5839
5974
|
const a = r.selection.from + 1;
|
|
5840
5975
|
r.replaceSelectionWith(i).scrollIntoView().setSelection(I.near(r.doc.resolve(a)));
|
|
5841
5976
|
}
|
|
5842
5977
|
return !0;
|
|
5843
5978
|
},
|
|
5844
|
-
addColumnBefore: () => ({ state: e, dispatch: t }) =>
|
|
5845
|
-
addColumnAfter: () => ({ state: e, dispatch: t }) =>
|
|
5846
|
-
deleteColumn: () => ({ state: e, dispatch: t }) =>
|
|
5847
|
-
addRowBefore: () => ({ state: e, dispatch: t }) =>
|
|
5848
|
-
addRowAfter: () => ({ state: e, dispatch: t }) =>
|
|
5849
|
-
deleteRow: () => ({ state: e, dispatch: t }) =>
|
|
5850
|
-
deleteTable: () => ({ state: e, dispatch: t }) =>
|
|
5851
|
-
mergeCells: () => ({ state: e, dispatch: t }) =>
|
|
5852
|
-
splitCell: () => ({ state: e, dispatch: t }) =>
|
|
5853
|
-
toggleHeaderColumn: () => ({ state: e, dispatch: t }) =>
|
|
5854
|
-
toggleHeaderRow: () => ({ state: e, dispatch: t }) =>
|
|
5855
|
-
toggleHeaderCell: () => ({ state: e, dispatch: t }) =>
|
|
5856
|
-
mergeOrSplit: () => ({ state: e, dispatch: t }) =>
|
|
5857
|
-
setCellAttribute: (e, t) => ({ state: n, dispatch: r }) =>
|
|
5858
|
-
goToNextCell: () => ({ state: e, dispatch: t }) =>
|
|
5859
|
-
goToPreviousCell: () => ({ state: e, dispatch: t }) =>
|
|
5860
|
-
fixTables: () => ({ state: e, dispatch: t }) => (t &&
|
|
5979
|
+
addColumnBefore: () => ({ state: e, dispatch: t }) => Xn(e, t),
|
|
5980
|
+
addColumnAfter: () => ({ state: e, dispatch: t }) => Qn(e, t),
|
|
5981
|
+
deleteColumn: () => ({ state: e, dispatch: t }) => Zn(e, t),
|
|
5982
|
+
addRowBefore: () => ({ state: e, dispatch: t }) => tr(e, t),
|
|
5983
|
+
addRowAfter: () => ({ state: e, dispatch: t }) => er(e, t),
|
|
5984
|
+
deleteRow: () => ({ state: e, dispatch: t }) => nr(e, t),
|
|
5985
|
+
deleteTable: () => ({ state: e, dispatch: t }) => rr(e, t),
|
|
5986
|
+
mergeCells: () => ({ state: e, dispatch: t }) => ie(e, t),
|
|
5987
|
+
splitCell: () => ({ state: e, dispatch: t }) => ae(e, t),
|
|
5988
|
+
toggleHeaderColumn: () => ({ state: e, dispatch: t }) => le("column")(e, t),
|
|
5989
|
+
toggleHeaderRow: () => ({ state: e, dispatch: t }) => le("row")(e, t),
|
|
5990
|
+
toggleHeaderCell: () => ({ state: e, dispatch: t }) => sr(e, t),
|
|
5991
|
+
mergeOrSplit: () => ({ state: e, dispatch: t }) => ie(e, t) ? !0 : ae(e, t),
|
|
5992
|
+
setCellAttribute: (e, t) => ({ state: n, dispatch: r }) => or(e, t)(n, r),
|
|
5993
|
+
goToNextCell: () => ({ state: e, dispatch: t }) => ce(1)(e, t),
|
|
5994
|
+
goToPreviousCell: () => ({ state: e, dispatch: t }) => ce(-1)(e, t),
|
|
5995
|
+
fixTables: () => ({ state: e, dispatch: t }) => (t && ir(e), !0),
|
|
5861
5996
|
setCellSelection: (e) => ({ tr: t, dispatch: n }) => {
|
|
5862
5997
|
if (n) {
|
|
5863
|
-
const r =
|
|
5998
|
+
const r = Ie.create(t.doc, e.anchorCell, e.headCell);
|
|
5864
5999
|
t.setSelection(r);
|
|
5865
6000
|
}
|
|
5866
6001
|
return !0;
|
|
@@ -5871,23 +6006,24 @@ const ct = ({ editor: e }) => {
|
|
|
5871
6006
|
return {
|
|
5872
6007
|
Tab: () => this.editor.commands.goToNextCell() ? !0 : this.editor.can().addRowAfter() ? this.editor.chain().addRowAfter().goToNextCell().run() : !1,
|
|
5873
6008
|
"Shift-Tab": () => this.editor.commands.goToPreviousCell(),
|
|
5874
|
-
Backspace:
|
|
5875
|
-
"Mod-Backspace":
|
|
5876
|
-
Delete:
|
|
5877
|
-
"Mod-Delete":
|
|
6009
|
+
Backspace: ut,
|
|
6010
|
+
"Mod-Backspace": ut,
|
|
6011
|
+
Delete: ut,
|
|
6012
|
+
"Mod-Delete": ut
|
|
5878
6013
|
};
|
|
5879
6014
|
},
|
|
5880
6015
|
addProseMirrorPlugins() {
|
|
5881
6016
|
return [
|
|
5882
6017
|
...this.options.resizable && this.editor.isEditable ? [
|
|
5883
|
-
|
|
6018
|
+
ar({
|
|
5884
6019
|
handleWidth: this.options.handleWidth,
|
|
5885
6020
|
cellMinWidth: this.options.cellMinWidth,
|
|
6021
|
+
defaultCellMinWidth: this.options.cellMinWidth,
|
|
5886
6022
|
View: this.options.View,
|
|
5887
6023
|
lastColumnResizable: this.options.lastColumnResizable
|
|
5888
6024
|
})
|
|
5889
6025
|
] : [],
|
|
5890
|
-
|
|
6026
|
+
lr({
|
|
5891
6027
|
allowTableNodeSelection: this.options.allowTableNodeSelection
|
|
5892
6028
|
})
|
|
5893
6029
|
];
|
|
@@ -5902,7 +6038,7 @@ const ct = ({ editor: e }) => {
|
|
|
5902
6038
|
tableRole: T(S(e, "tableRole", t))
|
|
5903
6039
|
};
|
|
5904
6040
|
}
|
|
5905
|
-
}),
|
|
6041
|
+
}), pa = P.create({
|
|
5906
6042
|
name: "tableCell",
|
|
5907
6043
|
addOptions() {
|
|
5908
6044
|
return {
|
|
@@ -5937,7 +6073,7 @@ const ct = ({ editor: e }) => {
|
|
|
5937
6073
|
renderHTML({ HTMLAttributes: e }) {
|
|
5938
6074
|
return ["td", x(this.options.HTMLAttributes, e), 0];
|
|
5939
6075
|
}
|
|
5940
|
-
}),
|
|
6076
|
+
}), ha = P.create({
|
|
5941
6077
|
name: "tableHeader",
|
|
5942
6078
|
addOptions() {
|
|
5943
6079
|
return {
|
|
@@ -5972,7 +6108,7 @@ const ct = ({ editor: e }) => {
|
|
|
5972
6108
|
renderHTML({ HTMLAttributes: e }) {
|
|
5973
6109
|
return ["th", x(this.options.HTMLAttributes, e), 0];
|
|
5974
6110
|
}
|
|
5975
|
-
}),
|
|
6111
|
+
}), gi = new _("mention"), fa = P.create({
|
|
5976
6112
|
name: "mention",
|
|
5977
6113
|
priority: 101,
|
|
5978
6114
|
addOptions() {
|
|
@@ -5993,7 +6129,7 @@ const ct = ({ editor: e }) => {
|
|
|
5993
6129
|
},
|
|
5994
6130
|
suggestion: {
|
|
5995
6131
|
char: "@",
|
|
5996
|
-
pluginKey:
|
|
6132
|
+
pluginKey: gi,
|
|
5997
6133
|
command: ({ editor: e, range: t, props: n }) => {
|
|
5998
6134
|
var r, s, o;
|
|
5999
6135
|
const i = e.view.state.selection.$to.nodeAfter;
|
|
@@ -6089,7 +6225,7 @@ const ct = ({ editor: e }) => {
|
|
|
6089
6225
|
},
|
|
6090
6226
|
addProseMirrorPlugins() {
|
|
6091
6227
|
return [
|
|
6092
|
-
|
|
6228
|
+
ci({
|
|
6093
6229
|
editor: this.editor,
|
|
6094
6230
|
...this.options.suggestion
|
|
6095
6231
|
})
|
|
@@ -6097,63 +6233,63 @@ const ct = ({ editor: e }) => {
|
|
|
6097
6233
|
}
|
|
6098
6234
|
});
|
|
6099
6235
|
export {
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6236
|
+
ua as $,
|
|
6237
|
+
Qi as A,
|
|
6238
|
+
xi as B,
|
|
6239
|
+
Hi as C,
|
|
6240
|
+
Pi as D,
|
|
6241
|
+
Ti as E,
|
|
6242
|
+
Ni as F,
|
|
6243
|
+
ta as G,
|
|
6244
|
+
Bi as H,
|
|
6245
|
+
Ri as I,
|
|
6246
|
+
Xi as J,
|
|
6247
|
+
ra as K,
|
|
6248
|
+
Gi as L,
|
|
6249
|
+
ea as M,
|
|
6250
|
+
Oi as N,
|
|
6251
|
+
Wi as O,
|
|
6252
|
+
sa as P,
|
|
6253
|
+
na as Q,
|
|
6254
|
+
Li as R,
|
|
6255
|
+
_i as S,
|
|
6256
|
+
ji as T,
|
|
6257
|
+
$i as U,
|
|
6258
|
+
Di as V,
|
|
6259
|
+
aa as W,
|
|
6260
|
+
la as X,
|
|
6261
|
+
ci as Y,
|
|
6262
|
+
_o as Z,
|
|
6263
|
+
ca as _,
|
|
6264
|
+
P as a,
|
|
6265
|
+
da as a0,
|
|
6266
|
+
ha as a1,
|
|
6267
|
+
pa as a2,
|
|
6268
|
+
fa as a3,
|
|
6269
|
+
Sr as a4,
|
|
6270
|
+
wi as b,
|
|
6271
|
+
Cs as c,
|
|
6272
|
+
Bo as d,
|
|
6273
|
+
Ei as e,
|
|
6274
|
+
Si as f,
|
|
6275
|
+
Ai as g,
|
|
6276
|
+
Ii as h,
|
|
6277
|
+
me as i,
|
|
6278
|
+
R as j,
|
|
6279
|
+
Fi as k,
|
|
6280
|
+
zi as l,
|
|
6145
6281
|
x as m,
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6282
|
+
Qe as n,
|
|
6283
|
+
Vi as o,
|
|
6284
|
+
Ui as p,
|
|
6285
|
+
Ki as q,
|
|
6286
|
+
qi as r,
|
|
6287
|
+
Yt as s,
|
|
6288
|
+
Ji as t,
|
|
6289
|
+
Ci as u,
|
|
6290
|
+
Yi as v,
|
|
6291
|
+
ia as w,
|
|
6292
|
+
Zt as x,
|
|
6293
|
+
Zi as y,
|
|
6294
|
+
oa as z
|
|
6159
6295
|
};
|