@blocknote/core 0.52.1 → 0.54.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 (221) hide show
  1. package/dist/BlockNoteExtension-BJCLnwrE.cjs +2 -0
  2. package/dist/BlockNoteExtension-BJCLnwrE.cjs.map +1 -0
  3. package/dist/BlockNoteExtension-CbvDA0F7.js +80 -0
  4. package/dist/BlockNoteExtension-CbvDA0F7.js.map +1 -0
  5. package/dist/{UserStore-QbbPFj0z.js → UserStore-C4TzkGEn.js} +3 -3
  6. package/dist/{UserStore-DCG6lsla.cjs.map → UserStore-C4TzkGEn.js.map} +1 -1
  7. package/dist/{UserStore-DCG6lsla.cjs → UserStore-mj3fXW4D.cjs} +2 -2
  8. package/dist/UserStore-mj3fXW4D.cjs.map +1 -0
  9. package/dist/blocknote.cjs +1 -1
  10. package/dist/blocknote.js +6 -6
  11. package/dist/{blocks-CiuUGa1E.js → blocks-CzQLehlc.js} +695 -652
  12. package/dist/blocks-CzQLehlc.js.map +1 -0
  13. package/dist/blocks-CzkqclGj.cjs +12 -0
  14. package/dist/blocks-CzkqclGj.cjs.map +1 -0
  15. package/dist/blocks.cjs +1 -1
  16. package/dist/blocks.js +2 -2
  17. package/dist/comments.cjs +1 -1
  18. package/dist/comments.cjs.map +1 -1
  19. package/dist/comments.js +7 -7
  20. package/dist/comments.js.map +1 -1
  21. package/dist/en-BuzSuuTq.cjs +2 -0
  22. package/dist/en-BuzSuuTq.cjs.map +1 -0
  23. package/dist/{en-CGKXfWma.js → en-uzHzj6eH.js} +10 -1
  24. package/dist/en-uzHzj6eH.js.map +1 -0
  25. package/dist/extensions-CSB9ZvuL.cjs +58 -0
  26. package/dist/extensions-CSB9ZvuL.cjs.map +1 -0
  27. package/dist/{extensions-CrUGDOks.js → extensions-DGuhtOgB.js} +717 -452
  28. package/dist/extensions-DGuhtOgB.js.map +1 -0
  29. package/dist/extensions.cjs +1 -1
  30. package/dist/extensions.js +4 -4
  31. package/dist/locales.cjs +1 -1
  32. package/dist/locales.cjs.map +1 -1
  33. package/dist/locales.js +199 -1
  34. package/dist/locales.js.map +1 -1
  35. package/dist/{src-DTF83Cl9.js → src-BkfZVfaO.js} +921 -835
  36. package/dist/src-BkfZVfaO.js.map +1 -0
  37. package/dist/src-DM3syMdf.cjs +23 -0
  38. package/dist/src-DM3syMdf.cjs.map +1 -0
  39. package/dist/style.css +1 -1
  40. package/dist/webpack-stats.json +1 -1
  41. package/dist/y.cjs +1 -1
  42. package/dist/y.cjs.map +1 -1
  43. package/dist/y.js +65 -62
  44. package/dist/y.js.map +1 -1
  45. package/dist/yjs.cjs +1 -1
  46. package/dist/yjs.cjs.map +1 -1
  47. package/dist/yjs.js +88 -76
  48. package/dist/yjs.js.map +1 -1
  49. package/package.json +29 -30
  50. package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +2505 -763
  51. package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +42 -0
  52. package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +16 -4
  53. package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +10 -1
  54. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +42 -8
  55. package/src/api/exporters/markdown/htmlToMarkdown.ts +45 -10
  56. package/src/api/exporters/markdown/markdownExporter.ts +10 -1
  57. package/src/api/nodeConversions/blockToNode.ts +5 -1
  58. package/src/api/nodeConversions/nodeToBlock.ts +3 -0
  59. package/src/api/parsers/html/parseHTML.ts +43 -0
  60. package/src/api/pmUtil.ts +16 -8
  61. package/src/blocks/Code/CodeBlockOptions.ts +83 -0
  62. package/src/blocks/Code/block.test.ts +1 -1
  63. package/src/blocks/Code/block.ts +29 -281
  64. package/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.ts +120 -0
  65. package/src/blocks/Code/helpers/parse/parsePreCode.ts +45 -0
  66. package/src/blocks/Code/helpers/render/createCodeBlock.ts +98 -0
  67. package/src/blocks/Code/helpers/toExternalHTML/createPreCode.ts +14 -0
  68. package/src/blocks/Table/TableExtension.test.ts +102 -0
  69. package/src/blocks/ToggleWrapper/createToggleWrapper.ts +16 -5
  70. package/src/blocks/defaultBlockTypeGuards.ts +6 -0
  71. package/src/blocks/index.ts +3 -0
  72. package/src/comments/extension.ts +2 -4
  73. package/src/editor/Block.css +324 -3
  74. package/src/editor/BlockNoteEditor.ts +25 -4
  75. package/src/editor/BlockNoteExtension.ts +1 -1
  76. package/src/editor/managers/ExtensionManager/extensions.ts +6 -0
  77. package/src/exporter/ExportImage.ts +50 -0
  78. package/src/exporter/Exporter.test.ts +48 -0
  79. package/src/exporter/Exporter.ts +46 -12
  80. package/src/exporter/index.ts +1 -0
  81. package/src/exporter/mapping.ts +4 -1
  82. package/src/extensions/FormattingToolbar/FormattingToolbar.ts +10 -8
  83. package/src/extensions/InlineContentBoundaryEdit/InlineContentBoundaryEdit.ts +109 -0
  84. package/src/extensions/SideMenu/SideMenu.ts +20 -3
  85. package/src/extensions/SourceBlockWithPreview/SourceBlockWithPreview.ts +192 -0
  86. package/src/extensions/SourceInlineContentWithPreview/SourceInlineContentWithPreview.ts +142 -0
  87. package/src/extensions/SuggestionMenu/SuggestionMenu.test.ts +118 -0
  88. package/src/extensions/SuggestionMenu/SuggestionMenu.ts +40 -27
  89. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +13 -3
  90. package/src/extensions/SyntaxHighlighting/SyntaxHighlighting.test.ts +120 -0
  91. package/src/extensions/SyntaxHighlighting/SyntaxHighlighting.ts +89 -0
  92. package/src/extensions/SyntaxHighlighting/inlineHighlight.test.ts +135 -0
  93. package/src/extensions/SyntaxHighlighting/shiki.ts +116 -0
  94. package/src/extensions/TableHandles/TableHandles.ts +25 -12
  95. package/src/extensions/TrailingNode/TrailingNode.ts +98 -32
  96. package/src/extensions/Versioning/inMemoryVersioning.ts +13 -3
  97. package/src/extensions/index.ts +4 -0
  98. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.ts +51 -2
  99. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +22 -2
  100. package/src/i18n/locales/ar.ts +9 -0
  101. package/src/i18n/locales/de.ts +9 -0
  102. package/src/i18n/locales/en.ts +9 -0
  103. package/src/i18n/locales/es.ts +9 -0
  104. package/src/i18n/locales/fa.ts +9 -0
  105. package/src/i18n/locales/fr.ts +9 -0
  106. package/src/i18n/locales/he.ts +9 -0
  107. package/src/i18n/locales/hr.ts +9 -0
  108. package/src/i18n/locales/is.ts +9 -0
  109. package/src/i18n/locales/it.ts +9 -0
  110. package/src/i18n/locales/ja.ts +9 -0
  111. package/src/i18n/locales/ko.ts +9 -0
  112. package/src/i18n/locales/nl.ts +9 -0
  113. package/src/i18n/locales/no.ts +9 -0
  114. package/src/i18n/locales/pl.ts +9 -0
  115. package/src/i18n/locales/pt.ts +9 -0
  116. package/src/i18n/locales/ru.ts +9 -0
  117. package/src/i18n/locales/sk.ts +9 -0
  118. package/src/i18n/locales/uk.ts +9 -0
  119. package/src/i18n/locales/uz.ts +9 -0
  120. package/src/i18n/locales/vi.ts +9 -0
  121. package/src/i18n/locales/zh-tw.ts +9 -0
  122. package/src/i18n/locales/zh.ts +9 -0
  123. package/src/index.ts +6 -1
  124. package/src/schema/blocks/createSpec.ts +17 -5
  125. package/src/schema/blocks/internal.test.ts +86 -0
  126. package/src/schema/blocks/internal.ts +64 -0
  127. package/src/schema/blocks/types.ts +53 -3
  128. package/src/schema/contentTypePropagation.test.ts +1 -1
  129. package/src/schema/inlineContent/createSpec.test.ts +161 -0
  130. package/src/schema/inlineContent/createSpec.ts +180 -13
  131. package/src/schema/inlineContent/internal.ts +21 -2
  132. package/src/schema/inlineContent/types.ts +35 -5
  133. package/src/schema/nodeViewMutations.test.ts +121 -0
  134. package/src/schema/nodeViewMutations.ts +46 -0
  135. package/src/user/UserStore.ts +1 -1
  136. package/src/util/Store.test.ts +132 -0
  137. package/src/util/Store.ts +135 -0
  138. package/src/y/extensions/AttributionExtension.test.ts +10 -0
  139. package/src/y/extensions/Versioning.test.ts +20 -7
  140. package/src/yjs/comments/RESTYjsThreadStore.test.ts +85 -0
  141. package/src/yjs/comments/RESTYjsThreadStore.ts +7 -1
  142. package/src/yjs/extensions/ForkYDoc.test.ts +37 -0
  143. package/src/yjs/extensions/ForkYDoc.ts +26 -1
  144. package/src/yjs/extensions/RelativePositionMapping.ts +8 -2
  145. package/src/yjs/extensions/Versioning.test.ts +17 -5
  146. package/types/src/api/exporters/html/util/serializeBlocksExternalHTML.d.ts +13 -0
  147. package/types/src/api/pmUtil.d.ts +7 -7
  148. package/types/src/blocks/Code/CodeBlockOptions.d.ts +61 -0
  149. package/types/src/blocks/Code/block.d.ts +3 -53
  150. package/types/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.d.ts +35 -0
  151. package/types/src/blocks/Code/helpers/parse/parsePreCode.d.ts +8 -0
  152. package/types/src/blocks/Code/helpers/render/createCodeBlock.d.ts +18 -0
  153. package/types/src/blocks/Code/helpers/toExternalHTML/createPreCode.d.ts +5 -0
  154. package/types/src/blocks/defaultBlockTypeGuards.d.ts +2 -0
  155. package/types/src/blocks/index.d.ts +3 -0
  156. package/types/src/comments/extension.d.ts +1 -15
  157. package/types/src/editor/BlockNoteEditor.d.ts +3 -3
  158. package/types/src/editor/BlockNoteExtension.d.ts +1 -1
  159. package/types/src/exporter/ExportImage.d.ts +36 -0
  160. package/types/src/exporter/Exporter.d.ts +21 -0
  161. package/types/src/exporter/Exporter.test.d.ts +1 -0
  162. package/types/src/exporter/index.d.ts +1 -0
  163. package/types/src/exporter/mapping.d.ts +1 -1
  164. package/types/src/extensions/FilePanel/FilePanel.d.ts +1 -1
  165. package/types/src/extensions/FormattingToolbar/FormattingToolbar.d.ts +1 -1
  166. package/types/src/extensions/InlineContentBoundaryEdit/InlineContentBoundaryEdit.d.ts +5 -0
  167. package/types/src/extensions/ShowSelection/ShowSelection.d.ts +1 -5
  168. package/types/src/extensions/SideMenu/SideMenu.d.ts +6 -1
  169. package/types/src/extensions/SourceBlockWithPreview/SourceBlockWithPreview.d.ts +45 -0
  170. package/types/src/extensions/SourceInlineContentWithPreview/SourceInlineContentWithPreview.d.ts +49 -0
  171. package/types/src/extensions/SuggestionMenu/SuggestionMenu.d.ts +7 -11
  172. package/types/src/extensions/SyntaxHighlighting/SyntaxHighlighting.d.ts +44 -0
  173. package/types/src/extensions/SyntaxHighlighting/SyntaxHighlighting.test.d.ts +1 -0
  174. package/types/src/extensions/SyntaxHighlighting/inlineHighlight.test.d.ts +1 -0
  175. package/types/src/extensions/SyntaxHighlighting/shiki.d.ts +13 -0
  176. package/types/src/extensions/TableHandles/TableHandles.d.ts +1 -1
  177. package/types/src/extensions/TrailingNode/TrailingNode.d.ts +5 -4
  178. package/types/src/extensions/Versioning/Versioning.d.ts +1 -35
  179. package/types/src/extensions/index.d.ts +4 -0
  180. package/types/src/i18n/locales/en.d.ts +9 -0
  181. package/types/src/i18n/locales/fa.d.ts +9 -0
  182. package/types/src/i18n/locales/sk.d.ts +9 -0
  183. package/types/src/index.d.ts +3 -1
  184. package/types/src/schema/blocks/internal.d.ts +21 -0
  185. package/types/src/schema/blocks/internal.test.d.ts +1 -0
  186. package/types/src/schema/blocks/types.d.ts +36 -3
  187. package/types/src/schema/inlineContent/createSpec.d.ts +35 -3
  188. package/types/src/schema/inlineContent/createSpec.test.d.ts +1 -0
  189. package/types/src/schema/inlineContent/internal.d.ts +3 -2
  190. package/types/src/schema/inlineContent/types.d.ts +22 -3
  191. package/types/src/schema/nodeViewMutations.d.ts +3 -0
  192. package/types/src/schema/nodeViewMutations.test.d.ts +1 -0
  193. package/types/src/user/UserStore.d.ts +1 -1
  194. package/types/src/util/Store.d.ts +45 -0
  195. package/types/src/util/Store.test.d.ts +1 -0
  196. package/types/src/y/extensions/AttributionExtension.d.ts +1 -1
  197. package/types/src/y/extensions/DiffVersioningExtension.d.ts +1 -1
  198. package/types/src/y/extensions/ForkYDoc.d.ts +1 -5
  199. package/types/src/y/extensions/index.d.ts +2 -10
  200. package/types/src/yjs/comments/RESTYjsThreadStore.test.d.ts +1 -0
  201. package/types/src/yjs/extensions/ForkYDoc.d.ts +1 -5
  202. package/types/src/yjs/extensions/index.d.ts +1 -5
  203. package/dist/BlockNoteExtension-B_IEJHS8.js +0 -38
  204. package/dist/BlockNoteExtension-B_IEJHS8.js.map +0 -1
  205. package/dist/BlockNoteExtension-M0znTzxP.cjs +0 -2
  206. package/dist/BlockNoteExtension-M0znTzxP.cjs.map +0 -1
  207. package/dist/UserStore-QbbPFj0z.js.map +0 -1
  208. package/dist/blocks-BqHv0xhc.cjs +0 -12
  209. package/dist/blocks-BqHv0xhc.cjs.map +0 -1
  210. package/dist/blocks-CiuUGa1E.js.map +0 -1
  211. package/dist/en-C5Z4Ag9_.cjs +0 -2
  212. package/dist/en-C5Z4Ag9_.cjs.map +0 -1
  213. package/dist/en-CGKXfWma.js.map +0 -1
  214. package/dist/extensions-CrUGDOks.js.map +0 -1
  215. package/dist/extensions-Ghr9QqqR.cjs +0 -52
  216. package/dist/extensions-Ghr9QqqR.cjs.map +0 -1
  217. package/dist/src-DTF83Cl9.js.map +0 -1
  218. package/dist/src-OfbaVbMw.cjs +0 -21
  219. package/dist/src-OfbaVbMw.cjs.map +0 -1
  220. package/src/blocks/Code/shiki.ts +0 -73
  221. package/types/src/blocks/Code/shiki.d.ts +0 -4
package/dist/y.js CHANGED
@@ -1,8 +1,8 @@
1
- import { D as e, jt as t, vn as n } from "./blocks-CiuUGa1E.js";
2
- import { i as r, n as i, t as a } from "./BlockNoteExtension-B_IEJHS8.js";
3
- import { _ as o, h as s, v as c, y as l } from "./src-DTF83Cl9.js";
4
- import { a as u, i as d, o as f } from "./extensions-CrUGDOks.js";
5
- import { n as p } from "./UserStore-QbbPFj0z.js";
1
+ import { It as e, O as t, wn as n } from "./blocks-CzQLehlc.js";
2
+ import { a as r, n as i, t as a } from "./BlockNoteExtension-CbvDA0F7.js";
3
+ import { _ as o, b as s, x as c, y as l } from "./src-BkfZVfaO.js";
4
+ import { a as u, i as d, o as f } from "./extensions-DGuhtOgB.js";
5
+ import { n as p } from "./UserStore-C4TzkGEn.js";
6
6
  import { t as m } from "./ThreadStore-et9wB5Xt.js";
7
7
  import { Mark as h, getChangedRanges as g, getMarkRange as _, posToDOMRect as ee } from "@tiptap/core";
8
8
  import { uint32 as te, uuidv4 as v } from "lib0/random";
@@ -13,19 +13,19 @@ import * as w from "@y/y";
13
13
  import { decodeAny as T, encodeAny as E } from "lib0/buffer";
14
14
  //#region src/y/extensions/YAttributionMarks.ts
15
15
  var D = (e, t) => e === void 0 ? void 0 : typeof e == "string" ? e : e[t], O = (e, t) => ({ mark: n, inline: r }) => {
16
- let i = t?.editor, a = e === "insert" ? "ins" : e === "delete" ? "del" : r ? "span" : "div", s = document.createElement(a);
17
- Object.assign(s.dataset, {
16
+ let i = t?.editor, a = e === "insert" ? "ins" : e === "delete" ? "del" : r ? "span" : "div", o = document.createElement(a);
17
+ Object.assign(o.dataset, {
18
18
  userIds: JSON.stringify(n.attrs.userIds),
19
19
  inline: String(r)
20
- }), e === "modification" && (s.dataset.type = "modification", s.dataset.format = JSON.stringify(n.attrs.format));
20
+ }), e === "modification" && (o.dataset.type = "modification", o.dataset.format = JSON.stringify(n.attrs.format));
21
21
  let u = D(t?.getAttributionMarkClassName?.({
22
22
  contentType: r ? "inline-content" : "block",
23
23
  modificationType: e === "modification" ? "format" : e
24
- }), "content"), d = (n.attrs.userIds ?? [])[0], f = d ? o(d) : c[0];
25
- if (u) s.style.cssText = "display: contents";
24
+ }), "content"), d = (n.attrs.userIds ?? [])[0], f = d ? l(d) : s[0];
25
+ if (u) o.style.cssText = "display: contents";
26
26
  else {
27
- let e = d ? `var(${l(d).light}, ${f.light})` : f.light, t = d ? `var(${l(d).dark}, ${f.dark})` : f.dark;
28
- s.style.cssText = `display: contents; --user-color-light: ${e}; --user-color-dark: ${t}`;
27
+ let e = d ? `var(${c(d).light}, ${f.light})` : f.light, t = d ? `var(${c(d).dark}, ${f.dark})` : f.dark;
28
+ o.style.cssText = `display: contents; --user-color-light: ${e}; --user-color-dark: ${t}`;
29
29
  }
30
30
  let p = document.createElement("span");
31
31
  if (r) p.className = u ?? (e === "delete" ? "bn-suggestion-mark bn-suggestion-mark--delete" : "bn-suggestion-mark");
@@ -33,15 +33,15 @@ var D = (e, t) => e === void 0 ? void 0 : typeof e == "string" ? e : e[t], O = (
33
33
  let e = i?.dictionary.suggestion_changes.deleted;
34
34
  e && p.style.setProperty("--deleted-label", JSON.stringify(e));
35
35
  }
36
- return s.appendChild(p), {
37
- dom: s,
36
+ return o.appendChild(p), {
37
+ dom: o,
38
38
  contentDOM: p
39
39
  };
40
40
  }, k = h.create({
41
41
  name: "y-attributed-insert",
42
42
  inclusive: !1,
43
43
  excludes: "",
44
- group: `${e} ${r}`,
44
+ group: `${t} ${r}`,
45
45
  addAttributes() {
46
46
  return { userIds: { default: null } };
47
47
  },
@@ -55,7 +55,7 @@ var D = (e, t) => e === void 0 ? void 0 : typeof e == "string" ? e : e[t], O = (
55
55
  name: "y-attributed-delete",
56
56
  inclusive: !1,
57
57
  excludes: "",
58
- group: `${e} ${r}`,
58
+ group: `${t} ${r}`,
59
59
  addAttributes() {
60
60
  return { userIds: { default: null } };
61
61
  },
@@ -72,7 +72,7 @@ var D = (e, t) => e === void 0 ? void 0 : typeof e == "string" ? e : e[t], O = (
72
72
  name: "y-attributed-format",
73
73
  inclusive: !1,
74
74
  excludes: "",
75
- group: `${e} ${r}`,
75
+ group: `${t} ${r}`,
76
76
  addAttributes() {
77
77
  return {
78
78
  userIds: { default: null },
@@ -141,19 +141,19 @@ var D = (e, t) => e === void 0 ? void 0 : typeof e == "string" ? e : e[t], O = (
141
141
  }
142
142
  })],
143
143
  mount({ dom: e, root: i, signal: a }) {
144
- let o = () => {
144
+ let s = () => {
145
145
  for (let [n, r] of t.store.state) {
146
- let { light: t, dark: i } = l(n);
146
+ let { light: t, dark: i } = c(n);
147
147
  r.color && r.colorLight ? (e.style.setProperty(t, r.colorLight), e.style.setProperty(i, r.color)) : (e.style.removeProperty(t), e.style.removeProperty(i));
148
148
  }
149
- }, c, u = (e) => N(e).map((e) => t.getUser(e)?.username ?? e), d = (e) => {
149
+ }, l, u = (e) => N(e).map((e) => t.getUser(e)?.username ?? e), d = (e) => {
150
150
  let t = N(e.dataset.userIds);
151
151
  return t.length === 0 ? "" : `${P(e.dataset.format).join(",")}:${t.join(",")}`;
152
152
  }, f = (e) => {
153
153
  let r = e.dataset.format !== void 0, i = r ? "format" : e.tagName === "INS" ? "insert" : "delete", a = e.dataset.inline === "false" ? "block" : "inline-content";
154
154
  return {
155
155
  anchor: e,
156
- color: s(t, N(e.dataset.userIds)).dark,
156
+ color: o(t, N(e.dataset.userIds)).dark,
157
157
  modificationType: i,
158
158
  contentType: a,
159
159
  users: u(e.dataset.userIds),
@@ -164,7 +164,7 @@ var D = (e, t) => e === void 0 ? void 0 : typeof e == "string" ? e : e[t], O = (
164
164
  }), "tooltip")
165
165
  };
166
166
  }, p = () => {
167
- c && (c = void 0, r.setState(void 0));
167
+ l && (l = void 0, r.setState(void 0));
168
168
  }, m = (e) => {
169
169
  for (; e;) {
170
170
  let t = e.closest(M);
@@ -174,28 +174,28 @@ var D = (e, t) => e === void 0 ? void 0 : typeof e == "string" ? e : e[t], O = (
174
174
  }
175
175
  };
176
176
  i.addEventListener("mouseover", (e) => {
177
- let n = m(e.target instanceof Element ? e.target : null);
178
- if (!n) {
177
+ let n = e.target instanceof Element ? e.target : null, i = m(n);
178
+ if (!i) {
179
179
  p();
180
180
  return;
181
181
  }
182
- let i = d(n), a = n, o = n.parentElement;
183
- for (; o;) {
184
- let e = o.closest(M);
182
+ let a = d(i), o = i, s = i.parentElement;
183
+ for (; s;) {
184
+ let e = s.closest(M);
185
185
  if (!e) break;
186
186
  let t = d(e);
187
- if (t === i) a = e;
187
+ if (t === a) o = e;
188
188
  else if (t) break;
189
- o = e.parentElement;
189
+ s = e.parentElement;
190
190
  }
191
- if (c === a) return;
192
- c = a, r.setState(f(a));
193
- let s = N(a.dataset.userIds);
194
- s.length > 0 && t.loadUsers(s).then(() => {
195
- c === a && r.setState(f(a));
191
+ if (l === o) return;
192
+ l = o, r.setState(f(o));
193
+ let c = N(o.dataset.userIds);
194
+ c.length > 0 && t.loadUsers(c).then(() => {
195
+ l === o && r.setState(f(o));
196
196
  });
197
- }, { signal: a }), a.addEventListener("abort", p), o();
198
- let h = t.store.subscribe(o);
197
+ }, { signal: a }), a.addEventListener("abort", p), s();
198
+ let h = t.store.subscribe(s);
199
199
  a.addEventListener("abort", h);
200
200
  },
201
201
  blockNoteExtensions: [j({ getAttributionMarkClassName: e?.getAttributionMarkClassName })]
@@ -282,12 +282,13 @@ var V = (e, t) => {
282
282
  let n = () => {
283
283
  t.exec(y({ ytype: e.fragment }));
284
284
  };
285
- if (e.provider && "synced" in e.provider && typeof e.provider.synced == "boolean") if (e.provider.synced) n();
286
- else if ("on" in e.provider && typeof e.provider.on == "function") e.provider.on("synced", (e) => {
287
- e && n();
288
- });
289
- else throw Error("YSyncExtension: provider must have a 'synced' boolean or an 'on' method to listen for 'sync'");
290
- else n();
285
+ if (e.provider && "synced" in e.provider && typeof e.provider.synced == "boolean") {
286
+ if (e.provider.synced) n();
287
+ else if ("on" in e.provider && typeof e.provider.on == "function") e.provider.on("synced", (e) => {
288
+ e && n();
289
+ });
290
+ else throw Error("YSyncExtension: provider must have a 'synced' boolean or an 'on' method to listen for 'sync'");
291
+ } else n();
291
292
  },
292
293
  prosemirrorPlugins: [he({
293
294
  suggestionDoc: e.suggestionDoc,
@@ -305,7 +306,8 @@ function W(e, t) {
305
306
  let r = Array.from(n.share.keys()).find((t) => n.share.get(t) === e);
306
307
  if (r == null) throw Error("type does not exist in other ydoc");
307
308
  return t.get(r, e.constructor);
308
- } else {
309
+ }
310
+ {
309
311
  let n = e._item, r = t.store.clients.get(n.id.client) ?? [], i = r[w.findIndexSS(r, n.id.clock)];
310
312
  if (!i) throw Error("type does not exist in other ydoc");
311
313
  let a = i.content;
@@ -314,11 +316,12 @@ function W(e, t) {
314
316
  }
315
317
  }
316
318
  function Se(e, t) {
317
- return n(e.pmSchema.nodeFromJSON(t));
319
+ let r = e.pmSchema.nodeFromJSON(t);
320
+ return n(r);
318
321
  }
319
- function G(e, n) {
320
- let r = n.map((n) => t(n, e.pmSchema));
321
- return e.pmSchema.topNodeType.create(null, e.pmSchema.nodes.blockGroup.create(null, r));
322
+ function G(t, n) {
323
+ let r = n.map((n) => e(n, t.pmSchema));
324
+ return t.pmSchema.topNodeType.create(null, t.pmSchema.nodes.blockGroup.create(null, r));
322
325
  }
323
326
  function K(e, t) {
324
327
  let r = ce(t.toDeltaDeep(), e.pmSchema, null);
@@ -339,8 +342,8 @@ function q(e, t) {
339
342
  return C.diff(n.done(), r.done(), { compare: V });
340
343
  }
341
344
  function J({ tr: e, fragment: t, renderer: n }) {
342
- let r = se(t.toDeltaDeep({ renderer: n }), H), i = x(e.doc, void 0, !0);
343
- return le(e, C.diff(i.done(), r.done(), { compare: V }), void 0, void 0);
345
+ let r = se(t.toDeltaDeep({ renderer: n }), H), i = x(e.doc, void 0, !0), a = C.diff(i.done(), r.done(), { compare: V });
346
+ return le(e, a, void 0, void 0);
344
347
  }
345
348
  //#endregion
346
349
  //#region src/y/extensions/Suggestions.ts
@@ -410,11 +413,11 @@ var Ee = a(({ editor: e, options: t }) => {
410
413
  getSuggestionAtSelection: o,
411
414
  getSuggestionAtCoords: (t) => e.transact(() => {
412
415
  let n = e.prosemirrorView.posAtCoords(t);
413
- if (!(n === null || n?.inside === -1)) return a(n.pos, "y-attributed-insert") || a(n.pos, "y-attributed-delete") || a(n.pos, "y-attributed-format");
416
+ if (n !== null && n?.inside !== -1) return a(n.pos, "y-attributed-insert") || a(n.pos, "y-attributed-delete") || a(n.pos, "y-attributed-format");
414
417
  }),
415
418
  checkUnresolvedSuggestions: () => {
416
419
  let t = !1;
417
- return e.prosemirrorState.doc.descendants((e) => t ? !1 : (t = e.marks.findIndex((e) => e.type.name === "y-attributed-insert" || e.type.name === "y-attributed-delete" || e.type.name === "y-attributed-format") !== -1, !0)), t;
420
+ return e.prosemirrorState.doc.descendants((e) => !t && (t = e.marks.findIndex((e) => e.type.name === "y-attributed-insert" || e.type.name === "y-attributed-delete" || e.type.name === "y-attributed-format") !== -1, !0)), t;
418
421
  }
419
422
  };
420
423
  });
@@ -932,12 +935,12 @@ function Ye(e) {
932
935
  by: a?.id
933
936
  };
934
937
  }, _ = async (e) => {
935
- let t = await $(`${c}?${new URLSearchParams({
938
+ let t = new URLSearchParams({
936
939
  ydoc: "true",
937
940
  to: String(e)
938
- })}`, i), n = T(new Uint8Array(t));
939
- if (!n.nextDoc) throw Error(`YHub returned no document state at timestamp ${e}.`);
940
- return w.convertUpdateFormatV1ToV2(n.nextDoc);
941
+ }), n = await $(`${c}?${t}`, i), r = T(new Uint8Array(n));
942
+ if (!r.nextDoc) throw Error(`YHub returned no document state at timestamp ${e}.`);
943
+ return w.convertUpdateFormatV1ToV2(r.nextDoc);
941
944
  };
942
945
  return {
943
946
  list: async () => {
@@ -947,25 +950,25 @@ function Ye(e) {
947
950
  customAttributions: "true"
948
951
  });
949
952
  c.set("groupMaxGap", String(t)), o !== void 0 && c.set("group", String(o)), n !== void 0 && c.set("groupMaxDuration", String(n)), r !== void 0 && c.set("mergeUsers", String(r));
950
- let l = await $(`${s}?${c}`, i), u = f(T(new Uint8Array(l)).map((e, t) => Je(e, t)).filter((e) => e !== void 0).map((e) => {
953
+ let l = await $(`${s}?${c}`, i), u = T(new Uint8Array(l)), d = f(u.map((e, t) => Je(e, t)).filter((e) => e !== void 0).map((e) => {
951
954
  let t = e.name, n = (typeof e.id == "string" ? p()?.getAttr(e.id) : void 0) ?? t;
952
955
  return {
953
956
  ...e,
954
957
  name: n
955
958
  };
956
- })), d = await m();
957
- return d ? [d, ...u] : u;
959
+ })), h = await m();
960
+ return h ? [h, ...d] : d;
958
961
  },
959
962
  create: g,
960
963
  getContent: async (e) => _(e.createdAt),
961
964
  getAttributions: async (e, t) => {
962
- let n = e.createdAt, r = t === void 0 ? 0 : t.createdAt, a = await $(`${c}?${new URLSearchParams({
965
+ let n = e.createdAt, r = t === void 0 ? 0 : t.createdAt, a = new URLSearchParams({
963
966
  from: String(r),
964
967
  to: String(n),
965
968
  attributions: "true"
966
- })}`, i), o = T(new Uint8Array(a));
967
- if (!o.attributions) throw Error(`YHub returned no attributions for snapshot ${String(e.id)}.`);
968
- return w.decodeContentMap(o.attributions);
969
+ }), o = await $(`${c}?${a}`, i), s = T(new Uint8Array(o));
970
+ if (!s.attributions) throw Error(`YHub returned no attributions for snapshot ${String(e.id)}.`);
971
+ return w.decodeContentMap(s.attributions);
969
972
  },
970
973
  restore: async (e, t) => {
971
974
  let n = t.createdAt, r = await _(n);