@blocknote/core 0.42.3 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/dist/BlockNoteExtension-BWw0r8Gy.cjs +2 -0
  2. package/dist/BlockNoteExtension-BWw0r8Gy.cjs.map +1 -0
  3. package/dist/BlockNoteExtension-C2X7LW-V.js +25 -0
  4. package/dist/BlockNoteExtension-C2X7LW-V.js.map +1 -0
  5. package/dist/BlockNoteSchema-B4gm-Qco.cjs +2 -0
  6. package/dist/BlockNoteSchema-B4gm-Qco.cjs.map +1 -0
  7. package/dist/BlockNoteSchema-C-l154WP.js +270 -0
  8. package/dist/BlockNoteSchema-C-l154WP.js.map +1 -0
  9. package/dist/EventEmitter-CLwfmbqG.cjs +2 -0
  10. package/dist/EventEmitter-CLwfmbqG.cjs.map +1 -0
  11. package/dist/EventEmitter-CjSwpTbz.js +27 -0
  12. package/dist/EventEmitter-CjSwpTbz.js.map +1 -0
  13. package/dist/ShowSelection-BW37oJ6h.cjs +2 -0
  14. package/dist/ShowSelection-BW37oJ6h.cjs.map +1 -0
  15. package/dist/ShowSelection-Dz-NEase.js +43 -0
  16. package/dist/ShowSelection-Dz-NEase.js.map +1 -0
  17. package/dist/TrailingNode-B_zPMWxw.js +2098 -0
  18. package/dist/TrailingNode-B_zPMWxw.js.map +1 -0
  19. package/dist/TrailingNode-CRHrgOnK.cjs +2 -0
  20. package/dist/TrailingNode-CRHrgOnK.cjs.map +1 -0
  21. package/dist/{blockToNode-DIfPWLH8.js → blockToNode-DBNbhwwC.js} +33 -33
  22. package/dist/blockToNode-DBNbhwwC.js.map +1 -0
  23. package/dist/blockToNode-w7H99R6p.cjs.map +1 -1
  24. package/dist/blocknote.cjs +4 -4
  25. package/dist/blocknote.cjs.map +1 -1
  26. package/dist/blocknote.js +2496 -5686
  27. package/dist/blocknote.js.map +1 -1
  28. package/dist/blocks.cjs +1 -1
  29. package/dist/blocks.js +71 -70
  30. package/dist/blocks.js.map +1 -1
  31. package/dist/comments.cjs +1 -1
  32. package/dist/comments.cjs.map +1 -1
  33. package/dist/comments.js +451 -137
  34. package/dist/comments.js.map +1 -1
  35. package/dist/defaultBlocks-DLJ4Q1_J.cjs +6 -0
  36. package/dist/defaultBlocks-DLJ4Q1_J.cjs.map +1 -0
  37. package/dist/{BlockNoteSchema-Bi-eeHal.js → defaultBlocks-DgA_mtQV.js} +974 -1027
  38. package/dist/defaultBlocks-DgA_mtQV.js.map +1 -0
  39. package/dist/extensions.cjs +2 -0
  40. package/dist/extensions.cjs.map +1 -0
  41. package/dist/extensions.js +57 -0
  42. package/dist/extensions.js.map +1 -0
  43. package/dist/tsconfig.tsbuildinfo +1 -1
  44. package/dist/webpack-stats.json +1 -1
  45. package/dist/yjs.js +1 -1
  46. package/package.json +9 -3
  47. package/src/api/nodeConversions/blockToNode.ts +1 -1
  48. package/src/api/nodeConversions/nodeToBlock.ts +1 -1
  49. package/src/blocks/Code/block.ts +4 -4
  50. package/src/blocks/Divider/block.ts +2 -2
  51. package/src/blocks/File/helpers/render/createAddFileButton.ts +7 -5
  52. package/src/blocks/Heading/block.ts +23 -20
  53. package/src/blocks/ListItem/BulletListItem/block.ts +2 -2
  54. package/src/blocks/ListItem/CheckListItem/block.ts +2 -2
  55. package/src/blocks/ListItem/NumberedListItem/block.ts +3 -3
  56. package/src/blocks/ListItem/ToggleListItem/block.ts +2 -2
  57. package/src/blocks/PageBreak/getPageBreakSlashMenuItems.ts +2 -2
  58. package/src/blocks/Paragraph/block.ts +2 -2
  59. package/src/blocks/Quote/block.ts +2 -2
  60. package/src/blocks/Table/block.ts +4 -3
  61. package/src/blocks/ToggleWrapper/createToggleWrapper.ts +2 -1
  62. package/src/comments/extension.ts +353 -0
  63. package/src/comments/index.ts +2 -1
  64. package/src/comments/types.ts +8 -0
  65. package/src/{extensions/Comments → comments}/userstore/UserStore.ts +2 -2
  66. package/src/editor/BlockNoteEditor.test.ts +2 -23
  67. package/src/editor/BlockNoteEditor.ts +60 -453
  68. package/src/editor/BlockNoteExtension.test.ts +103 -0
  69. package/src/editor/BlockNoteExtension.ts +174 -56
  70. package/src/editor/managers/EventManager.ts +64 -35
  71. package/src/editor/managers/ExtensionManager/extensions.ts +214 -0
  72. package/src/editor/managers/ExtensionManager/index.ts +514 -0
  73. package/src/editor/managers/ExtensionManager/symbol.ts +6 -0
  74. package/src/editor/managers/SelectionManager.ts +5 -1
  75. package/src/editor/managers/StateManager.ts +29 -17
  76. package/src/editor/managers/index.ts +1 -5
  77. package/src/extensions/BlockChange/{BlockChangePlugin.ts → BlockChange.ts} +27 -29
  78. package/src/extensions/Collaboration/{ForkYDocPlugin.test.ts → ForkYDoc.test.ts} +6 -5
  79. package/src/extensions/Collaboration/ForkYDoc.ts +158 -0
  80. package/src/extensions/Collaboration/YCursorPlugin.ts +183 -0
  81. package/src/extensions/Collaboration/YSync.ts +16 -0
  82. package/src/extensions/Collaboration/YUndo.ts +12 -0
  83. package/src/extensions/Collaboration/schemaMigration/SchemaMigration.ts +59 -0
  84. package/src/extensions/DropCursor/DropCursor.ts +26 -0
  85. package/src/extensions/FilePanel/FilePanel.ts +41 -0
  86. package/src/extensions/FormattingToolbar/FormattingToolbar.ts +119 -0
  87. package/src/extensions/History/History.ts +11 -0
  88. package/src/extensions/LinkToolbar/LinkToolbar.ts +121 -0
  89. package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.ts +74 -0
  90. package/src/extensions/Placeholder/Placeholder.ts +148 -0
  91. package/src/extensions/PreviousBlockType/{PreviousBlockTypePlugin.ts → PreviousBlockType.ts} +9 -13
  92. package/src/extensions/ShowSelection/{ShowSelectionPlugin.ts → ShowSelection.ts} +27 -33
  93. package/src/extensions/SideMenu/{SideMenuPlugin.ts → SideMenu.ts} +63 -83
  94. package/src/extensions/SuggestionMenu/{SuggestionPlugin.ts → SuggestionMenu.ts} +71 -77
  95. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +29 -44
  96. package/src/extensions/TableHandles/{TableHandlesPlugin.ts → TableHandles.ts} +416 -437
  97. package/src/extensions/TrailingNode/{TrailingNodeExtension.ts → TrailingNode.ts} +8 -17
  98. package/src/extensions/index.ts +24 -0
  99. package/src/extensions/{BackgroundColor → tiptap-extensions/BackgroundColor}/BackgroundColorExtension.ts +1 -1
  100. package/src/extensions/{KeyboardShortcuts → tiptap-extensions/KeyboardShortcuts}/KeyboardShortcutsExtension.ts +21 -16
  101. package/src/extensions/{TextColor → tiptap-extensions/TextColor}/TextColorExtension.ts +1 -1
  102. package/src/extensions/tiptap-extensions/index.ts +31 -0
  103. package/src/index.ts +1 -13
  104. package/src/schema/blocks/createSpec.ts +14 -11
  105. package/src/schema/blocks/internal.ts +2 -2
  106. package/src/schema/blocks/types.ts +8 -5
  107. package/src/schema/schema.ts +11 -36
  108. package/src/util/topo-sort.ts +46 -0
  109. package/types/src/comments/extension.d.ts +70 -0
  110. package/types/src/comments/index.d.ts +2 -1
  111. package/types/src/comments/types.d.ts +8 -0
  112. package/types/src/{extensions/Comments → comments}/userstore/UserStore.d.ts +2 -2
  113. package/types/src/editor/BlockNoteEditor.d.ts +34 -105
  114. package/types/src/editor/BlockNoteExtension.d.ts +87 -22
  115. package/types/src/editor/managers/EventManager.d.ts +25 -16
  116. package/types/src/editor/managers/ExtensionManager/extensions.d.ts +8 -0
  117. package/types/src/editor/managers/ExtensionManager/index.d.ts +83 -0
  118. package/types/src/editor/managers/ExtensionManager/symbol.d.ts +5 -0
  119. package/types/src/editor/managers/StateManager.d.ts +1 -12
  120. package/types/src/editor/managers/index.d.ts +1 -2
  121. package/types/src/extensions/BlockChange/BlockChange.d.ts +16 -0
  122. package/types/src/extensions/Collaboration/ForkYDoc.d.ts +34 -0
  123. package/types/src/extensions/Collaboration/ForkYDoc.test.d.ts +1 -0
  124. package/types/src/extensions/Collaboration/YCursorPlugin.d.ts +24 -0
  125. package/types/src/extensions/Collaboration/YSync.d.ts +8 -0
  126. package/types/src/extensions/Collaboration/YUndo.d.ts +12 -0
  127. package/types/src/extensions/Collaboration/schemaMigration/SchemaMigration.d.ts +8 -0
  128. package/types/src/extensions/DropCursor/DropCursor.d.ts +5 -0
  129. package/types/src/extensions/FilePanel/FilePanel.d.ts +11 -0
  130. package/types/src/extensions/FormattingToolbar/FormattingToolbar.d.ts +9 -0
  131. package/types/src/extensions/History/History.d.ts +6 -0
  132. package/types/src/extensions/LinkToolbar/LinkToolbar.d.ts +24 -0
  133. package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.d.ts +5 -0
  134. package/types/src/extensions/Placeholder/Placeholder.d.ts +6 -0
  135. package/types/src/extensions/PreviousBlockType/{PreviousBlockTypePlugin.d.ts → PreviousBlockType.d.ts} +9 -5
  136. package/types/src/extensions/ShowSelection/ShowSelection.d.ts +21 -0
  137. package/types/src/extensions/SideMenu/{SideMenuPlugin.d.ts → SideMenu.d.ts} +11 -15
  138. package/types/src/extensions/SuggestionMenu/SuggestionMenu.d.ts +54 -0
  139. package/types/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.d.ts +1 -1
  140. package/types/src/extensions/TableHandles/{TableHandlesPlugin.d.ts → TableHandles.d.ts} +28 -31
  141. package/types/src/extensions/TrailingNode/TrailingNode.d.ts +8 -0
  142. package/types/src/extensions/index.d.ts +24 -0
  143. package/types/src/extensions/{KeyboardShortcuts → tiptap-extensions/KeyboardShortcuts}/KeyboardShortcutsExtension.d.ts +1 -1
  144. package/types/src/extensions/tiptap-extensions/index.d.ts +11 -0
  145. package/types/src/index.d.ts +1 -13
  146. package/types/src/schema/blocks/createSpec.d.ts +4 -4
  147. package/types/src/schema/blocks/internal.d.ts +2 -2
  148. package/types/src/schema/blocks/types.d.ts +5 -5
  149. package/types/src/util/topo-sort.d.ts +8 -0
  150. package/dist/BlockNoteSchema-Bi-eeHal.js.map +0 -1
  151. package/dist/BlockNoteSchema-DjDaA2C3.cjs +0 -6
  152. package/dist/BlockNoteSchema-DjDaA2C3.cjs.map +0 -1
  153. package/dist/blockToNode-DIfPWLH8.js.map +0 -1
  154. package/src/comments/models/User.ts +0 -8
  155. package/src/editor/BlockNoteExtensions.ts +0 -325
  156. package/src/editor/managers/CollaborationManager.ts +0 -212
  157. package/src/editor/managers/ExtensionManager.ts +0 -130
  158. package/src/extensions/Collaboration/CursorPlugin.ts +0 -189
  159. package/src/extensions/Collaboration/ForkYDocPlugin.ts +0 -192
  160. package/src/extensions/Collaboration/SyncPlugin.ts +0 -18
  161. package/src/extensions/Collaboration/UndoPlugin.ts +0 -18
  162. package/src/extensions/Collaboration/schemaMigration/SchemaMigrationPlugin.ts +0 -59
  163. package/src/extensions/Comments/CommentsPlugin.ts +0 -392
  164. package/src/extensions/FilePanel/FilePanelPlugin.ts +0 -206
  165. package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +0 -363
  166. package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +0 -380
  167. package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts +0 -75
  168. package/src/extensions/Placeholder/PlaceholderPlugin.ts +0 -147
  169. package/types/src/comments/models/User.d.ts +0 -8
  170. package/types/src/editor/BlockNoteExtensions.d.ts +0 -43
  171. package/types/src/editor/managers/CollaborationManager.d.ts +0 -115
  172. package/types/src/editor/managers/ExtensionManager.d.ts +0 -68
  173. package/types/src/extensions/BlockChange/BlockChangePlugin.d.ts +0 -15
  174. package/types/src/extensions/Collaboration/CursorPlugin.d.ts +0 -37
  175. package/types/src/extensions/Collaboration/ForkYDocPlugin.d.ts +0 -41
  176. package/types/src/extensions/Collaboration/SyncPlugin.d.ts +0 -7
  177. package/types/src/extensions/Collaboration/UndoPlugin.d.ts +0 -9
  178. package/types/src/extensions/Collaboration/schemaMigration/SchemaMigrationPlugin.d.ts +0 -7
  179. package/types/src/extensions/Comments/CommentsPlugin.d.ts +0 -66
  180. package/types/src/extensions/FilePanel/FilePanelPlugin.d.ts +0 -31
  181. package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +0 -41
  182. package/types/src/extensions/LinkToolbar/LinkToolbarPlugin.d.ts +0 -42
  183. package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.d.ts +0 -5
  184. package/types/src/extensions/Placeholder/PlaceholderPlugin.d.ts +0 -6
  185. package/types/src/extensions/ShowSelection/ShowSelectionPlugin.d.ts +0 -15
  186. package/types/src/extensions/SuggestionMenu/SuggestionPlugin.d.ts +0 -31
  187. package/types/src/extensions/TrailingNode/TrailingNodeExtension.d.ts +0 -13
  188. /package/src/{extensions/Comments/CommentMark.ts → comments/mark.ts} +0 -0
  189. /package/src/extensions/{HardBreak → tiptap-extensions/HardBreak}/HardBreak.ts +0 -0
  190. /package/src/extensions/{Suggestions → tiptap-extensions/Suggestions}/SuggestionMarks.ts +0 -0
  191. /package/src/extensions/{TextAlignment → tiptap-extensions/TextAlignment}/TextAlignmentExtension.ts +0 -0
  192. /package/src/extensions/{UniqueID → tiptap-extensions/UniqueID}/UniqueID.ts +0 -0
  193. /package/types/src/{extensions/Comments/CommentMark.d.ts → comments/mark.d.ts} +0 -0
  194. /package/types/src/{extensions/Collaboration/ForkYDocPlugin.test.d.ts → editor/BlockNoteExtension.test.d.ts} +0 -0
  195. /package/types/src/extensions/{BackgroundColor → tiptap-extensions/BackgroundColor}/BackgroundColorExtension.d.ts +0 -0
  196. /package/types/src/extensions/{HardBreak → tiptap-extensions/HardBreak}/HardBreak.d.ts +0 -0
  197. /package/types/src/extensions/{Suggestions → tiptap-extensions/Suggestions}/SuggestionMarks.d.ts +0 -0
  198. /package/types/src/extensions/{TextAlignment → tiptap-extensions/TextAlignment}/TextAlignmentExtension.d.ts +0 -0
  199. /package/types/src/extensions/{TextColor → tiptap-extensions/TextColor}/TextColorExtension.d.ts +0 -0
  200. /package/types/src/extensions/{UniqueID → tiptap-extensions/UniqueID}/UniqueID.d.ts +0 -0
@@ -1,25 +1,30 @@
1
1
  var Oe = Object.defineProperty;
2
- var De = (e, t, n) => t in e ? Oe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var C = (e, t, n) => De(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { TableMap as me, goToNextCell as ee, columnResizing as _e, tableEditing as Ve, CellSelection as he, TableView as Re } from "prosemirror-tables";
5
- import { b as Z, g as We, a as P, n as ge, i as te, t as Fe, U as je, c as Ue, e as $, f as $e, h as be, j as Ge } from "./blockToNode-DIfPWLH8.js";
6
- import Ze from "@tiptap/extension-bold";
7
- import ze from "@tiptap/extension-code";
8
- import qe from "@tiptap/extension-italic";
9
- import Xe from "@tiptap/extension-strike";
10
- import Ke from "@tiptap/extension-underline";
11
- import { Node as N, Mark as Qe, Extension as Ye, callOrReturn as Je, getExtensionField as et, mergeAttributes as z } from "@tiptap/core";
12
- import { DOMParser as R, Fragment as O, DOMSerializer as ne, Slice as ke } from "prosemirror-model";
13
- import { createHighlightPlugin as tt } from "prosemirror-highlight";
14
- import { createParser as nt } from "prosemirror-highlight/shiki";
15
- import { TextSelection as Ce, Plugin as ot, PluginKey as rt } from "prosemirror-state";
16
- import { ReplaceStep as at } from "prosemirror-transform";
17
- import { DecorationSet as oe, Decoration as st } from "prosemirror-view";
18
- const ct = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
2
+ var _e = (e, t, n) => t in e ? Oe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var L = (e, t, n) => _e(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { TableMap as be, goToNextCell as ne, columnResizing as Ve, tableEditing as Re, CellSelection as Ce, TableView as We } from "prosemirror-tables";
5
+ import { Node as N, Mark as Fe, Extension as $e, callOrReturn as Ue, getExtensionField as qe, mergeAttributes as z, findParentNode as je } from "@tiptap/core";
6
+ import { TextSelection as ke, Plugin as Ge, PluginKey as Ze } from "prosemirror-state";
7
+ import { DecorationSet as oe, Decoration as re } from "prosemirror-view";
8
+ import { ReplaceStep as ze, Mapping as Xe } from "prosemirror-transform";
9
+ import { ySyncPluginKey as ae, absolutePositionToRelativePosition as Ke, relativePositionToAbsolutePosition as Qe } from "y-prosemirror";
10
+ import { c as k, a as ye } from "./BlockNoteExtension-C2X7LW-V.js";
11
+ import { b as X, v as Je, g as O, a as ve, i as se, t as Ye, U as et, q as tt, A as G, r as nt, w as Ee, J as ot } from "./blockToNode-DBNbhwwC.js";
12
+ import rt from "@tiptap/extension-bold";
13
+ import at from "@tiptap/extension-code";
14
+ import st from "@tiptap/extension-italic";
15
+ import it from "@tiptap/extension-strike";
16
+ import ct from "@tiptap/extension-underline";
17
+ import { DOMParser as xe, Fragment as lt, DOMSerializer as ie } from "@tiptap/pm/model";
18
+ import { createHighlightPlugin as dt } from "prosemirror-highlight";
19
+ import { createParser as ut } from "prosemirror-highlight/shiki";
20
+ import { Slice as we, Fragment as F, DOMParser as Se } from "prosemirror-model";
21
+ import { Plugin as pt, PluginKey as ft } from "@tiptap/pm/state";
22
+ import { DecorationSet as ce, Decoration as gt } from "@tiptap/pm/view";
23
+ const ht = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
19
24
  function M(e, t = "Ctrl") {
20
- return ct() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
25
+ return ht() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
21
26
  }
22
- function I(...e) {
27
+ function D(...e) {
23
28
  return [
24
29
  // Converts to & from set to remove duplicates.
25
30
  ...new Set(
@@ -27,31 +32,31 @@ function I(...e) {
27
32
  )
28
33
  ].join(" ");
29
34
  }
30
- const eo = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
31
- function it(e, t, n, o) {
35
+ const uo = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
36
+ function mt(e, t, n, o) {
32
37
  const r = document.createElement("div");
33
- r.className = I(
38
+ r.className = D(
34
39
  "bn-block-content",
35
40
  n.class
36
41
  ), r.setAttribute("data-content-type", e);
37
- for (const [s, c] of Object.entries(n))
38
- s !== "class" && r.setAttribute(s, c);
42
+ for (const [s, i] of Object.entries(n))
43
+ s !== "class" && r.setAttribute(s, i);
39
44
  const a = document.createElement(t);
40
- a.className = I(
45
+ a.className = D(
41
46
  "bn-inline-content",
42
47
  o.class
43
48
  );
44
- for (const [s, c] of Object.entries(
49
+ for (const [s, i] of Object.entries(
45
50
  o
46
51
  ))
47
- s !== "class" && a.setAttribute(s, c);
52
+ s !== "class" && a.setAttribute(s, i);
48
53
  return r.appendChild(a), {
49
54
  dom: r,
50
55
  contentDOM: a
51
56
  };
52
57
  }
53
- const re = (e, t) => {
54
- let n = Z(e, t.pmSchema);
58
+ const le = (e, t) => {
59
+ let n = X(e, t.pmSchema);
55
60
  n.type.name === "blockContainer" && (n = n.firstChild);
56
61
  const o = t.pmSchema.nodes[n.type.name].spec.toDOM;
57
62
  if (o === void 0)
@@ -65,7 +70,7 @@ const re = (e, t) => {
65
70
  );
66
71
  return r;
67
72
  };
68
- function lt(e, t = "<br>") {
73
+ function bt(e, t = "<br>") {
69
74
  const n = e.querySelectorAll("p");
70
75
  if (n.length > 1) {
71
76
  const o = n[0];
@@ -75,15 +80,15 @@ function lt(e, t = "<br>") {
75
80
  }
76
81
  }
77
82
  }
78
- function V(e) {
83
+ function W(e) {
79
84
  return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
80
85
  }
81
- function to(e) {
86
+ function po(e) {
82
87
  const t = e.split("/");
83
88
  return !t.length || // invalid?
84
89
  t[t.length - 1] === "" ? e : t[t.length - 1];
85
90
  }
86
- function no(e) {
91
+ function fo(e) {
87
92
  var n;
88
93
  const t = [
89
94
  "mp4",
@@ -103,7 +108,7 @@ function no(e) {
103
108
  return !1;
104
109
  }
105
110
  }
106
- function dt(e) {
111
+ function Ct(e) {
107
112
  const t = {};
108
113
  return Object.entries(e).forEach(([n, o]) => {
109
114
  t[n] = {
@@ -113,7 +118,7 @@ function dt(e) {
113
118
  // value is the same as its default, we don't display an HTML
114
119
  // attribute for it.
115
120
  parseHTML: (r) => {
116
- const a = r.getAttribute(V(n));
121
+ const a = r.getAttribute(W(n));
117
122
  if (a === null)
118
123
  return null;
119
124
  if (o.default === void 0 && o.type === "boolean" || o.default !== void 0 && typeof o.default == "boolean")
@@ -125,37 +130,37 @@ function dt(e) {
125
130
  return a;
126
131
  },
127
132
  renderHTML: (r) => r[n] !== o.default ? {
128
- [V(n)]: r[n]
133
+ [W(n)]: r[n]
129
134
  } : {}
130
135
  };
131
136
  }), t;
132
137
  }
133
- function ut(e, t, n, o) {
138
+ function kt(e, t, n, o) {
134
139
  const r = e();
135
140
  if (r === void 0)
136
141
  throw new Error("Cannot find node position");
137
142
  const s = n.state.doc.resolve(r).node().attrs.id;
138
143
  if (!s)
139
144
  throw new Error("Block doesn't have id");
140
- const c = t.getBlock(s);
141
- if (c.type !== o)
145
+ const i = t.getBlock(s);
146
+ if (i.type !== o)
142
147
  throw new Error("Block type does not match");
143
- return c;
148
+ return i;
144
149
  }
145
- function G(e, t, n, o, r = !1, a) {
150
+ function Z(e, t, n, o, r = !1, a) {
146
151
  const s = document.createElement("div");
147
152
  if (a !== void 0)
148
- for (const [c, l] of Object.entries(a))
149
- c !== "class" && s.setAttribute(c, l);
150
- s.className = I(
153
+ for (const [i, c] of Object.entries(a))
154
+ i !== "class" && s.setAttribute(i, c);
155
+ s.className = D(
151
156
  "bn-block-content",
152
157
  (a == null ? void 0 : a.class) || ""
153
158
  ), s.setAttribute("data-content-type", t);
154
- for (const [c, l] of Object.entries(n)) {
155
- const u = o[c].default;
156
- l !== u && s.setAttribute(V(c), l);
159
+ for (const [i, c] of Object.entries(n)) {
160
+ const u = o[i].default;
161
+ c !== u && s.setAttribute(W(i), c);
157
162
  }
158
- return r && s.setAttribute("data-file-block", ""), s.appendChild(e.dom), e.contentDOM && (e.contentDOM.className = I(
163
+ return r && s.setAttribute("data-file-block", ""), s.appendChild(e.dom), e.contentDOM && (e.contentDOM.className = D(
159
164
  "bn-inline-content",
160
165
  e.contentDOM.className
161
166
  )), {
@@ -163,7 +168,7 @@ function G(e, t, n, o, r = !1, a) {
163
168
  dom: s
164
169
  };
165
170
  }
166
- function pt(e, t, n) {
171
+ function yt(e, t, n) {
167
172
  return {
168
173
  config: {
169
174
  type: e.type,
@@ -172,18 +177,18 @@ function pt(e, t, n) {
172
177
  },
173
178
  implementation: {
174
179
  node: e.node,
175
- render: re,
176
- toExternalHTML: re
180
+ render: le,
181
+ toExternalHTML: le
177
182
  },
178
183
  extensions: n
179
184
  };
180
185
  }
181
- function ft(e, t) {
186
+ function vt(e, t) {
182
187
  e.stopEvent = (n) => (n.type === "mousedown" && setTimeout(() => {
183
188
  t.view.dom.blur();
184
189
  }, 10), !0);
185
190
  }
186
- function mt(e, t) {
191
+ function Et(e, t) {
187
192
  const n = [
188
193
  {
189
194
  tag: "[data-content-type=" + e.type + "]",
@@ -207,40 +212,40 @@ function mt(e, t) {
207
212
  schema: r
208
213
  });
209
214
  if (e.content === "inline") {
210
- const c = o.cloneNode(!0);
211
- return lt(
212
- c,
215
+ const i = o.cloneNode(!0);
216
+ return bt(
217
+ i,
213
218
  (a = t.meta) != null && a.code ? `
214
219
  ` : "<br>"
215
- ), R.fromSchema(r).parse(c, {
220
+ ), xe.fromSchema(r).parse(i, {
216
221
  topNode: r.nodes.paragraph.create()
217
222
  }).content;
218
223
  }
219
- return O.empty;
224
+ return lt.empty;
220
225
  } : void 0
221
226
  }), n;
222
227
  }
223
- function ht(e, t, n, o) {
224
- var a, s, c, l;
228
+ function go(e, t, n, o) {
229
+ var a, s, i, c;
225
230
  const r = t.node || N.create({
226
231
  name: e.type,
227
232
  content: e.content === "inline" ? "inline*" : e.content === "none" ? "" : e.content,
228
233
  group: "blockContent",
229
234
  selectable: ((a = t.meta) == null ? void 0 : a.selectable) ?? !0,
230
235
  isolating: ((s = t.meta) == null ? void 0 : s.isolating) ?? !0,
231
- code: ((c = t.meta) == null ? void 0 : c.code) ?? !1,
232
- defining: ((l = t.meta) == null ? void 0 : l.defining) ?? !0,
236
+ code: ((i = t.meta) == null ? void 0 : i.code) ?? !1,
237
+ defining: ((c = t.meta) == null ? void 0 : c.defining) ?? !0,
233
238
  priority: o,
234
239
  addAttributes() {
235
- return dt(e.propSchema);
240
+ return Ct(e.propSchema);
236
241
  },
237
242
  parseHTML() {
238
- return mt(e, t);
243
+ return Et(e, t);
239
244
  },
240
- renderHTML({ HTMLAttributes: i }) {
245
+ renderHTML({ HTMLAttributes: l }) {
241
246
  var d;
242
247
  const u = document.createElement("div");
243
- return G(
248
+ return Z(
244
249
  {
245
250
  dom: u,
246
251
  contentDOM: e.content === "inline" ? u : void 0
@@ -249,23 +254,23 @@ function ht(e, t, n, o) {
249
254
  {},
250
255
  e.propSchema,
251
256
  ((d = t.meta) == null ? void 0 : d.fileBlockAccept) !== void 0,
252
- i
257
+ l
253
258
  );
254
259
  },
255
260
  addNodeView() {
256
- return (i) => {
257
- var f, S;
258
- const u = this.options.editor, d = ut(
259
- i.getPos,
261
+ return (l) => {
262
+ var f, E;
263
+ const u = this.options.editor, d = kt(
264
+ l.getPos,
260
265
  u,
261
266
  this.editor,
262
267
  e.type
263
268
  ), p = ((f = this.options.domAttributes) == null ? void 0 : f.blockContent) || {}, h = t.render.call(
264
- { blockContentDOMAttributes: p, props: i, renderType: "nodeView" },
269
+ { blockContentDOMAttributes: p, props: l, renderType: "nodeView" },
265
270
  d,
266
271
  u
267
272
  );
268
- return ((S = t.meta) == null ? void 0 : S.selectable) === !1 && ft(h, this.editor), h;
273
+ return ((E = t.meta) == null ? void 0 : E.selectable) === !1 && vt(h, this.editor), h;
269
274
  };
270
275
  }
271
276
  });
@@ -278,7 +283,7 @@ function ht(e, t, n, o) {
278
283
  implementation: {
279
284
  ...t,
280
285
  node: r,
281
- render(i, u) {
286
+ render(l, u) {
282
287
  var p;
283
288
  const d = ((p = r.options.domAttributes) == null ? void 0 : p.blockContent) || {};
284
289
  return t.render.call(
@@ -287,22 +292,22 @@ function ht(e, t, n, o) {
287
292
  props: void 0,
288
293
  renderType: "dom"
289
294
  },
290
- i,
295
+ l,
291
296
  u
292
297
  );
293
298
  },
294
299
  // TODO: this should not have wrapInBlockStructure and generally be a lot simpler
295
300
  // post-processing in externalHTMLExporter should not be necessary
296
- toExternalHTML: (i, u) => {
301
+ toExternalHTML: (l, u) => {
297
302
  var p, h;
298
303
  const d = ((p = r.options.domAttributes) == null ? void 0 : p.blockContent) || {};
299
304
  return ((h = t.toExternalHTML) == null ? void 0 : h.call(
300
305
  { blockContentDOMAttributes: d },
301
- i,
306
+ l,
302
307
  u
303
308
  )) ?? t.render.call(
304
309
  { blockContentDOMAttributes: d, renderType: "dom", props: void 0 },
305
- i,
310
+ l,
306
311
  u
307
312
  );
308
313
  }
@@ -310,7 +315,7 @@ function ht(e, t, n, o) {
310
315
  extensions: n
311
316
  };
312
317
  }
313
- function oo(e) {
318
+ function ho(e) {
314
319
  return e;
315
320
  }
316
321
  function v(e, t, n) {
@@ -322,37 +327,37 @@ function v(e, t, n) {
322
327
  ...a,
323
328
  // TODO: this should not have wrapInBlockStructure and generally be a lot simpler
324
329
  // post-processing in externalHTMLExporter should not be necessary
325
- toExternalHTML(c, l) {
330
+ toExternalHTML(i, c) {
326
331
  var u, d;
327
- const i = (u = a.toExternalHTML) == null ? void 0 : u.call(
332
+ const l = (u = a.toExternalHTML) == null ? void 0 : u.call(
328
333
  { blockContentDOMAttributes: this.blockContentDOMAttributes },
329
- c,
330
- l
334
+ i,
335
+ c
331
336
  );
332
- if (i !== void 0)
333
- return G(
334
- i,
335
- c.type,
336
- c.props,
337
+ if (l !== void 0)
338
+ return Z(
339
+ l,
340
+ i.type,
341
+ i.props,
337
342
  r.propSchema,
338
343
  ((d = a.meta) == null ? void 0 : d.fileBlockAccept) !== void 0
339
344
  );
340
345
  },
341
- render(c, l) {
346
+ render(i, c) {
342
347
  var d;
343
- const i = a.render.call(
348
+ const l = a.render.call(
344
349
  {
345
350
  blockContentDOMAttributes: this.blockContentDOMAttributes,
346
351
  renderType: this.renderType,
347
352
  props: this.props
348
353
  },
349
- c,
350
- l
351
- );
352
- return G(
353
354
  i,
354
- c.type,
355
- c.props,
355
+ c
356
+ );
357
+ return Z(
358
+ l,
359
+ i.type,
360
+ i.props,
356
361
  r.propSchema,
357
362
  ((d = a.meta) == null ? void 0 : d.fileBlockAccept) !== void 0,
358
363
  this.blockContentDOMAttributes
@@ -363,13 +368,13 @@ function v(e, t, n) {
363
368
  };
364
369
  };
365
370
  }
366
- function ro(e, t, n, o) {
371
+ function mo(e, t, n, o) {
367
372
  return e.dom.setAttribute("data-inline-content-type", t), Object.entries(n).filter(([r, a]) => {
368
373
  const s = o[r];
369
374
  return a !== s.default;
370
- }).map(([r, a]) => [V(r), a]).forEach(([r, a]) => e.dom.setAttribute(r, a)), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
375
+ }).map(([r, a]) => [W(r), a]).forEach(([r, a]) => e.dom.setAttribute(r, a)), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
371
376
  }
372
- function ao(e) {
377
+ function bo(e) {
373
378
  return {
374
379
  Backspace: ({ editor: t }) => {
375
380
  const n = t.state.selection.$from;
@@ -377,14 +382,14 @@ function ao(e) {
377
382
  }
378
383
  };
379
384
  }
380
- function gt(e, t) {
385
+ function xt(e, t) {
381
386
  return {
382
387
  config: e,
383
388
  implementation: t
384
389
  };
385
390
  }
386
- function so(e, t, n) {
387
- return gt(
391
+ function Co(e, t, n) {
392
+ return xt(
388
393
  {
389
394
  type: e.name,
390
395
  propSchema: t,
@@ -396,12 +401,12 @@ function so(e, t, n) {
396
401
  }
397
402
  );
398
403
  }
399
- function ye(e) {
404
+ function wt(e) {
400
405
  return Object.fromEntries(
401
406
  Object.entries(e).map(([t, n]) => [t, n.config])
402
407
  );
403
408
  }
404
- function bt(e) {
409
+ function St(e) {
405
410
  return e === "boolean" ? {} : {
406
411
  stringValue: {
407
412
  default: void 0,
@@ -413,17 +418,17 @@ function bt(e) {
413
418
  }
414
419
  };
415
420
  }
416
- function _(e, t, n, o) {
421
+ function V(e, t, n, o) {
417
422
  return e.dom.setAttribute("data-style-type", t), o === "string" && e.dom.setAttribute("data-value", n), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
418
423
  }
419
- function ve(e, t) {
424
+ function Me(e, t) {
420
425
  return {
421
426
  config: e,
422
427
  implementation: t
423
428
  };
424
429
  }
425
430
  function H(e, t) {
426
- return ve(
431
+ return Me(
427
432
  {
428
433
  type: e.name,
429
434
  propSchema: t
@@ -438,7 +443,7 @@ function H(e, t) {
438
443
  );
439
444
  const a = o.pmSchema.mark(e.name, {
440
445
  stringValue: n
441
- }), s = ne.renderSpec(
446
+ }), s = ie.renderSpec(
442
447
  document,
443
448
  r(a, !0)
444
449
  );
@@ -456,7 +461,7 @@ function H(e, t) {
456
461
  );
457
462
  const a = o.pmSchema.mark(e.name, {
458
463
  stringValue: n
459
- }), s = ne.renderSpec(
464
+ }), s = ie.renderSpec(
460
465
  document,
461
466
  r(a, !0)
462
467
  );
@@ -469,12 +474,12 @@ function H(e, t) {
469
474
  }
470
475
  );
471
476
  }
472
- function Se(e) {
477
+ function Mt(e) {
473
478
  return Object.fromEntries(
474
479
  Object.entries(e).map(([t, n]) => [t, n.config])
475
480
  );
476
481
  }
477
- function kt(e, t) {
482
+ function Lt(e, t) {
478
483
  const n = [
479
484
  {
480
485
  tag: `[data-style-type="${e.type}"]`,
@@ -498,18 +503,18 @@ function kt(e, t) {
498
503
  }
499
504
  }), n;
500
505
  }
501
- function Ee(e, t) {
502
- const n = Qe.create({
506
+ function Le(e, t) {
507
+ const n = Fe.create({
503
508
  name: e.type,
504
509
  addAttributes() {
505
- return bt(e.propSchema);
510
+ return St(e.propSchema);
506
511
  },
507
512
  parseHTML() {
508
- return kt(e, t.parse);
513
+ return Lt(e, t.parse);
509
514
  },
510
515
  renderHTML({ mark: o }) {
511
516
  const r = (t.toExternalHTML || t.render)(o.attrs.stringValue);
512
- return _(
517
+ return V(
513
518
  r,
514
519
  e.type,
515
520
  o.attrs.stringValue,
@@ -519,7 +524,7 @@ function Ee(e, t) {
519
524
  addMarkView() {
520
525
  return ({ mark: o }) => {
521
526
  const r = t.render(o.attrs.stringValue);
522
- return _(
527
+ return V(
523
528
  r,
524
529
  e.type,
525
530
  o.attrs.stringValue,
@@ -528,12 +533,12 @@ function Ee(e, t) {
528
533
  };
529
534
  }
530
535
  });
531
- return ve(e, {
536
+ return Me(e, {
532
537
  ...t,
533
538
  mark: n,
534
539
  render: (o) => {
535
540
  const r = t.render(o);
536
- return _(
541
+ return V(
537
542
  r,
538
543
  e.type,
539
544
  o,
@@ -542,7 +547,7 @@ function Ee(e, t) {
542
547
  },
543
548
  toExternalHTML: (o) => {
544
549
  const r = (t.toExternalHTML || t.render)(o);
545
- return _(
550
+ return V(
546
551
  r,
547
552
  e.type,
548
553
  o,
@@ -551,229 +556,54 @@ function Ee(e, t) {
551
556
  }
552
557
  });
553
558
  }
554
- function Ct(e) {
555
- const t = vt(e);
556
- let { roots: n, nonRoots: o } = ae(t);
557
- const r = [];
558
- for (; n.size; ) {
559
- r.push(n);
560
- const a = /* @__PURE__ */ new Set();
561
- for (const s of n) {
562
- const c = e.get(s);
563
- if (c)
564
- for (const l of c) {
565
- const i = t.get(l);
566
- if (i === void 0)
567
- continue;
568
- const u = i - 1;
569
- t.set(l, u), u === 0 && a.add(l);
570
- }
571
- }
572
- n = a;
573
- }
574
- if (o = ae(t).nonRoots, o.size)
575
- throw new Error(
576
- `Cycle(s) detected; toposort only works on acyclic graphs. Cyclic nodes: ${Array.from(o).join(", ")}`
577
- );
578
- return r;
579
- }
580
- function yt(e) {
581
- const t = St(e);
582
- return Ct(t);
583
- }
584
- function vt(e) {
585
- const t = /* @__PURE__ */ new Map();
586
- for (const [n, o] of e.entries()) {
587
- t.has(n) || t.set(n, 0);
588
- for (const r of o) {
589
- const a = t.get(r) ?? 0;
590
- t.set(r, a + 1);
591
- }
592
- }
593
- return t;
594
- }
595
- function ae(e) {
596
- const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
597
- for (const [o, r] of e.entries())
598
- r === 0 ? t.add(o) : n.add(o);
599
- return { roots: t, nonRoots: n };
600
- }
601
- function St(e) {
602
- const t = /* @__PURE__ */ new Map();
603
- for (const [n, o] of e.entries()) {
604
- t.has(n) || t.set(n, /* @__PURE__ */ new Set());
605
- for (const r of o)
606
- t.has(r) || t.set(r, /* @__PURE__ */ new Set()), t.get(r).add(n);
607
- }
608
- return t;
609
- }
610
- function Et() {
611
- return /* @__PURE__ */ new Map();
612
- }
613
- function se(e) {
614
- return e && Object.fromEntries(
615
- Object.entries(e).filter(([, t]) => t !== void 0)
616
- );
617
- }
618
- class wt {
619
- constructor(t) {
620
- // Helper so that you can use typeof schema.BlockNoteEditor
621
- C(this, "BlockNoteEditor", "only for types");
622
- C(this, "Block", "only for types");
623
- C(this, "PartialBlock", "only for types");
624
- C(this, "inlineContentSpecs");
625
- C(this, "styleSpecs");
626
- C(this, "blockSpecs");
627
- C(this, "blockSchema");
628
- C(this, "inlineContentSchema");
629
- C(this, "styleSchema");
630
- this.opts = t;
631
- const {
632
- blockSpecs: n,
633
- inlineContentSpecs: o,
634
- styleSpecs: r,
635
- blockSchema: a,
636
- inlineContentSchema: s,
637
- styleSchema: c
638
- } = this.init();
639
- this.blockSpecs = n, this.styleSpecs = r, this.styleSchema = c, this.inlineContentSpecs = o, this.blockSchema = a, this.inlineContentSchema = s;
640
- }
641
- init() {
642
- var i;
643
- const t = Et(), n = /* @__PURE__ */ new Set();
644
- t.set("default", n);
645
- for (const [u, d] of Object.entries({
646
- ...this.opts.blockSpecs,
647
- ...this.opts.inlineContentSpecs,
648
- ...this.opts.styleSpecs
649
- }))
650
- (i = d.implementation) != null && i.runsBefore ? t.set(u, new Set(d.implementation.runsBefore)) : n.add(u);
651
- const o = yt(t), r = o.findIndex((u) => u.has("default")), a = (u) => 91 + (o.findIndex((p) => p.has(u)) + r) * 10, s = Object.fromEntries(
652
- Object.entries(this.opts.blockSpecs).map(([u, d]) => [
653
- u,
654
- ht(
655
- d.config,
656
- d.implementation,
657
- d.extensions,
658
- a(u)
659
- )
660
- ])
661
- ), c = Object.fromEntries(
662
- Object.entries(this.opts.inlineContentSpecs).map(
663
- ([u, d]) => {
664
- var p;
665
- return typeof d.config != "object" ? [u, d] : [
666
- u,
667
- {
668
- ...d,
669
- implementation: {
670
- ...d.implementation,
671
- node: (p = d.implementation) == null ? void 0 : p.node.extend({
672
- priority: a(u)
673
- })
674
- }
675
- }
676
- ];
677
- }
678
- )
679
- ), l = Object.fromEntries(
680
- Object.entries(this.opts.styleSpecs).map(([u, d]) => {
681
- var p;
682
- return [
683
- u,
684
- {
685
- ...d,
686
- implementation: {
687
- ...d.implementation,
688
- mark: (p = d.implementation) == null ? void 0 : p.mark.extend({
689
- priority: a(u)
690
- })
691
- }
692
- }
693
- ];
694
- })
695
- );
696
- return {
697
- blockSpecs: s,
698
- blockSchema: Object.fromEntries(
699
- Object.entries(s).map(([u, d]) => [u, d.config])
700
- ),
701
- inlineContentSpecs: se(c),
702
- styleSpecs: se(l),
703
- inlineContentSchema: ye(
704
- c
705
- ),
706
- styleSchema: Se(l)
707
- };
708
- }
709
- /**
710
- * Adds additional block specs to the current schema in a builder pattern.
711
- * This method allows extending the schema after it has been created.
712
- *
713
- * @param additionalBlockSpecs - Additional block specs to add to the schema
714
- * @returns The current schema instance for chaining
715
- */
716
- extend(t) {
717
- Object.assign(this.opts.blockSpecs, t.blockSpecs), Object.assign(this.opts.inlineContentSpecs, t.inlineContentSpecs), Object.assign(this.opts.styleSpecs, t.styleSpecs);
718
- const {
719
- blockSpecs: n,
720
- inlineContentSpecs: o,
721
- styleSpecs: r,
722
- blockSchema: a,
723
- inlineContentSchema: s,
724
- styleSchema: c
725
- } = this.init();
726
- return this.blockSpecs = n, this.styleSpecs = r, this.styleSchema = c, this.inlineContentSpecs = o, this.blockSchema = a, this.inlineContentSchema = s, this;
727
- }
728
- }
729
- function xt(e, t) {
559
+ function Tt(e, t) {
730
560
  let n, o;
731
- if (t.firstChild.descendants((r, a) => n ? !1 : !Lt(r) || r.attrs.id !== e ? !0 : (n = r, o = a + 1, !1)), !(n === void 0 || o === void 0))
561
+ if (t.firstChild.descendants((r, a) => n ? !1 : !Bt(r) || r.attrs.id !== e ? !0 : (n = r, o = a + 1, !1)), !(n === void 0 || o === void 0))
732
562
  return {
733
563
  node: n,
734
564
  posBeforeNode: o
735
565
  };
736
566
  }
737
- function Lt(e) {
567
+ function Bt(e) {
738
568
  return e.type.isInGroup("bnBlock");
739
569
  }
740
- const co = (e, t) => ({
570
+ const ko = (e, t) => ({
741
571
  tr: n,
742
572
  dispatch: o
743
- }) => (o && q(n, e, t), !0);
744
- function q(e, t, n, o, r) {
745
- const a = We(e.doc.resolve(t));
573
+ }) => (o && K(n, e, t), !0);
574
+ function K(e, t, n, o, r) {
575
+ const a = Je(e.doc.resolve(t));
746
576
  let s = null;
747
- a.blockNoteType === "table" && (s = Bt(e));
748
- const c = P(e);
577
+ a.blockNoteType === "table" && (s = Pt(e));
578
+ const i = O(e);
749
579
  if (o !== void 0 && r !== void 0 && o > r)
750
580
  throw new Error("Invalid replaceFromPos or replaceToPos");
751
- const l = c.nodes[a.blockNoteType], i = c.nodes[n.type || a.blockNoteType], u = i.isInGroup("bnBlock") ? i : c.nodes.blockContainer;
752
- if (a.isBlockContainer && i.isInGroup("blockContent")) {
581
+ const c = i.nodes[a.blockNoteType], l = i.nodes[n.type || a.blockNoteType], u = l.isInGroup("bnBlock") ? l : i.nodes.blockContainer;
582
+ if (a.isBlockContainer && l.isInGroup("blockContent")) {
753
583
  const d = o !== void 0 && o > a.blockContent.beforePos && o < a.blockContent.afterPos ? o - a.blockContent.beforePos - 1 : void 0, p = r !== void 0 && r > a.blockContent.beforePos && r < a.blockContent.afterPos ? r - a.blockContent.beforePos - 1 : void 0;
754
- ce(n, e, a), Mt(
584
+ de(n, e, a), At(
755
585
  n,
756
586
  e,
587
+ c,
757
588
  l,
758
- i,
759
589
  a,
760
590
  d,
761
591
  p
762
592
  );
763
- } else if (!a.isBlockContainer && i.isInGroup("bnBlock"))
764
- ce(n, e, a);
593
+ } else if (!a.isBlockContainer && l.isInGroup("bnBlock"))
594
+ de(n, e, a);
765
595
  else {
766
- const d = ge(a.bnBlock.node, c);
596
+ const d = ve(a.bnBlock.node, i);
767
597
  e.replaceWith(
768
598
  a.bnBlock.beforePos,
769
599
  a.bnBlock.afterPos,
770
- Z(
600
+ X(
771
601
  {
772
602
  children: d.children,
773
603
  // if no children are passed in, use existing children
774
604
  ...n
775
605
  },
776
- c
606
+ i
777
607
  )
778
608
  );
779
609
  return;
@@ -781,27 +611,27 @@ function q(e, t, n, o, r) {
781
611
  e.setNodeMarkup(a.bnBlock.beforePos, u, {
782
612
  ...a.bnBlock.node.attrs,
783
613
  ...n.props
784
- }), s && Tt(e, a, s);
614
+ }), s && Nt(e, a, s);
785
615
  }
786
- function Mt(e, t, n, o, r, a, s) {
787
- const c = P(t);
788
- let l = "keep";
616
+ function At(e, t, n, o, r, a, s) {
617
+ const i = O(t);
618
+ let c = "keep";
789
619
  if (e.content)
790
620
  if (typeof e.content == "string")
791
- l = te(
621
+ c = se(
792
622
  [e.content],
793
- c,
623
+ i,
794
624
  o.name
795
625
  );
796
626
  else if (Array.isArray(e.content))
797
- l = te(e.content, c, o.name);
627
+ c = se(e.content, i, o.name);
798
628
  else if (e.content.type === "tableContent")
799
- l = Fe(e.content, c);
629
+ c = Ye(e.content, i);
800
630
  else
801
- throw new je(e.content.type);
631
+ throw new et(e.content.type);
802
632
  else
803
- n.spec.content === "" || o.spec.content !== n.spec.content && (l = []);
804
- if (l === "keep")
633
+ n.spec.content === "" || o.spec.content !== n.spec.content && (c = []);
634
+ if (c === "keep")
805
635
  t.setNodeMarkup(r.blockContent.beforePos, o, {
806
636
  ...r.blockContent.node.attrs,
807
637
  ...e.props
@@ -811,12 +641,12 @@ function Mt(e, t, n, o, r, a, s) {
811
641
  ...r.blockContent.node.attrs,
812
642
  ...e.props
813
643
  });
814
- const i = r.blockContent.beforePos + 1 + (a ?? 0), u = r.blockContent.beforePos + 1 + (s ?? r.blockContent.node.content.size), d = t.doc.resolve(r.blockContent.beforePos).depth, p = t.doc.resolve(i).depth, h = t.doc.resolve(u).depth;
644
+ const l = r.blockContent.beforePos + 1 + (a ?? 0), u = r.blockContent.beforePos + 1 + (s ?? r.blockContent.node.content.size), d = t.doc.resolve(r.blockContent.beforePos).depth, p = t.doc.resolve(l).depth, h = t.doc.resolve(u).depth;
815
645
  t.replace(
816
- i,
646
+ l,
817
647
  u,
818
- new ke(
819
- O.from(l),
648
+ new we(
649
+ F.from(c),
820
650
  p - d - 1,
821
651
  h - d - 1
822
652
  )
@@ -830,20 +660,20 @@ function Mt(e, t, n, o, r, a, s) {
830
660
  ...r.blockContent.node.attrs,
831
661
  ...e.props
832
662
  },
833
- l
663
+ c
834
664
  )
835
665
  );
836
666
  }
837
- function ce(e, t, n) {
838
- const o = P(t);
667
+ function de(e, t, n) {
668
+ const o = O(t);
839
669
  if (e.children !== void 0 && e.children.length > 0) {
840
- const r = e.children.map((a) => Z(a, o));
670
+ const r = e.children.map((a) => X(a, o));
841
671
  if (n.childContainer)
842
672
  t.step(
843
- new at(
673
+ new ze(
844
674
  n.childContainer.beforePos + 1,
845
675
  n.childContainer.afterPos - 1,
846
- new ke(O.from(r), 0, 0)
676
+ new we(F.from(r), 0, 0)
847
677
  )
848
678
  );
849
679
  else {
@@ -856,65 +686,65 @@ function ce(e, t, n) {
856
686
  }
857
687
  }
858
688
  }
859
- function io(e, t, n, o, r) {
860
- const a = typeof t == "string" ? t : t.id, s = xt(a, e.doc);
689
+ function yo(e, t, n, o, r) {
690
+ const a = typeof t == "string" ? t : t.id, s = Tt(a, e.doc);
861
691
  if (!s)
862
692
  throw new Error(`Block with ID ${a} not found`);
863
- q(
693
+ K(
864
694
  e,
865
695
  s.posBeforeNode,
866
696
  n,
867
697
  o,
868
698
  r
869
699
  );
870
- const c = e.doc.resolve(s.posBeforeNode + 1).node(), l = P(e);
871
- return ge(c, l);
700
+ const i = e.doc.resolve(s.posBeforeNode + 1).node(), c = O(e);
701
+ return ve(i, c);
872
702
  }
873
- function Bt(e) {
703
+ function Pt(e) {
874
704
  const t = "selection" in e ? e.selection : null;
875
- if (!(t instanceof Ce))
705
+ if (!(t instanceof ke))
876
706
  return null;
877
707
  const n = e.doc.resolve(t.head);
878
708
  let o = -1, r = -1;
879
- for (let x = n.depth; x >= 0; x--) {
880
- const E = n.node(x).type.name;
881
- if (o < 0 && (E === "tableCell" || E === "tableHeader") && (o = x), E === "table") {
882
- r = x;
709
+ for (let w = n.depth; w >= 0; w--) {
710
+ const x = n.node(w).type.name;
711
+ if (o < 0 && (x === "tableCell" || x === "tableHeader") && (o = w), x === "table") {
712
+ r = w;
883
713
  break;
884
714
  }
885
715
  }
886
716
  if (o < 0 || r < 0)
887
717
  return null;
888
- const a = n.before(o), s = n.before(r), c = e.doc.nodeAt(s);
889
- if (!c || c.type.name !== "table")
718
+ const a = n.before(o), s = n.before(r), i = e.doc.nodeAt(s);
719
+ if (!i || i.type.name !== "table")
890
720
  return null;
891
- const l = me.get(c), i = a - (s + 1), u = l.map.indexOf(i);
721
+ const c = be.get(i), l = a - (s + 1), u = c.map.indexOf(l);
892
722
  if (u < 0)
893
723
  return null;
894
- const d = Math.floor(u / l.width), p = u % l.width, f = a + 1 + 1, S = Math.max(0, t.head - f);
895
- return { row: d, col: p, offset: S };
724
+ const d = Math.floor(u / c.width), p = u % c.width, f = a + 1 + 1, E = Math.max(0, t.head - f);
725
+ return { row: d, col: p, offset: E };
896
726
  }
897
- function Tt(e, t, n) {
898
- var x;
727
+ function Nt(e, t, n) {
728
+ var w;
899
729
  if (t.blockNoteType !== "table")
900
730
  return !1;
901
731
  let o = -1;
902
732
  if (t.isBlockContainer)
903
733
  o = e.mapping.map(t.blockContent.beforePos);
904
734
  else {
905
- const E = e.mapping.map(t.bnBlock.beforePos), A = E + (((x = e.doc.nodeAt(E)) == null ? void 0 : x.nodeSize) || 0);
906
- e.doc.nodesBetween(E, A, (g, L) => g.type.name === "table" ? (o = L, !1) : !0);
735
+ const x = e.mapping.map(t.bnBlock.beforePos), P = x + (((w = e.doc.nodeAt(x)) == null ? void 0 : w.nodeSize) || 0);
736
+ e.doc.nodesBetween(x, P, (m, S) => m.type.name === "table" ? (o = S, !1) : !0);
907
737
  }
908
738
  const r = o >= 0 ? e.doc.nodeAt(o) : null;
909
739
  if (!r || r.type.name !== "table")
910
740
  return !1;
911
- const a = me.get(r), s = Math.max(0, Math.min(n.row, a.height - 1)), c = Math.max(0, Math.min(n.col, a.width - 1)), l = s * a.width + c, i = a.map[l];
912
- if (i == null)
741
+ const a = be.get(r), s = Math.max(0, Math.min(n.row, a.height - 1)), i = Math.max(0, Math.min(n.col, a.width - 1)), c = s * a.width + i, l = a.map[c];
742
+ if (l == null)
913
743
  return !1;
914
- const d = o + 1 + i + 1, p = e.doc.nodeAt(d), h = d + 1, f = p ? p.content.size : 0, S = h + Math.max(0, Math.min(n.offset, f));
915
- return "selection" in e && e.setSelection(Ce.create(e.doc, S)), !0;
744
+ const d = o + 1 + l + 1, p = e.doc.nodeAt(d), h = d + 1, f = p ? p.content.size : 0, E = h + Math.max(0, Math.min(n.offset, f));
745
+ return "selection" in e && e.setSelection(ke.create(e.doc, E)), !0;
916
746
  }
917
- const B = {
747
+ const T = {
918
748
  gray: {
919
749
  text: "#9b9a97",
920
750
  background: "#ebeced"
@@ -951,7 +781,7 @@ const B = {
951
781
  text: "#ad1a72",
952
782
  background: "#f4dfeb"
953
783
  }
954
- }, lo = {
784
+ }, vo = {
955
785
  gray: {
956
786
  text: "#bebdb8",
957
787
  background: "#9b9a97"
@@ -988,7 +818,7 @@ const B = {
988
818
  text: "#da208f",
989
819
  background: "#ad1a72"
990
820
  }
991
- }, m = {
821
+ }, g = {
992
822
  backgroundColor: {
993
823
  default: "default"
994
824
  },
@@ -1001,30 +831,30 @@ const B = {
1001
831
  }
1002
832
  }, y = (e) => {
1003
833
  const t = {};
1004
- return e.hasAttribute("data-background-color") ? t.backgroundColor = e.getAttribute("data-background-color") : e.style.backgroundColor && (t.backgroundColor = e.style.backgroundColor), e.hasAttribute("data-text-color") ? t.textColor = e.getAttribute("data-text-color") : e.style.color && (t.textColor = e.style.color), t.textAlignment = m.textAlignment.values.includes(
834
+ return e.hasAttribute("data-background-color") ? t.backgroundColor = e.getAttribute("data-background-color") : e.style.backgroundColor && (t.backgroundColor = e.style.backgroundColor), e.hasAttribute("data-text-color") ? t.textColor = e.getAttribute("data-text-color") : e.style.color && (t.textColor = e.style.color), t.textAlignment = g.textAlignment.values.includes(
1005
835
  e.style.textAlign
1006
836
  ) ? e.style.textAlign : void 0, t;
1007
- }, T = (e, t) => {
1008
- e.backgroundColor && e.backgroundColor !== m.backgroundColor.default && (t.style.backgroundColor = e.backgroundColor in B ? B[e.backgroundColor].background : e.backgroundColor), e.textColor && e.textColor !== m.textColor.default && (t.style.color = e.textColor in B ? B[e.textColor].text : e.textColor), e.textAlignment && e.textAlignment !== m.textAlignment.default && (t.style.textAlign = e.textAlignment);
1009
- }, uo = (e = "backgroundColor") => ({
1010
- default: m.backgroundColor.default,
1011
- parseHTML: (t) => t.hasAttribute("data-background-color") ? t.getAttribute("data-background-color") : t.style.backgroundColor ? t.style.backgroundColor : m.backgroundColor.default,
1012
- renderHTML: (t) => t[e] === m.backgroundColor.default ? {} : {
837
+ }, A = (e, t) => {
838
+ e.backgroundColor && e.backgroundColor !== g.backgroundColor.default && (t.style.backgroundColor = e.backgroundColor in T ? T[e.backgroundColor].background : e.backgroundColor), e.textColor && e.textColor !== g.textColor.default && (t.style.color = e.textColor in T ? T[e.textColor].text : e.textColor), e.textAlignment && e.textAlignment !== g.textAlignment.default && (t.style.textAlign = e.textAlignment);
839
+ }, Eo = (e = "backgroundColor") => ({
840
+ default: g.backgroundColor.default,
841
+ parseHTML: (t) => t.hasAttribute("data-background-color") ? t.getAttribute("data-background-color") : t.style.backgroundColor ? t.style.backgroundColor : g.backgroundColor.default,
842
+ renderHTML: (t) => t[e] === g.backgroundColor.default ? {} : {
1013
843
  "data-background-color": t[e]
1014
844
  }
1015
- }), po = (e = "textColor") => ({
1016
- default: m.textColor.default,
1017
- parseHTML: (t) => t.hasAttribute("data-text-color") ? t.getAttribute("data-text-color") : t.style.color ? t.style.color : m.textColor.default,
1018
- renderHTML: (t) => t[e] === m.textColor.default ? {} : {
845
+ }), xo = (e = "textColor") => ({
846
+ default: g.textColor.default,
847
+ parseHTML: (t) => t.hasAttribute("data-text-color") ? t.getAttribute("data-text-color") : t.style.color ? t.style.color : g.textColor.default,
848
+ renderHTML: (t) => t[e] === g.textColor.default ? {} : {
1019
849
  "data-text-color": t[e]
1020
850
  }
1021
- }), fo = (e = "textAlignment") => ({
1022
- default: m.textAlignment.default,
1023
- parseHTML: (t) => t.hasAttribute("data-text-alignment") ? t.getAttribute("data-text-alignment") : t.style.textAlign ? t.style.textAlign : m.textAlignment.default,
1024
- renderHTML: (t) => t[e] === m.textAlignment.default ? {} : {
851
+ }), wo = (e = "textAlignment") => ({
852
+ default: g.textAlignment.default,
853
+ parseHTML: (t) => t.hasAttribute("data-text-alignment") ? t.getAttribute("data-text-alignment") : t.style.textAlign ? t.style.textAlign : g.textAlignment.default,
854
+ renderHTML: (t) => t[e] === g.textAlignment.default ? {} : {
1025
855
  "data-text-alignment": t[e]
1026
856
  }
1027
- }), W = (e, t) => {
857
+ }), $ = (e, t) => {
1028
858
  const n = e.querySelector(
1029
859
  t
1030
860
  );
@@ -1032,27 +862,51 @@ const B = {
1032
862
  return;
1033
863
  const o = e.querySelector("figcaption"), r = (o == null ? void 0 : o.textContent) ?? void 0;
1034
864
  return { targetElement: n, caption: r };
1035
- }, At = (e, t, n) => {
865
+ }, I = k(({ editor: e }) => {
866
+ const t = ye(void 0);
867
+ function n() {
868
+ t.setState(void 0);
869
+ }
870
+ return {
871
+ key: "filePanel",
872
+ store: t,
873
+ mount({ signal: o }) {
874
+ const r = e.onChange(
875
+ n,
876
+ // Don't trigger if the changes are caused by a remote user.
877
+ !1
878
+ ), a = e.onSelectionChange(
879
+ n,
880
+ // Don't trigger if the changes are caused by a remote user.
881
+ !1
882
+ );
883
+ o.addEventListener("abort", () => {
884
+ r(), a();
885
+ });
886
+ },
887
+ closeMenu: n,
888
+ showMenu(o) {
889
+ t.setState(o);
890
+ }
891
+ };
892
+ }), Ht = (e, t, n) => {
1036
893
  const o = document.createElement("div");
1037
894
  o.className = "bn-add-file-button";
1038
895
  const r = document.createElement("div");
1039
896
  r.className = "bn-add-file-button-icon", n ? r.appendChild(n) : r.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>', o.appendChild(r);
1040
897
  const a = document.createElement("p");
1041
898
  a.className = "bn-add-file-button-text", a.innerHTML = e.type in t.dictionary.file_blocks.add_button_text ? t.dictionary.file_blocks.add_button_text[e.type] : t.dictionary.file_blocks.add_button_text.file, o.appendChild(a);
1042
- const s = (l) => {
1043
- l.preventDefault();
1044
- }, c = () => {
1045
- t.transact(
1046
- (l) => l.setMeta(t.filePanel.plugins[0], {
1047
- block: e
1048
- })
1049
- );
899
+ const s = (c) => {
900
+ c.preventDefault(), c.stopPropagation();
901
+ }, i = () => {
902
+ var c;
903
+ t.isEditable && ((c = t.getExtension(I)) == null || c.showMenu(e.id));
1050
904
  };
1051
905
  return o.addEventListener(
1052
906
  "mousedown",
1053
907
  s,
1054
908
  !0
1055
- ), o.addEventListener("click", c, !0), {
909
+ ), o.addEventListener("click", i, !0), {
1056
910
  dom: o,
1057
911
  destroy: () => {
1058
912
  o.removeEventListener(
@@ -1061,45 +915,45 @@ const B = {
1061
915
  !0
1062
916
  ), o.removeEventListener(
1063
917
  "click",
1064
- c,
918
+ i,
1065
919
  !0
1066
920
  );
1067
921
  }
1068
922
  };
1069
- }, Nt = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>', Ht = (e) => {
923
+ }, It = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>', Dt = (e) => {
1070
924
  const t = document.createElement("div");
1071
925
  t.className = "bn-file-name-with-icon";
1072
926
  const n = document.createElement("div");
1073
- n.className = "bn-file-icon", n.innerHTML = Nt, t.appendChild(n);
927
+ n.className = "bn-file-icon", n.innerHTML = It, t.appendChild(n);
1074
928
  const o = document.createElement("p");
1075
929
  return o.className = "bn-file-name", o.textContent = e.props.name, t.appendChild(o), {
1076
930
  dom: t
1077
931
  };
1078
- }, X = (e, t, n, o) => {
932
+ }, Q = (e, t, n, o) => {
1079
933
  const r = document.createElement("div");
1080
934
  if (r.className = "bn-file-block-content-wrapper", e.props.url === "") {
1081
- const s = At(e, t, o);
935
+ const s = Ht(e, t, o);
1082
936
  r.appendChild(s.dom);
1083
- const c = t.onUploadStart((l) => {
1084
- if (l === e.id) {
937
+ const i = t.onUploadStart((c) => {
938
+ if (c === e.id) {
1085
939
  r.removeChild(s.dom);
1086
- const i = document.createElement("div");
1087
- i.className = "bn-file-loading-preview", i.textContent = "Loading...", r.appendChild(i);
940
+ const l = document.createElement("div");
941
+ l.className = "bn-file-loading-preview", l.textContent = "Loading...", r.appendChild(l);
1088
942
  }
1089
943
  });
1090
944
  return {
1091
945
  dom: r,
1092
946
  destroy: () => {
1093
- c(), s.destroy();
947
+ i(), s.destroy();
1094
948
  }
1095
949
  };
1096
950
  }
1097
951
  const a = { dom: r };
1098
952
  if (e.props.showPreview === !1 || !n) {
1099
- const s = Ht(e);
953
+ const s = Dt(e);
1100
954
  r.appendChild(s.dom), a.destroy = () => {
1101
- var c;
1102
- (c = s.destroy) == null || c.call(s);
955
+ var i;
956
+ (i = s.destroy) == null || i.call(s);
1103
957
  };
1104
958
  } else
1105
959
  r.appendChild(n.dom);
@@ -1108,18 +962,18 @@ const B = {
1108
962
  s.className = "bn-file-caption", s.textContent = e.props.caption, r.appendChild(s);
1109
963
  }
1110
964
  return a;
1111
- }, K = (e, t) => {
965
+ }, J = (e, t) => {
1112
966
  const n = document.createElement("figure"), o = document.createElement("figcaption");
1113
967
  return o.textContent = t, n.appendChild(e), n.appendChild(o), { dom: n };
1114
- }, F = (e, t) => {
968
+ }, U = (e, t) => {
1115
969
  const n = document.createElement("div"), o = document.createElement("p");
1116
970
  return o.textContent = t, n.appendChild(e), n.appendChild(o), {
1117
971
  dom: n
1118
972
  };
1119
- }, ie = (e) => ({ url: e.src || void 0 }), It = '<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>', Pt = (e) => ({
973
+ }, ue = (e) => ({ url: e.src || void 0 }), Ot = '<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>', _t = (e) => ({
1120
974
  type: "audio",
1121
975
  propSchema: {
1122
- backgroundColor: m.backgroundColor,
976
+ backgroundColor: g.backgroundColor,
1123
977
  // File name.
1124
978
  name: {
1125
979
  default: ""
@@ -1137,40 +991,40 @@ const B = {
1137
991
  }
1138
992
  },
1139
993
  content: "none"
1140
- }), Ot = (e = {}) => (t) => {
994
+ }), Vt = (e = {}) => (t) => {
1141
995
  if (t.tagName === "AUDIO") {
1142
996
  if (t.closest("figure"))
1143
997
  return;
1144
998
  const { backgroundColor: n } = y(t);
1145
999
  return {
1146
- ...ie(t),
1000
+ ...ue(t),
1147
1001
  backgroundColor: n
1148
1002
  };
1149
1003
  }
1150
1004
  if (t.tagName === "FIGURE") {
1151
- const n = W(t, "audio");
1005
+ const n = $(t, "audio");
1152
1006
  if (!n)
1153
1007
  return;
1154
1008
  const { targetElement: o, caption: r } = n, { backgroundColor: a } = y(t);
1155
1009
  return {
1156
- ...ie(o),
1010
+ ...ue(o),
1157
1011
  backgroundColor: a,
1158
1012
  caption: r
1159
1013
  };
1160
1014
  }
1161
- }, Dt = (e = {}) => (t, n) => {
1015
+ }, Rt = (e = {}) => (t, n) => {
1162
1016
  const o = document.createElement("div");
1163
- o.innerHTML = e.icon ?? It;
1017
+ o.innerHTML = e.icon ?? Ot;
1164
1018
  const r = document.createElement("audio");
1165
1019
  return r.className = "bn-audio", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((a) => {
1166
1020
  r.src = a;
1167
- }) : r.src = t.props.url, r.controls = !0, r.contentEditable = "false", r.draggable = !1, X(
1021
+ }) : r.src = t.props.url, r.controls = !0, r.contentEditable = "false", r.draggable = !1, Q(
1168
1022
  t,
1169
1023
  n,
1170
1024
  { dom: r },
1171
1025
  o.firstElementChild
1172
1026
  );
1173
- }, _t = (e = {}) => (t, n) => {
1027
+ }, Wt = (e = {}) => (t, n) => {
1174
1028
  if (!t.props.url) {
1175
1029
  const r = document.createElement("p");
1176
1030
  return r.textContent = "Add audio", {
@@ -1178,114 +1032,46 @@ const B = {
1178
1032
  };
1179
1033
  }
1180
1034
  let o;
1181
- return t.props.showPreview ? (o = document.createElement("audio"), o.src = t.props.url) : (o = document.createElement("a"), o.href = t.props.url, o.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? K(o, t.props.caption) : F(o, t.props.caption) : {
1035
+ return t.props.showPreview ? (o = document.createElement("audio"), o.src = t.props.url) : (o = document.createElement("a"), o.href = t.props.url, o.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? J(o, t.props.caption) : U(o, t.props.caption) : {
1182
1036
  dom: o
1183
1037
  };
1184
- }, Vt = v(
1185
- Pt,
1038
+ }, Ft = v(
1039
+ _t,
1186
1040
  (e) => ({
1187
1041
  meta: {
1188
1042
  fileBlockAccept: ["audio/*"]
1189
1043
  },
1190
- parse: Ot(e),
1191
- render: Dt(e),
1192
- toExternalHTML: _t(e),
1044
+ parse: Vt(e),
1045
+ render: Rt(e),
1046
+ toExternalHTML: Wt(e),
1193
1047
  runsBefore: ["file"]
1194
1048
  })
1195
- );
1196
- class Rt {
1197
- constructor() {
1198
- // eslint-disable-next-line @typescript-eslint/ban-types
1199
- C(this, "callbacks", {});
1200
- }
1201
- on(t, n) {
1202
- return this.callbacks[t] || (this.callbacks[t] = []), this.callbacks[t].push(n), () => this.off(t, n);
1203
- }
1204
- emit(t, ...n) {
1205
- const o = this.callbacks[t];
1206
- o && o.forEach((r) => r.apply(this, n));
1207
- }
1208
- off(t, n) {
1209
- const o = this.callbacks[t];
1210
- o && (n ? this.callbacks[t] = o.filter((r) => r !== n) : delete this.callbacks[t]);
1211
- }
1212
- removeAllListeners() {
1213
- this.callbacks = {};
1214
- }
1215
- }
1216
- class Wt extends Rt {
1217
- // eslint-disable-next-line
1218
- constructor(...n) {
1219
- super();
1220
- C(this, "plugins", []);
1221
- /**
1222
- * Input rules for the block
1223
- */
1224
- C(this, "inputRules");
1225
- /**
1226
- * A mapping of a keyboard shortcut to a function that will be called when the shortcut is pressed
1227
- *
1228
- * The keys are in the format:
1229
- * - Key names may be strings like `Shift-Ctrl-Enter`—a key identifier prefixed with zero or more modifiers
1230
- * - Key identifiers are based on the strings that can appear in KeyEvent.key
1231
- * - Use lowercase letters to refer to letter keys (or uppercase letters if you want shift to be held)
1232
- * - You may use `Space` as an alias for the " " name
1233
- * - Modifiers can be given in any order: `Shift-` (or `s-`), `Alt-` (or `a-`), `Ctrl-` (or `c-` or `Control-`) and `Cmd-` (or `m-` or `Meta-`)
1234
- * - For characters that are created by holding shift, the Shift- prefix is implied, and should not be added explicitly
1235
- * - You can use Mod- as a shorthand for Cmd- on Mac and Ctrl- on other platforms
1236
- *
1237
- * @example
1238
- * ```typescript
1239
- * keyboardShortcuts: {
1240
- * "Mod-Enter": (ctx) => { return true; },
1241
- * "Shift-Ctrl-Space": (ctx) => { return true; },
1242
- * "a": (ctx) => { return true; },
1243
- * "Space": (ctx) => { return true; }
1244
- * }
1245
- * ```
1246
- */
1247
- C(this, "keyboardShortcuts");
1248
- C(this, "tiptapExtensions");
1249
- }
1250
- static key() {
1251
- throw new Error("You must implement the key method in your extension");
1252
- }
1253
- addProsemirrorPlugin(n) {
1254
- this.plugins.push(n);
1255
- }
1256
- get priority() {
1257
- }
1258
- }
1259
- function w(e) {
1260
- const t = Object.create(Wt.prototype);
1261
- return t.key = e.key, t.inputRules = e.inputRules, t.keyboardShortcuts = e.keyboardShortcuts, t.plugins = e.plugins ?? [], t.tiptapExtensions = e.tiptapExtensions, t;
1262
- }
1263
- const le = Symbol.for("blocknote.shikiParser"), U = Symbol.for(
1049
+ ), pe = Symbol.for("blocknote.shikiParser"), j = Symbol.for(
1264
1050
  "blocknote.shikiHighlighterPromise"
1265
1051
  );
1266
- function Ft(e) {
1052
+ function $t(e) {
1267
1053
  const t = globalThis;
1268
1054
  let n, o, r = !1;
1269
- return tt({
1055
+ return dt({
1270
1056
  parser: (s) => {
1271
1057
  if (!e.createHighlighter)
1272
1058
  return process.env.NODE_ENV === "development" && !r && (console.log(
1273
1059
  "For syntax highlighting of code blocks, you must provide a `createCodeBlockSpec({ createHighlighter: () => ... })` function"
1274
1060
  ), r = !0), [];
1275
1061
  if (!n)
1276
- return t[U] = t[U] || e.createHighlighter(), t[U].then(
1277
- (l) => {
1278
- n = l;
1062
+ return t[j] = t[j] || e.createHighlighter(), t[j].then(
1063
+ (c) => {
1064
+ n = c;
1279
1065
  }
1280
1066
  );
1281
- const c = we(e, s.language);
1282
- return !c || c === "text" || c === "none" || c === "plaintext" || c === "txt" ? [] : n.getLoadedLanguages().includes(c) ? (o || (o = t[le] || nt(n), t[le] = o), o(s)) : n.loadLanguage(c);
1067
+ const i = Te(e, s.language);
1068
+ return !i || i === "text" || i === "none" || i === "plaintext" || i === "txt" ? [] : n.getLoadedLanguages().includes(i) ? (o || (o = t[pe] || ut(n), t[pe] = o), o(s)) : n.loadLanguage(i);
1283
1069
  },
1284
1070
  languageExtractor: (s) => s.attrs.language,
1285
1071
  nodeTypes: ["codeBlock"]
1286
1072
  });
1287
1073
  }
1288
- const jt = ({ defaultLanguage: e = "text" }) => ({
1074
+ const Ut = ({ defaultLanguage: e = "text" }) => ({
1289
1075
  type: "codeBlock",
1290
1076
  propSchema: {
1291
1077
  language: {
@@ -1293,8 +1079,8 @@ const jt = ({ defaultLanguage: e = "text" }) => ({
1293
1079
  }
1294
1080
  },
1295
1081
  content: "inline"
1296
- }), Ut = v(
1297
- jt,
1082
+ }), qt = v(
1083
+ Ut,
1298
1084
  (e) => ({
1299
1085
  meta: {
1300
1086
  code: !0,
@@ -1309,7 +1095,7 @@ const jt = ({ defaultLanguage: e = "text" }) => ({
1309
1095
  return { language: n.getAttribute("data-language") || ((a = n.className.split(" ").find((s) => s.includes("language-"))) == null ? void 0 : a.replace("language-", "")) };
1310
1096
  },
1311
1097
  parseContent: ({ el: t, schema: n }) => {
1312
- const o = R.fromSchema(n), r = t.firstElementChild;
1098
+ const o = xe.fromSchema(n), r = t.firstElementChild;
1313
1099
  return o.parse(r, {
1314
1100
  preserveWhitespace: "full",
1315
1101
  topNode: n.nodes.codeBlock.create()
@@ -1320,20 +1106,20 @@ const jt = ({ defaultLanguage: e = "text" }) => ({
1320
1106
  r.appendChild(a);
1321
1107
  let s;
1322
1108
  if (e.supportedLanguages) {
1323
- const c = document.createElement("select");
1109
+ const i = document.createElement("select");
1324
1110
  Object.entries(e.supportedLanguages ?? {}).forEach(
1325
1111
  ([u, { name: d }]) => {
1326
1112
  const p = document.createElement("option");
1327
- p.value = u, p.text = d, c.appendChild(p);
1113
+ p.value = u, p.text = d, i.appendChild(p);
1328
1114
  }
1329
- ), c.value = t.props.language || e.defaultLanguage || "text";
1330
- const l = (u) => {
1115
+ ), i.value = t.props.language || e.defaultLanguage || "text";
1116
+ const c = (u) => {
1331
1117
  const d = u.target.value;
1332
1118
  n.updateBlock(t.id, { props: { language: d } });
1333
1119
  };
1334
- c.addEventListener("change", l), s = () => c.removeEventListener("change", l);
1335
- const i = document.createElement("div");
1336
- i.contentEditable = "false", i.appendChild(c), o.appendChild(i);
1120
+ i.addEventListener("change", c), s = () => i.removeEventListener("change", c);
1121
+ const l = document.createElement("div");
1122
+ l.contentEditable = "false", l.appendChild(i), o.appendChild(l);
1337
1123
  }
1338
1124
  return o.appendChild(r), {
1339
1125
  dom: o,
@@ -1352,11 +1138,11 @@ const jt = ({ defaultLanguage: e = "text" }) => ({
1352
1138
  }
1353
1139
  }),
1354
1140
  (e) => [
1355
- w({
1141
+ k({
1356
1142
  key: "code-block-highlighter",
1357
- plugins: [Ft(e)]
1143
+ prosemirrorPlugins: [$t(e)]
1358
1144
  }),
1359
- w({
1145
+ k({
1360
1146
  key: "code-block-keyboard-shortcuts",
1361
1147
  keyboardShortcuts: {
1362
1148
  Delete: ({ editor: t }) => t.transact((n) => {
@@ -1374,18 +1160,18 @@ const jt = ({ defaultLanguage: e = "text" }) => ({
1374
1160
  const { block: o, nextBlock: r } = t.getTextCursorPosition();
1375
1161
  if (o.type !== "codeBlock")
1376
1162
  return !1;
1377
- const { $from: a } = n.selection, s = a.parentOffset === a.parent.nodeSize - 2, c = a.parent.textContent.endsWith(`
1163
+ const { $from: a } = n.selection, s = a.parentOffset === a.parent.nodeSize - 2, i = a.parent.textContent.endsWith(`
1378
1164
 
1379
1165
  `);
1380
- if (s && c) {
1166
+ if (s && i) {
1381
1167
  if (n.delete(a.pos - 2, a.pos), r)
1382
1168
  return t.setTextCursorPosition(r, "start"), !0;
1383
- const [l] = t.insertBlocks(
1169
+ const [c] = t.insertBlocks(
1384
1170
  [{ type: "paragraph" }],
1385
1171
  o,
1386
1172
  "after"
1387
1173
  );
1388
- return t.setTextCursorPosition(l, "start"), !0;
1174
+ return t.setTextCursorPosition(c, "start"), !0;
1389
1175
  }
1390
1176
  return n.insertText(`
1391
1177
  `), !0;
@@ -1412,7 +1198,7 @@ const jt = ({ defaultLanguage: e = "text" }) => ({
1412
1198
  type: "codeBlock",
1413
1199
  props: {
1414
1200
  language: {
1415
- language: we(e, n) ?? n
1201
+ language: Te(e, n) ?? n
1416
1202
  }.language
1417
1203
  },
1418
1204
  content: []
@@ -1423,18 +1209,18 @@ const jt = ({ defaultLanguage: e = "text" }) => ({
1423
1209
  })
1424
1210
  ]
1425
1211
  );
1426
- function we(e, t) {
1212
+ function Te(e, t) {
1427
1213
  var n;
1428
1214
  return (n = Object.entries(e.supportedLanguages ?? {}).find(
1429
1215
  ([o, { aliases: r }]) => (r == null ? void 0 : r.includes(t)) || o === t
1430
1216
  )) == null ? void 0 : n[0];
1431
1217
  }
1432
- const $t = () => ({
1218
+ const jt = () => ({
1433
1219
  type: "divider",
1434
1220
  propSchema: {},
1435
1221
  content: "none"
1436
1222
  }), Gt = v(
1437
- $t,
1223
+ jt,
1438
1224
  {
1439
1225
  meta: {
1440
1226
  isolating: !1
@@ -1450,7 +1236,7 @@ const $t = () => ({
1450
1236
  }
1451
1237
  },
1452
1238
  [
1453
- w({
1239
+ k({
1454
1240
  key: "divider-block-shortcuts",
1455
1241
  inputRules: [
1456
1242
  {
@@ -1462,10 +1248,10 @@ const $t = () => ({
1462
1248
  ]
1463
1249
  })
1464
1250
  ]
1465
- ), de = (e) => ({ url: e.src || void 0 }), Zt = () => ({
1251
+ ), fe = (e) => ({ url: e.src || void 0 }), Zt = () => ({
1466
1252
  type: "file",
1467
1253
  propSchema: {
1468
- backgroundColor: m.backgroundColor,
1254
+ backgroundColor: g.backgroundColor,
1469
1255
  // File name.
1470
1256
  name: {
1471
1257
  default: ""
@@ -1486,28 +1272,28 @@ const $t = () => ({
1486
1272
  return;
1487
1273
  const { backgroundColor: t } = y(e);
1488
1274
  return {
1489
- ...de(e),
1275
+ ...fe(e),
1490
1276
  backgroundColor: t
1491
1277
  };
1492
1278
  }
1493
1279
  if (e.tagName === "FIGURE") {
1494
- const t = W(e, "embed");
1280
+ const t = $(e, "embed");
1495
1281
  if (!t)
1496
1282
  return;
1497
1283
  const { targetElement: n, caption: o } = t, { backgroundColor: r } = y(e);
1498
1284
  return {
1499
- ...de(n),
1285
+ ...fe(n),
1500
1286
  backgroundColor: r,
1501
1287
  caption: o
1502
1288
  };
1503
1289
  }
1504
- }, qt = v(Zt, {
1290
+ }, Xt = v(Zt, {
1505
1291
  meta: {
1506
1292
  fileBlockAccept: ["*/*"]
1507
1293
  },
1508
1294
  parse: zt(),
1509
1295
  render(e, t) {
1510
- return X(e, t);
1296
+ return Q(e, t);
1511
1297
  },
1512
1298
  toExternalHTML(e) {
1513
1299
  if (!e.props.url) {
@@ -1517,17 +1303,17 @@ const $t = () => ({
1517
1303
  };
1518
1304
  }
1519
1305
  const t = document.createElement("a");
1520
- return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ? F(t, e.props.caption) : {
1306
+ return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ? U(t, e.props.caption) : {
1521
1307
  dom: t
1522
1308
  };
1523
1309
  }
1524
- }), Xt = {
1310
+ }), Kt = {
1525
1311
  set: (e, t) => window.localStorage.setItem(
1526
1312
  `toggle-${e.id}`,
1527
1313
  t ? "true" : "false"
1528
1314
  ),
1529
1315
  get: (e) => window.localStorage.getItem(`toggle-${e.id}`) === "true"
1530
- }, xe = (e, t, n, o = Xt) => {
1316
+ }, Be = (e, t, n, o = Kt) => {
1531
1317
  if ("isToggleable" in e.props && !e.props.isToggleable)
1532
1318
  return {
1533
1319
  dom: n
@@ -1537,17 +1323,17 @@ const $t = () => ({
1537
1323
  const s = document.createElement("button");
1538
1324
  s.className = "bn-toggle-button", s.type = "button", s.innerHTML = // https://fonts.google.com/icons?selected=Material+Symbols+Rounded:chevron_right:FILL@0;wght@700;GRAD@0;opsz@24&icon.query=chevron&icon.style=Rounded&icon.size=24&icon.color=%23e8eaed
1539
1325
  '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="CURRENTCOLOR"><path d="M320-200v-560l440 280-440 280Z"/></svg>';
1540
- const c = (f) => f.preventDefault();
1541
- s.addEventListener("mousedown", c);
1542
- const l = () => {
1326
+ const i = (f) => f.preventDefault();
1327
+ s.addEventListener("mousedown", i);
1328
+ const c = () => {
1543
1329
  var f;
1544
- a.getAttribute("data-show-children") === "true" ? (a.setAttribute("data-show-children", "false"), o.set(t.getBlock(e), !1), r.contains(i) && r.removeChild(i)) : (a.setAttribute("data-show-children", "true"), o.set(t.getBlock(e), !0), ((f = t.getBlock(e)) == null ? void 0 : f.children.length) === 0 && !r.contains(i) && r.appendChild(i));
1330
+ a.getAttribute("data-show-children") === "true" ? (a.setAttribute("data-show-children", "false"), o.set(t.getBlock(e), !1), r.contains(l) && r.removeChild(l)) : (a.setAttribute("data-show-children", "true"), o.set(t.getBlock(e), !0), t.isEditable && ((f = t.getBlock(e)) == null ? void 0 : f.children.length) === 0 && !r.contains(l) && r.appendChild(l));
1545
1331
  };
1546
- s.addEventListener("click", l), a.appendChild(s), a.appendChild(n);
1547
- const i = document.createElement("button");
1548
- i.className = "bn-toggle-add-block-button", i.type = "button", i.textContent = t.dictionary.toggle_blocks.add_block_button;
1332
+ s.addEventListener("click", c), a.appendChild(s), a.appendChild(n);
1333
+ const l = document.createElement("button");
1334
+ l.className = "bn-toggle-add-block-button", l.type = "button", l.textContent = t.dictionary.toggle_blocks.add_block_button;
1549
1335
  const u = (f) => f.preventDefault();
1550
- i.addEventListener(
1336
+ l.addEventListener(
1551
1337
  "mousedown",
1552
1338
  u
1553
1339
  );
@@ -1560,44 +1346,50 @@ const $t = () => ({
1560
1346
  t.setTextCursorPosition(f.children[0].id, "end"), t.focus();
1561
1347
  });
1562
1348
  };
1563
- i.addEventListener("click", d), r.appendChild(a);
1349
+ l.addEventListener("click", d), r.appendChild(a);
1564
1350
  let p = e.children.length;
1565
1351
  const h = t.onChange(() => {
1566
- var S;
1567
- const f = ((S = t.getBlock(e)) == null ? void 0 : S.children.length) ?? 0;
1568
- f > p ? (a.getAttribute("data-show-children") === "false" && (a.setAttribute("data-show-children", "true"), o.set(t.getBlock(e), !0)), r.contains(i) && r.removeChild(i)) : f === 0 && f < p && (a.getAttribute("data-show-children") === "true" && (a.setAttribute("data-show-children", "false"), o.set(t.getBlock(e), !1)), r.contains(i) && r.removeChild(i)), p = f;
1352
+ var E;
1353
+ const f = ((E = t.getBlock(e)) == null ? void 0 : E.children.length) ?? 0;
1354
+ f > p ? (a.getAttribute("data-show-children") === "false" && (a.setAttribute("data-show-children", "true"), o.set(t.getBlock(e), !0)), r.contains(l) && r.removeChild(l)) : f === 0 && f < p && (a.getAttribute("data-show-children") === "true" && (a.setAttribute("data-show-children", "false"), o.set(t.getBlock(e), !1)), r.contains(l) && r.removeChild(l)), p = f;
1569
1355
  });
1570
- return o.get(e) ? (a.setAttribute("data-show-children", "true"), e.children.length === 0 && r.appendChild(i)) : a.setAttribute("data-show-children", "false"), {
1356
+ return o.get(e) ? (a.setAttribute("data-show-children", "true"), t.isEditable && e.children.length === 0 && r.appendChild(l)) : a.setAttribute("data-show-children", "false"), {
1571
1357
  dom: r,
1572
1358
  // Prevents re-renders when the toggle button is clicked.
1573
1359
  ignoreMutation: (f) => f instanceof MutationRecord && // We want to prevent re-renders when the view changes, so we ignore
1574
1360
  // all mutations where the `data-show-children` attribute is changed
1575
1361
  // or the "add block" button is added/removed.
1576
- (f.type === "attributes" && f.target === a && f.attributeName === "data-show-children" || f.type === "childList" && (f.addedNodes[0] === i || f.removedNodes[0] === i)),
1362
+ (f.type === "attributes" && f.target === a && f.attributeName === "data-show-children" || f.type === "childList" && (f.addedNodes[0] === l || f.removedNodes[0] === l)),
1577
1363
  destroy: () => {
1578
- s.removeEventListener("mousedown", c), s.removeEventListener("click", l), i.removeEventListener(
1364
+ s.removeEventListener("mousedown", i), s.removeEventListener("click", c), l.removeEventListener(
1579
1365
  "mousedown",
1580
1366
  u
1581
- ), i.removeEventListener(
1367
+ ), l.removeEventListener(
1582
1368
  "click",
1583
1369
  d
1584
1370
  ), h == null || h();
1585
1371
  }
1586
1372
  };
1587
- }, Le = [1, 2, 3, 4, 5, 6], Kt = ({
1373
+ }, Ae = [1, 2, 3, 4, 5, 6], Qt = (e) => ({ editor: t }) => {
1374
+ const n = t.getTextCursorPosition();
1375
+ return t.schema.blockSchema[n.block.type].content !== "inline" ? !1 : (t.updateBlock(n.block, {
1376
+ type: "heading",
1377
+ props: { level: e }
1378
+ }), !0);
1379
+ }, Jt = ({
1588
1380
  defaultLevel: e = 1,
1589
- levels: t = Le,
1381
+ levels: t = Ae,
1590
1382
  allowToggleHeadings: n = !0
1591
1383
  } = {}) => ({
1592
1384
  type: "heading",
1593
1385
  propSchema: {
1594
- ...m,
1386
+ ...g,
1595
1387
  level: { default: e, values: t },
1596
1388
  ...n ? { isToggleable: { default: !1, optional: !0 } } : {}
1597
1389
  },
1598
1390
  content: "inline"
1599
- }), Qt = v(
1600
- Kt,
1391
+ }), Yt = v(
1392
+ Jt,
1601
1393
  ({ allowToggleHeadings: e = !0 } = {}) => ({
1602
1394
  meta: {
1603
1395
  isolating: !1
@@ -1633,34 +1425,26 @@ const $t = () => ({
1633
1425
  },
1634
1426
  render(t, n) {
1635
1427
  const o = document.createElement(`h${t.props.level}`);
1636
- return e ? { ...xe(t, n, o), contentDOM: o } : {
1428
+ return e ? { ...Be(t, n, o), contentDOM: o } : {
1637
1429
  dom: o,
1638
1430
  contentDOM: o
1639
1431
  };
1640
1432
  },
1641
1433
  toExternalHTML(t) {
1642
1434
  const n = document.createElement(`h${t.props.level}`);
1643
- return T(t.props, n), {
1435
+ return A(t.props, n), {
1644
1436
  dom: n,
1645
1437
  contentDOM: n
1646
1438
  };
1647
1439
  }
1648
1440
  }),
1649
- ({ levels: e = Le } = {}) => [
1650
- w({
1441
+ ({ levels: e = Ae } = {}) => [
1442
+ k({
1651
1443
  key: "heading-shortcuts",
1652
1444
  keyboardShortcuts: Object.fromEntries(
1653
1445
  e.map((t) => [
1654
1446
  `Mod-Alt-${t}`,
1655
- ({ editor: n }) => {
1656
- const o = n.getTextCursorPosition();
1657
- return n.schema.blockSchema[o.block.type].content !== "inline" ? !1 : (n.updateBlock(o.block, {
1658
- type: "heading",
1659
- props: {
1660
- level: t
1661
- }
1662
- }), !0);
1663
- }
1447
+ Qt(t)
1664
1448
  ]) ?? []
1665
1449
  ),
1666
1450
  inputRules: e.map((t) => ({
@@ -1676,98 +1460,98 @@ const $t = () => ({
1676
1460
  }))
1677
1461
  })
1678
1462
  ]
1679
- ), Me = (e, t, n, o, r) => {
1680
- const { dom: a, destroy: s } = X(
1463
+ ), Pe = (e, t, n, o, r) => {
1464
+ const { dom: a, destroy: s } = Q(
1681
1465
  e,
1682
1466
  t,
1683
1467
  n,
1684
1468
  r
1685
- ), c = a;
1686
- c.style.position = "relative", e.props.url && e.props.showPreview && (e.props.previewWidth ? c.style.width = `${e.props.previewWidth}px` : c.style.width = "fit-content");
1469
+ ), i = a;
1470
+ i.style.position = "relative", e.props.url && e.props.showPreview && (e.props.previewWidth ? i.style.width = `${e.props.previewWidth}px` : i.style.width = "fit-content");
1471
+ const c = document.createElement("div");
1472
+ c.className = "bn-resize-handle", c.style.left = "4px";
1687
1473
  const l = document.createElement("div");
1688
- l.className = "bn-resize-handle", l.style.left = "4px";
1689
- const i = document.createElement("div");
1690
- i.className = "bn-resize-handle", i.style.right = "4px";
1474
+ l.className = "bn-resize-handle", l.style.right = "4px";
1691
1475
  const u = document.createElement("div");
1692
1476
  u.style.position = "absolute", u.style.height = "100%", u.style.width = "100%";
1693
1477
  let d, p = e.props.previewWidth;
1694
- const h = (g) => {
1695
- var Y, J;
1478
+ const h = (m) => {
1479
+ var ee, te;
1696
1480
  if (!d) {
1697
- !t.isEditable && o.contains(l) && o.contains(i) && (o.removeChild(l), o.removeChild(i));
1481
+ !t.isEditable && o.contains(c) && o.contains(l) && (o.removeChild(c), o.removeChild(l));
1698
1482
  return;
1699
1483
  }
1700
- let L;
1701
- const D = "touches" in g ? g.touches[0].clientX : g.clientX;
1702
- e.props.textAlignment === "center" ? d.handleUsed === "left" ? L = d.initialWidth + (d.initialClientX - D) * 2 : L = d.initialWidth + (D - d.initialClientX) * 2 : d.handleUsed === "left" ? L = d.initialWidth + d.initialClientX - D : L = d.initialWidth + D - d.initialClientX, p = Math.min(
1703
- Math.max(L, 64),
1704
- ((J = (Y = t.domElement) == null ? void 0 : Y.firstElementChild) == null ? void 0 : J.clientWidth) || Number.MAX_VALUE
1705
- ), c.style.width = `${p}px`;
1706
- }, f = (g) => {
1707
- (!g.target || !c.contains(g.target) || !t.isEditable) && o.contains(l) && o.contains(i) && (o.removeChild(l), o.removeChild(i)), d && (d = void 0, c.contains(u) && c.removeChild(u), t.updateBlock(e, {
1484
+ let S;
1485
+ const _ = "touches" in m ? m.touches[0].clientX : m.clientX;
1486
+ e.props.textAlignment === "center" ? d.handleUsed === "left" ? S = d.initialWidth + (d.initialClientX - _) * 2 : S = d.initialWidth + (_ - d.initialClientX) * 2 : d.handleUsed === "left" ? S = d.initialWidth + d.initialClientX - _ : S = d.initialWidth + _ - d.initialClientX, p = Math.min(
1487
+ Math.max(S, 64),
1488
+ ((te = (ee = t.domElement) == null ? void 0 : ee.firstElementChild) == null ? void 0 : te.clientWidth) || Number.MAX_VALUE
1489
+ ), i.style.width = `${p}px`;
1490
+ }, f = (m) => {
1491
+ (!m.target || !i.contains(m.target) || !t.isEditable) && o.contains(c) && o.contains(l) && (o.removeChild(c), o.removeChild(l)), d && (d = void 0, i.contains(u) && i.removeChild(u), t.updateBlock(e, {
1708
1492
  props: {
1709
1493
  previewWidth: p
1710
1494
  }
1711
1495
  }));
1712
- }, S = () => {
1713
- t.isEditable && (o.appendChild(l), o.appendChild(i));
1714
- }, x = (g) => {
1715
- g.relatedTarget === l || g.relatedTarget === i || d || t.isEditable && o.contains(l) && o.contains(i) && (o.removeChild(l), o.removeChild(i));
1716
- }, E = (g) => {
1717
- g.preventDefault(), c.contains(u) || c.appendChild(u);
1718
- const L = "touches" in g ? g.touches[0].clientX : g.clientX;
1496
+ }, E = () => {
1497
+ t.isEditable && (o.appendChild(c), o.appendChild(l));
1498
+ }, w = (m) => {
1499
+ m.relatedTarget === c || m.relatedTarget === l || d || t.isEditable && o.contains(c) && o.contains(l) && (o.removeChild(c), o.removeChild(l));
1500
+ }, x = (m) => {
1501
+ m.preventDefault(), i.contains(u) || i.appendChild(u);
1502
+ const S = "touches" in m ? m.touches[0].clientX : m.clientX;
1719
1503
  d = {
1720
1504
  handleUsed: "left",
1721
- initialWidth: c.clientWidth,
1722
- initialClientX: L
1505
+ initialWidth: i.clientWidth,
1506
+ initialClientX: S
1723
1507
  };
1724
- }, A = (g) => {
1725
- g.preventDefault(), c.contains(u) || c.appendChild(u);
1726
- const L = "touches" in g ? g.touches[0].clientX : g.clientX;
1508
+ }, P = (m) => {
1509
+ m.preventDefault(), i.contains(u) || i.appendChild(u);
1510
+ const S = "touches" in m ? m.touches[0].clientX : m.clientX;
1727
1511
  d = {
1728
1512
  handleUsed: "right",
1729
- initialWidth: c.clientWidth,
1730
- initialClientX: L
1513
+ initialWidth: i.clientWidth,
1514
+ initialClientX: S
1731
1515
  };
1732
1516
  };
1733
- return window.addEventListener("mousemove", h), window.addEventListener("touchmove", h), window.addEventListener("mouseup", f), window.addEventListener("touchend", f), c.addEventListener("mouseenter", S), c.addEventListener("mouseleave", x), l.addEventListener(
1517
+ return window.addEventListener("mousemove", h), window.addEventListener("touchmove", h), window.addEventListener("mouseup", f), window.addEventListener("touchend", f), i.addEventListener("mouseenter", E), i.addEventListener("mouseleave", w), c.addEventListener(
1734
1518
  "mousedown",
1735
- E
1736
- ), l.addEventListener(
1519
+ x
1520
+ ), c.addEventListener(
1737
1521
  "touchstart",
1738
- E
1739
- ), i.addEventListener(
1522
+ x
1523
+ ), l.addEventListener(
1740
1524
  "mousedown",
1741
- A
1742
- ), i.addEventListener(
1525
+ P
1526
+ ), l.addEventListener(
1743
1527
  "touchstart",
1744
- A
1528
+ P
1745
1529
  ), {
1746
- dom: c,
1530
+ dom: i,
1747
1531
  destroy: () => {
1748
- s == null || s(), window.removeEventListener("mousemove", h), window.removeEventListener("touchmove", h), window.removeEventListener("mouseup", f), window.removeEventListener("touchend", f), c.removeEventListener("mouseenter", S), c.removeEventListener("mouseleave", x), l.removeEventListener(
1532
+ s == null || s(), window.removeEventListener("mousemove", h), window.removeEventListener("touchmove", h), window.removeEventListener("mouseup", f), window.removeEventListener("touchend", f), i.removeEventListener("mouseenter", E), i.removeEventListener("mouseleave", w), c.removeEventListener(
1749
1533
  "mousedown",
1750
- E
1751
- ), l.removeEventListener(
1534
+ x
1535
+ ), c.removeEventListener(
1752
1536
  "touchstart",
1753
- E
1754
- ), i.removeEventListener(
1537
+ x
1538
+ ), l.removeEventListener(
1755
1539
  "mousedown",
1756
- A
1757
- ), i.removeEventListener(
1540
+ P
1541
+ ), l.removeEventListener(
1758
1542
  "touchstart",
1759
- A
1543
+ P
1760
1544
  );
1761
1545
  }
1762
1546
  };
1763
- }, ue = (e) => {
1547
+ }, ge = (e) => {
1764
1548
  const t = e.src || void 0, n = e.width || void 0, o = e.alt || void 0;
1765
1549
  return { url: t, previewWidth: n, name: o };
1766
- }, Yt = '<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>', Jt = (e = {}) => ({
1550
+ }, en = '<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>', tn = (e = {}) => ({
1767
1551
  type: "image",
1768
1552
  propSchema: {
1769
- textAlignment: m.textAlignment,
1770
- backgroundColor: m.backgroundColor,
1553
+ textAlignment: g.textAlignment,
1554
+ backgroundColor: g.backgroundColor,
1771
1555
  // File name.
1772
1556
  name: {
1773
1557
  default: ""
@@ -1790,43 +1574,43 @@ const $t = () => ({
1790
1574
  }
1791
1575
  },
1792
1576
  content: "none"
1793
- }), en = (e = {}) => (t) => {
1577
+ }), nn = (e = {}) => (t) => {
1794
1578
  if (t.tagName === "IMG") {
1795
1579
  if (t.closest("figure"))
1796
1580
  return;
1797
1581
  const { backgroundColor: n } = y(t);
1798
1582
  return {
1799
- ...ue(t),
1583
+ ...ge(t),
1800
1584
  backgroundColor: n
1801
1585
  };
1802
1586
  }
1803
1587
  if (t.tagName === "FIGURE") {
1804
- const n = W(t, "img");
1588
+ const n = $(t, "img");
1805
1589
  if (!n)
1806
1590
  return;
1807
1591
  const { targetElement: o, caption: r } = n, { backgroundColor: a } = y(t);
1808
1592
  return {
1809
- ...ue(o),
1593
+ ...ge(o),
1810
1594
  backgroundColor: a,
1811
1595
  caption: r
1812
1596
  };
1813
1597
  }
1814
- }, tn = (e = {}) => (t, n) => {
1598
+ }, on = (e = {}) => (t, n) => {
1815
1599
  const o = document.createElement("div");
1816
- o.innerHTML = e.icon ?? Yt;
1600
+ o.innerHTML = e.icon ?? en;
1817
1601
  const r = document.createElement("div");
1818
1602
  r.className = "bn-visual-media-wrapper";
1819
1603
  const a = document.createElement("img");
1820
1604
  return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((s) => {
1821
1605
  a.src = s;
1822
- }) : a.src = t.props.url, a.alt = t.props.name || t.props.caption || "BlockNote image", a.contentEditable = "false", a.draggable = !1, r.appendChild(a), Me(
1606
+ }) : a.src = t.props.url, a.alt = t.props.name || t.props.caption || "BlockNote image", a.contentEditable = "false", a.draggable = !1, r.appendChild(a), Pe(
1823
1607
  t,
1824
1608
  n,
1825
1609
  { dom: r },
1826
1610
  r,
1827
1611
  o.firstElementChild
1828
1612
  );
1829
- }, nn = (e = {}) => (t, n) => {
1613
+ }, rn = (e = {}) => (t, n) => {
1830
1614
  if (!t.props.url) {
1831
1615
  const r = document.createElement("p");
1832
1616
  return r.textContent = "Add image", {
@@ -1834,28 +1618,28 @@ const $t = () => ({
1834
1618
  };
1835
1619
  }
1836
1620
  let o;
1837
- return t.props.showPreview ? (o = document.createElement("img"), o.src = t.props.url, o.alt = t.props.name || t.props.caption || "BlockNote image", t.props.previewWidth && (o.width = t.props.previewWidth)) : (o = document.createElement("a"), o.href = t.props.url, o.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? K(o, t.props.caption) : F(o, t.props.caption) : {
1621
+ return t.props.showPreview ? (o = document.createElement("img"), o.src = t.props.url, o.alt = t.props.name || t.props.caption || "BlockNote image", t.props.previewWidth && (o.width = t.props.previewWidth)) : (o = document.createElement("a"), o.href = t.props.url, o.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? J(o, t.props.caption) : U(o, t.props.caption) : {
1838
1622
  dom: o
1839
1623
  };
1840
- }, on = v(
1841
- Jt,
1624
+ }, an = v(
1625
+ tn,
1842
1626
  (e) => ({
1843
1627
  meta: {
1844
1628
  fileBlockAccept: ["image/*"]
1845
1629
  },
1846
- parse: en(e),
1847
- render: tn(e),
1848
- toExternalHTML: nn(e),
1630
+ parse: nn(e),
1631
+ render: on(e),
1632
+ toExternalHTML: rn(e),
1849
1633
  runsBefore: ["file"]
1850
1634
  })
1851
- ), mo = (e, t, n) => ({
1635
+ ), So = (e, t, n) => ({
1852
1636
  state: o,
1853
1637
  dispatch: r
1854
- }) => r ? Be(o.tr, e, t, n) : !0, Be = (e, t, n, o) => {
1855
- const r = Ue(e.doc, t), a = $(r);
1638
+ }) => r ? Ne(o.tr, e, t, n) : !0, Ne = (e, t, n, o) => {
1639
+ const r = tt(e.doc, t), a = G(r);
1856
1640
  if (!a.isBlockContainer)
1857
1641
  return !1;
1858
- const s = P(e), c = [
1642
+ const s = O(e), i = [
1859
1643
  {
1860
1644
  type: a.bnBlock.node.type,
1861
1645
  // always keep blockcontainer type
@@ -1866,25 +1650,25 @@ const $t = () => ({
1866
1650
  attrs: o ? { ...a.blockContent.node.attrs } : {}
1867
1651
  }
1868
1652
  ];
1869
- return e.split(t, 2, c), !0;
1870
- }, j = (e, t) => {
1653
+ return e.split(t, 2, i), !0;
1654
+ }, q = (e, t) => {
1871
1655
  const { blockInfo: n, selectionEmpty: o } = e.transact((s) => ({
1872
- blockInfo: $e(s),
1656
+ blockInfo: nt(s),
1873
1657
  selectionEmpty: s.selection.anchor === s.selection.head
1874
1658
  }));
1875
1659
  if (!n.isBlockContainer)
1876
1660
  return !1;
1877
1661
  const { bnBlock: r, blockContent: a } = n;
1878
1662
  return a.node.type.name !== t || !o ? !1 : a.node.childCount === 0 ? (e.transact((s) => {
1879
- q(s, r.beforePos, {
1663
+ K(s, r.beforePos, {
1880
1664
  type: "paragraph",
1881
1665
  props: {}
1882
1666
  });
1883
- }), !0) : a.node.childCount > 0 ? e.transact((s) => (s.deleteSelection(), Be(s, s.selection.from, !0))) : !1;
1667
+ }), !0) : a.node.childCount > 0 ? e.transact((s) => (s.deleteSelection(), Ne(s, s.selection.from, !0))) : !1;
1884
1668
  };
1885
- function Q(e, t, n) {
1669
+ function Y(e, t, n) {
1886
1670
  var d, p, h;
1887
- const o = R.fromSchema(t), r = e, a = document.createElement("div");
1671
+ const o = Se.fromSchema(t), r = e, a = document.createElement("div");
1888
1672
  a.setAttribute("data-node-type", "blockGroup");
1889
1673
  for (const f of Array.from(r.childNodes))
1890
1674
  a.appendChild(f.cloneNode(!0));
@@ -1896,30 +1680,30 @@ function Q(e, t, n) {
1896
1680
  s.firstChild.firstChild.nodeSize + 2
1897
1681
  )
1898
1682
  ));
1899
- const c = (h = s.firstChild) == null ? void 0 : h.firstChild;
1900
- if (!(c != null && c.isTextblock))
1901
- return O.from(s);
1902
- const l = t.nodes[n].create(
1683
+ const i = (h = s.firstChild) == null ? void 0 : h.firstChild;
1684
+ if (!(i != null && i.isTextblock))
1685
+ return F.from(s);
1686
+ const c = t.nodes[n].create(
1903
1687
  {},
1904
- c.content
1905
- ), i = s.content.cut(
1688
+ i.content
1689
+ ), l = s.content.cut(
1906
1690
  // +2 for the `blockGroup` node's start and end markers
1907
- c.nodeSize + 2
1691
+ i.nodeSize + 2
1908
1692
  );
1909
- if (i.size > 0) {
1910
- const f = s.copy(i);
1911
- return l.content.addToEnd(f);
1693
+ if (l.size > 0) {
1694
+ const f = s.copy(l);
1695
+ return c.content.addToEnd(f);
1912
1696
  }
1913
- return l.content;
1697
+ return c.content;
1914
1698
  }
1915
- const rn = () => ({
1699
+ const sn = () => ({
1916
1700
  type: "bulletListItem",
1917
1701
  propSchema: {
1918
- ...m
1702
+ ...g
1919
1703
  },
1920
1704
  content: "inline"
1921
- }), an = v(
1922
- rn,
1705
+ }), cn = v(
1706
+ sn,
1923
1707
  {
1924
1708
  meta: {
1925
1709
  isolating: !1
@@ -1934,7 +1718,7 @@ const rn = () => ({
1934
1718
  },
1935
1719
  // As `li` elements can contain multiple paragraphs, we need to merge their contents
1936
1720
  // into a single one so that ProseMirror can parse everything correctly.
1937
- parseContent: ({ el: e, schema: t }) => Q(e, t, "bulletListItem"),
1721
+ parseContent: ({ el: e, schema: t }) => Y(e, t, "bulletListItem"),
1938
1722
  render() {
1939
1723
  const e = document.createElement("p");
1940
1724
  return {
@@ -1944,17 +1728,17 @@ const rn = () => ({
1944
1728
  },
1945
1729
  toExternalHTML(e) {
1946
1730
  const t = document.createElement("li"), n = document.createElement("p");
1947
- return T(e.props, t), t.appendChild(n), {
1731
+ return A(e.props, t), t.appendChild(n), {
1948
1732
  dom: t,
1949
1733
  contentDOM: n
1950
1734
  };
1951
1735
  }
1952
1736
  },
1953
1737
  [
1954
- w({
1738
+ k({
1955
1739
  key: "bullet-list-item-shortcuts",
1956
1740
  keyboardShortcuts: {
1957
- Enter: ({ editor: e }) => j(e, "bulletListItem"),
1741
+ Enter: ({ editor: e }) => q(e, "bulletListItem"),
1958
1742
  "Mod-Shift-8": ({ editor: e }) => {
1959
1743
  const t = e.getTextCursorPosition();
1960
1744
  return e.schema.blockSchema[t.block.type].content !== "inline" ? !1 : (e.updateBlock(t.block, {
@@ -1967,7 +1751,7 @@ const rn = () => ({
1967
1751
  {
1968
1752
  find: new RegExp("^[-+*]\\s$"),
1969
1753
  replace({ editor: e }) {
1970
- if (be(
1754
+ if (Ee(
1971
1755
  e.prosemirrorState
1972
1756
  ).blockNoteType !== "heading")
1973
1757
  return {
@@ -1979,15 +1763,15 @@ const rn = () => ({
1979
1763
  ]
1980
1764
  })
1981
1765
  ]
1982
- ), sn = () => ({
1766
+ ), ln = () => ({
1983
1767
  type: "checkListItem",
1984
1768
  propSchema: {
1985
- ...m,
1769
+ ...g,
1986
1770
  checked: { default: !1, type: "boolean" }
1987
1771
  },
1988
1772
  content: "inline"
1989
- }), cn = v(
1990
- sn,
1773
+ }), dn = v(
1774
+ ln,
1991
1775
  {
1992
1776
  meta: {
1993
1777
  isolating: !1
@@ -2006,7 +1790,7 @@ const rn = () => ({
2006
1790
  },
2007
1791
  // As `li` elements can contain multiple paragraphs, we need to merge their contents
2008
1792
  // into a single one so that ProseMirror can parse everything correctly.
2009
- parseContent: ({ el: e, schema: t }) => Q(e, t, "checkListItem"),
1793
+ parseContent: ({ el: e, schema: t }) => Y(e, t, "checkListItem"),
2010
1794
  render(e, t) {
2011
1795
  const n = document.createDocumentFragment(), o = document.createElement("input");
2012
1796
  o.type = "checkbox", o.checked = e.props.checked, e.props.checked && o.setAttribute("checked", ""), o.addEventListener("change", () => {
@@ -2022,7 +1806,7 @@ const rn = () => ({
2022
1806
  const t = document.createElement("li"), n = document.createElement("input");
2023
1807
  n.type = "checkbox", n.checked = e.props.checked, e.props.checked && n.setAttribute("checked", "");
2024
1808
  const o = document.createElement("p");
2025
- return T(e.props, t), t.appendChild(n), t.appendChild(o), {
1809
+ return A(e.props, t), t.appendChild(n), t.appendChild(o), {
2026
1810
  dom: t,
2027
1811
  contentDOM: o
2028
1812
  };
@@ -2030,10 +1814,10 @@ const rn = () => ({
2030
1814
  runsBefore: ["bulletListItem"]
2031
1815
  },
2032
1816
  [
2033
- w({
1817
+ k({
2034
1818
  key: "check-list-item-shortcuts",
2035
1819
  keyboardShortcuts: {
2036
- Enter: ({ editor: e }) => j(e, "checkListItem"),
1820
+ Enter: ({ editor: e }) => q(e, "checkListItem"),
2037
1821
  "Mod-Shift-9": ({ editor: e }) => {
2038
1822
  const t = e.getTextCursorPosition();
2039
1823
  return e.schema.blockSchema[t.block.type].content !== "inline" ? !1 : (e.updateBlock(t.block, {
@@ -2070,48 +1854,48 @@ const rn = () => ({
2070
1854
  })
2071
1855
  ]
2072
1856
  );
2073
- function Te(e, t, n, o) {
1857
+ function He(e, t, n, o) {
2074
1858
  let r = e.firstChild.attrs.start || 1, a = !0;
2075
- const s = !!e.firstChild.attrs.start, c = $({
1859
+ const s = !!e.firstChild.attrs.start, i = G({
2076
1860
  posBeforeNode: t,
2077
1861
  node: e
2078
1862
  });
2079
- if (!c.isBlockContainer)
1863
+ if (!i.isBlockContainer)
2080
1864
  throw new Error("impossible");
2081
- const l = n.doc.resolve(c.bnBlock.beforePos).nodeBefore, i = l ? o.get(l) : void 0;
2082
- return i !== void 0 ? (r = i + 1, a = !1) : l && $({
2083
- posBeforeNode: c.bnBlock.beforePos - l.nodeSize,
2084
- node: l
2085
- }).blockNoteType === "numberedListItem" && (r = Te(
2086
- l,
2087
- c.bnBlock.beforePos - l.nodeSize,
1865
+ const c = n.doc.resolve(i.bnBlock.beforePos).nodeBefore, l = c ? o.get(c) : void 0;
1866
+ return l !== void 0 ? (r = l + 1, a = !1) : c && G({
1867
+ posBeforeNode: i.bnBlock.beforePos - c.nodeSize,
1868
+ node: c
1869
+ }).blockNoteType === "numberedListItem" && (r = He(
1870
+ c,
1871
+ i.bnBlock.beforePos - c.nodeSize,
2088
1872
  n,
2089
1873
  o
2090
1874
  ).index + 1, a = !1), o.set(e, r), { index: r, isFirst: a, hasStart: s };
2091
1875
  }
2092
- function pe(e, t) {
1876
+ function he(e, t) {
2093
1877
  const n = /* @__PURE__ */ new Map(), o = t.decorations.map(
2094
1878
  e.mapping,
2095
1879
  e.doc
2096
1880
  ), r = [];
2097
- e.doc.nodesBetween(0, e.doc.nodeSize - 2, (s, c) => {
1881
+ e.doc.nodesBetween(0, e.doc.nodeSize - 2, (s, i) => {
2098
1882
  if (s.type.name === "blockContainer" && s.firstChild.type.name === "numberedListItem") {
2099
- const { index: l, isFirst: i, hasStart: u } = Te(
1883
+ const { index: c, isFirst: l, hasStart: u } = He(
2100
1884
  s,
2101
- c,
1885
+ i,
2102
1886
  e,
2103
1887
  n
2104
1888
  );
2105
1889
  if (o.find(
2106
- c,
2107
- c + s.nodeSize,
2108
- (p) => p.index === l && p.isFirst === i && p.hasStart === u
1890
+ i,
1891
+ i + s.nodeSize,
1892
+ (p) => p.index === c && p.isFirst === l && p.hasStart === u
2109
1893
  ).length === 0) {
2110
- const p = e.doc.nodeAt(c + 1);
1894
+ const p = e.doc.nodeAt(i + 1);
2111
1895
  r.push(
2112
1896
  // move in by 1 to account for the block container
2113
- st.node(c + 1, c + 1 + p.nodeSize, {
2114
- "data-index": l.toString()
1897
+ gt.node(i + 1, i + 1 + p.nodeSize, {
1898
+ "data-index": c.toString()
2115
1899
  })
2116
1900
  );
2117
1901
  }
@@ -2124,33 +1908,33 @@ function pe(e, t) {
2124
1908
  decorations: o.remove(a).add(e.doc, r)
2125
1909
  };
2126
1910
  }
2127
- const ln = () => new ot({
2128
- key: new rt("numbered-list-indexing-decorations"),
1911
+ const un = () => new pt({
1912
+ key: new ft("numbered-list-indexing-decorations"),
2129
1913
  state: {
2130
1914
  init(e, t) {
2131
- return pe(t.tr, {
2132
- decorations: oe.empty
1915
+ return he(t.tr, {
1916
+ decorations: ce.empty
2133
1917
  });
2134
1918
  },
2135
1919
  apply(e, t) {
2136
- return !e.docChanged && !e.selectionSet && t.decorations ? t : pe(e, t);
1920
+ return !e.docChanged && !e.selectionSet && t.decorations ? t : he(e, t);
2137
1921
  }
2138
1922
  },
2139
1923
  props: {
2140
1924
  decorations(e) {
2141
1925
  var t;
2142
- return ((t = this.getState(e)) == null ? void 0 : t.decorations) ?? oe.empty;
1926
+ return ((t = this.getState(e)) == null ? void 0 : t.decorations) ?? ce.empty;
2143
1927
  }
2144
1928
  }
2145
- }), dn = () => ({
1929
+ }), pn = () => ({
2146
1930
  type: "numberedListItem",
2147
1931
  propSchema: {
2148
- ...m,
1932
+ ...g,
2149
1933
  start: { default: void 0, type: "number" }
2150
1934
  },
2151
1935
  content: "inline"
2152
- }), un = v(
2153
- dn,
1936
+ }), fn = v(
1937
+ pn,
2154
1938
  {
2155
1939
  meta: {
2156
1940
  isolating: !1
@@ -2170,7 +1954,7 @@ const ln = () => new ot({
2170
1954
  },
2171
1955
  // As `li` elements can contain multiple paragraphs, we need to merge their contents
2172
1956
  // into a single one so that ProseMirror can parse everything correctly.
2173
- parseContent: ({ el: e, schema: t }) => Q(e, t, "numberedListItem"),
1957
+ parseContent: ({ el: e, schema: t }) => Y(e, t, "numberedListItem"),
2174
1958
  render() {
2175
1959
  const e = document.createElement("p");
2176
1960
  return {
@@ -2180,20 +1964,20 @@ const ln = () => new ot({
2180
1964
  },
2181
1965
  toExternalHTML(e) {
2182
1966
  const t = document.createElement("li"), n = document.createElement("p");
2183
- return T(e.props, t), t.appendChild(n), {
1967
+ return A(e.props, t), t.appendChild(n), {
2184
1968
  dom: t,
2185
1969
  contentDOM: n
2186
1970
  };
2187
1971
  }
2188
1972
  },
2189
1973
  [
2190
- w({
1974
+ k({
2191
1975
  key: "numbered-list-item-shortcuts",
2192
1976
  inputRules: [
2193
1977
  {
2194
1978
  find: new RegExp("^(\\d+)\\.\\s$"),
2195
1979
  replace({ match: e, editor: t }) {
2196
- if (be(
1980
+ if (Ee(
2197
1981
  t.prosemirrorState
2198
1982
  ).blockNoteType === "heading")
2199
1983
  return;
@@ -2208,7 +1992,7 @@ const ln = () => new ot({
2208
1992
  }
2209
1993
  ],
2210
1994
  keyboardShortcuts: {
2211
- Enter: ({ editor: e }) => j(e, "numberedListItem"),
1995
+ Enter: ({ editor: e }) => q(e, "numberedListItem"),
2212
1996
  "Mod-Shift-7": ({ editor: e }) => {
2213
1997
  const t = e.getTextCursorPosition();
2214
1998
  return e.schema.blockSchema[t.block.type].content !== "inline" ? !1 : (e.updateBlock(t.block, {
@@ -2217,24 +2001,24 @@ const ln = () => new ot({
2217
2001
  }), !0);
2218
2002
  }
2219
2003
  },
2220
- plugins: [ln()]
2004
+ prosemirrorPlugins: [un()]
2221
2005
  })
2222
2006
  ]
2223
- ), pn = () => ({
2007
+ ), gn = () => ({
2224
2008
  type: "toggleListItem",
2225
2009
  propSchema: {
2226
- ...m
2010
+ ...g
2227
2011
  },
2228
2012
  content: "inline"
2229
- }), fn = v(
2230
- pn,
2013
+ }), hn = v(
2014
+ gn,
2231
2015
  {
2232
2016
  meta: {
2233
2017
  isolating: !1
2234
2018
  },
2235
2019
  render(e, t) {
2236
2020
  const n = document.createElement("p");
2237
- return { ...xe(
2021
+ return { ...Be(
2238
2022
  e,
2239
2023
  t,
2240
2024
  n
@@ -2242,17 +2026,17 @@ const ln = () => new ot({
2242
2026
  },
2243
2027
  toExternalHTML(e) {
2244
2028
  const t = document.createElement("li"), n = document.createElement("p");
2245
- return T(e.props, t), t.appendChild(n), {
2029
+ return A(e.props, t), t.appendChild(n), {
2246
2030
  dom: t,
2247
2031
  contentDOM: n
2248
2032
  };
2249
2033
  }
2250
2034
  },
2251
2035
  [
2252
- w({
2036
+ k({
2253
2037
  key: "toggle-list-item-shortcuts",
2254
2038
  keyboardShortcuts: {
2255
- Enter: ({ editor: e }) => j(e, "toggleListItem"),
2039
+ Enter: ({ editor: e }) => q(e, "toggleListItem"),
2256
2040
  "Mod-Shift-6": ({ editor: e }) => {
2257
2041
  const t = e.getTextCursorPosition();
2258
2042
  return e.schema.blockSchema[t.block.type].content !== "inline" ? !1 : (e.updateBlock(t.block, {
@@ -2264,39 +2048,11 @@ const ln = () => new ot({
2264
2048
  })
2265
2049
  ]
2266
2050
  ), mn = () => ({
2267
- type: "pageBreak",
2268
- propSchema: {},
2269
- content: "none"
2270
- }), hn = v(
2271
- mn,
2272
- {
2273
- parse(e) {
2274
- if (e.tagName === "DIV" && e.hasAttribute("data-page-break"))
2275
- return {};
2276
- },
2277
- render() {
2278
- const e = document.createElement("div");
2279
- return e.setAttribute("data-page-break", ""), {
2280
- dom: e
2281
- };
2282
- },
2283
- toExternalHTML() {
2284
- const e = document.createElement("div");
2285
- return e.setAttribute("data-page-break", ""), {
2286
- dom: e
2287
- };
2288
- }
2289
- }
2290
- ), ho = (e) => e.extend({
2291
- blockSpecs: {
2292
- pageBreak: hn()
2293
- }
2294
- }), gn = () => ({
2295
2051
  type: "paragraph",
2296
- propSchema: m,
2052
+ propSchema: g,
2297
2053
  content: "inline"
2298
2054
  }), bn = v(
2299
- gn,
2055
+ mn,
2300
2056
  {
2301
2057
  meta: {
2302
2058
  isolating: !1
@@ -2315,7 +2071,7 @@ const ln = () => new ot({
2315
2071
  },
2316
2072
  toExternalHTML: (e) => {
2317
2073
  const t = document.createElement("p");
2318
- return T(e.props, t), {
2074
+ return A(e.props, t), {
2319
2075
  dom: t,
2320
2076
  contentDOM: t
2321
2077
  };
@@ -2323,7 +2079,7 @@ const ln = () => new ot({
2323
2079
  runsBefore: ["default"]
2324
2080
  },
2325
2081
  [
2326
- w({
2082
+ k({
2327
2083
  key: "paragraph-shortcuts",
2328
2084
  keyboardShortcuts: {
2329
2085
  "Mod-Alt-0": ({ editor: e }) => {
@@ -2336,15 +2092,15 @@ const ln = () => new ot({
2336
2092
  }
2337
2093
  })
2338
2094
  ]
2339
- ), kn = () => ({
2095
+ ), Cn = () => ({
2340
2096
  type: "quote",
2341
2097
  propSchema: {
2342
- backgroundColor: m.backgroundColor,
2343
- textColor: m.textColor
2098
+ backgroundColor: g.backgroundColor,
2099
+ textColor: g.textColor
2344
2100
  },
2345
2101
  content: "inline"
2346
- }), Cn = v(
2347
- kn,
2102
+ }), kn = v(
2103
+ Cn,
2348
2104
  {
2349
2105
  meta: {
2350
2106
  isolating: !1
@@ -2364,14 +2120,14 @@ const ln = () => new ot({
2364
2120
  },
2365
2121
  toExternalHTML(e) {
2366
2122
  const t = document.createElement("blockquote");
2367
- return T(e.props, t), {
2123
+ return A(e.props, t), {
2368
2124
  dom: t,
2369
2125
  contentDOM: t
2370
2126
  };
2371
2127
  }
2372
2128
  },
2373
2129
  [
2374
- w({
2130
+ k({
2375
2131
  key: "quote-block-shortcuts",
2376
2132
  keyboardShortcuts: {
2377
2133
  "Mod-Alt-q": ({ editor: e }) => {
@@ -2395,18 +2151,18 @@ const ln = () => new ot({
2395
2151
  ]
2396
2152
  })
2397
2153
  ]
2398
- ), yn = 35, Ae = 120, go = 31, vn = Ye.create({
2154
+ ), yn = 35, Ie = 120, Mo = 31, vn = $e.create({
2399
2155
  name: "BlockNoteTableExtension",
2400
2156
  addProseMirrorPlugins: () => [
2401
- _e({
2157
+ Ve({
2402
2158
  cellMinWidth: yn,
2403
- defaultCellMinWidth: Ae,
2159
+ defaultCellMinWidth: Ie,
2404
2160
  // We set this to null as we implement our own node view in the table
2405
2161
  // block content. This node view is the same as what's used by default,
2406
2162
  // but is wrapped in a `blockContent` HTML element.
2407
2163
  View: null
2408
2164
  }),
2409
- Ve()
2165
+ Re()
2410
2166
  ],
2411
2167
  addKeyboardShortcuts() {
2412
2168
  return {
@@ -2420,10 +2176,10 @@ const ln = () => new ot({
2420
2176
  },
2421
2177
  // Enables navigating cells using the tab key.
2422
2178
  Tab: () => this.editor.commands.command(
2423
- ({ state: e, dispatch: t, view: n }) => ee(1)(e, t, n)
2179
+ ({ state: e, dispatch: t, view: n }) => ne(1)(e, t, n)
2424
2180
  ),
2425
2181
  "Shift-Tab": () => this.editor.commands.command(
2426
- ({ state: e, dispatch: t, view: n }) => ee(-1)(e, t, n)
2182
+ ({ state: e, dispatch: t, view: n }) => ne(-1)(e, t, n)
2427
2183
  )
2428
2184
  };
2429
2185
  },
@@ -2434,14 +2190,14 @@ const ln = () => new ot({
2434
2190
  storage: e.storage
2435
2191
  };
2436
2192
  return {
2437
- tableRole: Je(
2438
- et(e, "tableRole", t)
2193
+ tableRole: Ue(
2194
+ qe(e, "tableRole", t)
2439
2195
  )
2440
2196
  };
2441
2197
  }
2442
- }), Sn = {
2443
- textColor: m.textColor
2444
- }, En = N.create({
2198
+ }), En = {
2199
+ textColor: g.textColor
2200
+ }, xn = N.create({
2445
2201
  name: "tableHeader",
2446
2202
  addOptions() {
2447
2203
  return {
@@ -2481,7 +2237,7 @@ const ln = () => new ot({
2481
2237
  tag: "th",
2482
2238
  // As `th` elements can contain multiple paragraphs, we need to merge their contents
2483
2239
  // into a single one so that ProseMirror can parse everything correctly.
2484
- getContent: (e, t) => Ne(e, t)
2240
+ getContent: (e, t) => De(e, t)
2485
2241
  }
2486
2242
  ];
2487
2243
  },
@@ -2525,7 +2281,7 @@ const ln = () => new ot({
2525
2281
  tag: "td",
2526
2282
  // As `td` elements can contain multiple paragraphs, we need to merge their contents
2527
2283
  // into a single one so that ProseMirror can parse everything correctly.
2528
- getContent: (e, t) => Ne(e, t)
2284
+ getContent: (e, t) => De(e, t)
2529
2285
  }
2530
2286
  ];
2531
2287
  },
@@ -2536,7 +2292,7 @@ const ln = () => new ot({
2536
2292
  0
2537
2293
  ];
2538
2294
  }
2539
- }), xn = N.create({
2295
+ }), Sn = N.create({
2540
2296
  name: "table",
2541
2297
  content: "tableRow+",
2542
2298
  group: "blockContent",
@@ -2552,7 +2308,7 @@ const ln = () => new ot({
2552
2308
  },
2553
2309
  renderHTML({ node: e, HTMLAttributes: t }) {
2554
2310
  var r, a, s;
2555
- const n = it(
2311
+ const n = mt(
2556
2312
  this.name,
2557
2313
  "table",
2558
2314
  {
@@ -2561,11 +2317,11 @@ const ln = () => new ot({
2561
2317
  },
2562
2318
  ((a = this.options.domAttributes) == null ? void 0 : a.inlineContent) || {}
2563
2319
  ), o = document.createElement("colgroup");
2564
- for (const c of e.children[0].children)
2565
- if (c.attrs.colwidth)
2566
- for (const i of c.attrs.colwidth) {
2320
+ for (const i of e.children[0].children)
2321
+ if (i.attrs.colwidth)
2322
+ for (const l of i.attrs.colwidth) {
2567
2323
  const u = document.createElement("col");
2568
- i && (u.style = `width: ${i}px`), o.appendChild(u);
2324
+ l && (u.style = `width: ${l}px`), o.appendChild(u);
2569
2325
  }
2570
2326
  else
2571
2327
  o.appendChild(document.createElement("col"));
@@ -2581,34 +2337,34 @@ const ln = () => new ot({
2581
2337
  addNodeView() {
2582
2338
  return ({ node: e, HTMLAttributes: t }) => {
2583
2339
  var o;
2584
- class n extends Re {
2585
- constructor(a, s, c) {
2586
- super(a, s), this.node = a, this.cellMinWidth = s, this.blockContentHTMLAttributes = c;
2587
- const l = document.createElement("div");
2588
- l.className = I(
2340
+ class n extends We {
2341
+ constructor(a, s, i) {
2342
+ super(a, s), this.node = a, this.cellMinWidth = s, this.blockContentHTMLAttributes = i;
2343
+ const c = document.createElement("div");
2344
+ c.className = D(
2589
2345
  "bn-block-content",
2590
- c.class
2591
- ), l.setAttribute("data-content-type", "table");
2346
+ i.class
2347
+ ), c.setAttribute("data-content-type", "table");
2592
2348
  for (const [p, h] of Object.entries(
2593
- c
2349
+ i
2594
2350
  ))
2595
- p !== "class" && l.setAttribute(p, h);
2596
- const i = this.dom, u = document.createElement("div");
2597
- u.className = "tableWrapper-inner", u.appendChild(i.firstChild), i.appendChild(u), l.appendChild(i);
2351
+ p !== "class" && c.setAttribute(p, h);
2352
+ const l = this.dom, u = document.createElement("div");
2353
+ u.className = "tableWrapper-inner", u.appendChild(l.firstChild), l.appendChild(u), c.appendChild(l);
2598
2354
  const d = document.createElement("div");
2599
- d.className = "table-widgets-container", d.style.position = "relative", i.appendChild(d), this.dom = l;
2355
+ d.className = "table-widgets-container", d.style.position = "relative", l.appendChild(d), this.dom = c;
2600
2356
  }
2601
2357
  ignoreMutation(a) {
2602
2358
  return !a.target.closest(".tableWrapper-inner") || super.ignoreMutation(a);
2603
2359
  }
2604
2360
  }
2605
- return new n(e, Ae, {
2361
+ return new n(e, Ie, {
2606
2362
  ...((o = this.options.domAttributes) == null ? void 0 : o.blockContent) || {},
2607
2363
  ...t
2608
2364
  });
2609
2365
  };
2610
2366
  }
2611
- }), Ln = N.create({
2367
+ }), Mn = N.create({
2612
2368
  name: "tableParagraph",
2613
2369
  group: "tableContent",
2614
2370
  content: "inline*",
@@ -2629,7 +2385,7 @@ const ln = () => new ot({
2629
2385
  renderHTML({ HTMLAttributes: e }) {
2630
2386
  return ["p", e, 0];
2631
2387
  }
2632
- }), Mn = N.create({
2388
+ }), Ln = N.create({
2633
2389
  name: "tableRow",
2634
2390
  addOptions() {
2635
2391
  return {
@@ -2650,38 +2406,38 @@ const ln = () => new ot({
2650
2406
  ];
2651
2407
  }
2652
2408
  });
2653
- function Ne(e, t) {
2654
- const o = R.fromSchema(t).parse(e, {
2409
+ function De(e, t) {
2410
+ const o = Se.fromSchema(t).parse(e, {
2655
2411
  topNode: t.nodes.blockGroup.create()
2656
2412
  }), r = [];
2657
2413
  return o.content.descendants((a) => {
2658
2414
  if (a.isInline)
2659
2415
  return r.push(a), !1;
2660
- }), O.fromArray(r);
2416
+ }), F.fromArray(r);
2661
2417
  }
2662
- const Bn = () => pt(
2663
- { node: xn, type: "table", content: "table" },
2664
- Sn,
2418
+ const Tn = () => yt(
2419
+ { node: Sn, type: "table", content: "table" },
2420
+ En,
2665
2421
  [
2666
- w({
2422
+ k({
2667
2423
  key: "table-extensions",
2668
2424
  tiptapExtensions: [
2669
2425
  vn,
2670
- Ln,
2671
- En,
2426
+ Mn,
2427
+ xn,
2672
2428
  wn,
2673
- Mn
2429
+ Ln
2674
2430
  ]
2675
2431
  }),
2676
2432
  // Extension for keyboard shortcut which deletes the table if it's empty
2677
2433
  // and all cells are selected. Uses a separate extension as it needs
2678
2434
  // priority over keyboard handlers in the `TableExtension`'s
2679
2435
  // `tableEditing` plugin.
2680
- w({
2436
+ k({
2681
2437
  key: "table-keyboard-delete",
2682
2438
  keyboardShortcuts: {
2683
2439
  Backspace: ({ editor: e }) => {
2684
- if (!(e.prosemirrorState.selection instanceof he))
2440
+ if (!(e.prosemirrorState.selection instanceof Ce))
2685
2441
  return !1;
2686
2442
  const t = e.getTextCursorPosition().block, n = t.content;
2687
2443
  let o = 0;
@@ -2701,14 +2457,14 @@ const Bn = () => pt(
2701
2457
  }
2702
2458
  })
2703
2459
  ]
2704
- ), fe = (e) => {
2460
+ ), me = (e) => {
2705
2461
  const t = e.src || void 0, n = e.width || void 0;
2706
2462
  return { url: t, previewWidth: n };
2707
- }, Tn = '<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>', An = (e) => ({
2463
+ }, Bn = '<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>', An = (e) => ({
2708
2464
  type: "video",
2709
2465
  propSchema: {
2710
- textAlignment: m.textAlignment,
2711
- backgroundColor: m.backgroundColor,
2466
+ textAlignment: g.textAlignment,
2467
+ backgroundColor: g.backgroundColor,
2712
2468
  name: { default: "" },
2713
2469
  url: { default: "" },
2714
2470
  caption: { default: "" },
@@ -2716,43 +2472,43 @@ const Bn = () => pt(
2716
2472
  previewWidth: { default: void 0, type: "number" }
2717
2473
  },
2718
2474
  content: "none"
2719
- }), Nn = (e) => (t) => {
2475
+ }), Pn = (e) => (t) => {
2720
2476
  if (t.tagName === "VIDEO") {
2721
2477
  if (t.closest("figure"))
2722
2478
  return;
2723
2479
  const { backgroundColor: n } = y(t);
2724
2480
  return {
2725
- ...fe(t),
2481
+ ...me(t),
2726
2482
  backgroundColor: n
2727
2483
  };
2728
2484
  }
2729
2485
  if (t.tagName === "FIGURE") {
2730
- const n = W(t, "video");
2486
+ const n = $(t, "video");
2731
2487
  if (!n)
2732
2488
  return;
2733
2489
  const { targetElement: o, caption: r } = n, { backgroundColor: a } = y(t);
2734
2490
  return {
2735
- ...fe(o),
2491
+ ...me(o),
2736
2492
  backgroundColor: a,
2737
2493
  caption: r
2738
2494
  };
2739
2495
  }
2740
- }, Hn = v(
2496
+ }, Nn = v(
2741
2497
  An,
2742
2498
  (e) => ({
2743
2499
  meta: {
2744
2500
  fileBlockAccept: ["video/*"]
2745
2501
  },
2746
- parse: Nn(),
2502
+ parse: Pn(),
2747
2503
  render(t, n) {
2748
2504
  const o = document.createElement("div");
2749
- o.innerHTML = e.icon ?? Tn;
2505
+ o.innerHTML = e.icon ?? Bn;
2750
2506
  const r = document.createElement("div");
2751
2507
  r.className = "bn-visual-media-wrapper";
2752
2508
  const a = document.createElement("video");
2753
2509
  return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((s) => {
2754
2510
  a.src = s;
2755
- }) : a.src = t.props.url, a.controls = !0, a.contentEditable = "false", a.draggable = !1, a.width = t.props.previewWidth, r.appendChild(a), Me(
2511
+ }) : a.src = t.props.url, a.controls = !0, a.contentEditable = "false", a.draggable = !1, a.width = t.props.previewWidth, r.appendChild(a), Pe(
2756
2512
  t,
2757
2513
  n,
2758
2514
  { dom: r },
@@ -2768,23 +2524,14 @@ const Bn = () => pt(
2768
2524
  };
2769
2525
  }
2770
2526
  let n;
2771
- return t.props.showPreview ? (n = document.createElement("video"), n.src = t.props.url, t.props.previewWidth && (n.width = t.props.previewWidth)) : (n = document.createElement("a"), n.href = t.props.url, n.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? K(n, t.props.caption) : F(n, t.props.caption) : {
2527
+ return t.props.showPreview ? (n = document.createElement("video"), n.src = t.props.url, t.props.previewWidth && (n.width = t.props.previewWidth)) : (n = document.createElement("a"), n.href = t.props.url, n.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? J(n, t.props.caption) : U(n, t.props.caption) : {
2772
2528
  dom: n
2773
2529
  };
2774
2530
  },
2775
2531
  runsBefore: ["file"]
2776
2532
  })
2777
- ), bo = async (e) => {
2778
- const t = new FormData();
2779
- return t.append("file", e), (await (await fetch("https://tmpfiles.org/api/v1/upload", {
2780
- method: "POST",
2781
- body: t
2782
- })).json()).data.url.replace(
2783
- "tmpfiles.org/",
2784
- "tmpfiles.org/dl/"
2785
- );
2786
- };
2787
- function k(e, t, n) {
2533
+ );
2534
+ function C(e, t, n) {
2788
2535
  if (!(t in e.schema.blockSpecs))
2789
2536
  return !1;
2790
2537
  if (!n)
@@ -2807,13 +2554,256 @@ function k(e, t, n) {
2807
2554
  }
2808
2555
  return !0;
2809
2556
  }
2810
- function ko(e, t, n, o) {
2811
- return k(t, n, o) && e.type === n;
2557
+ function Lo(e, t, n, o) {
2558
+ return C(t, n, o) && e.type === n;
2559
+ }
2560
+ function To(e) {
2561
+ return e instanceof Ce;
2812
2562
  }
2813
- function Co(e) {
2814
- return e instanceof he;
2563
+ const R = /* @__PURE__ */ new Map();
2564
+ function Hn(e) {
2565
+ if (R.has(e))
2566
+ return R.get(e);
2567
+ const t = new Xe();
2568
+ return e._tiptapEditor.on("transaction", ({ transaction: n }) => {
2569
+ t.appendMapping(n.mapping);
2570
+ }), e._tiptapEditor.on("destroy", () => {
2571
+ R.delete(e);
2572
+ }), R.set(e, t), t;
2573
+ }
2574
+ function In(e, t, n = "left") {
2575
+ const o = ae.getState(e.prosemirrorState);
2576
+ if (!o) {
2577
+ const a = Hn(e), s = a.maps.length;
2578
+ return () => a.slice(s).map(t, n === "left" ? -1 : 1);
2579
+ }
2580
+ const r = Ke(
2581
+ // Track the position after the position if we are on the right side
2582
+ t + (n === "right" ? 1 : -1),
2583
+ o.binding.type,
2584
+ o.binding.mapping
2585
+ );
2586
+ return () => {
2587
+ const a = ae.getState(
2588
+ e.prosemirrorState
2589
+ ), s = Qe(
2590
+ a.doc,
2591
+ a.binding.type,
2592
+ r,
2593
+ a.binding.mapping
2594
+ );
2595
+ if (s === null)
2596
+ throw new Error("Position not found, cannot track positions");
2597
+ return s + (n === "right" ? -1 : 1);
2598
+ };
2599
+ }
2600
+ const Dn = je((e) => e.type.name === "blockContainer");
2601
+ class On {
2602
+ constructor(t, n, o) {
2603
+ L(this, "state");
2604
+ L(this, "emitUpdate");
2605
+ L(this, "rootEl");
2606
+ L(this, "pluginState");
2607
+ L(this, "handleScroll", () => {
2608
+ var t, n;
2609
+ if ((t = this.state) != null && t.show) {
2610
+ const o = (n = this.rootEl) == null ? void 0 : n.querySelector(
2611
+ `[data-decoration-id="${this.pluginState.decorationId}"]`
2612
+ );
2613
+ if (!o)
2614
+ return;
2615
+ this.state.referencePos = o.getBoundingClientRect().toJSON(), this.emitUpdate(this.pluginState.triggerCharacter);
2616
+ }
2617
+ });
2618
+ L(this, "closeMenu", () => {
2619
+ this.editor.transact((t) => t.setMeta(B, null));
2620
+ });
2621
+ L(this, "clearQuery", () => {
2622
+ this.pluginState !== void 0 && this.editor._tiptapEditor.chain().focus().deleteRange({
2623
+ from: this.pluginState.queryStartPos() - (this.pluginState.deleteTriggerCharacter ? this.pluginState.triggerCharacter.length : 0),
2624
+ to: this.editor.transact((t) => t.selection.from)
2625
+ }).run();
2626
+ });
2627
+ var r;
2628
+ this.editor = t, this.pluginState = void 0, this.emitUpdate = (a) => {
2629
+ var s;
2630
+ if (!this.state)
2631
+ throw new Error("Attempting to update uninitialized suggestions menu");
2632
+ n(a, {
2633
+ ...this.state,
2634
+ ignoreQueryLength: (s = this.pluginState) == null ? void 0 : s.ignoreQueryLength
2635
+ });
2636
+ }, this.rootEl = o.root, (r = this.rootEl) == null || r.addEventListener("scroll", this.handleScroll, !0);
2637
+ }
2638
+ update(t, n) {
2639
+ var l;
2640
+ const o = B.getState(n), r = B.getState(
2641
+ t.state
2642
+ ), a = o === void 0 && r !== void 0, s = o !== void 0 && r === void 0;
2643
+ if (!a && !(o !== void 0 && r !== void 0) && !s)
2644
+ return;
2645
+ if (this.pluginState = s ? o : r, s || !this.editor.isEditable) {
2646
+ this.state && (this.state.show = !1), this.emitUpdate(this.pluginState.triggerCharacter);
2647
+ return;
2648
+ }
2649
+ const c = (l = this.rootEl) == null ? void 0 : l.querySelector(
2650
+ `[data-decoration-id="${this.pluginState.decorationId}"]`
2651
+ );
2652
+ this.editor.isEditable && c && (this.state = {
2653
+ show: !0,
2654
+ referencePos: c.getBoundingClientRect().toJSON(),
2655
+ query: this.pluginState.query
2656
+ }, this.emitUpdate(this.pluginState.triggerCharacter));
2657
+ }
2658
+ destroy() {
2659
+ var t;
2660
+ (t = this.rootEl) == null || t.removeEventListener("scroll", this.handleScroll, !0);
2661
+ }
2815
2662
  }
2816
- function In(e) {
2663
+ const B = new Ze("SuggestionMenuPlugin"), _n = k(({ editor: e }) => {
2664
+ const t = [];
2665
+ let n;
2666
+ const o = ye(void 0);
2667
+ return {
2668
+ key: "suggestionMenu",
2669
+ store: o,
2670
+ addTriggerCharacter: (r) => {
2671
+ t.push(r);
2672
+ },
2673
+ removeTriggerCharacter: (r) => {
2674
+ t.splice(t.indexOf(r), 1);
2675
+ },
2676
+ closeMenu: () => {
2677
+ n == null || n.closeMenu();
2678
+ },
2679
+ clearQuery: () => {
2680
+ n == null || n.clearQuery();
2681
+ },
2682
+ shown: () => {
2683
+ var r;
2684
+ return ((r = n == null ? void 0 : n.state) == null ? void 0 : r.show) || !1;
2685
+ },
2686
+ openSuggestionMenu: (r, a) => {
2687
+ e.headless || (e.focus(), e.transact((s) => {
2688
+ a != null && a.deleteTriggerCharacter && s.insertText(r), s.scrollIntoView().setMeta(B, {
2689
+ triggerCharacter: r,
2690
+ deleteTriggerCharacter: (a == null ? void 0 : a.deleteTriggerCharacter) || !1,
2691
+ ignoreQueryLength: (a == null ? void 0 : a.ignoreQueryLength) || !1
2692
+ });
2693
+ }));
2694
+ },
2695
+ // TODO this whole plugin needs to be refactored (but I've done the minimal)
2696
+ prosemirrorPlugins: [
2697
+ new Ge({
2698
+ key: B,
2699
+ view: (r) => (n = new On(
2700
+ e,
2701
+ (a, s) => {
2702
+ o.setState({ ...s, triggerCharacter: a });
2703
+ },
2704
+ r
2705
+ ), n),
2706
+ state: {
2707
+ // Initialize the plugin's internal state.
2708
+ init() {
2709
+ },
2710
+ // Apply changes to the plugin state from an editor transaction.
2711
+ apply: (r, a, s, i) => {
2712
+ if (r.selection.$from.parent.type.spec.code)
2713
+ return a;
2714
+ const c = r.getMeta(B);
2715
+ if (typeof c == "object" && c !== null) {
2716
+ a && (n == null || n.closeMenu());
2717
+ const u = In(
2718
+ e,
2719
+ i.selection.from - // Need to account for the trigger char that was inserted, so we offset the position by the length of the trigger character.
2720
+ c.triggerCharacter.length
2721
+ );
2722
+ return {
2723
+ triggerCharacter: c.triggerCharacter,
2724
+ deleteTriggerCharacter: c.deleteTriggerCharacter !== !1,
2725
+ // When reading the queryStartPos, we offset the result by the length of the trigger character, to make it easy on the caller
2726
+ queryStartPos: () => u() + c.triggerCharacter.length,
2727
+ query: "",
2728
+ decorationId: `id_${Math.floor(Math.random() * 4294967295)}`,
2729
+ ignoreQueryLength: c == null ? void 0 : c.ignoreQueryLength
2730
+ };
2731
+ }
2732
+ if (a === void 0)
2733
+ return a;
2734
+ if (
2735
+ // Highlighting text should hide the menu.
2736
+ i.selection.from !== i.selection.to || // Transactions with plugin metadata should hide the menu.
2737
+ c === null || // Certain mouse events should hide the menu.
2738
+ // TODO: Change to global mousedown listener.
2739
+ r.getMeta("focus") || r.getMeta("blur") || r.getMeta("pointer") || // Moving the caret before the character which triggered the menu should hide it.
2740
+ a.triggerCharacter !== void 0 && i.selection.from < a.queryStartPos() || // Moving the caret to a new block should hide the menu.
2741
+ !i.selection.$from.sameParent(
2742
+ i.doc.resolve(a.queryStartPos())
2743
+ )
2744
+ )
2745
+ return;
2746
+ const l = { ...a };
2747
+ return l.query = i.doc.textBetween(
2748
+ a.queryStartPos(),
2749
+ i.selection.from
2750
+ ), l;
2751
+ }
2752
+ },
2753
+ props: {
2754
+ handleTextInput(r, a, s, i) {
2755
+ if (a === s) {
2756
+ const c = r.state.doc;
2757
+ for (const l of t) {
2758
+ const u = l.length > 1 ? c.textBetween(a - l.length, a) + i : i;
2759
+ if (l === u)
2760
+ return r.dispatch(r.state.tr.insertText(i)), r.dispatch(
2761
+ r.state.tr.setMeta(B, {
2762
+ triggerCharacter: u
2763
+ }).scrollIntoView()
2764
+ ), !0;
2765
+ }
2766
+ }
2767
+ return !1;
2768
+ },
2769
+ // Setup decorator on the currently active suggestion.
2770
+ decorations(r) {
2771
+ const a = this.getState(r);
2772
+ if (a === void 0)
2773
+ return null;
2774
+ if (!a.deleteTriggerCharacter) {
2775
+ const s = Dn(r.selection);
2776
+ if (s)
2777
+ return oe.create(r.doc, [
2778
+ re.node(
2779
+ s.pos,
2780
+ s.pos + s.node.nodeSize,
2781
+ {
2782
+ nodeName: "span",
2783
+ class: "bn-suggestion-decorator",
2784
+ "data-decoration-id": a.decorationId
2785
+ }
2786
+ )
2787
+ ]);
2788
+ }
2789
+ return oe.create(r.doc, [
2790
+ re.inline(
2791
+ a.queryStartPos() - a.triggerCharacter.length,
2792
+ a.queryStartPos(),
2793
+ {
2794
+ nodeName: "span",
2795
+ class: "bn-suggestion-decorator",
2796
+ "data-decoration-id": a.decorationId
2797
+ }
2798
+ )
2799
+ ]);
2800
+ }
2801
+ }
2802
+ })
2803
+ ]
2804
+ };
2805
+ });
2806
+ function Vn(e) {
2817
2807
  let t = e.getTextCursorPosition().block, n = e.schema.blockSchema[t.type].content;
2818
2808
  for (; n === "none"; ) {
2819
2809
  if (t = e.getTextCursorPosition().nextBlock, t === void 0)
@@ -2826,11 +2816,11 @@ function b(e, t) {
2826
2816
  if (n.content === void 0)
2827
2817
  throw new Error("Slash Menu open in a block that doesn't contain content.");
2828
2818
  let o;
2829
- return Array.isArray(n.content) && (n.content.length === 1 && Ge(n.content[0]) && n.content[0].type === "text" && n.content[0].text === "/" || n.content.length === 0) ? (o = e.updateBlock(n, t), e.setTextCursorPosition(o)) : (o = e.insertBlocks([t], n, "after")[0], e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)), In(e), o;
2819
+ return Array.isArray(n.content) && (n.content.length === 1 && ot(n.content[0]) && n.content[0].type === "text" && n.content[0].text === "/" || n.content.length === 0) ? (o = e.updateBlock(n, t), e.setTextCursorPosition(o)) : (o = e.insertBlocks([t], n, "after")[0], e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)), Vn(e), o;
2830
2820
  }
2831
- function yo(e) {
2821
+ function Bo(e) {
2832
2822
  const t = [];
2833
- return k(e, "heading", { level: "number" }) && t.push(
2823
+ return C(e, "heading", { level: "number" }) && t.push(
2834
2824
  {
2835
2825
  onItemClick: () => {
2836
2826
  b(e, {
@@ -2864,7 +2854,7 @@ function yo(e) {
2864
2854
  key: "heading_3",
2865
2855
  ...e.dictionary.slash_menu.heading_3
2866
2856
  }
2867
- ), k(e, "quote") && t.push({
2857
+ ), C(e, "quote") && t.push({
2868
2858
  onItemClick: () => {
2869
2859
  b(e, {
2870
2860
  type: "quote"
@@ -2872,7 +2862,7 @@ function yo(e) {
2872
2862
  },
2873
2863
  key: "quote",
2874
2864
  ...e.dictionary.slash_menu.quote
2875
- }), k(e, "toggleListItem") && t.push({
2865
+ }), C(e, "toggleListItem") && t.push({
2876
2866
  onItemClick: () => {
2877
2867
  b(e, {
2878
2868
  type: "toggleListItem"
@@ -2881,7 +2871,7 @@ function yo(e) {
2881
2871
  badge: M("Mod-Shift-6"),
2882
2872
  key: "toggle_list",
2883
2873
  ...e.dictionary.slash_menu.toggle_list
2884
- }), k(e, "numberedListItem") && t.push({
2874
+ }), C(e, "numberedListItem") && t.push({
2885
2875
  onItemClick: () => {
2886
2876
  b(e, {
2887
2877
  type: "numberedListItem"
@@ -2890,7 +2880,7 @@ function yo(e) {
2890
2880
  badge: M("Mod-Shift-7"),
2891
2881
  key: "numbered_list",
2892
2882
  ...e.dictionary.slash_menu.numbered_list
2893
- }), k(e, "bulletListItem") && t.push({
2883
+ }), C(e, "bulletListItem") && t.push({
2894
2884
  onItemClick: () => {
2895
2885
  b(e, {
2896
2886
  type: "bulletListItem"
@@ -2899,7 +2889,7 @@ function yo(e) {
2899
2889
  badge: M("Mod-Shift-8"),
2900
2890
  key: "bullet_list",
2901
2891
  ...e.dictionary.slash_menu.bullet_list
2902
- }), k(e, "checkListItem") && t.push({
2892
+ }), C(e, "checkListItem") && t.push({
2903
2893
  onItemClick: () => {
2904
2894
  b(e, {
2905
2895
  type: "checkListItem"
@@ -2908,7 +2898,7 @@ function yo(e) {
2908
2898
  badge: M("Mod-Shift-9"),
2909
2899
  key: "check_list",
2910
2900
  ...e.dictionary.slash_menu.check_list
2911
- }), k(e, "paragraph") && t.push({
2901
+ }), C(e, "paragraph") && t.push({
2912
2902
  onItemClick: () => {
2913
2903
  b(e, {
2914
2904
  type: "paragraph"
@@ -2917,7 +2907,7 @@ function yo(e) {
2917
2907
  badge: M("Mod-Alt-0"),
2918
2908
  key: "paragraph",
2919
2909
  ...e.dictionary.slash_menu.paragraph
2920
- }), k(e, "codeBlock") && t.push({
2910
+ }), C(e, "codeBlock") && t.push({
2921
2911
  onItemClick: () => {
2922
2912
  b(e, {
2923
2913
  type: "codeBlock"
@@ -2926,13 +2916,13 @@ function yo(e) {
2926
2916
  badge: M("Mod-Alt-c"),
2927
2917
  key: "code_block",
2928
2918
  ...e.dictionary.slash_menu.code_block
2929
- }), k(e, "divider") && t.push({
2919
+ }), C(e, "divider") && t.push({
2930
2920
  onItemClick: () => {
2931
2921
  b(e, { type: "divider" });
2932
2922
  },
2933
2923
  key: "divider",
2934
2924
  ...e.dictionary.slash_menu.divider
2935
- }), k(e, "table") && t.push({
2925
+ }), C(e, "table") && t.push({
2936
2926
  onItemClick: () => {
2937
2927
  b(e, {
2938
2928
  type: "table",
@@ -2952,59 +2942,47 @@ function yo(e) {
2952
2942
  badge: void 0,
2953
2943
  key: "table",
2954
2944
  ...e.dictionary.slash_menu.table
2955
- }), k(e, "image", { url: "string" }) && t.push({
2945
+ }), C(e, "image", { url: "string" }) && t.push({
2956
2946
  onItemClick: () => {
2947
+ var o;
2957
2948
  const n = b(e, {
2958
2949
  type: "image"
2959
2950
  });
2960
- e.transact(
2961
- (o) => o.setMeta(e.filePanel.plugins[0], {
2962
- block: n
2963
- })
2964
- );
2951
+ (o = e.getExtension(I)) == null || o.showMenu(n.id);
2965
2952
  },
2966
2953
  key: "image",
2967
2954
  ...e.dictionary.slash_menu.image
2968
- }), k(e, "video", { url: "string" }) && t.push({
2955
+ }), C(e, "video", { url: "string" }) && t.push({
2969
2956
  onItemClick: () => {
2957
+ var o;
2970
2958
  const n = b(e, {
2971
2959
  type: "video"
2972
2960
  });
2973
- e.transact(
2974
- (o) => o.setMeta(e.filePanel.plugins[0], {
2975
- block: n
2976
- })
2977
- );
2961
+ (o = e.getExtension(I)) == null || o.showMenu(n.id);
2978
2962
  },
2979
2963
  key: "video",
2980
2964
  ...e.dictionary.slash_menu.video
2981
- }), k(e, "audio", { url: "string" }) && t.push({
2965
+ }), C(e, "audio", { url: "string" }) && t.push({
2982
2966
  onItemClick: () => {
2967
+ var o;
2983
2968
  const n = b(e, {
2984
2969
  type: "audio"
2985
2970
  });
2986
- e.transact(
2987
- (o) => o.setMeta(e.filePanel.plugins[0], {
2988
- block: n
2989
- })
2990
- );
2971
+ (o = e.getExtension(I)) == null || o.showMenu(n.id);
2991
2972
  },
2992
2973
  key: "audio",
2993
2974
  ...e.dictionary.slash_menu.audio
2994
- }), k(e, "file", { url: "string" }) && t.push({
2975
+ }), C(e, "file", { url: "string" }) && t.push({
2995
2976
  onItemClick: () => {
2977
+ var o;
2996
2978
  const n = b(e, {
2997
2979
  type: "file"
2998
2980
  });
2999
- e.transact(
3000
- (o) => o.setMeta(e.filePanel.plugins[0], {
3001
- block: n
3002
- })
3003
- );
2981
+ (o = e.getExtension(I)) == null || o.showMenu(n.id);
3004
2982
  },
3005
2983
  key: "file",
3006
2984
  ...e.dictionary.slash_menu.file
3007
- }), k(e, "heading", {
2985
+ }), C(e, "heading", {
3008
2986
  level: "number",
3009
2987
  isToggleable: "boolean"
3010
2988
  }) && t.push(
@@ -3038,7 +3016,7 @@ function yo(e) {
3038
3016
  key: "toggle_heading_3",
3039
3017
  ...e.dictionary.slash_menu.toggle_heading_3
3040
3018
  }
3041
- ), k(e, "heading", { level: "number" }) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((n) => n > 3).forEach((n) => {
3019
+ ), C(e, "heading", { level: "number" }) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((n) => n > 3).forEach((n) => {
3042
3020
  t.push({
3043
3021
  onItemClick: () => {
3044
3022
  b(e, {
@@ -3051,7 +3029,8 @@ function yo(e) {
3051
3029
  });
3052
3030
  }), t.push({
3053
3031
  onItemClick: () => {
3054
- e.openSuggestionMenu(":", {
3032
+ var n;
3033
+ (n = e.getExtension(_n)) == null || n.openSuggestionMenu(":", {
3055
3034
  deleteTriggerCharacter: !0,
3056
3035
  ignoreQueryLength: !0
3057
3036
  });
@@ -3060,44 +3039,29 @@ function yo(e) {
3060
3039
  ...e.dictionary.slash_menu.emoji
3061
3040
  }), t;
3062
3041
  }
3063
- function vo(e, t) {
3042
+ function Ao(e, t) {
3064
3043
  return e.filter(
3065
3044
  ({ title: n, aliases: o }) => n.toLowerCase().includes(t.toLowerCase()) || o && o.filter(
3066
3045
  (r) => r.toLowerCase().includes(t.toLowerCase())
3067
3046
  ).length !== 0
3068
3047
  );
3069
3048
  }
3070
- function Pn(e) {
3071
- return "pageBreak" in e.schema.blockSchema;
3072
- }
3073
- function So(e) {
3074
- const t = [];
3075
- return Pn(e) && t.push({
3076
- ...e.dictionary.slash_menu.page_break,
3077
- onItemClick: () => {
3078
- b(e, {
3079
- type: "pageBreak"
3080
- });
3081
- },
3082
- key: "page_break"
3083
- }), t;
3084
- }
3085
- const On = {
3086
- audio: Vt(),
3087
- bulletListItem: an(),
3088
- checkListItem: cn(),
3089
- codeBlock: Ut(),
3049
+ const Po = {
3050
+ audio: Ft(),
3051
+ bulletListItem: cn(),
3052
+ checkListItem: dn(),
3053
+ codeBlock: qt(),
3090
3054
  divider: Gt(),
3091
- file: qt(),
3092
- heading: Qt(),
3093
- image: on(),
3094
- numberedListItem: un(),
3055
+ file: Xt(),
3056
+ heading: Yt(),
3057
+ image: an(),
3058
+ numberedListItem: fn(),
3095
3059
  paragraph: bn(),
3096
- quote: Cn(),
3097
- table: Bn(),
3098
- toggleListItem: fn(),
3099
- video: Hn()
3100
- }, Dn = Ee(
3060
+ quote: kn(),
3061
+ table: Tn(),
3062
+ toggleListItem: hn(),
3063
+ video: Nn()
3064
+ }, Rn = Le(
3101
3065
  {
3102
3066
  type: "textColor",
3103
3067
  propSchema: "string"
@@ -3112,7 +3076,7 @@ const On = {
3112
3076
  },
3113
3077
  toExternalHTML: (e) => {
3114
3078
  const t = document.createElement("span");
3115
- return e !== m.textColor.default && (t.style.color = e in B ? B[e].text : e), {
3079
+ return e !== g.textColor.default && (t.style.color = e in T ? T[e].text : e), {
3116
3080
  dom: t,
3117
3081
  contentDOM: t
3118
3082
  };
@@ -3122,7 +3086,7 @@ const On = {
3122
3086
  return e.style.color;
3123
3087
  }
3124
3088
  }
3125
- ), _n = Ee(
3089
+ ), Wn = Le(
3126
3090
  {
3127
3091
  type: "backgroundColor",
3128
3092
  propSchema: "string"
@@ -3137,7 +3101,7 @@ const On = {
3137
3101
  },
3138
3102
  toExternalHTML: (e) => {
3139
3103
  const t = document.createElement("span");
3140
- return e !== m.backgroundColor.default && (t.style.backgroundColor = e in B ? B[e].background : e), {
3104
+ return e !== g.backgroundColor.default && (t.style.backgroundColor = e in T ? T[e].background : e), {
3141
3105
  dom: t,
3142
3106
  contentDOM: t
3143
3107
  };
@@ -3147,142 +3111,125 @@ const On = {
3147
3111
  return e.style.backgroundColor;
3148
3112
  }
3149
3113
  }
3150
- ), He = {
3151
- bold: H(Ze, "boolean"),
3152
- italic: H(qe, "boolean"),
3153
- underline: H(Ke, "boolean"),
3154
- strike: H(Xe, "boolean"),
3155
- code: H(ze, "boolean"),
3156
- textColor: Dn,
3157
- backgroundColor: _n
3158
- }, Eo = Se(He), Ie = {
3114
+ ), Fn = {
3115
+ bold: H(rt, "boolean"),
3116
+ italic: H(st, "boolean"),
3117
+ underline: H(ct, "boolean"),
3118
+ strike: H(it, "boolean"),
3119
+ code: H(at, "boolean"),
3120
+ textColor: Rn,
3121
+ backgroundColor: Wn
3122
+ }, No = Mt(Fn), $n = {
3159
3123
  text: { config: "text", implementation: {} },
3160
3124
  link: { config: "link", implementation: {} }
3161
- }, wo = ye(
3162
- Ie
3125
+ }, Ho = wt(
3126
+ $n
3163
3127
  );
3164
- class Pe extends wt {
3165
- static create(t) {
3166
- return new Pe({
3167
- blockSpecs: (t == null ? void 0 : t.blockSpecs) ?? On,
3168
- inlineContentSpecs: (t == null ? void 0 : t.inlineContentSpecs) ?? Ie,
3169
- styleSpecs: (t == null ? void 0 : t.styleSpecs) ?? He
3170
- });
3171
- }
3172
- }
3173
3128
  export {
3174
- re as $,
3175
- cn as A,
3176
- dn as B,
3177
- un as C,
3178
- pn as D,
3179
- go as E,
3180
- It as F,
3181
- fn as G,
3129
+ C as $,
3130
+ dn as A,
3131
+ pn as B,
3132
+ fn as C,
3133
+ gn as D,
3134
+ Mo as E,
3135
+ Ot as F,
3136
+ hn as G,
3182
3137
  mn as H,
3183
- hn as I,
3184
- ho as J,
3185
- gn as K,
3186
- bn as L,
3187
- kn as M,
3188
- Cn as N,
3189
- Sn as O,
3190
- Bn as P,
3191
- Tn as Q,
3192
- An as R,
3193
- Nn as S,
3194
- Hn as T,
3195
- Xt as U,
3196
- xe as V,
3197
- bo as W,
3198
- Pn as X,
3199
- So as Y,
3200
- Pe as Z,
3201
- it as _,
3202
- Ae as a,
3203
- lt as a0,
3204
- On as a1,
3205
- He as a2,
3206
- Eo as a3,
3207
- Ie as a4,
3208
- wo as a5,
3209
- k as a6,
3210
- ko as a7,
3211
- Co as a8,
3212
- m as a9,
3213
- ft as aA,
3214
- mt as aB,
3215
- ht as aC,
3216
- oo as aD,
3217
- v as aE,
3218
- ut as aF,
3219
- G as aG,
3220
- pt as aH,
3221
- gt as aI,
3222
- ye as aJ,
3223
- kt as aK,
3224
- Ee as aL,
3225
- bt as aM,
3226
- _ as aN,
3227
- ve as aO,
3228
- H as aP,
3229
- Se as aQ,
3230
- wt as aR,
3231
- ct as aS,
3232
- M as aT,
3233
- eo as aU,
3234
- V as aV,
3235
- to as aW,
3236
- y as aa,
3237
- T as ab,
3238
- uo as ac,
3239
- po as ad,
3240
- fo as ae,
3241
- ro as af,
3242
- ao as ag,
3243
- dt as ah,
3244
- so as ai,
3245
- xt as aj,
3246
- Lt as ak,
3247
- Wt as al,
3248
- Rt as am,
3249
- mo as an,
3250
- co as ao,
3251
- I as ap,
3252
- io as aq,
3253
- no as ar,
3254
- q as as,
3255
- Bt as at,
3256
- w as au,
3257
- B as av,
3258
- lo as aw,
3259
- b as ax,
3260
- yo as ay,
3261
- vo as az,
3262
- Ot as b,
3263
- Pt as c,
3264
- Dt as d,
3265
- _t as e,
3266
- Vt as f,
3267
- jt as g,
3268
- Ut as h,
3269
- we as i,
3270
- $t as j,
3138
+ bn as I,
3139
+ Cn as J,
3140
+ kn as K,
3141
+ En as L,
3142
+ Tn as M,
3143
+ Bn as N,
3144
+ An as O,
3145
+ Pn as P,
3146
+ Nn as Q,
3147
+ Kt as R,
3148
+ Be as S,
3149
+ mt as T,
3150
+ le as U,
3151
+ bt as V,
3152
+ Po as W,
3153
+ Fn as X,
3154
+ No as Y,
3155
+ $n as Z,
3156
+ Ho as _,
3157
+ Ie as a,
3158
+ Lo as a0,
3159
+ To as a1,
3160
+ g as a2,
3161
+ y as a3,
3162
+ A as a4,
3163
+ Eo as a5,
3164
+ xo as a6,
3165
+ wo as a7,
3166
+ I as a8,
3167
+ _n as a9,
3168
+ Z as aA,
3169
+ yt as aB,
3170
+ xt as aC,
3171
+ Lt as aD,
3172
+ Le as aE,
3173
+ St as aF,
3174
+ V as aG,
3175
+ Me as aH,
3176
+ H as aI,
3177
+ ht as aJ,
3178
+ M as aK,
3179
+ uo as aL,
3180
+ W as aM,
3181
+ po as aN,
3182
+ In as aO,
3183
+ b as aa,
3184
+ Bo as ab,
3185
+ Ao as ac,
3186
+ go as ad,
3187
+ Mt as ae,
3188
+ wt as af,
3189
+ ho as ag,
3190
+ v as ah,
3191
+ Bt as ai,
3192
+ Tt as aj,
3193
+ mo as ak,
3194
+ bo as al,
3195
+ Ct as am,
3196
+ Co as an,
3197
+ yo as ao,
3198
+ fo as ap,
3199
+ So as aq,
3200
+ ko as ar,
3201
+ D as as,
3202
+ K as at,
3203
+ Pt as au,
3204
+ T as av,
3205
+ vo as aw,
3206
+ vt as ax,
3207
+ Et as ay,
3208
+ kt as az,
3209
+ Vt as b,
3210
+ _t as c,
3211
+ Rt as d,
3212
+ Wt as e,
3213
+ Ft as f,
3214
+ Ut as g,
3215
+ qt as h,
3216
+ Te as i,
3217
+ jt as j,
3271
3218
  Gt as k,
3272
3219
  Zt as l,
3273
3220
  zt as m,
3274
- qt as n,
3275
- Kt as o,
3276
- ie as p,
3277
- Qt as q,
3278
- Yt as r,
3279
- Jt as s,
3280
- en as t,
3281
- tn as u,
3282
- nn as v,
3283
- on as w,
3284
- rn as x,
3285
- an as y,
3286
- sn as z
3221
+ Xt as n,
3222
+ Jt as o,
3223
+ ue as p,
3224
+ Yt as q,
3225
+ en as r,
3226
+ tn as s,
3227
+ nn as t,
3228
+ on as u,
3229
+ rn as v,
3230
+ an as w,
3231
+ sn as x,
3232
+ cn as y,
3233
+ ln as z
3287
3234
  };
3288
- //# sourceMappingURL=BlockNoteSchema-Bi-eeHal.js.map
3235
+ //# sourceMappingURL=defaultBlocks-DgA_mtQV.js.map