@clevertask/scribe 0.1.29 → 0.1.31
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 +39 -53
- package/dist/BarMenu-Bm5IfWVV.js +302 -0
- package/dist/components/Menu/BarMenu.d.ts.map +1 -1
- package/dist/components/Menu/BarMenu.js +1 -2
- 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 +113 -103
- 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 +148 -157
- package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
- package/dist/components/Menu/TableBubbleMenu.js +3 -3
- package/dist/components/Menu/TableHeightSettings.js +3 -11
- package/dist/components/Menu/TableLayoutOptions.js +1 -5
- 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 +2 -2
- package/dist/components/Scribe/extension/extension-link.js +1 -2
- package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
- 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 -51
- 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 -2
- package/dist/components/Scribe/extension/resizable-table.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +10 -14
- package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +2 -2
- package/dist/components/Scribe/extension/table-layout.js +1 -2
- 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 +7 -21
- package/dist/{dist-DnVcys79.js → dist-BoAzo5MN.js} +491 -598
- package/dist/{dist-CDJRm4fL.js → dist-BqlzKS-_.js} +9 -17
- package/dist/{dist-B0xwy1Q5.js → dist-SM4NoN4h.js} +174 -385
- package/dist/document-node-capabilities.js +1 -1
- package/dist/{extension-BPeoqfHR.js → extension-dz0CIf3r.js} +1 -1
- package/dist/extension-link-DxIXGCtV.js +931 -0
- package/dist/{html-to-markdown-DF93it73.js → html-to-markdown-DeRG9OPm.js} +1 -1
- package/dist/main.css +1 -141
- package/dist/main.js +2 -2
- package/dist/{markdown-to-html-BoK5O_j-.js → markdown-to-html-tCPjQ5u6.js} +23 -70
- package/dist/{menus-scgppp2C.js → menus-BKxcTUsl.js} +36 -118
- package/dist/{purify.es-q6CUdJQi.js → purify.es-CSWcs7f1.js} +1 -23
- package/dist/{schema-extensions-ITR9LEgX.js → schema-extensions-B9hR1VrD.js} +1335 -1360
- package/dist/schema-extensions.js +1 -2
- package/dist/schema.js +1 -1
- package/dist/{table-layout-iVolql5p.js → table-layout-ClqaGg1E.js} +36 -36
- package/dist/{tippy.esm-MjWnmeEn.js → tippy.esm-C8V6GlaF.js} +5 -17
- package/dist/utils/create-scribe-editor.d.ts +1 -1
- package/dist/utils/create-scribe-editor.d.ts.map +1 -1
- package/dist/utils/create-scribe-editor.js +1 -2
- package/dist/utils/html-to-markdown.js +1 -2
- package/dist/utils/index.js +4 -4
- package/dist/utils/markdown-to-html.js +1 -2
- package/package.json +10 -10
- 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,38 +703,34 @@ 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];
|
|
710
|
-
if (o === "'" && !i)
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
}
|
|
727
|
-
if (o === ";" && a === 0) {
|
|
728
|
-
t.push(n), n = "";
|
|
729
|
-
continue;
|
|
710
|
+
if (o === "'" && !i) r = !r, n += o;
|
|
711
|
+
else if (o === "\"" && !r) i = !i, n += o;
|
|
712
|
+
else {
|
|
713
|
+
if (!r && !i) {
|
|
714
|
+
if (o === "(") {
|
|
715
|
+
a += 1, n += o;
|
|
716
|
+
continue;
|
|
717
|
+
}
|
|
718
|
+
if (o === ")" && a > 0) {
|
|
719
|
+
--a, n += o;
|
|
720
|
+
continue;
|
|
721
|
+
}
|
|
722
|
+
if (o === ";" && a === 0) {
|
|
723
|
+
t.push(n), n = "";
|
|
724
|
+
continue;
|
|
725
|
+
}
|
|
730
726
|
}
|
|
727
|
+
n += o;
|
|
731
728
|
}
|
|
732
|
-
n += o;
|
|
733
729
|
}
|
|
734
730
|
return n && t.push(n), t;
|
|
735
731
|
}
|
|
736
|
-
function
|
|
737
|
-
let t = [], n =
|
|
732
|
+
function Bt(e) {
|
|
733
|
+
let t = [], n = zt(e || ""), r = n.length;
|
|
738
734
|
for (let e = 0; e < r; e += 1) {
|
|
739
735
|
let r = n[e], i = r.indexOf(":");
|
|
740
736
|
if (i === -1) continue;
|
|
@@ -743,47 +739,41 @@ function zt(e) {
|
|
|
743
739
|
}
|
|
744
740
|
return t;
|
|
745
741
|
}
|
|
746
|
-
function
|
|
742
|
+
function Vt(...e) {
|
|
747
743
|
return e.filter((e) => !!e).reduce((e, t) => {
|
|
748
744
|
let n = { ...e };
|
|
749
745
|
return Object.entries(t).forEach(([e, t]) => {
|
|
750
|
-
if (e === "__proto__") {
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
}
|
|
759
|
-
if (!n[e]) {
|
|
760
|
-
n[e] = t;
|
|
761
|
-
return;
|
|
762
|
-
}
|
|
763
|
-
if (e === "class") {
|
|
746
|
+
if (e === "__proto__") Object.defineProperty(n, e, {
|
|
747
|
+
configurable: !0,
|
|
748
|
+
enumerable: !0,
|
|
749
|
+
value: t,
|
|
750
|
+
writable: !0
|
|
751
|
+
});
|
|
752
|
+
else if (!n[e]) n[e] = t;
|
|
753
|
+
else if (e === "class") {
|
|
764
754
|
let r = t ? String(t).split(" ") : [], i = n[e] ? n[e].split(" ") : [], a = r.filter((e) => !i.includes(e));
|
|
765
755
|
n[e] = [...i, ...a].join(" ");
|
|
766
756
|
} else if (e === "style") {
|
|
767
|
-
let r = new Map([...
|
|
757
|
+
let r = new Map([...Bt(n[e]), ...Bt(t)]);
|
|
768
758
|
n[e] = Array.from(r.entries()).map(([e, t]) => `${e}: ${t}`).join("; ");
|
|
769
759
|
} else n[e] = t;
|
|
770
760
|
}), n;
|
|
771
761
|
}, {});
|
|
772
762
|
}
|
|
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) =>
|
|
763
|
+
function V(e, t) {
|
|
764
|
+
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
765
|
}
|
|
776
|
-
function
|
|
766
|
+
function Ht(e) {
|
|
777
767
|
return typeof e == "string" ? e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" || e !== "false" && e : e;
|
|
778
768
|
}
|
|
779
|
-
function
|
|
769
|
+
function Ut(e, t) {
|
|
780
770
|
return "style" in e ? e : {
|
|
781
771
|
...e,
|
|
782
772
|
getAttrs: (n) => {
|
|
783
773
|
let r = e.getAttrs ? e.getAttrs(n) : e.attrs;
|
|
784
774
|
if (r === !1) return !1;
|
|
785
775
|
let i = t.reduce((e, t) => {
|
|
786
|
-
let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) :
|
|
776
|
+
let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) : Ht(n.getAttribute(t.name));
|
|
787
777
|
return r == null ? e : {
|
|
788
778
|
...e,
|
|
789
779
|
[t.name]: r
|
|
@@ -796,50 +786,50 @@ function Ht(e, t) {
|
|
|
796
786
|
}
|
|
797
787
|
};
|
|
798
788
|
}
|
|
799
|
-
function Ut(e) {
|
|
800
|
-
return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" && It(t) ? !1 : t != null));
|
|
801
|
-
}
|
|
802
789
|
function Wt(e) {
|
|
790
|
+
return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" && Lt(t) ? !1 : t != null));
|
|
791
|
+
}
|
|
792
|
+
function Gt(e) {
|
|
803
793
|
var t, n;
|
|
804
794
|
let r = {};
|
|
805
795
|
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
796
|
}
|
|
807
|
-
function
|
|
808
|
-
let n =
|
|
797
|
+
function Kt(e, t) {
|
|
798
|
+
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
799
|
let i = n.filter((e) => e.type === r.name), a = {
|
|
810
800
|
name: r.name,
|
|
811
801
|
options: r.options,
|
|
812
802
|
storage: r.storage,
|
|
813
803
|
editor: t
|
|
814
|
-
}, o =
|
|
804
|
+
}, o = Wt({
|
|
815
805
|
...e.reduce((e, t) => {
|
|
816
|
-
let n =
|
|
806
|
+
let n = R(t, "extendNodeSchema", a);
|
|
817
807
|
return {
|
|
818
808
|
...e,
|
|
819
809
|
...n ? n(r) : {}
|
|
820
810
|
};
|
|
821
811
|
}, {}),
|
|
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 =
|
|
812
|
+
content: z(R(r, "content", a)),
|
|
813
|
+
marks: z(R(r, "marks", a)),
|
|
814
|
+
group: z(R(r, "group", a)),
|
|
815
|
+
inline: z(R(r, "inline", a)),
|
|
816
|
+
atom: z(R(r, "atom", a)),
|
|
817
|
+
selectable: z(R(r, "selectable", a)),
|
|
818
|
+
draggable: z(R(r, "draggable", a)),
|
|
819
|
+
code: z(R(r, "code", a)),
|
|
820
|
+
whitespace: z(R(r, "whitespace", a)),
|
|
821
|
+
linebreakReplacement: z(R(r, "linebreakReplacement", a)),
|
|
822
|
+
defining: z(R(r, "defining", a)),
|
|
823
|
+
isolating: z(R(r, "isolating", a)),
|
|
824
|
+
attrs: Object.fromEntries(i.map(Gt))
|
|
825
|
+
}), s = z(R(r, "parseHTML", a));
|
|
826
|
+
s && (o.parseDOM = s.map((e) => Ut(e, i)));
|
|
827
|
+
let c = R(r, "renderHTML", a);
|
|
838
828
|
c && (o.toDOM = (e) => c({
|
|
839
829
|
node: e,
|
|
840
|
-
HTMLAttributes:
|
|
830
|
+
HTMLAttributes: V(e, i)
|
|
841
831
|
}));
|
|
842
|
-
let l =
|
|
832
|
+
let l = R(r, "renderText", a);
|
|
843
833
|
return l && (o.toText = l), [r.name, o];
|
|
844
834
|
})), s = Object.fromEntries(i.map((r) => {
|
|
845
835
|
let i = n.filter((e) => e.type === r.name), a = {
|
|
@@ -847,26 +837,26 @@ function Gt(e, t) {
|
|
|
847
837
|
options: r.options,
|
|
848
838
|
storage: r.storage,
|
|
849
839
|
editor: t
|
|
850
|
-
}, o =
|
|
840
|
+
}, o = Wt({
|
|
851
841
|
...e.reduce((e, t) => {
|
|
852
|
-
let n =
|
|
842
|
+
let n = R(t, "extendMarkSchema", a);
|
|
853
843
|
return {
|
|
854
844
|
...e,
|
|
855
845
|
...n ? n(r) : {}
|
|
856
846
|
};
|
|
857
847
|
}, {}),
|
|
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 =
|
|
848
|
+
inclusive: z(R(r, "inclusive", a)),
|
|
849
|
+
excludes: z(R(r, "excludes", a)),
|
|
850
|
+
group: z(R(r, "group", a)),
|
|
851
|
+
spanning: z(R(r, "spanning", a)),
|
|
852
|
+
code: z(R(r, "code", a)),
|
|
853
|
+
attrs: Object.fromEntries(i.map(Gt))
|
|
854
|
+
}), s = z(R(r, "parseHTML", a));
|
|
855
|
+
s && (o.parseDOM = s.map((e) => Ut(e, i)));
|
|
856
|
+
let c = R(r, "renderHTML", a);
|
|
867
857
|
return c && (o.toDOM = (e) => c({
|
|
868
858
|
mark: e,
|
|
869
|
-
HTMLAttributes:
|
|
859
|
+
HTMLAttributes: V(e, i)
|
|
870
860
|
})), [r.name, o];
|
|
871
861
|
}));
|
|
872
862
|
return new fe({
|
|
@@ -875,21 +865,21 @@ function Gt(e, t) {
|
|
|
875
865
|
marks: s
|
|
876
866
|
});
|
|
877
867
|
}
|
|
878
|
-
function
|
|
868
|
+
function qt(e) {
|
|
879
869
|
let t = e.filter((t, n) => e.indexOf(t) !== n);
|
|
880
870
|
return Array.from(new Set(t));
|
|
881
871
|
}
|
|
882
|
-
function
|
|
872
|
+
function H(e) {
|
|
883
873
|
return e.sort((e, t) => {
|
|
884
|
-
let n =
|
|
874
|
+
let n = R(e, "priority") || 100, r = R(t, "priority") || 100;
|
|
885
875
|
return n > r ? -1 : +(n < r);
|
|
886
876
|
});
|
|
887
877
|
}
|
|
888
|
-
function
|
|
889
|
-
let t =
|
|
878
|
+
function Jt(e) {
|
|
879
|
+
let t = H(Pt(e)), n = qt(t.map((e) => e.name));
|
|
890
880
|
return n.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((e) => `'${e}'`).join(", ")}]. This can lead to issues.`), t;
|
|
891
881
|
}
|
|
892
|
-
function
|
|
882
|
+
function Yt(e, t, n) {
|
|
893
883
|
let { from: r, to: i } = t, { blockSeparator: a = "\n\n", textSerializers: o = {} } = n || {}, s = "";
|
|
894
884
|
return e.nodesBetween(r, i, (e, n, c, l) => {
|
|
895
885
|
e.isBlock && n > r && (s += a);
|
|
@@ -907,16 +897,16 @@ function Jt(e, t, n) {
|
|
|
907
897
|
}
|
|
908
898
|
}), s;
|
|
909
899
|
}
|
|
910
|
-
function
|
|
911
|
-
return
|
|
900
|
+
function Xt(e, t) {
|
|
901
|
+
return Yt(e, {
|
|
912
902
|
from: 0,
|
|
913
903
|
to: e.content.size
|
|
914
904
|
}, t);
|
|
915
905
|
}
|
|
916
|
-
function
|
|
906
|
+
function Zt(e) {
|
|
917
907
|
return Object.fromEntries(Object.entries(e.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText]));
|
|
918
908
|
}
|
|
919
|
-
function
|
|
909
|
+
function Qt(e, t) {
|
|
920
910
|
let n = O(t, e.schema), { from: r, to: i } = e.selection, a = [];
|
|
921
911
|
e.doc.nodesBetween(r, i, (e) => {
|
|
922
912
|
a.push(e);
|
|
@@ -924,22 +914,22 @@ function Zt(e, t) {
|
|
|
924
914
|
let o = a.reverse().find((e) => e.type.name === n.name);
|
|
925
915
|
return o ? { ...o.attrs } : {};
|
|
926
916
|
}
|
|
927
|
-
function
|
|
928
|
-
let n =
|
|
929
|
-
return n === "node" ?
|
|
917
|
+
function $t(e, t) {
|
|
918
|
+
let n = I(typeof t == "string" ? t : t.name, e.schema);
|
|
919
|
+
return n === "node" ? Qt(e, t) : n === "mark" ? At(e, t) : {};
|
|
930
920
|
}
|
|
931
|
-
function
|
|
921
|
+
function en(e, t = JSON.stringify) {
|
|
932
922
|
let n = {};
|
|
933
923
|
return e.filter((e) => {
|
|
934
924
|
let r = t(e);
|
|
935
925
|
return Object.prototype.hasOwnProperty.call(n, r) ? !1 : n[r] = !0;
|
|
936
926
|
});
|
|
937
927
|
}
|
|
938
|
-
function
|
|
939
|
-
let t =
|
|
928
|
+
function tn(e) {
|
|
929
|
+
let t = en(e);
|
|
940
930
|
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
931
|
}
|
|
942
|
-
function
|
|
932
|
+
function nn(e) {
|
|
943
933
|
let { mapping: t, steps: n } = e, r = [];
|
|
944
934
|
return t.maps.forEach((e, i) => {
|
|
945
935
|
let a = [];
|
|
@@ -970,9 +960,9 @@ function tn(e) {
|
|
|
970
960
|
}
|
|
971
961
|
});
|
|
972
962
|
});
|
|
973
|
-
}),
|
|
963
|
+
}), tn(r);
|
|
974
964
|
}
|
|
975
|
-
function
|
|
965
|
+
function rn(e, t, n) {
|
|
976
966
|
let r = [];
|
|
977
967
|
return e === t ? n.resolve(e).marks().forEach((t) => {
|
|
978
968
|
let i = k(n.resolve(e), t.type);
|
|
@@ -988,29 +978,29 @@ function nn(e, t, n) {
|
|
|
988
978
|
})));
|
|
989
979
|
}), r;
|
|
990
980
|
}
|
|
991
|
-
var
|
|
981
|
+
var an = (e, t, n, r = 20) => {
|
|
992
982
|
let i = e.doc.resolve(n), a = r, o = null;
|
|
993
983
|
for (; a > 0 && o === null;) {
|
|
994
984
|
let e = i.node(a);
|
|
995
985
|
e?.type.name === t ? o = e : --a;
|
|
996
986
|
}
|
|
997
987
|
return [o, a];
|
|
998
|
-
},
|
|
988
|
+
}, on = (e) => {
|
|
999
989
|
let t = e.depth - 1;
|
|
1000
990
|
if (t < 0) return null;
|
|
1001
991
|
let n = e.index(t);
|
|
1002
992
|
return n === 0 ? null : e.node(t).child(n - 1);
|
|
1003
993
|
};
|
|
1004
|
-
function
|
|
994
|
+
function U(e, t) {
|
|
1005
995
|
return t.nodes[e] || t.marks[e] || null;
|
|
1006
996
|
}
|
|
1007
|
-
function
|
|
997
|
+
function W(e, t, n) {
|
|
1008
998
|
return Object.fromEntries(Object.entries(n).filter(([n]) => {
|
|
1009
999
|
let r = e.find((e) => e.type === t && e.name === n);
|
|
1010
1000
|
return r ? r.attribute.keepOnSplit : !1;
|
|
1011
1001
|
}));
|
|
1012
1002
|
}
|
|
1013
|
-
var
|
|
1003
|
+
var sn = (e, t = 500) => {
|
|
1014
1004
|
let n = "", r = e.parentOffset;
|
|
1015
1005
|
return e.parent.nodesBetween(Math.max(0, r - t), r, (e, t, i, a) => {
|
|
1016
1006
|
var o;
|
|
@@ -1023,7 +1013,7 @@ var on = (e, t = 500) => {
|
|
|
1023
1013
|
n += e.isAtom && !e.isText ? s : s.slice(0, Math.max(0, r - t));
|
|
1024
1014
|
}), n;
|
|
1025
1015
|
};
|
|
1026
|
-
function
|
|
1016
|
+
function cn(e, t, n = {}) {
|
|
1027
1017
|
let { empty: r, ranges: i } = e.selection, a = t ? A(t, e.schema) : null;
|
|
1028
1018
|
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
1019
|
let o = 0, s = [];
|
|
@@ -1043,38 +1033,38 @@ function sn(e, t, n = {}) {
|
|
|
1043
1033
|
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
1034
|
return (c > 0 ? c + l : c) >= o;
|
|
1045
1035
|
}
|
|
1046
|
-
function
|
|
1047
|
-
if (!t) return
|
|
1048
|
-
let r =
|
|
1049
|
-
return r === "node" ?
|
|
1036
|
+
function ln(e, t, n = {}) {
|
|
1037
|
+
if (!t) return F(e, null, n) || cn(e, null, n);
|
|
1038
|
+
let r = I(t, e.schema);
|
|
1039
|
+
return r === "node" ? F(e, t, n) : r === "mark" && cn(e, t, n);
|
|
1050
1040
|
}
|
|
1051
|
-
var
|
|
1041
|
+
var un = (e, t) => {
|
|
1052
1042
|
let { $from: n, $to: r, $anchor: i } = e.selection;
|
|
1053
1043
|
if (t) {
|
|
1054
|
-
let n =
|
|
1044
|
+
let n = L((e) => e.type.name === t)(e.selection);
|
|
1055
1045
|
if (!n) return !1;
|
|
1056
1046
|
let r = e.doc.resolve(n.pos + 1);
|
|
1057
1047
|
return i.pos + 1 === r.end();
|
|
1058
1048
|
}
|
|
1059
1049
|
return !(r.parentOffset < r.parent.nodeSize - 2 || n.pos !== r.pos);
|
|
1060
|
-
},
|
|
1050
|
+
}, dn = (e) => {
|
|
1061
1051
|
let { $from: t, $to: n } = e.selection;
|
|
1062
1052
|
return !(t.parentOffset > 0 || t.pos !== n.pos);
|
|
1063
1053
|
};
|
|
1064
|
-
function
|
|
1054
|
+
function fn(e, t) {
|
|
1065
1055
|
return Array.isArray(t) ? t.some((t) => (typeof t == "string" ? t : t.name) === e.name) : t;
|
|
1066
1056
|
}
|
|
1067
|
-
function
|
|
1068
|
-
let { nodeExtensions: n } =
|
|
1057
|
+
function pn(e, t) {
|
|
1058
|
+
let { nodeExtensions: n } = B(t), r = n.find((t) => t.name === e);
|
|
1069
1059
|
if (!r) return !1;
|
|
1070
|
-
let i =
|
|
1060
|
+
let i = z(R(r, "group", {
|
|
1071
1061
|
name: r.name,
|
|
1072
1062
|
options: r.options,
|
|
1073
1063
|
storage: r.storage
|
|
1074
1064
|
}));
|
|
1075
1065
|
return typeof i == "string" && i.split(" ").includes("list");
|
|
1076
1066
|
}
|
|
1077
|
-
function
|
|
1067
|
+
function G(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
1078
1068
|
if (n) {
|
|
1079
1069
|
if (e.type.name === "hardBreak") return !0;
|
|
1080
1070
|
if (e.isText) return !/\S/.test(e.text ?? "");
|
|
@@ -1085,7 +1075,7 @@ function K(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1085
1075
|
if (t) {
|
|
1086
1076
|
let r = !0;
|
|
1087
1077
|
return e.content.forEach((e) => {
|
|
1088
|
-
r !== !1 && (
|
|
1078
|
+
r !== !1 && (G(e, {
|
|
1089
1079
|
ignoreWhitespace: n,
|
|
1090
1080
|
checkChildren: t
|
|
1091
1081
|
}) || (r = !1));
|
|
@@ -1093,10 +1083,10 @@ function K(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1093
1083
|
}
|
|
1094
1084
|
return !1;
|
|
1095
1085
|
}
|
|
1096
|
-
function
|
|
1086
|
+
function mn(e) {
|
|
1097
1087
|
return e instanceof n;
|
|
1098
1088
|
}
|
|
1099
|
-
var
|
|
1089
|
+
var hn = class e {
|
|
1100
1090
|
constructor(e) {
|
|
1101
1091
|
this.position = e;
|
|
1102
1092
|
}
|
|
@@ -1107,17 +1097,17 @@ var mn = class e {
|
|
|
1107
1097
|
return { position: this.position };
|
|
1108
1098
|
}
|
|
1109
1099
|
};
|
|
1110
|
-
function
|
|
1100
|
+
function gn(e, t) {
|
|
1111
1101
|
let n = t.mapping.mapResult(e.position);
|
|
1112
1102
|
return {
|
|
1113
|
-
position: new
|
|
1103
|
+
position: new hn(n.pos),
|
|
1114
1104
|
mapResult: n
|
|
1115
1105
|
};
|
|
1116
1106
|
}
|
|
1117
|
-
function
|
|
1118
|
-
return new
|
|
1107
|
+
function _n(e) {
|
|
1108
|
+
return new hn(e);
|
|
1119
1109
|
}
|
|
1120
|
-
function
|
|
1110
|
+
function vn(e, t, n) {
|
|
1121
1111
|
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
1112
|
top: c,
|
|
1123
1113
|
bottom: l,
|
|
@@ -1133,7 +1123,7 @@ function _n(e, t, n) {
|
|
|
1133
1123
|
toJSON: () => f
|
|
1134
1124
|
};
|
|
1135
1125
|
}
|
|
1136
|
-
function
|
|
1126
|
+
function yn(e, t, n) {
|
|
1137
1127
|
let { selection: r } = t, i = null;
|
|
1138
1128
|
if (Ue(r) && (i = r.$cursor), i) {
|
|
1139
1129
|
let t = e.storedMarks ?? i.marks();
|
|
@@ -1152,11 +1142,11 @@ function vn(e, t, n) {
|
|
|
1152
1142
|
}), i;
|
|
1153
1143
|
});
|
|
1154
1144
|
}
|
|
1155
|
-
var
|
|
1145
|
+
var bn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1156
1146
|
let { selection: a } = n, { empty: o, ranges: s } = a, c = A(e, r.schema);
|
|
1157
1147
|
if (i) {
|
|
1158
1148
|
if (o) {
|
|
1159
|
-
let e =
|
|
1149
|
+
let e = At(r, c);
|
|
1160
1150
|
n.addStoredMark(c.create({
|
|
1161
1151
|
...e,
|
|
1162
1152
|
...t
|
|
@@ -1174,8 +1164,8 @@ var yn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1174
1164
|
});
|
|
1175
1165
|
});
|
|
1176
1166
|
}
|
|
1177
|
-
return
|
|
1178
|
-
},
|
|
1167
|
+
return yn(r, n, c);
|
|
1168
|
+
}, xn = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), Sn = (e, t = {}) => ({ state: n, dispatch: r, chain: i }) => {
|
|
1179
1169
|
let a = O(e, n.schema), o;
|
|
1180
1170
|
return n.selection.$anchor.sameParent(n.selection.$head) && (o = n.selection.$anchor.parent.attrs), a.isTextblock ? i().command(({ commands: e }) => ce(a, {
|
|
1181
1171
|
...o,
|
|
@@ -1184,13 +1174,13 @@ var yn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1184
1174
|
...o,
|
|
1185
1175
|
...t
|
|
1186
1176
|
})(e, r)).run() : (console.warn("[tiptap warn]: Currently \"setNode()\" only supports text block nodes."), !1);
|
|
1187
|
-
},
|
|
1177
|
+
}, Cn = (e) => ({ tr: t, dispatch: r }) => {
|
|
1188
1178
|
if (r) {
|
|
1189
1179
|
let { doc: r } = t, i = j(e, 0, r.content.size), a = n.create(r, i);
|
|
1190
1180
|
t.setSelection(a);
|
|
1191
1181
|
}
|
|
1192
1182
|
return !0;
|
|
1193
|
-
},
|
|
1183
|
+
}, wn = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1194
1184
|
let { selection: a } = r, o, s;
|
|
1195
1185
|
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
1186
|
t.isText || n.setNodeMarkup(r, void 0, {
|
|
@@ -1198,7 +1188,7 @@ var yn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1198
1188
|
dir: e
|
|
1199
1189
|
});
|
|
1200
1190
|
}), !0;
|
|
1201
|
-
},
|
|
1191
|
+
}, Tn = (e) => ({ tr: t, dispatch: n }) => {
|
|
1202
1192
|
if (n) {
|
|
1203
1193
|
let { doc: n } = t, { from: r, to: i } = typeof e == "number" ? {
|
|
1204
1194
|
from: e,
|
|
@@ -1207,22 +1197,22 @@ var yn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1207
1197
|
t.setSelection(u);
|
|
1208
1198
|
}
|
|
1209
1199
|
return !0;
|
|
1210
|
-
},
|
|
1200
|
+
}, En = (e) => ({ state: t, dispatch: n }) => {
|
|
1211
1201
|
let r = O(e, t.schema);
|
|
1212
1202
|
return he(r)(t, n);
|
|
1213
1203
|
};
|
|
1214
|
-
function
|
|
1204
|
+
function Dn(e, t) {
|
|
1215
1205
|
let n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
|
|
1216
1206
|
if (n) {
|
|
1217
1207
|
let r = n.filter((e) => t?.includes(e.type.name));
|
|
1218
1208
|
e.tr.ensureMarks(r);
|
|
1219
1209
|
}
|
|
1220
1210
|
}
|
|
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 &&
|
|
1211
|
+
var On = ({ keepMarks: e = !0 } = {}) => ({ tr: r, state: i, dispatch: a, editor: s }) => {
|
|
1212
|
+
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);
|
|
1213
|
+
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
1214
|
if (!u.parent.isBlock) return !1;
|
|
1225
|
-
let h = d.parentOffset === d.parent.content.size, g = u.depth === 0 ? void 0 :
|
|
1215
|
+
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
1216
|
type: g,
|
|
1227
1217
|
attrs: m
|
|
1228
1218
|
}] : void 0, v = c instanceof o && !c.empty ? t.create({
|
|
@@ -1240,10 +1230,10 @@ var Dn = ({ keepMarks: e = !0 } = {}) => ({ tr: r, state: i, dispatch: a, editor
|
|
|
1240
1230
|
u.node(-1).canReplaceWith(n.index(), n.index() + 1, g) && r.setNodeMarkup(r.mapping.slice(e).map(u.before()), g);
|
|
1241
1231
|
}
|
|
1242
1232
|
}
|
|
1243
|
-
e &&
|
|
1233
|
+
e && Dn(i, s.extensionManager.splittableMarks), r.scrollIntoView();
|
|
1244
1234
|
}
|
|
1245
1235
|
return x;
|
|
1246
|
-
},
|
|
1236
|
+
}, kn = (e, t = {}) => ({ tr: n, state: r, dispatch: i, editor: a }) => {
|
|
1247
1237
|
let s = O(e, r.schema), { $from: c, $to: l } = r.selection, u = r.selection.node;
|
|
1248
1238
|
if (u && u.isBlock || c.depth < 2 || !c.sameParent(l)) return !1;
|
|
1249
1239
|
let d = c.node(-1);
|
|
@@ -1255,7 +1245,7 @@ var Dn = ({ keepMarks: e = !0 } = {}) => ({ tr: r, state: i, dispatch: a, editor
|
|
|
1255
1245
|
let e = w.empty, r = c.index(-1) ? 1 : c.index(-2) ? 2 : 3;
|
|
1256
1246
|
for (let t = c.depth - r; t >= c.depth - 3; --t) e = w.from(c.node(t).copy(e));
|
|
1257
1247
|
let i = c.indexAfter(-1) < c.node(-2).childCount ? 1 : c.indexAfter(-2) < c.node(-3).childCount ? 2 : 3, a = {
|
|
1258
|
-
...
|
|
1248
|
+
...W(p, c.node().type.name, c.node().attrs),
|
|
1259
1249
|
...t
|
|
1260
1250
|
}, l = s.contentMatch.defaultType?.createAndFill(a) || void 0;
|
|
1261
1251
|
e = e.append(w.from(s.createAndFill(null, l) || void 0));
|
|
@@ -1270,10 +1260,10 @@ var Dn = ({ keepMarks: e = !0 } = {}) => ({ tr: r, state: i, dispatch: a, editor
|
|
|
1270
1260
|
return !0;
|
|
1271
1261
|
}
|
|
1272
1262
|
let m = l.pos === c.end() ? d.contentMatchAt(0).defaultType : null, h = {
|
|
1273
|
-
...
|
|
1263
|
+
...W(p, d.type.name, d.attrs),
|
|
1274
1264
|
...t
|
|
1275
1265
|
}, g = {
|
|
1276
|
-
...
|
|
1266
|
+
...W(p, c.node().type.name, c.node().attrs),
|
|
1277
1267
|
...t
|
|
1278
1268
|
}, _ = c.parentOffset === 0 && c.index(-1) === 0, v = c.before(-1);
|
|
1279
1269
|
n.delete(c.pos, l.pos);
|
|
@@ -1296,65 +1286,65 @@ var Dn = ({ keepMarks: e = !0 } = {}) => ({ tr: r, state: i, dispatch: a, editor
|
|
|
1296
1286
|
}
|
|
1297
1287
|
return !0;
|
|
1298
1288
|
};
|
|
1299
|
-
function
|
|
1289
|
+
function An(e) {
|
|
1300
1290
|
return !e || e === "1" ? null : e;
|
|
1301
1291
|
}
|
|
1302
|
-
function
|
|
1303
|
-
return
|
|
1292
|
+
function jn(e, t) {
|
|
1293
|
+
return An(e) === An(t);
|
|
1304
1294
|
}
|
|
1305
|
-
var
|
|
1306
|
-
let n =
|
|
1295
|
+
var Mn = (e, t) => {
|
|
1296
|
+
let n = L((e) => e.type === t)(e.selection);
|
|
1307
1297
|
if (!n) return !0;
|
|
1308
1298
|
let r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
|
|
1309
1299
|
if (r === void 0) return !0;
|
|
1310
1300
|
let i = e.doc.nodeAt(r);
|
|
1311
|
-
return !(n.node.type === i?.type && d(e.doc, n.pos)) || !
|
|
1312
|
-
},
|
|
1313
|
-
let n =
|
|
1301
|
+
return !(n.node.type === i?.type && d(e.doc, n.pos)) || !jn(n.node.attrs.type, i?.attrs.type) || e.join(n.pos), !0;
|
|
1302
|
+
}, Nn = (e, t) => {
|
|
1303
|
+
let n = L((e) => e.type === t)(e.selection);
|
|
1314
1304
|
if (!n) return !0;
|
|
1315
1305
|
let r = e.doc.resolve(n.start).after(n.depth);
|
|
1316
1306
|
if (r === void 0) return !0;
|
|
1317
1307
|
let i = e.doc.nodeAt(r);
|
|
1318
|
-
return !(n.node.type === i?.type && d(e.doc, r)) || !
|
|
1308
|
+
return !(n.node.type === i?.type && d(e.doc, r)) || !jn(n.node.attrs.type, i?.attrs.type) || e.join(r), !0;
|
|
1319
1309
|
};
|
|
1320
|
-
function
|
|
1310
|
+
function Pn(e) {
|
|
1321
1311
|
let t = e.doc, n = t.firstChild;
|
|
1322
1312
|
if (!n) return null;
|
|
1323
1313
|
let r = t.resolve(1), i = t.resolve(n.nodeSize - 1);
|
|
1324
1314
|
return o.between(r, i);
|
|
1325
1315
|
}
|
|
1326
|
-
var
|
|
1316
|
+
var Fn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain: c, commands: l, can: u }) => {
|
|
1327
1317
|
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
1318
|
if (!y) return !1;
|
|
1329
|
-
let x =
|
|
1319
|
+
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
1320
|
node: S,
|
|
1331
1321
|
pos: 0,
|
|
1332
1322
|
depth: 0
|
|
1333
1323
|
} : null, C = x ?? ne, re = !!x && y.depth >= 1 && y.depth - x.depth <= 1, ie = !!ne;
|
|
1334
1324
|
if ((re || ie) && C) {
|
|
1335
1325
|
if (C.node.type === p) return ee && ie ? c().command(({ tr: e, dispatch: t }) => {
|
|
1336
|
-
let n =
|
|
1326
|
+
let n = Pn(e);
|
|
1337
1327
|
return n ? (e.setSelection(n), t && t(e), !0) : !1;
|
|
1338
1328
|
}).liftListItem(m).run() : l.liftListItem(m);
|
|
1339
|
-
if (
|
|
1329
|
+
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
1330
|
}
|
|
1341
|
-
return !n || !b || !s ? c().command(() => u().wrapInList(p, r) ? !0 : l.clearNodes()).wrapInList(p, r).command(() =>
|
|
1331
|
+
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
1332
|
let e = u().wrapInList(p, r), t = b.filter((e) => f.includes(e.type.name));
|
|
1343
1333
|
return a.ensureMarks(t), e ? !0 : l.clearNodes();
|
|
1344
|
-
}).wrapInList(p, r).command(() =>
|
|
1345
|
-
},
|
|
1334
|
+
}).wrapInList(p, r).command(() => Mn(a, p)).command(() => Nn(a, p)).run();
|
|
1335
|
+
}, In = (e, t = {}, n = {}) => ({ state: r, commands: i }) => {
|
|
1346
1336
|
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 =
|
|
1337
|
+
return cn(r, o, t) ? i.unsetMark(o, { extendEmptyMarkRange: a }) : i.setMark(o, t);
|
|
1338
|
+
}, Ln = (e, t, n = {}) => ({ state: r, commands: i }) => {
|
|
1339
|
+
let a = O(e, r.schema), o = O(t, r.schema), s = F(r, a, n), c;
|
|
1350
1340
|
return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), s ? i.setNode(o, c) : i.setNode(a, {
|
|
1351
1341
|
...c,
|
|
1352
1342
|
...n
|
|
1353
1343
|
});
|
|
1354
|
-
},
|
|
1344
|
+
}, Rn = (e, t = {}) => ({ state: n, commands: r }) => {
|
|
1355
1345
|
let i = O(e, n.schema);
|
|
1356
|
-
return
|
|
1357
|
-
},
|
|
1346
|
+
return F(n, i, t) ? r.lift(i) : r.wrapIn(i, t);
|
|
1347
|
+
}, zn = () => ({ state: e, dispatch: t }) => {
|
|
1358
1348
|
let n = e.plugins;
|
|
1359
1349
|
for (let r = 0; r < n.length; r += 1) {
|
|
1360
1350
|
let i = n[r], a;
|
|
@@ -1371,7 +1361,7 @@ var Pn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1371
1361
|
}
|
|
1372
1362
|
}
|
|
1373
1363
|
return !1;
|
|
1374
|
-
},
|
|
1364
|
+
}, Bn = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
|
|
1375
1365
|
let { ignoreClearable: i = !1 } = e, { selection: a } = t, { empty: o, ranges: s } = a;
|
|
1376
1366
|
if (o) return !0;
|
|
1377
1367
|
let { nonClearableMarks: c } = r.extensionManager;
|
|
@@ -1382,7 +1372,7 @@ var Pn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1382
1372
|
});
|
|
1383
1373
|
}
|
|
1384
1374
|
return !0;
|
|
1385
|
-
},
|
|
1375
|
+
}, Vn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1386
1376
|
let { extendEmptyMarkRange: a = !1 } = t, { selection: o } = n, s = A(e, r.schema), { $from: c, empty: l, ranges: u } = o;
|
|
1387
1377
|
if (!i) return !0;
|
|
1388
1378
|
if (l && a) {
|
|
@@ -1392,15 +1382,15 @@ var Pn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1392
1382
|
n.removeMark(e.$from.pos, e.$to.pos, s);
|
|
1393
1383
|
});
|
|
1394
1384
|
return n.removeStoredMark(s), !0;
|
|
1395
|
-
},
|
|
1385
|
+
}, Hn = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
1396
1386
|
let { selection: i } = n, a, o;
|
|
1397
1387
|
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
1388
|
if (e.isText) return;
|
|
1399
1389
|
let r = { ...e.attrs };
|
|
1400
1390
|
delete r.dir, t.setNodeMarkup(n, void 0, r);
|
|
1401
1391
|
}), !0;
|
|
1402
|
-
},
|
|
1403
|
-
let a = null, o = null, s =
|
|
1392
|
+
}, Un = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1393
|
+
let a = null, o = null, s = I(typeof e == "string" ? e : e.name, r.schema);
|
|
1404
1394
|
if (!s) return !1;
|
|
1405
1395
|
s === "node" && (a = O(e, r.schema)), s === "mark" && (o = A(e, r.schema));
|
|
1406
1396
|
let c = !1;
|
|
@@ -1431,16 +1421,16 @@ var Pn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1431
1421
|
}));
|
|
1432
1422
|
}));
|
|
1433
1423
|
}), c;
|
|
1434
|
-
},
|
|
1424
|
+
}, K = new i("__tiptap_decorations__"), Wn = (e) => ({ tr: t, dispatch: n }) => (n && t.setMeta(K, {
|
|
1435
1425
|
type: "force",
|
|
1436
1426
|
name: e
|
|
1437
|
-
}), !0),
|
|
1427
|
+
}), !0), Gn = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1438
1428
|
let i = O(e, n.schema);
|
|
1439
1429
|
return le(i, t)(n, r);
|
|
1440
|
-
},
|
|
1430
|
+
}, Kn = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1441
1431
|
let i = O(e, n.schema);
|
|
1442
1432
|
return ge(i, t)(n, r);
|
|
1443
|
-
},
|
|
1433
|
+
}, qn = /* @__PURE__ */ xe({
|
|
1444
1434
|
blur: () => Se,
|
|
1445
1435
|
clearContent: () => Ce,
|
|
1446
1436
|
clearNodes: () => we,
|
|
@@ -1455,68 +1445,68 @@ var Pn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1455
1445
|
exitCode: () => Ie,
|
|
1456
1446
|
extendMarkRange: () => Ve,
|
|
1457
1447
|
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
|
-
|
|
1448
|
+
focus: () => qe,
|
|
1449
|
+
forEach: () => Je,
|
|
1450
|
+
insertContent: () => Ye,
|
|
1451
|
+
insertContentAt: () => et,
|
|
1452
|
+
insertDefaultBlock: () => nt,
|
|
1453
|
+
joinBackward: () => at,
|
|
1454
|
+
joinDown: () => it,
|
|
1455
|
+
joinForward: () => ot,
|
|
1456
|
+
joinItemBackward: () => ct,
|
|
1457
|
+
joinItemForward: () => lt,
|
|
1458
|
+
joinTextblockBackward: () => ut,
|
|
1459
|
+
joinTextblockForward: () => dt,
|
|
1460
|
+
joinUp: () => rt,
|
|
1461
|
+
keyboardShortcut: () => mt,
|
|
1462
|
+
lift: () => ht,
|
|
1463
|
+
liftEmptyBlock: () => gt,
|
|
1464
|
+
liftListItem: () => _t,
|
|
1465
|
+
newlineInCode: () => vt,
|
|
1466
|
+
resetAttributes: () => bt,
|
|
1467
|
+
scrollIntoView: () => xt,
|
|
1468
|
+
selectAll: () => St,
|
|
1469
|
+
selectNodeBackward: () => Ct,
|
|
1470
|
+
selectNodeForward: () => wt,
|
|
1471
|
+
selectParentNode: () => Tt,
|
|
1472
|
+
selectTextblockEnd: () => Et,
|
|
1473
|
+
selectTextblockStart: () => Dt,
|
|
1474
|
+
setContent: () => kt,
|
|
1475
|
+
setMark: () => bn,
|
|
1476
|
+
setMeta: () => xn,
|
|
1477
|
+
setNode: () => Sn,
|
|
1478
|
+
setNodeSelection: () => Cn,
|
|
1479
|
+
setTextDirection: () => wn,
|
|
1480
|
+
setTextSelection: () => Tn,
|
|
1481
|
+
sinkListItem: () => En,
|
|
1482
|
+
splitBlock: () => On,
|
|
1483
|
+
splitListItem: () => kn,
|
|
1484
|
+
toggleList: () => Fn,
|
|
1485
|
+
toggleMark: () => In,
|
|
1486
|
+
toggleNode: () => Ln,
|
|
1487
|
+
toggleWrap: () => Rn,
|
|
1488
|
+
undoInputRule: () => zn,
|
|
1489
|
+
unsetAllMarks: () => Bn,
|
|
1490
|
+
unsetMark: () => Vn,
|
|
1491
|
+
unsetTextDirection: () => Hn,
|
|
1492
|
+
updateAttributes: () => Un,
|
|
1493
|
+
updateDecorations: () => Wn,
|
|
1494
|
+
wrapIn: () => Gn,
|
|
1495
|
+
wrapInList: () => Kn
|
|
1496
|
+
}), q = /* @__PURE__ */ new WeakMap();
|
|
1497
|
+
function Jn(e, t) {
|
|
1498
|
+
q.set(e, (q.get(e) ?? 0) + 1);
|
|
1509
1499
|
try {
|
|
1510
1500
|
return t();
|
|
1511
1501
|
} finally {
|
|
1512
|
-
let t = (
|
|
1513
|
-
t > 0 ?
|
|
1502
|
+
let t = (q.get(e) ?? 1) - 1;
|
|
1503
|
+
t > 0 ? q.set(e, t) : q.delete(e);
|
|
1514
1504
|
}
|
|
1515
1505
|
}
|
|
1516
|
-
function
|
|
1517
|
-
return
|
|
1506
|
+
function Yn(e) {
|
|
1507
|
+
return q.has(e);
|
|
1518
1508
|
}
|
|
1519
|
-
var
|
|
1509
|
+
var Xn = class {
|
|
1520
1510
|
constructor() {
|
|
1521
1511
|
this.callbacks = {};
|
|
1522
1512
|
}
|
|
@@ -1540,44 +1530,44 @@ var Yn = class {
|
|
|
1540
1530
|
removeAllListeners() {
|
|
1541
1531
|
this.callbacks = {};
|
|
1542
1532
|
}
|
|
1543
|
-
},
|
|
1544
|
-
function
|
|
1533
|
+
}, Zn = typeof process < "u" && process.env.NODE_ENV !== "production";
|
|
1534
|
+
function Qn(e) {
|
|
1545
1535
|
return e.kind === "widget";
|
|
1546
1536
|
}
|
|
1547
|
-
function
|
|
1537
|
+
function $n(e, t) {
|
|
1548
1538
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
1549
|
-
for (let i of e) i.kind === "widget" &&
|
|
1539
|
+
for (let i of e) i.kind === "widget" && Qn(i) && r.add(i.key), n.push(i.toPMDecoration(t));
|
|
1550
1540
|
return {
|
|
1551
1541
|
decorations: n,
|
|
1552
1542
|
widgetKeys: r
|
|
1553
1543
|
};
|
|
1554
1544
|
}
|
|
1555
|
-
function
|
|
1556
|
-
let { decorations: r, widgetKeys: i } =
|
|
1545
|
+
function er(e, t, n) {
|
|
1546
|
+
let { decorations: r, widgetKeys: i } = $n(t, n);
|
|
1557
1547
|
return {
|
|
1558
1548
|
set: T.create(e, r),
|
|
1559
1549
|
widgetKeys: i
|
|
1560
1550
|
};
|
|
1561
1551
|
}
|
|
1562
|
-
function
|
|
1552
|
+
function tr({ position: e, from: t, to: n, docSize: r }) {
|
|
1563
1553
|
return e < t ? !1 : e < n || e === n && n === r;
|
|
1564
1554
|
}
|
|
1565
|
-
function
|
|
1566
|
-
return e.filter((e) =>
|
|
1555
|
+
function nr({ decorations: e, from: t, to: n, docSize: r, extensionName: i, warnedExtensions: a }) {
|
|
1556
|
+
return e.filter((e) => tr({
|
|
1567
1557
|
position: e.anchor,
|
|
1568
1558
|
from: t,
|
|
1569
1559
|
to: n,
|
|
1570
1560
|
docSize: r
|
|
1571
1561
|
}) ? !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
1562
|
}
|
|
1573
|
-
function
|
|
1563
|
+
function rr(e) {
|
|
1574
1564
|
let t = e.spec?.key;
|
|
1575
1565
|
return typeof t == "string" ? t : void 0;
|
|
1576
1566
|
}
|
|
1577
|
-
function
|
|
1567
|
+
function ir(e) {
|
|
1578
1568
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
1579
1569
|
for (let r of e.find()) {
|
|
1580
|
-
let e =
|
|
1570
|
+
let e = rr(r);
|
|
1581
1571
|
if (!e) continue;
|
|
1582
1572
|
let i = r.spec.extensionName ?? "unknown", a = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
1583
1573
|
a.add(i), t.set(e, a), n.set(e, (n.get(e) ?? 0) + 1);
|
|
@@ -1587,18 +1577,18 @@ function rr(e) {
|
|
|
1587
1577
|
extensions: t
|
|
1588
1578
|
})).filter(({ key: e }) => (n.get(e) ?? 0) > 1);
|
|
1589
1579
|
}
|
|
1590
|
-
function
|
|
1580
|
+
function ar(e) {
|
|
1591
1581
|
return e.jsonID === "attr";
|
|
1592
1582
|
}
|
|
1593
|
-
function
|
|
1583
|
+
function or(e) {
|
|
1594
1584
|
let t = !1;
|
|
1595
1585
|
if (e.getMap().forEach(() => {
|
|
1596
1586
|
t = !0;
|
|
1597
|
-
}), t ||
|
|
1587
|
+
}), t || ar(e)) return !0;
|
|
1598
1588
|
let n = e;
|
|
1599
1589
|
return typeof n.from == "number" && typeof n.to == "number";
|
|
1600
1590
|
}
|
|
1601
|
-
function
|
|
1591
|
+
function sr(e, t) {
|
|
1602
1592
|
let n = null, r = 0, i = 0;
|
|
1603
1593
|
for (let a = 0; a < e.childCount && !(i > t.to); a += 1) {
|
|
1604
1594
|
let o = i + e.child(a).nodeSize;
|
|
@@ -1609,11 +1599,11 @@ function or(e, t) {
|
|
|
1609
1599
|
to: r
|
|
1610
1600
|
};
|
|
1611
1601
|
}
|
|
1612
|
-
function
|
|
1613
|
-
if (e.steps.some((e) => !
|
|
1614
|
-
let n =
|
|
1602
|
+
function cr(e, t) {
|
|
1603
|
+
if (e.steps.some((e) => !or(e))) return { type: "full" };
|
|
1604
|
+
let n = nn(e).map(({ newRange: e }) => e);
|
|
1615
1605
|
e.steps.forEach((t, r) => {
|
|
1616
|
-
if (!
|
|
1606
|
+
if (!ar(t)) return;
|
|
1617
1607
|
let i = e.mapping.slice(r);
|
|
1618
1608
|
n.push({
|
|
1619
1609
|
from: i.map(t.pos, -1),
|
|
@@ -1622,7 +1612,7 @@ function sr(e, t) {
|
|
|
1622
1612
|
});
|
|
1623
1613
|
let r = [];
|
|
1624
1614
|
for (let e of n) {
|
|
1625
|
-
let n =
|
|
1615
|
+
let n = sr(t, e);
|
|
1626
1616
|
n && r.push(n);
|
|
1627
1617
|
}
|
|
1628
1618
|
r.sort((e, t) => e.from - t.from);
|
|
@@ -1636,29 +1626,29 @@ function sr(e, t) {
|
|
|
1636
1626
|
ranges: i
|
|
1637
1627
|
};
|
|
1638
1628
|
}
|
|
1639
|
-
function
|
|
1629
|
+
function lr(e, t, n, r) {
|
|
1640
1630
|
return e.map(t, n, { onRemove: (e) => {
|
|
1641
1631
|
let t = e?.key;
|
|
1642
1632
|
typeof t == "string" && r.delete(t);
|
|
1643
1633
|
} });
|
|
1644
1634
|
}
|
|
1645
|
-
function
|
|
1635
|
+
function ur(e, t, n) {
|
|
1646
1636
|
let r = t.decorationSetsByExtension[e] ?? T.empty, i = new Set(t.widgetKeysByExtension[e] ?? []);
|
|
1647
1637
|
return {
|
|
1648
|
-
set:
|
|
1638
|
+
set: lr(r, n.mapping, n.doc, i),
|
|
1649
1639
|
widgetKeys: i
|
|
1650
1640
|
};
|
|
1651
1641
|
}
|
|
1652
|
-
function
|
|
1642
|
+
function dr(e, t) {
|
|
1653
1643
|
let n = Object.values(t).flatMap((e) => e.find());
|
|
1654
1644
|
return T.create(e, n);
|
|
1655
1645
|
}
|
|
1656
|
-
function
|
|
1646
|
+
function fr(e) {
|
|
1657
1647
|
let t = /* @__PURE__ */ new Set();
|
|
1658
1648
|
for (let n of Object.values(e)) for (let e of n) t.add(e);
|
|
1659
1649
|
return t;
|
|
1660
1650
|
}
|
|
1661
|
-
function
|
|
1651
|
+
function pr(e, t) {
|
|
1662
1652
|
switch (t.update ?? "document") {
|
|
1663
1653
|
case "document":
|
|
1664
1654
|
if (t.createInRange) throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);
|
|
@@ -1673,21 +1663,21 @@ function fr(e, t) {
|
|
|
1673
1663
|
default: throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`);
|
|
1674
1664
|
}
|
|
1675
1665
|
}
|
|
1676
|
-
function
|
|
1666
|
+
function mr(e, t, n) {
|
|
1677
1667
|
return n ? !0 : e.update === "manual" ? !1 : e.shouldUpdate ? e.shouldUpdate(t) : t.tr.docChanged;
|
|
1678
1668
|
}
|
|
1679
|
-
var
|
|
1669
|
+
var hr = /* @__PURE__ */ new Set(), gr = class {
|
|
1680
1670
|
constructor(e) {
|
|
1681
1671
|
this.warnedWidgetKeys = /* @__PURE__ */ new Set(), this.warnedOutOfRangeExtensions = /* @__PURE__ */ new Set(), this.handleBeforeTransaction = ({ nextState: e }) => {
|
|
1682
|
-
let t =
|
|
1672
|
+
let t = K.getState(e);
|
|
1683
1673
|
t && this.warnDuplicateWidgetKeys(t);
|
|
1684
|
-
}, this.editor = e.editor, this.entries = this.resolveEntries(e.entries), this.entries.forEach(({ name: e, spec: t }) =>
|
|
1674
|
+
}, 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
1675
|
}
|
|
1686
1676
|
destroy() {
|
|
1687
1677
|
this.editor.off("beforeTransaction", this.handleBeforeTransaction);
|
|
1688
1678
|
}
|
|
1689
1679
|
liveWidgetKeys() {
|
|
1690
|
-
return
|
|
1680
|
+
return K.getState(this.editor.state)?.widgetKeys ?? hr;
|
|
1691
1681
|
}
|
|
1692
1682
|
get mountedView() {
|
|
1693
1683
|
return this.editor.isDestroyed ? null : this.editor.view;
|
|
@@ -1706,7 +1696,7 @@ var mr = /* @__PURE__ */ new Set(), hr = class {
|
|
|
1706
1696
|
createPlugin() {
|
|
1707
1697
|
let { editor: e, entries: t } = this;
|
|
1708
1698
|
return new r({
|
|
1709
|
-
key:
|
|
1699
|
+
key: K,
|
|
1710
1700
|
state: {
|
|
1711
1701
|
init: (e, n) => {
|
|
1712
1702
|
let r = {}, i = {};
|
|
@@ -1718,22 +1708,22 @@ var mr = /* @__PURE__ */ new Set(), hr = class {
|
|
|
1718
1708
|
decorationSetsByExtension: r,
|
|
1719
1709
|
widgetKeysByExtension: i,
|
|
1720
1710
|
mergedDecorationSet: this.buildMergedSet(n.doc, r),
|
|
1721
|
-
widgetKeys:
|
|
1711
|
+
widgetKeys: fr(i)
|
|
1722
1712
|
};
|
|
1723
1713
|
return this.warnDuplicateWidgetKeys(a), a;
|
|
1724
1714
|
},
|
|
1725
1715
|
apply: (n, r, i, a) => {
|
|
1726
|
-
let o = n.getMeta(
|
|
1727
|
-
return
|
|
1716
|
+
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();
|
|
1717
|
+
return Jn(e, () => {
|
|
1728
1718
|
for (let { name: o, spec: f } of t) {
|
|
1729
1719
|
let t = s || c === o;
|
|
1730
|
-
if (!
|
|
1720
|
+
if (!mr(f, {
|
|
1731
1721
|
editor: e,
|
|
1732
1722
|
tr: n,
|
|
1733
1723
|
oldState: i,
|
|
1734
1724
|
newState: a
|
|
1735
1725
|
}, t)) {
|
|
1736
|
-
let e =
|
|
1726
|
+
let e = ur(o, r, n);
|
|
1737
1727
|
l[o] = e.set, u[o] = e.widgetKeys;
|
|
1738
1728
|
} else if (f.update === "changedRanges" && n.docChanged && !t) {
|
|
1739
1729
|
let e = this.applyChangedRangesRecompute(o, f, r, n, a);
|
|
@@ -1753,34 +1743,34 @@ var mr = /* @__PURE__ */ new Set(), hr = class {
|
|
|
1753
1743
|
decorationSetsByExtension: l,
|
|
1754
1744
|
recomputedNames: d
|
|
1755
1745
|
}),
|
|
1756
|
-
widgetKeys:
|
|
1746
|
+
widgetKeys: fr(u)
|
|
1757
1747
|
};
|
|
1758
1748
|
}
|
|
1759
1749
|
},
|
|
1760
1750
|
props: { decorations(e) {
|
|
1761
|
-
return
|
|
1751
|
+
return K.getState(e)?.mergedDecorationSet ?? T.empty;
|
|
1762
1752
|
} }
|
|
1763
1753
|
});
|
|
1764
1754
|
}
|
|
1765
1755
|
applyChangedRangesRecompute(e, t, n, r, i) {
|
|
1766
|
-
let a =
|
|
1756
|
+
let a = cr(r, i.doc);
|
|
1767
1757
|
return a.type === "full" ? this.buildFullSet(e, t, i) : this.rebuildRanges(e, t, n, r, i, a.ranges);
|
|
1768
1758
|
}
|
|
1769
1759
|
rebuildRanges(e, t, n, r, i, a) {
|
|
1770
|
-
let o = n.decorationSetsByExtension[e] ?? T.empty, s = new Set(n.widgetKeysByExtension[e] ?? []), c =
|
|
1760
|
+
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
1761
|
for (let { from: n, to: r } of a) {
|
|
1772
|
-
let a = c.find(n, r).filter((e) =>
|
|
1762
|
+
let a = c.find(n, r).filter((e) => tr({
|
|
1773
1763
|
position: e.from,
|
|
1774
1764
|
from: n,
|
|
1775
1765
|
to: r,
|
|
1776
1766
|
docSize: l
|
|
1777
1767
|
}));
|
|
1778
1768
|
for (let e of a) {
|
|
1779
|
-
let t =
|
|
1769
|
+
let t = rr(e);
|
|
1780
1770
|
t && s.delete(t);
|
|
1781
1771
|
}
|
|
1782
1772
|
c = c.remove(a);
|
|
1783
|
-
let { decorations: o, widgetKeys: u } =
|
|
1773
|
+
let { decorations: o, widgetKeys: u } = $n(nr({
|
|
1784
1774
|
decorations: this.runCreate(e, "createInRange", () => t.createInRange({
|
|
1785
1775
|
editor: this.editor,
|
|
1786
1776
|
state: i,
|
|
@@ -1808,7 +1798,7 @@ var mr = /* @__PURE__ */ new Set(), hr = class {
|
|
|
1808
1798
|
state: n,
|
|
1809
1799
|
view: this.mountedView
|
|
1810
1800
|
}));
|
|
1811
|
-
return
|
|
1801
|
+
return er(n.doc, r, e);
|
|
1812
1802
|
}
|
|
1813
1803
|
runCreate(e, t, n) {
|
|
1814
1804
|
try {
|
|
@@ -1818,12 +1808,12 @@ var mr = /* @__PURE__ */ new Set(), hr = class {
|
|
|
1818
1808
|
}
|
|
1819
1809
|
}
|
|
1820
1810
|
warnDuplicateWidgetKeys(e) {
|
|
1821
|
-
if (!
|
|
1811
|
+
if (!Zn) return;
|
|
1822
1812
|
if (e.widgetKeys.size === 0) {
|
|
1823
1813
|
this.warnedWidgetKeys.clear();
|
|
1824
1814
|
return;
|
|
1825
1815
|
}
|
|
1826
|
-
let t =
|
|
1816
|
+
let t = ir(e.mergedDecorationSet), n = new Set(t.map(({ key: e }) => e));
|
|
1827
1817
|
for (let { key: e, extensions: n } of t) {
|
|
1828
1818
|
if (this.warnedWidgetKeys.has(e)) continue;
|
|
1829
1819
|
let t = Array.from(n).map((e) => `"${e}"`).join(", ");
|
|
@@ -1833,13 +1823,13 @@ var mr = /* @__PURE__ */ new Set(), hr = class {
|
|
|
1833
1823
|
}
|
|
1834
1824
|
buildMergedSet(e, t) {
|
|
1835
1825
|
let n = Object.keys(t);
|
|
1836
|
-
return n.length === 1 ? t[n[0]] :
|
|
1826
|
+
return n.length === 1 ? t[n[0]] : dr(e, t);
|
|
1837
1827
|
}
|
|
1838
1828
|
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) :
|
|
1829
|
+
return e.length === 1 ? r[e[0].name] : i.size === 0 ? t.mergedDecorationSet.map(n.mapping, n.doc) : dr(n.doc, r);
|
|
1840
1830
|
}
|
|
1841
1831
|
};
|
|
1842
|
-
function
|
|
1832
|
+
function _r(e, t) {
|
|
1843
1833
|
let { selection: r } = e, { $from: i } = r;
|
|
1844
1834
|
if (r instanceof n) {
|
|
1845
1835
|
let e = i.index();
|
|
@@ -1853,16 +1843,16 @@ function gr(e, t) {
|
|
|
1853
1843
|
}
|
|
1854
1844
|
return !1;
|
|
1855
1845
|
}
|
|
1856
|
-
function
|
|
1846
|
+
function vr(e, t, n) {
|
|
1857
1847
|
let r = document.querySelector(`style[data-tiptap-style${n ? `-${n}` : ""}]`);
|
|
1858
1848
|
if (r !== null) return r;
|
|
1859
1849
|
let i = document.createElement("style");
|
|
1860
1850
|
return t && i.setAttribute("nonce", t), i.setAttribute(`data-tiptap-style${n ? `-${n}` : ""}`, ""), i.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(i), i;
|
|
1861
1851
|
}
|
|
1862
|
-
function
|
|
1852
|
+
function yr(e) {
|
|
1863
1853
|
return e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
1864
1854
|
}
|
|
1865
|
-
function
|
|
1855
|
+
function br(e, t) {
|
|
1866
1856
|
let n = e.getAttribute("style");
|
|
1867
1857
|
if (!n) return null;
|
|
1868
1858
|
let r = n.split(";").map((e) => e.trim()).filter(Boolean), i = t.toLowerCase();
|
|
@@ -1872,22 +1862,22 @@ function yr(e, t) {
|
|
|
1872
1862
|
}
|
|
1873
1863
|
return null;
|
|
1874
1864
|
}
|
|
1875
|
-
function
|
|
1865
|
+
function xr() {
|
|
1876
1866
|
return typeof navigator < "u" && /Firefox/.test(navigator.userAgent);
|
|
1877
1867
|
}
|
|
1878
|
-
function
|
|
1868
|
+
function Sr(e) {
|
|
1879
1869
|
return typeof e == "number";
|
|
1880
1870
|
}
|
|
1881
|
-
function
|
|
1871
|
+
function Cr(e) {
|
|
1882
1872
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
1883
1873
|
}
|
|
1884
|
-
function
|
|
1885
|
-
return
|
|
1874
|
+
function J(e) {
|
|
1875
|
+
return Cr(e) === "Object" && e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
|
|
1886
1876
|
}
|
|
1887
|
-
function
|
|
1877
|
+
function wr(e) {
|
|
1888
1878
|
return typeof e == "string" && e.trim().length > 0 && !/[;{}]/.test(e);
|
|
1889
1879
|
}
|
|
1890
|
-
function
|
|
1880
|
+
function Tr(e, t, n) {
|
|
1891
1881
|
let r = e.split("\n"), i = [], a = "", o = 0, s = t.baseIndentSize || 2;
|
|
1892
1882
|
for (; o < r.length;) {
|
|
1893
1883
|
let e = r[o], u = e.match(t.itemPattern);
|
|
@@ -1931,13 +1921,13 @@ function wr(e, t, n) {
|
|
|
1931
1921
|
raw: a
|
|
1932
1922
|
};
|
|
1933
1923
|
}
|
|
1934
|
-
var
|
|
1935
|
-
function
|
|
1924
|
+
var Er = 4;
|
|
1925
|
+
function Dr(e) {
|
|
1936
1926
|
let t = 0;
|
|
1937
|
-
for (let n of e) t = n === " " ? t +
|
|
1927
|
+
for (let n of e) t = n === " " ? t + Er - t % Er : t + 1;
|
|
1938
1928
|
return t;
|
|
1939
1929
|
}
|
|
1940
|
-
function
|
|
1930
|
+
function Or(e, t, n, r, i) {
|
|
1941
1931
|
if (!e || !Array.isArray(e.content)) return "";
|
|
1942
1932
|
let a = typeof n == "function" ? n(r) : n, [o, ...s] = e.content, c = `${a}${t.renderChildren([o])}`;
|
|
1943
1933
|
return s && s.length > 0 && s.forEach((e, n) => {
|
|
@@ -1945,20 +1935,20 @@ function Dr(e, t, n, r, i) {
|
|
|
1945
1935
|
if (r != null) {
|
|
1946
1936
|
let n = (e) => {
|
|
1947
1937
|
if (!i?.alignNestedToPrefix) return t.indent(e);
|
|
1948
|
-
let n = t.indent(""), r =
|
|
1949
|
-
return (
|
|
1938
|
+
let n = t.indent(""), r = Dr(a);
|
|
1939
|
+
return (Dr(n) >= r ? n : " ".repeat(r)) + e;
|
|
1950
1940
|
}, o = r.split("\n").map((e) => n(e || "")).join("\n");
|
|
1951
1941
|
c += e.type === "paragraph" ? `\n\n${o}` : `\n${o}`;
|
|
1952
1942
|
}
|
|
1953
1943
|
}), c;
|
|
1954
1944
|
}
|
|
1955
|
-
function
|
|
1945
|
+
function kr(e, t) {
|
|
1956
1946
|
let n = { ...e };
|
|
1957
|
-
return
|
|
1958
|
-
|
|
1947
|
+
return J(e) && J(t) && Object.keys(t).forEach((r) => {
|
|
1948
|
+
J(t[r]) && J(e[r]) ? n[r] = kr(e[r], t[r]) : n[r] = t[r];
|
|
1959
1949
|
}), n;
|
|
1960
1950
|
}
|
|
1961
|
-
function
|
|
1951
|
+
function Ar(e, t, n = {}) {
|
|
1962
1952
|
let { state: r } = t, { doc: i, tr: a } = r, o = e;
|
|
1963
1953
|
i.descendants((t, r) => {
|
|
1964
1954
|
let i = a.mapping.map(r), s = a.mapping.map(r) + t.nodeSize, c = null;
|
|
@@ -1978,18 +1968,18 @@ function kr(e, t, n = {}) {
|
|
|
1978
1968
|
}
|
|
1979
1969
|
}), a.docChanged && t.view.dispatch(a);
|
|
1980
1970
|
}
|
|
1981
|
-
var
|
|
1971
|
+
var Y = class {
|
|
1982
1972
|
constructor(e) {
|
|
1983
1973
|
this.find = e.find, this.handler = e.handler, this.undoable = e.undoable ?? !0;
|
|
1984
1974
|
}
|
|
1985
|
-
},
|
|
1975
|
+
}, jr = (e, t) => {
|
|
1986
1976
|
if (Le(t)) return t.exec(e);
|
|
1987
1977
|
let n = t(e);
|
|
1988
1978
|
if (!n) return null;
|
|
1989
1979
|
let r = [n.text];
|
|
1990
1980
|
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
1981
|
};
|
|
1992
|
-
function
|
|
1982
|
+
function Mr(e) {
|
|
1993
1983
|
let { editor: n, from: r, to: i, text: a, insertText: o } = e;
|
|
1994
1984
|
if (!o) return {
|
|
1995
1985
|
inputTransaction: null,
|
|
@@ -2005,8 +1995,8 @@ function jr(e) {
|
|
|
2005
1995
|
}).tr
|
|
2006
1996
|
};
|
|
2007
1997
|
}
|
|
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 } =
|
|
1998
|
+
function Nr(e) {
|
|
1999
|
+
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
2000
|
editor: t,
|
|
2011
2001
|
from: n,
|
|
2012
2002
|
to: r,
|
|
@@ -2029,28 +2019,28 @@ function Mr(e) {
|
|
|
2029
2019
|
commands: h,
|
|
2030
2020
|
chain: g,
|
|
2031
2021
|
can: _
|
|
2032
|
-
}) === null || !d.steps.length ? !1 : u && (l.dispatch(u), !l.state.doc.eq(u.doc))
|
|
2022
|
+
}) === null || !d.steps.length ? !1 : (u && (l.dispatch(u), !l.state.doc.eq(u.doc)) || (ye(d), d.setMeta("inputRule", !0), a.undoable && d.setMeta(s, {
|
|
2033
2023
|
transform: d,
|
|
2034
2024
|
from: n,
|
|
2035
2025
|
to: f,
|
|
2036
2026
|
text: i
|
|
2037
|
-
}), l.dispatch(d), !0);
|
|
2027
|
+
}), l.dispatch(d)), !0);
|
|
2038
2028
|
}
|
|
2039
|
-
function
|
|
2029
|
+
function Pr(e, t, n) {
|
|
2040
2030
|
let r = t[0].length - n.length;
|
|
2041
2031
|
if (r <= 0) return !0;
|
|
2042
2032
|
let i = e.parentOffset - r;
|
|
2043
2033
|
return i >= 0 && e.parent.textBetween(i, e.parentOffset) === t[0].slice(0, r);
|
|
2044
2034
|
}
|
|
2045
|
-
function
|
|
2035
|
+
function X(e) {
|
|
2046
2036
|
let { editor: t, from: n, to: r, text: i, rules: a, plugin: o, insertText: s } = e, { view: c } = t;
|
|
2047
2037
|
if (c.composing) return !1;
|
|
2048
2038
|
let l = c.state.doc.resolve(n);
|
|
2049
2039
|
if (l.parent.type.spec.code || (l.nodeBefore || l.nodeAfter)?.marks.find((e) => e.type.spec.code)) return !1;
|
|
2050
|
-
let u =
|
|
2040
|
+
let u = sn(l) + i;
|
|
2051
2041
|
for (let e of a) {
|
|
2052
|
-
let a =
|
|
2053
|
-
if (a &&
|
|
2042
|
+
let a = jr(u, e.find);
|
|
2043
|
+
if (a && Pr(l, a, i) && Nr({
|
|
2054
2044
|
editor: t,
|
|
2055
2045
|
from: n,
|
|
2056
2046
|
to: r,
|
|
@@ -2063,7 +2053,7 @@ function Z(e) {
|
|
|
2063
2053
|
}
|
|
2064
2054
|
return !1;
|
|
2065
2055
|
}
|
|
2066
|
-
function
|
|
2056
|
+
function Fr(e) {
|
|
2067
2057
|
let { editor: t, rules: n } = e, i = new r({
|
|
2068
2058
|
state: {
|
|
2069
2059
|
init() {
|
|
@@ -2075,9 +2065,9 @@ function Pr(e) {
|
|
|
2075
2065
|
let s = e.getMeta("applyInputRules");
|
|
2076
2066
|
return s && setTimeout(() => {
|
|
2077
2067
|
let { text: e } = s;
|
|
2078
|
-
e = typeof e == "string" ? e :
|
|
2068
|
+
e = typeof e == "string" ? e : Ft(w.from(e), a.schema);
|
|
2079
2069
|
let { from: r } = s, o = r + e.length;
|
|
2080
|
-
|
|
2070
|
+
X({
|
|
2081
2071
|
editor: t,
|
|
2082
2072
|
from: r,
|
|
2083
2073
|
to: o,
|
|
@@ -2090,7 +2080,7 @@ function Pr(e) {
|
|
|
2090
2080
|
},
|
|
2091
2081
|
props: {
|
|
2092
2082
|
handleTextInput(e, r, a, o) {
|
|
2093
|
-
return
|
|
2083
|
+
return X({
|
|
2094
2084
|
editor: t,
|
|
2095
2085
|
from: r,
|
|
2096
2086
|
to: a,
|
|
@@ -2102,7 +2092,7 @@ function Pr(e) {
|
|
|
2102
2092
|
},
|
|
2103
2093
|
handleDOMEvents: { compositionend: (e) => (setTimeout(() => {
|
|
2104
2094
|
let { $cursor: r } = e.state.selection;
|
|
2105
|
-
r &&
|
|
2095
|
+
r && X({
|
|
2106
2096
|
editor: t,
|
|
2107
2097
|
from: r.pos,
|
|
2108
2098
|
to: r.pos,
|
|
@@ -2114,7 +2104,7 @@ function Pr(e) {
|
|
|
2114
2104
|
handleKeyDown(e, r) {
|
|
2115
2105
|
if (r.key !== "Enter") return !1;
|
|
2116
2106
|
let { $cursor: a } = e.state.selection;
|
|
2117
|
-
return a ?
|
|
2107
|
+
return a ? X({
|
|
2118
2108
|
editor: t,
|
|
2119
2109
|
from: a.pos,
|
|
2120
2110
|
to: a.pos,
|
|
@@ -2128,7 +2118,7 @@ function Pr(e) {
|
|
|
2128
2118
|
});
|
|
2129
2119
|
return i;
|
|
2130
2120
|
}
|
|
2131
|
-
var
|
|
2121
|
+
var Ir = class {
|
|
2132
2122
|
constructor(e = {}) {
|
|
2133
2123
|
this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = { name: this.name }, this.config = {
|
|
2134
2124
|
...this.config,
|
|
@@ -2136,10 +2126,10 @@ var Fr = class {
|
|
|
2136
2126
|
}, this.name = this.config.name;
|
|
2137
2127
|
}
|
|
2138
2128
|
get options() {
|
|
2139
|
-
return { ...
|
|
2129
|
+
return { ...z(R(this, "addOptions", { name: this.name })) };
|
|
2140
2130
|
}
|
|
2141
2131
|
get storage() {
|
|
2142
|
-
return { ...
|
|
2132
|
+
return { ...z(R(this, "addStorage", {
|
|
2143
2133
|
name: this.name,
|
|
2144
2134
|
options: this.options
|
|
2145
2135
|
})) };
|
|
@@ -2147,7 +2137,7 @@ var Fr = class {
|
|
|
2147
2137
|
configure(e = {}) {
|
|
2148
2138
|
let t = this.extend({
|
|
2149
2139
|
...this.config,
|
|
2150
|
-
addOptions: () =>
|
|
2140
|
+
addOptions: () => kr(this.options, e)
|
|
2151
2141
|
});
|
|
2152
2142
|
return t.name = this.name, t.parent = this.parent, this.child = null, t;
|
|
2153
2143
|
}
|
|
@@ -2158,7 +2148,7 @@ var Fr = class {
|
|
|
2158
2148
|
});
|
|
2159
2149
|
return t.parent = this, this.child = t, t.name = "name" in e ? e.name : t.parent.name, t;
|
|
2160
2150
|
}
|
|
2161
|
-
},
|
|
2151
|
+
}, Lr = class e extends Ir {
|
|
2162
2152
|
constructor(...e) {
|
|
2163
2153
|
super(...e), this.type = "mark";
|
|
2164
2154
|
}
|
|
@@ -2183,11 +2173,11 @@ var Fr = class {
|
|
|
2183
2173
|
let t = typeof e == "function" ? e() : e;
|
|
2184
2174
|
return super.extend(t);
|
|
2185
2175
|
}
|
|
2186
|
-
},
|
|
2176
|
+
}, Rr = class {
|
|
2187
2177
|
constructor(e) {
|
|
2188
2178
|
this.find = e.find, this.handler = e.handler;
|
|
2189
2179
|
}
|
|
2190
|
-
},
|
|
2180
|
+
}, zr = (e, t, n) => {
|
|
2191
2181
|
if (Le(t)) return [...e.matchAll(t)];
|
|
2192
2182
|
let r = t(e, n);
|
|
2193
2183
|
return r ? r.map((t) => {
|
|
@@ -2195,7 +2185,7 @@ var Fr = class {
|
|
|
2195
2185
|
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
2186
|
}) : [];
|
|
2197
2187
|
};
|
|
2198
|
-
function
|
|
2188
|
+
function Br(e) {
|
|
2199
2189
|
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
2190
|
editor: t,
|
|
2201
2191
|
state: n
|
|
@@ -2204,7 +2194,7 @@ function zr(e) {
|
|
|
2204
2194
|
var f;
|
|
2205
2195
|
if ((f = e.type) != null && (f = f.spec) != null && f.code || !(e.isText || e.isTextblock || e.isInline)) return;
|
|
2206
2196
|
let p = e.content?.size ?? e.nodeSize ?? 0, m = Math.max(r, t), h = Math.min(i, t + p);
|
|
2207
|
-
m >= h ||
|
|
2197
|
+
m >= h || zr(e.isText ? e.text || "" : e.textBetween(m - t, h - t, void 0, ""), a.find, o).forEach((e) => {
|
|
2208
2198
|
if (e.index === void 0) return;
|
|
2209
2199
|
let t = m + e.index + 1, r = t + e[0].length, i = {
|
|
2210
2200
|
from: n.tr.mapping.map(t),
|
|
@@ -2223,12 +2213,12 @@ function zr(e) {
|
|
|
2223
2213
|
});
|
|
2224
2214
|
}), d.every((e) => e !== null);
|
|
2225
2215
|
}
|
|
2226
|
-
var
|
|
2216
|
+
var Z = null, Vr = (e) => {
|
|
2227
2217
|
var t;
|
|
2228
2218
|
let n = new ClipboardEvent("paste", { clipboardData: new DataTransfer() });
|
|
2229
2219
|
return (t = n.clipboardData) == null || t.setData("text/html", e), n;
|
|
2230
2220
|
};
|
|
2231
|
-
function
|
|
2221
|
+
function Hr(e) {
|
|
2232
2222
|
let { editor: t, rules: n } = e, i = null, a = !1, o = !1, s = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, c;
|
|
2233
2223
|
try {
|
|
2234
2224
|
c = typeof DragEvent < "u" ? new DragEvent("drop") : null;
|
|
@@ -2240,7 +2230,7 @@ function Vr(e) {
|
|
|
2240
2230
|
state: e,
|
|
2241
2231
|
transaction: o
|
|
2242
2232
|
});
|
|
2243
|
-
if (
|
|
2233
|
+
if (Br({
|
|
2244
2234
|
editor: t,
|
|
2245
2235
|
state: l,
|
|
2246
2236
|
from: Math.max(n - 1, 0),
|
|
@@ -2258,13 +2248,13 @@ function Vr(e) {
|
|
|
2258
2248
|
}
|
|
2259
2249
|
};
|
|
2260
2250
|
return t.on("destroy", () => {
|
|
2261
|
-
|
|
2251
|
+
Z === t && (Z = null);
|
|
2262
2252
|
}), n.map((e) => new r({
|
|
2263
2253
|
view(e) {
|
|
2264
2254
|
let n = (n) => {
|
|
2265
|
-
i = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, i && (
|
|
2255
|
+
i = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, i && (Z = t);
|
|
2266
2256
|
}, r = () => {
|
|
2267
|
-
|
|
2257
|
+
Z &&= null;
|
|
2268
2258
|
};
|
|
2269
2259
|
return window.addEventListener("dragstart", n), window.addEventListener("dragend", r), { destroy() {
|
|
2270
2260
|
window.removeEventListener("dragstart", n), window.removeEventListener("dragend", r);
|
|
@@ -2273,7 +2263,7 @@ function Vr(e) {
|
|
|
2273
2263
|
props: { handleDOMEvents: {
|
|
2274
2264
|
drop: (e, t) => {
|
|
2275
2265
|
if (o = i === e.dom.parentElement, c = t, !o) {
|
|
2276
|
-
let e =
|
|
2266
|
+
let e = Z;
|
|
2277
2267
|
e?.isEditable && setTimeout(() => {
|
|
2278
2268
|
if (e.isDestroyed) return;
|
|
2279
2269
|
let t = e.state.selection;
|
|
@@ -2295,8 +2285,8 @@ function Vr(e) {
|
|
|
2295
2285
|
if (!c && !u && !f) return;
|
|
2296
2286
|
if (f) {
|
|
2297
2287
|
let { text: t } = d;
|
|
2298
|
-
t = typeof t == "string" ? t :
|
|
2299
|
-
let { from: n } = d, i = n + t.length, a =
|
|
2288
|
+
t = typeof t == "string" ? t : Ft(w.from(t), r.schema);
|
|
2289
|
+
let { from: n } = d, i = n + t.length, a = Vr(t);
|
|
2300
2290
|
return l({
|
|
2301
2291
|
rule: e,
|
|
2302
2292
|
state: r,
|
|
@@ -2306,7 +2296,7 @@ function Vr(e) {
|
|
|
2306
2296
|
});
|
|
2307
2297
|
}
|
|
2308
2298
|
let p = n.doc.content.findDiffStart(r.doc.content), m = n.doc.content.findDiffEnd(r.doc.content);
|
|
2309
|
-
if (
|
|
2299
|
+
if (Sr(p) && m && p !== m.b) return l({
|
|
2310
2300
|
rule: e,
|
|
2311
2301
|
state: r,
|
|
2312
2302
|
from: p,
|
|
@@ -2316,18 +2306,18 @@ function Vr(e) {
|
|
|
2316
2306
|
}
|
|
2317
2307
|
}));
|
|
2318
2308
|
}
|
|
2319
|
-
var
|
|
2309
|
+
var Q = class {
|
|
2320
2310
|
constructor(e, t) {
|
|
2321
|
-
this.splittableMarks = [], this.nonClearableMarks = [], this.decorationManager = null, this.editor = t, this.baseExtensions = e, this.extensions =
|
|
2311
|
+
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
2312
|
}
|
|
2323
2313
|
get commands() {
|
|
2324
2314
|
return this.extensions.reduce((e, t) => {
|
|
2325
|
-
let n =
|
|
2315
|
+
let n = R(t, "addCommands", {
|
|
2326
2316
|
name: t.name,
|
|
2327
2317
|
options: t.options,
|
|
2328
2318
|
storage: this.editor.extensionStorage[t.name],
|
|
2329
2319
|
editor: this.editor,
|
|
2330
|
-
type:
|
|
2320
|
+
type: U(t.name, this.schema)
|
|
2331
2321
|
});
|
|
2332
2322
|
return n ? {
|
|
2333
2323
|
...e,
|
|
@@ -2336,15 +2326,15 @@ var Hr = class {
|
|
|
2336
2326
|
}, {});
|
|
2337
2327
|
}
|
|
2338
2328
|
get plugins() {
|
|
2339
|
-
let { editor: e } = this, t =
|
|
2329
|
+
let { editor: e } = this, t = H([...this.extensions].reverse()).flatMap((t) => {
|
|
2340
2330
|
let n = {
|
|
2341
2331
|
name: t.name,
|
|
2342
2332
|
options: t.options,
|
|
2343
2333
|
storage: this.editor.extensionStorage[t.name],
|
|
2344
2334
|
editor: e,
|
|
2345
|
-
type:
|
|
2346
|
-
}, r = [], i =
|
|
2347
|
-
if (t.type === "mark" &&
|
|
2335
|
+
type: U(t.name, this.schema)
|
|
2336
|
+
}, r = [], i = R(t, "addKeyboardShortcuts", n), a = {};
|
|
2337
|
+
if (t.type === "mark" && R(t, "exitable", n) && (a.ArrowRight = () => Lr.handleExit({
|
|
2348
2338
|
editor: e,
|
|
2349
2339
|
mark: t
|
|
2350
2340
|
})), i) {
|
|
@@ -2356,29 +2346,29 @@ var Hr = class {
|
|
|
2356
2346
|
}
|
|
2357
2347
|
let o = ve(a);
|
|
2358
2348
|
r.push(o);
|
|
2359
|
-
let s =
|
|
2360
|
-
if (
|
|
2349
|
+
let s = R(t, "addInputRules", n);
|
|
2350
|
+
if (fn(t, e.options.enableInputRules) && s) {
|
|
2361
2351
|
let t = s();
|
|
2362
2352
|
if (t && t.length) {
|
|
2363
|
-
let n =
|
|
2353
|
+
let n = Fr({
|
|
2364
2354
|
editor: e,
|
|
2365
2355
|
rules: t
|
|
2366
2356
|
}), i = Array.isArray(n) ? n : [n];
|
|
2367
2357
|
r.push(...i);
|
|
2368
2358
|
}
|
|
2369
2359
|
}
|
|
2370
|
-
let c =
|
|
2371
|
-
if (
|
|
2360
|
+
let c = R(t, "addPasteRules", n);
|
|
2361
|
+
if (fn(t, e.options.enablePasteRules) && c) {
|
|
2372
2362
|
let t = c();
|
|
2373
2363
|
if (t && t.length) {
|
|
2374
|
-
let n =
|
|
2364
|
+
let n = Hr({
|
|
2375
2365
|
editor: e,
|
|
2376
2366
|
rules: t
|
|
2377
2367
|
});
|
|
2378
2368
|
r.push(...n);
|
|
2379
2369
|
}
|
|
2380
2370
|
}
|
|
2381
|
-
let l =
|
|
2371
|
+
let l = R(t, "addProseMirrorPlugins", n);
|
|
2382
2372
|
if (l) {
|
|
2383
2373
|
let e = l();
|
|
2384
2374
|
r.push(...e);
|
|
@@ -2393,29 +2383,29 @@ var Hr = class {
|
|
|
2393
2383
|
(e = this.decorationManager) == null || e.destroy();
|
|
2394
2384
|
let n = [];
|
|
2395
2385
|
return this.extensions.forEach((e) => {
|
|
2396
|
-
let r =
|
|
2386
|
+
let r = R(e, "addDecorations", {
|
|
2397
2387
|
name: e.name,
|
|
2398
2388
|
options: e.options,
|
|
2399
2389
|
storage: this.editor.extensionStorage[e.name],
|
|
2400
2390
|
editor: t,
|
|
2401
|
-
type:
|
|
2391
|
+
type: U(e.name, this.schema)
|
|
2402
2392
|
});
|
|
2403
2393
|
r && n.push({
|
|
2404
2394
|
name: e.name,
|
|
2405
2395
|
addDecorations: r
|
|
2406
2396
|
});
|
|
2407
|
-
}), this.decorationManager = new
|
|
2397
|
+
}), this.decorationManager = new gr({
|
|
2408
2398
|
editor: t,
|
|
2409
2399
|
entries: n
|
|
2410
2400
|
}), this.decorationManager.plugin;
|
|
2411
2401
|
}
|
|
2412
2402
|
get attributes() {
|
|
2413
|
-
return
|
|
2403
|
+
return Rt(this.extensions);
|
|
2414
2404
|
}
|
|
2415
2405
|
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 =
|
|
2406
|
+
let { editor: e } = this, { nodeExtensions: t } = B(this.extensions);
|
|
2407
|
+
return Object.fromEntries(t.filter((e) => !!R(e, "addNodeView")).map((t) => {
|
|
2408
|
+
let n = this.attributes.filter((e) => e.type === t.name), r = R(t, "addNodeView", {
|
|
2419
2409
|
name: t.name,
|
|
2420
2410
|
options: t.options,
|
|
2421
2411
|
storage: this.editor.extensionStorage[t.name],
|
|
@@ -2425,7 +2415,7 @@ var Hr = class {
|
|
|
2425
2415
|
if (!r) return [];
|
|
2426
2416
|
let i = r();
|
|
2427
2417
|
return i ? [t.name, (r, a, o, s, c) => {
|
|
2428
|
-
let l =
|
|
2418
|
+
let l = V(r, n);
|
|
2429
2419
|
return i({
|
|
2430
2420
|
node: r,
|
|
2431
2421
|
view: a,
|
|
@@ -2441,14 +2431,14 @@ var Hr = class {
|
|
|
2441
2431
|
}
|
|
2442
2432
|
dispatchTransaction(e) {
|
|
2443
2433
|
let { editor: t } = this;
|
|
2444
|
-
return
|
|
2434
|
+
return H([...this.extensions].reverse()).reduceRight((e, n) => {
|
|
2445
2435
|
let r = {
|
|
2446
2436
|
name: n.name,
|
|
2447
2437
|
options: n.options,
|
|
2448
2438
|
storage: this.editor.extensionStorage[n.name],
|
|
2449
2439
|
editor: t,
|
|
2450
|
-
type:
|
|
2451
|
-
}, i =
|
|
2440
|
+
type: U(n.name, this.schema)
|
|
2441
|
+
}, i = R(n, "dispatchTransaction", r);
|
|
2452
2442
|
return i ? (t) => {
|
|
2453
2443
|
i.call(r, {
|
|
2454
2444
|
transaction: t,
|
|
@@ -2459,14 +2449,14 @@ var Hr = class {
|
|
|
2459
2449
|
}
|
|
2460
2450
|
transformPastedHTML(e) {
|
|
2461
2451
|
let { editor: t } = this;
|
|
2462
|
-
return
|
|
2452
|
+
return H([...this.extensions]).reduce((e, n) => {
|
|
2463
2453
|
let r = {
|
|
2464
2454
|
name: n.name,
|
|
2465
2455
|
options: n.options,
|
|
2466
2456
|
storage: this.editor.extensionStorage[n.name],
|
|
2467
2457
|
editor: t,
|
|
2468
|
-
type:
|
|
2469
|
-
}, i =
|
|
2458
|
+
type: U(n.name, this.schema)
|
|
2459
|
+
}, i = R(n, "transformPastedHTML", r);
|
|
2470
2460
|
return i ? (t, n) => {
|
|
2471
2461
|
let a = e(t, n);
|
|
2472
2462
|
return i.call(r, a);
|
|
@@ -2474,9 +2464,9 @@ var Hr = class {
|
|
|
2474
2464
|
}, e || ((e) => e));
|
|
2475
2465
|
}
|
|
2476
2466
|
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 =
|
|
2467
|
+
let { editor: e } = this, { markExtensions: t } = B(this.extensions);
|
|
2468
|
+
return Object.fromEntries(t.filter((e) => !!R(e, "addMarkView")).map((t) => {
|
|
2469
|
+
let n = this.attributes.filter((e) => e.type === t.name), r = R(t, "addMarkView", {
|
|
2480
2470
|
name: t.name,
|
|
2481
2471
|
options: t.options,
|
|
2482
2472
|
storage: this.editor.extensionStorage[t.name],
|
|
@@ -2484,7 +2474,7 @@ var Hr = class {
|
|
|
2484
2474
|
type: A(t.name, this.schema)
|
|
2485
2475
|
});
|
|
2486
2476
|
return r ? [t.name, (i, a, o) => {
|
|
2487
|
-
let s =
|
|
2477
|
+
let s = V(i, n);
|
|
2488
2478
|
return r()({
|
|
2489
2479
|
mark: i,
|
|
2490
2480
|
view: a,
|
|
@@ -2493,7 +2483,7 @@ var Hr = class {
|
|
|
2493
2483
|
extension: t,
|
|
2494
2484
|
HTMLAttributes: s,
|
|
2495
2485
|
updateAttributes: (t) => {
|
|
2496
|
-
|
|
2486
|
+
Ar(i, e, t);
|
|
2497
2487
|
}
|
|
2498
2488
|
});
|
|
2499
2489
|
}] : [];
|
|
@@ -2517,16 +2507,16 @@ var Hr = class {
|
|
|
2517
2507
|
options: e.options,
|
|
2518
2508
|
storage: this.editor.extensionStorage[e.name],
|
|
2519
2509
|
editor: this.editor,
|
|
2520
|
-
type:
|
|
2510
|
+
type: U(e.name, this.schema)
|
|
2521
2511
|
};
|
|
2522
|
-
e.type === "mark" && ((
|
|
2523
|
-
let n =
|
|
2512
|
+
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));
|
|
2513
|
+
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
2514
|
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
2515
|
});
|
|
2526
2516
|
}
|
|
2527
2517
|
};
|
|
2528
|
-
|
|
2529
|
-
var $ = class e extends
|
|
2518
|
+
Q.resolve = Jt, Q.sort = H, Q.flatten = Pt;
|
|
2519
|
+
var $ = class e extends Ir {
|
|
2530
2520
|
constructor(...e) {
|
|
2531
2521
|
super(...e), this.type = "extension";
|
|
2532
2522
|
}
|
|
@@ -2550,11 +2540,11 @@ var $ = class e extends Fr {
|
|
|
2550
2540
|
return [new r({
|
|
2551
2541
|
key: new i("clipboardTextSerializer"),
|
|
2552
2542
|
props: { clipboardTextSerializer: () => {
|
|
2553
|
-
let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a =
|
|
2543
|
+
let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a = Zt(n), { blockSeparator: o } = this.options, s = {
|
|
2554
2544
|
...o === void 0 ? {} : { blockSeparator: o },
|
|
2555
2545
|
textSerializers: a
|
|
2556
2546
|
};
|
|
2557
|
-
return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) =>
|
|
2547
|
+
return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) => Yt(r, {
|
|
2558
2548
|
from: e.pos,
|
|
2559
2549
|
to: t.pos
|
|
2560
2550
|
}, s)).join(o ?? "\n\n");
|
|
@@ -2564,7 +2554,7 @@ var $ = class e extends Fr {
|
|
|
2564
2554
|
}), Wr = $.create({
|
|
2565
2555
|
name: "commands",
|
|
2566
2556
|
addCommands() {
|
|
2567
|
-
return { ...
|
|
2557
|
+
return { ...qn };
|
|
2568
2558
|
}
|
|
2569
2559
|
}), Gr = $.create({
|
|
2570
2560
|
name: "delete",
|
|
@@ -2573,8 +2563,8 @@ var $ = class e extends Fr {
|
|
|
2573
2563
|
let r = () => {
|
|
2574
2564
|
var n, r;
|
|
2575
2565
|
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
|
-
|
|
2566
|
+
let i = jt(e.before, [e, ...t]);
|
|
2567
|
+
nn(i).forEach((t) => {
|
|
2578
2568
|
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
2569
|
let a = r + n.nodeSize - 2, o = t.oldRange.from <= r && a <= t.oldRange.to;
|
|
2580
2570
|
this.editor.emit("delete", {
|
|
@@ -2705,7 +2695,7 @@ var $ = class e extends Fr {
|
|
|
2705
2695
|
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
2706
2696
|
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
2707
2697
|
};
|
|
2708
|
-
return
|
|
2698
|
+
return M() || ft() ? i : r;
|
|
2709
2699
|
},
|
|
2710
2700
|
addProseMirrorPlugins() {
|
|
2711
2701
|
return [new r({
|
|
@@ -2715,7 +2705,7 @@ var $ = class e extends Fr {
|
|
|
2715
2705
|
let r = e.some((e) => e.docChanged) && !t.doc.eq(n.doc), i = e.some((e) => e.getMeta("preventClearDocument"));
|
|
2716
2706
|
if (!r || i) return;
|
|
2717
2707
|
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 || !
|
|
2708
|
+
if (o || s !== l || c !== u || !G(n.doc)) return;
|
|
2719
2709
|
let d = n.tr, f = E({
|
|
2720
2710
|
state: n,
|
|
2721
2711
|
transaction: d
|
|
@@ -2759,7 +2749,7 @@ var $ = class e extends Fr {
|
|
|
2759
2749
|
},
|
|
2760
2750
|
addGlobalAttributes() {
|
|
2761
2751
|
if (!this.options.direction) return [];
|
|
2762
|
-
let { nodeExtensions: e } =
|
|
2752
|
+
let { nodeExtensions: e } = B(this.extensions);
|
|
2763
2753
|
return [{
|
|
2764
2754
|
types: e.filter((e) => e.name !== "text").map((e) => e.name),
|
|
2765
2755
|
attributes: { dir: {
|
|
@@ -2918,7 +2908,7 @@ var ni = class e {
|
|
|
2918
2908
|
...e
|
|
2919
2909
|
}), this.editor.view.dispatch(t);
|
|
2920
2910
|
}
|
|
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
|
|
2911
|
+
}, 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
2912
|
constructor(e = {}) {
|
|
2923
2913
|
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
2914
|
element: typeof document < "u" ? document.createElement("div") : null,
|
|
@@ -2955,8 +2945,8 @@ var ni = class e {
|
|
|
2955
2945
|
onDelete: () => null,
|
|
2956
2946
|
enableExtensionDispatchTransaction: !0
|
|
2957
2947
|
}, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.utils = {
|
|
2958
|
-
getUpdatedPosition:
|
|
2959
|
-
createMappablePosition:
|
|
2948
|
+
getUpdatedPosition: gn,
|
|
2949
|
+
createMappablePosition: _n
|
|
2960
2950
|
}, 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
2951
|
let n = this.createDoc();
|
|
2962
2952
|
if (!this.editorState) {
|
|
@@ -3001,7 +2991,7 @@ var ni = class e {
|
|
|
3001
2991
|
return this.commandManager ? this.commandManager.can() : D.createFallbackCan();
|
|
3002
2992
|
}
|
|
3003
2993
|
injectCSS() {
|
|
3004
|
-
this.options.injectCSS && typeof document < "u" && (this.css =
|
|
2994
|
+
this.options.injectCSS && typeof document < "u" && (this.css = vr(ri, this.options.injectNonce));
|
|
3005
2995
|
}
|
|
3006
2996
|
setOptions(e = {}) {
|
|
3007
2997
|
this.options = {
|
|
@@ -3043,10 +3033,10 @@ var ni = class e {
|
|
|
3043
3033
|
} });
|
|
3044
3034
|
}
|
|
3045
3035
|
get state() {
|
|
3046
|
-
return
|
|
3036
|
+
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
3037
|
}
|
|
3048
3038
|
registerPlugin(e, t) {
|
|
3049
|
-
let n =
|
|
3039
|
+
let n = It(t) ? t(e, [...this.state.plugins]) : [...this.state.plugins, e], r = this.state.reconfigure({ plugins: n });
|
|
3050
3040
|
return this.view.updateState(r), r;
|
|
3051
3041
|
}
|
|
3052
3042
|
unregisterPlugin(e) {
|
|
@@ -3077,7 +3067,7 @@ var ni = class e {
|
|
|
3077
3067
|
"node",
|
|
3078
3068
|
"mark"
|
|
3079
3069
|
].includes(e?.type));
|
|
3080
|
-
this.extensionManager = new
|
|
3070
|
+
this.extensionManager = new Q(n, this);
|
|
3081
3071
|
}
|
|
3082
3072
|
createCommandManager() {
|
|
3083
3073
|
this.commandManager = new D({ editor: this });
|
|
@@ -3088,10 +3078,10 @@ var ni = class e {
|
|
|
3088
3078
|
createDoc() {
|
|
3089
3079
|
let e;
|
|
3090
3080
|
try {
|
|
3091
|
-
e =
|
|
3081
|
+
e = Ot(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
|
|
3092
3082
|
} catch (e) {
|
|
3093
3083
|
if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) throw e;
|
|
3094
|
-
let n =
|
|
3084
|
+
let n = Ot(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
|
|
3095
3085
|
return this.editorState = t.create({
|
|
3096
3086
|
doc: n,
|
|
3097
3087
|
schema: this.schema,
|
|
@@ -3108,7 +3098,7 @@ var ni = class e {
|
|
|
3108
3098
|
}
|
|
3109
3099
|
getEditorViewAttributes() {
|
|
3110
3100
|
let e = this.options.editorProps?.attributes;
|
|
3111
|
-
return
|
|
3101
|
+
return It(e) ? (t) => ({
|
|
3112
3102
|
role: "textbox",
|
|
3113
3103
|
...e(t)
|
|
3114
3104
|
}) : {
|
|
@@ -3186,30 +3176,30 @@ var ni = class e {
|
|
|
3186
3176
|
});
|
|
3187
3177
|
}
|
|
3188
3178
|
getAttributes(e) {
|
|
3189
|
-
return
|
|
3179
|
+
return $t(this.state, e);
|
|
3190
3180
|
}
|
|
3191
3181
|
isActive(e, t) {
|
|
3192
3182
|
let n = typeof e == "string" ? e : null, r = typeof e == "string" ? t : e;
|
|
3193
|
-
return
|
|
3183
|
+
return ln(this.state, n, r);
|
|
3194
3184
|
}
|
|
3195
3185
|
getJSON() {
|
|
3196
3186
|
return this.state.doc.toJSON();
|
|
3197
3187
|
}
|
|
3198
3188
|
getHTML() {
|
|
3199
|
-
return
|
|
3189
|
+
return Ft(this.state.doc.content, this.schema);
|
|
3200
3190
|
}
|
|
3201
3191
|
getText(e) {
|
|
3202
3192
|
let { blockSeparator: t = "\n\n", textSerializers: n = {} } = e || {};
|
|
3203
|
-
return
|
|
3193
|
+
return Xt(this.state.doc, {
|
|
3204
3194
|
blockSeparator: t,
|
|
3205
3195
|
textSerializers: {
|
|
3206
|
-
...
|
|
3196
|
+
...Zt(this.schema),
|
|
3207
3197
|
...n
|
|
3208
3198
|
}
|
|
3209
3199
|
});
|
|
3210
3200
|
}
|
|
3211
3201
|
get isEmpty() {
|
|
3212
|
-
return
|
|
3202
|
+
return G(this.state.doc);
|
|
3213
3203
|
}
|
|
3214
3204
|
destroy() {
|
|
3215
3205
|
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 +3222,15 @@ var ni = class e {
|
|
|
3232
3222
|
}
|
|
3233
3223
|
};
|
|
3234
3224
|
function ai(e) {
|
|
3235
|
-
return new
|
|
3225
|
+
return new Y({
|
|
3236
3226
|
find: e.find,
|
|
3237
3227
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3238
|
-
let i =
|
|
3228
|
+
let i = z(e.getAttributes, void 0, r);
|
|
3239
3229
|
if (i === !1 || i === null) return null;
|
|
3240
3230
|
let { tr: a } = t, o = r[r.length - 1], s = r[0];
|
|
3241
3231
|
if (o) {
|
|
3242
3232
|
let r = s.search(/\S/), c = n.from + s.indexOf(o), l = c + o.length;
|
|
3243
|
-
if (
|
|
3233
|
+
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
3234
|
l < n.to && a.delete(l, n.to), c > n.from && a.delete(n.from + r, c);
|
|
3245
3235
|
let u = n.from + r + o.length;
|
|
3246
3236
|
a.addMark(n.from + r, u, e.type.create(i || {})), a.removeStoredMark(e.type);
|
|
@@ -3250,10 +3240,10 @@ function ai(e) {
|
|
|
3250
3240
|
});
|
|
3251
3241
|
}
|
|
3252
3242
|
function oi(e) {
|
|
3253
|
-
return new
|
|
3243
|
+
return new Y({
|
|
3254
3244
|
find: e.find,
|
|
3255
3245
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3256
|
-
let i =
|
|
3246
|
+
let i = z(e.getAttributes, void 0, r) || {}, { tr: a } = t, o = n.from, s = n.to, c = e.type.create(i);
|
|
3257
3247
|
if (r[1]) {
|
|
3258
3248
|
let e = o + r[0].lastIndexOf(r[1]);
|
|
3259
3249
|
e > s ? e = s : s = e + r[1].length;
|
|
@@ -3269,10 +3259,10 @@ function oi(e) {
|
|
|
3269
3259
|
});
|
|
3270
3260
|
}
|
|
3271
3261
|
function si(e) {
|
|
3272
|
-
return new
|
|
3262
|
+
return new Y({
|
|
3273
3263
|
find: e.find,
|
|
3274
3264
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3275
|
-
let i = t.doc.resolve(n.from), a =
|
|
3265
|
+
let i = t.doc.resolve(n.from), a = z(e.getAttributes, void 0, r) || {};
|
|
3276
3266
|
if (!i.node(-1).canReplaceWith(i.index(-1), i.indexAfter(-1), e.type)) return null;
|
|
3277
3267
|
t.tr.delete(n.from, n.to).setBlockType(n.from, n.from, e.type, a);
|
|
3278
3268
|
},
|
|
@@ -3280,7 +3270,7 @@ function si(e) {
|
|
|
3280
3270
|
});
|
|
3281
3271
|
}
|
|
3282
3272
|
function ci(e) {
|
|
3283
|
-
return new
|
|
3273
|
+
return new Y({
|
|
3284
3274
|
find: e.find,
|
|
3285
3275
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3286
3276
|
let i = e.replace, a = n.from, o = n.to;
|
|
@@ -3296,10 +3286,10 @@ function ci(e) {
|
|
|
3296
3286
|
});
|
|
3297
3287
|
}
|
|
3298
3288
|
function li(e) {
|
|
3299
|
-
return new
|
|
3289
|
+
return new Y({
|
|
3300
3290
|
find: e.find,
|
|
3301
3291
|
handler: ({ state: t, range: n, match: r, chain: i }) => {
|
|
3302
|
-
let a =
|
|
3292
|
+
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
3293
|
if (!c) return null;
|
|
3304
3294
|
if (o.wrap(s, c), e.keepMarks && e.editor) {
|
|
3305
3295
|
let { selection: n, storedMarks: r } = t, { splittableMarks: i } = e.editor.extensionManager, a = r || n.$to.parentOffset && n.$from.marks();
|
|
@@ -3448,7 +3438,7 @@ var ui = (e) => "touches" in e, di = class {
|
|
|
3448
3438
|
height: e / this.aspectRatio
|
|
3449
3439
|
};
|
|
3450
3440
|
}
|
|
3451
|
-
}, fi = class e extends
|
|
3441
|
+
}, fi = class e extends Ir {
|
|
3452
3442
|
constructor(...e) {
|
|
3453
3443
|
super(...e), this.type = "node";
|
|
3454
3444
|
}
|
|
@@ -3463,118 +3453,21 @@ var ui = (e) => "touches" in e, di = class {
|
|
|
3463
3453
|
let t = typeof e == "function" ? e() : e;
|
|
3464
3454
|
return super.extend(t);
|
|
3465
3455
|
}
|
|
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
3456
|
};
|
|
3564
|
-
function
|
|
3565
|
-
return new
|
|
3457
|
+
function pi(e) {
|
|
3458
|
+
return new Rr({
|
|
3566
3459
|
find: e.find,
|
|
3567
3460
|
handler: ({ state: t, range: n, match: r, pasteEvent: i }) => {
|
|
3568
|
-
let a =
|
|
3461
|
+
let a = z(e.getAttributes, void 0, r, i);
|
|
3569
3462
|
if (a === !1 || a === null) return null;
|
|
3570
3463
|
let { tr: o } = t, s = r[r.length - 1], c = r[0], l = n.to;
|
|
3571
3464
|
if (s) {
|
|
3572
3465
|
let i = c.search(/\S/), u = n.from + c.indexOf(s), d = u + s.length;
|
|
3573
|
-
if (
|
|
3466
|
+
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
3467
|
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
3468
|
}
|
|
3576
3469
|
}
|
|
3577
3470
|
});
|
|
3578
3471
|
}
|
|
3579
3472
|
//#endregion
|
|
3580
|
-
export {
|
|
3473
|
+
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 };
|