Skip to content

Commit 5751974

Browse files
committed
fix: get tables working
1 parent b46fcc6 commit 5751974

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

examples/01-basic/01-minimal/src/App.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,10 @@ import "@blocknote/core/fonts/inter.css";
22
import { BlockNoteView } from "@blocknote/mantine";
33
import "@blocknote/mantine/style.css";
44
import { useCreateBlockNote } from "@blocknote/react";
5-
import { BlockNoteSchema2 } from "@blocknote/core";
6-
import { codeBlock } from "@blocknote/code-block";
7-
8-
const schema = BlockNoteSchema2.create(undefined, {
9-
codeBlock,
10-
});
115

126
export default function App() {
137
// Creates a new editor instance.
14-
const editor = useCreateBlockNote({
15-
schema: schema as any,
16-
});
8+
const editor = useCreateBlockNote();
179

1810
// Renders the editor instance using a React component.
1911
return <BlockNoteView editor={editor} />;

packages/core/src/editor/CustomSchema.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,14 @@ export class CustomBlockNoteSchema<
9898
{
9999
extensions: blockDef.extensions,
100100
},
101-
createBlockSpec(
102-
blockDef.config,
103-
blockDef.implementation as any,
104-
getPriority(key),
105-
),
101+
// TODO annoying hack to get tables to work
102+
blockDef.config.type === "table"
103+
? blockDef
104+
: createBlockSpec(
105+
blockDef.config,
106+
blockDef.implementation as any,
107+
getPriority(key),
108+
),
106109
),
107110
];
108111
},

packages/core/src/schema/blocks/createSpec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@ export function createBlockSpec<
335335
blockContentDOMAttributes,
336336
);
337337
},
338+
// Only needed for tables right now, remove later
339+
requiredExtensions: (blockImplementation as any).requiredExtensions,
338340
});
339341
}
340342

0 commit comments

Comments
 (0)