@blocknote/core 0.11.1 → 0.12.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 (129) hide show
  1. package/README.md +13 -17
  2. package/dist/blocknote.js +1611 -1408
  3. package/dist/blocknote.js.map +1 -1
  4. package/dist/blocknote.umd.cjs +6 -6
  5. package/dist/blocknote.umd.cjs.map +1 -1
  6. package/dist/style.css +1 -1
  7. package/dist/webpack-stats.json +1 -1
  8. package/package.json +8 -4
  9. package/src/api/blockManipulation/blockManipulation.test.ts +19 -15
  10. package/src/api/blockManipulation/blockManipulation.ts +107 -17
  11. package/src/api/exporters/html/externalHTMLExporter.ts +3 -7
  12. package/src/api/exporters/html/htmlConversion.test.ts +6 -3
  13. package/src/api/exporters/html/internalHTMLSerializer.ts +3 -7
  14. package/src/api/exporters/html/util/sharedHTMLConversion.ts +3 -3
  15. package/src/api/exporters/markdown/markdownExporter.test.ts +7 -3
  16. package/src/api/exporters/markdown/markdownExporter.ts +2 -6
  17. package/src/api/nodeConversions/nodeConversions.test.ts +14 -7
  18. package/src/api/nodeConversions/nodeConversions.ts +1 -2
  19. package/src/api/parsers/html/parseHTML.test.ts +5 -1
  20. package/src/api/parsers/html/parseHTML.ts +2 -6
  21. package/src/api/parsers/html/util/nestedLists.ts +11 -1
  22. package/src/api/parsers/markdown/parseMarkdown.test.ts +3 -0
  23. package/src/api/parsers/markdown/parseMarkdown.ts +2 -6
  24. package/src/api/testUtil/cases/customBlocks.ts +18 -16
  25. package/src/api/testUtil/cases/customInlineContent.ts +12 -13
  26. package/src/api/testUtil/cases/customStyles.ts +12 -10
  27. package/src/api/testUtil/index.ts +4 -2
  28. package/src/api/testUtil/partialBlockTestUtil.ts +2 -6
  29. package/src/blocks/ImageBlockContent/ImageBlockContent.ts +1 -2
  30. package/src/blocks/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts +8 -1
  31. package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +13 -0
  32. package/src/blocks/defaultBlockHelpers.ts +3 -3
  33. package/src/blocks/defaultBlockTypeGuards.ts +84 -0
  34. package/src/blocks/defaultBlocks.ts +29 -3
  35. package/src/editor/Block.css +2 -31
  36. package/src/editor/BlockNoteEditor.ts +219 -263
  37. package/src/editor/BlockNoteExtensions.ts +5 -2
  38. package/src/editor/BlockNoteSchema.ts +98 -0
  39. package/src/editor/BlockNoteTipTapEditor.ts +162 -0
  40. package/src/editor/cursorPositionTypes.ts +2 -6
  41. package/src/editor/editor.css +0 -1
  42. package/src/editor/selectionTypes.ts +2 -6
  43. package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +22 -29
  44. package/src/extensions/HyperlinkToolbar/HyperlinkToolbarPlugin.ts +26 -27
  45. package/src/extensions/ImageToolbar/ImageToolbarPlugin.ts +45 -51
  46. package/src/extensions/Placeholder/PlaceholderExtension.ts +81 -88
  47. package/src/extensions/SideMenu/SideMenuPlugin.ts +55 -56
  48. package/src/extensions/SuggestionMenu/DefaultSuggestionItem.ts +8 -0
  49. package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +353 -0
  50. package/src/extensions/{SlashMenu/defaultSlashMenuItems.ts → SuggestionMenu/getDefaultSlashMenuItems.ts} +119 -89
  51. package/src/extensions/TableHandles/TableHandlesPlugin.ts +62 -45
  52. package/src/extensions-shared/UiElementPosition.ts +4 -0
  53. package/src/index.ts +6 -6
  54. package/src/pm-nodes/BlockContainer.ts +5 -9
  55. package/src/schema/blocks/types.ts +15 -15
  56. package/src/schema/inlineContent/createSpec.ts +2 -2
  57. package/src/schema/inlineContent/types.ts +1 -1
  58. package/src/util/browser.ts +6 -4
  59. package/src/util/typescript.ts +7 -4
  60. package/types/src/api/blockManipulation/blockManipulation.d.ts +6 -1
  61. package/types/src/api/exporters/html/externalHTMLExporter.d.ts +2 -1
  62. package/types/src/api/exporters/html/internalHTMLSerializer.d.ts +2 -1
  63. package/types/src/api/exporters/markdown/markdownExporter.d.ts +2 -1
  64. package/types/src/api/nodeConversions/nodeConversions.d.ts +2 -1
  65. package/types/src/api/parsers/html/parseHTML.d.ts +2 -1
  66. package/types/src/api/parsers/markdown/parseMarkdown.d.ts +2 -1
  67. package/types/src/api/testUtil/cases/customBlocks.d.ts +72 -13
  68. package/types/src/api/testUtil/cases/customInlineContent.d.ts +281 -6
  69. package/types/src/api/testUtil/cases/customStyles.d.ts +247 -13
  70. package/types/src/api/testUtil/index.d.ts +4 -2
  71. package/types/src/api/testUtil/partialBlockTestUtil.d.ts +2 -1
  72. package/types/src/blocks/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.d.ts +6 -1
  73. package/types/src/blocks/defaultBlockHelpers.d.ts +2 -2
  74. package/types/src/blocks/defaultBlockTypeGuards.d.ts +24 -0
  75. package/types/src/blocks/defaultBlocks.d.ts +21 -15
  76. package/types/src/editor/BlockNoteEditor.d.ts +48 -53
  77. package/types/src/editor/BlockNoteExtensions.d.ts +1 -0
  78. package/types/src/editor/BlockNoteSchema.d.ts +34 -0
  79. package/types/src/editor/BlockNoteTipTapEditor.d.ts +28 -0
  80. package/types/src/editor/cursorPositionTypes.d.ts +2 -1
  81. package/types/src/editor/selectionTypes.d.ts +2 -1
  82. package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +5 -6
  83. package/types/src/extensions/HyperlinkToolbar/HyperlinkToolbarPlugin.d.ts +2 -2
  84. package/types/src/extensions/ImageToolbar/ImageToolbarPlugin.d.ts +15 -14
  85. package/types/src/extensions/Placeholder/PlaceholderExtension.d.ts +2 -15
  86. package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +8 -7
  87. package/types/src/extensions/SuggestionMenu/DefaultSuggestionItem.d.ts +8 -0
  88. package/types/src/extensions/SuggestionMenu/SuggestionPlugin.d.ts +31 -0
  89. package/types/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.d.ts +10 -0
  90. package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +7 -7
  91. package/types/src/extensions-shared/UiElementPosition.d.ts +4 -0
  92. package/types/src/index.d.ts +6 -6
  93. package/types/src/pm-nodes/BlockContainer.d.ts +3 -2
  94. package/types/src/pm-nodes/BlockGroup.d.ts +1 -1
  95. package/types/src/schema/blocks/types.d.ts +15 -15
  96. package/types/src/schema/inlineContent/types.d.ts +1 -1
  97. package/types/src/util/browser.d.ts +1 -0
  98. package/types/src/util/typescript.d.ts +1 -0
  99. package/src/extensions/SlashMenu/BaseSlashMenuItem.ts +0 -12
  100. package/src/extensions/SlashMenu/SlashMenuPlugin.ts +0 -53
  101. package/src/extensions-shared/BaseUiElementTypes.ts +0 -8
  102. package/src/extensions-shared/README.md +0 -3
  103. package/src/extensions-shared/suggestion/SuggestionItem.ts +0 -3
  104. package/src/extensions-shared/suggestion/SuggestionPlugin.ts +0 -448
  105. package/types/src/extensions/SlashMenu/BaseSlashMenuItem.d.ts +0 -7
  106. package/types/src/extensions/SlashMenu/SlashMenuPlugin.d.ts +0 -13
  107. package/types/src/extensions/SlashMenu/defaultSlashMenuItems.d.ts +0 -3
  108. package/types/src/extensions-shared/BaseUiElementTypes.d.ts +0 -7
  109. package/types/src/extensions-shared/suggestion/SuggestionItem.d.ts +0 -3
  110. package/types/src/extensions-shared/suggestion/SuggestionPlugin.d.ts +0 -36
  111. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-100.woff +0 -0
  112. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-100.woff2 +0 -0
  113. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-200.woff +0 -0
  114. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-200.woff2 +0 -0
  115. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-300.woff +0 -0
  116. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-300.woff2 +0 -0
  117. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-500.woff +0 -0
  118. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-500.woff2 +0 -0
  119. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-600.woff +0 -0
  120. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-600.woff2 +0 -0
  121. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-700.woff +0 -0
  122. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-700.woff2 +0 -0
  123. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-800.woff +0 -0
  124. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-800.woff2 +0 -0
  125. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-900.woff +0 -0
  126. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-900.woff2 +0 -0
  127. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-regular.woff +0 -0
  128. /package/src/{assets → fonts}/inter-v12-latin/inter-v12-latin-regular.woff2 +0 -0
  129. /package/src/{assets/fonts-inter.css → fonts/inter.css} +0 -0
@@ -1,36 +0,0 @@
1
- import { Plugin, PluginKey } from "prosemirror-state";
2
- import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
3
- import { InlineContentSchema, StyleSchema } from "../../schema";
4
- import { BaseUiElementState } from "../BaseUiElementTypes";
5
- import { SuggestionItem } from "./SuggestionItem";
6
- export type SuggestionsMenuState<T extends SuggestionItem> = BaseUiElementState & {
7
- filteredItems: T[];
8
- keyboardHoveredItemIndex: number;
9
- };
10
- type SuggestionPluginState<T extends SuggestionItem> = {
11
- active: boolean;
12
- triggerCharacter: string | undefined;
13
- queryStartPos: number | undefined;
14
- items: T[];
15
- keyboardHoveredItemIndex: number | undefined;
16
- notFoundCount: number | undefined;
17
- decorationId: string | undefined;
18
- };
19
- /**
20
- * A ProseMirror plugin for suggestions, designed to make '/'-commands possible as well as mentions.
21
- *
22
- * This is basically a simplified version of TipTap's [Suggestions](https://github.com/ueberdosis/tiptap/tree/db92a9b313c5993b723c85cd30256f1d4a0b65e1/packages/suggestion) plugin.
23
- *
24
- * This version is adapted from the aforementioned version in the following ways:
25
- * - This version supports generic items instead of only strings (to allow for more advanced filtering for example)
26
- * - This version hides some unnecessary complexity from the user of the plugin.
27
- * - This version handles key events differently
28
- */
29
- export declare const setupSuggestionsMenu: <T extends SuggestionItem, BSchema extends Record<string, import("../../schema").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>, updateSuggestionsMenu: (suggestionsMenuState: SuggestionsMenuState<T>) => void, pluginKey: PluginKey, defaultTriggerCharacter: string, items?: (query: string) => T[], onSelectItem?: (props: {
30
- item: T;
31
- editor: BlockNoteEditor<BSchema, I, S>;
32
- }) => void) => {
33
- plugin: Plugin<SuggestionPluginState<T>>;
34
- itemCallback: (item: T) => void;
35
- };
36
- export {};
File without changes