Skip to content

Commit 80963f4

Browse files
committed
Update examples
1 parent 356aedc commit 80963f4

File tree

2 files changed

+28
-23
lines changed
  • examples/04-theming

2 files changed

+28
-23
lines changed

examples/04-theming/06-code-block/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import { BlockNoteSchema, createCodeBlockSpec } from "@blocknote/core";
12
import "@blocknote/core/fonts/inter.css";
23
import { BlockNoteView } from "@blocknote/mantine";
34
import "@blocknote/mantine/style.css";
45
import { useCreateBlockNote } from "@blocknote/react";
56
// This packages some of the most used languages in on-demand bundle
67
import { codeBlock } from "@blocknote/code-block";
7-
import { BlockNoteSchema, createCodeBlockSpec } from "@blocknote/core";
88

99
export default function App() {
1010
// Creates a new editor instance.

examples/04-theming/07-custom-code-block/src/App.tsx

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { BlockNoteSchema, createCodeBlockSpec } from "@blocknote/core";
12
import "@blocknote/core/fonts/inter.css";
23
import { BlockNoteView } from "@blocknote/mantine";
34
import "@blocknote/mantine/style.css";
@@ -8,29 +9,33 @@ import { createHighlighter } from "./shiki.bundle";
89
export default function App() {
910
// Creates a new editor instance.
1011
const editor = useCreateBlockNote({
11-
codeBlock: {
12-
indentLineWithTab: true,
13-
defaultLanguage: "typescript",
14-
supportedLanguages: {
15-
typescript: {
16-
name: "TypeScript",
17-
aliases: ["ts"],
18-
},
19-
javascript: {
20-
name: "JavaScript",
21-
aliases: ["js"],
22-
},
23-
vue: {
24-
name: "Vue",
25-
},
26-
},
27-
// This creates a highlighter, it can be asynchronous to load it afterwards
28-
createHighlighter: () =>
29-
createHighlighter({
30-
themes: ["dark-plus", "light-plus"],
31-
langs: [],
12+
schema: BlockNoteSchema.create().extend({
13+
blockSpecs: {
14+
codeBlock: createCodeBlockSpec({
15+
indentLineWithTab: true,
16+
defaultLanguage: "typescript",
17+
supportedLanguages: {
18+
typescript: {
19+
name: "TypeScript",
20+
aliases: ["ts"],
21+
},
22+
javascript: {
23+
name: "JavaScript",
24+
aliases: ["js"],
25+
},
26+
vue: {
27+
name: "Vue",
28+
},
29+
},
30+
// This creates a highlighter, it can be asynchronous to load it afterwards
31+
createHighlighter: () =>
32+
createHighlighter({
33+
themes: ["dark-plus", "light-plus"],
34+
langs: [],
35+
}),
3236
}),
33-
},
37+
},
38+
}),
3439
initialContent: [
3540
{
3641
type: "codeBlock",

0 commit comments

Comments
 (0)