@blocknote/core 0.19.0 → 0.19.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.
- package/README.md +2 -0
- package/dist/blocknote.js +2549 -2497
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +6 -6
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.test.js +5 -1
- package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.test.js.map +1 -1
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js +2 -40
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js.map +1 -1
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js +4 -0
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js.map +1 -1
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js +51 -9
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js.map +1 -1
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js +2 -2
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js.map +1 -1
- package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js +1 -1
- package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js.map +1 -1
- package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js +4 -2
- package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js.map +1 -1
- package/dist/src/api/getBlockInfoFromPos.js +19 -25
- package/dist/src/api/getBlockInfoFromPos.js.map +1 -1
- package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js +8 -4
- package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js.map +1 -1
- package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js +5 -3
- package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js.map +1 -1
- package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js +12 -6
- package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js.map +1 -1
- package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js +5 -1
- package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js.map +1 -1
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js +4 -2
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js.map +1 -1
- package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js +2 -1
- package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js.map +1 -1
- package/dist/src/blocks/TableBlockContent/TableBlockContent.js +0 -1
- package/dist/src/blocks/TableBlockContent/TableBlockContent.js.map +1 -1
- package/dist/src/editor/BlockNoteEditor.js +39 -43
- package/dist/src/editor/BlockNoteEditor.js.map +1 -1
- package/dist/src/editor/BlockNoteEditor.test.js +2 -2
- package/dist/src/editor/BlockNoteEditor.test.js.map +1 -1
- package/dist/src/editor/BlockNoteExtensions.js +52 -6
- package/dist/src/editor/BlockNoteExtensions.js.map +1 -1
- package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js +36 -6
- package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js.map +1 -1
- package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js +35 -32
- package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js.map +1 -1
- package/dist/src/extensions/Placeholder/PlaceholderPlugin.js +74 -71
- package/dist/src/extensions/Placeholder/PlaceholderPlugin.js.map +1 -1
- package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js +153 -149
- package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +2 -2
- package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +0 -6
- package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +0 -5
- package/src/api/blockManipulation/commands/moveBlock/__snapshots__/moveBlock.test.ts.snap +0 -8
- package/src/api/blockManipulation/commands/moveBlock/moveBlock.test.ts +7 -3
- package/src/api/blockManipulation/commands/removeBlocks/__snapshots__/removeBlocks.test.ts.snap +439 -2
- package/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.ts +6 -0
- package/src/api/blockManipulation/commands/removeBlocks/removeBlocks.ts +2 -82
- package/src/api/blockManipulation/commands/replaceBlocks/__snapshots__/replaceBlocks.test.ts.snap +0 -8
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +96 -20
- package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +0 -6
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +2 -5
- package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +0 -490
- package/src/api/clipboard/fromClipboard/acceptedMIMETypes.ts +1 -1
- package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +6 -5
- package/src/api/getBlockInfoFromPos.ts +20 -30
- package/src/api/parsers/html/__snapshots__/parse-notion-html.json +1 -2
- package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +16 -4
- package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +9 -3
- package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +22 -6
- package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +5 -3
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +8 -2
- package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +4 -1
- package/src/blocks/TableBlockContent/TableBlockContent.ts +0 -1
- package/src/editor/BlockNoteEditor.test.ts +2 -5
- package/src/editor/BlockNoteEditor.ts +71 -42
- package/src/editor/BlockNoteExtensions.ts +90 -14
- package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +36 -9
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts +45 -42
- package/src/extensions/Placeholder/PlaceholderPlugin.ts +94 -90
- package/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts +173 -169
- package/types/src/api/blockManipulation/commands/removeBlocks/removeBlocks.d.ts +0 -3
- package/types/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.d.ts +4 -0
- package/types/src/api/blockManipulation/setupTestEnv.d.ts +0 -6
- package/types/src/api/clipboard/fromClipboard/acceptedMIMETypes.d.ts +1 -1
- package/types/src/api/getBlockInfoFromPos.d.ts +9 -34
- package/types/src/api/testUtil/cases/customBlocks.d.ts +0 -6
- package/types/src/api/testUtil/cases/customInlineContent.d.ts +0 -6
- package/types/src/api/testUtil/cases/customStyles.d.ts +0 -6
- package/types/src/blocks/TableBlockContent/TableBlockContent.d.ts +0 -9
- package/types/src/blocks/defaultBlocks.d.ts +0 -12
- package/types/src/editor/BlockNoteEditor.d.ts +19 -2
- package/types/src/editor/BlockNoteExtensions.d.ts +14 -7
- package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.d.ts +4 -1
- package/types/src/extensions/Placeholder/PlaceholderPlugin.d.ts +4 -1
- package/types/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.d.ts +4 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditorOptions } from "@tiptap/core";
|
|
1
|
+
import { AnyExtension, EditorOptions } from "@tiptap/core";
|
|
2
2
|
import { Node, Schema } from "prosemirror-model";
|
|
3
3
|
import * as Y from "yjs";
|
|
4
4
|
import { Block, DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema, PartialBlock } from "../blocks/defaultBlocks.js";
|
|
@@ -8,7 +8,7 @@ import { LinkToolbarProsemirrorPlugin } from "../extensions/LinkToolbar/LinkTool
|
|
|
8
8
|
import { SideMenuProsemirrorPlugin } from "../extensions/SideMenu/SideMenuPlugin.js";
|
|
9
9
|
import { SuggestionMenuProseMirrorPlugin } from "../extensions/SuggestionMenu/SuggestionPlugin.js";
|
|
10
10
|
import { TableHandlesProsemirrorPlugin } from "../extensions/TableHandles/TableHandlesPlugin.js";
|
|
11
|
-
import { BlockIdentifier, BlockNoteDOMAttributes, BlockSchema, BlockSpecs, InlineContentSchema, InlineContentSpecs, PartialInlineContent, StyleSchema, StyleSpecs
|
|
11
|
+
import { BlockIdentifier, BlockNoteDOMAttributes, BlockSchema, BlockSpecs, InlineContentSchema, InlineContentSpecs, PartialInlineContent, Styles, StyleSchema, StyleSpecs } from "../schema/index.js";
|
|
12
12
|
import { NoInfer } from "../util/typescript.js";
|
|
13
13
|
import { TextCursorPosition } from "./cursorPositionTypes.js";
|
|
14
14
|
import { Selection } from "./selectionTypes.js";
|
|
@@ -17,6 +17,9 @@ import { BlockNoteTipTapEditor } from "./BlockNoteTipTapEditor.js";
|
|
|
17
17
|
import { Dictionary } from "../i18n/dictionary.js";
|
|
18
18
|
import { Plugin, Transaction } from "@tiptap/pm/state";
|
|
19
19
|
import "../style.css";
|
|
20
|
+
export type BlockNoteExtension = AnyExtension | {
|
|
21
|
+
plugin: Plugin;
|
|
22
|
+
};
|
|
20
23
|
export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema> = {
|
|
21
24
|
/**
|
|
22
25
|
* Whether changes to blocks (like indentation, creating lists, changing headings) should be animated or not. Defaults to `true`.
|
|
@@ -24,6 +27,9 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
|
|
|
24
27
|
* @default true
|
|
25
28
|
*/
|
|
26
29
|
animations?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Disable internal extensions (based on keys / extension name)
|
|
32
|
+
*/
|
|
27
33
|
disableExtensions: string[];
|
|
28
34
|
/**
|
|
29
35
|
* A dictionary object containing translations for the editor.
|
|
@@ -90,7 +96,14 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
|
|
|
90
96
|
*/
|
|
91
97
|
renderCursor?: (user: any) => HTMLElement;
|
|
92
98
|
};
|
|
99
|
+
/**
|
|
100
|
+
* additional tiptap options, undocumented
|
|
101
|
+
*/
|
|
93
102
|
_tiptapOptions: Partial<EditorOptions>;
|
|
103
|
+
/**
|
|
104
|
+
* (experimental) add extra prosemirror plugins or tiptap extensions to the editor
|
|
105
|
+
*/
|
|
106
|
+
_extensions: Record<string, BlockNoteExtension>;
|
|
94
107
|
trailingBlock?: boolean;
|
|
95
108
|
/**
|
|
96
109
|
* Boolean indicating whether the editor is in headless mode.
|
|
@@ -114,6 +127,10 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
|
|
|
114
127
|
export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockSchema, ISchema extends InlineContentSchema = DefaultInlineContentSchema, SSchema extends StyleSchema = DefaultStyleSchema> {
|
|
115
128
|
protected readonly options: Partial<BlockNoteEditorOptions<any, any, any>>;
|
|
116
129
|
private readonly _pmSchema;
|
|
130
|
+
/**
|
|
131
|
+
* extensions that are added to the editor, can be tiptap extensions or prosemirror plugins
|
|
132
|
+
*/
|
|
133
|
+
readonly extensions: Record<string, BlockNoteExtension>;
|
|
117
134
|
/**
|
|
118
135
|
* Boolean indicating whether the editor is in headless mode.
|
|
119
136
|
* Headless mode means we can use features like importing / exporting blocks,
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type { BlockNoteEditor } from "./BlockNoteEditor.js";
|
|
1
|
+
import type { BlockNoteEditor, BlockNoteExtension } from "./BlockNoteEditor.js";
|
|
2
|
+
import { Plugin } from "prosemirror-state";
|
|
2
3
|
import * as Y from "yjs";
|
|
3
|
-
import { BlockNoteDOMAttributes, BlockSpecs, InlineContentSchema, InlineContentSpecs, StyleSchema, StyleSpecs } from "../schema/index.js";
|
|
4
|
-
|
|
5
|
-
* Get all the Tiptap extensions BlockNote is configured with by default
|
|
6
|
-
*/
|
|
7
|
-
export declare const getBlockNoteExtensions: <BSchema extends Record<string, import("../schema/index.js").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(opts: {
|
|
4
|
+
import { BlockNoteDOMAttributes, BlockSchema, BlockSpecs, InlineContentSchema, InlineContentSpecs, StyleSchema, StyleSpecs } from "../schema/index.js";
|
|
5
|
+
type ExtensionOptions<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> = {
|
|
8
6
|
editor: BlockNoteEditor<BSchema, I, S>;
|
|
9
7
|
domAttributes: Partial<BlockNoteDOMAttributes>;
|
|
10
8
|
blockSpecs: BlockSpecs;
|
|
@@ -23,4 +21,13 @@ export declare const getBlockNoteExtensions: <BSchema extends Record<string, imp
|
|
|
23
21
|
};
|
|
24
22
|
disableExtensions: string[] | undefined;
|
|
25
23
|
setIdAttribute?: boolean;
|
|
26
|
-
|
|
24
|
+
animations: boolean;
|
|
25
|
+
tableHandles: boolean;
|
|
26
|
+
dropCursor: (opts: any) => Plugin;
|
|
27
|
+
placeholders: Record<string | "default", string>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Get all the Tiptap extensions BlockNote is configured with by default
|
|
31
|
+
*/
|
|
32
|
+
export declare const getBlockNoteExtensions: <BSchema extends Record<string, import("../schema/index.js").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(opts: ExtensionOptions<BSchema, I, S>) => Record<string, BlockNoteExtension>;
|
|
33
|
+
export {};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { Plugin } from "prosemirror-state";
|
|
2
2
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
3
|
-
export declare
|
|
3
|
+
export declare class PlaceholderPlugin {
|
|
4
|
+
readonly plugin: Plugin;
|
|
5
|
+
constructor(editor: BlockNoteEditor<any, any, any>, placeholders: Record<string | "default", string>);
|
|
6
|
+
}
|
|
@@ -7,8 +7,7 @@ import { Plugin } from "prosemirror-state";
|
|
|
7
7
|
*
|
|
8
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
9
|
*/
|
|
10
|
-
export declare
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}>;
|
|
10
|
+
export declare class PreviousBlockTypePlugin {
|
|
11
|
+
readonly plugin: Plugin;
|
|
12
|
+
constructor();
|
|
13
|
+
}
|