@blocknote/core 0.54.2 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BlockNoteExtension-BJCLnwrE.cjs.map +1 -1
- package/dist/BlockNoteExtension-CbvDA0F7.js.map +1 -1
- package/dist/blocknote.cjs +1 -1
- package/dist/blocknote.js +6 -6
- package/dist/blocks-DLgTreVu.cjs +12 -0
- package/dist/blocks-DLgTreVu.cjs.map +1 -0
- package/dist/{blocks-Dol85hpH.js → blocks-DaEUT0O1.js} +346 -340
- package/dist/blocks-DaEUT0O1.js.map +1 -0
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +1 -1
- package/dist/comments.cjs +1 -1
- package/dist/comments.cjs.map +1 -1
- package/dist/comments.js +62 -36
- package/dist/comments.js.map +1 -1
- package/dist/{en-uzHzj6eH.js → en-BAn9gxr-.js} +5 -2
- package/dist/{en-uzHzj6eH.js.map → en-BAn9gxr-.js.map} +1 -1
- package/dist/{en-BuzSuuTq.cjs → en-CHnrV5l8.cjs} +2 -2
- package/dist/{en-BuzSuuTq.cjs.map → en-CHnrV5l8.cjs.map} +1 -1
- package/dist/{extensions-D6JcJCwd.js → extensions-B1JQURVF.js} +221 -221
- package/dist/extensions-B1JQURVF.js.map +1 -0
- package/dist/{extensions-B7Rsp_Ft.cjs → extensions-CZkqKzJO.cjs} +3 -3
- package/dist/extensions-CZkqKzJO.cjs.map +1 -0
- package/dist/extensions.cjs +1 -1
- package/dist/extensions.js +2 -2
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +89 -23
- package/dist/locales.js.map +1 -1
- package/dist/{src-Buuo5l7X.js → src-D5w0XAHX.js} +702 -640
- package/dist/src-D5w0XAHX.js.map +1 -0
- package/dist/{src-C54Ok9E0.cjs → src-th5uZEvx.cjs} +8 -8
- package/dist/src-th5uZEvx.cjs.map +1 -0
- package/dist/webpack-stats.json +1 -1
- package/dist/y.cjs +1 -1
- package/dist/y.js +3 -3
- package/dist/yjs.cjs +1 -1
- package/dist/yjs.js +1 -1
- package/package.json +12 -12
- package/src/comments/CommentEditorSubmitExtension.test.ts +141 -0
- package/src/comments/CommentEditorSubmitExtension.ts +56 -0
- package/src/comments/extension.ts +8 -0
- package/src/comments/index.ts +1 -0
- package/src/editor/BlockNoteEditor.ts +94 -41
- package/src/editor/BlockNoteExtension.ts +6 -1
- package/src/editor/managers/EventManager.browser.test.ts +334 -0
- package/src/editor/managers/EventManager.ts +128 -31
- package/src/editor/managers/ExtensionManager/ExtensionManager.test.ts +88 -1
- package/src/editor/managers/ExtensionManager/index.ts +30 -7
- package/src/editor/managers/StyleManager.browser.test.ts +122 -0
- package/src/editor/managers/StyleManager.test.ts +98 -0
- package/src/editor/managers/StyleManager.ts +31 -15
- package/src/editor/managers/index.ts +1 -0
- package/src/extensions/FormattingToolbar/FormattingToolbar.ts +23 -0
- package/src/extensions/SideMenu/SideMenu.ts +15 -0
- package/src/extensions/TableHandles/TableHandles.browser.test.ts +3 -1
- package/src/i18n/locales/ar.ts +1 -0
- package/src/i18n/locales/de.ts +1 -0
- package/src/i18n/locales/en.ts +1 -0
- package/src/i18n/locales/es.ts +1 -0
- package/src/i18n/locales/fa.ts +1 -0
- package/src/i18n/locales/fr.ts +1 -0
- package/src/i18n/locales/he.ts +1 -0
- package/src/i18n/locales/hr.ts +1 -0
- package/src/i18n/locales/is.ts +1 -0
- package/src/i18n/locales/it.ts +1 -0
- package/src/i18n/locales/ja.ts +1 -0
- package/src/i18n/locales/ko.ts +1 -0
- package/src/i18n/locales/nl.ts +1 -0
- package/src/i18n/locales/no.ts +1 -0
- package/src/i18n/locales/pl.ts +1 -0
- package/src/i18n/locales/pt.ts +1 -0
- package/src/i18n/locales/ru.ts +1 -0
- package/src/i18n/locales/sk.ts +1 -0
- package/src/i18n/locales/uk.ts +1 -0
- package/src/i18n/locales/uz.ts +1 -0
- package/src/i18n/locales/vi.ts +1 -0
- package/src/i18n/locales/zh-tw.ts +1 -0
- package/src/i18n/locales/zh.ts +1 -0
- package/src/index.ts +1 -0
- package/src/util/browser.ts +24 -0
- package/types/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.d.ts +4 -0
- package/types/src/comments/CommentEditorSubmitExtension.d.ts +19 -0
- package/types/src/comments/CommentEditorSubmitExtension.test.d.ts +1 -0
- package/types/src/comments/extension.d.ts +7 -0
- package/types/src/comments/index.d.ts +1 -0
- package/types/src/editor/BlockNoteEditor.d.ts +52 -19
- package/types/src/editor/BlockNoteExtension.d.ts +3 -0
- package/types/src/editor/managers/EventManager.browser.test.d.ts +1 -0
- package/types/src/editor/managers/EventManager.d.ts +55 -0
- package/types/src/editor/managers/StyleManager.browser.test.d.ts +1 -0
- package/types/src/editor/managers/StyleManager.d.ts +4 -2
- package/types/src/editor/managers/StyleManager.test.d.ts +1 -0
- package/types/src/editor/managers/index.d.ts +1 -0
- package/types/src/extensions/SourceBlockWithPreview/SourceBlockWithPreview.d.ts +3 -0
- package/types/src/extensions/SourceInlineContentWithPreview/SourceInlineContentWithPreview.d.ts +1 -0
- package/types/src/i18n/locales/en.d.ts +1 -0
- package/types/src/i18n/locales/fa.d.ts +1 -0
- package/types/src/i18n/locales/sk.d.ts +1 -0
- package/types/src/index.d.ts +1 -0
- package/types/src/util/browser.d.ts +2 -0
- package/dist/blocks-CTB_5Vyj.cjs +0 -12
- package/dist/blocks-CTB_5Vyj.cjs.map +0 -1
- package/dist/blocks-Dol85hpH.js.map +0 -1
- package/dist/extensions-B7Rsp_Ft.cjs.map +0 -1
- package/dist/extensions-D6JcJCwd.js.map +0 -1
- package/dist/src-Buuo5l7X.js.map +0 -1
- package/dist/src-C54Ok9E0.cjs.map +0 -1
|
@@ -308,10 +308,10 @@ function k(e, t = "Ctrl") {
|
|
|
308
308
|
function A(...e) {
|
|
309
309
|
return [...new Set(e.filter((e) => e).join(" ").split(" "))].join(" ");
|
|
310
310
|
}
|
|
311
|
-
var Ve = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
311
|
+
var Ve = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent), He = () => typeof navigator < "u" && /android/i.test(navigator.userAgent), Ue, We = () => typeof navigator > "u" || typeof window > "u" ? !1 : (Ue === void 0 && (Ue = navigator.maxTouchPoints > 0 && typeof window.matchMedia == "function" && window.matchMedia("(pointer: coarse)").matches), Ue);
|
|
312
312
|
//#endregion
|
|
313
313
|
//#region src/blocks/defaultBlockHelpers.ts
|
|
314
|
-
function
|
|
314
|
+
function Ge(e, t, n, r) {
|
|
315
315
|
let i = document.createElement("div");
|
|
316
316
|
i.className = A("bn-block-content", n.class), i.setAttribute("data-content-type", e);
|
|
317
317
|
for (let [e, t] of Object.entries(n)) e !== "class" && i.setAttribute(e, t);
|
|
@@ -323,7 +323,7 @@ function He(e, t, n, r) {
|
|
|
323
323
|
contentDOM: a
|
|
324
324
|
};
|
|
325
325
|
}
|
|
326
|
-
var
|
|
326
|
+
var Ke = (e, t) => {
|
|
327
327
|
let n = U(e, t.pmSchema);
|
|
328
328
|
n.type.name === "blockContainer" && (n = n.firstChild);
|
|
329
329
|
let r = t.pmSchema.nodes[n.type.name].spec.toDOM;
|
|
@@ -332,7 +332,7 @@ var Ue = (e, t) => {
|
|
|
332
332
|
if (typeof i != "object" || !("dom" in i)) throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.");
|
|
333
333
|
return i;
|
|
334
334
|
};
|
|
335
|
-
function
|
|
335
|
+
function qe(e, t = "<br>") {
|
|
336
336
|
let n = e.querySelectorAll("p");
|
|
337
337
|
if (n.length > 1) {
|
|
338
338
|
let e = n[0];
|
|
@@ -344,44 +344,44 @@ function We(e, t = "<br>") {
|
|
|
344
344
|
}
|
|
345
345
|
//#endregion
|
|
346
346
|
//#region src/schema/nodeViewMutations.ts
|
|
347
|
-
function
|
|
347
|
+
function Je(e) {
|
|
348
348
|
return e.type !== "attributes" || !e.attributeName ? !1 : e.attributeName.startsWith("data-darkreader") ? !0 : e.attributeName === "style" ? (e.target.getAttribute("style") ?? "").includes("--darkreader") || (e.oldValue ?? "").includes("--darkreader") : !1;
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function Ye(e) {
|
|
351
351
|
let t = e.ignoreMutation?.bind(e), n = e.contentDOM;
|
|
352
|
-
e.ignoreMutation = (e) =>
|
|
352
|
+
e.ignoreMutation = (e) => Je(e) ? !0 : t ? t(e) : !n && e.type !== "selection";
|
|
353
353
|
}
|
|
354
354
|
//#endregion
|
|
355
355
|
//#region src/api/pmUtil.ts
|
|
356
356
|
function j(e) {
|
|
357
357
|
return "doc" in e ? e.doc.type.schema : e.type.schema;
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function Xe(e) {
|
|
360
360
|
return e.cached.blockNoteEditor;
|
|
361
361
|
}
|
|
362
|
-
function
|
|
363
|
-
return
|
|
362
|
+
function Ze(e) {
|
|
363
|
+
return Xe(e).schema;
|
|
364
364
|
}
|
|
365
|
-
function
|
|
366
|
-
return
|
|
365
|
+
function Qe(e) {
|
|
366
|
+
return Ze(e).blockSchema;
|
|
367
367
|
}
|
|
368
|
-
function
|
|
369
|
-
return
|
|
368
|
+
function $e(e) {
|
|
369
|
+
return Ze(e).inlineContentSchema;
|
|
370
370
|
}
|
|
371
371
|
function M(e) {
|
|
372
|
-
return
|
|
372
|
+
return Ze(e).styleSchema;
|
|
373
373
|
}
|
|
374
|
-
function
|
|
375
|
-
return
|
|
374
|
+
function et(e) {
|
|
375
|
+
return Xe(e).blockCache;
|
|
376
376
|
}
|
|
377
|
-
function
|
|
378
|
-
if (
|
|
379
|
-
let n =
|
|
377
|
+
function tt(e, t) {
|
|
378
|
+
if (Qe(e)[t.name]?.content === "plain") return !0;
|
|
379
|
+
let n = $e(e)[t.name];
|
|
380
380
|
return typeof n == "object" && n.content === "plain";
|
|
381
381
|
}
|
|
382
382
|
//#endregion
|
|
383
383
|
//#region src/api/nodeConversions/nodeToBlock.ts
|
|
384
|
-
function
|
|
384
|
+
function nt(e, t, n) {
|
|
385
385
|
let r = {
|
|
386
386
|
type: "tableContent",
|
|
387
387
|
columnWidths: [],
|
|
@@ -396,7 +396,7 @@ function $e(e, t, n) {
|
|
|
396
396
|
t ??= Array(e.attrs.colspan ?? 1).fill(void 0), r.columnWidths.push(...t);
|
|
397
397
|
}), s.cells = e.content.content.map((e, r) => (i[o] || (i[o] = []), i[o][r] = e.type.name === "tableHeader", {
|
|
398
398
|
type: "tableCell",
|
|
399
|
-
content: e.content.content.map((e) =>
|
|
399
|
+
content: e.content.content.map((e) => rt(e, t, n)).reduce((e, t) => {
|
|
400
400
|
if (!e.length) return t;
|
|
401
401
|
let n = e[e.length - 1], r = t[0];
|
|
402
402
|
return r && S(n) && S(r) && JSON.stringify(n.styles) === JSON.stringify(r.styles) ? (n.text += "\n" + r.text, e.push(...t.slice(1)), e) : (e.push(...t), e);
|
|
@@ -414,7 +414,7 @@ function $e(e, t, n) {
|
|
|
414
414
|
for (let e = 0; e < i[0]?.length; e++) i?.every((t) => t[e]) && (r.headerCols = (r.headerCols ?? 0) + 1);
|
|
415
415
|
return r;
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function rt(e, t, n) {
|
|
418
418
|
let r = [], i;
|
|
419
419
|
return e.content.forEach((e) => {
|
|
420
420
|
if (e.type.name === "hardBreak") {
|
|
@@ -434,7 +434,7 @@ function et(e, t, n) {
|
|
|
434
434
|
console.warn("unrecognized inline content type", e.type.name);
|
|
435
435
|
return;
|
|
436
436
|
}
|
|
437
|
-
i &&= (r.push(i), void 0), r.push(
|
|
437
|
+
i &&= (r.push(i), void 0), r.push(it(e, t, n));
|
|
438
438
|
return;
|
|
439
439
|
}
|
|
440
440
|
let a = {}, o;
|
|
@@ -492,7 +492,7 @@ function et(e, t, n) {
|
|
|
492
492
|
};
|
|
493
493
|
}), i && r.push(i), r;
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function it(e, t, n) {
|
|
496
496
|
if (e.type.name === "text" || e.type.name === "link") throw Error("unexpected");
|
|
497
497
|
let r = {}, i = t[e.type.name];
|
|
498
498
|
for (let [t, n] of Object.entries(e.attrs)) {
|
|
@@ -500,14 +500,14 @@ function tt(e, t, n) {
|
|
|
500
500
|
t in i.propSchema && (r[t] = n);
|
|
501
501
|
}
|
|
502
502
|
let a;
|
|
503
|
-
return a = i.content === "styled" ?
|
|
503
|
+
return a = i.content === "styled" ? rt(e, t, n) : i.content === "plain" ? e.textContent : void 0, {
|
|
504
504
|
type: e.type.name,
|
|
505
505
|
props: r,
|
|
506
506
|
content: a
|
|
507
507
|
};
|
|
508
508
|
}
|
|
509
509
|
function N(e, t) {
|
|
510
|
-
let n = e.type.schema, r =
|
|
510
|
+
let n = e.type.schema, r = Qe(n), i = $e(n), a = M(n), o = et(n);
|
|
511
511
|
if (!e.type.isInGroup("bnBlock")) throw Error("Node should be a bnBlock, but is instead: " + e.type.name);
|
|
512
512
|
let s = o?.get(e);
|
|
513
513
|
if (s) return s;
|
|
@@ -534,10 +534,10 @@ function N(e, t) {
|
|
|
534
534
|
let m;
|
|
535
535
|
if (f.content === "inline") {
|
|
536
536
|
if (!c.isBlockContainer) throw Error("impossible");
|
|
537
|
-
m =
|
|
537
|
+
m = rt(c.blockContent.node, i, a);
|
|
538
538
|
} else if (f.content === "table") {
|
|
539
539
|
if (!c.isBlockContainer) throw Error("impossible");
|
|
540
|
-
m =
|
|
540
|
+
m = nt(c.blockContent.node, i, a);
|
|
541
541
|
} else if (f.content === "plain") {
|
|
542
542
|
if (!c.isBlockContainer) throw Error("impossible");
|
|
543
543
|
let e = c.blockContent.node.textContent;
|
|
@@ -557,11 +557,11 @@ function N(e, t) {
|
|
|
557
557
|
};
|
|
558
558
|
return o?.set(e, h), h;
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function at(e) {
|
|
561
561
|
let t = [];
|
|
562
562
|
return e.firstChild && e.firstChild.descendants((n) => (t.push(N(n, e)), !1)), t;
|
|
563
563
|
}
|
|
564
|
-
function
|
|
564
|
+
function ot(e) {
|
|
565
565
|
function t(n, r, i) {
|
|
566
566
|
if (n.type.name !== "blockGroup") throw Error("unexpected");
|
|
567
567
|
let a = [], o, s;
|
|
@@ -604,11 +604,11 @@ function rt(e) {
|
|
|
604
604
|
function P(e) {
|
|
605
605
|
return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
606
606
|
}
|
|
607
|
-
function
|
|
607
|
+
function st(e) {
|
|
608
608
|
let t = e.split("/");
|
|
609
609
|
return !t.length || t[t.length - 1] === "" ? e : t[t.length - 1];
|
|
610
610
|
}
|
|
611
|
-
function
|
|
611
|
+
function ct(e) {
|
|
612
612
|
let t = [
|
|
613
613
|
"mp4",
|
|
614
614
|
"webm",
|
|
@@ -629,7 +629,7 @@ function at(e) {
|
|
|
629
629
|
}
|
|
630
630
|
//#endregion
|
|
631
631
|
//#region src/schema/blocks/internal.ts
|
|
632
|
-
function
|
|
632
|
+
function lt(e) {
|
|
633
633
|
let t = {};
|
|
634
634
|
return Object.entries(e).forEach(([e, n]) => {
|
|
635
635
|
t[e] = {
|
|
@@ -649,23 +649,23 @@ function ot(e) {
|
|
|
649
649
|
};
|
|
650
650
|
}), t;
|
|
651
651
|
}
|
|
652
|
-
function
|
|
652
|
+
function ut(e, t) {
|
|
653
653
|
let n = e();
|
|
654
654
|
if (n === void 0) throw Error("Cannot find node position");
|
|
655
655
|
let r = t.resolve(n).node();
|
|
656
656
|
if (!r) throw Error("Cannot find block container");
|
|
657
657
|
return N(r, t);
|
|
658
658
|
}
|
|
659
|
-
function
|
|
659
|
+
function dt(e, t, n) {
|
|
660
660
|
try {
|
|
661
|
-
return
|
|
661
|
+
return ut(e, n);
|
|
662
662
|
} catch (e) {
|
|
663
663
|
let r = n.type.schema.nodes.blockContainer?.createAndFill(null, t);
|
|
664
664
|
if (r) return N(r, n);
|
|
665
665
|
throw e;
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
|
-
function
|
|
668
|
+
function ft(e, t, n, r, i = !1, a) {
|
|
669
669
|
let o = document.createElement("div");
|
|
670
670
|
if (a !== void 0) for (let [e, t] of Object.entries(a)) e !== "class" && o.setAttribute(e, t);
|
|
671
671
|
o.className = A("bn-block-content", a?.class || ""), o.setAttribute("data-content-type", t);
|
|
@@ -675,7 +675,7 @@ function lt(e, t, n, r, i = !1, a) {
|
|
|
675
675
|
dom: o
|
|
676
676
|
};
|
|
677
677
|
}
|
|
678
|
-
function
|
|
678
|
+
function pt(e, t, n) {
|
|
679
679
|
return {
|
|
680
680
|
config: {
|
|
681
681
|
type: e.type,
|
|
@@ -684,20 +684,20 @@ function ut(e, t, n) {
|
|
|
684
684
|
},
|
|
685
685
|
implementation: {
|
|
686
686
|
node: e.node,
|
|
687
|
-
render:
|
|
688
|
-
toExternalHTML:
|
|
687
|
+
render: Ke,
|
|
688
|
+
toExternalHTML: Ke
|
|
689
689
|
},
|
|
690
690
|
extensions: n
|
|
691
691
|
};
|
|
692
692
|
}
|
|
693
693
|
//#endregion
|
|
694
694
|
//#region src/schema/blocks/createSpec.ts
|
|
695
|
-
function
|
|
695
|
+
function mt(e, t) {
|
|
696
696
|
e.stopEvent = (e) => (e.type === "mousedown" && setTimeout(() => {
|
|
697
697
|
t.view.dom.blur();
|
|
698
698
|
}, 10), !0);
|
|
699
699
|
}
|
|
700
|
-
function
|
|
700
|
+
function ht(e, t) {
|
|
701
701
|
let n = [{
|
|
702
702
|
tag: "[data-content-type=" + e.type + "]",
|
|
703
703
|
contentElement: ".bn-inline-content"
|
|
@@ -720,7 +720,7 @@ function ft(e, t) {
|
|
|
720
720
|
}
|
|
721
721
|
if (e.content === "inline" || e.content === "plain") {
|
|
722
722
|
let i = n.cloneNode(!0);
|
|
723
|
-
|
|
723
|
+
qe(i, e.content === "plain" || t.meta?.code ? "\n" : "<br>");
|
|
724
724
|
let a = ie.fromSchema(r).parse(i, {
|
|
725
725
|
topNode: r.nodes.paragraph.create(),
|
|
726
726
|
preserveWhitespace: !0
|
|
@@ -741,7 +741,7 @@ function ft(e, t) {
|
|
|
741
741
|
} : void 0
|
|
742
742
|
}), n;
|
|
743
743
|
}
|
|
744
|
-
function
|
|
744
|
+
function gt(e, n, r, i) {
|
|
745
745
|
let a = n.node || u.create({
|
|
746
746
|
name: e.type,
|
|
747
747
|
content: e.content === "inline" ? "inline*" : e.content === "plain" ? "text*" : e.content === "none" ? "" : e.content,
|
|
@@ -755,27 +755,27 @@ function pt(e, n, r, i) {
|
|
|
755
755
|
defining: n.meta?.defining ?? !0,
|
|
756
756
|
priority: i,
|
|
757
757
|
addAttributes() {
|
|
758
|
-
return
|
|
758
|
+
return lt(e.propSchema);
|
|
759
759
|
},
|
|
760
760
|
parseHTML() {
|
|
761
|
-
return
|
|
761
|
+
return ht(e, n);
|
|
762
762
|
},
|
|
763
763
|
renderHTML({ HTMLAttributes: t }) {
|
|
764
764
|
let r = document.createElement("div");
|
|
765
|
-
return
|
|
765
|
+
return ft({
|
|
766
766
|
dom: r,
|
|
767
767
|
contentDOM: e.content === "inline" || e.content === "plain" ? r : void 0
|
|
768
768
|
}, e.type, {}, e.propSchema, n.meta?.fileBlockAccept !== void 0, t);
|
|
769
769
|
},
|
|
770
770
|
addNodeView() {
|
|
771
771
|
return (t) => {
|
|
772
|
-
let r = this.options.editor, i =
|
|
772
|
+
let r = this.options.editor, i = dt(t.getPos, t.node, t.view.state.doc), a = this.options.domAttributes?.blockContent || {}, o = n.render.call({
|
|
773
773
|
blockContentDOMAttributes: a,
|
|
774
774
|
props: t,
|
|
775
775
|
renderType: "nodeView",
|
|
776
776
|
propSchema: e.propSchema
|
|
777
777
|
}, i, r);
|
|
778
|
-
return n.meta?.selectable === !1 &&
|
|
778
|
+
return n.meta?.selectable === !1 && mt(o, this.editor), Ye(o), o;
|
|
779
779
|
};
|
|
780
780
|
}
|
|
781
781
|
});
|
|
@@ -822,10 +822,10 @@ function I(e, t, n) {
|
|
|
822
822
|
...a,
|
|
823
823
|
toExternalHTML(e, t, n) {
|
|
824
824
|
let r = a.toExternalHTML?.call({ blockContentDOMAttributes: this.blockContentDOMAttributes }, e, t, n);
|
|
825
|
-
if (r !== void 0) return
|
|
825
|
+
if (r !== void 0) return ft(r, e.type, e.props, this.propSchema ?? i.propSchema, a.meta?.fileBlockAccept !== void 0);
|
|
826
826
|
},
|
|
827
827
|
render(e, t) {
|
|
828
|
-
return
|
|
828
|
+
return ft(a.render.call({
|
|
829
829
|
blockContentDOMAttributes: this.blockContentDOMAttributes,
|
|
830
830
|
renderType: this.renderType,
|
|
831
831
|
props: this.props
|
|
@@ -838,24 +838,24 @@ function I(e, t, n) {
|
|
|
838
838
|
}
|
|
839
839
|
//#endregion
|
|
840
840
|
//#region src/schema/inlineContent/internal.ts
|
|
841
|
-
function
|
|
841
|
+
function _t(e, t, n, r) {
|
|
842
842
|
return e.dom.setAttribute("data-inline-content-type", t), Object.entries(n).filter(([e, t]) => t !== r[e]?.default).map(([e, t]) => [P(e), t]).forEach(([t, n]) => e.dom.setAttribute(t, n)), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
843
843
|
}
|
|
844
|
-
function
|
|
844
|
+
function vt(e) {
|
|
845
845
|
return { Backspace: ({ editor: t }) => {
|
|
846
846
|
let n = t.state.selection.$from;
|
|
847
847
|
return t.state.selection.empty && n.node().type.name === e.type && n.parentOffset === 0;
|
|
848
848
|
} };
|
|
849
849
|
}
|
|
850
|
-
function
|
|
850
|
+
function yt(e, t, n) {
|
|
851
851
|
return {
|
|
852
852
|
config: e,
|
|
853
853
|
implementation: t,
|
|
854
854
|
extensions: n
|
|
855
855
|
};
|
|
856
856
|
}
|
|
857
|
-
function
|
|
858
|
-
return
|
|
857
|
+
function bt(e, t, n) {
|
|
858
|
+
return yt({
|
|
859
859
|
type: e.name,
|
|
860
860
|
propSchema: t,
|
|
861
861
|
content: e.config.content === "inline*" ? "styled" : e.config.content === "text*" ? "plain" : "none"
|
|
@@ -864,12 +864,12 @@ function _t(e, t, n) {
|
|
|
864
864
|
node: e
|
|
865
865
|
});
|
|
866
866
|
}
|
|
867
|
-
function
|
|
867
|
+
function xt(e) {
|
|
868
868
|
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, t.config]));
|
|
869
869
|
}
|
|
870
870
|
//#endregion
|
|
871
871
|
//#region src/schema/styles/internal.ts
|
|
872
|
-
function
|
|
872
|
+
function St(e) {
|
|
873
873
|
return e === "boolean" ? {} : { stringValue: {
|
|
874
874
|
default: void 0,
|
|
875
875
|
keepOnSplit: !0,
|
|
@@ -880,14 +880,14 @@ function yt(e) {
|
|
|
880
880
|
function L(e, t, n, r) {
|
|
881
881
|
return e.dom.setAttribute("data-style-type", t), r === "string" && e.dom.setAttribute("data-value", n), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
882
882
|
}
|
|
883
|
-
function
|
|
883
|
+
function Ct(e, t) {
|
|
884
884
|
return {
|
|
885
885
|
config: e,
|
|
886
886
|
implementation: t
|
|
887
887
|
};
|
|
888
888
|
}
|
|
889
889
|
function R(e, t) {
|
|
890
|
-
return
|
|
890
|
+
return Ct({
|
|
891
891
|
type: e.name,
|
|
892
892
|
propSchema: t
|
|
893
893
|
}, {
|
|
@@ -908,12 +908,12 @@ function R(e, t) {
|
|
|
908
908
|
}
|
|
909
909
|
});
|
|
910
910
|
}
|
|
911
|
-
function
|
|
911
|
+
function wt(e) {
|
|
912
912
|
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, t.config]));
|
|
913
913
|
}
|
|
914
914
|
//#endregion
|
|
915
915
|
//#region src/schema/styles/createSpec.ts
|
|
916
|
-
function
|
|
916
|
+
function Tt(e, t) {
|
|
917
917
|
let n = [{
|
|
918
918
|
tag: `[data-style-type="${e.type}"]`,
|
|
919
919
|
contentElement: (e) => {
|
|
@@ -931,14 +931,14 @@ function St(e, t) {
|
|
|
931
931
|
}
|
|
932
932
|
}), n;
|
|
933
933
|
}
|
|
934
|
-
function
|
|
934
|
+
function Et(e, t) {
|
|
935
935
|
let n = l.create({
|
|
936
936
|
name: e.type,
|
|
937
937
|
addAttributes() {
|
|
938
|
-
return
|
|
938
|
+
return St(e.propSchema);
|
|
939
939
|
},
|
|
940
940
|
parseHTML() {
|
|
941
|
-
return
|
|
941
|
+
return Tt(e, t.parse);
|
|
942
942
|
},
|
|
943
943
|
renderHTML({ mark: n }) {
|
|
944
944
|
return L((t.toExternalHTML || t.render)(n.attrs.stringValue), e.type, n.attrs.stringValue, e.propSchema);
|
|
@@ -947,7 +947,7 @@ function Ct(e, t) {
|
|
|
947
947
|
return ({ mark: n }) => L(t.render(n.attrs.stringValue), e.type, n.attrs.stringValue, e.propSchema);
|
|
948
948
|
}
|
|
949
949
|
});
|
|
950
|
-
return
|
|
950
|
+
return Ct(e, {
|
|
951
951
|
...t,
|
|
952
952
|
mark: n,
|
|
953
953
|
render: (n) => L(t.render(n), e.type, n, e.propSchema),
|
|
@@ -956,8 +956,8 @@ function Ct(e, t) {
|
|
|
956
956
|
}
|
|
957
957
|
//#endregion
|
|
958
958
|
//#region src/util/topo-sort.ts
|
|
959
|
-
function
|
|
960
|
-
let t =
|
|
959
|
+
function Dt(e) {
|
|
960
|
+
let t = kt(e), { roots: n, nonRoots: r } = At(t), i = [];
|
|
961
961
|
for (; n.size;) {
|
|
962
962
|
i.push(n);
|
|
963
963
|
let r = /* @__PURE__ */ new Set();
|
|
@@ -972,13 +972,13 @@ function wt(e) {
|
|
|
972
972
|
}
|
|
973
973
|
n = r;
|
|
974
974
|
}
|
|
975
|
-
if (r =
|
|
975
|
+
if (r = At(t).nonRoots, r.size) throw Error(`Cycle(s) detected; toposort only works on acyclic graphs. Cyclic nodes: ${Array.from(r).join(", ")}`);
|
|
976
976
|
return i;
|
|
977
977
|
}
|
|
978
|
-
function
|
|
979
|
-
return
|
|
978
|
+
function Ot(e) {
|
|
979
|
+
return Dt(jt(e));
|
|
980
980
|
}
|
|
981
|
-
function
|
|
981
|
+
function kt(e) {
|
|
982
982
|
let t = /* @__PURE__ */ new Map();
|
|
983
983
|
for (let [n, r] of e.entries()) {
|
|
984
984
|
t.has(n) || t.set(n, 0);
|
|
@@ -989,7 +989,7 @@ function Et(e) {
|
|
|
989
989
|
}
|
|
990
990
|
return t;
|
|
991
991
|
}
|
|
992
|
-
function
|
|
992
|
+
function At(e) {
|
|
993
993
|
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
994
994
|
for (let [r, i] of e.entries()) i === 0 ? t.add(r) : n.add(r);
|
|
995
995
|
return {
|
|
@@ -997,7 +997,7 @@ function Dt(e) {
|
|
|
997
997
|
nonRoots: n
|
|
998
998
|
};
|
|
999
999
|
}
|
|
1000
|
-
function
|
|
1000
|
+
function jt(e) {
|
|
1001
1001
|
let t = /* @__PURE__ */ new Map();
|
|
1002
1002
|
for (let [n, r] of e.entries()) {
|
|
1003
1003
|
t.has(n) || t.set(n, /* @__PURE__ */ new Set());
|
|
@@ -1005,26 +1005,26 @@ function Ot(e) {
|
|
|
1005
1005
|
}
|
|
1006
1006
|
return t;
|
|
1007
1007
|
}
|
|
1008
|
-
function
|
|
1008
|
+
function Mt() {
|
|
1009
1009
|
return /* @__PURE__ */ new Map();
|
|
1010
1010
|
}
|
|
1011
|
-
function
|
|
1011
|
+
function Nt(e, t, n) {
|
|
1012
1012
|
return e.has(t) || e.set(t, /* @__PURE__ */ new Set()), e.get(t).add(n), e;
|
|
1013
1013
|
}
|
|
1014
|
-
function
|
|
1015
|
-
let t =
|
|
1014
|
+
function Pt(e) {
|
|
1015
|
+
let t = Mt();
|
|
1016
1016
|
for (let n of e) Array.isArray(n.runsBefore) && n.runsBefore.length > 0 ? n.runsBefore.forEach((e) => {
|
|
1017
|
-
|
|
1018
|
-
}) :
|
|
1019
|
-
let n =
|
|
1017
|
+
Nt(t, n.key, e);
|
|
1018
|
+
}) : Nt(t, "default", n.key);
|
|
1019
|
+
let n = Ot(t), r = n.findIndex((e) => e.has("default"));
|
|
1020
1020
|
return (e) => 91 + (n.findIndex((t) => t.has(e)) + r) * 10;
|
|
1021
1021
|
}
|
|
1022
1022
|
//#endregion
|
|
1023
1023
|
//#region src/schema/schema.ts
|
|
1024
|
-
function
|
|
1024
|
+
function Ft(e) {
|
|
1025
1025
|
return e && Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
|
|
1026
1026
|
}
|
|
1027
|
-
var
|
|
1027
|
+
var It = class {
|
|
1028
1028
|
opts;
|
|
1029
1029
|
BlockNoteEditor = "only for types";
|
|
1030
1030
|
Block = "only for types";
|
|
@@ -1041,14 +1041,14 @@ var Nt = class {
|
|
|
1041
1041
|
this.blockSpecs = t, this.styleSpecs = r, this.styleSchema = o, this.inlineContentSpecs = n, this.blockSchema = i, this.inlineContentSchema = a;
|
|
1042
1042
|
}
|
|
1043
1043
|
init() {
|
|
1044
|
-
let e =
|
|
1044
|
+
let e = Pt(Object.entries({
|
|
1045
1045
|
...this.opts.blockSpecs,
|
|
1046
1046
|
...this.opts.inlineContentSpecs,
|
|
1047
1047
|
...this.opts.styleSpecs
|
|
1048
1048
|
}).map(([e, t]) => ({
|
|
1049
1049
|
key: e,
|
|
1050
1050
|
runsBefore: t.implementation?.runsBefore ?? []
|
|
1051
|
-
}))), t = Object.fromEntries(Object.entries(this.opts.blockSpecs).map(([t, n]) => [t,
|
|
1051
|
+
}))), t = Object.fromEntries(Object.entries(this.opts.blockSpecs).map(([t, n]) => [t, gt(n.config, n.implementation, n.extensions, e(t))])), n = Object.fromEntries(Object.entries(this.opts.inlineContentSpecs).map(([t, n]) => typeof n.config == "object" ? [t, {
|
|
1052
1052
|
...n,
|
|
1053
1053
|
implementation: {
|
|
1054
1054
|
...n.implementation,
|
|
@@ -1064,10 +1064,10 @@ var Nt = class {
|
|
|
1064
1064
|
return {
|
|
1065
1065
|
blockSpecs: t,
|
|
1066
1066
|
blockSchema: Object.fromEntries(Object.entries(t).map(([e, t]) => [e, t.config])),
|
|
1067
|
-
inlineContentSpecs:
|
|
1068
|
-
styleSpecs:
|
|
1069
|
-
inlineContentSchema:
|
|
1070
|
-
styleSchema:
|
|
1067
|
+
inlineContentSpecs: Ft(n),
|
|
1068
|
+
styleSpecs: Ft(r),
|
|
1069
|
+
inlineContentSchema: xt(n),
|
|
1070
|
+
styleSchema: wt(r)
|
|
1071
1071
|
};
|
|
1072
1072
|
}
|
|
1073
1073
|
extend(e) {
|
|
@@ -1092,7 +1092,7 @@ var Nt = class {
|
|
|
1092
1092
|
//#endregion
|
|
1093
1093
|
//#region src/api/blockManipulation/tables/tables.ts
|
|
1094
1094
|
function z(e) {
|
|
1095
|
-
let { height: t, width: n } =
|
|
1095
|
+
let { height: t, width: n } = Lt(e), r = Array(t).fill(!1).map(() => Array(n).fill(null)), i = (e, i) => {
|
|
1096
1096
|
for (let a = e; a < t; a++) for (let e = i; e < n; e++) if (!r[a][e]) return {
|
|
1097
1097
|
row: a,
|
|
1098
1098
|
col: e
|
|
@@ -1129,7 +1129,7 @@ function V(e, t, n = z(t)) {
|
|
|
1129
1129
|
}
|
|
1130
1130
|
throw Error(`Unable to resolve relative table cell indices for table, cell at ${e.row},${e.col} is not occupied`);
|
|
1131
1131
|
}
|
|
1132
|
-
function
|
|
1132
|
+
function Lt(e) {
|
|
1133
1133
|
let t = e.content.rows.length, n = 0;
|
|
1134
1134
|
return e.content.rows.forEach((e) => {
|
|
1135
1135
|
let t = 0;
|
|
@@ -1141,7 +1141,7 @@ function Pt(e) {
|
|
|
1141
1141
|
width: n
|
|
1142
1142
|
};
|
|
1143
1143
|
}
|
|
1144
|
-
function
|
|
1144
|
+
function Rt(e, t, n = z(t)) {
|
|
1145
1145
|
let r = n[e.row]?.[e.col];
|
|
1146
1146
|
if (r) return {
|
|
1147
1147
|
row: r.row,
|
|
@@ -1149,7 +1149,7 @@ function Ft(e, t, n = z(t)) {
|
|
|
1149
1149
|
cell: r.cell
|
|
1150
1150
|
};
|
|
1151
1151
|
}
|
|
1152
|
-
function
|
|
1152
|
+
function zt(e, t) {
|
|
1153
1153
|
let n = z(e);
|
|
1154
1154
|
if (t < 0 || t >= n.length) return [];
|
|
1155
1155
|
let r = 0;
|
|
@@ -1158,13 +1158,13 @@ function It(e, t) {
|
|
|
1158
1158
|
if (!e) return [];
|
|
1159
1159
|
r += e.rowspan;
|
|
1160
1160
|
}
|
|
1161
|
-
let i = Array(n[0].length).fill(!1).map((t, i) =>
|
|
1161
|
+
let i = Array(n[0].length).fill(!1).map((t, i) => Rt({
|
|
1162
1162
|
row: r,
|
|
1163
1163
|
col: i
|
|
1164
1164
|
}, e, n)).filter((e) => e !== void 0);
|
|
1165
1165
|
return i.filter((e, t) => i.findIndex((t) => t.row === e.row && t.col === e.col) === t);
|
|
1166
1166
|
}
|
|
1167
|
-
function
|
|
1167
|
+
function Bt(e, t) {
|
|
1168
1168
|
let n = z(e);
|
|
1169
1169
|
if (t < 0 || t >= n[0].length) return [];
|
|
1170
1170
|
let r = 0;
|
|
@@ -1173,13 +1173,13 @@ function Lt(e, t) {
|
|
|
1173
1173
|
if (!e) return [];
|
|
1174
1174
|
r += e.colspan;
|
|
1175
1175
|
}
|
|
1176
|
-
let i = Array(n.length).fill(!1).map((t, i) =>
|
|
1176
|
+
let i = Array(n.length).fill(!1).map((t, i) => Rt({
|
|
1177
1177
|
row: i,
|
|
1178
1178
|
col: r
|
|
1179
1179
|
}, e, n)).filter((e) => e !== void 0);
|
|
1180
1180
|
return i.filter((e, t) => i.findIndex((t) => t.row === e.row && t.col === e.col) === t);
|
|
1181
1181
|
}
|
|
1182
|
-
function
|
|
1182
|
+
function Vt(e, t, n, r = z(e)) {
|
|
1183
1183
|
let { col: i } = V({
|
|
1184
1184
|
row: 0,
|
|
1185
1185
|
col: t
|
|
@@ -1192,7 +1192,7 @@ function Rt(e, t, n, r = z(e)) {
|
|
|
1192
1192
|
e.splice(a, 0, t);
|
|
1193
1193
|
}), B(r);
|
|
1194
1194
|
}
|
|
1195
|
-
function
|
|
1195
|
+
function Ht(e, t, n, r = z(e)) {
|
|
1196
1196
|
let { row: i } = V({
|
|
1197
1197
|
row: t,
|
|
1198
1198
|
col: 0
|
|
@@ -1202,13 +1202,13 @@ function zt(e, t, n, r = z(e)) {
|
|
|
1202
1202
|
}, e, r), [o] = r.splice(i, 1);
|
|
1203
1203
|
return r.splice(a, 0, o), B(r);
|
|
1204
1204
|
}
|
|
1205
|
-
function
|
|
1206
|
-
return e ? w(e) ?
|
|
1205
|
+
function Ut(e) {
|
|
1206
|
+
return e ? w(e) ? Ut(e.content) : typeof e == "string" ? e.length === 0 : Array.isArray(e) ? e.every((e) => typeof e == "string" ? e.length === 0 : S(e) ? e.text.length === 0 : Re(e) ? typeof e.content == "string" ? e.content.length === 0 : e.content.every((e) => e.text.length === 0) : !1) : !1 : !0;
|
|
1207
1207
|
}
|
|
1208
|
-
function
|
|
1208
|
+
function Wt(e, t, n = z(e)) {
|
|
1209
1209
|
if (t === "columns") {
|
|
1210
1210
|
let e = 0;
|
|
1211
|
-
for (let t = n[0].length - 1; t >= 0 && n.every((e) =>
|
|
1211
|
+
for (let t = n[0].length - 1; t >= 0 && n.every((e) => Ut(e[t].cell) && e[t].colspan === 1); t--) e++;
|
|
1212
1212
|
for (let t = n.length - 1; t >= 0; t--) {
|
|
1213
1213
|
let r = Math.max(n[t].length - e, 1);
|
|
1214
1214
|
n[t] = n[t].slice(0, r);
|
|
@@ -1216,12 +1216,12 @@ function Vt(e, t, n = z(e)) {
|
|
|
1216
1216
|
return B(n);
|
|
1217
1217
|
}
|
|
1218
1218
|
let r = 0;
|
|
1219
|
-
for (let e = n.length - 1; e >= 0 && n[e].every((e) =>
|
|
1219
|
+
for (let e = n.length - 1; e >= 0 && n[e].every((e) => Ut(e.cell) && e.rowspan === 1); e--) r++;
|
|
1220
1220
|
let i = Math.min(r, n.length - 1);
|
|
1221
1221
|
return n.splice(n.length - i, i), B(n);
|
|
1222
1222
|
}
|
|
1223
|
-
function
|
|
1224
|
-
let { width: i, height: a } =
|
|
1223
|
+
function Gt(e, t, n, r = z(e)) {
|
|
1224
|
+
let { width: i, height: a } = Lt(e);
|
|
1225
1225
|
if (t === "columns") r.forEach((e, t) => {
|
|
1226
1226
|
if (n >= 0) for (let r = 0; r < n; r++) e.push({
|
|
1227
1227
|
row: t,
|
|
@@ -1245,8 +1245,8 @@ function Ht(e, t, n, r = z(e)) {
|
|
|
1245
1245
|
else n < 0 && r.splice(a + n, -1 * n);
|
|
1246
1246
|
return B(r);
|
|
1247
1247
|
}
|
|
1248
|
-
function
|
|
1249
|
-
let r =
|
|
1248
|
+
function Kt(e, t, n) {
|
|
1249
|
+
let r = zt(e, n);
|
|
1250
1250
|
if (!r.some((e) => D(e.cell) > 1)) return !0;
|
|
1251
1251
|
let i = n, a = n;
|
|
1252
1252
|
return r.forEach((e) => {
|
|
@@ -1254,8 +1254,8 @@ function Ut(e, t, n) {
|
|
|
1254
1254
|
i = Math.max(i, e.row + t - 1), a = Math.min(a, e.row);
|
|
1255
1255
|
}), t < n ? n === i : n === a;
|
|
1256
1256
|
}
|
|
1257
|
-
function
|
|
1258
|
-
let r =
|
|
1257
|
+
function qt(e, t, n) {
|
|
1258
|
+
let r = Bt(e, n);
|
|
1259
1259
|
if (!r.some((e) => E(e.cell) > 1)) return !0;
|
|
1260
1260
|
let i = n, a = n;
|
|
1261
1261
|
return r.forEach((e) => {
|
|
@@ -1263,13 +1263,13 @@ function Wt(e, t, n) {
|
|
|
1263
1263
|
i = Math.max(i, e.col + t - 1), a = Math.min(a, e.col);
|
|
1264
1264
|
}), t < n ? n === i : n === a;
|
|
1265
1265
|
}
|
|
1266
|
-
function
|
|
1266
|
+
function Jt(e, t, n) {
|
|
1267
1267
|
let r = V(e, n), i = V(t, n);
|
|
1268
1268
|
return r.col === i.col;
|
|
1269
1269
|
}
|
|
1270
1270
|
//#endregion
|
|
1271
1271
|
//#region src/api/nodeConversions/blockToNode.ts
|
|
1272
|
-
function
|
|
1272
|
+
function Yt(e, t, n, r) {
|
|
1273
1273
|
let i = [];
|
|
1274
1274
|
for (let [r, a] of Object.entries(e.styles || {})) {
|
|
1275
1275
|
let e = n[r];
|
|
@@ -1278,33 +1278,33 @@ function Kt(e, t, n, r) {
|
|
|
1278
1278
|
else if (e.propSchema === "string") a && i.push(t.mark(r, { stringValue: a }));
|
|
1279
1279
|
else throw new O(e.propSchema);
|
|
1280
1280
|
}
|
|
1281
|
-
let a = r && t.nodes[r] &&
|
|
1282
|
-
return !r || !
|
|
1281
|
+
let a = r && t.nodes[r] && tt(t, t.nodes[r]) ? [...t.nodes[r].allowedMarks(i)] : i;
|
|
1282
|
+
return !r || !tt(t, t.nodes[r]) ? e.text.split(/(\n)/g).filter((e) => e.length > 0).map((e) => e === "\n" ? t.nodes.hardBreak.createChecked() : t.text(e, a)) : e.text.length > 0 ? [t.text(e.text, a)] : [];
|
|
1283
1283
|
}
|
|
1284
|
-
function
|
|
1284
|
+
function Xt(e, t, n) {
|
|
1285
1285
|
let r = t.marks.link.create({ href: e.href });
|
|
1286
|
-
return
|
|
1286
|
+
return Zt(e.content, t, n).map((e) => {
|
|
1287
1287
|
if (e.type.name === "text") return e.mark([...e.marks, r]);
|
|
1288
1288
|
if (e.type.name === "hardBreak") return e;
|
|
1289
1289
|
throw Error("unexpected node type");
|
|
1290
1290
|
});
|
|
1291
1291
|
}
|
|
1292
|
-
function
|
|
1292
|
+
function Zt(e, t, n, r) {
|
|
1293
1293
|
let i = [];
|
|
1294
|
-
if (typeof e == "string") return i.push(...
|
|
1294
|
+
if (typeof e == "string") return i.push(...Yt({
|
|
1295
1295
|
type: "text",
|
|
1296
1296
|
text: e,
|
|
1297
1297
|
styles: {}
|
|
1298
1298
|
}, t, n, r)), i;
|
|
1299
|
-
for (let a of e) i.push(...
|
|
1299
|
+
for (let a of e) i.push(...Yt(a, t, n, r));
|
|
1300
1300
|
return i;
|
|
1301
1301
|
}
|
|
1302
1302
|
function H(e, t, n, r = M(t)) {
|
|
1303
1303
|
let i = [];
|
|
1304
|
-
for (let a of e) typeof a == "string" ? i.push(...
|
|
1304
|
+
for (let a of e) typeof a == "string" ? i.push(...Zt(a, t, r, n)) : Re(a) ? i.push(...Xt(a, t, r)) : S(a) ? i.push(...Zt([a], t, r, n)) : i.push($t(a, t, r));
|
|
1305
1305
|
return i;
|
|
1306
1306
|
}
|
|
1307
|
-
function
|
|
1307
|
+
function Qt(e, t, n = M(t)) {
|
|
1308
1308
|
let r = [], i = Array(e.headerRows ?? 0).fill(!0), a = Array(e.headerCols ?? 0).fill(!0), o = e.columnWidths ?? [];
|
|
1309
1309
|
for (let s = 0; s < e.rows.length; s++) {
|
|
1310
1310
|
let c = e.rows[s], l = [], u = i[s];
|
|
@@ -1335,7 +1335,7 @@ function Yt(e, t, n = M(t)) {
|
|
|
1335
1335
|
}
|
|
1336
1336
|
return r;
|
|
1337
1337
|
}
|
|
1338
|
-
function
|
|
1338
|
+
function $t(e, t, n) {
|
|
1339
1339
|
let r, i = e.type;
|
|
1340
1340
|
if (i === void 0 && (i = "paragraph"), !t.nodes[i]) throw Error(`node type ${i} not found in schema`);
|
|
1341
1341
|
if (!e.content) r = t.nodes[i].createChecked(e.props);
|
|
@@ -1346,7 +1346,7 @@ function Xt(e, t, n) {
|
|
|
1346
1346
|
let a = H(e.content, t, i, n);
|
|
1347
1347
|
r = t.nodes[i].createChecked(e.props, a);
|
|
1348
1348
|
} else if (e.content.type === "tableContent") {
|
|
1349
|
-
let a =
|
|
1349
|
+
let a = Qt(e.content, t, n);
|
|
1350
1350
|
r = t.nodes[i].createChecked(e.props, a);
|
|
1351
1351
|
} else throw new O(e.content.type);
|
|
1352
1352
|
return r;
|
|
@@ -1357,7 +1357,7 @@ function U(e, t, n = M(t)) {
|
|
|
1357
1357
|
let i = [];
|
|
1358
1358
|
if (e.children) for (let r of e.children) i.push(U(r, t, n));
|
|
1359
1359
|
if (!e.type || t.nodes[e.type].isInGroup("blockContent")) {
|
|
1360
|
-
let a =
|
|
1360
|
+
let a = $t(e, t, n), o = i.length > 0 ? t.nodes.blockGroup.createChecked({}, i) : void 0;
|
|
1361
1361
|
return t.nodes.blockContainer.createChecked({
|
|
1362
1362
|
id: r,
|
|
1363
1363
|
...e.props
|
|
@@ -1371,29 +1371,29 @@ function U(e, t, n = M(t)) {
|
|
|
1371
1371
|
}
|
|
1372
1372
|
//#endregion
|
|
1373
1373
|
//#region src/api/nodeUtil.ts
|
|
1374
|
-
function
|
|
1374
|
+
function en(e, t) {
|
|
1375
1375
|
let n, r;
|
|
1376
|
-
if (t.firstChild.descendants((i, a) => n ? !1 : !
|
|
1376
|
+
if (t.firstChild.descendants((i, a) => n ? !1 : !tn(i) || !i.attrs.id || ke(i, t) !== e || (n = i, r = a + 1, !1)), n !== void 0 && r !== void 0) return {
|
|
1377
1377
|
node: n,
|
|
1378
1378
|
posBeforeNode: r
|
|
1379
1379
|
};
|
|
1380
1380
|
}
|
|
1381
|
-
function
|
|
1381
|
+
function tn(e) {
|
|
1382
1382
|
return e.type.isInGroup("bnBlock");
|
|
1383
1383
|
}
|
|
1384
1384
|
//#endregion
|
|
1385
1385
|
//#region src/api/blockManipulation/commands/updateBlock/updateBlock.ts
|
|
1386
|
-
var
|
|
1387
|
-
function
|
|
1386
|
+
var nn = (e, t) => ({ tr: n, dispatch: r }) => (r && rn(n, e, t), !0);
|
|
1387
|
+
function rn(e, t, n, r, i) {
|
|
1388
1388
|
let a = je(e.doc.resolve(t)), o = null;
|
|
1389
|
-
a.blockNoteType === "table" && (o =
|
|
1389
|
+
a.blockNoteType === "table" && (o = dn(e));
|
|
1390
1390
|
let s = j(e);
|
|
1391
1391
|
if (r !== void 0 && i !== void 0 && r > i) throw Error("Invalid replaceFromPos or replaceToPos");
|
|
1392
1392
|
let c = s.nodes[a.blockNoteType], l = s.nodes[n.type || a.blockNoteType], u = l.isInGroup("bnBlock") ? l : s.nodes.blockContainer;
|
|
1393
1393
|
if (a.isBlockContainer && l.isInGroup("blockContent")) {
|
|
1394
1394
|
let t = r !== void 0 && r > a.blockContent.beforePos && r < a.blockContent.afterPos ? r - a.blockContent.beforePos - 1 : void 0, o = i !== void 0 && i > a.blockContent.beforePos && i < a.blockContent.afterPos ? i - a.blockContent.beforePos - 1 : void 0;
|
|
1395
|
-
|
|
1396
|
-
} else if (!a.isBlockContainer && l.isInGroup("bnBlock"))
|
|
1395
|
+
ln(n, e, a), an(n, e, c, l, a, t, o);
|
|
1396
|
+
} else if (!a.isBlockContainer && l.isInGroup("bnBlock")) ln(n, e, a);
|
|
1397
1397
|
else {
|
|
1398
1398
|
let t = U({
|
|
1399
1399
|
children: N(a.bnBlock.node, e.doc).children,
|
|
@@ -1402,14 +1402,14 @@ function en(e, t, n, r, i) {
|
|
|
1402
1402
|
t.check(), e.replaceWith(a.bnBlock.beforePos, a.bnBlock.afterPos, t);
|
|
1403
1403
|
return;
|
|
1404
1404
|
}
|
|
1405
|
-
|
|
1405
|
+
sn(e, a.bnBlock.beforePos, u, { ...n.props }), o && fn(e, a, o);
|
|
1406
1406
|
}
|
|
1407
|
-
function
|
|
1407
|
+
function an(e, t, n, r, o, s, c) {
|
|
1408
1408
|
let l = j(t), u = "keep";
|
|
1409
1409
|
if (e.content) {
|
|
1410
1410
|
if (typeof e.content == "string") u = H([e.content], l, r.name);
|
|
1411
1411
|
else if (Array.isArray(e.content)) u = H(e.content, l, r.name);
|
|
1412
|
-
else if (e.content.type === "tableContent") u =
|
|
1412
|
+
else if (e.content.type === "tableContent") u = Qt(e.content, l);
|
|
1413
1413
|
else throw new O(e.content.type);
|
|
1414
1414
|
} else {
|
|
1415
1415
|
let e = o.blockContent.node.content;
|
|
@@ -1420,16 +1420,16 @@ function tn(e, t, n, r, o, s, c) {
|
|
|
1420
1420
|
} else u = [];
|
|
1421
1421
|
}
|
|
1422
1422
|
}
|
|
1423
|
-
if (u === "keep")
|
|
1423
|
+
if (u === "keep") sn(t, o.blockContent.beforePos, r, { ...e.props });
|
|
1424
1424
|
else if (s !== void 0 || c !== void 0) {
|
|
1425
|
-
let n =
|
|
1425
|
+
let n = cn(t, o.blockContent.beforePos, r, { ...e.props }), l = n + 1 + (s ?? 0), d = n + 1 + (c ?? o.blockContent.node.content.size), f = t.doc.resolve(n).depth, p = t.doc.resolve(l).depth, m = t.doc.resolve(d).depth;
|
|
1426
1426
|
t.replace(l, d, new a(i.from(u), p - f - 1, m - f - 1));
|
|
1427
|
-
} else r === n || r.validContent(o.blockContent.node.content) ?
|
|
1427
|
+
} else r === n || r.validContent(o.blockContent.node.content) ? on(t, cn(t, o.blockContent.beforePos, r, { ...e.props }), i.from(u)) : t.replaceWith(o.blockContent.beforePos, o.blockContent.afterPos, r.createChecked({
|
|
1428
1428
|
...o.blockContent.node.attrs,
|
|
1429
1429
|
...e.props
|
|
1430
1430
|
}, u));
|
|
1431
1431
|
}
|
|
1432
|
-
function
|
|
1432
|
+
function on(e, t, n) {
|
|
1433
1433
|
let r = e.doc.nodeAt(t);
|
|
1434
1434
|
if (!r) throw RangeError("No node at given position");
|
|
1435
1435
|
let s = r.content, c = t + 1;
|
|
@@ -1453,7 +1453,7 @@ function nn(e, t, n) {
|
|
|
1453
1453
|
for (let e = d; e < p; e++) g.push(n.child(e));
|
|
1454
1454
|
e.step(new o(m, h, new a(i.from(g), 0, 0)));
|
|
1455
1455
|
}
|
|
1456
|
-
function
|
|
1456
|
+
function sn(e, t, n, r) {
|
|
1457
1457
|
let i = e.doc.nodeAt(t);
|
|
1458
1458
|
if (!i) throw RangeError("No node at given position");
|
|
1459
1459
|
let a = n.spec.attrs ?? {}, o = {};
|
|
@@ -1468,30 +1468,30 @@ function rn(e, t, n, r) {
|
|
|
1468
1468
|
}
|
|
1469
1469
|
e.setNodeMarkup(t, n, s);
|
|
1470
1470
|
}
|
|
1471
|
-
function
|
|
1471
|
+
function cn(e, t, n, r) {
|
|
1472
1472
|
let i = e.mapping.maps.length;
|
|
1473
|
-
return
|
|
1473
|
+
return sn(e, t, n, r), e.mapping.slice(i).map(t, -1);
|
|
1474
1474
|
}
|
|
1475
|
-
function
|
|
1475
|
+
function ln(e, t, n) {
|
|
1476
1476
|
let r = j(t);
|
|
1477
1477
|
if (e.children !== void 0 && e.children.length > 0) {
|
|
1478
1478
|
let a = e.children.map((e) => {
|
|
1479
1479
|
let t = U(e, r);
|
|
1480
1480
|
return t.check(), t;
|
|
1481
1481
|
});
|
|
1482
|
-
if (n.childContainer)
|
|
1482
|
+
if (n.childContainer) on(t, n.childContainer.beforePos, i.from(a));
|
|
1483
1483
|
else {
|
|
1484
1484
|
if (!n.isBlockContainer) throw Error("impossible");
|
|
1485
1485
|
t.insert(n.blockContent.afterPos, r.nodes.blockGroup.createChecked({}, a));
|
|
1486
1486
|
}
|
|
1487
1487
|
}
|
|
1488
1488
|
}
|
|
1489
|
-
function
|
|
1490
|
-
let a = typeof t == "string" ? t : t.id, o =
|
|
1489
|
+
function un(e, t, n, r, i) {
|
|
1490
|
+
let a = typeof t == "string" ? t : t.id, o = en(a, e.doc);
|
|
1491
1491
|
if (!o) throw Error(`Block with ID ${a} not found`);
|
|
1492
|
-
return
|
|
1492
|
+
return rn(e, o.posBeforeNode, n, r, i), N(e.doc.resolve(o.posBeforeNode + 1).node(), e.doc);
|
|
1493
1493
|
}
|
|
1494
|
-
function
|
|
1494
|
+
function dn(e) {
|
|
1495
1495
|
let t = "selection" in e ? e.selection : null;
|
|
1496
1496
|
if (!(t instanceof re)) return null;
|
|
1497
1497
|
let n = e.doc.resolve(t.head), r = -1, i = -1;
|
|
@@ -1514,7 +1514,7 @@ function cn(e) {
|
|
|
1514
1514
|
offset: Math.max(0, t.head - p)
|
|
1515
1515
|
};
|
|
1516
1516
|
}
|
|
1517
|
-
function
|
|
1517
|
+
function fn(e, t, n) {
|
|
1518
1518
|
if (t.blockNoteType !== "table") return !1;
|
|
1519
1519
|
let r = -1;
|
|
1520
1520
|
if (t.isBlockContainer) r = e.mapping.map(t.blockContent.beforePos);
|
|
@@ -1568,7 +1568,7 @@ var W = {
|
|
|
1568
1568
|
text: "#ad1a72",
|
|
1569
1569
|
background: "#f4dfeb"
|
|
1570
1570
|
}
|
|
1571
|
-
},
|
|
1571
|
+
}, pn = {
|
|
1572
1572
|
gray: {
|
|
1573
1573
|
text: "#bebdb8",
|
|
1574
1574
|
background: "#9b9a97"
|
|
@@ -1622,19 +1622,19 @@ var W = {
|
|
|
1622
1622
|
return e.hasAttribute("data-background-color") ? t.backgroundColor = e.getAttribute("data-background-color") : e.style.backgroundColor && (t.backgroundColor = e.style.backgroundColor), e.hasAttribute("data-text-color") ? t.textColor = e.getAttribute("data-text-color") : e.style.color && (t.textColor = e.style.color), t.textAlignment = G.textAlignment.values.includes(e.style.textAlign) ? e.style.textAlign : void 0, t;
|
|
1623
1623
|
}, q = (e, t) => {
|
|
1624
1624
|
e.backgroundColor && e.backgroundColor !== G.backgroundColor.default && (t.style.backgroundColor = e.backgroundColor in W ? W[e.backgroundColor].background : e.backgroundColor), e.textColor && e.textColor !== G.textColor.default && (t.style.color = e.textColor in W ? W[e.textColor].text : e.textColor), e.textAlignment && e.textAlignment !== G.textAlignment.default && (t.style.textAlign = e.textAlignment);
|
|
1625
|
-
},
|
|
1625
|
+
}, mn = (e = "backgroundColor") => ({
|
|
1626
1626
|
default: G.backgroundColor.default,
|
|
1627
1627
|
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : e.style.backgroundColor ? e.style.backgroundColor : G.backgroundColor.default,
|
|
1628
1628
|
renderHTML: (t) => t[e] === G.backgroundColor.default ? {} : { "data-background-color": t[e] }
|
|
1629
|
-
}),
|
|
1629
|
+
}), hn = (e = "textColor") => ({
|
|
1630
1630
|
default: G.textColor.default,
|
|
1631
1631
|
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : e.style.color ? e.style.color : G.textColor.default,
|
|
1632
1632
|
renderHTML: (t) => t[e] === G.textColor.default ? {} : { "data-text-color": t[e] }
|
|
1633
|
-
}),
|
|
1633
|
+
}), gn = (e = "textAlignment") => ({
|
|
1634
1634
|
default: G.textAlignment.default,
|
|
1635
1635
|
parseHTML: (e) => e.hasAttribute("data-text-alignment") ? e.getAttribute("data-text-alignment") : e.style.textAlign ? e.style.textAlign : G.textAlignment.default,
|
|
1636
1636
|
renderHTML: (t) => t[e] === G.textAlignment.default ? {} : { "data-text-alignment": t[e] }
|
|
1637
|
-
}),
|
|
1637
|
+
}), _n = (e, t) => {
|
|
1638
1638
|
let n = e.querySelector(t);
|
|
1639
1639
|
if (n) return {
|
|
1640
1640
|
targetElement: n,
|
|
@@ -1659,7 +1659,7 @@ var W = {
|
|
|
1659
1659
|
n.setState(e);
|
|
1660
1660
|
}
|
|
1661
1661
|
};
|
|
1662
|
-
}),
|
|
1662
|
+
}), vn = (e, t, n) => {
|
|
1663
1663
|
let r = document.createElement("div");
|
|
1664
1664
|
r.className = "bn-add-file-button";
|
|
1665
1665
|
let i = document.createElement("div");
|
|
@@ -1677,17 +1677,17 @@ var W = {
|
|
|
1677
1677
|
r.removeEventListener("mousedown", o, !0), r.removeEventListener("click", s, !0);
|
|
1678
1678
|
}
|
|
1679
1679
|
};
|
|
1680
|
-
},
|
|
1680
|
+
}, yn = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z\"></path></svg>", bn = (e) => {
|
|
1681
1681
|
let t = document.createElement("div");
|
|
1682
1682
|
t.className = "bn-file-name-with-icon";
|
|
1683
1683
|
let n = document.createElement("div");
|
|
1684
|
-
n.className = "bn-file-icon", n.innerHTML =
|
|
1684
|
+
n.className = "bn-file-icon", n.innerHTML = yn, t.appendChild(n);
|
|
1685
1685
|
let r = document.createElement("p");
|
|
1686
1686
|
return r.className = "bn-file-name", r.textContent = e.props.name, t.appendChild(r), { dom: t };
|
|
1687
|
-
},
|
|
1687
|
+
}, xn = (e, t, n, r) => {
|
|
1688
1688
|
let i = e.props.url !== "" && !!e.props.caption, a = document.createElement(i ? "figure" : "div");
|
|
1689
1689
|
if (a.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
1690
|
-
let n =
|
|
1690
|
+
let n = vn(e, t, r);
|
|
1691
1691
|
a.appendChild(n.dom);
|
|
1692
1692
|
let i = t.onUploadStart((t) => {
|
|
1693
1693
|
if (t === e.id) {
|
|
@@ -1705,7 +1705,7 @@ var W = {
|
|
|
1705
1705
|
}
|
|
1706
1706
|
let o = { dom: a };
|
|
1707
1707
|
if (e.props.showPreview === !1 || !n) {
|
|
1708
|
-
let t =
|
|
1708
|
+
let t = bn(e);
|
|
1709
1709
|
a.appendChild(t.dom), o.destroy = () => {
|
|
1710
1710
|
t.destroy?.();
|
|
1711
1711
|
};
|
|
@@ -1715,13 +1715,13 @@ var W = {
|
|
|
1715
1715
|
t.className = "bn-file-caption", t.textContent = e.props.caption, a.appendChild(t);
|
|
1716
1716
|
}
|
|
1717
1717
|
return o;
|
|
1718
|
-
},
|
|
1718
|
+
}, Sn = (e, t) => {
|
|
1719
1719
|
let n = document.createElement("figure"), r = document.createElement("figcaption");
|
|
1720
1720
|
return r.textContent = t, n.appendChild(e), n.appendChild(r), { dom: n };
|
|
1721
|
-
},
|
|
1721
|
+
}, Cn = (e, t) => {
|
|
1722
1722
|
let n = document.createElement("div"), r = document.createElement("p");
|
|
1723
1723
|
return r.textContent = t, n.appendChild(e), n.appendChild(r), { dom: n };
|
|
1724
|
-
},
|
|
1724
|
+
}, wn = (e) => ({ url: e.src || void 0 }), Tn = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z\"></path></svg>", En = F((e) => ({
|
|
1725
1725
|
type: "audio",
|
|
1726
1726
|
propSchema: {
|
|
1727
1727
|
backgroundColor: G.backgroundColor,
|
|
@@ -1731,55 +1731,55 @@ var W = {
|
|
|
1731
1731
|
showPreview: { default: !0 }
|
|
1732
1732
|
},
|
|
1733
1733
|
content: "none"
|
|
1734
|
-
})),
|
|
1734
|
+
})), Dn = (e = {}) => (e) => {
|
|
1735
1735
|
if (e.tagName === "AUDIO") {
|
|
1736
1736
|
if (e.closest("figure")) return;
|
|
1737
1737
|
let { backgroundColor: t } = K(e);
|
|
1738
1738
|
return {
|
|
1739
|
-
...
|
|
1739
|
+
...wn(e),
|
|
1740
1740
|
backgroundColor: t
|
|
1741
1741
|
};
|
|
1742
1742
|
}
|
|
1743
1743
|
if (e.tagName === "FIGURE") {
|
|
1744
|
-
let t =
|
|
1744
|
+
let t = _n(e, "audio");
|
|
1745
1745
|
if (!t) return;
|
|
1746
1746
|
let { targetElement: n, caption: r } = t, { backgroundColor: i } = K(e);
|
|
1747
1747
|
return {
|
|
1748
|
-
...
|
|
1748
|
+
...wn(n),
|
|
1749
1749
|
backgroundColor: i,
|
|
1750
1750
|
caption: r
|
|
1751
1751
|
};
|
|
1752
1752
|
}
|
|
1753
|
-
},
|
|
1753
|
+
}, On = (e = {}) => (t, n) => {
|
|
1754
1754
|
let r = document.createElement("div");
|
|
1755
1755
|
r.innerHTML = e.icon ?? "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z\"></path></svg>";
|
|
1756
1756
|
let i = document.createElement("audio");
|
|
1757
1757
|
return i.className = "bn-audio", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
1758
1758
|
i.src = e;
|
|
1759
|
-
}) : i.src = t.props.url, i.controls = !0, i.contentEditable = "false", i.draggable = !1,
|
|
1760
|
-
},
|
|
1759
|
+
}) : i.src = t.props.url, i.controls = !0, i.contentEditable = "false", i.draggable = !1, xn(t, n, { dom: i }, r.firstElementChild);
|
|
1760
|
+
}, kn = (e = {}) => (e, t) => {
|
|
1761
1761
|
if (!e.props.url) return { dom: document.createElement("audio") };
|
|
1762
1762
|
let n;
|
|
1763
|
-
return e.props.showPreview ? (n = document.createElement("audio"), n.src = e.props.url) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
1764
|
-
},
|
|
1763
|
+
return e.props.showPreview ? (n = document.createElement("audio"), n.src = e.props.url) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Sn(n, e.props.caption) : Cn(n, e.props.caption) : { dom: n };
|
|
1764
|
+
}, An = I(En, (e) => ({
|
|
1765
1765
|
meta: { fileBlockAccept: ["audio/*"] },
|
|
1766
|
-
parse:
|
|
1767
|
-
render:
|
|
1768
|
-
toExternalHTML:
|
|
1766
|
+
parse: Dn(e),
|
|
1767
|
+
render: On(e),
|
|
1768
|
+
toExternalHTML: kn(e),
|
|
1769
1769
|
runsBefore: ["file"]
|
|
1770
|
-
})),
|
|
1770
|
+
})), jn = (e) => {
|
|
1771
1771
|
{
|
|
1772
1772
|
if (e.tagName !== "PRE" || e.childElementCount !== 1 || e.firstElementChild?.tagName !== "CODE") return;
|
|
1773
1773
|
let t = e.firstElementChild;
|
|
1774
1774
|
return { language: t.getAttribute("data-language") || t.className.split(" ").find((e) => e.startsWith("language-"))?.replace("language-", "") };
|
|
1775
1775
|
}
|
|
1776
|
-
},
|
|
1776
|
+
}, Mn = ({ el: e, schema: t }, n) => {
|
|
1777
1777
|
let r = ie.fromSchema(t), i = e.firstElementChild;
|
|
1778
1778
|
return r.parse(i, {
|
|
1779
1779
|
preserveWhitespace: "full",
|
|
1780
1780
|
topNode: t.nodes[n].create()
|
|
1781
1781
|
}).content;
|
|
1782
|
-
},
|
|
1782
|
+
}, Nn = (e) => {
|
|
1783
1783
|
let t = document.createElement("pre"), n = document.createElement("code");
|
|
1784
1784
|
return n.className = `language-${e.props.language}`, n.dataset.language = e.props.language, t.appendChild(n), {
|
|
1785
1785
|
dom: t,
|
|
@@ -1788,13 +1788,13 @@ var W = {
|
|
|
1788
1788
|
};
|
|
1789
1789
|
//#endregion
|
|
1790
1790
|
//#region src/blocks/Code/CodeBlockOptions.ts
|
|
1791
|
-
function
|
|
1791
|
+
function Pn(e, t) {
|
|
1792
1792
|
let n = t.trim().toLowerCase();
|
|
1793
1793
|
return Object.entries(e.supportedLanguages ?? {}).find(([e, { aliases: t }]) => e.toLowerCase() === n || t?.some((e) => e.toLowerCase() === n))?.[0];
|
|
1794
1794
|
}
|
|
1795
1795
|
//#endregion
|
|
1796
1796
|
//#region src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.ts
|
|
1797
|
-
var
|
|
1797
|
+
var Fn = (e) => (t, r) => n({
|
|
1798
1798
|
key: t,
|
|
1799
1799
|
keyboardShortcuts: {
|
|
1800
1800
|
Delete: ({ editor: e }) => e.transact((t) => {
|
|
@@ -1831,12 +1831,12 @@ var Mn = (e) => (t, r) => n({
|
|
|
1831
1831
|
let n = t[1].trim();
|
|
1832
1832
|
return {
|
|
1833
1833
|
type: r,
|
|
1834
|
-
props: { language: { language:
|
|
1834
|
+
props: { language: { language: Pn(e, n) ?? n }.language },
|
|
1835
1835
|
content: []
|
|
1836
1836
|
};
|
|
1837
1837
|
}
|
|
1838
1838
|
}]
|
|
1839
|
-
}),
|
|
1839
|
+
}), In = (e, t, n, r) => {
|
|
1840
1840
|
if (!(n in r)) throw Error(`Language ${n} is not supported.`);
|
|
1841
1841
|
let i = document.createElement("select");
|
|
1842
1842
|
Object.entries(r).forEach(([e, { name: t }]) => {
|
|
@@ -1852,40 +1852,40 @@ var Mn = (e) => (t, r) => n({
|
|
|
1852
1852
|
dom: o,
|
|
1853
1853
|
destroy: () => i.removeEventListener("change", a)
|
|
1854
1854
|
};
|
|
1855
|
-
},
|
|
1855
|
+
}, Ln = (e, t, n) => {
|
|
1856
1856
|
let r = document.createElement("pre"), i = document.createElement("code");
|
|
1857
1857
|
r.appendChild(i);
|
|
1858
1858
|
let a = document.createDocumentFragment(), o;
|
|
1859
|
-
return n && Object.keys(n.supportedLanguages).length > 1 && (o =
|
|
1859
|
+
return n && Object.keys(n.supportedLanguages).length > 1 && (o = In(e, t, n.selectedLanguage, n.supportedLanguages), a.appendChild(o.dom)), a.appendChild(r), {
|
|
1860
1860
|
dom: a,
|
|
1861
1861
|
contentDOM: i,
|
|
1862
1862
|
destroy: () => {
|
|
1863
1863
|
o?.destroy();
|
|
1864
1864
|
}
|
|
1865
1865
|
};
|
|
1866
|
-
},
|
|
1866
|
+
}, Rn = "code-block-keyboard-shortcuts", zn = F(({ defaultLanguage: e = "text" }) => ({
|
|
1867
1867
|
type: "codeBlock",
|
|
1868
1868
|
propSchema: { language: { default: e } },
|
|
1869
1869
|
content: "plain"
|
|
1870
|
-
})),
|
|
1870
|
+
})), Bn = I(zn, (e) => ({
|
|
1871
1871
|
meta: {
|
|
1872
1872
|
code: !0,
|
|
1873
1873
|
defining: !0,
|
|
1874
1874
|
isolating: !1,
|
|
1875
1875
|
highlight: (e) => e.props.language
|
|
1876
1876
|
},
|
|
1877
|
-
parse: (e) =>
|
|
1878
|
-
parseContent: (e) =>
|
|
1879
|
-
render: (t, n) =>
|
|
1877
|
+
parse: (e) => jn(e),
|
|
1878
|
+
parseContent: (e) => Mn(e, "codeBlock"),
|
|
1879
|
+
render: (t, n) => Ln(t, n, e.supportedLanguages && {
|
|
1880
1880
|
selectedLanguage: t.props.language,
|
|
1881
1881
|
supportedLanguages: e.supportedLanguages
|
|
1882
1882
|
}),
|
|
1883
|
-
toExternalHTML: (e) =>
|
|
1884
|
-
}), (e) => [
|
|
1883
|
+
toExternalHTML: (e) => Nn(e)
|
|
1884
|
+
}), (e) => [Fn(e)(Rn, "codeBlock")]), Vn = F(() => ({
|
|
1885
1885
|
type: "divider",
|
|
1886
1886
|
propSchema: {},
|
|
1887
1887
|
content: "none"
|
|
1888
|
-
})),
|
|
1888
|
+
})), Hn = I(Vn, {
|
|
1889
1889
|
meta: { isolating: !1 },
|
|
1890
1890
|
parse(e) {
|
|
1891
1891
|
if (e.tagName === "HR") return {};
|
|
@@ -1905,7 +1905,7 @@ var Mn = (e) => (t, r) => n({
|
|
|
1905
1905
|
};
|
|
1906
1906
|
}
|
|
1907
1907
|
}]
|
|
1908
|
-
})]),
|
|
1908
|
+
})]), Un = (e) => ({ url: e.src || void 0 }), Wn = F(() => ({
|
|
1909
1909
|
type: "file",
|
|
1910
1910
|
propSchema: {
|
|
1911
1911
|
backgroundColor: G.backgroundColor,
|
|
@@ -1914,44 +1914,44 @@ var Mn = (e) => (t, r) => n({
|
|
|
1914
1914
|
caption: { default: "" }
|
|
1915
1915
|
},
|
|
1916
1916
|
content: "none"
|
|
1917
|
-
})),
|
|
1917
|
+
})), Gn = () => (e) => {
|
|
1918
1918
|
if (e.tagName === "EMBED") {
|
|
1919
1919
|
if (e.closest("figure")) return;
|
|
1920
1920
|
let { backgroundColor: t } = K(e);
|
|
1921
1921
|
return {
|
|
1922
|
-
...
|
|
1922
|
+
...Un(e),
|
|
1923
1923
|
backgroundColor: t
|
|
1924
1924
|
};
|
|
1925
1925
|
}
|
|
1926
1926
|
if (e.tagName === "FIGURE") {
|
|
1927
|
-
let t =
|
|
1927
|
+
let t = _n(e, "embed");
|
|
1928
1928
|
if (!t) return;
|
|
1929
1929
|
let { targetElement: n, caption: r } = t, { backgroundColor: i } = K(e);
|
|
1930
1930
|
return {
|
|
1931
|
-
...
|
|
1931
|
+
...Un(n),
|
|
1932
1932
|
backgroundColor: i,
|
|
1933
1933
|
caption: r
|
|
1934
1934
|
};
|
|
1935
1935
|
}
|
|
1936
|
-
},
|
|
1936
|
+
}, Kn = I(Wn, {
|
|
1937
1937
|
meta: { fileBlockAccept: ["*/*"] },
|
|
1938
|
-
parse:
|
|
1938
|
+
parse: Gn(),
|
|
1939
1939
|
render(e, t) {
|
|
1940
|
-
return
|
|
1940
|
+
return xn(e, t);
|
|
1941
1941
|
},
|
|
1942
1942
|
toExternalHTML(e) {
|
|
1943
1943
|
if (!e.props.url) return { dom: document.createElement("embed") };
|
|
1944
1944
|
let t = document.createElement("a");
|
|
1945
|
-
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ?
|
|
1945
|
+
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ? Cn(t, e.props.caption) : { dom: t };
|
|
1946
1946
|
}
|
|
1947
1947
|
});
|
|
1948
1948
|
//#endregion
|
|
1949
1949
|
//#region src/blocks/getDetailsContent.ts
|
|
1950
|
-
function
|
|
1950
|
+
function qn(e, t, n) {
|
|
1951
1951
|
let a = r.fromSchema(t), o = e.querySelector(":scope > summary"), s;
|
|
1952
1952
|
if (o) {
|
|
1953
1953
|
let e = o.cloneNode(!0);
|
|
1954
|
-
|
|
1954
|
+
qe(e), s = a.parse(e, {
|
|
1955
1955
|
topNode: t.nodes.paragraph.create(),
|
|
1956
1956
|
preserveWhitespace: !0
|
|
1957
1957
|
}).content;
|
|
@@ -1967,10 +1967,10 @@ function Wn(e, t, n) {
|
|
|
1967
1967
|
}
|
|
1968
1968
|
//#endregion
|
|
1969
1969
|
//#region src/blocks/ToggleWrapper/createToggleWrapper.ts
|
|
1970
|
-
var
|
|
1970
|
+
var Jn = {
|
|
1971
1971
|
set: (e, t) => window.localStorage.setItem(`toggle-${e.id}`, t ? "true" : "false"),
|
|
1972
1972
|
get: (e) => window.localStorage.getItem(`toggle-${e.id}`) === "true"
|
|
1973
|
-
},
|
|
1973
|
+
}, Yn = (e, t, n, r = Jn) => {
|
|
1974
1974
|
if ("isToggleable" in e.props && !e.props.isToggleable) return { dom: n };
|
|
1975
1975
|
let i = document.createElement("div"), a = document.createElement("div");
|
|
1976
1976
|
a.className = "bn-toggle-wrapper";
|
|
@@ -2020,20 +2020,20 @@ var Gn = {
|
|
|
2020
2020
|
o.removeEventListener("mousedown", s), o.removeEventListener("click", c), l.removeEventListener("mousedown", u), l.removeEventListener("click", d), p?.();
|
|
2021
2021
|
}
|
|
2022
2022
|
};
|
|
2023
|
-
},
|
|
2023
|
+
}, Xn = [
|
|
2024
2024
|
1,
|
|
2025
2025
|
2,
|
|
2026
2026
|
3,
|
|
2027
2027
|
4,
|
|
2028
2028
|
5,
|
|
2029
2029
|
6
|
|
2030
|
-
],
|
|
2030
|
+
], Zn = (e) => ({ editor: t }) => {
|
|
2031
2031
|
let n = t.getTextCursorPosition();
|
|
2032
2032
|
return t.schema.blockSchema[n.block.type].content === "inline" && (t.updateBlock(n.block, {
|
|
2033
2033
|
type: "heading",
|
|
2034
2034
|
props: { level: e }
|
|
2035
2035
|
}), !0);
|
|
2036
|
-
},
|
|
2036
|
+
}, Qn = F(({ defaultLevel: e = 1, levels: t = Xn, allowToggleHeadings: n = !0 } = {}) => ({
|
|
2037
2037
|
type: "heading",
|
|
2038
2038
|
propSchema: {
|
|
2039
2039
|
...G,
|
|
@@ -2047,7 +2047,7 @@ var Gn = {
|
|
|
2047
2047
|
} } : {}
|
|
2048
2048
|
},
|
|
2049
2049
|
content: "inline"
|
|
2050
|
-
})),
|
|
2050
|
+
})), $n = I(Qn, ({ allowToggleHeadings: e = !0 } = {}) => ({
|
|
2051
2051
|
meta: { isolating: !1 },
|
|
2052
2052
|
parse(t) {
|
|
2053
2053
|
if (e && t.tagName === "DETAILS") {
|
|
@@ -2088,13 +2088,13 @@ var Gn = {
|
|
|
2088
2088
|
};
|
|
2089
2089
|
},
|
|
2090
2090
|
...e ? { parseContent: ({ el: e, schema: t }) => {
|
|
2091
|
-
if (e.tagName === "DETAILS") return
|
|
2091
|
+
if (e.tagName === "DETAILS") return qn(e, t, "heading");
|
|
2092
2092
|
} } : {},
|
|
2093
2093
|
runsBefore: ["toggleListItem"],
|
|
2094
2094
|
render(t, n) {
|
|
2095
2095
|
let r = document.createElement(`h${t.props.level}`);
|
|
2096
2096
|
return e ? {
|
|
2097
|
-
...
|
|
2097
|
+
...Yn(t, n, r),
|
|
2098
2098
|
contentDOM: r
|
|
2099
2099
|
} : {
|
|
2100
2100
|
dom: r,
|
|
@@ -2118,9 +2118,9 @@ var Gn = {
|
|
|
2118
2118
|
contentDOM: n
|
|
2119
2119
|
};
|
|
2120
2120
|
}
|
|
2121
|
-
}), ({ levels: e =
|
|
2121
|
+
}), ({ levels: e = Xn } = {}) => [n({
|
|
2122
2122
|
key: "heading-shortcuts",
|
|
2123
|
-
keyboardShortcuts: Object.fromEntries(e.map((e) => [`Mod-Alt-${e}`,
|
|
2123
|
+
keyboardShortcuts: Object.fromEntries(e.map((e) => [`Mod-Alt-${e}`, Zn(e)]) ?? []),
|
|
2124
2124
|
inputRules: e.map((e) => ({
|
|
2125
2125
|
find: RegExp(`^(#{${e}})\\s$`),
|
|
2126
2126
|
replace({ match: e }) {
|
|
@@ -2130,8 +2130,8 @@ var Gn = {
|
|
|
2130
2130
|
};
|
|
2131
2131
|
}
|
|
2132
2132
|
}))
|
|
2133
|
-
})]),
|
|
2134
|
-
let { dom: a, destroy: o } =
|
|
2133
|
+
})]), er = (e, t, n, r, i) => {
|
|
2134
|
+
let { dom: a, destroy: o } = xn(e, t, n, i), s = a;
|
|
2135
2135
|
s.style.position = "relative", e.props.url && e.props.showPreview && (e.props.previewWidth ? s.style.width = `${e.props.previewWidth}px` : s.style.width = "fit-content");
|
|
2136
2136
|
let c = document.createElement("div");
|
|
2137
2137
|
c.className = "bn-resize-handle", c.style.left = "4px", c.style.display = "none", r.appendChild(c);
|
|
@@ -2175,11 +2175,11 @@ var Gn = {
|
|
|
2175
2175
|
o?.(), window.removeEventListener("mousemove", p), window.removeEventListener("touchmove", p), window.removeEventListener("mouseup", m), window.removeEventListener("touchend", m), s.removeEventListener("mouseenter", h), s.removeEventListener("mouseleave", g), c.removeEventListener("mousedown", _), c.removeEventListener("touchstart", _), l.removeEventListener("mousedown", v), l.removeEventListener("touchstart", v);
|
|
2176
2176
|
}
|
|
2177
2177
|
};
|
|
2178
|
-
},
|
|
2178
|
+
}, tr = (e) => ({
|
|
2179
2179
|
url: e.src || void 0,
|
|
2180
2180
|
previewWidth: e.width || void 0,
|
|
2181
2181
|
name: e.alt || void 0
|
|
2182
|
-
}),
|
|
2182
|
+
}), nr = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z\"></path></svg>", rr = F((e = {}) => ({
|
|
2183
2183
|
type: "image",
|
|
2184
2184
|
propSchema: {
|
|
2185
2185
|
textAlignment: G.textAlignment,
|
|
@@ -2194,26 +2194,26 @@ var Gn = {
|
|
|
2194
2194
|
}
|
|
2195
2195
|
},
|
|
2196
2196
|
content: "none"
|
|
2197
|
-
})),
|
|
2197
|
+
})), ir = (e = {}) => (e) => {
|
|
2198
2198
|
if (e.tagName === "IMG") {
|
|
2199
2199
|
if (e.closest("figure")) return;
|
|
2200
2200
|
let { backgroundColor: t } = K(e);
|
|
2201
2201
|
return {
|
|
2202
|
-
...
|
|
2202
|
+
...tr(e),
|
|
2203
2203
|
backgroundColor: t
|
|
2204
2204
|
};
|
|
2205
2205
|
}
|
|
2206
2206
|
if (e.tagName === "FIGURE") {
|
|
2207
|
-
let t =
|
|
2207
|
+
let t = _n(e, "img");
|
|
2208
2208
|
if (!t) return;
|
|
2209
2209
|
let { targetElement: n, caption: r } = t, { backgroundColor: i } = K(e);
|
|
2210
2210
|
return {
|
|
2211
|
-
...
|
|
2211
|
+
...tr(n),
|
|
2212
2212
|
backgroundColor: i,
|
|
2213
2213
|
caption: r
|
|
2214
2214
|
};
|
|
2215
2215
|
}
|
|
2216
|
-
},
|
|
2216
|
+
}, ar = (e = {}) => (t, n) => {
|
|
2217
2217
|
let r = document.createElement("div");
|
|
2218
2218
|
r.innerHTML = e.icon ?? "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z\"></path></svg>";
|
|
2219
2219
|
let i = document.createElement("div");
|
|
@@ -2221,18 +2221,18 @@ var Gn = {
|
|
|
2221
2221
|
let a = document.createElement("img");
|
|
2222
2222
|
return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
2223
2223
|
a.src = e;
|
|
2224
|
-
}) : a.src = t.props.url, a.alt = t.props.name || "", a.contentEditable = "false", a.draggable = !1, t.props.previewWidth && (a.width = t.props.previewWidth), i.appendChild(a),
|
|
2225
|
-
},
|
|
2224
|
+
}) : a.src = t.props.url, a.alt = t.props.name || "", a.contentEditable = "false", a.draggable = !1, t.props.previewWidth && (a.width = t.props.previewWidth), i.appendChild(a), er(t, n, { dom: i }, i, r.firstElementChild);
|
|
2225
|
+
}, or = (e = {}) => (e, t) => {
|
|
2226
2226
|
if (!e.props.url) return { dom: document.createElement("img") };
|
|
2227
2227
|
let n;
|
|
2228
|
-
return e.props.showPreview ? (n = document.createElement("img"), n.src = e.props.url, n.alt = e.props.name || "", e.props.previewWidth && (n.width = e.props.previewWidth)) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
2229
|
-
},
|
|
2228
|
+
return e.props.showPreview ? (n = document.createElement("img"), n.src = e.props.url, n.alt = e.props.name || "", e.props.previewWidth && (n.width = e.props.previewWidth)) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Sn(n, e.props.caption) : Cn(n, e.props.caption) : { dom: n };
|
|
2229
|
+
}, sr = I(rr, (e) => ({
|
|
2230
2230
|
meta: { fileBlockAccept: ["image/*"] },
|
|
2231
|
-
parse:
|
|
2232
|
-
render:
|
|
2233
|
-
toExternalHTML:
|
|
2231
|
+
parse: ir(e),
|
|
2232
|
+
render: ar(e),
|
|
2233
|
+
toExternalHTML: or(e),
|
|
2234
2234
|
runsBefore: ["file"]
|
|
2235
|
-
})),
|
|
2235
|
+
})), cr = (e, t, n) => ({ state: r, dispatch: i }) => !i || lr(r.tr, e, t, n), lr = (e, t, n, r) => {
|
|
2236
2236
|
let i = b(Ae(e.doc, t));
|
|
2237
2237
|
if (!i.isBlockContainer) return !1;
|
|
2238
2238
|
let a = j(e), o = [{
|
|
@@ -2246,7 +2246,7 @@ var Gn = {
|
|
|
2246
2246
|
attrs: r ? { ...i.blockContent.node.attrs } : {}
|
|
2247
2247
|
}];
|
|
2248
2248
|
return e.split(t, 2, o), !0;
|
|
2249
|
-
},
|
|
2249
|
+
}, ur = (e, t) => {
|
|
2250
2250
|
let { blockInfo: n, selectionEmpty: r } = e.transact((e) => ({
|
|
2251
2251
|
blockInfo: x(e),
|
|
2252
2252
|
selectionEmpty: e.selection.anchor === e.selection.head
|
|
@@ -2254,15 +2254,15 @@ var Gn = {
|
|
|
2254
2254
|
if (!n.isBlockContainer) return !1;
|
|
2255
2255
|
let { bnBlock: i, blockContent: a } = n;
|
|
2256
2256
|
return a.node.type.name !== t || !r ? !1 : a.node.childCount === 0 ? (e.transact((e) => {
|
|
2257
|
-
|
|
2257
|
+
rn(e, i.beforePos, {
|
|
2258
2258
|
type: "paragraph",
|
|
2259
2259
|
props: {}
|
|
2260
2260
|
});
|
|
2261
|
-
}), !0) : a.node.childCount > 0 && e.transact((e) => (e.deleteSelection(), e.scrollIntoView(),
|
|
2261
|
+
}), !0) : a.node.childCount > 0 && e.transact((e) => (e.deleteSelection(), e.scrollIntoView(), lr(e, e.selection.from, !0)));
|
|
2262
2262
|
};
|
|
2263
2263
|
//#endregion
|
|
2264
2264
|
//#region src/blocks/ListItem/getListItemContent.ts
|
|
2265
|
-
function
|
|
2265
|
+
function dr(e, t, n) {
|
|
2266
2266
|
let a = r.fromSchema(t), o = e, s = document.createElement("div");
|
|
2267
2267
|
s.setAttribute("data-node-type", "blockGroup");
|
|
2268
2268
|
for (let e of Array.from(o.childNodes)) s.appendChild(e.cloneNode(!0));
|
|
@@ -2279,18 +2279,18 @@ function cr(e, t, n) {
|
|
|
2279
2279
|
}
|
|
2280
2280
|
//#endregion
|
|
2281
2281
|
//#region src/blocks/ListItem/BulletListItem/block.ts
|
|
2282
|
-
var
|
|
2282
|
+
var fr = F(() => ({
|
|
2283
2283
|
type: "bulletListItem",
|
|
2284
2284
|
propSchema: { ...G },
|
|
2285
2285
|
content: "inline"
|
|
2286
|
-
})),
|
|
2286
|
+
})), pr = I(fr, {
|
|
2287
2287
|
meta: { isolating: !1 },
|
|
2288
2288
|
parse(e) {
|
|
2289
2289
|
if (e.tagName !== "LI") return;
|
|
2290
2290
|
let t = e.parentElement;
|
|
2291
2291
|
if (t === null || t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL" || !e.closest("ul, ol")) return K(e);
|
|
2292
2292
|
},
|
|
2293
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
2293
|
+
parseContent: ({ el: e, schema: t }) => dr(e, t, "bulletListItem"),
|
|
2294
2294
|
render() {
|
|
2295
2295
|
let e = document.createElement("p");
|
|
2296
2296
|
return {
|
|
@@ -2308,7 +2308,7 @@ var lr = F(() => ({
|
|
|
2308
2308
|
}, [n({
|
|
2309
2309
|
key: "bullet-list-item-shortcuts",
|
|
2310
2310
|
keyboardShortcuts: {
|
|
2311
|
-
Enter: ({ editor: e }) =>
|
|
2311
|
+
Enter: ({ editor: e }) => ur(e, "bulletListItem"),
|
|
2312
2312
|
"Mod-Shift-8": ({ editor: e }) => {
|
|
2313
2313
|
let t = e.getTextCursorPosition();
|
|
2314
2314
|
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
@@ -2326,7 +2326,7 @@ var lr = F(() => ({
|
|
|
2326
2326
|
};
|
|
2327
2327
|
}
|
|
2328
2328
|
}]
|
|
2329
|
-
})]),
|
|
2329
|
+
})]), mr = F(() => ({
|
|
2330
2330
|
type: "checkListItem",
|
|
2331
2331
|
propSchema: {
|
|
2332
2332
|
...G,
|
|
@@ -2336,7 +2336,7 @@ var lr = F(() => ({
|
|
|
2336
2336
|
}
|
|
2337
2337
|
},
|
|
2338
2338
|
content: "inline"
|
|
2339
|
-
})),
|
|
2339
|
+
})), hr = I(mr, {
|
|
2340
2340
|
meta: { isolating: !1 },
|
|
2341
2341
|
parse(e) {
|
|
2342
2342
|
if (e.tagName === "input") return e.closest("[data-content-type]") || e.closest("li") ? void 0 : e.type === "checkbox" ? { checked: e.checked } : void 0;
|
|
@@ -2350,7 +2350,7 @@ var lr = F(() => ({
|
|
|
2350
2350
|
};
|
|
2351
2351
|
}
|
|
2352
2352
|
},
|
|
2353
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
2353
|
+
parseContent: ({ el: e, schema: t }) => dr(e, t, "checkListItem"),
|
|
2354
2354
|
render(e, t) {
|
|
2355
2355
|
let n = document.createDocumentFragment(), r = document.createElement("input");
|
|
2356
2356
|
r.type = "checkbox", r.checked = e.props.checked, e.props.checked && r.setAttribute("checked", ""), r.disabled = !t.isEditable, r.addEventListener("change", () => {
|
|
@@ -2375,7 +2375,7 @@ var lr = F(() => ({
|
|
|
2375
2375
|
}, [n({
|
|
2376
2376
|
key: "check-list-item-shortcuts",
|
|
2377
2377
|
keyboardShortcuts: {
|
|
2378
|
-
Enter: ({ editor: e }) =>
|
|
2378
|
+
Enter: ({ editor: e }) => ur(e, "checkListItem"),
|
|
2379
2379
|
"Mod-Shift-9": ({ editor: e }) => {
|
|
2380
2380
|
let t = e.getTextCursorPosition();
|
|
2381
2381
|
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
@@ -2404,7 +2404,7 @@ var lr = F(() => ({
|
|
|
2404
2404
|
})]);
|
|
2405
2405
|
//#endregion
|
|
2406
2406
|
//#region src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts
|
|
2407
|
-
function
|
|
2407
|
+
function gr(e, t, n, r) {
|
|
2408
2408
|
let i = !!e.firstChild.attrs.start, a = b({
|
|
2409
2409
|
posBeforeNode: t,
|
|
2410
2410
|
node: e
|
|
@@ -2453,7 +2453,7 @@ function pr(e, t, n, r) {
|
|
|
2453
2453
|
hasStart: i
|
|
2454
2454
|
};
|
|
2455
2455
|
}
|
|
2456
|
-
function
|
|
2456
|
+
function _r(e, t) {
|
|
2457
2457
|
let n = /* @__PURE__ */ new Map(), r = t.decorations.map(e.mapping, e.doc), i = e.changedRange() ?? {
|
|
2458
2458
|
from: 0,
|
|
2459
2459
|
to: e.doc.nodeSize - 2
|
|
@@ -2461,7 +2461,7 @@ function mr(e, t) {
|
|
|
2461
2461
|
e.doc.nodesBetween(i.from, e.doc.nodeSize - 2, (t, s, c) => {
|
|
2462
2462
|
if (c && o.has(c)) return !1;
|
|
2463
2463
|
if (t.type.name === "blockContainer" && t.firstChild.type.name === "numberedListItem") {
|
|
2464
|
-
let { index: l, isFirst: u, hasStart: d } =
|
|
2464
|
+
let { index: l, isFirst: u, hasStart: d } = gr(t, s, e, n), f = e.doc.nodeAt(s + 1);
|
|
2465
2465
|
if (r.find(s + 1, s + 1 + f.nodeSize, (e) => e.index === l && e.isFirst === u && e.hasStart === d).length === 0) a.push(ye.node(s + 1, s + 1 + f.nodeSize, { "data-index": l.toString() }, {
|
|
2466
2466
|
index: l,
|
|
2467
2467
|
isFirst: u,
|
|
@@ -2473,20 +2473,20 @@ function mr(e, t) {
|
|
|
2473
2473
|
let s = a.flatMap((e) => r.find(e.from, e.to));
|
|
2474
2474
|
return { decorations: r.remove(s).add(e.doc, a) };
|
|
2475
2475
|
}
|
|
2476
|
-
var
|
|
2476
|
+
var vr = () => new _e({
|
|
2477
2477
|
key: new ve("numbered-list-indexing-decorations"),
|
|
2478
2478
|
state: {
|
|
2479
2479
|
init(e, t) {
|
|
2480
|
-
return
|
|
2480
|
+
return _r(t.tr, { decorations: be.empty });
|
|
2481
2481
|
},
|
|
2482
2482
|
apply(e, t) {
|
|
2483
|
-
return !e.docChanged && t.decorations ? t :
|
|
2483
|
+
return !e.docChanged && t.decorations ? t : _r(e, t);
|
|
2484
2484
|
}
|
|
2485
2485
|
},
|
|
2486
2486
|
props: { decorations(e) {
|
|
2487
2487
|
return this.getState(e)?.decorations ?? be.empty;
|
|
2488
2488
|
} }
|
|
2489
|
-
}),
|
|
2489
|
+
}), yr = F(() => ({
|
|
2490
2490
|
type: "numberedListItem",
|
|
2491
2491
|
propSchema: {
|
|
2492
2492
|
...G,
|
|
@@ -2496,7 +2496,7 @@ var hr = () => new _e({
|
|
|
2496
2496
|
}
|
|
2497
2497
|
},
|
|
2498
2498
|
content: "inline"
|
|
2499
|
-
})),
|
|
2499
|
+
})), br = I(yr, {
|
|
2500
2500
|
meta: { isolating: !1 },
|
|
2501
2501
|
parse(e) {
|
|
2502
2502
|
if (e.tagName !== "LI") return;
|
|
@@ -2509,7 +2509,7 @@ var hr = () => new _e({
|
|
|
2509
2509
|
};
|
|
2510
2510
|
}
|
|
2511
2511
|
},
|
|
2512
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
2512
|
+
parseContent: ({ el: e, schema: t }) => dr(e, t, "numberedListItem"),
|
|
2513
2513
|
render() {
|
|
2514
2514
|
let e = document.createElement("p");
|
|
2515
2515
|
return {
|
|
@@ -2538,7 +2538,7 @@ var hr = () => new _e({
|
|
|
2538
2538
|
}
|
|
2539
2539
|
}],
|
|
2540
2540
|
keyboardShortcuts: {
|
|
2541
|
-
Enter: ({ editor: e }) =>
|
|
2541
|
+
Enter: ({ editor: e }) => ur(e, "numberedListItem"),
|
|
2542
2542
|
"Mod-Shift-7": ({ editor: e }) => {
|
|
2543
2543
|
let t = e.getTextCursorPosition();
|
|
2544
2544
|
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
@@ -2547,12 +2547,12 @@ var hr = () => new _e({
|
|
|
2547
2547
|
}), !0);
|
|
2548
2548
|
}
|
|
2549
2549
|
},
|
|
2550
|
-
prosemirrorPlugins: [
|
|
2551
|
-
})]),
|
|
2550
|
+
prosemirrorPlugins: [vr()]
|
|
2551
|
+
})]), xr = F(() => ({
|
|
2552
2552
|
type: "toggleListItem",
|
|
2553
2553
|
propSchema: { ...G },
|
|
2554
2554
|
content: "inline"
|
|
2555
|
-
})),
|
|
2555
|
+
})), Sr = I(xr, {
|
|
2556
2556
|
meta: { isolating: !1 },
|
|
2557
2557
|
parse(e) {
|
|
2558
2558
|
if (e.tagName === "DETAILS") return K(e);
|
|
@@ -2564,13 +2564,13 @@ var hr = () => new _e({
|
|
|
2564
2564
|
parseContent: ({ el: e, schema: t }) => {
|
|
2565
2565
|
let n = e.tagName === "DETAILS" ? e : e.querySelector(":scope > details");
|
|
2566
2566
|
if (!n) throw Error("No details found in toggleListItem parseContent");
|
|
2567
|
-
return
|
|
2567
|
+
return qn(n, t, "toggleListItem");
|
|
2568
2568
|
},
|
|
2569
2569
|
runsBefore: ["bulletListItem"],
|
|
2570
2570
|
render(e, t) {
|
|
2571
2571
|
let n = document.createElement("p");
|
|
2572
2572
|
return {
|
|
2573
|
-
...
|
|
2573
|
+
...Yn(e, t, n),
|
|
2574
2574
|
contentDOM: n
|
|
2575
2575
|
};
|
|
2576
2576
|
},
|
|
@@ -2587,7 +2587,7 @@ var hr = () => new _e({
|
|
|
2587
2587
|
}, [n({
|
|
2588
2588
|
key: "toggle-list-item-shortcuts",
|
|
2589
2589
|
keyboardShortcuts: {
|
|
2590
|
-
Enter: ({ editor: e }) =>
|
|
2590
|
+
Enter: ({ editor: e }) => ur(e, "toggleListItem"),
|
|
2591
2591
|
"Mod-Shift-6": ({ editor: e }) => {
|
|
2592
2592
|
let t = e.getTextCursorPosition();
|
|
2593
2593
|
return e.schema.blockSchema[t.block.type].content === "inline" && (e.updateBlock(t.block, {
|
|
@@ -2596,11 +2596,11 @@ var hr = () => new _e({
|
|
|
2596
2596
|
}), !0);
|
|
2597
2597
|
}
|
|
2598
2598
|
}
|
|
2599
|
-
})]),
|
|
2599
|
+
})]), Cr = F(() => ({
|
|
2600
2600
|
type: "pageBreak",
|
|
2601
2601
|
propSchema: {},
|
|
2602
2602
|
content: "none"
|
|
2603
|
-
})),
|
|
2603
|
+
})), wr = I(Cr, {
|
|
2604
2604
|
parse(e) {
|
|
2605
2605
|
if (e.tagName === "DIV" && e.hasAttribute("data-page-break")) return {};
|
|
2606
2606
|
},
|
|
@@ -2612,11 +2612,11 @@ var hr = () => new _e({
|
|
|
2612
2612
|
let e = document.createElement("div");
|
|
2613
2613
|
return e.setAttribute("data-page-break", ""), { dom: e };
|
|
2614
2614
|
}
|
|
2615
|
-
}),
|
|
2615
|
+
}), Tr = (e) => e.extend({ blockSpecs: { pageBreak: wr() } }), Er = F(() => ({
|
|
2616
2616
|
type: "paragraph",
|
|
2617
2617
|
propSchema: G,
|
|
2618
2618
|
content: "inline"
|
|
2619
|
-
})),
|
|
2619
|
+
})), Dr = I(Er, {
|
|
2620
2620
|
meta: { isolating: !1 },
|
|
2621
2621
|
parse: (e) => {
|
|
2622
2622
|
if (e.tagName === "P" && e.textContent?.trim()) return K(e);
|
|
@@ -2645,14 +2645,14 @@ var hr = () => new _e({
|
|
|
2645
2645
|
props: {}
|
|
2646
2646
|
}), !0);
|
|
2647
2647
|
} }
|
|
2648
|
-
})]),
|
|
2648
|
+
})]), Or = F(() => ({
|
|
2649
2649
|
type: "quote",
|
|
2650
2650
|
propSchema: {
|
|
2651
2651
|
backgroundColor: G.backgroundColor,
|
|
2652
2652
|
textColor: G.textColor
|
|
2653
2653
|
},
|
|
2654
2654
|
content: "inline"
|
|
2655
|
-
})),
|
|
2655
|
+
})), kr = I(Or, {
|
|
2656
2656
|
meta: { isolating: !1 },
|
|
2657
2657
|
parse(e) {
|
|
2658
2658
|
if (e.tagName === "BLOCKQUOTE") {
|
|
@@ -2703,15 +2703,15 @@ var hr = () => new _e({
|
|
|
2703
2703
|
};
|
|
2704
2704
|
}
|
|
2705
2705
|
}]
|
|
2706
|
-
})]),
|
|
2706
|
+
})]), Ar = "blockLevelSuggestion";
|
|
2707
2707
|
function Y(e) {
|
|
2708
2708
|
return e && e.options.extensions.some((e) => {
|
|
2709
2709
|
if (e.type !== "mark") return !1;
|
|
2710
2710
|
let t = g(e, "group");
|
|
2711
2711
|
return typeof t == "string" && t.split(" ").includes("blockLevelSuggestion");
|
|
2712
|
-
}) ?
|
|
2712
|
+
}) ? Ar : "";
|
|
2713
2713
|
}
|
|
2714
|
-
var
|
|
2714
|
+
var jr = 120, Mr = 31, Nr = s.create({
|
|
2715
2715
|
name: "BlockNoteTableExtension",
|
|
2716
2716
|
addProseMirrorPlugins: () => [ue({
|
|
2717
2717
|
cellMinWidth: 35,
|
|
@@ -2740,7 +2740,7 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2740
2740
|
};
|
|
2741
2741
|
return { tableRole: d(g(e, "tableRole", t)) };
|
|
2742
2742
|
}
|
|
2743
|
-
}),
|
|
2743
|
+
}), Pr = { textColor: G.textColor }, Fr = u.create({
|
|
2744
2744
|
name: "tableHeader",
|
|
2745
2745
|
addOptions() {
|
|
2746
2746
|
return { HTMLAttributes: {} };
|
|
@@ -2767,7 +2767,7 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2767
2767
|
parseHTML() {
|
|
2768
2768
|
return [{
|
|
2769
2769
|
tag: "th",
|
|
2770
|
-
getContent: (e, t) =>
|
|
2770
|
+
getContent: (e, t) => Br(e, t)
|
|
2771
2771
|
}];
|
|
2772
2772
|
},
|
|
2773
2773
|
renderHTML({ HTMLAttributes: e }) {
|
|
@@ -2777,7 +2777,7 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2777
2777
|
0
|
|
2778
2778
|
];
|
|
2779
2779
|
}
|
|
2780
|
-
}),
|
|
2780
|
+
}), Ir = u.create({
|
|
2781
2781
|
name: "tableCell",
|
|
2782
2782
|
addOptions() {
|
|
2783
2783
|
return { HTMLAttributes: {} };
|
|
@@ -2804,7 +2804,7 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2804
2804
|
parseHTML() {
|
|
2805
2805
|
return [{
|
|
2806
2806
|
tag: "td",
|
|
2807
|
-
getContent: (e, t) =>
|
|
2807
|
+
getContent: (e, t) => Br(e, t)
|
|
2808
2808
|
}];
|
|
2809
2809
|
},
|
|
2810
2810
|
renderHTML({ HTMLAttributes: e }) {
|
|
@@ -2814,7 +2814,7 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2814
2814
|
0
|
|
2815
2815
|
];
|
|
2816
2816
|
}
|
|
2817
|
-
}),
|
|
2817
|
+
}), Lr = u.create({
|
|
2818
2818
|
name: "table",
|
|
2819
2819
|
content: "tableRow+",
|
|
2820
2820
|
group: "blockContent",
|
|
@@ -2827,7 +2827,7 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2827
2827
|
return [{ tag: "table" }];
|
|
2828
2828
|
},
|
|
2829
2829
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
2830
|
-
let n =
|
|
2830
|
+
let n = Ge(this.name, "table", {
|
|
2831
2831
|
...this.options.domAttributes?.blockContent || {},
|
|
2832
2832
|
...t
|
|
2833
2833
|
}, this.options.domAttributes?.inlineContent || {}), r = document.createElement("colgroup");
|
|
@@ -2859,7 +2859,7 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2859
2859
|
}
|
|
2860
2860
|
update(e) {
|
|
2861
2861
|
if (!super.update(e)) return !1;
|
|
2862
|
-
for (let [t, n] of Object.entries(
|
|
2862
|
+
for (let [t, n] of Object.entries(Pr)) {
|
|
2863
2863
|
let r = P(t), i = e.attrs[t];
|
|
2864
2864
|
i === n.default ? this.dom.removeAttribute(r) : this.dom.setAttribute(r, String(i));
|
|
2865
2865
|
}
|
|
@@ -2872,7 +2872,7 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2872
2872
|
});
|
|
2873
2873
|
};
|
|
2874
2874
|
}
|
|
2875
|
-
}),
|
|
2875
|
+
}), Rr = u.create({
|
|
2876
2876
|
name: "tableParagraph",
|
|
2877
2877
|
group: "tableContent",
|
|
2878
2878
|
content: "inline*",
|
|
@@ -2894,7 +2894,7 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2894
2894
|
0
|
|
2895
2895
|
];
|
|
2896
2896
|
}
|
|
2897
|
-
}),
|
|
2897
|
+
}), zr = u.create({
|
|
2898
2898
|
name: "tableRow",
|
|
2899
2899
|
addOptions() {
|
|
2900
2900
|
return { HTMLAttributes: {} };
|
|
@@ -2915,24 +2915,24 @@ var Or = 120, kr = 31, Ar = s.create({
|
|
|
2915
2915
|
];
|
|
2916
2916
|
}
|
|
2917
2917
|
});
|
|
2918
|
-
function
|
|
2918
|
+
function Br(e, t) {
|
|
2919
2919
|
let n = r.fromSchema(t).parse(e, { topNode: t.nodes.blockGroup.create() }), a = [];
|
|
2920
2920
|
return n.content.descendants((e) => {
|
|
2921
2921
|
if (e.isInline) return a.push(e), !1;
|
|
2922
2922
|
}), i.fromArray(a);
|
|
2923
2923
|
}
|
|
2924
|
-
var
|
|
2925
|
-
node:
|
|
2924
|
+
var Vr = () => pt({
|
|
2925
|
+
node: Lr,
|
|
2926
2926
|
type: "table",
|
|
2927
2927
|
content: "table"
|
|
2928
|
-
},
|
|
2928
|
+
}, Pr, [n({
|
|
2929
2929
|
key: "table-extensions",
|
|
2930
2930
|
tiptapExtensions: [
|
|
2931
|
-
Ar,
|
|
2932
|
-
Fr,
|
|
2933
|
-
Mr,
|
|
2934
2931
|
Nr,
|
|
2935
|
-
|
|
2932
|
+
Rr,
|
|
2933
|
+
Fr,
|
|
2934
|
+
Ir,
|
|
2935
|
+
zr
|
|
2936
2936
|
]
|
|
2937
2937
|
}), n({
|
|
2938
2938
|
key: "table-keyboard-delete",
|
|
@@ -2950,11 +2950,11 @@ var Rr = () => ut({
|
|
|
2950
2950
|
(e.getPrevBlock(t) || e.getNextBlock(t)) && e.setTextCursorPosition(t), e.removeBlocks([t]);
|
|
2951
2951
|
}), !0);
|
|
2952
2952
|
} }
|
|
2953
|
-
})]),
|
|
2953
|
+
})]), Hr = (e) => ({
|
|
2954
2954
|
url: e.src || void 0,
|
|
2955
2955
|
previewWidth: e.width || void 0,
|
|
2956
2956
|
name: e.getAttribute("data-name") || void 0
|
|
2957
|
-
}),
|
|
2957
|
+
}), Ur = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z\"></path></svg>", Wr = F((e) => ({
|
|
2958
2958
|
type: "video",
|
|
2959
2959
|
propSchema: {
|
|
2960
2960
|
textAlignment: G.textAlignment,
|
|
@@ -2969,28 +2969,28 @@ var Rr = () => ut({
|
|
|
2969
2969
|
}
|
|
2970
2970
|
},
|
|
2971
2971
|
content: "none"
|
|
2972
|
-
})),
|
|
2972
|
+
})), Gr = (e) => (e) => {
|
|
2973
2973
|
if (e.tagName === "VIDEO") {
|
|
2974
2974
|
if (e.closest("figure")) return;
|
|
2975
2975
|
let { backgroundColor: t } = K(e);
|
|
2976
2976
|
return {
|
|
2977
|
-
...
|
|
2977
|
+
...Hr(e),
|
|
2978
2978
|
backgroundColor: t
|
|
2979
2979
|
};
|
|
2980
2980
|
}
|
|
2981
2981
|
if (e.tagName === "FIGURE") {
|
|
2982
|
-
let t =
|
|
2982
|
+
let t = _n(e, "video");
|
|
2983
2983
|
if (!t) return;
|
|
2984
2984
|
let { targetElement: n, caption: r } = t, { backgroundColor: i } = K(e);
|
|
2985
2985
|
return {
|
|
2986
|
-
...
|
|
2986
|
+
...Hr(n),
|
|
2987
2987
|
backgroundColor: i,
|
|
2988
2988
|
caption: r
|
|
2989
2989
|
};
|
|
2990
2990
|
}
|
|
2991
|
-
},
|
|
2991
|
+
}, Kr = I(Wr, (e) => ({
|
|
2992
2992
|
meta: { fileBlockAccept: ["video/*"] },
|
|
2993
|
-
parse:
|
|
2993
|
+
parse: Gr(e),
|
|
2994
2994
|
render(t, n) {
|
|
2995
2995
|
let r = document.createElement("div");
|
|
2996
2996
|
r.innerHTML = e.icon ?? "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z\"></path></svg>";
|
|
@@ -2999,12 +2999,12 @@ var Rr = () => ut({
|
|
|
2999
2999
|
let a = document.createElement("video");
|
|
3000
3000
|
return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
|
|
3001
3001
|
a.src = e;
|
|
3002
|
-
}) : a.src = t.props.url, a.controls = !0, a.contentEditable = "false", a.draggable = !1, t.props.previewWidth && (a.width = t.props.previewWidth), i.appendChild(a),
|
|
3002
|
+
}) : a.src = t.props.url, a.controls = !0, a.contentEditable = "false", a.draggable = !1, t.props.previewWidth && (a.width = t.props.previewWidth), i.appendChild(a), er(t, n, { dom: i }, i, r.firstElementChild);
|
|
3003
3003
|
},
|
|
3004
3004
|
toExternalHTML(e) {
|
|
3005
3005
|
if (!e.props.url) return { dom: document.createElement("video") };
|
|
3006
3006
|
let t;
|
|
3007
|
-
return e.props.showPreview ? (t = document.createElement("video"), t.src = e.props.url, e.props.previewWidth && (t.width = e.props.previewWidth)) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
3007
|
+
return e.props.showPreview ? (t = document.createElement("video"), t.src = e.props.url, e.props.previewWidth && (t.width = e.props.previewWidth)) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Sn(t, e.props.caption) : Cn(t, e.props.caption) : { dom: t };
|
|
3008
3008
|
},
|
|
3009
3009
|
runsBefore: ["file"]
|
|
3010
3010
|
}));
|
|
@@ -3026,13 +3026,13 @@ function X(e, t, n) {
|
|
|
3026
3026
|
}
|
|
3027
3027
|
return !0;
|
|
3028
3028
|
}
|
|
3029
|
-
function
|
|
3029
|
+
function qr(e, t, n, r) {
|
|
3030
3030
|
return X(t, n, r) && e.type === n;
|
|
3031
3031
|
}
|
|
3032
|
-
function
|
|
3032
|
+
function Jr(e) {
|
|
3033
3033
|
return e instanceof se;
|
|
3034
3034
|
}
|
|
3035
|
-
function
|
|
3035
|
+
function Yr(e) {
|
|
3036
3036
|
let t = e.type.spec.tableRole;
|
|
3037
3037
|
return t === "cell" || t === "header_cell";
|
|
3038
3038
|
}
|
|
@@ -3052,7 +3052,13 @@ var Z = n(({ editor: t }) => {
|
|
|
3052
3052
|
a || o || n.setState(r());
|
|
3053
3053
|
}), c = t.onSelectionChange(() => {
|
|
3054
3054
|
a || o || n.setState(r());
|
|
3055
|
-
})
|
|
3055
|
+
}), l = t.onFocusChange((e, { focused: t }) => {
|
|
3056
|
+
if (!t) {
|
|
3057
|
+
n.setState(!1);
|
|
3058
|
+
return;
|
|
3059
|
+
}
|
|
3060
|
+
a || o || n.setState(r());
|
|
3061
|
+
}, { includeEditorUI: !0 });
|
|
3056
3062
|
e.addEventListener("pointerdown", () => {
|
|
3057
3063
|
a = !0, n.setState(!1);
|
|
3058
3064
|
}, { signal: i }), t.prosemirrorView.root.addEventListener("pointerup", () => {
|
|
@@ -3070,14 +3076,14 @@ var Z = n(({ editor: t }) => {
|
|
|
3070
3076
|
}, { signal: i }), t.prosemirrorView.root.addEventListener("dragend", () => {
|
|
3071
3077
|
o = !1;
|
|
3072
3078
|
}, { signal: i }), i.addEventListener("abort", () => {
|
|
3073
|
-
s(), c();
|
|
3079
|
+
s(), c(), l();
|
|
3074
3080
|
});
|
|
3075
3081
|
}
|
|
3076
3082
|
};
|
|
3077
3083
|
});
|
|
3078
3084
|
//#endregion
|
|
3079
3085
|
//#region src/api/positionMapping.ts
|
|
3080
|
-
function
|
|
3086
|
+
function Xr(e, t, n = "left") {
|
|
3081
3087
|
let r = e.getExtension("yPositionMapping");
|
|
3082
3088
|
if (r) return r.mapPosition(t, n);
|
|
3083
3089
|
let i = e.getExtension("positionMapping");
|
|
@@ -3086,7 +3092,7 @@ function qr(e, t, n = "left") {
|
|
|
3086
3092
|
}
|
|
3087
3093
|
//#endregion
|
|
3088
3094
|
//#region src/extensions/SuggestionMenu/SuggestionMenu.ts
|
|
3089
|
-
var
|
|
3095
|
+
var Zr = m((e) => e.type.name === "blockContainer"), Qr = class {
|
|
3090
3096
|
editor;
|
|
3091
3097
|
state;
|
|
3092
3098
|
emitUpdate;
|
|
@@ -3134,7 +3140,7 @@ var Jr = m((e) => e.type.name === "blockContainer"), Yr = class {
|
|
|
3134
3140
|
to: this.editor.transact((e) => e.selection.from)
|
|
3135
3141
|
}).run();
|
|
3136
3142
|
};
|
|
3137
|
-
}, Q = new ne("SuggestionMenuPlugin"),
|
|
3143
|
+
}, Q = new ne("SuggestionMenuPlugin"), $r = n(({ editor: t }) => {
|
|
3138
3144
|
let n = /* @__PURE__ */ new Map(), r, i = e(void 0);
|
|
3139
3145
|
return {
|
|
3140
3146
|
key: "suggestionMenu",
|
|
@@ -3163,7 +3169,7 @@ var Jr = m((e) => e.type.name === "blockContainer"), Yr = class {
|
|
|
3163
3169
|
},
|
|
3164
3170
|
prosemirrorPlugins: [new te({
|
|
3165
3171
|
key: Q,
|
|
3166
|
-
view: (e) => (r = new
|
|
3172
|
+
view: (e) => (r = new Qr(t, (e, t) => {
|
|
3167
3173
|
i.setState({
|
|
3168
3174
|
...t,
|
|
3169
3175
|
triggerCharacter: e
|
|
@@ -3176,7 +3182,7 @@ var Jr = m((e) => e.type.name === "blockContainer"), Yr = class {
|
|
|
3176
3182
|
let o = e.getMeta(Q);
|
|
3177
3183
|
if (typeof o == "object" && o) {
|
|
3178
3184
|
n && r?.closeMenu();
|
|
3179
|
-
let e =
|
|
3185
|
+
let e = Xr(t, a.selection.from - o.triggerCharacter.length);
|
|
3180
3186
|
return {
|
|
3181
3187
|
triggerCharacter: o.triggerCharacter,
|
|
3182
3188
|
deleteTriggerCharacter: o.deleteTriggerCharacter !== !1,
|
|
@@ -3208,7 +3214,7 @@ var Jr = m((e) => e.type.name === "blockContainer"), Yr = class {
|
|
|
3208
3214
|
let t = this.getState(e);
|
|
3209
3215
|
if (t === void 0) return null;
|
|
3210
3216
|
if (!t.deleteTriggerCharacter) {
|
|
3211
|
-
let n =
|
|
3217
|
+
let n = Zr(e.selection);
|
|
3212
3218
|
if (n) return Se.create(e.doc, [xe.node(n.pos, n.pos + n.node.nodeSize, {
|
|
3213
3219
|
nodeName: "span",
|
|
3214
3220
|
class: "bn-suggestion-decorator",
|
|
@@ -3227,7 +3233,7 @@ var Jr = m((e) => e.type.name === "blockContainer"), Yr = class {
|
|
|
3227
3233
|
});
|
|
3228
3234
|
//#endregion
|
|
3229
3235
|
//#region src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts
|
|
3230
|
-
function
|
|
3236
|
+
function ei(e) {
|
|
3231
3237
|
let t = e.getTextCursorPosition().block, n = e.schema.blockSchema[t.type].content;
|
|
3232
3238
|
for (; n === "none";) {
|
|
3233
3239
|
if (t = e.getTextCursorPosition().nextBlock, t === void 0) {
|
|
@@ -3242,9 +3248,9 @@ function $(e, t) {
|
|
|
3242
3248
|
let n = e.getTextCursorPosition().block;
|
|
3243
3249
|
if (n.content === void 0) throw Error("Slash Menu open in a block that doesn't contain content.");
|
|
3244
3250
|
let r;
|
|
3245
|
-
return Array.isArray(n.content) && (n.content.length === 1 && S(n.content[0]) && n.content[0].type === "text" && n.content[0].text === "/" || n.content.length === 0) ? (r = e.updateBlock(n, t), e.setTextCursorPosition(r)) : (r = e.insertBlocks([t], n, "after")[0], e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)),
|
|
3251
|
+
return Array.isArray(n.content) && (n.content.length === 1 && S(n.content[0]) && n.content[0].type === "text" && n.content[0].text === "/" || n.content.length === 0) ? (r = e.updateBlock(n, t), e.setTextCursorPosition(r)) : (r = e.insertBlocks([t], n, "after")[0], e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)), ei(e), r;
|
|
3246
3252
|
}
|
|
3247
|
-
function
|
|
3253
|
+
function ti(e) {
|
|
3248
3254
|
let t = [];
|
|
3249
3255
|
return X(e, "heading", { level: "number" }) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((e) => e <= 3).forEach((n) => {
|
|
3250
3256
|
t.push({
|
|
@@ -3392,7 +3398,7 @@ function Qr(e) {
|
|
|
3392
3398
|
});
|
|
3393
3399
|
}), t.push({
|
|
3394
3400
|
onItemClick: () => {
|
|
3395
|
-
e.getExtension(
|
|
3401
|
+
e.getExtension($r)?.openSuggestionMenu(":", {
|
|
3396
3402
|
deleteTriggerCharacter: !0,
|
|
3397
3403
|
ignoreQueryLength: !0
|
|
3398
3404
|
});
|
|
@@ -3401,17 +3407,17 @@ function Qr(e) {
|
|
|
3401
3407
|
...e.dictionary.slash_menu.emoji
|
|
3402
3408
|
}), t;
|
|
3403
3409
|
}
|
|
3404
|
-
function
|
|
3410
|
+
function ni(e, t) {
|
|
3405
3411
|
return e.filter(({ title: e, aliases: n }) => e.toLowerCase().includes(t.toLowerCase()) || n && n.filter((e) => e.toLowerCase().includes(t.toLowerCase())).length !== 0);
|
|
3406
3412
|
}
|
|
3407
3413
|
//#endregion
|
|
3408
3414
|
//#region src/blocks/PageBreak/getPageBreakSlashMenuItems.ts
|
|
3409
|
-
function
|
|
3415
|
+
function ri(e) {
|
|
3410
3416
|
return "pageBreak" in e.schema.blockSchema;
|
|
3411
3417
|
}
|
|
3412
|
-
function
|
|
3418
|
+
function ii(e) {
|
|
3413
3419
|
let t = [];
|
|
3414
|
-
return
|
|
3420
|
+
return ri(e) && t.push({
|
|
3415
3421
|
...e.dictionary.slash_menu.page_break,
|
|
3416
3422
|
onItemClick: () => {
|
|
3417
3423
|
$(e, { type: "pageBreak" });
|
|
@@ -3421,22 +3427,22 @@ function ti(e) {
|
|
|
3421
3427
|
}
|
|
3422
3428
|
//#endregion
|
|
3423
3429
|
//#region src/blocks/defaultBlocks.ts
|
|
3424
|
-
var
|
|
3425
|
-
audio:
|
|
3426
|
-
bulletListItem:
|
|
3427
|
-
checkListItem:
|
|
3428
|
-
codeBlock:
|
|
3429
|
-
divider:
|
|
3430
|
-
file:
|
|
3431
|
-
heading:
|
|
3432
|
-
image:
|
|
3433
|
-
numberedListItem:
|
|
3434
|
-
paragraph:
|
|
3435
|
-
quote:
|
|
3436
|
-
table:
|
|
3437
|
-
toggleListItem:
|
|
3438
|
-
video:
|
|
3439
|
-
},
|
|
3430
|
+
var ai = {
|
|
3431
|
+
audio: An(),
|
|
3432
|
+
bulletListItem: pr(),
|
|
3433
|
+
checkListItem: hr(),
|
|
3434
|
+
codeBlock: Bn(),
|
|
3435
|
+
divider: Hn(),
|
|
3436
|
+
file: Kn(),
|
|
3437
|
+
heading: $n(),
|
|
3438
|
+
image: sr(),
|
|
3439
|
+
numberedListItem: br(),
|
|
3440
|
+
paragraph: Dr(),
|
|
3441
|
+
quote: kr(),
|
|
3442
|
+
table: Vr(),
|
|
3443
|
+
toggleListItem: Sr(),
|
|
3444
|
+
video: Kr()
|
|
3445
|
+
}, oi = Et({
|
|
3440
3446
|
type: "textColor",
|
|
3441
3447
|
propSchema: "string"
|
|
3442
3448
|
}, {
|
|
@@ -3457,7 +3463,7 @@ var ni = {
|
|
|
3457
3463
|
parse: (e) => {
|
|
3458
3464
|
if (e.tagName === "SPAN" && e.style.color) return e.style.color;
|
|
3459
3465
|
}
|
|
3460
|
-
}),
|
|
3466
|
+
}), si = Et({
|
|
3461
3467
|
type: "backgroundColor",
|
|
3462
3468
|
propSchema: "string"
|
|
3463
3469
|
}, {
|
|
@@ -3478,7 +3484,7 @@ var ni = {
|
|
|
3478
3484
|
parse: (e) => {
|
|
3479
3485
|
if (e.tagName === "SPAN" && e.style.backgroundColor) return e.style.backgroundColor;
|
|
3480
3486
|
}
|
|
3481
|
-
}),
|
|
3487
|
+
}), ci = {
|
|
3482
3488
|
bold: R(Ce, "boolean"),
|
|
3483
3489
|
italic: R(Te, "boolean"),
|
|
3484
3490
|
underline: R(De, "boolean"),
|
|
@@ -3495,9 +3501,9 @@ var ni = {
|
|
|
3495
3501
|
}
|
|
3496
3502
|
})];
|
|
3497
3503
|
} }), "boolean"),
|
|
3498
|
-
textColor:
|
|
3499
|
-
backgroundColor:
|
|
3500
|
-
},
|
|
3504
|
+
textColor: oi,
|
|
3505
|
+
backgroundColor: si
|
|
3506
|
+
}, li = wt(ci), ui = {
|
|
3501
3507
|
text: {
|
|
3502
3508
|
config: "text",
|
|
3503
3509
|
implementation: {}
|
|
@@ -3506,16 +3512,16 @@ var ni = {
|
|
|
3506
3512
|
config: "link",
|
|
3507
3513
|
implementation: {}
|
|
3508
3514
|
}
|
|
3509
|
-
},
|
|
3515
|
+
}, di = xt(ui), fi = class e extends It {
|
|
3510
3516
|
static create(t) {
|
|
3511
3517
|
return new e({
|
|
3512
|
-
blockSpecs: t?.blockSpecs ??
|
|
3513
|
-
inlineContentSpecs: t?.inlineContentSpecs ??
|
|
3514
|
-
styleSpecs: t?.styleSpecs ??
|
|
3518
|
+
blockSpecs: t?.blockSpecs ?? ai,
|
|
3519
|
+
inlineContentSpecs: t?.inlineContentSpecs ?? ui,
|
|
3520
|
+
styleSpecs: t?.styleSpecs ?? ci
|
|
3515
3521
|
});
|
|
3516
3522
|
}
|
|
3517
3523
|
};
|
|
3518
3524
|
//#endregion
|
|
3519
|
-
export {
|
|
3525
|
+
export { Yn as $, S as $n, Ct as $t, kr as A, $e as An, un as At, hr as B, Be as Bn, qt as Bt, Vr as C, at as Cn, mn as Ct, Ar as D, et as Dn, pn as Dt, jr as E, ot as En, K as Et, Tr as F, Ge as Fn, U as Ft, nr as G, ze as Gn, Lt as Gt, fr as H, We as Hn, Wt as Ht, xr as I, Ke as In, H as It, ir as J, w as Jn, It as Jt, rr as K, E as Kn, Vt as Kt, Sr as L, qe as Ln, Qt as Lt, Dr as M, M as Mn, rn as Mt, Cr as N, tt as Nn, en as Nt, Y as O, Ze as On, W as Ot, wr as P, Ye as Pn, tn as Pt, $n as Q, Re as Qn, L as Qt, yr as R, k as Rn, Gt as Rt, Gr as S, nt as Sn, G as St, Mr as T, it as Tn, hn as Tt, pr as U, A as Un, Bt as Ut, mr as V, Ve as Vn, Kt as Vt, cr as W, O as Wn, zt as Wt, or as X, C as Xn, Et as Xt, ar as Y, T as Yn, Pt as Yt, Qn as Z, Le as Zn, Tt as Zt, Yr as _, ft as _n, En as _t, li as a, bt as an, y as ar, Hn as at, Wr as b, ct as bn, J as bt, ii as c, gt as cn, Oe as cr, Ln as ct, $ as d, I as dn, jn as dt, R as en, Ie as er, Jn as et, $r as f, ht as fn, Mn as ft, X as g, lt as gn, kn as gt, qr as h, ut as hn, On as ht, ui as i, vt as in, x as ir, Vn as it, Er as j, j as jn, nn as jt, Or as k, Qe as kn, dn as kt, ni as l, mt as ln, In as lt, Z as m, dt as mn, Dn as mt, ai as n, St as nn, Me as nr, Kn as nt, ci as o, yt as on, Ae as or, zn as ot, Xr as p, pt as pn, Tn as pt, sr as q, D as qn, Ht as qt, di as r, _t as rn, je as rr, Gn as rt, ri as s, xt as sn, ke as sr, Bn as st, fi as t, wt as tn, b as tr, Wn as tt, ti as u, F as un, Nn as ut, Jr as v, P as vn, An as vt, Pr as w, N as wn, gn as wt, Kr as x, rt as xn, q as xt, Ur as y, st as yn, wn as yt, br as z, He as zn, Jt as zt };
|
|
3520
3526
|
|
|
3521
|
-
//# sourceMappingURL=blocks-
|
|
3527
|
+
//# sourceMappingURL=blocks-DaEUT0O1.js.map
|