@blocknote/core 0.23.5 → 0.24.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/blocknote.js +750 -610
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +6 -6
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +3 -3
- package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +492 -0
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts +6 -0
- package/src/api/clipboard/toClipboard/copyExtension.ts +37 -2
- package/src/api/nodeConversions/blockToNode.ts +5 -3
- package/src/api/nodeConversions/nodeToBlock.ts +11 -5
- package/src/blocks/TableBlockContent/TableBlockContent.ts +2 -1
- package/src/editor/BlockNoteEditor.ts +21 -6
- package/src/editor/BlockNoteExtensions.ts +9 -4
- package/src/editor/BlockNoteTipTapEditor.ts +37 -36
- package/src/extensions/Placeholder/PlaceholderPlugin.ts +69 -54
- package/src/extensions/SideMenu/dragging.ts +2 -5
- package/src/i18n/locales/ar.ts +3 -0
- package/src/i18n/locales/de.ts +3 -0
- package/src/i18n/locales/en.ts +4 -1
- package/src/i18n/locales/es.ts +3 -0
- package/src/i18n/locales/fr.ts +3 -0
- package/src/i18n/locales/hr.ts +3 -0
- package/src/i18n/locales/is.ts +3 -0
- package/src/i18n/locales/it.ts +316 -314
- package/src/i18n/locales/ja.ts +3 -0
- package/src/i18n/locales/ko.ts +3 -0
- package/src/i18n/locales/nl.ts +3 -0
- package/src/i18n/locales/pl.ts +3 -0
- package/src/i18n/locales/pt.ts +3 -0
- package/src/i18n/locales/ru.ts +3 -0
- package/src/i18n/locales/uk.ts +337 -278
- package/src/i18n/locales/vi.ts +3 -0
- package/src/i18n/locales/zh.ts +3 -0
- package/types/src/editor/BlockNoteEditor.d.ts +2 -2
- package/types/src/editor/BlockNoteExtensions.d.ts +2 -2
- package/types/src/editor/BlockNoteTipTapEditor.d.ts +1 -2
- package/types/src/extensions/Placeholder/PlaceholderPlugin.d.ts +1 -1
- package/types/src/i18n/locales/de.d.ts +3 -0
- package/types/src/i18n/locales/en.d.ts +4 -7
- package/types/src/i18n/locales/es.d.ts +3 -0
- package/types/src/i18n/locales/hr.d.ts +3 -0
- package/types/src/i18n/locales/it.d.ts +3 -0
package/dist/blocknote.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var p = (e, t, o) =>
|
|
4
|
-
import { Slice as q, Fragment as j, DOMSerializer as
|
|
5
|
-
import { Extension as L, combineTransactionSteps as
|
|
6
|
-
import { Plugin as B, PluginKey as N, TextSelection as
|
|
7
|
-
import { v4 as
|
|
1
|
+
var bo = Object.defineProperty;
|
|
2
|
+
var ko = (e, t, o) => t in e ? bo(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
|
+
var p = (e, t, o) => ko(e, typeof t != "symbol" ? t + "" : t, o);
|
|
4
|
+
import { Slice as q, Fragment as j, DOMSerializer as vt, DOMParser as wt, Node as _o } from "prosemirror-model";
|
|
5
|
+
import { Extension as L, combineTransactionSteps as yo, getChangedRanges as vo, findChildrenInRange as wo, Node as Z, Mark as xe, InputRule as oe, isTextSelection as xt, callOrReturn as xo, getExtensionField as Co, selectionToInsertionEnd as Eo, isNodeSelection as Ye, posToDOMRect as je, getMarkRange as Qe, findChildren as et, findParentNode as So, extensions as re, Editor as Bo, createDocument as To, getSchema as Mo } from "@tiptap/core";
|
|
6
|
+
import { Plugin as B, PluginKey as N, TextSelection as U, NodeSelection as ce, Selection as Me, EditorState as Io } from "prosemirror-state";
|
|
7
|
+
import { v4 as Ct } from "uuid";
|
|
8
8
|
import { createHighlightPlugin as Lo } from "prosemirror-highlight";
|
|
9
9
|
import { createParser as Ao } from "prosemirror-highlight/shiki";
|
|
10
|
-
import { bundledLanguagesInfo as
|
|
10
|
+
import { bundledLanguagesInfo as Et, createHighlighter as Po } from "shiki";
|
|
11
11
|
import No from "@tiptap/extension-bold";
|
|
12
12
|
import jo from "@tiptap/extension-code";
|
|
13
13
|
import Do from "@tiptap/extension-italic";
|
|
14
|
-
import
|
|
15
|
-
import
|
|
14
|
+
import Ho from "@tiptap/extension-strike";
|
|
15
|
+
import Uo from "@tiptap/extension-underline";
|
|
16
16
|
import { ReplaceStep as Oo, ReplaceAroundStep as De } from "prosemirror-transform";
|
|
17
17
|
import { TableCell as Ro } from "@tiptap/extension-table-cell";
|
|
18
18
|
import { TableHeader as Vo } from "@tiptap/extension-table-header";
|
|
@@ -23,10 +23,9 @@ import { HardBreak as Ko } from "@tiptap/extension-hard-break";
|
|
|
23
23
|
import { History as qo } from "@tiptap/extension-history";
|
|
24
24
|
import { Link as Xo } from "@tiptap/extension-link";
|
|
25
25
|
import { Text as Zo } from "@tiptap/extension-text";
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import Qo from "@tiptap/extension-collaboration-cursor";
|
|
26
|
+
import Jo from "@tiptap/extension-collaboration";
|
|
27
|
+
import Yo from "@tiptap/extension-collaboration-cursor";
|
|
28
|
+
import { Decoration as X, DecorationSet as ie, EditorView as Qo } from "prosemirror-view";
|
|
30
29
|
import { dropCursor as ei } from "prosemirror-dropcursor";
|
|
31
30
|
const ti = {
|
|
32
31
|
slash_menu: {
|
|
@@ -287,6 +286,9 @@ const ti = {
|
|
|
287
286
|
},
|
|
288
287
|
align_justify: {
|
|
289
288
|
tooltip: "ضبط النص"
|
|
289
|
+
},
|
|
290
|
+
comment: {
|
|
291
|
+
tooltip: "إضافة ملاحظة"
|
|
290
292
|
}
|
|
291
293
|
},
|
|
292
294
|
file_panel: {
|
|
@@ -604,6 +606,9 @@ const ti = {
|
|
|
604
606
|
},
|
|
605
607
|
align_justify: {
|
|
606
608
|
tooltip: "Text Blocksatz"
|
|
609
|
+
},
|
|
610
|
+
comment: {
|
|
611
|
+
tooltip: "Kommentar hinzufügen"
|
|
607
612
|
}
|
|
608
613
|
},
|
|
609
614
|
file_panel: {
|
|
@@ -647,7 +652,7 @@ const ti = {
|
|
|
647
652
|
generic: {
|
|
648
653
|
ctrl_shortcut: "Strg"
|
|
649
654
|
}
|
|
650
|
-
},
|
|
655
|
+
}, St = {
|
|
651
656
|
slash_menu: {
|
|
652
657
|
heading: {
|
|
653
658
|
title: "Heading 1",
|
|
@@ -922,6 +927,9 @@ const ti = {
|
|
|
922
927
|
},
|
|
923
928
|
align_justify: {
|
|
924
929
|
tooltip: "Justify text"
|
|
930
|
+
},
|
|
931
|
+
comment: {
|
|
932
|
+
tooltip: "Add comment"
|
|
925
933
|
}
|
|
926
934
|
},
|
|
927
935
|
file_panel: {
|
|
@@ -1238,6 +1246,9 @@ const ti = {
|
|
|
1238
1246
|
},
|
|
1239
1247
|
align_justify: {
|
|
1240
1248
|
tooltip: "Justificar texto"
|
|
1249
|
+
},
|
|
1250
|
+
comment: {
|
|
1251
|
+
tooltip: "Agregar comentario"
|
|
1241
1252
|
}
|
|
1242
1253
|
},
|
|
1243
1254
|
file_panel: {
|
|
@@ -1577,6 +1588,9 @@ const ti = {
|
|
|
1577
1588
|
},
|
|
1578
1589
|
align_justify: {
|
|
1579
1590
|
tooltip: "Justifier le texte"
|
|
1591
|
+
},
|
|
1592
|
+
comment: {
|
|
1593
|
+
tooltip: "Ajouter un commentaire"
|
|
1580
1594
|
}
|
|
1581
1595
|
},
|
|
1582
1596
|
file_panel: {
|
|
@@ -1901,6 +1915,9 @@ const ti = {
|
|
|
1901
1915
|
},
|
|
1902
1916
|
align_justify: {
|
|
1903
1917
|
tooltip: "Poravnaj tekst obostrano"
|
|
1918
|
+
},
|
|
1919
|
+
comment: {
|
|
1920
|
+
tooltip: "Dodaj komentar"
|
|
1904
1921
|
}
|
|
1905
1922
|
},
|
|
1906
1923
|
file_panel: {
|
|
@@ -2210,6 +2227,9 @@ const ti = {
|
|
|
2210
2227
|
},
|
|
2211
2228
|
align_justify: {
|
|
2212
2229
|
tooltip: "Jafna texta"
|
|
2230
|
+
},
|
|
2231
|
+
comment: {
|
|
2232
|
+
tooltip: "Bæta við athugun"
|
|
2213
2233
|
}
|
|
2214
2234
|
},
|
|
2215
2235
|
file_panel: {
|
|
@@ -2522,6 +2542,9 @@ const ti = {
|
|
|
2522
2542
|
},
|
|
2523
2543
|
align_justify: {
|
|
2524
2544
|
tooltip: "Giustifica testo"
|
|
2545
|
+
},
|
|
2546
|
+
comment: {
|
|
2547
|
+
tooltip: "Aggiungi commento"
|
|
2525
2548
|
}
|
|
2526
2549
|
},
|
|
2527
2550
|
file_panel: {
|
|
@@ -2859,6 +2882,9 @@ const ti = {
|
|
|
2859
2882
|
},
|
|
2860
2883
|
align_justify: {
|
|
2861
2884
|
tooltip: "両端揃え"
|
|
2885
|
+
},
|
|
2886
|
+
comment: {
|
|
2887
|
+
tooltip: "コメントを追加"
|
|
2862
2888
|
}
|
|
2863
2889
|
},
|
|
2864
2890
|
file_panel: {
|
|
@@ -3189,6 +3215,9 @@ const ti = {
|
|
|
3189
3215
|
},
|
|
3190
3216
|
align_justify: {
|
|
3191
3217
|
tooltip: "텍스트 양쪽 맞춤"
|
|
3218
|
+
},
|
|
3219
|
+
comment: {
|
|
3220
|
+
tooltip: "코멘트 추가"
|
|
3192
3221
|
}
|
|
3193
3222
|
},
|
|
3194
3223
|
file_panel: {
|
|
@@ -3506,6 +3535,9 @@ const ti = {
|
|
|
3506
3535
|
},
|
|
3507
3536
|
align_justify: {
|
|
3508
3537
|
tooltip: "Tekst uitvullen"
|
|
3538
|
+
},
|
|
3539
|
+
comment: {
|
|
3540
|
+
tooltip: "Commentaar toevoegen"
|
|
3509
3541
|
}
|
|
3510
3542
|
},
|
|
3511
3543
|
file_panel: {
|
|
@@ -3807,6 +3839,9 @@ const ti = {
|
|
|
3807
3839
|
},
|
|
3808
3840
|
align_justify: {
|
|
3809
3841
|
tooltip: "Wyjustuj tekst"
|
|
3842
|
+
},
|
|
3843
|
+
comment: {
|
|
3844
|
+
tooltip: "Dodaj komentarz"
|
|
3810
3845
|
}
|
|
3811
3846
|
},
|
|
3812
3847
|
file_panel: {
|
|
@@ -4116,6 +4151,9 @@ const ti = {
|
|
|
4116
4151
|
},
|
|
4117
4152
|
align_justify: {
|
|
4118
4153
|
tooltip: "Justificar texto"
|
|
4154
|
+
},
|
|
4155
|
+
comment: {
|
|
4156
|
+
tooltip: "Adicionar comentário"
|
|
4119
4157
|
}
|
|
4120
4158
|
},
|
|
4121
4159
|
file_panel: {
|
|
@@ -4460,6 +4498,9 @@ const ti = {
|
|
|
4460
4498
|
},
|
|
4461
4499
|
align_justify: {
|
|
4462
4500
|
tooltip: "По середине текст"
|
|
4501
|
+
},
|
|
4502
|
+
comment: {
|
|
4503
|
+
tooltip: "Добавить комментарий"
|
|
4463
4504
|
}
|
|
4464
4505
|
},
|
|
4465
4506
|
file_panel: {
|
|
@@ -4526,19 +4567,45 @@ const ti = {
|
|
|
4526
4567
|
numbered_list: {
|
|
4527
4568
|
title: "Нумерований список",
|
|
4528
4569
|
subtext: "Список із впорядкованими елементами",
|
|
4529
|
-
aliases: [
|
|
4570
|
+
aliases: [
|
|
4571
|
+
"ol",
|
|
4572
|
+
"li",
|
|
4573
|
+
"list",
|
|
4574
|
+
"numberedlist",
|
|
4575
|
+
"numbered list",
|
|
4576
|
+
"список",
|
|
4577
|
+
"нумерований список"
|
|
4578
|
+
],
|
|
4530
4579
|
group: "Базові блоки"
|
|
4531
4580
|
},
|
|
4532
4581
|
bullet_list: {
|
|
4533
4582
|
title: "Маркований список",
|
|
4534
4583
|
subtext: "Список із невпорядкованими елементами",
|
|
4535
|
-
aliases: [
|
|
4584
|
+
aliases: [
|
|
4585
|
+
"ul",
|
|
4586
|
+
"li",
|
|
4587
|
+
"list",
|
|
4588
|
+
"bulletlist",
|
|
4589
|
+
"bullet list",
|
|
4590
|
+
"список",
|
|
4591
|
+
"маркований список"
|
|
4592
|
+
],
|
|
4536
4593
|
group: "Базові блоки"
|
|
4537
4594
|
},
|
|
4538
4595
|
check_list: {
|
|
4539
4596
|
title: "Чек-лист",
|
|
4540
4597
|
subtext: "Список із чекбоксами",
|
|
4541
|
-
aliases: [
|
|
4598
|
+
aliases: [
|
|
4599
|
+
"ul",
|
|
4600
|
+
"li",
|
|
4601
|
+
"list",
|
|
4602
|
+
"checklist",
|
|
4603
|
+
"check list",
|
|
4604
|
+
"checked list",
|
|
4605
|
+
"checkbox",
|
|
4606
|
+
"чекбокс",
|
|
4607
|
+
"чек-лист"
|
|
4608
|
+
],
|
|
4542
4609
|
group: "Базові блоки"
|
|
4543
4610
|
},
|
|
4544
4611
|
paragraph: {
|
|
@@ -4568,19 +4635,49 @@ const ti = {
|
|
|
4568
4635
|
image: {
|
|
4569
4636
|
title: "Зображення",
|
|
4570
4637
|
subtext: "Масштабоване зображення з підписом",
|
|
4571
|
-
aliases: [
|
|
4638
|
+
aliases: [
|
|
4639
|
+
"image",
|
|
4640
|
+
"imageUpload",
|
|
4641
|
+
"upload",
|
|
4642
|
+
"img",
|
|
4643
|
+
"picture",
|
|
4644
|
+
"media",
|
|
4645
|
+
"url",
|
|
4646
|
+
"зображення",
|
|
4647
|
+
"медіа"
|
|
4648
|
+
],
|
|
4572
4649
|
group: "Медіа"
|
|
4573
4650
|
},
|
|
4574
4651
|
video: {
|
|
4575
4652
|
title: "Відео",
|
|
4576
4653
|
subtext: "Масштабоване відео з підписом",
|
|
4577
|
-
aliases: [
|
|
4654
|
+
aliases: [
|
|
4655
|
+
"video",
|
|
4656
|
+
"videoUpload",
|
|
4657
|
+
"upload",
|
|
4658
|
+
"mp4",
|
|
4659
|
+
"film",
|
|
4660
|
+
"media",
|
|
4661
|
+
"url",
|
|
4662
|
+
"відео",
|
|
4663
|
+
"медіа"
|
|
4664
|
+
],
|
|
4578
4665
|
group: "Медіа"
|
|
4579
4666
|
},
|
|
4580
4667
|
audio: {
|
|
4581
4668
|
title: "Аудіо",
|
|
4582
4669
|
subtext: "Вбудоване аудіо з підписом",
|
|
4583
|
-
aliases: [
|
|
4670
|
+
aliases: [
|
|
4671
|
+
"audio",
|
|
4672
|
+
"audioUpload",
|
|
4673
|
+
"upload",
|
|
4674
|
+
"mp3",
|
|
4675
|
+
"sound",
|
|
4676
|
+
"media",
|
|
4677
|
+
"url",
|
|
4678
|
+
"аудіо",
|
|
4679
|
+
"медіа"
|
|
4680
|
+
],
|
|
4584
4681
|
group: "Медіа"
|
|
4585
4682
|
},
|
|
4586
4683
|
file: {
|
|
@@ -4746,6 +4843,9 @@ const ti = {
|
|
|
4746
4843
|
},
|
|
4747
4844
|
align_justify: {
|
|
4748
4845
|
tooltip: "Вирівняти за шириною"
|
|
4846
|
+
},
|
|
4847
|
+
comment: {
|
|
4848
|
+
tooltip: "Додати коментар"
|
|
4749
4849
|
}
|
|
4750
4850
|
},
|
|
4751
4851
|
file_panel: {
|
|
@@ -5062,6 +5162,9 @@ const ti = {
|
|
|
5062
5162
|
},
|
|
5063
5163
|
align_justify: {
|
|
5064
5164
|
tooltip: "Căn đều văn bản"
|
|
5165
|
+
},
|
|
5166
|
+
comment: {
|
|
5167
|
+
tooltip: "Thêm bình luận"
|
|
5065
5168
|
}
|
|
5066
5169
|
},
|
|
5067
5170
|
file_panel: {
|
|
@@ -5412,6 +5515,9 @@ const ti = {
|
|
|
5412
5515
|
},
|
|
5413
5516
|
align_justify: {
|
|
5414
5517
|
tooltip: "文本对齐"
|
|
5518
|
+
},
|
|
5519
|
+
comment: {
|
|
5520
|
+
tooltip: "添加评论"
|
|
5415
5521
|
}
|
|
5416
5522
|
},
|
|
5417
5523
|
file_panel: {
|
|
@@ -5459,7 +5565,7 @@ const ti = {
|
|
|
5459
5565
|
__proto__: null,
|
|
5460
5566
|
ar: ti,
|
|
5461
5567
|
de: oi,
|
|
5462
|
-
en:
|
|
5568
|
+
en: St,
|
|
5463
5569
|
es: ii,
|
|
5464
5570
|
fr: ni,
|
|
5465
5571
|
hr: ri,
|
|
@@ -5513,7 +5619,7 @@ const ue = L.create({
|
|
|
5513
5619
|
const e = window.__TEST_OPTIONS;
|
|
5514
5620
|
return e.mockID === void 0 ? e.mockID = 0 : e.mockID++, e.mockID.toString();
|
|
5515
5621
|
}
|
|
5516
|
-
return
|
|
5622
|
+
return Ct();
|
|
5517
5623
|
},
|
|
5518
5624
|
filterTransaction: null
|
|
5519
5625
|
};
|
|
@@ -5582,42 +5688,42 @@ const ue = L.create({
|
|
|
5582
5688
|
});
|
|
5583
5689
|
if (!r || a)
|
|
5584
5690
|
return;
|
|
5585
|
-
const { tr: s } = n, { types: l, attributeName: d, generateID: c } = this.options, u =
|
|
5691
|
+
const { tr: s } = n, { types: l, attributeName: d, generateID: c } = this.options, u = yo(
|
|
5586
5692
|
i.doc,
|
|
5587
5693
|
o
|
|
5588
5694
|
), { mapping: h } = u;
|
|
5589
|
-
if (
|
|
5590
|
-
const g =
|
|
5695
|
+
if (vo(u).forEach(({ newRange: f }) => {
|
|
5696
|
+
const g = wo(
|
|
5591
5697
|
n.doc,
|
|
5592
5698
|
f,
|
|
5593
|
-
(
|
|
5594
|
-
), b = g.map(({ node:
|
|
5595
|
-
g.forEach(({ node:
|
|
5699
|
+
(v) => l.includes(v.type.name)
|
|
5700
|
+
), b = g.map(({ node: v }) => v.attrs[d]).filter((v) => v !== null), k = ki(b);
|
|
5701
|
+
g.forEach(({ node: v, pos: y }) => {
|
|
5596
5702
|
let P;
|
|
5597
|
-
const
|
|
5598
|
-
if (
|
|
5599
|
-
const
|
|
5600
|
-
if (i.doc.content.findDiffStart(
|
|
5703
|
+
const Y = (P = s.doc.nodeAt(y)) === null || P === void 0 ? void 0 : P.attrs[d];
|
|
5704
|
+
if (Y === null) {
|
|
5705
|
+
const x = i.doc.type.createAndFill().content;
|
|
5706
|
+
if (i.doc.content.findDiffStart(x) === null) {
|
|
5601
5707
|
const Je = JSON.parse(
|
|
5602
5708
|
JSON.stringify(n.doc.toJSON())
|
|
5603
5709
|
);
|
|
5604
|
-
if (Je.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(Je.content) === JSON.stringify(
|
|
5710
|
+
if (Je.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(Je.content) === JSON.stringify(x.toJSON())) {
|
|
5605
5711
|
s.setNodeMarkup(y, void 0, {
|
|
5606
|
-
...
|
|
5712
|
+
...v.attrs,
|
|
5607
5713
|
[d]: "initialBlockId"
|
|
5608
5714
|
});
|
|
5609
5715
|
return;
|
|
5610
5716
|
}
|
|
5611
5717
|
}
|
|
5612
5718
|
s.setNodeMarkup(y, void 0, {
|
|
5613
|
-
...
|
|
5719
|
+
...v.attrs,
|
|
5614
5720
|
[d]: c()
|
|
5615
5721
|
});
|
|
5616
5722
|
return;
|
|
5617
5723
|
}
|
|
5618
5724
|
const { deleted: ge } = h.invert().mapResult(y);
|
|
5619
|
-
ge && k.includes(
|
|
5620
|
-
...
|
|
5725
|
+
ge && k.includes(Y) && s.setNodeMarkup(y, void 0, {
|
|
5726
|
+
...v.attrs,
|
|
5621
5727
|
[d]: c()
|
|
5622
5728
|
});
|
|
5623
5729
|
});
|
|
@@ -5690,7 +5796,7 @@ const ue = L.create({
|
|
|
5690
5796
|
function it(e) {
|
|
5691
5797
|
return e.type === "link";
|
|
5692
5798
|
}
|
|
5693
|
-
function
|
|
5799
|
+
function Bt(e) {
|
|
5694
5800
|
return typeof e != "string" && e.type === "link";
|
|
5695
5801
|
}
|
|
5696
5802
|
function de(e) {
|
|
@@ -5716,7 +5822,7 @@ function _i(e, t, o) {
|
|
|
5716
5822
|
const i = t.marks.link.create({
|
|
5717
5823
|
href: e.href
|
|
5718
5824
|
});
|
|
5719
|
-
return
|
|
5825
|
+
return He(e.content, t, o).map(
|
|
5720
5826
|
(n) => {
|
|
5721
5827
|
if (n.type.name === "text")
|
|
5722
5828
|
return n.mark([...n.marks, i]);
|
|
@@ -5726,7 +5832,7 @@ function _i(e, t, o) {
|
|
|
5726
5832
|
}
|
|
5727
5833
|
);
|
|
5728
5834
|
}
|
|
5729
|
-
function
|
|
5835
|
+
function He(e, t, o, i) {
|
|
5730
5836
|
const n = [];
|
|
5731
5837
|
if (typeof e == "string")
|
|
5732
5838
|
return n.push(
|
|
@@ -5743,15 +5849,15 @@ function Ue(e, t, o, i) {
|
|
|
5743
5849
|
);
|
|
5744
5850
|
return n;
|
|
5745
5851
|
}
|
|
5746
|
-
function
|
|
5852
|
+
function H(e, t, o, i) {
|
|
5747
5853
|
const n = [];
|
|
5748
5854
|
for (const r of e)
|
|
5749
5855
|
typeof r == "string" ? n.push(
|
|
5750
|
-
...
|
|
5751
|
-
) :
|
|
5752
|
-
...
|
|
5856
|
+
...He(r, t, o, i)
|
|
5857
|
+
) : Bt(r) ? n.push(..._i(r, t, o)) : de(r) ? n.push(
|
|
5858
|
+
...He([r], t, o, i)
|
|
5753
5859
|
) : n.push(
|
|
5754
|
-
|
|
5860
|
+
Tt(r, t, o)
|
|
5755
5861
|
);
|
|
5756
5862
|
return n;
|
|
5757
5863
|
}
|
|
@@ -5771,7 +5877,7 @@ function Ce(e, t, o) {
|
|
|
5771
5877
|
t.text(d)
|
|
5772
5878
|
);
|
|
5773
5879
|
else {
|
|
5774
|
-
const h =
|
|
5880
|
+
const h = H(d, t, o);
|
|
5775
5881
|
c = t.nodes.tableParagraph.createChecked({}, h);
|
|
5776
5882
|
}
|
|
5777
5883
|
const u = t.nodes.tableCell.createChecked(
|
|
@@ -5790,14 +5896,14 @@ function Ce(e, t, o) {
|
|
|
5790
5896
|
}
|
|
5791
5897
|
return i;
|
|
5792
5898
|
}
|
|
5793
|
-
function
|
|
5899
|
+
function Tt(e, t, o) {
|
|
5794
5900
|
let i, n = e.type;
|
|
5795
5901
|
if (n === void 0 && (n = "paragraph"), !t.nodes[n])
|
|
5796
5902
|
throw new Error(`node type ${n} not found in schema`);
|
|
5797
5903
|
if (!e.content)
|
|
5798
5904
|
i = t.nodes[n].createChecked(e.props);
|
|
5799
5905
|
else if (typeof e.content == "string") {
|
|
5800
|
-
const r =
|
|
5906
|
+
const r = H(
|
|
5801
5907
|
[e.content],
|
|
5802
5908
|
t,
|
|
5803
5909
|
o,
|
|
@@ -5805,7 +5911,7 @@ function Bt(e, t, o) {
|
|
|
5805
5911
|
);
|
|
5806
5912
|
i = t.nodes[n].createChecked(e.props, r);
|
|
5807
5913
|
} else if (Array.isArray(e.content)) {
|
|
5808
|
-
const r =
|
|
5914
|
+
const r = H(
|
|
5809
5915
|
e.content,
|
|
5810
5916
|
t,
|
|
5811
5917
|
o,
|
|
@@ -5819,16 +5925,16 @@ function Bt(e, t, o) {
|
|
|
5819
5925
|
throw new D(e.content.type);
|
|
5820
5926
|
return i;
|
|
5821
5927
|
}
|
|
5822
|
-
function
|
|
5928
|
+
function J(e, t, o) {
|
|
5823
5929
|
let i = e.id;
|
|
5824
5930
|
i === void 0 && (i = ue.options.generateID());
|
|
5825
5931
|
const n = [];
|
|
5826
5932
|
if (e.children)
|
|
5827
5933
|
for (const a of e.children)
|
|
5828
|
-
n.push(
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
const a =
|
|
5934
|
+
n.push(J(a, t, o));
|
|
5935
|
+
if (!e.type || // can happen if block.type is not defined (this should create the default node)
|
|
5936
|
+
t.nodes[e.type].isInGroup("blockContent")) {
|
|
5937
|
+
const a = Tt(
|
|
5832
5938
|
e,
|
|
5833
5939
|
t,
|
|
5834
5940
|
o
|
|
@@ -5841,7 +5947,7 @@ function Z(e, t, o) {
|
|
|
5841
5947
|
s ? [a, s] : a
|
|
5842
5948
|
);
|
|
5843
5949
|
} else {
|
|
5844
|
-
if (
|
|
5950
|
+
if (t.nodes[e.type].isInGroup("bnBlock"))
|
|
5845
5951
|
return t.nodes[e.type].createChecked(
|
|
5846
5952
|
{
|
|
5847
5953
|
id: i,
|
|
@@ -5854,23 +5960,23 @@ function Z(e, t, o) {
|
|
|
5854
5960
|
);
|
|
5855
5961
|
}
|
|
5856
5962
|
}
|
|
5857
|
-
function
|
|
5963
|
+
function Mt(e) {
|
|
5858
5964
|
const t = [...e.classList].filter(
|
|
5859
5965
|
(o) => !o.startsWith("bn-")
|
|
5860
5966
|
) || [];
|
|
5861
5967
|
t.length > 0 ? e.className = t.join(" ") : e.removeAttribute("class");
|
|
5862
5968
|
}
|
|
5863
|
-
function
|
|
5969
|
+
function It(e, t, o, i) {
|
|
5864
5970
|
let n;
|
|
5865
5971
|
if (t)
|
|
5866
5972
|
if (typeof t == "string")
|
|
5867
|
-
n =
|
|
5973
|
+
n = H(
|
|
5868
5974
|
[t],
|
|
5869
5975
|
e.pmSchema,
|
|
5870
5976
|
e.schema.styleSchema
|
|
5871
5977
|
);
|
|
5872
5978
|
else if (Array.isArray(t))
|
|
5873
|
-
n =
|
|
5979
|
+
n = H(
|
|
5874
5980
|
t,
|
|
5875
5981
|
e.pmSchema,
|
|
5876
5982
|
e.schema.styleSchema
|
|
@@ -5885,18 +5991,18 @@ function Mt(e, t, o, i) {
|
|
|
5885
5991
|
throw new D(t.type);
|
|
5886
5992
|
else throw new Error("blockContent is required");
|
|
5887
5993
|
const r = o.serializeFragment(j.from(n), i);
|
|
5888
|
-
return r.nodeType === 1 &&
|
|
5994
|
+
return r.nodeType === 1 && Mt(r), r;
|
|
5889
5995
|
}
|
|
5890
5996
|
function yi(e, t, o, i, n, r, a) {
|
|
5891
|
-
var g, b, k,
|
|
5997
|
+
var g, b, k, v, y, P, Y, ge;
|
|
5892
5998
|
const s = (a == null ? void 0 : a.document) ?? document, l = t.pmSchema.nodes.blockContainer;
|
|
5893
5999
|
let d = o.props;
|
|
5894
6000
|
if (!o.props) {
|
|
5895
6001
|
d = {};
|
|
5896
|
-
for (const [E,
|
|
6002
|
+
for (const [E, x] of Object.entries(
|
|
5897
6003
|
t.schema.blockSchema[o.type].propSchema
|
|
5898
6004
|
))
|
|
5899
|
-
|
|
6005
|
+
x.default !== void 0 && (d[E] = x.default);
|
|
5900
6006
|
}
|
|
5901
6007
|
const u = [...((b = (g = l.spec) == null ? void 0 : g.toDOM) == null ? void 0 : b.call(
|
|
5902
6008
|
g,
|
|
@@ -5907,15 +6013,15 @@ function yi(e, t, o, i, n, r, a) {
|
|
|
5907
6013
|
)).dom.attributes], h = t.blockImplementations[o.type].implementation.toExternalHTML({ ...o, props: d }, t), m = s.createDocumentFragment();
|
|
5908
6014
|
if (h.dom.classList.contains("bn-block-content")) {
|
|
5909
6015
|
const E = [...u, ...h.dom.attributes].filter(
|
|
5910
|
-
(
|
|
6016
|
+
(x) => x.name.startsWith("data") && x.name !== "data-content-type" && x.name !== "data-file-block" && x.name !== "data-node-view-wrapper" && x.name !== "data-node-type" && x.name !== "data-id" && x.name !== "data-index" && x.name !== "data-editable"
|
|
5911
6017
|
);
|
|
5912
|
-
for (const
|
|
5913
|
-
h.dom.firstChild.setAttribute(
|
|
5914
|
-
|
|
6018
|
+
for (const x of E)
|
|
6019
|
+
h.dom.firstChild.setAttribute(x.name, x.value);
|
|
6020
|
+
Mt(h.dom.firstChild), m.append(...h.dom.childNodes);
|
|
5915
6021
|
} else
|
|
5916
6022
|
m.append(h.dom);
|
|
5917
6023
|
if (h.contentDOM && o.content) {
|
|
5918
|
-
const E =
|
|
6024
|
+
const E = It(
|
|
5919
6025
|
t,
|
|
5920
6026
|
o.content,
|
|
5921
6027
|
// TODO
|
|
@@ -5927,8 +6033,8 @@ function yi(e, t, o, i, n, r, a) {
|
|
|
5927
6033
|
let f;
|
|
5928
6034
|
if (n.has(o.type) ? f = "OL" : r.has(o.type) && (f = "UL"), f) {
|
|
5929
6035
|
if (((k = e.lastChild) == null ? void 0 : k.nodeName) !== f) {
|
|
5930
|
-
const
|
|
5931
|
-
f === "OL" && (d != null && d.start) && (d == null ? void 0 : d.start) !== 1 &&
|
|
6036
|
+
const x = s.createElement(f);
|
|
6037
|
+
f === "OL" && (d != null && d.start) && (d == null ? void 0 : d.start) !== 1 && x.setAttribute("start", d.start + ""), e.append(x);
|
|
5932
6038
|
}
|
|
5933
6039
|
const E = s.createElement("li");
|
|
5934
6040
|
E.append(m), e.lastChild.appendChild(E);
|
|
@@ -5936,7 +6042,7 @@ function yi(e, t, o, i, n, r, a) {
|
|
|
5936
6042
|
e.append(m);
|
|
5937
6043
|
if (o.children && o.children.length > 0) {
|
|
5938
6044
|
const E = s.createDocumentFragment();
|
|
5939
|
-
if (
|
|
6045
|
+
if (Lt(
|
|
5940
6046
|
E,
|
|
5941
6047
|
t,
|
|
5942
6048
|
o.children,
|
|
@@ -5944,13 +6050,13 @@ function yi(e, t, o, i, n, r, a) {
|
|
|
5944
6050
|
n,
|
|
5945
6051
|
r,
|
|
5946
6052
|
a
|
|
5947
|
-
), ((
|
|
5948
|
-
for (; ((P = E.firstChild) == null ? void 0 : P.nodeName) === "UL" || ((
|
|
6053
|
+
), ((v = e.lastChild) == null ? void 0 : v.nodeName) === "UL" || ((y = e.lastChild) == null ? void 0 : y.nodeName) === "OL")
|
|
6054
|
+
for (; ((P = E.firstChild) == null ? void 0 : P.nodeName) === "UL" || ((Y = E.firstChild) == null ? void 0 : Y.nodeName) === "OL"; )
|
|
5949
6055
|
e.lastChild.lastChild.appendChild(E.firstChild);
|
|
5950
6056
|
t.pmSchema.nodes[o.type].isInGroup("blockContent") ? e.append(E) : (ge = h.contentDOM) == null || ge.append(E);
|
|
5951
6057
|
}
|
|
5952
6058
|
}
|
|
5953
|
-
const
|
|
6059
|
+
const Lt = (e, t, o, i, n, r, a) => {
|
|
5954
6060
|
for (const s of o)
|
|
5955
6061
|
yi(
|
|
5956
6062
|
e,
|
|
@@ -5963,7 +6069,7 @@ const It = (e, t, o, i, n, r, a) => {
|
|
|
5963
6069
|
);
|
|
5964
6070
|
}, vi = (e, t, o, i, n, r) => {
|
|
5965
6071
|
const s = ((r == null ? void 0 : r.document) ?? document).createDocumentFragment();
|
|
5966
|
-
return
|
|
6072
|
+
return Lt(
|
|
5967
6073
|
s,
|
|
5968
6074
|
e,
|
|
5969
6075
|
t,
|
|
@@ -5973,7 +6079,7 @@ const It = (e, t, o, i, n, r, a) => {
|
|
|
5973
6079
|
r
|
|
5974
6080
|
), s;
|
|
5975
6081
|
}, Ee = (e, t) => {
|
|
5976
|
-
const o =
|
|
6082
|
+
const o = vt.fromSchema(e);
|
|
5977
6083
|
return {
|
|
5978
6084
|
exportBlocks: (i, n) => {
|
|
5979
6085
|
const r = vi(
|
|
@@ -5987,7 +6093,7 @@ const It = (e, t, o, i, n, r, a) => {
|
|
|
5987
6093
|
return a.append(r), a.innerHTML;
|
|
5988
6094
|
},
|
|
5989
6095
|
exportInlineContent: (i, n) => {
|
|
5990
|
-
const r =
|
|
6096
|
+
const r = It(
|
|
5991
6097
|
t,
|
|
5992
6098
|
i,
|
|
5993
6099
|
o,
|
|
@@ -6001,14 +6107,14 @@ function wi(e, t, o, i, n) {
|
|
|
6001
6107
|
let r;
|
|
6002
6108
|
if (t)
|
|
6003
6109
|
if (typeof t == "string")
|
|
6004
|
-
r =
|
|
6110
|
+
r = H(
|
|
6005
6111
|
[t],
|
|
6006
6112
|
e.pmSchema,
|
|
6007
6113
|
e.schema.styleSchema,
|
|
6008
6114
|
i
|
|
6009
6115
|
);
|
|
6010
6116
|
else if (Array.isArray(t))
|
|
6011
|
-
r =
|
|
6117
|
+
r = H(
|
|
6012
6118
|
t,
|
|
6013
6119
|
e.pmSchema,
|
|
6014
6120
|
e.schema.styleSchema,
|
|
@@ -6050,7 +6156,7 @@ function xi(e, t, o, i, n) {
|
|
|
6050
6156
|
}
|
|
6051
6157
|
if (e.pmSchema.nodes[t.type].isInGroup("bnBlock")) {
|
|
6052
6158
|
if (t.children && t.children.length > 0) {
|
|
6053
|
-
const b =
|
|
6159
|
+
const b = At(
|
|
6054
6160
|
e,
|
|
6055
6161
|
t.children,
|
|
6056
6162
|
o,
|
|
@@ -6068,10 +6174,10 @@ function xi(e, t, o, i, n) {
|
|
|
6068
6174
|
})
|
|
6069
6175
|
);
|
|
6070
6176
|
return (f = c.contentDOM) == null || f.appendChild(l.dom), t.children && t.children.length > 0 && ((g = c.contentDOM) == null || g.appendChild(
|
|
6071
|
-
|
|
6177
|
+
Pt(e, t.children, o, n)
|
|
6072
6178
|
)), c.dom;
|
|
6073
6179
|
}
|
|
6074
|
-
function
|
|
6180
|
+
function At(e, t, o, i) {
|
|
6075
6181
|
const r = ((i == null ? void 0 : i.document) ?? document).createDocumentFragment();
|
|
6076
6182
|
let a = 0;
|
|
6077
6183
|
for (const s of t) {
|
|
@@ -6087,14 +6193,14 @@ function Lt(e, t, o, i) {
|
|
|
6087
6193
|
}
|
|
6088
6194
|
return r;
|
|
6089
6195
|
}
|
|
6090
|
-
const
|
|
6196
|
+
const Pt = (e, t, o, i) => {
|
|
6091
6197
|
var s;
|
|
6092
|
-
const n = e.pmSchema.nodes.blockGroup, r = n.spec.toDOM(n.create({})), a =
|
|
6198
|
+
const n = e.pmSchema.nodes.blockGroup, r = n.spec.toDOM(n.create({})), a = At(e, t, o, i);
|
|
6093
6199
|
return (s = r.contentDOM) == null || s.appendChild(a), r.dom;
|
|
6094
6200
|
}, Ci = (e, t) => {
|
|
6095
|
-
const o =
|
|
6201
|
+
const o = vt.fromSchema(e);
|
|
6096
6202
|
return {
|
|
6097
|
-
serializeBlocks: (i, n) =>
|
|
6203
|
+
serializeBlocks: (i, n) => Pt(t, i, o, n).outerHTML
|
|
6098
6204
|
};
|
|
6099
6205
|
};
|
|
6100
6206
|
function z(e, t) {
|
|
@@ -6230,7 +6336,7 @@ function R(e, t, o, i) {
|
|
|
6230
6336
|
};
|
|
6231
6337
|
}
|
|
6232
6338
|
const rt = (e, t) => {
|
|
6233
|
-
let o =
|
|
6339
|
+
let o = J(e, t.pmSchema, t.schema.styleSchema);
|
|
6234
6340
|
o.type.name === "blockContainer" && (o = o.firstChild);
|
|
6235
6341
|
const i = t.pmSchema.nodes[o.type.name].spec.toDOM;
|
|
6236
6342
|
if (i === void 0)
|
|
@@ -6243,7 +6349,7 @@ const rt = (e, t) => {
|
|
|
6243
6349
|
"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."
|
|
6244
6350
|
);
|
|
6245
6351
|
return n;
|
|
6246
|
-
},
|
|
6352
|
+
}, C = {
|
|
6247
6353
|
backgroundColor: {
|
|
6248
6354
|
default: "default"
|
|
6249
6355
|
},
|
|
@@ -6254,7 +6360,7 @@ const rt = (e, t) => {
|
|
|
6254
6360
|
default: "left",
|
|
6255
6361
|
values: ["left", "center", "right", "justify"]
|
|
6256
6362
|
}
|
|
6257
|
-
},
|
|
6363
|
+
}, Nt = ["backgroundColor", "textColor"];
|
|
6258
6364
|
function ye(e) {
|
|
6259
6365
|
return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
6260
6366
|
}
|
|
@@ -6265,7 +6371,7 @@ function ls(e) {
|
|
|
6265
6371
|
}
|
|
6266
6372
|
function he(e) {
|
|
6267
6373
|
const t = {};
|
|
6268
|
-
return Object.entries(e).filter(([o, i]) => !
|
|
6374
|
+
return Object.entries(e).filter(([o, i]) => !Nt.includes(o)).forEach(([o, i]) => {
|
|
6269
6375
|
t[o] = {
|
|
6270
6376
|
default: i.default,
|
|
6271
6377
|
keepOnSplit: !0,
|
|
@@ -6314,7 +6420,7 @@ function be(e, t, o, i, n = !1, r) {
|
|
|
6314
6420
|
), a.setAttribute("data-content-type", t);
|
|
6315
6421
|
for (const [s, l] of Object.entries(o)) {
|
|
6316
6422
|
const c = i[s].default;
|
|
6317
|
-
!
|
|
6423
|
+
!Nt.includes(s) && l !== c && a.setAttribute(ye(s), l);
|
|
6318
6424
|
}
|
|
6319
6425
|
return n && a.setAttribute("data-file-block", ""), a.appendChild(e.dom), e.contentDOM !== void 0 && (e.contentDOM.className = G(
|
|
6320
6426
|
"bn-inline-content",
|
|
@@ -6325,16 +6431,16 @@ function be(e, t, o, i, n = !1, r) {
|
|
|
6325
6431
|
};
|
|
6326
6432
|
}
|
|
6327
6433
|
function $(e) {
|
|
6328
|
-
return
|
|
6434
|
+
return Z.create(e);
|
|
6329
6435
|
}
|
|
6330
|
-
function
|
|
6436
|
+
function jt(e, t) {
|
|
6331
6437
|
return {
|
|
6332
6438
|
config: e,
|
|
6333
6439
|
implementation: t
|
|
6334
6440
|
};
|
|
6335
6441
|
}
|
|
6336
6442
|
function W(e, t, o) {
|
|
6337
|
-
return
|
|
6443
|
+
return jt(
|
|
6338
6444
|
{
|
|
6339
6445
|
type: e.name,
|
|
6340
6446
|
content: e.config.content === "inline*" ? "inline" : e.config.content === "tableRow+" ? "table" : "none",
|
|
@@ -6349,7 +6455,7 @@ function W(e, t, o) {
|
|
|
6349
6455
|
}
|
|
6350
6456
|
);
|
|
6351
6457
|
}
|
|
6352
|
-
function
|
|
6458
|
+
function Dt(e) {
|
|
6353
6459
|
return Object.fromEntries(
|
|
6354
6460
|
Object.entries(e).map(([t, o]) => [t, o.config])
|
|
6355
6461
|
);
|
|
@@ -6426,7 +6532,7 @@ function me(e, t) {
|
|
|
6426
6532
|
throw new Error(
|
|
6427
6533
|
"Node name does not match block type. This is a bug in BlockNote."
|
|
6428
6534
|
);
|
|
6429
|
-
return
|
|
6535
|
+
return jt(e, {
|
|
6430
6536
|
node: o,
|
|
6431
6537
|
toInternalHTML: (i, n) => {
|
|
6432
6538
|
var s;
|
|
@@ -6460,7 +6566,7 @@ function me(e, t) {
|
|
|
6460
6566
|
}
|
|
6461
6567
|
});
|
|
6462
6568
|
}
|
|
6463
|
-
function
|
|
6569
|
+
function Ht(e, t, o) {
|
|
6464
6570
|
const i = {
|
|
6465
6571
|
type: "tableContent",
|
|
6466
6572
|
columnWidths: [],
|
|
@@ -6507,9 +6613,13 @@ function Se(e, t, o) {
|
|
|
6507
6613
|
};
|
|
6508
6614
|
return;
|
|
6509
6615
|
}
|
|
6510
|
-
if (r.type.name !== "link" && r.type.name !== "text"
|
|
6616
|
+
if (r.type.name !== "link" && r.type.name !== "text") {
|
|
6617
|
+
if (!t[r.type.name]) {
|
|
6618
|
+
console.warn("unrecognized inline content type", r.type.name);
|
|
6619
|
+
return;
|
|
6620
|
+
}
|
|
6511
6621
|
n && (i.push(n), n = void 0), i.push(
|
|
6512
|
-
|
|
6622
|
+
Ue(r, t, o)
|
|
6513
6623
|
);
|
|
6514
6624
|
return;
|
|
6515
6625
|
}
|
|
@@ -6520,8 +6630,11 @@ function Se(e, t, o) {
|
|
|
6520
6630
|
s = l;
|
|
6521
6631
|
else {
|
|
6522
6632
|
const d = o[l.type.name];
|
|
6523
|
-
if (!d)
|
|
6633
|
+
if (!d) {
|
|
6634
|
+
if (l.type.spec.blocknoteIgnore)
|
|
6635
|
+
continue;
|
|
6524
6636
|
throw new Error(`style ${l.type.name} not found in styleSchema`);
|
|
6637
|
+
}
|
|
6525
6638
|
if (d.propSchema === "boolean")
|
|
6526
6639
|
a[d.type] = !0;
|
|
6527
6640
|
else if (d.propSchema === "string")
|
|
@@ -6580,7 +6693,7 @@ function Se(e, t, o) {
|
|
|
6580
6693
|
};
|
|
6581
6694
|
}), n && i.push(n), i;
|
|
6582
6695
|
}
|
|
6583
|
-
function
|
|
6696
|
+
function Ue(e, t, o) {
|
|
6584
6697
|
if (e.type.name === "text" || e.type.name === "link")
|
|
6585
6698
|
throw new Error("unexpected");
|
|
6586
6699
|
const i = {}, n = t[e.type.name];
|
|
@@ -6601,7 +6714,7 @@ function He(e, t, o) {
|
|
|
6601
6714
|
content: r
|
|
6602
6715
|
};
|
|
6603
6716
|
}
|
|
6604
|
-
function
|
|
6717
|
+
function w(e, t, o, i, n) {
|
|
6605
6718
|
var f;
|
|
6606
6719
|
if (!e.type.isInGroup("bnBlock"))
|
|
6607
6720
|
throw Error(
|
|
@@ -6627,7 +6740,7 @@ function v(e, t, o, i, n) {
|
|
|
6627
6740
|
const c = t[a.blockNoteType], u = [];
|
|
6628
6741
|
(f = a.childContainer) == null || f.node.forEach((g) => {
|
|
6629
6742
|
u.push(
|
|
6630
|
-
|
|
6743
|
+
w(
|
|
6631
6744
|
g,
|
|
6632
6745
|
t,
|
|
6633
6746
|
o,
|
|
@@ -6648,7 +6761,7 @@ function v(e, t, o, i, n) {
|
|
|
6648
6761
|
} else if (c.content === "table") {
|
|
6649
6762
|
if (!a.isBlockContainer)
|
|
6650
6763
|
throw new Error("impossible");
|
|
6651
|
-
h =
|
|
6764
|
+
h = Ht(
|
|
6652
6765
|
a.blockContent.node,
|
|
6653
6766
|
o,
|
|
6654
6767
|
i
|
|
@@ -6715,7 +6828,7 @@ function Ai(e) {
|
|
|
6715
6828
|
];
|
|
6716
6829
|
}
|
|
6717
6830
|
function ds(e, t) {
|
|
6718
|
-
const o =
|
|
6831
|
+
const o = Z.create({
|
|
6719
6832
|
name: e.type,
|
|
6720
6833
|
inline: !0,
|
|
6721
6834
|
group: "inline",
|
|
@@ -6733,7 +6846,7 @@ function ds(e, t) {
|
|
|
6733
6846
|
},
|
|
6734
6847
|
renderHTML({ node: i }) {
|
|
6735
6848
|
const n = this.options.editor, r = t.render(
|
|
6736
|
-
|
|
6849
|
+
Ue(
|
|
6737
6850
|
i,
|
|
6738
6851
|
n.schema.inlineContentSchema,
|
|
6739
6852
|
n.schema.styleSchema
|
|
@@ -6753,7 +6866,7 @@ function ds(e, t) {
|
|
|
6753
6866
|
addNodeView() {
|
|
6754
6867
|
return ({ node: i, getPos: n }) => {
|
|
6755
6868
|
const r = this.options.editor, a = t.render(
|
|
6756
|
-
|
|
6869
|
+
Ue(
|
|
6757
6870
|
i,
|
|
6758
6871
|
r.schema.inlineContentSchema,
|
|
6759
6872
|
r.schema.styleSchema
|
|
@@ -6762,7 +6875,7 @@ function ds(e, t) {
|
|
|
6762
6875
|
(s) => {
|
|
6763
6876
|
if (typeof n == "boolean")
|
|
6764
6877
|
return;
|
|
6765
|
-
const l =
|
|
6878
|
+
const l = H(
|
|
6766
6879
|
[s],
|
|
6767
6880
|
r._tiptapEditor.schema,
|
|
6768
6881
|
r.schema.styleSchema
|
|
@@ -6806,14 +6919,14 @@ function Pi(e) {
|
|
|
6806
6919
|
function Ni(e, t, o, i) {
|
|
6807
6920
|
return e.dom.setAttribute("data-style-type", t), i === "string" && e.dom.setAttribute("data-value", o), e.contentDOM !== void 0 && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
6808
6921
|
}
|
|
6809
|
-
function
|
|
6922
|
+
function Ot(e, t) {
|
|
6810
6923
|
return {
|
|
6811
6924
|
config: e,
|
|
6812
6925
|
implementation: t
|
|
6813
6926
|
};
|
|
6814
6927
|
}
|
|
6815
6928
|
function K(e, t) {
|
|
6816
|
-
return
|
|
6929
|
+
return Ot(
|
|
6817
6930
|
{
|
|
6818
6931
|
type: e.name,
|
|
6819
6932
|
propSchema: t
|
|
@@ -6823,7 +6936,7 @@ function K(e, t) {
|
|
|
6823
6936
|
}
|
|
6824
6937
|
);
|
|
6825
6938
|
}
|
|
6826
|
-
function
|
|
6939
|
+
function Rt(e) {
|
|
6827
6940
|
return Object.fromEntries(
|
|
6828
6941
|
Object.entries(e).map(([t, o]) => [t, o.config])
|
|
6829
6942
|
);
|
|
@@ -6864,7 +6977,7 @@ function cs(e, t) {
|
|
|
6864
6977
|
);
|
|
6865
6978
|
}
|
|
6866
6979
|
});
|
|
6867
|
-
return
|
|
6980
|
+
return Ot(e, {
|
|
6868
6981
|
mark: o
|
|
6869
6982
|
});
|
|
6870
6983
|
}
|
|
@@ -6910,11 +7023,11 @@ const Be = (e, t) => {
|
|
|
6910
7023
|
);
|
|
6911
7024
|
}
|
|
6912
7025
|
};
|
|
6913
|
-
},
|
|
7026
|
+
}, Hi = '<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>', Ui = (e) => {
|
|
6914
7027
|
const t = document.createElement("div");
|
|
6915
7028
|
t.className = "bn-file-name-with-icon";
|
|
6916
7029
|
const o = document.createElement("div");
|
|
6917
|
-
o.className = "bn-file-icon", o.innerHTML =
|
|
7030
|
+
o.className = "bn-file-icon", o.innerHTML = Hi, t.appendChild(o);
|
|
6918
7031
|
const i = document.createElement("p");
|
|
6919
7032
|
return i.className = "bn-file-name", i.textContent = e.props.name, t.appendChild(i), {
|
|
6920
7033
|
dom: t
|
|
@@ -6945,7 +7058,7 @@ const Be = (e, t) => {
|
|
|
6945
7058
|
}
|
|
6946
7059
|
const a = { dom: r };
|
|
6947
7060
|
if (e.props.showPreview === !1 || !o) {
|
|
6948
|
-
const s =
|
|
7061
|
+
const s = Ui(e);
|
|
6949
7062
|
r.appendChild(s.dom), a.destroy = () => {
|
|
6950
7063
|
var l;
|
|
6951
7064
|
(l = s.destroy) == null || l.call(s);
|
|
@@ -6966,7 +7079,7 @@ const Be = (e, t) => {
|
|
|
6966
7079
|
dom: o
|
|
6967
7080
|
};
|
|
6968
7081
|
}, st = (e) => ({ url: e.src || void 0 }), Oi = '<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>', Ri = {
|
|
6969
|
-
backgroundColor:
|
|
7082
|
+
backgroundColor: C.backgroundColor,
|
|
6970
7083
|
// File name.
|
|
6971
7084
|
name: {
|
|
6972
7085
|
default: ""
|
|
@@ -7029,13 +7142,13 @@ const Be = (e, t) => {
|
|
|
7029
7142
|
render: zi,
|
|
7030
7143
|
parse: Fi,
|
|
7031
7144
|
toExternalHTML: Gi
|
|
7032
|
-
}),
|
|
7145
|
+
}), Vt = [
|
|
7033
7146
|
{
|
|
7034
7147
|
id: "text",
|
|
7035
7148
|
name: "Plain Text",
|
|
7036
7149
|
match: ["text", "txt", "plain"]
|
|
7037
7150
|
},
|
|
7038
|
-
...
|
|
7151
|
+
...Et.filter((e) => [
|
|
7039
7152
|
"c",
|
|
7040
7153
|
"cpp",
|
|
7041
7154
|
"css",
|
|
@@ -7137,9 +7250,9 @@ const Be = (e, t) => {
|
|
|
7137
7250
|
), Oe = {
|
|
7138
7251
|
language: {
|
|
7139
7252
|
default: "javascript",
|
|
7140
|
-
values: [...
|
|
7253
|
+
values: [...Vt.map((e) => e.id)]
|
|
7141
7254
|
}
|
|
7142
|
-
},
|
|
7255
|
+
}, zt = $({
|
|
7143
7256
|
name: "codeBlock",
|
|
7144
7257
|
content: "inline*",
|
|
7145
7258
|
group: "blockContent",
|
|
@@ -7150,7 +7263,7 @@ const Be = (e, t) => {
|
|
|
7150
7263
|
return {
|
|
7151
7264
|
defaultLanguage: "javascript",
|
|
7152
7265
|
indentLineWithTab: !0,
|
|
7153
|
-
supportedLanguages:
|
|
7266
|
+
supportedLanguages: Vt
|
|
7154
7267
|
};
|
|
7155
7268
|
},
|
|
7156
7269
|
addAttributes() {
|
|
@@ -7250,7 +7363,7 @@ const Be = (e, t) => {
|
|
|
7250
7363
|
}
|
|
7251
7364
|
);
|
|
7252
7365
|
const s = a.language;
|
|
7253
|
-
return s && s !== "text" && !o.getLoadedLanguages().includes(s) && e.find(({ id: l }) => l === s) &&
|
|
7366
|
+
return s && s !== "text" && !o.getLoadedLanguages().includes(s) && e.find(({ id: l }) => l === s) && Et.find(({ id: l }) => l === s) ? o.loadLanguage(s) : (i || (i = t[lt] || Ao(o), t[lt] = i), i(a));
|
|
7254
7367
|
},
|
|
7255
7368
|
languageExtractor: (a) => a.attrs.language,
|
|
7256
7369
|
nodeTypes: [this.name]
|
|
@@ -7259,7 +7372,7 @@ const Be = (e, t) => {
|
|
|
7259
7372
|
addInputRules() {
|
|
7260
7373
|
const e = this.options.supportedLanguages;
|
|
7261
7374
|
return [
|
|
7262
|
-
new
|
|
7375
|
+
new oe({
|
|
7263
7376
|
find: /^```(.*?)\s$/,
|
|
7264
7377
|
handler: ({ state: t, range: o, match: i }) => {
|
|
7265
7378
|
var s;
|
|
@@ -7272,7 +7385,7 @@ const Be = (e, t) => {
|
|
|
7272
7385
|
this.type
|
|
7273
7386
|
))
|
|
7274
7387
|
return null;
|
|
7275
|
-
t.tr.delete(o.from, o.to).setBlockType(o.from, o.from, this.type, a).setSelection(
|
|
7388
|
+
t.tr.delete(o.from, o.to).setBlockType(o.from, o.from, this.type, a).setSelection(U.create(t.tr.doc, o.from));
|
|
7276
7389
|
}
|
|
7277
7390
|
})
|
|
7278
7391
|
];
|
|
@@ -7281,7 +7394,7 @@ const Be = (e, t) => {
|
|
|
7281
7394
|
return {
|
|
7282
7395
|
Delete: ({ editor: e }) => {
|
|
7283
7396
|
const { selection: t } = e.state, { $from: o } = t;
|
|
7284
|
-
if (e.isActive(this.name) && !o.parent.textContent &&
|
|
7397
|
+
if (e.isActive(this.name) && !o.parent.textContent && xt(t)) {
|
|
7285
7398
|
const i = o.pos - o.parentOffset - 2;
|
|
7286
7399
|
return e.chain().setNodeSelection(i).deleteSelection().run(), !0;
|
|
7287
7400
|
}
|
|
@@ -7310,13 +7423,13 @@ const Be = (e, t) => {
|
|
|
7310
7423
|
};
|
|
7311
7424
|
}
|
|
7312
7425
|
}), Wi = W(
|
|
7313
|
-
|
|
7426
|
+
zt,
|
|
7314
7427
|
Oe
|
|
7315
7428
|
);
|
|
7316
7429
|
function us(e) {
|
|
7317
7430
|
var t;
|
|
7318
7431
|
return W(
|
|
7319
|
-
|
|
7432
|
+
zt.configure(e),
|
|
7320
7433
|
{
|
|
7321
7434
|
language: {
|
|
7322
7435
|
default: e.defaultLanguage || Oe.language.default,
|
|
@@ -7404,7 +7517,7 @@ const Ki = {
|
|
|
7404
7517
|
return ["span", e, 0];
|
|
7405
7518
|
}
|
|
7406
7519
|
}), tn = K(en, "string"), dt = (e) => ({ url: e.src || void 0 }), on = {
|
|
7407
|
-
backgroundColor:
|
|
7520
|
+
backgroundColor: C.backgroundColor,
|
|
7408
7521
|
// File name.
|
|
7409
7522
|
name: {
|
|
7410
7523
|
default: ""
|
|
@@ -7471,7 +7584,7 @@ const Ki = {
|
|
|
7471
7584
|
else if (!r.isBlockContainer && s.isInGroup("bnBlock"))
|
|
7472
7585
|
ct(o, i, e, r);
|
|
7473
7586
|
else {
|
|
7474
|
-
const d =
|
|
7587
|
+
const d = w(
|
|
7475
7588
|
r.bnBlock.node,
|
|
7476
7589
|
e.schema.blockSchema,
|
|
7477
7590
|
e.schema.inlineContentSchema,
|
|
@@ -7481,7 +7594,7 @@ const Ki = {
|
|
|
7481
7594
|
return i.tr.replaceWith(
|
|
7482
7595
|
r.bnBlock.beforePos,
|
|
7483
7596
|
r.bnBlock.afterPos,
|
|
7484
|
-
|
|
7597
|
+
J(
|
|
7485
7598
|
{
|
|
7486
7599
|
children: d.children,
|
|
7487
7600
|
// if no children are passed in, use existing children
|
|
@@ -7503,14 +7616,14 @@ function dn(e, t, o, i, n, r) {
|
|
|
7503
7616
|
let a = "keep";
|
|
7504
7617
|
if (e.content)
|
|
7505
7618
|
if (typeof e.content == "string")
|
|
7506
|
-
a =
|
|
7619
|
+
a = H(
|
|
7507
7620
|
[e.content],
|
|
7508
7621
|
t.schema,
|
|
7509
7622
|
o.schema.styleSchema,
|
|
7510
7623
|
n.name
|
|
7511
7624
|
);
|
|
7512
7625
|
else if (Array.isArray(e.content))
|
|
7513
|
-
a =
|
|
7626
|
+
a = H(
|
|
7514
7627
|
e.content,
|
|
7515
7628
|
t.schema,
|
|
7516
7629
|
o.schema.styleSchema,
|
|
@@ -7547,7 +7660,7 @@ function dn(e, t, o, i, n, r) {
|
|
|
7547
7660
|
}
|
|
7548
7661
|
function ct(e, t, o, i) {
|
|
7549
7662
|
if (e.children !== void 0) {
|
|
7550
|
-
const n = e.children.map((r) =>
|
|
7663
|
+
const n = e.children.map((r) => J(r, t.schema, o.schema.styleSchema));
|
|
7551
7664
|
if (i.childContainer)
|
|
7552
7665
|
t.tr.step(
|
|
7553
7666
|
new Oo(
|
|
@@ -7576,7 +7689,7 @@ function cn(e, t, o) {
|
|
|
7576
7689
|
o
|
|
7577
7690
|
)({ state: s, dispatch: l }), !0));
|
|
7578
7691
|
const a = i.state.doc.resolve(r.posBeforeNode + 1).node();
|
|
7579
|
-
return
|
|
7692
|
+
return w(
|
|
7580
7693
|
a,
|
|
7581
7694
|
e.schema.blockSchema,
|
|
7582
7695
|
e.schema.inlineContentSchema,
|
|
@@ -7584,19 +7697,19 @@ function cn(e, t, o) {
|
|
|
7584
7697
|
e.blockCache
|
|
7585
7698
|
);
|
|
7586
7699
|
}
|
|
7587
|
-
const
|
|
7588
|
-
...
|
|
7700
|
+
const Ft = {
|
|
7701
|
+
...C,
|
|
7589
7702
|
level: { default: 1, values: [1, 2, 3] }
|
|
7590
7703
|
}, un = $({
|
|
7591
7704
|
name: "heading",
|
|
7592
7705
|
content: "inline*",
|
|
7593
7706
|
group: "blockContent",
|
|
7594
7707
|
addAttributes() {
|
|
7595
|
-
return he(
|
|
7708
|
+
return he(Ft);
|
|
7596
7709
|
},
|
|
7597
7710
|
addInputRules() {
|
|
7598
7711
|
return [
|
|
7599
|
-
...[1, 2, 3].map((e) => new
|
|
7712
|
+
...[1, 2, 3].map((e) => new oe({
|
|
7600
7713
|
find: new RegExp(`^(#{${e}})\\s$`),
|
|
7601
7714
|
handler: ({ state: t, chain: o, range: i }) => {
|
|
7602
7715
|
const n = _(t);
|
|
@@ -7689,8 +7802,8 @@ const zt = {
|
|
|
7689
7802
|
}
|
|
7690
7803
|
}), pn = W(
|
|
7691
7804
|
un,
|
|
7692
|
-
|
|
7693
|
-
),
|
|
7805
|
+
Ft
|
|
7806
|
+
), Gt = (e, t, o, i, n, r) => {
|
|
7694
7807
|
const { dom: a, destroy: s } = $e(
|
|
7695
7808
|
e,
|
|
7696
7809
|
t,
|
|
@@ -7727,7 +7840,7 @@ const zt = {
|
|
|
7727
7840
|
initialWidth: l.clientWidth,
|
|
7728
7841
|
initialClientX: y.clientX
|
|
7729
7842
|
};
|
|
7730
|
-
},
|
|
7843
|
+
}, v = (y) => {
|
|
7731
7844
|
y.preventDefault(), u = {
|
|
7732
7845
|
handleUsed: "right",
|
|
7733
7846
|
initialWidth: l.clientWidth,
|
|
@@ -7739,7 +7852,7 @@ const zt = {
|
|
|
7739
7852
|
k
|
|
7740
7853
|
), c.addEventListener(
|
|
7741
7854
|
"mousedown",
|
|
7742
|
-
|
|
7855
|
+
v
|
|
7743
7856
|
), {
|
|
7744
7857
|
dom: l,
|
|
7745
7858
|
destroy: () => {
|
|
@@ -7748,7 +7861,7 @@ const zt = {
|
|
|
7748
7861
|
k
|
|
7749
7862
|
), c.removeEventListener(
|
|
7750
7863
|
"mousedown",
|
|
7751
|
-
|
|
7864
|
+
v
|
|
7752
7865
|
);
|
|
7753
7866
|
}
|
|
7754
7867
|
};
|
|
@@ -7756,8 +7869,8 @@ const zt = {
|
|
|
7756
7869
|
const t = e.src || void 0, o = e.width || void 0;
|
|
7757
7870
|
return { url: t, previewWidth: o };
|
|
7758
7871
|
}, hn = '<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>', mn = {
|
|
7759
|
-
textAlignment:
|
|
7760
|
-
backgroundColor:
|
|
7872
|
+
textAlignment: C.textAlignment,
|
|
7873
|
+
backgroundColor: C.backgroundColor,
|
|
7761
7874
|
// File name.
|
|
7762
7875
|
name: {
|
|
7763
7876
|
default: ""
|
|
@@ -7791,7 +7904,7 @@ const zt = {
|
|
|
7791
7904
|
const n = document.createElement("img");
|
|
7792
7905
|
return n.className = "bn-visual-media", t.resolveFileUrl ? t.resolveFileUrl(e.props.url).then((r) => {
|
|
7793
7906
|
n.src = r;
|
|
7794
|
-
}) : n.src = e.props.url, n.alt = e.props.name || e.props.caption || "BlockNote image", n.contentEditable = "false", n.draggable = !1, i.appendChild(n),
|
|
7907
|
+
}) : n.src = e.props.url, n.alt = e.props.name || e.props.caption || "BlockNote image", n.contentEditable = "false", n.draggable = !1, i.appendChild(n), Gt(
|
|
7795
7908
|
e,
|
|
7796
7909
|
t,
|
|
7797
7910
|
{ dom: i },
|
|
@@ -7827,7 +7940,7 @@ const zt = {
|
|
|
7827
7940
|
render: gn,
|
|
7828
7941
|
parse: bn,
|
|
7829
7942
|
toExternalHTML: kn
|
|
7830
|
-
}),
|
|
7943
|
+
}), $t = (e, t, o) => ({
|
|
7831
7944
|
state: i,
|
|
7832
7945
|
dispatch: n
|
|
7833
7946
|
}) => {
|
|
@@ -7866,11 +7979,11 @@ const zt = {
|
|
|
7866
7979
|
() => (
|
|
7867
7980
|
// Splits the current block, moving content inside that's after the cursor
|
|
7868
7981
|
// to a new block of the same type below.
|
|
7869
|
-
l.command(() => n.node.childCount > 0 ? (s().deleteSelection().command(
|
|
7982
|
+
l.command(() => n.node.childCount > 0 ? (s().deleteSelection().command($t(a.selection.from, !0)).run(), !0) : !1)
|
|
7870
7983
|
)
|
|
7871
7984
|
]);
|
|
7872
7985
|
}, yn = {
|
|
7873
|
-
...
|
|
7986
|
+
...C
|
|
7874
7987
|
}, vn = $({
|
|
7875
7988
|
name: "bulletListItem",
|
|
7876
7989
|
content: "inline*",
|
|
@@ -7881,7 +7994,7 @@ const zt = {
|
|
|
7881
7994
|
addInputRules() {
|
|
7882
7995
|
return [
|
|
7883
7996
|
// Creates an unordered list when starting with "-", "+", or "*".
|
|
7884
|
-
new
|
|
7997
|
+
new oe({
|
|
7885
7998
|
find: new RegExp("^[-+*]\\s$"),
|
|
7886
7999
|
handler: ({ state: e, chain: t, range: o }) => {
|
|
7887
8000
|
const i = _(e);
|
|
@@ -7961,8 +8074,8 @@ const zt = {
|
|
|
7961
8074
|
}), wn = W(
|
|
7962
8075
|
vn,
|
|
7963
8076
|
yn
|
|
7964
|
-
),
|
|
7965
|
-
...
|
|
8077
|
+
), Wt = {
|
|
8078
|
+
...C,
|
|
7966
8079
|
checked: {
|
|
7967
8080
|
default: !1
|
|
7968
8081
|
}
|
|
@@ -7971,12 +8084,12 @@ const zt = {
|
|
|
7971
8084
|
content: "inline*",
|
|
7972
8085
|
group: "blockContent",
|
|
7973
8086
|
addAttributes() {
|
|
7974
|
-
return he(
|
|
8087
|
+
return he(Wt);
|
|
7975
8088
|
},
|
|
7976
8089
|
addInputRules() {
|
|
7977
8090
|
return [
|
|
7978
8091
|
// Creates a checklist when starting with "[]" or "[X]".
|
|
7979
|
-
new
|
|
8092
|
+
new oe({
|
|
7980
8093
|
find: new RegExp("\\[\\s*\\]\\s$"),
|
|
7981
8094
|
handler: ({ state: e, chain: t, range: o }) => {
|
|
7982
8095
|
const i = _(e);
|
|
@@ -7994,7 +8107,7 @@ const zt = {
|
|
|
7994
8107
|
).deleteRange({ from: o.from, to: o.to });
|
|
7995
8108
|
}
|
|
7996
8109
|
}),
|
|
7997
|
-
new
|
|
8110
|
+
new oe({
|
|
7998
8111
|
find: new RegExp("\\[[Xx]\\]\\s$"),
|
|
7999
8112
|
handler: ({ state: e, chain: t, range: o }) => {
|
|
8000
8113
|
const i = _(e);
|
|
@@ -8142,7 +8255,7 @@ const zt = {
|
|
|
8142
8255
|
}
|
|
8143
8256
|
}), Cn = W(
|
|
8144
8257
|
xn,
|
|
8145
|
-
|
|
8258
|
+
Wt
|
|
8146
8259
|
), En = new N("numbered-list-indexing"), Sn = () => new B({
|
|
8147
8260
|
key: En,
|
|
8148
8261
|
appendTransaction: (e, t, o) => {
|
|
@@ -8189,8 +8302,8 @@ const zt = {
|
|
|
8189
8302
|
}
|
|
8190
8303
|
}), n ? i : null;
|
|
8191
8304
|
}
|
|
8192
|
-
}),
|
|
8193
|
-
...
|
|
8305
|
+
}), Kt = {
|
|
8306
|
+
...C,
|
|
8194
8307
|
start: { default: void 0, type: "number" }
|
|
8195
8308
|
}, Bn = $({
|
|
8196
8309
|
name: "numberedListItem",
|
|
@@ -8199,7 +8312,7 @@ const zt = {
|
|
|
8199
8312
|
priority: 90,
|
|
8200
8313
|
addAttributes() {
|
|
8201
8314
|
return {
|
|
8202
|
-
...he(
|
|
8315
|
+
...he(Kt),
|
|
8203
8316
|
// the index attribute is only used internally (it's not part of the blocknote schema)
|
|
8204
8317
|
// that's why it's defined explicitly here, and not part of the prop schema
|
|
8205
8318
|
index: {
|
|
@@ -8214,7 +8327,7 @@ const zt = {
|
|
|
8214
8327
|
addInputRules() {
|
|
8215
8328
|
return [
|
|
8216
8329
|
// Creates an ordered list when starting with "1.".
|
|
8217
|
-
new
|
|
8330
|
+
new oe({
|
|
8218
8331
|
find: new RegExp("^(\\d+)\\.\\s$"),
|
|
8219
8332
|
handler: ({ state: e, chain: t, range: o, match: i }) => {
|
|
8220
8333
|
const n = _(e);
|
|
@@ -8311,9 +8424,9 @@ const zt = {
|
|
|
8311
8424
|
}
|
|
8312
8425
|
}), Tn = W(
|
|
8313
8426
|
Bn,
|
|
8314
|
-
|
|
8427
|
+
Kt
|
|
8315
8428
|
), Mn = {
|
|
8316
|
-
...
|
|
8429
|
+
...C
|
|
8317
8430
|
}, In = $({
|
|
8318
8431
|
name: "paragraph",
|
|
8319
8432
|
content: "inline*",
|
|
@@ -8360,12 +8473,12 @@ const zt = {
|
|
|
8360
8473
|
}), Ln = W(
|
|
8361
8474
|
In,
|
|
8362
8475
|
Mn
|
|
8363
|
-
), An = 35,
|
|
8476
|
+
), An = 35, qt = 120, ps = 31, Pn = L.create({
|
|
8364
8477
|
name: "BlockNoteTableExtension",
|
|
8365
8478
|
addProseMirrorPlugins: () => [
|
|
8366
8479
|
Fo({
|
|
8367
8480
|
cellMinWidth: An,
|
|
8368
|
-
defaultCellMinWidth:
|
|
8481
|
+
defaultCellMinWidth: qt,
|
|
8369
8482
|
// We set this to null as we implement our own node view in the table
|
|
8370
8483
|
// block content. This node view is the same as what's used by default,
|
|
8371
8484
|
// but is wrapped in a `blockContent` HTML element.
|
|
@@ -8399,13 +8512,13 @@ const zt = {
|
|
|
8399
8512
|
storage: e.storage
|
|
8400
8513
|
};
|
|
8401
8514
|
return {
|
|
8402
|
-
tableRole:
|
|
8403
|
-
|
|
8515
|
+
tableRole: xo(
|
|
8516
|
+
Co(e, "tableRole", t)
|
|
8404
8517
|
)
|
|
8405
8518
|
};
|
|
8406
8519
|
}
|
|
8407
8520
|
}), Nn = {
|
|
8408
|
-
textColor:
|
|
8521
|
+
textColor: C.textColor
|
|
8409
8522
|
}, jn = $({
|
|
8410
8523
|
name: "table",
|
|
8411
8524
|
content: "tableRow+",
|
|
@@ -8458,13 +8571,13 @@ const zt = {
|
|
|
8458
8571
|
return !r.target.closest(".tableWrapper-inner") || super.ignoreMutation(r);
|
|
8459
8572
|
}
|
|
8460
8573
|
}
|
|
8461
|
-
return new o(e,
|
|
8574
|
+
return new o(e, qt, {
|
|
8462
8575
|
...((i = this.options.domAttributes) == null ? void 0 : i.blockContent) || {},
|
|
8463
8576
|
...t
|
|
8464
8577
|
});
|
|
8465
8578
|
};
|
|
8466
8579
|
}
|
|
8467
|
-
}), Dn =
|
|
8580
|
+
}), Dn = Z.create({
|
|
8468
8581
|
name: "tableParagraph",
|
|
8469
8582
|
group: "tableContent",
|
|
8470
8583
|
content: "inline*",
|
|
@@ -8493,7 +8606,7 @@ const zt = {
|
|
|
8493
8606
|
renderHTML({ HTMLAttributes: e }) {
|
|
8494
8607
|
return ["p", e, 0];
|
|
8495
8608
|
}
|
|
8496
|
-
}),
|
|
8609
|
+
}), Hn = W(
|
|
8497
8610
|
jn,
|
|
8498
8611
|
Nn,
|
|
8499
8612
|
[
|
|
@@ -8510,9 +8623,9 @@ const zt = {
|
|
|
8510
8623
|
), pt = (e) => {
|
|
8511
8624
|
const t = e.src || void 0, o = e.width || void 0;
|
|
8512
8625
|
return { url: t, previewWidth: o };
|
|
8513
|
-
},
|
|
8514
|
-
textAlignment:
|
|
8515
|
-
backgroundColor:
|
|
8626
|
+
}, Un = '<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>', On = {
|
|
8627
|
+
textAlignment: C.textAlignment,
|
|
8628
|
+
backgroundColor: C.backgroundColor,
|
|
8516
8629
|
// File name.
|
|
8517
8630
|
name: {
|
|
8518
8631
|
default: ""
|
|
@@ -8540,13 +8653,13 @@ const zt = {
|
|
|
8540
8653
|
fileBlockAccept: ["video/*"]
|
|
8541
8654
|
}, Vn = (e, t) => {
|
|
8542
8655
|
const o = document.createElement("div");
|
|
8543
|
-
o.innerHTML =
|
|
8656
|
+
o.innerHTML = Un;
|
|
8544
8657
|
const i = document.createElement("div");
|
|
8545
8658
|
i.className = "bn-visual-media-wrapper";
|
|
8546
8659
|
const n = document.createElement("video");
|
|
8547
8660
|
return n.className = "bn-visual-media", t.resolveFileUrl ? t.resolveFileUrl(e.props.url).then((r) => {
|
|
8548
8661
|
n.src = r;
|
|
8549
|
-
}) : n.src = e.props.url, n.controls = !0, n.contentEditable = "false", n.draggable = !1, n.width = e.props.previewWidth, i.appendChild(n),
|
|
8662
|
+
}) : n.src = e.props.url, n.controls = !0, n.contentEditable = "false", n.draggable = !1, n.width = e.props.previewWidth, i.appendChild(n), Gt(
|
|
8550
8663
|
e,
|
|
8551
8664
|
t,
|
|
8552
8665
|
{ dom: i },
|
|
@@ -8582,31 +8695,31 @@ const zt = {
|
|
|
8582
8695
|
render: Vn,
|
|
8583
8696
|
parse: zn,
|
|
8584
8697
|
toExternalHTML: Fn
|
|
8585
|
-
}),
|
|
8698
|
+
}), Xt = {
|
|
8586
8699
|
paragraph: Ln,
|
|
8587
8700
|
heading: pn,
|
|
8588
8701
|
codeBlock: Wi,
|
|
8589
8702
|
bulletListItem: wn,
|
|
8590
8703
|
numberedListItem: Tn,
|
|
8591
8704
|
checkListItem: Cn,
|
|
8592
|
-
table:
|
|
8705
|
+
table: Hn,
|
|
8593
8706
|
file: ln,
|
|
8594
8707
|
image: _n,
|
|
8595
8708
|
video: Gn,
|
|
8596
8709
|
audio: $i
|
|
8597
|
-
}, $n =
|
|
8710
|
+
}, $n = Dt(Xt), Zt = {
|
|
8598
8711
|
bold: K(No, "boolean"),
|
|
8599
8712
|
italic: K(Do, "boolean"),
|
|
8600
|
-
underline: K(
|
|
8601
|
-
strike: K(
|
|
8713
|
+
underline: K(Uo, "boolean"),
|
|
8714
|
+
strike: K(Ho, "boolean"),
|
|
8602
8715
|
code: K(jo, "boolean"),
|
|
8603
8716
|
textColor: tn,
|
|
8604
8717
|
backgroundColor: Qi
|
|
8605
|
-
}, hs =
|
|
8718
|
+
}, hs = Rt(Zt), Jt = {
|
|
8606
8719
|
text: { config: "text", implementation: {} },
|
|
8607
8720
|
link: { config: "link", implementation: {} }
|
|
8608
8721
|
}, Wn = Ut(
|
|
8609
|
-
|
|
8722
|
+
Jt
|
|
8610
8723
|
);
|
|
8611
8724
|
function I(e, t) {
|
|
8612
8725
|
return e in t.schema.blockSchema && t.schema.blockSchema[e] === $n[e];
|
|
@@ -8627,7 +8740,7 @@ function gs(e, t) {
|
|
|
8627
8740
|
return t.schema.blockSchema[e.type].isFileBlock && !e.props.url;
|
|
8628
8741
|
}
|
|
8629
8742
|
function Xn(e, t, o) {
|
|
8630
|
-
return t in o.schema.blockSchema && e in o.schema.blockSchema[t].propSchema && o.schema.blockSchema[t].propSchema[e] ===
|
|
8743
|
+
return t in o.schema.blockSchema && e in o.schema.blockSchema[t].propSchema && o.schema.blockSchema[t].propSchema[e] === C[e];
|
|
8631
8744
|
}
|
|
8632
8745
|
function bs(e, t, o) {
|
|
8633
8746
|
return Xn(e, t.type, o);
|
|
@@ -8832,28 +8945,28 @@ class fe {
|
|
|
8832
8945
|
p(this, "BlockNoteEditor", "only for types");
|
|
8833
8946
|
p(this, "Block", "only for types");
|
|
8834
8947
|
p(this, "PartialBlock", "only for types");
|
|
8835
|
-
this.blockSpecs = Le(t == null ? void 0 : t.blockSpecs) ||
|
|
8948
|
+
this.blockSpecs = Le(t == null ? void 0 : t.blockSpecs) || Xt, this.inlineContentSpecs = Le(t == null ? void 0 : t.inlineContentSpecs) || Jt, this.styleSpecs = Le(t == null ? void 0 : t.styleSpecs) || Zt, this.blockSchema = Dt(this.blockSpecs), this.inlineContentSchema = Ut(
|
|
8836
8949
|
this.inlineContentSpecs
|
|
8837
|
-
), this.styleSchema =
|
|
8950
|
+
), this.styleSchema = Rt(this.styleSpecs);
|
|
8838
8951
|
}
|
|
8839
8952
|
static create(t) {
|
|
8840
8953
|
return new fe(t);
|
|
8841
8954
|
}
|
|
8842
8955
|
}
|
|
8843
|
-
const
|
|
8956
|
+
const Yt = fe.create({
|
|
8844
8957
|
blockSpecs: {
|
|
8845
8958
|
pageBreak: Ji
|
|
8846
8959
|
}
|
|
8847
8960
|
}), ys = (e) => fe.create({
|
|
8848
8961
|
blockSpecs: {
|
|
8849
8962
|
...e.blockSpecs,
|
|
8850
|
-
...
|
|
8963
|
+
...Yt.blockSpecs
|
|
8851
8964
|
},
|
|
8852
8965
|
inlineContentSpecs: e.inlineContentSpecs,
|
|
8853
8966
|
styleSpecs: e.styleSpecs
|
|
8854
8967
|
});
|
|
8855
8968
|
function Jn(e) {
|
|
8856
|
-
return "pageBreak" in e.schema.blockSchema && e.schema.blockSchema.pageBreak ===
|
|
8969
|
+
return "pageBreak" in e.schema.blockSchema && e.schema.blockSchema.pageBreak === Yt.blockSchema.pageBreak;
|
|
8857
8970
|
}
|
|
8858
8971
|
function vs(e) {
|
|
8859
8972
|
const t = [];
|
|
@@ -8881,7 +8994,7 @@ function Yn(e, t, o, i = "before") {
|
|
|
8881
8994
|
const n = typeof o == "string" ? o : o.id, r = [];
|
|
8882
8995
|
for (const l of t)
|
|
8883
8996
|
r.push(
|
|
8884
|
-
|
|
8997
|
+
J(l, e.pmSchema, e.schema.styleSchema)
|
|
8885
8998
|
);
|
|
8886
8999
|
const a = A(n, e._tiptapEditor.state.doc);
|
|
8887
9000
|
if (!a)
|
|
@@ -8897,7 +9010,7 @@ function Yn(e, t, o, i = "before") {
|
|
|
8897
9010
|
const s = [];
|
|
8898
9011
|
for (const l of r)
|
|
8899
9012
|
s.push(
|
|
8900
|
-
|
|
9013
|
+
w(
|
|
8901
9014
|
l,
|
|
8902
9015
|
e.schema.blockSchema,
|
|
8903
9016
|
e.schema.inlineContentSchema,
|
|
@@ -8963,7 +9076,7 @@ function er(e, t) {
|
|
|
8963
9076
|
throw new Error(
|
|
8964
9077
|
`Could not find block with ID ${t.headBlockId} to update selection`
|
|
8965
9078
|
);
|
|
8966
|
-
i =
|
|
9079
|
+
i = U.create(
|
|
8967
9080
|
e._tiptapEditor.state.doc,
|
|
8968
9081
|
o + t.anchorOffset,
|
|
8969
9082
|
a + t.headOffset
|
|
@@ -8977,57 +9090,57 @@ function Re(e) {
|
|
|
8977
9090
|
children: Re(t.children)
|
|
8978
9091
|
}).flat();
|
|
8979
9092
|
}
|
|
8980
|
-
function
|
|
9093
|
+
function Qt(e, t, o) {
|
|
8981
9094
|
var r;
|
|
8982
9095
|
const i = ((r = e.getSelection()) == null ? void 0 : r.blocks) || [
|
|
8983
9096
|
e.getTextCursorPosition().block
|
|
8984
9097
|
], n = Qn(e);
|
|
8985
9098
|
e.removeBlocks(i), e.insertBlocks(Re(i), t, o), er(e, n);
|
|
8986
9099
|
}
|
|
8987
|
-
function
|
|
9100
|
+
function eo(e) {
|
|
8988
9101
|
return !e || e.type !== "columnList";
|
|
8989
9102
|
}
|
|
8990
|
-
function
|
|
9103
|
+
function to(e, t, o) {
|
|
8991
9104
|
let i, n;
|
|
8992
9105
|
if (t ? t.children.length > 0 ? (i = t.children[t.children.length - 1], n = "after") : (i = t, n = "before") : o && (i = o, n = "before"), !i || !n)
|
|
8993
9106
|
return;
|
|
8994
9107
|
const r = e.getParentBlock(i);
|
|
8995
|
-
return
|
|
9108
|
+
return eo(r) ? { referenceBlock: i, placement: n } : to(
|
|
8996
9109
|
e,
|
|
8997
9110
|
n === "after" ? i : e.getPrevBlock(i),
|
|
8998
9111
|
r
|
|
8999
9112
|
);
|
|
9000
9113
|
}
|
|
9001
|
-
function
|
|
9114
|
+
function oo(e, t, o) {
|
|
9002
9115
|
let i, n;
|
|
9003
9116
|
if (t ? t.children.length > 0 ? (i = t.children[0], n = "before") : (i = t, n = "after") : o && (i = o, n = "after"), !i || !n)
|
|
9004
9117
|
return;
|
|
9005
9118
|
const r = e.getParentBlock(i);
|
|
9006
|
-
return
|
|
9119
|
+
return eo(r) ? { referenceBlock: i, placement: n } : oo(
|
|
9007
9120
|
e,
|
|
9008
9121
|
n === "before" ? i : e.getNextBlock(i),
|
|
9009
9122
|
r
|
|
9010
9123
|
);
|
|
9011
9124
|
}
|
|
9012
9125
|
function tr(e) {
|
|
9013
|
-
const t = e.getSelection(), o = (t == null ? void 0 : t.blocks[0]) || e.getTextCursorPosition().block, i =
|
|
9126
|
+
const t = e.getSelection(), o = (t == null ? void 0 : t.blocks[0]) || e.getTextCursorPosition().block, i = to(
|
|
9014
9127
|
e,
|
|
9015
9128
|
e.getPrevBlock(o),
|
|
9016
9129
|
e.getParentBlock(o)
|
|
9017
9130
|
);
|
|
9018
|
-
i &&
|
|
9131
|
+
i && Qt(
|
|
9019
9132
|
e,
|
|
9020
9133
|
i.referenceBlock,
|
|
9021
9134
|
i.placement
|
|
9022
9135
|
);
|
|
9023
9136
|
}
|
|
9024
9137
|
function or(e) {
|
|
9025
|
-
const t = e.getSelection(), o = (t == null ? void 0 : t.blocks[(t == null ? void 0 : t.blocks.length) - 1]) || e.getTextCursorPosition().block, i =
|
|
9138
|
+
const t = e.getSelection(), o = (t == null ? void 0 : t.blocks[(t == null ? void 0 : t.blocks.length) - 1]) || e.getTextCursorPosition().block, i = oo(
|
|
9026
9139
|
e,
|
|
9027
9140
|
e.getNextBlock(o),
|
|
9028
9141
|
e.getParentBlock(o)
|
|
9029
9142
|
);
|
|
9030
|
-
i &&
|
|
9143
|
+
i && Qt(
|
|
9031
9144
|
e,
|
|
9032
9145
|
i.referenceBlock,
|
|
9033
9146
|
i.placement
|
|
@@ -9074,7 +9187,7 @@ function ir(e, t) {
|
|
|
9074
9187
|
return !0;
|
|
9075
9188
|
};
|
|
9076
9189
|
}
|
|
9077
|
-
function
|
|
9190
|
+
function io(e) {
|
|
9078
9191
|
return e._tiptapEditor.commands.command(
|
|
9079
9192
|
ir(
|
|
9080
9193
|
e._tiptapEditor.schema.nodes.blockContainer,
|
|
@@ -9097,13 +9210,13 @@ function ar(e) {
|
|
|
9097
9210
|
);
|
|
9098
9211
|
return e._tiptapEditor.state.doc.resolve(t.beforePos).depth > 1;
|
|
9099
9212
|
}
|
|
9100
|
-
function
|
|
9213
|
+
function no(e, t, o) {
|
|
9101
9214
|
const i = e._tiptapEditor;
|
|
9102
9215
|
let n = i.state.tr;
|
|
9103
9216
|
const r = [];
|
|
9104
9217
|
for (const u of o)
|
|
9105
9218
|
r.push(
|
|
9106
|
-
|
|
9219
|
+
J(u, e.pmSchema, e.schema.styleSchema)
|
|
9107
9220
|
);
|
|
9108
9221
|
const a = new Set(
|
|
9109
9222
|
t.map(
|
|
@@ -9117,7 +9230,7 @@ function io(e, t, o) {
|
|
|
9117
9230
|
if (!u.type.isInGroup("bnBlock") || !a.has(u.attrs.id))
|
|
9118
9231
|
return !0;
|
|
9119
9232
|
if (s.push(
|
|
9120
|
-
|
|
9233
|
+
w(
|
|
9121
9234
|
u,
|
|
9122
9235
|
e.schema.blockSchema,
|
|
9123
9236
|
e.schema.inlineContentSchema,
|
|
@@ -9145,7 +9258,7 @@ function io(e, t, o) {
|
|
|
9145
9258
|
const c = [];
|
|
9146
9259
|
for (const u of r)
|
|
9147
9260
|
c.push(
|
|
9148
|
-
|
|
9261
|
+
w(
|
|
9149
9262
|
u,
|
|
9150
9263
|
e.schema.blockSchema,
|
|
9151
9264
|
e.schema.inlineContentSchema,
|
|
@@ -9156,15 +9269,15 @@ function io(e, t, o) {
|
|
|
9156
9269
|
return { insertedBlocks: c, removedBlocks: s };
|
|
9157
9270
|
}
|
|
9158
9271
|
function sr(e, t, o) {
|
|
9159
|
-
return
|
|
9272
|
+
return no(e, t, o);
|
|
9160
9273
|
}
|
|
9161
9274
|
function lr(e, t) {
|
|
9162
|
-
return
|
|
9275
|
+
return no(e, t, []).removedBlocks;
|
|
9163
9276
|
}
|
|
9164
9277
|
function dr(e, t) {
|
|
9165
9278
|
const o = typeof t == "string" ? t : t.id, i = A(o, e._tiptapEditor.state.doc);
|
|
9166
9279
|
if (i)
|
|
9167
|
-
return
|
|
9280
|
+
return w(
|
|
9168
9281
|
i.node,
|
|
9169
9282
|
e.schema.blockSchema,
|
|
9170
9283
|
e.schema.inlineContentSchema,
|
|
@@ -9180,7 +9293,7 @@ function cr(e, t) {
|
|
|
9180
9293
|
i.posBeforeNode
|
|
9181
9294
|
).nodeBefore;
|
|
9182
9295
|
if (r)
|
|
9183
|
-
return
|
|
9296
|
+
return w(
|
|
9184
9297
|
r,
|
|
9185
9298
|
e.schema.blockSchema,
|
|
9186
9299
|
e.schema.inlineContentSchema,
|
|
@@ -9196,7 +9309,7 @@ function ur(e, t) {
|
|
|
9196
9309
|
i.posBeforeNode + i.node.nodeSize
|
|
9197
9310
|
).nodeAfter;
|
|
9198
9311
|
if (r)
|
|
9199
|
-
return
|
|
9312
|
+
return w(
|
|
9200
9313
|
r,
|
|
9201
9314
|
e.schema.blockSchema,
|
|
9202
9315
|
e.schema.inlineContentSchema,
|
|
@@ -9212,7 +9325,7 @@ function pr(e, t) {
|
|
|
9212
9325
|
i.posBeforeNode
|
|
9213
9326
|
), r = n.node(), a = n.node(-1), s = a.type.name !== "doc" ? r.type.name === "blockGroup" ? a : r : void 0;
|
|
9214
9327
|
if (s)
|
|
9215
|
-
return
|
|
9328
|
+
return w(
|
|
9216
9329
|
s,
|
|
9217
9330
|
e.schema.blockSchema,
|
|
9218
9331
|
e.schema.inlineContentSchema,
|
|
@@ -9229,7 +9342,7 @@ function hr(e, t, o, i = { updateSelection: !0 }) {
|
|
|
9229
9342
|
const { parent: c } = n.doc.resolve(r);
|
|
9230
9343
|
c.isTextblock && !c.type.spec.code && !c.childCount && (r -= 1, a += 1);
|
|
9231
9344
|
}
|
|
9232
|
-
return s ? n.insertText(d, r, a) : n.replaceWith(r, a, t), i.updateSelection &&
|
|
9345
|
+
return s ? n.insertText(d, r, a) : n.replaceWith(r, a, t), i.updateSelection && Eo(n, n.steps.length - 1, -1), o.dispatch(n), !0;
|
|
9233
9346
|
}
|
|
9234
9347
|
function mr(e) {
|
|
9235
9348
|
const t = e._tiptapEditor.state;
|
|
@@ -9245,7 +9358,7 @@ function mr(e) {
|
|
|
9245
9358
|
throw new Error(
|
|
9246
9359
|
`Error getting selection - node not found at position ${u}`
|
|
9247
9360
|
);
|
|
9248
|
-
return
|
|
9361
|
+
return w(
|
|
9249
9362
|
h,
|
|
9250
9363
|
e.schema.blockSchema,
|
|
9251
9364
|
e.schema.inlineContentSchema,
|
|
@@ -9255,7 +9368,7 @@ function mr(e) {
|
|
|
9255
9368
|
}, r = [], a = o.sharedDepth(i.pos), s = o.index(a), l = i.index(a);
|
|
9256
9369
|
if (o.depth > a) {
|
|
9257
9370
|
r.push(
|
|
9258
|
-
|
|
9371
|
+
w(
|
|
9259
9372
|
o.nodeAfter,
|
|
9260
9373
|
e.schema.blockSchema,
|
|
9261
9374
|
e.schema.inlineContentSchema,
|
|
@@ -9319,7 +9432,7 @@ function fr(e, t, o) {
|
|
|
9319
9432
|
m = d.blockContent.afterPos - 1;
|
|
9320
9433
|
e._tiptapEditor.dispatch(
|
|
9321
9434
|
e._tiptapEditor.state.tr.setSelection(
|
|
9322
|
-
|
|
9435
|
+
U.create(e._tiptapEditor.state.doc, h, m)
|
|
9323
9436
|
)
|
|
9324
9437
|
);
|
|
9325
9438
|
}
|
|
@@ -9329,28 +9442,28 @@ function gr(e) {
|
|
|
9329
9442
|
).nodeAfter;
|
|
9330
9443
|
let r;
|
|
9331
9444
|
return o.depth > 1 && (r = o.node(), r.type.isInGroup("bnBlock") || (r = o.node(o.depth - 1))), {
|
|
9332
|
-
block:
|
|
9445
|
+
block: w(
|
|
9333
9446
|
t.node,
|
|
9334
9447
|
e.schema.blockSchema,
|
|
9335
9448
|
e.schema.inlineContentSchema,
|
|
9336
9449
|
e.schema.styleSchema,
|
|
9337
9450
|
e.blockCache
|
|
9338
9451
|
),
|
|
9339
|
-
prevBlock: i === null ? void 0 :
|
|
9452
|
+
prevBlock: i === null ? void 0 : w(
|
|
9340
9453
|
i,
|
|
9341
9454
|
e.schema.blockSchema,
|
|
9342
9455
|
e.schema.inlineContentSchema,
|
|
9343
9456
|
e.schema.styleSchema,
|
|
9344
9457
|
e.blockCache
|
|
9345
9458
|
),
|
|
9346
|
-
nextBlock: n === null ? void 0 :
|
|
9459
|
+
nextBlock: n === null ? void 0 : w(
|
|
9347
9460
|
n,
|
|
9348
9461
|
e.schema.blockSchema,
|
|
9349
9462
|
e.schema.inlineContentSchema,
|
|
9350
9463
|
e.schema.styleSchema,
|
|
9351
9464
|
e.blockCache
|
|
9352
9465
|
),
|
|
9353
|
-
parentBlock: r === void 0 ? void 0 :
|
|
9466
|
+
parentBlock: r === void 0 ? void 0 : w(
|
|
9354
9467
|
r,
|
|
9355
9468
|
e.schema.blockSchema,
|
|
9356
9469
|
e.schema.inlineContentSchema,
|
|
@@ -9359,7 +9472,7 @@ function gr(e) {
|
|
|
9359
9472
|
)
|
|
9360
9473
|
};
|
|
9361
9474
|
}
|
|
9362
|
-
function
|
|
9475
|
+
function ro(e, t, o = "start") {
|
|
9363
9476
|
const i = typeof t == "string" ? t : t.id, n = A(i, e._tiptapEditor.state.doc);
|
|
9364
9477
|
if (!n)
|
|
9365
9478
|
throw new Error(`Block with ID ${i} not found`);
|
|
@@ -9386,13 +9499,13 @@ function no(e, t, o = "start") {
|
|
|
9386
9499
|
throw new D(a);
|
|
9387
9500
|
} else {
|
|
9388
9501
|
const s = o === "start" ? r.childContainer.node.firstChild : r.childContainer.node.lastChild;
|
|
9389
|
-
|
|
9502
|
+
ro(e, s.attrs.id, o);
|
|
9390
9503
|
}
|
|
9391
9504
|
}
|
|
9392
|
-
let
|
|
9505
|
+
let Q;
|
|
9393
9506
|
async function qe() {
|
|
9394
|
-
if (
|
|
9395
|
-
return
|
|
9507
|
+
if (Q)
|
|
9508
|
+
return Q;
|
|
9396
9509
|
const e = await Promise.all([
|
|
9397
9510
|
import("rehype-parse"),
|
|
9398
9511
|
import("rehype-stringify"),
|
|
@@ -9405,7 +9518,7 @@ async function qe() {
|
|
|
9405
9518
|
import("remark-rehype"),
|
|
9406
9519
|
import("rehype-format")
|
|
9407
9520
|
]);
|
|
9408
|
-
return
|
|
9521
|
+
return Q = {
|
|
9409
9522
|
rehypeParse: e[0],
|
|
9410
9523
|
rehypeStringify: e[1],
|
|
9411
9524
|
unified: e[2],
|
|
@@ -9416,7 +9529,7 @@ async function qe() {
|
|
|
9416
9529
|
remarkParse: e[7],
|
|
9417
9530
|
remarkRehype: e[8],
|
|
9418
9531
|
rehypeFormat: e[9]
|
|
9419
|
-
},
|
|
9532
|
+
}, Q;
|
|
9420
9533
|
}
|
|
9421
9534
|
function br() {
|
|
9422
9535
|
const e = (t) => {
|
|
@@ -9435,7 +9548,7 @@ function br() {
|
|
|
9435
9548
|
return e;
|
|
9436
9549
|
}
|
|
9437
9550
|
function kr() {
|
|
9438
|
-
const e =
|
|
9551
|
+
const e = Q;
|
|
9439
9552
|
if (!e)
|
|
9440
9553
|
throw new Error(
|
|
9441
9554
|
"addSpacesToCheckboxes requires ESM dependencies to be initialized"
|
|
@@ -9457,7 +9570,7 @@ function kr() {
|
|
|
9457
9570
|
return t;
|
|
9458
9571
|
}
|
|
9459
9572
|
function Xe(e) {
|
|
9460
|
-
const t =
|
|
9573
|
+
const t = Q;
|
|
9461
9574
|
if (!t)
|
|
9462
9575
|
throw new Error(
|
|
9463
9576
|
"cleanHTMLToMarkdown requires ESM dependencies to be initialized"
|
|
@@ -9506,20 +9619,20 @@ let ht = null;
|
|
|
9506
9619
|
function Cr() {
|
|
9507
9620
|
return ht || (ht = document.implementation.createHTMLDocument("title"));
|
|
9508
9621
|
}
|
|
9509
|
-
function
|
|
9622
|
+
function ao(e) {
|
|
9510
9623
|
if (typeof e == "string") {
|
|
9511
9624
|
const t = Cr().createElement("div");
|
|
9512
9625
|
t.innerHTML = e, e = t;
|
|
9513
9626
|
}
|
|
9514
9627
|
return wr(e), xr(e), e;
|
|
9515
9628
|
}
|
|
9516
|
-
async function
|
|
9517
|
-
const r =
|
|
9629
|
+
async function so(e, t, o, i, n) {
|
|
9630
|
+
const r = ao(e), s = wt.fromSchema(n).parse(r, {
|
|
9518
9631
|
topNode: n.nodes.blockGroup.create()
|
|
9519
9632
|
}), l = [];
|
|
9520
9633
|
for (let d = 0; d < s.childCount; d++)
|
|
9521
9634
|
l.push(
|
|
9522
|
-
|
|
9635
|
+
w(s.child(d), t, o, i)
|
|
9523
9636
|
);
|
|
9524
9637
|
return l;
|
|
9525
9638
|
}
|
|
@@ -9546,7 +9659,7 @@ async function Sr(e, t, o, i, n) {
|
|
|
9546
9659
|
code: Er
|
|
9547
9660
|
}
|
|
9548
9661
|
}).use(r.rehypeStringify.default).processSync(e);
|
|
9549
|
-
return
|
|
9662
|
+
return so(
|
|
9550
9663
|
a.value,
|
|
9551
9664
|
t,
|
|
9552
9665
|
o,
|
|
@@ -9574,7 +9687,7 @@ function Tr(e, t) {
|
|
|
9574
9687
|
throw new Error(`The string ${t} is not a valid MIME type.`);
|
|
9575
9688
|
return o[1] === "*" || i[1] === "*" ? o[0] === i[0] : (o[0] === "*" || i[0] === "*" || o[0] === i[0]) && o[1] === i[1];
|
|
9576
9689
|
}
|
|
9577
|
-
async function
|
|
9690
|
+
async function lo(e, t) {
|
|
9578
9691
|
var a;
|
|
9579
9692
|
if (!t.uploadFile) {
|
|
9580
9693
|
console.warn(
|
|
@@ -9671,7 +9784,7 @@ const Mr = (e) => L.create({
|
|
|
9671
9784
|
i = n;
|
|
9672
9785
|
break;
|
|
9673
9786
|
}
|
|
9674
|
-
return i === null ? !0 : i === "Files" ? (
|
|
9787
|
+
return i === null ? !0 : i === "Files" ? (lo(o, e), !0) : !1;
|
|
9675
9788
|
}
|
|
9676
9789
|
}
|
|
9677
9790
|
}
|
|
@@ -9718,9 +9831,9 @@ const Lr = (e) => L.create({
|
|
|
9718
9831
|
if (i === "vscode-editor-data")
|
|
9719
9832
|
return Ir(o, t), !0;
|
|
9720
9833
|
if (i === "Files")
|
|
9721
|
-
return
|
|
9834
|
+
return lo(o, e), !0;
|
|
9722
9835
|
let n = o.clipboardData.getData(i);
|
|
9723
|
-
return i === "blocknote/html" ? (t.pasteHTML(n), !0) : i === "text/html" ? (n =
|
|
9836
|
+
return i === "blocknote/html" ? (t.pasteHTML(n), !0) : i === "text/html" ? (n = ao(n.trim()).innerHTML, t.pasteHTML(n), !0) : (t.pasteText(n), !0);
|
|
9724
9837
|
}
|
|
9725
9838
|
}
|
|
9726
9839
|
}
|
|
@@ -9728,13 +9841,13 @@ const Lr = (e) => L.create({
|
|
|
9728
9841
|
];
|
|
9729
9842
|
}
|
|
9730
9843
|
});
|
|
9731
|
-
function
|
|
9844
|
+
function co(e, t) {
|
|
9732
9845
|
const o = [];
|
|
9733
9846
|
return e.descendants((i) => {
|
|
9734
9847
|
var n, r;
|
|
9735
9848
|
return i.type.name === "blockContainer" && ((n = i.firstChild) == null ? void 0 : n.type.name) === "blockGroup" ? !0 : i.type.name === "columnList" && i.childCount === 1 ? ((r = i.firstChild) == null || r.forEach((a) => {
|
|
9736
9849
|
o.push(
|
|
9737
|
-
|
|
9850
|
+
w(
|
|
9738
9851
|
a,
|
|
9739
9852
|
t.blockSchema,
|
|
9740
9853
|
t.inlineContentSchema,
|
|
@@ -9742,7 +9855,7 @@ function lo(e, t) {
|
|
|
9742
9855
|
)
|
|
9743
9856
|
);
|
|
9744
9857
|
}), !1) : i.type.isInGroup("bnBlock") ? (o.push(
|
|
9745
|
-
|
|
9858
|
+
w(
|
|
9746
9859
|
i,
|
|
9747
9860
|
t.blockSchema,
|
|
9748
9861
|
t.inlineContentSchema,
|
|
@@ -9774,7 +9887,7 @@ function Ar(e, t, o) {
|
|
|
9774
9887
|
);
|
|
9775
9888
|
if (n) {
|
|
9776
9889
|
((s = t.firstChild) == null ? void 0 : s.type.name) === "table" && (t = t.firstChild.content);
|
|
9777
|
-
const l =
|
|
9890
|
+
const l = Ht(
|
|
9778
9891
|
t,
|
|
9779
9892
|
o.schema.inlineContentSchema,
|
|
9780
9893
|
o.schema.styleSchema
|
|
@@ -9791,19 +9904,18 @@ function Ar(e, t, o) {
|
|
|
9791
9904
|
);
|
|
9792
9905
|
r = a.exportInlineContent(l, {});
|
|
9793
9906
|
} else {
|
|
9794
|
-
const l =
|
|
9907
|
+
const l = co(t, o.schema);
|
|
9795
9908
|
r = a.exportBlocks(l, {});
|
|
9796
9909
|
}
|
|
9797
9910
|
return r;
|
|
9798
9911
|
}
|
|
9799
|
-
function
|
|
9912
|
+
function uo(e, t) {
|
|
9800
9913
|
"node" in e.state.selection && e.state.selection.node.type.spec.group === "blockContent" && t.dispatch(
|
|
9801
9914
|
t._tiptapEditor.state.tr.setSelection(
|
|
9802
9915
|
new ce(e.state.doc.resolve(e.state.selection.from - 1))
|
|
9803
9916
|
)
|
|
9804
9917
|
);
|
|
9805
|
-
const o =
|
|
9806
|
-
e,
|
|
9918
|
+
const o = e.serializeForClipboard(
|
|
9807
9919
|
e.state.selection.content()
|
|
9808
9920
|
).dom.innerHTML, i = e.state.selection.content().content, n = Ar(
|
|
9809
9921
|
e,
|
|
@@ -9812,9 +9924,20 @@ function co(e, t) {
|
|
|
9812
9924
|
), r = Xe(n);
|
|
9813
9925
|
return { clipboardHTML: o, externalHTML: n, markdown: r };
|
|
9814
9926
|
}
|
|
9815
|
-
const mt = (
|
|
9927
|
+
const mt = () => {
|
|
9928
|
+
const e = window.getSelection();
|
|
9929
|
+
if (!e || e.isCollapsed)
|
|
9930
|
+
return !0;
|
|
9931
|
+
let t = e.focusNode;
|
|
9932
|
+
for (; t; ) {
|
|
9933
|
+
if (t instanceof HTMLElement && t.getAttribute("contenteditable") === "false")
|
|
9934
|
+
return !0;
|
|
9935
|
+
t = t.parentElement;
|
|
9936
|
+
}
|
|
9937
|
+
return !1;
|
|
9938
|
+
}, ft = (e, t, o) => {
|
|
9816
9939
|
o.preventDefault(), o.clipboardData.clearData();
|
|
9817
|
-
const { clipboardHTML: i, externalHTML: n, markdown: r } =
|
|
9940
|
+
const { clipboardHTML: i, externalHTML: n, markdown: r } = uo(
|
|
9818
9941
|
t,
|
|
9819
9942
|
e
|
|
9820
9943
|
);
|
|
@@ -9827,10 +9950,10 @@ const mt = (e, t, o) => {
|
|
|
9827
9950
|
props: {
|
|
9828
9951
|
handleDOMEvents: {
|
|
9829
9952
|
copy(t, o) {
|
|
9830
|
-
return mt(e, t, o), !0;
|
|
9953
|
+
return mt() || ft(e, t, o), !0;
|
|
9831
9954
|
},
|
|
9832
9955
|
cut(t, o) {
|
|
9833
|
-
return mt(e, t, o), t.editable && t.dispatch(t.state.tr.deleteSelection()), !0;
|
|
9956
|
+
return mt() || (ft(e, t, o), t.editable && t.dispatch(t.state.tr.deleteSelection())), !0;
|
|
9834
9957
|
},
|
|
9835
9958
|
// This is for the use-case in which only a block without content
|
|
9836
9959
|
// is selected, e.g. an image block, and dragged (not using the
|
|
@@ -9845,7 +9968,7 @@ const mt = (e, t, o) => {
|
|
|
9845
9968
|
)
|
|
9846
9969
|
)
|
|
9847
9970
|
), o.preventDefault(), o.dataTransfer.clearData();
|
|
9848
|
-
const { clipboardHTML: i, externalHTML: n, markdown: r } =
|
|
9971
|
+
const { clipboardHTML: i, externalHTML: n, markdown: r } = uo(t, e);
|
|
9849
9972
|
return o.dataTransfer.setData("blocknote/html", i), o.dataTransfer.setData("text/html", n), o.dataTransfer.setData("text/plain", r), !0;
|
|
9850
9973
|
}
|
|
9851
9974
|
}
|
|
@@ -9861,9 +9984,9 @@ const mt = (e, t, o) => {
|
|
|
9861
9984
|
types: ["blockContainer"],
|
|
9862
9985
|
attributes: {
|
|
9863
9986
|
backgroundColor: {
|
|
9864
|
-
default:
|
|
9865
|
-
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") :
|
|
9866
|
-
renderHTML: (e) => e.backgroundColor ===
|
|
9987
|
+
default: C.backgroundColor.default,
|
|
9988
|
+
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : C.backgroundColor.default,
|
|
9989
|
+
renderHTML: (e) => e.backgroundColor === C.backgroundColor.default ? {} : {
|
|
9867
9990
|
"data-background-color": e.backgroundColor
|
|
9868
9991
|
}
|
|
9869
9992
|
}
|
|
@@ -9871,7 +9994,82 @@ const mt = (e, t, o) => {
|
|
|
9871
9994
|
}
|
|
9872
9995
|
];
|
|
9873
9996
|
}
|
|
9874
|
-
})
|
|
9997
|
+
}), jr = (e) => {
|
|
9998
|
+
var i;
|
|
9999
|
+
const t = [];
|
|
10000
|
+
t.push(
|
|
10001
|
+
Jo.configure({
|
|
10002
|
+
fragment: e.fragment
|
|
10003
|
+
})
|
|
10004
|
+
);
|
|
10005
|
+
const o = (i = e.provider) == null ? void 0 : i.awareness;
|
|
10006
|
+
if (o) {
|
|
10007
|
+
const n = /* @__PURE__ */ new Map();
|
|
10008
|
+
e.showCursorLabels !== "always" && o.on(
|
|
10009
|
+
"change",
|
|
10010
|
+
({
|
|
10011
|
+
updated: s
|
|
10012
|
+
}) => {
|
|
10013
|
+
for (const l of s) {
|
|
10014
|
+
const d = n.get(l);
|
|
10015
|
+
d && (d.element.setAttribute("data-active", ""), d.hideTimeout && clearTimeout(d.hideTimeout), n.set(l, {
|
|
10016
|
+
element: d.element,
|
|
10017
|
+
hideTimeout: setTimeout(() => {
|
|
10018
|
+
d.element.removeAttribute("data-active");
|
|
10019
|
+
}, 2e3)
|
|
10020
|
+
}));
|
|
10021
|
+
}
|
|
10022
|
+
}
|
|
10023
|
+
);
|
|
10024
|
+
const r = (s) => {
|
|
10025
|
+
const l = document.createElement("span");
|
|
10026
|
+
l.classList.add("collaboration-cursor__base");
|
|
10027
|
+
const d = document.createElement("span");
|
|
10028
|
+
d.setAttribute("contentedEditable", "false"), d.classList.add("collaboration-cursor__caret"), d.setAttribute("style", `background-color: ${s.color}`);
|
|
10029
|
+
const c = document.createElement("span");
|
|
10030
|
+
return c.classList.add("collaboration-cursor__label"), c.setAttribute("style", `background-color: ${s.color}`), c.insertBefore(document.createTextNode(s.name), null), d.insertBefore(c, null), l.insertBefore(document.createTextNode(""), null), l.insertBefore(d, null), l.insertBefore(document.createTextNode(""), null), l;
|
|
10031
|
+
}, a = (s) => {
|
|
10032
|
+
var u;
|
|
10033
|
+
const l = [...o.getStates().entries()].find(
|
|
10034
|
+
(h) => h[1].user === s
|
|
10035
|
+
);
|
|
10036
|
+
if (!l)
|
|
10037
|
+
throw new Error("Could not find client state for user");
|
|
10038
|
+
const d = l[0];
|
|
10039
|
+
let c = n.get(d);
|
|
10040
|
+
if (!c) {
|
|
10041
|
+
const h = ((u = e == null ? void 0 : e.renderCursor) == null ? void 0 : u.call(e, s)) || r(s);
|
|
10042
|
+
(e == null ? void 0 : e.showCursorLabels) !== "always" && (h.addEventListener("mouseenter", () => {
|
|
10043
|
+
const m = n.get(d);
|
|
10044
|
+
m.element.setAttribute("data-active", ""), m.hideTimeout && (clearTimeout(m.hideTimeout), n.set(d, {
|
|
10045
|
+
element: m.element,
|
|
10046
|
+
hideTimeout: void 0
|
|
10047
|
+
}));
|
|
10048
|
+
}), h.addEventListener("mouseleave", () => {
|
|
10049
|
+
const m = n.get(d);
|
|
10050
|
+
n.set(d, {
|
|
10051
|
+
element: m.element,
|
|
10052
|
+
hideTimeout: setTimeout(() => {
|
|
10053
|
+
m.element.removeAttribute("data-active");
|
|
10054
|
+
}, 2e3)
|
|
10055
|
+
});
|
|
10056
|
+
})), c = {
|
|
10057
|
+
element: h,
|
|
10058
|
+
hideTimeout: void 0
|
|
10059
|
+
}, n.set(d, c);
|
|
10060
|
+
}
|
|
10061
|
+
return c.element;
|
|
10062
|
+
};
|
|
10063
|
+
t.push(
|
|
10064
|
+
Yo.configure({
|
|
10065
|
+
user: e.user,
|
|
10066
|
+
render: a,
|
|
10067
|
+
provider: e.provider
|
|
10068
|
+
})
|
|
10069
|
+
);
|
|
10070
|
+
}
|
|
10071
|
+
return t;
|
|
10072
|
+
};
|
|
9875
10073
|
class ne {
|
|
9876
10074
|
constructor() {
|
|
9877
10075
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -9892,7 +10090,7 @@ class ne {
|
|
|
9892
10090
|
this.callbacks = {};
|
|
9893
10091
|
}
|
|
9894
10092
|
}
|
|
9895
|
-
class
|
|
10093
|
+
class Dr {
|
|
9896
10094
|
constructor(t, o, i, n) {
|
|
9897
10095
|
p(this, "state");
|
|
9898
10096
|
p(this, "emitUpdate");
|
|
@@ -9949,7 +10147,7 @@ class jr {
|
|
|
9949
10147
|
}
|
|
9950
10148
|
}
|
|
9951
10149
|
const Ae = new N("FilePanelPlugin");
|
|
9952
|
-
class
|
|
10150
|
+
class Hr extends ne {
|
|
9953
10151
|
constructor(o) {
|
|
9954
10152
|
super();
|
|
9955
10153
|
p(this, "view");
|
|
@@ -9960,7 +10158,7 @@ class Dr extends ne {
|
|
|
9960
10158
|
});
|
|
9961
10159
|
this.plugin = new B({
|
|
9962
10160
|
key: Ae,
|
|
9963
|
-
view: (i) => (this.view = new
|
|
10161
|
+
view: (i) => (this.view = new Dr(
|
|
9964
10162
|
o,
|
|
9965
10163
|
Ae,
|
|
9966
10164
|
i,
|
|
@@ -10002,7 +10200,7 @@ class Ur {
|
|
|
10002
10200
|
p(this, "preventHide", !1);
|
|
10003
10201
|
p(this, "preventShow", !1);
|
|
10004
10202
|
p(this, "shouldShow", ({ state: t, from: o, to: i, view: n }) => {
|
|
10005
|
-
const { doc: r, selection: a } = t, { empty: s } = a, l = !r.textBetween(o, i).length &&
|
|
10203
|
+
const { doc: r, selection: a } = t, { empty: s } = a, l = !r.textBetween(o, i).length && xt(t.selection);
|
|
10006
10204
|
return a.$from.parent.type.spec.code || Ye(a) && a.node.type.spec.code ? !1 : !(!n.hasFocus() || s || l);
|
|
10007
10205
|
});
|
|
10008
10206
|
p(this, "blurHandler", (t) => {
|
|
@@ -10081,17 +10279,17 @@ class Ur {
|
|
|
10081
10279
|
return je(this.pmView, n, r);
|
|
10082
10280
|
}
|
|
10083
10281
|
}
|
|
10084
|
-
const
|
|
10282
|
+
const Or = new N(
|
|
10085
10283
|
"FormattingToolbarPlugin"
|
|
10086
10284
|
);
|
|
10087
|
-
class
|
|
10285
|
+
class Rr extends ne {
|
|
10088
10286
|
constructor(o) {
|
|
10089
10287
|
super();
|
|
10090
10288
|
p(this, "view");
|
|
10091
10289
|
p(this, "plugin");
|
|
10092
10290
|
p(this, "closeMenu", () => this.view.closeMenu());
|
|
10093
10291
|
this.plugin = new B({
|
|
10094
|
-
key:
|
|
10292
|
+
key: Or,
|
|
10095
10293
|
view: (i) => (this.view = new Ur(o, i, (n) => {
|
|
10096
10294
|
this.emit("update", n);
|
|
10097
10295
|
}), this.view),
|
|
@@ -10108,7 +10306,7 @@ class Or extends ne {
|
|
|
10108
10306
|
return this.on("update", o);
|
|
10109
10307
|
}
|
|
10110
10308
|
}
|
|
10111
|
-
const
|
|
10309
|
+
const gt = (e, t) => {
|
|
10112
10310
|
const o = e.resolve(t);
|
|
10113
10311
|
if (o.depth <= 1)
|
|
10114
10312
|
return;
|
|
@@ -10127,13 +10325,13 @@ const ft = (e, t) => {
|
|
|
10127
10325
|
return pe(
|
|
10128
10326
|
e.resolve(n)
|
|
10129
10327
|
);
|
|
10130
|
-
},
|
|
10328
|
+
}, po = (e, t) => {
|
|
10131
10329
|
for (; t.childContainer; ) {
|
|
10132
10330
|
const o = t.childContainer.node, i = e.resolve(t.childContainer.beforePos + 1).posAtIndex(o.childCount - 1);
|
|
10133
10331
|
t = pe(e.resolve(i));
|
|
10134
10332
|
}
|
|
10135
10333
|
return t;
|
|
10136
|
-
},
|
|
10334
|
+
}, Vr = (e, t) => e.isBlockContainer && e.blockContent.node.type.spec.content === "inline*" && e.blockContent.node.childCount > 0 && t.isBlockContainer && t.blockContent.node.type.spec.content === "inline*", zr = (e, t, o, i) => {
|
|
10137
10335
|
if (!i.isBlockContainer)
|
|
10138
10336
|
throw new Error(
|
|
10139
10337
|
`Attempted to merge block at position ${i.bnBlock.beforePos} into previous block at position ${o.bnBlock.beforePos}, but next block is not a block container`
|
|
@@ -10162,7 +10360,7 @@ const ft = (e, t) => {
|
|
|
10162
10360
|
);
|
|
10163
10361
|
}
|
|
10164
10362
|
return !0;
|
|
10165
|
-
},
|
|
10363
|
+
}, bt = (e) => ({
|
|
10166
10364
|
state: t,
|
|
10167
10365
|
dispatch: o
|
|
10168
10366
|
}) => {
|
|
@@ -10172,12 +10370,12 @@ const ft = (e, t) => {
|
|
|
10172
10370
|
);
|
|
10173
10371
|
if (!r)
|
|
10174
10372
|
return !1;
|
|
10175
|
-
const a =
|
|
10373
|
+
const a = po(
|
|
10176
10374
|
t.doc,
|
|
10177
10375
|
r
|
|
10178
10376
|
);
|
|
10179
|
-
return
|
|
10180
|
-
},
|
|
10377
|
+
return Vr(a, n) ? zr(t, o, a, n) : !1;
|
|
10378
|
+
}, Fr = L.create({
|
|
10181
10379
|
priority: 50,
|
|
10182
10380
|
// TODO: The shortcuts need a refactor. Do we want to use a command priority
|
|
10183
10381
|
// design as there is now, or clump the logic into a single function?
|
|
@@ -10220,7 +10418,7 @@ const ft = (e, t) => {
|
|
|
10220
10418
|
if (!a.isBlockContainer)
|
|
10221
10419
|
return !1;
|
|
10222
10420
|
const { bnBlock: s, blockContent: l } = a, d = r.selection.from === l.beforePos + 1, c = r.selection.empty, u = s.beforePos;
|
|
10223
|
-
return d && c ? i().command(
|
|
10421
|
+
return d && c ? i().command(bt(u)).scrollIntoView().run() : !1;
|
|
10224
10422
|
}),
|
|
10225
10423
|
() => n.command(({ state: r, dispatch: a }) => {
|
|
10226
10424
|
const s = _(r);
|
|
@@ -10229,13 +10427,13 @@ const ft = (e, t) => {
|
|
|
10229
10427
|
s.bnBlock.beforePos
|
|
10230
10428
|
))
|
|
10231
10429
|
return !1;
|
|
10232
|
-
const c =
|
|
10430
|
+
const c = gt(
|
|
10233
10431
|
r.doc,
|
|
10234
10432
|
s.bnBlock.beforePos
|
|
10235
10433
|
);
|
|
10236
10434
|
if ((c == null ? void 0 : c.blockNoteType) !== "column")
|
|
10237
10435
|
return !1;
|
|
10238
|
-
const u = c, h =
|
|
10436
|
+
const u = c, h = gt(
|
|
10239
10437
|
r.doc,
|
|
10240
10438
|
u.bnBlock.beforePos
|
|
10241
10439
|
);
|
|
@@ -10265,7 +10463,7 @@ const ft = (e, t) => {
|
|
|
10265
10463
|
)
|
|
10266
10464
|
);
|
|
10267
10465
|
const k = r.tr.doc.resolve(u.bnBlock.beforePos);
|
|
10268
|
-
r.tr.setSelection(
|
|
10466
|
+
r.tr.setSelection(U.between(k, k));
|
|
10269
10467
|
} else {
|
|
10270
10468
|
r.tr.step(
|
|
10271
10469
|
new De(
|
|
@@ -10284,7 +10482,7 @@ const ft = (e, t) => {
|
|
|
10284
10482
|
const k = r.tr.doc.resolve(
|
|
10285
10483
|
r.tr.mapping.map(u.bnBlock.beforePos - 1)
|
|
10286
10484
|
);
|
|
10287
|
-
r.tr.setSelection(
|
|
10485
|
+
r.tr.setSelection(U.between(k, k));
|
|
10288
10486
|
}
|
|
10289
10487
|
else if (m)
|
|
10290
10488
|
if (g) {
|
|
@@ -10298,7 +10496,7 @@ const ft = (e, t) => {
|
|
|
10298
10496
|
const k = r.tr.doc.resolve(
|
|
10299
10497
|
h.bnBlock.beforePos
|
|
10300
10498
|
);
|
|
10301
|
-
r.tr.setSelection(
|
|
10499
|
+
r.tr.setSelection(U.between(k, k));
|
|
10302
10500
|
} else
|
|
10303
10501
|
r.tr.delete(
|
|
10304
10502
|
u.bnBlock.beforePos - 1,
|
|
@@ -10316,7 +10514,7 @@ const ft = (e, t) => {
|
|
|
10316
10514
|
b.content
|
|
10317
10515
|
);
|
|
10318
10516
|
const k = r.tr.doc.resolve(u.bnBlock.beforePos - 1);
|
|
10319
|
-
r.tr.setSelection(
|
|
10517
|
+
r.tr.setSelection(U.between(k, k));
|
|
10320
10518
|
}
|
|
10321
10519
|
}
|
|
10322
10520
|
return !0;
|
|
@@ -10333,7 +10531,7 @@ const ft = (e, t) => {
|
|
|
10333
10531
|
a.bnBlock.beforePos
|
|
10334
10532
|
);
|
|
10335
10533
|
if (d && s && l) {
|
|
10336
|
-
const c =
|
|
10534
|
+
const c = po(
|
|
10337
10535
|
r.doc,
|
|
10338
10536
|
d
|
|
10339
10537
|
);
|
|
@@ -10373,7 +10571,7 @@ const ft = (e, t) => {
|
|
|
10373
10571
|
let f = d, g = a.afterPos + 1, b = n.doc.resolve(g).depth;
|
|
10374
10572
|
for (; b < f; )
|
|
10375
10573
|
f = b, g += 2, b = n.doc.resolve(g).depth;
|
|
10376
|
-
return i.command(
|
|
10574
|
+
return i.command(bt(g - 1));
|
|
10377
10575
|
}
|
|
10378
10576
|
return !1;
|
|
10379
10577
|
})
|
|
@@ -10400,7 +10598,7 @@ const ft = (e, t) => {
|
|
|
10400
10598
|
if (r) {
|
|
10401
10599
|
const f = n.schema.nodes.blockContainer.createAndFill();
|
|
10402
10600
|
n.tr.insert(h, f).scrollIntoView(), n.tr.setSelection(
|
|
10403
|
-
new
|
|
10601
|
+
new U(n.doc.resolve(m))
|
|
10404
10602
|
);
|
|
10405
10603
|
}
|
|
10406
10604
|
return !0;
|
|
@@ -10415,7 +10613,7 @@ const ft = (e, t) => {
|
|
|
10415
10613
|
return !1;
|
|
10416
10614
|
const { blockContent: s } = a, l = n.selection.$anchor.parentOffset === 0;
|
|
10417
10615
|
return s.node.childCount === 0 ? !1 : (r().deleteSelection().command(
|
|
10418
|
-
|
|
10616
|
+
$t(
|
|
10419
10617
|
n.selection.from,
|
|
10420
10618
|
l,
|
|
10421
10619
|
l
|
|
@@ -10427,7 +10625,7 @@ const ft = (e, t) => {
|
|
|
10427
10625
|
// editor since the browser will try to use tab for keyboard navigation.
|
|
10428
10626
|
Tab: () => {
|
|
10429
10627
|
var i, n, r;
|
|
10430
|
-
return this.options.tabBehavior !== "prefer-indent" && ((i = this.options.editor.formattingToolbar) != null && i.shown || (n = this.options.editor.linkToolbar) != null && n.shown || (r = this.options.editor.filePanel) != null && r.shown) ? !1 :
|
|
10628
|
+
return this.options.tabBehavior !== "prefer-indent" && ((i = this.options.editor.formattingToolbar) != null && i.shown || (n = this.options.editor.linkToolbar) != null && n.shown || (r = this.options.editor.filePanel) != null && r.shown) ? !1 : io(this.options.editor);
|
|
10431
10629
|
},
|
|
10432
10630
|
"Shift-Tab": () => {
|
|
10433
10631
|
var i, n, r;
|
|
@@ -10438,7 +10636,7 @@ const ft = (e, t) => {
|
|
|
10438
10636
|
};
|
|
10439
10637
|
}
|
|
10440
10638
|
});
|
|
10441
|
-
class
|
|
10639
|
+
class Gr {
|
|
10442
10640
|
constructor(t, o, i) {
|
|
10443
10641
|
p(this, "state");
|
|
10444
10642
|
p(this, "emitUpdate");
|
|
@@ -10566,8 +10764,8 @@ class Fr {
|
|
|
10566
10764
|
);
|
|
10567
10765
|
}
|
|
10568
10766
|
}
|
|
10569
|
-
const
|
|
10570
|
-
class
|
|
10767
|
+
const $r = new N("LinkToolbarPlugin");
|
|
10768
|
+
class Wr extends ne {
|
|
10571
10769
|
constructor(o) {
|
|
10572
10770
|
super();
|
|
10573
10771
|
p(this, "view");
|
|
@@ -10606,8 +10804,8 @@ class $r extends ne {
|
|
|
10606
10804
|
});
|
|
10607
10805
|
p(this, "closeMenu", () => this.view.closeMenu());
|
|
10608
10806
|
this.plugin = new B({
|
|
10609
|
-
key:
|
|
10610
|
-
view: (i) => (this.view = new
|
|
10807
|
+
key: $r,
|
|
10808
|
+
view: (i) => (this.view = new Gr(o, i, (n) => {
|
|
10611
10809
|
this.emit("update", n);
|
|
10612
10810
|
}), this.view),
|
|
10613
10811
|
props: {
|
|
@@ -10623,7 +10821,7 @@ class $r extends ne {
|
|
|
10623
10821
|
return ((i = (o = this.view) == null ? void 0 : o.state) == null ? void 0 : i.show) || !1;
|
|
10624
10822
|
}
|
|
10625
10823
|
}
|
|
10626
|
-
const
|
|
10824
|
+
const Kr = [
|
|
10627
10825
|
"http",
|
|
10628
10826
|
"https",
|
|
10629
10827
|
"ftp",
|
|
@@ -10634,12 +10832,12 @@ const Wr = [
|
|
|
10634
10832
|
"sms",
|
|
10635
10833
|
"cid",
|
|
10636
10834
|
"xmpp"
|
|
10637
|
-
],
|
|
10638
|
-
class
|
|
10835
|
+
], qr = "https", Xr = new N("node-selection-keyboard");
|
|
10836
|
+
class Zr {
|
|
10639
10837
|
constructor() {
|
|
10640
10838
|
p(this, "plugin");
|
|
10641
10839
|
this.plugin = new B({
|
|
10642
|
-
key:
|
|
10840
|
+
key: Xr,
|
|
10643
10841
|
props: {
|
|
10644
10842
|
handleKeyDown: (t, o) => {
|
|
10645
10843
|
if ("node" in t.state.selection) {
|
|
@@ -10654,7 +10852,7 @@ class Xr {
|
|
|
10654
10852
|
t.state.tr.selection.$to.after(),
|
|
10655
10853
|
t.state.schema.nodes.paragraph.createChecked()
|
|
10656
10854
|
).setSelection(
|
|
10657
|
-
new
|
|
10855
|
+
new U(
|
|
10658
10856
|
i.doc.resolve(t.state.tr.selection.$to.after() + 1)
|
|
10659
10857
|
)
|
|
10660
10858
|
)
|
|
@@ -10667,69 +10865,83 @@ class Xr {
|
|
|
10667
10865
|
});
|
|
10668
10866
|
}
|
|
10669
10867
|
}
|
|
10670
|
-
const
|
|
10671
|
-
class
|
|
10868
|
+
const Jr = new N("blocknote-placeholder");
|
|
10869
|
+
class Yr {
|
|
10672
10870
|
constructor(t, o) {
|
|
10673
10871
|
p(this, "plugin");
|
|
10674
10872
|
this.plugin = new B({
|
|
10675
|
-
key:
|
|
10676
|
-
view: () => {
|
|
10677
|
-
var
|
|
10678
|
-
const
|
|
10679
|
-
|
|
10680
|
-
const r =
|
|
10681
|
-
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
const
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10688
|
-
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
)} { content: ${JSON.stringify(u)}; }`
|
|
10695
|
-
), h || r.insertRule(
|
|
10696
|
-
`${s(c, !0)} { content: ${JSON.stringify(
|
|
10697
|
-
u
|
|
10873
|
+
key: Jr,
|
|
10874
|
+
view: (i) => {
|
|
10875
|
+
var d, c;
|
|
10876
|
+
const n = `placeholder-selector-${Ct()}`;
|
|
10877
|
+
i.dom.classList.add(n);
|
|
10878
|
+
const r = document.createElement("style"), a = t._tiptapEditor.options.injectNonce;
|
|
10879
|
+
a && r.setAttribute("nonce", a), ((d = t.prosemirrorView) == null ? void 0 : d.root) instanceof ShadowRoot ? t.prosemirrorView.root.append(r) : (c = t.prosemirrorView) == null || c.root.head.appendChild(r);
|
|
10880
|
+
const s = r.sheet, l = (u = "") => `.${n} .bn-block-content${u} .bn-inline-content:has(> .ProseMirror-trailingBreak:only-child):before`;
|
|
10881
|
+
try {
|
|
10882
|
+
const {
|
|
10883
|
+
default: u,
|
|
10884
|
+
emptyDocument: h,
|
|
10885
|
+
...m
|
|
10886
|
+
} = o;
|
|
10887
|
+
for (const [b, k] of Object.entries(m)) {
|
|
10888
|
+
const v = `[data-content-type="${b}"]`;
|
|
10889
|
+
s.insertRule(
|
|
10890
|
+
`${l(v)} { content: ${JSON.stringify(
|
|
10891
|
+
k
|
|
10698
10892
|
)}; }`
|
|
10699
10893
|
);
|
|
10700
|
-
} catch (m) {
|
|
10701
|
-
console.warn(
|
|
10702
|
-
"Failed to insert placeholder CSS rule - this is likely due to the browser not supporting certain CSS pseudo-element selectors (:has, :only-child:, or :before)",
|
|
10703
|
-
m
|
|
10704
|
-
);
|
|
10705
10894
|
}
|
|
10895
|
+
const f = "[data-is-only-empty-block]", g = "[data-is-empty-and-focused]";
|
|
10896
|
+
s.insertRule(
|
|
10897
|
+
`${l(f)} { content: ${JSON.stringify(
|
|
10898
|
+
h
|
|
10899
|
+
)}; }`
|
|
10900
|
+
), s.insertRule(
|
|
10901
|
+
`${l(g)} { content: ${JSON.stringify(
|
|
10902
|
+
u
|
|
10903
|
+
)}; }`
|
|
10904
|
+
);
|
|
10905
|
+
} catch (u) {
|
|
10906
|
+
console.warn(
|
|
10907
|
+
"Failed to insert placeholder CSS rule - this is likely due to the browser not supporting certain CSS pseudo-element selectors (:has, :only-child:, or :before)",
|
|
10908
|
+
u
|
|
10909
|
+
);
|
|
10706
10910
|
}
|
|
10707
10911
|
return {
|
|
10708
10912
|
destroy: () => {
|
|
10709
|
-
var
|
|
10710
|
-
((
|
|
10913
|
+
var u, h;
|
|
10914
|
+
((u = t.prosemirrorView) == null ? void 0 : u.root) instanceof ShadowRoot ? t.prosemirrorView.root.removeChild(r) : (h = t.prosemirrorView) == null || h.root.head.removeChild(r);
|
|
10711
10915
|
}
|
|
10712
10916
|
};
|
|
10713
10917
|
},
|
|
10714
10918
|
props: {
|
|
10715
|
-
// TODO: maybe also add placeholder for empty document ("e.g.: start writing..")
|
|
10716
10919
|
decorations: (i) => {
|
|
10717
10920
|
const { doc: n, selection: r } = i;
|
|
10718
10921
|
if (!t.isEditable || !r.empty || r.$from.parent.type.spec.code)
|
|
10719
10922
|
return;
|
|
10720
|
-
const a =
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10923
|
+
const a = [];
|
|
10924
|
+
i.doc.content.size === 6 && a.push(
|
|
10925
|
+
X.node(2, 4, {
|
|
10926
|
+
"data-is-only-empty-block": "true"
|
|
10927
|
+
})
|
|
10928
|
+
);
|
|
10929
|
+
const s = r.$anchor, l = s.parent;
|
|
10930
|
+
if (l.content.size === 0) {
|
|
10931
|
+
const d = s.before();
|
|
10932
|
+
a.push(
|
|
10933
|
+
X.node(d, d + l.nodeSize, {
|
|
10934
|
+
"data-is-empty-and-focused": "true"
|
|
10935
|
+
})
|
|
10936
|
+
);
|
|
10937
|
+
}
|
|
10938
|
+
return ie.create(n, a);
|
|
10727
10939
|
}
|
|
10728
10940
|
}
|
|
10729
10941
|
});
|
|
10730
10942
|
}
|
|
10731
10943
|
}
|
|
10732
|
-
const
|
|
10944
|
+
const kt = new N("previous-blocks"), Qr = {
|
|
10733
10945
|
// Numbered List Items
|
|
10734
10946
|
index: "index",
|
|
10735
10947
|
// Headings
|
|
@@ -10739,19 +10951,19 @@ const bt = new N("previous-blocks"), Yr = {
|
|
|
10739
10951
|
depth: "depth",
|
|
10740
10952
|
"depth-change": "depth-change"
|
|
10741
10953
|
};
|
|
10742
|
-
class
|
|
10954
|
+
class ea {
|
|
10743
10955
|
constructor() {
|
|
10744
10956
|
p(this, "plugin");
|
|
10745
10957
|
let t;
|
|
10746
10958
|
this.plugin = new B({
|
|
10747
|
-
key:
|
|
10959
|
+
key: kt,
|
|
10748
10960
|
view(o) {
|
|
10749
10961
|
return {
|
|
10750
10962
|
update: async (i, n) => {
|
|
10751
10963
|
var r;
|
|
10752
10964
|
((r = this.key) == null ? void 0 : r.getState(i.state).updatedBlocks.size) > 0 && (t = setTimeout(() => {
|
|
10753
10965
|
i.dispatch(
|
|
10754
|
-
i.state.tr.setMeta(
|
|
10966
|
+
i.state.tr.setMeta(kt, { clearUpdate: !0 })
|
|
10755
10967
|
);
|
|
10756
10968
|
}, 0));
|
|
10757
10969
|
},
|
|
@@ -10809,8 +11021,8 @@ class Qr {
|
|
|
10809
11021
|
return;
|
|
10810
11022
|
const s = i.currentTransactionOldBlockAttrs[r.attrs.id], l = {};
|
|
10811
11023
|
for (const [c, u] of Object.entries(s))
|
|
10812
|
-
l["data-prev-" +
|
|
10813
|
-
const d =
|
|
11024
|
+
l["data-prev-" + Qr[c]] = u || "none";
|
|
11025
|
+
const d = X.node(a, a + r.nodeSize, {
|
|
10814
11026
|
...l
|
|
10815
11027
|
});
|
|
10816
11028
|
n.push(d);
|
|
@@ -10820,14 +11032,14 @@ class Qr {
|
|
|
10820
11032
|
});
|
|
10821
11033
|
}
|
|
10822
11034
|
}
|
|
10823
|
-
function
|
|
11035
|
+
function ho(e, t) {
|
|
10824
11036
|
var o, i;
|
|
10825
11037
|
for (; e && e.parentElement && e.parentElement !== t.dom && ((o = e.getAttribute) == null ? void 0 : o.call(e, "data-node-type")) !== "blockContainer"; )
|
|
10826
11038
|
e = e.parentElement;
|
|
10827
11039
|
if (((i = e.getAttribute) == null ? void 0 : i.call(e, "data-node-type")) === "blockContainer")
|
|
10828
11040
|
return { node: e, id: e.getAttribute("data-id") };
|
|
10829
11041
|
}
|
|
10830
|
-
class
|
|
11042
|
+
class ee extends Me {
|
|
10831
11043
|
constructor(o, i) {
|
|
10832
11044
|
super(o, i);
|
|
10833
11045
|
p(this, "nodes");
|
|
@@ -10838,13 +11050,13 @@ class Q extends Me {
|
|
|
10838
11050
|
});
|
|
10839
11051
|
}
|
|
10840
11052
|
static create(o, i, n = i) {
|
|
10841
|
-
return new
|
|
11053
|
+
return new ee(o.resolve(i), o.resolve(n));
|
|
10842
11054
|
}
|
|
10843
11055
|
content() {
|
|
10844
11056
|
return new q(j.from(this.nodes), 0, 0);
|
|
10845
11057
|
}
|
|
10846
11058
|
eq(o) {
|
|
10847
|
-
if (!(o instanceof
|
|
11059
|
+
if (!(o instanceof ee) || this.nodes.length !== o.nodes.length || this.from !== o.from || this.to !== o.to)
|
|
10848
11060
|
return !1;
|
|
10849
11061
|
for (let i = 0; i < this.nodes.length; i++)
|
|
10850
11062
|
if (!this.nodes[i].eq(o.nodes[i]))
|
|
@@ -10853,7 +11065,7 @@ class Q extends Me {
|
|
|
10853
11065
|
}
|
|
10854
11066
|
map(o, i) {
|
|
10855
11067
|
const n = i.mapResult(this.from), r = i.mapResult(this.to);
|
|
10856
|
-
return r.deleted ? Me.near(o.resolve(n.pos)) : n.deleted ? Me.near(o.resolve(r.pos)) : new
|
|
11068
|
+
return r.deleted ? Me.near(o.resolve(n.pos)) : n.deleted ? Me.near(o.resolve(r.pos)) : new ee(
|
|
10857
11069
|
o.resolve(n.pos),
|
|
10858
11070
|
o.resolve(r.pos)
|
|
10859
11071
|
);
|
|
@@ -10863,7 +11075,7 @@ class Q extends Me {
|
|
|
10863
11075
|
}
|
|
10864
11076
|
}
|
|
10865
11077
|
let O;
|
|
10866
|
-
function
|
|
11078
|
+
function ta(e, t) {
|
|
10867
11079
|
let o, i;
|
|
10868
11080
|
const n = t.resolve(e.from).node().type.spec.group === "blockContent", r = t.resolve(e.to).node().type.spec.group === "blockContent", a = Math.min(e.$anchor.depth, e.$head.depth);
|
|
10869
11081
|
if (n && r) {
|
|
@@ -10873,7 +11085,7 @@ function ea(e, t) {
|
|
|
10873
11085
|
o = e.from, i = e.to;
|
|
10874
11086
|
return { from: o, to: i };
|
|
10875
11087
|
}
|
|
10876
|
-
function
|
|
11088
|
+
function _t(e, t, o = t) {
|
|
10877
11089
|
t === o && (o += e.state.doc.resolve(t + 1).node().nodeSize);
|
|
10878
11090
|
const i = e.domAtPos(t).node.cloneNode(!0), n = e.domAtPos(t).node, r = (c, u) => Array.prototype.indexOf.call(c.children, u), a = r(
|
|
10879
11091
|
n,
|
|
@@ -10886,16 +11098,16 @@ function kt(e, t, o = t) {
|
|
|
10886
11098
|
);
|
|
10887
11099
|
for (let c = n.childElementCount - 1; c >= 0; c--)
|
|
10888
11100
|
(c > s || c < a) && i.removeChild(i.children[c]);
|
|
10889
|
-
|
|
11101
|
+
mo(e.root), O = i;
|
|
10890
11102
|
const d = e.dom.className.split(" ").filter(
|
|
10891
11103
|
(c) => c !== "ProseMirror" && c !== "bn-root" && c !== "bn-editor"
|
|
10892
11104
|
).join(" ");
|
|
10893
11105
|
O.className = O.className + " bn-drag-preview " + d, e.root instanceof ShadowRoot ? e.root.appendChild(O) : e.root.body.appendChild(O);
|
|
10894
11106
|
}
|
|
10895
|
-
function
|
|
11107
|
+
function mo(e) {
|
|
10896
11108
|
O !== void 0 && (e instanceof ShadowRoot ? e.removeChild(O) : e.body.removeChild(O), O = void 0);
|
|
10897
11109
|
}
|
|
10898
|
-
function
|
|
11110
|
+
function oa(e, t, o) {
|
|
10899
11111
|
if (!e.dataTransfer)
|
|
10900
11112
|
return;
|
|
10901
11113
|
const i = o.prosemirrorView;
|
|
@@ -10906,17 +11118,14 @@ function ta(e, t, o) {
|
|
|
10906
11118
|
throw new Error(`Block with ID ${t.id} not found`);
|
|
10907
11119
|
const r = n.posBeforeNode;
|
|
10908
11120
|
if (r != null) {
|
|
10909
|
-
const a = i.state.selection, s = i.state.doc, { from: l, to: d } =
|
|
11121
|
+
const a = i.state.selection, s = i.state.doc, { from: l, to: d } = ta(a, s), c = l <= r && r < d, u = a.$anchor.node() !== a.$head.node() || a instanceof ee;
|
|
10910
11122
|
c && u ? (i.dispatch(
|
|
10911
|
-
i.state.tr.setSelection(
|
|
10912
|
-
),
|
|
11123
|
+
i.state.tr.setSelection(ee.create(s, l, d))
|
|
11124
|
+
), _t(i, l, d)) : (i.dispatch(
|
|
10913
11125
|
i.state.tr.setSelection(ce.create(i.state.doc, r))
|
|
10914
|
-
),
|
|
10915
|
-
const h = i.state.selection.content(), m = o.pmSchema, f =
|
|
10916
|
-
|
|
10917
|
-
h
|
|
10918
|
-
).dom.innerHTML, g = Ee(m, o), b = lo(h.content, o.schema), k = g.exportBlocks(b, {}), C = Xe(k);
|
|
10919
|
-
e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html", f), e.dataTransfer.setData("text/html", k), e.dataTransfer.setData("text/plain", C), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setDragImage(O, 0, 0);
|
|
11126
|
+
), _t(i, r));
|
|
11127
|
+
const h = i.state.selection.content(), m = o.pmSchema, f = i.serializeForClipboard(h).dom.innerHTML, g = Ee(m, o), b = co(h.content, o.schema), k = g.exportBlocks(b, {}), v = Xe(k);
|
|
11128
|
+
e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html", f), e.dataTransfer.setData("text/html", k), e.dataTransfer.setData("text/plain", v), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setDragImage(O, 0, 0);
|
|
10920
11129
|
}
|
|
10921
11130
|
}
|
|
10922
11131
|
const ae = 0.1;
|
|
@@ -10937,9 +11146,9 @@ function ze(e, t, o, i = !0) {
|
|
|
10937
11146
|
},
|
|
10938
11147
|
o,
|
|
10939
11148
|
!1
|
|
10940
|
-
) :
|
|
11149
|
+
) : ho(r, e);
|
|
10941
11150
|
}
|
|
10942
|
-
function
|
|
11151
|
+
function ia(e, t, o) {
|
|
10943
11152
|
if (!t.dom.firstChild)
|
|
10944
11153
|
return;
|
|
10945
11154
|
const i = t.dom.firstChild.getBoundingClientRect(), n = {
|
|
@@ -10954,7 +11163,7 @@ function oa(e, t, o) {
|
|
|
10954
11163
|
}
|
|
10955
11164
|
return s;
|
|
10956
11165
|
}
|
|
10957
|
-
class
|
|
11166
|
+
class na {
|
|
10958
11167
|
constructor(t, o, i, n) {
|
|
10959
11168
|
p(this, "state");
|
|
10960
11169
|
p(this, "emitUpdate");
|
|
@@ -10969,7 +11178,7 @@ class ia {
|
|
|
10969
11178
|
var i, n, r, a;
|
|
10970
11179
|
if (this.menuFrozen || !this.mousePos)
|
|
10971
11180
|
return;
|
|
10972
|
-
const t =
|
|
11181
|
+
const t = ia(
|
|
10973
11182
|
this.mousePos,
|
|
10974
11183
|
this.pmView,
|
|
10975
11184
|
this.sideMenuDetection
|
|
@@ -11008,7 +11217,7 @@ class ia {
|
|
|
11008
11217
|
var i;
|
|
11009
11218
|
if (this.pmView.dragging === null || (this.editor._tiptapEditor.commands.blur(), !this.isDragOrigin && this.pmView.dom.contains(t.target) ? this.pmView.dispatch(
|
|
11010
11219
|
this.pmView.state.tr.setSelection(
|
|
11011
|
-
|
|
11220
|
+
U.create(
|
|
11012
11221
|
this.pmView.state.tr.doc,
|
|
11013
11222
|
this.pmView.state.tr.selection.to
|
|
11014
11223
|
)
|
|
@@ -11054,7 +11263,7 @@ class ia {
|
|
|
11054
11263
|
throw new Error("New drag was started while an existing drag is ongoing");
|
|
11055
11264
|
const i = document.createElement("div");
|
|
11056
11265
|
i.innerHTML = o;
|
|
11057
|
-
const r =
|
|
11266
|
+
const r = wt.fromSchema(this.pmView.state.schema).parse(i, {
|
|
11058
11267
|
topNode: this.pmView.state.schema.nodes.blockGroup.create()
|
|
11059
11268
|
});
|
|
11060
11269
|
this.pmView.dragging = {
|
|
@@ -11170,8 +11379,8 @@ class ia {
|
|
|
11170
11379
|
), this.pmView.root.removeEventListener("scroll", this.onScroll, !0);
|
|
11171
11380
|
}
|
|
11172
11381
|
}
|
|
11173
|
-
const
|
|
11174
|
-
class
|
|
11382
|
+
const ra = new N("SideMenuPlugin");
|
|
11383
|
+
class aa extends ne {
|
|
11175
11384
|
constructor(o, i) {
|
|
11176
11385
|
super();
|
|
11177
11386
|
p(this, "view");
|
|
@@ -11180,13 +11389,13 @@ class ra extends ne {
|
|
|
11180
11389
|
* Handles drag & drop events for blocks.
|
|
11181
11390
|
*/
|
|
11182
11391
|
p(this, "blockDragStart", (o, i) => {
|
|
11183
|
-
this.view && (this.view.isDragOrigin = !0),
|
|
11392
|
+
this.view && (this.view.isDragOrigin = !0), oa(o, i, this.editor);
|
|
11184
11393
|
});
|
|
11185
11394
|
/**
|
|
11186
11395
|
* Handles drag & drop events for blocks.
|
|
11187
11396
|
*/
|
|
11188
11397
|
p(this, "blockDragEnd", () => {
|
|
11189
|
-
this.editor.prosemirrorView &&
|
|
11398
|
+
this.editor.prosemirrorView && mo(this.editor.prosemirrorView.root), this.view && (this.view.isDragOrigin = !1);
|
|
11190
11399
|
});
|
|
11191
11400
|
/**
|
|
11192
11401
|
* Freezes the side menu. When frozen, the side menu will stay
|
|
@@ -11205,8 +11414,8 @@ class ra extends ne {
|
|
|
11205
11414
|
this.view.menuFrozen = !1, this.view.state.show = !1, this.view.emitUpdate(this.view.state);
|
|
11206
11415
|
});
|
|
11207
11416
|
this.editor = o, this.plugin = new B({
|
|
11208
|
-
key:
|
|
11209
|
-
view: (n) => (this.view = new
|
|
11417
|
+
key: ra,
|
|
11418
|
+
view: (n) => (this.view = new na(
|
|
11210
11419
|
o,
|
|
11211
11420
|
i,
|
|
11212
11421
|
n,
|
|
@@ -11220,8 +11429,8 @@ class ra extends ne {
|
|
|
11220
11429
|
return this.on("update", o);
|
|
11221
11430
|
}
|
|
11222
11431
|
}
|
|
11223
|
-
const
|
|
11224
|
-
class
|
|
11432
|
+
const sa = So((e) => e.type.name === "blockContainer");
|
|
11433
|
+
class la {
|
|
11225
11434
|
constructor(t, o) {
|
|
11226
11435
|
p(this, "state");
|
|
11227
11436
|
p(this, "emitUpdate");
|
|
@@ -11240,7 +11449,7 @@ class sa {
|
|
|
11240
11449
|
});
|
|
11241
11450
|
p(this, "closeMenu", () => {
|
|
11242
11451
|
this.editor.dispatch(
|
|
11243
|
-
this.editor._tiptapEditor.state.tr.setMeta(
|
|
11452
|
+
this.editor._tiptapEditor.state.tr.setMeta(te, null)
|
|
11244
11453
|
);
|
|
11245
11454
|
});
|
|
11246
11455
|
p(this, "clearQuery", () => {
|
|
@@ -11262,7 +11471,7 @@ class sa {
|
|
|
11262
11471
|
}
|
|
11263
11472
|
update(t, o) {
|
|
11264
11473
|
var d;
|
|
11265
|
-
const i =
|
|
11474
|
+
const i = te.getState(o), n = te.getState(
|
|
11266
11475
|
t.state
|
|
11267
11476
|
), r = i === void 0 && n !== void 0, a = i !== void 0 && n === void 0;
|
|
11268
11477
|
if (!r && !(i !== void 0 && n !== void 0) && !a)
|
|
@@ -11285,8 +11494,8 @@ class sa {
|
|
|
11285
11494
|
(t = this.rootEl) == null || t.removeEventListener("scroll", this.handleScroll, !0);
|
|
11286
11495
|
}
|
|
11287
11496
|
}
|
|
11288
|
-
const
|
|
11289
|
-
class
|
|
11497
|
+
const te = new N("SuggestionMenuPlugin");
|
|
11498
|
+
class da extends ne {
|
|
11290
11499
|
constructor(o) {
|
|
11291
11500
|
super();
|
|
11292
11501
|
p(this, "view");
|
|
@@ -11305,8 +11514,8 @@ class la extends ne {
|
|
|
11305
11514
|
p(this, "clearQuery", () => this.view.clearQuery());
|
|
11306
11515
|
const i = this.triggerCharacters;
|
|
11307
11516
|
this.plugin = new B({
|
|
11308
|
-
key:
|
|
11309
|
-
view: () => (this.view = new
|
|
11517
|
+
key: te,
|
|
11518
|
+
view: () => (this.view = new la(
|
|
11310
11519
|
o,
|
|
11311
11520
|
(n, r) => {
|
|
11312
11521
|
this.emit(`update ${n}`, r);
|
|
@@ -11320,7 +11529,7 @@ class la extends ne {
|
|
|
11320
11529
|
apply(n, r, a, s) {
|
|
11321
11530
|
if (n.getMeta("orderedListIndexing") !== void 0 || n.selection.$from.parent.type.spec.code)
|
|
11322
11531
|
return r;
|
|
11323
|
-
const l = n.getMeta(
|
|
11532
|
+
const l = n.getMeta(te);
|
|
11324
11533
|
if (typeof l == "object" && l !== null && r === void 0)
|
|
11325
11534
|
return {
|
|
11326
11535
|
triggerCharacter: l.triggerCharacter,
|
|
@@ -11352,7 +11561,7 @@ class la extends ne {
|
|
|
11352
11561
|
handleTextInput(n, r, a, s) {
|
|
11353
11562
|
const l = this.getState(n.state);
|
|
11354
11563
|
return i.includes(s) && l === void 0 ? (n.dispatch(
|
|
11355
|
-
n.state.tr.insertText(s).scrollIntoView().setMeta(
|
|
11564
|
+
n.state.tr.insertText(s).scrollIntoView().setMeta(te, {
|
|
11356
11565
|
triggerCharacter: s
|
|
11357
11566
|
})
|
|
11358
11567
|
), !0) : !1;
|
|
@@ -11363,10 +11572,10 @@ class la extends ne {
|
|
|
11363
11572
|
if (r === void 0)
|
|
11364
11573
|
return null;
|
|
11365
11574
|
if (!r.deleteTriggerCharacter) {
|
|
11366
|
-
const a =
|
|
11575
|
+
const a = sa(n.selection);
|
|
11367
11576
|
if (a)
|
|
11368
11577
|
return ie.create(n.doc, [
|
|
11369
|
-
|
|
11578
|
+
X.node(
|
|
11370
11579
|
a.pos,
|
|
11371
11580
|
a.pos + a.node.nodeSize,
|
|
11372
11581
|
{
|
|
@@ -11378,7 +11587,7 @@ class la extends ne {
|
|
|
11378
11587
|
]);
|
|
11379
11588
|
}
|
|
11380
11589
|
return ie.create(n.doc, [
|
|
11381
|
-
|
|
11590
|
+
X.inline(
|
|
11382
11591
|
r.queryStartPos - r.triggerCharacter.length,
|
|
11383
11592
|
r.queryStartPos,
|
|
11384
11593
|
{
|
|
@@ -11404,16 +11613,16 @@ function xs(e, t) {
|
|
|
11404
11613
|
e.suggestionMenus.addTriggerCharacter(t);
|
|
11405
11614
|
}
|
|
11406
11615
|
let M;
|
|
11407
|
-
function
|
|
11616
|
+
function yt(e) {
|
|
11408
11617
|
M || (M = document.createElement("div"), M.innerHTML = "_", M.style.opacity = "0", M.style.height = "1px", M.style.width = "1px", e instanceof Document ? e.body.appendChild(M) : e.appendChild(M));
|
|
11409
11618
|
}
|
|
11410
|
-
function
|
|
11619
|
+
function ca(e) {
|
|
11411
11620
|
M && (e instanceof Document ? e.body.removeChild(M) : e.removeChild(M), M = void 0);
|
|
11412
11621
|
}
|
|
11413
11622
|
function ke(e) {
|
|
11414
11623
|
return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
|
|
11415
11624
|
}
|
|
11416
|
-
function
|
|
11625
|
+
function ua(e) {
|
|
11417
11626
|
let t = e;
|
|
11418
11627
|
for (; t && t.nodeName !== "TD" && t.nodeName !== "TH" && !t.classList.contains("tableWrapper"); ) {
|
|
11419
11628
|
if (t.classList.contains("ProseMirror"))
|
|
@@ -11433,12 +11642,12 @@ function ca(e) {
|
|
|
11433
11642
|
tbodyNode: t.querySelector("tbody")
|
|
11434
11643
|
};
|
|
11435
11644
|
}
|
|
11436
|
-
function
|
|
11645
|
+
function pa(e, t) {
|
|
11437
11646
|
const o = t.querySelectorAll(e);
|
|
11438
11647
|
for (let i = 0; i < o.length; i++)
|
|
11439
11648
|
o[i].style.visibility = "hidden";
|
|
11440
11649
|
}
|
|
11441
|
-
class
|
|
11650
|
+
class ha {
|
|
11442
11651
|
constructor(t, o, i) {
|
|
11443
11652
|
p(this, "state");
|
|
11444
11653
|
p(this, "emitUpdate");
|
|
@@ -11458,7 +11667,7 @@ class pa {
|
|
|
11458
11667
|
var d, c, u, h;
|
|
11459
11668
|
if (this.menuFrozen || this.mouseState === "selecting" || !(t.target instanceof Element) || !this.pmView.dom.contains(t.target))
|
|
11460
11669
|
return;
|
|
11461
|
-
const o =
|
|
11670
|
+
const o = ua(t.target);
|
|
11462
11671
|
if ((o == null ? void 0 : o.type) === "cell" && this.mouseState === "down" && !((d = this.state) != null && d.draggingState)) {
|
|
11463
11672
|
this.mouseState = "selecting", (c = this.state) != null && c.show && (this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate());
|
|
11464
11673
|
return;
|
|
@@ -11469,7 +11678,7 @@ class pa {
|
|
|
11469
11678
|
}
|
|
11470
11679
|
if (!o.tbodyNode)
|
|
11471
11680
|
return;
|
|
11472
|
-
const i = o.tbodyNode.getBoundingClientRect(), n =
|
|
11681
|
+
const i = o.tbodyNode.getBoundingClientRect(), n = ho(o.domNode, this.pmView);
|
|
11473
11682
|
if (!n)
|
|
11474
11683
|
return;
|
|
11475
11684
|
this.tableElement = n.node;
|
|
@@ -11480,7 +11689,7 @@ class pa {
|
|
|
11480
11689
|
);
|
|
11481
11690
|
if (!a)
|
|
11482
11691
|
throw new Error(`Block with ID ${n.id} not found`);
|
|
11483
|
-
const s =
|
|
11692
|
+
const s = w(
|
|
11484
11693
|
a.node,
|
|
11485
11694
|
this.editor.schema.blockSchema,
|
|
11486
11695
|
this.editor.schema.inlineContentSchema,
|
|
@@ -11529,7 +11738,7 @@ class pa {
|
|
|
11529
11738
|
var h;
|
|
11530
11739
|
if (((h = this.state) == null ? void 0 : h.draggingState) === void 0)
|
|
11531
11740
|
return;
|
|
11532
|
-
t.preventDefault(), t.dataTransfer.dropEffect = "move",
|
|
11741
|
+
t.preventDefault(), t.dataTransfer.dropEffect = "move", pa(
|
|
11533
11742
|
".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline",
|
|
11534
11743
|
this.pmView.root
|
|
11535
11744
|
);
|
|
@@ -11627,7 +11836,7 @@ class pa {
|
|
|
11627
11836
|
}
|
|
11628
11837
|
}
|
|
11629
11838
|
const se = new N("TableHandlesPlugin");
|
|
11630
|
-
class
|
|
11839
|
+
class ma extends ne {
|
|
11631
11840
|
constructor(o) {
|
|
11632
11841
|
super();
|
|
11633
11842
|
p(this, "view");
|
|
@@ -11654,7 +11863,7 @@ class ha extends ne {
|
|
|
11654
11863
|
})
|
|
11655
11864
|
), !this.editor.prosemirrorView)
|
|
11656
11865
|
throw new Error("Editor view not initialized.");
|
|
11657
|
-
|
|
11866
|
+
yt(this.editor.prosemirrorView.root), o.dataTransfer.setDragImage(M, 0, 0), o.dataTransfer.effectAllowed = "move";
|
|
11658
11867
|
});
|
|
11659
11868
|
/**
|
|
11660
11869
|
* Callback that should be set on the `dragStart` event for whichever element
|
|
@@ -11678,7 +11887,7 @@ class ha extends ne {
|
|
|
11678
11887
|
})
|
|
11679
11888
|
), !this.editor.prosemirrorView)
|
|
11680
11889
|
throw new Error("Editor view not initialized.");
|
|
11681
|
-
|
|
11890
|
+
yt(this.editor.prosemirrorView.root), o.dataTransfer.setDragImage(M, 0, 0), o.dataTransfer.effectAllowed = "copyMove";
|
|
11682
11891
|
});
|
|
11683
11892
|
/**
|
|
11684
11893
|
* Callback that should be set on the `dragEnd` event for both the element
|
|
@@ -11693,7 +11902,7 @@ class ha extends ne {
|
|
|
11693
11902
|
this.editor._tiptapEditor.state.tr.setMeta(se, null)
|
|
11694
11903
|
), !this.editor.prosemirrorView)
|
|
11695
11904
|
throw new Error("Editor view not initialized.");
|
|
11696
|
-
|
|
11905
|
+
ca(this.editor.prosemirrorView.root);
|
|
11697
11906
|
});
|
|
11698
11907
|
/**
|
|
11699
11908
|
* Freezes the drag handles. When frozen, they will stay attached to the same
|
|
@@ -11711,7 +11920,7 @@ class ha extends ne {
|
|
|
11711
11920
|
});
|
|
11712
11921
|
this.editor = o, this.plugin = new B({
|
|
11713
11922
|
key: se,
|
|
11714
|
-
view: (i) => (this.view = new
|
|
11923
|
+
view: (i) => (this.view = new ha(o, i, (n) => {
|
|
11715
11924
|
this.emit("update", n);
|
|
11716
11925
|
}), this.view),
|
|
11717
11926
|
// We use decorations to render the drop cursor when dragging a table row
|
|
@@ -11737,7 +11946,7 @@ class ha extends ne {
|
|
|
11737
11946
|
), h = u.node(), m = u.pos + (n > this.view.state.draggingState.originalIndex ? h.nodeSize - 2 : 0);
|
|
11738
11947
|
r.push(
|
|
11739
11948
|
// The widget is a small bar which spans the width of the cell.
|
|
11740
|
-
|
|
11949
|
+
X.widget(m, () => {
|
|
11741
11950
|
const f = document.createElement("div");
|
|
11742
11951
|
return f.className = "bn-table-drop-cursor", f.style.left = "0", f.style.right = "0", n > this.view.state.draggingState.originalIndex ? f.style.bottom = "-2px" : f.style.top = "-3px", f.style.height = "4px", f;
|
|
11743
11952
|
})
|
|
@@ -11752,7 +11961,7 @@ class ha extends ne {
|
|
|
11752
11961
|
), u = c.node(), h = c.pos + (n > this.view.state.draggingState.originalIndex ? u.nodeSize - 2 : 0);
|
|
11753
11962
|
r.push(
|
|
11754
11963
|
// The widget is a small bar which spans the height of the cell.
|
|
11755
|
-
|
|
11964
|
+
X.widget(h, () => {
|
|
11756
11965
|
const m = document.createElement("div");
|
|
11757
11966
|
return m.className = "bn-table-drop-cursor", m.style.top = "0", m.style.bottom = "0", n > this.view.state.draggingState.originalIndex ? m.style.right = "-2px" : m.style.left = "-3px", m.style.width = "4px", m;
|
|
11758
11967
|
})
|
|
@@ -11767,7 +11976,7 @@ class ha extends ne {
|
|
|
11767
11976
|
return this.on("update", o);
|
|
11768
11977
|
}
|
|
11769
11978
|
}
|
|
11770
|
-
const
|
|
11979
|
+
const fa = L.create({
|
|
11771
11980
|
name: "textAlignment",
|
|
11772
11981
|
addGlobalAttributes() {
|
|
11773
11982
|
return [
|
|
@@ -11793,7 +12002,7 @@ const ma = L.create({
|
|
|
11793
12002
|
}
|
|
11794
12003
|
];
|
|
11795
12004
|
}
|
|
11796
|
-
}),
|
|
12005
|
+
}), ga = L.create({
|
|
11797
12006
|
name: "blockTextColor",
|
|
11798
12007
|
addGlobalAttributes() {
|
|
11799
12008
|
return [
|
|
@@ -11801,9 +12010,9 @@ const ma = L.create({
|
|
|
11801
12010
|
types: ["blockContainer"],
|
|
11802
12011
|
attributes: {
|
|
11803
12012
|
textColor: {
|
|
11804
|
-
default:
|
|
11805
|
-
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") :
|
|
11806
|
-
renderHTML: (e) => e.textColor ===
|
|
12013
|
+
default: C.textColor.default,
|
|
12014
|
+
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : C.textColor.default,
|
|
12015
|
+
renderHTML: (e) => e.textColor === C.textColor.default ? {} : {
|
|
11807
12016
|
"data-text-color": e.textColor
|
|
11808
12017
|
}
|
|
11809
12018
|
}
|
|
@@ -11811,7 +12020,7 @@ const ma = L.create({
|
|
|
11811
12020
|
}
|
|
11812
12021
|
];
|
|
11813
12022
|
}
|
|
11814
|
-
}),
|
|
12023
|
+
}), ba = L.create({
|
|
11815
12024
|
name: "trailingNode",
|
|
11816
12025
|
addProseMirrorPlugins() {
|
|
11817
12026
|
const e = new N(this.name);
|
|
@@ -11846,13 +12055,13 @@ const ma = L.create({
|
|
|
11846
12055
|
})
|
|
11847
12056
|
];
|
|
11848
12057
|
}
|
|
11849
|
-
}),
|
|
12058
|
+
}), ka = {
|
|
11850
12059
|
blockColor: "data-block-color",
|
|
11851
12060
|
blockStyle: "data-block-style",
|
|
11852
12061
|
id: "data-id",
|
|
11853
12062
|
depth: "data-depth",
|
|
11854
12063
|
depthChange: "data-depth-change"
|
|
11855
|
-
},
|
|
12064
|
+
}, _a = Z.create({
|
|
11856
12065
|
name: "blockContainer",
|
|
11857
12066
|
group: "blockGroupChild bnBlock",
|
|
11858
12067
|
// A block always contains content, and optionally a blockGroup which contains nested blocks
|
|
@@ -11868,7 +12077,7 @@ const ma = L.create({
|
|
|
11868
12077
|
if (typeof e == "string")
|
|
11869
12078
|
return !1;
|
|
11870
12079
|
const t = {};
|
|
11871
|
-
for (const [o, i] of Object.entries(
|
|
12080
|
+
for (const [o, i] of Object.entries(ka))
|
|
11872
12081
|
e.getAttribute(i) && (t[o] = e.getAttribute(i));
|
|
11873
12082
|
return e.getAttribute("data-node-type") === "blockContainer" ? t : !1;
|
|
11874
12083
|
}
|
|
@@ -11893,7 +12102,7 @@ const ma = L.create({
|
|
|
11893
12102
|
contentDOM: i
|
|
11894
12103
|
};
|
|
11895
12104
|
}
|
|
11896
|
-
}),
|
|
12105
|
+
}), ya = Z.create({
|
|
11897
12106
|
name: "blockGroup",
|
|
11898
12107
|
group: "childContainer",
|
|
11899
12108
|
content: "blockGroupChild+",
|
|
@@ -11922,101 +12131,26 @@ const ma = L.create({
|
|
|
11922
12131
|
contentDOM: o
|
|
11923
12132
|
};
|
|
11924
12133
|
}
|
|
11925
|
-
}),
|
|
12134
|
+
}), va = Z.create({
|
|
11926
12135
|
name: "doc",
|
|
11927
12136
|
topNode: !0,
|
|
11928
12137
|
content: "blockGroup"
|
|
11929
|
-
}),
|
|
11930
|
-
var i;
|
|
11931
|
-
const t = [];
|
|
11932
|
-
t.push(
|
|
11933
|
-
Yo.configure({
|
|
11934
|
-
fragment: e.fragment
|
|
11935
|
-
})
|
|
11936
|
-
);
|
|
11937
|
-
const o = (i = e.provider) == null ? void 0 : i.awareness;
|
|
11938
|
-
if (o) {
|
|
11939
|
-
const n = /* @__PURE__ */ new Map();
|
|
11940
|
-
e.showCursorLabels !== "always" && o.on(
|
|
11941
|
-
"change",
|
|
11942
|
-
({
|
|
11943
|
-
updated: s
|
|
11944
|
-
}) => {
|
|
11945
|
-
for (const l of s) {
|
|
11946
|
-
const d = n.get(l);
|
|
11947
|
-
d && (d.element.setAttribute("data-active", ""), d.hideTimeout && clearTimeout(d.hideTimeout), n.set(l, {
|
|
11948
|
-
element: d.element,
|
|
11949
|
-
hideTimeout: setTimeout(() => {
|
|
11950
|
-
d.element.removeAttribute("data-active");
|
|
11951
|
-
}, 2e3)
|
|
11952
|
-
}));
|
|
11953
|
-
}
|
|
11954
|
-
}
|
|
11955
|
-
);
|
|
11956
|
-
const r = (s) => {
|
|
11957
|
-
const l = document.createElement("span");
|
|
11958
|
-
l.classList.add("collaboration-cursor__base");
|
|
11959
|
-
const d = document.createElement("span");
|
|
11960
|
-
d.setAttribute("contentedEditable", "false"), d.classList.add("collaboration-cursor__caret"), d.setAttribute("style", `background-color: ${s.color}`);
|
|
11961
|
-
const c = document.createElement("span");
|
|
11962
|
-
return c.classList.add("collaboration-cursor__label"), c.setAttribute("style", `background-color: ${s.color}`), c.insertBefore(document.createTextNode(s.name), null), d.insertBefore(c, null), l.insertBefore(document.createTextNode(""), null), l.insertBefore(d, null), l.insertBefore(document.createTextNode(""), null), l;
|
|
11963
|
-
}, a = (s) => {
|
|
11964
|
-
var u;
|
|
11965
|
-
const l = [...o.getStates().entries()].find(
|
|
11966
|
-
(h) => h[1].user === s
|
|
11967
|
-
);
|
|
11968
|
-
if (!l)
|
|
11969
|
-
throw new Error("Could not find client state for user");
|
|
11970
|
-
const d = l[0];
|
|
11971
|
-
let c = n.get(d);
|
|
11972
|
-
if (!c) {
|
|
11973
|
-
const h = ((u = e == null ? void 0 : e.renderCursor) == null ? void 0 : u.call(e, s)) || r(s);
|
|
11974
|
-
(e == null ? void 0 : e.showCursorLabels) !== "always" && (h.addEventListener("mouseenter", () => {
|
|
11975
|
-
const m = n.get(d);
|
|
11976
|
-
m.element.setAttribute("data-active", ""), m.hideTimeout && (clearTimeout(m.hideTimeout), n.set(d, {
|
|
11977
|
-
element: m.element,
|
|
11978
|
-
hideTimeout: void 0
|
|
11979
|
-
}));
|
|
11980
|
-
}), h.addEventListener("mouseleave", () => {
|
|
11981
|
-
const m = n.get(d);
|
|
11982
|
-
n.set(d, {
|
|
11983
|
-
element: m.element,
|
|
11984
|
-
hideTimeout: setTimeout(() => {
|
|
11985
|
-
m.element.removeAttribute("data-active");
|
|
11986
|
-
}, 2e3)
|
|
11987
|
-
});
|
|
11988
|
-
})), c = {
|
|
11989
|
-
element: h,
|
|
11990
|
-
hideTimeout: void 0
|
|
11991
|
-
}, n.set(d, c);
|
|
11992
|
-
}
|
|
11993
|
-
return c.element;
|
|
11994
|
-
};
|
|
11995
|
-
t.push(
|
|
11996
|
-
Qo.configure({
|
|
11997
|
-
user: e.user,
|
|
11998
|
-
render: a,
|
|
11999
|
-
provider: e.provider
|
|
12000
|
-
})
|
|
12001
|
-
);
|
|
12002
|
-
}
|
|
12003
|
-
return t;
|
|
12004
|
-
}, wa = (e) => {
|
|
12138
|
+
}), wa = (e) => {
|
|
12005
12139
|
const t = {}, o = xa(e);
|
|
12006
12140
|
for (const n of o)
|
|
12007
12141
|
t[n.name] = n;
|
|
12008
|
-
t.formattingToolbar = new
|
|
12142
|
+
t.formattingToolbar = new Rr(
|
|
12009
12143
|
e.editor
|
|
12010
|
-
), t.linkToolbar = new
|
|
12144
|
+
), t.linkToolbar = new Wr(e.editor), t.sideMenu = new aa(
|
|
12011
12145
|
e.editor,
|
|
12012
12146
|
e.sideMenuDetection
|
|
12013
|
-
), t.suggestionMenus = new
|
|
12147
|
+
), t.suggestionMenus = new da(e.editor), t.filePanel = new Hr(e.editor), t.placeholder = new Yr(e.editor, e.placeholders), (e.animations ?? !0) && (t.animations = new ea()), e.tableHandles && (t.tableHandles = new ma(e.editor)), t.dropCursor = {
|
|
12014
12148
|
plugin: e.dropCursor({
|
|
12015
12149
|
width: 5,
|
|
12016
12150
|
color: "#ddeeff",
|
|
12017
12151
|
editor: e.editor
|
|
12018
12152
|
})
|
|
12019
|
-
}, t.nodeSelectionKeyboard = new
|
|
12153
|
+
}, t.nodeSelectionKeyboard = new Zr();
|
|
12020
12154
|
const i = e.disableExtensions || [];
|
|
12021
12155
|
for (const n of i)
|
|
12022
12156
|
delete t[n];
|
|
@@ -12044,13 +12178,15 @@ const ma = L.create({
|
|
|
12044
12178
|
Xo.extend({
|
|
12045
12179
|
inclusive: !1
|
|
12046
12180
|
}).configure({
|
|
12047
|
-
defaultProtocol:
|
|
12048
|
-
protocols:
|
|
12181
|
+
defaultProtocol: qr,
|
|
12182
|
+
protocols: Kr
|
|
12049
12183
|
}),
|
|
12050
|
-
...Object.values(e.styleSpecs).map((o) => o.implementation.mark
|
|
12051
|
-
|
|
12184
|
+
...Object.values(e.styleSpecs).map((o) => o.implementation.mark.configure({
|
|
12185
|
+
editor: e.editor
|
|
12186
|
+
})),
|
|
12187
|
+
ga,
|
|
12052
12188
|
Nr,
|
|
12053
|
-
|
|
12189
|
+
fa,
|
|
12054
12190
|
// make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)
|
|
12055
12191
|
L.create({
|
|
12056
12192
|
name: "OverrideEscape",
|
|
@@ -12061,16 +12197,16 @@ const ma = L.create({
|
|
|
12061
12197
|
}
|
|
12062
12198
|
}),
|
|
12063
12199
|
// nodes
|
|
12064
|
-
|
|
12065
|
-
|
|
12200
|
+
va,
|
|
12201
|
+
_a.configure({
|
|
12066
12202
|
editor: e.editor,
|
|
12067
12203
|
domAttributes: e.domAttributes
|
|
12068
12204
|
}),
|
|
12069
|
-
|
|
12205
|
+
Fr.configure({
|
|
12070
12206
|
editor: e.editor,
|
|
12071
12207
|
tabBehavior: e.tabBehavior
|
|
12072
12208
|
}),
|
|
12073
|
-
|
|
12209
|
+
ya.configure({
|
|
12074
12210
|
domAttributes: e.domAttributes
|
|
12075
12211
|
}),
|
|
12076
12212
|
...Object.values(e.inlineContentSpecs).filter((o) => o.config !== "link" && o.config !== "text").map((o) => o.implementation.node.configure({
|
|
@@ -12095,9 +12231,9 @@ const ma = L.create({
|
|
|
12095
12231
|
Mr(e.editor),
|
|
12096
12232
|
// This needs to be at the bottom of this list, because Key events (such as enter, when selecting a /command),
|
|
12097
12233
|
// should be handled before Enter handlers in other components like splitListItem
|
|
12098
|
-
...e.trailingBlock === void 0 || e.trailingBlock ? [
|
|
12234
|
+
...e.trailingBlock === void 0 || e.trailingBlock ? [ba] : []
|
|
12099
12235
|
];
|
|
12100
|
-
return e.collaboration ? t.push(...
|
|
12236
|
+
return e.collaboration ? t.push(...jr(e.collaboration)) : t.push(qo), t;
|
|
12101
12237
|
};
|
|
12102
12238
|
function Ca(e, t) {
|
|
12103
12239
|
const o = [];
|
|
@@ -12156,18 +12292,17 @@ function Ba(e, t) {
|
|
|
12156
12292
|
}
|
|
12157
12293
|
return !0;
|
|
12158
12294
|
}
|
|
12159
|
-
const we = class we extends
|
|
12295
|
+
const we = class we extends Bo {
|
|
12160
12296
|
constructor(o, i) {
|
|
12161
12297
|
super({ ...o, content: void 0 });
|
|
12162
12298
|
p(this, "_state");
|
|
12163
|
-
p(this, "_creating", !1);
|
|
12164
12299
|
/**
|
|
12165
12300
|
* Mounts / unmounts the editor to a dom element
|
|
12166
12301
|
*
|
|
12167
12302
|
* @param element DOM element to mount to, ur null / undefined to destroy
|
|
12168
12303
|
*/
|
|
12169
|
-
p(this, "mount", (o) => {
|
|
12170
|
-
o ? (this.options.element = o, this.createViewAlternative()) :
|
|
12304
|
+
p(this, "mount", (o, i) => {
|
|
12305
|
+
o ? (this.options.element = o, this.createViewAlternative(i)) : this.destroy();
|
|
12171
12306
|
});
|
|
12172
12307
|
const n = this.schema;
|
|
12173
12308
|
let r;
|
|
@@ -12176,14 +12311,14 @@ const we = class we extends So {
|
|
|
12176
12311
|
if (r)
|
|
12177
12312
|
return r;
|
|
12178
12313
|
const d = a.apply(n.nodes.doc, l), c = JSON.parse(JSON.stringify(d.toJSON()));
|
|
12179
|
-
return c.content[0].content[0].attrs.id = "initialBlockId", r =
|
|
12314
|
+
return c.content[0].content[0].attrs.id = "initialBlockId", r = _o.fromJSON(n, c), r;
|
|
12180
12315
|
};
|
|
12181
12316
|
let s;
|
|
12182
12317
|
try {
|
|
12183
12318
|
const l = o == null ? void 0 : o.content.map(
|
|
12184
|
-
(d) =>
|
|
12319
|
+
(d) => J(d, this.schema, i).toJSON()
|
|
12185
12320
|
);
|
|
12186
|
-
s =
|
|
12321
|
+
s = To(
|
|
12187
12322
|
{
|
|
12188
12323
|
type: "doc",
|
|
12189
12324
|
content: [
|
|
@@ -12204,7 +12339,7 @@ const we = class we extends So {
|
|
|
12204
12339
|
"Error creating document from blocks passed as `initialContent`:\n" + +JSON.stringify(o.content)
|
|
12205
12340
|
);
|
|
12206
12341
|
}
|
|
12207
|
-
this._state =
|
|
12342
|
+
this._state = Io.create({
|
|
12208
12343
|
doc: s,
|
|
12209
12344
|
schema: this.schema
|
|
12210
12345
|
// selection: selection || undefined,
|
|
@@ -12219,25 +12354,26 @@ const we = class we extends So {
|
|
|
12219
12354
|
/**
|
|
12220
12355
|
* Replace the default `createView` method with a custom one - which we call on mount
|
|
12221
12356
|
*/
|
|
12222
|
-
createViewAlternative() {
|
|
12223
|
-
this.
|
|
12224
|
-
|
|
12225
|
-
|
|
12226
|
-
|
|
12227
|
-
|
|
12228
|
-
|
|
12229
|
-
|
|
12230
|
-
|
|
12231
|
-
|
|
12232
|
-
|
|
12233
|
-
|
|
12234
|
-
|
|
12235
|
-
|
|
12236
|
-
|
|
12237
|
-
|
|
12238
|
-
|
|
12239
|
-
|
|
12357
|
+
createViewAlternative(o) {
|
|
12358
|
+
this.contentComponent = o;
|
|
12359
|
+
const i = {};
|
|
12360
|
+
this.extensionManager.extensions.forEach((r) => {
|
|
12361
|
+
r.type === "mark" && r.config.addMarkView && (i[r.name] = r.config.addMarkView);
|
|
12362
|
+
}), this.view = new Qo(
|
|
12363
|
+
{ mount: this.options.element },
|
|
12364
|
+
// use mount option so that we reuse the existing element instead of creating a new one
|
|
12365
|
+
{
|
|
12366
|
+
...this.options.editorProps,
|
|
12367
|
+
// @ts-ignore
|
|
12368
|
+
dispatchTransaction: this.dispatchTransaction.bind(this),
|
|
12369
|
+
state: this.state,
|
|
12370
|
+
markViews: i
|
|
12371
|
+
}
|
|
12372
|
+
);
|
|
12373
|
+
const n = this.state.reconfigure({
|
|
12374
|
+
plugins: this.extensionManager.plugins
|
|
12240
12375
|
});
|
|
12376
|
+
this.view.updateState(n), this.createNodeViews(), this.commands.focus(this.options.autofocus), this.emit("create", { editor: this }), this.isInitialized = !0;
|
|
12241
12377
|
}
|
|
12242
12378
|
};
|
|
12243
12379
|
p(we, "create", (o, i) => {
|
|
@@ -12259,7 +12395,7 @@ const Ta = {
|
|
|
12259
12395
|
enablePasteRules: !0,
|
|
12260
12396
|
enableCoreExtensions: !1
|
|
12261
12397
|
};
|
|
12262
|
-
class
|
|
12398
|
+
class fo {
|
|
12263
12399
|
constructor(t) {
|
|
12264
12400
|
p(this, "_pmSchema");
|
|
12265
12401
|
/**
|
|
@@ -12322,10 +12458,10 @@ class mo {
|
|
|
12322
12458
|
*
|
|
12323
12459
|
* @warning Not needed to call manually when using React, use BlockNoteView to take care of mounting
|
|
12324
12460
|
*/
|
|
12325
|
-
p(this, "mount", (t) => {
|
|
12326
|
-
this._tiptapEditor.mount(t);
|
|
12461
|
+
p(this, "mount", (t, o) => {
|
|
12462
|
+
this._tiptapEditor.mount(t, o);
|
|
12327
12463
|
});
|
|
12328
|
-
var
|
|
12464
|
+
var l, d, c, u, h, m, f;
|
|
12329
12465
|
this.options = t;
|
|
12330
12466
|
const o = t;
|
|
12331
12467
|
if (o.onEditorContentChange)
|
|
@@ -12344,7 +12480,7 @@ class mo {
|
|
|
12344
12480
|
throw new Error(
|
|
12345
12481
|
"editable initialization option is deprecated, use <BlockNoteView editable={true/false} />, or alternatively editor.isEditable = true/false"
|
|
12346
12482
|
);
|
|
12347
|
-
this.dictionary = t.dictionary ||
|
|
12483
|
+
this.dictionary = t.dictionary || St;
|
|
12348
12484
|
const i = {
|
|
12349
12485
|
defaultStyles: !0,
|
|
12350
12486
|
schema: t.schema || fe.create(),
|
|
@@ -12371,29 +12507,31 @@ class mo {
|
|
|
12371
12507
|
placeholders: i.placeholders,
|
|
12372
12508
|
tabBehavior: i.tabBehavior,
|
|
12373
12509
|
sideMenuDetection: i.sideMenuDetection || "viewport"
|
|
12374
|
-
}), (((
|
|
12375
|
-
this.extensions[
|
|
12376
|
-
}), Object.entries(i._extensions || {}).forEach(([
|
|
12377
|
-
typeof
|
|
12510
|
+
}), (((l = i._tiptapOptions) == null ? void 0 : l.extensions) || []).forEach((g) => {
|
|
12511
|
+
this.extensions[g.name] = g;
|
|
12512
|
+
}), Object.entries(i._extensions || {}).forEach(([g, b]) => {
|
|
12513
|
+
typeof b == "function" && (b = b(this)), this.extensions[g] = b;
|
|
12378
12514
|
}), this.formattingToolbar = this.extensions.formattingToolbar, this.linkToolbar = this.extensions.linkToolbar, this.sideMenu = this.extensions.sideMenu, this.suggestionMenus = this.extensions.suggestionMenus, this.filePanel = this.extensions.filePanel, this.tableHandles = this.extensions.tableHandles, i.uploadFile) {
|
|
12379
|
-
const
|
|
12380
|
-
this.uploadFile = async (
|
|
12515
|
+
const g = i.uploadFile;
|
|
12516
|
+
this.uploadFile = async (b, k) => {
|
|
12381
12517
|
this.onUploadStartCallbacks.forEach(
|
|
12382
|
-
(
|
|
12518
|
+
(v) => v.apply(this, [k])
|
|
12383
12519
|
);
|
|
12384
12520
|
try {
|
|
12385
|
-
return await
|
|
12521
|
+
return await g(b, k);
|
|
12386
12522
|
} finally {
|
|
12387
12523
|
this.onUploadEndCallbacks.forEach(
|
|
12388
|
-
(
|
|
12524
|
+
(v) => v.apply(this, [k])
|
|
12389
12525
|
);
|
|
12390
12526
|
}
|
|
12391
12527
|
};
|
|
12392
12528
|
}
|
|
12393
|
-
this.resolveFileUrl = i.resolveFileUrl, this.headless = i._headless
|
|
12529
|
+
this.resolveFileUrl = i.resolveFileUrl, this.headless = i._headless;
|
|
12530
|
+
const n = "collaboration" in this.extensions || "liveblocksExtension" in this.extensions;
|
|
12531
|
+
n && i.initialContent && console.warn(
|
|
12394
12532
|
"When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"
|
|
12395
12533
|
);
|
|
12396
|
-
const
|
|
12534
|
+
const r = i.initialContent || (n ? [
|
|
12397
12535
|
{
|
|
12398
12536
|
type: "paragraph",
|
|
12399
12537
|
id: "initialBlockId"
|
|
@@ -12404,48 +12542,48 @@ class mo {
|
|
|
12404
12542
|
id: ue.options.generateID()
|
|
12405
12543
|
}
|
|
12406
12544
|
]);
|
|
12407
|
-
if (!Array.isArray(
|
|
12545
|
+
if (!Array.isArray(r) || r.length === 0)
|
|
12408
12546
|
throw new Error(
|
|
12409
|
-
"initialContent must be a non-empty array of blocks, received: " +
|
|
12547
|
+
"initialContent must be a non-empty array of blocks, received: " + r
|
|
12410
12548
|
);
|
|
12411
|
-
const
|
|
12412
|
-
...Object.entries(this.extensions).map(([
|
|
12413
|
-
if (
|
|
12414
|
-
return
|
|
12415
|
-
if (!
|
|
12549
|
+
const a = [
|
|
12550
|
+
...Object.entries(this.extensions).map(([g, b]) => {
|
|
12551
|
+
if (b instanceof L || b instanceof Z || b instanceof xe)
|
|
12552
|
+
return b;
|
|
12553
|
+
if (!b.plugin)
|
|
12416
12554
|
throw new Error(
|
|
12417
12555
|
"Extension should either be a TipTap extension or a ProseMirror plugin in a plugin property"
|
|
12418
12556
|
);
|
|
12419
12557
|
return L.create({
|
|
12420
|
-
name:
|
|
12421
|
-
addProseMirrorPlugins: () => [
|
|
12558
|
+
name: g,
|
|
12559
|
+
addProseMirrorPlugins: () => [b.plugin]
|
|
12422
12560
|
});
|
|
12423
12561
|
})
|
|
12424
|
-
],
|
|
12562
|
+
], s = {
|
|
12425
12563
|
...Ta,
|
|
12426
12564
|
...i._tiptapOptions,
|
|
12427
|
-
content:
|
|
12428
|
-
extensions:
|
|
12565
|
+
content: r,
|
|
12566
|
+
extensions: a,
|
|
12429
12567
|
editorProps: {
|
|
12430
|
-
...(
|
|
12568
|
+
...(d = i._tiptapOptions) == null ? void 0 : d.editorProps,
|
|
12431
12569
|
attributes: {
|
|
12432
12570
|
// As of TipTap v2.5.0 the tabIndex is removed when the editor is not
|
|
12433
12571
|
// editable, so you can't focus it. We want to revert this as we have
|
|
12434
12572
|
// UI behaviour that relies on it.
|
|
12435
12573
|
tabIndex: "0",
|
|
12436
|
-
...(
|
|
12437
|
-
...(
|
|
12574
|
+
...(u = (c = i._tiptapOptions) == null ? void 0 : c.editorProps) == null ? void 0 : u.attributes,
|
|
12575
|
+
...(h = i.domAttributes) == null ? void 0 : h.editor,
|
|
12438
12576
|
class: G(
|
|
12439
12577
|
"bn-editor",
|
|
12440
12578
|
i.defaultStyles ? "bn-default-styles" : "",
|
|
12441
|
-
((
|
|
12579
|
+
((f = (m = i.domAttributes) == null ? void 0 : m.editor) == null ? void 0 : f.class) || ""
|
|
12442
12580
|
)
|
|
12443
12581
|
},
|
|
12444
12582
|
transformPasted: Sa
|
|
12445
12583
|
}
|
|
12446
12584
|
};
|
|
12447
|
-
this.headless ? this._pmSchema =
|
|
12448
|
-
|
|
12585
|
+
this.headless ? this._pmSchema = Mo(s.extensions) : (this._tiptapEditor = ve.create(
|
|
12586
|
+
s,
|
|
12449
12587
|
this.schema.styleSchema
|
|
12450
12588
|
), this._pmSchema = this._tiptapEditor.schema);
|
|
12451
12589
|
}
|
|
@@ -12453,7 +12591,7 @@ class mo {
|
|
|
12453
12591
|
return this._pmSchema;
|
|
12454
12592
|
}
|
|
12455
12593
|
static create(t = {}) {
|
|
12456
|
-
return new
|
|
12594
|
+
return new fo(t);
|
|
12457
12595
|
}
|
|
12458
12596
|
dispatch(t) {
|
|
12459
12597
|
this._tiptapEditor.dispatch(t);
|
|
@@ -12498,7 +12636,7 @@ class mo {
|
|
|
12498
12636
|
get document() {
|
|
12499
12637
|
const t = [];
|
|
12500
12638
|
return this._tiptapEditor.state.doc.firstChild.descendants((o) => (t.push(
|
|
12501
|
-
|
|
12639
|
+
w(
|
|
12502
12640
|
o,
|
|
12503
12641
|
this.schema.blockSchema,
|
|
12504
12642
|
this.schema.inlineContentSchema,
|
|
@@ -12598,7 +12736,7 @@ class mo {
|
|
|
12598
12736
|
* @param placement Whether the text cursor should be placed at the start or end of the block.
|
|
12599
12737
|
*/
|
|
12600
12738
|
setTextCursorPosition(t, o = "start") {
|
|
12601
|
-
|
|
12739
|
+
ro(this, t, o);
|
|
12602
12740
|
}
|
|
12603
12741
|
/**
|
|
12604
12742
|
* Gets a snapshot of the current selection.
|
|
@@ -12677,7 +12815,7 @@ class mo {
|
|
|
12677
12815
|
* @param content can be a string, or array of partial inline content elements
|
|
12678
12816
|
*/
|
|
12679
12817
|
insertInlineContent(t) {
|
|
12680
|
-
const o =
|
|
12818
|
+
const o = H(
|
|
12681
12819
|
t,
|
|
12682
12820
|
this.pmSchema,
|
|
12683
12821
|
this.schema.styleSchema
|
|
@@ -12699,7 +12837,9 @@ class mo {
|
|
|
12699
12837
|
for (const i of o) {
|
|
12700
12838
|
const n = this.schema.styleSchema[i.type.name];
|
|
12701
12839
|
if (!n) {
|
|
12702
|
-
|
|
12840
|
+
// Links are not considered styles in blocknote
|
|
12841
|
+
i.type.name !== "link" && // "blocknoteIgnore" tagged marks (such as comments) are also not considered BlockNote "styles"
|
|
12842
|
+
!i.type.spec.blocknoteIgnore && console.warn("mark not found in styleschema", i.type.name);
|
|
12703
12843
|
continue;
|
|
12704
12844
|
}
|
|
12705
12845
|
n.propSchema === "boolean" ? t[n.type] = !0 : t[n.type] = i.attrs.stringValue;
|
|
@@ -12788,7 +12928,7 @@ class mo {
|
|
|
12788
12928
|
* Nests the block containing the text cursor into the block above it.
|
|
12789
12929
|
*/
|
|
12790
12930
|
nestBlock() {
|
|
12791
|
-
|
|
12931
|
+
io(this);
|
|
12792
12932
|
}
|
|
12793
12933
|
/**
|
|
12794
12934
|
* Checks if the block containing the text cursor is nested.
|
|
@@ -12848,7 +12988,7 @@ class mo {
|
|
|
12848
12988
|
* @returns The blocks parsed from the HTML string.
|
|
12849
12989
|
*/
|
|
12850
12990
|
async tryParseHTMLToBlocks(t) {
|
|
12851
|
-
return
|
|
12991
|
+
return so(
|
|
12852
12992
|
t,
|
|
12853
12993
|
this.schema.blockSchema,
|
|
12854
12994
|
this.schema.inlineContentSchema,
|
|
@@ -13088,7 +13228,7 @@ function Ne(e = "") {
|
|
|
13088
13228
|
] : e;
|
|
13089
13229
|
}
|
|
13090
13230
|
function le(e) {
|
|
13091
|
-
return typeof e == "string" ? Ne(e) : Array.isArray(e) ? e.flatMap((t) => typeof t == "string" ? Ne(t) :
|
|
13231
|
+
return typeof e == "string" ? Ne(e) : Array.isArray(e) ? e.flatMap((t) => typeof t == "string" ? Ne(t) : Bt(t) ? {
|
|
13092
13232
|
...t,
|
|
13093
13233
|
content: Ne(t.content)
|
|
13094
13234
|
} : de(t) ? t : {
|
|
@@ -13108,10 +13248,10 @@ function le(e) {
|
|
|
13108
13248
|
}
|
|
13109
13249
|
function Is(e, t) {
|
|
13110
13250
|
return t.map(
|
|
13111
|
-
(o) =>
|
|
13251
|
+
(o) => go(e.blockSchema, o)
|
|
13112
13252
|
);
|
|
13113
13253
|
}
|
|
13114
|
-
function
|
|
13254
|
+
function go(e, t) {
|
|
13115
13255
|
var n;
|
|
13116
13256
|
const o = e[t.type].content, i = {
|
|
13117
13257
|
id: "",
|
|
@@ -13142,7 +13282,7 @@ function fo(e, t) {
|
|
|
13142
13282
|
return {
|
|
13143
13283
|
...i,
|
|
13144
13284
|
content: le(i.content),
|
|
13145
|
-
children: i.children.map((r) =>
|
|
13285
|
+
children: i.children.map((r) => go(e, r))
|
|
13146
13286
|
};
|
|
13147
13287
|
}
|
|
13148
13288
|
function Ma(e) {
|
|
@@ -13154,36 +13294,36 @@ function Ia(e) {
|
|
|
13154
13294
|
}
|
|
13155
13295
|
export {
|
|
13156
13296
|
$i as AudioBlock,
|
|
13157
|
-
|
|
13297
|
+
fo as BlockNoteEditor,
|
|
13158
13298
|
fe as BlockNoteSchema,
|
|
13159
13299
|
Es as COLORS_DARK_MODE_DEFAULT,
|
|
13160
13300
|
Cs as COLORS_DEFAULT,
|
|
13161
13301
|
Wi as CodeBlock,
|
|
13162
|
-
|
|
13302
|
+
qr as DEFAULT_LINK_PROTOCOL,
|
|
13163
13303
|
ps as EMPTY_CELL_HEIGHT,
|
|
13164
|
-
|
|
13304
|
+
qt as EMPTY_CELL_WIDTH,
|
|
13165
13305
|
Ss as Exporter,
|
|
13166
13306
|
Oi as FILE_AUDIO_ICON_SVG,
|
|
13167
|
-
|
|
13307
|
+
Hi as FILE_ICON_SVG,
|
|
13168
13308
|
hn as FILE_IMAGE_ICON_SVG,
|
|
13169
|
-
|
|
13309
|
+
Un as FILE_VIDEO_ICON_SVG,
|
|
13170
13310
|
ln as FileBlock,
|
|
13171
|
-
|
|
13172
|
-
|
|
13173
|
-
|
|
13311
|
+
Hr as FilePanelProsemirrorPlugin,
|
|
13312
|
+
Dr as FilePanelView,
|
|
13313
|
+
Rr as FormattingToolbarProsemirrorPlugin,
|
|
13174
13314
|
Ur as FormattingToolbarView,
|
|
13175
|
-
|
|
13315
|
+
so as HTMLToBlocks,
|
|
13176
13316
|
_n as ImageBlock,
|
|
13177
|
-
|
|
13317
|
+
Wr as LinkToolbarProsemirrorPlugin,
|
|
13178
13318
|
Ji as PageBreak,
|
|
13179
|
-
|
|
13180
|
-
|
|
13181
|
-
|
|
13182
|
-
|
|
13183
|
-
|
|
13319
|
+
aa as SideMenuProsemirrorPlugin,
|
|
13320
|
+
na as SideMenuView,
|
|
13321
|
+
da as SuggestionMenuProseMirrorPlugin,
|
|
13322
|
+
ma as TableHandlesProsemirrorPlugin,
|
|
13323
|
+
ha as TableHandlesView,
|
|
13184
13324
|
ue as UniqueID,
|
|
13185
13325
|
D as UnreachableCaseError,
|
|
13186
|
-
|
|
13326
|
+
Kr as VALID_LINK_PROTOCOLS,
|
|
13187
13327
|
Gn as VideoBlock,
|
|
13188
13328
|
Ma as addIdsToBlock,
|
|
13189
13329
|
Ia as addIdsToBlocks,
|
|
@@ -13197,7 +13337,7 @@ export {
|
|
|
13197
13337
|
Ri as audioPropSchema,
|
|
13198
13338
|
zi as audioRender,
|
|
13199
13339
|
Gi as audioToExternalHTML,
|
|
13200
|
-
|
|
13340
|
+
J as blockToNode,
|
|
13201
13341
|
_r as blocksToMarkdown,
|
|
13202
13342
|
ye as camelToDataKebab,
|
|
13203
13343
|
bs as checkBlockHasDefaultProp,
|
|
@@ -13212,7 +13352,7 @@ export {
|
|
|
13212
13352
|
Xe as cleanHTMLToMarkdown,
|
|
13213
13353
|
Ms as combineByGroup,
|
|
13214
13354
|
Se as contentNodeToInlineContent,
|
|
13215
|
-
|
|
13355
|
+
Ht as contentNodeToTableContent,
|
|
13216
13356
|
Di as createAddFileButton,
|
|
13217
13357
|
me as createBlockSpec,
|
|
13218
13358
|
W as createBlockSpecFromStronglyTypedTiptapNode,
|
|
@@ -13220,30 +13360,30 @@ export {
|
|
|
13220
13360
|
Ee as createExternalHTMLExporter,
|
|
13221
13361
|
We as createFigureWithCaption,
|
|
13222
13362
|
$e as createFileBlockWrapper,
|
|
13223
|
-
|
|
13363
|
+
Ui as createFileNameWithIcon,
|
|
13224
13364
|
ds as createInlineContentSpec,
|
|
13225
13365
|
Li as createInlineContentSpecFromTipTapNode,
|
|
13226
|
-
|
|
13366
|
+
jt as createInternalBlockSpec,
|
|
13227
13367
|
Ci as createInternalHTMLSerializer,
|
|
13228
13368
|
Ii as createInternalInlineContentSpec,
|
|
13229
|
-
|
|
13369
|
+
Ot as createInternalStyleSpec,
|
|
13230
13370
|
Te as createLinkWithCaption,
|
|
13231
|
-
|
|
13371
|
+
Gt as createResizableFileBlockWrapper,
|
|
13232
13372
|
$ as createStronglyTypedTiptapNode,
|
|
13233
13373
|
cs as createStyleSpec,
|
|
13234
13374
|
K as createStyleSpecFromTipTapMark,
|
|
13235
13375
|
xs as createSuggestionMenu,
|
|
13236
13376
|
us as customizeCodeBlock,
|
|
13237
13377
|
$n as defaultBlockSchema,
|
|
13238
|
-
|
|
13378
|
+
Xt as defaultBlockSpecs,
|
|
13239
13379
|
rt as defaultBlockToHTML,
|
|
13240
13380
|
Oe as defaultCodeBlockPropSchema,
|
|
13241
13381
|
Wn as defaultInlineContentSchema,
|
|
13242
|
-
|
|
13243
|
-
|
|
13382
|
+
Jt as defaultInlineContentSpecs,
|
|
13383
|
+
C as defaultProps,
|
|
13244
13384
|
hs as defaultStyleSchema,
|
|
13245
|
-
|
|
13246
|
-
|
|
13385
|
+
Zt as defaultStyleSpecs,
|
|
13386
|
+
Q as esmDependencies,
|
|
13247
13387
|
nn as fileBlockConfig,
|
|
13248
13388
|
an as fileParse,
|
|
13249
13389
|
on as filePropSchema,
|
|
@@ -13252,14 +13392,14 @@ export {
|
|
|
13252
13392
|
ls as filenameFromURL,
|
|
13253
13393
|
_s as filterSuggestionItems,
|
|
13254
13394
|
V as formatKeyboardShortcut,
|
|
13255
|
-
|
|
13395
|
+
Or as formattingToolbarPluginKey,
|
|
13256
13396
|
Si as getBlockFromPos,
|
|
13257
13397
|
F as getBlockInfo,
|
|
13258
13398
|
pe as getBlockInfoFromResolvedPos,
|
|
13259
13399
|
_ as getBlockInfoFromSelection,
|
|
13260
13400
|
Ge as getBlockInfoWithManualOffset,
|
|
13261
13401
|
wa as getBlockNoteExtensions,
|
|
13262
|
-
|
|
13402
|
+
Dt as getBlockSchemaFromSpecs,
|
|
13263
13403
|
Ts as getDefaultEmojiPickerItems,
|
|
13264
13404
|
ks as getDefaultSlashMenuItems,
|
|
13265
13405
|
Ai as getInlineContentParseRules,
|
|
@@ -13269,41 +13409,41 @@ export {
|
|
|
13269
13409
|
vs as getPageBreakSlashMenuItems,
|
|
13270
13410
|
Ti as getParseRules,
|
|
13271
13411
|
ji as getStyleParseRules,
|
|
13272
|
-
|
|
13412
|
+
Rt as getStyleSchemaFromSpecs,
|
|
13273
13413
|
fn as imageBlockConfig,
|
|
13274
13414
|
bn as imageParse,
|
|
13275
13415
|
mn as imagePropSchema,
|
|
13276
13416
|
gn as imageRender,
|
|
13277
13417
|
kn as imageToExternalHTML,
|
|
13278
|
-
|
|
13418
|
+
Nt as inheritedProps,
|
|
13279
13419
|
qe as initializeESMDependencies,
|
|
13280
|
-
|
|
13420
|
+
H as inlineContentToNodes,
|
|
13281
13421
|
T as insertOrUpdateBlock,
|
|
13282
13422
|
Ei as isAppleOS,
|
|
13283
13423
|
it as isLinkInlineContent,
|
|
13284
|
-
|
|
13424
|
+
Bt as isPartialLinkInlineContent,
|
|
13285
13425
|
ss as isSafari,
|
|
13286
13426
|
de as isStyledTextInlineContent,
|
|
13287
|
-
|
|
13427
|
+
$r as linkToolbarPluginKey,
|
|
13288
13428
|
rs as locales,
|
|
13289
13429
|
Bs as mappingFactory,
|
|
13290
13430
|
Sr as markdownToBlocks,
|
|
13291
13431
|
G as mergeCSSClasses,
|
|
13292
|
-
|
|
13293
|
-
|
|
13432
|
+
w as nodeToBlock,
|
|
13433
|
+
Ue as nodeToCustomInlineContent,
|
|
13294
13434
|
Ki as pageBreakConfig,
|
|
13295
13435
|
Xi as pageBreakParse,
|
|
13296
13436
|
qi as pageBreakRender,
|
|
13297
|
-
|
|
13437
|
+
Yt as pageBreakSchema,
|
|
13298
13438
|
Zi as pageBreakToExternalHTML,
|
|
13299
13439
|
dt as parseEmbedElement,
|
|
13300
13440
|
Be as parseFigureElement,
|
|
13301
|
-
|
|
13441
|
+
go as partialBlockToBlockForTesting,
|
|
13302
13442
|
Is as partialBlocksToBlocksForTesting,
|
|
13303
13443
|
he as propsToAttributes,
|
|
13304
13444
|
Ie as shikiHighlighterPromiseSymbol,
|
|
13305
13445
|
lt as shikiParserSymbol,
|
|
13306
|
-
|
|
13446
|
+
ra as sideMenuPluginKey,
|
|
13307
13447
|
Pi as stylePropsToAttributes,
|
|
13308
13448
|
Ce as tableContentToNodes,
|
|
13309
13449
|
se as tableHandlesPluginKey,
|