@blocknote/core 0.12.4 → 0.13.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 +1079 -685
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +6 -6
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +2 -2
- package/src/blocks/ImageBlockContent/ImageBlockContent.ts +1 -1
- package/src/editor/BlockNoteEditor.ts +24 -8
- package/src/editor/BlockNoteExtensions.ts +22 -11
- package/src/editor/BlockNoteTipTapEditor.ts +9 -6
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +24 -41
- package/src/extensions/ImagePanel/ImageToolbarPlugin.ts +27 -30
- package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +25 -3
- package/src/extensions/Placeholder/PlaceholderPlugin.ts +95 -0
- package/src/extensions/SideMenu/SideMenuPlugin.ts +3 -2
- package/src/extensions/SuggestionMenu/DefaultSuggestionItem.ts +3 -0
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +6 -2
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +18 -44
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +1 -1
- package/src/i18n/dictionary.ts +17 -0
- package/src/i18n/locales/en.ts +196 -0
- package/src/i18n/locales/index.ts +2 -0
- package/src/i18n/locales/nl.ts +197 -0
- package/src/index.ts +4 -1
- package/src/pm-nodes/BlockContainer.ts +17 -1
- package/src/util/browser.ts +2 -2
- package/src/util/typescript.ts +8 -0
- package/types/src/editor/BlockNoteEditor.d.ts +11 -1
- package/types/src/editor/BlockNoteExtensions.d.ts +3 -3
- package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +5 -4
- package/types/src/extensions/ImagePanel/ImageToolbarPlugin.d.ts +7 -5
- package/types/src/extensions/LinkToolbar/LinkToolbarPlugin.d.ts +3 -1
- package/types/src/extensions/Placeholder/PlaceholderPlugin.d.ts +3 -0
- package/types/src/extensions/SuggestionMenu/DefaultSuggestionItem.d.ts +2 -0
- package/types/src/extensions/SuggestionMenu/SuggestionPlugin.d.ts +2 -1
- package/types/src/i18n/dictionary.d.ts +2 -0
- package/types/src/i18n/locales/en.d.ts +184 -0
- package/types/src/i18n/locales/index.d.ts +2 -0
- package/types/src/i18n/locales/nl.d.ts +2 -0
- package/types/src/index.d.ts +4 -1
- package/types/src/pm-nodes/BlockContainer.d.ts +1 -1
- package/types/src/util/browser.d.ts +1 -1
- package/types/src/util/typescript.d.ts +1 -0
- package/src/extensions/Placeholder/PlaceholderExtension.ts +0 -124
- package/types/src/extensions/Placeholder/PlaceholderExtension.d.ts +0 -12
|
@@ -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
|
+
};
|
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
|
|
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<
|
|
65
|
+
editor: BlockNoteEditor<any, any, any>;
|
|
66
66
|
}>({
|
|
67
67
|
name: "blockContainer",
|
|
68
68
|
group: "blockContainer",
|
|
@@ -686,10 +686,26 @@ export const BlockContainer = Node.create<{
|
|
|
686
686
|
// Always returning true for tab key presses ensures they're not captured by the browser. Otherwise, they blur the
|
|
687
687
|
// editor since the browser will try to use tab for keyboard navigation.
|
|
688
688
|
Tab: () => {
|
|
689
|
+
if (
|
|
690
|
+
this.options.editor.formattingToolbar?.shown ||
|
|
691
|
+
this.options.editor.linkToolbar?.shown ||
|
|
692
|
+
this.options.editor.imagePanel?.shown
|
|
693
|
+
) {
|
|
694
|
+
// don't handle tabs if a toolbar is shown, so we can tab into / out of it
|
|
695
|
+
return false;
|
|
696
|
+
}
|
|
689
697
|
this.editor.commands.sinkListItem("blockContainer");
|
|
690
698
|
return true;
|
|
691
699
|
},
|
|
692
700
|
"Shift-Tab": () => {
|
|
701
|
+
if (
|
|
702
|
+
this.options.editor.formattingToolbar?.shown ||
|
|
703
|
+
this.options.editor.linkToolbar?.shown ||
|
|
704
|
+
this.options.editor.imagePanel?.shown
|
|
705
|
+
) {
|
|
706
|
+
// don't handle tabs if a toolbar is shown, so we can tab into / out of it
|
|
707
|
+
return false;
|
|
708
|
+
}
|
|
693
709
|
this.editor.commands.liftListItem("blockContainer");
|
|
694
710
|
return true;
|
|
695
711
|
},
|
package/src/util/browser.ts
CHANGED
|
@@ -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",
|
|
11
|
+
return shortcut.replace("Mod", ctrlText);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
package/src/util/typescript.ts
CHANGED
|
@@ -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];
|
|
@@ -3,10 +3,10 @@ import { Node } from "prosemirror-model";
|
|
|
3
3
|
import * as Y from "yjs";
|
|
4
4
|
import { Block, DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema, PartialBlock } from "../blocks/defaultBlocks";
|
|
5
5
|
import { FormattingToolbarProsemirrorPlugin } from "../extensions/FormattingToolbar/FormattingToolbarPlugin";
|
|
6
|
+
import { ImagePanelProsemirrorPlugin } from "../extensions/ImagePanel/ImageToolbarPlugin";
|
|
6
7
|
import { LinkToolbarProsemirrorPlugin } from "../extensions/LinkToolbar/LinkToolbarPlugin";
|
|
7
8
|
import { SideMenuProsemirrorPlugin } from "../extensions/SideMenu/SideMenuPlugin";
|
|
8
9
|
import { SuggestionMenuProseMirrorPlugin } from "../extensions/SuggestionMenu/SuggestionPlugin";
|
|
9
|
-
import { ImagePanelProsemirrorPlugin } from "../extensions/ImagePanel/ImageToolbarPlugin";
|
|
10
10
|
import { TableHandlesProsemirrorPlugin } from "../extensions/TableHandles/TableHandlesPlugin";
|
|
11
11
|
import { BlockIdentifier, BlockNoteDOMAttributes, BlockSchema, BlockSpecs, InlineContentSchema, InlineContentSpecs, PartialInlineContent, StyleSchema, StyleSpecs, Styles } from "../schema";
|
|
12
12
|
import { NoInfer } from "../util/typescript";
|
|
@@ -14,10 +14,18 @@ import { TextCursorPosition } from "./cursorPositionTypes";
|
|
|
14
14
|
import { Selection } from "./selectionTypes";
|
|
15
15
|
import { BlockNoteSchema } from "./BlockNoteSchema";
|
|
16
16
|
import { BlockNoteTipTapEditor } from "./BlockNoteTipTapEditor";
|
|
17
|
+
import { Dictionary } from "../i18n/dictionary";
|
|
17
18
|
import "./Block.css";
|
|
18
19
|
import "./editor.css";
|
|
19
20
|
export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema> = {
|
|
20
21
|
enableBlockNoteExtensions: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* A dictionary object containing translations for the editor.
|
|
24
|
+
*/
|
|
25
|
+
dictionary?: Dictionary;
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated, provide placeholders via dictionary instead
|
|
28
|
+
*/
|
|
21
29
|
placeholders: Record<string | "default", string>;
|
|
22
30
|
/**
|
|
23
31
|
* An object containing attributes that should be added to HTML elements of the editor.
|
|
@@ -67,6 +75,7 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
|
|
|
67
75
|
renderCursor?: (user: any) => HTMLElement;
|
|
68
76
|
};
|
|
69
77
|
_tiptapOptions: Partial<EditorOptions>;
|
|
78
|
+
trailingBlock?: boolean;
|
|
70
79
|
};
|
|
71
80
|
export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockSchema, ISchema extends InlineContentSchema = DefaultInlineContentSchema, SSchema extends StyleSchema = DefaultStyleSchema> {
|
|
72
81
|
private readonly options;
|
|
@@ -74,6 +83,7 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
|
|
|
74
83
|
contentComponent: any;
|
|
75
84
|
};
|
|
76
85
|
blockCache: WeakMap<Node, Block<any, any, any>>;
|
|
86
|
+
readonly dictionary: Dictionary;
|
|
77
87
|
readonly schema: BlockNoteSchema<BSchema, ISchema, SSchema>;
|
|
78
88
|
readonly blockImplementations: BlockSpecs;
|
|
79
89
|
readonly inlineContentImplementations: InlineContentSpecs;
|
|
@@ -7,12 +7,12 @@ import { BlockNoteDOMAttributes, BlockSpecs, InlineContentSchema, InlineContentS
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const getBlockNoteExtensions: <BSchema extends Record<string, import("../schema").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(opts: {
|
|
9
9
|
editor: BlockNoteEditor<BSchema, I, S>;
|
|
10
|
-
placeholders?: Record<string, string> | undefined;
|
|
11
10
|
domAttributes: Partial<BlockNoteDOMAttributes>;
|
|
12
11
|
blockSchema: BSchema;
|
|
13
12
|
blockSpecs: BlockSpecs;
|
|
14
13
|
inlineContentSpecs: InlineContentSpecs;
|
|
15
14
|
styleSpecs: StyleSpecs;
|
|
15
|
+
trailingBlock: boolean | undefined;
|
|
16
16
|
collaboration?: {
|
|
17
17
|
fragment: Y.XmlFragment;
|
|
18
18
|
user: {
|
|
@@ -20,6 +20,6 @@ export declare const getBlockNoteExtensions: <BSchema extends Record<string, imp
|
|
|
20
20
|
color: string;
|
|
21
21
|
};
|
|
22
22
|
provider: any;
|
|
23
|
-
renderCursor?: (
|
|
24
|
-
}
|
|
23
|
+
renderCursor?: (user: any) => HTMLElement;
|
|
24
|
+
};
|
|
25
25
|
}) => Extensions;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { EditorState, Plugin, PluginKey } from "prosemirror-state";
|
|
1
|
+
import { EditorState, Plugin, PluginKey, PluginView } from "prosemirror-state";
|
|
2
2
|
import { EditorView } from "prosemirror-view";
|
|
3
3
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
4
4
|
import { UiElementPosition } from "../../extensions-shared/UiElementPosition";
|
|
5
5
|
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
|
|
6
6
|
import { EventEmitter } from "../../util/EventEmitter";
|
|
7
7
|
export type FormattingToolbarState = UiElementPosition;
|
|
8
|
-
export declare class FormattingToolbarView {
|
|
8
|
+
export declare class FormattingToolbarView implements PluginView {
|
|
9
9
|
private readonly editor;
|
|
10
10
|
private readonly pmView;
|
|
11
11
|
state?: FormattingToolbarState;
|
|
@@ -23,11 +23,10 @@ export declare class FormattingToolbarView {
|
|
|
23
23
|
viewMousedownHandler: () => void;
|
|
24
24
|
viewMouseupHandler: () => void;
|
|
25
25
|
dragHandler: () => void;
|
|
26
|
-
focusHandler: () => void;
|
|
27
|
-
blurHandler: (event: FocusEvent) => void;
|
|
28
26
|
scrollHandler: () => void;
|
|
29
27
|
update(view: EditorView, oldState?: EditorState): void;
|
|
30
28
|
destroy(): void;
|
|
29
|
+
closeMenu: () => void;
|
|
31
30
|
getSelectionBoundingBox(): DOMRect;
|
|
32
31
|
}
|
|
33
32
|
export declare const formattingToolbarPluginKey: PluginKey<any>;
|
|
@@ -35,5 +34,7 @@ export declare class FormattingToolbarProsemirrorPlugin extends EventEmitter<any
|
|
|
35
34
|
private view;
|
|
36
35
|
readonly plugin: Plugin;
|
|
37
36
|
constructor(editor: BlockNoteEditor<any, any, any>);
|
|
37
|
+
get shown(): boolean;
|
|
38
38
|
onUpdate(callback: (state: FormattingToolbarState) => void): () => void;
|
|
39
|
+
closeMenu: () => void;
|
|
39
40
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { EditorState, Plugin, PluginKey } from "prosemirror-state";
|
|
1
|
+
import { EditorState, Plugin, PluginKey, PluginView } from "prosemirror-state";
|
|
2
2
|
import { EditorView } from "prosemirror-view";
|
|
3
|
+
import { DefaultBlockSchema } from "../../blocks/defaultBlocks";
|
|
3
4
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
4
|
-
import type { BlockFromConfig, InlineContentSchema, StyleSchema } from "../../schema";
|
|
5
5
|
import { UiElementPosition } from "../../extensions-shared/UiElementPosition";
|
|
6
|
+
import type { BlockFromConfig, InlineContentSchema, StyleSchema } from "../../schema";
|
|
6
7
|
import { EventEmitter } from "../../util/EventEmitter";
|
|
7
|
-
import { DefaultBlockSchema } from "../../blocks/defaultBlocks";
|
|
8
8
|
export type ImagePanelState<I extends InlineContentSchema, S extends StyleSchema> = UiElementPosition & {
|
|
9
9
|
block: BlockFromConfig<DefaultBlockSchema["image"], I, S>;
|
|
10
10
|
};
|
|
11
|
-
export declare class ImagePanelView<I extends InlineContentSchema, S extends StyleSchema> {
|
|
11
|
+
export declare class ImagePanelView<I extends InlineContentSchema, S extends StyleSchema> implements PluginView {
|
|
12
12
|
private readonly pluginKey;
|
|
13
13
|
private readonly pmView;
|
|
14
14
|
state?: ImagePanelState<I, S>;
|
|
@@ -17,9 +17,9 @@ export declare class ImagePanelView<I extends InlineContentSchema, S extends Sty
|
|
|
17
17
|
constructor(pluginKey: PluginKey, pmView: EditorView, emitUpdate: (state: ImagePanelState<I, S>) => void);
|
|
18
18
|
mouseDownHandler: () => void;
|
|
19
19
|
dragstartHandler: () => void;
|
|
20
|
-
blurHandler: (event: FocusEvent) => void;
|
|
21
20
|
scrollHandler: () => void;
|
|
22
21
|
update(view: EditorView, prevState: EditorState): void;
|
|
22
|
+
closeMenu: () => void;
|
|
23
23
|
destroy(): void;
|
|
24
24
|
}
|
|
25
25
|
export declare class ImagePanelProsemirrorPlugin<I extends InlineContentSchema, S extends StyleSchema> extends EventEmitter<any> {
|
|
@@ -28,5 +28,7 @@ export declare class ImagePanelProsemirrorPlugin<I extends InlineContentSchema,
|
|
|
28
28
|
constructor(_editor: BlockNoteEditor<{
|
|
29
29
|
image: DefaultBlockSchema["image"];
|
|
30
30
|
}, I, S>);
|
|
31
|
+
get shown(): boolean;
|
|
31
32
|
onUpdate(callback: (state: ImagePanelState<I, S>) => void): () => void;
|
|
33
|
+
closeMenu: () => void;
|
|
32
34
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Plugin, PluginKey } from "prosemirror-state";
|
|
2
2
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
3
|
-
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
|
|
4
3
|
import { UiElementPosition } from "../../extensions-shared/UiElementPosition";
|
|
4
|
+
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
|
|
5
5
|
import { EventEmitter } from "../../util/EventEmitter";
|
|
6
6
|
export type LinkToolbarState = UiElementPosition & {
|
|
7
7
|
url: string;
|
|
@@ -37,4 +37,6 @@ export declare class LinkToolbarProsemirrorPlugin<BSchema extends BlockSchema, I
|
|
|
37
37
|
* cursor exits the link toolbar.
|
|
38
38
|
*/
|
|
39
39
|
stopHideTimer: () => void;
|
|
40
|
+
get shown(): boolean;
|
|
41
|
+
closeMenu: () => void;
|
|
40
42
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Plugin, PluginKey } from "prosemirror-state";
|
|
2
2
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
3
|
-
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
|
|
4
3
|
import { UiElementPosition } from "../../extensions-shared/UiElementPosition";
|
|
4
|
+
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
|
|
5
5
|
import { EventEmitter } from "../../util/EventEmitter";
|
|
6
6
|
export type SuggestionMenuState = UiElementPosition & {
|
|
7
7
|
query: string;
|
|
@@ -27,5 +27,6 @@ export declare class SuggestionMenuProseMirrorPlugin<BSchema extends BlockSchema
|
|
|
27
27
|
removeTriggerCharacter: (triggerCharacter: string) => void;
|
|
28
28
|
closeMenu: () => void;
|
|
29
29
|
clearQuery: () => void;
|
|
30
|
+
get shown(): boolean;
|
|
30
31
|
}
|
|
31
32
|
export declare function createSuggestionMenu<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>, triggerCharacter: string): void;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
export declare const en: {
|
|
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
|
+
paragraph: {
|
|
34
|
+
title: string;
|
|
35
|
+
subtext: string;
|
|
36
|
+
aliases: string[];
|
|
37
|
+
group: string;
|
|
38
|
+
};
|
|
39
|
+
table: {
|
|
40
|
+
title: string;
|
|
41
|
+
subtext: string;
|
|
42
|
+
aliases: string[];
|
|
43
|
+
group: string;
|
|
44
|
+
};
|
|
45
|
+
image: {
|
|
46
|
+
title: string;
|
|
47
|
+
subtext: string;
|
|
48
|
+
aliases: string[];
|
|
49
|
+
group: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
placeholders: {
|
|
53
|
+
default: string;
|
|
54
|
+
heading: string;
|
|
55
|
+
bulletListItem: string;
|
|
56
|
+
numberedListItem: string;
|
|
57
|
+
};
|
|
58
|
+
image: {
|
|
59
|
+
add_button: string;
|
|
60
|
+
};
|
|
61
|
+
side_menu: {
|
|
62
|
+
add_block_label: string;
|
|
63
|
+
drag_handle_label: string;
|
|
64
|
+
};
|
|
65
|
+
drag_handle: {
|
|
66
|
+
delete_menuitem: string;
|
|
67
|
+
colors_menuitem: string;
|
|
68
|
+
};
|
|
69
|
+
table_handle: {
|
|
70
|
+
delete_column_menuitem: string;
|
|
71
|
+
delete_row_menuitem: string;
|
|
72
|
+
add_left_menuitem: string;
|
|
73
|
+
add_right_menuitem: string;
|
|
74
|
+
add_above_menuitem: string;
|
|
75
|
+
add_below_menuitem: string;
|
|
76
|
+
};
|
|
77
|
+
suggestion_menu: {
|
|
78
|
+
no_items_title: string;
|
|
79
|
+
loading: string;
|
|
80
|
+
};
|
|
81
|
+
color_picker: {
|
|
82
|
+
text_title: string;
|
|
83
|
+
background_title: string;
|
|
84
|
+
colors: {
|
|
85
|
+
default: string;
|
|
86
|
+
gray: string;
|
|
87
|
+
brown: string;
|
|
88
|
+
red: string;
|
|
89
|
+
orange: string;
|
|
90
|
+
yellow: string;
|
|
91
|
+
green: string;
|
|
92
|
+
blue: string;
|
|
93
|
+
purple: string;
|
|
94
|
+
pink: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
formatting_toolbar: {
|
|
98
|
+
bold: {
|
|
99
|
+
tooltip: string;
|
|
100
|
+
secondary_tooltip: string;
|
|
101
|
+
};
|
|
102
|
+
italic: {
|
|
103
|
+
tooltip: string;
|
|
104
|
+
secondary_tooltip: string;
|
|
105
|
+
};
|
|
106
|
+
underline: {
|
|
107
|
+
tooltip: string;
|
|
108
|
+
secondary_tooltip: string;
|
|
109
|
+
};
|
|
110
|
+
strike: {
|
|
111
|
+
tooltip: string;
|
|
112
|
+
secondary_tooltip: string;
|
|
113
|
+
};
|
|
114
|
+
code: {
|
|
115
|
+
tooltip: string;
|
|
116
|
+
secondary_tooltip: string;
|
|
117
|
+
};
|
|
118
|
+
colors: {
|
|
119
|
+
tooltip: string;
|
|
120
|
+
};
|
|
121
|
+
link: {
|
|
122
|
+
tooltip: string;
|
|
123
|
+
secondary_tooltip: string;
|
|
124
|
+
};
|
|
125
|
+
image_caption: {
|
|
126
|
+
tooltip: string;
|
|
127
|
+
input_placeholder: string;
|
|
128
|
+
};
|
|
129
|
+
image_replace: {
|
|
130
|
+
tooltip: string;
|
|
131
|
+
};
|
|
132
|
+
nest: {
|
|
133
|
+
tooltip: string;
|
|
134
|
+
secondary_tooltip: string;
|
|
135
|
+
};
|
|
136
|
+
unnest: {
|
|
137
|
+
tooltip: string;
|
|
138
|
+
secondary_tooltip: string;
|
|
139
|
+
};
|
|
140
|
+
align_left: {
|
|
141
|
+
tooltip: string;
|
|
142
|
+
};
|
|
143
|
+
align_center: {
|
|
144
|
+
tooltip: string;
|
|
145
|
+
};
|
|
146
|
+
align_right: {
|
|
147
|
+
tooltip: string;
|
|
148
|
+
};
|
|
149
|
+
align_justify: {
|
|
150
|
+
tooltip: string;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
image_panel: {
|
|
154
|
+
upload: {
|
|
155
|
+
title: string;
|
|
156
|
+
file_placeholder: string;
|
|
157
|
+
upload_error: string;
|
|
158
|
+
};
|
|
159
|
+
embed: {
|
|
160
|
+
title: string;
|
|
161
|
+
embed_button: string;
|
|
162
|
+
url_placeholder: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
link_toolbar: {
|
|
166
|
+
delete: {
|
|
167
|
+
tooltip: string;
|
|
168
|
+
};
|
|
169
|
+
edit: {
|
|
170
|
+
text: string;
|
|
171
|
+
tooltip: string;
|
|
172
|
+
};
|
|
173
|
+
open: {
|
|
174
|
+
tooltip: string;
|
|
175
|
+
};
|
|
176
|
+
form: {
|
|
177
|
+
title_placeholder: string;
|
|
178
|
+
url_placeholder: string;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
generic: {
|
|
182
|
+
ctrl_shortcut: string;
|
|
183
|
+
};
|
|
184
|
+
};
|
package/types/src/index.d.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";
|
|
@@ -24,4 +25,6 @@ export * from "./util/string";
|
|
|
24
25
|
export * from "./api/nodeConversions/nodeConversions";
|
|
25
26
|
export * from "./api/testUtil/partialBlockTestUtil";
|
|
26
27
|
export * from "./extensions/UniqueID/UniqueID";
|
|
27
|
-
export
|
|
28
|
+
export * from "./i18n/dictionary";
|
|
29
|
+
export { UnreachableCaseError, assertEmpty } from "./util/typescript";
|
|
30
|
+
export { locales };
|
|
@@ -25,5 +25,5 @@ export declare const BlockContainer: Node<{
|
|
|
25
25
|
blockContent: Record<string, string>;
|
|
26
26
|
inlineContent: Record<string, string>;
|
|
27
27
|
}> | undefined;
|
|
28
|
-
editor: BlockNoteEditor<
|
|
28
|
+
editor: BlockNoteEditor<any, any, any>;
|
|
29
29
|
}, any>;
|