@blocknote/core 0.17.1 → 0.19.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 (490) hide show
  1. package/dist/blocknote.js +2774 -1804
  2. package/dist/blocknote.js.map +1 -1
  3. package/dist/blocknote.umd.cjs +9 -6
  4. package/dist/blocknote.umd.cjs.map +1 -1
  5. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js +27 -0
  6. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js.map +1 -0
  7. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js +99 -0
  8. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.js.map +1 -0
  9. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js +97 -0
  10. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.js.map +1 -0
  11. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js +88 -0
  12. package/dist/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.js.map +1 -0
  13. package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.js +116 -0
  14. package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.js.map +1 -0
  15. package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.test.js +106 -0
  16. package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.test.js.map +1 -0
  17. package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js +57 -0
  18. package/dist/src/api/blockManipulation/commands/nestBlock/nestBlock.js.map +1 -0
  19. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js +43 -0
  20. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js.map +1 -0
  21. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js +27 -0
  22. package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js.map +1 -0
  23. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js +29 -0
  24. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js.map +1 -0
  25. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js +157 -0
  26. package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.js.map +1 -0
  27. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js +27 -0
  28. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js.map +1 -0
  29. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js +64 -0
  30. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js.map +1 -0
  31. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js +145 -0
  32. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js.map +1 -0
  33. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js +252 -0
  34. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.test.js.map +1 -0
  35. package/dist/src/api/blockManipulation/insertContentAt.js +64 -0
  36. package/dist/src/api/blockManipulation/insertContentAt.js.map +1 -0
  37. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js +76 -0
  38. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js.map +1 -0
  39. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js +33 -0
  40. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.js.map +1 -0
  41. package/dist/src/api/blockManipulation/setupTestEnv.js +172 -0
  42. package/dist/src/api/blockManipulation/setupTestEnv.js.map +1 -0
  43. package/dist/src/api/clipboard/clipboard.test.js +246 -0
  44. package/dist/src/api/clipboard/clipboard.test.js.map +1 -0
  45. package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js +8 -0
  46. package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js.map +1 -0
  47. package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js +38 -0
  48. package/dist/src/api/clipboard/fromClipboard/fileDropExtension.js.map +1 -0
  49. package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js +109 -0
  50. package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js.map +1 -0
  51. package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js +26 -0
  52. package/dist/src/api/clipboard/fromClipboard/handleVSCodePaste.js.map +1 -0
  53. package/dist/src/api/clipboard/fromClipboard/pasteExtension.js +57 -0
  54. package/dist/src/api/clipboard/fromClipboard/pasteExtension.js.map +1 -0
  55. package/dist/src/api/clipboard/toClipboard/copyExtension.js +132 -0
  56. package/dist/src/api/clipboard/toClipboard/copyExtension.js.map +1 -0
  57. package/dist/src/api/exporters/html/externalHTMLExporter.js +35 -0
  58. package/dist/src/api/exporters/html/externalHTMLExporter.js.map +1 -0
  59. package/dist/src/api/exporters/html/htmlConversion.test.js +72 -0
  60. package/dist/src/api/exporters/html/htmlConversion.test.js.map +1 -0
  61. package/dist/src/api/exporters/html/internalHTMLSerializer.js +21 -0
  62. package/dist/src/api/exporters/html/internalHTMLSerializer.js.map +1 -0
  63. package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js +141 -0
  64. package/dist/src/api/exporters/html/util/serializeBlocksExternalHTML.js.map +1 -0
  65. package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js +96 -0
  66. package/dist/src/api/exporters/html/util/serializeBlocksInternalHTML.js.map +1 -0
  67. package/dist/src/api/exporters/markdown/markdownExporter.js +31 -0
  68. package/dist/src/api/exporters/markdown/markdownExporter.js.map +1 -0
  69. package/dist/src/api/exporters/markdown/markdownExporter.test.js +57 -0
  70. package/dist/src/api/exporters/markdown/markdownExporter.test.js.map +1 -0
  71. package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js +33 -0
  72. package/dist/src/api/exporters/markdown/removeUnderlinesRehypePlugin.js.map +1 -0
  73. package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js +37 -0
  74. package/dist/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.js.map +1 -0
  75. package/dist/src/api/getBlockInfoFromPos.js +171 -0
  76. package/dist/src/api/getBlockInfoFromPos.js.map +1 -0
  77. package/dist/src/api/nodeConversions/blockToNode.js +197 -0
  78. package/dist/src/api/nodeConversions/blockToNode.js.map +1 -0
  79. package/dist/src/api/nodeConversions/fragmentToBlocks.js +50 -0
  80. package/dist/src/api/nodeConversions/fragmentToBlocks.js.map +1 -0
  81. package/dist/src/api/nodeConversions/nodeConversions.test.js +54 -0
  82. package/dist/src/api/nodeConversions/nodeConversions.test.js.map +1 -0
  83. package/dist/src/api/nodeConversions/nodeToBlock.js +316 -0
  84. package/dist/src/api/nodeConversions/nodeToBlock.js.map +1 -0
  85. package/dist/src/api/nodeUtil.js +28 -0
  86. package/dist/src/api/nodeUtil.js.map +1 -0
  87. package/dist/src/api/parsers/html/parseHTML.js +19 -0
  88. package/dist/src/api/parsers/html/parseHTML.js.map +1 -0
  89. package/dist/src/api/parsers/html/parseHTML.test.js +470 -0
  90. package/dist/src/api/parsers/html/parseHTML.test.js.map +1 -0
  91. package/dist/src/api/parsers/html/util/nestedLists.js +106 -0
  92. package/dist/src/api/parsers/html/util/nestedLists.js.map +1 -0
  93. package/dist/src/api/parsers/html/util/nestedLists.test.js +166 -0
  94. package/dist/src/api/parsers/html/util/nestedLists.test.js.map +1 -0
  95. package/dist/src/api/parsers/markdown/parseMarkdown.js +52 -0
  96. package/dist/src/api/parsers/markdown/parseMarkdown.js.map +1 -0
  97. package/dist/src/api/parsers/markdown/parseMarkdown.test.js +109 -0
  98. package/dist/src/api/parsers/markdown/parseMarkdown.test.js.map +1 -0
  99. package/dist/src/api/testUtil/cases/customBlocks.js +313 -0
  100. package/dist/src/api/testUtil/cases/customBlocks.js.map +1 -0
  101. package/dist/src/api/testUtil/cases/customInlineContent.js +91 -0
  102. package/dist/src/api/testUtil/cases/customInlineContent.js.map +1 -0
  103. package/dist/src/api/testUtil/cases/customStyles.js +83 -0
  104. package/dist/src/api/testUtil/cases/customStyles.js.map +1 -0
  105. package/dist/src/api/testUtil/cases/defaultSchema.js +673 -0
  106. package/dist/src/api/testUtil/cases/defaultSchema.js.map +1 -0
  107. package/dist/src/api/testUtil/index.js +2 -0
  108. package/dist/src/api/testUtil/index.js.map +1 -0
  109. package/dist/src/api/testUtil/partialBlockTestUtil.js +114 -0
  110. package/dist/src/api/testUtil/partialBlockTestUtil.js.map +1 -0
  111. package/dist/src/api/testUtil/paste.js +29 -0
  112. package/dist/src/api/testUtil/paste.js.map +1 -0
  113. package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js +97 -0
  114. package/dist/src/blocks/AudioBlockContent/AudioBlockContent.js.map +1 -0
  115. package/dist/src/blocks/AudioBlockContent/audioBlockHelpers.js +5 -0
  116. package/dist/src/blocks/AudioBlockContent/audioBlockHelpers.js.map +1 -0
  117. package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js +273 -0
  118. package/dist/src/blocks/CodeBlockContent/CodeBlockContent.js.map +1 -0
  119. package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js +90 -0
  120. package/dist/src/blocks/CodeBlockContent/defaultSupportedLanguages.js.map +1 -0
  121. package/dist/src/blocks/FileBlockContent/FileBlockContent.js +70 -0
  122. package/dist/src/blocks/FileBlockContent/FileBlockContent.js.map +1 -0
  123. package/dist/src/blocks/FileBlockContent/fileBlockHelpers.js +317 -0
  124. package/dist/src/blocks/FileBlockContent/fileBlockHelpers.js.map +1 -0
  125. package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js +15 -0
  126. package/dist/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js.map +1 -0
  127. package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js +141 -0
  128. package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js.map +1 -0
  129. package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js +106 -0
  130. package/dist/src/blocks/ImageBlockContent/ImageBlockContent.js.map +1 -0
  131. package/dist/src/blocks/ImageBlockContent/imageBlockHelpers.js +6 -0
  132. package/dist/src/blocks/ImageBlockContent/imageBlockHelpers.js.map +1 -0
  133. package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js +111 -0
  134. package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js.map +1 -0
  135. package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js +218 -0
  136. package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js.map +1 -0
  137. package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js +41 -0
  138. package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js.map +1 -0
  139. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js +58 -0
  140. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.js.map +1 -0
  141. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js +128 -0
  142. package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js.map +1 -0
  143. package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js +51 -0
  144. package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js.map +1 -0
  145. package/dist/src/blocks/TableBlockContent/TableBlockContent.js +130 -0
  146. package/dist/src/blocks/TableBlockContent/TableBlockContent.js.map +1 -0
  147. package/dist/src/blocks/TableBlockContent/TableExtension.js +57 -0
  148. package/dist/src/blocks/TableBlockContent/TableExtension.js.map +1 -0
  149. package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js +103 -0
  150. package/dist/src/blocks/VideoBlockContent/VideoBlockContent.js.map +1 -0
  151. package/dist/src/blocks/VideoBlockContent/videoBlockHelpers.js +6 -0
  152. package/dist/src/blocks/VideoBlockContent/videoBlockHelpers.js.map +1 -0
  153. package/dist/src/blocks/defaultBlockHelpers.js +50 -0
  154. package/dist/src/blocks/defaultBlockHelpers.js.map +1 -0
  155. package/dist/src/blocks/defaultBlockTypeGuards.js +40 -0
  156. package/dist/src/blocks/defaultBlockTypeGuards.js.map +1 -0
  157. package/dist/src/blocks/defaultBlocks.js +50 -0
  158. package/dist/src/blocks/defaultBlocks.js.map +1 -0
  159. package/dist/src/blocks/defaultProps.js +19 -0
  160. package/dist/src/blocks/defaultProps.js.map +1 -0
  161. package/dist/src/editor/BlockNoteEditor.js +750 -0
  162. package/dist/src/editor/BlockNoteEditor.js.map +1 -0
  163. package/dist/src/editor/BlockNoteEditor.test.js +65 -0
  164. package/dist/src/editor/BlockNoteEditor.test.js.map +1 -0
  165. package/dist/src/editor/BlockNoteExtensions.js +149 -0
  166. package/dist/src/editor/BlockNoteExtensions.js.map +1 -0
  167. package/dist/src/editor/BlockNoteSchema.js +38 -0
  168. package/dist/src/editor/BlockNoteSchema.js.map +1 -0
  169. package/dist/src/editor/BlockNoteTipTapEditor.js +169 -0
  170. package/dist/src/editor/BlockNoteTipTapEditor.js.map +1 -0
  171. package/dist/src/editor/cursorPositionTypes.js +2 -0
  172. package/dist/src/editor/cursorPositionTypes.js.map +1 -0
  173. package/dist/src/editor/defaultColors.js +77 -0
  174. package/dist/src/editor/defaultColors.js.map +1 -0
  175. package/dist/src/editor/selectionTypes.js +2 -0
  176. package/dist/src/editor/selectionTypes.js.map +1 -0
  177. package/dist/src/editor/transformPasted.js +79 -0
  178. package/dist/src/editor/transformPasted.js.map +1 -0
  179. package/dist/src/exporter/Exporter.js +36 -0
  180. package/dist/src/exporter/Exporter.js.map +1 -0
  181. package/dist/src/exporter/index.js +3 -0
  182. package/dist/src/exporter/index.js.map +1 -0
  183. package/dist/src/exporter/mapping.js +12 -0
  184. package/dist/src/exporter/mapping.js.map +1 -0
  185. package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js +30 -0
  186. package/dist/src/extensions/BackgroundColor/BackgroundColorExtension.js.map +1 -0
  187. package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js +39 -0
  188. package/dist/src/extensions/BackgroundColor/BackgroundColorMark.js.map +1 -0
  189. package/dist/src/extensions/FilePanel/FilePanelPlugin.js +131 -0
  190. package/dist/src/extensions/FilePanel/FilePanelPlugin.js.map +1 -0
  191. package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js +195 -0
  192. package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js.map +1 -0
  193. package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js +309 -0
  194. package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js.map +1 -0
  195. package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js +247 -0
  196. package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js.map +1 -0
  197. package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js +51 -0
  198. package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js.map +1 -0
  199. package/dist/src/extensions/Placeholder/PlaceholderPlugin.js +81 -0
  200. package/dist/src/extensions/Placeholder/PlaceholderPlugin.js.map +1 -0
  201. package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js +183 -0
  202. package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js.map +1 -0
  203. package/dist/src/extensions/SideMenu/MultipleNodeSelection.js +68 -0
  204. package/dist/src/extensions/SideMenu/MultipleNodeSelection.js.map +1 -0
  205. package/dist/src/extensions/SideMenu/SideMenuPlugin.js +339 -0
  206. package/dist/src/extensions/SideMenu/SideMenuPlugin.js.map +1 -0
  207. package/dist/src/extensions/SideMenu/dragging.js +128 -0
  208. package/dist/src/extensions/SideMenu/dragging.js.map +1 -0
  209. package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js +2 -0
  210. package/dist/src/extensions/SuggestionMenu/DefaultGridSuggestionItem.js.map +1 -0
  211. package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js +2 -0
  212. package/dist/src/extensions/SuggestionMenu/DefaultSuggestionItem.js.map +1 -0
  213. package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js +245 -0
  214. package/dist/src/extensions/SuggestionMenu/SuggestionPlugin.js.map +1 -0
  215. package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js +26 -0
  216. package/dist/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.js.map +1 -0
  217. package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js +244 -0
  218. package/dist/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.js.map +1 -0
  219. package/dist/src/extensions/TableHandles/TableHandlesPlugin.js +553 -0
  220. package/dist/src/extensions/TableHandles/TableHandlesPlugin.js.map +1 -0
  221. package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js +36 -0
  222. package/dist/src/extensions/TextAlignment/TextAlignmentExtension.js.map +1 -0
  223. package/dist/src/extensions/TextColor/TextColorExtension.js +29 -0
  224. package/dist/src/extensions/TextColor/TextColorExtension.js.map +1 -0
  225. package/dist/src/extensions/TextColor/TextColorMark.js +37 -0
  226. package/dist/src/extensions/TextColor/TextColorMark.js.map +1 -0
  227. package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js +58 -0
  228. package/dist/src/extensions/TrailingNode/TrailingNodeExtension.js.map +1 -0
  229. package/dist/src/extensions/UniqueID/UniqueID.js +283 -0
  230. package/dist/src/extensions/UniqueID/UniqueID.js.map +1 -0
  231. package/dist/src/extensions/getDraggableBlockFromElement.js +13 -0
  232. package/dist/src/extensions/getDraggableBlockFromElement.js.map +1 -0
  233. package/dist/src/extensions-shared/UiElementPosition.js +2 -0
  234. package/dist/src/extensions-shared/UiElementPosition.js.map +1 -0
  235. package/dist/src/i18n/dictionary.js +4 -0
  236. package/dist/src/i18n/dictionary.js.map +1 -0
  237. package/dist/src/i18n/locales/ar.js +298 -0
  238. package/dist/src/i18n/locales/ar.js.map +1 -0
  239. package/dist/src/i18n/locales/de.js +313 -0
  240. package/dist/src/i18n/locales/de.js.map +1 -0
  241. package/dist/src/i18n/locales/en.js +314 -0
  242. package/dist/src/i18n/locales/en.js.map +1 -0
  243. package/dist/src/i18n/locales/es.js +312 -0
  244. package/dist/src/i18n/locales/es.js.map +1 -0
  245. package/dist/src/i18n/locales/fr.js +313 -0
  246. package/dist/src/i18n/locales/fr.js.map +1 -0
  247. package/dist/src/i18n/locales/hr.js +308 -0
  248. package/dist/src/i18n/locales/hr.js.map +1 -0
  249. package/dist/src/i18n/locales/index.js +16 -0
  250. package/dist/src/i18n/locales/index.js.map +1 -0
  251. package/dist/src/i18n/locales/is.js +305 -0
  252. package/dist/src/i18n/locales/is.js.map +1 -0
  253. package/dist/src/i18n/locales/ja.js +333 -0
  254. package/dist/src/i18n/locales/ja.js.map +1 -0
  255. package/dist/src/i18n/locales/ko.js +326 -0
  256. package/dist/src/i18n/locales/ko.js.map +1 -0
  257. package/dist/src/i18n/locales/nl.js +313 -0
  258. package/dist/src/i18n/locales/nl.js.map +1 -0
  259. package/dist/src/i18n/locales/pl.js +297 -0
  260. package/dist/src/i18n/locales/pl.js.map +1 -0
  261. package/dist/src/i18n/locales/pt.js +305 -0
  262. package/dist/src/i18n/locales/pt.js.map +1 -0
  263. package/dist/src/i18n/locales/ru.js +340 -0
  264. package/dist/src/i18n/locales/ru.js.map +1 -0
  265. package/dist/src/i18n/locales/vi.js +312 -0
  266. package/dist/src/i18n/locales/vi.js.map +1 -0
  267. package/dist/src/i18n/locales/zh.js +346 -0
  268. package/dist/src/i18n/locales/zh.js.map +1 -0
  269. package/dist/src/index.js +55 -0
  270. package/dist/src/index.js.map +1 -0
  271. package/dist/src/pm-nodes/BlockContainer.js +72 -0
  272. package/dist/src/pm-nodes/BlockContainer.js.map +1 -0
  273. package/dist/src/pm-nodes/BlockGroup.js +43 -0
  274. package/dist/src/pm-nodes/BlockGroup.js.map +1 -0
  275. package/dist/src/pm-nodes/Doc.js +7 -0
  276. package/dist/src/pm-nodes/Doc.js.map +1 -0
  277. package/dist/src/pm-nodes/index.js +4 -0
  278. package/dist/src/pm-nodes/index.js.map +1 -0
  279. package/dist/src/schema/blocks/createSpec.js +126 -0
  280. package/dist/src/schema/blocks/createSpec.js.map +1 -0
  281. package/dist/src/schema/blocks/internal.js +147 -0
  282. package/dist/src/schema/blocks/internal.js.map +1 -0
  283. package/dist/src/schema/blocks/types.js +2 -0
  284. package/dist/src/schema/blocks/types.js.map +1 -0
  285. package/dist/src/schema/index.js +11 -0
  286. package/dist/src/schema/index.js.map +1 -0
  287. package/dist/src/schema/inlineContent/createSpec.js +64 -0
  288. package/dist/src/schema/inlineContent/createSpec.js.map +1 -0
  289. package/dist/src/schema/inlineContent/internal.js +52 -0
  290. package/dist/src/schema/inlineContent/internal.js.map +1 -0
  291. package/dist/src/schema/inlineContent/types.js +10 -0
  292. package/dist/src/schema/inlineContent/types.js.map +1 -0
  293. package/dist/src/schema/propTypes.js +2 -0
  294. package/dist/src/schema/propTypes.js.map +1 -0
  295. package/dist/src/schema/styles/createSpec.js +48 -0
  296. package/dist/src/schema/styles/createSpec.js.map +1 -0
  297. package/dist/src/schema/styles/internal.js +53 -0
  298. package/dist/src/schema/styles/internal.js.map +1 -0
  299. package/dist/src/schema/styles/types.js +2 -0
  300. package/dist/src/schema/styles/types.js.map +1 -0
  301. package/dist/src/util/EventEmitter.js +33 -0
  302. package/dist/src/util/EventEmitter.js.map +1 -0
  303. package/dist/src/util/browser.js +17 -0
  304. package/dist/src/util/browser.js.map +1 -0
  305. package/dist/src/util/combineByGroup.js +20 -0
  306. package/dist/src/util/combineByGroup.js.map +1 -0
  307. package/dist/src/util/esmDependencies.js +35 -0
  308. package/dist/src/util/esmDependencies.js.map +1 -0
  309. package/dist/src/util/string.js +14 -0
  310. package/dist/src/util/string.js.map +1 -0
  311. package/dist/src/util/typescript.js +12 -0
  312. package/dist/src/util/typescript.js.map +1 -0
  313. package/dist/style.css +1 -1
  314. package/dist/tsconfig.tsbuildinfo +1 -0
  315. package/dist/webpack-stats.json +1 -1
  316. package/package.json +9 -7
  317. package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +30 -0
  318. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +2 -0
  319. package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +25 -0
  320. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +2 -2
  321. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +104 -39
  322. package/src/api/blockManipulation/commands/moveBlock/__snapshots__/moveBlock.test.ts.snap +40 -0
  323. package/src/api/blockManipulation/commands/moveBlock/moveBlock.ts +3 -5
  324. package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +100 -0
  325. package/src/api/blockManipulation/commands/removeBlocks/__snapshots__/removeBlocks.test.ts.snap +10 -0
  326. package/src/api/blockManipulation/commands/removeBlocks/removeBlocks.ts +1 -1
  327. package/src/api/blockManipulation/commands/replaceBlocks/__snapshots__/replaceBlocks.test.ts.snap +40 -0
  328. package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +30 -0
  329. package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +8 -4
  330. package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +11 -7
  331. package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +87 -0
  332. package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +5 -5
  333. package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +192 -107
  334. package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.ts +48 -33
  335. package/src/api/clipboard/clipboard.test.ts +1 -1
  336. package/src/api/clipboard/fromClipboard/acceptedMIMETypes.ts +1 -0
  337. package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +1 -1
  338. package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +49 -0
  339. package/src/api/clipboard/fromClipboard/pasteExtension.ts +6 -0
  340. package/src/api/clipboard/toClipboard/copyExtension.ts +1 -1
  341. package/src/api/exporters/html/__snapshots__/codeBlock/defaultLanguage/external.html +1 -0
  342. package/src/api/exporters/html/__snapshots__/codeBlock/defaultLanguage/internal.html +1 -0
  343. package/src/api/exporters/html/__snapshots__/codeBlock/empty/external.html +1 -0
  344. package/src/api/exporters/html/__snapshots__/codeBlock/empty/internal.html +1 -0
  345. package/src/api/exporters/html/__snapshots__/codeBlock/python/external.html +1 -0
  346. package/src/api/exporters/html/__snapshots__/codeBlock/python/internal.html +1 -0
  347. package/src/api/exporters/html/__snapshots__/image/basic/internal.html +1 -1
  348. package/src/api/exporters/html/__snapshots__/image/nested/internal.html +1 -1
  349. package/src/api/exporters/html/__snapshots__/image/noName/internal.html +1 -1
  350. package/src/api/exporters/html/__snapshots__/image/noPreview/internal.html +1 -1
  351. package/src/api/exporters/html/__snapshots__/lists/basic/internal.html +1 -1
  352. package/src/api/exporters/html/__snapshots__/lists/nested/internal.html +1 -1
  353. package/src/api/exporters/html/__snapshots__/simpleImage/basic/external.html +1 -1
  354. package/src/api/exporters/html/__snapshots__/simpleImage/basic/internal.html +1 -1
  355. package/src/api/exporters/html/__snapshots__/simpleImage/nested/external.html +1 -1
  356. package/src/api/exporters/html/__snapshots__/simpleImage/nested/internal.html +1 -1
  357. package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/external.html +1 -1
  358. package/src/api/exporters/html/__snapshots__/simpleImage/noName/external.html +1 -1
  359. package/src/api/exporters/html/__snapshots__/simpleImage/noName/internal.html +1 -1
  360. package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/external.html +1 -1
  361. package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/internal.html +1 -1
  362. package/src/api/exporters/html/__snapshots__/table/allColWidths/external.html +1 -0
  363. package/src/api/exporters/html/__snapshots__/table/allColWidths/internal.html +1 -0
  364. package/src/api/exporters/html/__snapshots__/table/basic/external.html +1 -0
  365. package/src/api/exporters/html/__snapshots__/table/basic/internal.html +1 -0
  366. package/src/api/exporters/html/__snapshots__/table/mixedColWidths/external.html +1 -0
  367. package/src/api/exporters/html/__snapshots__/table/mixedColWidths/internal.html +1 -0
  368. package/src/api/exporters/html/htmlConversion.test.ts +1 -4
  369. package/src/api/exporters/html/internalHTMLSerializer.ts +2 -7
  370. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +7 -1
  371. package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +75 -33
  372. package/src/api/exporters/markdown/__snapshots__/codeBlock/defaultLanguage/markdown.md +3 -0
  373. package/src/api/exporters/markdown/__snapshots__/codeBlock/empty/markdown.md +2 -0
  374. package/src/api/exporters/markdown/__snapshots__/codeBlock/python/markdown.md +3 -0
  375. package/src/api/exporters/markdown/__snapshots__/table/allColWidths/markdown.md +5 -0
  376. package/src/api/exporters/markdown/__snapshots__/table/basic/markdown.md +5 -0
  377. package/src/api/exporters/markdown/__snapshots__/table/mixedColWidths/markdown.md +5 -0
  378. package/src/api/exporters/markdown/markdownExporter.test.ts +1 -4
  379. package/src/api/getBlockInfoFromPos.ts +113 -58
  380. package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +711 -0
  381. package/src/api/nodeConversions/blockToNode.ts +62 -26
  382. package/src/api/nodeConversions/fragmentToBlocks.ts +18 -0
  383. package/src/api/nodeConversions/nodeToBlock.ts +35 -22
  384. package/src/api/nodeUtil.ts +1 -1
  385. package/src/api/parsers/html/__snapshots__/parse-notion-html.json +5 -0
  386. package/src/api/parsers/markdown/parseMarkdown.ts +1 -1
  387. package/src/api/testUtil/cases/defaultSchema.ts +95 -0
  388. package/src/api/testUtil/partialBlockTestUtil.ts +41 -4
  389. package/src/blocks/AudioBlockContent/AudioBlockContent.ts +4 -2
  390. package/src/blocks/CodeBlockContent/CodeBlockContent.ts +369 -0
  391. package/src/blocks/CodeBlockContent/defaultSupportedLanguages.ts +96 -0
  392. package/src/blocks/FileBlockContent/fileBlockHelpers.ts +10 -2
  393. package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +19 -31
  394. package/src/blocks/ImageBlockContent/ImageBlockContent.ts +4 -2
  395. package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +5 -9
  396. package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +6 -10
  397. package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +1 -1
  398. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +11 -4
  399. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +5 -9
  400. package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +4 -8
  401. package/src/blocks/TableBlockContent/TableBlockContent.ts +83 -8
  402. package/src/blocks/TableBlockContent/TableExtension.ts +10 -1
  403. package/src/blocks/VideoBlockContent/VideoBlockContent.ts +4 -2
  404. package/src/blocks/defaultBlockHelpers.ts +7 -2
  405. package/src/blocks/defaultBlocks.ts +4 -0
  406. package/src/editor/Block.css +71 -3
  407. package/src/editor/BlockNoteEditor.test.ts +2 -2
  408. package/src/editor/BlockNoteEditor.ts +18 -21
  409. package/src/editor/BlockNoteExtensions.ts +2 -3
  410. package/src/editor/BlockNoteTipTapEditor.ts +8 -1
  411. package/src/editor/defaultColors.ts +77 -0
  412. package/src/editor/editor.css +43 -5
  413. package/src/editor/transformPasted.ts +6 -3
  414. package/src/exporter/Exporter.ts +101 -0
  415. package/src/exporter/index.ts +2 -0
  416. package/src/exporter/mapping.ts +75 -0
  417. package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +8 -0
  418. package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +201 -48
  419. package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts +1 -1
  420. package/src/extensions/Placeholder/PlaceholderPlugin.ts +5 -0
  421. package/src/extensions/SideMenu/SideMenuPlugin.ts +141 -52
  422. package/src/extensions/SideMenu/dragging.ts +3 -54
  423. package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +5 -0
  424. package/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts +2 -1
  425. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +22 -6
  426. package/src/extensions/TableHandles/TableHandlesPlugin.ts +225 -120
  427. package/src/extensions/TrailingNode/TrailingNodeExtension.ts +1 -1
  428. package/src/extensions/getDraggableBlockFromElement.ts +19 -0
  429. package/src/i18n/locales/ar.ts +6 -0
  430. package/src/i18n/locales/de.ts +299 -294
  431. package/src/i18n/locales/en.ts +6 -0
  432. package/src/i18n/locales/es.ts +310 -274
  433. package/src/i18n/locales/fr.ts +6 -0
  434. package/src/i18n/locales/is.ts +6 -0
  435. package/src/i18n/locales/ja.ts +6 -0
  436. package/src/i18n/locales/ko.ts +6 -0
  437. package/src/i18n/locales/nl.ts +6 -0
  438. package/src/i18n/locales/pl.ts +6 -0
  439. package/src/i18n/locales/pt.ts +10 -4
  440. package/src/i18n/locales/ru.ts +6 -0
  441. package/src/i18n/locales/vi.ts +6 -0
  442. package/src/i18n/locales/zh.ts +6 -0
  443. package/src/index.ts +9 -0
  444. package/src/pm-nodes/BlockContainer.ts +1 -1
  445. package/src/pm-nodes/BlockGroup.ts +2 -2
  446. package/src/pm-nodes/README.md +127 -28
  447. package/src/schema/blocks/createSpec.ts +4 -1
  448. package/src/schema/blocks/internal.ts +12 -2
  449. package/src/schema/blocks/types.ts +3 -1
  450. package/src/util/combineByGroup.ts +25 -0
  451. package/types/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.d.ts +22 -2
  452. package/types/src/api/blockManipulation/commands/nestBlock/nestBlock.d.ts +5 -0
  453. package/types/src/api/blockManipulation/setupTestEnv.d.ts +22 -8
  454. package/types/src/api/clipboard/fromClipboard/acceptedMIMETypes.d.ts +1 -1
  455. package/types/src/api/clipboard/fromClipboard/handleVSCodePaste.d.ts +3 -0
  456. package/types/src/api/exporters/html/util/serializeBlocksInternalHTML.d.ts +2 -3
  457. package/types/src/api/getBlockInfoFromPos.d.ts +55 -5
  458. package/types/src/api/nodeConversions/blockToNode.d.ts +1 -1
  459. package/types/src/api/nodeConversions/nodeToBlock.d.ts +3 -1
  460. package/types/src/api/testUtil/cases/customBlocks.d.ts +22 -8
  461. package/types/src/api/testUtil/cases/customInlineContent.d.ts +22 -8
  462. package/types/src/api/testUtil/cases/customStyles.d.ts +22 -8
  463. package/types/src/api/testUtil/partialBlockTestUtil.d.ts +2 -1
  464. package/types/src/blocks/AudioBlockContent/AudioBlockContent.d.ts +1 -0
  465. package/types/src/blocks/CodeBlockContent/CodeBlockContent.d.ts +57 -0
  466. package/types/src/blocks/CodeBlockContent/defaultSupportedLanguages.d.ts +6 -0
  467. package/types/src/blocks/FileBlockContent/fileBlockHelpers.d.ts +1 -0
  468. package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +1 -0
  469. package/types/src/blocks/TableBlockContent/TableBlockContent.d.ts +0 -12
  470. package/types/src/blocks/TableBlockContent/TableExtension.d.ts +3 -0
  471. package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +1 -0
  472. package/types/src/blocks/defaultBlocks.d.ts +45 -16
  473. package/types/src/editor/BlockNoteEditor.d.ts +4 -3
  474. package/types/src/editor/BlockNoteTipTapEditor.d.ts +1 -0
  475. package/types/src/editor/defaultColors.d.ts +76 -0
  476. package/types/src/exporter/Exporter.d.ts +43 -0
  477. package/types/src/exporter/index.d.ts +2 -0
  478. package/types/src/exporter/mapping.d.ts +30 -0
  479. package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +2 -1
  480. package/types/src/extensions/SideMenu/dragging.d.ts +1 -6
  481. package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +9 -5
  482. package/types/src/extensions/getDraggableBlockFromElement.d.ts +5 -0
  483. package/types/src/i18n/locales/de.d.ts +6 -0
  484. package/types/src/i18n/locales/en.d.ts +6 -0
  485. package/types/src/i18n/locales/es.d.ts +6 -0
  486. package/types/src/index.d.ts +6 -0
  487. package/types/src/schema/blocks/createSpec.d.ts +1 -1
  488. package/types/src/schema/blocks/internal.d.ts +2 -2
  489. package/types/src/schema/blocks/types.d.ts +3 -1
  490. package/types/src/util/combineByGroup.d.ts +9 -0
@@ -0,0 +1,79 @@
1
+ import { Fragment, Slice } from "@tiptap/pm/model";
2
+ // helper function to remove a child from a fragment
3
+ function removeChild(node, n) {
4
+ const children = [];
5
+ node.forEach((child, _, i) => {
6
+ if (i !== n) {
7
+ children.push(child);
8
+ }
9
+ });
10
+ return Fragment.from(children);
11
+ }
12
+ /**
13
+ * Wrap adjacent tableRow items in a table.
14
+ *
15
+ * This makes sure the content that we paste is always a table (and not a tableRow)
16
+ * A table works better for the remaing paste handling logic, as it's actually a blockContent node
17
+ */
18
+ export function wrapTableRows(f, schema) {
19
+ const newItems = [];
20
+ for (let i = 0; i < f.childCount; i++) {
21
+ if (f.child(i).type.name === "tableRow") {
22
+ if (newItems.length > 0 &&
23
+ newItems[newItems.length - 1].type.name === "table") {
24
+ // append to existing table
25
+ const prevTable = newItems[newItems.length - 1];
26
+ const newTable = prevTable.copy(prevTable.content.addToEnd(f.child(i)));
27
+ newItems[newItems.length - 1] = newTable;
28
+ }
29
+ else {
30
+ // create new table to wrap tableRow with
31
+ const newTable = schema.nodes.table.createChecked(undefined, f.child(i));
32
+ newItems.push(newTable);
33
+ }
34
+ }
35
+ else {
36
+ newItems.push(f.child(i));
37
+ }
38
+ }
39
+ f = Fragment.from(newItems);
40
+ return f;
41
+ }
42
+ /**
43
+ * fix for https://github.com/ProseMirror/prosemirror/issues/1430#issuecomment-1822570821
44
+ *
45
+ * Without this fix, pasting two paragraphs would cause the second one to be indented in the other
46
+ * this fix wraps every element in the slice in it's own blockContainer, to prevent Prosemirror from nesting the
47
+ * elements on paste.
48
+ *
49
+ * The exception is when we encounter blockGroups with listitems, because those actually should be nested
50
+ */
51
+ export function transformPasted(slice, view) {
52
+ let f = Fragment.from(slice.content);
53
+ f = wrapTableRows(f, view.state.schema);
54
+ for (let i = 0; i < f.childCount; i++) {
55
+ if (f.child(i).type.spec.group === "blockContent") {
56
+ const content = [f.child(i)];
57
+ // when there is a blockGroup with lists, it should be nested in the new blockcontainer
58
+ // (if we remove this if-block, the nesting bug will be fixed, but lists won't be nested correctly)
59
+ if (i + 1 < f.childCount &&
60
+ f.child(i + 1).type.name === "blockGroup" // TODO
61
+ ) {
62
+ const nestedChild = f
63
+ .child(i + 1)
64
+ .child(0)
65
+ .child(0);
66
+ if (nestedChild.type.name === "bulletListItem" ||
67
+ nestedChild.type.name === "numberedListItem" ||
68
+ nestedChild.type.name === "checkListItem") {
69
+ content.push(f.child(i + 1));
70
+ f = removeChild(f, i + 1);
71
+ }
72
+ }
73
+ const container = view.state.schema.nodes.blockContainer.createChecked(undefined, content);
74
+ f = f.replaceChild(i, container);
75
+ }
76
+ }
77
+ return new Slice(f, slice.openStart, slice.openEnd);
78
+ }
79
+ //# sourceMappingURL=transformPasted.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformPasted.js","sourceRoot":"","sources":["../../../src/editor/transformPasted.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAU,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG3D,oDAAoD;AACpD,SAAS,WAAW,CAAC,IAAc,EAAE,CAAS;IAC5C,MAAM,QAAQ,GAAU,EAAE,CAAC;IAC3B,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE;QAC3B,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACZ,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC,IAAI,CAAC,QAAQ,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H,CAAC;YACD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,CACpE,SAAS,EACT,OAAO,CACR,CAAC;YACF,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IACD,OAAO,IAAI,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,36 @@
1
+ export class Exporter {
2
+ mappings;
3
+ options;
4
+ constructor(_schema, // only used for type inference
5
+ mappings, options) {
6
+ this.mappings = mappings;
7
+ this.options = options;
8
+ }
9
+ async resolveFile(url) {
10
+ if (!this.options?.resolveFileUrl) {
11
+ return (await fetch(url)).blob();
12
+ }
13
+ const ret = await this.options.resolveFileUrl(url);
14
+ if (ret instanceof Blob) {
15
+ return ret;
16
+ }
17
+ return (await fetch(ret)).blob();
18
+ }
19
+ mapStyles(styles) {
20
+ const stylesArray = Object.entries(styles).map(([key, value]) => {
21
+ const mappedStyle = this.mappings.styleMapping[key](value, this);
22
+ return mappedStyle;
23
+ });
24
+ return stylesArray;
25
+ }
26
+ mapInlineContent(inlineContent) {
27
+ return this.mappings.inlineContentMapping[inlineContent.type](inlineContent, this);
28
+ }
29
+ transformInlineContent(inlineContentArray) {
30
+ return inlineContentArray.map((ic) => this.mapInlineContent(ic));
31
+ }
32
+ async mapBlock(block, nestingLevel, numberedListIndex) {
33
+ return this.mappings.blockMapping[block.type](block, this, nestingLevel, numberedListIndex);
34
+ }
35
+ }
36
+ //# sourceMappingURL=Exporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Exporter.js","sourceRoot":"","sources":["../../../src/exporter/Exporter.ts"],"names":[],"mappings":"AAqCA,MAAM,OAAgB,QAAQ;IAWP;IAKH;IAPlB,YACE,OAAiC,EAAE,+BAA+B;IAC/C,QAIl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,EACpB,iBAAyB;QAEzB,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAC3C,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,iBAAiB,CAClB,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ export * from "./Exporter.js";
2
+ export * from "./mapping.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exporter/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The mapping factory is a utility function to easily create mappings for
3
+ * a BlockNoteSchema. Using the factory makes it easier to get typescript code completion etc.
4
+ */
5
+ export function mappingFactory(_schema) {
6
+ return {
7
+ createBlockMapping: (mapping) => mapping,
8
+ createInlineContentMapping: (mapping) => mapping,
9
+ createStyleMapping: (mapping) => mapping,
10
+ };
11
+ }
12
+ //# sourceMappingURL=mapping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapping.js","sourceRoot":"","sources":["../../../src/exporter/mapping.ts"],"names":[],"mappings":"AAyDA;;;GAGG;AACH,MAAM,UAAU,cAAc,CAI5B,OAAiC;IACjC,OAAO;QACL,kBAAkB,EAAE,CAAQ,OAAqC,EAAE,EAAE,CACnE,OAAO;QACT,0BAA0B,EAAE,CAC1B,OAA0C,EAC1C,EAAE,CAAC,OAAO;QACZ,kBAAkB,EAAE,CAAI,OAA2B,EAAE,EAAE,CAAC,OAAO;KAChE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { Extension } from "@tiptap/core";
2
+ import { defaultProps } from "../../blocks/defaultProps.js";
3
+ export const BackgroundColorExtension = Extension.create({
4
+ name: "blockBackgroundColor",
5
+ addGlobalAttributes() {
6
+ return [
7
+ {
8
+ types: ["blockContainer"],
9
+ attributes: {
10
+ backgroundColor: {
11
+ default: defaultProps.backgroundColor.default,
12
+ parseHTML: (element) => element.hasAttribute("data-background-color")
13
+ ? element.getAttribute("data-background-color")
14
+ : defaultProps.backgroundColor.default,
15
+ renderHTML: (attributes) => {
16
+ if (attributes.backgroundColor ===
17
+ defaultProps.backgroundColor.default) {
18
+ return {};
19
+ }
20
+ return {
21
+ "data-background-color": attributes.backgroundColor,
22
+ };
23
+ },
24
+ },
25
+ },
26
+ },
27
+ ];
28
+ },
29
+ });
30
+ //# sourceMappingURL=BackgroundColorExtension.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BackgroundColorExtension.js","sourceRoot":"","sources":["../../../../src/extensions/BackgroundColor/BackgroundColorExtension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,MAAM,CAAC,MAAM,wBAAwB,GAAG,SAAS,CAAC,MAAM,CAAC;IACvD,IAAI,EAAE,sBAAsB;IAE5B,mBAAmB;QACjB,OAAO;YACL;gBACE,KAAK,EAAE,CAAC,gBAAgB,CAAC;gBACzB,UAAU,EAAE;oBACV,eAAe,EAAE;wBACf,OAAO,EAAE,YAAY,CAAC,eAAe,CAAC,OAAO;wBAC7C,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CACrB,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC;4BAC3C,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC;4BAC/C,CAAC,CAAC,YAAY,CAAC,eAAe,CAAC,OAAO;wBAC1C,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE;4BACzB,IACE,UAAU,CAAC,eAAe;gCAC1B,YAAY,CAAC,eAAe,CAAC,OAAO,EACpC,CAAC;gCACD,OAAO,EAAE,CAAC;4BACZ,CAAC;4BACD,OAAO;gCACL,uBAAuB,EAAE,UAAU,CAAC,eAAe;6BACpD,CAAC;wBACJ,CAAC;qBACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { Mark } from "@tiptap/core";
2
+ import { createStyleSpecFromTipTapMark } from "../../schema/index.js";
3
+ const BackgroundColorMark = Mark.create({
4
+ name: "backgroundColor",
5
+ addAttributes() {
6
+ return {
7
+ stringValue: {
8
+ default: undefined,
9
+ parseHTML: (element) => element.getAttribute("data-background-color"),
10
+ renderHTML: (attributes) => ({
11
+ "data-background-color": attributes.stringValue,
12
+ }),
13
+ },
14
+ };
15
+ },
16
+ parseHTML() {
17
+ return [
18
+ {
19
+ tag: "span",
20
+ getAttrs: (element) => {
21
+ if (typeof element === "string") {
22
+ return false;
23
+ }
24
+ if (element.hasAttribute("data-background-color")) {
25
+ return {
26
+ stringValue: element.getAttribute("data-background-color"),
27
+ };
28
+ }
29
+ return false;
30
+ },
31
+ },
32
+ ];
33
+ },
34
+ renderHTML({ HTMLAttributes }) {
35
+ return ["span", HTMLAttributes, 0];
36
+ },
37
+ });
38
+ export const BackgroundColor = createStyleSpecFromTipTapMark(BackgroundColorMark, "string");
39
+ //# sourceMappingURL=BackgroundColorMark.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BackgroundColorMark.js","sourceRoot":"","sources":["../../../../src/extensions/BackgroundColor/BackgroundColorMark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAEtE,MAAM,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,iBAAiB;IAEvB,aAAa;QACX,OAAO;YACL,WAAW,EAAE;gBACX,OAAO,EAAE,SAAS;gBAClB,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC;gBACrE,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;oBAC3B,uBAAuB,EAAE,UAAU,CAAC,WAAW;iBAChD,CAAC;aACH;SACF,CAAC;IACJ,CAAC;IAED,SAAS;QACP,OAAO;YACL;gBACE,GAAG,EAAE,MAAM;gBACX,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE;oBACpB,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;wBAChC,OAAO,KAAK,CAAC;oBACf,CAAC;oBAED,IAAI,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC,EAAE,CAAC;wBAClD,OAAO;4BACL,WAAW,EAAE,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC;yBAC3D,CAAC;oBACJ,CAAC;oBAED,OAAO,KAAK,CAAC;gBACf,CAAC;aACF;SACF,CAAC;IACJ,CAAC;IAED,UAAU,CAAC,EAAE,cAAc,EAAE;QAC3B,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;IACrC,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,6BAA6B,CAC1D,mBAAmB,EACnB,QAAQ,CACT,CAAC"}
@@ -0,0 +1,131 @@
1
+ import { Plugin, PluginKey } from "prosemirror-state";
2
+ import { EventEmitter } from "../../util/EventEmitter.js";
3
+ export class FilePanelView {
4
+ editor;
5
+ pluginKey;
6
+ pmView;
7
+ state;
8
+ emitUpdate;
9
+ constructor(editor, pluginKey, pmView, emitUpdate) {
10
+ this.editor = editor;
11
+ this.pluginKey = pluginKey;
12
+ this.pmView = pmView;
13
+ this.emitUpdate = () => {
14
+ if (!this.state) {
15
+ throw new Error("Attempting to update uninitialized file panel");
16
+ }
17
+ emitUpdate(this.state);
18
+ };
19
+ pmView.dom.addEventListener("mousedown", this.mouseDownHandler);
20
+ pmView.dom.addEventListener("dragstart", this.dragstartHandler);
21
+ // Setting capture=true ensures that any parent container of the editor that
22
+ // gets scrolled will trigger the scroll event. Scroll events do not bubble
23
+ // and so won't propagate to the document by default.
24
+ pmView.root.addEventListener("scroll", this.scrollHandler, true);
25
+ }
26
+ mouseDownHandler = () => {
27
+ if (this.state?.show) {
28
+ this.state.show = false;
29
+ this.emitUpdate();
30
+ }
31
+ };
32
+ // For dragging the whole editor.
33
+ dragstartHandler = () => {
34
+ if (this.state?.show) {
35
+ this.state.show = false;
36
+ this.emitUpdate();
37
+ }
38
+ };
39
+ scrollHandler = () => {
40
+ if (this.state?.show) {
41
+ const blockElement = this.pmView.root.querySelector(`[data-node-type="blockContainer"][data-id="${this.state.block.id}"]`);
42
+ if (!blockElement) {
43
+ return;
44
+ }
45
+ this.state.referencePos = blockElement.getBoundingClientRect();
46
+ this.emitUpdate();
47
+ }
48
+ };
49
+ update(view, prevState) {
50
+ const pluginState = this.pluginKey.getState(view.state);
51
+ if (!this.state?.show && pluginState.block && this.editor.isEditable) {
52
+ const blockElement = this.pmView.root.querySelector(`[data-node-type="blockContainer"][data-id="${pluginState.block.id}"]`);
53
+ if (!blockElement) {
54
+ return;
55
+ }
56
+ this.state = {
57
+ show: true,
58
+ referencePos: blockElement.getBoundingClientRect(),
59
+ block: pluginState.block,
60
+ };
61
+ this.emitUpdate();
62
+ return;
63
+ }
64
+ if (!view.state.selection.eq(prevState.selection) ||
65
+ !view.state.doc.eq(prevState.doc) ||
66
+ !this.editor.isEditable) {
67
+ if (this.state?.show) {
68
+ this.state.show = false;
69
+ this.emitUpdate();
70
+ }
71
+ }
72
+ }
73
+ closeMenu = () => {
74
+ if (this.state?.show) {
75
+ this.state.show = false;
76
+ this.emitUpdate();
77
+ }
78
+ };
79
+ destroy() {
80
+ this.pmView.dom.removeEventListener("mousedown", this.mouseDownHandler);
81
+ this.pmView.dom.removeEventListener("dragstart", this.dragstartHandler);
82
+ this.pmView.root.removeEventListener("scroll", this.scrollHandler, true);
83
+ }
84
+ }
85
+ const filePanelPluginKey = new PluginKey("FilePanelPlugin");
86
+ export class FilePanelProsemirrorPlugin extends EventEmitter {
87
+ view;
88
+ plugin;
89
+ constructor(editor) {
90
+ super();
91
+ this.plugin = new Plugin({
92
+ key: filePanelPluginKey,
93
+ view: (editorView) => {
94
+ this.view = new FilePanelView(editor, filePanelPluginKey, editorView, (state) => {
95
+ this.emit("update", state);
96
+ });
97
+ return this.view;
98
+ },
99
+ props: {
100
+ handleKeyDown: (_view, event) => {
101
+ if (event.key === "Escape" && this.shown) {
102
+ this.view?.closeMenu();
103
+ return true;
104
+ }
105
+ return false;
106
+ },
107
+ },
108
+ state: {
109
+ init: () => {
110
+ return {
111
+ block: undefined,
112
+ };
113
+ },
114
+ apply: (transaction) => {
115
+ const block = transaction.getMeta(filePanelPluginKey)?.block;
116
+ return {
117
+ block,
118
+ };
119
+ },
120
+ },
121
+ });
122
+ }
123
+ get shown() {
124
+ return this.view?.state?.show || false;
125
+ }
126
+ onUpdate(callback) {
127
+ return this.on("update", callback);
128
+ }
129
+ closeMenu = () => this.view?.closeMenu();
130
+ }
131
+ //# sourceMappingURL=FilePanelPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilePanelPlugin.js","sourceRoot":"","sources":["../../../../src/extensions/FilePanel/FilePanelPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,EAAE,SAAS,EAAc,MAAM,mBAAmB,CAAC;AAW/E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAU1D,MAAM,OAAO,aAAa;IAOL;IAKA;IACA;IAVZ,KAAK,CAAwB;IAC7B,UAAU,CAAa;IAE9B,YACmB,MAIhB,EACgB,SAAoB,EACpB,MAAkB,EACnC,UAAiD;QAPhC,WAAM,GAAN,MAAM,CAItB;QACgB,cAAS,GAAT,SAAS,CAAW;QACpB,WAAM,GAAN,MAAM,CAAY;QAGnC,IAAI,CAAC,UAAU,GAAG,GAAG,EAAE;YACrB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;gBAChB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;YACnE,CAAC;YAED,UAAU,C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,GAAG,EAAE;oBACT,OAAO;wBACL,KAAK,EAAE,SAAS;qBACjB,CAAC;gBACJ,CAAC;gBACD,KAAK,EAAE,CAAC,WAAW,EAAE,EAAE;oBACrB,MAAM,KAAK,GACT,WAAW,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,KAAK,CAAC;oBAEjD,OAAO;wBACL,KAAK;qBACN,CAAC;gBACJ,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,IAAI,KAAK,CAAC;IACzC,CAAC;IAEM,QAAQ,CAAC,QAA+C;QAC7D,OAAO,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACrC,CAAC;IAEM,SAAS,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC;CACjD"}
@@ -0,0 +1,195 @@
1
+ import { isNodeSelection, isTextSelection, posToDOMRect } from "@tiptap/core";
2
+ import { Plugin, PluginKey } from "prosemirror-state";
3
+ import { EventEmitter } from "../../util/EventEmitter.js";
4
+ export class FormattingToolbarView {
5
+ editor;
6
+ pmView;
7
+ state;
8
+ emitUpdate;
9
+ preventHide = false;
10
+ preventShow = false;
11
+ shouldShow = ({ state, from, to, view }) => {
12
+ const { doc, selection } = state;
13
+ const { empty } = selection;
14
+ // Sometime check for `empty` is not enough.
15
+ // Doubleclick an empty paragraph returns a node size of 2.
16
+ // So we check also for an empty text size.
17
+ const isEmptyTextBlock = !doc.textBetween(from, to).length && isTextSelection(state.selection);
18
+ // Don't show toolbar inside code blocks
19
+ if (selection.$from.parent.type.spec.code ||
20
+ (isNodeSelection(selection) && selection.node.type.spec.code)) {
21
+ return false;
22
+ }
23
+ // check view.hasFocus so that the toolbar doesn't show up when the editor is not focused or when for example a code block is focused
24
+ return !(!view.hasFocus() || empty || isEmptyTextBlock);
25
+ };
26
+ constructor(editor, pmView, emitUpdate) {
27
+ this.editor = editor;
28
+ this.pmView = pmView;
29
+ this.emitUpdate = () => {
30
+ if (!this.state) {
31
+ throw new Error("Attempting to update uninitialized formatting toolbar");
32
+ }
33
+ emitUpdate(this.state);
34
+ };
35
+ pmView.dom.addEventListener("mousedown", this.viewMousedownHandler);
36
+ pmView.dom.addEventListener("mouseup", this.viewMouseupHandler);
37
+ pmView.dom.addEventListener("dragstart", this.dragHandler);
38
+ pmView.dom.addEventListener("dragover", this.dragHandler);
39
+ pmView.dom.addEventListener("blur", this.blurHandler);
40
+ // Setting capture=true ensures that any parent container of the editor that
41
+ // gets scrolled will trigger the scroll event. Scroll events do not bubble
42
+ // and so won't propagate to the document by default.
43
+ pmView.root.addEventListener("scroll", this.scrollHandler, true);
44
+ }
45
+ blurHandler = (event) => {
46
+ if (this.preventHide) {
47
+ this.preventHide = false;
48
+ return;
49
+ }
50
+ const editorWrapper = this.pmView.dom.parentElement;
51
+ // Checks if the focus is moving to an element outside the editor. If it is,
52
+ // the toolbar is hidden.
53
+ if (
54
+ // An element is clicked.
55
+ event &&
56
+ event.relatedTarget &&
57
+ // Element is inside the editor.
58
+ (editorWrapper === event.relatedTarget ||
59
+ editorWrapper.contains(event.relatedTarget) ||
60
+ event.relatedTarget.matches(".bn-ui-container, .bn-ui-container *"))) {
61
+ return;
62
+ }
63
+ if (this.state?.show) {
64
+ this.state.show = false;
65
+ this.emitUpdate();
66
+ }
67
+ };
68
+ viewMousedownHandler = () => {
69
+ this.preventShow = true;
70
+ };
71
+ viewMouseupHandler = () => {
72
+ this.preventShow = false;
73
+ setTimeout(() => this.update(this.pmView));
74
+ };
75
+ // For dragging the whole editor.
76
+ dragHandler = () => {
77
+ if (this.state?.show) {
78
+ this.state.show = false;
79
+ this.emitUpdate();
80
+ }
81
+ };
82
+ scrollHandler = () => {
83
+ if (this.state?.show) {
84
+ this.state.referencePos = this.getSelectionBoundingBox();
85
+ this.emitUpdate();
86
+ }
87
+ };
88
+ update(view, oldState) {
89
+ // Delays the update to handle edge case with drag and drop, where the view
90
+ // is blurred asynchronously and happens only after the state update.
91
+ // Wrapping in a setTimeout gives enough time to wait for the blur event to
92
+ // occur before updating the toolbar.
93
+ const { state, composing } = view;
94
+ const { doc, selection } = state;
95
+ const isSame = oldState && oldState.doc.eq(doc) && oldState.selection.eq(selection);
96
+ if (composing || isSame) {
97
+ return;
98
+ }
99
+ // support for CellSelections
100
+ const { ranges } = selection;
101
+ const from = Math.min(...ranges.map((range) => range.$from.pos));
102
+ const to = Math.max(...ranges.map((range) => range.$to.pos));
103
+ const shouldShow = this.shouldShow?.({
104
+ view,
105
+ state,
106
+ from,
107
+ to,
108
+ });
109
+ // Checks if menu should be shown/updated.
110
+ if (!this.preventShow && (shouldShow || this.preventHide)) {
111
+ // Unlike other UI elements, we don't prevent the formatting toolbar from
112
+ // showing when the editor is not editable. This is because some buttons,
113
+ // e.g. the download file button, should still be accessible. Therefore,
114
+ // logic for hiding when the editor is non-editable is handled
115
+ // individually in each button.
116
+ this.state = {
117
+ show: true,
118
+ referencePos: this.getSelectionBoundingBox(),
119
+ };
120
+ this.emitUpdate();
121
+ return;
122
+ }
123
+ // Checks if menu should be hidden.
124
+ if (this.state?.show &&
125
+ !this.preventHide &&
126
+ (!shouldShow || this.preventShow || !this.editor.isEditable)) {
127
+ this.state.show = false;
128
+ this.emitUpdate();
129
+ return;
130
+ }
131
+ }
132
+ destroy() {
133
+ this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler);
134
+ this.pmView.dom.removeEventListener("mouseup", this.viewMouseupHandler);
135
+ this.pmView.dom.removeEventListener("dragstart", this.dragHandler);
136
+ this.pmView.dom.removeEventListener("dragover", this.dragHandler);
137
+ this.pmView.dom.removeEventListener("blur", this.blurHandler);
138
+ this.pmView.root.removeEventListener("scroll", this.scrollHandler, true);
139
+ }
140
+ closeMenu = () => {
141
+ if (this.state?.show) {
142
+ this.state.show = false;
143
+ this.emitUpdate();
144
+ }
145
+ };
146
+ getSelectionBoundingBox() {
147
+ const { state } = this.pmView;
148
+ const { selection } = state;
149
+ // support for CellSelections
150
+ const { ranges } = selection;
151
+ const from = Math.min(...ranges.map((range) => range.$from.pos));
152
+ const to = Math.max(...ranges.map((range) => range.$to.pos));
153
+ if (isNodeSelection(selection)) {
154
+ const node = this.pmView.nodeDOM(from);
155
+ if (node) {
156
+ return node.getBoundingClientRect();
157
+ }
158
+ }
159
+ return posToDOMRect(this.pmView, from, to);
160
+ }
161
+ }
162
+ export const formattingToolbarPluginKey = new PluginKey("FormattingToolbarPlugin");
163
+ export class FormattingToolbarProsemirrorPlugin extends EventEmitter {
164
+ view;
165
+ plugin;
166
+ constructor(editor) {
167
+ super();
168
+ this.plugin = new Plugin({
169
+ key: formattingToolbarPluginKey,
170
+ view: (editorView) => {
171
+ this.view = new FormattingToolbarView(editor, editorView, (state) => {
172
+ this.emit("update", state);
173
+ });
174
+ return this.view;
175
+ },
176
+ props: {
177
+ handleKeyDown: (_view, event) => {
178
+ if (event.key === "Escape" && this.shown) {
179
+ this.view.closeMenu();
180
+ return true;
181
+ }
182
+ return false;
183
+ },
184
+ },
185
+ });
186
+ }
187
+ get shown() {
188
+ return this.view?.state?.show || false;
189
+ }
190
+ onUpdate(callback) {
191
+ return this.on("update", callback);
192
+ }
193
+ closeMenu = () => this.view.closeMenu();
194
+ }
195
+ //# sourceMappingURL=FormattingToolbarPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormattingToolbarPlugin.js","sourceRoot":"","sources":["../../../../src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAe,MAAM,EAAE,SAAS,EAAc,MAAM,mBAAmB,CAAC;AAU/E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1D,MAAM,OAAO,qBAAqB;IAmCb;IAKA;IAvCZ,KAAK,CA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