@blocknote/core 0.37.0 → 0.39.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 (271) hide show
  1. package/dist/BlockNoteSchema-DmZ6UQfY.cjs +11 -0
  2. package/dist/BlockNoteSchema-DmZ6UQfY.cjs.map +1 -0
  3. package/dist/BlockNoteSchema-oR047ACf.js +4275 -0
  4. package/dist/BlockNoteSchema-oR047ACf.js.map +1 -0
  5. package/dist/blocknote.cjs +4 -12
  6. package/dist/blocknote.cjs.map +1 -1
  7. package/dist/blocknote.js +3311 -7230
  8. package/dist/blocknote.js.map +1 -1
  9. package/dist/blocks.cjs +2 -0
  10. package/dist/blocks.cjs.map +1 -0
  11. package/dist/blocks.js +71 -0
  12. package/dist/blocks.js.map +1 -0
  13. package/dist/{en-CvDoFvhc.js → en-Bq3Es3Np.js} +6 -12
  14. package/dist/en-Bq3Es3Np.js.map +1 -0
  15. package/dist/en-D3B48eJ7.cjs +2 -0
  16. package/dist/en-D3B48eJ7.cjs.map +1 -0
  17. package/dist/locales.cjs +1 -1
  18. package/dist/locales.cjs.map +1 -1
  19. package/dist/locales.js +109 -229
  20. package/dist/locales.js.map +1 -1
  21. package/dist/style.css +1 -1
  22. package/dist/tsconfig.tsbuildinfo +1 -0
  23. package/dist/webpack-stats.json +1 -1
  24. package/package.json +25 -22
  25. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +1 -1
  26. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +2 -2
  27. package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +34 -25
  28. package/src/api/blockManipulation/setupTestEnv.ts +0 -1
  29. package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +4 -8
  30. package/src/api/clipboard/toClipboard/copyExtension.ts +1 -3
  31. package/src/api/exporters/html/externalHTMLExporter.ts +0 -1
  32. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +128 -28
  33. package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +101 -41
  34. package/src/api/exporters/markdown/markdownExporter.ts +13 -22
  35. package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +2 -12
  36. package/src/api/parsers/html/parseHTML.ts +3 -2
  37. package/src/api/parsers/html/util/nestedLists.test.ts +8 -8
  38. package/src/api/parsers/markdown/parseMarkdown.ts +17 -14
  39. package/src/api/pmUtil.ts +1 -1
  40. package/src/api/positionMapping.test.ts +197 -33
  41. package/src/api/positionMapping.ts +4 -6
  42. package/src/blocks/Audio/block.ts +174 -0
  43. package/src/blocks/BlockNoteSchema.ts +59 -0
  44. package/src/blocks/Code/block.ts +303 -0
  45. package/src/blocks/Code/shiki.ts +73 -0
  46. package/src/blocks/File/block.ts +98 -0
  47. package/src/blocks/{FileBlockContent → File}/helpers/render/createAddFileButton.ts +8 -4
  48. package/src/blocks/{FileBlockContent → File}/helpers/render/createFileBlockWrapper.ts +16 -13
  49. package/src/blocks/{FileBlockContent → File}/helpers/render/createFileNameWithIcon.ts +15 -2
  50. package/src/blocks/{FileBlockContent → File}/helpers/render/createResizableFileBlockWrapper.ts +63 -19
  51. package/src/blocks/Heading/block.ts +138 -0
  52. package/src/blocks/Image/block.ts +190 -0
  53. package/src/blocks/ListItem/BulletListItem/block.ts +116 -0
  54. package/src/blocks/ListItem/CheckListItem/block.ts +175 -0
  55. package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts +173 -0
  56. package/src/blocks/ListItem/NumberedListItem/block.ts +133 -0
  57. package/src/blocks/ListItem/ToggleListItem/block.ts +78 -0
  58. package/src/blocks/PageBreak/block.ts +72 -0
  59. package/src/blocks/{PageBreakBlockContent → PageBreak}/getPageBreakSlashMenuItems.ts +9 -7
  60. package/src/blocks/Paragraph/block.ts +80 -0
  61. package/src/blocks/Quote/block.ts +90 -0
  62. package/src/blocks/{TableBlockContent/TableBlockContent.ts → Table/block.ts} +169 -51
  63. package/src/blocks/ToggleWrapper/createToggleWrapper.ts +1 -1
  64. package/src/blocks/Video/block.ts +143 -0
  65. package/src/blocks/defaultBlockHelpers.ts +2 -2
  66. package/src/blocks/defaultBlockTypeGuards.ts +143 -174
  67. package/src/blocks/defaultBlocks.ts +107 -35
  68. package/src/blocks/defaultProps.ts +145 -4
  69. package/src/blocks/index.ts +26 -0
  70. package/src/blocks/utils/listItemEnterHandler.ts +42 -0
  71. package/src/editor/Block.css +54 -18
  72. package/src/editor/BlockNoteEditor.ts +265 -230
  73. package/src/editor/BlockNoteExtension.ts +92 -0
  74. package/src/editor/BlockNoteExtensions.ts +20 -16
  75. package/src/editor/defaultColors.ts +2 -2
  76. package/src/exporter/Exporter.ts +1 -1
  77. package/src/exporter/mapping.ts +1 -1
  78. package/src/extensions/BackgroundColor/BackgroundColorExtension.ts +3 -20
  79. package/src/extensions/BackgroundColor/BackgroundColorMark.ts +6 -8
  80. package/src/extensions/BlockChange/BlockChangePlugin.ts +2 -1
  81. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor-forked.json +2 -2
  82. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor.json +2 -2
  83. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-forked.html +1 -1
  84. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap.html +1 -1
  85. package/src/extensions/Collaboration/schemaMigration/SchemaMigrationPlugin.ts +52 -0
  86. package/src/extensions/Collaboration/schemaMigration/migrationRules/index.ts +4 -0
  87. package/src/extensions/Collaboration/schemaMigration/migrationRules/migrationRule.ts +4 -0
  88. package/src/extensions/Collaboration/schemaMigration/migrationRules/moveColorAttributes.ts +78 -0
  89. package/src/extensions/Comments/CommentsPlugin.ts +2 -0
  90. package/src/extensions/FilePanel/FilePanelPlugin.ts +5 -10
  91. package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +1 -1
  92. package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +4 -3
  93. package/src/extensions/Placeholder/PlaceholderPlugin.ts +2 -2
  94. package/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts +1 -23
  95. package/src/extensions/SideMenu/SideMenuPlugin.ts +0 -2
  96. package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +0 -5
  97. package/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts +6 -2
  98. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +24 -17
  99. package/src/extensions/TableHandles/TableHandlesPlugin.ts +2 -2
  100. package/src/extensions/TextAlignment/TextAlignmentExtension.ts +5 -11
  101. package/src/extensions/TextColor/TextColorExtension.ts +3 -17
  102. package/src/extensions/TextColor/TextColorMark.ts +4 -9
  103. package/src/extensions/UniqueID/UniqueID.ts +6 -13
  104. package/src/i18n/locales/ar.ts +6 -12
  105. package/src/i18n/locales/de.ts +6 -12
  106. package/src/i18n/locales/en.ts +6 -12
  107. package/src/i18n/locales/es.ts +6 -12
  108. package/src/i18n/locales/fr.ts +6 -12
  109. package/src/i18n/locales/he.ts +6 -12
  110. package/src/i18n/locales/hr.ts +6 -12
  111. package/src/i18n/locales/is.ts +6 -12
  112. package/src/i18n/locales/it.ts +6 -12
  113. package/src/i18n/locales/ja.ts +6 -12
  114. package/src/i18n/locales/ko.ts +6 -12
  115. package/src/i18n/locales/nl.ts +6 -12
  116. package/src/i18n/locales/no.ts +6 -12
  117. package/src/i18n/locales/pl.ts +6 -12
  118. package/src/i18n/locales/pt.ts +6 -12
  119. package/src/i18n/locales/ru.ts +6 -12
  120. package/src/i18n/locales/sk.ts +6 -12
  121. package/src/i18n/locales/uk.ts +6 -12
  122. package/src/i18n/locales/vi.ts +6 -12
  123. package/src/i18n/locales/zh-tw.ts +6 -12
  124. package/src/i18n/locales/zh.ts +6 -12
  125. package/src/index.ts +2 -29
  126. package/src/schema/blocks/createSpec.ts +342 -169
  127. package/src/schema/blocks/internal.ts +77 -138
  128. package/src/schema/blocks/types.ts +264 -94
  129. package/src/schema/index.ts +1 -0
  130. package/src/schema/inlineContent/createSpec.ts +99 -21
  131. package/src/schema/inlineContent/internal.ts +16 -7
  132. package/src/schema/inlineContent/types.ts +24 -2
  133. package/src/schema/propTypes.ts +15 -9
  134. package/src/schema/schema.ts +209 -0
  135. package/src/schema/styles/createSpec.ts +79 -31
  136. package/src/schema/styles/internal.ts +61 -2
  137. package/src/schema/styles/types.ts +17 -3
  138. package/src/util/topo-sort.test.ts +125 -0
  139. package/src/util/topo-sort.ts +160 -0
  140. package/types/src/api/blockManipulation/commands/splitBlock/splitBlock.d.ts +2 -1
  141. package/types/src/api/blockManipulation/selections/selection.d.ts +1 -1
  142. package/types/src/api/blockManipulation/setupTestEnv.d.ts +29 -543
  143. package/types/src/api/exporters/html/util/serializeBlocksExternalHTML.d.ts +1 -1
  144. package/types/src/api/exporters/html/util/serializeBlocksInternalHTML.d.ts +1 -1
  145. package/types/src/api/exporters/markdown/markdownExporter.d.ts +1 -1
  146. package/types/src/api/parsers/html/parseHTML.d.ts +1 -1
  147. package/types/src/api/parsers/markdown/parseMarkdown.d.ts +2 -2
  148. package/types/src/api/pmUtil.d.ts +1 -1
  149. package/types/src/blocks/Audio/block.d.ts +58 -0
  150. package/types/src/blocks/BlockNoteSchema.d.ts +18 -0
  151. package/types/src/blocks/{CodeBlockContent/CodeBlockContent.d.ts → Code/block.d.ts} +25 -26
  152. package/types/src/blocks/Code/shiki.d.ts +4 -0
  153. package/types/src/blocks/File/block.d.ts +37 -0
  154. package/types/src/blocks/File/helpers/render/createAddFileButton.d.ts +6 -0
  155. package/types/src/blocks/File/helpers/render/createFileBlockWrapper.d.ts +25 -0
  156. package/types/src/blocks/{FileBlockContent → File}/helpers/render/createFileNameWithIcon.d.ts +6 -2
  157. package/types/src/blocks/File/helpers/render/createResizableFileBlockWrapper.d.ts +31 -0
  158. package/types/src/blocks/Heading/block.d.ts +71 -0
  159. package/types/src/blocks/Image/block.d.ts +102 -0
  160. package/types/src/blocks/ListItem/BulletListItem/block.d.ts +25 -0
  161. package/types/src/blocks/ListItem/CheckListItem/block.d.ts +33 -0
  162. package/types/src/blocks/ListItem/NumberedListItem/IndexingPlugin.d.ts +8 -0
  163. package/types/src/blocks/ListItem/NumberedListItem/block.d.ts +33 -0
  164. package/types/src/blocks/ListItem/ToggleListItem/block.d.ts +25 -0
  165. package/types/src/blocks/PageBreak/block.d.ts +11 -0
  166. package/types/src/blocks/{PageBreakBlockContent → PageBreak}/getPageBreakSlashMenuItems.d.ts +4 -2
  167. package/types/src/blocks/Paragraph/block.d.ts +25 -0
  168. package/types/src/blocks/Quote/block.d.ts +17 -0
  169. package/types/src/blocks/Table/block.d.ts +21 -0
  170. package/types/src/blocks/Video/block.d.ts +67 -0
  171. package/types/src/blocks/defaultBlockHelpers.d.ts +1 -1
  172. package/types/src/blocks/defaultBlockTypeGuards.d.ts +15 -36
  173. package/types/src/blocks/defaultBlocks.d.ts +221 -1060
  174. package/types/src/blocks/defaultProps.d.ts +17 -1
  175. package/types/src/blocks/index.d.ts +24 -0
  176. package/types/src/blocks/utils/listItemEnterHandler.d.ts +2 -0
  177. package/types/src/editor/BlockNoteEditor.d.ts +39 -75
  178. package/types/src/editor/BlockNoteExtension.d.ts +67 -0
  179. package/types/src/editor/BlockNoteExtensions.d.ts +2 -0
  180. package/types/src/editor/defaultColors.d.ts +8 -76
  181. package/types/src/exporter/Exporter.d.ts +1 -1
  182. package/types/src/exporter/mapping.d.ts +1 -1
  183. package/types/src/extensions/BackgroundColor/BackgroundColorMark.d.ts +4 -1
  184. package/types/src/extensions/Collaboration/schemaMigration/SchemaMigrationPlugin.d.ts +7 -0
  185. package/types/src/extensions/Collaboration/schemaMigration/migrationRules/index.d.ts +3 -0
  186. package/types/src/extensions/Collaboration/schemaMigration/migrationRules/migrationRule.d.ts +3 -0
  187. package/types/src/extensions/Collaboration/schemaMigration/migrationRules/moveColorAttributes.d.ts +2 -0
  188. package/types/src/extensions/Comments/CommentsPlugin.d.ts +3 -1
  189. package/types/src/extensions/FilePanel/FilePanelPlugin.d.ts +4 -4
  190. package/types/src/extensions/TextColor/TextColorMark.d.ts +4 -1
  191. package/types/src/i18n/locales/en.d.ts +1 -12
  192. package/types/src/i18n/locales/sk.d.ts +1 -12
  193. package/types/src/index.d.ts +2 -26
  194. package/types/src/schema/blocks/createSpec.d.ts +16 -36
  195. package/types/src/schema/blocks/internal.d.ts +11 -33
  196. package/types/src/schema/blocks/types.d.ts +181 -57
  197. package/types/src/schema/index.d.ts +1 -0
  198. package/types/src/schema/inlineContent/createSpec.d.ts +36 -2
  199. package/types/src/schema/inlineContent/internal.d.ts +7 -15
  200. package/types/src/schema/inlineContent/types.d.ts +15 -1
  201. package/types/src/schema/propTypes.d.ts +4 -4
  202. package/types/src/schema/schema.d.ts +40 -0
  203. package/types/src/schema/styles/createSpec.d.ts +6 -4
  204. package/types/src/schema/styles/internal.d.ts +6 -3
  205. package/types/src/schema/styles/types.d.ts +11 -2
  206. package/types/src/util/topo-sort.d.ts +18 -0
  207. package/types/src/util/topo-sort.test.d.ts +1 -0
  208. package/dist/en-CvDoFvhc.js.map +0 -1
  209. package/dist/en-ub2yVBX0.cjs +0 -2
  210. package/dist/en-ub2yVBX0.cjs.map +0 -1
  211. package/src/blocks/AudioBlockContent/AudioBlockContent.ts +0 -145
  212. package/src/blocks/CodeBlockContent/CodeBlockContent.ts +0 -445
  213. package/src/blocks/FileBlockContent/FileBlockContent.ts +0 -100
  214. package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +0 -159
  215. package/src/blocks/ImageBlockContent/ImageBlockContent.ts +0 -160
  216. package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +0 -134
  217. package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +0 -299
  218. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +0 -86
  219. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +0 -172
  220. package/src/blocks/ListItemBlockContent/ToggleListItemBlockContent/ToggleListItemBlockContent.ts +0 -104
  221. package/src/blocks/PageBreakBlockContent/PageBreakBlockContent.ts +0 -49
  222. package/src/blocks/PageBreakBlockContent/schema.ts +0 -40
  223. package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +0 -78
  224. package/src/blocks/QuoteBlockContent/QuoteBlockContent.ts +0 -121
  225. package/src/blocks/VideoBlockContent/VideoBlockContent.ts +0 -159
  226. package/src/editor/BlockNoteSchema.ts +0 -107
  227. package/src/editor/BlockNoteTipTapEditor.ts +0 -335
  228. package/src/util/esmDependencies.ts +0 -51
  229. package/types/src/blocks/AudioBlockContent/AudioBlockContent.d.ts +0 -99
  230. package/types/src/blocks/FileBlockContent/FileBlockContent.d.ts +0 -90
  231. package/types/src/blocks/FileBlockContent/helpers/render/createAddFileButton.d.ts +0 -6
  232. package/types/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.d.ts +0 -9
  233. package/types/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.d.ts +0 -9
  234. package/types/src/blocks/HeadingBlockContent/HeadingBlockContent.d.ts +0 -67
  235. package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +0 -131
  236. package/types/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.d.ts +0 -46
  237. package/types/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.d.ts +0 -55
  238. package/types/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.d.ts +0 -2
  239. package/types/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.d.ts +0 -58
  240. package/types/src/blocks/ListItemBlockContent/ToggleListItemBlockContent/ToggleListItemBlockContent.d.ts +0 -46
  241. package/types/src/blocks/PageBreakBlockContent/PageBreakBlockContent.d.ts +0 -31
  242. package/types/src/blocks/PageBreakBlockContent/schema.d.ts +0 -86
  243. package/types/src/blocks/ParagraphBlockContent/ParagraphBlockContent.d.ts +0 -52
  244. package/types/src/blocks/QuoteBlockContent/QuoteBlockContent.d.ts +0 -52
  245. package/types/src/blocks/TableBlockContent/TableBlockContent.d.ts +0 -39
  246. package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +0 -131
  247. package/types/src/editor/BlockNoteSchema.d.ts +0 -34
  248. package/types/src/editor/BlockNoteTipTapEditor.d.ts +0 -43
  249. package/types/src/util/esmDependencies.d.ts +0 -24
  250. /package/src/blocks/{AudioBlockContent → Audio}/parseAudioElement.ts +0 -0
  251. /package/src/blocks/{FileBlockContent → File}/helpers/parse/parseEmbedElement.ts +0 -0
  252. /package/src/blocks/{FileBlockContent → File}/helpers/parse/parseFigureElement.ts +0 -0
  253. /package/src/blocks/{FileBlockContent → File}/helpers/toExternalHTML/createFigureWithCaption.ts +0 -0
  254. /package/src/blocks/{FileBlockContent → File}/helpers/toExternalHTML/createLinkWithCaption.ts +0 -0
  255. /package/src/blocks/{FileBlockContent → File/helpers}/uploadToTmpFilesDotOrg_DEV_ONLY.ts +0 -0
  256. /package/src/blocks/{ImageBlockContent → Image}/parseImageElement.ts +0 -0
  257. /package/src/blocks/{ListItemBlockContent → ListItem}/ListItemKeyboardShortcuts.ts +0 -0
  258. /package/src/blocks/{ListItemBlockContent → ListItem}/getListItemContent.ts +0 -0
  259. /package/src/blocks/{TableBlockContent → Table}/TableExtension.ts +0 -0
  260. /package/src/blocks/{VideoBlockContent → Video}/parseVideoElement.ts +0 -0
  261. /package/types/src/blocks/{AudioBlockContent → Audio}/parseAudioElement.d.ts +0 -0
  262. /package/types/src/blocks/{FileBlockContent → File}/helpers/parse/parseEmbedElement.d.ts +0 -0
  263. /package/types/src/blocks/{FileBlockContent → File}/helpers/parse/parseFigureElement.d.ts +0 -0
  264. /package/types/src/blocks/{FileBlockContent → File}/helpers/toExternalHTML/createFigureWithCaption.d.ts +0 -0
  265. /package/types/src/blocks/{FileBlockContent → File}/helpers/toExternalHTML/createLinkWithCaption.d.ts +0 -0
  266. /package/types/src/blocks/{FileBlockContent → File/helpers}/uploadToTmpFilesDotOrg_DEV_ONLY.d.ts +0 -0
  267. /package/types/src/blocks/{ImageBlockContent → Image}/parseImageElement.d.ts +0 -0
  268. /package/types/src/blocks/{ListItemBlockContent → ListItem}/ListItemKeyboardShortcuts.d.ts +0 -0
  269. /package/types/src/blocks/{ListItemBlockContent → ListItem}/getListItemContent.d.ts +0 -0
  270. /package/types/src/blocks/{TableBlockContent → Table}/TableExtension.d.ts +0 -0
  271. /package/types/src/blocks/{VideoBlockContent → Video}/parseVideoElement.d.ts +0 -0
@@ -1,3 +1,4 @@
1
+ import { Attribute } from "@tiptap/core";
1
2
  import type { Props } from "../schema/index.js";
2
3
  export declare const defaultProps: {
3
4
  backgroundColor: {
@@ -12,4 +13,19 @@ export declare const defaultProps: {
12
13
  };
13
14
  };
14
15
  export type DefaultProps = Props<typeof defaultProps>;
15
- export declare const inheritedProps: string[];
16
+ export declare const parseDefaultProps: (element: HTMLElement) => Partial<Props<{
17
+ backgroundColor: {
18
+ default: "default";
19
+ };
20
+ textColor: {
21
+ default: "default";
22
+ };
23
+ textAlignment: {
24
+ default: "left";
25
+ values: readonly ["left", "center", "right", "justify"];
26
+ };
27
+ }>>;
28
+ export declare const addDefaultPropsExternalHTML: (props: Partial<DefaultProps>, element: HTMLElement) => void;
29
+ export declare const getBackgroundColorAttribute: (attributeName?: string) => Attribute;
30
+ export declare const getTextColorAttribute: (attributeName?: string) => Attribute;
31
+ export declare const getTextAlignmentAttribute: (attributeName?: string) => Attribute;
@@ -0,0 +1,24 @@
1
+ export * from "./Audio/block.js";
2
+ export * from "./Audio/parseAudioElement.js";
3
+ export * from "./Code/block.js";
4
+ export * from "./File/block.js";
5
+ export * from "./Heading/block.js";
6
+ export * from "./Image/block.js";
7
+ export * from "./ListItem/BulletListItem/block.js";
8
+ export * from "./ListItem/CheckListItem/block.js";
9
+ export * from "./ListItem/NumberedListItem/block.js";
10
+ export * from "./ListItem/ToggleListItem/block.js";
11
+ export * from "./PageBreak/block.js";
12
+ export * from "./Paragraph/block.js";
13
+ export * from "./Quote/block.js";
14
+ export * from "./Table/block.js";
15
+ export * from "./Video/block.js";
16
+ export { EMPTY_CELL_HEIGHT, EMPTY_CELL_WIDTH } from "./Table/TableExtension.js";
17
+ export * from "./ToggleWrapper/createToggleWrapper.js";
18
+ export * from "./File/helpers/uploadToTmpFilesDotOrg_DEV_ONLY.js";
19
+ export * from "./PageBreak/getPageBreakSlashMenuItems.js";
20
+ export * from "./BlockNoteSchema.js";
21
+ export * from "./defaultBlockHelpers.js";
22
+ export * from "./defaultBlocks.js";
23
+ export * from "./defaultBlockTypeGuards.js";
24
+ export * from "./defaultProps.js";
@@ -0,0 +1,2 @@
1
+ import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
2
+ export declare const handleEnter: (editor: BlockNoteEditor<any, any, any>, listItemType: string) => boolean;
@@ -1,7 +1,10 @@
1
- import { AnyExtension, EditorOptions } from "@tiptap/core";
1
+ import { AnyExtension, EditorOptions, Editor as TiptapEditor } from "@tiptap/core";
2
+ import { type Command, type Plugin, type Transaction } from "@tiptap/pm/state";
2
3
  import { Node, Schema } from "prosemirror-model";
3
4
  import * as Y from "yjs";
4
- import { Block, DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema, PartialBlock } from "../blocks/defaultBlocks.js";
5
+ import { BlocksChanged } from "../api/getBlocksChangedByTransaction.js";
6
+ import type { ThreadStore, User } from "../comments/index.js";
7
+ import type { ForkYDocPlugin } from "../extensions/Collaboration/ForkYDocPlugin.js";
5
8
  import type { CommentsPlugin } from "../extensions/Comments/CommentsPlugin.js";
6
9
  import { FilePanelProsemirrorPlugin } from "../extensions/FilePanel/FilePanelPlugin.js";
7
10
  import { FormattingToolbarProsemirrorPlugin } from "../extensions/FormattingToolbar/FormattingToolbarPlugin.js";
@@ -9,21 +12,15 @@ import { LinkToolbarProsemirrorPlugin } from "../extensions/LinkToolbar/LinkTool
9
12
  import { SideMenuProsemirrorPlugin } from "../extensions/SideMenu/SideMenuPlugin.js";
10
13
  import { SuggestionMenuProseMirrorPlugin } from "../extensions/SuggestionMenu/SuggestionPlugin.js";
11
14
  import { TableHandlesProsemirrorPlugin } from "../extensions/TableHandles/TableHandlesPlugin.js";
12
- import { BlockIdentifier, BlockNoteDOMAttributes, BlockSchema, BlockSpecs, InlineContentSchema, InlineContentSpecs, PartialInlineContent, Styles, StyleSchema, StyleSpecs } from "../schema/index.js";
13
- import { NoInfer } from "../util/typescript.js";
14
- import { TextCursorPosition } from "./cursorPositionTypes.js";
15
- import { Selection } from "./selectionTypes.js";
16
- import { BlockNoteSchema } from "./BlockNoteSchema.js";
17
- import { BlockNoteTipTapEditor } from "./BlockNoteTipTapEditor.js";
18
15
  import { Dictionary } from "../i18n/dictionary.js";
19
- import { type Command, type Plugin, type Transaction } from "@tiptap/pm/state";
20
- import { EditorView } from "prosemirror-view";
21
- import { BlocksChanged } from "../api/getBlocksChangedByTransaction.js";
22
- import { CodeBlockOptions } from "../blocks/CodeBlockContent/CodeBlockContent.js";
23
- import type { ThreadStore, User } from "../comments/index.js";
24
- import type { ForkYDocPlugin } from "../extensions/Collaboration/ForkYDocPlugin.js";
16
+ import { BlockIdentifier, BlockNoteDOMAttributes, BlockSchema, BlockSpecs, CustomBlockNoteSchema, InlineContentSchema, InlineContentSpecs, PartialInlineContent, Styles, StyleSchema, StyleSpecs } from "../schema/index.js";
17
+ import "../style.css";
25
18
  import { EventEmitter } from "../util/EventEmitter.js";
19
+ import { NoInfer } from "../util/typescript.js";
26
20
  import { BlockNoteExtension } from "./BlockNoteExtension.js";
21
+ import { TextCursorPosition } from "./cursorPositionTypes.js";
22
+ import { Selection } from "./selectionTypes.js";
23
+ import { Block, BlockNoteSchema, DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema, PartialBlock } from "../blocks/index.js";
27
24
  import "../style.css";
28
25
  /**
29
26
  * A factory function that returns a BlockNoteExtension
@@ -77,10 +74,6 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
77
74
  */
78
75
  showCursorLabels?: "always" | "activity";
79
76
  };
80
- /**
81
- * Options for code blocks.
82
- */
83
- codeBlock?: CodeBlockOptions;
84
77
  /**
85
78
  * Configuration for the comments feature, requires a `threadStore`.
86
79
  *
@@ -88,6 +81,7 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
88
81
  * @remarks `CommentsOptions`
89
82
  */
90
83
  comments?: {
84
+ schema?: BlockNoteSchema<any, any, any>;
91
85
  threadStore: ThreadStore;
92
86
  };
93
87
  /**
@@ -129,17 +123,6 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
129
123
  width?: number;
130
124
  class?: string;
131
125
  }) => Plugin;
132
- /**
133
- * Configuration for headings
134
- */
135
- heading?: {
136
- /**
137
- * The levels of headings that should be available in the editor.
138
- * @note Configurable up to 6 levels of headings.
139
- * @default [1, 2, 3]
140
- */
141
- levels?: (1 | 2 | 3 | 4 | 5 | 6)[];
142
- };
143
126
  /**
144
127
  * The content that should be in the editor when it's created, represented as an array of {@link PartialBlock} objects.
145
128
  *
@@ -170,7 +153,7 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
170
153
  */
171
154
  pasteHandler?: (context: {
172
155
  event: ClipboardEvent;
173
- editor: BlockNoteEditor<BSchema, ISchema, SSchema>;
156
+ editor: BlockNoteEditor<NoInfer<BSchema>, NoInfer<ISchema>, NoInfer<SSchema>>;
174
157
  /**
175
158
  * The default paste handler
176
159
  * @param context The context object
@@ -207,7 +190,7 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
207
190
  * See [Custom Schemas](https://www.blocknotejs.org/docs/custom-schemas) for more info.
208
191
  * @remarks `BlockNoteSchema`
209
192
  */
210
- schema: BlockNoteSchema<BSchema, ISchema, SSchema>;
193
+ schema: CustomBlockNoteSchema<BSchema, ISchema, SSchema>;
211
194
  /**
212
195
  * A flag indicating whether to set an HTML ID for every block
213
196
  *
@@ -298,20 +281,11 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
298
281
  * @internal
299
282
  */
300
283
  extensions?: Array<BlockNoteExtension | BlockNoteExtensionFactory>;
301
- /**
302
- * Boolean indicating whether the editor is in headless mode.
303
- * Headless mode means we can use features like importing / exporting blocks,
304
- * but there's no underlying editor (UI) instantiated.
305
- *
306
- * You probably don't need to set this manually, but use the `server-util` package instead that uses this option internally
307
- * @internal
308
- */
309
- _headless?: boolean;
310
284
  };
311
285
  export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockSchema, ISchema extends InlineContentSchema = DefaultInlineContentSchema, SSchema extends StyleSchema = DefaultStyleSchema> extends EventEmitter<{
312
286
  create: void;
313
287
  }> {
314
- protected readonly options: Partial<BlockNoteEditorOptions<any, any, any>>;
288
+ protected readonly options: Partial<BlockNoteEditorOptions<BSchema, ISchema, SSchema>>;
315
289
  /**
316
290
  * The underlying prosemirror schema
317
291
  */
@@ -320,16 +294,7 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
320
294
  * extensions that are added to the editor, can be tiptap extensions or prosemirror plugins
321
295
  */
322
296
  extensions: Record<string, SupportedExtension>;
323
- /**
324
- * Boolean indicating whether the editor is in headless mode.
325
- * Headless mode means we can use features like importing / exporting blocks,
326
- * but there's no underlying editor (UI) instantiated.
327
- *
328
- * You probably don't need to set this manually, but use the `server-util` package instead that uses this option internally
329
- */
330
- readonly headless: boolean;
331
- readonly _tiptapEditor: Omit<BlockNoteTipTapEditor, "view"> & {
332
- view: EditorView | undefined;
297
+ readonly _tiptapEditor: TiptapEditor & {
333
298
  contentComponent: any;
334
299
  };
335
300
  /**
@@ -350,7 +315,7 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
350
315
  /**
351
316
  * The schema of the editor. The schema defines which Blocks, InlineContent, and Styles are available in the editor.
352
317
  */
353
- readonly schema: BlockNoteSchema<BSchema, ISchema, SSchema>;
318
+ readonly schema: CustomBlockNoteSchema<BSchema, ISchema, SSchema>;
354
319
  readonly blockImplementations: BlockSpecs;
355
320
  readonly inlineContentImplementations: InlineContentSpecs;
356
321
  readonly styleImplementations: StyleSpecs;
@@ -390,13 +355,11 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
390
355
  cellTextColor: boolean;
391
356
  headers: boolean;
392
357
  };
393
- codeBlock: CodeBlockOptions;
394
- heading: {
395
- levels: (1 | 2 | 3 | 4 | 5 | 6)[];
396
- };
397
358
  };
398
- static create<BSchema extends BlockSchema = DefaultBlockSchema, ISchema extends InlineContentSchema = DefaultInlineContentSchema, SSchema extends StyleSchema = DefaultStyleSchema>(options?: Partial<BlockNoteEditorOptions<BSchema, ISchema, SSchema>>): BlockNoteEditor<BSchema, ISchema, SSchema>;
399
- protected constructor(options: Partial<BlockNoteEditorOptions<any, any, any>>);
359
+ static create<Options extends Partial<BlockNoteEditorOptions<any, any, any>> | undefined>(options?: Options): Options extends {
360
+ schema: CustomBlockNoteSchema<infer BSchema, infer ISchema, infer SSchema>;
361
+ } ? BlockNoteEditor<BSchema, ISchema, SSchema> : BlockNoteEditor<DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema>;
362
+ protected constructor(options: Partial<BlockNoteEditorOptions<BSchema, ISchema, SSchema>>);
400
363
  /**
401
364
  * Stores the currently active transaction, which is the accumulated transaction from all {@link dispatch} calls during a {@link transact} calls
402
365
  */
@@ -464,11 +427,15 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
464
427
  new (...args: any[]): T;
465
428
  } & typeof BlockNoteExtension, key?: string): T;
466
429
  /**
467
- * Mount the editor to a parent DOM element. Call mount(undefined) to clean up
430
+ * Mount the editor to a DOM element.
468
431
  *
469
432
  * @warning Not needed to call manually when using React, use BlockNoteView to take care of mounting
470
433
  */
471
- mount: (parentElement?: HTMLElement | null, contentComponent?: any) => void;
434
+ mount: (element: HTMLElement) => void;
435
+ /**
436
+ * Unmount the editor from the DOM element it is bound to
437
+ */
438
+ unmount: () => void;
472
439
  /**
473
440
  * Get the underlying prosemirror state
474
441
  * @note Prefer using `editor.transact` to read the current editor state, as that will ensure the state is up to date
@@ -479,9 +446,10 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
479
446
  * Get the underlying prosemirror view
480
447
  * @see https://prosemirror.net/docs/ref/#view.EditorView
481
448
  */
482
- get prosemirrorView(): EditorView | undefined;
449
+ get prosemirrorView(): import("prosemirror-view").EditorView;
483
450
  get domElement(): HTMLDivElement | undefined;
484
451
  isFocused(): boolean;
452
+ get headless(): boolean;
485
453
  focus(): void;
486
454
  onUploadStart(callback: (blockId?: string) => void): () => void;
487
455
  onUploadEnd(callback: (blockId?: string) => void): () => void;
@@ -576,7 +544,7 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
576
544
  * only the part of the block that is included in the selection.
577
545
  */
578
546
  getSelectionCutBlocks(): {
579
- blocks: Block<Record<string, import("../index.js").BlockConfig>, InlineContentSchema, StyleSchema>[];
547
+ blocks: Block<Record<string, import("../index.js").BlockConfig<string, import("../index.js").PropSchema, "inline" | "none" | "table">>, InlineContentSchema, StyleSchema>[];
580
548
  blockCutAtStart: string | undefined;
581
549
  blockCutAtEnd: string | undefined;
582
550
  _meta: {
@@ -621,7 +589,7 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
621
589
  * Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
622
590
  * @param blocksToRemove An array of identifiers for existing blocks that should be removed.
623
591
  */
624
- removeBlocks(blocksToRemove: BlockIdentifier[]): Block<Record<string, import("../index.js").BlockConfig>, InlineContentSchema, StyleSchema>[];
592
+ removeBlocks(blocksToRemove: BlockIdentifier[]): Block<Record<string, import("../index.js").BlockConfig<string, import("../index.js").PropSchema, "inline" | "none" | "table">>, InlineContentSchema, StyleSchema>[];
625
593
  /**
626
594
  * Replaces existing blocks in the editor with new blocks. If the blocks that should be removed are not adjacent or
627
595
  * are at different nesting levels, `blocksToInsert` will be inserted at the position of the first block in
@@ -717,7 +685,7 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
717
685
  * @param blocks An array of blocks that should be serialized into HTML.
718
686
  * @returns The blocks, serialized as an HTML string.
719
687
  */
720
- blocksToHTMLLossy(blocks?: PartialBlock<BSchema, ISchema, SSchema>[]): Promise<string>;
688
+ blocksToHTMLLossy(blocks?: PartialBlock<BSchema, ISchema, SSchema>[]): string;
721
689
  /**
722
690
  * Serializes blocks into an HTML string in the format that would normally be rendered by the editor.
723
691
  *
@@ -727,7 +695,7 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
727
695
  * @param blocks An array of blocks that should be serialized into HTML.
728
696
  * @returns The blocks, serialized as an HTML string.
729
697
  */
730
- blocksToFullHTML(blocks: PartialBlock<BSchema, ISchema, SSchema>[]): Promise<string>;
698
+ blocksToFullHTML(blocks: PartialBlock<BSchema, ISchema, SSchema>[]): string;
731
699
  /**
732
700
  * Parses blocks from an HTML string. Tries to create `Block` objects out of any HTML block-level elements, and
733
701
  * `InlineNode` objects from any HTML inline elements, though not all element types are recognized. If BlockNote
@@ -735,14 +703,14 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
735
703
  * @param html The HTML string to parse blocks from.
736
704
  * @returns The blocks parsed from the HTML string.
737
705
  */
738
- tryParseHTMLToBlocks(html: string): Promise<Block<BSchema, ISchema, SSchema>[]>;
706
+ tryParseHTMLToBlocks(html: string): Block<BSchema, ISchema, SSchema>[];
739
707
  /**
740
708
  * Serializes blocks into a Markdown string. The output is simplified as Markdown does not support all features of
741
709
  * BlockNote - children of blocks which aren't list items are un-nested and certain styles are removed.
742
710
  * @param blocks An array of blocks that should be serialized into Markdown.
743
711
  * @returns The blocks, serialized as a Markdown string.
744
712
  */
745
- blocksToMarkdownLossy(blocks?: PartialBlock<BSchema, ISchema, SSchema>[]): Promise<string>;
713
+ blocksToMarkdownLossy(blocks?: PartialBlock<BSchema, ISchema, SSchema>[]): string;
746
714
  /**
747
715
  * Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on
748
716
  * Markdown syntax, though not all symbols are recognized. If BlockNote doesn't recognize a symbol, it will parse it
@@ -780,14 +748,14 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
780
748
  * Returns the blocks that were inserted, updated, or deleted by the change that occurred.
781
749
  */
782
750
  getChanges(): BlocksChanged<BSchema, ISchema, SSchema>;
783
- }) => void): (() => void) | undefined;
751
+ }) => void): () => void;
784
752
  /**
785
753
  * A callback function that runs whenever the text cursor position or selection changes.
786
754
  *
787
755
  * @param callback The callback to execute.
788
756
  * @returns A function to remove the callback.
789
757
  */
790
- onSelectionChange(callback: (editor: BlockNoteEditor<BSchema, ISchema, SSchema>) => void, includeSelectionChangedByRemote?: boolean): (() => void) | undefined;
758
+ onSelectionChange(callback: (editor: BlockNoteEditor<BSchema, ISchema, SSchema>) => void, includeSelectionChangedByRemote?: boolean): () => void;
791
759
  /**
792
760
  * A callback function that runs when the editor has been initialized.
793
761
  *
@@ -802,10 +770,6 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
802
770
  }): void;
803
771
  getForceSelectionVisible(): boolean;
804
772
  setForceSelectionVisible(forceSelectionVisible: boolean): void;
805
- /**
806
- * This will convert HTML into a format that is compatible with BlockNote.
807
- */
808
- private convertHtmlToBlockNoteHtml;
809
773
  /**
810
774
  * Paste HTML into the editor. Defaults to converting HTML to BlockNote HTML.
811
775
  * @param html The HTML to paste.
@@ -816,10 +780,10 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
816
780
  * Paste text into the editor. Defaults to interpreting text as markdown.
817
781
  * @param text The text to paste.
818
782
  */
819
- pasteText(text: string): boolean | undefined;
783
+ pasteText(text: string): boolean;
820
784
  /**
821
785
  * Paste markdown into the editor.
822
786
  * @param markdown The markdown to paste.
823
787
  */
824
- pasteMarkdown(markdown: string): Promise<void>;
788
+ pasteMarkdown(markdown: string): void;
825
789
  }
@@ -1,9 +1,76 @@
1
1
  import { Plugin } from "prosemirror-state";
2
2
  import { EventEmitter } from "../util/EventEmitter.js";
3
+ import { AnyExtension } from "@tiptap/core";
4
+ import { BlockSchema, InlineContentSchema, PartialBlockNoDefaults, StyleSchema } from "../schema/index.js";
5
+ import { BlockNoteEditor } from "./BlockNoteEditor.js";
3
6
  export declare abstract class BlockNoteExtension<TEvent extends Record<string, any> = any> extends EventEmitter<TEvent> {
4
7
  static key(): string;
5
8
  protected addProsemirrorPlugin(plugin: Plugin): void;
6
9
  readonly plugins: Plugin[];
7
10
  get priority(): number | undefined;
8
11
  constructor(..._args: any[]);
12
+ /**
13
+ * Input rules for the block
14
+ */
15
+ inputRules?: InputRule[];
16
+ /**
17
+ * A mapping of a keyboard shortcut to a function that will be called when the shortcut is pressed
18
+ *
19
+ * The keys are in the format:
20
+ * - Key names may be strings like `Shift-Ctrl-Enter`—a key identifier prefixed with zero or more modifiers
21
+ * - Key identifiers are based on the strings that can appear in KeyEvent.key
22
+ * - Use lowercase letters to refer to letter keys (or uppercase letters if you want shift to be held)
23
+ * - You may use `Space` as an alias for the " " name
24
+ * - Modifiers can be given in any order: `Shift-` (or `s-`), `Alt-` (or `a-`), `Ctrl-` (or `c-` or `Control-`) and `Cmd-` (or `m-` or `Meta-`)
25
+ * - For characters that are created by holding shift, the Shift- prefix is implied, and should not be added explicitly
26
+ * - You can use Mod- as a shorthand for Cmd- on Mac and Ctrl- on other platforms
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * keyboardShortcuts: {
31
+ * "Mod-Enter": (ctx) => { return true; },
32
+ * "Shift-Ctrl-Space": (ctx) => { return true; },
33
+ * "a": (ctx) => { return true; },
34
+ * "Space": (ctx) => { return true; }
35
+ * }
36
+ * ```
37
+ */
38
+ keyboardShortcuts?: Record<string, (ctx: {
39
+ editor: BlockNoteEditor<BlockSchema, InlineContentSchema, StyleSchema>;
40
+ }) => boolean>;
41
+ tiptapExtensions?: AnyExtension[];
9
42
  }
43
+ export type InputRule = {
44
+ /**
45
+ * The regex to match when to trigger the input rule
46
+ */
47
+ find: RegExp;
48
+ /**
49
+ * The function to call when the input rule is matched
50
+ * @returns undefined if the input rule should not be triggered, or an object with the type and props to update the block
51
+ */
52
+ replace: (props: {
53
+ /**
54
+ * The result of the regex match
55
+ */
56
+ match: RegExpMatchArray;
57
+ /**
58
+ * The range of the text that was matched
59
+ */
60
+ range: {
61
+ from: number;
62
+ to: number;
63
+ };
64
+ /**
65
+ * The editor instance
66
+ */
67
+ editor: BlockNoteEditor<any, any, any>;
68
+ }) => undefined | PartialBlockNoDefaults<any, any, any>;
69
+ };
70
+ /**
71
+ * This creates an instance of a BlockNoteExtension that can be used to add to a schema.
72
+ * It is a bit of a hack, but it works.
73
+ */
74
+ export declare function createBlockNoteExtension(options: Partial<Pick<BlockNoteExtension, "inputRules" | "keyboardShortcuts" | "plugins" | "tiptapExtensions">> & {
75
+ key: string;
76
+ }): BlockNoteExtension;
@@ -3,6 +3,7 @@ import * as Y from "yjs";
3
3
  import type { ThreadStore } from "../comments/index.js";
4
4
  import { BlockNoteDOMAttributes, BlockSchema, BlockSpecs, InlineContentSchema, InlineContentSpecs, StyleSchema, StyleSpecs } from "../schema/index.js";
5
5
  import type { BlockNoteEditor, BlockNoteEditorOptions, SupportedExtension } from "./BlockNoteEditor.js";
6
+ import { BlockNoteSchema } from "../blocks/BlockNoteSchema.js";
6
7
  type ExtensionOptions<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> = {
7
8
  editor: BlockNoteEditor<BSchema, I, S>;
8
9
  domAttributes: Partial<BlockNoteDOMAttributes>;
@@ -29,6 +30,7 @@ type ExtensionOptions<BSchema extends BlockSchema, I extends InlineContentSchema
29
30
  placeholders: Record<string | "default" | "emptyDocument", string | undefined>;
30
31
  tabBehavior?: "prefer-navigate-ui" | "prefer-indent";
31
32
  comments?: {
33
+ schema?: BlockNoteSchema<any, any, any>;
32
34
  threadStore: ThreadStore;
33
35
  };
34
36
  pasteHandler: BlockNoteEditorOptions<any, any, any>["pasteHandler"];
@@ -1,76 +1,8 @@
1
- export declare const COLORS_DEFAULT: {
2
- gray: {
3
- text: string;
4
- background: string;
5
- };
6
- brown: {
7
- text: string;
8
- background: string;
9
- };
10
- red: {
11
- text: string;
12
- background: string;
13
- };
14
- orange: {
15
- text: string;
16
- background: string;
17
- };
18
- yellow: {
19
- text: string;
20
- background: string;
21
- };
22
- green: {
23
- text: string;
24
- background: string;
25
- };
26
- blue: {
27
- text: string;
28
- background: string;
29
- };
30
- purple: {
31
- text: string;
32
- background: string;
33
- };
34
- pink: {
35
- text: string;
36
- background: string;
37
- };
38
- };
39
- export declare const COLORS_DARK_MODE_DEFAULT: {
40
- gray: {
41
- text: string;
42
- background: string;
43
- };
44
- brown: {
45
- text: string;
46
- background: string;
47
- };
48
- red: {
49
- text: string;
50
- background: string;
51
- };
52
- orange: {
53
- text: string;
54
- background: string;
55
- };
56
- yellow: {
57
- text: string;
58
- background: string;
59
- };
60
- green: {
61
- text: string;
62
- background: string;
63
- };
64
- blue: {
65
- text: string;
66
- background: string;
67
- };
68
- purple: {
69
- text: string;
70
- background: string;
71
- };
72
- pink: {
73
- text: string;
74
- background: string;
75
- };
76
- };
1
+ export declare const COLORS_DEFAULT: Record<string, {
2
+ text: string;
3
+ background: string;
4
+ }>;
5
+ export declare const COLORS_DARK_MODE_DEFAULT: Record<string, {
6
+ text: string;
7
+ background: string;
8
+ }>;
@@ -1,4 +1,4 @@
1
- import { BlockNoteSchema } from "../editor/BlockNoteSchema.js";
1
+ import { BlockNoteSchema } from "../blocks/BlockNoteSchema.js";
2
2
  import { COLORS_DEFAULT } from "../editor/defaultColors.js";
3
3
  import { BlockFromConfig, BlockSchema, InlineContent, InlineContentSchema, StyleSchema, StyledText, Styles } from "../schema/index.js";
4
4
  import type { BlockMapping, InlineContentMapping, StyleMapping } from "./mapping.js";
@@ -1,4 +1,4 @@
1
- import { BlockNoteSchema } from "../editor/BlockNoteSchema.js";
1
+ import { BlockNoteSchema } from "../blocks/BlockNoteSchema.js";
2
2
  import { BlockFromConfigNoChildren, BlockSchema, InlineContentFromConfig, InlineContentSchema, StyleSchema, Styles } from "../schema/index.js";
3
3
  import type { Exporter } from "./Exporter.js";
4
4
  /**
@@ -3,5 +3,8 @@ export declare const BackgroundColor: {
3
3
  type: string;
4
4
  propSchema: "string";
5
5
  };
6
- implementation: import("../../index.js").StyleImplementation;
6
+ implementation: import("../../index.js").StyleImplementation<{
7
+ type: string;
8
+ propSchema: "string";
9
+ }>;
7
10
  };
@@ -0,0 +1,7 @@
1
+ import * as Y from "yjs";
2
+ import { BlockNoteExtension } from "../../../editor/BlockNoteExtension.js";
3
+ export declare class SchemaMigrationPlugin extends BlockNoteExtension {
4
+ private migrationDone;
5
+ static key(): string;
6
+ constructor(fragment: Y.XmlFragment);
7
+ }
@@ -0,0 +1,3 @@
1
+ import { MigrationRule } from "./migrationRule.js";
2
+ declare const _default: MigrationRule[];
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { Transaction } from "@tiptap/pm/state";
2
+ import * as Y from "yjs";
3
+ export type MigrationRule = (fragment: Y.XmlFragment, tr: Transaction) => void;
@@ -0,0 +1,2 @@
1
+ import { MigrationRule } from "./migrationRule.js";
2
+ export declare const moveColorAttributes: MigrationRule;
@@ -1,11 +1,13 @@
1
1
  import type { CommentBody, ThreadStore, User } from "../../comments/index.js";
2
2
  import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
3
3
  import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
4
+ import { BlockNoteSchema } from "../../blocks/BlockNoteSchema.js";
4
5
  import { UserStore } from "./userstore/UserStore.js";
5
6
  export declare class CommentsPlugin extends BlockNoteExtension {
6
7
  private readonly editor;
7
8
  readonly threadStore: ThreadStore;
8
9
  private readonly markType;
10
+ readonly commentEditorSchema?: BlockNoteSchema<any, any, any> | undefined;
9
11
  static key(): string;
10
12
  readonly userStore: UserStore<User>;
11
13
  /**
@@ -26,7 +28,7 @@ export declare class CommentsPlugin extends BlockNoteExtension {
26
28
  * when a thread is resolved or deleted, we need to update the marks to reflect the new state
27
29
  */
28
30
  private updateMarksFromThreads;
29
- constructor(editor: BlockNoteEditor<any, any, any>, threadStore: ThreadStore, markType: string);
31
+ constructor(editor: BlockNoteEditor<any, any, any>, threadStore: ThreadStore, markType: string, commentEditorSchema?: BlockNoteSchema<any, any, any> | undefined);
30
32
  /**
31
33
  * Subscribe to state updates
32
34
  */
@@ -3,9 +3,9 @@ import { EditorView } from "prosemirror-view";
3
3
  import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
4
4
  import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
5
5
  import { UiElementPosition } from "../../extensions-shared/UiElementPosition.js";
6
- import type { BlockFromConfig, FileBlockConfig, InlineContentSchema, StyleSchema } from "../../schema/index.js";
6
+ import type { BlockFromConfig, InlineContentSchema, StyleSchema } from "../../schema/index.js";
7
7
  export type FilePanelState<I extends InlineContentSchema, S extends StyleSchema> = UiElementPosition & {
8
- block: BlockFromConfig<FileBlockConfig, I, S>;
8
+ block: BlockFromConfig<any, I, S>;
9
9
  };
10
10
  export declare class FilePanelView<I extends InlineContentSchema, S extends StyleSchema> implements PluginView {
11
11
  private readonly editor;
@@ -13,7 +13,7 @@ export declare class FilePanelView<I extends InlineContentSchema, S extends Styl
13
13
  private readonly pmView;
14
14
  state?: FilePanelState<I, S>;
15
15
  emitUpdate: () => void;
16
- constructor(editor: BlockNoteEditor<Record<string, FileBlockConfig>, I, S>, pluginKey: PluginKey<FilePanelState<I, S>>, pmView: EditorView, emitUpdate: (state: FilePanelState<I, S>) => void);
16
+ constructor(editor: BlockNoteEditor<Record<string, any>, I, S>, pluginKey: PluginKey<FilePanelState<I, S>>, pmView: EditorView, emitUpdate: (state: FilePanelState<I, S>) => void);
17
17
  mouseDownHandler: () => void;
18
18
  dragstartHandler: () => void;
19
19
  scrollHandler: () => void;
@@ -24,7 +24,7 @@ export declare class FilePanelView<I extends InlineContentSchema, S extends Styl
24
24
  export declare class FilePanelProsemirrorPlugin<I extends InlineContentSchema, S extends StyleSchema> extends BlockNoteExtension {
25
25
  static key(): string;
26
26
  private view;
27
- constructor(editor: BlockNoteEditor<Record<string, FileBlockConfig>, I, S>);
27
+ constructor(editor: BlockNoteEditor<Record<string, any>, I, S>);
28
28
  get shown(): boolean;
29
29
  onUpdate(callback: (state: FilePanelState<I, S>) => void): () => void;
30
30
  closeMenu: () => void | undefined;
@@ -3,5 +3,8 @@ export declare const TextColor: {
3
3
  type: string;
4
4
  propSchema: "string";
5
5
  };
6
- implementation: import("../../index.js").StyleImplementation;
6
+ implementation: import("../../index.js").StyleImplementation<{
7
+ type: string;
8
+ propSchema: "string";
9
+ }>;
7
10
  };
@@ -141,18 +141,7 @@ export declare const en: {
141
141
  };
142
142
  placeholders: Record<string | "default" | "emptyDocument", string | undefined>;
143
143
  file_blocks: {
144
- image: {
145
- add_button_text: string;
146
- };
147
- video: {
148
- add_button_text: string;
149
- };
150
- audio: {
151
- add_button_text: string;
152
- };
153
- file: {
154
- add_button_text: string;
155
- };
144
+ add_button_text: Record<string, string>;
156
145
  };
157
146
  toggle_blocks: {
158
147
  add_block_button: string;