@blocknote/core 0.32.0-hackdays.0 → 0.33.0
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.
- package/dist/blocknote.cjs +9 -9
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +2193 -1961
- package/dist/blocknote.js.map +1 -1
- package/dist/en-CsgPjHa4.cjs +2 -0
- package/dist/en-CsgPjHa4.cjs.map +1 -0
- package/dist/{en-qGo6sk9V.js → en-Dx9fwHD4.js} +47 -1
- package/dist/en-Dx9fwHD4.js.map +1 -0
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +1453 -30
- package/dist/locales.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/webpack-stats.json +1 -1
- package/package.json +1 -1
- package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +18 -0
- package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +10 -0
- package/src/api/blockManipulation/commands/moveBlocks/__snapshots__/moveBlocks.test.ts.snap +40 -0
- package/src/api/blockManipulation/commands/replaceBlocks/__snapshots__/replaceBlocks.test.ts.snap +23 -0
- package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +13 -0
- package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +50 -0
- package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +72 -74
- package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +1 -0
- package/src/blocks/ListItemBlockContent/ToggleListItemBlockContent/ToggleListItemBlockContent.ts +104 -0
- package/src/blocks/ToggleWrapper/createToggleWrapper.ts +182 -0
- package/src/blocks/defaultBlockTypeGuards.ts +6 -2
- package/src/blocks/defaultBlocks.ts +2 -0
- package/src/editor/Block.css +112 -25
- package/src/editor/BlockNoteEditor.test.ts +1 -0
- package/src/editor/BlockNoteEditor.ts +18 -0
- package/src/editor/BlockNoteExtensions.ts +1 -1
- package/src/editor/BlockNoteTipTapEditor.ts +1 -0
- package/src/editor/editor.css +3 -0
- package/src/extensions/Collaboration/CursorPlugin.ts +33 -2
- package/src/extensions/Collaboration/ForkYDocPlugin.ts +26 -8
- package/src/extensions/Collaboration/UndoPlugin.ts +3 -2
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +4 -1
- package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +16 -4
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +64 -0
- package/src/i18n/locales/ar.ts +46 -0
- package/src/i18n/locales/de.ts +65 -0
- package/src/i18n/locales/en.ts +46 -0
- package/src/i18n/locales/es.ts +46 -0
- package/src/i18n/locales/fr.ts +68 -0
- package/src/i18n/locales/he.ts +402 -0
- package/src/i18n/locales/hr.ts +46 -0
- package/src/i18n/locales/index.ts +1 -0
- package/src/i18n/locales/is.ts +67 -0
- package/src/i18n/locales/it.ts +67 -0
- package/src/i18n/locales/ja.ts +66 -0
- package/src/i18n/locales/ko.ts +46 -0
- package/src/i18n/locales/nl.ts +47 -0
- package/src/i18n/locales/no.ts +64 -0
- package/src/i18n/locales/pl.ts +52 -0
- package/src/i18n/locales/pt.ts +46 -0
- package/src/i18n/locales/ru.ts +62 -0
- package/src/i18n/locales/sk.ts +46 -0
- package/src/i18n/locales/uk.ts +46 -0
- package/src/i18n/locales/vi.ts +46 -0
- package/src/i18n/locales/zh-tw.ts +54 -0
- package/src/i18n/locales/zh.ts +54 -0
- package/src/index.ts +1 -0
- package/src/schema/blocks/createSpec.ts +3 -1
- package/src/util/browser.ts +11 -1
- package/types/src/api/blockManipulation/setupTestEnv.d.ts +42 -2
- package/types/src/blocks/HeadingBlockContent/HeadingBlockContent.d.ts +12 -3
- package/types/src/blocks/ListItemBlockContent/ToggleListItemBlockContent/ToggleListItemBlockContent.d.ts +46 -0
- package/types/src/blocks/ToggleWrapper/createToggleWrapper.d.ts +15 -0
- package/types/src/blocks/defaultBlockTypeGuards.d.ts +2 -2
- package/types/src/blocks/defaultBlocks.d.ts +84 -4
- package/types/src/editor/BlockNoteEditor.d.ts +14 -0
- package/types/src/extensions/Collaboration/CursorPlugin.d.ts +6 -0
- package/types/src/extensions/Collaboration/UndoPlugin.d.ts +4 -1
- package/types/src/i18n/locales/en.d.ts +45 -0
- package/types/src/i18n/locales/he.d.ts +2 -0
- package/types/src/i18n/locales/index.d.ts +1 -0
- package/types/src/i18n/locales/sk.d.ts +45 -0
- package/types/src/index.d.ts +1 -0
- package/types/src/schema/blocks/createSpec.d.ts +2 -1
- package/dist/en-BXVKCwYt.cjs +0 -2
- package/dist/en-BXVKCwYt.cjs.map +0 -1
- package/dist/en-qGo6sk9V.js.map +0 -1
- package/types/src/api/blockManipulation/selections/selection.test.d.ts +0 -1
- package/types/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.d.ts +0 -5
- package/types/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.d.ts +0 -1
- package/types/src/extensions/Collaboration/createCollaborationExtensions.d.ts +0 -17
package/src/i18n/locales/uk.ts
CHANGED
|
@@ -20,6 +20,42 @@ export const uk: Dictionary = {
|
|
|
20
20
|
aliases: ["h3", "heading3", "subheading", "заголовок3"],
|
|
21
21
|
group: "Заголовки",
|
|
22
22
|
},
|
|
23
|
+
heading_4: {
|
|
24
|
+
title: "Заголовок 4",
|
|
25
|
+
subtext: "Використовується для менших підрозділів",
|
|
26
|
+
aliases: ["h4", "heading4", "subheading4", "заголовок4"],
|
|
27
|
+
group: "Підзаголовки",
|
|
28
|
+
},
|
|
29
|
+
heading_5: {
|
|
30
|
+
title: "Заголовок 5",
|
|
31
|
+
subtext: "Використовується для заголовків менших підрозділів",
|
|
32
|
+
aliases: ["h5", "heading5", "subheading5", "заголовок5", "підзаголовок5"],
|
|
33
|
+
group: "Підзаголовки",
|
|
34
|
+
},
|
|
35
|
+
heading_6: {
|
|
36
|
+
title: "Заголовок 6",
|
|
37
|
+
subtext: "Використовується для заголовків найнижчого рівня",
|
|
38
|
+
aliases: ["h6", "heading6", "subheading6", "заголовок6", "підзаголовок6"],
|
|
39
|
+
group: "Підзаголовки",
|
|
40
|
+
},
|
|
41
|
+
toggle_heading: {
|
|
42
|
+
title: "Розгортаємий заголовок 1",
|
|
43
|
+
subtext: "Розгортаємий заголовок найвищого рівня",
|
|
44
|
+
aliases: ["h", "heading1", "h1", "заголовок1", "розгортаємий"],
|
|
45
|
+
group: "Підзаголовки",
|
|
46
|
+
},
|
|
47
|
+
toggle_heading_2: {
|
|
48
|
+
title: "Розгортаємий заголовок 2",
|
|
49
|
+
subtext: "Розгортаємий основний заголовок розділу",
|
|
50
|
+
aliases: ["h2", "heading2", "subheading", "заголовок2", "розгортаємий"],
|
|
51
|
+
group: "Підзаголовки",
|
|
52
|
+
},
|
|
53
|
+
toggle_heading_3: {
|
|
54
|
+
title: "Розгортаємий заголовок 3",
|
|
55
|
+
subtext: "Розгортаємий підзаголовок і груповий заголовок",
|
|
56
|
+
aliases: ["h3", "heading3", "subheading", "заголовок3", "розгортаємий"],
|
|
57
|
+
group: "Підзаголовки",
|
|
58
|
+
},
|
|
23
59
|
quote: {
|
|
24
60
|
title: "Цитата",
|
|
25
61
|
subtext: "Цитата або уривок",
|
|
@@ -70,6 +106,12 @@ export const uk: Dictionary = {
|
|
|
70
106
|
],
|
|
71
107
|
group: "Базові блоки",
|
|
72
108
|
},
|
|
109
|
+
toggle_list: {
|
|
110
|
+
title: "Розгортаємий список",
|
|
111
|
+
subtext: "Список із прихованими підпунктами",
|
|
112
|
+
aliases: ["li", "список", "розгортаємий список", "складений список"],
|
|
113
|
+
group: "Базові блоки",
|
|
114
|
+
},
|
|
73
115
|
paragraph: {
|
|
74
116
|
title: "Параграф",
|
|
75
117
|
subtext: "Основний текст документа",
|
|
@@ -158,6 +200,7 @@ export const uk: Dictionary = {
|
|
|
158
200
|
placeholders: {
|
|
159
201
|
default: "Введіть текст або наберіть '/' для команд",
|
|
160
202
|
heading: "Заголовок",
|
|
203
|
+
toggleListItem: "Перемикач",
|
|
161
204
|
bulletListItem: "Список",
|
|
162
205
|
numberedListItem: "Список",
|
|
163
206
|
checkListItem: "Список",
|
|
@@ -359,6 +402,9 @@ export const uk: Dictionary = {
|
|
|
359
402
|
},
|
|
360
403
|
},
|
|
361
404
|
comments: {
|
|
405
|
+
edited: "відредаговано",
|
|
406
|
+
save_button_text: "Зберегти",
|
|
407
|
+
cancel_button_text: "Скасувати",
|
|
362
408
|
actions: {
|
|
363
409
|
add_reaction: "Додати реакцію",
|
|
364
410
|
resolve: "Вирішити",
|
package/src/i18n/locales/vi.ts
CHANGED
|
@@ -20,6 +20,42 @@ export const vi: Dictionary = {
|
|
|
20
20
|
aliases: ["h3", "tieude3", "tieudephu"],
|
|
21
21
|
group: "Tiêu đề",
|
|
22
22
|
},
|
|
23
|
+
heading_4: {
|
|
24
|
+
title: "Tiêu đề H4",
|
|
25
|
+
subtext: "Sử dụng cho tiêu đề phụ nhỏ hơn",
|
|
26
|
+
aliases: ["h4", "tieude4", "tieudephu4"],
|
|
27
|
+
group: "Tiêu đề phụ",
|
|
28
|
+
},
|
|
29
|
+
heading_5: {
|
|
30
|
+
title: "Tiêu đề H5",
|
|
31
|
+
subtext: "Sử dụng cho tiêu đề phụ nhỏ hơn",
|
|
32
|
+
aliases: ["h5", "tieude5", "tieudephu5"],
|
|
33
|
+
group: "Tiêu đề phụ",
|
|
34
|
+
},
|
|
35
|
+
heading_6: {
|
|
36
|
+
title: "Tiêu đề H6",
|
|
37
|
+
subtext: "Sử dụng cho tiêu đề cấp thấp nhất",
|
|
38
|
+
aliases: ["h6", "tieude6", "tieudephu6"],
|
|
39
|
+
group: "Tiêu đề phụ",
|
|
40
|
+
},
|
|
41
|
+
toggle_heading: {
|
|
42
|
+
title: "Tiêu đề có thể thu gọn H1",
|
|
43
|
+
subtext: "Tiêu đề cấp cao nhất có thể thu gọn",
|
|
44
|
+
aliases: ["h", "tieude1", "dd1", "thugon"],
|
|
45
|
+
group: "Tiêu đề phụ",
|
|
46
|
+
},
|
|
47
|
+
toggle_heading_2: {
|
|
48
|
+
title: "Tiêu đề có thể thu gọn H2",
|
|
49
|
+
subtext: "Tiêu đề cho các phần chính có thể thu gọn",
|
|
50
|
+
aliases: ["h2", "tieude2", "tieudephu", "thugon"],
|
|
51
|
+
group: "Tiêu đề phụ",
|
|
52
|
+
},
|
|
53
|
+
toggle_heading_3: {
|
|
54
|
+
title: "Tiêu đề có thể thu gọn H3",
|
|
55
|
+
subtext: "Tiêu đề cho phụ đề và tiêu đề nhóm có thể thu gọn",
|
|
56
|
+
aliases: ["h3", "tieude3", "tieudephu", "thugon"],
|
|
57
|
+
group: "Tiêu đề phụ",
|
|
58
|
+
},
|
|
23
59
|
quote: {
|
|
24
60
|
title: "Trích dẫn",
|
|
25
61
|
subtext: "Trích dẫn hoặc đoạn trích",
|
|
@@ -51,6 +87,12 @@ export const vi: Dictionary = {
|
|
|
51
87
|
],
|
|
52
88
|
group: "Khối cơ bản",
|
|
53
89
|
},
|
|
90
|
+
toggle_list: {
|
|
91
|
+
title: "Danh sách có thể thu gọn",
|
|
92
|
+
subtext: "Danh sách với các mục con có thể ẩn",
|
|
93
|
+
aliases: ["li", "danh sach", "danh sach thu gon", "danh sach co the an"],
|
|
94
|
+
group: "Khối cơ bản",
|
|
95
|
+
},
|
|
54
96
|
paragraph: {
|
|
55
97
|
title: "Đoạn văn",
|
|
56
98
|
subtext: "Sử dụng cho nội dung chính của tài liệu",
|
|
@@ -132,6 +174,7 @@ export const vi: Dictionary = {
|
|
|
132
174
|
placeholders: {
|
|
133
175
|
default: "Nhập văn bản hoặc gõ '/' để thêm định dạng",
|
|
134
176
|
heading: "Tiêu đề",
|
|
177
|
+
toggleListItem: "Chuyển đổi",
|
|
135
178
|
bulletListItem: "Danh sách",
|
|
136
179
|
numberedListItem: "Danh sách",
|
|
137
180
|
checkListItem: "Danh sách",
|
|
@@ -334,6 +377,9 @@ export const vi: Dictionary = {
|
|
|
334
377
|
},
|
|
335
378
|
},
|
|
336
379
|
comments: {
|
|
380
|
+
edited: "đã chỉnh sửa",
|
|
381
|
+
save_button_text: "Lưu",
|
|
382
|
+
cancel_button_text: "Hủy",
|
|
337
383
|
actions: {
|
|
338
384
|
add_reaction: "Thêm phản ứng",
|
|
339
385
|
resolve: "Giải quyết",
|
|
@@ -20,6 +20,50 @@ export const zhTW: Dictionary = {
|
|
|
20
20
|
aliases: ["h3", "heading3", "subheading", "標題", "三級標題"],
|
|
21
21
|
group: "標題",
|
|
22
22
|
},
|
|
23
|
+
heading_4: {
|
|
24
|
+
title: "四級標題",
|
|
25
|
+
subtext: "用於小節和分組標題",
|
|
26
|
+
aliases: ["h4", "heading4", "subheading", "標題", "四級標題"],
|
|
27
|
+
group: "副標題",
|
|
28
|
+
},
|
|
29
|
+
heading_5: {
|
|
30
|
+
title: "五級標題",
|
|
31
|
+
subtext: "用於小節和分組標題",
|
|
32
|
+
aliases: ["h5", "heading5", "subheading", "標題", "五級標題"],
|
|
33
|
+
group: "副標題",
|
|
34
|
+
},
|
|
35
|
+
heading_6: {
|
|
36
|
+
title: "六級標題",
|
|
37
|
+
subtext: "用於小節和分組標題",
|
|
38
|
+
aliases: ["h6", "heading6", "subheading", "標題", "六級標題"],
|
|
39
|
+
group: "副標題",
|
|
40
|
+
},
|
|
41
|
+
toggle_heading: {
|
|
42
|
+
title: "可摺疊一級標題",
|
|
43
|
+
subtext: "可摺疊的頂級標題",
|
|
44
|
+
aliases: ["h", "heading1", "h1", "標題", "一級標題", "摺疊"],
|
|
45
|
+
group: "副標題",
|
|
46
|
+
},
|
|
47
|
+
toggle_heading_2: {
|
|
48
|
+
title: "可摺疊二級標題",
|
|
49
|
+
subtext: "可摺疊的關鍵部分標題",
|
|
50
|
+
aliases: [
|
|
51
|
+
"h2",
|
|
52
|
+
"heading2",
|
|
53
|
+
"subheading",
|
|
54
|
+
"標題",
|
|
55
|
+
"二級標題",
|
|
56
|
+
"副標題",
|
|
57
|
+
"摺疊",
|
|
58
|
+
],
|
|
59
|
+
group: "副標題",
|
|
60
|
+
},
|
|
61
|
+
toggle_heading_3: {
|
|
62
|
+
title: "可摺疊三級標題",
|
|
63
|
+
subtext: "可摺疊的小節和分組標題",
|
|
64
|
+
aliases: ["h3", "heading3", "subheading", "標題", "三級標題", "摺疊"],
|
|
65
|
+
group: "副標題",
|
|
66
|
+
},
|
|
23
67
|
quote: {
|
|
24
68
|
title: "引用",
|
|
25
69
|
subtext: "引用或摘錄",
|
|
@@ -69,6 +113,12 @@ export const zhTW: Dictionary = {
|
|
|
69
113
|
],
|
|
70
114
|
group: "基礎",
|
|
71
115
|
},
|
|
116
|
+
toggle_list: {
|
|
117
|
+
title: "可摺疊列表",
|
|
118
|
+
subtext: "帶有可隱藏子項的列表",
|
|
119
|
+
aliases: ["li", "列表", "可摺疊列表", "摺疊列表"],
|
|
120
|
+
group: "基礎",
|
|
121
|
+
},
|
|
72
122
|
paragraph: {
|
|
73
123
|
title: "段落",
|
|
74
124
|
subtext: "用於文件正文",
|
|
@@ -166,6 +216,7 @@ export const zhTW: Dictionary = {
|
|
|
166
216
|
placeholders: {
|
|
167
217
|
default: "輸入 '/' 以使用指令",
|
|
168
218
|
heading: "標題",
|
|
219
|
+
toggleListItem: "切換",
|
|
169
220
|
bulletListItem: "列表",
|
|
170
221
|
numberedListItem: "列表",
|
|
171
222
|
checkListItem: "列表",
|
|
@@ -368,6 +419,9 @@ export const zhTW: Dictionary = {
|
|
|
368
419
|
},
|
|
369
420
|
},
|
|
370
421
|
comments: {
|
|
422
|
+
edited: "已編輯",
|
|
423
|
+
save_button_text: "儲存",
|
|
424
|
+
cancel_button_text: "取消",
|
|
371
425
|
actions: {
|
|
372
426
|
add_reaction: "新增回應",
|
|
373
427
|
resolve: "解決",
|
package/src/i18n/locales/zh.ts
CHANGED
|
@@ -20,6 +20,50 @@ export const zh: Dictionary = {
|
|
|
20
20
|
aliases: ["h3", "heading3", "subheading", "标题", "三级标题"],
|
|
21
21
|
group: "标题",
|
|
22
22
|
},
|
|
23
|
+
heading_4: {
|
|
24
|
+
title: "四级标题",
|
|
25
|
+
subtext: "用于较小的子节标题",
|
|
26
|
+
aliases: ["h4", "heading4", "subheading4", "四级标题"],
|
|
27
|
+
group: "副标题",
|
|
28
|
+
},
|
|
29
|
+
heading_5: {
|
|
30
|
+
title: "五级标题",
|
|
31
|
+
subtext: "用于较小的子节标题",
|
|
32
|
+
aliases: ["h5", "heading5", "subheading5", "五级标题"],
|
|
33
|
+
group: "副标题",
|
|
34
|
+
},
|
|
35
|
+
heading_6: {
|
|
36
|
+
title: "六级标题",
|
|
37
|
+
subtext: "用于最低层级的标题",
|
|
38
|
+
aliases: ["h6", "heading6", "subheading6", "六级标题"],
|
|
39
|
+
group: "副标题",
|
|
40
|
+
},
|
|
41
|
+
toggle_heading: {
|
|
42
|
+
title: "可折叠一级标题",
|
|
43
|
+
subtext: "可折叠的顶级标题",
|
|
44
|
+
aliases: ["h", "heading1", "h1", "标题", "一级标题", "折叠"],
|
|
45
|
+
group: "副标题",
|
|
46
|
+
},
|
|
47
|
+
toggle_heading_2: {
|
|
48
|
+
title: "可折叠二级标题",
|
|
49
|
+
subtext: "可折叠的关键部分标题",
|
|
50
|
+
aliases: [
|
|
51
|
+
"h2",
|
|
52
|
+
"heading2",
|
|
53
|
+
"subheading",
|
|
54
|
+
"标题",
|
|
55
|
+
"二级标题",
|
|
56
|
+
"副标题",
|
|
57
|
+
"折叠",
|
|
58
|
+
],
|
|
59
|
+
group: "副标题",
|
|
60
|
+
},
|
|
61
|
+
toggle_heading_3: {
|
|
62
|
+
title: "可折叠三级标题",
|
|
63
|
+
subtext: "可折叠的小节和分组标题",
|
|
64
|
+
aliases: ["h3", "heading3", "subheading", "标题", "三级标题", "折叠"],
|
|
65
|
+
group: "副标题",
|
|
66
|
+
},
|
|
23
67
|
quote: {
|
|
24
68
|
title: "引用",
|
|
25
69
|
subtext: "引用或摘录",
|
|
@@ -69,6 +113,12 @@ export const zh: Dictionary = {
|
|
|
69
113
|
],
|
|
70
114
|
group: "基础",
|
|
71
115
|
},
|
|
116
|
+
toggle_list: {
|
|
117
|
+
title: "可折叠列表",
|
|
118
|
+
subtext: "带有可隐藏子项的列表",
|
|
119
|
+
aliases: ["li", "列表", "可折叠列表", "折叠列表"],
|
|
120
|
+
group: "基础",
|
|
121
|
+
},
|
|
72
122
|
paragraph: {
|
|
73
123
|
title: "段落",
|
|
74
124
|
subtext: "用于文档正文",
|
|
@@ -166,6 +216,7 @@ export const zh: Dictionary = {
|
|
|
166
216
|
placeholders: {
|
|
167
217
|
default: "输入 '/' 以使用命令",
|
|
168
218
|
heading: "标题",
|
|
219
|
+
toggleListItem: "切换",
|
|
169
220
|
bulletListItem: "列表",
|
|
170
221
|
numberedListItem: "列表",
|
|
171
222
|
checkListItem: "列表",
|
|
@@ -368,6 +419,9 @@ export const zh: Dictionary = {
|
|
|
368
419
|
},
|
|
369
420
|
},
|
|
370
421
|
comments: {
|
|
422
|
+
edited: "已编辑",
|
|
423
|
+
save_button_text: "保存",
|
|
424
|
+
cancel_button_text: "取消",
|
|
371
425
|
actions: {
|
|
372
426
|
add_reaction: "添加反应",
|
|
373
427
|
resolve: "解决",
|
package/src/index.ts
CHANGED
|
@@ -26,6 +26,7 @@ export * from "./blocks/ImageBlockContent/ImageBlockContent.js";
|
|
|
26
26
|
export * from "./blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.js";
|
|
27
27
|
export * from "./blocks/PageBreakBlockContent/PageBreakBlockContent.js";
|
|
28
28
|
export * from "./blocks/PageBreakBlockContent/schema.js";
|
|
29
|
+
export * from "./blocks/ToggleWrapper/createToggleWrapper.js";
|
|
29
30
|
export {
|
|
30
31
|
EMPTY_CELL_HEIGHT,
|
|
31
32
|
EMPTY_CELL_WIDTH,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Editor } from "@tiptap/core";
|
|
2
2
|
import { TagParseRule } from "@tiptap/pm/model";
|
|
3
|
-
import { NodeView } from "@tiptap/pm/view";
|
|
3
|
+
import { NodeView, ViewMutationRecord } from "@tiptap/pm/view";
|
|
4
4
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
5
5
|
import { InlineContentSchema } from "../inlineContent/types.js";
|
|
6
6
|
import { StyleSchema } from "../styles/types.js";
|
|
@@ -44,6 +44,7 @@ export type CustomBlockImplementation<
|
|
|
44
44
|
) => {
|
|
45
45
|
dom: HTMLElement;
|
|
46
46
|
contentDOM?: HTMLElement;
|
|
47
|
+
ignoreMutation?: (mutation: ViewMutationRecord) => boolean;
|
|
47
48
|
destroy?: () => void;
|
|
48
49
|
};
|
|
49
50
|
// Exports block to external HTML. If not defined, the output will be the same
|
|
@@ -199,6 +200,7 @@ export function createBlockSpec<
|
|
|
199
200
|
block.type,
|
|
200
201
|
block.props,
|
|
201
202
|
blockConfig.propSchema,
|
|
203
|
+
blockConfig.isFileBlock,
|
|
202
204
|
blockContentDOMAttributes,
|
|
203
205
|
);
|
|
204
206
|
|
package/src/util/browser.ts
CHANGED
|
@@ -13,7 +13,17 @@ export function formatKeyboardShortcut(shortcut: string, ctrlText = "Ctrl") {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function mergeCSSClasses(...classes: (string | false | undefined)[]) {
|
|
16
|
-
return
|
|
16
|
+
return [
|
|
17
|
+
// Converts to & from set to remove duplicates.
|
|
18
|
+
...new Set(
|
|
19
|
+
classes
|
|
20
|
+
.filter((c) => c)
|
|
21
|
+
// Ensures that if multiple classes are passed as a single string, they
|
|
22
|
+
// are split.
|
|
23
|
+
.join(" ")
|
|
24
|
+
.split(" "),
|
|
25
|
+
),
|
|
26
|
+
].join(" ");
|
|
17
27
|
}
|
|
18
28
|
|
|
19
29
|
export const isSafari = () =>
|
|
@@ -41,7 +41,10 @@ export declare function setupTestEnv(): () => BlockNoteEditor<import("../../inde
|
|
|
41
41
|
propSchema: {
|
|
42
42
|
level: {
|
|
43
43
|
default: number;
|
|
44
|
-
values: readonly [1, 2, 3];
|
|
44
|
+
values: readonly [1, 2, 3, 4, 5, 6];
|
|
45
|
+
};
|
|
46
|
+
isToggleable: {
|
|
47
|
+
default: false;
|
|
45
48
|
};
|
|
46
49
|
backgroundColor: {
|
|
47
50
|
default: "default";
|
|
@@ -61,7 +64,10 @@ export declare function setupTestEnv(): () => BlockNoteEditor<import("../../inde
|
|
|
61
64
|
propSchema: {
|
|
62
65
|
level: {
|
|
63
66
|
default: number;
|
|
64
|
-
values: readonly [1, 2, 3];
|
|
67
|
+
values: readonly [1, 2, 3, 4, 5, 6];
|
|
68
|
+
};
|
|
69
|
+
isToggleable: {
|
|
70
|
+
default: false;
|
|
65
71
|
};
|
|
66
72
|
backgroundColor: {
|
|
67
73
|
default: "default";
|
|
@@ -130,6 +136,40 @@ export declare function setupTestEnv(): () => BlockNoteEditor<import("../../inde
|
|
|
130
136
|
};
|
|
131
137
|
}, any, import("../../index.js").InlineContentSchema, import("../../index.js").StyleSchema>;
|
|
132
138
|
};
|
|
139
|
+
toggleListItem: {
|
|
140
|
+
config: {
|
|
141
|
+
type: "toggleListItem";
|
|
142
|
+
content: "inline";
|
|
143
|
+
propSchema: {
|
|
144
|
+
backgroundColor: {
|
|
145
|
+
default: "default";
|
|
146
|
+
};
|
|
147
|
+
textColor: {
|
|
148
|
+
default: "default";
|
|
149
|
+
};
|
|
150
|
+
textAlignment: {
|
|
151
|
+
default: "left";
|
|
152
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
implementation: import("../../index.js").TiptapBlockImplementation<{
|
|
157
|
+
type: "toggleListItem";
|
|
158
|
+
content: "inline";
|
|
159
|
+
propSchema: {
|
|
160
|
+
backgroundColor: {
|
|
161
|
+
default: "default";
|
|
162
|
+
};
|
|
163
|
+
textColor: {
|
|
164
|
+
default: "default";
|
|
165
|
+
};
|
|
166
|
+
textAlignment: {
|
|
167
|
+
default: "left";
|
|
168
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
}, any, import("../../index.js").InlineContentSchema, import("../../index.js").StyleSchema>;
|
|
172
|
+
};
|
|
133
173
|
bulletListItem: {
|
|
134
174
|
config: {
|
|
135
175
|
type: "bulletListItem";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export declare const headingPropSchema: {
|
|
2
2
|
level: {
|
|
3
3
|
default: number;
|
|
4
|
-
values: readonly [1, 2, 3];
|
|
4
|
+
values: readonly [1, 2, 3, 4, 5, 6];
|
|
5
|
+
};
|
|
6
|
+
isToggleable: {
|
|
7
|
+
default: false;
|
|
5
8
|
};
|
|
6
9
|
backgroundColor: {
|
|
7
10
|
default: "default";
|
|
@@ -21,7 +24,10 @@ export declare const Heading: {
|
|
|
21
24
|
propSchema: {
|
|
22
25
|
level: {
|
|
23
26
|
default: number;
|
|
24
|
-
values: readonly [1, 2, 3];
|
|
27
|
+
values: readonly [1, 2, 3, 4, 5, 6];
|
|
28
|
+
};
|
|
29
|
+
isToggleable: {
|
|
30
|
+
default: false;
|
|
25
31
|
};
|
|
26
32
|
backgroundColor: {
|
|
27
33
|
default: "default";
|
|
@@ -41,7 +47,10 @@ export declare const Heading: {
|
|
|
41
47
|
propSchema: {
|
|
42
48
|
level: {
|
|
43
49
|
default: number;
|
|
44
|
-
values: readonly [1, 2, 3];
|
|
50
|
+
values: readonly [1, 2, 3, 4, 5, 6];
|
|
51
|
+
};
|
|
52
|
+
isToggleable: {
|
|
53
|
+
default: false;
|
|
45
54
|
};
|
|
46
55
|
backgroundColor: {
|
|
47
56
|
default: "default";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare const toggleListItemPropSchema: {
|
|
2
|
+
backgroundColor: {
|
|
3
|
+
default: "default";
|
|
4
|
+
};
|
|
5
|
+
textColor: {
|
|
6
|
+
default: "default";
|
|
7
|
+
};
|
|
8
|
+
textAlignment: {
|
|
9
|
+
default: "left";
|
|
10
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const ToggleListItem: {
|
|
14
|
+
config: {
|
|
15
|
+
type: "toggleListItem";
|
|
16
|
+
content: "inline";
|
|
17
|
+
propSchema: {
|
|
18
|
+
backgroundColor: {
|
|
19
|
+
default: "default";
|
|
20
|
+
};
|
|
21
|
+
textColor: {
|
|
22
|
+
default: "default";
|
|
23
|
+
};
|
|
24
|
+
textAlignment: {
|
|
25
|
+
default: "left";
|
|
26
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
implementation: import("../../../index.js").TiptapBlockImplementation<{
|
|
31
|
+
type: "toggleListItem";
|
|
32
|
+
content: "inline";
|
|
33
|
+
propSchema: {
|
|
34
|
+
backgroundColor: {
|
|
35
|
+
default: "default";
|
|
36
|
+
};
|
|
37
|
+
textColor: {
|
|
38
|
+
default: "default";
|
|
39
|
+
};
|
|
40
|
+
textAlignment: {
|
|
41
|
+
default: "left";
|
|
42
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
}, any, import("../../../index.js").InlineContentSchema, import("../../../index.js").StyleSchema>;
|
|
46
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ViewMutationRecord } from "@tiptap/pm/view";
|
|
2
|
+
import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
3
|
+
import { Block } from "../defaultBlocks.js";
|
|
4
|
+
type ToggledState = {
|
|
5
|
+
set: (block: Block<any, any, any>, isToggled: boolean) => void;
|
|
6
|
+
get: (block: Block<any, any, any>) => boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const defaultToggledState: ToggledState;
|
|
9
|
+
export declare const createToggleWrapper: (block: Block<any, any, any>, editor: BlockNoteEditor<any, any, any>, renderedElement: HTMLElement, toggledState?: ToggledState) => {
|
|
10
|
+
dom: HTMLElement;
|
|
11
|
+
contentDOM?: HTMLElement;
|
|
12
|
+
ignoreMutation?: (mutation: ViewMutationRecord) => boolean;
|
|
13
|
+
destroy?: () => void;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -5,10 +5,10 @@ import { Block, DefaultBlockSchema, DefaultInlineContentSchema } from "./default
|
|
|
5
5
|
import { defaultProps } from "./defaultProps.js";
|
|
6
6
|
import { Selection } from "prosemirror-state";
|
|
7
7
|
export declare function checkDefaultBlockTypeInSchema<BlockType extends keyof DefaultBlockSchema, I extends InlineContentSchema, S extends StyleSchema>(blockType: BlockType, editor: BlockNoteEditor<any, I, S>): editor is BlockNoteEditor<{
|
|
8
|
-
|
|
8
|
+
[K in BlockType]: DefaultBlockSchema[BlockType];
|
|
9
9
|
}, I, S>;
|
|
10
10
|
export declare function checkDefaultInlineContentTypeInSchema<InlineContentType extends keyof DefaultInlineContentSchema, B extends BlockSchema, S extends StyleSchema>(inlineContentType: InlineContentType, editor: BlockNoteEditor<B, any, S>): editor is BlockNoteEditor<B, {
|
|
11
|
-
|
|
11
|
+
[K in InlineContentType]: DefaultInlineContentSchema[InlineContentType];
|
|
12
12
|
}, S>;
|
|
13
13
|
export declare function checkBlockIsDefaultType<BlockType extends keyof DefaultBlockSchema, I extends InlineContentSchema, S extends StyleSchema>(blockType: BlockType, block: Block<any, I, S>, editor: BlockNoteEditor<any, I, S>): block is BlockFromConfig<DefaultBlockSchema[BlockType], I, S>;
|
|
14
14
|
export declare function checkBlockIsFileBlock<B extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(block: Block<any, I, S>, editor: BlockNoteEditor<B, I, S>): block is BlockFromConfig<FileBlockConfig, I, S>;
|
|
@@ -41,7 +41,10 @@ export declare const defaultBlockSpecs: {
|
|
|
41
41
|
propSchema: {
|
|
42
42
|
level: {
|
|
43
43
|
default: number;
|
|
44
|
-
values: readonly [1, 2, 3];
|
|
44
|
+
values: readonly [1, 2, 3, 4, 5, 6];
|
|
45
|
+
};
|
|
46
|
+
isToggleable: {
|
|
47
|
+
default: false;
|
|
45
48
|
};
|
|
46
49
|
backgroundColor: {
|
|
47
50
|
default: "default";
|
|
@@ -61,7 +64,10 @@ export declare const defaultBlockSpecs: {
|
|
|
61
64
|
propSchema: {
|
|
62
65
|
level: {
|
|
63
66
|
default: number;
|
|
64
|
-
values: readonly [1, 2, 3];
|
|
67
|
+
values: readonly [1, 2, 3, 4, 5, 6];
|
|
68
|
+
};
|
|
69
|
+
isToggleable: {
|
|
70
|
+
default: false;
|
|
65
71
|
};
|
|
66
72
|
backgroundColor: {
|
|
67
73
|
default: "default";
|
|
@@ -130,6 +136,40 @@ export declare const defaultBlockSpecs: {
|
|
|
130
136
|
};
|
|
131
137
|
}, any, InlineContentSchema, StyleSchema>;
|
|
132
138
|
};
|
|
139
|
+
toggleListItem: {
|
|
140
|
+
config: {
|
|
141
|
+
type: "toggleListItem";
|
|
142
|
+
content: "inline";
|
|
143
|
+
propSchema: {
|
|
144
|
+
backgroundColor: {
|
|
145
|
+
default: "default";
|
|
146
|
+
};
|
|
147
|
+
textColor: {
|
|
148
|
+
default: "default";
|
|
149
|
+
};
|
|
150
|
+
textAlignment: {
|
|
151
|
+
default: "left";
|
|
152
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
implementation: import("../index.js").TiptapBlockImplementation<{
|
|
157
|
+
type: "toggleListItem";
|
|
158
|
+
content: "inline";
|
|
159
|
+
propSchema: {
|
|
160
|
+
backgroundColor: {
|
|
161
|
+
default: "default";
|
|
162
|
+
};
|
|
163
|
+
textColor: {
|
|
164
|
+
default: "default";
|
|
165
|
+
};
|
|
166
|
+
textAlignment: {
|
|
167
|
+
default: "left";
|
|
168
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
172
|
+
};
|
|
133
173
|
bulletListItem: {
|
|
134
174
|
config: {
|
|
135
175
|
type: "bulletListItem";
|
|
@@ -525,7 +565,10 @@ export declare const defaultBlockSchema: import("../index.js").BlockSchemaFromSp
|
|
|
525
565
|
propSchema: {
|
|
526
566
|
level: {
|
|
527
567
|
default: number;
|
|
528
|
-
values: readonly [1, 2, 3];
|
|
568
|
+
values: readonly [1, 2, 3, 4, 5, 6];
|
|
569
|
+
};
|
|
570
|
+
isToggleable: {
|
|
571
|
+
default: false;
|
|
529
572
|
};
|
|
530
573
|
backgroundColor: {
|
|
531
574
|
default: "default";
|
|
@@ -545,7 +588,10 @@ export declare const defaultBlockSchema: import("../index.js").BlockSchemaFromSp
|
|
|
545
588
|
propSchema: {
|
|
546
589
|
level: {
|
|
547
590
|
default: number;
|
|
548
|
-
values: readonly [1, 2, 3];
|
|
591
|
+
values: readonly [1, 2, 3, 4, 5, 6];
|
|
592
|
+
};
|
|
593
|
+
isToggleable: {
|
|
594
|
+
default: false;
|
|
549
595
|
};
|
|
550
596
|
backgroundColor: {
|
|
551
597
|
default: "default";
|
|
@@ -614,6 +660,40 @@ export declare const defaultBlockSchema: import("../index.js").BlockSchemaFromSp
|
|
|
614
660
|
};
|
|
615
661
|
}, any, InlineContentSchema, StyleSchema>;
|
|
616
662
|
};
|
|
663
|
+
toggleListItem: {
|
|
664
|
+
config: {
|
|
665
|
+
type: "toggleListItem";
|
|
666
|
+
content: "inline";
|
|
667
|
+
propSchema: {
|
|
668
|
+
backgroundColor: {
|
|
669
|
+
default: "default";
|
|
670
|
+
};
|
|
671
|
+
textColor: {
|
|
672
|
+
default: "default";
|
|
673
|
+
};
|
|
674
|
+
textAlignment: {
|
|
675
|
+
default: "left";
|
|
676
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
677
|
+
};
|
|
678
|
+
};
|
|
679
|
+
};
|
|
680
|
+
implementation: import("../index.js").TiptapBlockImplementation<{
|
|
681
|
+
type: "toggleListItem";
|
|
682
|
+
content: "inline";
|
|
683
|
+
propSchema: {
|
|
684
|
+
backgroundColor: {
|
|
685
|
+
default: "default";
|
|
686
|
+
};
|
|
687
|
+
textColor: {
|
|
688
|
+
default: "default";
|
|
689
|
+
};
|
|
690
|
+
textAlignment: {
|
|
691
|
+
default: "left";
|
|
692
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
693
|
+
};
|
|
694
|
+
};
|
|
695
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
696
|
+
};
|
|
617
697
|
bulletListItem: {
|
|
618
698
|
config: {
|
|
619
699
|
type: "bulletListItem";
|