11import {
22 BlockNoteSchema ,
3+ combineByGroup ,
4+ filterSuggestionItems ,
5+ locales ,
36 uploadToTmpFilesDotOrg_DEV_ONLY ,
47} from "@blocknote/core" ;
58import "@blocknote/core/fonts/inter.css" ;
6- import { useCreateBlockNote } from "@blocknote/react" ;
9+ import {
10+ getDefaultReactSlashMenuItems ,
11+ SuggestionMenuController ,
12+ useCreateBlockNote ,
13+ } from "@blocknote/react" ;
714import { BlockNoteView } from "@blocknote/mantine" ;
815import {
16+ getMultiColumnSlashMenuItems ,
17+ locales as multiColumnLocales ,
918 multiColumnDropCursor ,
1019 withMultiColumn ,
1120} from "@blocknote/xl-multi-column" ;
@@ -74,6 +83,10 @@ export default function DemoEditor(props: { theme?: "light" | "dark" }) {
7483
7584 const editor = useCreateBlockNote (
7685 {
86+ dictionary : {
87+ ...locales . en ,
88+ multi_column : multiColumnLocales . en ,
89+ } ,
7790 schema : withMultiColumn ( BlockNoteSchema . create ( ) ) ,
7891 dropCursor : multiColumnDropCursor ,
7992 collaboration : {
@@ -100,5 +113,27 @@ export default function DemoEditor(props: { theme?: "light" | "dark" }) {
100113 }
101114 } , [ warningShown ] ) ;
102115
103- return < BlockNoteView onFocus = { focus } editor = { editor } theme = { props . theme } /> ;
116+ const getSlashMenuItems = useMemo ( ( ) => {
117+ return async ( query : string ) =>
118+ filterSuggestionItems (
119+ combineByGroup (
120+ getDefaultReactSlashMenuItems ( editor ) ,
121+ getMultiColumnSlashMenuItems ( editor ) ,
122+ ) ,
123+ query ,
124+ ) ;
125+ } , [ editor ] ) ;
126+
127+ return (
128+ < BlockNoteView
129+ onFocus = { focus }
130+ editor = { editor }
131+ theme = { props . theme }
132+ slashMenu = { false } >
133+ < SuggestionMenuController
134+ triggerCharacter = { "/" }
135+ getItems = { getSlashMenuItems }
136+ />
137+ </ BlockNoteView >
138+ ) ;
104139}
0 commit comments