Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
b94e7ee
refactor(extensions): rewrite to use new extension system
nperez0111 Oct 31, 2025
916fc8c
chore: minor fixes
nperez0111 Nov 3, 2025
6a0150c
Refactored almost all formatting toolbar components to use `useEditor…
matthewlipski Oct 29, 2025
06fa6f7
Refactored remaining uses of hooks with `useEditorState` where possib…
matthewlipski Oct 30, 2025
5ffc5a4
feat: virtual element hooks
nperez0111 Nov 3, 2025
9b266e5
Merge branch 'plugin-system' of github.com:TypeCellOS/BlockNote into …
matthewlipski Nov 4, 2025
1073248
Refactored formatting toolbar, file panel, and suggestion menu contro…
matthewlipski Nov 5, 2025
343b67c
Fixed popover position reference not updating when it should & fixed …
matthewlipski Nov 9, 2025
f80999c
Cleaned up hooks
matthewlipski Nov 11, 2025
a1372c0
- Cleaned up refactored UI plugins
matthewlipski Nov 12, 2025
555973d
Refactored side menu & fixed issue with `GenericPopover` memoized `in…
matthewlipski Nov 12, 2025
d07e2a4
Comment edit
matthewlipski Nov 13, 2025
369606c
Fixed core build
matthewlipski Nov 13, 2025
a5287b4
Misc fixes
matthewlipski Nov 17, 2025
2b2d3a2
Small fix
matthewlipski Nov 17, 2025
050ecff
Refactored table handles
matthewlipski Nov 17, 2025
84d303c
Fixed various build & UI issues
matthewlipski Nov 18, 2025
988f3de
Fixed various UI issues
matthewlipski Nov 18, 2025
7693564
Fixed link creation/editing throwing error
matthewlipski Nov 19, 2025
ccfa56d
Refactored comments
matthewlipski Nov 19, 2025
e01c25c
chore: update prosemirror versions
nperez0111 Nov 19, 2025
5ce9ad7
fix: y-prosemirror plugin ordering
nperez0111 Nov 19, 2025
bd5a73d
Updated comments to fully use new components APIs
matthewlipski Nov 19, 2025
7972e49
chore: fix build
nperez0111 Nov 19, 2025
3b568d2
build: get multi-column building again
nperez0111 Nov 19, 2025
e64aef7
refactor: rewrite the AI extension to use the new plugin API
nperez0111 Nov 20, 2025
0c3c37a
fix: make mounting and unmounting extensions actually work properly
nperez0111 Nov 20, 2025
3c8992a
Fixed z-index clipping issues
matthewlipski Nov 20, 2025
911d01a
Merge branch 'plugin-system' of github.com:TypeCellOS/BlockNote into …
matthewlipski Nov 20, 2025
e92b294
refactor: normalize extension naming no longer plugins
nperez0111 Nov 20, 2025
81c0032
refactor: always turn a DOMRect into JSON for easy comparisons
nperez0111 Nov 20, 2025
16e87ab
refactor: change imports of extensions to be found at `@blocknote/cor…
nperez0111 Nov 20, 2025
d9c8b65
fix: use an abort signal instead of sending an abortcontroller
nperez0111 Nov 20, 2025
beb11fc
chore: fix circular import
nperez0111 Nov 20, 2025
8fb1459
chore: use any blocknote editor
nperez0111 Nov 20, 2025
4be8534
refactor: less derived state
nperez0111 Nov 20, 2025
d40518b
refactor: rename `usePlugin` -> `useExtension`
nperez0111 Nov 20, 2025
2fb11fa
refactor: remove class member
nperez0111 Nov 20, 2025
0190ba2
refactor: rename `plugins` -> `prosemirrorPlugins` and `init` -> `mount`
nperez0111 Nov 20, 2025
5157ce8
Fixed suggestion menus closing when clicking scroll bar
matthewlipski Nov 20, 2025
171ef89
Merge branch 'plugin-system' of github.com:TypeCellOS/BlockNote into …
matthewlipski Nov 20, 2025
f57ef14
fix: always pull the latest extensions in React
nperez0111 Nov 20, 2025
dd098b0
Fixed table handle issues
matthewlipski Nov 21, 2025
f4bab3b
add comments
YousefED Nov 21, 2025
9b69258
Merge branch 'plugin-system' of github.com:TypeCellOS/BlockNote into …
YousefED Nov 21, 2025
6f901a2
Fixed most remaining table handle issues
matthewlipski Nov 21, 2025
c1b1b3d
Merge branch 'plugin-system' of github.com:TypeCellOS/BlockNote into …
matthewlipski Nov 21, 2025
981aedc
fix: formatting toolbar, comments + cleanup
nperez0111 Nov 21, 2025
0be31ed
refactor: filepanel unsubs it's listeners
nperez0111 Nov 21, 2025
4300600
Merge branch 'main' into plugin-system
matthewlipski Nov 21, 2025
bba68f2
Fixed build
matthewlipski Nov 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/content/docs/features/extensions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BlockNote includes an extensions system which lets you expand the editor's behav

## Creating an extension

An extension is an instance of the [`BlockNoteExtension`](https://github.com/TypeCellOS/BlockNote/blob/10cdbfb5f77ef82f3617c0fa1191e0bf5b7358c5/packages/core/src/editor/BlockNoteExtension.ts#L13) class. However, it's recommended for most use cases to create extensions using the `createBlockNoteExtension` function, rather than instanciating the class directly:
An extension is an instance of the [`BlockNoteExtension`](https://github.com/TypeCellOS/BlockNote/blob/10cdbfb5f77ef82f3617c0fa1191e0bf5b7358c5/packages/core/src/editor/BlockNoteExtension.ts#L13) class. However, it's recommended for most use cases to create extensions using the `createExtension` function, rather than instanciating the class directly:

```typescript
type BlockNoteExtensionOptions = {
Expand Down Expand Up @@ -43,10 +43,10 @@ const customBlockExtensionOptions: BlockNoteExtensionOptions = {
tiptapExtensions: ...,
}

const CustomExtension = createBlockNoteExtension(customBlockExtensionOptions);
const CustomExtension = createExtension(customBlockExtensionOptions);
```

Let's go over the options that can be passed into `createBlockNoteExtension`:
Let's go over the options that can be passed into `createExtension`:

`key:` The name of the extension.

Expand Down Expand Up @@ -74,7 +74,7 @@ The `extensions` [editor option](/docs/reference/editor/overview#options) takes
const editor = useCreateBlockNote({
extensions: [
// Add extensions here:
createBlockNoteExtension({ ... })
createExtension({ ... })
],
});
```
Expand All @@ -95,7 +95,7 @@ const createCustomBlock = createReactBlockSpec(
}
[
// Add extensions here:
createBlockNoteExtension({ ... })
createExtension({ ... })
],
});
```
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const FileReplaceButton = () => {
variant={"panel-popover"}
>
{/* Replaces default file panel with our Uppy one. */}
<UppyFilePanel block={block as any} />
<UppyFilePanel blockId={block.id} />
</Components.Generic.Popover.Content>
</Components.Generic.Popover.Root>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const uppy = new Uppy()
});

export function UppyFilePanel(props: FilePanelProps) {
const { block } = props;
const { blockId } = props;
const editor = useBlockNoteEditor();

useEffect(() => {
Expand All @@ -68,7 +68,7 @@ export function UppyFilePanel(props: FilePanelProps) {
url: response.uploadURL,
},
};
editor.updateBlock(block, updateData);
editor.updateBlock(blockId, updateData);

// File should be removed from the Uppy instance after upload.
uppy.removeFile(file.id);
Expand All @@ -78,7 +78,7 @@ export function UppyFilePanel(props: FilePanelProps) {
return () => {
uppy.off("upload-success", handler);
};
}, [block, editor]);
}, [blockId, editor]);

// set up dashboard as in https://uppy.io/examples/
return <Dashboard uppy={uppy} width={400} height={500} />;
Expand Down
2 changes: 2 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@
},
"dependencies": {
"@emoji-mart/data": "^1.2.1",
"@handlewithcare/prosemirror-inputrules": "0.1.3",
"@shikijs/types": "3.13.0",
"@tanstack/store": "0.7.7",
"@tiptap/core": "^3.7.2",
"@tiptap/extension-bold": "^3.7.2",
"@tiptap/extension-code": "^3.7.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/blocks/Code/block.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { HighlighterGeneric } from "@shikijs/types";
import { createBlockNoteExtension } from "../../editor/BlockNoteExtension.js";
import { createExtension } from "../../editor/BlockNoteExtension.js";
import { createBlockConfig, createBlockSpec } from "../../schema/index.js";
import { lazyShikiPlugin } from "./shiki.js";
import { DOMParser } from "@tiptap/pm/model";
Expand Down Expand Up @@ -169,11 +169,11 @@ export const createCodeBlockSpec = createBlockSpec(
}),
(options) => {
return [
createBlockNoteExtension({
createExtension({
key: "code-block-highlighter",
plugins: [lazyShikiPlugin(options)],
}),
createBlockNoteExtension({
createExtension({
key: "code-block-keyboard-shortcuts",
keyboardShortcuts: {
Delete: ({ editor }) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/blocks/Divider/block.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createBlockNoteExtension } from "../../editor/BlockNoteExtension.js";
import { createExtension } from "../../editor/BlockNoteExtension.js";
import { createBlockConfig, createBlockSpec } from "../../schema/index.js";

export type DividerBlockConfig = ReturnType<typeof createDividerBlockConfig>;
Expand Down Expand Up @@ -34,7 +34,7 @@ export const createDividerBlockSpec = createBlockSpec(
},
},
[
createBlockNoteExtension({
createExtension({
key: "divider-block-shortcuts",
inputRules: [
{
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/blocks/Heading/block.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createBlockConfig, createBlockSpec } from "../../schema/index.js";
import { createBlockNoteExtension } from "../../editor/BlockNoteExtension.js";
import { createExtension } from "../../editor/BlockNoteExtension.js";
import {
addDefaultPropsExternalHTML,
defaultProps,
Expand Down Expand Up @@ -97,7 +97,7 @@ export const createHeadingBlockSpec = createBlockSpec(
},
}),
({ levels = HEADING_LEVELS }: HeadingOptions = {}) => [
createBlockNoteExtension({
createExtension({
key: "heading-shortcuts",
keyboardShortcuts: Object.fromEntries(
levels.map((level) => [
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/blocks/ListItem/BulletListItem/block.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getBlockInfoFromSelection } from "../../../api/getBlockInfoFromPos.js";
import { createBlockNoteExtension } from "../../../editor/BlockNoteExtension.js";
import { createExtension } from "../../../editor/BlockNoteExtension.js";
import { createBlockConfig, createBlockSpec } from "../../../schema/index.js";
import {
addDefaultPropsExternalHTML,
Expand Down Expand Up @@ -78,7 +78,7 @@ export const createBulletListItemBlockSpec = createBlockSpec(
},
},
[
createBlockNoteExtension({
createExtension({
key: "bullet-list-item-shortcuts",
keyboardShortcuts: {
Enter: ({ editor }) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/blocks/ListItem/CheckListItem/block.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createBlockNoteExtension } from "../../../editor/BlockNoteExtension.js";
import { createExtension } from "../../../editor/BlockNoteExtension.js";
import { createBlockConfig, createBlockSpec } from "../../../schema/index.js";
import {
addDefaultPropsExternalHTML,
Expand Down Expand Up @@ -123,7 +123,7 @@ export const createCheckListItemBlockSpec = createBlockSpec(
runsBefore: ["bulletListItem"],
},
[
createBlockNoteExtension({
createExtension({
key: "check-list-item-shortcuts",
keyboardShortcuts: {
Enter: ({ editor }) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/blocks/ListItem/NumberedListItem/block.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getBlockInfoFromSelection } from "../../../api/getBlockInfoFromPos.js";
import { createBlockNoteExtension } from "../../../editor/BlockNoteExtension.js";
import { createExtension } from "../../../editor/BlockNoteExtension.js";
import { createBlockConfig, createBlockSpec } from "../../../schema/index.js";
import {
addDefaultPropsExternalHTML,
Expand Down Expand Up @@ -91,7 +91,7 @@ export const createNumberedListItemBlockSpec = createBlockSpec(
},
},
[
createBlockNoteExtension({
createExtension({
key: "numbered-list-item-shortcuts",
inputRules: [
{
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/blocks/ListItem/ToggleListItem/block.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createBlockNoteExtension } from "../../../editor/BlockNoteExtension.js";
import { createExtension } from "../../../editor/BlockNoteExtension.js";
import { createBlockConfig, createBlockSpec } from "../../../schema/index.js";
import {
addDefaultPropsExternalHTML,
Expand Down Expand Up @@ -50,7 +50,7 @@ export const createToggleListItemBlockSpec = createBlockSpec(
},
},
[
createBlockNoteExtension({
createExtension({
key: "toggle-list-item-shortcuts",
keyboardShortcuts: {
Enter: ({ editor }) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/blocks/Paragraph/block.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createBlockNoteExtension } from "../../editor/BlockNoteExtension.js";
import { createExtension } from "../../editor/BlockNoteExtension.js";
import { createBlockConfig, createBlockSpec } from "../../schema/index.js";
import {
addDefaultPropsExternalHTML,
Expand Down Expand Up @@ -55,7 +55,7 @@ export const createParagraphBlockSpec = createBlockSpec(
runsBefore: ["default"],
},
[
createBlockNoteExtension({
createExtension({
key: "paragraph-shortcuts",
keyboardShortcuts: {
"Mod-Alt-0": ({ editor }) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/blocks/Quote/block.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createBlockNoteExtension } from "../../editor/BlockNoteExtension.js";
import { createExtension } from "../../editor/BlockNoteExtension.js";
import { createBlockConfig, createBlockSpec } from "../../schema/index.js";
import {
addDefaultPropsExternalHTML,
Expand Down Expand Up @@ -54,7 +54,7 @@ export const createQuoteBlockSpec = createBlockSpec(
},
},
[
createBlockNoteExtension({
createExtension({
key: "quote-block-shortcuts",
keyboardShortcuts: {
"Mod-Alt-q": ({ editor }) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/blocks/Table/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Node, mergeAttributes } from "@tiptap/core";
import { DOMParser, Fragment, Node as PMNode, Schema } from "prosemirror-model";
import { CellSelection, TableView } from "prosemirror-tables";
import { NodeView } from "prosemirror-view";
import { createBlockNoteExtension } from "../../editor/BlockNoteExtension.js";
import { createExtension } from "../../editor/BlockNoteExtension.js";
import {
BlockConfig,
createBlockSpecFromTiptapNode,
Expand Down Expand Up @@ -385,7 +385,7 @@ export const createTableBlockSpec = () =>
{ node: TiptapTableNode, type: "table", content: "table" },
tablePropSchema,
[
createBlockNoteExtension({
createExtension({
key: "table-extensions",
tiptapExtensions: [
TableExtension,
Expand All @@ -399,7 +399,7 @@ export const createTableBlockSpec = () =>
// and all cells are selected. Uses a separate extension as it needs
// priority over keyboard handlers in the `TableExtension`'s
// `tableEditing` plugin.
createBlockNoteExtension({
createExtension({
key: "table-keyboard-delete",
keyboardShortcuts: {
Backspace: ({ editor }) => {
Expand Down
Loading
Loading