@blocknote/core 0.49.0 → 0.51.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 (147) hide show
  1. package/dist/blocknote.cjs +1 -1
  2. package/dist/blocknote.js +4 -4
  3. package/dist/{blocks-CSfJen16.js → blocks-D0lMxErU.js} +612 -568
  4. package/dist/blocks-D0lMxErU.js.map +1 -0
  5. package/dist/blocks-KyMOxPT3.cjs +11 -0
  6. package/dist/blocks-KyMOxPT3.cjs.map +1 -0
  7. package/dist/blocks.cjs +1 -1
  8. package/dist/blocks.js +2 -2
  9. package/dist/comments.cjs +1 -1
  10. package/dist/comments.cjs.map +1 -1
  11. package/dist/comments.js +17 -14
  12. package/dist/comments.js.map +1 -1
  13. package/dist/{en-QsSI16s5.js → en-B9hMApn4.js} +4 -2
  14. package/dist/en-B9hMApn4.js.map +1 -0
  15. package/dist/{en-C4ykW581.cjs → en-Cj5r8sW_.cjs} +2 -2
  16. package/dist/en-Cj5r8sW_.cjs.map +1 -0
  17. package/dist/{extensions-C3nguvVr.js → extensions-CQFfm5f5.js} +621 -353
  18. package/dist/extensions-CQFfm5f5.js.map +1 -0
  19. package/dist/extensions-Cuw3zOdC.cjs +52 -0
  20. package/dist/extensions-Cuw3zOdC.cjs.map +1 -0
  21. package/dist/extensions.cjs +1 -1
  22. package/dist/extensions.js +3 -3
  23. package/dist/locales.cjs +1 -1
  24. package/dist/locales.cjs.map +1 -1
  25. package/dist/locales.js +68 -24
  26. package/dist/locales.js.map +1 -1
  27. package/dist/{src-DQfz4zLM.js → src-DK_8q1j5.js} +1135 -625
  28. package/dist/src-DK_8q1j5.js.map +1 -0
  29. package/dist/src-_83jmA7A.cjs +21 -0
  30. package/dist/src-_83jmA7A.cjs.map +1 -0
  31. package/dist/style.css +1 -1
  32. package/dist/webpack-stats.json +1 -1
  33. package/dist/yjs.cjs +1 -1
  34. package/dist/yjs.js +8 -8
  35. package/package.json +1 -13
  36. package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +7 -7
  37. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +5 -3
  38. package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +5 -5
  39. package/src/api/blockManipulation/commands/moveBlocks/__snapshots__/moveBlocks.test.ts.snap +2550 -291
  40. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +83 -2
  41. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +103 -42
  42. package/src/api/blockManipulation/commands/nestBlock/__snapshots__/nestBlock.test.ts.snap +0 -143
  43. package/src/api/blockManipulation/commands/replaceBlocks/__snapshots__/replaceBlocks.test.ts.snap +12 -12
  44. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +5 -3
  45. package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +6 -6
  46. package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +22 -22
  47. package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +12 -8
  48. package/src/api/blockManipulation/setupTestEnv.ts +1 -1
  49. package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +2 -6
  50. package/src/api/clipboard/fromClipboard/pasteExtension.ts +7 -2
  51. package/src/api/clipboard/toClipboard/copyExtension.ts +21 -16
  52. package/src/api/exporters/markdown/htmlToMarkdown.ts +813 -0
  53. package/src/api/exporters/markdown/markdownExporter.ts +2 -21
  54. package/src/api/nodeConversions/blockToNode.ts +3 -2
  55. package/src/api/parsers/html/util/__snapshots__/nestedLists.test.ts.snap +122 -107
  56. package/src/api/parsers/html/util/nestedLists.test.ts +1 -12
  57. package/src/api/parsers/markdown/markdownToHtml.ts +1194 -0
  58. package/src/api/parsers/markdown/parseMarkdown.ts +2 -101
  59. package/src/blocks/Audio/block.ts +1 -4
  60. package/src/blocks/Code/block.test.ts +258 -0
  61. package/src/blocks/File/block.ts +1 -4
  62. package/src/blocks/File/helpers/render/createFileBlockWrapper.ts +7 -2
  63. package/src/blocks/Image/block.ts +9 -6
  64. package/src/blocks/ListItem/BulletListItem/block.ts +7 -4
  65. package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts +3 -4
  66. package/src/blocks/Table/TableExtension.ts +38 -9
  67. package/src/blocks/Video/block.ts +4 -5
  68. package/src/blocks/Video/parseVideoElement.ts +2 -1
  69. package/src/blocks/defaultBlocks.ts +34 -1
  70. package/src/comments/extension.ts +30 -11
  71. package/src/editor/Block.css +22 -18
  72. package/src/editor/BlockNoteEditor.test.ts +10 -4
  73. package/src/editor/BlockNoteEditor.ts +30 -13
  74. package/src/editor/managers/BlockManager.ts +10 -6
  75. package/src/editor/managers/ExtensionManager/extensions.ts +8 -9
  76. package/src/editor/managers/ExtensionManager/index.ts +80 -25
  77. package/src/editor/performance.test.ts +2 -2
  78. package/src/editor/transformPasted.test.ts +295 -0
  79. package/src/editor/transformPasted.ts +77 -0
  80. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor-forked.json +1 -12
  81. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor.json +0 -11
  82. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-forked.html +1 -1
  83. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap.html +1 -1
  84. package/src/extensions/SideMenu/SideMenu.ts +2 -2
  85. package/src/extensions/SideMenu/dragging.ts +7 -10
  86. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +21 -0
  87. package/src/extensions/TableHandles/TableHandles.ts +2 -0
  88. package/src/extensions/TrailingNode/TrailingNode.ts +124 -65
  89. package/src/extensions/tiptap-extensions/Link/index.ts +1 -1
  90. package/src/extensions/tiptap-extensions/Link/link.ts +49 -18
  91. package/src/i18n/locales/ar.ts +3 -1
  92. package/src/i18n/locales/de.ts +3 -1
  93. package/src/i18n/locales/en.ts +3 -1
  94. package/src/i18n/locales/es.ts +3 -1
  95. package/src/i18n/locales/fa.ts +3 -1
  96. package/src/i18n/locales/fr.ts +4 -2
  97. package/src/i18n/locales/he.ts +3 -1
  98. package/src/i18n/locales/hr.ts +3 -1
  99. package/src/i18n/locales/is.ts +3 -1
  100. package/src/i18n/locales/it.ts +3 -1
  101. package/src/i18n/locales/ja.ts +3 -1
  102. package/src/i18n/locales/ko.ts +3 -1
  103. package/src/i18n/locales/nl.ts +3 -1
  104. package/src/i18n/locales/no.ts +3 -1
  105. package/src/i18n/locales/pl.ts +3 -1
  106. package/src/i18n/locales/pt.ts +3 -1
  107. package/src/i18n/locales/ru.ts +3 -1
  108. package/src/i18n/locales/sk.ts +3 -1
  109. package/src/i18n/locales/uk.ts +3 -1
  110. package/src/i18n/locales/uz.ts +3 -1
  111. package/src/i18n/locales/vi.ts +3 -1
  112. package/src/i18n/locales/zh-tw.ts +3 -1
  113. package/src/i18n/locales/zh.ts +3 -1
  114. package/types/src/api/blockManipulation/commands/moveBlocks/moveBlocks.d.ts +13 -2
  115. package/types/src/api/clipboard/fromClipboard/handleVSCodePaste.d.ts +1 -1
  116. package/types/src/api/exporters/markdown/htmlToMarkdown.d.ts +11 -0
  117. package/types/src/api/parsers/markdown/markdownToHtml.d.ts +5 -0
  118. package/types/src/blocks/Code/block.test.d.ts +1 -0
  119. package/types/src/blocks/Video/block.d.ts +2 -0
  120. package/types/src/blocks/Video/parseVideoElement.d.ts +1 -0
  121. package/types/src/comments/extension.d.ts +2 -1
  122. package/types/src/editor/BlockNoteEditor.d.ts +20 -6
  123. package/types/src/editor/managers/BlockManager.d.ts +8 -4
  124. package/types/src/editor/transformPasted.test.d.ts +1 -0
  125. package/types/src/extensions/TrailingNode/TrailingNode.d.ts +8 -3
  126. package/types/src/extensions/tiptap-extensions/Link/index.d.ts +1 -1
  127. package/types/src/extensions/tiptap-extensions/Link/link.d.ts +12 -0
  128. package/types/src/i18n/locales/en.d.ts +2 -0
  129. package/types/src/i18n/locales/fa.d.ts +2 -0
  130. package/types/src/i18n/locales/sk.d.ts +2 -0
  131. package/dist/blocks-CSfJen16.js.map +0 -1
  132. package/dist/blocks-_lpGWKOa.cjs +0 -11
  133. package/dist/blocks-_lpGWKOa.cjs.map +0 -1
  134. package/dist/en-C4ykW581.cjs.map +0 -1
  135. package/dist/en-QsSI16s5.js.map +0 -1
  136. package/dist/extensions-BfYaEv6F.cjs +0 -2
  137. package/dist/extensions-BfYaEv6F.cjs.map +0 -1
  138. package/dist/extensions-C3nguvVr.js.map +0 -1
  139. package/dist/src-ChTwrMcE.cjs +0 -5
  140. package/dist/src-ChTwrMcE.cjs.map +0 -1
  141. package/dist/src-DQfz4zLM.js.map +0 -1
  142. package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +0 -42
  143. package/src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.ts +0 -19
  144. package/src/api/exporters/markdown/util/removeUnderlinesRehypePlugin.ts +0 -39
  145. package/types/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.d.ts +0 -7
  146. package/types/src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.d.ts +0 -2
  147. package/types/src/api/exporters/markdown/util/removeUnderlinesRehypePlugin.d.ts +0 -6
@@ -1,27 +1,22 @@
1
- import { An as e, At as t, Ct as n, En as r, Et as i, Ht as a, Jn as o, Ln as s, Ot as c, Qt as l, Rn as u, Tt as d, V as f, Xt as p, Zt as m, an as h, cn as ee, dn as g, f as te, gn as _, gt as ne, hn as v, in as y, kt as b, mn as x, nn as re, on as ie, pn as ae, pt as oe, rn as se, t as ce, tn as le, vn as S, vt as ue, wt as de } from "./blocks-CSfJen16.js";
2
- import { C as fe, D as pe, E as me, O as he, S as ge, T as _e, _ as ve, d as ye, f as be, k as xe, l as Se, m as Ce, n as we, o as Te, p as Ee, t as De, u as Oe, v as ke, w as Ae, x as je, y as C } from "./extensions-C3nguvVr.js";
3
- import { r as Me, t as Ne } from "./BlockNoteExtension-B6RhuQ3V.js";
4
- import { t as Pe } from "./ShowSelection-BsHFfdMi.js";
5
- import { t as Fe } from "./en-QsSI16s5.js";
6
- import { t as Ie } from "./EventEmitter-CuPnGDYt.js";
7
- import { DOMParser as Le, DOMSerializer as Re, Fragment as w, Node as ze, NodeRange as Be, Slice as T } from "prosemirror-model";
8
- import { ReplaceAroundStep as E, ReplaceStep as Ve, canJoin as He, liftTarget as Ue } from "prosemirror-transform";
9
- import { Editor as We, Extension as D, Mark as O, Node as k, combineTransactionSteps as Ge, createDocument as Ke, extensions as A, findChildrenInRange as qe, findParentNodeClosestToPos as Je, getAttributes as Ye, getChangedRanges as Xe, getMarkRange as Ze, getMarksBetween as Qe, getSchema as $e, isNodeSelection as et, markPasteRule as tt, mergeAttributes as j, posToDOMRect as nt, selectionToInsertionEnd as rt } from "@tiptap/core";
1
+ import { $t as e, At as t, Dn as n, Dt as r, Et as i, H as a, Qt as o, Rn as s, Tt as c, Ut as l, Yn as u, Zt as d, _n as f, _t as p, an as m, f as h, fn as g, gn as _, hn as v, in as ee, jn as te, jt as ne, kt as y, ln as re, m as b, mn as x, mt as ie, nn as ae, on as S, rn as oe, sn as se, t as ce, wt as le, yn as C, yt as ue, zn as w } from "./blocks-D0lMxErU.js";
2
+ import { C as de, D as fe, E as pe, O as me, S as he, T as ge, _ as _e, b as ve, d as ye, f as be, l as xe, m as Se, n as Ce, o as we, p as Te, t as Ee, u as De, v as Oe, w as ke, x as Ae } from "./extensions-CQFfm5f5.js";
3
+ import { r as je, t as Me } from "./BlockNoteExtension-B6RhuQ3V.js";
4
+ import { t as Ne } from "./ShowSelection-BsHFfdMi.js";
5
+ import { t as Pe } from "./en-B9hMApn4.js";
6
+ import { t as Fe } from "./EventEmitter-CuPnGDYt.js";
7
+ import { DOMParser as Ie, DOMSerializer as Le, Fragment as T, Node as Re, NodeRange as ze, Slice as E } from "prosemirror-model";
8
+ import { ReplaceAroundStep as D, ReplaceStep as Be, canJoin as Ve, liftTarget as He } from "prosemirror-transform";
9
+ import { Editor as Ue, Extension as O, Mark as k, Node as A, combineTransactionSteps as We, createDocument as Ge, extensions as j, findChildrenInRange as Ke, findParentNodeClosestToPos as qe, getAttributes as Je, getChangedRanges as Ye, getMarkRange as Xe, getMarksBetween as Ze, getSchema as Qe, isNodeSelection as $e, markPasteRule as et, mergeAttributes as tt, posToDOMRect as nt, selectionToInsertionEnd as rt } from "@tiptap/core";
10
10
  import { NodeSelection as M, Plugin as N, TextSelection as P } from "prosemirror-state";
11
11
  import { Fragment as F, Slice as I } from "@tiptap/pm/model";
12
- import { CellSelection as L, TableMap as it } from "prosemirror-tables";
13
- import { Plugin as at, PluginKey as ot } from "@tiptap/pm/state";
14
- import st from "remark-gfm";
15
- import { unified as ct } from "unified";
16
- import lt from "remark-parse";
17
- import ut, { defaultHandlers as dt } from "remark-rehype";
18
- import ft from "rehype-stringify";
19
- import { InputRule as pt, inputRules as mt } from "@handlewithcare/prosemirror-inputrules";
20
- import { keymap as ht } from "@tiptap/pm/keymap";
21
- import { Gapcursor as gt } from "@tiptap/extensions/gap-cursor";
22
- import { Text as _t } from "@tiptap/extension-text";
12
+ import { CellSelection as it, TableMap as at } from "prosemirror-tables";
13
+ import { Plugin as ot, PluginKey as st } from "@tiptap/pm/state";
14
+ import { InputRule as ct, inputRules as lt } from "@handlewithcare/prosemirror-inputrules";
15
+ import { keymap as ut } from "@tiptap/pm/keymap";
16
+ import { Gapcursor as dt } from "@tiptap/extensions/gap-cursor";
17
+ import { Text as ft } from "@tiptap/extension-text";
23
18
  //#region src/schema/inlineContent/createSpec.ts
24
- function vt(e, t) {
19
+ function pt(e, t) {
25
20
  let n = [{
26
21
  tag: `[data-inline-content-type="${e.type}"]`,
27
22
  contentElement: (e) => {
@@ -38,62 +33,65 @@ function vt(e, t) {
38
33
  }
39
34
  }), n;
40
35
  }
41
- function yt(e, t) {
42
- return l(k.create({
43
- name: e.type,
36
+ function mt(r, i) {
37
+ return e(A.create({
38
+ name: r.type,
44
39
  inline: !0,
45
40
  group: "inline",
46
- draggable: t.meta?.draggable,
47
- selectable: e.content === "styled",
48
- atom: e.content === "none",
49
- content: e.content === "styled" ? "inline*" : "",
41
+ draggable: i.meta?.draggable,
42
+ selectable: r.content === "styled",
43
+ atom: r.content === "none",
44
+ content: r.content === "styled" ? "inline*" : "",
50
45
  addAttributes() {
51
- return r(e.propSchema);
46
+ return n(r.propSchema);
52
47
  },
53
48
  addKeyboardShortcuts() {
54
- return m(e);
49
+ return o(r);
55
50
  },
56
51
  parseHTML() {
57
- return vt(e, t.parse);
52
+ return pt(r, i.parse);
58
53
  },
59
- renderHTML({ node: n }) {
60
- let r = this.options.editor;
61
- return p(t.render.call({
54
+ renderHTML({ node: e }) {
55
+ let t = this.options.editor;
56
+ return d(i.render.call({
62
57
  renderType: "dom",
63
58
  props: void 0
64
- }, h(n, r.schema.inlineContentSchema, r.schema.styleSchema), () => {}, r), e.type, n.attrs, e.propSchema);
59
+ }, S(e, t.schema.inlineContentSchema, t.schema.styleSchema), () => {}, t), r.type, e.attrs, r.propSchema);
65
60
  },
66
61
  addNodeView() {
67
- return (n) => {
68
- let { node: r, getPos: i } = n, a = this.options.editor;
69
- return p(t.render.call({
62
+ return (e) => {
63
+ let { node: n, getPos: a } = e, o = this.options.editor;
64
+ return d(i.render.call({
70
65
  renderType: "nodeView",
71
- props: n
72
- }, h(r, a.schema.inlineContentSchema, a.schema.styleSchema), (e) => {
73
- let t = b([e], a.pmSchema), n = i();
74
- n && a.transact((e) => e.replaceWith(n, n + r.nodeSize, t));
75
- }, a), e.type, r.attrs, e.propSchema);
66
+ props: e
67
+ }, S(n, o.schema.inlineContentSchema, o.schema.styleSchema), (e) => {
68
+ let r = t([e], o.pmSchema), i = a();
69
+ i && o.transact((e) => e.replaceWith(i, i + n.nodeSize, r));
70
+ }, o), r.type, n.attrs, r.propSchema);
76
71
  };
77
72
  }
78
- }), e.propSchema, {
79
- ...t,
80
- toExternalHTML: t.toExternalHTML,
81
- render(n, r, i) {
82
- return p(t.render(n, r, i), e.type, n.props, e.propSchema);
73
+ }), r.propSchema, {
74
+ ...i,
75
+ toExternalHTML: i.toExternalHTML,
76
+ render(e, t, n) {
77
+ return d(i.render(e, t, n), r.type, e.props, r.propSchema);
83
78
  }
84
79
  });
85
80
  }
86
81
  //#endregion
87
82
  //#region src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts
88
- function bt(e, t, n, r = "before") {
89
- let a = typeof n == "string" ? n : n.id, o = g(e), s = t.map((e) => c(e, o)), l = i(a, e.doc);
90
- if (!l) throw Error(`Block with ID ${a} not found`);
91
- let u = l.posBeforeNode;
92
- return r === "after" && (u += l.node.nodeSize), e.step(new Ve(u, u, new T(w.from(s), 0, 0))), s.map((e) => y(e, o));
83
+ function ht(e, t, n, i = "before") {
84
+ let a = typeof n == "string" ? n : n.id, o = g(e), s = t.map((e) => {
85
+ let t = y(e, o);
86
+ return t.check(), t;
87
+ }), c = r(a, e.doc);
88
+ if (!c) throw Error(`Block with ID ${a} not found`);
89
+ let l = c.posBeforeNode;
90
+ return i === "after" && (l += c.node.nodeSize), e.step(new Be(l, l, new E(T.from(s), 0, 0))), s.map((e) => m(e, o));
93
91
  }
94
92
  //#endregion
95
93
  //#region src/api/blockManipulation/commands/replaceBlocks/util/fixColumnList.ts
96
- function R(e) {
94
+ function L(e) {
97
95
  if (!e || e.type.name !== "column") throw Error("Invalid columnPos: does not point to column node.");
98
96
  let t = e.firstChild;
99
97
  if (!t) throw Error("Invalid column: does not have child node.");
@@ -101,77 +99,80 @@ function R(e) {
101
99
  if (!n) throw Error("Invalid blockContainer: does not have child node.");
102
100
  return e.childCount === 1 && t.childCount === 1 && n.type.name === "paragraph" && n.content.content.length === 0;
103
101
  }
104
- function xt(e, t) {
102
+ function gt(e, t) {
105
103
  let n = e.doc.resolve(t), r = n.nodeAfter;
106
104
  if (!r || r.type.name !== "columnList") throw Error("Invalid columnListPos: does not point to columnList node.");
107
105
  for (let t = r.childCount - 1; t >= 0; t--) {
108
106
  let r = e.doc.resolve(n.pos + 1).posAtIndex(t), i = e.doc.resolve(r).nodeAfter;
109
107
  if (!i || i.type.name !== "column") throw Error("Invalid columnPos: does not point to column node.");
110
- R(i) && e.delete(r, r + i.nodeSize);
108
+ L(i) && e.delete(r, r + i.nodeSize);
111
109
  }
112
110
  }
113
- function z(e, t) {
114
- xt(e, t);
111
+ function R(e, t) {
112
+ gt(e, t);
115
113
  let n = e.doc.resolve(t).nodeAfter;
116
114
  if (!n || n.type.name !== "columnList") throw Error("Invalid columnListPos: does not point to columnList node.");
117
115
  if (n.childCount > 2) return;
118
116
  if (n.childCount < 2) throw Error("Invalid columnList: contains fewer than two children.");
119
117
  let r = t + 1, i = e.doc.resolve(r).nodeAfter, a = t + n.nodeSize - 1, o = e.doc.resolve(a).nodeBefore;
120
118
  if (!i || !o) throw Error("Invalid columnList: does not contain children.");
121
- let s = R(i), c = R(o);
119
+ let s = L(i), c = L(o);
122
120
  if (s && c) {
123
121
  e.delete(t, t + n.nodeSize);
124
122
  return;
125
123
  }
126
124
  if (s) {
127
- e.step(new E(t, t + n.nodeSize, a - o.nodeSize + 1, a - 1, T.empty, 0, !1));
125
+ e.step(new D(t, t + n.nodeSize, a - o.nodeSize + 1, a - 1, E.empty, 0, !1));
128
126
  return;
129
127
  }
130
128
  if (c) {
131
- e.step(new E(t, t + n.nodeSize, r + 1, r + i.nodeSize - 1, T.empty, 0, !1));
129
+ e.step(new D(t, t + n.nodeSize, r + 1, r + i.nodeSize - 1, E.empty, 0, !1));
132
130
  return;
133
131
  }
134
132
  }
135
133
  //#endregion
136
134
  //#region src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts
137
- function B(e, t, n) {
138
- let r = g(e), i = n.map((e) => c(e, r)), a = new Set(t.map((e) => typeof e == "string" ? e : e.id)), o = [], s = /* @__PURE__ */ new Set(), l = typeof t[0] == "string" ? t[0] : t[0].id, u = 0;
139
- if (e.doc.descendants((t, c) => {
135
+ function z(e, t, n) {
136
+ let r = g(e), i = n.map((e) => {
137
+ let t = y(e, r);
138
+ return t.check(), t;
139
+ }), a = new Set(t.map((e) => typeof e == "string" ? e : e.id)), o = [], s = /* @__PURE__ */ new Set(), c = typeof t[0] == "string" ? t[0] : t[0].id, l = 0;
140
+ if (e.doc.descendants((t, u) => {
140
141
  if (a.size === 0) return !1;
141
142
  if (!t.type.isInGroup("bnBlock") || !a.has(t.attrs.id)) return !0;
142
- if (o.push(y(t, r)), a.delete(t.attrs.id), n.length > 0 && t.attrs.id === l) {
143
+ if (o.push(m(t, r)), a.delete(t.attrs.id), n.length > 0 && t.attrs.id === c) {
143
144
  let t = e.doc.nodeSize;
144
- e.insert(c, i);
145
+ e.insert(u, i);
145
146
  let n = e.doc.nodeSize;
146
- u += t - n;
147
+ l += t - n;
147
148
  }
148
- let d = e.doc.nodeSize, f = e.doc.resolve(c - u);
149
- f.node().type.name === "column" ? s.add(f.before(-1)) : f.node().type.name === "columnList" && s.add(f.before()), f.node().type.name === "blockGroup" && f.node(f.depth - 1).type.name !== "doc" && f.node().childCount === 1 ? e.delete(f.before(), f.after()) : e.delete(c - u, c - u + t.nodeSize);
149
+ let d = e.doc.nodeSize, f = e.doc.resolve(u - l);
150
+ f.node().type.name === "column" ? s.add(f.before(-1)) : f.node().type.name === "columnList" && s.add(f.before()), f.node().type.name === "blockGroup" && f.node(f.depth - 1).type.name !== "doc" && f.node().childCount === 1 ? e.delete(f.before(), f.after()) : e.delete(u - l, u - l + t.nodeSize);
150
151
  let p = e.doc.nodeSize;
151
- return u += d - p, !1;
152
+ return l += d - p, !1;
152
153
  }), a.size > 0) {
153
154
  let e = [...a].join("\n");
154
155
  throw Error("Blocks with the following IDs could not be found in the editor: " + e);
155
156
  }
156
- return s.forEach((t) => z(e, t)), {
157
- insertedBlocks: i.map((e) => y(e, r)),
157
+ return s.forEach((t) => R(e, t)), {
158
+ insertedBlocks: i.map((e) => m(e, r)),
158
159
  removedBlocks: o
159
160
  };
160
161
  }
161
162
  //#endregion
162
163
  //#region src/api/exporters/html/util/serializeBlocksInternalHTML.ts
163
- function St(e, n, r, i, a) {
164
+ function _t(e, n, r, i, a) {
164
165
  let o;
165
166
  if (!n) throw Error("blockContent is required");
166
- if (typeof n == "string") o = b([n], e.pmSchema, i);
167
- else if (Array.isArray(n)) o = b(n, e.pmSchema, i);
168
- else if (n.type === "tableContent") o = t(n, e.pmSchema);
169
- else throw new u(n.type);
167
+ if (typeof n == "string") o = t([n], e.pmSchema, i);
168
+ else if (Array.isArray(n)) o = t(n, e.pmSchema, i);
169
+ else if (n.type === "tableContent") o = ne(n, e.pmSchema);
170
+ else throw new w(n.type);
170
171
  let s = (a?.document ?? document).createDocumentFragment();
171
172
  for (let t of o) if (t.type.name !== "text" && e.schema.inlineContentSchema[t.type.name]) {
172
173
  let n = e.schema.inlineContentSpecs[t.type.name].implementation;
173
174
  if (n) {
174
- let i = h(t, e.schema.inlineContentSchema, e.schema.styleSchema), o = n.render.call({
175
+ let i = S(t, e.schema.inlineContentSchema, e.schema.styleSchema), o = n.render.call({
175
176
  renderType: "dom",
176
177
  props: void 0
177
178
  }, i, () => {}, e);
@@ -189,17 +190,17 @@ function St(e, n, r, i, a) {
189
190
  let t = e.schema.styleSpecs[r.type.name].implementation.render(r.attrs.stringValue, e);
190
191
  t.contentDOM.appendChild(n), n = t.dom;
191
192
  } else {
192
- let e = r.type.spec.toDOM(r, !0), t = Re.renderSpec(document, e);
193
+ let e = r.type.spec.toDOM(r, !0), t = Le.renderSpec(document, e);
193
194
  t.contentDOM.appendChild(n), n = t.dom;
194
195
  }
195
196
  s.appendChild(n);
196
197
  } else {
197
- let e = r.serializeFragment(w.from([t]), a);
198
+ let e = r.serializeFragment(T.from([t]), a);
198
199
  s.appendChild(e);
199
200
  }
200
201
  return s;
201
202
  }
202
- function Ct(e, t, n, r) {
203
+ function vt(e, t, n, r) {
203
204
  let i = e.pmSchema.nodes.blockContainer, a = t.props || {};
204
205
  for (let [n, r] of Object.entries(e.schema.blockSchema[t.type].propSchema)) !(n in a) && r.default !== void 0 && (a[n] = r.default);
205
206
  let o = t.children || [], s = e.blockImplementations[t.type].implementation.render.call({
@@ -211,12 +212,12 @@ function Ct(e, t, n, r) {
211
212
  children: o
212
213
  }, e);
213
214
  if (s.contentDOM && t.content) {
214
- let i = St(e, t.content, n, t.type, r);
215
+ let i = _t(e, t.content, n, t.type, r);
215
216
  s.contentDOM.appendChild(i);
216
217
  }
217
218
  if (e.pmSchema.nodes[t.type].isInGroup("bnBlock")) {
218
219
  if (t.children && t.children.length > 0) {
219
- let i = wt(e, t.children, n, r);
220
+ let i = yt(e, t.children, n, r);
220
221
  s.contentDOM?.append(i);
221
222
  }
222
223
  return s.dom;
@@ -225,61 +226,61 @@ function Ct(e, t, n, r) {
225
226
  id: t.id,
226
227
  ...a
227
228
  }));
228
- return c.contentDOM?.appendChild(s.dom), t.children && t.children.length > 0 && c.contentDOM?.appendChild(Tt(e, t.children, n, r)), c.dom;
229
+ return c.contentDOM?.appendChild(s.dom), t.children && t.children.length > 0 && c.contentDOM?.appendChild(bt(e, t.children, n, r)), c.dom;
229
230
  }
230
- function wt(e, t, n, r) {
231
+ function yt(e, t, n, r) {
231
232
  let i = (r?.document ?? document).createDocumentFragment();
232
233
  for (let a of t) {
233
- let t = Ct(e, a, n, r);
234
+ let t = vt(e, a, n, r);
234
235
  i.appendChild(t);
235
236
  }
236
237
  return i;
237
238
  }
238
- var Tt = (e, t, n, r) => {
239
- let i = e.pmSchema.nodes.blockGroup, a = i.spec.toDOM(i.create({})), o = wt(e, t, n, r);
239
+ var bt = (e, t, n, r) => {
240
+ let i = e.pmSchema.nodes.blockGroup, a = i.spec.toDOM(i.create({})), o = yt(e, t, n, r);
240
241
  return a.contentDOM?.appendChild(o), a.dom;
241
- }, Et = (e) => (e.querySelectorAll("[data-content-type=\"numberedListItem\"]").forEach((e) => {
242
+ }, xt = (e) => (e.querySelectorAll("[data-content-type=\"numberedListItem\"]").forEach((e) => {
242
243
  let t = e.closest(".bn-block-outer")?.previousElementSibling?.querySelector("[data-content-type=\"numberedListItem\"]");
243
244
  if (!t) e.setAttribute("data-index", e.getAttribute("data-start") || "1");
244
245
  else {
245
246
  let n = t.getAttribute("data-index");
246
247
  e.setAttribute("data-index", (parseInt(n || "0") + 1).toString());
247
248
  }
248
- }), e), Dt = (e) => (e.querySelectorAll("[data-content-type=\"checkListItem\"] input").forEach((e) => {
249
+ }), e), St = (e) => (e.querySelectorAll("[data-content-type=\"checkListItem\"] input").forEach((e) => {
249
250
  e.disabled = !0;
250
- }), e), Ot = (e) => (e.querySelectorAll(".bn-toggle-wrapper[data-show-children=\"false\"]").forEach((e) => {
251
+ }), e), Ct = (e) => (e.querySelectorAll(".bn-toggle-wrapper[data-show-children=\"false\"]").forEach((e) => {
251
252
  e.setAttribute("data-show-children", "true");
252
- }), e), kt = (e) => (e.querySelectorAll("[data-content-type=\"table\"] table").forEach((e) => {
253
+ }), e), wt = (e) => (e.querySelectorAll("[data-content-type=\"table\"] table").forEach((e) => {
253
254
  e.setAttribute("style", "--default-cell-min-width: 120px;"), e.setAttribute("data-show-children", "true");
254
- }), e), At = (e) => (e.querySelectorAll("[data-content-type=\"table\"] table").forEach((e) => {
255
+ }), e), Tt = (e) => (e.querySelectorAll("[data-content-type=\"table\"] table").forEach((e) => {
255
256
  let t = document.createElement("div");
256
257
  t.className = "tableWrapper";
257
258
  let n = document.createElement("div");
258
259
  n.className = "tableWrapper-inner", t.appendChild(n), e.parentElement?.appendChild(t), t.appendChild(e);
259
- }), e), jt = (e) => (e.querySelectorAll(".bn-inline-content:empty").forEach((e) => {
260
+ }), e), Et = (e) => (e.querySelectorAll(".bn-inline-content:empty").forEach((e) => {
260
261
  let t = document.createElement("span");
261
262
  t.className = "ProseMirror-trailingBreak", t.setAttribute("style", "display: inline-block;"), e.appendChild(t);
262
- }), e), Mt = (e, t) => {
263
- let n = Re.fromSchema(e), r = [
264
- Et,
265
- Dt,
266
- Ot,
267
- kt,
268
- At,
269
- jt
263
+ }), e), Dt = (e, t) => {
264
+ let n = Le.fromSchema(e), r = [
265
+ xt,
266
+ St,
267
+ Ct,
268
+ wt,
269
+ Tt,
270
+ Et
270
271
  ];
271
272
  return { serializeBlocks: (e, i) => {
272
- let a = Tt(t, e, n, i);
273
+ let a = bt(t, e, n, i);
273
274
  for (let e of r) a = e(a);
274
275
  return a.outerHTML;
275
276
  } };
276
277
  };
277
278
  //#endregion
278
279
  //#region src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts
279
- function Nt(e) {
280
+ function Ot(e) {
280
281
  return e.transact((e) => {
281
- let t = S(e.doc, e.selection.anchor);
282
- if (e.selection instanceof L) return {
282
+ let t = C(e.doc, e.selection.anchor);
283
+ if (e.selection instanceof it) return {
283
284
  type: "cell",
284
285
  anchorBlockId: t.node.attrs.id,
285
286
  anchorCellOffset: e.selection.$anchorCell.pos - t.posBeforeNode,
@@ -290,7 +291,7 @@ function Nt(e) {
290
291
  anchorBlockId: t.node.attrs.id
291
292
  };
292
293
  {
293
- let n = S(e.doc, e.selection.head);
294
+ let n = C(e.doc, e.selection.head);
294
295
  return {
295
296
  type: "text",
296
297
  anchorBlockId: t.node.attrs.id,
@@ -301,154 +302,172 @@ function Nt(e) {
301
302
  }
302
303
  });
303
304
  }
304
- function Pt(e, t) {
305
- let n = i(t.anchorBlockId, e.doc)?.posBeforeNode;
305
+ function kt(e, t) {
306
+ let n = r(t.anchorBlockId, e.doc)?.posBeforeNode;
306
307
  if (n === void 0) throw Error(`Could not find block with ID ${t.anchorBlockId} to update selection`);
307
- let r;
308
- if (t.type === "cell") r = L.create(e.doc, n + t.anchorCellOffset, n + t.headCellOffset);
309
- else if (t.type === "node") r = M.create(e.doc, n + 1);
308
+ let i;
309
+ if (t.type === "cell") i = it.create(e.doc, n + t.anchorCellOffset, n + t.headCellOffset);
310
+ else if (t.type === "node") i = M.create(e.doc, n + 1);
310
311
  else {
311
- let a = i(t.headBlockId, e.doc)?.posBeforeNode;
312
+ let a = r(t.headBlockId, e.doc)?.posBeforeNode;
312
313
  if (a === void 0) throw Error(`Could not find block with ID ${t.headBlockId} to update selection`);
313
- r = P.create(e.doc, n + t.anchorOffset, a + t.headOffset);
314
+ i = P.create(e.doc, n + t.anchorOffset, a + t.headOffset);
314
315
  }
315
- e.setSelection(r);
316
+ e.setSelection(i);
316
317
  }
317
- function V(e) {
318
- return e.map((e) => e.type === "columnList" ? e.children.map((e) => V(e.children)).flat() : {
319
- ...e,
320
- children: V(e.children)
321
- }).flat();
318
+ function At(e) {
319
+ return e.flatMap((e) => e.type === "column" ? e.children : [e]);
320
+ }
321
+ function B(e, t, n, r) {
322
+ e.transact(() => {
323
+ let i = e.getBlock(n);
324
+ if (i?.type === "columnList") {
325
+ let t = r === "after" ? e.getNextBlock(i) : e.getPrevBlock(i);
326
+ t && (n = t, r = r === "after" ? "before" : "after");
327
+ }
328
+ e.removeBlocks(t), e.insertBlocks(At(t), n, r);
329
+ });
322
330
  }
323
- function Ft(e, t, n) {
331
+ function jt(e, t, n) {
324
332
  e.transact((r) => {
325
- let i = e.getSelection()?.blocks || [e.getTextCursorPosition().block], a = Nt(e);
326
- e.removeBlocks(i), e.insertBlocks(V(i), t, n), Pt(r, a);
333
+ let i = e.getSelection()?.blocks || [e.getTextCursorPosition().block], a = Ot(e);
334
+ B(e, i, t, n), kt(r, a);
327
335
  });
328
336
  }
329
- function It(e) {
337
+ function Mt(e) {
330
338
  return !e || e.type !== "columnList";
331
339
  }
332
- function Lt(e, t, n) {
340
+ function Nt(e, t, n) {
333
341
  let r, i;
334
342
  if (t ? t.children.length > 0 ? (r = t.children[t.children.length - 1], i = "after") : (r = t, i = "before") : n && (r = n, i = "before"), !r || !i) return;
335
343
  let a = e.getParentBlock(r);
336
- return It(a) ? {
344
+ return Mt(a) ? {
337
345
  referenceBlock: r,
338
346
  placement: i
339
- } : Lt(e, i === "after" ? r : e.getPrevBlock(r), a);
347
+ } : Nt(e, i === "after" ? r : e.getPrevBlock(r), a);
340
348
  }
341
- function Rt(e, t, n) {
349
+ function Pt(e, t, n) {
342
350
  let r, i;
343
351
  if (t ? t.children.length > 0 ? (r = t.children[0], i = "before") : (r = t, i = "after") : n && (r = n, i = "after"), !r || !i) return;
344
352
  let a = e.getParentBlock(r);
345
- return It(a) ? {
353
+ return Mt(a) ? {
346
354
  referenceBlock: r,
347
355
  placement: i
348
- } : Rt(e, i === "before" ? r : e.getNextBlock(r), a);
356
+ } : Pt(e, i === "before" ? r : e.getNextBlock(r), a);
349
357
  }
350
- function zt(e) {
358
+ function Ft(e, t) {
351
359
  e.transact(() => {
352
- let t = e.getSelection()?.blocks[0] || e.getTextCursorPosition().block, n = Lt(e, e.getPrevBlock(t), e.getParentBlock(t));
353
- n && Ft(e, n.referenceBlock, n.placement);
360
+ let n;
361
+ if (t) {
362
+ if (n = e.getBlock(t), !n) return;
363
+ } else n = e.getSelection()?.blocks[0] || e.getTextCursorPosition().block;
364
+ let r = Nt(e, e.getPrevBlock(n), e.getParentBlock(n));
365
+ r && (t ? B(e, [n], r.referenceBlock, r.placement) : jt(e, r.referenceBlock, r.placement));
354
366
  });
355
367
  }
356
- function Bt(e) {
368
+ function It(e, t) {
357
369
  e.transact(() => {
358
- let t = e.getSelection(), n = t?.blocks[t?.blocks.length - 1] || e.getTextCursorPosition().block, r = Rt(e, e.getNextBlock(n), e.getParentBlock(n));
359
- r && Ft(e, r.referenceBlock, r.placement);
370
+ let n;
371
+ if (t) {
372
+ if (n = e.getBlock(t), !n) return;
373
+ } else {
374
+ let t = e.getSelection();
375
+ n = t?.blocks[t?.blocks.length - 1] || e.getTextCursorPosition().block;
376
+ }
377
+ let r = Pt(e, e.getNextBlock(n), e.getParentBlock(n));
378
+ r && (t ? B(e, [n], r.referenceBlock, r.placement) : jt(e, r.referenceBlock, r.placement));
360
379
  });
361
380
  }
362
381
  //#endregion
363
382
  //#region src/api/blockManipulation/commands/nestBlock/nestBlock.ts
364
- function Vt(e, t, n) {
383
+ function Lt(e, t, n) {
365
384
  let { $from: r, $to: i } = e.selection, a = r.blockRange(i, (e) => e.childCount > 0 && (e.type.name === "blockGroup" || e.type.name === "column"));
366
385
  if (!a) return !1;
367
386
  let o = a.startIndex;
368
387
  if (o === 0) return !1;
369
388
  let s = a.parent.child(o - 1);
370
389
  if (s.type !== t) return !1;
371
- let c = s.lastChild && s.lastChild.type === n, l = w.from(c ? t.create() : null), u = new T(w.from(t.create(null, w.from(n.create(null, l)))), c ? 3 : 1, 0), d = a.start, f = a.end;
372
- return e.step(new E(d - (c ? 3 : 1), f, d, f, u, 1, !0)).scrollIntoView(), !0;
390
+ let c = s.lastChild && s.lastChild.type === n, l = T.from(c ? t.create() : null), u = new E(T.from(t.create(null, T.from(n.create(null, l)))), c ? 3 : 1, 0), d = a.start, f = a.end;
391
+ return e.step(new D(d - (c ? 3 : 1), f, d, f, u, 1, !0)).scrollIntoView(), !0;
373
392
  }
374
- function Ht(e) {
375
- return e.transact((t) => Vt(t, e.pmSchema.nodes.blockContainer, e.pmSchema.nodes.blockGroup));
393
+ function Rt(e) {
394
+ return e.transact((t) => Lt(t, e.pmSchema.nodes.blockContainer, e.pmSchema.nodes.blockGroup));
376
395
  }
377
- function Ut(e, t, n, r) {
396
+ function zt(e, t, n, r) {
378
397
  let i = r.end, a = r.$to.end(r.depth);
379
398
  if (i < a) {
380
399
  let o = r.parent.child(r.endIndex - 1), s = o.lastChild && o.lastChild.type === n;
381
- e.step(new E(i - (s ? 2 : 1), a, i, a, new T(w.from(t.create(null, n.create())), s ? 2 : 1, 0), +!s, !0)), r = new Be(e.doc.resolve(r.$from.pos), e.doc.resolve(a), r.depth);
400
+ e.step(new D(i - (s ? 2 : 1), a, i, a, new E(T.from(t.create(null, n.create())), s ? 2 : 1, 0), +!s, !0)), r = new ze(e.doc.resolve(r.$from.pos), e.doc.resolve(a), r.depth);
382
401
  }
383
- let o = Ue(r);
402
+ let o = He(r);
384
403
  if (o == null) return !1;
385
404
  e.lift(r, o);
386
405
  let s = e.doc.resolve(e.mapping.map(i, -1) - 1);
387
- return He(e.doc, s.pos) && s.nodeBefore.type === s.nodeAfter.type && e.join(s.pos), e.scrollIntoView(), !0;
406
+ return Ve(e.doc, s.pos) && s.nodeBefore.type === s.nodeAfter.type && e.join(s.pos), e.scrollIntoView(), !0;
388
407
  }
389
- function H(e, t, n) {
408
+ function V(e, t, n) {
390
409
  let { $from: r, $to: i } = e.selection, a = r.blockRange(i, (e) => e.childCount > 0 && (e.type.name === "blockGroup" || e.type.name === "column"));
391
- return a && r.node(a.depth - 1).type === t ? Ut(e, t, n, a) : !1;
410
+ return a && r.node(a.depth - 1).type === t ? zt(e, t, n, a) : !1;
392
411
  }
393
- function Wt(e) {
394
- return e.transact((t) => H(t, e.pmSchema.nodes.blockContainer, e.pmSchema.nodes.blockGroup));
412
+ function Bt(e) {
413
+ return e.transact((t) => V(t, e.pmSchema.nodes.blockContainer, e.pmSchema.nodes.blockGroup));
395
414
  }
396
- function Gt(e) {
415
+ function Vt(e) {
397
416
  return e.transact((e) => {
398
- let { bnBlock: t } = _(e);
417
+ let { bnBlock: t } = f(e);
399
418
  return e.doc.resolve(t.beforePos).nodeBefore !== null;
400
419
  });
401
420
  }
402
- function Kt(e) {
421
+ function Ht(e) {
403
422
  return e.transact((e) => {
404
- let { bnBlock: t } = _(e);
423
+ let { bnBlock: t } = f(e);
405
424
  return e.doc.resolve(t.beforePos).depth > 1;
406
425
  });
407
426
  }
408
427
  //#endregion
409
428
  //#region src/api/blockManipulation/getBlock/getBlock.ts
410
- function qt(e, t) {
411
- let n = typeof t == "string" ? t : t.id, r = g(e), a = i(n, e);
412
- if (a) return y(a.node, r);
429
+ function Ut(e, t) {
430
+ let n = typeof t == "string" ? t : t.id, i = g(e), a = r(n, e);
431
+ if (a) return m(a.node, i);
413
432
  }
414
- function Jt(e, t) {
415
- let n = i(typeof t == "string" ? t : t.id, e), r = g(e);
433
+ function Wt(e, t) {
434
+ let n = r(typeof t == "string" ? t : t.id, e), i = g(e);
416
435
  if (!n) return;
417
436
  let a = e.resolve(n.posBeforeNode).nodeBefore;
418
- if (a) return y(a, r);
437
+ if (a) return m(a, i);
419
438
  }
420
- function Yt(e, t) {
421
- let n = i(typeof t == "string" ? t : t.id, e), r = g(e);
439
+ function Gt(e, t) {
440
+ let n = r(typeof t == "string" ? t : t.id, e), i = g(e);
422
441
  if (!n) return;
423
442
  let a = e.resolve(n.posBeforeNode + n.node.nodeSize).nodeAfter;
424
- if (a) return y(a, r);
443
+ if (a) return m(a, i);
425
444
  }
426
- function Xt(e, t) {
427
- let n = typeof t == "string" ? t : t.id, r = g(e), a = i(n, e);
445
+ function Kt(e, t) {
446
+ let n = typeof t == "string" ? t : t.id, i = g(e), a = r(n, e);
428
447
  if (!a) return;
429
448
  let o = e.resolve(a.posBeforeNode), s = o.node(), c = o.node(-1), l = c.type.name === "doc" ? void 0 : s.type.name === "blockGroup" ? c : s;
430
- if (l) return y(l, r);
449
+ if (l) return m(l, i);
431
450
  }
432
451
  //#endregion
433
452
  //#region src/editor/managers/BlockManager.ts
434
- var Zt = class {
453
+ var qt = class {
435
454
  constructor(e) {
436
455
  this.editor = e;
437
456
  }
438
457
  get document() {
439
- return this.editor.transact((e) => se(e.doc, this.editor.pmSchema));
458
+ return this.editor.transact((e) => ee(e.doc, this.editor.pmSchema));
440
459
  }
441
460
  getBlock(e) {
442
- return this.editor.transact((t) => qt(t.doc, e));
461
+ return this.editor.transact((t) => Ut(t.doc, e));
443
462
  }
444
463
  getPrevBlock(e) {
445
- return this.editor.transact((t) => Jt(t.doc, e));
464
+ return this.editor.transact((t) => Wt(t.doc, e));
446
465
  }
447
466
  getNextBlock(e) {
448
- return this.editor.transact((t) => Yt(t.doc, e));
467
+ return this.editor.transact((t) => Gt(t.doc, e));
449
468
  }
450
469
  getParentBlock(e) {
451
- return this.editor.transact((t) => Xt(t.doc, e));
470
+ return this.editor.transact((t) => Kt(t.doc, e));
452
471
  }
453
472
  forEachBlock(e, t = !1) {
454
473
  let n = this.document.slice();
@@ -460,36 +479,36 @@ var Zt = class {
460
479
  r(n);
461
480
  }
462
481
  insertBlocks(e, t, n = "before") {
463
- return this.editor.transact((r) => bt(r, e, t, n));
482
+ return this.editor.transact((r) => ht(r, e, t, n));
464
483
  }
465
484
  updateBlock(e, t) {
466
- return this.editor.transact((r) => n(r, e, t));
485
+ return this.editor.transact((n) => le(n, e, t));
467
486
  }
468
487
  removeBlocks(e) {
469
- return this.editor.transact((t) => B(t, e, []).removedBlocks);
488
+ return this.editor.transact((t) => z(t, e, []).removedBlocks);
470
489
  }
471
490
  replaceBlocks(e, t) {
472
- return this.editor.transact((n) => B(n, e, t));
491
+ return this.editor.transact((n) => z(n, e, t));
473
492
  }
474
493
  canNestBlock() {
475
- return Gt(this.editor);
494
+ return Vt(this.editor);
476
495
  }
477
496
  nestBlock() {
478
- Ht(this.editor);
497
+ Rt(this.editor);
479
498
  }
480
499
  canUnnestBlock() {
481
- return Kt(this.editor);
500
+ return Ht(this.editor);
482
501
  }
483
502
  unnestBlock() {
484
- Wt(this.editor);
503
+ Bt(this.editor);
485
504
  }
486
- moveBlocksUp() {
487
- return zt(this.editor);
505
+ moveBlocksUp(e) {
506
+ return Ft(this.editor, e);
488
507
  }
489
- moveBlocksDown() {
490
- return Bt(this.editor);
508
+ moveBlocksDown(e) {
509
+ return It(this.editor, e);
491
510
  }
492
- }, Qt = class extends Ie {
511
+ }, Jt = class extends Fe {
493
512
  constructor(e) {
494
513
  super(), this.editor = e, e.on("create", () => {
495
514
  e._tiptapEditor.on("update", ({ transaction: t, appendedTransactions: n }) => {
@@ -512,8 +531,8 @@ var Zt = class {
512
531
  }
513
532
  onChange(e, t = !0) {
514
533
  let n = ({ transaction: n, appendedTransactions: r }) => {
515
- !t && $t(n) || e(this.editor, { getChanges() {
516
- return he(n, r);
534
+ !t && Yt(n) || e(this.editor, { getChanges() {
535
+ return fe(n, r);
517
536
  } });
518
537
  };
519
538
  return this.on("onChange", n), () => {
@@ -522,7 +541,7 @@ var Zt = class {
522
541
  }
523
542
  onSelectionChange(e, t = !1) {
524
543
  let n = (n) => {
525
- !t && $t(n.transaction) || e(this.editor);
544
+ !t && Yt(n.transaction) || e(this.editor);
526
545
  };
527
546
  return this.on("onSelectionChange", n), () => {
528
547
  this.off("onSelectionChange", n);
@@ -539,30 +558,30 @@ var Zt = class {
539
558
  };
540
559
  }
541
560
  };
542
- function $t(e) {
561
+ function Yt(e) {
543
562
  return !!e.getMeta("y-sync$");
544
563
  }
545
564
  //#endregion
546
565
  //#region src/api/parsers/html/util/nestedLists.ts
547
- function en(e) {
566
+ function Xt(e) {
548
567
  return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
549
568
  }
550
- function tn(e) {
569
+ function Zt(e) {
551
570
  return e.nodeType === 3 && !/\S/.test(e.nodeValue || "");
552
571
  }
553
- function nn(e) {
572
+ function Qt(e) {
554
573
  e.querySelectorAll("li > ul, li > ol").forEach((e) => {
555
- let t = en(e), n = e.parentElement, r = Array.from(n.childNodes).slice(t + 1);
574
+ let t = Xt(e), n = e.parentElement, r = Array.from(n.childNodes).slice(t + 1);
556
575
  e.remove(), r.forEach((e) => {
557
576
  e.remove();
558
577
  }), n.insertAdjacentElement("afterend", e), r.reverse().forEach((t) => {
559
- if (tn(t)) return;
578
+ if (Zt(t)) return;
560
579
  let n = document.createElement("li");
561
580
  n.append(t), e.insertAdjacentElement("afterend", n);
562
581
  }), n.childNodes.length === 0 && n.remove();
563
582
  });
564
583
  }
565
- function rn(e) {
584
+ function $t(e) {
566
585
  e.querySelectorAll("li + ul, li + ol").forEach((e) => {
567
586
  let t = e.previousElementSibling, n = document.createElement("div");
568
587
  t.insertAdjacentElement("afterend", n), n.append(t);
@@ -570,25 +589,25 @@ function rn(e) {
570
589
  for (r.setAttribute("data-node-type", "blockGroup"), n.append(r); n.nextElementSibling?.nodeName === "UL" || n.nextElementSibling?.nodeName === "OL";) r.append(n.nextElementSibling);
571
590
  });
572
591
  }
573
- var an = null;
574
- function on() {
575
- return an ||= document.implementation.createHTMLDocument("title");
592
+ var en = null;
593
+ function tn() {
594
+ return en ||= document.implementation.createHTMLDocument("title");
576
595
  }
577
- function sn(e) {
596
+ function nn(e) {
578
597
  if (typeof e == "string") {
579
- let t = on().createElement("div");
598
+ let t = tn().createElement("div");
580
599
  t.innerHTML = e, e = t;
581
600
  }
582
- return nn(e), rn(e), e;
601
+ return Qt(e), $t(e), e;
583
602
  }
584
603
  //#endregion
585
604
  //#region src/api/parsers/html/util/normalizeWhitespace.ts
586
- function cn(e) {
605
+ function rn(e) {
587
606
  let t = e.ownerDocument.createTreeWalker(e, 128), n;
588
607
  for (; n = t.nextNode();) if (/^\s*notionvc:/.test(n.nodeValue || "")) return !0;
589
608
  return !1;
590
609
  }
591
- function ln(e) {
610
+ function an(e) {
592
611
  let t = new Set(["PRE", "CODE"]), n = e.ownerDocument.createTreeWalker(e, 4, { acceptNode(n) {
593
612
  let r = n.parentElement;
594
613
  for (; r && r !== e;) {
@@ -600,92 +619,555 @@ function ln(e) {
600
619
  for (; i = n.nextNode();) r.push(i);
601
620
  for (let e of r) e.nodeValue && /[\r\n]/.test(e.nodeValue) && (e.nodeValue = e.nodeValue.replace(/[ \t\r\n\f]+/g, " "));
602
621
  }
603
- function un(e) {
604
- cn(e) || ln(e);
622
+ function on(e) {
623
+ rn(e) || an(e);
605
624
  }
606
625
  //#endregion
607
626
  //#region src/api/parsers/html/parseHTML.ts
608
- function U(e, t) {
609
- let n = sn(e);
610
- un(n);
611
- let r = Le.fromSchema(t).parse(n, { topNode: t.nodes.blockGroup.create() }), i = [];
612
- for (let e = 0; e < r.childCount; e++) i.push(y(r.child(e), t));
627
+ function H(e, t) {
628
+ let n = nn(e);
629
+ on(n);
630
+ let r = Ie.fromSchema(t).parse(n, { topNode: t.nodes.blockGroup.create() }), i = [];
631
+ for (let e = 0; e < r.childCount; e++) i.push(m(r.child(e), t));
613
632
  return i;
614
633
  }
615
634
  //#endregion
616
- //#region src/api/parsers/markdown/parseMarkdown.ts
635
+ //#region src/api/parsers/markdown/markdownToHtml.ts
636
+ function U(e) {
637
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
638
+ }
639
+ function sn(e) {
640
+ return e ? /\w/.test(e) : !1;
641
+ }
642
+ function W(e, t, n) {
643
+ let r = t > 0 ? e[t - 1] : void 0, i = t + n < e.length ? e[t + n] : void 0;
644
+ return sn(r) && sn(i);
645
+ }
646
+ function cn(e, t) {
647
+ if (e[t] !== "\\" || t + 1 >= e.length) return null;
648
+ let n = e[t + 1];
649
+ return n === "\n" ? {
650
+ html: "<br>\n",
651
+ end: t + 2
652
+ } : "\\`*_{}[]()#+-.!~|>".includes(n) ? {
653
+ html: U(n),
654
+ end: t + 2
655
+ } : null;
656
+ }
657
+ function ln(e, t) {
658
+ return e[t] === "`" ? Tn(e, t) : null;
659
+ }
660
+ function un(e, t) {
661
+ return e[t] !== "!" || e[t + 1] !== "[" ? null : En(e, t);
662
+ }
617
663
  function dn(e, t) {
618
- let n = t.value ? t.value : "", r = {};
619
- t.lang && (r["data-language"] = t.lang);
620
- let i = {
621
- type: "element",
622
- tagName: "code",
623
- properties: r,
624
- children: [{
625
- type: "text",
626
- value: n
627
- }]
628
- };
629
- return t.meta && (i.data = { meta: t.meta }), e.patch(t, i), i = e.applyData(t, i), i = {
630
- type: "element",
631
- tagName: "pre",
632
- properties: {},
633
- children: [i]
634
- }, e.patch(t, i), i;
664
+ return e[t] === "[" ? Dn(e, t) : null;
635
665
  }
636
666
  function fn(e, t) {
637
- let n = String(t?.url || ""), r = {
638
- type: "element",
639
- tagName: "video",
640
- properties: {
641
- src: n,
642
- "data-name": t?.title ? String(t.title) : void 0,
643
- "data-url": n,
644
- controls: !0
645
- },
646
- children: []
667
+ return e[t] !== "~" || e[t + 1] !== "~" ? null : K(e, t, "~~", "<del>", "</del>");
668
+ }
669
+ function pn(e, t) {
670
+ return e[t] === "*" && e[t + 1] === "*" && e[t + 2] === "*" || e[t] === "_" && e[t + 1] === "_" && e[t + 2] === "_" && !W(e, t, 3) ? K(e, t, e.substring(t, t + 3), "<strong><em>", "</em></strong>") : null;
671
+ }
672
+ function mn(e, t) {
673
+ return e[t] === "*" && e[t + 1] === "*" || e[t] === "_" && e[t + 1] === "_" && !W(e, t, 2) ? K(e, t, e.substring(t, t + 2), "<strong>", "</strong>") : null;
674
+ }
675
+ function hn(e, t) {
676
+ return e[t] === "*" || e[t] === "_" && !W(e, t, 1) ? K(e, t, e[t], "<em>", "</em>") : null;
677
+ }
678
+ function gn(e, t) {
679
+ return e[t] === "\n" ? {
680
+ html: "<br>\n",
681
+ end: t + 1
682
+ } : null;
683
+ }
684
+ var _n = /^<\/?[a-zA-Z][a-zA-Z0-9-]*(?:\s+[a-zA-Z_:][a-zA-Z0-9_.:-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*\s*\/?>/, vn = /^<!--[\s\S]*?-->/, yn = /^<!\[CDATA\[[\s\S]*?\]\]>/, bn = /^<\?[\s\S]*?\?>/, xn = /^<![A-Za-z][\s\S]*?>/;
685
+ function Sn(e, t) {
686
+ if (e[t] !== "<") return null;
687
+ let n = e.substring(t);
688
+ for (let e of [
689
+ vn,
690
+ yn,
691
+ bn,
692
+ xn,
693
+ _n
694
+ ]) {
695
+ let r = n.match(e);
696
+ if (r) return {
697
+ html: r[0],
698
+ end: t + r[0].length
699
+ };
700
+ }
701
+ return null;
702
+ }
703
+ var Cn = /* @__PURE__ */ new Set("\\`![~*_\n<"), wn = [
704
+ cn,
705
+ ln,
706
+ un,
707
+ dn,
708
+ fn,
709
+ pn,
710
+ mn,
711
+ hn,
712
+ Sn,
713
+ gn
714
+ ];
715
+ function G(e) {
716
+ let t = "", n = 0;
717
+ for (; n < e.length;) {
718
+ if (e[n] === "\n" && n >= 2 && e[n - 1] === " " && e[n - 2] === " ") {
719
+ t = t.replace(/ +$/, ""), t += "<br>\n", n++;
720
+ continue;
721
+ }
722
+ let r = !1;
723
+ if (Cn.has(e[n])) for (let i of wn) {
724
+ let a = i(e, n);
725
+ if (a) {
726
+ t += a.html, n = a.end, r = !0;
727
+ break;
728
+ }
729
+ }
730
+ if (!r) {
731
+ let r = n;
732
+ for (n++; n < e.length && !Cn.has(e[n]);) n++;
733
+ t += U(e.substring(r, n));
734
+ }
735
+ }
736
+ return t;
737
+ }
738
+ function Tn(e, t) {
739
+ let n = 0, r = t;
740
+ for (; r < e.length && e[r] === "`";) n++, r++;
741
+ let i = r;
742
+ for (; i < e.length;) if (e[i] === "`") {
743
+ let t = 0, a = i;
744
+ for (; i < e.length && e[i] === "`";) t++, i++;
745
+ if (t === n) {
746
+ let t = e.substring(r, a);
747
+ return t = t.replace(/\n/g, " "), t.length >= 2 && t[0] === " " && t[t.length - 1] === " " && /[^ ]/.test(t) && (t = t.substring(1, t.length - 1)), {
748
+ html: `<code>${U(t)}</code>`,
749
+ end: i
750
+ };
751
+ }
752
+ } else i++;
753
+ return null;
754
+ }
755
+ function En(e, t) {
756
+ let n = On(e, t + 1);
757
+ if (n === -1) return null;
758
+ let r = t + 2;
759
+ if (e[n + 1] !== "(") return null;
760
+ let i = n + 2, a = kn(e, i - 1);
761
+ if (a === -1) return null;
762
+ let o = e.substring(r, n), { url: s, title: c } = An(e.substring(i, a));
763
+ if (te(s)) {
764
+ let e = o || c;
765
+ return {
766
+ html: `<video src="${U(s)}"${e ? ` data-name="${U(e)}"` : ""} data-url="${U(s)}" controls></video>`,
767
+ end: a + 1
768
+ };
769
+ }
770
+ let l = c === void 0 ? "" : ` title="${U(c)}"`;
771
+ return {
772
+ html: `<img src="${U(s)}" alt="${U(o)}"${l}>`,
773
+ end: a + 1
774
+ };
775
+ }
776
+ function Dn(e, t) {
777
+ let n = t + 1, r = On(e, t);
778
+ if (r === -1 || e[r + 1] !== "(") return null;
779
+ let i = r + 2, a = kn(e, r + 1);
780
+ if (a === -1) return null;
781
+ let o = e.substring(n, r), { url: s, title: c } = An(e.substring(i, a)), l = c === void 0 ? "" : ` title="${U(c)}"`;
782
+ return {
783
+ html: `<a href="${U(s)}"${l}>${G(o)}</a>`,
784
+ end: a + 1
785
+ };
786
+ }
787
+ function On(e, t) {
788
+ let n = 0;
789
+ for (let r = t; r < e.length; r++) {
790
+ if (e[r] === "\\" && r + 1 < e.length) {
791
+ r++;
792
+ continue;
793
+ }
794
+ if (e[r] === "[" && n++, e[r] === "]" && (n--, n === 0)) return r;
795
+ }
796
+ return -1;
797
+ }
798
+ function kn(e, t) {
799
+ let n = 0;
800
+ for (let r = t; r < e.length; r++) {
801
+ if (e[r] === "\\" && r + 1 < e.length) {
802
+ r++;
803
+ continue;
804
+ }
805
+ if (e[r] === "(" && n++, e[r] === ")" && (n--, n === 0)) return r;
806
+ }
807
+ return -1;
808
+ }
809
+ function An(e) {
810
+ e = e.trim();
811
+ let t, n;
812
+ if (e.startsWith("<")) {
813
+ let r = e.indexOf(">");
814
+ r === -1 ? (t = e.substring(1), n = "") : (t = e.substring(1, r), n = e.substring(r + 1).trim());
815
+ } else {
816
+ let r = e.length;
817
+ for (let t = 0; t < e.length; t++) {
818
+ if (e[t] === "\\" && t + 1 < e.length) {
819
+ t++;
820
+ continue;
821
+ }
822
+ if (e[t] === " " || e[t] === " " || e[t] === "\n") {
823
+ r = t;
824
+ break;
825
+ }
826
+ }
827
+ t = e.substring(0, r), n = e.substring(r).trim();
828
+ }
829
+ let r;
830
+ if (n.length > 0) {
831
+ let e = n.match(/^"([^"]*)"$|^'([^']*)'$|^\(([^)]*)\)$/);
832
+ e && (r = e[1] ?? e[2] ?? e[3]);
833
+ }
834
+ return {
835
+ url: t,
836
+ title: r
647
837
  };
648
- return e.patch?.(t, r), r = e.applyData ? e.applyData(t, r) : r, r;
649
- }
650
- function W(t) {
651
- return ct().use(lt).use(st).use(ut, { handlers: {
652
- ...dt,
653
- image: (t, n) => e(String(n?.url || "")) ? fn(t, n) : dt.image(t, n),
654
- code: dn,
655
- blockquote: (e, t) => {
656
- let n = {
657
- type: "element",
658
- tagName: "blockquote",
659
- properties: {},
660
- children: e.wrap(e.all(t), !1)
838
+ }
839
+ function K(e, t, n, r, i) {
840
+ let a = n.length, o = t + a;
841
+ if (o >= e.length || e[o] === " " || e[o] === " ") return null;
842
+ let s = o;
843
+ for (; s < e.length;) {
844
+ if (e[s] === "\\" && s + 1 < e.length) {
845
+ s += 2;
846
+ continue;
847
+ }
848
+ if (e.substring(s, s + a) === n) {
849
+ if (e[s - 1] === " " || e[s - 1] === " ") {
850
+ s++;
851
+ continue;
852
+ }
853
+ if (a === 1 && (s > 0 && e[s - 1] === n[0] && !(s >= 2 && e[s - 2] === "\\") || s + a < e.length && e[s + a] === n[0])) {
854
+ s++;
855
+ continue;
856
+ }
857
+ let t = e.substring(o, s);
858
+ if (t.length === 0) {
859
+ s++;
860
+ continue;
861
+ }
862
+ return {
863
+ html: r + G(t) + i,
864
+ end: s + a
661
865
  };
662
- return e.patch(t, n), e.applyData(t, n);
663
866
  }
664
- } }).use(ft).processSync(t).value;
867
+ s++;
868
+ }
869
+ return null;
870
+ }
871
+ var jn = new Set(/* @__PURE__ */ "address.article.aside.audio.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.section.source.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul".split("."));
872
+ function Mn(e) {
873
+ if (/^ {0,3}<(!--|\?|![A-Za-z]|!\[CDATA\[)/.test(e)) return !0;
874
+ let t = e.match(/^ {0,3}<\/?([a-zA-Z][a-zA-Z0-9-]*)(?:\s|\/?>|$)/);
875
+ return t ? jn.has(t[1].toLowerCase()) : !1;
876
+ }
877
+ function q(e) {
878
+ let t = e.split("\n"), n = [], r = 0, i = !0;
879
+ for (; r < t.length;) {
880
+ let e = t[r];
881
+ if (e.trim() === "") {
882
+ i = !0, r++;
883
+ continue;
884
+ }
885
+ let a = e.match(/^ {0,3}(`{3,}|~{3,})(.*)$/);
886
+ if (a) {
887
+ let e = a[1], o = e[0], s = e.length, c = a[2].trim(), l = [];
888
+ for (r++; r < t.length;) {
889
+ if (t[r].match(RegExp(`^ {0,3}${o}{${s},}\\s*$`))) {
890
+ r++;
891
+ break;
892
+ }
893
+ l.push(t[r]), r++;
894
+ }
895
+ n.push({
896
+ type: "codeBlock",
897
+ language: c || "",
898
+ code: l.join("\n")
899
+ }), i = !1;
900
+ continue;
901
+ }
902
+ let o = e.match(/^(#{1,6})\s+(.+?)(?:\s+#+\s*|\s*)$/);
903
+ if (o) {
904
+ n.push({
905
+ type: "heading",
906
+ level: o[1].length,
907
+ content: o[2]
908
+ }), i = !1, r++;
909
+ continue;
910
+ }
911
+ if (/^(\s{0,3})([-*_])\s*(\2\s*){2,}$/.test(e)) {
912
+ let t = n[n.length - 1];
913
+ if (!i && e.trim().match(/^-+$/) && t && t.type === "paragraph") {
914
+ let e = t;
915
+ n[n.length - 1] = {
916
+ type: "heading",
917
+ level: 2,
918
+ content: e.content
919
+ }, i = !1, r++;
920
+ continue;
921
+ }
922
+ n.push({ type: "hr" }), i = !1, r++;
923
+ continue;
924
+ }
925
+ if (r + 1 < t.length) {
926
+ let a = t[r + 1];
927
+ if (/^={1,}\s*$/.test(a) && e.trim().length > 0) {
928
+ n.push({
929
+ type: "heading",
930
+ level: 1,
931
+ content: e.trim()
932
+ }), i = !1, r += 2;
933
+ continue;
934
+ }
935
+ }
936
+ let s = Nn(t, r);
937
+ if (s) {
938
+ n.push(s.token), r = s.nextLine, i = !1;
939
+ continue;
940
+ }
941
+ if (/^\s{0,3}>/.test(e)) {
942
+ let e = [];
943
+ for (; r < t.length && /^\s{0,3}>/.test(t[r]);) e.push(t[r].replace(/^\s{0,3}>\s?/, "")), r++;
944
+ for (; r < t.length;) {
945
+ let n = t[r];
946
+ if (n.trim() === "" || /^\s{0,3}>/.test(n) || /^(#{1,6})\s/.test(n) || /^(`{3,}|~{3,})/.test(n) || /^(\s{0,3})([-*_])\s*(\2\s*){2,}$/.test(n) || /^\s*([-*+]|\d+[.)])\s+/.test(n) || /^\s*\|(.+\|)+\s*$/.test(n)) break;
947
+ e.push(n), r++;
948
+ }
949
+ n.push({
950
+ type: "blockquote",
951
+ content: e.join("\n")
952
+ }), i = !1;
953
+ continue;
954
+ }
955
+ let c = e.match(/^(\s*)([-*+]|\d+[.)])(\s+)(\[[ xX]\] )?(.*)$/);
956
+ if (c) {
957
+ let e = c[1].length, a = c[2], o = c[3], s = c[4], l = c[5], u, d, f;
958
+ s ? (u = "task", f = s.trim() !== "[ ]") : /^\d+[.)]$/.test(a) ? (u = "ordered", d = parseInt(a, 10)) : u = "bullet";
959
+ let p = e + a.length + o.length + (s ? s.length : 0), m = e + 1, h = (e) => {
960
+ if (e.trim() === "") return !0;
961
+ let t = e.match(/^\s*/)[0].length;
962
+ return !!(t >= p || t >= m && e.match(/^\s*([-*+]|\d+[.)])\s+/));
963
+ };
964
+ r++;
965
+ let g = [];
966
+ for (; r < t.length;) {
967
+ let e = t[r];
968
+ if (e.trim() === "") {
969
+ let e = r + 1;
970
+ for (; e < t.length && t[e].trim() === "";) e++;
971
+ if (e < t.length && h(t[e])) {
972
+ g.push(""), r++;
973
+ continue;
974
+ }
975
+ break;
976
+ }
977
+ if (!h(e)) break;
978
+ e.match(/^\s*/)[0].length >= p ? g.push(e.substring(p)) : g.push(e.substring(m)), r++;
979
+ }
980
+ let _ = g.join("\n").replace(/^\n+|\n+$/g, "");
981
+ n.push({
982
+ type: "listItem",
983
+ listType: u,
984
+ indent: e,
985
+ content: l.trim(),
986
+ start: d,
987
+ checked: f,
988
+ childContent: _ || void 0
989
+ }), i = !1;
990
+ continue;
991
+ }
992
+ if (Mn(e)) {
993
+ let e = [];
994
+ for (; r < t.length && t[r].trim() !== "";) e.push(t[r]), r++;
995
+ n.push({
996
+ type: "rawHtml",
997
+ content: e.join("\n")
998
+ }), i = !1;
999
+ continue;
1000
+ }
1001
+ let l = [e];
1002
+ for (r++; r < t.length;) {
1003
+ let e = t[r];
1004
+ if (e.trim() === "" || /^(#{1,6})\s/.test(e) || /^(`{3,}|~{3,})/.test(e) || /^\s{0,3}>/.test(e) || /^(\s{0,3})([-*_])\s*(\2\s*){2,}$/.test(e) || /^\s*([-*+]|\d+[.)])\s+/.test(e) || /^\s*\|(.+\|)+\s*$/.test(e) || Mn(e) || r + 1 < t.length && /^[=-]+\s*$/.test(t[r + 1]) && e.trim().length > 0) break;
1005
+ l.push(e), r++;
1006
+ }
1007
+ n.push({
1008
+ type: "paragraph",
1009
+ content: l.map((e) => e.replace(/^ {1,3}/, "")).join("\n").replace(/[ \t]+$/, "")
1010
+ }), i = !1;
1011
+ }
1012
+ return n;
665
1013
  }
666
- function pn(e, t) {
667
- return U(W(e), t);
1014
+ function Nn(e, t) {
1015
+ if (t + 1 >= e.length) return null;
1016
+ let n = e[t], r = e[t + 1];
1017
+ if (!r.includes("|") || !/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/.test(r) || !n.includes("|")) return null;
1018
+ let i = J(n), a = Pn(r), o = [], s = t + 2;
1019
+ for (; s < e.length;) {
1020
+ let t = e[s];
1021
+ if (!t.includes("|")) break;
1022
+ o.push(J(t)), s++;
1023
+ }
1024
+ return {
1025
+ token: {
1026
+ type: "table",
1027
+ headers: i,
1028
+ rows: o,
1029
+ alignments: a
1030
+ },
1031
+ nextLine: s
1032
+ };
1033
+ }
1034
+ function J(e) {
1035
+ let t = e.trim(), n = t.startsWith("|") ? t.substring(1) : t, r = n.endsWith("|") ? n.substring(0, n.length - 1) : n, i = [], a = "";
1036
+ for (let e = 0; e < r.length; e++) r[e] === "\\" && e + 1 < r.length && r[e + 1] === "|" ? (a += "|", e++) : r[e] === "|" ? (i.push(a.trim()), a = "") : a += r[e];
1037
+ return i.push(a.trim()), i;
1038
+ }
1039
+ function Pn(e) {
1040
+ return J(e).map((e) => {
1041
+ let t = e.trim(), n = t.startsWith(":"), r = t.endsWith(":");
1042
+ return n && r ? "center" : r ? "right" : n ? "left" : null;
1043
+ });
1044
+ }
1045
+ function Y(e) {
1046
+ let t = "", n = 0;
1047
+ for (; n < e.length;) {
1048
+ let r = e[n];
1049
+ switch (r.type) {
1050
+ case "heading": {
1051
+ let e = r;
1052
+ t += `<h${e.level}>${G(e.content)}</h${e.level}>`, n++;
1053
+ break;
1054
+ }
1055
+ case "paragraph":
1056
+ t += `<p>${G(r.content)}</p>`, n++;
1057
+ break;
1058
+ case "codeBlock": {
1059
+ let e = r, i = e.language ? ` data-language="${U(e.language)}"` : "";
1060
+ t += `<pre><code${i}>${U(e.code)}</code></pre>`, n++;
1061
+ break;
1062
+ }
1063
+ case "blockquote": {
1064
+ let e = Y(q(r.content));
1065
+ t += `<blockquote>${e}</blockquote>`, n++;
1066
+ break;
1067
+ }
1068
+ case "hr":
1069
+ t += "<hr>", n++;
1070
+ break;
1071
+ case "listItem": {
1072
+ let r = Fn(e, n);
1073
+ t += r.html, n = r.nextIndex;
1074
+ break;
1075
+ }
1076
+ case "table":
1077
+ t += Ln(r), n++;
1078
+ break;
1079
+ case "rawHtml":
1080
+ t += r.content, n++;
1081
+ break;
1082
+ default: n++;
1083
+ }
1084
+ }
1085
+ return t;
1086
+ }
1087
+ function Fn(e, t) {
1088
+ let n = "", r = t, i = null;
1089
+ for (; r < e.length && e[r].type === "listItem";) {
1090
+ let t = e[r], a = In(t.listType);
1091
+ if (i !== null && i !== a && (n += `</${i === "ordered" ? "ol" : "ul"}>`, i = null), i === null) {
1092
+ if (a === "ordered") {
1093
+ let e = t.start !== void 0 && t.start !== 1 ? ` start="${t.start}"` : "";
1094
+ n += `<ol${e}>`;
1095
+ } else n += "<ul>";
1096
+ i = a;
1097
+ }
1098
+ if (t.listType === "task") {
1099
+ let e = t.checked ? " checked" : "";
1100
+ n += `<li><input type="checkbox" disabled${e}><p>${G(t.content)}</p>`;
1101
+ } else n += `<li><p>${G(t.content)}</p>`;
1102
+ if (t.childContent) {
1103
+ let e = q(t.childContent);
1104
+ n += Y(e);
1105
+ }
1106
+ n += "</li>", r++;
1107
+ }
1108
+ return i !== null && (n += `</${i === "ordered" ? "ol" : "ul"}>`), {
1109
+ html: n,
1110
+ nextIndex: r
1111
+ };
1112
+ }
1113
+ function In(e) {
1114
+ return e === "ordered" ? "ordered" : "bullet";
1115
+ }
1116
+ function Ln(e) {
1117
+ let t = "<table>", n = e.headers.every((e) => e.trim() === ""), r = e.headers.length;
1118
+ if (!n) {
1119
+ t += "<thead><tr>";
1120
+ for (let n = 0; n < r; n++) {
1121
+ let r = e.alignments[n], i = r ? ` align="${r}"` : "";
1122
+ t += `<th${i}>${G(e.headers[n])}</th>`;
1123
+ }
1124
+ t += "</tr></thead>";
1125
+ }
1126
+ if (e.rows.length > 0) {
1127
+ t += "<tbody>";
1128
+ for (let n of e.rows) {
1129
+ t += "<tr>";
1130
+ for (let i = 0; i < r; i++) {
1131
+ let r = i < n.length ? n[i] : "", a = e.alignments[i], o = a ? ` align="${a}"` : "";
1132
+ t += `<td${o}>${G(r)}</td>`;
1133
+ }
1134
+ t += "</tr>";
1135
+ }
1136
+ t += "</tbody>";
1137
+ }
1138
+ return t += "</table>", t;
1139
+ }
1140
+ function Rn(e) {
1141
+ return Y(q(e));
1142
+ }
1143
+ //#endregion
1144
+ //#region src/api/parsers/markdown/parseMarkdown.ts
1145
+ function zn(e) {
1146
+ return Rn(e);
1147
+ }
1148
+ function Bn(e, t) {
1149
+ return H(zn(e), t);
668
1150
  }
669
1151
  //#endregion
670
1152
  //#region src/editor/managers/ExportManager.ts
671
- var mn = class {
1153
+ var Vn = class {
672
1154
  constructor(e) {
673
1155
  this.editor = e;
674
1156
  }
675
1157
  blocksToHTMLLossy(e = this.editor.document) {
676
- return xe(this.editor.pmSchema, this.editor).exportBlocks(e, {});
1158
+ return me(this.editor.pmSchema, this.editor).exportBlocks(e, {});
677
1159
  }
678
1160
  blocksToFullHTML(e = this.editor.document) {
679
- return Mt(this.editor.pmSchema, this.editor).serializeBlocks(e, {});
1161
+ return Dt(this.editor.pmSchema, this.editor).serializeBlocks(e, {});
680
1162
  }
681
1163
  tryParseHTMLToBlocks(e) {
682
- return U(e, this.editor.pmSchema);
1164
+ return H(e, this.editor.pmSchema);
683
1165
  }
684
1166
  blocksToMarkdownLossy(e = this.editor.document) {
685
- return Oe(e, this.editor.pmSchema, this.editor, {});
1167
+ return De(e, this.editor.pmSchema, this.editor, {});
686
1168
  }
687
1169
  tryParseMarkdownToBlocks(e) {
688
- return pn(e, this.editor.pmSchema);
1170
+ return Bn(e, this.editor.pmSchema);
689
1171
  }
690
1172
  pasteHTML(e, t = !1) {
691
1173
  let n = e;
@@ -699,13 +1181,42 @@ var mn = class {
699
1181
  return this.editor.prosemirrorView?.pasteText(e);
700
1182
  }
701
1183
  pasteMarkdown(e) {
702
- let t = W(e);
1184
+ let t = zn(e);
703
1185
  return this.pasteHTML(t);
704
1186
  }
705
- }, hn = "aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2";
1187
+ };
1188
+ //#endregion
1189
+ //#region src/api/blockManipulation/selections/textCursorPosition.ts
1190
+ function Hn(e) {
1191
+ let { bnBlock: t } = f(e), n = g(e.doc), r = e.doc.resolve(t.beforePos), i = r.nodeBefore, a = e.doc.resolve(t.afterPos).nodeAfter, o;
1192
+ return r.depth > 1 && (o = r.node(), o.type.isInGroup("bnBlock") || (o = r.node(r.depth - 1))), {
1193
+ block: m(t.node, n),
1194
+ prevBlock: i === null ? void 0 : m(i, n),
1195
+ nextBlock: a === null ? void 0 : m(a, n),
1196
+ parentBlock: o === void 0 ? void 0 : m(o, n)
1197
+ };
1198
+ }
1199
+ function Un(e, t, n = "start") {
1200
+ let i = typeof t == "string" ? t : t.id, a = re(g(e.doc)), o = r(i, e.doc);
1201
+ if (!o) throw Error(`Block with ID ${i} not found`);
1202
+ let s = x(o), c = a.blockSchema[s.blockNoteType].content;
1203
+ if (s.isBlockContainer) {
1204
+ let t = s.blockContent;
1205
+ if (c === "none") {
1206
+ e.setSelection(M.create(e.doc, t.beforePos));
1207
+ return;
1208
+ }
1209
+ if (c === "inline") n === "start" ? e.setSelection(P.create(e.doc, t.beforePos + 1)) : e.setSelection(P.create(e.doc, t.afterPos - 1));
1210
+ else if (c === "table") n === "start" ? e.setSelection(P.create(e.doc, t.beforePos + 4)) : e.setSelection(P.create(e.doc, t.afterPos - 4));
1211
+ else throw new w(c);
1212
+ } else Un(e, (n === "start" ? s.childContainer.node.firstChild : s.childContainer.node.lastChild).attrs.id, n);
1213
+ }
1214
+ //#endregion
1215
+ //#region src/extensions/tiptap-extensions/Link/helpers/tlds.ts
1216
+ var Wn = "aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2";
706
1217
  //#endregion
707
1218
  //#region src/extensions/tiptap-extensions/Link/helpers/linkDetector.ts
708
- function gn(e) {
1219
+ function Gn(e) {
709
1220
  let t = [], n = [], r = 0;
710
1221
  for (; r < e.length;) {
711
1222
  let i = 0;
@@ -719,59 +1230,59 @@ function gn(e) {
719
1230
  }
720
1231
  return t;
721
1232
  }
722
- var _n = new Set(gn(hn)), vn = new Set(["localhost"]), yn = /[.,;:!?"']+$/, bn = /(?:https?|ftp|ftps):\/\/[^\s]+/g, xn = /mailto:[^\s]+/g, Sn = /[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}/g, Cn = /(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(?::\d{1,5})?(?:[/?#][^\s]*)?/g;
723
- function wn(e) {
1233
+ var Kn = new Set(Gn(Wn)), qn = new Set(["localhost"]), Jn = /[.,;:!?"']+$/, Yn = /(?:https?|ftp|ftps):\/\/[^\s]+/g, Xn = /mailto:[^\s]+/g, Zn = /[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}/g, Qn = /(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(?::\d{1,5})?(?:[/?#][^\s]*)?/g;
1234
+ function $n(e) {
724
1235
  let t = e, n = !0;
725
1236
  for (; n;) {
726
1237
  n = !1;
727
1238
  let e = t;
728
- t = t.replace(yn, ""), t !== e && (n = !0);
1239
+ t = t.replace(Jn, ""), t !== e && (n = !0);
729
1240
  for (let [e, r] of [["(", ")"], ["[", "]"]]) for (; t.endsWith(r);) {
730
- let i = Tn(t, e);
731
- if (Tn(t, r) > i) t = t.slice(0, -1), n = !0;
1241
+ let i = er(t, e);
1242
+ if (er(t, r) > i) t = t.slice(0, -1), n = !0;
732
1243
  else break;
733
1244
  }
734
1245
  }
735
1246
  return t;
736
1247
  }
737
- function Tn(e, t) {
1248
+ function er(e, t) {
738
1249
  let n = 0;
739
1250
  for (let r = 0; r < e.length; r++) e[r] === t && n++;
740
1251
  return n;
741
1252
  }
742
- function En(e) {
1253
+ function tr(e) {
743
1254
  let t = e.split(".");
744
1255
  return t[t.length - 1].toLowerCase();
745
1256
  }
746
- function Dn(e) {
747
- let t = En(e);
748
- return _n.has(t);
1257
+ function nr(e) {
1258
+ let t = tr(e);
1259
+ return Kn.has(t);
749
1260
  }
750
- function On(e, t, n) {
1261
+ function rr(e, t, n) {
751
1262
  return t === "email" ? "mailto:" + e : /^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(e) || /^mailto:/i.test(e) ? e : n + "://" + e;
752
1263
  }
753
- function kn(e, t) {
1264
+ function ir(e, t) {
754
1265
  if (!e) return [];
755
1266
  let n = t?.defaultProtocol || "http", r = [];
756
- for (let t of e.matchAll(bn)) r.push({
1267
+ for (let t of e.matchAll(Yn)) r.push({
757
1268
  type: "url",
758
1269
  value: t[0],
759
1270
  start: t.index,
760
1271
  end: t.index + t[0].length
761
1272
  });
762
- for (let t of e.matchAll(xn)) r.push({
1273
+ for (let t of e.matchAll(Xn)) r.push({
763
1274
  type: "url",
764
1275
  value: t[0],
765
1276
  start: t.index,
766
1277
  end: t.index + t[0].length
767
1278
  });
768
- for (let t of e.matchAll(Sn)) r.push({
1279
+ for (let t of e.matchAll(Zn)) r.push({
769
1280
  type: "email",
770
1281
  value: t[0],
771
1282
  start: t.index,
772
1283
  end: t.index + t[0].length
773
1284
  });
774
- for (let t of e.matchAll(Cn)) r.push({
1285
+ for (let t of e.matchAll(Qn)) r.push({
775
1286
  type: "url",
776
1287
  value: t[0],
777
1288
  start: t.index,
@@ -782,18 +1293,18 @@ function kn(e, t) {
782
1293
  for (let e of r) e.start >= a && (i.push(e), a = e.end);
783
1294
  let o = [];
784
1295
  for (let e of i) {
785
- let t = wn(e.value);
1296
+ let t = $n(e.value);
786
1297
  if (!t) continue;
787
1298
  let r = e.start, i = r + t.length;
788
1299
  if (e.type === "url" && !/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t)) {
789
1300
  let e = new URL("http://" + t).hostname;
790
- if (!Dn(e)) continue;
1301
+ if (!nr(e)) continue;
791
1302
  }
792
1303
  if (e.type === "email") {
793
1304
  let e = t.split("@")[1];
794
- if (!Dn(e)) continue;
1305
+ if (!nr(e)) continue;
795
1306
  }
796
- let a = On(t, e.type, n);
1307
+ let a = rr(t, e.type, n);
797
1308
  o.push({
798
1309
  type: e.type,
799
1310
  value: t,
@@ -805,47 +1316,47 @@ function kn(e, t) {
805
1316
  }
806
1317
  return o;
807
1318
  }
808
- function An(e, t = "http") {
809
- if (!e) return [q(e, 0, 0)];
1319
+ function ar(e, t = "http") {
1320
+ if (!e) return [X(e, 0, 0)];
810
1321
  for (let [n, r] of [
811
1322
  ["(", ")"],
812
1323
  ["[", "]"],
813
1324
  ["{", "}"]
814
1325
  ]) if (e.startsWith(n) && e.endsWith(r) && e.length > 2) {
815
1326
  let i = e.slice(1, -1);
816
- if (G(i)) return [
817
- q(n, 0, 1),
818
- K(i, 1, 1 + i.length, t),
819
- q(r, 1 + i.length, e.length)
1327
+ if (or(i)) return [
1328
+ X(n, 0, 1),
1329
+ sr(i, 1, 1 + i.length, t),
1330
+ X(r, 1 + i.length, e.length)
820
1331
  ];
821
1332
  }
822
1333
  if (e.endsWith(".") && e.length > 1) {
823
1334
  let n = e.slice(0, -1);
824
- if (G(n)) return [K(n, 0, n.length, t), q(".", n.length, e.length)];
1335
+ if (or(n)) return [sr(n, 0, n.length, t), X(".", n.length, e.length)];
825
1336
  }
826
- return G(e) ? [K(e, 0, e.length, t)] : [q(e, 0, e.length)];
1337
+ return or(e) ? [sr(e, 0, e.length, t)] : [X(e, 0, e.length)];
827
1338
  }
828
- function G(e) {
829
- if (/^(?:https?|ftp|ftps):\/\/[^\s]+$/.test(e) || /^mailto:[^\s]+$/.test(e) || vn.has(e.toLowerCase())) return !0;
1339
+ function or(e) {
1340
+ if (/^(?:https?|ftp|ftps):\/\/[^\s]+$/.test(e) || /^mailto:[^\s]+$/.test(e) || qn.has(e.toLowerCase())) return !0;
830
1341
  let t = e.match(/^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+([a-zA-Z]{2,})(?::\d{1,5})?(?:[/?#][^\s]*)?$/);
831
1342
  if (t) {
832
1343
  let e = t[1].toLowerCase();
833
- if (_n.has(e)) return !0;
1344
+ if (Kn.has(e)) return !0;
834
1345
  }
835
1346
  return !1;
836
1347
  }
837
- function K(e, t, n, r) {
1348
+ function sr(e, t, n, r) {
838
1349
  let i = e.includes("@") && !e.includes("://") && !e.startsWith("mailto:") ? "email" : "url";
839
1350
  return {
840
1351
  type: i,
841
1352
  value: e,
842
1353
  isLink: !0,
843
- href: On(e, i, r),
1354
+ href: rr(e, i, r),
844
1355
  start: t,
845
1356
  end: n
846
1357
  };
847
1358
  }
848
- function q(e, t, n) {
1359
+ function X(e, t, n) {
849
1360
  return {
850
1361
  type: "text",
851
1362
  value: e,
@@ -857,40 +1368,40 @@ function q(e, t, n) {
857
1368
  }
858
1369
  //#endregion
859
1370
  //#region src/extensions/tiptap-extensions/Link/helpers/whitespace.ts
860
- var J = "[\0- \xA0 ᠎ -\u2029  ]", jn = new RegExp(J), Mn = RegExp(`${J}$`), Nn = new RegExp(J, "g");
1371
+ var cr = "[\0- \xA0 ᠎ -\u2029  ]", lr = new RegExp(cr), ur = RegExp(`${cr}$`), dr = new RegExp(cr, "g");
861
1372
  //#endregion
862
1373
  //#region src/extensions/tiptap-extensions/Link/helpers/autolink.ts
863
- function Pn(e) {
1374
+ function fr(e) {
864
1375
  return e.length === 1 ? e[0].isLink : e.length === 3 && e[1].isLink ? ["()", "[]"].includes(e[0].value + e[2].value) : !1;
865
1376
  }
866
- function Fn(e) {
867
- return new at({
868
- key: new ot("autolink"),
1377
+ function pr(e) {
1378
+ return new ot({
1379
+ key: new st("autolink"),
869
1380
  appendTransaction: (t, n, r) => {
870
1381
  let i = t.some((e) => e.docChanged) && !n.doc.eq(r.doc), a = t.some((e) => e.getMeta("preventAutolink"));
871
1382
  if (!i || a) return;
872
1383
  let { tr: o } = r;
873
- if (Xe(Ge(n.doc, [...t])).forEach(({ newRange: t }) => {
874
- let n = qe(r.doc, t, (e) => e.isTextblock), i, a;
1384
+ if (Ye(We(n.doc, [...t])).forEach(({ newRange: t }) => {
1385
+ let n = Ke(r.doc, t, (e) => e.isTextblock), i, a;
875
1386
  if (n.length > 1) i = n[0], a = r.doc.textBetween(i.pos, i.pos + i.node.nodeSize, void 0, " ");
876
1387
  else if (n.length) {
877
1388
  let e = r.doc.textBetween(t.from, t.to, " ", " ");
878
- if (!Mn.test(e)) return;
1389
+ if (!ur.test(e)) return;
879
1390
  i = n[0], a = r.doc.textBetween(i.pos, t.to, void 0, " ");
880
1391
  }
881
1392
  if (i && a) {
882
- let t = a.split(jn).filter(Boolean);
1393
+ let t = a.split(lr).filter(Boolean);
883
1394
  if (t.length <= 0) return;
884
1395
  let n = t[t.length - 1], s = i.pos + a.lastIndexOf(n);
885
1396
  if (!n) return;
886
- let c = An(n, e.defaultProtocol);
887
- if (!Pn(c)) return;
1397
+ let c = ar(n, e.defaultProtocol);
1398
+ if (!fr(c)) return;
888
1399
  c.filter((e) => e.isLink).map((e) => ({
889
1400
  ...e,
890
1401
  from: s + e.start + 1,
891
1402
  to: s + e.end + 1
892
1403
  })).filter((e) => r.schema.marks.code ? !r.doc.rangeHasMark(e.from, e.to, r.schema.marks.code) : !0).filter((t) => e.validate(t.value)).filter((t) => e.shouldAutoLink(t.value)).forEach((t) => {
893
- Qe(t.from, t.to, r.doc).some((t) => t.mark.type === e.type) || o.addMark(t.from, t.to, e.type.create({ href: t.href }));
1404
+ Ze(t.from, t.to, r.doc).some((t) => t.mark.type === e.type) || o.addMark(t.from, t.to, e.type.create({ href: t.href }));
894
1405
  });
895
1406
  }
896
1407
  }), o.steps.length) return o;
@@ -899,9 +1410,9 @@ function Fn(e) {
899
1410
  }
900
1411
  //#endregion
901
1412
  //#region src/extensions/tiptap-extensions/Link/helpers/clickHandler.ts
902
- function In(e) {
903
- return new at({
904
- key: new ot("handleClickLink"),
1413
+ function mr(e) {
1414
+ return new ot({
1415
+ key: new st("handleClickLink"),
905
1416
  props: { handleClick: (t, n, r) => {
906
1417
  if (r.button !== 0 || !t.editable) return !1;
907
1418
  let i = null;
@@ -917,16 +1428,16 @@ function In(e) {
917
1428
  if (!e.editor) throw Error("BlockNoteEditor not found in Link click handler");
918
1429
  return e.onClick(r, e.editor) ?? !0;
919
1430
  }
920
- let a = Ye(t.state, e.type.name), o = i.href ?? a.href, s = i.target ?? a.target;
1431
+ let a = Je(t.state, e.type.name), o = i.href ?? a.href, s = i.target ?? a.target;
921
1432
  return o ? (window.open(o, s), !0) : !1;
922
1433
  } }
923
1434
  });
924
1435
  }
925
1436
  //#endregion
926
1437
  //#region src/extensions/tiptap-extensions/Link/helpers/pasteHandler.ts
927
- function Ln(e) {
928
- return new at({
929
- key: new ot("handlePasteLink"),
1438
+ function hr(e) {
1439
+ return new ot({
1440
+ key: new st("handlePasteLink"),
930
1441
  props: { handlePaste: (t, n, r) => {
931
1442
  let { shouldAutoLink: i, isValidLink: a } = e, { state: o } = t, { selection: s } = o, { empty: c } = s;
932
1443
  if (c) return !1;
@@ -934,55 +1445,50 @@ function Ln(e) {
934
1445
  r.content.forEach((e) => {
935
1446
  l += e.textContent;
936
1447
  });
937
- let u = kn(l, { defaultProtocol: e.defaultProtocol }).find((e) => e.isLink && e.value === l);
1448
+ let u = ir(l, { defaultProtocol: e.defaultProtocol }).find((e) => e.isLink && e.value === l);
938
1449
  return !l || !u || !a(u.value) || i !== void 0 && !i(u.value) ? !1 : e.editor.commands.setMark(e.type, { href: u.href });
939
1450
  } }
940
1451
  });
941
1452
  }
942
1453
  //#endregion
943
1454
  //#region src/extensions/tiptap-extensions/Link/link.ts
944
- var Y = "https", X = {
945
- target: "_blank",
946
- rel: "noopener noreferrer nofollow",
947
- className: "bn-inline-content-section",
948
- "data-inline-content-type": "link"
949
- }, Rn = /^(?:(?:http|https|ftp|ftps|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z0-9+.\-]+(?:[^a-z+.\-:]|$))/i;
950
- function zn(e) {
1455
+ var Z = "https", gr = /^(?:(?:http|https|ftp|ftps|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z0-9+.\-]+(?:[^a-z+.\-:]|$))/i;
1456
+ function _r(e) {
951
1457
  if (!e) return !0;
952
- let t = e.replace(Nn, "");
953
- return Rn.test(t);
1458
+ let t = e.replace(dr, "");
1459
+ return gr.test(t);
954
1460
  }
955
- function Z(e) {
1461
+ function vr(e) {
956
1462
  let t = /^[a-z][a-z0-9+.-]*:\/\//i.test(e), n = /^[a-z][a-z0-9+.-]*:/i.test(e);
957
1463
  if (t || n && !e.includes("@")) return !0;
958
1464
  let r = (e.includes("@") ? e.split("@").pop() : e).split(/[/?#:]/)[0];
959
1465
  return !(/^\d{1,3}(\.\d{1,3}){3}$/.test(r) || !/\./.test(r));
960
1466
  }
961
- var Bn = O.create({
1467
+ var yr = k.create({
962
1468
  name: "link",
963
- priority: 1e3,
964
1469
  keepOnSplit: !1,
965
1470
  exitable: !0,
966
1471
  inclusive: !1,
967
1472
  addOptions() {
968
1473
  return {
969
- HTMLAttributes: {},
1474
+ HTMLAttributes: {
1475
+ target: "_blank",
1476
+ rel: "noopener noreferrer nofollow",
1477
+ className: "bn-inline-content-section",
1478
+ "data-inline-content-type": "link"
1479
+ },
970
1480
  editor: void 0,
971
1481
  onClick: void 0,
972
- isValidLink: zn
1482
+ isValidLink: _r
973
1483
  };
974
1484
  },
975
1485
  addAttributes() {
976
- return {
977
- href: {
978
- default: null,
979
- parseHTML(e) {
980
- return e.getAttribute("href");
981
- }
982
- },
983
- target: { default: X.target },
984
- rel: { default: X.rel }
985
- };
1486
+ return { href: {
1487
+ default: null,
1488
+ parseHTML(e) {
1489
+ return e.getAttribute("href");
1490
+ }
1491
+ } };
986
1492
  },
987
1493
  parseHTML() {
988
1494
  let e = this.options.isValidLink;
@@ -997,25 +1503,25 @@ var Bn = O.create({
997
1503
  renderHTML({ HTMLAttributes: e }) {
998
1504
  return this.options.isValidLink(e.href) ? [
999
1505
  "a",
1000
- j(X, e),
1506
+ tt(e, this.options.HTMLAttributes),
1001
1507
  0
1002
1508
  ] : [
1003
1509
  "a",
1004
- j(X, {
1510
+ tt({
1005
1511
  ...e,
1006
1512
  href: ""
1007
- }),
1513
+ }, this.options.HTMLAttributes),
1008
1514
  0
1009
1515
  ];
1010
1516
  },
1011
1517
  addPasteRules() {
1012
1518
  let e = this.options.isValidLink;
1013
- return [tt({
1519
+ return [et({
1014
1520
  find: (t) => {
1015
1521
  let n = [];
1016
1522
  if (t) {
1017
- let r = kn(t, { defaultProtocol: Y }).filter((t) => t.isLink && e(t.value));
1018
- for (let e of r) Z(e.value) && n.push({
1523
+ let r = ir(t, { defaultProtocol: Z }).filter((t) => t.isLink && e(t.value));
1524
+ for (let e of r) vr(e.value) && n.push({
1019
1525
  text: e.value,
1020
1526
  data: { href: e.href },
1021
1527
  index: e.start
@@ -1029,25 +1535,33 @@ var Bn = O.create({
1029
1535
  },
1030
1536
  addProseMirrorPlugins() {
1031
1537
  let e = [];
1032
- return e.push(Fn({
1538
+ return e.push(pr({
1033
1539
  type: this.type,
1034
- defaultProtocol: Y,
1540
+ defaultProtocol: Z,
1035
1541
  validate: this.options.isValidLink,
1036
- shouldAutoLink: Z
1037
- })), e.push(In({
1542
+ shouldAutoLink: vr
1543
+ })), e.push(mr({
1038
1544
  type: this.type,
1039
1545
  tiptapEditor: this.editor,
1040
1546
  editor: this.options.editor,
1041
1547
  onClick: this.options.onClick
1042
- })), e.push(Ln({
1548
+ })), e.push(hr({
1043
1549
  editor: this.editor,
1044
- defaultProtocol: Y,
1550
+ defaultProtocol: Z,
1045
1551
  type: this.type,
1046
- shouldAutoLink: Z,
1552
+ shouldAutoLink: vr,
1047
1553
  isValidLink: this.options.isValidLink
1048
1554
  })), e;
1049
1555
  }
1050
- }), Vn = [
1556
+ }), br = Me(({ editor: e, options: t }) => ({
1557
+ key: "link",
1558
+ tiptapExtensions: [yr.configure({
1559
+ HTMLAttributes: t.HTMLAttributes ?? {},
1560
+ editor: e,
1561
+ onClick: t.onClick,
1562
+ ...t.isValidLink ? { isValidLink: t.isValidLink } : {}
1563
+ })]
1564
+ })), xr = [
1051
1565
  "vscode-editor-data",
1052
1566
  "blocknote/html",
1053
1567
  "text/markdown",
@@ -1057,21 +1571,21 @@ var Bn = O.create({
1057
1571
  ];
1058
1572
  //#endregion
1059
1573
  //#region src/api/clipboard/fromClipboard/handleFileInsertion.ts
1060
- function Hn(e, t) {
1574
+ function Sr(e, t) {
1061
1575
  if (!e.startsWith(".") || !t.startsWith(".")) throw Error("The strings provided are not valid file extensions.");
1062
1576
  return e === t;
1063
1577
  }
1064
- function Un(e, t) {
1578
+ function Cr(e, t) {
1065
1579
  let n = e.split("/"), r = t.split("/");
1066
1580
  if (n.length !== 2) throw Error(`The string ${e} is not a valid MIME type.`);
1067
1581
  if (r.length !== 2) throw Error(`The string ${t} is not a valid MIME type.`);
1068
1582
  return n[1] === "*" || r[1] === "*" ? n[0] === r[0] : (n[0] === "*" || r[0] === "*" || n[0] === r[0]) && n[1] === r[1];
1069
1583
  }
1070
- function Wn(e, t, n, r = "after") {
1584
+ function wr(e, t, n, r = "after") {
1071
1585
  let i;
1072
1586
  return i = Array.isArray(t.content) && t.content.length === 0 ? e.updateBlock(t, n).id : e.insertBlocks([n], t, r)[0].id, i;
1073
1587
  }
1074
- async function Gn(e, t) {
1588
+ async function Tr(e, t) {
1075
1589
  if (!t.uploadFile) {
1076
1590
  console.warn("Attempted ot insert file, but uploadFile is not set in the BlockNote editor options");
1077
1591
  return;
@@ -1079,7 +1593,7 @@ async function Gn(e, t) {
1079
1593
  let n = "dataTransfer" in e ? e.dataTransfer : e.clipboardData;
1080
1594
  if (n === null) return;
1081
1595
  let r = null;
1082
- for (let e of Vn) if (n.types.includes(e)) {
1596
+ for (let e of xr) if (n.types.includes(e)) {
1083
1597
  r = e;
1084
1598
  break;
1085
1599
  }
@@ -1091,7 +1605,7 @@ async function Gn(e, t) {
1091
1605
  let r = "file";
1092
1606
  for (let e of Object.values(t.schema.blockSpecs)) for (let t of e.implementation.meta?.fileBlockAccept || []) {
1093
1607
  let a = t.startsWith("."), o = i[n].getAsFile();
1094
- if (o && (!a && o.type && Un(i[n].type, t) || a && Hn("." + o.name.split(".").pop(), t))) {
1608
+ if (o && (!a && o.type && Cr(i[n].type, t) || a && Sr("." + o.name.split(".").pop(), t))) {
1095
1609
  r = e.config.type;
1096
1610
  break;
1097
1611
  }
@@ -1104,7 +1618,7 @@ async function Gn(e, t) {
1104
1618
  }, i;
1105
1619
  if (e.type === "paste") {
1106
1620
  let e = t.getTextCursorPosition().block;
1107
- i = Wn(t, e, n);
1621
+ i = wr(t, e, n);
1108
1622
  } else if (e.type === "drop") {
1109
1623
  let r = {
1110
1624
  left: e.clientX,
@@ -1112,8 +1626,8 @@ async function Gn(e, t) {
1112
1626
  }, a = t.prosemirrorView.posAtCoords(r);
1113
1627
  if (!a) return;
1114
1628
  i = t.transact((e) => {
1115
- let i = S(e.doc, a.pos), o = (t.domElement?.querySelector(`[data-id="${i.node.attrs.id}"]`))?.getBoundingClientRect();
1116
- return Wn(t, t.getBlock(i.node.attrs.id), n, o && (o.top + o.bottom) / 2 > r.top ? "before" : "after");
1629
+ let i = C(e.doc, a.pos), o = (t.domElement?.querySelector(`[data-id="${i.node.attrs.id}"]`))?.getBoundingClientRect();
1630
+ return wr(t, t.getBlock(i.node.attrs.id), n, o && (o.top + o.bottom) / 2 > r.top ? "before" : "after");
1117
1631
  });
1118
1632
  } else return;
1119
1633
  let o = await t.uploadFile(a, i), s = typeof o == "string" ? { props: { url: o } } : { ...o };
@@ -1124,63 +1638,65 @@ async function Gn(e, t) {
1124
1638
  }
1125
1639
  //#endregion
1126
1640
  //#region src/api/clipboard/fromClipboard/fileDropExtension.ts
1127
- var Kn = (e) => D.create({
1641
+ var Er = (e) => O.create({
1128
1642
  name: "dropFile",
1129
1643
  addProseMirrorPlugins() {
1130
1644
  return [new N({ props: { handleDOMEvents: { drop(t, n) {
1131
1645
  if (!e.isEditable) return;
1132
1646
  let r = null;
1133
- for (let e of Vn) if (n.dataTransfer.types.includes(e)) {
1647
+ for (let e of xr) if (n.dataTransfer.types.includes(e)) {
1134
1648
  r = e;
1135
1649
  break;
1136
1650
  }
1137
- return r === null ? !0 : r === "Files" ? (Gn(n, e), !0) : !1;
1651
+ return r === null ? !0 : r === "Files" ? (Tr(n, e), !0) : !1;
1138
1652
  } } } })];
1139
1653
  }
1140
- }), qn = /(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/, Jn = /(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/, Yn = /\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/, Xn = /(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/, Zn = /(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/, Qn = /(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/, $n = /\n{2} {0,3}-{2,48}\n{2}/, er = /(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/, tr = /(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/, nr = /(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/, rr = /^\s*\|(.+\|)+\s*$/m, ir = /^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m, ar = /^\s*\|(.+\|)+\s*$/m, or = (e) => qn.test(e) || Jn.test(e) || Yn.test(e) || Xn.test(e) || Zn.test(e) || Qn.test(e) || $n.test(e) || er.test(e) || tr.test(e) || nr.test(e) || rr.test(e) || ir.test(e) || ar.test(e);
1654
+ }), Dr = /(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/, Or = /(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/, kr = /\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/, Ar = /(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/, jr = /(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/, Mr = /(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/, Nr = /\n{2} {0,3}-{2,48}\n{2}/, Pr = /(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/, Fr = /(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/, Ir = /(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/, Lr = /^\s*\|(.+\|)+\s*$/m, Rr = /^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m, zr = /^\s*\|(.+\|)+\s*$/m, Br = (e) => Dr.test(e) || Or.test(e) || kr.test(e) || Ar.test(e) || jr.test(e) || Mr.test(e) || Nr.test(e) || Pr.test(e) || Fr.test(e) || Ir.test(e) || Lr.test(e) || Rr.test(e) || zr.test(e);
1141
1655
  //#endregion
1142
1656
  //#region src/api/clipboard/fromClipboard/handleVSCodePaste.ts
1143
- async function sr(e, t) {
1657
+ function Vr(e, t) {
1144
1658
  let { schema: n } = t.state;
1145
1659
  if (!e.clipboardData) return !1;
1146
1660
  let r = e.clipboardData.getData("text/plain");
1147
- if (!r) return !1;
1148
- if (!n.nodes.codeBlock) return t.pasteText(r), !0;
1661
+ if (!r || !n.nodes.codeBlock) return !1;
1149
1662
  let i = e.clipboardData.getData("vscode-editor-data"), a = (i ? JSON.parse(i) : void 0)?.mode;
1150
1663
  return a ? (t.pasteHTML(`<pre><code class="language-${a}">${r.replace(/\r\n?/g, "\n")}</code></pre>`), !0) : !1;
1151
1664
  }
1152
1665
  //#endregion
1153
1666
  //#region src/api/clipboard/fromClipboard/pasteExtension.ts
1154
- function cr({ event: e, editor: t, prioritizeMarkdownOverHTML: n, plainTextAsMarkdown: r }) {
1667
+ function Hr({ event: e, editor: t, prioritizeMarkdownOverHTML: n, plainTextAsMarkdown: r }) {
1155
1668
  if (t.transact((e) => e.selection.$from.parent.type.spec.code && e.selection.$to.parent.type.spec.code)) {
1156
1669
  let n = e.clipboardData?.getData("text/plain");
1157
1670
  if (n) return t.pasteText(n), !0;
1158
1671
  }
1159
1672
  let i;
1160
- for (let t of Vn) if (e.clipboardData.types.includes(t)) {
1673
+ for (let t of xr) if (e.clipboardData.types.includes(t)) {
1161
1674
  i = t;
1162
1675
  break;
1163
1676
  }
1164
1677
  if (!i) return !0;
1165
- if (i === "vscode-editor-data") return sr(e, t.prosemirrorView), !0;
1166
- if (i === "Files") return Gn(e, t), !0;
1678
+ if (i === "vscode-editor-data") {
1679
+ if (Vr(e, t.prosemirrorView)) return !0;
1680
+ i = "text/plain";
1681
+ }
1682
+ if (i === "Files") return Tr(e, t), !0;
1167
1683
  let a = e.clipboardData.getData(i);
1168
1684
  if (i === "blocknote/html") return t.pasteHTML(a, !0), !0;
1169
1685
  if (i === "text/markdown") return t.pasteMarkdown(a), !0;
1170
1686
  if (n) {
1171
1687
  let n = e.clipboardData.getData("text/plain");
1172
- if (or(n)) return t.pasteMarkdown(n), !0;
1688
+ if (Br(n)) return t.pasteMarkdown(n), !0;
1173
1689
  }
1174
1690
  return i === "text/html" ? (t.pasteHTML(a), !0) : r ? (t.pasteMarkdown(a), !0) : (t.pasteText(a), !0);
1175
1691
  }
1176
- var lr = (e, t) => D.create({
1692
+ var Ur = (e, t) => O.create({
1177
1693
  name: "pasteFromClipboard",
1178
1694
  addProseMirrorPlugins() {
1179
1695
  return [new N({ props: { handleDOMEvents: { paste(n, r) {
1180
1696
  if (r.preventDefault(), e.isEditable) return t({
1181
1697
  event: r,
1182
1698
  editor: e,
1183
- defaultPasteHandler: ({ prioritizeMarkdownOverHTML: t = !0, plainTextAsMarkdown: n = !0 } = {}) => cr({
1699
+ defaultPasteHandler: ({ prioritizeMarkdownOverHTML: t = !0, plainTextAsMarkdown: n = !0 } = {}) => Hr({
1184
1700
  event: r,
1185
1701
  editor: e,
1186
1702
  prioritizeMarkdownOverHTML: t,
@@ -1192,76 +1708,78 @@ var lr = (e, t) => D.create({
1192
1708
  });
1193
1709
  //#endregion
1194
1710
  //#region src/api/clipboard/toClipboard/copyExtension.ts
1195
- function ur(e, t, n) {
1196
- let r = !1, i = e.state.selection instanceof L;
1711
+ function Wr(e, t, n) {
1712
+ let r = !1, i = e.state.selection instanceof it;
1197
1713
  if (!i) {
1198
1714
  let n = e.state.doc.slice(e.state.selection.from, e.state.selection.to, !1).content, i = [];
1199
1715
  for (let e = 0; e < n.childCount; e++) i.push(n.child(e));
1200
1716
  r = i.find((e) => e.type.isInGroup("bnBlock") || e.type.name === "blockGroup" || e.type.spec.group === "blockContent") === void 0, r && (t = n);
1201
1717
  }
1202
- let a, o = xe(e.state.schema, n);
1718
+ let a, o = me(e.state.schema, n);
1203
1719
  if (i) {
1204
1720
  t.firstChild?.type.name === "table" && (t = t.firstChild.content);
1205
- let e = re(t, n.schema.inlineContentSchema, n.schema.styleSchema);
1721
+ let e = oe(t, n.schema.inlineContentSchema, n.schema.styleSchema);
1206
1722
  a = `<table>${o.exportInlineContent(e, {})}</table>`;
1207
1723
  } else if (r) {
1208
- let e = le(t, n.schema.inlineContentSchema, n.schema.styleSchema);
1724
+ let e = ae(t, n.schema.inlineContentSchema, n.schema.styleSchema);
1209
1725
  a = o.exportInlineContent(e, {});
1210
1726
  } else {
1211
- let e = Se(t);
1727
+ let e = xe(t);
1212
1728
  a = o.exportBlocks(e, {});
1213
1729
  }
1214
1730
  return a;
1215
1731
  }
1216
- function dr(e, t) {
1732
+ function Gr(e, t) {
1217
1733
  "node" in e.state.selection && e.state.selection.node.type.spec.group === "blockContent" && t.transact((t) => t.setSelection(new M(t.doc.resolve(e.state.selection.from - 1))));
1218
- let n = e.serializeForClipboard(e.state.selection.content()).dom.innerHTML, r = e.state.selection.content().content, i = ur(e, r, t);
1734
+ let n = e.serializeForClipboard(e.state.selection.content()).dom.innerHTML, r = e.state.selection.content().content, i = Wr(e, r, t);
1219
1735
  return {
1220
1736
  clipboardHTML: n,
1221
1737
  externalHTML: i,
1222
1738
  markdown: ye(i)
1223
1739
  };
1224
1740
  }
1225
- var fr = () => {
1226
- let e = window.getSelection();
1227
- if (!e || e.isCollapsed) return !0;
1228
- let t = e.focusNode;
1229
- for (; t;) {
1230
- if (t instanceof HTMLElement && t.getAttribute("contenteditable") === "false") return !0;
1231
- t = t.parentElement;
1741
+ var Kr = (e) => {
1742
+ if (e.state.selection.empty) return !0;
1743
+ let t = window.getSelection();
1744
+ if (t && !t.isCollapsed) {
1745
+ let e = t.focusNode;
1746
+ for (; e;) {
1747
+ if (e instanceof HTMLElement && e.getAttribute("contenteditable") === "false") return !0;
1748
+ e = e.parentElement;
1749
+ }
1232
1750
  }
1233
1751
  return !1;
1234
- }, pr = (e, t, n) => {
1752
+ }, qr = (e, t, n) => {
1235
1753
  n.preventDefault(), n.clipboardData.clearData();
1236
- let { clipboardHTML: r, externalHTML: i, markdown: a } = dr(t, e);
1754
+ let { clipboardHTML: r, externalHTML: i, markdown: a } = Gr(t, e);
1237
1755
  n.clipboardData.setData("blocknote/html", r), n.clipboardData.setData("text/html", i), n.clipboardData.setData("text/plain", a);
1238
- }, mr = (e) => D.create({
1756
+ }, Jr = (e) => O.create({
1239
1757
  name: "copyToClipboard",
1240
1758
  addProseMirrorPlugins() {
1241
1759
  return [new N({ props: { handleDOMEvents: {
1242
1760
  copy(t, n) {
1243
- return fr() || pr(e, t, n), !0;
1761
+ return Kr(t) || qr(e, t, n), !0;
1244
1762
  },
1245
1763
  cut(t, n) {
1246
- return fr() ? !0 : (pr(e, t, n), t.editable && t.dispatch(t.state.tr.deleteSelection()), !0);
1764
+ return Kr(t) ? !0 : (qr(e, t, n), t.editable && t.dispatch(t.state.tr.deleteSelection()), !0);
1247
1765
  },
1248
1766
  dragstart(t, n) {
1249
1767
  if (!("node" in t.state.selection) || t.state.selection.node.type.spec.group !== "blockContent") return;
1250
1768
  e.transact((e) => e.setSelection(new M(e.doc.resolve(t.state.selection.from - 1)))), n.preventDefault(), n.dataTransfer.clearData();
1251
- let { clipboardHTML: r, externalHTML: i, markdown: a } = dr(t, e);
1769
+ let { clipboardHTML: r, externalHTML: i, markdown: a } = Gr(t, e);
1252
1770
  return n.dataTransfer.setData("blocknote/html", r), n.dataTransfer.setData("text/html", i), n.dataTransfer.setData("text/plain", a), !0;
1253
1771
  }
1254
1772
  } } })];
1255
1773
  }
1256
- }), hr = D.create({
1774
+ }), Yr = O.create({
1257
1775
  name: "blockBackgroundColor",
1258
1776
  addGlobalAttributes() {
1259
1777
  return [{
1260
1778
  types: ["tableCell", "tableHeader"],
1261
- attributes: { backgroundColor: ne() }
1779
+ attributes: { backgroundColor: p() }
1262
1780
  }];
1263
1781
  }
1264
- }), gr = k.create({
1782
+ }), Xr = A.create({
1265
1783
  name: "hardBreak",
1266
1784
  inline: !0,
1267
1785
  group: "inline",
@@ -1272,33 +1790,33 @@ var fr = () => {
1272
1790
  return [{ tag: "br" }];
1273
1791
  },
1274
1792
  renderHTML({ HTMLAttributes: e }) {
1275
- return ["br", j(this.options.HTMLAttributes, e)];
1793
+ return ["br", tt(this.options.HTMLAttributes, e)];
1276
1794
  },
1277
1795
  renderText() {
1278
1796
  return "\n";
1279
1797
  }
1280
- }), _r = (e, t) => {
1798
+ }), Zr = (e, t) => {
1281
1799
  let n = e.resolve(t), r = n.depth - 1;
1282
1800
  if (r < 1) return;
1283
1801
  let i = n.before(r), a = e.resolve(i).nodeAfter;
1284
- if (a) return a.type.spec.group?.includes("bnBlock") ? x(e.resolve(i)) : _r(e, i);
1802
+ if (a) return a.type.spec.group?.includes("bnBlock") ? v(e.resolve(i)) : Zr(e, i);
1285
1803
  }, Q = (e, t) => {
1286
1804
  let n = e.resolve(t), r = n.index();
1287
1805
  if (r === 0) return;
1288
1806
  let i = n.posAtIndex(r - 1);
1289
- return x(e.resolve(i));
1807
+ return v(e.resolve(i));
1290
1808
  }, $ = (e, t) => {
1291
1809
  let n = e.resolve(t), r = n.index();
1292
1810
  if (r === n.node().childCount - 1) return;
1293
1811
  let i = n.posAtIndex(r + 1);
1294
- return x(e.resolve(i));
1295
- }, vr = (e, t) => {
1812
+ return v(e.resolve(i));
1813
+ }, Qr = (e, t) => {
1296
1814
  for (; t.childContainer;) {
1297
1815
  let n = t.childContainer.node, r = e.resolve(t.childContainer.beforePos + 1).posAtIndex(n.childCount - 1);
1298
- t = x(e.resolve(r));
1816
+ t = v(e.resolve(r));
1299
1817
  }
1300
1818
  return t;
1301
- }, yr = (e, t) => e.isBlockContainer && e.blockContent.node.type.spec.content === "inline*" && e.blockContent.node.childCount > 0 && t.isBlockContainer && t.blockContent.node.type.spec.content === "inline*", br = (e, t, n, r) => {
1819
+ }, $r = (e, t) => e.isBlockContainer && e.blockContent.node.type.spec.content === "inline*" && e.blockContent.node.childCount > 0 && t.isBlockContainer && t.blockContent.node.type.spec.content === "inline*", ei = (e, t, n, r) => {
1302
1820
  if (!r.isBlockContainer) throw Error(`Attempted to merge block at position ${r.bnBlock.beforePos} into previous block at position ${n.bnBlock.beforePos}, but next block is not a block container`);
1303
1821
  if (r.childContainer) {
1304
1822
  let n = e.doc.resolve(r.childContainer.beforePos + 1), i = e.doc.resolve(r.childContainer.afterPos - 1), a = n.blockRange(i);
@@ -1312,42 +1830,42 @@ var fr = () => {
1312
1830
  t(e.tr.delete(n.blockContent.afterPos - 1, r.blockContent.beforePos + 1));
1313
1831
  }
1314
1832
  return !0;
1315
- }, xr = (e) => ({ state: t, dispatch: n }) => {
1316
- let r = x(t.doc.resolve(e)), i = Q(t.doc, r.bnBlock.beforePos);
1833
+ }, ti = (e) => ({ state: t, dispatch: n }) => {
1834
+ let r = v(t.doc.resolve(e)), i = Q(t.doc, r.bnBlock.beforePos);
1317
1835
  if (!i) return !1;
1318
- let a = vr(t.doc, i);
1319
- return yr(a, r) ? br(t, n, a, r) : !1;
1320
- }, Sr = D.create({
1836
+ let a = Qr(t.doc, i);
1837
+ return $r(a, r) ? ei(t, n, a, r) : !1;
1838
+ }, ni = O.create({
1321
1839
  priority: 50,
1322
1840
  addKeyboardShortcuts() {
1323
1841
  let e = () => this.editor.commands.first(({ chain: e, commands: t }) => [
1324
1842
  () => t.deleteSelection(),
1325
1843
  () => t.undoInputRule(),
1326
1844
  () => t.command(({ state: e }) => {
1327
- let n = v(e);
1845
+ let n = _(e);
1328
1846
  if (!n.isBlockContainer) return !1;
1329
1847
  let r = e.selection.from === n.blockContent.beforePos + 1, i = n.blockContent.node.type.name === "paragraph";
1330
- return r && !i ? t.command(de(n.bnBlock.beforePos, {
1848
+ return r && !i ? t.command(c(n.bnBlock.beforePos, {
1331
1849
  type: "paragraph",
1332
1850
  props: {}
1333
1851
  })) : !1;
1334
1852
  }),
1335
1853
  () => t.command(({ state: e, tr: t }) => {
1336
- let n = v(e);
1854
+ let n = _(e);
1337
1855
  if (!n.isBlockContainer) return !1;
1338
1856
  let { blockContent: r } = n;
1339
- return e.selection.from === r.beforePos + 1 ? H(t, t.doc.type.schema.nodes.blockContainer, t.doc.type.schema.nodes.blockGroup) : !1;
1857
+ return e.selection.from === r.beforePos + 1 ? V(t, t.doc.type.schema.nodes.blockContainer, t.doc.type.schema.nodes.blockGroup) : !1;
1340
1858
  }),
1341
1859
  () => t.command(({ state: t }) => {
1342
- let n = v(t);
1860
+ let n = _(t);
1343
1861
  if (!n.isBlockContainer) return !1;
1344
1862
  let { bnBlock: r, blockContent: i } = n, a = Q(t.doc, n.bnBlock.beforePos);
1345
1863
  if (!a || !a.isBlockContainer || a.blockContent.node.type.spec.content !== "inline*") return !1;
1346
1864
  let o = t.selection.from === i.beforePos + 1, s = t.selection.empty, c = r.beforePos;
1347
- return o && s ? e().command(xr(c)).scrollIntoView().run() : !1;
1865
+ return o && s ? e().command(ti(c)).scrollIntoView().run() : !1;
1348
1866
  }),
1349
1867
  () => t.command(({ state: e, tr: t, dispatch: n }) => {
1350
- let r = v(e);
1868
+ let r = _(e);
1351
1869
  if (!r.isBlockContainer || e.selection.from !== r.blockContent.beforePos + 1) return !1;
1352
1870
  let i = Q(e.doc, r.bnBlock.beforePos);
1353
1871
  if (!i || i.isBlockContainer) return !1;
@@ -1358,20 +1876,20 @@ var fr = () => {
1358
1876
  return !1;
1359
1877
  }),
1360
1878
  () => t.command(({ state: e, tr: t, dispatch: n }) => {
1361
- let r = v(e);
1879
+ let r = _(e);
1362
1880
  if (!r.isBlockContainer || t.selection.from !== r.blockContent.beforePos + 1) return !1;
1363
1881
  let i = t.doc.resolve(r.bnBlock.beforePos);
1364
1882
  if (i.nodeBefore || i.node().type.name !== "column") return !1;
1365
1883
  let a = t.doc.resolve(r.bnBlock.beforePos), o = t.doc.resolve(a.before()), s = o.before();
1366
- return n && (t.delete(r.bnBlock.beforePos, r.bnBlock.afterPos), z(t, s), o.pos === s + 1 ? (t.insert(s, r.bnBlock.node), t.setSelection(P.near(t.doc.resolve(s)))) : (t.insert(o.pos - 1, r.bnBlock.node), t.setSelection(P.near(t.doc.resolve(o.pos))))), !0;
1884
+ return n && (t.delete(r.bnBlock.beforePos, r.bnBlock.afterPos), R(t, s), o.pos === s + 1 ? (t.insert(s, r.bnBlock.node), t.setSelection(P.near(t.doc.resolve(s)))) : (t.insert(o.pos - 1, r.bnBlock.node), t.setSelection(P.near(t.doc.resolve(o.pos))))), !0;
1367
1885
  }),
1368
1886
  () => t.command(({ state: t }) => {
1369
- let n = v(t);
1887
+ let n = _(t);
1370
1888
  if (!n.isBlockContainer) return !1;
1371
1889
  if (n.blockContent.node.childCount === 0 && n.blockContent.node.type.spec.content === "inline*") {
1372
1890
  let r = Q(t.doc, n.bnBlock.beforePos);
1373
1891
  if (!r) return !1;
1374
- let i = vr(t.doc, r);
1892
+ let i = Qr(t.doc, r);
1375
1893
  if (!i.isBlockContainer || !i || !i.isBlockContainer) return !1;
1376
1894
  let a = e();
1377
1895
  if (n.childContainer && a.insertContentAt(n.bnBlock.afterPos, n.childContainer?.node.content), i.blockContent.node.type.spec.content === "tableRow+") {
@@ -1390,11 +1908,11 @@ var fr = () => {
1390
1908
  return !1;
1391
1909
  }),
1392
1910
  () => t.command(({ state: t }) => {
1393
- let n = v(t);
1911
+ let n = _(t);
1394
1912
  if (!n.isBlockContainer) return !1;
1395
1913
  let r = t.selection.from === n.blockContent.beforePos + 1, i = t.selection.empty, a = Q(t.doc, n.bnBlock.beforePos);
1396
1914
  if (a && r && i) {
1397
- let r = vr(t.doc, a);
1915
+ let r = Qr(t.doc, a);
1398
1916
  if (!r.isBlockContainer) return !1;
1399
1917
  if (r.blockContent.node.type.spec.content === "" || r.blockContent.node.type.spec.content === "inline*" && r.blockContent.node.childCount === 0) return e().cut({
1400
1918
  from: n.bnBlock.beforePos,
@@ -1409,13 +1927,13 @@ var fr = () => {
1409
1927
  ]), t = () => this.editor.commands.first(({ chain: e, commands: t }) => [
1410
1928
  () => t.deleteSelection(),
1411
1929
  () => t.command(({ state: t }) => {
1412
- let n = v(t);
1930
+ let n = _(t);
1413
1931
  if (!n.isBlockContainer || !n.childContainer) return !1;
1414
- let { blockContent: r, childContainer: i } = n, a = t.selection.from === r.afterPos - 1, o = t.selection.empty, s = x(t.doc.resolve(i.beforePos + 1));
1932
+ let { blockContent: r, childContainer: i } = n, a = t.selection.from === r.afterPos - 1, o = t.selection.empty, s = v(t.doc.resolve(i.beforePos + 1));
1415
1933
  if (!s.isBlockContainer) return !1;
1416
1934
  if (a && o) {
1417
1935
  let n = s.blockContent.node, a = n.type.spec.content === "inline*", o = r.node.type.spec.content === "inline*";
1418
- return e().insertContentAt(s.bnBlock.afterPos, s.childContainer?.node.content || w.empty).deleteRange(i.node.childCount === 1 ? {
1936
+ return e().insertContentAt(s.bnBlock.afterPos, s.childContainer?.node.content || T.empty).deleteRange(i.node.childCount === 1 ? {
1419
1937
  from: i.beforePos,
1420
1938
  to: i.afterPos
1421
1939
  } : {
@@ -1426,50 +1944,50 @@ var fr = () => {
1426
1944
  return !1;
1427
1945
  }),
1428
1946
  () => t.command(({ state: t }) => {
1429
- let n = v(t);
1947
+ let n = _(t);
1430
1948
  if (!n.isBlockContainer) return !1;
1431
1949
  let { bnBlock: r, blockContent: i } = n, a = $(t.doc, n.bnBlock.beforePos);
1432
1950
  if (!a || !a.isBlockContainer) return !1;
1433
1951
  let o = t.selection.from === i.afterPos - 1, s = t.selection.empty, c = r.afterPos;
1434
- return o && s ? e().command(xr(c)).scrollIntoView().run() : !1;
1952
+ return o && s ? e().command(ti(c)).scrollIntoView().run() : !1;
1435
1953
  }),
1436
1954
  () => t.command(({ state: e, tr: t, dispatch: n }) => {
1437
- let r = v(e);
1955
+ let r = _(e);
1438
1956
  if (!r.isBlockContainer || e.selection.from !== r.blockContent.afterPos - 1) return !1;
1439
1957
  let i = $(e.doc, r.bnBlock.beforePos);
1440
1958
  if (!i || i.isBlockContainer) return !1;
1441
1959
  if (n) {
1442
1960
  let e = i.bnBlock.beforePos + 1, n = t.doc.resolve(e + 1);
1443
- return t.delete(n.pos, n.pos + n.nodeAfter.nodeSize), z(t, i.bnBlock.beforePos), t.insert(r.bnBlock.afterPos, n.nodeAfter), t.setSelection(P.near(t.doc.resolve(n.pos))), !0;
1961
+ return t.delete(n.pos, n.pos + n.nodeAfter.nodeSize), R(t, i.bnBlock.beforePos), t.insert(r.bnBlock.afterPos, n.nodeAfter), t.setSelection(P.near(t.doc.resolve(n.pos))), !0;
1444
1962
  }
1445
1963
  return !1;
1446
1964
  }),
1447
1965
  () => t.command(({ state: e, tr: t, dispatch: n }) => {
1448
- let r = v(e);
1966
+ let r = _(e);
1449
1967
  if (!r.isBlockContainer || t.selection.from !== r.blockContent.afterPos - 1) return !1;
1450
1968
  let i = t.doc.resolve(r.bnBlock.afterPos);
1451
1969
  if (i.nodeAfter || i.node().type.name !== "column") return !1;
1452
1970
  let a = t.doc.resolve(r.bnBlock.afterPos), o = t.doc.resolve(a.after()), s = o.after();
1453
1971
  if (n) {
1454
- let e = o.pos === s - 1 ? s : o.pos + 1, n = x(t.doc.resolve(e));
1455
- t.delete(n.bnBlock.beforePos, n.bnBlock.afterPos), z(t, s - o.node().nodeSize), t.insert(a.pos, n.bnBlock.node), t.setSelection(P.near(t.doc.resolve(e)));
1972
+ let e = o.pos === s - 1 ? s : o.pos + 1, n = v(t.doc.resolve(e));
1973
+ t.delete(n.bnBlock.beforePos, n.bnBlock.afterPos), R(t, s - o.node().nodeSize), t.insert(a.pos, n.bnBlock.node), t.setSelection(P.near(t.doc.resolve(e)));
1456
1974
  }
1457
1975
  return !0;
1458
1976
  }),
1459
1977
  () => t.command(({ state: t }) => {
1460
- let n = v(t);
1978
+ let n = _(t);
1461
1979
  if (!n.isBlockContainer) return !1;
1462
1980
  let { blockContent: r } = n, i = t.selection.from === r.afterPos - 1, a = t.selection.empty;
1463
1981
  if (i && a) {
1464
1982
  let i = (e, t) => {
1465
1983
  let n = $(e, t);
1466
1984
  if (n) return n;
1467
- let r = _r(e, t);
1985
+ let r = Zr(e, t);
1468
1986
  if (r) return i(e, r.bnBlock.beforePos);
1469
1987
  }, a = i(t.doc, n.bnBlock.beforePos);
1470
1988
  if (!a || !a.isBlockContainer) return !1;
1471
1989
  let o = a.blockContent.node, s = o.type.spec.content === "inline*", c = r.node.type.spec.content === "inline*";
1472
- return e().insertContentAt(a.bnBlock.afterPos, a.childContainer?.node.content || w.empty).deleteRange({
1990
+ return e().insertContentAt(a.bnBlock.afterPos, a.childContainer?.node.content || T.empty).deleteRange({
1473
1991
  from: a.bnBlock.beforePos,
1474
1992
  to: a.bnBlock.afterPos
1475
1993
  }).insertContentAt(t.selection.from, s && c ? o.content : null).setTextSelection(t.selection.from).scrollIntoView().run();
@@ -1477,7 +1995,7 @@ var fr = () => {
1477
1995
  return !1;
1478
1996
  }),
1479
1997
  () => t.command(({ state: t }) => {
1480
- let n = v(t);
1998
+ let n = _(t);
1481
1999
  if (!n.isBlockContainer) return !1;
1482
2000
  if (n.blockContent.node.childCount === 0 && n.blockContent.node.type.spec.content === "inline*") {
1483
2001
  let r = $(t.doc, n.bnBlock.beforePos);
@@ -1495,7 +2013,7 @@ var fr = () => {
1495
2013
  return !1;
1496
2014
  }),
1497
2015
  () => t.command(({ state: t }) => {
1498
- let n = v(t);
2016
+ let n = _(t);
1499
2017
  if (!n.isBlockContainer) return !1;
1500
2018
  let r = t.selection.from === n.blockContent.afterPos - 1, i = t.selection.empty, a = $(t.doc, n.bnBlock.beforePos);
1501
2019
  if (!a || !a.isBlockContainer) return !1;
@@ -1510,13 +2028,13 @@ var fr = () => {
1510
2028
  })
1511
2029
  ]), n = (e = !1) => this.editor.commands.first(({ commands: t, tr: n }) => [
1512
2030
  () => t.command(({ state: e, tr: t }) => {
1513
- let n = v(e);
2031
+ let n = _(e);
1514
2032
  if (!n.isBlockContainer) return !1;
1515
2033
  let { bnBlock: r, blockContent: i } = n, { depth: a } = e.doc.resolve(r.beforePos), o = e.selection.$anchor.parentOffset === 0, s = e.selection.anchor === e.selection.head, c = i.node.childCount === 0;
1516
- return o && s && c && a > 1 ? H(t, t.doc.type.schema.nodes.blockContainer, t.doc.type.schema.nodes.blockGroup) : !1;
2034
+ return o && s && c && a > 1 ? V(t, t.doc.type.schema.nodes.blockContainer, t.doc.type.schema.nodes.blockGroup) : !1;
1517
2035
  }),
1518
2036
  () => t.command(({ state: t }) => {
1519
- let r = v(t), i = this.options.editor.schema.blockSchema[r.blockNoteType].meta?.hardBreakShortcut ?? "shift+enter";
2037
+ let r = _(t), i = this.options.editor.schema.blockSchema[r.blockNoteType].meta?.hardBreakShortcut ?? "shift+enter";
1520
2038
  if (i === "none") return !1;
1521
2039
  if (i === "shift+enter" && e || i === "enter") {
1522
2040
  let e = n.storedMarks || n.selection.$head.marks().filter((e) => this.editor.extensionManager.splittableMarks.includes(e.type.name));
@@ -1525,7 +2043,7 @@ var fr = () => {
1525
2043
  return !1;
1526
2044
  }),
1527
2045
  () => t.command(({ state: e, dispatch: t, tr: n }) => {
1528
- let r = v(e);
2046
+ let r = _(e);
1529
2047
  if (!r.isBlockContainer) return !1;
1530
2048
  let { bnBlock: i, blockContent: a } = r, o = e.selection.$anchor.parentOffset === 0, s = e.selection.anchor === e.selection.head, c = a.node.childCount === 0;
1531
2049
  if (o && s && c) {
@@ -1539,10 +2057,10 @@ var fr = () => {
1539
2057
  return !1;
1540
2058
  }),
1541
2059
  () => t.command(({ state: e, chain: t }) => {
1542
- let n = v(e);
2060
+ let n = _(e);
1543
2061
  if (!n.isBlockContainer) return !1;
1544
2062
  let { blockContent: r } = n, i = e.selection.$anchor.parentOffset === 0;
1545
- return r.node.childCount === 0 ? !1 : (t().deleteSelection().command(f(e.selection.from, i, i)).run(), !0);
2063
+ return r.node.childCount === 0 ? !1 : (t().deleteSelection().command(a(e.selection.from, i, i)).run(), !0);
1546
2064
  })
1547
2065
  ]);
1548
2066
  return {
@@ -1550,8 +2068,8 @@ var fr = () => {
1550
2068
  Delete: t,
1551
2069
  Enter: () => n(),
1552
2070
  "Shift-Enter": () => n(!0),
1553
- Tab: () => this.options.tabBehavior !== "prefer-indent" && (this.options.editor.getExtension(C)?.store.state || this.options.editor.getExtension(oe)?.store.state !== void 0) ? !1 : Ht(this.options.editor),
1554
- "Shift-Tab": () => this.options.tabBehavior !== "prefer-indent" && (this.options.editor.getExtension(C)?.store.state || this.options.editor.getExtension(oe)?.store.state !== void 0) ? !1 : Wt(this.options.editor),
2071
+ Tab: () => this.options.tabBehavior !== "prefer-indent" && (this.options.editor.getExtension(b)?.store.state || this.options.editor.getExtension(ie)?.store.state !== void 0) ? !1 : Rt(this.options.editor),
2072
+ "Shift-Tab": () => this.options.tabBehavior !== "prefer-indent" && (this.options.editor.getExtension(b)?.store.state || this.options.editor.getExtension(ie)?.store.state !== void 0) ? !1 : Bt(this.options.editor),
1555
2073
  "Shift-Mod-ArrowUp": () => (this.options.editor.moveBlocksUp(), !0),
1556
2074
  "Shift-Mod-ArrowDown": () => (this.options.editor.moveBlocksDown(), !0),
1557
2075
  "Mod-z": () => this.options.editor.undo(),
@@ -1559,7 +2077,7 @@ var fr = () => {
1559
2077
  "Shift-Mod-z": () => this.options.editor.redo()
1560
2078
  };
1561
2079
  }
1562
- }), Cr = O.create({
2080
+ }), ri = k.create({
1563
2081
  name: "insertion",
1564
2082
  inclusive: !1,
1565
2083
  excludes: "deletion modification insertion",
@@ -1592,7 +2110,7 @@ var fr = () => {
1592
2110
  }]
1593
2111
  } : {};
1594
2112
  }
1595
- }), wr = O.create({
2113
+ }), ii = k.create({
1596
2114
  name: "deletion",
1597
2115
  inclusive: !1,
1598
2116
  excludes: "insertion modification deletion",
@@ -1625,7 +2143,7 @@ var fr = () => {
1625
2143
  }]
1626
2144
  } : {};
1627
2145
  }
1628
- }), Tr = O.create({
2146
+ }), ai = k.create({
1629
2147
  name: "modification",
1630
2148
  inclusive: !1,
1631
2149
  excludes: "deletion insertion",
@@ -1683,7 +2201,7 @@ var fr = () => {
1683
2201
  }]
1684
2202
  } : {};
1685
2203
  }
1686
- }), Er = D.create({
2204
+ }), oi = O.create({
1687
2205
  name: "textAlignment",
1688
2206
  addGlobalAttributes() {
1689
2207
  return [{
@@ -1695,7 +2213,7 @@ var fr = () => {
1695
2213
  } }
1696
2214
  }];
1697
2215
  }
1698
- }), Dr = D.create({
2216
+ }), si = O.create({
1699
2217
  name: "blockTextColor",
1700
2218
  addGlobalAttributes() {
1701
2219
  return [{
@@ -1707,13 +2225,13 @@ var fr = () => {
1707
2225
  attributes: { textColor: ue() }
1708
2226
  }];
1709
2227
  }
1710
- }), Or = {
2228
+ }), ci = {
1711
2229
  blockColor: "data-block-color",
1712
2230
  blockStyle: "data-block-style",
1713
2231
  id: "data-id",
1714
2232
  depth: "data-depth",
1715
2233
  depthChange: "data-depth-change"
1716
- }, kr = k.create({
2234
+ }, li = A.create({
1717
2235
  name: "blockContainer",
1718
2236
  group: "blockGroupChild bnBlock",
1719
2237
  content: "blockContent blockGroup?",
@@ -1726,7 +2244,7 @@ var fr = () => {
1726
2244
  getAttrs: (e) => {
1727
2245
  if (typeof e == "string") return !1;
1728
2246
  let t = {};
1729
- for (let [n, r] of Object.entries(Or)) e.getAttribute(r) && (t[n] = e.getAttribute(r));
2247
+ for (let [n, r] of Object.entries(ci)) e.getAttribute(r) && (t[n] = e.getAttribute(r));
1730
2248
  return t;
1731
2249
  }
1732
2250
  }, {
@@ -1749,7 +2267,7 @@ var fr = () => {
1749
2267
  contentDOM: r
1750
2268
  };
1751
2269
  }
1752
- }), Ar = k.create({
2270
+ }), ui = A.create({
1753
2271
  name: "blockGroup",
1754
2272
  group: "childContainer",
1755
2273
  content: "blockGroupChild+",
@@ -1772,32 +2290,32 @@ var fr = () => {
1772
2290
  contentDOM: n
1773
2291
  };
1774
2292
  }
1775
- }), jr = k.create({
2293
+ }), di = A.create({
1776
2294
  name: "doc",
1777
2295
  topNode: !0,
1778
2296
  content: "blockGroup",
1779
2297
  marks: "insertion modification deletion"
1780
- }), Mr = Ne(({ options: e }) => ({
2298
+ }), fi = Me(({ options: e }) => ({
1781
2299
  key: "collaboration",
1782
2300
  blockNoteExtensions: [
1783
- fe(e),
1784
- me(e),
1785
- _e(e),
1786
- Ae(),
1787
- ge(e)
2301
+ he(e),
2302
+ ge(e),
2303
+ ke(e),
2304
+ de(),
2305
+ Ae(e)
1788
2306
  ]
1789
2307
  }));
1790
2308
  //#endregion
1791
2309
  //#region src/editor/managers/ExtensionManager/extensions.ts
1792
- function Nr(e, t) {
2310
+ function pi(e, t) {
1793
2311
  return [
1794
- A.ClipboardTextSerializer,
1795
- A.Commands,
1796
- A.Editable,
1797
- A.FocusEvents,
1798
- A.Tabindex,
1799
- gt,
1800
- o.configure({
2312
+ j.ClipboardTextSerializer,
2313
+ j.Commands,
2314
+ j.Editable,
2315
+ j.FocusEvents,
2316
+ j.Tabindex,
2317
+ dt,
2318
+ u.configure({
1801
2319
  types: [
1802
2320
  "blockContainer",
1803
2321
  "columnList",
@@ -1806,64 +2324,63 @@ function Nr(e, t) {
1806
2324
  setIdAttribute: t.setIdAttribute,
1807
2325
  isWithinEditor: e.isWithinEditor
1808
2326
  }),
1809
- gr,
1810
- _t,
1811
- Cr,
1812
- wr,
1813
- Tr,
1814
- Bn.configure({
1815
- HTMLAttributes: t.links?.HTMLAttributes ?? {},
1816
- editor: e,
1817
- onClick: t.links?.onClick,
1818
- ...t.links?.isValidLink ? { isValidLink: t.links.isValidLink } : {}
1819
- }),
2327
+ Xr,
2328
+ ft,
2329
+ ri,
2330
+ ii,
2331
+ ai,
1820
2332
  ...Object.values(e.schema.styleSpecs).map((t) => t.implementation.mark.configure({ editor: e })),
1821
- Dr,
1822
- hr,
1823
- Er,
1824
- D.create({
2333
+ si,
2334
+ Yr,
2335
+ oi,
2336
+ O.create({
1825
2337
  name: "OverrideEscape",
1826
- addKeyboardShortcuts: () => ({ Escape: () => e.getExtension(te)?.shown() ? !1 : (e.blur(), !0) })
2338
+ addKeyboardShortcuts: () => ({ Escape: () => e.getExtension(h)?.shown() ? !1 : (e.blur(), !0) })
1827
2339
  }),
1828
- jr,
1829
- kr.configure({
2340
+ di,
2341
+ li.configure({
1830
2342
  editor: e,
1831
2343
  domAttributes: t.domAttributes
1832
2344
  }),
1833
- Sr.configure({
2345
+ ni.configure({
1834
2346
  editor: e,
1835
2347
  tabBehavior: t.tabBehavior
1836
2348
  }),
1837
- Ar.configure({ domAttributes: t.domAttributes }),
2349
+ ui.configure({ domAttributes: t.domAttributes }),
1838
2350
  ...Object.values(e.schema.inlineContentSpecs).filter((e) => e.config !== "link" && e.config !== "text").map((t) => t.implementation.node.configure({ editor: e })),
1839
2351
  ...Object.values(e.schema.blockSpecs).flatMap((n) => [..."node" in n.implementation ? [n.implementation.node.configure({
1840
2352
  editor: e,
1841
2353
  domAttributes: t.domAttributes
1842
2354
  })] : []]),
1843
- mr(e),
1844
- lr(e, t.pasteHandler || ((e) => e.defaultPasteHandler())),
1845
- Kn(e)
2355
+ Jr(e),
2356
+ Ur(e, t.pasteHandler || ((e) => e.defaultPasteHandler())),
2357
+ Er(e)
1846
2358
  ];
1847
2359
  }
1848
- function Pr(e, t) {
2360
+ function mi(e, t) {
1849
2361
  let n = [
1850
2362
  pe(),
1851
- je(t),
1852
- oe(t),
1853
- C(t),
1854
2363
  ve(t),
1855
- Ce(),
1856
- Ee(t),
1857
- Pe(t),
2364
+ ie(t),
2365
+ b(t),
2366
+ br({
2367
+ HTMLAttributes: t.links?.HTMLAttributes ?? {},
2368
+ onClick: t.links?.onClick,
2369
+ ...t.links?.isValidLink ? { isValidLink: t.links.isValidLink } : {}
2370
+ }),
2371
+ _e(t),
2372
+ Se(),
1858
2373
  Te(t),
1859
- te(t),
1860
- ...t.trailingBlock === !1 ? [] : [De()]
2374
+ Ne(t),
2375
+ we(t),
2376
+ h(t),
2377
+ ...t.trailingBlock === !1 ? [] : [Ee()]
1861
2378
  ];
1862
- return t.collaboration ? n.push(Mr(t.collaboration)) : n.push(ke()), "table" in e.schema.blockSpecs && n.push(we(t)), t.animations !== !1 && n.push(be()), n;
2379
+ return t.collaboration ? n.push(fi(t.collaboration)) : n.push(Oe()), "table" in e.schema.blockSpecs && n.push(Ce(t)), t.animations !== !1 && n.push(be()), n;
1863
2380
  }
1864
2381
  //#endregion
1865
2382
  //#region src/editor/managers/ExtensionManager/index.ts
1866
- var Fr = class {
2383
+ var hi = class {
1867
2384
  disabledExtensions = /* @__PURE__ */ new Set();
1868
2385
  extensions = [];
1869
2386
  abortMap = /* @__PURE__ */ new Map();
@@ -1884,7 +2401,7 @@ var Fr = class {
1884
2401
  }), e.onUnmount(() => {
1885
2402
  for (let [e, t] of this.abortMap.entries()) this.abortMap.delete(e), t.abort();
1886
2403
  }), this.disabledExtensions = new Set(t.disableExtensions || []);
1887
- for (let e of Pr(this.editor, this.options)) this.addExtension(e);
2404
+ for (let e of mi(this.editor, this.options)) this.addExtension(e);
1888
2405
  for (let e of this.options.extensions ?? []) this.addExtension(e);
1889
2406
  for (let e of Object.values(this.editor.schema.blockSpecs)) for (let t of e.extensions ?? []) this.addExtension(t);
1890
2407
  }
@@ -1904,7 +2421,7 @@ var Fr = class {
1904
2421
  let t;
1905
2422
  if (t = typeof e == "function" ? e({ editor: this.editor }) : e, !(!t || this.disabledExtensions.has(t.key))) {
1906
2423
  if (typeof e == "function") {
1907
- let e = t[Me];
2424
+ let e = t[je];
1908
2425
  typeof e == "function" && this.extensionFactories.set(e, t);
1909
2426
  }
1910
2427
  if (this.extensions.push(t), t.blockNoteExtensions) for (let e of t.blockNoteExtensions) this.addExtension(e);
@@ -1943,23 +2460,29 @@ var Fr = class {
1943
2460
  this.editor.prosemirrorView.updateState(n);
1944
2461
  }
1945
2462
  getTiptapExtensions() {
1946
- let e = Nr(this.editor, this.options).filter((e) => !this.disabledExtensions.has(e.name)), t = a(this.extensions), n = /* @__PURE__ */ new Map();
2463
+ let e = pi(this.editor, this.options).filter((e) => !this.disabledExtensions.has(e.name)), t = l(this.extensions), n = /* @__PURE__ */ new Map();
1947
2464
  for (let r of this.extensions) {
1948
2465
  r.tiptapExtensions && e.push(...r.tiptapExtensions);
1949
2466
  let i = t(r.key), { plugins: a, inputRules: o } = this.getProsemirrorPluginsFromExtension(r);
1950
- a.length && e.push(D.create({
2467
+ a.length && e.push(O.create({
1951
2468
  name: r.key,
1952
2469
  priority: i,
1953
2470
  addProseMirrorPlugins: () => a
1954
2471
  })), o.length && (n.has(i) || n.set(i, []), n.get(i).push(...o));
1955
2472
  }
1956
- e.push(D.create({
2473
+ e.push(O.create({
1957
2474
  name: "blocknote-input-rules",
1958
2475
  addProseMirrorPlugins() {
1959
2476
  let e = [];
1960
- return Array.from(n.keys()).sort().reverse().forEach((t) => {
2477
+ Array.from(n.keys()).sort().reverse().forEach((t) => {
1961
2478
  e.push(...n.get(t));
1962
- }), [mt({ rules: e })];
2479
+ });
2480
+ let t = lt({ rules: e });
2481
+ return [t, new N({ props: { handleKeyDown(e, n) {
2482
+ if (n.key !== "Enter" || n.shiftKey || n.ctrlKey || n.metaKey || n.altKey) return !1;
2483
+ let { $cursor: r } = e.state.selection;
2484
+ return r ? !!t.props.handleTextInput?.call(t, e, r.pos, r.pos, "\n", () => e.state.tr.insertText("\n", r.pos, r.pos)) : !1;
2485
+ } } })];
1963
2486
  }
1964
2487
  }));
1965
2488
  for (let t of this.options._tiptapOptions?.extensions ?? []) e.push(t);
@@ -1970,23 +2493,24 @@ var Fr = class {
1970
2493
  return !e.prosemirrorPlugins?.length && !Object.keys(e.keyboardShortcuts || {}).length && !e.inputRules?.length ? {
1971
2494
  plugins: t,
1972
2495
  inputRules: n
1973
- } : (this.extensionPlugins.set(e, t), e.inputRules?.length && n.push(...e.inputRules.map((e) => new pt(e.find, (t, n, r, i) => {
1974
- let a = e.replace({
2496
+ } : (this.extensionPlugins.set(e, t), e.inputRules?.length && n.push(...e.inputRules.map((e) => new ct(e.find, (t, n, r, a) => {
2497
+ let o = e.replace({
1975
2498
  match: n,
1976
2499
  range: {
1977
2500
  from: r,
1978
- to: i
2501
+ to: a
1979
2502
  },
1980
2503
  editor: this.editor
1981
2504
  });
1982
- if (a) {
1983
- let e = this.editor.getTextCursorPosition();
1984
- if (this.editor.schema.blockSchema[e.block.type].content !== "inline") return null;
1985
- let n = _(t.tr), o = t.tr.deleteRange(r, i);
1986
- return d(o, n.bnBlock.beforePos, a), o;
2505
+ if (o) {
2506
+ let e = t.tr, n = f(e);
2507
+ if (!n.isBlockContainer || this.editor.schema.blockSchema[n.blockNoteType]?.content !== "inline") return null;
2508
+ e.deleteRange(r, a), i(e, n.bnBlock.beforePos, o);
2509
+ let s = n.bnBlock.node.attrs.id;
2510
+ return s && Un(e, s, "start"), e;
1987
2511
  }
1988
2512
  return null;
1989
- }))), Object.keys(e.keyboardShortcuts || {}).length && t.push(ht(Object.fromEntries(Object.entries(e.keyboardShortcuts).map(([e, t]) => [e, () => t({ editor: this.editor })])))), {
2513
+ }, { undoable: !0 }))), Object.keys(e.keyboardShortcuts || {}).length && t.push(ut(Object.fromEntries(Object.entries(e.keyboardShortcuts).map(([e, t]) => [e, () => t({ editor: this.editor })])))), {
1990
2514
  plugins: t,
1991
2515
  inputRules: n
1992
2516
  });
@@ -2005,7 +2529,7 @@ var Fr = class {
2005
2529
  };
2006
2530
  //#endregion
2007
2531
  //#region src/util/expandToWords.ts
2008
- function Ir(e, t) {
2532
+ function gi(e, t) {
2009
2533
  let { $from: n, $to: r } = t;
2010
2534
  if (n.pos > n.start() && n.pos < e.content.size) {
2011
2535
  let t = e.textBetween(n.pos, n.pos + 1);
@@ -2030,16 +2554,16 @@ function Ir(e, t) {
2030
2554
  }
2031
2555
  //#endregion
2032
2556
  //#region src/api/blockManipulation/selections/selection.ts
2033
- function Lr(e) {
2557
+ function _i(e) {
2034
2558
  let t = g(e);
2035
2559
  if (e.selection.empty || "node" in e.selection) return;
2036
- let n = e.doc.resolve(S(e.doc, e.selection.from).posBeforeNode), r = e.doc.resolve(S(e.doc, e.selection.to).posBeforeNode), i = (r, i) => {
2560
+ let n = e.doc.resolve(C(e.doc, e.selection.from).posBeforeNode), r = e.doc.resolve(C(e.doc, e.selection.to).posBeforeNode), i = (r, i) => {
2037
2561
  let a = n.posAtIndex(r, i), o = e.doc.resolve(a).nodeAfter;
2038
2562
  if (!o) throw Error(`Error getting selection - node not found at position ${a}`);
2039
- return y(o, t);
2563
+ return m(o, t);
2040
2564
  }, a = [], o = n.sharedDepth(r.pos), s = n.index(o), c = r.index(o);
2041
2565
  if (n.depth > o) {
2042
- a.push(y(n.nodeAfter, t));
2566
+ a.push(m(n.nodeAfter, t));
2043
2567
  for (let e = n.depth; e > o; e--) if (n.node(e).type.isInGroup("childContainer")) {
2044
2568
  let t = n.index(e) + 1, r = n.node(e).childCount;
2045
2569
  for (let n = t; n < r; n++) a.push(i(n, e));
@@ -2049,34 +2573,34 @@ function Lr(e) {
2049
2573
  if (a.length === 0) throw Error(`Error getting selection - selection doesn't span any blocks (${e.selection})`);
2050
2574
  return { blocks: a };
2051
2575
  }
2052
- function Rr(e, t, n) {
2053
- let r = typeof t == "string" ? t : t.id, a = typeof n == "string" ? n : n.id, o = ee(g(e));
2054
- if (r === a) throw Error(`Attempting to set selection with the same anchor and head blocks (id ${r})`);
2055
- let s = i(r, e.doc);
2056
- if (!s) throw Error(`Block with ID ${r} not found`);
2057
- let c = i(a, e.doc);
2576
+ function vi(e, t, n) {
2577
+ let i = typeof t == "string" ? t : t.id, a = typeof n == "string" ? n : n.id, o = re(g(e));
2578
+ if (i === a) throw Error(`Attempting to set selection with the same anchor and head blocks (id ${i})`);
2579
+ let s = r(i, e.doc);
2580
+ if (!s) throw Error(`Block with ID ${i} not found`);
2581
+ let c = r(a, e.doc);
2058
2582
  if (!c) throw Error(`Block with ID ${a} not found`);
2059
- let l = ae(s), u = ae(c), d = o.blockSchema[l.blockNoteType], f = o.blockSchema[u.blockNoteType];
2060
- if (!l.isBlockContainer || d.content === "none") throw Error(`Attempting to set selection anchor in block without content (id ${r})`);
2583
+ let l = x(s), u = x(c), d = o.blockSchema[l.blockNoteType], f = o.blockSchema[u.blockNoteType];
2584
+ if (!l.isBlockContainer || d.content === "none") throw Error(`Attempting to set selection anchor in block without content (id ${i})`);
2061
2585
  if (!u.isBlockContainer || f.content === "none") throw Error(`Attempting to set selection anchor in block without content (id ${a})`);
2062
2586
  let p, m;
2063
2587
  if (d.content === "table") {
2064
- let e = it.get(l.blockContent.node);
2588
+ let e = at.get(l.blockContent.node);
2065
2589
  p = l.blockContent.beforePos + e.positionAt(0, 0, l.blockContent.node) + 1 + 2;
2066
2590
  } else p = l.blockContent.beforePos + 1;
2067
2591
  if (f.content === "table") {
2068
- let t = it.get(u.blockContent.node), n = u.blockContent.beforePos + t.positionAt(t.height - 1, t.width - 1, u.blockContent.node) + 1;
2592
+ let t = at.get(u.blockContent.node), n = u.blockContent.beforePos + t.positionAt(t.height - 1, t.width - 1, u.blockContent.node) + 1;
2069
2593
  m = n + e.doc.resolve(n).nodeAfter.nodeSize - 2;
2070
2594
  } else m = u.blockContent.afterPos - 1;
2071
2595
  e.setSelection(P.create(e.doc, p, m));
2072
2596
  }
2073
- function zr(e, t = !1) {
2074
- let n = g(e), r = t ? Ir(e.doc, e.selection) : e.selection, i = r.$from, a = r.$to;
2597
+ function yi(e, t = !1) {
2598
+ let n = g(e), r = t ? gi(e.doc, e.selection) : e.selection, i = r.$from, a = r.$to;
2075
2599
  for (; a.parentOffset >= a.parent.nodeSize - 2 && a.depth > 0;) a = e.doc.resolve(a.pos + 1);
2076
2600
  for (; a.parentOffset === 0 && a.depth > 0;) a = e.doc.resolve(a.pos - 1);
2077
2601
  for (; i.parentOffset === 0 && i.depth > 0;) i = e.doc.resolve(i.pos - 1);
2078
2602
  for (; i.parentOffset >= i.parent.nodeSize - 2 && i.depth > 0;) i = e.doc.resolve(i.pos + 1);
2079
- let o = ie(e.doc.slice(i.pos, a.pos, !0), n);
2603
+ let o = se(e.doc.slice(i.pos, a.pos, !0), n);
2080
2604
  return {
2081
2605
  _meta: {
2082
2606
  startPos: i.pos,
@@ -2086,62 +2610,36 @@ function zr(e, t = !1) {
2086
2610
  };
2087
2611
  }
2088
2612
  //#endregion
2089
- //#region src/api/blockManipulation/selections/textCursorPosition.ts
2090
- function Br(e) {
2091
- let { bnBlock: t } = _(e), n = g(e.doc), r = e.doc.resolve(t.beforePos), i = r.nodeBefore, a = e.doc.resolve(t.afterPos).nodeAfter, o;
2092
- return r.depth > 1 && (o = r.node(), o.type.isInGroup("bnBlock") || (o = r.node(r.depth - 1))), {
2093
- block: y(t.node, n),
2094
- prevBlock: i === null ? void 0 : y(i, n),
2095
- nextBlock: a === null ? void 0 : y(a, n),
2096
- parentBlock: o === void 0 ? void 0 : y(o, n)
2097
- };
2098
- }
2099
- function Vr(e, t, n = "start") {
2100
- let r = typeof t == "string" ? t : t.id, a = ee(g(e.doc)), o = i(r, e.doc);
2101
- if (!o) throw Error(`Block with ID ${r} not found`);
2102
- let s = ae(o), c = a.blockSchema[s.blockNoteType].content;
2103
- if (s.isBlockContainer) {
2104
- let t = s.blockContent;
2105
- if (c === "none") {
2106
- e.setSelection(M.create(e.doc, t.beforePos));
2107
- return;
2108
- }
2109
- if (c === "inline") n === "start" ? e.setSelection(P.create(e.doc, t.beforePos + 1)) : e.setSelection(P.create(e.doc, t.afterPos - 1));
2110
- else if (c === "table") n === "start" ? e.setSelection(P.create(e.doc, t.beforePos + 4)) : e.setSelection(P.create(e.doc, t.afterPos - 4));
2111
- else throw new u(c);
2112
- } else Vr(e, (n === "start" ? s.childContainer.node.firstChild : s.childContainer.node.lastChild).attrs.id, n);
2113
- }
2114
- //#endregion
2115
2613
  //#region src/editor/managers/SelectionManager.ts
2116
- var Hr = class {
2614
+ var bi = class {
2117
2615
  constructor(e) {
2118
2616
  this.editor = e;
2119
2617
  }
2120
2618
  getSelection() {
2121
- return this.editor.transact((e) => Lr(e));
2619
+ return this.editor.transact((e) => _i(e));
2122
2620
  }
2123
2621
  getSelectionCutBlocks(e = !1) {
2124
- return this.editor.transact((t) => zr(t, e));
2622
+ return this.editor.transact((t) => yi(t, e));
2125
2623
  }
2126
2624
  setSelection(e, t) {
2127
- return this.editor.transact((n) => Rr(n, e, t));
2625
+ return this.editor.transact((n) => vi(n, e, t));
2128
2626
  }
2129
2627
  getTextCursorPosition() {
2130
- return this.editor.transact((e) => Br(e));
2628
+ return this.editor.transact((e) => Hn(e));
2131
2629
  }
2132
2630
  setTextCursorPosition(e, t = "start") {
2133
- return this.editor.transact((n) => Vr(n, e, t));
2631
+ return this.editor.transact((n) => Un(n, e, t));
2134
2632
  }
2135
2633
  getSelectionBoundingBox() {
2136
2634
  if (!this.editor.prosemirrorView) return;
2137
2635
  let { selection: e } = this.editor.prosemirrorState, { ranges: t } = e, n = Math.min(...t.map((e) => e.$from.pos)), r = Math.max(...t.map((e) => e.$to.pos));
2138
- if (et(e)) {
2636
+ if ($e(e)) {
2139
2637
  let e = this.editor.prosemirrorView.nodeDOM(n);
2140
2638
  if (e) return e.getBoundingClientRect();
2141
2639
  }
2142
2640
  return nt(this.editor.prosemirrorView, n, r).toJSON();
2143
2641
  }
2144
- }, Ur = class {
2642
+ }, xi = class {
2145
2643
  constructor(e) {
2146
2644
  this.editor = e;
2147
2645
  }
@@ -2219,7 +2717,7 @@ var Hr = class {
2219
2717
  };
2220
2718
  //#endregion
2221
2719
  //#region src/api/blockManipulation/insertContentAt.ts
2222
- function Wr(e, t, n, r = { updateSelection: !0 }) {
2720
+ function Si(e, t, n, r = { updateSelection: !0 }) {
2223
2721
  let { from: i, to: a } = typeof t == "number" ? {
2224
2722
  from: t,
2225
2723
  to: t
@@ -2237,17 +2735,17 @@ function Wr(e, t, n, r = { updateSelection: !0 }) {
2237
2735
  }
2238
2736
  //#endregion
2239
2737
  //#region src/editor/managers/StyleManager.ts
2240
- var Gr = class {
2738
+ var Ci = class {
2241
2739
  constructor(e) {
2242
2740
  this.editor = e;
2243
2741
  }
2244
- insertInlineContent(e, { updateSelection: t = !1 } = {}) {
2245
- let n = b(e, this.editor.pmSchema);
2742
+ insertInlineContent(e, { updateSelection: n = !1 } = {}) {
2743
+ let r = t(e, this.editor.pmSchema);
2246
2744
  this.editor.transact((e) => {
2247
- Wr(e, {
2745
+ Si(e, {
2248
2746
  from: e.selection.from,
2249
2747
  to: e.selection.to
2250
- }, n, { updateSelection: t });
2748
+ }, r, { updateSelection: n });
2251
2749
  });
2252
2750
  }
2253
2751
  getActiveStyles() {
@@ -2270,7 +2768,7 @@ var Gr = class {
2270
2768
  if (!e) throw Error(`style ${t} not found in styleSchema`);
2271
2769
  if (e.propSchema === "boolean") this.editor._tiptapEditor.commands.setMark(t);
2272
2770
  else if (e.propSchema === "string") this.editor._tiptapEditor.commands.setMark(t, { stringValue: n });
2273
- else throw new u(e.propSchema);
2771
+ else throw new w(e.propSchema);
2274
2772
  }
2275
2773
  }
2276
2774
  removeStyles(e) {
@@ -2282,7 +2780,7 @@ var Gr = class {
2282
2780
  if (!e) throw Error(`style ${t} not found in styleSchema`);
2283
2781
  if (e.propSchema === "boolean") this.editor._tiptapEditor.commands.toggleMark(t);
2284
2782
  else if (e.propSchema === "string") this.editor._tiptapEditor.commands.toggleMark(t, { stringValue: n });
2285
- else throw new u(e.propSchema);
2783
+ else throw new w(e.propSchema);
2286
2784
  }
2287
2785
  }
2288
2786
  getSelectedText() {
@@ -2292,7 +2790,7 @@ var Gr = class {
2292
2790
  return this.editor.transact((t) => {
2293
2791
  let n = t.doc.resolve(e), r = n.marks().find((e) => e.type.name === "link");
2294
2792
  if (!r) return;
2295
- let i = Ze(n, r.type);
2793
+ let i = Xe(n, r.type);
2296
2794
  if (i) return {
2297
2795
  href: r.attrs.href,
2298
2796
  from: i.from,
@@ -2331,22 +2829,22 @@ var Gr = class {
2331
2829
  };
2332
2830
  //#endregion
2333
2831
  //#region src/editor/transformPasted.ts
2334
- function Kr(e) {
2335
- return Je(e.state.selection.$from, (e) => e.type.name === "tableCell" || e.type.name === "tableHeader") !== void 0;
2832
+ function wi(e) {
2833
+ return qe(e.state.selection.$from, (e) => e.type.name === "tableCell" || e.type.name === "tableHeader") !== void 0;
2336
2834
  }
2337
- function qr(e, t) {
2835
+ function Ti(e, t) {
2338
2836
  let n = t.nodes.hardBreak, r = F.empty;
2339
2837
  return e.forEach((e) => {
2340
- e.isTextblock && e.childCount > 0 ? (r = r.append(e.content), r = r.addToEnd(n.create())) : e.isText ? r = r.addToEnd(e) : e.isBlock && e.childCount > 0 && (r = r.append(qr(e.content, t)), r = r.addToEnd(n.create()));
2838
+ e.isTextblock && e.childCount > 0 ? (r = r.append(e.content), r = r.addToEnd(n.create())) : e.isText ? r = r.addToEnd(e) : e.isBlock && e.childCount > 0 && (r = r.append(Ti(e.content, t)), r = r.addToEnd(n.create()));
2341
2839
  }), r.lastChild?.type === n && (r = r.cut(0, r.size - 1)), r;
2342
2840
  }
2343
- function Jr(e, t) {
2841
+ function Ei(e, t) {
2344
2842
  let n = [];
2345
2843
  return e.forEach((e, r, i) => {
2346
2844
  i !== t && n.push(e);
2347
2845
  }), F.from(n);
2348
2846
  }
2349
- function Yr(e, t) {
2847
+ function Di(e, t) {
2350
2848
  let n = [];
2351
2849
  for (let r = 0; r < e.childCount; r++) if (e.child(r).type.name === "tableRow") if (n.length > 0 && n[n.length - 1].type.name === "table") {
2352
2850
  let t = n[n.length - 1], i = t.copy(t.content.addToEnd(e.child(r)));
@@ -2358,32 +2856,44 @@ function Yr(e, t) {
2358
2856
  else n.push(e.child(r));
2359
2857
  return e = F.from(n), e;
2360
2858
  }
2361
- function Xr(e, t) {
2859
+ function Oi(e, t) {
2362
2860
  let n = F.from(e.content);
2363
- if (n = Yr(n, t.state.schema), Kr(t)) {
2861
+ n = Di(n, t.state.schema);
2862
+ let r = ki(n, t, e);
2863
+ if (r) return r;
2864
+ if (wi(t)) {
2364
2865
  let e = !1;
2365
2866
  if (n.descendants((t) => {
2366
2867
  t.type.isInGroup("tableContent") && (e = !0);
2367
- }), !e && !t.state.schema.nodes.tableParagraph.validContent(n)) return new I(qr(n, t.state.schema), 0, 0);
2868
+ }), !e && !t.state.schema.nodes.tableParagraph.validContent(n)) return new I(Ti(n, t.state.schema), 0, 0);
2368
2869
  }
2369
- if (!Zr(n, t)) return new I(n, e.openStart, e.openEnd);
2870
+ if (!Ai(n, t)) return new I(n, e.openStart, e.openEnd);
2370
2871
  for (let e = 0; e < n.childCount; e++) if (n.child(e).type.spec.group === "blockContent") {
2371
2872
  let r = [n.child(e)];
2372
2873
  if (e + 1 < n.childCount && n.child(e + 1).type.name === "blockGroup") {
2373
2874
  let t = n.child(e + 1).child(0).child(0);
2374
- (t.type.name === "bulletListItem" || t.type.name === "numberedListItem" || t.type.name === "checkListItem") && (r.push(n.child(e + 1)), n = Jr(n, e + 1));
2875
+ (t.type.name === "bulletListItem" || t.type.name === "numberedListItem" || t.type.name === "checkListItem") && (r.push(n.child(e + 1)), n = Ei(n, e + 1));
2375
2876
  }
2376
2877
  let i = t.state.schema.nodes.blockContainer.createChecked(void 0, r);
2377
2878
  n = n.replaceChild(e, i);
2378
2879
  }
2379
2880
  return new I(n, e.openStart, e.openEnd);
2380
2881
  }
2381
- function Zr(e, t) {
2882
+ function ki(e, t, n) {
2883
+ if (wi(t) || t.dragging) return null;
2884
+ let r = _(t.state), i = r.isBlockContainer ? r.blockContent.node : null;
2885
+ if (!i || i.type.name === "paragraph" || i.type.spec.content !== "inline*" || i.childCount > 0) return null;
2886
+ let a = e.firstChild, o = a?.firstChild, s = o?.firstChild;
2887
+ if (a?.type.name !== "blockGroup" || o?.type.name !== "blockContainer" || s?.type.name !== "paragraph") return null;
2888
+ let c = i.type.create(i.attrs, s.content), l = o.copy(o.content.replaceChild(0, c)), u = a.copy(a.content.replaceChild(0, l));
2889
+ return new I(e.replaceChild(0, u), n.openStart, n.openEnd);
2890
+ }
2891
+ function Ai(e, t) {
2382
2892
  let n = e.childCount === 1, r = e.firstChild?.type.spec.content === "inline*", i = e.firstChild?.type.spec.content === "tableRow+";
2383
2893
  if (n) {
2384
2894
  if (r) return !1;
2385
2895
  if (i) {
2386
- let e = v(t.state);
2896
+ let e = _(t.state);
2387
2897
  if (e.isBlockContainer) return e.blockContent.node.type.spec.content !== "tableRow+";
2388
2898
  }
2389
2899
  }
@@ -2391,11 +2901,11 @@ function Zr(e, t) {
2391
2901
  }
2392
2902
  //#endregion
2393
2903
  //#region src/editor/BlockNoteEditor.ts
2394
- var Qr = {
2904
+ var ji = {
2395
2905
  enableInputRules: !0,
2396
2906
  enablePasteRules: !0,
2397
2907
  enableCoreExtensions: !1
2398
- }, $r = class e extends Ie {
2908
+ }, Mi = class e extends Fe {
2399
2909
  pmSchema;
2400
2910
  _tiptapEditor;
2401
2911
  elementRenderer = null;
@@ -2414,7 +2924,7 @@ var Qr = {
2414
2924
  return new e(t ?? {});
2415
2925
  }
2416
2926
  constructor(e) {
2417
- super(), this.options = e, this.dictionary = e.dictionary || Fe, this.settings = { tables: {
2927
+ super(), this.options = e, this.dictionary = e.dictionary || Pe, this.settings = { tables: {
2418
2928
  splitCells: e?.tables?.splitCells ?? !1,
2419
2929
  cellBackgroundColor: e?.tables?.cellBackgroundColor ?? !1,
2420
2930
  cellTextColor: e?.tables?.cellTextColor ?? !1,
@@ -2440,11 +2950,11 @@ var Qr = {
2440
2950
  }
2441
2951
  };
2442
2952
  }
2443
- this.resolveFileUrl = t.resolveFileUrl, this._eventManager = new Qt(this), this._extensionManager = new Fr(this, t);
2953
+ this.resolveFileUrl = t.resolveFileUrl, this._eventManager = new Jt(this), this._extensionManager = new hi(this, t);
2444
2954
  let n = this._extensionManager.getTiptapExtensions(), r = this._extensionManager.hasExtension("ySync") || this._extensionManager.hasExtension("liveblocksExtension");
2445
2955
  r && t.initialContent && console.warn("When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider");
2446
2956
  let i = {
2447
- ...Qr,
2957
+ ...ji,
2448
2958
  ...t._tiptapOptions,
2449
2959
  element: null,
2450
2960
  autofocus: t.autofocus ?? !1,
@@ -2457,7 +2967,7 @@ var Qr = {
2457
2967
  ...t.domAttributes?.editor,
2458
2968
  class: s("bn-editor", t.defaultStyles ? "bn-default-styles" : "", t.domAttributes?.editor?.class || "")
2459
2969
  },
2460
- transformPasted: Xr
2970
+ transformPasted: Oi
2461
2971
  }
2462
2972
  };
2463
2973
  try {
@@ -2466,33 +2976,33 @@ var Qr = {
2466
2976
  id: "initialBlockId"
2467
2977
  }] : [{
2468
2978
  type: "paragraph",
2469
- id: o.options.generateID()
2979
+ id: u.options.generateID()
2470
2980
  }]);
2471
2981
  if (!Array.isArray(e) || e.length === 0) throw Error("initialContent must be a non-empty array of blocks, received: " + e);
2472
- let n = $e(i.extensions), a = Ke({
2982
+ let n = Qe(i.extensions), a = Ge({
2473
2983
  type: "doc",
2474
2984
  content: [{
2475
2985
  type: "blockGroup",
2476
- content: e.map((e) => c(e, n, this.schema.styleSchema).toJSON())
2986
+ content: e.map((e) => y(e, n, this.schema.styleSchema).toJSON())
2477
2987
  }]
2478
2988
  }, n, i.parseOptions);
2479
- this._tiptapEditor = new We({
2989
+ this._tiptapEditor = new Ue({
2480
2990
  ...i,
2481
2991
  content: a.toJSON()
2482
2992
  }), this.pmSchema = this._tiptapEditor.schema;
2483
2993
  } catch (e) {
2484
2994
  throw Error("Error creating document from blocks passed as `initialContent`", { cause: e });
2485
2995
  }
2486
- let a, l = this.pmSchema.nodes.doc.createAndFill;
2996
+ let a, o = this.pmSchema.nodes.doc.createAndFill;
2487
2997
  this.pmSchema.nodes.doc.createAndFill = (...e) => {
2488
2998
  if (a) return a;
2489
- let t = l.apply(this.pmSchema.nodes.doc, e), n = JSON.parse(JSON.stringify(t.toJSON()));
2490
- return n.content[0].content[0].attrs.id = "initialBlockId", a = ze.fromJSON(this.pmSchema, n), a;
2999
+ let t = o.apply(this.pmSchema.nodes.doc, e), n = JSON.parse(JSON.stringify(t.toJSON()));
3000
+ return n.content[0].content[0].attrs.id = "initialBlockId", a = Re.fromJSON(this.pmSchema, n), a;
2491
3001
  }, this.pmSchema.cached.blockNoteEditor = this, this._tiptapEditor.on("mount", () => {
2492
3002
  this.headless = !1;
2493
3003
  }), this._tiptapEditor.on("unmount", () => {
2494
3004
  this.headless = !0;
2495
- }), this._blockManager = new Zt(this), this._exportManager = new mn(this), this._selectionManager = new Hr(this), this._stateManager = new Ur(this), this._styleManager = new Gr(this), this.emit("create");
3005
+ }), this._blockManager = new qt(this), this._exportManager = new Vn(this), this._selectionManager = new bi(this), this._stateManager = new xi(this), this._styleManager = new Ci(this), this.emit("create");
2496
3006
  }
2497
3007
  _blockManager;
2498
3008
  _eventManager;
@@ -2516,9 +3026,9 @@ var Qr = {
2516
3026
  unregisterExtension = (...e) => this._extensionManager.unregisterExtension(...e);
2517
3027
  registerExtension = (...e) => this._extensionManager.registerExtension(...e);
2518
3028
  getExtension = ((...e) => this._extensionManager.getExtension(...e));
2519
- mount = (e) => {
2520
- let t = e.getRootNode();
2521
- typeof ShadowRoot < "u" && t instanceof ShadowRoot ? t.appendChild(this.portalElement) : document.body.appendChild(this.portalElement), this._tiptapEditor.mount({ mount: e });
3029
+ mount = (e, t) => {
3030
+ let n = e.getRootNode(), r = typeof ShadowRoot < "u" && n instanceof ShadowRoot;
3031
+ (t?.portalTarget ?? e.parentElement ?? (r ? n : document.body)).appendChild(this.portalElement), this._tiptapEditor.mount({ mount: e });
2522
3032
  };
2523
3033
  unmount = () => {
2524
3034
  this.portalElement?.remove(), this._tiptapEditor.unmount();
@@ -2674,11 +3184,11 @@ var Qr = {
2674
3184
  unnestBlock() {
2675
3185
  this._blockManager.unnestBlock();
2676
3186
  }
2677
- moveBlocksUp() {
2678
- return this._blockManager.moveBlocksUp();
3187
+ moveBlocksUp(e) {
3188
+ return this._blockManager.moveBlocksUp(e);
2679
3189
  }
2680
- moveBlocksDown() {
2681
- return this._blockManager.moveBlocksDown();
3190
+ moveBlocksDown(e) {
3191
+ return this._blockManager.moveBlocksDown(e);
2682
3192
  }
2683
3193
  blocksToHTMLLossy(e = this.document) {
2684
3194
  return this._exportManager.blocksToHTMLLossy(e);
@@ -2723,7 +3233,7 @@ var Qr = {
2723
3233
  pasteMarkdown(e) {
2724
3234
  return this._exportManager.pasteMarkdown(e);
2725
3235
  }
2726
- }, ei = class {
3236
+ }, Ni = class {
2727
3237
  constructor(e, t, n) {
2728
3238
  this.mappings = t, this.options = n;
2729
3239
  }
@@ -2747,7 +3257,7 @@ var Qr = {
2747
3257
  };
2748
3258
  //#endregion
2749
3259
  //#region src/exporter/mapping.ts
2750
- function ti(e) {
3260
+ function Pi(e) {
2751
3261
  return {
2752
3262
  createBlockMapping: (e) => e,
2753
3263
  createInlineContentMapping: (e) => e,
@@ -2756,7 +3266,7 @@ function ti(e) {
2756
3266
  }
2757
3267
  //#endregion
2758
3268
  //#region src/util/combineByGroup.ts
2759
- function ni(e, ...t) {
3269
+ function Fi(e, ...t) {
2760
3270
  let n = [...e];
2761
3271
  for (let e of t) for (let t of e) {
2762
3272
  let e = n.findLastIndex((e) => e.group === t.group);
@@ -2765,6 +3275,6 @@ function ni(e, ...t) {
2765
3275
  return n;
2766
3276
  }
2767
3277
  //#endregion
2768
- export { R as _, Ir as a, yt as b, W as c, Yt as d, Xt as f, z as g, B as h, $r as i, U as l, Mt as m, ti as n, dr as o, Jt as p, ei as r, pn as s, ni as t, qt as u, xt as v, vt as x, bt as y };
3278
+ export { L as _, gi as a, mt as b, zn as c, Gt as d, Kt as f, R as g, z as h, Mi as i, H as l, Dt as m, Pi as n, Gr as o, Wt as p, Ni as r, Bn as s, Fi as t, Ut as u, gt as v, pt as x, ht as y };
2769
3279
 
2770
- //# sourceMappingURL=src-DQfz4zLM.js.map
3280
+ //# sourceMappingURL=src-DK_8q1j5.js.map