@blocknote/core 0.51.3 → 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 (397) 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-D0lMxErU.js → blocks-CiuUGa1E.js} +1096 -998
  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-D2mx2C9y.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-Dvmif2FY.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 +129 -0
  101. package/src/blocks/Table/TableExtension.ts +23 -20
  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 +39 -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/ExtensionManager.test.d.ts +1 -0
  271. package/types/src/editor/managers/ExtensionManager/extensions.d.ts +2 -2
  272. package/types/src/editor/managers/ExtensionManager/index.d.ts +13 -0
  273. package/types/src/editor/managers/SelectionManager.d.ts +1 -1
  274. package/types/src/extensions/PositionMapping/PositionMapping.d.ts +4 -0
  275. package/types/src/extensions/TableHandles/TableHandles.d.ts +6 -6
  276. package/types/src/extensions/Versioning/Versioning.d.ts +352 -0
  277. package/types/src/extensions/Versioning/Versioning.test.d.ts +1 -0
  278. package/types/src/extensions/Versioning/inMemoryVersioning.d.ts +37 -0
  279. package/types/src/extensions/Versioning/inMemoryVersioning.test.d.ts +1 -0
  280. package/types/src/extensions/Versioning/index.d.ts +2 -0
  281. package/types/src/extensions/index.d.ts +6 -9
  282. package/types/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.d.ts +1 -0
  283. package/types/src/extensions/tiptap-extensions/UniqueID/UniqueID.d.ts +6 -1
  284. package/types/src/extensions/tiptap-extensions/UniqueID/UniqueID.test.d.ts +4 -0
  285. package/types/src/extensions/tiptap-extensions/index.d.ts +1 -5
  286. package/types/src/i18n/locales/en.d.ts +9 -1
  287. package/types/src/i18n/locales/fa.d.ts +9 -1
  288. package/types/src/i18n/locales/sk.d.ts +9 -1
  289. package/types/src/index.d.ts +2 -0
  290. package/types/src/pm-nodes/suggestionMarks.d.ts +26 -0
  291. package/types/src/schema/blocks/createSpec.d.ts +4 -4
  292. package/types/src/schema/blocks/createSpec.test.d.ts +1 -0
  293. package/types/src/schema/blocks/extendBlockSpec.test.d.ts +1 -0
  294. package/types/src/schema/blocks/internal.d.ts +5 -7
  295. package/types/src/schema/blocks/types.d.ts +22 -14
  296. package/types/src/schema/contentTypePropagation.test.d.ts +1 -0
  297. package/types/src/schema/index.d.ts +1 -0
  298. package/types/src/schema/inlineContent/types.d.ts +3 -3
  299. package/types/src/schema/markGroups.d.ts +33 -0
  300. package/types/src/user/UserStore.d.ts +105 -0
  301. package/types/src/user/createUserStore.test.d.ts +1 -0
  302. package/types/src/user/index.d.ts +2 -0
  303. package/types/src/user/userColors.d.ts +36 -0
  304. package/types/src/y/comments/RESTYjsThreadStore.d.ts +77 -0
  305. package/types/src/y/comments/YjsThreadStore.d.ts +79 -0
  306. package/types/src/y/comments/YjsThreadStore.test.d.ts +1 -0
  307. package/types/src/y/comments/YjsThreadStoreBase.d.ts +15 -0
  308. package/types/src/y/comments/index.d.ts +3 -0
  309. package/types/src/y/comments/yjsHelpers.d.ts +13 -0
  310. package/types/src/y/extensions/AttributionExtension.d.ts +74 -0
  311. package/types/src/y/extensions/AttributionExtension.test.d.ts +1 -0
  312. package/types/src/y/extensions/DiffVersioningExtension.d.ts +69 -0
  313. package/types/src/y/extensions/DiffVersioningExtension.test.d.ts +1 -0
  314. package/types/src/{extensions/Collaboration → y/extensions}/ForkYDoc.d.ts +4 -2
  315. package/types/src/y/extensions/ForkYDoc.test.d.ts +1 -0
  316. package/types/src/y/extensions/RelativePositionMapping.d.ts +4 -0
  317. package/types/src/y/extensions/RelativePositionMapping.test.d.ts +1 -0
  318. package/types/src/y/extensions/Suggestions.d.ts +36 -0
  319. package/types/src/y/extensions/Versioning.d.ts +17 -0
  320. package/types/src/y/extensions/Versioning.test.d.ts +1 -0
  321. package/types/src/y/extensions/YAttributionMarks.d.ts +67 -0
  322. package/types/src/y/extensions/YCursorPlugin.d.ts +14 -0
  323. package/types/src/y/extensions/YSync.d.ts +32 -0
  324. package/types/src/y/extensions/blockMatchNodes.d.ts +25 -0
  325. package/types/src/y/extensions/index.d.ts +189 -0
  326. package/types/src/y/index.d.ts +4 -0
  327. package/types/src/y/utils.d.ts +82 -0
  328. package/types/src/y/utils.test.d.ts +1 -0
  329. package/types/src/y/versioning/__test__/yhub.test.d.ts +1 -0
  330. package/types/src/y/versioning/index.d.ts +1 -0
  331. package/types/src/y/versioning/yhub.d.ts +87 -0
  332. package/types/src/{comments/threadstore/yjs → yjs/comments}/RESTYjsThreadStore.d.ts +6 -10
  333. package/types/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStore.d.ts +3 -3
  334. package/types/src/yjs/comments/YjsThreadStore.test.d.ts +1 -0
  335. package/types/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStoreBase.d.ts +3 -3
  336. package/types/src/yjs/comments/index.d.ts +3 -0
  337. package/types/src/{comments/threadstore/yjs → yjs/comments}/yjsHelpers.d.ts +1 -1
  338. package/types/src/yjs/extensions/FixUpSchema.d.ts +3 -0
  339. package/types/src/yjs/extensions/FixUpSchema.test.d.ts +1 -0
  340. package/types/src/yjs/extensions/ForkYDoc.d.ts +27 -0
  341. package/types/src/yjs/extensions/ForkYDoc.test.d.ts +1 -0
  342. package/types/src/yjs/extensions/RelativePositionMapping.d.ts +4 -0
  343. package/types/src/yjs/extensions/RelativePositionMapping.test.d.ts +1 -0
  344. package/types/src/yjs/extensions/Versioning.d.ts +26 -0
  345. package/types/src/yjs/extensions/Versioning.test.d.ts +1 -0
  346. package/types/src/{extensions/Collaboration → yjs/extensions}/YCursorPlugin.d.ts +5 -2
  347. package/types/src/{extensions/Collaboration → yjs/extensions}/YSync.d.ts +1 -1
  348. package/types/src/{extensions/Collaboration/Collaboration.d.ts → yjs/extensions/index.d.ts} +36 -15
  349. package/types/src/yjs/extensions/schemaMigration/migrationRules/moveColorAttributes.test.d.ts +1 -0
  350. package/types/src/yjs/index.d.ts +2 -0
  351. package/types/src/yjs/utils.d.ts +5 -0
  352. package/dist/BlockNoteExtension-B6RhuQ3V.js +0 -27
  353. package/dist/BlockNoteExtension-B6RhuQ3V.js.map +0 -1
  354. package/dist/BlockNoteExtension-ab0REuob.cjs +0 -2
  355. package/dist/BlockNoteExtension-ab0REuob.cjs.map +0 -1
  356. package/dist/EventEmitter-CuPnGDYt.js +0 -22
  357. package/dist/EventEmitter-CuPnGDYt.js.map +0 -1
  358. package/dist/EventEmitter-DHdSnYCD.cjs +0 -2
  359. package/dist/EventEmitter-DHdSnYCD.cjs.map +0 -1
  360. package/dist/ShowSelection-BsHFfdMi.js +0 -29
  361. package/dist/ShowSelection-BsHFfdMi.js.map +0 -1
  362. package/dist/ShowSelection-DhXglbt8.cjs +0 -2
  363. package/dist/ShowSelection-DhXglbt8.cjs.map +0 -1
  364. package/dist/blocks-D0lMxErU.js.map +0 -1
  365. package/dist/blocks-KyMOxPT3.cjs +0 -11
  366. package/dist/blocks-KyMOxPT3.cjs.map +0 -1
  367. package/dist/en-B9hMApn4.js.map +0 -1
  368. package/dist/en-Cj5r8sW_.cjs.map +0 -1
  369. package/dist/extensions-Cutrafjg.cjs +0 -52
  370. package/dist/extensions-Cutrafjg.cjs.map +0 -1
  371. package/dist/extensions-D2mx2C9y.js.map +0 -1
  372. package/dist/src-D5R5YzV7.cjs +0 -21
  373. package/dist/src-D5R5YzV7.cjs.map +0 -1
  374. package/dist/src-Dvmif2FY.js.map +0 -1
  375. package/src/comments/userstore/UserStore.ts +0 -72
  376. package/src/extensions/Collaboration/Collaboration.ts +0 -55
  377. package/src/extensions/Collaboration/ForkYDoc.test.ts +0 -179
  378. package/src/extensions/tiptap-extensions/Suggestions/SuggestionMarks.ts +0 -175
  379. package/types/src/comments/userstore/UserStore.d.ts +0 -31
  380. package/types/src/extensions/tiptap-extensions/Suggestions/SuggestionMarks.d.ts +0 -4
  381. /package/src/{extensions/Collaboration → yjs/extensions}/YUndo.ts +0 -0
  382. /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap-editor-forked.json +0 -0
  383. /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap-editor.json +0 -0
  384. /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap-forked.html +0 -0
  385. /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap.html +0 -0
  386. /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/SchemaMigration.ts +0 -0
  387. /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/index.ts +0 -0
  388. /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/migrationRule.ts +0 -0
  389. /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/moveColorAttributes.ts +0 -0
  390. /package/types/src/{comments/threadstore/yjs/YjsThreadStore.test.d.ts → api/getBlockInfoFromPos.test.d.ts} +0 -0
  391. /package/types/src/{extensions/Collaboration/ForkYDoc.test.d.ts → api/nodeConversions/blockToNode.test.d.ts} +0 -0
  392. /package/types/src/{extensions/Collaboration/schemaMigration/migrationRules/moveColorAttributes.test.d.ts → blocks/Table/TableExtension.test.d.ts} +0 -0
  393. /package/types/src/{extensions/Collaboration → yjs/extensions}/YUndo.d.ts +0 -0
  394. /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/SchemaMigration.d.ts +0 -0
  395. /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/index.d.ts +0 -0
  396. /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/migrationRule.d.ts +0 -0
  397. /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/moveColorAttributes.d.ts +0 -0
@@ -0,0 +1,352 @@
1
+ import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
2
+ import { type User, type UserStoreOrResolver } from "../../user/index.js";
3
+ /**
4
+ * Represents a single snapshot of a document's history, including metadata and content information.
5
+ * Snapshots are used for versioning and can be created, listed, restored, and previewed through the
6
+ * {@link VersioningEndpoints}.
7
+ */
8
+ export interface VersionSnapshot {
9
+ /**
10
+ * The unique identifier for the snapshot. A plain string for real snapshots;
11
+ * the {@link CURRENT_VERSION_ID} symbol for the synthetic "Current version"
12
+ * entry (which no backend ever persists or round-trips).
13
+ */
14
+ id: string | typeof CURRENT_VERSION_ID;
15
+ /**
16
+ * The name of the snapshot.
17
+ */
18
+ name?: string;
19
+ /**
20
+ * The timestamp when the snapshot was created (unix timestamp).
21
+ */
22
+ createdAt: number;
23
+ /**
24
+ * The timestamp when the snapshot was last updated (unix timestamp).
25
+ */
26
+ updatedAt: number;
27
+ /**
28
+ * An optional secondary label for the snapshot, which can display additional information such as a custom description.
29
+ * This is for display purposes only and is not used for any logic in the versioning system.
30
+ *
31
+ * For author attribution, prefer {@link by}: it holds raw user ids that the
32
+ * view layer resolves to user info (and keeps up to date as users load).
33
+ * When both are set, `secondaryLabel` wins.
34
+ */
35
+ secondaryLabel?: string;
36
+ /**
37
+ * The id(s) of the user(s) that authored this version, as raw user ids —
38
+ * never pre-resolved to display names. The view layer resolves them via the
39
+ * {@link VersioningExtension}'s user store (see
40
+ * {@link VersioningExtensionOptions.resolveUsers}), reactively updating as
41
+ * user info loads. Only used when {@link secondaryLabel} is unset.
42
+ */
43
+ by?: User["id"] | User["id"][];
44
+ /**
45
+ * The ID of the previous snapshot that this snapshot was restored from.
46
+ */
47
+ restoredFromSnapshotId?: string;
48
+ }
49
+ /**
50
+ * Identifier for a single {@link VersionSnapshot}, either the bare id or the
51
+ * whole reference. Tracks {@link VersionSnapshot.id}, so it also accepts the
52
+ * {@link CURRENT_VERSION_ID} symbol.
53
+ */
54
+ export type VersionSnapshotIdentifier = VersionSnapshot["id"] | Pick<VersionSnapshot, "id">;
55
+ /**
56
+ * The `id` of the synthetic "Current version" entry — the live document shown at
57
+ * the top of `list()` and set as `previewedSnapshotId` while previewing it (see
58
+ * {@link VersioningExtension.previewCurrentVersion}).
59
+ *
60
+ * A `unique symbol`, not a string, so it can never clash with a real snapshot id.
61
+ * It's client-only — never fetched via `getContent` / `getAttributions` (the row
62
+ * is previewed live) and never serialised, so no backend round-trips it. Because
63
+ * {@link VersionSnapshot.id} is `string | typeof CURRENT_VERSION_ID`, code that
64
+ * needs a string form for this one row (e.g. a React `key`) derives it locally.
65
+ */
66
+ export declare const CURRENT_VERSION_ID: unique symbol;
67
+ /**
68
+ * The backend contract for versioning: **where snapshot data lives** (pure
69
+ * storage — in-memory, `localStorage`, HTTP, …). Counterpart to
70
+ * {@link PreviewController} (*how a snapshot is rendered*) and
71
+ * {@link VersioningExtensionOptions} (*how the live editor is bridged in*);
72
+ * {@link VersioningExtension} orchestrates the three.
73
+ *
74
+ * Type params trace the data flow:
75
+ * @typeParam Input - Live document handle passed to {@link create} / {@link restore},
76
+ * from {@link VersioningExtensionOptions.getCurrentDocument} (e.g. `Y.Type`, `Block[]`).
77
+ * @typeParam Output - Serialised snapshot content from {@link getContent} /
78
+ * {@link restore}, rendered by {@link PreviewController.enterPreview} (e.g. `Uint8Array`).
79
+ * @typeParam Attributions - Optional diff-authorship data from {@link getAttributions},
80
+ * also consumed by {@link PreviewController.enterPreview} (e.g. `Y.ContentMap`).
81
+ */
82
+ export interface VersioningEndpoints<Input = any, Output = any, Attributions = any> {
83
+ /**
84
+ * List all snapshots for this document, sorted newest-first by
85
+ * {@link VersionSnapshot.createdAt}.
86
+ */
87
+ list: () => Promise<VersionSnapshot[]>;
88
+ /**
89
+ * Create a new snapshot from the current content.
90
+ *
91
+ * @note omit for backends with continuous history (e.g. YHub's activity
92
+ * timeline). Gates the extension's `canCreate` flag.
93
+ */
94
+ create?: (
95
+ /** Live document to snapshot, from {@link VersioningExtensionOptions.getCurrentDocument}. */
96
+ content: Input, options?: {
97
+ /** Optional name for this snapshot. */
98
+ name?: string;
99
+ /** Id of the snapshot this one was restored from, if any. */
100
+ restoredFromSnapshot?: VersionSnapshot;
101
+ }) => Promise<VersionSnapshot>;
102
+ /**
103
+ * Restore the document to a snapshot. Implementations should create any backup
104
+ * snapshots they need before returning.
105
+ *
106
+ * @returns The restored content ({@link Output}, **not `void`**) — passed to
107
+ * {@link PreviewController.applyRestore}.
108
+ * @note omit to disable restore. Gates the extension's `canRestore` flag.
109
+ */
110
+ restore?: (
111
+ /** Live document, from {@link VersioningExtensionOptions.getCurrentDocument} (for backup). */
112
+ doc: Input,
113
+ /** The snapshot to restore. */
114
+ snapshot: VersionSnapshot) => Promise<Output>;
115
+ /**
116
+ * Fetch a snapshot's content ({@link Output}) for preview — same format as
117
+ * {@link VersioningExtensionOptions.serializeCurrentContent}. Sibling of
118
+ * {@link getAttributions}; both are the storage-side fetch that
119
+ * {@link PreviewController.enterPreview} renders.
120
+ */
121
+ getContent: (snapshot: VersionSnapshot) => Promise<Output>;
122
+ /**
123
+ * Fetch diff-authorship data ({@link Attributions}: who/when) for the range
124
+ * `compareTo → snapshot`, rendered by {@link PreviewController.enterPreview}
125
+ * (its only consumer). Lives on the endpoint, not `enterPreview`, so one
126
+ * preview controller pairs with attribution-capable (YHub) or attribution-less
127
+ * (`localStorage`) backends — {@link Attributions} is that seam.
128
+ *
129
+ * @note omit and previews still render the content diff, minus attribution.
130
+ */
131
+ getAttributions?: (
132
+ /** The previewed snapshot (the "new" side of the diff). */
133
+ snapshot: VersionSnapshot,
134
+ /** The baseline it's diffed against (the "old" side). */
135
+ compareTo?: VersionSnapshot) => Promise<Attributions>;
136
+ /**
137
+ * Rename a snapshot.
138
+ *
139
+ * @note omit to disable rename. Gates the extension's `canRename` flag.
140
+ */
141
+ rename?: (snapshot: VersionSnapshot, name?: string) => Promise<void>;
142
+ /**
143
+ * Permanently remove a snapshot.
144
+ *
145
+ * @note omit for immutable-history backends (e.g. YHub). Gates the extension's
146
+ * `canRemove` flag.
147
+ */
148
+ remove?: (snapshot: VersionSnapshot) => Promise<void>;
149
+ }
150
+ /**
151
+ * A factory function for the endpoints to receive a reference to the editor.
152
+ *
153
+ * @typeParam Input - See {@link VersioningEndpoints}.
154
+ * @typeParam Output - See {@link VersioningEndpoints}.
155
+ * @typeParam Attributions - See {@link VersioningEndpoints}.
156
+ */
157
+ export type VersioningEndpointsFactory<Input = any, Output = any, Attributions = any> = (editor: BlockNoteEditor<any, any, any>) => VersioningEndpoints<Input, Output, Attributions>;
158
+ /**
159
+ * Controls **how a snapshot is rendered** — the render-side counterpart to
160
+ * {@link VersioningEndpoints} (storage). {@link VersioningExtension} fetches
161
+ * content/attributions from the endpoints and delegates rendering here; keeping
162
+ * the two separate lets one controller pair with different backends.
163
+ *
164
+ * @typeParam Output - Serialised snapshot content; matches the endpoints' `Output`.
165
+ * @typeParam Attributions - Optional attribution data; matches the endpoints' `Attributions`.
166
+ */
167
+ export interface PreviewController<Output = any, Attributions = any> {
168
+ /**
169
+ * Whether {@link enterPreview} can render a diff (uses `compareToContent`).
170
+ * Defaults to `true`; `false` for show-one-version-only backends (e.g. the Yjs
171
+ * v13 adapter). Surfaced as {@link VersioningExtension.canCompare}.
172
+ */
173
+ supportsComparison?: boolean;
174
+ /**
175
+ * Enter preview mode. Arguments come from the endpoints:
176
+ * {@link VersioningEndpoints.getContent} (content) and
177
+ * {@link VersioningEndpoints.getAttributions} (attributions).
178
+ */
179
+ enterPreview: (
180
+ /** Snapshot to preview ({@link Output}, from {@link VersioningEndpoints.getContent}). */
181
+ snapshotContent: Output,
182
+ /** When set, diff `compareToContent` (baseline) against `snapshotContent`. */
183
+ compareToContent?: Output,
184
+ /**
185
+ * Diff attributions ({@link Attributions}, from
186
+ * {@link VersioningEndpoints.getAttributions}). Only meaningful with
187
+ * `compareToContent`.
188
+ */
189
+ attributions?: Attributions,
190
+ /**
191
+ * The snapshot(s) this preview is for (metadata only — the content is
192
+ * `snapshotContent` / `compareToContent`). Lets a controller label the
193
+ * preview with e.g. the version's name, without smuggling it through the
194
+ * {@link Attributions} channel. `snapshot` is the previewed version (the
195
+ * {@link CURRENT_VERSION_ID} entry when previewing the live document);
196
+ * `compareTo` is the baseline it's diffed against, if any.
197
+ */
198
+ context?: {
199
+ snapshot: VersionSnapshot;
200
+ compareTo?: VersionSnapshot;
201
+ }) => void;
202
+ /** Exit preview mode and resume normal editing. */
203
+ exitPreview: () => void;
204
+ /**
205
+ * Apply restored content to the live document. Called with the {@link Output}
206
+ * from {@link VersioningEndpoints.restore}, after preview mode has exited.
207
+ */
208
+ applyRestore: (snapshotContent: Output) => void;
209
+ }
210
+ /** Sort snapshots newest-first by creation time. */
211
+ export declare function sortSnapshotsNewestFirst(snapshots: VersionSnapshot[]): VersionSnapshot[];
212
+ /**
213
+ * Options accepted by the {@link VersioningExtension} — **how the live editor is
214
+ * bridged in**, alongside the {@link VersioningEndpoints} (storage) and
215
+ * {@link PreviewController} (rendering).
216
+ *
217
+ * @typeParam Input - See {@link VersioningEndpoints}.
218
+ * @typeParam Output - See {@link VersioningEndpoints}.
219
+ * @typeParam Attributions - See {@link VersioningEndpoints}.
220
+ */
221
+ export type VersioningExtensionOptions<Input = any, Output = any, Attributions = any> = {
222
+ /**
223
+ * Backend storage for snapshots.
224
+ */
225
+ endpoints: VersioningEndpoints<Input, Output, Attributions> | VersioningEndpointsFactory<Input, Output, Attributions>;
226
+ /**
227
+ * Controls how snapshot previews and restores are rendered in the editor.
228
+ */
229
+ preview: PreviewController<Output, Attributions>;
230
+ /**
231
+ * The **live, mutable document handle** ({@link Input}) the backend snapshots
232
+ * *from* / restores *into*. Passed to {@link VersioningEndpoints.create} and
233
+ * {@link VersioningEndpoints.restore}. Cf. {@link serializeCurrentContent} (a
234
+ * detached copy); the two coincide for some backends (in-memory:
235
+ * `Input === Output === Block[]`) and differ for others (Yjs: `Y.Type` vs `Uint8Array`).
236
+ */
237
+ getCurrentDocument: () => Input;
238
+ /**
239
+ * The live document **serialised to snapshot format** ({@link Output}, matching
240
+ * {@link VersioningEndpoints.getContent}), for diffing the live doc against a
241
+ * snapshot (see {@link VersioningExtension.previewCurrentVersion}). Cf.
242
+ * {@link getCurrentDocument} (the live handle).
243
+ *
244
+ * @note omit and the UI can't offer a "Current version" diff. Gates the
245
+ * extension's `canPreviewCurrent` flag.
246
+ */
247
+ serializeCurrentContent?: () => Output | Promise<Output>;
248
+ /**
249
+ * Resolve user information for the author ids in {@link VersionSnapshot.by},
250
+ * used by the view layer to render version-author labels.
251
+ *
252
+ * Either a resolver function (called with the ids of users that are not yet
253
+ * cached, returning their information — a user store is built from it
254
+ * internally) or a pre-built user store (see `createUserStore`). Pass the
255
+ * same store you give the comments/collaboration extensions so a single
256
+ * de-duped user cache is shared across features.
257
+ *
258
+ * @note omit and author ids are displayed as-is.
259
+ */
260
+ resolveUsers?: UserStoreOrResolver;
261
+ };
262
+ export declare const VersioningExtension: (options: VersioningExtensionOptions<any, any, any> | ((editor: BlockNoteEditor<any, any, any>) => VersioningExtensionOptions)) => import("../../index.js").ExtensionFactoryInstance<{
263
+ readonly key: "versioning";
264
+ readonly store: import("@tanstack/store").Store<{
265
+ snapshots: VersionSnapshot[];
266
+ /**
267
+ * The id of the version currently shown in the editor (the "new" side of
268
+ * a diff). `undefined` means the live, editable document. Is the
269
+ * {@link CURRENT_VERSION_ID} symbol when previewing the live document as a
270
+ * read-only diff against a snapshot.
271
+ */
272
+ previewedSnapshotId?: string | typeof CURRENT_VERSION_ID;
273
+ /**
274
+ * The id of the snapshot the preview is being diffed against (the
275
+ * "baseline" / old side). `undefined` when not showing a diff. Always a
276
+ * real snapshot id (never the current entry), but typed as the same union
277
+ * as {@link VersionSnapshot.id} since it's copied from one. Used to render
278
+ * the "Comparing to" indicator in the sidebar.
279
+ */
280
+ compareToSnapshotId?: string | typeof CURRENT_VERSION_ID;
281
+ }, (cb: {
282
+ snapshots: VersionSnapshot[];
283
+ /**
284
+ * The id of the version currently shown in the editor (the "new" side of
285
+ * a diff). `undefined` means the live, editable document. Is the
286
+ * {@link CURRENT_VERSION_ID} symbol when previewing the live document as a
287
+ * read-only diff against a snapshot.
288
+ */
289
+ previewedSnapshotId?: string | typeof CURRENT_VERSION_ID;
290
+ /**
291
+ * The id of the snapshot the preview is being diffed against (the
292
+ * "baseline" / old side). `undefined` when not showing a diff. Always a
293
+ * real snapshot id (never the current entry), but typed as the same union
294
+ * as {@link VersionSnapshot.id} since it's copied from one. Used to render
295
+ * the "Comparing to" indicator in the sidebar.
296
+ */
297
+ compareToSnapshotId?: string | typeof CURRENT_VERSION_ID;
298
+ }) => {
299
+ snapshots: VersionSnapshot[];
300
+ /**
301
+ * The id of the version currently shown in the editor (the "new" side of
302
+ * a diff). `undefined` means the live, editable document. Is the
303
+ * {@link CURRENT_VERSION_ID} symbol when previewing the live document as a
304
+ * read-only diff against a snapshot.
305
+ */
306
+ previewedSnapshotId?: string | typeof CURRENT_VERSION_ID;
307
+ /**
308
+ * The id of the snapshot the preview is being diffed against (the
309
+ * "baseline" / old side). `undefined` when not showing a diff. Always a
310
+ * real snapshot id (never the current entry), but typed as the same union
311
+ * as {@link VersionSnapshot.id} since it's copied from one. Used to render
312
+ * the "Comparing to" indicator in the sidebar.
313
+ */
314
+ compareToSnapshotId?: string | typeof CURRENT_VERSION_ID;
315
+ }>;
316
+ readonly userStore: import("../../index.js").UserStore<User>;
317
+ readonly list: () => Promise<VersionSnapshot[]>;
318
+ readonly canCompare: boolean;
319
+ readonly canCreate: boolean;
320
+ readonly create: ((options?: {
321
+ /**
322
+ * The optional name for this snapshot.
323
+ */
324
+ name?: string;
325
+ /**
326
+ * The ID of the snapshot this one was restored from, if applicable.
327
+ */
328
+ restoredFromSnapshot?: VersionSnapshotIdentifier;
329
+ }) => Promise<VersionSnapshot>) | undefined;
330
+ readonly canRestore: boolean;
331
+ readonly restore: ((id: VersionSnapshotIdentifier) => Promise<any>) | undefined;
332
+ readonly canRename: boolean;
333
+ readonly rename: ((id: VersionSnapshotIdentifier, name?: string) => Promise<void>) | undefined;
334
+ readonly canRemove: boolean;
335
+ readonly remove: ((id: VersionSnapshotIdentifier) => Promise<void>) | undefined;
336
+ readonly previewSnapshot: (id: VersionSnapshotIdentifier, previewOptions?: {
337
+ /**
338
+ * When set, the preview shows a diff against this snapshot (typically the
339
+ * chronologically previous version in the history list).
340
+ */
341
+ compareTo?: VersionSnapshotIdentifier;
342
+ }) => Promise<void>;
343
+ readonly canPreviewCurrent: boolean;
344
+ readonly previewCurrentVersion: ((previewOptions?: {
345
+ /**
346
+ * The snapshot to diff the live document against (the baseline). When
347
+ * omitted, the live document is shown without a diff.
348
+ */
349
+ compareTo?: VersionSnapshotIdentifier;
350
+ }) => Promise<void>) | undefined;
351
+ readonly exitPreview: () => void;
352
+ }>;
@@ -0,0 +1,37 @@
1
+ import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
2
+ import type { Block } from "../../blocks/defaultBlocks.js";
3
+ import type { PreviewController, VersioningEndpoints, VersioningExtensionOptions } from "./Versioning.js";
4
+ /**
5
+ * Create a {@link PreviewController} that swaps the BlockNote document in and
6
+ * out using `editor.replaceBlocks`.
7
+ *
8
+ * When entering preview mode the current document is saved so it can be
9
+ * restored on exit. Successive `enterPreview` calls without an intervening
10
+ * `exitPreview` preserve the original saved document.
11
+ */
12
+ export declare function createInMemoryPreviewController(editor: BlockNoteEditor<any, any, any>): PreviewController<Block<any, any, any>[]>;
13
+ /**
14
+ * Create a {@link VersioningEndpoints} that stores snapshots entirely in
15
+ * memory. Useful for local-only / non-collaborative editors where you want
16
+ * versioning without any persistence layer.
17
+ *
18
+ * Snapshots are stored as BlockNote document JSON (`Block[]`).
19
+ */
20
+ export declare function createInMemoryVersioningEndpoints(): VersioningEndpoints<Block<any, any, any>[], Block<any, any, any>[]>;
21
+ /**
22
+ * Create all the options needed to wire a {@link VersioningExtension} with
23
+ * fully in-memory storage and BlockNote JSON-based preview.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * import { VersioningExtension } from "@blocknote/core/extensions";
28
+ * import { createInMemoryVersioningAdapter } from "@blocknote/core/extensions";
29
+ *
30
+ * const editor = BlockNoteEditor.create({
31
+ * extensions: [
32
+ * VersioningExtension(createInMemoryVersioningAdapter(editor)),
33
+ * ],
34
+ * });
35
+ * ```
36
+ */
37
+ export declare function createInMemoryVersioningAdapter(editor: BlockNoteEditor<any, any, any>): VersioningExtensionOptions<Block<any, any, any>[], Block<any, any, any>[]>;
@@ -0,0 +1,2 @@
1
+ export * from "./Versioning.js";
2
+ export * from "./inMemoryVersioning.js";
@@ -1,9 +1,4 @@
1
1
  export * from "./BlockChange/BlockChange.js";
2
- export * from "./Collaboration/ForkYDoc.js";
3
- export * from "./Collaboration/schemaMigration/SchemaMigration.js";
4
- export * from "./Collaboration/YCursorPlugin.js";
5
- export * from "./Collaboration/YSync.js";
6
- export * from "./Collaboration/YUndo.js";
7
2
  export * from "./DropCursor/DropCursor.js";
8
3
  export * from "./FilePanel/FilePanel.js";
9
4
  export * from "./FormattingToolbar/FormattingToolbar.js";
@@ -12,13 +7,15 @@ export * from "./LinkToolbar/LinkToolbar.js";
12
7
  export * from "./LinkToolbar/protocols.js";
13
8
  export * from "./NodeSelectionKeyboard/NodeSelectionKeyboard.js";
14
9
  export * from "./Placeholder/Placeholder.js";
10
+ export * from "./PositionMapping/PositionMapping.js";
15
11
  export * from "./PreviousBlockType/PreviousBlockType.js";
16
12
  export * from "./ShowSelection/ShowSelection.js";
17
13
  export * from "./SideMenu/SideMenu.js";
18
- export * from "./SuggestionMenu/SuggestionMenu.js";
19
- export * from "./SuggestionMenu/getDefaultSlashMenuItems.js";
20
- export * from "./SuggestionMenu/getDefaultEmojiPickerItems.js";
21
- export * from "./SuggestionMenu/DefaultSuggestionItem.js";
22
14
  export * from "./SuggestionMenu/DefaultGridSuggestionItem.js";
15
+ export * from "./SuggestionMenu/DefaultSuggestionItem.js";
16
+ export * from "./SuggestionMenu/getDefaultEmojiPickerItems.js";
17
+ export * from "./SuggestionMenu/getDefaultSlashMenuItems.js";
18
+ export * from "./SuggestionMenu/SuggestionMenu.js";
23
19
  export * from "./TableHandles/TableHandles.js";
24
20
  export * from "./TrailingNode/TrailingNode.js";
21
+ export * from "./Versioning/index.js";
@@ -1,3 +1,8 @@
1
1
  import { Extension } from "@tiptap/core";
2
- declare const UniqueID: Extension<any, any>;
2
+ declare const UniqueID: Extension<{
3
+ types: string[];
4
+ setIdAttribute: boolean;
5
+ isWithinEditor: ((element: Element) => boolean) | undefined;
6
+ generateID: () => string;
7
+ }, any>;
3
8
  export { UniqueID as default, UniqueID };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ */
4
+ export {};
@@ -1,11 +1,7 @@
1
1
  export * from "./BackgroundColor/BackgroundColorExtension.js";
2
2
  export * from "./HardBreak/HardBreak.js";
3
3
  export * from "./KeyboardShortcuts/KeyboardShortcutsExtension.js";
4
- export * from "./Suggestions/SuggestionMarks.js";
5
4
  export * from "./TextAlignment/TextAlignmentExtension.js";
6
5
  export * from "./TextColor/TextColorExtension.js";
7
6
  export * from "./UniqueID/UniqueID.js";
8
- export declare const DEFAULT_TIP_TAP_EXTENSIONS: (import("@tiptap/core").Node<any, any> | import("@tiptap/core").Mark<any, any> | import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Extension<{
9
- editor: import("../../index.js").BlockNoteEditor<any, any, any>;
10
- tabBehavior: "prefer-navigate-ui" | "prefer-indent";
11
- }, any>)[];
7
+ export * from "./Link/link.js";
@@ -145,7 +145,7 @@ export declare const en: {
145
145
  group: string;
146
146
  };
147
147
  };
148
- placeholders: Record<string | "default" | "emptyDocument", string | undefined>;
148
+ placeholders: Record<string, string | undefined>;
149
149
  file_blocks: {
150
150
  add_button_text: Record<string, string>;
151
151
  };
@@ -300,6 +300,7 @@ export declare const en: {
300
300
  save_button_text: string;
301
301
  cancel_button_text: string;
302
302
  deleted_reference_text: string;
303
+ discard_pending_comment: string;
303
304
  actions: {
304
305
  add_reaction: string;
305
306
  resolve: string;
@@ -316,6 +317,13 @@ export declare const en: {
316
317
  more_replies: (count: number) => string;
317
318
  };
318
319
  };
320
+ suggestion_changes: {
321
+ formatting_change: string;
322
+ deleted: string;
323
+ inserted_by: (users: string) => string;
324
+ deleted_by: (users: string) => string;
325
+ formatting_change_by: (formats: string, users: string) => string;
326
+ };
319
327
  generic: {
320
328
  ctrl_shortcut: string;
321
329
  };
@@ -145,7 +145,7 @@ export declare const fa: {
145
145
  group: string;
146
146
  };
147
147
  };
148
- placeholders: Record<string | "default" | "emptyDocument", string | undefined>;
148
+ placeholders: Record<string, string | undefined>;
149
149
  file_blocks: {
150
150
  add_button_text: Record<string, string>;
151
151
  };
@@ -300,6 +300,7 @@ export declare const fa: {
300
300
  save_button_text: string;
301
301
  cancel_button_text: string;
302
302
  deleted_reference_text: string;
303
+ discard_pending_comment: string;
303
304
  actions: {
304
305
  add_reaction: string;
305
306
  resolve: string;
@@ -316,6 +317,13 @@ export declare const fa: {
316
317
  more_replies: (count: number) => string;
317
318
  };
318
319
  };
320
+ suggestion_changes: {
321
+ formatting_change: string;
322
+ deleted: string;
323
+ inserted_by: (users: string) => string;
324
+ deleted_by: (users: string) => string;
325
+ formatting_change_by: (formats: string, users: string) => string;
326
+ };
319
327
  generic: {
320
328
  ctrl_shortcut: string;
321
329
  };
@@ -145,7 +145,7 @@ export declare const sk: {
145
145
  group: string;
146
146
  };
147
147
  };
148
- placeholders: Record<string | "default" | "emptyDocument", string | undefined>;
148
+ placeholders: Record<string, string | undefined>;
149
149
  file_blocks: {
150
150
  add_button_text: Record<string, string>;
151
151
  };
@@ -335,6 +335,7 @@ export declare const sk: {
335
335
  save_button_text: string;
336
336
  cancel_button_text: string;
337
337
  deleted_reference_text: string;
338
+ discard_pending_comment: string;
338
339
  actions: {
339
340
  add_reaction: string;
340
341
  resolve: string;
@@ -351,6 +352,13 @@ export declare const sk: {
351
352
  more_replies: (count: number) => string;
352
353
  };
353
354
  };
355
+ suggestion_changes: {
356
+ formatting_change: string;
357
+ deleted: string;
358
+ inserted_by: (users: string) => string;
359
+ deleted_by: (users: string) => string;
360
+ formatting_change_by: (formats: string, users: string) => string;
361
+ };
354
362
  generic: {
355
363
  ctrl_shortcut: string;
356
364
  };
@@ -6,6 +6,7 @@ export * from "./api/exporters/html/externalHTMLExporter.js";
6
6
  export * from "./api/exporters/html/internalHTMLSerializer.js";
7
7
  export * from "./api/getBlockInfoFromPos.js";
8
8
  export * from "./api/getBlocksChangedByTransaction.js";
9
+ export * from "./pm-nodes/suggestionMarks.js";
9
10
  export * from "./api/nodeUtil.js";
10
11
  export * from "./api/pmUtil.js";
11
12
  export * from "./blocks/index.js";
@@ -18,6 +19,7 @@ export * from "./extensions/index.js";
18
19
  export * from "./extensions-shared/UiElementPosition.js";
19
20
  export * from "./i18n/dictionary.js";
20
21
  export * from "./schema/index.js";
22
+ export * from "./user/index.js";
21
23
  export * from "./util/browser.js";
22
24
  export * from "./util/combineByGroup.js";
23
25
  export * from "./util/expandToWords.js";
@@ -0,0 +1,26 @@
1
+ import { Editor } from "@tiptap/core";
2
+ /**
3
+ * The mark schema group shared by every "suggestion" mark — both the Yjs
4
+ * collaboration marks (`y-attributed-*`) and the AI marks (`insertion` /
5
+ * `deletion` / `modification`). A mark opts into being allowed on block nodes by
6
+ * declaring this group in its spec (`group: BLOCK_LEVEL_SUGGESTION_GROUP`).
7
+ */
8
+ export declare const BLOCK_LEVEL_SUGGESTION_GROUP = "blockLevelSuggestion";
9
+ /**
10
+ * Block node specs (blockContainer, blockGroup, doc, table cells, columns...)
11
+ * allow the suggestion marks so that a whole block can be marked inserted /
12
+ * deleted / modified in suggestion mode.
13
+ *
14
+ * These marks only exist when the extension that provides them is loaded; a node
15
+ * spec that referenced them unconditionally would make ProseMirror throw
16
+ * "Unknown mark type" while building the schema of an editor that doesn't have
17
+ * them (e.g. a plain, non-collaborative, non-AI editor) — this applies to a mark
18
+ * group with no members too.
19
+ *
20
+ * Use this as a node's `marks` field: it returns the {@link
21
+ * BLOCK_LEVEL_SUGGESTION_GROUP} group name (which ProseMirror expands to every
22
+ * mark in the group) when at least one such mark is registered on the editor, or
23
+ * `""` otherwise. It's evaluated at schema-build time, where the tiptap editor's
24
+ * fully-flattened extension list is available on `this.editor`.
25
+ */
26
+ export declare function suggestionMarks(editor: Editor | undefined): string;
@@ -5,8 +5,8 @@ import { Extension, ExtensionFactoryInstance } from "../../editor/BlockNoteExten
5
5
  import { PropSchema } from "../propTypes.js";
6
6
  import { BlockConfig, BlockImplementation, BlockImplementationOrCreator, BlockSpec, LooseBlockSpec } from "./types.js";
7
7
  export declare function applyNonSelectableBlockFix(nodeView: NodeView, editor: Editor): void;
8
- export declare function getParseRules<TName extends string, TProps extends PropSchema, TContent extends "inline" | "none" | "table">(config: BlockConfig<TName, TProps, TContent>, implementation: BlockImplementation<TName, TProps, TContent>): TagParseRule[];
9
- export declare function addNodeAndExtensionsToSpec<TName extends string, TProps extends PropSchema, TContent extends "inline" | "none" | "table">(blockConfig: BlockConfig<TName, TProps, TContent>, blockImplementation: BlockImplementation<TName, TProps, TContent>, extensions?: (ExtensionFactoryInstance | Extension)[], priority?: number): LooseBlockSpec<TName, TProps, TContent>;
8
+ export declare function getParseRules<TName extends string, TProps extends PropSchema, TContent extends "inline" | "none" | "table" | "plain">(config: BlockConfig<TName, TProps, TContent>, implementation: BlockImplementation<TName, TProps, TContent>): TagParseRule[];
9
+ export declare function addNodeAndExtensionsToSpec<TName extends string, TProps extends PropSchema, TContent extends "inline" | "none" | "table" | "plain">(blockConfig: BlockConfig<TName, TProps, TContent>, blockImplementation: BlockImplementation<TName, TProps, TContent>, extensions?: (ExtensionFactoryInstance | Extension)[], priority?: number): LooseBlockSpec<TName, TProps, TContent>;
10
10
  /**
11
11
  * Helper function to create a block config.
12
12
  */
@@ -15,5 +15,5 @@ export declare function createBlockConfig<TCallback extends (options: Partial<Re
15
15
  * Helper function to create a block definition.
16
16
  * Can accept either functions that return the required objects, or the objects directly.
17
17
  */
18
- export declare function createBlockSpec<const TName extends string, const TProps extends PropSchema, const TContent extends "inline" | "none", const TOptions extends Partial<Record<string, any>> | undefined = undefined>(blockConfigOrCreator: BlockConfig<TName, TProps, TContent>, blockImplementationOrCreator: BlockImplementationOrCreator<BlockConfig<TName, TProps, TContent>, TOptions>, extensionsOrCreator?: (ExtensionFactoryInstance | Extension)[] | (TOptions extends undefined ? () => (ExtensionFactoryInstance | Extension)[] : (options: Partial<TOptions>) => (ExtensionFactoryInstance | Extension)[])): (options?: Partial<TOptions>) => BlockSpec<TName, TProps, TContent>;
19
- export declare function createBlockSpec<const TName extends string, const TProps extends PropSchema, const TContent extends "inline" | "none", const BlockConf extends BlockConfig<TName, TProps, TContent>, const TOptions extends Partial<Record<string, any>>>(blockCreator: (options: Partial<TOptions>) => BlockConf, blockImplementationOrCreator: BlockImplementationOrCreator<BlockConf, TOptions>, extensionsOrCreator?: (ExtensionFactoryInstance | Extension)[] | (TOptions extends undefined ? () => (ExtensionFactoryInstance | Extension)[] : (options: Partial<TOptions>) => (ExtensionFactoryInstance | Extension)[])): (options?: Partial<TOptions>) => BlockSpec<BlockConf["type"], BlockConf["propSchema"], BlockConf["content"]>;
18
+ export declare function createBlockSpec<const TName extends string, const TProps extends PropSchema, const TContent extends "inline" | "none" | "plain", const TOptions extends Partial<Record<string, any>> | undefined = undefined>(blockConfigOrCreator: BlockConfig<TName, TProps, TContent>, blockImplementationOrCreator: BlockImplementationOrCreator<BlockConfig<TName, TProps, TContent>, TOptions>, extensionsOrCreator?: (ExtensionFactoryInstance | Extension)[] | (TOptions extends undefined ? () => (ExtensionFactoryInstance | Extension)[] : (options: Partial<TOptions>) => (ExtensionFactoryInstance | Extension)[])): (options?: Partial<TOptions>) => BlockSpec<TName, TProps, TContent>;
19
+ export declare function createBlockSpec<const TName extends string, const TProps extends PropSchema, const TContent extends "inline" | "none" | "plain", const BlockConf extends BlockConfig<TName, TProps, TContent>, const TOptions extends Partial<Record<string, any>>>(blockCreator: (options: Partial<TOptions>) => BlockConf, blockImplementationOrCreator: BlockImplementationOrCreator<BlockConf, TOptions>, extensionsOrCreator?: (ExtensionFactoryInstance | Extension)[] | (TOptions extends undefined ? () => (ExtensionFactoryInstance | Extension)[] : (options: Partial<TOptions>) => (ExtensionFactoryInstance | Extension)[])): (options?: Partial<TOptions>) => BlockSpec<BlockConf["type"], BlockConf["propSchema"], BlockConf["content"]>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};