@blocknote/core 0.14.5 → 0.15.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.
Files changed (60) hide show
  1. package/dist/blocknote.js +1219 -1005
  2. package/dist/blocknote.js.map +1 -1
  3. package/dist/blocknote.umd.cjs +6 -6
  4. package/dist/blocknote.umd.cjs.map +1 -1
  5. package/dist/webpack-stats.json +1 -1
  6. package/package.json +26 -23
  7. package/src/api/blockManipulation/blockManipulation.ts +21 -21
  8. package/src/api/exporters/copyExtension.ts +14 -10
  9. package/src/api/exporters/html/externalHTMLExporter.ts +26 -8
  10. package/src/api/exporters/html/htmlConversion.test.ts +27 -25
  11. package/src/api/exporters/html/internalHTMLSerializer.ts +22 -7
  12. package/src/api/exporters/html/util/sharedHTMLConversion.ts +3 -2
  13. package/src/api/exporters/markdown/markdownExporter.ts +5 -4
  14. package/src/api/nodeConversions/nodeConversions.test.ts +9 -6
  15. package/src/api/parsers/html/parseHTML.test.ts +3 -4
  16. package/src/blocks/FileBlockContent/fileBlockHelpers.ts +1 -1
  17. package/src/blocks/defaultBlockHelpers.ts +3 -6
  18. package/src/blocks/defaultBlockTypeGuards.ts +26 -1
  19. package/src/editor/BlockNoteEditor.test.ts +48 -1
  20. package/src/editor/BlockNoteEditor.ts +153 -36
  21. package/src/editor/BlockNoteExtensions.ts +0 -1
  22. package/src/editor/BlockNoteTipTapEditor.ts +14 -5
  23. package/src/extensions/BackgroundColor/BackgroundColorExtension.ts +10 -4
  24. package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +2 -2
  25. package/src/extensions/SideMenu/SideMenuPlugin.ts +7 -12
  26. package/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.ts +4 -0
  27. package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +2 -2
  28. package/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts +38 -0
  29. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +13 -6
  30. package/src/extensions/TableHandles/TableHandlesPlugin.ts +5 -5
  31. package/src/extensions/TextAlignment/TextAlignmentExtension.ts +7 -3
  32. package/src/extensions/TextColor/TextColorExtension.ts +7 -3
  33. package/src/i18n/locales/ar.ts +6 -0
  34. package/src/i18n/locales/en.ts +18 -12
  35. package/src/i18n/locales/fr.ts +6 -0
  36. package/src/i18n/locales/is.ts +6 -0
  37. package/src/i18n/locales/ja.ts +6 -0
  38. package/src/i18n/locales/ko.ts +15 -0
  39. package/src/i18n/locales/nl.ts +11 -0
  40. package/src/i18n/locales/pl.ts +6 -0
  41. package/src/i18n/locales/pt.ts +6 -0
  42. package/src/i18n/locales/ru.ts +322 -309
  43. package/src/i18n/locales/vi.ts +13 -0
  44. package/src/i18n/locales/zh.ts +14 -0
  45. package/src/index.ts +14 -5
  46. package/src/style.css +2 -7
  47. package/types/src/api/exporters/html/externalHTMLExporter.d.ts +6 -2
  48. package/types/src/api/exporters/html/internalHTMLSerializer.d.ts +6 -2
  49. package/types/src/api/exporters/html/util/sharedHTMLConversion.d.ts +3 -1
  50. package/types/src/api/exporters/markdown/markdownExporter.d.ts +4 -2
  51. package/types/src/blocks/defaultBlockTypeGuards.d.ts +4 -1
  52. package/types/src/editor/BlockNoteEditor.d.ts +71 -11
  53. package/types/src/editor/BlockNoteExtensions.d.ts +0 -1
  54. package/types/src/editor/BlockNoteTipTapEditor.d.ts +2 -2
  55. package/types/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.d.ts +4 -0
  56. package/types/src/extensions/SuggestionMenu/SuggestionPlugin.d.ts +1 -2
  57. package/types/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.d.ts +4 -0
  58. package/types/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.d.ts +1 -1
  59. package/types/src/i18n/locales/en.d.ts +6 -0
  60. package/types/src/index.d.ts +11 -5
package/dist/blocknote.js CHANGED
@@ -1,38 +1,40 @@
1
- var St = Object.defineProperty;
2
- var Mt = (e, t, o) => t in e ? St(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
- var c = (e, t, o) => (Mt(e, typeof t != "symbol" ? t + "" : t, o), o);
4
- import { Slice as D, Fragment as L, DOMSerializer as we, DOMParser as Tt, Node as Bt } from "prosemirror-model";
5
- import qe from "rehype-parse";
6
- import Xe from "rehype-stringify";
1
+ var Bt = Object.defineProperty;
2
+ var Lt = (e, t, o) => t in e ? Bt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
+ var c = (e, t, o) => (Lt(e, typeof t != "symbol" ? t + "" : t, o), o);
4
+ import { Slice as D, Fragment as L, DOMSerializer as we, DOMParser as It, Node as At } from "prosemirror-model";
5
+ import Je from "rehype-parse";
6
+ import Ye from "rehype-stringify";
7
7
  import { unified as ve } from "unified";
8
- import { Extension as M, combineTransactionSteps as Lt, getChangedRanges as It, findChildrenInRange as At, Node as $, Mark as xe, InputRule as ee, callOrReturn as Nt, getExtensionField as Pt, mergeAttributes as Ht, selectionToInsertionEnd as Ut, isTextSelection as Dt, isNodeSelection as Vt, posToDOMRect as ke, getMarkRange as Pe, findParentNode as Rt, findChildren as He, extensions as J, Editor as Ot, createDocument as jt } from "@tiptap/core";
9
- import { Plugin as y, PluginKey as S, Selection as he, NodeSelection as ne, TextSelection as Y, EditorState as zt } from "prosemirror-state";
10
- import { v4 as Ft } from "uuid";
8
+ import { Extension as M, combineTransactionSteps as Nt, getChangedRanges as Pt, findChildrenInRange as Ht, Node as $, Mark as xe, InputRule as ee, callOrReturn as Ut, getExtensionField as Dt, mergeAttributes as jt, selectionToInsertionEnd as Rt, isTextSelection as Vt, isNodeSelection as Ot, posToDOMRect as ke, getMarkRange as He, findParentNode as zt, findChildren as Ue, extensions as J, Editor as Ft, createDocument as Gt, getSchema as Kt } from "@tiptap/core";
9
+ import { Plugin as y, PluginKey as S, Selection as he, NodeSelection as ne, TextSelection as Y, EditorState as Wt } from "prosemirror-state";
10
+ import { v4 as $t } from "uuid";
11
11
  import { fromDom as _e } from "hast-util-from-dom";
12
- import Gt from "@tiptap/extension-bold";
13
- import Wt from "@tiptap/extension-code";
14
- import Kt from "@tiptap/extension-italic";
15
- import $t from "@tiptap/extension-strike";
16
- import qt from "@tiptap/extension-underline";
17
- import { TableCell as Xt } from "@tiptap/extension-table-cell";
18
- import { TableHeader as Zt } from "@tiptap/extension-table-header";
19
- import { TableRow as Jt } from "@tiptap/extension-table-row";
20
- import { columnResizing as Yt, tableEditing as Qt } from "prosemirror-tables";
21
- import eo from "rehype-remark";
22
- import Ze from "remark-gfm";
23
- import to from "remark-stringify";
24
- import oo from "remark-parse";
25
- import io, { defaultHandlers as no } from "remark-rehype";
26
- import { DecorationSet as G, Decoration as W, EditorView as ro } from "prosemirror-view";
27
- import ao from "@tiptap/extension-collaboration";
28
- import so from "@tiptap/extension-collaboration-cursor";
29
- import { Dropcursor as lo } from "@tiptap/extension-dropcursor";
30
- import { Gapcursor as co } from "@tiptap/extension-gapcursor";
31
- import { HardBreak as uo } from "@tiptap/extension-hard-break";
32
- import { History as po } from "@tiptap/extension-history";
33
- import { Link as ho } from "@tiptap/extension-link";
34
- import { Text as mo } from "@tiptap/extension-text";
35
- const fo = {
12
+ import qt from "@tiptap/extension-bold";
13
+ import Xt from "@tiptap/extension-code";
14
+ import Zt from "@tiptap/extension-italic";
15
+ import Jt from "@tiptap/extension-strike";
16
+ import Yt from "@tiptap/extension-underline";
17
+ import { TableCell as Qt } from "@tiptap/extension-table-cell";
18
+ import { TableHeader as eo } from "@tiptap/extension-table-header";
19
+ import { TableRow as to } from "@tiptap/extension-table-row";
20
+ import { columnResizing as oo, tableEditing as io } from "prosemirror-tables";
21
+ import no from "rehype-remark";
22
+ import Qe from "remark-gfm";
23
+ import ro from "remark-stringify";
24
+ import ao from "remark-parse";
25
+ import so, { defaultHandlers as lo } from "remark-rehype";
26
+ import { DecorationSet as G, Decoration as K, EditorView as co } from "prosemirror-view";
27
+ import uo from "@tiptap/extension-collaboration";
28
+ import po from "@tiptap/extension-collaboration-cursor";
29
+ import { Dropcursor as ho } from "@tiptap/extension-dropcursor";
30
+ import { Gapcursor as mo } from "@tiptap/extension-gapcursor";
31
+ import { HardBreak as fo } from "@tiptap/extension-hard-break";
32
+ import { History as go } from "@tiptap/extension-history";
33
+ import { Link as bo } from "@tiptap/extension-link";
34
+ import { Text as ko } from "@tiptap/extension-text";
35
+ import _o from "@emoji-mart/data";
36
+ import { init as yo, SearchIndex as wo } from "emoji-mart";
37
+ const vo = {
36
38
  slash_menu: {
37
39
  heading: {
38
40
  title: "عنوان 1",
@@ -121,6 +123,12 @@ const fo = {
121
123
  subtext: "إدراج ملف",
122
124
  aliases: ["ملف", "تحميل", "تضمين", "وسائط", "رابط"],
123
125
  group: "وسائط"
126
+ },
127
+ emoji: {
128
+ title: "الرموز التعبيرية",
129
+ subtext: "تُستخدم لإدراج رمز تعبيري",
130
+ aliases: ["رمز تعبيري", "إيموجي", "إيموت", "عاطفة", "وجه"],
131
+ group: "آخرون"
124
132
  }
125
133
  },
126
134
  placeholders: {
@@ -316,41 +324,41 @@ const fo = {
316
324
  generic: {
317
325
  ctrl_shortcut: "Ctrl"
318
326
  }
319
- }, Je = {
327
+ }, et = {
320
328
  slash_menu: {
321
329
  heading: {
322
330
  title: "Heading 1",
323
- subtext: "Used for a top-level heading",
331
+ subtext: "Top-level heading",
324
332
  aliases: ["h", "heading1", "h1"],
325
333
  group: "Headings"
326
334
  },
327
335
  heading_2: {
328
336
  title: "Heading 2",
329
- subtext: "Used for key sections",
337
+ subtext: "Key section heading",
330
338
  aliases: ["h2", "heading2", "subheading"],
331
339
  group: "Headings"
332
340
  },
333
341
  heading_3: {
334
342
  title: "Heading 3",
335
- subtext: "Used for subsections and group headings",
343
+ subtext: "Subsection and group heading",
336
344
  aliases: ["h3", "heading3", "subheading"],
337
345
  group: "Headings"
338
346
  },
339
347
  numbered_list: {
340
348
  title: "Numbered List",
341
- subtext: "Used to display a numbered list",
349
+ subtext: "List with ordered items",
342
350
  aliases: ["ol", "li", "list", "numberedlist", "numbered list"],
343
351
  group: "Basic blocks"
344
352
  },
345
353
  bullet_list: {
346
354
  title: "Bullet List",
347
- subtext: "Used to display an unordered list",
355
+ subtext: "List with unordered items",
348
356
  aliases: ["ul", "li", "list", "bulletlist", "bullet list"],
349
357
  group: "Basic blocks"
350
358
  },
351
359
  check_list: {
352
360
  title: "Check List",
353
- subtext: "Used to display a list with checkboxes",
361
+ subtext: "List with checkboxes",
354
362
  aliases: [
355
363
  "ul",
356
364
  "li",
@@ -364,19 +372,19 @@ const fo = {
364
372
  },
365
373
  paragraph: {
366
374
  title: "Paragraph",
367
- subtext: "Used for the body of your document",
375
+ subtext: "The body of your document",
368
376
  aliases: ["p", "paragraph"],
369
377
  group: "Basic blocks"
370
378
  },
371
379
  table: {
372
380
  title: "Table",
373
- subtext: "Used for tables",
381
+ subtext: "Table with editable cells",
374
382
  aliases: ["table"],
375
383
  group: "Advanced"
376
384
  },
377
385
  image: {
378
386
  title: "Image",
379
- subtext: "Insert an image",
387
+ subtext: "Resizable image with caption",
380
388
  aliases: [
381
389
  "image",
382
390
  "imageUpload",
@@ -390,7 +398,7 @@ const fo = {
390
398
  },
391
399
  video: {
392
400
  title: "Video",
393
- subtext: "Insert a video",
401
+ subtext: "Resizable video with caption",
394
402
  aliases: [
395
403
  "video",
396
404
  "videoUpload",
@@ -404,7 +412,7 @@ const fo = {
404
412
  },
405
413
  audio: {
406
414
  title: "Audio",
407
- subtext: "Insert audio",
415
+ subtext: "Embedded audio with caption",
408
416
  aliases: [
409
417
  "audio",
410
418
  "audioUpload",
@@ -418,9 +426,15 @@ const fo = {
418
426
  },
419
427
  file: {
420
428
  title: "File",
421
- subtext: "Insert a file",
429
+ subtext: "Embedded file",
422
430
  aliases: ["file", "upload", "embed", "media", "url"],
423
431
  group: "Media"
432
+ },
433
+ emoji: {
434
+ title: "Emoji",
435
+ subtext: "Search for and insert an emoji",
436
+ aliases: ["emoji", "emote", "emotion", "face"],
437
+ group: "Others"
424
438
  }
425
439
  },
426
440
  placeholders: {
@@ -616,7 +630,7 @@ const fo = {
616
630
  generic: {
617
631
  ctrl_shortcut: "Ctrl"
618
632
  }
619
- }, go = {
633
+ }, xo = {
620
634
  slash_menu: {
621
635
  heading: {
622
636
  title: "Titre 1",
@@ -720,6 +734,12 @@ const fo = {
720
734
  subtext: "Insérer un fichier",
721
735
  aliases: ["fichier", "téléverser", "intégrer", "média", "url"],
722
736
  group: "Média"
737
+ },
738
+ emoji: {
739
+ title: "Emoji",
740
+ subtext: "Utilisé pour insérer un emoji",
741
+ aliases: ["emoji", "émoticône", "émotion", "visage"],
742
+ group: "Autres"
723
743
  }
724
744
  },
725
745
  placeholders: {
@@ -915,7 +935,7 @@ const fo = {
915
935
  generic: {
916
936
  ctrl_shortcut: "Ctrl"
917
937
  }
918
- }, bo = {
938
+ }, Eo = {
919
939
  slash_menu: {
920
940
  heading: {
921
941
  title: "Fyrirsögn 1",
@@ -1012,6 +1032,12 @@ const fo = {
1012
1032
  subtext: "Setja inn skrá",
1013
1033
  aliases: ["skrá", "hlaða upp", "fella inn", "miðill", "url"],
1014
1034
  group: "Miðlar"
1035
+ },
1036
+ emoji: {
1037
+ title: "Emoji",
1038
+ subtext: "Notað til að setja inn smámynd",
1039
+ aliases: ["emoji", "andlitsávísun", "tilfinningar", "andlit"],
1040
+ group: "Annað"
1015
1041
  }
1016
1042
  },
1017
1043
  placeholders: {
@@ -1206,7 +1232,7 @@ const fo = {
1206
1232
  generic: {
1207
1233
  ctrl_shortcut: "Ctrl"
1208
1234
  }
1209
- }, ko = {
1235
+ }, Co = {
1210
1236
  slash_menu: {
1211
1237
  heading: {
1212
1238
  title: "見出し1",
@@ -1330,6 +1356,12 @@ const fo = {
1330
1356
  subtext: "ファイルを挿入",
1331
1357
  aliases: ["file", "upload", "embed", "media", "url", "ファイル"],
1332
1358
  group: "メディア"
1359
+ },
1360
+ emoji: {
1361
+ title: "絵文字",
1362
+ subtext: "絵文字を挿入するために使用します",
1363
+ aliases: ["絵文字", "顔文字", "感情表現", "顔"],
1364
+ group: "その他"
1333
1365
  }
1334
1366
  },
1335
1367
  placeholders: {
@@ -1525,7 +1557,7 @@ const fo = {
1525
1557
  generic: {
1526
1558
  ctrl_shortcut: "Ctrl"
1527
1559
  }
1528
- }, _o = {
1560
+ }, So = {
1529
1561
  slash_menu: {
1530
1562
  heading: {
1531
1563
  title: "제목1",
@@ -1633,6 +1665,21 @@ const fo = {
1633
1665
  subtext: "파일 삽입",
1634
1666
  aliases: ["file", "upload", "embed", "media", "파일", "url"],
1635
1667
  group: "미디어"
1668
+ },
1669
+ emoji: {
1670
+ title: "이모지",
1671
+ subtext: "이모지 삽입용으로 사용됩니다",
1672
+ aliases: [
1673
+ "이모지",
1674
+ "emoji",
1675
+ "감정 표현",
1676
+ "emotion expression",
1677
+ "표정",
1678
+ "face expression",
1679
+ "얼굴",
1680
+ "face"
1681
+ ],
1682
+ group: "기타"
1636
1683
  }
1637
1684
  },
1638
1685
  placeholders: {
@@ -1828,7 +1875,7 @@ const fo = {
1828
1875
  generic: {
1829
1876
  ctrl_shortcut: "Ctrl"
1830
1877
  }
1831
- }, yo = {
1878
+ }, Mo = {
1832
1879
  slash_menu: {
1833
1880
  heading: {
1834
1881
  title: "Kop 1",
@@ -1927,6 +1974,17 @@ const fo = {
1927
1974
  subtext: "Voeg een bestand in",
1928
1975
  aliases: ["bestand", "upload", "insluiten", "media", "url"],
1929
1976
  group: "Media"
1977
+ },
1978
+ emoji: {
1979
+ title: "Emoji",
1980
+ subtext: "Gebruikt voor het invoegen van een emoji",
1981
+ aliases: [
1982
+ "emoji",
1983
+ "emotie-uitdrukking",
1984
+ "gezichtsuitdrukking",
1985
+ "gezicht"
1986
+ ],
1987
+ group: "Overig"
1930
1988
  }
1931
1989
  },
1932
1990
  placeholders: {
@@ -2122,7 +2180,7 @@ const fo = {
2122
2180
  generic: {
2123
2181
  ctrl_shortcut: "Ctrl"
2124
2182
  }
2125
- }, wo = {
2183
+ }, To = {
2126
2184
  slash_menu: {
2127
2185
  heading: {
2128
2186
  title: "Nagłówek 1",
@@ -2211,6 +2269,12 @@ const fo = {
2211
2269
  subtext: "Wstaw plik",
2212
2270
  aliases: ["plik", "wrzuć", "wstaw", "media", "url"],
2213
2271
  group: "Media"
2272
+ },
2273
+ emoji: {
2274
+ title: "Emoji",
2275
+ subtext: "Używane do wstawiania emoji",
2276
+ aliases: ["emoji", "emotka", "wyrażenie emocji", "twarz"],
2277
+ group: "Inne"
2214
2278
  }
2215
2279
  },
2216
2280
  placeholders: {
@@ -2405,7 +2469,7 @@ const fo = {
2405
2469
  generic: {
2406
2470
  ctrl_shortcut: "Ctrl"
2407
2471
  }
2408
- }, vo = {
2472
+ }, Bo = {
2409
2473
  slash_menu: {
2410
2474
  heading: {
2411
2475
  title: "Título",
@@ -2501,6 +2565,12 @@ const fo = {
2501
2565
  subtext: "Inserir um arquivo",
2502
2566
  aliases: ["arquivo", "upload", "incorporar", "mídia", "url"],
2503
2567
  group: "Mídia"
2568
+ },
2569
+ emoji: {
2570
+ title: "Emoji",
2571
+ subtext: "Usado para inserir um emoji",
2572
+ aliases: ["emoji", "emoticon", "expressão emocional", "rosto"],
2573
+ group: "Outros"
2504
2574
  }
2505
2575
  },
2506
2576
  placeholders: {
@@ -2696,7 +2766,7 @@ const fo = {
2696
2766
  generic: {
2697
2767
  ctrl_shortcut: "Ctrl"
2698
2768
  }
2699
- }, xo = {
2769
+ }, Lo = {
2700
2770
  slash_menu: {
2701
2771
  heading: {
2702
2772
  title: "Tiêu đề H1",
@@ -2792,6 +2862,19 @@ const fo = {
2792
2862
  subtext: "Chèn tệp",
2793
2863
  aliases: ["tep", "tai-len", "nhung", "media", "url"],
2794
2864
  group: "Phương tiện"
2865
+ },
2866
+ emoji: {
2867
+ title: "Biểu tượng cảm xúc",
2868
+ subtext: "Dùng để chèn biểu tượng cảm xúc",
2869
+ aliases: [
2870
+ "biểu tượng cảm xúc",
2871
+ "emoji",
2872
+ "emoticon",
2873
+ "cảm xúc expression",
2874
+ "khuôn mặt",
2875
+ "face"
2876
+ ],
2877
+ group: "Khác"
2795
2878
  }
2796
2879
  },
2797
2880
  placeholders: {
@@ -2987,7 +3070,7 @@ const fo = {
2987
3070
  generic: {
2988
3071
  ctrl_shortcut: "Ctrl"
2989
3072
  }
2990
- }, Eo = {
3073
+ }, Io = {
2991
3074
  slash_menu: {
2992
3075
  heading: {
2993
3076
  title: "一级标题",
@@ -3116,6 +3199,20 @@ const fo = {
3116
3199
  subtext: "插入文件",
3117
3200
  aliases: ["文件", "上传", "file", "嵌入", "媒体", "url"],
3118
3201
  group: "媒体"
3202
+ },
3203
+ emoji: {
3204
+ title: "表情符号",
3205
+ subtext: "用于插入表情符号",
3206
+ aliases: [
3207
+ "表情符号",
3208
+ "emoji",
3209
+ "face",
3210
+ "emote",
3211
+ "表情",
3212
+ "表情表达",
3213
+ "表情"
3214
+ ],
3215
+ group: "其他"
3119
3216
  }
3120
3217
  },
3121
3218
  placeholders: {
@@ -3311,7 +3408,7 @@ const fo = {
3311
3408
  generic: {
3312
3409
  ctrl_shortcut: "Ctrl"
3313
3410
  }
3314
- }, Co = {
3411
+ }, Ao = {
3315
3412
  slash_menu: {
3316
3413
  heading: {
3317
3414
  title: "Заголовок 1 уровня",
@@ -3348,7 +3445,15 @@ const fo = {
3348
3445
  bullet_list: {
3349
3446
  title: "Маркированный список",
3350
3447
  subtext: "Для отображения неупорядоченного списка.",
3351
- aliases: ["ul", "li", "list", "bulletlist", "bullet list", "список", "маркированный список"],
3448
+ aliases: [
3449
+ "ul",
3450
+ "li",
3451
+ "list",
3452
+ "bulletlist",
3453
+ "bullet list",
3454
+ "список",
3455
+ "маркированный список"
3456
+ ],
3352
3457
  group: "Базовые блоки"
3353
3458
  },
3354
3459
  check_list: {
@@ -3434,6 +3539,12 @@ const fo = {
3434
3539
  subtext: "Вставить файл",
3435
3540
  aliases: ["file", "upload", "embed", "media", "url", "загрузка", "файл"],
3436
3541
  group: "Медиа"
3542
+ },
3543
+ emoji: {
3544
+ title: "Эмодзи",
3545
+ subtext: "Используется для вставки эмодзи",
3546
+ aliases: ["эмодзи", "смайлик", "выражение эмоций", "лицо"],
3547
+ group: "Прочее"
3437
3548
  }
3438
3549
  },
3439
3550
  placeholders: {
@@ -3629,33 +3740,33 @@ const fo = {
3629
3740
  generic: {
3630
3741
  ctrl_shortcut: "Ctrl"
3631
3742
  }
3632
- }, Ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3743
+ }, zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3633
3744
  __proto__: null,
3634
- ar: fo,
3635
- en: Je,
3636
- fr: go,
3637
- is: bo,
3638
- ja: ko,
3639
- ko: _o,
3640
- nl: yo,
3641
- pl: wo,
3642
- pt: vo,
3643
- ru: Co,
3644
- vi: xo,
3645
- zh: Eo
3745
+ ar: vo,
3746
+ en: et,
3747
+ fr: xo,
3748
+ is: Eo,
3749
+ ja: Co,
3750
+ ko: So,
3751
+ nl: Mo,
3752
+ pl: To,
3753
+ pt: Bo,
3754
+ ru: Ao,
3755
+ vi: Lo,
3756
+ zh: Io
3646
3757
  }, Symbol.toStringTag, { value: "Module" }));
3647
- function So(e, t = JSON.stringify) {
3758
+ function No(e, t = JSON.stringify) {
3648
3759
  const o = {};
3649
3760
  return e.filter((i) => {
3650
3761
  const n = t(i);
3651
3762
  return Object.prototype.hasOwnProperty.call(o, n) ? !1 : o[n] = !0;
3652
3763
  });
3653
3764
  }
3654
- function Mo(e) {
3765
+ function Po(e) {
3655
3766
  const t = e.filter(
3656
3767
  (i, n) => e.indexOf(i) !== n
3657
3768
  );
3658
- return So(t);
3769
+ return No(t);
3659
3770
  }
3660
3771
  const oe = M.create({
3661
3772
  name: "uniqueID",
@@ -3671,7 +3782,7 @@ const oe = M.create({
3671
3782
  const e = window.__TEST_OPTIONS;
3672
3783
  return e.mockID === void 0 ? e.mockID = 0 : e.mockID++, e.mockID.toString();
3673
3784
  }
3674
- return Ft();
3785
+ return $t();
3675
3786
  },
3676
3787
  filterTransaction: null
3677
3788
  };
@@ -3734,26 +3845,26 @@ const oe = M.create({
3734
3845
  });
3735
3846
  if (!r || a)
3736
3847
  return;
3737
- const { tr: s } = n, { types: l, attributeName: d, generateID: u } = this.options, p = Lt(
3848
+ const { tr: s } = n, { types: l, attributeName: d, generateID: u } = this.options, p = Nt(
3738
3849
  i.doc,
3739
3850
  o
3740
3851
  ), { mapping: h } = p;
3741
- if (It(p).forEach(({ newRange: m }) => {
3742
- const g = At(
3852
+ if (Pt(p).forEach(({ newRange: m }) => {
3853
+ const g = Ht(
3743
3854
  n.doc,
3744
3855
  m,
3745
3856
  (T) => l.includes(T.type.name)
3746
- ), b = g.map(({ node: T }) => T.attrs[d]).filter((T) => T !== null), A = Mo(b);
3857
+ ), b = g.map(({ node: T }) => T.attrs[d]).filter((T) => T !== null), A = Po(b);
3747
3858
  g.forEach(({ node: T, pos: N }) => {
3748
3859
  let Z;
3749
- const Ie = (Z = s.doc.nodeAt(N)) === null || Z === void 0 ? void 0 : Z.attrs[d];
3750
- if (Ie === null) {
3751
- const Ae = i.doc.type.createAndFill().content;
3752
- if (i.doc.content.findDiffStart(Ae) === null) {
3753
- const Ne = JSON.parse(
3860
+ const Ae = (Z = s.doc.nodeAt(N)) === null || Z === void 0 ? void 0 : Z.attrs[d];
3861
+ if (Ae === null) {
3862
+ const Ne = i.doc.type.createAndFill().content;
3863
+ if (i.doc.content.findDiffStart(Ne) === null) {
3864
+ const Pe = JSON.parse(
3754
3865
  JSON.stringify(n.doc.toJSON())
3755
3866
  );
3756
- if (Ne.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(Ne.content) === JSON.stringify(Ae.toJSON())) {
3867
+ if (Pe.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(Pe.content) === JSON.stringify(Ne.toJSON())) {
3757
3868
  s.setNodeMarkup(N, void 0, {
3758
3869
  ...T.attrs,
3759
3870
  [d]: "initialBlockId"
@@ -3767,8 +3878,8 @@ const oe = M.create({
3767
3878
  });
3768
3879
  return;
3769
3880
  }
3770
- const { deleted: Ct } = h.invert().mapResult(N);
3771
- Ct && A.includes(Ie) && s.setNodeMarkup(N, void 0, {
3881
+ const { deleted: Tt } = h.invert().mapResult(N);
3882
+ Tt && A.includes(Ae) && s.setNodeMarkup(N, void 0, {
3772
3883
  ...T.attrs,
3773
3884
  [d]: u()
3774
3885
  });
@@ -3839,7 +3950,7 @@ const oe = M.create({
3839
3950
  ];
3840
3951
  }
3841
3952
  });
3842
- function Ye(e) {
3953
+ function tt(e) {
3843
3954
  const t = e.attrs.id, o = e.firstChild, i = o.type, n = e.childCount === 2 ? e.lastChild.childCount : 0;
3844
3955
  return {
3845
3956
  id: t,
@@ -3869,7 +3980,7 @@ function k(e, t) {
3869
3980
  break;
3870
3981
  s -= 1, a = n.node(s);
3871
3982
  }
3872
- const { id: l, contentNode: d, contentType: u, numChildBlocks: p } = Ye(a), h = n.start(s), f = n.end(s);
3983
+ const { id: l, contentNode: d, contentType: u, numChildBlocks: p } = tt(a), h = n.start(s), f = n.end(s);
3873
3984
  return {
3874
3985
  id: l,
3875
3986
  node: a,
@@ -3881,10 +3992,10 @@ function k(e, t) {
3881
3992
  depth: s
3882
3993
  };
3883
3994
  }
3884
- function Ue(e) {
3995
+ function De(e) {
3885
3996
  return e.type === "link";
3886
3997
  }
3887
- function Qe(e) {
3998
+ function ot(e) {
3888
3999
  return typeof e != "string" && e.type === "link";
3889
4000
  }
3890
4001
  function te(e) {
@@ -3895,12 +4006,12 @@ class I extends Error {
3895
4006
  super(`Unreachable case: ${t}`);
3896
4007
  }
3897
4008
  }
3898
- function Nr(e, t = !0) {
4009
+ function Fr(e, t = !0) {
3899
4010
  const { "data-test": o, ...i } = e;
3900
4011
  if (Object.keys(i).length > 0 && t)
3901
4012
  throw new Error("Object must be empty " + JSON.stringify(e));
3902
4013
  }
3903
- function De(e, t, o) {
4014
+ function je(e, t, o) {
3904
4015
  const i = [];
3905
4016
  for (const [n, r] of Object.entries(e.styles)) {
3906
4017
  const a = o[n];
@@ -3916,7 +4027,7 @@ function De(e, t, o) {
3916
4027
  return e.text.split(/(\n)/g).filter((n) => n.length > 0).map((n) => n === `
3917
4028
  ` ? t.nodes.hardBreak.create() : t.text(n, i));
3918
4029
  }
3919
- function To(e, t, o) {
4030
+ function Ho(e, t, o) {
3920
4031
  const i = t.marks.link.create({
3921
4032
  href: e.href
3922
4033
  });
@@ -3934,25 +4045,25 @@ function ye(e, t, o) {
3934
4045
  const i = [];
3935
4046
  if (typeof e == "string")
3936
4047
  return i.push(
3937
- ...De(
4048
+ ...je(
3938
4049
  { type: "text", text: e, styles: {} },
3939
4050
  t,
3940
4051
  o
3941
4052
  )
3942
4053
  ), i;
3943
4054
  for (const n of e)
3944
- i.push(...De(n, t, o));
4055
+ i.push(...je(n, t, o));
3945
4056
  return i;
3946
4057
  }
3947
- function K(e, t, o) {
4058
+ function W(e, t, o) {
3948
4059
  const i = [];
3949
4060
  for (const n of e)
3950
- typeof n == "string" ? i.push(...ye(n, t, o)) : Qe(n) ? i.push(...To(n, t, o)) : te(n) ? i.push(...ye([n], t, o)) : i.push(
3951
- tt(n, t, o)
4061
+ typeof n == "string" ? i.push(...ye(n, t, o)) : ot(n) ? i.push(...Ho(n, t, o)) : te(n) ? i.push(...ye([n], t, o)) : i.push(
4062
+ nt(n, t, o)
3952
4063
  );
3953
4064
  return i;
3954
4065
  }
3955
- function et(e, t, o) {
4066
+ function it(e, t, o) {
3956
4067
  const i = [];
3957
4068
  for (const n of e.rows) {
3958
4069
  const r = [];
@@ -3963,7 +4074,7 @@ function et(e, t, o) {
3963
4074
  else if (typeof s == "string")
3964
4075
  l = t.nodes.tableParagraph.create({}, t.text(s));
3965
4076
  else {
3966
- const u = K(s, t, o);
4077
+ const u = W(s, t, o);
3967
4078
  l = t.nodes.tableParagraph.create({}, u);
3968
4079
  }
3969
4080
  const d = t.nodes.tableCell.create({}, l);
@@ -3974,20 +4085,20 @@ function et(e, t, o) {
3974
4085
  }
3975
4086
  return i;
3976
4087
  }
3977
- function tt(e, t, o) {
4088
+ function nt(e, t, o) {
3978
4089
  let i, n = e.type;
3979
4090
  if (n === void 0 && (n = "paragraph"), !t.nodes[n])
3980
4091
  throw new Error(`node type ${n} not found in schema`);
3981
4092
  if (!e.content)
3982
4093
  i = t.nodes[n].create(e.props);
3983
4094
  else if (typeof e.content == "string") {
3984
- const r = K([e.content], t, o);
4095
+ const r = W([e.content], t, o);
3985
4096
  i = t.nodes[n].create(e.props, r);
3986
4097
  } else if (Array.isArray(e.content)) {
3987
- const r = K(e.content, t, o);
4098
+ const r = W(e.content, t, o);
3988
4099
  i = t.nodes[n].create(e.props, r);
3989
4100
  } else if (e.content.type === "tableContent") {
3990
- const r = et(e.content, t, o);
4101
+ const r = it(e.content, t, o);
3991
4102
  i = t.nodes[n].create(e.props, r);
3992
4103
  } else
3993
4104
  throw new I(e.content.type);
@@ -3996,7 +4107,7 @@ function tt(e, t, o) {
3996
4107
  function P(e, t, o) {
3997
4108
  let i = e.id;
3998
4109
  i === void 0 && (i = oe.options.generateID());
3999
- const n = tt(
4110
+ const n = nt(
4000
4111
  e,
4001
4112
  t,
4002
4113
  o
@@ -4013,7 +4124,7 @@ function P(e, t, o) {
4013
4124
  r.length > 0 ? [n, a] : n
4014
4125
  );
4015
4126
  }
4016
- function Bo(e, t, o) {
4127
+ function Uo(e, t, o) {
4017
4128
  const i = {
4018
4129
  type: "tableContent",
4019
4130
  rows: []
@@ -4042,7 +4153,7 @@ function Ee(e, t, o) {
4042
4153
  if (te(n))
4043
4154
  n.text += `
4044
4155
  `;
4045
- else if (Ue(n))
4156
+ else if (De(n))
4046
4157
  n.content[n.content.length - 1].text += `
4047
4158
  `;
4048
4159
  else
@@ -4058,7 +4169,7 @@ function Ee(e, t, o) {
4058
4169
  }
4059
4170
  if (r.type.name !== "link" && r.type.name !== "text" && t[r.type.name]) {
4060
4171
  n && (i.push(n), n = void 0), i.push(
4061
- ot(r, t, o)
4172
+ rt(r, t, o)
4062
4173
  );
4063
4174
  return;
4064
4175
  }
@@ -4092,7 +4203,7 @@ function Ee(e, t, o) {
4092
4203
  type: "text",
4093
4204
  text: r.textContent,
4094
4205
  styles: a
4095
- }) : Ue(n) && (s ? n.href === s.attrs.href ? JSON.stringify(
4206
+ }) : De(n) && (s ? n.href === s.attrs.href ? JSON.stringify(
4096
4207
  n.content[n.content.length - 1].styles
4097
4208
  ) === JSON.stringify(a) ? n.content[n.content.length - 1].text += r.textContent : n.content.push({
4098
4209
  type: "text",
@@ -4129,7 +4240,7 @@ function Ee(e, t, o) {
4129
4240
  };
4130
4241
  }), n && i.push(n), i;
4131
4242
  }
4132
- function ot(e, t, o) {
4243
+ function rt(e, t, o) {
4133
4244
  if (e.type.name === "text" || e.type.name === "link")
4134
4245
  throw new Error("unexpected");
4135
4246
  const i = {}, n = t[e.type.name];
@@ -4158,7 +4269,7 @@ function v(e, t, o, i, n) {
4158
4269
  const r = n == null ? void 0 : n.get(e);
4159
4270
  if (r)
4160
4271
  return r;
4161
- const a = Ye(e);
4272
+ const a = tt(e);
4162
4273
  let s = a.id;
4163
4274
  s === null && (s = oe.options.generateID());
4164
4275
  const l = {};
@@ -4193,7 +4304,7 @@ function v(e, t, o, i, n) {
4193
4304
  i
4194
4305
  );
4195
4306
  else if (d.content === "table")
4196
- p = Bo(
4307
+ p = Uo(
4197
4308
  a.contentNode,
4198
4309
  o,
4199
4310
  i
@@ -4211,14 +4322,14 @@ function v(e, t, o, i, n) {
4211
4322
  };
4212
4323
  return n == null || n.set(e, h), h;
4213
4324
  }
4214
- function Lo(e) {
4325
+ function Do(e) {
4215
4326
  return e.document || window.document;
4216
4327
  }
4217
- const it = (e, t, o, i, n) => {
4328
+ const at = (e, t, o, i, n) => {
4218
4329
  if (!o.nodes[e.type.name])
4219
4330
  throw new Error("Serializer is missing a node type: " + e.type.name);
4220
4331
  const { dom: r, contentDOM: a } = we.renderSpec(
4221
- Lo(t),
4332
+ Do(t),
4222
4333
  o.nodes[e.type.name](e)
4223
4334
  );
4224
4335
  if (a) {
@@ -4257,11 +4368,11 @@ const it = (e, t, o, i, n) => {
4257
4368
  o.serializeFragment(e.content, t, a);
4258
4369
  }
4259
4370
  return r;
4260
- }, nt = (e, t) => {
4261
- const o = t.serializeFragment(e), i = document.createElement("div");
4262
- return i.appendChild(o), i.innerHTML;
4371
+ }, st = (e, t, o) => {
4372
+ const i = t.serializeFragment(e, o), n = document.createElement("div");
4373
+ return n.appendChild(i), n.innerHTML;
4263
4374
  };
4264
- function Io(e) {
4375
+ function jo(e) {
4265
4376
  const t = /* @__PURE__ */ new Set([
4266
4377
  ...e.orderedListItemBlockTypes,
4267
4378
  ...e.unorderedListItemBlockTypes
@@ -4323,44 +4434,50 @@ function Io(e) {
4323
4434
  }
4324
4435
  const ae = (e, t) => {
4325
4436
  const o = we.fromSchema(e);
4326
- return o.serializeNodeInner = (i, n) => it(i, n, o, t, !0), o.exportProseMirrorFragment = (i) => ve().use(qe, { fragment: !0 }).use(Io, {
4437
+ return o.serializeNodeInner = (i, n) => at(i, n, o, t, !0), o.exportProseMirrorFragment = (i, n) => ve().use(Je, { fragment: !0 }).use(jo, {
4327
4438
  orderedListItemBlockTypes: /* @__PURE__ */ new Set(["numberedListItem"]),
4328
4439
  unorderedListItemBlockTypes: /* @__PURE__ */ new Set([
4329
4440
  "bulletListItem",
4330
4441
  "checkListItem"
4331
4442
  ])
4332
- }).use(Xe).processSync(nt(i, o)).value, o.exportBlocks = (i) => {
4333
- const n = i.map(
4334
- (a) => P(a, e, t.schema.styleSchema)
4335
- ), r = e.nodes.blockGroup.create(null, n);
4336
- return o.exportProseMirrorFragment(L.from(r));
4443
+ }).use(Ye).processSync(st(i, o, n)).value, o.exportBlocks = (i, n) => {
4444
+ const r = i.map(
4445
+ (s) => P(s, e, t.schema.styleSchema)
4446
+ ), a = e.nodes.blockGroup.create(null, r);
4447
+ return o.exportProseMirrorFragment(
4448
+ L.from(a),
4449
+ n
4450
+ );
4337
4451
  }, o;
4338
- }, rt = (e, t) => {
4452
+ }, Ce = (e, t) => {
4339
4453
  const o = we.fromSchema(e);
4340
- return o.serializeNodeInner = (i, n) => it(i, n, o, t, !1), o.serializeProseMirrorFragment = (i) => nt(i, o), o.serializeBlocks = (i) => {
4341
- const n = i.map(
4342
- (a) => P(a, e, t.schema.styleSchema)
4343
- ), r = e.nodes.blockGroup.create(null, n);
4344
- return o.serializeProseMirrorFragment(L.from(r));
4454
+ return o.serializeNodeInner = (i, n) => at(i, n, o, t, !1), o.serializeProseMirrorFragment = (i, n) => st(i, o, n), o.serializeBlocks = (i, n) => {
4455
+ const r = i.map(
4456
+ (s) => P(s, e, t.schema.styleSchema)
4457
+ ), a = e.nodes.blockGroup.create(null, r);
4458
+ return o.serializeProseMirrorFragment(
4459
+ L.from(a),
4460
+ n
4461
+ );
4345
4462
  }, o;
4346
- }, Ao = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
4463
+ }, Ro = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
4347
4464
  function H(e, t = "Ctrl") {
4348
- return Ao() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
4465
+ return Ro() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
4349
4466
  }
4350
- function R(...e) {
4467
+ function j(...e) {
4351
4468
  return e.filter((t) => t).join(" ");
4352
4469
  }
4353
- const Pr = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
4354
- function O(e, t, o, i) {
4470
+ const Gr = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
4471
+ function R(e, t, o, i) {
4355
4472
  const n = document.createElement("div");
4356
- n.className = R(
4473
+ n.className = j(
4357
4474
  "bn-block-content",
4358
4475
  o.class
4359
4476
  ), n.setAttribute("data-content-type", e);
4360
4477
  for (const [a, s] of Object.entries(o))
4361
4478
  a !== "class" && n.setAttribute(a, s);
4362
4479
  const r = document.createElement(t);
4363
- r.className = R(
4480
+ r.className = j(
4364
4481
  "bn-inline-content",
4365
4482
  i.class
4366
4483
  );
@@ -4373,12 +4490,8 @@ function O(e, t, o, i) {
4373
4490
  contentDOM: r
4374
4491
  };
4375
4492
  }
4376
- const Ve = (e, t) => {
4377
- const o = P(
4378
- e,
4379
- t._tiptapEditor.schema,
4380
- t.schema.styleSchema
4381
- ).firstChild, i = t._tiptapEditor.schema.nodes[o.type.name].spec.toDOM;
4493
+ const Re = (e, t) => {
4494
+ const o = P(e, t.pmSchema, t.schema.styleSchema).firstChild, i = t.pmSchema.nodes[o.type.name].spec.toDOM;
4382
4495
  if (i === void 0)
4383
4496
  throw new Error(
4384
4497
  "This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`."
@@ -4400,18 +4513,18 @@ const Ve = (e, t) => {
4400
4513
  default: "left",
4401
4514
  values: ["left", "center", "right", "justify"]
4402
4515
  }
4403
- }, at = ["backgroundColor", "textColor"];
4516
+ }, lt = ["backgroundColor", "textColor"];
4404
4517
  function re(e) {
4405
4518
  return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
4406
4519
  }
4407
- function Hr(e) {
4520
+ function Kr(e) {
4408
4521
  const t = e.split("/");
4409
4522
  return !t.length || // invalid?
4410
4523
  t[t.length - 1] === "" ? e : t[t.length - 1];
4411
4524
  }
4412
- function st(e) {
4525
+ function dt(e) {
4413
4526
  const t = {};
4414
- return Object.entries(e).filter(([o, i]) => !at.includes(o)).forEach(([o, i]) => {
4527
+ return Object.entries(e).filter(([o, i]) => !lt.includes(o)).forEach(([o, i]) => {
4415
4528
  t[o] = {
4416
4529
  default: i.default,
4417
4530
  keepOnSplit: !0,
@@ -4436,7 +4549,7 @@ function st(e) {
4436
4549
  };
4437
4550
  }), t;
4438
4551
  }
4439
- function No(e, t, o, i) {
4552
+ function Vo(e, t, o, i) {
4440
4553
  if (typeof e == "boolean")
4441
4554
  throw new Error(
4442
4555
  "Cannot find node position as getPos is a boolean, not a function."
@@ -4454,13 +4567,13 @@ function me(e, t, o, i, n = !1, r) {
4454
4567
  if (r !== void 0)
4455
4568
  for (const [s, l] of Object.entries(r))
4456
4569
  s !== "class" && a.setAttribute(s, l);
4457
- a.className = R(
4570
+ a.className = j(
4458
4571
  "bn-block-content",
4459
4572
  (r == null ? void 0 : r.class) || ""
4460
4573
  ), a.setAttribute("data-content-type", t);
4461
4574
  for (const [s, l] of Object.entries(o))
4462
- !at.includes(s) && l !== i[s].default && a.setAttribute(re(s), l);
4463
- return n && a.setAttribute("data-file-block", ""), a.appendChild(e.dom), e.contentDOM !== void 0 && (e.contentDOM.className = R(
4575
+ !lt.includes(s) && l !== i[s].default && a.setAttribute(re(s), l);
4576
+ return n && a.setAttribute("data-file-block", ""), a.appendChild(e.dom), e.contentDOM !== void 0 && (e.contentDOM.className = j(
4464
4577
  "bn-inline-content",
4465
4578
  e.contentDOM.className
4466
4579
  ), e.contentDOM.setAttribute("data-editable", "")), {
@@ -4468,17 +4581,17 @@ function me(e, t, o, i, n = !1, r) {
4468
4581
  dom: a
4469
4582
  };
4470
4583
  }
4471
- function z(e) {
4584
+ function O(e) {
4472
4585
  return $.create(e);
4473
4586
  }
4474
- function lt(e, t) {
4587
+ function ct(e, t) {
4475
4588
  return {
4476
4589
  config: e,
4477
4590
  implementation: t
4478
4591
  };
4479
4592
  }
4480
4593
  function q(e, t, o) {
4481
- return lt(
4594
+ return ct(
4482
4595
  {
4483
4596
  type: e.name,
4484
4597
  content: e.config.content === "inline*" ? "inline" : e.config.content === "tableRow+" ? "table" : "none",
@@ -4487,18 +4600,18 @@ function q(e, t, o) {
4487
4600
  {
4488
4601
  node: e,
4489
4602
  requiredExtensions: o,
4490
- toInternalHTML: Ve,
4491
- toExternalHTML: Ve
4603
+ toInternalHTML: Re,
4604
+ toExternalHTML: Re
4492
4605
  // parse: () => undefined, // parse rules are in node already
4493
4606
  }
4494
4607
  );
4495
4608
  }
4496
- function dt(e) {
4609
+ function ut(e) {
4497
4610
  return Object.fromEntries(
4498
4611
  Object.entries(e).map(([t, o]) => [t, o.config])
4499
4612
  );
4500
4613
  }
4501
- function Po(e, t) {
4614
+ function Oo(e, t) {
4502
4615
  const o = [
4503
4616
  {
4504
4617
  tag: "[data-content-type=" + e.type + "]",
@@ -4516,16 +4629,16 @@ function Po(e, t) {
4516
4629
  }), o;
4517
4630
  }
4518
4631
  function se(e, t) {
4519
- const o = z({
4632
+ const o = O({
4520
4633
  name: e.type,
4521
4634
  content: e.content === "inline" ? "inline*" : "",
4522
4635
  group: "blockContent",
4523
4636
  selectable: !0,
4524
4637
  addAttributes() {
4525
- return st(e.propSchema);
4638
+ return dt(e.propSchema);
4526
4639
  },
4527
4640
  parseHTML() {
4528
- return Po(e, t.parse);
4641
+ return Oo(e, t.parse);
4529
4642
  },
4530
4643
  renderHTML() {
4531
4644
  const i = document.createElement("div");
@@ -4536,7 +4649,7 @@ function se(e, t) {
4536
4649
  addNodeView() {
4537
4650
  return ({ getPos: i }) => {
4538
4651
  var l;
4539
- const n = this.options.editor, r = No(
4652
+ const n = this.options.editor, r = Vo(
4540
4653
  i,
4541
4654
  n,
4542
4655
  this.editor,
@@ -4556,7 +4669,7 @@ function se(e, t) {
4556
4669
  throw new Error(
4557
4670
  "Node name does not match block type. This is a bug in BlockNote."
4558
4671
  );
4559
- return lt(e, {
4672
+ return ct(e, {
4560
4673
  node: o,
4561
4674
  toInternalHTML: (i, n) => {
4562
4675
  var s;
@@ -4588,10 +4701,10 @@ function se(e, t) {
4588
4701
  }
4589
4702
  });
4590
4703
  }
4591
- function Ho(e, t, o, i) {
4704
+ function zo(e, t, o, i) {
4592
4705
  return e.dom.setAttribute("data-inline-content-type", t), Object.entries(o).filter(([n, r]) => r !== i[n].default).map(([n, r]) => [re(n), r]).forEach(([n, r]) => e.dom.setAttribute(n, r)), e.contentDOM !== void 0 && e.contentDOM.setAttribute("data-editable", ""), e;
4593
4706
  }
4594
- function Uo(e) {
4707
+ function Fo(e) {
4595
4708
  return {
4596
4709
  Backspace: ({ editor: t }) => {
4597
4710
  const o = t.state.selection.$from;
@@ -4599,14 +4712,14 @@ function Uo(e) {
4599
4712
  }
4600
4713
  };
4601
4714
  }
4602
- function Do(e, t) {
4715
+ function Go(e, t) {
4603
4716
  return {
4604
4717
  config: e,
4605
4718
  implementation: t
4606
4719
  };
4607
4720
  }
4608
- function Vo(e, t) {
4609
- return Do(
4721
+ function Ko(e, t) {
4722
+ return Go(
4610
4723
  {
4611
4724
  type: e.name,
4612
4725
  propSchema: t,
@@ -4617,12 +4730,12 @@ function Vo(e, t) {
4617
4730
  }
4618
4731
  );
4619
4732
  }
4620
- function ct(e) {
4733
+ function pt(e) {
4621
4734
  return Object.fromEntries(
4622
4735
  Object.entries(e).map(([t, o]) => [t, o.config])
4623
4736
  );
4624
4737
  }
4625
- function Ro(e) {
4738
+ function Wo(e) {
4626
4739
  return [
4627
4740
  {
4628
4741
  tag: `[data-inline-content-type="${e.type}"]`,
@@ -4633,7 +4746,7 @@ function Ro(e) {
4633
4746
  }
4634
4747
  ];
4635
4748
  }
4636
- function Ur(e, t) {
4749
+ function Wr(e, t) {
4637
4750
  const o = $.create({
4638
4751
  name: e.type,
4639
4752
  inline: !0,
@@ -4642,24 +4755,24 @@ function Ur(e, t) {
4642
4755
  atom: e.content === "none",
4643
4756
  content: e.content === "styled" ? "inline*" : "",
4644
4757
  addAttributes() {
4645
- return st(e.propSchema);
4758
+ return dt(e.propSchema);
4646
4759
  },
4647
4760
  addKeyboardShortcuts() {
4648
- return Uo(e);
4761
+ return Fo(e);
4649
4762
  },
4650
4763
  parseHTML() {
4651
- return Ro(e);
4764
+ return Wo(e);
4652
4765
  },
4653
4766
  renderHTML({ node: i }) {
4654
4767
  const n = this.options.editor, r = t.render(
4655
- ot(
4768
+ rt(
4656
4769
  i,
4657
4770
  n.schema.inlineContentSchema,
4658
4771
  n.schema.styleSchema
4659
4772
  )
4660
4773
  // TODO: fix cast
4661
4774
  );
4662
- return Ho(
4775
+ return zo(
4663
4776
  r,
4664
4777
  e.type,
4665
4778
  i.attrs,
@@ -4667,12 +4780,12 @@ function Ur(e, t) {
4667
4780
  );
4668
4781
  }
4669
4782
  });
4670
- return Vo(
4783
+ return Ko(
4671
4784
  o,
4672
4785
  e.propSchema
4673
4786
  );
4674
4787
  }
4675
- function Oo(e) {
4788
+ function $o(e) {
4676
4789
  return e === "boolean" ? {} : {
4677
4790
  stringValue: {
4678
4791
  default: void 0,
@@ -4684,17 +4797,17 @@ function Oo(e) {
4684
4797
  }
4685
4798
  };
4686
4799
  }
4687
- function jo(e, t, o, i) {
4800
+ function qo(e, t, o, i) {
4688
4801
  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;
4689
4802
  }
4690
- function ut(e, t) {
4803
+ function ht(e, t) {
4691
4804
  return {
4692
4805
  config: e,
4693
4806
  implementation: t
4694
4807
  };
4695
4808
  }
4696
4809
  function U(e, t) {
4697
- return ut(
4810
+ return ht(
4698
4811
  {
4699
4812
  type: e.name,
4700
4813
  propSchema: t
@@ -4704,12 +4817,12 @@ function U(e, t) {
4704
4817
  }
4705
4818
  );
4706
4819
  }
4707
- function pt(e) {
4820
+ function mt(e) {
4708
4821
  return Object.fromEntries(
4709
4822
  Object.entries(e).map(([t, o]) => [t, o.config])
4710
4823
  );
4711
4824
  }
4712
- function zo(e) {
4825
+ function Xo(e) {
4713
4826
  return [
4714
4827
  {
4715
4828
  tag: `[data-style-type="${e.type}"]`,
@@ -4720,14 +4833,14 @@ function zo(e) {
4720
4833
  }
4721
4834
  ];
4722
4835
  }
4723
- function Dr(e, t) {
4836
+ function $r(e, t) {
4724
4837
  const o = xe.create({
4725
4838
  name: e.type,
4726
4839
  addAttributes() {
4727
- return Oo(e.propSchema);
4840
+ return $o(e.propSchema);
4728
4841
  },
4729
4842
  parseHTML() {
4730
- return zo(e);
4843
+ return Xo(e);
4731
4844
  },
4732
4845
  renderHTML({ mark: i }) {
4733
4846
  let n;
@@ -4737,7 +4850,7 @@ function Dr(e, t) {
4737
4850
  n = t.render(i.attrs.stringValue);
4738
4851
  else
4739
4852
  throw new I(e.propSchema);
4740
- return jo(
4853
+ return qo(
4741
4854
  n,
4742
4855
  e.type,
4743
4856
  i.attrs.stringValue,
@@ -4745,7 +4858,7 @@ function Dr(e, t) {
4745
4858
  );
4746
4859
  }
4747
4860
  });
4748
- return ut(e, {
4861
+ return ht(e, {
4749
4862
  mark: o
4750
4863
  });
4751
4864
  }
@@ -4758,7 +4871,7 @@ const le = (e) => {
4758
4871
  return i.className = "bn-file-default-preview-name", i.textContent = e.props.name || "", t.appendChild(o), t.appendChild(i), {
4759
4872
  dom: t
4760
4873
  };
4761
- }, j = (e, t) => {
4874
+ }, V = (e, t) => {
4762
4875
  const o = document.createElement("div");
4763
4876
  o.className = "bn-file-and-caption-wrapper";
4764
4877
  const i = document.createElement("p");
@@ -4775,7 +4888,7 @@ const le = (e) => {
4775
4888
  const s = (d) => {
4776
4889
  d.preventDefault();
4777
4890
  }, l = () => {
4778
- t._tiptapEditor.view.dispatch(
4891
+ t.dispatch(
4779
4892
  t._tiptapEditor.state.tr.setMeta(t.filePanel.plugin, {
4780
4893
  block: e
4781
4894
  })
@@ -4799,7 +4912,7 @@ const le = (e) => {
4799
4912
  );
4800
4913
  }
4801
4914
  };
4802
- }, Re = (e) => ({ url: e.src || void 0 }), ce = (e, t) => {
4915
+ }, Ve = (e) => ({ url: e.src || void 0 }), ce = (e, t) => {
4803
4916
  const o = e.querySelector(
4804
4917
  t
4805
4918
  );
@@ -4812,10 +4925,10 @@ const le = (e) => {
4812
4925
  return i.textContent = t, o.appendChild(e), o.appendChild(i), {
4813
4926
  dom: o
4814
4927
  };
4815
- }, Ce = (e, t) => {
4928
+ }, Se = (e, t) => {
4816
4929
  const o = document.createElement("figure"), i = document.createElement("figcaption");
4817
4930
  return i.textContent = t, o.appendChild(e), o.appendChild(i), { dom: o };
4818
- }, ht = (e, t, o, i, n) => {
4931
+ }, ft = (e, t, o, i, n) => {
4819
4932
  if (!e.props.previewWidth)
4820
4933
  throw new Error("Block must have a `previewWidth` prop.");
4821
4934
  const r = document.createElement("div");
@@ -4875,7 +4988,91 @@ const le = (e) => {
4875
4988
  );
4876
4989
  }
4877
4990
  };
4878
- }, Fo = {
4991
+ }, Oe = (e) => ({ url: e.src || void 0 }), Zo = {
4992
+ backgroundColor: _.backgroundColor,
4993
+ // File name.
4994
+ name: {
4995
+ default: ""
4996
+ },
4997
+ // File url.
4998
+ url: {
4999
+ default: ""
5000
+ },
5001
+ // File caption.
5002
+ caption: {
5003
+ default: ""
5004
+ },
5005
+ showPreview: {
5006
+ default: !0
5007
+ }
5008
+ }, Jo = {
5009
+ type: "audio",
5010
+ propSchema: Zo,
5011
+ content: "none",
5012
+ isFileBlock: !0,
5013
+ fileBlockAcceptMimeTypes: ["audio/*"]
5014
+ }, Yo = (e, t) => {
5015
+ const o = document.createElement("div");
5016
+ if (o.className = "bn-file-block-content-wrapper", e.props.url === "") {
5017
+ const i = document.createElement("div");
5018
+ i.innerHTML = '<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>';
5019
+ const n = de(
5020
+ e,
5021
+ t,
5022
+ t.dictionary.file_blocks.audio.add_button_text,
5023
+ i.firstElementChild
5024
+ );
5025
+ return o.appendChild(n.dom), {
5026
+ dom: o,
5027
+ destroy: () => {
5028
+ var r;
5029
+ (r = n == null ? void 0 : n.destroy) == null || r.call(n);
5030
+ }
5031
+ };
5032
+ } else if (e.props.showPreview) {
5033
+ const i = document.createElement("audio");
5034
+ i.className = "bn-audio", t.resolveFileUrl(e.props.url).then((r) => {
5035
+ i.src = r;
5036
+ }), i.controls = !0, i.contentEditable = "false", i.draggable = !1;
5037
+ const n = V(e, i);
5038
+ return o.appendChild(n.dom), {
5039
+ dom: o
5040
+ };
5041
+ } else {
5042
+ const i = le(e).dom;
5043
+ return {
5044
+ dom: V(e, i).dom
5045
+ };
5046
+ }
5047
+ }, Qo = (e) => {
5048
+ if (e.tagName === "AUDIO")
5049
+ return Oe(e);
5050
+ if (e.tagName === "FIGURE") {
5051
+ const t = ce(e, "audio");
5052
+ if (!t)
5053
+ return;
5054
+ const { targetElement: o, caption: i } = t;
5055
+ return {
5056
+ ...Oe(o),
5057
+ caption: i
5058
+ };
5059
+ }
5060
+ }, ei = (e) => {
5061
+ if (!e.props.url) {
5062
+ const o = document.createElement("p");
5063
+ return o.textContent = "Add audio", {
5064
+ dom: o
5065
+ };
5066
+ }
5067
+ let t;
5068
+ return e.props.showPreview ? (t = document.createElement("audio"), t.src = e.props.url) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Se(t, e.props.caption) : ue(t, e.props.caption) : {
5069
+ dom: t
5070
+ };
5071
+ }, ti = se(Jo, {
5072
+ render: Yo,
5073
+ parse: Qo,
5074
+ toExternalHTML: ei
5075
+ }), oi = {
4879
5076
  backgroundColor: _.backgroundColor,
4880
5077
  // File name.
4881
5078
  name: {
@@ -4889,12 +5086,12 @@ const le = (e) => {
4889
5086
  caption: {
4890
5087
  default: ""
4891
5088
  }
4892
- }, Go = {
5089
+ }, ii = {
4893
5090
  type: "file",
4894
- propSchema: Fo,
5091
+ propSchema: oi,
4895
5092
  content: "none",
4896
5093
  isFileBlock: !0
4897
- }, Wo = (e, t) => {
5094
+ }, ni = (e, t) => {
4898
5095
  const o = document.createElement("div");
4899
5096
  if (o.className = "bn-file-block-content-wrapper", e.props.url === "") {
4900
5097
  const i = de(e, t);
@@ -4903,25 +5100,25 @@ const le = (e) => {
4903
5100
  destroy: i.destroy
4904
5101
  };
4905
5102
  } else {
4906
- const i = le(e).dom, n = j(e, i);
5103
+ const i = le(e).dom, n = V(e, i);
4907
5104
  return o.appendChild(n.dom), {
4908
5105
  dom: o
4909
5106
  };
4910
5107
  }
4911
- }, Ko = (e) => {
5108
+ }, ri = (e) => {
4912
5109
  if (e.tagName === "EMBED")
4913
- return Re(e);
5110
+ return Ve(e);
4914
5111
  if (e.tagName === "FIGURE") {
4915
5112
  const t = ce(e, "embed");
4916
5113
  if (!t)
4917
5114
  return;
4918
5115
  const { targetElement: o, caption: i } = t;
4919
5116
  return {
4920
- ...Re(o),
5117
+ ...Ve(o),
4921
5118
  caption: i
4922
5119
  };
4923
5120
  }
4924
- }, $o = (e) => {
5121
+ }, ai = (e) => {
4925
5122
  if (!e.props.url) {
4926
5123
  const o = document.createElement("p");
4927
5124
  return o.textContent = "Add file", {
@@ -4932,14 +5129,14 @@ const le = (e) => {
4932
5129
  return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ? ue(t, e.props.caption) : {
4933
5130
  dom: t
4934
5131
  };
4935
- }, qo = se(Go, {
4936
- render: Wo,
4937
- parse: Ko,
4938
- toExternalHTML: $o
4939
- }), Oe = (e) => {
5132
+ }, si = se(ii, {
5133
+ render: ni,
5134
+ parse: ri,
5135
+ toExternalHTML: ai
5136
+ }), ze = (e) => {
4940
5137
  const t = e.src || void 0, o = e.width || void 0;
4941
5138
  return { url: t, previewWidth: o };
4942
- }, Xo = {
5139
+ }, li = {
4943
5140
  textAlignment: _.textAlignment,
4944
5141
  backgroundColor: _.backgroundColor,
4945
5142
  // File name.
@@ -4961,13 +5158,13 @@ const le = (e) => {
4961
5158
  previewWidth: {
4962
5159
  default: 512
4963
5160
  }
4964
- }, Zo = {
5161
+ }, di = {
4965
5162
  type: "image",
4966
- propSchema: Xo,
5163
+ propSchema: li,
4967
5164
  content: "none",
4968
5165
  isFileBlock: !0,
4969
5166
  fileBlockAcceptMimeTypes: ["image/*"]
4970
- }, Jo = (e, t) => {
5167
+ }, ci = (e, t) => {
4971
5168
  const o = document.createElement("div");
4972
5169
  if (o.className = "bn-file-block-content-wrapper", e.props.url === "") {
4973
5170
  const i = document.createElement("div");
@@ -4993,13 +5190,13 @@ const le = (e) => {
4993
5190
  e.props.previewWidth,
4994
5191
  t.domElement.firstElementChild.clientWidth
4995
5192
  );
4996
- const n = ht(
5193
+ const n = ft(
4997
5194
  e,
4998
5195
  t,
4999
5196
  i,
5000
5197
  () => i.width,
5001
5198
  (a) => i.width = a
5002
- ), r = j(e, n.dom);
5199
+ ), r = V(e, n.dom);
5003
5200
  return o.appendChild(r.dom), {
5004
5201
  dom: o,
5005
5202
  destroy: n.destroy
@@ -5007,23 +5204,23 @@ const le = (e) => {
5007
5204
  } else {
5008
5205
  const i = le(e).dom;
5009
5206
  return {
5010
- dom: j(e, i).dom
5207
+ dom: V(e, i).dom
5011
5208
  };
5012
5209
  }
5013
- }, Yo = (e) => {
5210
+ }, ui = (e) => {
5014
5211
  if (e.tagName === "IMG")
5015
- return Oe(e);
5212
+ return ze(e);
5016
5213
  if (e.tagName === "FIGURE") {
5017
5214
  const t = ce(e, "img");
5018
5215
  if (!t)
5019
5216
  return;
5020
5217
  const { targetElement: o, caption: i } = t;
5021
5218
  return {
5022
- ...Oe(o),
5219
+ ...ze(o),
5023
5220
  caption: i
5024
5221
  };
5025
5222
  }
5026
- }, Qo = (e) => {
5223
+ }, pi = (e) => {
5027
5224
  if (!e.props.url) {
5028
5225
  const o = document.createElement("p");
5029
5226
  return o.textContent = "Add image", {
@@ -5031,17 +5228,17 @@ const le = (e) => {
5031
5228
  };
5032
5229
  }
5033
5230
  let t;
5034
- return e.props.showPreview ? (t = document.createElement("img"), t.src = e.props.url, t.alt = e.props.name || e.props.caption || "BlockNote image", t.width = e.props.previewWidth) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Ce(t, e.props.caption) : ue(t, e.props.caption) : {
5231
+ return e.props.showPreview ? (t = document.createElement("img"), t.src = e.props.url, t.alt = e.props.name || e.props.caption || "BlockNote image", t.width = e.props.previewWidth) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Se(t, e.props.caption) : ue(t, e.props.caption) : {
5035
5232
  dom: t
5036
5233
  };
5037
- }, ei = se(Zo, {
5038
- render: Jo,
5039
- parse: Yo,
5040
- toExternalHTML: Qo
5041
- }), je = (e) => {
5234
+ }, hi = se(di, {
5235
+ render: ci,
5236
+ parse: ui,
5237
+ toExternalHTML: pi
5238
+ }), Fe = (e) => {
5042
5239
  const t = e.src || void 0, o = e.width || void 0;
5043
5240
  return { url: t, previewWidth: o };
5044
- }, ti = {
5241
+ }, mi = {
5045
5242
  textAlignment: _.textAlignment,
5046
5243
  backgroundColor: _.backgroundColor,
5047
5244
  // File name.
@@ -5063,13 +5260,13 @@ const le = (e) => {
5063
5260
  previewWidth: {
5064
5261
  default: 512
5065
5262
  }
5066
- }, oi = {
5263
+ }, fi = {
5067
5264
  type: "video",
5068
- propSchema: ti,
5265
+ propSchema: mi,
5069
5266
  content: "none",
5070
5267
  isFileBlock: !0,
5071
5268
  fileBlockAcceptMimeTypes: ["video/*"]
5072
- }, ii = (e, t) => {
5269
+ }, gi = (e, t) => {
5073
5270
  const o = document.createElement("div");
5074
5271
  if (o.className = "bn-file-block-content-wrapper", e.props.url === "") {
5075
5272
  const i = document.createElement("div");
@@ -5093,13 +5290,13 @@ const le = (e) => {
5093
5290
  e.props.previewWidth,
5094
5291
  t.domElement.firstElementChild.clientWidth
5095
5292
  );
5096
- const n = ht(
5293
+ const n = ft(
5097
5294
  e,
5098
5295
  t,
5099
5296
  i,
5100
5297
  () => i.width,
5101
5298
  (a) => i.width = a
5102
- ), r = j(e, n.dom);
5299
+ ), r = V(e, n.dom);
5103
5300
  return o.appendChild(r.dom), {
5104
5301
  dom: o,
5105
5302
  destroy: n.destroy
@@ -5107,23 +5304,23 @@ const le = (e) => {
5107
5304
  } else {
5108
5305
  const i = le(e).dom;
5109
5306
  return {
5110
- dom: j(e, i).dom
5307
+ dom: V(e, i).dom
5111
5308
  };
5112
5309
  }
5113
- }, ni = (e) => {
5310
+ }, bi = (e) => {
5114
5311
  if (e.tagName === "VIDEO")
5115
- return je(e);
5312
+ return Fe(e);
5116
5313
  if (e.tagName === "FIGURE") {
5117
5314
  const t = ce(e, "video");
5118
5315
  if (!t)
5119
5316
  return;
5120
5317
  const { targetElement: o, caption: i } = t;
5121
5318
  return {
5122
- ...je(o),
5319
+ ...Fe(o),
5123
5320
  caption: i
5124
5321
  };
5125
5322
  }
5126
- }, ri = (e) => {
5323
+ }, ki = (e) => {
5127
5324
  if (!e.props.url) {
5128
5325
  const o = document.createElement("p");
5129
5326
  return o.textContent = "Add video", {
@@ -5131,98 +5328,14 @@ const le = (e) => {
5131
5328
  };
5132
5329
  }
5133
5330
  let t;
5134
- return e.props.showPreview ? (t = document.createElement("video"), t.src = e.props.url, t.width = e.props.previewWidth) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Ce(t, e.props.caption) : ue(t, e.props.caption) : {
5135
- dom: t
5136
- };
5137
- }, ai = se(oi, {
5138
- render: ii,
5139
- parse: ni,
5140
- toExternalHTML: ri
5141
- }), ze = (e) => ({ url: e.src || void 0 }), si = {
5142
- backgroundColor: _.backgroundColor,
5143
- // File name.
5144
- name: {
5145
- default: ""
5146
- },
5147
- // File url.
5148
- url: {
5149
- default: ""
5150
- },
5151
- // File caption.
5152
- caption: {
5153
- default: ""
5154
- },
5155
- showPreview: {
5156
- default: !0
5157
- }
5158
- }, li = {
5159
- type: "audio",
5160
- propSchema: si,
5161
- content: "none",
5162
- isFileBlock: !0,
5163
- fileBlockAcceptMimeTypes: ["audio/*"]
5164
- }, di = (e, t) => {
5165
- const o = document.createElement("div");
5166
- if (o.className = "bn-file-block-content-wrapper", e.props.url === "") {
5167
- const i = document.createElement("div");
5168
- i.innerHTML = '<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>';
5169
- const n = de(
5170
- e,
5171
- t,
5172
- t.dictionary.file_blocks.audio.add_button_text,
5173
- i.firstElementChild
5174
- );
5175
- return o.appendChild(n.dom), {
5176
- dom: o,
5177
- destroy: () => {
5178
- var r;
5179
- (r = n == null ? void 0 : n.destroy) == null || r.call(n);
5180
- }
5181
- };
5182
- } else if (e.props.showPreview) {
5183
- const i = document.createElement("audio");
5184
- i.className = "bn-audio", t.resolveFileUrl(e.props.url).then((r) => {
5185
- i.src = r;
5186
- }), i.controls = !0, i.contentEditable = "false", i.draggable = !1;
5187
- const n = j(e, i);
5188
- return o.appendChild(n.dom), {
5189
- dom: o
5190
- };
5191
- } else {
5192
- const i = le(e).dom;
5193
- return {
5194
- dom: j(e, i).dom
5195
- };
5196
- }
5197
- }, ci = (e) => {
5198
- if (e.tagName === "AUDIO")
5199
- return ze(e);
5200
- if (e.tagName === "FIGURE") {
5201
- const t = ce(e, "audio");
5202
- if (!t)
5203
- return;
5204
- const { targetElement: o, caption: i } = t;
5205
- return {
5206
- ...ze(o),
5207
- caption: i
5208
- };
5209
- }
5210
- }, ui = (e) => {
5211
- if (!e.props.url) {
5212
- const o = document.createElement("p");
5213
- return o.textContent = "Add audio", {
5214
- dom: o
5215
- };
5216
- }
5217
- let t;
5218
- return e.props.showPreview ? (t = document.createElement("audio"), t.src = e.props.url) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Ce(t, e.props.caption) : ue(t, e.props.caption) : {
5331
+ return e.props.showPreview ? (t = document.createElement("video"), t.src = e.props.url, t.width = e.props.previewWidth) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Se(t, e.props.caption) : ue(t, e.props.caption) : {
5219
5332
  dom: t
5220
5333
  };
5221
- }, pi = se(li, {
5222
- render: di,
5223
- parse: ci,
5224
- toExternalHTML: ui
5225
- }), Vr = async (e) => {
5334
+ }, _i = se(fi, {
5335
+ render: gi,
5336
+ parse: bi,
5337
+ toExternalHTML: ki
5338
+ }), qr = async (e) => {
5226
5339
  const t = new FormData();
5227
5340
  return t.append("file", e), (await (await fetch("https://tmpfiles.org/api/v1/upload", {
5228
5341
  method: "POST",
@@ -5231,7 +5344,7 @@ const le = (e) => {
5231
5344
  "tmpfiles.org/",
5232
5345
  "tmpfiles.org/dl/"
5233
5346
  );
5234
- }, hi = xe.create({
5347
+ }, yi = xe.create({
5235
5348
  name: "backgroundColor",
5236
5349
  addAttributes() {
5237
5350
  return {
@@ -5257,10 +5370,10 @@ const le = (e) => {
5257
5370
  renderHTML({ HTMLAttributes: e }) {
5258
5371
  return ["span", e, 0];
5259
5372
  }
5260
- }), mi = U(
5261
- hi,
5373
+ }), wi = U(
5374
+ yi,
5262
5375
  "string"
5263
- ), fi = xe.create({
5376
+ ), vi = xe.create({
5264
5377
  name: "textColor",
5265
5378
  addAttributes() {
5266
5379
  return {
@@ -5284,16 +5397,16 @@ const le = (e) => {
5284
5397
  renderHTML({ HTMLAttributes: e }) {
5285
5398
  return ["span", e, 0];
5286
5399
  }
5287
- }), gi = U(fi, "string"), C = (e) => {
5400
+ }), xi = U(vi, "string"), C = (e) => {
5288
5401
  const { contentType: t } = k(
5289
5402
  e.state.doc,
5290
5403
  e.state.selection.from
5291
5404
  );
5292
5405
  return t.spec.content;
5293
- }, bi = {
5406
+ }, Ei = {
5294
5407
  ..._,
5295
5408
  level: { default: 1, values: [1, 2, 3] }
5296
- }, ki = z({
5409
+ }, Ci = O({
5297
5410
  name: "heading",
5298
5411
  content: "inline*",
5299
5412
  group: "blockContent",
@@ -5386,7 +5499,7 @@ const le = (e) => {
5386
5499
  },
5387
5500
  renderHTML({ node: e, HTMLAttributes: t }) {
5388
5501
  var o, i;
5389
- return O(
5502
+ return R(
5390
5503
  this.name,
5391
5504
  `h${e.attrs.level}`,
5392
5505
  {
@@ -5396,10 +5509,10 @@ const le = (e) => {
5396
5509
  ((i = this.options.domAttributes) == null ? void 0 : i.inlineContent) || {}
5397
5510
  );
5398
5511
  }
5399
- }), _i = q(
5400
- ki,
5401
- bi
5402
- ), Se = (e) => {
5512
+ }), Si = q(
5513
+ Ci,
5514
+ Ei
5515
+ ), Me = (e) => {
5403
5516
  const { contentNode: t, contentType: o } = k(
5404
5517
  e.state.doc,
5405
5518
  e.state.selection.from
@@ -5418,9 +5531,9 @@ const le = (e) => {
5418
5531
  a.command(() => t.childCount > 0 ? (r().deleteSelection().BNSplitBlock(n.selection.from, !0).run(), !0) : !1)
5419
5532
  )
5420
5533
  ]);
5421
- }, yi = {
5534
+ }, Mi = {
5422
5535
  ..._
5423
- }, wi = z({
5536
+ }, Ti = O({
5424
5537
  name: "bulletListItem",
5425
5538
  content: "inline*",
5426
5539
  group: "blockContent",
@@ -5443,7 +5556,7 @@ const le = (e) => {
5443
5556
  },
5444
5557
  addKeyboardShortcuts() {
5445
5558
  return {
5446
- Enter: () => Se(this.editor),
5559
+ Enter: () => Me(this.editor),
5447
5560
  "Mod-Shift-8": () => C(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
5448
5561
  this.editor.state.selection.anchor,
5449
5562
  {
@@ -5486,7 +5599,7 @@ const le = (e) => {
5486
5599
  },
5487
5600
  renderHTML({ HTMLAttributes: e }) {
5488
5601
  var t, o;
5489
- return O(
5602
+ return R(
5490
5603
  this.name,
5491
5604
  // We use a <p> tag, because for <li> tags we'd need a <ul> element to put
5492
5605
  // them in to be semantically correct, which we can't have due to the
@@ -5499,11 +5612,11 @@ const le = (e) => {
5499
5612
  ((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
5500
5613
  );
5501
5614
  }
5502
- }), vi = q(
5503
- wi,
5504
- yi
5505
- ), xi = new S("numbered-list-indexing"), Ei = () => new y({
5506
- key: xi,
5615
+ }), Bi = q(
5616
+ Ti,
5617
+ Mi
5618
+ ), Li = new S("numbered-list-indexing"), Ii = () => new y({
5619
+ key: Li,
5507
5620
  appendTransaction: (e, t, o) => {
5508
5621
  const i = o.tr;
5509
5622
  i.setMeta("numberedListIndexing", !0);
@@ -5532,9 +5645,9 @@ const le = (e) => {
5532
5645
  }
5533
5646
  }), n ? i : null;
5534
5647
  }
5535
- }), Ci = {
5648
+ }), Ai = {
5536
5649
  ..._
5537
- }, Si = z({
5650
+ }, Ni = O({
5538
5651
  name: "numberedListItem",
5539
5652
  content: "inline*",
5540
5653
  group: "blockContent",
@@ -5566,7 +5679,7 @@ const le = (e) => {
5566
5679
  },
5567
5680
  addKeyboardShortcuts() {
5568
5681
  return {
5569
- Enter: () => Se(this.editor),
5682
+ Enter: () => Me(this.editor),
5570
5683
  "Mod-Shift-7": () => C(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
5571
5684
  this.editor.state.selection.anchor,
5572
5685
  {
@@ -5577,7 +5690,7 @@ const le = (e) => {
5577
5690
  };
5578
5691
  },
5579
5692
  addProseMirrorPlugins() {
5580
- return [Ei()];
5693
+ return [Ii()];
5581
5694
  },
5582
5695
  parseHTML() {
5583
5696
  return [
@@ -5614,7 +5727,7 @@ const le = (e) => {
5614
5727
  },
5615
5728
  renderHTML({ HTMLAttributes: e }) {
5616
5729
  var t, o;
5617
- return O(
5730
+ return R(
5618
5731
  this.name,
5619
5732
  // We use a <p> tag, because for <li> tags we'd need an <ol> element to
5620
5733
  // put them in to be semantically correct, which we can't have due to the
@@ -5627,15 +5740,15 @@ const le = (e) => {
5627
5740
  ((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
5628
5741
  );
5629
5742
  }
5630
- }), Mi = q(
5631
- Si,
5632
- Ci
5633
- ), Ti = {
5743
+ }), Pi = q(
5744
+ Ni,
5745
+ Ai
5746
+ ), Hi = {
5634
5747
  ..._,
5635
5748
  checked: {
5636
5749
  default: !1
5637
5750
  }
5638
- }, Bi = z({
5751
+ }, Ui = O({
5639
5752
  name: "checkListItem",
5640
5753
  content: "inline*",
5641
5754
  group: "blockContent",
@@ -5680,7 +5793,7 @@ const le = (e) => {
5680
5793
  },
5681
5794
  addKeyboardShortcuts() {
5682
5795
  return {
5683
- Enter: () => Se(this.editor),
5796
+ Enter: () => Me(this.editor),
5684
5797
  "Mod-Shift-9": () => C(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
5685
5798
  this.editor.state.selection.anchor,
5686
5799
  {
@@ -5732,7 +5845,7 @@ const le = (e) => {
5732
5845
  var r, a;
5733
5846
  const o = document.createElement("input");
5734
5847
  o.type = "checkbox", o.checked = e.attrs.checked, e.attrs.checked && o.setAttribute("checked", "");
5735
- const { dom: i, contentDOM: n } = O(
5848
+ const { dom: i, contentDOM: n } = R(
5736
5849
  this.name,
5737
5850
  "p",
5738
5851
  {
@@ -5765,7 +5878,7 @@ const le = (e) => {
5765
5878
  });
5766
5879
  };
5767
5880
  a.addEventListener("change", s);
5768
- const { dom: l, contentDOM: d } = O(
5881
+ const { dom: l, contentDOM: d } = R(
5769
5882
  this.name,
5770
5883
  "p",
5771
5884
  {
@@ -5787,12 +5900,12 @@ const le = (e) => {
5787
5900
  };
5788
5901
  };
5789
5902
  }
5790
- }), Li = q(
5791
- Bi,
5792
- Ti
5793
- ), Ii = {
5903
+ }), Di = q(
5904
+ Ui,
5905
+ Hi
5906
+ ), ji = {
5794
5907
  ..._
5795
- }, Ai = z({
5908
+ }, Ri = O({
5796
5909
  name: "paragraph",
5797
5910
  content: "inline*",
5798
5911
  group: "blockContent",
@@ -5823,7 +5936,7 @@ const le = (e) => {
5823
5936
  },
5824
5937
  renderHTML({ HTMLAttributes: e }) {
5825
5938
  var t, o;
5826
- return O(
5939
+ return R(
5827
5940
  this.name,
5828
5941
  "p",
5829
5942
  {
@@ -5833,16 +5946,16 @@ const le = (e) => {
5833
5946
  ((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
5834
5947
  );
5835
5948
  }
5836
- }), Ni = q(
5837
- Ai,
5838
- Ii
5839
- ), Pi = M.create({
5949
+ }), Vi = q(
5950
+ Ri,
5951
+ ji
5952
+ ), Oi = M.create({
5840
5953
  name: "BlockNoteTableExtension",
5841
5954
  addProseMirrorPlugins: () => [
5842
- Yt({
5955
+ oo({
5843
5956
  cellMinWidth: 100
5844
5957
  }),
5845
- Qt()
5958
+ io()
5846
5959
  ],
5847
5960
  addKeyboardShortcuts() {
5848
5961
  return {
@@ -5863,14 +5976,14 @@ const le = (e) => {
5863
5976
  storage: e.storage
5864
5977
  };
5865
5978
  return {
5866
- tableRole: Nt(
5867
- Pt(e, "tableRole", t)
5979
+ tableRole: Ut(
5980
+ Dt(e, "tableRole", t)
5868
5981
  )
5869
5982
  };
5870
5983
  }
5871
- }), Hi = {
5984
+ }), zi = {
5872
5985
  ..._
5873
- }, Ui = z({
5986
+ }, Fi = O({
5874
5987
  name: "table",
5875
5988
  content: "tableRow+",
5876
5989
  group: "blockContent",
@@ -5881,7 +5994,7 @@ const le = (e) => {
5881
5994
  },
5882
5995
  renderHTML({ HTMLAttributes: e }) {
5883
5996
  var t, o;
5884
- return O(
5997
+ return R(
5885
5998
  this.name,
5886
5999
  "table",
5887
6000
  {
@@ -5891,7 +6004,7 @@ const le = (e) => {
5891
6004
  ((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
5892
6005
  );
5893
6006
  }
5894
- }), Di = $.create({
6007
+ }), Gi = $.create({
5895
6008
  name: "tableParagraph",
5896
6009
  group: "tableContent",
5897
6010
  content: "inline*",
@@ -5912,71 +6025,74 @@ const le = (e) => {
5912
6025
  renderHTML({ HTMLAttributes: e }) {
5913
6026
  return [
5914
6027
  "p",
5915
- Ht(this.options.HTMLAttributes, e),
6028
+ jt(this.options.HTMLAttributes, e),
5916
6029
  0
5917
6030
  ];
5918
6031
  }
5919
- }), Vi = q(
5920
- Ui,
5921
- Hi,
6032
+ }), Ki = q(
6033
+ Fi,
6034
+ zi,
5922
6035
  [
5923
- Pi,
5924
- Di,
5925
- Zt.extend({
6036
+ Oi,
6037
+ Gi,
6038
+ eo.extend({
5926
6039
  content: "tableContent"
5927
6040
  }),
5928
- Xt.extend({
6041
+ Qt.extend({
5929
6042
  content: "tableContent"
5930
6043
  }),
5931
- Jt
6044
+ to
5932
6045
  ]
5933
- ), mt = {
5934
- paragraph: Ni,
5935
- heading: _i,
5936
- bulletListItem: vi,
5937
- numberedListItem: Mi,
5938
- checkListItem: Li,
5939
- table: Vi,
5940
- file: qo,
5941
- image: ei,
5942
- video: ai,
5943
- audio: pi
5944
- }, Ri = dt(mt), ft = {
5945
- bold: U(Gt, "boolean"),
5946
- italic: U(Kt, "boolean"),
5947
- underline: U(qt, "boolean"),
5948
- strike: U($t, "boolean"),
5949
- code: U(Wt, "boolean"),
5950
- textColor: gi,
5951
- backgroundColor: mi
5952
- }, Rr = pt(ft), gt = {
6046
+ ), gt = {
6047
+ paragraph: Vi,
6048
+ heading: Si,
6049
+ bulletListItem: Bi,
6050
+ numberedListItem: Pi,
6051
+ checkListItem: Di,
6052
+ table: Ki,
6053
+ file: si,
6054
+ image: hi,
6055
+ video: _i,
6056
+ audio: ti
6057
+ }, Wi = ut(gt), bt = {
6058
+ bold: U(qt, "boolean"),
6059
+ italic: U(Zt, "boolean"),
6060
+ underline: U(Yt, "boolean"),
6061
+ strike: U(Jt, "boolean"),
6062
+ code: U(Xt, "boolean"),
6063
+ textColor: xi,
6064
+ backgroundColor: wi
6065
+ }, Xr = mt(bt), kt = {
5953
6066
  text: { config: "text", implementation: {} },
5954
6067
  link: { config: "link", implementation: {} }
5955
- }, Or = ct(
5956
- gt
6068
+ }, $i = pt(
6069
+ kt
5957
6070
  );
5958
6071
  function E(e, t) {
5959
- return e in t.schema.blockSchema && t.schema.blockSchema[e] === Ri[e];
6072
+ return e in t.schema.blockSchema && t.schema.blockSchema[e] === Wi[e];
5960
6073
  }
5961
- function Oi(e, t, o) {
6074
+ function qi(e, t) {
6075
+ return e in t.schema.inlineContentSchema && t.schema.inlineContentSchema[e] === $i[e];
6076
+ }
6077
+ function Xi(e, t, o) {
5962
6078
  return t.type === e && t.type in o.schema.blockSchema && E(t.type, o);
5963
6079
  }
5964
- function jr(e, t) {
6080
+ function Zr(e, t) {
5965
6081
  return e.type in t.schema.blockSchema && t.schema.blockSchema[e.type].isFileBlock || !1;
5966
6082
  }
5967
- function zr(e, t) {
6083
+ function Jr(e, t) {
5968
6084
  return e.type in t.schema.blockSchema && t.schema.blockSchema[e.type].isFileBlock && "showPreview" in t.schema.blockSchema[e.type].propSchema || !1;
5969
6085
  }
5970
- function Fr(e, t) {
6086
+ function Yr(e, t) {
5971
6087
  return t.schema.blockSchema[e.type].isFileBlock && !e.props.url;
5972
6088
  }
5973
- function ji(e, t, o) {
6089
+ function Zi(e, t, o) {
5974
6090
  return t in o.schema.blockSchema && e in o.schema.blockSchema[t].propSchema && o.schema.blockSchema[t].propSchema[e] === _[e];
5975
6091
  }
5976
- function Gr(e, t, o) {
5977
- return ji(e, t.type, o);
6092
+ function Qr(e, t, o) {
6093
+ return Zi(e, t.type, o);
5978
6094
  }
5979
- function Me(e, t) {
6095
+ function Te(e, t) {
5980
6096
  let o, i;
5981
6097
  if (t.firstChild.descendants((n, r) => o ? !1 : n.type.name !== "blockContainer" || n.attrs.id !== e ? !0 : (o = n, i = r + 1, !1)), o === void 0 || i === void 0)
5982
6098
  throw Error("Could not find block in the editor with matching ID.");
@@ -5985,44 +6101,47 @@ function Me(e, t) {
5985
6101
  posBeforeNode: i
5986
6102
  };
5987
6103
  }
5988
- function zi(e, t, o = "before", i) {
5989
- const n = i._tiptapEditor, r = typeof t == "string" ? t : t.id, a = [];
5990
- for (const u of e)
5991
- a.push(
5992
- P(u, n.schema, i.schema.styleSchema)
5993
- );
5994
- const { node: s, posBeforeNode: l } = Me(r, n.state.doc);
5995
- if (o === "before" && n.view.dispatch(
5996
- n.state.tr.insert(l, a)
5997
- ), o === "after" && n.view.dispatch(
5998
- n.state.tr.insert(l + s.nodeSize, a)
5999
- ), o === "nested" && s.childCount < 2) {
6000
- const u = n.state.schema.nodes.blockGroup.create(
6001
- {},
6002
- a
6104
+ function Ji(e, t, o = "before", i) {
6105
+ const n = typeof t == "string" ? t : t.id, r = [];
6106
+ for (const d of e)
6107
+ r.push(
6108
+ P(d, i.pmSchema, i.schema.styleSchema)
6003
6109
  );
6004
- n.view.dispatch(
6005
- n.state.tr.insert(
6006
- l + s.firstChild.nodeSize + 1,
6007
- u
6110
+ const { node: a, posBeforeNode: s } = Te(
6111
+ n,
6112
+ i._tiptapEditor.state.doc
6113
+ );
6114
+ if (o === "before" && i.dispatch(
6115
+ i._tiptapEditor.state.tr.insert(s, r)
6116
+ ), o === "after" && i.dispatch(
6117
+ i._tiptapEditor.state.tr.insert(
6118
+ s + a.nodeSize,
6119
+ r
6120
+ )
6121
+ ), o === "nested" && a.childCount < 2) {
6122
+ const d = i._tiptapEditor.state.schema.nodes.blockGroup.create({}, r);
6123
+ i.dispatch(
6124
+ i._tiptapEditor.state.tr.insert(
6125
+ s + a.firstChild.nodeSize + 1,
6126
+ d
6008
6127
  )
6009
6128
  );
6010
6129
  }
6011
- const d = [];
6012
- for (const u of a)
6013
- d.push(
6130
+ const l = [];
6131
+ for (const d of r)
6132
+ l.push(
6014
6133
  v(
6015
- u,
6134
+ d,
6016
6135
  i.schema.blockSchema,
6017
6136
  i.schema.inlineContentSchema,
6018
6137
  i.schema.styleSchema,
6019
6138
  i.blockCache
6020
6139
  )
6021
6140
  );
6022
- return d;
6141
+ return l;
6023
6142
  }
6024
- function Fi(e, t, o) {
6025
- const i = o._tiptapEditor, n = typeof e == "string" ? e : e.id, { posBeforeNode: r } = Me(n, i.state.doc);
6143
+ function Yi(e, t, o) {
6144
+ const i = o._tiptapEditor, n = typeof e == "string" ? e : e.id, { posBeforeNode: r } = Te(n, i.state.doc);
6026
6145
  i.commands.BNUpdateBlock(r + 1, t);
6027
6146
  const a = i.state.doc.resolve(r + 1).node();
6028
6147
  return v(
@@ -6033,7 +6152,7 @@ function Fi(e, t, o) {
6033
6152
  o.blockCache
6034
6153
  );
6035
6154
  }
6036
- function bt(e, t, o) {
6155
+ function _t(e, t, o) {
6037
6156
  const i = t._tiptapEditor, n = i.state.tr, r = new Set(
6038
6157
  e.map(
6039
6158
  (l) => typeof l == "string" ? l : l.id
@@ -6065,54 +6184,54 @@ function bt(e, t, o) {
6065
6184
  "Blocks with the following IDs could not be found in the editor: " + l
6066
6185
  );
6067
6186
  }
6068
- return i.view.dispatch(n), a;
6187
+ return t.dispatch(n), a;
6069
6188
  }
6070
- function Gi(e, t) {
6071
- return bt(e, t);
6189
+ function Qi(e, t) {
6190
+ return _t(e, t);
6072
6191
  }
6073
- function Wi(e, t, o) {
6074
- const i = o._tiptapEditor, n = [];
6075
- for (const l of t)
6076
- n.push(
6077
- P(l, i.schema, o.schema.styleSchema)
6192
+ function en(e, t, o) {
6193
+ const i = [];
6194
+ for (const s of t)
6195
+ i.push(
6196
+ P(s, o.pmSchema, o.schema.styleSchema)
6078
6197
  );
6079
- const r = typeof e[0] == "string" ? e[0] : e[0].id, a = bt(
6198
+ const n = typeof e[0] == "string" ? e[0] : e[0].id, r = _t(
6080
6199
  e,
6081
6200
  o,
6082
- (l, d, u, p) => {
6083
- if (l.attrs.id === r) {
6084
- const h = u.doc.nodeSize;
6085
- u.insert(d, n);
6086
- const f = u.doc.nodeSize;
6087
- return p + h - f;
6201
+ (s, l, d, u) => {
6202
+ if (s.attrs.id === n) {
6203
+ const p = d.doc.nodeSize;
6204
+ d.insert(l, i);
6205
+ const h = d.doc.nodeSize;
6206
+ return u + p - h;
6088
6207
  }
6089
- return p;
6208
+ return u;
6090
6209
  }
6091
- ), s = [];
6092
- for (const l of n)
6093
- s.push(
6210
+ ), a = [];
6211
+ for (const s of i)
6212
+ a.push(
6094
6213
  v(
6095
- l,
6214
+ s,
6096
6215
  o.schema.blockSchema,
6097
6216
  o.schema.inlineContentSchema,
6098
6217
  o.schema.styleSchema,
6099
6218
  o.blockCache
6100
6219
  )
6101
6220
  );
6102
- return { insertedBlocks: s, removedBlocks: a };
6221
+ return { insertedBlocks: a, removedBlocks: r };
6103
6222
  }
6104
- function Ki(e, t, o, i = { updateSelection: !0 }) {
6105
- const n = o._tiptapEditor, r = n.state.tr;
6106
- let { from: a, to: s } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, l = !0, d = !0, u = "";
6107
- if (t.forEach((p) => {
6108
- p.check(), l && p.isText && p.marks.length === 0 ? u += p.text : l = !1, d = d ? p.isBlock : !1;
6109
- }), a === s && d) {
6110
- const { parent: p } = r.doc.resolve(a);
6111
- p.isTextblock && !p.type.spec.code && !p.childCount && (a -= 1, s += 1);
6112
- }
6113
- return l ? r.insertText(u, a, s) : r.replaceWith(a, s, t), i.updateSelection && Ut(r, r.steps.length - 1, -1), n.view.dispatch(r), !0;
6223
+ function tn(e, t, o, i = { updateSelection: !0 }) {
6224
+ const n = o._tiptapEditor.state.tr;
6225
+ let { from: r, to: a } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, s = !0, l = !0, d = "";
6226
+ if (t.forEach((u) => {
6227
+ u.check(), s && u.isText && u.marks.length === 0 ? d += u.text : s = !1, l = l ? u.isBlock : !1;
6228
+ }), r === a && l) {
6229
+ const { parent: u } = n.doc.resolve(r);
6230
+ u.isTextblock && !u.type.spec.code && !u.childCount && (r -= 1, a += 1);
6231
+ }
6232
+ return s ? n.insertText(d, r, a) : n.replaceWith(r, a, t), i.updateSelection && Rt(n, n.steps.length - 1, -1), o.dispatch(n), !0;
6114
6233
  }
6115
- function $i() {
6234
+ function on() {
6116
6235
  const e = (t) => {
6117
6236
  let o = t.children.length;
6118
6237
  for (let i = 0; i < o; i++) {
@@ -6128,7 +6247,7 @@ function $i() {
6128
6247
  };
6129
6248
  return e;
6130
6249
  }
6131
- function qi() {
6250
+ function nn() {
6132
6251
  const e = (t) => {
6133
6252
  var o;
6134
6253
  if (t.children && "length" in t.children && t.children.length)
@@ -6143,35 +6262,35 @@ function qi() {
6143
6262
  };
6144
6263
  return e;
6145
6264
  }
6146
- function Te(e) {
6147
- return ve().use(qe, { fragment: !0 }).use($i).use(qi).use(eo).use(Ze).use(to, { handlers: { text: (o) => o.value } }).processSync(e).value;
6265
+ function Be(e) {
6266
+ return ve().use(Je, { fragment: !0 }).use(on).use(nn).use(no).use(Qe).use(ro, { handlers: { text: (o) => o.value } }).processSync(e).value;
6148
6267
  }
6149
- function Xi(e, t, o) {
6150
- const n = ae(t, o).exportBlocks(e);
6151
- return Te(n);
6268
+ function rn(e, t, o, i) {
6269
+ const r = ae(t, o).exportBlocks(e, i);
6270
+ return Be(r);
6152
6271
  }
6153
- function Zi(e) {
6272
+ function an(e) {
6154
6273
  return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
6155
6274
  }
6156
- function Ji(e) {
6275
+ function sn(e) {
6157
6276
  return e.nodeType === 3 && !/\S/.test(e.nodeValue || "");
6158
6277
  }
6159
- function Yi(e) {
6278
+ function ln(e) {
6160
6279
  e.querySelectorAll("li > ul, li > ol").forEach((t) => {
6161
- const o = Zi(t), i = t.parentElement, n = Array.from(i.childNodes).slice(
6280
+ const o = an(t), i = t.parentElement, n = Array.from(i.childNodes).slice(
6162
6281
  o + 1
6163
6282
  );
6164
6283
  t.remove(), n.forEach((r) => {
6165
6284
  r.remove();
6166
6285
  }), i.insertAdjacentElement("afterend", t), n.reverse().forEach((r) => {
6167
- if (Ji(r))
6286
+ if (sn(r))
6168
6287
  return;
6169
6288
  const a = document.createElement("li");
6170
6289
  a.append(r), t.insertAdjacentElement("afterend", a);
6171
6290
  }), i.childNodes.length === 0 && i.remove();
6172
6291
  });
6173
6292
  }
6174
- function Qi(e) {
6293
+ function dn(e) {
6175
6294
  e.querySelectorAll("li + ul, li + ol").forEach((t) => {
6176
6295
  var r, a;
6177
6296
  const o = t.previousElementSibling, i = document.createElement("div");
@@ -6181,19 +6300,19 @@ function Qi(e) {
6181
6300
  n.append(i.nextElementSibling);
6182
6301
  });
6183
6302
  }
6184
- let Fe = null;
6185
- function en() {
6186
- return Fe || (Fe = document.implementation.createHTMLDocument("title"));
6303
+ let Ge = null;
6304
+ function cn() {
6305
+ return Ge || (Ge = document.implementation.createHTMLDocument("title"));
6187
6306
  }
6188
- function kt(e) {
6307
+ function yt(e) {
6189
6308
  if (typeof e == "string") {
6190
- const t = en().createElement("div");
6309
+ const t = cn().createElement("div");
6191
6310
  t.innerHTML = e, e = t;
6192
6311
  }
6193
- return Yi(e), Qi(e), e;
6312
+ return ln(e), dn(e), e;
6194
6313
  }
6195
- async function _t(e, t, o, i, n) {
6196
- const r = kt(e), s = Tt.fromSchema(n).parse(r, {
6314
+ async function wt(e, t, o, i, n) {
6315
+ const r = yt(e), s = It.fromSchema(n).parse(r, {
6197
6316
  topNode: n.nodes.blockGroup.create()
6198
6317
  }), l = [];
6199
6318
  for (let d = 0; d < s.childCount; d++)
@@ -6202,7 +6321,7 @@ async function _t(e, t, o, i, n) {
6202
6321
  );
6203
6322
  return l;
6204
6323
  }
6205
- function tn(e, t) {
6324
+ function un(e, t) {
6206
6325
  const o = t.value ? t.value + `
6207
6326
  ` : "", i = {};
6208
6327
  t.lang && (i["data-language"] = t.lang);
@@ -6219,14 +6338,14 @@ function tn(e, t) {
6219
6338
  children: [n]
6220
6339
  }, e.patch(t, n), n;
6221
6340
  }
6222
- function on(e, t, o, i, n) {
6223
- const r = ve().use(oo).use(Ze).use(io, {
6341
+ function pn(e, t, o, i, n) {
6342
+ const r = ve().use(ao).use(Qe).use(so, {
6224
6343
  handlers: {
6225
- ...no,
6226
- code: tn
6344
+ ...lo,
6345
+ code: un
6227
6346
  }
6228
- }).use(Xe).processSync(e);
6229
- return _t(
6347
+ }).use(Ye).processSync(e);
6348
+ return wt(
6230
6349
  r.value,
6231
6350
  t,
6232
6351
  o,
@@ -6254,7 +6373,7 @@ class X {
6254
6373
  this.callbacks = {};
6255
6374
  }
6256
6375
  }
6257
- class nn {
6376
+ class hn {
6258
6377
  constructor(t, o, i, n) {
6259
6378
  c(this, "state");
6260
6379
  c(this, "emitUpdate");
@@ -6307,7 +6426,7 @@ class nn {
6307
6426
  }
6308
6427
  }
6309
6428
  const fe = new S("FilePanelPlugin");
6310
- class rn extends X {
6429
+ class mn extends X {
6311
6430
  constructor(o) {
6312
6431
  super();
6313
6432
  c(this, "view");
@@ -6315,7 +6434,7 @@ class rn extends X {
6315
6434
  c(this, "closeMenu", () => this.view.closeMenu());
6316
6435
  this.plugin = new y({
6317
6436
  key: fe,
6318
- view: (i) => (this.view = new nn(
6437
+ view: (i) => (this.view = new hn(
6319
6438
  o,
6320
6439
  fe,
6321
6440
  i,
@@ -6347,14 +6466,14 @@ class rn extends X {
6347
6466
  return this.on("update", o);
6348
6467
  }
6349
6468
  }
6350
- class an {
6469
+ class fn {
6351
6470
  constructor(t, o, i) {
6352
6471
  c(this, "state");
6353
6472
  c(this, "emitUpdate");
6354
6473
  c(this, "preventHide", !1);
6355
6474
  c(this, "preventShow", !1);
6356
6475
  c(this, "shouldShow", ({ state: t, from: o, to: i, view: n }) => {
6357
- const { doc: r, selection: a } = t, { empty: s } = a, l = !r.textBetween(o, i).length && Dt(t.selection);
6476
+ const { doc: r, selection: a } = t, { empty: s } = a, l = !r.textBetween(o, i).length && Vt(t.selection);
6358
6477
  return !(!n.hasFocus() || s || l);
6359
6478
  });
6360
6479
  c(this, "viewMousedownHandler", () => {
@@ -6412,7 +6531,7 @@ class an {
6412
6531
  }
6413
6532
  getSelectionBoundingBox() {
6414
6533
  const { state: t } = this.pmView, { selection: o } = t, { ranges: i } = o, n = Math.min(...i.map((a) => a.$from.pos)), r = Math.max(...i.map((a) => a.$to.pos));
6415
- if (Vt(o)) {
6534
+ if (Ot(o)) {
6416
6535
  const a = this.pmView.nodeDOM(n);
6417
6536
  if (a)
6418
6537
  return a.getBoundingClientRect();
@@ -6420,18 +6539,18 @@ class an {
6420
6539
  return ke(this.pmView, n, r);
6421
6540
  }
6422
6541
  }
6423
- const sn = new S(
6542
+ const gn = new S(
6424
6543
  "FormattingToolbarPlugin"
6425
6544
  );
6426
- class ln extends X {
6545
+ class bn extends X {
6427
6546
  constructor(o) {
6428
6547
  super();
6429
6548
  c(this, "view");
6430
6549
  c(this, "plugin");
6431
6550
  c(this, "closeMenu", () => this.view.closeMenu());
6432
6551
  this.plugin = new y({
6433
- key: sn,
6434
- view: (i) => (this.view = new an(o, i, (n) => {
6552
+ key: gn,
6553
+ view: (i) => (this.view = new fn(o, i, (n) => {
6435
6554
  this.emit("update", n);
6436
6555
  }), this.view),
6437
6556
  props: {
@@ -6447,7 +6566,7 @@ class ln extends X {
6447
6566
  return this.on("update", o);
6448
6567
  }
6449
6568
  }
6450
- class dn {
6569
+ class kn {
6451
6570
  constructor(t, o, i) {
6452
6571
  c(this, "state");
6453
6572
  c(this, "emitUpdate");
@@ -6465,7 +6584,7 @@ class dn {
6465
6584
  const o = t.target, i = this.pmView.posAtDOM(o, 0) + 1, n = this.pmView.state.doc.resolve(i), r = n.marks();
6466
6585
  for (const a of r)
6467
6586
  if (a.type.name === this.pmView.state.schema.mark("link").type.name) {
6468
- this.mouseHoveredLinkMark = a, this.mouseHoveredLinkMarkRange = Pe(n, a.type, a.attrs) || void 0;
6587
+ this.mouseHoveredLinkMark = a, this.mouseHoveredLinkMarkRange = He(n, a.type, a.attrs) || void 0;
6469
6588
  break;
6470
6589
  }
6471
6590
  }
@@ -6516,11 +6635,11 @@ class dn {
6516
6635
  this.linkMarkRange.from,
6517
6636
  this.linkMarkRange.from + o.length,
6518
6637
  this.pmView.state.schema.mark("link", { href: t })
6519
- ), this.pmView.dispatch(i), this.pmView.focus(), (n = this.state) != null && n.show && (this.state.show = !1, this.emitUpdate());
6638
+ ), this.editor.dispatch(i), this.pmView.focus(), (n = this.state) != null && n.show && (this.state.show = !1, this.emitUpdate());
6520
6639
  }
6521
6640
  deleteLink() {
6522
6641
  var t;
6523
- this.pmView.dispatch(
6642
+ this.editor.dispatch(
6524
6643
  this.pmView.state.tr.removeMark(
6525
6644
  this.linkMarkRange.from,
6526
6645
  this.linkMarkRange.to,
@@ -6537,7 +6656,7 @@ class dn {
6537
6656
  const i = this.pmView.state.selection.$from.marks();
6538
6657
  for (const n of i)
6539
6658
  if (n.type.name === this.pmView.state.schema.mark("link").type.name) {
6540
- this.keyboardHoveredLinkMark = n, this.keyboardHoveredLinkMarkRange = Pe(
6659
+ this.keyboardHoveredLinkMark = n, this.keyboardHoveredLinkMarkRange = He(
6541
6660
  this.pmView.state.selection.$from,
6542
6661
  n.type,
6543
6662
  n.attrs
@@ -6574,8 +6693,8 @@ class dn {
6574
6693
  );
6575
6694
  }
6576
6695
  }
6577
- const cn = new S("LinkToolbarPlugin");
6578
- class un extends X {
6696
+ const _n = new S("LinkToolbarPlugin");
6697
+ class yn extends X {
6579
6698
  constructor(o) {
6580
6699
  super();
6581
6700
  c(this, "view");
@@ -6614,8 +6733,8 @@ class un extends X {
6614
6733
  });
6615
6734
  c(this, "closeMenu", () => this.view.closeMenu());
6616
6735
  this.plugin = new y({
6617
- key: cn,
6618
- view: (i) => (this.view = new dn(o, i, (n) => {
6736
+ key: _n,
6737
+ view: (i) => (this.view = new kn(o, i, (n) => {
6619
6738
  this.emit("update", n);
6620
6739
  }), this.view),
6621
6740
  props: {
@@ -6631,202 +6750,24 @@ class un extends X {
6631
6750
  return ((i = (o = this.view) == null ? void 0 : o.state) == null ? void 0 : i.show) || !1;
6632
6751
  }
6633
6752
  }
6634
- const pn = Rt((e) => e.type.name === "blockContainer");
6635
- class hn {
6636
- constructor(t, o) {
6637
- c(this, "state");
6638
- c(this, "emitUpdate");
6639
- c(this, "rootEl");
6640
- c(this, "pluginState");
6641
- c(this, "handleScroll", () => {
6642
- var t, o;
6643
- if ((t = this.state) != null && t.show) {
6644
- const i = (o = this.rootEl) == null ? void 0 : o.querySelector(
6645
- `[data-decoration-id="${this.pluginState.decorationId}"]`
6646
- );
6647
- this.state.referencePos = i.getBoundingClientRect(), this.emitUpdate(this.pluginState.triggerCharacter);
6648
- }
6649
- });
6650
- c(this, "closeMenu", () => {
6651
- this.editor._tiptapEditor.view.dispatch(
6652
- this.editor._tiptapEditor.view.state.tr.setMeta(
6653
- V,
6654
- null
6655
- )
6656
- );
6657
- });
6658
- c(this, "clearQuery", () => {
6659
- this.pluginState !== void 0 && this.editor._tiptapEditor.chain().focus().deleteRange({
6660
- from: this.pluginState.queryStartPos - (this.pluginState.fromUserInput ? this.pluginState.triggerCharacter.length : 0),
6661
- to: this.editor._tiptapEditor.state.selection.from
6662
- }).run();
6663
- });
6664
- this.editor = t, this.pluginState = void 0, this.emitUpdate = (i) => {
6665
- if (!this.state)
6666
- throw new Error("Attempting to update uninitialized suggestions menu");
6667
- o(i, this.state);
6668
- }, this.rootEl = this.editor._tiptapEditor.view.root, this.rootEl.addEventListener("scroll", this.handleScroll, !0);
6669
- }
6670
- update(t, o) {
6671
- var d;
6672
- const i = V.getState(o), n = V.getState(
6673
- t.state
6674
- ), r = i === void 0 && n !== void 0, a = i !== void 0 && n === void 0;
6675
- if (!r && !(i !== void 0 && n !== void 0) && !a)
6676
- return;
6677
- if (this.pluginState = a ? i : n, a || !this.editor.isEditable) {
6678
- this.state.show = !1, this.emitUpdate(this.pluginState.triggerCharacter);
6679
- return;
6680
- }
6681
- const l = (d = this.rootEl) == null ? void 0 : d.querySelector(
6682
- `[data-decoration-id="${this.pluginState.decorationId}"]`
6683
- );
6684
- this.editor.isEditable && (this.state = {
6685
- show: !0,
6686
- referencePos: l.getBoundingClientRect(),
6687
- query: this.pluginState.query
6688
- }, this.emitUpdate(this.pluginState.triggerCharacter));
6689
- }
6690
- destroy() {
6691
- var t;
6692
- (t = this.rootEl) == null || t.removeEventListener("scroll", this.handleScroll, !0);
6693
- }
6694
- }
6695
- const V = new S("SuggestionMenuPlugin");
6696
- class mn extends X {
6697
- constructor(o) {
6698
- super();
6699
- c(this, "view");
6700
- c(this, "plugin");
6701
- c(this, "triggerCharacters", []);
6702
- c(this, "addTriggerCharacter", (o) => {
6703
- this.triggerCharacters.push(o);
6704
- });
6705
- // TODO: Should this be called automatically when listeners are removed?
6706
- c(this, "removeTriggerCharacter", (o) => {
6707
- this.triggerCharacters = this.triggerCharacters.filter(
6708
- (i) => i !== o
6709
- );
6710
- });
6711
- c(this, "closeMenu", () => this.view.closeMenu());
6712
- c(this, "clearQuery", () => this.view.clearQuery());
6713
- const i = this.triggerCharacters;
6714
- this.plugin = new y({
6715
- key: V,
6716
- view: () => (this.view = new hn(
6717
- o,
6718
- (n, r) => {
6719
- this.emit(`update ${n}`, r);
6720
- }
6721
- ), this.view),
6722
- state: {
6723
- // Initialize the plugin's internal state.
6724
- init() {
6725
- },
6726
- // Apply changes to the plugin state from an editor transaction.
6727
- apply(n, r, a, s) {
6728
- if (n.getMeta("orderedListIndexing") !== void 0)
6729
- return r;
6730
- const l = n.getMeta(V);
6731
- if (typeof l == "object" && l !== null && r === void 0)
6732
- return {
6733
- triggerCharacter: l.triggerCharacter,
6734
- fromUserInput: l.fromUserInput !== !1,
6735
- queryStartPos: s.selection.from,
6736
- query: "",
6737
- decorationId: `id_${Math.floor(Math.random() * 4294967295)}`
6738
- };
6739
- if (r === void 0)
6740
- return r;
6741
- if (
6742
- // Highlighting text should hide the menu.
6743
- s.selection.from !== s.selection.to || // Transactions with plugin metadata should hide the menu.
6744
- l === null || // Certain mouse events should hide the menu.
6745
- // TODO: Change to global mousedown listener.
6746
- n.getMeta("focus") || n.getMeta("blur") || n.getMeta("pointer") || // Moving the caret before the character which triggered the menu should hide it.
6747
- r.triggerCharacter !== void 0 && s.selection.from < r.queryStartPos
6748
- )
6749
- return;
6750
- const d = { ...r };
6751
- return d.query = s.doc.textBetween(
6752
- r.queryStartPos,
6753
- s.selection.from
6754
- ), d;
6755
- }
6756
- },
6757
- props: {
6758
- handleTextInput(n, r, a, s) {
6759
- const l = this.getState(n.state);
6760
- return i.includes(s) && l === void 0 ? (n.dispatch(
6761
- n.state.tr.insertText(s).scrollIntoView().setMeta(V, {
6762
- triggerCharacter: s
6763
- })
6764
- ), !0) : !1;
6765
- },
6766
- // Setup decorator on the currently active suggestion.
6767
- decorations(n) {
6768
- const r = this.getState(n);
6769
- if (r === void 0)
6770
- return null;
6771
- if (!r.fromUserInput) {
6772
- const a = pn(n.selection);
6773
- if (a)
6774
- return G.create(n.doc, [
6775
- W.node(
6776
- a.pos,
6777
- a.pos + a.node.nodeSize,
6778
- {
6779
- nodeName: "span",
6780
- class: "bn-suggestion-decorator",
6781
- "data-decoration-id": r.decorationId
6782
- }
6783
- )
6784
- ]);
6785
- }
6786
- return G.create(n.doc, [
6787
- W.inline(
6788
- r.queryStartPos - r.triggerCharacter.length,
6789
- r.queryStartPos,
6790
- {
6791
- nodeName: "span",
6792
- class: "bn-suggestion-decorator",
6793
- "data-decoration-id": r.decorationId
6794
- }
6795
- )
6796
- ]);
6797
- }
6798
- }
6799
- });
6800
- }
6801
- onUpdate(o, i) {
6802
- return this.triggerCharacters.includes(o) || this.addTriggerCharacter(o), this.on(`update ${o}`, i);
6803
- }
6804
- get shown() {
6805
- var o, i;
6806
- return ((i = (o = this.view) == null ? void 0 : o.state) == null ? void 0 : i.show) || !1;
6807
- }
6808
- }
6809
- function Wr(e, t) {
6810
- e.suggestionMenus.addTriggerCharacter(t);
6811
- }
6812
- class F extends he {
6813
- constructor(o, i) {
6814
- super(o, i);
6815
- c(this, "nodes");
6816
- const n = o.node();
6817
- this.nodes = [], o.doc.nodesBetween(o.pos, i.pos, (r, a, s) => {
6818
- if (s !== null && s.eq(n))
6819
- return this.nodes.push(r), !1;
6753
+ class z extends he {
6754
+ constructor(o, i) {
6755
+ super(o, i);
6756
+ c(this, "nodes");
6757
+ const n = o.node();
6758
+ this.nodes = [], o.doc.nodesBetween(o.pos, i.pos, (r, a, s) => {
6759
+ if (s !== null && s.eq(n))
6760
+ return this.nodes.push(r), !1;
6820
6761
  });
6821
6762
  }
6822
6763
  static create(o, i, n = i) {
6823
- return new F(o.resolve(i), o.resolve(n));
6764
+ return new z(o.resolve(i), o.resolve(n));
6824
6765
  }
6825
6766
  content() {
6826
6767
  return new D(L.from(this.nodes), 0, 0);
6827
6768
  }
6828
6769
  eq(o) {
6829
- if (!(o instanceof F) || this.nodes.length !== o.nodes.length || this.from !== o.from || this.to !== o.to)
6770
+ if (!(o instanceof z) || this.nodes.length !== o.nodes.length || this.from !== o.from || this.to !== o.to)
6830
6771
  return !1;
6831
6772
  for (let i = 0; i < this.nodes.length; i++)
6832
6773
  if (!this.nodes[i].eq(o.nodes[i]))
@@ -6835,7 +6776,7 @@ class F extends he {
6835
6776
  }
6836
6777
  map(o, i) {
6837
6778
  const n = i.mapResult(this.from), r = i.mapResult(this.to);
6838
- return r.deleted ? he.near(o.resolve(n.pos)) : n.deleted ? he.near(o.resolve(r.pos)) : new F(
6779
+ return r.deleted ? he.near(o.resolve(n.pos)) : n.deleted ? he.near(o.resolve(r.pos)) : new z(
6839
6780
  o.resolve(n.pos),
6840
6781
  o.resolve(r.pos)
6841
6782
  );
@@ -6852,7 +6793,7 @@ function pe(e, t) {
6852
6793
  if (e.hasAttribute("data-id"))
6853
6794
  return { node: e, id: e.getAttribute("data-id") };
6854
6795
  }
6855
- function fn(e, t) {
6796
+ function wn(e, t) {
6856
6797
  const o = pe(e, t);
6857
6798
  if (o && o.node.nodeType === 1) {
6858
6799
  const i = t.docView, n = i.nearestDesc(o.node, !0);
@@ -6860,7 +6801,7 @@ function fn(e, t) {
6860
6801
  }
6861
6802
  return null;
6862
6803
  }
6863
- function gn(e, t) {
6804
+ function vn(e, t) {
6864
6805
  let o, i;
6865
6806
  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);
6866
6807
  if (n && r) {
@@ -6870,7 +6811,7 @@ function gn(e, t) {
6870
6811
  o = e.from, i = e.to;
6871
6812
  return { from: o, to: i };
6872
6813
  }
6873
- function Ge(e, t, o = t) {
6814
+ function Ke(e, t, o = t) {
6874
6815
  t === o && (o += e.state.doc.resolve(t + 1).node().nodeSize);
6875
6816
  const i = e.domAtPos(t).node.cloneNode(!0), n = e.domAtPos(t).node, r = (u, p) => Array.prototype.indexOf.call(u.children, p), a = r(
6876
6817
  n,
@@ -6883,16 +6824,16 @@ function Ge(e, t, o = t) {
6883
6824
  );
6884
6825
  for (let u = n.childElementCount - 1; u >= 0; u--)
6885
6826
  (u > s || u < a) && i.removeChild(i.children[u]);
6886
- yt(e.root), B = i;
6827
+ vt(e.root), B = i;
6887
6828
  const d = e.dom.className.split(" ").filter(
6888
6829
  (u) => u !== "ProseMirror" && u !== "bn-root" && u !== "bn-editor"
6889
6830
  ).join(" ");
6890
6831
  B.className = B.className + " bn-drag-preview " + d, e.root instanceof ShadowRoot ? e.root.appendChild(B) : e.root.body.appendChild(B);
6891
6832
  }
6892
- function yt(e) {
6833
+ function vt(e) {
6893
6834
  B !== void 0 && (e instanceof ShadowRoot ? e.removeChild(B) : e.body.removeChild(B), B = void 0);
6894
6835
  }
6895
- function bn(e, t) {
6836
+ function xn(e, t) {
6896
6837
  if (!e.dataTransfer)
6897
6838
  return;
6898
6839
  const o = t.prosemirrorView, i = o.dom.getBoundingClientRect(), n = {
@@ -6908,23 +6849,25 @@ function bn(e, t) {
6908
6849
  }
6909
6850
  if (!a)
6910
6851
  return;
6911
- const s = fn(a.node, o);
6852
+ const s = wn(a.node, o);
6912
6853
  if (s != null) {
6913
- const l = o.state.selection, d = o.state.doc, { from: u, to: p } = gn(l, d), h = u <= s && s < p, f = l.$anchor.node() !== l.$head.node() || l instanceof F;
6854
+ const l = o.state.selection, d = o.state.doc, { from: u, to: p } = vn(l, d), h = u <= s && s < p, f = l.$anchor.node() !== l.$head.node() || l instanceof z;
6914
6855
  h && f ? (o.dispatch(
6915
- o.state.tr.setSelection(F.create(d, u, p))
6916
- ), Ge(o, u, p)) : (o.dispatch(
6856
+ o.state.tr.setSelection(z.create(d, u, p))
6857
+ ), Ke(o, u, p)) : (o.dispatch(
6917
6858
  o.state.tr.setSelection(ne.create(o.state.doc, s))
6918
- ), Ge(o, s));
6919
- const m = o.state.selection.content(), g = t._tiptapEditor.schema, A = rt(g, t).serializeProseMirrorFragment(
6920
- m.content
6859
+ ), Ke(o, s));
6860
+ const m = o.state.selection.content(), g = t.pmSchema, A = Ce(g, t).serializeProseMirrorFragment(
6861
+ m.content,
6862
+ {}
6921
6863
  ), N = ae(g, t).exportProseMirrorFragment(
6922
- m.content
6923
- ), Z = Te(N);
6864
+ m.content,
6865
+ {}
6866
+ ), Z = Be(N);
6924
6867
  e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html", A), e.dataTransfer.setData("text/html", N), e.dataTransfer.setData("text/plain", Z), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setDragImage(B, 0, 0), o.dragging = { slice: m, move: !0 };
6925
6868
  }
6926
6869
  }
6927
- class kn {
6870
+ class En {
6928
6871
  constructor(t, o, i) {
6929
6872
  c(this, "state");
6930
6873
  c(this, "emitUpdate");
@@ -7130,16 +7073,11 @@ class kn {
7130
7073
  this.editor._tiptapEditor.chain().BNCreateBlock(d).setTextSelection(u).run();
7131
7074
  } else
7132
7075
  this.editor._tiptapEditor.commands.setTextSelection(a + 1);
7133
- this.pmView.focus(), this.pmView.dispatch(
7134
- this.pmView.state.tr.scrollIntoView().setMeta(V, {
7135
- triggerCharacter: "/",
7136
- fromUserInput: !1
7137
- })
7138
- );
7076
+ this.editor.openSelectionMenu("/");
7139
7077
  }
7140
7078
  }
7141
- const _n = new S("SideMenuPlugin");
7142
- class yn extends X {
7079
+ const Cn = new S("SideMenuPlugin");
7080
+ class Sn extends X {
7143
7081
  constructor(o) {
7144
7082
  super();
7145
7083
  c(this, "view");
@@ -7153,12 +7091,12 @@ class yn extends X {
7153
7091
  * Handles drag & drop events for blocks.
7154
7092
  */
7155
7093
  c(this, "blockDragStart", (o) => {
7156
- this.view.isDragging = !0, bn(o, this.editor);
7094
+ this.view.isDragging = !0, xn(o, this.editor);
7157
7095
  });
7158
7096
  /**
7159
7097
  * Handles drag & drop events for blocks.
7160
7098
  */
7161
- c(this, "blockDragEnd", () => yt(this.editor.prosemirrorView.root));
7099
+ c(this, "blockDragEnd", () => vt(this.editor.prosemirrorView.root));
7162
7100
  /**
7163
7101
  * Freezes the side menu. When frozen, the side menu will stay
7164
7102
  * attached to the same block regardless of which block is hovered by the
@@ -7174,8 +7112,8 @@ class yn extends X {
7174
7112
  this.view.menuFrozen = !1, this.view.state.show = !1, this.view.emitUpdate(this.view.state);
7175
7113
  });
7176
7114
  this.editor = o, this.plugin = new y({
7177
- key: _n,
7178
- view: (i) => (this.view = new kn(o, i, (n) => {
7115
+ key: Cn,
7116
+ view: (i) => (this.view = new En(o, i, (n) => {
7179
7117
  this.emit("update", n);
7180
7118
  }), this.view)
7181
7119
  });
@@ -7184,29 +7122,207 @@ class yn extends X {
7184
7122
  return this.on("update", o);
7185
7123
  }
7186
7124
  }
7125
+ const Mn = zt((e) => e.type.name === "blockContainer");
7126
+ class Tn {
7127
+ constructor(t, o) {
7128
+ c(this, "state");
7129
+ c(this, "emitUpdate");
7130
+ c(this, "rootEl");
7131
+ c(this, "pluginState");
7132
+ c(this, "handleScroll", () => {
7133
+ var t, o;
7134
+ if ((t = this.state) != null && t.show) {
7135
+ const i = (o = this.rootEl) == null ? void 0 : o.querySelector(
7136
+ `[data-decoration-id="${this.pluginState.decorationId}"]`
7137
+ );
7138
+ this.state.referencePos = i.getBoundingClientRect(), this.emitUpdate(this.pluginState.triggerCharacter);
7139
+ }
7140
+ });
7141
+ c(this, "closeMenu", () => {
7142
+ this.editor.dispatch(
7143
+ this.editor._tiptapEditor.view.state.tr.setMeta(
7144
+ F,
7145
+ null
7146
+ )
7147
+ );
7148
+ });
7149
+ c(this, "clearQuery", () => {
7150
+ this.pluginState !== void 0 && this.editor._tiptapEditor.chain().focus().deleteRange({
7151
+ from: this.pluginState.queryStartPos - (this.pluginState.fromUserInput ? this.pluginState.triggerCharacter.length : 0),
7152
+ to: this.editor._tiptapEditor.state.selection.from
7153
+ }).run();
7154
+ });
7155
+ this.editor = t, this.pluginState = void 0, this.emitUpdate = (i) => {
7156
+ if (!this.state)
7157
+ throw new Error("Attempting to update uninitialized suggestions menu");
7158
+ o(i, this.state);
7159
+ }, this.rootEl = this.editor._tiptapEditor.view.root, this.rootEl.addEventListener("scroll", this.handleScroll, !0);
7160
+ }
7161
+ update(t, o) {
7162
+ var d;
7163
+ const i = F.getState(o), n = F.getState(
7164
+ t.state
7165
+ ), r = i === void 0 && n !== void 0, a = i !== void 0 && n === void 0;
7166
+ if (!r && !(i !== void 0 && n !== void 0) && !a)
7167
+ return;
7168
+ if (this.pluginState = a ? i : n, a || !this.editor.isEditable) {
7169
+ this.state.show = !1, this.emitUpdate(this.pluginState.triggerCharacter);
7170
+ return;
7171
+ }
7172
+ const l = (d = this.rootEl) == null ? void 0 : d.querySelector(
7173
+ `[data-decoration-id="${this.pluginState.decorationId}"]`
7174
+ );
7175
+ this.editor.isEditable && (this.state = {
7176
+ show: !0,
7177
+ referencePos: l.getBoundingClientRect(),
7178
+ query: this.pluginState.query
7179
+ }, this.emitUpdate(this.pluginState.triggerCharacter));
7180
+ }
7181
+ destroy() {
7182
+ var t;
7183
+ (t = this.rootEl) == null || t.removeEventListener("scroll", this.handleScroll, !0);
7184
+ }
7185
+ }
7186
+ const F = new S("SuggestionMenuPlugin");
7187
+ class Bn extends X {
7188
+ constructor(o) {
7189
+ super();
7190
+ c(this, "view");
7191
+ c(this, "plugin");
7192
+ c(this, "triggerCharacters", []);
7193
+ c(this, "addTriggerCharacter", (o) => {
7194
+ this.triggerCharacters.push(o);
7195
+ });
7196
+ // TODO: Should this be called automatically when listeners are removed?
7197
+ c(this, "removeTriggerCharacter", (o) => {
7198
+ this.triggerCharacters = this.triggerCharacters.filter(
7199
+ (i) => i !== o
7200
+ );
7201
+ });
7202
+ c(this, "closeMenu", () => this.view.closeMenu());
7203
+ c(this, "clearQuery", () => this.view.clearQuery());
7204
+ const i = this.triggerCharacters;
7205
+ this.plugin = new y({
7206
+ key: F,
7207
+ view: () => (this.view = new Tn(
7208
+ o,
7209
+ (n, r) => {
7210
+ this.emit(`update ${n}`, r);
7211
+ }
7212
+ ), this.view),
7213
+ state: {
7214
+ // Initialize the plugin's internal state.
7215
+ init() {
7216
+ },
7217
+ // Apply changes to the plugin state from an editor transaction.
7218
+ apply(n, r, a, s) {
7219
+ if (n.getMeta("orderedListIndexing") !== void 0)
7220
+ return r;
7221
+ const l = n.getMeta(F);
7222
+ if (typeof l == "object" && l !== null && r === void 0)
7223
+ return {
7224
+ triggerCharacter: l.triggerCharacter,
7225
+ fromUserInput: l.fromUserInput !== !1,
7226
+ queryStartPos: s.selection.from,
7227
+ query: "",
7228
+ decorationId: `id_${Math.floor(Math.random() * 4294967295)}`
7229
+ };
7230
+ if (r === void 0)
7231
+ return r;
7232
+ if (
7233
+ // Highlighting text should hide the menu.
7234
+ s.selection.from !== s.selection.to || // Transactions with plugin metadata should hide the menu.
7235
+ l === null || // Certain mouse events should hide the menu.
7236
+ // TODO: Change to global mousedown listener.
7237
+ n.getMeta("focus") || n.getMeta("blur") || n.getMeta("pointer") || // Moving the caret before the character which triggered the menu should hide it.
7238
+ r.triggerCharacter !== void 0 && s.selection.from < r.queryStartPos
7239
+ )
7240
+ return;
7241
+ const d = { ...r };
7242
+ return d.query = s.doc.textBetween(
7243
+ r.queryStartPos,
7244
+ s.selection.from
7245
+ ), d;
7246
+ }
7247
+ },
7248
+ props: {
7249
+ handleTextInput(n, r, a, s) {
7250
+ const l = this.getState(n.state);
7251
+ return i.includes(s) && l === void 0 ? (n.dispatch(
7252
+ n.state.tr.insertText(s).scrollIntoView().setMeta(F, {
7253
+ triggerCharacter: s
7254
+ })
7255
+ ), !0) : !1;
7256
+ },
7257
+ // Setup decorator on the currently active suggestion.
7258
+ decorations(n) {
7259
+ const r = this.getState(n);
7260
+ if (r === void 0)
7261
+ return null;
7262
+ if (!r.fromUserInput) {
7263
+ const a = Mn(n.selection);
7264
+ if (a)
7265
+ return G.create(n.doc, [
7266
+ K.node(
7267
+ a.pos,
7268
+ a.pos + a.node.nodeSize,
7269
+ {
7270
+ nodeName: "span",
7271
+ class: "bn-suggestion-decorator",
7272
+ "data-decoration-id": r.decorationId
7273
+ }
7274
+ )
7275
+ ]);
7276
+ }
7277
+ return G.create(n.doc, [
7278
+ K.inline(
7279
+ r.queryStartPos - r.triggerCharacter.length,
7280
+ r.queryStartPos,
7281
+ {
7282
+ nodeName: "span",
7283
+ class: "bn-suggestion-decorator",
7284
+ "data-decoration-id": r.decorationId
7285
+ }
7286
+ )
7287
+ ]);
7288
+ }
7289
+ }
7290
+ });
7291
+ }
7292
+ onUpdate(o, i) {
7293
+ return this.triggerCharacters.includes(o) || this.addTriggerCharacter(o), this.on(`update ${o}`, i);
7294
+ }
7295
+ get shown() {
7296
+ var o, i;
7297
+ return ((i = (o = this.view) == null ? void 0 : o.state) == null ? void 0 : i.show) || !1;
7298
+ }
7299
+ }
7300
+ function ea(e, t) {
7301
+ e.suggestionMenus.addTriggerCharacter(t);
7302
+ }
7187
7303
  let w;
7188
7304
  function We(e) {
7189
7305
  w || (w = document.createElement("div"), w.innerHTML = "_", w.style.opacity = "0", w.style.height = "1px", w.style.width = "1px", e instanceof Document ? e.body.appendChild(w) : e.appendChild(w));
7190
7306
  }
7191
- function wn(e) {
7307
+ function Ln(e) {
7192
7308
  w && (e instanceof Document ? e.body.removeChild(w) : e.removeChild(w), w = void 0);
7193
7309
  }
7194
7310
  function ie(e) {
7195
7311
  return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
7196
7312
  }
7197
- function vn(e) {
7313
+ function In(e) {
7198
7314
  for (; e && e.nodeName !== "TD" && e.nodeName !== "TH"; )
7199
7315
  e = e.classList && e.classList.contains("ProseMirror") ? null : e.parentNode;
7200
7316
  return e;
7201
7317
  }
7202
- function xn(e, t) {
7318
+ function An(e, t) {
7203
7319
  e.forEach((o) => {
7204
7320
  const i = t.querySelectorAll(o);
7205
7321
  for (let n = 0; n < i.length; n++)
7206
7322
  i[n].style.visibility = "hidden";
7207
7323
  });
7208
7324
  }
7209
- class En {
7325
+ class Nn {
7210
7326
  constructor(t, o, i) {
7211
7327
  c(this, "state");
7212
7328
  c(this, "emitUpdate");
@@ -7218,7 +7334,7 @@ class En {
7218
7334
  var d;
7219
7335
  if (this.menuFrozen)
7220
7336
  return;
7221
- const o = vn(t.target);
7337
+ const o = In(t.target);
7222
7338
  if (!o || !this.editor.isEditable) {
7223
7339
  (d = this.state) != null && d.show && (this.state.show = !1, this.emitUpdate());
7224
7340
  return;
@@ -7239,7 +7355,7 @@ class En {
7239
7355
  this.editor.schema.styleSchema,
7240
7356
  this.editor.blockCache
7241
7357
  );
7242
- return Oi("table", h, this.editor) && (this.tablePos = p + 1, l = h), !1;
7358
+ return Xi("table", h, this.editor) && (this.tablePos = p + 1, l = h), !1;
7243
7359
  }), !!l && (this.tableId = s.id, !(this.state !== void 0 && this.state.show && this.tableId === s.id && this.state.rowIndex === n && this.state.colIndex === i)))
7244
7360
  return this.state = {
7245
7361
  show: !0,
@@ -7255,7 +7371,7 @@ class En {
7255
7371
  var h;
7256
7372
  if (((h = this.state) == null ? void 0 : h.draggingState) === void 0)
7257
7373
  return;
7258
- t.preventDefault(), t.dataTransfer.dropEffect = "move", xn(
7374
+ t.preventDefault(), t.dataTransfer.dropEffect = "move", An(
7259
7375
  [
7260
7376
  "column-resize-handle",
7261
7377
  "prosemirror-dropcursor-block",
@@ -7284,7 +7400,7 @@ class En {
7284
7400
  const a = ie(n.parentElement), s = ie(n), l = this.state.draggingState.draggedCellOrientation === "row" ? this.state.rowIndex : this.state.colIndex, u = (this.state.draggingState.draggedCellOrientation === "row" ? a : s) !== l;
7285
7401
  (this.state.rowIndex !== a || this.state.colIndex !== s) && (this.state.rowIndex = a, this.state.colIndex = s, this.state.referencePosCell = n.getBoundingClientRect(), r = !0);
7286
7402
  const p = this.state.draggingState.draggedCellOrientation === "row" ? o.top : o.left;
7287
- this.state.draggingState.mousePos !== p && (this.state.draggingState.mousePos = p, r = !0), r && this.emitUpdate(), u && this.pmView.dispatch(
7403
+ this.state.draggingState.mousePos !== p && (this.state.draggingState.mousePos = p, r = !0), r && this.emitUpdate(), u && this.editor.dispatch(
7288
7404
  this.pmView.state.tr.setMeta(Q, !0)
7289
7405
  );
7290
7406
  });
@@ -7343,7 +7459,7 @@ class En {
7343
7459
  }
7344
7460
  }
7345
7461
  const Q = new S("TableHandlesPlugin");
7346
- class Cn extends X {
7462
+ class Pn extends X {
7347
7463
  constructor(o) {
7348
7464
  super();
7349
7465
  c(this, "view");
@@ -7361,7 +7477,7 @@ class Cn extends X {
7361
7477
  draggedCellOrientation: "col",
7362
7478
  originalIndex: this.view.state.colIndex,
7363
7479
  mousePos: o.clientX
7364
- }, this.view.emitUpdate(), this.editor._tiptapEditor.view.dispatch(
7480
+ }, this.view.emitUpdate(), this.editor.dispatch(
7365
7481
  this.editor._tiptapEditor.state.tr.setMeta(Q, {
7366
7482
  draggedCellOrientation: this.view.state.draggingState.draggedCellOrientation,
7367
7483
  originalIndex: this.view.state.colIndex,
@@ -7383,7 +7499,7 @@ class Cn extends X {
7383
7499
  draggedCellOrientation: "row",
7384
7500
  originalIndex: this.view.state.rowIndex,
7385
7501
  mousePos: o.clientY
7386
- }, this.view.emitUpdate(), this.editor._tiptapEditor.view.dispatch(
7502
+ }, this.view.emitUpdate(), this.editor.dispatch(
7387
7503
  this.editor._tiptapEditor.state.tr.setMeta(Q, {
7388
7504
  draggedCellOrientation: this.view.state.draggingState.draggedCellOrientation,
7389
7505
  originalIndex: this.view.state.rowIndex,
@@ -7401,9 +7517,9 @@ class Cn extends X {
7401
7517
  throw new Error(
7402
7518
  "Attempted to drag table row, but no table block was hovered prior."
7403
7519
  );
7404
- this.view.state.draggingState = void 0, this.view.emitUpdate(), this.editor._tiptapEditor.view.dispatch(
7520
+ this.view.state.draggingState = void 0, this.view.emitUpdate(), this.editor.dispatch(
7405
7521
  this.editor._tiptapEditor.state.tr.setMeta(Q, null)
7406
- ), wn(this.editor._tiptapEditor.view.root);
7522
+ ), Ln(this.editor._tiptapEditor.view.root);
7407
7523
  });
7408
7524
  /**
7409
7525
  * Freezes the drag handles. When frozen, they will stay attached to the same
@@ -7421,7 +7537,7 @@ class Cn extends X {
7421
7537
  });
7422
7538
  this.editor = o, this.plugin = new y({
7423
7539
  key: Q,
7424
- view: (i) => (this.view = new En(o, i, (n) => {
7540
+ view: (i) => (this.view = new Nn(o, i, (n) => {
7425
7541
  this.emit("update", n);
7426
7542
  }), this.view),
7427
7543
  // We use decorations to render the drop cursor when dragging a table row
@@ -7444,7 +7560,7 @@ class Cn extends X {
7444
7560
  ), h = p.node(), f = p.pos + (n > this.view.state.draggingState.originalIndex ? h.nodeSize - 2 : 0);
7445
7561
  r.push(
7446
7562
  // The widget is a small bar which spans the width of the cell.
7447
- W.widget(f, () => {
7563
+ K.widget(f, () => {
7448
7564
  const m = document.createElement("div");
7449
7565
  return m.className = "bn-table-drop-cursor", m.style.left = "0", m.style.right = "0", n > this.view.state.draggingState.originalIndex ? m.style.bottom = "-2px" : m.style.top = "-3px", m.style.height = "4px", m;
7450
7566
  })
@@ -7459,7 +7575,7 @@ class Cn extends X {
7459
7575
  ), p = u.node(), h = u.pos + (n > this.view.state.draggingState.originalIndex ? p.nodeSize - 2 : 0);
7460
7576
  r.push(
7461
7577
  // The widget is a small bar which spans the height of the cell.
7462
- W.widget(h, () => {
7578
+ K.widget(h, () => {
7463
7579
  const f = document.createElement("div");
7464
7580
  return f.className = "bn-table-drop-cursor", f.style.top = "0", f.style.bottom = "0", n > this.view.state.draggingState.originalIndex ? f.style.right = "-2px" : f.style.left = "-3px", f.style.width = "4px", f;
7465
7581
  })
@@ -7474,17 +7590,23 @@ class Cn extends X {
7474
7590
  return this.on("update", o);
7475
7591
  }
7476
7592
  }
7477
- function Ke(e, t) {
7478
- const o = e.state.selection.content().content, n = rt(
7593
+ function $e(e, t) {
7594
+ const o = e.state.selection.content().content, n = Ce(
7479
7595
  e.state.schema,
7480
7596
  t
7481
- ).serializeProseMirrorFragment(o), a = ae(
7597
+ ).serializeProseMirrorFragment(
7598
+ o,
7599
+ {}
7600
+ ), a = ae(
7482
7601
  e.state.schema,
7483
7602
  t
7484
- ).exportProseMirrorFragment(o), s = Te(a);
7603
+ ).exportProseMirrorFragment(
7604
+ o,
7605
+ {}
7606
+ ), s = Be(a);
7485
7607
  return { internalHTML: n, externalHTML: a, plainText: s };
7486
7608
  }
7487
- const Sn = (e) => M.create({
7609
+ const Hn = (e) => M.create({
7488
7610
  name: "copyToClipboard",
7489
7611
  addProseMirrorPlugins() {
7490
7612
  return [
@@ -7492,14 +7614,14 @@ const Sn = (e) => M.create({
7492
7614
  props: {
7493
7615
  handleDOMEvents: {
7494
7616
  copy(t, o) {
7495
- o.preventDefault(), o.clipboardData.clearData(), "node" in t.state.selection && t.state.selection.node.type.spec.group === "blockContent" && t.dispatch(
7496
- t.state.tr.setSelection(
7617
+ o.preventDefault(), o.clipboardData.clearData(), "node" in t.state.selection && t.state.selection.node.type.spec.group === "blockContent" && e.dispatch(
7618
+ e._tiptapEditor.state.tr.setSelection(
7497
7619
  new ne(
7498
7620
  t.state.doc.resolve(t.state.selection.from - 1)
7499
7621
  )
7500
7622
  )
7501
7623
  );
7502
- const { internalHTML: i, externalHTML: n, plainText: r } = Ke(t, e);
7624
+ const { internalHTML: i, externalHTML: n, plainText: r } = $e(t, e);
7503
7625
  return o.clipboardData.setData("blocknote/html", i), o.clipboardData.setData("text/html", n), o.clipboardData.setData("text/plain", r), !0;
7504
7626
  },
7505
7627
  // This is for the use-case in which only a block without content
@@ -7508,14 +7630,14 @@ const Sn = (e) => M.create({
7508
7630
  dragstart(t, o) {
7509
7631
  if (!("node" in t.state.selection) || t.state.selection.node.type.spec.group !== "blockContent")
7510
7632
  return;
7511
- t.dispatch(
7512
- t.state.tr.setSelection(
7633
+ e.dispatch(
7634
+ e._tiptapEditor.state.tr.setSelection(
7513
7635
  new ne(
7514
7636
  t.state.doc.resolve(t.state.selection.from - 1)
7515
7637
  )
7516
7638
  )
7517
7639
  ), o.preventDefault(), o.dataTransfer.clearData();
7518
- const { internalHTML: i, externalHTML: n, plainText: r } = Ke(t, e);
7640
+ const { internalHTML: i, externalHTML: n, plainText: r } = $e(t, e);
7519
7641
  return o.dataTransfer.setData("blocknote/html", i), o.dataTransfer.setData("text/html", n), o.dataTransfer.setData("text/plain", r), !0;
7520
7642
  }
7521
7643
  }
@@ -7524,7 +7646,7 @@ const Sn = (e) => M.create({
7524
7646
  ];
7525
7647
  }
7526
7648
  });
7527
- function Mn(e) {
7649
+ function Un(e) {
7528
7650
  let t = e.getTextCursorPosition().block, o = e.schema.blockSchema[t.type].content;
7529
7651
  for (; o === "none"; )
7530
7652
  t = e.getTextCursorPosition().nextBlock, o = e.schema.blockSchema[t.type].content, e.setTextCursorPosition(t, "end");
@@ -7538,9 +7660,9 @@ function x(e, t) {
7538
7660
  "end"
7539
7661
  ));
7540
7662
  const i = e.getTextCursorPosition().block;
7541
- return Mn(e), i;
7663
+ return Un(e), i;
7542
7664
  }
7543
- function Kr(e) {
7665
+ function ta(e) {
7544
7666
  const t = [];
7545
7667
  return E("heading", e) && t.push(
7546
7668
  {
@@ -7637,7 +7759,7 @@ function Kr(e) {
7637
7759
  const o = x(e, {
7638
7760
  type: "image"
7639
7761
  });
7640
- e.prosemirrorView.dispatch(
7762
+ e.dispatch(
7641
7763
  e._tiptapEditor.state.tr.setMeta(e.filePanel.plugin, {
7642
7764
  block: o
7643
7765
  })
@@ -7650,7 +7772,7 @@ function Kr(e) {
7650
7772
  const o = x(e, {
7651
7773
  type: "video"
7652
7774
  });
7653
- e.prosemirrorView.dispatch(
7775
+ e.dispatch(
7654
7776
  e._tiptapEditor.state.tr.setMeta(e.filePanel.plugin, {
7655
7777
  block: o
7656
7778
  })
@@ -7663,7 +7785,7 @@ function Kr(e) {
7663
7785
  const o = x(e, {
7664
7786
  type: "audio"
7665
7787
  });
7666
- e.prosemirrorView.dispatch(
7788
+ e.dispatch(
7667
7789
  e._tiptapEditor.state.tr.setMeta(e.filePanel.plugin, {
7668
7790
  block: o
7669
7791
  })
@@ -7676,7 +7798,7 @@ function Kr(e) {
7676
7798
  const o = x(e, {
7677
7799
  type: "file"
7678
7800
  });
7679
- e.prosemirrorView.dispatch(
7801
+ e.dispatch(
7680
7802
  e._tiptapEditor.state.tr.setMeta(e.filePanel.plugin, {
7681
7803
  block: o
7682
7804
  })
@@ -7684,22 +7806,26 @@ function Kr(e) {
7684
7806
  },
7685
7807
  key: "image",
7686
7808
  ...e.dictionary.slash_menu.file
7809
+ }), t.push({
7810
+ onItemClick: () => e.openSelectionMenu(":"),
7811
+ key: "emoji",
7812
+ ...e.dictionary.slash_menu.emoji
7687
7813
  }), t;
7688
7814
  }
7689
- function $r(e, t) {
7815
+ function oa(e, t) {
7690
7816
  return e.filter(
7691
7817
  ({ title: o, aliases: i }) => o.toLowerCase().includes(t.toLowerCase()) || i && i.filter(
7692
7818
  (n) => n.toLowerCase().includes(t.toLowerCase())
7693
7819
  ).length !== 0
7694
7820
  );
7695
7821
  }
7696
- const Be = [
7822
+ const Le = [
7697
7823
  "blocknote/html",
7698
7824
  "Files",
7699
7825
  "text/html",
7700
7826
  "text/plain"
7701
7827
  ];
7702
- function Tn(e, t) {
7828
+ function Dn(e, t) {
7703
7829
  const o = e.split("/"), i = t.split("/");
7704
7830
  if (o.length !== 2)
7705
7831
  throw new Error(`The string ${e} is not a valid MIME type.`);
@@ -7707,14 +7833,14 @@ function Tn(e, t) {
7707
7833
  throw new Error(`The string ${t} is not a valid MIME type.`);
7708
7834
  return o[1] === "*" || i[1] === "*" ? o[0] === i[0] : (o[0] === "*" || i[0] === "*" || o[0] === i[0]) && o[1] === i[1];
7709
7835
  }
7710
- async function wt(e, t) {
7836
+ async function xt(e, t) {
7711
7837
  if (!t.uploadFile)
7712
7838
  return;
7713
7839
  const o = "dataTransfer" in e ? e.dataTransfer : e.clipboardData;
7714
7840
  if (o === null)
7715
7841
  return;
7716
7842
  let i = null;
7717
- for (const a of Be)
7843
+ for (const a of Le)
7718
7844
  if (o.types.includes(a)) {
7719
7845
  i = a;
7720
7846
  break;
@@ -7732,7 +7858,7 @@ async function wt(e, t) {
7732
7858
  let s = "file";
7733
7859
  for (const d of r)
7734
7860
  for (const u of d.fileBlockAcceptMimeTypes || [])
7735
- if (Tn(n[a].type, u)) {
7861
+ if (Dn(n[a].type, u)) {
7736
7862
  s = d.type;
7737
7863
  break;
7738
7864
  }
@@ -7752,7 +7878,7 @@ async function wt(e, t) {
7752
7878
  }
7753
7879
  }
7754
7880
  }
7755
- const Bn = (e) => M.create({
7881
+ const jn = (e) => M.create({
7756
7882
  name: "pasteFromClipboard",
7757
7883
  addProseMirrorPlugins() {
7758
7884
  return [
@@ -7763,7 +7889,7 @@ const Bn = (e) => M.create({
7763
7889
  if (o.preventDefault(), !e.isEditable)
7764
7890
  return;
7765
7891
  let i = null;
7766
- for (const r of Be)
7892
+ for (const r of Le)
7767
7893
  if (o.clipboardData.types.includes(r)) {
7768
7894
  i = r;
7769
7895
  break;
@@ -7771,16 +7897,16 @@ const Bn = (e) => M.create({
7771
7897
  if (i === null)
7772
7898
  return !0;
7773
7899
  if (i === "Files")
7774
- return wt(o, e), !0;
7900
+ return xt(o, e), !0;
7775
7901
  let n = o.clipboardData.getData(i);
7776
- return i === "text/html" && (n = kt(n.trim()).innerHTML), e._tiptapEditor.view.pasteHTML(n), !0;
7902
+ return i === "text/html" && (n = yt(n.trim()).innerHTML), e._tiptapEditor.view.pasteHTML(n), !0;
7777
7903
  }
7778
7904
  }
7779
7905
  }
7780
7906
  })
7781
7907
  ];
7782
7908
  }
7783
- }), Ln = (e) => M.create({
7909
+ }), Rn = (e) => M.create({
7784
7910
  name: "dropFile",
7785
7911
  addProseMirrorPlugins() {
7786
7912
  return [
@@ -7791,19 +7917,19 @@ const Bn = (e) => M.create({
7791
7917
  if (!e.isEditable)
7792
7918
  return;
7793
7919
  let i = null;
7794
- for (const n of Be)
7920
+ for (const n of Le)
7795
7921
  if (o.dataTransfer.types.includes(n)) {
7796
7922
  i = n;
7797
7923
  break;
7798
7924
  }
7799
- return i === null ? !0 : i === "Files" ? (wt(o, e), !0) : !1;
7925
+ return i === null ? !0 : i === "Files" ? (xt(o, e), !0) : !1;
7800
7926
  }
7801
7927
  }
7802
7928
  }
7803
7929
  })
7804
7930
  ];
7805
7931
  }
7806
- }), In = M.create({
7932
+ }), Vn = M.create({
7807
7933
  name: "blockBackgroundColor",
7808
7934
  addGlobalAttributes() {
7809
7935
  return [
@@ -7813,7 +7939,7 @@ const Bn = (e) => M.create({
7813
7939
  backgroundColor: {
7814
7940
  default: _.backgroundColor.default,
7815
7941
  parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : _.backgroundColor.default,
7816
- renderHTML: (e) => e.backgroundColor !== _.backgroundColor.default && {
7942
+ renderHTML: (e) => e.backgroundColor === _.backgroundColor.default ? {} : {
7817
7943
  "data-background-color": e.backgroundColor
7818
7944
  }
7819
7945
  }
@@ -7821,7 +7947,7 @@ const Bn = (e) => M.create({
7821
7947
  }
7822
7948
  ];
7823
7949
  }
7824
- }), An = M.create({
7950
+ }), On = M.create({
7825
7951
  name: "textAlignment",
7826
7952
  addGlobalAttributes() {
7827
7953
  return [
@@ -7839,7 +7965,7 @@ const Bn = (e) => M.create({
7839
7965
  textAlignment: {
7840
7966
  default: "left",
7841
7967
  parseHTML: (e) => e.getAttribute("data-text-alignment"),
7842
- renderHTML: (e) => e.textAlignment !== "left" && {
7968
+ renderHTML: (e) => e.textAlignment === "left" ? {} : {
7843
7969
  "data-text-alignment": e.textAlignment
7844
7970
  }
7845
7971
  }
@@ -7847,7 +7973,7 @@ const Bn = (e) => M.create({
7847
7973
  }
7848
7974
  ];
7849
7975
  }
7850
- }), Nn = M.create({
7976
+ }), zn = M.create({
7851
7977
  name: "blockTextColor",
7852
7978
  addGlobalAttributes() {
7853
7979
  return [
@@ -7857,7 +7983,7 @@ const Bn = (e) => M.create({
7857
7983
  textColor: {
7858
7984
  default: _.textColor.default,
7859
7985
  parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : _.textColor.default,
7860
- renderHTML: (e) => e.textColor !== _.textColor.default && {
7986
+ renderHTML: (e) => e.textColor === _.textColor.default ? {} : {
7861
7987
  "data-text-color": e.textColor
7862
7988
  }
7863
7989
  }
@@ -7865,7 +7991,7 @@ const Bn = (e) => M.create({
7865
7991
  }
7866
7992
  ];
7867
7993
  }
7868
- }), Pn = M.create({
7994
+ }), Fn = M.create({
7869
7995
  name: "trailingNode",
7870
7996
  addProseMirrorPlugins() {
7871
7997
  const e = new S(this.name);
@@ -7900,8 +8026,8 @@ const Bn = (e) => M.create({
7900
8026
  })
7901
8027
  ];
7902
8028
  }
7903
- }), Hn = new S("non-editable-block"), Un = () => new y({
7904
- key: Hn,
8029
+ }), Gn = new S("non-editable-block"), Kn = () => new y({
8030
+ key: Gn,
7905
8031
  props: {
7906
8032
  handleKeyDown: (e, t) => {
7907
8033
  if ("node" in e.state.selection) {
@@ -7926,7 +8052,7 @@ const Bn = (e) => M.create({
7926
8052
  return !1;
7927
8053
  }
7928
8054
  }
7929
- }), $e = new S("previous-blocks"), Dn = {
8055
+ }), qe = new S("previous-blocks"), Wn = {
7930
8056
  // Numbered List Items
7931
8057
  index: "index",
7932
8058
  // Headings
@@ -7935,17 +8061,17 @@ const Bn = (e) => M.create({
7935
8061
  type: "type",
7936
8062
  depth: "depth",
7937
8063
  "depth-change": "depth-change"
7938
- }, Vn = () => {
8064
+ }, $n = () => {
7939
8065
  let e;
7940
8066
  return new y({
7941
- key: $e,
8067
+ key: qe,
7942
8068
  view(t) {
7943
8069
  return {
7944
8070
  update: async (o, i) => {
7945
8071
  var n;
7946
8072
  ((n = this.key) == null ? void 0 : n.getState(o.state).updatedBlocks.size) > 0 && (e = setTimeout(() => {
7947
8073
  o.dispatch(
7948
- o.state.tr.setMeta($e, { clearUpdate: !0 })
8074
+ o.state.tr.setMeta(qe, { clearUpdate: !0 })
7949
8075
  );
7950
8076
  }, 0));
7951
8077
  },
@@ -7968,9 +8094,9 @@ const Bn = (e) => M.create({
7968
8094
  apply(t, o, i, n) {
7969
8095
  if (o.currentTransactionOldBlockAttrs = {}, o.updatedBlocks.clear(), !t.docChanged || i.doc.eq(n.doc))
7970
8096
  return o;
7971
- const r = {}, a = He(i.doc, (d) => d.attrs.id), s = new Map(
8097
+ const r = {}, a = Ue(i.doc, (d) => d.attrs.id), s = new Map(
7972
8098
  a.map((d) => [d.node.attrs.id, d])
7973
- ), l = He(n.doc, (d) => d.attrs.id);
8099
+ ), l = Ue(n.doc, (d) => d.attrs.id);
7974
8100
  for (const d of l) {
7975
8101
  const u = s.get(d.node.attrs.id), p = u == null ? void 0 : u.node.firstChild, h = d.node.firstChild;
7976
8102
  if (u && p && h) {
@@ -8003,8 +8129,8 @@ const Bn = (e) => M.create({
8003
8129
  return;
8004
8130
  const a = o.currentTransactionOldBlockAttrs[n.attrs.id], s = {};
8005
8131
  for (const [d, u] of Object.entries(a))
8006
- s["data-prev-" + Dn[d]] = u || "none";
8007
- const l = W.node(r, r + n.nodeSize, {
8132
+ s["data-prev-" + Wn[d]] = u || "none";
8133
+ const l = K.node(r, r + n.nodeSize, {
8008
8134
  ...s
8009
8135
  });
8010
8136
  i.push(l);
@@ -8012,13 +8138,13 @@ const Bn = (e) => M.create({
8012
8138
  }
8013
8139
  }
8014
8140
  });
8015
- }, Rn = {
8141
+ }, qn = {
8016
8142
  blockColor: "data-block-color",
8017
8143
  blockStyle: "data-block-style",
8018
8144
  id: "data-id",
8019
8145
  depth: "data-depth",
8020
8146
  depthChange: "data-depth-change"
8021
- }, On = $.create({
8147
+ }, Xn = $.create({
8022
8148
  name: "blockContainer",
8023
8149
  group: "blockContainer",
8024
8150
  // A block always contains content, and optionally a blockGroup which contains nested blocks
@@ -8034,7 +8160,7 @@ const Bn = (e) => M.create({
8034
8160
  if (typeof e == "string")
8035
8161
  return !1;
8036
8162
  const t = {};
8037
- for (const [o, i] of Object.entries(Rn))
8163
+ for (const [o, i] of Object.entries(qn))
8038
8164
  e.getAttribute(i) && (t[o] = e.getAttribute(i));
8039
8165
  return e.getAttribute("data-node-type") === "blockContainer" ? t : !1;
8040
8166
  }
@@ -8051,7 +8177,7 @@ const Bn = (e) => M.create({
8051
8177
  ...((n = this.options.domAttributes) == null ? void 0 : n.block) || {},
8052
8178
  ...e
8053
8179
  }, i = document.createElement("div");
8054
- i.className = R("bn-block", o.class), i.setAttribute("data-node-type", this.name);
8180
+ i.className = j("bn-block", o.class), i.setAttribute("data-node-type", this.name);
8055
8181
  for (const [r, a] of Object.entries(o))
8056
8182
  r !== "class" && i.setAttribute(r, a);
8057
8183
  return t.appendChild(i), {
@@ -8104,19 +8230,19 @@ const Bn = (e) => M.create({
8104
8230
  let p = "keep";
8105
8231
  if (t.content)
8106
8232
  if (typeof t.content == "string")
8107
- p = K(
8233
+ p = W(
8108
8234
  [t.content],
8109
8235
  o.schema,
8110
8236
  this.options.editor.schema.styleSchema
8111
8237
  );
8112
8238
  else if (Array.isArray(t.content))
8113
- p = K(
8239
+ p = W(
8114
8240
  t.content,
8115
8241
  o.schema,
8116
8242
  this.options.editor.schema.styleSchema
8117
8243
  );
8118
8244
  else if (t.content.type === "tableContent")
8119
- p = et(
8245
+ p = it(
8120
8246
  t.content,
8121
8247
  o.schema,
8122
8248
  this.options.editor.schema.styleSchema
@@ -8242,7 +8368,7 @@ const Bn = (e) => M.create({
8242
8368
  };
8243
8369
  },
8244
8370
  addProseMirrorPlugins() {
8245
- return [Vn(), Un()];
8371
+ return [$n(), Kn()];
8246
8372
  },
8247
8373
  addKeyboardShortcuts() {
8248
8374
  return {
@@ -8349,7 +8475,7 @@ const Bn = (e) => M.create({
8349
8475
  }
8350
8476
  };
8351
8477
  }
8352
- }), jn = $.create({
8478
+ }), Zn = $.create({
8353
8479
  name: "blockGroup",
8354
8480
  group: "blockGroup",
8355
8481
  content: "blockContainer+",
@@ -8367,7 +8493,7 @@ const Bn = (e) => M.create({
8367
8493
  ...((i = this.options.domAttributes) == null ? void 0 : i.blockGroup) || {},
8368
8494
  ...e
8369
8495
  }, o = document.createElement("div");
8370
- o.className = R(
8496
+ o.className = j(
8371
8497
  "bn-block-group",
8372
8498
  t.class
8373
8499
  ), o.setAttribute("data-node-type", "blockGroup");
@@ -8378,11 +8504,11 @@ const Bn = (e) => M.create({
8378
8504
  contentDOM: o
8379
8505
  };
8380
8506
  }
8381
- }), zn = $.create({
8507
+ }), Jn = $.create({
8382
8508
  name: "doc",
8383
8509
  topNode: !0,
8384
8510
  content: "blockGroup"
8385
- }), Fn = (e) => {
8511
+ }), Yn = (e) => {
8386
8512
  var i;
8387
8513
  const t = [
8388
8514
  J.ClipboardTextSerializer,
@@ -8391,17 +8517,17 @@ const Bn = (e) => M.create({
8391
8517
  J.FocusEvents,
8392
8518
  J.Tabindex,
8393
8519
  // DevTools,
8394
- co,
8520
+ mo,
8395
8521
  // DropCursor,
8396
8522
  oe.configure({
8397
8523
  types: ["blockContainer"]
8398
8524
  }),
8399
- uo.extend({ priority: 10 }),
8525
+ fo.extend({ priority: 10 }),
8400
8526
  // Comments,
8401
8527
  // basics:
8402
- mo,
8528
+ ko,
8403
8529
  // marks:
8404
- ho.extend({
8530
+ bo.extend({
8405
8531
  addKeyboardShortcuts() {
8406
8532
  return {
8407
8533
  "Mod-k": () => (this.editor.commands.toggleLink({ href: "" }), !0)
@@ -8409,9 +8535,9 @@ const Bn = (e) => M.create({
8409
8535
  }
8410
8536
  }),
8411
8537
  ...Object.values(e.styleSpecs).map((n) => n.implementation.mark),
8412
- Nn,
8413
- In,
8414
- An,
8538
+ zn,
8539
+ Vn,
8540
+ On,
8415
8541
  // make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)
8416
8542
  M.create({
8417
8543
  name: "OverrideEscape",
@@ -8422,12 +8548,12 @@ const Bn = (e) => M.create({
8422
8548
  }
8423
8549
  }),
8424
8550
  // nodes
8425
- zn,
8426
- On.configure({
8551
+ Jn,
8552
+ Xn.configure({
8427
8553
  editor: e.editor,
8428
8554
  domAttributes: e.domAttributes
8429
8555
  }),
8430
- jn.configure({
8556
+ Zn.configure({
8431
8557
  domAttributes: e.domAttributes
8432
8558
  }),
8433
8559
  ...Object.values(e.inlineContentSpecs).filter((n) => n.config !== "link" && n.config !== "text").map((n) => n.implementation.node.configure({
@@ -8447,17 +8573,17 @@ const Bn = (e) => M.create({
8447
8573
  domAttributes: e.domAttributes
8448
8574
  })
8449
8575
  ]),
8450
- Sn(e.editor),
8451
- Bn(e.editor),
8452
- Ln(e.editor),
8453
- lo.configure({ width: 5, color: "#ddeeff" }),
8576
+ Hn(e.editor),
8577
+ jn(e.editor),
8578
+ Rn(e.editor),
8579
+ ho.configure({ width: 5, color: "#ddeeff" }),
8454
8580
  // This needs to be at the bottom of this list, because Key events (such as enter, when selecting a /command),
8455
8581
  // should be handled before Enter handlers in other components like splitListItem
8456
- ...e.trailingBlock === void 0 || e.trailingBlock ? [Pn] : []
8582
+ ...e.trailingBlock === void 0 || e.trailingBlock ? [Fn] : []
8457
8583
  ];
8458
8584
  if (e.collaboration) {
8459
8585
  if (t.push(
8460
- ao.configure({
8586
+ uo.configure({
8461
8587
  fragment: e.collaboration.fragment
8462
8588
  })
8463
8589
  ), (i = e.collaboration.provider) != null && i.awareness) {
@@ -8470,7 +8596,7 @@ const Bn = (e) => M.create({
8470
8596
  return a.insertBefore(l, null), a.insertBefore(s, null), a.insertBefore(d, null), a;
8471
8597
  };
8472
8598
  t.push(
8473
- so.configure({
8599
+ po.configure({
8474
8600
  user: e.collaboration.user,
8475
8601
  render: e.collaboration.renderCursor || n,
8476
8602
  provider: e.collaboration.provider
@@ -8478,24 +8604,24 @@ const Bn = (e) => M.create({
8478
8604
  );
8479
8605
  }
8480
8606
  } else
8481
- t.push(po);
8607
+ t.push(go);
8482
8608
  const o = e.disableExtensions || [];
8483
8609
  return t.filter((n) => !o.includes(n.name));
8484
8610
  };
8485
- function Gn(e, t) {
8611
+ function Qn(e, t) {
8486
8612
  const o = [];
8487
8613
  return e.forEach((i, n, r) => {
8488
8614
  r !== t && o.push(i);
8489
8615
  }), L.from(o);
8490
8616
  }
8491
- function Wn(e, t) {
8617
+ function er(e, t) {
8492
8618
  let o = L.from(e.content);
8493
8619
  for (let i = 0; i < o.childCount; i++)
8494
8620
  if (o.child(i).type.spec.group === "blockContent") {
8495
8621
  const n = [o.child(i)];
8496
8622
  if (i + 1 < o.childCount && o.child(i + 1).type.spec.group === "blockGroup") {
8497
8623
  const a = o.child(i + 1).child(0).child(0);
8498
- (a.type.name === "bulletListItem" || a.type.name === "numberedListItem" || a.type.name === "checkListItem") && (n.push(o.child(i + 1)), o = Gn(o, i + 1));
8624
+ (a.type.name === "bulletListItem" || a.type.name === "numberedListItem" || a.type.name === "checkListItem") && (n.push(o.child(i + 1)), o = Qn(o, i + 1));
8499
8625
  }
8500
8626
  const r = t.state.schema.nodes.blockContainer.create(
8501
8627
  void 0,
@@ -8510,7 +8636,7 @@ function ge(e) {
8510
8636
  Object.entries(e).filter(([, t]) => t !== void 0)
8511
8637
  );
8512
8638
  }
8513
- class Le {
8639
+ class Ie {
8514
8640
  constructor(t) {
8515
8641
  c(this, "blockSpecs");
8516
8642
  c(this, "inlineContentSpecs");
@@ -8522,15 +8648,15 @@ class Le {
8522
8648
  c(this, "BlockNoteEditor", "only for types");
8523
8649
  c(this, "Block", "only for types");
8524
8650
  c(this, "PartialBlock", "only for types");
8525
- this.blockSpecs = ge(t == null ? void 0 : t.blockSpecs) || mt, this.inlineContentSpecs = ge(t == null ? void 0 : t.inlineContentSpecs) || gt, this.styleSpecs = ge(t == null ? void 0 : t.styleSpecs) || ft, this.blockSchema = dt(this.blockSpecs), this.inlineContentSchema = ct(
8651
+ this.blockSpecs = ge(t == null ? void 0 : t.blockSpecs) || gt, this.inlineContentSpecs = ge(t == null ? void 0 : t.inlineContentSpecs) || kt, this.styleSpecs = ge(t == null ? void 0 : t.styleSpecs) || bt, this.blockSchema = ut(this.blockSpecs), this.inlineContentSchema = pt(
8526
8652
  this.inlineContentSpecs
8527
- ), this.styleSchema = pt(this.styleSpecs);
8653
+ ), this.styleSchema = mt(this.styleSpecs);
8528
8654
  }
8529
8655
  static create(t) {
8530
- return new Le(t);
8656
+ return new Ie(t);
8531
8657
  }
8532
8658
  }
8533
- class Kn extends Ot {
8659
+ class Et extends Ft {
8534
8660
  constructor(o, i) {
8535
8661
  super({ ...o, content: void 0 });
8536
8662
  c(this, "_state");
@@ -8549,14 +8675,14 @@ class Kn extends Ot {
8549
8675
  if (r)
8550
8676
  return r;
8551
8677
  const d = a.apply(n.nodes.doc, l), u = JSON.parse(JSON.stringify(d.toJSON()));
8552
- return u.content[0].content[0].attrs.id = "initialBlockId", r = Bt.fromJSON(n, u), r;
8678
+ return u.content[0].content[0].attrs.id = "initialBlockId", r = At.fromJSON(n, u), r;
8553
8679
  };
8554
8680
  let s;
8555
8681
  try {
8556
8682
  const l = o == null ? void 0 : o.content.map(
8557
8683
  (d) => P(d, this.schema, i).toJSON()
8558
8684
  );
8559
- s = jt(
8685
+ s = Gt(
8560
8686
  {
8561
8687
  type: "doc",
8562
8688
  content: [
@@ -8577,7 +8703,7 @@ class Kn extends Ot {
8577
8703
  "Error creating document from blocks passed as `initialContent`:\n" + +JSON.stringify(o.content)
8578
8704
  );
8579
8705
  }
8580
- this._state = zt.create({
8706
+ this._state = Wt.create({
8581
8707
  doc: s,
8582
8708
  schema: this.schema
8583
8709
  // selection: selection || undefined,
@@ -8586,14 +8712,15 @@ class Kn extends Ot {
8586
8712
  get state() {
8587
8713
  return this.view && (this._state = this.view.state), this._state;
8588
8714
  }
8589
- createView() {
8715
+ dispatch(o) {
8716
+ this.view ? this.view.dispatch(o) : this._state = this.state.apply(o);
8590
8717
  }
8591
8718
  /**
8592
8719
  * Replace the default `createView` method with a custom one - which we call on mount
8593
8720
  */
8594
8721
  createViewAlternative() {
8595
8722
  queueMicrotask(() => {
8596
- this.view = new ro(
8723
+ this.view = new co(
8597
8724
  { mount: this.options.element },
8598
8725
  // use mount option so that we reuse the existing element instead of creating a new one
8599
8726
  {
@@ -8610,8 +8737,10 @@ class Kn extends Ot {
8610
8737
  });
8611
8738
  }
8612
8739
  }
8613
- const $n = new S("blocknote-placeholder"), qn = (e, t) => new y({
8614
- key: $n,
8740
+ Et.prototype.createView = () => {
8741
+ };
8742
+ const tr = new S("blocknote-placeholder"), or = (e, t) => new y({
8743
+ key: tr,
8615
8744
  view: () => {
8616
8745
  const o = document.createElement("style"), i = e._tiptapEditor.options.injectNonce;
8617
8746
  i && o.setAttribute("nonce", i), e._tiptapEditor.view.root instanceof ShadowRoot ? e._tiptapEditor.view.root.append(o) : e._tiptapEditor.view.root.head.appendChild(o);
@@ -8649,23 +8778,49 @@ const $n = new S("blocknote-placeholder"), qn = (e, t) => new y({
8649
8778
  const r = n.$anchor, a = r.parent;
8650
8779
  if (a.content.size > 0)
8651
8780
  return null;
8652
- const s = r.before(), l = W.node(s, s + a.nodeSize, {
8781
+ const s = r.before(), l = K.node(s, s + a.nodeSize, {
8653
8782
  "data-is-empty-and-focused": "true"
8654
8783
  });
8655
8784
  return G.create(i, [l]);
8656
8785
  }
8657
8786
  }
8658
8787
  });
8659
- const Xn = {
8788
+ const ir = {
8660
8789
  enableInputRules: !0,
8661
8790
  enablePasteRules: !0,
8662
8791
  enableCoreExtensions: !1
8663
8792
  };
8664
- class vt {
8793
+ class Ct {
8665
8794
  constructor(t) {
8795
+ c(this, "_pmSchema");
8796
+ /**
8797
+ * Boolean indicating whether the editor is in headless mode.
8798
+ * Headless mode means we can use features like importing / exporting blocks,
8799
+ * but there's no underlying editor (UI) instantiated.
8800
+ *
8801
+ * You probably don't need to set this manually, but use the `server-util` package instead that uses this option internally
8802
+ */
8803
+ c(this, "headless", !1);
8666
8804
  c(this, "_tiptapEditor");
8805
+ // TODO: Type should actually reflect that it can be `undefined` in headless mode
8806
+ /**
8807
+ * Used by React to store a reference to an `ElementRenderer` helper utility to make sure we can render React elements
8808
+ * in the correct context (used by `ReactRenderUtil`)
8809
+ */
8810
+ c(this, "elementRenderer", null);
8811
+ /**
8812
+ * Cache of all blocks. This makes sure we don't have to "recompute" blocks if underlying Prosemirror Nodes haven't changed.
8813
+ * This is especially useful when we want to keep track of the same block across multiple operations,
8814
+ * with this cache, blocks stay the same object reference (referential equality with ===).
8815
+ */
8667
8816
  c(this, "blockCache", /* @__PURE__ */ new WeakMap());
8817
+ /**
8818
+ * The dictionary contains translations for the editor.
8819
+ */
8668
8820
  c(this, "dictionary");
8821
+ /**
8822
+ * The schema of the editor. The schema defines which Blocks, InlineContent, and Styles are available in the editor.
8823
+ */
8669
8824
  c(this, "schema");
8670
8825
  c(this, "blockImplementations");
8671
8826
  c(this, "inlineContentImplementations");
@@ -8676,8 +8831,25 @@ class vt {
8676
8831
  c(this, "suggestionMenus");
8677
8832
  c(this, "filePanel");
8678
8833
  c(this, "tableHandles");
8834
+ /**
8835
+ * The `uploadFile` method is what the editor uses when files need to be uploaded (for example when selecting an image to upload).
8836
+ * This method should set when creating the editor as this is application-specific.
8837
+ *
8838
+ * `undefined` means the application doesn't support file uploads.
8839
+ *
8840
+ * @param file The file that should be uploaded.
8841
+ * @returns The URL of the uploaded file OR an object containing props that should be set on the file block (such as an id)
8842
+ */
8679
8843
  c(this, "uploadFile");
8680
8844
  c(this, "resolveFileUrl");
8845
+ /**
8846
+ * Mount the editor to a parent DOM element. Call mount(undefined) to clean up
8847
+ *
8848
+ * @warning Not needed to call manually when using React, use BlockNoteView to take care of mounting
8849
+ */
8850
+ c(this, "mount", (t) => {
8851
+ this._tiptapEditor.mount(t);
8852
+ });
8681
8853
  var l, d, u, p, h, f, m;
8682
8854
  this.options = t;
8683
8855
  const o = t;
@@ -8697,21 +8869,21 @@ class vt {
8697
8869
  throw new Error(
8698
8870
  "editable initialization option is deprecated, use <BlockNoteView editable={true/false} />, or alternatively editor.isEditable = true/false"
8699
8871
  );
8700
- this.dictionary = t.dictionary || Je;
8872
+ this.dictionary = t.dictionary || et;
8701
8873
  const i = {
8702
8874
  defaultStyles: !0,
8703
- schema: t.schema || Le.create(),
8875
+ schema: t.schema || Ie.create(),
8876
+ _headless: !1,
8704
8877
  ...t,
8705
8878
  placeholders: {
8706
8879
  ...this.dictionary.placeholders,
8707
8880
  ...t.placeholders
8708
8881
  }
8709
8882
  };
8710
- this.schema = i.schema, this.blockImplementations = i.schema.blockSpecs, this.inlineContentImplementations = i.schema.inlineContentSpecs, this.styleImplementations = i.schema.styleSpecs, this.formattingToolbar = new ln(this), this.linkToolbar = new un(this), this.sideMenu = new yn(this), this.suggestionMenus = new mn(this), this.filePanel = new rn(this), E("table", this) && (this.tableHandles = new Cn(this));
8711
- const n = Fn({
8883
+ this.schema = i.schema, this.blockImplementations = i.schema.blockSpecs, this.inlineContentImplementations = i.schema.inlineContentSpecs, this.styleImplementations = i.schema.styleSpecs, this.formattingToolbar = new bn(this), this.linkToolbar = new yn(this), this.sideMenu = new Sn(this), this.suggestionMenus = new Bn(this), this.filePanel = new mn(this), E("table", this) && (this.tableHandles = new Pn(this));
8884
+ const n = Yn({
8712
8885
  editor: this,
8713
8886
  domAttributes: i.domAttributes || {},
8714
- blockSchema: this.schema.blockSchema,
8715
8887
  blockSpecs: this.schema.blockSpecs,
8716
8888
  styleSpecs: this.schema.styleSpecs,
8717
8889
  inlineContentSpecs: this.schema.inlineContentSpecs,
@@ -8727,10 +8899,10 @@ class vt {
8727
8899
  this.suggestionMenus.plugin,
8728
8900
  ...this.filePanel ? [this.filePanel.plugin] : [],
8729
8901
  ...this.tableHandles ? [this.tableHandles.plugin] : [],
8730
- qn(this, i.placeholders)
8902
+ or(this, i.placeholders)
8731
8903
  ]
8732
8904
  });
8733
- n.push(r), this.uploadFile = i.uploadFile, this.resolveFileUrl = i.resolveFileUrl || (async (g) => g), i.collaboration && i.initialContent && console.warn(
8905
+ n.push(r), this.uploadFile = i.uploadFile, this.resolveFileUrl = i.resolveFileUrl || (async (g) => g), this.headless = i._headless, i.collaboration && i.initialContent && console.warn(
8734
8906
  "When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"
8735
8907
  );
8736
8908
  const a = i.initialContent || (t.collaboration ? [
@@ -8749,7 +8921,7 @@ class vt {
8749
8921
  "initialContent must be a non-empty array of blocks, received: " + a
8750
8922
  );
8751
8923
  const s = {
8752
- ...Xn,
8924
+ ...ir,
8753
8925
  ...i._tiptapOptions,
8754
8926
  content: a,
8755
8927
  extensions: [
@@ -8761,30 +8933,28 @@ class vt {
8761
8933
  attributes: {
8762
8934
  ...(p = (u = i._tiptapOptions) == null ? void 0 : u.editorProps) == null ? void 0 : p.attributes,
8763
8935
  ...(h = i.domAttributes) == null ? void 0 : h.editor,
8764
- class: R(
8936
+ class: j(
8765
8937
  "bn-editor",
8766
8938
  i.defaultStyles ? "bn-default-styles" : "",
8767
8939
  ((m = (f = i.domAttributes) == null ? void 0 : f.editor) == null ? void 0 : m.class) || ""
8768
8940
  )
8769
8941
  },
8770
- transformPasted: Wn
8942
+ transformPasted: er
8771
8943
  }
8772
8944
  };
8773
- this._tiptapEditor = new Kn(
8945
+ this.headless ? this._pmSchema = Kt(s.extensions) : (this._tiptapEditor = new Et(
8774
8946
  s,
8775
8947
  this.schema.styleSchema
8776
- );
8948
+ ), this._pmSchema = this._tiptapEditor.schema);
8949
+ }
8950
+ get pmSchema() {
8951
+ return this._pmSchema;
8777
8952
  }
8778
8953
  static create(t = {}) {
8779
- return new vt(t);
8954
+ return new Ct(t);
8780
8955
  }
8781
- /**
8782
- * Mount the editor to a parent DOM element. Call mount(undefined) to clean up
8783
- *
8784
- * @warning Not needed for React, use BlockNoteView to take care of this
8785
- */
8786
- mount(t) {
8787
- this._tiptapEditor.mount(t);
8956
+ dispatch(t) {
8957
+ this._tiptapEditor.dispatch(t);
8788
8958
  }
8789
8959
  get prosemirrorView() {
8790
8960
  return this._tiptapEditor.view;
@@ -8802,7 +8972,7 @@ class vt {
8802
8972
  * @deprecated, use `editor.document` instead
8803
8973
  */
8804
8974
  get topLevelBlocks() {
8805
- return this.topLevelBlocks;
8975
+ return this.document;
8806
8976
  }
8807
8977
  /**
8808
8978
  * Gets a snapshot of all top-level (non-nested) blocks in the editor.
@@ -8913,7 +9083,7 @@ class vt {
8913
9083
  * @param placement Whether the text cursor should be placed at the start or end of the block.
8914
9084
  */
8915
9085
  setTextCursorPosition(t, o = "start") {
8916
- const i = typeof t == "string" ? t : t.id, { posBeforeNode: n } = Me(i, this._tiptapEditor.state.doc), { startPos: r, contentNode: a } = k(
9086
+ const i = typeof t == "string" ? t : t.id, { posBeforeNode: n } = Te(i, this._tiptapEditor.state.doc), { startPos: r, contentNode: a } = k(
8917
9087
  this._tiptapEditor.state.doc,
8918
9088
  n + 2
8919
9089
  ), s = this.schema.blockSchema[a.type.name].content;
@@ -8954,6 +9124,11 @@ class vt {
8954
9124
  * @returns True if the editor is editable, false otherwise.
8955
9125
  */
8956
9126
  get isEditable() {
9127
+ if (!this._tiptapEditor) {
9128
+ if (!this.headless)
9129
+ throw new Error("no editor, but also not headless?");
9130
+ return !1;
9131
+ }
8957
9132
  return this._tiptapEditor.isEditable;
8958
9133
  }
8959
9134
  /**
@@ -8961,6 +9136,11 @@ class vt {
8961
9136
  * @param editable True to make the editor editable, or false to lock it.
8962
9137
  */
8963
9138
  set isEditable(t) {
9139
+ if (!this._tiptapEditor) {
9140
+ if (!this.headless)
9141
+ throw new Error("no editor, but also not headless?");
9142
+ return;
9143
+ }
8964
9144
  this._tiptapEditor.options.editable !== t && this._tiptapEditor.setEditable(t);
8965
9145
  }
8966
9146
  /**
@@ -8972,7 +9152,7 @@ class vt {
8972
9152
  * `referenceBlock`. Inserts the blocks at the start of the existing block's children if "nested" is used.
8973
9153
  */
8974
9154
  insertBlocks(t, o, i = "before") {
8975
- return zi(t, o, i, this);
9155
+ return Ji(t, o, i, this);
8976
9156
  }
8977
9157
  /**
8978
9158
  * Updates an existing block in the editor. Since updatedBlock is a PartialBlock object, some fields might not be
@@ -8982,14 +9162,14 @@ class vt {
8982
9162
  * @param update A partial block which defines how the existing block should be changed.
8983
9163
  */
8984
9164
  updateBlock(t, o) {
8985
- return Fi(t, o, this);
9165
+ return Yi(t, o, this);
8986
9166
  }
8987
9167
  /**
8988
9168
  * Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
8989
9169
  * @param blocksToRemove An array of identifiers for existing blocks that should be removed.
8990
9170
  */
8991
9171
  removeBlocks(t) {
8992
- return Gi(t, this);
9172
+ return Qi(t, this);
8993
9173
  }
8994
9174
  /**
8995
9175
  * Replaces existing blocks in the editor with new blocks. If the blocks that should be removed are not adjacent or
@@ -8999,7 +9179,7 @@ class vt {
8999
9179
  * @param blocksToInsert An array of partial blocks to replace the old ones with.
9000
9180
  */
9001
9181
  replaceBlocks(t, o) {
9002
- return Wi(t, o, this);
9182
+ return en(t, o, this);
9003
9183
  }
9004
9184
  /**
9005
9185
  * Insert a piece of content at the current cursor position.
@@ -9007,12 +9187,12 @@ class vt {
9007
9187
  * @param content can be a string, or array of partial inline content elements
9008
9188
  */
9009
9189
  insertInlineContent(t) {
9010
- const o = K(
9190
+ const o = W(
9011
9191
  t,
9012
- this._tiptapEditor.schema,
9192
+ this.pmSchema,
9013
9193
  this.schema.styleSchema
9014
9194
  );
9015
- Ki(
9195
+ tn(
9016
9196
  {
9017
9197
  from: this._tiptapEditor.state.selection.from,
9018
9198
  to: this._tiptapEditor.state.selection.to
@@ -9103,9 +9283,9 @@ class vt {
9103
9283
  return;
9104
9284
  const { from: i, to: n } = this._tiptapEditor.state.selection;
9105
9285
  o || (o = this._tiptapEditor.state.doc.textBetween(i, n));
9106
- const r = this._tiptapEditor.schema.mark("link", { href: t });
9107
- this._tiptapEditor.view.dispatch(
9108
- this._tiptapEditor.view.state.tr.insertText(o, i, n).addMark(i, i + o.length, r)
9286
+ const r = this.pmSchema.mark("link", { href: t });
9287
+ this.dispatch(
9288
+ this._tiptapEditor.state.tr.insertText(o, i, n).addMark(i, i + o.length, r)
9109
9289
  );
9110
9290
  }
9111
9291
  /**
@@ -9140,18 +9320,27 @@ class vt {
9140
9320
  unnestBlock() {
9141
9321
  this._tiptapEditor.commands.liftListItem("blockContainer");
9142
9322
  }
9143
- // TODO: Fix when implementing HTML/Markdown import & export
9144
9323
  /**
9145
- * Serializes blocks into an HTML string. To better conform to HTML standards, children of blocks which aren't list
9324
+ * Exports blocks into a simplified HTML string. To better conform to HTML standards, children of blocks which aren't list
9146
9325
  * items are un-nested in the output HTML.
9326
+ *
9147
9327
  * @param blocks An array of blocks that should be serialized into HTML.
9148
9328
  * @returns The blocks, serialized as an HTML string.
9149
9329
  */
9150
9330
  async blocksToHTMLLossy(t = this.document) {
9151
- return ae(
9152
- this._tiptapEditor.schema,
9153
- this
9154
- ).exportBlocks(t);
9331
+ return ae(this.pmSchema, this).exportBlocks(t, {});
9332
+ }
9333
+ /**
9334
+ * Serializes blocks into an HTML string in the format that would normally be rendered by the editor.
9335
+ *
9336
+ * Use this method if you want to server-side render HTML (for example, a blog post that has been edited in BlockNote)
9337
+ * and serve it to users without loading the editor on the client (i.e.: displaying the blog post)
9338
+ *
9339
+ * @param blocks An array of blocks that should be serialized into HTML.
9340
+ * @returns The blocks, serialized as an HTML string.
9341
+ */
9342
+ async blocksToFullHTML(t) {
9343
+ return Ce(this.pmSchema, this).serializeBlocks(t, {});
9155
9344
  }
9156
9345
  /**
9157
9346
  * Parses blocks from an HTML string. Tries to create `Block` objects out of any HTML block-level elements, and
@@ -9161,12 +9350,12 @@ class vt {
9161
9350
  * @returns The blocks parsed from the HTML string.
9162
9351
  */
9163
9352
  async tryParseHTMLToBlocks(t) {
9164
- return _t(
9353
+ return wt(
9165
9354
  t,
9166
9355
  this.schema.blockSchema,
9167
9356
  this.schema.inlineContentSchema,
9168
9357
  this.schema.styleSchema,
9169
- this._tiptapEditor.schema
9358
+ this.pmSchema
9170
9359
  );
9171
9360
  }
9172
9361
  /**
@@ -9176,7 +9365,7 @@ class vt {
9176
9365
  * @returns The blocks, serialized as a Markdown string.
9177
9366
  */
9178
9367
  async blocksToMarkdownLossy(t = this.document) {
9179
- return Xi(t, this._tiptapEditor.schema, this);
9368
+ return rn(t, this.pmSchema, this, {});
9180
9369
  }
9181
9370
  /**
9182
9371
  * Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on
@@ -9186,12 +9375,12 @@ class vt {
9186
9375
  * @returns The blocks parsed from the Markdown string.
9187
9376
  */
9188
9377
  async tryParseMarkdownToBlocks(t) {
9189
- return on(
9378
+ return pn(
9190
9379
  t,
9191
9380
  this.schema.blockSchema,
9192
9381
  this.schema.inlineContentSchema,
9193
9382
  this.schema.styleSchema,
9194
- this._tiptapEditor.schema
9383
+ this.pmSchema
9195
9384
  );
9196
9385
  }
9197
9386
  /**
@@ -9211,6 +9400,8 @@ class vt {
9211
9400
  * @returns A function to remove the callback.
9212
9401
  */
9213
9402
  onChange(t) {
9403
+ if (this.headless)
9404
+ return;
9214
9405
  const o = () => {
9215
9406
  t(this);
9216
9407
  };
@@ -9225,6 +9416,8 @@ class vt {
9225
9416
  * @returns A function to remove the callback.
9226
9417
  */
9227
9418
  onSelectionChange(t) {
9419
+ if (this.headless)
9420
+ return;
9228
9421
  const o = () => {
9229
9422
  t(this);
9230
9423
  };
@@ -9232,6 +9425,22 @@ class vt {
9232
9425
  this._tiptapEditor.off("selectionUpdate", o);
9233
9426
  };
9234
9427
  }
9428
+ openSelectionMenu(t) {
9429
+ this.prosemirrorView.focus(), this.prosemirrorView.dispatch(
9430
+ this.prosemirrorView.state.tr.scrollIntoView().setMeta(this.suggestionMenus.plugin, {
9431
+ triggerCharacter: t,
9432
+ fromUserInput: !1
9433
+ })
9434
+ );
9435
+ }
9436
+ }
9437
+ let Xe = !1;
9438
+ const Ze = _o;
9439
+ async function ia(e, t) {
9440
+ return qi("text", e) ? (Xe || (Xe = !0, await yo({ emojiMartData: Ze })), (t.trim() === "" ? Object.values(Ze.emojis) : await wo.search(t)).map((i) => ({
9441
+ id: i.skins[0].native,
9442
+ onItemClick: () => e.insertInlineContent(i.skins[0].native + " ")
9443
+ }))) : [];
9235
9444
  }
9236
9445
  function be(e = "") {
9237
9446
  return typeof e == "string" ? [
@@ -9242,22 +9451,22 @@ function be(e = "") {
9242
9451
  }
9243
9452
  ] : e;
9244
9453
  }
9245
- function xt(e) {
9246
- return typeof e == "string" ? be(e) : Array.isArray(e) ? e.flatMap((t) => typeof t == "string" ? be(t) : Qe(t) ? {
9454
+ function St(e) {
9455
+ return typeof e == "string" ? be(e) : Array.isArray(e) ? e.flatMap((t) => typeof t == "string" ? be(t) : ot(t) ? {
9247
9456
  ...t,
9248
9457
  content: be(t.content)
9249
9458
  } : te(t) ? t : {
9250
9459
  props: {},
9251
9460
  ...t,
9252
- content: xt(t.content)
9461
+ content: St(t.content)
9253
9462
  }) : e;
9254
9463
  }
9255
- function qr(e, t) {
9464
+ function na(e, t) {
9256
9465
  return t.map(
9257
- (o) => Et(e, o)
9466
+ (o) => Mt(e, o)
9258
9467
  );
9259
9468
  }
9260
- function Et(e, t) {
9469
+ function Mt(e, t) {
9261
9470
  const o = {
9262
9471
  id: "",
9263
9472
  type: t.type,
@@ -9272,137 +9481,142 @@ function Et(e, t) {
9272
9481
  }
9273
9482
  ), {
9274
9483
  ...o,
9275
- content: xt(o.content),
9276
- children: o.children.map((i) => Et(e, i))
9484
+ content: St(o.content),
9485
+ children: o.children.map((i) => Mt(e, i))
9277
9486
  };
9278
9487
  }
9279
- function Zn(e) {
9280
- e.id || (e.id = oe.options.generateID()), e.children && Jn(e.children);
9488
+ function nr(e) {
9489
+ e.id || (e.id = oe.options.generateID()), e.children && rr(e.children);
9281
9490
  }
9282
- function Jn(e) {
9491
+ function rr(e) {
9283
9492
  for (const t of e)
9284
- Zn(t);
9493
+ nr(t);
9285
9494
  }
9286
9495
  export {
9287
- pi as AudioBlock,
9288
- vt as BlockNoteEditor,
9289
- Le as BlockNoteSchema,
9290
- qo as FileBlock,
9291
- rn as FilePanelProsemirrorPlugin,
9292
- nn as FilePanelView,
9293
- ln as FormattingToolbarProsemirrorPlugin,
9294
- an as FormattingToolbarView,
9295
- ei as ImageBlock,
9296
- un as LinkToolbarProsemirrorPlugin,
9297
- yn as SideMenuProsemirrorPlugin,
9298
- kn as SideMenuView,
9299
- mn as SuggestionMenuProseMirrorPlugin,
9300
- Cn as TableHandlesProsemirrorPlugin,
9301
- En as TableHandlesView,
9496
+ ti as AudioBlock,
9497
+ Ct as BlockNoteEditor,
9498
+ Ie as BlockNoteSchema,
9499
+ si as FileBlock,
9500
+ mn as FilePanelProsemirrorPlugin,
9501
+ hn as FilePanelView,
9502
+ bn as FormattingToolbarProsemirrorPlugin,
9503
+ fn as FormattingToolbarView,
9504
+ wt as HTMLToBlocks,
9505
+ hi as ImageBlock,
9506
+ yn as LinkToolbarProsemirrorPlugin,
9507
+ Sn as SideMenuProsemirrorPlugin,
9508
+ En as SideMenuView,
9509
+ Bn as SuggestionMenuProseMirrorPlugin,
9510
+ Pn as TableHandlesProsemirrorPlugin,
9511
+ Nn as TableHandlesView,
9302
9512
  oe as UniqueID,
9303
9513
  I as UnreachableCaseError,
9304
- ai as VideoBlock,
9305
- Zn as addIdsToBlock,
9306
- Jn as addIdsToBlocks,
9307
- Ho as addInlineContentAttributes,
9308
- Uo as addInlineContentKeyboardShortcuts,
9309
- jo as addStyleAttributes,
9310
- Nr as assertEmpty,
9311
- li as audioBlockConfig,
9312
- ci as audioParse,
9313
- si as audioPropSchema,
9314
- di as audioRender,
9315
- ui as audioToExternalHTML,
9514
+ _i as VideoBlock,
9515
+ nr as addIdsToBlock,
9516
+ rr as addIdsToBlocks,
9517
+ zo as addInlineContentAttributes,
9518
+ Fo as addInlineContentKeyboardShortcuts,
9519
+ qo as addStyleAttributes,
9520
+ Fr as assertEmpty,
9521
+ Jo as audioBlockConfig,
9522
+ Qo as audioParse,
9523
+ Zo as audioPropSchema,
9524
+ Yo as audioRender,
9525
+ ei as audioToExternalHTML,
9316
9526
  P as blockToNode,
9527
+ rn as blocksToMarkdown,
9317
9528
  re as camelToDataKebab,
9318
- Gr as checkBlockHasDefaultProp,
9319
- Oi as checkBlockIsDefaultType,
9320
- jr as checkBlockIsFileBlock,
9321
- Fr as checkBlockIsFileBlockWithPlaceholder,
9322
- zr as checkBlockIsFileBlockWithPreview,
9323
- ji as checkBlockTypeHasDefaultProp,
9529
+ Qr as checkBlockHasDefaultProp,
9530
+ Xi as checkBlockIsDefaultType,
9531
+ Zr as checkBlockIsFileBlock,
9532
+ Yr as checkBlockIsFileBlockWithPlaceholder,
9533
+ Jr as checkBlockIsFileBlockWithPreview,
9534
+ Zi as checkBlockTypeHasDefaultProp,
9324
9535
  E as checkDefaultBlockTypeInSchema,
9536
+ qi as checkDefaultInlineContentTypeInSchema,
9537
+ Be as cleanHTMLToMarkdown,
9325
9538
  Ee as contentNodeToInlineContent,
9326
9539
  de as createAddFileButton,
9327
9540
  se as createBlockSpec,
9328
9541
  q as createBlockSpecFromStronglyTypedTiptapNode,
9329
9542
  le as createDefaultFilePreview,
9330
9543
  ae as createExternalHTMLExporter,
9331
- Ce as createFigureWithCaption,
9332
- j as createFileAndCaptionWrapper,
9333
- Ur as createInlineContentSpec,
9334
- Vo as createInlineContentSpecFromTipTapNode,
9335
- lt as createInternalBlockSpec,
9336
- rt as createInternalHTMLSerializer,
9337
- Do as createInternalInlineContentSpec,
9338
- ut as createInternalStyleSpec,
9544
+ Se as createFigureWithCaption,
9545
+ V as createFileAndCaptionWrapper,
9546
+ Wr as createInlineContentSpec,
9547
+ Ko as createInlineContentSpecFromTipTapNode,
9548
+ ct as createInternalBlockSpec,
9549
+ Ce as createInternalHTMLSerializer,
9550
+ Go as createInternalInlineContentSpec,
9551
+ ht as createInternalStyleSpec,
9339
9552
  ue as createLinkWithCaption,
9340
- ht as createResizeHandlesWrapper,
9341
- z as createStronglyTypedTiptapNode,
9342
- Dr as createStyleSpec,
9553
+ ft as createResizeHandlesWrapper,
9554
+ O as createStronglyTypedTiptapNode,
9555
+ $r as createStyleSpec,
9343
9556
  U as createStyleSpecFromTipTapMark,
9344
- Wr as createSuggestionMenu,
9345
- Ri as defaultBlockSchema,
9346
- mt as defaultBlockSpecs,
9347
- Or as defaultInlineContentSchema,
9348
- gt as defaultInlineContentSpecs,
9557
+ ea as createSuggestionMenu,
9558
+ Wi as defaultBlockSchema,
9559
+ gt as defaultBlockSpecs,
9560
+ $i as defaultInlineContentSchema,
9561
+ kt as defaultInlineContentSpecs,
9349
9562
  _ as defaultProps,
9350
- Rr as defaultStyleSchema,
9351
- ft as defaultStyleSpecs,
9352
- Go as fileBlockConfig,
9353
- Ko as fileParse,
9354
- Fo as filePropSchema,
9355
- Wo as fileRender,
9356
- $o as fileToExternalHTML,
9357
- Hr as filenameFromURL,
9358
- $r as filterSuggestionItems,
9563
+ Xr as defaultStyleSchema,
9564
+ bt as defaultStyleSpecs,
9565
+ ii as fileBlockConfig,
9566
+ ri as fileParse,
9567
+ oi as filePropSchema,
9568
+ ni as fileRender,
9569
+ ai as fileToExternalHTML,
9570
+ Kr as filenameFromURL,
9571
+ oa as filterSuggestionItems,
9359
9572
  H as formatKeyboardShortcut,
9360
- sn as formattingToolbarPluginKey,
9361
- No as getBlockFromPos,
9362
- Fn as getBlockNoteExtensions,
9363
- dt as getBlockSchemaFromSpecs,
9364
- Kr as getDefaultSlashMenuItems,
9573
+ gn as formattingToolbarPluginKey,
9574
+ Vo as getBlockFromPos,
9575
+ Yn as getBlockNoteExtensions,
9576
+ ut as getBlockSchemaFromSpecs,
9577
+ ia as getDefaultEmojiPickerItems,
9578
+ ta as getDefaultSlashMenuItems,
9365
9579
  pe as getDraggableBlockFromElement,
9366
- Ro as getInlineContentParseRules,
9367
- ct as getInlineContentSchemaFromSpecs,
9368
- Po as getParseRules,
9369
- zo as getStyleParseRules,
9370
- pt as getStyleSchemaFromSpecs,
9371
- Zo as imageBlockConfig,
9372
- Yo as imageParse,
9373
- Xo as imagePropSchema,
9374
- Jo as imageRender,
9375
- Qo as imageToExternalHTML,
9376
- at as inheritedProps,
9377
- K as inlineContentToNodes,
9580
+ Wo as getInlineContentParseRules,
9581
+ pt as getInlineContentSchemaFromSpecs,
9582
+ Oo as getParseRules,
9583
+ Xo as getStyleParseRules,
9584
+ mt as getStyleSchemaFromSpecs,
9585
+ di as imageBlockConfig,
9586
+ ui as imageParse,
9587
+ li as imagePropSchema,
9588
+ ci as imageRender,
9589
+ pi as imageToExternalHTML,
9590
+ lt as inheritedProps,
9591
+ W as inlineContentToNodes,
9378
9592
  x as insertOrUpdateBlock,
9379
- Ao as isAppleOS,
9380
- Ue as isLinkInlineContent,
9381
- Qe as isPartialLinkInlineContent,
9382
- Pr as isSafari,
9593
+ Ro as isAppleOS,
9594
+ De as isLinkInlineContent,
9595
+ ot as isPartialLinkInlineContent,
9596
+ Gr as isSafari,
9383
9597
  te as isStyledTextInlineContent,
9384
- cn as linkToolbarPluginKey,
9385
- Ar as locales,
9386
- R as mergeCSSClasses,
9598
+ _n as linkToolbarPluginKey,
9599
+ zr as locales,
9600
+ pn as markdownToBlocks,
9601
+ j as mergeCSSClasses,
9387
9602
  v as nodeToBlock,
9388
- ot as nodeToCustomInlineContent,
9389
- Re as parseEmbedElement,
9603
+ rt as nodeToCustomInlineContent,
9604
+ Ve as parseEmbedElement,
9390
9605
  ce as parseFigureElement,
9391
- Oe as parseImageElement,
9392
- Et as partialBlockToBlockForTesting,
9393
- qr as partialBlocksToBlocksForTesting,
9394
- st as propsToAttributes,
9395
- _n as sideMenuPluginKey,
9396
- Oo as stylePropsToAttributes,
9397
- V as suggestionMenuPluginKey,
9398
- et as tableContentToNodes,
9606
+ ze as parseImageElement,
9607
+ Mt as partialBlockToBlockForTesting,
9608
+ na as partialBlocksToBlocksForTesting,
9609
+ dt as propsToAttributes,
9610
+ Cn as sideMenuPluginKey,
9611
+ $o as stylePropsToAttributes,
9612
+ it as tableContentToNodes,
9399
9613
  Q as tableHandlesPluginKey,
9400
- Vr as uploadToTmpFilesDotOrg_DEV_ONLY,
9401
- oi as videoBlockConfig,
9402
- ni as videoParse,
9403
- ti as videoPropSchema,
9404
- ii as videoRender,
9405
- ri as videoToExternalHTML,
9614
+ qr as uploadToTmpFilesDotOrg_DEV_ONLY,
9615
+ fi as videoBlockConfig,
9616
+ bi as videoParse,
9617
+ mi as videoPropSchema,
9618
+ gi as videoRender,
9619
+ ki as videoToExternalHTML,
9406
9620
  me as wrapInBlockStructure
9407
9621
  };
9408
9622
  //# sourceMappingURL=blocknote.js.map