@blocknote/core 0.12.4 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +6 -2
  2. package/dist/blocknote.js +2362 -1544
  3. package/dist/blocknote.js.map +1 -1
  4. package/dist/blocknote.umd.cjs +6 -6
  5. package/dist/blocknote.umd.cjs.map +1 -1
  6. package/dist/webpack-stats.json +1 -1
  7. package/package.json +2 -2
  8. package/src/blocks/ImageBlockContent/ImageBlockContent.ts +1 -1
  9. package/src/editor/BlockNoteEditor.ts +24 -8
  10. package/src/editor/BlockNoteExtensions.ts +23 -12
  11. package/src/editor/BlockNoteTipTapEditor.ts +9 -6
  12. package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +24 -41
  13. package/src/extensions/ImagePanel/ImageToolbarPlugin.ts +27 -30
  14. package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +25 -3
  15. package/src/extensions/NonEditableBlocks/NonEditableBlockPlugin.ts +43 -12
  16. package/src/extensions/Placeholder/PlaceholderPlugin.ts +95 -0
  17. package/src/extensions/SideMenu/SideMenuPlugin.ts +3 -2
  18. package/src/extensions/SuggestionMenu/DefaultSuggestionItem.ts +3 -0
  19. package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +6 -2
  20. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +18 -44
  21. package/src/extensions/TableHandles/TableHandlesPlugin.ts +1 -1
  22. package/src/i18n/dictionary.ts +17 -0
  23. package/src/i18n/locales/en.ts +196 -0
  24. package/src/i18n/locales/fr.ts +196 -0
  25. package/src/i18n/locales/index.ts +4 -0
  26. package/src/i18n/locales/nl.ts +197 -0
  27. package/src/i18n/locales/zh.ts +213 -0
  28. package/src/index.ts +4 -1
  29. package/src/pm-nodes/BlockContainer.ts +20 -2
  30. package/src/util/browser.ts +2 -2
  31. package/src/util/typescript.ts +8 -0
  32. package/types/src/editor/BlockNoteEditor.d.ts +11 -1
  33. package/types/src/editor/BlockNoteExtensions.d.ts +3 -3
  34. package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +5 -4
  35. package/types/src/extensions/ImagePanel/ImageToolbarPlugin.d.ts +7 -5
  36. package/types/src/extensions/LinkToolbar/LinkToolbarPlugin.d.ts +3 -1
  37. package/types/src/extensions/Placeholder/PlaceholderPlugin.d.ts +3 -0
  38. package/types/src/extensions/SuggestionMenu/DefaultSuggestionItem.d.ts +2 -0
  39. package/types/src/extensions/SuggestionMenu/SuggestionPlugin.d.ts +2 -1
  40. package/types/src/i18n/dictionary.d.ts +2 -0
  41. package/types/src/i18n/locales/en.d.ts +184 -0
  42. package/types/src/i18n/locales/fr.d.ts +184 -0
  43. package/types/src/i18n/locales/index.d.ts +4 -0
  44. package/types/src/i18n/locales/nl.d.ts +2 -0
  45. package/types/src/i18n/locales/zh.d.ts +2 -0
  46. package/types/src/index.d.ts +4 -1
  47. package/types/src/pm-nodes/BlockContainer.d.ts +1 -1
  48. package/types/src/util/browser.d.ts +1 -1
  49. package/types/src/util/typescript.d.ts +1 -0
  50. package/src/extensions/Placeholder/PlaceholderExtension.ts +0 -124
  51. package/types/src/extensions/Placeholder/PlaceholderExtension.d.ts +0 -12
@@ -0,0 +1,196 @@
1
+ export const fr = {
2
+ slash_menu: {
3
+ heading: {
4
+ title: "Titre 1",
5
+ subtext: "Utilisé pour un titre de premier niveau",
6
+ aliases: ["h", "titre1", "h1"],
7
+ group: "Titres",
8
+ },
9
+ heading_2: {
10
+ title: "Titre 2",
11
+ subtext: "Utilisé pour les sections clés",
12
+ aliases: ["h2", "titre2", "sous-titre"],
13
+ group: "Titres",
14
+ },
15
+ heading_3: {
16
+ title: "Titre 3",
17
+ subtext: "Utilisé pour les sous-sections et les titres de groupe",
18
+ aliases: ["h3", "titre3", "sous-titre"],
19
+ group: "Titres",
20
+ },
21
+ numbered_list: {
22
+ title: "Liste Numérotée",
23
+ subtext: "Utilisé pour afficher une liste numérotée",
24
+ aliases: ["ol", "li", "liste", "listenumérotée", "liste numérotée"],
25
+ group: "Blocs de base",
26
+ },
27
+ bullet_list: {
28
+ title: "Liste à Puces",
29
+ subtext: "Utilisé pour afficher une liste non ordonnée",
30
+ aliases: ["ul", "li", "liste", "listeàpuces", "liste à puces"],
31
+ group: "Blocs de base",
32
+ },
33
+ paragraph: {
34
+ title: "Paragraphe",
35
+ subtext: "Utilisé pour le corps de votre document",
36
+ aliases: ["p", "paragraphe"],
37
+ group: "Blocs de base",
38
+ },
39
+ table: {
40
+ title: "Tableau",
41
+ subtext: "Utilisé pour les tableaux",
42
+ aliases: ["tableau"],
43
+ group: "Avancé",
44
+ },
45
+ image: {
46
+ title: "Image",
47
+ subtext: "Insérer une image",
48
+ aliases: [
49
+ "image",
50
+ "uploadImage",
51
+ "télécharger",
52
+ "img",
53
+ "photo",
54
+ "média",
55
+ "url",
56
+ "drive",
57
+ "dropbox",
58
+ ],
59
+ group: "Médias",
60
+ },
61
+ },
62
+ placeholders: {
63
+ default: "Entrez du texte ou tapez '/' pour les commandes",
64
+ heading: "Titre",
65
+ bulletListItem: "Liste",
66
+ numberedListItem: "Liste",
67
+ },
68
+ image: {
69
+ add_button: "Ajouter une Image",
70
+ },
71
+ // from react package:
72
+ side_menu: {
73
+ add_block_label: "Ajouter un bloc",
74
+ drag_handle_label: "Ouvrir le menu du bloc",
75
+ },
76
+ drag_handle: {
77
+ delete_menuitem: "Supprimer",
78
+ colors_menuitem: "Couleurs",
79
+ },
80
+ table_handle: {
81
+ delete_column_menuitem: "Supprimer la colonne",
82
+ delete_row_menuitem: "Supprimer la ligne",
83
+ add_left_menuitem: "Ajouter une colonne à gauche",
84
+ add_right_menuitem: "Ajouter une colonne à droite",
85
+ add_above_menuitem: "Ajouter une ligne au-dessus",
86
+ add_below_menuitem: "Ajouter une ligne en dessous",
87
+ },
88
+ suggestion_menu: {
89
+ no_items_title: "Aucun élément trouvé",
90
+ loading: "Chargement…",
91
+ },
92
+ color_picker: {
93
+ text_title: "Texte",
94
+ background_title: "Fond",
95
+ colors: {
96
+ default: "Défaut",
97
+ gray: "Gris",
98
+ brown: "Marron",
99
+ red: "Rouge",
100
+ orange: "Orange",
101
+ yellow: "Jaune",
102
+ green: "Vert",
103
+ blue: "Bleu",
104
+ purple: "Violet",
105
+ pink: "Rose",
106
+ },
107
+ },
108
+
109
+ formatting_toolbar: {
110
+ bold: {
111
+ tooltip: "Gras",
112
+ secondary_tooltip: "Mod+B",
113
+ },
114
+ italic: {
115
+ tooltip: "Italique",
116
+ secondary_tooltip: "Mod+I",
117
+ },
118
+ underline: {
119
+ tooltip: "Souligner",
120
+ secondary_tooltip: "Mod+U",
121
+ },
122
+ strike: {
123
+ tooltip: "Barré",
124
+ secondary_tooltip: "Mod+Shift+X",
125
+ },
126
+ code: {
127
+ tooltip: "Code",
128
+ secondary_tooltip: "",
129
+ },
130
+ colors: {
131
+ tooltip: "Couleurs",
132
+ },
133
+ link: {
134
+ tooltip: "Créer un lien",
135
+ secondary_tooltip: "Mod+K",
136
+ },
137
+ image_caption: {
138
+ tooltip: "Modifier la légende",
139
+ input_placeholder: "Modifier la légende",
140
+ },
141
+ image_replace: {
142
+ tooltip: "Remplacer l'image",
143
+ },
144
+ nest: {
145
+ tooltip: "Emboîter le bloc",
146
+ secondary_tooltip: "Tab",
147
+ },
148
+ unnest: {
149
+ tooltip: "Démboîter le bloc",
150
+ secondary_tooltip: "Shift+Tab",
151
+ },
152
+ align_left: {
153
+ tooltip: "Aligner le texte à gauche",
154
+ },
155
+ align_center: {
156
+ tooltip: "Aligner le texte au centre",
157
+ },
158
+ align_right: {
159
+ tooltip: "Aligner le texte à droite",
160
+ },
161
+ align_justify: {
162
+ tooltip: "Justifier le texte",
163
+ },
164
+ },
165
+ image_panel: {
166
+ upload: {
167
+ title: "Télécharger",
168
+ file_placeholder: "Télécharger l'image",
169
+ upload_error: "Erreur : Échec du téléchargement",
170
+ },
171
+ embed: {
172
+ title: "Intégrer",
173
+ embed_button: "Intégrer l'image",
174
+ url_placeholder: "Entrez l'URL",
175
+ },
176
+ },
177
+ link_toolbar: {
178
+ delete: {
179
+ tooltip: "Supprimer le lien",
180
+ },
181
+ edit: {
182
+ text: "Modifier le lien",
183
+ tooltip: "Modifier",
184
+ },
185
+ open: {
186
+ tooltip: "Ouvrir dans un nouvel onglet",
187
+ },
188
+ form: {
189
+ title_placeholder: "Modifier le titre",
190
+ url_placeholder: "Modifier l'URL",
191
+ },
192
+ },
193
+ generic: {
194
+ ctrl_shortcut: "Ctrl",
195
+ },
196
+ };
@@ -0,0 +1,4 @@
1
+ export * from "./en";
2
+ export * from "./nl";
3
+ export * from "./zh";
4
+ export * from "./fr";
@@ -0,0 +1,197 @@
1
+ import type { Dictionary } from "../dictionary";
2
+
3
+ export const nl: Dictionary = {
4
+ slash_menu: {
5
+ heading: {
6
+ title: "Kop 1",
7
+ subtext: "Gebruikt voor een hoofdkop",
8
+ aliases: ["h", "kop1", "h1"],
9
+ group: "Koppen",
10
+ },
11
+ heading_2: {
12
+ title: "Kop 2",
13
+ subtext: "Gebruikt voor belangrijke secties",
14
+ aliases: ["h2", "kop2", "subkop"],
15
+ group: "Koppen",
16
+ },
17
+ heading_3: {
18
+ title: "Kop 3",
19
+ subtext: "Gebruikt voor subsecties en groepskoppen",
20
+ aliases: ["h3", "kop3", "subkop"],
21
+ group: "Koppen",
22
+ },
23
+ numbered_list: {
24
+ title: "Genummerde Lijst",
25
+ subtext: "Gebruikt om een genummerde lijst weer te geven",
26
+ aliases: ["ol", "li", "lijst", "genummerdelijst", "genummerde lijst"],
27
+ group: "Basisblokken",
28
+ },
29
+ bullet_list: {
30
+ title: "Puntenlijst",
31
+ subtext: "Gebruikt om een ongeordende lijst weer te geven",
32
+ aliases: ["ul", "li", "lijst", "puntenlijst", "punten lijst"],
33
+ group: "Basisblokken",
34
+ },
35
+ paragraph: {
36
+ title: "Paragraaf",
37
+ subtext: "Gebruikt voor de hoofdtekst van uw document",
38
+ aliases: ["p", "paragraaf"],
39
+ group: "Basisblokken",
40
+ },
41
+ table: {
42
+ title: "Tabel",
43
+ subtext: "Gebruikt voor tabellen",
44
+ aliases: ["tabel"],
45
+ group: "Geavanceerd",
46
+ },
47
+ image: {
48
+ title: "Afbeelding",
49
+ subtext: "Voeg een afbeelding in",
50
+ aliases: [
51
+ "afbeelding",
52
+ "imageUpload",
53
+ "upload",
54
+ "img",
55
+ "foto",
56
+ "media",
57
+ "url",
58
+ "drive",
59
+ "dropbox",
60
+ ],
61
+ group: "Media",
62
+ },
63
+ },
64
+ placeholders: {
65
+ default: "Voer tekst in of type '/' voor commando's",
66
+ heading: "Kop",
67
+ bulletListItem: "Lijst",
68
+ numberedListItem: "Lijst",
69
+ },
70
+ image: {
71
+ add_button: "Afbeelding toevoegen",
72
+ },
73
+ // from react package:
74
+ side_menu: {
75
+ add_block_label: "Nieuw blok",
76
+ drag_handle_label: "Open blok menu",
77
+ },
78
+ drag_handle: {
79
+ delete_menuitem: "Verwijder",
80
+ colors_menuitem: "Kleuren",
81
+ },
82
+ table_handle: {
83
+ delete_column_menuitem: "Verwijder kolom",
84
+ delete_row_menuitem: "Verwijder rij",
85
+ add_left_menuitem: "Voeg kolom links toe",
86
+ add_right_menuitem: "Voeg kolom rechts toe",
87
+ add_above_menuitem: "Voeg rij boven toe",
88
+ add_below_menuitem: "Voeg rij onder toe",
89
+ },
90
+ suggestion_menu: {
91
+ no_items_title: "Geen items gevonden",
92
+ loading: "Laden…",
93
+ },
94
+ color_picker: {
95
+ text_title: "Tekst",
96
+ background_title: "Achtergrond",
97
+ colors: {
98
+ default: "Standaard",
99
+ gray: "Grijs",
100
+ brown: "Bruin",
101
+ red: "Rood",
102
+ orange: "Oranje",
103
+ yellow: "Geel",
104
+ green: "Groen",
105
+ blue: "Blauw",
106
+ purple: "Paars",
107
+ pink: "Roze",
108
+ },
109
+ },
110
+ formatting_toolbar: {
111
+ bold: {
112
+ tooltip: "Vet",
113
+ secondary_tooltip: "Mod+B",
114
+ },
115
+ italic: {
116
+ tooltip: "Cursief",
117
+ secondary_tooltip: "Mod+I",
118
+ },
119
+ underline: {
120
+ tooltip: "Onderstrepen",
121
+ secondary_tooltip: "Mod+U",
122
+ },
123
+ strike: {
124
+ tooltip: "Doorstrepen",
125
+ secondary_tooltip: "Mod+Shift+X",
126
+ },
127
+ code: {
128
+ tooltip: "Code",
129
+ secondary_tooltip: "",
130
+ },
131
+ colors: {
132
+ tooltip: "Kleuren",
133
+ },
134
+ link: {
135
+ tooltip: "Maak link",
136
+ secondary_tooltip: "Mod+K",
137
+ },
138
+ image_caption: {
139
+ tooltip: "Bewerk onderschrift",
140
+ input_placeholder: "Bewerk onderschrift",
141
+ },
142
+ image_replace: {
143
+ tooltip: "Vervang afbeelding",
144
+ },
145
+ nest: {
146
+ tooltip: "Nest blok",
147
+ secondary_tooltip: "Tab",
148
+ },
149
+ unnest: {
150
+ tooltip: "Ontnest blok",
151
+ secondary_tooltip: "Shift+Tab",
152
+ },
153
+ align_left: {
154
+ tooltip: "Tekst links uitlijnen",
155
+ },
156
+ align_center: {
157
+ tooltip: "Tekst centreren",
158
+ },
159
+ align_right: {
160
+ tooltip: "Tekst rechts uitlijnen",
161
+ },
162
+ align_justify: {
163
+ tooltip: "Tekst uitvullen",
164
+ },
165
+ },
166
+ image_panel: {
167
+ upload: {
168
+ title: "Upload",
169
+ file_placeholder: "Upload afbeelding",
170
+ upload_error: "Fout: Upload mislukt",
171
+ },
172
+ embed: {
173
+ title: "Insluiten",
174
+ embed_button: "Insluiten afbeelding",
175
+ url_placeholder: "Voer URL in",
176
+ },
177
+ },
178
+ link_toolbar: {
179
+ delete: {
180
+ tooltip: "Verwijder link",
181
+ },
182
+ edit: {
183
+ text: "Bewerk link",
184
+ tooltip: "Bewerk",
185
+ },
186
+ open: {
187
+ tooltip: "Open in nieuw tabblad",
188
+ },
189
+ form: {
190
+ title_placeholder: "Bewerk titel",
191
+ url_placeholder: "Bewerk URL",
192
+ },
193
+ },
194
+ generic: {
195
+ ctrl_shortcut: "Ctrl",
196
+ },
197
+ };
@@ -0,0 +1,213 @@
1
+ import type { Dictionary } from "../dictionary";
2
+
3
+ export const zh: Dictionary = {
4
+ slash_menu: {
5
+ heading: {
6
+ title: "一级标题",
7
+ subtext: "用于顶级标题",
8
+ aliases: ["h", "heading1", "h1", "标题", "一级标题"],
9
+ group: "标题",
10
+ },
11
+ heading_2: {
12
+ title: "二级标题",
13
+ subtext: "用于关键部分",
14
+ aliases: ["h2", "heading2", "subheading", "标题", "二级标题", "副标题"],
15
+ group: "标题",
16
+ },
17
+ heading_3: {
18
+ title: "三级标题",
19
+ subtext: "用于小节和分组标题",
20
+ aliases: ["h3", "heading3", "subheading", "标题", "三级标题"],
21
+ group: "标题",
22
+ },
23
+ numbered_list: {
24
+ title: "有序列表",
25
+ subtext: "用于显示有序列表",
26
+ aliases: [
27
+ "ol",
28
+ "li",
29
+ "list",
30
+ "numberedlist",
31
+ "numbered list",
32
+ "列表",
33
+ "有序列表",
34
+ ],
35
+ group: "基础",
36
+ },
37
+ bullet_list: {
38
+ title: "无序列表",
39
+ subtext: "用于显示无序列表",
40
+ aliases: [
41
+ "ul",
42
+ "li",
43
+ "list",
44
+ "bulletlist",
45
+ "bullet list",
46
+ "列表",
47
+ "无序列表",
48
+ ],
49
+ group: "基础",
50
+ },
51
+ paragraph: {
52
+ title: "段落",
53
+ subtext: "用于文档正文",
54
+ aliases: ["p", "paragraph", "text", "正文"],
55
+ group: "基础",
56
+ },
57
+ table: {
58
+ title: "表格",
59
+ subtext: "使用表格",
60
+ aliases: ["table", "表格"],
61
+ group: "高级功能",
62
+ },
63
+ image: {
64
+ title: "图片",
65
+ subtext: "插入图片",
66
+ aliases: [
67
+ "图片",
68
+ "上传图片",
69
+ "上传",
70
+ "image",
71
+ "img",
72
+ "相册",
73
+ "媒体",
74
+ "url",
75
+ ],
76
+ group: "媒体",
77
+ },
78
+ },
79
+ placeholders: {
80
+ default: "输入 '/' 以使用命令",
81
+ heading: "标题",
82
+ bulletListItem: "列表",
83
+ numberedListItem: "列表",
84
+ },
85
+ image: {
86
+ add_button: "添加图片",
87
+ },
88
+ // from react package:
89
+ side_menu: {
90
+ add_block_label: "添加块",
91
+ drag_handle_label: "打开菜单",
92
+ },
93
+ drag_handle: {
94
+ delete_menuitem: "删除",
95
+ colors_menuitem: "颜色",
96
+ },
97
+ table_handle: {
98
+ delete_column_menuitem: "删除列",
99
+ delete_row_menuitem: "删除行",
100
+ add_left_menuitem: "左侧添加列",
101
+ add_right_menuitem: "右侧添加列",
102
+ add_above_menuitem: "上方添加行",
103
+ add_below_menuitem: "下方添加行",
104
+ },
105
+ suggestion_menu: {
106
+ no_items_title: "无匹配项",
107
+ loading: "加载中…",
108
+ },
109
+ color_picker: {
110
+ text_title: "文本",
111
+ background_title: "背景色",
112
+ colors: {
113
+ default: "默认",
114
+ gray: "灰色",
115
+ brown: "棕色",
116
+ red: "红色",
117
+ orange: "橙色",
118
+ yellow: "黄色",
119
+ green: "绿色",
120
+ blue: "蓝色",
121
+ purple: "紫色",
122
+ pink: "粉色",
123
+ },
124
+ },
125
+
126
+ formatting_toolbar: {
127
+ bold: {
128
+ tooltip: "加粗",
129
+ secondary_tooltip: "Mod+B",
130
+ },
131
+ italic: {
132
+ tooltip: "斜体",
133
+ secondary_tooltip: "Mod+I",
134
+ },
135
+ underline: {
136
+ tooltip: "下划线",
137
+ secondary_tooltip: "Mod+U",
138
+ },
139
+ strike: {
140
+ tooltip: "删除线",
141
+ secondary_tooltip: "Mod+Shift+X",
142
+ },
143
+ code: {
144
+ tooltip: "代码标记",
145
+ secondary_tooltip: "",
146
+ },
147
+ colors: {
148
+ tooltip: "颜色",
149
+ },
150
+ link: {
151
+ tooltip: "添加链接",
152
+ secondary_tooltip: "Mod+K",
153
+ },
154
+ image_caption: {
155
+ tooltip: "编辑标题",
156
+ input_placeholder: "编辑标题",
157
+ },
158
+ image_replace: {
159
+ tooltip: "替换图片",
160
+ },
161
+ nest: {
162
+ tooltip: "嵌套",
163
+ secondary_tooltip: "Tab",
164
+ },
165
+ unnest: {
166
+ tooltip: "取消嵌套",
167
+ secondary_tooltip: "Shift+Tab",
168
+ },
169
+ align_left: {
170
+ tooltip: "左对齐",
171
+ },
172
+ align_center: {
173
+ tooltip: "居中",
174
+ },
175
+ align_right: {
176
+ tooltip: "右对齐",
177
+ },
178
+ align_justify: {
179
+ tooltip: "文本对齐",
180
+ },
181
+ },
182
+ image_panel: {
183
+ upload: {
184
+ title: "上传",
185
+ file_placeholder: "上传图片",
186
+ upload_error: "Error:上传失败",
187
+ },
188
+ embed: {
189
+ title: "嵌入",
190
+ embed_button: "嵌入图片",
191
+ url_placeholder: "输入图片地址",
192
+ },
193
+ },
194
+ link_toolbar: {
195
+ delete: {
196
+ tooltip: "清除链接",
197
+ },
198
+ edit: {
199
+ text: "编辑链接",
200
+ tooltip: "编辑",
201
+ },
202
+ open: {
203
+ tooltip: "新窗口打开",
204
+ },
205
+ form: {
206
+ title_placeholder: "编辑标题",
207
+ url_placeholder: "编辑链接地址",
208
+ },
209
+ },
210
+ generic: {
211
+ ctrl_shortcut: "Ctrl",
212
+ },
213
+ };
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as locales from "./i18n/locales";
1
2
  export * from "./api/exporters/html/externalHTMLExporter";
2
3
  export * from "./api/exporters/html/internalHTMLSerializer";
3
4
  export * from "./api/testUtil";
@@ -25,4 +26,6 @@ export * from "./util/string";
25
26
  export * from "./api/nodeConversions/nodeConversions";
26
27
  export * from "./api/testUtil/partialBlockTestUtil";
27
28
  export * from "./extensions/UniqueID/UniqueID";
28
- export { UnreachableCaseError } from "./util/typescript";
29
+ export * from "./i18n/dictionary";
30
+ export { UnreachableCaseError, assertEmpty } from "./util/typescript";
31
+ export { locales };
@@ -62,7 +62,7 @@ declare module "@tiptap/core" {
62
62
  */
63
63
  export const BlockContainer = Node.create<{
64
64
  domAttributes?: BlockNoteDOMAttributes;
65
- editor: BlockNoteEditor<BlockSchema, InlineContentSchema, StyleSchema>;
65
+ editor: BlockNoteEditor<any, any, any>;
66
66
  }>({
67
67
  name: "blockContainer",
68
68
  group: "blockContainer",
@@ -139,7 +139,7 @@ export const BlockContainer = Node.create<{
139
139
  state.schema.nodes["blockContainer"].createAndFill()!;
140
140
 
141
141
  if (dispatch) {
142
- state.tr.insert(pos, newBlock);
142
+ state.tr.insert(pos, newBlock).scrollIntoView();
143
143
  }
144
144
 
145
145
  return true;
@@ -470,6 +470,8 @@ export const BlockContainer = Node.create<{
470
470
  )
471
471
  : undefined
472
472
  );
473
+
474
+ state.tr.scrollIntoView();
473
475
  }
474
476
 
475
477
  return true;
@@ -686,10 +688,26 @@ export const BlockContainer = Node.create<{
686
688
  // Always returning true for tab key presses ensures they're not captured by the browser. Otherwise, they blur the
687
689
  // editor since the browser will try to use tab for keyboard navigation.
688
690
  Tab: () => {
691
+ if (
692
+ this.options.editor.formattingToolbar?.shown ||
693
+ this.options.editor.linkToolbar?.shown ||
694
+ this.options.editor.imagePanel?.shown
695
+ ) {
696
+ // don't handle tabs if a toolbar is shown, so we can tab into / out of it
697
+ return false;
698
+ }
689
699
  this.editor.commands.sinkListItem("blockContainer");
690
700
  return true;
691
701
  },
692
702
  "Shift-Tab": () => {
703
+ if (
704
+ this.options.editor.formattingToolbar?.shown ||
705
+ this.options.editor.linkToolbar?.shown ||
706
+ this.options.editor.imagePanel?.shown
707
+ ) {
708
+ // don't handle tabs if a toolbar is shown, so we can tab into / out of it
709
+ return false;
710
+ }
693
711
  this.editor.commands.liftListItem("blockContainer");
694
712
  return true;
695
713
  },
@@ -4,11 +4,11 @@ export const isAppleOS = () =>
4
4
  (/AppleWebKit/.test(navigator.userAgent) &&
5
5
  /Mobile\/\w+/.test(navigator.userAgent)));
6
6
 
7
- export function formatKeyboardShortcut(shortcut: string) {
7
+ export function formatKeyboardShortcut(shortcut: string, ctrlText = "Ctrl") {
8
8
  if (isAppleOS()) {
9
9
  return shortcut.replace("Mod", "⌘");
10
10
  } else {
11
- return shortcut.replace("Mod", "Ctrl");
11
+ return shortcut.replace("Mod", ctrlText);
12
12
  }
13
13
  }
14
14
 
@@ -4,5 +4,13 @@ export class UnreachableCaseError extends Error {
4
4
  }
5
5
  }
6
6
 
7
+ export function assertEmpty(obj: Record<string, never>, throwError = true) {
8
+ const { "data-test": dataTest, ...rest } = obj; // exclude data-test
9
+
10
+ if (Object.keys(rest).length > 0 && throwError) {
11
+ throw new Error("Object must be empty " + JSON.stringify(obj));
12
+ }
13
+ }
14
+
7
15
  // TODO: change for built-in version of typescript 5.4 after upgrade
8
16
  export type NoInfer<T> = [T][T extends any ? 0 : never];