@blocknote/core 0.56.0 → 0.57.1

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 (733) hide show
  1. package/NOTICE.txt +101 -0
  2. package/dist/BlockNoteExtension-U58cXw1g.js +64 -0
  3. package/dist/ThreadStore-CSEwCO0O.js +8 -0
  4. package/dist/{UserStore-OZJP3K8T.js → UserStore-BFv6NXA-.js} +3 -7
  5. package/dist/ar-DPJDxCQI.js +3 -0
  6. package/dist/blocknote.js +8 -6
  7. package/dist/blocks-BUX9dXi9.js +2063 -0
  8. package/dist/blocks.js +3 -2
  9. package/dist/comments.js +8 -9
  10. package/dist/de-CakHBokE.js +3 -0
  11. package/dist/emoji-data.js +102 -0
  12. package/dist/en-BGdzE27X.js +3 -0
  13. package/dist/{en-Ch-vvt5e.js → en-Ne9rlj9Y.js} +9 -6
  14. package/dist/es-VeBX6MEG.js +3 -0
  15. package/dist/{extensions-BbM81hHa.js → extensions-CEgexSyF.js} +846 -824
  16. package/dist/extensions.js +4 -4
  17. package/dist/fa-Dt7EYtKf.js +3 -0
  18. package/dist/fr-DUhhjxrJ.js +3 -0
  19. package/dist/getDefaultSlashMenuItems-DfDOr807.js +1939 -0
  20. package/dist/he-BShJg1dK.js +3 -0
  21. package/dist/hr-BXtyqmwg.js +3 -0
  22. package/dist/is-2Fb-0w_j.js +3 -0
  23. package/dist/it-CiZtVb3Y.js +3 -0
  24. package/dist/ja-CsxD3kEL.js +3 -0
  25. package/dist/ko-It6g03Cy.js +3 -0
  26. package/dist/locales.js +692 -54
  27. package/dist/markGroups-BszXCkX8.js +18 -0
  28. package/dist/nb-CLao87La.js +3 -0
  29. package/dist/nl-JQSo8dht.js +3 -0
  30. package/dist/pl-DEMBgHEP.js +3 -0
  31. package/dist/pt-CBCdYAax.js +3 -0
  32. package/dist/ru-BQk_9Q-L.js +3 -0
  33. package/dist/sk-kgB2DtDL.js +3 -0
  34. package/dist/{src-BmLsLZfE.js → src-DksfoQmN.js} +1173 -1090
  35. package/dist/style.css +1 -1
  36. package/dist/tr-DkcSXX8f.js +3 -0
  37. package/dist/uk-Bib-e6bV.js +3 -0
  38. package/dist/uz-B2jaKhJb.js +3 -0
  39. package/dist/vi-V_GFRxE8.js +3 -0
  40. package/dist/y.js +366 -365
  41. package/dist/yjs.js +140 -138
  42. package/dist/zh-hant-2ZrAkFnC.js +3 -0
  43. package/dist/zh-jglyCmjs.js +3 -0
  44. package/package.json +45 -21
  45. package/types/src/api/blockManipulation/layoutBlocks/layoutBlocks.fixture.d.ts +5 -0
  46. package/types/src/api/blockManipulation/tables/tables.d.ts +9 -4
  47. package/types/src/api/clipboard/fromClipboard/normalizeOfficeHTML.d.ts +5 -0
  48. package/types/src/api/exporters/markdown/wrapWithDelimiter.d.ts +6 -0
  49. package/types/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.d.ts +4 -0
  50. package/types/src/blocks/defaultBlocks.d.ts +10 -0
  51. package/types/src/editor/BlockNoteEditor.d.ts +2 -1
  52. package/types/src/editor/managers/ExtensionManager/index.d.ts +4 -4
  53. package/types/src/editor/managers/StyleManager.d.ts +2 -1
  54. package/types/src/emoji-data/frimousse/ar.d.ts +2 -0
  55. package/types/src/emoji-data/frimousse/common.d.ts +3 -0
  56. package/types/src/emoji-data/frimousse/de.d.ts +2 -0
  57. package/types/src/emoji-data/frimousse/en.d.ts +2 -0
  58. package/types/src/emoji-data/frimousse/es.d.ts +2 -0
  59. package/types/src/emoji-data/frimousse/fa.d.ts +2 -0
  60. package/types/src/emoji-data/frimousse/fr.d.ts +2 -0
  61. package/types/src/emoji-data/frimousse/he.d.ts +2 -0
  62. package/types/src/emoji-data/frimousse/hr.d.ts +2 -0
  63. package/types/src/emoji-data/frimousse/is.d.ts +2 -0
  64. package/types/src/emoji-data/frimousse/it.d.ts +2 -0
  65. package/types/src/emoji-data/frimousse/ja.d.ts +2 -0
  66. package/types/src/emoji-data/frimousse/ko.d.ts +2 -0
  67. package/types/src/emoji-data/frimousse/loadFrimousseData.d.ts +2 -0
  68. package/types/src/emoji-data/frimousse/nb.d.ts +2 -0
  69. package/types/src/emoji-data/frimousse/nl.d.ts +2 -0
  70. package/types/src/emoji-data/frimousse/pl.d.ts +2 -0
  71. package/types/src/emoji-data/frimousse/pt.d.ts +2 -0
  72. package/types/src/emoji-data/frimousse/ru.d.ts +2 -0
  73. package/types/src/emoji-data/frimousse/sk.d.ts +2 -0
  74. package/types/src/emoji-data/frimousse/tr.d.ts +2 -0
  75. package/types/src/emoji-data/frimousse/types.d.ts +21 -0
  76. package/types/src/emoji-data/frimousse/uk.d.ts +2 -0
  77. package/types/src/emoji-data/frimousse/uz.d.ts +2 -0
  78. package/types/src/emoji-data/frimousse/vi.d.ts +2 -0
  79. package/types/src/emoji-data/frimousse/zh-hant.d.ts +2 -0
  80. package/types/src/emoji-data/frimousse/zh.d.ts +2 -0
  81. package/types/src/emoji-data/index.d.ts +3 -0
  82. package/types/src/emoji-data/searchEmojis.d.ts +5 -0
  83. package/types/src/extensions/Loading/Loading.d.ts +11 -0
  84. package/types/src/extensions/SideMenu/MultipleNodeSelection.d.ts +13 -4
  85. package/types/src/extensions/SideMenu/SideMenu.d.ts +2 -1
  86. package/types/src/extensions/Versioning/Versioning.d.ts +2 -0
  87. package/types/src/extensions/Versioning/inMemoryVersioning.d.ts +1 -0
  88. package/types/src/extensions/Versioning/types.d.ts +12 -6
  89. package/types/src/extensions/Versioning/versioningState.d.ts +6 -0
  90. package/types/src/extensions/index.d.ts +1 -2
  91. package/types/src/i18n/dictionary.d.ts +4 -1
  92. package/types/src/i18n/locales/en.d.ts +6 -0
  93. package/types/src/i18n/locales/fa.d.ts +6 -0
  94. package/types/src/i18n/locales/index.d.ts +1 -0
  95. package/types/src/i18n/locales/sk.d.ts +6 -0
  96. package/types/src/i18n/locales/tr.d.ts +378 -0
  97. package/types/src/index.d.ts +0 -1
  98. package/types/src/schema/inlineContent/createSpec.d.ts +2 -1
  99. package/types/src/schema/inlineContent/internal.d.ts +1 -1
  100. package/types/src/schema/inlineContent/types.d.ts +2 -4
  101. package/types/src/schema/styles/createSpec.d.ts +2 -1
  102. package/types/src/schema/styles/internal.d.ts +4 -1
  103. package/types/src/schema/styles/types.d.ts +2 -0
  104. package/types/src/y/extensions/YSync.d.ts +1 -1
  105. package/types/src/y/extensions/index.d.ts +1 -1
  106. package/types/src/y/versioning/yhub.d.ts +2 -0
  107. package/types/src/yjs/extensions/Versioning.d.ts +1 -0
  108. package/types/src/yjs/extensions/YUndo.d.ts +3 -2
  109. package/types/src/yjs/extensions/index.d.ts +1 -1
  110. package/dist/BlockNoteExtension-DjEkXkR5.cjs +0 -2
  111. package/dist/BlockNoteExtension-DjEkXkR5.cjs.map +0 -1
  112. package/dist/BlockNoteExtension-TsTGtIeX.js +0 -87
  113. package/dist/BlockNoteExtension-TsTGtIeX.js.map +0 -1
  114. package/dist/ThreadStore-Bx-gSEh1.cjs +0 -2
  115. package/dist/ThreadStore-Bx-gSEh1.cjs.map +0 -1
  116. package/dist/ThreadStore-et9wB5Xt.js +0 -11
  117. package/dist/ThreadStore-et9wB5Xt.js.map +0 -1
  118. package/dist/UserStore-CTVzVGh-.cjs +0 -2
  119. package/dist/UserStore-CTVzVGh-.cjs.map +0 -1
  120. package/dist/UserStore-OZJP3K8T.js.map +0 -1
  121. package/dist/blocknote.cjs +0 -1
  122. package/dist/blocks-COVwe5Cf.cjs +0 -12
  123. package/dist/blocks-COVwe5Cf.cjs.map +0 -1
  124. package/dist/blocks-COYcDVg7.js +0 -3943
  125. package/dist/blocks-COYcDVg7.js.map +0 -1
  126. package/dist/blocks.cjs +0 -1
  127. package/dist/comments.cjs +0 -2
  128. package/dist/comments.cjs.map +0 -1
  129. package/dist/comments.js.map +0 -1
  130. package/dist/en-Ch-vvt5e.js.map +0 -1
  131. package/dist/en-N5lu0-j8.cjs +0 -2
  132. package/dist/en-N5lu0-j8.cjs.map +0 -1
  133. package/dist/extensions-BbM81hHa.js.map +0 -1
  134. package/dist/extensions-D_WkAfSt.cjs +0 -58
  135. package/dist/extensions-D_WkAfSt.cjs.map +0 -1
  136. package/dist/extensions.cjs +0 -1
  137. package/dist/locales.cjs +0 -2
  138. package/dist/locales.cjs.map +0 -1
  139. package/dist/locales.js.map +0 -1
  140. package/dist/src-4OQT3z5S.cjs +0 -23
  141. package/dist/src-4OQT3z5S.cjs.map +0 -1
  142. package/dist/src-BmLsLZfE.js.map +0 -1
  143. package/dist/webpack-stats.json +0 -1
  144. package/dist/y.cjs +0 -2
  145. package/dist/y.cjs.map +0 -1
  146. package/dist/y.js.map +0 -1
  147. package/dist/yjs.cjs +0 -2
  148. package/dist/yjs.cjs.map +0 -1
  149. package/dist/yjs.js.map +0 -1
  150. package/src/api/README.md +0 -8
  151. package/src/api/__snapshots__/blocks-deleted-nested-deep.json +0 -26
  152. package/src/api/__snapshots__/blocks-deleted-nested.json +0 -68
  153. package/src/api/__snapshots__/blocks-deleted.json +0 -26
  154. package/src/api/__snapshots__/blocks-indented-changed.json +0 -129
  155. package/src/api/__snapshots__/blocks-inserted-nested.json +0 -62
  156. package/src/api/__snapshots__/blocks-inserted.json +0 -20
  157. package/src/api/__snapshots__/blocks-moved-deeper-into-nesting.json +0 -164
  158. package/src/api/__snapshots__/blocks-moved-down-twice-in-same-parent.json +0 -44
  159. package/src/api/__snapshots__/blocks-moved-insert-changes-sibling-order.json +0 -26
  160. package/src/api/__snapshots__/blocks-moved-multiple-in-same-transaction.json +0 -188
  161. package/src/api/__snapshots__/blocks-moved-nested-sibling-reorder.json +0 -180
  162. package/src/api/__snapshots__/blocks-moved-to-different-parent.json +0 -78
  163. package/src/api/__snapshots__/blocks-moved-to-root-level.json +0 -78
  164. package/src/api/__snapshots__/blocks-moved-up-down-in-same-parent.json +0 -44
  165. package/src/api/__snapshots__/blocks-moved-up-down-in-same-transaction.json +0 -44
  166. package/src/api/__snapshots__/blocks-outdented-changed.json +0 -129
  167. package/src/api/__snapshots__/blocks-updated-content-inserted.json +0 -42
  168. package/src/api/__snapshots__/blocks-updated-multiple-insert.json +0 -50
  169. package/src/api/__snapshots__/blocks-updated-multiple.json +0 -82
  170. package/src/api/__snapshots__/blocks-updated-nested-deep.json +0 -42
  171. package/src/api/__snapshots__/blocks-updated-nested-multiple.json +0 -118
  172. package/src/api/__snapshots__/blocks-updated-nested.json +0 -78
  173. package/src/api/__snapshots__/blocks-updated-single.json +0 -42
  174. package/src/api/__snapshots__/blocks-updated.json +0 -42
  175. package/src/api/blockManipulation/__snapshots__/transactions.test.ts.snap +0 -34
  176. package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +0 -4570
  177. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts +0 -176
  178. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +0 -95
  179. package/src/api/blockManipulation/commands/insertBlocks/insertPlacement.test.ts +0 -217
  180. package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +0 -2761
  181. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +0 -251
  182. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +0 -187
  183. package/src/api/blockManipulation/commands/moveBlocks/__snapshots__/moveBlocks.test.ts.snap +0 -13625
  184. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +0 -391
  185. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +0 -350
  186. package/src/api/blockManipulation/commands/nestBlock/__snapshots__/nestBlock.test.ts.snap +0 -952
  187. package/src/api/blockManipulation/commands/nestBlock/nestBlock.test.ts +0 -917
  188. package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +0 -248
  189. package/src/api/blockManipulation/commands/replaceBlocks/__snapshots__/replaceBlocks.test.ts.snap +0 -5710
  190. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.ts +0 -306
  191. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +0 -143
  192. package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +0 -3507
  193. package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +0 -364
  194. package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +0 -90
  195. package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +0 -15085
  196. package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +0 -1210
  197. package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +0 -706
  198. package/src/api/blockManipulation/getBlock/getBlock.ts +0 -104
  199. package/src/api/blockManipulation/insertContentAt.ts +0 -83
  200. package/src/api/blockManipulation/layoutBlocks/fixLayoutBlock.ts +0 -173
  201. package/src/api/blockManipulation/layoutBlocks/layoutBlocks.browser.test.ts +0 -293
  202. package/src/api/blockManipulation/layoutBlocks/layoutBlocks.fixture.ts +0 -145
  203. package/src/api/blockManipulation/layoutBlocks/layoutBlocks.test.ts +0 -783
  204. package/src/api/blockManipulation/layoutBlocks/plainBlocks.test.ts +0 -180
  205. package/src/api/blockManipulation/layoutBlocks/titledBlocks.test.ts +0 -365
  206. package/src/api/blockManipulation/selections/selection.ts +0 -234
  207. package/src/api/blockManipulation/selections/textCursorPosition.ts +0 -63
  208. package/src/api/blockManipulation/setupTestEnv.ts +0 -223
  209. package/src/api/blockManipulation/tables/tables.test.ts +0 -2127
  210. package/src/api/blockManipulation/tables/tables.ts +0 -887
  211. package/src/api/clipboard/fromClipboard/acceptedMIMETypes.ts +0 -8
  212. package/src/api/clipboard/fromClipboard/fileDropExtension.ts +0 -55
  213. package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +0 -209
  214. package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +0 -38
  215. package/src/api/clipboard/fromClipboard/pasteExtension.ts +0 -157
  216. package/src/api/clipboard/toClipboard/copyExtension.ts +0 -299
  217. package/src/api/combineTransactionSteps.ts +0 -22
  218. package/src/api/exporters/html/externalHTMLExporter.ts +0 -76
  219. package/src/api/exporters/html/internalHTMLSerializer.ts +0 -182
  220. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +0 -510
  221. package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +0 -283
  222. package/src/api/exporters/markdown/htmlToMarkdown.ts +0 -895
  223. package/src/api/exporters/markdown/markdownExporter.ts +0 -41
  224. package/src/api/getBlockInfoFromPos.test.ts +0 -681
  225. package/src/api/getBlockInfoFromPos.ts +0 -693
  226. package/src/api/getBlocksChangedByTransaction.test.ts +0 -783
  227. package/src/api/getBlocksChangedByTransaction.ts +0 -458
  228. package/src/api/getChangedRangeWithAttrs.ts +0 -54
  229. package/src/api/getChangedRanges.test.ts +0 -391
  230. package/src/api/getChangedRanges.ts +0 -368
  231. package/src/api/nodeConversions/blockToNode.test.ts +0 -113
  232. package/src/api/nodeConversions/blockToNode.ts +0 -427
  233. package/src/api/nodeConversions/fragmentToBlocks.ts +0 -48
  234. package/src/api/nodeConversions/nodeToBlock.ts +0 -717
  235. package/src/api/nodeUtil.ts +0 -46
  236. package/src/api/parsers/html/parseHTML.ts +0 -80
  237. package/src/api/parsers/html/util/__snapshots__/nestedLists.test.ts.snap +0 -144
  238. package/src/api/parsers/html/util/nestedLists.test.ts +0 -165
  239. package/src/api/parsers/html/util/nestedLists.ts +0 -123
  240. package/src/api/parsers/html/util/normalizeWhitespace.ts +0 -87
  241. package/src/api/parsers/markdown/autolink.ts +0 -23
  242. package/src/api/parsers/markdown/detectMarkdown.test.ts +0 -211
  243. package/src/api/parsers/markdown/detectMarkdown.ts +0 -61
  244. package/src/api/parsers/markdown/markdownToHtml.ts +0 -1444
  245. package/src/api/parsers/markdown/parseMarkdown.ts +0 -24
  246. package/src/api/pmUtil.ts +0 -79
  247. package/src/api/positionMapping.test.ts +0 -209
  248. package/src/api/positionMapping.ts +0 -42
  249. package/src/blocks/Audio/block.ts +0 -171
  250. package/src/blocks/Audio/parseAudioElement.ts +0 -5
  251. package/src/blocks/BlockNoteSchema.ts +0 -59
  252. package/src/blocks/Code/CodeBlockOptions.ts +0 -83
  253. package/src/blocks/Code/block.test.ts +0 -265
  254. package/src/blocks/Code/block.ts +0 -56
  255. package/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.ts +0 -125
  256. package/src/blocks/Code/helpers/parse/parsePreCode.ts +0 -45
  257. package/src/blocks/Code/helpers/render/createCodeBlock.ts +0 -98
  258. package/src/blocks/Code/helpers/toExternalHTML/createPreCode.ts +0 -14
  259. package/src/blocks/Divider/block.ts +0 -49
  260. package/src/blocks/File/block.ts +0 -95
  261. package/src/blocks/File/helpers/parse/parseEmbedElement.ts +0 -5
  262. package/src/blocks/File/helpers/parse/parseFigureElement.ts +0 -16
  263. package/src/blocks/File/helpers/render/createAddFileButton.ts +0 -69
  264. package/src/blocks/File/helpers/render/createFileBlockWrapper.ts +0 -88
  265. package/src/blocks/File/helpers/render/createFileNameWithIcon.ts +0 -37
  266. package/src/blocks/File/helpers/render/createResizableFileBlockWrapper.ts +0 -271
  267. package/src/blocks/File/helpers/toExternalHTML/createFigureWithCaption.ts +0 -13
  268. package/src/blocks/File/helpers/toExternalHTML/createLinkWithCaption.ts +0 -15
  269. package/src/blocks/Heading/block.ts +0 -227
  270. package/src/blocks/Image/block.ts +0 -193
  271. package/src/blocks/Image/parseImageElement.ts +0 -7
  272. package/src/blocks/ListItem/BulletListItem/block.ts +0 -129
  273. package/src/blocks/ListItem/CheckListItem/block.test.ts +0 -61
  274. package/src/blocks/ListItem/CheckListItem/block.ts +0 -184
  275. package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.test.ts +0 -352
  276. package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts +0 -239
  277. package/src/blocks/ListItem/NumberedListItem/block.ts +0 -143
  278. package/src/blocks/ListItem/ToggleListItem/block.ts +0 -139
  279. package/src/blocks/ListItem/getListItemContent.ts +0 -115
  280. package/src/blocks/PageBreak/block.ts +0 -72
  281. package/src/blocks/PageBreak/getPageBreakSlashMenuItems.ts +0 -47
  282. package/src/blocks/Paragraph/block.ts +0 -80
  283. package/src/blocks/Quote/block.ts +0 -99
  284. package/src/blocks/README.md +0 -3
  285. package/src/blocks/Table/TableExtension.test.ts +0 -231
  286. package/src/blocks/Table/TableExtension.ts +0 -115
  287. package/src/blocks/Table/block.ts +0 -492
  288. package/src/blocks/ToggleWrapper/createToggleFrame.ts +0 -126
  289. package/src/blocks/ToggleWrapper/toggleBlocks.browser.test.ts +0 -1056
  290. package/src/blocks/Video/block.ts +0 -142
  291. package/src/blocks/Video/parseVideoElement.ts +0 -7
  292. package/src/blocks/defaultBlockHelpers.ts +0 -113
  293. package/src/blocks/defaultBlockTypeGuards.ts +0 -167
  294. package/src/blocks/defaultBlockTypeItems.test.ts +0 -70
  295. package/src/blocks/defaultBlockTypeItems.ts +0 -99
  296. package/src/blocks/defaultBlocks.test.ts +0 -67
  297. package/src/blocks/defaultBlocks.ts +0 -214
  298. package/src/blocks/defaultProps.ts +0 -165
  299. package/src/blocks/getDetailsContent.ts +0 -77
  300. package/src/blocks/index.ts +0 -30
  301. package/src/comments/CommentEditorSubmitExtension.test.ts +0 -141
  302. package/src/comments/CommentEditorSubmitExtension.ts +0 -56
  303. package/src/comments/extension.ts +0 -396
  304. package/src/comments/index.ts +0 -8
  305. package/src/comments/mark.ts +0 -64
  306. package/src/comments/threadstore/DefaultThreadStoreAuth.ts +0 -106
  307. package/src/comments/threadstore/ThreadStore.ts +0 -130
  308. package/src/comments/threadstore/ThreadStoreAuth.ts +0 -13
  309. package/src/comments/threadstore/TipTapThreadStore.ts +0 -292
  310. package/src/comments/threadstore/tiptap/types.ts +0 -131
  311. package/src/comments/types.ts +0 -121
  312. package/src/editor/Block.css +0 -1498
  313. package/src/editor/BlockNoteEditor.node.test.ts +0 -35
  314. package/src/editor/BlockNoteEditor.test.ts +0 -278
  315. package/src/editor/BlockNoteEditor.ts +0 -1559
  316. package/src/editor/BlockNoteExtension.test.ts +0 -103
  317. package/src/editor/BlockNoteExtension.ts +0 -246
  318. package/src/editor/README.md +0 -3
  319. package/src/editor/blockColors.browser.test.ts +0 -127
  320. package/src/editor/cursorPositionTypes.ts +0 -17
  321. package/src/editor/defaultColors.ts +0 -77
  322. package/src/editor/editor.css +0 -257
  323. package/src/editor/managers/BlockManager.ts +0 -256
  324. package/src/editor/managers/EventManager.browser.test.ts +0 -334
  325. package/src/editor/managers/EventManager.ts +0 -260
  326. package/src/editor/managers/ExportManager.ts +0 -137
  327. package/src/editor/managers/ExtensionManager/ExtensionManager.browser.test.ts +0 -45
  328. package/src/editor/managers/ExtensionManager/ExtensionManager.node.test.ts +0 -209
  329. package/src/editor/managers/ExtensionManager/ExtensionManager.test.ts +0 -336
  330. package/src/editor/managers/ExtensionManager/extensions.ts +0 -200
  331. package/src/editor/managers/ExtensionManager/index.ts +0 -764
  332. package/src/editor/managers/ExtensionManager/symbol.ts +0 -5
  333. package/src/editor/managers/SelectionManager.ts +0 -120
  334. package/src/editor/managers/StateManager.ts +0 -261
  335. package/src/editor/managers/StyleManager.browser.test.ts +0 -122
  336. package/src/editor/managers/StyleManager.test.ts +0 -98
  337. package/src/editor/managers/StyleManager.ts +0 -278
  338. package/src/editor/managers/index.ts +0 -8
  339. package/src/editor/performance.test.ts +0 -192
  340. package/src/editor/selectionTypes.ts +0 -14
  341. package/src/editor/transformPasted.test.ts +0 -295
  342. package/src/editor/transformPasted.ts +0 -294
  343. package/src/exporter/ExportImage.ts +0 -50
  344. package/src/exporter/Exporter.test.ts +0 -255
  345. package/src/exporter/Exporter.ts +0 -185
  346. package/src/exporter/index.ts +0 -3
  347. package/src/exporter/mapping.ts +0 -110
  348. package/src/extensions/BlockChange/BlockChange.ts +0 -67
  349. package/src/extensions/DropCursor/DropCursor.ts +0 -376
  350. package/src/extensions/DropCursor/dropIntoChildren.ts +0 -80
  351. package/src/extensions/DropCursor/utils.ts +0 -195
  352. package/src/extensions/FilePanel/FilePanel.ts +0 -41
  353. package/src/extensions/FormattingToolbar/FormattingToolbar.ts +0 -157
  354. package/src/extensions/History/History.ts +0 -11
  355. package/src/extensions/InlineContentBoundaryEdit/InlineContentBoundaryEdit.ts +0 -109
  356. package/src/extensions/LinkToolbar/LinkToolbar.ts +0 -76
  357. package/src/extensions/LinkToolbar/protocols.ts +0 -13
  358. package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.test.ts +0 -190
  359. package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.ts +0 -112
  360. package/src/extensions/Placeholder/Placeholder.test.ts +0 -23
  361. package/src/extensions/Placeholder/Placeholder.ts +0 -150
  362. package/src/extensions/PositionMapping/PositionMapping.ts +0 -68
  363. package/src/extensions/PreviousBlockType/PreviousBlockType.test.ts +0 -156
  364. package/src/extensions/PreviousBlockType/PreviousBlockType.ts +0 -201
  365. package/src/extensions/README.md +0 -3
  366. package/src/extensions/ReadOnly/ReadOnly.test.ts +0 -181
  367. package/src/extensions/ReadOnly/ReadOnly.ts +0 -73
  368. package/src/extensions/ShowSelection/ShowSelection.ts +0 -61
  369. package/src/extensions/SideMenu/MultipleNodeSelection.ts +0 -89
  370. package/src/extensions/SideMenu/SideMenu.ts +0 -470
  371. package/src/extensions/SideMenu/blockDropHandling.ts +0 -372
  372. package/src/extensions/SideMenu/blockGeometry.browser.test.ts +0 -148
  373. package/src/extensions/SideMenu/blockGeometry.test.ts +0 -46
  374. package/src/extensions/SideMenu/blockGeometry.ts +0 -53
  375. package/src/extensions/SideMenu/dragging.ts +0 -200
  376. package/src/extensions/SideMenu/sideMenuHover.test.ts +0 -36
  377. package/src/extensions/SideMenu/sideMenuHover.ts +0 -270
  378. package/src/extensions/SourceBlockWithPreview/SourceBlockWithPreview.ts +0 -193
  379. package/src/extensions/SourceInlineContentWithPreview/SourceInlineContentWithPreview.ts +0 -142
  380. package/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.ts +0 -4
  381. package/src/extensions/SuggestionMenu/DefaultSuggestionItem.ts +0 -11
  382. package/src/extensions/SuggestionMenu/SuggestionMenu.test.ts +0 -309
  383. package/src/extensions/SuggestionMenu/SuggestionMenu.ts +0 -436
  384. package/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts +0 -76
  385. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +0 -299
  386. package/src/extensions/SyntaxHighlighting/SyntaxHighlighting.test.ts +0 -130
  387. package/src/extensions/SyntaxHighlighting/SyntaxHighlighting.ts +0 -89
  388. package/src/extensions/SyntaxHighlighting/inlineHighlight.test.ts +0 -135
  389. package/src/extensions/SyntaxHighlighting/shiki.ts +0 -116
  390. package/src/extensions/TableHandles/TableHandles.browser.test.ts +0 -307
  391. package/src/extensions/TableHandles/TableHandles.ts +0 -1263
  392. package/src/extensions/TrailingNode/TrailingNode.ts +0 -233
  393. package/src/extensions/Versioning/Versioning.browser.test.ts +0 -151
  394. package/src/extensions/Versioning/Versioning.node.test.ts +0 -177
  395. package/src/extensions/Versioning/Versioning.ts +0 -161
  396. package/src/extensions/Versioning/__test__/result.ts +0 -12
  397. package/src/extensions/Versioning/comparison.test.ts +0 -40
  398. package/src/extensions/Versioning/createVersioning.test.ts +0 -867
  399. package/src/extensions/Versioning/createVersioning.ts +0 -499
  400. package/src/extensions/Versioning/formatVersionDate.ts +0 -24
  401. package/src/extensions/Versioning/inMemoryVersioning.test.ts +0 -572
  402. package/src/extensions/Versioning/inMemoryVersioning.ts +0 -268
  403. package/src/extensions/Versioning/index.ts +0 -6
  404. package/src/extensions/Versioning/scrollScheduling.test.ts +0 -51
  405. package/src/extensions/Versioning/scrollToFirstChange.test.ts +0 -320
  406. package/src/extensions/Versioning/scrollToFirstChange.ts +0 -139
  407. package/src/extensions/Versioning/types.ts +0 -219
  408. package/src/extensions/Versioning/versioningState.ts +0 -154
  409. package/src/extensions/blockDOM.browser.test.ts +0 -102
  410. package/src/extensions/blockDOM.test.ts +0 -178
  411. package/src/extensions/blockDOM.ts +0 -135
  412. package/src/extensions/index.ts +0 -27
  413. package/src/extensions/tiptap-extensions/BackgroundColor/BackgroundColorExtension.ts +0 -17
  414. package/src/extensions/tiptap-extensions/HardBreak/HardBreak.ts +0 -35
  415. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.ts +0 -1870
  416. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +0 -1116
  417. package/src/extensions/tiptap-extensions/KeyboardShortcuts/blockIdentity.browser.test.ts +0 -152
  418. package/src/extensions/tiptap-extensions/Link/helpers/autolink.ts +0 -174
  419. package/src/extensions/tiptap-extensions/Link/helpers/clickHandler.ts +0 -82
  420. package/src/extensions/tiptap-extensions/Link/helpers/linkDetector.ts +0 -412
  421. package/src/extensions/tiptap-extensions/Link/helpers/pasteHandler.ts +0 -53
  422. package/src/extensions/tiptap-extensions/Link/helpers/tlds.ts +0 -7
  423. package/src/extensions/tiptap-extensions/Link/helpers/whitespace.ts +0 -13
  424. package/src/extensions/tiptap-extensions/Link/index.ts +0 -2
  425. package/src/extensions/tiptap-extensions/Link/link.test.ts +0 -945
  426. package/src/extensions/tiptap-extensions/Link/link.ts +0 -238
  427. package/src/extensions/tiptap-extensions/TextAlignment/TextAlignmentExtension.ts +0 -33
  428. package/src/extensions/tiptap-extensions/TextColor/TextColorExtension.ts +0 -17
  429. package/src/extensions/tiptap-extensions/UniqueID/UniqueID.test.ts +0 -173
  430. package/src/extensions/tiptap-extensions/UniqueID/UniqueID.ts +0 -339
  431. package/src/extensions/tiptap-extensions/index.ts +0 -7
  432. package/src/extensions-shared/UiElementPosition.ts +0 -4
  433. package/src/fonts/inter.browser.test.ts +0 -57
  434. package/src/i18n/dictionary.ts +0 -17
  435. package/src/i18n/index.ts +0 -2
  436. package/src/i18n/locales/ar.ts +0 -443
  437. package/src/i18n/locales/de.ts +0 -477
  438. package/src/i18n/locales/en.ts +0 -458
  439. package/src/i18n/locales/es.ts +0 -456
  440. package/src/i18n/locales/fa.ts +0 -427
  441. package/src/i18n/locales/fr.ts +0 -504
  442. package/src/i18n/locales/he.ts +0 -458
  443. package/src/i18n/locales/hr.ts +0 -472
  444. package/src/i18n/locales/index.ts +0 -23
  445. package/src/i18n/locales/is.ts +0 -472
  446. package/src/i18n/locales/it.ts +0 -480
  447. package/src/i18n/locales/ja.ts +0 -498
  448. package/src/i18n/locales/ko.ts +0 -471
  449. package/src/i18n/locales/nl.ts +0 -459
  450. package/src/i18n/locales/no.ts +0 -476
  451. package/src/i18n/locales/pl.ts +0 -449
  452. package/src/i18n/locales/pt.ts +0 -451
  453. package/src/i18n/locales/ru.ts +0 -502
  454. package/src/i18n/locales/sk.ts +0 -456
  455. package/src/i18n/locales/uk.ts +0 -482
  456. package/src/i18n/locales/uz.ts +0 -492
  457. package/src/i18n/locales/vi.ts +0 -457
  458. package/src/i18n/locales/zh-tw.ts +0 -499
  459. package/src/i18n/locales/zh.ts +0 -499
  460. package/src/index.ts +0 -66
  461. package/src/locales.ts +0 -1
  462. package/src/pm-nodes/BlockContainer.test.ts +0 -101
  463. package/src/pm-nodes/BlockContainer.ts +0 -200
  464. package/src/pm-nodes/BlockGroup.ts +0 -58
  465. package/src/pm-nodes/Doc.ts +0 -11
  466. package/src/pm-nodes/README.md +0 -143
  467. package/src/pm-nodes/index.ts +0 -3
  468. package/src/pm-nodes/suggestionMarks.ts +0 -43
  469. package/src/schema/README.md +0 -3
  470. package/src/schema/blocks/children.test.ts +0 -288
  471. package/src/schema/blocks/children.ts +0 -136
  472. package/src/schema/blocks/createSpec.browser.test.ts +0 -176
  473. package/src/schema/blocks/createSpec.test.ts +0 -354
  474. package/src/schema/blocks/createSpec.ts +0 -732
  475. package/src/schema/blocks/extendBlockSpec.test.ts +0 -188
  476. package/src/schema/blocks/frame.test.ts +0 -112
  477. package/src/schema/blocks/frame.ts +0 -337
  478. package/src/schema/blocks/internal.test.ts +0 -86
  479. package/src/schema/blocks/internal.ts +0 -288
  480. package/src/schema/blocks/keyboard.ts +0 -154
  481. package/src/schema/blocks/layoutBlockAttributes.ts +0 -29
  482. package/src/schema/blocks/meta.test.ts +0 -53
  483. package/src/schema/blocks/meta.ts +0 -35
  484. package/src/schema/blocks/renderFrame.test.ts +0 -691
  485. package/src/schema/blocks/types.ts +0 -966
  486. package/src/schema/blocks/validateChildren.ts +0 -156
  487. package/src/schema/contentTypePropagation.test.ts +0 -182
  488. package/src/schema/dataAttributes.test.ts +0 -72
  489. package/src/schema/dataAttributes.ts +0 -69
  490. package/src/schema/index.ts +0 -15
  491. package/src/schema/inlineContent/createSpec.test.ts +0 -161
  492. package/src/schema/inlineContent/createSpec.ts +0 -409
  493. package/src/schema/inlineContent/internal.ts +0 -131
  494. package/src/schema/inlineContent/types.ts +0 -204
  495. package/src/schema/markGroups.ts +0 -82
  496. package/src/schema/nodeViewMutations.test.ts +0 -146
  497. package/src/schema/nodeViewMutations.ts +0 -49
  498. package/src/schema/propTypes.ts +0 -61
  499. package/src/schema/schema.test.ts +0 -110
  500. package/src/schema/schema.ts +0 -243
  501. package/src/schema/styles/createSpec.ts +0 -140
  502. package/src/schema/styles/internal.ts +0 -155
  503. package/src/schema/styles/types.ts +0 -57
  504. package/src/style.css +0 -2
  505. package/src/user/UserStore.ts +0 -199
  506. package/src/user/createUserStore.test.ts +0 -126
  507. package/src/user/index.ts +0 -2
  508. package/src/user/userColors.test.ts +0 -108
  509. package/src/user/userColors.ts +0 -101
  510. package/src/util/EventEmitter.ts +0 -59
  511. package/src/util/README.md +0 -3
  512. package/src/util/Store.test.ts +0 -132
  513. package/src/util/Store.ts +0 -135
  514. package/src/util/browser.ts +0 -54
  515. package/src/util/combineByGroup.ts +0 -25
  516. package/src/util/expandToWords.ts +0 -38
  517. package/src/util/string.ts +0 -36
  518. package/src/util/table.ts +0 -110
  519. package/src/util/topo-sort.test.ts +0 -125
  520. package/src/util/topo-sort.ts +0 -206
  521. package/src/util/typescript.ts +0 -17
  522. package/src/vite-env.d.ts +0 -7
  523. package/src/y/README.md +0 -5
  524. package/src/y/comments/RESTYjsThreadStore.ts +0 -138
  525. package/src/y/comments/YjsThreadStore.test.ts +0 -295
  526. package/src/y/comments/YjsThreadStore.ts +0 -358
  527. package/src/y/comments/YjsThreadStoreBase.ts +0 -50
  528. package/src/y/comments/index.ts +0 -3
  529. package/src/y/comments/yjsHelpers.ts +0 -125
  530. package/src/y/extensions/AttributionExtension.test.ts +0 -364
  531. package/src/y/extensions/AttributionExtension.ts +0 -401
  532. package/src/y/extensions/DiffVersioningExtension.test.ts +0 -242
  533. package/src/y/extensions/DiffVersioningExtension.ts +0 -200
  534. package/src/y/extensions/EmptyDocBinding.test.ts +0 -282
  535. package/src/y/extensions/ForkYDoc.node.test.ts +0 -77
  536. package/src/y/extensions/ForkYDoc.test.ts +0 -344
  537. package/src/y/extensions/ForkYDoc.ts +0 -117
  538. package/src/y/extensions/History.test.ts +0 -125
  539. package/src/y/extensions/RelativePositionMapping.test.ts +0 -453
  540. package/src/y/extensions/RelativePositionMapping.ts +0 -45
  541. package/src/y/extensions/Suggestions.ts +0 -174
  542. package/src/y/extensions/Versioning.node.test.ts +0 -126
  543. package/src/y/extensions/Versioning.test.ts +0 -117
  544. package/src/y/extensions/Versioning.ts +0 -74
  545. package/src/y/extensions/YAttributionMarks.ts +0 -422
  546. package/src/y/extensions/YCursorPlugin.ts +0 -192
  547. package/src/y/extensions/YSync.node.test.ts +0 -75
  548. package/src/y/extensions/YSync.ts +0 -197
  549. package/src/y/extensions/YSyncRemount.test.ts +0 -99
  550. package/src/y/extensions/blockMatchNodes.ts +0 -173
  551. package/src/y/extensions/index.ts +0 -140
  552. package/src/y/extensions/legacyYjsDocBinding.test.ts +0 -652
  553. package/src/y/extensions/nestingChanges.test.ts +0 -326
  554. package/src/y/extensions/persistentBlockGroups.test.ts +0 -1709
  555. package/src/y/extensions/persistentBlockGroups.ts +0 -953
  556. package/src/y/extensions/snapshotCodec.test.ts +0 -105
  557. package/src/y/extensions/snapshotCodec.ts +0 -39
  558. package/src/y/extensions/snapshotPreview.test.ts +0 -201
  559. package/src/y/extensions/snapshotPreview.ts +0 -292
  560. package/src/y/extensions/tableReshape.test.ts +0 -121
  561. package/src/y/extensions/v1BindingSnapshotDiff.test.ts +0 -121
  562. package/src/y/extensions/versionDiffAttribution.test.ts +0 -944
  563. package/src/y/extensions/versionDiffPerformance.test.ts +0 -101
  564. package/src/y/index.ts +0 -5
  565. package/src/y/utils.test.ts +0 -1309
  566. package/src/y/utils.ts +0 -366
  567. package/src/y/versioning/__test__/fixtures/activity-all-after.bin +0 -0
  568. package/src/y/versioning/__test__/fixtures/activity-all-after.json +0 -50
  569. package/src/y/versioning/__test__/fixtures/activity-all.bin +0 -0
  570. package/src/y/versioning/__test__/fixtures/activity-all.json +0 -20
  571. package/src/y/versioning/__test__/fixtures/activity-filtered-after.bin +0 -0
  572. package/src/y/versioning/__test__/fixtures/activity-filtered-after.json +0 -32
  573. package/src/y/versioning/__test__/fixtures/activity-filtered-before.json +0 -1
  574. package/src/y/versioning/__test__/fixtures/changeset.bin +0 -0
  575. package/src/y/versioning/__test__/fixtures/patch-response.json +0 -4
  576. package/src/y/versioning/__test__/yhub.test.ts +0 -966
  577. package/src/y/versioning/index.ts +0 -6
  578. package/src/y/versioning/yhub.ts +0 -350
  579. package/src/y/versioning/yhubClient.ts +0 -345
  580. package/src/yjs/README.md +0 -5
  581. package/src/yjs/comments/RESTYjsThreadStore.test.ts +0 -95
  582. package/src/yjs/comments/RESTYjsThreadStore.ts +0 -172
  583. package/src/yjs/comments/YjsThreadStore.test.ts +0 -295
  584. package/src/yjs/comments/YjsThreadStore.ts +0 -345
  585. package/src/yjs/comments/YjsThreadStoreBase.ts +0 -50
  586. package/src/yjs/comments/index.ts +0 -3
  587. package/src/yjs/comments/yjsHelpers.ts +0 -127
  588. package/src/yjs/extensions/FixUpSchema.test.ts +0 -421
  589. package/src/yjs/extensions/FixUpSchema.ts +0 -99
  590. package/src/yjs/extensions/ForkYDoc.browser.test.ts +0 -84
  591. package/src/yjs/extensions/ForkYDoc.node.test.ts +0 -231
  592. package/src/yjs/extensions/ForkYDoc.test.ts +0 -320
  593. package/src/yjs/extensions/ForkYDoc.ts +0 -177
  594. package/src/yjs/extensions/RelativePositionMapping.test.ts +0 -418
  595. package/src/yjs/extensions/RelativePositionMapping.ts +0 -77
  596. package/src/yjs/extensions/Versioning.test.ts +0 -376
  597. package/src/yjs/extensions/Versioning.ts +0 -126
  598. package/src/yjs/extensions/YCursorPlugin.ts +0 -201
  599. package/src/yjs/extensions/YSync.ts +0 -16
  600. package/src/yjs/extensions/YUndo.ts +0 -12
  601. package/src/yjs/extensions/__snapshots__/fork-yjs-snap-editor-forked.json +0 -19
  602. package/src/yjs/extensions/__snapshots__/fork-yjs-snap-editor.json +0 -19
  603. package/src/yjs/extensions/__snapshots__/fork-yjs-snap-forked.html +0 -1
  604. package/src/yjs/extensions/__snapshots__/fork-yjs-snap.html +0 -1
  605. package/src/yjs/extensions/index.ts +0 -89
  606. package/src/yjs/extensions/schemaMigration/SchemaMigration.ts +0 -59
  607. package/src/yjs/extensions/schemaMigration/migrationRules/index.ts +0 -4
  608. package/src/yjs/extensions/schemaMigration/migrationRules/migrationRule.ts +0 -4
  609. package/src/yjs/extensions/schemaMigration/migrationRules/moveColorAttributes.test.ts +0 -130
  610. package/src/yjs/extensions/schemaMigration/migrationRules/moveColorAttributes.ts +0 -91
  611. package/src/yjs/index.ts +0 -7
  612. package/src/yjs/utils.test.ts +0 -1013
  613. package/src/yjs/utils.ts +0 -186
  614. package/types/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.d.ts +0 -1
  615. package/types/src/api/blockManipulation/commands/insertBlocks/insertPlacement.test.d.ts +0 -1
  616. package/types/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.d.ts +0 -1
  617. package/types/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.d.ts +0 -1
  618. package/types/src/api/blockManipulation/commands/nestBlock/nestBlock.test.d.ts +0 -1
  619. package/types/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.d.ts +0 -1
  620. package/types/src/api/blockManipulation/commands/splitBlock/splitBlock.test.d.ts +0 -1
  621. package/types/src/api/blockManipulation/commands/updateBlock/updateBlock.test.d.ts +0 -1
  622. package/types/src/api/blockManipulation/layoutBlocks/layoutBlocks.browser.test.d.ts +0 -1
  623. package/types/src/api/blockManipulation/layoutBlocks/layoutBlocks.test.d.ts +0 -1
  624. package/types/src/api/blockManipulation/layoutBlocks/plainBlocks.test.d.ts +0 -1
  625. package/types/src/api/blockManipulation/layoutBlocks/titledBlocks.test.d.ts +0 -1
  626. package/types/src/api/blockManipulation/tables/tables.test.d.ts +0 -1
  627. package/types/src/api/getBlockInfoFromPos.test.d.ts +0 -1
  628. package/types/src/api/getBlocksChangedByTransaction.test.d.ts +0 -1
  629. package/types/src/api/getChangedRanges.test.d.ts +0 -1
  630. package/types/src/api/nodeConversions/blockToNode.test.d.ts +0 -1
  631. package/types/src/api/parsers/html/util/nestedLists.test.d.ts +0 -1
  632. package/types/src/api/parsers/markdown/detectMarkdown.test.d.ts +0 -1
  633. package/types/src/api/positionMapping.test.d.ts +0 -1
  634. package/types/src/blocks/Code/block.test.d.ts +0 -1
  635. package/types/src/blocks/ListItem/CheckListItem/block.test.d.ts +0 -1
  636. package/types/src/blocks/ListItem/NumberedListItem/IndexingPlugin.test.d.ts +0 -1
  637. package/types/src/blocks/Table/TableExtension.test.d.ts +0 -1
  638. package/types/src/blocks/ToggleWrapper/toggleBlocks.browser.test.d.ts +0 -1
  639. package/types/src/blocks/defaultBlockTypeItems.test.d.ts +0 -1
  640. package/types/src/blocks/defaultBlocks.test.d.ts +0 -1
  641. package/types/src/comments/CommentEditorSubmitExtension.test.d.ts +0 -1
  642. package/types/src/editor/BlockNoteEditor.node.test.d.ts +0 -1
  643. package/types/src/editor/BlockNoteEditor.test.d.ts +0 -1
  644. package/types/src/editor/BlockNoteExtension.test.d.ts +0 -1
  645. package/types/src/editor/blockColors.browser.test.d.ts +0 -1
  646. package/types/src/editor/managers/EventManager.browser.test.d.ts +0 -1
  647. package/types/src/editor/managers/ExtensionManager/ExtensionManager.browser.test.d.ts +0 -1
  648. package/types/src/editor/managers/ExtensionManager/ExtensionManager.node.test.d.ts +0 -1
  649. package/types/src/editor/managers/ExtensionManager/ExtensionManager.test.d.ts +0 -1
  650. package/types/src/editor/managers/StyleManager.browser.test.d.ts +0 -1
  651. package/types/src/editor/managers/StyleManager.test.d.ts +0 -1
  652. package/types/src/editor/performance.test.d.ts +0 -1
  653. package/types/src/editor/transformPasted.test.d.ts +0 -1
  654. package/types/src/exporter/Exporter.test.d.ts +0 -1
  655. package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.test.d.ts +0 -1
  656. package/types/src/extensions/Placeholder/Placeholder.test.d.ts +0 -1
  657. package/types/src/extensions/PreviousBlockType/PreviousBlockType.test.d.ts +0 -1
  658. package/types/src/extensions/ReadOnly/ReadOnly.test.d.ts +0 -1
  659. package/types/src/extensions/SideMenu/blockGeometry.browser.test.d.ts +0 -1
  660. package/types/src/extensions/SideMenu/blockGeometry.test.d.ts +0 -1
  661. package/types/src/extensions/SideMenu/sideMenuHover.test.d.ts +0 -1
  662. package/types/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.d.ts +0 -4
  663. package/types/src/extensions/SuggestionMenu/SuggestionMenu.test.d.ts +0 -1
  664. package/types/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.d.ts +0 -4
  665. package/types/src/extensions/SyntaxHighlighting/SyntaxHighlighting.test.d.ts +0 -1
  666. package/types/src/extensions/SyntaxHighlighting/inlineHighlight.test.d.ts +0 -1
  667. package/types/src/extensions/TableHandles/TableHandles.browser.test.d.ts +0 -1
  668. package/types/src/extensions/Versioning/Versioning.browser.test.d.ts +0 -1
  669. package/types/src/extensions/Versioning/Versioning.node.test.d.ts +0 -1
  670. package/types/src/extensions/Versioning/__test__/result.d.ts +0 -3
  671. package/types/src/extensions/Versioning/comparison.test.d.ts +0 -1
  672. package/types/src/extensions/Versioning/createVersioning.test.d.ts +0 -1
  673. package/types/src/extensions/Versioning/inMemoryVersioning.test.d.ts +0 -1
  674. package/types/src/extensions/Versioning/scrollScheduling.test.d.ts +0 -1
  675. package/types/src/extensions/Versioning/scrollToFirstChange.test.d.ts +0 -1
  676. package/types/src/extensions/blockDOM.browser.test.d.ts +0 -1
  677. package/types/src/extensions/blockDOM.test.d.ts +0 -1
  678. package/types/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.d.ts +0 -4
  679. package/types/src/extensions/tiptap-extensions/KeyboardShortcuts/blockIdentity.browser.test.d.ts +0 -1
  680. package/types/src/extensions/tiptap-extensions/Link/link.test.d.ts +0 -1
  681. package/types/src/extensions/tiptap-extensions/UniqueID/UniqueID.test.d.ts +0 -4
  682. package/types/src/fonts/inter.browser.test.d.ts +0 -2
  683. package/types/src/pm-nodes/BlockContainer.test.d.ts +0 -1
  684. package/types/src/schema/blocks/children.test.d.ts +0 -1
  685. package/types/src/schema/blocks/createSpec.browser.test.d.ts +0 -1
  686. package/types/src/schema/blocks/createSpec.test.d.ts +0 -1
  687. package/types/src/schema/blocks/extendBlockSpec.test.d.ts +0 -1
  688. package/types/src/schema/blocks/frame.test.d.ts +0 -1
  689. package/types/src/schema/blocks/internal.test.d.ts +0 -1
  690. package/types/src/schema/blocks/meta.test.d.ts +0 -1
  691. package/types/src/schema/blocks/renderFrame.test.d.ts +0 -1
  692. package/types/src/schema/contentTypePropagation.test.d.ts +0 -1
  693. package/types/src/schema/dataAttributes.test.d.ts +0 -1
  694. package/types/src/schema/inlineContent/createSpec.test.d.ts +0 -1
  695. package/types/src/schema/nodeViewMutations.test.d.ts +0 -1
  696. package/types/src/schema/schema.test.d.ts +0 -1
  697. package/types/src/user/createUserStore.test.d.ts +0 -1
  698. package/types/src/user/userColors.test.d.ts +0 -1
  699. package/types/src/util/Store.test.d.ts +0 -1
  700. package/types/src/util/topo-sort.test.d.ts +0 -1
  701. package/types/src/y/comments/YjsThreadStore.test.d.ts +0 -1
  702. package/types/src/y/extensions/AttributionExtension.test.d.ts +0 -1
  703. package/types/src/y/extensions/DiffVersioningExtension.test.d.ts +0 -1
  704. package/types/src/y/extensions/EmptyDocBinding.test.d.ts +0 -1
  705. package/types/src/y/extensions/ForkYDoc.node.test.d.ts +0 -1
  706. package/types/src/y/extensions/ForkYDoc.test.d.ts +0 -1
  707. package/types/src/y/extensions/History.test.d.ts +0 -1
  708. package/types/src/y/extensions/RelativePositionMapping.test.d.ts +0 -1
  709. package/types/src/y/extensions/Versioning.node.test.d.ts +0 -1
  710. package/types/src/y/extensions/Versioning.test.d.ts +0 -1
  711. package/types/src/y/extensions/YSync.node.test.d.ts +0 -1
  712. package/types/src/y/extensions/YSyncRemount.test.d.ts +0 -1
  713. package/types/src/y/extensions/legacyYjsDocBinding.test.d.ts +0 -1
  714. package/types/src/y/extensions/nestingChanges.test.d.ts +0 -1
  715. package/types/src/y/extensions/persistentBlockGroups.test.d.ts +0 -1
  716. package/types/src/y/extensions/snapshotCodec.test.d.ts +0 -1
  717. package/types/src/y/extensions/snapshotPreview.test.d.ts +0 -1
  718. package/types/src/y/extensions/tableReshape.test.d.ts +0 -1
  719. package/types/src/y/extensions/v1BindingSnapshotDiff.test.d.ts +0 -1
  720. package/types/src/y/extensions/versionDiffAttribution.test.d.ts +0 -1
  721. package/types/src/y/extensions/versionDiffPerformance.test.d.ts +0 -1
  722. package/types/src/y/utils.test.d.ts +0 -1
  723. package/types/src/y/versioning/__test__/yhub.test.d.ts +0 -1
  724. package/types/src/yjs/comments/RESTYjsThreadStore.test.d.ts +0 -1
  725. package/types/src/yjs/comments/YjsThreadStore.test.d.ts +0 -1
  726. package/types/src/yjs/extensions/FixUpSchema.test.d.ts +0 -1
  727. package/types/src/yjs/extensions/ForkYDoc.browser.test.d.ts +0 -1
  728. package/types/src/yjs/extensions/ForkYDoc.node.test.d.ts +0 -1
  729. package/types/src/yjs/extensions/ForkYDoc.test.d.ts +0 -1
  730. package/types/src/yjs/extensions/RelativePositionMapping.test.d.ts +0 -1
  731. package/types/src/yjs/extensions/Versioning.test.d.ts +0 -1
  732. package/types/src/yjs/extensions/schemaMigration/migrationRules/moveColorAttributes.test.d.ts +0 -1
  733. package/types/src/yjs/utils.test.d.ts +0 -1
@@ -1,2127 +0,0 @@
1
- import { describe, expect, it } from "vite-plus/test";
2
-
3
- import { Block, DefaultBlockSchema } from "../../../blocks/defaultBlocks.js";
4
- import {
5
- getCellsAtColumnHandle,
6
- getCellsAtRowHandle,
7
- getRelativeTableCells,
8
- getAbsoluteTableCells,
9
- moveColumn,
10
- moveRow,
11
- cropEmptyRowsOrColumns,
12
- } from "./tables.js";
13
-
14
- /**
15
- * Simple table
16
- * | 1-1 | 1-2 | 1-3 |
17
- * | 2-1 | 2-2 | 2-3 |
18
- */
19
- const simpleTable = {
20
- type: "table",
21
- id: "table-0",
22
- props: {
23
- textColor: "default",
24
- },
25
- content: {
26
- type: "tableContent",
27
- columnWidths: [100, 100],
28
- rows: [
29
- {
30
- cells: [
31
- {
32
- type: "tableCell",
33
- props: {
34
- backgroundColor: "default",
35
- textColor: "default",
36
- textAlignment: "left",
37
- colspan: 1,
38
- rowspan: 1,
39
- },
40
- content: [{ type: "text", text: "1-1", styles: {} }],
41
- },
42
- {
43
- type: "tableCell",
44
- props: {
45
- backgroundColor: "default",
46
- textColor: "default",
47
- textAlignment: "left",
48
- colspan: 1,
49
- rowspan: 1,
50
- },
51
- content: [{ type: "text", text: "1-2", styles: {} }],
52
- },
53
- ],
54
- },
55
- {
56
- cells: [
57
- {
58
- type: "tableCell",
59
- props: {
60
- backgroundColor: "default",
61
- textColor: "default",
62
- textAlignment: "left",
63
- colspan: 1,
64
- rowspan: 1,
65
- },
66
- content: [{ type: "text", text: "2-1", styles: {} }],
67
- },
68
- {
69
- type: "tableCell",
70
- props: {
71
- backgroundColor: "default",
72
- textColor: "default",
73
- textAlignment: "left",
74
- colspan: 1,
75
- rowspan: 1,
76
- },
77
- content: [{ type: "text", text: "2-2", styles: {} }],
78
- },
79
- ],
80
- },
81
- ],
82
- },
83
- children: [],
84
- } satisfies Block<
85
- {
86
- table: DefaultBlockSchema["table"];
87
- },
88
- any,
89
- any
90
- >;
91
-
92
- /**
93
- * Normal table
94
- * | 1-1 | 1-2 | 1-3 |
95
- * | 2-1 | 2-2 | 2-3 |
96
- *
97
- * Table with colspan
98
- * | 1-1 | 1-1 | 1-2 |
99
- * | 2-1 | 2-2 | 2-3 |
100
- */
101
- const tableWithColspan = {
102
- type: "table",
103
- id: "table-0",
104
- props: {
105
- textColor: "default",
106
- },
107
- content: {
108
- type: "tableContent",
109
- columnWidths: [100, 100],
110
- rows: [
111
- {
112
- cells: [
113
- {
114
- type: "tableCell",
115
- props: {
116
- backgroundColor: "default",
117
- textColor: "default",
118
- textAlignment: "left",
119
- colspan: 2,
120
- rowspan: 1,
121
- },
122
- content: [
123
- { type: "text", text: "1-1", styles: {} },
124
- { type: "text", text: "1-2", styles: {} },
125
- ],
126
- },
127
- {
128
- type: "tableCell",
129
- props: {
130
- backgroundColor: "default",
131
- textColor: "default",
132
- textAlignment: "left",
133
- colspan: 1,
134
- rowspan: 1,
135
- },
136
- content: [{ type: "text", text: "1-3", styles: {} }],
137
- },
138
- ],
139
- },
140
- {
141
- cells: [
142
- {
143
- type: "tableCell",
144
- props: {
145
- backgroundColor: "default",
146
- textColor: "default",
147
- textAlignment: "left",
148
- colspan: 1,
149
- rowspan: 1,
150
- },
151
- content: [{ type: "text", text: "2-1", styles: {} }],
152
- },
153
- {
154
- type: "tableCell",
155
- props: {
156
- backgroundColor: "default",
157
- textColor: "default",
158
- textAlignment: "left",
159
- colspan: 1,
160
- rowspan: 1,
161
- },
162
- content: [{ type: "text", text: "2-2", styles: {} }],
163
- },
164
- {
165
- type: "tableCell",
166
- props: {
167
- backgroundColor: "default",
168
- textColor: "default",
169
- textAlignment: "left",
170
- colspan: 1,
171
- rowspan: 1,
172
- },
173
- content: [{ type: "text", text: "2-3", styles: {} }],
174
- },
175
- ],
176
- },
177
- ],
178
- },
179
- children: [],
180
- } satisfies Block<
181
- {
182
- table: DefaultBlockSchema["table"];
183
- },
184
- any,
185
- any
186
- >;
187
-
188
- /**
189
- * Normal table
190
- * | 1-1 | 1-2 | 1-3 |
191
- * | 2-1 | 2-2 | 2-3 |
192
- * | 3-1 | 3-2 | 3-3 |
193
- *
194
- * Table with rowspan
195
- * | 1-1 | 1-2 | 1-3 |
196
- * | 1-1 | 2-1 | 2-2 |
197
- * | 3-1 | 3-2 | 3-3 |
198
- */
199
- const tableWithRowspan = {
200
- type: "table",
201
- id: "table-0",
202
- props: {
203
- textColor: "default",
204
- },
205
- content: {
206
- type: "tableContent",
207
- columnWidths: [100, 100],
208
- rows: [
209
- {
210
- cells: [
211
- {
212
- type: "tableCell",
213
- props: {
214
- backgroundColor: "default",
215
- textColor: "default",
216
- textAlignment: "left",
217
- colspan: 1,
218
- rowspan: 2,
219
- },
220
- content: [
221
- { type: "text", text: "1-1", styles: {} },
222
- { type: "text", text: "2-1", styles: {} },
223
- ],
224
- },
225
- {
226
- type: "tableCell",
227
- props: {
228
- backgroundColor: "default",
229
- textColor: "default",
230
- textAlignment: "left",
231
- colspan: 1,
232
- rowspan: 1,
233
- },
234
- content: [{ type: "text", text: "1-2", styles: {} }],
235
- },
236
- {
237
- type: "tableCell",
238
- props: {
239
- backgroundColor: "default",
240
- textColor: "default",
241
- textAlignment: "left",
242
- colspan: 1,
243
- rowspan: 1,
244
- },
245
- content: [{ type: "text", text: "1-3", styles: {} }],
246
- },
247
- ],
248
- },
249
- {
250
- cells: [
251
- {
252
- type: "tableCell",
253
- props: {
254
- backgroundColor: "default",
255
- textColor: "default",
256
- textAlignment: "left",
257
- colspan: 1,
258
- rowspan: 1,
259
- },
260
- content: [{ type: "text", text: "2-2", styles: {} }],
261
- },
262
- {
263
- type: "tableCell",
264
- props: {
265
- backgroundColor: "default",
266
- textColor: "default",
267
- textAlignment: "left",
268
- colspan: 1,
269
- rowspan: 1,
270
- },
271
- content: [{ type: "text", text: "2-3", styles: {} }],
272
- },
273
- ],
274
- },
275
- {
276
- cells: [
277
- {
278
- type: "tableCell",
279
- props: {
280
- backgroundColor: "default",
281
- textColor: "default",
282
- textAlignment: "left",
283
- colspan: 1,
284
- rowspan: 1,
285
- },
286
- content: [{ type: "text", text: "3-1", styles: {} }],
287
- },
288
- {
289
- type: "tableCell",
290
- props: {
291
- backgroundColor: "default",
292
- textColor: "default",
293
- textAlignment: "left",
294
- colspan: 1,
295
- rowspan: 1,
296
- },
297
- content: [{ type: "text", text: "3-2", styles: {} }],
298
- },
299
- {
300
- type: "tableCell",
301
- props: {
302
- backgroundColor: "default",
303
- textColor: "default",
304
- textAlignment: "left",
305
- colspan: 1,
306
- rowspan: 1,
307
- },
308
- content: [{ type: "text", text: "3-3", styles: {} }],
309
- },
310
- ],
311
- },
312
- ],
313
- },
314
- children: [],
315
- } satisfies Block<
316
- {
317
- table: DefaultBlockSchema["table"];
318
- },
319
- any,
320
- any
321
- >;
322
-
323
- /**
324
- * Normal table
325
- * | 1-1 | 1-2 | 1-3 |
326
- * | 2-1 | 2-2 | 2-3 |
327
- * | 3-1 | 3-2 | 3-3 |
328
- *
329
- * Table with colspan and rowspan
330
- * | 1-1 | 1-2 | 1-3 |
331
- * | 1-1 | 2-1 | 2-1 |
332
- * | 3-1 | 3-2 | 3-3 |
333
- */
334
- const tableWithColspanAndRowspan = {
335
- type: "table",
336
- id: "table-0",
337
- props: {
338
- textColor: "default",
339
- },
340
- content: {
341
- type: "tableContent",
342
- columnWidths: [100, 100],
343
- rows: [
344
- {
345
- cells: [
346
- {
347
- type: "tableCell",
348
- props: {
349
- backgroundColor: "default",
350
- textColor: "default",
351
- textAlignment: "left",
352
- colspan: 1,
353
- rowspan: 2,
354
- },
355
- content: [
356
- { type: "text", text: "1-1", styles: {} },
357
- { type: "text", text: "2-1", styles: {} },
358
- ],
359
- },
360
- {
361
- type: "tableCell",
362
- props: {
363
- backgroundColor: "default",
364
- textColor: "default",
365
- textAlignment: "left",
366
- colspan: 1,
367
- rowspan: 1,
368
- },
369
- content: [{ type: "text", text: "1-2", styles: {} }],
370
- },
371
- {
372
- type: "tableCell",
373
- props: {
374
- backgroundColor: "default",
375
- textColor: "default",
376
- textAlignment: "left",
377
- colspan: 1,
378
- rowspan: 1,
379
- },
380
- content: [{ type: "text", text: "1-3", styles: {} }],
381
- },
382
- ],
383
- },
384
- {
385
- cells: [
386
- {
387
- type: "tableCell",
388
- props: {
389
- backgroundColor: "default",
390
- textColor: "default",
391
- textAlignment: "left",
392
- colspan: 2,
393
- rowspan: 1,
394
- },
395
- content: [
396
- { type: "text", text: "2-2", styles: {} },
397
- { type: "text", text: "2-3", styles: {} },
398
- ],
399
- },
400
- ],
401
- },
402
- {
403
- cells: [
404
- {
405
- type: "tableCell",
406
- props: {
407
- backgroundColor: "default",
408
- textColor: "default",
409
- textAlignment: "left",
410
- colspan: 1,
411
- rowspan: 1,
412
- },
413
- content: [{ type: "text", text: "3-1", styles: {} }],
414
- },
415
- {
416
- type: "tableCell",
417
- props: {
418
- backgroundColor: "default",
419
- textColor: "default",
420
- textAlignment: "left",
421
- colspan: 1,
422
- rowspan: 1,
423
- },
424
- content: [{ type: "text", text: "3-2", styles: {} }],
425
- },
426
- {
427
- type: "tableCell",
428
- props: {
429
- backgroundColor: "default",
430
- textColor: "default",
431
- textAlignment: "left",
432
- colspan: 1,
433
- rowspan: 1,
434
- },
435
- content: [{ type: "text", text: "3-3", styles: {} }],
436
- },
437
- ],
438
- },
439
- ],
440
- },
441
- children: [],
442
- } satisfies Block<
443
- {
444
- table: DefaultBlockSchema["table"];
445
- },
446
- any,
447
- any
448
- >;
449
-
450
- /**
451
- * Normal table
452
- * | 1-1 | 1-2 | 1-3 |
453
- * | 2-1 | 2-2 | 2-3 |
454
- * | 3-1 | 3-2 | 3-3 |
455
- *
456
- * Table with colspans and rowspans
457
- * | 1-1 | 1-2 | 1-2 |
458
- * | 1-1 | 2-1 | 2-1 |
459
- * | 3-1 | 2-1 | 2-1 |
460
- */
461
- const tableWithColspansAndRowspans = {
462
- type: "table",
463
- id: "table-0",
464
- props: {
465
- textColor: "default",
466
- },
467
- content: {
468
- type: "tableContent",
469
- columnWidths: [100, 100],
470
- rows: [
471
- {
472
- cells: [
473
- {
474
- type: "tableCell",
475
- props: {
476
- backgroundColor: "default",
477
- textColor: "default",
478
- textAlignment: "left",
479
- colspan: 1,
480
- rowspan: 2,
481
- },
482
- content: [
483
- { type: "text", text: "1-1", styles: {} },
484
- { type: "text", text: "2-1", styles: {} },
485
- ],
486
- },
487
- {
488
- type: "tableCell",
489
- props: {
490
- backgroundColor: "default",
491
- textColor: "default",
492
- textAlignment: "left",
493
- colspan: 2,
494
- rowspan: 1,
495
- },
496
- content: [
497
- { type: "text", text: "1-2", styles: {} },
498
- { type: "text", text: "1-3", styles: {} },
499
- ],
500
- },
501
- ],
502
- },
503
- {
504
- cells: [
505
- {
506
- type: "tableCell",
507
- props: {
508
- backgroundColor: "default",
509
- textColor: "default",
510
- textAlignment: "left",
511
- colspan: 2,
512
- rowspan: 2,
513
- },
514
- content: [
515
- { type: "text", text: "2-2", styles: {} },
516
- { type: "text", text: "2-3", styles: {} },
517
- { type: "text", text: "3-2", styles: {} },
518
- { type: "text", text: "3-3", styles: {} },
519
- ],
520
- },
521
- ],
522
- },
523
- {
524
- cells: [
525
- {
526
- type: "tableCell",
527
- props: {
528
- backgroundColor: "default",
529
- textColor: "default",
530
- textAlignment: "left",
531
- colspan: 1,
532
- rowspan: 1,
533
- },
534
- content: [{ type: "text", text: "3-1", styles: {} }],
535
- },
536
- ],
537
- },
538
- ],
539
- },
540
- children: [],
541
- } satisfies Block<
542
- {
543
- table: DefaultBlockSchema["table"];
544
- },
545
- any,
546
- any
547
- >;
548
-
549
- const invalidTableShape = {
550
- type: "table",
551
- id: "table-0",
552
- props: {
553
- textColor: "default",
554
- },
555
- content: {
556
- type: "tableContent",
557
- columnWidths: [100, 100],
558
- rows: [
559
- {
560
- cells: [
561
- {
562
- type: "tableCell",
563
- content: [
564
- {
565
- type: "text",
566
- text: "Table Cell",
567
- styles: {},
568
- props: {
569
- backgroundColor: "default",
570
- textColor: "default",
571
- textAlignment: "left",
572
- },
573
- },
574
- ],
575
- props: {
576
- backgroundColor: "default",
577
- textColor: "default",
578
- textAlignment: "left",
579
- },
580
- },
581
- ],
582
- },
583
- {
584
- cells: [
585
- {
586
- type: "tableCell",
587
- content: [
588
- {
589
- type: "text",
590
- text: "Table Cell",
591
- styles: {},
592
- props: {
593
- backgroundColor: "default",
594
- textColor: "default",
595
- textAlignment: "left",
596
- },
597
- },
598
- ],
599
- props: {
600
- backgroundColor: "default",
601
- textColor: "default",
602
- textAlignment: "left",
603
- },
604
- },
605
- ],
606
- },
607
- {
608
- cells: [
609
- {
610
- type: "tableCell",
611
- content: [
612
- {
613
- type: "text",
614
- text: "Table Cell",
615
- styles: {},
616
- props: {
617
- backgroundColor: "default",
618
- textColor: "default",
619
- textAlignment: "left",
620
- },
621
- },
622
- ],
623
- props: {
624
- backgroundColor: "default",
625
- textColor: "default",
626
- textAlignment: "left",
627
- },
628
- },
629
- {
630
- type: "tableCell",
631
- content: [
632
- {
633
- type: "text",
634
- text: "Table Cell",
635
- styles: {},
636
- props: {
637
- backgroundColor: "default",
638
- textColor: "default",
639
- textAlignment: "left",
640
- },
641
- },
642
- ],
643
- props: {
644
- colspan: 2,
645
- backgroundColor: "default",
646
- textColor: "default",
647
- textAlignment: "left",
648
- },
649
- },
650
- {
651
- type: "tableCell",
652
- content: [
653
- {
654
- type: "text",
655
- text: "Table x",
656
- styles: {},
657
- props: {
658
- backgroundColor: "default",
659
- textColor: "default",
660
- textAlignment: "left",
661
- },
662
- },
663
- ],
664
- props: {
665
- backgroundColor: "default",
666
- textColor: "default",
667
- textAlignment: "left",
668
- },
669
- },
670
- ],
671
- },
672
- ],
673
- },
674
- children: [],
675
- } satisfies Block<
676
- {
677
- table: DefaultBlockSchema["table"];
678
- },
679
- any,
680
- any
681
- >;
682
-
683
- /**
684
- * Normal table
685
- * | 1-1 | 1-2 | 1-3 | 1-4 |
686
- * | 2-1 | 2-2 | 2-3 | 2-4 |
687
- * | 3-1 | 3-2 | 3-3 | 3-4 |
688
- *
689
- * Table with complex rowspans and colspans
690
- * | 1-1 | 1-1 | 1-2 | 1-3 |
691
- * | 1-1 | 1-1 | 2-1 | 2-2 |
692
- * | 3-1 | 3-2 | 2-1 | 3-3 |
693
- */
694
- const tableWithComplexRowspansAndColspans = {
695
- type: "table",
696
- id: "table-0",
697
- props: {
698
- textColor: "default",
699
- },
700
- content: {
701
- type: "tableContent",
702
- columnWidths: [100, 100],
703
- rows: [
704
- {
705
- cells: [
706
- {
707
- type: "tableCell",
708
- props: {
709
- backgroundColor: "default",
710
- textColor: "default",
711
- textAlignment: "left",
712
- colspan: 2,
713
- rowspan: 2,
714
- },
715
- content: [
716
- { type: "text", text: "1-1", styles: {} },
717
- { type: "text", text: "1-2", styles: {} },
718
- { type: "text", text: "2-1", styles: {} },
719
- { type: "text", text: "2-2", styles: {} },
720
- ],
721
- },
722
- {
723
- type: "tableCell",
724
- props: {
725
- backgroundColor: "default",
726
- textColor: "default",
727
- textAlignment: "left",
728
- colspan: 1,
729
- rowspan: 1,
730
- },
731
- content: [{ type: "text", text: "1-3", styles: {} }],
732
- },
733
- {
734
- type: "tableCell",
735
- props: {
736
- backgroundColor: "default",
737
- textColor: "default",
738
- textAlignment: "left",
739
- colspan: 1,
740
- rowspan: 1,
741
- },
742
- content: [{ type: "text", text: "1-4", styles: {} }],
743
- },
744
- ],
745
- },
746
- {
747
- cells: [
748
- {
749
- type: "tableCell",
750
- props: {
751
- backgroundColor: "default",
752
- textColor: "default",
753
- textAlignment: "left",
754
- colspan: 1,
755
- rowspan: 2,
756
- },
757
- content: [
758
- { type: "text", text: "2-3", styles: {} },
759
- { type: "text", text: "3-3", styles: {} },
760
- ],
761
- },
762
- {
763
- type: "tableCell",
764
- props: {
765
- backgroundColor: "default",
766
- textColor: "default",
767
- textAlignment: "left",
768
- colspan: 1,
769
- rowspan: 1,
770
- },
771
- content: [{ type: "text", text: "2-4", styles: {} }],
772
- },
773
- ],
774
- },
775
- {
776
- cells: [
777
- {
778
- type: "tableCell",
779
- props: {
780
- backgroundColor: "default",
781
- textColor: "default",
782
- textAlignment: "left",
783
- colspan: 1,
784
- rowspan: 1,
785
- },
786
- content: [{ type: "text", text: "3-1", styles: {} }],
787
- },
788
- {
789
- type: "tableCell",
790
- props: {
791
- backgroundColor: "default",
792
- textColor: "default",
793
- textAlignment: "left",
794
- colspan: 1,
795
- rowspan: 1,
796
- },
797
- content: [{ type: "text", text: "3-2", styles: {} }],
798
- },
799
- {
800
- type: "tableCell",
801
- props: {
802
- backgroundColor: "default",
803
- textColor: "default",
804
- textAlignment: "left",
805
- colspan: 1,
806
- rowspan: 1,
807
- },
808
- content: [{ type: "text", text: "3-3", styles: {} }],
809
- },
810
- ],
811
- },
812
- ],
813
- },
814
- children: [],
815
- } satisfies Block<
816
- {
817
- table: DefaultBlockSchema["table"];
818
- },
819
- any,
820
- any
821
- >;
822
-
823
- describe("Test getAbsoluteTableCellIndices", () => {
824
- it("should resolve relative table cell indices to absolute table cell indices", () => {
825
- expect(getAbsoluteTableCells({ row: 0, col: 0 }, simpleTable)).toEqual({
826
- row: 0,
827
- col: 0,
828
- cell: simpleTable.content.rows[0].cells[0],
829
- });
830
- expect(getAbsoluteTableCells({ row: 0, col: 1 }, simpleTable)).toEqual({
831
- row: 0,
832
- col: 1,
833
- cell: simpleTable.content.rows[0].cells[1],
834
- });
835
- expect(getAbsoluteTableCells({ row: 1, col: 0 }, simpleTable)).toEqual({
836
- row: 1,
837
- col: 0,
838
- cell: simpleTable.content.rows[1].cells[0],
839
- });
840
- expect(getAbsoluteTableCells({ row: 1, col: 1 }, simpleTable)).toEqual({
841
- row: 1,
842
- col: 1,
843
- cell: simpleTable.content.rows[1].cells[1],
844
- });
845
- });
846
-
847
- it("should resolve relative table cell indices to absolute table cell indices with colspan", () => {
848
- expect(getAbsoluteTableCells({ row: 0, col: 0 }, tableWithColspan)).toEqual(
849
- {
850
- row: 0,
851
- col: 0,
852
- cell: tableWithColspan.content.rows[0].cells[0],
853
- },
854
- );
855
- expect(getAbsoluteTableCells({ row: 0, col: 1 }, tableWithColspan)).toEqual(
856
- {
857
- row: 0,
858
- col: 2,
859
- cell: tableWithColspan.content.rows[0].cells[1],
860
- },
861
- );
862
- expect(getAbsoluteTableCells({ row: 1, col: 0 }, tableWithColspan)).toEqual(
863
- {
864
- row: 1,
865
- col: 0,
866
- cell: tableWithColspan.content.rows[1].cells[0],
867
- },
868
- );
869
- expect(getAbsoluteTableCells({ row: 1, col: 1 }, tableWithColspan)).toEqual(
870
- {
871
- row: 1,
872
- col: 1,
873
- cell: tableWithColspan.content.rows[1].cells[1],
874
- },
875
- );
876
- expect(getAbsoluteTableCells({ row: 1, col: 2 }, tableWithColspan)).toEqual(
877
- {
878
- row: 1,
879
- col: 2,
880
- cell: tableWithColspan.content.rows[1].cells[2],
881
- },
882
- );
883
- });
884
-
885
- it("should resolve relative table cell indices to absolute table cell indices with rowspan", () => {
886
- expect(getAbsoluteTableCells({ row: 0, col: 0 }, tableWithRowspan)).toEqual(
887
- {
888
- row: 0,
889
- col: 0,
890
- cell: tableWithRowspan.content.rows[0].cells[0],
891
- },
892
- );
893
- expect(getAbsoluteTableCells({ row: 0, col: 1 }, tableWithRowspan)).toEqual(
894
- {
895
- row: 0,
896
- col: 1,
897
- cell: tableWithRowspan.content.rows[0].cells[1],
898
- },
899
- );
900
- expect(getAbsoluteTableCells({ row: 0, col: 2 }, tableWithRowspan)).toEqual(
901
- {
902
- row: 0,
903
- col: 2,
904
- cell: tableWithRowspan.content.rows[0].cells[2],
905
- },
906
- );
907
- expect(getAbsoluteTableCells({ row: 1, col: 0 }, tableWithRowspan)).toEqual(
908
- {
909
- row: 1,
910
- col: 1,
911
- cell: tableWithRowspan.content.rows[1].cells[0],
912
- },
913
- );
914
- expect(getAbsoluteTableCells({ row: 1, col: 1 }, tableWithRowspan)).toEqual(
915
- {
916
- row: 1,
917
- col: 2,
918
- cell: tableWithRowspan.content.rows[1].cells[1],
919
- },
920
- );
921
- expect(getAbsoluteTableCells({ row: 2, col: 0 }, tableWithRowspan)).toEqual(
922
- {
923
- row: 2,
924
- col: 0,
925
- cell: tableWithRowspan.content.rows[2].cells[0],
926
- },
927
- );
928
- expect(getAbsoluteTableCells({ row: 2, col: 1 }, tableWithRowspan)).toEqual(
929
- {
930
- row: 2,
931
- col: 1,
932
- cell: tableWithRowspan.content.rows[2].cells[1],
933
- },
934
- );
935
- });
936
-
937
- it("should resolve complex rowspans and colspans", () => {
938
- expect(
939
- getAbsoluteTableCells(
940
- { row: 0, col: 0 },
941
- tableWithComplexRowspansAndColspans,
942
- ),
943
- ).toEqual({
944
- row: 0,
945
- col: 0,
946
- cell: tableWithComplexRowspansAndColspans.content.rows[0].cells[0],
947
- });
948
- expect(
949
- getAbsoluteTableCells(
950
- { row: 0, col: 1 },
951
- tableWithComplexRowspansAndColspans,
952
- ),
953
- ).toEqual({
954
- row: 0,
955
- col: 2,
956
- cell: tableWithComplexRowspansAndColspans.content.rows[0].cells[1],
957
- });
958
- expect(
959
- getAbsoluteTableCells(
960
- { row: 0, col: 2 },
961
- tableWithComplexRowspansAndColspans,
962
- ),
963
- ).toEqual({
964
- row: 0,
965
- col: 3,
966
- cell: tableWithComplexRowspansAndColspans.content.rows[0].cells[2],
967
- });
968
- expect(
969
- getAbsoluteTableCells(
970
- { row: 1, col: 0 },
971
- tableWithComplexRowspansAndColspans,
972
- ),
973
- ).toEqual({
974
- row: 1,
975
- col: 2,
976
- cell: tableWithComplexRowspansAndColspans.content.rows[1].cells[0],
977
- });
978
- expect(
979
- getAbsoluteTableCells(
980
- { row: 1, col: 1 },
981
- tableWithComplexRowspansAndColspans,
982
- ),
983
- ).toEqual({
984
- row: 1,
985
- col: 3,
986
- cell: tableWithComplexRowspansAndColspans.content.rows[1].cells[1],
987
- });
988
- expect(
989
- getAbsoluteTableCells(
990
- { row: 2, col: 0 },
991
- tableWithComplexRowspansAndColspans,
992
- ),
993
- ).toEqual({
994
- row: 2,
995
- col: 0,
996
- cell: tableWithComplexRowspansAndColspans.content.rows[2].cells[0],
997
- });
998
- expect(
999
- getAbsoluteTableCells(
1000
- { row: 2, col: 1 },
1001
- tableWithComplexRowspansAndColspans,
1002
- ),
1003
- ).toEqual({
1004
- row: 2,
1005
- col: 1,
1006
- cell: tableWithComplexRowspansAndColspans.content.rows[2].cells[1],
1007
- });
1008
- expect(
1009
- getAbsoluteTableCells(
1010
- { row: 2, col: 2 },
1011
- tableWithComplexRowspansAndColspans,
1012
- ),
1013
- ).toEqual({
1014
- row: 2,
1015
- col: 3,
1016
- cell: tableWithComplexRowspansAndColspans.content.rows[2].cells[2],
1017
- });
1018
- });
1019
-
1020
- it("should not crash at an invalid table shape", () => {
1021
- expect(() =>
1022
- getAbsoluteTableCells({ row: 2, col: 2 }, invalidTableShape),
1023
- ).not.toThrow();
1024
- });
1025
- });
1026
-
1027
- describe("Test getRelativeTableCellIndices", () => {
1028
- it("should resolve absolute table cell indices to relative table cell indices", () => {
1029
- expect(getRelativeTableCells({ row: 0, col: 0 }, simpleTable)).toEqual({
1030
- row: 0,
1031
- col: 0,
1032
- cell: simpleTable.content.rows[0].cells[0],
1033
- });
1034
- expect(getRelativeTableCells({ row: 0, col: 1 }, simpleTable)).toEqual({
1035
- row: 0,
1036
- col: 1,
1037
- cell: simpleTable.content.rows[0].cells[1],
1038
- });
1039
- expect(getRelativeTableCells({ row: 1, col: 0 }, simpleTable)).toEqual({
1040
- row: 1,
1041
- col: 0,
1042
- cell: simpleTable.content.rows[1].cells[0],
1043
- });
1044
- expect(getRelativeTableCells({ row: 1, col: 1 }, simpleTable)).toEqual({
1045
- row: 1,
1046
- col: 1,
1047
- cell: simpleTable.content.rows[1].cells[1],
1048
- });
1049
- });
1050
-
1051
- it("should resolve absolute table cell indices to relative table cell indices with colspan", () => {
1052
- expect(getRelativeTableCells({ row: 0, col: 0 }, tableWithColspan)).toEqual(
1053
- {
1054
- row: 0,
1055
- col: 0,
1056
- cell: tableWithColspan.content.rows[0].cells[0],
1057
- },
1058
- );
1059
- expect(getRelativeTableCells({ row: 0, col: 1 }, tableWithColspan)).toEqual(
1060
- {
1061
- row: 0,
1062
- col: 0,
1063
- cell: tableWithColspan.content.rows[0].cells[0],
1064
- },
1065
- );
1066
- expect(getRelativeTableCells({ row: 0, col: 2 }, tableWithColspan)).toEqual(
1067
- {
1068
- row: 0,
1069
- col: 1,
1070
- cell: tableWithColspan.content.rows[0].cells[1],
1071
- },
1072
- );
1073
- expect(getRelativeTableCells({ row: 1, col: 0 }, tableWithColspan)).toEqual(
1074
- {
1075
- row: 1,
1076
- col: 0,
1077
- cell: tableWithColspan.content.rows[1].cells[0],
1078
- },
1079
- );
1080
- expect(getRelativeTableCells({ row: 1, col: 1 }, tableWithColspan)).toEqual(
1081
- {
1082
- row: 1,
1083
- col: 1,
1084
- cell: tableWithColspan.content.rows[1].cells[1],
1085
- },
1086
- );
1087
- expect(getRelativeTableCells({ row: 1, col: 2 }, tableWithColspan)).toEqual(
1088
- {
1089
- row: 1,
1090
- col: 2,
1091
- cell: tableWithColspan.content.rows[1].cells[2],
1092
- },
1093
- );
1094
- });
1095
-
1096
- it("should resolve absolute table cell indices to relative table cell indices with rowspan", () => {
1097
- expect(getRelativeTableCells({ row: 0, col: 0 }, tableWithRowspan)).toEqual(
1098
- {
1099
- row: 0,
1100
- col: 0,
1101
- cell: tableWithRowspan.content.rows[0].cells[0],
1102
- },
1103
- );
1104
- expect(getRelativeTableCells({ row: 0, col: 1 }, tableWithRowspan)).toEqual(
1105
- {
1106
- row: 0,
1107
- col: 1,
1108
- cell: tableWithRowspan.content.rows[0].cells[1],
1109
- },
1110
- );
1111
- expect(getRelativeTableCells({ row: 0, col: 2 }, tableWithRowspan)).toEqual(
1112
- {
1113
- row: 0,
1114
- col: 2,
1115
- cell: tableWithRowspan.content.rows[0].cells[2],
1116
- },
1117
- );
1118
- expect(getRelativeTableCells({ row: 1, col: 0 }, tableWithRowspan)).toEqual(
1119
- {
1120
- row: 0,
1121
- col: 0,
1122
- cell: tableWithRowspan.content.rows[0].cells[0],
1123
- },
1124
- );
1125
- expect(getRelativeTableCells({ row: 1, col: 1 }, tableWithRowspan)).toEqual(
1126
- {
1127
- row: 1,
1128
- col: 0,
1129
- cell: tableWithRowspan.content.rows[1].cells[0],
1130
- },
1131
- );
1132
- expect(getRelativeTableCells({ row: 1, col: 2 }, tableWithRowspan)).toEqual(
1133
- {
1134
- row: 1,
1135
- col: 1,
1136
- cell: tableWithRowspan.content.rows[1].cells[1],
1137
- },
1138
- );
1139
- expect(getRelativeTableCells({ row: 2, col: 0 }, tableWithRowspan)).toEqual(
1140
- {
1141
- row: 2,
1142
- col: 0,
1143
- cell: tableWithRowspan.content.rows[2].cells[0],
1144
- },
1145
- );
1146
- expect(getRelativeTableCells({ row: 2, col: 1 }, tableWithRowspan)).toEqual(
1147
- {
1148
- row: 2,
1149
- col: 1,
1150
- cell: tableWithRowspan.content.rows[2].cells[1],
1151
- },
1152
- );
1153
- expect(getRelativeTableCells({ row: 2, col: 2 }, tableWithRowspan)).toEqual(
1154
- {
1155
- row: 2,
1156
- col: 2,
1157
- cell: tableWithRowspan.content.rows[2].cells[2],
1158
- },
1159
- );
1160
- });
1161
-
1162
- it("should resolve absolute table cell indices to relative table cell indices with colspan and rowspan", () => {
1163
- expect(
1164
- getRelativeTableCells({ row: 0, col: 0 }, tableWithColspanAndRowspan),
1165
- ).toEqual({
1166
- row: 0,
1167
- col: 0,
1168
- cell: tableWithColspanAndRowspan.content.rows[0].cells[0],
1169
- });
1170
- expect(
1171
- getRelativeTableCells({ row: 0, col: 1 }, tableWithColspanAndRowspan),
1172
- ).toEqual({
1173
- row: 0,
1174
- col: 1,
1175
- cell: tableWithColspanAndRowspan.content.rows[0].cells[1],
1176
- });
1177
- expect(
1178
- getRelativeTableCells({ row: 0, col: 2 }, tableWithColspanAndRowspan),
1179
- ).toEqual({
1180
- row: 0,
1181
- col: 2,
1182
- cell: tableWithColspanAndRowspan.content.rows[0].cells[2],
1183
- });
1184
- expect(
1185
- getRelativeTableCells({ row: 1, col: 0 }, tableWithColspanAndRowspan),
1186
- ).toEqual({
1187
- row: 0,
1188
- col: 0,
1189
- cell: tableWithColspanAndRowspan.content.rows[0].cells[0],
1190
- });
1191
- expect(
1192
- getRelativeTableCells({ row: 1, col: 1 }, tableWithColspanAndRowspan),
1193
- ).toEqual({
1194
- row: 1,
1195
- col: 0,
1196
- cell: tableWithColspanAndRowspan.content.rows[1].cells[0],
1197
- });
1198
- expect(
1199
- getRelativeTableCells({ row: 1, col: 2 }, tableWithColspanAndRowspan),
1200
- ).toEqual({
1201
- row: 1,
1202
- col: 0,
1203
- cell: tableWithColspanAndRowspan.content.rows[1].cells[0],
1204
- });
1205
- expect(
1206
- getRelativeTableCells({ row: 2, col: 0 }, tableWithColspanAndRowspan),
1207
- ).toEqual({
1208
- row: 2,
1209
- col: 0,
1210
- cell: tableWithColspanAndRowspan.content.rows[2].cells[0],
1211
- });
1212
- expect(
1213
- getRelativeTableCells({ row: 2, col: 1 }, tableWithColspanAndRowspan),
1214
- ).toEqual({
1215
- row: 2,
1216
- col: 1,
1217
- cell: tableWithColspanAndRowspan.content.rows[2].cells[1],
1218
- });
1219
- expect(
1220
- getRelativeTableCells({ row: 2, col: 2 }, tableWithColspanAndRowspan),
1221
- ).toEqual({
1222
- row: 2,
1223
- col: 2,
1224
- cell: tableWithColspanAndRowspan.content.rows[2].cells[2],
1225
- });
1226
- });
1227
-
1228
- it("should resolve absolute table cell indices to relative table cell indices with colspans and rowspans", () => {
1229
- expect(
1230
- getRelativeTableCells({ row: 0, col: 0 }, tableWithColspansAndRowspans),
1231
- ).toEqual({
1232
- row: 0,
1233
- col: 0,
1234
- cell: tableWithColspansAndRowspans.content.rows[0].cells[0],
1235
- });
1236
- expect(
1237
- getRelativeTableCells({ row: 0, col: 1 }, tableWithColspansAndRowspans),
1238
- ).toEqual({
1239
- row: 0,
1240
- col: 1,
1241
- cell: tableWithColspansAndRowspans.content.rows[0].cells[1],
1242
- });
1243
- expect(
1244
- getRelativeTableCells({ row: 0, col: 2 }, tableWithColspansAndRowspans),
1245
- ).toEqual({
1246
- row: 0,
1247
- col: 1,
1248
- cell: tableWithColspansAndRowspans.content.rows[0].cells[1],
1249
- });
1250
- expect(
1251
- getRelativeTableCells({ row: 1, col: 0 }, tableWithColspansAndRowspans),
1252
- ).toEqual({
1253
- row: 0,
1254
- col: 0,
1255
- cell: tableWithColspansAndRowspans.content.rows[0].cells[0],
1256
- });
1257
- expect(
1258
- getRelativeTableCells({ row: 1, col: 1 }, tableWithColspansAndRowspans),
1259
- ).toEqual({
1260
- row: 1,
1261
- col: 0,
1262
- cell: tableWithColspansAndRowspans.content.rows[1].cells[0],
1263
- });
1264
- expect(
1265
- getRelativeTableCells({ row: 1, col: 2 }, tableWithColspansAndRowspans),
1266
- ).toEqual({
1267
- row: 1,
1268
- col: 0,
1269
- cell: tableWithColspansAndRowspans.content.rows[1].cells[0],
1270
- });
1271
- expect(
1272
- getRelativeTableCells({ row: 2, col: 0 }, tableWithColspansAndRowspans),
1273
- ).toEqual({
1274
- row: 2,
1275
- col: 0,
1276
- cell: tableWithColspansAndRowspans.content.rows[2].cells[0],
1277
- });
1278
- expect(
1279
- getRelativeTableCells({ row: 2, col: 1 }, tableWithColspansAndRowspans),
1280
- ).toEqual({
1281
- row: 1,
1282
- col: 0,
1283
- cell: tableWithColspansAndRowspans.content.rows[1].cells[0],
1284
- });
1285
- expect(
1286
- getRelativeTableCells({ row: 2, col: 2 }, tableWithColspansAndRowspans),
1287
- ).toEqual({
1288
- row: 1,
1289
- col: 0,
1290
- cell: tableWithColspansAndRowspans.content.rows[1].cells[0],
1291
- });
1292
- });
1293
- });
1294
-
1295
- describe("resolveAbsoluteTableCellIndices and resolveRelativeTableCellIndices should be inverse functions", () => {
1296
- it("should work for simple tables", () => {
1297
- for (let row = 0; row < simpleTable.content.rows.length; row++) {
1298
- for (
1299
- let col = 0;
1300
- col < simpleTable.content.rows[row].cells.length;
1301
- col++
1302
- ) {
1303
- expect(
1304
- getRelativeTableCells(
1305
- getAbsoluteTableCells({ row, col }, simpleTable),
1306
- simpleTable,
1307
- ),
1308
- ).toEqual({ row, col, cell: simpleTable.content.rows[row].cells[col] });
1309
- }
1310
- }
1311
- });
1312
- it("should work for tables with colspans", () => {
1313
- for (let row = 0; row < tableWithColspan.content.rows.length; row++) {
1314
- for (
1315
- let col = 0;
1316
- col < tableWithColspan.content.rows[row].cells.length;
1317
- col++
1318
- ) {
1319
- expect(
1320
- getRelativeTableCells(
1321
- getAbsoluteTableCells({ row, col }, tableWithColspan),
1322
- tableWithColspan,
1323
- ),
1324
- ).toEqual({
1325
- row,
1326
- col,
1327
- cell: tableWithColspan.content.rows[row].cells[col],
1328
- });
1329
- }
1330
- }
1331
- });
1332
-
1333
- it("should work for tables with rowspans", () => {
1334
- for (let row = 0; row < tableWithRowspan.content.rows.length; row++) {
1335
- for (
1336
- let col = 0;
1337
- col < tableWithRowspan.content.rows[row].cells.length;
1338
- col++
1339
- ) {
1340
- expect(
1341
- getRelativeTableCells(
1342
- getAbsoluteTableCells({ row, col }, tableWithRowspan),
1343
- tableWithRowspan,
1344
- ),
1345
- ).toEqual({
1346
- row,
1347
- col,
1348
- cell: tableWithRowspan.content.rows[row].cells[col],
1349
- });
1350
- }
1351
- }
1352
- });
1353
-
1354
- it("should work for tables with colspans and rowspans", () => {
1355
- for (
1356
- let row = 0;
1357
- row < tableWithColspanAndRowspan.content.rows.length;
1358
- row++
1359
- ) {
1360
- for (
1361
- let col = 0;
1362
- col < tableWithColspanAndRowspan.content.rows[row].cells.length;
1363
- col++
1364
- ) {
1365
- expect(
1366
- getRelativeTableCells(
1367
- getAbsoluteTableCells({ row, col }, tableWithColspanAndRowspan),
1368
- tableWithColspanAndRowspan,
1369
- ),
1370
- ).toEqual({
1371
- row,
1372
- col,
1373
- cell: tableWithColspanAndRowspan.content.rows[row].cells[col],
1374
- });
1375
- }
1376
- }
1377
- });
1378
-
1379
- it("should work for tables with complex rowspans and colspans", () => {
1380
- for (
1381
- let row = 0;
1382
- row < tableWithComplexRowspansAndColspans.content.rows.length;
1383
- row++
1384
- ) {
1385
- for (
1386
- let col = 0;
1387
- col <
1388
- tableWithComplexRowspansAndColspans.content.rows[row].cells.length;
1389
- col++
1390
- ) {
1391
- expect(
1392
- getRelativeTableCells(
1393
- getAbsoluteTableCells(
1394
- { row, col },
1395
- tableWithComplexRowspansAndColspans,
1396
- ),
1397
- tableWithComplexRowspansAndColspans,
1398
- ),
1399
- ).toEqual({
1400
- row,
1401
- col,
1402
- cell: tableWithComplexRowspansAndColspans.content.rows[row].cells[
1403
- col
1404
- ],
1405
- });
1406
- }
1407
- }
1408
- });
1409
- });
1410
-
1411
- describe("Test getRow", () => {
1412
- it("should get the row of the table", () => {
1413
- expect(getCellsAtRowHandle(simpleTable, 0)).toEqual(
1414
- simpleTable.content.rows[0].cells.map((cell, col) => ({
1415
- row: 0,
1416
- col,
1417
- cell,
1418
- })),
1419
- );
1420
- });
1421
-
1422
- it("should get the row of the table with colspan", () => {
1423
- expect(getCellsAtRowHandle(tableWithColspan, 0)).toEqual([
1424
- {
1425
- row: 0,
1426
- col: 0,
1427
- cell: tableWithColspan.content.rows[0].cells[0],
1428
- },
1429
- {
1430
- row: 0,
1431
- col: 1,
1432
- cell: tableWithColspan.content.rows[0].cells[1],
1433
- },
1434
- ]);
1435
-
1436
- expect(getCellsAtRowHandle(tableWithColspan, 1)).toEqual([
1437
- {
1438
- row: 1,
1439
- col: 0,
1440
- cell: tableWithColspan.content.rows[1].cells[0],
1441
- },
1442
- {
1443
- row: 1,
1444
- col: 1,
1445
- cell: tableWithColspan.content.rows[1].cells[1],
1446
- },
1447
- {
1448
- row: 1,
1449
- col: 2,
1450
- cell: tableWithColspan.content.rows[1].cells[2],
1451
- },
1452
- ]);
1453
- });
1454
-
1455
- it("should get the row of the table with rowspan", () => {
1456
- expect(getCellsAtRowHandle(tableWithRowspan, 0)).toEqual([
1457
- {
1458
- row: 0,
1459
- col: 0,
1460
- cell: tableWithRowspan.content.rows[0].cells[0],
1461
- },
1462
- {
1463
- row: 0,
1464
- col: 1,
1465
- cell: tableWithRowspan.content.rows[0].cells[1],
1466
- },
1467
- {
1468
- row: 0,
1469
- col: 2,
1470
- cell: tableWithRowspan.content.rows[0].cells[2],
1471
- },
1472
- ]);
1473
-
1474
- expect(getCellsAtRowHandle(tableWithRowspan, 1)).toEqual([
1475
- {
1476
- row: 2,
1477
- col: 0,
1478
- cell: tableWithRowspan.content.rows[2].cells[0],
1479
- },
1480
- {
1481
- row: 2,
1482
- col: 1,
1483
- cell: tableWithRowspan.content.rows[2].cells[1],
1484
- },
1485
- {
1486
- row: 2,
1487
- col: 2,
1488
- cell: tableWithRowspan.content.rows[2].cells[2],
1489
- },
1490
- ]);
1491
- });
1492
-
1493
- it("should get the row of the table with complex rowspans and colspans", () => {
1494
- expect(getCellsAtRowHandle(tableWithComplexRowspansAndColspans, 0)).toEqual(
1495
- [
1496
- {
1497
- row: 0,
1498
- col: 0,
1499
- cell: tableWithComplexRowspansAndColspans.content.rows[0].cells[0],
1500
- },
1501
- {
1502
- row: 0,
1503
- col: 1,
1504
- cell: tableWithComplexRowspansAndColspans.content.rows[0].cells[1],
1505
- },
1506
- {
1507
- row: 0,
1508
- col: 2,
1509
- cell: tableWithComplexRowspansAndColspans.content.rows[0].cells[2],
1510
- },
1511
- ],
1512
- );
1513
- expect(getCellsAtRowHandle(tableWithComplexRowspansAndColspans, 1)).toEqual(
1514
- [
1515
- {
1516
- row: 2,
1517
- col: 0,
1518
- cell: tableWithComplexRowspansAndColspans.content.rows[2].cells[0],
1519
- },
1520
- {
1521
- row: 2,
1522
- col: 1,
1523
- cell: tableWithComplexRowspansAndColspans.content.rows[2].cells[1],
1524
- },
1525
- {
1526
- row: 1,
1527
- col: 0,
1528
- cell: tableWithComplexRowspansAndColspans.content.rows[1].cells[0],
1529
- },
1530
- {
1531
- row: 2,
1532
- col: 2,
1533
- cell: tableWithComplexRowspansAndColspans.content.rows[2].cells[2],
1534
- },
1535
- ],
1536
- );
1537
- expect(getCellsAtRowHandle(tableWithComplexRowspansAndColspans, 2)).toEqual(
1538
- [],
1539
- );
1540
- });
1541
- });
1542
-
1543
- describe("Test getColumn", () => {
1544
- it("should get the column of the table", () => {
1545
- expect(getCellsAtColumnHandle(simpleTable, 0)).toEqual([
1546
- {
1547
- row: 0,
1548
- col: 0,
1549
- cell: simpleTable.content.rows[0].cells[0],
1550
- },
1551
- {
1552
- row: 1,
1553
- col: 0,
1554
- cell: simpleTable.content.rows[1].cells[0],
1555
- },
1556
- ]);
1557
-
1558
- expect(getCellsAtColumnHandle(simpleTable, 1)).toEqual([
1559
- {
1560
- row: 0,
1561
- col: 1,
1562
- cell: simpleTable.content.rows[0].cells[1],
1563
- },
1564
- {
1565
- row: 1,
1566
- col: 1,
1567
- cell: simpleTable.content.rows[1].cells[1],
1568
- },
1569
- ]);
1570
- expect(getCellsAtColumnHandle(simpleTable, 2)).toEqual([]);
1571
- });
1572
-
1573
- it("should get the column of the table with colspan", () => {
1574
- expect(getCellsAtColumnHandle(tableWithColspan, 0)).toEqual([
1575
- {
1576
- row: 0,
1577
- col: 0,
1578
- cell: tableWithColspan.content.rows[0].cells[0],
1579
- },
1580
- {
1581
- row: 1,
1582
- col: 0,
1583
- cell: tableWithColspan.content.rows[1].cells[0],
1584
- },
1585
- ]);
1586
-
1587
- expect(getCellsAtColumnHandle(tableWithColspan, 1)).toEqual([
1588
- {
1589
- row: 0,
1590
- col: 1,
1591
- cell: tableWithColspan.content.rows[0].cells[1],
1592
- },
1593
- {
1594
- row: 1,
1595
- col: 2,
1596
- cell: tableWithColspan.content.rows[1].cells[2],
1597
- },
1598
- ]);
1599
- expect(getCellsAtColumnHandle(tableWithColspan, 2)).toEqual([]);
1600
- });
1601
-
1602
- it("should get the column of the table with rowspan", () => {
1603
- expect(getCellsAtColumnHandle(tableWithRowspan, 0)).toEqual([
1604
- {
1605
- row: 0,
1606
- col: 0,
1607
- cell: tableWithRowspan.content.rows[0].cells[0],
1608
- },
1609
- {
1610
- row: 2,
1611
- col: 0,
1612
- cell: tableWithRowspan.content.rows[2].cells[0],
1613
- },
1614
- ]);
1615
-
1616
- expect(getCellsAtColumnHandle(tableWithRowspan, 1)).toEqual([
1617
- {
1618
- row: 0,
1619
- col: 1,
1620
- cell: tableWithRowspan.content.rows[0].cells[1],
1621
- },
1622
- {
1623
- row: 1,
1624
- col: 0,
1625
- cell: tableWithRowspan.content.rows[1].cells[0],
1626
- },
1627
- {
1628
- row: 2,
1629
- col: 1,
1630
- cell: tableWithRowspan.content.rows[2].cells[1],
1631
- },
1632
- ]);
1633
-
1634
- expect(getCellsAtColumnHandle(tableWithRowspan, 2)).toEqual([
1635
- {
1636
- row: 0,
1637
- col: 2,
1638
- cell: tableWithRowspan.content.rows[0].cells[2],
1639
- },
1640
- {
1641
- row: 1,
1642
- col: 1,
1643
- cell: tableWithRowspan.content.rows[1].cells[1],
1644
- },
1645
- {
1646
- row: 2,
1647
- col: 2,
1648
- cell: tableWithRowspan.content.rows[2].cells[2],
1649
- },
1650
- ]);
1651
- expect(getCellsAtColumnHandle(tableWithRowspan, 3)).toEqual([]);
1652
- });
1653
-
1654
- it("should get the column of the table with complex rowspans and colspans", () => {
1655
- expect(
1656
- getCellsAtColumnHandle(tableWithComplexRowspansAndColspans, 0),
1657
- ).toEqual([
1658
- {
1659
- row: 0,
1660
- col: 0,
1661
- cell: tableWithComplexRowspansAndColspans.content.rows[0].cells[0],
1662
- },
1663
- {
1664
- row: 2,
1665
- col: 0,
1666
- cell: tableWithComplexRowspansAndColspans.content.rows[2].cells[0],
1667
- },
1668
- ]);
1669
- expect(
1670
- getCellsAtColumnHandle(tableWithComplexRowspansAndColspans, 1),
1671
- ).toEqual([
1672
- {
1673
- row: 0,
1674
- col: 1,
1675
- cell: tableWithComplexRowspansAndColspans.content.rows[0].cells[1],
1676
- },
1677
- {
1678
- row: 1,
1679
- col: 0,
1680
- cell: tableWithComplexRowspansAndColspans.content.rows[1].cells[0],
1681
- },
1682
- ]);
1683
- expect(
1684
- getCellsAtColumnHandle(tableWithComplexRowspansAndColspans, 2),
1685
- ).toEqual([
1686
- {
1687
- row: 0,
1688
- col: 2,
1689
- cell: tableWithComplexRowspansAndColspans.content.rows[0].cells[2],
1690
- },
1691
- {
1692
- row: 1,
1693
- col: 1,
1694
- cell: tableWithComplexRowspansAndColspans.content.rows[1].cells[1],
1695
- },
1696
- {
1697
- row: 2,
1698
- col: 2,
1699
- cell: tableWithComplexRowspansAndColspans.content.rows[2].cells[2],
1700
- },
1701
- ]);
1702
- expect(
1703
- getCellsAtColumnHandle(tableWithComplexRowspansAndColspans, 3),
1704
- ).toEqual([]);
1705
- });
1706
- });
1707
-
1708
- describe("Test moveColumn", () => {
1709
- it("should move the column of the table", () => {
1710
- expect(moveColumn(simpleTable, 0, 1)).toEqual([
1711
- {
1712
- cells: [
1713
- simpleTable.content.rows[0].cells[1],
1714
- simpleTable.content.rows[0].cells[0],
1715
- ],
1716
- },
1717
- {
1718
- cells: [
1719
- simpleTable.content.rows[1].cells[1],
1720
- simpleTable.content.rows[1].cells[0],
1721
- ],
1722
- },
1723
- ]);
1724
- });
1725
- });
1726
-
1727
- describe("Test moveRow", () => {
1728
- it("should move the row of the table", () => {
1729
- expect(moveRow(simpleTable, 0, 1)).toEqual([
1730
- {
1731
- cells: [
1732
- simpleTable.content.rows[1].cells[0],
1733
- simpleTable.content.rows[1].cells[1],
1734
- ],
1735
- },
1736
- {
1737
- cells: [
1738
- simpleTable.content.rows[0].cells[0],
1739
- simpleTable.content.rows[0].cells[1],
1740
- ],
1741
- },
1742
- ]);
1743
- });
1744
- });
1745
-
1746
- describe("Test cropEmptyRowsOrColumns", () => {
1747
- const emptyCell = {
1748
- type: "tableCell" as const,
1749
- props: {
1750
- backgroundColor: "red",
1751
- textColor: "blue",
1752
- textAlignment: "left" as const,
1753
- colspan: 1,
1754
- rowspan: 1,
1755
- },
1756
- content: [{ type: "text" as const, text: "", styles: {} }],
1757
- };
1758
- it("should crop the empty rows of the table", () => {
1759
- expect(
1760
- cropEmptyRowsOrColumns(
1761
- {
1762
- ...simpleTable,
1763
- content: {
1764
- ...simpleTable.content,
1765
- rows: simpleTable.content.rows.concat([
1766
- {
1767
- cells: [emptyCell, emptyCell],
1768
- },
1769
- ]),
1770
- },
1771
- },
1772
- "rows",
1773
- ),
1774
- ).toEqual([
1775
- {
1776
- cells: [
1777
- simpleTable.content.rows[0].cells[0],
1778
- simpleTable.content.rows[0].cells[1],
1779
- ],
1780
- },
1781
- {
1782
- cells: [
1783
- simpleTable.content.rows[1].cells[0],
1784
- simpleTable.content.rows[1].cells[1],
1785
- ],
1786
- },
1787
- ]);
1788
- });
1789
-
1790
- it("should crop the empty rows of a table with colspan", () => {
1791
- expect(
1792
- cropEmptyRowsOrColumns(
1793
- {
1794
- ...tableWithColspan,
1795
- content: {
1796
- ...tableWithColspan.content,
1797
- rows: tableWithColspan.content.rows.concat([
1798
- {
1799
- cells: [emptyCell, emptyCell, emptyCell],
1800
- },
1801
- ]),
1802
- },
1803
- },
1804
- "rows",
1805
- ),
1806
- ).toEqual(tableWithColspan.content.rows);
1807
- });
1808
-
1809
- it("should crop the empty columns of a table with colspan", () => {
1810
- expect(
1811
- cropEmptyRowsOrColumns(
1812
- {
1813
- ...tableWithColspan,
1814
- content: {
1815
- ...tableWithColspan.content,
1816
- rows: [
1817
- {
1818
- cells: [...tableWithColspan.content.rows[0].cells, emptyCell],
1819
- },
1820
- {
1821
- cells: [...tableWithColspan.content.rows[1].cells, emptyCell],
1822
- },
1823
- ],
1824
- },
1825
- },
1826
- "columns",
1827
- ),
1828
- ).toEqual(tableWithColspan.content.rows);
1829
- });
1830
-
1831
- it("should crop the empty rows of a table with rowspan", () => {
1832
- expect(
1833
- cropEmptyRowsOrColumns(
1834
- {
1835
- ...tableWithRowspan,
1836
- content: {
1837
- ...tableWithRowspan.content,
1838
- rows: tableWithRowspan.content.rows.concat([
1839
- {
1840
- cells: [emptyCell, emptyCell, emptyCell],
1841
- },
1842
- ]),
1843
- },
1844
- },
1845
- "rows",
1846
- ),
1847
- ).toEqual(tableWithRowspan.content.rows);
1848
- });
1849
-
1850
- it("should crop the empty columns of a table with rowspan", () => {
1851
- expect(
1852
- cropEmptyRowsOrColumns(
1853
- {
1854
- ...tableWithRowspan,
1855
- content: {
1856
- ...tableWithRowspan.content,
1857
- rows: [
1858
- {
1859
- cells: [...tableWithRowspan.content.rows[0].cells, emptyCell],
1860
- },
1861
- {
1862
- cells: [...tableWithRowspan.content.rows[1].cells, emptyCell],
1863
- },
1864
- {
1865
- cells: [...tableWithRowspan.content.rows[2].cells, emptyCell],
1866
- },
1867
- ],
1868
- },
1869
- },
1870
- "columns",
1871
- ),
1872
- ).toEqual(tableWithRowspan.content.rows);
1873
- });
1874
-
1875
- it("should crop the empty rows of a table with colspan and rowspan", () => {
1876
- expect(
1877
- cropEmptyRowsOrColumns(
1878
- {
1879
- ...tableWithColspanAndRowspan,
1880
- content: {
1881
- ...tableWithColspanAndRowspan.content,
1882
- rows: tableWithColspanAndRowspan.content.rows.concat([
1883
- {
1884
- cells: [emptyCell, emptyCell, emptyCell],
1885
- },
1886
- ]),
1887
- },
1888
- },
1889
- "rows",
1890
- ),
1891
- ).toEqual(tableWithColspanAndRowspan.content.rows);
1892
- });
1893
-
1894
- it("should crop the empty columns of a table with colspan and rowspan", () => {
1895
- expect(
1896
- cropEmptyRowsOrColumns(
1897
- {
1898
- ...tableWithColspanAndRowspan,
1899
- content: {
1900
- ...tableWithColspanAndRowspan.content,
1901
- rows: [
1902
- {
1903
- cells: [
1904
- ...tableWithColspanAndRowspan.content.rows[0].cells,
1905
- emptyCell,
1906
- ],
1907
- },
1908
- {
1909
- cells: [
1910
- ...tableWithColspanAndRowspan.content.rows[1].cells,
1911
- emptyCell,
1912
- ],
1913
- },
1914
- {
1915
- cells: [
1916
- ...tableWithColspanAndRowspan.content.rows[2].cells,
1917
- emptyCell,
1918
- ],
1919
- },
1920
- ],
1921
- },
1922
- },
1923
- "columns",
1924
- ),
1925
- ).toEqual(tableWithColspanAndRowspan.content.rows);
1926
- });
1927
-
1928
- it("should crop the empty rows of a table with complex rowspans and colspans", () => {
1929
- expect(
1930
- cropEmptyRowsOrColumns(
1931
- {
1932
- ...tableWithComplexRowspansAndColspans,
1933
- content: {
1934
- ...tableWithComplexRowspansAndColspans.content,
1935
- rows: tableWithComplexRowspansAndColspans.content.rows.concat([
1936
- {
1937
- cells: [emptyCell, emptyCell, emptyCell, emptyCell],
1938
- },
1939
- ]),
1940
- },
1941
- },
1942
- "rows",
1943
- ),
1944
- ).toEqual(tableWithComplexRowspansAndColspans.content.rows);
1945
- });
1946
-
1947
- it("should crop the empty columns of a table with complex rowspans and colspans", () => {
1948
- expect(
1949
- cropEmptyRowsOrColumns(
1950
- {
1951
- ...tableWithComplexRowspansAndColspans,
1952
- content: {
1953
- ...tableWithComplexRowspansAndColspans.content,
1954
- rows: [
1955
- {
1956
- cells: [
1957
- ...tableWithComplexRowspansAndColspans.content.rows[0].cells,
1958
- emptyCell,
1959
- ],
1960
- },
1961
- {
1962
- cells: [
1963
- ...tableWithComplexRowspansAndColspans.content.rows[1].cells,
1964
- emptyCell,
1965
- ],
1966
- },
1967
- {
1968
- cells: [
1969
- ...tableWithComplexRowspansAndColspans.content.rows[2].cells,
1970
- emptyCell,
1971
- ],
1972
- },
1973
- ],
1974
- },
1975
- },
1976
- "columns",
1977
- ),
1978
- ).toEqual(tableWithComplexRowspansAndColspans.content.rows);
1979
- });
1980
-
1981
- it("should not crop out the last row of a table", () => {
1982
- expect(
1983
- cropEmptyRowsOrColumns(
1984
- {
1985
- ...simpleTable,
1986
- content: {
1987
- ...simpleTable.content,
1988
- rows: [
1989
- {
1990
- cells: [emptyCell, emptyCell],
1991
- },
1992
- {
1993
- cells: [emptyCell, emptyCell],
1994
- },
1995
- ],
1996
- },
1997
- },
1998
- "rows",
1999
- ),
2000
- ).toEqual([
2001
- {
2002
- cells: [emptyCell, emptyCell],
2003
- },
2004
- ]);
2005
- });
2006
-
2007
- it("should not crop out the last column of a table", () => {
2008
- expect(
2009
- cropEmptyRowsOrColumns(
2010
- {
2011
- ...simpleTable,
2012
- content: {
2013
- ...simpleTable.content,
2014
- rows: [
2015
- {
2016
- cells: [emptyCell, emptyCell],
2017
- },
2018
- {
2019
- cells: [emptyCell, emptyCell],
2020
- },
2021
- ],
2022
- },
2023
- },
2024
- "columns",
2025
- ),
2026
- ).toEqual([
2027
- {
2028
- cells: [emptyCell],
2029
- },
2030
- {
2031
- cells: [emptyCell],
2032
- },
2033
- ]);
2034
- });
2035
-
2036
- it("should preserve any colspan or rowspan on that last row", () => {
2037
- expect(
2038
- cropEmptyRowsOrColumns(
2039
- {
2040
- ...simpleTable,
2041
- content: {
2042
- ...simpleTable.content,
2043
- rows: [
2044
- {
2045
- cells: [
2046
- {
2047
- ...emptyCell,
2048
- props: {
2049
- ...emptyCell.props,
2050
- rowspan: 2,
2051
- },
2052
- },
2053
- emptyCell,
2054
- ],
2055
- },
2056
- {
2057
- cells: [emptyCell],
2058
- },
2059
- ],
2060
- },
2061
- },
2062
- "rows",
2063
- ),
2064
- ).toEqual([
2065
- {
2066
- cells: [
2067
- {
2068
- ...emptyCell,
2069
- props: {
2070
- ...emptyCell.props,
2071
- rowspan: 2,
2072
- },
2073
- },
2074
- emptyCell,
2075
- ],
2076
- },
2077
- {
2078
- cells: [emptyCell],
2079
- },
2080
- ]);
2081
- });
2082
-
2083
- it("should preserve any colspan or rowspan on that last column", () => {
2084
- expect(
2085
- cropEmptyRowsOrColumns(
2086
- {
2087
- ...simpleTable,
2088
- content: {
2089
- ...simpleTable.content,
2090
- rows: [
2091
- {
2092
- cells: [
2093
- {
2094
- ...emptyCell,
2095
- props: {
2096
- ...emptyCell.props,
2097
- colspan: 2,
2098
- },
2099
- },
2100
- ],
2101
- },
2102
- {
2103
- cells: [emptyCell, emptyCell],
2104
- },
2105
- ],
2106
- },
2107
- },
2108
- "columns",
2109
- ),
2110
- ).toEqual([
2111
- {
2112
- cells: [
2113
- {
2114
- ...emptyCell,
2115
- props: {
2116
- ...emptyCell.props,
2117
- colspan: 2,
2118
- },
2119
- },
2120
- ],
2121
- },
2122
- {
2123
- cells: [emptyCell, emptyCell],
2124
- },
2125
- ]);
2126
- });
2127
- });