@blocknote/core 0.13.3 → 0.13.4
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 +1038 -696
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +6 -6
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +2 -2
- package/src/api/exporters/html/__snapshots__/image/basic/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/nested/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/noCaption/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/noName/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/lists/basic/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/lists/basic/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/lists/nested/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/lists/nested/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/simpleImage/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/basic/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/nested/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/nested/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/internal.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noName/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noName/internal.html +1 -1
- package/src/api/exporters/html/externalHTMLExporter.ts +4 -3
- package/src/api/exporters/html/util/simplifyBlocksRehypePlugin.ts +1 -1
- package/src/api/exporters/markdown/__snapshots__/lists/basic/markdown.md +8 -0
- package/src/api/exporters/markdown/__snapshots__/lists/nested/markdown.md +10 -0
- package/src/api/exporters/markdown/__snapshots__/simpleImage/basic/markdown.md +1 -1
- package/src/api/exporters/markdown/__snapshots__/simpleImage/nested/markdown.md +2 -2
- package/src/api/exporters/markdown/__snapshots__/simpleImage/noCaption/markdown.md +1 -1
- package/src/api/exporters/markdown/__snapshots__/simpleImage/noName/markdown.md +1 -1
- package/src/api/exporters/markdown/markdownExporter.ts +2 -0
- package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +42 -0
- package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +50 -0
- package/src/api/parsers/html/__snapshots__/paste/list-test.json +74 -2
- package/src/api/parsers/html/__snapshots__/paste/parse-mixed-nested-lists.json +135 -10
- package/src/api/parsers/html/__snapshots__/paste/parse-nested-lists-with-paragraphs.json +132 -7
- package/src/api/parsers/html/__snapshots__/paste/parse-nested-lists.json +111 -3
- package/src/api/parsers/html/parseHTML.test.ts +166 -95
- package/src/api/testUtil/cases/customBlocks.ts +3 -0
- package/src/api/testUtil/cases/defaultSchema.ts +71 -0
- package/src/blocks/AudioBlockContent/AudioBlockContent.ts +3 -2
- package/src/blocks/FileBlockContent/FileBlockContent.ts +1 -2
- package/src/blocks/ImageBlockContent/ImageBlockContent.ts +3 -2
- package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +3 -0
- package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +266 -0
- package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +2 -1
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +1 -0
- package/src/blocks/VideoBlockContent/VideoBlockContent.ts +0 -1
- package/src/blocks/defaultBlockTypeGuards.ts +1 -1
- package/src/blocks/defaultBlocks.ts +6 -3
- package/src/editor/Block.css +22 -0
- package/src/editor/BlockNoteEditor.ts +10 -0
- package/src/editor/transformPasted.ts +2 -1
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +13 -0
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +27 -27
- package/src/extensions/TextAlignment/TextAlignmentExtension.ts +7 -1
- package/src/i18n/locales/en.ts +15 -0
- package/src/i18n/locales/fr.ts +14 -0
- package/src/i18n/locales/is.ts +7 -0
- package/src/i18n/locales/ja.ts +24 -1
- package/src/i18n/locales/ko.ts +15 -0
- package/src/i18n/locales/nl.ts +7 -0
- package/src/i18n/locales/pl.ts +7 -0
- package/src/i18n/locales/pt.ts +14 -0
- package/src/i18n/locales/vi.ts +16 -2
- package/src/i18n/locales/zh.ts +16 -0
- package/src/pm-nodes/BlockContainer.ts +16 -4
- package/src/schema/blocks/types.ts +0 -1
- package/types/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.d.ts +7 -0
- package/types/src/api/testUtil/cases/customBlocks.d.ts +74 -42
- package/types/src/api/testUtil/cases/customInlineContent.d.ts +74 -42
- package/types/src/api/testUtil/cases/customStyles.d.ts +74 -42
- package/types/src/blocks/AudioBlockContent/AudioBlockContent.d.ts +0 -3
- package/types/src/blocks/FileBlockContent/FileBlockContent.d.ts +0 -3
- package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +0 -3
- package/types/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.d.ts +55 -0
- package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +0 -3
- package/types/src/blocks/defaultBlocks.d.ts +141 -77
- package/types/src/editor/BlockNoteEditor.d.ts +7 -0
- package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +1 -1
- package/types/src/i18n/locales/en.d.ts +7 -0
- package/types/src/pm-nodes/BlockContainer.d.ts +1 -1
- package/types/src/schema/blocks/types.d.ts +0 -1
package/dist/blocknote.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var Et = Object.defineProperty;
|
|
2
2
|
var Ct = (t, e, o) => e in t ? Et(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
|
|
3
3
|
var c = (t, e, o) => (Ct(t, typeof e != "symbol" ? e + "" : e, o), o);
|
|
4
|
-
import { Slice as
|
|
4
|
+
import { Slice as U, Fragment as T, DOMSerializer as _e, DOMParser as St, Node as Mt } from "prosemirror-model";
|
|
5
5
|
import Ke from "rehype-parse";
|
|
6
6
|
import qe from "rehype-stringify";
|
|
7
|
-
import { unified as
|
|
8
|
-
import { Extension as
|
|
9
|
-
import { Plugin as
|
|
7
|
+
import { unified as we } from "unified";
|
|
8
|
+
import { Extension as B, combineTransactionSteps as Tt, getChangedRanges as Bt, findChildrenInRange as Lt, Node as W, Mark as xe, InputRule as Y, callOrReturn as It, getExtensionField as At, mergeAttributes as Nt, selectionToInsertionEnd as Pt, isTextSelection as Ht, isNodeSelection as Ut, posToDOMRect as ke, getMarkRange as Ne, findParentNode as Dt, findChildren as Pe, extensions as X, Editor as Ot, createDocument as Rt } from "@tiptap/core";
|
|
9
|
+
import { Plugin as _, PluginKey as S, Selection as he, NodeSelection as oe, TextSelection as Z, EditorState as Vt } from "prosemirror-state";
|
|
10
10
|
import { v4 as jt } from "uuid";
|
|
11
|
-
import { fromDom as
|
|
11
|
+
import { fromDom as ye } from "hast-util-from-dom";
|
|
12
12
|
import zt from "@tiptap/extension-bold";
|
|
13
13
|
import Ft from "@tiptap/extension-code";
|
|
14
14
|
import Gt from "@tiptap/extension-italic";
|
|
@@ -23,7 +23,7 @@ import Xe from "remark-gfm";
|
|
|
23
23
|
import Qt from "remark-stringify";
|
|
24
24
|
import eo from "remark-parse";
|
|
25
25
|
import to, { defaultHandlers as oo } from "remark-rehype";
|
|
26
|
-
import { DecorationSet as
|
|
26
|
+
import { DecorationSet as F, Decoration as G, EditorView as io } from "prosemirror-view";
|
|
27
27
|
import no from "@tiptap/extension-collaboration";
|
|
28
28
|
import ro from "@tiptap/extension-collaboration-cursor";
|
|
29
29
|
import { Dropcursor as ao } from "@tiptap/extension-dropcursor";
|
|
@@ -64,6 +64,20 @@ const Ze = {
|
|
|
64
64
|
aliases: ["ul", "li", "list", "bulletlist", "bullet list"],
|
|
65
65
|
group: "Basic blocks"
|
|
66
66
|
},
|
|
67
|
+
check_list: {
|
|
68
|
+
title: "Check List",
|
|
69
|
+
subtext: "Used to display a list with checkboxes",
|
|
70
|
+
aliases: [
|
|
71
|
+
"ul",
|
|
72
|
+
"li",
|
|
73
|
+
"list",
|
|
74
|
+
"checklist",
|
|
75
|
+
"check list",
|
|
76
|
+
"checked list",
|
|
77
|
+
"checkbox"
|
|
78
|
+
],
|
|
79
|
+
group: "Basic blocks"
|
|
80
|
+
},
|
|
67
81
|
paragraph: {
|
|
68
82
|
title: "Paragraph",
|
|
69
83
|
subtext: "Used for the body of your document",
|
|
@@ -129,7 +143,8 @@ const Ze = {
|
|
|
129
143
|
default: "Enter text or type '/' for commands",
|
|
130
144
|
heading: "Heading",
|
|
131
145
|
bulletListItem: "List",
|
|
132
|
-
numberedListItem: "List"
|
|
146
|
+
numberedListItem: "List",
|
|
147
|
+
checkListItem: "List"
|
|
133
148
|
},
|
|
134
149
|
file_blocks: {
|
|
135
150
|
image: {
|
|
@@ -349,6 +364,19 @@ const Ze = {
|
|
|
349
364
|
aliases: ["ul", "li", "liste", "listeàpuces", "liste à puces"],
|
|
350
365
|
group: "Blocs de base"
|
|
351
366
|
},
|
|
367
|
+
check_list: {
|
|
368
|
+
title: "Liste de vérification",
|
|
369
|
+
subtext: "Utilisé pour afficher une liste avec des cases à cocher",
|
|
370
|
+
aliases: [
|
|
371
|
+
"ul",
|
|
372
|
+
"li",
|
|
373
|
+
"liste",
|
|
374
|
+
"liste de vérification",
|
|
375
|
+
"liste cochée",
|
|
376
|
+
"case à cocher"
|
|
377
|
+
],
|
|
378
|
+
group: "Blocs de base"
|
|
379
|
+
},
|
|
352
380
|
paragraph: {
|
|
353
381
|
title: "Paragraphe",
|
|
354
382
|
subtext: "Utilisé pour le corps de votre document",
|
|
@@ -414,7 +442,8 @@ const Ze = {
|
|
|
414
442
|
default: "Entrez du texte ou tapez '/' pour les commandes",
|
|
415
443
|
heading: "Titre",
|
|
416
444
|
bulletListItem: "Liste",
|
|
417
|
-
numberedListItem: "Liste"
|
|
445
|
+
numberedListItem: "Liste",
|
|
446
|
+
checkListItem: "Liste"
|
|
418
447
|
},
|
|
419
448
|
file_blocks: {
|
|
420
449
|
image: {
|
|
@@ -634,6 +663,12 @@ const Ze = {
|
|
|
634
663
|
aliases: ["ul", "li", "listi", "punktalisti"],
|
|
635
664
|
group: "Grunnblokkar"
|
|
636
665
|
},
|
|
666
|
+
check_list: {
|
|
667
|
+
title: "Athugunarlisti",
|
|
668
|
+
subtext: "Notað til að sýna lista með gátreitum",
|
|
669
|
+
aliases: ["ul", "li", "listi", "athugunarlisti", "merktur listi"],
|
|
670
|
+
group: "Grunnblokkar"
|
|
671
|
+
},
|
|
637
672
|
paragraph: {
|
|
638
673
|
title: "Málsgrein",
|
|
639
674
|
subtext: "Notað fyrir meginmál skjalsins",
|
|
@@ -699,7 +734,8 @@ const Ze = {
|
|
|
699
734
|
default: "Sláðu inn texta eða skrifaðu '/' fyrir skipanir",
|
|
700
735
|
heading: "Fyrirsögn",
|
|
701
736
|
bulletListItem: "Listi",
|
|
702
|
-
numberedListItem: "Listi"
|
|
737
|
+
numberedListItem: "Listi",
|
|
738
|
+
checkListItem: "Listi"
|
|
703
739
|
},
|
|
704
740
|
file_blocks: {
|
|
705
741
|
image: {
|
|
@@ -923,7 +959,29 @@ const Ze = {
|
|
|
923
959
|
bullet_list: {
|
|
924
960
|
title: "箇条書き",
|
|
925
961
|
subtext: "箇条書きを表示するために使用",
|
|
926
|
-
aliases: [
|
|
962
|
+
aliases: [
|
|
963
|
+
"ul",
|
|
964
|
+
"li",
|
|
965
|
+
"bulletlist",
|
|
966
|
+
"bullet list",
|
|
967
|
+
"リスト",
|
|
968
|
+
"箇条書きリスト"
|
|
969
|
+
],
|
|
970
|
+
group: "基本ブロック"
|
|
971
|
+
},
|
|
972
|
+
check_list: {
|
|
973
|
+
title: "チェックリスト",
|
|
974
|
+
subtext: "チェックボックス付きリストを表示するために使用されます",
|
|
975
|
+
aliases: [
|
|
976
|
+
"ul",
|
|
977
|
+
"li",
|
|
978
|
+
"list",
|
|
979
|
+
"checklist",
|
|
980
|
+
"checked list",
|
|
981
|
+
"リスト",
|
|
982
|
+
"チェックリスト",
|
|
983
|
+
"チェックされたリスト"
|
|
984
|
+
],
|
|
927
985
|
group: "基本ブロック"
|
|
928
986
|
},
|
|
929
987
|
paragraph: {
|
|
@@ -994,7 +1052,8 @@ const Ze = {
|
|
|
994
1052
|
default: "テキストを入力するか'/' を入力してコマンド選択",
|
|
995
1053
|
heading: "見出し",
|
|
996
1054
|
bulletListItem: "リストを追加",
|
|
997
|
-
numberedListItem: "リストを追加"
|
|
1055
|
+
numberedListItem: "リストを追加",
|
|
1056
|
+
checkListItem: "リストを追加"
|
|
998
1057
|
},
|
|
999
1058
|
file_blocks: {
|
|
1000
1059
|
image: {
|
|
@@ -1214,6 +1273,20 @@ const Ze = {
|
|
|
1214
1273
|
aliases: ["ul", "li", "목록", "글머리 기호 목록", "글머리 목록"],
|
|
1215
1274
|
group: "기본 블록"
|
|
1216
1275
|
},
|
|
1276
|
+
check_list: {
|
|
1277
|
+
title: "체크리스트",
|
|
1278
|
+
subtext: "체크박스가 있는 목록을 표시하는 데 사용",
|
|
1279
|
+
aliases: [
|
|
1280
|
+
"ul",
|
|
1281
|
+
"li",
|
|
1282
|
+
"목록",
|
|
1283
|
+
"체크리스트",
|
|
1284
|
+
"체크 리스트",
|
|
1285
|
+
"체크된 목록",
|
|
1286
|
+
"체크박스"
|
|
1287
|
+
],
|
|
1288
|
+
group: "기본 블록"
|
|
1289
|
+
},
|
|
1217
1290
|
paragraph: {
|
|
1218
1291
|
title: "본문",
|
|
1219
1292
|
subtext: "일반 텍스트",
|
|
@@ -1282,7 +1355,8 @@ const Ze = {
|
|
|
1282
1355
|
default: "텍스트를 입력하거나 /를 입력하여 명령을 입력하세요.",
|
|
1283
1356
|
heading: "제목",
|
|
1284
1357
|
bulletListItem: "목록",
|
|
1285
|
-
numberedListItem: "목록"
|
|
1358
|
+
numberedListItem: "목록",
|
|
1359
|
+
checkListItem: "목록"
|
|
1286
1360
|
},
|
|
1287
1361
|
file_blocks: {
|
|
1288
1362
|
image: {
|
|
@@ -1502,6 +1576,12 @@ const Ze = {
|
|
|
1502
1576
|
aliases: ["ul", "li", "lijst", "puntenlijst", "punten lijst"],
|
|
1503
1577
|
group: "Basisblokken"
|
|
1504
1578
|
},
|
|
1579
|
+
check_list: {
|
|
1580
|
+
title: "Controlelijst",
|
|
1581
|
+
subtext: "Gebruikt om een lijst met selectievakjes weer te geven",
|
|
1582
|
+
aliases: ["ul", "li", "lijst", "aangevinkte lijst", "selectievakje"],
|
|
1583
|
+
group: "Basisblokken"
|
|
1584
|
+
},
|
|
1505
1585
|
paragraph: {
|
|
1506
1586
|
title: "Paragraaf",
|
|
1507
1587
|
subtext: "Gebruikt voor de hoofdtekst van uw document",
|
|
@@ -1569,7 +1649,8 @@ const Ze = {
|
|
|
1569
1649
|
default: "Voer tekst in of type '/' voor commando's",
|
|
1570
1650
|
heading: "Kop",
|
|
1571
1651
|
bulletListItem: "Lijst",
|
|
1572
|
-
numberedListItem: "Lijst"
|
|
1652
|
+
numberedListItem: "Lijst",
|
|
1653
|
+
checkListItem: "Lijst"
|
|
1573
1654
|
},
|
|
1574
1655
|
file_blocks: {
|
|
1575
1656
|
image: {
|
|
@@ -1789,6 +1870,12 @@ const Ze = {
|
|
|
1789
1870
|
aliases: ["ul", "li", "lista", "punktowana lista"],
|
|
1790
1871
|
group: "Podstawowe bloki"
|
|
1791
1872
|
},
|
|
1873
|
+
check_list: {
|
|
1874
|
+
title: "Lista z polami wyboru",
|
|
1875
|
+
subtext: "Używana do wyświetlania listy z polami wyboru",
|
|
1876
|
+
aliases: ["ul", "li", "lista", "lista z polami wyboru", "pole wyboru"],
|
|
1877
|
+
group: "Podstawowe bloki"
|
|
1878
|
+
},
|
|
1792
1879
|
paragraph: {
|
|
1793
1880
|
title: "Akapit",
|
|
1794
1881
|
subtext: "Używany dla treści dokumentu",
|
|
@@ -1846,7 +1933,8 @@ const Ze = {
|
|
|
1846
1933
|
default: "Wprowadź tekst lub wpisz '/' aby użyć poleceń",
|
|
1847
1934
|
heading: "Nagłówek",
|
|
1848
1935
|
bulletListItem: "Lista",
|
|
1849
|
-
numberedListItem: "Lista"
|
|
1936
|
+
numberedListItem: "Lista",
|
|
1937
|
+
checkListItem: "Lista"
|
|
1850
1938
|
},
|
|
1851
1939
|
file_blocks: {
|
|
1852
1940
|
image: {
|
|
@@ -2065,6 +2153,19 @@ const Ze = {
|
|
|
2065
2153
|
aliases: ["ul", "li", "lista", "listamarcadores", "lista com marcadores"],
|
|
2066
2154
|
group: "Blocos Básicos"
|
|
2067
2155
|
},
|
|
2156
|
+
check_list: {
|
|
2157
|
+
title: "Lista de verificação",
|
|
2158
|
+
subtext: "Usado para exibir uma lista com caixas de seleção",
|
|
2159
|
+
aliases: [
|
|
2160
|
+
"ul",
|
|
2161
|
+
"li",
|
|
2162
|
+
"lista",
|
|
2163
|
+
"lista de verificação",
|
|
2164
|
+
"lista marcada",
|
|
2165
|
+
"caixa de seleção"
|
|
2166
|
+
],
|
|
2167
|
+
group: "Blocos básicos"
|
|
2168
|
+
},
|
|
2068
2169
|
paragraph: {
|
|
2069
2170
|
title: "Parágrafo",
|
|
2070
2171
|
subtext: "Usado para o corpo do seu documento",
|
|
@@ -2122,7 +2223,8 @@ const Ze = {
|
|
|
2122
2223
|
default: "Digite texto ou use '/' para comandos",
|
|
2123
2224
|
heading: "Título",
|
|
2124
2225
|
bulletListItem: "Lista",
|
|
2125
|
-
numberedListItem: "Lista"
|
|
2226
|
+
numberedListItem: "Lista",
|
|
2227
|
+
checkListItem: "Lista"
|
|
2126
2228
|
},
|
|
2127
2229
|
file_blocks: {
|
|
2128
2230
|
image: {
|
|
@@ -2310,7 +2412,7 @@ const Ze = {
|
|
|
2310
2412
|
generic: {
|
|
2311
2413
|
ctrl_shortcut: "Ctrl"
|
|
2312
2414
|
}
|
|
2313
|
-
},
|
|
2415
|
+
}, vo = {
|
|
2314
2416
|
slash_menu: {
|
|
2315
2417
|
heading: {
|
|
2316
2418
|
title: "Tiêu đề H1",
|
|
@@ -2333,13 +2435,26 @@ const Ze = {
|
|
|
2333
2435
|
numbered_list: {
|
|
2334
2436
|
title: "Danh sách đánh số",
|
|
2335
2437
|
subtext: "Sử dụng để hiển thị danh sách có đánh số",
|
|
2336
|
-
aliases: ["ol", "li", "ds", "danhsachdso", "danh
|
|
2438
|
+
aliases: ["ol", "li", "ds", "danhsachdso", "danh sach danh so"],
|
|
2337
2439
|
group: "Khối cơ bản"
|
|
2338
2440
|
},
|
|
2339
2441
|
bullet_list: {
|
|
2340
2442
|
title: "Danh sách",
|
|
2341
2443
|
subtext: "Sử dụng để hiển thị danh sách không đánh số",
|
|
2342
|
-
aliases: ["ul", "li", "ds", "danhsach", "danh
|
|
2444
|
+
aliases: ["ul", "li", "ds", "danhsach", "danh sach"],
|
|
2445
|
+
group: "Khối cơ bản"
|
|
2446
|
+
},
|
|
2447
|
+
check_list: {
|
|
2448
|
+
title: "Danh sách kiểm tra",
|
|
2449
|
+
subtext: "Dùng để hiển thị danh sách có hộp kiểm",
|
|
2450
|
+
aliases: [
|
|
2451
|
+
"ul",
|
|
2452
|
+
"li",
|
|
2453
|
+
"danh sach",
|
|
2454
|
+
"danh sach kiem tra",
|
|
2455
|
+
"danh sach da kiem tra",
|
|
2456
|
+
"hop kiem"
|
|
2457
|
+
],
|
|
2343
2458
|
group: "Khối cơ bản"
|
|
2344
2459
|
},
|
|
2345
2460
|
paragraph: {
|
|
@@ -2399,7 +2514,8 @@ const Ze = {
|
|
|
2399
2514
|
default: "Nhập văn bản hoặc gõ '/' để thêm định dạng",
|
|
2400
2515
|
heading: "Tiêu đề",
|
|
2401
2516
|
bulletListItem: "Danh sách",
|
|
2402
|
-
numberedListItem: "Danh sách"
|
|
2517
|
+
numberedListItem: "Danh sách",
|
|
2518
|
+
checkListItem: "Danh sách"
|
|
2403
2519
|
},
|
|
2404
2520
|
file_blocks: {
|
|
2405
2521
|
image: {
|
|
@@ -2587,7 +2703,7 @@ const Ze = {
|
|
|
2587
2703
|
generic: {
|
|
2588
2704
|
ctrl_shortcut: "Ctrl"
|
|
2589
2705
|
}
|
|
2590
|
-
},
|
|
2706
|
+
}, _o = {
|
|
2591
2707
|
slash_menu: {
|
|
2592
2708
|
heading: {
|
|
2593
2709
|
title: "一级标题",
|
|
@@ -2635,6 +2751,21 @@ const Ze = {
|
|
|
2635
2751
|
],
|
|
2636
2752
|
group: "基础"
|
|
2637
2753
|
},
|
|
2754
|
+
check_list: {
|
|
2755
|
+
title: "检查清单",
|
|
2756
|
+
subtext: "用于显示带有复选框的列表",
|
|
2757
|
+
aliases: [
|
|
2758
|
+
"ul",
|
|
2759
|
+
"li",
|
|
2760
|
+
"checklist",
|
|
2761
|
+
"checked list",
|
|
2762
|
+
"列表",
|
|
2763
|
+
"检查清单",
|
|
2764
|
+
"勾选列表",
|
|
2765
|
+
"复选框"
|
|
2766
|
+
],
|
|
2767
|
+
group: "基本块"
|
|
2768
|
+
},
|
|
2638
2769
|
paragraph: {
|
|
2639
2770
|
title: "段落",
|
|
2640
2771
|
subtext: "用于文档正文",
|
|
@@ -2707,7 +2838,8 @@ const Ze = {
|
|
|
2707
2838
|
default: "输入 '/' 以使用命令",
|
|
2708
2839
|
heading: "标题",
|
|
2709
2840
|
bulletListItem: "列表",
|
|
2710
|
-
numberedListItem: "列表"
|
|
2841
|
+
numberedListItem: "列表",
|
|
2842
|
+
checkListItem: "列表"
|
|
2711
2843
|
},
|
|
2712
2844
|
file_blocks: {
|
|
2713
2845
|
image: {
|
|
@@ -2895,7 +3027,7 @@ const Ze = {
|
|
|
2895
3027
|
generic: {
|
|
2896
3028
|
ctrl_shortcut: "Ctrl"
|
|
2897
3029
|
}
|
|
2898
|
-
},
|
|
3030
|
+
}, Mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2899
3031
|
__proto__: null,
|
|
2900
3032
|
en: Ze,
|
|
2901
3033
|
fr: ho,
|
|
@@ -2905,10 +3037,10 @@ const Ze = {
|
|
|
2905
3037
|
nl: bo,
|
|
2906
3038
|
pl: ko,
|
|
2907
3039
|
pt: yo,
|
|
2908
|
-
vi:
|
|
2909
|
-
zh:
|
|
3040
|
+
vi: vo,
|
|
3041
|
+
zh: _o
|
|
2910
3042
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2911
|
-
function
|
|
3043
|
+
function wo(t, e = JSON.stringify) {
|
|
2912
3044
|
const o = {};
|
|
2913
3045
|
return t.filter((i) => {
|
|
2914
3046
|
const n = e(i);
|
|
@@ -2919,9 +3051,9 @@ function xo(t) {
|
|
|
2919
3051
|
const e = t.filter(
|
|
2920
3052
|
(i, n) => t.indexOf(i) !== n
|
|
2921
3053
|
);
|
|
2922
|
-
return
|
|
3054
|
+
return wo(e);
|
|
2923
3055
|
}
|
|
2924
|
-
const
|
|
3056
|
+
const ee = B.create({
|
|
2925
3057
|
name: "uniqueID",
|
|
2926
3058
|
// we’ll set a very high priority to make sure this runs first
|
|
2927
3059
|
// and is compatible with `appendTransaction` hooks of other extensions
|
|
@@ -2989,12 +3121,12 @@ const J = T.create({
|
|
|
2989
3121
|
addProseMirrorPlugins() {
|
|
2990
3122
|
let t = null, e = !1;
|
|
2991
3123
|
return [
|
|
2992
|
-
new
|
|
2993
|
-
key: new
|
|
3124
|
+
new _({
|
|
3125
|
+
key: new S("uniqueID"),
|
|
2994
3126
|
appendTransaction: (o, i, n) => {
|
|
2995
|
-
const r = o.some((
|
|
2996
|
-
let g,
|
|
2997
|
-
return !(!((
|
|
3127
|
+
const r = o.some((f) => f.docChanged) && !i.doc.eq(n.doc), a = this.options.filterTransaction && o.some((f) => {
|
|
3128
|
+
let g, k;
|
|
3129
|
+
return !(!((k = (g = this.options).filterTransaction) === null || k === void 0) && k.call(g, f));
|
|
2998
3130
|
});
|
|
2999
3131
|
if (!r || a)
|
|
3000
3132
|
return;
|
|
@@ -3002,38 +3134,38 @@ const J = T.create({
|
|
|
3002
3134
|
i.doc,
|
|
3003
3135
|
o
|
|
3004
3136
|
), { mapping: h } = p;
|
|
3005
|
-
if (Bt(p).forEach(({ newRange:
|
|
3137
|
+
if (Bt(p).forEach(({ newRange: f }) => {
|
|
3006
3138
|
const g = Lt(
|
|
3007
3139
|
n.doc,
|
|
3008
|
-
|
|
3009
|
-
(
|
|
3010
|
-
),
|
|
3011
|
-
g.forEach(({ node:
|
|
3012
|
-
let
|
|
3013
|
-
const
|
|
3014
|
-
if (
|
|
3015
|
-
const
|
|
3016
|
-
if (i.doc.content.findDiffStart(
|
|
3017
|
-
const
|
|
3140
|
+
f,
|
|
3141
|
+
(M) => l.includes(M.type.name)
|
|
3142
|
+
), k = g.map(({ node: M }) => M.attrs[d]).filter((M) => M !== null), L = xo(k);
|
|
3143
|
+
g.forEach(({ node: M, pos: q }) => {
|
|
3144
|
+
let pe;
|
|
3145
|
+
const Le = (pe = s.doc.nodeAt(q)) === null || pe === void 0 ? void 0 : pe.attrs[d];
|
|
3146
|
+
if (Le === null) {
|
|
3147
|
+
const Ie = i.doc.type.createAndFill().content;
|
|
3148
|
+
if (i.doc.content.findDiffStart(Ie) === null) {
|
|
3149
|
+
const Ae = JSON.parse(
|
|
3018
3150
|
JSON.stringify(n.doc.toJSON())
|
|
3019
3151
|
);
|
|
3020
|
-
if (
|
|
3021
|
-
s.setNodeMarkup(
|
|
3022
|
-
...
|
|
3152
|
+
if (Ae.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(Ae.content) === JSON.stringify(Ie.toJSON())) {
|
|
3153
|
+
s.setNodeMarkup(q, void 0, {
|
|
3154
|
+
...M.attrs,
|
|
3023
3155
|
[d]: "initialBlockId"
|
|
3024
3156
|
});
|
|
3025
3157
|
return;
|
|
3026
3158
|
}
|
|
3027
3159
|
}
|
|
3028
|
-
s.setNodeMarkup(
|
|
3029
|
-
...
|
|
3160
|
+
s.setNodeMarkup(q, void 0, {
|
|
3161
|
+
...M.attrs,
|
|
3030
3162
|
[d]: u()
|
|
3031
3163
|
});
|
|
3032
3164
|
return;
|
|
3033
3165
|
}
|
|
3034
|
-
const { deleted: xt } = h.invert().mapResult(
|
|
3035
|
-
xt &&
|
|
3036
|
-
...
|
|
3166
|
+
const { deleted: xt } = h.invert().mapResult(q);
|
|
3167
|
+
xt && L.includes(Le) && s.setNodeMarkup(q, void 0, {
|
|
3168
|
+
...M.attrs,
|
|
3037
3169
|
[d]: u()
|
|
3038
3170
|
});
|
|
3039
3171
|
});
|
|
@@ -3090,9 +3222,9 @@ const J = T.create({
|
|
|
3090
3222
|
l.marks
|
|
3091
3223
|
);
|
|
3092
3224
|
s.push(d);
|
|
3093
|
-
}),
|
|
3225
|
+
}), T.from(s);
|
|
3094
3226
|
};
|
|
3095
|
-
return e = !1, new
|
|
3227
|
+
return e = !1, new U(
|
|
3096
3228
|
r(o.content),
|
|
3097
3229
|
o.openStart,
|
|
3098
3230
|
o.openEnd
|
|
@@ -3133,7 +3265,7 @@ function b(t, e) {
|
|
|
3133
3265
|
break;
|
|
3134
3266
|
s -= 1, a = n.node(s);
|
|
3135
3267
|
}
|
|
3136
|
-
const { id: l, contentNode: d, contentType: u, numChildBlocks: p } = Je(a), h = n.start(s),
|
|
3268
|
+
const { id: l, contentNode: d, contentType: u, numChildBlocks: p } = Je(a), h = n.start(s), m = n.end(s);
|
|
3137
3269
|
return {
|
|
3138
3270
|
id: l,
|
|
3139
3271
|
node: a,
|
|
@@ -3141,7 +3273,7 @@ function b(t, e) {
|
|
|
3141
3273
|
contentType: u,
|
|
3142
3274
|
numChildBlocks: p,
|
|
3143
3275
|
startPos: h,
|
|
3144
|
-
endPos:
|
|
3276
|
+
endPos: m,
|
|
3145
3277
|
depth: s
|
|
3146
3278
|
};
|
|
3147
3279
|
}
|
|
@@ -3151,7 +3283,7 @@ function He(t) {
|
|
|
3151
3283
|
function Ye(t) {
|
|
3152
3284
|
return typeof t != "string" && t.type === "link";
|
|
3153
3285
|
}
|
|
3154
|
-
function
|
|
3286
|
+
function Q(t) {
|
|
3155
3287
|
return typeof t != "string" && t.type === "text";
|
|
3156
3288
|
}
|
|
3157
3289
|
class I extends Error {
|
|
@@ -3159,7 +3291,7 @@ class I extends Error {
|
|
|
3159
3291
|
super(`Unreachable case: ${e}`);
|
|
3160
3292
|
}
|
|
3161
3293
|
}
|
|
3162
|
-
function
|
|
3294
|
+
function Tr(t, e = !0) {
|
|
3163
3295
|
const { "data-test": o, ...i } = t;
|
|
3164
3296
|
if (Object.keys(i).length > 0 && e)
|
|
3165
3297
|
throw new Error("Object must be empty " + JSON.stringify(t));
|
|
@@ -3184,7 +3316,7 @@ function Eo(t, e, o) {
|
|
|
3184
3316
|
const i = e.marks.link.create({
|
|
3185
3317
|
href: t.href
|
|
3186
3318
|
});
|
|
3187
|
-
return
|
|
3319
|
+
return ve(t.content, e, o).map(
|
|
3188
3320
|
(n) => {
|
|
3189
3321
|
if (n.type.name === "text")
|
|
3190
3322
|
return n.mark([...n.marks, i]);
|
|
@@ -3194,7 +3326,7 @@ function Eo(t, e, o) {
|
|
|
3194
3326
|
}
|
|
3195
3327
|
);
|
|
3196
3328
|
}
|
|
3197
|
-
function
|
|
3329
|
+
function ve(t, e, o) {
|
|
3198
3330
|
const i = [];
|
|
3199
3331
|
if (typeof t == "string")
|
|
3200
3332
|
return i.push(
|
|
@@ -3208,10 +3340,10 @@ function be(t, e, o) {
|
|
|
3208
3340
|
i.push(...Ue(n, e, o));
|
|
3209
3341
|
return i;
|
|
3210
3342
|
}
|
|
3211
|
-
function
|
|
3343
|
+
function ne(t, e, o) {
|
|
3212
3344
|
const i = [];
|
|
3213
3345
|
for (const n of t)
|
|
3214
|
-
typeof n == "string" ? i.push(...
|
|
3346
|
+
typeof n == "string" ? i.push(...ve(n, e, o)) : Ye(n) ? i.push(...Eo(n, e, o)) : Q(n) ? i.push(...ve([n], e, o)) : i.push(
|
|
3215
3347
|
et(n, e, o)
|
|
3216
3348
|
);
|
|
3217
3349
|
return i;
|
|
@@ -3227,7 +3359,7 @@ function Qe(t, e, o) {
|
|
|
3227
3359
|
else if (typeof s == "string")
|
|
3228
3360
|
l = e.nodes.tableParagraph.create({}, e.text(s));
|
|
3229
3361
|
else {
|
|
3230
|
-
const u =
|
|
3362
|
+
const u = ne(s, e, o);
|
|
3231
3363
|
l = e.nodes.tableParagraph.create({}, u);
|
|
3232
3364
|
}
|
|
3233
3365
|
const d = e.nodes.tableCell.create({}, l);
|
|
@@ -3250,7 +3382,7 @@ function et(t, e, o) {
|
|
|
3250
3382
|
e.text(t.content)
|
|
3251
3383
|
);
|
|
3252
3384
|
else if (Array.isArray(t.content)) {
|
|
3253
|
-
const r =
|
|
3385
|
+
const r = ne(t.content, e, o);
|
|
3254
3386
|
i = e.nodes[n].create(t.props, r);
|
|
3255
3387
|
} else if (t.content.type === "tableContent") {
|
|
3256
3388
|
const r = Qe(t.content, e, o);
|
|
@@ -3261,7 +3393,7 @@ function et(t, e, o) {
|
|
|
3261
3393
|
}
|
|
3262
3394
|
function N(t, e, o) {
|
|
3263
3395
|
let i = t.id;
|
|
3264
|
-
i === void 0 && (i =
|
|
3396
|
+
i === void 0 && (i = ee.options.generateID());
|
|
3265
3397
|
const n = et(
|
|
3266
3398
|
t,
|
|
3267
3399
|
e,
|
|
@@ -3290,7 +3422,7 @@ function Co(t, e, o) {
|
|
|
3290
3422
|
};
|
|
3291
3423
|
n.content.forEach((a) => {
|
|
3292
3424
|
r.cells.push(
|
|
3293
|
-
|
|
3425
|
+
Ee(
|
|
3294
3426
|
a.firstChild,
|
|
3295
3427
|
e,
|
|
3296
3428
|
o
|
|
@@ -3299,13 +3431,13 @@ function Co(t, e, o) {
|
|
|
3299
3431
|
}), i.rows.push(r);
|
|
3300
3432
|
}), i;
|
|
3301
3433
|
}
|
|
3302
|
-
function
|
|
3434
|
+
function Ee(t, e, o) {
|
|
3303
3435
|
const i = [];
|
|
3304
3436
|
let n;
|
|
3305
3437
|
return t.content.forEach((r) => {
|
|
3306
3438
|
if (r.type.name === "hardBreak") {
|
|
3307
3439
|
if (n)
|
|
3308
|
-
if (
|
|
3440
|
+
if (Q(n))
|
|
3309
3441
|
n.text += `
|
|
3310
3442
|
`;
|
|
3311
3443
|
else if (He(n))
|
|
@@ -3344,7 +3476,7 @@ function ve(t, e, o) {
|
|
|
3344
3476
|
else
|
|
3345
3477
|
throw new I(d.propSchema);
|
|
3346
3478
|
}
|
|
3347
|
-
n ?
|
|
3479
|
+
n ? Q(n) ? s ? (i.push(n), n = {
|
|
3348
3480
|
type: "link",
|
|
3349
3481
|
href: s.attrs.href,
|
|
3350
3482
|
content: [
|
|
@@ -3406,7 +3538,7 @@ function tt(t, e, o) {
|
|
|
3406
3538
|
s in d && (i[s] = l);
|
|
3407
3539
|
}
|
|
3408
3540
|
let r;
|
|
3409
|
-
return n.content === "styled" ? r =
|
|
3541
|
+
return n.content === "styled" ? r = Ee(
|
|
3410
3542
|
t,
|
|
3411
3543
|
e,
|
|
3412
3544
|
o
|
|
@@ -3416,7 +3548,7 @@ function tt(t, e, o) {
|
|
|
3416
3548
|
content: r
|
|
3417
3549
|
};
|
|
3418
3550
|
}
|
|
3419
|
-
function
|
|
3551
|
+
function v(t, e, o, i, n) {
|
|
3420
3552
|
if (t.type.name !== "blockContainer")
|
|
3421
3553
|
throw Error(
|
|
3422
3554
|
"Node must be of type blockContainer, but is of type" + t.type.name + "."
|
|
@@ -3426,9 +3558,9 @@ function _(t, e, o, i, n) {
|
|
|
3426
3558
|
return r;
|
|
3427
3559
|
const a = Je(t);
|
|
3428
3560
|
let s = a.id;
|
|
3429
|
-
s === null && (s =
|
|
3561
|
+
s === null && (s = ee.options.generateID());
|
|
3430
3562
|
const l = {};
|
|
3431
|
-
for (const [
|
|
3563
|
+
for (const [m, f] of Object.entries({
|
|
3432
3564
|
...t.attrs,
|
|
3433
3565
|
...a.contentNode.attrs
|
|
3434
3566
|
})) {
|
|
@@ -3437,14 +3569,14 @@ function _(t, e, o, i, n) {
|
|
|
3437
3569
|
throw Error(
|
|
3438
3570
|
"Block is of an unrecognized type: " + a.contentType.name
|
|
3439
3571
|
);
|
|
3440
|
-
const
|
|
3441
|
-
|
|
3572
|
+
const k = g.propSchema;
|
|
3573
|
+
m in k && (l[m] = f);
|
|
3442
3574
|
}
|
|
3443
3575
|
const d = e[a.contentType.name], u = [];
|
|
3444
|
-
for (let
|
|
3576
|
+
for (let m = 0; m < a.numChildBlocks; m++)
|
|
3445
3577
|
u.push(
|
|
3446
|
-
|
|
3447
|
-
t.lastChild.child(
|
|
3578
|
+
v(
|
|
3579
|
+
t.lastChild.child(m),
|
|
3448
3580
|
e,
|
|
3449
3581
|
o,
|
|
3450
3582
|
i,
|
|
@@ -3453,7 +3585,7 @@ function _(t, e, o, i, n) {
|
|
|
3453
3585
|
);
|
|
3454
3586
|
let p;
|
|
3455
3587
|
if (d.content === "inline")
|
|
3456
|
-
p =
|
|
3588
|
+
p = Ee(
|
|
3457
3589
|
a.contentNode,
|
|
3458
3590
|
o,
|
|
3459
3591
|
i
|
|
@@ -3483,7 +3615,7 @@ function So(t) {
|
|
|
3483
3615
|
const ot = (t, e, o, i, n) => {
|
|
3484
3616
|
if (!o.nodes[t.type.name])
|
|
3485
3617
|
throw new Error("Serializer is missing a node type: " + t.type.name);
|
|
3486
|
-
const { dom: r, contentDOM: a } =
|
|
3618
|
+
const { dom: r, contentDOM: a } = _e.renderSpec(
|
|
3487
3619
|
So(e),
|
|
3488
3620
|
o.nodes[t.type.name](t)
|
|
3489
3621
|
);
|
|
@@ -3494,7 +3626,7 @@ const ot = (t, e, o, i, n) => {
|
|
|
3494
3626
|
const s = t.childCount > 0 && t.firstChild.type.spec.group === "blockContent" ? t.firstChild : void 0, l = t.childCount > 0 && t.lastChild.type.spec.group === "blockGroup" ? t.lastChild : void 0;
|
|
3495
3627
|
if (s !== void 0) {
|
|
3496
3628
|
const d = i.blockImplementations[s.type.name].implementation, p = (n ? d.toExternalHTML : d.toInternalHTML)(
|
|
3497
|
-
|
|
3629
|
+
v(
|
|
3498
3630
|
t,
|
|
3499
3631
|
i.schema.blockSchema,
|
|
3500
3632
|
i.schema.inlineContentSchema,
|
|
@@ -3515,7 +3647,7 @@ const ot = (t, e, o, i, n) => {
|
|
|
3515
3647
|
a.appendChild(p.dom);
|
|
3516
3648
|
}
|
|
3517
3649
|
l !== void 0 && o.serializeFragment(
|
|
3518
|
-
|
|
3650
|
+
T.from(l),
|
|
3519
3651
|
e,
|
|
3520
3652
|
a
|
|
3521
3653
|
);
|
|
@@ -3541,30 +3673,30 @@ function Mo(t) {
|
|
|
3541
3673
|
for (let s = 0; s < n; s++) {
|
|
3542
3674
|
const d = i.children[s].children[0], u = d.children[0], p = d.children.length === 2 ? d.children[1] : null, h = e.has(
|
|
3543
3675
|
u.properties.dataContentType
|
|
3544
|
-
),
|
|
3676
|
+
), m = h ? t.orderedListItemBlockTypes.has(
|
|
3545
3677
|
u.properties.dataContentType
|
|
3546
3678
|
) ? "ol" : "ul" : null;
|
|
3547
|
-
if (p !== null && o(p), r && r.tagName !==
|
|
3679
|
+
if (p !== null && o(p), r && r.tagName !== m) {
|
|
3548
3680
|
i.children.splice(
|
|
3549
3681
|
s - r.children.length,
|
|
3550
3682
|
r.children.length,
|
|
3551
3683
|
r
|
|
3552
3684
|
);
|
|
3553
|
-
const
|
|
3554
|
-
s -=
|
|
3685
|
+
const f = r.children.length - 1;
|
|
3686
|
+
s -= f, n -= f, r = void 0;
|
|
3555
3687
|
}
|
|
3556
3688
|
if (h) {
|
|
3557
|
-
r || (r =
|
|
3558
|
-
document.createElement(
|
|
3689
|
+
r || (r = ye(
|
|
3690
|
+
document.createElement(m)
|
|
3559
3691
|
));
|
|
3560
|
-
const
|
|
3692
|
+
const f = ye(
|
|
3561
3693
|
document.createElement("li")
|
|
3562
3694
|
);
|
|
3563
|
-
|
|
3695
|
+
f.children.push(...u.children), p !== null && f.children.push(...p.children), r.children.push(f);
|
|
3564
3696
|
} else if (p !== null) {
|
|
3565
3697
|
i.children.splice(s + 1, 0, ...p.children), i.children[s] = u.children[0];
|
|
3566
|
-
const
|
|
3567
|
-
s +=
|
|
3698
|
+
const f = p.children.length;
|
|
3699
|
+
s += f, n += f;
|
|
3568
3700
|
} else
|
|
3569
3701
|
i.children[s] = u.children[0];
|
|
3570
3702
|
}
|
|
@@ -3576,43 +3708,46 @@ function Mo(t) {
|
|
|
3576
3708
|
};
|
|
3577
3709
|
return o;
|
|
3578
3710
|
}
|
|
3579
|
-
const
|
|
3580
|
-
const o =
|
|
3581
|
-
return o.serializeNodeInner = (i, n) => ot(i, n, o, e, !0), o.exportProseMirrorFragment = (i) =>
|
|
3711
|
+
const re = (t, e) => {
|
|
3712
|
+
const o = _e.fromSchema(t);
|
|
3713
|
+
return o.serializeNodeInner = (i, n) => ot(i, n, o, e, !0), o.exportProseMirrorFragment = (i) => we().use(Ke, { fragment: !0 }).use(Mo, {
|
|
3582
3714
|
orderedListItemBlockTypes: /* @__PURE__ */ new Set(["numberedListItem"]),
|
|
3583
|
-
unorderedListItemBlockTypes: /* @__PURE__ */ new Set([
|
|
3715
|
+
unorderedListItemBlockTypes: /* @__PURE__ */ new Set([
|
|
3716
|
+
"bulletListItem",
|
|
3717
|
+
"checkListItem"
|
|
3718
|
+
])
|
|
3584
3719
|
}).use(qe).processSync(it(i, o)).value, o.exportBlocks = (i) => {
|
|
3585
3720
|
const n = i.map(
|
|
3586
3721
|
(a) => N(a, t, e.schema.styleSchema)
|
|
3587
3722
|
), r = t.nodes.blockGroup.create(null, n);
|
|
3588
|
-
return o.exportProseMirrorFragment(
|
|
3723
|
+
return o.exportProseMirrorFragment(T.from(r));
|
|
3589
3724
|
}, o;
|
|
3590
3725
|
}, nt = (t, e) => {
|
|
3591
|
-
const o =
|
|
3726
|
+
const o = _e.fromSchema(t);
|
|
3592
3727
|
return o.serializeNodeInner = (i, n) => ot(i, n, o, e, !1), o.serializeProseMirrorFragment = (i) => it(i, o), o.serializeBlocks = (i) => {
|
|
3593
3728
|
const n = i.map(
|
|
3594
3729
|
(a) => N(a, t, e.schema.styleSchema)
|
|
3595
3730
|
), r = t.nodes.blockGroup.create(null, n);
|
|
3596
|
-
return o.serializeProseMirrorFragment(
|
|
3731
|
+
return o.serializeProseMirrorFragment(T.from(r));
|
|
3597
3732
|
}, o;
|
|
3598
3733
|
}, To = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
|
|
3599
|
-
function
|
|
3734
|
+
function P(t, e = "Ctrl") {
|
|
3600
3735
|
return To() ? t.replace("Mod", "⌘") : t.replace("Mod", e);
|
|
3601
3736
|
}
|
|
3602
|
-
function
|
|
3737
|
+
function O(...t) {
|
|
3603
3738
|
return t.filter((e) => e).join(" ");
|
|
3604
3739
|
}
|
|
3605
|
-
const
|
|
3606
|
-
function
|
|
3740
|
+
const Br = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
3741
|
+
function R(t, e, o, i) {
|
|
3607
3742
|
const n = document.createElement("div");
|
|
3608
|
-
n.className =
|
|
3743
|
+
n.className = O(
|
|
3609
3744
|
"bn-block-content",
|
|
3610
3745
|
o.class
|
|
3611
3746
|
), n.setAttribute("data-content-type", t);
|
|
3612
3747
|
for (const [a, s] of Object.entries(o))
|
|
3613
3748
|
a !== "class" && n.setAttribute(a, s);
|
|
3614
3749
|
const r = document.createElement(e);
|
|
3615
|
-
r.className =
|
|
3750
|
+
r.className = O(
|
|
3616
3751
|
"bn-inline-content",
|
|
3617
3752
|
i.class
|
|
3618
3753
|
);
|
|
@@ -3641,7 +3776,7 @@ const De = (t, e) => {
|
|
|
3641
3776
|
"Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property."
|
|
3642
3777
|
);
|
|
3643
3778
|
return n;
|
|
3644
|
-
},
|
|
3779
|
+
}, y = {
|
|
3645
3780
|
backgroundColor: {
|
|
3646
3781
|
default: "default"
|
|
3647
3782
|
},
|
|
@@ -3653,10 +3788,10 @@ const De = (t, e) => {
|
|
|
3653
3788
|
values: ["left", "center", "right", "justify"]
|
|
3654
3789
|
}
|
|
3655
3790
|
}, rt = ["backgroundColor", "textColor"];
|
|
3656
|
-
function
|
|
3791
|
+
function ie(t) {
|
|
3657
3792
|
return "data-" + t.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
3658
3793
|
}
|
|
3659
|
-
function
|
|
3794
|
+
function Lr(t) {
|
|
3660
3795
|
const e = t.split("/");
|
|
3661
3796
|
return !e.length || // invalid?
|
|
3662
3797
|
e[e.length - 1] === "" ? t : e[e.length - 1];
|
|
@@ -3671,7 +3806,7 @@ function at(t) {
|
|
|
3671
3806
|
// value is the same as its default, we don't display an HTML
|
|
3672
3807
|
// attribute for it.
|
|
3673
3808
|
parseHTML: (n) => {
|
|
3674
|
-
const r = n.getAttribute(
|
|
3809
|
+
const r = n.getAttribute(ie(o));
|
|
3675
3810
|
if (r === null)
|
|
3676
3811
|
return null;
|
|
3677
3812
|
if (typeof i.default == "boolean")
|
|
@@ -3683,7 +3818,7 @@ function at(t) {
|
|
|
3683
3818
|
return r;
|
|
3684
3819
|
},
|
|
3685
3820
|
renderHTML: (n) => n[o] !== i.default ? {
|
|
3686
|
-
[
|
|
3821
|
+
[ie(o)]: n[o]
|
|
3687
3822
|
} : {}
|
|
3688
3823
|
};
|
|
3689
3824
|
}), e;
|
|
@@ -3701,18 +3836,18 @@ function Bo(t, e, o, i) {
|
|
|
3701
3836
|
throw new Error("Block type does not match");
|
|
3702
3837
|
return s;
|
|
3703
3838
|
}
|
|
3704
|
-
function
|
|
3839
|
+
function me(t, e, o, i, n = !1, r) {
|
|
3705
3840
|
const a = document.createElement("div");
|
|
3706
3841
|
if (r !== void 0)
|
|
3707
3842
|
for (const [s, l] of Object.entries(r))
|
|
3708
3843
|
s !== "class" && a.setAttribute(s, l);
|
|
3709
|
-
a.className =
|
|
3844
|
+
a.className = O(
|
|
3710
3845
|
"bn-block-content",
|
|
3711
3846
|
(r == null ? void 0 : r.class) || ""
|
|
3712
3847
|
), a.setAttribute("data-content-type", e);
|
|
3713
3848
|
for (const [s, l] of Object.entries(o))
|
|
3714
|
-
!rt.includes(s) && l !== i[s].default && a.setAttribute(
|
|
3715
|
-
return n && a.setAttribute("data-file-block", ""), a.appendChild(t.dom), t.contentDOM !== void 0 && (t.contentDOM.className =
|
|
3849
|
+
!rt.includes(s) && l !== i[s].default && a.setAttribute(ie(s), l);
|
|
3850
|
+
return n && a.setAttribute("data-file-block", ""), a.appendChild(t.dom), t.contentDOM !== void 0 && (t.contentDOM.className = O(
|
|
3716
3851
|
"bn-inline-content",
|
|
3717
3852
|
t.contentDOM.className
|
|
3718
3853
|
), t.contentDOM.setAttribute("data-editable", "")), {
|
|
@@ -3720,8 +3855,8 @@ function pe(t, e, o, i, n = !1, r) {
|
|
|
3720
3855
|
dom: a
|
|
3721
3856
|
};
|
|
3722
3857
|
}
|
|
3723
|
-
function
|
|
3724
|
-
return
|
|
3858
|
+
function j(t) {
|
|
3859
|
+
return W.create(t);
|
|
3725
3860
|
}
|
|
3726
3861
|
function st(t, e) {
|
|
3727
3862
|
return {
|
|
@@ -3729,7 +3864,7 @@ function st(t, e) {
|
|
|
3729
3864
|
implementation: e
|
|
3730
3865
|
};
|
|
3731
3866
|
}
|
|
3732
|
-
function
|
|
3867
|
+
function $(t, e, o) {
|
|
3733
3868
|
return st(
|
|
3734
3869
|
{
|
|
3735
3870
|
type: t.name,
|
|
@@ -3767,8 +3902,8 @@ function Lo(t, e) {
|
|
|
3767
3902
|
}
|
|
3768
3903
|
}), o;
|
|
3769
3904
|
}
|
|
3770
|
-
function
|
|
3771
|
-
const o =
|
|
3905
|
+
function ae(t, e) {
|
|
3906
|
+
const o = j({
|
|
3772
3907
|
name: t.type,
|
|
3773
3908
|
content: t.content === "inline" ? "inline*" : "",
|
|
3774
3909
|
group: "blockContent",
|
|
@@ -3794,7 +3929,7 @@ function re(t, e) {
|
|
|
3794
3929
|
this.editor,
|
|
3795
3930
|
t.type
|
|
3796
3931
|
), a = ((l = this.options.domAttributes) == null ? void 0 : l.blockContent) || {}, s = e.render(r, n);
|
|
3797
|
-
return
|
|
3932
|
+
return me(
|
|
3798
3933
|
s,
|
|
3799
3934
|
r.type,
|
|
3800
3935
|
r.props,
|
|
@@ -3813,7 +3948,7 @@ function re(t, e) {
|
|
|
3813
3948
|
toInternalHTML: (i, n) => {
|
|
3814
3949
|
var s;
|
|
3815
3950
|
const r = ((s = o.options.domAttributes) == null ? void 0 : s.blockContent) || {}, a = e.render(i, n);
|
|
3816
|
-
return
|
|
3951
|
+
return me(
|
|
3817
3952
|
a,
|
|
3818
3953
|
i.type,
|
|
3819
3954
|
i.props,
|
|
@@ -3830,7 +3965,7 @@ function re(t, e) {
|
|
|
3830
3965
|
i,
|
|
3831
3966
|
n
|
|
3832
3967
|
);
|
|
3833
|
-
return a === void 0 && (a = e.render(i, n)),
|
|
3968
|
+
return a === void 0 && (a = e.render(i, n)), me(
|
|
3834
3969
|
a,
|
|
3835
3970
|
i.type,
|
|
3836
3971
|
i.props,
|
|
@@ -3841,7 +3976,7 @@ function re(t, e) {
|
|
|
3841
3976
|
});
|
|
3842
3977
|
}
|
|
3843
3978
|
function Io(t, e, o, i) {
|
|
3844
|
-
return t.dom.setAttribute("data-inline-content-type", e), Object.entries(o).filter(([n, r]) => r !== i[n].default).map(([n, r]) => [
|
|
3979
|
+
return t.dom.setAttribute("data-inline-content-type", e), Object.entries(o).filter(([n, r]) => r !== i[n].default).map(([n, r]) => [ie(n), r]).forEach(([n, r]) => t.dom.setAttribute(n, r)), t.contentDOM !== void 0 && t.contentDOM.setAttribute("data-editable", ""), t;
|
|
3845
3980
|
}
|
|
3846
3981
|
function Ao(t) {
|
|
3847
3982
|
return {
|
|
@@ -3885,8 +4020,8 @@ function Ho(t) {
|
|
|
3885
4020
|
}
|
|
3886
4021
|
];
|
|
3887
4022
|
}
|
|
3888
|
-
function
|
|
3889
|
-
const o =
|
|
4023
|
+
function Ir(t, e) {
|
|
4024
|
+
const o = W.create({
|
|
3890
4025
|
name: t.type,
|
|
3891
4026
|
inline: !0,
|
|
3892
4027
|
group: "inline",
|
|
@@ -3945,7 +4080,7 @@ function ct(t, e) {
|
|
|
3945
4080
|
implementation: e
|
|
3946
4081
|
};
|
|
3947
4082
|
}
|
|
3948
|
-
function
|
|
4083
|
+
function H(t, e) {
|
|
3949
4084
|
return ct(
|
|
3950
4085
|
{
|
|
3951
4086
|
type: t.name,
|
|
@@ -3972,8 +4107,8 @@ function Oo(t) {
|
|
|
3972
4107
|
}
|
|
3973
4108
|
];
|
|
3974
4109
|
}
|
|
3975
|
-
function
|
|
3976
|
-
const o =
|
|
4110
|
+
function Ar(t, e) {
|
|
4111
|
+
const o = xe.create({
|
|
3977
4112
|
name: t.type,
|
|
3978
4113
|
addAttributes() {
|
|
3979
4114
|
return Uo(t.propSchema);
|
|
@@ -4001,7 +4136,7 @@ function Mr(t, e) {
|
|
|
4001
4136
|
mark: o
|
|
4002
4137
|
});
|
|
4003
4138
|
}
|
|
4004
|
-
const
|
|
4139
|
+
const se = (t) => {
|
|
4005
4140
|
const e = document.createElement("div");
|
|
4006
4141
|
e.className = "bn-file-default-preview";
|
|
4007
4142
|
const o = document.createElement("div");
|
|
@@ -4010,14 +4145,14 @@ const ae = (t) => {
|
|
|
4010
4145
|
return i.className = "bn-file-default-preview-name", i.textContent = t.props.name || "", e.appendChild(o), e.appendChild(i), {
|
|
4011
4146
|
dom: e
|
|
4012
4147
|
};
|
|
4013
|
-
},
|
|
4148
|
+
}, V = (t, e) => {
|
|
4014
4149
|
const o = document.createElement("div");
|
|
4015
4150
|
o.className = "bn-file-and-caption-wrapper";
|
|
4016
4151
|
const i = document.createElement("p");
|
|
4017
4152
|
return i.className = "bn-file-caption", i.textContent = t.props.caption, o.appendChild(e), o.appendChild(i), {
|
|
4018
4153
|
dom: o
|
|
4019
4154
|
};
|
|
4020
|
-
},
|
|
4155
|
+
}, le = (t, e, o, i) => {
|
|
4021
4156
|
const n = document.createElement("div");
|
|
4022
4157
|
n.className = "bn-add-file-button";
|
|
4023
4158
|
const r = document.createElement("div");
|
|
@@ -4051,7 +4186,7 @@ const ae = (t) => {
|
|
|
4051
4186
|
);
|
|
4052
4187
|
}
|
|
4053
4188
|
};
|
|
4054
|
-
}, Oe = (t) => ({ url: t.src || void 0 }),
|
|
4189
|
+
}, Oe = (t) => ({ url: t.src || void 0 }), de = (t, e) => {
|
|
4055
4190
|
const o = t.querySelector(
|
|
4056
4191
|
e
|
|
4057
4192
|
);
|
|
@@ -4059,12 +4194,12 @@ const ae = (t) => {
|
|
|
4059
4194
|
return;
|
|
4060
4195
|
const i = t.querySelector("figcaption"), n = (i == null ? void 0 : i.textContent) ?? void 0;
|
|
4061
4196
|
return { targetElement: o, caption: n };
|
|
4062
|
-
},
|
|
4197
|
+
}, ce = (t, e) => {
|
|
4063
4198
|
const o = document.createElement("div"), i = document.createElement("p");
|
|
4064
4199
|
return i.textContent = e, o.appendChild(t), o.appendChild(i), {
|
|
4065
4200
|
dom: o
|
|
4066
4201
|
};
|
|
4067
|
-
},
|
|
4202
|
+
}, Ce = (t, e) => {
|
|
4068
4203
|
const o = document.createElement("figure"), i = document.createElement("figcaption");
|
|
4069
4204
|
return i.textContent = e, o.appendChild(t), o.appendChild(i), { dom: o };
|
|
4070
4205
|
}, pt = (t, e, o, i, n) => {
|
|
@@ -4082,10 +4217,10 @@ const ae = (t) => {
|
|
|
4082
4217
|
!e.isEditable && r.contains(a) && r.contains(s) && (r.removeChild(a), r.removeChild(s));
|
|
4083
4218
|
return;
|
|
4084
4219
|
}
|
|
4085
|
-
let
|
|
4086
|
-
t.props.textAlignment === "center" ? l.handleUsed === "left" ?
|
|
4087
|
-
const
|
|
4088
|
-
|
|
4220
|
+
let k;
|
|
4221
|
+
t.props.textAlignment === "center" ? l.handleUsed === "left" ? k = l.initialWidth + (l.initialClientX - g.clientX) * 2 : k = l.initialWidth + (g.clientX - l.initialClientX) * 2 : l.handleUsed === "left" ? k = l.initialWidth + l.initialClientX - g.clientX : k = l.initialWidth + g.clientX - l.initialClientX;
|
|
4222
|
+
const L = 64;
|
|
4223
|
+
k < L ? n(L) : k > e.domElement.firstElementChild.clientWidth ? n(e.domElement.firstElementChild.clientWidth) : n(k);
|
|
4089
4224
|
}, u = (g) => {
|
|
4090
4225
|
(!g.target || !r.contains(g.target) || !e.isEditable) && r.contains(a) && r.contains(s) && (r.removeChild(a), r.removeChild(s)), l && (l = void 0, e.updateBlock(t, {
|
|
4091
4226
|
props: {
|
|
@@ -4096,13 +4231,13 @@ const ae = (t) => {
|
|
|
4096
4231
|
e.isEditable && (r.appendChild(a), r.appendChild(s));
|
|
4097
4232
|
}, h = (g) => {
|
|
4098
4233
|
g.relatedTarget === a || g.relatedTarget === s || l || e.isEditable && r.contains(a) && r.contains(s) && (r.removeChild(a), r.removeChild(s));
|
|
4099
|
-
},
|
|
4234
|
+
}, m = (g) => {
|
|
4100
4235
|
g.preventDefault(), r.appendChild(a), r.appendChild(s), l = {
|
|
4101
4236
|
handleUsed: "left",
|
|
4102
4237
|
initialWidth: t.props.previewWidth,
|
|
4103
4238
|
initialClientX: g.clientX
|
|
4104
4239
|
};
|
|
4105
|
-
},
|
|
4240
|
+
}, f = (g) => {
|
|
4106
4241
|
g.preventDefault(), r.appendChild(a), r.appendChild(s), l = {
|
|
4107
4242
|
handleUsed: "right",
|
|
4108
4243
|
initialWidth: t.props.previewWidth,
|
|
@@ -4111,24 +4246,24 @@ const ae = (t) => {
|
|
|
4111
4246
|
};
|
|
4112
4247
|
return r.appendChild(o), window.addEventListener("mousemove", d), window.addEventListener("mouseup", u), o.addEventListener("mouseenter", p), o.addEventListener("mouseleave", h), a.addEventListener(
|
|
4113
4248
|
"mousedown",
|
|
4114
|
-
|
|
4249
|
+
m
|
|
4115
4250
|
), s.addEventListener(
|
|
4116
4251
|
"mousedown",
|
|
4117
|
-
|
|
4252
|
+
f
|
|
4118
4253
|
), {
|
|
4119
4254
|
dom: r,
|
|
4120
4255
|
destroy: () => {
|
|
4121
4256
|
window.removeEventListener("mousemove", d), window.removeEventListener("mouseup", u), o.removeEventListener("mouseenter", p), o.removeEventListener("mouseleave", h), a.removeEventListener(
|
|
4122
4257
|
"mousedown",
|
|
4123
|
-
|
|
4258
|
+
m
|
|
4124
4259
|
), s.removeEventListener(
|
|
4125
4260
|
"mousedown",
|
|
4126
|
-
|
|
4261
|
+
f
|
|
4127
4262
|
);
|
|
4128
4263
|
}
|
|
4129
4264
|
};
|
|
4130
4265
|
}, Ro = {
|
|
4131
|
-
backgroundColor:
|
|
4266
|
+
backgroundColor: y.backgroundColor,
|
|
4132
4267
|
// File name.
|
|
4133
4268
|
name: {
|
|
4134
4269
|
default: ""
|
|
@@ -4145,18 +4280,17 @@ const ae = (t) => {
|
|
|
4145
4280
|
type: "file",
|
|
4146
4281
|
propSchema: Ro,
|
|
4147
4282
|
content: "none",
|
|
4148
|
-
isFileBlock: !0
|
|
4149
|
-
isFileBlockPlaceholder: (t) => !t.props.url
|
|
4283
|
+
isFileBlock: !0
|
|
4150
4284
|
}, jo = (t, e) => {
|
|
4151
4285
|
const o = document.createElement("div");
|
|
4152
4286
|
if (o.className = "bn-file-block-content-wrapper", t.props.url === "") {
|
|
4153
|
-
const i =
|
|
4287
|
+
const i = le(t, e);
|
|
4154
4288
|
return o.appendChild(i.dom), {
|
|
4155
4289
|
dom: o,
|
|
4156
4290
|
destroy: i.destroy
|
|
4157
4291
|
};
|
|
4158
4292
|
} else {
|
|
4159
|
-
const i =
|
|
4293
|
+
const i = se(t).dom, n = V(t, i);
|
|
4160
4294
|
return o.appendChild(n.dom), {
|
|
4161
4295
|
dom: o
|
|
4162
4296
|
};
|
|
@@ -4165,7 +4299,7 @@ const ae = (t) => {
|
|
|
4165
4299
|
if (t.tagName === "EMBED")
|
|
4166
4300
|
return Oe(t);
|
|
4167
4301
|
if (t.tagName === "FIGURE") {
|
|
4168
|
-
const e =
|
|
4302
|
+
const e = de(t, "embed");
|
|
4169
4303
|
if (!e)
|
|
4170
4304
|
return;
|
|
4171
4305
|
const { targetElement: o, caption: i } = e;
|
|
@@ -4182,10 +4316,10 @@ const ae = (t) => {
|
|
|
4182
4316
|
};
|
|
4183
4317
|
}
|
|
4184
4318
|
const e = document.createElement("a");
|
|
4185
|
-
return e.href = t.props.url, e.textContent = t.props.name || t.props.url, t.props.caption ?
|
|
4319
|
+
return e.href = t.props.url, e.textContent = t.props.name || t.props.url, t.props.caption ? ce(e, t.props.caption) : {
|
|
4186
4320
|
dom: e
|
|
4187
4321
|
};
|
|
4188
|
-
}, Go =
|
|
4322
|
+
}, Go = ae(Vo, {
|
|
4189
4323
|
render: jo,
|
|
4190
4324
|
parse: zo,
|
|
4191
4325
|
toExternalHTML: Fo
|
|
@@ -4193,8 +4327,8 @@ const ae = (t) => {
|
|
|
4193
4327
|
const e = t.src || void 0, o = t.width || void 0;
|
|
4194
4328
|
return { url: e, previewWidth: o };
|
|
4195
4329
|
}, Wo = {
|
|
4196
|
-
textAlignment:
|
|
4197
|
-
backgroundColor:
|
|
4330
|
+
textAlignment: y.textAlignment,
|
|
4331
|
+
backgroundColor: y.backgroundColor,
|
|
4198
4332
|
// File name.
|
|
4199
4333
|
name: {
|
|
4200
4334
|
default: ""
|
|
@@ -4219,14 +4353,13 @@ const ae = (t) => {
|
|
|
4219
4353
|
propSchema: Wo,
|
|
4220
4354
|
content: "none",
|
|
4221
4355
|
isFileBlock: !0,
|
|
4222
|
-
isFileBlockPlaceholder: (t) => !t.props.url,
|
|
4223
4356
|
fileBlockAcceptMimeTypes: ["image/*"]
|
|
4224
4357
|
}, Ko = (t, e) => {
|
|
4225
4358
|
const o = document.createElement("div");
|
|
4226
4359
|
if (o.className = "bn-file-block-content-wrapper", t.props.url === "") {
|
|
4227
4360
|
const i = document.createElement("div");
|
|
4228
4361
|
i.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z"></path></svg>';
|
|
4229
|
-
const n =
|
|
4362
|
+
const n = le(
|
|
4230
4363
|
t,
|
|
4231
4364
|
e,
|
|
4232
4365
|
e.dictionary.file_blocks.image.add_button_text,
|
|
@@ -4241,7 +4374,9 @@ const ae = (t) => {
|
|
|
4241
4374
|
};
|
|
4242
4375
|
} else if (t.props.showPreview) {
|
|
4243
4376
|
const i = document.createElement("img");
|
|
4244
|
-
i.className = "bn-visual-media",
|
|
4377
|
+
i.className = "bn-visual-media", e.resolveFileUrl(t.props.url).then((a) => {
|
|
4378
|
+
i.src = a;
|
|
4379
|
+
}), i.alt = t.props.name || t.props.caption || "BlockNote image", i.contentEditable = "false", i.draggable = !1, i.width = Math.min(
|
|
4245
4380
|
t.props.previewWidth,
|
|
4246
4381
|
e.domElement.firstElementChild.clientWidth
|
|
4247
4382
|
);
|
|
@@ -4251,22 +4386,22 @@ const ae = (t) => {
|
|
|
4251
4386
|
i,
|
|
4252
4387
|
() => i.width,
|
|
4253
4388
|
(a) => i.width = a
|
|
4254
|
-
), r =
|
|
4389
|
+
), r = V(t, n.dom);
|
|
4255
4390
|
return o.appendChild(r.dom), {
|
|
4256
4391
|
dom: o,
|
|
4257
4392
|
destroy: n.destroy
|
|
4258
4393
|
};
|
|
4259
4394
|
} else {
|
|
4260
|
-
const i =
|
|
4395
|
+
const i = se(t).dom;
|
|
4261
4396
|
return {
|
|
4262
|
-
dom:
|
|
4397
|
+
dom: V(t, i).dom
|
|
4263
4398
|
};
|
|
4264
4399
|
}
|
|
4265
4400
|
}, qo = (t) => {
|
|
4266
4401
|
if (t.tagName === "IMG")
|
|
4267
4402
|
return Re(t);
|
|
4268
4403
|
if (t.tagName === "FIGURE") {
|
|
4269
|
-
const e =
|
|
4404
|
+
const e = de(t, "img");
|
|
4270
4405
|
if (!e)
|
|
4271
4406
|
return;
|
|
4272
4407
|
const { targetElement: o, caption: i } = e;
|
|
@@ -4283,10 +4418,10 @@ const ae = (t) => {
|
|
|
4283
4418
|
};
|
|
4284
4419
|
}
|
|
4285
4420
|
let e;
|
|
4286
|
-
return t.props.showPreview ? (e = document.createElement("img"), e.src = t.props.url, e.alt = t.props.name || t.props.caption || "BlockNote image", e.width = t.props.previewWidth) : (e = document.createElement("a"), e.href = t.props.url, e.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ?
|
|
4421
|
+
return t.props.showPreview ? (e = document.createElement("img"), e.src = t.props.url, e.alt = t.props.name || t.props.caption || "BlockNote image", e.width = t.props.previewWidth) : (e = document.createElement("a"), e.href = t.props.url, e.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? Ce(e, t.props.caption) : ce(e, t.props.caption) : {
|
|
4287
4422
|
dom: e
|
|
4288
4423
|
};
|
|
4289
|
-
}, Zo =
|
|
4424
|
+
}, Zo = ae($o, {
|
|
4290
4425
|
render: Ko,
|
|
4291
4426
|
parse: qo,
|
|
4292
4427
|
toExternalHTML: Xo
|
|
@@ -4294,8 +4429,8 @@ const ae = (t) => {
|
|
|
4294
4429
|
const e = t.src || void 0, o = t.width || void 0;
|
|
4295
4430
|
return { url: e, previewWidth: o };
|
|
4296
4431
|
}, Jo = {
|
|
4297
|
-
textAlignment:
|
|
4298
|
-
backgroundColor:
|
|
4432
|
+
textAlignment: y.textAlignment,
|
|
4433
|
+
backgroundColor: y.backgroundColor,
|
|
4299
4434
|
// File name.
|
|
4300
4435
|
name: {
|
|
4301
4436
|
default: ""
|
|
@@ -4320,14 +4455,13 @@ const ae = (t) => {
|
|
|
4320
4455
|
propSchema: Jo,
|
|
4321
4456
|
content: "none",
|
|
4322
4457
|
isFileBlock: !0,
|
|
4323
|
-
isFileBlockPlaceholder: (t) => !t.props.url,
|
|
4324
4458
|
fileBlockAcceptMimeTypes: ["video/*"]
|
|
4325
4459
|
}, Qo = (t, e) => {
|
|
4326
4460
|
const o = document.createElement("div");
|
|
4327
4461
|
if (o.className = "bn-file-block-content-wrapper", t.props.url === "") {
|
|
4328
4462
|
const i = document.createElement("div");
|
|
4329
4463
|
i.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z"></path></svg>';
|
|
4330
|
-
const n =
|
|
4464
|
+
const n = le(
|
|
4331
4465
|
t,
|
|
4332
4466
|
e,
|
|
4333
4467
|
e.dictionary.file_blocks.video.add_button_text,
|
|
@@ -4352,22 +4486,22 @@ const ae = (t) => {
|
|
|
4352
4486
|
i,
|
|
4353
4487
|
() => i.width,
|
|
4354
4488
|
(a) => i.width = a
|
|
4355
|
-
), r =
|
|
4489
|
+
), r = V(t, n.dom);
|
|
4356
4490
|
return o.appendChild(r.dom), {
|
|
4357
4491
|
dom: o,
|
|
4358
4492
|
destroy: n.destroy
|
|
4359
4493
|
};
|
|
4360
4494
|
} else {
|
|
4361
|
-
const i =
|
|
4495
|
+
const i = se(t).dom;
|
|
4362
4496
|
return {
|
|
4363
|
-
dom:
|
|
4497
|
+
dom: V(t, i).dom
|
|
4364
4498
|
};
|
|
4365
4499
|
}
|
|
4366
4500
|
}, ei = (t) => {
|
|
4367
4501
|
if (t.tagName === "VIDEO")
|
|
4368
4502
|
return Ve(t);
|
|
4369
4503
|
if (t.tagName === "FIGURE") {
|
|
4370
|
-
const e =
|
|
4504
|
+
const e = de(t, "video");
|
|
4371
4505
|
if (!e)
|
|
4372
4506
|
return;
|
|
4373
4507
|
const { targetElement: o, caption: i } = e;
|
|
@@ -4384,15 +4518,15 @@ const ae = (t) => {
|
|
|
4384
4518
|
};
|
|
4385
4519
|
}
|
|
4386
4520
|
let e;
|
|
4387
|
-
return t.props.showPreview ? (e = document.createElement("video"), e.src = t.props.url, e.width = t.props.previewWidth) : (e = document.createElement("a"), e.href = t.props.url, e.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ?
|
|
4521
|
+
return t.props.showPreview ? (e = document.createElement("video"), e.src = t.props.url, e.width = t.props.previewWidth) : (e = document.createElement("a"), e.href = t.props.url, e.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? Ce(e, t.props.caption) : ce(e, t.props.caption) : {
|
|
4388
4522
|
dom: e
|
|
4389
4523
|
};
|
|
4390
|
-
}, oi =
|
|
4524
|
+
}, oi = ae(Yo, {
|
|
4391
4525
|
render: Qo,
|
|
4392
4526
|
parse: ei,
|
|
4393
4527
|
toExternalHTML: ti
|
|
4394
4528
|
}), je = (t) => ({ url: t.src || void 0 }), ii = {
|
|
4395
|
-
backgroundColor:
|
|
4529
|
+
backgroundColor: y.backgroundColor,
|
|
4396
4530
|
// File name.
|
|
4397
4531
|
name: {
|
|
4398
4532
|
default: ""
|
|
@@ -4413,14 +4547,13 @@ const ae = (t) => {
|
|
|
4413
4547
|
propSchema: ii,
|
|
4414
4548
|
content: "none",
|
|
4415
4549
|
isFileBlock: !0,
|
|
4416
|
-
isFileBlockPlaceholder: (t) => !t.props.url,
|
|
4417
4550
|
fileBlockAcceptMimeTypes: ["audio/*"]
|
|
4418
4551
|
}, ri = (t, e) => {
|
|
4419
4552
|
const o = document.createElement("div");
|
|
4420
4553
|
if (o.className = "bn-file-block-content-wrapper", t.props.url === "") {
|
|
4421
4554
|
const i = document.createElement("div");
|
|
4422
4555
|
i.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"></path></svg>';
|
|
4423
|
-
const n =
|
|
4556
|
+
const n = le(
|
|
4424
4557
|
t,
|
|
4425
4558
|
e,
|
|
4426
4559
|
e.dictionary.file_blocks.audio.add_button_text,
|
|
@@ -4435,22 +4568,24 @@ const ae = (t) => {
|
|
|
4435
4568
|
};
|
|
4436
4569
|
} else if (t.props.showPreview) {
|
|
4437
4570
|
const i = document.createElement("audio");
|
|
4438
|
-
i.className = "bn-audio",
|
|
4439
|
-
|
|
4571
|
+
i.className = "bn-audio", e.resolveFileUrl(t.props.url).then((r) => {
|
|
4572
|
+
i.src = r;
|
|
4573
|
+
}), i.controls = !0, i.contentEditable = "false", i.draggable = !1;
|
|
4574
|
+
const n = V(t, i);
|
|
4440
4575
|
return o.appendChild(n.dom), {
|
|
4441
4576
|
dom: o
|
|
4442
4577
|
};
|
|
4443
4578
|
} else {
|
|
4444
|
-
const i =
|
|
4579
|
+
const i = se(t).dom;
|
|
4445
4580
|
return {
|
|
4446
|
-
dom:
|
|
4581
|
+
dom: V(t, i).dom
|
|
4447
4582
|
};
|
|
4448
4583
|
}
|
|
4449
4584
|
}, ai = (t) => {
|
|
4450
4585
|
if (t.tagName === "AUDIO")
|
|
4451
4586
|
return je(t);
|
|
4452
4587
|
if (t.tagName === "FIGURE") {
|
|
4453
|
-
const e =
|
|
4588
|
+
const e = de(t, "audio");
|
|
4454
4589
|
if (!e)
|
|
4455
4590
|
return;
|
|
4456
4591
|
const { targetElement: o, caption: i } = e;
|
|
@@ -4467,14 +4602,14 @@ const ae = (t) => {
|
|
|
4467
4602
|
};
|
|
4468
4603
|
}
|
|
4469
4604
|
let e;
|
|
4470
|
-
return t.props.showPreview ? (e = document.createElement("audio"), e.src = t.props.url) : (e = document.createElement("a"), e.href = t.props.url, e.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ?
|
|
4605
|
+
return t.props.showPreview ? (e = document.createElement("audio"), e.src = t.props.url) : (e = document.createElement("a"), e.href = t.props.url, e.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? Ce(e, t.props.caption) : ce(e, t.props.caption) : {
|
|
4471
4606
|
dom: e
|
|
4472
4607
|
};
|
|
4473
|
-
}, li =
|
|
4608
|
+
}, li = ae(ni, {
|
|
4474
4609
|
render: ri,
|
|
4475
4610
|
parse: ai,
|
|
4476
4611
|
toExternalHTML: si
|
|
4477
|
-
}),
|
|
4612
|
+
}), Nr = async (t) => {
|
|
4478
4613
|
const e = new FormData();
|
|
4479
4614
|
return e.append("file", t), (await (await fetch("https://tmpfiles.org/api/v1/upload", {
|
|
4480
4615
|
method: "POST",
|
|
@@ -4483,7 +4618,7 @@ const ae = (t) => {
|
|
|
4483
4618
|
"tmpfiles.org/",
|
|
4484
4619
|
"tmpfiles.org/dl/"
|
|
4485
4620
|
);
|
|
4486
|
-
}, di =
|
|
4621
|
+
}, di = xe.create({
|
|
4487
4622
|
name: "backgroundColor",
|
|
4488
4623
|
addAttributes() {
|
|
4489
4624
|
return {
|
|
@@ -4509,10 +4644,10 @@ const ae = (t) => {
|
|
|
4509
4644
|
renderHTML({ HTMLAttributes: t }) {
|
|
4510
4645
|
return ["span", t, 0];
|
|
4511
4646
|
}
|
|
4512
|
-
}), ci =
|
|
4647
|
+
}), ci = H(
|
|
4513
4648
|
di,
|
|
4514
4649
|
"string"
|
|
4515
|
-
), ui =
|
|
4650
|
+
), ui = xe.create({
|
|
4516
4651
|
name: "textColor",
|
|
4517
4652
|
addAttributes() {
|
|
4518
4653
|
return {
|
|
@@ -4536,16 +4671,16 @@ const ae = (t) => {
|
|
|
4536
4671
|
renderHTML({ HTMLAttributes: t }) {
|
|
4537
4672
|
return ["span", t, 0];
|
|
4538
4673
|
}
|
|
4539
|
-
}), pi =
|
|
4674
|
+
}), pi = H(ui, "string"), C = (t) => {
|
|
4540
4675
|
const { contentType: e } = b(
|
|
4541
4676
|
t.state.doc,
|
|
4542
4677
|
t.state.selection.from
|
|
4543
4678
|
);
|
|
4544
4679
|
return e.spec.content;
|
|
4545
4680
|
}, hi = {
|
|
4546
|
-
...
|
|
4681
|
+
...y,
|
|
4547
4682
|
level: { default: 1, values: [1, 2, 3] }
|
|
4548
|
-
}, mi =
|
|
4683
|
+
}, mi = j({
|
|
4549
4684
|
name: "heading",
|
|
4550
4685
|
content: "inline*",
|
|
4551
4686
|
group: "blockContent",
|
|
@@ -4567,10 +4702,10 @@ const ae = (t) => {
|
|
|
4567
4702
|
},
|
|
4568
4703
|
addInputRules() {
|
|
4569
4704
|
return [
|
|
4570
|
-
...[1, 2, 3].map((t) => new
|
|
4705
|
+
...[1, 2, 3].map((t) => new Y({
|
|
4571
4706
|
find: new RegExp(`^(#{${t}})\\s$`),
|
|
4572
4707
|
handler: ({ state: e, chain: o, range: i }) => {
|
|
4573
|
-
|
|
4708
|
+
C(this.editor) === "inline*" && o().BNUpdateBlock(e.selection.from, {
|
|
4574
4709
|
type: "heading",
|
|
4575
4710
|
props: {
|
|
4576
4711
|
level: t
|
|
@@ -4582,7 +4717,7 @@ const ae = (t) => {
|
|
|
4582
4717
|
},
|
|
4583
4718
|
addKeyboardShortcuts() {
|
|
4584
4719
|
return {
|
|
4585
|
-
"Mod-Alt-1": () =>
|
|
4720
|
+
"Mod-Alt-1": () => C(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
4586
4721
|
this.editor.state.selection.anchor,
|
|
4587
4722
|
{
|
|
4588
4723
|
type: "heading",
|
|
@@ -4591,7 +4726,7 @@ const ae = (t) => {
|
|
|
4591
4726
|
}
|
|
4592
4727
|
}
|
|
4593
4728
|
),
|
|
4594
|
-
"Mod-Alt-2": () =>
|
|
4729
|
+
"Mod-Alt-2": () => C(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
4595
4730
|
this.editor.state.selection.anchor,
|
|
4596
4731
|
{
|
|
4597
4732
|
type: "heading",
|
|
@@ -4600,7 +4735,7 @@ const ae = (t) => {
|
|
|
4600
4735
|
}
|
|
4601
4736
|
}
|
|
4602
4737
|
),
|
|
4603
|
-
"Mod-Alt-3": () =>
|
|
4738
|
+
"Mod-Alt-3": () => C(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
4604
4739
|
this.editor.state.selection.anchor,
|
|
4605
4740
|
{
|
|
4606
4741
|
type: "heading",
|
|
@@ -4638,7 +4773,7 @@ const ae = (t) => {
|
|
|
4638
4773
|
},
|
|
4639
4774
|
renderHTML({ node: t, HTMLAttributes: e }) {
|
|
4640
4775
|
var o, i;
|
|
4641
|
-
return
|
|
4776
|
+
return R(
|
|
4642
4777
|
this.name,
|
|
4643
4778
|
`h${t.attrs.level}`,
|
|
4644
4779
|
{
|
|
@@ -4648,15 +4783,15 @@ const ae = (t) => {
|
|
|
4648
4783
|
((i = this.options.domAttributes) == null ? void 0 : i.inlineContent) || {}
|
|
4649
4784
|
);
|
|
4650
4785
|
}
|
|
4651
|
-
}), fi =
|
|
4786
|
+
}), fi = $(
|
|
4652
4787
|
mi,
|
|
4653
4788
|
hi
|
|
4654
|
-
),
|
|
4789
|
+
), ue = (t) => {
|
|
4655
4790
|
const { node: e, contentType: o } = b(
|
|
4656
4791
|
t.state.doc,
|
|
4657
4792
|
t.state.selection.from
|
|
4658
4793
|
), i = t.state.selection.anchor === t.state.selection.head;
|
|
4659
|
-
return !(o.name === "bulletListItem" || o.name === "numberedListItem") || !i ? !1 : t.commands.first(({ state: n, chain: r, commands: a }) => [
|
|
4794
|
+
return !(o.name === "bulletListItem" || o.name === "numberedListItem" || o.name === "checkListItem") || !i ? !1 : t.commands.first(({ state: n, chain: r, commands: a }) => [
|
|
4660
4795
|
() => (
|
|
4661
4796
|
// Changes list item block to a text block if the content is empty.
|
|
4662
4797
|
a.command(() => e.textContent.length === 0 ? a.BNUpdateBlock(n.selection.from, {
|
|
@@ -4671,18 +4806,21 @@ const ae = (t) => {
|
|
|
4671
4806
|
)
|
|
4672
4807
|
]);
|
|
4673
4808
|
}, gi = {
|
|
4674
|
-
...
|
|
4675
|
-
}, bi =
|
|
4809
|
+
...y
|
|
4810
|
+
}, bi = j({
|
|
4676
4811
|
name: "bulletListItem",
|
|
4677
4812
|
content: "inline*",
|
|
4678
4813
|
group: "blockContent",
|
|
4814
|
+
// This is to make sure that check list parse rules run before, since they
|
|
4815
|
+
// both parse `li` elements but check lists are more specific.
|
|
4816
|
+
priority: 90,
|
|
4679
4817
|
addInputRules() {
|
|
4680
4818
|
return [
|
|
4681
4819
|
// Creates an unordered list when starting with "-", "+", or "*".
|
|
4682
|
-
new
|
|
4820
|
+
new Y({
|
|
4683
4821
|
find: new RegExp("^[-+*]\\s$"),
|
|
4684
4822
|
handler: ({ state: t, chain: e, range: o }) => {
|
|
4685
|
-
|
|
4823
|
+
C(this.editor) === "inline*" && e().BNUpdateBlock(t.selection.from, {
|
|
4686
4824
|
type: "bulletListItem",
|
|
4687
4825
|
props: {}
|
|
4688
4826
|
}).deleteRange({ from: o.from, to: o.to });
|
|
@@ -4692,8 +4830,8 @@ const ae = (t) => {
|
|
|
4692
4830
|
},
|
|
4693
4831
|
addKeyboardShortcuts() {
|
|
4694
4832
|
return {
|
|
4695
|
-
Enter: () =>
|
|
4696
|
-
"Mod-Shift-8": () =>
|
|
4833
|
+
Enter: () => ue(this.editor),
|
|
4834
|
+
"Mod-Shift-8": () => C(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
4697
4835
|
this.editor.state.selection.anchor,
|
|
4698
4836
|
{
|
|
4699
4837
|
type: "bulletListItem",
|
|
@@ -4735,7 +4873,7 @@ const ae = (t) => {
|
|
|
4735
4873
|
},
|
|
4736
4874
|
renderHTML({ HTMLAttributes: t }) {
|
|
4737
4875
|
var e, o;
|
|
4738
|
-
return
|
|
4876
|
+
return R(
|
|
4739
4877
|
this.name,
|
|
4740
4878
|
// We use a <p> tag, because for <li> tags we'd need a <ul> element to put
|
|
4741
4879
|
// them in to be semantically correct, which we can't have due to the
|
|
@@ -4748,10 +4886,10 @@ const ae = (t) => {
|
|
|
4748
4886
|
((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
|
|
4749
4887
|
);
|
|
4750
4888
|
}
|
|
4751
|
-
}), ki =
|
|
4889
|
+
}), ki = $(
|
|
4752
4890
|
bi,
|
|
4753
4891
|
gi
|
|
4754
|
-
), yi = new
|
|
4892
|
+
), yi = new S("numbered-list-indexing"), vi = () => new _({
|
|
4755
4893
|
key: yi,
|
|
4756
4894
|
appendTransaction: (t, e, o) => {
|
|
4757
4895
|
const i = o.tr;
|
|
@@ -4768,10 +4906,10 @@ const ae = (t) => {
|
|
|
4768
4906
|
if (h === void 0)
|
|
4769
4907
|
return;
|
|
4770
4908
|
if (!(d.depth !== h.depth)) {
|
|
4771
|
-
const
|
|
4909
|
+
const f = h.contentNode;
|
|
4772
4910
|
if (h.contentType.name === "numberedListItem") {
|
|
4773
|
-
const
|
|
4774
|
-
s = (parseInt(
|
|
4911
|
+
const L = f.attrs.index;
|
|
4912
|
+
s = (parseInt(L) + 1).toString();
|
|
4775
4913
|
}
|
|
4776
4914
|
}
|
|
4777
4915
|
}
|
|
@@ -4781,12 +4919,13 @@ const ae = (t) => {
|
|
|
4781
4919
|
}
|
|
4782
4920
|
}), n ? i : null;
|
|
4783
4921
|
}
|
|
4784
|
-
}),
|
|
4785
|
-
...
|
|
4786
|
-
},
|
|
4922
|
+
}), _i = {
|
|
4923
|
+
...y
|
|
4924
|
+
}, wi = j({
|
|
4787
4925
|
name: "numberedListItem",
|
|
4788
4926
|
content: "inline*",
|
|
4789
4927
|
group: "blockContent",
|
|
4928
|
+
priority: 90,
|
|
4790
4929
|
addAttributes() {
|
|
4791
4930
|
return {
|
|
4792
4931
|
index: {
|
|
@@ -4801,10 +4940,10 @@ const ae = (t) => {
|
|
|
4801
4940
|
addInputRules() {
|
|
4802
4941
|
return [
|
|
4803
4942
|
// Creates an ordered list when starting with "1.".
|
|
4804
|
-
new
|
|
4943
|
+
new Y({
|
|
4805
4944
|
find: new RegExp("^1\\.\\s$"),
|
|
4806
4945
|
handler: ({ state: t, chain: e, range: o }) => {
|
|
4807
|
-
|
|
4946
|
+
C(this.editor) === "inline*" && e().BNUpdateBlock(t.selection.from, {
|
|
4808
4947
|
type: "numberedListItem",
|
|
4809
4948
|
props: {}
|
|
4810
4949
|
}).deleteRange({ from: o.from, to: o.to });
|
|
@@ -4814,8 +4953,8 @@ const ae = (t) => {
|
|
|
4814
4953
|
},
|
|
4815
4954
|
addKeyboardShortcuts() {
|
|
4816
4955
|
return {
|
|
4817
|
-
Enter: () =>
|
|
4818
|
-
"Mod-Shift-7": () =>
|
|
4956
|
+
Enter: () => ue(this.editor),
|
|
4957
|
+
"Mod-Shift-7": () => C(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
4819
4958
|
this.editor.state.selection.anchor,
|
|
4820
4959
|
{
|
|
4821
4960
|
type: "numberedListItem",
|
|
@@ -4825,7 +4964,7 @@ const ae = (t) => {
|
|
|
4825
4964
|
};
|
|
4826
4965
|
},
|
|
4827
4966
|
addProseMirrorPlugins() {
|
|
4828
|
-
return [
|
|
4967
|
+
return [vi()];
|
|
4829
4968
|
},
|
|
4830
4969
|
parseHTML() {
|
|
4831
4970
|
return [
|
|
@@ -4862,7 +5001,7 @@ const ae = (t) => {
|
|
|
4862
5001
|
},
|
|
4863
5002
|
renderHTML({ HTMLAttributes: t }) {
|
|
4864
5003
|
var e, o;
|
|
4865
|
-
return
|
|
5004
|
+
return R(
|
|
4866
5005
|
this.name,
|
|
4867
5006
|
// We use a <p> tag, because for <li> tags we'd need an <ol> element to
|
|
4868
5007
|
// put them in to be semantically correct, which we can't have due to the
|
|
@@ -4875,19 +5014,179 @@ const ae = (t) => {
|
|
|
4875
5014
|
((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
|
|
4876
5015
|
);
|
|
4877
5016
|
}
|
|
4878
|
-
}), xi =
|
|
4879
|
-
|
|
4880
|
-
|
|
5017
|
+
}), xi = $(
|
|
5018
|
+
wi,
|
|
5019
|
+
_i
|
|
4881
5020
|
), Ei = {
|
|
4882
|
-
...
|
|
4883
|
-
|
|
5021
|
+
...y,
|
|
5022
|
+
checked: {
|
|
5023
|
+
default: !1
|
|
5024
|
+
}
|
|
5025
|
+
}, Ci = j({
|
|
5026
|
+
name: "checkListItem",
|
|
5027
|
+
content: "inline*",
|
|
5028
|
+
group: "blockContent",
|
|
5029
|
+
addAttributes() {
|
|
5030
|
+
return {
|
|
5031
|
+
checked: {
|
|
5032
|
+
default: !1,
|
|
5033
|
+
// instead of "checked" attributes, use "data-checked"
|
|
5034
|
+
parseHTML: (t) => t.getAttribute("data-checked") === "true" || void 0,
|
|
5035
|
+
renderHTML: (t) => t.checked ? {
|
|
5036
|
+
"data-checked": t.checked.toString()
|
|
5037
|
+
} : {}
|
|
5038
|
+
}
|
|
5039
|
+
};
|
|
5040
|
+
},
|
|
5041
|
+
addInputRules() {
|
|
5042
|
+
return [
|
|
5043
|
+
// Creates a checklist when starting with "[]" or "[X]".
|
|
5044
|
+
new Y({
|
|
5045
|
+
find: new RegExp("\\[\\s*\\]\\s$"),
|
|
5046
|
+
handler: ({ state: t, chain: e, range: o }) => {
|
|
5047
|
+
C(this.editor) === "inline*" && e().BNUpdateBlock(t.selection.from, {
|
|
5048
|
+
type: "checkListItem",
|
|
5049
|
+
props: {
|
|
5050
|
+
checked: !1
|
|
5051
|
+
}
|
|
5052
|
+
}).deleteRange({ from: o.from, to: o.to });
|
|
5053
|
+
}
|
|
5054
|
+
}),
|
|
5055
|
+
new Y({
|
|
5056
|
+
find: new RegExp("\\[[Xx]\\]\\s$"),
|
|
5057
|
+
handler: ({ state: t, chain: e, range: o }) => {
|
|
5058
|
+
C(this.editor) === "inline*" && e().BNUpdateBlock(t.selection.from, {
|
|
5059
|
+
type: "checkListItem",
|
|
5060
|
+
props: {
|
|
5061
|
+
checked: !0
|
|
5062
|
+
}
|
|
5063
|
+
}).deleteRange({ from: o.from, to: o.to });
|
|
5064
|
+
}
|
|
5065
|
+
})
|
|
5066
|
+
];
|
|
5067
|
+
},
|
|
5068
|
+
addKeyboardShortcuts() {
|
|
5069
|
+
return {
|
|
5070
|
+
Enter: () => ue(this.editor),
|
|
5071
|
+
"Mod-Shift-9": () => C(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
5072
|
+
this.editor.state.selection.anchor,
|
|
5073
|
+
{
|
|
5074
|
+
type: "checkListItem",
|
|
5075
|
+
props: {}
|
|
5076
|
+
}
|
|
5077
|
+
)
|
|
5078
|
+
};
|
|
5079
|
+
},
|
|
5080
|
+
parseHTML() {
|
|
5081
|
+
return [
|
|
5082
|
+
{
|
|
5083
|
+
tag: "div[data-content-type=" + this.name + "]"
|
|
5084
|
+
// TODO: remove if we can't come up with test case that needs this
|
|
5085
|
+
},
|
|
5086
|
+
// Checkbox only.
|
|
5087
|
+
{
|
|
5088
|
+
tag: "input",
|
|
5089
|
+
getAttrs: (t) => typeof t == "string" ? !1 : t.type === "checkbox" ? { checked: t.checked } : !1,
|
|
5090
|
+
node: "checkListItem"
|
|
5091
|
+
},
|
|
5092
|
+
// Container element for checkbox + label.
|
|
5093
|
+
{
|
|
5094
|
+
tag: "li",
|
|
5095
|
+
getAttrs: (t) => {
|
|
5096
|
+
if (typeof t == "string")
|
|
5097
|
+
return !1;
|
|
5098
|
+
const e = t.parentElement;
|
|
5099
|
+
if (e === null)
|
|
5100
|
+
return !1;
|
|
5101
|
+
if (e.tagName === "UL" || e.tagName === "DIV" && e.parentElement.tagName === "UL") {
|
|
5102
|
+
const o = t.querySelector(
|
|
5103
|
+
"input[type=checkbox]"
|
|
5104
|
+
) || null;
|
|
5105
|
+
return o === null ? !1 : { checked: o.checked };
|
|
5106
|
+
}
|
|
5107
|
+
return !1;
|
|
5108
|
+
},
|
|
5109
|
+
node: "checkListItem"
|
|
5110
|
+
}
|
|
5111
|
+
];
|
|
5112
|
+
},
|
|
5113
|
+
// Since there is no HTML checklist element, there isn't really any
|
|
5114
|
+
// standardization for what checklists should look like in the DOM. GDocs'
|
|
5115
|
+
// and Notion's aren't cross compatible, for example. This implementation
|
|
5116
|
+
// has a semantically correct DOM structure (though missing a label for the
|
|
5117
|
+
// checkbox) which is also converted correctly to Markdown by remark.
|
|
5118
|
+
renderHTML({ node: t, HTMLAttributes: e }) {
|
|
5119
|
+
var r, a;
|
|
5120
|
+
const o = document.createElement("input");
|
|
5121
|
+
o.type = "checkbox", o.checked = t.attrs.checked, t.attrs.checked && o.setAttribute("checked", "");
|
|
5122
|
+
const { dom: i, contentDOM: n } = R(
|
|
5123
|
+
this.name,
|
|
5124
|
+
"p",
|
|
5125
|
+
{
|
|
5126
|
+
...((r = this.options.domAttributes) == null ? void 0 : r.blockContent) || {},
|
|
5127
|
+
...e
|
|
5128
|
+
},
|
|
5129
|
+
((a = this.options.domAttributes) == null ? void 0 : a.inlineContent) || {}
|
|
5130
|
+
);
|
|
5131
|
+
return i.insertBefore(o, n), { dom: i, contentDOM: n };
|
|
5132
|
+
},
|
|
5133
|
+
// Need to render node view since the checkbox needs to be able to update the
|
|
5134
|
+
// node. This is only possible with a node view as it exposes `getPos`.
|
|
5135
|
+
addNodeView() {
|
|
5136
|
+
return ({ node: t, getPos: e, editor: o, HTMLAttributes: i }) => {
|
|
5137
|
+
var u, p;
|
|
5138
|
+
const n = document.createElement("div"), r = document.createElement("div");
|
|
5139
|
+
r.contentEditable = "false";
|
|
5140
|
+
const a = document.createElement("input");
|
|
5141
|
+
a.type = "checkbox", a.checked = t.attrs.checked, t.attrs.checked && a.setAttribute("checked", "");
|
|
5142
|
+
const s = () => {
|
|
5143
|
+
if (!o.isEditable) {
|
|
5144
|
+
a.checked = !a.checked;
|
|
5145
|
+
return;
|
|
5146
|
+
}
|
|
5147
|
+
typeof e != "boolean" && this.editor.commands.BNUpdateBlock(e(), {
|
|
5148
|
+
type: "checkListItem",
|
|
5149
|
+
props: {
|
|
5150
|
+
checked: a.checked
|
|
5151
|
+
}
|
|
5152
|
+
});
|
|
5153
|
+
};
|
|
5154
|
+
a.addEventListener("change", s);
|
|
5155
|
+
const { dom: l, contentDOM: d } = R(
|
|
5156
|
+
this.name,
|
|
5157
|
+
"p",
|
|
5158
|
+
{
|
|
5159
|
+
...((u = this.options.domAttributes) == null ? void 0 : u.blockContent) || {},
|
|
5160
|
+
...i
|
|
5161
|
+
},
|
|
5162
|
+
((p = this.options.domAttributes) == null ? void 0 : p.inlineContent) || {}
|
|
5163
|
+
);
|
|
5164
|
+
if (typeof e != "boolean") {
|
|
5165
|
+
const m = "label-" + this.editor.state.doc.resolve(e()).node().attrs.id;
|
|
5166
|
+
a.setAttribute("aria-labelledby", m), d.id = m;
|
|
5167
|
+
}
|
|
5168
|
+
return l.removeChild(d), l.appendChild(n), n.appendChild(r), n.appendChild(d), r.appendChild(a), {
|
|
5169
|
+
dom: l,
|
|
5170
|
+
contentDOM: d,
|
|
5171
|
+
destroy: () => {
|
|
5172
|
+
a.removeEventListener("change", s);
|
|
5173
|
+
}
|
|
5174
|
+
};
|
|
5175
|
+
};
|
|
5176
|
+
}
|
|
5177
|
+
}), Si = $(
|
|
5178
|
+
Ci,
|
|
5179
|
+
Ei
|
|
5180
|
+
), Mi = {
|
|
5181
|
+
...y
|
|
5182
|
+
}, Ti = j({
|
|
4884
5183
|
name: "paragraph",
|
|
4885
5184
|
content: "inline*",
|
|
4886
5185
|
group: "blockContent",
|
|
4887
5186
|
addKeyboardShortcuts() {
|
|
4888
5187
|
return {
|
|
4889
|
-
Enter: () =>
|
|
4890
|
-
"Mod-Alt-0": () =>
|
|
5188
|
+
Enter: () => ue(this.editor),
|
|
5189
|
+
"Mod-Alt-0": () => C(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
4891
5190
|
this.editor.state.selection.anchor,
|
|
4892
5191
|
{
|
|
4893
5192
|
type: "paragraph",
|
|
@@ -4908,7 +5207,7 @@ const ae = (t) => {
|
|
|
4908
5207
|
},
|
|
4909
5208
|
renderHTML({ HTMLAttributes: t }) {
|
|
4910
5209
|
var e, o;
|
|
4911
|
-
return
|
|
5210
|
+
return R(
|
|
4912
5211
|
this.name,
|
|
4913
5212
|
"p",
|
|
4914
5213
|
{
|
|
@@ -4918,10 +5217,10 @@ const ae = (t) => {
|
|
|
4918
5217
|
((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
|
|
4919
5218
|
);
|
|
4920
5219
|
}
|
|
4921
|
-
}),
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
),
|
|
5220
|
+
}), Bi = $(
|
|
5221
|
+
Ti,
|
|
5222
|
+
Mi
|
|
5223
|
+
), Li = B.create({
|
|
4925
5224
|
name: "BlockNoteTableExtension",
|
|
4926
5225
|
addProseMirrorPlugins: () => [
|
|
4927
5226
|
Zt({
|
|
@@ -4953,9 +5252,9 @@ const ae = (t) => {
|
|
|
4953
5252
|
)
|
|
4954
5253
|
};
|
|
4955
5254
|
}
|
|
4956
|
-
}),
|
|
4957
|
-
...
|
|
4958
|
-
},
|
|
5255
|
+
}), Ii = {
|
|
5256
|
+
...y
|
|
5257
|
+
}, Ai = j({
|
|
4959
5258
|
name: "table",
|
|
4960
5259
|
content: "tableRow+",
|
|
4961
5260
|
group: "blockContent",
|
|
@@ -4966,7 +5265,7 @@ const ae = (t) => {
|
|
|
4966
5265
|
},
|
|
4967
5266
|
renderHTML({ HTMLAttributes: t }) {
|
|
4968
5267
|
var e, o;
|
|
4969
|
-
return
|
|
5268
|
+
return R(
|
|
4970
5269
|
this.name,
|
|
4971
5270
|
"table",
|
|
4972
5271
|
{
|
|
@@ -4976,7 +5275,7 @@ const ae = (t) => {
|
|
|
4976
5275
|
((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
|
|
4977
5276
|
);
|
|
4978
5277
|
}
|
|
4979
|
-
}),
|
|
5278
|
+
}), Ni = W.create({
|
|
4980
5279
|
name: "tableParagraph",
|
|
4981
5280
|
group: "tableContent",
|
|
4982
5281
|
content: "inline*",
|
|
@@ -4990,12 +5289,12 @@ const ae = (t) => {
|
|
|
4990
5289
|
0
|
|
4991
5290
|
];
|
|
4992
5291
|
}
|
|
4993
|
-
}),
|
|
4994
|
-
|
|
4995
|
-
|
|
5292
|
+
}), Pi = $(
|
|
5293
|
+
Ai,
|
|
5294
|
+
Ii,
|
|
4996
5295
|
[
|
|
4997
|
-
Mi,
|
|
4998
5296
|
Li,
|
|
5297
|
+
Ni,
|
|
4999
5298
|
qt.extend({
|
|
5000
5299
|
content: "tableContent"
|
|
5001
5300
|
}),
|
|
@@ -5005,52 +5304,52 @@ const ae = (t) => {
|
|
|
5005
5304
|
Xt
|
|
5006
5305
|
]
|
|
5007
5306
|
), ht = {
|
|
5008
|
-
paragraph:
|
|
5307
|
+
paragraph: Bi,
|
|
5009
5308
|
heading: fi,
|
|
5010
5309
|
bulletListItem: ki,
|
|
5011
5310
|
numberedListItem: xi,
|
|
5311
|
+
checkListItem: Si,
|
|
5312
|
+
table: Pi,
|
|
5012
5313
|
file: Go,
|
|
5013
5314
|
image: Zo,
|
|
5014
5315
|
video: oi,
|
|
5015
|
-
audio: li
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
code: P(Ft, "boolean"),
|
|
5316
|
+
audio: li
|
|
5317
|
+
}, Hi = lt(ht), mt = {
|
|
5318
|
+
bold: H(zt, "boolean"),
|
|
5319
|
+
italic: H(Gt, "boolean"),
|
|
5320
|
+
underline: H($t, "boolean"),
|
|
5321
|
+
strike: H(Wt, "boolean"),
|
|
5322
|
+
code: H(Ft, "boolean"),
|
|
5023
5323
|
textColor: pi,
|
|
5024
5324
|
backgroundColor: ci
|
|
5025
|
-
},
|
|
5325
|
+
}, Pr = ut(mt), ft = {
|
|
5026
5326
|
text: { config: "text", implementation: {} },
|
|
5027
5327
|
link: { config: "link", implementation: {} }
|
|
5028
|
-
},
|
|
5328
|
+
}, Hr = dt(
|
|
5029
5329
|
ft
|
|
5030
5330
|
);
|
|
5031
|
-
function
|
|
5032
|
-
return t in e.schema.blockSchema && e.schema.blockSchema[t] ===
|
|
5331
|
+
function x(t, e) {
|
|
5332
|
+
return t in e.schema.blockSchema && e.schema.blockSchema[t] === Hi[t];
|
|
5033
5333
|
}
|
|
5034
|
-
function
|
|
5035
|
-
return e.type === t && e.type in o.schema.blockSchema &&
|
|
5334
|
+
function Ui(t, e, o) {
|
|
5335
|
+
return e.type === t && e.type in o.schema.blockSchema && x(e.type, o);
|
|
5036
5336
|
}
|
|
5037
|
-
function
|
|
5337
|
+
function Ur(t, e) {
|
|
5038
5338
|
return t.type in e.schema.blockSchema && e.schema.blockSchema[t.type].isFileBlock || !1;
|
|
5039
5339
|
}
|
|
5040
|
-
function
|
|
5340
|
+
function Dr(t, e) {
|
|
5041
5341
|
return t.type in e.schema.blockSchema && e.schema.blockSchema[t.type].isFileBlock && "showPreview" in e.schema.blockSchema[t.type].propSchema || !1;
|
|
5042
5342
|
}
|
|
5043
|
-
function
|
|
5044
|
-
|
|
5045
|
-
return o.isFileBlock && o.isFileBlockPlaceholder(t);
|
|
5343
|
+
function Or(t, e) {
|
|
5344
|
+
return e.schema.blockSchema[t.type].isFileBlock && !t.props.url;
|
|
5046
5345
|
}
|
|
5047
|
-
function
|
|
5048
|
-
return e in o.schema.blockSchema && t in o.schema.blockSchema[e].propSchema && o.schema.blockSchema[e].propSchema[t] ===
|
|
5346
|
+
function Di(t, e, o) {
|
|
5347
|
+
return e in o.schema.blockSchema && t in o.schema.blockSchema[e].propSchema && o.schema.blockSchema[e].propSchema[t] === y[t];
|
|
5049
5348
|
}
|
|
5050
|
-
function
|
|
5051
|
-
return
|
|
5349
|
+
function Rr(t, e, o) {
|
|
5350
|
+
return Di(t, e.type, o);
|
|
5052
5351
|
}
|
|
5053
|
-
function
|
|
5352
|
+
function Se(t, e) {
|
|
5054
5353
|
let o, i;
|
|
5055
5354
|
if (e.firstChild.descendants((n, r) => o ? !1 : n.type.name !== "blockContainer" || n.attrs.id !== t ? !0 : (o = n, i = r + 1, !1)), o === void 0 || i === void 0)
|
|
5056
5355
|
throw Error("Could not find block in the editor with matching ID.");
|
|
@@ -5059,13 +5358,13 @@ function Ce(t, e) {
|
|
|
5059
5358
|
posBeforeNode: i
|
|
5060
5359
|
};
|
|
5061
5360
|
}
|
|
5062
|
-
function
|
|
5361
|
+
function Oi(t, e, o = "before", i) {
|
|
5063
5362
|
const n = i._tiptapEditor, r = typeof e == "string" ? e : e.id, a = [];
|
|
5064
5363
|
for (const u of t)
|
|
5065
5364
|
a.push(
|
|
5066
5365
|
N(u, n.schema, i.schema.styleSchema)
|
|
5067
5366
|
);
|
|
5068
|
-
const { node: s, posBeforeNode: l } =
|
|
5367
|
+
const { node: s, posBeforeNode: l } = Se(r, n.state.doc);
|
|
5069
5368
|
if (o === "before" && n.view.dispatch(
|
|
5070
5369
|
n.state.tr.insert(l, a)
|
|
5071
5370
|
), o === "after" && n.view.dispatch(
|
|
@@ -5085,7 +5384,7 @@ function Pi(t, e, o = "before", i) {
|
|
|
5085
5384
|
const d = [];
|
|
5086
5385
|
for (const u of a)
|
|
5087
5386
|
d.push(
|
|
5088
|
-
|
|
5387
|
+
v(
|
|
5089
5388
|
u,
|
|
5090
5389
|
i.schema.blockSchema,
|
|
5091
5390
|
i.schema.inlineContentSchema,
|
|
@@ -5095,11 +5394,11 @@ function Pi(t, e, o = "before", i) {
|
|
|
5095
5394
|
);
|
|
5096
5395
|
return d;
|
|
5097
5396
|
}
|
|
5098
|
-
function
|
|
5099
|
-
const i = o._tiptapEditor, n = typeof t == "string" ? t : t.id, { posBeforeNode: r } =
|
|
5397
|
+
function Ri(t, e, o) {
|
|
5398
|
+
const i = o._tiptapEditor, n = typeof t == "string" ? t : t.id, { posBeforeNode: r } = Se(n, i.state.doc);
|
|
5100
5399
|
i.commands.BNUpdateBlock(r + 1, e);
|
|
5101
5400
|
const a = i.state.doc.resolve(r + 1).node();
|
|
5102
|
-
return
|
|
5401
|
+
return v(
|
|
5103
5402
|
a,
|
|
5104
5403
|
o.schema.blockSchema,
|
|
5105
5404
|
o.schema.inlineContentSchema,
|
|
@@ -5120,7 +5419,7 @@ function gt(t, e, o) {
|
|
|
5120
5419
|
if (l.type.name !== "blockContainer" || !r.has(l.attrs.id))
|
|
5121
5420
|
return !0;
|
|
5122
5421
|
a.push(
|
|
5123
|
-
|
|
5422
|
+
v(
|
|
5124
5423
|
l,
|
|
5125
5424
|
e.schema.blockSchema,
|
|
5126
5425
|
e.schema.inlineContentSchema,
|
|
@@ -5141,10 +5440,10 @@ function gt(t, e, o) {
|
|
|
5141
5440
|
}
|
|
5142
5441
|
return i.view.dispatch(n), a;
|
|
5143
5442
|
}
|
|
5144
|
-
function
|
|
5443
|
+
function Vi(t, e) {
|
|
5145
5444
|
return gt(t, e);
|
|
5146
5445
|
}
|
|
5147
|
-
function
|
|
5446
|
+
function ji(t, e, o) {
|
|
5148
5447
|
const i = o._tiptapEditor, n = [];
|
|
5149
5448
|
for (const l of e)
|
|
5150
5449
|
n.push(
|
|
@@ -5157,15 +5456,15 @@ function Di(t, e, o) {
|
|
|
5157
5456
|
if (l.attrs.id === r) {
|
|
5158
5457
|
const h = u.doc.nodeSize;
|
|
5159
5458
|
u.insert(d, n);
|
|
5160
|
-
const
|
|
5161
|
-
return p + h -
|
|
5459
|
+
const m = u.doc.nodeSize;
|
|
5460
|
+
return p + h - m;
|
|
5162
5461
|
}
|
|
5163
5462
|
return p;
|
|
5164
5463
|
}
|
|
5165
5464
|
), s = [];
|
|
5166
5465
|
for (const l of n)
|
|
5167
5466
|
s.push(
|
|
5168
|
-
|
|
5467
|
+
v(
|
|
5169
5468
|
l,
|
|
5170
5469
|
o.schema.blockSchema,
|
|
5171
5470
|
o.schema.inlineContentSchema,
|
|
@@ -5175,7 +5474,7 @@ function Di(t, e, o) {
|
|
|
5175
5474
|
);
|
|
5176
5475
|
return { insertedBlocks: s, removedBlocks: a };
|
|
5177
5476
|
}
|
|
5178
|
-
function
|
|
5477
|
+
function zi(t, e, o, i = { updateSelection: !0 }) {
|
|
5179
5478
|
const n = o._tiptapEditor, r = n.state.tr;
|
|
5180
5479
|
let { from: a, to: s } = typeof t == "number" ? { from: t, to: t } : { from: t.from, to: t.to }, l = !0, d = !0, u = "";
|
|
5181
5480
|
if (e.forEach((p) => {
|
|
@@ -5186,7 +5485,7 @@ function Oi(t, e, o, i = { updateSelection: !0 }) {
|
|
|
5186
5485
|
}
|
|
5187
5486
|
return l ? r.insertText(u, a, s) : r.replaceWith(a, s, e), i.updateSelection && Pt(r, r.steps.length - 1, -1), n.view.dispatch(r), !0;
|
|
5188
5487
|
}
|
|
5189
|
-
function
|
|
5488
|
+
function Fi() {
|
|
5190
5489
|
const t = (e) => {
|
|
5191
5490
|
let o = e.children.length;
|
|
5192
5491
|
for (let i = 0; i < o; i++) {
|
|
@@ -5202,35 +5501,50 @@ function Ri() {
|
|
|
5202
5501
|
};
|
|
5203
5502
|
return t;
|
|
5204
5503
|
}
|
|
5205
|
-
function
|
|
5206
|
-
|
|
5504
|
+
function Gi() {
|
|
5505
|
+
const t = (e) => {
|
|
5506
|
+
var o;
|
|
5507
|
+
if (e.children && "length" in e.children && e.children.length)
|
|
5508
|
+
for (let i = e.children.length - 1; i >= 0; i--) {
|
|
5509
|
+
const n = e.children[i], r = i + 1 < e.children.length ? e.children[i + 1] : void 0;
|
|
5510
|
+
n.type === "element" && n.tagName === "input" && ((o = n.properties) == null ? void 0 : o.type) === "checkbox" && (r == null ? void 0 : r.type) === "element" && r.tagName === "p" ? (r.tagName = "span", r.children.splice(
|
|
5511
|
+
0,
|
|
5512
|
+
0,
|
|
5513
|
+
ye(document.createTextNode(" "))
|
|
5514
|
+
)) : t(n);
|
|
5515
|
+
}
|
|
5516
|
+
};
|
|
5517
|
+
return t;
|
|
5207
5518
|
}
|
|
5208
|
-
function
|
|
5209
|
-
|
|
5210
|
-
return Se(n);
|
|
5519
|
+
function Me(t) {
|
|
5520
|
+
return we().use(Ke, { fragment: !0 }).use(Fi).use(Gi).use(Yt).use(Xe).use(Qt).processSync(t).value;
|
|
5211
5521
|
}
|
|
5212
|
-
function
|
|
5522
|
+
function Wi(t, e, o) {
|
|
5523
|
+
const n = re(e, o).exportBlocks(t);
|
|
5524
|
+
return Me(n);
|
|
5525
|
+
}
|
|
5526
|
+
function $i(t) {
|
|
5213
5527
|
return Array.prototype.indexOf.call(t.parentElement.childNodes, t);
|
|
5214
5528
|
}
|
|
5215
|
-
function
|
|
5529
|
+
function Ki(t) {
|
|
5216
5530
|
return t.nodeType === 3 && !/\S/.test(t.nodeValue || "");
|
|
5217
5531
|
}
|
|
5218
|
-
function
|
|
5532
|
+
function qi(t) {
|
|
5219
5533
|
t.querySelectorAll("li > ul, li > ol").forEach((e) => {
|
|
5220
|
-
const o =
|
|
5534
|
+
const o = $i(e), i = e.parentElement, n = Array.from(i.childNodes).slice(
|
|
5221
5535
|
o + 1
|
|
5222
5536
|
);
|
|
5223
5537
|
e.remove(), n.forEach((r) => {
|
|
5224
5538
|
r.remove();
|
|
5225
5539
|
}), i.insertAdjacentElement("afterend", e), n.reverse().forEach((r) => {
|
|
5226
|
-
if (
|
|
5540
|
+
if (Ki(r))
|
|
5227
5541
|
return;
|
|
5228
5542
|
const a = document.createElement("li");
|
|
5229
5543
|
a.append(r), e.insertAdjacentElement("afterend", a);
|
|
5230
5544
|
}), i.childNodes.length === 0 && i.remove();
|
|
5231
5545
|
});
|
|
5232
5546
|
}
|
|
5233
|
-
function
|
|
5547
|
+
function Xi(t) {
|
|
5234
5548
|
t.querySelectorAll("li + ul, li + ol").forEach((e) => {
|
|
5235
5549
|
var r, a;
|
|
5236
5550
|
const o = e.previousElementSibling, i = document.createElement("div");
|
|
@@ -5241,15 +5555,15 @@ function Gi(t) {
|
|
|
5241
5555
|
});
|
|
5242
5556
|
}
|
|
5243
5557
|
let ze = null;
|
|
5244
|
-
function
|
|
5558
|
+
function Zi() {
|
|
5245
5559
|
return ze || (ze = document.implementation.createHTMLDocument("title"));
|
|
5246
5560
|
}
|
|
5247
5561
|
function bt(t) {
|
|
5248
5562
|
if (typeof t == "string") {
|
|
5249
|
-
const e =
|
|
5563
|
+
const e = Zi().createElement("div");
|
|
5250
5564
|
e.innerHTML = t, t = e;
|
|
5251
5565
|
}
|
|
5252
|
-
return
|
|
5566
|
+
return qi(t), Xi(t), t;
|
|
5253
5567
|
}
|
|
5254
5568
|
async function kt(t, e, o, i, n) {
|
|
5255
5569
|
const r = bt(t), s = St.fromSchema(n).parse(r, {
|
|
@@ -5257,11 +5571,11 @@ async function kt(t, e, o, i, n) {
|
|
|
5257
5571
|
}), l = [];
|
|
5258
5572
|
for (let d = 0; d < s.childCount; d++)
|
|
5259
5573
|
l.push(
|
|
5260
|
-
|
|
5574
|
+
v(s.child(d), e, o, i)
|
|
5261
5575
|
);
|
|
5262
5576
|
return l;
|
|
5263
5577
|
}
|
|
5264
|
-
function
|
|
5578
|
+
function Ji(t, e) {
|
|
5265
5579
|
const o = e.value ? e.value + `
|
|
5266
5580
|
` : "", i = {};
|
|
5267
5581
|
e.lang && (i["data-language"] = e.lang);
|
|
@@ -5278,11 +5592,11 @@ function $i(t, e) {
|
|
|
5278
5592
|
children: [n]
|
|
5279
5593
|
}, t.patch(e, n), n;
|
|
5280
5594
|
}
|
|
5281
|
-
function
|
|
5282
|
-
const r =
|
|
5595
|
+
function Yi(t, e, o, i, n) {
|
|
5596
|
+
const r = we().use(eo).use(Xe).use(to, {
|
|
5283
5597
|
handlers: {
|
|
5284
5598
|
...oo,
|
|
5285
|
-
code:
|
|
5599
|
+
code: Ji
|
|
5286
5600
|
}
|
|
5287
5601
|
}).use(qe).processSync(t);
|
|
5288
5602
|
return kt(
|
|
@@ -5293,7 +5607,7 @@ function Ki(t, e, o, i, n) {
|
|
|
5293
5607
|
n
|
|
5294
5608
|
);
|
|
5295
5609
|
}
|
|
5296
|
-
class
|
|
5610
|
+
class K {
|
|
5297
5611
|
constructor() {
|
|
5298
5612
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
5299
5613
|
c(this, "callbacks", {});
|
|
@@ -5313,7 +5627,7 @@ class W {
|
|
|
5313
5627
|
this.callbacks = {};
|
|
5314
5628
|
}
|
|
5315
5629
|
}
|
|
5316
|
-
class
|
|
5630
|
+
class Qi {
|
|
5317
5631
|
constructor(e, o, i) {
|
|
5318
5632
|
c(this, "state");
|
|
5319
5633
|
c(this, "emitUpdate");
|
|
@@ -5366,18 +5680,18 @@ class qi {
|
|
|
5366
5680
|
this.pmView.dom.removeEventListener("mousedown", this.mouseDownHandler), this.pmView.dom.removeEventListener("dragstart", this.dragstartHandler), document.removeEventListener("scroll", this.scrollHandler);
|
|
5367
5681
|
}
|
|
5368
5682
|
}
|
|
5369
|
-
const
|
|
5370
|
-
class
|
|
5683
|
+
const fe = new S("FilePanelPlugin");
|
|
5684
|
+
class en extends K {
|
|
5371
5685
|
constructor(o) {
|
|
5372
5686
|
super();
|
|
5373
5687
|
c(this, "view");
|
|
5374
5688
|
c(this, "plugin");
|
|
5375
5689
|
c(this, "closeMenu", () => this.view.closeMenu());
|
|
5376
|
-
this.plugin = new
|
|
5377
|
-
key:
|
|
5378
|
-
view: (i) => (this.view = new
|
|
5690
|
+
this.plugin = new _({
|
|
5691
|
+
key: fe,
|
|
5692
|
+
view: (i) => (this.view = new Qi(
|
|
5379
5693
|
// editor,
|
|
5380
|
-
|
|
5694
|
+
fe,
|
|
5381
5695
|
i,
|
|
5382
5696
|
(n) => {
|
|
5383
5697
|
this.emit("update", n);
|
|
@@ -5393,7 +5707,7 @@ class Xi extends W {
|
|
|
5393
5707
|
apply: (i) => {
|
|
5394
5708
|
var r;
|
|
5395
5709
|
return {
|
|
5396
|
-
block: (r = i.getMeta(
|
|
5710
|
+
block: (r = i.getMeta(fe)) == null ? void 0 : r.block
|
|
5397
5711
|
};
|
|
5398
5712
|
}
|
|
5399
5713
|
}
|
|
@@ -5407,7 +5721,7 @@ class Xi extends W {
|
|
|
5407
5721
|
return this.on("update", o);
|
|
5408
5722
|
}
|
|
5409
5723
|
}
|
|
5410
|
-
class
|
|
5724
|
+
class tn {
|
|
5411
5725
|
constructor(e, o, i) {
|
|
5412
5726
|
c(this, "state");
|
|
5413
5727
|
c(this, "emitUpdate");
|
|
@@ -5446,12 +5760,12 @@ class Zi {
|
|
|
5446
5760
|
}, o.dom.addEventListener("mousedown", this.viewMousedownHandler), o.dom.addEventListener("mouseup", this.viewMouseupHandler), o.dom.addEventListener("dragstart", this.dragHandler), o.dom.addEventListener("dragover", this.dragHandler), document.addEventListener("scroll", this.scrollHandler);
|
|
5447
5761
|
}
|
|
5448
5762
|
update(e, o) {
|
|
5449
|
-
var h,
|
|
5763
|
+
var h, m;
|
|
5450
5764
|
const { state: i, composing: n } = e, { doc: r, selection: a } = i, s = o && o.doc.eq(r) && o.selection.eq(a);
|
|
5451
5765
|
if ((this.prevWasEditable === null || this.prevWasEditable === this.editor.isEditable) && (n || s))
|
|
5452
5766
|
return;
|
|
5453
5767
|
this.prevWasEditable = this.editor.isEditable;
|
|
5454
|
-
const { ranges: l } = a, d = Math.min(...l.map((
|
|
5768
|
+
const { ranges: l } = a, d = Math.min(...l.map((f) => f.$from.pos)), u = Math.max(...l.map((f) => f.$to.pos)), p = (h = this.shouldShow) == null ? void 0 : h.call(this, {
|
|
5455
5769
|
view: e,
|
|
5456
5770
|
state: i,
|
|
5457
5771
|
from: d,
|
|
@@ -5464,7 +5778,7 @@ class Zi {
|
|
|
5464
5778
|
}, this.emitUpdate();
|
|
5465
5779
|
return;
|
|
5466
5780
|
}
|
|
5467
|
-
if ((
|
|
5781
|
+
if ((m = this.state) != null && m.show && !this.preventHide && (!p || this.preventShow || !this.editor.isEditable)) {
|
|
5468
5782
|
this.state.show = !1, this.emitUpdate();
|
|
5469
5783
|
return;
|
|
5470
5784
|
}
|
|
@@ -5479,21 +5793,21 @@ class Zi {
|
|
|
5479
5793
|
if (a)
|
|
5480
5794
|
return a.getBoundingClientRect();
|
|
5481
5795
|
}
|
|
5482
|
-
return
|
|
5796
|
+
return ke(this.pmView, n, r);
|
|
5483
5797
|
}
|
|
5484
5798
|
}
|
|
5485
|
-
const
|
|
5799
|
+
const on = new S(
|
|
5486
5800
|
"FormattingToolbarPlugin"
|
|
5487
5801
|
);
|
|
5488
|
-
class
|
|
5802
|
+
class nn extends K {
|
|
5489
5803
|
constructor(o) {
|
|
5490
5804
|
super();
|
|
5491
5805
|
c(this, "view");
|
|
5492
5806
|
c(this, "plugin");
|
|
5493
5807
|
c(this, "closeMenu", () => this.view.closeMenu());
|
|
5494
|
-
this.plugin = new
|
|
5495
|
-
key:
|
|
5496
|
-
view: (i) => (this.view = new
|
|
5808
|
+
this.plugin = new _({
|
|
5809
|
+
key: on,
|
|
5810
|
+
view: (i) => (this.view = new tn(o, i, (n) => {
|
|
5497
5811
|
this.emit("update", n);
|
|
5498
5812
|
}), this.view),
|
|
5499
5813
|
props: {
|
|
@@ -5509,7 +5823,7 @@ class Yi extends W {
|
|
|
5509
5823
|
return this.on("update", o);
|
|
5510
5824
|
}
|
|
5511
5825
|
}
|
|
5512
|
-
class
|
|
5826
|
+
class rn {
|
|
5513
5827
|
constructor(e, o, i) {
|
|
5514
5828
|
c(this, "state");
|
|
5515
5829
|
c(this, "emitUpdate");
|
|
@@ -5527,7 +5841,7 @@ class Qi {
|
|
|
5527
5841
|
const o = e.target, i = this.pmView.posAtDOM(o, 0) + 1, n = this.pmView.state.doc.resolve(i), r = n.marks();
|
|
5528
5842
|
for (const a of r)
|
|
5529
5843
|
if (a.type.name === this.pmView.state.schema.mark("link").type.name) {
|
|
5530
|
-
this.mouseHoveredLinkMark = a, this.mouseHoveredLinkMarkRange =
|
|
5844
|
+
this.mouseHoveredLinkMark = a, this.mouseHoveredLinkMarkRange = Ne(n, a.type, a.attrs) || void 0;
|
|
5531
5845
|
break;
|
|
5532
5846
|
}
|
|
5533
5847
|
}
|
|
@@ -5543,7 +5857,7 @@ class Qi {
|
|
|
5543
5857
|
});
|
|
5544
5858
|
c(this, "scrollHandler", () => {
|
|
5545
5859
|
var e;
|
|
5546
|
-
this.linkMark !== void 0 && (e = this.state) != null && e.show && (this.state.referencePos =
|
|
5860
|
+
this.linkMark !== void 0 && (e = this.state) != null && e.show && (this.state.referencePos = ke(
|
|
5547
5861
|
this.pmView,
|
|
5548
5862
|
this.linkMarkRange.from,
|
|
5549
5863
|
this.linkMarkRange.to
|
|
@@ -5595,7 +5909,7 @@ class Qi {
|
|
|
5595
5909
|
const i = this.pmView.state.selection.$from.marks();
|
|
5596
5910
|
for (const n of i)
|
|
5597
5911
|
if (n.type.name === this.pmView.state.schema.mark("link").type.name) {
|
|
5598
|
-
this.keyboardHoveredLinkMark = n, this.keyboardHoveredLinkMarkRange =
|
|
5912
|
+
this.keyboardHoveredLinkMark = n, this.keyboardHoveredLinkMarkRange = Ne(
|
|
5599
5913
|
this.pmView.state.selection.$from,
|
|
5600
5914
|
n.type,
|
|
5601
5915
|
n.attrs
|
|
@@ -5606,7 +5920,7 @@ class Qi {
|
|
|
5606
5920
|
if (this.mouseHoveredLinkMark && (this.linkMark = this.mouseHoveredLinkMark, this.linkMarkRange = this.mouseHoveredLinkMarkRange), this.keyboardHoveredLinkMark && (this.linkMark = this.keyboardHoveredLinkMark, this.linkMarkRange = this.keyboardHoveredLinkMarkRange), this.linkMark && this.editor.isEditable) {
|
|
5607
5921
|
this.state = {
|
|
5608
5922
|
show: !0,
|
|
5609
|
-
referencePos:
|
|
5923
|
+
referencePos: ke(
|
|
5610
5924
|
this.pmView,
|
|
5611
5925
|
this.linkMarkRange.from,
|
|
5612
5926
|
this.linkMarkRange.to
|
|
@@ -5628,8 +5942,8 @@ class Qi {
|
|
|
5628
5942
|
this.pmView.dom.removeEventListener("mouseover", this.mouseOverHandler), document.removeEventListener("scroll", this.scrollHandler), document.removeEventListener("click", this.clickHandler, !0);
|
|
5629
5943
|
}
|
|
5630
5944
|
}
|
|
5631
|
-
const
|
|
5632
|
-
class
|
|
5945
|
+
const an = new S("LinkToolbarPlugin");
|
|
5946
|
+
class sn extends K {
|
|
5633
5947
|
constructor(o) {
|
|
5634
5948
|
super();
|
|
5635
5949
|
c(this, "view");
|
|
@@ -5667,9 +5981,9 @@ class tn extends W {
|
|
|
5667
5981
|
this.view.stopMenuUpdateTimer();
|
|
5668
5982
|
});
|
|
5669
5983
|
c(this, "closeMenu", () => this.view.closeMenu());
|
|
5670
|
-
this.plugin = new
|
|
5671
|
-
key:
|
|
5672
|
-
view: (i) => (this.view = new
|
|
5984
|
+
this.plugin = new _({
|
|
5985
|
+
key: an,
|
|
5986
|
+
view: (i) => (this.view = new rn(o, i, (n) => {
|
|
5673
5987
|
this.emit("update", n);
|
|
5674
5988
|
}), this.view),
|
|
5675
5989
|
props: {
|
|
@@ -5685,8 +5999,8 @@ class tn extends W {
|
|
|
5685
5999
|
return ((i = (o = this.view) == null ? void 0 : o.state) == null ? void 0 : i.show) || !1;
|
|
5686
6000
|
}
|
|
5687
6001
|
}
|
|
5688
|
-
const
|
|
5689
|
-
class
|
|
6002
|
+
const ln = Dt((t) => t.type.name === "blockContainer");
|
|
6003
|
+
class dn {
|
|
5690
6004
|
constructor(e, o) {
|
|
5691
6005
|
c(this, "state");
|
|
5692
6006
|
c(this, "emitUpdate");
|
|
@@ -5703,7 +6017,7 @@ class nn {
|
|
|
5703
6017
|
c(this, "closeMenu", () => {
|
|
5704
6018
|
this.editor._tiptapEditor.view.dispatch(
|
|
5705
6019
|
this.editor._tiptapEditor.view.state.tr.setMeta(
|
|
5706
|
-
|
|
6020
|
+
D,
|
|
5707
6021
|
null
|
|
5708
6022
|
)
|
|
5709
6023
|
);
|
|
@@ -5721,7 +6035,7 @@ class nn {
|
|
|
5721
6035
|
}, document.addEventListener("scroll", this.handleScroll);
|
|
5722
6036
|
}
|
|
5723
6037
|
update(e, o) {
|
|
5724
|
-
const i =
|
|
6038
|
+
const i = D.getState(o), n = D.getState(
|
|
5725
6039
|
e.state
|
|
5726
6040
|
), r = i === void 0 && n !== void 0, a = i !== void 0 && n === void 0;
|
|
5727
6041
|
if (!r && !(i !== void 0 && n !== void 0) && !a)
|
|
@@ -5743,8 +6057,8 @@ class nn {
|
|
|
5743
6057
|
document.removeEventListener("scroll", this.handleScroll);
|
|
5744
6058
|
}
|
|
5745
6059
|
}
|
|
5746
|
-
const
|
|
5747
|
-
class
|
|
6060
|
+
const D = new S("SuggestionMenuPlugin");
|
|
6061
|
+
class cn extends K {
|
|
5748
6062
|
constructor(o) {
|
|
5749
6063
|
super();
|
|
5750
6064
|
c(this, "view");
|
|
@@ -5762,9 +6076,9 @@ class rn extends W {
|
|
|
5762
6076
|
c(this, "closeMenu", () => this.view.closeMenu());
|
|
5763
6077
|
c(this, "clearQuery", () => this.view.clearQuery());
|
|
5764
6078
|
const i = this.triggerCharacters;
|
|
5765
|
-
this.plugin = new
|
|
5766
|
-
key:
|
|
5767
|
-
view: () => (this.view = new
|
|
6079
|
+
this.plugin = new _({
|
|
6080
|
+
key: D,
|
|
6081
|
+
view: () => (this.view = new dn(
|
|
5768
6082
|
o,
|
|
5769
6083
|
(n, r) => {
|
|
5770
6084
|
this.emit(`update ${n}`, r);
|
|
@@ -5778,7 +6092,7 @@ class rn extends W {
|
|
|
5778
6092
|
apply(n, r, a, s) {
|
|
5779
6093
|
if (n.getMeta("orderedListIndexing") !== void 0)
|
|
5780
6094
|
return r;
|
|
5781
|
-
const l = n.getMeta(
|
|
6095
|
+
const l = n.getMeta(D);
|
|
5782
6096
|
if (typeof l == "object" && l !== null && r === void 0)
|
|
5783
6097
|
return {
|
|
5784
6098
|
triggerCharacter: l.triggerCharacter,
|
|
@@ -5809,7 +6123,7 @@ class rn extends W {
|
|
|
5809
6123
|
handleTextInput(n, r, a, s) {
|
|
5810
6124
|
const l = this.getState(n.state);
|
|
5811
6125
|
return i.includes(s) && l === void 0 ? (n.dispatch(
|
|
5812
|
-
n.state.tr.insertText(s).scrollIntoView().setMeta(
|
|
6126
|
+
n.state.tr.insertText(s).scrollIntoView().setMeta(D, {
|
|
5813
6127
|
triggerCharacter: s
|
|
5814
6128
|
})
|
|
5815
6129
|
), !0) : !1;
|
|
@@ -5820,10 +6134,10 @@ class rn extends W {
|
|
|
5820
6134
|
if (r === void 0)
|
|
5821
6135
|
return null;
|
|
5822
6136
|
if (!r.fromUserInput) {
|
|
5823
|
-
const a =
|
|
6137
|
+
const a = ln(n.selection);
|
|
5824
6138
|
if (a)
|
|
5825
|
-
return
|
|
5826
|
-
|
|
6139
|
+
return F.create(n.doc, [
|
|
6140
|
+
G.node(
|
|
5827
6141
|
a.pos,
|
|
5828
6142
|
a.pos + a.node.nodeSize,
|
|
5829
6143
|
{
|
|
@@ -5834,8 +6148,8 @@ class rn extends W {
|
|
|
5834
6148
|
)
|
|
5835
6149
|
]);
|
|
5836
6150
|
}
|
|
5837
|
-
return
|
|
5838
|
-
|
|
6151
|
+
return F.create(n.doc, [
|
|
6152
|
+
G.inline(
|
|
5839
6153
|
r.queryStartPos - r.triggerCharacter.length,
|
|
5840
6154
|
r.queryStartPos,
|
|
5841
6155
|
{
|
|
@@ -5857,10 +6171,10 @@ class rn extends W {
|
|
|
5857
6171
|
return ((i = (o = this.view) == null ? void 0 : o.state) == null ? void 0 : i.show) || !1;
|
|
5858
6172
|
}
|
|
5859
6173
|
}
|
|
5860
|
-
function
|
|
6174
|
+
function Vr(t, e) {
|
|
5861
6175
|
t.suggestionMenus.addTriggerCharacter(e);
|
|
5862
6176
|
}
|
|
5863
|
-
class
|
|
6177
|
+
class z extends he {
|
|
5864
6178
|
constructor(o, i) {
|
|
5865
6179
|
super(o, i);
|
|
5866
6180
|
c(this, "nodes");
|
|
@@ -5871,13 +6185,13 @@ class V extends ue {
|
|
|
5871
6185
|
});
|
|
5872
6186
|
}
|
|
5873
6187
|
static create(o, i, n = i) {
|
|
5874
|
-
return new
|
|
6188
|
+
return new z(o.resolve(i), o.resolve(n));
|
|
5875
6189
|
}
|
|
5876
6190
|
content() {
|
|
5877
|
-
return new
|
|
6191
|
+
return new U(T.from(this.nodes), 0, 0);
|
|
5878
6192
|
}
|
|
5879
6193
|
eq(o) {
|
|
5880
|
-
if (!(o instanceof
|
|
6194
|
+
if (!(o instanceof z) || this.nodes.length !== o.nodes.length || this.from !== o.from || this.to !== o.to)
|
|
5881
6195
|
return !1;
|
|
5882
6196
|
for (let i = 0; i < this.nodes.length; i++)
|
|
5883
6197
|
if (!this.nodes[i].eq(o.nodes[i]))
|
|
@@ -5886,7 +6200,7 @@ class V extends ue {
|
|
|
5886
6200
|
}
|
|
5887
6201
|
map(o, i) {
|
|
5888
6202
|
const n = i.mapResult(this.from), r = i.mapResult(this.to);
|
|
5889
|
-
return r.deleted ?
|
|
6203
|
+
return r.deleted ? he.near(o.resolve(n.pos)) : n.deleted ? he.near(o.resolve(r.pos)) : new z(
|
|
5890
6204
|
o.resolve(n.pos),
|
|
5891
6205
|
o.resolve(r.pos)
|
|
5892
6206
|
);
|
|
@@ -5896,7 +6210,7 @@ class V extends ue {
|
|
|
5896
6210
|
}
|
|
5897
6211
|
}
|
|
5898
6212
|
let A;
|
|
5899
|
-
function
|
|
6213
|
+
function Te(t, e) {
|
|
5900
6214
|
var n;
|
|
5901
6215
|
if (!e.dom.isConnected)
|
|
5902
6216
|
return;
|
|
@@ -5911,15 +6225,15 @@ function Me(t, e) {
|
|
|
5911
6225
|
return { node: i, id: i.getAttribute("data-id") };
|
|
5912
6226
|
}
|
|
5913
6227
|
}
|
|
5914
|
-
function
|
|
5915
|
-
const o =
|
|
6228
|
+
function un(t, e) {
|
|
6229
|
+
const o = Te(t, e);
|
|
5916
6230
|
if (o && o.node.nodeType === 1) {
|
|
5917
6231
|
const i = e.docView, n = i.nearestDesc(o.node, !0);
|
|
5918
6232
|
return !n || n === i ? null : n.posBefore;
|
|
5919
6233
|
}
|
|
5920
6234
|
return null;
|
|
5921
6235
|
}
|
|
5922
|
-
function
|
|
6236
|
+
function pn(t, e) {
|
|
5923
6237
|
let o, i;
|
|
5924
6238
|
const n = e.resolve(t.from).node().type.spec.group === "blockContent", r = e.resolve(t.to).node().type.spec.group === "blockContent", a = Math.min(t.$anchor.depth, t.$head.depth);
|
|
5925
6239
|
if (n && r) {
|
|
@@ -5951,30 +6265,30 @@ function Fe(t, e, o = e) {
|
|
|
5951
6265
|
function yt() {
|
|
5952
6266
|
A !== void 0 && (document.body.removeChild(A), A = void 0);
|
|
5953
6267
|
}
|
|
5954
|
-
function
|
|
6268
|
+
function hn(t, e) {
|
|
5955
6269
|
if (!t.dataTransfer)
|
|
5956
6270
|
return;
|
|
5957
6271
|
const o = e.prosemirrorView, i = o.dom.getBoundingClientRect(), n = {
|
|
5958
6272
|
left: i.left + i.width / 2,
|
|
5959
6273
|
// take middle of editor
|
|
5960
6274
|
top: t.clientY
|
|
5961
|
-
}, r =
|
|
6275
|
+
}, r = un(n, o);
|
|
5962
6276
|
if (r != null) {
|
|
5963
|
-
const a = o.state.selection, s = o.state.doc, { from: l, to: d } =
|
|
6277
|
+
const a = o.state.selection, s = o.state.doc, { from: l, to: d } = pn(a, s), u = l <= r && r < d, p = a.$anchor.node() !== a.$head.node() || a instanceof z;
|
|
5964
6278
|
u && p ? (o.dispatch(
|
|
5965
|
-
o.state.tr.setSelection(
|
|
6279
|
+
o.state.tr.setSelection(z.create(s, l, d))
|
|
5966
6280
|
), Fe(o, l, d)) : (o.dispatch(
|
|
5967
|
-
o.state.tr.setSelection(
|
|
6281
|
+
o.state.tr.setSelection(oe.create(o.state.doc, r))
|
|
5968
6282
|
), Fe(o, r));
|
|
5969
|
-
const h = o.state.selection.content(),
|
|
6283
|
+
const h = o.state.selection.content(), m = e._tiptapEditor.schema, g = nt(m, e).serializeProseMirrorFragment(
|
|
5970
6284
|
h.content
|
|
5971
|
-
),
|
|
6285
|
+
), L = re(m, e).exportProseMirrorFragment(
|
|
5972
6286
|
h.content
|
|
5973
|
-
),
|
|
5974
|
-
t.dataTransfer.clearData(), t.dataTransfer.setData("blocknote/html", g), t.dataTransfer.setData("text/html",
|
|
6287
|
+
), M = Me(L);
|
|
6288
|
+
t.dataTransfer.clearData(), t.dataTransfer.setData("blocknote/html", g), t.dataTransfer.setData("text/html", L), t.dataTransfer.setData("text/plain", M), t.dataTransfer.effectAllowed = "move", t.dataTransfer.setDragImage(A, 0, 0), o.dragging = { slice: h, move: !0 };
|
|
5975
6289
|
}
|
|
5976
6290
|
}
|
|
5977
|
-
class
|
|
6291
|
+
class mn {
|
|
5978
6292
|
constructor(e, o, i) {
|
|
5979
6293
|
c(this, "state");
|
|
5980
6294
|
c(this, "emitUpdate");
|
|
@@ -6035,7 +6349,7 @@ class dn {
|
|
|
6035
6349
|
this.state && !this.state.show && (this.state.show = !0, this.emitUpdate(this.state)), this.menuFrozen = !1;
|
|
6036
6350
|
});
|
|
6037
6351
|
c(this, "onMouseMove", (e) => {
|
|
6038
|
-
var d, u, p, h,
|
|
6352
|
+
var d, u, p, h, m;
|
|
6039
6353
|
if (this.menuFrozen)
|
|
6040
6354
|
return;
|
|
6041
6355
|
const o = this.pmView.dom.firstChild.getBoundingClientRect(), i = this.pmView.dom.getBoundingClientRect(), n = e.clientX >= i.left && e.clientX <= i.right && e.clientY >= i.top && e.clientY <= i.bottom, r = this.pmView.dom.parentElement;
|
|
@@ -6053,24 +6367,24 @@ class dn {
|
|
|
6053
6367
|
left: o.left + o.width / 2,
|
|
6054
6368
|
// take middle of editor
|
|
6055
6369
|
top: e.clientY
|
|
6056
|
-
}, s =
|
|
6370
|
+
}, s = Te(a, this.pmView);
|
|
6057
6371
|
if (!s || !this.editor.isEditable) {
|
|
6058
6372
|
(u = this.state) != null && u.show && (this.state.show = !1, this.emitUpdate(this.state));
|
|
6059
6373
|
return;
|
|
6060
6374
|
}
|
|
6061
|
-
if ((p = this.state) != null && p.show && ((h = this.hoveredBlock) != null && h.hasAttribute("data-id")) && ((
|
|
6375
|
+
if ((p = this.state) != null && p.show && ((h = this.hoveredBlock) != null && h.hasAttribute("data-id")) && ((m = this.hoveredBlock) == null ? void 0 : m.getAttribute("data-id")) === s.id)
|
|
6062
6376
|
return;
|
|
6063
6377
|
this.hoveredBlock = s.node;
|
|
6064
6378
|
const l = s.node.firstChild;
|
|
6065
6379
|
if (l && this.editor.isEditable) {
|
|
6066
|
-
const
|
|
6380
|
+
const f = l.getBoundingClientRect();
|
|
6067
6381
|
this.state = {
|
|
6068
6382
|
show: !0,
|
|
6069
6383
|
referencePos: new DOMRect(
|
|
6070
|
-
this.horizontalPosAnchoredAtRoot ? this.horizontalPosAnchor :
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6384
|
+
this.horizontalPosAnchoredAtRoot ? this.horizontalPosAnchor : f.x,
|
|
6385
|
+
f.y,
|
|
6386
|
+
f.width,
|
|
6387
|
+
f.height
|
|
6074
6388
|
),
|
|
6075
6389
|
block: this.editor.getBlock(
|
|
6076
6390
|
this.hoveredBlock.getAttribute("data-id")
|
|
@@ -6122,15 +6436,15 @@ class dn {
|
|
|
6122
6436
|
} else
|
|
6123
6437
|
this.editor._tiptapEditor.commands.setTextSelection(a + 1);
|
|
6124
6438
|
this.pmView.focus(), this.pmView.dispatch(
|
|
6125
|
-
this.pmView.state.tr.scrollIntoView().setMeta(
|
|
6439
|
+
this.pmView.state.tr.scrollIntoView().setMeta(D, {
|
|
6126
6440
|
triggerCharacter: "/",
|
|
6127
6441
|
fromUserInput: !1
|
|
6128
6442
|
})
|
|
6129
6443
|
);
|
|
6130
6444
|
}
|
|
6131
6445
|
}
|
|
6132
|
-
const
|
|
6133
|
-
class
|
|
6446
|
+
const fn = new S("SideMenuPlugin");
|
|
6447
|
+
class gn extends K {
|
|
6134
6448
|
constructor(o) {
|
|
6135
6449
|
super();
|
|
6136
6450
|
c(this, "view");
|
|
@@ -6144,7 +6458,7 @@ class un extends W {
|
|
|
6144
6458
|
* Handles drag & drop events for blocks.
|
|
6145
6459
|
*/
|
|
6146
6460
|
c(this, "blockDragStart", (o) => {
|
|
6147
|
-
this.view.isDragging = !0,
|
|
6461
|
+
this.view.isDragging = !0, hn(o, this.editor);
|
|
6148
6462
|
});
|
|
6149
6463
|
/**
|
|
6150
6464
|
* Handles drag & drop events for blocks.
|
|
@@ -6162,9 +6476,9 @@ class un extends W {
|
|
|
6162
6476
|
* mouse cursor.
|
|
6163
6477
|
*/
|
|
6164
6478
|
c(this, "unfreezeMenu", () => this.view.menuFrozen = !1);
|
|
6165
|
-
this.editor = o, this.plugin = new
|
|
6166
|
-
key:
|
|
6167
|
-
view: (i) => (this.view = new
|
|
6479
|
+
this.editor = o, this.plugin = new _({
|
|
6480
|
+
key: fn,
|
|
6481
|
+
view: (i) => (this.view = new mn(o, i, (n) => {
|
|
6168
6482
|
this.emit("update", n);
|
|
6169
6483
|
}), this.view)
|
|
6170
6484
|
});
|
|
@@ -6173,29 +6487,29 @@ class un extends W {
|
|
|
6173
6487
|
return this.on("update", o);
|
|
6174
6488
|
}
|
|
6175
6489
|
}
|
|
6176
|
-
let
|
|
6490
|
+
let E;
|
|
6177
6491
|
function Ge() {
|
|
6178
|
-
|
|
6492
|
+
E || (E = document.createElement("div"), E.innerHTML = "_", E.style.opacity = "0", E.style.height = "1px", E.style.width = "1px", document.body.appendChild(E));
|
|
6179
6493
|
}
|
|
6180
|
-
function
|
|
6181
|
-
|
|
6494
|
+
function bn() {
|
|
6495
|
+
E && (document.body.removeChild(E), E = void 0);
|
|
6182
6496
|
}
|
|
6183
|
-
function
|
|
6497
|
+
function te(t) {
|
|
6184
6498
|
return Array.prototype.indexOf.call(t.parentElement.childNodes, t);
|
|
6185
6499
|
}
|
|
6186
|
-
function
|
|
6500
|
+
function kn(t) {
|
|
6187
6501
|
for (; t && t.nodeName !== "TD" && t.nodeName !== "TH"; )
|
|
6188
6502
|
t = t.classList && t.classList.contains("ProseMirror") ? null : t.parentNode;
|
|
6189
6503
|
return t;
|
|
6190
6504
|
}
|
|
6191
|
-
function
|
|
6505
|
+
function yn(t) {
|
|
6192
6506
|
t.forEach((e) => {
|
|
6193
6507
|
const o = document.getElementsByClassName(e);
|
|
6194
6508
|
for (let i = 0; i < o.length; i++)
|
|
6195
6509
|
o[i].style.visibility = "hidden";
|
|
6196
6510
|
});
|
|
6197
6511
|
}
|
|
6198
|
-
class
|
|
6512
|
+
class vn {
|
|
6199
6513
|
constructor(e, o, i) {
|
|
6200
6514
|
c(this, "state");
|
|
6201
6515
|
c(this, "emitUpdate");
|
|
@@ -6207,40 +6521,44 @@ class fn {
|
|
|
6207
6521
|
var d;
|
|
6208
6522
|
if (this.menuFrozen)
|
|
6209
6523
|
return;
|
|
6210
|
-
const o =
|
|
6524
|
+
const o = kn(e.target);
|
|
6211
6525
|
if (!o || !this.editor.isEditable) {
|
|
6212
6526
|
(d = this.state) != null && d.show && (this.state.show = !1, this.emitUpdate());
|
|
6213
6527
|
return;
|
|
6214
6528
|
}
|
|
6215
|
-
const i =
|
|
6529
|
+
const i = te(o), n = te(o.parentElement), r = o.getBoundingClientRect(), a = o.parentElement.parentElement.getBoundingClientRect(), s = Te(r, this.pmView);
|
|
6216
6530
|
if (!s)
|
|
6217
|
-
throw new Error(
|
|
6218
|
-
"Found table cell element, but could not find surrounding blockContent element."
|
|
6219
|
-
);
|
|
6220
|
-
if (this.tableId = s.id, this.state !== void 0 && this.state.show && this.tableId === s.id && this.state.rowIndex === n && this.state.colIndex === i)
|
|
6221
6531
|
return;
|
|
6222
6532
|
let l;
|
|
6223
|
-
|
|
6224
|
-
u
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6533
|
+
if (this.editor._tiptapEditor.state.doc.descendants((u, p) => {
|
|
6534
|
+
if (typeof l < "u")
|
|
6535
|
+
return !1;
|
|
6536
|
+
if (u.type.name !== "blockContainer" || u.attrs.id !== s.id)
|
|
6537
|
+
return !0;
|
|
6538
|
+
const h = v(
|
|
6539
|
+
u,
|
|
6540
|
+
this.editor.schema.blockSchema,
|
|
6541
|
+
this.editor.schema.inlineContentSchema,
|
|
6542
|
+
this.editor.schema.styleSchema,
|
|
6543
|
+
this.editor.blockCache
|
|
6544
|
+
);
|
|
6545
|
+
return Ui("table", h, this.editor) && (this.tablePos = p + 1, l = h), !1;
|
|
6546
|
+
}), !!l && (this.tableId = s.id, !(this.state !== void 0 && this.state.show && this.tableId === s.id && this.state.rowIndex === n && this.state.colIndex === i)))
|
|
6547
|
+
return this.state = {
|
|
6548
|
+
show: !0,
|
|
6549
|
+
referencePosCell: r,
|
|
6550
|
+
referencePosTable: a,
|
|
6551
|
+
block: l,
|
|
6552
|
+
colIndex: i,
|
|
6553
|
+
rowIndex: n,
|
|
6554
|
+
draggingState: void 0
|
|
6555
|
+
}, this.emitUpdate(), !1;
|
|
6238
6556
|
});
|
|
6239
6557
|
c(this, "dragOverHandler", (e) => {
|
|
6240
6558
|
var h;
|
|
6241
6559
|
if (((h = this.state) == null ? void 0 : h.draggingState) === void 0)
|
|
6242
6560
|
return;
|
|
6243
|
-
e.preventDefault(), e.dataTransfer.dropEffect = "move",
|
|
6561
|
+
e.preventDefault(), e.dataTransfer.dropEffect = "move", yn([
|
|
6244
6562
|
"column-resize-handle",
|
|
6245
6563
|
"prosemirror-dropcursor-block",
|
|
6246
6564
|
"prosemirror-dropcursor-inline"
|
|
@@ -6255,7 +6573,7 @@ class fn {
|
|
|
6255
6573
|
this.state.referencePosTable.bottom - 1
|
|
6256
6574
|
)
|
|
6257
6575
|
}, i = document.elementsFromPoint(o.left, o.top).filter(
|
|
6258
|
-
(
|
|
6576
|
+
(m) => m.tagName === "TD" || m.tagName === "TH"
|
|
6259
6577
|
);
|
|
6260
6578
|
if (i.length === 0)
|
|
6261
6579
|
throw new Error(
|
|
@@ -6263,11 +6581,11 @@ class fn {
|
|
|
6263
6581
|
);
|
|
6264
6582
|
const n = i[0];
|
|
6265
6583
|
let r = !1;
|
|
6266
|
-
const a =
|
|
6584
|
+
const a = te(n.parentElement), s = te(n), l = this.state.draggingState.draggedCellOrientation === "row" ? this.state.rowIndex : this.state.colIndex, u = (this.state.draggingState.draggedCellOrientation === "row" ? a : s) !== l;
|
|
6267
6585
|
(this.state.rowIndex !== a || this.state.colIndex !== s) && (this.state.rowIndex = a, this.state.colIndex = s, this.state.referencePosCell = n.getBoundingClientRect(), r = !0);
|
|
6268
6586
|
const p = this.state.draggingState.draggedCellOrientation === "row" ? o.top : o.left;
|
|
6269
6587
|
this.state.draggingState.mousePos !== p && (this.state.draggingState.mousePos = p, r = !0), r && this.emitUpdate(), u && this.pmView.dispatch(
|
|
6270
|
-
this.pmView.state.tr.setMeta(
|
|
6588
|
+
this.pmView.state.tr.setMeta(J, !0)
|
|
6271
6589
|
);
|
|
6272
6590
|
});
|
|
6273
6591
|
c(this, "dropHandler", (e) => {
|
|
@@ -6315,8 +6633,8 @@ class fn {
|
|
|
6315
6633
|
this.pmView.dom.removeEventListener("mousemove", this.mouseMoveHandler), document.removeEventListener("dragover", this.dragOverHandler), document.removeEventListener("drop", this.dropHandler), document.removeEventListener("scroll", this.scrollHandler);
|
|
6316
6634
|
}
|
|
6317
6635
|
}
|
|
6318
|
-
const
|
|
6319
|
-
class
|
|
6636
|
+
const J = new S("TableHandlesPlugin");
|
|
6637
|
+
class _n extends K {
|
|
6320
6638
|
constructor(o) {
|
|
6321
6639
|
super();
|
|
6322
6640
|
c(this, "view");
|
|
@@ -6335,13 +6653,13 @@ class gn extends W {
|
|
|
6335
6653
|
originalIndex: this.view.state.colIndex,
|
|
6336
6654
|
mousePos: o.clientX
|
|
6337
6655
|
}, this.view.emitUpdate(), this.editor._tiptapEditor.view.dispatch(
|
|
6338
|
-
this.editor._tiptapEditor.state.tr.setMeta(
|
|
6656
|
+
this.editor._tiptapEditor.state.tr.setMeta(J, {
|
|
6339
6657
|
draggedCellOrientation: this.view.state.draggingState.draggedCellOrientation,
|
|
6340
6658
|
originalIndex: this.view.state.colIndex,
|
|
6341
6659
|
newIndex: this.view.state.colIndex,
|
|
6342
6660
|
tablePos: this.view.tablePos
|
|
6343
6661
|
})
|
|
6344
|
-
), Ge(), o.dataTransfer.setDragImage(
|
|
6662
|
+
), Ge(), o.dataTransfer.setDragImage(E, 0, 0), o.dataTransfer.effectAllowed = "move";
|
|
6345
6663
|
});
|
|
6346
6664
|
/**
|
|
6347
6665
|
* Callback that should be set on the `dragStart` event for whichever element
|
|
@@ -6357,13 +6675,13 @@ class gn extends W {
|
|
|
6357
6675
|
originalIndex: this.view.state.rowIndex,
|
|
6358
6676
|
mousePos: o.clientY
|
|
6359
6677
|
}, this.view.emitUpdate(), this.editor._tiptapEditor.view.dispatch(
|
|
6360
|
-
this.editor._tiptapEditor.state.tr.setMeta(
|
|
6678
|
+
this.editor._tiptapEditor.state.tr.setMeta(J, {
|
|
6361
6679
|
draggedCellOrientation: this.view.state.draggingState.draggedCellOrientation,
|
|
6362
6680
|
originalIndex: this.view.state.rowIndex,
|
|
6363
6681
|
newIndex: this.view.state.rowIndex,
|
|
6364
6682
|
tablePos: this.view.tablePos
|
|
6365
6683
|
})
|
|
6366
|
-
), Ge(), o.dataTransfer.setDragImage(
|
|
6684
|
+
), Ge(), o.dataTransfer.setDragImage(E, 0, 0), o.dataTransfer.effectAllowed = "copyMove";
|
|
6367
6685
|
});
|
|
6368
6686
|
/**
|
|
6369
6687
|
* Callback that should be set on the `dragEnd` event for both the element
|
|
@@ -6375,8 +6693,8 @@ class gn extends W {
|
|
|
6375
6693
|
"Attempted to drag table row, but no table block was hovered prior."
|
|
6376
6694
|
);
|
|
6377
6695
|
this.view.state.draggingState = void 0, this.view.emitUpdate(), this.editor._tiptapEditor.view.dispatch(
|
|
6378
|
-
this.editor._tiptapEditor.state.tr.setMeta(
|
|
6379
|
-
),
|
|
6696
|
+
this.editor._tiptapEditor.state.tr.setMeta(J, null)
|
|
6697
|
+
), bn();
|
|
6380
6698
|
});
|
|
6381
6699
|
/**
|
|
6382
6700
|
* Freezes the drag handles. When frozen, they will stay attached to the same
|
|
@@ -6392,9 +6710,9 @@ class gn extends W {
|
|
|
6392
6710
|
c(this, "unfreezeHandles", () => {
|
|
6393
6711
|
this.view.menuFrozen = !1;
|
|
6394
6712
|
});
|
|
6395
|
-
this.editor = o, this.plugin = new
|
|
6396
|
-
key:
|
|
6397
|
-
view: (i) => (this.view = new
|
|
6713
|
+
this.editor = o, this.plugin = new _({
|
|
6714
|
+
key: J,
|
|
6715
|
+
view: (i) => (this.view = new vn(o, i, (n) => {
|
|
6398
6716
|
this.emit("update", n);
|
|
6399
6717
|
}), this.view),
|
|
6400
6718
|
// We use decorations to render the drop cursor when dragging a table row
|
|
@@ -6405,7 +6723,7 @@ class gn extends W {
|
|
|
6405
6723
|
return;
|
|
6406
6724
|
const n = this.view.state.draggingState.draggedCellOrientation === "row" ? this.view.state.rowIndex : this.view.state.colIndex, r = [];
|
|
6407
6725
|
if (n === this.view.state.draggingState.originalIndex)
|
|
6408
|
-
return
|
|
6726
|
+
return F.create(i.doc, r);
|
|
6409
6727
|
const a = i.doc.resolve(this.view.tablePos + 1), s = a.node();
|
|
6410
6728
|
if (this.view.state.draggingState.draggedCellOrientation === "row") {
|
|
6411
6729
|
const l = i.doc.resolve(
|
|
@@ -6414,12 +6732,12 @@ class gn extends W {
|
|
|
6414
6732
|
for (let u = 0; u < d.childCount; u++) {
|
|
6415
6733
|
const p = i.doc.resolve(
|
|
6416
6734
|
l.posAtIndex(u) + 1
|
|
6417
|
-
), h = p.node(),
|
|
6735
|
+
), h = p.node(), m = p.pos + (n > this.view.state.draggingState.originalIndex ? h.nodeSize - 2 : 0);
|
|
6418
6736
|
r.push(
|
|
6419
6737
|
// The widget is a small bar which spans the width of the cell.
|
|
6420
|
-
|
|
6421
|
-
const
|
|
6422
|
-
return
|
|
6738
|
+
G.widget(m, () => {
|
|
6739
|
+
const f = document.createElement("div");
|
|
6740
|
+
return f.className = "bn-table-drop-cursor", f.style.left = "0", f.style.right = "0", n > this.view.state.draggingState.originalIndex ? f.style.bottom = "-2px" : f.style.top = "-3px", f.style.height = "4px", f;
|
|
6423
6741
|
})
|
|
6424
6742
|
);
|
|
6425
6743
|
}
|
|
@@ -6432,13 +6750,13 @@ class gn extends W {
|
|
|
6432
6750
|
), p = u.node(), h = u.pos + (n > this.view.state.draggingState.originalIndex ? p.nodeSize - 2 : 0);
|
|
6433
6751
|
r.push(
|
|
6434
6752
|
// The widget is a small bar which spans the height of the cell.
|
|
6435
|
-
|
|
6436
|
-
const
|
|
6437
|
-
return
|
|
6753
|
+
G.widget(h, () => {
|
|
6754
|
+
const m = document.createElement("div");
|
|
6755
|
+
return m.className = "bn-table-drop-cursor", m.style.top = "0", m.style.bottom = "0", n > this.view.state.draggingState.originalIndex ? m.style.right = "-2px" : m.style.left = "-3px", m.style.width = "4px", m;
|
|
6438
6756
|
})
|
|
6439
6757
|
);
|
|
6440
6758
|
}
|
|
6441
|
-
return
|
|
6759
|
+
return F.create(i.doc, r);
|
|
6442
6760
|
}
|
|
6443
6761
|
}
|
|
6444
6762
|
});
|
|
@@ -6451,23 +6769,23 @@ function We(t, e) {
|
|
|
6451
6769
|
const o = t.state.selection.content().content, n = nt(
|
|
6452
6770
|
t.state.schema,
|
|
6453
6771
|
e
|
|
6454
|
-
).serializeProseMirrorFragment(o), a =
|
|
6772
|
+
).serializeProseMirrorFragment(o), a = re(
|
|
6455
6773
|
t.state.schema,
|
|
6456
6774
|
e
|
|
6457
|
-
).exportProseMirrorFragment(o), s =
|
|
6775
|
+
).exportProseMirrorFragment(o), s = Me(a);
|
|
6458
6776
|
return { internalHTML: n, externalHTML: a, plainText: s };
|
|
6459
6777
|
}
|
|
6460
|
-
const
|
|
6778
|
+
const wn = (t) => B.create({
|
|
6461
6779
|
name: "copyToClipboard",
|
|
6462
6780
|
addProseMirrorPlugins() {
|
|
6463
6781
|
return [
|
|
6464
|
-
new
|
|
6782
|
+
new _({
|
|
6465
6783
|
props: {
|
|
6466
6784
|
handleDOMEvents: {
|
|
6467
6785
|
copy(e, o) {
|
|
6468
6786
|
o.preventDefault(), o.clipboardData.clearData(), "node" in e.state.selection && e.state.selection.node.type.spec.group === "blockContent" && e.dispatch(
|
|
6469
6787
|
e.state.tr.setSelection(
|
|
6470
|
-
new
|
|
6788
|
+
new oe(
|
|
6471
6789
|
e.state.doc.resolve(e.state.selection.from - 1)
|
|
6472
6790
|
)
|
|
6473
6791
|
)
|
|
@@ -6483,7 +6801,7 @@ const bn = (t) => T.create({
|
|
|
6483
6801
|
return;
|
|
6484
6802
|
e.dispatch(
|
|
6485
6803
|
e.state.tr.setSelection(
|
|
6486
|
-
new
|
|
6804
|
+
new oe(
|
|
6487
6805
|
e.state.doc.resolve(e.state.selection.from - 1)
|
|
6488
6806
|
)
|
|
6489
6807
|
)
|
|
@@ -6496,21 +6814,21 @@ const bn = (t) => T.create({
|
|
|
6496
6814
|
})
|
|
6497
6815
|
];
|
|
6498
6816
|
}
|
|
6499
|
-
}),
|
|
6817
|
+
}), xn = [
|
|
6500
6818
|
"blocknote/html",
|
|
6501
6819
|
"text/html",
|
|
6502
6820
|
"text/plain"
|
|
6503
|
-
],
|
|
6821
|
+
], En = (t) => B.create({
|
|
6504
6822
|
name: "pasteFromClipboard",
|
|
6505
6823
|
addProseMirrorPlugins() {
|
|
6506
6824
|
return [
|
|
6507
|
-
new
|
|
6825
|
+
new _({
|
|
6508
6826
|
props: {
|
|
6509
6827
|
handleDOMEvents: {
|
|
6510
6828
|
paste(e, o) {
|
|
6511
6829
|
o.preventDefault();
|
|
6512
6830
|
let i = null;
|
|
6513
|
-
for (const n of
|
|
6831
|
+
for (const n of xn)
|
|
6514
6832
|
if (o.clipboardData.types.includes(n)) {
|
|
6515
6833
|
i = n;
|
|
6516
6834
|
break;
|
|
@@ -6528,7 +6846,7 @@ const bn = (t) => T.create({
|
|
|
6528
6846
|
})
|
|
6529
6847
|
];
|
|
6530
6848
|
}
|
|
6531
|
-
}),
|
|
6849
|
+
}), Cn = B.create({
|
|
6532
6850
|
name: "blockBackgroundColor",
|
|
6533
6851
|
addGlobalAttributes() {
|
|
6534
6852
|
return [
|
|
@@ -6536,9 +6854,9 @@ const bn = (t) => T.create({
|
|
|
6536
6854
|
types: ["blockContainer"],
|
|
6537
6855
|
attributes: {
|
|
6538
6856
|
backgroundColor: {
|
|
6539
|
-
default:
|
|
6540
|
-
parseHTML: (t) => t.hasAttribute("data-background-color") ? t.getAttribute("data-background-color") :
|
|
6541
|
-
renderHTML: (t) => t.backgroundColor !==
|
|
6857
|
+
default: y.backgroundColor.default,
|
|
6858
|
+
parseHTML: (t) => t.hasAttribute("data-background-color") ? t.getAttribute("data-background-color") : y.backgroundColor.default,
|
|
6859
|
+
renderHTML: (t) => t.backgroundColor !== y.backgroundColor.default && {
|
|
6542
6860
|
"data-background-color": t.backgroundColor
|
|
6543
6861
|
}
|
|
6544
6862
|
}
|
|
@@ -6546,14 +6864,20 @@ const bn = (t) => T.create({
|
|
|
6546
6864
|
}
|
|
6547
6865
|
];
|
|
6548
6866
|
}
|
|
6549
|
-
}),
|
|
6867
|
+
}), Sn = B.create({
|
|
6550
6868
|
name: "textAlignment",
|
|
6551
6869
|
addGlobalAttributes() {
|
|
6552
6870
|
return [
|
|
6553
6871
|
{
|
|
6554
6872
|
// Attribute is applied to block content instead of container so that child blocks don't inherit the text
|
|
6555
6873
|
// alignment styling.
|
|
6556
|
-
types: [
|
|
6874
|
+
types: [
|
|
6875
|
+
"paragraph",
|
|
6876
|
+
"heading",
|
|
6877
|
+
"bulletListItem",
|
|
6878
|
+
"numberedListItem",
|
|
6879
|
+
"checkListItem"
|
|
6880
|
+
],
|
|
6557
6881
|
attributes: {
|
|
6558
6882
|
textAlignment: {
|
|
6559
6883
|
default: "left",
|
|
@@ -6566,7 +6890,7 @@ const bn = (t) => T.create({
|
|
|
6566
6890
|
}
|
|
6567
6891
|
];
|
|
6568
6892
|
}
|
|
6569
|
-
}),
|
|
6893
|
+
}), Mn = B.create({
|
|
6570
6894
|
name: "blockTextColor",
|
|
6571
6895
|
addGlobalAttributes() {
|
|
6572
6896
|
return [
|
|
@@ -6574,9 +6898,9 @@ const bn = (t) => T.create({
|
|
|
6574
6898
|
types: ["blockContainer"],
|
|
6575
6899
|
attributes: {
|
|
6576
6900
|
textColor: {
|
|
6577
|
-
default:
|
|
6578
|
-
parseHTML: (t) => t.hasAttribute("data-text-color") ? t.getAttribute("data-text-color") :
|
|
6579
|
-
renderHTML: (t) => t.textColor !==
|
|
6901
|
+
default: y.textColor.default,
|
|
6902
|
+
parseHTML: (t) => t.hasAttribute("data-text-color") ? t.getAttribute("data-text-color") : y.textColor.default,
|
|
6903
|
+
renderHTML: (t) => t.textColor !== y.textColor.default && {
|
|
6580
6904
|
"data-text-color": t.textColor
|
|
6581
6905
|
}
|
|
6582
6906
|
}
|
|
@@ -6584,12 +6908,12 @@ const bn = (t) => T.create({
|
|
|
6584
6908
|
}
|
|
6585
6909
|
];
|
|
6586
6910
|
}
|
|
6587
|
-
}),
|
|
6911
|
+
}), Tn = B.create({
|
|
6588
6912
|
name: "trailingNode",
|
|
6589
6913
|
addProseMirrorPlugins() {
|
|
6590
|
-
const t = new
|
|
6914
|
+
const t = new S(this.name);
|
|
6591
6915
|
return [
|
|
6592
|
-
new
|
|
6916
|
+
new _({
|
|
6593
6917
|
key: t,
|
|
6594
6918
|
appendTransaction: (e, o, i) => {
|
|
6595
6919
|
const { doc: n, tr: r, schema: a } = i, s = t.getState(i), l = n.content.size - 2, d = a.nodes.blockContainer, u = a.nodes.paragraph;
|
|
@@ -6619,8 +6943,8 @@ const bn = (t) => T.create({
|
|
|
6619
6943
|
})
|
|
6620
6944
|
];
|
|
6621
6945
|
}
|
|
6622
|
-
}),
|
|
6623
|
-
key:
|
|
6946
|
+
}), Bn = new S("non-editable-block"), Ln = () => new _({
|
|
6947
|
+
key: Bn,
|
|
6624
6948
|
props: {
|
|
6625
6949
|
handleKeyDown: (t, e) => {
|
|
6626
6950
|
if ("node" in t.state.selection) {
|
|
@@ -6635,7 +6959,7 @@ const bn = (t) => T.create({
|
|
|
6635
6959
|
t.state.tr.selection.$to.after(),
|
|
6636
6960
|
t.state.schema.nodes.paragraph.create()
|
|
6637
6961
|
).setSelection(
|
|
6638
|
-
new
|
|
6962
|
+
new Z(
|
|
6639
6963
|
o.doc.resolve(t.state.tr.selection.$to.after() + 1)
|
|
6640
6964
|
)
|
|
6641
6965
|
)
|
|
@@ -6645,7 +6969,7 @@ const bn = (t) => T.create({
|
|
|
6645
6969
|
return !1;
|
|
6646
6970
|
}
|
|
6647
6971
|
}
|
|
6648
|
-
}), $e = new
|
|
6972
|
+
}), $e = new S("previous-blocks"), In = {
|
|
6649
6973
|
// Numbered List Items
|
|
6650
6974
|
index: "index",
|
|
6651
6975
|
// Headings
|
|
@@ -6654,9 +6978,9 @@ const bn = (t) => T.create({
|
|
|
6654
6978
|
type: "type",
|
|
6655
6979
|
depth: "depth",
|
|
6656
6980
|
"depth-change": "depth-change"
|
|
6657
|
-
},
|
|
6981
|
+
}, An = () => {
|
|
6658
6982
|
let t;
|
|
6659
|
-
return new
|
|
6983
|
+
return new _({
|
|
6660
6984
|
key: $e,
|
|
6661
6985
|
view(e) {
|
|
6662
6986
|
return {
|
|
@@ -6687,25 +7011,25 @@ const bn = (t) => T.create({
|
|
|
6687
7011
|
apply(e, o, i, n) {
|
|
6688
7012
|
if (o.currentTransactionOldBlockAttrs = {}, o.updatedBlocks.clear(), !e.docChanged || i.doc.eq(n.doc))
|
|
6689
7013
|
return o;
|
|
6690
|
-
const r = {}, a =
|
|
7014
|
+
const r = {}, a = Pe(i.doc, (d) => d.attrs.id), s = new Map(
|
|
6691
7015
|
a.map((d) => [d.node.attrs.id, d])
|
|
6692
|
-
), l =
|
|
7016
|
+
), l = Pe(n.doc, (d) => d.attrs.id);
|
|
6693
7017
|
for (const d of l) {
|
|
6694
7018
|
const u = s.get(d.node.attrs.id), p = u == null ? void 0 : u.node.firstChild, h = d.node.firstChild;
|
|
6695
7019
|
if (u && p && h) {
|
|
6696
|
-
const
|
|
7020
|
+
const m = {
|
|
6697
7021
|
index: h.attrs.index,
|
|
6698
7022
|
level: h.attrs.level,
|
|
6699
7023
|
type: h.type.name,
|
|
6700
7024
|
depth: n.doc.resolve(d.pos).depth
|
|
6701
7025
|
};
|
|
6702
|
-
let
|
|
7026
|
+
let f = {
|
|
6703
7027
|
index: p.attrs.index,
|
|
6704
7028
|
level: p.attrs.level,
|
|
6705
7029
|
type: p.type.name,
|
|
6706
7030
|
depth: i.doc.resolve(u.pos).depth
|
|
6707
7031
|
};
|
|
6708
|
-
r[d.node.attrs.id] =
|
|
7032
|
+
r[d.node.attrs.id] = f, e.getMeta("numberedListIndexing") && (d.node.attrs.id in o.prevTransactionOldBlockAttrs && (f = o.prevTransactionOldBlockAttrs[d.node.attrs.id]), m.type === "numberedListItem" && (f.index = m.index)), o.currentTransactionOldBlockAttrs[d.node.attrs.id] = f, JSON.stringify(f) !== JSON.stringify(m) && (f["depth-change"] = f.depth - m.depth, o.updatedBlocks.add(d.node.attrs.id));
|
|
6709
7033
|
}
|
|
6710
7034
|
}
|
|
6711
7035
|
return o.prevTransactionOldBlockAttrs = r, o;
|
|
@@ -6722,22 +7046,22 @@ const bn = (t) => T.create({
|
|
|
6722
7046
|
return;
|
|
6723
7047
|
const a = o.currentTransactionOldBlockAttrs[n.attrs.id], s = {};
|
|
6724
7048
|
for (const [d, u] of Object.entries(a))
|
|
6725
|
-
s["data-prev-" +
|
|
6726
|
-
const l =
|
|
7049
|
+
s["data-prev-" + In[d]] = u || "none";
|
|
7050
|
+
const l = G.node(r, r + n.nodeSize, {
|
|
6727
7051
|
...s
|
|
6728
7052
|
});
|
|
6729
7053
|
i.push(l);
|
|
6730
|
-
}),
|
|
7054
|
+
}), F.create(e.doc, i);
|
|
6731
7055
|
}
|
|
6732
7056
|
}
|
|
6733
7057
|
});
|
|
6734
|
-
},
|
|
7058
|
+
}, Nn = {
|
|
6735
7059
|
blockColor: "data-block-color",
|
|
6736
7060
|
blockStyle: "data-block-style",
|
|
6737
7061
|
id: "data-id",
|
|
6738
7062
|
depth: "data-depth",
|
|
6739
7063
|
depthChange: "data-depth-change"
|
|
6740
|
-
},
|
|
7064
|
+
}, Pn = W.create({
|
|
6741
7065
|
name: "blockContainer",
|
|
6742
7066
|
group: "blockContainer",
|
|
6743
7067
|
// A block always contains content, and optionally a blockGroup which contains nested blocks
|
|
@@ -6753,7 +7077,7 @@ const bn = (t) => T.create({
|
|
|
6753
7077
|
if (typeof t == "string")
|
|
6754
7078
|
return !1;
|
|
6755
7079
|
const e = {};
|
|
6756
|
-
for (const [o, i] of Object.entries(
|
|
7080
|
+
for (const [o, i] of Object.entries(Nn))
|
|
6757
7081
|
t.getAttribute(i) && (e[o] = t.getAttribute(i));
|
|
6758
7082
|
return t.getAttribute("data-node-type") === "blockContainer" ? e : !1;
|
|
6759
7083
|
}
|
|
@@ -6770,7 +7094,7 @@ const bn = (t) => T.create({
|
|
|
6770
7094
|
...((n = this.options.domAttributes) == null ? void 0 : n.block) || {},
|
|
6771
7095
|
...t
|
|
6772
7096
|
}, i = document.createElement("div");
|
|
6773
|
-
i.className =
|
|
7097
|
+
i.className = O("bn-block", o.class), i.setAttribute("data-node-type", this.name);
|
|
6774
7098
|
for (const [r, a] of Object.entries(o))
|
|
6775
7099
|
r !== "class" && i.setAttribute(r, a);
|
|
6776
7100
|
return e.appendChild(i), {
|
|
@@ -6802,10 +7126,10 @@ const bn = (t) => T.create({
|
|
|
6802
7126
|
if (i) {
|
|
6803
7127
|
if (e.children !== void 0) {
|
|
6804
7128
|
const h = [];
|
|
6805
|
-
for (const
|
|
7129
|
+
for (const m of e.children)
|
|
6806
7130
|
h.push(
|
|
6807
7131
|
N(
|
|
6808
|
-
|
|
7132
|
+
m,
|
|
6809
7133
|
o.schema,
|
|
6810
7134
|
this.options.editor.schema.styleSchema
|
|
6811
7135
|
)
|
|
@@ -6813,7 +7137,7 @@ const bn = (t) => T.create({
|
|
|
6813
7137
|
s.childCount === 2 ? o.tr.replace(
|
|
6814
7138
|
r + l.nodeSize + 1,
|
|
6815
7139
|
a - 1,
|
|
6816
|
-
new
|
|
7140
|
+
new U(T.from(h), 0, 0)
|
|
6817
7141
|
) : o.tr.insert(
|
|
6818
7142
|
r + l.nodeSize,
|
|
6819
7143
|
o.schema.nodes.blockGroup.create({}, h)
|
|
@@ -6825,7 +7149,7 @@ const bn = (t) => T.create({
|
|
|
6825
7149
|
if (typeof e.content == "string")
|
|
6826
7150
|
p = [o.schema.text(e.content)];
|
|
6827
7151
|
else if (Array.isArray(e.content))
|
|
6828
|
-
p =
|
|
7152
|
+
p = ne(
|
|
6829
7153
|
e.content,
|
|
6830
7154
|
o.schema,
|
|
6831
7155
|
this.options.editor.schema.styleSchema
|
|
@@ -6839,8 +7163,8 @@ const bn = (t) => T.create({
|
|
|
6839
7163
|
else
|
|
6840
7164
|
throw new I(e.content.type);
|
|
6841
7165
|
else {
|
|
6842
|
-
const h = o.schema.nodes[d].spec.content,
|
|
6843
|
-
h === "" ||
|
|
7166
|
+
const h = o.schema.nodes[d].spec.content, m = o.schema.nodes[u].spec.content;
|
|
7167
|
+
h === "" || m !== h && (p = []);
|
|
6844
7168
|
}
|
|
6845
7169
|
p === "keep" ? o.tr.setNodeMarkup(
|
|
6846
7170
|
r,
|
|
@@ -6860,11 +7184,11 @@ const bn = (t) => T.create({
|
|
|
6860
7184
|
p
|
|
6861
7185
|
)
|
|
6862
7186
|
).setSelection(
|
|
6863
|
-
o.schema.nodes[u].spec.content === "" ? new
|
|
7187
|
+
o.schema.nodes[u].spec.content === "" ? new oe(o.tr.doc.resolve(r)) : o.schema.nodes[u].spec.content === "inline*" ? new Z(o.tr.doc.resolve(r)) : (
|
|
6864
7188
|
// Need to offset the position as we have to get through the
|
|
6865
7189
|
// `tableRow` and `tableCell` nodes to get to the
|
|
6866
7190
|
// `tableParagraph` node we want to set the selection in.
|
|
6867
|
-
new
|
|
7191
|
+
new Z(o.tr.doc.resolve(r + 4))
|
|
6868
7192
|
)
|
|
6869
7193
|
), o.tr.setNodeMarkup(r - 1, void 0, {
|
|
6870
7194
|
...s.attrs,
|
|
@@ -6899,9 +7223,9 @@ const bn = (t) => T.create({
|
|
|
6899
7223
|
t + 1
|
|
6900
7224
|
), { node: a, contentNode: s, startPos: l, endPos: d, depth: u } = r;
|
|
6901
7225
|
if (a.childCount === 2) {
|
|
6902
|
-
const
|
|
7226
|
+
const m = e.doc.resolve(
|
|
6903
7227
|
l + s.nodeSize + 1
|
|
6904
|
-
),
|
|
7228
|
+
), f = e.doc.resolve(d - 1), g = m.blockRange(f);
|
|
6905
7229
|
o && e.tr.lift(g, u - 1);
|
|
6906
7230
|
}
|
|
6907
7231
|
let p = t - 1, h = b(e.doc, p);
|
|
@@ -6912,48 +7236,52 @@ const bn = (t) => T.create({
|
|
|
6912
7236
|
e.tr.deleteRange(l, l + s.nodeSize).replace(
|
|
6913
7237
|
p - 1,
|
|
6914
7238
|
l,
|
|
6915
|
-
new
|
|
7239
|
+
new U(s.content, 0, 0)
|
|
6916
7240
|
).scrollIntoView()
|
|
6917
7241
|
), e.tr.setSelection(
|
|
6918
|
-
new
|
|
7242
|
+
new Z(e.doc.resolve(p - 1))
|
|
6919
7243
|
)), !0;
|
|
6920
7244
|
},
|
|
6921
7245
|
// Splits a block at a given position. Content after the position is moved to a new block below, at the same
|
|
6922
7246
|
// nesting level.
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
7247
|
+
// - `keepType` is usually false, unless the selection is at the start of
|
|
7248
|
+
// a block.
|
|
7249
|
+
// - `keepProps` is usually true when `keepType` is true, except for when
|
|
7250
|
+
// creating new list item blocks with Enter.
|
|
7251
|
+
BNSplitBlock: (t, e, o) => ({ state: i, dispatch: n }) => {
|
|
7252
|
+
const r = b(i.doc, t);
|
|
7253
|
+
if (r === void 0)
|
|
6926
7254
|
return !1;
|
|
6927
|
-
const { contentNode:
|
|
6928
|
-
return
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
7255
|
+
const { contentNode: a, contentType: s, startPos: l, endPos: d, depth: u } = r, p = i.doc.cut(l + 1, t), h = i.doc.cut(t, d - 1), m = i.schema.nodes.blockContainer.createAndFill(), f = d + 1, g = f + 2;
|
|
7256
|
+
return n && (i.tr.insert(f, m), i.tr.replace(
|
|
7257
|
+
g,
|
|
7258
|
+
g + 1,
|
|
7259
|
+
h.content.size > 0 ? new U(
|
|
7260
|
+
T.from(h),
|
|
7261
|
+
u + 2,
|
|
7262
|
+
u + 2
|
|
6935
7263
|
) : void 0
|
|
6936
|
-
), e &&
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
),
|
|
6942
|
-
new
|
|
6943
|
-
),
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
7264
|
+
), e && i.tr.setBlockType(
|
|
7265
|
+
g,
|
|
7266
|
+
g,
|
|
7267
|
+
i.schema.node(s).type,
|
|
7268
|
+
o ? a.attrs : void 0
|
|
7269
|
+
), i.tr.setSelection(
|
|
7270
|
+
new Z(i.doc.resolve(g))
|
|
7271
|
+
), i.tr.replace(
|
|
7272
|
+
l + 1,
|
|
7273
|
+
d - 1,
|
|
7274
|
+
p.content.size > 0 ? new U(
|
|
7275
|
+
T.from(p),
|
|
7276
|
+
u + 2,
|
|
7277
|
+
u + 2
|
|
6950
7278
|
) : void 0
|
|
6951
|
-
),
|
|
7279
|
+
), i.tr.scrollIntoView()), !0;
|
|
6952
7280
|
}
|
|
6953
7281
|
};
|
|
6954
7282
|
},
|
|
6955
7283
|
addProseMirrorPlugins() {
|
|
6956
|
-
return [
|
|
7284
|
+
return [An(), Ln()];
|
|
6957
7285
|
},
|
|
6958
7286
|
addKeyboardShortcuts() {
|
|
6959
7287
|
return {
|
|
@@ -7003,10 +7331,10 @@ const bn = (t) => T.create({
|
|
|
7003
7331
|
n.selection.from
|
|
7004
7332
|
), l = s === n.doc.nodeSize - 4, d = n.selection.from === s - 1, u = n.selection.empty, p = r.childCount === 2;
|
|
7005
7333
|
if (!l && d && u && !p) {
|
|
7006
|
-
let h = a,
|
|
7007
|
-
for (;
|
|
7008
|
-
h =
|
|
7009
|
-
return i.BNMergeBlocks(
|
|
7334
|
+
let h = a, m = s + 2, f = n.doc.resolve(m).depth;
|
|
7335
|
+
for (; f < h; )
|
|
7336
|
+
h = f, m += 2, f = n.doc.resolve(m).depth;
|
|
7337
|
+
return i.BNMergeBlocks(m - 1);
|
|
7010
7338
|
}
|
|
7011
7339
|
return !1;
|
|
7012
7340
|
})
|
|
@@ -7041,7 +7369,11 @@ const bn = (t) => T.create({
|
|
|
7041
7369
|
n.doc,
|
|
7042
7370
|
n.selection.from
|
|
7043
7371
|
), s = n.selection.$anchor.parentOffset === 0;
|
|
7044
|
-
return a.textContent.length === 0 ? !1 : (r().deleteSelection().BNSplitBlock(
|
|
7372
|
+
return a.textContent.length === 0 ? !1 : (r().deleteSelection().BNSplitBlock(
|
|
7373
|
+
n.selection.from,
|
|
7374
|
+
s,
|
|
7375
|
+
s
|
|
7376
|
+
).run(), !0);
|
|
7045
7377
|
})
|
|
7046
7378
|
]),
|
|
7047
7379
|
// Always returning true for tab key presses ensures they're not captured by the browser. Otherwise, they blur the
|
|
@@ -7056,7 +7388,7 @@ const bn = (t) => T.create({
|
|
|
7056
7388
|
}
|
|
7057
7389
|
};
|
|
7058
7390
|
}
|
|
7059
|
-
}),
|
|
7391
|
+
}), Hn = W.create({
|
|
7060
7392
|
name: "blockGroup",
|
|
7061
7393
|
group: "blockGroup",
|
|
7062
7394
|
content: "blockContainer+",
|
|
@@ -7074,7 +7406,7 @@ const bn = (t) => T.create({
|
|
|
7074
7406
|
...((i = this.options.domAttributes) == null ? void 0 : i.blockGroup) || {},
|
|
7075
7407
|
...t
|
|
7076
7408
|
}, o = document.createElement("div");
|
|
7077
|
-
o.className =
|
|
7409
|
+
o.className = O(
|
|
7078
7410
|
"bn-block-group",
|
|
7079
7411
|
e.class
|
|
7080
7412
|
), o.setAttribute("data-node-type", "blockGroup");
|
|
@@ -7085,22 +7417,22 @@ const bn = (t) => T.create({
|
|
|
7085
7417
|
contentDOM: o
|
|
7086
7418
|
};
|
|
7087
7419
|
}
|
|
7088
|
-
}),
|
|
7420
|
+
}), Un = W.create({
|
|
7089
7421
|
name: "doc",
|
|
7090
7422
|
topNode: !0,
|
|
7091
7423
|
content: "blockGroup"
|
|
7092
|
-
}),
|
|
7424
|
+
}), Dn = (t) => {
|
|
7093
7425
|
var o;
|
|
7094
7426
|
const e = [
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7427
|
+
X.ClipboardTextSerializer,
|
|
7428
|
+
X.Commands,
|
|
7429
|
+
X.Editable,
|
|
7430
|
+
X.FocusEvents,
|
|
7431
|
+
X.Tabindex,
|
|
7100
7432
|
// DevTools,
|
|
7101
7433
|
so,
|
|
7102
7434
|
// DropCursor,
|
|
7103
|
-
|
|
7435
|
+
ee.configure({
|
|
7104
7436
|
types: ["blockContainer"]
|
|
7105
7437
|
}),
|
|
7106
7438
|
lo.extend({ priority: 10 }),
|
|
@@ -7110,11 +7442,11 @@ const bn = (t) => T.create({
|
|
|
7110
7442
|
// marks:
|
|
7111
7443
|
uo,
|
|
7112
7444
|
...Object.values(t.styleSpecs).map((i) => i.implementation.mark),
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7445
|
+
Mn,
|
|
7446
|
+
Cn,
|
|
7447
|
+
Sn,
|
|
7116
7448
|
// make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)
|
|
7117
|
-
|
|
7449
|
+
B.create({
|
|
7118
7450
|
name: "OverrideEscape",
|
|
7119
7451
|
addKeyboardShortcuts() {
|
|
7120
7452
|
return {
|
|
@@ -7123,12 +7455,12 @@ const bn = (t) => T.create({
|
|
|
7123
7455
|
}
|
|
7124
7456
|
}),
|
|
7125
7457
|
// nodes
|
|
7126
|
-
|
|
7127
|
-
|
|
7458
|
+
Un,
|
|
7459
|
+
Pn.configure({
|
|
7128
7460
|
editor: t.editor,
|
|
7129
7461
|
domAttributes: t.domAttributes
|
|
7130
7462
|
}),
|
|
7131
|
-
|
|
7463
|
+
Hn.configure({
|
|
7132
7464
|
domAttributes: t.domAttributes
|
|
7133
7465
|
}),
|
|
7134
7466
|
...Object.values(t.inlineContentSpecs).filter((i) => i.config !== "link" && i.config !== "text").map((i) => i.implementation.node.configure({
|
|
@@ -7148,12 +7480,12 @@ const bn = (t) => T.create({
|
|
|
7148
7480
|
domAttributes: t.domAttributes
|
|
7149
7481
|
})
|
|
7150
7482
|
]),
|
|
7151
|
-
|
|
7152
|
-
|
|
7483
|
+
wn(t.editor),
|
|
7484
|
+
En(t.editor),
|
|
7153
7485
|
ao.configure({ width: 5, color: "#ddeeff" }),
|
|
7154
7486
|
// This needs to be at the bottom of this list, because Key events (such as enter, when selecting a /command),
|
|
7155
7487
|
// should be handled before Enter handlers in other components like splitListItem
|
|
7156
|
-
...t.trailingBlock === void 0 || t.trailingBlock ? [
|
|
7488
|
+
...t.trailingBlock === void 0 || t.trailingBlock ? [Tn] : []
|
|
7157
7489
|
];
|
|
7158
7490
|
if (t.collaboration) {
|
|
7159
7491
|
if (e.push(
|
|
@@ -7181,20 +7513,20 @@ const bn = (t) => T.create({
|
|
|
7181
7513
|
e.push(co);
|
|
7182
7514
|
return e;
|
|
7183
7515
|
};
|
|
7184
|
-
function
|
|
7516
|
+
function On(t, e) {
|
|
7185
7517
|
const o = [];
|
|
7186
7518
|
return t.forEach((i, n, r) => {
|
|
7187
7519
|
r !== e && o.push(i);
|
|
7188
|
-
}),
|
|
7520
|
+
}), T.from(o);
|
|
7189
7521
|
}
|
|
7190
|
-
function
|
|
7191
|
-
let o =
|
|
7522
|
+
function Rn(t, e) {
|
|
7523
|
+
let o = T.from(t.content);
|
|
7192
7524
|
for (let i = 0; i < o.childCount; i++)
|
|
7193
7525
|
if (o.child(i).type.spec.group === "blockContent") {
|
|
7194
7526
|
const n = [o.child(i)];
|
|
7195
7527
|
if (i + 1 < o.childCount && o.child(i + 1).type.spec.group === "blockGroup") {
|
|
7196
7528
|
const a = o.child(i + 1).child(0).child(0);
|
|
7197
|
-
(a.type.name === "bulletListItem" || a.type.name === "numberedListItem") && (n.push(o.child(i + 1)), o =
|
|
7529
|
+
(a.type.name === "bulletListItem" || a.type.name === "numberedListItem" || a.type.name === "checkListItem") && (n.push(o.child(i + 1)), o = On(o, i + 1));
|
|
7198
7530
|
}
|
|
7199
7531
|
const r = e.state.schema.nodes.blockContainer.create(
|
|
7200
7532
|
void 0,
|
|
@@ -7202,14 +7534,14 @@ function Pn(t, e) {
|
|
|
7202
7534
|
);
|
|
7203
7535
|
o = o.replaceChild(i, r);
|
|
7204
7536
|
}
|
|
7205
|
-
return new
|
|
7537
|
+
return new U(o, t.openStart, t.openEnd);
|
|
7206
7538
|
}
|
|
7207
|
-
function
|
|
7539
|
+
function ge(t) {
|
|
7208
7540
|
return t && Object.fromEntries(
|
|
7209
7541
|
Object.entries(t).filter(([, e]) => e !== void 0)
|
|
7210
7542
|
);
|
|
7211
7543
|
}
|
|
7212
|
-
class
|
|
7544
|
+
class Be {
|
|
7213
7545
|
constructor(e) {
|
|
7214
7546
|
c(this, "blockSpecs");
|
|
7215
7547
|
c(this, "inlineContentSpecs");
|
|
@@ -7221,15 +7553,15 @@ class Te {
|
|
|
7221
7553
|
c(this, "BlockNoteEditor", "only for types");
|
|
7222
7554
|
c(this, "Block", "only for types");
|
|
7223
7555
|
c(this, "PartialBlock", "only for types");
|
|
7224
|
-
this.blockSpecs =
|
|
7556
|
+
this.blockSpecs = ge(e == null ? void 0 : e.blockSpecs) || ht, this.inlineContentSpecs = ge(e == null ? void 0 : e.inlineContentSpecs) || ft, this.styleSpecs = ge(e == null ? void 0 : e.styleSpecs) || mt, this.blockSchema = lt(this.blockSpecs), this.inlineContentSchema = dt(
|
|
7225
7557
|
this.inlineContentSpecs
|
|
7226
7558
|
), this.styleSchema = ut(this.styleSpecs);
|
|
7227
7559
|
}
|
|
7228
7560
|
static create(e) {
|
|
7229
|
-
return new
|
|
7561
|
+
return new Be(e);
|
|
7230
7562
|
}
|
|
7231
7563
|
}
|
|
7232
|
-
class
|
|
7564
|
+
class Vn extends Ot {
|
|
7233
7565
|
constructor(o, i) {
|
|
7234
7566
|
super({ ...o, content: void 0 });
|
|
7235
7567
|
c(this, "_state");
|
|
@@ -7309,8 +7641,8 @@ class Hn extends Ot {
|
|
|
7309
7641
|
});
|
|
7310
7642
|
}
|
|
7311
7643
|
}
|
|
7312
|
-
const
|
|
7313
|
-
key:
|
|
7644
|
+
const jn = new S("blocknote-placeholder"), zn = (t, e) => new _({
|
|
7645
|
+
key: jn,
|
|
7314
7646
|
view: () => {
|
|
7315
7647
|
const o = document.createElement("style");
|
|
7316
7648
|
document.head.appendChild(o);
|
|
@@ -7348,19 +7680,19 @@ const Un = new x("blocknote-placeholder"), Dn = (t, e) => new w({
|
|
|
7348
7680
|
const r = n.$anchor, a = r.parent;
|
|
7349
7681
|
if (a.content.size > 0)
|
|
7350
7682
|
return null;
|
|
7351
|
-
const s = r.before(), l =
|
|
7683
|
+
const s = r.before(), l = G.node(s, s + a.nodeSize, {
|
|
7352
7684
|
"data-is-empty-and-focused": "true"
|
|
7353
7685
|
});
|
|
7354
|
-
return
|
|
7686
|
+
return F.create(i, [l]);
|
|
7355
7687
|
}
|
|
7356
7688
|
}
|
|
7357
7689
|
});
|
|
7358
|
-
const
|
|
7690
|
+
const Fn = {
|
|
7359
7691
|
enableInputRules: !0,
|
|
7360
7692
|
enablePasteRules: !0,
|
|
7361
7693
|
enableCoreExtensions: !1
|
|
7362
7694
|
};
|
|
7363
|
-
class
|
|
7695
|
+
class vt {
|
|
7364
7696
|
constructor(e) {
|
|
7365
7697
|
c(this, "_tiptapEditor");
|
|
7366
7698
|
c(this, "blockCache", /* @__PURE__ */ new WeakMap());
|
|
@@ -7376,7 +7708,8 @@ class _t {
|
|
|
7376
7708
|
c(this, "filePanel");
|
|
7377
7709
|
c(this, "tableHandles");
|
|
7378
7710
|
c(this, "uploadFile");
|
|
7379
|
-
|
|
7711
|
+
c(this, "resolveFileUrl");
|
|
7712
|
+
var l, d, u, p, h, m, f, g;
|
|
7380
7713
|
this.options = e;
|
|
7381
7714
|
const o = e;
|
|
7382
7715
|
if (o.onEditorContentChange)
|
|
@@ -7398,15 +7731,15 @@ class _t {
|
|
|
7398
7731
|
this.dictionary = e.dictionary || Ze;
|
|
7399
7732
|
const i = {
|
|
7400
7733
|
defaultStyles: !0,
|
|
7401
|
-
schema: e.schema ||
|
|
7734
|
+
schema: e.schema || Be.create(),
|
|
7402
7735
|
...e,
|
|
7403
7736
|
placeholders: {
|
|
7404
7737
|
...this.dictionary.placeholders,
|
|
7405
7738
|
...e.placeholders
|
|
7406
7739
|
}
|
|
7407
7740
|
};
|
|
7408
|
-
this.schema = i.schema, this.blockImplementations = i.schema.blockSpecs, this.inlineContentImplementations = i.schema.inlineContentSpecs, this.styleImplementations = i.schema.styleSpecs, this.formattingToolbar = new
|
|
7409
|
-
const n =
|
|
7741
|
+
this.schema = i.schema, this.blockImplementations = i.schema.blockSpecs, this.inlineContentImplementations = i.schema.inlineContentSpecs, this.styleImplementations = i.schema.styleSpecs, this.formattingToolbar = new nn(this), this.linkToolbar = new sn(this), this.sideMenu = new gn(this), this.suggestionMenus = new cn(this), this.filePanel = new en(this), x("table", this) && (this.tableHandles = new _n(this));
|
|
7742
|
+
const n = Dn({
|
|
7410
7743
|
editor: this,
|
|
7411
7744
|
domAttributes: i.domAttributes || {},
|
|
7412
7745
|
blockSchema: this.schema.blockSchema,
|
|
@@ -7415,7 +7748,7 @@ class _t {
|
|
|
7415
7748
|
inlineContentSpecs: this.schema.inlineContentSpecs,
|
|
7416
7749
|
collaboration: i.collaboration,
|
|
7417
7750
|
trailingBlock: i.trailingBlock
|
|
7418
|
-
}), r =
|
|
7751
|
+
}), r = B.create({
|
|
7419
7752
|
name: "BlockNoteUIExtension",
|
|
7420
7753
|
addProseMirrorPlugins: () => [
|
|
7421
7754
|
this.formattingToolbar.plugin,
|
|
@@ -7424,10 +7757,10 @@ class _t {
|
|
|
7424
7757
|
this.suggestionMenus.plugin,
|
|
7425
7758
|
...this.filePanel ? [this.filePanel.plugin] : [],
|
|
7426
7759
|
...this.tableHandles ? [this.tableHandles.plugin] : [],
|
|
7427
|
-
|
|
7760
|
+
zn(this, i.placeholders)
|
|
7428
7761
|
]
|
|
7429
7762
|
});
|
|
7430
|
-
n.push(r), this.uploadFile = i.uploadFile, i.collaboration && i.initialContent && console.warn(
|
|
7763
|
+
n.push(r), this.uploadFile = i.uploadFile, this.resolveFileUrl = i.resolveFileUrl || (async (k) => k), i.collaboration && i.initialContent && console.warn(
|
|
7431
7764
|
"When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"
|
|
7432
7765
|
);
|
|
7433
7766
|
const a = i.initialContent || (e.collaboration ? [
|
|
@@ -7438,7 +7771,7 @@ class _t {
|
|
|
7438
7771
|
] : [
|
|
7439
7772
|
{
|
|
7440
7773
|
type: "paragraph",
|
|
7441
|
-
id:
|
|
7774
|
+
id: ee.options.generateID()
|
|
7442
7775
|
}
|
|
7443
7776
|
]);
|
|
7444
7777
|
if (!Array.isArray(a) || a.length === 0)
|
|
@@ -7446,7 +7779,7 @@ class _t {
|
|
|
7446
7779
|
"initialContent must be a non-empty array of blocks, received: " + a
|
|
7447
7780
|
);
|
|
7448
7781
|
const s = {
|
|
7449
|
-
...
|
|
7782
|
+
...Fn,
|
|
7450
7783
|
...i._tiptapOptions,
|
|
7451
7784
|
content: a,
|
|
7452
7785
|
extensions: i.enableBlockNoteExtensions === !1 ? ((l = i._tiptapOptions) == null ? void 0 : l.extensions) || [] : [...((d = i._tiptapOptions) == null ? void 0 : d.extensions) || [], ...n],
|
|
@@ -7454,23 +7787,23 @@ class _t {
|
|
|
7454
7787
|
...(u = i._tiptapOptions) == null ? void 0 : u.editorProps,
|
|
7455
7788
|
attributes: {
|
|
7456
7789
|
...(h = (p = i._tiptapOptions) == null ? void 0 : p.editorProps) == null ? void 0 : h.attributes,
|
|
7457
|
-
...(
|
|
7458
|
-
class:
|
|
7790
|
+
...(m = i.domAttributes) == null ? void 0 : m.editor,
|
|
7791
|
+
class: O(
|
|
7459
7792
|
"bn-editor",
|
|
7460
7793
|
i.defaultStyles ? "bn-default-styles" : "",
|
|
7461
|
-
((g = (
|
|
7794
|
+
((g = (f = i.domAttributes) == null ? void 0 : f.editor) == null ? void 0 : g.class) || ""
|
|
7462
7795
|
)
|
|
7463
7796
|
},
|
|
7464
|
-
transformPasted:
|
|
7797
|
+
transformPasted: Rn
|
|
7465
7798
|
}
|
|
7466
7799
|
};
|
|
7467
|
-
this._tiptapEditor = new
|
|
7800
|
+
this._tiptapEditor = new Vn(
|
|
7468
7801
|
s,
|
|
7469
7802
|
this.schema.styleSchema
|
|
7470
7803
|
);
|
|
7471
7804
|
}
|
|
7472
7805
|
static create(e = {}) {
|
|
7473
|
-
return new
|
|
7806
|
+
return new vt(e);
|
|
7474
7807
|
}
|
|
7475
7808
|
/**
|
|
7476
7809
|
* Mount the editor to a parent DOM element. Call mount(undefined) to clean up
|
|
@@ -7505,7 +7838,7 @@ class _t {
|
|
|
7505
7838
|
get document() {
|
|
7506
7839
|
const e = [];
|
|
7507
7840
|
return this._tiptapEditor.state.doc.firstChild.descendants((o) => (e.push(
|
|
7508
|
-
|
|
7841
|
+
v(
|
|
7509
7842
|
o,
|
|
7510
7843
|
this.schema.blockSchema,
|
|
7511
7844
|
this.schema.inlineContentSchema,
|
|
@@ -7522,7 +7855,7 @@ class _t {
|
|
|
7522
7855
|
getBlock(e) {
|
|
7523
7856
|
const o = typeof e == "string" ? e : e.id;
|
|
7524
7857
|
let i;
|
|
7525
|
-
return this._tiptapEditor.state.doc.firstChild.descendants((n) => typeof i < "u" ? !1 : n.type.name !== "blockContainer" || n.attrs.id !== o ? !0 : (i =
|
|
7858
|
+
return this._tiptapEditor.state.doc.firstChild.descendants((n) => typeof i < "u" ? !1 : n.type.name !== "blockContainer" || n.attrs.id !== o ? !0 : (i = v(
|
|
7526
7859
|
n,
|
|
7527
7860
|
this.schema.blockSchema,
|
|
7528
7861
|
this.schema.inlineContentSchema,
|
|
@@ -7577,21 +7910,21 @@ class _t {
|
|
|
7577
7910
|
r > 0 && (s = this._tiptapEditor.state.doc.resolve(i - 2).node());
|
|
7578
7911
|
let l;
|
|
7579
7912
|
return r < a - 1 && (l = this._tiptapEditor.state.doc.resolve(n + 2).node()), {
|
|
7580
|
-
block:
|
|
7913
|
+
block: v(
|
|
7581
7914
|
e,
|
|
7582
7915
|
this.schema.blockSchema,
|
|
7583
7916
|
this.schema.inlineContentSchema,
|
|
7584
7917
|
this.schema.styleSchema,
|
|
7585
7918
|
this.blockCache
|
|
7586
7919
|
),
|
|
7587
|
-
prevBlock: s === void 0 ? void 0 :
|
|
7920
|
+
prevBlock: s === void 0 ? void 0 : v(
|
|
7588
7921
|
s,
|
|
7589
7922
|
this.schema.blockSchema,
|
|
7590
7923
|
this.schema.inlineContentSchema,
|
|
7591
7924
|
this.schema.styleSchema,
|
|
7592
7925
|
this.blockCache
|
|
7593
7926
|
),
|
|
7594
|
-
nextBlock: l === void 0 ? void 0 :
|
|
7927
|
+
nextBlock: l === void 0 ? void 0 : v(
|
|
7595
7928
|
l,
|
|
7596
7929
|
this.schema.blockSchema,
|
|
7597
7930
|
this.schema.inlineContentSchema,
|
|
@@ -7607,7 +7940,7 @@ class _t {
|
|
|
7607
7940
|
* @param placement Whether the text cursor should be placed at the start or end of the block.
|
|
7608
7941
|
*/
|
|
7609
7942
|
setTextCursorPosition(e, o = "start") {
|
|
7610
|
-
const i = typeof e == "string" ? e : e.id, { posBeforeNode: n } =
|
|
7943
|
+
const i = typeof e == "string" ? e : e.id, { posBeforeNode: n } = Se(i, this._tiptapEditor.state.doc), { startPos: r, contentNode: a } = b(
|
|
7611
7944
|
this._tiptapEditor.state.doc,
|
|
7612
7945
|
n + 2
|
|
7613
7946
|
), s = this.schema.blockSchema[a.type.name].content;
|
|
@@ -7634,7 +7967,7 @@ class _t {
|
|
|
7634
7967
|
return;
|
|
7635
7968
|
const e = [];
|
|
7636
7969
|
return this._tiptapEditor.state.doc.descendants((o, i) => o.type.spec.group !== "blockContent" || i + o.nodeSize < this._tiptapEditor.state.selection.from || i > this._tiptapEditor.state.selection.to ? !0 : (e.push(
|
|
7637
|
-
|
|
7970
|
+
v(
|
|
7638
7971
|
this._tiptapEditor.state.doc.resolve(i).node(),
|
|
7639
7972
|
this.schema.blockSchema,
|
|
7640
7973
|
this.schema.inlineContentSchema,
|
|
@@ -7666,7 +7999,7 @@ class _t {
|
|
|
7666
7999
|
* `referenceBlock`. Inserts the blocks at the start of the existing block's children if "nested" is used.
|
|
7667
8000
|
*/
|
|
7668
8001
|
insertBlocks(e, o, i = "before") {
|
|
7669
|
-
return
|
|
8002
|
+
return Oi(e, o, i, this);
|
|
7670
8003
|
}
|
|
7671
8004
|
/**
|
|
7672
8005
|
* Updates an existing block in the editor. Since updatedBlock is a PartialBlock object, some fields might not be
|
|
@@ -7676,14 +8009,14 @@ class _t {
|
|
|
7676
8009
|
* @param update A partial block which defines how the existing block should be changed.
|
|
7677
8010
|
*/
|
|
7678
8011
|
updateBlock(e, o) {
|
|
7679
|
-
return
|
|
8012
|
+
return Ri(e, o, this);
|
|
7680
8013
|
}
|
|
7681
8014
|
/**
|
|
7682
8015
|
* Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
|
|
7683
8016
|
* @param blocksToRemove An array of identifiers for existing blocks that should be removed.
|
|
7684
8017
|
*/
|
|
7685
8018
|
removeBlocks(e) {
|
|
7686
|
-
return
|
|
8019
|
+
return Vi(e, this);
|
|
7687
8020
|
}
|
|
7688
8021
|
/**
|
|
7689
8022
|
* Replaces existing blocks in the editor with new blocks. If the blocks that should be removed are not adjacent or
|
|
@@ -7693,7 +8026,7 @@ class _t {
|
|
|
7693
8026
|
* @param blocksToInsert An array of partial blocks to replace the old ones with.
|
|
7694
8027
|
*/
|
|
7695
8028
|
replaceBlocks(e, o) {
|
|
7696
|
-
return
|
|
8029
|
+
return ji(e, o, this);
|
|
7697
8030
|
}
|
|
7698
8031
|
/**
|
|
7699
8032
|
* Insert a piece of content at the current cursor position.
|
|
@@ -7701,12 +8034,12 @@ class _t {
|
|
|
7701
8034
|
* @param content can be a string, or array of partial inline content elements
|
|
7702
8035
|
*/
|
|
7703
8036
|
insertInlineContent(e) {
|
|
7704
|
-
const o =
|
|
8037
|
+
const o = ne(
|
|
7705
8038
|
e,
|
|
7706
8039
|
this._tiptapEditor.schema,
|
|
7707
8040
|
this.schema.styleSchema
|
|
7708
8041
|
);
|
|
7709
|
-
|
|
8042
|
+
zi(
|
|
7710
8043
|
{
|
|
7711
8044
|
from: this._tiptapEditor.state.selection.from,
|
|
7712
8045
|
to: this._tiptapEditor.state.selection.to
|
|
@@ -7842,7 +8175,7 @@ class _t {
|
|
|
7842
8175
|
* @returns The blocks, serialized as an HTML string.
|
|
7843
8176
|
*/
|
|
7844
8177
|
async blocksToHTMLLossy(e = this.document) {
|
|
7845
|
-
return
|
|
8178
|
+
return re(
|
|
7846
8179
|
this._tiptapEditor.schema,
|
|
7847
8180
|
this
|
|
7848
8181
|
).exportBlocks(e);
|
|
@@ -7870,7 +8203,7 @@ class _t {
|
|
|
7870
8203
|
* @returns The blocks, serialized as a Markdown string.
|
|
7871
8204
|
*/
|
|
7872
8205
|
async blocksToMarkdownLossy(e = this.document) {
|
|
7873
|
-
return
|
|
8206
|
+
return Wi(e, this._tiptapEditor.schema, this);
|
|
7874
8207
|
}
|
|
7875
8208
|
/**
|
|
7876
8209
|
* Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on
|
|
@@ -7880,7 +8213,7 @@ class _t {
|
|
|
7880
8213
|
* @returns The blocks parsed from the Markdown string.
|
|
7881
8214
|
*/
|
|
7882
8215
|
async tryParseMarkdownToBlocks(e) {
|
|
7883
|
-
return
|
|
8216
|
+
return Yi(
|
|
7884
8217
|
e,
|
|
7885
8218
|
this.schema.blockSchema,
|
|
7886
8219
|
this.schema.inlineContentSchema,
|
|
@@ -7927,88 +8260,97 @@ class _t {
|
|
|
7927
8260
|
};
|
|
7928
8261
|
}
|
|
7929
8262
|
}
|
|
7930
|
-
function
|
|
8263
|
+
function Gn(t) {
|
|
7931
8264
|
let e = t.getTextCursorPosition().block, o = t.schema.blockSchema[e.type].content;
|
|
7932
8265
|
for (; o === "none"; )
|
|
7933
8266
|
e = t.getTextCursorPosition().nextBlock, o = t.schema.blockSchema[e.type].content, t.setTextCursorPosition(e, "end");
|
|
7934
8267
|
}
|
|
7935
|
-
function
|
|
8268
|
+
function w(t, e) {
|
|
7936
8269
|
const o = t.getTextCursorPosition().block;
|
|
7937
8270
|
if (o.content === void 0)
|
|
7938
8271
|
throw new Error("Slash Menu open in a block that doesn't contain content.");
|
|
7939
|
-
Array.isArray(o.content) && (o.content.length === 1 &&
|
|
8272
|
+
Array.isArray(o.content) && (o.content.length === 1 && Q(o.content[0]) && o.content[0].type === "text" && o.content[0].text === "/" || o.content.length === 0) ? t.updateBlock(o, e) : (t.insertBlocks([e], o, "after"), t.setTextCursorPosition(
|
|
7940
8273
|
t.getTextCursorPosition().nextBlock,
|
|
7941
8274
|
"end"
|
|
7942
8275
|
));
|
|
7943
8276
|
const i = t.getTextCursorPosition().block;
|
|
7944
|
-
return
|
|
8277
|
+
return Gn(t), i;
|
|
7945
8278
|
}
|
|
7946
|
-
function
|
|
8279
|
+
function jr(t) {
|
|
7947
8280
|
const e = [];
|
|
7948
|
-
return
|
|
8281
|
+
return x("heading", t) && e.push(
|
|
7949
8282
|
{
|
|
7950
8283
|
onItemClick: () => {
|
|
7951
|
-
|
|
8284
|
+
w(t, {
|
|
7952
8285
|
type: "heading",
|
|
7953
8286
|
props: { level: 1 }
|
|
7954
8287
|
});
|
|
7955
8288
|
},
|
|
7956
|
-
badge:
|
|
8289
|
+
badge: P("Mod-Alt-1"),
|
|
7957
8290
|
key: "heading",
|
|
7958
8291
|
...t.dictionary.slash_menu.heading
|
|
7959
8292
|
},
|
|
7960
8293
|
{
|
|
7961
8294
|
onItemClick: () => {
|
|
7962
|
-
|
|
8295
|
+
w(t, {
|
|
7963
8296
|
type: "heading",
|
|
7964
8297
|
props: { level: 2 }
|
|
7965
8298
|
});
|
|
7966
8299
|
},
|
|
7967
|
-
badge:
|
|
8300
|
+
badge: P("Mod-Alt-2"),
|
|
7968
8301
|
key: "heading_2",
|
|
7969
8302
|
...t.dictionary.slash_menu.heading_2
|
|
7970
8303
|
},
|
|
7971
8304
|
{
|
|
7972
8305
|
onItemClick: () => {
|
|
7973
|
-
|
|
8306
|
+
w(t, {
|
|
7974
8307
|
type: "heading",
|
|
7975
8308
|
props: { level: 3 }
|
|
7976
8309
|
});
|
|
7977
8310
|
},
|
|
7978
|
-
badge:
|
|
8311
|
+
badge: P("Mod-Alt-3"),
|
|
7979
8312
|
key: "heading_3",
|
|
7980
8313
|
...t.dictionary.slash_menu.heading_3
|
|
7981
8314
|
}
|
|
7982
|
-
),
|
|
8315
|
+
), x("numberedListItem", t) && e.push({
|
|
7983
8316
|
onItemClick: () => {
|
|
7984
|
-
|
|
8317
|
+
w(t, {
|
|
7985
8318
|
type: "numberedListItem"
|
|
7986
8319
|
});
|
|
7987
8320
|
},
|
|
7988
|
-
badge:
|
|
8321
|
+
badge: P("Mod-Shift-7"),
|
|
7989
8322
|
key: "numbered_list",
|
|
7990
8323
|
...t.dictionary.slash_menu.numbered_list
|
|
7991
|
-
}),
|
|
8324
|
+
}), x("bulletListItem", t) && e.push({
|
|
7992
8325
|
onItemClick: () => {
|
|
7993
|
-
|
|
8326
|
+
w(t, {
|
|
7994
8327
|
type: "bulletListItem"
|
|
7995
8328
|
});
|
|
7996
8329
|
},
|
|
7997
|
-
badge:
|
|
8330
|
+
badge: P("Mod-Shift-8"),
|
|
7998
8331
|
key: "bullet_list",
|
|
7999
8332
|
...t.dictionary.slash_menu.bullet_list
|
|
8000
|
-
}),
|
|
8333
|
+
}), x("checkListItem", t) && e.push({
|
|
8001
8334
|
onItemClick: () => {
|
|
8002
|
-
|
|
8335
|
+
w(t, {
|
|
8336
|
+
type: "checkListItem"
|
|
8337
|
+
});
|
|
8338
|
+
},
|
|
8339
|
+
badge: P("Mod-Shift-9"),
|
|
8340
|
+
key: "check_list",
|
|
8341
|
+
...t.dictionary.slash_menu.check_list
|
|
8342
|
+
}), x("paragraph", t) && e.push({
|
|
8343
|
+
onItemClick: () => {
|
|
8344
|
+
w(t, {
|
|
8003
8345
|
type: "paragraph"
|
|
8004
8346
|
});
|
|
8005
8347
|
},
|
|
8006
|
-
badge:
|
|
8348
|
+
badge: P("Mod-Alt-0"),
|
|
8007
8349
|
key: "paragraph",
|
|
8008
8350
|
...t.dictionary.slash_menu.paragraph
|
|
8009
|
-
}),
|
|
8351
|
+
}), x("table", t) && e.push({
|
|
8010
8352
|
onItemClick: () => {
|
|
8011
|
-
|
|
8353
|
+
w(t, {
|
|
8012
8354
|
type: "table",
|
|
8013
8355
|
content: {
|
|
8014
8356
|
type: "tableContent",
|
|
@@ -8026,9 +8368,9 @@ function Dr(t) {
|
|
|
8026
8368
|
badge: void 0,
|
|
8027
8369
|
key: "table",
|
|
8028
8370
|
...t.dictionary.slash_menu.table
|
|
8029
|
-
}),
|
|
8371
|
+
}), x("image", t) && e.push({
|
|
8030
8372
|
onItemClick: () => {
|
|
8031
|
-
const o =
|
|
8373
|
+
const o = w(t, {
|
|
8032
8374
|
type: "image"
|
|
8033
8375
|
});
|
|
8034
8376
|
t.prosemirrorView.dispatch(
|
|
@@ -8039,9 +8381,9 @@ function Dr(t) {
|
|
|
8039
8381
|
},
|
|
8040
8382
|
key: "image",
|
|
8041
8383
|
...t.dictionary.slash_menu.image
|
|
8042
|
-
}),
|
|
8384
|
+
}), x("video", t) && e.push({
|
|
8043
8385
|
onItemClick: () => {
|
|
8044
|
-
const o =
|
|
8386
|
+
const o = w(t, {
|
|
8045
8387
|
type: "video"
|
|
8046
8388
|
});
|
|
8047
8389
|
t.prosemirrorView.dispatch(
|
|
@@ -8052,9 +8394,9 @@ function Dr(t) {
|
|
|
8052
8394
|
},
|
|
8053
8395
|
key: "video",
|
|
8054
8396
|
...t.dictionary.slash_menu.video
|
|
8055
|
-
}),
|
|
8397
|
+
}), x("audio", t) && e.push({
|
|
8056
8398
|
onItemClick: () => {
|
|
8057
|
-
const o =
|
|
8399
|
+
const o = w(t, {
|
|
8058
8400
|
type: "audio"
|
|
8059
8401
|
});
|
|
8060
8402
|
t.prosemirrorView.dispatch(
|
|
@@ -8065,9 +8407,9 @@ function Dr(t) {
|
|
|
8065
8407
|
},
|
|
8066
8408
|
key: "audio",
|
|
8067
8409
|
...t.dictionary.slash_menu.audio
|
|
8068
|
-
}),
|
|
8410
|
+
}), x("file", t) && e.push({
|
|
8069
8411
|
onItemClick: () => {
|
|
8070
|
-
const o =
|
|
8412
|
+
const o = w(t, {
|
|
8071
8413
|
type: "file"
|
|
8072
8414
|
});
|
|
8073
8415
|
t.prosemirrorView.dispatch(
|
|
@@ -8080,14 +8422,14 @@ function Dr(t) {
|
|
|
8080
8422
|
...t.dictionary.slash_menu.file
|
|
8081
8423
|
}), e;
|
|
8082
8424
|
}
|
|
8083
|
-
function
|
|
8425
|
+
function zr(t, e) {
|
|
8084
8426
|
return t.filter(
|
|
8085
8427
|
({ title: o, aliases: i }) => o.toLowerCase().includes(e.toLowerCase()) || i && i.filter(
|
|
8086
8428
|
(n) => n.toLowerCase().includes(e.toLowerCase())
|
|
8087
8429
|
).length !== 0
|
|
8088
8430
|
);
|
|
8089
8431
|
}
|
|
8090
|
-
function
|
|
8432
|
+
function be(t = "") {
|
|
8091
8433
|
return typeof t == "string" ? [
|
|
8092
8434
|
{
|
|
8093
8435
|
type: "text",
|
|
@@ -8096,22 +8438,22 @@ function fe(t = "") {
|
|
|
8096
8438
|
}
|
|
8097
8439
|
] : t;
|
|
8098
8440
|
}
|
|
8099
|
-
function
|
|
8100
|
-
return typeof t == "string" ?
|
|
8441
|
+
function _t(t) {
|
|
8442
|
+
return typeof t == "string" ? be(t) : Array.isArray(t) ? t.flatMap((e) => typeof e == "string" ? be(e) : Ye(e) ? {
|
|
8101
8443
|
...e,
|
|
8102
|
-
content:
|
|
8103
|
-
} :
|
|
8444
|
+
content: be(e.content)
|
|
8445
|
+
} : Q(e) ? e : {
|
|
8104
8446
|
props: {},
|
|
8105
8447
|
...e,
|
|
8106
|
-
content:
|
|
8448
|
+
content: _t(e.content)
|
|
8107
8449
|
}) : t;
|
|
8108
8450
|
}
|
|
8109
|
-
function
|
|
8451
|
+
function Fr(t, e) {
|
|
8110
8452
|
return e.map(
|
|
8111
|
-
(o) =>
|
|
8453
|
+
(o) => wt(t, o)
|
|
8112
8454
|
);
|
|
8113
8455
|
}
|
|
8114
|
-
function
|
|
8456
|
+
function wt(t, e) {
|
|
8115
8457
|
const o = {
|
|
8116
8458
|
id: "",
|
|
8117
8459
|
type: e.type,
|
|
@@ -8126,97 +8468,97 @@ function vt(t, e) {
|
|
|
8126
8468
|
}
|
|
8127
8469
|
), {
|
|
8128
8470
|
...o,
|
|
8129
|
-
content:
|
|
8130
|
-
children: o.children.map((i) =>
|
|
8471
|
+
content: _t(o.content),
|
|
8472
|
+
children: o.children.map((i) => wt(t, i))
|
|
8131
8473
|
};
|
|
8132
8474
|
}
|
|
8133
|
-
function
|
|
8134
|
-
t.id || (t.id =
|
|
8475
|
+
function Wn(t) {
|
|
8476
|
+
t.id || (t.id = ee.options.generateID()), t.children && $n(t.children);
|
|
8135
8477
|
}
|
|
8136
|
-
function
|
|
8478
|
+
function $n(t) {
|
|
8137
8479
|
for (const e of t)
|
|
8138
|
-
|
|
8480
|
+
Wn(e);
|
|
8139
8481
|
}
|
|
8140
8482
|
export {
|
|
8141
8483
|
li as AudioBlock,
|
|
8142
|
-
|
|
8143
|
-
|
|
8484
|
+
vt as BlockNoteEditor,
|
|
8485
|
+
Be as BlockNoteSchema,
|
|
8144
8486
|
Go as FileBlock,
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8148
|
-
|
|
8487
|
+
en as FilePanelProsemirrorPlugin,
|
|
8488
|
+
Qi as FilePanelView,
|
|
8489
|
+
nn as FormattingToolbarProsemirrorPlugin,
|
|
8490
|
+
tn as FormattingToolbarView,
|
|
8149
8491
|
Zo as ImageBlock,
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8492
|
+
sn as LinkToolbarProsemirrorPlugin,
|
|
8493
|
+
gn as SideMenuProsemirrorPlugin,
|
|
8494
|
+
mn as SideMenuView,
|
|
8495
|
+
cn as SuggestionMenuProseMirrorPlugin,
|
|
8496
|
+
_n as TableHandlesProsemirrorPlugin,
|
|
8497
|
+
vn as TableHandlesView,
|
|
8498
|
+
ee as UniqueID,
|
|
8157
8499
|
I as UnreachableCaseError,
|
|
8158
8500
|
oi as VideoBlock,
|
|
8159
|
-
|
|
8160
|
-
|
|
8501
|
+
Wn as addIdsToBlock,
|
|
8502
|
+
$n as addIdsToBlocks,
|
|
8161
8503
|
Io as addInlineContentAttributes,
|
|
8162
8504
|
Ao as addInlineContentKeyboardShortcuts,
|
|
8163
8505
|
Do as addStyleAttributes,
|
|
8164
|
-
|
|
8506
|
+
Tr as assertEmpty,
|
|
8165
8507
|
ni as audioBlockConfig,
|
|
8166
8508
|
ai as audioParse,
|
|
8167
8509
|
ii as audioPropSchema,
|
|
8168
8510
|
ri as audioRender,
|
|
8169
8511
|
si as audioToExternalHTML,
|
|
8170
8512
|
N as blockToNode,
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8513
|
+
ie as camelToDataKebab,
|
|
8514
|
+
Rr as checkBlockHasDefaultProp,
|
|
8515
|
+
Ui as checkBlockIsDefaultType,
|
|
8516
|
+
Ur as checkBlockIsFileBlock,
|
|
8517
|
+
Or as checkBlockIsFileBlockWithPlaceholder,
|
|
8518
|
+
Dr as checkBlockIsFileBlockWithPreview,
|
|
8519
|
+
Di as checkBlockTypeHasDefaultProp,
|
|
8520
|
+
x as checkDefaultBlockTypeInSchema,
|
|
8521
|
+
Ee as contentNodeToInlineContent,
|
|
8522
|
+
le as createAddFileButton,
|
|
8523
|
+
ae as createBlockSpec,
|
|
8524
|
+
$ as createBlockSpecFromStronglyTypedTiptapNode,
|
|
8525
|
+
se as createDefaultFilePreview,
|
|
8526
|
+
re as createExternalHTMLExporter,
|
|
8527
|
+
Ce as createFigureWithCaption,
|
|
8528
|
+
V as createFileAndCaptionWrapper,
|
|
8529
|
+
Ir as createInlineContentSpec,
|
|
8188
8530
|
Po as createInlineContentSpecFromTipTapNode,
|
|
8189
8531
|
st as createInternalBlockSpec,
|
|
8190
8532
|
nt as createInternalHTMLSerializer,
|
|
8191
8533
|
No as createInternalInlineContentSpec,
|
|
8192
8534
|
ct as createInternalStyleSpec,
|
|
8193
|
-
|
|
8535
|
+
ce as createLinkWithCaption,
|
|
8194
8536
|
pt as createResizeHandlesWrapper,
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
8537
|
+
j as createStronglyTypedTiptapNode,
|
|
8538
|
+
Ar as createStyleSpec,
|
|
8539
|
+
H as createStyleSpecFromTipTapMark,
|
|
8540
|
+
Vr as createSuggestionMenu,
|
|
8541
|
+
Hi as defaultBlockSchema,
|
|
8200
8542
|
ht as defaultBlockSpecs,
|
|
8201
|
-
|
|
8543
|
+
Hr as defaultInlineContentSchema,
|
|
8202
8544
|
ft as defaultInlineContentSpecs,
|
|
8203
|
-
|
|
8204
|
-
|
|
8545
|
+
y as defaultProps,
|
|
8546
|
+
Pr as defaultStyleSchema,
|
|
8205
8547
|
mt as defaultStyleSpecs,
|
|
8206
8548
|
Vo as fileBlockConfig,
|
|
8207
8549
|
zo as fileParse,
|
|
8208
8550
|
Ro as filePropSchema,
|
|
8209
8551
|
jo as fileRender,
|
|
8210
8552
|
Fo as fileToExternalHTML,
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8553
|
+
Lr as filenameFromURL,
|
|
8554
|
+
zr as filterSuggestionItems,
|
|
8555
|
+
P as formatKeyboardShortcut,
|
|
8556
|
+
on as formattingToolbarPluginKey,
|
|
8215
8557
|
Bo as getBlockFromPos,
|
|
8216
|
-
|
|
8558
|
+
Dn as getBlockNoteExtensions,
|
|
8217
8559
|
lt as getBlockSchemaFromSpecs,
|
|
8218
|
-
|
|
8219
|
-
|
|
8560
|
+
jr as getDefaultSlashMenuItems,
|
|
8561
|
+
Te as getDraggableBlockFromCoords,
|
|
8220
8562
|
Ho as getInlineContentParseRules,
|
|
8221
8563
|
dt as getInlineContentSchemaFromSpecs,
|
|
8222
8564
|
Lo as getParseRules,
|
|
@@ -8228,35 +8570,35 @@ export {
|
|
|
8228
8570
|
Ko as imageRender,
|
|
8229
8571
|
Xo as imageToExternalHTML,
|
|
8230
8572
|
rt as inheritedProps,
|
|
8231
|
-
|
|
8232
|
-
|
|
8573
|
+
ne as inlineContentToNodes,
|
|
8574
|
+
w as insertOrUpdateBlock,
|
|
8233
8575
|
To as isAppleOS,
|
|
8234
8576
|
He as isLinkInlineContent,
|
|
8235
8577
|
Ye as isPartialLinkInlineContent,
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8240
|
-
|
|
8241
|
-
|
|
8578
|
+
Br as isSafari,
|
|
8579
|
+
Q as isStyledTextInlineContent,
|
|
8580
|
+
an as linkToolbarPluginKey,
|
|
8581
|
+
Mr as locales,
|
|
8582
|
+
O as mergeCSSClasses,
|
|
8583
|
+
v as nodeToBlock,
|
|
8242
8584
|
tt as nodeToCustomInlineContent,
|
|
8243
8585
|
Oe as parseEmbedElement,
|
|
8244
|
-
|
|
8586
|
+
de as parseFigureElement,
|
|
8245
8587
|
Re as parseImageElement,
|
|
8246
|
-
|
|
8247
|
-
|
|
8588
|
+
wt as partialBlockToBlockForTesting,
|
|
8589
|
+
Fr as partialBlocksToBlocksForTesting,
|
|
8248
8590
|
at as propsToAttributes,
|
|
8249
|
-
|
|
8591
|
+
fn as sideMenuPluginKey,
|
|
8250
8592
|
Uo as stylePropsToAttributes,
|
|
8251
|
-
|
|
8593
|
+
D as suggestionMenuPluginKey,
|
|
8252
8594
|
Qe as tableContentToNodes,
|
|
8253
|
-
|
|
8254
|
-
|
|
8595
|
+
J as tableHandlesPluginKey,
|
|
8596
|
+
Nr as uploadToTmpFilesDotOrg_DEV_ONLY,
|
|
8255
8597
|
Yo as videoBlockConfig,
|
|
8256
8598
|
ei as videoParse,
|
|
8257
8599
|
Jo as videoPropSchema,
|
|
8258
8600
|
Qo as videoRender,
|
|
8259
8601
|
ti as videoToExternalHTML,
|
|
8260
|
-
|
|
8602
|
+
me as wrapInBlockStructure
|
|
8261
8603
|
};
|
|
8262
8604
|
//# sourceMappingURL=blocknote.js.map
|