Skip to content

Commit 36fdc70

Browse files
committed
Merge branch 'main' into trailing-block-update
2 parents 365e46b + dac995c commit 36fdc70

121 files changed

Lines changed: 2652 additions & 896 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"fumadocs-ui": "npm:@fumadocs/base-ui@16.5.0",
8383
"lucide-react": "^0.562.0",
8484
"motion": "^12.28.1",
85-
"next": "^16.1.6",
85+
"next": "^16.2.6",
8686
"next-themes": "^0.4.6",
8787
"nodemailer": "^7.0.12",
8888
"pg": "^8.17.1",
@@ -122,7 +122,7 @@
122122
"@types/react-dom": "^19.2.3",
123123
"babel-plugin-react-compiler": "^1.0.0",
124124
"eslint": "^9.39.2",
125-
"eslint-config-next": "^16.1.6",
125+
"eslint-config-next": "^16.2.6",
126126
"next-validate-link": "^1.6.4",
127127
"postcss": "^8.5.6",
128128
"serve": "^14.2.6",
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"playground": true,
3+
"docs": false,
4+
"author": "matthewlipski",
5+
"tags": ["Basic"]
6+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# No Trailing Block
2+
3+
This example shows how to disable the automatic creation of a trailing block at the end of the editor by setting the `trailingBlock` option to `false`.
4+
5+
**Relevant Docs:**
6+
7+
- [Editor Setup](/docs/getting-started/editor-setup)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html lang="en">
2+
<head>
3+
<meta charset="UTF-8" />
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
5+
<title>No Trailing Block</title>
6+
<script>
7+
<!-- AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY -->
8+
</script>
9+
</head>
10+
<body>
11+
<div id="root"></div>
12+
<script type="module" src="./main.tsx"></script>
13+
</body>
14+
</html>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY
2+
import React from "react";
3+
import { createRoot } from "react-dom/client";
4+
import App from "./src/App.jsx";
5+
6+
const root = createRoot(document.getElementById("root")!);
7+
root.render(
8+
<React.StrictMode>
9+
<App />
10+
</React.StrictMode>
11+
);
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "@blocknote/example-basic-no-trailing-block",
3+
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
4+
"type": "module",
5+
"private": true,
6+
"version": "0.12.4",
7+
"scripts": {
8+
"start": "vite",
9+
"dev": "vite",
10+
"build:prod": "tsc && vite build",
11+
"preview": "vite preview"
12+
},
13+
"dependencies": {
14+
"@blocknote/ariakit": "latest",
15+
"@blocknote/core": "latest",
16+
"@blocknote/mantine": "latest",
17+
"@blocknote/react": "latest",
18+
"@blocknote/shadcn": "latest",
19+
"@mantine/core": "^8.3.11",
20+
"@mantine/hooks": "^8.3.11",
21+
"@mantine/utils": "^6.0.22",
22+
"react": "^19.2.3",
23+
"react-dom": "^19.2.3"
24+
},
25+
"devDependencies": {
26+
"@types/react": "^19.2.3",
27+
"@types/react-dom": "^19.2.3",
28+
"@vitejs/plugin-react": "^6.0.1",
29+
"vite": "^8.0.8"
30+
}
31+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import "@blocknote/core/fonts/inter.css";
2+
import { BlockNoteView } from "@blocknote/mantine";
3+
import "@blocknote/mantine/style.css";
4+
import { useCreateBlockNote } from "@blocknote/react";
5+
6+
export default function App() {
7+
// Creates a new editor instance.
8+
const editor = useCreateBlockNote({
9+
trailingBlock: false,
10+
});
11+
12+
// Renders the editor instance using a React component.
13+
return <BlockNoteView editor={editor} />;
14+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"__comment": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
3+
"compilerOptions": {
4+
"target": "ESNext",
5+
"useDefineForClassFields": true,
6+
"lib": [
7+
"DOM",
8+
"DOM.Iterable",
9+
"ESNext"
10+
],
11+
"allowJs": false,
12+
"skipLibCheck": true,
13+
"esModuleInterop": false,
14+
"allowSyntheticDefaultImports": true,
15+
"strict": true,
16+
"forceConsistentCasingInFileNames": true,
17+
"module": "ESNext",
18+
"moduleResolution": "bundler",
19+
"resolveJsonModule": true,
20+
"isolatedModules": true,
21+
"noEmit": true,
22+
"jsx": "react-jsx",
23+
"composite": true
24+
},
25+
"include": [
26+
"."
27+
],
28+
"__ADD_FOR_LOCAL_DEV_references": [
29+
{
30+
"path": "../../../packages/core/"
31+
},
32+
{
33+
"path": "../../../packages/react/"
34+
}
35+
]
36+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY
2+
import react from "@vitejs/plugin-react";
3+
import * as fs from "fs";
4+
import * as path from "path";
5+
import { defineConfig } from "vite";
6+
// import eslintPlugin from "vite-plugin-eslint";
7+
// https://vitejs.dev/config/
8+
export default defineConfig((conf) => ({
9+
plugins: [react()],
10+
optimizeDeps: {},
11+
build: {
12+
sourcemap: true,
13+
},
14+
resolve: {
15+
alias:
16+
conf.command === "build" ||
17+
!fs.existsSync(path.resolve(__dirname, "../../packages/core/src"))
18+
? {}
19+
: ({
20+
// Comment out the lines below to load a built version of blocknote
21+
// or, keep as is to load live from sources with live reload working
22+
"@blocknote/core": path.resolve(
23+
__dirname,
24+
"../../packages/core/src/"
25+
),
26+
"@blocknote/react": path.resolve(
27+
__dirname,
28+
"../../packages/react/src/"
29+
),
30+
} as any),
31+
},
32+
}));

examples/03-ui-components/02-formatting-toolbar-buttons/src/App.tsx

Lines changed: 34 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,39 @@ import {
1818

1919
import { BlueButton } from "./BlueButton";
2020

21+
const CustomFormattingToolbar = () => (
22+
<FormattingToolbar>
23+
<BlockTypeSelect key={"blockTypeSelect"} />
24+
25+
{/* Extra button to toggle blue text & background */}
26+
<BlueButton key={"customButton"} />
27+
28+
<FileCaptionButton key={"fileCaptionButton"} />
29+
<FileReplaceButton key={"replaceFileButton"} />
30+
31+
<BasicTextStyleButton basicTextStyle={"bold"} key={"boldStyleButton"} />
32+
<BasicTextStyleButton basicTextStyle={"italic"} key={"italicStyleButton"} />
33+
<BasicTextStyleButton
34+
basicTextStyle={"underline"}
35+
key={"underlineStyleButton"}
36+
/>
37+
<BasicTextStyleButton basicTextStyle={"strike"} key={"strikeStyleButton"} />
38+
{/* Extra button to toggle code styles */}
39+
<BasicTextStyleButton key={"codeStyleButton"} basicTextStyle={"code"} />
40+
41+
<TextAlignButton textAlignment={"left"} key={"textAlignLeftButton"} />
42+
<TextAlignButton textAlignment={"center"} key={"textAlignCenterButton"} />
43+
<TextAlignButton textAlignment={"right"} key={"textAlignRightButton"} />
44+
45+
<ColorStyleButton key={"colorStyleButton"} />
46+
47+
<NestBlockButton key={"nestBlockButton"} />
48+
<UnnestBlockButton key={"unnestBlockButton"} />
49+
50+
<CreateLinkButton key={"createLinkButton"} />
51+
</FormattingToolbar>
52+
);
53+
2154
export default function App() {
2255
// Creates a new editor instance.
2356
const editor = useCreateBlockNote({
@@ -77,61 +110,7 @@ export default function App() {
77110
// Renders the editor instance.
78111
return (
79112
<BlockNoteView editor={editor} formattingToolbar={false}>
80-
<FormattingToolbarController
81-
formattingToolbar={() => (
82-
<FormattingToolbar>
83-
<BlockTypeSelect key={"blockTypeSelect"} />
84-
85-
{/* Extra button to toggle blue text & background */}
86-
<BlueButton key={"customButton"} />
87-
88-
<FileCaptionButton key={"fileCaptionButton"} />
89-
<FileReplaceButton key={"replaceFileButton"} />
90-
91-
<BasicTextStyleButton
92-
basicTextStyle={"bold"}
93-
key={"boldStyleButton"}
94-
/>
95-
<BasicTextStyleButton
96-
basicTextStyle={"italic"}
97-
key={"italicStyleButton"}
98-
/>
99-
<BasicTextStyleButton
100-
basicTextStyle={"underline"}
101-
key={"underlineStyleButton"}
102-
/>
103-
<BasicTextStyleButton
104-
basicTextStyle={"strike"}
105-
key={"strikeStyleButton"}
106-
/>
107-
{/* Extra button to toggle code styles */}
108-
<BasicTextStyleButton
109-
key={"codeStyleButton"}
110-
basicTextStyle={"code"}
111-
/>
112-
113-
<TextAlignButton
114-
textAlignment={"left"}
115-
key={"textAlignLeftButton"}
116-
/>
117-
<TextAlignButton
118-
textAlignment={"center"}
119-
key={"textAlignCenterButton"}
120-
/>
121-
<TextAlignButton
122-
textAlignment={"right"}
123-
key={"textAlignRightButton"}
124-
/>
125-
126-
<ColorStyleButton key={"colorStyleButton"} />
127-
128-
<NestBlockButton key={"nestBlockButton"} />
129-
<UnnestBlockButton key={"unnestBlockButton"} />
130-
131-
<CreateLinkButton key={"createLinkButton"} />
132-
</FormattingToolbar>
133-
)}
134-
/>
113+
<FormattingToolbarController formattingToolbar={CustomFormattingToolbar} />
135114
</BlockNoteView>
136115
);
137116
}

0 commit comments

Comments
 (0)