@blocknote/core 0.23.6 → 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 +676 -542
- 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 +2 -2
- 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/nodeConversions/blockToNode.ts +5 -3
- package/src/api/nodeConversions/nodeToBlock.ts +11 -5
- 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/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,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var p = (e, t, o) =>
|
|
4
|
-
import { Slice as q, Fragment as j, DOMSerializer as vt, DOMParser as wt, Node as
|
|
5
|
-
import { Extension as L, combineTransactionSteps as
|
|
6
|
-
import { Plugin as B, PluginKey as N, TextSelection as U, NodeSelection as ce, Selection as Me, EditorState 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";
|
|
@@ -23,9 +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 Yo from "@tiptap/extension-collaboration";
|
|
28
|
-
import Qo from "
|
|
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";
|
|
29
29
|
import { dropCursor as ei } from "prosemirror-dropcursor";
|
|
30
30
|
const ti = {
|
|
31
31
|
slash_menu: {
|
|
@@ -286,6 +286,9 @@ const ti = {
|
|
|
286
286
|
},
|
|
287
287
|
align_justify: {
|
|
288
288
|
tooltip: "ضبط النص"
|
|
289
|
+
},
|
|
290
|
+
comment: {
|
|
291
|
+
tooltip: "إضافة ملاحظة"
|
|
289
292
|
}
|
|
290
293
|
},
|
|
291
294
|
file_panel: {
|
|
@@ -603,6 +606,9 @@ const ti = {
|
|
|
603
606
|
},
|
|
604
607
|
align_justify: {
|
|
605
608
|
tooltip: "Text Blocksatz"
|
|
609
|
+
},
|
|
610
|
+
comment: {
|
|
611
|
+
tooltip: "Kommentar hinzufügen"
|
|
606
612
|
}
|
|
607
613
|
},
|
|
608
614
|
file_panel: {
|
|
@@ -646,7 +652,7 @@ const ti = {
|
|
|
646
652
|
generic: {
|
|
647
653
|
ctrl_shortcut: "Strg"
|
|
648
654
|
}
|
|
649
|
-
},
|
|
655
|
+
}, St = {
|
|
650
656
|
slash_menu: {
|
|
651
657
|
heading: {
|
|
652
658
|
title: "Heading 1",
|
|
@@ -921,6 +927,9 @@ const ti = {
|
|
|
921
927
|
},
|
|
922
928
|
align_justify: {
|
|
923
929
|
tooltip: "Justify text"
|
|
930
|
+
},
|
|
931
|
+
comment: {
|
|
932
|
+
tooltip: "Add comment"
|
|
924
933
|
}
|
|
925
934
|
},
|
|
926
935
|
file_panel: {
|
|
@@ -1237,6 +1246,9 @@ const ti = {
|
|
|
1237
1246
|
},
|
|
1238
1247
|
align_justify: {
|
|
1239
1248
|
tooltip: "Justificar texto"
|
|
1249
|
+
},
|
|
1250
|
+
comment: {
|
|
1251
|
+
tooltip: "Agregar comentario"
|
|
1240
1252
|
}
|
|
1241
1253
|
},
|
|
1242
1254
|
file_panel: {
|
|
@@ -1576,6 +1588,9 @@ const ti = {
|
|
|
1576
1588
|
},
|
|
1577
1589
|
align_justify: {
|
|
1578
1590
|
tooltip: "Justifier le texte"
|
|
1591
|
+
},
|
|
1592
|
+
comment: {
|
|
1593
|
+
tooltip: "Ajouter un commentaire"
|
|
1579
1594
|
}
|
|
1580
1595
|
},
|
|
1581
1596
|
file_panel: {
|
|
@@ -1900,6 +1915,9 @@ const ti = {
|
|
|
1900
1915
|
},
|
|
1901
1916
|
align_justify: {
|
|
1902
1917
|
tooltip: "Poravnaj tekst obostrano"
|
|
1918
|
+
},
|
|
1919
|
+
comment: {
|
|
1920
|
+
tooltip: "Dodaj komentar"
|
|
1903
1921
|
}
|
|
1904
1922
|
},
|
|
1905
1923
|
file_panel: {
|
|
@@ -2209,6 +2227,9 @@ const ti = {
|
|
|
2209
2227
|
},
|
|
2210
2228
|
align_justify: {
|
|
2211
2229
|
tooltip: "Jafna texta"
|
|
2230
|
+
},
|
|
2231
|
+
comment: {
|
|
2232
|
+
tooltip: "Bæta við athugun"
|
|
2212
2233
|
}
|
|
2213
2234
|
},
|
|
2214
2235
|
file_panel: {
|
|
@@ -2521,6 +2542,9 @@ const ti = {
|
|
|
2521
2542
|
},
|
|
2522
2543
|
align_justify: {
|
|
2523
2544
|
tooltip: "Giustifica testo"
|
|
2545
|
+
},
|
|
2546
|
+
comment: {
|
|
2547
|
+
tooltip: "Aggiungi commento"
|
|
2524
2548
|
}
|
|
2525
2549
|
},
|
|
2526
2550
|
file_panel: {
|
|
@@ -2858,6 +2882,9 @@ const ti = {
|
|
|
2858
2882
|
},
|
|
2859
2883
|
align_justify: {
|
|
2860
2884
|
tooltip: "両端揃え"
|
|
2885
|
+
},
|
|
2886
|
+
comment: {
|
|
2887
|
+
tooltip: "コメントを追加"
|
|
2861
2888
|
}
|
|
2862
2889
|
},
|
|
2863
2890
|
file_panel: {
|
|
@@ -3188,6 +3215,9 @@ const ti = {
|
|
|
3188
3215
|
},
|
|
3189
3216
|
align_justify: {
|
|
3190
3217
|
tooltip: "텍스트 양쪽 맞춤"
|
|
3218
|
+
},
|
|
3219
|
+
comment: {
|
|
3220
|
+
tooltip: "코멘트 추가"
|
|
3191
3221
|
}
|
|
3192
3222
|
},
|
|
3193
3223
|
file_panel: {
|
|
@@ -3505,6 +3535,9 @@ const ti = {
|
|
|
3505
3535
|
},
|
|
3506
3536
|
align_justify: {
|
|
3507
3537
|
tooltip: "Tekst uitvullen"
|
|
3538
|
+
},
|
|
3539
|
+
comment: {
|
|
3540
|
+
tooltip: "Commentaar toevoegen"
|
|
3508
3541
|
}
|
|
3509
3542
|
},
|
|
3510
3543
|
file_panel: {
|
|
@@ -3806,6 +3839,9 @@ const ti = {
|
|
|
3806
3839
|
},
|
|
3807
3840
|
align_justify: {
|
|
3808
3841
|
tooltip: "Wyjustuj tekst"
|
|
3842
|
+
},
|
|
3843
|
+
comment: {
|
|
3844
|
+
tooltip: "Dodaj komentarz"
|
|
3809
3845
|
}
|
|
3810
3846
|
},
|
|
3811
3847
|
file_panel: {
|
|
@@ -4115,6 +4151,9 @@ const ti = {
|
|
|
4115
4151
|
},
|
|
4116
4152
|
align_justify: {
|
|
4117
4153
|
tooltip: "Justificar texto"
|
|
4154
|
+
},
|
|
4155
|
+
comment: {
|
|
4156
|
+
tooltip: "Adicionar comentário"
|
|
4118
4157
|
}
|
|
4119
4158
|
},
|
|
4120
4159
|
file_panel: {
|
|
@@ -4459,6 +4498,9 @@ const ti = {
|
|
|
4459
4498
|
},
|
|
4460
4499
|
align_justify: {
|
|
4461
4500
|
tooltip: "По середине текст"
|
|
4501
|
+
},
|
|
4502
|
+
comment: {
|
|
4503
|
+
tooltip: "Добавить комментарий"
|
|
4462
4504
|
}
|
|
4463
4505
|
},
|
|
4464
4506
|
file_panel: {
|
|
@@ -4525,19 +4567,45 @@ const ti = {
|
|
|
4525
4567
|
numbered_list: {
|
|
4526
4568
|
title: "Нумерований список",
|
|
4527
4569
|
subtext: "Список із впорядкованими елементами",
|
|
4528
|
-
aliases: [
|
|
4570
|
+
aliases: [
|
|
4571
|
+
"ol",
|
|
4572
|
+
"li",
|
|
4573
|
+
"list",
|
|
4574
|
+
"numberedlist",
|
|
4575
|
+
"numbered list",
|
|
4576
|
+
"список",
|
|
4577
|
+
"нумерований список"
|
|
4578
|
+
],
|
|
4529
4579
|
group: "Базові блоки"
|
|
4530
4580
|
},
|
|
4531
4581
|
bullet_list: {
|
|
4532
4582
|
title: "Маркований список",
|
|
4533
4583
|
subtext: "Список із невпорядкованими елементами",
|
|
4534
|
-
aliases: [
|
|
4584
|
+
aliases: [
|
|
4585
|
+
"ul",
|
|
4586
|
+
"li",
|
|
4587
|
+
"list",
|
|
4588
|
+
"bulletlist",
|
|
4589
|
+
"bullet list",
|
|
4590
|
+
"список",
|
|
4591
|
+
"маркований список"
|
|
4592
|
+
],
|
|
4535
4593
|
group: "Базові блоки"
|
|
4536
4594
|
},
|
|
4537
4595
|
check_list: {
|
|
4538
4596
|
title: "Чек-лист",
|
|
4539
4597
|
subtext: "Список із чекбоксами",
|
|
4540
|
-
aliases: [
|
|
4598
|
+
aliases: [
|
|
4599
|
+
"ul",
|
|
4600
|
+
"li",
|
|
4601
|
+
"list",
|
|
4602
|
+
"checklist",
|
|
4603
|
+
"check list",
|
|
4604
|
+
"checked list",
|
|
4605
|
+
"checkbox",
|
|
4606
|
+
"чекбокс",
|
|
4607
|
+
"чек-лист"
|
|
4608
|
+
],
|
|
4541
4609
|
group: "Базові блоки"
|
|
4542
4610
|
},
|
|
4543
4611
|
paragraph: {
|
|
@@ -4567,19 +4635,49 @@ const ti = {
|
|
|
4567
4635
|
image: {
|
|
4568
4636
|
title: "Зображення",
|
|
4569
4637
|
subtext: "Масштабоване зображення з підписом",
|
|
4570
|
-
aliases: [
|
|
4638
|
+
aliases: [
|
|
4639
|
+
"image",
|
|
4640
|
+
"imageUpload",
|
|
4641
|
+
"upload",
|
|
4642
|
+
"img",
|
|
4643
|
+
"picture",
|
|
4644
|
+
"media",
|
|
4645
|
+
"url",
|
|
4646
|
+
"зображення",
|
|
4647
|
+
"медіа"
|
|
4648
|
+
],
|
|
4571
4649
|
group: "Медіа"
|
|
4572
4650
|
},
|
|
4573
4651
|
video: {
|
|
4574
4652
|
title: "Відео",
|
|
4575
4653
|
subtext: "Масштабоване відео з підписом",
|
|
4576
|
-
aliases: [
|
|
4654
|
+
aliases: [
|
|
4655
|
+
"video",
|
|
4656
|
+
"videoUpload",
|
|
4657
|
+
"upload",
|
|
4658
|
+
"mp4",
|
|
4659
|
+
"film",
|
|
4660
|
+
"media",
|
|
4661
|
+
"url",
|
|
4662
|
+
"відео",
|
|
4663
|
+
"медіа"
|
|
4664
|
+
],
|
|
4577
4665
|
group: "Медіа"
|
|
4578
4666
|
},
|
|
4579
4667
|
audio: {
|
|
4580
4668
|
title: "Аудіо",
|
|
4581
4669
|
subtext: "Вбудоване аудіо з підписом",
|
|
4582
|
-
aliases: [
|
|
4670
|
+
aliases: [
|
|
4671
|
+
"audio",
|
|
4672
|
+
"audioUpload",
|
|
4673
|
+
"upload",
|
|
4674
|
+
"mp3",
|
|
4675
|
+
"sound",
|
|
4676
|
+
"media",
|
|
4677
|
+
"url",
|
|
4678
|
+
"аудіо",
|
|
4679
|
+
"медіа"
|
|
4680
|
+
],
|
|
4583
4681
|
group: "Медіа"
|
|
4584
4682
|
},
|
|
4585
4683
|
file: {
|
|
@@ -4745,6 +4843,9 @@ const ti = {
|
|
|
4745
4843
|
},
|
|
4746
4844
|
align_justify: {
|
|
4747
4845
|
tooltip: "Вирівняти за шириною"
|
|
4846
|
+
},
|
|
4847
|
+
comment: {
|
|
4848
|
+
tooltip: "Додати коментар"
|
|
4748
4849
|
}
|
|
4749
4850
|
},
|
|
4750
4851
|
file_panel: {
|
|
@@ -5061,6 +5162,9 @@ const ti = {
|
|
|
5061
5162
|
},
|
|
5062
5163
|
align_justify: {
|
|
5063
5164
|
tooltip: "Căn đều văn bản"
|
|
5165
|
+
},
|
|
5166
|
+
comment: {
|
|
5167
|
+
tooltip: "Thêm bình luận"
|
|
5064
5168
|
}
|
|
5065
5169
|
},
|
|
5066
5170
|
file_panel: {
|
|
@@ -5411,6 +5515,9 @@ const ti = {
|
|
|
5411
5515
|
},
|
|
5412
5516
|
align_justify: {
|
|
5413
5517
|
tooltip: "文本对齐"
|
|
5518
|
+
},
|
|
5519
|
+
comment: {
|
|
5520
|
+
tooltip: "添加评论"
|
|
5414
5521
|
}
|
|
5415
5522
|
},
|
|
5416
5523
|
file_panel: {
|
|
@@ -5458,7 +5565,7 @@ const ti = {
|
|
|
5458
5565
|
__proto__: null,
|
|
5459
5566
|
ar: ti,
|
|
5460
5567
|
de: oi,
|
|
5461
|
-
en:
|
|
5568
|
+
en: St,
|
|
5462
5569
|
es: ii,
|
|
5463
5570
|
fr: ni,
|
|
5464
5571
|
hr: ri,
|
|
@@ -5512,7 +5619,7 @@ const ue = L.create({
|
|
|
5512
5619
|
const e = window.__TEST_OPTIONS;
|
|
5513
5620
|
return e.mockID === void 0 ? e.mockID = 0 : e.mockID++, e.mockID.toString();
|
|
5514
5621
|
}
|
|
5515
|
-
return
|
|
5622
|
+
return Ct();
|
|
5516
5623
|
},
|
|
5517
5624
|
filterTransaction: null
|
|
5518
5625
|
};
|
|
@@ -5581,42 +5688,42 @@ const ue = L.create({
|
|
|
5581
5688
|
});
|
|
5582
5689
|
if (!r || a)
|
|
5583
5690
|
return;
|
|
5584
|
-
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(
|
|
5585
5692
|
i.doc,
|
|
5586
5693
|
o
|
|
5587
5694
|
), { mapping: h } = u;
|
|
5588
|
-
if (
|
|
5589
|
-
const g =
|
|
5695
|
+
if (vo(u).forEach(({ newRange: f }) => {
|
|
5696
|
+
const g = wo(
|
|
5590
5697
|
n.doc,
|
|
5591
5698
|
f,
|
|
5592
|
-
(
|
|
5593
|
-
), b = g.map(({ node:
|
|
5594
|
-
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 }) => {
|
|
5595
5702
|
let P;
|
|
5596
|
-
const
|
|
5597
|
-
if (
|
|
5598
|
-
const
|
|
5599
|
-
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) {
|
|
5600
5707
|
const Je = JSON.parse(
|
|
5601
5708
|
JSON.stringify(n.doc.toJSON())
|
|
5602
5709
|
);
|
|
5603
|
-
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())) {
|
|
5604
5711
|
s.setNodeMarkup(y, void 0, {
|
|
5605
|
-
...
|
|
5712
|
+
...v.attrs,
|
|
5606
5713
|
[d]: "initialBlockId"
|
|
5607
5714
|
});
|
|
5608
5715
|
return;
|
|
5609
5716
|
}
|
|
5610
5717
|
}
|
|
5611
5718
|
s.setNodeMarkup(y, void 0, {
|
|
5612
|
-
...
|
|
5719
|
+
...v.attrs,
|
|
5613
5720
|
[d]: c()
|
|
5614
5721
|
});
|
|
5615
5722
|
return;
|
|
5616
5723
|
}
|
|
5617
5724
|
const { deleted: ge } = h.invert().mapResult(y);
|
|
5618
|
-
ge && k.includes(
|
|
5619
|
-
...
|
|
5725
|
+
ge && k.includes(Y) && s.setNodeMarkup(y, void 0, {
|
|
5726
|
+
...v.attrs,
|
|
5620
5727
|
[d]: c()
|
|
5621
5728
|
});
|
|
5622
5729
|
});
|
|
@@ -5689,7 +5796,7 @@ const ue = L.create({
|
|
|
5689
5796
|
function it(e) {
|
|
5690
5797
|
return e.type === "link";
|
|
5691
5798
|
}
|
|
5692
|
-
function
|
|
5799
|
+
function Bt(e) {
|
|
5693
5800
|
return typeof e != "string" && e.type === "link";
|
|
5694
5801
|
}
|
|
5695
5802
|
function de(e) {
|
|
@@ -5747,10 +5854,10 @@ function H(e, t, o, i) {
|
|
|
5747
5854
|
for (const r of e)
|
|
5748
5855
|
typeof r == "string" ? n.push(
|
|
5749
5856
|
...He(r, t, o, i)
|
|
5750
|
-
) :
|
|
5857
|
+
) : Bt(r) ? n.push(..._i(r, t, o)) : de(r) ? n.push(
|
|
5751
5858
|
...He([r], t, o, i)
|
|
5752
5859
|
) : n.push(
|
|
5753
|
-
|
|
5860
|
+
Tt(r, t, o)
|
|
5754
5861
|
);
|
|
5755
5862
|
return n;
|
|
5756
5863
|
}
|
|
@@ -5789,7 +5896,7 @@ function Ce(e, t, o) {
|
|
|
5789
5896
|
}
|
|
5790
5897
|
return i;
|
|
5791
5898
|
}
|
|
5792
|
-
function
|
|
5899
|
+
function Tt(e, t, o) {
|
|
5793
5900
|
let i, n = e.type;
|
|
5794
5901
|
if (n === void 0 && (n = "paragraph"), !t.nodes[n])
|
|
5795
5902
|
throw new Error(`node type ${n} not found in schema`);
|
|
@@ -5818,16 +5925,16 @@ function Bt(e, t, o) {
|
|
|
5818
5925
|
throw new D(e.content.type);
|
|
5819
5926
|
return i;
|
|
5820
5927
|
}
|
|
5821
|
-
function
|
|
5928
|
+
function J(e, t, o) {
|
|
5822
5929
|
let i = e.id;
|
|
5823
5930
|
i === void 0 && (i = ue.options.generateID());
|
|
5824
5931
|
const n = [];
|
|
5825
5932
|
if (e.children)
|
|
5826
5933
|
for (const a of e.children)
|
|
5827
|
-
n.push(
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
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(
|
|
5831
5938
|
e,
|
|
5832
5939
|
t,
|
|
5833
5940
|
o
|
|
@@ -5840,7 +5947,7 @@ function Z(e, t, o) {
|
|
|
5840
5947
|
s ? [a, s] : a
|
|
5841
5948
|
);
|
|
5842
5949
|
} else {
|
|
5843
|
-
if (
|
|
5950
|
+
if (t.nodes[e.type].isInGroup("bnBlock"))
|
|
5844
5951
|
return t.nodes[e.type].createChecked(
|
|
5845
5952
|
{
|
|
5846
5953
|
id: i,
|
|
@@ -5853,13 +5960,13 @@ function Z(e, t, o) {
|
|
|
5853
5960
|
);
|
|
5854
5961
|
}
|
|
5855
5962
|
}
|
|
5856
|
-
function
|
|
5963
|
+
function Mt(e) {
|
|
5857
5964
|
const t = [...e.classList].filter(
|
|
5858
5965
|
(o) => !o.startsWith("bn-")
|
|
5859
5966
|
) || [];
|
|
5860
5967
|
t.length > 0 ? e.className = t.join(" ") : e.removeAttribute("class");
|
|
5861
5968
|
}
|
|
5862
|
-
function
|
|
5969
|
+
function It(e, t, o, i) {
|
|
5863
5970
|
let n;
|
|
5864
5971
|
if (t)
|
|
5865
5972
|
if (typeof t == "string")
|
|
@@ -5884,18 +5991,18 @@ function Mt(e, t, o, i) {
|
|
|
5884
5991
|
throw new D(t.type);
|
|
5885
5992
|
else throw new Error("blockContent is required");
|
|
5886
5993
|
const r = o.serializeFragment(j.from(n), i);
|
|
5887
|
-
return r.nodeType === 1 &&
|
|
5994
|
+
return r.nodeType === 1 && Mt(r), r;
|
|
5888
5995
|
}
|
|
5889
5996
|
function yi(e, t, o, i, n, r, a) {
|
|
5890
|
-
var g, b, k,
|
|
5997
|
+
var g, b, k, v, y, P, Y, ge;
|
|
5891
5998
|
const s = (a == null ? void 0 : a.document) ?? document, l = t.pmSchema.nodes.blockContainer;
|
|
5892
5999
|
let d = o.props;
|
|
5893
6000
|
if (!o.props) {
|
|
5894
6001
|
d = {};
|
|
5895
|
-
for (const [E,
|
|
6002
|
+
for (const [E, x] of Object.entries(
|
|
5896
6003
|
t.schema.blockSchema[o.type].propSchema
|
|
5897
6004
|
))
|
|
5898
|
-
|
|
6005
|
+
x.default !== void 0 && (d[E] = x.default);
|
|
5899
6006
|
}
|
|
5900
6007
|
const u = [...((b = (g = l.spec) == null ? void 0 : g.toDOM) == null ? void 0 : b.call(
|
|
5901
6008
|
g,
|
|
@@ -5906,15 +6013,15 @@ function yi(e, t, o, i, n, r, a) {
|
|
|
5906
6013
|
)).dom.attributes], h = t.blockImplementations[o.type].implementation.toExternalHTML({ ...o, props: d }, t), m = s.createDocumentFragment();
|
|
5907
6014
|
if (h.dom.classList.contains("bn-block-content")) {
|
|
5908
6015
|
const E = [...u, ...h.dom.attributes].filter(
|
|
5909
|
-
(
|
|
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"
|
|
5910
6017
|
);
|
|
5911
|
-
for (const
|
|
5912
|
-
h.dom.firstChild.setAttribute(
|
|
5913
|
-
|
|
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);
|
|
5914
6021
|
} else
|
|
5915
6022
|
m.append(h.dom);
|
|
5916
6023
|
if (h.contentDOM && o.content) {
|
|
5917
|
-
const E =
|
|
6024
|
+
const E = It(
|
|
5918
6025
|
t,
|
|
5919
6026
|
o.content,
|
|
5920
6027
|
// TODO
|
|
@@ -5926,8 +6033,8 @@ function yi(e, t, o, i, n, r, a) {
|
|
|
5926
6033
|
let f;
|
|
5927
6034
|
if (n.has(o.type) ? f = "OL" : r.has(o.type) && (f = "UL"), f) {
|
|
5928
6035
|
if (((k = e.lastChild) == null ? void 0 : k.nodeName) !== f) {
|
|
5929
|
-
const
|
|
5930
|
-
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);
|
|
5931
6038
|
}
|
|
5932
6039
|
const E = s.createElement("li");
|
|
5933
6040
|
E.append(m), e.lastChild.appendChild(E);
|
|
@@ -5935,7 +6042,7 @@ function yi(e, t, o, i, n, r, a) {
|
|
|
5935
6042
|
e.append(m);
|
|
5936
6043
|
if (o.children && o.children.length > 0) {
|
|
5937
6044
|
const E = s.createDocumentFragment();
|
|
5938
|
-
if (
|
|
6045
|
+
if (Lt(
|
|
5939
6046
|
E,
|
|
5940
6047
|
t,
|
|
5941
6048
|
o.children,
|
|
@@ -5943,13 +6050,13 @@ function yi(e, t, o, i, n, r, a) {
|
|
|
5943
6050
|
n,
|
|
5944
6051
|
r,
|
|
5945
6052
|
a
|
|
5946
|
-
), ((
|
|
5947
|
-
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"; )
|
|
5948
6055
|
e.lastChild.lastChild.appendChild(E.firstChild);
|
|
5949
6056
|
t.pmSchema.nodes[o.type].isInGroup("blockContent") ? e.append(E) : (ge = h.contentDOM) == null || ge.append(E);
|
|
5950
6057
|
}
|
|
5951
6058
|
}
|
|
5952
|
-
const
|
|
6059
|
+
const Lt = (e, t, o, i, n, r, a) => {
|
|
5953
6060
|
for (const s of o)
|
|
5954
6061
|
yi(
|
|
5955
6062
|
e,
|
|
@@ -5962,7 +6069,7 @@ const It = (e, t, o, i, n, r, a) => {
|
|
|
5962
6069
|
);
|
|
5963
6070
|
}, vi = (e, t, o, i, n, r) => {
|
|
5964
6071
|
const s = ((r == null ? void 0 : r.document) ?? document).createDocumentFragment();
|
|
5965
|
-
return
|
|
6072
|
+
return Lt(
|
|
5966
6073
|
s,
|
|
5967
6074
|
e,
|
|
5968
6075
|
t,
|
|
@@ -5986,7 +6093,7 @@ const It = (e, t, o, i, n, r, a) => {
|
|
|
5986
6093
|
return a.append(r), a.innerHTML;
|
|
5987
6094
|
},
|
|
5988
6095
|
exportInlineContent: (i, n) => {
|
|
5989
|
-
const r =
|
|
6096
|
+
const r = It(
|
|
5990
6097
|
t,
|
|
5991
6098
|
i,
|
|
5992
6099
|
o,
|
|
@@ -6049,7 +6156,7 @@ function xi(e, t, o, i, n) {
|
|
|
6049
6156
|
}
|
|
6050
6157
|
if (e.pmSchema.nodes[t.type].isInGroup("bnBlock")) {
|
|
6051
6158
|
if (t.children && t.children.length > 0) {
|
|
6052
|
-
const b =
|
|
6159
|
+
const b = At(
|
|
6053
6160
|
e,
|
|
6054
6161
|
t.children,
|
|
6055
6162
|
o,
|
|
@@ -6067,10 +6174,10 @@ function xi(e, t, o, i, n) {
|
|
|
6067
6174
|
})
|
|
6068
6175
|
);
|
|
6069
6176
|
return (f = c.contentDOM) == null || f.appendChild(l.dom), t.children && t.children.length > 0 && ((g = c.contentDOM) == null || g.appendChild(
|
|
6070
|
-
|
|
6177
|
+
Pt(e, t.children, o, n)
|
|
6071
6178
|
)), c.dom;
|
|
6072
6179
|
}
|
|
6073
|
-
function
|
|
6180
|
+
function At(e, t, o, i) {
|
|
6074
6181
|
const r = ((i == null ? void 0 : i.document) ?? document).createDocumentFragment();
|
|
6075
6182
|
let a = 0;
|
|
6076
6183
|
for (const s of t) {
|
|
@@ -6086,14 +6193,14 @@ function Lt(e, t, o, i) {
|
|
|
6086
6193
|
}
|
|
6087
6194
|
return r;
|
|
6088
6195
|
}
|
|
6089
|
-
const
|
|
6196
|
+
const Pt = (e, t, o, i) => {
|
|
6090
6197
|
var s;
|
|
6091
|
-
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);
|
|
6092
6199
|
return (s = r.contentDOM) == null || s.appendChild(a), r.dom;
|
|
6093
6200
|
}, Ci = (e, t) => {
|
|
6094
6201
|
const o = vt.fromSchema(e);
|
|
6095
6202
|
return {
|
|
6096
|
-
serializeBlocks: (i, n) =>
|
|
6203
|
+
serializeBlocks: (i, n) => Pt(t, i, o, n).outerHTML
|
|
6097
6204
|
};
|
|
6098
6205
|
};
|
|
6099
6206
|
function z(e, t) {
|
|
@@ -6229,7 +6336,7 @@ function R(e, t, o, i) {
|
|
|
6229
6336
|
};
|
|
6230
6337
|
}
|
|
6231
6338
|
const rt = (e, t) => {
|
|
6232
|
-
let o =
|
|
6339
|
+
let o = J(e, t.pmSchema, t.schema.styleSchema);
|
|
6233
6340
|
o.type.name === "blockContainer" && (o = o.firstChild);
|
|
6234
6341
|
const i = t.pmSchema.nodes[o.type.name].spec.toDOM;
|
|
6235
6342
|
if (i === void 0)
|
|
@@ -6242,7 +6349,7 @@ const rt = (e, t) => {
|
|
|
6242
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."
|
|
6243
6350
|
);
|
|
6244
6351
|
return n;
|
|
6245
|
-
},
|
|
6352
|
+
}, C = {
|
|
6246
6353
|
backgroundColor: {
|
|
6247
6354
|
default: "default"
|
|
6248
6355
|
},
|
|
@@ -6253,7 +6360,7 @@ const rt = (e, t) => {
|
|
|
6253
6360
|
default: "left",
|
|
6254
6361
|
values: ["left", "center", "right", "justify"]
|
|
6255
6362
|
}
|
|
6256
|
-
},
|
|
6363
|
+
}, Nt = ["backgroundColor", "textColor"];
|
|
6257
6364
|
function ye(e) {
|
|
6258
6365
|
return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
6259
6366
|
}
|
|
@@ -6264,7 +6371,7 @@ function ls(e) {
|
|
|
6264
6371
|
}
|
|
6265
6372
|
function he(e) {
|
|
6266
6373
|
const t = {};
|
|
6267
|
-
return Object.entries(e).filter(([o, i]) => !
|
|
6374
|
+
return Object.entries(e).filter(([o, i]) => !Nt.includes(o)).forEach(([o, i]) => {
|
|
6268
6375
|
t[o] = {
|
|
6269
6376
|
default: i.default,
|
|
6270
6377
|
keepOnSplit: !0,
|
|
@@ -6313,7 +6420,7 @@ function be(e, t, o, i, n = !1, r) {
|
|
|
6313
6420
|
), a.setAttribute("data-content-type", t);
|
|
6314
6421
|
for (const [s, l] of Object.entries(o)) {
|
|
6315
6422
|
const c = i[s].default;
|
|
6316
|
-
!
|
|
6423
|
+
!Nt.includes(s) && l !== c && a.setAttribute(ye(s), l);
|
|
6317
6424
|
}
|
|
6318
6425
|
return n && a.setAttribute("data-file-block", ""), a.appendChild(e.dom), e.contentDOM !== void 0 && (e.contentDOM.className = G(
|
|
6319
6426
|
"bn-inline-content",
|
|
@@ -6324,16 +6431,16 @@ function be(e, t, o, i, n = !1, r) {
|
|
|
6324
6431
|
};
|
|
6325
6432
|
}
|
|
6326
6433
|
function $(e) {
|
|
6327
|
-
return
|
|
6434
|
+
return Z.create(e);
|
|
6328
6435
|
}
|
|
6329
|
-
function
|
|
6436
|
+
function jt(e, t) {
|
|
6330
6437
|
return {
|
|
6331
6438
|
config: e,
|
|
6332
6439
|
implementation: t
|
|
6333
6440
|
};
|
|
6334
6441
|
}
|
|
6335
6442
|
function W(e, t, o) {
|
|
6336
|
-
return
|
|
6443
|
+
return jt(
|
|
6337
6444
|
{
|
|
6338
6445
|
type: e.name,
|
|
6339
6446
|
content: e.config.content === "inline*" ? "inline" : e.config.content === "tableRow+" ? "table" : "none",
|
|
@@ -6348,7 +6455,7 @@ function W(e, t, o) {
|
|
|
6348
6455
|
}
|
|
6349
6456
|
);
|
|
6350
6457
|
}
|
|
6351
|
-
function
|
|
6458
|
+
function Dt(e) {
|
|
6352
6459
|
return Object.fromEntries(
|
|
6353
6460
|
Object.entries(e).map(([t, o]) => [t, o.config])
|
|
6354
6461
|
);
|
|
@@ -6425,7 +6532,7 @@ function me(e, t) {
|
|
|
6425
6532
|
throw new Error(
|
|
6426
6533
|
"Node name does not match block type. This is a bug in BlockNote."
|
|
6427
6534
|
);
|
|
6428
|
-
return
|
|
6535
|
+
return jt(e, {
|
|
6429
6536
|
node: o,
|
|
6430
6537
|
toInternalHTML: (i, n) => {
|
|
6431
6538
|
var s;
|
|
@@ -6459,7 +6566,7 @@ function me(e, t) {
|
|
|
6459
6566
|
}
|
|
6460
6567
|
});
|
|
6461
6568
|
}
|
|
6462
|
-
function
|
|
6569
|
+
function Ht(e, t, o) {
|
|
6463
6570
|
const i = {
|
|
6464
6571
|
type: "tableContent",
|
|
6465
6572
|
columnWidths: [],
|
|
@@ -6506,7 +6613,11 @@ function Se(e, t, o) {
|
|
|
6506
6613
|
};
|
|
6507
6614
|
return;
|
|
6508
6615
|
}
|
|
6509
|
-
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
|
+
}
|
|
6510
6621
|
n && (i.push(n), n = void 0), i.push(
|
|
6511
6622
|
Ue(r, t, o)
|
|
6512
6623
|
);
|
|
@@ -6519,8 +6630,11 @@ function Se(e, t, o) {
|
|
|
6519
6630
|
s = l;
|
|
6520
6631
|
else {
|
|
6521
6632
|
const d = o[l.type.name];
|
|
6522
|
-
if (!d)
|
|
6633
|
+
if (!d) {
|
|
6634
|
+
if (l.type.spec.blocknoteIgnore)
|
|
6635
|
+
continue;
|
|
6523
6636
|
throw new Error(`style ${l.type.name} not found in styleSchema`);
|
|
6637
|
+
}
|
|
6524
6638
|
if (d.propSchema === "boolean")
|
|
6525
6639
|
a[d.type] = !0;
|
|
6526
6640
|
else if (d.propSchema === "string")
|
|
@@ -6600,7 +6714,7 @@ function Ue(e, t, o) {
|
|
|
6600
6714
|
content: r
|
|
6601
6715
|
};
|
|
6602
6716
|
}
|
|
6603
|
-
function
|
|
6717
|
+
function w(e, t, o, i, n) {
|
|
6604
6718
|
var f;
|
|
6605
6719
|
if (!e.type.isInGroup("bnBlock"))
|
|
6606
6720
|
throw Error(
|
|
@@ -6626,7 +6740,7 @@ function v(e, t, o, i, n) {
|
|
|
6626
6740
|
const c = t[a.blockNoteType], u = [];
|
|
6627
6741
|
(f = a.childContainer) == null || f.node.forEach((g) => {
|
|
6628
6742
|
u.push(
|
|
6629
|
-
|
|
6743
|
+
w(
|
|
6630
6744
|
g,
|
|
6631
6745
|
t,
|
|
6632
6746
|
o,
|
|
@@ -6647,7 +6761,7 @@ function v(e, t, o, i, n) {
|
|
|
6647
6761
|
} else if (c.content === "table") {
|
|
6648
6762
|
if (!a.isBlockContainer)
|
|
6649
6763
|
throw new Error("impossible");
|
|
6650
|
-
h =
|
|
6764
|
+
h = Ht(
|
|
6651
6765
|
a.blockContent.node,
|
|
6652
6766
|
o,
|
|
6653
6767
|
i
|
|
@@ -6697,7 +6811,7 @@ function Li(e, t) {
|
|
|
6697
6811
|
}
|
|
6698
6812
|
);
|
|
6699
6813
|
}
|
|
6700
|
-
function
|
|
6814
|
+
function Ut(e) {
|
|
6701
6815
|
return Object.fromEntries(
|
|
6702
6816
|
Object.entries(e).map(([t, o]) => [t, o.config])
|
|
6703
6817
|
);
|
|
@@ -6714,7 +6828,7 @@ function Ai(e) {
|
|
|
6714
6828
|
];
|
|
6715
6829
|
}
|
|
6716
6830
|
function ds(e, t) {
|
|
6717
|
-
const o =
|
|
6831
|
+
const o = Z.create({
|
|
6718
6832
|
name: e.type,
|
|
6719
6833
|
inline: !0,
|
|
6720
6834
|
group: "inline",
|
|
@@ -6805,14 +6919,14 @@ function Pi(e) {
|
|
|
6805
6919
|
function Ni(e, t, o, i) {
|
|
6806
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;
|
|
6807
6921
|
}
|
|
6808
|
-
function
|
|
6922
|
+
function Ot(e, t) {
|
|
6809
6923
|
return {
|
|
6810
6924
|
config: e,
|
|
6811
6925
|
implementation: t
|
|
6812
6926
|
};
|
|
6813
6927
|
}
|
|
6814
6928
|
function K(e, t) {
|
|
6815
|
-
return
|
|
6929
|
+
return Ot(
|
|
6816
6930
|
{
|
|
6817
6931
|
type: e.name,
|
|
6818
6932
|
propSchema: t
|
|
@@ -6822,7 +6936,7 @@ function K(e, t) {
|
|
|
6822
6936
|
}
|
|
6823
6937
|
);
|
|
6824
6938
|
}
|
|
6825
|
-
function
|
|
6939
|
+
function Rt(e) {
|
|
6826
6940
|
return Object.fromEntries(
|
|
6827
6941
|
Object.entries(e).map(([t, o]) => [t, o.config])
|
|
6828
6942
|
);
|
|
@@ -6863,7 +6977,7 @@ function cs(e, t) {
|
|
|
6863
6977
|
);
|
|
6864
6978
|
}
|
|
6865
6979
|
});
|
|
6866
|
-
return
|
|
6980
|
+
return Ot(e, {
|
|
6867
6981
|
mark: o
|
|
6868
6982
|
});
|
|
6869
6983
|
}
|
|
@@ -6965,7 +7079,7 @@ const Be = (e, t) => {
|
|
|
6965
7079
|
dom: o
|
|
6966
7080
|
};
|
|
6967
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 = {
|
|
6968
|
-
backgroundColor:
|
|
7082
|
+
backgroundColor: C.backgroundColor,
|
|
6969
7083
|
// File name.
|
|
6970
7084
|
name: {
|
|
6971
7085
|
default: ""
|
|
@@ -7028,13 +7142,13 @@ const Be = (e, t) => {
|
|
|
7028
7142
|
render: zi,
|
|
7029
7143
|
parse: Fi,
|
|
7030
7144
|
toExternalHTML: Gi
|
|
7031
|
-
}),
|
|
7145
|
+
}), Vt = [
|
|
7032
7146
|
{
|
|
7033
7147
|
id: "text",
|
|
7034
7148
|
name: "Plain Text",
|
|
7035
7149
|
match: ["text", "txt", "plain"]
|
|
7036
7150
|
},
|
|
7037
|
-
...
|
|
7151
|
+
...Et.filter((e) => [
|
|
7038
7152
|
"c",
|
|
7039
7153
|
"cpp",
|
|
7040
7154
|
"css",
|
|
@@ -7136,9 +7250,9 @@ const Be = (e, t) => {
|
|
|
7136
7250
|
), Oe = {
|
|
7137
7251
|
language: {
|
|
7138
7252
|
default: "javascript",
|
|
7139
|
-
values: [...
|
|
7253
|
+
values: [...Vt.map((e) => e.id)]
|
|
7140
7254
|
}
|
|
7141
|
-
},
|
|
7255
|
+
}, zt = $({
|
|
7142
7256
|
name: "codeBlock",
|
|
7143
7257
|
content: "inline*",
|
|
7144
7258
|
group: "blockContent",
|
|
@@ -7149,7 +7263,7 @@ const Be = (e, t) => {
|
|
|
7149
7263
|
return {
|
|
7150
7264
|
defaultLanguage: "javascript",
|
|
7151
7265
|
indentLineWithTab: !0,
|
|
7152
|
-
supportedLanguages:
|
|
7266
|
+
supportedLanguages: Vt
|
|
7153
7267
|
};
|
|
7154
7268
|
},
|
|
7155
7269
|
addAttributes() {
|
|
@@ -7249,7 +7363,7 @@ const Be = (e, t) => {
|
|
|
7249
7363
|
}
|
|
7250
7364
|
);
|
|
7251
7365
|
const s = a.language;
|
|
7252
|
-
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));
|
|
7253
7367
|
},
|
|
7254
7368
|
languageExtractor: (a) => a.attrs.language,
|
|
7255
7369
|
nodeTypes: [this.name]
|
|
@@ -7258,7 +7372,7 @@ const Be = (e, t) => {
|
|
|
7258
7372
|
addInputRules() {
|
|
7259
7373
|
const e = this.options.supportedLanguages;
|
|
7260
7374
|
return [
|
|
7261
|
-
new
|
|
7375
|
+
new oe({
|
|
7262
7376
|
find: /^```(.*?)\s$/,
|
|
7263
7377
|
handler: ({ state: t, range: o, match: i }) => {
|
|
7264
7378
|
var s;
|
|
@@ -7309,13 +7423,13 @@ const Be = (e, t) => {
|
|
|
7309
7423
|
};
|
|
7310
7424
|
}
|
|
7311
7425
|
}), Wi = W(
|
|
7312
|
-
|
|
7426
|
+
zt,
|
|
7313
7427
|
Oe
|
|
7314
7428
|
);
|
|
7315
7429
|
function us(e) {
|
|
7316
7430
|
var t;
|
|
7317
7431
|
return W(
|
|
7318
|
-
|
|
7432
|
+
zt.configure(e),
|
|
7319
7433
|
{
|
|
7320
7434
|
language: {
|
|
7321
7435
|
default: e.defaultLanguage || Oe.language.default,
|
|
@@ -7403,7 +7517,7 @@ const Ki = {
|
|
|
7403
7517
|
return ["span", e, 0];
|
|
7404
7518
|
}
|
|
7405
7519
|
}), tn = K(en, "string"), dt = (e) => ({ url: e.src || void 0 }), on = {
|
|
7406
|
-
backgroundColor:
|
|
7520
|
+
backgroundColor: C.backgroundColor,
|
|
7407
7521
|
// File name.
|
|
7408
7522
|
name: {
|
|
7409
7523
|
default: ""
|
|
@@ -7470,7 +7584,7 @@ const Ki = {
|
|
|
7470
7584
|
else if (!r.isBlockContainer && s.isInGroup("bnBlock"))
|
|
7471
7585
|
ct(o, i, e, r);
|
|
7472
7586
|
else {
|
|
7473
|
-
const d =
|
|
7587
|
+
const d = w(
|
|
7474
7588
|
r.bnBlock.node,
|
|
7475
7589
|
e.schema.blockSchema,
|
|
7476
7590
|
e.schema.inlineContentSchema,
|
|
@@ -7480,7 +7594,7 @@ const Ki = {
|
|
|
7480
7594
|
return i.tr.replaceWith(
|
|
7481
7595
|
r.bnBlock.beforePos,
|
|
7482
7596
|
r.bnBlock.afterPos,
|
|
7483
|
-
|
|
7597
|
+
J(
|
|
7484
7598
|
{
|
|
7485
7599
|
children: d.children,
|
|
7486
7600
|
// if no children are passed in, use existing children
|
|
@@ -7546,7 +7660,7 @@ function dn(e, t, o, i, n, r) {
|
|
|
7546
7660
|
}
|
|
7547
7661
|
function ct(e, t, o, i) {
|
|
7548
7662
|
if (e.children !== void 0) {
|
|
7549
|
-
const n = e.children.map((r) =>
|
|
7663
|
+
const n = e.children.map((r) => J(r, t.schema, o.schema.styleSchema));
|
|
7550
7664
|
if (i.childContainer)
|
|
7551
7665
|
t.tr.step(
|
|
7552
7666
|
new Oo(
|
|
@@ -7575,7 +7689,7 @@ function cn(e, t, o) {
|
|
|
7575
7689
|
o
|
|
7576
7690
|
)({ state: s, dispatch: l }), !0));
|
|
7577
7691
|
const a = i.state.doc.resolve(r.posBeforeNode + 1).node();
|
|
7578
|
-
return
|
|
7692
|
+
return w(
|
|
7579
7693
|
a,
|
|
7580
7694
|
e.schema.blockSchema,
|
|
7581
7695
|
e.schema.inlineContentSchema,
|
|
@@ -7583,19 +7697,19 @@ function cn(e, t, o) {
|
|
|
7583
7697
|
e.blockCache
|
|
7584
7698
|
);
|
|
7585
7699
|
}
|
|
7586
|
-
const
|
|
7587
|
-
...
|
|
7700
|
+
const Ft = {
|
|
7701
|
+
...C,
|
|
7588
7702
|
level: { default: 1, values: [1, 2, 3] }
|
|
7589
7703
|
}, un = $({
|
|
7590
7704
|
name: "heading",
|
|
7591
7705
|
content: "inline*",
|
|
7592
7706
|
group: "blockContent",
|
|
7593
7707
|
addAttributes() {
|
|
7594
|
-
return he(
|
|
7708
|
+
return he(Ft);
|
|
7595
7709
|
},
|
|
7596
7710
|
addInputRules() {
|
|
7597
7711
|
return [
|
|
7598
|
-
...[1, 2, 3].map((e) => new
|
|
7712
|
+
...[1, 2, 3].map((e) => new oe({
|
|
7599
7713
|
find: new RegExp(`^(#{${e}})\\s$`),
|
|
7600
7714
|
handler: ({ state: t, chain: o, range: i }) => {
|
|
7601
7715
|
const n = _(t);
|
|
@@ -7688,8 +7802,8 @@ const zt = {
|
|
|
7688
7802
|
}
|
|
7689
7803
|
}), pn = W(
|
|
7690
7804
|
un,
|
|
7691
|
-
|
|
7692
|
-
),
|
|
7805
|
+
Ft
|
|
7806
|
+
), Gt = (e, t, o, i, n, r) => {
|
|
7693
7807
|
const { dom: a, destroy: s } = $e(
|
|
7694
7808
|
e,
|
|
7695
7809
|
t,
|
|
@@ -7726,7 +7840,7 @@ const zt = {
|
|
|
7726
7840
|
initialWidth: l.clientWidth,
|
|
7727
7841
|
initialClientX: y.clientX
|
|
7728
7842
|
};
|
|
7729
|
-
},
|
|
7843
|
+
}, v = (y) => {
|
|
7730
7844
|
y.preventDefault(), u = {
|
|
7731
7845
|
handleUsed: "right",
|
|
7732
7846
|
initialWidth: l.clientWidth,
|
|
@@ -7738,7 +7852,7 @@ const zt = {
|
|
|
7738
7852
|
k
|
|
7739
7853
|
), c.addEventListener(
|
|
7740
7854
|
"mousedown",
|
|
7741
|
-
|
|
7855
|
+
v
|
|
7742
7856
|
), {
|
|
7743
7857
|
dom: l,
|
|
7744
7858
|
destroy: () => {
|
|
@@ -7747,7 +7861,7 @@ const zt = {
|
|
|
7747
7861
|
k
|
|
7748
7862
|
), c.removeEventListener(
|
|
7749
7863
|
"mousedown",
|
|
7750
|
-
|
|
7864
|
+
v
|
|
7751
7865
|
);
|
|
7752
7866
|
}
|
|
7753
7867
|
};
|
|
@@ -7755,8 +7869,8 @@ const zt = {
|
|
|
7755
7869
|
const t = e.src || void 0, o = e.width || void 0;
|
|
7756
7870
|
return { url: t, previewWidth: o };
|
|
7757
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 = {
|
|
7758
|
-
textAlignment:
|
|
7759
|
-
backgroundColor:
|
|
7872
|
+
textAlignment: C.textAlignment,
|
|
7873
|
+
backgroundColor: C.backgroundColor,
|
|
7760
7874
|
// File name.
|
|
7761
7875
|
name: {
|
|
7762
7876
|
default: ""
|
|
@@ -7790,7 +7904,7 @@ const zt = {
|
|
|
7790
7904
|
const n = document.createElement("img");
|
|
7791
7905
|
return n.className = "bn-visual-media", t.resolveFileUrl ? t.resolveFileUrl(e.props.url).then((r) => {
|
|
7792
7906
|
n.src = r;
|
|
7793
|
-
}) : 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(
|
|
7794
7908
|
e,
|
|
7795
7909
|
t,
|
|
7796
7910
|
{ dom: i },
|
|
@@ -7826,7 +7940,7 @@ const zt = {
|
|
|
7826
7940
|
render: gn,
|
|
7827
7941
|
parse: bn,
|
|
7828
7942
|
toExternalHTML: kn
|
|
7829
|
-
}),
|
|
7943
|
+
}), $t = (e, t, o) => ({
|
|
7830
7944
|
state: i,
|
|
7831
7945
|
dispatch: n
|
|
7832
7946
|
}) => {
|
|
@@ -7865,11 +7979,11 @@ const zt = {
|
|
|
7865
7979
|
() => (
|
|
7866
7980
|
// Splits the current block, moving content inside that's after the cursor
|
|
7867
7981
|
// to a new block of the same type below.
|
|
7868
|
-
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)
|
|
7869
7983
|
)
|
|
7870
7984
|
]);
|
|
7871
7985
|
}, yn = {
|
|
7872
|
-
...
|
|
7986
|
+
...C
|
|
7873
7987
|
}, vn = $({
|
|
7874
7988
|
name: "bulletListItem",
|
|
7875
7989
|
content: "inline*",
|
|
@@ -7880,7 +7994,7 @@ const zt = {
|
|
|
7880
7994
|
addInputRules() {
|
|
7881
7995
|
return [
|
|
7882
7996
|
// Creates an unordered list when starting with "-", "+", or "*".
|
|
7883
|
-
new
|
|
7997
|
+
new oe({
|
|
7884
7998
|
find: new RegExp("^[-+*]\\s$"),
|
|
7885
7999
|
handler: ({ state: e, chain: t, range: o }) => {
|
|
7886
8000
|
const i = _(e);
|
|
@@ -7960,8 +8074,8 @@ const zt = {
|
|
|
7960
8074
|
}), wn = W(
|
|
7961
8075
|
vn,
|
|
7962
8076
|
yn
|
|
7963
|
-
),
|
|
7964
|
-
...
|
|
8077
|
+
), Wt = {
|
|
8078
|
+
...C,
|
|
7965
8079
|
checked: {
|
|
7966
8080
|
default: !1
|
|
7967
8081
|
}
|
|
@@ -7970,12 +8084,12 @@ const zt = {
|
|
|
7970
8084
|
content: "inline*",
|
|
7971
8085
|
group: "blockContent",
|
|
7972
8086
|
addAttributes() {
|
|
7973
|
-
return he(
|
|
8087
|
+
return he(Wt);
|
|
7974
8088
|
},
|
|
7975
8089
|
addInputRules() {
|
|
7976
8090
|
return [
|
|
7977
8091
|
// Creates a checklist when starting with "[]" or "[X]".
|
|
7978
|
-
new
|
|
8092
|
+
new oe({
|
|
7979
8093
|
find: new RegExp("\\[\\s*\\]\\s$"),
|
|
7980
8094
|
handler: ({ state: e, chain: t, range: o }) => {
|
|
7981
8095
|
const i = _(e);
|
|
@@ -7993,7 +8107,7 @@ const zt = {
|
|
|
7993
8107
|
).deleteRange({ from: o.from, to: o.to });
|
|
7994
8108
|
}
|
|
7995
8109
|
}),
|
|
7996
|
-
new
|
|
8110
|
+
new oe({
|
|
7997
8111
|
find: new RegExp("\\[[Xx]\\]\\s$"),
|
|
7998
8112
|
handler: ({ state: e, chain: t, range: o }) => {
|
|
7999
8113
|
const i = _(e);
|
|
@@ -8141,7 +8255,7 @@ const zt = {
|
|
|
8141
8255
|
}
|
|
8142
8256
|
}), Cn = W(
|
|
8143
8257
|
xn,
|
|
8144
|
-
|
|
8258
|
+
Wt
|
|
8145
8259
|
), En = new N("numbered-list-indexing"), Sn = () => new B({
|
|
8146
8260
|
key: En,
|
|
8147
8261
|
appendTransaction: (e, t, o) => {
|
|
@@ -8188,8 +8302,8 @@ const zt = {
|
|
|
8188
8302
|
}
|
|
8189
8303
|
}), n ? i : null;
|
|
8190
8304
|
}
|
|
8191
|
-
}),
|
|
8192
|
-
...
|
|
8305
|
+
}), Kt = {
|
|
8306
|
+
...C,
|
|
8193
8307
|
start: { default: void 0, type: "number" }
|
|
8194
8308
|
}, Bn = $({
|
|
8195
8309
|
name: "numberedListItem",
|
|
@@ -8198,7 +8312,7 @@ const zt = {
|
|
|
8198
8312
|
priority: 90,
|
|
8199
8313
|
addAttributes() {
|
|
8200
8314
|
return {
|
|
8201
|
-
...he(
|
|
8315
|
+
...he(Kt),
|
|
8202
8316
|
// the index attribute is only used internally (it's not part of the blocknote schema)
|
|
8203
8317
|
// that's why it's defined explicitly here, and not part of the prop schema
|
|
8204
8318
|
index: {
|
|
@@ -8213,7 +8327,7 @@ const zt = {
|
|
|
8213
8327
|
addInputRules() {
|
|
8214
8328
|
return [
|
|
8215
8329
|
// Creates an ordered list when starting with "1.".
|
|
8216
|
-
new
|
|
8330
|
+
new oe({
|
|
8217
8331
|
find: new RegExp("^(\\d+)\\.\\s$"),
|
|
8218
8332
|
handler: ({ state: e, chain: t, range: o, match: i }) => {
|
|
8219
8333
|
const n = _(e);
|
|
@@ -8310,9 +8424,9 @@ const zt = {
|
|
|
8310
8424
|
}
|
|
8311
8425
|
}), Tn = W(
|
|
8312
8426
|
Bn,
|
|
8313
|
-
|
|
8427
|
+
Kt
|
|
8314
8428
|
), Mn = {
|
|
8315
|
-
...
|
|
8429
|
+
...C
|
|
8316
8430
|
}, In = $({
|
|
8317
8431
|
name: "paragraph",
|
|
8318
8432
|
content: "inline*",
|
|
@@ -8359,12 +8473,12 @@ const zt = {
|
|
|
8359
8473
|
}), Ln = W(
|
|
8360
8474
|
In,
|
|
8361
8475
|
Mn
|
|
8362
|
-
), An = 35,
|
|
8476
|
+
), An = 35, qt = 120, ps = 31, Pn = L.create({
|
|
8363
8477
|
name: "BlockNoteTableExtension",
|
|
8364
8478
|
addProseMirrorPlugins: () => [
|
|
8365
8479
|
Fo({
|
|
8366
8480
|
cellMinWidth: An,
|
|
8367
|
-
defaultCellMinWidth:
|
|
8481
|
+
defaultCellMinWidth: qt,
|
|
8368
8482
|
// We set this to null as we implement our own node view in the table
|
|
8369
8483
|
// block content. This node view is the same as what's used by default,
|
|
8370
8484
|
// but is wrapped in a `blockContent` HTML element.
|
|
@@ -8398,13 +8512,13 @@ const zt = {
|
|
|
8398
8512
|
storage: e.storage
|
|
8399
8513
|
};
|
|
8400
8514
|
return {
|
|
8401
|
-
tableRole:
|
|
8402
|
-
|
|
8515
|
+
tableRole: xo(
|
|
8516
|
+
Co(e, "tableRole", t)
|
|
8403
8517
|
)
|
|
8404
8518
|
};
|
|
8405
8519
|
}
|
|
8406
8520
|
}), Nn = {
|
|
8407
|
-
textColor:
|
|
8521
|
+
textColor: C.textColor
|
|
8408
8522
|
}, jn = $({
|
|
8409
8523
|
name: "table",
|
|
8410
8524
|
content: "tableRow+",
|
|
@@ -8457,13 +8571,13 @@ const zt = {
|
|
|
8457
8571
|
return !r.target.closest(".tableWrapper-inner") || super.ignoreMutation(r);
|
|
8458
8572
|
}
|
|
8459
8573
|
}
|
|
8460
|
-
return new o(e,
|
|
8574
|
+
return new o(e, qt, {
|
|
8461
8575
|
...((i = this.options.domAttributes) == null ? void 0 : i.blockContent) || {},
|
|
8462
8576
|
...t
|
|
8463
8577
|
});
|
|
8464
8578
|
};
|
|
8465
8579
|
}
|
|
8466
|
-
}), Dn =
|
|
8580
|
+
}), Dn = Z.create({
|
|
8467
8581
|
name: "tableParagraph",
|
|
8468
8582
|
group: "tableContent",
|
|
8469
8583
|
content: "inline*",
|
|
@@ -8510,8 +8624,8 @@ const zt = {
|
|
|
8510
8624
|
const t = e.src || void 0, o = e.width || void 0;
|
|
8511
8625
|
return { url: t, previewWidth: o };
|
|
8512
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 = {
|
|
8513
|
-
textAlignment:
|
|
8514
|
-
backgroundColor:
|
|
8627
|
+
textAlignment: C.textAlignment,
|
|
8628
|
+
backgroundColor: C.backgroundColor,
|
|
8515
8629
|
// File name.
|
|
8516
8630
|
name: {
|
|
8517
8631
|
default: ""
|
|
@@ -8545,7 +8659,7 @@ const zt = {
|
|
|
8545
8659
|
const n = document.createElement("video");
|
|
8546
8660
|
return n.className = "bn-visual-media", t.resolveFileUrl ? t.resolveFileUrl(e.props.url).then((r) => {
|
|
8547
8661
|
n.src = r;
|
|
8548
|
-
}) : 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(
|
|
8549
8663
|
e,
|
|
8550
8664
|
t,
|
|
8551
8665
|
{ dom: i },
|
|
@@ -8581,7 +8695,7 @@ const zt = {
|
|
|
8581
8695
|
render: Vn,
|
|
8582
8696
|
parse: zn,
|
|
8583
8697
|
toExternalHTML: Fn
|
|
8584
|
-
}),
|
|
8698
|
+
}), Xt = {
|
|
8585
8699
|
paragraph: Ln,
|
|
8586
8700
|
heading: pn,
|
|
8587
8701
|
codeBlock: Wi,
|
|
@@ -8593,7 +8707,7 @@ const zt = {
|
|
|
8593
8707
|
image: _n,
|
|
8594
8708
|
video: Gn,
|
|
8595
8709
|
audio: $i
|
|
8596
|
-
}, $n =
|
|
8710
|
+
}, $n = Dt(Xt), Zt = {
|
|
8597
8711
|
bold: K(No, "boolean"),
|
|
8598
8712
|
italic: K(Do, "boolean"),
|
|
8599
8713
|
underline: K(Uo, "boolean"),
|
|
@@ -8601,11 +8715,11 @@ const zt = {
|
|
|
8601
8715
|
code: K(jo, "boolean"),
|
|
8602
8716
|
textColor: tn,
|
|
8603
8717
|
backgroundColor: Qi
|
|
8604
|
-
}, hs =
|
|
8718
|
+
}, hs = Rt(Zt), Jt = {
|
|
8605
8719
|
text: { config: "text", implementation: {} },
|
|
8606
8720
|
link: { config: "link", implementation: {} }
|
|
8607
|
-
}, Wn =
|
|
8608
|
-
|
|
8721
|
+
}, Wn = Ut(
|
|
8722
|
+
Jt
|
|
8609
8723
|
);
|
|
8610
8724
|
function I(e, t) {
|
|
8611
8725
|
return e in t.schema.blockSchema && t.schema.blockSchema[e] === $n[e];
|
|
@@ -8626,7 +8740,7 @@ function gs(e, t) {
|
|
|
8626
8740
|
return t.schema.blockSchema[e.type].isFileBlock && !e.props.url;
|
|
8627
8741
|
}
|
|
8628
8742
|
function Xn(e, t, o) {
|
|
8629
|
-
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];
|
|
8630
8744
|
}
|
|
8631
8745
|
function bs(e, t, o) {
|
|
8632
8746
|
return Xn(e, t.type, o);
|
|
@@ -8831,28 +8945,28 @@ class fe {
|
|
|
8831
8945
|
p(this, "BlockNoteEditor", "only for types");
|
|
8832
8946
|
p(this, "Block", "only for types");
|
|
8833
8947
|
p(this, "PartialBlock", "only for types");
|
|
8834
|
-
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(
|
|
8835
8949
|
this.inlineContentSpecs
|
|
8836
|
-
), this.styleSchema =
|
|
8950
|
+
), this.styleSchema = Rt(this.styleSpecs);
|
|
8837
8951
|
}
|
|
8838
8952
|
static create(t) {
|
|
8839
8953
|
return new fe(t);
|
|
8840
8954
|
}
|
|
8841
8955
|
}
|
|
8842
|
-
const
|
|
8956
|
+
const Yt = fe.create({
|
|
8843
8957
|
blockSpecs: {
|
|
8844
8958
|
pageBreak: Ji
|
|
8845
8959
|
}
|
|
8846
8960
|
}), ys = (e) => fe.create({
|
|
8847
8961
|
blockSpecs: {
|
|
8848
8962
|
...e.blockSpecs,
|
|
8849
|
-
...
|
|
8963
|
+
...Yt.blockSpecs
|
|
8850
8964
|
},
|
|
8851
8965
|
inlineContentSpecs: e.inlineContentSpecs,
|
|
8852
8966
|
styleSpecs: e.styleSpecs
|
|
8853
8967
|
});
|
|
8854
8968
|
function Jn(e) {
|
|
8855
|
-
return "pageBreak" in e.schema.blockSchema && e.schema.blockSchema.pageBreak ===
|
|
8969
|
+
return "pageBreak" in e.schema.blockSchema && e.schema.blockSchema.pageBreak === Yt.blockSchema.pageBreak;
|
|
8856
8970
|
}
|
|
8857
8971
|
function vs(e) {
|
|
8858
8972
|
const t = [];
|
|
@@ -8880,7 +8994,7 @@ function Yn(e, t, o, i = "before") {
|
|
|
8880
8994
|
const n = typeof o == "string" ? o : o.id, r = [];
|
|
8881
8995
|
for (const l of t)
|
|
8882
8996
|
r.push(
|
|
8883
|
-
|
|
8997
|
+
J(l, e.pmSchema, e.schema.styleSchema)
|
|
8884
8998
|
);
|
|
8885
8999
|
const a = A(n, e._tiptapEditor.state.doc);
|
|
8886
9000
|
if (!a)
|
|
@@ -8896,7 +9010,7 @@ function Yn(e, t, o, i = "before") {
|
|
|
8896
9010
|
const s = [];
|
|
8897
9011
|
for (const l of r)
|
|
8898
9012
|
s.push(
|
|
8899
|
-
|
|
9013
|
+
w(
|
|
8900
9014
|
l,
|
|
8901
9015
|
e.schema.blockSchema,
|
|
8902
9016
|
e.schema.inlineContentSchema,
|
|
@@ -8976,57 +9090,57 @@ function Re(e) {
|
|
|
8976
9090
|
children: Re(t.children)
|
|
8977
9091
|
}).flat();
|
|
8978
9092
|
}
|
|
8979
|
-
function
|
|
9093
|
+
function Qt(e, t, o) {
|
|
8980
9094
|
var r;
|
|
8981
9095
|
const i = ((r = e.getSelection()) == null ? void 0 : r.blocks) || [
|
|
8982
9096
|
e.getTextCursorPosition().block
|
|
8983
9097
|
], n = Qn(e);
|
|
8984
9098
|
e.removeBlocks(i), e.insertBlocks(Re(i), t, o), er(e, n);
|
|
8985
9099
|
}
|
|
8986
|
-
function
|
|
9100
|
+
function eo(e) {
|
|
8987
9101
|
return !e || e.type !== "columnList";
|
|
8988
9102
|
}
|
|
8989
|
-
function
|
|
9103
|
+
function to(e, t, o) {
|
|
8990
9104
|
let i, n;
|
|
8991
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)
|
|
8992
9106
|
return;
|
|
8993
9107
|
const r = e.getParentBlock(i);
|
|
8994
|
-
return
|
|
9108
|
+
return eo(r) ? { referenceBlock: i, placement: n } : to(
|
|
8995
9109
|
e,
|
|
8996
9110
|
n === "after" ? i : e.getPrevBlock(i),
|
|
8997
9111
|
r
|
|
8998
9112
|
);
|
|
8999
9113
|
}
|
|
9000
|
-
function
|
|
9114
|
+
function oo(e, t, o) {
|
|
9001
9115
|
let i, n;
|
|
9002
9116
|
if (t ? t.children.length > 0 ? (i = t.children[0], n = "before") : (i = t, n = "after") : o && (i = o, n = "after"), !i || !n)
|
|
9003
9117
|
return;
|
|
9004
9118
|
const r = e.getParentBlock(i);
|
|
9005
|
-
return
|
|
9119
|
+
return eo(r) ? { referenceBlock: i, placement: n } : oo(
|
|
9006
9120
|
e,
|
|
9007
9121
|
n === "before" ? i : e.getNextBlock(i),
|
|
9008
9122
|
r
|
|
9009
9123
|
);
|
|
9010
9124
|
}
|
|
9011
9125
|
function tr(e) {
|
|
9012
|
-
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(
|
|
9013
9127
|
e,
|
|
9014
9128
|
e.getPrevBlock(o),
|
|
9015
9129
|
e.getParentBlock(o)
|
|
9016
9130
|
);
|
|
9017
|
-
i &&
|
|
9131
|
+
i && Qt(
|
|
9018
9132
|
e,
|
|
9019
9133
|
i.referenceBlock,
|
|
9020
9134
|
i.placement
|
|
9021
9135
|
);
|
|
9022
9136
|
}
|
|
9023
9137
|
function or(e) {
|
|
9024
|
-
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(
|
|
9025
9139
|
e,
|
|
9026
9140
|
e.getNextBlock(o),
|
|
9027
9141
|
e.getParentBlock(o)
|
|
9028
9142
|
);
|
|
9029
|
-
i &&
|
|
9143
|
+
i && Qt(
|
|
9030
9144
|
e,
|
|
9031
9145
|
i.referenceBlock,
|
|
9032
9146
|
i.placement
|
|
@@ -9073,7 +9187,7 @@ function ir(e, t) {
|
|
|
9073
9187
|
return !0;
|
|
9074
9188
|
};
|
|
9075
9189
|
}
|
|
9076
|
-
function
|
|
9190
|
+
function io(e) {
|
|
9077
9191
|
return e._tiptapEditor.commands.command(
|
|
9078
9192
|
ir(
|
|
9079
9193
|
e._tiptapEditor.schema.nodes.blockContainer,
|
|
@@ -9096,13 +9210,13 @@ function ar(e) {
|
|
|
9096
9210
|
);
|
|
9097
9211
|
return e._tiptapEditor.state.doc.resolve(t.beforePos).depth > 1;
|
|
9098
9212
|
}
|
|
9099
|
-
function
|
|
9213
|
+
function no(e, t, o) {
|
|
9100
9214
|
const i = e._tiptapEditor;
|
|
9101
9215
|
let n = i.state.tr;
|
|
9102
9216
|
const r = [];
|
|
9103
9217
|
for (const u of o)
|
|
9104
9218
|
r.push(
|
|
9105
|
-
|
|
9219
|
+
J(u, e.pmSchema, e.schema.styleSchema)
|
|
9106
9220
|
);
|
|
9107
9221
|
const a = new Set(
|
|
9108
9222
|
t.map(
|
|
@@ -9116,7 +9230,7 @@ function io(e, t, o) {
|
|
|
9116
9230
|
if (!u.type.isInGroup("bnBlock") || !a.has(u.attrs.id))
|
|
9117
9231
|
return !0;
|
|
9118
9232
|
if (s.push(
|
|
9119
|
-
|
|
9233
|
+
w(
|
|
9120
9234
|
u,
|
|
9121
9235
|
e.schema.blockSchema,
|
|
9122
9236
|
e.schema.inlineContentSchema,
|
|
@@ -9144,7 +9258,7 @@ function io(e, t, o) {
|
|
|
9144
9258
|
const c = [];
|
|
9145
9259
|
for (const u of r)
|
|
9146
9260
|
c.push(
|
|
9147
|
-
|
|
9261
|
+
w(
|
|
9148
9262
|
u,
|
|
9149
9263
|
e.schema.blockSchema,
|
|
9150
9264
|
e.schema.inlineContentSchema,
|
|
@@ -9155,15 +9269,15 @@ function io(e, t, o) {
|
|
|
9155
9269
|
return { insertedBlocks: c, removedBlocks: s };
|
|
9156
9270
|
}
|
|
9157
9271
|
function sr(e, t, o) {
|
|
9158
|
-
return
|
|
9272
|
+
return no(e, t, o);
|
|
9159
9273
|
}
|
|
9160
9274
|
function lr(e, t) {
|
|
9161
|
-
return
|
|
9275
|
+
return no(e, t, []).removedBlocks;
|
|
9162
9276
|
}
|
|
9163
9277
|
function dr(e, t) {
|
|
9164
9278
|
const o = typeof t == "string" ? t : t.id, i = A(o, e._tiptapEditor.state.doc);
|
|
9165
9279
|
if (i)
|
|
9166
|
-
return
|
|
9280
|
+
return w(
|
|
9167
9281
|
i.node,
|
|
9168
9282
|
e.schema.blockSchema,
|
|
9169
9283
|
e.schema.inlineContentSchema,
|
|
@@ -9179,7 +9293,7 @@ function cr(e, t) {
|
|
|
9179
9293
|
i.posBeforeNode
|
|
9180
9294
|
).nodeBefore;
|
|
9181
9295
|
if (r)
|
|
9182
|
-
return
|
|
9296
|
+
return w(
|
|
9183
9297
|
r,
|
|
9184
9298
|
e.schema.blockSchema,
|
|
9185
9299
|
e.schema.inlineContentSchema,
|
|
@@ -9195,7 +9309,7 @@ function ur(e, t) {
|
|
|
9195
9309
|
i.posBeforeNode + i.node.nodeSize
|
|
9196
9310
|
).nodeAfter;
|
|
9197
9311
|
if (r)
|
|
9198
|
-
return
|
|
9312
|
+
return w(
|
|
9199
9313
|
r,
|
|
9200
9314
|
e.schema.blockSchema,
|
|
9201
9315
|
e.schema.inlineContentSchema,
|
|
@@ -9211,7 +9325,7 @@ function pr(e, t) {
|
|
|
9211
9325
|
i.posBeforeNode
|
|
9212
9326
|
), r = n.node(), a = n.node(-1), s = a.type.name !== "doc" ? r.type.name === "blockGroup" ? a : r : void 0;
|
|
9213
9327
|
if (s)
|
|
9214
|
-
return
|
|
9328
|
+
return w(
|
|
9215
9329
|
s,
|
|
9216
9330
|
e.schema.blockSchema,
|
|
9217
9331
|
e.schema.inlineContentSchema,
|
|
@@ -9228,7 +9342,7 @@ function hr(e, t, o, i = { updateSelection: !0 }) {
|
|
|
9228
9342
|
const { parent: c } = n.doc.resolve(r);
|
|
9229
9343
|
c.isTextblock && !c.type.spec.code && !c.childCount && (r -= 1, a += 1);
|
|
9230
9344
|
}
|
|
9231
|
-
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;
|
|
9232
9346
|
}
|
|
9233
9347
|
function mr(e) {
|
|
9234
9348
|
const t = e._tiptapEditor.state;
|
|
@@ -9244,7 +9358,7 @@ function mr(e) {
|
|
|
9244
9358
|
throw new Error(
|
|
9245
9359
|
`Error getting selection - node not found at position ${u}`
|
|
9246
9360
|
);
|
|
9247
|
-
return
|
|
9361
|
+
return w(
|
|
9248
9362
|
h,
|
|
9249
9363
|
e.schema.blockSchema,
|
|
9250
9364
|
e.schema.inlineContentSchema,
|
|
@@ -9254,7 +9368,7 @@ function mr(e) {
|
|
|
9254
9368
|
}, r = [], a = o.sharedDepth(i.pos), s = o.index(a), l = i.index(a);
|
|
9255
9369
|
if (o.depth > a) {
|
|
9256
9370
|
r.push(
|
|
9257
|
-
|
|
9371
|
+
w(
|
|
9258
9372
|
o.nodeAfter,
|
|
9259
9373
|
e.schema.blockSchema,
|
|
9260
9374
|
e.schema.inlineContentSchema,
|
|
@@ -9328,28 +9442,28 @@ function gr(e) {
|
|
|
9328
9442
|
).nodeAfter;
|
|
9329
9443
|
let r;
|
|
9330
9444
|
return o.depth > 1 && (r = o.node(), r.type.isInGroup("bnBlock") || (r = o.node(o.depth - 1))), {
|
|
9331
|
-
block:
|
|
9445
|
+
block: w(
|
|
9332
9446
|
t.node,
|
|
9333
9447
|
e.schema.blockSchema,
|
|
9334
9448
|
e.schema.inlineContentSchema,
|
|
9335
9449
|
e.schema.styleSchema,
|
|
9336
9450
|
e.blockCache
|
|
9337
9451
|
),
|
|
9338
|
-
prevBlock: i === null ? void 0 :
|
|
9452
|
+
prevBlock: i === null ? void 0 : w(
|
|
9339
9453
|
i,
|
|
9340
9454
|
e.schema.blockSchema,
|
|
9341
9455
|
e.schema.inlineContentSchema,
|
|
9342
9456
|
e.schema.styleSchema,
|
|
9343
9457
|
e.blockCache
|
|
9344
9458
|
),
|
|
9345
|
-
nextBlock: n === null ? void 0 :
|
|
9459
|
+
nextBlock: n === null ? void 0 : w(
|
|
9346
9460
|
n,
|
|
9347
9461
|
e.schema.blockSchema,
|
|
9348
9462
|
e.schema.inlineContentSchema,
|
|
9349
9463
|
e.schema.styleSchema,
|
|
9350
9464
|
e.blockCache
|
|
9351
9465
|
),
|
|
9352
|
-
parentBlock: r === void 0 ? void 0 :
|
|
9466
|
+
parentBlock: r === void 0 ? void 0 : w(
|
|
9353
9467
|
r,
|
|
9354
9468
|
e.schema.blockSchema,
|
|
9355
9469
|
e.schema.inlineContentSchema,
|
|
@@ -9358,7 +9472,7 @@ function gr(e) {
|
|
|
9358
9472
|
)
|
|
9359
9473
|
};
|
|
9360
9474
|
}
|
|
9361
|
-
function
|
|
9475
|
+
function ro(e, t, o = "start") {
|
|
9362
9476
|
const i = typeof t == "string" ? t : t.id, n = A(i, e._tiptapEditor.state.doc);
|
|
9363
9477
|
if (!n)
|
|
9364
9478
|
throw new Error(`Block with ID ${i} not found`);
|
|
@@ -9385,13 +9499,13 @@ function no(e, t, o = "start") {
|
|
|
9385
9499
|
throw new D(a);
|
|
9386
9500
|
} else {
|
|
9387
9501
|
const s = o === "start" ? r.childContainer.node.firstChild : r.childContainer.node.lastChild;
|
|
9388
|
-
|
|
9502
|
+
ro(e, s.attrs.id, o);
|
|
9389
9503
|
}
|
|
9390
9504
|
}
|
|
9391
|
-
let
|
|
9505
|
+
let Q;
|
|
9392
9506
|
async function qe() {
|
|
9393
|
-
if (
|
|
9394
|
-
return
|
|
9507
|
+
if (Q)
|
|
9508
|
+
return Q;
|
|
9395
9509
|
const e = await Promise.all([
|
|
9396
9510
|
import("rehype-parse"),
|
|
9397
9511
|
import("rehype-stringify"),
|
|
@@ -9404,7 +9518,7 @@ async function qe() {
|
|
|
9404
9518
|
import("remark-rehype"),
|
|
9405
9519
|
import("rehype-format")
|
|
9406
9520
|
]);
|
|
9407
|
-
return
|
|
9521
|
+
return Q = {
|
|
9408
9522
|
rehypeParse: e[0],
|
|
9409
9523
|
rehypeStringify: e[1],
|
|
9410
9524
|
unified: e[2],
|
|
@@ -9415,7 +9529,7 @@ async function qe() {
|
|
|
9415
9529
|
remarkParse: e[7],
|
|
9416
9530
|
remarkRehype: e[8],
|
|
9417
9531
|
rehypeFormat: e[9]
|
|
9418
|
-
},
|
|
9532
|
+
}, Q;
|
|
9419
9533
|
}
|
|
9420
9534
|
function br() {
|
|
9421
9535
|
const e = (t) => {
|
|
@@ -9434,7 +9548,7 @@ function br() {
|
|
|
9434
9548
|
return e;
|
|
9435
9549
|
}
|
|
9436
9550
|
function kr() {
|
|
9437
|
-
const e =
|
|
9551
|
+
const e = Q;
|
|
9438
9552
|
if (!e)
|
|
9439
9553
|
throw new Error(
|
|
9440
9554
|
"addSpacesToCheckboxes requires ESM dependencies to be initialized"
|
|
@@ -9456,7 +9570,7 @@ function kr() {
|
|
|
9456
9570
|
return t;
|
|
9457
9571
|
}
|
|
9458
9572
|
function Xe(e) {
|
|
9459
|
-
const t =
|
|
9573
|
+
const t = Q;
|
|
9460
9574
|
if (!t)
|
|
9461
9575
|
throw new Error(
|
|
9462
9576
|
"cleanHTMLToMarkdown requires ESM dependencies to be initialized"
|
|
@@ -9505,20 +9619,20 @@ let ht = null;
|
|
|
9505
9619
|
function Cr() {
|
|
9506
9620
|
return ht || (ht = document.implementation.createHTMLDocument("title"));
|
|
9507
9621
|
}
|
|
9508
|
-
function
|
|
9622
|
+
function ao(e) {
|
|
9509
9623
|
if (typeof e == "string") {
|
|
9510
9624
|
const t = Cr().createElement("div");
|
|
9511
9625
|
t.innerHTML = e, e = t;
|
|
9512
9626
|
}
|
|
9513
9627
|
return wr(e), xr(e), e;
|
|
9514
9628
|
}
|
|
9515
|
-
async function
|
|
9516
|
-
const r =
|
|
9629
|
+
async function so(e, t, o, i, n) {
|
|
9630
|
+
const r = ao(e), s = wt.fromSchema(n).parse(r, {
|
|
9517
9631
|
topNode: n.nodes.blockGroup.create()
|
|
9518
9632
|
}), l = [];
|
|
9519
9633
|
for (let d = 0; d < s.childCount; d++)
|
|
9520
9634
|
l.push(
|
|
9521
|
-
|
|
9635
|
+
w(s.child(d), t, o, i)
|
|
9522
9636
|
);
|
|
9523
9637
|
return l;
|
|
9524
9638
|
}
|
|
@@ -9545,7 +9659,7 @@ async function Sr(e, t, o, i, n) {
|
|
|
9545
9659
|
code: Er
|
|
9546
9660
|
}
|
|
9547
9661
|
}).use(r.rehypeStringify.default).processSync(e);
|
|
9548
|
-
return
|
|
9662
|
+
return so(
|
|
9549
9663
|
a.value,
|
|
9550
9664
|
t,
|
|
9551
9665
|
o,
|
|
@@ -9573,7 +9687,7 @@ function Tr(e, t) {
|
|
|
9573
9687
|
throw new Error(`The string ${t} is not a valid MIME type.`);
|
|
9574
9688
|
return o[1] === "*" || i[1] === "*" ? o[0] === i[0] : (o[0] === "*" || i[0] === "*" || o[0] === i[0]) && o[1] === i[1];
|
|
9575
9689
|
}
|
|
9576
|
-
async function
|
|
9690
|
+
async function lo(e, t) {
|
|
9577
9691
|
var a;
|
|
9578
9692
|
if (!t.uploadFile) {
|
|
9579
9693
|
console.warn(
|
|
@@ -9670,7 +9784,7 @@ const Mr = (e) => L.create({
|
|
|
9670
9784
|
i = n;
|
|
9671
9785
|
break;
|
|
9672
9786
|
}
|
|
9673
|
-
return i === null ? !0 : i === "Files" ? (
|
|
9787
|
+
return i === null ? !0 : i === "Files" ? (lo(o, e), !0) : !1;
|
|
9674
9788
|
}
|
|
9675
9789
|
}
|
|
9676
9790
|
}
|
|
@@ -9717,9 +9831,9 @@ const Lr = (e) => L.create({
|
|
|
9717
9831
|
if (i === "vscode-editor-data")
|
|
9718
9832
|
return Ir(o, t), !0;
|
|
9719
9833
|
if (i === "Files")
|
|
9720
|
-
return
|
|
9834
|
+
return lo(o, e), !0;
|
|
9721
9835
|
let n = o.clipboardData.getData(i);
|
|
9722
|
-
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);
|
|
9723
9837
|
}
|
|
9724
9838
|
}
|
|
9725
9839
|
}
|
|
@@ -9727,13 +9841,13 @@ const Lr = (e) => L.create({
|
|
|
9727
9841
|
];
|
|
9728
9842
|
}
|
|
9729
9843
|
});
|
|
9730
|
-
function
|
|
9844
|
+
function co(e, t) {
|
|
9731
9845
|
const o = [];
|
|
9732
9846
|
return e.descendants((i) => {
|
|
9733
9847
|
var n, r;
|
|
9734
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) => {
|
|
9735
9849
|
o.push(
|
|
9736
|
-
|
|
9850
|
+
w(
|
|
9737
9851
|
a,
|
|
9738
9852
|
t.blockSchema,
|
|
9739
9853
|
t.inlineContentSchema,
|
|
@@ -9741,7 +9855,7 @@ function lo(e, t) {
|
|
|
9741
9855
|
)
|
|
9742
9856
|
);
|
|
9743
9857
|
}), !1) : i.type.isInGroup("bnBlock") ? (o.push(
|
|
9744
|
-
|
|
9858
|
+
w(
|
|
9745
9859
|
i,
|
|
9746
9860
|
t.blockSchema,
|
|
9747
9861
|
t.inlineContentSchema,
|
|
@@ -9773,7 +9887,7 @@ function Ar(e, t, o) {
|
|
|
9773
9887
|
);
|
|
9774
9888
|
if (n) {
|
|
9775
9889
|
((s = t.firstChild) == null ? void 0 : s.type.name) === "table" && (t = t.firstChild.content);
|
|
9776
|
-
const l =
|
|
9890
|
+
const l = Ht(
|
|
9777
9891
|
t,
|
|
9778
9892
|
o.schema.inlineContentSchema,
|
|
9779
9893
|
o.schema.styleSchema
|
|
@@ -9790,12 +9904,12 @@ function Ar(e, t, o) {
|
|
|
9790
9904
|
);
|
|
9791
9905
|
r = a.exportInlineContent(l, {});
|
|
9792
9906
|
} else {
|
|
9793
|
-
const l =
|
|
9907
|
+
const l = co(t, o.schema);
|
|
9794
9908
|
r = a.exportBlocks(l, {});
|
|
9795
9909
|
}
|
|
9796
9910
|
return r;
|
|
9797
9911
|
}
|
|
9798
|
-
function
|
|
9912
|
+
function uo(e, t) {
|
|
9799
9913
|
"node" in e.state.selection && e.state.selection.node.type.spec.group === "blockContent" && t.dispatch(
|
|
9800
9914
|
t._tiptapEditor.state.tr.setSelection(
|
|
9801
9915
|
new ce(e.state.doc.resolve(e.state.selection.from - 1))
|
|
@@ -9823,7 +9937,7 @@ const mt = () => {
|
|
|
9823
9937
|
return !1;
|
|
9824
9938
|
}, ft = (e, t, o) => {
|
|
9825
9939
|
o.preventDefault(), o.clipboardData.clearData();
|
|
9826
|
-
const { clipboardHTML: i, externalHTML: n, markdown: r } =
|
|
9940
|
+
const { clipboardHTML: i, externalHTML: n, markdown: r } = uo(
|
|
9827
9941
|
t,
|
|
9828
9942
|
e
|
|
9829
9943
|
);
|
|
@@ -9854,7 +9968,7 @@ const mt = () => {
|
|
|
9854
9968
|
)
|
|
9855
9969
|
)
|
|
9856
9970
|
), o.preventDefault(), o.dataTransfer.clearData();
|
|
9857
|
-
const { clipboardHTML: i, externalHTML: n, markdown: r } =
|
|
9971
|
+
const { clipboardHTML: i, externalHTML: n, markdown: r } = uo(t, e);
|
|
9858
9972
|
return o.dataTransfer.setData("blocknote/html", i), o.dataTransfer.setData("text/html", n), o.dataTransfer.setData("text/plain", r), !0;
|
|
9859
9973
|
}
|
|
9860
9974
|
}
|
|
@@ -9870,9 +9984,9 @@ const mt = () => {
|
|
|
9870
9984
|
types: ["blockContainer"],
|
|
9871
9985
|
attributes: {
|
|
9872
9986
|
backgroundColor: {
|
|
9873
|
-
default:
|
|
9874
|
-
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") :
|
|
9875
|
-
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 ? {} : {
|
|
9876
9990
|
"data-background-color": e.backgroundColor
|
|
9877
9991
|
}
|
|
9878
9992
|
}
|
|
@@ -9880,7 +9994,82 @@ const mt = () => {
|
|
|
9880
9994
|
}
|
|
9881
9995
|
];
|
|
9882
9996
|
}
|
|
9883
|
-
})
|
|
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
|
+
};
|
|
9884
10073
|
class ne {
|
|
9885
10074
|
constructor() {
|
|
9886
10075
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -9901,7 +10090,7 @@ class ne {
|
|
|
9901
10090
|
this.callbacks = {};
|
|
9902
10091
|
}
|
|
9903
10092
|
}
|
|
9904
|
-
class
|
|
10093
|
+
class Dr {
|
|
9905
10094
|
constructor(t, o, i, n) {
|
|
9906
10095
|
p(this, "state");
|
|
9907
10096
|
p(this, "emitUpdate");
|
|
@@ -9958,7 +10147,7 @@ class jr {
|
|
|
9958
10147
|
}
|
|
9959
10148
|
}
|
|
9960
10149
|
const Ae = new N("FilePanelPlugin");
|
|
9961
|
-
class
|
|
10150
|
+
class Hr extends ne {
|
|
9962
10151
|
constructor(o) {
|
|
9963
10152
|
super();
|
|
9964
10153
|
p(this, "view");
|
|
@@ -9969,7 +10158,7 @@ class Dr extends ne {
|
|
|
9969
10158
|
});
|
|
9970
10159
|
this.plugin = new B({
|
|
9971
10160
|
key: Ae,
|
|
9972
|
-
view: (i) => (this.view = new
|
|
10161
|
+
view: (i) => (this.view = new Dr(
|
|
9973
10162
|
o,
|
|
9974
10163
|
Ae,
|
|
9975
10164
|
i,
|
|
@@ -10004,7 +10193,7 @@ class Dr extends ne {
|
|
|
10004
10193
|
return this.on("update", o);
|
|
10005
10194
|
}
|
|
10006
10195
|
}
|
|
10007
|
-
class
|
|
10196
|
+
class Ur {
|
|
10008
10197
|
constructor(t, o, i) {
|
|
10009
10198
|
p(this, "state");
|
|
10010
10199
|
p(this, "emitUpdate");
|
|
@@ -10090,18 +10279,18 @@ class Hr {
|
|
|
10090
10279
|
return je(this.pmView, n, r);
|
|
10091
10280
|
}
|
|
10092
10281
|
}
|
|
10093
|
-
const
|
|
10282
|
+
const Or = new N(
|
|
10094
10283
|
"FormattingToolbarPlugin"
|
|
10095
10284
|
);
|
|
10096
|
-
class
|
|
10285
|
+
class Rr extends ne {
|
|
10097
10286
|
constructor(o) {
|
|
10098
10287
|
super();
|
|
10099
10288
|
p(this, "view");
|
|
10100
10289
|
p(this, "plugin");
|
|
10101
10290
|
p(this, "closeMenu", () => this.view.closeMenu());
|
|
10102
10291
|
this.plugin = new B({
|
|
10103
|
-
key:
|
|
10104
|
-
view: (i) => (this.view = new
|
|
10292
|
+
key: Or,
|
|
10293
|
+
view: (i) => (this.view = new Ur(o, i, (n) => {
|
|
10105
10294
|
this.emit("update", n);
|
|
10106
10295
|
}), this.view),
|
|
10107
10296
|
props: {
|
|
@@ -10136,13 +10325,13 @@ const gt = (e, t) => {
|
|
|
10136
10325
|
return pe(
|
|
10137
10326
|
e.resolve(n)
|
|
10138
10327
|
);
|
|
10139
|
-
},
|
|
10328
|
+
}, po = (e, t) => {
|
|
10140
10329
|
for (; t.childContainer; ) {
|
|
10141
10330
|
const o = t.childContainer.node, i = e.resolve(t.childContainer.beforePos + 1).posAtIndex(o.childCount - 1);
|
|
10142
10331
|
t = pe(e.resolve(i));
|
|
10143
10332
|
}
|
|
10144
10333
|
return t;
|
|
10145
|
-
},
|
|
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) => {
|
|
10146
10335
|
if (!i.isBlockContainer)
|
|
10147
10336
|
throw new Error(
|
|
10148
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`
|
|
@@ -10181,12 +10370,12 @@ const gt = (e, t) => {
|
|
|
10181
10370
|
);
|
|
10182
10371
|
if (!r)
|
|
10183
10372
|
return !1;
|
|
10184
|
-
const a =
|
|
10373
|
+
const a = po(
|
|
10185
10374
|
t.doc,
|
|
10186
10375
|
r
|
|
10187
10376
|
);
|
|
10188
|
-
return
|
|
10189
|
-
},
|
|
10377
|
+
return Vr(a, n) ? zr(t, o, a, n) : !1;
|
|
10378
|
+
}, Fr = L.create({
|
|
10190
10379
|
priority: 50,
|
|
10191
10380
|
// TODO: The shortcuts need a refactor. Do we want to use a command priority
|
|
10192
10381
|
// design as there is now, or clump the logic into a single function?
|
|
@@ -10342,7 +10531,7 @@ const gt = (e, t) => {
|
|
|
10342
10531
|
a.bnBlock.beforePos
|
|
10343
10532
|
);
|
|
10344
10533
|
if (d && s && l) {
|
|
10345
|
-
const c =
|
|
10534
|
+
const c = po(
|
|
10346
10535
|
r.doc,
|
|
10347
10536
|
d
|
|
10348
10537
|
);
|
|
@@ -10424,7 +10613,7 @@ const gt = (e, t) => {
|
|
|
10424
10613
|
return !1;
|
|
10425
10614
|
const { blockContent: s } = a, l = n.selection.$anchor.parentOffset === 0;
|
|
10426
10615
|
return s.node.childCount === 0 ? !1 : (r().deleteSelection().command(
|
|
10427
|
-
|
|
10616
|
+
$t(
|
|
10428
10617
|
n.selection.from,
|
|
10429
10618
|
l,
|
|
10430
10619
|
l
|
|
@@ -10436,7 +10625,7 @@ const gt = (e, t) => {
|
|
|
10436
10625
|
// editor since the browser will try to use tab for keyboard navigation.
|
|
10437
10626
|
Tab: () => {
|
|
10438
10627
|
var i, n, r;
|
|
10439
|
-
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);
|
|
10440
10629
|
},
|
|
10441
10630
|
"Shift-Tab": () => {
|
|
10442
10631
|
var i, n, r;
|
|
@@ -10447,7 +10636,7 @@ const gt = (e, t) => {
|
|
|
10447
10636
|
};
|
|
10448
10637
|
}
|
|
10449
10638
|
});
|
|
10450
|
-
class
|
|
10639
|
+
class Gr {
|
|
10451
10640
|
constructor(t, o, i) {
|
|
10452
10641
|
p(this, "state");
|
|
10453
10642
|
p(this, "emitUpdate");
|
|
@@ -10575,8 +10764,8 @@ class Fr {
|
|
|
10575
10764
|
);
|
|
10576
10765
|
}
|
|
10577
10766
|
}
|
|
10578
|
-
const
|
|
10579
|
-
class
|
|
10767
|
+
const $r = new N("LinkToolbarPlugin");
|
|
10768
|
+
class Wr extends ne {
|
|
10580
10769
|
constructor(o) {
|
|
10581
10770
|
super();
|
|
10582
10771
|
p(this, "view");
|
|
@@ -10615,8 +10804,8 @@ class $r extends ne {
|
|
|
10615
10804
|
});
|
|
10616
10805
|
p(this, "closeMenu", () => this.view.closeMenu());
|
|
10617
10806
|
this.plugin = new B({
|
|
10618
|
-
key:
|
|
10619
|
-
view: (i) => (this.view = new
|
|
10807
|
+
key: $r,
|
|
10808
|
+
view: (i) => (this.view = new Gr(o, i, (n) => {
|
|
10620
10809
|
this.emit("update", n);
|
|
10621
10810
|
}), this.view),
|
|
10622
10811
|
props: {
|
|
@@ -10632,7 +10821,7 @@ class $r extends ne {
|
|
|
10632
10821
|
return ((i = (o = this.view) == null ? void 0 : o.state) == null ? void 0 : i.show) || !1;
|
|
10633
10822
|
}
|
|
10634
10823
|
}
|
|
10635
|
-
const
|
|
10824
|
+
const Kr = [
|
|
10636
10825
|
"http",
|
|
10637
10826
|
"https",
|
|
10638
10827
|
"ftp",
|
|
@@ -10643,12 +10832,12 @@ const Wr = [
|
|
|
10643
10832
|
"sms",
|
|
10644
10833
|
"cid",
|
|
10645
10834
|
"xmpp"
|
|
10646
|
-
],
|
|
10647
|
-
class
|
|
10835
|
+
], qr = "https", Xr = new N("node-selection-keyboard");
|
|
10836
|
+
class Zr {
|
|
10648
10837
|
constructor() {
|
|
10649
10838
|
p(this, "plugin");
|
|
10650
10839
|
this.plugin = new B({
|
|
10651
|
-
key:
|
|
10840
|
+
key: Xr,
|
|
10652
10841
|
props: {
|
|
10653
10842
|
handleKeyDown: (t, o) => {
|
|
10654
10843
|
if ("node" in t.state.selection) {
|
|
@@ -10676,69 +10865,83 @@ class Xr {
|
|
|
10676
10865
|
});
|
|
10677
10866
|
}
|
|
10678
10867
|
}
|
|
10679
|
-
const
|
|
10680
|
-
class
|
|
10868
|
+
const Jr = new N("blocknote-placeholder");
|
|
10869
|
+
class Yr {
|
|
10681
10870
|
constructor(t, o) {
|
|
10682
10871
|
p(this, "plugin");
|
|
10683
10872
|
this.plugin = new B({
|
|
10684
|
-
key:
|
|
10685
|
-
view: () => {
|
|
10686
|
-
var
|
|
10687
|
-
const
|
|
10688
|
-
|
|
10689
|
-
const r =
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
const
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
|
|
10699
|
-
|
|
10700
|
-
|
|
10701
|
-
|
|
10702
|
-
|
|
10703
|
-
)} { content: ${JSON.stringify(u)}; }`
|
|
10704
|
-
), h || r.insertRule(
|
|
10705
|
-
`${s(c, !0)} { content: ${JSON.stringify(
|
|
10706
|
-
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
|
|
10707
10892
|
)}; }`
|
|
10708
10893
|
);
|
|
10709
|
-
} catch (m) {
|
|
10710
|
-
console.warn(
|
|
10711
|
-
"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)",
|
|
10712
|
-
m
|
|
10713
|
-
);
|
|
10714
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
|
+
);
|
|
10715
10910
|
}
|
|
10716
10911
|
return {
|
|
10717
10912
|
destroy: () => {
|
|
10718
|
-
var
|
|
10719
|
-
((
|
|
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);
|
|
10720
10915
|
}
|
|
10721
10916
|
};
|
|
10722
10917
|
},
|
|
10723
10918
|
props: {
|
|
10724
|
-
// TODO: maybe also add placeholder for empty document ("e.g.: start writing..")
|
|
10725
10919
|
decorations: (i) => {
|
|
10726
10920
|
const { doc: n, selection: r } = i;
|
|
10727
10921
|
if (!t.isEditable || !r.empty || r.$from.parent.type.spec.code)
|
|
10728
10922
|
return;
|
|
10729
|
-
const a =
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
|
|
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);
|
|
10736
10939
|
}
|
|
10737
10940
|
}
|
|
10738
10941
|
});
|
|
10739
10942
|
}
|
|
10740
10943
|
}
|
|
10741
|
-
const kt = new N("previous-blocks"),
|
|
10944
|
+
const kt = new N("previous-blocks"), Qr = {
|
|
10742
10945
|
// Numbered List Items
|
|
10743
10946
|
index: "index",
|
|
10744
10947
|
// Headings
|
|
@@ -10748,7 +10951,7 @@ const kt = new N("previous-blocks"), Yr = {
|
|
|
10748
10951
|
depth: "depth",
|
|
10749
10952
|
"depth-change": "depth-change"
|
|
10750
10953
|
};
|
|
10751
|
-
class
|
|
10954
|
+
class ea {
|
|
10752
10955
|
constructor() {
|
|
10753
10956
|
p(this, "plugin");
|
|
10754
10957
|
let t;
|
|
@@ -10818,8 +11021,8 @@ class Qr {
|
|
|
10818
11021
|
return;
|
|
10819
11022
|
const s = i.currentTransactionOldBlockAttrs[r.attrs.id], l = {};
|
|
10820
11023
|
for (const [c, u] of Object.entries(s))
|
|
10821
|
-
l["data-prev-" +
|
|
10822
|
-
const d =
|
|
11024
|
+
l["data-prev-" + Qr[c]] = u || "none";
|
|
11025
|
+
const d = X.node(a, a + r.nodeSize, {
|
|
10823
11026
|
...l
|
|
10824
11027
|
});
|
|
10825
11028
|
n.push(d);
|
|
@@ -10829,14 +11032,14 @@ class Qr {
|
|
|
10829
11032
|
});
|
|
10830
11033
|
}
|
|
10831
11034
|
}
|
|
10832
|
-
function
|
|
11035
|
+
function ho(e, t) {
|
|
10833
11036
|
var o, i;
|
|
10834
11037
|
for (; e && e.parentElement && e.parentElement !== t.dom && ((o = e.getAttribute) == null ? void 0 : o.call(e, "data-node-type")) !== "blockContainer"; )
|
|
10835
11038
|
e = e.parentElement;
|
|
10836
11039
|
if (((i = e.getAttribute) == null ? void 0 : i.call(e, "data-node-type")) === "blockContainer")
|
|
10837
11040
|
return { node: e, id: e.getAttribute("data-id") };
|
|
10838
11041
|
}
|
|
10839
|
-
class
|
|
11042
|
+
class ee extends Me {
|
|
10840
11043
|
constructor(o, i) {
|
|
10841
11044
|
super(o, i);
|
|
10842
11045
|
p(this, "nodes");
|
|
@@ -10847,13 +11050,13 @@ class Q extends Me {
|
|
|
10847
11050
|
});
|
|
10848
11051
|
}
|
|
10849
11052
|
static create(o, i, n = i) {
|
|
10850
|
-
return new
|
|
11053
|
+
return new ee(o.resolve(i), o.resolve(n));
|
|
10851
11054
|
}
|
|
10852
11055
|
content() {
|
|
10853
11056
|
return new q(j.from(this.nodes), 0, 0);
|
|
10854
11057
|
}
|
|
10855
11058
|
eq(o) {
|
|
10856
|
-
if (!(o instanceof
|
|
11059
|
+
if (!(o instanceof ee) || this.nodes.length !== o.nodes.length || this.from !== o.from || this.to !== o.to)
|
|
10857
11060
|
return !1;
|
|
10858
11061
|
for (let i = 0; i < this.nodes.length; i++)
|
|
10859
11062
|
if (!this.nodes[i].eq(o.nodes[i]))
|
|
@@ -10862,7 +11065,7 @@ class Q extends Me {
|
|
|
10862
11065
|
}
|
|
10863
11066
|
map(o, i) {
|
|
10864
11067
|
const n = i.mapResult(this.from), r = i.mapResult(this.to);
|
|
10865
|
-
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(
|
|
10866
11069
|
o.resolve(n.pos),
|
|
10867
11070
|
o.resolve(r.pos)
|
|
10868
11071
|
);
|
|
@@ -10872,7 +11075,7 @@ class Q extends Me {
|
|
|
10872
11075
|
}
|
|
10873
11076
|
}
|
|
10874
11077
|
let O;
|
|
10875
|
-
function
|
|
11078
|
+
function ta(e, t) {
|
|
10876
11079
|
let o, i;
|
|
10877
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);
|
|
10878
11081
|
if (n && r) {
|
|
@@ -10895,16 +11098,16 @@ function _t(e, t, o = t) {
|
|
|
10895
11098
|
);
|
|
10896
11099
|
for (let c = n.childElementCount - 1; c >= 0; c--)
|
|
10897
11100
|
(c > s || c < a) && i.removeChild(i.children[c]);
|
|
10898
|
-
|
|
11101
|
+
mo(e.root), O = i;
|
|
10899
11102
|
const d = e.dom.className.split(" ").filter(
|
|
10900
11103
|
(c) => c !== "ProseMirror" && c !== "bn-root" && c !== "bn-editor"
|
|
10901
11104
|
).join(" ");
|
|
10902
11105
|
O.className = O.className + " bn-drag-preview " + d, e.root instanceof ShadowRoot ? e.root.appendChild(O) : e.root.body.appendChild(O);
|
|
10903
11106
|
}
|
|
10904
|
-
function
|
|
11107
|
+
function mo(e) {
|
|
10905
11108
|
O !== void 0 && (e instanceof ShadowRoot ? e.removeChild(O) : e.body.removeChild(O), O = void 0);
|
|
10906
11109
|
}
|
|
10907
|
-
function
|
|
11110
|
+
function oa(e, t, o) {
|
|
10908
11111
|
if (!e.dataTransfer)
|
|
10909
11112
|
return;
|
|
10910
11113
|
const i = o.prosemirrorView;
|
|
@@ -10915,14 +11118,14 @@ function ta(e, t, o) {
|
|
|
10915
11118
|
throw new Error(`Block with ID ${t.id} not found`);
|
|
10916
11119
|
const r = n.posBeforeNode;
|
|
10917
11120
|
if (r != null) {
|
|
10918
|
-
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;
|
|
10919
11122
|
c && u ? (i.dispatch(
|
|
10920
|
-
i.state.tr.setSelection(
|
|
11123
|
+
i.state.tr.setSelection(ee.create(s, l, d))
|
|
10921
11124
|
), _t(i, l, d)) : (i.dispatch(
|
|
10922
11125
|
i.state.tr.setSelection(ce.create(i.state.doc, r))
|
|
10923
11126
|
), _t(i, r));
|
|
10924
|
-
const h = i.state.selection.content(), m = o.pmSchema, f = i.serializeForClipboard(h).dom.innerHTML, g = Ee(m, o), b =
|
|
10925
|
-
e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html", f), e.dataTransfer.setData("text/html", k), e.dataTransfer.setData("text/plain",
|
|
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);
|
|
10926
11129
|
}
|
|
10927
11130
|
}
|
|
10928
11131
|
const ae = 0.1;
|
|
@@ -10943,9 +11146,9 @@ function ze(e, t, o, i = !0) {
|
|
|
10943
11146
|
},
|
|
10944
11147
|
o,
|
|
10945
11148
|
!1
|
|
10946
|
-
) :
|
|
11149
|
+
) : ho(r, e);
|
|
10947
11150
|
}
|
|
10948
|
-
function
|
|
11151
|
+
function ia(e, t, o) {
|
|
10949
11152
|
if (!t.dom.firstChild)
|
|
10950
11153
|
return;
|
|
10951
11154
|
const i = t.dom.firstChild.getBoundingClientRect(), n = {
|
|
@@ -10960,7 +11163,7 @@ function oa(e, t, o) {
|
|
|
10960
11163
|
}
|
|
10961
11164
|
return s;
|
|
10962
11165
|
}
|
|
10963
|
-
class
|
|
11166
|
+
class na {
|
|
10964
11167
|
constructor(t, o, i, n) {
|
|
10965
11168
|
p(this, "state");
|
|
10966
11169
|
p(this, "emitUpdate");
|
|
@@ -10975,7 +11178,7 @@ class ia {
|
|
|
10975
11178
|
var i, n, r, a;
|
|
10976
11179
|
if (this.menuFrozen || !this.mousePos)
|
|
10977
11180
|
return;
|
|
10978
|
-
const t =
|
|
11181
|
+
const t = ia(
|
|
10979
11182
|
this.mousePos,
|
|
10980
11183
|
this.pmView,
|
|
10981
11184
|
this.sideMenuDetection
|
|
@@ -11176,8 +11379,8 @@ class ia {
|
|
|
11176
11379
|
), this.pmView.root.removeEventListener("scroll", this.onScroll, !0);
|
|
11177
11380
|
}
|
|
11178
11381
|
}
|
|
11179
|
-
const
|
|
11180
|
-
class
|
|
11382
|
+
const ra = new N("SideMenuPlugin");
|
|
11383
|
+
class aa extends ne {
|
|
11181
11384
|
constructor(o, i) {
|
|
11182
11385
|
super();
|
|
11183
11386
|
p(this, "view");
|
|
@@ -11186,13 +11389,13 @@ class ra extends ne {
|
|
|
11186
11389
|
* Handles drag & drop events for blocks.
|
|
11187
11390
|
*/
|
|
11188
11391
|
p(this, "blockDragStart", (o, i) => {
|
|
11189
|
-
this.view && (this.view.isDragOrigin = !0),
|
|
11392
|
+
this.view && (this.view.isDragOrigin = !0), oa(o, i, this.editor);
|
|
11190
11393
|
});
|
|
11191
11394
|
/**
|
|
11192
11395
|
* Handles drag & drop events for blocks.
|
|
11193
11396
|
*/
|
|
11194
11397
|
p(this, "blockDragEnd", () => {
|
|
11195
|
-
this.editor.prosemirrorView &&
|
|
11398
|
+
this.editor.prosemirrorView && mo(this.editor.prosemirrorView.root), this.view && (this.view.isDragOrigin = !1);
|
|
11196
11399
|
});
|
|
11197
11400
|
/**
|
|
11198
11401
|
* Freezes the side menu. When frozen, the side menu will stay
|
|
@@ -11211,8 +11414,8 @@ class ra extends ne {
|
|
|
11211
11414
|
this.view.menuFrozen = !1, this.view.state.show = !1, this.view.emitUpdate(this.view.state);
|
|
11212
11415
|
});
|
|
11213
11416
|
this.editor = o, this.plugin = new B({
|
|
11214
|
-
key:
|
|
11215
|
-
view: (n) => (this.view = new
|
|
11417
|
+
key: ra,
|
|
11418
|
+
view: (n) => (this.view = new na(
|
|
11216
11419
|
o,
|
|
11217
11420
|
i,
|
|
11218
11421
|
n,
|
|
@@ -11226,8 +11429,8 @@ class ra extends ne {
|
|
|
11226
11429
|
return this.on("update", o);
|
|
11227
11430
|
}
|
|
11228
11431
|
}
|
|
11229
|
-
const
|
|
11230
|
-
class
|
|
11432
|
+
const sa = So((e) => e.type.name === "blockContainer");
|
|
11433
|
+
class la {
|
|
11231
11434
|
constructor(t, o) {
|
|
11232
11435
|
p(this, "state");
|
|
11233
11436
|
p(this, "emitUpdate");
|
|
@@ -11246,7 +11449,7 @@ class sa {
|
|
|
11246
11449
|
});
|
|
11247
11450
|
p(this, "closeMenu", () => {
|
|
11248
11451
|
this.editor.dispatch(
|
|
11249
|
-
this.editor._tiptapEditor.state.tr.setMeta(
|
|
11452
|
+
this.editor._tiptapEditor.state.tr.setMeta(te, null)
|
|
11250
11453
|
);
|
|
11251
11454
|
});
|
|
11252
11455
|
p(this, "clearQuery", () => {
|
|
@@ -11268,7 +11471,7 @@ class sa {
|
|
|
11268
11471
|
}
|
|
11269
11472
|
update(t, o) {
|
|
11270
11473
|
var d;
|
|
11271
|
-
const i =
|
|
11474
|
+
const i = te.getState(o), n = te.getState(
|
|
11272
11475
|
t.state
|
|
11273
11476
|
), r = i === void 0 && n !== void 0, a = i !== void 0 && n === void 0;
|
|
11274
11477
|
if (!r && !(i !== void 0 && n !== void 0) && !a)
|
|
@@ -11291,8 +11494,8 @@ class sa {
|
|
|
11291
11494
|
(t = this.rootEl) == null || t.removeEventListener("scroll", this.handleScroll, !0);
|
|
11292
11495
|
}
|
|
11293
11496
|
}
|
|
11294
|
-
const
|
|
11295
|
-
class
|
|
11497
|
+
const te = new N("SuggestionMenuPlugin");
|
|
11498
|
+
class da extends ne {
|
|
11296
11499
|
constructor(o) {
|
|
11297
11500
|
super();
|
|
11298
11501
|
p(this, "view");
|
|
@@ -11311,8 +11514,8 @@ class la extends ne {
|
|
|
11311
11514
|
p(this, "clearQuery", () => this.view.clearQuery());
|
|
11312
11515
|
const i = this.triggerCharacters;
|
|
11313
11516
|
this.plugin = new B({
|
|
11314
|
-
key:
|
|
11315
|
-
view: () => (this.view = new
|
|
11517
|
+
key: te,
|
|
11518
|
+
view: () => (this.view = new la(
|
|
11316
11519
|
o,
|
|
11317
11520
|
(n, r) => {
|
|
11318
11521
|
this.emit(`update ${n}`, r);
|
|
@@ -11326,7 +11529,7 @@ class la extends ne {
|
|
|
11326
11529
|
apply(n, r, a, s) {
|
|
11327
11530
|
if (n.getMeta("orderedListIndexing") !== void 0 || n.selection.$from.parent.type.spec.code)
|
|
11328
11531
|
return r;
|
|
11329
|
-
const l = n.getMeta(
|
|
11532
|
+
const l = n.getMeta(te);
|
|
11330
11533
|
if (typeof l == "object" && l !== null && r === void 0)
|
|
11331
11534
|
return {
|
|
11332
11535
|
triggerCharacter: l.triggerCharacter,
|
|
@@ -11358,7 +11561,7 @@ class la extends ne {
|
|
|
11358
11561
|
handleTextInput(n, r, a, s) {
|
|
11359
11562
|
const l = this.getState(n.state);
|
|
11360
11563
|
return i.includes(s) && l === void 0 ? (n.dispatch(
|
|
11361
|
-
n.state.tr.insertText(s).scrollIntoView().setMeta(
|
|
11564
|
+
n.state.tr.insertText(s).scrollIntoView().setMeta(te, {
|
|
11362
11565
|
triggerCharacter: s
|
|
11363
11566
|
})
|
|
11364
11567
|
), !0) : !1;
|
|
@@ -11369,10 +11572,10 @@ class la extends ne {
|
|
|
11369
11572
|
if (r === void 0)
|
|
11370
11573
|
return null;
|
|
11371
11574
|
if (!r.deleteTriggerCharacter) {
|
|
11372
|
-
const a =
|
|
11575
|
+
const a = sa(n.selection);
|
|
11373
11576
|
if (a)
|
|
11374
11577
|
return ie.create(n.doc, [
|
|
11375
|
-
|
|
11578
|
+
X.node(
|
|
11376
11579
|
a.pos,
|
|
11377
11580
|
a.pos + a.node.nodeSize,
|
|
11378
11581
|
{
|
|
@@ -11384,7 +11587,7 @@ class la extends ne {
|
|
|
11384
11587
|
]);
|
|
11385
11588
|
}
|
|
11386
11589
|
return ie.create(n.doc, [
|
|
11387
|
-
|
|
11590
|
+
X.inline(
|
|
11388
11591
|
r.queryStartPos - r.triggerCharacter.length,
|
|
11389
11592
|
r.queryStartPos,
|
|
11390
11593
|
{
|
|
@@ -11413,13 +11616,13 @@ let M;
|
|
|
11413
11616
|
function yt(e) {
|
|
11414
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));
|
|
11415
11618
|
}
|
|
11416
|
-
function
|
|
11619
|
+
function ca(e) {
|
|
11417
11620
|
M && (e instanceof Document ? e.body.removeChild(M) : e.removeChild(M), M = void 0);
|
|
11418
11621
|
}
|
|
11419
11622
|
function ke(e) {
|
|
11420
11623
|
return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
|
|
11421
11624
|
}
|
|
11422
|
-
function
|
|
11625
|
+
function ua(e) {
|
|
11423
11626
|
let t = e;
|
|
11424
11627
|
for (; t && t.nodeName !== "TD" && t.nodeName !== "TH" && !t.classList.contains("tableWrapper"); ) {
|
|
11425
11628
|
if (t.classList.contains("ProseMirror"))
|
|
@@ -11439,12 +11642,12 @@ function ca(e) {
|
|
|
11439
11642
|
tbodyNode: t.querySelector("tbody")
|
|
11440
11643
|
};
|
|
11441
11644
|
}
|
|
11442
|
-
function
|
|
11645
|
+
function pa(e, t) {
|
|
11443
11646
|
const o = t.querySelectorAll(e);
|
|
11444
11647
|
for (let i = 0; i < o.length; i++)
|
|
11445
11648
|
o[i].style.visibility = "hidden";
|
|
11446
11649
|
}
|
|
11447
|
-
class
|
|
11650
|
+
class ha {
|
|
11448
11651
|
constructor(t, o, i) {
|
|
11449
11652
|
p(this, "state");
|
|
11450
11653
|
p(this, "emitUpdate");
|
|
@@ -11464,7 +11667,7 @@ class pa {
|
|
|
11464
11667
|
var d, c, u, h;
|
|
11465
11668
|
if (this.menuFrozen || this.mouseState === "selecting" || !(t.target instanceof Element) || !this.pmView.dom.contains(t.target))
|
|
11466
11669
|
return;
|
|
11467
|
-
const o =
|
|
11670
|
+
const o = ua(t.target);
|
|
11468
11671
|
if ((o == null ? void 0 : o.type) === "cell" && this.mouseState === "down" && !((d = this.state) != null && d.draggingState)) {
|
|
11469
11672
|
this.mouseState = "selecting", (c = this.state) != null && c.show && (this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate());
|
|
11470
11673
|
return;
|
|
@@ -11475,7 +11678,7 @@ class pa {
|
|
|
11475
11678
|
}
|
|
11476
11679
|
if (!o.tbodyNode)
|
|
11477
11680
|
return;
|
|
11478
|
-
const i = o.tbodyNode.getBoundingClientRect(), n =
|
|
11681
|
+
const i = o.tbodyNode.getBoundingClientRect(), n = ho(o.domNode, this.pmView);
|
|
11479
11682
|
if (!n)
|
|
11480
11683
|
return;
|
|
11481
11684
|
this.tableElement = n.node;
|
|
@@ -11486,7 +11689,7 @@ class pa {
|
|
|
11486
11689
|
);
|
|
11487
11690
|
if (!a)
|
|
11488
11691
|
throw new Error(`Block with ID ${n.id} not found`);
|
|
11489
|
-
const s =
|
|
11692
|
+
const s = w(
|
|
11490
11693
|
a.node,
|
|
11491
11694
|
this.editor.schema.blockSchema,
|
|
11492
11695
|
this.editor.schema.inlineContentSchema,
|
|
@@ -11535,7 +11738,7 @@ class pa {
|
|
|
11535
11738
|
var h;
|
|
11536
11739
|
if (((h = this.state) == null ? void 0 : h.draggingState) === void 0)
|
|
11537
11740
|
return;
|
|
11538
|
-
t.preventDefault(), t.dataTransfer.dropEffect = "move",
|
|
11741
|
+
t.preventDefault(), t.dataTransfer.dropEffect = "move", pa(
|
|
11539
11742
|
".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline",
|
|
11540
11743
|
this.pmView.root
|
|
11541
11744
|
);
|
|
@@ -11633,7 +11836,7 @@ class pa {
|
|
|
11633
11836
|
}
|
|
11634
11837
|
}
|
|
11635
11838
|
const se = new N("TableHandlesPlugin");
|
|
11636
|
-
class
|
|
11839
|
+
class ma extends ne {
|
|
11637
11840
|
constructor(o) {
|
|
11638
11841
|
super();
|
|
11639
11842
|
p(this, "view");
|
|
@@ -11699,7 +11902,7 @@ class ha extends ne {
|
|
|
11699
11902
|
this.editor._tiptapEditor.state.tr.setMeta(se, null)
|
|
11700
11903
|
), !this.editor.prosemirrorView)
|
|
11701
11904
|
throw new Error("Editor view not initialized.");
|
|
11702
|
-
|
|
11905
|
+
ca(this.editor.prosemirrorView.root);
|
|
11703
11906
|
});
|
|
11704
11907
|
/**
|
|
11705
11908
|
* Freezes the drag handles. When frozen, they will stay attached to the same
|
|
@@ -11717,7 +11920,7 @@ class ha extends ne {
|
|
|
11717
11920
|
});
|
|
11718
11921
|
this.editor = o, this.plugin = new B({
|
|
11719
11922
|
key: se,
|
|
11720
|
-
view: (i) => (this.view = new
|
|
11923
|
+
view: (i) => (this.view = new ha(o, i, (n) => {
|
|
11721
11924
|
this.emit("update", n);
|
|
11722
11925
|
}), this.view),
|
|
11723
11926
|
// We use decorations to render the drop cursor when dragging a table row
|
|
@@ -11743,7 +11946,7 @@ class ha extends ne {
|
|
|
11743
11946
|
), h = u.node(), m = u.pos + (n > this.view.state.draggingState.originalIndex ? h.nodeSize - 2 : 0);
|
|
11744
11947
|
r.push(
|
|
11745
11948
|
// The widget is a small bar which spans the width of the cell.
|
|
11746
|
-
|
|
11949
|
+
X.widget(m, () => {
|
|
11747
11950
|
const f = document.createElement("div");
|
|
11748
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;
|
|
11749
11952
|
})
|
|
@@ -11758,7 +11961,7 @@ class ha extends ne {
|
|
|
11758
11961
|
), u = c.node(), h = c.pos + (n > this.view.state.draggingState.originalIndex ? u.nodeSize - 2 : 0);
|
|
11759
11962
|
r.push(
|
|
11760
11963
|
// The widget is a small bar which spans the height of the cell.
|
|
11761
|
-
|
|
11964
|
+
X.widget(h, () => {
|
|
11762
11965
|
const m = document.createElement("div");
|
|
11763
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;
|
|
11764
11967
|
})
|
|
@@ -11773,7 +11976,7 @@ class ha extends ne {
|
|
|
11773
11976
|
return this.on("update", o);
|
|
11774
11977
|
}
|
|
11775
11978
|
}
|
|
11776
|
-
const
|
|
11979
|
+
const fa = L.create({
|
|
11777
11980
|
name: "textAlignment",
|
|
11778
11981
|
addGlobalAttributes() {
|
|
11779
11982
|
return [
|
|
@@ -11799,7 +12002,7 @@ const ma = L.create({
|
|
|
11799
12002
|
}
|
|
11800
12003
|
];
|
|
11801
12004
|
}
|
|
11802
|
-
}),
|
|
12005
|
+
}), ga = L.create({
|
|
11803
12006
|
name: "blockTextColor",
|
|
11804
12007
|
addGlobalAttributes() {
|
|
11805
12008
|
return [
|
|
@@ -11807,9 +12010,9 @@ const ma = L.create({
|
|
|
11807
12010
|
types: ["blockContainer"],
|
|
11808
12011
|
attributes: {
|
|
11809
12012
|
textColor: {
|
|
11810
|
-
default:
|
|
11811
|
-
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") :
|
|
11812
|
-
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 ? {} : {
|
|
11813
12016
|
"data-text-color": e.textColor
|
|
11814
12017
|
}
|
|
11815
12018
|
}
|
|
@@ -11817,7 +12020,7 @@ const ma = L.create({
|
|
|
11817
12020
|
}
|
|
11818
12021
|
];
|
|
11819
12022
|
}
|
|
11820
|
-
}),
|
|
12023
|
+
}), ba = L.create({
|
|
11821
12024
|
name: "trailingNode",
|
|
11822
12025
|
addProseMirrorPlugins() {
|
|
11823
12026
|
const e = new N(this.name);
|
|
@@ -11852,13 +12055,13 @@ const ma = L.create({
|
|
|
11852
12055
|
})
|
|
11853
12056
|
];
|
|
11854
12057
|
}
|
|
11855
|
-
}),
|
|
12058
|
+
}), ka = {
|
|
11856
12059
|
blockColor: "data-block-color",
|
|
11857
12060
|
blockStyle: "data-block-style",
|
|
11858
12061
|
id: "data-id",
|
|
11859
12062
|
depth: "data-depth",
|
|
11860
12063
|
depthChange: "data-depth-change"
|
|
11861
|
-
},
|
|
12064
|
+
}, _a = Z.create({
|
|
11862
12065
|
name: "blockContainer",
|
|
11863
12066
|
group: "blockGroupChild bnBlock",
|
|
11864
12067
|
// A block always contains content, and optionally a blockGroup which contains nested blocks
|
|
@@ -11874,7 +12077,7 @@ const ma = L.create({
|
|
|
11874
12077
|
if (typeof e == "string")
|
|
11875
12078
|
return !1;
|
|
11876
12079
|
const t = {};
|
|
11877
|
-
for (const [o, i] of Object.entries(
|
|
12080
|
+
for (const [o, i] of Object.entries(ka))
|
|
11878
12081
|
e.getAttribute(i) && (t[o] = e.getAttribute(i));
|
|
11879
12082
|
return e.getAttribute("data-node-type") === "blockContainer" ? t : !1;
|
|
11880
12083
|
}
|
|
@@ -11899,7 +12102,7 @@ const ma = L.create({
|
|
|
11899
12102
|
contentDOM: i
|
|
11900
12103
|
};
|
|
11901
12104
|
}
|
|
11902
|
-
}),
|
|
12105
|
+
}), ya = Z.create({
|
|
11903
12106
|
name: "blockGroup",
|
|
11904
12107
|
group: "childContainer",
|
|
11905
12108
|
content: "blockGroupChild+",
|
|
@@ -11928,101 +12131,26 @@ const ma = L.create({
|
|
|
11928
12131
|
contentDOM: o
|
|
11929
12132
|
};
|
|
11930
12133
|
}
|
|
11931
|
-
}),
|
|
12134
|
+
}), va = Z.create({
|
|
11932
12135
|
name: "doc",
|
|
11933
12136
|
topNode: !0,
|
|
11934
12137
|
content: "blockGroup"
|
|
11935
|
-
}),
|
|
11936
|
-
var i;
|
|
11937
|
-
const t = [];
|
|
11938
|
-
t.push(
|
|
11939
|
-
Yo.configure({
|
|
11940
|
-
fragment: e.fragment
|
|
11941
|
-
})
|
|
11942
|
-
);
|
|
11943
|
-
const o = (i = e.provider) == null ? void 0 : i.awareness;
|
|
11944
|
-
if (o) {
|
|
11945
|
-
const n = /* @__PURE__ */ new Map();
|
|
11946
|
-
e.showCursorLabels !== "always" && o.on(
|
|
11947
|
-
"change",
|
|
11948
|
-
({
|
|
11949
|
-
updated: s
|
|
11950
|
-
}) => {
|
|
11951
|
-
for (const l of s) {
|
|
11952
|
-
const d = n.get(l);
|
|
11953
|
-
d && (d.element.setAttribute("data-active", ""), d.hideTimeout && clearTimeout(d.hideTimeout), n.set(l, {
|
|
11954
|
-
element: d.element,
|
|
11955
|
-
hideTimeout: setTimeout(() => {
|
|
11956
|
-
d.element.removeAttribute("data-active");
|
|
11957
|
-
}, 2e3)
|
|
11958
|
-
}));
|
|
11959
|
-
}
|
|
11960
|
-
}
|
|
11961
|
-
);
|
|
11962
|
-
const r = (s) => {
|
|
11963
|
-
const l = document.createElement("span");
|
|
11964
|
-
l.classList.add("collaboration-cursor__base");
|
|
11965
|
-
const d = document.createElement("span");
|
|
11966
|
-
d.setAttribute("contentedEditable", "false"), d.classList.add("collaboration-cursor__caret"), d.setAttribute("style", `background-color: ${s.color}`);
|
|
11967
|
-
const c = document.createElement("span");
|
|
11968
|
-
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;
|
|
11969
|
-
}, a = (s) => {
|
|
11970
|
-
var u;
|
|
11971
|
-
const l = [...o.getStates().entries()].find(
|
|
11972
|
-
(h) => h[1].user === s
|
|
11973
|
-
);
|
|
11974
|
-
if (!l)
|
|
11975
|
-
throw new Error("Could not find client state for user");
|
|
11976
|
-
const d = l[0];
|
|
11977
|
-
let c = n.get(d);
|
|
11978
|
-
if (!c) {
|
|
11979
|
-
const h = ((u = e == null ? void 0 : e.renderCursor) == null ? void 0 : u.call(e, s)) || r(s);
|
|
11980
|
-
(e == null ? void 0 : e.showCursorLabels) !== "always" && (h.addEventListener("mouseenter", () => {
|
|
11981
|
-
const m = n.get(d);
|
|
11982
|
-
m.element.setAttribute("data-active", ""), m.hideTimeout && (clearTimeout(m.hideTimeout), n.set(d, {
|
|
11983
|
-
element: m.element,
|
|
11984
|
-
hideTimeout: void 0
|
|
11985
|
-
}));
|
|
11986
|
-
}), h.addEventListener("mouseleave", () => {
|
|
11987
|
-
const m = n.get(d);
|
|
11988
|
-
n.set(d, {
|
|
11989
|
-
element: m.element,
|
|
11990
|
-
hideTimeout: setTimeout(() => {
|
|
11991
|
-
m.element.removeAttribute("data-active");
|
|
11992
|
-
}, 2e3)
|
|
11993
|
-
});
|
|
11994
|
-
})), c = {
|
|
11995
|
-
element: h,
|
|
11996
|
-
hideTimeout: void 0
|
|
11997
|
-
}, n.set(d, c);
|
|
11998
|
-
}
|
|
11999
|
-
return c.element;
|
|
12000
|
-
};
|
|
12001
|
-
t.push(
|
|
12002
|
-
Qo.configure({
|
|
12003
|
-
user: e.user,
|
|
12004
|
-
render: a,
|
|
12005
|
-
provider: e.provider
|
|
12006
|
-
})
|
|
12007
|
-
);
|
|
12008
|
-
}
|
|
12009
|
-
return t;
|
|
12010
|
-
}, wa = (e) => {
|
|
12138
|
+
}), wa = (e) => {
|
|
12011
12139
|
const t = {}, o = xa(e);
|
|
12012
12140
|
for (const n of o)
|
|
12013
12141
|
t[n.name] = n;
|
|
12014
|
-
t.formattingToolbar = new
|
|
12142
|
+
t.formattingToolbar = new Rr(
|
|
12015
12143
|
e.editor
|
|
12016
|
-
), t.linkToolbar = new
|
|
12144
|
+
), t.linkToolbar = new Wr(e.editor), t.sideMenu = new aa(
|
|
12017
12145
|
e.editor,
|
|
12018
12146
|
e.sideMenuDetection
|
|
12019
|
-
), 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 = {
|
|
12020
12148
|
plugin: e.dropCursor({
|
|
12021
12149
|
width: 5,
|
|
12022
12150
|
color: "#ddeeff",
|
|
12023
12151
|
editor: e.editor
|
|
12024
12152
|
})
|
|
12025
|
-
}, t.nodeSelectionKeyboard = new
|
|
12153
|
+
}, t.nodeSelectionKeyboard = new Zr();
|
|
12026
12154
|
const i = e.disableExtensions || [];
|
|
12027
12155
|
for (const n of i)
|
|
12028
12156
|
delete t[n];
|
|
@@ -12050,13 +12178,15 @@ const ma = L.create({
|
|
|
12050
12178
|
Xo.extend({
|
|
12051
12179
|
inclusive: !1
|
|
12052
12180
|
}).configure({
|
|
12053
|
-
defaultProtocol:
|
|
12054
|
-
protocols:
|
|
12181
|
+
defaultProtocol: qr,
|
|
12182
|
+
protocols: Kr
|
|
12055
12183
|
}),
|
|
12056
|
-
...Object.values(e.styleSpecs).map((o) => o.implementation.mark
|
|
12057
|
-
|
|
12184
|
+
...Object.values(e.styleSpecs).map((o) => o.implementation.mark.configure({
|
|
12185
|
+
editor: e.editor
|
|
12186
|
+
})),
|
|
12187
|
+
ga,
|
|
12058
12188
|
Nr,
|
|
12059
|
-
|
|
12189
|
+
fa,
|
|
12060
12190
|
// make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)
|
|
12061
12191
|
L.create({
|
|
12062
12192
|
name: "OverrideEscape",
|
|
@@ -12067,16 +12197,16 @@ const ma = L.create({
|
|
|
12067
12197
|
}
|
|
12068
12198
|
}),
|
|
12069
12199
|
// nodes
|
|
12070
|
-
|
|
12071
|
-
|
|
12200
|
+
va,
|
|
12201
|
+
_a.configure({
|
|
12072
12202
|
editor: e.editor,
|
|
12073
12203
|
domAttributes: e.domAttributes
|
|
12074
12204
|
}),
|
|
12075
|
-
|
|
12205
|
+
Fr.configure({
|
|
12076
12206
|
editor: e.editor,
|
|
12077
12207
|
tabBehavior: e.tabBehavior
|
|
12078
12208
|
}),
|
|
12079
|
-
|
|
12209
|
+
ya.configure({
|
|
12080
12210
|
domAttributes: e.domAttributes
|
|
12081
12211
|
}),
|
|
12082
12212
|
...Object.values(e.inlineContentSpecs).filter((o) => o.config !== "link" && o.config !== "text").map((o) => o.implementation.node.configure({
|
|
@@ -12101,9 +12231,9 @@ const ma = L.create({
|
|
|
12101
12231
|
Mr(e.editor),
|
|
12102
12232
|
// This needs to be at the bottom of this list, because Key events (such as enter, when selecting a /command),
|
|
12103
12233
|
// should be handled before Enter handlers in other components like splitListItem
|
|
12104
|
-
...e.trailingBlock === void 0 || e.trailingBlock ? [
|
|
12234
|
+
...e.trailingBlock === void 0 || e.trailingBlock ? [ba] : []
|
|
12105
12235
|
];
|
|
12106
|
-
return e.collaboration ? t.push(...
|
|
12236
|
+
return e.collaboration ? t.push(...jr(e.collaboration)) : t.push(qo), t;
|
|
12107
12237
|
};
|
|
12108
12238
|
function Ca(e, t) {
|
|
12109
12239
|
const o = [];
|
|
@@ -12162,18 +12292,17 @@ function Ba(e, t) {
|
|
|
12162
12292
|
}
|
|
12163
12293
|
return !0;
|
|
12164
12294
|
}
|
|
12165
|
-
const we = class we extends
|
|
12295
|
+
const we = class we extends Bo {
|
|
12166
12296
|
constructor(o, i) {
|
|
12167
12297
|
super({ ...o, content: void 0 });
|
|
12168
12298
|
p(this, "_state");
|
|
12169
|
-
p(this, "_creating", !1);
|
|
12170
12299
|
/**
|
|
12171
12300
|
* Mounts / unmounts the editor to a dom element
|
|
12172
12301
|
*
|
|
12173
12302
|
* @param element DOM element to mount to, ur null / undefined to destroy
|
|
12174
12303
|
*/
|
|
12175
|
-
p(this, "mount", (o) => {
|
|
12176
|
-
o ? (this.options.element = o, this.createViewAlternative()) :
|
|
12304
|
+
p(this, "mount", (o, i) => {
|
|
12305
|
+
o ? (this.options.element = o, this.createViewAlternative(i)) : this.destroy();
|
|
12177
12306
|
});
|
|
12178
12307
|
const n = this.schema;
|
|
12179
12308
|
let r;
|
|
@@ -12182,14 +12311,14 @@ const we = class we extends So {
|
|
|
12182
12311
|
if (r)
|
|
12183
12312
|
return r;
|
|
12184
12313
|
const d = a.apply(n.nodes.doc, l), c = JSON.parse(JSON.stringify(d.toJSON()));
|
|
12185
|
-
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;
|
|
12186
12315
|
};
|
|
12187
12316
|
let s;
|
|
12188
12317
|
try {
|
|
12189
12318
|
const l = o == null ? void 0 : o.content.map(
|
|
12190
|
-
(d) =>
|
|
12319
|
+
(d) => J(d, this.schema, i).toJSON()
|
|
12191
12320
|
);
|
|
12192
|
-
s =
|
|
12321
|
+
s = To(
|
|
12193
12322
|
{
|
|
12194
12323
|
type: "doc",
|
|
12195
12324
|
content: [
|
|
@@ -12210,7 +12339,7 @@ const we = class we extends So {
|
|
|
12210
12339
|
"Error creating document from blocks passed as `initialContent`:\n" + +JSON.stringify(o.content)
|
|
12211
12340
|
);
|
|
12212
12341
|
}
|
|
12213
|
-
this._state =
|
|
12342
|
+
this._state = Io.create({
|
|
12214
12343
|
doc: s,
|
|
12215
12344
|
schema: this.schema
|
|
12216
12345
|
// selection: selection || undefined,
|
|
@@ -12225,25 +12354,26 @@ const we = class we extends So {
|
|
|
12225
12354
|
/**
|
|
12226
12355
|
* Replace the default `createView` method with a custom one - which we call on mount
|
|
12227
12356
|
*/
|
|
12228
|
-
createViewAlternative() {
|
|
12229
|
-
this.
|
|
12230
|
-
|
|
12231
|
-
|
|
12232
|
-
|
|
12233
|
-
|
|
12234
|
-
|
|
12235
|
-
|
|
12236
|
-
|
|
12237
|
-
|
|
12238
|
-
|
|
12239
|
-
|
|
12240
|
-
|
|
12241
|
-
|
|
12242
|
-
|
|
12243
|
-
|
|
12244
|
-
|
|
12245
|
-
|
|
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
|
|
12246
12375
|
});
|
|
12376
|
+
this.view.updateState(n), this.createNodeViews(), this.commands.focus(this.options.autofocus), this.emit("create", { editor: this }), this.isInitialized = !0;
|
|
12247
12377
|
}
|
|
12248
12378
|
};
|
|
12249
12379
|
p(we, "create", (o, i) => {
|
|
@@ -12265,7 +12395,7 @@ const Ta = {
|
|
|
12265
12395
|
enablePasteRules: !0,
|
|
12266
12396
|
enableCoreExtensions: !1
|
|
12267
12397
|
};
|
|
12268
|
-
class
|
|
12398
|
+
class fo {
|
|
12269
12399
|
constructor(t) {
|
|
12270
12400
|
p(this, "_pmSchema");
|
|
12271
12401
|
/**
|
|
@@ -12328,10 +12458,10 @@ class mo {
|
|
|
12328
12458
|
*
|
|
12329
12459
|
* @warning Not needed to call manually when using React, use BlockNoteView to take care of mounting
|
|
12330
12460
|
*/
|
|
12331
|
-
p(this, "mount", (t) => {
|
|
12332
|
-
this._tiptapEditor.mount(t);
|
|
12461
|
+
p(this, "mount", (t, o) => {
|
|
12462
|
+
this._tiptapEditor.mount(t, o);
|
|
12333
12463
|
});
|
|
12334
|
-
var
|
|
12464
|
+
var l, d, c, u, h, m, f;
|
|
12335
12465
|
this.options = t;
|
|
12336
12466
|
const o = t;
|
|
12337
12467
|
if (o.onEditorContentChange)
|
|
@@ -12350,7 +12480,7 @@ class mo {
|
|
|
12350
12480
|
throw new Error(
|
|
12351
12481
|
"editable initialization option is deprecated, use <BlockNoteView editable={true/false} />, or alternatively editor.isEditable = true/false"
|
|
12352
12482
|
);
|
|
12353
|
-
this.dictionary = t.dictionary ||
|
|
12483
|
+
this.dictionary = t.dictionary || St;
|
|
12354
12484
|
const i = {
|
|
12355
12485
|
defaultStyles: !0,
|
|
12356
12486
|
schema: t.schema || fe.create(),
|
|
@@ -12377,29 +12507,31 @@ class mo {
|
|
|
12377
12507
|
placeholders: i.placeholders,
|
|
12378
12508
|
tabBehavior: i.tabBehavior,
|
|
12379
12509
|
sideMenuDetection: i.sideMenuDetection || "viewport"
|
|
12380
|
-
}), (((
|
|
12381
|
-
this.extensions[
|
|
12382
|
-
}), Object.entries(i._extensions || {}).forEach(([
|
|
12383
|
-
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;
|
|
12384
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) {
|
|
12385
|
-
const
|
|
12386
|
-
this.uploadFile = async (
|
|
12515
|
+
const g = i.uploadFile;
|
|
12516
|
+
this.uploadFile = async (b, k) => {
|
|
12387
12517
|
this.onUploadStartCallbacks.forEach(
|
|
12388
|
-
(
|
|
12518
|
+
(v) => v.apply(this, [k])
|
|
12389
12519
|
);
|
|
12390
12520
|
try {
|
|
12391
|
-
return await
|
|
12521
|
+
return await g(b, k);
|
|
12392
12522
|
} finally {
|
|
12393
12523
|
this.onUploadEndCallbacks.forEach(
|
|
12394
|
-
(
|
|
12524
|
+
(v) => v.apply(this, [k])
|
|
12395
12525
|
);
|
|
12396
12526
|
}
|
|
12397
12527
|
};
|
|
12398
12528
|
}
|
|
12399
|
-
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(
|
|
12400
12532
|
"When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"
|
|
12401
12533
|
);
|
|
12402
|
-
const
|
|
12534
|
+
const r = i.initialContent || (n ? [
|
|
12403
12535
|
{
|
|
12404
12536
|
type: "paragraph",
|
|
12405
12537
|
id: "initialBlockId"
|
|
@@ -12410,48 +12542,48 @@ class mo {
|
|
|
12410
12542
|
id: ue.options.generateID()
|
|
12411
12543
|
}
|
|
12412
12544
|
]);
|
|
12413
|
-
if (!Array.isArray(
|
|
12545
|
+
if (!Array.isArray(r) || r.length === 0)
|
|
12414
12546
|
throw new Error(
|
|
12415
|
-
"initialContent must be a non-empty array of blocks, received: " +
|
|
12547
|
+
"initialContent must be a non-empty array of blocks, received: " + r
|
|
12416
12548
|
);
|
|
12417
|
-
const
|
|
12418
|
-
...Object.entries(this.extensions).map(([
|
|
12419
|
-
if (
|
|
12420
|
-
return
|
|
12421
|
-
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)
|
|
12422
12554
|
throw new Error(
|
|
12423
12555
|
"Extension should either be a TipTap extension or a ProseMirror plugin in a plugin property"
|
|
12424
12556
|
);
|
|
12425
12557
|
return L.create({
|
|
12426
|
-
name:
|
|
12427
|
-
addProseMirrorPlugins: () => [
|
|
12558
|
+
name: g,
|
|
12559
|
+
addProseMirrorPlugins: () => [b.plugin]
|
|
12428
12560
|
});
|
|
12429
12561
|
})
|
|
12430
|
-
],
|
|
12562
|
+
], s = {
|
|
12431
12563
|
...Ta,
|
|
12432
12564
|
...i._tiptapOptions,
|
|
12433
|
-
content:
|
|
12434
|
-
extensions:
|
|
12565
|
+
content: r,
|
|
12566
|
+
extensions: a,
|
|
12435
12567
|
editorProps: {
|
|
12436
|
-
...(
|
|
12568
|
+
...(d = i._tiptapOptions) == null ? void 0 : d.editorProps,
|
|
12437
12569
|
attributes: {
|
|
12438
12570
|
// As of TipTap v2.5.0 the tabIndex is removed when the editor is not
|
|
12439
12571
|
// editable, so you can't focus it. We want to revert this as we have
|
|
12440
12572
|
// UI behaviour that relies on it.
|
|
12441
12573
|
tabIndex: "0",
|
|
12442
|
-
...(
|
|
12443
|
-
...(
|
|
12574
|
+
...(u = (c = i._tiptapOptions) == null ? void 0 : c.editorProps) == null ? void 0 : u.attributes,
|
|
12575
|
+
...(h = i.domAttributes) == null ? void 0 : h.editor,
|
|
12444
12576
|
class: G(
|
|
12445
12577
|
"bn-editor",
|
|
12446
12578
|
i.defaultStyles ? "bn-default-styles" : "",
|
|
12447
|
-
((
|
|
12579
|
+
((f = (m = i.domAttributes) == null ? void 0 : m.editor) == null ? void 0 : f.class) || ""
|
|
12448
12580
|
)
|
|
12449
12581
|
},
|
|
12450
12582
|
transformPasted: Sa
|
|
12451
12583
|
}
|
|
12452
12584
|
};
|
|
12453
|
-
this.headless ? this._pmSchema =
|
|
12454
|
-
|
|
12585
|
+
this.headless ? this._pmSchema = Mo(s.extensions) : (this._tiptapEditor = ve.create(
|
|
12586
|
+
s,
|
|
12455
12587
|
this.schema.styleSchema
|
|
12456
12588
|
), this._pmSchema = this._tiptapEditor.schema);
|
|
12457
12589
|
}
|
|
@@ -12459,7 +12591,7 @@ class mo {
|
|
|
12459
12591
|
return this._pmSchema;
|
|
12460
12592
|
}
|
|
12461
12593
|
static create(t = {}) {
|
|
12462
|
-
return new
|
|
12594
|
+
return new fo(t);
|
|
12463
12595
|
}
|
|
12464
12596
|
dispatch(t) {
|
|
12465
12597
|
this._tiptapEditor.dispatch(t);
|
|
@@ -12504,7 +12636,7 @@ class mo {
|
|
|
12504
12636
|
get document() {
|
|
12505
12637
|
const t = [];
|
|
12506
12638
|
return this._tiptapEditor.state.doc.firstChild.descendants((o) => (t.push(
|
|
12507
|
-
|
|
12639
|
+
w(
|
|
12508
12640
|
o,
|
|
12509
12641
|
this.schema.blockSchema,
|
|
12510
12642
|
this.schema.inlineContentSchema,
|
|
@@ -12604,7 +12736,7 @@ class mo {
|
|
|
12604
12736
|
* @param placement Whether the text cursor should be placed at the start or end of the block.
|
|
12605
12737
|
*/
|
|
12606
12738
|
setTextCursorPosition(t, o = "start") {
|
|
12607
|
-
|
|
12739
|
+
ro(this, t, o);
|
|
12608
12740
|
}
|
|
12609
12741
|
/**
|
|
12610
12742
|
* Gets a snapshot of the current selection.
|
|
@@ -12705,7 +12837,9 @@ class mo {
|
|
|
12705
12837
|
for (const i of o) {
|
|
12706
12838
|
const n = this.schema.styleSchema[i.type.name];
|
|
12707
12839
|
if (!n) {
|
|
12708
|
-
|
|
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);
|
|
12709
12843
|
continue;
|
|
12710
12844
|
}
|
|
12711
12845
|
n.propSchema === "boolean" ? t[n.type] = !0 : t[n.type] = i.attrs.stringValue;
|
|
@@ -12794,7 +12928,7 @@ class mo {
|
|
|
12794
12928
|
* Nests the block containing the text cursor into the block above it.
|
|
12795
12929
|
*/
|
|
12796
12930
|
nestBlock() {
|
|
12797
|
-
|
|
12931
|
+
io(this);
|
|
12798
12932
|
}
|
|
12799
12933
|
/**
|
|
12800
12934
|
* Checks if the block containing the text cursor is nested.
|
|
@@ -12854,7 +12988,7 @@ class mo {
|
|
|
12854
12988
|
* @returns The blocks parsed from the HTML string.
|
|
12855
12989
|
*/
|
|
12856
12990
|
async tryParseHTMLToBlocks(t) {
|
|
12857
|
-
return
|
|
12991
|
+
return so(
|
|
12858
12992
|
t,
|
|
12859
12993
|
this.schema.blockSchema,
|
|
12860
12994
|
this.schema.inlineContentSchema,
|
|
@@ -13094,7 +13228,7 @@ function Ne(e = "") {
|
|
|
13094
13228
|
] : e;
|
|
13095
13229
|
}
|
|
13096
13230
|
function le(e) {
|
|
13097
|
-
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) ? {
|
|
13098
13232
|
...t,
|
|
13099
13233
|
content: Ne(t.content)
|
|
13100
13234
|
} : de(t) ? t : {
|
|
@@ -13114,10 +13248,10 @@ function le(e) {
|
|
|
13114
13248
|
}
|
|
13115
13249
|
function Is(e, t) {
|
|
13116
13250
|
return t.map(
|
|
13117
|
-
(o) =>
|
|
13251
|
+
(o) => go(e.blockSchema, o)
|
|
13118
13252
|
);
|
|
13119
13253
|
}
|
|
13120
|
-
function
|
|
13254
|
+
function go(e, t) {
|
|
13121
13255
|
var n;
|
|
13122
13256
|
const o = e[t.type].content, i = {
|
|
13123
13257
|
id: "",
|
|
@@ -13148,7 +13282,7 @@ function fo(e, t) {
|
|
|
13148
13282
|
return {
|
|
13149
13283
|
...i,
|
|
13150
13284
|
content: le(i.content),
|
|
13151
|
-
children: i.children.map((r) =>
|
|
13285
|
+
children: i.children.map((r) => go(e, r))
|
|
13152
13286
|
};
|
|
13153
13287
|
}
|
|
13154
13288
|
function Ma(e) {
|
|
@@ -13160,36 +13294,36 @@ function Ia(e) {
|
|
|
13160
13294
|
}
|
|
13161
13295
|
export {
|
|
13162
13296
|
$i as AudioBlock,
|
|
13163
|
-
|
|
13297
|
+
fo as BlockNoteEditor,
|
|
13164
13298
|
fe as BlockNoteSchema,
|
|
13165
13299
|
Es as COLORS_DARK_MODE_DEFAULT,
|
|
13166
13300
|
Cs as COLORS_DEFAULT,
|
|
13167
13301
|
Wi as CodeBlock,
|
|
13168
|
-
|
|
13302
|
+
qr as DEFAULT_LINK_PROTOCOL,
|
|
13169
13303
|
ps as EMPTY_CELL_HEIGHT,
|
|
13170
|
-
|
|
13304
|
+
qt as EMPTY_CELL_WIDTH,
|
|
13171
13305
|
Ss as Exporter,
|
|
13172
13306
|
Oi as FILE_AUDIO_ICON_SVG,
|
|
13173
13307
|
Hi as FILE_ICON_SVG,
|
|
13174
13308
|
hn as FILE_IMAGE_ICON_SVG,
|
|
13175
13309
|
Un as FILE_VIDEO_ICON_SVG,
|
|
13176
13310
|
ln as FileBlock,
|
|
13177
|
-
|
|
13178
|
-
|
|
13179
|
-
|
|
13180
|
-
|
|
13181
|
-
|
|
13311
|
+
Hr as FilePanelProsemirrorPlugin,
|
|
13312
|
+
Dr as FilePanelView,
|
|
13313
|
+
Rr as FormattingToolbarProsemirrorPlugin,
|
|
13314
|
+
Ur as FormattingToolbarView,
|
|
13315
|
+
so as HTMLToBlocks,
|
|
13182
13316
|
_n as ImageBlock,
|
|
13183
|
-
|
|
13317
|
+
Wr as LinkToolbarProsemirrorPlugin,
|
|
13184
13318
|
Ji as PageBreak,
|
|
13185
|
-
|
|
13186
|
-
|
|
13187
|
-
|
|
13188
|
-
|
|
13189
|
-
|
|
13319
|
+
aa as SideMenuProsemirrorPlugin,
|
|
13320
|
+
na as SideMenuView,
|
|
13321
|
+
da as SuggestionMenuProseMirrorPlugin,
|
|
13322
|
+
ma as TableHandlesProsemirrorPlugin,
|
|
13323
|
+
ha as TableHandlesView,
|
|
13190
13324
|
ue as UniqueID,
|
|
13191
13325
|
D as UnreachableCaseError,
|
|
13192
|
-
|
|
13326
|
+
Kr as VALID_LINK_PROTOCOLS,
|
|
13193
13327
|
Gn as VideoBlock,
|
|
13194
13328
|
Ma as addIdsToBlock,
|
|
13195
13329
|
Ia as addIdsToBlocks,
|
|
@@ -13203,7 +13337,7 @@ export {
|
|
|
13203
13337
|
Ri as audioPropSchema,
|
|
13204
13338
|
zi as audioRender,
|
|
13205
13339
|
Gi as audioToExternalHTML,
|
|
13206
|
-
|
|
13340
|
+
J as blockToNode,
|
|
13207
13341
|
_r as blocksToMarkdown,
|
|
13208
13342
|
ye as camelToDataKebab,
|
|
13209
13343
|
bs as checkBlockHasDefaultProp,
|
|
@@ -13218,7 +13352,7 @@ export {
|
|
|
13218
13352
|
Xe as cleanHTMLToMarkdown,
|
|
13219
13353
|
Ms as combineByGroup,
|
|
13220
13354
|
Se as contentNodeToInlineContent,
|
|
13221
|
-
|
|
13355
|
+
Ht as contentNodeToTableContent,
|
|
13222
13356
|
Di as createAddFileButton,
|
|
13223
13357
|
me as createBlockSpec,
|
|
13224
13358
|
W as createBlockSpecFromStronglyTypedTiptapNode,
|
|
@@ -13229,27 +13363,27 @@ export {
|
|
|
13229
13363
|
Ui as createFileNameWithIcon,
|
|
13230
13364
|
ds as createInlineContentSpec,
|
|
13231
13365
|
Li as createInlineContentSpecFromTipTapNode,
|
|
13232
|
-
|
|
13366
|
+
jt as createInternalBlockSpec,
|
|
13233
13367
|
Ci as createInternalHTMLSerializer,
|
|
13234
13368
|
Ii as createInternalInlineContentSpec,
|
|
13235
|
-
|
|
13369
|
+
Ot as createInternalStyleSpec,
|
|
13236
13370
|
Te as createLinkWithCaption,
|
|
13237
|
-
|
|
13371
|
+
Gt as createResizableFileBlockWrapper,
|
|
13238
13372
|
$ as createStronglyTypedTiptapNode,
|
|
13239
13373
|
cs as createStyleSpec,
|
|
13240
13374
|
K as createStyleSpecFromTipTapMark,
|
|
13241
13375
|
xs as createSuggestionMenu,
|
|
13242
13376
|
us as customizeCodeBlock,
|
|
13243
13377
|
$n as defaultBlockSchema,
|
|
13244
|
-
|
|
13378
|
+
Xt as defaultBlockSpecs,
|
|
13245
13379
|
rt as defaultBlockToHTML,
|
|
13246
13380
|
Oe as defaultCodeBlockPropSchema,
|
|
13247
13381
|
Wn as defaultInlineContentSchema,
|
|
13248
|
-
|
|
13249
|
-
|
|
13382
|
+
Jt as defaultInlineContentSpecs,
|
|
13383
|
+
C as defaultProps,
|
|
13250
13384
|
hs as defaultStyleSchema,
|
|
13251
|
-
|
|
13252
|
-
|
|
13385
|
+
Zt as defaultStyleSpecs,
|
|
13386
|
+
Q as esmDependencies,
|
|
13253
13387
|
nn as fileBlockConfig,
|
|
13254
13388
|
an as fileParse,
|
|
13255
13389
|
on as filePropSchema,
|
|
@@ -13258,58 +13392,58 @@ export {
|
|
|
13258
13392
|
ls as filenameFromURL,
|
|
13259
13393
|
_s as filterSuggestionItems,
|
|
13260
13394
|
V as formatKeyboardShortcut,
|
|
13261
|
-
|
|
13395
|
+
Or as formattingToolbarPluginKey,
|
|
13262
13396
|
Si as getBlockFromPos,
|
|
13263
13397
|
F as getBlockInfo,
|
|
13264
13398
|
pe as getBlockInfoFromResolvedPos,
|
|
13265
13399
|
_ as getBlockInfoFromSelection,
|
|
13266
13400
|
Ge as getBlockInfoWithManualOffset,
|
|
13267
13401
|
wa as getBlockNoteExtensions,
|
|
13268
|
-
|
|
13402
|
+
Dt as getBlockSchemaFromSpecs,
|
|
13269
13403
|
Ts as getDefaultEmojiPickerItems,
|
|
13270
13404
|
ks as getDefaultSlashMenuItems,
|
|
13271
13405
|
Ai as getInlineContentParseRules,
|
|
13272
|
-
|
|
13406
|
+
Ut as getInlineContentSchemaFromSpecs,
|
|
13273
13407
|
z as getNearestBlockPos,
|
|
13274
13408
|
A as getNodeById,
|
|
13275
13409
|
vs as getPageBreakSlashMenuItems,
|
|
13276
13410
|
Ti as getParseRules,
|
|
13277
13411
|
ji as getStyleParseRules,
|
|
13278
|
-
|
|
13412
|
+
Rt as getStyleSchemaFromSpecs,
|
|
13279
13413
|
fn as imageBlockConfig,
|
|
13280
13414
|
bn as imageParse,
|
|
13281
13415
|
mn as imagePropSchema,
|
|
13282
13416
|
gn as imageRender,
|
|
13283
13417
|
kn as imageToExternalHTML,
|
|
13284
|
-
|
|
13418
|
+
Nt as inheritedProps,
|
|
13285
13419
|
qe as initializeESMDependencies,
|
|
13286
13420
|
H as inlineContentToNodes,
|
|
13287
13421
|
T as insertOrUpdateBlock,
|
|
13288
13422
|
Ei as isAppleOS,
|
|
13289
13423
|
it as isLinkInlineContent,
|
|
13290
|
-
|
|
13424
|
+
Bt as isPartialLinkInlineContent,
|
|
13291
13425
|
ss as isSafari,
|
|
13292
13426
|
de as isStyledTextInlineContent,
|
|
13293
|
-
|
|
13427
|
+
$r as linkToolbarPluginKey,
|
|
13294
13428
|
rs as locales,
|
|
13295
13429
|
Bs as mappingFactory,
|
|
13296
13430
|
Sr as markdownToBlocks,
|
|
13297
13431
|
G as mergeCSSClasses,
|
|
13298
|
-
|
|
13432
|
+
w as nodeToBlock,
|
|
13299
13433
|
Ue as nodeToCustomInlineContent,
|
|
13300
13434
|
Ki as pageBreakConfig,
|
|
13301
13435
|
Xi as pageBreakParse,
|
|
13302
13436
|
qi as pageBreakRender,
|
|
13303
|
-
|
|
13437
|
+
Yt as pageBreakSchema,
|
|
13304
13438
|
Zi as pageBreakToExternalHTML,
|
|
13305
13439
|
dt as parseEmbedElement,
|
|
13306
13440
|
Be as parseFigureElement,
|
|
13307
|
-
|
|
13441
|
+
go as partialBlockToBlockForTesting,
|
|
13308
13442
|
Is as partialBlocksToBlocksForTesting,
|
|
13309
13443
|
he as propsToAttributes,
|
|
13310
13444
|
Ie as shikiHighlighterPromiseSymbol,
|
|
13311
13445
|
lt as shikiParserSymbol,
|
|
13312
|
-
|
|
13446
|
+
ra as sideMenuPluginKey,
|
|
13313
13447
|
Pi as stylePropsToAttributes,
|
|
13314
13448
|
Ce as tableContentToNodes,
|
|
13315
13449
|
se as tableHandlesPluginKey,
|