File tree Expand file tree Collapse file tree 9 files changed +190
-0
lines changed
examples/01-basic/11-custom-placeholder Expand file tree Collapse file tree 9 files changed +190
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "playground" : true ,
3
+ "docs" : true ,
4
+ "author" : " ezhil56x" ,
5
+ "tags" : [" Basic" ]
6
+ }
Original file line number Diff line number Diff line change
1
+ import { locales } from "@blocknote/core" ;
2
+ import "@blocknote/core/fonts/inter.css" ;
3
+ import { BlockNoteView } from "@blocknote/mantine" ;
4
+ import "@blocknote/mantine/style.css" ;
5
+ import { useCreateBlockNote } from "@blocknote/react" ;
6
+
7
+ export default function App ( ) {
8
+ // We use the English, default dictionary
9
+ const locale = locales [ "en" ] ;
10
+
11
+ // Creates a new editor instance.
12
+ const editor = useCreateBlockNote ( {
13
+ // We override the `placeholders` in our dictionary
14
+ dictionary : {
15
+ ...locale ,
16
+ placeholders : {
17
+ ...locale . placeholders ,
18
+ // We override the default placeholder
19
+ default : "This is a custom placeholder" ,
20
+ // We override the heading placeholder
21
+ heading : "This is a custom heading" ,
22
+ } ,
23
+ } ,
24
+ } ) ;
25
+
26
+ // Renders the editor instance using a React component.
27
+ return < BlockNoteView editor = { editor } /> ;
28
+ }
Original file line number Diff line number Diff line change
1
+ # Change placeholder text
2
+
3
+ In this example, we show how to change the default placeholder and the placeholder for Headings by overriding the placeholders in the dictionary.
4
+
5
+ ** Relevant Docs:**
6
+
7
+ - [ Editor Setup] ( /docs/editor-basics/setup )
8
+ - [ Localization (i18n)] ( /examples/basic/localization )
Original file line number Diff line number Diff line change
1
+ < html lang ="en ">
2
+ < head >
3
+ < script >
4
+ <!-- AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY -->
5
+ </ script >
6
+ < meta charset ="UTF-8 " />
7
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
8
+ < title > Change placeholder text</ title >
9
+ </ head >
10
+ < body >
11
+ < div id ="root "> </ div >
12
+ < script type ="module " src ="./main.tsx "> </ script >
13
+ </ body >
14
+ </ html >
Original file line number Diff line number Diff line change
1
+ // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY
2
+ import React from "react" ;
3
+ import { createRoot } from "react-dom/client" ;
4
+ import App from "./App" ;
5
+
6
+ const root = createRoot ( document . getElementById ( "root" ) ! ) ;
7
+ root . render (
8
+ < React . StrictMode >
9
+ < App />
10
+ </ React . StrictMode >
11
+ ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " @blocknote/example-custom-placeholder" ,
3
+ "description" : " AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY" ,
4
+ "private" : true ,
5
+ "version" : " 0.12.4" ,
6
+ "scripts" : {
7
+ "start" : " vite" ,
8
+ "dev" : " vite" ,
9
+ "build" : " tsc && vite build" ,
10
+ "preview" : " vite preview" ,
11
+ "lint" : " eslint . --max-warnings 0"
12
+ },
13
+ "dependencies" : {
14
+ "@blocknote/core" : " latest" ,
15
+ "@blocknote/react" : " latest" ,
16
+ "@blocknote/ariakit" : " latest" ,
17
+ "@blocknote/mantine" : " latest" ,
18
+ "@blocknote/shadcn" : " latest" ,
19
+ "react" : " ^18.3.1" ,
20
+ "react-dom" : " ^18.3.1"
21
+ },
22
+ "devDependencies" : {
23
+ "@types/react" : " ^18.0.25" ,
24
+ "@types/react-dom" : " ^18.0.9" ,
25
+ "@vitejs/plugin-react" : " ^4.3.1" ,
26
+ "eslint" : " ^8.10.0" ,
27
+ "vite" : " ^5.3.4"
28
+ },
29
+ "eslintConfig" : {
30
+ "extends" : [
31
+ " ../../../.eslintrc.js"
32
+ ]
33
+ },
34
+ "eslintIgnore" : [
35
+ " dist"
36
+ ]
37
+ }
Original file line number Diff line number Diff line change
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" : " Node" ,
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
+ }
Original file line number Diff line number Diff line change
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
+ } ) ) ;
Original file line number Diff line number Diff line change 199
199
"slug" : "basic"
200
200
}
201
201
} ,
202
+ {
203
+ "projectSlug" : "custom-placeholder" ,
204
+ "fullSlug" : "basic/custom-placeholder" ,
205
+ "pathFromRoot" : "examples/01-basic/11-custom-placeholder" ,
206
+ "config" : {
207
+ "playground" : true ,
208
+ "docs" : true ,
209
+ "author" : "ezhil56x" ,
210
+ "tags" : [
211
+ "Basic"
212
+ ]
213
+ } ,
214
+ "title" : "Change placeholder text" ,
215
+ "group" : {
216
+ "pathFromRoot" : "examples/01-basic" ,
217
+ "slug" : "basic"
218
+ }
219
+ } ,
202
220
{
203
221
"projectSlug" : "testing" ,
204
222
"fullSlug" : "basic/testing" ,
You can’t perform that action at this time.
0 commit comments