@blocknote/core 0.22.0 → 0.23.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.js +2315 -1711
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +7 -7
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +2 -2
- package/src/api/clipboard/__snapshots__/internal/basicBlocks.html +1 -0
- package/src/api/clipboard/__snapshots__/internal/basicBlocksWithProps.html +1 -0
- package/src/api/clipboard/clipboardInternal.test.ts +126 -0
- package/src/api/exporters/html/__snapshots__/pageBreak/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/pageBreak/basic/internal.html +1 -0
- package/src/api/exporters/markdown/__snapshots__/pageBreak/basic/markdown.md +0 -0
- package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +16 -0
- package/src/api/parsers/html/__snapshots__/parse-codeblocks.json +62 -0
- package/src/api/parsers/html/parseHTML.test.ts +9 -0
- package/src/api/testUtil/cases/defaultSchema.ts +15 -1
- package/src/blocks/CodeBlockContent/CodeBlockContent.ts +32 -11
- package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +0 -9
- package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +1 -1
- package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +1 -1
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +1 -1
- package/src/blocks/PageBreakBlockContent/PageBreakBlockContent.ts +49 -0
- package/src/blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.ts +45 -0
- package/src/blocks/PageBreakBlockContent/schema.ts +40 -0
- package/src/editor/Block.css +15 -1
- package/src/editor/BlockNoteEditor.ts +17 -0
- package/src/editor/BlockNoteExtensions.ts +111 -16
- package/src/editor/editor.css +22 -7
- package/src/extensions/SideMenu/SideMenuPlugin.ts +115 -23
- package/src/extensions/SideMenu/dragging.ts +0 -1
- package/src/extensions/SuggestionMenu/DefaultSuggestionItem.ts +1 -1
- package/src/i18n/locales/ar.ts +6 -0
- package/src/i18n/locales/de.ts +6 -0
- package/src/i18n/locales/en.ts +6 -0
- package/src/i18n/locales/es.ts +6 -0
- package/src/i18n/locales/fr.ts +47 -17
- package/src/i18n/locales/hr.ts +72 -54
- package/src/i18n/locales/index.ts +1 -0
- package/src/i18n/locales/is.ts +6 -0
- package/src/i18n/locales/it.ts +315 -0
- package/src/i18n/locales/ja.ts +6 -0
- package/src/i18n/locales/ko.ts +6 -0
- package/src/i18n/locales/nl.ts +6 -0
- package/src/i18n/locales/pl.ts +6 -0
- package/src/i18n/locales/pt.ts +6 -0
- package/src/i18n/locales/ru.ts +6 -0
- package/src/i18n/locales/vi.ts +6 -0
- package/src/i18n/locales/zh.ts +6 -0
- package/src/index.ts +3 -0
- package/types/src/api/testUtil/cases/defaultSchema.d.ts +2 -1
- package/types/src/blocks/CodeBlockContent/CodeBlockContent.d.ts +2 -0
- package/types/src/blocks/PageBreakBlockContent/PageBreakBlockContent.d.ts +31 -0
- package/types/src/blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.d.ts +8 -0
- package/types/src/blocks/PageBreakBlockContent/schema.d.ts +86 -0
- package/types/src/editor/BlockNoteEditor.d.ts +15 -0
- package/types/src/editor/BlockNoteExtensions.d.ts +2 -0
- package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +25 -5
- package/types/src/extensions/SuggestionMenu/DefaultSuggestionItem.d.ts +1 -1
- package/types/src/i18n/locales/de.d.ts +6 -0
- package/types/src/i18n/locales/en.d.ts +6 -0
- package/types/src/i18n/locales/es.d.ts +6 -0
- package/types/src/i18n/locales/hr.d.ts +6 -0
- package/types/src/i18n/locales/index.d.ts +1 -0
- package/types/src/i18n/locales/it.d.ts +245 -0
- package/types/src/index.d.ts +3 -0
package/src/i18n/locales/ko.ts
CHANGED
|
@@ -58,6 +58,12 @@ export const ko: Dictionary = {
|
|
|
58
58
|
aliases: ["code", "pre"],
|
|
59
59
|
group: "기본 블록",
|
|
60
60
|
},
|
|
61
|
+
page_break: {
|
|
62
|
+
title: "페이지 나누기",
|
|
63
|
+
subtext: "페이지 구분자",
|
|
64
|
+
aliases: ["page", "break", "separator", "페이지", "구분자"],
|
|
65
|
+
group: "기본 블록",
|
|
66
|
+
},
|
|
61
67
|
table: {
|
|
62
68
|
title: "표",
|
|
63
69
|
subtext: "간단한 표를 추가합니다.",
|
package/src/i18n/locales/nl.ts
CHANGED
|
@@ -50,6 +50,12 @@ export const nl: Dictionary = {
|
|
|
50
50
|
aliases: ["code", "pre"],
|
|
51
51
|
group: "Basisblokken",
|
|
52
52
|
},
|
|
53
|
+
page_break: {
|
|
54
|
+
title: "Pagina-einde",
|
|
55
|
+
subtext: "Paginascheiding",
|
|
56
|
+
aliases: ["page", "break", "separator", "pagina", "scheiding"],
|
|
57
|
+
group: "Basisblokken",
|
|
58
|
+
},
|
|
53
59
|
table: {
|
|
54
60
|
title: "Tabel",
|
|
55
61
|
subtext: "Gebruikt voor tabellen",
|
package/src/i18n/locales/pl.ts
CHANGED
|
@@ -50,6 +50,12 @@ export const pl: Dictionary = {
|
|
|
50
50
|
aliases: ["kod", "pre"],
|
|
51
51
|
group: "Podstawowe bloki",
|
|
52
52
|
},
|
|
53
|
+
page_break: {
|
|
54
|
+
title: "Podział strony",
|
|
55
|
+
subtext: "Separator strony",
|
|
56
|
+
aliases: ["page", "break", "separator", "podział", "separator"],
|
|
57
|
+
group: "Podstawowe bloki",
|
|
58
|
+
},
|
|
53
59
|
table: {
|
|
54
60
|
title: "Tabela",
|
|
55
61
|
subtext: "Używana do tworzenia tabel",
|
package/src/i18n/locales/pt.ts
CHANGED
|
@@ -57,6 +57,12 @@ export const pt: Dictionary = {
|
|
|
57
57
|
aliases: ["codigo", "pre"],
|
|
58
58
|
group: "Blocos básicos",
|
|
59
59
|
},
|
|
60
|
+
page_break: {
|
|
61
|
+
title: "Quebra de página",
|
|
62
|
+
subtext: "Separador de página",
|
|
63
|
+
aliases: ["page", "break", "separator", "quebra", "separador"],
|
|
64
|
+
group: "Blocos básicos",
|
|
65
|
+
},
|
|
60
66
|
table: {
|
|
61
67
|
title: "Tabela",
|
|
62
68
|
subtext: "Usado para tabelas",
|
package/src/i18n/locales/ru.ts
CHANGED
|
@@ -75,6 +75,12 @@ export const ru: Dictionary = {
|
|
|
75
75
|
aliases: ["code", "pre", "блок кода"],
|
|
76
76
|
group: "Базовые блоки",
|
|
77
77
|
},
|
|
78
|
+
page_break: {
|
|
79
|
+
title: "Разрыв страницы",
|
|
80
|
+
subtext: "Разделитель страницы",
|
|
81
|
+
aliases: ["page", "break", "separator", "разрыв", "разделитель"],
|
|
82
|
+
group: "Основные блоки",
|
|
83
|
+
},
|
|
78
84
|
table: {
|
|
79
85
|
title: "Таблица",
|
|
80
86
|
subtext: "Используется для таблиц",
|
package/src/i18n/locales/vi.ts
CHANGED
|
@@ -57,6 +57,12 @@ export const vi: Dictionary = {
|
|
|
57
57
|
aliases: ["code", "pre"],
|
|
58
58
|
group: "Khối cơ bản",
|
|
59
59
|
},
|
|
60
|
+
page_break: {
|
|
61
|
+
title: "Ngắt trang",
|
|
62
|
+
subtext: "Phân cách trang",
|
|
63
|
+
aliases: ["page", "break", "separator", "ngắt", "phân cách"],
|
|
64
|
+
group: "Khối cơ bản",
|
|
65
|
+
},
|
|
60
66
|
table: {
|
|
61
67
|
title: "Bảng",
|
|
62
68
|
subtext: "Sử dụng để tạo bảng",
|
package/src/i18n/locales/zh.ts
CHANGED
|
@@ -75,6 +75,12 @@ export const zh: Dictionary = {
|
|
|
75
75
|
aliases: ["code", "pre", "代码", "预格式"],
|
|
76
76
|
group: "基础",
|
|
77
77
|
},
|
|
78
|
+
page_break: {
|
|
79
|
+
title: "分页符",
|
|
80
|
+
subtext: "页面分隔符",
|
|
81
|
+
aliases: ["page", "break", "separator", "分页", "分隔符"],
|
|
82
|
+
group: "基础",
|
|
83
|
+
},
|
|
78
84
|
table: {
|
|
79
85
|
title: "表格",
|
|
80
86
|
subtext: "使用表格",
|
package/src/index.ts
CHANGED
|
@@ -6,6 +6,9 @@ export * from "./api/nodeUtil.js";
|
|
|
6
6
|
export * from "./api/testUtil/index.js";
|
|
7
7
|
export * from "./blocks/AudioBlockContent/AudioBlockContent.js";
|
|
8
8
|
export * from "./blocks/CodeBlockContent/CodeBlockContent.js";
|
|
9
|
+
export * from "./blocks/PageBreakBlockContent/PageBreakBlockContent.js";
|
|
10
|
+
export * from "./blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.js";
|
|
11
|
+
export * from "./blocks/PageBreakBlockContent/schema.js";
|
|
9
12
|
export * from "./blocks/FileBlockContent/FileBlockContent.js";
|
|
10
13
|
export * from "./blocks/FileBlockContent/helpers/parse/parseEmbedElement.js";
|
|
11
14
|
export * from "./blocks/FileBlockContent/helpers/parse/parseFigureElement.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { EditorTestCases } from "../index.js";
|
|
2
2
|
import { DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema } from "../../../blocks/defaultBlocks.js";
|
|
3
|
-
|
|
3
|
+
import { pageBreakSchema } from "../../../blocks/PageBreakBlockContent/schema.js";
|
|
4
|
+
export declare const defaultSchemaTestCases: EditorTestCases<DefaultBlockSchema & typeof pageBreakSchema.blockSchema, DefaultInlineContentSchema, DefaultStyleSchema>;
|
|
@@ -4,6 +4,8 @@ interface CodeBlockOptions {
|
|
|
4
4
|
indentLineWithTab: boolean;
|
|
5
5
|
supportedLanguages: SupportedLanguageConfig[];
|
|
6
6
|
}
|
|
7
|
+
export declare const shikiParserSymbol: unique symbol;
|
|
8
|
+
export declare const shikiHighlighterPromiseSymbol: unique symbol;
|
|
7
9
|
export declare const defaultCodeBlockPropSchema: {
|
|
8
10
|
language: {
|
|
9
11
|
default: string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Props } from "../../schema/index.js";
|
|
2
|
+
export declare const pageBreakConfig: {
|
|
3
|
+
type: "pageBreak";
|
|
4
|
+
propSchema: {};
|
|
5
|
+
content: "none";
|
|
6
|
+
isFileBlock: false;
|
|
7
|
+
isSelectable: false;
|
|
8
|
+
};
|
|
9
|
+
export declare const pageBreakRender: () => {
|
|
10
|
+
dom: HTMLDivElement;
|
|
11
|
+
};
|
|
12
|
+
export declare const pageBreakParse: (element: HTMLElement) => Partial<Props<typeof pageBreakConfig.propSchema>> | undefined;
|
|
13
|
+
export declare const pageBreakToExternalHTML: () => {
|
|
14
|
+
dom: HTMLDivElement;
|
|
15
|
+
};
|
|
16
|
+
export declare const PageBreak: {
|
|
17
|
+
config: {
|
|
18
|
+
type: "pageBreak";
|
|
19
|
+
propSchema: {};
|
|
20
|
+
content: "none";
|
|
21
|
+
isFileBlock: false;
|
|
22
|
+
isSelectable: false;
|
|
23
|
+
};
|
|
24
|
+
implementation: import("../../schema/index.js").TiptapBlockImplementation<{
|
|
25
|
+
type: "pageBreak";
|
|
26
|
+
propSchema: {};
|
|
27
|
+
content: "none";
|
|
28
|
+
isFileBlock: false;
|
|
29
|
+
isSelectable: false;
|
|
30
|
+
}, any, import("../../schema/index.js").InlineContentSchema, import("../../schema/index.js").StyleSchema>;
|
|
31
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
2
|
+
import { DefaultSuggestionItem } from "../../extensions/SuggestionMenu/DefaultSuggestionItem.js";
|
|
3
|
+
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema/index.js";
|
|
4
|
+
import { pageBreakSchema } from "./schema.js";
|
|
5
|
+
export declare function checkPageBreakBlocksInSchema<I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<any, I, S>): editor is BlockNoteEditor<typeof pageBreakSchema.blockSchema, I, S>;
|
|
6
|
+
export declare function getPageBreakSlashMenuItems<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>): (Omit<DefaultSuggestionItem, "key"> & {
|
|
7
|
+
key: "page_break";
|
|
8
|
+
})[];
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { BlockNoteSchema } from "../../editor/BlockNoteSchema.js";
|
|
2
|
+
import { InlineContentSchema, StyleSchema } from "../../schema/index.js";
|
|
3
|
+
import { PageBreak } from "./PageBreakBlockContent.js";
|
|
4
|
+
export declare const pageBreakSchema: BlockNoteSchema<import("../../schema/index.js").BlockSchemaFromSpecs<{
|
|
5
|
+
pageBreak: {
|
|
6
|
+
config: {
|
|
7
|
+
type: "pageBreak";
|
|
8
|
+
propSchema: {};
|
|
9
|
+
content: "none";
|
|
10
|
+
isFileBlock: false;
|
|
11
|
+
isSelectable: false;
|
|
12
|
+
};
|
|
13
|
+
implementation: import("../../schema/index.js").TiptapBlockImplementation<{
|
|
14
|
+
type: "pageBreak";
|
|
15
|
+
propSchema: {};
|
|
16
|
+
content: "none";
|
|
17
|
+
isFileBlock: false;
|
|
18
|
+
isSelectable: false;
|
|
19
|
+
}, any, InlineContentSchema, StyleSchema>;
|
|
20
|
+
};
|
|
21
|
+
}>, import("../../schema/index.js").InlineContentSchemaFromSpecs<{
|
|
22
|
+
text: {
|
|
23
|
+
config: "text";
|
|
24
|
+
implementation: any;
|
|
25
|
+
};
|
|
26
|
+
link: {
|
|
27
|
+
config: "link";
|
|
28
|
+
implementation: any;
|
|
29
|
+
};
|
|
30
|
+
}>, import("../../schema/index.js").StyleSchemaFromSpecs<{
|
|
31
|
+
bold: {
|
|
32
|
+
config: {
|
|
33
|
+
type: string;
|
|
34
|
+
propSchema: "boolean";
|
|
35
|
+
};
|
|
36
|
+
implementation: import("../../schema/index.js").StyleImplementation;
|
|
37
|
+
};
|
|
38
|
+
italic: {
|
|
39
|
+
config: {
|
|
40
|
+
type: string;
|
|
41
|
+
propSchema: "boolean";
|
|
42
|
+
};
|
|
43
|
+
implementation: import("../../schema/index.js").StyleImplementation;
|
|
44
|
+
};
|
|
45
|
+
underline: {
|
|
46
|
+
config: {
|
|
47
|
+
type: string;
|
|
48
|
+
propSchema: "boolean";
|
|
49
|
+
};
|
|
50
|
+
implementation: import("../../schema/index.js").StyleImplementation;
|
|
51
|
+
};
|
|
52
|
+
strike: {
|
|
53
|
+
config: {
|
|
54
|
+
type: string;
|
|
55
|
+
propSchema: "boolean";
|
|
56
|
+
};
|
|
57
|
+
implementation: import("../../schema/index.js").StyleImplementation;
|
|
58
|
+
};
|
|
59
|
+
code: {
|
|
60
|
+
config: {
|
|
61
|
+
type: string;
|
|
62
|
+
propSchema: "boolean";
|
|
63
|
+
};
|
|
64
|
+
implementation: import("../../schema/index.js").StyleImplementation;
|
|
65
|
+
};
|
|
66
|
+
textColor: {
|
|
67
|
+
config: {
|
|
68
|
+
type: string;
|
|
69
|
+
propSchema: "string";
|
|
70
|
+
};
|
|
71
|
+
implementation: import("../../schema/index.js").StyleImplementation;
|
|
72
|
+
};
|
|
73
|
+
backgroundColor: {
|
|
74
|
+
config: {
|
|
75
|
+
type: string;
|
|
76
|
+
propSchema: "string";
|
|
77
|
+
};
|
|
78
|
+
implementation: import("../../schema/index.js").StyleImplementation;
|
|
79
|
+
};
|
|
80
|
+
}>>;
|
|
81
|
+
/**
|
|
82
|
+
* Adds page break support to the given schema.
|
|
83
|
+
*/
|
|
84
|
+
export declare const withPageBreak: <B extends Record<string, import("../../schema/index.js").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(schema: BlockNoteSchema<B, I, S>) => BlockNoteSchema<B & {
|
|
85
|
+
pageBreak: typeof PageBreak.config;
|
|
86
|
+
}, I, S>;
|
|
@@ -96,6 +96,13 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
|
|
|
96
96
|
* Optional function to customize how cursors of users are rendered
|
|
97
97
|
*/
|
|
98
98
|
renderCursor?: (user: any) => HTMLElement;
|
|
99
|
+
/**
|
|
100
|
+
* Optional flag to set when the user label should be shown with the default
|
|
101
|
+
* collaboration cursor. Setting to "always" will always show the label,
|
|
102
|
+
* while "activity" will only show the label when the user moves the cursor
|
|
103
|
+
* or types. Defaults to "activity".
|
|
104
|
+
*/
|
|
105
|
+
showCursorLabels?: "always" | "activity";
|
|
99
106
|
};
|
|
100
107
|
/**
|
|
101
108
|
* additional tiptap options, undocumented
|
|
@@ -138,6 +145,14 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
|
|
|
138
145
|
@default "prefer-navigate-ui"
|
|
139
146
|
*/
|
|
140
147
|
tabBehavior: "prefer-navigate-ui" | "prefer-indent";
|
|
148
|
+
/**
|
|
149
|
+
* The detection mode for showing the side menu - "viewport" always shows the
|
|
150
|
+
* side menu for the block next to the mouse cursor, while "editor" only shows
|
|
151
|
+
* it when hovering the editor or the side menu itself.
|
|
152
|
+
*
|
|
153
|
+
* @default "viewport"
|
|
154
|
+
*/
|
|
155
|
+
sideMenuDetection: "viewport" | "editor";
|
|
141
156
|
};
|
|
142
157
|
export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockSchema, ISchema extends InlineContentSchema = DefaultInlineContentSchema, SSchema extends StyleSchema = DefaultStyleSchema> {
|
|
143
158
|
protected readonly options: Partial<BlockNoteEditorOptions<any, any, any>>;
|
|
@@ -18,6 +18,7 @@ type ExtensionOptions<BSchema extends BlockSchema, I extends InlineContentSchema
|
|
|
18
18
|
};
|
|
19
19
|
provider: any;
|
|
20
20
|
renderCursor?: (user: any) => HTMLElement;
|
|
21
|
+
showCursorLabels?: "always" | "activity";
|
|
21
22
|
};
|
|
22
23
|
disableExtensions: string[] | undefined;
|
|
23
24
|
setIdAttribute?: boolean;
|
|
@@ -26,6 +27,7 @@ type ExtensionOptions<BSchema extends BlockSchema, I extends InlineContentSchema
|
|
|
26
27
|
dropCursor: (opts: any) => Plugin;
|
|
27
28
|
placeholders: Record<string | "default", string>;
|
|
28
29
|
tabBehavior?: "prefer-navigate-ui" | "prefer-indent";
|
|
30
|
+
sideMenuDetection: "viewport" | "editor";
|
|
29
31
|
};
|
|
30
32
|
/**
|
|
31
33
|
* Get all the Tiptap extensions BlockNote is configured with by default
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { PluginView } from "@tiptap/pm/state";
|
|
2
|
-
import {
|
|
3
|
-
import { EditorView } from "prosemirror-view";
|
|
1
|
+
import { EditorState, Plugin, PluginKey, PluginView } from "@tiptap/pm/state";
|
|
2
|
+
import { EditorView } from "@tiptap/pm/view";
|
|
4
3
|
import { Block } from "../../blocks/defaultBlocks.js";
|
|
5
4
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
6
5
|
import { UiElementPosition } from "../../extensions-shared/UiElementPosition.js";
|
|
@@ -14,13 +13,15 @@ export type SideMenuState<BSchema extends BlockSchema, I extends InlineContentSc
|
|
|
14
13
|
*/
|
|
15
14
|
export declare class SideMenuView<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> implements PluginView {
|
|
16
15
|
private readonly editor;
|
|
16
|
+
private readonly sideMenuDetection;
|
|
17
17
|
private readonly pmView;
|
|
18
18
|
state?: SideMenuState<BSchema, I, S>;
|
|
19
19
|
readonly emitUpdate: (state: SideMenuState<BSchema, I, S>) => void;
|
|
20
20
|
private mousePos;
|
|
21
21
|
private hoveredBlock;
|
|
22
22
|
menuFrozen: boolean;
|
|
23
|
-
|
|
23
|
+
isDragOrigin: boolean;
|
|
24
|
+
constructor(editor: BlockNoteEditor<BSchema, I, S>, sideMenuDetection: "viewport" | "editor", pmView: EditorView, emitUpdate: (state: SideMenuState<BSchema, I, S>) => void);
|
|
24
25
|
updateState: (state: SideMenuState<BSchema, I, S>) => void;
|
|
25
26
|
updateStateFromMousePos: () => void;
|
|
26
27
|
/**
|
|
@@ -29,6 +30,25 @@ export declare class SideMenuView<BSchema extends BlockSchema, I extends InlineC
|
|
|
29
30
|
* when dragging / dropping to the side of the editor
|
|
30
31
|
*/
|
|
31
32
|
onDrop: (event: DragEvent) => void;
|
|
33
|
+
/**
|
|
34
|
+
* If a block is being dragged, ProseMirror usually gets the context of what's
|
|
35
|
+
* being dragged from `view.dragging`, which is automatically set when a
|
|
36
|
+
* `dragstart` event fires in the editor. However, if the user tries to drag
|
|
37
|
+
* and drop blocks between multiple editors, only the one in which the drag
|
|
38
|
+
* began has that context, so we need to set it on the others manually. This
|
|
39
|
+
* ensures that PM always drops the blocks in between other blocks, and not
|
|
40
|
+
* inside them.
|
|
41
|
+
*
|
|
42
|
+
* After the `dragstart` event fires on the drag handle, it sets
|
|
43
|
+
* `blocknote/html` data on the clipboard. This handler fires right after,
|
|
44
|
+
* parsing the `blocknote/html` data into nodes and setting them on
|
|
45
|
+
* `view.dragging`.
|
|
46
|
+
*
|
|
47
|
+
* Note: Setting `view.dragging` on `dragover` would be better as the user
|
|
48
|
+
* could then drag between editors in different windows, but you can only
|
|
49
|
+
* access `dataTransfer` contents on `dragstart` and `drop` events.
|
|
50
|
+
*/
|
|
51
|
+
onDragStart: (event: DragEvent) => void;
|
|
32
52
|
/**
|
|
33
53
|
* If the event is outside the editor contents,
|
|
34
54
|
* we dispatch a fake event, so that we can still drop the content
|
|
@@ -46,7 +66,7 @@ export declare class SideMenuProsemirrorPlugin<BSchema extends BlockSchema, I ex
|
|
|
46
66
|
private readonly editor;
|
|
47
67
|
view: SideMenuView<BSchema, I, S> | undefined;
|
|
48
68
|
readonly plugin: Plugin;
|
|
49
|
-
constructor(editor: BlockNoteEditor<BSchema, I, S
|
|
69
|
+
constructor(editor: BlockNoteEditor<BSchema, I, S>, sideMenuDetection: "viewport" | "editor");
|
|
50
70
|
onUpdate(callback: (state: SideMenuState<BSchema, I, S>) => void): () => void;
|
|
51
71
|
/**
|
|
52
72
|
* Handles drag & drop events for blocks.
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
export declare const it: {
|
|
2
|
+
slash_menu: {
|
|
3
|
+
heading: {
|
|
4
|
+
title: string;
|
|
5
|
+
subtext: string;
|
|
6
|
+
aliases: string[];
|
|
7
|
+
group: string;
|
|
8
|
+
};
|
|
9
|
+
heading_2: {
|
|
10
|
+
title: string;
|
|
11
|
+
subtext: string;
|
|
12
|
+
aliases: string[];
|
|
13
|
+
group: string;
|
|
14
|
+
};
|
|
15
|
+
heading_3: {
|
|
16
|
+
title: string;
|
|
17
|
+
subtext: string;
|
|
18
|
+
aliases: string[];
|
|
19
|
+
group: string;
|
|
20
|
+
};
|
|
21
|
+
numbered_list: {
|
|
22
|
+
title: string;
|
|
23
|
+
subtext: string;
|
|
24
|
+
aliases: string[];
|
|
25
|
+
group: string;
|
|
26
|
+
};
|
|
27
|
+
bullet_list: {
|
|
28
|
+
title: string;
|
|
29
|
+
subtext: string;
|
|
30
|
+
aliases: string[];
|
|
31
|
+
group: string;
|
|
32
|
+
};
|
|
33
|
+
check_list: {
|
|
34
|
+
title: string;
|
|
35
|
+
subtext: string;
|
|
36
|
+
aliases: string[];
|
|
37
|
+
group: string;
|
|
38
|
+
};
|
|
39
|
+
paragraph: {
|
|
40
|
+
title: string;
|
|
41
|
+
subtext: string;
|
|
42
|
+
aliases: string[];
|
|
43
|
+
group: string;
|
|
44
|
+
};
|
|
45
|
+
code_block: {
|
|
46
|
+
title: string;
|
|
47
|
+
subtext: string;
|
|
48
|
+
aliases: string[];
|
|
49
|
+
group: string;
|
|
50
|
+
};
|
|
51
|
+
table: {
|
|
52
|
+
title: string;
|
|
53
|
+
subtext: string;
|
|
54
|
+
aliases: string[];
|
|
55
|
+
group: string;
|
|
56
|
+
};
|
|
57
|
+
image: {
|
|
58
|
+
title: string;
|
|
59
|
+
subtext: string;
|
|
60
|
+
aliases: string[];
|
|
61
|
+
group: string;
|
|
62
|
+
};
|
|
63
|
+
video: {
|
|
64
|
+
title: string;
|
|
65
|
+
subtext: string;
|
|
66
|
+
aliases: string[];
|
|
67
|
+
group: string;
|
|
68
|
+
};
|
|
69
|
+
audio: {
|
|
70
|
+
title: string;
|
|
71
|
+
subtext: string;
|
|
72
|
+
aliases: string[];
|
|
73
|
+
group: string;
|
|
74
|
+
};
|
|
75
|
+
file: {
|
|
76
|
+
title: string;
|
|
77
|
+
subtext: string;
|
|
78
|
+
aliases: string[];
|
|
79
|
+
group: string;
|
|
80
|
+
};
|
|
81
|
+
emoji: {
|
|
82
|
+
title: string;
|
|
83
|
+
subtext: string;
|
|
84
|
+
aliases: string[];
|
|
85
|
+
group: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
placeholders: {
|
|
89
|
+
default: string;
|
|
90
|
+
heading: string;
|
|
91
|
+
bulletListItem: string;
|
|
92
|
+
numberedListItem: string;
|
|
93
|
+
checkListItem: string;
|
|
94
|
+
};
|
|
95
|
+
file_blocks: {
|
|
96
|
+
image: {
|
|
97
|
+
add_button_text: string;
|
|
98
|
+
};
|
|
99
|
+
video: {
|
|
100
|
+
add_button_text: string;
|
|
101
|
+
};
|
|
102
|
+
audio: {
|
|
103
|
+
add_button_text: string;
|
|
104
|
+
};
|
|
105
|
+
file: {
|
|
106
|
+
add_button_text: string;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
side_menu: {
|
|
110
|
+
add_block_label: string;
|
|
111
|
+
drag_handle_label: string;
|
|
112
|
+
};
|
|
113
|
+
drag_handle: {
|
|
114
|
+
delete_menuitem: string;
|
|
115
|
+
colors_menuitem: string;
|
|
116
|
+
};
|
|
117
|
+
table_handle: {
|
|
118
|
+
delete_column_menuitem: string;
|
|
119
|
+
delete_row_menuitem: string;
|
|
120
|
+
add_left_menuitem: string;
|
|
121
|
+
add_right_menuitem: string;
|
|
122
|
+
add_above_menuitem: string;
|
|
123
|
+
add_below_menuitem: string;
|
|
124
|
+
};
|
|
125
|
+
suggestion_menu: {
|
|
126
|
+
no_items_title: string;
|
|
127
|
+
loading: string;
|
|
128
|
+
};
|
|
129
|
+
color_picker: {
|
|
130
|
+
text_title: string;
|
|
131
|
+
background_title: string;
|
|
132
|
+
colors: {
|
|
133
|
+
default: string;
|
|
134
|
+
gray: string;
|
|
135
|
+
brown: string;
|
|
136
|
+
red: string;
|
|
137
|
+
orange: string;
|
|
138
|
+
yellow: string;
|
|
139
|
+
green: string;
|
|
140
|
+
blue: string;
|
|
141
|
+
purple: string;
|
|
142
|
+
pink: string;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
formatting_toolbar: {
|
|
146
|
+
bold: {
|
|
147
|
+
tooltip: string;
|
|
148
|
+
secondary_tooltip: string;
|
|
149
|
+
};
|
|
150
|
+
italic: {
|
|
151
|
+
tooltip: string;
|
|
152
|
+
secondary_tooltip: string;
|
|
153
|
+
};
|
|
154
|
+
underline: {
|
|
155
|
+
tooltip: string;
|
|
156
|
+
secondary_tooltip: string;
|
|
157
|
+
};
|
|
158
|
+
strike: {
|
|
159
|
+
tooltip: string;
|
|
160
|
+
secondary_tooltip: string;
|
|
161
|
+
};
|
|
162
|
+
code: {
|
|
163
|
+
tooltip: string;
|
|
164
|
+
secondary_tooltip: string;
|
|
165
|
+
};
|
|
166
|
+
colors: {
|
|
167
|
+
tooltip: string;
|
|
168
|
+
};
|
|
169
|
+
link: {
|
|
170
|
+
tooltip: string;
|
|
171
|
+
secondary_tooltip: string;
|
|
172
|
+
};
|
|
173
|
+
file_caption: {
|
|
174
|
+
tooltip: string;
|
|
175
|
+
input_placeholder: string;
|
|
176
|
+
};
|
|
177
|
+
file_replace: {
|
|
178
|
+
tooltip: Record<string, string>;
|
|
179
|
+
};
|
|
180
|
+
file_rename: {
|
|
181
|
+
tooltip: Record<string, string>;
|
|
182
|
+
input_placeholder: Record<string, string>;
|
|
183
|
+
};
|
|
184
|
+
file_download: {
|
|
185
|
+
tooltip: Record<string, string>;
|
|
186
|
+
};
|
|
187
|
+
file_delete: {
|
|
188
|
+
tooltip: Record<string, string>;
|
|
189
|
+
};
|
|
190
|
+
file_preview_toggle: {
|
|
191
|
+
tooltip: string;
|
|
192
|
+
};
|
|
193
|
+
nest: {
|
|
194
|
+
tooltip: string;
|
|
195
|
+
secondary_tooltip: string;
|
|
196
|
+
};
|
|
197
|
+
unnest: {
|
|
198
|
+
tooltip: string;
|
|
199
|
+
secondary_tooltip: string;
|
|
200
|
+
};
|
|
201
|
+
align_left: {
|
|
202
|
+
tooltip: string;
|
|
203
|
+
};
|
|
204
|
+
align_center: {
|
|
205
|
+
tooltip: string;
|
|
206
|
+
};
|
|
207
|
+
align_right: {
|
|
208
|
+
tooltip: string;
|
|
209
|
+
};
|
|
210
|
+
align_justify: {
|
|
211
|
+
tooltip: string;
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
file_panel: {
|
|
215
|
+
upload: {
|
|
216
|
+
title: string;
|
|
217
|
+
file_placeholder: Record<string, string>;
|
|
218
|
+
upload_error: string;
|
|
219
|
+
};
|
|
220
|
+
embed: {
|
|
221
|
+
title: string;
|
|
222
|
+
embed_button: Record<string, string>;
|
|
223
|
+
url_placeholder: string;
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
link_toolbar: {
|
|
227
|
+
delete: {
|
|
228
|
+
tooltip: string;
|
|
229
|
+
};
|
|
230
|
+
edit: {
|
|
231
|
+
text: string;
|
|
232
|
+
tooltip: string;
|
|
233
|
+
};
|
|
234
|
+
open: {
|
|
235
|
+
tooltip: string;
|
|
236
|
+
};
|
|
237
|
+
form: {
|
|
238
|
+
title_placeholder: string;
|
|
239
|
+
url_placeholder: string;
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
generic: {
|
|
243
|
+
ctrl_shortcut: string;
|
|
244
|
+
};
|
|
245
|
+
};
|