@blocknote/core 0.30.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/dist/blocknote.cjs +9 -9
  2. package/dist/blocknote.cjs.map +1 -1
  3. package/dist/blocknote.js +2771 -2245
  4. package/dist/blocknote.js.map +1 -1
  5. package/dist/comments.cjs.map +1 -1
  6. package/dist/comments.js.map +1 -1
  7. package/dist/{en-D4taoCs4.cjs → en-BXVKCwYt.cjs} +2 -2
  8. package/dist/en-BXVKCwYt.cjs.map +1 -0
  9. package/dist/{en-B7ycW7c8.js → en-qGo6sk9V.js} +2 -3
  10. package/dist/en-qGo6sk9V.js.map +1 -0
  11. package/dist/locales.cjs +1 -1
  12. package/dist/locales.cjs.map +1 -1
  13. package/dist/locales.js +20 -39
  14. package/dist/locales.js.map +1 -1
  15. package/dist/style.css +1 -1
  16. package/dist/webpack-stats.json +1 -1
  17. package/package.json +8 -7
  18. package/src/api/README.md +1 -1
  19. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts +19 -14
  20. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +7 -8
  21. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +3 -3
  22. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +12 -12
  23. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +14 -14
  24. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +16 -16
  25. package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +8 -8
  26. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.ts +12 -12
  27. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +8 -8
  28. package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +10 -10
  29. package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +2 -2
  30. package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +2816 -0
  31. package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +200 -42
  32. package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +104 -34
  33. package/src/api/blockManipulation/getBlock/getBlock.ts +9 -9
  34. package/src/api/blockManipulation/insertContentAt.ts +1 -1
  35. package/src/api/blockManipulation/selections/selection.ts +59 -12
  36. package/src/api/blockManipulation/selections/{textCursorPosition/textCursorPosition.ts → textCursorPosition.ts} +13 -13
  37. package/src/api/blockManipulation/tables/tables.test.ts +106 -106
  38. package/src/api/blockManipulation/tables/tables.ts +35 -35
  39. package/src/api/clipboard/fromClipboard/fileDropExtension.ts +2 -2
  40. package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +9 -9
  41. package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +3 -3
  42. package/src/api/clipboard/fromClipboard/pasteExtension.ts +3 -3
  43. package/src/api/clipboard/toClipboard/copyExtension.ts +22 -22
  44. package/src/api/exporters/html/externalHTMLExporter.ts +6 -6
  45. package/src/api/exporters/html/internalHTMLSerializer.ts +3 -3
  46. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +16 -16
  47. package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +14 -14
  48. package/src/api/exporters/markdown/markdownExporter.ts +3 -3
  49. package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +3 -3
  50. package/src/api/getBlockInfoFromPos.ts +6 -6
  51. package/src/api/nodeConversions/blockToNode.ts +31 -28
  52. package/src/api/nodeConversions/fragmentToBlocks.ts +1 -1
  53. package/src/api/nodeConversions/nodeToBlock.ts +240 -41
  54. package/src/api/nodeUtil.test.ts +16 -16
  55. package/src/api/nodeUtil.ts +10 -10
  56. package/src/api/parsers/html/parseHTML.ts +1 -1
  57. package/src/api/parsers/html/util/nestedLists.ts +2 -2
  58. package/src/api/parsers/markdown/parseMarkdown.ts +1 -1
  59. package/src/api/pmUtil.ts +7 -7
  60. package/src/api/positionMapping.test.ts +3 -3
  61. package/src/api/positionMapping.ts +5 -5
  62. package/src/blocks/AudioBlockContent/AudioBlockContent.ts +4 -4
  63. package/src/blocks/CodeBlockContent/CodeBlockContent.ts +18 -18
  64. package/src/blocks/FileBlockContent/FileBlockContent.ts +2 -2
  65. package/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.ts +2 -2
  66. package/src/blocks/FileBlockContent/helpers/render/createAddFileButton.ts +6 -6
  67. package/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.ts +2 -2
  68. package/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.ts +1 -1
  69. package/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.ts +7 -7
  70. package/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.ts +1 -1
  71. package/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.ts +1 -1
  72. package/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts +2 -2
  73. package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +6 -6
  74. package/src/blocks/ImageBlockContent/ImageBlockContent.ts +4 -4
  75. package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +4 -4
  76. package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +10 -10
  77. package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +1 -1
  78. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +1 -1
  79. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +4 -4
  80. package/src/blocks/ListItemBlockContent/getListItemContent.ts +5 -5
  81. package/src/blocks/PageBreakBlockContent/PageBreakBlockContent.ts +1 -1
  82. package/src/blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.ts +3 -3
  83. package/src/blocks/PageBreakBlockContent/schema.ts +2 -2
  84. package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +3 -3
  85. package/src/blocks/QuoteBlockContent/QuoteBlockContent.ts +4 -4
  86. package/src/blocks/README.md +1 -1
  87. package/src/blocks/TableBlockContent/TableBlockContent.ts +37 -7
  88. package/src/blocks/TableBlockContent/TableExtension.ts +3 -3
  89. package/src/blocks/VideoBlockContent/VideoBlockContent.ts +4 -4
  90. package/src/blocks/defaultBlockHelpers.ts +8 -8
  91. package/src/blocks/defaultBlockTypeGuards.ts +16 -16
  92. package/src/blocks/defaultBlocks.ts +3 -3
  93. package/src/comments/threadstore/DefaultThreadStoreAuth.ts +3 -3
  94. package/src/comments/threadstore/ThreadStore.ts +1 -1
  95. package/src/comments/threadstore/TipTapThreadStore.ts +10 -10
  96. package/src/comments/threadstore/yjs/RESTYjsThreadStore.ts +4 -4
  97. package/src/comments/threadstore/yjs/YjsThreadStore.test.ts +2 -2
  98. package/src/comments/threadstore/yjs/YjsThreadStore.ts +14 -14
  99. package/src/comments/threadstore/yjs/YjsThreadStoreBase.ts +1 -1
  100. package/src/comments/threadstore/yjs/yjsHelpers.ts +6 -6
  101. package/src/editor/Block.css +35 -1
  102. package/src/editor/BlockNoteEditor.test.ts +10 -3
  103. package/src/editor/BlockNoteEditor.ts +95 -38
  104. package/src/editor/BlockNoteExtension.ts +26 -0
  105. package/src/editor/BlockNoteExtensions.ts +38 -22
  106. package/src/editor/BlockNoteSchema.ts +4 -4
  107. package/src/editor/BlockNoteTipTapEditor.ts +33 -12
  108. package/src/editor/README.md +1 -1
  109. package/src/editor/cursorPositionTypes.ts +1 -1
  110. package/src/editor/editor.css +15 -3
  111. package/src/editor/selectionTypes.ts +1 -1
  112. package/src/editor/transformPasted.ts +2 -2
  113. package/src/exporter/Exporter.ts +5 -5
  114. package/src/exporter/mapping.ts +7 -7
  115. package/src/extensions/BackgroundColor/BackgroundColorMark.ts +1 -1
  116. package/src/extensions/Collaboration/CursorPlugin.ts +15 -9
  117. package/src/extensions/Collaboration/ForkYDocPlugin.test.ts +166 -0
  118. package/src/extensions/Collaboration/ForkYDocPlugin.ts +174 -0
  119. package/src/extensions/Collaboration/SyncPlugin.ts +7 -4
  120. package/src/extensions/Collaboration/UndoPlugin.ts +7 -4
  121. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor-forked.json +30 -0
  122. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor.json +30 -0
  123. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-forked.html +1 -0
  124. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap.html +1 -0
  125. package/src/extensions/Comments/CommentsPlugin.ts +80 -75
  126. package/src/extensions/Comments/userstore/UserStore.ts +2 -2
  127. package/src/extensions/FilePanel/FilePanelPlugin.ts +56 -55
  128. package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +60 -30
  129. package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +26 -26
  130. package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +33 -32
  131. package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts +45 -42
  132. package/src/extensions/Placeholder/PlaceholderPlugin.ts +113 -110
  133. package/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts +179 -170
  134. package/src/extensions/README.md +1 -1
  135. package/src/extensions/ShowSelection/ShowSelectionPlugin.ts +22 -19
  136. package/src/extensions/SideMenu/MultipleNodeSelection.ts +1 -1
  137. package/src/extensions/SideMenu/SideMenuPlugin.ts +49 -48
  138. package/src/extensions/SideMenu/dragging.ts +8 -8
  139. package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +176 -176
  140. package/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts +2 -2
  141. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +16 -16
  142. package/src/extensions/Suggestions/SuggestionMarks.ts +175 -0
  143. package/src/extensions/TableHandles/TableHandlesPlugin.ts +199 -195
  144. package/src/extensions/TrailingNode/TrailingNodeExtension.ts +1 -1
  145. package/src/extensions/UniqueID/UniqueID.ts +6 -6
  146. package/src/extensions/getDraggableBlockFromElement.ts +1 -1
  147. package/src/fonts/inter.css +18 -9
  148. package/src/i18n/locales/ar.ts +0 -1
  149. package/src/i18n/locales/de.ts +0 -1
  150. package/src/i18n/locales/en.ts +0 -1
  151. package/src/i18n/locales/es.ts +0 -1
  152. package/src/i18n/locales/fr.ts +0 -1
  153. package/src/i18n/locales/hr.ts +0 -1
  154. package/src/i18n/locales/is.ts +0 -1
  155. package/src/i18n/locales/it.ts +0 -1
  156. package/src/i18n/locales/ja.ts +0 -1
  157. package/src/i18n/locales/ko.ts +0 -1
  158. package/src/i18n/locales/nl.ts +0 -1
  159. package/src/i18n/locales/no.ts +0 -1
  160. package/src/i18n/locales/pl.ts +0 -1
  161. package/src/i18n/locales/pt.ts +0 -1
  162. package/src/i18n/locales/ru.ts +0 -1
  163. package/src/i18n/locales/sk.ts +0 -1
  164. package/src/i18n/locales/uk.ts +0 -1
  165. package/src/i18n/locales/vi.ts +0 -1
  166. package/src/i18n/locales/zh-tw.ts +0 -1
  167. package/src/i18n/locales/zh.ts +0 -1
  168. package/src/index.ts +18 -8
  169. package/src/locales.ts +1 -1
  170. package/src/pm-nodes/BlockContainer.ts +1 -1
  171. package/src/pm-nodes/BlockGroup.ts +2 -2
  172. package/src/pm-nodes/Doc.ts +5 -4
  173. package/src/schema/README.md +1 -1
  174. package/src/schema/blocks/createSpec.ts +14 -14
  175. package/src/schema/blocks/internal.ts +17 -17
  176. package/src/schema/blocks/types.ts +25 -25
  177. package/src/schema/inlineContent/createSpec.ts +16 -20
  178. package/src/schema/inlineContent/internal.ts +9 -9
  179. package/src/schema/inlineContent/types.ts +26 -26
  180. package/src/schema/propTypes.ts +8 -8
  181. package/src/schema/styles/createSpec.ts +2 -2
  182. package/src/schema/styles/internal.ts +7 -7
  183. package/src/schema/styles/types.ts +2 -2
  184. package/src/util/EventEmitter.ts +4 -4
  185. package/src/util/README.md +1 -1
  186. package/src/util/combineByGroup.ts +1 -1
  187. package/src/util/table.ts +33 -30
  188. package/types/src/api/blockManipulation/commands/insertBlocks/insertBlocks.d.ts +1 -1
  189. package/types/src/api/blockManipulation/commands/removeBlocks/removeBlocks.d.ts +4 -0
  190. package/types/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.d.ts +1 -0
  191. package/types/src/api/blockManipulation/commands/updateBlock/updateBlock.d.ts +3 -1
  192. package/types/src/api/blockManipulation/selections/selection.d.ts +10 -0
  193. package/types/src/api/blockManipulation/selections/textCursorPosition.d.ts +5 -0
  194. package/types/src/api/blockManipulation/transactions.test.d.ts +0 -0
  195. package/types/src/api/clipboard/clipboardExternal.test.d.ts +1 -0
  196. package/types/src/api/clipboard/clipboardInternal.test.d.ts +1 -0
  197. package/types/src/api/clipboard/testUtil.d.ts +541 -0
  198. package/types/src/api/exporters/html/htmlConversion.test.d.ts +1 -0
  199. package/types/src/api/exporters/markdown/markdownExporter.test.d.ts +1 -0
  200. package/types/src/api/nodeConversions/nodeConversions.test.d.ts +1 -0
  201. package/types/src/api/nodeConversions/nodeToBlock.d.ts +39 -2
  202. package/types/src/api/parsers/html/parseHTML.test.d.ts +1 -0
  203. package/types/src/api/parsers/markdown/parseMarkdown.test.d.ts +1 -0
  204. package/types/src/api/pmUtil.d.ts +3 -3
  205. package/types/src/api/testUtil/cases/customBlocks.d.ts +670 -0
  206. package/types/src/api/testUtil/cases/customInlineContent.d.ts +558 -0
  207. package/types/src/api/testUtil/cases/customStyles.d.ts +552 -0
  208. package/types/src/api/testUtil/cases/defaultSchema.d.ts +4 -0
  209. package/types/src/api/testUtil/index.d.ts +14 -0
  210. package/types/src/api/testUtil/partialBlockTestUtil.d.ts +9 -0
  211. package/types/src/api/testUtil/paste.d.ts +2 -0
  212. package/types/src/blocks/CodeBlockContent/defaultSupportedLanguages.d.ts +6 -0
  213. package/types/src/blocks/TableBlockContent/TableBlockContent.d.ts +9 -1
  214. package/types/src/editor/BlockNoteEditor.d.ts +58 -10
  215. package/types/src/editor/BlockNoteExtension.d.ts +9 -0
  216. package/types/src/editor/BlockNoteExtensions.d.ts +2 -2
  217. package/types/src/editor/BlockNoteTipTapEditor.d.ts +2 -2
  218. package/types/src/extensions/Collaboration/CursorPlugin.d.ts +3 -3
  219. package/types/src/extensions/Collaboration/ForkYDocPlugin.d.ts +41 -0
  220. package/types/src/extensions/Collaboration/ForkYDocPlugin.test.d.ts +1 -0
  221. package/types/src/extensions/Collaboration/SyncPlugin.d.ts +3 -3
  222. package/types/src/extensions/Collaboration/UndoPlugin.d.ts +3 -3
  223. package/types/src/extensions/Collaboration/createCollaborationExtensions.d.ts +17 -0
  224. package/types/src/extensions/Comments/CommentsPlugin.d.ts +2 -4
  225. package/types/src/extensions/FilePanel/FilePanelPlugin.d.ts +3 -4
  226. package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +5 -5
  227. package/types/src/extensions/LinkToolbar/LinkToolbarPlugin.d.ts +3 -4
  228. package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.d.ts +2 -3
  229. package/types/src/extensions/Placeholder/PlaceholderPlugin.d.ts +2 -3
  230. package/types/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.d.ts +2 -3
  231. package/types/src/extensions/ShowSelection/ShowSelectionPlugin.d.ts +2 -3
  232. package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +3 -4
  233. package/types/src/extensions/SuggestionMenu/SuggestionPlugin.d.ts +2 -4
  234. package/types/src/extensions/Suggestions/SuggestionMarks.d.ts +4 -0
  235. package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +5 -6
  236. package/types/src/i18n/locales/en.d.ts +0 -1
  237. package/types/src/i18n/locales/sk.d.ts +0 -1
  238. package/types/src/index.d.ts +15 -8
  239. package/dist/en-B7ycW7c8.js.map +0 -1
  240. package/dist/en-D4taoCs4.cjs.map +0 -1
  241. package/dist/tsconfig.tsbuildinfo +0 -1
  242. package/src/api/blockManipulation/selections/__snapshots__/selection.test.ts.snap +0 -844
  243. package/src/api/blockManipulation/selections/selection.test.ts +0 -72
  244. package/src/api/blockManipulation/selections/textCursorPosition/__snapshots__/textCursorPosition.test.ts.snap +0 -316
  245. package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.ts +0 -74
@@ -1,844 +0,0 @@
1
- // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
-
3
- exports[`Test getSelection & setSelection > Basic 1`] = `
4
- {
5
- "blocks": [
6
- {
7
- "children": [],
8
- "content": [
9
- {
10
- "styles": {},
11
- "text": "Paragraph 0",
12
- "type": "text",
13
- },
14
- ],
15
- "id": "paragraph-0",
16
- "props": {
17
- "backgroundColor": "default",
18
- "textAlignment": "left",
19
- "textColor": "default",
20
- },
21
- "type": "paragraph",
22
- },
23
- {
24
- "children": [],
25
- "content": [
26
- {
27
- "styles": {},
28
- "text": "Paragraph 1",
29
- "type": "text",
30
- },
31
- ],
32
- "id": "paragraph-1",
33
- "props": {
34
- "backgroundColor": "default",
35
- "textAlignment": "left",
36
- "textColor": "default",
37
- },
38
- "type": "paragraph",
39
- },
40
- ],
41
- }
42
- `;
43
-
44
- exports[`Test getSelection & setSelection > Contains block with children 1`] = `
45
- {
46
- "blocks": [
47
- {
48
- "children": [],
49
- "content": [
50
- {
51
- "styles": {},
52
- "text": "Paragraph 1",
53
- "type": "text",
54
- },
55
- ],
56
- "id": "paragraph-1",
57
- "props": {
58
- "backgroundColor": "default",
59
- "textAlignment": "left",
60
- "textColor": "default",
61
- },
62
- "type": "paragraph",
63
- },
64
- {
65
- "children": [
66
- {
67
- "children": [
68
- {
69
- "children": [],
70
- "content": [
71
- {
72
- "styles": {},
73
- "text": "Double Nested Paragraph 0",
74
- "type": "text",
75
- },
76
- ],
77
- "id": "double-nested-paragraph-0",
78
- "props": {
79
- "backgroundColor": "default",
80
- "textAlignment": "left",
81
- "textColor": "default",
82
- },
83
- "type": "paragraph",
84
- },
85
- ],
86
- "content": [
87
- {
88
- "styles": {},
89
- "text": "Nested Paragraph 0",
90
- "type": "text",
91
- },
92
- ],
93
- "id": "nested-paragraph-0",
94
- "props": {
95
- "backgroundColor": "default",
96
- "textAlignment": "left",
97
- "textColor": "default",
98
- },
99
- "type": "paragraph",
100
- },
101
- ],
102
- "content": [
103
- {
104
- "styles": {},
105
- "text": "Paragraph with children",
106
- "type": "text",
107
- },
108
- ],
109
- "id": "paragraph-with-children",
110
- "props": {
111
- "backgroundColor": "default",
112
- "textAlignment": "left",
113
- "textColor": "default",
114
- },
115
- "type": "paragraph",
116
- },
117
- {
118
- "children": [],
119
- "content": [
120
- {
121
- "styles": {},
122
- "text": "Paragraph 2",
123
- "type": "text",
124
- },
125
- ],
126
- "id": "paragraph-2",
127
- "props": {
128
- "backgroundColor": "default",
129
- "textAlignment": "left",
130
- "textColor": "default",
131
- },
132
- "type": "paragraph",
133
- },
134
- ],
135
- }
136
- `;
137
-
138
- exports[`Test getSelection & setSelection > Ends in block with children 1`] = `
139
- {
140
- "blocks": [
141
- {
142
- "children": [],
143
- "content": [
144
- {
145
- "styles": {},
146
- "text": "Paragraph 1",
147
- "type": "text",
148
- },
149
- ],
150
- "id": "paragraph-1",
151
- "props": {
152
- "backgroundColor": "default",
153
- "textAlignment": "left",
154
- "textColor": "default",
155
- },
156
- "type": "paragraph",
157
- },
158
- {
159
- "children": [
160
- {
161
- "children": [
162
- {
163
- "children": [],
164
- "content": [
165
- {
166
- "styles": {},
167
- "text": "Double Nested Paragraph 0",
168
- "type": "text",
169
- },
170
- ],
171
- "id": "double-nested-paragraph-0",
172
- "props": {
173
- "backgroundColor": "default",
174
- "textAlignment": "left",
175
- "textColor": "default",
176
- },
177
- "type": "paragraph",
178
- },
179
- ],
180
- "content": [
181
- {
182
- "styles": {},
183
- "text": "Nested Paragraph 0",
184
- "type": "text",
185
- },
186
- ],
187
- "id": "nested-paragraph-0",
188
- "props": {
189
- "backgroundColor": "default",
190
- "textAlignment": "left",
191
- "textColor": "default",
192
- },
193
- "type": "paragraph",
194
- },
195
- ],
196
- "content": [
197
- {
198
- "styles": {},
199
- "text": "Paragraph with children",
200
- "type": "text",
201
- },
202
- ],
203
- "id": "paragraph-with-children",
204
- "props": {
205
- "backgroundColor": "default",
206
- "textAlignment": "left",
207
- "textColor": "default",
208
- },
209
- "type": "paragraph",
210
- },
211
- ],
212
- }
213
- `;
214
-
215
- exports[`Test getSelection & setSelection > Ends in nested block 1`] = `
216
- {
217
- "blocks": [
218
- {
219
- "children": [],
220
- "content": [
221
- {
222
- "styles": {},
223
- "text": "Paragraph 1",
224
- "type": "text",
225
- },
226
- ],
227
- "id": "paragraph-1",
228
- "props": {
229
- "backgroundColor": "default",
230
- "textAlignment": "left",
231
- "textColor": "default",
232
- },
233
- "type": "paragraph",
234
- },
235
- {
236
- "children": [
237
- {
238
- "children": [
239
- {
240
- "children": [],
241
- "content": [
242
- {
243
- "styles": {},
244
- "text": "Double Nested Paragraph 0",
245
- "type": "text",
246
- },
247
- ],
248
- "id": "double-nested-paragraph-0",
249
- "props": {
250
- "backgroundColor": "default",
251
- "textAlignment": "left",
252
- "textColor": "default",
253
- },
254
- "type": "paragraph",
255
- },
256
- ],
257
- "content": [
258
- {
259
- "styles": {},
260
- "text": "Nested Paragraph 0",
261
- "type": "text",
262
- },
263
- ],
264
- "id": "nested-paragraph-0",
265
- "props": {
266
- "backgroundColor": "default",
267
- "textAlignment": "left",
268
- "textColor": "default",
269
- },
270
- "type": "paragraph",
271
- },
272
- ],
273
- "content": [
274
- {
275
- "styles": {},
276
- "text": "Paragraph with children",
277
- "type": "text",
278
- },
279
- ],
280
- "id": "paragraph-with-children",
281
- "props": {
282
- "backgroundColor": "default",
283
- "textAlignment": "left",
284
- "textColor": "default",
285
- },
286
- "type": "paragraph",
287
- },
288
- ],
289
- }
290
- `;
291
-
292
- exports[`Test getSelection & setSelection > Ends in table 1`] = `
293
- {
294
- "blocks": [
295
- {
296
- "children": [],
297
- "content": [
298
- {
299
- "styles": {},
300
- "text": "Paragraph 6",
301
- "type": "text",
302
- },
303
- ],
304
- "id": "paragraph-6",
305
- "props": {
306
- "backgroundColor": "default",
307
- "textAlignment": "left",
308
- "textColor": "default",
309
- },
310
- "type": "paragraph",
311
- },
312
- {
313
- "children": [],
314
- "content": {
315
- "columnWidths": [
316
- undefined,
317
- undefined,
318
- undefined,
319
- ],
320
- "headerCols": undefined,
321
- "headerRows": undefined,
322
- "rows": [
323
- {
324
- "cells": [
325
- {
326
- "content": [
327
- {
328
- "styles": {},
329
- "text": "Cell 1",
330
- "type": "text",
331
- },
332
- ],
333
- "props": {
334
- "backgroundColor": "default",
335
- "colspan": 1,
336
- "rowspan": 1,
337
- "textAlignment": "left",
338
- "textColor": "default",
339
- },
340
- "type": "tableCell",
341
- },
342
- {
343
- "content": [
344
- {
345
- "styles": {},
346
- "text": "Cell 2",
347
- "type": "text",
348
- },
349
- ],
350
- "props": {
351
- "backgroundColor": "default",
352
- "colspan": 1,
353
- "rowspan": 1,
354
- "textAlignment": "left",
355
- "textColor": "default",
356
- },
357
- "type": "tableCell",
358
- },
359
- {
360
- "content": [
361
- {
362
- "styles": {},
363
- "text": "Cell 3",
364
- "type": "text",
365
- },
366
- ],
367
- "props": {
368
- "backgroundColor": "default",
369
- "colspan": 1,
370
- "rowspan": 1,
371
- "textAlignment": "left",
372
- "textColor": "default",
373
- },
374
- "type": "tableCell",
375
- },
376
- ],
377
- },
378
- {
379
- "cells": [
380
- {
381
- "content": [
382
- {
383
- "styles": {},
384
- "text": "Cell 4",
385
- "type": "text",
386
- },
387
- ],
388
- "props": {
389
- "backgroundColor": "default",
390
- "colspan": 1,
391
- "rowspan": 1,
392
- "textAlignment": "left",
393
- "textColor": "default",
394
- },
395
- "type": "tableCell",
396
- },
397
- {
398
- "content": [
399
- {
400
- "styles": {},
401
- "text": "Cell 5",
402
- "type": "text",
403
- },
404
- ],
405
- "props": {
406
- "backgroundColor": "default",
407
- "colspan": 1,
408
- "rowspan": 1,
409
- "textAlignment": "left",
410
- "textColor": "default",
411
- },
412
- "type": "tableCell",
413
- },
414
- {
415
- "content": [
416
- {
417
- "styles": {},
418
- "text": "Cell 6",
419
- "type": "text",
420
- },
421
- ],
422
- "props": {
423
- "backgroundColor": "default",
424
- "colspan": 1,
425
- "rowspan": 1,
426
- "textAlignment": "left",
427
- "textColor": "default",
428
- },
429
- "type": "tableCell",
430
- },
431
- ],
432
- },
433
- {
434
- "cells": [
435
- {
436
- "content": [
437
- {
438
- "styles": {},
439
- "text": "Cell 7",
440
- "type": "text",
441
- },
442
- ],
443
- "props": {
444
- "backgroundColor": "default",
445
- "colspan": 1,
446
- "rowspan": 1,
447
- "textAlignment": "left",
448
- "textColor": "default",
449
- },
450
- "type": "tableCell",
451
- },
452
- {
453
- "content": [
454
- {
455
- "styles": {},
456
- "text": "Cell 8",
457
- "type": "text",
458
- },
459
- ],
460
- "props": {
461
- "backgroundColor": "default",
462
- "colspan": 1,
463
- "rowspan": 1,
464
- "textAlignment": "left",
465
- "textColor": "default",
466
- },
467
- "type": "tableCell",
468
- },
469
- {
470
- "content": [
471
- {
472
- "styles": {},
473
- "text": "Cell 9",
474
- "type": "text",
475
- },
476
- ],
477
- "props": {
478
- "backgroundColor": "default",
479
- "colspan": 1,
480
- "rowspan": 1,
481
- "textAlignment": "left",
482
- "textColor": "default",
483
- },
484
- "type": "tableCell",
485
- },
486
- ],
487
- },
488
- ],
489
- "type": "tableContent",
490
- },
491
- "id": "table-0",
492
- "props": {
493
- "textColor": "default",
494
- },
495
- "type": "table",
496
- },
497
- ],
498
- }
499
- `;
500
-
501
- exports[`Test getSelection & setSelection > Starts in block with children 1`] = `
502
- {
503
- "blocks": [
504
- {
505
- "children": [
506
- {
507
- "children": [
508
- {
509
- "children": [],
510
- "content": [
511
- {
512
- "styles": {},
513
- "text": "Double Nested Paragraph 0",
514
- "type": "text",
515
- },
516
- ],
517
- "id": "double-nested-paragraph-0",
518
- "props": {
519
- "backgroundColor": "default",
520
- "textAlignment": "left",
521
- "textColor": "default",
522
- },
523
- "type": "paragraph",
524
- },
525
- ],
526
- "content": [
527
- {
528
- "styles": {},
529
- "text": "Nested Paragraph 0",
530
- "type": "text",
531
- },
532
- ],
533
- "id": "nested-paragraph-0",
534
- "props": {
535
- "backgroundColor": "default",
536
- "textAlignment": "left",
537
- "textColor": "default",
538
- },
539
- "type": "paragraph",
540
- },
541
- ],
542
- "content": [
543
- {
544
- "styles": {},
545
- "text": "Paragraph with children",
546
- "type": "text",
547
- },
548
- ],
549
- "id": "paragraph-with-children",
550
- "props": {
551
- "backgroundColor": "default",
552
- "textAlignment": "left",
553
- "textColor": "default",
554
- },
555
- "type": "paragraph",
556
- },
557
- {
558
- "children": [],
559
- "content": [
560
- {
561
- "styles": {},
562
- "text": "Paragraph 2",
563
- "type": "text",
564
- },
565
- ],
566
- "id": "paragraph-2",
567
- "props": {
568
- "backgroundColor": "default",
569
- "textAlignment": "left",
570
- "textColor": "default",
571
- },
572
- "type": "paragraph",
573
- },
574
- ],
575
- }
576
- `;
577
-
578
- exports[`Test getSelection & setSelection > Starts in nested block 1`] = `
579
- {
580
- "blocks": [
581
- {
582
- "children": [
583
- {
584
- "children": [],
585
- "content": [
586
- {
587
- "styles": {},
588
- "text": "Double Nested Paragraph 0",
589
- "type": "text",
590
- },
591
- ],
592
- "id": "double-nested-paragraph-0",
593
- "props": {
594
- "backgroundColor": "default",
595
- "textAlignment": "left",
596
- "textColor": "default",
597
- },
598
- "type": "paragraph",
599
- },
600
- ],
601
- "content": [
602
- {
603
- "styles": {},
604
- "text": "Nested Paragraph 0",
605
- "type": "text",
606
- },
607
- ],
608
- "id": "nested-paragraph-0",
609
- "props": {
610
- "backgroundColor": "default",
611
- "textAlignment": "left",
612
- "textColor": "default",
613
- },
614
- "type": "paragraph",
615
- },
616
- {
617
- "children": [],
618
- "content": [
619
- {
620
- "styles": {},
621
- "text": "Paragraph 2",
622
- "type": "text",
623
- },
624
- ],
625
- "id": "paragraph-2",
626
- "props": {
627
- "backgroundColor": "default",
628
- "textAlignment": "left",
629
- "textColor": "default",
630
- },
631
- "type": "paragraph",
632
- },
633
- ],
634
- }
635
- `;
636
-
637
- exports[`Test getSelection & setSelection > Starts in table 1`] = `
638
- {
639
- "blocks": [
640
- {
641
- "children": [],
642
- "content": {
643
- "columnWidths": [
644
- undefined,
645
- undefined,
646
- undefined,
647
- ],
648
- "headerCols": undefined,
649
- "headerRows": undefined,
650
- "rows": [
651
- {
652
- "cells": [
653
- {
654
- "content": [
655
- {
656
- "styles": {},
657
- "text": "Cell 1",
658
- "type": "text",
659
- },
660
- ],
661
- "props": {
662
- "backgroundColor": "default",
663
- "colspan": 1,
664
- "rowspan": 1,
665
- "textAlignment": "left",
666
- "textColor": "default",
667
- },
668
- "type": "tableCell",
669
- },
670
- {
671
- "content": [
672
- {
673
- "styles": {},
674
- "text": "Cell 2",
675
- "type": "text",
676
- },
677
- ],
678
- "props": {
679
- "backgroundColor": "default",
680
- "colspan": 1,
681
- "rowspan": 1,
682
- "textAlignment": "left",
683
- "textColor": "default",
684
- },
685
- "type": "tableCell",
686
- },
687
- {
688
- "content": [
689
- {
690
- "styles": {},
691
- "text": "Cell 3",
692
- "type": "text",
693
- },
694
- ],
695
- "props": {
696
- "backgroundColor": "default",
697
- "colspan": 1,
698
- "rowspan": 1,
699
- "textAlignment": "left",
700
- "textColor": "default",
701
- },
702
- "type": "tableCell",
703
- },
704
- ],
705
- },
706
- {
707
- "cells": [
708
- {
709
- "content": [
710
- {
711
- "styles": {},
712
- "text": "Cell 4",
713
- "type": "text",
714
- },
715
- ],
716
- "props": {
717
- "backgroundColor": "default",
718
- "colspan": 1,
719
- "rowspan": 1,
720
- "textAlignment": "left",
721
- "textColor": "default",
722
- },
723
- "type": "tableCell",
724
- },
725
- {
726
- "content": [
727
- {
728
- "styles": {},
729
- "text": "Cell 5",
730
- "type": "text",
731
- },
732
- ],
733
- "props": {
734
- "backgroundColor": "default",
735
- "colspan": 1,
736
- "rowspan": 1,
737
- "textAlignment": "left",
738
- "textColor": "default",
739
- },
740
- "type": "tableCell",
741
- },
742
- {
743
- "content": [
744
- {
745
- "styles": {},
746
- "text": "Cell 6",
747
- "type": "text",
748
- },
749
- ],
750
- "props": {
751
- "backgroundColor": "default",
752
- "colspan": 1,
753
- "rowspan": 1,
754
- "textAlignment": "left",
755
- "textColor": "default",
756
- },
757
- "type": "tableCell",
758
- },
759
- ],
760
- },
761
- {
762
- "cells": [
763
- {
764
- "content": [
765
- {
766
- "styles": {},
767
- "text": "Cell 7",
768
- "type": "text",
769
- },
770
- ],
771
- "props": {
772
- "backgroundColor": "default",
773
- "colspan": 1,
774
- "rowspan": 1,
775
- "textAlignment": "left",
776
- "textColor": "default",
777
- },
778
- "type": "tableCell",
779
- },
780
- {
781
- "content": [
782
- {
783
- "styles": {},
784
- "text": "Cell 8",
785
- "type": "text",
786
- },
787
- ],
788
- "props": {
789
- "backgroundColor": "default",
790
- "colspan": 1,
791
- "rowspan": 1,
792
- "textAlignment": "left",
793
- "textColor": "default",
794
- },
795
- "type": "tableCell",
796
- },
797
- {
798
- "content": [
799
- {
800
- "styles": {},
801
- "text": "Cell 9",
802
- "type": "text",
803
- },
804
- ],
805
- "props": {
806
- "backgroundColor": "default",
807
- "colspan": 1,
808
- "rowspan": 1,
809
- "textAlignment": "left",
810
- "textColor": "default",
811
- },
812
- "type": "tableCell",
813
- },
814
- ],
815
- },
816
- ],
817
- "type": "tableContent",
818
- },
819
- "id": "table-0",
820
- "props": {
821
- "textColor": "default",
822
- },
823
- "type": "table",
824
- },
825
- {
826
- "children": [],
827
- "content": [
828
- {
829
- "styles": {},
830
- "text": "Paragraph 7",
831
- "type": "text",
832
- },
833
- ],
834
- "id": "paragraph-7",
835
- "props": {
836
- "backgroundColor": "default",
837
- "textAlignment": "left",
838
- "textColor": "default",
839
- },
840
- "type": "paragraph",
841
- },
842
- ],
843
- }
844
- `;