@blocknote/core 0.1.0-alpha.3 → 0.1.1

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 (109) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +4 -2
  3. package/dist/blocknote.js +3461 -2429
  4. package/dist/blocknote.js.map +1 -1
  5. package/dist/blocknote.umd.cjs +35 -71
  6. package/dist/blocknote.umd.cjs.map +1 -1
  7. package/dist/style.css +1 -1
  8. package/package.json +9 -7
  9. package/src/BlockNoteExtensions.ts +10 -17
  10. package/src/BlockNoteTheme.ts +150 -0
  11. package/src/EditorContent.tsx +2 -1
  12. package/src/extensions/Blocks/BlockAttributes.ts +12 -0
  13. package/src/extensions/Blocks/MultipleNodeSelection.ts +87 -0
  14. package/src/extensions/Blocks/OrderedListPlugin.ts +2 -2
  15. package/src/extensions/Blocks/PreviousBlockTypePlugin.ts +8 -2
  16. package/src/extensions/Blocks/helpers/findBlock.ts +1 -1
  17. package/src/extensions/Blocks/nodes/Block.module.css +37 -37
  18. package/src/extensions/Blocks/nodes/Block.ts +89 -45
  19. package/src/extensions/Blocks/nodes/BlockGroup.ts +19 -2
  20. package/src/extensions/Blocks/nodes/Content.ts +15 -2
  21. package/src/extensions/BubbleMenu/BubbleMenuExtension.tsx +10 -2
  22. package/src/extensions/BubbleMenu/component/BubbleMenu.tsx +122 -98
  23. package/src/extensions/BubbleMenu/component/LinkToolbarButton.tsx +8 -8
  24. package/src/extensions/DraggableBlocks/DraggableBlocksPlugin.tsx +143 -33
  25. package/src/extensions/DraggableBlocks/components/DragHandle.tsx +15 -21
  26. package/src/extensions/DraggableBlocks/components/DragHandleMenu.tsx +8 -7
  27. package/src/extensions/Hyperlinks/HyperlinkMenuPlugin.tsx +31 -66
  28. package/src/extensions/Hyperlinks/menus/EditHyperlinkMenu.tsx +44 -0
  29. package/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItem.tsx +34 -0
  30. package/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItemIcon.tsx +31 -0
  31. package/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItemInput.tsx +40 -0
  32. package/src/extensions/Hyperlinks/menus/HoverHyperlinkMenu.tsx +37 -0
  33. package/src/extensions/Hyperlinks/menus/HyperlinkMenu.tsx +63 -0
  34. package/src/extensions/SlashMenu/SlashMenuItem.ts +3 -1
  35. package/src/extensions/SlashMenu/defaultCommands.tsx +4 -4
  36. package/src/extensions/TrailingNode/TrailingNodeExtension.ts +8 -5
  37. package/src/shared/components/toolbar/Toolbar.tsx +8 -3
  38. package/src/shared/components/toolbar/ToolbarButton.tsx +57 -0
  39. package/src/shared/components/toolbar/ToolbarDropdown.tsx +35 -0
  40. package/src/shared/components/toolbar/ToolbarDropdownItem.tsx +35 -0
  41. package/src/shared/components/toolbar/ToolbarDropdownTarget.tsx +31 -0
  42. package/src/shared/plugins/suggestion/SuggestionItem.ts +3 -1
  43. package/src/shared/plugins/suggestion/{SuggestionListReactRenderer.ts → SuggestionListReactRenderer.tsx} +13 -4
  44. package/src/shared/plugins/suggestion/components/SuggestionGroup.tsx +6 -93
  45. package/src/shared/plugins/suggestion/components/SuggestionGroupItem.tsx +82 -0
  46. package/src/shared/plugins/suggestion/components/SuggestionList.tsx +24 -23
  47. package/src/useEditor.ts +4 -0
  48. package/src/utils.ts +12 -0
  49. package/types/src/BlockNoteExtensions.d.ts +3 -0
  50. package/types/src/BlockNoteTheme.d.ts +2 -0
  51. package/types/src/commands/indentation.d.ts +2 -0
  52. package/types/src/extensions/Blocks/BlockAttributes.d.ts +2 -0
  53. package/types/src/extensions/Blocks/MultipleNodeSelection.d.ts +24 -0
  54. package/types/src/extensions/Blocks/nodes/Block.d.ts +1 -1
  55. package/types/src/extensions/BubbleMenu/component/LinkToolbarButton.d.ts +2 -2
  56. package/types/src/extensions/Hyperlinks/menus/EditHyperlinkMenu.d.ts +11 -0
  57. package/types/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItem.d.ts +13 -0
  58. package/types/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItemIcon.d.ts +8 -0
  59. package/types/src/extensions/Hyperlinks/menus/EditHyperlinkMenuItemInput.d.ts +9 -0
  60. package/types/src/extensions/Hyperlinks/menus/HoverHyperlinkMenu.d.ts +12 -0
  61. package/types/src/extensions/Hyperlinks/menus/HyperlinkMenu.d.ts +21 -0
  62. package/types/src/extensions/Hyperlinks/menus/helpers/PanelTextInput.d.ts +39 -0
  63. package/types/src/extensions/Hyperlinks/menus/helpers/PanelTextInputStyles.d.ts +3 -0
  64. package/types/src/extensions/Hyperlinks/menus/helpers/ToolbarComponent.d.ts +13 -0
  65. package/types/src/extensions/SlashMenu/SlashMenuItem.d.ts +4 -7
  66. package/types/src/extensions/TrailingNode/TrailingNodeExtension.d.ts +3 -0
  67. package/types/src/nodes/ChildgroupNode.d.ts +28 -0
  68. package/types/src/nodes/patchNodes.d.ts +1 -0
  69. package/types/src/plugins/TreeViewPlugin/index.d.ts +2 -0
  70. package/types/src/plugins/animation.d.ts +2 -0
  71. package/types/src/react/BlockNoteComposer.d.ts +17 -0
  72. package/types/src/react/BlockNotePlugin.d.ts +1 -0
  73. package/types/src/react/index.d.ts +3 -0
  74. package/types/src/react/useBlockNoteSetup.d.ts +2 -0
  75. package/types/src/registerBlockNote.d.ts +2 -0
  76. package/types/src/shared/components/toolbar/SimpleToolbarButton.d.ts +2 -3
  77. package/types/src/shared/components/toolbar/SimpleToolbarDropdown.d.ts +11 -0
  78. package/types/src/shared/components/toolbar/SimpleToolbarDropdownItem.d.ts +11 -0
  79. package/types/src/shared/components/toolbar/Toolbar.d.ts +2 -2
  80. package/types/src/shared/components/toolbar/ToolbarButton.d.ts +15 -0
  81. package/types/src/shared/components/toolbar/ToolbarDropdown.d.ts +17 -0
  82. package/types/src/shared/components/toolbar/ToolbarDropdownItem.d.ts +11 -0
  83. package/types/src/shared/components/toolbar/ToolbarDropdownTarget.d.ts +8 -0
  84. package/types/src/shared/plugins/suggestion/SuggestionItem.d.ts +2 -4
  85. package/types/src/shared/plugins/suggestion/components/SuggestionGroupItem.d.ts +9 -0
  86. package/types/src/shared/plugins/suggestion/components/SuggestionList.d.ts +0 -15
  87. package/types/src/themes/BlockNoteEditorTheme.d.ts +11 -0
  88. package/types/src/useEditor.d.ts +3 -0
  89. package/types/src/utils.d.ts +2 -0
  90. package/src/extensions/Blocks/nodes/README.md +0 -26
  91. package/src/extensions/BubbleMenu/component/DropdownBlockItem.module.css +0 -13
  92. package/src/extensions/BubbleMenu/component/DropdownBlockItem.tsx +0 -25
  93. package/src/extensions/DraggableBlocks/components/DragHandle.module.css +0 -33
  94. package/src/extensions/DraggableBlocks/components/DragHandleMenu.module.css +0 -10
  95. package/src/extensions/Hyperlinks/menus/HyperlinkBasicMenu.tsx +0 -59
  96. package/src/extensions/Hyperlinks/menus/HyperlinkEditMenu.tsx +0 -72
  97. package/src/extensions/Hyperlinks/menus/atlaskit/PanelTextInput.tsx +0 -173
  98. package/src/extensions/Hyperlinks/menus/atlaskit/PanelTextInputStyles.ts +0 -36
  99. package/src/extensions/Hyperlinks/menus/atlaskit/README.md +0 -1
  100. package/src/extensions/Hyperlinks/menus/atlaskit/ToolbarComponent.tsx +0 -61
  101. package/src/extensions/helpers/formatKeyboardShortcut.ts +0 -9
  102. package/src/lib/atlaskit/browser.ts +0 -47
  103. package/src/shared/components/toolbar/SimpleToolbarButton.module.css +0 -13
  104. package/src/shared/components/toolbar/SimpleToolbarButton.tsx +0 -56
  105. package/src/shared/components/toolbar/Toolbar.module.css +0 -10
  106. package/src/shared/components/toolbar/ToolbarSeparator.module.css +0 -13
  107. package/src/shared/components/toolbar/ToolbarSeparator.tsx +0 -7
  108. package/src/shared/plugins/suggestion/components/SuggestionGroup.module.css +0 -45
  109. package/src/shared/plugins/suggestion/components/SuggestionList.module.css +0 -10
package/src/utils.ts ADDED
@@ -0,0 +1,12 @@
1
+ export const isAppleOS = () =>
2
+ /Mac/.test(navigator.platform) ||
3
+ (/AppleWebKit/.test(navigator.userAgent) &&
4
+ /Mobile\/\w+/.test(navigator.userAgent));
5
+
6
+ export function formatKeyboardShortcut(shortcut: string) {
7
+ if (isAppleOS()) {
8
+ return shortcut.replace("Mod", "⌘");
9
+ } else {
10
+ return shortcut.replace("Mod", "Ctrl");
11
+ }
12
+ }
@@ -1,4 +1,7 @@
1
1
  import { Extensions } from "@tiptap/core";
2
2
  import { Node } from "@tiptap/core";
3
3
  export declare const Document: Node<any, any>;
4
+ /**
5
+ * Get all the Tiptap extensions BlockNote is configured with by default
6
+ */
4
7
  export declare const getBlockNoteExtensions: () => Extensions;
@@ -0,0 +1,2 @@
1
+ import { MantineThemeOverride } from "@mantine/core";
2
+ export declare const BlockNoteTheme: MantineThemeOverride;
@@ -0,0 +1,2 @@
1
+ import { LexicalEditor } from "lexical";
2
+ export declare function registerIndentationCommands(editor: LexicalEditor): () => void;
@@ -0,0 +1,2 @@
1
+ declare const BlockAttributes: Record<string, string>;
2
+ export default BlockAttributes;
@@ -0,0 +1,24 @@
1
+ import { Selection } from "prosemirror-state";
2
+ import { Node, ResolvedPos, Slice } from "prosemirror-model";
3
+ import { Mappable } from "prosemirror-transform";
4
+ /**
5
+ * This class represents an editor selection which spans multiple nodes/blocks. It's currently only used to allow users
6
+ * to drag multiple blocks at the same time. Expects the selection anchor and head to be between nodes, i.e. just before
7
+ * the first target node and just after the last, and that anchor and head are at the same nesting level.
8
+ *
9
+ * Partially based on ProseMirror's NodeSelection implementation:
10
+ * (https://github.com/ProseMirror/prosemirror-state/blob/master/src/selection.ts)
11
+ * MultipleNodeSelection differs from NodeSelection in the following ways:
12
+ * 1. Stores which nodes are included in the selection instead of just a single node.
13
+ * 2. Already expects the selection to start just before the first target node and ends just after the last, while a
14
+ * NodeSelection automatically sets both anchor and head to just before the single target node.
15
+ */
16
+ export declare class MultipleNodeSelection extends Selection {
17
+ nodes: Array<Node>;
18
+ constructor($anchor: ResolvedPos, $head: ResolvedPos);
19
+ static create(doc: Node, from: number, to?: number): MultipleNodeSelection;
20
+ content(): Slice;
21
+ eq(selection: Selection): boolean;
22
+ map(doc: Node, mapping: Mappable): Selection;
23
+ toJSON(): any;
24
+ }
@@ -2,7 +2,7 @@ import { Node } from "@tiptap/core";
2
2
  export interface IBlock {
3
3
  HTMLAttributes: Record<string, any>;
4
4
  }
5
- export declare type Level = 1 | 2 | 3;
5
+ export declare type Level = "1" | "2" | "3";
6
6
  export declare type ListType = "li" | "oli";
7
7
  declare module "@tiptap/core" {
8
8
  interface Commands<ReturnType> {
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { Editor } from "@tiptap/core";
3
- import { SimpleToolbarButtonProps } from "../../../shared/components/toolbar/SimpleToolbarButton";
4
- declare type Props = SimpleToolbarButtonProps & {
3
+ import { ToolbarButtonProps } from "../../../shared/components/toolbar/ToolbarButton";
4
+ declare type Props = ToolbarButtonProps & {
5
5
  editor: Editor;
6
6
  };
7
7
  /**
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ export declare type EditHyperlinkMenuProps = {
3
+ url: string;
4
+ text: string;
5
+ update: (url: string, text: string) => void;
6
+ };
7
+ /**
8
+ * Menu which opens when editing an existing hyperlink or creating a new one.
9
+ * Provides input fields for setting the hyperlink URL and title.
10
+ */
11
+ export declare const EditHyperlinkMenu: (props: EditHyperlinkMenuProps) => JSX.Element;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { IconType } from "react-icons";
3
+ export declare type EditHyperlinkMenuItemProps = {
4
+ icon: IconType;
5
+ mainIconTooltip: string;
6
+ secondaryIconTooltip?: string;
7
+ autofocus?: boolean;
8
+ placeholder?: string;
9
+ value?: string;
10
+ onChange: (value: string) => void;
11
+ onSubmit: () => void;
12
+ };
13
+ export declare function EditHyperlinkMenuItem(props: EditHyperlinkMenuItemProps): JSX.Element;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { IconType } from "react-icons";
3
+ export declare type EditHyperlinkMenuItemIconProps = {
4
+ icon: IconType;
5
+ mainTooltip: string;
6
+ secondaryTooltip?: string;
7
+ };
8
+ export declare function EditHyperlinkMenuItemIcon(props: EditHyperlinkMenuItemIconProps): JSX.Element;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ export declare type EditHyperlinkMenuItemInputProps = {
3
+ autofocus?: boolean;
4
+ placeholder?: string;
5
+ value?: string;
6
+ onChange: (value: string) => void;
7
+ onSubmit: () => void;
8
+ };
9
+ export declare function EditHyperlinkMenuItemInput(props: EditHyperlinkMenuItemInputProps): JSX.Element;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ declare type HoverHyperlinkMenuProps = {
3
+ url: string;
4
+ edit: () => void;
5
+ remove: () => void;
6
+ };
7
+ /**
8
+ * Menu which opens when hovering an existing hyperlink.
9
+ * Provides buttons for editing, opening, and removing the hyperlink.
10
+ */
11
+ export declare const HoverHyperlinkMenu: (props: HoverHyperlinkMenuProps) => JSX.Element;
12
+ export {};
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ declare type HyperlinkMenuProps = {
3
+ url: string;
4
+ text: string;
5
+ pos: {
6
+ height: number;
7
+ width: number;
8
+ left: number;
9
+ right: number;
10
+ top: number;
11
+ bottom: number;
12
+ };
13
+ update: (url: string, text: string) => void;
14
+ remove: () => void;
15
+ };
16
+ /**
17
+ * Main menu component for the hyperlink extension.
18
+ * Either renders a menu to create/edit a hyperlink, or a menu to interact with it on mouse hover.
19
+ */
20
+ export declare const HyperlinkMenu: (props: HyperlinkMenuProps) => JSX.Element;
21
+ export {};
@@ -0,0 +1,39 @@
1
+ import { KeyboardEvent, PureComponent } from "react";
2
+ import { FocusEvent } from "react";
3
+ export interface Props {
4
+ autoFocus?: boolean | FocusOptions;
5
+ defaultValue?: string;
6
+ onChange?: (value: string) => void;
7
+ onSubmit?: (value: string) => void;
8
+ onCancel?: (e: KeyboardEvent) => void;
9
+ placeholder?: string;
10
+ onMouseDown?: Function;
11
+ onKeyDown?: (e: KeyboardEvent<any>) => void;
12
+ onUndo?: Function;
13
+ onRedo?: Function;
14
+ onBlur?: Function;
15
+ width?: number;
16
+ maxLength?: number;
17
+ testId?: string;
18
+ ariaLabel?: string;
19
+ id?: string;
20
+ }
21
+ export interface State {
22
+ value?: string;
23
+ }
24
+ export default class PanelTextInput extends PureComponent<Props, State> {
25
+ private input?;
26
+ private focusTimeoutId;
27
+ constructor(props: Props);
28
+ UNSAFE_componentWillReceiveProps(nextProps: Props): void;
29
+ componentWillUnmount(): void;
30
+ onMouseDown: () => void;
31
+ onBlur: (e: FocusEvent<any>) => void;
32
+ render(): JSX.Element;
33
+ focus(): void;
34
+ private handleChange;
35
+ private handleKeydown;
36
+ private isUndoEvent;
37
+ private isRedoEvent;
38
+ private handleRef;
39
+ }
@@ -0,0 +1,3 @@
1
+ export declare const N400 = "#505F79";
2
+ export declare const N800 = "#172B4D";
3
+ export declare const Input: import("styled-components").StyledComponent<"input", any, {}, never>;
@@ -0,0 +1,13 @@
1
+ export declare const N80 = "#97A0AF";
2
+ export declare const N30 = "#EBECF0";
3
+ export declare const RECENT_SEARCH_WIDTH_IN_PX = 420;
4
+ export declare const RECENT_SEARCH_WIDTH_WITHOUT_ITEMS_IN_PX = 360;
5
+ export declare const RECENT_SEARCH_HEIGHT_IN_PX = 360;
6
+ export declare const InputWrapper = "\n display: flex;\n line-height: 0;\n padding: 4px 0;\n align-items: center;\n";
7
+ export declare const UrlInputWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
8
+ export declare const Container: import("styled-components").StyledComponent<"div", any, {
9
+ provider: boolean;
10
+ }, never>;
11
+ export declare const TextInputWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
12
+ export declare const IconWrapper: import("styled-components").StyledComponent<"span", any, {}, never>;
13
+ export declare const ContainerWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
2
1
  import { Editor, Range } from "@tiptap/core";
3
2
  import SuggestionItem from "../../shared/plugins/suggestion/SuggestionItem";
3
+ import { IconType } from "react-icons";
4
4
  export declare type SlashMenuCallback = (editor: Editor, range: Range) => boolean;
5
5
  export declare enum SlashMenuGroups {
6
6
  HEADINGS = "Headings",
@@ -20,9 +20,7 @@ export declare class SlashMenuItem implements SuggestionItem {
20
20
  readonly group: SlashMenuGroups;
21
21
  readonly execute: SlashMenuCallback;
22
22
  readonly aliases: string[];
23
- readonly icon?: import("react").ComponentType<{
24
- className: string;
25
- }> | undefined;
23
+ readonly icon?: IconType | undefined;
26
24
  readonly hint?: string | undefined;
27
25
  readonly shortcut?: string | undefined;
28
26
  groupName: string;
@@ -34,10 +32,9 @@ export declare class SlashMenuItem implements SuggestionItem {
34
32
  * @param execute The callback for creating a new node
35
33
  * @param aliases Aliases for this command
36
34
  * @param icon To be shown next to the name in the menu
35
+ * @param hint Short description of command
37
36
  * @param shortcut Info about keyboard shortcut that would activate this command
38
37
  */
39
- constructor(name: string, group: SlashMenuGroups, execute: SlashMenuCallback, aliases?: string[], icon?: import("react").ComponentType<{
40
- className: string;
41
- }> | undefined, hint?: string | undefined, shortcut?: string | undefined);
38
+ constructor(name: string, group: SlashMenuGroups, execute: SlashMenuCallback, aliases?: string[], icon?: IconType | undefined, hint?: string | undefined, shortcut?: string | undefined);
42
39
  match(query: string): boolean;
43
40
  }
@@ -7,4 +7,7 @@ import { Extension } from "@tiptap/core";
7
7
  export interface TrailingNodeOptions {
8
8
  node: string;
9
9
  }
10
+ /**
11
+ * Add a trailing node to the document so the user can always click at the bottom of the document and start typing
12
+ */
10
13
  export declare const TrailingNode: Extension<TrailingNodeOptions, any>;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import { EditorConfig, ElementNode, LexicalNode, NodeKey, RangeSelection, SerializedElementNode, Spread, TextNode } from "lexical";
9
+ export declare type SerializedChildgroupNode = Spread<{
10
+ type: "childgroup";
11
+ version: 1;
12
+ }, SerializedElementNode>;
13
+ export declare class ChildgroupNode extends ElementNode {
14
+ static getType(): string;
15
+ static clone(node: ChildgroupNode): ChildgroupNode;
16
+ constructor(key?: NodeKey);
17
+ canBeEmpty(): boolean;
18
+ createDOM(_config: EditorConfig): HTMLElement;
19
+ updateDOM(_prevNode: TextNode, _dom: HTMLElement, _config: EditorConfig): boolean;
20
+ select(_anchorOffset?: number | undefined, _focusOffset?: number | undefined): RangeSelection;
21
+ selectStart(): RangeSelection;
22
+ insertBeforeDOM(dom: HTMLElement, childDOM: HTMLElement, referenceNode: Node | null): void;
23
+ static importJSON(_serializedNode: SerializedChildgroupNode): ChildgroupNode;
24
+ exportJSON(): SerializedChildgroupNode;
25
+ getClassName(): string;
26
+ }
27
+ export declare function $isChildgroupNode(node: LexicalNode | null | undefined): node is ChildgroupNode;
28
+ export declare function $createChildgroupNode(): ChildgroupNode;
@@ -0,0 +1 @@
1
+ export declare function patchNode(node: any): void;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function TreeViewPlugin(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { LexicalEditor } from "lexical";
2
+ export declare function registerAnimation(editor: LexicalEditor): () => void;
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { EditorState, EditorThemeClasses, Klass, LexicalEditor, LexicalNode } from "lexical";
3
+ export declare type InitialEditorStateType = null | string | EditorState | ((editor: LexicalEditor) => void);
4
+ declare type Props = {
5
+ children: JSX.Element | JSX.Element[];
6
+ initialConfig: Readonly<{
7
+ editor__DEPRECATED?: LexicalEditor | null;
8
+ namespace: string;
9
+ nodes?: ReadonlyArray<Klass<LexicalNode>>;
10
+ onError: (error: Error, editor: LexicalEditor) => void;
11
+ editable?: boolean;
12
+ theme?: EditorThemeClasses;
13
+ editorState?: InitialEditorStateType;
14
+ }>;
15
+ };
16
+ export declare function BlockNoteComposer({ initialConfig, children }: Props): JSX.Element;
17
+ export {};
@@ -0,0 +1 @@
1
+ export declare function BlockNotePlugin(_props: {}): null;
@@ -0,0 +1,3 @@
1
+ export * from "./BlockNoteComposer";
2
+ export * from "./BlockNotePlugin";
3
+ export * from "./useBlockNoteSetup";
@@ -0,0 +1,2 @@
1
+ import type { LexicalEditor } from "lexical";
2
+ export declare function useBlockNoteSetup(editor: LexicalEditor): void;
@@ -0,0 +1,2 @@
1
+ import type { LexicalEditor } from "lexical";
2
+ export declare function registerBlockNote(editor: LexicalEditor): () => void;
@@ -1,9 +1,8 @@
1
1
  import React from "react";
2
+ import { IconType } from "react-icons";
2
3
  export declare type SimpleToolbarButtonProps = {
3
4
  onClick?: (e: React.MouseEvent) => void;
4
- icon?: React.ComponentType<{
5
- className: string;
6
- }>;
5
+ icon?: IconType;
7
6
  mainTooltip: string;
8
7
  secondaryTooltip?: string;
9
8
  isSelected?: boolean;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { SimpleToolbarDropdownItemProps } from "./SimpleToolbarDropdownItem";
3
+ import { IconType } from "react-icons";
4
+ export declare type SimpleToolbarDropdownProps = {
5
+ text: string;
6
+ icon?: IconType;
7
+ items: Array<SimpleToolbarDropdownItemProps>;
8
+ children?: any;
9
+ isDisabled?: boolean;
10
+ };
11
+ export declare function SimpleToolbarDropdown(props: SimpleToolbarDropdownProps): JSX.Element;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { IconType } from "react-icons";
3
+ export declare type SimpleToolbarDropdownItemProps = {
4
+ onClick?: (e: React.MouseEvent) => void;
5
+ text: string;
6
+ icon?: IconType;
7
+ isSelected?: boolean;
8
+ children?: any;
9
+ isDisabled?: boolean;
10
+ };
11
+ export declare function SimpleToolbarDropdownItem(props: SimpleToolbarDropdownItemProps): JSX.Element;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import { ReactNode } from "react";
2
2
  export declare const Toolbar: (props: {
3
- children: any;
3
+ children: ReactNode;
4
4
  }) => JSX.Element;
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import { IconType } from "react-icons";
3
+ export declare type ToolbarButtonProps = {
4
+ onClick?: (e: React.MouseEvent) => void;
5
+ icon?: IconType;
6
+ mainTooltip: string;
7
+ secondaryTooltip?: string;
8
+ isSelected?: boolean;
9
+ children?: any;
10
+ isDisabled?: boolean;
11
+ };
12
+ /**
13
+ * Helper for basic buttons that show in the inline bubble menu.
14
+ */
15
+ export declare const ToolbarButton: React.ForwardRefExoticComponent<ToolbarButtonProps & React.RefAttributes<unknown>>;
@@ -0,0 +1,17 @@
1
+ import { IconType } from "react-icons";
2
+ import { MouseEvent } from "react";
3
+ export declare type ToolbarDropdownProps = {
4
+ text: string;
5
+ icon?: IconType;
6
+ items: Array<{
7
+ onClick?: (e: MouseEvent) => void;
8
+ text: string;
9
+ icon?: IconType;
10
+ isSelected?: boolean;
11
+ children?: any;
12
+ isDisabled?: boolean;
13
+ }>;
14
+ children?: any;
15
+ isDisabled?: boolean;
16
+ };
17
+ export declare function ToolbarDropdown(props: ToolbarDropdownProps): JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { IconType } from "react-icons";
2
+ import { MouseEvent } from "react";
3
+ export declare type ToolbarDropdownItemProps = {
4
+ onClick?: (e: MouseEvent) => void;
5
+ text: string;
6
+ icon?: IconType;
7
+ isSelected?: boolean;
8
+ children?: any;
9
+ isDisabled?: boolean;
10
+ };
11
+ export declare function ToolbarDropdownItem(props: ToolbarDropdownItemProps): JSX.Element;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { IconType } from "react-icons";
3
+ export declare type ToolbarDropdownTargetProps = {
4
+ text: string;
5
+ icon?: IconType;
6
+ isDisabled?: boolean;
7
+ };
8
+ export declare const ToolbarDropdownTarget: import("react").ForwardRefExoticComponent<ToolbarDropdownTargetProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import { IconType } from "react-icons";
2
2
  /**
3
3
  * A generic interface used in all suggestion menus (slash menu, mentions, etc)
4
4
  */
@@ -14,9 +14,7 @@ export default interface SuggestionItem {
14
14
  /**
15
15
  * The react icon
16
16
  */
17
- icon?: React.ComponentType<{
18
- className: string;
19
- }>;
17
+ icon?: IconType;
20
18
  hint?: string;
21
19
  shortcut?: string;
22
20
  /**
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import SuggestionItem from "../SuggestionItem";
3
+ export declare type SuggestionGroupItemProps<T> = {
4
+ item: T;
5
+ index: number;
6
+ selectedIndex?: number;
7
+ clickItem: (item: T) => void;
8
+ };
9
+ export declare function SuggestionGroupItem<T extends SuggestionItem>(props: SuggestionGroupItemProps<T>): JSX.Element;
@@ -1,26 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import SuggestionItem from "../SuggestionItem";
3
3
  export declare type SuggestionListProps<T> = {
4
- /**
5
- * Object containing all suggestion items, grouped by their `groupName`.
6
- */
7
4
  groups: {
8
5
  [groupName: string]: T[];
9
6
  };
10
- /**
11
- * The total number of suggestion-items
12
- */
13
7
  count: number;
14
- /**
15
- * This callback gets executed whenever an item is clicked on
16
- */
17
8
  onSelectItem: (item: T) => void;
18
- /**
19
- * The index of the item that is currently selected (but not yet clicked on)
20
- */
21
9
  selectedIndex: number;
22
10
  };
23
- /**
24
- * Stateless component that renders the suggestion list
25
- */
26
11
  export declare function SuggestionList<T extends SuggestionItem>(props: SuggestionListProps<T>): JSX.Element;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import type { EditorThemeClasses } from "lexical";
9
+ import "./BlockNoteEditorTheme.css";
10
+ declare const theme: EditorThemeClasses;
11
+ export { theme as defaultTheme };
@@ -4,5 +4,8 @@ declare type BlockNoteEditorOptions = EditorOptions & {
4
4
  enableBlockNoteExtensions: boolean;
5
5
  disableHistoryExtension: boolean;
6
6
  };
7
+ /**
8
+ * Main hook for importing a BlockNote editor into a react project
9
+ */
7
10
  export declare const useEditor: (options?: Partial<BlockNoteEditorOptions>, deps?: DependencyList) => import("@tiptap/react").Editor | null;
8
11
  export {};
@@ -0,0 +1,2 @@
1
+ export declare const isAppleOS: () => boolean;
2
+ export declare function formatKeyboardShortcut(shortcut: string): string;
@@ -1,26 +0,0 @@
1
- # Node structure
2
-
3
- We use the following document structure:
4
-
5
- ```xml
6
- <blockgroup>
7
- <block>
8
- <content>Parent element 1</content>
9
- <blockgroup>
10
- <block>
11
- <content>Nested / child / indented item</content>
12
- </block>
13
- </blockgroup>
14
- </block>
15
- <block>
16
- <content>Parent element 2</content>
17
- <blockgroup>
18
- <block>...</block>
19
- <block>...</block>
20
- </blockgroup>
21
- </block>
22
- <block>
23
- <content>Element 3 without children</content>
24
- </block>
25
- </blockgroup>
26
- ```
@@ -1,13 +0,0 @@
1
- .item_container {
2
- display: flex;
3
- flex-direction: row;
4
- justify-content: space-between;
5
- min-width: 100px;
6
- gap: 1em;
7
- }
8
- .logo_and_item_container {
9
- display: flex;
10
- flex-direction: row;
11
- justify-content: flex-start;
12
- gap: 0.5rem;
13
- }
@@ -1,25 +0,0 @@
1
- import { DropdownItem } from "@atlaskit/dropdown-menu";
2
- import { IconType } from "react-icons/lib";
3
- import { TiTick } from "react-icons/ti";
4
- import styles from "./DropdownBlockItem.module.css";
5
-
6
- interface DropdownBlockItemProps {
7
- title: string;
8
- icon: IconType;
9
- isSelected?: boolean;
10
- onClick?: () => void;
11
- }
12
- export default function DropdownBlockItem(props: DropdownBlockItemProps) {
13
- const ItemIcon = props.icon;
14
- return (
15
- <DropdownItem onClick={props.onClick}>
16
- <div className={`${styles.item_container}`}>
17
- <div className={`${styles.logo_and_item_container}`}>
18
- <ItemIcon />
19
- {props.title}
20
- </div>
21
- {props.isSelected && <TiTick />}
22
- </div>
23
- </DropdownItem>
24
- );
25
- }
@@ -1,33 +0,0 @@
1
- .dragHandle {
2
- /* position: absolute; */
3
- transition: opacity 300ms;
4
- width: 20px;
5
- height: 24px;
6
-
7
- background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -4 10 24"><path fill-opacity="0.2" d="M4 14c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zM2 6C.9 6 0 6.9 0 8s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6C.9 0 0 .9 0 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" /></svg>');
8
- background-repeat: no-repeat;
9
- background-size: contain;
10
- background-position: center;
11
- cursor: grab;
12
- border-radius: 3px;
13
- }
14
-
15
- /* .dragHandle:active {
16
- cursor: !important;
17
- } */
18
-
19
- .dragHandleAdd:hover,
20
- .dragHandle:hover {
21
- background-color: #eee;
22
- }
23
-
24
- .dragHandleAdd {
25
- /* position: absolute; */
26
- transition: opacity 300ms;
27
-
28
- background-repeat: no-repeat;
29
- background-size: contain;
30
- background-position: center;
31
- cursor: pointer;
32
- border-radius: 3px;
33
- }
@@ -1,10 +0,0 @@
1
- .menuList {
2
- color: var(--N800);
3
- background-color: white;
4
- border: 1px solid var(--N40);
5
- box-shadow: 0px 4px 8px rgba(9, 30, 66, 0.25),
6
- 0px 0px 1px rgba(9, 30, 66, 0.31);
7
- border-radius: 4px;
8
- max-width: 320;
9
- margin: 16px auto;
10
- }