Skip to content

Commit 7035425

Browse files
committed
Implemented PR feedback
1 parent b2d2df9 commit 7035425

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

packages/react/src/components/FormattingToolbar/DefaultSelects/BlockTypeSelect.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
2-
BlockNoteEditor,
32
BlockSchema,
3+
Dictionary,
44
editorHasBlockWithType,
55
InlineContentSchema,
66
StyleSchema,
@@ -36,90 +36,90 @@ export type BlockTypeSelectItem = {
3636
icon: IconType;
3737
};
3838

39-
export const getDefaultBlockTypeSelectItems = (
40-
editor: BlockNoteEditor<any, any, any>,
39+
export const blockTypeSelectItems = (
40+
dict: Dictionary,
4141
): BlockTypeSelectItem[] => [
4242
{
43-
name: editor.dictionary.slash_menu.paragraph.title,
43+
name: dict.slash_menu.paragraph.title,
4444
type: "paragraph",
4545
icon: RiText,
4646
},
4747
{
48-
name: editor.dictionary.slash_menu.heading.title,
48+
name: dict.slash_menu.heading.title,
4949
type: "heading",
5050
props: { level: 1, isToggleable: false },
5151
icon: RiH1,
5252
},
5353
{
54-
name: editor.dictionary.slash_menu.heading_2.title,
54+
name: dict.slash_menu.heading_2.title,
5555
type: "heading",
5656
props: { level: 2, isToggleable: false },
5757
icon: RiH2,
5858
},
5959
{
60-
name: editor.dictionary.slash_menu.heading_3.title,
60+
name: dict.slash_menu.heading_3.title,
6161
type: "heading",
6262
props: { level: 3, isToggleable: false },
6363
icon: RiH3,
6464
},
6565
{
66-
name: editor.dictionary.slash_menu.heading_4.title,
66+
name: dict.slash_menu.heading_4.title,
6767
type: "heading",
6868
props: { level: 4, isToggleable: false },
6969
icon: RiH4,
7070
},
7171
{
72-
name: editor.dictionary.slash_menu.heading_5.title,
72+
name: dict.slash_menu.heading_5.title,
7373
type: "heading",
7474
props: { level: 5, isToggleable: false },
7575
icon: RiH5,
7676
},
7777
{
78-
name: editor.dictionary.slash_menu.heading_6.title,
78+
name: dict.slash_menu.heading_6.title,
7979
type: "heading",
8080
props: { level: 6, isToggleable: false },
8181
icon: RiH6,
8282
},
8383
{
84-
name: editor.dictionary.slash_menu.toggle_heading.title,
84+
name: dict.slash_menu.toggle_heading.title,
8585
type: "heading",
8686
props: { level: 1, isToggleable: true },
8787
icon: RiH1,
8888
},
8989
{
90-
name: editor.dictionary.slash_menu.toggle_heading_2.title,
90+
name: dict.slash_menu.toggle_heading_2.title,
9191
type: "heading",
9292
props: { level: 2, isToggleable: true },
9393
icon: RiH2,
9494
},
9595
{
96-
name: editor.dictionary.slash_menu.toggle_heading_3.title,
96+
name: dict.slash_menu.toggle_heading_3.title,
9797
type: "heading",
9898
props: { level: 3, isToggleable: true },
9999
icon: RiH3,
100100
},
101101
{
102-
name: editor.dictionary.slash_menu.quote.title,
102+
name: dict.slash_menu.quote.title,
103103
type: "quote",
104104
icon: RiQuoteText,
105105
},
106106
{
107-
name: editor.dictionary.slash_menu.toggle_list.title,
107+
name: dict.slash_menu.toggle_list.title,
108108
type: "toggleListItem",
109109
icon: RiPlayList2Fill,
110110
},
111111
{
112-
name: editor.dictionary.slash_menu.bullet_list.title,
112+
name: dict.slash_menu.bullet_list.title,
113113
type: "bulletListItem",
114114
icon: RiListUnordered,
115115
},
116116
{
117-
name: editor.dictionary.slash_menu.numbered_list.title,
117+
name: dict.slash_menu.numbered_list.title,
118118
type: "numberedListItem",
119119
icon: RiListOrdered,
120120
},
121121
{
122-
name: editor.dictionary.slash_menu.check_list.title,
122+
name: dict.slash_menu.check_list.title,
123123
type: "checkListItem",
124124
icon: RiListCheck3,
125125
},
@@ -141,7 +141,7 @@ export const BlockTypeSelect = (props: { items?: BlockTypeSelectItem[] }) => {
141141
// the schema.
142142
const filteredItems = useMemo(
143143
() =>
144-
(props.items || getDefaultBlockTypeSelectItems(editor)).filter((item) =>
144+
(props.items || blockTypeSelectItems(editor.dictionary)).filter((item) =>
145145
editorHasBlockWithType(
146146
editor,
147147
item.type,

0 commit comments

Comments
 (0)