@clevertask/scribe 0.1.29 → 0.1.30
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 +30 -47
- package/dist/BarMenu-Bban-B3t.js +302 -0
- package/dist/components/Menu/BarMenu.d.ts.map +1 -1
- package/dist/components/Menu/BarMenu.js +1 -1
- package/dist/components/Menu/BubbleMenu.js +2 -2
- package/dist/components/Menu/CalloutBubbleMenu.js +2 -2
- package/dist/components/Menu/LinkBubbleMenu.d.ts.map +1 -1
- package/dist/components/Menu/LinkBubbleMenu.js +107 -119
- package/dist/components/Menu/LinkEditor.d.ts +0 -7
- package/dist/components/Menu/LinkEditor.d.ts.map +1 -1
- package/dist/components/Menu/LinkEditor.js +152 -153
- package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
- package/dist/components/Menu/TableBubbleMenu.js +3 -3
- package/dist/components/Menu/TableHeightSettings.js +1 -1
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts.map +1 -1
- package/dist/components/Menu/linkBubbleMenuPlugin.js +9 -5
- package/dist/components/Scribe/extension/callout.js +7 -7
- package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
- package/dist/components/Scribe/extension/extension-link.js +1 -1
- package/dist/components/Scribe/extension/extension-markdown-paste.js +1 -1
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/attributes.d.ts +0 -7
- package/dist/components/Scribe/extension/external-link-preview/attributes.d.ts.map +1 -1
- package/dist/components/Scribe/extension/external-link-preview/attributes.js +26 -51
- package/dist/components/Scribe/extension/external-link-preview/commands.d.ts +5 -12
- package/dist/components/Scribe/extension/external-link-preview/commands.d.ts.map +1 -1
- package/dist/components/Scribe/extension/external-link-preview/commands.js +56 -121
- package/dist/components/Scribe/extension/external-link-preview/index.d.ts +4 -6
- package/dist/components/Scribe/extension/external-link-preview/index.d.ts.map +1 -1
- package/dist/components/Scribe/extension/external-link-preview/index.js +5 -41
- package/dist/components/Scribe/extension/external-link-preview/render-html.d.ts +1 -0
- package/dist/components/Scribe/extension/external-link-preview/render-html.d.ts.map +1 -1
- package/dist/components/Scribe/extension/external-link-preview/render-html.js +17 -60
- package/dist/components/Scribe/extension/external-link-preview/schema.d.ts +2 -2
- package/dist/components/Scribe/extension/external-link-preview/schema.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/serialization.d.ts.map +1 -1
- package/dist/components/Scribe/extension/external-link-preview/serialization.js +29 -45
- package/dist/components/Scribe/extension/external-link-preview/types.d.ts +14 -17
- package/dist/components/Scribe/extension/external-link-preview/types.d.ts.map +1 -1
- package/dist/components/Scribe/extension/index.js +1 -1
- package/dist/components/Scribe/extension/resizable-table.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
- package/dist/components/Scribe/extension/table-layout.js +1 -1
- package/dist/components/Scribe/extension/tableOfContents.js +1 -1
- package/dist/components/Scribe/index.d.ts +3 -9
- package/dist/components/Scribe/index.d.ts.map +1 -1
- package/dist/components/Scribe/index.js +3 -3
- package/dist/{dist-DnVcys79.js → dist-DGEcUiqG.js} +464 -561
- package/dist/{dist-CDJRm4fL.js → dist-TKt66Yz8.js} +1 -1
- package/dist/{dist-B0xwy1Q5.js → dist-ZGDUiMX8.js} +174 -382
- package/dist/document-node-capabilities.js +1 -1
- package/dist/{extension-BPeoqfHR.js → extension-I7Ocj_D_.js} +1 -1
- package/dist/extension-link-Cb1UO6hv.js +939 -0
- package/dist/main.css +0 -141
- package/dist/{menus-scgppp2C.js → menus-BrQTLTFL.js} +15 -15
- package/dist/{schema-extensions-ITR9LEgX.js → schema-extensions-CzDKrIf8.js} +1324 -1324
- package/dist/schema-extensions.js +1 -1
- package/dist/schema.js +1 -1
- package/dist/{table-layout-iVolql5p.js → table-layout-Dt7KmVp_.js} +36 -36
- package/dist/utils/create-scribe-editor.d.ts +1 -1
- package/dist/utils/create-scribe-editor.d.ts.map +1 -1
- package/dist/utils/index.js +2 -2
- package/package.json +1 -1
- package/dist/BarMenu-BC8XoC6e.js +0 -302
- package/dist/components/Menu/ExternalLinkDisplayOptions.d.ts +0 -13
- package/dist/components/Menu/ExternalLinkDisplayOptions.d.ts.map +0 -1
- package/dist/components/Menu/ExternalLinkDisplayOptions.js +0 -90
- package/dist/components/Scribe/extension/external-link-preview/node-view.d.ts +0 -3
- package/dist/components/Scribe/extension/external-link-preview/node-view.d.ts.map +0 -1
- package/dist/components/Scribe/extension/external-link-preview/node-view.js +0 -97
- package/dist/components/Scribe/extension/external-link-preview/normalization.d.ts +0 -7
- package/dist/components/Scribe/extension/external-link-preview/normalization.d.ts.map +0 -1
- package/dist/components/Scribe/extension/external-link-preview/normalization.js +0 -21
- package/dist/components/Scribe/extension/external-link-preview/paste.d.ts +0 -8
- package/dist/components/Scribe/extension/external-link-preview/paste.d.ts.map +0 -1
- package/dist/components/Scribe/extension/external-link-preview/paste.js +0 -53
- package/dist/components/Scribe/extension/external-link-preview/policy.d.ts +0 -7
- package/dist/components/Scribe/extension/external-link-preview/policy.d.ts.map +0 -1
- package/dist/components/Scribe/extension/external-link-preview/policy.js +0 -38
- package/dist/components/Scribe/extension/external-link-preview/resolver.d.ts +0 -23
- package/dist/components/Scribe/extension/external-link-preview/resolver.d.ts.map +0 -1
- package/dist/components/Scribe/extension/external-link-preview/resolver.js +0 -118
- package/dist/extension-link-RvaqaDqr.js +0 -934
|
@@ -256,10 +256,10 @@ function We(e, t = null) {
|
|
|
256
256
|
let i = n.from, s = r.to;
|
|
257
257
|
return t === "all" ? o.create(e, j(0, i, s), j(e.content.size, i, s)) : o.create(e, j(t, i, s), j(t, i, s));
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function Ge() {
|
|
260
260
|
return ["Android"].includes(navigator.platform) || /android/i.test(navigator.userAgent);
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function M() {
|
|
263
263
|
return [
|
|
264
264
|
"iPad Simulator",
|
|
265
265
|
"iPhone Simulator",
|
|
@@ -269,16 +269,16 @@ function N() {
|
|
|
269
269
|
"iPod"
|
|
270
270
|
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function Ke() {
|
|
273
273
|
return typeof navigator < "u" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
274
274
|
}
|
|
275
|
-
var
|
|
275
|
+
var qe = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
|
|
276
276
|
t = {
|
|
277
277
|
scrollIntoView: !0,
|
|
278
278
|
...t
|
|
279
279
|
};
|
|
280
280
|
let o = () => {
|
|
281
|
-
(
|
|
281
|
+
(M() || Ge()) && r.dom.focus(), Ke() && !M() && !Ge() && r.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
|
|
282
282
|
n.isDestroyed || (r.focus(), t?.scrollIntoView && n.commands.scrollIntoView());
|
|
283
283
|
});
|
|
284
284
|
};
|
|
@@ -290,30 +290,30 @@ var Ke = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
|
|
|
290
290
|
if (a && e === null && !Ue(n.state.selection)) return o(), !0;
|
|
291
291
|
let s = We(i.doc, e) || n.state.selection, c = n.state.selection.eq(s);
|
|
292
292
|
return a && (c || i.setSelection(s), c && i.storedMarks && i.setStoredMarks(i.storedMarks), o()), !0;
|
|
293
|
-
},
|
|
293
|
+
}, Je = (e, t) => (n) => e.every((e, r) => t(e, {
|
|
294
294
|
...n,
|
|
295
295
|
index: r
|
|
296
|
-
})),
|
|
296
|
+
})), Ye = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({
|
|
297
297
|
from: n.selection.from,
|
|
298
298
|
to: n.selection.to
|
|
299
|
-
}, e, t),
|
|
299
|
+
}, e, t), Xe = (e) => {
|
|
300
300
|
let t = e.childNodes;
|
|
301
301
|
for (let n = t.length - 1; n >= 0; --n) {
|
|
302
302
|
let r = t[n];
|
|
303
|
-
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 &&
|
|
303
|
+
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Xe(r);
|
|
304
304
|
}
|
|
305
305
|
return e;
|
|
306
306
|
};
|
|
307
|
-
function
|
|
307
|
+
function N(e) {
|
|
308
308
|
if (typeof window > "u") throw Error("[tiptap error]: there is no window object available, so this function cannot be used");
|
|
309
309
|
let t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
|
|
310
|
-
return
|
|
310
|
+
return Xe(n);
|
|
311
311
|
}
|
|
312
|
-
function
|
|
312
|
+
function Ze(e) {
|
|
313
313
|
return typeof e?.nodesBetween == "function";
|
|
314
314
|
}
|
|
315
|
-
function
|
|
316
|
-
if (
|
|
315
|
+
function P(e, t, n) {
|
|
316
|
+
if (Ze(e)) return e;
|
|
317
317
|
let r = typeof e == "object" && !!e;
|
|
318
318
|
n = {
|
|
319
319
|
slice: !0,
|
|
@@ -327,7 +327,7 @@ function F(e, t, n) {
|
|
|
327
327
|
return n.errorOnInvalidContent && r.check(), r;
|
|
328
328
|
} catch (r) {
|
|
329
329
|
if (n.errorOnInvalidContent) throw Error("[tiptap error]: Invalid JSON content", { cause: r });
|
|
330
|
-
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", r),
|
|
330
|
+
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", r), P("", t, n);
|
|
331
331
|
}
|
|
332
332
|
if (i) {
|
|
333
333
|
if (n.errorOnInvalidContent) {
|
|
@@ -343,17 +343,17 @@ function F(e, t, n) {
|
|
|
343
343
|
}]
|
|
344
344
|
} })
|
|
345
345
|
});
|
|
346
|
-
if (n.slice ? ue.fromSchema(a).parseSlice(
|
|
346
|
+
if (n.slice ? ue.fromSchema(a).parseSlice(N(e), n.parseOptions) : ue.fromSchema(a).parse(N(e), n.parseOptions), n.errorOnInvalidContent && r) throw Error("[tiptap error]: Invalid HTML content", { cause: /* @__PURE__ */ Error(`Invalid element found: ${i}`) });
|
|
347
347
|
}
|
|
348
348
|
let r = ue.fromSchema(t);
|
|
349
|
-
return n.slice ? r.parseSlice(
|
|
349
|
+
return n.slice ? r.parseSlice(N(e), n.parseOptions).content : r.parse(N(e), n.parseOptions);
|
|
350
350
|
}
|
|
351
|
-
return
|
|
351
|
+
return P("", t, n);
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function Qe(e) {
|
|
354
354
|
return !("type" in e);
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function $e(e, t, n) {
|
|
357
357
|
let r = e.steps.length - 1;
|
|
358
358
|
if (r < t) return;
|
|
359
359
|
let i = e.steps[r];
|
|
@@ -363,7 +363,7 @@ function Qe(e, t, n) {
|
|
|
363
363
|
s === 0 && (s = r);
|
|
364
364
|
}), e.setSelection(a.near(e.doc.resolve(s), n));
|
|
365
365
|
}
|
|
366
|
-
var
|
|
366
|
+
var et = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
367
367
|
if (i) {
|
|
368
368
|
n = {
|
|
369
369
|
parseOptions: a.options.parseOptions,
|
|
@@ -385,7 +385,7 @@ var $e = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
385
385
|
...n.parseOptions
|
|
386
386
|
};
|
|
387
387
|
if (!n.errorOnInvalidContent && !a.options.enableContentCheck && a.options.emitContentError) try {
|
|
388
|
-
|
|
388
|
+
P(t, a.schema, {
|
|
389
389
|
parseOptions: s,
|
|
390
390
|
errorOnInvalidContent: !0
|
|
391
391
|
});
|
|
@@ -393,7 +393,7 @@ var $e = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
393
393
|
o(e);
|
|
394
394
|
}
|
|
395
395
|
try {
|
|
396
|
-
i =
|
|
396
|
+
i = P(t, a.schema, {
|
|
397
397
|
parseOptions: s,
|
|
398
398
|
errorOnInvalidContent: n.errorOnInvalidContent ?? a.options.enableContentCheck
|
|
399
399
|
});
|
|
@@ -406,7 +406,7 @@ var $e = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
406
406
|
} : {
|
|
407
407
|
from: e.from,
|
|
408
408
|
to: e.to
|
|
409
|
-
}, u = !0, d = !0, f =
|
|
409
|
+
}, u = !0, d = !0, f = Qe(i) ? i.content : [i];
|
|
410
410
|
if (f.forEach((e) => {
|
|
411
411
|
e.check(), u = u ? e.isText && e.marks.length === 0 : !1, d = d ? e.isBlock : !1;
|
|
412
412
|
}), c === l && d) {
|
|
@@ -414,13 +414,13 @@ var $e = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
414
414
|
e.isTextblock && !e.type.spec.code && !e.childCount && (--c, l += 1);
|
|
415
415
|
}
|
|
416
416
|
let p;
|
|
417
|
-
if (u) p = Array.isArray(t) ? t.map((e) => e.text || "").join("") :
|
|
417
|
+
if (u) p = Array.isArray(t) ? t.map((e) => e.text || "").join("") : Ze(t) ? f.map((e) => e.text ?? "").join("") : typeof t == "object" && t && t.text ? t.text : t, r.insertText(p, c, l);
|
|
418
418
|
else {
|
|
419
419
|
p = w.from(f);
|
|
420
420
|
let e = r.doc.resolve(c), t = e.node(), n = e.parentOffset === 0, i = t.isText || t.isTextblock, a = t.content.size > 0;
|
|
421
421
|
n && i && a && d && (c = Math.max(0, c - 1)), r.replaceWith(c, l, f);
|
|
422
422
|
}
|
|
423
|
-
n.updateSelection &&
|
|
423
|
+
n.updateSelection && $e(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", {
|
|
424
424
|
from: c,
|
|
425
425
|
text: p
|
|
426
426
|
}), n.applyPasteRules && r.setMeta("applyPasteRules", {
|
|
@@ -430,46 +430,46 @@ var $e = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
430
430
|
}
|
|
431
431
|
return !0;
|
|
432
432
|
};
|
|
433
|
-
function
|
|
433
|
+
function tt(e) {
|
|
434
434
|
for (let t = 0; t < e.edgeCount; t += 1) {
|
|
435
435
|
let { type: n } = e.edge(t);
|
|
436
436
|
if (n.isTextblock && !n.hasRequiredAttrs()) return n;
|
|
437
437
|
}
|
|
438
438
|
return null;
|
|
439
439
|
}
|
|
440
|
-
var
|
|
440
|
+
var nt = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
|
|
441
441
|
let { pos: i, attrs: a, content: o, updateSelection: s = !0 } = e, c;
|
|
442
442
|
c = typeof i == "number" ? t.doc.resolve(i) : i || t.selection.$from;
|
|
443
|
-
let l =
|
|
443
|
+
let l = tt(c.parent.contentMatchAt(c.index()));
|
|
444
444
|
if (!l) return !1;
|
|
445
445
|
let u = Object.keys(l.spec.attrs || {}), d = a ? Object.fromEntries(Object.entries(a).filter(([e]) => u.includes(e))) : {}, f;
|
|
446
446
|
if (o) {
|
|
447
|
-
let e =
|
|
447
|
+
let e = P(o, r.schema);
|
|
448
448
|
f = l.createAndFill(d, e);
|
|
449
449
|
} else f = l.createAndFill(d);
|
|
450
|
-
return f ? (n && (t.insert(c.pos, f), s &&
|
|
451
|
-
},
|
|
450
|
+
return f ? (n && (t.insert(c.pos, f), s && $e(t, t.steps.length - 1, -1)), !0) : !1;
|
|
451
|
+
}, rt = () => ({ state: e, dispatch: t }) => te(e, t), it = () => ({ state: e, dispatch: t }) => y(e, t), at = () => ({ state: e, dispatch: t }) => v(e, t), ot = () => ({ state: e, dispatch: t }) => b(e, t), st = (e, t) => {
|
|
452
452
|
let n = e.resolve(t), r = n.nodeBefore, i = n.nodeAfter;
|
|
453
453
|
return !r || !i ? !1 : !r.type.spec.isolating && !i.type.spec.isolating;
|
|
454
|
-
},
|
|
454
|
+
}, ct = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
455
455
|
try {
|
|
456
456
|
let r = m(e.doc, e.selection.$from.pos, -1);
|
|
457
|
-
return r == null || !
|
|
457
|
+
return r == null || !st(e.doc, r) ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
458
458
|
} catch {
|
|
459
459
|
return !1;
|
|
460
460
|
}
|
|
461
|
-
},
|
|
461
|
+
}, lt = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
462
462
|
try {
|
|
463
463
|
let r = m(e.doc, e.selection.$from.pos, 1);
|
|
464
|
-
return r == null || !
|
|
464
|
+
return r == null || !st(e.doc, r) ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
465
465
|
} catch {
|
|
466
466
|
return !1;
|
|
467
467
|
}
|
|
468
|
-
},
|
|
469
|
-
function
|
|
468
|
+
}, ut = () => ({ state: e, dispatch: t }) => x(e, t), dt = () => ({ state: e, dispatch: t }) => ee(e, t);
|
|
469
|
+
function ft() {
|
|
470
470
|
return typeof navigator < "u" && /Mac/.test(navigator.platform);
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function pt(e) {
|
|
473
473
|
let t = e.split(/-(?!$)/), n = t[t.length - 1];
|
|
474
474
|
n === "Space" && (n = " ");
|
|
475
475
|
let r, i, a, o;
|
|
@@ -479,13 +479,13 @@ function ft(e) {
|
|
|
479
479
|
else if (/^a(lt)?$/i.test(n)) r = !0;
|
|
480
480
|
else if (/^(c|ctrl|control)$/i.test(n)) i = !0;
|
|
481
481
|
else if (/^s(hift)?$/i.test(n)) a = !0;
|
|
482
|
-
else if (/^mod$/i.test(n))
|
|
482
|
+
else if (/^mod$/i.test(n)) M() || ft() ? o = !0 : i = !0;
|
|
483
483
|
else throw Error(`Unrecognized modifier name: ${n}`);
|
|
484
484
|
}
|
|
485
485
|
return r && (n = `Alt-${n}`), i && (n = `Ctrl-${n}`), o && (n = `Meta-${n}`), a && (n = `Shift-${n}`), n;
|
|
486
486
|
}
|
|
487
|
-
var
|
|
488
|
-
let a =
|
|
487
|
+
var mt = (e) => ({ editor: t, view: n, tr: r, dispatch: i }) => {
|
|
488
|
+
let a = pt(e).split(/-(?!$)/), o = a.find((e) => ![
|
|
489
489
|
"Alt",
|
|
490
490
|
"Ctrl",
|
|
491
491
|
"Meta",
|
|
@@ -506,7 +506,7 @@ var pt = (e) => ({ editor: t, view: n, tr: r, dispatch: i }) => {
|
|
|
506
506
|
t && i && r.maybeStep(t);
|
|
507
507
|
}), !0;
|
|
508
508
|
};
|
|
509
|
-
function
|
|
509
|
+
function F(e, t, n = {}) {
|
|
510
510
|
let { from: r, to: i, empty: a } = e.selection, o = t ? O(t, e.schema) : null, s = [];
|
|
511
511
|
e.doc.nodesBetween(r, i, (e, t) => {
|
|
512
512
|
if (e.isText) return;
|
|
@@ -520,49 +520,49 @@ function I(e, t, n = {}) {
|
|
|
520
520
|
let c = i - r, l = s.filter((e) => !o || o.name === e.node.type.name).filter((e) => Re(e.node.attrs, n, { strict: !1 }));
|
|
521
521
|
return a ? !!l.length : l.reduce((e, t) => e + t.to - t.from, 0) >= c;
|
|
522
522
|
}
|
|
523
|
-
var
|
|
523
|
+
var ht = (e, t = {}) => ({ state: n, dispatch: r }) => F(n, O(e, n.schema), t) ? S(n, r) : !1, gt = () => ({ state: e, dispatch: t }) => ne(e, t), _t = (e) => ({ state: t, dispatch: n }) => {
|
|
524
524
|
let r = O(e, t.schema);
|
|
525
525
|
return me(r)(t, n);
|
|
526
|
-
},
|
|
527
|
-
function
|
|
526
|
+
}, vt = () => ({ state: e, dispatch: t }) => C(e, t);
|
|
527
|
+
function I(e, t) {
|
|
528
528
|
return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
|
|
529
529
|
}
|
|
530
|
-
function
|
|
530
|
+
function yt(e, t) {
|
|
531
531
|
let n = typeof t == "string" ? [t] : t;
|
|
532
532
|
return Object.keys(e).reduce((t, r) => (n.includes(r) || (t[r] = e[r]), t), {});
|
|
533
533
|
}
|
|
534
|
-
var
|
|
535
|
-
let a = null, o = null, s =
|
|
534
|
+
var bt = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
535
|
+
let a = null, o = null, s = I(typeof e == "string" ? e : e.name, r.schema);
|
|
536
536
|
if (!s) return !1;
|
|
537
537
|
s === "node" && (a = O(e, r.schema)), s === "mark" && (o = A(e, r.schema));
|
|
538
538
|
let c = !1;
|
|
539
539
|
return n.selection.ranges.forEach((e) => {
|
|
540
540
|
r.doc.nodesBetween(e.$from.pos, e.$to.pos, (e, r) => {
|
|
541
|
-
a && a === e.type && (c = !0, i && n.setNodeMarkup(r, void 0,
|
|
542
|
-
o === a.type && (c = !0, i && n.addMark(r, r + e.nodeSize, o.create(
|
|
541
|
+
a && a === e.type && (c = !0, i && n.setNodeMarkup(r, void 0, yt(e.attrs, t))), o && e.marks.length && e.marks.forEach((a) => {
|
|
542
|
+
o === a.type && (c = !0, i && n.addMark(r, r + e.nodeSize, o.create(yt(a.attrs, t))));
|
|
543
543
|
});
|
|
544
544
|
});
|
|
545
545
|
}), c;
|
|
546
|
-
},
|
|
546
|
+
}, xt = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), St = () => ({ tr: t, dispatch: n }) => {
|
|
547
547
|
if (n) {
|
|
548
548
|
let n = new e(t.doc);
|
|
549
549
|
t.setSelection(n);
|
|
550
550
|
}
|
|
551
551
|
return !0;
|
|
552
|
-
},
|
|
553
|
-
function
|
|
554
|
-
return
|
|
552
|
+
}, Ct = () => ({ state: e, dispatch: t }) => re(e, t), wt = () => ({ state: e, dispatch: t }) => ie(e, t), Tt = () => ({ state: e, dispatch: t }) => ae(e, t), Et = () => ({ state: e, dispatch: t }) => oe(e, t), Dt = () => ({ state: e, dispatch: t }) => se(e, t);
|
|
553
|
+
function Ot(e, t, n = {}, r = {}) {
|
|
554
|
+
return P(e, t, {
|
|
555
555
|
slice: !1,
|
|
556
556
|
parseOptions: n,
|
|
557
557
|
errorOnInvalidContent: r.errorOnInvalidContent
|
|
558
558
|
});
|
|
559
559
|
}
|
|
560
|
-
var
|
|
560
|
+
var kt = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {} } = {}) => ({ editor: i, tr: a, dispatch: o, commands: s }) => {
|
|
561
561
|
let { doc: c } = a;
|
|
562
562
|
if (r.preserveWhitespace !== "full") {
|
|
563
|
-
let s =
|
|
563
|
+
let s = Ot(e, i.schema, r, { errorOnInvalidContent: t ?? i.options.enableContentCheck });
|
|
564
564
|
if (o) {
|
|
565
|
-
let e =
|
|
565
|
+
let e = Qe(s) ? s.content : [s];
|
|
566
566
|
a.replaceWith(0, c.content.size, e).setMeta("preventUpdate", !n);
|
|
567
567
|
}
|
|
568
568
|
return !0;
|
|
@@ -575,7 +575,7 @@ var Ot = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {
|
|
|
575
575
|
errorOnInvalidContent: t ?? i.options.enableContentCheck
|
|
576
576
|
});
|
|
577
577
|
};
|
|
578
|
-
function
|
|
578
|
+
function At(e, t) {
|
|
579
579
|
let n = A(t, e.schema), { from: r, to: i, empty: a } = e.selection, o = [];
|
|
580
580
|
a ? (e.storedMarks && o.push(...e.storedMarks), o.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, i, (e) => {
|
|
581
581
|
o.push(...e.marks);
|
|
@@ -583,7 +583,7 @@ function kt(e, t) {
|
|
|
583
583
|
let s = o.find((e) => e.type.name === n.name);
|
|
584
584
|
return s ? { ...s.attrs } : {};
|
|
585
585
|
}
|
|
586
|
-
function
|
|
586
|
+
function jt(e, t) {
|
|
587
587
|
let n = new u(e);
|
|
588
588
|
return t.forEach((e) => {
|
|
589
589
|
e.steps.forEach((e) => {
|
|
@@ -591,7 +591,7 @@ function At(e, t) {
|
|
|
591
591
|
});
|
|
592
592
|
}), n;
|
|
593
593
|
}
|
|
594
|
-
function
|
|
594
|
+
function Mt(e, t, n) {
|
|
595
595
|
let r = [];
|
|
596
596
|
return e.nodesBetween(t.from, t.to, (e, t) => {
|
|
597
597
|
n(e) && r.push({
|
|
@@ -600,7 +600,7 @@ function jt(e, t, n) {
|
|
|
600
600
|
});
|
|
601
601
|
}), r;
|
|
602
602
|
}
|
|
603
|
-
function
|
|
603
|
+
function Nt(e, t) {
|
|
604
604
|
for (let n = e.depth; n > 0; --n) {
|
|
605
605
|
let r = e.node(n);
|
|
606
606
|
if (t(r)) return {
|
|
@@ -611,47 +611,47 @@ function Mt(e, t) {
|
|
|
611
611
|
};
|
|
612
612
|
}
|
|
613
613
|
}
|
|
614
|
-
function
|
|
615
|
-
return (t) =>
|
|
614
|
+
function L(e) {
|
|
615
|
+
return (t) => Nt(t.$from, e);
|
|
616
616
|
}
|
|
617
|
-
function
|
|
618
|
-
return e.config[t] === void 0 && e.parent ?
|
|
617
|
+
function R(e, t, n) {
|
|
618
|
+
return e.config[t] === void 0 && e.parent ? R(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
|
|
619
619
|
...n,
|
|
620
|
-
parent: e.parent ?
|
|
620
|
+
parent: e.parent ? R(e.parent, t, n) : null
|
|
621
621
|
}) : e.config[t];
|
|
622
622
|
}
|
|
623
|
-
function
|
|
623
|
+
function Pt(e) {
|
|
624
624
|
return e.map((e) => {
|
|
625
|
-
let t =
|
|
625
|
+
let t = R(e, "addExtensions", {
|
|
626
626
|
name: e.name,
|
|
627
627
|
options: e.options,
|
|
628
628
|
storage: e.storage
|
|
629
629
|
});
|
|
630
|
-
return t ? [e, ...
|
|
630
|
+
return t ? [e, ...Pt(t())] : e;
|
|
631
631
|
}).flat(10);
|
|
632
632
|
}
|
|
633
|
-
function
|
|
633
|
+
function Ft(e, t) {
|
|
634
634
|
let n = de.fromSchema(t).serializeFragment(e), r = document.implementation.createHTMLDocument().createElement("div");
|
|
635
635
|
return r.appendChild(n), r.innerHTML;
|
|
636
636
|
}
|
|
637
|
-
function
|
|
637
|
+
function It(e) {
|
|
638
638
|
return typeof e == "function";
|
|
639
639
|
}
|
|
640
|
-
function
|
|
641
|
-
return
|
|
640
|
+
function z(e, t = void 0, ...n) {
|
|
641
|
+
return It(e) ? t ? e.bind(t)(...n) : e(...n) : e;
|
|
642
642
|
}
|
|
643
|
-
function
|
|
643
|
+
function Lt(e = {}) {
|
|
644
644
|
return Object.keys(e).length === 0 && e.constructor === Object;
|
|
645
645
|
}
|
|
646
|
-
function
|
|
646
|
+
function B(e) {
|
|
647
647
|
return {
|
|
648
648
|
baseExtensions: e.filter((e) => e.type === "extension"),
|
|
649
649
|
nodeExtensions: e.filter((e) => e.type === "node"),
|
|
650
650
|
markExtensions: e.filter((e) => e.type === "mark")
|
|
651
651
|
};
|
|
652
652
|
}
|
|
653
|
-
function
|
|
654
|
-
let t = [], { nodeExtensions: n, markExtensions: r } =
|
|
653
|
+
function Rt(e) {
|
|
654
|
+
let t = [], { nodeExtensions: n, markExtensions: r } = B(e), i = [...n, ...r], a = {
|
|
655
655
|
default: null,
|
|
656
656
|
validate: void 0,
|
|
657
657
|
rendered: !0,
|
|
@@ -661,7 +661,7 @@ function Lt(e) {
|
|
|
661
661
|
isRequired: !1
|
|
662
662
|
}, o = n.filter((e) => e.name !== "text").map((e) => e.name), s = r.map((e) => e.name), c = [...o, ...s];
|
|
663
663
|
return e.forEach((e) => {
|
|
664
|
-
let n =
|
|
664
|
+
let n = R(e, "addGlobalAttributes", {
|
|
665
665
|
name: e.name,
|
|
666
666
|
options: e.options,
|
|
667
667
|
storage: e.storage,
|
|
@@ -683,7 +683,7 @@ function Lt(e) {
|
|
|
683
683
|
});
|
|
684
684
|
});
|
|
685
685
|
}), i.forEach((e) => {
|
|
686
|
-
let n =
|
|
686
|
+
let n = R(e, "addAttributes", {
|
|
687
687
|
name: e.name,
|
|
688
688
|
options: e.options,
|
|
689
689
|
storage: e.storage
|
|
@@ -703,7 +703,7 @@ function Lt(e) {
|
|
|
703
703
|
});
|
|
704
704
|
}), t;
|
|
705
705
|
}
|
|
706
|
-
function
|
|
706
|
+
function zt(e) {
|
|
707
707
|
let t = [], n = "", r = !1, i = !1, a = 0, o = e.length;
|
|
708
708
|
for (let s = 0; s < o; s += 1) {
|
|
709
709
|
let o = e[s];
|
|
@@ -733,8 +733,8 @@ function Rt(e) {
|
|
|
733
733
|
}
|
|
734
734
|
return n && t.push(n), t;
|
|
735
735
|
}
|
|
736
|
-
function
|
|
737
|
-
let t = [], n =
|
|
736
|
+
function Bt(e) {
|
|
737
|
+
let t = [], n = zt(e || ""), r = n.length;
|
|
738
738
|
for (let e = 0; e < r; e += 1) {
|
|
739
739
|
let r = n[e], i = r.indexOf(":");
|
|
740
740
|
if (i === -1) continue;
|
|
@@ -743,7 +743,7 @@ function zt(e) {
|
|
|
743
743
|
}
|
|
744
744
|
return t;
|
|
745
745
|
}
|
|
746
|
-
function
|
|
746
|
+
function Vt(...e) {
|
|
747
747
|
return e.filter((e) => !!e).reduce((e, t) => {
|
|
748
748
|
let n = { ...e };
|
|
749
749
|
return Object.entries(t).forEach(([e, t]) => {
|
|
@@ -764,26 +764,26 @@ function Bt(...e) {
|
|
|
764
764
|
let r = t ? String(t).split(" ") : [], i = n[e] ? n[e].split(" ") : [], a = r.filter((e) => !i.includes(e));
|
|
765
765
|
n[e] = [...i, ...a].join(" ");
|
|
766
766
|
} else if (e === "style") {
|
|
767
|
-
let r = new Map([...
|
|
767
|
+
let r = new Map([...Bt(n[e]), ...Bt(t)]);
|
|
768
768
|
n[e] = Array.from(r.entries()).map(([e, t]) => `${e}: ${t}`).join("; ");
|
|
769
769
|
} else n[e] = t;
|
|
770
770
|
}), n;
|
|
771
771
|
}, {});
|
|
772
772
|
}
|
|
773
|
-
function
|
|
774
|
-
return t.filter((t) => t.type === e.type.name).filter((e) => e.attribute.rendered).map((t) => t.attribute.renderHTML ? t.attribute.renderHTML(e.attrs) || {} : { [t.name]: e.attrs[t.name] }).reduce((e, t) =>
|
|
773
|
+
function V(e, t) {
|
|
774
|
+
return t.filter((t) => t.type === e.type.name).filter((e) => e.attribute.rendered).map((t) => t.attribute.renderHTML ? t.attribute.renderHTML(e.attrs) || {} : { [t.name]: e.attrs[t.name] }).reduce((e, t) => Vt(e, t), {});
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function Ht(e) {
|
|
777
777
|
return typeof e == "string" ? e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" || e !== "false" && e : e;
|
|
778
778
|
}
|
|
779
|
-
function
|
|
779
|
+
function Ut(e, t) {
|
|
780
780
|
return "style" in e ? e : {
|
|
781
781
|
...e,
|
|
782
782
|
getAttrs: (n) => {
|
|
783
783
|
let r = e.getAttrs ? e.getAttrs(n) : e.attrs;
|
|
784
784
|
if (r === !1) return !1;
|
|
785
785
|
let i = t.reduce((e, t) => {
|
|
786
|
-
let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) :
|
|
786
|
+
let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) : Ht(n.getAttribute(t.name));
|
|
787
787
|
return r == null ? e : {
|
|
788
788
|
...e,
|
|
789
789
|
[t.name]: r
|
|
@@ -796,50 +796,50 @@ function Ht(e, t) {
|
|
|
796
796
|
}
|
|
797
797
|
};
|
|
798
798
|
}
|
|
799
|
-
function Ut(e) {
|
|
800
|
-
return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" && It(t) ? !1 : t != null));
|
|
801
|
-
}
|
|
802
799
|
function Wt(e) {
|
|
800
|
+
return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" && Lt(t) ? !1 : t != null));
|
|
801
|
+
}
|
|
802
|
+
function Gt(e) {
|
|
803
803
|
var t, n;
|
|
804
804
|
let r = {};
|
|
805
805
|
return !(e != null && (t = e.attribute) != null && t.isRequired) && "default" in (e?.attribute || {}) && (r.default = e.attribute.default), (e == null || (n = e.attribute) == null ? void 0 : n.validate) !== void 0 && (r.validate = e.attribute.validate), [e.name, r];
|
|
806
806
|
}
|
|
807
|
-
function
|
|
808
|
-
let n =
|
|
807
|
+
function Kt(e, t) {
|
|
808
|
+
let n = Rt(e), { nodeExtensions: r, markExtensions: i } = B(e), a = r.find((e) => R(e, "topNode"))?.name, o = Object.fromEntries(r.map((r) => {
|
|
809
809
|
let i = n.filter((e) => e.type === r.name), a = {
|
|
810
810
|
name: r.name,
|
|
811
811
|
options: r.options,
|
|
812
812
|
storage: r.storage,
|
|
813
813
|
editor: t
|
|
814
|
-
}, o =
|
|
814
|
+
}, o = Wt({
|
|
815
815
|
...e.reduce((e, t) => {
|
|
816
|
-
let n =
|
|
816
|
+
let n = R(t, "extendNodeSchema", a);
|
|
817
817
|
return {
|
|
818
818
|
...e,
|
|
819
819
|
...n ? n(r) : {}
|
|
820
820
|
};
|
|
821
821
|
}, {}),
|
|
822
|
-
content:
|
|
823
|
-
marks:
|
|
824
|
-
group:
|
|
825
|
-
inline:
|
|
826
|
-
atom:
|
|
827
|
-
selectable:
|
|
828
|
-
draggable:
|
|
829
|
-
code:
|
|
830
|
-
whitespace:
|
|
831
|
-
linebreakReplacement:
|
|
832
|
-
defining:
|
|
833
|
-
isolating:
|
|
834
|
-
attrs: Object.fromEntries(i.map(
|
|
835
|
-
}), s =
|
|
836
|
-
s && (o.parseDOM = s.map((e) =>
|
|
837
|
-
let c =
|
|
822
|
+
content: z(R(r, "content", a)),
|
|
823
|
+
marks: z(R(r, "marks", a)),
|
|
824
|
+
group: z(R(r, "group", a)),
|
|
825
|
+
inline: z(R(r, "inline", a)),
|
|
826
|
+
atom: z(R(r, "atom", a)),
|
|
827
|
+
selectable: z(R(r, "selectable", a)),
|
|
828
|
+
draggable: z(R(r, "draggable", a)),
|
|
829
|
+
code: z(R(r, "code", a)),
|
|
830
|
+
whitespace: z(R(r, "whitespace", a)),
|
|
831
|
+
linebreakReplacement: z(R(r, "linebreakReplacement", a)),
|
|
832
|
+
defining: z(R(r, "defining", a)),
|
|
833
|
+
isolating: z(R(r, "isolating", a)),
|
|
834
|
+
attrs: Object.fromEntries(i.map(Gt))
|
|
835
|
+
}), s = z(R(r, "parseHTML", a));
|
|
836
|
+
s && (o.parseDOM = s.map((e) => Ut(e, i)));
|
|
837
|
+
let c = R(r, "renderHTML", a);
|
|
838
838
|
c && (o.toDOM = (e) => c({
|
|
839
839
|
node: e,
|
|
840
|
-
HTMLAttributes:
|
|
840
|
+
HTMLAttributes: V(e, i)
|
|
841
841
|
}));
|
|
842
|
-
let l =
|
|
842
|
+
let l = R(r, "renderText", a);
|
|
843
843
|
return l && (o.toText = l), [r.name, o];
|
|
844
844
|
})), s = Object.fromEntries(i.map((r) => {
|
|
845
845
|
let i = n.filter((e) => e.type === r.name), a = {
|
|
@@ -847,26 +847,26 @@ function Gt(e, t) {
|
|
|
847
847
|
options: r.options,
|
|
848
848
|
storage: r.storage,
|
|
849
849
|
editor: t
|
|
850
|
-
}, o =
|
|
850
|
+
}, o = Wt({
|
|
851
851
|
...e.reduce((e, t) => {
|
|
852
|
-
let n =
|
|
852
|
+
let n = R(t, "extendMarkSchema", a);
|
|
853
853
|
return {
|
|
854
854
|
...e,
|
|
855
855
|
...n ? n(r) : {}
|
|
856
856
|
};
|
|
857
857
|
}, {}),
|
|
858
|
-
inclusive:
|
|
859
|
-
excludes:
|
|
860
|
-
group:
|
|
861
|
-
spanning:
|
|
862
|
-
code:
|
|
863
|
-
attrs: Object.fromEntries(i.map(
|
|
864
|
-
}), s =
|
|
865
|
-
s && (o.parseDOM = s.map((e) =>
|
|
866
|
-
let c =
|
|
858
|
+
inclusive: z(R(r, "inclusive", a)),
|
|
859
|
+
excludes: z(R(r, "excludes", a)),
|
|
860
|
+
group: z(R(r, "group", a)),
|
|
861
|
+
spanning: z(R(r, "spanning", a)),
|
|
862
|
+
code: z(R(r, "code", a)),
|
|
863
|
+
attrs: Object.fromEntries(i.map(Gt))
|
|
864
|
+
}), s = z(R(r, "parseHTML", a));
|
|
865
|
+
s && (o.parseDOM = s.map((e) => Ut(e, i)));
|
|
866
|
+
let c = R(r, "renderHTML", a);
|
|
867
867
|
return c && (o.toDOM = (e) => c({
|
|
868
868
|
mark: e,
|
|
869
|
-
HTMLAttributes:
|
|
869
|
+
HTMLAttributes: V(e, i)
|
|
870
870
|
})), [r.name, o];
|
|
871
871
|
}));
|
|
872
872
|
return new fe({
|
|
@@ -875,21 +875,21 @@ function Gt(e, t) {
|
|
|
875
875
|
marks: s
|
|
876
876
|
});
|
|
877
877
|
}
|
|
878
|
-
function
|
|
878
|
+
function qt(e) {
|
|
879
879
|
let t = e.filter((t, n) => e.indexOf(t) !== n);
|
|
880
880
|
return Array.from(new Set(t));
|
|
881
881
|
}
|
|
882
|
-
function
|
|
882
|
+
function H(e) {
|
|
883
883
|
return e.sort((e, t) => {
|
|
884
|
-
let n =
|
|
884
|
+
let n = R(e, "priority") || 100, r = R(t, "priority") || 100;
|
|
885
885
|
return n > r ? -1 : +(n < r);
|
|
886
886
|
});
|
|
887
887
|
}
|
|
888
|
-
function
|
|
889
|
-
let t =
|
|
888
|
+
function Jt(e) {
|
|
889
|
+
let t = H(Pt(e)), n = qt(t.map((e) => e.name));
|
|
890
890
|
return n.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((e) => `'${e}'`).join(", ")}]. This can lead to issues.`), t;
|
|
891
891
|
}
|
|
892
|
-
function
|
|
892
|
+
function Yt(e, t, n) {
|
|
893
893
|
let { from: r, to: i } = t, { blockSeparator: a = "\n\n", textSerializers: o = {} } = n || {}, s = "";
|
|
894
894
|
return e.nodesBetween(r, i, (e, n, c, l) => {
|
|
895
895
|
e.isBlock && n > r && (s += a);
|
|
@@ -907,16 +907,16 @@ function Jt(e, t, n) {
|
|
|
907
907
|
}
|
|
908
908
|
}), s;
|
|
909
909
|
}
|
|
910
|
-
function
|
|
911
|
-
return
|
|
910
|
+
function Xt(e, t) {
|
|
911
|
+
return Yt(e, {
|
|
912
912
|
from: 0,
|
|
913
913
|
to: e.content.size
|
|
914
914
|
}, t);
|
|
915
915
|
}
|
|
916
|
-
function
|
|
916
|
+
function Zt(e) {
|
|
917
917
|
return Object.fromEntries(Object.entries(e.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText]));
|
|
918
918
|
}
|
|
919
|
-
function
|
|
919
|
+
function Qt(e, t) {
|
|
920
920
|
let n = O(t, e.schema), { from: r, to: i } = e.selection, a = [];
|
|
921
921
|
e.doc.nodesBetween(r, i, (e) => {
|
|
922
922
|
a.push(e);
|
|
@@ -924,22 +924,22 @@ function Zt(e, t) {
|
|
|
924
924
|
let o = a.reverse().find((e) => e.type.name === n.name);
|
|
925
925
|
return o ? { ...o.attrs } : {};
|
|
926
926
|
}
|
|
927
|
-
function
|
|
928
|
-
let n =
|
|
929
|
-
return n === "node" ?
|
|
927
|
+
function $t(e, t) {
|
|
928
|
+
let n = I(typeof t == "string" ? t : t.name, e.schema);
|
|
929
|
+
return n === "node" ? Qt(e, t) : n === "mark" ? At(e, t) : {};
|
|
930
930
|
}
|
|
931
|
-
function
|
|
931
|
+
function en(e, t = JSON.stringify) {
|
|
932
932
|
let n = {};
|
|
933
933
|
return e.filter((e) => {
|
|
934
934
|
let r = t(e);
|
|
935
935
|
return Object.prototype.hasOwnProperty.call(n, r) ? !1 : n[r] = !0;
|
|
936
936
|
});
|
|
937
937
|
}
|
|
938
|
-
function
|
|
939
|
-
let t =
|
|
938
|
+
function tn(e) {
|
|
939
|
+
let t = en(e);
|
|
940
940
|
return t.length === 1 ? t : t.filter((e, n) => !t.filter((e, t) => t !== n).some((t) => e.oldRange.from >= t.oldRange.from && e.oldRange.to <= t.oldRange.to && e.newRange.from >= t.newRange.from && e.newRange.to <= t.newRange.to));
|
|
941
941
|
}
|
|
942
|
-
function
|
|
942
|
+
function nn(e) {
|
|
943
943
|
let { mapping: t, steps: n } = e, r = [];
|
|
944
944
|
return t.maps.forEach((e, i) => {
|
|
945
945
|
let a = [];
|
|
@@ -970,9 +970,9 @@ function tn(e) {
|
|
|
970
970
|
}
|
|
971
971
|
});
|
|
972
972
|
});
|
|
973
|
-
}),
|
|
973
|
+
}), tn(r);
|
|
974
974
|
}
|
|
975
|
-
function
|
|
975
|
+
function rn(e, t, n) {
|
|
976
976
|
let r = [];
|
|
977
977
|
return e === t ? n.resolve(e).marks().forEach((t) => {
|
|
978
978
|
let i = k(n.resolve(e), t.type);
|
|
@@ -988,29 +988,29 @@ function nn(e, t, n) {
|
|
|
988
988
|
})));
|
|
989
989
|
}), r;
|
|
990
990
|
}
|
|
991
|
-
var
|
|
991
|
+
var an = (e, t, n, r = 20) => {
|
|
992
992
|
let i = e.doc.resolve(n), a = r, o = null;
|
|
993
993
|
for (; a > 0 && o === null;) {
|
|
994
994
|
let e = i.node(a);
|
|
995
995
|
e?.type.name === t ? o = e : --a;
|
|
996
996
|
}
|
|
997
997
|
return [o, a];
|
|
998
|
-
},
|
|
998
|
+
}, on = (e) => {
|
|
999
999
|
let t = e.depth - 1;
|
|
1000
1000
|
if (t < 0) return null;
|
|
1001
1001
|
let n = e.index(t);
|
|
1002
1002
|
return n === 0 ? null : e.node(t).child(n - 1);
|
|
1003
1003
|
};
|
|
1004
|
-
function
|
|
1004
|
+
function U(e, t) {
|
|
1005
1005
|
return t.nodes[e] || t.marks[e] || null;
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1007
|
+
function W(e, t, n) {
|
|
1008
1008
|
return Object.fromEntries(Object.entries(n).filter(([n]) => {
|
|
1009
1009
|
let r = e.find((e) => e.type === t && e.name === n);
|
|
1010
1010
|
return r ? r.attribute.keepOnSplit : !1;
|
|
1011
1011
|
}));
|
|
1012
1012
|
}
|
|
1013
|
-
var
|
|
1013
|
+
var sn = (e, t = 500) => {
|
|
1014
1014
|
let n = "", r = e.parentOffset;
|
|
1015
1015
|
return e.parent.nodesBetween(Math.max(0, r - t), r, (e, t, i, a) => {
|
|
1016
1016
|
var o;
|
|
@@ -1023,7 +1023,7 @@ var on = (e, t = 500) => {
|
|
|
1023
1023
|
n += e.isAtom && !e.isText ? s : s.slice(0, Math.max(0, r - t));
|
|
1024
1024
|
}), n;
|
|
1025
1025
|
};
|
|
1026
|
-
function
|
|
1026
|
+
function cn(e, t, n = {}) {
|
|
1027
1027
|
let { empty: r, ranges: i } = e.selection, a = t ? A(t, e.schema) : null;
|
|
1028
1028
|
if (r) return !!(e.storedMarks || e.selection.$from.marks()).filter((e) => !a || a.name === e.type.name).find((e) => Re(e.attrs, n, { strict: !1 }));
|
|
1029
1029
|
let o = 0, s = [];
|
|
@@ -1043,38 +1043,38 @@ function sn(e, t, n = {}) {
|
|
|
1043
1043
|
let c = s.filter((e) => !a || a.name === e.mark.type.name).filter((e) => Re(e.mark.attrs, n, { strict: !1 })).reduce((e, t) => e + t.to - t.from, 0), l = s.filter((e) => !a || e.mark.type !== a && e.mark.type.excludes(a)).reduce((e, t) => e + t.to - t.from, 0);
|
|
1044
1044
|
return (c > 0 ? c + l : c) >= o;
|
|
1045
1045
|
}
|
|
1046
|
-
function
|
|
1047
|
-
if (!t) return
|
|
1048
|
-
let r =
|
|
1049
|
-
return r === "node" ?
|
|
1046
|
+
function ln(e, t, n = {}) {
|
|
1047
|
+
if (!t) return F(e, null, n) || cn(e, null, n);
|
|
1048
|
+
let r = I(t, e.schema);
|
|
1049
|
+
return r === "node" ? F(e, t, n) : r === "mark" && cn(e, t, n);
|
|
1050
1050
|
}
|
|
1051
|
-
var
|
|
1051
|
+
var un = (e, t) => {
|
|
1052
1052
|
let { $from: n, $to: r, $anchor: i } = e.selection;
|
|
1053
1053
|
if (t) {
|
|
1054
|
-
let n =
|
|
1054
|
+
let n = L((e) => e.type.name === t)(e.selection);
|
|
1055
1055
|
if (!n) return !1;
|
|
1056
1056
|
let r = e.doc.resolve(n.pos + 1);
|
|
1057
1057
|
return i.pos + 1 === r.end();
|
|
1058
1058
|
}
|
|
1059
1059
|
return !(r.parentOffset < r.parent.nodeSize - 2 || n.pos !== r.pos);
|
|
1060
|
-
},
|
|
1060
|
+
}, dn = (e) => {
|
|
1061
1061
|
let { $from: t, $to: n } = e.selection;
|
|
1062
1062
|
return !(t.parentOffset > 0 || t.pos !== n.pos);
|
|
1063
1063
|
};
|
|
1064
|
-
function
|
|
1064
|
+
function fn(e, t) {
|
|
1065
1065
|
return Array.isArray(t) ? t.some((t) => (typeof t == "string" ? t : t.name) === e.name) : t;
|
|
1066
1066
|
}
|
|
1067
|
-
function
|
|
1068
|
-
let { nodeExtensions: n } =
|
|
1067
|
+
function pn(e, t) {
|
|
1068
|
+
let { nodeExtensions: n } = B(t), r = n.find((t) => t.name === e);
|
|
1069
1069
|
if (!r) return !1;
|
|
1070
|
-
let i =
|
|
1070
|
+
let i = z(R(r, "group", {
|
|
1071
1071
|
name: r.name,
|
|
1072
1072
|
options: r.options,
|
|
1073
1073
|
storage: r.storage
|
|
1074
1074
|
}));
|
|
1075
1075
|
return typeof i == "string" && i.split(" ").includes("list");
|
|
1076
1076
|
}
|
|
1077
|
-
function
|
|
1077
|
+
function G(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
1078
1078
|
if (n) {
|
|
1079
1079
|
if (e.type.name === "hardBreak") return !0;
|
|
1080
1080
|
if (e.isText) return !/\S/.test(e.text ?? "");
|
|
@@ -1085,7 +1085,7 @@ function K(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1085
1085
|
if (t) {
|
|
1086
1086
|
let r = !0;
|
|
1087
1087
|
return e.content.forEach((e) => {
|
|
1088
|
-
r !== !1 && (
|
|
1088
|
+
r !== !1 && (G(e, {
|
|
1089
1089
|
ignoreWhitespace: n,
|
|
1090
1090
|
checkChildren: t
|
|
1091
1091
|
}) || (r = !1));
|
|
@@ -1093,10 +1093,10 @@ function K(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1093
1093
|
}
|
|
1094
1094
|
return !1;
|
|
1095
1095
|
}
|
|
1096
|
-
function
|
|
1096
|
+
function mn(e) {
|
|
1097
1097
|
return e instanceof n;
|
|
1098
1098
|
}
|
|
1099
|
-
var
|
|
1099
|
+
var hn = class e {
|
|
1100
1100
|
constructor(e) {
|
|
1101
1101
|
this.position = e;
|
|
1102
1102
|
}
|
|
@@ -1107,17 +1107,17 @@ var mn = class e {
|
|
|
1107
1107
|
return { position: this.position };
|
|
1108
1108
|
}
|
|
1109
1109
|
};
|
|
1110
|
-
function
|
|
1110
|
+
function gn(e, t) {
|
|
1111
1111
|
let n = t.mapping.mapResult(e.position);
|
|
1112
1112
|
return {
|
|
1113
|
-
position: new
|
|
1113
|
+
position: new hn(n.pos),
|
|
1114
1114
|
mapResult: n
|
|
1115
1115
|
};
|
|
1116
1116
|
}
|
|
1117
|
-
function
|
|
1118
|
-
return new
|
|
1117
|
+
function _n(e) {
|
|
1118
|
+
return new hn(e);
|
|
1119
1119
|
}
|
|
1120
|
-
function
|
|
1120
|
+
function vn(e, t, n) {
|
|
1121
1121
|
let r = e.state.doc.content.size, i = j(t, 0, r), a = j(n, 0, r), o = e.coordsAtPos(i), s = e.coordsAtPos(a, -1), c = Math.min(o.top, s.top), l = Math.max(o.bottom, s.bottom), u = Math.min(o.left, s.left), d = Math.max(o.right, s.right), f = {
|
|
1122
1122
|
top: c,
|
|
1123
1123
|
bottom: l,
|
|
@@ -1133,7 +1133,7 @@ function _n(e, t, n) {
|
|
|
1133
1133
|
toJSON: () => f
|
|
1134
1134
|
};
|
|
1135
1135
|
}
|
|
1136
|
-
function
|
|
1136
|
+
function yn(e, t, n) {
|
|
1137
1137
|
let { selection: r } = t, i = null;
|
|
1138
1138
|
if (Ue(r) && (i = r.$cursor), i) {
|
|
1139
1139
|
let t = e.storedMarks ?? i.marks();
|
|
@@ -1152,11 +1152,11 @@ function vn(e, t, n) {
|
|
|
1152
1152
|
}), i;
|
|
1153
1153
|
});
|
|
1154
1154
|
}
|
|
1155
|
-
var
|
|
1155
|
+
var bn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1156
1156
|
let { selection: a } = n, { empty: o, ranges: s } = a, c = A(e, r.schema);
|
|
1157
1157
|
if (i) {
|
|
1158
1158
|
if (o) {
|
|
1159
|
-
let e =
|
|
1159
|
+
let e = At(r, c);
|
|
1160
1160
|
n.addStoredMark(c.create({
|
|
1161
1161
|
...e,
|
|
1162
1162
|
...t
|
|
@@ -1174,8 +1174,8 @@ var yn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1174
1174
|
});
|
|
1175
1175
|
});
|
|
1176
1176
|
}
|
|
1177
|
-
return
|
|
1178
|
-
},
|
|
1177
|
+
return yn(r, n, c);
|
|
1178
|
+
}, xn = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), Sn = (e, t = {}) => ({ state: n, dispatch: r, chain: i }) => {
|
|
1179
1179
|
let a = O(e, n.schema), o;
|
|
1180
1180
|
return n.selection.$anchor.sameParent(n.selection.$head) && (o = n.selection.$anchor.parent.attrs), a.isTextblock ? i().command(({ commands: e }) => ce(a, {
|
|
1181
1181
|
...o,
|
|
@@ -1184,13 +1184,13 @@ var yn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1184
1184
|
...o,
|
|
1185
1185
|
...t
|
|
1186
1186
|
})(e, r)).run() : (console.warn("[tiptap warn]: Currently \"setNode()\" only supports text block nodes."), !1);
|
|
1187
|
-
},
|
|
1187
|
+
}, Cn = (e) => ({ tr: t, dispatch: r }) => {
|
|
1188
1188
|
if (r) {
|
|
1189
1189
|
let { doc: r } = t, i = j(e, 0, r.content.size), a = n.create(r, i);
|
|
1190
1190
|
t.setSelection(a);
|
|
1191
1191
|
}
|
|
1192
1192
|
return !0;
|
|
1193
|
-
},
|
|
1193
|
+
}, wn = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1194
1194
|
let { selection: a } = r, o, s;
|
|
1195
1195
|
return typeof t == "number" ? (o = t, s = t) : t && "from" in t && "to" in t ? (o = t.from, s = t.to) : (o = a.from, s = a.to), i && n.doc.nodesBetween(o, s, (t, r) => {
|
|
1196
1196
|
t.isText || n.setNodeMarkup(r, void 0, {
|
|
@@ -1198,7 +1198,7 @@ var yn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1198
1198
|
dir: e
|
|
1199
1199
|
});
|
|
1200
1200
|
}), !0;
|
|
1201
|
-
},
|
|
1201
|
+
}, Tn = (e) => ({ tr: t, dispatch: n }) => {
|
|
1202
1202
|
if (n) {
|
|
1203
1203
|
let { doc: n } = t, { from: r, to: i } = typeof e == "number" ? {
|
|
1204
1204
|
from: e,
|
|
@@ -1207,22 +1207,22 @@ var yn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1207
1207
|
t.setSelection(u);
|
|
1208
1208
|
}
|
|
1209
1209
|
return !0;
|
|
1210
|
-
},
|
|
1210
|
+
}, En = (e) => ({ state: t, dispatch: n }) => {
|
|
1211
1211
|
let r = O(e, t.schema);
|
|
1212
1212
|
return he(r)(t, n);
|
|
1213
1213
|
};
|
|
1214
|
-
function
|
|
1214
|
+
function Dn(e, t) {
|
|
1215
1215
|
let n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
|
|
1216
1216
|
if (n) {
|
|
1217
1217
|
let r = n.filter((e) => t?.includes(e.type.name));
|
|
1218
1218
|
e.tr.ensureMarks(r);
|
|
1219
1219
|
}
|
|
1220
1220
|
}
|
|
1221
|
-
var
|
|
1222
|
-
let { selection: c, doc: l } = r, { $from: u, $to: d } = c, p = s.extensionManager.attributes, m =
|
|
1223
|
-
if (c instanceof n && c.node.isBlock) return !u.parentOffset || !f(l, u.pos) ? !1 : (a && (e &&
|
|
1221
|
+
var On = ({ keepMarks: e = !0 } = {}) => ({ tr: r, state: i, dispatch: a, editor: s }) => {
|
|
1222
|
+
let { selection: c, doc: l } = r, { $from: u, $to: d } = c, p = s.extensionManager.attributes, m = W(p, u.node().type.name, u.node().attrs);
|
|
1223
|
+
if (c instanceof n && c.node.isBlock) return !u.parentOffset || !f(l, u.pos) ? !1 : (a && (e && Dn(i, s.extensionManager.splittableMarks), r.split(u.pos).scrollIntoView()), !0);
|
|
1224
1224
|
if (!u.parent.isBlock) return !1;
|
|
1225
|
-
let h = d.parentOffset === d.parent.content.size, g = u.depth === 0 ? void 0 :
|
|
1225
|
+
let h = d.parentOffset === d.parent.content.size, g = u.depth === 0 ? void 0 : tt(u.node(-1).contentMatchAt(u.indexAfter(-1))), _ = h && g ? [{
|
|
1226
1226
|
type: g,
|
|
1227
1227
|
attrs: m
|
|
1228
1228
|
}] : void 0, v = c instanceof o && !c.empty ? t.create({
|
|
@@ -1240,10 +1240,10 @@ var Dn = ({ keepMarks: e = !0 } = {}) => ({ tr: r, state: i, dispatch: a, editor
|
|
|
1240
1240
|
u.node(-1).canReplaceWith(n.index(), n.index() + 1, g) && r.setNodeMarkup(r.mapping.slice(e).map(u.before()), g);
|
|
1241
1241
|
}
|
|
1242
1242
|
}
|
|
1243
|
-
e &&
|
|
1243
|
+
e && Dn(i, s.extensionManager.splittableMarks), r.scrollIntoView();
|
|
1244
1244
|
}
|
|
1245
1245
|
return x;
|
|
1246
|
-
},
|
|
1246
|
+
}, kn = (e, t = {}) => ({ tr: n, state: r, dispatch: i, editor: a }) => {
|
|
1247
1247
|
let s = O(e, r.schema), { $from: c, $to: l } = r.selection, u = r.selection.node;
|
|
1248
1248
|
if (u && u.isBlock || c.depth < 2 || !c.sameParent(l)) return !1;
|
|
1249
1249
|
let d = c.node(-1);
|
|
@@ -1255,7 +1255,7 @@ var Dn = ({ keepMarks: e = !0 } = {}) => ({ tr: r, state: i, dispatch: a, editor
|
|
|
1255
1255
|
let e = w.empty, r = c.index(-1) ? 1 : c.index(-2) ? 2 : 3;
|
|
1256
1256
|
for (let t = c.depth - r; t >= c.depth - 3; --t) e = w.from(c.node(t).copy(e));
|
|
1257
1257
|
let i = c.indexAfter(-1) < c.node(-2).childCount ? 1 : c.indexAfter(-2) < c.node(-3).childCount ? 2 : 3, a = {
|
|
1258
|
-
...
|
|
1258
|
+
...W(p, c.node().type.name, c.node().attrs),
|
|
1259
1259
|
...t
|
|
1260
1260
|
}, l = s.contentMatch.defaultType?.createAndFill(a) || void 0;
|
|
1261
1261
|
e = e.append(w.from(s.createAndFill(null, l) || void 0));
|
|
@@ -1270,10 +1270,10 @@ var Dn = ({ keepMarks: e = !0 } = {}) => ({ tr: r, state: i, dispatch: a, editor
|
|
|
1270
1270
|
return !0;
|
|
1271
1271
|
}
|
|
1272
1272
|
let m = l.pos === c.end() ? d.contentMatchAt(0).defaultType : null, h = {
|
|
1273
|
-
...
|
|
1273
|
+
...W(p, d.type.name, d.attrs),
|
|
1274
1274
|
...t
|
|
1275
1275
|
}, g = {
|
|
1276
|
-
...
|
|
1276
|
+
...W(p, c.node().type.name, c.node().attrs),
|
|
1277
1277
|
...t
|
|
1278
1278
|
}, _ = c.parentOffset === 0 && c.index(-1) === 0, v = c.before(-1);
|
|
1279
1279
|
n.delete(c.pos, l.pos);
|
|
@@ -1296,65 +1296,65 @@ var Dn = ({ keepMarks: e = !0 } = {}) => ({ tr: r, state: i, dispatch: a, editor
|
|
|
1296
1296
|
}
|
|
1297
1297
|
return !0;
|
|
1298
1298
|
};
|
|
1299
|
-
function
|
|
1299
|
+
function An(e) {
|
|
1300
1300
|
return !e || e === "1" ? null : e;
|
|
1301
1301
|
}
|
|
1302
|
-
function
|
|
1303
|
-
return
|
|
1302
|
+
function jn(e, t) {
|
|
1303
|
+
return An(e) === An(t);
|
|
1304
1304
|
}
|
|
1305
|
-
var
|
|
1306
|
-
let n =
|
|
1305
|
+
var Mn = (e, t) => {
|
|
1306
|
+
let n = L((e) => e.type === t)(e.selection);
|
|
1307
1307
|
if (!n) return !0;
|
|
1308
1308
|
let r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
|
|
1309
1309
|
if (r === void 0) return !0;
|
|
1310
1310
|
let i = e.doc.nodeAt(r);
|
|
1311
|
-
return !(n.node.type === i?.type && d(e.doc, n.pos)) || !
|
|
1312
|
-
},
|
|
1313
|
-
let n =
|
|
1311
|
+
return !(n.node.type === i?.type && d(e.doc, n.pos)) || !jn(n.node.attrs.type, i?.attrs.type) || e.join(n.pos), !0;
|
|
1312
|
+
}, Nn = (e, t) => {
|
|
1313
|
+
let n = L((e) => e.type === t)(e.selection);
|
|
1314
1314
|
if (!n) return !0;
|
|
1315
1315
|
let r = e.doc.resolve(n.start).after(n.depth);
|
|
1316
1316
|
if (r === void 0) return !0;
|
|
1317
1317
|
let i = e.doc.nodeAt(r);
|
|
1318
|
-
return !(n.node.type === i?.type && d(e.doc, r)) || !
|
|
1318
|
+
return !(n.node.type === i?.type && d(e.doc, r)) || !jn(n.node.attrs.type, i?.attrs.type) || e.join(r), !0;
|
|
1319
1319
|
};
|
|
1320
|
-
function
|
|
1320
|
+
function Pn(e) {
|
|
1321
1321
|
let t = e.doc, n = t.firstChild;
|
|
1322
1322
|
if (!n) return null;
|
|
1323
1323
|
let r = t.resolve(1), i = t.resolve(n.nodeSize - 1);
|
|
1324
1324
|
return o.between(r, i);
|
|
1325
1325
|
}
|
|
1326
|
-
var
|
|
1326
|
+
var Fn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain: c, commands: l, can: u }) => {
|
|
1327
1327
|
let { extensions: d, splittableMarks: f } = i.extensionManager, p = O(e, o.schema), m = O(t, o.schema), { selection: h, storedMarks: g } = o, { $from: _, $to: v } = h, y = _.blockRange(v), b = g || h.$to.parentOffset && h.$from.marks();
|
|
1328
1328
|
if (!y) return !1;
|
|
1329
|
-
let x =
|
|
1329
|
+
let x = L((e) => pn(e.type.name, d))(h), ee = h.from === 0 && h.to === o.doc.content.size, te = o.doc.content.content, S = te.length === 1 ? te[0] : null, ne = ee && S && pn(S.type.name, d) ? {
|
|
1330
1330
|
node: S,
|
|
1331
1331
|
pos: 0,
|
|
1332
1332
|
depth: 0
|
|
1333
1333
|
} : null, C = x ?? ne, re = !!x && y.depth >= 1 && y.depth - x.depth <= 1, ie = !!ne;
|
|
1334
1334
|
if ((re || ie) && C) {
|
|
1335
1335
|
if (C.node.type === p) return ee && ie ? c().command(({ tr: e, dispatch: t }) => {
|
|
1336
|
-
let n =
|
|
1336
|
+
let n = Pn(e);
|
|
1337
1337
|
return n ? (e.setSelection(n), t && t(e), !0) : !1;
|
|
1338
1338
|
}).liftListItem(m).run() : l.liftListItem(m);
|
|
1339
|
-
if (
|
|
1339
|
+
if (pn(C.node.type.name, d) && p.validContent(C.node.content)) return c().command(() => (a.setNodeMarkup(C.pos, p), !0)).command(() => Mn(a, p)).command(() => Nn(a, p)).run();
|
|
1340
1340
|
}
|
|
1341
|
-
return !n || !b || !s ? c().command(() => u().wrapInList(p, r) ? !0 : l.clearNodes()).wrapInList(p, r).command(() =>
|
|
1341
|
+
return !n || !b || !s ? c().command(() => u().wrapInList(p, r) ? !0 : l.clearNodes()).wrapInList(p, r).command(() => Mn(a, p)).command(() => Nn(a, p)).run() : c().command(() => {
|
|
1342
1342
|
let e = u().wrapInList(p, r), t = b.filter((e) => f.includes(e.type.name));
|
|
1343
1343
|
return a.ensureMarks(t), e ? !0 : l.clearNodes();
|
|
1344
|
-
}).wrapInList(p, r).command(() =>
|
|
1345
|
-
},
|
|
1344
|
+
}).wrapInList(p, r).command(() => Mn(a, p)).command(() => Nn(a, p)).run();
|
|
1345
|
+
}, In = (e, t = {}, n = {}) => ({ state: r, commands: i }) => {
|
|
1346
1346
|
let { extendEmptyMarkRange: a = !1 } = n, o = A(e, r.schema);
|
|
1347
|
-
return
|
|
1348
|
-
},
|
|
1349
|
-
let a = O(e, r.schema), o = O(t, r.schema), s =
|
|
1347
|
+
return cn(r, o, t) ? i.unsetMark(o, { extendEmptyMarkRange: a }) : i.setMark(o, t);
|
|
1348
|
+
}, Ln = (e, t, n = {}) => ({ state: r, commands: i }) => {
|
|
1349
|
+
let a = O(e, r.schema), o = O(t, r.schema), s = F(r, a, n), c;
|
|
1350
1350
|
return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), s ? i.setNode(o, c) : i.setNode(a, {
|
|
1351
1351
|
...c,
|
|
1352
1352
|
...n
|
|
1353
1353
|
});
|
|
1354
|
-
},
|
|
1354
|
+
}, Rn = (e, t = {}) => ({ state: n, commands: r }) => {
|
|
1355
1355
|
let i = O(e, n.schema);
|
|
1356
|
-
return
|
|
1357
|
-
},
|
|
1356
|
+
return F(n, i, t) ? r.lift(i) : r.wrapIn(i, t);
|
|
1357
|
+
}, zn = () => ({ state: e, dispatch: t }) => {
|
|
1358
1358
|
let n = e.plugins;
|
|
1359
1359
|
for (let r = 0; r < n.length; r += 1) {
|
|
1360
1360
|
let i = n[r], a;
|
|
@@ -1371,7 +1371,7 @@ var Pn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1371
1371
|
}
|
|
1372
1372
|
}
|
|
1373
1373
|
return !1;
|
|
1374
|
-
},
|
|
1374
|
+
}, Bn = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
|
|
1375
1375
|
let { ignoreClearable: i = !1 } = e, { selection: a } = t, { empty: o, ranges: s } = a;
|
|
1376
1376
|
if (o) return !0;
|
|
1377
1377
|
let { nonClearableMarks: c } = r.extensionManager;
|
|
@@ -1382,7 +1382,7 @@ var Pn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1382
1382
|
});
|
|
1383
1383
|
}
|
|
1384
1384
|
return !0;
|
|
1385
|
-
},
|
|
1385
|
+
}, Vn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1386
1386
|
let { extendEmptyMarkRange: a = !1 } = t, { selection: o } = n, s = A(e, r.schema), { $from: c, empty: l, ranges: u } = o;
|
|
1387
1387
|
if (!i) return !0;
|
|
1388
1388
|
if (l && a) {
|
|
@@ -1392,15 +1392,15 @@ var Pn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1392
1392
|
n.removeMark(e.$from.pos, e.$to.pos, s);
|
|
1393
1393
|
});
|
|
1394
1394
|
return n.removeStoredMark(s), !0;
|
|
1395
|
-
},
|
|
1395
|
+
}, Hn = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
1396
1396
|
let { selection: i } = n, a, o;
|
|
1397
1397
|
return typeof e == "number" ? (a = e, o = e) : e && "from" in e && "to" in e ? (a = e.from, o = e.to) : (a = i.from, o = i.to), r && t.doc.nodesBetween(a, o, (e, n) => {
|
|
1398
1398
|
if (e.isText) return;
|
|
1399
1399
|
let r = { ...e.attrs };
|
|
1400
1400
|
delete r.dir, t.setNodeMarkup(n, void 0, r);
|
|
1401
1401
|
}), !0;
|
|
1402
|
-
},
|
|
1403
|
-
let a = null, o = null, s =
|
|
1402
|
+
}, Un = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1403
|
+
let a = null, o = null, s = I(typeof e == "string" ? e : e.name, r.schema);
|
|
1404
1404
|
if (!s) return !1;
|
|
1405
1405
|
s === "node" && (a = O(e, r.schema)), s === "mark" && (o = A(e, r.schema));
|
|
1406
1406
|
let c = !1;
|
|
@@ -1431,16 +1431,16 @@ var Pn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1431
1431
|
}));
|
|
1432
1432
|
}));
|
|
1433
1433
|
}), c;
|
|
1434
|
-
},
|
|
1434
|
+
}, K = new i("__tiptap_decorations__"), Wn = (e) => ({ tr: t, dispatch: n }) => (n && t.setMeta(K, {
|
|
1435
1435
|
type: "force",
|
|
1436
1436
|
name: e
|
|
1437
|
-
}), !0),
|
|
1437
|
+
}), !0), Gn = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1438
1438
|
let i = O(e, n.schema);
|
|
1439
1439
|
return le(i, t)(n, r);
|
|
1440
|
-
},
|
|
1440
|
+
}, Kn = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1441
1441
|
let i = O(e, n.schema);
|
|
1442
1442
|
return ge(i, t)(n, r);
|
|
1443
|
-
},
|
|
1443
|
+
}, qn = /* @__PURE__ */ xe({
|
|
1444
1444
|
blur: () => Se,
|
|
1445
1445
|
clearContent: () => Ce,
|
|
1446
1446
|
clearNodes: () => we,
|
|
@@ -1455,68 +1455,68 @@ var Pn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1455
1455
|
exitCode: () => Ie,
|
|
1456
1456
|
extendMarkRange: () => Ve,
|
|
1457
1457
|
first: () => He,
|
|
1458
|
-
focus: () =>
|
|
1459
|
-
forEach: () =>
|
|
1460
|
-
insertContent: () =>
|
|
1461
|
-
insertContentAt: () =>
|
|
1462
|
-
insertDefaultBlock: () =>
|
|
1463
|
-
joinBackward: () =>
|
|
1464
|
-
joinDown: () =>
|
|
1465
|
-
joinForward: () =>
|
|
1466
|
-
joinItemBackward: () =>
|
|
1467
|
-
joinItemForward: () =>
|
|
1468
|
-
joinTextblockBackward: () =>
|
|
1469
|
-
joinTextblockForward: () =>
|
|
1470
|
-
joinUp: () =>
|
|
1471
|
-
keyboardShortcut: () =>
|
|
1472
|
-
lift: () =>
|
|
1473
|
-
liftEmptyBlock: () =>
|
|
1474
|
-
liftListItem: () =>
|
|
1475
|
-
newlineInCode: () =>
|
|
1476
|
-
resetAttributes: () =>
|
|
1477
|
-
scrollIntoView: () =>
|
|
1478
|
-
selectAll: () =>
|
|
1479
|
-
selectNodeBackward: () =>
|
|
1480
|
-
selectNodeForward: () =>
|
|
1481
|
-
selectParentNode: () =>
|
|
1482
|
-
selectTextblockEnd: () =>
|
|
1483
|
-
selectTextblockStart: () =>
|
|
1484
|
-
setContent: () =>
|
|
1485
|
-
setMark: () =>
|
|
1486
|
-
setMeta: () =>
|
|
1487
|
-
setNode: () =>
|
|
1488
|
-
setNodeSelection: () =>
|
|
1489
|
-
setTextDirection: () =>
|
|
1490
|
-
setTextSelection: () =>
|
|
1491
|
-
sinkListItem: () =>
|
|
1492
|
-
splitBlock: () =>
|
|
1493
|
-
splitListItem: () =>
|
|
1494
|
-
toggleList: () =>
|
|
1495
|
-
toggleMark: () =>
|
|
1496
|
-
toggleNode: () =>
|
|
1497
|
-
toggleWrap: () =>
|
|
1498
|
-
undoInputRule: () =>
|
|
1499
|
-
unsetAllMarks: () =>
|
|
1500
|
-
unsetMark: () =>
|
|
1501
|
-
unsetTextDirection: () =>
|
|
1502
|
-
updateAttributes: () =>
|
|
1503
|
-
updateDecorations: () =>
|
|
1504
|
-
wrapIn: () =>
|
|
1505
|
-
wrapInList: () =>
|
|
1506
|
-
}),
|
|
1507
|
-
function
|
|
1508
|
-
|
|
1458
|
+
focus: () => qe,
|
|
1459
|
+
forEach: () => Je,
|
|
1460
|
+
insertContent: () => Ye,
|
|
1461
|
+
insertContentAt: () => et,
|
|
1462
|
+
insertDefaultBlock: () => nt,
|
|
1463
|
+
joinBackward: () => at,
|
|
1464
|
+
joinDown: () => it,
|
|
1465
|
+
joinForward: () => ot,
|
|
1466
|
+
joinItemBackward: () => ct,
|
|
1467
|
+
joinItemForward: () => lt,
|
|
1468
|
+
joinTextblockBackward: () => ut,
|
|
1469
|
+
joinTextblockForward: () => dt,
|
|
1470
|
+
joinUp: () => rt,
|
|
1471
|
+
keyboardShortcut: () => mt,
|
|
1472
|
+
lift: () => ht,
|
|
1473
|
+
liftEmptyBlock: () => gt,
|
|
1474
|
+
liftListItem: () => _t,
|
|
1475
|
+
newlineInCode: () => vt,
|
|
1476
|
+
resetAttributes: () => bt,
|
|
1477
|
+
scrollIntoView: () => xt,
|
|
1478
|
+
selectAll: () => St,
|
|
1479
|
+
selectNodeBackward: () => Ct,
|
|
1480
|
+
selectNodeForward: () => wt,
|
|
1481
|
+
selectParentNode: () => Tt,
|
|
1482
|
+
selectTextblockEnd: () => Et,
|
|
1483
|
+
selectTextblockStart: () => Dt,
|
|
1484
|
+
setContent: () => kt,
|
|
1485
|
+
setMark: () => bn,
|
|
1486
|
+
setMeta: () => xn,
|
|
1487
|
+
setNode: () => Sn,
|
|
1488
|
+
setNodeSelection: () => Cn,
|
|
1489
|
+
setTextDirection: () => wn,
|
|
1490
|
+
setTextSelection: () => Tn,
|
|
1491
|
+
sinkListItem: () => En,
|
|
1492
|
+
splitBlock: () => On,
|
|
1493
|
+
splitListItem: () => kn,
|
|
1494
|
+
toggleList: () => Fn,
|
|
1495
|
+
toggleMark: () => In,
|
|
1496
|
+
toggleNode: () => Ln,
|
|
1497
|
+
toggleWrap: () => Rn,
|
|
1498
|
+
undoInputRule: () => zn,
|
|
1499
|
+
unsetAllMarks: () => Bn,
|
|
1500
|
+
unsetMark: () => Vn,
|
|
1501
|
+
unsetTextDirection: () => Hn,
|
|
1502
|
+
updateAttributes: () => Un,
|
|
1503
|
+
updateDecorations: () => Wn,
|
|
1504
|
+
wrapIn: () => Gn,
|
|
1505
|
+
wrapInList: () => Kn
|
|
1506
|
+
}), q = /* @__PURE__ */ new WeakMap();
|
|
1507
|
+
function Jn(e, t) {
|
|
1508
|
+
q.set(e, (q.get(e) ?? 0) + 1);
|
|
1509
1509
|
try {
|
|
1510
1510
|
return t();
|
|
1511
1511
|
} finally {
|
|
1512
|
-
let t = (
|
|
1513
|
-
t > 0 ?
|
|
1512
|
+
let t = (q.get(e) ?? 1) - 1;
|
|
1513
|
+
t > 0 ? q.set(e, t) : q.delete(e);
|
|
1514
1514
|
}
|
|
1515
1515
|
}
|
|
1516
|
-
function
|
|
1517
|
-
return
|
|
1516
|
+
function Yn(e) {
|
|
1517
|
+
return q.has(e);
|
|
1518
1518
|
}
|
|
1519
|
-
var
|
|
1519
|
+
var Xn = class {
|
|
1520
1520
|
constructor() {
|
|
1521
1521
|
this.callbacks = {};
|
|
1522
1522
|
}
|
|
@@ -1540,44 +1540,44 @@ var Yn = class {
|
|
|
1540
1540
|
removeAllListeners() {
|
|
1541
1541
|
this.callbacks = {};
|
|
1542
1542
|
}
|
|
1543
|
-
},
|
|
1544
|
-
function
|
|
1543
|
+
}, Zn = typeof process < "u" && process.env.NODE_ENV !== "production";
|
|
1544
|
+
function Qn(e) {
|
|
1545
1545
|
return e.kind === "widget";
|
|
1546
1546
|
}
|
|
1547
|
-
function
|
|
1547
|
+
function $n(e, t) {
|
|
1548
1548
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
1549
|
-
for (let i of e) i.kind === "widget" &&
|
|
1549
|
+
for (let i of e) i.kind === "widget" && Qn(i) && r.add(i.key), n.push(i.toPMDecoration(t));
|
|
1550
1550
|
return {
|
|
1551
1551
|
decorations: n,
|
|
1552
1552
|
widgetKeys: r
|
|
1553
1553
|
};
|
|
1554
1554
|
}
|
|
1555
|
-
function
|
|
1556
|
-
let { decorations: r, widgetKeys: i } =
|
|
1555
|
+
function er(e, t, n) {
|
|
1556
|
+
let { decorations: r, widgetKeys: i } = $n(t, n);
|
|
1557
1557
|
return {
|
|
1558
1558
|
set: T.create(e, r),
|
|
1559
1559
|
widgetKeys: i
|
|
1560
1560
|
};
|
|
1561
1561
|
}
|
|
1562
|
-
function
|
|
1562
|
+
function tr({ position: e, from: t, to: n, docSize: r }) {
|
|
1563
1563
|
return e < t ? !1 : e < n || e === n && n === r;
|
|
1564
1564
|
}
|
|
1565
|
-
function
|
|
1566
|
-
return e.filter((e) =>
|
|
1565
|
+
function nr({ decorations: e, from: t, to: n, docSize: r, extensionName: i, warnedExtensions: a }) {
|
|
1566
|
+
return e.filter((e) => tr({
|
|
1567
1567
|
position: e.anchor,
|
|
1568
1568
|
from: t,
|
|
1569
1569
|
to: n,
|
|
1570
1570
|
docSize: r
|
|
1571
1571
|
}) ? !0 : (e.anchor === n || a.has(i) || (a.add(i), console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)), !1));
|
|
1572
1572
|
}
|
|
1573
|
-
function
|
|
1573
|
+
function rr(e) {
|
|
1574
1574
|
let t = e.spec?.key;
|
|
1575
1575
|
return typeof t == "string" ? t : void 0;
|
|
1576
1576
|
}
|
|
1577
|
-
function
|
|
1577
|
+
function ir(e) {
|
|
1578
1578
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
1579
1579
|
for (let r of e.find()) {
|
|
1580
|
-
let e =
|
|
1580
|
+
let e = rr(r);
|
|
1581
1581
|
if (!e) continue;
|
|
1582
1582
|
let i = r.spec.extensionName ?? "unknown", a = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
1583
1583
|
a.add(i), t.set(e, a), n.set(e, (n.get(e) ?? 0) + 1);
|
|
@@ -1587,18 +1587,18 @@ function rr(e) {
|
|
|
1587
1587
|
extensions: t
|
|
1588
1588
|
})).filter(({ key: e }) => (n.get(e) ?? 0) > 1);
|
|
1589
1589
|
}
|
|
1590
|
-
function
|
|
1590
|
+
function ar(e) {
|
|
1591
1591
|
return e.jsonID === "attr";
|
|
1592
1592
|
}
|
|
1593
|
-
function
|
|
1593
|
+
function or(e) {
|
|
1594
1594
|
let t = !1;
|
|
1595
1595
|
if (e.getMap().forEach(() => {
|
|
1596
1596
|
t = !0;
|
|
1597
|
-
}), t ||
|
|
1597
|
+
}), t || ar(e)) return !0;
|
|
1598
1598
|
let n = e;
|
|
1599
1599
|
return typeof n.from == "number" && typeof n.to == "number";
|
|
1600
1600
|
}
|
|
1601
|
-
function
|
|
1601
|
+
function sr(e, t) {
|
|
1602
1602
|
let n = null, r = 0, i = 0;
|
|
1603
1603
|
for (let a = 0; a < e.childCount && !(i > t.to); a += 1) {
|
|
1604
1604
|
let o = i + e.child(a).nodeSize;
|
|
@@ -1609,11 +1609,11 @@ function or(e, t) {
|
|
|
1609
1609
|
to: r
|
|
1610
1610
|
};
|
|
1611
1611
|
}
|
|
1612
|
-
function
|
|
1613
|
-
if (e.steps.some((e) => !
|
|
1614
|
-
let n =
|
|
1612
|
+
function cr(e, t) {
|
|
1613
|
+
if (e.steps.some((e) => !or(e))) return { type: "full" };
|
|
1614
|
+
let n = nn(e).map(({ newRange: e }) => e);
|
|
1615
1615
|
e.steps.forEach((t, r) => {
|
|
1616
|
-
if (!
|
|
1616
|
+
if (!ar(t)) return;
|
|
1617
1617
|
let i = e.mapping.slice(r);
|
|
1618
1618
|
n.push({
|
|
1619
1619
|
from: i.map(t.pos, -1),
|
|
@@ -1622,7 +1622,7 @@ function sr(e, t) {
|
|
|
1622
1622
|
});
|
|
1623
1623
|
let r = [];
|
|
1624
1624
|
for (let e of n) {
|
|
1625
|
-
let n =
|
|
1625
|
+
let n = sr(t, e);
|
|
1626
1626
|
n && r.push(n);
|
|
1627
1627
|
}
|
|
1628
1628
|
r.sort((e, t) => e.from - t.from);
|
|
@@ -1636,29 +1636,29 @@ function sr(e, t) {
|
|
|
1636
1636
|
ranges: i
|
|
1637
1637
|
};
|
|
1638
1638
|
}
|
|
1639
|
-
function
|
|
1639
|
+
function lr(e, t, n, r) {
|
|
1640
1640
|
return e.map(t, n, { onRemove: (e) => {
|
|
1641
1641
|
let t = e?.key;
|
|
1642
1642
|
typeof t == "string" && r.delete(t);
|
|
1643
1643
|
} });
|
|
1644
1644
|
}
|
|
1645
|
-
function
|
|
1645
|
+
function ur(e, t, n) {
|
|
1646
1646
|
let r = t.decorationSetsByExtension[e] ?? T.empty, i = new Set(t.widgetKeysByExtension[e] ?? []);
|
|
1647
1647
|
return {
|
|
1648
|
-
set:
|
|
1648
|
+
set: lr(r, n.mapping, n.doc, i),
|
|
1649
1649
|
widgetKeys: i
|
|
1650
1650
|
};
|
|
1651
1651
|
}
|
|
1652
|
-
function
|
|
1652
|
+
function dr(e, t) {
|
|
1653
1653
|
let n = Object.values(t).flatMap((e) => e.find());
|
|
1654
1654
|
return T.create(e, n);
|
|
1655
1655
|
}
|
|
1656
|
-
function
|
|
1656
|
+
function fr(e) {
|
|
1657
1657
|
let t = /* @__PURE__ */ new Set();
|
|
1658
1658
|
for (let n of Object.values(e)) for (let e of n) t.add(e);
|
|
1659
1659
|
return t;
|
|
1660
1660
|
}
|
|
1661
|
-
function
|
|
1661
|
+
function pr(e, t) {
|
|
1662
1662
|
switch (t.update ?? "document") {
|
|
1663
1663
|
case "document":
|
|
1664
1664
|
if (t.createInRange) throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);
|
|
@@ -1673,21 +1673,21 @@ function fr(e, t) {
|
|
|
1673
1673
|
default: throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`);
|
|
1674
1674
|
}
|
|
1675
1675
|
}
|
|
1676
|
-
function
|
|
1676
|
+
function mr(e, t, n) {
|
|
1677
1677
|
return n ? !0 : e.update === "manual" ? !1 : e.shouldUpdate ? e.shouldUpdate(t) : t.tr.docChanged;
|
|
1678
1678
|
}
|
|
1679
|
-
var
|
|
1679
|
+
var hr = /* @__PURE__ */ new Set(), gr = class {
|
|
1680
1680
|
constructor(e) {
|
|
1681
1681
|
this.warnedWidgetKeys = /* @__PURE__ */ new Set(), this.warnedOutOfRangeExtensions = /* @__PURE__ */ new Set(), this.handleBeforeTransaction = ({ nextState: e }) => {
|
|
1682
|
-
let t =
|
|
1682
|
+
let t = K.getState(e);
|
|
1683
1683
|
t && this.warnDuplicateWidgetKeys(t);
|
|
1684
|
-
}, this.editor = e.editor, this.entries = this.resolveEntries(e.entries), this.entries.forEach(({ name: e, spec: t }) =>
|
|
1684
|
+
}, this.editor = e.editor, this.entries = this.resolveEntries(e.entries), this.entries.forEach(({ name: e, spec: t }) => pr(e, t)), this.plugin = this.entries.length > 0 ? this.createPlugin() : null, this.editor.on("beforeTransaction", this.handleBeforeTransaction);
|
|
1685
1685
|
}
|
|
1686
1686
|
destroy() {
|
|
1687
1687
|
this.editor.off("beforeTransaction", this.handleBeforeTransaction);
|
|
1688
1688
|
}
|
|
1689
1689
|
liveWidgetKeys() {
|
|
1690
|
-
return
|
|
1690
|
+
return K.getState(this.editor.state)?.widgetKeys ?? hr;
|
|
1691
1691
|
}
|
|
1692
1692
|
get mountedView() {
|
|
1693
1693
|
return this.editor.isDestroyed ? null : this.editor.view;
|
|
@@ -1706,7 +1706,7 @@ var mr = /* @__PURE__ */ new Set(), hr = class {
|
|
|
1706
1706
|
createPlugin() {
|
|
1707
1707
|
let { editor: e, entries: t } = this;
|
|
1708
1708
|
return new r({
|
|
1709
|
-
key:
|
|
1709
|
+
key: K,
|
|
1710
1710
|
state: {
|
|
1711
1711
|
init: (e, n) => {
|
|
1712
1712
|
let r = {}, i = {};
|
|
@@ -1718,22 +1718,22 @@ var mr = /* @__PURE__ */ new Set(), hr = class {
|
|
|
1718
1718
|
decorationSetsByExtension: r,
|
|
1719
1719
|
widgetKeysByExtension: i,
|
|
1720
1720
|
mergedDecorationSet: this.buildMergedSet(n.doc, r),
|
|
1721
|
-
widgetKeys:
|
|
1721
|
+
widgetKeys: fr(i)
|
|
1722
1722
|
};
|
|
1723
1723
|
return this.warnDuplicateWidgetKeys(a), a;
|
|
1724
1724
|
},
|
|
1725
1725
|
apply: (n, r, i, a) => {
|
|
1726
|
-
let o = n.getMeta(
|
|
1727
|
-
return
|
|
1726
|
+
let o = n.getMeta(K), s = o?.type === "force" && !o.name, c = o?.type === "force" ? o.name : void 0, l = {}, u = {}, d = /* @__PURE__ */ new Set();
|
|
1727
|
+
return Jn(e, () => {
|
|
1728
1728
|
for (let { name: o, spec: f } of t) {
|
|
1729
1729
|
let t = s || c === o;
|
|
1730
|
-
if (!
|
|
1730
|
+
if (!mr(f, {
|
|
1731
1731
|
editor: e,
|
|
1732
1732
|
tr: n,
|
|
1733
1733
|
oldState: i,
|
|
1734
1734
|
newState: a
|
|
1735
1735
|
}, t)) {
|
|
1736
|
-
let e =
|
|
1736
|
+
let e = ur(o, r, n);
|
|
1737
1737
|
l[o] = e.set, u[o] = e.widgetKeys;
|
|
1738
1738
|
} else if (f.update === "changedRanges" && n.docChanged && !t) {
|
|
1739
1739
|
let e = this.applyChangedRangesRecompute(o, f, r, n, a);
|
|
@@ -1753,34 +1753,34 @@ var mr = /* @__PURE__ */ new Set(), hr = class {
|
|
|
1753
1753
|
decorationSetsByExtension: l,
|
|
1754
1754
|
recomputedNames: d
|
|
1755
1755
|
}),
|
|
1756
|
-
widgetKeys:
|
|
1756
|
+
widgetKeys: fr(u)
|
|
1757
1757
|
};
|
|
1758
1758
|
}
|
|
1759
1759
|
},
|
|
1760
1760
|
props: { decorations(e) {
|
|
1761
|
-
return
|
|
1761
|
+
return K.getState(e)?.mergedDecorationSet ?? T.empty;
|
|
1762
1762
|
} }
|
|
1763
1763
|
});
|
|
1764
1764
|
}
|
|
1765
1765
|
applyChangedRangesRecompute(e, t, n, r, i) {
|
|
1766
|
-
let a =
|
|
1766
|
+
let a = cr(r, i.doc);
|
|
1767
1767
|
return a.type === "full" ? this.buildFullSet(e, t, i) : this.rebuildRanges(e, t, n, r, i, a.ranges);
|
|
1768
1768
|
}
|
|
1769
1769
|
rebuildRanges(e, t, n, r, i, a) {
|
|
1770
|
-
let o = n.decorationSetsByExtension[e] ?? T.empty, s = new Set(n.widgetKeysByExtension[e] ?? []), c =
|
|
1770
|
+
let o = n.decorationSetsByExtension[e] ?? T.empty, s = new Set(n.widgetKeysByExtension[e] ?? []), c = lr(o, r.mapping, r.doc, s), l = i.doc.content.size;
|
|
1771
1771
|
for (let { from: n, to: r } of a) {
|
|
1772
|
-
let a = c.find(n, r).filter((e) =>
|
|
1772
|
+
let a = c.find(n, r).filter((e) => tr({
|
|
1773
1773
|
position: e.from,
|
|
1774
1774
|
from: n,
|
|
1775
1775
|
to: r,
|
|
1776
1776
|
docSize: l
|
|
1777
1777
|
}));
|
|
1778
1778
|
for (let e of a) {
|
|
1779
|
-
let t =
|
|
1779
|
+
let t = rr(e);
|
|
1780
1780
|
t && s.delete(t);
|
|
1781
1781
|
}
|
|
1782
1782
|
c = c.remove(a);
|
|
1783
|
-
let { decorations: o, widgetKeys: u } =
|
|
1783
|
+
let { decorations: o, widgetKeys: u } = $n(nr({
|
|
1784
1784
|
decorations: this.runCreate(e, "createInRange", () => t.createInRange({
|
|
1785
1785
|
editor: this.editor,
|
|
1786
1786
|
state: i,
|
|
@@ -1808,7 +1808,7 @@ var mr = /* @__PURE__ */ new Set(), hr = class {
|
|
|
1808
1808
|
state: n,
|
|
1809
1809
|
view: this.mountedView
|
|
1810
1810
|
}));
|
|
1811
|
-
return
|
|
1811
|
+
return er(n.doc, r, e);
|
|
1812
1812
|
}
|
|
1813
1813
|
runCreate(e, t, n) {
|
|
1814
1814
|
try {
|
|
@@ -1818,12 +1818,12 @@ var mr = /* @__PURE__ */ new Set(), hr = class {
|
|
|
1818
1818
|
}
|
|
1819
1819
|
}
|
|
1820
1820
|
warnDuplicateWidgetKeys(e) {
|
|
1821
|
-
if (!
|
|
1821
|
+
if (!Zn) return;
|
|
1822
1822
|
if (e.widgetKeys.size === 0) {
|
|
1823
1823
|
this.warnedWidgetKeys.clear();
|
|
1824
1824
|
return;
|
|
1825
1825
|
}
|
|
1826
|
-
let t =
|
|
1826
|
+
let t = ir(e.mergedDecorationSet), n = new Set(t.map(({ key: e }) => e));
|
|
1827
1827
|
for (let { key: e, extensions: n } of t) {
|
|
1828
1828
|
if (this.warnedWidgetKeys.has(e)) continue;
|
|
1829
1829
|
let t = Array.from(n).map((e) => `"${e}"`).join(", ");
|
|
@@ -1833,13 +1833,13 @@ var mr = /* @__PURE__ */ new Set(), hr = class {
|
|
|
1833
1833
|
}
|
|
1834
1834
|
buildMergedSet(e, t) {
|
|
1835
1835
|
let n = Object.keys(t);
|
|
1836
|
-
return n.length === 1 ? t[n[0]] :
|
|
1836
|
+
return n.length === 1 ? t[n[0]] : dr(e, t);
|
|
1837
1837
|
}
|
|
1838
1838
|
mergeAfterApply({ entries: e, previous: t, tr: n, decorationSetsByExtension: r, recomputedNames: i }) {
|
|
1839
|
-
return e.length === 1 ? r[e[0].name] : i.size === 0 ? t.mergedDecorationSet.map(n.mapping, n.doc) :
|
|
1839
|
+
return e.length === 1 ? r[e[0].name] : i.size === 0 ? t.mergedDecorationSet.map(n.mapping, n.doc) : dr(n.doc, r);
|
|
1840
1840
|
}
|
|
1841
1841
|
};
|
|
1842
|
-
function
|
|
1842
|
+
function _r(e, t) {
|
|
1843
1843
|
let { selection: r } = e, { $from: i } = r;
|
|
1844
1844
|
if (r instanceof n) {
|
|
1845
1845
|
let e = i.index();
|
|
@@ -1853,16 +1853,16 @@ function gr(e, t) {
|
|
|
1853
1853
|
}
|
|
1854
1854
|
return !1;
|
|
1855
1855
|
}
|
|
1856
|
-
function
|
|
1856
|
+
function vr(e, t, n) {
|
|
1857
1857
|
let r = document.querySelector(`style[data-tiptap-style${n ? `-${n}` : ""}]`);
|
|
1858
1858
|
if (r !== null) return r;
|
|
1859
1859
|
let i = document.createElement("style");
|
|
1860
1860
|
return t && i.setAttribute("nonce", t), i.setAttribute(`data-tiptap-style${n ? `-${n}` : ""}`, ""), i.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(i), i;
|
|
1861
1861
|
}
|
|
1862
|
-
function
|
|
1862
|
+
function yr(e) {
|
|
1863
1863
|
return e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
1864
1864
|
}
|
|
1865
|
-
function
|
|
1865
|
+
function br(e, t) {
|
|
1866
1866
|
let n = e.getAttribute("style");
|
|
1867
1867
|
if (!n) return null;
|
|
1868
1868
|
let r = n.split(";").map((e) => e.trim()).filter(Boolean), i = t.toLowerCase();
|
|
@@ -1872,22 +1872,22 @@ function yr(e, t) {
|
|
|
1872
1872
|
}
|
|
1873
1873
|
return null;
|
|
1874
1874
|
}
|
|
1875
|
-
function
|
|
1875
|
+
function xr() {
|
|
1876
1876
|
return typeof navigator < "u" && /Firefox/.test(navigator.userAgent);
|
|
1877
1877
|
}
|
|
1878
|
-
function
|
|
1878
|
+
function Sr(e) {
|
|
1879
1879
|
return typeof e == "number";
|
|
1880
1880
|
}
|
|
1881
|
-
function
|
|
1881
|
+
function Cr(e) {
|
|
1882
1882
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
1883
1883
|
}
|
|
1884
|
-
function
|
|
1885
|
-
return
|
|
1884
|
+
function J(e) {
|
|
1885
|
+
return Cr(e) === "Object" && e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
|
|
1886
1886
|
}
|
|
1887
|
-
function
|
|
1887
|
+
function wr(e) {
|
|
1888
1888
|
return typeof e == "string" && e.trim().length > 0 && !/[;{}]/.test(e);
|
|
1889
1889
|
}
|
|
1890
|
-
function
|
|
1890
|
+
function Tr(e, t, n) {
|
|
1891
1891
|
let r = e.split("\n"), i = [], a = "", o = 0, s = t.baseIndentSize || 2;
|
|
1892
1892
|
for (; o < r.length;) {
|
|
1893
1893
|
let e = r[o], u = e.match(t.itemPattern);
|
|
@@ -1931,13 +1931,13 @@ function wr(e, t, n) {
|
|
|
1931
1931
|
raw: a
|
|
1932
1932
|
};
|
|
1933
1933
|
}
|
|
1934
|
-
var
|
|
1935
|
-
function
|
|
1934
|
+
var Er = 4;
|
|
1935
|
+
function Dr(e) {
|
|
1936
1936
|
let t = 0;
|
|
1937
|
-
for (let n of e) t = n === " " ? t +
|
|
1937
|
+
for (let n of e) t = n === " " ? t + Er - t % Er : t + 1;
|
|
1938
1938
|
return t;
|
|
1939
1939
|
}
|
|
1940
|
-
function
|
|
1940
|
+
function Or(e, t, n, r, i) {
|
|
1941
1941
|
if (!e || !Array.isArray(e.content)) return "";
|
|
1942
1942
|
let a = typeof n == "function" ? n(r) : n, [o, ...s] = e.content, c = `${a}${t.renderChildren([o])}`;
|
|
1943
1943
|
return s && s.length > 0 && s.forEach((e, n) => {
|
|
@@ -1945,20 +1945,20 @@ function Dr(e, t, n, r, i) {
|
|
|
1945
1945
|
if (r != null) {
|
|
1946
1946
|
let n = (e) => {
|
|
1947
1947
|
if (!i?.alignNestedToPrefix) return t.indent(e);
|
|
1948
|
-
let n = t.indent(""), r =
|
|
1949
|
-
return (
|
|
1948
|
+
let n = t.indent(""), r = Dr(a);
|
|
1949
|
+
return (Dr(n) >= r ? n : " ".repeat(r)) + e;
|
|
1950
1950
|
}, o = r.split("\n").map((e) => n(e || "")).join("\n");
|
|
1951
1951
|
c += e.type === "paragraph" ? `\n\n${o}` : `\n${o}`;
|
|
1952
1952
|
}
|
|
1953
1953
|
}), c;
|
|
1954
1954
|
}
|
|
1955
|
-
function
|
|
1955
|
+
function kr(e, t) {
|
|
1956
1956
|
let n = { ...e };
|
|
1957
|
-
return
|
|
1958
|
-
|
|
1957
|
+
return J(e) && J(t) && Object.keys(t).forEach((r) => {
|
|
1958
|
+
J(t[r]) && J(e[r]) ? n[r] = kr(e[r], t[r]) : n[r] = t[r];
|
|
1959
1959
|
}), n;
|
|
1960
1960
|
}
|
|
1961
|
-
function
|
|
1961
|
+
function Ar(e, t, n = {}) {
|
|
1962
1962
|
let { state: r } = t, { doc: i, tr: a } = r, o = e;
|
|
1963
1963
|
i.descendants((t, r) => {
|
|
1964
1964
|
let i = a.mapping.map(r), s = a.mapping.map(r) + t.nodeSize, c = null;
|
|
@@ -1978,18 +1978,18 @@ function kr(e, t, n = {}) {
|
|
|
1978
1978
|
}
|
|
1979
1979
|
}), a.docChanged && t.view.dispatch(a);
|
|
1980
1980
|
}
|
|
1981
|
-
var
|
|
1981
|
+
var Y = class {
|
|
1982
1982
|
constructor(e) {
|
|
1983
1983
|
this.find = e.find, this.handler = e.handler, this.undoable = e.undoable ?? !0;
|
|
1984
1984
|
}
|
|
1985
|
-
},
|
|
1985
|
+
}, jr = (e, t) => {
|
|
1986
1986
|
if (Le(t)) return t.exec(e);
|
|
1987
1987
|
let n = t(e);
|
|
1988
1988
|
if (!n) return null;
|
|
1989
1989
|
let r = [n.text];
|
|
1990
1990
|
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;
|
|
1991
1991
|
};
|
|
1992
|
-
function
|
|
1992
|
+
function Mr(e) {
|
|
1993
1993
|
let { editor: n, from: r, to: i, text: a, insertText: o } = e;
|
|
1994
1994
|
if (!o) return {
|
|
1995
1995
|
inputTransaction: null,
|
|
@@ -2005,8 +2005,8 @@ function jr(e) {
|
|
|
2005
2005
|
}).tr
|
|
2006
2006
|
};
|
|
2007
2007
|
}
|
|
2008
|
-
function
|
|
2009
|
-
let { editor: t, from: n, to: r, text: i, rule: a, match: o, plugin: s, insertText: c } = e, { view: l } = t, { inputTransaction: u, tr: d } =
|
|
2008
|
+
function Nr(e) {
|
|
2009
|
+
let { editor: t, from: n, to: r, text: i, rule: a, match: o, plugin: s, insertText: c } = e, { view: l } = t, { inputTransaction: u, tr: d } = Mr({
|
|
2010
2010
|
editor: t,
|
|
2011
2011
|
from: n,
|
|
2012
2012
|
to: r,
|
|
@@ -2036,21 +2036,21 @@ function Mr(e) {
|
|
|
2036
2036
|
text: i
|
|
2037
2037
|
}), l.dispatch(d), !0);
|
|
2038
2038
|
}
|
|
2039
|
-
function
|
|
2039
|
+
function Pr(e, t, n) {
|
|
2040
2040
|
let r = t[0].length - n.length;
|
|
2041
2041
|
if (r <= 0) return !0;
|
|
2042
2042
|
let i = e.parentOffset - r;
|
|
2043
2043
|
return i >= 0 && e.parent.textBetween(i, e.parentOffset) === t[0].slice(0, r);
|
|
2044
2044
|
}
|
|
2045
|
-
function
|
|
2045
|
+
function X(e) {
|
|
2046
2046
|
let { editor: t, from: n, to: r, text: i, rules: a, plugin: o, insertText: s } = e, { view: c } = t;
|
|
2047
2047
|
if (c.composing) return !1;
|
|
2048
2048
|
let l = c.state.doc.resolve(n);
|
|
2049
2049
|
if (l.parent.type.spec.code || (l.nodeBefore || l.nodeAfter)?.marks.find((e) => e.type.spec.code)) return !1;
|
|
2050
|
-
let u =
|
|
2050
|
+
let u = sn(l) + i;
|
|
2051
2051
|
for (let e of a) {
|
|
2052
|
-
let a =
|
|
2053
|
-
if (a &&
|
|
2052
|
+
let a = jr(u, e.find);
|
|
2053
|
+
if (a && Pr(l, a, i) && Nr({
|
|
2054
2054
|
editor: t,
|
|
2055
2055
|
from: n,
|
|
2056
2056
|
to: r,
|
|
@@ -2063,7 +2063,7 @@ function Z(e) {
|
|
|
2063
2063
|
}
|
|
2064
2064
|
return !1;
|
|
2065
2065
|
}
|
|
2066
|
-
function
|
|
2066
|
+
function Fr(e) {
|
|
2067
2067
|
let { editor: t, rules: n } = e, i = new r({
|
|
2068
2068
|
state: {
|
|
2069
2069
|
init() {
|
|
@@ -2075,9 +2075,9 @@ function Pr(e) {
|
|
|
2075
2075
|
let s = e.getMeta("applyInputRules");
|
|
2076
2076
|
return s && setTimeout(() => {
|
|
2077
2077
|
let { text: e } = s;
|
|
2078
|
-
e = typeof e == "string" ? e :
|
|
2078
|
+
e = typeof e == "string" ? e : Ft(w.from(e), a.schema);
|
|
2079
2079
|
let { from: r } = s, o = r + e.length;
|
|
2080
|
-
|
|
2080
|
+
X({
|
|
2081
2081
|
editor: t,
|
|
2082
2082
|
from: r,
|
|
2083
2083
|
to: o,
|
|
@@ -2090,7 +2090,7 @@ function Pr(e) {
|
|
|
2090
2090
|
},
|
|
2091
2091
|
props: {
|
|
2092
2092
|
handleTextInput(e, r, a, o) {
|
|
2093
|
-
return
|
|
2093
|
+
return X({
|
|
2094
2094
|
editor: t,
|
|
2095
2095
|
from: r,
|
|
2096
2096
|
to: a,
|
|
@@ -2102,7 +2102,7 @@ function Pr(e) {
|
|
|
2102
2102
|
},
|
|
2103
2103
|
handleDOMEvents: { compositionend: (e) => (setTimeout(() => {
|
|
2104
2104
|
let { $cursor: r } = e.state.selection;
|
|
2105
|
-
r &&
|
|
2105
|
+
r && X({
|
|
2106
2106
|
editor: t,
|
|
2107
2107
|
from: r.pos,
|
|
2108
2108
|
to: r.pos,
|
|
@@ -2114,7 +2114,7 @@ function Pr(e) {
|
|
|
2114
2114
|
handleKeyDown(e, r) {
|
|
2115
2115
|
if (r.key !== "Enter") return !1;
|
|
2116
2116
|
let { $cursor: a } = e.state.selection;
|
|
2117
|
-
return a ?
|
|
2117
|
+
return a ? X({
|
|
2118
2118
|
editor: t,
|
|
2119
2119
|
from: a.pos,
|
|
2120
2120
|
to: a.pos,
|
|
@@ -2128,7 +2128,7 @@ function Pr(e) {
|
|
|
2128
2128
|
});
|
|
2129
2129
|
return i;
|
|
2130
2130
|
}
|
|
2131
|
-
var
|
|
2131
|
+
var Ir = class {
|
|
2132
2132
|
constructor(e = {}) {
|
|
2133
2133
|
this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = { name: this.name }, this.config = {
|
|
2134
2134
|
...this.config,
|
|
@@ -2136,10 +2136,10 @@ var Fr = class {
|
|
|
2136
2136
|
}, this.name = this.config.name;
|
|
2137
2137
|
}
|
|
2138
2138
|
get options() {
|
|
2139
|
-
return { ...
|
|
2139
|
+
return { ...z(R(this, "addOptions", { name: this.name })) };
|
|
2140
2140
|
}
|
|
2141
2141
|
get storage() {
|
|
2142
|
-
return { ...
|
|
2142
|
+
return { ...z(R(this, "addStorage", {
|
|
2143
2143
|
name: this.name,
|
|
2144
2144
|
options: this.options
|
|
2145
2145
|
})) };
|
|
@@ -2147,7 +2147,7 @@ var Fr = class {
|
|
|
2147
2147
|
configure(e = {}) {
|
|
2148
2148
|
let t = this.extend({
|
|
2149
2149
|
...this.config,
|
|
2150
|
-
addOptions: () =>
|
|
2150
|
+
addOptions: () => kr(this.options, e)
|
|
2151
2151
|
});
|
|
2152
2152
|
return t.name = this.name, t.parent = this.parent, this.child = null, t;
|
|
2153
2153
|
}
|
|
@@ -2158,7 +2158,7 @@ var Fr = class {
|
|
|
2158
2158
|
});
|
|
2159
2159
|
return t.parent = this, this.child = t, t.name = "name" in e ? e.name : t.parent.name, t;
|
|
2160
2160
|
}
|
|
2161
|
-
},
|
|
2161
|
+
}, Lr = class e extends Ir {
|
|
2162
2162
|
constructor(...e) {
|
|
2163
2163
|
super(...e), this.type = "mark";
|
|
2164
2164
|
}
|
|
@@ -2183,11 +2183,11 @@ var Fr = class {
|
|
|
2183
2183
|
let t = typeof e == "function" ? e() : e;
|
|
2184
2184
|
return super.extend(t);
|
|
2185
2185
|
}
|
|
2186
|
-
},
|
|
2186
|
+
}, Rr = class {
|
|
2187
2187
|
constructor(e) {
|
|
2188
2188
|
this.find = e.find, this.handler = e.handler;
|
|
2189
2189
|
}
|
|
2190
|
-
},
|
|
2190
|
+
}, zr = (e, t, n) => {
|
|
2191
2191
|
if (Le(t)) return [...e.matchAll(t)];
|
|
2192
2192
|
let r = t(e, n);
|
|
2193
2193
|
return r ? r.map((t) => {
|
|
@@ -2195,7 +2195,7 @@ var Fr = class {
|
|
|
2195
2195
|
return n.index = t.index, n.input = e, n.data = t.data, t.replaceWith && (t.text.includes(t.replaceWith) || console.warn("[tiptap warn]: \"pasteRuleMatch.replaceWith\" must be part of \"pasteRuleMatch.text\"."), n.push(t.replaceWith)), n;
|
|
2196
2196
|
}) : [];
|
|
2197
2197
|
};
|
|
2198
|
-
function
|
|
2198
|
+
function Br(e) {
|
|
2199
2199
|
let { editor: t, state: n, from: r, to: i, rule: a, pasteEvent: o, dropEvent: s } = e, { commands: c, chain: l, can: u } = new D({
|
|
2200
2200
|
editor: t,
|
|
2201
2201
|
state: n
|
|
@@ -2204,7 +2204,7 @@ function zr(e) {
|
|
|
2204
2204
|
var f;
|
|
2205
2205
|
if ((f = e.type) != null && (f = f.spec) != null && f.code || !(e.isText || e.isTextblock || e.isInline)) return;
|
|
2206
2206
|
let p = e.content?.size ?? e.nodeSize ?? 0, m = Math.max(r, t), h = Math.min(i, t + p);
|
|
2207
|
-
m >= h ||
|
|
2207
|
+
m >= h || zr(e.isText ? e.text || "" : e.textBetween(m - t, h - t, void 0, ""), a.find, o).forEach((e) => {
|
|
2208
2208
|
if (e.index === void 0) return;
|
|
2209
2209
|
let t = m + e.index + 1, r = t + e[0].length, i = {
|
|
2210
2210
|
from: n.tr.mapping.map(t),
|
|
@@ -2223,12 +2223,12 @@ function zr(e) {
|
|
|
2223
2223
|
});
|
|
2224
2224
|
}), d.every((e) => e !== null);
|
|
2225
2225
|
}
|
|
2226
|
-
var
|
|
2226
|
+
var Z = null, Vr = (e) => {
|
|
2227
2227
|
var t;
|
|
2228
2228
|
let n = new ClipboardEvent("paste", { clipboardData: new DataTransfer() });
|
|
2229
2229
|
return (t = n.clipboardData) == null || t.setData("text/html", e), n;
|
|
2230
2230
|
};
|
|
2231
|
-
function
|
|
2231
|
+
function Hr(e) {
|
|
2232
2232
|
let { editor: t, rules: n } = e, i = null, a = !1, o = !1, s = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, c;
|
|
2233
2233
|
try {
|
|
2234
2234
|
c = typeof DragEvent < "u" ? new DragEvent("drop") : null;
|
|
@@ -2240,7 +2240,7 @@ function Vr(e) {
|
|
|
2240
2240
|
state: e,
|
|
2241
2241
|
transaction: o
|
|
2242
2242
|
});
|
|
2243
|
-
if (
|
|
2243
|
+
if (Br({
|
|
2244
2244
|
editor: t,
|
|
2245
2245
|
state: l,
|
|
2246
2246
|
from: Math.max(n - 1, 0),
|
|
@@ -2258,13 +2258,13 @@ function Vr(e) {
|
|
|
2258
2258
|
}
|
|
2259
2259
|
};
|
|
2260
2260
|
return t.on("destroy", () => {
|
|
2261
|
-
|
|
2261
|
+
Z === t && (Z = null);
|
|
2262
2262
|
}), n.map((e) => new r({
|
|
2263
2263
|
view(e) {
|
|
2264
2264
|
let n = (n) => {
|
|
2265
|
-
i = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, i && (
|
|
2265
|
+
i = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, i && (Z = t);
|
|
2266
2266
|
}, r = () => {
|
|
2267
|
-
|
|
2267
|
+
Z &&= null;
|
|
2268
2268
|
};
|
|
2269
2269
|
return window.addEventListener("dragstart", n), window.addEventListener("dragend", r), { destroy() {
|
|
2270
2270
|
window.removeEventListener("dragstart", n), window.removeEventListener("dragend", r);
|
|
@@ -2273,7 +2273,7 @@ function Vr(e) {
|
|
|
2273
2273
|
props: { handleDOMEvents: {
|
|
2274
2274
|
drop: (e, t) => {
|
|
2275
2275
|
if (o = i === e.dom.parentElement, c = t, !o) {
|
|
2276
|
-
let e =
|
|
2276
|
+
let e = Z;
|
|
2277
2277
|
e?.isEditable && setTimeout(() => {
|
|
2278
2278
|
if (e.isDestroyed) return;
|
|
2279
2279
|
let t = e.state.selection;
|
|
@@ -2295,8 +2295,8 @@ function Vr(e) {
|
|
|
2295
2295
|
if (!c && !u && !f) return;
|
|
2296
2296
|
if (f) {
|
|
2297
2297
|
let { text: t } = d;
|
|
2298
|
-
t = typeof t == "string" ? t :
|
|
2299
|
-
let { from: n } = d, i = n + t.length, a =
|
|
2298
|
+
t = typeof t == "string" ? t : Ft(w.from(t), r.schema);
|
|
2299
|
+
let { from: n } = d, i = n + t.length, a = Vr(t);
|
|
2300
2300
|
return l({
|
|
2301
2301
|
rule: e,
|
|
2302
2302
|
state: r,
|
|
@@ -2306,7 +2306,7 @@ function Vr(e) {
|
|
|
2306
2306
|
});
|
|
2307
2307
|
}
|
|
2308
2308
|
let p = n.doc.content.findDiffStart(r.doc.content), m = n.doc.content.findDiffEnd(r.doc.content);
|
|
2309
|
-
if (
|
|
2309
|
+
if (Sr(p) && m && p !== m.b) return l({
|
|
2310
2310
|
rule: e,
|
|
2311
2311
|
state: r,
|
|
2312
2312
|
from: p,
|
|
@@ -2316,18 +2316,18 @@ function Vr(e) {
|
|
|
2316
2316
|
}
|
|
2317
2317
|
}));
|
|
2318
2318
|
}
|
|
2319
|
-
var
|
|
2319
|
+
var Q = class {
|
|
2320
2320
|
constructor(e, t) {
|
|
2321
|
-
this.splittableMarks = [], this.nonClearableMarks = [], this.decorationManager = null, this.editor = t, this.baseExtensions = e, this.extensions =
|
|
2321
|
+
this.splittableMarks = [], this.nonClearableMarks = [], this.decorationManager = null, this.editor = t, this.baseExtensions = e, this.extensions = Jt(e), this.schema = Kt(this.extensions, t), this.setupExtensions();
|
|
2322
2322
|
}
|
|
2323
2323
|
get commands() {
|
|
2324
2324
|
return this.extensions.reduce((e, t) => {
|
|
2325
|
-
let n =
|
|
2325
|
+
let n = R(t, "addCommands", {
|
|
2326
2326
|
name: t.name,
|
|
2327
2327
|
options: t.options,
|
|
2328
2328
|
storage: this.editor.extensionStorage[t.name],
|
|
2329
2329
|
editor: this.editor,
|
|
2330
|
-
type:
|
|
2330
|
+
type: U(t.name, this.schema)
|
|
2331
2331
|
});
|
|
2332
2332
|
return n ? {
|
|
2333
2333
|
...e,
|
|
@@ -2336,15 +2336,15 @@ var Hr = class {
|
|
|
2336
2336
|
}, {});
|
|
2337
2337
|
}
|
|
2338
2338
|
get plugins() {
|
|
2339
|
-
let { editor: e } = this, t =
|
|
2339
|
+
let { editor: e } = this, t = H([...this.extensions].reverse()).flatMap((t) => {
|
|
2340
2340
|
let n = {
|
|
2341
2341
|
name: t.name,
|
|
2342
2342
|
options: t.options,
|
|
2343
2343
|
storage: this.editor.extensionStorage[t.name],
|
|
2344
2344
|
editor: e,
|
|
2345
|
-
type:
|
|
2346
|
-
}, r = [], i =
|
|
2347
|
-
if (t.type === "mark" &&
|
|
2345
|
+
type: U(t.name, this.schema)
|
|
2346
|
+
}, r = [], i = R(t, "addKeyboardShortcuts", n), a = {};
|
|
2347
|
+
if (t.type === "mark" && R(t, "exitable", n) && (a.ArrowRight = () => Lr.handleExit({
|
|
2348
2348
|
editor: e,
|
|
2349
2349
|
mark: t
|
|
2350
2350
|
})), i) {
|
|
@@ -2356,29 +2356,29 @@ var Hr = class {
|
|
|
2356
2356
|
}
|
|
2357
2357
|
let o = ve(a);
|
|
2358
2358
|
r.push(o);
|
|
2359
|
-
let s =
|
|
2360
|
-
if (
|
|
2359
|
+
let s = R(t, "addInputRules", n);
|
|
2360
|
+
if (fn(t, e.options.enableInputRules) && s) {
|
|
2361
2361
|
let t = s();
|
|
2362
2362
|
if (t && t.length) {
|
|
2363
|
-
let n =
|
|
2363
|
+
let n = Fr({
|
|
2364
2364
|
editor: e,
|
|
2365
2365
|
rules: t
|
|
2366
2366
|
}), i = Array.isArray(n) ? n : [n];
|
|
2367
2367
|
r.push(...i);
|
|
2368
2368
|
}
|
|
2369
2369
|
}
|
|
2370
|
-
let c =
|
|
2371
|
-
if (
|
|
2370
|
+
let c = R(t, "addPasteRules", n);
|
|
2371
|
+
if (fn(t, e.options.enablePasteRules) && c) {
|
|
2372
2372
|
let t = c();
|
|
2373
2373
|
if (t && t.length) {
|
|
2374
|
-
let n =
|
|
2374
|
+
let n = Hr({
|
|
2375
2375
|
editor: e,
|
|
2376
2376
|
rules: t
|
|
2377
2377
|
});
|
|
2378
2378
|
r.push(...n);
|
|
2379
2379
|
}
|
|
2380
2380
|
}
|
|
2381
|
-
let l =
|
|
2381
|
+
let l = R(t, "addProseMirrorPlugins", n);
|
|
2382
2382
|
if (l) {
|
|
2383
2383
|
let e = l();
|
|
2384
2384
|
r.push(...e);
|
|
@@ -2393,29 +2393,29 @@ var Hr = class {
|
|
|
2393
2393
|
(e = this.decorationManager) == null || e.destroy();
|
|
2394
2394
|
let n = [];
|
|
2395
2395
|
return this.extensions.forEach((e) => {
|
|
2396
|
-
let r =
|
|
2396
|
+
let r = R(e, "addDecorations", {
|
|
2397
2397
|
name: e.name,
|
|
2398
2398
|
options: e.options,
|
|
2399
2399
|
storage: this.editor.extensionStorage[e.name],
|
|
2400
2400
|
editor: t,
|
|
2401
|
-
type:
|
|
2401
|
+
type: U(e.name, this.schema)
|
|
2402
2402
|
});
|
|
2403
2403
|
r && n.push({
|
|
2404
2404
|
name: e.name,
|
|
2405
2405
|
addDecorations: r
|
|
2406
2406
|
});
|
|
2407
|
-
}), this.decorationManager = new
|
|
2407
|
+
}), this.decorationManager = new gr({
|
|
2408
2408
|
editor: t,
|
|
2409
2409
|
entries: n
|
|
2410
2410
|
}), this.decorationManager.plugin;
|
|
2411
2411
|
}
|
|
2412
2412
|
get attributes() {
|
|
2413
|
-
return
|
|
2413
|
+
return Rt(this.extensions);
|
|
2414
2414
|
}
|
|
2415
2415
|
get nodeViews() {
|
|
2416
|
-
let { editor: e } = this, { nodeExtensions: t } =
|
|
2417
|
-
return Object.fromEntries(t.filter((e) => !!
|
|
2418
|
-
let n = this.attributes.filter((e) => e.type === t.name), r =
|
|
2416
|
+
let { editor: e } = this, { nodeExtensions: t } = B(this.extensions);
|
|
2417
|
+
return Object.fromEntries(t.filter((e) => !!R(e, "addNodeView")).map((t) => {
|
|
2418
|
+
let n = this.attributes.filter((e) => e.type === t.name), r = R(t, "addNodeView", {
|
|
2419
2419
|
name: t.name,
|
|
2420
2420
|
options: t.options,
|
|
2421
2421
|
storage: this.editor.extensionStorage[t.name],
|
|
@@ -2425,7 +2425,7 @@ var Hr = class {
|
|
|
2425
2425
|
if (!r) return [];
|
|
2426
2426
|
let i = r();
|
|
2427
2427
|
return i ? [t.name, (r, a, o, s, c) => {
|
|
2428
|
-
let l =
|
|
2428
|
+
let l = V(r, n);
|
|
2429
2429
|
return i({
|
|
2430
2430
|
node: r,
|
|
2431
2431
|
view: a,
|
|
@@ -2441,14 +2441,14 @@ var Hr = class {
|
|
|
2441
2441
|
}
|
|
2442
2442
|
dispatchTransaction(e) {
|
|
2443
2443
|
let { editor: t } = this;
|
|
2444
|
-
return
|
|
2444
|
+
return H([...this.extensions].reverse()).reduceRight((e, n) => {
|
|
2445
2445
|
let r = {
|
|
2446
2446
|
name: n.name,
|
|
2447
2447
|
options: n.options,
|
|
2448
2448
|
storage: this.editor.extensionStorage[n.name],
|
|
2449
2449
|
editor: t,
|
|
2450
|
-
type:
|
|
2451
|
-
}, i =
|
|
2450
|
+
type: U(n.name, this.schema)
|
|
2451
|
+
}, i = R(n, "dispatchTransaction", r);
|
|
2452
2452
|
return i ? (t) => {
|
|
2453
2453
|
i.call(r, {
|
|
2454
2454
|
transaction: t,
|
|
@@ -2459,14 +2459,14 @@ var Hr = class {
|
|
|
2459
2459
|
}
|
|
2460
2460
|
transformPastedHTML(e) {
|
|
2461
2461
|
let { editor: t } = this;
|
|
2462
|
-
return
|
|
2462
|
+
return H([...this.extensions]).reduce((e, n) => {
|
|
2463
2463
|
let r = {
|
|
2464
2464
|
name: n.name,
|
|
2465
2465
|
options: n.options,
|
|
2466
2466
|
storage: this.editor.extensionStorage[n.name],
|
|
2467
2467
|
editor: t,
|
|
2468
|
-
type:
|
|
2469
|
-
}, i =
|
|
2468
|
+
type: U(n.name, this.schema)
|
|
2469
|
+
}, i = R(n, "transformPastedHTML", r);
|
|
2470
2470
|
return i ? (t, n) => {
|
|
2471
2471
|
let a = e(t, n);
|
|
2472
2472
|
return i.call(r, a);
|
|
@@ -2474,9 +2474,9 @@ var Hr = class {
|
|
|
2474
2474
|
}, e || ((e) => e));
|
|
2475
2475
|
}
|
|
2476
2476
|
get markViews() {
|
|
2477
|
-
let { editor: e } = this, { markExtensions: t } =
|
|
2478
|
-
return Object.fromEntries(t.filter((e) => !!
|
|
2479
|
-
let n = this.attributes.filter((e) => e.type === t.name), r =
|
|
2477
|
+
let { editor: e } = this, { markExtensions: t } = B(this.extensions);
|
|
2478
|
+
return Object.fromEntries(t.filter((e) => !!R(e, "addMarkView")).map((t) => {
|
|
2479
|
+
let n = this.attributes.filter((e) => e.type === t.name), r = R(t, "addMarkView", {
|
|
2480
2480
|
name: t.name,
|
|
2481
2481
|
options: t.options,
|
|
2482
2482
|
storage: this.editor.extensionStorage[t.name],
|
|
@@ -2484,7 +2484,7 @@ var Hr = class {
|
|
|
2484
2484
|
type: A(t.name, this.schema)
|
|
2485
2485
|
});
|
|
2486
2486
|
return r ? [t.name, (i, a, o) => {
|
|
2487
|
-
let s =
|
|
2487
|
+
let s = V(i, n);
|
|
2488
2488
|
return r()({
|
|
2489
2489
|
mark: i,
|
|
2490
2490
|
view: a,
|
|
@@ -2493,7 +2493,7 @@ var Hr = class {
|
|
|
2493
2493
|
extension: t,
|
|
2494
2494
|
HTMLAttributes: s,
|
|
2495
2495
|
updateAttributes: (t) => {
|
|
2496
|
-
|
|
2496
|
+
Ar(i, e, t);
|
|
2497
2497
|
}
|
|
2498
2498
|
});
|
|
2499
2499
|
}] : [];
|
|
@@ -2517,16 +2517,16 @@ var Hr = class {
|
|
|
2517
2517
|
options: e.options,
|
|
2518
2518
|
storage: this.editor.extensionStorage[e.name],
|
|
2519
2519
|
editor: this.editor,
|
|
2520
|
-
type:
|
|
2520
|
+
type: U(e.name, this.schema)
|
|
2521
2521
|
};
|
|
2522
|
-
e.type === "mark" && ((
|
|
2523
|
-
let n =
|
|
2522
|
+
e.type === "mark" && ((z(R(e, "keepOnSplit", t)) ?? !0) && this.splittableMarks.push(e.name), (z(R(e, "clearable", t)) ?? !0) || this.nonClearableMarks.push(e.name));
|
|
2523
|
+
let n = R(e, "onBeforeCreate", t), r = R(e, "onCreate", t), i = R(e, "onUpdate", t), a = R(e, "onSelectionUpdate", t), o = R(e, "onTransaction", t), s = R(e, "onFocus", t), c = R(e, "onBlur", t), l = R(e, "onDestroy", t);
|
|
2524
2524
|
n && this.editor.on("beforeCreate", n), r && this.editor.on("create", r), i && this.editor.on("update", i), a && this.editor.on("selectionUpdate", a), o && this.editor.on("transaction", o), s && this.editor.on("focus", s), c && this.editor.on("blur", c), l && this.editor.on("destroy", l);
|
|
2525
2525
|
});
|
|
2526
2526
|
}
|
|
2527
2527
|
};
|
|
2528
|
-
|
|
2529
|
-
var $ = class e extends
|
|
2528
|
+
Q.resolve = Jt, Q.sort = H, Q.flatten = Pt;
|
|
2529
|
+
var $ = class e extends Ir {
|
|
2530
2530
|
constructor(...e) {
|
|
2531
2531
|
super(...e), this.type = "extension";
|
|
2532
2532
|
}
|
|
@@ -2550,11 +2550,11 @@ var $ = class e extends Fr {
|
|
|
2550
2550
|
return [new r({
|
|
2551
2551
|
key: new i("clipboardTextSerializer"),
|
|
2552
2552
|
props: { clipboardTextSerializer: () => {
|
|
2553
|
-
let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a =
|
|
2553
|
+
let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a = Zt(n), { blockSeparator: o } = this.options, s = {
|
|
2554
2554
|
...o === void 0 ? {} : { blockSeparator: o },
|
|
2555
2555
|
textSerializers: a
|
|
2556
2556
|
};
|
|
2557
|
-
return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) =>
|
|
2557
|
+
return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) => Yt(r, {
|
|
2558
2558
|
from: e.pos,
|
|
2559
2559
|
to: t.pos
|
|
2560
2560
|
}, s)).join(o ?? "\n\n");
|
|
@@ -2564,7 +2564,7 @@ var $ = class e extends Fr {
|
|
|
2564
2564
|
}), Wr = $.create({
|
|
2565
2565
|
name: "commands",
|
|
2566
2566
|
addCommands() {
|
|
2567
|
-
return { ...
|
|
2567
|
+
return { ...qn };
|
|
2568
2568
|
}
|
|
2569
2569
|
}), Gr = $.create({
|
|
2570
2570
|
name: "delete",
|
|
@@ -2573,8 +2573,8 @@ var $ = class e extends Fr {
|
|
|
2573
2573
|
let r = () => {
|
|
2574
2574
|
var n, r;
|
|
2575
2575
|
if (((n = this.editor.options.coreExtensionOptions) == null || (n = n.delete) == null || (r = n.filterTransaction) == null ? void 0 : r.call(n, e)) ?? e.getMeta("y-sync$")) return;
|
|
2576
|
-
let i =
|
|
2577
|
-
|
|
2576
|
+
let i = jt(e.before, [e, ...t]);
|
|
2577
|
+
nn(i).forEach((t) => {
|
|
2578
2578
|
i.mapping.mapResult(t.oldRange.from).deletedAfter && i.mapping.mapResult(t.oldRange.to).deletedBefore && i.before.nodesBetween(t.oldRange.from, t.oldRange.to, (n, r) => {
|
|
2579
2579
|
let a = r + n.nodeSize - 2, o = t.oldRange.from <= r && a <= t.oldRange.to;
|
|
2580
2580
|
this.editor.emit("delete", {
|
|
@@ -2705,7 +2705,7 @@ var $ = class e extends Fr {
|
|
|
2705
2705
|
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
2706
2706
|
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
2707
2707
|
};
|
|
2708
|
-
return
|
|
2708
|
+
return M() || ft() ? i : r;
|
|
2709
2709
|
},
|
|
2710
2710
|
addProseMirrorPlugins() {
|
|
2711
2711
|
return [new r({
|
|
@@ -2715,7 +2715,7 @@ var $ = class e extends Fr {
|
|
|
2715
2715
|
let r = e.some((e) => e.docChanged) && !t.doc.eq(n.doc), i = e.some((e) => e.getMeta("preventClearDocument"));
|
|
2716
2716
|
if (!r || i) return;
|
|
2717
2717
|
let { empty: o, from: s, to: c } = t.selection, l = a.atStart(t.doc).from, u = a.atEnd(t.doc).to;
|
|
2718
|
-
if (o || s !== l || c !== u || !
|
|
2718
|
+
if (o || s !== l || c !== u || !G(n.doc)) return;
|
|
2719
2719
|
let d = n.tr, f = E({
|
|
2720
2720
|
state: n,
|
|
2721
2721
|
transaction: d
|
|
@@ -2759,7 +2759,7 @@ var $ = class e extends Fr {
|
|
|
2759
2759
|
},
|
|
2760
2760
|
addGlobalAttributes() {
|
|
2761
2761
|
if (!this.options.direction) return [];
|
|
2762
|
-
let { nodeExtensions: e } =
|
|
2762
|
+
let { nodeExtensions: e } = B(this.extensions);
|
|
2763
2763
|
return [{
|
|
2764
2764
|
types: e.filter((e) => e.name !== "text").map((e) => e.name),
|
|
2765
2765
|
attributes: { dir: {
|
|
@@ -2918,7 +2918,7 @@ var ni = class e {
|
|
|
2918
2918
|
...e
|
|
2919
2919
|
}), this.editor.view.dispatch(t);
|
|
2920
2920
|
}
|
|
2921
|
-
}, ri = ".ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: \"liga\" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable=\"false\"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable=\"false\"] [contenteditable=\"true\"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}", ii = class extends
|
|
2921
|
+
}, ri = ".ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: \"liga\" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable=\"false\"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable=\"false\"] [contenteditable=\"true\"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}", ii = class extends Xn {
|
|
2922
2922
|
constructor(e = {}) {
|
|
2923
2923
|
super(), this.css = null, this.className = "tiptap", this.editorView = null, this.isFocused = !1, this.destroyed = !1, this.isInitialized = !1, this.extensionStorage = {}, this.instanceId = Math.random().toString(36).slice(2, 9), this.hasWarnedStaleDecorationRead = !1, this.options = {
|
|
2924
2924
|
element: typeof document < "u" ? document.createElement("div") : null,
|
|
@@ -2955,8 +2955,8 @@ var ni = class e {
|
|
|
2955
2955
|
onDelete: () => null,
|
|
2956
2956
|
enableExtensionDispatchTransaction: !0
|
|
2957
2957
|
}, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.utils = {
|
|
2958
|
-
getUpdatedPosition:
|
|
2959
|
-
createMappablePosition:
|
|
2958
|
+
getUpdatedPosition: gn,
|
|
2959
|
+
createMappablePosition: _n
|
|
2960
2960
|
}, this.setOptions(e), this.createExtensionManager(), this.createCommandManager(), this.createSchema(), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("mount", this.options.onMount), this.on("unmount", this.options.onUnmount), this.on("contentError", this.options.onContentError), this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", this.options.onFocus), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), this.on("drop", ({ event: e, slice: t, moved: n }) => this.options.onDrop(e, t, n)), this.on("paste", ({ event: e, slice: t }) => this.options.onPaste(e, t)), this.on("delete", this.options.onDelete);
|
|
2961
2961
|
let n = this.createDoc();
|
|
2962
2962
|
if (!this.editorState) {
|
|
@@ -3001,7 +3001,7 @@ var ni = class e {
|
|
|
3001
3001
|
return this.commandManager ? this.commandManager.can() : D.createFallbackCan();
|
|
3002
3002
|
}
|
|
3003
3003
|
injectCSS() {
|
|
3004
|
-
this.options.injectCSS && typeof document < "u" && (this.css =
|
|
3004
|
+
this.options.injectCSS && typeof document < "u" && (this.css = vr(ri, this.options.injectNonce));
|
|
3005
3005
|
}
|
|
3006
3006
|
setOptions(e = {}) {
|
|
3007
3007
|
this.options = {
|
|
@@ -3043,10 +3043,10 @@ var ni = class e {
|
|
|
3043
3043
|
} });
|
|
3044
3044
|
}
|
|
3045
3045
|
get state() {
|
|
3046
|
-
return
|
|
3046
|
+
return Zn && !this.hasWarnedStaleDecorationRead && Yn(this) && (this.hasWarnedStaleDecorationRead = !0, console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")), this.editorView && (this.editorState = this.view.state), this.editorState;
|
|
3047
3047
|
}
|
|
3048
3048
|
registerPlugin(e, t) {
|
|
3049
|
-
let n =
|
|
3049
|
+
let n = It(t) ? t(e, [...this.state.plugins]) : [...this.state.plugins, e], r = this.state.reconfigure({ plugins: n });
|
|
3050
3050
|
return this.view.updateState(r), r;
|
|
3051
3051
|
}
|
|
3052
3052
|
unregisterPlugin(e) {
|
|
@@ -3077,7 +3077,7 @@ var ni = class e {
|
|
|
3077
3077
|
"node",
|
|
3078
3078
|
"mark"
|
|
3079
3079
|
].includes(e?.type));
|
|
3080
|
-
this.extensionManager = new
|
|
3080
|
+
this.extensionManager = new Q(n, this);
|
|
3081
3081
|
}
|
|
3082
3082
|
createCommandManager() {
|
|
3083
3083
|
this.commandManager = new D({ editor: this });
|
|
@@ -3088,10 +3088,10 @@ var ni = class e {
|
|
|
3088
3088
|
createDoc() {
|
|
3089
3089
|
let e;
|
|
3090
3090
|
try {
|
|
3091
|
-
e =
|
|
3091
|
+
e = Ot(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
|
|
3092
3092
|
} catch (e) {
|
|
3093
3093
|
if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) throw e;
|
|
3094
|
-
let n =
|
|
3094
|
+
let n = Ot(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
|
|
3095
3095
|
return this.editorState = t.create({
|
|
3096
3096
|
doc: n,
|
|
3097
3097
|
schema: this.schema,
|
|
@@ -3108,7 +3108,7 @@ var ni = class e {
|
|
|
3108
3108
|
}
|
|
3109
3109
|
getEditorViewAttributes() {
|
|
3110
3110
|
let e = this.options.editorProps?.attributes;
|
|
3111
|
-
return
|
|
3111
|
+
return It(e) ? (t) => ({
|
|
3112
3112
|
role: "textbox",
|
|
3113
3113
|
...e(t)
|
|
3114
3114
|
}) : {
|
|
@@ -3186,30 +3186,30 @@ var ni = class e {
|
|
|
3186
3186
|
});
|
|
3187
3187
|
}
|
|
3188
3188
|
getAttributes(e) {
|
|
3189
|
-
return
|
|
3189
|
+
return $t(this.state, e);
|
|
3190
3190
|
}
|
|
3191
3191
|
isActive(e, t) {
|
|
3192
3192
|
let n = typeof e == "string" ? e : null, r = typeof e == "string" ? t : e;
|
|
3193
|
-
return
|
|
3193
|
+
return ln(this.state, n, r);
|
|
3194
3194
|
}
|
|
3195
3195
|
getJSON() {
|
|
3196
3196
|
return this.state.doc.toJSON();
|
|
3197
3197
|
}
|
|
3198
3198
|
getHTML() {
|
|
3199
|
-
return
|
|
3199
|
+
return Ft(this.state.doc.content, this.schema);
|
|
3200
3200
|
}
|
|
3201
3201
|
getText(e) {
|
|
3202
3202
|
let { blockSeparator: t = "\n\n", textSerializers: n = {} } = e || {};
|
|
3203
|
-
return
|
|
3203
|
+
return Xt(this.state.doc, {
|
|
3204
3204
|
blockSeparator: t,
|
|
3205
3205
|
textSerializers: {
|
|
3206
|
-
...
|
|
3206
|
+
...Zt(this.schema),
|
|
3207
3207
|
...n
|
|
3208
3208
|
}
|
|
3209
3209
|
});
|
|
3210
3210
|
}
|
|
3211
3211
|
get isEmpty() {
|
|
3212
|
-
return
|
|
3212
|
+
return G(this.state.doc);
|
|
3213
3213
|
}
|
|
3214
3214
|
destroy() {
|
|
3215
3215
|
this.destroyed || (this.destroyed = !0, this.emit("destroy"), this.unmount(), this.removeAllListeners(), this.extensionManager.destroy(), this.extensionManager = null, this.schema = null, this.commandManager = null, this.extensionStorage = {});
|
|
@@ -3232,15 +3232,15 @@ var ni = class e {
|
|
|
3232
3232
|
}
|
|
3233
3233
|
};
|
|
3234
3234
|
function ai(e) {
|
|
3235
|
-
return new
|
|
3235
|
+
return new Y({
|
|
3236
3236
|
find: e.find,
|
|
3237
3237
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3238
|
-
let i =
|
|
3238
|
+
let i = z(e.getAttributes, void 0, r);
|
|
3239
3239
|
if (i === !1 || i === null) return null;
|
|
3240
3240
|
let { tr: a } = t, o = r[r.length - 1], s = r[0];
|
|
3241
3241
|
if (o) {
|
|
3242
3242
|
let r = s.search(/\S/), c = n.from + s.indexOf(o), l = c + o.length;
|
|
3243
|
-
if (
|
|
3243
|
+
if (rn(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > c).length) return null;
|
|
3244
3244
|
l < n.to && a.delete(l, n.to), c > n.from && a.delete(n.from + r, c);
|
|
3245
3245
|
let u = n.from + r + o.length;
|
|
3246
3246
|
a.addMark(n.from + r, u, e.type.create(i || {})), a.removeStoredMark(e.type);
|
|
@@ -3250,10 +3250,10 @@ function ai(e) {
|
|
|
3250
3250
|
});
|
|
3251
3251
|
}
|
|
3252
3252
|
function oi(e) {
|
|
3253
|
-
return new
|
|
3253
|
+
return new Y({
|
|
3254
3254
|
find: e.find,
|
|
3255
3255
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3256
|
-
let i =
|
|
3256
|
+
let i = z(e.getAttributes, void 0, r) || {}, { tr: a } = t, o = n.from, s = n.to, c = e.type.create(i);
|
|
3257
3257
|
if (r[1]) {
|
|
3258
3258
|
let e = o + r[0].lastIndexOf(r[1]);
|
|
3259
3259
|
e > s ? e = s : s = e + r[1].length;
|
|
@@ -3269,10 +3269,10 @@ function oi(e) {
|
|
|
3269
3269
|
});
|
|
3270
3270
|
}
|
|
3271
3271
|
function si(e) {
|
|
3272
|
-
return new
|
|
3272
|
+
return new Y({
|
|
3273
3273
|
find: e.find,
|
|
3274
3274
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3275
|
-
let i = t.doc.resolve(n.from), a =
|
|
3275
|
+
let i = t.doc.resolve(n.from), a = z(e.getAttributes, void 0, r) || {};
|
|
3276
3276
|
if (!i.node(-1).canReplaceWith(i.index(-1), i.indexAfter(-1), e.type)) return null;
|
|
3277
3277
|
t.tr.delete(n.from, n.to).setBlockType(n.from, n.from, e.type, a);
|
|
3278
3278
|
},
|
|
@@ -3280,7 +3280,7 @@ function si(e) {
|
|
|
3280
3280
|
});
|
|
3281
3281
|
}
|
|
3282
3282
|
function ci(e) {
|
|
3283
|
-
return new
|
|
3283
|
+
return new Y({
|
|
3284
3284
|
find: e.find,
|
|
3285
3285
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3286
3286
|
let i = e.replace, a = n.from, o = n.to;
|
|
@@ -3296,10 +3296,10 @@ function ci(e) {
|
|
|
3296
3296
|
});
|
|
3297
3297
|
}
|
|
3298
3298
|
function li(e) {
|
|
3299
|
-
return new
|
|
3299
|
+
return new Y({
|
|
3300
3300
|
find: e.find,
|
|
3301
3301
|
handler: ({ state: t, range: n, match: r, chain: i }) => {
|
|
3302
|
-
let a =
|
|
3302
|
+
let a = z(e.getAttributes, void 0, r) || {}, o = t.tr.delete(n.from, n.to), s = o.doc.resolve(n.from).blockRange(), c = s && p(s, e.type, a);
|
|
3303
3303
|
if (!c) return null;
|
|
3304
3304
|
if (o.wrap(s, c), e.keepMarks && e.editor) {
|
|
3305
3305
|
let { selection: n, storedMarks: r } = t, { splittableMarks: i } = e.editor.extensionManager, a = r || n.$to.parentOffset && n.$from.marks();
|
|
@@ -3448,7 +3448,7 @@ var ui = (e) => "touches" in e, di = class {
|
|
|
3448
3448
|
height: e / this.aspectRatio
|
|
3449
3449
|
};
|
|
3450
3450
|
}
|
|
3451
|
-
}, fi = class e extends
|
|
3451
|
+
}, fi = class e extends Ir {
|
|
3452
3452
|
constructor(...e) {
|
|
3453
3453
|
super(...e), this.type = "node";
|
|
3454
3454
|
}
|
|
@@ -3463,118 +3463,21 @@ var ui = (e) => "touches" in e, di = class {
|
|
|
3463
3463
|
let t = typeof e == "function" ? e() : e;
|
|
3464
3464
|
return super.extend(t);
|
|
3465
3465
|
}
|
|
3466
|
-
}, pi = class {
|
|
3467
|
-
constructor(e, t, n) {
|
|
3468
|
-
this.isDragging = !1, this.component = e, this.editor = t.editor, this.options = {
|
|
3469
|
-
stopEvent: null,
|
|
3470
|
-
ignoreMutation: null,
|
|
3471
|
-
...n
|
|
3472
|
-
}, this.extension = t.extension, this.node = t.node, this.decorations = t.decorations, this.innerDecorations = t.innerDecorations, this.view = t.view, this.HTMLAttributes = t.HTMLAttributes, this.getPos = () => {
|
|
3473
|
-
try {
|
|
3474
|
-
return t.getPos();
|
|
3475
|
-
} catch {
|
|
3476
|
-
return;
|
|
3477
|
-
}
|
|
3478
|
-
}, this.mount();
|
|
3479
|
-
}
|
|
3480
|
-
mount() {}
|
|
3481
|
-
get dom() {
|
|
3482
|
-
return this.editor.view.dom;
|
|
3483
|
-
}
|
|
3484
|
-
get contentDOM() {
|
|
3485
|
-
return null;
|
|
3486
|
-
}
|
|
3487
|
-
onDragStart(e) {
|
|
3488
|
-
let { view: t } = this.editor, r = e.target, i = r.nodeType === 3 ? r.parentElement?.closest("[data-drag-handle]") : r.closest("[data-drag-handle]");
|
|
3489
|
-
if (!this.dom || this.contentDOM?.contains(r) || !i) return;
|
|
3490
|
-
let a = 0, o = 0;
|
|
3491
|
-
if (this.dom !== i) {
|
|
3492
|
-
let t = this.dom.getBoundingClientRect(), n = i.getBoundingClientRect(), r = e.offsetX ?? e.nativeEvent?.offsetX, s = e.offsetY ?? e.nativeEvent?.offsetY;
|
|
3493
|
-
a = n.x - t.x + r, o = n.y - t.y + s;
|
|
3494
|
-
}
|
|
3495
|
-
let s = this.dom.cloneNode(!0);
|
|
3496
|
-
try {
|
|
3497
|
-
let e = this.dom.getBoundingClientRect();
|
|
3498
|
-
s.style.width = `${Math.round(e.width)}px`, s.style.height = `${Math.round(e.height)}px`, s.style.boxSizing = "border-box", s.style.pointerEvents = "none";
|
|
3499
|
-
} catch {}
|
|
3500
|
-
let c = null;
|
|
3501
|
-
try {
|
|
3502
|
-
var l;
|
|
3503
|
-
c = document.createElement("div"), c.style.position = "absolute", c.style.top = "-9999px", c.style.left = "-9999px", c.style.pointerEvents = "none", c.appendChild(s), document.body.appendChild(c), (l = e.dataTransfer) == null || l.setDragImage(s, a, o);
|
|
3504
|
-
} finally {
|
|
3505
|
-
c && setTimeout(() => {
|
|
3506
|
-
try {
|
|
3507
|
-
c?.remove();
|
|
3508
|
-
} catch {}
|
|
3509
|
-
}, 0);
|
|
3510
|
-
}
|
|
3511
|
-
let u = this.getPos();
|
|
3512
|
-
if (typeof u != "number") return;
|
|
3513
|
-
let d = n.create(t.state.doc, u), f = t.state.tr.setSelection(d);
|
|
3514
|
-
t.dispatch(f);
|
|
3515
|
-
}
|
|
3516
|
-
stopEvent(e) {
|
|
3517
|
-
if (!this.dom) return !1;
|
|
3518
|
-
if (typeof this.options.stopEvent == "function") return this.options.stopEvent({ event: e });
|
|
3519
|
-
let t = e.target;
|
|
3520
|
-
if (!this.dom.contains(t) || this.contentDOM?.contains(t)) return !1;
|
|
3521
|
-
let r = e.type.startsWith("drag"), i = e.type === "dragover" || e.type === "dragenter", a = e.type === "drop";
|
|
3522
|
-
if (([
|
|
3523
|
-
"INPUT",
|
|
3524
|
-
"BUTTON",
|
|
3525
|
-
"SELECT",
|
|
3526
|
-
"TEXTAREA"
|
|
3527
|
-
].includes(t.tagName) || t.isContentEditable) && !a && !r) return !0;
|
|
3528
|
-
let { isEditable: o } = this.editor, { isDragging: s } = this, c = !!this.node.type.spec.draggable, l = n.isSelectable(this.node), u = e.type === "copy", d = e.type === "paste", f = e.type === "cut", p = e.type === "mousedown";
|
|
3529
|
-
if (!c && l && r && e.target === this.dom && e.preventDefault(), c && r && !s && e.target === this.dom) return e.preventDefault(), !1;
|
|
3530
|
-
if (c && o && !s && p) {
|
|
3531
|
-
let e = t.closest("[data-drag-handle]");
|
|
3532
|
-
e && (this.dom === e || this.dom.contains(e)) && (this.isDragging = !0, document.addEventListener("dragend", () => {
|
|
3533
|
-
this.isDragging = !1;
|
|
3534
|
-
}, { once: !0 }), document.addEventListener("drop", () => {
|
|
3535
|
-
this.isDragging = !1;
|
|
3536
|
-
}, { once: !0 }), document.addEventListener("mouseup", () => {
|
|
3537
|
-
this.isDragging = !1;
|
|
3538
|
-
}, { once: !0 }));
|
|
3539
|
-
}
|
|
3540
|
-
return !(s || i || a || u || d || f || p && l);
|
|
3541
|
-
}
|
|
3542
|
-
ignoreMutation(e) {
|
|
3543
|
-
return this.dom ? this.contentDOM ? typeof this.options.ignoreMutation == "function" ? this.options.ignoreMutation({ mutation: e }) : this.node.isLeaf || this.node.isAtom ? !0 : e.type === "selection" || this.contentDOM.contains(e.target) && e.type === "childList" && (N() || M()) && this.editor.isFocused && [...Array.from(e.addedNodes), ...Array.from(e.removedNodes)].every((e) => e.isContentEditable) ? !1 : this.contentDOM === e.target && e.type === "attributes" || !this.contentDOM.contains(e.target) : e.type !== "selection" : !0;
|
|
3544
|
-
}
|
|
3545
|
-
updateAttributes(e) {
|
|
3546
|
-
this.editor.commands.command(({ tr: t }) => {
|
|
3547
|
-
let n = this.getPos();
|
|
3548
|
-
return typeof n == "number" && (t.setNodeMarkup(n, void 0, {
|
|
3549
|
-
...this.node.attrs,
|
|
3550
|
-
...e
|
|
3551
|
-
}), !0);
|
|
3552
|
-
});
|
|
3553
|
-
}
|
|
3554
|
-
deleteNode() {
|
|
3555
|
-
let e = this.getPos();
|
|
3556
|
-
if (typeof e != "number") return;
|
|
3557
|
-
let t = e + this.node.nodeSize;
|
|
3558
|
-
this.editor.commands.deleteRange({
|
|
3559
|
-
from: e,
|
|
3560
|
-
to: t
|
|
3561
|
-
});
|
|
3562
|
-
}
|
|
3563
3466
|
};
|
|
3564
|
-
function
|
|
3565
|
-
return new
|
|
3467
|
+
function pi(e) {
|
|
3468
|
+
return new Rr({
|
|
3566
3469
|
find: e.find,
|
|
3567
3470
|
handler: ({ state: t, range: n, match: r, pasteEvent: i }) => {
|
|
3568
|
-
let a =
|
|
3471
|
+
let a = z(e.getAttributes, void 0, r, i);
|
|
3569
3472
|
if (a === !1 || a === null) return null;
|
|
3570
3473
|
let { tr: o } = t, s = r[r.length - 1], c = r[0], l = n.to;
|
|
3571
3474
|
if (s) {
|
|
3572
3475
|
let i = c.search(/\S/), u = n.from + c.indexOf(s), d = u + s.length;
|
|
3573
|
-
if (
|
|
3476
|
+
if (rn(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > u).length) return null;
|
|
3574
3477
|
d < n.to && o.delete(d, n.to), u > n.from && o.delete(n.from + i, u), l = n.from + i + s.length, o.addMark(n.from + i, l, e.type.create(a || {})), r.index !== void 0 && r.input !== void 0 && r.index + r[0].length >= r.input.length || o.removeStoredMark(e.type);
|
|
3575
3478
|
}
|
|
3576
3479
|
}
|
|
3577
3480
|
});
|
|
3578
3481
|
}
|
|
3579
3482
|
//#endregion
|
|
3580
|
-
export {
|
|
3483
|
+
export { dn as A, Vt as B, on as C, Zt as D, Xt as E, Ue as F, ci as G, Tr as H, wr as I, si as K, M as L, F as M, G as N, Ge as O, mn as P, ai as R, O as S, br as T, vn as U, oi as V, Or as W, R as _, fi as a, rn as b, z as c, qn as d, yr as f, nn as g, $t as h, Lr as i, xr as j, un as k, _r as l, Nt as m, $ as n, Rr as o, Mt as p, li as q, Y as r, di as s, ii as t, jt as u, k as v, V as w, an as x, A as y, pi as z };
|