@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,42 +1,35 @@
1
- import { At as e, Bt as t, Dt as n, Et as r, Ft as i, It as a, Lt as o, Mt as s, Nt as c, Pt as l, Rn as u, Rt as d, an as f, dn as p, g as m, h, ht as g, in as _, jt as ee, kt as v, r as te, zt as ne } from "./blocks-CSfJen16.js";
2
- import { n as y, t as b } from "./BlockNoteExtension-B6RhuQ3V.js";
3
- import { DOMSerializer as x, Fragment as S, Slice as re } from "prosemirror-model";
4
- import { dropPoint as ie } from "prosemirror-transform";
5
- import { combineTransactionSteps as ae, findChildrenInRange as C, posToDOMRect as oe } from "@tiptap/core";
6
- import { NodeSelection as se, Plugin as w, PluginKey as T, Selection as E, TextSelection as ce } from "prosemirror-state";
7
- import { uuidv4 as le } from "lib0/random";
8
- import { DOMParser as ue, Slice as de } from "@tiptap/pm/model";
9
- import { CellSelection as fe, addColumnAfter as pe, addColumnBefore as me, addRowAfter as he, addRowBefore as ge, deleteColumn as _e, deleteRow as ve, mergeCells as ye, splitCell as be } from "prosemirror-tables";
10
- import { Plugin as D, PluginKey as O, TextSelection as xe } from "@tiptap/pm/state";
11
- import { Decoration as k, DecorationSet as A } from "prosemirror-view";
12
- import { defaultSelectionBuilder as Se, redoCommand as Ce, undoCommand as we, yCursorPlugin as Te, ySyncPlugin as Ee, yUndoPlugin as De, yUndoPluginKey as j } from "y-prosemirror";
13
- import Oe from "fast-deep-equal";
14
- import * as M from "yjs";
15
- import { history as ke, redo as Ae, undo as je } from "@tiptap/pm/history";
16
- import Me from "rehype-parse";
17
- import Ne from "rehype-remark";
18
- import Pe from "remark-gfm";
19
- import Fe from "remark-stringify";
20
- import { unified as Ie } from "unified";
21
- import { fromDom as Le } from "hast-util-from-dom";
22
- import { visit as Re } from "unist-util-visit";
1
+ import { At as e, Bt as t, Dt as n, Ft as r, It as i, Lt as a, Mt as o, Nt as s, Ot as c, Pt as l, Rt as u, Vt as d, _ as f, an as p, fn as m, g as h, gt as g, jt as ee, on as te, r as ne, zn as re, zt as ie } from "./blocks-D0lMxErU.js";
2
+ import { n as _, t as v } from "./BlockNoteExtension-B6RhuQ3V.js";
3
+ import { DOMSerializer as ae, Fragment as y, Slice as oe } from "prosemirror-model";
4
+ import { dropPoint as se } from "prosemirror-transform";
5
+ import { combineTransactionSteps as ce, findChildrenInRange as le, posToDOMRect as ue } from "@tiptap/core";
6
+ import { NodeSelection as de, Plugin as b, PluginKey as x, Selection as S, TextSelection as fe } from "prosemirror-state";
7
+ import { uuidv4 as pe } from "lib0/random";
8
+ import { DOMParser as me, Slice as he } from "@tiptap/pm/model";
9
+ import { CellSelection as ge, addColumnAfter as _e, addColumnBefore as ve, addRowAfter as ye, addRowBefore as be, deleteColumn as xe, deleteRow as Se, mergeCells as Ce, splitCell as we } from "prosemirror-tables";
10
+ import { Plugin as C, PluginKey as Te, TextSelection as Ee } from "@tiptap/pm/state";
11
+ import { Decoration as w, DecorationSet as T } from "prosemirror-view";
12
+ import { defaultSelectionBuilder as De, redoCommand as Oe, undoCommand as ke, yCursorPlugin as Ae, ySyncPlugin as je, yUndoPlugin as Me, yUndoPluginKey as E } from "y-prosemirror";
13
+ import Ne from "fast-deep-equal";
14
+ import * as D from "yjs";
15
+ import { history as Pe, redo as Fe, undo as Ie } from "@tiptap/pm/history";
23
16
  //#region src/api/exporters/html/util/serializeBlocksExternalHTML.ts
24
- function N(e) {
17
+ function Le(e) {
25
18
  let t = Array.from(e.classList).filter((e) => !e.startsWith("bn-")) || [];
26
19
  t.length > 0 ? e.className = t.join(" ") : e.removeAttribute("class");
27
20
  }
28
- function P(t, n, r, i) {
21
+ function Re(t, n, r, i) {
29
22
  let a;
30
23
  if (!n) throw Error("blockContent is required");
31
- if (typeof n == "string") a = v([n], t.pmSchema);
32
- else if (Array.isArray(n)) a = v(n, t.pmSchema);
33
- else if (n.type === "tableContent") a = e(n, t.pmSchema);
34
- else throw new u(n.type);
24
+ if (typeof n == "string") a = e([n], t.pmSchema);
25
+ else if (Array.isArray(n)) a = e(n, t.pmSchema);
26
+ else if (n.type === "tableContent") a = ee(n, t.pmSchema);
27
+ else throw new re(n.type);
35
28
  let o = (i?.document ?? document).createDocumentFragment();
36
29
  for (let e of a) if (e.type.name !== "text" && t.schema.inlineContentSchema[e.type.name]) {
37
30
  let n = t.schema.inlineContentSpecs[e.type.name].implementation;
38
31
  if (n) {
39
- let a = f(e, t.schema.inlineContentSchema, t.schema.styleSchema), s = n.toExternalHTML ? n.toExternalHTML(a, t) : n.render.call({
32
+ let a = te(e, t.schema.inlineContentSchema, t.schema.styleSchema), s = n.toExternalHTML ? n.toExternalHTML(a, t) : n.render.call({
40
33
  renderType: "dom",
41
34
  props: void 0
42
35
  }, a, () => {}, t);
@@ -54,15 +47,15 @@ function P(t, n, r, i) {
54
47
  let e = (t.schema.styleSpecs[r.type.name].implementation.toExternalHTML ?? t.schema.styleSpecs[r.type.name].implementation.render)(r.attrs.stringValue, t);
55
48
  e.contentDOM.appendChild(n), n = e.dom;
56
49
  } else {
57
- let e = r.type.spec.toDOM(r, !0), t = x.renderSpec(document, e);
50
+ let e = r.type.spec.toDOM(r, !0), t = ae.renderSpec(document, e);
58
51
  t.contentDOM.appendChild(n), n = t.dom;
59
52
  }
60
53
  o.appendChild(n);
61
54
  } else {
62
- let t = r.serializeFragment(S.from([e]), i);
55
+ let t = r.serializeFragment(y.from([e]), i);
63
56
  o.appendChild(t);
64
57
  }
65
- return o.childNodes.length === 1 && o.firstChild?.nodeType === 1 && N(o.firstChild), o;
58
+ return o.childNodes.length === 1 && o.firstChild?.nodeType === 1 && Le(o.firstChild), o;
66
59
  }
67
60
  function ze(e, t, n, r, i, a, o, s) {
68
61
  let c = s?.document ?? document, l = t.pmSchema.nodes.blockContainer, u = n.props || {};
@@ -80,10 +73,10 @@ function ze(e, t, n, r, i, a, o, s) {
80
73
  if (m.dom.classList.contains("bn-block-content")) {
81
74
  let e = [...f, ...Array.from(m.dom.attributes)].filter((e) => e.name.startsWith("data") && e.name !== "data-content-type" && e.name !== "data-file-block" && e.name !== "data-node-view-wrapper" && e.name !== "data-node-type" && e.name !== "data-id" && e.name !== "data-editable");
82
75
  for (let t of e) m.dom.firstChild.setAttribute(t.name, t.value);
83
- N(m.dom.firstChild), o > 0 && m.dom.firstChild.setAttribute("data-nesting-level", o.toString()), h.append(...Array.from(m.dom.childNodes));
76
+ Le(m.dom.firstChild), o > 0 && m.dom.firstChild.setAttribute("data-nesting-level", o.toString()), h.append(...Array.from(m.dom.childNodes));
84
77
  } else h.append(m.dom), o > 0 && m.dom.setAttribute("data-nesting-level", o.toString());
85
78
  if (m.contentDOM && n.content) {
86
- let e = P(t, n.content, r, s);
79
+ let e = Re(t, n.content, r, s);
87
80
  m.contentDOM.appendChild(e);
88
81
  }
89
82
  let g;
@@ -96,20 +89,20 @@ function ze(e, t, n, r, i, a, o, s) {
96
89
  } else e.append(h);
97
90
  if (n.children && n.children.length > 0) {
98
91
  let l = c.createDocumentFragment();
99
- if (F(l, t, n.children, r, i, a, o + 1, s), e.lastChild?.nodeName === "UL" || e.lastChild?.nodeName === "OL") for (; l.firstChild?.nodeName === "UL" || l.firstChild?.nodeName === "OL";) e.lastChild.lastChild.appendChild(l.firstChild);
92
+ if (Be(l, t, n.children, r, i, a, o + 1, s), e.lastChild?.nodeName === "UL" || e.lastChild?.nodeName === "OL") for (; l.firstChild?.nodeName === "UL" || l.firstChild?.nodeName === "OL";) e.lastChild.lastChild.appendChild(l.firstChild);
100
93
  "childrenDOM" in m && m.childrenDOM ? m.childrenDOM.append(l) : t.pmSchema.nodes[n.type].isInGroup("blockContent") ? e.append(l) : m.contentDOM?.append(l);
101
94
  }
102
95
  }
103
- var F = (e, t, n, r, i, a, o = 0, s) => {
96
+ var Be = (e, t, n, r, i, a, o = 0, s) => {
104
97
  for (let c of n) ze(e, t, c, r, i, a, o, s);
105
- }, Be = (e, t, n, r, i, a) => {
98
+ }, Ve = (e, t, n, r, i, a) => {
106
99
  let o = (a?.document ?? document).createDocumentFragment();
107
- return F(o, e, t, n, r, i, 0, a), o;
108
- }, I = (e, t) => {
109
- let n = x.fromSchema(e);
100
+ return Be(o, e, t, n, r, i, 0, a), o;
101
+ }, O = (e, t) => {
102
+ let n = ae.fromSchema(e);
110
103
  return {
111
104
  exportBlocks: (e, r) => {
112
- let i = Be(t, e, n, new Set(["numberedListItem"]), new Set([
105
+ let i = Ve(t, e, n, new Set(["numberedListItem"]), new Set([
113
106
  "bulletListItem",
114
107
  "checkListItem",
115
108
  "toggleListItem"
@@ -117,41 +110,41 @@ var F = (e, t, n, r, i, a, o = 0, s) => {
117
110
  return a.append(i), a.innerHTML;
118
111
  },
119
112
  exportInlineContent: (e, r) => {
120
- let i = P(t, e, n, r), a = document.createElement("div");
113
+ let i = Re(t, e, n, r), a = document.createElement("div");
121
114
  return a.append(i.cloneNode(!0)), a.innerHTML;
122
115
  }
123
116
  };
124
117
  };
125
118
  //#endregion
126
119
  //#region src/api/getBlocksChangedByTransaction.ts
127
- function Ve(e, t) {
120
+ function He(e, t) {
128
121
  if (t === 0) return;
129
- let r = e.resolve(t);
130
- for (let e = r.depth; e > 0; e--) {
131
- let t = r.node(e);
132
- if (n(t)) return t.attrs.id;
122
+ let n = e.resolve(t);
123
+ for (let e = n.depth; e > 0; e--) {
124
+ let t = n.node(e);
125
+ if (c(t)) return t.attrs.id;
133
126
  }
134
127
  }
135
- function He(e) {
128
+ function Ue(e) {
136
129
  return e.getMeta("paste") ? { type: "paste" } : e.getMeta("uiEvent") === "drop" ? { type: "drop" } : e.getMeta("history$") ? { type: e.getMeta("history$").redo ? "redo" : "undo" } : e.getMeta("y-sync$") ? e.getMeta("y-sync$").isUndoRedoOperation ? { type: "undo-redo" } : { type: "yjs-remote" } : { type: "local" };
137
130
  }
138
- function L(e) {
139
- let t = {}, r = {}, i = p(e);
140
- return e.descendants((a, o) => {
141
- if (!n(a)) return !0;
142
- let s = Ve(e, o), c = s ?? "__root__";
143
- r[c] || (r[c] = []);
144
- let l = _(a, i);
145
- return t[a.attrs.id] = {
131
+ function We(e) {
132
+ let t = {}, n = {}, r = m(e);
133
+ return e.descendants((i, a) => {
134
+ if (!c(i)) return !0;
135
+ let o = He(e, a), s = o ?? "__root__";
136
+ n[s] || (n[s] = []);
137
+ let l = p(i, r);
138
+ return t[i.attrs.id] = {
146
139
  block: l,
147
- parentId: s
148
- }, r[c].push(a.attrs.id), !0;
140
+ parentId: o
141
+ }, n[s].push(i.attrs.id), !0;
149
142
  }), {
150
143
  byId: t,
151
- childrenByParent: r
144
+ childrenByParent: n
152
145
  };
153
146
  }
154
- function Ue(e, t) {
147
+ function Ge(e, t) {
155
148
  let n = /* @__PURE__ */ new Set();
156
149
  if (!e || !t) return n;
157
150
  let r = new Set(e), i = t.filter((e) => r.has(e)), a = e.filter((e) => i.includes(e));
@@ -175,8 +168,8 @@ function Ue(e, t) {
175
168
  for (let e = 0; e < i.length; e++) p.has(e) || n.add(i[e]);
176
169
  return n;
177
170
  }
178
- function R(e, t = []) {
179
- let n = He(e), r = ae(e.before, [e, ...t]), i = L(r.before), a = L(r.doc), o = [], s = /* @__PURE__ */ new Set();
171
+ function Ke(e, t = []) {
172
+ let n = Ue(e), r = ce(e.before, [e, ...t]), i = We(r.before), a = We(r.doc), o = [], s = /* @__PURE__ */ new Set();
180
173
  Object.keys(a.byId).filter((e) => !(e in i.byId)).forEach((e) => {
181
174
  o.push({
182
175
  type: "insert",
@@ -193,7 +186,7 @@ function R(e, t = []) {
193
186
  }), s.add(e);
194
187
  }), Object.keys(a.byId).filter((e) => e in i.byId).forEach((e) => {
195
188
  let t = i.byId[e], r = a.byId[e];
196
- t.parentId === r.parentId ? Oe({
189
+ t.parentId === r.parentId ? Ne({
197
190
  ...t.block,
198
191
  children: void 0
199
192
  }, {
@@ -215,7 +208,7 @@ function R(e, t = []) {
215
208
  });
216
209
  let c = i.childrenByParent, l = a.childrenByParent, u = new Set([...Object.keys(c), ...Object.keys(l)]), d = /* @__PURE__ */ new Set();
217
210
  return u.forEach((e) => {
218
- let t = Ue(c[e], l[e]);
211
+ let t = Ge(c[e], l[e]);
219
212
  t.size !== 0 && t.forEach((t) => {
220
213
  let r = i.byId[t], c = a.byId[t];
221
214
  !r || !c || r.parentId === c.parentId && (s.has(t) || (r.parentId ?? "__root__") === e && (d.has(t) || (d.add(t), o.push({
@@ -231,17 +224,17 @@ function R(e, t = []) {
231
224
  }
232
225
  //#endregion
233
226
  //#region src/extensions/BlockChange/BlockChange.ts
234
- var We = b(() => {
227
+ var qe = v(() => {
235
228
  let e = [];
236
229
  return {
237
230
  key: "blockChange",
238
- prosemirrorPlugins: [new w({
239
- key: new T("blockChange"),
231
+ prosemirrorPlugins: [new b({
232
+ key: new x("blockChange"),
240
233
  filterTransaction: (t) => {
241
234
  let n;
242
235
  return e.reduce((e, r) => e === !1 ? e : r({
243
236
  getChanges() {
244
- return n || (n = R(t), n);
237
+ return n || (n = Ke(t), n);
245
238
  },
246
239
  tr: t
247
240
  }) !== !1, !0);
@@ -256,7 +249,7 @@ var We = b(() => {
256
249
  });
257
250
  //#endregion
258
251
  //#region src/extensions/Collaboration/YCursorPlugin.ts
259
- function z(e) {
252
+ function Je(e) {
260
253
  let t = e.charAt(0) === "#" ? e.substring(1, 7) : e, n = parseInt(t.substring(0, 2), 16), r = parseInt(t.substring(2, 4), 16), i = parseInt(t.substring(4, 6), 16), a = [
261
254
  n / 255,
262
255
  r / 255,
@@ -264,15 +257,15 @@ function z(e) {
264
257
  ].map((e) => e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4);
265
258
  return .2126 * a[0] + .7152 * a[1] + .0722 * a[2] <= .179;
266
259
  }
267
- function Ge(e) {
260
+ function Ye(e) {
268
261
  let t = document.createElement("span");
269
262
  t.classList.add("bn-collaboration-cursor__base");
270
263
  let n = document.createElement("span");
271
- n.setAttribute("contentedEditable", "false"), n.classList.add("bn-collaboration-cursor__caret"), n.setAttribute("style", `background-color: ${e.color}; color: ${z(e.color) ? "white" : "black"}`);
264
+ n.setAttribute("contentedEditable", "false"), n.classList.add("bn-collaboration-cursor__caret"), n.setAttribute("style", `background-color: ${e.color}; color: ${Je(e.color) ? "white" : "black"}`);
272
265
  let r = document.createElement("span");
273
- return r.classList.add("bn-collaboration-cursor__label"), r.setAttribute("style", `background-color: ${e.color}; color: ${z(e.color) ? "white" : "black"}`), r.insertBefore(document.createTextNode(e.name), null), n.insertBefore(r, null), t.insertBefore(document.createTextNode("⁠"), null), t.insertBefore(n, null), t.insertBefore(document.createTextNode("⁠"), null), t;
266
+ return r.classList.add("bn-collaboration-cursor__label"), r.setAttribute("style", `background-color: ${e.color}; color: ${Je(e.color) ? "white" : "black"}`), r.insertBefore(document.createTextNode(e.name), null), n.insertBefore(r, null), t.insertBefore(document.createTextNode("⁠"), null), t.insertBefore(n, null), t.insertBefore(document.createTextNode("⁠"), null), t;
274
267
  }
275
- var B = b(({ options: e }) => {
268
+ var k = v(({ options: e }) => {
276
269
  let t = /* @__PURE__ */ new Map(), n = e.provider && "awareness" in e.provider && typeof e.provider.awareness == "object" ? e.provider.awareness : void 0;
277
270
  return n && ("setLocalStateField" in n && typeof n.setLocalStateField == "function" && n.setLocalStateField("user", e.user), "on" in n && typeof n.on == "function" && e.showCursorLabels !== "always" && n.on("change", ({ updated: e }) => {
278
271
  for (let n of e) {
@@ -288,12 +281,12 @@ var B = b(({ options: e }) => {
288
281
  }
289
282
  })), {
290
283
  key: "yCursor",
291
- prosemirrorPlugins: [n ? Te(n, {
292
- selectionBuilder: Se,
284
+ prosemirrorPlugins: [n ? Ae(n, {
285
+ selectionBuilder: De,
293
286
  cursorBuilder(n, r) {
294
287
  let i = t.get(r);
295
288
  if (!i) {
296
- let a = (e.renderCursor ?? Ge)(n);
289
+ let a = (e.renderCursor ?? Ye)(n);
297
290
  e.showCursorLabels !== "always" && (a.addEventListener("mouseenter", () => {
298
291
  let e = t.get(r);
299
292
  e.element.setAttribute("data-active", ""), e.hideTimeout && (clearTimeout(e.hideTimeout), t.set(r, {
@@ -321,20 +314,20 @@ var B = b(({ options: e }) => {
321
314
  n?.setLocalStateField("user", e);
322
315
  }
323
316
  };
324
- }), V = b(({ options: e }) => ({
317
+ }), A = v(({ options: e }) => ({
325
318
  key: "ySync",
326
- prosemirrorPlugins: [Ee(e.fragment)],
319
+ prosemirrorPlugins: [je(e.fragment)],
327
320
  runsBefore: ["default"]
328
- })), H = b(() => ({
321
+ })), j = v(() => ({
329
322
  key: "yUndo",
330
- prosemirrorPlugins: [De()],
323
+ prosemirrorPlugins: [Me()],
331
324
  dependsOn: ["yCursor", "ySync"],
332
- undoCommand: we,
333
- redoCommand: Ce
325
+ undoCommand: ke,
326
+ redoCommand: Oe
334
327
  }));
335
328
  //#endregion
336
329
  //#region src/extensions/Collaboration/ForkYDoc.ts
337
- function Ke(e, t) {
330
+ function Xe(e, t) {
338
331
  let n = e.doc;
339
332
  if (e._item === null) {
340
333
  let r = Array.from(n.share.keys()).find((t) => n.share.get(t) === e);
@@ -342,11 +335,11 @@ function Ke(e, t) {
342
335
  return t.get(r, e.constructor);
343
336
  } else {
344
337
  let n = e._item, r = t.store.clients.get(n.id.client) ?? [];
345
- return r[M.findIndexSS(r, n.id.clock)].content.type;
338
+ return r[D.findIndexSS(r, n.id.clock)].content.type;
346
339
  }
347
340
  }
348
- var qe = b(({ editor: e, options: t }) => {
349
- let n, r = y({ isForked: !1 });
341
+ var Ze = v(({ editor: e, options: t }) => {
342
+ let n, r = _({ isForked: !1 });
350
343
  return {
351
344
  key: "yForkDoc",
352
345
  store: r,
@@ -354,23 +347,23 @@ var qe = b(({ editor: e, options: t }) => {
354
347
  if (n) return;
355
348
  let i = t.fragment;
356
349
  if (!i) throw Error("No fragment to fork from");
357
- let a = new M.Doc();
358
- M.applyUpdate(a, M.encodeStateAsUpdate(i.doc));
359
- let o = Ke(i, a);
350
+ let a = new D.Doc();
351
+ D.applyUpdate(a, D.encodeStateAsUpdate(i.doc));
352
+ let o = Xe(i, a);
360
353
  n = {
361
- undoStack: j.getState(e.prosemirrorState).undoManager.undoStack,
354
+ undoStack: E.getState(e.prosemirrorState).undoManager.undoStack,
362
355
  originalFragment: i,
363
356
  forkedFragment: o
364
357
  }, e.unregisterExtension([
365
- H,
366
- B,
367
- V
358
+ j,
359
+ k,
360
+ A
368
361
  ]);
369
362
  let s = {
370
363
  ...t,
371
364
  fragment: o
372
365
  };
373
- e.registerExtension([V(s), H()]), r.setState({ isForked: !0 });
366
+ e.registerExtension([A(s), j()]), r.setState({ isForked: !0 });
374
367
  },
375
368
  merge({ keepChanges: i }) {
376
369
  if (!n) return;
@@ -381,24 +374,24 @@ var qe = b(({ editor: e, options: t }) => {
381
374
  ]);
382
375
  let { originalFragment: a, forkedFragment: o, undoStack: s } = n;
383
376
  if (e.registerExtension([
384
- V(t),
385
- B(t),
386
- H()
387
- ]), j.getState(e.prosemirrorState).undoManager.undoStack = s, i) {
388
- let t = M.encodeStateAsUpdate(o.doc, M.encodeStateVector(a.doc));
389
- M.applyUpdate(a.doc, t, e);
377
+ A(t),
378
+ k(t),
379
+ j()
380
+ ]), E.getState(e.prosemirrorState).undoManager.undoStack = s, i) {
381
+ let t = D.encodeStateAsUpdate(o.doc, D.encodeStateVector(a.doc));
382
+ D.applyUpdate(a.doc, t, e);
390
383
  }
391
384
  n = void 0, r.setState({ isForked: !1 });
392
385
  }
393
386
  };
394
- }), U = (e, t) => {
387
+ }), M = (e, t) => {
395
388
  t(e), e.forEach((e) => {
396
- e instanceof M.XmlElement && U(e, t);
389
+ e instanceof D.XmlElement && M(e, t);
397
390
  });
398
- }, Je = [(e, t) => {
391
+ }, Qe = [(e, t) => {
399
392
  let n = /* @__PURE__ */ new Map();
400
393
  return e.forEach((e) => {
401
- e instanceof M.XmlElement && U(e, (e) => {
394
+ e instanceof D.XmlElement && M(e, (e) => {
402
395
  if (e.nodeName === "blockContainer" && e.hasAttribute("id")) {
403
396
  let t = e.getAttribute("textColor"), r = e.getAttribute("backgroundColor"), i = {
404
397
  textColor: t === g.textColor.default ? void 0 : t,
@@ -417,16 +410,16 @@ var qe = b(({ editor: e, options: t }) => {
417
410
  });
418
411
  }
419
412
  }), !0);
420
- }], Ye = b(({ options: e }) => {
413
+ }], $e = v(({ options: e }) => {
421
414
  let t = !1;
422
415
  return {
423
416
  key: "schemaMigration",
424
- prosemirrorPlugins: [new D({
425
- key: new O("schemaMigration"),
417
+ prosemirrorPlugins: [new C({
418
+ key: new Te("schemaMigration"),
426
419
  appendTransaction: (n, r, i) => {
427
420
  if (t || !n.some((e) => e.getMeta("y-sync$")) || n.every((e) => !e.docChanged) || !e.fragment.firstChild) return;
428
421
  let a = i.tr;
429
- for (let t of Je) t(e.fragment, a);
422
+ for (let t of Qe) t(e.fragment, a);
430
423
  if (t = !0, a.docChanged) return a;
431
424
  }
432
425
  })]
@@ -434,10 +427,10 @@ var qe = b(({ editor: e, options: t }) => {
434
427
  });
435
428
  //#endregion
436
429
  //#region src/extensions/DropCursor/utils.ts
437
- function W(e, t) {
430
+ function et(e, t) {
438
431
  return !e || !t ? !1 : !!e.closest(`.${t}`);
439
432
  }
440
- function Xe(e, t, n, r, i) {
433
+ function tt(e, t, n, r, i) {
441
434
  let a = e.state.doc.resolve(t.pos);
442
435
  if (a.parent.inlineContent || t.orientation === "inline") return null;
443
436
  let o = a.nodeBefore, s = a.nodeAfter;
@@ -464,7 +457,7 @@ function Xe(e, t, n, r, i) {
464
457
  bottom: f + p
465
458
  };
466
459
  }
467
- function Ze(e, t, n, r) {
460
+ function nt(e, t, n, r) {
468
461
  let i = e.coordsAtPos(t.pos), a = n / 2 * r;
469
462
  return {
470
463
  left: i.left - a,
@@ -473,10 +466,10 @@ function Ze(e, t, n, r) {
473
466
  bottom: i.bottom
474
467
  };
475
468
  }
476
- function Qe(e, t) {
469
+ function rt(e, t) {
477
470
  e.classList.toggle("prosemirror-dropcursor-inline", t === "inline"), e.classList.toggle("prosemirror-dropcursor-block-horizontal", t === "block-horizontal"), e.classList.toggle("prosemirror-dropcursor-block-vertical-left", t === "block-vertical-left"), e.classList.toggle("prosemirror-dropcursor-block-vertical-right", t === "block-vertical-right"), e.classList.toggle("prosemirror-dropcursor-block", t === "block-horizontal"), e.classList.toggle("prosemirror-dropcursor-vertical", t === "block-vertical-left" || t === "block-vertical-right");
478
471
  }
479
- function $e(e) {
472
+ function it(e) {
480
473
  if (!e || e === document.body && getComputedStyle(e).position === "static") return {
481
474
  parentLeft: -window.pageXOffset,
482
475
  parentTop: -window.pageYOffset
@@ -489,7 +482,7 @@ function $e(e) {
489
482
  }
490
483
  //#endregion
491
484
  //#region src/extensions/DropCursor/DropCursor.ts
492
- var et = "bn-drag-exclude", tt = b(({ editor: e, options: t }) => {
485
+ var at = "bn-drag-exclude", ot = v(({ editor: e, options: t }) => {
493
486
  let n = null, r = null, i = -1, a = null, o = {
494
487
  width: t.dropCursor?.width ?? 5,
495
488
  color: t.dropCursor?.color ?? "#ddeeff",
@@ -499,9 +492,9 @@ var et = "bn-drag-exclude", tt = b(({ editor: e, options: t }) => {
499
492
  e?.pos === n?.pos && e?.orientation === n?.orientation || (n = e, e == null ? (r && r.parentNode && r.parentNode.removeChild(r), r = null) : c());
500
493
  }, c = () => {
501
494
  if (!n) return;
502
- let t = e.prosemirrorView, i = t.dom, a = i.getBoundingClientRect(), s = a.width / i.offsetWidth, c = a.height / i.offsetHeight, l = Xe(t, n, o.width, s, c) ?? Ze(t, n, o.width, s), u = t.dom.offsetParent;
503
- r || (r = u.appendChild(document.createElement("div")), r.style.cssText = "position: absolute; z-index: 50; pointer-events: none;", o.color && (r.style.backgroundColor = o.color)), Qe(r, n.orientation);
504
- let { parentLeft: d, parentTop: f } = $e(u);
495
+ let t = e.prosemirrorView, i = t.dom, a = i.getBoundingClientRect(), s = a.width / i.offsetWidth, c = a.height / i.offsetHeight, l = tt(t, n, o.width, s, c) ?? nt(t, n, o.width, s), u = t.dom.offsetParent;
496
+ r || (r = u.appendChild(document.createElement("div")), r.style.cssText = "position: absolute; z-index: 50; pointer-events: none;", o.color && (r.style.backgroundColor = o.color)), rt(r, n.orientation);
497
+ let { parentLeft: d, parentTop: f } = it(u);
505
498
  r.style.left = (l.left - d) / s + "px", r.style.top = (l.top - f) / c + "px", r.style.width = (l.right - l.left) / s + "px", r.style.height = (l.bottom - l.top) / c + "px";
506
499
  }, l = (e) => {
507
500
  clearTimeout(i), i = window.setTimeout(() => s(null), e);
@@ -510,7 +503,7 @@ var et = "bn-drag-exclude", tt = b(({ editor: e, options: t }) => {
510
503
  a = t.target instanceof Element ? t.target : null;
511
504
  }, d = (t) => {
512
505
  let n = t;
513
- if (a && W(a, o.exclude) || n.target instanceof Element && W(n.target, o.exclude)) return;
506
+ if (a && et(a, o.exclude) || n.target instanceof Element && et(n.target, o.exclude)) return;
514
507
  let r = e.prosemirrorView;
515
508
  if (!r.editable) return;
516
509
  let i = r.posAtCoords({
@@ -520,7 +513,7 @@ var et = "bn-drag-exclude", tt = b(({ editor: e, options: t }) => {
520
513
  if (i && !d) {
521
514
  let t = i.pos;
522
515
  if (r.dragging && r.dragging.slice) {
523
- let e = ie(r.state.doc, t, r.dragging.slice);
516
+ let e = se(r.state.doc, t, r.dragging.slice);
524
517
  e != null && (t = e);
525
518
  }
526
519
  let a = !r.state.doc.resolve(t).parent.inlineContent, c = {
@@ -561,48 +554,12 @@ var et = "bn-drag-exclude", tt = b(({ editor: e, options: t }) => {
561
554
  });
562
555
  }
563
556
  };
564
- }), nt = b(({ editor: e }) => {
565
- let t = y(!1), n = () => e.transact((e) => {
566
- if (e.selection.empty || e.selection instanceof ce && e.doc.textBetween(e.selection.from, e.selection.to).length === 0) return !1;
567
- let t = !1;
568
- return e.selection.content().content.descendants((e) => (e.type.spec.code && (t = !0), !t)), !t;
569
- });
570
- return {
571
- key: "formattingToolbar",
572
- store: t,
573
- mount({ dom: r, signal: i }) {
574
- let a = !1, o = !1, s = e.onChange(() => {
575
- a || o || t.setState(n());
576
- }), c = e.onSelectionChange(() => {
577
- a || o || t.setState(n());
578
- });
579
- r.addEventListener("pointerdown", () => {
580
- a = !0, t.setState(!1);
581
- }, { signal: i }), e.prosemirrorView.root.addEventListener("pointerup", () => {
582
- a = !1, e.isFocused() && t.setState(n());
583
- }, {
584
- signal: i,
585
- capture: !0
586
- }), r.addEventListener("pointercancel", () => {
587
- a = !0;
588
- }, {
589
- signal: i,
590
- capture: !0
591
- }), e.prosemirrorView.root.addEventListener("dragstart", () => {
592
- o = !0, t.setState(!1);
593
- }, { signal: i }), e.prosemirrorView.root.addEventListener("dragend", () => {
594
- o = !1;
595
- }, { signal: i }), i.addEventListener("abort", () => {
596
- s(), c();
597
- });
598
- }
599
- };
600
- }), rt = b(() => ({
557
+ }), st = v(() => ({
601
558
  key: "history",
602
- prosemirrorPlugins: [ke()],
603
- undoCommand: je,
604
- redoCommand: Ae
605
- })), it = b(({ editor: e }) => {
559
+ prosemirrorPlugins: [Pe()],
560
+ undoCommand: Ie,
561
+ redoCommand: Fe
562
+ })), ct = v(({ editor: e }) => {
606
563
  function t(t) {
607
564
  let n = e.prosemirrorView.nodeDOM(t);
608
565
  for (; n && n.parentElement;) {
@@ -623,7 +580,7 @@ var et = "bn-drag-exclude", tt = b(({ editor: e, options: t }) => {
623
580
  return n.text;
624
581
  },
625
582
  get position() {
626
- return oe(e.prosemirrorView, n.from, n.to).toJSON();
583
+ return ue(e.prosemirrorView, n.from, n.to).toJSON();
627
584
  }
628
585
  };
629
586
  }
@@ -649,7 +606,7 @@ var et = "bn-drag-exclude", tt = b(({ editor: e, options: t }) => {
649
606
  e.deleteLink(t);
650
607
  }
651
608
  };
652
- }), at = [
609
+ }), lt = [
653
610
  "http",
654
611
  "https",
655
612
  "ftp",
@@ -660,30 +617,30 @@ var et = "bn-drag-exclude", tt = b(({ editor: e, options: t }) => {
660
617
  "sms",
661
618
  "cid",
662
619
  "xmpp"
663
- ], ot = "https", st = new T("node-selection-keyboard"), ct = b(() => ({
620
+ ], ut = "https", dt = new x("node-selection-keyboard"), ft = v(() => ({
664
621
  key: "nodeSelectionKeyboard",
665
- prosemirrorPlugins: [new w({
666
- key: st,
622
+ prosemirrorPlugins: [new b({
623
+ key: dt,
667
624
  props: { handleKeyDown: (e, t) => {
668
625
  if ("node" in e.state.selection) {
669
626
  if (t.ctrlKey || t.metaKey) return !1;
670
627
  if (t.key.length === 1) return t.preventDefault(), !0;
671
628
  if (t.key === "Enter" && !t.isComposing && !t.shiftKey && !t.altKey && !t.ctrlKey && !t.metaKey) {
672
629
  let t = e.state.tr;
673
- return e.dispatch(t.insert(e.state.tr.selection.$to.after(), e.state.schema.nodes.paragraph.createChecked()).setSelection(new ce(t.doc.resolve(e.state.tr.selection.$to.after() + 1)))), !0;
630
+ return e.dispatch(t.insert(e.state.tr.selection.$to.after(), e.state.schema.nodes.paragraph.createChecked()).setSelection(new fe(t.doc.resolve(e.state.tr.selection.$to.after() + 1)))), !0;
674
631
  }
675
632
  }
676
633
  return !1;
677
634
  } }
678
635
  })]
679
- })), lt = new T("blocknote-placeholder"), ut = b(({ editor: e, options: t }) => {
636
+ })), pt = new x("blocknote-placeholder"), mt = v(({ editor: e, options: t }) => {
680
637
  let n = t.placeholders;
681
638
  return {
682
639
  key: "placeholder",
683
- prosemirrorPlugins: [new w({
684
- key: lt,
640
+ prosemirrorPlugins: [new b({
641
+ key: pt,
685
642
  view: (t) => {
686
- let r = `placeholder-selector-${le()}`;
643
+ let r = `placeholder-selector-${pe()}`;
687
644
  t.dom.classList.add(r);
688
645
  let i = document.createElement("style"), a = e._tiptapEditor.options.injectNonce;
689
646
  a && i.setAttribute("nonce", a), t.root instanceof window.ShadowRoot ? t.root.append(i) : t.root.head.appendChild(i);
@@ -706,33 +663,33 @@ var et = "bn-drag-exclude", tt = b(({ editor: e, options: t }) => {
706
663
  let { doc: n, selection: r } = t;
707
664
  if (!e.isEditable || !r.empty || r.$from.parent.type.spec.code) return;
708
665
  let i = [];
709
- t.doc.content.size === 6 && i.push(k.node(2, 4, { "data-is-only-empty-block": "true" }));
666
+ t.doc.content.size === 6 && i.push(w.node(2, 4, { "data-is-only-empty-block": "true" }));
710
667
  let a = r.$anchor, o = a.parent;
711
668
  if (o.content.size === 0) {
712
669
  let e = a.before();
713
- i.push(k.node(e, e + o.nodeSize, { "data-is-empty-and-focused": "true" }));
670
+ i.push(w.node(e, e + o.nodeSize, { "data-is-empty-and-focused": "true" }));
714
671
  }
715
- return A.create(n, i);
672
+ return T.create(n, i);
716
673
  } }
717
674
  })]
718
675
  };
719
- }), dt = new T("previous-blocks"), ft = {
676
+ }), ht = new x("previous-blocks"), gt = {
720
677
  index: "index",
721
678
  level: "level",
722
679
  type: "type",
723
680
  depth: "depth",
724
681
  "depth-change": "depth-change"
725
- }, pt = b(() => {
682
+ }, _t = v(() => {
726
683
  let e;
727
684
  return {
728
685
  key: "previousBlockType",
729
- prosemirrorPlugins: [new w({
730
- key: dt,
686
+ prosemirrorPlugins: [new b({
687
+ key: ht,
731
688
  view(t) {
732
689
  return {
733
690
  update: async (t, n) => {
734
691
  this.key?.getState(t.state).updatedBlocks.size > 0 && (e = setTimeout(() => {
735
- t.dispatch(t.state.tr.setMeta(dt, { clearUpdate: !0 }));
692
+ t.dispatch(t.state.tr.setMeta(ht, { clearUpdate: !0 }));
736
693
  }, 0));
737
694
  },
738
695
  destroy: () => {
@@ -755,7 +712,7 @@ var et = "bn-drag-exclude", tt = b(({ editor: e, options: t }) => {
755
712
  let a = e.mapping.invert(), o = {
756
713
  from: a.map(i.from, -1),
757
714
  to: a.map(i.to, 1)
758
- }, s = {}, c = C(n.doc, o, (e) => e.attrs.id), l = new Map(c.map((e) => [e.node.attrs.id, e])), u = C(r.doc, i, (e) => e.attrs.id);
715
+ }, s = {}, c = le(n.doc, o, (e) => e.attrs.id), l = new Map(c.map((e) => [e.node.attrs.id, e])), u = le(r.doc, i, (e) => e.attrs.id);
759
716
  for (let e of u) {
760
717
  let i = l.get(e.node.attrs.id), a = i?.node.firstChild, o = e.node.firstChild;
761
718
  if (i && a && o) {
@@ -783,16 +740,16 @@ var et = "bn-drag-exclude", tt = b(({ editor: e, options: t }) => {
783
740
  return e.doc.descendants((e, r) => {
784
741
  if (!e.attrs.id || !t.updatedBlocks.has(e.attrs.id)) return;
785
742
  let i = t.currentTransactionOldBlockAttrs[e.attrs.id], a = {};
786
- for (let [e, t] of Object.entries(i)) a["data-prev-" + ft[e]] = t || "none";
787
- n.push(k.node(r, r + e.nodeSize, { ...a }));
788
- }), A.create(e.doc, n);
743
+ for (let [e, t] of Object.entries(i)) a["data-prev-" + gt[e]] = t || "none";
744
+ n.push(w.node(r, r + e.nodeSize, { ...a }));
745
+ }), T.create(e.doc, n);
789
746
  } }
790
747
  })]
791
748
  };
792
749
  });
793
750
  //#endregion
794
751
  //#region src/extensions/getDraggableBlockFromElement.ts
795
- function mt(e, t) {
752
+ function vt(e, t) {
796
753
  for (; e && e.parentElement && e.parentElement !== t.dom && e.getAttribute?.("data-node-type") !== "blockContainer";) e = e.parentElement;
797
754
  if (e.getAttribute?.("data-node-type") === "blockContainer") return {
798
755
  node: e,
@@ -800,69 +757,365 @@ function mt(e, t) {
800
757
  };
801
758
  }
802
759
  //#endregion
803
- //#region src/api/exporters/markdown/util/removeUnderlinesRehypePlugin.ts
804
- function ht() {
805
- let e = (t) => {
806
- let n = t.children.length;
807
- for (let r = 0; r < n; r++) {
808
- let i = t.children[r];
809
- if (i.type === "element" && (e(i), i.tagName === "u")) if (i.children.length > 0) {
810
- t.children.splice(r, 1, ...i.children);
811
- let e = i.children.length - 1;
812
- n += e, r += e;
813
- } else t.children.splice(r, 1), n--, r--;
814
- }
760
+ //#region src/api/exporters/markdown/htmlToMarkdown.ts
761
+ function yt(e) {
762
+ let t = document.createElement("div");
763
+ return t.innerHTML = e, N(t, {
764
+ indent: "",
765
+ inListItem: !1
766
+ }).trim() + "\n";
767
+ }
768
+ function N(e, t) {
769
+ let n = "", r = Array.from(e.childNodes);
770
+ for (let e = 0; e < r.length; e++) {
771
+ let i = r[e];
772
+ n += P(i, t);
773
+ }
774
+ return n;
775
+ }
776
+ function P(e, t) {
777
+ if (e.nodeType === 3) return e.textContent || "";
778
+ if (e.nodeType !== 1) return "";
779
+ let n = e;
780
+ switch (n.tagName.toLowerCase()) {
781
+ case "p": return bt(n, t);
782
+ case "h1":
783
+ case "h2":
784
+ case "h3":
785
+ case "h4":
786
+ case "h5":
787
+ case "h6": return F(n, t);
788
+ case "blockquote": return xt(n, t);
789
+ case "pre": return St(n, t);
790
+ case "ul": return wt(n, t);
791
+ case "ol": return Tt(n, t);
792
+ case "table": return Dt(n, t);
793
+ case "hr": return t.indent + "***\n\n";
794
+ case "img": return kt(n, t);
795
+ case "video": return At(n, t);
796
+ case "audio": return jt(n, t);
797
+ case "embed": return Mt(n, t);
798
+ case "figure": return Nt(n, t);
799
+ case "a": return H(n, t);
800
+ case "details": return Lt(n, t);
801
+ case "div": return N(n, t);
802
+ case "br": return "";
803
+ default: return N(n, t);
804
+ }
805
+ }
806
+ function bt(e, t) {
807
+ let n = zt(U(e));
808
+ return t.inListItem ? n : t.indent + n + "\n\n";
809
+ }
810
+ function F(e, t) {
811
+ let n = parseInt(e.tagName[1], 10), r = "#".repeat(n) + " ", i = U(e);
812
+ return t.indent + r + i + "\n\n";
813
+ }
814
+ function xt(e, t) {
815
+ let n = Array.from(e.children).filter((e) => {
816
+ let t = e.tagName.toLowerCase();
817
+ return [
818
+ "p",
819
+ "ul",
820
+ "ol",
821
+ "pre",
822
+ "blockquote",
823
+ "table",
824
+ "hr"
825
+ ].includes(t);
826
+ }), r;
827
+ if (n.length > 0) {
828
+ let e = [];
829
+ for (let t of n) t.tagName.toLowerCase() === "p" ? e.push(U(t)) : e.push(P(t, {
830
+ indent: "",
831
+ inListItem: !1
832
+ }).trim());
833
+ r = e.join("\n\n");
834
+ } else r = U(e);
835
+ return r.split("\n").map((e) => t.indent + "> " + e).join("\n") + "\n\n";
836
+ }
837
+ function St(e, t) {
838
+ let n = e.querySelector("code");
839
+ if (!n) return "";
840
+ let r = n.getAttribute("data-language") || Ct(n.className) || "", i = I(n), a = Math.max(0, ...(i.match(/`+/g) ?? []).map((e) => e.length)), o = "`".repeat(Math.max(3, a + 1));
841
+ return i ? t.indent + o + r + "\n" + i + (i.endsWith("\n") ? "" : "\n") + o + "\n\n" : t.indent + o + r + "\n" + o + "\n\n";
842
+ }
843
+ function I(e) {
844
+ let t = "";
845
+ for (let n of Array.from(e.childNodes)) n.nodeType === 3 ? t += n.textContent || "" : n.nodeType === 1 && (n.tagName.toLowerCase() === "br" ? t += "\n" : t += I(n));
846
+ return t;
847
+ }
848
+ function Ct(e) {
849
+ let t = e.match(/language-(\S+)/);
850
+ return t ? t[1] : "";
851
+ }
852
+ function wt(e, t) {
853
+ let n = "", r = Array.from(e.children).filter((e) => e.tagName.toLowerCase() === "li");
854
+ for (let e of r) n += L(e, "bullet", t);
855
+ return t.inListItem || (n += "\n"), n;
856
+ }
857
+ function Tt(e, t) {
858
+ let n = "", r = Array.from(e.children).filter((e) => e.tagName.toLowerCase() === "li"), i = parseInt(e.getAttribute("start") || "1", 10);
859
+ for (let e = 0; e < r.length; e++) {
860
+ let a = i + e;
861
+ n += L(r[e], "ordered", t, a);
862
+ }
863
+ return t.inListItem || (n += "\n"), n;
864
+ }
865
+ function L(e, t, n, r) {
866
+ let i = null, a = null;
867
+ for (let t of Array.from(e.children)) {
868
+ let e = t.tagName.toLowerCase();
869
+ e === "input" && t.type === "checkbox" && (i = t), e === "details" && (a = t);
870
+ }
871
+ let o, s;
872
+ i ? (o = `* ${i.checked ? "[x]" : "[ ]"} `, s = 2) : t === "ordered" ? (o = `${r}. `, s = o.length) : (o = "* ", s = 2);
873
+ let c, l;
874
+ if (a) {
875
+ let e = a.querySelector("summary")?.querySelector("p");
876
+ l = a, c = e ? U(e) : "";
877
+ } else l = Et(e, i), c = l ? U(l) : "";
878
+ let u = n.indent + o + c + "\n", d = n.indent + " ".repeat(s), f = {
879
+ indent: d,
880
+ inListItem: !0
815
881
  };
816
- return e;
882
+ if (a) {
883
+ let e = a.querySelector("summary");
884
+ for (let t of Array.from(a.children)) if (t !== e) if (t.tagName.toLowerCase() === "p") {
885
+ let e = U(t);
886
+ u += "\n" + d + e + "\n";
887
+ } else u += P(t, f);
888
+ }
889
+ let p = Array.from(e.children);
890
+ for (let e of p) {
891
+ let t = e.tagName.toLowerCase();
892
+ if (!(e === l || e === i) && t !== "input") if (t === "ul" || t === "ol") u += P(e, f);
893
+ else if (t === "p") {
894
+ let t = U(e);
895
+ u += "\n" + d + t + "\n";
896
+ } else u += "\n" + P(e, f);
897
+ }
898
+ return u;
817
899
  }
818
- //#endregion
819
- //#region src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts
820
- function gt() {
821
- let e = (t) => {
822
- if (t.children && "length" in t.children && t.children.length) for (let n = t.children.length - 1; n >= 0; n--) {
823
- let r = t.children[n], i = n + 1 < t.children.length ? t.children[n + 1] : void 0;
824
- r.type === "element" && r.tagName === "input" && r.properties?.type === "checkbox" && i?.type === "element" && i.tagName === "p" ? (i.tagName = "span", i.children.splice(0, 0, Le(document.createTextNode(" ")))) : e(r);
900
+ function Et(e, t) {
901
+ for (let n of Array.from(e.children)) {
902
+ if (n === t || n.tagName.toLowerCase() === "input") continue;
903
+ let e = n.tagName.toLowerCase();
904
+ if (e === "p" || e === "span") return n;
905
+ }
906
+ return null;
907
+ }
908
+ function Dt(e, t) {
909
+ let n = e.querySelector("colgroup"), r = 0;
910
+ n && (r = n.querySelectorAll("col").length);
911
+ let i = [], a = !1, o = e.querySelectorAll("tr"), s = [];
912
+ o.forEach((e, t) => {
913
+ s[t] || (s[t] = []);
914
+ let n = e.querySelectorAll("th, td"), i = 0;
915
+ n.forEach((e) => {
916
+ for (; s[t][i] !== void 0;) i++;
917
+ t === 0 && e.tagName.toLowerCase() === "th" && (a = !0);
918
+ let n = Ot(U(e).trim()), r = parseInt(e.getAttribute("colspan") || "1", 10), o = parseInt(e.getAttribute("rowspan") || "1", 10);
919
+ for (let e = 0; e < o; e++) for (let a = 0; a < r; a++) {
920
+ let r = t + e;
921
+ s[r] || (s[r] = []), s[r][i + a] = e === 0 && a === 0 ? n : "";
922
+ }
923
+ i += r;
924
+ }), s[t] && (r = Math.max(r, s[t].length));
925
+ });
926
+ for (let e of s) {
927
+ let t = [];
928
+ for (let n = 0; n < r; n++) t.push(e && e[n] !== void 0 ? e[n] ?? "" : "");
929
+ i.push(t);
930
+ }
931
+ if (i.length === 0) return "";
932
+ let c = [];
933
+ for (let e = 0; e < r; e++) {
934
+ let t = 3;
935
+ for (let n of i) {
936
+ let r = e < n.length ? n[e].length : 0;
937
+ t = Math.max(t, r);
825
938
  }
826
- };
827
- return e;
939
+ c.push(Math.max(t, 10));
940
+ }
941
+ let l = "";
942
+ if (a) {
943
+ l += t.indent + R(i[0], c, r) + "\n", l += t.indent + z(c, r) + "\n";
944
+ for (let e = 1; e < i.length; e++) l += t.indent + R(i[e], c, r) + "\n";
945
+ } else {
946
+ let e = Array(r).fill("");
947
+ l += t.indent + R(e, c, r) + "\n", l += t.indent + z(c, r) + "\n";
948
+ for (let e of i) l += t.indent + R(e, c, r) + "\n";
949
+ }
950
+ return l += "\n", l;
828
951
  }
829
- //#endregion
830
- //#region src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.ts
831
- function _t() {
832
- return (e) => {
833
- Re(e, "element", (e, t, n) => {
834
- if (n && e.tagName === "video") {
835
- let r = e.properties?.src || e.properties?.["data-url"] || "", i = e.properties?.title || e.properties?.["data-name"] || "";
836
- n.children[t] = {
837
- type: "text",
838
- value: `![${i}](${r})`
839
- };
952
+ function Ot(e) {
953
+ return e.replace(/\|/g, "\\|");
954
+ }
955
+ function R(e, t, n) {
956
+ let r = [];
957
+ for (let i = 0; i < n; i++) {
958
+ let n = i < e.length ? e[i] : "";
959
+ r.push(" " + n.padEnd(t[i]) + " ");
960
+ }
961
+ return "|" + r.join("|") + "|";
962
+ }
963
+ function z(e, t) {
964
+ let n = [];
965
+ for (let r = 0; r < t; r++) n.push(" " + "-".repeat(e[r]) + " ");
966
+ return "|" + n.join("|") + "|";
967
+ }
968
+ function kt(e, t) {
969
+ let n = e.getAttribute("src") || "", r = e.getAttribute("alt") || "";
970
+ return n ? t.indent + `![${r}](${n})\n\n` : "\n\n";
971
+ }
972
+ function At(e, t) {
973
+ let n = e.getAttribute("src") || e.getAttribute("data-url") || "", r = e.getAttribute("data-name") || e.getAttribute("title") || "";
974
+ return n ? t.indent + `![${r}](${n})\n\n` : "\n\n";
975
+ }
976
+ function jt(e, t) {
977
+ let n = e.getAttribute("src") || "";
978
+ return n ? t.indent + `<audio src="${V(n)}" controls></audio>\n\n` : "\n\n";
979
+ }
980
+ function Mt(e, t) {
981
+ let n = e.getAttribute("src") || "";
982
+ return n ? t.indent + `[](${n})\n\n` : "\n\n";
983
+ }
984
+ function Nt(e, t) {
985
+ let n = e.querySelector("img"), r = e.querySelector("video"), i = e.querySelector("audio"), a = e.querySelector("a"), o = e.querySelector("figcaption")?.textContent?.trim() || "";
986
+ return n ? B("img", n.getAttribute("src") || "", n.getAttribute("alt") || "", o, t) : r ? B("video", r.getAttribute("src") || r.getAttribute("data-url") || "", r.getAttribute("data-name") || r.getAttribute("title") || "", o, t) : i ? B("audio", i.getAttribute("src") || "", "", o, t) : a ? H(a, t) : "";
987
+ }
988
+ function B(e, t, n, r, i) {
989
+ if (!t) return "";
990
+ if (!r && e !== "audio") return i.indent + `![${n}](${t})\n\n`;
991
+ let a = n && n !== r ? e === "img" ? ` alt="${V(n)}"` : e === "video" ? ` data-name="${V(n)}"` : "" : "", o = e === "img" ? `<img${a} src="${V(t)}">` : `<${e} src="${V(t)}"${a} controls></${e}>`, s = r ? `<figcaption>${Pt(r)}</figcaption>` : "";
992
+ return i.indent + `<figure>${o}${s}</figure>\n\n`;
993
+ }
994
+ function V(e) {
995
+ return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
996
+ }
997
+ function Pt(e) {
998
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
999
+ }
1000
+ function H(e, t) {
1001
+ let n = e.getAttribute("href") || "", r = e.textContent?.trim() || "";
1002
+ return n ? t.indent + Ft(r, n) + "\n\n" : t.indent + r + "\n\n";
1003
+ }
1004
+ function Ft(e, t) {
1005
+ return !e || e === t ? t : `[${e}](${It(t)})`;
1006
+ }
1007
+ function It(e) {
1008
+ return e.replace(/[\\()]/g, "\\$&");
1009
+ }
1010
+ function Lt(e, t) {
1011
+ let n = e.querySelector("summary");
1012
+ if (!n) return N(e, t);
1013
+ let r = n.querySelector("h1, h2, h3, h4, h5, h6");
1014
+ if (r) {
1015
+ let i = F(r, t);
1016
+ for (let r of Array.from(e.children)) r !== n && (i += P(r, t));
1017
+ return i;
1018
+ }
1019
+ return N(n, t);
1020
+ }
1021
+ function U(e) {
1022
+ let t = "";
1023
+ for (let n of Array.from(e.childNodes)) if (n.nodeType === 3) t += n.textContent || "";
1024
+ else if (n.nodeType === 1) {
1025
+ let e = n;
1026
+ switch (e.tagName.toLowerCase()) {
1027
+ case "strong":
1028
+ case "b": {
1029
+ let { content: n, trailing: r } = Rt(U(e));
1030
+ n ? t += `**${n}**${r}` : t += r;
1031
+ break;
840
1032
  }
841
- });
1033
+ case "em":
1034
+ case "i": {
1035
+ let { content: n, trailing: r } = Rt(U(e));
1036
+ n ? t += `*${n}*${r}` : t += r;
1037
+ break;
1038
+ }
1039
+ case "s":
1040
+ case "del":
1041
+ t += `~~${U(e)}~~`;
1042
+ break;
1043
+ case "code": {
1044
+ let n = e.textContent || "", r = Math.max(0, ...(n.match(/`+/g) ?? []).map((e) => e.length)), i = "`".repeat(r + 1), a = n.startsWith("`") || n.endsWith("`");
1045
+ t += i + (a ? ` ${n} ` : n) + i;
1046
+ break;
1047
+ }
1048
+ case "u":
1049
+ t += U(e);
1050
+ break;
1051
+ case "a": {
1052
+ let n = e.getAttribute("href") || "", r = U(e);
1053
+ t += Ft(r, n);
1054
+ break;
1055
+ }
1056
+ case "br":
1057
+ t += "\\\n";
1058
+ break;
1059
+ case "span":
1060
+ t += U(e);
1061
+ break;
1062
+ case "img": {
1063
+ let n = e.getAttribute("src") || "", r = e.getAttribute("alt") || "";
1064
+ t += `![${r}](${n})`;
1065
+ break;
1066
+ }
1067
+ case "video": {
1068
+ let n = e.getAttribute("src") || e.getAttribute("data-url") || "", r = e.getAttribute("data-name") || e.getAttribute("title") || "";
1069
+ t += `![${r}](${n})`;
1070
+ break;
1071
+ }
1072
+ case "p":
1073
+ t += U(e);
1074
+ break;
1075
+ case "input": break;
1076
+ default:
1077
+ t += U(e);
1078
+ break;
1079
+ }
1080
+ }
1081
+ return t;
1082
+ }
1083
+ function Rt(e) {
1084
+ let t = e.match(/^(.*?)(\s*)$/);
1085
+ return t ? {
1086
+ content: t[1],
1087
+ trailing: t[2]
1088
+ } : {
1089
+ content: e,
1090
+ trailing: ""
842
1091
  };
843
1092
  }
1093
+ function zt(e) {
1094
+ let t = e.replace(/^(\\\n)+/, "");
1095
+ return t = t.replace(/(\\\n)+$/, ""), t;
1096
+ }
844
1097
  //#endregion
845
1098
  //#region src/api/exporters/markdown/markdownExporter.ts
846
- function G(e) {
847
- return Ie().use(Me, { fragment: !0 }).use(_t).use(ht).use(gt).use(Ne).use(Pe).use(Fe, { handlers: { text: (e) => e.value } }).processSync(e).value;
1099
+ function W(e) {
1100
+ return yt(e);
848
1101
  }
849
- function vt(e, t, n, r) {
850
- return G(I(t, n).exportBlocks(e, r));
1102
+ function Bt(e, t, n, r) {
1103
+ return W(O(t, n).exportBlocks(e, r));
851
1104
  }
852
1105
  //#endregion
853
1106
  //#region src/api/nodeConversions/fragmentToBlocks.ts
854
- function yt(e) {
1107
+ function Vt(e) {
855
1108
  let t = [];
856
1109
  return e.descendants((e) => {
857
- let n = p(e);
1110
+ let n = m(e);
858
1111
  return e.type.name === "blockContainer" && e.firstChild?.type.name === "blockGroup" ? !0 : e.type.name === "columnList" && e.childCount === 1 ? (e.firstChild?.forEach((e) => {
859
- t.push(_(e, n));
860
- }), !1) : e.type.isInGroup("bnBlock") ? (t.push(_(e, n)), !1) : !0;
1112
+ t.push(p(e, n));
1113
+ }), !1) : e.type.isInGroup("bnBlock") ? (t.push(p(e, n)), !1) : !0;
861
1114
  }), t;
862
1115
  }
863
1116
  //#endregion
864
1117
  //#region src/extensions/SideMenu/MultipleNodeSelection.ts
865
- var K = class e extends E {
1118
+ var G = class e extends S {
866
1119
  nodes;
867
1120
  constructor(e, t) {
868
1121
  super(e, t);
@@ -875,7 +1128,7 @@ var K = class e extends E {
875
1128
  return new e(t.resolve(n), t.resolve(r));
876
1129
  }
877
1130
  content() {
878
- return new re(S.from(this.nodes), 0, 0);
1131
+ return new oe(y.from(this.nodes), 0, 0);
879
1132
  }
880
1133
  eq(t) {
881
1134
  if (!(t instanceof e) || this.nodes.length !== t.nodes.length || this.from !== t.from || this.to !== t.to) return !1;
@@ -884,7 +1137,7 @@ var K = class e extends E {
884
1137
  }
885
1138
  map(t, n) {
886
1139
  let r = n.mapResult(this.from), i = n.mapResult(this.to);
887
- return i.deleted ? E.near(t.resolve(r.pos)) : r.deleted ? E.near(t.resolve(i.pos)) : new e(t.resolve(r.pos), t.resolve(i.pos));
1140
+ return i.deleted ? S.near(t.resolve(r.pos)) : r.deleted ? S.near(t.resolve(i.pos)) : new e(t.resolve(r.pos), t.resolve(i.pos));
888
1141
  }
889
1142
  toJSON() {
890
1143
  return {
@@ -894,11 +1147,11 @@ var K = class e extends E {
894
1147
  };
895
1148
  }
896
1149
  };
897
- E.jsonID("multiple-node", K);
1150
+ S.jsonID("multiple-node", G);
898
1151
  //#endregion
899
1152
  //#region src/extensions/SideMenu/dragging.ts
900
- var q;
901
- function bt(e, t) {
1153
+ var K;
1154
+ function Ht(e, t) {
902
1155
  let n, r, i = t.resolve(e.from).node().type.spec.group === "blockContent", a = t.resolve(e.to).node().type.spec.group === "blockContent", o = Math.min(e.$anchor.depth, e.$head.depth);
903
1156
  if (i && a) {
904
1157
  let i = e.$from.start(o - 1), a = e.$to.end(o - 1);
@@ -909,56 +1162,51 @@ function bt(e, t) {
909
1162
  to: r
910
1163
  };
911
1164
  }
912
- function xt(e, t, n = t) {
1165
+ function Ut(e, t, n = t) {
913
1166
  t === n && (n += e.state.doc.resolve(t + 1).node().nodeSize);
914
1167
  let r = e.domAtPos(t).node.cloneNode(!0), i = e.domAtPos(t).node, a = (e, t) => Array.prototype.indexOf.call(e.children, t), o = a(i, e.domAtPos(t + 1).node.parentElement), s = a(i, e.domAtPos(n - 1).node.parentElement);
915
1168
  for (let e = i.childElementCount - 1; e >= 0; e--) (e > s || e < o) && r.removeChild(r.children[e]);
916
- St(e.root), q = r;
917
- let c = q.getElementsByTagName("iframe");
918
- for (let e = 0; e < c.length; e++) {
919
- let t = c[e], n = t.parentElement;
920
- n && n.removeChild(t);
921
- }
922
- let l = e.dom.className.split(" ").filter((e) => e !== "ProseMirror" && e !== "bn-root" && e !== "bn-editor").join(" ");
923
- q.className = q.className + " bn-drag-preview " + l, e.root instanceof ShadowRoot ? e.root.appendChild(q) : e.root.body.appendChild(q);
1169
+ Wt(e.root), K = r, K.querySelectorAll("iframe, embed, object").forEach((e) => e.parentElement?.removeChild(e));
1170
+ let c = e.dom.className.split(" ").filter((e) => e !== "ProseMirror" && e !== "bn-root" && e !== "bn-editor").join(" ");
1171
+ K.className = K.className + " bn-drag-preview " + c, e.root instanceof ShadowRoot ? e.root.appendChild(K) : e.root.body.appendChild(K);
924
1172
  }
925
- function St(e) {
926
- q !== void 0 && (e instanceof ShadowRoot ? e.removeChild(q) : e.body.removeChild(q), q = void 0);
1173
+ function Wt(e) {
1174
+ K !== void 0 && (e instanceof ShadowRoot ? e.removeChild(K) : e.body.removeChild(K), K = void 0);
927
1175
  }
928
- function Ct(e, t, n) {
929
- if (!e.dataTransfer || n.headless) return;
930
- let i = n.prosemirrorView, a = r(t.id, i.state.doc);
1176
+ function Gt(e, t, r) {
1177
+ if (!e.dataTransfer || r.headless) return;
1178
+ let i = r.prosemirrorView, a = n(t.id, i.state.doc);
931
1179
  if (!a) throw Error(`Block with ID ${t.id} not found`);
932
1180
  let o = a.posBeforeNode;
933
1181
  if (o != null) {
934
- let t = i.state.selection, r = i.state.doc, { from: a, to: s } = bt(t, r), c = a <= o && o < s, l = t.$anchor.node() !== t.$head.node() || t instanceof K;
935
- c && l ? (i.dispatch(i.state.tr.setSelection(K.create(r, a, s))), xt(i, a, s)) : (i.dispatch(i.state.tr.setSelection(se.create(i.state.doc, o))), xt(i, o));
936
- let u = i.state.selection.content(), d = n.pmSchema, f = i.serializeForClipboard(u).dom.innerHTML, p = I(d, n), m = yt(u.content), h = p.exportBlocks(m, {}), g = G(h);
937
- e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html", f), e.dataTransfer.setData("text/html", h), e.dataTransfer.setData("text/plain", g), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setDragImage(q, 0, 0);
1182
+ let t = i.state.selection, n = i.state.doc, { from: a, to: s } = Ht(t, n), c = a <= o && o < s, l = t.$anchor.node() !== t.$head.node() || t instanceof G;
1183
+ c && l ? (i.dispatch(i.state.tr.setSelection(G.create(n, a, s))), Ut(i, a, s)) : (i.dispatch(i.state.tr.setSelection(de.create(i.state.doc, o))), Ut(i, o));
1184
+ let u = i.state.selection.content(), d = r.pmSchema, f = i.serializeForClipboard(u).dom.innerHTML, p = O(d, r), m = Vt(u.content), h = p.exportBlocks(m, {}), g = W(h);
1185
+ e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html", f), e.dataTransfer.setData("text/html", h), e.dataTransfer.setData("text/plain", g), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setDragImage(K, 0, 0);
938
1186
  }
939
1187
  }
940
1188
  //#endregion
941
1189
  //#region src/extensions/SideMenu/SideMenu.ts
942
- var wt = 250;
943
- function J(e, t, n = !0) {
1190
+ var Kt = 250;
1191
+ function q(e, t, n = !0) {
944
1192
  let r = e.root.elementsFromPoint(t.left, t.top);
945
- for (let i of r) if (e.dom.contains(i)) return n && i.closest("[data-node-type=columnList]") ? J(e, {
1193
+ for (let i of r) if (e.dom.contains(i)) return n && i.closest("[data-node-type=columnList]") ? q(e, {
946
1194
  left: t.left + 50,
947
1195
  top: t.top
948
- }, !1) : mt(i, e);
1196
+ }, !1) : vt(i, e);
949
1197
  }
950
- function Tt(e, t) {
1198
+ function qt(e, t) {
951
1199
  if (!t.dom.firstChild) return;
952
- let n = t.dom.firstChild.getBoundingClientRect(), r = J(t, {
1200
+ let n = t.dom.firstChild.getBoundingClientRect(), r = q(t, {
953
1201
  left: Math.min(Math.max(n.left + 10, e.x), n.right - 10),
954
1202
  top: e.y
955
1203
  });
956
- if (r) return J(t, {
1204
+ if (r) return q(t, {
957
1205
  left: r.node.getBoundingClientRect().right - 10,
958
1206
  top: e.y
959
1207
  }, !1);
960
1208
  }
961
- var Et = class {
1209
+ var J = class {
962
1210
  state;
963
1211
  emitUpdate;
964
1212
  mousePos;
@@ -980,11 +1228,11 @@ var Et = class {
980
1228
  clientX: this.mousePos.x,
981
1229
  clientY: this.mousePos.y
982
1230
  });
983
- if (e?.element !== this.pmView.dom || e.distance > wt) {
1231
+ if (e?.element !== this.pmView.dom || e.distance > Kt) {
984
1232
  this.state?.show && (this.state.show = !1, this.updateState(this.state));
985
1233
  return;
986
1234
  }
987
- let t = Tt(this.mousePos, this.pmView);
1235
+ let t = qt(this.mousePos, this.pmView);
988
1236
  if (!t || !this.editor.isEditable) {
989
1237
  this.state?.show && (this.state.show = !1, this.updateState(this.state));
990
1238
  return;
@@ -1003,9 +1251,9 @@ var Et = class {
1003
1251
  if (!t || this.pmView.dragging) return;
1004
1252
  let n = document.createElement("div");
1005
1253
  n.innerHTML = t;
1006
- let r = ue.fromSchema(this.pmView.state.schema).parse(n, { topNode: this.pmView.state.schema.nodes.blockGroup.create() });
1254
+ let r = me.fromSchema(this.pmView.state.schema).parse(n, { topNode: this.pmView.state.schema.nodes.blockGroup.create() });
1007
1255
  this.pmView.dragging = {
1008
- slice: new de(r.content, 0, 0),
1256
+ slice: new he(r.content, 0, 0),
1009
1257
  move: !0
1010
1258
  };
1011
1259
  };
@@ -1037,7 +1285,7 @@ var Et = class {
1037
1285
  getDragEventContext = (e) => {
1038
1286
  if (!(this.pmView.dragging !== null || this.isDragOrigin || e.dataTransfer?.types.includes("blocknote/html") || e.target instanceof Node && this.pmView.dom.contains(e.target))) return;
1039
1287
  let t = !e.dataTransfer?.types.includes("blocknote/html") && !!this.pmView.dragging, n = !!this.isDragOrigin, r = t || n, i = this.findClosestEditorElement(e);
1040
- if (!i || i.distance > wt) return;
1288
+ if (!i || i.distance > Kt) return;
1041
1289
  let a = i.element === this.pmView.dom, o = a && i.distance === 0;
1042
1290
  if (!(!a && !r)) return {
1043
1291
  isDropPoint: a,
@@ -1055,7 +1303,7 @@ var Et = class {
1055
1303
  let { isDropPoint: n, isDropWithinEditorBounds: r, isDragOrigin: i } = t;
1056
1304
  if (!r && n && this.dispatchSyntheticEvent(e), n) {
1057
1305
  if (this.pmView.dragging) return;
1058
- this.pmView.dispatch(this.pmView.state.tr.setSelection(xe.create(this.pmView.state.tr.doc, this.pmView.state.tr.selection.anchor)));
1306
+ this.pmView.dispatch(this.pmView.state.tr.setSelection(Ee.create(this.pmView.state.tr.doc, this.pmView.state.tr.selection.anchor)));
1059
1307
  return;
1060
1308
  } else if (i) {
1061
1309
  setTimeout(() => this.pmView.dispatch(this.pmView.state.tr.deleteSelection()), 0);
@@ -1091,22 +1339,22 @@ var Et = class {
1091
1339
  destroy() {
1092
1340
  this.state?.show && (this.state.show = !1, this.emitUpdate(this.state)), this.pmView.root.removeEventListener("mousemove", this.onMouseMove, !0), this.pmView.root.removeEventListener("dragstart", this.onDragStart), this.pmView.root.removeEventListener("dragover", this.onDragOver), this.pmView.root.removeEventListener("drop", this.onDrop, !0), this.pmView.root.removeEventListener("dragend", this.onDragEnd, !0), this.pmView.root.removeEventListener("keydown", this.onKeyDown, !0);
1093
1341
  }
1094
- }, Dt = new O("SideMenuPlugin"), Ot = b(({ editor: e }) => {
1095
- let t, n = y(void 0);
1342
+ }, Jt = new Te("SideMenuPlugin"), Yt = v(({ editor: e }) => {
1343
+ let t, n = _(void 0);
1096
1344
  return {
1097
1345
  key: "sideMenu",
1098
1346
  store: n,
1099
- prosemirrorPlugins: [new D({
1100
- key: Dt,
1101
- view: (r) => (t = new Et(e, r, (e) => {
1347
+ prosemirrorPlugins: [new C({
1348
+ key: Jt,
1349
+ view: (r) => (t = new J(e, r, (e) => {
1102
1350
  n.setState({ ...e });
1103
1351
  }), t)
1104
1352
  })],
1105
1353
  blockDragStart(n, r) {
1106
- t && (t.isDragOrigin = !0), Ct(n, r, e);
1354
+ t && (t.isDragOrigin = !0), Gt(n, r, e);
1107
1355
  },
1108
1356
  blockDragEnd() {
1109
- St(e.prosemirrorView.root), t && (t.isDragOrigin = !1), e.blur();
1357
+ Wt(e.prosemirrorView.root), t && (t.isDragOrigin = !1), e.blur();
1110
1358
  },
1111
1359
  freezeMenu() {
1112
1360
  t.menuFrozen = !0, t.state.show = !0, t.emitUpdate(t.state);
@@ -1115,11 +1363,11 @@ var Et = class {
1115
1363
  t.menuFrozen = !1, t.state.show = !1, t.emitUpdate(t.state);
1116
1364
  },
1117
1365
  hideMenuIfNotFrozen() {
1118
- !t.menuFrozen && t.state.show && (t.state.show = !1, t.emitUpdate(t.state));
1366
+ !t.menuFrozen && t.state?.show && (t.state.show = !1, t.emitUpdate(t.state));
1119
1367
  }
1120
1368
  };
1121
1369
  }), Y;
1122
- async function kt() {
1370
+ async function Xt() {
1123
1371
  return Y || (Y = (async () => {
1124
1372
  let [e, t] = await Promise.all([import("emoji-mart"), import("@emoji-mart/data")]), n = "default" in e ? e.default : e, r = "default" in t ? t.default : t;
1125
1373
  return await n.init({ data: r }), {
@@ -1128,9 +1376,9 @@ async function kt() {
1128
1376
  };
1129
1377
  })(), Y);
1130
1378
  }
1131
- async function At(e, t) {
1132
- if (!("text" in e.schema.inlineContentSchema) || e.schema.inlineContentSchema.text !== te.text) return [];
1133
- let { emojiData: n, emojiMart: r } = await kt();
1379
+ async function Zt(e, t) {
1380
+ if (!("text" in e.schema.inlineContentSchema) || e.schema.inlineContentSchema.text !== ne.text) return [];
1381
+ let { emojiData: n, emojiMart: r } = await Xt();
1134
1382
  return (t.trim() === "" ? Object.values(n.emojis) : await r.SearchIndex.search(t)).map((t) => ({
1135
1383
  id: t.skins[0].native,
1136
1384
  onItemClick: () => e.insertInlineContent(t.skins[0].native + " ")
@@ -1139,16 +1387,16 @@ async function At(e, t) {
1139
1387
  //#endregion
1140
1388
  //#region src/extensions/TableHandles/TableHandles.ts
1141
1389
  var X;
1142
- function jt(e) {
1390
+ function Qt(e) {
1143
1391
  X || (X = document.createElement("div"), X.innerHTML = "_", X.style.opacity = "0", X.style.height = "1px", X.style.width = "1px", e instanceof Document ? e.body.appendChild(X) : e.appendChild(X));
1144
1392
  }
1145
- function Mt(e) {
1393
+ function $t(e) {
1146
1394
  X &&= (e instanceof Document ? e.body.removeChild(X) : e.removeChild(X), void 0);
1147
1395
  }
1148
1396
  function Z(e) {
1149
1397
  return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
1150
1398
  }
1151
- function Nt(e) {
1399
+ function en(e) {
1152
1400
  let t = e;
1153
1401
  for (; t && t.nodeName !== "TD" && t.nodeName !== "TH" && !t.classList.contains("tableWrapper");) {
1154
1402
  if (t.classList.contains("ProseMirror")) return;
@@ -1166,11 +1414,11 @@ function Nt(e) {
1166
1414
  tbodyNode: t.querySelector("tbody")
1167
1415
  };
1168
1416
  }
1169
- function Pt(e, t) {
1417
+ function tn(e, t) {
1170
1418
  let n = t.querySelectorAll(e);
1171
1419
  for (let e = 0; e < n.length; e++) n[e].style.visibility = "hidden";
1172
1420
  }
1173
- var Ft = class {
1421
+ var nn = class {
1174
1422
  state;
1175
1423
  emitUpdate;
1176
1424
  tableId;
@@ -1193,7 +1441,7 @@ var Ft = class {
1193
1441
  };
1194
1442
  mouseMoveHandler = (e) => {
1195
1443
  if (this.menuFrozen || this.mouseState === "selecting" || !(e.target instanceof Element) || !this.pmView.dom.contains(e.target)) return;
1196
- let t = Nt(e.target);
1444
+ let t = en(e.target);
1197
1445
  if (t?.type === "cell" && this.mouseState === "down" && !this.state?.draggingState) {
1198
1446
  this.mouseState = "selecting", this.state?.show && (this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate());
1199
1447
  return;
@@ -1203,23 +1451,23 @@ var Ft = class {
1203
1451
  return;
1204
1452
  }
1205
1453
  if (!t.tbodyNode) return;
1206
- let n = t.tbodyNode.getBoundingClientRect(), i = mt(t.domNode, this.pmView);
1454
+ let r = t.tbodyNode.getBoundingClientRect(), i = vt(t.domNode, this.pmView);
1207
1455
  if (!i) return;
1208
1456
  this.tableElement = i.node;
1209
- let a, o = this.editor.transact((e) => r(i.id, e.doc));
1457
+ let a, o = this.editor.transact((e) => n(i.id, e.doc));
1210
1458
  if (!o) throw Error(`Block with ID ${i.id} not found`);
1211
- let s = _(o.node, this.editor.pmSchema, this.editor.schema.blockSchema, this.editor.schema.inlineContentSchema, this.editor.schema.styleSchema);
1459
+ let s = p(o.node, this.editor.pmSchema, this.editor.schema.blockSchema, this.editor.schema.inlineContentSchema, this.editor.schema.styleSchema);
1212
1460
  if (h(this.editor, "table") && (this.tablePos = o.posBeforeNode + 1, a = s), !a) return;
1213
1461
  this.tableId = i.id;
1214
1462
  let c = t.domNode.closest(".tableWrapper")?.querySelector(".table-widgets-container");
1215
1463
  if (t?.type === "wrapper") {
1216
- let t = e.clientY >= n.bottom - 1 && e.clientY < n.bottom + 20, r = e.clientX >= n.right - 1 && e.clientX < n.right + 20, i = this.state?.block.id !== a.id || e.clientX > n.right || e.clientY > n.bottom;
1464
+ let t = e.clientY >= r.bottom - 1 && e.clientY < r.bottom + 20, n = e.clientX >= r.right - 1 && e.clientX < r.right + 20, i = this.state?.block.id !== a.id || e.clientX > r.right || e.clientY > r.bottom;
1217
1465
  this.state = {
1218
1466
  ...this.state,
1219
1467
  show: !0,
1220
1468
  showAddOrRemoveRowsButton: t,
1221
- showAddOrRemoveColumnsButton: r,
1222
- referencePosTable: n,
1469
+ showAddOrRemoveColumnsButton: n,
1470
+ referencePosTable: r,
1223
1471
  block: a,
1224
1472
  widgetContainer: c,
1225
1473
  colIndex: i ? void 0 : this.state?.colIndex,
@@ -1227,18 +1475,18 @@ var Ft = class {
1227
1475
  referencePosCell: i ? void 0 : this.state?.referencePosCell
1228
1476
  };
1229
1477
  } else {
1230
- let e = Z(t.domNode), r = Z(t.domNode.parentElement), o = t.domNode.getBoundingClientRect();
1231
- if (this.state !== void 0 && this.state.show && this.tableId === i.id && this.state.rowIndex === r && this.state.colIndex === e) return;
1478
+ let e = Z(t.domNode), n = Z(t.domNode.parentElement), o = t.domNode.getBoundingClientRect();
1479
+ if (this.state !== void 0 && this.state.show && this.tableId === i.id && this.state.rowIndex === n && this.state.colIndex === e) return;
1232
1480
  this.state = {
1233
1481
  show: !0,
1234
1482
  showAddOrRemoveColumnsButton: e === a.content.rows[0].cells.length - 1,
1235
- showAddOrRemoveRowsButton: r === a.content.rows.length - 1,
1236
- referencePosTable: n,
1483
+ showAddOrRemoveRowsButton: n === a.content.rows.length - 1,
1484
+ referencePosTable: r,
1237
1485
  block: a,
1238
1486
  draggingState: void 0,
1239
1487
  referencePosCell: o,
1240
1488
  colIndex: e,
1241
- rowIndex: r,
1489
+ rowIndex: n,
1242
1490
  widgetContainer: c
1243
1491
  };
1244
1492
  }
@@ -1246,7 +1494,7 @@ var Ft = class {
1246
1494
  };
1247
1495
  dragOverHandler = (e) => {
1248
1496
  if (this.state?.draggingState === void 0) return;
1249
- e.preventDefault(), e.dataTransfer.dropEffect = "move", Pt(".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline", this.pmView.root);
1497
+ e.preventDefault(), e.dataTransfer.dropEffect = "move", tn(".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline", this.pmView.root);
1250
1498
  let t = {
1251
1499
  left: Math.min(Math.max(e.clientX, this.state.referencePosTable.left + 1), this.state.referencePosTable.right - 1),
1252
1500
  top: Math.min(Math.max(e.clientY, this.state.referencePosTable.top + 1), this.state.referencePosTable.bottom - 1)
@@ -1261,10 +1509,12 @@ var Ft = class {
1261
1509
  if (this.mouseState = "up", this.state === void 0 || this.state.draggingState === void 0) return !1;
1262
1510
  if (this.state.rowIndex === void 0 || this.state.colIndex === void 0) throw Error("Attempted to drop table row or column, but no table block was hovered prior.");
1263
1511
  e.preventDefault();
1264
- let { draggingState: n, colIndex: r, rowIndex: i } = this.state, a = this.state.block.content.columnWidths;
1512
+ let { draggingState: n, colIndex: i, rowIndex: a } = this.state;
1513
+ this.state.draggingState = void 0;
1514
+ let o = this.state.block.content.columnWidths;
1265
1515
  if (n.draggedCellOrientation === "row") {
1266
- if (!l(this.state.block, n.originalIndex, i)) return !1;
1267
- let e = t(this.state.block, n.originalIndex, i);
1516
+ if (!r(this.state.block, n.originalIndex, a)) return !1;
1517
+ let e = d(this.state.block, n.originalIndex, a);
1268
1518
  this.editor.updateBlock(this.state.block, {
1269
1519
  type: "table",
1270
1520
  content: {
@@ -1273,13 +1523,13 @@ var Ft = class {
1273
1523
  }
1274
1524
  });
1275
1525
  } else {
1276
- if (!c(this.state.block, n.originalIndex, r)) return !1;
1277
- let e = ne(this.state.block, n.originalIndex, r), [t] = a.splice(n.originalIndex, 1);
1278
- a.splice(r, 0, t), this.editor.updateBlock(this.state.block, {
1526
+ if (!l(this.state.block, n.originalIndex, i)) return !1;
1527
+ let e = t(this.state.block, n.originalIndex, i), [r] = o.splice(n.originalIndex, 1);
1528
+ o.splice(i, 0, r), this.editor.updateBlock(this.state.block, {
1279
1529
  type: "table",
1280
1530
  content: {
1281
1531
  ...this.state.block.content,
1282
- columnWidths: a,
1532
+ columnWidths: o,
1283
1533
  rows: e
1284
1534
  }
1285
1535
  });
@@ -1292,7 +1542,7 @@ var Ft = class {
1292
1542
  this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate();
1293
1543
  return;
1294
1544
  }
1295
- let { height: e, width: t } = d(this.state.block);
1545
+ let { height: e, width: t } = ie(this.state.block);
1296
1546
  this.state.rowIndex !== void 0 && this.state.colIndex !== void 0 && (this.state.rowIndex >= e && (this.state.rowIndex = e - 1), this.state.colIndex >= t && (this.state.colIndex = t - 1));
1297
1547
  let n = this.tableElement.querySelector("tbody");
1298
1548
  if (!n) throw Error("Table block does not contain a 'tbody' HTML element. This should never happen.");
@@ -1305,14 +1555,14 @@ var Ft = class {
1305
1555
  destroy() {
1306
1556
  this.pmView.dom.removeEventListener("mousemove", this.mouseMoveHandler), window.removeEventListener("mouseup", this.mouseUpHandler), this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler), this.pmView.root.removeEventListener("dragover", this.dragOverHandler), this.pmView.root.removeEventListener("drop", this.dropHandler);
1307
1557
  }
1308
- }, Q = new T("TableHandlesPlugin"), It = b(({ editor: e }) => {
1309
- let t, n = y(void 0);
1558
+ }, Q = new x("TableHandlesPlugin"), rn = v(({ editor: e }) => {
1559
+ let t, n = _(void 0);
1310
1560
  return {
1311
1561
  key: "tableHandles",
1312
1562
  store: n,
1313
- prosemirrorPlugins: [new w({
1563
+ prosemirrorPlugins: [new b({
1314
1564
  key: Q,
1315
- view: (r) => (t = new Ft(e, r, (e) => {
1565
+ view: (r) => (t = new nn(e, r, (e) => {
1316
1566
  n.setState(e.block ? {
1317
1567
  ...e,
1318
1568
  draggingState: e.draggingState ? { ...e.draggingState } : void 0
@@ -1322,22 +1572,22 @@ var Ft = class {
1322
1572
  if (t === void 0 || t.state === void 0 || t.state.draggingState === void 0 || t.tablePos === void 0) return;
1323
1573
  let n = t.state.draggingState.draggedCellOrientation === "row" ? t.state.rowIndex : t.state.colIndex;
1324
1574
  if (n === void 0) return;
1325
- let r = [], { block: i, draggingState: s } = t.state, { originalIndex: u, draggedCellOrientation: d } = s;
1326
- if (n === u || !i || d === "row" && !l(i, u, n) || d === "col" && !c(i, u, n)) return A.create(e.doc, r);
1575
+ let i = [], { block: o, draggingState: s } = t.state, { originalIndex: c, draggedCellOrientation: d } = s;
1576
+ if (n === c || !o || d === "row" && !r(o, c, n) || d === "col" && !l(o, c, n)) return T.create(e.doc, i);
1327
1577
  let f = e.doc.resolve(t.tablePos + 1);
1328
- return t.state.draggingState.draggedCellOrientation === "row" ? o(t.state.block, n).forEach(({ row: t, col: i }) => {
1329
- let a = e.doc.resolve(f.posAtIndex(t) + 1), o = e.doc.resolve(a.posAtIndex(i) + 1), s = o.node(), c = o.pos + (n > u ? s.nodeSize - 2 : 0);
1330
- r.push(k.widget(c, () => {
1578
+ return t.state.draggingState.draggedCellOrientation === "row" ? u(t.state.block, n).forEach(({ row: t, col: r }) => {
1579
+ let a = e.doc.resolve(f.posAtIndex(t) + 1), o = e.doc.resolve(a.posAtIndex(r) + 1), s = o.node(), l = o.pos + (n > c ? s.nodeSize - 2 : 0);
1580
+ i.push(w.widget(l, () => {
1331
1581
  let e = document.createElement("div");
1332
- return e.className = "bn-table-drop-cursor", e.style.left = "0", e.style.right = "0", n > u ? e.style.bottom = "-2px" : e.style.top = "-3px", e.style.height = "4px", e;
1582
+ return e.className = "bn-table-drop-cursor", e.style.left = "0", e.style.right = "0", n > c ? e.style.bottom = "-2px" : e.style.top = "-3px", e.style.height = "4px", e;
1333
1583
  }));
1334
- }) : a(t.state.block, n).forEach(({ row: t, col: i }) => {
1335
- let a = e.doc.resolve(f.posAtIndex(t) + 1), o = e.doc.resolve(a.posAtIndex(i) + 1), s = o.node(), c = o.pos + (n > u ? s.nodeSize - 2 : 0);
1336
- r.push(k.widget(c, () => {
1584
+ }) : a(t.state.block, n).forEach(({ row: t, col: r }) => {
1585
+ let a = e.doc.resolve(f.posAtIndex(t) + 1), o = e.doc.resolve(a.posAtIndex(r) + 1), s = o.node(), l = o.pos + (n > c ? s.nodeSize - 2 : 0);
1586
+ i.push(w.widget(l, () => {
1337
1587
  let e = document.createElement("div");
1338
- return e.className = "bn-table-drop-cursor", e.style.top = "0", e.style.bottom = "0", n > u ? e.style.right = "-2px" : e.style.left = "-3px", e.style.width = "4px", e;
1588
+ return e.className = "bn-table-drop-cursor", e.style.top = "0", e.style.bottom = "0", n > c ? e.style.right = "-2px" : e.style.left = "-3px", e.style.width = "4px", e;
1339
1589
  }));
1340
- }), A.create(e.doc, r);
1590
+ }), T.create(e.doc, i);
1341
1591
  } }
1342
1592
  })],
1343
1593
  colDragStart(n) {
@@ -1351,7 +1601,7 @@ var Ft = class {
1351
1601
  originalIndex: t.state.colIndex,
1352
1602
  newIndex: t.state.colIndex,
1353
1603
  tablePos: t.tablePos
1354
- })), !e.headless && (jt(e.prosemirrorView.root), n.dataTransfer.setDragImage(X, 0, 0), n.dataTransfer.effectAllowed = "move");
1604
+ })), !e.headless && (Qt(e.prosemirrorView.root), n.dataTransfer.setDragImage(X, 0, 0), n.dataTransfer.effectAllowed = "move");
1355
1605
  },
1356
1606
  rowDragStart(n) {
1357
1607
  if (t.state === void 0 || t.state.rowIndex === void 0) throw Error("Attempted to drag table row, but no table block was hovered prior.");
@@ -1364,11 +1614,11 @@ var Ft = class {
1364
1614
  originalIndex: t.state.rowIndex,
1365
1615
  newIndex: t.state.rowIndex,
1366
1616
  tablePos: t.tablePos
1367
- })), !e.headless && (jt(e.prosemirrorView.root), n.dataTransfer.setDragImage(X, 0, 0), n.dataTransfer.effectAllowed = "copyMove");
1617
+ })), !e.headless && (Qt(e.prosemirrorView.root), n.dataTransfer.setDragImage(X, 0, 0), n.dataTransfer.effectAllowed = "copyMove");
1368
1618
  },
1369
1619
  dragEnd() {
1370
1620
  if (t.state === void 0) throw Error("Attempted to drag table row, but no table block was hovered prior.");
1371
- t.state.draggingState = void 0, t.emitUpdate(), e.transact((e) => e.setMeta(Q, null)), !e.headless && Mt(e.prosemirrorView.root);
1621
+ t.state.draggingState = void 0, t.emitUpdate(), e.transact((e) => e.setMeta(Q, null)), !e.headless && $t(e.prosemirrorView.root);
1372
1622
  },
1373
1623
  freezeHandles() {
1374
1624
  t.menuFrozen = !0;
@@ -1380,7 +1630,7 @@ var Ft = class {
1380
1630
  !t.menuFrozen && t.state?.show && (t.state.show = !1, t.state.showAddOrRemoveRowsButton = !1, t.state.showAddOrRemoveColumnsButton = !1, t.emitUpdate());
1381
1631
  },
1382
1632
  getCellsAtRowHandle(e, t) {
1383
- return o(e, t);
1633
+ return u(e, t);
1384
1634
  },
1385
1635
  getCellsAtColumnHandle(e, t) {
1386
1636
  return a(e, t);
@@ -1388,7 +1638,7 @@ var Ft = class {
1388
1638
  setCellSelection(e, n, r = n) {
1389
1639
  if (!t) throw Error("Table handles view not initialized");
1390
1640
  let i = e.doc.resolve(t.tablePos + 1), a = e.doc.resolve(i.posAtIndex(n.row) + 1), o = e.doc.resolve(a.posAtIndex(n.col)), s = e.doc.resolve(i.posAtIndex(r.row) + 1), c = e.doc.resolve(s.posAtIndex(r.col)), l = e.tr;
1391
- return l.setSelection(new fe(o, c)), e.apply(l);
1641
+ return l.setSelection(new ge(o, c)), e.apply(l);
1392
1642
  },
1393
1643
  addRowOrColumn(t, n) {
1394
1644
  e.exec((e, r) => {
@@ -1399,28 +1649,28 @@ var Ft = class {
1399
1649
  row: 0,
1400
1650
  col: t
1401
1651
  });
1402
- return n.orientation === "row" ? n.side === "above" ? ge(i, r) : he(i, r) : n.side === "left" ? me(i, r) : pe(i, r);
1652
+ return n.orientation === "row" ? n.side === "above" ? be(i, r) : ye(i, r) : n.side === "left" ? ve(i, r) : _e(i, r);
1403
1653
  });
1404
1654
  },
1405
1655
  removeRowOrColumn(t, n) {
1406
- return n === "row" ? e.exec((e, n) => ve(this.setCellSelection(e, {
1656
+ return n === "row" ? e.exec((e, n) => Se(this.setCellSelection(e, {
1407
1657
  row: t,
1408
1658
  col: 0
1409
- }), n)) : e.exec((e, n) => _e(this.setCellSelection(e, {
1659
+ }), n)) : e.exec((e, n) => xe(this.setCellSelection(e, {
1410
1660
  row: 0,
1411
1661
  col: t
1412
1662
  }), n));
1413
1663
  },
1414
1664
  mergeCells(t) {
1415
- return e.exec((e, n) => ye(t ? this.setCellSelection(e, t.relativeStartCell, t.relativeEndCell) : e, n));
1665
+ return e.exec((e, n) => Ce(t ? this.setCellSelection(e, t.relativeStartCell, t.relativeEndCell) : e, n));
1416
1666
  },
1417
1667
  splitCell(t) {
1418
- return e.exec((e, n) => be(t ? this.setCellSelection(e, t) : e, n));
1668
+ return e.exec((e, n) => we(t ? this.setCellSelection(e, t) : e, n));
1419
1669
  },
1420
1670
  getCellSelection() {
1421
1671
  return e.transact((e) => {
1422
1672
  let t = e.selection, n = t.$from, r = t.$to;
1423
- if (m(t)) {
1673
+ if (f(t)) {
1424
1674
  let { ranges: e } = t;
1425
1675
  e.forEach((e) => {
1426
1676
  n = e.$from.min(n ?? e.$from), r = e.$to.max(r ?? e.$to);
@@ -1446,7 +1696,7 @@ var Ft = class {
1446
1696
  },
1447
1697
  getMergeDirection(t) {
1448
1698
  return e.transact((e) => {
1449
- let n = m(e.selection) ? e.selection : void 0;
1699
+ let n = f(e.selection) ? e.selection : void 0;
1450
1700
  if (!n || !t || n.ranges.length <= 1) return;
1451
1701
  let r = this.getCellSelection();
1452
1702
  if (r) return s(r.from, r.to, t) ? "vertical" : "horizontal";
@@ -1456,32 +1706,50 @@ var Ft = class {
1456
1706
  return i(e, t);
1457
1707
  },
1458
1708
  addRowsOrColumns(e, t, n) {
1459
- return ee(e, t, n);
1709
+ return o(e, t, n);
1460
1710
  }
1461
1711
  };
1462
- }), $ = new T("trailingNode"), Lt = b(() => ({
1463
- key: "trailingNode",
1464
- prosemirrorPlugins: [new w({
1465
- key: $,
1466
- appendTransaction: (e, t, n) => {
1467
- let { doc: r, tr: i, schema: a } = n, o = $.getState(n), s = r.content.size - 2, c = a.nodes.blockContainer, l = a.nodes.paragraph;
1468
- if (o) return i.insert(s, c.create(void 0, l.create()));
1469
- },
1470
- state: {
1471
- init: (e, t) => {},
1472
- apply: (e, t) => {
1473
- if (!e.docChanged) return t;
1474
- let n = e.doc.lastChild;
1475
- if (!n || n.type.name !== "blockGroup") throw Error("Expected blockGroup");
1476
- if (n = n.lastChild, !n || n.type.name !== "blockContainer") return !0;
1477
- let r = n.firstChild;
1478
- if (!r) throw Error("Expected blockContent");
1479
- return n.nodeSize > 4 || r.type.spec.content !== "inline*";
1480
- }
1481
- }
1482
- })]
1483
- }));
1712
+ }), $ = new x("trailingNode");
1713
+ function an(e, t) {
1714
+ if (!t) return !1;
1715
+ let n = e.lastChild?.lastChild, r = n?.firstChild;
1716
+ return !(n?.type.name === "blockContainer" && r?.type.name === "paragraph" && r.content.size === 0);
1717
+ }
1718
+ var on = v(({ editor: e }) => {
1719
+ function t(t) {
1720
+ return w.widget(t, () => {
1721
+ let t = document.createElement("div");
1722
+ return t.className = "bn-trailing-block", t.contentEditable = "false", t.addEventListener("mousedown", (t) => {
1723
+ t.preventDefault(), e.transact((t) => {
1724
+ let [n] = e.insertBlocks([{ type: "paragraph" }], e.document[e.document.length - 1], "after");
1725
+ e.setTextCursorPosition(n, "start"), t.scrollIntoView();
1726
+ }), e.prosemirrorView?.focus();
1727
+ }), t;
1728
+ }, { side: 1 });
1729
+ }
1730
+ function n(e, n, r) {
1731
+ let i = n.map(e.mapping, e.doc), a = i.find(), o = a.length > 0;
1732
+ return o === an(e.doc, r) ? i : o ? i.remove(a) : i.add(e.doc, [t(e.doc.content.size - 1)]);
1733
+ }
1734
+ return {
1735
+ key: "trailingNode",
1736
+ prosemirrorPlugins: [new b({
1737
+ key: $,
1738
+ state: {
1739
+ init: (t, r) => n(r.tr, T.empty, e.isEditable),
1740
+ apply: (t, r) => !t.docChanged && !t.getMeta($) ? r : n(t, r, e.isEditable)
1741
+ },
1742
+ view(e) {
1743
+ let t = e.editable;
1744
+ return { update(e) {
1745
+ e.editable !== t && (t = e.editable, e.dispatch(e.state.tr.setMeta($, !0)));
1746
+ } };
1747
+ },
1748
+ props: { decorations: (e) => $.getState(e) }
1749
+ })]
1750
+ };
1751
+ });
1484
1752
  //#endregion
1485
- export { qe as C, We as D, B as E, R as O, Ye as S, V as T, it as _, At as a, et as b, Dt as c, G as d, pt as f, at as g, ot as h, Q as i, I as k, yt as l, ct as m, It as n, Ot as o, ut as p, Ft as r, Et as s, Lt as t, vt as u, rt as v, H as w, tt as x, nt as y };
1753
+ export { j as C, Ke as D, qe as E, O, Ze as S, k as T, ct as _, Zt as a, ot as b, Jt as c, W as d, _t as f, lt as g, ut as h, Q as i, Vt as l, ft as m, rn as n, Yt as o, mt as p, nn as r, J as s, on as t, Bt as u, st as v, A as w, $e as x, at as y };
1486
1754
 
1487
- //# sourceMappingURL=extensions-C3nguvVr.js.map
1755
+ //# sourceMappingURL=extensions-CQFfm5f5.js.map