@blocknote/core 0.14.5 → 0.15.2

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