Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
acc7114
zod refactor
YousefED Oct 13, 2025
6847a09
add zod to examples
YousefED Oct 13, 2025
bd154ed
refactor types and partial / full
YousefED Oct 16, 2025
30c5581
remove unneeded code
YousefED Oct 16, 2025
f2d191e
fix !
YousefED Oct 16, 2025
75bd4e5
fix build
YousefED Oct 16, 2025
5eb10ec
remove SpecificBlock
YousefED Oct 16, 2025
b99822a
fix build
YousefED Oct 16, 2025
53bd6d7
fix core tests
YousefED Oct 16, 2025
750a942
refactor: move all instances of `BlockNoteSchema` to `CustomBlockNote…
nperez0111 Oct 16, 2025
a5099b3
chore: kludges to get the build working
nperez0111 Oct 16, 2025
f9842b6
Merge branch 'main' into refactor/zod-props-v2
nperez0111 Oct 16, 2025
c3bb8d0
chore: update lockfile
nperez0111 Oct 16, 2025
3e0148b
chore: fix the lint
nperez0111 Oct 16, 2025
f2559f4
chore: bump zod to same version
nperez0111 Oct 16, 2025
e905344
chore: get the tests to pass by parsing an empty object
nperez0111 Oct 16, 2025
e79e0fe
refactor: use type defs to declare defaultBlocks properties for perf …
nperez0111 Oct 17, 2025
984a21b
copy in tests from matthew
YousefED Oct 17, 2025
cba8abb
createPropSchemaFromZod
YousefED Oct 29, 2025
c37934c
fix
YousefED Oct 29, 2025
0920bf9
address feedback
YousefED Oct 29, 2025
56f4245
Merge branch 'refactor/zod-props-v2' into refactor/remove-partials
YousefED Oct 29, 2025
d15becc
merge and build
YousefED Oct 29, 2025
b028a1b
fix build
YousefED Oct 29, 2025
6ffa70e
fix build
YousefED Oct 29, 2025
553932b
empty spans added
YousefED Oct 29, 2025
cbda9e7
fix odt test
YousefED Oct 29, 2025
0dcd4f8
fix tests
YousefED Oct 29, 2025
b8383f7
update snap
YousefED Oct 29, 2025
2cfa627
fix tests
YousefED Oct 29, 2025
282a966
fix "as never"
YousefED Oct 29, 2025
bbe2299
small fixes
YousefED Oct 29, 2025
7b44f98
fix build
YousefED Oct 29, 2025
fab647f
Merge pull request #2111 from TypeCellOS/refactor/remove-partials
YousefED Oct 29, 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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.addMissingImports": "explicit"
},
"[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
Expand Down
3 changes: 2 additions & 1 deletion examples/01-basic/01-minimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
3 changes: 2 additions & 1 deletion examples/01-basic/02-block-objects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
1 change: 1 addition & 0 deletions examples/01-basic/03-multi-column/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"zod": "^4.0.0",
"@blocknote/xl-multi-column": "latest"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion examples/01-basic/04-default-blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
3 changes: 2 additions & 1 deletion examples/01-basic/05-removing-default-blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
3 changes: 2 additions & 1 deletion examples/01-basic/06-block-manipulation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
3 changes: 2 additions & 1 deletion examples/01-basic/07-selection-blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
3 changes: 2 additions & 1 deletion examples/01-basic/08-ariakit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
1 change: 1 addition & 0 deletions examples/01-basic/09-shadcn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"zod": "^4.0.0",
"tailwindcss": "^4.1.12",
"tw-animate-css": "^1.3.7"
},
Expand Down
3 changes: 2 additions & 1 deletion examples/01-basic/10-localization/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
3 changes: 2 additions & 1 deletion examples/01-basic/11-custom-placeholder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
3 changes: 2 additions & 1 deletion examples/01-basic/12-multi-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
3 changes: 2 additions & 1 deletion examples/01-basic/13-custom-paste-handler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
3 changes: 2 additions & 1 deletion examples/01-basic/testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
3 changes: 2 additions & 1 deletion examples/02-backend/01-file-uploading/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
3 changes: 2 additions & 1 deletion examples/02-backend/02-saving-loading/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
1 change: 1 addition & 0 deletions examples/02-backend/03-s3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"zod": "^4.0.0",
"@aws-sdk/client-s3": "^3.609.0",
"@aws-sdk/s3-request-presigner": "^3.609.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"zod": "^4.0.0",
"@blocknote/server-util": "latest"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion examples/03-ui-components/01-ui-elements-remove/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"zod": "^4.0.0",
"react-icons": "^5.2.1"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { defaultProps } from "@blocknote/core";
import { createReactBlockSpec } from "@blocknote/react";
import { Menu } from "@mantine/core";
import { MdCancel, MdCheckCircle, MdError, MdInfo } from "react-icons/md";
import { z } from "zod/v4";

import { createPropSchemaFromZod, defaultZodPropSchema } from "@blocknote/core";
import "./styles.css";

// The types of alerts that users can choose from.
Expand Down Expand Up @@ -53,14 +54,18 @@ export const alertTypes = [
export const Alert = createReactBlockSpec(
{
type: "alert",
propSchema: {
textAlignment: defaultProps.textAlignment,
textColor: defaultProps.textColor,
type: {
default: "warning",
values: ["warning", "error", "info", "success"],
},
},
propSchema: createPropSchemaFromZod(
defaultZodPropSchema
.pick({
textAlignment: true,
textColor: true,
})
.extend({
type: z
.enum(["warning", "error", "info", "success"])
.default("warning"),
}),
),
content: "inline",
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"zod": "^4.0.0",
"react-icons": "^5.2.1"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"zod": "^4.0.0",
"react-icons": "^5.2.1"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"zod": "^4.0.0",
"react-icons": "^5.2.1"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { createPropSchemaFromZod } from "@blocknote/core";
import { createReactInlineContentSpec } from "@blocknote/react";
import { z } from "zod/v4";

// The Mention inline content.
export const Mention = createReactInlineContentSpec(
{
type: "mention",
propSchema: {
user: {
default: "Unknown",
},
},
propSchema: createPropSchemaFromZod(
z.object({
user: z.string().default("Unknown"),
}),
),
content: "none",
},
{
Expand Down
1 change: 1 addition & 0 deletions examples/03-ui-components/11-uppy-file-panel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"zod": "^4.0.0",
"@uppy/core": "^3.13.1",
"@uppy/dashboard": "^3.9.1",
"@uppy/drag-drop": "^3.1.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import {
BlockSchema,
baseFileZodPropSchema,
blockHasType,
BlockSchema,
InlineContentSchema,
optionalFileZodPropSchema,
StyleSchema,
createPropSchemaFromZod
} from "@blocknote/core";
import {
useBlockNoteEditor,
Expand Down Expand Up @@ -41,7 +44,15 @@ export const FileReplaceButton = () => {

if (
block === undefined ||
!blockHasType(block, editor, "file", { url: "string" }) ||
!blockHasType(
block,
editor,
block.type,
// TODO
createPropSchemaFromZod(baseFileZodPropSchema.extend({
...optionalFileZodPropSchema.pick({ url: true }).shape,
})),
) ||
!editor.isEditable
) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
1 change: 1 addition & 0 deletions examples/03-ui-components/13-custom-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"zod": "^4.0.0",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@mui/icons-material": "^5.16.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"@mantine/hooks": "^8.3.4",
"@mantine/utils": "^6.0.22",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"react-dom": "^19.1.0",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
Expand Down
Loading