@blocknote/core 0.47.0 → 0.47.2

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 (77) hide show
  1. package/dist/BlockNoteExtension-BWw0r8Gy.cjs.map +1 -1
  2. package/dist/BlockNoteExtension-C2X7LW-V.js.map +1 -1
  3. package/dist/{BlockNoteSchema-DT4bdXj5.cjs → BlockNoteSchema-CCs_V3lo.cjs} +2 -2
  4. package/dist/{BlockNoteSchema-DT4bdXj5.cjs.map → BlockNoteSchema-CCs_V3lo.cjs.map} +1 -1
  5. package/dist/{BlockNoteSchema-1r-ln0Q0.js → BlockNoteSchema-ooiKsd5B.js} +2 -2
  6. package/dist/{BlockNoteSchema-1r-ln0Q0.js.map → BlockNoteSchema-ooiKsd5B.js.map} +1 -1
  7. package/dist/{TrailingNode-DZag-Nvu.js → TrailingNode-GzE59m_7.js} +588 -416
  8. package/dist/TrailingNode-GzE59m_7.js.map +1 -0
  9. package/dist/TrailingNode-n0WdMPUl.cjs +2 -0
  10. package/dist/TrailingNode-n0WdMPUl.cjs.map +1 -0
  11. package/dist/blocknote.cjs +4 -4
  12. package/dist/blocknote.cjs.map +1 -1
  13. package/dist/blocknote.js +1206 -955
  14. package/dist/blocknote.js.map +1 -1
  15. package/dist/blocks.cjs +1 -1
  16. package/dist/blocks.js +2 -2
  17. package/dist/comments.cjs.map +1 -1
  18. package/dist/comments.js.map +1 -1
  19. package/dist/defaultBlocks-Dg9kQWXm.cjs +6 -0
  20. package/dist/defaultBlocks-Dg9kQWXm.cjs.map +1 -0
  21. package/dist/{defaultBlocks-BSOEW3GR.js → defaultBlocks-ZzGbYgQn.js} +627 -543
  22. package/dist/defaultBlocks-ZzGbYgQn.js.map +1 -0
  23. package/dist/extensions.cjs +1 -1
  24. package/dist/extensions.cjs.map +1 -1
  25. package/dist/extensions.js +33 -54
  26. package/dist/extensions.js.map +1 -1
  27. package/dist/locales.cjs +1 -1
  28. package/dist/locales.cjs.map +1 -1
  29. package/dist/locales.js +25 -24
  30. package/dist/locales.js.map +1 -1
  31. package/dist/style.css +1 -1
  32. package/dist/tsconfig.tsbuildinfo +1 -1
  33. package/dist/webpack-stats.json +1 -1
  34. package/package.json +1 -10
  35. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +33 -7
  36. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +7 -1
  37. package/src/blocks/Heading/block.ts +48 -1
  38. package/src/blocks/ListItem/ToggleListItem/block.ts +51 -1
  39. package/src/blocks/Paragraph/block.ts +1 -1
  40. package/src/blocks/getDetailsContent.ts +77 -0
  41. package/src/comments/threadstore/TipTapThreadStore.ts +5 -5
  42. package/src/comments/threadstore/tiptap/types.ts +131 -0
  43. package/src/editor/Block.css +6 -0
  44. package/src/editor/BlockNoteEditor.ts +9 -14
  45. package/src/editor/managers/ExtensionManager/symbol.ts +0 -1
  46. package/src/editor/managers/SelectionManager.ts +3 -1
  47. package/src/extensions/Collaboration/YCursorPlugin.ts +3 -1
  48. package/src/extensions/DropCursor/DropCursor.ts +262 -25
  49. package/src/extensions/DropCursor/utils.ts +195 -0
  50. package/src/extensions/SuggestionMenu/SuggestionMenu.test.ts +191 -0
  51. package/src/extensions/SuggestionMenu/SuggestionMenu.ts +28 -11
  52. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +438 -53
  53. package/src/i18n/locales/fa.ts +4 -21
  54. package/src/i18n/locales/index.ts +1 -1
  55. package/src/i18n/locales/ru.ts +1 -1
  56. package/src/i18n/locales/uz.ts +22 -4
  57. package/src/index.ts +1 -0
  58. package/src/schema/blocks/createSpec.ts +35 -45
  59. package/src/schema/blocks/types.ts +101 -1
  60. package/types/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.d.ts +5 -0
  61. package/types/src/blocks/getDetailsContent.d.ts +19 -0
  62. package/types/src/comments/threadstore/TipTapThreadStore.d.ts +1 -1
  63. package/types/src/comments/threadstore/tiptap/types.d.ts +73 -0
  64. package/types/src/editor/BlockNoteEditor.d.ts +6 -9
  65. package/types/src/extensions/DropCursor/DropCursor.d.ts +42 -5
  66. package/types/src/extensions/DropCursor/utils.d.ts +48 -0
  67. package/types/src/extensions/SuggestionMenu/SuggestionMenu.d.ts +12 -3
  68. package/types/src/extensions/SuggestionMenu/SuggestionMenu.test.d.ts +1 -0
  69. package/types/src/index.d.ts +1 -0
  70. package/types/src/schema/blocks/createSpec.d.ts +3 -3
  71. package/types/src/schema/blocks/types.d.ts +31 -1
  72. package/dist/TrailingNode-DZag-Nvu.js.map +0 -1
  73. package/dist/TrailingNode-tesI8f7N.cjs +0 -2
  74. package/dist/TrailingNode-tesI8f7N.cjs.map +0 -1
  75. package/dist/defaultBlocks-BSOEW3GR.js.map +0 -1
  76. package/dist/defaultBlocks-D049Pbme.cjs +0 -6
  77. package/dist/defaultBlocks-D049Pbme.cjs.map +0 -1
@@ -57,12 +57,30 @@ export interface BlockConfig<T extends string = string, PS extends PropSchema =
57
57
  */
58
58
  content: C;
59
59
  }
60
+ /**
61
+ * BlockConfigOrCreator is a union type of BlockConfig and a function that returns a BlockConfig.
62
+ * This is used to create block configs that can be passed to the createBlockSpec function.
63
+ */
64
+ export type BlockConfigOrCreator<TName extends string = string, TProps extends PropSchema = PropSchema, TContent extends "inline" | "none" = "inline" | "none", TOptions extends Record<string, any> | undefined = Record<string, any> | undefined> = BlockConfig<TName, TProps, TContent> | (TOptions extends undefined ? () => BlockConfig<TName, TProps, TContent> : (options: Partial<TOptions>) => BlockConfig<TName, TProps, TContent>);
65
+ /**
66
+ * ExtractBlockConfigFromConfigOrCreator is a helper type that extracts the BlockConfig type from a BlockConfigOrCreator.
67
+ */
68
+ export type ExtractBlockConfigFromConfigOrCreator<ConfigOrCreator extends BlockConfig<string, PropSchema, "inline" | "none"> | ((...args: any[]) => BlockConfig<string, PropSchema, "inline" | "none">)> = ConfigOrCreator extends (...args: any[]) => infer Config ? Config : ConfigOrCreator;
60
69
  export type CustomBlockConfig<T extends string = string, PS extends PropSchema = PropSchema, C extends "inline" | "none" = "inline" | "none"> = BlockConfig<T, PS, C>;
61
70
  export type BlockSpec<T extends string = string, PS extends PropSchema = PropSchema, C extends "inline" | "none" | "table" = "inline" | "none" | "table"> = {
62
71
  config: BlockConfig<T, PS, C>;
63
72
  implementation: BlockImplementation<T, PS, C>;
64
73
  extensions?: (Extension | ExtensionFactoryInstance)[];
65
74
  };
75
+ /**
76
+ * BlockSpecOrCreator is a union type of BlockSpec and a function that returns a BlockSpec.
77
+ * This is used to create block specs that can be passed to the createBlockSpec function.
78
+ */
79
+ export type BlockSpecOrCreator<T extends string = string, PS extends PropSchema = PropSchema, C extends "inline" | "none" | "table" = "inline" | "none" | "table", TOptions extends Record<string, any> | undefined = Record<string, any> | undefined> = BlockSpec<T, PS, C> | (TOptions extends undefined ? () => BlockSpec<T, PS, C> : (options: Partial<TOptions>) => BlockSpec<T, PS, C>);
80
+ /**
81
+ * ExtractBlockSpecFromSpecOrCreator is a helper type that extracts the BlockSpec type from a BlockSpecOrCreator.
82
+ */
83
+ export type ExtractBlockSpecFromSpecOrCreator<SpecOrCreator extends BlockSpec<string, PropSchema, "inline" | "none"> | ((...args: any[]) => BlockSpec<string, PropSchema, "inline" | "none">)> = SpecOrCreator extends (...args: any[]) => infer Spec ? Spec : SpecOrCreator;
66
84
  /**
67
85
  * This allows de-coupling the types that we display to users versus the types we expose internally.
68
86
  *
@@ -91,6 +109,7 @@ export type LooseBlockSpec<T extends string = string, PS extends PropSchema = Pr
91
109
  }) => {
92
110
  dom: HTMLElement | DocumentFragment;
93
111
  contentDOM?: HTMLElement;
112
+ childrenDOM?: HTMLElement;
94
113
  } | undefined;
95
114
  node: Node;
96
115
  };
@@ -125,6 +144,7 @@ export type BlockSpecs = {
125
144
  }) => {
126
145
  dom: HTMLElement | DocumentFragment;
127
146
  contentDOM?: HTMLElement;
147
+ childrenDOM?: HTMLElement;
128
148
  } | undefined;
129
149
  };
130
150
  extensions?: BlockSpec<k>["extensions"];
@@ -265,6 +285,7 @@ export type BlockImplementation<TName extends string = string, TProps extends Pr
265
285
  }) => {
266
286
  dom: HTMLElement | DocumentFragment;
267
287
  contentDOM?: HTMLElement;
288
+ childrenDOM?: HTMLElement;
268
289
  } | undefined;
269
290
  /**
270
291
  * Parses an external HTML element into a block of this type when it returns the block props object, otherwise undefined
@@ -282,7 +303,16 @@ export type BlockImplementation<TName extends string = string, TProps extends Pr
282
303
  parseContent?: (options: {
283
304
  el: HTMLElement;
284
305
  schema: Schema;
285
- }) => Fragment;
306
+ }) => Fragment | undefined;
286
307
  };
308
+ /**
309
+ * BlockImplementationOrCreator is a union type of BlockImplementation and a function that returns a BlockImplementation.
310
+ * This is used to create block implementations that can be passed to the createBlockSpec function.
311
+ */
312
+ export type BlockImplementationOrCreator<ConfigOrCreator extends BlockConfigOrCreator = BlockConfigOrCreator, TOptions extends Record<string, any> | undefined = Record<string, any> | undefined, Config extends ExtractBlockConfigFromConfigOrCreator<ConfigOrCreator> = ExtractBlockConfigFromConfigOrCreator<ConfigOrCreator>> = BlockImplementation<Config["type"], Config["propSchema"], Config["content"]> | (TOptions extends undefined ? () => BlockImplementation<Config["type"], Config["propSchema"], Config["content"]> : (options: Partial<TOptions>) => BlockImplementation<Config["type"], Config["propSchema"], Config["content"]>);
313
+ /**
314
+ * ExtractBlockImplementationFromImplementationOrCreator is a helper type that extracts the BlockImplementation type from a BlockImplementationOrCreator.
315
+ */
316
+ export type ExtractBlockImplementationFromImplementationOrCreator<ImplementationOrCreator extends BlockImplementation<string, PropSchema, "inline" | "none"> | ((...args: any[]) => BlockImplementation<string, PropSchema, "inline" | "none">)> = ImplementationOrCreator extends (...args: any[]) => infer Implementation ? Implementation : ImplementationOrCreator;
287
317
  export type CustomBlockImplementation<T extends string = string, PS extends PropSchema = PropSchema, C extends "inline" | "none" = "inline" | "none"> = BlockImplementation<T, PS, C>;
288
318
  export {};