@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
package/dist/blocknote.js
CHANGED
|
@@ -1,49 +1,442 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (n, t, e) => (
|
|
4
|
-
import { Slice as U, Fragment as T, DOMSerializer as bt, DOMParser as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
var fe = Object.defineProperty;
|
|
2
|
+
var ge = (n, t, e) => t in n ? fe(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var d = (n, t, e) => (ge(n, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
+
import { Slice as U, Fragment as T, DOMSerializer as bt, DOMParser as be, Node as ke } from "prosemirror-model";
|
|
5
|
+
import Vt from "rehype-parse";
|
|
6
|
+
import zt from "rehype-stringify";
|
|
7
7
|
import { unified as kt } from "unified";
|
|
8
|
-
import { Extension as M, combineTransactionSteps as
|
|
9
|
-
import { Plugin as v, PluginKey as x, Selection as ut, NodeSelection as it, TextSelection as ot, EditorState as
|
|
10
|
-
import { v4 as
|
|
8
|
+
import { Extension as M, combineTransactionSteps as ye, getChangedRanges as we, findChildrenInRange as ve, Node as K, Mark as yt, InputRule as wt, callOrReturn as Ee, getExtensionField as Se, mergeAttributes as Ce, selectionToInsertionEnd as xe, isNodeSelection as Te, posToDOMRect as ft, getMarkRange as Mt, findParentNode as Me, findChildren as Bt, extensions as X, Editor as Be, createDocument as Le } from "@tiptap/core";
|
|
9
|
+
import { Plugin as v, PluginKey as x, Selection as ut, NodeSelection as it, TextSelection as ot, EditorState as Ie } from "prosemirror-state";
|
|
10
|
+
import { v4 as _e } from "uuid";
|
|
11
11
|
import { fromDom as Lt } from "hast-util-from-dom";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
12
|
+
import Ae from "@tiptap/extension-bold";
|
|
13
|
+
import Ne from "@tiptap/extension-code";
|
|
14
14
|
import Pe from "@tiptap/extension-italic";
|
|
15
15
|
import He from "@tiptap/extension-strike";
|
|
16
16
|
import De from "@tiptap/extension-underline";
|
|
17
17
|
import { TableCell as Oe } from "@tiptap/extension-table-cell";
|
|
18
|
-
import { TableHeader as
|
|
19
|
-
import { TableRow as
|
|
20
|
-
import { columnResizing as
|
|
21
|
-
import
|
|
18
|
+
import { TableHeader as Ue } from "@tiptap/extension-table-header";
|
|
19
|
+
import { TableRow as Re } from "@tiptap/extension-table-row";
|
|
20
|
+
import { columnResizing as Ve, tableEditing as ze } from "prosemirror-tables";
|
|
21
|
+
import Fe from "rehype-remark";
|
|
22
22
|
import Ft from "remark-gfm";
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import { DecorationSet as G, Decoration as
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import { Dropcursor as
|
|
30
|
-
import { Gapcursor as
|
|
31
|
-
import { HardBreak as
|
|
32
|
-
import { History as
|
|
33
|
-
import { Link as
|
|
34
|
-
import { Text as
|
|
35
|
-
|
|
23
|
+
import je from "remark-stringify";
|
|
24
|
+
import Ge from "remark-parse";
|
|
25
|
+
import $e, { defaultHandlers as Ke } from "remark-rehype";
|
|
26
|
+
import { DecorationSet as G, Decoration as $, EditorView as qe } from "prosemirror-view";
|
|
27
|
+
import We from "@tiptap/extension-collaboration";
|
|
28
|
+
import Je from "@tiptap/extension-collaboration-cursor";
|
|
29
|
+
import { Dropcursor as Xe } from "@tiptap/extension-dropcursor";
|
|
30
|
+
import { Gapcursor as Ye } from "@tiptap/extension-gapcursor";
|
|
31
|
+
import { HardBreak as Qe } from "@tiptap/extension-hard-break";
|
|
32
|
+
import { History as Ze } from "@tiptap/extension-history";
|
|
33
|
+
import { Link as tn } from "@tiptap/extension-link";
|
|
34
|
+
import { Text as en } from "@tiptap/extension-text";
|
|
35
|
+
const jt = {
|
|
36
|
+
slash_menu: {
|
|
37
|
+
heading: {
|
|
38
|
+
title: "Heading 1",
|
|
39
|
+
subtext: "Used for a top-level heading",
|
|
40
|
+
aliases: ["h", "heading1", "h1"],
|
|
41
|
+
group: "Headings"
|
|
42
|
+
},
|
|
43
|
+
heading_2: {
|
|
44
|
+
title: "Heading 2",
|
|
45
|
+
subtext: "Used for key sections",
|
|
46
|
+
aliases: ["h2", "heading2", "subheading"],
|
|
47
|
+
group: "Headings"
|
|
48
|
+
},
|
|
49
|
+
heading_3: {
|
|
50
|
+
title: "Heading 3",
|
|
51
|
+
subtext: "Used for subsections and group headings",
|
|
52
|
+
aliases: ["h3", "heading3", "subheading"],
|
|
53
|
+
group: "Headings"
|
|
54
|
+
},
|
|
55
|
+
numbered_list: {
|
|
56
|
+
title: "Numbered List",
|
|
57
|
+
subtext: "Used to display a numbered list",
|
|
58
|
+
aliases: ["ol", "li", "list", "numberedlist", "numbered list"],
|
|
59
|
+
group: "Basic blocks"
|
|
60
|
+
},
|
|
61
|
+
bullet_list: {
|
|
62
|
+
title: "Bullet List",
|
|
63
|
+
subtext: "Used to display an unordered list",
|
|
64
|
+
aliases: ["ul", "li", "list", "bulletlist", "bullet list"],
|
|
65
|
+
group: "Basic blocks"
|
|
66
|
+
},
|
|
67
|
+
paragraph: {
|
|
68
|
+
title: "Paragraph",
|
|
69
|
+
subtext: "Used for the body of your document",
|
|
70
|
+
aliases: ["p", "paragraph"],
|
|
71
|
+
group: "Basic blocks"
|
|
72
|
+
},
|
|
73
|
+
table: {
|
|
74
|
+
title: "Table",
|
|
75
|
+
subtext: "Used for for tables",
|
|
76
|
+
aliases: ["table"],
|
|
77
|
+
group: "Advanced"
|
|
78
|
+
},
|
|
79
|
+
image: {
|
|
80
|
+
title: "Image",
|
|
81
|
+
subtext: "Insert an image",
|
|
82
|
+
aliases: [
|
|
83
|
+
"image",
|
|
84
|
+
"imageUpload",
|
|
85
|
+
"upload",
|
|
86
|
+
"img",
|
|
87
|
+
"picture",
|
|
88
|
+
"media",
|
|
89
|
+
"url",
|
|
90
|
+
"drive",
|
|
91
|
+
"dropbox"
|
|
92
|
+
],
|
|
93
|
+
group: "Media"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
placeholders: {
|
|
97
|
+
default: "Enter text or type '/' for commands",
|
|
98
|
+
heading: "Heading",
|
|
99
|
+
bulletListItem: "List",
|
|
100
|
+
numberedListItem: "List"
|
|
101
|
+
},
|
|
102
|
+
image: {
|
|
103
|
+
add_button: "Add Image"
|
|
104
|
+
},
|
|
105
|
+
// from react package:
|
|
106
|
+
side_menu: {
|
|
107
|
+
add_block_label: "Add block",
|
|
108
|
+
drag_handle_label: "Open block menu"
|
|
109
|
+
},
|
|
110
|
+
drag_handle: {
|
|
111
|
+
delete_menuitem: "Delete",
|
|
112
|
+
colors_menuitem: "Colors"
|
|
113
|
+
},
|
|
114
|
+
table_handle: {
|
|
115
|
+
delete_column_menuitem: "Delete column",
|
|
116
|
+
delete_row_menuitem: "Delete row",
|
|
117
|
+
add_left_menuitem: "Add column left",
|
|
118
|
+
add_right_menuitem: "Add column right",
|
|
119
|
+
add_above_menuitem: "Add row above",
|
|
120
|
+
add_below_menuitem: "Add row below"
|
|
121
|
+
},
|
|
122
|
+
suggestion_menu: {
|
|
123
|
+
no_items_title: "No items found",
|
|
124
|
+
loading: "Loading…"
|
|
125
|
+
},
|
|
126
|
+
color_picker: {
|
|
127
|
+
text_title: "Text",
|
|
128
|
+
background_title: "Background",
|
|
129
|
+
colors: {
|
|
130
|
+
default: "Default",
|
|
131
|
+
gray: "Gray",
|
|
132
|
+
brown: "Brown",
|
|
133
|
+
red: "Red",
|
|
134
|
+
orange: "Orange",
|
|
135
|
+
yellow: "Yellow",
|
|
136
|
+
green: "Green",
|
|
137
|
+
blue: "Blue",
|
|
138
|
+
purple: "Purple",
|
|
139
|
+
pink: "Pink"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
formatting_toolbar: {
|
|
143
|
+
bold: {
|
|
144
|
+
tooltip: "Bold",
|
|
145
|
+
secondary_tooltip: "Mod+B"
|
|
146
|
+
},
|
|
147
|
+
italic: {
|
|
148
|
+
tooltip: "Italic",
|
|
149
|
+
secondary_tooltip: "Mod+I"
|
|
150
|
+
},
|
|
151
|
+
underline: {
|
|
152
|
+
tooltip: "Underline",
|
|
153
|
+
secondary_tooltip: "Mod+U"
|
|
154
|
+
},
|
|
155
|
+
strike: {
|
|
156
|
+
tooltip: "Strike",
|
|
157
|
+
secondary_tooltip: "Mod+Shift+X"
|
|
158
|
+
},
|
|
159
|
+
code: {
|
|
160
|
+
tooltip: "Code",
|
|
161
|
+
secondary_tooltip: ""
|
|
162
|
+
},
|
|
163
|
+
colors: {
|
|
164
|
+
tooltip: "Colors"
|
|
165
|
+
},
|
|
166
|
+
link: {
|
|
167
|
+
tooltip: "Create link",
|
|
168
|
+
secondary_tooltip: "Mod+K"
|
|
169
|
+
},
|
|
170
|
+
image_caption: {
|
|
171
|
+
tooltip: "Edit caption",
|
|
172
|
+
input_placeholder: "Edit caption"
|
|
173
|
+
},
|
|
174
|
+
image_replace: {
|
|
175
|
+
tooltip: "Replace image"
|
|
176
|
+
},
|
|
177
|
+
nest: {
|
|
178
|
+
tooltip: "Nest block",
|
|
179
|
+
secondary_tooltip: "Tab"
|
|
180
|
+
},
|
|
181
|
+
unnest: {
|
|
182
|
+
tooltip: "Unnest block",
|
|
183
|
+
secondary_tooltip: "Shift+Tab"
|
|
184
|
+
},
|
|
185
|
+
align_left: {
|
|
186
|
+
tooltip: "Align text left"
|
|
187
|
+
},
|
|
188
|
+
align_center: {
|
|
189
|
+
tooltip: "Align text center"
|
|
190
|
+
},
|
|
191
|
+
align_right: {
|
|
192
|
+
tooltip: "Align text right"
|
|
193
|
+
},
|
|
194
|
+
align_justify: {
|
|
195
|
+
tooltip: "Justify text"
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
image_panel: {
|
|
199
|
+
upload: {
|
|
200
|
+
title: "Upload",
|
|
201
|
+
file_placeholder: "Upload image",
|
|
202
|
+
upload_error: "Error: Upload failed"
|
|
203
|
+
},
|
|
204
|
+
embed: {
|
|
205
|
+
title: "Embed",
|
|
206
|
+
embed_button: "Embed image",
|
|
207
|
+
url_placeholder: "Enter URL"
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
link_toolbar: {
|
|
211
|
+
delete: {
|
|
212
|
+
tooltip: "Remove link"
|
|
213
|
+
},
|
|
214
|
+
edit: {
|
|
215
|
+
text: "Edit link",
|
|
216
|
+
tooltip: "Edit"
|
|
217
|
+
},
|
|
218
|
+
open: {
|
|
219
|
+
tooltip: "Open in new tab"
|
|
220
|
+
},
|
|
221
|
+
form: {
|
|
222
|
+
title_placeholder: "Edit title",
|
|
223
|
+
url_placeholder: "Edit URL"
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
generic: {
|
|
227
|
+
ctrl_shortcut: "Ctrl"
|
|
228
|
+
}
|
|
229
|
+
}, nn = {
|
|
230
|
+
slash_menu: {
|
|
231
|
+
heading: {
|
|
232
|
+
title: "Kop 1",
|
|
233
|
+
subtext: "Gebruikt voor een hoofdkop",
|
|
234
|
+
aliases: ["h", "kop1", "h1"],
|
|
235
|
+
group: "Koppen"
|
|
236
|
+
},
|
|
237
|
+
heading_2: {
|
|
238
|
+
title: "Kop 2",
|
|
239
|
+
subtext: "Gebruikt voor belangrijke secties",
|
|
240
|
+
aliases: ["h2", "kop2", "subkop"],
|
|
241
|
+
group: "Koppen"
|
|
242
|
+
},
|
|
243
|
+
heading_3: {
|
|
244
|
+
title: "Kop 3",
|
|
245
|
+
subtext: "Gebruikt voor subsecties en groepskoppen",
|
|
246
|
+
aliases: ["h3", "kop3", "subkop"],
|
|
247
|
+
group: "Koppen"
|
|
248
|
+
},
|
|
249
|
+
numbered_list: {
|
|
250
|
+
title: "Genummerde Lijst",
|
|
251
|
+
subtext: "Gebruikt om een genummerde lijst weer te geven",
|
|
252
|
+
aliases: ["ol", "li", "lijst", "genummerdelijst", "genummerde lijst"],
|
|
253
|
+
group: "Basisblokken"
|
|
254
|
+
},
|
|
255
|
+
bullet_list: {
|
|
256
|
+
title: "Puntenlijst",
|
|
257
|
+
subtext: "Gebruikt om een ongeordende lijst weer te geven",
|
|
258
|
+
aliases: ["ul", "li", "lijst", "puntenlijst", "punten lijst"],
|
|
259
|
+
group: "Basisblokken"
|
|
260
|
+
},
|
|
261
|
+
paragraph: {
|
|
262
|
+
title: "Paragraaf",
|
|
263
|
+
subtext: "Gebruikt voor de hoofdtekst van uw document",
|
|
264
|
+
aliases: ["p", "paragraaf"],
|
|
265
|
+
group: "Basisblokken"
|
|
266
|
+
},
|
|
267
|
+
table: {
|
|
268
|
+
title: "Tabel",
|
|
269
|
+
subtext: "Gebruikt voor tabellen",
|
|
270
|
+
aliases: ["tabel"],
|
|
271
|
+
group: "Geavanceerd"
|
|
272
|
+
},
|
|
273
|
+
image: {
|
|
274
|
+
title: "Afbeelding",
|
|
275
|
+
subtext: "Voeg een afbeelding in",
|
|
276
|
+
aliases: [
|
|
277
|
+
"afbeelding",
|
|
278
|
+
"imageUpload",
|
|
279
|
+
"upload",
|
|
280
|
+
"img",
|
|
281
|
+
"foto",
|
|
282
|
+
"media",
|
|
283
|
+
"url",
|
|
284
|
+
"drive",
|
|
285
|
+
"dropbox"
|
|
286
|
+
],
|
|
287
|
+
group: "Media"
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
placeholders: {
|
|
291
|
+
default: "Voer tekst in of type '/' voor commando's",
|
|
292
|
+
heading: "Kop",
|
|
293
|
+
bulletListItem: "Lijst",
|
|
294
|
+
numberedListItem: "Lijst"
|
|
295
|
+
},
|
|
296
|
+
image: {
|
|
297
|
+
add_button: "Afbeelding toevoegen"
|
|
298
|
+
},
|
|
299
|
+
// from react package:
|
|
300
|
+
side_menu: {
|
|
301
|
+
add_block_label: "Nieuw blok",
|
|
302
|
+
drag_handle_label: "Open blok menu"
|
|
303
|
+
},
|
|
304
|
+
drag_handle: {
|
|
305
|
+
delete_menuitem: "Verwijder",
|
|
306
|
+
colors_menuitem: "Kleuren"
|
|
307
|
+
},
|
|
308
|
+
table_handle: {
|
|
309
|
+
delete_column_menuitem: "Verwijder kolom",
|
|
310
|
+
delete_row_menuitem: "Verwijder rij",
|
|
311
|
+
add_left_menuitem: "Voeg kolom links toe",
|
|
312
|
+
add_right_menuitem: "Voeg kolom rechts toe",
|
|
313
|
+
add_above_menuitem: "Voeg rij boven toe",
|
|
314
|
+
add_below_menuitem: "Voeg rij onder toe"
|
|
315
|
+
},
|
|
316
|
+
suggestion_menu: {
|
|
317
|
+
no_items_title: "Geen items gevonden",
|
|
318
|
+
loading: "Laden…"
|
|
319
|
+
},
|
|
320
|
+
color_picker: {
|
|
321
|
+
text_title: "Tekst",
|
|
322
|
+
background_title: "Achtergrond",
|
|
323
|
+
colors: {
|
|
324
|
+
default: "Standaard",
|
|
325
|
+
gray: "Grijs",
|
|
326
|
+
brown: "Bruin",
|
|
327
|
+
red: "Rood",
|
|
328
|
+
orange: "Oranje",
|
|
329
|
+
yellow: "Geel",
|
|
330
|
+
green: "Groen",
|
|
331
|
+
blue: "Blauw",
|
|
332
|
+
purple: "Paars",
|
|
333
|
+
pink: "Roze"
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
formatting_toolbar: {
|
|
337
|
+
bold: {
|
|
338
|
+
tooltip: "Vet",
|
|
339
|
+
secondary_tooltip: "Mod+B"
|
|
340
|
+
},
|
|
341
|
+
italic: {
|
|
342
|
+
tooltip: "Cursief",
|
|
343
|
+
secondary_tooltip: "Mod+I"
|
|
344
|
+
},
|
|
345
|
+
underline: {
|
|
346
|
+
tooltip: "Onderstrepen",
|
|
347
|
+
secondary_tooltip: "Mod+U"
|
|
348
|
+
},
|
|
349
|
+
strike: {
|
|
350
|
+
tooltip: "Doorstrepen",
|
|
351
|
+
secondary_tooltip: "Mod+Shift+X"
|
|
352
|
+
},
|
|
353
|
+
code: {
|
|
354
|
+
tooltip: "Code",
|
|
355
|
+
secondary_tooltip: ""
|
|
356
|
+
},
|
|
357
|
+
colors: {
|
|
358
|
+
tooltip: "Kleuren"
|
|
359
|
+
},
|
|
360
|
+
link: {
|
|
361
|
+
tooltip: "Maak link",
|
|
362
|
+
secondary_tooltip: "Mod+K"
|
|
363
|
+
},
|
|
364
|
+
image_caption: {
|
|
365
|
+
tooltip: "Bewerk onderschrift",
|
|
366
|
+
input_placeholder: "Bewerk onderschrift"
|
|
367
|
+
},
|
|
368
|
+
image_replace: {
|
|
369
|
+
tooltip: "Vervang afbeelding"
|
|
370
|
+
},
|
|
371
|
+
nest: {
|
|
372
|
+
tooltip: "Nest blok",
|
|
373
|
+
secondary_tooltip: "Tab"
|
|
374
|
+
},
|
|
375
|
+
unnest: {
|
|
376
|
+
tooltip: "Ontnest blok",
|
|
377
|
+
secondary_tooltip: "Shift+Tab"
|
|
378
|
+
},
|
|
379
|
+
align_left: {
|
|
380
|
+
tooltip: "Tekst links uitlijnen"
|
|
381
|
+
},
|
|
382
|
+
align_center: {
|
|
383
|
+
tooltip: "Tekst centreren"
|
|
384
|
+
},
|
|
385
|
+
align_right: {
|
|
386
|
+
tooltip: "Tekst rechts uitlijnen"
|
|
387
|
+
},
|
|
388
|
+
align_justify: {
|
|
389
|
+
tooltip: "Tekst uitvullen"
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
image_panel: {
|
|
393
|
+
upload: {
|
|
394
|
+
title: "Upload",
|
|
395
|
+
file_placeholder: "Upload afbeelding",
|
|
396
|
+
upload_error: "Fout: Upload mislukt"
|
|
397
|
+
},
|
|
398
|
+
embed: {
|
|
399
|
+
title: "Insluiten",
|
|
400
|
+
embed_button: "Insluiten afbeelding",
|
|
401
|
+
url_placeholder: "Voer URL in"
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
link_toolbar: {
|
|
405
|
+
delete: {
|
|
406
|
+
tooltip: "Verwijder link"
|
|
407
|
+
},
|
|
408
|
+
edit: {
|
|
409
|
+
text: "Bewerk link",
|
|
410
|
+
tooltip: "Bewerk"
|
|
411
|
+
},
|
|
412
|
+
open: {
|
|
413
|
+
tooltip: "Open in nieuw tabblad"
|
|
414
|
+
},
|
|
415
|
+
form: {
|
|
416
|
+
title_placeholder: "Bewerk titel",
|
|
417
|
+
url_placeholder: "Bewerk URL"
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
generic: {
|
|
421
|
+
ctrl_shortcut: "Ctrl"
|
|
422
|
+
}
|
|
423
|
+
}, Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
424
|
+
__proto__: null,
|
|
425
|
+
en: jt,
|
|
426
|
+
nl: nn
|
|
427
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
428
|
+
function on(n, t = JSON.stringify) {
|
|
36
429
|
const e = {};
|
|
37
430
|
return n.filter((o) => {
|
|
38
431
|
const r = t(o);
|
|
39
432
|
return Object.prototype.hasOwnProperty.call(e, r) ? !1 : e[r] = !0;
|
|
40
433
|
});
|
|
41
434
|
}
|
|
42
|
-
function
|
|
435
|
+
function rn(n) {
|
|
43
436
|
const t = n.filter(
|
|
44
437
|
(o, r) => n.indexOf(o) !== r
|
|
45
438
|
);
|
|
46
|
-
return
|
|
439
|
+
return on(t);
|
|
47
440
|
}
|
|
48
441
|
const Z = M.create({
|
|
49
442
|
name: "uniqueID",
|
|
@@ -59,7 +452,7 @@ const Z = M.create({
|
|
|
59
452
|
const n = window.__TEST_OPTIONS;
|
|
60
453
|
return n.mockID === void 0 ? n.mockID = 0 : n.mockID++, n.mockID.toString();
|
|
61
454
|
}
|
|
62
|
-
return
|
|
455
|
+
return _e();
|
|
63
456
|
},
|
|
64
457
|
filterTransaction: null
|
|
65
458
|
};
|
|
@@ -122,19 +515,19 @@ const Z = M.create({
|
|
|
122
515
|
});
|
|
123
516
|
if (!i || s)
|
|
124
517
|
return;
|
|
125
|
-
const { tr: a } = r, { types: l, attributeName: c, generateID: u } = this.options, p =
|
|
518
|
+
const { tr: a } = r, { types: l, attributeName: c, generateID: u } = this.options, p = ye(
|
|
126
519
|
o.doc,
|
|
127
520
|
e
|
|
128
521
|
), { mapping: m } = p;
|
|
129
|
-
if (
|
|
130
|
-
const k =
|
|
522
|
+
if (we(p).forEach(({ newRange: f }) => {
|
|
523
|
+
const k = ve(
|
|
131
524
|
r.doc,
|
|
132
525
|
f,
|
|
133
526
|
(E) => l.includes(E.type.name)
|
|
134
|
-
), S = k.map(({ node: E }) => E.attrs[c]).filter((E) => E !== null), B =
|
|
135
|
-
k.forEach(({ node: E, pos:
|
|
136
|
-
let
|
|
137
|
-
const J = (
|
|
527
|
+
), S = k.map(({ node: E }) => E.attrs[c]).filter((E) => E !== null), B = rn(S);
|
|
528
|
+
k.forEach(({ node: E, pos: D }) => {
|
|
529
|
+
let z;
|
|
530
|
+
const J = (z = a.doc.nodeAt(D)) === null || z === void 0 ? void 0 : z.attrs[c];
|
|
138
531
|
if (J === null) {
|
|
139
532
|
const ct = o.doc.type.createAndFill().content;
|
|
140
533
|
if (o.doc.content.findDiffStart(ct) === null) {
|
|
@@ -142,21 +535,21 @@ const Z = M.create({
|
|
|
142
535
|
JSON.stringify(r.doc.toJSON())
|
|
143
536
|
);
|
|
144
537
|
if (nt.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(nt.content) === JSON.stringify(ct.toJSON())) {
|
|
145
|
-
a.setNodeMarkup(
|
|
538
|
+
a.setNodeMarkup(D, void 0, {
|
|
146
539
|
...E.attrs,
|
|
147
540
|
[c]: "initialBlockId"
|
|
148
541
|
});
|
|
149
542
|
return;
|
|
150
543
|
}
|
|
151
544
|
}
|
|
152
|
-
a.setNodeMarkup(
|
|
545
|
+
a.setNodeMarkup(D, void 0, {
|
|
153
546
|
...E.attrs,
|
|
154
547
|
[c]: u()
|
|
155
548
|
});
|
|
156
549
|
return;
|
|
157
550
|
}
|
|
158
|
-
const { deleted: g } = m.invert().mapResult(
|
|
159
|
-
g && B.includes(J) && a.setNodeMarkup(
|
|
551
|
+
const { deleted: g } = m.invert().mapResult(D);
|
|
552
|
+
g && B.includes(J) && a.setNodeMarkup(D, void 0, {
|
|
160
553
|
...E.attrs,
|
|
161
554
|
[c]: u()
|
|
162
555
|
});
|
|
@@ -227,7 +620,7 @@ const Z = M.create({
|
|
|
227
620
|
];
|
|
228
621
|
}
|
|
229
622
|
});
|
|
230
|
-
function
|
|
623
|
+
function Gt(n) {
|
|
231
624
|
const t = n.attrs.id, e = n.firstChild, o = e.type, r = n.childCount === 2 ? n.lastChild.childCount : 0;
|
|
232
625
|
return {
|
|
233
626
|
id: t,
|
|
@@ -257,7 +650,7 @@ function b(n, t) {
|
|
|
257
650
|
break;
|
|
258
651
|
a -= 1, s = r.node(a);
|
|
259
652
|
}
|
|
260
|
-
const { id: l, contentNode: c, contentType: u, numChildBlocks: p } =
|
|
653
|
+
const { id: l, contentNode: c, contentType: u, numChildBlocks: p } = Gt(s), m = r.start(a), h = r.end(a);
|
|
261
654
|
return {
|
|
262
655
|
id: l,
|
|
263
656
|
node: s,
|
|
@@ -272,7 +665,7 @@ function b(n, t) {
|
|
|
272
665
|
function It(n) {
|
|
273
666
|
return n.type === "link";
|
|
274
667
|
}
|
|
275
|
-
function
|
|
668
|
+
function $t(n) {
|
|
276
669
|
return typeof n != "string" && n.type === "link";
|
|
277
670
|
}
|
|
278
671
|
function Q(n) {
|
|
@@ -283,7 +676,12 @@ class A extends Error {
|
|
|
283
676
|
super(`Unreachable case: ${t}`);
|
|
284
677
|
}
|
|
285
678
|
}
|
|
286
|
-
function
|
|
679
|
+
function Or(n, t = !0) {
|
|
680
|
+
const { "data-test": e, ...o } = n;
|
|
681
|
+
if (Object.keys(o).length > 0 && t)
|
|
682
|
+
throw new Error("Object must be empty " + JSON.stringify(n));
|
|
683
|
+
}
|
|
684
|
+
function _t(n, t, e) {
|
|
287
685
|
const o = [];
|
|
288
686
|
for (const [r, i] of Object.entries(n.styles)) {
|
|
289
687
|
const s = e[r];
|
|
@@ -299,7 +697,7 @@ function Nt(n, t, e) {
|
|
|
299
697
|
return n.text.split(/(\n)/g).filter((r) => r.length > 0).map((r) => r === `
|
|
300
698
|
` ? t.nodes.hardBreak.create() : t.text(r, o));
|
|
301
699
|
}
|
|
302
|
-
function
|
|
700
|
+
function sn(n, t, e) {
|
|
303
701
|
const o = t.marks.link.create({
|
|
304
702
|
href: n.href
|
|
305
703
|
});
|
|
@@ -317,25 +715,25 @@ function gt(n, t, e) {
|
|
|
317
715
|
const o = [];
|
|
318
716
|
if (typeof n == "string")
|
|
319
717
|
return o.push(
|
|
320
|
-
...
|
|
718
|
+
..._t(
|
|
321
719
|
{ type: "text", text: n, styles: {} },
|
|
322
720
|
t,
|
|
323
721
|
e
|
|
324
722
|
)
|
|
325
723
|
), o;
|
|
326
724
|
for (const r of n)
|
|
327
|
-
o.push(...
|
|
725
|
+
o.push(..._t(r, t, e));
|
|
328
726
|
return o;
|
|
329
727
|
}
|
|
330
728
|
function at(n, t, e) {
|
|
331
729
|
const o = [];
|
|
332
730
|
for (const r of n)
|
|
333
|
-
typeof r == "string" ? o.push(...gt(r, t, e)) :
|
|
334
|
-
|
|
731
|
+
typeof r == "string" ? o.push(...gt(r, t, e)) : $t(r) ? o.push(...sn(r, t, e)) : Q(r) ? o.push(...gt([r], t, e)) : o.push(
|
|
732
|
+
qt(r, t, e)
|
|
335
733
|
);
|
|
336
734
|
return o;
|
|
337
735
|
}
|
|
338
|
-
function
|
|
736
|
+
function Kt(n, t, e) {
|
|
339
737
|
const o = [];
|
|
340
738
|
for (const r of n.rows) {
|
|
341
739
|
const i = [];
|
|
@@ -357,7 +755,7 @@ function jt(n, t, e) {
|
|
|
357
755
|
}
|
|
358
756
|
return o;
|
|
359
757
|
}
|
|
360
|
-
function
|
|
758
|
+
function qt(n, t, e) {
|
|
361
759
|
let o, r = n.type;
|
|
362
760
|
if (r === void 0 && (r = "paragraph"), !t.nodes[r])
|
|
363
761
|
throw new Error(`node type ${r} not found in schema`);
|
|
@@ -372,23 +770,23 @@ function Wt(n, t, e) {
|
|
|
372
770
|
const i = at(n.content, t, e);
|
|
373
771
|
o = t.nodes[r].create(n.props, i);
|
|
374
772
|
} else if (n.content.type === "tableContent") {
|
|
375
|
-
const i =
|
|
773
|
+
const i = Kt(n.content, t, e);
|
|
376
774
|
o = t.nodes[r].create(n.props, i);
|
|
377
775
|
} else
|
|
378
776
|
throw new A(n.content.type);
|
|
379
777
|
return o;
|
|
380
778
|
}
|
|
381
|
-
function
|
|
779
|
+
function H(n, t, e) {
|
|
382
780
|
let o = n.id;
|
|
383
781
|
o === void 0 && (o = Z.options.generateID());
|
|
384
|
-
const r =
|
|
782
|
+
const r = qt(
|
|
385
783
|
n,
|
|
386
784
|
t,
|
|
387
785
|
e
|
|
388
786
|
), i = [];
|
|
389
787
|
if (n.children)
|
|
390
788
|
for (const a of n.children)
|
|
391
|
-
i.push(
|
|
789
|
+
i.push(H(a, t, e));
|
|
392
790
|
const s = t.nodes.blockGroup.create({}, i);
|
|
393
791
|
return t.nodes.blockContainer.create(
|
|
394
792
|
{
|
|
@@ -398,7 +796,7 @@ function D(n, t, e) {
|
|
|
398
796
|
i.length > 0 ? [r, s] : r
|
|
399
797
|
);
|
|
400
798
|
}
|
|
401
|
-
function
|
|
799
|
+
function an(n, t, e) {
|
|
402
800
|
const o = {
|
|
403
801
|
type: "tableContent",
|
|
404
802
|
rows: []
|
|
@@ -443,7 +841,7 @@ function vt(n, t, e) {
|
|
|
443
841
|
}
|
|
444
842
|
if (i.type.name !== "link" && i.type.name !== "text" && t[i.type.name]) {
|
|
445
843
|
r && (o.push(r), r = void 0), o.push(
|
|
446
|
-
|
|
844
|
+
Wt(i, t, e)
|
|
447
845
|
);
|
|
448
846
|
return;
|
|
449
847
|
}
|
|
@@ -514,7 +912,7 @@ function vt(n, t, e) {
|
|
|
514
912
|
};
|
|
515
913
|
}), r && o.push(r), o;
|
|
516
914
|
}
|
|
517
|
-
function
|
|
915
|
+
function Wt(n, t, e) {
|
|
518
916
|
if (n.type.name === "text" || n.type.name === "link")
|
|
519
917
|
throw new Error("unexpected");
|
|
520
918
|
const o = {}, r = t[n.type.name];
|
|
@@ -543,7 +941,7 @@ function y(n, t, e, o, r) {
|
|
|
543
941
|
const i = r == null ? void 0 : r.get(n);
|
|
544
942
|
if (i)
|
|
545
943
|
return i;
|
|
546
|
-
const s =
|
|
944
|
+
const s = Gt(n);
|
|
547
945
|
let a = s.id;
|
|
548
946
|
a === null && (a = Z.options.generateID());
|
|
549
947
|
const l = {};
|
|
@@ -578,7 +976,7 @@ function y(n, t, e, o, r) {
|
|
|
578
976
|
o
|
|
579
977
|
);
|
|
580
978
|
else if (c.content === "table")
|
|
581
|
-
p =
|
|
979
|
+
p = an(
|
|
582
980
|
s.contentNode,
|
|
583
981
|
e,
|
|
584
982
|
o
|
|
@@ -596,14 +994,14 @@ function y(n, t, e, o, r) {
|
|
|
596
994
|
};
|
|
597
995
|
return r == null || r.set(n, m), m;
|
|
598
996
|
}
|
|
599
|
-
function
|
|
997
|
+
function ln(n) {
|
|
600
998
|
return n.document || window.document;
|
|
601
999
|
}
|
|
602
|
-
const
|
|
1000
|
+
const Jt = (n, t, e, o, r) => {
|
|
603
1001
|
if (!e.nodes[n.type.name])
|
|
604
1002
|
throw new Error("Serializer is missing a node type: " + n.type.name);
|
|
605
1003
|
const { dom: i, contentDOM: s } = bt.renderSpec(
|
|
606
|
-
|
|
1004
|
+
ln(t),
|
|
607
1005
|
e.nodes[n.type.name](n)
|
|
608
1006
|
);
|
|
609
1007
|
if (s) {
|
|
@@ -642,11 +1040,11 @@ const Kt = (n, t, e, o, r) => {
|
|
|
642
1040
|
e.serializeFragment(n.content, t, s);
|
|
643
1041
|
}
|
|
644
1042
|
return i;
|
|
645
|
-
},
|
|
1043
|
+
}, Xt = (n, t) => {
|
|
646
1044
|
const e = t.serializeFragment(n), o = document.createElement("div");
|
|
647
1045
|
return o.appendChild(e), o.innerHTML;
|
|
648
1046
|
};
|
|
649
|
-
function
|
|
1047
|
+
function cn(n) {
|
|
650
1048
|
const t = /* @__PURE__ */ new Set([
|
|
651
1049
|
...n.orderedListItemBlockTypes,
|
|
652
1050
|
...n.unorderedListItemBlockTypes
|
|
@@ -697,24 +1095,24 @@ function an(n) {
|
|
|
697
1095
|
}
|
|
698
1096
|
const lt = (n, t) => {
|
|
699
1097
|
const e = bt.fromSchema(n);
|
|
700
|
-
return e.serializeNodeInner = (o, r) =>
|
|
1098
|
+
return e.serializeNodeInner = (o, r) => Jt(o, r, e, t, !0), e.exportProseMirrorFragment = (o) => kt().use(Vt, { fragment: !0 }).use(cn, {
|
|
701
1099
|
orderedListItemBlockTypes: /* @__PURE__ */ new Set(["numberedListItem"]),
|
|
702
1100
|
unorderedListItemBlockTypes: /* @__PURE__ */ new Set(["bulletListItem"])
|
|
703
|
-
}).use(
|
|
1101
|
+
}).use(zt).processSync(Xt(o, e)).value, e.exportBlocks = (o) => {
|
|
704
1102
|
const r = o.map(
|
|
705
|
-
(s) =>
|
|
1103
|
+
(s) => H(s, n, t.schema.styleSchema)
|
|
706
1104
|
), i = n.nodes.blockGroup.create(null, r);
|
|
707
1105
|
return e.exportProseMirrorFragment(T.from(i));
|
|
708
1106
|
}, e;
|
|
709
|
-
},
|
|
1107
|
+
}, Yt = (n, t) => {
|
|
710
1108
|
const e = bt.fromSchema(n);
|
|
711
|
-
return e.serializeNodeInner = (o, r) =>
|
|
1109
|
+
return e.serializeNodeInner = (o, r) => Jt(o, r, e, t, !1), e.serializeProseMirrorFragment = (o) => Xt(o, e), e.serializeBlocks = (o) => {
|
|
712
1110
|
const r = o.map(
|
|
713
|
-
(s) =>
|
|
1111
|
+
(s) => H(s, n, t.schema.styleSchema)
|
|
714
1112
|
), i = n.nodes.blockGroup.create(null, r);
|
|
715
1113
|
return e.serializeProseMirrorFragment(T.from(i));
|
|
716
1114
|
}, e;
|
|
717
|
-
},
|
|
1115
|
+
}, Ur = async (n) => {
|
|
718
1116
|
const t = new FormData();
|
|
719
1117
|
return t.append("file", n), (await (await fetch("https://tmpfiles.org/api/v1/upload", {
|
|
720
1118
|
method: "POST",
|
|
@@ -723,24 +1121,24 @@ const lt = (n, t) => {
|
|
|
723
1121
|
"tmpfiles.org/",
|
|
724
1122
|
"tmpfiles.org/dl/"
|
|
725
1123
|
);
|
|
726
|
-
},
|
|
727
|
-
function F(n) {
|
|
728
|
-
return
|
|
1124
|
+
}, dn = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
|
|
1125
|
+
function F(n, t = "Ctrl") {
|
|
1126
|
+
return dn() ? n.replace("Mod", "⌘") : n.replace("Mod", t);
|
|
729
1127
|
}
|
|
730
|
-
function
|
|
1128
|
+
function V(...n) {
|
|
731
1129
|
return n.filter((t) => t).join(" ");
|
|
732
1130
|
}
|
|
733
|
-
const
|
|
1131
|
+
const Rr = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
734
1132
|
function tt(n, t, e, o) {
|
|
735
1133
|
const r = document.createElement("div");
|
|
736
|
-
r.className =
|
|
1134
|
+
r.className = V(
|
|
737
1135
|
"bn-block-content",
|
|
738
1136
|
e.class
|
|
739
1137
|
), r.setAttribute("data-content-type", n);
|
|
740
1138
|
for (const [s, a] of Object.entries(e))
|
|
741
1139
|
s !== "class" && r.setAttribute(s, a);
|
|
742
1140
|
const i = document.createElement(t);
|
|
743
|
-
i.className =
|
|
1141
|
+
i.className = V(
|
|
744
1142
|
"bn-inline-content",
|
|
745
1143
|
o.class
|
|
746
1144
|
);
|
|
@@ -754,7 +1152,7 @@ function tt(n, t, e, o) {
|
|
|
754
1152
|
};
|
|
755
1153
|
}
|
|
756
1154
|
const At = (n, t) => {
|
|
757
|
-
const e =
|
|
1155
|
+
const e = H(
|
|
758
1156
|
n,
|
|
759
1157
|
t._tiptapEditor.schema,
|
|
760
1158
|
t.schema.styleSchema
|
|
@@ -780,13 +1178,13 @@ const At = (n, t) => {
|
|
|
780
1178
|
default: "left",
|
|
781
1179
|
values: ["left", "center", "right", "justify"]
|
|
782
1180
|
}
|
|
783
|
-
},
|
|
1181
|
+
}, Qt = ["backgroundColor", "textColor"];
|
|
784
1182
|
function st(n) {
|
|
785
1183
|
return "data-" + n.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
786
1184
|
}
|
|
787
|
-
function
|
|
1185
|
+
function Zt(n) {
|
|
788
1186
|
const t = {};
|
|
789
|
-
return Object.entries(n).filter(([e, o]) => !
|
|
1187
|
+
return Object.entries(n).filter(([e, o]) => !Qt.includes(e)).forEach(([e, o]) => {
|
|
790
1188
|
t[e] = {
|
|
791
1189
|
default: o.default,
|
|
792
1190
|
keepOnSplit: !0,
|
|
@@ -811,7 +1209,7 @@ function Qt(n) {
|
|
|
811
1209
|
};
|
|
812
1210
|
}), t;
|
|
813
1211
|
}
|
|
814
|
-
function
|
|
1212
|
+
function un(n, t, e, o) {
|
|
815
1213
|
if (typeof n == "boolean")
|
|
816
1214
|
throw new Error(
|
|
817
1215
|
"Cannot find node position as getPos is a boolean, not a function."
|
|
@@ -826,13 +1224,13 @@ function pt(n, t, e, o, r) {
|
|
|
826
1224
|
if (r !== void 0)
|
|
827
1225
|
for (const [s, a] of Object.entries(r))
|
|
828
1226
|
s !== "class" && i.setAttribute(s, a);
|
|
829
|
-
i.className =
|
|
1227
|
+
i.className = V(
|
|
830
1228
|
"bn-block-content",
|
|
831
1229
|
(r == null ? void 0 : r.class) || ""
|
|
832
1230
|
), i.setAttribute("data-content-type", t);
|
|
833
1231
|
for (const [s, a] of Object.entries(e))
|
|
834
|
-
!
|
|
835
|
-
return i.appendChild(n.dom), n.contentDOM !== void 0 && (n.contentDOM.className =
|
|
1232
|
+
!Qt.includes(s) && a !== o[s].default && i.setAttribute(st(s), a);
|
|
1233
|
+
return i.appendChild(n.dom), n.contentDOM !== void 0 && (n.contentDOM.className = V(
|
|
836
1234
|
"bn-inline-content",
|
|
837
1235
|
n.contentDOM.className
|
|
838
1236
|
), n.contentDOM.setAttribute("data-editable", "")), {
|
|
@@ -841,16 +1239,16 @@ function pt(n, t, e, o, r) {
|
|
|
841
1239
|
};
|
|
842
1240
|
}
|
|
843
1241
|
function q(n) {
|
|
844
|
-
return
|
|
1242
|
+
return K.create(n);
|
|
845
1243
|
}
|
|
846
|
-
function
|
|
1244
|
+
function te(n, t) {
|
|
847
1245
|
return {
|
|
848
1246
|
config: n,
|
|
849
1247
|
implementation: t
|
|
850
1248
|
};
|
|
851
1249
|
}
|
|
852
1250
|
function et(n, t, e) {
|
|
853
|
-
return
|
|
1251
|
+
return te(
|
|
854
1252
|
{
|
|
855
1253
|
type: n.name,
|
|
856
1254
|
content: n.config.content === "inline*" ? "inline" : n.config.content === "tableRow+" ? "table" : "none",
|
|
@@ -865,12 +1263,12 @@ function et(n, t, e) {
|
|
|
865
1263
|
}
|
|
866
1264
|
);
|
|
867
1265
|
}
|
|
868
|
-
function
|
|
1266
|
+
function ee(n) {
|
|
869
1267
|
return Object.fromEntries(
|
|
870
1268
|
Object.entries(n).map(([t, e]) => [t, e.config])
|
|
871
1269
|
);
|
|
872
1270
|
}
|
|
873
|
-
function
|
|
1271
|
+
function pn(n, t) {
|
|
874
1272
|
const e = [
|
|
875
1273
|
{
|
|
876
1274
|
tag: "[data-content-type=" + n.type + "]",
|
|
@@ -887,17 +1285,17 @@ function dn(n, t) {
|
|
|
887
1285
|
}
|
|
888
1286
|
}), e;
|
|
889
1287
|
}
|
|
890
|
-
function
|
|
1288
|
+
function hn(n, t) {
|
|
891
1289
|
const e = q({
|
|
892
1290
|
name: n.type,
|
|
893
1291
|
content: n.content === "inline" ? "inline*" : "",
|
|
894
1292
|
group: "blockContent",
|
|
895
1293
|
selectable: !0,
|
|
896
1294
|
addAttributes() {
|
|
897
|
-
return
|
|
1295
|
+
return Zt(n.propSchema);
|
|
898
1296
|
},
|
|
899
1297
|
parseHTML() {
|
|
900
|
-
return
|
|
1298
|
+
return pn(n, t.parse);
|
|
901
1299
|
},
|
|
902
1300
|
renderHTML() {
|
|
903
1301
|
const o = document.createElement("div");
|
|
@@ -908,7 +1306,7 @@ function un(n, t) {
|
|
|
908
1306
|
addNodeView() {
|
|
909
1307
|
return ({ getPos: o }) => {
|
|
910
1308
|
var l;
|
|
911
|
-
const r = this.options.editor, i =
|
|
1309
|
+
const r = this.options.editor, i = un(
|
|
912
1310
|
o,
|
|
913
1311
|
r,
|
|
914
1312
|
this.editor,
|
|
@@ -928,7 +1326,7 @@ function un(n, t) {
|
|
|
928
1326
|
throw new Error(
|
|
929
1327
|
"Node name does not match block type. This is a bug in BlockNote."
|
|
930
1328
|
);
|
|
931
|
-
return
|
|
1329
|
+
return te(n, {
|
|
932
1330
|
node: e,
|
|
933
1331
|
toInternalHTML: (o, r) => {
|
|
934
1332
|
var a;
|
|
@@ -959,10 +1357,10 @@ function un(n, t) {
|
|
|
959
1357
|
}
|
|
960
1358
|
});
|
|
961
1359
|
}
|
|
962
|
-
function
|
|
1360
|
+
function mn(n, t, e, o) {
|
|
963
1361
|
return n.dom.setAttribute("data-inline-content-type", t), Object.entries(e).filter(([r, i]) => i !== o[r].default).map(([r, i]) => [st(r), i]).forEach(([r, i]) => n.dom.setAttribute(r, i)), n.contentDOM !== void 0 && n.contentDOM.setAttribute("data-editable", ""), n;
|
|
964
1362
|
}
|
|
965
|
-
function
|
|
1363
|
+
function fn(n) {
|
|
966
1364
|
return {
|
|
967
1365
|
Backspace: ({ editor: t }) => {
|
|
968
1366
|
const e = t.state.selection.$from;
|
|
@@ -970,14 +1368,14 @@ function hn(n) {
|
|
|
970
1368
|
}
|
|
971
1369
|
};
|
|
972
1370
|
}
|
|
973
|
-
function
|
|
1371
|
+
function gn(n, t) {
|
|
974
1372
|
return {
|
|
975
1373
|
config: n,
|
|
976
1374
|
implementation: t
|
|
977
1375
|
};
|
|
978
1376
|
}
|
|
979
|
-
function
|
|
980
|
-
return
|
|
1377
|
+
function bn(n, t) {
|
|
1378
|
+
return gn(
|
|
981
1379
|
{
|
|
982
1380
|
type: n.name,
|
|
983
1381
|
propSchema: t,
|
|
@@ -988,12 +1386,12 @@ function fn(n, t) {
|
|
|
988
1386
|
}
|
|
989
1387
|
);
|
|
990
1388
|
}
|
|
991
|
-
function
|
|
1389
|
+
function ne(n) {
|
|
992
1390
|
return Object.fromEntries(
|
|
993
1391
|
Object.entries(n).map(([t, e]) => [t, e.config])
|
|
994
1392
|
);
|
|
995
1393
|
}
|
|
996
|
-
function
|
|
1394
|
+
function kn(n) {
|
|
997
1395
|
return [
|
|
998
1396
|
{
|
|
999
1397
|
tag: `[data-inline-content-type="${n.type}"]`,
|
|
@@ -1004,8 +1402,8 @@ function gn(n) {
|
|
|
1004
1402
|
}
|
|
1005
1403
|
];
|
|
1006
1404
|
}
|
|
1007
|
-
function
|
|
1008
|
-
const e =
|
|
1405
|
+
function Vr(n, t) {
|
|
1406
|
+
const e = K.create({
|
|
1009
1407
|
name: n.type,
|
|
1010
1408
|
inline: !0,
|
|
1011
1409
|
group: "inline",
|
|
@@ -1013,24 +1411,24 @@ function Or(n, t) {
|
|
|
1013
1411
|
atom: n.content === "none",
|
|
1014
1412
|
content: n.content === "styled" ? "inline*" : "",
|
|
1015
1413
|
addAttributes() {
|
|
1016
|
-
return
|
|
1414
|
+
return Zt(n.propSchema);
|
|
1017
1415
|
},
|
|
1018
1416
|
addKeyboardShortcuts() {
|
|
1019
|
-
return
|
|
1417
|
+
return fn(n);
|
|
1020
1418
|
},
|
|
1021
1419
|
parseHTML() {
|
|
1022
|
-
return
|
|
1420
|
+
return kn(n);
|
|
1023
1421
|
},
|
|
1024
1422
|
renderHTML({ node: o }) {
|
|
1025
1423
|
const r = this.options.editor, i = t.render(
|
|
1026
|
-
|
|
1424
|
+
Wt(
|
|
1027
1425
|
o,
|
|
1028
1426
|
r.schema.inlineContentSchema,
|
|
1029
1427
|
r.schema.styleSchema
|
|
1030
1428
|
)
|
|
1031
1429
|
// TODO: fix cast
|
|
1032
1430
|
);
|
|
1033
|
-
return
|
|
1431
|
+
return mn(
|
|
1034
1432
|
i,
|
|
1035
1433
|
n.type,
|
|
1036
1434
|
o.attrs,
|
|
@@ -1038,12 +1436,12 @@ function Or(n, t) {
|
|
|
1038
1436
|
);
|
|
1039
1437
|
}
|
|
1040
1438
|
});
|
|
1041
|
-
return
|
|
1439
|
+
return bn(
|
|
1042
1440
|
e,
|
|
1043
1441
|
n.propSchema
|
|
1044
1442
|
);
|
|
1045
1443
|
}
|
|
1046
|
-
function
|
|
1444
|
+
function yn(n) {
|
|
1047
1445
|
return n === "boolean" ? {} : {
|
|
1048
1446
|
stringValue: {
|
|
1049
1447
|
default: void 0,
|
|
@@ -1055,17 +1453,17 @@ function bn(n) {
|
|
|
1055
1453
|
}
|
|
1056
1454
|
};
|
|
1057
1455
|
}
|
|
1058
|
-
function
|
|
1456
|
+
function wn(n, t, e, o) {
|
|
1059
1457
|
return n.dom.setAttribute("data-style-type", t), o === "string" && n.dom.setAttribute("data-value", e), n.contentDOM !== void 0 && n.contentDOM.setAttribute("data-editable", ""), n;
|
|
1060
1458
|
}
|
|
1061
|
-
function
|
|
1459
|
+
function oe(n, t) {
|
|
1062
1460
|
return {
|
|
1063
1461
|
config: n,
|
|
1064
1462
|
implementation: t
|
|
1065
1463
|
};
|
|
1066
1464
|
}
|
|
1067
|
-
function
|
|
1068
|
-
return
|
|
1465
|
+
function O(n, t) {
|
|
1466
|
+
return oe(
|
|
1069
1467
|
{
|
|
1070
1468
|
type: n.name,
|
|
1071
1469
|
propSchema: t
|
|
@@ -1075,12 +1473,12 @@ function _(n, t) {
|
|
|
1075
1473
|
}
|
|
1076
1474
|
);
|
|
1077
1475
|
}
|
|
1078
|
-
function
|
|
1476
|
+
function re(n) {
|
|
1079
1477
|
return Object.fromEntries(
|
|
1080
1478
|
Object.entries(n).map(([t, e]) => [t, e.config])
|
|
1081
1479
|
);
|
|
1082
1480
|
}
|
|
1083
|
-
function
|
|
1481
|
+
function vn(n) {
|
|
1084
1482
|
return [
|
|
1085
1483
|
{
|
|
1086
1484
|
tag: `[data-style-type="${n.type}"]`,
|
|
@@ -1091,14 +1489,14 @@ function yn(n) {
|
|
|
1091
1489
|
}
|
|
1092
1490
|
];
|
|
1093
1491
|
}
|
|
1094
|
-
function
|
|
1492
|
+
function zr(n, t) {
|
|
1095
1493
|
const e = yt.create({
|
|
1096
1494
|
name: n.type,
|
|
1097
1495
|
addAttributes() {
|
|
1098
|
-
return
|
|
1496
|
+
return yn(n.propSchema);
|
|
1099
1497
|
},
|
|
1100
1498
|
parseHTML() {
|
|
1101
|
-
return
|
|
1499
|
+
return vn(n);
|
|
1102
1500
|
},
|
|
1103
1501
|
renderHTML({ mark: o }) {
|
|
1104
1502
|
let r;
|
|
@@ -1108,7 +1506,7 @@ function _r(n, t) {
|
|
|
1108
1506
|
r = t.render(o.attrs.stringValue);
|
|
1109
1507
|
else
|
|
1110
1508
|
throw new A(n.propSchema);
|
|
1111
|
-
return
|
|
1509
|
+
return wn(
|
|
1112
1510
|
r,
|
|
1113
1511
|
n.type,
|
|
1114
1512
|
o.attrs.stringValue,
|
|
@@ -1116,11 +1514,11 @@ function _r(n, t) {
|
|
|
1116
1514
|
);
|
|
1117
1515
|
}
|
|
1118
1516
|
});
|
|
1119
|
-
return
|
|
1517
|
+
return oe(n, {
|
|
1120
1518
|
mark: e
|
|
1121
1519
|
});
|
|
1122
1520
|
}
|
|
1123
|
-
const
|
|
1521
|
+
const En = yt.create({
|
|
1124
1522
|
name: "backgroundColor",
|
|
1125
1523
|
addAttributes() {
|
|
1126
1524
|
return {
|
|
@@ -1146,10 +1544,10 @@ const wn = yt.create({
|
|
|
1146
1544
|
renderHTML({ HTMLAttributes: n }) {
|
|
1147
1545
|
return ["span", n, 0];
|
|
1148
1546
|
}
|
|
1149
|
-
}),
|
|
1150
|
-
|
|
1547
|
+
}), Sn = O(
|
|
1548
|
+
En,
|
|
1151
1549
|
"string"
|
|
1152
|
-
),
|
|
1550
|
+
), Cn = yt.create({
|
|
1153
1551
|
name: "textColor",
|
|
1154
1552
|
addAttributes() {
|
|
1155
1553
|
return {
|
|
@@ -1173,16 +1571,16 @@ const wn = yt.create({
|
|
|
1173
1571
|
renderHTML({ HTMLAttributes: n }) {
|
|
1174
1572
|
return ["span", n, 0];
|
|
1175
1573
|
}
|
|
1176
|
-
}),
|
|
1574
|
+
}), xn = O(Cn, "string"), _ = (n) => {
|
|
1177
1575
|
const { contentType: t } = b(
|
|
1178
1576
|
n.state.doc,
|
|
1179
1577
|
n.state.selection.from
|
|
1180
1578
|
);
|
|
1181
1579
|
return t.spec.content;
|
|
1182
|
-
},
|
|
1580
|
+
}, Tn = {
|
|
1183
1581
|
...w,
|
|
1184
1582
|
level: { default: 1, values: [1, 2, 3] }
|
|
1185
|
-
},
|
|
1583
|
+
}, Mn = q({
|
|
1186
1584
|
name: "heading",
|
|
1187
1585
|
content: "inline*",
|
|
1188
1586
|
group: "blockContent",
|
|
@@ -1207,7 +1605,7 @@ const wn = yt.create({
|
|
|
1207
1605
|
...[1, 2, 3].map((n) => new wt({
|
|
1208
1606
|
find: new RegExp(`^(#{${n}})\\s$`),
|
|
1209
1607
|
handler: ({ state: t, chain: e, range: o }) => {
|
|
1210
|
-
|
|
1608
|
+
_(this.editor) === "inline*" && e().BNUpdateBlock(t.selection.from, {
|
|
1211
1609
|
type: "heading",
|
|
1212
1610
|
props: {
|
|
1213
1611
|
level: n
|
|
@@ -1219,7 +1617,7 @@ const wn = yt.create({
|
|
|
1219
1617
|
},
|
|
1220
1618
|
addKeyboardShortcuts() {
|
|
1221
1619
|
return {
|
|
1222
|
-
"Mod-Alt-1": () =>
|
|
1620
|
+
"Mod-Alt-1": () => _(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
1223
1621
|
this.editor.state.selection.anchor,
|
|
1224
1622
|
{
|
|
1225
1623
|
type: "heading",
|
|
@@ -1228,7 +1626,7 @@ const wn = yt.create({
|
|
|
1228
1626
|
}
|
|
1229
1627
|
}
|
|
1230
1628
|
),
|
|
1231
|
-
"Mod-Alt-2": () =>
|
|
1629
|
+
"Mod-Alt-2": () => _(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
1232
1630
|
this.editor.state.selection.anchor,
|
|
1233
1631
|
{
|
|
1234
1632
|
type: "heading",
|
|
@@ -1237,7 +1635,7 @@ const wn = yt.create({
|
|
|
1237
1635
|
}
|
|
1238
1636
|
}
|
|
1239
1637
|
),
|
|
1240
|
-
"Mod-Alt-3": () =>
|
|
1638
|
+
"Mod-Alt-3": () => _(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
1241
1639
|
this.editor.state.selection.anchor,
|
|
1242
1640
|
{
|
|
1243
1641
|
type: "heading",
|
|
@@ -1285,10 +1683,10 @@ const wn = yt.create({
|
|
|
1285
1683
|
((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
|
|
1286
1684
|
);
|
|
1287
1685
|
}
|
|
1288
|
-
}),
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
),
|
|
1686
|
+
}), Bn = et(
|
|
1687
|
+
Mn,
|
|
1688
|
+
Tn
|
|
1689
|
+
), Ln = {
|
|
1292
1690
|
textAlignment: w.textAlignment,
|
|
1293
1691
|
backgroundColor: w.backgroundColor,
|
|
1294
1692
|
// Image url.
|
|
@@ -1303,7 +1701,7 @@ const wn = yt.create({
|
|
|
1303
1701
|
width: {
|
|
1304
1702
|
default: 512
|
|
1305
1703
|
}
|
|
1306
|
-
},
|
|
1704
|
+
}, Nt = (n) => {
|
|
1307
1705
|
switch (n) {
|
|
1308
1706
|
case "left":
|
|
1309
1707
|
return "flex-start";
|
|
@@ -1314,9 +1712,9 @@ const wn = yt.create({
|
|
|
1314
1712
|
default:
|
|
1315
1713
|
return "flex-start";
|
|
1316
1714
|
}
|
|
1317
|
-
},
|
|
1715
|
+
}, Pt = 64, In = (n, t) => {
|
|
1318
1716
|
const e = document.createElement("div");
|
|
1319
|
-
e.className = "bn-image-block-content-wrapper", e.style.alignItems =
|
|
1717
|
+
e.className = "bn-image-block-content-wrapper", e.style.alignItems = Nt(
|
|
1320
1718
|
n.props.textAlignment
|
|
1321
1719
|
);
|
|
1322
1720
|
const o = document.createElement("div");
|
|
@@ -1324,7 +1722,7 @@ const wn = yt.create({
|
|
|
1324
1722
|
const r = document.createElement("div");
|
|
1325
1723
|
r.className = "bn-add-image-button-icon";
|
|
1326
1724
|
const i = document.createElement("p");
|
|
1327
|
-
i.className = "bn-add-image-button-text", i.innerText =
|
|
1725
|
+
i.className = "bn-add-image-button-text", i.innerText = t.dictionary.image.add_button;
|
|
1328
1726
|
const s = document.createElement("div");
|
|
1329
1727
|
s.className = "bn-image-and-caption-wrapper";
|
|
1330
1728
|
const a = document.createElement("div");
|
|
@@ -1355,7 +1753,7 @@ const wn = yt.create({
|
|
|
1355
1753
|
return;
|
|
1356
1754
|
}
|
|
1357
1755
|
let L;
|
|
1358
|
-
|
|
1756
|
+
Nt(n.props.textAlignment) === "center" ? h.handleUsed === "left" ? L = h.initialWidth + (h.initialClientX - g.clientX) * 2 : L = h.initialWidth + (g.clientX - h.initialClientX) * 2 : h.handleUsed === "left" ? L = h.initialWidth + h.initialClientX - g.clientX : L = h.initialWidth + g.clientX - h.initialClientX, L < Pt ? l.style.width = `${Pt}px` : L > t.domElement.firstElementChild.clientWidth ? l.style.width = `${t.domElement.firstElementChild.clientWidth}px` : l.style.width = `${L}px`;
|
|
1359
1757
|
}, k = (g) => {
|
|
1360
1758
|
(!g.target || !a.contains(g.target) || !t.isEditable) && a.contains(c) && a.contains(u) && (a.removeChild(c), a.removeChild(u)), h && (h = void 0, t.updateBlock(n, {
|
|
1361
1759
|
type: "image",
|
|
@@ -1374,9 +1772,9 @@ const wn = yt.create({
|
|
|
1374
1772
|
);
|
|
1375
1773
|
}, E = () => {
|
|
1376
1774
|
t.isEditable && (a.appendChild(c), a.appendChild(u));
|
|
1377
|
-
},
|
|
1775
|
+
}, D = (g) => {
|
|
1378
1776
|
g.relatedTarget === c || g.relatedTarget === u || h || t.isEditable && a.contains(c) && a.contains(u) && (a.removeChild(c), a.removeChild(u));
|
|
1379
|
-
},
|
|
1777
|
+
}, z = (g) => {
|
|
1380
1778
|
g.preventDefault(), a.appendChild(c), a.appendChild(u), h = {
|
|
1381
1779
|
handleUsed: "left",
|
|
1382
1780
|
initialWidth: n.props.width,
|
|
@@ -1389,9 +1787,9 @@ const wn = yt.create({
|
|
|
1389
1787
|
initialClientX: g.clientX
|
|
1390
1788
|
};
|
|
1391
1789
|
};
|
|
1392
|
-
return o.appendChild(r), o.appendChild(i), s.appendChild(a), a.appendChild(l), s.appendChild(p), n.props.url === "" ? e.appendChild(o) : e.appendChild(s), window.addEventListener("mousemove", f), window.addEventListener("mouseup", k), o.addEventListener("mousedown", S), o.addEventListener("click", B), l.addEventListener("mouseenter", E), l.addEventListener("mouseleave",
|
|
1790
|
+
return o.appendChild(r), o.appendChild(i), s.appendChild(a), a.appendChild(l), s.appendChild(p), n.props.url === "" ? e.appendChild(o) : e.appendChild(s), window.addEventListener("mousemove", f), window.addEventListener("mouseup", k), o.addEventListener("mousedown", S), o.addEventListener("click", B), l.addEventListener("mouseenter", E), l.addEventListener("mouseleave", D), c.addEventListener(
|
|
1393
1791
|
"mousedown",
|
|
1394
|
-
|
|
1792
|
+
z
|
|
1395
1793
|
), u.addEventListener(
|
|
1396
1794
|
"mousedown",
|
|
1397
1795
|
J
|
|
@@ -1403,21 +1801,21 @@ const wn = yt.create({
|
|
|
1403
1801
|
S
|
|
1404
1802
|
), o.removeEventListener("click", B), c.removeEventListener(
|
|
1405
1803
|
"mousedown",
|
|
1406
|
-
|
|
1804
|
+
z
|
|
1407
1805
|
), u.removeEventListener(
|
|
1408
1806
|
"mousedown",
|
|
1409
1807
|
J
|
|
1410
1808
|
);
|
|
1411
1809
|
}
|
|
1412
1810
|
};
|
|
1413
|
-
},
|
|
1811
|
+
}, _n = hn(
|
|
1414
1812
|
{
|
|
1415
1813
|
type: "image",
|
|
1416
|
-
propSchema:
|
|
1814
|
+
propSchema: Ln,
|
|
1417
1815
|
content: "none"
|
|
1418
1816
|
},
|
|
1419
1817
|
{
|
|
1420
|
-
render:
|
|
1818
|
+
render: In,
|
|
1421
1819
|
toExternalHTML: (n) => {
|
|
1422
1820
|
if (n.props.url === "") {
|
|
1423
1821
|
const o = document.createElement("p");
|
|
@@ -1467,7 +1865,7 @@ const wn = yt.create({
|
|
|
1467
1865
|
s.command(() => t.textContent.length > 0 ? (i().deleteSelection().BNSplitBlock(r.selection.from, !0).run(), !0) : !1)
|
|
1468
1866
|
)
|
|
1469
1867
|
]);
|
|
1470
|
-
},
|
|
1868
|
+
}, An = {
|
|
1471
1869
|
...w
|
|
1472
1870
|
}, Nn = q({
|
|
1473
1871
|
name: "bulletListItem",
|
|
@@ -1479,7 +1877,7 @@ const wn = yt.create({
|
|
|
1479
1877
|
new wt({
|
|
1480
1878
|
find: new RegExp("^[-+*]\\s$"),
|
|
1481
1879
|
handler: ({ state: n, chain: t, range: e }) => {
|
|
1482
|
-
|
|
1880
|
+
_(this.editor) === "inline*" && t().BNUpdateBlock(n.selection.from, {
|
|
1483
1881
|
type: "bulletListItem",
|
|
1484
1882
|
props: {}
|
|
1485
1883
|
}).deleteRange({ from: e.from, to: e.to });
|
|
@@ -1490,7 +1888,7 @@ const wn = yt.create({
|
|
|
1490
1888
|
addKeyboardShortcuts() {
|
|
1491
1889
|
return {
|
|
1492
1890
|
Enter: () => Et(this.editor),
|
|
1493
|
-
"Mod-Shift-8": () =>
|
|
1891
|
+
"Mod-Shift-8": () => _(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
1494
1892
|
this.editor.state.selection.anchor,
|
|
1495
1893
|
{
|
|
1496
1894
|
type: "bulletListItem",
|
|
@@ -1545,11 +1943,11 @@ const wn = yt.create({
|
|
|
1545
1943
|
((e = this.options.domAttributes) == null ? void 0 : e.inlineContent) || {}
|
|
1546
1944
|
);
|
|
1547
1945
|
}
|
|
1548
|
-
}),
|
|
1946
|
+
}), Pn = et(
|
|
1549
1947
|
Nn,
|
|
1550
|
-
|
|
1551
|
-
),
|
|
1552
|
-
key:
|
|
1948
|
+
An
|
|
1949
|
+
), Hn = new x("numbered-list-indexing"), Dn = () => new v({
|
|
1950
|
+
key: Hn,
|
|
1553
1951
|
appendTransaction: (n, t, e) => {
|
|
1554
1952
|
const o = e.tr;
|
|
1555
1953
|
o.setMeta("numberedListIndexing", !0);
|
|
@@ -1578,9 +1976,9 @@ const wn = yt.create({
|
|
|
1578
1976
|
}
|
|
1579
1977
|
}), r ? o : null;
|
|
1580
1978
|
}
|
|
1581
|
-
}),
|
|
1979
|
+
}), On = {
|
|
1582
1980
|
...w
|
|
1583
|
-
},
|
|
1981
|
+
}, Un = q({
|
|
1584
1982
|
name: "numberedListItem",
|
|
1585
1983
|
content: "inline*",
|
|
1586
1984
|
group: "blockContent",
|
|
@@ -1601,7 +1999,7 @@ const wn = yt.create({
|
|
|
1601
1999
|
new wt({
|
|
1602
2000
|
find: new RegExp("^1\\.\\s$"),
|
|
1603
2001
|
handler: ({ state: n, chain: t, range: e }) => {
|
|
1604
|
-
|
|
2002
|
+
_(this.editor) === "inline*" && t().BNUpdateBlock(n.selection.from, {
|
|
1605
2003
|
type: "numberedListItem",
|
|
1606
2004
|
props: {}
|
|
1607
2005
|
}).deleteRange({ from: e.from, to: e.to });
|
|
@@ -1612,7 +2010,7 @@ const wn = yt.create({
|
|
|
1612
2010
|
addKeyboardShortcuts() {
|
|
1613
2011
|
return {
|
|
1614
2012
|
Enter: () => Et(this.editor),
|
|
1615
|
-
"Mod-Shift-7": () =>
|
|
2013
|
+
"Mod-Shift-7": () => _(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
1616
2014
|
this.editor.state.selection.anchor,
|
|
1617
2015
|
{
|
|
1618
2016
|
type: "numberedListItem",
|
|
@@ -1622,7 +2020,7 @@ const wn = yt.create({
|
|
|
1622
2020
|
};
|
|
1623
2021
|
},
|
|
1624
2022
|
addProseMirrorPlugins() {
|
|
1625
|
-
return [
|
|
2023
|
+
return [Dn()];
|
|
1626
2024
|
},
|
|
1627
2025
|
parseHTML() {
|
|
1628
2026
|
return [
|
|
@@ -1672,19 +2070,19 @@ const wn = yt.create({
|
|
|
1672
2070
|
((e = this.options.domAttributes) == null ? void 0 : e.inlineContent) || {}
|
|
1673
2071
|
);
|
|
1674
2072
|
}
|
|
1675
|
-
}),
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
),
|
|
2073
|
+
}), Rn = et(
|
|
2074
|
+
Un,
|
|
2075
|
+
On
|
|
2076
|
+
), Vn = {
|
|
1679
2077
|
...w
|
|
1680
|
-
},
|
|
2078
|
+
}, zn = q({
|
|
1681
2079
|
name: "paragraph",
|
|
1682
2080
|
content: "inline*",
|
|
1683
2081
|
group: "blockContent",
|
|
1684
2082
|
addKeyboardShortcuts() {
|
|
1685
2083
|
return {
|
|
1686
2084
|
Enter: () => Et(this.editor),
|
|
1687
|
-
"Mod-Alt-0": () =>
|
|
2085
|
+
"Mod-Alt-0": () => _(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
1688
2086
|
this.editor.state.selection.anchor,
|
|
1689
2087
|
{
|
|
1690
2088
|
type: "paragraph",
|
|
@@ -1715,13 +2113,13 @@ const wn = yt.create({
|
|
|
1715
2113
|
((e = this.options.domAttributes) == null ? void 0 : e.inlineContent) || {}
|
|
1716
2114
|
);
|
|
1717
2115
|
}
|
|
1718
|
-
}),
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
),
|
|
2116
|
+
}), Fn = et(
|
|
2117
|
+
zn,
|
|
2118
|
+
Vn
|
|
2119
|
+
), jn = M.create({
|
|
1722
2120
|
name: "BlockNoteTableExtension",
|
|
1723
2121
|
addProseMirrorPlugins: () => [
|
|
1724
|
-
|
|
2122
|
+
Ve({
|
|
1725
2123
|
cellMinWidth: 100
|
|
1726
2124
|
}),
|
|
1727
2125
|
ze()
|
|
@@ -1745,12 +2143,12 @@ const wn = yt.create({
|
|
|
1745
2143
|
storage: n.storage
|
|
1746
2144
|
};
|
|
1747
2145
|
return {
|
|
1748
|
-
tableRole:
|
|
1749
|
-
|
|
2146
|
+
tableRole: Ee(
|
|
2147
|
+
Se(n, "tableRole", t)
|
|
1750
2148
|
)
|
|
1751
2149
|
};
|
|
1752
2150
|
}
|
|
1753
|
-
}),
|
|
2151
|
+
}), Gn = {
|
|
1754
2152
|
...w
|
|
1755
2153
|
}, $n = q({
|
|
1756
2154
|
name: "table",
|
|
@@ -1773,7 +2171,7 @@ const wn = yt.create({
|
|
|
1773
2171
|
((e = this.options.domAttributes) == null ? void 0 : e.inlineContent) || {}
|
|
1774
2172
|
);
|
|
1775
2173
|
}
|
|
1776
|
-
}),
|
|
2174
|
+
}), Kn = K.create({
|
|
1777
2175
|
name: "tableParagraph",
|
|
1778
2176
|
group: "tableContent",
|
|
1779
2177
|
content: "inline*",
|
|
@@ -1783,56 +2181,56 @@ const wn = yt.create({
|
|
|
1783
2181
|
renderHTML({ HTMLAttributes: n }) {
|
|
1784
2182
|
return [
|
|
1785
2183
|
"p",
|
|
1786
|
-
|
|
2184
|
+
Ce(this.options.HTMLAttributes, n),
|
|
1787
2185
|
0
|
|
1788
2186
|
];
|
|
1789
2187
|
}
|
|
1790
|
-
}),
|
|
2188
|
+
}), qn = et(
|
|
1791
2189
|
$n,
|
|
1792
|
-
|
|
2190
|
+
Gn,
|
|
1793
2191
|
[
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
2192
|
+
jn,
|
|
2193
|
+
Kn,
|
|
2194
|
+
Ue.extend({
|
|
1797
2195
|
content: "tableContent"
|
|
1798
2196
|
}),
|
|
1799
2197
|
Oe.extend({
|
|
1800
2198
|
content: "tableContent"
|
|
1801
2199
|
}),
|
|
1802
|
-
|
|
2200
|
+
Re
|
|
1803
2201
|
]
|
|
1804
|
-
),
|
|
1805
|
-
paragraph:
|
|
1806
|
-
heading:
|
|
1807
|
-
bulletListItem:
|
|
1808
|
-
numberedListItem:
|
|
1809
|
-
image:
|
|
1810
|
-
table:
|
|
1811
|
-
}, Wn =
|
|
1812
|
-
bold:
|
|
1813
|
-
italic:
|
|
1814
|
-
underline:
|
|
1815
|
-
strike:
|
|
1816
|
-
code:
|
|
1817
|
-
textColor:
|
|
1818
|
-
backgroundColor:
|
|
1819
|
-
},
|
|
2202
|
+
), ie = {
|
|
2203
|
+
paragraph: Fn,
|
|
2204
|
+
heading: Bn,
|
|
2205
|
+
bulletListItem: Pn,
|
|
2206
|
+
numberedListItem: Rn,
|
|
2207
|
+
image: _n,
|
|
2208
|
+
table: qn
|
|
2209
|
+
}, Wn = ee(ie), se = {
|
|
2210
|
+
bold: O(Ae, "boolean"),
|
|
2211
|
+
italic: O(Pe, "boolean"),
|
|
2212
|
+
underline: O(De, "boolean"),
|
|
2213
|
+
strike: O(He, "boolean"),
|
|
2214
|
+
code: O(Ne, "boolean"),
|
|
2215
|
+
textColor: xn,
|
|
2216
|
+
backgroundColor: Sn
|
|
2217
|
+
}, Fr = re(se), ae = {
|
|
1820
2218
|
text: { config: "text", implementation: {} },
|
|
1821
2219
|
link: { config: "link", implementation: {} }
|
|
1822
|
-
},
|
|
1823
|
-
|
|
2220
|
+
}, jr = ne(
|
|
2221
|
+
ae
|
|
1824
2222
|
);
|
|
1825
2223
|
function I(n, t) {
|
|
1826
2224
|
return n in t.schema.blockSchema && t.schema.blockSchema[n] === Wn[n];
|
|
1827
2225
|
}
|
|
1828
|
-
function
|
|
2226
|
+
function Gr(n, t, e) {
|
|
1829
2227
|
return t.type === n && t.type in e.schema.blockSchema && I(t.type, e);
|
|
1830
2228
|
}
|
|
1831
|
-
function
|
|
2229
|
+
function Jn(n, t, e) {
|
|
1832
2230
|
return t in e.schema.blockSchema && n in e.schema.blockSchema[t].propSchema && e.schema.blockSchema[t].propSchema[n] === w[n];
|
|
1833
2231
|
}
|
|
1834
|
-
function
|
|
1835
|
-
return
|
|
2232
|
+
function $r(n, t, e) {
|
|
2233
|
+
return Jn(n, t.type, e);
|
|
1836
2234
|
}
|
|
1837
2235
|
function St(n, t) {
|
|
1838
2236
|
let e, o;
|
|
@@ -1843,11 +2241,11 @@ function St(n, t) {
|
|
|
1843
2241
|
posBeforeNode: o
|
|
1844
2242
|
};
|
|
1845
2243
|
}
|
|
1846
|
-
function
|
|
2244
|
+
function Xn(n, t, e = "before", o) {
|
|
1847
2245
|
const r = o._tiptapEditor, i = typeof t == "string" ? t : t.id, s = [];
|
|
1848
2246
|
for (const u of n)
|
|
1849
2247
|
s.push(
|
|
1850
|
-
|
|
2248
|
+
H(u, r.schema, o.schema.styleSchema)
|
|
1851
2249
|
);
|
|
1852
2250
|
const { node: a, posBeforeNode: l } = St(i, r.state.doc);
|
|
1853
2251
|
if (e === "before" && r.view.dispatch(
|
|
@@ -1879,7 +2277,7 @@ function Kn(n, t, e = "before", o) {
|
|
|
1879
2277
|
);
|
|
1880
2278
|
return c;
|
|
1881
2279
|
}
|
|
1882
|
-
function
|
|
2280
|
+
function Yn(n, t, e) {
|
|
1883
2281
|
const o = e._tiptapEditor, r = typeof n == "string" ? n : n.id, { posBeforeNode: i } = St(r, o.state.doc);
|
|
1884
2282
|
o.commands.BNUpdateBlock(i + 1, t);
|
|
1885
2283
|
const s = o.state.doc.resolve(i + 1).node();
|
|
@@ -1891,7 +2289,7 @@ function Jn(n, t, e) {
|
|
|
1891
2289
|
e.blockCache
|
|
1892
2290
|
);
|
|
1893
2291
|
}
|
|
1894
|
-
function
|
|
2292
|
+
function le(n, t, e) {
|
|
1895
2293
|
const o = t._tiptapEditor, r = o.state.tr, i = new Set(
|
|
1896
2294
|
n.map(
|
|
1897
2295
|
(l) => typeof l == "string" ? l : l.id
|
|
@@ -1925,16 +2323,16 @@ function ae(n, t, e) {
|
|
|
1925
2323
|
}
|
|
1926
2324
|
return o.view.dispatch(r), s;
|
|
1927
2325
|
}
|
|
1928
|
-
function
|
|
1929
|
-
return
|
|
2326
|
+
function Qn(n, t) {
|
|
2327
|
+
return le(n, t);
|
|
1930
2328
|
}
|
|
1931
|
-
function
|
|
2329
|
+
function Zn(n, t, e) {
|
|
1932
2330
|
const o = e._tiptapEditor, r = [];
|
|
1933
2331
|
for (const l of t)
|
|
1934
2332
|
r.push(
|
|
1935
|
-
|
|
2333
|
+
H(l, o.schema, e.schema.styleSchema)
|
|
1936
2334
|
);
|
|
1937
|
-
const i = typeof n[0] == "string" ? n[0] : n[0].id, s =
|
|
2335
|
+
const i = typeof n[0] == "string" ? n[0] : n[0].id, s = le(
|
|
1938
2336
|
n,
|
|
1939
2337
|
e,
|
|
1940
2338
|
(l, c, u, p) => {
|
|
@@ -1959,7 +2357,7 @@ function Yn(n, t, e) {
|
|
|
1959
2357
|
);
|
|
1960
2358
|
return { insertedBlocks: a, removedBlocks: s };
|
|
1961
2359
|
}
|
|
1962
|
-
function
|
|
2360
|
+
function to(n, t, e, o = { updateSelection: !0 }) {
|
|
1963
2361
|
const r = e._tiptapEditor, i = r.state.tr;
|
|
1964
2362
|
let { from: s, to: a } = typeof n == "number" ? { from: n, to: n } : { from: n.from, to: n.to }, l = !0, c = !0, u = "";
|
|
1965
2363
|
if (t.forEach((p) => {
|
|
@@ -1968,9 +2366,9 @@ function Qn(n, t, e, o = { updateSelection: !0 }) {
|
|
|
1968
2366
|
const { parent: p } = i.doc.resolve(s);
|
|
1969
2367
|
p.isTextblock && !p.type.spec.code && !p.childCount && (s -= 1, a += 1);
|
|
1970
2368
|
}
|
|
1971
|
-
return l ? i.insertText(u, s, a) : i.replaceWith(s, a, t), o.updateSelection &&
|
|
2369
|
+
return l ? i.insertText(u, s, a) : i.replaceWith(s, a, t), o.updateSelection && xe(i, i.steps.length - 1, -1), r.view.dispatch(i), !0;
|
|
1972
2370
|
}
|
|
1973
|
-
function
|
|
2371
|
+
function eo() {
|
|
1974
2372
|
const n = (t) => {
|
|
1975
2373
|
let e = t.children.length;
|
|
1976
2374
|
for (let o = 0; o < e; o++) {
|
|
@@ -1987,34 +2385,34 @@ function Zn() {
|
|
|
1987
2385
|
return n;
|
|
1988
2386
|
}
|
|
1989
2387
|
function Ct(n) {
|
|
1990
|
-
return kt().use(
|
|
2388
|
+
return kt().use(Vt, { fragment: !0 }).use(eo).use(Fe).use(Ft).use(je).processSync(n).value;
|
|
1991
2389
|
}
|
|
1992
|
-
function
|
|
2390
|
+
function no(n, t, e) {
|
|
1993
2391
|
const r = lt(t, e).exportBlocks(n);
|
|
1994
2392
|
return Ct(r);
|
|
1995
2393
|
}
|
|
1996
|
-
function
|
|
2394
|
+
function oo(n) {
|
|
1997
2395
|
return Array.prototype.indexOf.call(n.parentElement.childNodes, n);
|
|
1998
2396
|
}
|
|
1999
|
-
function
|
|
2397
|
+
function ro(n) {
|
|
2000
2398
|
return n.nodeType === 3 && !/\S/.test(n.nodeValue || "");
|
|
2001
2399
|
}
|
|
2002
|
-
function
|
|
2400
|
+
function io(n) {
|
|
2003
2401
|
n.querySelectorAll("li > ul, li > ol").forEach((t) => {
|
|
2004
|
-
const e =
|
|
2402
|
+
const e = oo(t), o = t.parentElement, r = Array.from(o.childNodes).slice(
|
|
2005
2403
|
e + 1
|
|
2006
2404
|
);
|
|
2007
2405
|
t.remove(), r.forEach((i) => {
|
|
2008
2406
|
i.remove();
|
|
2009
2407
|
}), o.insertAdjacentElement("afterend", t), r.reverse().forEach((i) => {
|
|
2010
|
-
if (
|
|
2408
|
+
if (ro(i))
|
|
2011
2409
|
return;
|
|
2012
2410
|
const s = document.createElement("li");
|
|
2013
2411
|
s.append(i), t.insertAdjacentElement("afterend", s);
|
|
2014
2412
|
}), o.childNodes.length === 0 && o.remove();
|
|
2015
2413
|
});
|
|
2016
2414
|
}
|
|
2017
|
-
function
|
|
2415
|
+
function so(n) {
|
|
2018
2416
|
n.querySelectorAll("li + ul, li + ol").forEach((t) => {
|
|
2019
2417
|
var i, s;
|
|
2020
2418
|
const e = t.previousElementSibling, o = document.createElement("div");
|
|
@@ -2024,19 +2422,19 @@ function ro(n) {
|
|
|
2024
2422
|
r.append(o.nextElementSibling);
|
|
2025
2423
|
});
|
|
2026
2424
|
}
|
|
2027
|
-
let
|
|
2028
|
-
function
|
|
2029
|
-
return
|
|
2425
|
+
let Ht = null;
|
|
2426
|
+
function ao() {
|
|
2427
|
+
return Ht || (Ht = document.implementation.createHTMLDocument("title"));
|
|
2030
2428
|
}
|
|
2031
|
-
function
|
|
2429
|
+
function ce(n) {
|
|
2032
2430
|
if (typeof n == "string") {
|
|
2033
|
-
const t =
|
|
2431
|
+
const t = ao().createElement("div");
|
|
2034
2432
|
t.innerHTML = n, n = t;
|
|
2035
2433
|
}
|
|
2036
|
-
return
|
|
2434
|
+
return io(n), so(n), n;
|
|
2037
2435
|
}
|
|
2038
|
-
async function
|
|
2039
|
-
const i =
|
|
2436
|
+
async function de(n, t, e, o, r) {
|
|
2437
|
+
const i = ce(n), a = be.fromSchema(r).parse(i, {
|
|
2040
2438
|
topNode: r.nodes.blockGroup.create()
|
|
2041
2439
|
}), l = [];
|
|
2042
2440
|
for (let c = 0; c < a.childCount; c++)
|
|
@@ -2045,7 +2443,7 @@ async function ce(n, t, e, o, r) {
|
|
|
2045
2443
|
);
|
|
2046
2444
|
return l;
|
|
2047
2445
|
}
|
|
2048
|
-
function
|
|
2446
|
+
function lo(n, t) {
|
|
2049
2447
|
const e = t.value ? t.value + `
|
|
2050
2448
|
` : "", o = {};
|
|
2051
2449
|
t.lang && (o["data-language"] = t.lang);
|
|
@@ -2062,14 +2460,14 @@ function so(n, t) {
|
|
|
2062
2460
|
children: [r]
|
|
2063
2461
|
}, n.patch(t, r), r;
|
|
2064
2462
|
}
|
|
2065
|
-
function
|
|
2066
|
-
const i = kt().use(
|
|
2463
|
+
function co(n, t, e, o, r) {
|
|
2464
|
+
const i = kt().use(Ge).use(Ft).use($e, {
|
|
2067
2465
|
handlers: {
|
|
2068
|
-
...
|
|
2069
|
-
code:
|
|
2466
|
+
...Ke,
|
|
2467
|
+
code: lo
|
|
2070
2468
|
}
|
|
2071
|
-
}).use(
|
|
2072
|
-
return
|
|
2469
|
+
}).use(zt).processSync(n);
|
|
2470
|
+
return de(
|
|
2073
2471
|
i.value,
|
|
2074
2472
|
t,
|
|
2075
2473
|
e,
|
|
@@ -2077,7 +2475,7 @@ function ao(n, t, e, o, r) {
|
|
|
2077
2475
|
r
|
|
2078
2476
|
);
|
|
2079
2477
|
}
|
|
2080
|
-
class
|
|
2478
|
+
class W {
|
|
2081
2479
|
constructor() {
|
|
2082
2480
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
2083
2481
|
d(this, "callbacks", {});
|
|
@@ -2097,7 +2495,7 @@ class K {
|
|
|
2097
2495
|
this.callbacks = {};
|
|
2098
2496
|
}
|
|
2099
2497
|
}
|
|
2100
|
-
class
|
|
2498
|
+
class uo {
|
|
2101
2499
|
constructor(t, e, o) {
|
|
2102
2500
|
d(this, "state");
|
|
2103
2501
|
d(this, "emitUpdate");
|
|
@@ -2116,31 +2514,21 @@ class lo {
|
|
|
2116
2514
|
var t;
|
|
2117
2515
|
(t = this.state) != null && t.show && (this.state.show = !1, this.emitUpdate());
|
|
2118
2516
|
});
|
|
2119
|
-
d(this, "focusHandler", () => {
|
|
2120
|
-
setTimeout(() => this.update(this.pmView));
|
|
2121
|
-
});
|
|
2122
|
-
d(this, "blurHandler", (t) => {
|
|
2123
|
-
var o;
|
|
2124
|
-
if (this.preventHide) {
|
|
2125
|
-
this.preventHide = !1;
|
|
2126
|
-
return;
|
|
2127
|
-
}
|
|
2128
|
-
const e = this.pmView.dom.parentElement;
|
|
2129
|
-
// An element is clicked.
|
|
2130
|
-
t && t.relatedTarget && // Element is inside the editor.
|
|
2131
|
-
(e === t.relatedTarget || e.contains(t.relatedTarget)) || (o = this.state) != null && o.show && (this.state.show = !1, this.emitUpdate());
|
|
2132
|
-
});
|
|
2133
2517
|
d(this, "scrollHandler", () => {
|
|
2134
2518
|
var t;
|
|
2135
2519
|
(t = this.state) != null && t.show && (this.state.referencePos = this.getSelectionBoundingBox(), this.emitUpdate());
|
|
2136
2520
|
});
|
|
2521
|
+
d(this, "closeMenu", () => {
|
|
2522
|
+
var t;
|
|
2523
|
+
(t = this.state) != null && t.show && (this.state.show = !1, this.emitUpdate());
|
|
2524
|
+
});
|
|
2137
2525
|
this.editor = t, this.pmView = e, this.emitUpdate = () => {
|
|
2138
2526
|
if (!this.state)
|
|
2139
2527
|
throw new Error(
|
|
2140
2528
|
"Attempting to update uninitialized formatting toolbar"
|
|
2141
2529
|
);
|
|
2142
2530
|
o(this.state);
|
|
2143
|
-
}, e.dom.addEventListener("mousedown", this.viewMousedownHandler), e.dom.addEventListener("mouseup", this.viewMouseupHandler), e.dom.addEventListener("dragstart", this.dragHandler), e.dom.addEventListener("dragover", this.dragHandler),
|
|
2531
|
+
}, e.dom.addEventListener("mousedown", this.viewMousedownHandler), e.dom.addEventListener("mouseup", this.viewMouseupHandler), e.dom.addEventListener("dragstart", this.dragHandler), e.dom.addEventListener("dragover", this.dragHandler), document.addEventListener("scroll", this.scrollHandler);
|
|
2144
2532
|
}
|
|
2145
2533
|
update(t, e) {
|
|
2146
2534
|
var m, h;
|
|
@@ -2167,11 +2555,11 @@ class lo {
|
|
|
2167
2555
|
}
|
|
2168
2556
|
}
|
|
2169
2557
|
destroy() {
|
|
2170
|
-
this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler), this.pmView.dom.removeEventListener("mouseup", this.viewMouseupHandler), this.pmView.dom.removeEventListener("dragstart", this.dragHandler), this.pmView.dom.removeEventListener("dragover", this.dragHandler),
|
|
2558
|
+
this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler), this.pmView.dom.removeEventListener("mouseup", this.viewMouseupHandler), this.pmView.dom.removeEventListener("dragstart", this.dragHandler), this.pmView.dom.removeEventListener("dragover", this.dragHandler), document.removeEventListener("scroll", this.scrollHandler);
|
|
2171
2559
|
}
|
|
2172
2560
|
getSelectionBoundingBox() {
|
|
2173
2561
|
const { state: t } = this.pmView, { selection: e } = t, { ranges: o } = e, r = Math.min(...o.map((s) => s.$from.pos)), i = Math.max(...o.map((s) => s.$to.pos));
|
|
2174
|
-
if (
|
|
2562
|
+
if (Te(e)) {
|
|
2175
2563
|
const s = this.pmView.nodeDOM(r);
|
|
2176
2564
|
if (s)
|
|
2177
2565
|
return s.getBoundingClientRect();
|
|
@@ -2179,26 +2567,128 @@ class lo {
|
|
|
2179
2567
|
return ft(this.pmView, r, i);
|
|
2180
2568
|
}
|
|
2181
2569
|
}
|
|
2182
|
-
const
|
|
2570
|
+
const po = new x(
|
|
2183
2571
|
"FormattingToolbarPlugin"
|
|
2184
2572
|
);
|
|
2185
|
-
class
|
|
2573
|
+
class ho extends W {
|
|
2186
2574
|
constructor(e) {
|
|
2187
2575
|
super();
|
|
2188
2576
|
d(this, "view");
|
|
2189
2577
|
d(this, "plugin");
|
|
2578
|
+
d(this, "closeMenu", () => this.view.closeMenu());
|
|
2190
2579
|
this.plugin = new v({
|
|
2191
|
-
key:
|
|
2192
|
-
view: (o) => (this.view = new
|
|
2580
|
+
key: po,
|
|
2581
|
+
view: (o) => (this.view = new uo(e, o, (r) => {
|
|
2193
2582
|
this.emit("update", r);
|
|
2194
|
-
}), this.view)
|
|
2583
|
+
}), this.view),
|
|
2584
|
+
props: {
|
|
2585
|
+
handleKeyDown: (o, r) => r.key === "Escape" && this.shown ? (this.view.closeMenu(), !0) : !1
|
|
2586
|
+
}
|
|
2195
2587
|
});
|
|
2196
2588
|
}
|
|
2589
|
+
get shown() {
|
|
2590
|
+
var e, o;
|
|
2591
|
+
return ((o = (e = this.view) == null ? void 0 : e.state) == null ? void 0 : o.show) || !1;
|
|
2592
|
+
}
|
|
2197
2593
|
onUpdate(e) {
|
|
2198
2594
|
return this.on("update", e);
|
|
2199
2595
|
}
|
|
2200
2596
|
}
|
|
2201
|
-
class
|
|
2597
|
+
class mo {
|
|
2598
|
+
constructor(t, e, o) {
|
|
2599
|
+
d(this, "state");
|
|
2600
|
+
d(this, "emitUpdate");
|
|
2601
|
+
d(this, "prevWasEditable", null);
|
|
2602
|
+
d(this, "mouseDownHandler", () => {
|
|
2603
|
+
var t;
|
|
2604
|
+
(t = this.state) != null && t.show && (this.state.show = !1, this.emitUpdate());
|
|
2605
|
+
});
|
|
2606
|
+
// For dragging the whole editor.
|
|
2607
|
+
d(this, "dragstartHandler", () => {
|
|
2608
|
+
var t;
|
|
2609
|
+
(t = this.state) != null && t.show && (this.state.show = !1, this.emitUpdate());
|
|
2610
|
+
});
|
|
2611
|
+
d(this, "scrollHandler", () => {
|
|
2612
|
+
var t;
|
|
2613
|
+
if ((t = this.state) != null && t.show) {
|
|
2614
|
+
const e = document.querySelector(
|
|
2615
|
+
`[data-node-type="blockContainer"][data-id="${this.state.block.id}"]`
|
|
2616
|
+
);
|
|
2617
|
+
this.state.referencePos = e.getBoundingClientRect(), this.emitUpdate();
|
|
2618
|
+
}
|
|
2619
|
+
});
|
|
2620
|
+
d(this, "closeMenu", () => {
|
|
2621
|
+
var t;
|
|
2622
|
+
(t = this.state) != null && t.show && (this.state.show = !1, this.emitUpdate());
|
|
2623
|
+
});
|
|
2624
|
+
this.pluginKey = t, this.pmView = e, this.emitUpdate = () => {
|
|
2625
|
+
if (!this.state)
|
|
2626
|
+
throw new Error("Attempting to update uninitialized image panel");
|
|
2627
|
+
o(this.state);
|
|
2628
|
+
}, e.dom.addEventListener("mousedown", this.mouseDownHandler), e.dom.addEventListener("dragstart", this.dragstartHandler), document.addEventListener("scroll", this.scrollHandler);
|
|
2629
|
+
}
|
|
2630
|
+
update(t, e) {
|
|
2631
|
+
var r, i;
|
|
2632
|
+
const o = this.pluginKey.getState(t.state);
|
|
2633
|
+
if (!((r = this.state) != null && r.show) && o.block) {
|
|
2634
|
+
const s = document.querySelector(
|
|
2635
|
+
`[data-node-type="blockContainer"][data-id="${o.block.id}"]`
|
|
2636
|
+
);
|
|
2637
|
+
this.state = {
|
|
2638
|
+
show: !0,
|
|
2639
|
+
referencePos: s.getBoundingClientRect(),
|
|
2640
|
+
block: o.block
|
|
2641
|
+
}, this.emitUpdate();
|
|
2642
|
+
return;
|
|
2643
|
+
}
|
|
2644
|
+
(!t.state.selection.eq(e.selection) || !t.state.doc.eq(e.doc)) && (i = this.state) != null && i.show && (this.state.show = !1, this.emitUpdate());
|
|
2645
|
+
}
|
|
2646
|
+
destroy() {
|
|
2647
|
+
this.pmView.dom.removeEventListener("mousedown", this.mouseDownHandler), this.pmView.dom.removeEventListener("dragstart", this.dragstartHandler), document.removeEventListener("scroll", this.scrollHandler);
|
|
2648
|
+
}
|
|
2649
|
+
}
|
|
2650
|
+
const ht = new x("ImagePanelPlugin");
|
|
2651
|
+
class fo extends W {
|
|
2652
|
+
constructor(e) {
|
|
2653
|
+
super();
|
|
2654
|
+
d(this, "view");
|
|
2655
|
+
d(this, "plugin");
|
|
2656
|
+
d(this, "closeMenu", () => this.view.closeMenu());
|
|
2657
|
+
this.plugin = new v({
|
|
2658
|
+
key: ht,
|
|
2659
|
+
view: (o) => (this.view = new mo(
|
|
2660
|
+
// editor,
|
|
2661
|
+
ht,
|
|
2662
|
+
o,
|
|
2663
|
+
(r) => {
|
|
2664
|
+
this.emit("update", r);
|
|
2665
|
+
}
|
|
2666
|
+
), this.view),
|
|
2667
|
+
props: {
|
|
2668
|
+
handleKeyDown: (o, r) => r.key === "Escape" && this.shown ? (this.view.closeMenu(), !0) : !1
|
|
2669
|
+
},
|
|
2670
|
+
state: {
|
|
2671
|
+
init: () => ({
|
|
2672
|
+
block: void 0
|
|
2673
|
+
}),
|
|
2674
|
+
apply: (o) => {
|
|
2675
|
+
var i;
|
|
2676
|
+
return {
|
|
2677
|
+
block: (i = o.getMeta(ht)) == null ? void 0 : i.block
|
|
2678
|
+
};
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
});
|
|
2682
|
+
}
|
|
2683
|
+
get shown() {
|
|
2684
|
+
var e, o;
|
|
2685
|
+
return ((o = (e = this.view) == null ? void 0 : e.state) == null ? void 0 : o.show) || !1;
|
|
2686
|
+
}
|
|
2687
|
+
onUpdate(e) {
|
|
2688
|
+
return this.on("update", e);
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
class go {
|
|
2202
2692
|
constructor(t, e, o) {
|
|
2203
2693
|
d(this, "state");
|
|
2204
2694
|
d(this, "emitUpdate");
|
|
@@ -2238,6 +2728,10 @@ class po {
|
|
|
2238
2728
|
this.linkMarkRange.to
|
|
2239
2729
|
), this.emitUpdate());
|
|
2240
2730
|
});
|
|
2731
|
+
d(this, "closeMenu", () => {
|
|
2732
|
+
var t;
|
|
2733
|
+
(t = this.state) != null && t.show && (this.state.show = !1, this.emitUpdate());
|
|
2734
|
+
});
|
|
2241
2735
|
this.editor = t, this.pmView = e, this.emitUpdate = () => {
|
|
2242
2736
|
if (!this.state)
|
|
2243
2737
|
throw new Error("Attempting to update uninitialized link toolbar");
|
|
@@ -2313,8 +2807,8 @@ class po {
|
|
|
2313
2807
|
this.pmView.dom.removeEventListener("mouseover", this.mouseOverHandler), document.removeEventListener("scroll", this.scrollHandler), document.removeEventListener("click", this.clickHandler, !0);
|
|
2314
2808
|
}
|
|
2315
2809
|
}
|
|
2316
|
-
const
|
|
2317
|
-
class
|
|
2810
|
+
const bo = new x("LinkToolbarPlugin");
|
|
2811
|
+
class ko extends W {
|
|
2318
2812
|
constructor(e) {
|
|
2319
2813
|
super();
|
|
2320
2814
|
d(this, "view");
|
|
@@ -2351,19 +2845,27 @@ class mo extends K {
|
|
|
2351
2845
|
d(this, "stopHideTimer", () => {
|
|
2352
2846
|
this.view.stopMenuUpdateTimer();
|
|
2353
2847
|
});
|
|
2848
|
+
d(this, "closeMenu", () => this.view.closeMenu());
|
|
2354
2849
|
this.plugin = new v({
|
|
2355
|
-
key:
|
|
2356
|
-
view: (o) => (this.view = new
|
|
2850
|
+
key: bo,
|
|
2851
|
+
view: (o) => (this.view = new go(e, o, (r) => {
|
|
2357
2852
|
this.emit("update", r);
|
|
2358
|
-
}), this.view)
|
|
2853
|
+
}), this.view),
|
|
2854
|
+
props: {
|
|
2855
|
+
handleKeyDown: (o, r) => r.key === "Escape" && this.shown ? (this.view.closeMenu(), !0) : !1
|
|
2856
|
+
}
|
|
2359
2857
|
});
|
|
2360
2858
|
}
|
|
2361
2859
|
onUpdate(e) {
|
|
2362
2860
|
return this.on("update", e);
|
|
2363
2861
|
}
|
|
2862
|
+
get shown() {
|
|
2863
|
+
var e, o;
|
|
2864
|
+
return ((o = (e = this.view) == null ? void 0 : e.state) == null ? void 0 : o.show) || !1;
|
|
2865
|
+
}
|
|
2364
2866
|
}
|
|
2365
|
-
const
|
|
2366
|
-
class
|
|
2867
|
+
const yo = Me((n) => n.type.name === "blockContainer");
|
|
2868
|
+
class wo {
|
|
2367
2869
|
constructor(t, e) {
|
|
2368
2870
|
d(this, "state");
|
|
2369
2871
|
d(this, "emitUpdate");
|
|
@@ -2421,7 +2923,7 @@ class go {
|
|
|
2421
2923
|
}
|
|
2422
2924
|
}
|
|
2423
2925
|
const R = new x("SuggestionMenuPlugin");
|
|
2424
|
-
class
|
|
2926
|
+
class vo extends W {
|
|
2425
2927
|
constructor(e) {
|
|
2426
2928
|
super();
|
|
2427
2929
|
d(this, "view");
|
|
@@ -2441,7 +2943,7 @@ class bo extends K {
|
|
|
2441
2943
|
const o = this.triggerCharacters;
|
|
2442
2944
|
this.plugin = new v({
|
|
2443
2945
|
key: R,
|
|
2444
|
-
view: () => (this.view = new
|
|
2946
|
+
view: () => (this.view = new wo(
|
|
2445
2947
|
e,
|
|
2446
2948
|
(r, i) => {
|
|
2447
2949
|
this.emit(`update ${r}`, i);
|
|
@@ -2497,10 +2999,10 @@ class bo extends K {
|
|
|
2497
2999
|
if (i === void 0)
|
|
2498
3000
|
return null;
|
|
2499
3001
|
if (!i.fromUserInput) {
|
|
2500
|
-
const s =
|
|
3002
|
+
const s = yo(r.selection);
|
|
2501
3003
|
if (s)
|
|
2502
3004
|
return G.create(r.doc, [
|
|
2503
|
-
|
|
3005
|
+
$.node(
|
|
2504
3006
|
s.pos,
|
|
2505
3007
|
s.pos + s.node.nodeSize,
|
|
2506
3008
|
{
|
|
@@ -2512,7 +3014,7 @@ class bo extends K {
|
|
|
2512
3014
|
]);
|
|
2513
3015
|
}
|
|
2514
3016
|
return G.create(r.doc, [
|
|
2515
|
-
|
|
3017
|
+
$.inline(
|
|
2516
3018
|
i.queryStartPos - i.triggerCharacter.length,
|
|
2517
3019
|
i.queryStartPos,
|
|
2518
3020
|
{
|
|
@@ -2529,11 +3031,15 @@ class bo extends K {
|
|
|
2529
3031
|
onUpdate(e, o) {
|
|
2530
3032
|
return this.triggerCharacters.includes(e) || this.addTriggerCharacter(e), this.on(`update ${e}`, o);
|
|
2531
3033
|
}
|
|
3034
|
+
get shown() {
|
|
3035
|
+
var e, o;
|
|
3036
|
+
return ((o = (e = this.view) == null ? void 0 : e.state) == null ? void 0 : o.show) || !1;
|
|
3037
|
+
}
|
|
2532
3038
|
}
|
|
2533
|
-
function
|
|
3039
|
+
function Kr(n, t) {
|
|
2534
3040
|
n.suggestionMenus.addTriggerCharacter(t);
|
|
2535
3041
|
}
|
|
2536
|
-
class
|
|
3042
|
+
class j extends ut {
|
|
2537
3043
|
constructor(e, o) {
|
|
2538
3044
|
super(e, o);
|
|
2539
3045
|
d(this, "nodes");
|
|
@@ -2544,13 +3050,13 @@ class $ extends ut {
|
|
|
2544
3050
|
});
|
|
2545
3051
|
}
|
|
2546
3052
|
static create(e, o, r = o) {
|
|
2547
|
-
return new
|
|
3053
|
+
return new j(e.resolve(o), e.resolve(r));
|
|
2548
3054
|
}
|
|
2549
3055
|
content() {
|
|
2550
3056
|
return new U(T.from(this.nodes), 0, 0);
|
|
2551
3057
|
}
|
|
2552
3058
|
eq(e) {
|
|
2553
|
-
if (!(e instanceof
|
|
3059
|
+
if (!(e instanceof j) || this.nodes.length !== e.nodes.length || this.from !== e.from || this.to !== e.to)
|
|
2554
3060
|
return !1;
|
|
2555
3061
|
for (let o = 0; o < this.nodes.length; o++)
|
|
2556
3062
|
if (!this.nodes[o].eq(e.nodes[o]))
|
|
@@ -2559,7 +3065,7 @@ class $ extends ut {
|
|
|
2559
3065
|
}
|
|
2560
3066
|
map(e, o) {
|
|
2561
3067
|
const r = o.mapResult(this.from), i = o.mapResult(this.to);
|
|
2562
|
-
return i.deleted ? ut.near(e.resolve(r.pos)) : r.deleted ? ut.near(e.resolve(i.pos)) : new
|
|
3068
|
+
return i.deleted ? ut.near(e.resolve(r.pos)) : r.deleted ? ut.near(e.resolve(i.pos)) : new j(
|
|
2563
3069
|
e.resolve(r.pos),
|
|
2564
3070
|
e.resolve(i.pos)
|
|
2565
3071
|
);
|
|
@@ -2568,7 +3074,7 @@ class $ extends ut {
|
|
|
2568
3074
|
return { type: "node", anchor: this.anchor, head: this.head };
|
|
2569
3075
|
}
|
|
2570
3076
|
}
|
|
2571
|
-
let
|
|
3077
|
+
let P;
|
|
2572
3078
|
function xt(n, t) {
|
|
2573
3079
|
var r;
|
|
2574
3080
|
if (!t.dom.isConnected)
|
|
@@ -2584,7 +3090,7 @@ function xt(n, t) {
|
|
|
2584
3090
|
return { node: o, id: o.getAttribute("data-id") };
|
|
2585
3091
|
}
|
|
2586
3092
|
}
|
|
2587
|
-
function
|
|
3093
|
+
function Eo(n, t) {
|
|
2588
3094
|
const e = xt(n, t);
|
|
2589
3095
|
if (e && e.node.nodeType === 1) {
|
|
2590
3096
|
const o = t.docView, r = o.nearestDesc(e.node, !0);
|
|
@@ -2592,7 +3098,7 @@ function ko(n, t) {
|
|
|
2592
3098
|
}
|
|
2593
3099
|
return null;
|
|
2594
3100
|
}
|
|
2595
|
-
function
|
|
3101
|
+
function So(n, t) {
|
|
2596
3102
|
let e, o;
|
|
2597
3103
|
const r = t.resolve(n.from).node().type.spec.group === "blockContent", i = t.resolve(n.to).node().type.spec.group === "blockContent", s = Math.min(n.$anchor.depth, n.$head.depth);
|
|
2598
3104
|
if (r && i) {
|
|
@@ -2602,7 +3108,7 @@ function yo(n, t) {
|
|
|
2602
3108
|
e = n.from, o = n.to;
|
|
2603
3109
|
return { from: e, to: o };
|
|
2604
3110
|
}
|
|
2605
|
-
function
|
|
3111
|
+
function Dt(n, t, e = t) {
|
|
2606
3112
|
t === e && (e += n.state.doc.resolve(t + 1).node().nodeSize);
|
|
2607
3113
|
const o = n.domAtPos(t).node.cloneNode(!0), r = n.domAtPos(t).node, i = (u, p) => Array.prototype.indexOf.call(u.children, p), s = i(
|
|
2608
3114
|
r,
|
|
@@ -2615,39 +3121,39 @@ function Ot(n, t, e = t) {
|
|
|
2615
3121
|
);
|
|
2616
3122
|
for (let u = r.childElementCount - 1; u >= 0; u--)
|
|
2617
3123
|
(u > a || u < s) && o.removeChild(o.children[u]);
|
|
2618
|
-
|
|
3124
|
+
ue(), P = o;
|
|
2619
3125
|
const c = n.dom.className.split(" ").filter(
|
|
2620
3126
|
(u) => u !== "ProseMirror" && u !== "bn-root" && u !== "bn-editor"
|
|
2621
3127
|
).join(" ");
|
|
2622
|
-
|
|
3128
|
+
P.className = P.className + " bn-drag-preview " + c, document.body.appendChild(P);
|
|
2623
3129
|
}
|
|
2624
|
-
function
|
|
2625
|
-
|
|
3130
|
+
function ue() {
|
|
3131
|
+
P !== void 0 && (document.body.removeChild(P), P = void 0);
|
|
2626
3132
|
}
|
|
2627
|
-
function
|
|
3133
|
+
function Co(n, t) {
|
|
2628
3134
|
if (!n.dataTransfer)
|
|
2629
3135
|
return;
|
|
2630
3136
|
const e = t.prosemirrorView, o = e.dom.getBoundingClientRect(), r = {
|
|
2631
3137
|
left: o.left + o.width / 2,
|
|
2632
3138
|
// take middle of editor
|
|
2633
3139
|
top: n.clientY
|
|
2634
|
-
}, i =
|
|
3140
|
+
}, i = Eo(r, e);
|
|
2635
3141
|
if (i != null) {
|
|
2636
|
-
const s = e.state.selection, a = e.state.doc, { from: l, to: c } =
|
|
3142
|
+
const s = e.state.selection, a = e.state.doc, { from: l, to: c } = So(s, a), u = l <= i && i < c, p = s.$anchor.node() !== s.$head.node() || s instanceof j;
|
|
2637
3143
|
u && p ? (e.dispatch(
|
|
2638
|
-
e.state.tr.setSelection(
|
|
2639
|
-
),
|
|
3144
|
+
e.state.tr.setSelection(j.create(a, l, c))
|
|
3145
|
+
), Dt(e, l, c)) : (e.dispatch(
|
|
2640
3146
|
e.state.tr.setSelection(it.create(e.state.doc, i))
|
|
2641
|
-
),
|
|
2642
|
-
const m = e.state.selection.content(), h = t._tiptapEditor.schema, k =
|
|
3147
|
+
), Dt(e, i));
|
|
3148
|
+
const m = e.state.selection.content(), h = t._tiptapEditor.schema, k = Yt(h, t).serializeProseMirrorFragment(
|
|
2643
3149
|
m.content
|
|
2644
3150
|
), B = lt(h, t).exportProseMirrorFragment(
|
|
2645
3151
|
m.content
|
|
2646
3152
|
), E = Ct(B);
|
|
2647
|
-
n.dataTransfer.clearData(), n.dataTransfer.setData("blocknote/html", k), n.dataTransfer.setData("text/html", B), n.dataTransfer.setData("text/plain", E), n.dataTransfer.effectAllowed = "move", n.dataTransfer.setDragImage(
|
|
3153
|
+
n.dataTransfer.clearData(), n.dataTransfer.setData("blocknote/html", k), n.dataTransfer.setData("text/html", B), n.dataTransfer.setData("text/plain", E), n.dataTransfer.effectAllowed = "move", n.dataTransfer.setDragImage(P, 0, 0), e.dragging = { slice: m, move: !0 };
|
|
2648
3154
|
}
|
|
2649
3155
|
}
|
|
2650
|
-
class
|
|
3156
|
+
class xo {
|
|
2651
3157
|
constructor(t, e, o) {
|
|
2652
3158
|
d(this, "state");
|
|
2653
3159
|
d(this, "emitUpdate");
|
|
@@ -2702,7 +3208,7 @@ class vo {
|
|
|
2702
3208
|
});
|
|
2703
3209
|
d(this, "onKeyDown", (t) => {
|
|
2704
3210
|
var e;
|
|
2705
|
-
(e = this.state) != null && e.show && (this.state.show = !1, this.emitUpdate(this.state)
|
|
3211
|
+
(e = this.state) != null && e.show && this.editor.isFocused() && (this.state.show = !1, this.emitUpdate(this.state), this.menuFrozen = !1);
|
|
2706
3212
|
});
|
|
2707
3213
|
d(this, "onMouseDown", (t) => {
|
|
2708
3214
|
this.state && !this.state.show && (this.state.show = !0, this.emitUpdate(this.state)), this.menuFrozen = !1;
|
|
@@ -2802,8 +3308,8 @@ class vo {
|
|
|
2802
3308
|
);
|
|
2803
3309
|
}
|
|
2804
3310
|
}
|
|
2805
|
-
const
|
|
2806
|
-
class
|
|
3311
|
+
const To = new x("SideMenuPlugin");
|
|
3312
|
+
class Mo extends W {
|
|
2807
3313
|
constructor(e) {
|
|
2808
3314
|
super();
|
|
2809
3315
|
d(this, "view");
|
|
@@ -2817,12 +3323,12 @@ class So extends K {
|
|
|
2817
3323
|
* Handles drag & drop events for blocks.
|
|
2818
3324
|
*/
|
|
2819
3325
|
d(this, "blockDragStart", (e) => {
|
|
2820
|
-
this.view.isDragging = !0,
|
|
3326
|
+
this.view.isDragging = !0, Co(e, this.editor);
|
|
2821
3327
|
});
|
|
2822
3328
|
/**
|
|
2823
3329
|
* Handles drag & drop events for blocks.
|
|
2824
3330
|
*/
|
|
2825
|
-
d(this, "blockDragEnd", () =>
|
|
3331
|
+
d(this, "blockDragEnd", () => ue());
|
|
2826
3332
|
/**
|
|
2827
3333
|
* Freezes the side menu. When frozen, the side menu will stay
|
|
2828
3334
|
* attached to the same block regardless of which block is hovered by the
|
|
@@ -2836,8 +3342,8 @@ class So extends K {
|
|
|
2836
3342
|
*/
|
|
2837
3343
|
d(this, "unfreezeMenu", () => this.view.menuFrozen = !1);
|
|
2838
3344
|
this.editor = e, this.plugin = new v({
|
|
2839
|
-
key:
|
|
2840
|
-
view: (o) => (this.view = new
|
|
3345
|
+
key: To,
|
|
3346
|
+
view: (o) => (this.view = new xo(e, o, (r) => {
|
|
2841
3347
|
this.emit("update", r);
|
|
2842
3348
|
}), this.view)
|
|
2843
3349
|
});
|
|
@@ -2846,118 +3352,29 @@ class So extends K {
|
|
|
2846
3352
|
return this.on("update", e);
|
|
2847
3353
|
}
|
|
2848
3354
|
}
|
|
2849
|
-
class Co {
|
|
2850
|
-
constructor(t, e, o) {
|
|
2851
|
-
d(this, "state");
|
|
2852
|
-
d(this, "emitUpdate");
|
|
2853
|
-
d(this, "prevWasEditable", null);
|
|
2854
|
-
d(this, "mouseDownHandler", () => {
|
|
2855
|
-
var t;
|
|
2856
|
-
(t = this.state) != null && t.show && (this.state.show = !1, this.emitUpdate());
|
|
2857
|
-
});
|
|
2858
|
-
// For dragging the whole editor.
|
|
2859
|
-
d(this, "dragstartHandler", () => {
|
|
2860
|
-
var t;
|
|
2861
|
-
(t = this.state) != null && t.show && (this.state.show = !1, this.emitUpdate());
|
|
2862
|
-
});
|
|
2863
|
-
d(this, "blurHandler", (t) => {
|
|
2864
|
-
var o;
|
|
2865
|
-
const e = this.pmView.dom.parentElement;
|
|
2866
|
-
// An element is clicked.
|
|
2867
|
-
t && t.relatedTarget && // Element is inside the editor.
|
|
2868
|
-
(e === t.relatedTarget || e.contains(t.relatedTarget)) || (o = this.state) != null && o.show && (this.state.show = !1, this.emitUpdate());
|
|
2869
|
-
});
|
|
2870
|
-
d(this, "scrollHandler", () => {
|
|
2871
|
-
var t;
|
|
2872
|
-
if ((t = this.state) != null && t.show) {
|
|
2873
|
-
const e = document.querySelector(
|
|
2874
|
-
`[data-node-type="blockContainer"][data-id="${this.state.block.id}"]`
|
|
2875
|
-
);
|
|
2876
|
-
this.state.referencePos = e.getBoundingClientRect(), this.emitUpdate();
|
|
2877
|
-
}
|
|
2878
|
-
});
|
|
2879
|
-
this.pluginKey = t, this.pmView = e, this.emitUpdate = () => {
|
|
2880
|
-
if (!this.state)
|
|
2881
|
-
throw new Error("Attempting to update uninitialized image panel");
|
|
2882
|
-
o(this.state);
|
|
2883
|
-
}, e.dom.addEventListener("mousedown", this.mouseDownHandler), e.dom.addEventListener("dragstart", this.dragstartHandler), e.dom.addEventListener("blur", this.blurHandler), document.addEventListener("scroll", this.scrollHandler);
|
|
2884
|
-
}
|
|
2885
|
-
update(t, e) {
|
|
2886
|
-
var r, i;
|
|
2887
|
-
const o = this.pluginKey.getState(t.state);
|
|
2888
|
-
if (!((r = this.state) != null && r.show) && o.block) {
|
|
2889
|
-
const s = document.querySelector(
|
|
2890
|
-
`[data-node-type="blockContainer"][data-id="${o.block.id}"]`
|
|
2891
|
-
);
|
|
2892
|
-
this.state = {
|
|
2893
|
-
show: !0,
|
|
2894
|
-
referencePos: s.getBoundingClientRect(),
|
|
2895
|
-
block: o.block
|
|
2896
|
-
}, this.emitUpdate();
|
|
2897
|
-
return;
|
|
2898
|
-
}
|
|
2899
|
-
(!t.state.selection.eq(e.selection) || !t.state.doc.eq(e.doc)) && (i = this.state) != null && i.show && (this.state.show = !1, this.emitUpdate());
|
|
2900
|
-
}
|
|
2901
|
-
destroy() {
|
|
2902
|
-
this.pmView.dom.removeEventListener("mousedown", this.mouseDownHandler), this.pmView.dom.removeEventListener("dragstart", this.dragstartHandler), this.pmView.dom.removeEventListener("blur", this.blurHandler), document.removeEventListener("scroll", this.scrollHandler);
|
|
2903
|
-
}
|
|
2904
|
-
}
|
|
2905
|
-
const ht = new x("ImagePanelPlugin");
|
|
2906
|
-
class xo extends K {
|
|
2907
|
-
constructor(e) {
|
|
2908
|
-
super();
|
|
2909
|
-
d(this, "view");
|
|
2910
|
-
d(this, "plugin");
|
|
2911
|
-
this.plugin = new v({
|
|
2912
|
-
key: ht,
|
|
2913
|
-
view: (o) => (this.view = new Co(
|
|
2914
|
-
// editor,
|
|
2915
|
-
ht,
|
|
2916
|
-
o,
|
|
2917
|
-
(r) => {
|
|
2918
|
-
this.emit("update", r);
|
|
2919
|
-
}
|
|
2920
|
-
), this.view),
|
|
2921
|
-
state: {
|
|
2922
|
-
init: () => ({
|
|
2923
|
-
block: void 0
|
|
2924
|
-
}),
|
|
2925
|
-
apply: (o) => {
|
|
2926
|
-
var i;
|
|
2927
|
-
return {
|
|
2928
|
-
block: (i = o.getMeta(ht)) == null ? void 0 : i.block
|
|
2929
|
-
};
|
|
2930
|
-
}
|
|
2931
|
-
}
|
|
2932
|
-
});
|
|
2933
|
-
}
|
|
2934
|
-
onUpdate(e) {
|
|
2935
|
-
return this.on("update", e);
|
|
2936
|
-
}
|
|
2937
|
-
}
|
|
2938
3355
|
let C;
|
|
2939
|
-
function
|
|
3356
|
+
function Ot() {
|
|
2940
3357
|
C || (C = document.createElement("div"), C.innerHTML = "_", C.style.opacity = "0", C.style.height = "1px", C.style.width = "1px", document.body.appendChild(C));
|
|
2941
3358
|
}
|
|
2942
|
-
function
|
|
3359
|
+
function Bo() {
|
|
2943
3360
|
C && (document.body.removeChild(C), C = void 0);
|
|
2944
3361
|
}
|
|
2945
3362
|
function rt(n) {
|
|
2946
3363
|
return Array.prototype.indexOf.call(n.parentElement.childNodes, n);
|
|
2947
3364
|
}
|
|
2948
|
-
function
|
|
3365
|
+
function Lo(n) {
|
|
2949
3366
|
for (; n && n.nodeName !== "TD" && n.nodeName !== "TH"; )
|
|
2950
3367
|
n = n.classList && n.classList.contains("ProseMirror") ? null : n.parentNode;
|
|
2951
3368
|
return n;
|
|
2952
3369
|
}
|
|
2953
|
-
function
|
|
3370
|
+
function Io(n) {
|
|
2954
3371
|
n.forEach((t) => {
|
|
2955
3372
|
const e = document.getElementsByClassName(t);
|
|
2956
3373
|
for (let o = 0; o < e.length; o++)
|
|
2957
3374
|
e[o].style.visibility = "hidden";
|
|
2958
3375
|
});
|
|
2959
3376
|
}
|
|
2960
|
-
class
|
|
3377
|
+
class _o {
|
|
2961
3378
|
constructor(t, e, o) {
|
|
2962
3379
|
d(this, "state");
|
|
2963
3380
|
d(this, "emitUpdate");
|
|
@@ -2969,7 +3386,7 @@ class Lo {
|
|
|
2969
3386
|
var c;
|
|
2970
3387
|
if (this.menuFrozen)
|
|
2971
3388
|
return;
|
|
2972
|
-
const e =
|
|
3389
|
+
const e = Lo(t.target);
|
|
2973
3390
|
if (!e || !this.editor.isEditable) {
|
|
2974
3391
|
(c = this.state) != null && c.show && (this.state.show = !1, this.emitUpdate());
|
|
2975
3392
|
return;
|
|
@@ -3002,7 +3419,7 @@ class Lo {
|
|
|
3002
3419
|
var m;
|
|
3003
3420
|
if (((m = this.state) == null ? void 0 : m.draggingState) === void 0)
|
|
3004
3421
|
return;
|
|
3005
|
-
t.preventDefault(), t.dataTransfer.dropEffect = "move",
|
|
3422
|
+
t.preventDefault(), t.dataTransfer.dropEffect = "move", Io([
|
|
3006
3423
|
"column-resize-handle",
|
|
3007
3424
|
"prosemirror-dropcursor-block",
|
|
3008
3425
|
"prosemirror-dropcursor-inline"
|
|
@@ -3074,11 +3491,11 @@ class Lo {
|
|
|
3074
3491
|
}, e.dom.addEventListener("mousemove", this.mouseMoveHandler), document.addEventListener("dragover", this.dragOverHandler), document.addEventListener("drop", this.dropHandler), document.addEventListener("scroll", this.scrollHandler);
|
|
3075
3492
|
}
|
|
3076
3493
|
destroy() {
|
|
3077
|
-
this.pmView.dom.removeEventListener("
|
|
3494
|
+
this.pmView.dom.removeEventListener("mousemove", this.mouseMoveHandler), document.removeEventListener("dragover", this.dragOverHandler), document.removeEventListener("drop", this.dropHandler), document.removeEventListener("scroll", this.scrollHandler);
|
|
3078
3495
|
}
|
|
3079
3496
|
}
|
|
3080
3497
|
const Y = new x("TableHandlesPlugin");
|
|
3081
|
-
class
|
|
3498
|
+
class Ao extends W {
|
|
3082
3499
|
constructor(e) {
|
|
3083
3500
|
super();
|
|
3084
3501
|
d(this, "view");
|
|
@@ -3103,7 +3520,7 @@ class Io extends K {
|
|
|
3103
3520
|
newIndex: this.view.state.colIndex,
|
|
3104
3521
|
tablePos: this.view.tablePos
|
|
3105
3522
|
})
|
|
3106
|
-
),
|
|
3523
|
+
), Ot(), e.dataTransfer.setDragImage(C, 0, 0), e.dataTransfer.effectAllowed = "move";
|
|
3107
3524
|
});
|
|
3108
3525
|
/**
|
|
3109
3526
|
* Callback that should be set on the `dragStart` event for whichever element
|
|
@@ -3125,7 +3542,7 @@ class Io extends K {
|
|
|
3125
3542
|
newIndex: this.view.state.rowIndex,
|
|
3126
3543
|
tablePos: this.view.tablePos
|
|
3127
3544
|
})
|
|
3128
|
-
),
|
|
3545
|
+
), Ot(), e.dataTransfer.setDragImage(C, 0, 0), e.dataTransfer.effectAllowed = "copyMove";
|
|
3129
3546
|
});
|
|
3130
3547
|
/**
|
|
3131
3548
|
* Callback that should be set on the `dragEnd` event for both the element
|
|
@@ -3138,7 +3555,7 @@ class Io extends K {
|
|
|
3138
3555
|
);
|
|
3139
3556
|
this.view.state.draggingState = void 0, this.view.emitUpdate(), this.editor._tiptapEditor.view.dispatch(
|
|
3140
3557
|
this.editor._tiptapEditor.state.tr.setMeta(Y, null)
|
|
3141
|
-
),
|
|
3558
|
+
), Bo();
|
|
3142
3559
|
});
|
|
3143
3560
|
/**
|
|
3144
3561
|
* Freezes the drag handles. When frozen, they will stay attached to the same
|
|
@@ -3156,7 +3573,7 @@ class Io extends K {
|
|
|
3156
3573
|
});
|
|
3157
3574
|
this.editor = e, this.plugin = new v({
|
|
3158
3575
|
key: Y,
|
|
3159
|
-
view: (o) => (this.view = new
|
|
3576
|
+
view: (o) => (this.view = new _o(e, o, (r) => {
|
|
3160
3577
|
this.emit("update", r);
|
|
3161
3578
|
}), this.view),
|
|
3162
3579
|
// We use decorations to render the drop cursor when dragging a table row
|
|
@@ -3179,7 +3596,7 @@ class Io extends K {
|
|
|
3179
3596
|
), m = p.node(), h = p.pos + (r > this.view.state.draggingState.originalIndex ? m.nodeSize - 2 : 0);
|
|
3180
3597
|
i.push(
|
|
3181
3598
|
// The widget is a small bar which spans the width of the cell.
|
|
3182
|
-
|
|
3599
|
+
$.widget(h, () => {
|
|
3183
3600
|
const f = document.createElement("div");
|
|
3184
3601
|
return f.className = "bn-table-drop-cursor", f.style.left = "0", f.style.right = "0", r > this.view.state.draggingState.originalIndex ? f.style.bottom = "-2px" : f.style.top = "-3px", f.style.height = "4px", f;
|
|
3185
3602
|
})
|
|
@@ -3194,7 +3611,7 @@ class Io extends K {
|
|
|
3194
3611
|
), p = u.node(), m = u.pos + (r > this.view.state.draggingState.originalIndex ? p.nodeSize - 2 : 0);
|
|
3195
3612
|
i.push(
|
|
3196
3613
|
// The widget is a small bar which spans the height of the cell.
|
|
3197
|
-
|
|
3614
|
+
$.widget(m, () => {
|
|
3198
3615
|
const h = document.createElement("div");
|
|
3199
3616
|
return h.className = "bn-table-drop-cursor", h.style.top = "0", h.style.bottom = "0", r > this.view.state.draggingState.originalIndex ? h.style.right = "-2px" : h.style.left = "-3px", h.style.width = "4px", h;
|
|
3200
3617
|
})
|
|
@@ -3210,7 +3627,7 @@ class Io extends K {
|
|
|
3210
3627
|
}
|
|
3211
3628
|
}
|
|
3212
3629
|
function Ut(n, t) {
|
|
3213
|
-
const e = n.state.selection.content().content, r =
|
|
3630
|
+
const e = n.state.selection.content().content, r = Yt(
|
|
3214
3631
|
n.state.schema,
|
|
3215
3632
|
t
|
|
3216
3633
|
).serializeProseMirrorFragment(e), s = lt(
|
|
@@ -3258,11 +3675,11 @@ const No = (n) => M.create({
|
|
|
3258
3675
|
})
|
|
3259
3676
|
];
|
|
3260
3677
|
}
|
|
3261
|
-
}),
|
|
3678
|
+
}), Po = [
|
|
3262
3679
|
"blocknote/html",
|
|
3263
3680
|
"text/html",
|
|
3264
3681
|
"text/plain"
|
|
3265
|
-
],
|
|
3682
|
+
], Ho = (n) => M.create({
|
|
3266
3683
|
name: "pasteFromClipboard",
|
|
3267
3684
|
addProseMirrorPlugins() {
|
|
3268
3685
|
return [
|
|
@@ -3272,14 +3689,14 @@ const No = (n) => M.create({
|
|
|
3272
3689
|
paste(t, e) {
|
|
3273
3690
|
e.preventDefault();
|
|
3274
3691
|
let o = null;
|
|
3275
|
-
for (const r of
|
|
3692
|
+
for (const r of Po)
|
|
3276
3693
|
if (e.clipboardData.types.includes(r)) {
|
|
3277
3694
|
o = r;
|
|
3278
3695
|
break;
|
|
3279
3696
|
}
|
|
3280
3697
|
if (o !== null) {
|
|
3281
3698
|
let r = e.clipboardData.getData(o);
|
|
3282
|
-
o === "text/html" && (r =
|
|
3699
|
+
o === "text/html" && (r = ce(
|
|
3283
3700
|
r.trim()
|
|
3284
3701
|
).innerHTML), n._tiptapEditor.view.pasteHTML(r);
|
|
3285
3702
|
}
|
|
@@ -3290,7 +3707,7 @@ const No = (n) => M.create({
|
|
|
3290
3707
|
})
|
|
3291
3708
|
];
|
|
3292
3709
|
}
|
|
3293
|
-
}),
|
|
3710
|
+
}), Do = M.create({
|
|
3294
3711
|
name: "blockBackgroundColor",
|
|
3295
3712
|
addGlobalAttributes() {
|
|
3296
3713
|
return [
|
|
@@ -3308,71 +3725,7 @@ const No = (n) => M.create({
|
|
|
3308
3725
|
}
|
|
3309
3726
|
];
|
|
3310
3727
|
}
|
|
3311
|
-
}),
|
|
3312
|
-
name: "placeholder",
|
|
3313
|
-
addOptions() {
|
|
3314
|
-
return {
|
|
3315
|
-
placeholders: {
|
|
3316
|
-
default: "Enter text or type '/' for commands",
|
|
3317
|
-
heading: "Heading",
|
|
3318
|
-
bulletListItem: "List",
|
|
3319
|
-
numberedListItem: "List"
|
|
3320
|
-
}
|
|
3321
|
-
};
|
|
3322
|
-
},
|
|
3323
|
-
addProseMirrorPlugins() {
|
|
3324
|
-
const n = this.options.placeholders;
|
|
3325
|
-
return [
|
|
3326
|
-
new v({
|
|
3327
|
-
key: Do,
|
|
3328
|
-
view: () => {
|
|
3329
|
-
const t = document.createElement("style");
|
|
3330
|
-
document.head.appendChild(t);
|
|
3331
|
-
const e = t.sheet, o = (i = "") => `.bn-block-content${i} .bn-inline-content:has(> .ProseMirror-trailingBreak):before`, r = (i, s = !0) => {
|
|
3332
|
-
const a = s ? "[data-is-empty-and-focused]" : "";
|
|
3333
|
-
if (i === "default")
|
|
3334
|
-
return o(a);
|
|
3335
|
-
const l = `[data-content-type="${i}"]`;
|
|
3336
|
-
return o(a + l);
|
|
3337
|
-
};
|
|
3338
|
-
for (const [i, s] of Object.entries(n)) {
|
|
3339
|
-
const a = i === "default";
|
|
3340
|
-
e.insertRule(
|
|
3341
|
-
`${r(
|
|
3342
|
-
i,
|
|
3343
|
-
a
|
|
3344
|
-
)}{ content: ${JSON.stringify(s)}; }`
|
|
3345
|
-
), a || e.insertRule(
|
|
3346
|
-
`${r(i, !0)}{ content: ${JSON.stringify(
|
|
3347
|
-
s
|
|
3348
|
-
)}; }`
|
|
3349
|
-
);
|
|
3350
|
-
}
|
|
3351
|
-
return {
|
|
3352
|
-
destroy: () => {
|
|
3353
|
-
document.head.removeChild(t);
|
|
3354
|
-
}
|
|
3355
|
-
};
|
|
3356
|
-
},
|
|
3357
|
-
props: {
|
|
3358
|
-
// TODO: maybe also add placeholder for empty document ("e.g.: start writing..")
|
|
3359
|
-
decorations: (t) => {
|
|
3360
|
-
const { doc: e, selection: o } = t;
|
|
3361
|
-
if (!this.editor.isEditable || !o.empty)
|
|
3362
|
-
return;
|
|
3363
|
-
const i = o.$anchor, s = i.parent;
|
|
3364
|
-
if (s.content.size > 0)
|
|
3365
|
-
return null;
|
|
3366
|
-
const a = i.before(), l = j.node(a, a + s.nodeSize, {
|
|
3367
|
-
"data-is-empty-and-focused": "true"
|
|
3368
|
-
});
|
|
3369
|
-
return G.create(e, [l]);
|
|
3370
|
-
}
|
|
3371
|
-
}
|
|
3372
|
-
})
|
|
3373
|
-
];
|
|
3374
|
-
}
|
|
3375
|
-
}), _o = M.create({
|
|
3728
|
+
}), Oo = M.create({
|
|
3376
3729
|
name: "textAlignment",
|
|
3377
3730
|
addGlobalAttributes() {
|
|
3378
3731
|
return [
|
|
@@ -3445,8 +3798,8 @@ const No = (n) => M.create({
|
|
|
3445
3798
|
})
|
|
3446
3799
|
];
|
|
3447
3800
|
}
|
|
3448
|
-
}),
|
|
3449
|
-
key:
|
|
3801
|
+
}), Vo = new x("non-editable-block"), zo = () => new v({
|
|
3802
|
+
key: Vo,
|
|
3450
3803
|
props: {
|
|
3451
3804
|
handleKeyDown: (n, t) => {
|
|
3452
3805
|
"node" in n.state.selection && t.key.length === 1 && !t.ctrlKey && !t.altKey && !t.metaKey && !t.shiftKey && t.preventDefault();
|
|
@@ -3461,7 +3814,7 @@ const No = (n) => M.create({
|
|
|
3461
3814
|
type: "type",
|
|
3462
3815
|
depth: "depth",
|
|
3463
3816
|
"depth-change": "depth-change"
|
|
3464
|
-
},
|
|
3817
|
+
}, jo = () => {
|
|
3465
3818
|
let n;
|
|
3466
3819
|
return new v({
|
|
3467
3820
|
key: Rt,
|
|
@@ -3530,7 +3883,7 @@ const No = (n) => M.create({
|
|
|
3530
3883
|
const s = e.currentTransactionOldBlockAttrs[r.attrs.id], a = {};
|
|
3531
3884
|
for (const [c, u] of Object.entries(s))
|
|
3532
3885
|
a["data-prev-" + Fo[c]] = u || "none";
|
|
3533
|
-
const l =
|
|
3886
|
+
const l = $.node(i, i + r.nodeSize, {
|
|
3534
3887
|
...a
|
|
3535
3888
|
});
|
|
3536
3889
|
o.push(l);
|
|
@@ -3544,7 +3897,7 @@ const No = (n) => M.create({
|
|
|
3544
3897
|
id: "data-id",
|
|
3545
3898
|
depth: "data-depth",
|
|
3546
3899
|
depthChange: "data-depth-change"
|
|
3547
|
-
},
|
|
3900
|
+
}, $o = K.create({
|
|
3548
3901
|
name: "blockContainer",
|
|
3549
3902
|
group: "blockContainer",
|
|
3550
3903
|
// A block always contains content, and optionally a blockGroup which contains nested blocks
|
|
@@ -3577,7 +3930,7 @@ const No = (n) => M.create({
|
|
|
3577
3930
|
...((r = this.options.domAttributes) == null ? void 0 : r.block) || {},
|
|
3578
3931
|
...n
|
|
3579
3932
|
}, o = document.createElement("div");
|
|
3580
|
-
o.className =
|
|
3933
|
+
o.className = V("bn-block", e.class), o.setAttribute("data-node-type", this.name);
|
|
3581
3934
|
for (const [i, s] of Object.entries(e))
|
|
3582
3935
|
i !== "class" && o.setAttribute(i, s);
|
|
3583
3936
|
return t.appendChild(o), {
|
|
@@ -3611,7 +3964,7 @@ const No = (n) => M.create({
|
|
|
3611
3964
|
const m = [];
|
|
3612
3965
|
for (const h of t.children)
|
|
3613
3966
|
m.push(
|
|
3614
|
-
|
|
3967
|
+
H(
|
|
3615
3968
|
h,
|
|
3616
3969
|
e.schema,
|
|
3617
3970
|
this.options.editor.schema.styleSchema
|
|
@@ -3638,7 +3991,7 @@ const No = (n) => M.create({
|
|
|
3638
3991
|
this.options.editor.schema.styleSchema
|
|
3639
3992
|
);
|
|
3640
3993
|
else if (t.content.type === "tableContent")
|
|
3641
|
-
p =
|
|
3994
|
+
p = Kt(
|
|
3642
3995
|
t.content,
|
|
3643
3996
|
e.schema,
|
|
3644
3997
|
this.options.editor.schema.styleSchema
|
|
@@ -3760,7 +4113,7 @@ const No = (n) => M.create({
|
|
|
3760
4113
|
};
|
|
3761
4114
|
},
|
|
3762
4115
|
addProseMirrorPlugins() {
|
|
3763
|
-
return [
|
|
4116
|
+
return [jo(), zo()];
|
|
3764
4117
|
},
|
|
3765
4118
|
addKeyboardShortcuts() {
|
|
3766
4119
|
return {
|
|
@@ -3853,11 +4206,17 @@ const No = (n) => M.create({
|
|
|
3853
4206
|
]),
|
|
3854
4207
|
// Always returning true for tab key presses ensures they're not captured by the browser. Otherwise, they blur the
|
|
3855
4208
|
// editor since the browser will try to use tab for keyboard navigation.
|
|
3856
|
-
Tab: () =>
|
|
3857
|
-
|
|
4209
|
+
Tab: () => {
|
|
4210
|
+
var o, r, i;
|
|
4211
|
+
return (o = this.options.editor.formattingToolbar) != null && o.shown || (r = this.options.editor.linkToolbar) != null && r.shown || (i = this.options.editor.imagePanel) != null && i.shown ? !1 : (this.editor.commands.sinkListItem("blockContainer"), !0);
|
|
4212
|
+
},
|
|
4213
|
+
"Shift-Tab": () => {
|
|
4214
|
+
var o, r, i;
|
|
4215
|
+
return (o = this.options.editor.formattingToolbar) != null && o.shown || (r = this.options.editor.linkToolbar) != null && r.shown || (i = this.options.editor.imagePanel) != null && i.shown ? !1 : (this.editor.commands.liftListItem("blockContainer"), !0);
|
|
4216
|
+
}
|
|
3858
4217
|
};
|
|
3859
4218
|
}
|
|
3860
|
-
}),
|
|
4219
|
+
}), Ko = K.create({
|
|
3861
4220
|
name: "blockGroup",
|
|
3862
4221
|
group: "blockGroup",
|
|
3863
4222
|
content: "blockContainer+",
|
|
@@ -3875,7 +4234,7 @@ const No = (n) => M.create({
|
|
|
3875
4234
|
...((o = this.options.domAttributes) == null ? void 0 : o.blockGroup) || {},
|
|
3876
4235
|
...n
|
|
3877
4236
|
}, e = document.createElement("div");
|
|
3878
|
-
e.className =
|
|
4237
|
+
e.className = V(
|
|
3879
4238
|
"bn-block-group",
|
|
3880
4239
|
t.class
|
|
3881
4240
|
), e.setAttribute("data-node-type", "blockGroup");
|
|
@@ -3886,11 +4245,11 @@ const No = (n) => M.create({
|
|
|
3886
4245
|
contentDOM: e
|
|
3887
4246
|
};
|
|
3888
4247
|
}
|
|
3889
|
-
}), qo =
|
|
4248
|
+
}), qo = K.create({
|
|
3890
4249
|
name: "doc",
|
|
3891
4250
|
topNode: !0,
|
|
3892
4251
|
content: "blockGroup"
|
|
3893
|
-
}),
|
|
4252
|
+
}), Wo = (n) => {
|
|
3894
4253
|
var e;
|
|
3895
4254
|
const t = [
|
|
3896
4255
|
X.ClipboardTextSerializer,
|
|
@@ -3899,32 +4258,37 @@ const No = (n) => M.create({
|
|
|
3899
4258
|
X.FocusEvents,
|
|
3900
4259
|
X.Tabindex,
|
|
3901
4260
|
// DevTools,
|
|
3902
|
-
|
|
4261
|
+
Ye,
|
|
3903
4262
|
// DropCursor,
|
|
3904
|
-
Oo.configure({
|
|
3905
|
-
// TODO: This shorthand is kind of ugly
|
|
3906
|
-
...n.placeholders !== void 0 ? { placeholders: n.placeholders } : {}
|
|
3907
|
-
}),
|
|
3908
4263
|
Z.configure({
|
|
3909
4264
|
types: ["blockContainer"]
|
|
3910
4265
|
}),
|
|
3911
|
-
|
|
4266
|
+
Qe,
|
|
3912
4267
|
// Comments,
|
|
3913
4268
|
// basics:
|
|
3914
|
-
|
|
4269
|
+
en,
|
|
3915
4270
|
// marks:
|
|
3916
|
-
|
|
4271
|
+
tn,
|
|
3917
4272
|
...Object.values(n.styleSpecs).map((o) => o.implementation.mark),
|
|
3918
4273
|
Uo,
|
|
3919
|
-
|
|
3920
|
-
|
|
4274
|
+
Do,
|
|
4275
|
+
Oo,
|
|
4276
|
+
// make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)
|
|
4277
|
+
M.create({
|
|
4278
|
+
name: "OverrideEscape",
|
|
4279
|
+
addKeyboardShortcuts() {
|
|
4280
|
+
return {
|
|
4281
|
+
Escape: () => n.editor.suggestionMenus.shown ? !1 : this.editor.commands.blur()
|
|
4282
|
+
};
|
|
4283
|
+
}
|
|
4284
|
+
}),
|
|
3921
4285
|
// nodes
|
|
3922
4286
|
qo,
|
|
3923
|
-
|
|
4287
|
+
$o.configure({
|
|
3924
4288
|
editor: n.editor,
|
|
3925
4289
|
domAttributes: n.domAttributes
|
|
3926
4290
|
}),
|
|
3927
|
-
|
|
4291
|
+
Ko.configure({
|
|
3928
4292
|
domAttributes: n.domAttributes
|
|
3929
4293
|
}),
|
|
3930
4294
|
...Object.values(n.inlineContentSpecs).filter((o) => o.config !== "link" && o.config !== "text").map((o) => o.implementation.node.configure({
|
|
@@ -3945,15 +4309,15 @@ const No = (n) => M.create({
|
|
|
3945
4309
|
})
|
|
3946
4310
|
]),
|
|
3947
4311
|
No(n.editor),
|
|
3948
|
-
|
|
3949
|
-
|
|
4312
|
+
Ho(n.editor),
|
|
4313
|
+
Xe.configure({ width: 5, color: "#ddeeff" }),
|
|
3950
4314
|
// This needs to be at the bottom of this list, because Key events (such as enter, when selecting a /command),
|
|
3951
4315
|
// should be handled before Enter handlers in other components like splitListItem
|
|
3952
|
-
Ro
|
|
4316
|
+
...n.trailingBlock === void 0 || n.trailingBlock ? [Ro] : []
|
|
3953
4317
|
];
|
|
3954
4318
|
if (n.collaboration) {
|
|
3955
4319
|
if (t.push(
|
|
3956
|
-
|
|
4320
|
+
We.configure({
|
|
3957
4321
|
fragment: n.collaboration.fragment
|
|
3958
4322
|
})
|
|
3959
4323
|
), (e = n.collaboration.provider) != null && e.awareness) {
|
|
@@ -3966,7 +4330,7 @@ const No = (n) => M.create({
|
|
|
3966
4330
|
return i.insertBefore(a, null), i.insertBefore(s, null), i.insertBefore(l, null), i;
|
|
3967
4331
|
};
|
|
3968
4332
|
t.push(
|
|
3969
|
-
|
|
4333
|
+
Je.configure({
|
|
3970
4334
|
user: n.collaboration.user,
|
|
3971
4335
|
render: n.collaboration.renderCursor || o,
|
|
3972
4336
|
provider: n.collaboration.provider
|
|
@@ -3974,7 +4338,7 @@ const No = (n) => M.create({
|
|
|
3974
4338
|
);
|
|
3975
4339
|
}
|
|
3976
4340
|
} else
|
|
3977
|
-
t.push(
|
|
4341
|
+
t.push(Ze);
|
|
3978
4342
|
return t;
|
|
3979
4343
|
};
|
|
3980
4344
|
function Jo(n, t) {
|
|
@@ -4012,15 +4376,15 @@ class Tt {
|
|
|
4012
4376
|
d(this, "BlockNoteEditor", "only for types");
|
|
4013
4377
|
d(this, "Block", "only for types");
|
|
4014
4378
|
d(this, "PartialBlock", "only for types");
|
|
4015
|
-
this.blockSpecs = (t == null ? void 0 : t.blockSpecs) ||
|
|
4379
|
+
this.blockSpecs = (t == null ? void 0 : t.blockSpecs) || ie, this.inlineContentSpecs = (t == null ? void 0 : t.inlineContentSpecs) || ae, this.styleSpecs = (t == null ? void 0 : t.styleSpecs) || se, this.blockSchema = ee(this.blockSpecs), this.inlineContentSchema = ne(
|
|
4016
4380
|
this.inlineContentSpecs
|
|
4017
|
-
), this.styleSchema =
|
|
4381
|
+
), this.styleSchema = re(this.styleSpecs);
|
|
4018
4382
|
}
|
|
4019
4383
|
static create(t) {
|
|
4020
4384
|
return new Tt(t);
|
|
4021
4385
|
}
|
|
4022
4386
|
}
|
|
4023
|
-
class Yo extends
|
|
4387
|
+
class Yo extends Be {
|
|
4024
4388
|
constructor(e, o) {
|
|
4025
4389
|
super({ ...e, content: void 0 });
|
|
4026
4390
|
d(this, "_state");
|
|
@@ -4039,14 +4403,14 @@ class Yo extends Me {
|
|
|
4039
4403
|
if (i)
|
|
4040
4404
|
return i;
|
|
4041
4405
|
const c = s.apply(r.nodes.doc, l), u = JSON.parse(JSON.stringify(c.toJSON()));
|
|
4042
|
-
return u.content[0].content[0].attrs.id = "initialBlockId", i =
|
|
4406
|
+
return u.content[0].content[0].attrs.id = "initialBlockId", i = ke.fromJSON(r, u), i;
|
|
4043
4407
|
};
|
|
4044
4408
|
let a;
|
|
4045
4409
|
try {
|
|
4046
4410
|
const l = e == null ? void 0 : e.content.map(
|
|
4047
|
-
(c) =>
|
|
4411
|
+
(c) => H(c, this.schema, o).toJSON()
|
|
4048
4412
|
);
|
|
4049
|
-
a =
|
|
4413
|
+
a = Le(
|
|
4050
4414
|
{
|
|
4051
4415
|
type: "doc",
|
|
4052
4416
|
content: [
|
|
@@ -4067,7 +4431,7 @@ class Yo extends Me {
|
|
|
4067
4431
|
"Error creating document from blocks passed as `initialContent`:\n" + +JSON.stringify(e.content)
|
|
4068
4432
|
);
|
|
4069
4433
|
}
|
|
4070
|
-
this._state =
|
|
4434
|
+
this._state = Ie.create({
|
|
4071
4435
|
doc: a,
|
|
4072
4436
|
schema: this.schema
|
|
4073
4437
|
// selection: selection || undefined,
|
|
@@ -4083,12 +4447,16 @@ class Yo extends Me {
|
|
|
4083
4447
|
*/
|
|
4084
4448
|
createViewAlternative() {
|
|
4085
4449
|
queueMicrotask(() => {
|
|
4086
|
-
this.view = new
|
|
4087
|
-
|
|
4088
|
-
//
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4450
|
+
this.view = new qe(
|
|
4451
|
+
{ mount: this.options.element },
|
|
4452
|
+
// use mount option so that we reuse the existing element instead of creating a new one
|
|
4453
|
+
{
|
|
4454
|
+
...this.options.editorProps,
|
|
4455
|
+
// @ts-ignore
|
|
4456
|
+
dispatchTransaction: this.dispatchTransaction.bind(this),
|
|
4457
|
+
state: this.state
|
|
4458
|
+
}
|
|
4459
|
+
);
|
|
4092
4460
|
const e = this.state.reconfigure({
|
|
4093
4461
|
plugins: this.extensionManager.plugins
|
|
4094
4462
|
});
|
|
@@ -4096,15 +4464,62 @@ class Yo extends Me {
|
|
|
4096
4464
|
});
|
|
4097
4465
|
}
|
|
4098
4466
|
}
|
|
4099
|
-
const Qo = {
|
|
4467
|
+
const Qo = new x("blocknote-placeholder"), Zo = (n, t) => new v({
|
|
4468
|
+
key: Qo,
|
|
4469
|
+
view: () => {
|
|
4470
|
+
const e = document.createElement("style");
|
|
4471
|
+
document.head.appendChild(e);
|
|
4472
|
+
const o = e.sheet, r = (s = "") => `.bn-block-content${s} .bn-inline-content:has(> .ProseMirror-trailingBreak):before`, i = (s, a = !0) => {
|
|
4473
|
+
const l = a ? "[data-is-empty-and-focused]" : "";
|
|
4474
|
+
if (s === "default")
|
|
4475
|
+
return r(l);
|
|
4476
|
+
const c = `[data-content-type="${s}"]`;
|
|
4477
|
+
return r(l + c);
|
|
4478
|
+
};
|
|
4479
|
+
for (const [s, a] of Object.entries(t)) {
|
|
4480
|
+
const l = s === "default";
|
|
4481
|
+
o.insertRule(
|
|
4482
|
+
`${i(s, l)}{ content: ${JSON.stringify(
|
|
4483
|
+
a
|
|
4484
|
+
)}; }`
|
|
4485
|
+
), l || o.insertRule(
|
|
4486
|
+
`${i(s, !0)}{ content: ${JSON.stringify(
|
|
4487
|
+
a
|
|
4488
|
+
)}; }`
|
|
4489
|
+
);
|
|
4490
|
+
}
|
|
4491
|
+
return {
|
|
4492
|
+
destroy: () => {
|
|
4493
|
+
document.head.removeChild(e);
|
|
4494
|
+
}
|
|
4495
|
+
};
|
|
4496
|
+
},
|
|
4497
|
+
props: {
|
|
4498
|
+
// TODO: maybe also add placeholder for empty document ("e.g.: start writing..")
|
|
4499
|
+
decorations: (e) => {
|
|
4500
|
+
const { doc: o, selection: r } = e;
|
|
4501
|
+
if (!n.isEditable || !r.empty)
|
|
4502
|
+
return;
|
|
4503
|
+
const i = r.$anchor, s = i.parent;
|
|
4504
|
+
if (s.content.size > 0)
|
|
4505
|
+
return null;
|
|
4506
|
+
const a = i.before(), l = $.node(a, a + s.nodeSize, {
|
|
4507
|
+
"data-is-empty-and-focused": "true"
|
|
4508
|
+
});
|
|
4509
|
+
return G.create(o, [l]);
|
|
4510
|
+
}
|
|
4511
|
+
}
|
|
4512
|
+
});
|
|
4513
|
+
const tr = {
|
|
4100
4514
|
enableInputRules: !0,
|
|
4101
4515
|
enablePasteRules: !0,
|
|
4102
4516
|
enableCoreExtensions: !1
|
|
4103
4517
|
};
|
|
4104
|
-
class
|
|
4518
|
+
class pe {
|
|
4105
4519
|
constructor(t) {
|
|
4106
4520
|
d(this, "_tiptapEditor");
|
|
4107
4521
|
d(this, "blockCache", /* @__PURE__ */ new WeakMap());
|
|
4522
|
+
d(this, "dictionary");
|
|
4108
4523
|
d(this, "schema");
|
|
4109
4524
|
d(this, "blockImplementations");
|
|
4110
4525
|
d(this, "inlineContentImplementations");
|
|
@@ -4135,21 +4550,26 @@ class ue {
|
|
|
4135
4550
|
throw new Error(
|
|
4136
4551
|
"editable initialization option is deprecated, use <BlockNoteView editable={true/false} />, or alternatively editor.isEditable = true/false"
|
|
4137
4552
|
);
|
|
4553
|
+
this.dictionary = t.dictionary || jt;
|
|
4138
4554
|
const o = {
|
|
4139
4555
|
defaultStyles: !0,
|
|
4140
4556
|
schema: t.schema || Tt.create(),
|
|
4141
|
-
...t
|
|
4557
|
+
...t,
|
|
4558
|
+
placeholders: {
|
|
4559
|
+
...this.dictionary.placeholders,
|
|
4560
|
+
...t.placeholders
|
|
4561
|
+
}
|
|
4142
4562
|
};
|
|
4143
|
-
this.schema = o.schema, this.blockImplementations = o.schema.blockSpecs, this.inlineContentImplementations = o.schema.inlineContentSpecs, this.styleImplementations = o.schema.styleSpecs, this.formattingToolbar = new
|
|
4144
|
-
const r =
|
|
4563
|
+
this.schema = o.schema, this.blockImplementations = o.schema.blockSpecs, this.inlineContentImplementations = o.schema.inlineContentSpecs, this.styleImplementations = o.schema.styleSpecs, this.formattingToolbar = new ho(this), this.linkToolbar = new ko(this), this.sideMenu = new Mo(this), this.suggestionMenus = new vo(this), I("image", this) && (this.imagePanel = new fo(this)), I("table", this) && (this.tableHandles = new Ao(this));
|
|
4564
|
+
const r = Wo({
|
|
4145
4565
|
editor: this,
|
|
4146
|
-
placeholders: o.placeholders,
|
|
4147
4566
|
domAttributes: o.domAttributes || {},
|
|
4148
4567
|
blockSchema: this.schema.blockSchema,
|
|
4149
4568
|
blockSpecs: this.schema.blockSpecs,
|
|
4150
4569
|
styleSpecs: this.schema.styleSpecs,
|
|
4151
4570
|
inlineContentSpecs: this.schema.inlineContentSpecs,
|
|
4152
|
-
collaboration: o.collaboration
|
|
4571
|
+
collaboration: o.collaboration,
|
|
4572
|
+
trailingBlock: o.trailingBlock
|
|
4153
4573
|
}), i = M.create({
|
|
4154
4574
|
name: "BlockNoteUIExtension",
|
|
4155
4575
|
addProseMirrorPlugins: () => [
|
|
@@ -4158,7 +4578,8 @@ class ue {
|
|
|
4158
4578
|
this.sideMenu.plugin,
|
|
4159
4579
|
this.suggestionMenus.plugin,
|
|
4160
4580
|
...this.imagePanel ? [this.imagePanel.plugin] : [],
|
|
4161
|
-
...this.tableHandles ? [this.tableHandles.plugin] : []
|
|
4581
|
+
...this.tableHandles ? [this.tableHandles.plugin] : [],
|
|
4582
|
+
Zo(this, o.placeholders)
|
|
4162
4583
|
]
|
|
4163
4584
|
});
|
|
4164
4585
|
r.push(i), this.uploadFile = o.uploadFile, o.collaboration && o.initialContent && console.warn(
|
|
@@ -4180,7 +4601,7 @@ class ue {
|
|
|
4180
4601
|
"initialContent must be a non-empty array of blocks, received: " + s
|
|
4181
4602
|
);
|
|
4182
4603
|
const a = {
|
|
4183
|
-
...
|
|
4604
|
+
...tr,
|
|
4184
4605
|
...o._tiptapOptions,
|
|
4185
4606
|
content: s,
|
|
4186
4607
|
extensions: o.enableBlockNoteExtensions === !1 ? ((l = o._tiptapOptions) == null ? void 0 : l.extensions) || [] : [...((c = o._tiptapOptions) == null ? void 0 : c.extensions) || [], ...r],
|
|
@@ -4189,7 +4610,7 @@ class ue {
|
|
|
4189
4610
|
attributes: {
|
|
4190
4611
|
...(m = (p = o._tiptapOptions) == null ? void 0 : p.editorProps) == null ? void 0 : m.attributes,
|
|
4191
4612
|
...(h = o.domAttributes) == null ? void 0 : h.editor,
|
|
4192
|
-
class:
|
|
4613
|
+
class: V(
|
|
4193
4614
|
"bn-editor",
|
|
4194
4615
|
o.defaultStyles ? "bn-default-styles" : "",
|
|
4195
4616
|
((k = (f = o.domAttributes) == null ? void 0 : f.editor) == null ? void 0 : k.class) || ""
|
|
@@ -4204,7 +4625,7 @@ class ue {
|
|
|
4204
4625
|
);
|
|
4205
4626
|
}
|
|
4206
4627
|
static create(t = {}) {
|
|
4207
|
-
return new
|
|
4628
|
+
return new pe(t);
|
|
4208
4629
|
}
|
|
4209
4630
|
/**
|
|
4210
4631
|
* Mount the editor to a parent DOM element. Call mount(undefined) to clean up
|
|
@@ -4400,7 +4821,7 @@ class ue {
|
|
|
4400
4821
|
* `referenceBlock`. Inserts the blocks at the start of the existing block's children if "nested" is used.
|
|
4401
4822
|
*/
|
|
4402
4823
|
insertBlocks(t, e, o = "before") {
|
|
4403
|
-
return
|
|
4824
|
+
return Xn(t, e, o, this);
|
|
4404
4825
|
}
|
|
4405
4826
|
/**
|
|
4406
4827
|
* Updates an existing block in the editor. Since updatedBlock is a PartialBlock object, some fields might not be
|
|
@@ -4410,14 +4831,14 @@ class ue {
|
|
|
4410
4831
|
* @param update A partial block which defines how the existing block should be changed.
|
|
4411
4832
|
*/
|
|
4412
4833
|
updateBlock(t, e) {
|
|
4413
|
-
return
|
|
4834
|
+
return Yn(t, e, this);
|
|
4414
4835
|
}
|
|
4415
4836
|
/**
|
|
4416
4837
|
* Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
|
|
4417
4838
|
* @param blocksToRemove An array of identifiers for existing blocks that should be removed.
|
|
4418
4839
|
*/
|
|
4419
4840
|
removeBlocks(t) {
|
|
4420
|
-
return
|
|
4841
|
+
return Qn(t, this);
|
|
4421
4842
|
}
|
|
4422
4843
|
/**
|
|
4423
4844
|
* Replaces existing blocks in the editor with new blocks. If the blocks that should be removed are not adjacent or
|
|
@@ -4427,7 +4848,7 @@ class ue {
|
|
|
4427
4848
|
* @param blocksToInsert An array of partial blocks to replace the old ones with.
|
|
4428
4849
|
*/
|
|
4429
4850
|
replaceBlocks(t, e) {
|
|
4430
|
-
return
|
|
4851
|
+
return Zn(t, e, this);
|
|
4431
4852
|
}
|
|
4432
4853
|
/**
|
|
4433
4854
|
* Insert a piece of content at the current cursor position.
|
|
@@ -4440,7 +4861,7 @@ class ue {
|
|
|
4440
4861
|
this._tiptapEditor.schema,
|
|
4441
4862
|
this.schema.styleSchema
|
|
4442
4863
|
);
|
|
4443
|
-
|
|
4864
|
+
to(
|
|
4444
4865
|
{
|
|
4445
4866
|
from: this._tiptapEditor.state.selection.from,
|
|
4446
4867
|
to: this._tiptapEditor.state.selection.to
|
|
@@ -4469,7 +4890,6 @@ class ue {
|
|
|
4469
4890
|
* @param styles The styles to add.
|
|
4470
4891
|
*/
|
|
4471
4892
|
addStyles(t) {
|
|
4472
|
-
this._tiptapEditor.view.focus();
|
|
4473
4893
|
for (const [e, o] of Object.entries(t)) {
|
|
4474
4894
|
const r = this.schema.styleSchema[e];
|
|
4475
4895
|
if (!r)
|
|
@@ -4487,7 +4907,6 @@ class ue {
|
|
|
4487
4907
|
* @param styles The styles to remove.
|
|
4488
4908
|
*/
|
|
4489
4909
|
removeStyles(t) {
|
|
4490
|
-
this._tiptapEditor.view.focus();
|
|
4491
4910
|
for (const e of Object.keys(t))
|
|
4492
4911
|
this._tiptapEditor.commands.unsetMark(e);
|
|
4493
4912
|
}
|
|
@@ -4496,7 +4915,6 @@ class ue {
|
|
|
4496
4915
|
* @param styles The styles to toggle.
|
|
4497
4916
|
*/
|
|
4498
4917
|
toggleStyles(t) {
|
|
4499
|
-
this._tiptapEditor.view.focus();
|
|
4500
4918
|
for (const [e, o] of Object.entries(t)) {
|
|
4501
4919
|
const r = this.schema.styleSchema[e];
|
|
4502
4920
|
if (!r)
|
|
@@ -4592,7 +5010,7 @@ class ue {
|
|
|
4592
5010
|
* @returns The blocks parsed from the HTML string.
|
|
4593
5011
|
*/
|
|
4594
5012
|
async tryParseHTMLToBlocks(t) {
|
|
4595
|
-
return
|
|
5013
|
+
return de(
|
|
4596
5014
|
t,
|
|
4597
5015
|
this.schema.blockSchema,
|
|
4598
5016
|
this.schema.inlineContentSchema,
|
|
@@ -4607,7 +5025,7 @@ class ue {
|
|
|
4607
5025
|
* @returns The blocks, serialized as a Markdown string.
|
|
4608
5026
|
*/
|
|
4609
5027
|
async blocksToMarkdownLossy(t = this.document) {
|
|
4610
|
-
return
|
|
5028
|
+
return no(t, this._tiptapEditor.schema, this);
|
|
4611
5029
|
}
|
|
4612
5030
|
/**
|
|
4613
5031
|
* Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on
|
|
@@ -4617,7 +5035,7 @@ class ue {
|
|
|
4617
5035
|
* @returns The blocks parsed from the Markdown string.
|
|
4618
5036
|
*/
|
|
4619
5037
|
async tryParseMarkdownToBlocks(t) {
|
|
4620
|
-
return
|
|
5038
|
+
return co(
|
|
4621
5039
|
t,
|
|
4622
5040
|
this.schema.blockSchema,
|
|
4623
5041
|
this.schema.inlineContentSchema,
|
|
@@ -4664,12 +5082,12 @@ class ue {
|
|
|
4664
5082
|
};
|
|
4665
5083
|
}
|
|
4666
5084
|
}
|
|
4667
|
-
function
|
|
5085
|
+
function er(n) {
|
|
4668
5086
|
let t = n.getTextCursorPosition().block, e = n.schema.blockSchema[t.type].content;
|
|
4669
5087
|
for (; e === "none"; )
|
|
4670
5088
|
t = n.getTextCursorPosition().nextBlock, e = n.schema.blockSchema[t.type].content, n.setTextCursorPosition(t, "end");
|
|
4671
5089
|
}
|
|
4672
|
-
function
|
|
5090
|
+
function N(n, t) {
|
|
4673
5091
|
const e = n.getTextCursorPosition().block;
|
|
4674
5092
|
if (e.content === void 0)
|
|
4675
5093
|
throw new Error("Slash Menu open in a block that doesn't contain content.");
|
|
@@ -4678,87 +5096,74 @@ function P(n, t) {
|
|
|
4678
5096
|
"end"
|
|
4679
5097
|
));
|
|
4680
5098
|
const o = n.getTextCursorPosition().block;
|
|
4681
|
-
return
|
|
5099
|
+
return er(n), o;
|
|
4682
5100
|
}
|
|
4683
|
-
function
|
|
5101
|
+
function qr(n) {
|
|
4684
5102
|
const t = [];
|
|
4685
5103
|
return I("heading", n) && t.push(
|
|
4686
5104
|
{
|
|
4687
|
-
title: "Heading 1",
|
|
4688
5105
|
onItemClick: () => {
|
|
4689
|
-
|
|
5106
|
+
N(n, {
|
|
4690
5107
|
type: "heading",
|
|
4691
5108
|
props: { level: 1 }
|
|
4692
5109
|
});
|
|
4693
5110
|
},
|
|
4694
|
-
subtext: "Used for a top-level heading",
|
|
4695
5111
|
badge: F("Mod-Alt-1"),
|
|
4696
|
-
|
|
4697
|
-
|
|
5112
|
+
key: "heading",
|
|
5113
|
+
...n.dictionary.slash_menu.heading
|
|
4698
5114
|
},
|
|
4699
5115
|
{
|
|
4700
|
-
title: "Heading 2",
|
|
4701
5116
|
onItemClick: () => {
|
|
4702
|
-
|
|
5117
|
+
N(n, {
|
|
4703
5118
|
type: "heading",
|
|
4704
5119
|
props: { level: 2 }
|
|
4705
5120
|
});
|
|
4706
5121
|
},
|
|
4707
|
-
subtext: "Used for key sections",
|
|
4708
5122
|
badge: F("Mod-Alt-2"),
|
|
4709
|
-
|
|
4710
|
-
|
|
5123
|
+
key: "heading_2",
|
|
5124
|
+
...n.dictionary.slash_menu.heading_2
|
|
4711
5125
|
},
|
|
4712
5126
|
{
|
|
4713
|
-
title: "Heading 3",
|
|
4714
5127
|
onItemClick: () => {
|
|
4715
|
-
|
|
5128
|
+
N(n, {
|
|
4716
5129
|
type: "heading",
|
|
4717
5130
|
props: { level: 3 }
|
|
4718
5131
|
});
|
|
4719
5132
|
},
|
|
4720
|
-
subtext: "Used for subsections and group headings",
|
|
4721
5133
|
badge: F("Mod-Alt-3"),
|
|
4722
|
-
|
|
4723
|
-
|
|
5134
|
+
key: "heading_3",
|
|
5135
|
+
...n.dictionary.slash_menu.heading_3
|
|
4724
5136
|
}
|
|
4725
5137
|
), I("numberedListItem", n) && t.push({
|
|
4726
|
-
title: "Numbered List",
|
|
4727
5138
|
onItemClick: () => {
|
|
4728
|
-
|
|
5139
|
+
N(n, {
|
|
4729
5140
|
type: "numberedListItem"
|
|
4730
5141
|
});
|
|
4731
5142
|
},
|
|
4732
|
-
subtext: "Used to display a numbered list",
|
|
4733
5143
|
badge: F("Mod-Shift-7"),
|
|
4734
|
-
|
|
4735
|
-
|
|
5144
|
+
key: "numbered_list",
|
|
5145
|
+
...n.dictionary.slash_menu.numbered_list
|
|
4736
5146
|
}), I("bulletListItem", n) && t.push({
|
|
4737
|
-
title: "Bullet List",
|
|
4738
5147
|
onItemClick: () => {
|
|
4739
|
-
|
|
5148
|
+
N(n, {
|
|
4740
5149
|
type: "bulletListItem"
|
|
4741
5150
|
});
|
|
4742
5151
|
},
|
|
4743
|
-
subtext: "Used to display an unordered list",
|
|
4744
5152
|
badge: F("Mod-Shift-8"),
|
|
4745
|
-
|
|
4746
|
-
|
|
5153
|
+
key: "bullet_list",
|
|
5154
|
+
...n.dictionary.slash_menu.bullet_list
|
|
4747
5155
|
}), I("paragraph", n) && t.push({
|
|
4748
|
-
title: "Paragraph",
|
|
4749
5156
|
onItemClick: () => {
|
|
4750
|
-
|
|
5157
|
+
N(n, {
|
|
4751
5158
|
type: "paragraph"
|
|
4752
5159
|
});
|
|
4753
5160
|
},
|
|
4754
|
-
subtext: "Used for the body of your document",
|
|
4755
5161
|
badge: F("Mod-Alt-0"),
|
|
4756
|
-
|
|
4757
|
-
|
|
5162
|
+
key: "paragraph",
|
|
5163
|
+
...n.dictionary.slash_menu.paragraph
|
|
4758
5164
|
}), I("table", n) && t.push({
|
|
4759
|
-
title: "Table",
|
|
4760
5165
|
onItemClick: () => {
|
|
4761
|
-
|
|
5166
|
+
N(n, {
|
|
4762
5167
|
type: "table",
|
|
4763
5168
|
content: {
|
|
4764
5169
|
type: "tableContent",
|
|
@@ -4773,14 +5178,12 @@ function $r(n) {
|
|
|
4773
5178
|
}
|
|
4774
5179
|
});
|
|
4775
5180
|
},
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
badge: void 0
|
|
5181
|
+
badge: void 0,
|
|
5182
|
+
key: "table",
|
|
5183
|
+
...n.dictionary.slash_menu.table
|
|
4780
5184
|
}), I("image", n) && t.push({
|
|
4781
|
-
title: "Image",
|
|
4782
5185
|
onItemClick: () => {
|
|
4783
|
-
const e =
|
|
5186
|
+
const e = N(n, {
|
|
4784
5187
|
type: "image"
|
|
4785
5188
|
});
|
|
4786
5189
|
n.prosemirrorView.dispatch(
|
|
@@ -4789,25 +5192,14 @@ function $r(n) {
|
|
|
4789
5192
|
})
|
|
4790
5193
|
);
|
|
4791
5194
|
},
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
"image",
|
|
4795
|
-
"imageUpload",
|
|
4796
|
-
"upload",
|
|
4797
|
-
"img",
|
|
4798
|
-
"picture",
|
|
4799
|
-
"media",
|
|
4800
|
-
"url",
|
|
4801
|
-
"drive",
|
|
4802
|
-
"dropbox"
|
|
4803
|
-
],
|
|
4804
|
-
group: "Media"
|
|
5195
|
+
key: "image",
|
|
5196
|
+
...n.dictionary.slash_menu.image
|
|
4805
5197
|
}), t;
|
|
4806
5198
|
}
|
|
4807
|
-
function
|
|
5199
|
+
function Wr(n, t) {
|
|
4808
5200
|
return n.filter(
|
|
4809
|
-
({ title: e, aliases: o }) => e.toLowerCase().
|
|
4810
|
-
(r) => r.toLowerCase().
|
|
5201
|
+
({ title: e, aliases: o }) => e.toLowerCase().includes(t.toLowerCase()) || o && o.filter(
|
|
5202
|
+
(r) => r.toLowerCase().includes(t.toLowerCase())
|
|
4811
5203
|
).length !== 0
|
|
4812
5204
|
);
|
|
4813
5205
|
}
|
|
@@ -4820,22 +5212,22 @@ function mt(n = "") {
|
|
|
4820
5212
|
}
|
|
4821
5213
|
] : n;
|
|
4822
5214
|
}
|
|
4823
|
-
function
|
|
4824
|
-
return typeof n == "string" ? mt(n) : Array.isArray(n) ? n.flatMap((t) => typeof t == "string" ? mt(t) :
|
|
5215
|
+
function he(n) {
|
|
5216
|
+
return typeof n == "string" ? mt(n) : Array.isArray(n) ? n.flatMap((t) => typeof t == "string" ? mt(t) : $t(t) ? {
|
|
4825
5217
|
...t,
|
|
4826
5218
|
content: mt(t.content)
|
|
4827
5219
|
} : Q(t) ? t : {
|
|
4828
5220
|
props: {},
|
|
4829
5221
|
...t,
|
|
4830
|
-
content:
|
|
5222
|
+
content: he(t.content)
|
|
4831
5223
|
}) : n;
|
|
4832
5224
|
}
|
|
4833
|
-
function
|
|
5225
|
+
function Jr(n, t) {
|
|
4834
5226
|
return t.map(
|
|
4835
|
-
(e) =>
|
|
5227
|
+
(e) => me(n, e)
|
|
4836
5228
|
);
|
|
4837
5229
|
}
|
|
4838
|
-
function
|
|
5230
|
+
function me(n, t) {
|
|
4839
5231
|
const e = {
|
|
4840
5232
|
id: "",
|
|
4841
5233
|
type: t.type,
|
|
@@ -4850,98 +5242,100 @@ function he(n, t) {
|
|
|
4850
5242
|
}
|
|
4851
5243
|
), {
|
|
4852
5244
|
...e,
|
|
4853
|
-
content:
|
|
4854
|
-
children: e.children.map((o) =>
|
|
5245
|
+
content: he(e.content),
|
|
5246
|
+
children: e.children.map((o) => me(n, o))
|
|
4855
5247
|
};
|
|
4856
5248
|
}
|
|
4857
|
-
function
|
|
4858
|
-
n.id || (n.id = Z.options.generateID()), n.children &&
|
|
5249
|
+
function nr(n) {
|
|
5250
|
+
n.id || (n.id = Z.options.generateID()), n.children && or(n.children);
|
|
4859
5251
|
}
|
|
4860
|
-
function
|
|
5252
|
+
function or(n) {
|
|
4861
5253
|
for (const t of n)
|
|
4862
|
-
|
|
5254
|
+
nr(t);
|
|
4863
5255
|
}
|
|
4864
5256
|
export {
|
|
4865
|
-
|
|
5257
|
+
pe as BlockNoteEditor,
|
|
4866
5258
|
Tt as BlockNoteSchema,
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
5259
|
+
ho as FormattingToolbarProsemirrorPlugin,
|
|
5260
|
+
uo as FormattingToolbarView,
|
|
5261
|
+
fo as ImagePanelProsemirrorPlugin,
|
|
5262
|
+
mo as ImagePanelView,
|
|
5263
|
+
ko as LinkToolbarProsemirrorPlugin,
|
|
5264
|
+
Mo as SideMenuProsemirrorPlugin,
|
|
5265
|
+
xo as SideMenuView,
|
|
5266
|
+
vo as SuggestionMenuProseMirrorPlugin,
|
|
5267
|
+
Ao as TableHandlesProsemirrorPlugin,
|
|
5268
|
+
_o as TableHandlesView,
|
|
4877
5269
|
Z as UniqueID,
|
|
4878
5270
|
A as UnreachableCaseError,
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
5271
|
+
nr as addIdsToBlock,
|
|
5272
|
+
or as addIdsToBlocks,
|
|
5273
|
+
mn as addInlineContentAttributes,
|
|
5274
|
+
fn as addInlineContentKeyboardShortcuts,
|
|
5275
|
+
wn as addStyleAttributes,
|
|
5276
|
+
Or as assertEmpty,
|
|
5277
|
+
H as blockToNode,
|
|
4885
5278
|
st as camelToDataKebab,
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
5279
|
+
$r as checkBlockHasDefaultProp,
|
|
5280
|
+
Gr as checkBlockIsDefaultType,
|
|
5281
|
+
Jn as checkBlockTypeHasDefaultProp,
|
|
4889
5282
|
I as checkDefaultBlockTypeInSchema,
|
|
4890
5283
|
vt as contentNodeToInlineContent,
|
|
4891
|
-
|
|
5284
|
+
hn as createBlockSpec,
|
|
4892
5285
|
et as createBlockSpecFromStronglyTypedTiptapNode,
|
|
4893
5286
|
lt as createExternalHTMLExporter,
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
5287
|
+
Vr as createInlineContentSpec,
|
|
5288
|
+
bn as createInlineContentSpecFromTipTapNode,
|
|
5289
|
+
te as createInternalBlockSpec,
|
|
5290
|
+
Yt as createInternalHTMLSerializer,
|
|
5291
|
+
gn as createInternalInlineContentSpec,
|
|
5292
|
+
oe as createInternalStyleSpec,
|
|
4900
5293
|
q as createStronglyTypedTiptapNode,
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
5294
|
+
zr as createStyleSpec,
|
|
5295
|
+
O as createStyleSpecFromTipTapMark,
|
|
5296
|
+
Kr as createSuggestionMenu,
|
|
4904
5297
|
Wn as defaultBlockSchema,
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
5298
|
+
ie as defaultBlockSpecs,
|
|
5299
|
+
jr as defaultInlineContentSchema,
|
|
5300
|
+
ae as defaultInlineContentSpecs,
|
|
4908
5301
|
w as defaultProps,
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
5302
|
+
Fr as defaultStyleSchema,
|
|
5303
|
+
se as defaultStyleSpecs,
|
|
5304
|
+
Wr as filterSuggestionItems,
|
|
4912
5305
|
F as formatKeyboardShortcut,
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
5306
|
+
po as formattingToolbarPluginKey,
|
|
5307
|
+
un as getBlockFromPos,
|
|
5308
|
+
Wo as getBlockNoteExtensions,
|
|
5309
|
+
ee as getBlockSchemaFromSpecs,
|
|
5310
|
+
qr as getDefaultSlashMenuItems,
|
|
4918
5311
|
xt as getDraggableBlockFromCoords,
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
5312
|
+
kn as getInlineContentParseRules,
|
|
5313
|
+
ne as getInlineContentSchemaFromSpecs,
|
|
5314
|
+
pn as getParseRules,
|
|
5315
|
+
vn as getStyleParseRules,
|
|
5316
|
+
re as getStyleSchemaFromSpecs,
|
|
5317
|
+
Qt as inheritedProps,
|
|
4925
5318
|
at as inlineContentToNodes,
|
|
4926
|
-
|
|
4927
|
-
|
|
5319
|
+
N as insertOrUpdateBlock,
|
|
5320
|
+
dn as isAppleOS,
|
|
4928
5321
|
It as isLinkInlineContent,
|
|
4929
|
-
|
|
4930
|
-
|
|
5322
|
+
$t as isPartialLinkInlineContent,
|
|
5323
|
+
Rr as isSafari,
|
|
4931
5324
|
Q as isStyledTextInlineContent,
|
|
4932
|
-
|
|
4933
|
-
|
|
5325
|
+
bo as linkToolbarPluginKey,
|
|
5326
|
+
Dr as locales,
|
|
5327
|
+
V as mergeCSSClasses,
|
|
4934
5328
|
y as nodeToBlock,
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
5329
|
+
Wt as nodeToCustomInlineContent,
|
|
5330
|
+
me as partialBlockToBlockForTesting,
|
|
5331
|
+
Jr as partialBlocksToBlocksForTesting,
|
|
5332
|
+
Zt as propsToAttributes,
|
|
5333
|
+
To as sideMenuPluginKey,
|
|
5334
|
+
yn as stylePropsToAttributes,
|
|
4941
5335
|
R as suggestionMenuPluginKey,
|
|
4942
|
-
|
|
5336
|
+
Kt as tableContentToNodes,
|
|
4943
5337
|
Y as tableHandlesPluginKey,
|
|
4944
|
-
|
|
5338
|
+
Ur as uploadToTmpFilesDotOrg_DEV_ONLY,
|
|
4945
5339
|
pt as wrapInBlockStructure
|
|
4946
5340
|
};
|
|
4947
5341
|
//# sourceMappingURL=blocknote.js.map
|