@blocknote/core 0.1.0-alpha.3

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 (143) hide show
  1. package/README.md +99 -0
  2. package/dist/blocknote.js +4485 -0
  3. package/dist/blocknote.js.map +1 -0
  4. package/dist/blocknote.umd.cjs +90 -0
  5. package/dist/blocknote.umd.cjs.map +1 -0
  6. package/dist/style.css +1 -0
  7. package/package.json +109 -0
  8. package/src/BlockNoteExtensions.ts +90 -0
  9. package/src/EditorContent.tsx +1 -0
  10. package/src/assets/inter-v12-latin/inter-v12-latin-100.woff +0 -0
  11. package/src/assets/inter-v12-latin/inter-v12-latin-100.woff2 +0 -0
  12. package/src/assets/inter-v12-latin/inter-v12-latin-200.woff +0 -0
  13. package/src/assets/inter-v12-latin/inter-v12-latin-200.woff2 +0 -0
  14. package/src/assets/inter-v12-latin/inter-v12-latin-300.woff +0 -0
  15. package/src/assets/inter-v12-latin/inter-v12-latin-300.woff2 +0 -0
  16. package/src/assets/inter-v12-latin/inter-v12-latin-500.woff +0 -0
  17. package/src/assets/inter-v12-latin/inter-v12-latin-500.woff2 +0 -0
  18. package/src/assets/inter-v12-latin/inter-v12-latin-600.woff +0 -0
  19. package/src/assets/inter-v12-latin/inter-v12-latin-600.woff2 +0 -0
  20. package/src/assets/inter-v12-latin/inter-v12-latin-700.woff +0 -0
  21. package/src/assets/inter-v12-latin/inter-v12-latin-700.woff2 +0 -0
  22. package/src/assets/inter-v12-latin/inter-v12-latin-800.woff +0 -0
  23. package/src/assets/inter-v12-latin/inter-v12-latin-800.woff2 +0 -0
  24. package/src/assets/inter-v12-latin/inter-v12-latin-900.woff +0 -0
  25. package/src/assets/inter-v12-latin/inter-v12-latin-900.woff2 +0 -0
  26. package/src/assets/inter-v12-latin/inter-v12-latin-regular.woff +0 -0
  27. package/src/assets/inter-v12-latin/inter-v12-latin-regular.woff2 +0 -0
  28. package/src/editor.module.css +3 -0
  29. package/src/extensions/Blocks/OrderedListPlugin.ts +46 -0
  30. package/src/extensions/Blocks/PreviousBlockTypePlugin.ts +146 -0
  31. package/src/extensions/Blocks/commands/joinBackward.ts +274 -0
  32. package/src/extensions/Blocks/helpers/findBlock.ts +3 -0
  33. package/src/extensions/Blocks/helpers/setBlockHeading.ts +30 -0
  34. package/src/extensions/Blocks/index.ts +15 -0
  35. package/src/extensions/Blocks/nodes/Block.module.css +226 -0
  36. package/src/extensions/Blocks/nodes/Block.ts +390 -0
  37. package/src/extensions/Blocks/nodes/BlockGroup.ts +28 -0
  38. package/src/extensions/Blocks/nodes/Content.ts +50 -0
  39. package/src/extensions/Blocks/nodes/README.md +26 -0
  40. package/src/extensions/Blocks/rule.ts +48 -0
  41. package/src/extensions/BubbleMenu/BubbleMenuExtension.tsx +28 -0
  42. package/src/extensions/BubbleMenu/BubbleMenuPlugin.ts +245 -0
  43. package/src/extensions/BubbleMenu/component/BubbleMenu.tsx +216 -0
  44. package/src/extensions/BubbleMenu/component/DropdownBlockItem.module.css +13 -0
  45. package/src/extensions/BubbleMenu/component/DropdownBlockItem.tsx +25 -0
  46. package/src/extensions/BubbleMenu/component/LinkToolbarButton.tsx +67 -0
  47. package/src/extensions/DraggableBlocks/DraggableBlocksExtension.ts +15 -0
  48. package/src/extensions/DraggableBlocks/DraggableBlocksPlugin.tsx +266 -0
  49. package/src/extensions/DraggableBlocks/components/DragHandle.module.css +33 -0
  50. package/src/extensions/DraggableBlocks/components/DragHandle.tsx +108 -0
  51. package/src/extensions/DraggableBlocks/components/DragHandleMenu.module.css +10 -0
  52. package/src/extensions/DraggableBlocks/components/DragHandleMenu.tsx +18 -0
  53. package/src/extensions/Hyperlinks/HyperlinkMark.tsx +16 -0
  54. package/src/extensions/Hyperlinks/HyperlinkMenuPlugin.tsx +200 -0
  55. package/src/extensions/Hyperlinks/menus/HyperlinkBasicMenu.tsx +59 -0
  56. package/src/extensions/Hyperlinks/menus/HyperlinkEditMenu.tsx +72 -0
  57. package/src/extensions/Hyperlinks/menus/atlaskit/PanelTextInput.tsx +173 -0
  58. package/src/extensions/Hyperlinks/menus/atlaskit/PanelTextInputStyles.ts +36 -0
  59. package/src/extensions/Hyperlinks/menus/atlaskit/README.md +1 -0
  60. package/src/extensions/Hyperlinks/menus/atlaskit/ToolbarComponent.tsx +61 -0
  61. package/src/extensions/Paragraph/FixedParagraph.ts +12 -0
  62. package/src/extensions/Placeholder/PlaceholderExtension.ts +127 -0
  63. package/src/extensions/SlashMenu/SlashMenuExtension.ts +43 -0
  64. package/src/extensions/SlashMenu/SlashMenuItem.ts +56 -0
  65. package/src/extensions/SlashMenu/defaultCommands.tsx +229 -0
  66. package/src/extensions/SlashMenu/index.ts +11 -0
  67. package/src/extensions/TrailingNode/TrailingNodeExtension.ts +70 -0
  68. package/src/extensions/UniqueID/UniqueID.ts +281 -0
  69. package/src/extensions/helpers/formatKeyboardShortcut.ts +9 -0
  70. package/src/fonts-inter.css +94 -0
  71. package/src/globals.css +28 -0
  72. package/src/index.ts +5 -0
  73. package/src/lib/atlaskit/browser.ts +47 -0
  74. package/src/root.module.css +19 -0
  75. package/src/shared/components/toolbar/SimpleToolbarButton.module.css +13 -0
  76. package/src/shared/components/toolbar/SimpleToolbarButton.tsx +56 -0
  77. package/src/shared/components/toolbar/Toolbar.module.css +10 -0
  78. package/src/shared/components/toolbar/Toolbar.tsx +5 -0
  79. package/src/shared/components/toolbar/ToolbarSeparator.module.css +13 -0
  80. package/src/shared/components/toolbar/ToolbarSeparator.tsx +7 -0
  81. package/src/shared/components/tooltip/TooltipContent.module.css +15 -0
  82. package/src/shared/components/tooltip/TooltipContent.tsx +23 -0
  83. package/src/shared/hooks/useEditorForceUpdate.tsx +30 -0
  84. package/src/shared/plugins/suggestion/SuggestionItem.ts +31 -0
  85. package/src/shared/plugins/suggestion/SuggestionListReactRenderer.ts +227 -0
  86. package/src/shared/plugins/suggestion/SuggestionPlugin.ts +365 -0
  87. package/src/shared/plugins/suggestion/components/SuggestionGroup.module.css +45 -0
  88. package/src/shared/plugins/suggestion/components/SuggestionGroup.tsx +134 -0
  89. package/src/shared/plugins/suggestion/components/SuggestionList.module.css +10 -0
  90. package/src/shared/plugins/suggestion/components/SuggestionList.tsx +91 -0
  91. package/src/style.css +7 -0
  92. package/src/useEditor.ts +47 -0
  93. package/src/vite-env.d.ts +1 -0
  94. package/types/src/BlockNoteExtensions.d.ts +4 -0
  95. package/types/src/EditorContent.d.ts +1 -0
  96. package/types/src/extensions/Blocks/OrderedListPlugin.d.ts +2 -0
  97. package/types/src/extensions/Blocks/PreviousBlockTypePlugin.d.ts +13 -0
  98. package/types/src/extensions/Blocks/commands/joinBackward.d.ts +14 -0
  99. package/types/src/extensions/Blocks/helpers/findBlock.d.ts +6 -0
  100. package/types/src/extensions/Blocks/helpers/setBlockHeading.d.ts +5 -0
  101. package/types/src/extensions/Blocks/index.d.ts +1 -0
  102. package/types/src/extensions/Blocks/nodes/Block.d.ts +32 -0
  103. package/types/src/extensions/Blocks/nodes/BlockGroup.d.ts +2 -0
  104. package/types/src/extensions/Blocks/nodes/Content.d.ts +5 -0
  105. package/types/src/extensions/Blocks/rule.d.ts +16 -0
  106. package/types/src/extensions/BubbleMenu/BubbleMenuExtension.d.ts +5 -0
  107. package/types/src/extensions/BubbleMenu/BubbleMenuPlugin.d.ts +46 -0
  108. package/types/src/extensions/BubbleMenu/component/BubbleMenu.d.ts +5 -0
  109. package/types/src/extensions/BubbleMenu/component/DropdownBlockItem.d.ts +10 -0
  110. package/types/src/extensions/BubbleMenu/component/LinkToolbarButton.d.ts +11 -0
  111. package/types/src/extensions/DraggableBlocks/DraggableBlocksExtension.d.ts +7 -0
  112. package/types/src/extensions/DraggableBlocks/DraggableBlocksPlugin.d.ts +18 -0
  113. package/types/src/extensions/DraggableBlocks/components/DragHandle.d.ts +12 -0
  114. package/types/src/extensions/DraggableBlocks/components/DragHandleMenu.d.ts +6 -0
  115. package/types/src/extensions/Hyperlinks/HyperlinkMark.d.ts +7 -0
  116. package/types/src/extensions/Hyperlinks/HyperlinkMenuPlugin.d.ts +2 -0
  117. package/types/src/extensions/Hyperlinks/menus/HyperlinkBasicMenu.d.ts +12 -0
  118. package/types/src/extensions/Hyperlinks/menus/HyperlinkEditMenu.d.ts +10 -0
  119. package/types/src/extensions/Hyperlinks/menus/atlaskit/PanelTextInput.d.ts +39 -0
  120. package/types/src/extensions/Hyperlinks/menus/atlaskit/PanelTextInputStyles.d.ts +1 -0
  121. package/types/src/extensions/Hyperlinks/menus/atlaskit/ToolbarComponent.d.ts +11 -0
  122. package/types/src/extensions/Paragraph/FixedParagraph.d.ts +1 -0
  123. package/types/src/extensions/Placeholder/PlaceholderExtension.d.ts +25 -0
  124. package/types/src/extensions/SlashMenu/SlashMenuExtension.d.ts +10 -0
  125. package/types/src/extensions/SlashMenu/SlashMenuItem.d.ts +43 -0
  126. package/types/src/extensions/SlashMenu/defaultCommands.d.ts +8 -0
  127. package/types/src/extensions/SlashMenu/index.d.ts +5 -0
  128. package/types/src/extensions/TrailingNode/TrailingNodeExtension.d.ts +10 -0
  129. package/types/src/extensions/UniqueID/UniqueID.d.ts +3 -0
  130. package/types/src/extensions/helpers/formatKeyboardShortcut.d.ts +1 -0
  131. package/types/src/index.d.ts +4 -0
  132. package/types/src/lib/atlaskit/browser.d.ts +12 -0
  133. package/types/src/shared/components/toolbar/SimpleToolbarButton.d.ts +16 -0
  134. package/types/src/shared/components/toolbar/Toolbar.d.ts +4 -0
  135. package/types/src/shared/components/toolbar/ToolbarSeparator.d.ts +2 -0
  136. package/types/src/shared/components/tooltip/TooltipContent.d.ts +15 -0
  137. package/types/src/shared/hooks/useEditorForceUpdate.d.ts +2 -0
  138. package/types/src/shared/plugins/suggestion/SuggestionItem.d.ts +29 -0
  139. package/types/src/shared/plugins/suggestion/SuggestionListReactRenderer.d.ts +71 -0
  140. package/types/src/shared/plugins/suggestion/SuggestionPlugin.d.ts +74 -0
  141. package/types/src/shared/plugins/suggestion/components/SuggestionGroup.d.ts +23 -0
  142. package/types/src/shared/plugins/suggestion/components/SuggestionList.d.ts +26 -0
  143. package/types/src/useEditor.d.ts +8 -0
@@ -0,0 +1,4 @@
1
+ import { Extensions } from "@tiptap/core";
2
+ import { Node } from "@tiptap/core";
3
+ export declare const Document: Node<any, any>;
4
+ export declare const getBlockNoteExtensions: () => Extensions;
@@ -0,0 +1 @@
1
+ export { EditorContent } from "@tiptap/react";
@@ -0,0 +1,2 @@
1
+ import { Plugin } from "prosemirror-state";
2
+ export declare const OrderedListPlugin: () => Plugin<any>;
@@ -0,0 +1,13 @@
1
+ import { Plugin } from "prosemirror-state";
2
+ /**
3
+ * This plugin tracks transformation of Block node attributes, so we can support CSS transitions.
4
+ *
5
+ * Problem it solves: Prosemirror recreates the DOM when transactions happen. So when a transaction changes an Node attribute,
6
+ * it results in a completely new DOM element. This means CSS transitions don't work.
7
+ *
8
+ * Solution: When attributes change on a node, this plugin sets a data-* attribute with the "previous" value. This way we can still use CSS transitions. (See block.module.css)
9
+ */
10
+ export declare const PreviousBlockTypePlugin: () => Plugin<{
11
+ prevBlockAttrs: any;
12
+ needsUpdate: boolean;
13
+ }>;
@@ -0,0 +1,14 @@
1
+ import { Command } from "prosemirror-state";
2
+ /**
3
+ * Code taken from https://github.com/ProseMirror/prosemirror-commands/blob/97a8cb5fac25e697d4693ce343e2e3b020a7fa2f/src/commands.ts
4
+ * Reason for modification: https://github.com/YousefED/BlockNote/pull/11
5
+ *
6
+ * BlockA
7
+ * BlockB
8
+ * Order of behavior has been switched to make first and second blocks content
9
+ * merge before trying to add second block as child of first
10
+ *
11
+ * behavior responsible for joining BlockB as A child of BlockA moved to (line 379 - 393 original file) after
12
+ * behavior responsible for joining content of BlockA and BlockB (line 402 - 422 original file)
13
+ */
14
+ export declare const joinBackward: Command;
@@ -0,0 +1,6 @@
1
+ export declare const findBlock: (selection: import("prosemirror-state").Selection) => {
2
+ pos: number;
3
+ start: number;
4
+ depth: number;
5
+ node: import("prosemirror-model").Node;
6
+ } | undefined;
@@ -0,0 +1,5 @@
1
+ import { Transaction } from "prosemirror-state";
2
+ import { Level } from "../nodes/Block";
3
+ declare type Dispatch = ((args?: any) => any) | undefined;
4
+ export declare function setBlockHeading(tr: Transaction, dispatch: Dispatch, level?: Level): boolean;
5
+ export {};
@@ -0,0 +1 @@
1
+ export declare const blocks: any[];
@@ -0,0 +1,32 @@
1
+ import { Node } from "@tiptap/core";
2
+ export interface IBlock {
3
+ HTMLAttributes: Record<string, any>;
4
+ }
5
+ export declare type Level = 1 | 2 | 3;
6
+ export declare type ListType = "li" | "oli";
7
+ declare module "@tiptap/core" {
8
+ interface Commands<ReturnType> {
9
+ blockHeading: {
10
+ /**
11
+ * Set a heading node
12
+ */
13
+ setBlockHeading: (attributes: {
14
+ level: Level;
15
+ }) => ReturnType;
16
+ /**
17
+ * Unset a heading node
18
+ */
19
+ unsetBlockHeading: () => ReturnType;
20
+ unsetList: () => ReturnType;
21
+ addNewBlockAsSibling: (attributes?: {
22
+ headingType?: Level;
23
+ listType?: ListType;
24
+ }) => ReturnType;
25
+ setBlockList: (type: ListType) => ReturnType;
26
+ };
27
+ }
28
+ }
29
+ /**
30
+ * The main "Block node" documents consist of
31
+ */
32
+ export declare const Block: Node<IBlock, any>;
@@ -0,0 +1,2 @@
1
+ import { Node } from "@tiptap/core";
2
+ export declare const BlockGroup: Node<any, any>;
@@ -0,0 +1,5 @@
1
+ import { Node } from "@tiptap/core";
2
+ export interface IBlock {
3
+ HTMLAttributes: Record<string, any>;
4
+ }
5
+ export declare const ContentBlock: Node<IBlock, any>;
@@ -0,0 +1,16 @@
1
+ import { ExtendedRegExpMatchArray, InputRule, InputRuleFinder } from "@tiptap/core";
2
+ import { NodeType } from "prosemirror-model";
3
+ /**
4
+ * Modified version of https://github.com/ueberdosis/tiptap/blob/6a813686f5e87cebac49a624936dbeadb5a29f95/packages/core/src/inputRules/textblockTypeInputRule.ts
5
+ * But instead of changing the type of a node, we use setNodeMarkup to change some of it's current attributes
6
+ *
7
+ * Build an input rule that changes the type of a textblock when the
8
+ * matched text is typed into it. When using a regular expresion you’ll
9
+ * probably want the regexp to start with `^`, so that the pattern can
10
+ * only occur at the start of a textblock.
11
+ */
12
+ export declare function textblockTypeInputRuleSameNodeType(config: {
13
+ find: InputRuleFinder;
14
+ type: NodeType;
15
+ getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
16
+ }): InputRule;
@@ -0,0 +1,5 @@
1
+ import { Extension } from "@tiptap/core";
2
+ /**
3
+ * The menu that is displayed when selecting a piece of text.
4
+ */
5
+ export declare const BubbleMenuExtension: Extension<{}, any>;
@@ -0,0 +1,46 @@
1
+ import { Editor } from "@tiptap/core";
2
+ import { EditorState, Plugin, PluginKey } from "prosemirror-state";
3
+ import { EditorView } from "prosemirror-view";
4
+ import { Instance, Props } from "tippy.js";
5
+ export interface BubbleMenuPluginProps {
6
+ pluginKey: PluginKey | string;
7
+ editor: Editor;
8
+ element: HTMLElement;
9
+ tippyOptions?: Partial<Props>;
10
+ shouldShow?: ((props: {
11
+ editor: Editor;
12
+ view: EditorView;
13
+ state: EditorState;
14
+ oldState?: EditorState;
15
+ from: number;
16
+ to: number;
17
+ }) => boolean) | null;
18
+ }
19
+ export declare type BubbleMenuViewProps = BubbleMenuPluginProps & {
20
+ view: EditorView;
21
+ };
22
+ export declare class BubbleMenuView {
23
+ editor: Editor;
24
+ element: HTMLElement;
25
+ view: EditorView;
26
+ preventHide: boolean;
27
+ preventShow: boolean;
28
+ tippy: Instance | undefined;
29
+ tippyOptions?: Partial<Props>;
30
+ shouldShow: Exclude<BubbleMenuPluginProps["shouldShow"], null>;
31
+ constructor({ editor, element, view, tippyOptions, shouldShow, }: BubbleMenuViewProps);
32
+ mousedownHandler: () => void;
33
+ viewMousedownHandler: () => void;
34
+ viewMouseupHandler: () => void;
35
+ dragstartHandler: () => void;
36
+ focusHandler: () => void;
37
+ blurHandler: ({ event }: {
38
+ event: FocusEvent;
39
+ }) => void;
40
+ createTooltip(): void;
41
+ update(view: EditorView, oldState?: EditorState): void;
42
+ show(): void;
43
+ hide(): void;
44
+ destroy(): void;
45
+ }
46
+ export declare const createBubbleMenuPlugin: (options: BubbleMenuPluginProps) => Plugin<any>;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { Editor } from "@tiptap/core";
3
+ export declare const BubbleMenu: (props: {
4
+ editor: Editor;
5
+ }) => JSX.Element;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { IconType } from "react-icons/lib";
3
+ interface DropdownBlockItemProps {
4
+ title: string;
5
+ icon: IconType;
6
+ isSelected?: boolean;
7
+ onClick?: () => void;
8
+ }
9
+ export default function DropdownBlockItem(props: DropdownBlockItemProps): JSX.Element;
10
+ export {};
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { Editor } from "@tiptap/core";
3
+ import { SimpleToolbarButtonProps } from "../../../shared/components/toolbar/SimpleToolbarButton";
4
+ declare type Props = SimpleToolbarButtonProps & {
5
+ editor: Editor;
6
+ };
7
+ /**
8
+ * The link menu button opens a tooltip on click
9
+ */
10
+ export declare const LinkToolbarButton: (props: Props) => JSX.Element;
11
+ export default LinkToolbarButton;
@@ -0,0 +1,7 @@
1
+ import { Extension } from "@tiptap/core";
2
+ /**
3
+ * This extension adds a drag handle in front of all nodes with a "data-id" attribute
4
+ *
5
+ * code based on https://github.com/ueberdosis/tiptap/issues/323#issuecomment-506637799
6
+ */
7
+ export declare const DraggableBlocksExtension: Extension<{}, any>;
@@ -0,0 +1,18 @@
1
+ import { Plugin } from "prosemirror-state";
2
+ export declare function createRect(rect: DOMRect): {
3
+ left: number;
4
+ top: number;
5
+ width: number;
6
+ height: number;
7
+ bottom: number;
8
+ right: number;
9
+ };
10
+ export declare function absoluteRect(element: HTMLElement): {
11
+ left: number;
12
+ top: number;
13
+ width: number;
14
+ height: number;
15
+ bottom: number;
16
+ right: number;
17
+ };
18
+ export declare const createDraggableBlocksPlugin: () => Plugin<any>;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { EditorView } from "prosemirror-view";
3
+ export declare const DragHandle: (props: {
4
+ view: EditorView;
5
+ coords: {
6
+ left: number;
7
+ top: number;
8
+ };
9
+ onShow?: () => void;
10
+ onHide?: () => void;
11
+ onAddClicked?: () => void;
12
+ }) => JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare type Props = {
3
+ onDelete: () => void;
4
+ };
5
+ declare const DragHandleMenu: (props: Props) => JSX.Element;
6
+ export default DragHandleMenu;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This custom link includes a special menu for editing/deleting/opening the link.
3
+ * The menu will be triggered by hovering over the link with the mouse,
4
+ * or by moving the cursor inside the link text
5
+ */
6
+ declare const Hyperlink: import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any>;
7
+ export default Hyperlink;
@@ -0,0 +1,2 @@
1
+ import { Plugin } from "prosemirror-state";
2
+ export declare const createHyperlinkMenuPlugin: () => Plugin<any>;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ declare type HyperlinkMenuProps = {
3
+ href: string;
4
+ removeHandler: () => void;
5
+ editMenu: React.ReactElement;
6
+ };
7
+ /**
8
+ * A hyperlink menu shown when an anchor is hovered over.
9
+ * It shows options to edit / remove / open the link
10
+ */
11
+ export declare const HyperlinkBasicMenu: (props: HyperlinkMenuProps) => JSX.Element;
12
+ export {};
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ export declare type HyperlinkEditorMenuProps = {
3
+ url: string;
4
+ text: string;
5
+ onSubmit: (url: string, text: string) => void;
6
+ };
7
+ /**
8
+ * The sub menu for editing an anchor element
9
+ */
10
+ export declare const HyperlinkEditMenu: (props: HyperlinkEditorMenuProps) => JSX.Element;
@@ -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 @@
1
+ export declare const Input: import("styled-components").StyledComponent<"input", any, {}, never>;
@@ -0,0 +1,11 @@
1
+ export declare const RECENT_SEARCH_WIDTH_IN_PX = 420;
2
+ export declare const RECENT_SEARCH_WIDTH_WITHOUT_ITEMS_IN_PX = 360;
3
+ export declare const RECENT_SEARCH_HEIGHT_IN_PX = 360;
4
+ export declare const InputWrapper = "\n display: flex;\n line-height: 0;\n padding: 4px 0;\n align-items: center;\n";
5
+ export declare const UrlInputWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
6
+ export declare const Container: import("styled-components").StyledComponent<"div", any, {
7
+ provider: boolean;
8
+ }, never>;
9
+ export declare const TextInputWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
10
+ export declare const IconWrapper: import("styled-components").StyledComponent<"span", any, {}, never>;
11
+ export declare const ContainerWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1 @@
1
+ export declare const FixedParagraph: import("@tiptap/core").Node<import("@tiptap/extension-paragraph").ParagraphOptions, any>;
@@ -0,0 +1,25 @@
1
+ import { Editor, Extension } from "@tiptap/core";
2
+ import { Node as ProsemirrorNode } from "prosemirror-model";
3
+ /**
4
+ * This is a modified version of the tiptap
5
+ * placeholder plugin, that also sets hasAnchorClass
6
+ *
7
+ * It does not set a data-placeholder (text is currently done in css)
8
+ *
9
+ */
10
+ export interface PlaceholderOptions {
11
+ emptyEditorClass: string;
12
+ emptyNodeClass: string;
13
+ isFilterClass: string;
14
+ hasAnchorClass: string;
15
+ placeholder: ((PlaceholderProps: {
16
+ editor: Editor;
17
+ node: ProsemirrorNode;
18
+ pos: number;
19
+ hasAnchor: boolean;
20
+ }) => string) | string;
21
+ showOnlyWhenEditable: boolean;
22
+ showOnlyCurrent: boolean;
23
+ includeChildren: boolean;
24
+ }
25
+ export declare const Placeholder: Extension<PlaceholderOptions, any>;
@@ -0,0 +1,10 @@
1
+ import { Extension } from "@tiptap/core";
2
+ import { SlashMenuItem } from "./SlashMenuItem";
3
+ import { PluginKey } from "prosemirror-state";
4
+ export declare type SlashMenuOptions = {
5
+ commands: {
6
+ [key: string]: SlashMenuItem;
7
+ };
8
+ };
9
+ export declare const SlashMenuPluginKey: PluginKey<any>;
10
+ export declare const SlashMenuExtension: Extension<SlashMenuOptions, any>;
@@ -0,0 +1,43 @@
1
+ /// <reference types="react" />
2
+ import { Editor, Range } from "@tiptap/core";
3
+ import SuggestionItem from "../../shared/plugins/suggestion/SuggestionItem";
4
+ export declare type SlashMenuCallback = (editor: Editor, range: Range) => boolean;
5
+ export declare enum SlashMenuGroups {
6
+ HEADINGS = "Headings",
7
+ BASIC_BLOCKS = "Basic Blocks",
8
+ CODE = "Code Blocks",
9
+ INLINE = "Inline",
10
+ EMBED = "Embed",
11
+ PLUGIN = "Plugin"
12
+ }
13
+ /**
14
+ * A class that defines a slash command (/<command>).
15
+ *
16
+ * Not to be confused with ProseMirror commands nor TipTap commands.
17
+ */
18
+ export declare class SlashMenuItem implements SuggestionItem {
19
+ readonly name: string;
20
+ readonly group: SlashMenuGroups;
21
+ readonly execute: SlashMenuCallback;
22
+ readonly aliases: string[];
23
+ readonly icon?: import("react").ComponentType<{
24
+ className: string;
25
+ }> | undefined;
26
+ readonly hint?: string | undefined;
27
+ readonly shortcut?: string | undefined;
28
+ groupName: string;
29
+ /**
30
+ * Constructs a new slash-command.
31
+ *
32
+ * @param name The name of the command
33
+ * @param group Used to organize the menu
34
+ * @param execute The callback for creating a new node
35
+ * @param aliases Aliases for this command
36
+ * @param icon To be shown next to the name in the menu
37
+ * @param shortcut Info about keyboard shortcut that would activate this command
38
+ */
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);
42
+ match(query: string): boolean;
43
+ }
@@ -0,0 +1,8 @@
1
+ import { SlashMenuItem } from "./SlashMenuItem";
2
+ /**
3
+ * An array containing commands for creating all default blocks.
4
+ */
5
+ declare const defaultCommands: {
6
+ [key: string]: SlashMenuItem;
7
+ };
8
+ export default defaultCommands;
@@ -0,0 +1,5 @@
1
+ import { SlashMenuExtension } from "./SlashMenuExtension";
2
+ import defaultCommands from "./defaultCommands";
3
+ import { SlashMenuGroups, SlashMenuItem } from "./SlashMenuItem";
4
+ export { defaultCommands, SlashMenuItem as SlashCommand, SlashMenuGroups as CommandGroup, };
5
+ export default SlashMenuExtension;
@@ -0,0 +1,10 @@
1
+ import { Extension } from "@tiptap/core";
2
+ /**
3
+ * Extension based on:
4
+ * - https://github.com/ueberdosis/tiptap/blob/v1/packages/tiptap-extensions/src/extensions/TrailingNode.js
5
+ * - https://github.com/remirror/remirror/blob/e0f1bec4a1e8073ce8f5500d62193e52321155b9/packages/prosemirror-trailing-node/src/trailing-node-plugin.ts
6
+ */
7
+ export interface TrailingNodeOptions {
8
+ node: string;
9
+ }
10
+ export declare const TrailingNode: Extension<TrailingNodeOptions, any>;
@@ -0,0 +1,3 @@
1
+ import { Extension } from "@tiptap/core";
2
+ declare const UniqueID: Extension<any, any>;
3
+ export { UniqueID, UniqueID as default };
@@ -0,0 +1 @@
1
+ export default function formatKeyboardShortcut(shortcut: string): string;
@@ -0,0 +1,4 @@
1
+ import "./globals.css";
2
+ export * from "./BlockNoteExtensions";
3
+ export * from "./EditorContent";
4
+ export * from "./useEditor";
@@ -0,0 +1,12 @@
1
+ declare const result: {
2
+ mac: boolean;
3
+ ie: boolean;
4
+ ie_version: number;
5
+ gecko: boolean;
6
+ chrome: boolean;
7
+ chrome_version: number;
8
+ android: boolean;
9
+ ios: boolean;
10
+ webkit: boolean;
11
+ };
12
+ export default result;
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ export declare type SimpleToolbarButtonProps = {
3
+ onClick?: (e: React.MouseEvent) => void;
4
+ icon?: React.ComponentType<{
5
+ className: string;
6
+ }>;
7
+ mainTooltip: string;
8
+ secondaryTooltip?: string;
9
+ isSelected?: boolean;
10
+ children?: any;
11
+ isDisabled?: boolean;
12
+ };
13
+ /**
14
+ * Helper for basic buttons that show in the inline bubble menu.
15
+ */
16
+ export declare const SimpleToolbarButton: React.ForwardRefExoticComponent<SimpleToolbarButtonProps & React.RefAttributes<unknown>>;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare const Toolbar: (props: {
3
+ children: any;
4
+ }) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const ToolbarSeparator: () => JSX.Element;
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Helper for the tooltip for inline bubble menu buttons.
4
+ *
5
+ * Often used to display a tooltip showing the command name + keyboard shortcut, e.g.:
6
+ *
7
+ * Bold
8
+ * Ctrl+B
9
+ *
10
+ * TODO: maybe use default Tippy styles instead?
11
+ */
12
+ export declare const TooltipContent: (props: {
13
+ mainTooltip: string;
14
+ secondaryTooltip?: string;
15
+ }) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { Editor } from "@tiptap/core";
2
+ export declare const useEditorForceUpdate: (editor: Editor) => void;
@@ -0,0 +1,29 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * A generic interface used in all suggestion menus (slash menu, mentions, etc)
4
+ */
5
+ export default interface SuggestionItem {
6
+ /**
7
+ * The name of the item
8
+ */
9
+ name: string;
10
+ /**
11
+ * The name of the group to which this item belongs
12
+ */
13
+ groupName: string;
14
+ /**
15
+ * The react icon
16
+ */
17
+ icon?: React.ComponentType<{
18
+ className: string;
19
+ }>;
20
+ hint?: string;
21
+ shortcut?: string;
22
+ /**
23
+ * This function matches this item against a query string, the function should return **true** if the item
24
+ * matches the query or **false** otherwise.
25
+ *
26
+ * @param query the query string
27
+ */
28
+ match(query: string): boolean;
29
+ }
@@ -0,0 +1,71 @@
1
+ import { Editor } from "@tiptap/core";
2
+ import SuggestionItem from "./SuggestionItem";
3
+ /**
4
+ * The interface that each suggestion renderer should conform to.
5
+ */
6
+ export interface SuggestionRenderer<T extends SuggestionItem> {
7
+ /**
8
+ * Disposes of the suggestion menu.
9
+ */
10
+ onExit?: (props: SuggestionRendererProps<T>) => void;
11
+ /**
12
+ * Updates the suggestion menu.
13
+ *
14
+ * This function should be called when the renderer's `props` change,
15
+ * after `onStart` has been called.
16
+ */
17
+ onUpdate?: (props: SuggestionRendererProps<T>) => void;
18
+ /**
19
+ * Creates and displays a new suggestion menu popup.
20
+ */
21
+ onStart?: (props: SuggestionRendererProps<T>) => void;
22
+ /**
23
+ * Function for handling key events
24
+ */
25
+ onKeyDown?: (event: KeyboardEvent) => boolean;
26
+ /**
27
+ * The DOM Element representing the suggestion menu
28
+ */
29
+ getComponent: () => Element | undefined;
30
+ }
31
+ export declare type SuggestionRendererProps<T extends SuggestionItem> = {
32
+ /**
33
+ * Object containing all suggestion items, grouped by their `groupName`.
34
+ */
35
+ groups: {
36
+ [groupName: string]: T[];
37
+ };
38
+ /**
39
+ * The total number of suggestion-items.
40
+ */
41
+ count: number;
42
+ /**
43
+ * This callback is executed whenever the user selects an item.
44
+ *
45
+ * @param item the selected item
46
+ */
47
+ onSelectItem: (item: T) => void;
48
+ /**
49
+ * A function returning the client rect to use as reference for positioning the suggestion menu popup.
50
+ */
51
+ clientRect: (() => DOMRect) | null;
52
+ /**
53
+ * This callback is executed when the suggestion menu needs to be closed,
54
+ * e.g. when the user presses escape.
55
+ */
56
+ onClose: () => void;
57
+ };
58
+ /**
59
+ * This function creates a SuggestionRenderer based on TipTap's ReactRenderer utility.
60
+ *
61
+ * The resulting renderer can be used to display a suggestion menu containing (grouped) suggestion items.
62
+ *
63
+ * This renderer also takes care of the following key events:
64
+ * - Key up/down, for navigating the suggestion menu (selecting different items)
65
+ * - Enter for picking the currently selected item and closing the menu
66
+ * - Escape to close the menu, without taking action
67
+ *
68
+ * @param editor the TipTap editor
69
+ * @returns the newly constructed SuggestionRenderer
70
+ */
71
+ export default function createRenderer<T extends SuggestionItem>(editor: Editor): SuggestionRenderer<T>;