@blocknote/core 0.51.4 → 0.52.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 (396) hide show
  1. package/dist/BlockNoteExtension-B_IEJHS8.js +38 -0
  2. package/dist/BlockNoteExtension-B_IEJHS8.js.map +1 -0
  3. package/dist/BlockNoteExtension-M0znTzxP.cjs +2 -0
  4. package/dist/BlockNoteExtension-M0znTzxP.cjs.map +1 -0
  5. package/dist/ThreadStore-Bx-gSEh1.cjs +2 -0
  6. package/dist/ThreadStore-Bx-gSEh1.cjs.map +1 -0
  7. package/dist/ThreadStore-et9wB5Xt.js +11 -0
  8. package/dist/ThreadStore-et9wB5Xt.js.map +1 -0
  9. package/dist/UserStore-DCG6lsla.cjs +2 -0
  10. package/dist/UserStore-DCG6lsla.cjs.map +1 -0
  11. package/dist/UserStore-QbbPFj0z.js +73 -0
  12. package/dist/UserStore-QbbPFj0z.js.map +1 -0
  13. package/dist/blocknote.cjs +1 -1
  14. package/dist/blocknote.js +6 -7
  15. package/dist/blocks-BqHv0xhc.cjs +12 -0
  16. package/dist/blocks-BqHv0xhc.cjs.map +1 -0
  17. package/dist/{blocks-DGsP5WKr.js → blocks-CiuUGa1E.js} +1093 -994
  18. package/dist/blocks-CiuUGa1E.js.map +1 -0
  19. package/dist/blocks.cjs +1 -1
  20. package/dist/blocks.js +2 -2
  21. package/dist/comments.cjs +1 -1
  22. package/dist/comments.cjs.map +1 -1
  23. package/dist/comments.js +75 -340
  24. package/dist/comments.js.map +1 -1
  25. package/dist/{en-Cj5r8sW_.cjs → en-C5Z4Ag9_.cjs} +2 -2
  26. package/dist/en-C5Z4Ag9_.cjs.map +1 -0
  27. package/dist/{en-B9hMApn4.js → en-CGKXfWma.js} +9 -1
  28. package/dist/en-CGKXfWma.js.map +1 -0
  29. package/dist/{extensions-Co4y7P63.js → extensions-CrUGDOks.js} +655 -583
  30. package/dist/extensions-CrUGDOks.js.map +1 -0
  31. package/dist/extensions-Ghr9QqqR.cjs +52 -0
  32. package/dist/extensions-Ghr9QqqR.cjs.map +1 -0
  33. package/dist/extensions.cjs +1 -1
  34. package/dist/extensions.js +4 -4
  35. package/dist/locales.cjs +1 -1
  36. package/dist/locales.cjs.map +1 -1
  37. package/dist/locales.js +177 -1
  38. package/dist/locales.js.map +1 -1
  39. package/dist/{src-Bcud0PIg.js → src-DTF83Cl9.js} +1243 -1297
  40. package/dist/src-DTF83Cl9.js.map +1 -0
  41. package/dist/src-OfbaVbMw.cjs +21 -0
  42. package/dist/src-OfbaVbMw.cjs.map +1 -0
  43. package/dist/style.css +1 -1
  44. package/dist/webpack-stats.json +1 -1
  45. package/dist/y.cjs +2 -0
  46. package/dist/y.cjs.map +1 -0
  47. package/dist/y.js +989 -0
  48. package/dist/y.js.map +1 -0
  49. package/dist/yjs.cjs +1 -1
  50. package/dist/yjs.cjs.map +1 -1
  51. package/dist/yjs.js +535 -14
  52. package/dist/yjs.js.map +1 -1
  53. package/package.json +46 -19
  54. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts +1 -1
  55. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +1 -1
  56. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +3 -3
  57. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +25 -20
  58. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +39 -29
  59. package/src/api/blockManipulation/commands/nestBlock/nestBlock.test.ts +2 -2
  60. package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +4 -8
  61. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.ts +1 -1
  62. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +21 -9
  63. package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +6 -5
  64. package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +362 -4
  65. package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +240 -30
  66. package/src/api/blockManipulation/getBlock/getBlock.ts +4 -9
  67. package/src/api/blockManipulation/selections/selection.ts +3 -6
  68. package/src/api/blockManipulation/selections/textCursorPosition.ts +10 -10
  69. package/src/api/blockManipulation/setupTestEnv.ts +1 -1
  70. package/src/api/blockManipulation/tables/tables.test.ts +1 -1
  71. package/src/api/clipboard/fromClipboard/fileDropExtension.ts +1 -1
  72. package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +8 -4
  73. package/src/api/clipboard/fromClipboard/pasteExtension.ts +1 -1
  74. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +2 -1
  75. package/src/api/exporters/markdown/htmlToMarkdown.ts +79 -43
  76. package/src/api/getBlockInfoFromPos.test.ts +256 -0
  77. package/src/api/getBlockInfoFromPos.ts +53 -15
  78. package/src/api/getBlocksChangedByTransaction.test.ts +2 -1
  79. package/src/api/getBlocksChangedByTransaction.ts +6 -6
  80. package/src/api/nodeConversions/blockToNode.test.ts +113 -0
  81. package/src/api/nodeConversions/blockToNode.ts +15 -3
  82. package/src/api/nodeConversions/fragmentToBlocks.ts +2 -4
  83. package/src/api/nodeConversions/nodeToBlock.ts +28 -58
  84. package/src/api/nodeUtil.ts +6 -2
  85. package/src/api/parsers/html/parseHTML.ts +1 -1
  86. package/src/api/parsers/html/util/nestedLists.test.ts +1 -1
  87. package/src/api/parsers/markdown/detectMarkdown.test.ts +1 -1
  88. package/src/api/parsers/markdown/markdownToHtml.ts +228 -82
  89. package/src/api/pmUtil.ts +18 -1
  90. package/src/api/positionMapping.test.ts +20 -345
  91. package/src/api/positionMapping.ts +13 -83
  92. package/src/blocks/Audio/block.ts +1 -1
  93. package/src/blocks/Code/block.test.ts +14 -7
  94. package/src/blocks/Code/block.ts +2 -2
  95. package/src/blocks/Image/block.ts +1 -1
  96. package/src/blocks/ListItem/CheckListItem/block.test.ts +1 -1
  97. package/src/blocks/ListItem/ListItemKeyboardShortcuts.ts +2 -2
  98. package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.test.ts +4 -11
  99. package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts +47 -50
  100. package/src/blocks/Table/TableExtension.test.ts +9 -6
  101. package/src/blocks/Table/TableExtension.ts +20 -6
  102. package/src/blocks/Table/block.ts +18 -5
  103. package/src/blocks/Video/block.ts +1 -1
  104. package/src/blocks/utils/listItemEnterHandler.ts +3 -2
  105. package/src/comments/extension.ts +30 -21
  106. package/src/comments/index.ts +0 -3
  107. package/src/comments/mark.ts +4 -0
  108. package/src/comments/threadstore/ThreadStore.ts +4 -8
  109. package/src/comments/types.ts +0 -8
  110. package/src/editor/Block.css +307 -3
  111. package/src/editor/BlockNoteEditor.test.ts +21 -18
  112. package/src/editor/BlockNoteEditor.ts +22 -57
  113. package/src/editor/BlockNoteExtension.test.ts +1 -1
  114. package/src/editor/managers/BlockManager.ts +1 -1
  115. package/src/editor/managers/ExtensionManager/ExtensionManager.test.ts +249 -0
  116. package/src/editor/managers/ExtensionManager/extensions.ts +7 -18
  117. package/src/editor/managers/ExtensionManager/index.ts +168 -68
  118. package/src/editor/managers/StateManager.ts +4 -3
  119. package/src/editor/performance.test.ts +14 -1
  120. package/src/editor/transformPasted.test.ts +1 -1
  121. package/src/extensions/Placeholder/Placeholder.ts +1 -0
  122. package/src/extensions/PositionMapping/PositionMapping.ts +68 -0
  123. package/src/extensions/PreviousBlockType/PreviousBlockType.test.ts +14 -1
  124. package/src/extensions/PreviousBlockType/PreviousBlockType.ts +14 -11
  125. package/src/extensions/SideMenu/SideMenu.ts +9 -2
  126. package/src/extensions/SuggestionMenu/SuggestionMenu.test.ts +1 -1
  127. package/src/extensions/TableHandles/TableHandles.ts +18 -20
  128. package/src/extensions/TrailingNode/TrailingNode.ts +33 -1
  129. package/src/extensions/Versioning/Versioning.test.ts +435 -0
  130. package/src/extensions/Versioning/Versioning.ts +628 -0
  131. package/src/extensions/Versioning/inMemoryVersioning.test.ts +469 -0
  132. package/src/extensions/Versioning/inMemoryVersioning.ts +263 -0
  133. package/src/extensions/Versioning/index.ts +2 -0
  134. package/src/extensions/index.ts +6 -9
  135. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.ts +155 -0
  136. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +6 -8
  137. package/src/extensions/tiptap-extensions/Link/helpers/autolink.ts +9 -9
  138. package/src/extensions/tiptap-extensions/Link/helpers/linkDetector.ts +8 -10
  139. package/src/extensions/tiptap-extensions/Link/helpers/whitespace.ts +2 -2
  140. package/src/extensions/tiptap-extensions/Link/link.test.ts +26 -22
  141. package/src/extensions/tiptap-extensions/UniqueID/UniqueID.test.ts +187 -0
  142. package/src/extensions/tiptap-extensions/UniqueID/UniqueID.ts +37 -24
  143. package/src/extensions/tiptap-extensions/index.ts +1 -25
  144. package/src/i18n/locales/ar.ts +9 -0
  145. package/src/i18n/locales/de.ts +9 -0
  146. package/src/i18n/locales/en.ts +10 -1
  147. package/src/i18n/locales/es.ts +9 -0
  148. package/src/i18n/locales/fa.ts +11 -1
  149. package/src/i18n/locales/fr.ts +9 -0
  150. package/src/i18n/locales/he.ts +10 -1
  151. package/src/i18n/locales/hr.ts +10 -0
  152. package/src/i18n/locales/is.ts +10 -0
  153. package/src/i18n/locales/it.ts +9 -0
  154. package/src/i18n/locales/ja.ts +9 -0
  155. package/src/i18n/locales/ko.ts +9 -0
  156. package/src/i18n/locales/nl.ts +10 -0
  157. package/src/i18n/locales/no.ts +10 -0
  158. package/src/i18n/locales/pl.ts +9 -0
  159. package/src/i18n/locales/pt.ts +10 -0
  160. package/src/i18n/locales/ru.ts +10 -0
  161. package/src/i18n/locales/sk.ts +10 -1
  162. package/src/i18n/locales/uk.ts +9 -0
  163. package/src/i18n/locales/uz.ts +9 -0
  164. package/src/i18n/locales/vi.ts +9 -0
  165. package/src/i18n/locales/zh-tw.ts +9 -0
  166. package/src/i18n/locales/zh.ts +9 -0
  167. package/src/index.ts +2 -0
  168. package/src/pm-nodes/BlockContainer.ts +4 -1
  169. package/src/pm-nodes/BlockGroup.ts +4 -1
  170. package/src/pm-nodes/Doc.ts +4 -1
  171. package/src/pm-nodes/suggestionMarks.ts +43 -0
  172. package/src/schema/blocks/createSpec.test.ts +123 -0
  173. package/src/schema/blocks/createSpec.ts +82 -24
  174. package/src/schema/blocks/extendBlockSpec.test.ts +188 -0
  175. package/src/schema/blocks/internal.ts +13 -43
  176. package/src/schema/blocks/types.ts +69 -22
  177. package/src/schema/contentTypePropagation.test.ts +182 -0
  178. package/src/schema/index.ts +1 -0
  179. package/src/schema/inlineContent/internal.ts +1 -1
  180. package/src/schema/inlineContent/types.ts +3 -3
  181. package/src/schema/markGroups.ts +50 -0
  182. package/src/user/UserStore.ts +199 -0
  183. package/src/user/createUserStore.test.ts +126 -0
  184. package/src/user/index.ts +2 -0
  185. package/src/user/userColors.ts +72 -0
  186. package/src/util/string.ts +1 -1
  187. package/src/util/topo-sort.test.ts +1 -1
  188. package/src/util/typescript.ts +2 -1
  189. package/src/vite-env.d.ts +1 -1
  190. package/src/y/README.md +5 -0
  191. package/src/{comments/threadstore/yjs → y/comments}/RESTYjsThreadStore.ts +8 -14
  192. package/src/y/comments/YjsThreadStore.test.ts +295 -0
  193. package/src/y/comments/YjsThreadStore.ts +358 -0
  194. package/src/y/comments/YjsThreadStoreBase.ts +50 -0
  195. package/src/y/comments/index.ts +3 -0
  196. package/src/y/comments/yjsHelpers.ts +125 -0
  197. package/src/y/extensions/AttributionExtension.test.ts +86 -0
  198. package/src/y/extensions/AttributionExtension.ts +378 -0
  199. package/src/y/extensions/DiffVersioningExtension.test.ts +193 -0
  200. package/src/y/extensions/DiffVersioningExtension.ts +228 -0
  201. package/src/y/extensions/ForkYDoc.test.ts +253 -0
  202. package/src/y/extensions/ForkYDoc.ts +108 -0
  203. package/src/y/extensions/RelativePositionMapping.test.ts +418 -0
  204. package/src/y/extensions/RelativePositionMapping.ts +49 -0
  205. package/src/y/extensions/Suggestions.ts +174 -0
  206. package/src/y/extensions/Versioning.test.ts +395 -0
  207. package/src/y/extensions/Versioning.ts +115 -0
  208. package/src/y/extensions/YAttributionMarks.ts +320 -0
  209. package/src/{extensions/Collaboration → y/extensions}/YCursorPlugin.ts +15 -7
  210. package/src/y/extensions/YSync.ts +125 -0
  211. package/src/y/extensions/blockMatchNodes.ts +182 -0
  212. package/src/y/extensions/index.ts +156 -0
  213. package/src/y/index.ts +4 -0
  214. package/src/y/utils.test.ts +1042 -0
  215. package/src/y/utils.ts +242 -0
  216. package/src/y/versioning/__test__/fixtures/activity-all-after.bin +0 -0
  217. package/src/y/versioning/__test__/fixtures/activity-all-after.json +50 -0
  218. package/src/y/versioning/__test__/fixtures/activity-all.bin +0 -0
  219. package/src/y/versioning/__test__/fixtures/activity-all.json +20 -0
  220. package/src/y/versioning/__test__/fixtures/activity-filtered-after.bin +0 -0
  221. package/src/y/versioning/__test__/fixtures/activity-filtered-after.json +32 -0
  222. package/src/y/versioning/__test__/fixtures/activity-filtered-before.json +1 -0
  223. package/src/y/versioning/__test__/fixtures/changeset.bin +0 -0
  224. package/src/y/versioning/__test__/fixtures/patch-response.json +4 -0
  225. package/src/y/versioning/__test__/yhub.test.ts +752 -0
  226. package/src/y/versioning/index.ts +1 -0
  227. package/src/y/versioning/yhub.ts +631 -0
  228. package/src/yjs/README.md +5 -0
  229. package/src/yjs/comments/RESTYjsThreadStore.ts +166 -0
  230. package/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStore.test.ts +3 -3
  231. package/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStore.ts +7 -3
  232. package/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStoreBase.ts +3 -3
  233. package/src/yjs/comments/index.ts +3 -0
  234. package/src/{comments/threadstore/yjs → yjs/comments}/yjsHelpers.ts +5 -1
  235. package/src/yjs/extensions/FixUpSchema.test.ts +421 -0
  236. package/src/yjs/extensions/FixUpSchema.ts +88 -0
  237. package/src/yjs/extensions/ForkYDoc.test.ts +216 -0
  238. package/src/{extensions/Collaboration → yjs/extensions}/ForkYDoc.ts +38 -57
  239. package/src/yjs/extensions/RelativePositionMapping.test.ts +418 -0
  240. package/src/yjs/extensions/RelativePositionMapping.ts +71 -0
  241. package/src/yjs/extensions/Versioning.test.ts +549 -0
  242. package/src/yjs/extensions/Versioning.ts +83 -0
  243. package/src/yjs/extensions/YCursorPlugin.ts +201 -0
  244. package/src/{extensions/Collaboration → yjs/extensions}/YSync.ts +1 -1
  245. package/src/yjs/extensions/index.ts +89 -0
  246. package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/moveColorAttributes.test.ts +1 -1
  247. package/src/yjs/index.ts +2 -0
  248. package/src/yjs/utils.test.ts +5 -15
  249. package/src/yjs/utils.ts +36 -0
  250. package/types/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.d.ts +3 -1
  251. package/types/src/api/blockManipulation/selections/selection.d.ts +1 -1
  252. package/types/src/api/getBlockInfoFromPos.d.ts +5 -9
  253. package/types/src/api/nodeConversions/nodeToBlock.d.ts +4 -6
  254. package/types/src/api/pmUtil.d.ts +12 -1
  255. package/types/src/blocks/Audio/block.d.ts +2 -2
  256. package/types/src/blocks/Code/block.d.ts +2 -2
  257. package/types/src/blocks/File/block.d.ts +2 -2
  258. package/types/src/blocks/Heading/block.d.ts +21 -21
  259. package/types/src/blocks/Image/block.d.ts +3 -3
  260. package/types/src/blocks/ListItem/CheckListItem/block.d.ts +6 -6
  261. package/types/src/blocks/ListItem/NumberedListItem/block.d.ts +6 -6
  262. package/types/src/blocks/Video/block.d.ts +3 -3
  263. package/types/src/blocks/defaultBlocks.d.ts +17 -17
  264. package/types/src/comments/extension.d.ts +18 -5
  265. package/types/src/comments/index.d.ts +0 -3
  266. package/types/src/comments/threadstore/ThreadStore.d.ts +4 -8
  267. package/types/src/comments/types.d.ts +0 -8
  268. package/types/src/editor/BlockNoteEditor.d.ts +8 -9
  269. package/types/src/editor/managers/BlockManager.d.ts +1 -1
  270. package/types/src/editor/managers/ExtensionManager/extensions.d.ts +2 -2
  271. package/types/src/editor/managers/ExtensionManager/index.d.ts +13 -0
  272. package/types/src/editor/managers/SelectionManager.d.ts +1 -1
  273. package/types/src/extensions/PositionMapping/PositionMapping.d.ts +4 -0
  274. package/types/src/extensions/TableHandles/TableHandles.d.ts +6 -6
  275. package/types/src/extensions/Versioning/Versioning.d.ts +352 -0
  276. package/types/src/extensions/Versioning/Versioning.test.d.ts +1 -0
  277. package/types/src/extensions/Versioning/inMemoryVersioning.d.ts +37 -0
  278. package/types/src/extensions/Versioning/inMemoryVersioning.test.d.ts +1 -0
  279. package/types/src/extensions/Versioning/index.d.ts +2 -0
  280. package/types/src/extensions/index.d.ts +6 -9
  281. package/types/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.d.ts +1 -0
  282. package/types/src/extensions/tiptap-extensions/UniqueID/UniqueID.d.ts +6 -1
  283. package/types/src/extensions/tiptap-extensions/UniqueID/UniqueID.test.d.ts +4 -0
  284. package/types/src/extensions/tiptap-extensions/index.d.ts +1 -5
  285. package/types/src/i18n/locales/en.d.ts +9 -1
  286. package/types/src/i18n/locales/fa.d.ts +9 -1
  287. package/types/src/i18n/locales/sk.d.ts +9 -1
  288. package/types/src/index.d.ts +2 -0
  289. package/types/src/pm-nodes/suggestionMarks.d.ts +26 -0
  290. package/types/src/schema/blocks/createSpec.d.ts +4 -4
  291. package/types/src/schema/blocks/createSpec.test.d.ts +1 -0
  292. package/types/src/schema/blocks/extendBlockSpec.test.d.ts +1 -0
  293. package/types/src/schema/blocks/internal.d.ts +5 -7
  294. package/types/src/schema/blocks/types.d.ts +22 -14
  295. package/types/src/schema/contentTypePropagation.test.d.ts +1 -0
  296. package/types/src/schema/index.d.ts +1 -0
  297. package/types/src/schema/inlineContent/types.d.ts +3 -3
  298. package/types/src/schema/markGroups.d.ts +33 -0
  299. package/types/src/user/UserStore.d.ts +105 -0
  300. package/types/src/user/createUserStore.test.d.ts +1 -0
  301. package/types/src/user/index.d.ts +2 -0
  302. package/types/src/user/userColors.d.ts +36 -0
  303. package/types/src/y/comments/RESTYjsThreadStore.d.ts +77 -0
  304. package/types/src/y/comments/YjsThreadStore.d.ts +79 -0
  305. package/types/src/y/comments/YjsThreadStore.test.d.ts +1 -0
  306. package/types/src/y/comments/YjsThreadStoreBase.d.ts +15 -0
  307. package/types/src/y/comments/index.d.ts +3 -0
  308. package/types/src/y/comments/yjsHelpers.d.ts +13 -0
  309. package/types/src/y/extensions/AttributionExtension.d.ts +74 -0
  310. package/types/src/y/extensions/AttributionExtension.test.d.ts +1 -0
  311. package/types/src/y/extensions/DiffVersioningExtension.d.ts +69 -0
  312. package/types/src/y/extensions/DiffVersioningExtension.test.d.ts +1 -0
  313. package/types/src/{extensions/Collaboration → y/extensions}/ForkYDoc.d.ts +4 -2
  314. package/types/src/y/extensions/ForkYDoc.test.d.ts +1 -0
  315. package/types/src/y/extensions/RelativePositionMapping.d.ts +4 -0
  316. package/types/src/y/extensions/RelativePositionMapping.test.d.ts +1 -0
  317. package/types/src/y/extensions/Suggestions.d.ts +36 -0
  318. package/types/src/y/extensions/Versioning.d.ts +17 -0
  319. package/types/src/y/extensions/Versioning.test.d.ts +1 -0
  320. package/types/src/y/extensions/YAttributionMarks.d.ts +67 -0
  321. package/types/src/y/extensions/YCursorPlugin.d.ts +14 -0
  322. package/types/src/y/extensions/YSync.d.ts +32 -0
  323. package/types/src/y/extensions/blockMatchNodes.d.ts +25 -0
  324. package/types/src/y/extensions/index.d.ts +189 -0
  325. package/types/src/y/index.d.ts +4 -0
  326. package/types/src/y/utils.d.ts +82 -0
  327. package/types/src/y/utils.test.d.ts +1 -0
  328. package/types/src/y/versioning/__test__/yhub.test.d.ts +1 -0
  329. package/types/src/y/versioning/index.d.ts +1 -0
  330. package/types/src/y/versioning/yhub.d.ts +87 -0
  331. package/types/src/{comments/threadstore/yjs → yjs/comments}/RESTYjsThreadStore.d.ts +6 -10
  332. package/types/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStore.d.ts +3 -3
  333. package/types/src/yjs/comments/YjsThreadStore.test.d.ts +1 -0
  334. package/types/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStoreBase.d.ts +3 -3
  335. package/types/src/yjs/comments/index.d.ts +3 -0
  336. package/types/src/{comments/threadstore/yjs → yjs/comments}/yjsHelpers.d.ts +1 -1
  337. package/types/src/yjs/extensions/FixUpSchema.d.ts +3 -0
  338. package/types/src/yjs/extensions/FixUpSchema.test.d.ts +1 -0
  339. package/types/src/yjs/extensions/ForkYDoc.d.ts +27 -0
  340. package/types/src/yjs/extensions/ForkYDoc.test.d.ts +1 -0
  341. package/types/src/yjs/extensions/RelativePositionMapping.d.ts +4 -0
  342. package/types/src/yjs/extensions/RelativePositionMapping.test.d.ts +1 -0
  343. package/types/src/yjs/extensions/Versioning.d.ts +26 -0
  344. package/types/src/yjs/extensions/Versioning.test.d.ts +1 -0
  345. package/types/src/{extensions/Collaboration → yjs/extensions}/YCursorPlugin.d.ts +5 -2
  346. package/types/src/{extensions/Collaboration → yjs/extensions}/YSync.d.ts +1 -1
  347. package/types/src/{extensions/Collaboration/Collaboration.d.ts → yjs/extensions/index.d.ts} +36 -15
  348. package/types/src/yjs/extensions/schemaMigration/migrationRules/moveColorAttributes.test.d.ts +1 -0
  349. package/types/src/yjs/index.d.ts +2 -0
  350. package/types/src/yjs/utils.d.ts +5 -0
  351. package/dist/BlockNoteExtension-B6RhuQ3V.js +0 -27
  352. package/dist/BlockNoteExtension-B6RhuQ3V.js.map +0 -1
  353. package/dist/BlockNoteExtension-ab0REuob.cjs +0 -2
  354. package/dist/BlockNoteExtension-ab0REuob.cjs.map +0 -1
  355. package/dist/EventEmitter-CuPnGDYt.js +0 -22
  356. package/dist/EventEmitter-CuPnGDYt.js.map +0 -1
  357. package/dist/EventEmitter-DHdSnYCD.cjs +0 -2
  358. package/dist/EventEmitter-DHdSnYCD.cjs.map +0 -1
  359. package/dist/ShowSelection-BsHFfdMi.js +0 -29
  360. package/dist/ShowSelection-BsHFfdMi.js.map +0 -1
  361. package/dist/ShowSelection-DhXglbt8.cjs +0 -2
  362. package/dist/ShowSelection-DhXglbt8.cjs.map +0 -1
  363. package/dist/blocks-Bm6IfL1R.cjs +0 -11
  364. package/dist/blocks-Bm6IfL1R.cjs.map +0 -1
  365. package/dist/blocks-DGsP5WKr.js.map +0 -1
  366. package/dist/en-B9hMApn4.js.map +0 -1
  367. package/dist/en-Cj5r8sW_.cjs.map +0 -1
  368. package/dist/extensions-Co4y7P63.js.map +0 -1
  369. package/dist/extensions-IJK3t0sz.cjs +0 -52
  370. package/dist/extensions-IJK3t0sz.cjs.map +0 -1
  371. package/dist/src-B6rlChSc.cjs +0 -21
  372. package/dist/src-B6rlChSc.cjs.map +0 -1
  373. package/dist/src-Bcud0PIg.js.map +0 -1
  374. package/src/comments/userstore/UserStore.ts +0 -72
  375. package/src/extensions/Collaboration/Collaboration.ts +0 -55
  376. package/src/extensions/Collaboration/ForkYDoc.test.ts +0 -179
  377. package/src/extensions/tiptap-extensions/Suggestions/SuggestionMarks.ts +0 -175
  378. package/types/src/comments/userstore/UserStore.d.ts +0 -31
  379. package/types/src/extensions/tiptap-extensions/Suggestions/SuggestionMarks.d.ts +0 -4
  380. /package/src/{extensions/Collaboration → yjs/extensions}/YUndo.ts +0 -0
  381. /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap-editor-forked.json +0 -0
  382. /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap-editor.json +0 -0
  383. /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap-forked.html +0 -0
  384. /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap.html +0 -0
  385. /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/SchemaMigration.ts +0 -0
  386. /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/index.ts +0 -0
  387. /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/migrationRule.ts +0 -0
  388. /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/moveColorAttributes.ts +0 -0
  389. /package/types/src/{comments/threadstore/yjs/YjsThreadStore.test.d.ts → api/getBlockInfoFromPos.test.d.ts} +0 -0
  390. /package/types/src/{extensions/Collaboration/ForkYDoc.test.d.ts → api/nodeConversions/blockToNode.test.d.ts} +0 -0
  391. /package/types/src/{extensions/Collaboration/schemaMigration/migrationRules/moveColorAttributes.test.d.ts → editor/managers/ExtensionManager/ExtensionManager.test.d.ts} +0 -0
  392. /package/types/src/{extensions/Collaboration → yjs/extensions}/YUndo.d.ts +0 -0
  393. /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/SchemaMigration.d.ts +0 -0
  394. /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/index.d.ts +0 -0
  395. /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/migrationRule.d.ts +0 -0
  396. /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/moveColorAttributes.d.ts +0 -0
@@ -0,0 +1,69 @@
1
+ import type { Block } from "../../blocks/defaultBlocks.js";
2
+ import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
3
+ import type { User } from "../../user/index.js";
4
+ import type { GetAttributionMarkClassName } from "./YAttributionMarks.js";
5
+ export type DiffVersioningExtensionOptions = {
6
+ /**
7
+ * The color used for the diff's attribution marks. Defaults to a blue.
8
+ */
9
+ color?: string;
10
+ /**
11
+ * See {@link GetAttributionMarkClassName}. Forwarded to the underlying
12
+ * {@link AttributionExtension} to override mark styling by change type.
13
+ */
14
+ getAttributionMarkClassName?: GetAttributionMarkClassName;
15
+ };
16
+ /**
17
+ * An opt-in extension that renders a read-only diff between two BlockNote
18
+ * documents (`Block[]`) directly in the editor, marking insertions/deletions
19
+ * with the `y-attributed-*` suggestion marks — the same visual result the Yjs
20
+ * collaboration adapter produces, but driven from two plain block arrays with
21
+ * no server and no live Yjs sync.
22
+ *
23
+ * It composes {@link AttributionExtension} (which registers the attribution
24
+ * marks and drives their colors + hover tooltips from a user store), and adds
25
+ * the {@link renderDiff} / {@link clearDiff} capability.
26
+ *
27
+ * Registering this extension is what makes non-collaborative versioning
28
+ * (`inMemoryVersioning`) capable of showing diffs: the in-memory preview
29
+ * controller looks this up by key (`"diffVersioning"`) and delegates to
30
+ * {@link renderDiff}, falling back to a static document swap when it's absent.
31
+ *
32
+ * `renderDiff` is also a standalone, directly-callable API — you can register
33
+ * just this extension and call
34
+ * `editor.getExtension(DiffVersioningExtension).renderDiff(target, baseline)`
35
+ * to render a known diff (e.g. in tests).
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const editor = BlockNoteEditor.create({
40
+ * extensions: [DiffVersioningExtension()],
41
+ * });
42
+ * editor.getExtension(DiffVersioningExtension)!.renderDiff(target, baseline);
43
+ * ```
44
+ */
45
+ export declare const DiffVersioningExtension: (options?: DiffVersioningExtensionOptions | undefined) => import("../../index.js").ExtensionFactoryInstance<{
46
+ key: string;
47
+ blockNoteExtensions: import("../../index.js").ExtensionFactoryInstance<{
48
+ key: string;
49
+ userStore: import("../../index.js").UserStore<User>;
50
+ store: import("@tanstack/store").Store<import("./AttributionExtension.js").AttributionTooltipState | undefined, (cb: import("./AttributionExtension.js").AttributionTooltipState | undefined) => import("./AttributionExtension.js").AttributionTooltipState | undefined>;
51
+ prosemirrorPlugins: import("prosemirror-state").Plugin<null>[];
52
+ mount({ dom, root, signal }: {
53
+ dom: HTMLElement;
54
+ root: Document | ShadowRoot;
55
+ signal: AbortSignal;
56
+ }): void;
57
+ blockNoteExtensions: import("../../index.js").ExtensionFactoryInstance<{
58
+ key: string;
59
+ tiptapExtensions: (import("@tiptap/core").Mark<{
60
+ getAttributionMarkClassName?: GetAttributionMarkClassName;
61
+ }, any> | import("@tiptap/core").Mark<{
62
+ editor?: BlockNoteEditor<any, any, any>;
63
+ getAttributionMarkClassName?: GetAttributionMarkClassName;
64
+ }, any>)[];
65
+ }>[];
66
+ }>[];
67
+ renderDiff: (snapshotBlocks: Block<any, any, any>[], baselineBlocks: Block<any, any, any>[], versionLabel?: string) => void;
68
+ clearDiff: (restore: Block<any, any, any>[]) => void;
69
+ }>;
@@ -1,4 +1,4 @@
1
- import { CollaborationOptions } from "./Collaboration.js";
1
+ import { CollaborationOptions } from "./index.js";
2
2
  export declare const ForkYDocExtension: (options: CollaborationOptions) => import("../../index.js").ExtensionFactoryInstance<{
3
3
  readonly key: "yForkDoc";
4
4
  readonly store: import("@tanstack/store").Store<{
@@ -13,7 +13,9 @@ export declare const ForkYDocExtension: (options: CollaborationOptions) => impor
13
13
  * allowing modifications to the document without affecting the remote.
14
14
  * These changes can later be rolled back or applied to the remote.
15
15
  */
16
- readonly fork: () => void;
16
+ readonly fork: ({ initialUpdate, }?: {
17
+ initialUpdate?: Uint8Array;
18
+ }) => void;
17
19
  /**
18
20
  * Resume syncing the Y.js document to the remote
19
21
  * If `keepChanges` is true, any changes that have been made to the forked document will be applied to the original document.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare const RelativePositionMappingExtension: (options?: any) => import("../../index.js").ExtensionFactoryInstance<{
2
+ readonly key: "yPositionMapping";
3
+ readonly mapPosition: (position: number, side?: "left" | "right") => () => number;
4
+ }>;
@@ -0,0 +1,36 @@
1
+ import { CollaborationOptions } from "./index.js";
2
+ export declare const SuggestionsExtension: (options: CollaborationOptions) => import("../../index.js").ExtensionFactoryInstance<{
3
+ readonly key: "suggestions";
4
+ readonly userStore: import("../../index.js").UserStore<import("../../index.js").User>;
5
+ readonly runsBefore: readonly ["ySync"];
6
+ readonly viewSuggestions: () => void;
7
+ readonly enableSuggestions: () => void;
8
+ readonly disableSuggestions: () => void;
9
+ readonly applyAllSuggestions: () => boolean;
10
+ readonly applySuggestion: (start: number, end?: number) => boolean;
11
+ readonly revertSuggestion: (start: number, end?: number) => boolean;
12
+ readonly revertAllSuggestions: () => boolean;
13
+ readonly getSuggestionElementAtPos: (pos: number) => HTMLElement | null;
14
+ readonly getMarkAtPos: (pos: number, markType: string) => {
15
+ range: import("@tiptap/core").Range;
16
+ mark: import("prosemirror-model").Mark;
17
+ readonly text: string;
18
+ readonly position: DOMRect;
19
+ } | undefined;
20
+ readonly getSuggestionAtSelection: () => {
21
+ range: import("@tiptap/core").Range;
22
+ mark: import("prosemirror-model").Mark;
23
+ readonly text: string;
24
+ readonly position: DOMRect;
25
+ } | undefined;
26
+ readonly getSuggestionAtCoords: (coords: {
27
+ left: number;
28
+ top: number;
29
+ }) => {
30
+ range: import("@tiptap/core").Range;
31
+ mark: import("prosemirror-model").Mark;
32
+ readonly text: string;
33
+ readonly position: DOMRect;
34
+ } | undefined;
35
+ readonly checkUnresolvedSuggestions: () => false;
36
+ }>;
@@ -0,0 +1,17 @@
1
+ import * as Y from "@y/y";
2
+ import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
3
+ import type { PreviewController } from "../../extensions/Versioning/index.js";
4
+ /**
5
+ * Creates a Yjs-specific adapter that provides the {@link PreviewController}
6
+ * and `getCurrentDocument` callback required by the base
7
+ * {@link VersioningExtension}.
8
+ *
9
+ * This is wired automatically by the {@link CollaborationExtension} when
10
+ * `versioningEndpoints` is provided. You only need to call this directly if
11
+ * you're using the `VersioningExtension` outside of the collaboration wrapper.
12
+ */
13
+ export declare function createYjsVersioningAdapter(editor: BlockNoteEditor<any, any, any>, fragment: Y.Type): {
14
+ preview: PreviewController<Uint8Array, Y.ContentMap>;
15
+ getCurrentDocument: () => Y.Type;
16
+ serializeCurrentContent: () => Uint8Array;
17
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,67 @@
1
+ import { Mark } from "@tiptap/core";
2
+ import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
3
+ /**
4
+ * Describes a suggestion mark to {@link GetAttributionMarkClassName}: whether it
5
+ * wraps inline content or a whole block, and which kind of change it represents.
6
+ * `modificationType: "format"` corresponds to the `y-attributed-format`
7
+ * (modification) mark.
8
+ */
9
+ export type AttributionMarkStyleInfo = {
10
+ contentType: "inline-content" | "block";
11
+ modificationType: "insert" | "delete" | "format";
12
+ };
13
+ /**
14
+ * The class name(s) an app returns to style a suggestion mark. Either:
15
+ * - a single string applied to *both* the mark content and its hover tooltip, or
16
+ * - `{ content, tooltip }` to style the mark content and the tooltip
17
+ * independently.
18
+ */
19
+ export type AttributionMarkClassNames = string | {
20
+ content: string;
21
+ tooltip: string;
22
+ };
23
+ /**
24
+ * Optional callback to override suggestion-mark styling. Given a mark's
25
+ * {@link AttributionMarkStyleInfo}, it returns the class name(s) to apply (see
26
+ * {@link AttributionMarkClassNames}). When a class is returned, the default
27
+ * per-user color (the `--user-color-*` custom properties and the built-in
28
+ * `.bn-suggestion-mark` / `.bn-suggestion-node` styling) is *not* applied to the
29
+ * mark content, so the class fully controls its appearance — letting an app
30
+ * color suggestions by change type (e.g. green insertions, red deletions)
31
+ * instead of by author.
32
+ */
33
+ export type GetAttributionMarkClassName = (info: AttributionMarkStyleInfo) => AttributionMarkClassNames;
34
+ /**
35
+ * Resolve the {@link AttributionMarkClassNames} returned by a
36
+ * {@link GetAttributionMarkClassName} callback to the class name for a single
37
+ * target (the mark `content` or its `tooltip`).
38
+ */
39
+ export declare const resolveAttributionMarkClassName: (result: AttributionMarkClassNames | undefined, target: "content" | "tooltip") => string | undefined;
40
+ export declare const YAttributedInsertion: Mark<{
41
+ getAttributionMarkClassName?: GetAttributionMarkClassName;
42
+ }, any>;
43
+ export declare const YAttributedDeletion: Mark<{
44
+ editor?: BlockNoteEditor<any, any, any>;
45
+ getAttributionMarkClassName?: GetAttributionMarkClassName;
46
+ }, any>;
47
+ export declare const YAttributedFormat: Mark<{
48
+ getAttributionMarkClassName?: GetAttributionMarkClassName;
49
+ }, any>;
50
+ /**
51
+ * Bundles the three `y-attributed-*` suggestion marks into a single BlockNote
52
+ * extension, so they can be registered wherever they're actually needed (the
53
+ * Yjs collaboration extension, or a test that exercises suggestions) instead of
54
+ * living in the default schema. The marks opt into being allowed on block nodes
55
+ * via their `blockLevelSuggestion` option — see `suggestionMarks`.
56
+ */
57
+ export declare const YAttributionMarksExtension: (options?: {
58
+ getAttributionMarkClassName?: GetAttributionMarkClassName;
59
+ } | undefined) => import("../../index.js").ExtensionFactoryInstance<{
60
+ key: string;
61
+ tiptapExtensions: (Mark<{
62
+ getAttributionMarkClassName?: GetAttributionMarkClassName;
63
+ }, any> | Mark<{
64
+ editor?: BlockNoteEditor<any, any, any>;
65
+ getAttributionMarkClassName?: GetAttributionMarkClassName;
66
+ }, any>)[];
67
+ }>;
@@ -0,0 +1,14 @@
1
+ import { CollaborationOptions } from "./index.js";
2
+ export type CollaborationUser = {
3
+ id?: string;
4
+ name: string;
5
+ color: string;
6
+ [key: string]: unknown;
7
+ };
8
+ export declare const YCursorExtension: (options: CollaborationOptions) => import("../../index.js").ExtensionFactoryInstance<{
9
+ readonly key: "yCursor";
10
+ readonly prosemirrorPlugins: import("prosemirror-state").Plugin<import("prosemirror-view").DecorationSet>[];
11
+ readonly dependsOn: readonly ["ySync"];
12
+ readonly updateUser: (user: CollaborationUser) => void;
13
+ readonly getUser: () => CollaborationUser | undefined;
14
+ }>;
@@ -0,0 +1,32 @@
1
+ import { CollaborationOptions } from "./index.js";
2
+ /**
3
+ * Maps a Y attribution to BlockNote's `y-attributed-*` mark attrs.
4
+ *
5
+ * The mapper must be deterministic in `(format, attribution)` and emit attrs
6
+ * that exactly match the declared mark schema in YAttributionMarks.ts. Any
7
+ * mismatch causes the sync plugin to fire phantom reconcile dispatches in a
8
+ * loop. See ATTRIBUTION.md in @y/prosemirror.
9
+ *
10
+ * Crucially the marks carry only stable identity (`userIds`, plus `format` for
11
+ * the modification mark) — *not* user colors. Colors resolve asynchronously
12
+ * from the {@link UserStore}, so baking them in here would make the mapper's
13
+ * output change under a fixed `(format, attribution)` once a user loads, which
14
+ * is exactly the non-determinism that triggers the reconcile loop. Instead the
15
+ * `AttributionExtension` applies colors as a decoration layer that can
16
+ * update independently of the mark representation.
17
+ */
18
+ export declare const mapAttributionToMark: (format: Record<string, unknown> | null, attribution: {
19
+ insert?: readonly string[];
20
+ delete?: readonly string[];
21
+ format?: Record<string, readonly string[]>;
22
+ insertAt?: number;
23
+ deleteAt?: number;
24
+ formatAt?: number;
25
+ }) => Record<string, unknown>;
26
+ export declare const YSyncExtension: (options: Pick<CollaborationOptions, "fragment" | "getAttributionMarkClassName" | "provider" | "renderer" | "suggestionDoc">) => import("../../index.js").ExtensionFactoryInstance<{
27
+ readonly key: "ySync";
28
+ readonly fragment: import("@y/y").Type<any>;
29
+ readonly mount: () => void;
30
+ readonly prosemirrorPlugins: readonly [import("prosemirror-state").Plugin<any>];
31
+ readonly runsBefore: readonly ["default"];
32
+ }>;
@@ -0,0 +1,25 @@
1
+ import { $prosemirrorDelta } from "@y/prosemirror";
2
+ import * as schema from "lib0/schema";
3
+ /**
4
+ * BlockNote's node-pairing policy for y-prosemirror's `matchNodes` option
5
+ * (forwarded to `lib0/delta.diff`). This is the schema-specific bit that lives
6
+ * in userland - the binding itself stays schema-agnostic.
7
+ *
8
+ * A `blockContainer` holds exactly one block content (`blockContent
9
+ * blockGroup?`). Diffing a *type change* of that content as an in-place child
10
+ * delete+insert would, under a suggestion, tombstone the old content next to the
11
+ * new one => two block-contents in one container => schema-invalid. So we
12
+ * declare a container's identity to be its first block-content child's type:
13
+ * when that changes, the two containers are reported as *different*, the PM->Y
14
+ * diff replaces the whole container, and the deleted + inserted containers sit
15
+ * as siblings in the blockGroup (`blockGroupChild+` allows that). Each carries
16
+ * the `y-attributed-*` node mark - which `blockContainer` already whitelists -
17
+ * so no schema change and no storage transform are needed. A plain text edit
18
+ * keeps the same first-child type => same identity => the diff descends and
19
+ * merges as usual.
20
+ *
21
+ * @param a removed (old) node
22
+ * @param b inserted (new) node
23
+ * @returns whether `a` and `b` are the same node (diff in place) vs different (replace)
24
+ */
25
+ export declare const blockMatchNodes: (a: schema.Unwrap<typeof $prosemirrorDelta>, b: schema.Unwrap<typeof $prosemirrorDelta>) => boolean;
@@ -0,0 +1,189 @@
1
+ import type { Awareness } from "@y/protocols/awareness";
2
+ import type * as Y from "@y/y";
3
+ import { BlockNoteEditorOptions } from "../../editor/BlockNoteEditor.js";
4
+ import { VersioningEndpoints, VersioningEndpointsFactory } from "../../extensions/Versioning/index.js";
5
+ import { UserStoreOrResolver } from "../../user/index.js";
6
+ import { CollaborationUser } from "./YCursorPlugin.js";
7
+ import type { GetAttributionMarkClassName } from "./YAttributionMarks.js";
8
+ export type CollaborationOptions = {
9
+ /**
10
+ * The Yjs Type that's used for collaboration.
11
+ */
12
+ fragment: Y.Type;
13
+ /**
14
+ * The user info for the current user that's shown to other collaborators.
15
+ */
16
+ user: CollaborationUser;
17
+ /**
18
+ * Resolve user information (usernames, colors) for suggestions and versions,
19
+ * used to drive suggestion-author tooltips, suggestion colors and
20
+ * version-history author labels.
21
+ *
22
+ * Either a resolver function (called with the ids of users that are not yet
23
+ * cached, returning their information — a user store is built from it
24
+ * internally) or a pre-built user store (see `createUserStore`). Pass the same
25
+ * store you give the comments extension so a single de-duped user cache is
26
+ * shared across comments, suggestions and versioning.
27
+ */
28
+ resolveUsers?: UserStoreOrResolver;
29
+ /**
30
+ * A Yjs provider (used for awareness / cursor information)
31
+ */
32
+ provider?: {
33
+ awareness?: Awareness;
34
+ };
35
+ /**
36
+ * Optional function to customize how cursors of users are rendered
37
+ */
38
+ renderCursor?: (user: CollaborationUser) => HTMLElement;
39
+ /**
40
+ * Optional flag to set when the user label should be shown with the default
41
+ * collaboration cursor. Setting to "always" will always show the label,
42
+ * while "activity" will only show the label when the user moves the cursor
43
+ * or types. Defaults to "activity".
44
+ */
45
+ showCursorLabels?: "always" | "activity";
46
+ /**
47
+ * The renderer for the collaboration.
48
+ */
49
+ renderer?: Y.DiffRenderer;
50
+ /**
51
+ * The suggestion doc for the collaboration. If using suggestion mode
52
+ */
53
+ suggestionDoc?: Y.Doc;
54
+ /**
55
+ * Optional callback to override suggestion-mark styling by change type instead
56
+ * of by author. Given a mark's content/modification type, return a class name
57
+ * applied to the mark and its hover tooltip; the per-user color is then
58
+ * dropped for that mark. See {@link GetAttributionMarkClassName}.
59
+ */
60
+ getAttributionMarkClassName?: GetAttributionMarkClassName;
61
+ /**
62
+ * The endpoints for the versioning functionality.
63
+ */
64
+ versioningEndpoints?: VersioningEndpoints<Y.Type, Uint8Array> | VersioningEndpointsFactory<Y.Type, Uint8Array>;
65
+ };
66
+ export declare const CollaborationExtension: (options: CollaborationOptions) => import("../../index.js").ExtensionFactoryInstance<{
67
+ readonly key: "collaboration";
68
+ readonly userStore: import("../../index.js").UserStore<import("../../index.js").User>;
69
+ readonly blockNoteExtensions: (import("../../index.js").ExtensionFactoryInstance<{
70
+ readonly key: "versioning";
71
+ readonly store: import("@tanstack/store").Store<{
72
+ snapshots: import("../../index.js").VersionSnapshot[];
73
+ previewedSnapshotId?: string | typeof import("../../index.js").CURRENT_VERSION_ID;
74
+ compareToSnapshotId?: string | typeof import("../../index.js").CURRENT_VERSION_ID;
75
+ }, (cb: {
76
+ snapshots: import("../../index.js").VersionSnapshot[];
77
+ previewedSnapshotId?: string | typeof import("../../index.js").CURRENT_VERSION_ID;
78
+ compareToSnapshotId?: string | typeof import("../../index.js").CURRENT_VERSION_ID;
79
+ }) => {
80
+ snapshots: import("../../index.js").VersionSnapshot[];
81
+ previewedSnapshotId?: string | typeof import("../../index.js").CURRENT_VERSION_ID;
82
+ compareToSnapshotId?: string | typeof import("../../index.js").CURRENT_VERSION_ID;
83
+ }>;
84
+ readonly userStore: import("../../index.js").UserStore<import("../../index.js").User>;
85
+ readonly list: () => Promise<import("../../index.js").VersionSnapshot[]>;
86
+ readonly canCompare: boolean;
87
+ readonly canCreate: boolean;
88
+ readonly create: ((options?: {
89
+ name?: string;
90
+ restoredFromSnapshot?: import("../../index.js").VersionSnapshotIdentifier;
91
+ }) => Promise<import("../../index.js").VersionSnapshot>) | undefined;
92
+ readonly canRestore: boolean;
93
+ readonly restore: ((id: import("../../index.js").VersionSnapshotIdentifier) => Promise<any>) | undefined;
94
+ readonly canRename: boolean;
95
+ readonly rename: ((id: import("../../index.js").VersionSnapshotIdentifier, name?: string) => Promise<void>) | undefined;
96
+ readonly canRemove: boolean;
97
+ readonly remove: ((id: import("../../index.js").VersionSnapshotIdentifier) => Promise<void>) | undefined;
98
+ readonly previewSnapshot: (id: import("../../index.js").VersionSnapshotIdentifier, previewOptions?: {
99
+ compareTo?: import("../../index.js").VersionSnapshotIdentifier;
100
+ }) => Promise<void>;
101
+ readonly canPreviewCurrent: boolean;
102
+ readonly previewCurrentVersion: ((previewOptions?: {
103
+ compareTo?: import("../../index.js").VersionSnapshotIdentifier;
104
+ }) => Promise<void>) | undefined;
105
+ readonly exitPreview: () => void;
106
+ }> | import("../../index.js").ExtensionFactoryInstance<{
107
+ key: string;
108
+ userStore: import("../../index.js").UserStore<import("../../index.js").User>;
109
+ store: import("@tanstack/store").Store<import("./AttributionExtension.js").AttributionTooltipState | undefined, (cb: import("./AttributionExtension.js").AttributionTooltipState | undefined) => import("./AttributionExtension.js").AttributionTooltipState | undefined>;
110
+ prosemirrorPlugins: import("prosemirror-state").Plugin<null>[];
111
+ mount({ dom, root, signal }: {
112
+ dom: HTMLElement;
113
+ root: Document | ShadowRoot;
114
+ signal: AbortSignal;
115
+ }): void;
116
+ blockNoteExtensions: import("../../index.js").ExtensionFactoryInstance<{
117
+ key: string;
118
+ tiptapExtensions: (import("@tiptap/core").Mark<{
119
+ getAttributionMarkClassName?: GetAttributionMarkClassName;
120
+ }, any> | import("@tiptap/core").Mark<{
121
+ editor?: import("../../index.js").BlockNoteEditor<any, any, any>;
122
+ getAttributionMarkClassName?: GetAttributionMarkClassName;
123
+ }, any>)[];
124
+ }>[];
125
+ }> | import("../../index.js").ExtensionFactoryInstance<{
126
+ readonly key: "yPositionMapping";
127
+ readonly mapPosition: (position: number, side?: "left" | "right") => () => number;
128
+ }> | import("../../index.js").ExtensionFactoryInstance<{
129
+ readonly key: "suggestions";
130
+ readonly userStore: import("../../index.js").UserStore<import("../../index.js").User>;
131
+ readonly runsBefore: readonly ["ySync"];
132
+ readonly viewSuggestions: () => void;
133
+ readonly enableSuggestions: () => void;
134
+ readonly disableSuggestions: () => void;
135
+ readonly applyAllSuggestions: () => boolean;
136
+ readonly applySuggestion: (start: number, end?: number) => boolean;
137
+ readonly revertSuggestion: (start: number, end?: number) => boolean;
138
+ readonly revertAllSuggestions: () => boolean;
139
+ readonly getSuggestionElementAtPos: (pos: number) => HTMLElement | null;
140
+ readonly getMarkAtPos: (pos: number, markType: string) => {
141
+ range: import("@tiptap/core").Range;
142
+ mark: import("prosemirror-model").Mark;
143
+ readonly text: string;
144
+ readonly position: DOMRect;
145
+ } | undefined;
146
+ readonly getSuggestionAtSelection: () => {
147
+ range: import("@tiptap/core").Range;
148
+ mark: import("prosemirror-model").Mark;
149
+ readonly text: string;
150
+ readonly position: DOMRect;
151
+ } | undefined;
152
+ readonly getSuggestionAtCoords: (coords: {
153
+ left: number;
154
+ top: number;
155
+ }) => {
156
+ range: import("@tiptap/core").Range;
157
+ mark: import("prosemirror-model").Mark;
158
+ readonly text: string;
159
+ readonly position: DOMRect;
160
+ } | undefined;
161
+ readonly checkUnresolvedSuggestions: () => false;
162
+ }> | import("../../index.js").ExtensionFactoryInstance<{
163
+ readonly key: "yCursor";
164
+ readonly prosemirrorPlugins: import("prosemirror-state").Plugin<import("prosemirror-view").DecorationSet>[];
165
+ readonly dependsOn: readonly ["ySync"];
166
+ readonly updateUser: (user: CollaborationUser) => void;
167
+ readonly getUser: () => CollaborationUser | undefined;
168
+ }> | import("../../index.js").ExtensionFactoryInstance<{
169
+ readonly key: "ySync";
170
+ readonly fragment: Y.Type<any>;
171
+ readonly mount: () => void;
172
+ readonly prosemirrorPlugins: readonly [import("prosemirror-state").Plugin<any>];
173
+ readonly runsBefore: readonly ["default"];
174
+ }>)[];
175
+ }>;
176
+ export declare function withCollaboration<Options extends Partial<BlockNoteEditorOptions<any, any, any>>>(options: Options & {
177
+ /**
178
+ * Options for configuring the collaboration functionality.
179
+ */
180
+ collaboration: CollaborationOptions;
181
+ }): Options;
182
+ export * from "./AttributionExtension.js";
183
+ export * from "./DiffVersioningExtension.js";
184
+ export * from "./RelativePositionMapping.js";
185
+ export * from "./Suggestions.js";
186
+ export * from "./Versioning.js";
187
+ export * from "./YAttributionMarks.js";
188
+ export * from "./YCursorPlugin.js";
189
+ export * from "./YSync.js";
@@ -0,0 +1,4 @@
1
+ export * from "./extensions/index.js";
2
+ export * from "./utils.js";
3
+ export * from "./comments/index.js";
4
+ export * from "./versioning/index.js";
@@ -0,0 +1,82 @@
1
+ import * as d from "lib0/delta";
2
+ import { Node } from "prosemirror-model";
3
+ import { Transaction } from "prosemirror-state";
4
+ import { type Block, type BlockNoteEditor, type BlockSchema, type InlineContentSchema, type PartialBlock, type StyleSchema } from "../index.js";
5
+ import * as Y from "@y/y";
6
+ /**
7
+ * Find the equivalent of a Y.Type in another Y.Doc.
8
+ *
9
+ * For root types this looks up the matching shared key; for sub-types it
10
+ * locates the item by its client/clock ID in the target doc's store.
11
+ */
12
+ export declare function findTypeInOtherYdoc<T extends Y.Type<any>>(ytype: T, otherYdoc: Y.Doc): T;
13
+ /**
14
+ * Turn Prosemirror JSON to BlockNote style JSON
15
+ * @param editor BlockNote editor
16
+ * @param json Prosemirror JSON
17
+ * @returns BlockNote style JSON
18
+ */
19
+ export declare function _prosemirrorJSONToBlocks<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema>(editor: BlockNoteEditor<BSchema, ISchema, SSchema>, json: any): Block<BSchema, ISchema, SSchema>[];
20
+ /**
21
+ * Turn BlockNote JSON to Prosemirror node / state
22
+ * @param editor BlockNote editor
23
+ * @param blocks BlockNote blocks
24
+ * @returns Prosemirror root node
25
+ */
26
+ export declare function _blocksToProsemirrorNode<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema>(editor: BlockNoteEditor<BSchema, ISchema, SSchema>, blocks: PartialBlock<BSchema, ISchema, SSchema>[]): Node;
27
+ /** YJS / BLOCKNOTE conversions */
28
+ /**
29
+ * Turn a Y.Type collaborative doc into a BlockNote document (BlockNote style JSON of all blocks)
30
+ * @param editor BlockNote editor
31
+ * @param fragment Y.Type
32
+ * @returns BlockNote document (BlockNote style JSON of all blocks)
33
+ */
34
+ export declare function yfragmentToBlocks<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema>(editor: BlockNoteEditor<BSchema, ISchema, SSchema>, fragment: Y.Type): Block<BSchema, ISchema, SSchema>[];
35
+ /**
36
+ * Convert blocks to a Y.Type
37
+ *
38
+ * This can be used when importing existing content to Y.Doc for the first time,
39
+ * note that this should not be used to rehydrate a Y.Doc from a database once
40
+ * collaboration has begun as all history will be lost
41
+ *
42
+ * @param editor BlockNote editor
43
+ * @param blocks the blocks to convert
44
+ * @param fragment XML fragment name
45
+ * @returns Y.Type
46
+ */
47
+ export declare function blocksToYType<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema>(editor: BlockNoteEditor<BSchema, ISchema, SSchema>, blocks: Block<BSchema, ISchema, SSchema>[], fragment?: Y.Type): Y.Type<any>;
48
+ /**
49
+ * Turn a Y.Doc collaborative doc into a BlockNote document (BlockNote style JSON of all blocks)
50
+ * @param editor BlockNote editor
51
+ * @param ydoc Y.Doc
52
+ * @param fragment XML fragment name
53
+ * @returns BlockNote document (BlockNote style JSON of all blocks)
54
+ */
55
+ export declare function yDocToBlocks<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema>(editor: BlockNoteEditor<BSchema, ISchema, SSchema>, ydoc: Y.Doc, fragment?: string): Block<BSchema, ISchema, SSchema>[];
56
+ /**
57
+ * This can be used when importing existing content to Y.Doc for the first time,
58
+ * note that this should not be used to rehydrate a Y.Doc from a database once
59
+ * collaboration has begun as all history will be lost
60
+ *
61
+ * @param editor BlockNote editor
62
+ * @param blocks the blocks to convert
63
+ * @param fragment XML fragment name
64
+ */
65
+ export declare function blocksToYDoc<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema>(editor: BlockNoteEditor<BSchema, ISchema, SSchema>, blocks: PartialBlock<BSchema, ISchema, SSchema>[], fragment?: string): Y.Doc;
66
+ /**
67
+ * Diff two ProseMirror documents into a delta, using BlockNote's node-pairing
68
+ * policy ({@link blockMatchNodes}) so a block's content-type change is reported
69
+ * as a replace rather than a schema-invalid in-place edit.
70
+ */
71
+ export declare function docDiffToDelta(previousDoc: Node, newDoc: Node): d.Delta<d.DeltaConf>;
72
+ /**
73
+ * Build a ProseMirror transaction that turns `tr.doc` into the content of a
74
+ * Y.Type `fragment`, applying the `renderer`'s authorship as
75
+ * `y-attributed-*` marks. Used to render a (read-only) diff of a snapshot / a
76
+ * version comparison into the editor.
77
+ */
78
+ export declare function getProseMirrorTrFromYFragment({ tr, fragment, renderer, }: {
79
+ tr: Transaction;
80
+ fragment: Y.Type;
81
+ renderer?: Y.AbstractRenderer | null;
82
+ }): Transaction;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./yhub.js";