@blocknote/core 0.15.7 → 0.15.10
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 +1304 -1194
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +5 -5
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +23 -23
- package/src/api/exporters/copyExtension.ts +48 -33
- package/src/api/exporters/html/__snapshots__/complex/misc/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/customParagraph/styled/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/file/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/file/nested/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/file/noCaption/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/file/noName/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/fontSize/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/between-links/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/end/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/link/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/multiple/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/only/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/start/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/hardbreak/styles/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/nested/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/noCaption/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/noName/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/image/noPreview/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/link/adjacent/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/link/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/link/styled/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/mention/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/paragraph/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/paragraph/empty/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/paragraph/lineBreaks/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/paragraph/nested/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/paragraph/styled/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleCustomParagraph/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleCustomParagraph/nested/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleCustomParagraph/styled/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/button/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/nested/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noName/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/small/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots__/tag/basic/external.html +1 -1
- package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionLeavesBlockChildren.html +1 -1
- package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionSpansBlocksChildren.html +1 -1
- package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionWithinBlockChildren.html +1 -1
- package/src/api/exporters/html/util/simplifyBlocksRehypePlugin.ts +51 -2
- package/src/api/parsers/handleFileInsertion.ts +30 -17
- package/src/blocks/AudioBlockContent/AudioBlockContent.ts +23 -47
- package/src/blocks/FileBlockContent/FileBlockContent.ts +4 -22
- package/src/blocks/FileBlockContent/fileBlockHelpers.ts +72 -1
- package/src/blocks/ImageBlockContent/ImageBlockContent.ts +35 -61
- package/src/blocks/VideoBlockContent/VideoBlockContent.ts +33 -58
- package/src/editor/BlockNoteEditor.test.ts +13 -0
- package/src/editor/BlockNoteEditor.ts +71 -6
- package/src/editor/BlockNoteExtensions.ts +4 -2
- package/src/editor/BlockNoteTipTapEditor.ts +4 -1
- package/src/extensions/FilePanel/FilePanelPlugin.ts +10 -6
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +0 -1
- package/src/extensions/SideMenu/SideMenuPlugin.ts +22 -11
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +6 -3
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +5 -1
- package/src/extensions/UniqueID/UniqueID.ts +15 -4
- package/src/pm-nodes/BlockContainer.ts +1 -2
- package/src/schema/blocks/createSpec.ts +31 -2
- package/src/schema/blocks/types.ts +2 -0
- package/src/schema/inlineContent/createSpec.ts +58 -6
- package/types/src/blocks/AudioBlockContent/AudioBlockContent.d.ts +2 -2
- package/types/src/blocks/FileBlockContent/FileBlockContent.d.ts +2 -2
- package/types/src/blocks/FileBlockContent/fileBlockHelpers.d.ts +11 -1
- package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +2 -2
- package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +2 -2
- package/types/src/editor/BlockNoteEditor.d.ts +23 -4
- package/types/src/editor/BlockNoteExtensions.d.ts +1 -0
- package/types/src/extensions/FilePanel/FilePanelPlugin.d.ts +1 -1
- package/types/src/schema/blocks/createSpec.d.ts +3 -0
- package/types/src/schema/blocks/types.d.ts +2 -0
- package/types/src/schema/inlineContent/createSpec.d.ts +5 -4
package/dist/blocknote.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var c = (e, t, i) =>
|
|
4
|
-
import { Slice as
|
|
5
|
-
import { Extension as
|
|
6
|
-
import { Plugin as
|
|
7
|
-
import { v4 as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { TableCell as
|
|
14
|
-
import { TableHeader as
|
|
15
|
-
import { TableRow as
|
|
16
|
-
import { columnResizing as
|
|
17
|
-
import { DecorationSet as K, Decoration as
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import { Dropcursor as
|
|
21
|
-
import { Gapcursor as
|
|
22
|
-
import { HardBreak as
|
|
23
|
-
import { History as
|
|
24
|
-
import { Link as
|
|
25
|
-
import { Text as
|
|
26
|
-
const
|
|
1
|
+
var Bt = Object.defineProperty;
|
|
2
|
+
var Lt = (e, t, i) => t in e ? Bt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
|
|
3
|
+
var c = (e, t, i) => Lt(e, typeof t != "symbol" ? t + "" : t, i);
|
|
4
|
+
import { Slice as z, Fragment as N, DOMSerializer as Ee, DOMParser as It, Node as At } from "prosemirror-model";
|
|
5
|
+
import { Extension as I, combineTransactionSteps as Nt, getChangedRanges as Pt, findChildrenInRange as Ht, Node as q, Mark as Ce, InputRule as ee, callOrReturn as Ut, getExtensionField as Dt, mergeAttributes as jt, selectionToInsertionEnd as zt, isTextSelection as Vt, isNodeSelection as Rt, posToDOMRect as we, getMarkRange as De, findParentNode as Ot, extensions as J, Editor as Ft, createDocument as Gt, findChildren as je, getSchema as Wt } from "@tiptap/core";
|
|
6
|
+
import { Plugin as x, PluginKey as L, Selection as fe, NodeSelection as le, TextSelection as Y, EditorState as Kt } from "prosemirror-state";
|
|
7
|
+
import { v4 as $t } from "uuid";
|
|
8
|
+
import qt from "@tiptap/extension-bold";
|
|
9
|
+
import Xt from "@tiptap/extension-code";
|
|
10
|
+
import Zt from "@tiptap/extension-italic";
|
|
11
|
+
import Jt from "@tiptap/extension-strike";
|
|
12
|
+
import Yt from "@tiptap/extension-underline";
|
|
13
|
+
import { TableCell as Qt } from "@tiptap/extension-table-cell";
|
|
14
|
+
import { TableHeader as ei } from "@tiptap/extension-table-header";
|
|
15
|
+
import { TableRow as ti } from "@tiptap/extension-table-row";
|
|
16
|
+
import { columnResizing as ii, tableEditing as oi } from "prosemirror-tables";
|
|
17
|
+
import { DecorationSet as K, Decoration as $, EditorView as ni } from "prosemirror-view";
|
|
18
|
+
import ri from "@tiptap/extension-collaboration";
|
|
19
|
+
import ai from "@tiptap/extension-collaboration-cursor";
|
|
20
|
+
import { Dropcursor as si } from "@tiptap/extension-dropcursor";
|
|
21
|
+
import { Gapcursor as li } from "@tiptap/extension-gapcursor";
|
|
22
|
+
import { HardBreak as di } from "@tiptap/extension-hard-break";
|
|
23
|
+
import { History as ci } from "@tiptap/extension-history";
|
|
24
|
+
import { Link as ui } from "@tiptap/extension-link";
|
|
25
|
+
import { Text as pi } from "@tiptap/extension-text";
|
|
26
|
+
const hi = {
|
|
27
27
|
slash_menu: {
|
|
28
28
|
heading: {
|
|
29
29
|
title: "عنوان 1",
|
|
@@ -313,7 +313,7 @@ const ci = {
|
|
|
313
313
|
generic: {
|
|
314
314
|
ctrl_shortcut: "Ctrl"
|
|
315
315
|
}
|
|
316
|
-
},
|
|
316
|
+
}, mi = {
|
|
317
317
|
slash_menu: {
|
|
318
318
|
heading: {
|
|
319
319
|
title: "Überschrift 1",
|
|
@@ -618,7 +618,7 @@ const ci = {
|
|
|
618
618
|
generic: {
|
|
619
619
|
ctrl_shortcut: "Strg"
|
|
620
620
|
}
|
|
621
|
-
},
|
|
621
|
+
}, Qe = {
|
|
622
622
|
slash_menu: {
|
|
623
623
|
heading: {
|
|
624
624
|
title: "Heading 1",
|
|
@@ -924,7 +924,7 @@ const ci = {
|
|
|
924
924
|
generic: {
|
|
925
925
|
ctrl_shortcut: "Ctrl"
|
|
926
926
|
}
|
|
927
|
-
},
|
|
927
|
+
}, fi = {
|
|
928
928
|
slash_menu: {
|
|
929
929
|
heading: {
|
|
930
930
|
title: "Encabezado 1",
|
|
@@ -1197,7 +1197,7 @@ const ci = {
|
|
|
1197
1197
|
generic: {
|
|
1198
1198
|
ctrl_shortcut: "Ctrl"
|
|
1199
1199
|
}
|
|
1200
|
-
},
|
|
1200
|
+
}, gi = {
|
|
1201
1201
|
slash_menu: {
|
|
1202
1202
|
heading: {
|
|
1203
1203
|
title: "Titre 1",
|
|
@@ -1502,7 +1502,7 @@ const ci = {
|
|
|
1502
1502
|
generic: {
|
|
1503
1503
|
ctrl_shortcut: "Ctrl"
|
|
1504
1504
|
}
|
|
1505
|
-
},
|
|
1505
|
+
}, bi = {
|
|
1506
1506
|
slash_menu: {
|
|
1507
1507
|
heading: {
|
|
1508
1508
|
title: "Fyrirsögn 1",
|
|
@@ -1799,7 +1799,7 @@ const ci = {
|
|
|
1799
1799
|
generic: {
|
|
1800
1800
|
ctrl_shortcut: "Ctrl"
|
|
1801
1801
|
}
|
|
1802
|
-
},
|
|
1802
|
+
}, _i = {
|
|
1803
1803
|
slash_menu: {
|
|
1804
1804
|
heading: {
|
|
1805
1805
|
title: "見出し1",
|
|
@@ -2124,7 +2124,7 @@ const ci = {
|
|
|
2124
2124
|
generic: {
|
|
2125
2125
|
ctrl_shortcut: "Ctrl"
|
|
2126
2126
|
}
|
|
2127
|
-
},
|
|
2127
|
+
}, ki = {
|
|
2128
2128
|
slash_menu: {
|
|
2129
2129
|
heading: {
|
|
2130
2130
|
title: "제목1",
|
|
@@ -2442,7 +2442,7 @@ const ci = {
|
|
|
2442
2442
|
generic: {
|
|
2443
2443
|
ctrl_shortcut: "Ctrl"
|
|
2444
2444
|
}
|
|
2445
|
-
},
|
|
2445
|
+
}, yi = {
|
|
2446
2446
|
slash_menu: {
|
|
2447
2447
|
heading: {
|
|
2448
2448
|
title: "Kop 1",
|
|
@@ -2747,7 +2747,7 @@ const ci = {
|
|
|
2747
2747
|
generic: {
|
|
2748
2748
|
ctrl_shortcut: "Ctrl"
|
|
2749
2749
|
}
|
|
2750
|
-
},
|
|
2750
|
+
}, wi = {
|
|
2751
2751
|
slash_menu: {
|
|
2752
2752
|
heading: {
|
|
2753
2753
|
title: "Nagłówek 1",
|
|
@@ -3036,7 +3036,7 @@ const ci = {
|
|
|
3036
3036
|
generic: {
|
|
3037
3037
|
ctrl_shortcut: "Ctrl"
|
|
3038
3038
|
}
|
|
3039
|
-
},
|
|
3039
|
+
}, vi = {
|
|
3040
3040
|
slash_menu: {
|
|
3041
3041
|
heading: {
|
|
3042
3042
|
title: "Título",
|
|
@@ -3333,7 +3333,7 @@ const ci = {
|
|
|
3333
3333
|
generic: {
|
|
3334
3334
|
ctrl_shortcut: "Ctrl"
|
|
3335
3335
|
}
|
|
3336
|
-
},
|
|
3336
|
+
}, xi = {
|
|
3337
3337
|
slash_menu: {
|
|
3338
3338
|
heading: {
|
|
3339
3339
|
title: "Заголовок 1 уровня",
|
|
@@ -3665,7 +3665,7 @@ const ci = {
|
|
|
3665
3665
|
generic: {
|
|
3666
3666
|
ctrl_shortcut: "Ctrl"
|
|
3667
3667
|
}
|
|
3668
|
-
},
|
|
3668
|
+
}, Ei = {
|
|
3669
3669
|
slash_menu: {
|
|
3670
3670
|
heading: {
|
|
3671
3671
|
title: "Tiêu đề H1",
|
|
@@ -3969,7 +3969,7 @@ const ci = {
|
|
|
3969
3969
|
generic: {
|
|
3970
3970
|
ctrl_shortcut: "Ctrl"
|
|
3971
3971
|
}
|
|
3972
|
-
},
|
|
3972
|
+
}, Ci = {
|
|
3973
3973
|
slash_menu: {
|
|
3974
3974
|
heading: {
|
|
3975
3975
|
title: "一级标题",
|
|
@@ -4307,27 +4307,27 @@ const ci = {
|
|
|
4307
4307
|
generic: {
|
|
4308
4308
|
ctrl_shortcut: "Ctrl"
|
|
4309
4309
|
}
|
|
4310
|
-
},
|
|
4310
|
+
}, Mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4311
4311
|
__proto__: null,
|
|
4312
|
-
ar:
|
|
4313
|
-
de:
|
|
4314
|
-
en:
|
|
4315
|
-
es:
|
|
4316
|
-
fr:
|
|
4317
|
-
is:
|
|
4318
|
-
ja:
|
|
4319
|
-
ko:
|
|
4320
|
-
nl:
|
|
4321
|
-
pl:
|
|
4322
|
-
pt:
|
|
4323
|
-
ru:
|
|
4324
|
-
vi:
|
|
4325
|
-
zh:
|
|
4312
|
+
ar: hi,
|
|
4313
|
+
de: mi,
|
|
4314
|
+
en: Qe,
|
|
4315
|
+
es: fi,
|
|
4316
|
+
fr: gi,
|
|
4317
|
+
is: bi,
|
|
4318
|
+
ja: _i,
|
|
4319
|
+
ko: ki,
|
|
4320
|
+
nl: yi,
|
|
4321
|
+
pl: wi,
|
|
4322
|
+
pt: vi,
|
|
4323
|
+
ru: xi,
|
|
4324
|
+
vi: Ei,
|
|
4325
|
+
zh: Ci
|
|
4326
4326
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4327
|
-
let
|
|
4328
|
-
async function
|
|
4329
|
-
if (
|
|
4330
|
-
return
|
|
4327
|
+
let H;
|
|
4328
|
+
async function ie() {
|
|
4329
|
+
if (H)
|
|
4330
|
+
return H;
|
|
4331
4331
|
const e = await Promise.all([
|
|
4332
4332
|
import("rehype-parse"),
|
|
4333
4333
|
import("rehype-stringify"),
|
|
@@ -4340,7 +4340,7 @@ async function oe() {
|
|
|
4340
4340
|
import("remark-rehype"),
|
|
4341
4341
|
import("rehype-format")
|
|
4342
4342
|
]);
|
|
4343
|
-
return
|
|
4343
|
+
return H = {
|
|
4344
4344
|
rehypeParse: e[0],
|
|
4345
4345
|
rehypeStringify: e[1],
|
|
4346
4346
|
unified: e[2],
|
|
@@ -4351,22 +4351,22 @@ async function oe() {
|
|
|
4351
4351
|
remarkParse: e[7],
|
|
4352
4352
|
remarkRehype: e[8],
|
|
4353
4353
|
rehypeFormat: e[9]
|
|
4354
|
-
},
|
|
4354
|
+
}, H;
|
|
4355
4355
|
}
|
|
4356
|
-
function
|
|
4356
|
+
function Si(e, t = JSON.stringify) {
|
|
4357
4357
|
const i = {};
|
|
4358
4358
|
return e.filter((o) => {
|
|
4359
4359
|
const n = t(o);
|
|
4360
4360
|
return Object.prototype.hasOwnProperty.call(i, n) ? !1 : i[n] = !0;
|
|
4361
4361
|
});
|
|
4362
4362
|
}
|
|
4363
|
-
function
|
|
4363
|
+
function Mi(e) {
|
|
4364
4364
|
const t = e.filter(
|
|
4365
4365
|
(o, n) => e.indexOf(o) !== n
|
|
4366
4366
|
);
|
|
4367
|
-
return
|
|
4367
|
+
return Si(t);
|
|
4368
4368
|
}
|
|
4369
|
-
const
|
|
4369
|
+
const oe = I.create({
|
|
4370
4370
|
name: "uniqueID",
|
|
4371
4371
|
// we’ll set a very high priority to make sure this runs first
|
|
4372
4372
|
// and is compatible with `appendTransaction` hooks of other extensions
|
|
@@ -4375,12 +4375,13 @@ const ne = T.create({
|
|
|
4375
4375
|
return {
|
|
4376
4376
|
attributeName: "id",
|
|
4377
4377
|
types: [],
|
|
4378
|
+
setIdAttribute: !1,
|
|
4378
4379
|
generateID: () => {
|
|
4379
4380
|
if (typeof window < "u" && window.__TEST_OPTIONS) {
|
|
4380
4381
|
const e = window.__TEST_OPTIONS;
|
|
4381
4382
|
return e.mockID === void 0 ? e.mockID = 0 : e.mockID++, e.mockID.toString();
|
|
4382
4383
|
}
|
|
4383
|
-
return
|
|
4384
|
+
return $t();
|
|
4384
4385
|
},
|
|
4385
4386
|
filterTransaction: null
|
|
4386
4387
|
};
|
|
@@ -4393,9 +4394,15 @@ const ne = T.create({
|
|
|
4393
4394
|
[this.options.attributeName]: {
|
|
4394
4395
|
default: null,
|
|
4395
4396
|
parseHTML: (e) => e.getAttribute(`data-${this.options.attributeName}`),
|
|
4396
|
-
renderHTML: (e) =>
|
|
4397
|
-
|
|
4398
|
-
|
|
4397
|
+
renderHTML: (e) => {
|
|
4398
|
+
const t = {
|
|
4399
|
+
[`data-${this.options.attributeName}`]: e[this.options.attributeName]
|
|
4400
|
+
};
|
|
4401
|
+
return this.options.setIdAttribute ? {
|
|
4402
|
+
...t,
|
|
4403
|
+
id: e[this.options.attributeName]
|
|
4404
|
+
} : t;
|
|
4405
|
+
}
|
|
4399
4406
|
}
|
|
4400
4407
|
}
|
|
4401
4408
|
}
|
|
@@ -4434,51 +4441,51 @@ const ne = T.create({
|
|
|
4434
4441
|
addProseMirrorPlugins() {
|
|
4435
4442
|
let e = null, t = !1;
|
|
4436
4443
|
return [
|
|
4437
|
-
new
|
|
4438
|
-
key: new
|
|
4444
|
+
new x({
|
|
4445
|
+
key: new L("uniqueID"),
|
|
4439
4446
|
appendTransaction: (i, o, n) => {
|
|
4440
|
-
const r = i.some((
|
|
4441
|
-
let
|
|
4442
|
-
return !(!((
|
|
4447
|
+
const r = i.some((f) => f.docChanged) && !o.doc.eq(n.doc), a = this.options.filterTransaction && i.some((f) => {
|
|
4448
|
+
let g, k;
|
|
4449
|
+
return !(!((k = (g = this.options).filterTransaction) === null || k === void 0) && k.call(g, f));
|
|
4443
4450
|
});
|
|
4444
4451
|
if (!r || a)
|
|
4445
4452
|
return;
|
|
4446
|
-
const { tr: s } = n, { types: l, attributeName: d, generateID: u } = this.options, p =
|
|
4453
|
+
const { tr: s } = n, { types: l, attributeName: d, generateID: u } = this.options, p = Nt(
|
|
4447
4454
|
o.doc,
|
|
4448
4455
|
i
|
|
4449
4456
|
), { mapping: h } = p;
|
|
4450
|
-
if (
|
|
4451
|
-
const
|
|
4457
|
+
if (Pt(p).forEach(({ newRange: f }) => {
|
|
4458
|
+
const g = Ht(
|
|
4452
4459
|
n.doc,
|
|
4453
|
-
|
|
4454
|
-
(
|
|
4455
|
-
),
|
|
4456
|
-
|
|
4457
|
-
let
|
|
4458
|
-
const Pe = (
|
|
4460
|
+
f,
|
|
4461
|
+
(b) => l.includes(b.type.name)
|
|
4462
|
+
), k = g.map(({ node: b }) => b.attrs[d]).filter((b) => b !== null), v = Mi(k);
|
|
4463
|
+
g.forEach(({ node: b, pos: y }) => {
|
|
4464
|
+
let S;
|
|
4465
|
+
const Pe = (S = s.doc.nodeAt(y)) === null || S === void 0 ? void 0 : S.attrs[d];
|
|
4459
4466
|
if (Pe === null) {
|
|
4460
4467
|
const He = o.doc.type.createAndFill().content;
|
|
4461
4468
|
if (o.doc.content.findDiffStart(He) === null) {
|
|
4462
|
-
const
|
|
4469
|
+
const Ue = JSON.parse(
|
|
4463
4470
|
JSON.stringify(n.doc.toJSON())
|
|
4464
4471
|
);
|
|
4465
|
-
if (
|
|
4466
|
-
s.setNodeMarkup(
|
|
4467
|
-
...
|
|
4472
|
+
if (Ue.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(Ue.content) === JSON.stringify(He.toJSON())) {
|
|
4473
|
+
s.setNodeMarkup(y, void 0, {
|
|
4474
|
+
...b.attrs,
|
|
4468
4475
|
[d]: "initialBlockId"
|
|
4469
4476
|
});
|
|
4470
4477
|
return;
|
|
4471
4478
|
}
|
|
4472
4479
|
}
|
|
4473
|
-
s.setNodeMarkup(
|
|
4474
|
-
...
|
|
4480
|
+
s.setNodeMarkup(y, void 0, {
|
|
4481
|
+
...b.attrs,
|
|
4475
4482
|
[d]: u()
|
|
4476
4483
|
});
|
|
4477
4484
|
return;
|
|
4478
4485
|
}
|
|
4479
|
-
const { deleted:
|
|
4480
|
-
|
|
4481
|
-
...
|
|
4486
|
+
const { deleted: Tt } = h.invert().mapResult(y);
|
|
4487
|
+
Tt && v.includes(Pe) && s.setNodeMarkup(y, void 0, {
|
|
4488
|
+
...b.attrs,
|
|
4482
4489
|
[d]: u()
|
|
4483
4490
|
});
|
|
4484
4491
|
});
|
|
@@ -4535,9 +4542,9 @@ const ne = T.create({
|
|
|
4535
4542
|
l.marks
|
|
4536
4543
|
);
|
|
4537
4544
|
s.push(d);
|
|
4538
|
-
}),
|
|
4545
|
+
}), N.from(s);
|
|
4539
4546
|
};
|
|
4540
|
-
return t = !1, new
|
|
4547
|
+
return t = !1, new z(
|
|
4541
4548
|
r(i.content),
|
|
4542
4549
|
i.openStart,
|
|
4543
4550
|
i.openEnd
|
|
@@ -4548,7 +4555,7 @@ const ne = T.create({
|
|
|
4548
4555
|
];
|
|
4549
4556
|
}
|
|
4550
4557
|
});
|
|
4551
|
-
function
|
|
4558
|
+
function et(e) {
|
|
4552
4559
|
const t = e.attrs.id, i = e.firstChild, o = i.type, n = e.childCount === 2 ? e.lastChild.childCount : 0;
|
|
4553
4560
|
return {
|
|
4554
4561
|
id: t,
|
|
@@ -4578,7 +4585,7 @@ function _(e, t) {
|
|
|
4578
4585
|
break;
|
|
4579
4586
|
s -= 1, a = n.node(s);
|
|
4580
4587
|
}
|
|
4581
|
-
const { id: l, contentNode: d, contentType: u, numChildBlocks: p } =
|
|
4588
|
+
const { id: l, contentNode: d, contentType: u, numChildBlocks: p } = et(a), h = n.start(s), m = n.end(s);
|
|
4582
4589
|
return {
|
|
4583
4590
|
id: l,
|
|
4584
4591
|
node: a,
|
|
@@ -4593,23 +4600,23 @@ function _(e, t) {
|
|
|
4593
4600
|
function ze(e) {
|
|
4594
4601
|
return e.type === "link";
|
|
4595
4602
|
}
|
|
4596
|
-
function
|
|
4603
|
+
function tt(e) {
|
|
4597
4604
|
return typeof e != "string" && e.type === "link";
|
|
4598
4605
|
}
|
|
4599
|
-
function
|
|
4606
|
+
function te(e) {
|
|
4600
4607
|
return typeof e != "string" && e.type === "text";
|
|
4601
4608
|
}
|
|
4602
|
-
class
|
|
4609
|
+
class P extends Error {
|
|
4603
4610
|
constructor(t) {
|
|
4604
4611
|
super(`Unreachable case: ${t}`);
|
|
4605
4612
|
}
|
|
4606
4613
|
}
|
|
4607
|
-
function
|
|
4614
|
+
function Tr(e, t = !0) {
|
|
4608
4615
|
const { "data-test": i, ...o } = e;
|
|
4609
4616
|
if (Object.keys(o).length > 0 && t)
|
|
4610
4617
|
throw new Error("Object must be empty " + JSON.stringify(e));
|
|
4611
4618
|
}
|
|
4612
|
-
function
|
|
4619
|
+
function Ve(e, t, i) {
|
|
4613
4620
|
const o = [];
|
|
4614
4621
|
for (const [n, r] of Object.entries(e.styles)) {
|
|
4615
4622
|
const a = i[n];
|
|
@@ -4620,16 +4627,16 @@ function Re(e, t, i) {
|
|
|
4620
4627
|
else if (a.propSchema === "string")
|
|
4621
4628
|
o.push(t.mark(n, { stringValue: r }));
|
|
4622
4629
|
else
|
|
4623
|
-
throw new
|
|
4630
|
+
throw new P(a.propSchema);
|
|
4624
4631
|
}
|
|
4625
4632
|
return e.text.split(/(\n)/g).filter((n) => n.length > 0).map((n) => n === `
|
|
4626
4633
|
` ? t.nodes.hardBreak.create() : t.text(n, o));
|
|
4627
4634
|
}
|
|
4628
|
-
function
|
|
4635
|
+
function Ti(e, t, i) {
|
|
4629
4636
|
const o = t.marks.link.create({
|
|
4630
4637
|
href: e.href
|
|
4631
4638
|
});
|
|
4632
|
-
return
|
|
4639
|
+
return ve(e.content, t, i).map(
|
|
4633
4640
|
(n) => {
|
|
4634
4641
|
if (n.type.name === "text")
|
|
4635
4642
|
return n.mark([...n.marks, o]);
|
|
@@ -4639,29 +4646,29 @@ function Ci(e, t, i) {
|
|
|
4639
4646
|
}
|
|
4640
4647
|
);
|
|
4641
4648
|
}
|
|
4642
|
-
function
|
|
4649
|
+
function ve(e, t, i) {
|
|
4643
4650
|
const o = [];
|
|
4644
4651
|
if (typeof e == "string")
|
|
4645
4652
|
return o.push(
|
|
4646
|
-
...
|
|
4653
|
+
...Ve(
|
|
4647
4654
|
{ type: "text", text: e, styles: {} },
|
|
4648
4655
|
t,
|
|
4649
4656
|
i
|
|
4650
4657
|
)
|
|
4651
4658
|
), o;
|
|
4652
4659
|
for (const n of e)
|
|
4653
|
-
o.push(...
|
|
4660
|
+
o.push(...Ve(n, t, i));
|
|
4654
4661
|
return o;
|
|
4655
4662
|
}
|
|
4656
|
-
function
|
|
4663
|
+
function V(e, t, i) {
|
|
4657
4664
|
const o = [];
|
|
4658
4665
|
for (const n of e)
|
|
4659
|
-
typeof n == "string" ? o.push(...
|
|
4660
|
-
|
|
4666
|
+
typeof n == "string" ? o.push(...ve(n, t, i)) : tt(n) ? o.push(...Ti(n, t, i)) : te(n) ? o.push(...ve([n], t, i)) : o.push(
|
|
4667
|
+
ot(n, t, i)
|
|
4661
4668
|
);
|
|
4662
4669
|
return o;
|
|
4663
4670
|
}
|
|
4664
|
-
function
|
|
4671
|
+
function it(e, t, i) {
|
|
4665
4672
|
const o = [];
|
|
4666
4673
|
for (const n of e.rows) {
|
|
4667
4674
|
const r = [];
|
|
@@ -4672,7 +4679,7 @@ function et(e, t, i) {
|
|
|
4672
4679
|
else if (typeof s == "string")
|
|
4673
4680
|
l = t.nodes.tableParagraph.create({}, t.text(s));
|
|
4674
4681
|
else {
|
|
4675
|
-
const u =
|
|
4682
|
+
const u = V(s, t, i);
|
|
4676
4683
|
l = t.nodes.tableParagraph.create({}, u);
|
|
4677
4684
|
}
|
|
4678
4685
|
const d = t.nodes.tableCell.create({}, l);
|
|
@@ -4683,36 +4690,36 @@ function et(e, t, i) {
|
|
|
4683
4690
|
}
|
|
4684
4691
|
return o;
|
|
4685
4692
|
}
|
|
4686
|
-
function
|
|
4693
|
+
function ot(e, t, i) {
|
|
4687
4694
|
let o, n = e.type;
|
|
4688
4695
|
if (n === void 0 && (n = "paragraph"), !t.nodes[n])
|
|
4689
4696
|
throw new Error(`node type ${n} not found in schema`);
|
|
4690
4697
|
if (!e.content)
|
|
4691
4698
|
o = t.nodes[n].create(e.props);
|
|
4692
4699
|
else if (typeof e.content == "string") {
|
|
4693
|
-
const r =
|
|
4700
|
+
const r = V([e.content], t, i);
|
|
4694
4701
|
o = t.nodes[n].create(e.props, r);
|
|
4695
4702
|
} else if (Array.isArray(e.content)) {
|
|
4696
|
-
const r =
|
|
4703
|
+
const r = V(e.content, t, i);
|
|
4697
4704
|
o = t.nodes[n].create(e.props, r);
|
|
4698
4705
|
} else if (e.content.type === "tableContent") {
|
|
4699
|
-
const r =
|
|
4706
|
+
const r = it(e.content, t, i);
|
|
4700
4707
|
o = t.nodes[n].create(e.props, r);
|
|
4701
4708
|
} else
|
|
4702
|
-
throw new
|
|
4709
|
+
throw new P(e.content.type);
|
|
4703
4710
|
return o;
|
|
4704
4711
|
}
|
|
4705
|
-
function
|
|
4712
|
+
function U(e, t, i) {
|
|
4706
4713
|
let o = e.id;
|
|
4707
|
-
o === void 0 && (o =
|
|
4708
|
-
const n =
|
|
4714
|
+
o === void 0 && (o = oe.options.generateID());
|
|
4715
|
+
const n = ot(
|
|
4709
4716
|
e,
|
|
4710
4717
|
t,
|
|
4711
4718
|
i
|
|
4712
4719
|
), r = [];
|
|
4713
4720
|
if (e.children)
|
|
4714
4721
|
for (const s of e.children)
|
|
4715
|
-
r.push(
|
|
4722
|
+
r.push(U(s, t, i));
|
|
4716
4723
|
const a = t.nodes.blockGroup.create({}, r);
|
|
4717
4724
|
return t.nodes.blockContainer.create(
|
|
4718
4725
|
{
|
|
@@ -4722,7 +4729,7 @@ function H(e, t, i) {
|
|
|
4722
4729
|
r.length > 0 ? [n, a] : n
|
|
4723
4730
|
);
|
|
4724
4731
|
}
|
|
4725
|
-
function
|
|
4732
|
+
function Bi(e, t, i) {
|
|
4726
4733
|
const o = {
|
|
4727
4734
|
type: "tableContent",
|
|
4728
4735
|
rows: []
|
|
@@ -4748,7 +4755,7 @@ function Se(e, t, i) {
|
|
|
4748
4755
|
return e.content.forEach((r) => {
|
|
4749
4756
|
if (r.type.name === "hardBreak") {
|
|
4750
4757
|
if (n)
|
|
4751
|
-
if (
|
|
4758
|
+
if (te(n))
|
|
4752
4759
|
n.text += `
|
|
4753
4760
|
`;
|
|
4754
4761
|
else if (ze(n))
|
|
@@ -4767,7 +4774,7 @@ function Se(e, t, i) {
|
|
|
4767
4774
|
}
|
|
4768
4775
|
if (r.type.name !== "link" && r.type.name !== "text" && t[r.type.name]) {
|
|
4769
4776
|
n && (o.push(n), n = void 0), o.push(
|
|
4770
|
-
|
|
4777
|
+
xe(r, t, i)
|
|
4771
4778
|
);
|
|
4772
4779
|
return;
|
|
4773
4780
|
}
|
|
@@ -4785,9 +4792,9 @@ function Se(e, t, i) {
|
|
|
4785
4792
|
else if (d.propSchema === "string")
|
|
4786
4793
|
a[d.type] = l.attrs.stringValue;
|
|
4787
4794
|
else
|
|
4788
|
-
throw new
|
|
4795
|
+
throw new P(d.propSchema);
|
|
4789
4796
|
}
|
|
4790
|
-
n ?
|
|
4797
|
+
n ? te(n) ? s ? (o.push(n), n = {
|
|
4791
4798
|
type: "link",
|
|
4792
4799
|
href: s.attrs.href,
|
|
4793
4800
|
content: [
|
|
@@ -4838,7 +4845,7 @@ function Se(e, t, i) {
|
|
|
4838
4845
|
};
|
|
4839
4846
|
}), n && o.push(n), o;
|
|
4840
4847
|
}
|
|
4841
|
-
function
|
|
4848
|
+
function xe(e, t, i) {
|
|
4842
4849
|
if (e.type.name === "text" || e.type.name === "link")
|
|
4843
4850
|
throw new Error("unexpected");
|
|
4844
4851
|
const o = {}, n = t[e.type.name];
|
|
@@ -4859,7 +4866,7 @@ function it(e, t, i) {
|
|
|
4859
4866
|
content: r
|
|
4860
4867
|
};
|
|
4861
4868
|
}
|
|
4862
|
-
function
|
|
4869
|
+
function C(e, t, i, o, n) {
|
|
4863
4870
|
if (e.type.name !== "blockContainer")
|
|
4864
4871
|
throw Error(
|
|
4865
4872
|
"Node must be of type blockContainer, but is of type" + e.type.name + "."
|
|
@@ -4867,26 +4874,26 @@ function x(e, t, i, o, n) {
|
|
|
4867
4874
|
const r = n == null ? void 0 : n.get(e);
|
|
4868
4875
|
if (r)
|
|
4869
4876
|
return r;
|
|
4870
|
-
const a =
|
|
4877
|
+
const a = et(e);
|
|
4871
4878
|
let s = a.id;
|
|
4872
|
-
s === null && (s =
|
|
4879
|
+
s === null && (s = oe.options.generateID());
|
|
4873
4880
|
const l = {};
|
|
4874
|
-
for (const [m,
|
|
4881
|
+
for (const [m, f] of Object.entries({
|
|
4875
4882
|
...e.attrs,
|
|
4876
4883
|
...a.contentNode.attrs
|
|
4877
4884
|
})) {
|
|
4878
|
-
const
|
|
4879
|
-
if (!
|
|
4885
|
+
const g = t[a.contentType.name];
|
|
4886
|
+
if (!g)
|
|
4880
4887
|
throw Error(
|
|
4881
4888
|
"Block is of an unrecognized type: " + a.contentType.name
|
|
4882
4889
|
);
|
|
4883
|
-
const
|
|
4884
|
-
m in
|
|
4890
|
+
const k = g.propSchema;
|
|
4891
|
+
m in k && (l[m] = f);
|
|
4885
4892
|
}
|
|
4886
4893
|
const d = t[a.contentType.name], u = [];
|
|
4887
4894
|
for (let m = 0; m < a.numChildBlocks; m++)
|
|
4888
4895
|
u.push(
|
|
4889
|
-
|
|
4896
|
+
C(
|
|
4890
4897
|
e.lastChild.child(m),
|
|
4891
4898
|
t,
|
|
4892
4899
|
i,
|
|
@@ -4902,7 +4909,7 @@ function x(e, t, i, o, n) {
|
|
|
4902
4909
|
o
|
|
4903
4910
|
);
|
|
4904
4911
|
else if (d.content === "table")
|
|
4905
|
-
p =
|
|
4912
|
+
p = Bi(
|
|
4906
4913
|
a.contentNode,
|
|
4907
4914
|
i,
|
|
4908
4915
|
o
|
|
@@ -4910,7 +4917,7 @@ function x(e, t, i, o, n) {
|
|
|
4910
4917
|
else if (d.content === "none")
|
|
4911
4918
|
p = void 0;
|
|
4912
4919
|
else
|
|
4913
|
-
throw new
|
|
4920
|
+
throw new P(d.content);
|
|
4914
4921
|
const h = {
|
|
4915
4922
|
id: s,
|
|
4916
4923
|
type: d.type,
|
|
@@ -4920,14 +4927,14 @@ function x(e, t, i, o, n) {
|
|
|
4920
4927
|
};
|
|
4921
4928
|
return n == null || n.set(e, h), h;
|
|
4922
4929
|
}
|
|
4923
|
-
function
|
|
4930
|
+
function Li(e) {
|
|
4924
4931
|
return e.document || window.document;
|
|
4925
4932
|
}
|
|
4926
|
-
const
|
|
4933
|
+
const nt = (e, t, i, o, n) => {
|
|
4927
4934
|
if (!i.nodes[e.type.name])
|
|
4928
4935
|
throw new Error("Serializer is missing a node type: " + e.type.name);
|
|
4929
4936
|
const { dom: r, contentDOM: a } = Ee.renderSpec(
|
|
4930
|
-
|
|
4937
|
+
Li(t),
|
|
4931
4938
|
i.nodes[e.type.name](e)
|
|
4932
4939
|
);
|
|
4933
4940
|
if (a) {
|
|
@@ -4937,7 +4944,7 @@ const ot = (e, t, i, o, n) => {
|
|
|
4937
4944
|
const s = e.childCount > 0 && e.firstChild.type.spec.group === "blockContent" ? e.firstChild : void 0, l = e.childCount > 0 && e.lastChild.type.spec.group === "blockGroup" ? e.lastChild : void 0;
|
|
4938
4945
|
if (s !== void 0) {
|
|
4939
4946
|
const d = o.blockImplementations[s.type.name].implementation, p = (n ? d.toExternalHTML : d.toInternalHTML)(
|
|
4940
|
-
|
|
4947
|
+
C(
|
|
4941
4948
|
e,
|
|
4942
4949
|
o.schema.blockSchema,
|
|
4943
4950
|
o.schema.inlineContentSchema,
|
|
@@ -4958,7 +4965,7 @@ const ot = (e, t, i, o, n) => {
|
|
|
4958
4965
|
a.appendChild(p.dom);
|
|
4959
4966
|
}
|
|
4960
4967
|
l !== void 0 && i.serializeFragment(
|
|
4961
|
-
|
|
4968
|
+
N.from(l),
|
|
4962
4969
|
t,
|
|
4963
4970
|
a
|
|
4964
4971
|
);
|
|
@@ -4966,12 +4973,23 @@ const ot = (e, t, i, o, n) => {
|
|
|
4966
4973
|
i.serializeFragment(e.content, t, a);
|
|
4967
4974
|
}
|
|
4968
4975
|
return r;
|
|
4969
|
-
},
|
|
4976
|
+
}, rt = (e, t, i) => {
|
|
4970
4977
|
const o = t.serializeFragment(e, i), n = document.createElement("div");
|
|
4971
4978
|
return n.appendChild(o), n.innerHTML;
|
|
4972
4979
|
};
|
|
4973
|
-
function
|
|
4974
|
-
|
|
4980
|
+
function Re(e, t) {
|
|
4981
|
+
var o;
|
|
4982
|
+
const i = (((o = e.properties) == null ? void 0 : o.className) || []).filter(
|
|
4983
|
+
(n) => !n.startsWith("bn-")
|
|
4984
|
+
) || [];
|
|
4985
|
+
e.properties = {
|
|
4986
|
+
...e.properties,
|
|
4987
|
+
...t,
|
|
4988
|
+
className: i.length > 0 ? i : void 0
|
|
4989
|
+
};
|
|
4990
|
+
}
|
|
4991
|
+
function Ii(e) {
|
|
4992
|
+
const t = H;
|
|
4975
4993
|
if (!t)
|
|
4976
4994
|
throw new Error(
|
|
4977
4995
|
"simplifyBlocks requires ESM dependencies to be initialized"
|
|
@@ -4987,45 +5005,60 @@ function Ti(e) {
|
|
|
4987
5005
|
}
|
|
4988
5006
|
let r = n.children.length, a;
|
|
4989
5007
|
for (let l = 0; l < r; l++) {
|
|
4990
|
-
const u = n.children[l].children[0], p = u.children.find((
|
|
4991
|
-
const
|
|
4992
|
-
return
|
|
4993
|
-
}), h = u.children.find((
|
|
4994
|
-
const
|
|
4995
|
-
return
|
|
4996
|
-
})
|
|
5008
|
+
const u = n.children[l].children[0], p = u.children.find((b) => {
|
|
5009
|
+
const y = b.properties, S = y == null ? void 0 : y.className;
|
|
5010
|
+
return S == null ? void 0 : S.includes("bn-block-content");
|
|
5011
|
+
}), h = u.children.find((b) => {
|
|
5012
|
+
const y = b.properties, S = y == null ? void 0 : y.className;
|
|
5013
|
+
return S == null ? void 0 : S.includes("bn-block-group");
|
|
5014
|
+
}), m = Object.fromEntries(
|
|
5015
|
+
Object.entries(u.properties || {}).filter(
|
|
5016
|
+
([b]) => b.startsWith("data") && b !== "dataId" && b !== "dataNodeType"
|
|
5017
|
+
)
|
|
5018
|
+
), f = Object.fromEntries(
|
|
5019
|
+
Object.entries((p == null ? void 0 : p.properties) || {}).filter(
|
|
5020
|
+
([b]) => b.startsWith("data") && b !== "dataContentType" && b !== "dataFileBlock" && b !== "dataNodeViewWrapper" && b !== "dataEditable"
|
|
5021
|
+
)
|
|
5022
|
+
), g = {
|
|
5023
|
+
...m,
|
|
5024
|
+
...f
|
|
5025
|
+
};
|
|
4997
5026
|
if (!p) {
|
|
4998
5027
|
n.children.splice(l, 1, ...h.children), o(n);
|
|
4999
5028
|
return;
|
|
5000
5029
|
}
|
|
5001
|
-
const
|
|
5030
|
+
const k = i.has(
|
|
5002
5031
|
p.properties.dataContentType
|
|
5003
|
-
),
|
|
5032
|
+
), v = k ? e.orderedListItemBlockTypes.has(
|
|
5004
5033
|
p.properties.dataContentType
|
|
5005
5034
|
) ? "ol" : "ul" : null;
|
|
5006
|
-
if (h && o(h), a && a.tagName !==
|
|
5035
|
+
if (h && o(h), a && a.tagName !== v) {
|
|
5007
5036
|
n.children.splice(
|
|
5008
5037
|
l - a.children.length,
|
|
5009
5038
|
a.children.length,
|
|
5010
5039
|
a
|
|
5011
5040
|
);
|
|
5012
|
-
const
|
|
5013
|
-
l -=
|
|
5041
|
+
const b = a.children.length - 1;
|
|
5042
|
+
l -= b, r -= b, a = void 0;
|
|
5014
5043
|
}
|
|
5015
|
-
if (
|
|
5044
|
+
if (k) {
|
|
5016
5045
|
a || (a = t.hastUtilFromDom.fromDom(
|
|
5017
|
-
document.createElement(
|
|
5046
|
+
document.createElement(v)
|
|
5018
5047
|
));
|
|
5019
|
-
const
|
|
5048
|
+
const b = t.hastUtilFromDom.fromDom(
|
|
5020
5049
|
document.createElement("li")
|
|
5021
5050
|
);
|
|
5022
|
-
|
|
5051
|
+
b.children.push(...p.children), h && b.children.push(...h.children), a.children.push(b);
|
|
5023
5052
|
} else if (h) {
|
|
5024
|
-
n.children.splice(l + 1, 0, ...h.children)
|
|
5025
|
-
const
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5053
|
+
n.children.splice(l + 1, 0, ...h.children);
|
|
5054
|
+
const b = p.children[0];
|
|
5055
|
+
Re(b, g), n.children[l] = b;
|
|
5056
|
+
const y = h.children.length;
|
|
5057
|
+
l += y, r += y;
|
|
5058
|
+
} else {
|
|
5059
|
+
const b = p.children[0];
|
|
5060
|
+
Re(b, g), n.children[l] = b;
|
|
5061
|
+
}
|
|
5029
5062
|
}
|
|
5030
5063
|
a && n.children.splice(
|
|
5031
5064
|
r - a.children.length,
|
|
@@ -5036,62 +5069,62 @@ function Ti(e) {
|
|
|
5036
5069
|
return o;
|
|
5037
5070
|
}
|
|
5038
5071
|
const de = (e, t) => {
|
|
5039
|
-
const i =
|
|
5072
|
+
const i = H;
|
|
5040
5073
|
if (!i)
|
|
5041
5074
|
throw new Error(
|
|
5042
5075
|
"External HTML exporter requires ESM dependencies to be initialized"
|
|
5043
5076
|
);
|
|
5044
5077
|
const o = Ee.fromSchema(e);
|
|
5045
|
-
return o.serializeNodeInner = (n, r) =>
|
|
5078
|
+
return o.serializeNodeInner = (n, r) => nt(n, r, o, t, !0), o.exportProseMirrorFragment = (n, r) => i.unified.unified().use(i.rehypeParse.default, { fragment: !0 }).use(Ii, {
|
|
5046
5079
|
orderedListItemBlockTypes: /* @__PURE__ */ new Set(["numberedListItem"]),
|
|
5047
5080
|
unorderedListItemBlockTypes: /* @__PURE__ */ new Set([
|
|
5048
5081
|
"bulletListItem",
|
|
5049
5082
|
"checkListItem"
|
|
5050
5083
|
])
|
|
5051
|
-
}).use(i.rehypeStringify.default).processSync(
|
|
5084
|
+
}).use(i.rehypeStringify.default).processSync(rt(n, o, r)).value, o.exportBlocks = (n, r) => {
|
|
5052
5085
|
const a = n.map(
|
|
5053
|
-
(l) =>
|
|
5086
|
+
(l) => U(l, e, t.schema.styleSchema)
|
|
5054
5087
|
), s = e.nodes.blockGroup.create(null, a);
|
|
5055
5088
|
return o.exportProseMirrorFragment(
|
|
5056
|
-
|
|
5089
|
+
N.from(s),
|
|
5057
5090
|
r
|
|
5058
5091
|
);
|
|
5059
5092
|
}, o;
|
|
5060
5093
|
}, Me = (e, t) => {
|
|
5061
5094
|
const i = Ee.fromSchema(e);
|
|
5062
|
-
return i.serializeNodeInner = (o, n) =>
|
|
5095
|
+
return i.serializeNodeInner = (o, n) => nt(o, n, i, t, !1), i.serializeProseMirrorFragment = (o, n) => rt(o, i, n), i.serializeBlocks = (o, n) => {
|
|
5063
5096
|
const r = o.map(
|
|
5064
|
-
(s) =>
|
|
5097
|
+
(s) => U(s, e, t.schema.styleSchema)
|
|
5065
5098
|
), a = e.nodes.blockGroup.create(null, r);
|
|
5066
5099
|
return i.serializeProseMirrorFragment(
|
|
5067
|
-
|
|
5100
|
+
N.from(a),
|
|
5068
5101
|
n
|
|
5069
5102
|
);
|
|
5070
5103
|
}, i;
|
|
5071
|
-
},
|
|
5104
|
+
}, B = (e) => {
|
|
5072
5105
|
const { contentType: t } = _(
|
|
5073
5106
|
e.state.doc,
|
|
5074
5107
|
e.state.selection.from
|
|
5075
5108
|
);
|
|
5076
5109
|
return t.spec.content;
|
|
5077
|
-
},
|
|
5110
|
+
}, Ai = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
|
|
5078
5111
|
function D(e, t = "Ctrl") {
|
|
5079
|
-
return
|
|
5112
|
+
return Ai() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
|
|
5080
5113
|
}
|
|
5081
|
-
function
|
|
5114
|
+
function R(...e) {
|
|
5082
5115
|
return e.filter((t) => t).join(" ");
|
|
5083
5116
|
}
|
|
5084
|
-
const
|
|
5085
|
-
function
|
|
5117
|
+
const Br = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
5118
|
+
function O(e, t, i, o) {
|
|
5086
5119
|
const n = document.createElement("div");
|
|
5087
|
-
n.className =
|
|
5120
|
+
n.className = R(
|
|
5088
5121
|
"bn-block-content",
|
|
5089
5122
|
i.class
|
|
5090
5123
|
), n.setAttribute("data-content-type", e);
|
|
5091
5124
|
for (const [a, s] of Object.entries(i))
|
|
5092
5125
|
a !== "class" && n.setAttribute(a, s);
|
|
5093
5126
|
const r = document.createElement(t);
|
|
5094
|
-
r.className =
|
|
5127
|
+
r.className = R(
|
|
5095
5128
|
"bn-inline-content",
|
|
5096
5129
|
o.class
|
|
5097
5130
|
);
|
|
@@ -5104,8 +5137,8 @@ function R(e, t, i, o) {
|
|
|
5104
5137
|
contentDOM: r
|
|
5105
5138
|
};
|
|
5106
5139
|
}
|
|
5107
|
-
const
|
|
5108
|
-
const i =
|
|
5140
|
+
const Oe = (e, t) => {
|
|
5141
|
+
const i = U(e, t.pmSchema, t.schema.styleSchema).firstChild, o = t.pmSchema.nodes[i.type.name].spec.toDOM;
|
|
5109
5142
|
if (o === void 0)
|
|
5110
5143
|
throw new Error(
|
|
5111
5144
|
"This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`."
|
|
@@ -5116,7 +5149,7 @@ const Ve = (e, t) => {
|
|
|
5116
5149
|
"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."
|
|
5117
5150
|
);
|
|
5118
5151
|
return n;
|
|
5119
|
-
},
|
|
5152
|
+
}, w = {
|
|
5120
5153
|
backgroundColor: {
|
|
5121
5154
|
default: "default"
|
|
5122
5155
|
},
|
|
@@ -5127,18 +5160,18 @@ const Ve = (e, t) => {
|
|
|
5127
5160
|
default: "left",
|
|
5128
5161
|
values: ["left", "center", "right", "justify"]
|
|
5129
5162
|
}
|
|
5130
|
-
},
|
|
5131
|
-
function
|
|
5163
|
+
}, at = ["backgroundColor", "textColor"];
|
|
5164
|
+
function se(e) {
|
|
5132
5165
|
return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
5133
5166
|
}
|
|
5134
|
-
function
|
|
5167
|
+
function Lr(e) {
|
|
5135
5168
|
const t = e.split("/");
|
|
5136
5169
|
return !t.length || // invalid?
|
|
5137
5170
|
t[t.length - 1] === "" ? e : t[t.length - 1];
|
|
5138
5171
|
}
|
|
5139
|
-
function
|
|
5172
|
+
function st(e) {
|
|
5140
5173
|
const t = {};
|
|
5141
|
-
return Object.entries(e).filter(([i, o]) => !
|
|
5174
|
+
return Object.entries(e).filter(([i, o]) => !at.includes(i)).forEach(([i, o]) => {
|
|
5142
5175
|
t[i] = {
|
|
5143
5176
|
default: o.default,
|
|
5144
5177
|
keepOnSplit: !0,
|
|
@@ -5146,7 +5179,7 @@ function at(e) {
|
|
|
5146
5179
|
// value is the same as its default, we don't display an HTML
|
|
5147
5180
|
// attribute for it.
|
|
5148
5181
|
parseHTML: (n) => {
|
|
5149
|
-
const r = n.getAttribute(
|
|
5182
|
+
const r = n.getAttribute(se(i));
|
|
5150
5183
|
if (r === null)
|
|
5151
5184
|
return null;
|
|
5152
5185
|
if (typeof o.default == "boolean")
|
|
@@ -5158,12 +5191,12 @@ function at(e) {
|
|
|
5158
5191
|
return r;
|
|
5159
5192
|
},
|
|
5160
5193
|
renderHTML: (n) => n[i] !== o.default ? {
|
|
5161
|
-
[
|
|
5194
|
+
[se(i)]: n[i]
|
|
5162
5195
|
} : {}
|
|
5163
5196
|
};
|
|
5164
5197
|
}), t;
|
|
5165
5198
|
}
|
|
5166
|
-
function
|
|
5199
|
+
function Ni(e, t, i, o) {
|
|
5167
5200
|
if (typeof e == "boolean")
|
|
5168
5201
|
throw new Error(
|
|
5169
5202
|
"Cannot find node position as getPos is a boolean, not a function."
|
|
@@ -5176,18 +5209,18 @@ function Li(e, t, i, o) {
|
|
|
5176
5209
|
throw new Error("Block type does not match");
|
|
5177
5210
|
return s;
|
|
5178
5211
|
}
|
|
5179
|
-
function
|
|
5212
|
+
function ge(e, t, i, o, n = !1, r) {
|
|
5180
5213
|
const a = document.createElement("div");
|
|
5181
5214
|
if (r !== void 0)
|
|
5182
5215
|
for (const [s, l] of Object.entries(r))
|
|
5183
5216
|
s !== "class" && a.setAttribute(s, l);
|
|
5184
|
-
a.className =
|
|
5217
|
+
a.className = R(
|
|
5185
5218
|
"bn-block-content",
|
|
5186
5219
|
(r == null ? void 0 : r.class) || ""
|
|
5187
5220
|
), a.setAttribute("data-content-type", t);
|
|
5188
5221
|
for (const [s, l] of Object.entries(i))
|
|
5189
|
-
!
|
|
5190
|
-
return n && a.setAttribute("data-file-block", ""), a.appendChild(e.dom), e.contentDOM !== void 0 && (e.contentDOM.className =
|
|
5222
|
+
!at.includes(s) && l !== o[s].default && a.setAttribute(se(s), l);
|
|
5223
|
+
return n && a.setAttribute("data-file-block", ""), a.appendChild(e.dom), e.contentDOM !== void 0 && (e.contentDOM.className = R(
|
|
5191
5224
|
"bn-inline-content",
|
|
5192
5225
|
e.contentDOM.className
|
|
5193
5226
|
), e.contentDOM.setAttribute("data-editable", "")), {
|
|
@@ -5195,17 +5228,17 @@ function be(e, t, i, o, n = !1, r) {
|
|
|
5195
5228
|
dom: a
|
|
5196
5229
|
};
|
|
5197
5230
|
}
|
|
5198
|
-
function
|
|
5231
|
+
function F(e) {
|
|
5199
5232
|
return q.create(e);
|
|
5200
5233
|
}
|
|
5201
|
-
function
|
|
5234
|
+
function lt(e, t) {
|
|
5202
5235
|
return {
|
|
5203
5236
|
config: e,
|
|
5204
5237
|
implementation: t
|
|
5205
5238
|
};
|
|
5206
5239
|
}
|
|
5207
5240
|
function X(e, t, i) {
|
|
5208
|
-
return
|
|
5241
|
+
return lt(
|
|
5209
5242
|
{
|
|
5210
5243
|
type: e.name,
|
|
5211
5244
|
content: e.config.content === "inline*" ? "inline" : e.config.content === "tableRow+" ? "table" : "none",
|
|
@@ -5214,18 +5247,23 @@ function X(e, t, i) {
|
|
|
5214
5247
|
{
|
|
5215
5248
|
node: e,
|
|
5216
5249
|
requiredExtensions: i,
|
|
5217
|
-
toInternalHTML:
|
|
5218
|
-
toExternalHTML:
|
|
5250
|
+
toInternalHTML: Oe,
|
|
5251
|
+
toExternalHTML: Oe
|
|
5219
5252
|
// parse: () => undefined, // parse rules are in node already
|
|
5220
5253
|
}
|
|
5221
5254
|
);
|
|
5222
5255
|
}
|
|
5223
|
-
function
|
|
5256
|
+
function dt(e) {
|
|
5224
5257
|
return Object.fromEntries(
|
|
5225
5258
|
Object.entries(e).map(([t, i]) => [t, i.config])
|
|
5226
5259
|
);
|
|
5227
5260
|
}
|
|
5228
|
-
function
|
|
5261
|
+
function Pi(e, t) {
|
|
5262
|
+
e.stopEvent = (i) => i.type === "copy" || i.type === "cut" ? !0 : i.type === "mousedown" ? (setTimeout(() => {
|
|
5263
|
+
t.view.dom.blur();
|
|
5264
|
+
}, 10), !0) : !1;
|
|
5265
|
+
}
|
|
5266
|
+
function Hi(e, t) {
|
|
5229
5267
|
const i = [
|
|
5230
5268
|
{
|
|
5231
5269
|
tag: "[data-content-type=" + e.type + "]",
|
|
@@ -5243,16 +5281,16 @@ function Ii(e, t) {
|
|
|
5243
5281
|
}), i;
|
|
5244
5282
|
}
|
|
5245
5283
|
function ce(e, t) {
|
|
5246
|
-
const i =
|
|
5284
|
+
const i = F({
|
|
5247
5285
|
name: e.type,
|
|
5248
5286
|
content: e.content === "inline" ? "inline*" : "",
|
|
5249
5287
|
group: "blockContent",
|
|
5250
|
-
selectable: !0,
|
|
5288
|
+
selectable: e.isSelectable ?? !0,
|
|
5251
5289
|
addAttributes() {
|
|
5252
|
-
return
|
|
5290
|
+
return st(e.propSchema);
|
|
5253
5291
|
},
|
|
5254
5292
|
parseHTML() {
|
|
5255
|
-
return
|
|
5293
|
+
return Hi(e, t.parse);
|
|
5256
5294
|
},
|
|
5257
5295
|
renderHTML() {
|
|
5258
5296
|
const o = document.createElement("div");
|
|
@@ -5262,20 +5300,20 @@ function ce(e, t) {
|
|
|
5262
5300
|
},
|
|
5263
5301
|
addNodeView() {
|
|
5264
5302
|
return ({ getPos: o }) => {
|
|
5265
|
-
var
|
|
5266
|
-
const n = this.options.editor, r =
|
|
5303
|
+
var d;
|
|
5304
|
+
const n = this.options.editor, r = Ni(
|
|
5267
5305
|
o,
|
|
5268
5306
|
n,
|
|
5269
5307
|
this.editor,
|
|
5270
5308
|
e.type
|
|
5271
|
-
), a = ((
|
|
5272
|
-
return be(
|
|
5309
|
+
), a = ((d = this.options.domAttributes) == null ? void 0 : d.blockContent) || {}, s = t.render(r, n), l = ge(
|
|
5273
5310
|
s,
|
|
5274
5311
|
r.type,
|
|
5275
5312
|
r.props,
|
|
5276
5313
|
e.propSchema,
|
|
5277
5314
|
a
|
|
5278
5315
|
);
|
|
5316
|
+
return e.isSelectable === !1 && Pi(l, this.editor), l;
|
|
5279
5317
|
};
|
|
5280
5318
|
}
|
|
5281
5319
|
});
|
|
@@ -5283,12 +5321,12 @@ function ce(e, t) {
|
|
|
5283
5321
|
throw new Error(
|
|
5284
5322
|
"Node name does not match block type. This is a bug in BlockNote."
|
|
5285
5323
|
);
|
|
5286
|
-
return
|
|
5324
|
+
return lt(e, {
|
|
5287
5325
|
node: i,
|
|
5288
5326
|
toInternalHTML: (o, n) => {
|
|
5289
5327
|
var s;
|
|
5290
5328
|
const r = ((s = i.options.domAttributes) == null ? void 0 : s.blockContent) || {}, a = t.render(o, n);
|
|
5291
|
-
return
|
|
5329
|
+
return ge(
|
|
5292
5330
|
a,
|
|
5293
5331
|
o.type,
|
|
5294
5332
|
o.props,
|
|
@@ -5305,7 +5343,7 @@ function ce(e, t) {
|
|
|
5305
5343
|
o,
|
|
5306
5344
|
n
|
|
5307
5345
|
);
|
|
5308
|
-
return a === void 0 && (a = t.render(o, n)),
|
|
5346
|
+
return a === void 0 && (a = t.render(o, n)), ge(
|
|
5309
5347
|
a,
|
|
5310
5348
|
o.type,
|
|
5311
5349
|
o.props,
|
|
@@ -5315,10 +5353,10 @@ function ce(e, t) {
|
|
|
5315
5353
|
}
|
|
5316
5354
|
});
|
|
5317
5355
|
}
|
|
5318
|
-
function
|
|
5319
|
-
return e.dom.setAttribute("data-inline-content-type", t), Object.entries(i).filter(([n, r]) => r !== o[n].default).map(([n, r]) => [
|
|
5356
|
+
function Fe(e, t, i, o) {
|
|
5357
|
+
return e.dom.setAttribute("data-inline-content-type", t), Object.entries(i).filter(([n, r]) => r !== o[n].default).map(([n, r]) => [se(n), r]).forEach(([n, r]) => e.dom.setAttribute(n, r)), e.contentDOM !== void 0 && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
5320
5358
|
}
|
|
5321
|
-
function
|
|
5359
|
+
function Ui(e) {
|
|
5322
5360
|
return {
|
|
5323
5361
|
Backspace: ({ editor: t }) => {
|
|
5324
5362
|
const i = t.state.selection.$from;
|
|
@@ -5326,14 +5364,14 @@ function Ni(e) {
|
|
|
5326
5364
|
}
|
|
5327
5365
|
};
|
|
5328
5366
|
}
|
|
5329
|
-
function
|
|
5367
|
+
function Di(e, t) {
|
|
5330
5368
|
return {
|
|
5331
5369
|
config: e,
|
|
5332
5370
|
implementation: t
|
|
5333
5371
|
};
|
|
5334
5372
|
}
|
|
5335
|
-
function
|
|
5336
|
-
return
|
|
5373
|
+
function ji(e, t) {
|
|
5374
|
+
return Di(
|
|
5337
5375
|
{
|
|
5338
5376
|
type: e.name,
|
|
5339
5377
|
propSchema: t,
|
|
@@ -5344,12 +5382,12 @@ function Hi(e, t) {
|
|
|
5344
5382
|
}
|
|
5345
5383
|
);
|
|
5346
5384
|
}
|
|
5347
|
-
function
|
|
5385
|
+
function ct(e) {
|
|
5348
5386
|
return Object.fromEntries(
|
|
5349
5387
|
Object.entries(e).map(([t, i]) => [t, i.config])
|
|
5350
5388
|
);
|
|
5351
5389
|
}
|
|
5352
|
-
function
|
|
5390
|
+
function zi(e) {
|
|
5353
5391
|
return [
|
|
5354
5392
|
{
|
|
5355
5393
|
tag: `[data-inline-content-type="${e.type}"]`,
|
|
@@ -5360,7 +5398,7 @@ function Di(e) {
|
|
|
5360
5398
|
}
|
|
5361
5399
|
];
|
|
5362
5400
|
}
|
|
5363
|
-
function
|
|
5401
|
+
function Ir(e, t) {
|
|
5364
5402
|
const i = q.create({
|
|
5365
5403
|
name: e.type,
|
|
5366
5404
|
inline: !0,
|
|
@@ -5369,37 +5407,75 @@ function Mr(e, t) {
|
|
|
5369
5407
|
atom: e.content === "none",
|
|
5370
5408
|
content: e.content === "styled" ? "inline*" : "",
|
|
5371
5409
|
addAttributes() {
|
|
5372
|
-
return
|
|
5410
|
+
return st(e.propSchema);
|
|
5373
5411
|
},
|
|
5374
5412
|
addKeyboardShortcuts() {
|
|
5375
|
-
return
|
|
5413
|
+
return Ui(e);
|
|
5376
5414
|
},
|
|
5377
5415
|
parseHTML() {
|
|
5378
|
-
return
|
|
5416
|
+
return zi(e);
|
|
5379
5417
|
},
|
|
5380
5418
|
renderHTML({ node: o }) {
|
|
5381
5419
|
const n = this.options.editor, r = t.render(
|
|
5382
|
-
|
|
5420
|
+
xe(
|
|
5383
5421
|
o,
|
|
5384
5422
|
n.schema.inlineContentSchema,
|
|
5385
5423
|
n.schema.styleSchema
|
|
5386
|
-
)
|
|
5424
|
+
),
|
|
5387
5425
|
// TODO: fix cast
|
|
5426
|
+
() => {
|
|
5427
|
+
},
|
|
5428
|
+
n
|
|
5388
5429
|
);
|
|
5389
|
-
return
|
|
5430
|
+
return Fe(
|
|
5390
5431
|
r,
|
|
5391
5432
|
e.type,
|
|
5392
5433
|
o.attrs,
|
|
5393
5434
|
e.propSchema
|
|
5394
5435
|
);
|
|
5436
|
+
},
|
|
5437
|
+
addNodeView() {
|
|
5438
|
+
return ({ node: o, getPos: n }) => {
|
|
5439
|
+
const r = this.options.editor, a = t.render(
|
|
5440
|
+
xe(
|
|
5441
|
+
o,
|
|
5442
|
+
r.schema.inlineContentSchema,
|
|
5443
|
+
r.schema.styleSchema
|
|
5444
|
+
),
|
|
5445
|
+
// TODO: fix cast
|
|
5446
|
+
(s) => {
|
|
5447
|
+
if (typeof n == "boolean")
|
|
5448
|
+
return;
|
|
5449
|
+
const l = V(
|
|
5450
|
+
[s],
|
|
5451
|
+
r._tiptapEditor.schema,
|
|
5452
|
+
r.schema.styleSchema
|
|
5453
|
+
);
|
|
5454
|
+
r._tiptapEditor.view.dispatch(
|
|
5455
|
+
r._tiptapEditor.view.state.tr.replaceWith(
|
|
5456
|
+
n(),
|
|
5457
|
+
n() + o.nodeSize,
|
|
5458
|
+
l
|
|
5459
|
+
)
|
|
5460
|
+
);
|
|
5461
|
+
},
|
|
5462
|
+
r
|
|
5463
|
+
);
|
|
5464
|
+
return Fe(
|
|
5465
|
+
a,
|
|
5466
|
+
e.type,
|
|
5467
|
+
o.attrs,
|
|
5468
|
+
e.propSchema
|
|
5469
|
+
);
|
|
5470
|
+
};
|
|
5395
5471
|
}
|
|
5396
5472
|
});
|
|
5397
|
-
return
|
|
5473
|
+
return ji(
|
|
5398
5474
|
i,
|
|
5399
5475
|
e.propSchema
|
|
5400
5476
|
);
|
|
5401
5477
|
}
|
|
5402
|
-
function
|
|
5478
|
+
function Vi(e) {
|
|
5403
5479
|
return e === "boolean" ? {} : {
|
|
5404
5480
|
stringValue: {
|
|
5405
5481
|
default: void 0,
|
|
@@ -5411,17 +5487,17 @@ function Ui(e) {
|
|
|
5411
5487
|
}
|
|
5412
5488
|
};
|
|
5413
5489
|
}
|
|
5414
|
-
function
|
|
5490
|
+
function Ri(e, t, i, o) {
|
|
5415
5491
|
return e.dom.setAttribute("data-style-type", t), o === "string" && e.dom.setAttribute("data-value", i), e.contentDOM !== void 0 && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
5416
5492
|
}
|
|
5417
|
-
function
|
|
5493
|
+
function ut(e, t) {
|
|
5418
5494
|
return {
|
|
5419
5495
|
config: e,
|
|
5420
5496
|
implementation: t
|
|
5421
5497
|
};
|
|
5422
5498
|
}
|
|
5423
|
-
function
|
|
5424
|
-
return
|
|
5499
|
+
function j(e, t) {
|
|
5500
|
+
return ut(
|
|
5425
5501
|
{
|
|
5426
5502
|
type: e.name,
|
|
5427
5503
|
propSchema: t
|
|
@@ -5431,12 +5507,12 @@ function U(e, t) {
|
|
|
5431
5507
|
}
|
|
5432
5508
|
);
|
|
5433
5509
|
}
|
|
5434
|
-
function
|
|
5510
|
+
function pt(e) {
|
|
5435
5511
|
return Object.fromEntries(
|
|
5436
5512
|
Object.entries(e).map(([t, i]) => [t, i.config])
|
|
5437
5513
|
);
|
|
5438
5514
|
}
|
|
5439
|
-
function
|
|
5515
|
+
function Oi(e) {
|
|
5440
5516
|
return [
|
|
5441
5517
|
{
|
|
5442
5518
|
tag: `[data-style-type="${e.type}"]`,
|
|
@@ -5447,14 +5523,14 @@ function zi(e) {
|
|
|
5447
5523
|
}
|
|
5448
5524
|
];
|
|
5449
5525
|
}
|
|
5450
|
-
function
|
|
5526
|
+
function Ar(e, t) {
|
|
5451
5527
|
const i = Ce.create({
|
|
5452
5528
|
name: e.type,
|
|
5453
5529
|
addAttributes() {
|
|
5454
|
-
return
|
|
5530
|
+
return Vi(e.propSchema);
|
|
5455
5531
|
},
|
|
5456
5532
|
parseHTML() {
|
|
5457
|
-
return
|
|
5533
|
+
return Oi(e);
|
|
5458
5534
|
},
|
|
5459
5535
|
renderHTML({ mark: o }) {
|
|
5460
5536
|
let n;
|
|
@@ -5463,8 +5539,8 @@ function Tr(e, t) {
|
|
|
5463
5539
|
else if (e.propSchema === "string")
|
|
5464
5540
|
n = t.render(o.attrs.stringValue);
|
|
5465
5541
|
else
|
|
5466
|
-
throw new
|
|
5467
|
-
return
|
|
5542
|
+
throw new P(e.propSchema);
|
|
5543
|
+
return Ri(
|
|
5468
5544
|
n,
|
|
5469
5545
|
e.type,
|
|
5470
5546
|
o.attrs.stringValue,
|
|
@@ -5472,11 +5548,45 @@ function Tr(e, t) {
|
|
|
5472
5548
|
);
|
|
5473
5549
|
}
|
|
5474
5550
|
});
|
|
5475
|
-
return
|
|
5551
|
+
return ut(e, {
|
|
5476
5552
|
mark: i
|
|
5477
5553
|
});
|
|
5478
5554
|
}
|
|
5479
|
-
const ue = (e) => {
|
|
5555
|
+
const ue = (e, t, i, o, n) => {
|
|
5556
|
+
const r = document.createElement("div");
|
|
5557
|
+
if (r.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
5558
|
+
const a = Fi(
|
|
5559
|
+
e,
|
|
5560
|
+
t,
|
|
5561
|
+
o,
|
|
5562
|
+
n
|
|
5563
|
+
);
|
|
5564
|
+
r.appendChild(a.dom);
|
|
5565
|
+
const s = document.createElement("div");
|
|
5566
|
+
s.className = "bn-file-loading-preview", s.textContent = "Loading...";
|
|
5567
|
+
const l = t.onUploadStart((u) => {
|
|
5568
|
+
u === e.id && (r.removeChild(a.dom), r.appendChild(s));
|
|
5569
|
+
}), d = t.onUploadEnd((u) => {
|
|
5570
|
+
u === e.id && (r.removeChild(s), r.appendChild(a.dom));
|
|
5571
|
+
});
|
|
5572
|
+
return {
|
|
5573
|
+
dom: r,
|
|
5574
|
+
destroy: () => {
|
|
5575
|
+
var u;
|
|
5576
|
+
(u = a.destroy) == null || u.call(a), l(), d();
|
|
5577
|
+
}
|
|
5578
|
+
};
|
|
5579
|
+
} else if (e.props.showPreview === !1) {
|
|
5580
|
+
const a = ht(e).dom;
|
|
5581
|
+
return {
|
|
5582
|
+
dom: ne(e, a).dom
|
|
5583
|
+
};
|
|
5584
|
+
} else
|
|
5585
|
+
return r.appendChild(i.dom), {
|
|
5586
|
+
dom: r,
|
|
5587
|
+
destroy: i.destroy
|
|
5588
|
+
};
|
|
5589
|
+
}, ht = (e) => {
|
|
5480
5590
|
const t = document.createElement("div");
|
|
5481
5591
|
t.className = "bn-file-default-preview";
|
|
5482
5592
|
const i = document.createElement("div");
|
|
@@ -5485,14 +5595,14 @@ const ue = (e) => {
|
|
|
5485
5595
|
return o.className = "bn-file-default-preview-name", o.textContent = e.props.name || "", t.appendChild(i), t.appendChild(o), {
|
|
5486
5596
|
dom: t
|
|
5487
5597
|
};
|
|
5488
|
-
},
|
|
5598
|
+
}, ne = (e, t) => {
|
|
5489
5599
|
const i = document.createElement("div");
|
|
5490
5600
|
i.className = "bn-file-and-caption-wrapper";
|
|
5491
5601
|
const o = document.createElement("p");
|
|
5492
5602
|
return o.className = "bn-file-caption", o.textContent = e.props.caption, i.appendChild(t), i.appendChild(o), {
|
|
5493
5603
|
dom: i
|
|
5494
5604
|
};
|
|
5495
|
-
},
|
|
5605
|
+
}, Fi = (e, t, i, o) => {
|
|
5496
5606
|
const n = document.createElement("div");
|
|
5497
5607
|
n.className = "bn-add-file-button";
|
|
5498
5608
|
const r = document.createElement("div");
|
|
@@ -5526,7 +5636,7 @@ const ue = (e) => {
|
|
|
5526
5636
|
);
|
|
5527
5637
|
}
|
|
5528
5638
|
};
|
|
5529
|
-
},
|
|
5639
|
+
}, Ge = (e) => ({ url: e.src || void 0 }), pe = (e, t) => {
|
|
5530
5640
|
const i = e.querySelector(
|
|
5531
5641
|
t
|
|
5532
5642
|
);
|
|
@@ -5534,7 +5644,7 @@ const ue = (e) => {
|
|
|
5534
5644
|
return;
|
|
5535
5645
|
const o = e.querySelector("figcaption"), n = (o == null ? void 0 : o.textContent) ?? void 0;
|
|
5536
5646
|
return { targetElement: i, caption: n };
|
|
5537
|
-
},
|
|
5647
|
+
}, he = (e, t) => {
|
|
5538
5648
|
const i = document.createElement("div"), o = document.createElement("p");
|
|
5539
5649
|
return o.textContent = t, i.appendChild(e), i.appendChild(o), {
|
|
5540
5650
|
dom: i
|
|
@@ -5542,7 +5652,7 @@ const ue = (e) => {
|
|
|
5542
5652
|
}, Te = (e, t) => {
|
|
5543
5653
|
const i = document.createElement("figure"), o = document.createElement("figcaption");
|
|
5544
5654
|
return o.textContent = t, i.appendChild(e), i.appendChild(o), { dom: i };
|
|
5545
|
-
},
|
|
5655
|
+
}, mt = (e, t, i, o, n) => {
|
|
5546
5656
|
if (!e.props.previewWidth)
|
|
5547
5657
|
throw new Error("Block must have a `previewWidth` prop.");
|
|
5548
5658
|
const r = document.createElement("div");
|
|
@@ -5552,36 +5662,36 @@ const ue = (e) => {
|
|
|
5552
5662
|
const s = document.createElement("div");
|
|
5553
5663
|
s.className = "bn-visual-media-resize-handle", s.style.right = "4px";
|
|
5554
5664
|
let l;
|
|
5555
|
-
const d = (
|
|
5665
|
+
const d = (g) => {
|
|
5556
5666
|
if (!l) {
|
|
5557
5667
|
!t.isEditable && r.contains(a) && r.contains(s) && (r.removeChild(a), r.removeChild(s));
|
|
5558
5668
|
return;
|
|
5559
5669
|
}
|
|
5560
|
-
let
|
|
5561
|
-
e.props.textAlignment === "center" ? l.handleUsed === "left" ?
|
|
5562
|
-
const
|
|
5563
|
-
|
|
5564
|
-
}, u = (
|
|
5565
|
-
(!
|
|
5670
|
+
let k;
|
|
5671
|
+
e.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;
|
|
5672
|
+
const v = 64;
|
|
5673
|
+
k < v ? n(v) : k > t.domElement.firstElementChild.clientWidth ? n(t.domElement.firstElementChild.clientWidth) : n(k);
|
|
5674
|
+
}, u = (g) => {
|
|
5675
|
+
(!g.target || !r.contains(g.target) || !t.isEditable) && r.contains(a) && r.contains(s) && (r.removeChild(a), r.removeChild(s)), l && (l = void 0, t.updateBlock(e, {
|
|
5566
5676
|
props: {
|
|
5567
5677
|
previewWidth: o()
|
|
5568
5678
|
}
|
|
5569
5679
|
}));
|
|
5570
5680
|
}, p = () => {
|
|
5571
5681
|
t.isEditable && (r.appendChild(a), r.appendChild(s));
|
|
5572
|
-
}, h = (
|
|
5573
|
-
|
|
5574
|
-
}, m = (
|
|
5575
|
-
|
|
5682
|
+
}, h = (g) => {
|
|
5683
|
+
g.relatedTarget === a || g.relatedTarget === s || l || t.isEditable && r.contains(a) && r.contains(s) && (r.removeChild(a), r.removeChild(s));
|
|
5684
|
+
}, m = (g) => {
|
|
5685
|
+
g.preventDefault(), r.appendChild(a), r.appendChild(s), l = {
|
|
5576
5686
|
handleUsed: "left",
|
|
5577
5687
|
initialWidth: e.props.previewWidth,
|
|
5578
|
-
initialClientX:
|
|
5688
|
+
initialClientX: g.clientX
|
|
5579
5689
|
};
|
|
5580
|
-
},
|
|
5581
|
-
|
|
5690
|
+
}, f = (g) => {
|
|
5691
|
+
g.preventDefault(), r.appendChild(a), r.appendChild(s), l = {
|
|
5582
5692
|
handleUsed: "right",
|
|
5583
5693
|
initialWidth: e.props.previewWidth,
|
|
5584
|
-
initialClientX:
|
|
5694
|
+
initialClientX: g.clientX
|
|
5585
5695
|
};
|
|
5586
5696
|
};
|
|
5587
5697
|
return r.appendChild(i), window.addEventListener("mousemove", d), window.addEventListener("mouseup", u), i.addEventListener("mouseenter", p), i.addEventListener("mouseleave", h), a.addEventListener(
|
|
@@ -5589,7 +5699,7 @@ const ue = (e) => {
|
|
|
5589
5699
|
m
|
|
5590
5700
|
), s.addEventListener(
|
|
5591
5701
|
"mousedown",
|
|
5592
|
-
|
|
5702
|
+
f
|
|
5593
5703
|
), {
|
|
5594
5704
|
dom: r,
|
|
5595
5705
|
destroy: () => {
|
|
@@ -5598,12 +5708,12 @@ const ue = (e) => {
|
|
|
5598
5708
|
m
|
|
5599
5709
|
), s.removeEventListener(
|
|
5600
5710
|
"mousedown",
|
|
5601
|
-
|
|
5711
|
+
f
|
|
5602
5712
|
);
|
|
5603
5713
|
}
|
|
5604
5714
|
};
|
|
5605
|
-
},
|
|
5606
|
-
backgroundColor:
|
|
5715
|
+
}, We = (e) => ({ url: e.src || void 0 }), Gi = {
|
|
5716
|
+
backgroundColor: w.backgroundColor,
|
|
5607
5717
|
// File name.
|
|
5608
5718
|
name: {
|
|
5609
5719
|
default: ""
|
|
@@ -5619,59 +5729,41 @@ const ue = (e) => {
|
|
|
5619
5729
|
showPreview: {
|
|
5620
5730
|
default: !0
|
|
5621
5731
|
}
|
|
5622
|
-
},
|
|
5732
|
+
}, Wi = {
|
|
5623
5733
|
type: "audio",
|
|
5624
|
-
propSchema:
|
|
5734
|
+
propSchema: Gi,
|
|
5625
5735
|
content: "none",
|
|
5626
5736
|
isFileBlock: !0,
|
|
5627
5737
|
fileBlockAccept: ["audio/*"]
|
|
5628
|
-
},
|
|
5738
|
+
}, Ki = (e, t) => {
|
|
5629
5739
|
const i = document.createElement("div");
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
}
|
|
5645
|
-
};
|
|
5646
|
-
} else if (e.props.showPreview) {
|
|
5647
|
-
const o = document.createElement("audio");
|
|
5648
|
-
o.className = "bn-audio", t.resolveFileUrl(e.props.url).then((r) => {
|
|
5649
|
-
o.src = r;
|
|
5650
|
-
}), o.controls = !0, o.contentEditable = "false", o.draggable = !1;
|
|
5651
|
-
const n = V(e, o);
|
|
5652
|
-
return i.appendChild(n.dom), {
|
|
5653
|
-
dom: i
|
|
5654
|
-
};
|
|
5655
|
-
} else {
|
|
5656
|
-
const o = ue(e).dom;
|
|
5657
|
-
return {
|
|
5658
|
-
dom: V(e, o).dom
|
|
5659
|
-
};
|
|
5660
|
-
}
|
|
5661
|
-
}, Fi = (e) => {
|
|
5740
|
+
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>';
|
|
5741
|
+
const o = document.createElement("audio");
|
|
5742
|
+
o.className = "bn-audio", t.resolveFileUrl(e.props.url).then((r) => {
|
|
5743
|
+
o.src = r;
|
|
5744
|
+
}), o.controls = !0, o.contentEditable = "false", o.draggable = !1;
|
|
5745
|
+
const n = ne(e, o);
|
|
5746
|
+
return ue(
|
|
5747
|
+
e,
|
|
5748
|
+
t,
|
|
5749
|
+
n,
|
|
5750
|
+
t.dictionary.file_blocks.audio.add_button_text,
|
|
5751
|
+
i.firstElementChild
|
|
5752
|
+
);
|
|
5753
|
+
}, $i = (e) => {
|
|
5662
5754
|
if (e.tagName === "AUDIO")
|
|
5663
|
-
return
|
|
5755
|
+
return We(e);
|
|
5664
5756
|
if (e.tagName === "FIGURE") {
|
|
5665
|
-
const t =
|
|
5757
|
+
const t = pe(e, "audio");
|
|
5666
5758
|
if (!t)
|
|
5667
5759
|
return;
|
|
5668
5760
|
const { targetElement: i, caption: o } = t;
|
|
5669
5761
|
return {
|
|
5670
|
-
...
|
|
5762
|
+
...We(i),
|
|
5671
5763
|
caption: o
|
|
5672
5764
|
};
|
|
5673
5765
|
}
|
|
5674
|
-
},
|
|
5766
|
+
}, qi = (e) => {
|
|
5675
5767
|
if (!e.props.url) {
|
|
5676
5768
|
const i = document.createElement("p");
|
|
5677
5769
|
return i.textContent = "Add audio", {
|
|
@@ -5679,15 +5771,15 @@ const ue = (e) => {
|
|
|
5679
5771
|
};
|
|
5680
5772
|
}
|
|
5681
5773
|
let t;
|
|
5682
|
-
return e.props.showPreview ? (t = document.createElement("audio"), t.src = e.props.url) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Te(t, e.props.caption) :
|
|
5774
|
+
return e.props.showPreview ? (t = document.createElement("audio"), t.src = e.props.url) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Te(t, e.props.caption) : he(t, e.props.caption) : {
|
|
5683
5775
|
dom: t
|
|
5684
5776
|
};
|
|
5685
|
-
},
|
|
5686
|
-
render:
|
|
5687
|
-
parse:
|
|
5688
|
-
toExternalHTML:
|
|
5689
|
-
}),
|
|
5690
|
-
backgroundColor:
|
|
5777
|
+
}, Xi = ce(Wi, {
|
|
5778
|
+
render: Ki,
|
|
5779
|
+
parse: $i,
|
|
5780
|
+
toExternalHTML: qi
|
|
5781
|
+
}), Zi = {
|
|
5782
|
+
backgroundColor: w.backgroundColor,
|
|
5691
5783
|
// File name.
|
|
5692
5784
|
name: {
|
|
5693
5785
|
default: ""
|
|
@@ -5700,39 +5792,28 @@ const ue = (e) => {
|
|
|
5700
5792
|
caption: {
|
|
5701
5793
|
default: ""
|
|
5702
5794
|
}
|
|
5703
|
-
},
|
|
5795
|
+
}, Ji = {
|
|
5704
5796
|
type: "file",
|
|
5705
|
-
propSchema:
|
|
5797
|
+
propSchema: Zi,
|
|
5706
5798
|
content: "none",
|
|
5707
5799
|
isFileBlock: !0
|
|
5708
|
-
},
|
|
5709
|
-
const i =
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
return i.appendChild(o.dom), {
|
|
5713
|
-
dom: i,
|
|
5714
|
-
destroy: o.destroy
|
|
5715
|
-
};
|
|
5716
|
-
} else {
|
|
5717
|
-
const o = ue(e).dom, n = V(e, o);
|
|
5718
|
-
return i.appendChild(n.dom), {
|
|
5719
|
-
dom: i
|
|
5720
|
-
};
|
|
5721
|
-
}
|
|
5722
|
-
}, Xi = (e) => {
|
|
5800
|
+
}, Yi = (e, t) => {
|
|
5801
|
+
const i = ht(e).dom, o = ne(e, i);
|
|
5802
|
+
return ue(e, t, o);
|
|
5803
|
+
}, Qi = (e) => {
|
|
5723
5804
|
if (e.tagName === "EMBED")
|
|
5724
|
-
return
|
|
5805
|
+
return Ge(e);
|
|
5725
5806
|
if (e.tagName === "FIGURE") {
|
|
5726
|
-
const t =
|
|
5807
|
+
const t = pe(e, "embed");
|
|
5727
5808
|
if (!t)
|
|
5728
5809
|
return;
|
|
5729
5810
|
const { targetElement: i, caption: o } = t;
|
|
5730
5811
|
return {
|
|
5731
|
-
...
|
|
5812
|
+
...Ge(i),
|
|
5732
5813
|
caption: o
|
|
5733
5814
|
};
|
|
5734
5815
|
}
|
|
5735
|
-
},
|
|
5816
|
+
}, eo = (e) => {
|
|
5736
5817
|
if (!e.props.url) {
|
|
5737
5818
|
const i = document.createElement("p");
|
|
5738
5819
|
return i.textContent = "Add file", {
|
|
@@ -5740,14 +5821,14 @@ const ue = (e) => {
|
|
|
5740
5821
|
};
|
|
5741
5822
|
}
|
|
5742
5823
|
const t = document.createElement("a");
|
|
5743
|
-
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ?
|
|
5824
|
+
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ? he(t, e.props.caption) : {
|
|
5744
5825
|
dom: t
|
|
5745
5826
|
};
|
|
5746
|
-
},
|
|
5747
|
-
render:
|
|
5748
|
-
parse:
|
|
5749
|
-
toExternalHTML:
|
|
5750
|
-
}),
|
|
5827
|
+
}, to = ce(Ji, {
|
|
5828
|
+
render: Yi,
|
|
5829
|
+
parse: Qi,
|
|
5830
|
+
toExternalHTML: eo
|
|
5831
|
+
}), Nr = async (e) => {
|
|
5751
5832
|
const t = new FormData();
|
|
5752
5833
|
return t.append("file", e), (await (await fetch("https://tmpfiles.org/api/v1/upload", {
|
|
5753
5834
|
method: "POST",
|
|
@@ -5756,12 +5837,12 @@ const ue = (e) => {
|
|
|
5756
5837
|
"tmpfiles.org/",
|
|
5757
5838
|
"tmpfiles.org/dl/"
|
|
5758
5839
|
);
|
|
5759
|
-
},
|
|
5840
|
+
}, Ke = (e) => {
|
|
5760
5841
|
const t = e.src || void 0, i = e.width || void 0;
|
|
5761
5842
|
return { url: t, previewWidth: i };
|
|
5762
|
-
},
|
|
5763
|
-
textAlignment:
|
|
5764
|
-
backgroundColor:
|
|
5843
|
+
}, io = {
|
|
5844
|
+
textAlignment: w.textAlignment,
|
|
5845
|
+
backgroundColor: w.backgroundColor,
|
|
5765
5846
|
// File name.
|
|
5766
5847
|
name: {
|
|
5767
5848
|
default: ""
|
|
@@ -5781,69 +5862,50 @@ const ue = (e) => {
|
|
|
5781
5862
|
previewWidth: {
|
|
5782
5863
|
default: 512
|
|
5783
5864
|
}
|
|
5784
|
-
},
|
|
5865
|
+
}, oo = {
|
|
5785
5866
|
type: "image",
|
|
5786
|
-
propSchema:
|
|
5867
|
+
propSchema: io,
|
|
5787
5868
|
content: "none",
|
|
5788
5869
|
isFileBlock: !0,
|
|
5789
5870
|
fileBlockAccept: ["image/*"]
|
|
5790
|
-
},
|
|
5871
|
+
}, no = (e, t) => {
|
|
5791
5872
|
const i = document.createElement("div");
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
);
|
|
5816
|
-
const n = pt(
|
|
5817
|
-
e,
|
|
5818
|
-
t,
|
|
5819
|
-
o,
|
|
5820
|
-
() => o.width,
|
|
5821
|
-
(a) => o.width = a
|
|
5822
|
-
), r = V(e, n.dom);
|
|
5823
|
-
return i.appendChild(r.dom), {
|
|
5824
|
-
dom: i,
|
|
5825
|
-
destroy: n.destroy
|
|
5826
|
-
};
|
|
5827
|
-
} else {
|
|
5828
|
-
const o = ue(e).dom;
|
|
5829
|
-
return {
|
|
5830
|
-
dom: V(e, o).dom
|
|
5831
|
-
};
|
|
5832
|
-
}
|
|
5833
|
-
}, to = (e) => {
|
|
5873
|
+
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>';
|
|
5874
|
+
const o = document.createElement("img");
|
|
5875
|
+
o.className = "bn-visual-media", t.resolveFileUrl(e.props.url).then((a) => {
|
|
5876
|
+
o.src = a;
|
|
5877
|
+
}), o.alt = e.props.name || e.props.caption || "BlockNote image", o.contentEditable = "false", o.draggable = !1, o.width = Math.min(
|
|
5878
|
+
e.props.previewWidth,
|
|
5879
|
+
t.domElement.firstElementChild.clientWidth
|
|
5880
|
+
);
|
|
5881
|
+
const n = mt(
|
|
5882
|
+
e,
|
|
5883
|
+
t,
|
|
5884
|
+
o,
|
|
5885
|
+
() => o.width,
|
|
5886
|
+
(a) => o.width = a
|
|
5887
|
+
), r = ne(e, n.dom);
|
|
5888
|
+
return ue(
|
|
5889
|
+
e,
|
|
5890
|
+
t,
|
|
5891
|
+
r,
|
|
5892
|
+
t.dictionary.file_blocks.image.add_button_text,
|
|
5893
|
+
i.firstElementChild
|
|
5894
|
+
);
|
|
5895
|
+
}, ro = (e) => {
|
|
5834
5896
|
if (e.tagName === "IMG")
|
|
5835
|
-
return
|
|
5897
|
+
return Ke(e);
|
|
5836
5898
|
if (e.tagName === "FIGURE") {
|
|
5837
|
-
const t =
|
|
5899
|
+
const t = pe(e, "img");
|
|
5838
5900
|
if (!t)
|
|
5839
5901
|
return;
|
|
5840
5902
|
const { targetElement: i, caption: o } = t;
|
|
5841
5903
|
return {
|
|
5842
|
-
...
|
|
5904
|
+
...Ke(i),
|
|
5843
5905
|
caption: o
|
|
5844
5906
|
};
|
|
5845
5907
|
}
|
|
5846
|
-
},
|
|
5908
|
+
}, ao = (e) => {
|
|
5847
5909
|
if (!e.props.url) {
|
|
5848
5910
|
const i = document.createElement("p");
|
|
5849
5911
|
return i.textContent = "Add image", {
|
|
@@ -5851,19 +5913,19 @@ const ue = (e) => {
|
|
|
5851
5913
|
};
|
|
5852
5914
|
}
|
|
5853
5915
|
let t;
|
|
5854
|
-
return e.props.showPreview ? (t = document.createElement("img"), t.src = e.props.url, t.alt = e.props.name || e.props.caption || "BlockNote image", t.width = e.props.previewWidth) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Te(t, e.props.caption) :
|
|
5916
|
+
return e.props.showPreview ? (t = document.createElement("img"), t.src = e.props.url, t.alt = e.props.name || e.props.caption || "BlockNote image", t.width = e.props.previewWidth) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Te(t, e.props.caption) : he(t, e.props.caption) : {
|
|
5855
5917
|
dom: t
|
|
5856
5918
|
};
|
|
5857
|
-
},
|
|
5858
|
-
render:
|
|
5859
|
-
parse:
|
|
5860
|
-
toExternalHTML:
|
|
5861
|
-
}),
|
|
5919
|
+
}, so = ce(oo, {
|
|
5920
|
+
render: no,
|
|
5921
|
+
parse: ro,
|
|
5922
|
+
toExternalHTML: ao
|
|
5923
|
+
}), $e = (e) => {
|
|
5862
5924
|
const t = e.src || void 0, i = e.width || void 0;
|
|
5863
5925
|
return { url: t, previewWidth: i };
|
|
5864
|
-
},
|
|
5865
|
-
textAlignment:
|
|
5866
|
-
backgroundColor:
|
|
5926
|
+
}, lo = {
|
|
5927
|
+
textAlignment: w.textAlignment,
|
|
5928
|
+
backgroundColor: w.backgroundColor,
|
|
5867
5929
|
// File name.
|
|
5868
5930
|
name: {
|
|
5869
5931
|
default: ""
|
|
@@ -5883,67 +5945,48 @@ const ue = (e) => {
|
|
|
5883
5945
|
previewWidth: {
|
|
5884
5946
|
default: 512
|
|
5885
5947
|
}
|
|
5886
|
-
},
|
|
5948
|
+
}, co = {
|
|
5887
5949
|
type: "video",
|
|
5888
|
-
propSchema:
|
|
5950
|
+
propSchema: lo,
|
|
5889
5951
|
content: "none",
|
|
5890
5952
|
isFileBlock: !0,
|
|
5891
5953
|
fileBlockAccept: ["video/*"]
|
|
5892
|
-
},
|
|
5954
|
+
}, uo = (e, t) => {
|
|
5893
5955
|
const i = document.createElement("div");
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
);
|
|
5916
|
-
const n = pt(
|
|
5917
|
-
e,
|
|
5918
|
-
t,
|
|
5919
|
-
o,
|
|
5920
|
-
() => o.width,
|
|
5921
|
-
(a) => o.width = a
|
|
5922
|
-
), r = V(e, n.dom);
|
|
5923
|
-
return i.appendChild(r.dom), {
|
|
5924
|
-
dom: i,
|
|
5925
|
-
destroy: n.destroy
|
|
5926
|
-
};
|
|
5927
|
-
} else {
|
|
5928
|
-
const o = ue(e).dom;
|
|
5929
|
-
return {
|
|
5930
|
-
dom: V(e, o).dom
|
|
5931
|
-
};
|
|
5932
|
-
}
|
|
5933
|
-
}, so = (e) => {
|
|
5956
|
+
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>';
|
|
5957
|
+
const o = document.createElement("video");
|
|
5958
|
+
o.className = "bn-visual-media", o.src = e.props.url, o.controls = !0, o.contentEditable = "false", o.draggable = !1, o.width = Math.min(
|
|
5959
|
+
e.props.previewWidth,
|
|
5960
|
+
t.domElement.firstElementChild.clientWidth
|
|
5961
|
+
);
|
|
5962
|
+
const n = mt(
|
|
5963
|
+
e,
|
|
5964
|
+
t,
|
|
5965
|
+
o,
|
|
5966
|
+
() => o.width,
|
|
5967
|
+
(a) => o.width = a
|
|
5968
|
+
), r = ne(e, n.dom);
|
|
5969
|
+
return ue(
|
|
5970
|
+
e,
|
|
5971
|
+
t,
|
|
5972
|
+
r,
|
|
5973
|
+
t.dictionary.file_blocks.video.add_button_text,
|
|
5974
|
+
i.firstElementChild
|
|
5975
|
+
);
|
|
5976
|
+
}, po = (e) => {
|
|
5934
5977
|
if (e.tagName === "VIDEO")
|
|
5935
|
-
return
|
|
5978
|
+
return $e(e);
|
|
5936
5979
|
if (e.tagName === "FIGURE") {
|
|
5937
|
-
const t =
|
|
5980
|
+
const t = pe(e, "video");
|
|
5938
5981
|
if (!t)
|
|
5939
5982
|
return;
|
|
5940
5983
|
const { targetElement: i, caption: o } = t;
|
|
5941
5984
|
return {
|
|
5942
|
-
|
|
5985
|
+
...$e(i),
|
|
5943
5986
|
caption: o
|
|
5944
5987
|
};
|
|
5945
5988
|
}
|
|
5946
|
-
},
|
|
5989
|
+
}, ho = (e) => {
|
|
5947
5990
|
if (!e.props.url) {
|
|
5948
5991
|
const i = document.createElement("p");
|
|
5949
5992
|
return i.textContent = "Add video", {
|
|
@@ -5951,14 +5994,14 @@ const ue = (e) => {
|
|
|
5951
5994
|
};
|
|
5952
5995
|
}
|
|
5953
5996
|
let t;
|
|
5954
|
-
return e.props.showPreview ? (t = document.createElement("video"), t.src = e.props.url, t.width = e.props.previewWidth) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Te(t, e.props.caption) :
|
|
5997
|
+
return e.props.showPreview ? (t = document.createElement("video"), t.src = e.props.url, t.width = e.props.previewWidth) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Te(t, e.props.caption) : he(t, e.props.caption) : {
|
|
5955
5998
|
dom: t
|
|
5956
5999
|
};
|
|
5957
|
-
},
|
|
5958
|
-
render:
|
|
5959
|
-
parse:
|
|
5960
|
-
toExternalHTML:
|
|
5961
|
-
}),
|
|
6000
|
+
}, mo = ce(co, {
|
|
6001
|
+
render: uo,
|
|
6002
|
+
parse: po,
|
|
6003
|
+
toExternalHTML: ho
|
|
6004
|
+
}), fo = Ce.create({
|
|
5962
6005
|
name: "backgroundColor",
|
|
5963
6006
|
addAttributes() {
|
|
5964
6007
|
return {
|
|
@@ -5984,10 +6027,10 @@ const ue = (e) => {
|
|
|
5984
6027
|
renderHTML({ HTMLAttributes: e }) {
|
|
5985
6028
|
return ["span", e, 0];
|
|
5986
6029
|
}
|
|
5987
|
-
}),
|
|
5988
|
-
|
|
6030
|
+
}), go = j(
|
|
6031
|
+
fo,
|
|
5989
6032
|
"string"
|
|
5990
|
-
),
|
|
6033
|
+
), bo = Ce.create({
|
|
5991
6034
|
name: "textColor",
|
|
5992
6035
|
addAttributes() {
|
|
5993
6036
|
return {
|
|
@@ -6011,10 +6054,10 @@ const ue = (e) => {
|
|
|
6011
6054
|
renderHTML({ HTMLAttributes: e }) {
|
|
6012
6055
|
return ["span", e, 0];
|
|
6013
6056
|
}
|
|
6014
|
-
}),
|
|
6015
|
-
...
|
|
6057
|
+
}), _o = j(bo, "string"), ko = {
|
|
6058
|
+
...w,
|
|
6016
6059
|
level: { default: 1, values: [1, 2, 3] }
|
|
6017
|
-
},
|
|
6060
|
+
}, yo = F({
|
|
6018
6061
|
name: "heading",
|
|
6019
6062
|
content: "inline*",
|
|
6020
6063
|
group: "blockContent",
|
|
@@ -6036,10 +6079,10 @@ const ue = (e) => {
|
|
|
6036
6079
|
},
|
|
6037
6080
|
addInputRules() {
|
|
6038
6081
|
return [
|
|
6039
|
-
...[1, 2, 3].map((e) => new
|
|
6082
|
+
...[1, 2, 3].map((e) => new ee({
|
|
6040
6083
|
find: new RegExp(`^(#{${e}})\\s$`),
|
|
6041
6084
|
handler: ({ state: t, chain: i, range: o }) => {
|
|
6042
|
-
|
|
6085
|
+
B(this.editor) === "inline*" && i().BNUpdateBlock(t.selection.from, {
|
|
6043
6086
|
type: "heading",
|
|
6044
6087
|
props: {
|
|
6045
6088
|
level: e
|
|
@@ -6051,7 +6094,7 @@ const ue = (e) => {
|
|
|
6051
6094
|
},
|
|
6052
6095
|
addKeyboardShortcuts() {
|
|
6053
6096
|
return {
|
|
6054
|
-
"Mod-Alt-1": () =>
|
|
6097
|
+
"Mod-Alt-1": () => B(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6055
6098
|
this.editor.state.selection.anchor,
|
|
6056
6099
|
{
|
|
6057
6100
|
type: "heading",
|
|
@@ -6060,7 +6103,7 @@ const ue = (e) => {
|
|
|
6060
6103
|
}
|
|
6061
6104
|
}
|
|
6062
6105
|
),
|
|
6063
|
-
"Mod-Alt-2": () =>
|
|
6106
|
+
"Mod-Alt-2": () => B(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6064
6107
|
this.editor.state.selection.anchor,
|
|
6065
6108
|
{
|
|
6066
6109
|
type: "heading",
|
|
@@ -6069,7 +6112,7 @@ const ue = (e) => {
|
|
|
6069
6112
|
}
|
|
6070
6113
|
}
|
|
6071
6114
|
),
|
|
6072
|
-
"Mod-Alt-3": () =>
|
|
6115
|
+
"Mod-Alt-3": () => B(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6073
6116
|
this.editor.state.selection.anchor,
|
|
6074
6117
|
{
|
|
6075
6118
|
type: "heading",
|
|
@@ -6107,7 +6150,7 @@ const ue = (e) => {
|
|
|
6107
6150
|
},
|
|
6108
6151
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
6109
6152
|
var i, o;
|
|
6110
|
-
return
|
|
6153
|
+
return O(
|
|
6111
6154
|
this.name,
|
|
6112
6155
|
`h${e.attrs.level}`,
|
|
6113
6156
|
{
|
|
@@ -6117,9 +6160,9 @@ const ue = (e) => {
|
|
|
6117
6160
|
((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
|
|
6118
6161
|
);
|
|
6119
6162
|
}
|
|
6120
|
-
}),
|
|
6121
|
-
|
|
6122
|
-
|
|
6163
|
+
}), wo = X(
|
|
6164
|
+
yo,
|
|
6165
|
+
ko
|
|
6123
6166
|
), Be = (e) => {
|
|
6124
6167
|
const { contentNode: t, contentType: i } = _(
|
|
6125
6168
|
e.state.doc,
|
|
@@ -6139,9 +6182,9 @@ const ue = (e) => {
|
|
|
6139
6182
|
a.command(() => t.childCount > 0 ? (r().deleteSelection().BNSplitBlock(n.selection.from, !0).run(), !0) : !1)
|
|
6140
6183
|
)
|
|
6141
6184
|
]);
|
|
6142
|
-
},
|
|
6143
|
-
...
|
|
6144
|
-
},
|
|
6185
|
+
}, vo = {
|
|
6186
|
+
...w
|
|
6187
|
+
}, xo = F({
|
|
6145
6188
|
name: "bulletListItem",
|
|
6146
6189
|
content: "inline*",
|
|
6147
6190
|
group: "blockContent",
|
|
@@ -6151,10 +6194,10 @@ const ue = (e) => {
|
|
|
6151
6194
|
addInputRules() {
|
|
6152
6195
|
return [
|
|
6153
6196
|
// Creates an unordered list when starting with "-", "+", or "*".
|
|
6154
|
-
new
|
|
6197
|
+
new ee({
|
|
6155
6198
|
find: new RegExp("^[-+*]\\s$"),
|
|
6156
6199
|
handler: ({ state: e, chain: t, range: i }) => {
|
|
6157
|
-
|
|
6200
|
+
B(this.editor) === "inline*" && t().BNUpdateBlock(e.selection.from, {
|
|
6158
6201
|
type: "bulletListItem",
|
|
6159
6202
|
props: {}
|
|
6160
6203
|
}).deleteRange({ from: i.from, to: i.to });
|
|
@@ -6165,7 +6208,7 @@ const ue = (e) => {
|
|
|
6165
6208
|
addKeyboardShortcuts() {
|
|
6166
6209
|
return {
|
|
6167
6210
|
Enter: () => Be(this.editor),
|
|
6168
|
-
"Mod-Shift-8": () =>
|
|
6211
|
+
"Mod-Shift-8": () => B(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6169
6212
|
this.editor.state.selection.anchor,
|
|
6170
6213
|
{
|
|
6171
6214
|
type: "bulletListItem",
|
|
@@ -6207,7 +6250,7 @@ const ue = (e) => {
|
|
|
6207
6250
|
},
|
|
6208
6251
|
renderHTML({ HTMLAttributes: e }) {
|
|
6209
6252
|
var t, i;
|
|
6210
|
-
return
|
|
6253
|
+
return O(
|
|
6211
6254
|
this.name,
|
|
6212
6255
|
// We use a <p> tag, because for <li> tags we'd need a <ul> element to put
|
|
6213
6256
|
// them in to be semantically correct, which we can't have due to the
|
|
@@ -6220,11 +6263,11 @@ const ue = (e) => {
|
|
|
6220
6263
|
((i = this.options.domAttributes) == null ? void 0 : i.inlineContent) || {}
|
|
6221
6264
|
);
|
|
6222
6265
|
}
|
|
6223
|
-
}),
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
),
|
|
6227
|
-
key:
|
|
6266
|
+
}), Eo = X(
|
|
6267
|
+
xo,
|
|
6268
|
+
vo
|
|
6269
|
+
), Co = new L("numbered-list-indexing"), So = () => new x({
|
|
6270
|
+
key: Co,
|
|
6228
6271
|
appendTransaction: (e, t, i) => {
|
|
6229
6272
|
const o = i.tr;
|
|
6230
6273
|
o.setMeta("numberedListIndexing", !0);
|
|
@@ -6240,10 +6283,10 @@ const ue = (e) => {
|
|
|
6240
6283
|
if (h === void 0)
|
|
6241
6284
|
return;
|
|
6242
6285
|
if (!(d.depth !== h.depth)) {
|
|
6243
|
-
const
|
|
6286
|
+
const f = h.contentNode;
|
|
6244
6287
|
if (h.contentType.name === "numberedListItem") {
|
|
6245
|
-
const
|
|
6246
|
-
s = (parseInt(
|
|
6288
|
+
const v = f.attrs.index;
|
|
6289
|
+
s = (parseInt(v) + 1).toString();
|
|
6247
6290
|
}
|
|
6248
6291
|
}
|
|
6249
6292
|
}
|
|
@@ -6253,9 +6296,9 @@ const ue = (e) => {
|
|
|
6253
6296
|
}
|
|
6254
6297
|
}), n ? o : null;
|
|
6255
6298
|
}
|
|
6256
|
-
}),
|
|
6257
|
-
...
|
|
6258
|
-
},
|
|
6299
|
+
}), Mo = {
|
|
6300
|
+
...w
|
|
6301
|
+
}, To = F({
|
|
6259
6302
|
name: "numberedListItem",
|
|
6260
6303
|
content: "inline*",
|
|
6261
6304
|
group: "blockContent",
|
|
@@ -6274,10 +6317,10 @@ const ue = (e) => {
|
|
|
6274
6317
|
addInputRules() {
|
|
6275
6318
|
return [
|
|
6276
6319
|
// Creates an ordered list when starting with "1.".
|
|
6277
|
-
new
|
|
6320
|
+
new ee({
|
|
6278
6321
|
find: new RegExp("^1\\.\\s$"),
|
|
6279
6322
|
handler: ({ state: e, chain: t, range: i }) => {
|
|
6280
|
-
|
|
6323
|
+
B(this.editor) === "inline*" && t().BNUpdateBlock(e.selection.from, {
|
|
6281
6324
|
type: "numberedListItem",
|
|
6282
6325
|
props: {}
|
|
6283
6326
|
}).deleteRange({ from: i.from, to: i.to });
|
|
@@ -6288,7 +6331,7 @@ const ue = (e) => {
|
|
|
6288
6331
|
addKeyboardShortcuts() {
|
|
6289
6332
|
return {
|
|
6290
6333
|
Enter: () => Be(this.editor),
|
|
6291
|
-
"Mod-Shift-7": () =>
|
|
6334
|
+
"Mod-Shift-7": () => B(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6292
6335
|
this.editor.state.selection.anchor,
|
|
6293
6336
|
{
|
|
6294
6337
|
type: "numberedListItem",
|
|
@@ -6298,7 +6341,7 @@ const ue = (e) => {
|
|
|
6298
6341
|
};
|
|
6299
6342
|
},
|
|
6300
6343
|
addProseMirrorPlugins() {
|
|
6301
|
-
return [
|
|
6344
|
+
return [So()];
|
|
6302
6345
|
},
|
|
6303
6346
|
parseHTML() {
|
|
6304
6347
|
return [
|
|
@@ -6335,7 +6378,7 @@ const ue = (e) => {
|
|
|
6335
6378
|
},
|
|
6336
6379
|
renderHTML({ HTMLAttributes: e }) {
|
|
6337
6380
|
var t, i;
|
|
6338
|
-
return
|
|
6381
|
+
return O(
|
|
6339
6382
|
this.name,
|
|
6340
6383
|
// We use a <p> tag, because for <li> tags we'd need an <ol> element to
|
|
6341
6384
|
// put them in to be semantically correct, which we can't have due to the
|
|
@@ -6348,15 +6391,15 @@ const ue = (e) => {
|
|
|
6348
6391
|
((i = this.options.domAttributes) == null ? void 0 : i.inlineContent) || {}
|
|
6349
6392
|
);
|
|
6350
6393
|
}
|
|
6351
|
-
}),
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
),
|
|
6355
|
-
...
|
|
6394
|
+
}), Bo = X(
|
|
6395
|
+
To,
|
|
6396
|
+
Mo
|
|
6397
|
+
), Lo = {
|
|
6398
|
+
...w,
|
|
6356
6399
|
checked: {
|
|
6357
6400
|
default: !1
|
|
6358
6401
|
}
|
|
6359
|
-
},
|
|
6402
|
+
}, Io = F({
|
|
6360
6403
|
name: "checkListItem",
|
|
6361
6404
|
content: "inline*",
|
|
6362
6405
|
group: "blockContent",
|
|
@@ -6375,10 +6418,10 @@ const ue = (e) => {
|
|
|
6375
6418
|
addInputRules() {
|
|
6376
6419
|
return [
|
|
6377
6420
|
// Creates a checklist when starting with "[]" or "[X]".
|
|
6378
|
-
new
|
|
6421
|
+
new ee({
|
|
6379
6422
|
find: new RegExp("\\[\\s*\\]\\s$"),
|
|
6380
6423
|
handler: ({ state: e, chain: t, range: i }) => {
|
|
6381
|
-
|
|
6424
|
+
B(this.editor) === "inline*" && t().BNUpdateBlock(e.selection.from, {
|
|
6382
6425
|
type: "checkListItem",
|
|
6383
6426
|
props: {
|
|
6384
6427
|
checked: !1
|
|
@@ -6386,10 +6429,10 @@ const ue = (e) => {
|
|
|
6386
6429
|
}).deleteRange({ from: i.from, to: i.to });
|
|
6387
6430
|
}
|
|
6388
6431
|
}),
|
|
6389
|
-
new
|
|
6432
|
+
new ee({
|
|
6390
6433
|
find: new RegExp("\\[[Xx]\\]\\s$"),
|
|
6391
6434
|
handler: ({ state: e, chain: t, range: i }) => {
|
|
6392
|
-
|
|
6435
|
+
B(this.editor) === "inline*" && t().BNUpdateBlock(e.selection.from, {
|
|
6393
6436
|
type: "checkListItem",
|
|
6394
6437
|
props: {
|
|
6395
6438
|
checked: !0
|
|
@@ -6402,7 +6445,7 @@ const ue = (e) => {
|
|
|
6402
6445
|
addKeyboardShortcuts() {
|
|
6403
6446
|
return {
|
|
6404
6447
|
Enter: () => Be(this.editor),
|
|
6405
|
-
"Mod-Shift-9": () =>
|
|
6448
|
+
"Mod-Shift-9": () => B(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6406
6449
|
this.editor.state.selection.anchor,
|
|
6407
6450
|
{
|
|
6408
6451
|
type: "checkListItem",
|
|
@@ -6453,7 +6496,7 @@ const ue = (e) => {
|
|
|
6453
6496
|
var r, a;
|
|
6454
6497
|
const i = document.createElement("input");
|
|
6455
6498
|
i.type = "checkbox", i.checked = e.attrs.checked, e.attrs.checked && i.setAttribute("checked", "");
|
|
6456
|
-
const { dom: o, contentDOM: n } =
|
|
6499
|
+
const { dom: o, contentDOM: n } = O(
|
|
6457
6500
|
this.name,
|
|
6458
6501
|
"p",
|
|
6459
6502
|
{
|
|
@@ -6486,7 +6529,7 @@ const ue = (e) => {
|
|
|
6486
6529
|
});
|
|
6487
6530
|
};
|
|
6488
6531
|
a.addEventListener("change", s);
|
|
6489
|
-
const { dom: l, contentDOM: d } =
|
|
6532
|
+
const { dom: l, contentDOM: d } = O(
|
|
6490
6533
|
this.name,
|
|
6491
6534
|
"p",
|
|
6492
6535
|
{
|
|
@@ -6508,18 +6551,18 @@ const ue = (e) => {
|
|
|
6508
6551
|
};
|
|
6509
6552
|
};
|
|
6510
6553
|
}
|
|
6511
|
-
}),
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
),
|
|
6515
|
-
...
|
|
6516
|
-
},
|
|
6554
|
+
}), Ao = X(
|
|
6555
|
+
Io,
|
|
6556
|
+
Lo
|
|
6557
|
+
), No = {
|
|
6558
|
+
...w
|
|
6559
|
+
}, Po = F({
|
|
6517
6560
|
name: "paragraph",
|
|
6518
6561
|
content: "inline*",
|
|
6519
6562
|
group: "blockContent",
|
|
6520
6563
|
addKeyboardShortcuts() {
|
|
6521
6564
|
return {
|
|
6522
|
-
"Mod-Alt-0": () =>
|
|
6565
|
+
"Mod-Alt-0": () => B(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6523
6566
|
this.editor.state.selection.anchor,
|
|
6524
6567
|
{
|
|
6525
6568
|
type: "paragraph",
|
|
@@ -6544,7 +6587,7 @@ const ue = (e) => {
|
|
|
6544
6587
|
},
|
|
6545
6588
|
renderHTML({ HTMLAttributes: e }) {
|
|
6546
6589
|
var t, i;
|
|
6547
|
-
return
|
|
6590
|
+
return O(
|
|
6548
6591
|
this.name,
|
|
6549
6592
|
"p",
|
|
6550
6593
|
{
|
|
@@ -6554,16 +6597,16 @@ const ue = (e) => {
|
|
|
6554
6597
|
((i = this.options.domAttributes) == null ? void 0 : i.inlineContent) || {}
|
|
6555
6598
|
);
|
|
6556
6599
|
}
|
|
6557
|
-
}),
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
),
|
|
6600
|
+
}), Ho = X(
|
|
6601
|
+
Po,
|
|
6602
|
+
No
|
|
6603
|
+
), Uo = I.create({
|
|
6561
6604
|
name: "BlockNoteTableExtension",
|
|
6562
6605
|
addProseMirrorPlugins: () => [
|
|
6563
|
-
|
|
6606
|
+
ii({
|
|
6564
6607
|
cellMinWidth: 100
|
|
6565
6608
|
}),
|
|
6566
|
-
|
|
6609
|
+
oi()
|
|
6567
6610
|
],
|
|
6568
6611
|
addKeyboardShortcuts() {
|
|
6569
6612
|
return {
|
|
@@ -6584,14 +6627,14 @@ const ue = (e) => {
|
|
|
6584
6627
|
storage: e.storage
|
|
6585
6628
|
};
|
|
6586
6629
|
return {
|
|
6587
|
-
tableRole:
|
|
6588
|
-
|
|
6630
|
+
tableRole: Ut(
|
|
6631
|
+
Dt(e, "tableRole", t)
|
|
6589
6632
|
)
|
|
6590
6633
|
};
|
|
6591
6634
|
}
|
|
6592
|
-
}),
|
|
6593
|
-
...
|
|
6594
|
-
},
|
|
6635
|
+
}), Do = {
|
|
6636
|
+
...w
|
|
6637
|
+
}, jo = F({
|
|
6595
6638
|
name: "table",
|
|
6596
6639
|
content: "tableRow+",
|
|
6597
6640
|
group: "blockContent",
|
|
@@ -6602,7 +6645,7 @@ const ue = (e) => {
|
|
|
6602
6645
|
},
|
|
6603
6646
|
renderHTML({ HTMLAttributes: e }) {
|
|
6604
6647
|
var t, i;
|
|
6605
|
-
return
|
|
6648
|
+
return O(
|
|
6606
6649
|
this.name,
|
|
6607
6650
|
"table",
|
|
6608
6651
|
{
|
|
@@ -6612,7 +6655,7 @@ const ue = (e) => {
|
|
|
6612
6655
|
((i = this.options.domAttributes) == null ? void 0 : i.inlineContent) || {}
|
|
6613
6656
|
);
|
|
6614
6657
|
}
|
|
6615
|
-
}),
|
|
6658
|
+
}), zo = q.create({
|
|
6616
6659
|
name: "tableParagraph",
|
|
6617
6660
|
group: "tableContent",
|
|
6618
6661
|
content: "inline*",
|
|
@@ -6633,72 +6676,72 @@ const ue = (e) => {
|
|
|
6633
6676
|
renderHTML({ HTMLAttributes: e }) {
|
|
6634
6677
|
return [
|
|
6635
6678
|
"p",
|
|
6636
|
-
|
|
6679
|
+
jt(this.options.HTMLAttributes, e),
|
|
6637
6680
|
0
|
|
6638
6681
|
];
|
|
6639
6682
|
}
|
|
6640
|
-
}),
|
|
6641
|
-
|
|
6642
|
-
|
|
6683
|
+
}), Vo = X(
|
|
6684
|
+
jo,
|
|
6685
|
+
Do,
|
|
6643
6686
|
[
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6687
|
+
Uo,
|
|
6688
|
+
zo,
|
|
6689
|
+
ei.extend({
|
|
6647
6690
|
content: "tableContent"
|
|
6648
6691
|
}),
|
|
6649
|
-
|
|
6692
|
+
Qt.extend({
|
|
6650
6693
|
content: "tableContent"
|
|
6651
6694
|
}),
|
|
6652
|
-
|
|
6695
|
+
ti
|
|
6653
6696
|
]
|
|
6654
|
-
),
|
|
6655
|
-
paragraph:
|
|
6656
|
-
heading:
|
|
6657
|
-
bulletListItem:
|
|
6658
|
-
numberedListItem:
|
|
6659
|
-
checkListItem:
|
|
6660
|
-
table:
|
|
6661
|
-
file:
|
|
6662
|
-
image:
|
|
6663
|
-
video:
|
|
6664
|
-
audio:
|
|
6665
|
-
},
|
|
6666
|
-
bold:
|
|
6667
|
-
italic:
|
|
6668
|
-
underline:
|
|
6669
|
-
strike:
|
|
6670
|
-
code:
|
|
6671
|
-
textColor:
|
|
6672
|
-
backgroundColor:
|
|
6673
|
-
},
|
|
6697
|
+
), ft = {
|
|
6698
|
+
paragraph: Ho,
|
|
6699
|
+
heading: wo,
|
|
6700
|
+
bulletListItem: Eo,
|
|
6701
|
+
numberedListItem: Bo,
|
|
6702
|
+
checkListItem: Ao,
|
|
6703
|
+
table: Vo,
|
|
6704
|
+
file: to,
|
|
6705
|
+
image: so,
|
|
6706
|
+
video: mo,
|
|
6707
|
+
audio: Xi
|
|
6708
|
+
}, Ro = dt(ft), gt = {
|
|
6709
|
+
bold: j(qt, "boolean"),
|
|
6710
|
+
italic: j(Zt, "boolean"),
|
|
6711
|
+
underline: j(Yt, "boolean"),
|
|
6712
|
+
strike: j(Jt, "boolean"),
|
|
6713
|
+
code: j(Xt, "boolean"),
|
|
6714
|
+
textColor: _o,
|
|
6715
|
+
backgroundColor: go
|
|
6716
|
+
}, Pr = pt(gt), bt = {
|
|
6674
6717
|
text: { config: "text", implementation: {} },
|
|
6675
6718
|
link: { config: "link", implementation: {} }
|
|
6676
|
-
},
|
|
6677
|
-
|
|
6719
|
+
}, Oo = ct(
|
|
6720
|
+
bt
|
|
6678
6721
|
);
|
|
6679
|
-
function
|
|
6680
|
-
return e in t.schema.blockSchema && t.schema.blockSchema[e] ===
|
|
6722
|
+
function T(e, t) {
|
|
6723
|
+
return e in t.schema.blockSchema && t.schema.blockSchema[e] === Ro[e];
|
|
6681
6724
|
}
|
|
6682
|
-
function
|
|
6683
|
-
return e in t.schema.inlineContentSchema && t.schema.inlineContentSchema[e] ===
|
|
6725
|
+
function Fo(e, t) {
|
|
6726
|
+
return e in t.schema.inlineContentSchema && t.schema.inlineContentSchema[e] === Oo[e];
|
|
6684
6727
|
}
|
|
6685
|
-
function
|
|
6686
|
-
return t.type === e && t.type in i.schema.blockSchema &&
|
|
6728
|
+
function Go(e, t, i) {
|
|
6729
|
+
return t.type === e && t.type in i.schema.blockSchema && T(t.type, i);
|
|
6687
6730
|
}
|
|
6688
|
-
function
|
|
6731
|
+
function Hr(e, t) {
|
|
6689
6732
|
return e.type in t.schema.blockSchema && t.schema.blockSchema[e.type].isFileBlock || !1;
|
|
6690
6733
|
}
|
|
6691
|
-
function
|
|
6734
|
+
function Ur(e, t) {
|
|
6692
6735
|
return e.type in t.schema.blockSchema && t.schema.blockSchema[e.type].isFileBlock && "showPreview" in t.schema.blockSchema[e.type].propSchema || !1;
|
|
6693
6736
|
}
|
|
6694
|
-
function
|
|
6737
|
+
function Dr(e, t) {
|
|
6695
6738
|
return t.schema.blockSchema[e.type].isFileBlock && !e.props.url;
|
|
6696
6739
|
}
|
|
6697
|
-
function
|
|
6698
|
-
return t in i.schema.blockSchema && e in i.schema.blockSchema[t].propSchema && i.schema.blockSchema[t].propSchema[e] ===
|
|
6740
|
+
function Wo(e, t, i) {
|
|
6741
|
+
return t in i.schema.blockSchema && e in i.schema.blockSchema[t].propSchema && i.schema.blockSchema[t].propSchema[e] === w[e];
|
|
6699
6742
|
}
|
|
6700
|
-
function
|
|
6701
|
-
return
|
|
6743
|
+
function jr(e, t, i) {
|
|
6744
|
+
return Wo(e, t.type, i);
|
|
6702
6745
|
}
|
|
6703
6746
|
function Le(e, t) {
|
|
6704
6747
|
let i, o;
|
|
@@ -6709,11 +6752,11 @@ function Le(e, t) {
|
|
|
6709
6752
|
posBeforeNode: o
|
|
6710
6753
|
};
|
|
6711
6754
|
}
|
|
6712
|
-
function
|
|
6755
|
+
function Ko(e, t, i = "before", o) {
|
|
6713
6756
|
const n = typeof t == "string" ? t : t.id, r = [];
|
|
6714
6757
|
for (const d of e)
|
|
6715
6758
|
r.push(
|
|
6716
|
-
|
|
6759
|
+
U(d, o.pmSchema, o.schema.styleSchema)
|
|
6717
6760
|
);
|
|
6718
6761
|
const { node: a, posBeforeNode: s } = Le(
|
|
6719
6762
|
n,
|
|
@@ -6738,7 +6781,7 @@ function Oo(e, t, i = "before", o) {
|
|
|
6738
6781
|
const l = [];
|
|
6739
6782
|
for (const d of r)
|
|
6740
6783
|
l.push(
|
|
6741
|
-
|
|
6784
|
+
C(
|
|
6742
6785
|
d,
|
|
6743
6786
|
o.schema.blockSchema,
|
|
6744
6787
|
o.schema.inlineContentSchema,
|
|
@@ -6748,11 +6791,11 @@ function Oo(e, t, i = "before", o) {
|
|
|
6748
6791
|
);
|
|
6749
6792
|
return l;
|
|
6750
6793
|
}
|
|
6751
|
-
function
|
|
6794
|
+
function $o(e, t, i) {
|
|
6752
6795
|
const o = i._tiptapEditor, n = typeof e == "string" ? e : e.id, { posBeforeNode: r } = Le(n, o.state.doc);
|
|
6753
6796
|
o.commands.BNUpdateBlock(r + 1, t);
|
|
6754
6797
|
const a = o.state.doc.resolve(r + 1).node();
|
|
6755
|
-
return
|
|
6798
|
+
return C(
|
|
6756
6799
|
a,
|
|
6757
6800
|
i.schema.blockSchema,
|
|
6758
6801
|
i.schema.inlineContentSchema,
|
|
@@ -6760,7 +6803,7 @@ function Fo(e, t, i) {
|
|
|
6760
6803
|
i.blockCache
|
|
6761
6804
|
);
|
|
6762
6805
|
}
|
|
6763
|
-
function
|
|
6806
|
+
function _t(e, t, i) {
|
|
6764
6807
|
const o = t._tiptapEditor, n = o.state.tr, r = new Set(
|
|
6765
6808
|
e.map(
|
|
6766
6809
|
(l) => typeof l == "string" ? l : l.id
|
|
@@ -6773,7 +6816,7 @@ function gt(e, t, i) {
|
|
|
6773
6816
|
if (l.type.name !== "blockContainer" || !r.has(l.attrs.id))
|
|
6774
6817
|
return !0;
|
|
6775
6818
|
a.push(
|
|
6776
|
-
|
|
6819
|
+
C(
|
|
6777
6820
|
l,
|
|
6778
6821
|
t.schema.blockSchema,
|
|
6779
6822
|
t.schema.inlineContentSchema,
|
|
@@ -6794,16 +6837,16 @@ function gt(e, t, i) {
|
|
|
6794
6837
|
}
|
|
6795
6838
|
return t.dispatch(n), a;
|
|
6796
6839
|
}
|
|
6797
|
-
function
|
|
6798
|
-
return
|
|
6840
|
+
function qo(e, t) {
|
|
6841
|
+
return _t(e, t);
|
|
6799
6842
|
}
|
|
6800
|
-
function
|
|
6843
|
+
function Xo(e, t, i) {
|
|
6801
6844
|
const o = [];
|
|
6802
6845
|
for (const s of t)
|
|
6803
6846
|
o.push(
|
|
6804
|
-
|
|
6847
|
+
U(s, i.pmSchema, i.schema.styleSchema)
|
|
6805
6848
|
);
|
|
6806
|
-
const n = typeof e[0] == "string" ? e[0] : e[0].id, r =
|
|
6849
|
+
const n = typeof e[0] == "string" ? e[0] : e[0].id, r = _t(
|
|
6807
6850
|
e,
|
|
6808
6851
|
i,
|
|
6809
6852
|
(s, l, d, u) => {
|
|
@@ -6818,7 +6861,7 @@ function Ko(e, t, i) {
|
|
|
6818
6861
|
), a = [];
|
|
6819
6862
|
for (const s of o)
|
|
6820
6863
|
a.push(
|
|
6821
|
-
|
|
6864
|
+
C(
|
|
6822
6865
|
s,
|
|
6823
6866
|
i.schema.blockSchema,
|
|
6824
6867
|
i.schema.inlineContentSchema,
|
|
@@ -6828,7 +6871,7 @@ function Ko(e, t, i) {
|
|
|
6828
6871
|
);
|
|
6829
6872
|
return { insertedBlocks: a, removedBlocks: r };
|
|
6830
6873
|
}
|
|
6831
|
-
function
|
|
6874
|
+
function Zo(e, t, i, o = { updateSelection: !0 }) {
|
|
6832
6875
|
const n = i._tiptapEditor.state.tr;
|
|
6833
6876
|
let { from: r, to: a } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, s = !0, l = !0, d = "";
|
|
6834
6877
|
if (t.forEach((u) => {
|
|
@@ -6837,9 +6880,9 @@ function Wo(e, t, i, o = { updateSelection: !0 }) {
|
|
|
6837
6880
|
const { parent: u } = n.doc.resolve(r);
|
|
6838
6881
|
u.isTextblock && !u.type.spec.code && !u.childCount && (r -= 1, a += 1);
|
|
6839
6882
|
}
|
|
6840
|
-
return s ? n.insertText(d, r, a) : n.replaceWith(r, a, t), o.updateSelection &&
|
|
6883
|
+
return s ? n.insertText(d, r, a) : n.replaceWith(r, a, t), o.updateSelection && zt(n, n.steps.length - 1, -1), i.dispatch(n), !0;
|
|
6841
6884
|
}
|
|
6842
|
-
function
|
|
6885
|
+
function Jo() {
|
|
6843
6886
|
const e = (t) => {
|
|
6844
6887
|
let i = t.children.length;
|
|
6845
6888
|
for (let o = 0; o < i; o++) {
|
|
@@ -6855,8 +6898,8 @@ function $o() {
|
|
|
6855
6898
|
};
|
|
6856
6899
|
return e;
|
|
6857
6900
|
}
|
|
6858
|
-
function
|
|
6859
|
-
const e =
|
|
6901
|
+
function Yo() {
|
|
6902
|
+
const e = H;
|
|
6860
6903
|
if (!e)
|
|
6861
6904
|
throw new Error(
|
|
6862
6905
|
"simplifyBlocks requires ESM dependencies to be initialized"
|
|
@@ -6878,42 +6921,42 @@ function qo() {
|
|
|
6878
6921
|
return t;
|
|
6879
6922
|
}
|
|
6880
6923
|
function Ie(e) {
|
|
6881
|
-
const t =
|
|
6924
|
+
const t = H;
|
|
6882
6925
|
if (!t)
|
|
6883
6926
|
throw new Error(
|
|
6884
6927
|
"cleanHTMLToMarkdown requires ESM dependencies to be initialized"
|
|
6885
6928
|
);
|
|
6886
|
-
return t.unified.unified().use(t.rehypeParse.default, { fragment: !0 }).use(
|
|
6929
|
+
return t.unified.unified().use(t.rehypeParse.default, { fragment: !0 }).use(Jo).use(Yo).use(t.rehypeRemark.default).use(t.remarkGfm.default).use(t.remarkStringify.default, {
|
|
6887
6930
|
handlers: { text: (o) => o.value }
|
|
6888
6931
|
}).processSync(e).value;
|
|
6889
6932
|
}
|
|
6890
|
-
async function
|
|
6891
|
-
await
|
|
6933
|
+
async function Qo(e, t, i, o) {
|
|
6934
|
+
await ie();
|
|
6892
6935
|
const r = de(t, i).exportBlocks(e, o);
|
|
6893
6936
|
return Ie(r);
|
|
6894
6937
|
}
|
|
6895
|
-
function
|
|
6938
|
+
function en(e) {
|
|
6896
6939
|
return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
|
|
6897
6940
|
}
|
|
6898
|
-
function
|
|
6941
|
+
function tn(e) {
|
|
6899
6942
|
return e.nodeType === 3 && !/\S/.test(e.nodeValue || "");
|
|
6900
6943
|
}
|
|
6901
|
-
function
|
|
6944
|
+
function on(e) {
|
|
6902
6945
|
e.querySelectorAll("li > ul, li > ol").forEach((t) => {
|
|
6903
|
-
const i =
|
|
6946
|
+
const i = en(t), o = t.parentElement, n = Array.from(o.childNodes).slice(
|
|
6904
6947
|
i + 1
|
|
6905
6948
|
);
|
|
6906
6949
|
t.remove(), n.forEach((r) => {
|
|
6907
6950
|
r.remove();
|
|
6908
6951
|
}), o.insertAdjacentElement("afterend", t), n.reverse().forEach((r) => {
|
|
6909
|
-
if (
|
|
6952
|
+
if (tn(r))
|
|
6910
6953
|
return;
|
|
6911
6954
|
const a = document.createElement("li");
|
|
6912
6955
|
a.append(r), t.insertAdjacentElement("afterend", a);
|
|
6913
6956
|
}), o.childNodes.length === 0 && o.remove();
|
|
6914
6957
|
});
|
|
6915
6958
|
}
|
|
6916
|
-
function
|
|
6959
|
+
function nn(e) {
|
|
6917
6960
|
e.querySelectorAll("li + ul, li + ol").forEach((t) => {
|
|
6918
6961
|
var r, a;
|
|
6919
6962
|
const i = t.previousElementSibling, o = document.createElement("div");
|
|
@@ -6923,28 +6966,28 @@ function Qo(e) {
|
|
|
6923
6966
|
n.append(o.nextElementSibling);
|
|
6924
6967
|
});
|
|
6925
6968
|
}
|
|
6926
|
-
let
|
|
6927
|
-
function
|
|
6928
|
-
return
|
|
6969
|
+
let qe = null;
|
|
6970
|
+
function rn() {
|
|
6971
|
+
return qe || (qe = document.implementation.createHTMLDocument("title"));
|
|
6929
6972
|
}
|
|
6930
|
-
function
|
|
6973
|
+
function kt(e) {
|
|
6931
6974
|
if (typeof e == "string") {
|
|
6932
|
-
const t =
|
|
6975
|
+
const t = rn().createElement("div");
|
|
6933
6976
|
t.innerHTML = e, e = t;
|
|
6934
6977
|
}
|
|
6935
|
-
return
|
|
6978
|
+
return on(e), nn(e), e;
|
|
6936
6979
|
}
|
|
6937
|
-
async function
|
|
6938
|
-
const r =
|
|
6980
|
+
async function yt(e, t, i, o, n) {
|
|
6981
|
+
const r = kt(e), s = It.fromSchema(n).parse(r, {
|
|
6939
6982
|
topNode: n.nodes.blockGroup.create()
|
|
6940
6983
|
}), l = [];
|
|
6941
6984
|
for (let d = 0; d < s.childCount; d++)
|
|
6942
6985
|
l.push(
|
|
6943
|
-
|
|
6986
|
+
C(s.child(d), t, i, o)
|
|
6944
6987
|
);
|
|
6945
6988
|
return l;
|
|
6946
6989
|
}
|
|
6947
|
-
function
|
|
6990
|
+
function an(e, t) {
|
|
6948
6991
|
const i = t.value ? t.value + `
|
|
6949
6992
|
` : "", o = {};
|
|
6950
6993
|
t.lang && (o["data-language"] = t.lang);
|
|
@@ -6961,14 +7004,14 @@ function tn(e, t) {
|
|
|
6961
7004
|
children: [n]
|
|
6962
7005
|
}, e.patch(t, n), n;
|
|
6963
7006
|
}
|
|
6964
|
-
async function
|
|
6965
|
-
const r = await
|
|
7007
|
+
async function sn(e, t, i, o, n) {
|
|
7008
|
+
const r = await ie(), a = r.unified.unified().use(r.remarkParse.default).use(r.remarkGfm.default).use(r.remarkRehype.default, {
|
|
6966
7009
|
handlers: {
|
|
6967
7010
|
...r.remarkRehype.defaultHandlers,
|
|
6968
|
-
code:
|
|
7011
|
+
code: an
|
|
6969
7012
|
}
|
|
6970
7013
|
}).use(r.rehypeStringify.default).processSync(e);
|
|
6971
|
-
return
|
|
7014
|
+
return yt(
|
|
6972
7015
|
a.value,
|
|
6973
7016
|
t,
|
|
6974
7017
|
i,
|
|
@@ -6996,7 +7039,7 @@ class Z {
|
|
|
6996
7039
|
this.callbacks = {};
|
|
6997
7040
|
}
|
|
6998
7041
|
}
|
|
6999
|
-
class
|
|
7042
|
+
class ln {
|
|
7000
7043
|
constructor(t, i, o, n) {
|
|
7001
7044
|
c(this, "state");
|
|
7002
7045
|
c(this, "emitUpdate");
|
|
@@ -7015,6 +7058,8 @@ class nn {
|
|
|
7015
7058
|
const i = this.pmView.root.querySelector(
|
|
7016
7059
|
`[data-node-type="blockContainer"][data-id="${this.state.block.id}"]`
|
|
7017
7060
|
);
|
|
7061
|
+
if (!i)
|
|
7062
|
+
return;
|
|
7018
7063
|
this.state.referencePos = i.getBoundingClientRect(), this.emitUpdate();
|
|
7019
7064
|
}
|
|
7020
7065
|
});
|
|
@@ -7035,6 +7080,8 @@ class nn {
|
|
|
7035
7080
|
const a = this.pmView.root.querySelector(
|
|
7036
7081
|
`[data-node-type="blockContainer"][data-id="${o.block.id}"]`
|
|
7037
7082
|
);
|
|
7083
|
+
if (!a)
|
|
7084
|
+
return;
|
|
7038
7085
|
this.state = {
|
|
7039
7086
|
show: !0,
|
|
7040
7087
|
referencePos: a.getBoundingClientRect(),
|
|
@@ -7048,25 +7095,31 @@ class nn {
|
|
|
7048
7095
|
this.pmView.dom.removeEventListener("mousedown", this.mouseDownHandler), this.pmView.dom.removeEventListener("dragstart", this.dragstartHandler), this.pmView.root.removeEventListener("scroll", this.scrollHandler, !0);
|
|
7049
7096
|
}
|
|
7050
7097
|
}
|
|
7051
|
-
const
|
|
7052
|
-
class
|
|
7098
|
+
const be = new L("FilePanelPlugin");
|
|
7099
|
+
class dn extends Z {
|
|
7053
7100
|
constructor(i) {
|
|
7054
7101
|
super();
|
|
7055
7102
|
c(this, "view");
|
|
7056
7103
|
c(this, "plugin");
|
|
7057
|
-
c(this, "closeMenu", () =>
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7104
|
+
c(this, "closeMenu", () => {
|
|
7105
|
+
var i;
|
|
7106
|
+
return (i = this.view) == null ? void 0 : i.closeMenu();
|
|
7107
|
+
});
|
|
7108
|
+
this.plugin = new x({
|
|
7109
|
+
key: be,
|
|
7110
|
+
view: (o) => (this.view = new ln(
|
|
7061
7111
|
i,
|
|
7062
|
-
|
|
7112
|
+
be,
|
|
7063
7113
|
o,
|
|
7064
7114
|
(n) => {
|
|
7065
7115
|
this.emit("update", n);
|
|
7066
7116
|
}
|
|
7067
7117
|
), this.view),
|
|
7068
7118
|
props: {
|
|
7069
|
-
handleKeyDown: (o, n) =>
|
|
7119
|
+
handleKeyDown: (o, n) => {
|
|
7120
|
+
var r;
|
|
7121
|
+
return n.key === "Escape" && this.shown ? ((r = this.view) == null || r.closeMenu(), !0) : !1;
|
|
7122
|
+
}
|
|
7070
7123
|
},
|
|
7071
7124
|
state: {
|
|
7072
7125
|
init: () => ({
|
|
@@ -7075,7 +7128,7 @@ class rn extends Z {
|
|
|
7075
7128
|
apply: (o) => {
|
|
7076
7129
|
var r;
|
|
7077
7130
|
return {
|
|
7078
|
-
block: (r = o.getMeta(
|
|
7131
|
+
block: (r = o.getMeta(be)) == null ? void 0 : r.block
|
|
7079
7132
|
};
|
|
7080
7133
|
}
|
|
7081
7134
|
}
|
|
@@ -7089,14 +7142,14 @@ class rn extends Z {
|
|
|
7089
7142
|
return this.on("update", i);
|
|
7090
7143
|
}
|
|
7091
7144
|
}
|
|
7092
|
-
class
|
|
7145
|
+
class cn {
|
|
7093
7146
|
constructor(t, i, o) {
|
|
7094
7147
|
c(this, "state");
|
|
7095
7148
|
c(this, "emitUpdate");
|
|
7096
7149
|
c(this, "preventHide", !1);
|
|
7097
7150
|
c(this, "preventShow", !1);
|
|
7098
7151
|
c(this, "shouldShow", ({ state: t, from: i, to: o, view: n }) => {
|
|
7099
|
-
const { doc: r, selection: a } = t, { empty: s } = a, l = !r.textBetween(i, o).length &&
|
|
7152
|
+
const { doc: r, selection: a } = t, { empty: s } = a, l = !r.textBetween(i, o).length && Vt(t.selection);
|
|
7100
7153
|
return !(!n.hasFocus() || s || l);
|
|
7101
7154
|
});
|
|
7102
7155
|
c(this, "blurHandler", (t) => {
|
|
@@ -7144,7 +7197,7 @@ class an {
|
|
|
7144
7197
|
const { state: o, composing: n } = t, { doc: r, selection: a } = o, s = i && i.doc.eq(r) && i.selection.eq(a);
|
|
7145
7198
|
if (n || s)
|
|
7146
7199
|
return;
|
|
7147
|
-
const { ranges: l } = a, d = Math.min(...l.map((
|
|
7200
|
+
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, {
|
|
7148
7201
|
view: t,
|
|
7149
7202
|
state: o,
|
|
7150
7203
|
from: d,
|
|
@@ -7167,26 +7220,26 @@ class an {
|
|
|
7167
7220
|
}
|
|
7168
7221
|
getSelectionBoundingBox() {
|
|
7169
7222
|
const { state: t } = this.pmView, { selection: i } = t, { ranges: o } = i, n = Math.min(...o.map((a) => a.$from.pos)), r = Math.max(...o.map((a) => a.$to.pos));
|
|
7170
|
-
if (
|
|
7223
|
+
if (Rt(i)) {
|
|
7171
7224
|
const a = this.pmView.nodeDOM(n);
|
|
7172
7225
|
if (a)
|
|
7173
7226
|
return a.getBoundingClientRect();
|
|
7174
7227
|
}
|
|
7175
|
-
return
|
|
7228
|
+
return we(this.pmView, n, r);
|
|
7176
7229
|
}
|
|
7177
7230
|
}
|
|
7178
|
-
const
|
|
7231
|
+
const un = new L(
|
|
7179
7232
|
"FormattingToolbarPlugin"
|
|
7180
7233
|
);
|
|
7181
|
-
class
|
|
7234
|
+
class pn extends Z {
|
|
7182
7235
|
constructor(i) {
|
|
7183
7236
|
super();
|
|
7184
7237
|
c(this, "view");
|
|
7185
7238
|
c(this, "plugin");
|
|
7186
7239
|
c(this, "closeMenu", () => this.view.closeMenu());
|
|
7187
|
-
this.plugin = new
|
|
7188
|
-
key:
|
|
7189
|
-
view: (o) => (this.view = new
|
|
7240
|
+
this.plugin = new x({
|
|
7241
|
+
key: un,
|
|
7242
|
+
view: (o) => (this.view = new cn(i, o, (n) => {
|
|
7190
7243
|
this.emit("update", n);
|
|
7191
7244
|
}), this.view),
|
|
7192
7245
|
props: {
|
|
@@ -7202,7 +7255,7 @@ class ln extends Z {
|
|
|
7202
7255
|
return this.on("update", i);
|
|
7203
7256
|
}
|
|
7204
7257
|
}
|
|
7205
|
-
class
|
|
7258
|
+
class hn {
|
|
7206
7259
|
constructor(t, i, o) {
|
|
7207
7260
|
c(this, "state");
|
|
7208
7261
|
c(this, "emitUpdate");
|
|
@@ -7220,7 +7273,7 @@ class dn {
|
|
|
7220
7273
|
const i = t.target, o = this.pmView.posAtDOM(i, 0) + 1, n = this.pmView.state.doc.resolve(o), r = n.marks();
|
|
7221
7274
|
for (const a of r)
|
|
7222
7275
|
if (a.type.name === this.pmView.state.schema.mark("link").type.name) {
|
|
7223
|
-
this.mouseHoveredLinkMark = a, this.mouseHoveredLinkMarkRange =
|
|
7276
|
+
this.mouseHoveredLinkMark = a, this.mouseHoveredLinkMarkRange = De(n, a.type, a.attrs) || void 0;
|
|
7224
7277
|
break;
|
|
7225
7278
|
}
|
|
7226
7279
|
}
|
|
@@ -7236,7 +7289,7 @@ class dn {
|
|
|
7236
7289
|
});
|
|
7237
7290
|
c(this, "scrollHandler", () => {
|
|
7238
7291
|
var t;
|
|
7239
|
-
this.linkMark !== void 0 && (t = this.state) != null && t.show && (this.state.referencePos =
|
|
7292
|
+
this.linkMark !== void 0 && (t = this.state) != null && t.show && (this.state.referencePos = we(
|
|
7240
7293
|
this.pmView,
|
|
7241
7294
|
this.linkMarkRange.from,
|
|
7242
7295
|
this.linkMarkRange.to
|
|
@@ -7292,7 +7345,7 @@ class dn {
|
|
|
7292
7345
|
const o = this.pmView.state.selection.$from.marks();
|
|
7293
7346
|
for (const n of o)
|
|
7294
7347
|
if (n.type.name === this.pmView.state.schema.mark("link").type.name) {
|
|
7295
|
-
this.keyboardHoveredLinkMark = n, this.keyboardHoveredLinkMarkRange =
|
|
7348
|
+
this.keyboardHoveredLinkMark = n, this.keyboardHoveredLinkMarkRange = De(
|
|
7296
7349
|
this.pmView.state.selection.$from,
|
|
7297
7350
|
n.type,
|
|
7298
7351
|
n.attrs
|
|
@@ -7303,7 +7356,7 @@ class dn {
|
|
|
7303
7356
|
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) {
|
|
7304
7357
|
this.state = {
|
|
7305
7358
|
show: !0,
|
|
7306
|
-
referencePos:
|
|
7359
|
+
referencePos: we(
|
|
7307
7360
|
this.pmView,
|
|
7308
7361
|
this.linkMarkRange.from,
|
|
7309
7362
|
this.linkMarkRange.to
|
|
@@ -7329,8 +7382,8 @@ class dn {
|
|
|
7329
7382
|
);
|
|
7330
7383
|
}
|
|
7331
7384
|
}
|
|
7332
|
-
const
|
|
7333
|
-
class
|
|
7385
|
+
const mn = new L("LinkToolbarPlugin");
|
|
7386
|
+
class fn extends Z {
|
|
7334
7387
|
constructor(i) {
|
|
7335
7388
|
super();
|
|
7336
7389
|
c(this, "view");
|
|
@@ -7368,9 +7421,9 @@ class un extends Z {
|
|
|
7368
7421
|
this.view.stopMenuUpdateTimer();
|
|
7369
7422
|
});
|
|
7370
7423
|
c(this, "closeMenu", () => this.view.closeMenu());
|
|
7371
|
-
this.plugin = new
|
|
7372
|
-
key:
|
|
7373
|
-
view: (o) => (this.view = new
|
|
7424
|
+
this.plugin = new x({
|
|
7425
|
+
key: mn,
|
|
7426
|
+
view: (o) => (this.view = new hn(i, o, (n) => {
|
|
7374
7427
|
this.emit("update", n);
|
|
7375
7428
|
}), this.view),
|
|
7376
7429
|
props: {
|
|
@@ -7386,7 +7439,7 @@ class un extends Z {
|
|
|
7386
7439
|
return ((o = (i = this.view) == null ? void 0 : i.state) == null ? void 0 : o.show) || !1;
|
|
7387
7440
|
}
|
|
7388
7441
|
}
|
|
7389
|
-
class
|
|
7442
|
+
class G extends fe {
|
|
7390
7443
|
constructor(i, o) {
|
|
7391
7444
|
super(i, o);
|
|
7392
7445
|
c(this, "nodes");
|
|
@@ -7397,13 +7450,13 @@ class F extends ge {
|
|
|
7397
7450
|
});
|
|
7398
7451
|
}
|
|
7399
7452
|
static create(i, o, n = o) {
|
|
7400
|
-
return new
|
|
7453
|
+
return new G(i.resolve(o), i.resolve(n));
|
|
7401
7454
|
}
|
|
7402
7455
|
content() {
|
|
7403
|
-
return new
|
|
7456
|
+
return new z(N.from(this.nodes), 0, 0);
|
|
7404
7457
|
}
|
|
7405
7458
|
eq(i) {
|
|
7406
|
-
if (!(i instanceof
|
|
7459
|
+
if (!(i instanceof G) || this.nodes.length !== i.nodes.length || this.from !== i.from || this.to !== i.to)
|
|
7407
7460
|
return !1;
|
|
7408
7461
|
for (let o = 0; o < this.nodes.length; o++)
|
|
7409
7462
|
if (!this.nodes[o].eq(i.nodes[o]))
|
|
@@ -7412,7 +7465,7 @@ class F extends ge {
|
|
|
7412
7465
|
}
|
|
7413
7466
|
map(i, o) {
|
|
7414
7467
|
const n = o.mapResult(this.from), r = o.mapResult(this.to);
|
|
7415
|
-
return r.deleted ?
|
|
7468
|
+
return r.deleted ? fe.near(i.resolve(n.pos)) : n.deleted ? fe.near(i.resolve(r.pos)) : new G(
|
|
7416
7469
|
i.resolve(n.pos),
|
|
7417
7470
|
i.resolve(r.pos)
|
|
7418
7471
|
);
|
|
@@ -7421,23 +7474,23 @@ class F extends ge {
|
|
|
7421
7474
|
return { type: "node", anchor: this.anchor, head: this.head };
|
|
7422
7475
|
}
|
|
7423
7476
|
}
|
|
7424
|
-
let
|
|
7425
|
-
function
|
|
7477
|
+
let A;
|
|
7478
|
+
function me(e, t) {
|
|
7426
7479
|
var i, o;
|
|
7427
7480
|
for (; e && e.parentElement && e.parentElement !== t.dom && ((i = e.getAttribute) == null ? void 0 : i.call(e, "data-node-type")) !== "blockContainer"; )
|
|
7428
7481
|
e = e.parentElement;
|
|
7429
7482
|
if (((o = e.getAttribute) == null ? void 0 : o.call(e, "data-node-type")) === "blockContainer")
|
|
7430
7483
|
return { node: e, id: e.getAttribute("data-id") };
|
|
7431
7484
|
}
|
|
7432
|
-
function
|
|
7433
|
-
const i =
|
|
7485
|
+
function gn(e, t) {
|
|
7486
|
+
const i = me(e, t);
|
|
7434
7487
|
if (i && i.node.nodeType === 1) {
|
|
7435
7488
|
const o = t.docView, n = o.nearestDesc(i.node, !0);
|
|
7436
7489
|
return !n || n === o ? null : n.posBefore;
|
|
7437
7490
|
}
|
|
7438
7491
|
return null;
|
|
7439
7492
|
}
|
|
7440
|
-
function
|
|
7493
|
+
function bn(e, t) {
|
|
7441
7494
|
let i, o;
|
|
7442
7495
|
const n = t.resolve(e.from).node().type.spec.group === "blockContent", r = t.resolve(e.to).node().type.spec.group === "blockContent", a = Math.min(e.$anchor.depth, e.$head.depth);
|
|
7443
7496
|
if (n && r) {
|
|
@@ -7447,7 +7500,7 @@ function hn(e, t) {
|
|
|
7447
7500
|
i = e.from, o = e.to;
|
|
7448
7501
|
return { from: i, to: o };
|
|
7449
7502
|
}
|
|
7450
|
-
function
|
|
7503
|
+
function Xe(e, t, i = t) {
|
|
7451
7504
|
t === i && (i += e.state.doc.resolve(t + 1).node().nodeSize);
|
|
7452
7505
|
const o = e.domAtPos(t).node.cloneNode(!0), n = e.domAtPos(t).node, r = (u, p) => Array.prototype.indexOf.call(u.children, p), a = r(
|
|
7453
7506
|
n,
|
|
@@ -7460,16 +7513,16 @@ function $e(e, t, i = t) {
|
|
|
7460
7513
|
);
|
|
7461
7514
|
for (let u = n.childElementCount - 1; u >= 0; u--)
|
|
7462
7515
|
(u > s || u < a) && o.removeChild(o.children[u]);
|
|
7463
|
-
|
|
7516
|
+
wt(e.root), A = o;
|
|
7464
7517
|
const d = e.dom.className.split(" ").filter(
|
|
7465
7518
|
(u) => u !== "ProseMirror" && u !== "bn-root" && u !== "bn-editor"
|
|
7466
7519
|
).join(" ");
|
|
7467
|
-
|
|
7520
|
+
A.className = A.className + " bn-drag-preview " + d, e.root instanceof ShadowRoot ? e.root.appendChild(A) : e.root.body.appendChild(A);
|
|
7468
7521
|
}
|
|
7469
|
-
function
|
|
7470
|
-
|
|
7522
|
+
function wt(e) {
|
|
7523
|
+
A !== void 0 && (e instanceof ShadowRoot ? e.removeChild(A) : e.body.removeChild(A), A = void 0);
|
|
7471
7524
|
}
|
|
7472
|
-
function
|
|
7525
|
+
function _n(e, t) {
|
|
7473
7526
|
if (!e.dataTransfer)
|
|
7474
7527
|
return;
|
|
7475
7528
|
const i = t.prosemirrorView, o = i.dom.getBoundingClientRect(), n = {
|
|
@@ -7480,30 +7533,30 @@ function mn(e, t) {
|
|
|
7480
7533
|
let a;
|
|
7481
7534
|
for (const l of r)
|
|
7482
7535
|
if (i.dom.contains(l)) {
|
|
7483
|
-
a =
|
|
7536
|
+
a = me(l, i);
|
|
7484
7537
|
break;
|
|
7485
7538
|
}
|
|
7486
7539
|
if (!a)
|
|
7487
7540
|
return;
|
|
7488
|
-
const s =
|
|
7541
|
+
const s = gn(a.node, i);
|
|
7489
7542
|
if (s != null) {
|
|
7490
|
-
const l = i.state.selection, d = i.state.doc, { from: u, to: p } =
|
|
7543
|
+
const l = i.state.selection, d = i.state.doc, { from: u, to: p } = bn(l, d), h = u <= s && s < p, m = l.$anchor.node() !== l.$head.node() || l instanceof G;
|
|
7491
7544
|
h && m ? (i.dispatch(
|
|
7492
|
-
i.state.tr.setSelection(
|
|
7493
|
-
),
|
|
7494
|
-
i.state.tr.setSelection(
|
|
7495
|
-
),
|
|
7496
|
-
const
|
|
7497
|
-
|
|
7545
|
+
i.state.tr.setSelection(G.create(d, u, p))
|
|
7546
|
+
), Xe(i, u, p)) : (i.dispatch(
|
|
7547
|
+
i.state.tr.setSelection(le.create(i.state.doc, s))
|
|
7548
|
+
), Xe(i, s));
|
|
7549
|
+
const f = i.state.selection.content(), g = t.pmSchema, v = Me(g, t).serializeProseMirrorFragment(
|
|
7550
|
+
f.content,
|
|
7498
7551
|
{}
|
|
7499
|
-
),
|
|
7500
|
-
|
|
7552
|
+
), y = de(g, t).exportProseMirrorFragment(
|
|
7553
|
+
f.content,
|
|
7501
7554
|
{}
|
|
7502
|
-
),
|
|
7503
|
-
e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html",
|
|
7555
|
+
), S = Ie(y);
|
|
7556
|
+
e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html", v), e.dataTransfer.setData("text/html", y), e.dataTransfer.setData("text/plain", S), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setDragImage(A, 0, 0), i.dragging = { slice: f, move: !0 };
|
|
7504
7557
|
}
|
|
7505
7558
|
}
|
|
7506
|
-
class
|
|
7559
|
+
class kn {
|
|
7507
7560
|
constructor(t, i, o) {
|
|
7508
7561
|
c(this, "state");
|
|
7509
7562
|
c(this, "emitUpdate");
|
|
@@ -7520,7 +7573,7 @@ class fn {
|
|
|
7520
7573
|
c(this, "menuFrozen", !1);
|
|
7521
7574
|
c(this, "updateState", () => {
|
|
7522
7575
|
var a, s, l, d;
|
|
7523
|
-
if (this.menuFrozen || !this.mousePos)
|
|
7576
|
+
if (this.menuFrozen || !this.mousePos || !this.pmView.dom.firstChild)
|
|
7524
7577
|
return;
|
|
7525
7578
|
const t = this.pmView.dom.firstChild.getBoundingClientRect();
|
|
7526
7579
|
this.horizontalPosAnchor = t.x;
|
|
@@ -7535,7 +7588,7 @@ class fn {
|
|
|
7535
7588
|
let n;
|
|
7536
7589
|
for (const u of o)
|
|
7537
7590
|
if (this.pmView.dom.contains(u)) {
|
|
7538
|
-
n =
|
|
7591
|
+
n = me(u, this.pmView);
|
|
7539
7592
|
break;
|
|
7540
7593
|
}
|
|
7541
7594
|
if (!n || !this.editor.isEditable) {
|
|
@@ -7600,7 +7653,7 @@ class fn {
|
|
|
7600
7653
|
left: t.clientX,
|
|
7601
7654
|
top: t.clientY
|
|
7602
7655
|
});
|
|
7603
|
-
if (!i || i.inside === -1) {
|
|
7656
|
+
if (!i || i.inside === -1 && this.pmView.dom.firstChild) {
|
|
7604
7657
|
const o = new Event("dragover", t), n = this.pmView.dom.firstChild.getBoundingClientRect();
|
|
7605
7658
|
o.clientX = n.left + n.width / 2, o.clientY = t.clientY, o.dataTransfer = t.dataTransfer, o.preventDefault = () => t.preventDefault(), o.synthetic = !0, this.pmView.dom.dispatchEvent(o);
|
|
7606
7659
|
}
|
|
@@ -7630,14 +7683,14 @@ class fn {
|
|
|
7630
7683
|
this.updateState(), this.needUpdate && (this.emitUpdate(this.state), this.needUpdate = !1);
|
|
7631
7684
|
});
|
|
7632
7685
|
c(this, "onScroll", () => {
|
|
7633
|
-
var t;
|
|
7634
|
-
if ((t = this.state) != null && t.show) {
|
|
7635
|
-
const
|
|
7686
|
+
var t, i;
|
|
7687
|
+
if ((t = this.state) != null && t.show && ((i = this.hoveredBlock) != null && i.firstChild)) {
|
|
7688
|
+
const n = this.hoveredBlock.firstChild.getBoundingClientRect();
|
|
7636
7689
|
this.state.referencePos = new DOMRect(
|
|
7637
|
-
this.horizontalPosAnchoredAtRoot ? this.horizontalPosAnchor :
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7690
|
+
this.horizontalPosAnchoredAtRoot ? this.horizontalPosAnchor : n.x,
|
|
7691
|
+
n.y,
|
|
7692
|
+
n.width,
|
|
7693
|
+
n.height
|
|
7641
7694
|
), this.emitUpdate(this.state);
|
|
7642
7695
|
}
|
|
7643
7696
|
});
|
|
@@ -7645,14 +7698,14 @@ class fn {
|
|
|
7645
7698
|
if (!this.state)
|
|
7646
7699
|
throw new Error("Attempting to update uninitialized side menu");
|
|
7647
7700
|
o(this.state);
|
|
7648
|
-
}, this.horizontalPosAnchoredAtRoot = !0, this.horizontalPosAnchor = this.pmView.dom.firstChild.getBoundingClientRect().x, this.pmView.root.addEventListener(
|
|
7701
|
+
}, this.horizontalPosAnchoredAtRoot = !0, this.pmView.dom.firstChild && (this.horizontalPosAnchor = this.pmView.dom.firstChild.getBoundingClientRect().x), this.pmView.root.addEventListener(
|
|
7649
7702
|
"drop",
|
|
7650
7703
|
this.onDrop,
|
|
7651
7704
|
!0
|
|
7652
7705
|
), this.pmView.root.addEventListener(
|
|
7653
7706
|
"dragover",
|
|
7654
7707
|
this.onDragOver
|
|
7655
|
-
),
|
|
7708
|
+
), ie(), this.pmView.dom.addEventListener("dragstart", this.onDragStart), this.pmView.root.addEventListener(
|
|
7656
7709
|
"mousemove",
|
|
7657
7710
|
this.onMouseMove,
|
|
7658
7711
|
!0
|
|
@@ -7694,8 +7747,9 @@ class fn {
|
|
|
7694
7747
|
);
|
|
7695
7748
|
}
|
|
7696
7749
|
addBlock() {
|
|
7697
|
-
var l;
|
|
7698
|
-
(l = this.state) != null && l.show && (this.state.show = !1, this.emitUpdate(this.state))
|
|
7750
|
+
var l, d;
|
|
7751
|
+
if ((l = this.state) != null && l.show && (this.state.show = !1, this.emitUpdate(this.state)), !((d = this.hoveredBlock) != null && d.firstChild))
|
|
7752
|
+
return;
|
|
7699
7753
|
const i = this.hoveredBlock.firstChild.getBoundingClientRect(), o = this.pmView.posAtCoords({
|
|
7700
7754
|
left: i.left + i.width / 2,
|
|
7701
7755
|
top: i.top + i.height / 2
|
|
@@ -7710,15 +7764,15 @@ class fn {
|
|
|
7710
7764
|
return;
|
|
7711
7765
|
const { contentNode: r, startPos: a, endPos: s } = n;
|
|
7712
7766
|
if (r.type.spec.content !== "inline*" || r.textContent.length !== 0) {
|
|
7713
|
-
const
|
|
7714
|
-
this.editor._tiptapEditor.chain().BNCreateBlock(
|
|
7767
|
+
const u = s + 1, p = u + 2;
|
|
7768
|
+
this.editor._tiptapEditor.chain().BNCreateBlock(u).setTextSelection(p).run();
|
|
7715
7769
|
} else
|
|
7716
7770
|
this.editor._tiptapEditor.commands.setTextSelection(a + 1);
|
|
7717
7771
|
this.editor.openSuggestionMenu("/");
|
|
7718
7772
|
}
|
|
7719
7773
|
}
|
|
7720
|
-
const
|
|
7721
|
-
class
|
|
7774
|
+
const yn = new L("SideMenuPlugin");
|
|
7775
|
+
class wn extends Z {
|
|
7722
7776
|
constructor(i) {
|
|
7723
7777
|
super();
|
|
7724
7778
|
c(this, "view");
|
|
@@ -7732,12 +7786,12 @@ class bn extends Z {
|
|
|
7732
7786
|
* Handles drag & drop events for blocks.
|
|
7733
7787
|
*/
|
|
7734
7788
|
c(this, "blockDragStart", (i) => {
|
|
7735
|
-
this.view.isDragging = !0,
|
|
7789
|
+
this.view.isDragging = !0, _n(i, this.editor);
|
|
7736
7790
|
});
|
|
7737
7791
|
/**
|
|
7738
7792
|
* Handles drag & drop events for blocks.
|
|
7739
7793
|
*/
|
|
7740
|
-
c(this, "blockDragEnd", () =>
|
|
7794
|
+
c(this, "blockDragEnd", () => wt(this.editor.prosemirrorView.root));
|
|
7741
7795
|
/**
|
|
7742
7796
|
* Freezes the side menu. When frozen, the side menu will stay
|
|
7743
7797
|
* attached to the same block regardless of which block is hovered by the
|
|
@@ -7752,9 +7806,9 @@ class bn extends Z {
|
|
|
7752
7806
|
c(this, "unfreezeMenu", () => {
|
|
7753
7807
|
this.view.menuFrozen = !1, this.view.state.show = !1, this.view.emitUpdate(this.view.state);
|
|
7754
7808
|
});
|
|
7755
|
-
this.editor = i, this.plugin = new
|
|
7756
|
-
key:
|
|
7757
|
-
view: (o) => (this.view = new
|
|
7809
|
+
this.editor = i, this.plugin = new x({
|
|
7810
|
+
key: yn,
|
|
7811
|
+
view: (o) => (this.view = new kn(i, o, (n) => {
|
|
7758
7812
|
this.emit("update", n);
|
|
7759
7813
|
}), this.view)
|
|
7760
7814
|
});
|
|
@@ -7763,8 +7817,8 @@ class bn extends Z {
|
|
|
7763
7817
|
return this.on("update", i);
|
|
7764
7818
|
}
|
|
7765
7819
|
}
|
|
7766
|
-
const
|
|
7767
|
-
class
|
|
7820
|
+
const vn = Ot((e) => e.type.name === "blockContainer");
|
|
7821
|
+
class xn {
|
|
7768
7822
|
constructor(t, i) {
|
|
7769
7823
|
c(this, "state");
|
|
7770
7824
|
c(this, "emitUpdate");
|
|
@@ -7776,13 +7830,15 @@ class kn {
|
|
|
7776
7830
|
const o = (i = this.rootEl) == null ? void 0 : i.querySelector(
|
|
7777
7831
|
`[data-decoration-id="${this.pluginState.decorationId}"]`
|
|
7778
7832
|
);
|
|
7833
|
+
if (!o)
|
|
7834
|
+
return;
|
|
7779
7835
|
this.state.referencePos = o.getBoundingClientRect(), this.emitUpdate(this.pluginState.triggerCharacter);
|
|
7780
7836
|
}
|
|
7781
7837
|
});
|
|
7782
7838
|
c(this, "closeMenu", () => {
|
|
7783
7839
|
this.editor.dispatch(
|
|
7784
7840
|
this.editor._tiptapEditor.view.state.tr.setMeta(
|
|
7785
|
-
|
|
7841
|
+
W,
|
|
7786
7842
|
null
|
|
7787
7843
|
)
|
|
7788
7844
|
);
|
|
@@ -7805,7 +7861,7 @@ class kn {
|
|
|
7805
7861
|
}
|
|
7806
7862
|
update(t, i) {
|
|
7807
7863
|
var d;
|
|
7808
|
-
const o =
|
|
7864
|
+
const o = W.getState(i), n = W.getState(
|
|
7809
7865
|
t.state
|
|
7810
7866
|
), r = o === void 0 && n !== void 0, a = o !== void 0 && n === void 0;
|
|
7811
7867
|
if (!r && !(o !== void 0 && n !== void 0) && !a)
|
|
@@ -7817,7 +7873,7 @@ class kn {
|
|
|
7817
7873
|
const l = (d = this.rootEl) == null ? void 0 : d.querySelector(
|
|
7818
7874
|
`[data-decoration-id="${this.pluginState.decorationId}"]`
|
|
7819
7875
|
);
|
|
7820
|
-
this.editor.isEditable && (this.state = {
|
|
7876
|
+
this.editor.isEditable && l && (this.state = {
|
|
7821
7877
|
show: !0,
|
|
7822
7878
|
referencePos: l.getBoundingClientRect(),
|
|
7823
7879
|
query: this.pluginState.query
|
|
@@ -7828,8 +7884,8 @@ class kn {
|
|
|
7828
7884
|
(t = this.rootEl) == null || t.removeEventListener("scroll", this.handleScroll, !0);
|
|
7829
7885
|
}
|
|
7830
7886
|
}
|
|
7831
|
-
const
|
|
7832
|
-
class
|
|
7887
|
+
const W = new L("SuggestionMenuPlugin");
|
|
7888
|
+
class En extends Z {
|
|
7833
7889
|
constructor(i) {
|
|
7834
7890
|
super();
|
|
7835
7891
|
c(this, "view");
|
|
@@ -7847,9 +7903,9 @@ class yn extends Z {
|
|
|
7847
7903
|
c(this, "closeMenu", () => this.view.closeMenu());
|
|
7848
7904
|
c(this, "clearQuery", () => this.view.clearQuery());
|
|
7849
7905
|
const o = this.triggerCharacters;
|
|
7850
|
-
this.plugin = new
|
|
7851
|
-
key:
|
|
7852
|
-
view: () => (this.view = new
|
|
7906
|
+
this.plugin = new x({
|
|
7907
|
+
key: W,
|
|
7908
|
+
view: () => (this.view = new xn(
|
|
7853
7909
|
i,
|
|
7854
7910
|
(n, r) => {
|
|
7855
7911
|
this.emit(`update ${n}`, r);
|
|
@@ -7863,7 +7919,7 @@ class yn extends Z {
|
|
|
7863
7919
|
apply(n, r, a, s) {
|
|
7864
7920
|
if (n.getMeta("orderedListIndexing") !== void 0)
|
|
7865
7921
|
return r;
|
|
7866
|
-
const l = n.getMeta(
|
|
7922
|
+
const l = n.getMeta(W);
|
|
7867
7923
|
if (typeof l == "object" && l !== null && r === void 0)
|
|
7868
7924
|
return {
|
|
7869
7925
|
triggerCharacter: l.triggerCharacter,
|
|
@@ -7895,7 +7951,7 @@ class yn extends Z {
|
|
|
7895
7951
|
handleTextInput(n, r, a, s) {
|
|
7896
7952
|
const l = this.getState(n.state);
|
|
7897
7953
|
return o.includes(s) && l === void 0 ? (n.dispatch(
|
|
7898
|
-
n.state.tr.insertText(s).scrollIntoView().setMeta(
|
|
7954
|
+
n.state.tr.insertText(s).scrollIntoView().setMeta(W, {
|
|
7899
7955
|
triggerCharacter: s
|
|
7900
7956
|
})
|
|
7901
7957
|
), !0) : !1;
|
|
@@ -7906,10 +7962,10 @@ class yn extends Z {
|
|
|
7906
7962
|
if (r === void 0)
|
|
7907
7963
|
return null;
|
|
7908
7964
|
if (!r.deleteTriggerCharacter) {
|
|
7909
|
-
const a =
|
|
7965
|
+
const a = vn(n.selection);
|
|
7910
7966
|
if (a)
|
|
7911
7967
|
return K.create(n.doc, [
|
|
7912
|
-
|
|
7968
|
+
$.node(
|
|
7913
7969
|
a.pos,
|
|
7914
7970
|
a.pos + a.node.nodeSize,
|
|
7915
7971
|
{
|
|
@@ -7921,7 +7977,7 @@ class yn extends Z {
|
|
|
7921
7977
|
]);
|
|
7922
7978
|
}
|
|
7923
7979
|
return K.create(n.doc, [
|
|
7924
|
-
|
|
7980
|
+
$.inline(
|
|
7925
7981
|
r.queryStartPos - r.triggerCharacter.length,
|
|
7926
7982
|
r.queryStartPos,
|
|
7927
7983
|
{
|
|
@@ -7943,32 +7999,32 @@ class yn extends Z {
|
|
|
7943
7999
|
return ((o = (i = this.view) == null ? void 0 : i.state) == null ? void 0 : o.show) || !1;
|
|
7944
8000
|
}
|
|
7945
8001
|
}
|
|
7946
|
-
function
|
|
8002
|
+
function zr(e, t) {
|
|
7947
8003
|
e.suggestionMenus.addTriggerCharacter(t);
|
|
7948
8004
|
}
|
|
7949
|
-
let
|
|
7950
|
-
function
|
|
7951
|
-
|
|
8005
|
+
let E;
|
|
8006
|
+
function Ze(e) {
|
|
8007
|
+
E || (E = document.createElement("div"), E.innerHTML = "_", E.style.opacity = "0", E.style.height = "1px", E.style.width = "1px", e instanceof Document ? e.body.appendChild(E) : e.appendChild(E));
|
|
7952
8008
|
}
|
|
7953
|
-
function
|
|
7954
|
-
|
|
8009
|
+
function Cn(e) {
|
|
8010
|
+
E && (e instanceof Document ? e.body.removeChild(E) : e.removeChild(E), E = void 0);
|
|
7955
8011
|
}
|
|
7956
8012
|
function re(e) {
|
|
7957
8013
|
return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
|
|
7958
8014
|
}
|
|
7959
|
-
function
|
|
8015
|
+
function Sn(e) {
|
|
7960
8016
|
for (; e && e.nodeName !== "TD" && e.nodeName !== "TH"; )
|
|
7961
8017
|
e = e.classList && e.classList.contains("ProseMirror") ? null : e.parentNode;
|
|
7962
8018
|
return e;
|
|
7963
8019
|
}
|
|
7964
|
-
function
|
|
8020
|
+
function Mn(e, t) {
|
|
7965
8021
|
e.forEach((i) => {
|
|
7966
8022
|
const o = t.querySelectorAll(i);
|
|
7967
8023
|
for (let n = 0; n < o.length; n++)
|
|
7968
8024
|
o[n].style.visibility = "hidden";
|
|
7969
8025
|
});
|
|
7970
8026
|
}
|
|
7971
|
-
class
|
|
8027
|
+
class Tn {
|
|
7972
8028
|
constructor(t, i, o) {
|
|
7973
8029
|
c(this, "state");
|
|
7974
8030
|
c(this, "emitUpdate");
|
|
@@ -7977,31 +8033,34 @@ class En {
|
|
|
7977
8033
|
c(this, "menuFrozen", !1);
|
|
7978
8034
|
c(this, "prevWasEditable", null);
|
|
7979
8035
|
c(this, "mouseMoveHandler", (t) => {
|
|
7980
|
-
var d;
|
|
8036
|
+
var d, u, p;
|
|
7981
8037
|
if (this.menuFrozen)
|
|
7982
8038
|
return;
|
|
7983
|
-
const i =
|
|
8039
|
+
const i = Sn(t.target);
|
|
7984
8040
|
if (!i || !this.editor.isEditable) {
|
|
7985
8041
|
(d = this.state) != null && d.show && (this.state.show = !1, this.emitUpdate());
|
|
7986
8042
|
return;
|
|
7987
8043
|
}
|
|
7988
|
-
const o = re(i), n = re(i.parentElement), r = i.getBoundingClientRect(), a = i.parentElement.parentElement
|
|
8044
|
+
const o = re(i), n = re(i.parentElement), r = i.getBoundingClientRect(), a = (p = (u = i.parentElement) == null ? void 0 : u.parentElement) == null ? void 0 : p.getBoundingClientRect();
|
|
8045
|
+
if (!a)
|
|
8046
|
+
return;
|
|
8047
|
+
const s = me(i, this.pmView);
|
|
7989
8048
|
if (!s)
|
|
7990
8049
|
return;
|
|
7991
8050
|
let l;
|
|
7992
|
-
if (this.editor._tiptapEditor.state.doc.descendants((
|
|
8051
|
+
if (this.editor._tiptapEditor.state.doc.descendants((h, m) => {
|
|
7993
8052
|
if (typeof l < "u")
|
|
7994
8053
|
return !1;
|
|
7995
|
-
if (
|
|
8054
|
+
if (h.type.name !== "blockContainer" || h.attrs.id !== s.id)
|
|
7996
8055
|
return !0;
|
|
7997
|
-
const
|
|
7998
|
-
|
|
8056
|
+
const f = C(
|
|
8057
|
+
h,
|
|
7999
8058
|
this.editor.schema.blockSchema,
|
|
8000
8059
|
this.editor.schema.inlineContentSchema,
|
|
8001
8060
|
this.editor.schema.styleSchema,
|
|
8002
8061
|
this.editor.blockCache
|
|
8003
8062
|
);
|
|
8004
|
-
return
|
|
8063
|
+
return Go("table", f, this.editor) && (this.tablePos = m + 1, l = f), !1;
|
|
8005
8064
|
}), !!l && (this.tableId = s.id, !(this.state !== void 0 && this.state.show && this.tableId === s.id && this.state.rowIndex === n && this.state.colIndex === o)))
|
|
8006
8065
|
return this.state = {
|
|
8007
8066
|
show: !0,
|
|
@@ -8017,7 +8076,7 @@ class En {
|
|
|
8017
8076
|
var h;
|
|
8018
8077
|
if (((h = this.state) == null ? void 0 : h.draggingState) === void 0)
|
|
8019
8078
|
return;
|
|
8020
|
-
t.preventDefault(), t.dataTransfer.dropEffect = "move",
|
|
8079
|
+
t.preventDefault(), t.dataTransfer.dropEffect = "move", Mn(
|
|
8021
8080
|
[
|
|
8022
8081
|
"column-resize-handle",
|
|
8023
8082
|
"prosemirror-dropcursor-block",
|
|
@@ -8047,7 +8106,7 @@ class En {
|
|
|
8047
8106
|
(this.state.rowIndex !== a || this.state.colIndex !== s) && (this.state.rowIndex = a, this.state.colIndex = s, this.state.referencePosCell = n.getBoundingClientRect(), r = !0);
|
|
8048
8107
|
const p = this.state.draggingState.draggedCellOrientation === "row" ? i.top : i.left;
|
|
8049
8108
|
this.state.draggingState.mousePos !== p && (this.state.draggingState.mousePos = p, r = !0), r && this.emitUpdate(), u && this.editor.dispatch(
|
|
8050
|
-
this.pmView.state.tr.setMeta(
|
|
8109
|
+
this.pmView.state.tr.setMeta(Q, !0)
|
|
8051
8110
|
);
|
|
8052
8111
|
});
|
|
8053
8112
|
c(this, "dropHandler", (t) => {
|
|
@@ -8104,8 +8163,8 @@ class En {
|
|
|
8104
8163
|
), this.pmView.root.removeEventListener("scroll", this.scrollHandler, !0);
|
|
8105
8164
|
}
|
|
8106
8165
|
}
|
|
8107
|
-
const
|
|
8108
|
-
class
|
|
8166
|
+
const Q = new L("TableHandlesPlugin");
|
|
8167
|
+
class Bn extends Z {
|
|
8109
8168
|
constructor(i) {
|
|
8110
8169
|
super();
|
|
8111
8170
|
c(this, "view");
|
|
@@ -8124,13 +8183,13 @@ class Cn extends Z {
|
|
|
8124
8183
|
originalIndex: this.view.state.colIndex,
|
|
8125
8184
|
mousePos: i.clientX
|
|
8126
8185
|
}, this.view.emitUpdate(), this.editor.dispatch(
|
|
8127
|
-
this.editor._tiptapEditor.state.tr.setMeta(
|
|
8186
|
+
this.editor._tiptapEditor.state.tr.setMeta(Q, {
|
|
8128
8187
|
draggedCellOrientation: this.view.state.draggingState.draggedCellOrientation,
|
|
8129
8188
|
originalIndex: this.view.state.colIndex,
|
|
8130
8189
|
newIndex: this.view.state.colIndex,
|
|
8131
8190
|
tablePos: this.view.tablePos
|
|
8132
8191
|
})
|
|
8133
|
-
),
|
|
8192
|
+
), Ze(this.editor._tiptapEditor.view.root), i.dataTransfer.setDragImage(E, 0, 0), i.dataTransfer.effectAllowed = "move";
|
|
8134
8193
|
});
|
|
8135
8194
|
/**
|
|
8136
8195
|
* Callback that should be set on the `dragStart` event for whichever element
|
|
@@ -8146,13 +8205,13 @@ class Cn extends Z {
|
|
|
8146
8205
|
originalIndex: this.view.state.rowIndex,
|
|
8147
8206
|
mousePos: i.clientY
|
|
8148
8207
|
}, this.view.emitUpdate(), this.editor.dispatch(
|
|
8149
|
-
this.editor._tiptapEditor.state.tr.setMeta(
|
|
8208
|
+
this.editor._tiptapEditor.state.tr.setMeta(Q, {
|
|
8150
8209
|
draggedCellOrientation: this.view.state.draggingState.draggedCellOrientation,
|
|
8151
8210
|
originalIndex: this.view.state.rowIndex,
|
|
8152
8211
|
newIndex: this.view.state.rowIndex,
|
|
8153
8212
|
tablePos: this.view.tablePos
|
|
8154
8213
|
})
|
|
8155
|
-
),
|
|
8214
|
+
), Ze(this.editor._tiptapEditor.view.root), i.dataTransfer.setDragImage(E, 0, 0), i.dataTransfer.effectAllowed = "copyMove";
|
|
8156
8215
|
});
|
|
8157
8216
|
/**
|
|
8158
8217
|
* Callback that should be set on the `dragEnd` event for both the element
|
|
@@ -8164,8 +8223,8 @@ class Cn extends Z {
|
|
|
8164
8223
|
"Attempted to drag table row, but no table block was hovered prior."
|
|
8165
8224
|
);
|
|
8166
8225
|
this.view.state.draggingState = void 0, this.view.emitUpdate(), this.editor.dispatch(
|
|
8167
|
-
this.editor._tiptapEditor.state.tr.setMeta(
|
|
8168
|
-
),
|
|
8226
|
+
this.editor._tiptapEditor.state.tr.setMeta(Q, null)
|
|
8227
|
+
), Cn(this.editor._tiptapEditor.view.root);
|
|
8169
8228
|
});
|
|
8170
8229
|
/**
|
|
8171
8230
|
* Freezes the drag handles. When frozen, they will stay attached to the same
|
|
@@ -8181,9 +8240,9 @@ class Cn extends Z {
|
|
|
8181
8240
|
c(this, "unfreezeHandles", () => {
|
|
8182
8241
|
this.view.menuFrozen = !1;
|
|
8183
8242
|
});
|
|
8184
|
-
this.editor = i, this.plugin = new
|
|
8185
|
-
key:
|
|
8186
|
-
view: (o) => (this.view = new
|
|
8243
|
+
this.editor = i, this.plugin = new x({
|
|
8244
|
+
key: Q,
|
|
8245
|
+
view: (o) => (this.view = new Tn(i, o, (n) => {
|
|
8187
8246
|
this.emit("update", n);
|
|
8188
8247
|
}), this.view),
|
|
8189
8248
|
// We use decorations to render the drop cursor when dragging a table row
|
|
@@ -8206,9 +8265,9 @@ class Cn extends Z {
|
|
|
8206
8265
|
), h = p.node(), m = p.pos + (n > this.view.state.draggingState.originalIndex ? h.nodeSize - 2 : 0);
|
|
8207
8266
|
r.push(
|
|
8208
8267
|
// The widget is a small bar which spans the width of the cell.
|
|
8209
|
-
|
|
8210
|
-
const
|
|
8211
|
-
return
|
|
8268
|
+
$.widget(m, () => {
|
|
8269
|
+
const f = document.createElement("div");
|
|
8270
|
+
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;
|
|
8212
8271
|
})
|
|
8213
8272
|
);
|
|
8214
8273
|
}
|
|
@@ -8221,7 +8280,7 @@ class Cn extends Z {
|
|
|
8221
8280
|
), p = u.node(), h = u.pos + (n > this.view.state.draggingState.originalIndex ? p.nodeSize - 2 : 0);
|
|
8222
8281
|
r.push(
|
|
8223
8282
|
// The widget is a small bar which spans the height of the cell.
|
|
8224
|
-
|
|
8283
|
+
$.widget(h, () => {
|
|
8225
8284
|
const m = document.createElement("div");
|
|
8226
8285
|
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;
|
|
8227
8286
|
})
|
|
@@ -8236,15 +8295,15 @@ class Cn extends Z {
|
|
|
8236
8295
|
return this.on("update", i);
|
|
8237
8296
|
}
|
|
8238
8297
|
}
|
|
8239
|
-
async function
|
|
8240
|
-
const i = e.state.selection.content().content, n =
|
|
8298
|
+
async function vt(e, t) {
|
|
8299
|
+
const i = e.state.selection.content().content, n = Me(
|
|
8241
8300
|
e.state.schema,
|
|
8242
8301
|
t
|
|
8243
|
-
)
|
|
8302
|
+
).serializeProseMirrorFragment(
|
|
8244
8303
|
i,
|
|
8245
8304
|
{}
|
|
8246
8305
|
);
|
|
8247
|
-
await
|
|
8306
|
+
await ie();
|
|
8248
8307
|
const a = de(
|
|
8249
8308
|
e.state.schema,
|
|
8250
8309
|
t
|
|
@@ -8254,24 +8313,27 @@ async function Xe(e, t) {
|
|
|
8254
8313
|
), s = await Ie(a);
|
|
8255
8314
|
return { internalHTML: n, externalHTML: a, plainText: s };
|
|
8256
8315
|
}
|
|
8257
|
-
const
|
|
8316
|
+
const Je = (e, t, i) => {
|
|
8317
|
+
i.preventDefault(), i.clipboardData.clearData(), "node" in t.state.selection && t.state.selection.node.type.spec.group === "blockContent" && e.dispatch(
|
|
8318
|
+
e._tiptapEditor.state.tr.setSelection(
|
|
8319
|
+
new le(t.state.doc.resolve(t.state.selection.from - 1))
|
|
8320
|
+
)
|
|
8321
|
+
), (async () => {
|
|
8322
|
+
const { internalHTML: o, externalHTML: n, plainText: r } = await vt(t, e);
|
|
8323
|
+
i.clipboardData.setData("blocknote/html", o), i.clipboardData.setData("text/html", n), i.clipboardData.setData("text/plain", r);
|
|
8324
|
+
})();
|
|
8325
|
+
}, Ln = (e) => I.create({
|
|
8258
8326
|
name: "copyToClipboard",
|
|
8259
8327
|
addProseMirrorPlugins() {
|
|
8260
8328
|
return [
|
|
8261
|
-
new
|
|
8329
|
+
new x({
|
|
8262
8330
|
props: {
|
|
8263
8331
|
handleDOMEvents: {
|
|
8264
8332
|
copy(t, i) {
|
|
8265
|
-
return
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
)
|
|
8270
|
-
)
|
|
8271
|
-
), (async () => {
|
|
8272
|
-
const { internalHTML: o, externalHTML: n, plainText: r } = await Xe(t, e);
|
|
8273
|
-
i.clipboardData.setData("blocknote/html", o), i.clipboardData.setData("text/html", n), i.clipboardData.setData("text/plain", r);
|
|
8274
|
-
})(), !0;
|
|
8333
|
+
return Je(e, t, i), !0;
|
|
8334
|
+
},
|
|
8335
|
+
cut(t, i) {
|
|
8336
|
+
return Je(e, t, i), t.dispatch(t.state.tr.deleteSelection()), !0;
|
|
8275
8337
|
},
|
|
8276
8338
|
// This is for the use-case in which only a block without content
|
|
8277
8339
|
// is selected, e.g. an image block, and dragged (not using the
|
|
@@ -8280,12 +8342,12 @@ const Sn = (e) => T.create({
|
|
|
8280
8342
|
if ("node" in t.state.selection && t.state.selection.node.type.spec.group === "blockContent")
|
|
8281
8343
|
return e.dispatch(
|
|
8282
8344
|
e._tiptapEditor.state.tr.setSelection(
|
|
8283
|
-
new
|
|
8345
|
+
new le(
|
|
8284
8346
|
t.state.doc.resolve(t.state.selection.from - 1)
|
|
8285
8347
|
)
|
|
8286
8348
|
)
|
|
8287
8349
|
), i.preventDefault(), i.dataTransfer.clearData(), (async () => {
|
|
8288
|
-
const { internalHTML: o, externalHTML: n, plainText: r } = await
|
|
8350
|
+
const { internalHTML: o, externalHTML: n, plainText: r } = await vt(t, e);
|
|
8289
8351
|
i.dataTransfer.setData("blocknote/html", o), i.dataTransfer.setData("text/html", n), i.dataTransfer.setData("text/plain", r);
|
|
8290
8352
|
})(), !0;
|
|
8291
8353
|
}
|
|
@@ -8300,12 +8362,12 @@ const Sn = (e) => T.create({
|
|
|
8300
8362
|
"text/html",
|
|
8301
8363
|
"text/plain"
|
|
8302
8364
|
];
|
|
8303
|
-
function
|
|
8365
|
+
function In(e, t) {
|
|
8304
8366
|
if (!e.startsWith(".") || !t.startsWith("."))
|
|
8305
8367
|
throw new Error("The strings provided are not valid file extensions.");
|
|
8306
8368
|
return e === t;
|
|
8307
8369
|
}
|
|
8308
|
-
function
|
|
8370
|
+
function An(e, t) {
|
|
8309
8371
|
const i = e.split("/"), o = t.split("/");
|
|
8310
8372
|
if (i.length !== 2)
|
|
8311
8373
|
throw new Error(`The string ${e} is not a valid MIME type.`);
|
|
@@ -8313,7 +8375,7 @@ function Tn(e, t) {
|
|
|
8313
8375
|
throw new Error(`The string ${t} is not a valid MIME type.`);
|
|
8314
8376
|
return i[1] === "*" || o[1] === "*" ? i[0] === o[0] : (i[0] === "*" || o[0] === "*" || i[0] === o[0]) && i[1] === o[1];
|
|
8315
8377
|
}
|
|
8316
|
-
async function
|
|
8378
|
+
async function xt(e, t) {
|
|
8317
8379
|
if (!t.uploadFile)
|
|
8318
8380
|
return;
|
|
8319
8381
|
const i = "dataTransfer" in e ? e.dataTransfer : e.clipboardData;
|
|
@@ -8339,7 +8401,7 @@ async function yt(e, t) {
|
|
|
8339
8401
|
for (const d of r)
|
|
8340
8402
|
for (const u of d.fileBlockAccept || []) {
|
|
8341
8403
|
const p = u.startsWith("."), h = n[a].getAsFile();
|
|
8342
|
-
if (h && (!p && h.type &&
|
|
8404
|
+
if (h && (!p && h.type && An(n[a].type, u) || p && In(
|
|
8343
8405
|
"." + h.name.split(".").pop(),
|
|
8344
8406
|
u
|
|
8345
8407
|
))) {
|
|
@@ -8349,85 +8411,98 @@ async function yt(e, t) {
|
|
|
8349
8411
|
}
|
|
8350
8412
|
const l = n[a].getAsFile();
|
|
8351
8413
|
if (l) {
|
|
8352
|
-
const d =
|
|
8414
|
+
const d = {
|
|
8353
8415
|
type: s,
|
|
8354
8416
|
props: {
|
|
8355
|
-
name: l.name
|
|
8356
|
-
url: d
|
|
8417
|
+
name: l.name
|
|
8357
8418
|
}
|
|
8358
|
-
}
|
|
8359
|
-
|
|
8360
|
-
|
|
8361
|
-
t.
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
|
|
8419
|
+
};
|
|
8420
|
+
let u;
|
|
8421
|
+
if (e.type === "paste")
|
|
8422
|
+
u = t.insertBlocks(
|
|
8423
|
+
[d],
|
|
8424
|
+
t.getTextCursorPosition().block,
|
|
8425
|
+
"after"
|
|
8426
|
+
)[0].id;
|
|
8427
|
+
else if (e.type === "drop") {
|
|
8428
|
+
const m = {
|
|
8365
8429
|
left: e.clientX,
|
|
8366
8430
|
top: e.clientY
|
|
8367
|
-
},
|
|
8368
|
-
if (!
|
|
8431
|
+
}, f = t._tiptapEditor.view.posAtCoords(m);
|
|
8432
|
+
if (!f)
|
|
8369
8433
|
return;
|
|
8370
|
-
const
|
|
8434
|
+
const g = _(
|
|
8371
8435
|
t._tiptapEditor.state.doc,
|
|
8372
|
-
|
|
8436
|
+
f.pos
|
|
8373
8437
|
);
|
|
8374
|
-
t.insertBlocks(
|
|
8375
|
-
|
|
8438
|
+
u = t.insertBlocks(
|
|
8439
|
+
[d],
|
|
8440
|
+
g.id,
|
|
8441
|
+
"after"
|
|
8442
|
+
)[0].id;
|
|
8443
|
+
} else
|
|
8444
|
+
return;
|
|
8445
|
+
const p = await t.uploadFile(l, u), h = typeof p == "string" ? {
|
|
8446
|
+
props: {
|
|
8447
|
+
url: p
|
|
8448
|
+
}
|
|
8449
|
+
} : { ...p };
|
|
8450
|
+
t.updateBlock(u, h);
|
|
8376
8451
|
}
|
|
8377
8452
|
}
|
|
8378
8453
|
}
|
|
8379
|
-
const
|
|
8380
|
-
name: "
|
|
8454
|
+
const Nn = (e) => I.create({
|
|
8455
|
+
name: "dropFile",
|
|
8381
8456
|
addProseMirrorPlugins() {
|
|
8382
8457
|
return [
|
|
8383
|
-
new
|
|
8458
|
+
new x({
|
|
8384
8459
|
props: {
|
|
8385
8460
|
handleDOMEvents: {
|
|
8386
|
-
|
|
8387
|
-
if (
|
|
8461
|
+
drop(t, i) {
|
|
8462
|
+
if (!e.isEditable)
|
|
8388
8463
|
return;
|
|
8389
8464
|
let o = null;
|
|
8390
|
-
for (const
|
|
8391
|
-
if (i.
|
|
8392
|
-
o =
|
|
8465
|
+
for (const n of Ae)
|
|
8466
|
+
if (i.dataTransfer.types.includes(n)) {
|
|
8467
|
+
o = n;
|
|
8393
8468
|
break;
|
|
8394
8469
|
}
|
|
8395
|
-
|
|
8396
|
-
return !0;
|
|
8397
|
-
if (o === "Files")
|
|
8398
|
-
return yt(i, e), !0;
|
|
8399
|
-
let n = i.clipboardData.getData(o);
|
|
8400
|
-
return o === "text/html" && (n = bt(n.trim()).innerHTML), e._tiptapEditor.view.pasteHTML(n), !0;
|
|
8470
|
+
return o === null ? !0 : o === "Files" ? (xt(i, e), !0) : !1;
|
|
8401
8471
|
}
|
|
8402
8472
|
}
|
|
8403
8473
|
}
|
|
8404
8474
|
})
|
|
8405
8475
|
];
|
|
8406
8476
|
}
|
|
8407
|
-
}),
|
|
8408
|
-
name: "
|
|
8477
|
+
}), Pn = (e) => I.create({
|
|
8478
|
+
name: "pasteFromClipboard",
|
|
8409
8479
|
addProseMirrorPlugins() {
|
|
8410
8480
|
return [
|
|
8411
|
-
new
|
|
8481
|
+
new x({
|
|
8412
8482
|
props: {
|
|
8413
8483
|
handleDOMEvents: {
|
|
8414
|
-
|
|
8415
|
-
if (!e.isEditable)
|
|
8484
|
+
paste(t, i) {
|
|
8485
|
+
if (i.preventDefault(), !e.isEditable)
|
|
8416
8486
|
return;
|
|
8417
8487
|
let o = null;
|
|
8418
|
-
for (const
|
|
8419
|
-
if (i.
|
|
8420
|
-
o =
|
|
8488
|
+
for (const r of Ae)
|
|
8489
|
+
if (i.clipboardData.types.includes(r)) {
|
|
8490
|
+
o = r;
|
|
8421
8491
|
break;
|
|
8422
8492
|
}
|
|
8423
|
-
|
|
8493
|
+
if (o === null)
|
|
8494
|
+
return !0;
|
|
8495
|
+
if (o === "Files")
|
|
8496
|
+
return xt(i, e), !0;
|
|
8497
|
+
let n = i.clipboardData.getData(o);
|
|
8498
|
+
return o === "text/html" && (n = kt(n.trim()).innerHTML), e._tiptapEditor.view.pasteHTML(n), !0;
|
|
8424
8499
|
}
|
|
8425
8500
|
}
|
|
8426
8501
|
}
|
|
8427
8502
|
})
|
|
8428
8503
|
];
|
|
8429
8504
|
}
|
|
8430
|
-
}),
|
|
8505
|
+
}), Hn = I.create({
|
|
8431
8506
|
name: "blockBackgroundColor",
|
|
8432
8507
|
addGlobalAttributes() {
|
|
8433
8508
|
return [
|
|
@@ -8435,9 +8510,9 @@ const Bn = (e) => T.create({
|
|
|
8435
8510
|
types: ["blockContainer"],
|
|
8436
8511
|
attributes: {
|
|
8437
8512
|
backgroundColor: {
|
|
8438
|
-
default:
|
|
8439
|
-
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") :
|
|
8440
|
-
renderHTML: (e) => e.backgroundColor ===
|
|
8513
|
+
default: w.backgroundColor.default,
|
|
8514
|
+
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : w.backgroundColor.default,
|
|
8515
|
+
renderHTML: (e) => e.backgroundColor === w.backgroundColor.default ? {} : {
|
|
8441
8516
|
"data-background-color": e.backgroundColor
|
|
8442
8517
|
}
|
|
8443
8518
|
}
|
|
@@ -8445,7 +8520,7 @@ const Bn = (e) => T.create({
|
|
|
8445
8520
|
}
|
|
8446
8521
|
];
|
|
8447
8522
|
}
|
|
8448
|
-
}),
|
|
8523
|
+
}), Un = I.create({
|
|
8449
8524
|
name: "textAlignment",
|
|
8450
8525
|
addGlobalAttributes() {
|
|
8451
8526
|
return [
|
|
@@ -8471,7 +8546,7 @@ const Bn = (e) => T.create({
|
|
|
8471
8546
|
}
|
|
8472
8547
|
];
|
|
8473
8548
|
}
|
|
8474
|
-
}),
|
|
8549
|
+
}), Dn = I.create({
|
|
8475
8550
|
name: "blockTextColor",
|
|
8476
8551
|
addGlobalAttributes() {
|
|
8477
8552
|
return [
|
|
@@ -8479,9 +8554,9 @@ const Bn = (e) => T.create({
|
|
|
8479
8554
|
types: ["blockContainer"],
|
|
8480
8555
|
attributes: {
|
|
8481
8556
|
textColor: {
|
|
8482
|
-
default:
|
|
8483
|
-
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") :
|
|
8484
|
-
renderHTML: (e) => e.textColor ===
|
|
8557
|
+
default: w.textColor.default,
|
|
8558
|
+
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : w.textColor.default,
|
|
8559
|
+
renderHTML: (e) => e.textColor === w.textColor.default ? {} : {
|
|
8485
8560
|
"data-text-color": e.textColor
|
|
8486
8561
|
}
|
|
8487
8562
|
}
|
|
@@ -8489,12 +8564,12 @@ const Bn = (e) => T.create({
|
|
|
8489
8564
|
}
|
|
8490
8565
|
];
|
|
8491
8566
|
}
|
|
8492
|
-
}),
|
|
8567
|
+
}), jn = I.create({
|
|
8493
8568
|
name: "trailingNode",
|
|
8494
8569
|
addProseMirrorPlugins() {
|
|
8495
|
-
const e = new
|
|
8570
|
+
const e = new L(this.name);
|
|
8496
8571
|
return [
|
|
8497
|
-
new
|
|
8572
|
+
new x({
|
|
8498
8573
|
key: e,
|
|
8499
8574
|
appendTransaction: (t, i, o) => {
|
|
8500
8575
|
const { doc: n, tr: r, schema: a } = o, s = e.getState(o), l = n.content.size - 2, d = a.nodes.blockContainer, u = a.nodes.paragraph;
|
|
@@ -8524,8 +8599,8 @@ const Bn = (e) => T.create({
|
|
|
8524
8599
|
})
|
|
8525
8600
|
];
|
|
8526
8601
|
}
|
|
8527
|
-
}),
|
|
8528
|
-
key:
|
|
8602
|
+
}), zn = new L("non-editable-block"), Vn = () => new x({
|
|
8603
|
+
key: zn,
|
|
8529
8604
|
props: {
|
|
8530
8605
|
handleKeyDown: (e, t) => {
|
|
8531
8606
|
if ("node" in e.state.selection) {
|
|
@@ -8540,7 +8615,7 @@ const Bn = (e) => T.create({
|
|
|
8540
8615
|
e.state.tr.selection.$to.after(),
|
|
8541
8616
|
e.state.schema.nodes.paragraph.create()
|
|
8542
8617
|
).setSelection(
|
|
8543
|
-
new
|
|
8618
|
+
new Y(
|
|
8544
8619
|
i.doc.resolve(e.state.tr.selection.$to.after() + 1)
|
|
8545
8620
|
)
|
|
8546
8621
|
)
|
|
@@ -8550,99 +8625,13 @@ const Bn = (e) => T.create({
|
|
|
8550
8625
|
return !1;
|
|
8551
8626
|
}
|
|
8552
8627
|
}
|
|
8553
|
-
}),
|
|
8554
|
-
// Numbered List Items
|
|
8555
|
-
index: "index",
|
|
8556
|
-
// Headings
|
|
8557
|
-
level: "level",
|
|
8558
|
-
// All Blocks
|
|
8559
|
-
type: "type",
|
|
8560
|
-
depth: "depth",
|
|
8561
|
-
"depth-change": "depth-change"
|
|
8562
|
-
}, jn = () => {
|
|
8563
|
-
let e;
|
|
8564
|
-
return new w({
|
|
8565
|
-
key: Ze,
|
|
8566
|
-
view(t) {
|
|
8567
|
-
return {
|
|
8568
|
-
update: async (i, o) => {
|
|
8569
|
-
var n;
|
|
8570
|
-
((n = this.key) == null ? void 0 : n.getState(i.state).updatedBlocks.size) > 0 && (e = setTimeout(() => {
|
|
8571
|
-
i.dispatch(
|
|
8572
|
-
i.state.tr.setMeta(Ze, { clearUpdate: !0 })
|
|
8573
|
-
);
|
|
8574
|
-
}, 0));
|
|
8575
|
-
},
|
|
8576
|
-
destroy: () => {
|
|
8577
|
-
e && clearTimeout(e);
|
|
8578
|
-
}
|
|
8579
|
-
};
|
|
8580
|
-
},
|
|
8581
|
-
state: {
|
|
8582
|
-
init() {
|
|
8583
|
-
return {
|
|
8584
|
-
// Block attributes, by block ID, from just before the previous transaction.
|
|
8585
|
-
prevTransactionOldBlockAttrs: {},
|
|
8586
|
-
// Block attributes, by block ID, from just before the current transaction.
|
|
8587
|
-
currentTransactionOldBlockAttrs: {},
|
|
8588
|
-
// Set of IDs of blocks whose attributes changed from the current transaction.
|
|
8589
|
-
updatedBlocks: /* @__PURE__ */ new Set()
|
|
8590
|
-
};
|
|
8591
|
-
},
|
|
8592
|
-
apply(t, i, o, n) {
|
|
8593
|
-
if (i.currentTransactionOldBlockAttrs = {}, i.updatedBlocks.clear(), !t.docChanged || o.doc.eq(n.doc))
|
|
8594
|
-
return i;
|
|
8595
|
-
const r = {}, a = je(o.doc, (d) => d.attrs.id), s = new Map(
|
|
8596
|
-
a.map((d) => [d.node.attrs.id, d])
|
|
8597
|
-
), l = je(n.doc, (d) => d.attrs.id);
|
|
8598
|
-
for (const d of l) {
|
|
8599
|
-
const u = s.get(d.node.attrs.id), p = u == null ? void 0 : u.node.firstChild, h = d.node.firstChild;
|
|
8600
|
-
if (u && p && h) {
|
|
8601
|
-
const m = {
|
|
8602
|
-
index: h.attrs.index,
|
|
8603
|
-
level: h.attrs.level,
|
|
8604
|
-
type: h.type.name,
|
|
8605
|
-
depth: n.doc.resolve(d.pos).depth
|
|
8606
|
-
};
|
|
8607
|
-
let g = {
|
|
8608
|
-
index: p.attrs.index,
|
|
8609
|
-
level: p.attrs.level,
|
|
8610
|
-
type: p.type.name,
|
|
8611
|
-
depth: o.doc.resolve(u.pos).depth
|
|
8612
|
-
};
|
|
8613
|
-
r[d.node.attrs.id] = g, t.getMeta("numberedListIndexing") && (d.node.attrs.id in i.prevTransactionOldBlockAttrs && (g = i.prevTransactionOldBlockAttrs[d.node.attrs.id]), m.type === "numberedListItem" && (g.index = m.index)), i.currentTransactionOldBlockAttrs[d.node.attrs.id] = g, JSON.stringify(g) !== JSON.stringify(m) && (g["depth-change"] = g.depth - m.depth, i.updatedBlocks.add(d.node.attrs.id));
|
|
8614
|
-
}
|
|
8615
|
-
}
|
|
8616
|
-
return i.prevTransactionOldBlockAttrs = r, i;
|
|
8617
|
-
}
|
|
8618
|
-
},
|
|
8619
|
-
props: {
|
|
8620
|
-
decorations(t) {
|
|
8621
|
-
const i = this.getState(t);
|
|
8622
|
-
if (i.updatedBlocks.size === 0)
|
|
8623
|
-
return;
|
|
8624
|
-
const o = [];
|
|
8625
|
-
return t.doc.descendants((n, r) => {
|
|
8626
|
-
if (!n.attrs.id || !i.updatedBlocks.has(n.attrs.id))
|
|
8627
|
-
return;
|
|
8628
|
-
const a = i.currentTransactionOldBlockAttrs[n.attrs.id], s = {};
|
|
8629
|
-
for (const [d, u] of Object.entries(a))
|
|
8630
|
-
s["data-prev-" + Un[d]] = u || "none";
|
|
8631
|
-
const l = W.node(r, r + n.nodeSize, {
|
|
8632
|
-
...s
|
|
8633
|
-
});
|
|
8634
|
-
o.push(l);
|
|
8635
|
-
}), K.create(t.doc, o);
|
|
8636
|
-
}
|
|
8637
|
-
}
|
|
8638
|
-
});
|
|
8639
|
-
}, zn = {
|
|
8628
|
+
}), Rn = {
|
|
8640
8629
|
blockColor: "data-block-color",
|
|
8641
8630
|
blockStyle: "data-block-style",
|
|
8642
8631
|
id: "data-id",
|
|
8643
8632
|
depth: "data-depth",
|
|
8644
8633
|
depthChange: "data-depth-change"
|
|
8645
|
-
},
|
|
8634
|
+
}, On = q.create({
|
|
8646
8635
|
name: "blockContainer",
|
|
8647
8636
|
group: "blockContainer",
|
|
8648
8637
|
// A block always contains content, and optionally a blockGroup which contains nested blocks
|
|
@@ -8658,7 +8647,7 @@ const Bn = (e) => T.create({
|
|
|
8658
8647
|
if (typeof e == "string")
|
|
8659
8648
|
return !1;
|
|
8660
8649
|
const t = {};
|
|
8661
|
-
for (const [i, o] of Object.entries(
|
|
8650
|
+
for (const [i, o] of Object.entries(Rn))
|
|
8662
8651
|
e.getAttribute(o) && (t[i] = e.getAttribute(o));
|
|
8663
8652
|
return e.getAttribute("data-node-type") === "blockContainer" ? t : !1;
|
|
8664
8653
|
}
|
|
@@ -8675,7 +8664,7 @@ const Bn = (e) => T.create({
|
|
|
8675
8664
|
...((n = this.options.domAttributes) == null ? void 0 : n.block) || {},
|
|
8676
8665
|
...e
|
|
8677
8666
|
}, o = document.createElement("div");
|
|
8678
|
-
o.className =
|
|
8667
|
+
o.className = R("bn-block", i.class), o.setAttribute("data-node-type", this.name);
|
|
8679
8668
|
for (const [r, a] of Object.entries(i))
|
|
8680
8669
|
r !== "class" && o.setAttribute(r, a);
|
|
8681
8670
|
return t.appendChild(o), {
|
|
@@ -8709,7 +8698,7 @@ const Bn = (e) => T.create({
|
|
|
8709
8698
|
const h = [];
|
|
8710
8699
|
for (const m of t.children)
|
|
8711
8700
|
h.push(
|
|
8712
|
-
|
|
8701
|
+
U(
|
|
8713
8702
|
m,
|
|
8714
8703
|
i.schema,
|
|
8715
8704
|
this.options.editor.schema.styleSchema
|
|
@@ -8718,7 +8707,7 @@ const Bn = (e) => T.create({
|
|
|
8718
8707
|
s.childCount === 2 ? i.tr.replace(
|
|
8719
8708
|
r + l.nodeSize + 1,
|
|
8720
8709
|
a - 1,
|
|
8721
|
-
new
|
|
8710
|
+
new z(N.from(h), 0, 0)
|
|
8722
8711
|
) : i.tr.insert(
|
|
8723
8712
|
r + l.nodeSize,
|
|
8724
8713
|
i.schema.nodes.blockGroup.create({}, h)
|
|
@@ -8728,25 +8717,25 @@ const Bn = (e) => T.create({
|
|
|
8728
8717
|
let p = "keep";
|
|
8729
8718
|
if (t.content)
|
|
8730
8719
|
if (typeof t.content == "string")
|
|
8731
|
-
p =
|
|
8720
|
+
p = V(
|
|
8732
8721
|
[t.content],
|
|
8733
8722
|
i.schema,
|
|
8734
8723
|
this.options.editor.schema.styleSchema
|
|
8735
8724
|
);
|
|
8736
8725
|
else if (Array.isArray(t.content))
|
|
8737
|
-
p =
|
|
8726
|
+
p = V(
|
|
8738
8727
|
t.content,
|
|
8739
8728
|
i.schema,
|
|
8740
8729
|
this.options.editor.schema.styleSchema
|
|
8741
8730
|
);
|
|
8742
8731
|
else if (t.content.type === "tableContent")
|
|
8743
|
-
p =
|
|
8732
|
+
p = it(
|
|
8744
8733
|
t.content,
|
|
8745
8734
|
i.schema,
|
|
8746
8735
|
this.options.editor.schema.styleSchema
|
|
8747
8736
|
);
|
|
8748
8737
|
else
|
|
8749
|
-
throw new
|
|
8738
|
+
throw new P(t.content.type);
|
|
8750
8739
|
else {
|
|
8751
8740
|
const h = i.schema.nodes[d].spec.content, m = i.schema.nodes[u].spec.content;
|
|
8752
8741
|
h === "" || m !== h && (p = []);
|
|
@@ -8769,11 +8758,11 @@ const Bn = (e) => T.create({
|
|
|
8769
8758
|
p
|
|
8770
8759
|
)
|
|
8771
8760
|
).setSelection(
|
|
8772
|
-
i.schema.nodes[u].spec.content === "" ? new
|
|
8761
|
+
i.schema.nodes[u].spec.content === "" ? new le(i.tr.doc.resolve(r)) : i.schema.nodes[u].spec.content === "inline*" ? new Y(i.tr.doc.resolve(r)) : (
|
|
8773
8762
|
// Need to offset the position as we have to get through the
|
|
8774
8763
|
// `tableRow` and `tableCell` nodes to get to the
|
|
8775
8764
|
// `tableParagraph` node we want to set the selection in.
|
|
8776
|
-
new
|
|
8765
|
+
new Y(i.tr.doc.resolve(r + 4))
|
|
8777
8766
|
)
|
|
8778
8767
|
), i.tr.setNodeMarkup(r - 1, void 0, {
|
|
8779
8768
|
...s.attrs,
|
|
@@ -8810,8 +8799,8 @@ const Bn = (e) => T.create({
|
|
|
8810
8799
|
if (a.childCount === 2) {
|
|
8811
8800
|
const m = t.doc.resolve(
|
|
8812
8801
|
l + s.nodeSize + 1
|
|
8813
|
-
),
|
|
8814
|
-
i && t.tr.lift(
|
|
8802
|
+
), f = t.doc.resolve(d - 1), g = m.blockRange(f);
|
|
8803
|
+
i && t.tr.lift(g, u - 1);
|
|
8815
8804
|
}
|
|
8816
8805
|
let p = e - 1, h = _(t.doc, p);
|
|
8817
8806
|
for (; h.numChildBlocks > 0; )
|
|
@@ -8821,10 +8810,10 @@ const Bn = (e) => T.create({
|
|
|
8821
8810
|
t.tr.deleteRange(l, l + s.nodeSize).replace(
|
|
8822
8811
|
p - 1,
|
|
8823
8812
|
l,
|
|
8824
|
-
new
|
|
8813
|
+
new z(s.content, 0, 0)
|
|
8825
8814
|
).scrollIntoView()
|
|
8826
8815
|
), t.tr.setSelection(
|
|
8827
|
-
new
|
|
8816
|
+
new Y(t.doc.resolve(p - 1))
|
|
8828
8817
|
)), !0;
|
|
8829
8818
|
},
|
|
8830
8819
|
// Splits a block at a given position. Content after the position is moved to a new block below, at the same
|
|
@@ -8837,27 +8826,27 @@ const Bn = (e) => T.create({
|
|
|
8837
8826
|
const r = _(o.doc, e);
|
|
8838
8827
|
if (r === void 0)
|
|
8839
8828
|
return !1;
|
|
8840
|
-
const { contentNode: a, contentType: s, startPos: l, endPos: d, depth: u } = r, p = o.doc.cut(l + 1, e), h = o.doc.cut(e, d - 1), m = o.schema.nodes.blockContainer.createAndFill(),
|
|
8841
|
-
return n && (o.tr.insert(
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
h.content.size > 0 ? new
|
|
8845
|
-
|
|
8829
|
+
const { contentNode: a, contentType: s, startPos: l, endPos: d, depth: u } = r, p = o.doc.cut(l + 1, e), h = o.doc.cut(e, d - 1), m = o.schema.nodes.blockContainer.createAndFill(), f = d + 1, g = f + 2;
|
|
8830
|
+
return n && (o.tr.insert(f, m), o.tr.replace(
|
|
8831
|
+
g,
|
|
8832
|
+
g + 1,
|
|
8833
|
+
h.content.size > 0 ? new z(
|
|
8834
|
+
N.from(h),
|
|
8846
8835
|
u + 2,
|
|
8847
8836
|
u + 2
|
|
8848
8837
|
) : void 0
|
|
8849
8838
|
), t && o.tr.setBlockType(
|
|
8850
|
-
|
|
8851
|
-
|
|
8839
|
+
g,
|
|
8840
|
+
g,
|
|
8852
8841
|
o.schema.node(s).type,
|
|
8853
8842
|
i ? a.attrs : void 0
|
|
8854
8843
|
), o.tr.setSelection(
|
|
8855
|
-
new
|
|
8844
|
+
new Y(o.doc.resolve(g))
|
|
8856
8845
|
), o.tr.replace(
|
|
8857
8846
|
l + 1,
|
|
8858
8847
|
d - 1,
|
|
8859
|
-
p.content.size > 0 ? new
|
|
8860
|
-
|
|
8848
|
+
p.content.size > 0 ? new z(
|
|
8849
|
+
N.from(p),
|
|
8861
8850
|
u + 2,
|
|
8862
8851
|
u + 2
|
|
8863
8852
|
) : void 0
|
|
@@ -8866,7 +8855,7 @@ const Bn = (e) => T.create({
|
|
|
8866
8855
|
};
|
|
8867
8856
|
},
|
|
8868
8857
|
addProseMirrorPlugins() {
|
|
8869
|
-
return [
|
|
8858
|
+
return [Vn()];
|
|
8870
8859
|
},
|
|
8871
8860
|
addKeyboardShortcuts() {
|
|
8872
8861
|
return {
|
|
@@ -8916,9 +8905,9 @@ const Bn = (e) => T.create({
|
|
|
8916
8905
|
n.selection.from
|
|
8917
8906
|
), l = s === n.doc.nodeSize - 4, d = n.selection.from === s - 1, u = n.selection.empty, p = r.childCount === 2;
|
|
8918
8907
|
if (!l && d && u && !p) {
|
|
8919
|
-
let h = a, m = s + 2,
|
|
8920
|
-
for (;
|
|
8921
|
-
h =
|
|
8908
|
+
let h = a, m = s + 2, f = n.doc.resolve(m).depth;
|
|
8909
|
+
for (; f < h; )
|
|
8910
|
+
h = f, m += 2, f = n.doc.resolve(m).depth;
|
|
8922
8911
|
return o.BNMergeBlocks(m - 1);
|
|
8923
8912
|
}
|
|
8924
8913
|
return !1;
|
|
@@ -8973,7 +8962,7 @@ const Bn = (e) => T.create({
|
|
|
8973
8962
|
}
|
|
8974
8963
|
};
|
|
8975
8964
|
}
|
|
8976
|
-
}),
|
|
8965
|
+
}), Fn = q.create({
|
|
8977
8966
|
name: "blockGroup",
|
|
8978
8967
|
group: "blockGroup",
|
|
8979
8968
|
content: "blockContainer+",
|
|
@@ -8991,7 +8980,7 @@ const Bn = (e) => T.create({
|
|
|
8991
8980
|
...((o = this.options.domAttributes) == null ? void 0 : o.blockGroup) || {},
|
|
8992
8981
|
...e
|
|
8993
8982
|
}, i = document.createElement("div");
|
|
8994
|
-
i.className =
|
|
8983
|
+
i.className = R(
|
|
8995
8984
|
"bn-block-group",
|
|
8996
8985
|
t.class
|
|
8997
8986
|
), i.setAttribute("data-node-type", "blockGroup");
|
|
@@ -9002,30 +8991,31 @@ const Bn = (e) => T.create({
|
|
|
9002
8991
|
contentDOM: i
|
|
9003
8992
|
};
|
|
9004
8993
|
}
|
|
9005
|
-
}),
|
|
8994
|
+
}), Gn = q.create({
|
|
9006
8995
|
name: "doc",
|
|
9007
8996
|
topNode: !0,
|
|
9008
8997
|
content: "blockGroup"
|
|
9009
|
-
}),
|
|
8998
|
+
}), Wn = (e) => {
|
|
9010
8999
|
var o;
|
|
9011
9000
|
const t = [
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
|
|
9001
|
+
J.ClipboardTextSerializer,
|
|
9002
|
+
J.Commands,
|
|
9003
|
+
J.Editable,
|
|
9004
|
+
J.FocusEvents,
|
|
9005
|
+
J.Tabindex,
|
|
9017
9006
|
// DevTools,
|
|
9018
|
-
|
|
9007
|
+
li,
|
|
9019
9008
|
// DropCursor,
|
|
9020
|
-
|
|
9021
|
-
types: ["blockContainer"]
|
|
9009
|
+
oe.configure({
|
|
9010
|
+
types: ["blockContainer"],
|
|
9011
|
+
setIdAttribute: e.setIdAttribute
|
|
9022
9012
|
}),
|
|
9023
|
-
|
|
9013
|
+
di.extend({ priority: 10 }),
|
|
9024
9014
|
// Comments,
|
|
9025
9015
|
// basics:
|
|
9026
|
-
|
|
9016
|
+
pi,
|
|
9027
9017
|
// marks:
|
|
9028
|
-
|
|
9018
|
+
ui.extend({
|
|
9029
9019
|
addKeyboardShortcuts() {
|
|
9030
9020
|
return {
|
|
9031
9021
|
"Mod-k": () => (this.editor.commands.toggleLink({ href: "" }), !0)
|
|
@@ -9033,11 +9023,11 @@ const Bn = (e) => T.create({
|
|
|
9033
9023
|
}
|
|
9034
9024
|
}),
|
|
9035
9025
|
...Object.values(e.styleSpecs).map((n) => n.implementation.mark),
|
|
9036
|
-
|
|
9037
|
-
|
|
9038
|
-
|
|
9026
|
+
Dn,
|
|
9027
|
+
Hn,
|
|
9028
|
+
Un,
|
|
9039
9029
|
// make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)
|
|
9040
|
-
|
|
9030
|
+
I.create({
|
|
9041
9031
|
name: "OverrideEscape",
|
|
9042
9032
|
addKeyboardShortcuts() {
|
|
9043
9033
|
return {
|
|
@@ -9046,12 +9036,12 @@ const Bn = (e) => T.create({
|
|
|
9046
9036
|
}
|
|
9047
9037
|
}),
|
|
9048
9038
|
// nodes
|
|
9049
|
-
|
|
9050
|
-
|
|
9039
|
+
Gn,
|
|
9040
|
+
On.configure({
|
|
9051
9041
|
editor: e.editor,
|
|
9052
9042
|
domAttributes: e.domAttributes
|
|
9053
9043
|
}),
|
|
9054
|
-
|
|
9044
|
+
Fn.configure({
|
|
9055
9045
|
domAttributes: e.domAttributes
|
|
9056
9046
|
}),
|
|
9057
9047
|
...Object.values(e.inlineContentSpecs).filter((n) => n.config !== "link" && n.config !== "text").map((n) => n.implementation.node.configure({
|
|
@@ -9071,17 +9061,17 @@ const Bn = (e) => T.create({
|
|
|
9071
9061
|
domAttributes: e.domAttributes
|
|
9072
9062
|
})
|
|
9073
9063
|
]),
|
|
9074
|
-
Sn(e.editor),
|
|
9075
|
-
Bn(e.editor),
|
|
9076
9064
|
Ln(e.editor),
|
|
9077
|
-
|
|
9065
|
+
Pn(e.editor),
|
|
9066
|
+
Nn(e.editor),
|
|
9067
|
+
si.configure({ width: 5, color: "#ddeeff" }),
|
|
9078
9068
|
// This needs to be at the bottom of this list, because Key events (such as enter, when selecting a /command),
|
|
9079
9069
|
// should be handled before Enter handlers in other components like splitListItem
|
|
9080
|
-
...e.trailingBlock === void 0 || e.trailingBlock ? [
|
|
9070
|
+
...e.trailingBlock === void 0 || e.trailingBlock ? [jn] : []
|
|
9081
9071
|
];
|
|
9082
9072
|
if (e.collaboration) {
|
|
9083
9073
|
if (t.push(
|
|
9084
|
-
|
|
9074
|
+
ri.configure({
|
|
9085
9075
|
fragment: e.collaboration.fragment
|
|
9086
9076
|
})
|
|
9087
9077
|
), (o = e.collaboration.provider) != null && o.awareness) {
|
|
@@ -9094,7 +9084,7 @@ const Bn = (e) => T.create({
|
|
|
9094
9084
|
return a.insertBefore(l, null), a.insertBefore(s, null), a.insertBefore(d, null), a;
|
|
9095
9085
|
};
|
|
9096
9086
|
t.push(
|
|
9097
|
-
|
|
9087
|
+
ai.configure({
|
|
9098
9088
|
user: e.collaboration.user,
|
|
9099
9089
|
render: e.collaboration.renderCursor || n,
|
|
9100
9090
|
provider: e.collaboration.provider
|
|
@@ -9102,24 +9092,24 @@ const Bn = (e) => T.create({
|
|
|
9102
9092
|
);
|
|
9103
9093
|
}
|
|
9104
9094
|
} else
|
|
9105
|
-
t.push(
|
|
9095
|
+
t.push(ci);
|
|
9106
9096
|
const i = e.disableExtensions || [];
|
|
9107
9097
|
return t.filter((n) => !i.includes(n.name));
|
|
9108
9098
|
};
|
|
9109
|
-
function
|
|
9099
|
+
function Kn(e, t) {
|
|
9110
9100
|
const i = [];
|
|
9111
9101
|
return e.forEach((o, n, r) => {
|
|
9112
9102
|
r !== t && i.push(o);
|
|
9113
|
-
}),
|
|
9103
|
+
}), N.from(i);
|
|
9114
9104
|
}
|
|
9115
|
-
function
|
|
9116
|
-
let i =
|
|
9105
|
+
function $n(e, t) {
|
|
9106
|
+
let i = N.from(e.content);
|
|
9117
9107
|
for (let o = 0; o < i.childCount; o++)
|
|
9118
9108
|
if (i.child(o).type.spec.group === "blockContent") {
|
|
9119
9109
|
const n = [i.child(o)];
|
|
9120
9110
|
if (o + 1 < i.childCount && i.child(o + 1).type.spec.group === "blockGroup") {
|
|
9121
9111
|
const a = i.child(o + 1).child(0).child(0);
|
|
9122
|
-
(a.type.name === "bulletListItem" || a.type.name === "numberedListItem" || a.type.name === "checkListItem") && (n.push(i.child(o + 1)), i =
|
|
9112
|
+
(a.type.name === "bulletListItem" || a.type.name === "numberedListItem" || a.type.name === "checkListItem") && (n.push(i.child(o + 1)), i = Kn(i, o + 1));
|
|
9123
9113
|
}
|
|
9124
9114
|
const r = t.state.schema.nodes.blockContainer.create(
|
|
9125
9115
|
void 0,
|
|
@@ -9127,9 +9117,9 @@ function Kn(e, t) {
|
|
|
9127
9117
|
);
|
|
9128
9118
|
i = i.replaceChild(o, r);
|
|
9129
9119
|
}
|
|
9130
|
-
return new
|
|
9120
|
+
return new z(i, e.openStart, e.openEnd);
|
|
9131
9121
|
}
|
|
9132
|
-
function
|
|
9122
|
+
function _e(e) {
|
|
9133
9123
|
return e && Object.fromEntries(
|
|
9134
9124
|
Object.entries(e).filter(([, t]) => t !== void 0)
|
|
9135
9125
|
);
|
|
@@ -9146,15 +9136,15 @@ class Ne {
|
|
|
9146
9136
|
c(this, "BlockNoteEditor", "only for types");
|
|
9147
9137
|
c(this, "Block", "only for types");
|
|
9148
9138
|
c(this, "PartialBlock", "only for types");
|
|
9149
|
-
this.blockSpecs =
|
|
9139
|
+
this.blockSpecs = _e(t == null ? void 0 : t.blockSpecs) || ft, this.inlineContentSpecs = _e(t == null ? void 0 : t.inlineContentSpecs) || bt, this.styleSpecs = _e(t == null ? void 0 : t.styleSpecs) || gt, this.blockSchema = dt(this.blockSpecs), this.inlineContentSchema = ct(
|
|
9150
9140
|
this.inlineContentSpecs
|
|
9151
|
-
), this.styleSchema =
|
|
9141
|
+
), this.styleSchema = pt(this.styleSpecs);
|
|
9152
9142
|
}
|
|
9153
9143
|
static create(t) {
|
|
9154
9144
|
return new Ne(t);
|
|
9155
9145
|
}
|
|
9156
9146
|
}
|
|
9157
|
-
class
|
|
9147
|
+
class Et extends Ft {
|
|
9158
9148
|
constructor(i, o) {
|
|
9159
9149
|
super({ ...i, content: void 0 });
|
|
9160
9150
|
c(this, "_state");
|
|
@@ -9173,14 +9163,14 @@ class wt extends Rt {
|
|
|
9173
9163
|
if (r)
|
|
9174
9164
|
return r;
|
|
9175
9165
|
const d = a.apply(n.nodes.doc, l), u = JSON.parse(JSON.stringify(d.toJSON()));
|
|
9176
|
-
return u.content[0].content[0].attrs.id = "initialBlockId", r =
|
|
9166
|
+
return u.content[0].content[0].attrs.id = "initialBlockId", r = At.fromJSON(n, u), r;
|
|
9177
9167
|
};
|
|
9178
9168
|
let s;
|
|
9179
9169
|
try {
|
|
9180
9170
|
const l = i == null ? void 0 : i.content.map(
|
|
9181
|
-
(d) =>
|
|
9171
|
+
(d) => U(d, this.schema, o).toJSON()
|
|
9182
9172
|
);
|
|
9183
|
-
s =
|
|
9173
|
+
s = Gt(
|
|
9184
9174
|
{
|
|
9185
9175
|
type: "doc",
|
|
9186
9176
|
content: [
|
|
@@ -9201,7 +9191,7 @@ class wt extends Rt {
|
|
|
9201
9191
|
"Error creating document from blocks passed as `initialContent`:\n" + +JSON.stringify(i.content)
|
|
9202
9192
|
);
|
|
9203
9193
|
}
|
|
9204
|
-
this._state =
|
|
9194
|
+
this._state = Kt.create({
|
|
9205
9195
|
doc: s,
|
|
9206
9196
|
schema: this.schema
|
|
9207
9197
|
// selection: selection || undefined,
|
|
@@ -9218,7 +9208,7 @@ class wt extends Rt {
|
|
|
9218
9208
|
*/
|
|
9219
9209
|
createViewAlternative() {
|
|
9220
9210
|
queueMicrotask(() => {
|
|
9221
|
-
this.view = new
|
|
9211
|
+
this.view = new ni(
|
|
9222
9212
|
{ mount: this.options.element },
|
|
9223
9213
|
// use mount option so that we reuse the existing element instead of creating a new one
|
|
9224
9214
|
{
|
|
@@ -9235,10 +9225,11 @@ class wt extends Rt {
|
|
|
9235
9225
|
});
|
|
9236
9226
|
}
|
|
9237
9227
|
}
|
|
9238
|
-
|
|
9228
|
+
Et.prototype.createView = function() {
|
|
9229
|
+
this.options.onPaste = this.options.onDrop = void 0;
|
|
9239
9230
|
};
|
|
9240
|
-
const
|
|
9241
|
-
key:
|
|
9231
|
+
const qn = new L("blocknote-placeholder"), Xn = (e, t) => new x({
|
|
9232
|
+
key: qn,
|
|
9242
9233
|
view: () => {
|
|
9243
9234
|
const i = document.createElement("style"), o = e._tiptapEditor.options.injectNonce;
|
|
9244
9235
|
o && i.setAttribute("nonce", o), e._tiptapEditor.view.root instanceof ShadowRoot ? e._tiptapEditor.view.root.append(i) : e._tiptapEditor.view.root.head.appendChild(i);
|
|
@@ -9276,18 +9267,104 @@ const Wn = new M("blocknote-placeholder"), $n = (e, t) => new w({
|
|
|
9276
9267
|
const r = n.$anchor, a = r.parent;
|
|
9277
9268
|
if (a.content.size > 0)
|
|
9278
9269
|
return null;
|
|
9279
|
-
const s = r.before(), l =
|
|
9270
|
+
const s = r.before(), l = $.node(s, s + a.nodeSize, {
|
|
9280
9271
|
"data-is-empty-and-focused": "true"
|
|
9281
9272
|
});
|
|
9282
9273
|
return K.create(o, [l]);
|
|
9283
9274
|
}
|
|
9284
9275
|
}
|
|
9285
|
-
}),
|
|
9276
|
+
}), Ye = new L("previous-blocks"), Zn = {
|
|
9277
|
+
// Numbered List Items
|
|
9278
|
+
index: "index",
|
|
9279
|
+
// Headings
|
|
9280
|
+
level: "level",
|
|
9281
|
+
// All Blocks
|
|
9282
|
+
type: "type",
|
|
9283
|
+
depth: "depth",
|
|
9284
|
+
"depth-change": "depth-change"
|
|
9285
|
+
}, Jn = () => {
|
|
9286
|
+
let e;
|
|
9287
|
+
return new x({
|
|
9288
|
+
key: Ye,
|
|
9289
|
+
view(t) {
|
|
9290
|
+
return {
|
|
9291
|
+
update: async (i, o) => {
|
|
9292
|
+
var n;
|
|
9293
|
+
((n = this.key) == null ? void 0 : n.getState(i.state).updatedBlocks.size) > 0 && (e = setTimeout(() => {
|
|
9294
|
+
i.dispatch(
|
|
9295
|
+
i.state.tr.setMeta(Ye, { clearUpdate: !0 })
|
|
9296
|
+
);
|
|
9297
|
+
}, 0));
|
|
9298
|
+
},
|
|
9299
|
+
destroy: () => {
|
|
9300
|
+
e && clearTimeout(e);
|
|
9301
|
+
}
|
|
9302
|
+
};
|
|
9303
|
+
},
|
|
9304
|
+
state: {
|
|
9305
|
+
init() {
|
|
9306
|
+
return {
|
|
9307
|
+
// Block attributes, by block ID, from just before the previous transaction.
|
|
9308
|
+
prevTransactionOldBlockAttrs: {},
|
|
9309
|
+
// Block attributes, by block ID, from just before the current transaction.
|
|
9310
|
+
currentTransactionOldBlockAttrs: {},
|
|
9311
|
+
// Set of IDs of blocks whose attributes changed from the current transaction.
|
|
9312
|
+
updatedBlocks: /* @__PURE__ */ new Set()
|
|
9313
|
+
};
|
|
9314
|
+
},
|
|
9315
|
+
apply(t, i, o, n) {
|
|
9316
|
+
if (i.currentTransactionOldBlockAttrs = {}, i.updatedBlocks.clear(), !t.docChanged || o.doc.eq(n.doc))
|
|
9317
|
+
return i;
|
|
9318
|
+
const r = {}, a = je(o.doc, (d) => d.attrs.id), s = new Map(
|
|
9319
|
+
a.map((d) => [d.node.attrs.id, d])
|
|
9320
|
+
), l = je(n.doc, (d) => d.attrs.id);
|
|
9321
|
+
for (const d of l) {
|
|
9322
|
+
const u = s.get(d.node.attrs.id), p = u == null ? void 0 : u.node.firstChild, h = d.node.firstChild;
|
|
9323
|
+
if (u && p && h) {
|
|
9324
|
+
const m = {
|
|
9325
|
+
index: h.attrs.index,
|
|
9326
|
+
level: h.attrs.level,
|
|
9327
|
+
type: h.type.name,
|
|
9328
|
+
depth: n.doc.resolve(d.pos).depth
|
|
9329
|
+
};
|
|
9330
|
+
let f = {
|
|
9331
|
+
index: p.attrs.index,
|
|
9332
|
+
level: p.attrs.level,
|
|
9333
|
+
type: p.type.name,
|
|
9334
|
+
depth: o.doc.resolve(u.pos).depth
|
|
9335
|
+
};
|
|
9336
|
+
r[d.node.attrs.id] = f, t.getMeta("numberedListIndexing") && (d.node.attrs.id in i.prevTransactionOldBlockAttrs && (f = i.prevTransactionOldBlockAttrs[d.node.attrs.id]), m.type === "numberedListItem" && (f.index = m.index)), i.currentTransactionOldBlockAttrs[d.node.attrs.id] = f, JSON.stringify(f) !== JSON.stringify(m) && (f["depth-change"] = f.depth - m.depth, i.updatedBlocks.add(d.node.attrs.id));
|
|
9337
|
+
}
|
|
9338
|
+
}
|
|
9339
|
+
return i.prevTransactionOldBlockAttrs = r, i;
|
|
9340
|
+
}
|
|
9341
|
+
},
|
|
9342
|
+
props: {
|
|
9343
|
+
decorations(t) {
|
|
9344
|
+
const i = this.getState(t);
|
|
9345
|
+
if (i.updatedBlocks.size === 0)
|
|
9346
|
+
return;
|
|
9347
|
+
const o = [];
|
|
9348
|
+
return t.doc.descendants((n, r) => {
|
|
9349
|
+
if (!n.attrs.id || !i.updatedBlocks.has(n.attrs.id))
|
|
9350
|
+
return;
|
|
9351
|
+
const a = i.currentTransactionOldBlockAttrs[n.attrs.id], s = {};
|
|
9352
|
+
for (const [d, u] of Object.entries(a))
|
|
9353
|
+
s["data-prev-" + Zn[d]] = u || "none";
|
|
9354
|
+
const l = $.node(r, r + n.nodeSize, {
|
|
9355
|
+
...s
|
|
9356
|
+
});
|
|
9357
|
+
o.push(l);
|
|
9358
|
+
}), K.create(t.doc, o);
|
|
9359
|
+
}
|
|
9360
|
+
}
|
|
9361
|
+
});
|
|
9362
|
+
}, Yn = {
|
|
9286
9363
|
enableInputRules: !0,
|
|
9287
9364
|
enablePasteRules: !0,
|
|
9288
9365
|
enableCoreExtensions: !1
|
|
9289
9366
|
};
|
|
9290
|
-
class
|
|
9367
|
+
class Ct {
|
|
9291
9368
|
constructor(t) {
|
|
9292
9369
|
c(this, "_pmSchema");
|
|
9293
9370
|
/**
|
|
@@ -9338,6 +9415,8 @@ class vt {
|
|
|
9338
9415
|
* @returns The URL of the uploaded file OR an object containing props that should be set on the file block (such as an id)
|
|
9339
9416
|
*/
|
|
9340
9417
|
c(this, "uploadFile");
|
|
9418
|
+
c(this, "onUploadStartCallbacks", []);
|
|
9419
|
+
c(this, "onUploadEndCallbacks", []);
|
|
9341
9420
|
c(this, "resolveFileUrl");
|
|
9342
9421
|
/**
|
|
9343
9422
|
* Mount the editor to a parent DOM element. Call mount(undefined) to clean up
|
|
@@ -9347,7 +9426,7 @@ class vt {
|
|
|
9347
9426
|
c(this, "mount", (t) => {
|
|
9348
9427
|
this._tiptapEditor.mount(t);
|
|
9349
9428
|
});
|
|
9350
|
-
var l, d, u, p, h, m,
|
|
9429
|
+
var l, d, u, p, h, m, f;
|
|
9351
9430
|
this.options = t;
|
|
9352
9431
|
const i = t;
|
|
9353
9432
|
if (i.onEditorContentChange)
|
|
@@ -9366,7 +9445,7 @@ class vt {
|
|
|
9366
9445
|
throw new Error(
|
|
9367
9446
|
"editable initialization option is deprecated, use <BlockNoteView editable={true/false} />, or alternatively editor.isEditable = true/false"
|
|
9368
9447
|
);
|
|
9369
|
-
this.dictionary = t.dictionary ||
|
|
9448
|
+
this.dictionary = t.dictionary || Qe;
|
|
9370
9449
|
const o = {
|
|
9371
9450
|
defaultStyles: !0,
|
|
9372
9451
|
schema: t.schema || Ne.create(),
|
|
@@ -9377,8 +9456,8 @@ class vt {
|
|
|
9377
9456
|
...t.placeholders
|
|
9378
9457
|
}
|
|
9379
9458
|
};
|
|
9380
|
-
this.schema = o.schema, this.blockImplementations = o.schema.blockSpecs, this.inlineContentImplementations = o.schema.inlineContentSpecs, this.styleImplementations = o.schema.styleSpecs, this.formattingToolbar = new
|
|
9381
|
-
const n =
|
|
9459
|
+
this.schema = o.schema, this.blockImplementations = o.schema.blockSpecs, this.inlineContentImplementations = o.schema.inlineContentSpecs, this.styleImplementations = o.schema.styleSpecs, this.formattingToolbar = new pn(this), this.linkToolbar = new fn(this), this.sideMenu = new wn(this), this.suggestionMenus = new En(this), this.filePanel = new dn(this), T("table", this) && (this.tableHandles = new Bn(this));
|
|
9460
|
+
const n = Wn({
|
|
9382
9461
|
editor: this,
|
|
9383
9462
|
domAttributes: o.domAttributes || {},
|
|
9384
9463
|
blockSpecs: this.schema.blockSpecs,
|
|
@@ -9386,8 +9465,9 @@ class vt {
|
|
|
9386
9465
|
inlineContentSpecs: this.schema.inlineContentSpecs,
|
|
9387
9466
|
collaboration: o.collaboration,
|
|
9388
9467
|
trailingBlock: o.trailingBlock,
|
|
9389
|
-
disableExtensions: o.disableExtensions
|
|
9390
|
-
|
|
9468
|
+
disableExtensions: o.disableExtensions,
|
|
9469
|
+
setIdAttribute: o.setIdAttribute
|
|
9470
|
+
}), r = I.create({
|
|
9391
9471
|
name: "BlockNoteUIExtension",
|
|
9392
9472
|
addProseMirrorPlugins: () => [
|
|
9393
9473
|
this.formattingToolbar.plugin,
|
|
@@ -9396,10 +9476,26 @@ class vt {
|
|
|
9396
9476
|
this.suggestionMenus.plugin,
|
|
9397
9477
|
...this.filePanel ? [this.filePanel.plugin] : [],
|
|
9398
9478
|
...this.tableHandles ? [this.tableHandles.plugin] : [],
|
|
9399
|
-
|
|
9479
|
+
Xn(this, o.placeholders),
|
|
9480
|
+
...this.options.animations ?? !0 ? [Jn()] : []
|
|
9400
9481
|
]
|
|
9401
9482
|
});
|
|
9402
|
-
n.push(r),
|
|
9483
|
+
if (n.push(r), o.uploadFile) {
|
|
9484
|
+
const g = o.uploadFile;
|
|
9485
|
+
this.uploadFile = async (k, v) => {
|
|
9486
|
+
this.onUploadStartCallbacks.forEach(
|
|
9487
|
+
(b) => b.apply(this, [v])
|
|
9488
|
+
);
|
|
9489
|
+
try {
|
|
9490
|
+
return await g(k, v);
|
|
9491
|
+
} finally {
|
|
9492
|
+
this.onUploadEndCallbacks.forEach(
|
|
9493
|
+
(b) => b.apply(this, [v])
|
|
9494
|
+
);
|
|
9495
|
+
}
|
|
9496
|
+
};
|
|
9497
|
+
}
|
|
9498
|
+
this.resolveFileUrl = o.resolveFileUrl || (async (g) => g), this.headless = o._headless, o.collaboration && o.initialContent && console.warn(
|
|
9403
9499
|
"When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"
|
|
9404
9500
|
);
|
|
9405
9501
|
const a = o.initialContent || (t.collaboration ? [
|
|
@@ -9410,7 +9506,7 @@ class vt {
|
|
|
9410
9506
|
] : [
|
|
9411
9507
|
{
|
|
9412
9508
|
type: "paragraph",
|
|
9413
|
-
id:
|
|
9509
|
+
id: oe.options.generateID()
|
|
9414
9510
|
}
|
|
9415
9511
|
]);
|
|
9416
9512
|
if (!Array.isArray(a) || a.length === 0)
|
|
@@ -9418,7 +9514,7 @@ class vt {
|
|
|
9418
9514
|
"initialContent must be a non-empty array of blocks, received: " + a
|
|
9419
9515
|
);
|
|
9420
9516
|
const s = {
|
|
9421
|
-
...
|
|
9517
|
+
...Yn,
|
|
9422
9518
|
...o._tiptapOptions,
|
|
9423
9519
|
content: a,
|
|
9424
9520
|
extensions: [
|
|
@@ -9434,16 +9530,16 @@ class vt {
|
|
|
9434
9530
|
tabIndex: "0",
|
|
9435
9531
|
...(p = (u = o._tiptapOptions) == null ? void 0 : u.editorProps) == null ? void 0 : p.attributes,
|
|
9436
9532
|
...(h = o.domAttributes) == null ? void 0 : h.editor,
|
|
9437
|
-
class:
|
|
9533
|
+
class: R(
|
|
9438
9534
|
"bn-editor",
|
|
9439
9535
|
o.defaultStyles ? "bn-default-styles" : "",
|
|
9440
|
-
((
|
|
9536
|
+
((f = (m = o.domAttributes) == null ? void 0 : m.editor) == null ? void 0 : f.class) || ""
|
|
9441
9537
|
)
|
|
9442
9538
|
},
|
|
9443
|
-
transformPasted:
|
|
9539
|
+
transformPasted: $n
|
|
9444
9540
|
}
|
|
9445
9541
|
};
|
|
9446
|
-
this.headless ? this._pmSchema =
|
|
9542
|
+
this.headless ? this._pmSchema = Wt(s.extensions) : (this._tiptapEditor = new Et(
|
|
9447
9543
|
s,
|
|
9448
9544
|
this.schema.styleSchema
|
|
9449
9545
|
), this._pmSchema = this._tiptapEditor.schema);
|
|
@@ -9452,7 +9548,7 @@ class vt {
|
|
|
9452
9548
|
return this._pmSchema;
|
|
9453
9549
|
}
|
|
9454
9550
|
static create(t = {}) {
|
|
9455
|
-
return new
|
|
9551
|
+
return new Ct(t);
|
|
9456
9552
|
}
|
|
9457
9553
|
dispatch(t) {
|
|
9458
9554
|
this._tiptapEditor.dispatch(t);
|
|
@@ -9469,6 +9565,18 @@ class vt {
|
|
|
9469
9565
|
focus() {
|
|
9470
9566
|
this._tiptapEditor.view.focus();
|
|
9471
9567
|
}
|
|
9568
|
+
onUploadStart(t) {
|
|
9569
|
+
return this.onUploadStartCallbacks.push(t), () => {
|
|
9570
|
+
const i = this.onUploadStartCallbacks.indexOf(t);
|
|
9571
|
+
i > -1 && this.onUploadStartCallbacks.splice(i, 1);
|
|
9572
|
+
};
|
|
9573
|
+
}
|
|
9574
|
+
onUploadEnd(t) {
|
|
9575
|
+
return this.onUploadEndCallbacks.push(t), () => {
|
|
9576
|
+
const i = this.onUploadEndCallbacks.indexOf(t);
|
|
9577
|
+
i > -1 && this.onUploadEndCallbacks.splice(i, 1);
|
|
9578
|
+
};
|
|
9579
|
+
}
|
|
9472
9580
|
/**
|
|
9473
9581
|
* @deprecated, use `editor.document` instead
|
|
9474
9582
|
*/
|
|
@@ -9482,7 +9590,7 @@ class vt {
|
|
|
9482
9590
|
get document() {
|
|
9483
9591
|
const t = [];
|
|
9484
9592
|
return this._tiptapEditor.state.doc.firstChild.descendants((i) => (t.push(
|
|
9485
|
-
|
|
9593
|
+
C(
|
|
9486
9594
|
i,
|
|
9487
9595
|
this.schema.blockSchema,
|
|
9488
9596
|
this.schema.inlineContentSchema,
|
|
@@ -9499,7 +9607,7 @@ class vt {
|
|
|
9499
9607
|
getBlock(t) {
|
|
9500
9608
|
const i = typeof t == "string" ? t : t.id;
|
|
9501
9609
|
let o;
|
|
9502
|
-
return this._tiptapEditor.state.doc.firstChild.descendants((n) => typeof o < "u" ? !1 : n.type.name !== "blockContainer" || n.attrs.id !== i ? !0 : (o =
|
|
9610
|
+
return this._tiptapEditor.state.doc.firstChild.descendants((n) => typeof o < "u" ? !1 : n.type.name !== "blockContainer" || n.attrs.id !== i ? !0 : (o = C(
|
|
9503
9611
|
n,
|
|
9504
9612
|
this.schema.blockSchema,
|
|
9505
9613
|
this.schema.inlineContentSchema,
|
|
@@ -9517,7 +9625,7 @@ class vt {
|
|
|
9517
9625
|
i && o.reverse();
|
|
9518
9626
|
function n(r) {
|
|
9519
9627
|
for (const a of r) {
|
|
9520
|
-
if (
|
|
9628
|
+
if (t(a) === !1)
|
|
9521
9629
|
return !1;
|
|
9522
9630
|
const s = i ? a.children.slice().reverse() : a.children;
|
|
9523
9631
|
if (!n(s))
|
|
@@ -9554,21 +9662,21 @@ class vt {
|
|
|
9554
9662
|
r > 0 && (s = this._tiptapEditor.state.doc.resolve(o - 2).node());
|
|
9555
9663
|
let l;
|
|
9556
9664
|
return r < a - 1 && (l = this._tiptapEditor.state.doc.resolve(n + 2).node()), {
|
|
9557
|
-
block:
|
|
9665
|
+
block: C(
|
|
9558
9666
|
t,
|
|
9559
9667
|
this.schema.blockSchema,
|
|
9560
9668
|
this.schema.inlineContentSchema,
|
|
9561
9669
|
this.schema.styleSchema,
|
|
9562
9670
|
this.blockCache
|
|
9563
9671
|
),
|
|
9564
|
-
prevBlock: s === void 0 ? void 0 :
|
|
9672
|
+
prevBlock: s === void 0 ? void 0 : C(
|
|
9565
9673
|
s,
|
|
9566
9674
|
this.schema.blockSchema,
|
|
9567
9675
|
this.schema.inlineContentSchema,
|
|
9568
9676
|
this.schema.styleSchema,
|
|
9569
9677
|
this.blockCache
|
|
9570
9678
|
),
|
|
9571
|
-
nextBlock: l === void 0 ? void 0 :
|
|
9679
|
+
nextBlock: l === void 0 ? void 0 : C(
|
|
9572
9680
|
l,
|
|
9573
9681
|
this.schema.blockSchema,
|
|
9574
9682
|
this.schema.inlineContentSchema,
|
|
@@ -9601,7 +9709,7 @@ class vt {
|
|
|
9601
9709
|
r + a.nodeSize - 4
|
|
9602
9710
|
);
|
|
9603
9711
|
else
|
|
9604
|
-
throw new
|
|
9712
|
+
throw new P(s);
|
|
9605
9713
|
}
|
|
9606
9714
|
/**
|
|
9607
9715
|
* Gets a snapshot of the current selection.
|
|
@@ -9615,7 +9723,7 @@ class vt {
|
|
|
9615
9723
|
return !0;
|
|
9616
9724
|
const n = o + i.nodeSize - 1, r = o + 1;
|
|
9617
9725
|
return n <= this._tiptapEditor.state.selection.from || r >= this._tiptapEditor.state.selection.to ? !0 : (t.push(
|
|
9618
|
-
|
|
9726
|
+
C(
|
|
9619
9727
|
this._tiptapEditor.state.doc.resolve(o).node(),
|
|
9620
9728
|
this.schema.blockSchema,
|
|
9621
9729
|
this.schema.inlineContentSchema,
|
|
@@ -9658,7 +9766,7 @@ class vt {
|
|
|
9658
9766
|
* `referenceBlock`. Inserts the blocks at the start of the existing block's children if "nested" is used.
|
|
9659
9767
|
*/
|
|
9660
9768
|
insertBlocks(t, i, o = "before") {
|
|
9661
|
-
return
|
|
9769
|
+
return Ko(t, i, o, this);
|
|
9662
9770
|
}
|
|
9663
9771
|
/**
|
|
9664
9772
|
* Updates an existing block in the editor. Since updatedBlock is a PartialBlock object, some fields might not be
|
|
@@ -9668,14 +9776,14 @@ class vt {
|
|
|
9668
9776
|
* @param update A partial block which defines how the existing block should be changed.
|
|
9669
9777
|
*/
|
|
9670
9778
|
updateBlock(t, i) {
|
|
9671
|
-
return
|
|
9779
|
+
return $o(t, i, this);
|
|
9672
9780
|
}
|
|
9673
9781
|
/**
|
|
9674
9782
|
* Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
|
|
9675
9783
|
* @param blocksToRemove An array of identifiers for existing blocks that should be removed.
|
|
9676
9784
|
*/
|
|
9677
9785
|
removeBlocks(t) {
|
|
9678
|
-
return
|
|
9786
|
+
return qo(t, this);
|
|
9679
9787
|
}
|
|
9680
9788
|
/**
|
|
9681
9789
|
* Replaces existing blocks in the editor with new blocks. If the blocks that should be removed are not adjacent or
|
|
@@ -9685,7 +9793,7 @@ class vt {
|
|
|
9685
9793
|
* @param blocksToInsert An array of partial blocks to replace the old ones with.
|
|
9686
9794
|
*/
|
|
9687
9795
|
replaceBlocks(t, i) {
|
|
9688
|
-
return
|
|
9796
|
+
return Xo(t, i, this);
|
|
9689
9797
|
}
|
|
9690
9798
|
/**
|
|
9691
9799
|
* Insert a piece of content at the current cursor position.
|
|
@@ -9693,12 +9801,12 @@ class vt {
|
|
|
9693
9801
|
* @param content can be a string, or array of partial inline content elements
|
|
9694
9802
|
*/
|
|
9695
9803
|
insertInlineContent(t) {
|
|
9696
|
-
const i =
|
|
9804
|
+
const i = V(
|
|
9697
9805
|
t,
|
|
9698
9806
|
this.pmSchema,
|
|
9699
9807
|
this.schema.styleSchema
|
|
9700
9808
|
);
|
|
9701
|
-
|
|
9809
|
+
Zo(
|
|
9702
9810
|
{
|
|
9703
9811
|
from: this._tiptapEditor.state.selection.from,
|
|
9704
9812
|
to: this._tiptapEditor.state.selection.to
|
|
@@ -9736,7 +9844,7 @@ class vt {
|
|
|
9736
9844
|
else if (n.propSchema === "string")
|
|
9737
9845
|
this._tiptapEditor.commands.setMark(i, { stringValue: o });
|
|
9738
9846
|
else
|
|
9739
|
-
throw new
|
|
9847
|
+
throw new P(n.propSchema);
|
|
9740
9848
|
}
|
|
9741
9849
|
}
|
|
9742
9850
|
/**
|
|
@@ -9761,7 +9869,7 @@ class vt {
|
|
|
9761
9869
|
else if (n.propSchema === "string")
|
|
9762
9870
|
this._tiptapEditor.commands.toggleMark(i, { stringValue: o });
|
|
9763
9871
|
else
|
|
9764
|
-
throw new
|
|
9872
|
+
throw new P(n.propSchema);
|
|
9765
9873
|
}
|
|
9766
9874
|
}
|
|
9767
9875
|
/**
|
|
@@ -9834,7 +9942,7 @@ class vt {
|
|
|
9834
9942
|
* @returns The blocks, serialized as an HTML string.
|
|
9835
9943
|
*/
|
|
9836
9944
|
async blocksToHTMLLossy(t = this.document) {
|
|
9837
|
-
return await
|
|
9945
|
+
return await ie(), de(this.pmSchema, this).exportBlocks(t, {});
|
|
9838
9946
|
}
|
|
9839
9947
|
/**
|
|
9840
9948
|
* Serializes blocks into an HTML string in the format that would normally be rendered by the editor.
|
|
@@ -9856,7 +9964,7 @@ class vt {
|
|
|
9856
9964
|
* @returns The blocks parsed from the HTML string.
|
|
9857
9965
|
*/
|
|
9858
9966
|
async tryParseHTMLToBlocks(t) {
|
|
9859
|
-
return
|
|
9967
|
+
return yt(
|
|
9860
9968
|
t,
|
|
9861
9969
|
this.schema.blockSchema,
|
|
9862
9970
|
this.schema.inlineContentSchema,
|
|
@@ -9871,7 +9979,7 @@ class vt {
|
|
|
9871
9979
|
* @returns The blocks, serialized as a Markdown string.
|
|
9872
9980
|
*/
|
|
9873
9981
|
async blocksToMarkdownLossy(t = this.document) {
|
|
9874
|
-
return
|
|
9982
|
+
return Qo(t, this.pmSchema, this, {});
|
|
9875
9983
|
}
|
|
9876
9984
|
/**
|
|
9877
9985
|
* Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on
|
|
@@ -9881,7 +9989,7 @@ class vt {
|
|
|
9881
9989
|
* @returns The blocks parsed from the Markdown string.
|
|
9882
9990
|
*/
|
|
9883
9991
|
async tryParseMarkdownToBlocks(t) {
|
|
9884
|
-
return
|
|
9992
|
+
return sn(
|
|
9885
9993
|
t,
|
|
9886
9994
|
this.schema.blockSchema,
|
|
9887
9995
|
this.schema.inlineContentSchema,
|
|
@@ -9942,43 +10050,43 @@ class vt {
|
|
|
9942
10050
|
);
|
|
9943
10051
|
}
|
|
9944
10052
|
}
|
|
9945
|
-
let ae,
|
|
9946
|
-
async function
|
|
9947
|
-
if (!
|
|
10053
|
+
let ae, ke;
|
|
10054
|
+
async function Vr(e, t) {
|
|
10055
|
+
if (!Fo("text", e))
|
|
9948
10056
|
return [];
|
|
9949
10057
|
if (!ae) {
|
|
9950
|
-
ae = import("@emoji-mart/data"),
|
|
10058
|
+
ae = import("@emoji-mart/data"), ke = await import("emoji-mart");
|
|
9951
10059
|
const n = (await ae).default;
|
|
9952
|
-
await
|
|
10060
|
+
await ke.init({ data: n });
|
|
9953
10061
|
}
|
|
9954
10062
|
const i = (await ae).default;
|
|
9955
|
-
return (t.trim() === "" ? Object.values(i.emojis) : await
|
|
10063
|
+
return (t.trim() === "" ? Object.values(i.emojis) : await ke.SearchIndex.search(t)).map((n) => ({
|
|
9956
10064
|
id: n.skins[0].native,
|
|
9957
10065
|
onItemClick: () => e.insertInlineContent(n.skins[0].native + " ")
|
|
9958
10066
|
}));
|
|
9959
10067
|
}
|
|
9960
|
-
function
|
|
10068
|
+
function Qn(e) {
|
|
9961
10069
|
let t = e.getTextCursorPosition().block, i = e.schema.blockSchema[t.type].content;
|
|
9962
10070
|
for (; i === "none"; )
|
|
9963
10071
|
t = e.getTextCursorPosition().nextBlock, i = e.schema.blockSchema[t.type].content, e.setTextCursorPosition(t, "end");
|
|
9964
10072
|
}
|
|
9965
|
-
function
|
|
10073
|
+
function M(e, t) {
|
|
9966
10074
|
const i = e.getTextCursorPosition().block;
|
|
9967
10075
|
if (i.content === void 0)
|
|
9968
10076
|
throw new Error("Slash Menu open in a block that doesn't contain content.");
|
|
9969
|
-
Array.isArray(i.content) && (i.content.length === 1 &&
|
|
10077
|
+
Array.isArray(i.content) && (i.content.length === 1 && te(i.content[0]) && i.content[0].type === "text" && i.content[0].text === "/" || i.content.length === 0) ? e.updateBlock(i, t) : (e.insertBlocks([t], i, "after"), e.setTextCursorPosition(
|
|
9970
10078
|
e.getTextCursorPosition().nextBlock,
|
|
9971
10079
|
"end"
|
|
9972
10080
|
));
|
|
9973
10081
|
const o = e.getTextCursorPosition().block;
|
|
9974
|
-
return
|
|
10082
|
+
return Qn(e), o;
|
|
9975
10083
|
}
|
|
9976
|
-
function
|
|
10084
|
+
function Rr(e) {
|
|
9977
10085
|
const t = [];
|
|
9978
|
-
return
|
|
10086
|
+
return T("heading", e) && t.push(
|
|
9979
10087
|
{
|
|
9980
10088
|
onItemClick: () => {
|
|
9981
|
-
|
|
10089
|
+
M(e, {
|
|
9982
10090
|
type: "heading",
|
|
9983
10091
|
props: { level: 1 }
|
|
9984
10092
|
});
|
|
@@ -9989,7 +10097,7 @@ function Ur(e) {
|
|
|
9989
10097
|
},
|
|
9990
10098
|
{
|
|
9991
10099
|
onItemClick: () => {
|
|
9992
|
-
|
|
10100
|
+
M(e, {
|
|
9993
10101
|
type: "heading",
|
|
9994
10102
|
props: { level: 2 }
|
|
9995
10103
|
});
|
|
@@ -10000,7 +10108,7 @@ function Ur(e) {
|
|
|
10000
10108
|
},
|
|
10001
10109
|
{
|
|
10002
10110
|
onItemClick: () => {
|
|
10003
|
-
|
|
10111
|
+
M(e, {
|
|
10004
10112
|
type: "heading",
|
|
10005
10113
|
props: { level: 3 }
|
|
10006
10114
|
});
|
|
@@ -10009,45 +10117,45 @@ function Ur(e) {
|
|
|
10009
10117
|
key: "heading_3",
|
|
10010
10118
|
...e.dictionary.slash_menu.heading_3
|
|
10011
10119
|
}
|
|
10012
|
-
),
|
|
10120
|
+
), T("numberedListItem", e) && t.push({
|
|
10013
10121
|
onItemClick: () => {
|
|
10014
|
-
|
|
10122
|
+
M(e, {
|
|
10015
10123
|
type: "numberedListItem"
|
|
10016
10124
|
});
|
|
10017
10125
|
},
|
|
10018
10126
|
badge: D("Mod-Shift-7"),
|
|
10019
10127
|
key: "numbered_list",
|
|
10020
10128
|
...e.dictionary.slash_menu.numbered_list
|
|
10021
|
-
}),
|
|
10129
|
+
}), T("bulletListItem", e) && t.push({
|
|
10022
10130
|
onItemClick: () => {
|
|
10023
|
-
|
|
10131
|
+
M(e, {
|
|
10024
10132
|
type: "bulletListItem"
|
|
10025
10133
|
});
|
|
10026
10134
|
},
|
|
10027
10135
|
badge: D("Mod-Shift-8"),
|
|
10028
10136
|
key: "bullet_list",
|
|
10029
10137
|
...e.dictionary.slash_menu.bullet_list
|
|
10030
|
-
}),
|
|
10138
|
+
}), T("checkListItem", e) && t.push({
|
|
10031
10139
|
onItemClick: () => {
|
|
10032
|
-
|
|
10140
|
+
M(e, {
|
|
10033
10141
|
type: "checkListItem"
|
|
10034
10142
|
});
|
|
10035
10143
|
},
|
|
10036
10144
|
badge: D("Mod-Shift-9"),
|
|
10037
10145
|
key: "check_list",
|
|
10038
10146
|
...e.dictionary.slash_menu.check_list
|
|
10039
|
-
}),
|
|
10147
|
+
}), T("paragraph", e) && t.push({
|
|
10040
10148
|
onItemClick: () => {
|
|
10041
|
-
|
|
10149
|
+
M(e, {
|
|
10042
10150
|
type: "paragraph"
|
|
10043
10151
|
});
|
|
10044
10152
|
},
|
|
10045
10153
|
badge: D("Mod-Alt-0"),
|
|
10046
10154
|
key: "paragraph",
|
|
10047
10155
|
...e.dictionary.slash_menu.paragraph
|
|
10048
|
-
}),
|
|
10156
|
+
}), T("table", e) && t.push({
|
|
10049
10157
|
onItemClick: () => {
|
|
10050
|
-
|
|
10158
|
+
M(e, {
|
|
10051
10159
|
type: "table",
|
|
10052
10160
|
content: {
|
|
10053
10161
|
type: "tableContent",
|
|
@@ -10065,9 +10173,9 @@ function Ur(e) {
|
|
|
10065
10173
|
badge: void 0,
|
|
10066
10174
|
key: "table",
|
|
10067
10175
|
...e.dictionary.slash_menu.table
|
|
10068
|
-
}),
|
|
10176
|
+
}), T("image", e) && t.push({
|
|
10069
10177
|
onItemClick: () => {
|
|
10070
|
-
const i =
|
|
10178
|
+
const i = M(e, {
|
|
10071
10179
|
type: "image"
|
|
10072
10180
|
});
|
|
10073
10181
|
e.dispatch(
|
|
@@ -10078,9 +10186,9 @@ function Ur(e) {
|
|
|
10078
10186
|
},
|
|
10079
10187
|
key: "image",
|
|
10080
10188
|
...e.dictionary.slash_menu.image
|
|
10081
|
-
}),
|
|
10189
|
+
}), T("video", e) && t.push({
|
|
10082
10190
|
onItemClick: () => {
|
|
10083
|
-
const i =
|
|
10191
|
+
const i = M(e, {
|
|
10084
10192
|
type: "video"
|
|
10085
10193
|
});
|
|
10086
10194
|
e.dispatch(
|
|
@@ -10091,9 +10199,9 @@ function Ur(e) {
|
|
|
10091
10199
|
},
|
|
10092
10200
|
key: "video",
|
|
10093
10201
|
...e.dictionary.slash_menu.video
|
|
10094
|
-
}),
|
|
10202
|
+
}), T("audio", e) && t.push({
|
|
10095
10203
|
onItemClick: () => {
|
|
10096
|
-
const i =
|
|
10204
|
+
const i = M(e, {
|
|
10097
10205
|
type: "audio"
|
|
10098
10206
|
});
|
|
10099
10207
|
e.dispatch(
|
|
@@ -10104,9 +10212,9 @@ function Ur(e) {
|
|
|
10104
10212
|
},
|
|
10105
10213
|
key: "audio",
|
|
10106
10214
|
...e.dictionary.slash_menu.audio
|
|
10107
|
-
}),
|
|
10215
|
+
}), T("file", e) && t.push({
|
|
10108
10216
|
onItemClick: () => {
|
|
10109
|
-
const i =
|
|
10217
|
+
const i = M(e, {
|
|
10110
10218
|
type: "file"
|
|
10111
10219
|
});
|
|
10112
10220
|
e.dispatch(
|
|
@@ -10128,14 +10236,14 @@ function Ur(e) {
|
|
|
10128
10236
|
...e.dictionary.slash_menu.emoji
|
|
10129
10237
|
}), t;
|
|
10130
10238
|
}
|
|
10131
|
-
function
|
|
10239
|
+
function Or(e, t) {
|
|
10132
10240
|
return e.filter(
|
|
10133
10241
|
({ title: i, aliases: o }) => i.toLowerCase().includes(t.toLowerCase()) || o && o.filter(
|
|
10134
10242
|
(n) => n.toLowerCase().includes(t.toLowerCase())
|
|
10135
10243
|
).length !== 0
|
|
10136
10244
|
);
|
|
10137
10245
|
}
|
|
10138
|
-
function
|
|
10246
|
+
function ye(e = "") {
|
|
10139
10247
|
return typeof e == "string" ? [
|
|
10140
10248
|
{
|
|
10141
10249
|
type: "text",
|
|
@@ -10144,22 +10252,22 @@ function we(e = "") {
|
|
|
10144
10252
|
}
|
|
10145
10253
|
] : e;
|
|
10146
10254
|
}
|
|
10147
|
-
function
|
|
10148
|
-
return typeof e == "string" ?
|
|
10255
|
+
function St(e) {
|
|
10256
|
+
return typeof e == "string" ? ye(e) : Array.isArray(e) ? e.flatMap((t) => typeof t == "string" ? ye(t) : tt(t) ? {
|
|
10149
10257
|
...t,
|
|
10150
|
-
content:
|
|
10151
|
-
} :
|
|
10258
|
+
content: ye(t.content)
|
|
10259
|
+
} : te(t) ? t : {
|
|
10152
10260
|
props: {},
|
|
10153
10261
|
...t,
|
|
10154
|
-
content:
|
|
10262
|
+
content: St(t.content)
|
|
10155
10263
|
}) : e;
|
|
10156
10264
|
}
|
|
10157
|
-
function
|
|
10265
|
+
function Fr(e, t) {
|
|
10158
10266
|
return t.map(
|
|
10159
|
-
(i) =>
|
|
10267
|
+
(i) => Mt(e, i)
|
|
10160
10268
|
);
|
|
10161
10269
|
}
|
|
10162
|
-
function
|
|
10270
|
+
function Mt(e, t) {
|
|
10163
10271
|
const i = {
|
|
10164
10272
|
id: "",
|
|
10165
10273
|
type: t.type,
|
|
@@ -10174,147 +10282,149 @@ function Et(e, t) {
|
|
|
10174
10282
|
}
|
|
10175
10283
|
), {
|
|
10176
10284
|
...i,
|
|
10177
|
-
content:
|
|
10178
|
-
children: i.children.map((o) =>
|
|
10285
|
+
content: St(i.content),
|
|
10286
|
+
children: i.children.map((o) => Mt(e, o))
|
|
10179
10287
|
};
|
|
10180
10288
|
}
|
|
10181
|
-
function
|
|
10182
|
-
e.id || (e.id =
|
|
10289
|
+
function er(e) {
|
|
10290
|
+
e.id || (e.id = oe.options.generateID()), e.children && tr(e.children);
|
|
10183
10291
|
}
|
|
10184
|
-
function
|
|
10292
|
+
function tr(e) {
|
|
10185
10293
|
for (const t of e)
|
|
10186
|
-
|
|
10294
|
+
er(t);
|
|
10187
10295
|
}
|
|
10188
10296
|
export {
|
|
10189
|
-
|
|
10190
|
-
|
|
10297
|
+
Xi as AudioBlock,
|
|
10298
|
+
Ct as BlockNoteEditor,
|
|
10191
10299
|
Ne as BlockNoteSchema,
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10221
|
-
|
|
10222
|
-
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
|
|
10229
|
-
|
|
10300
|
+
to as FileBlock,
|
|
10301
|
+
dn as FilePanelProsemirrorPlugin,
|
|
10302
|
+
ln as FilePanelView,
|
|
10303
|
+
pn as FormattingToolbarProsemirrorPlugin,
|
|
10304
|
+
cn as FormattingToolbarView,
|
|
10305
|
+
yt as HTMLToBlocks,
|
|
10306
|
+
so as ImageBlock,
|
|
10307
|
+
fn as LinkToolbarProsemirrorPlugin,
|
|
10308
|
+
wn as SideMenuProsemirrorPlugin,
|
|
10309
|
+
kn as SideMenuView,
|
|
10310
|
+
En as SuggestionMenuProseMirrorPlugin,
|
|
10311
|
+
Bn as TableHandlesProsemirrorPlugin,
|
|
10312
|
+
Tn as TableHandlesView,
|
|
10313
|
+
oe as UniqueID,
|
|
10314
|
+
P as UnreachableCaseError,
|
|
10315
|
+
mo as VideoBlock,
|
|
10316
|
+
er as addIdsToBlock,
|
|
10317
|
+
tr as addIdsToBlocks,
|
|
10318
|
+
Fe as addInlineContentAttributes,
|
|
10319
|
+
Ui as addInlineContentKeyboardShortcuts,
|
|
10320
|
+
Ri as addStyleAttributes,
|
|
10321
|
+
Pi as applyNonSelectableBlockFix,
|
|
10322
|
+
Tr as assertEmpty,
|
|
10323
|
+
Wi as audioBlockConfig,
|
|
10324
|
+
$i as audioParse,
|
|
10325
|
+
Gi as audioPropSchema,
|
|
10326
|
+
Ki as audioRender,
|
|
10327
|
+
qi as audioToExternalHTML,
|
|
10328
|
+
U as blockToNode,
|
|
10329
|
+
Qo as blocksToMarkdown,
|
|
10330
|
+
se as camelToDataKebab,
|
|
10331
|
+
jr as checkBlockHasDefaultProp,
|
|
10332
|
+
Go as checkBlockIsDefaultType,
|
|
10333
|
+
Hr as checkBlockIsFileBlock,
|
|
10334
|
+
Dr as checkBlockIsFileBlockWithPlaceholder,
|
|
10335
|
+
Ur as checkBlockIsFileBlockWithPreview,
|
|
10336
|
+
Wo as checkBlockTypeHasDefaultProp,
|
|
10337
|
+
T as checkDefaultBlockTypeInSchema,
|
|
10338
|
+
Fo as checkDefaultInlineContentTypeInSchema,
|
|
10230
10339
|
Ie as cleanHTMLToMarkdown,
|
|
10231
10340
|
Se as contentNodeToInlineContent,
|
|
10232
|
-
|
|
10341
|
+
Fi as createAddFileButton,
|
|
10233
10342
|
ce as createBlockSpec,
|
|
10234
10343
|
X as createBlockSpecFromStronglyTypedTiptapNode,
|
|
10235
|
-
|
|
10236
|
-
|
|
10344
|
+
O as createDefaultBlockDOMOutputSpec,
|
|
10345
|
+
ht as createDefaultFilePreview,
|
|
10237
10346
|
de as createExternalHTMLExporter,
|
|
10238
10347
|
Te as createFigureWithCaption,
|
|
10239
|
-
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10348
|
+
ne as createFileAndCaptionWrapper,
|
|
10349
|
+
ue as createFileBlockWrapper,
|
|
10350
|
+
Ir as createInlineContentSpec,
|
|
10351
|
+
ji as createInlineContentSpecFromTipTapNode,
|
|
10352
|
+
lt as createInternalBlockSpec,
|
|
10243
10353
|
Me as createInternalHTMLSerializer,
|
|
10244
|
-
|
|
10245
|
-
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
|
|
10256
|
-
|
|
10257
|
-
|
|
10258
|
-
|
|
10259
|
-
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
|
|
10263
|
-
|
|
10264
|
-
|
|
10265
|
-
|
|
10266
|
-
|
|
10267
|
-
|
|
10354
|
+
Di as createInternalInlineContentSpec,
|
|
10355
|
+
ut as createInternalStyleSpec,
|
|
10356
|
+
he as createLinkWithCaption,
|
|
10357
|
+
mt as createResizeHandlesWrapper,
|
|
10358
|
+
F as createStronglyTypedTiptapNode,
|
|
10359
|
+
Ar as createStyleSpec,
|
|
10360
|
+
j as createStyleSpecFromTipTapMark,
|
|
10361
|
+
zr as createSuggestionMenu,
|
|
10362
|
+
Ro as defaultBlockSchema,
|
|
10363
|
+
ft as defaultBlockSpecs,
|
|
10364
|
+
Oe as defaultBlockToHTML,
|
|
10365
|
+
Oo as defaultInlineContentSchema,
|
|
10366
|
+
bt as defaultInlineContentSpecs,
|
|
10367
|
+
w as defaultProps,
|
|
10368
|
+
Pr as defaultStyleSchema,
|
|
10369
|
+
gt as defaultStyleSpecs,
|
|
10370
|
+
H as esmDependencies,
|
|
10371
|
+
Ji as fileBlockConfig,
|
|
10372
|
+
Qi as fileParse,
|
|
10373
|
+
Zi as filePropSchema,
|
|
10374
|
+
Yi as fileRender,
|
|
10375
|
+
eo as fileToExternalHTML,
|
|
10376
|
+
Lr as filenameFromURL,
|
|
10377
|
+
Or as filterSuggestionItems,
|
|
10268
10378
|
D as formatKeyboardShortcut,
|
|
10269
|
-
|
|
10270
|
-
|
|
10271
|
-
|
|
10272
|
-
|
|
10273
|
-
|
|
10274
|
-
|
|
10275
|
-
|
|
10276
|
-
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
|
|
10379
|
+
un as formattingToolbarPluginKey,
|
|
10380
|
+
Ni as getBlockFromPos,
|
|
10381
|
+
Wn as getBlockNoteExtensions,
|
|
10382
|
+
dt as getBlockSchemaFromSpecs,
|
|
10383
|
+
B as getCurrentBlockContentType,
|
|
10384
|
+
Vr as getDefaultEmojiPickerItems,
|
|
10385
|
+
Rr as getDefaultSlashMenuItems,
|
|
10386
|
+
me as getDraggableBlockFromElement,
|
|
10387
|
+
zi as getInlineContentParseRules,
|
|
10388
|
+
ct as getInlineContentSchemaFromSpecs,
|
|
10389
|
+
Hi as getParseRules,
|
|
10390
|
+
Oi as getStyleParseRules,
|
|
10391
|
+
pt as getStyleSchemaFromSpecs,
|
|
10392
|
+
oo as imageBlockConfig,
|
|
10393
|
+
ro as imageParse,
|
|
10394
|
+
io as imagePropSchema,
|
|
10395
|
+
no as imageRender,
|
|
10396
|
+
ao as imageToExternalHTML,
|
|
10397
|
+
at as inheritedProps,
|
|
10398
|
+
ie as initializeESMDependencies,
|
|
10399
|
+
V as inlineContentToNodes,
|
|
10400
|
+
M as insertOrUpdateBlock,
|
|
10401
|
+
Ai as isAppleOS,
|
|
10292
10402
|
ze as isLinkInlineContent,
|
|
10293
|
-
|
|
10294
|
-
|
|
10295
|
-
|
|
10296
|
-
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
|
|
10403
|
+
tt as isPartialLinkInlineContent,
|
|
10404
|
+
Br as isSafari,
|
|
10405
|
+
te as isStyledTextInlineContent,
|
|
10406
|
+
mn as linkToolbarPluginKey,
|
|
10407
|
+
Mr as locales,
|
|
10408
|
+
sn as markdownToBlocks,
|
|
10409
|
+
R as mergeCSSClasses,
|
|
10410
|
+
C as nodeToBlock,
|
|
10411
|
+
xe as nodeToCustomInlineContent,
|
|
10412
|
+
Ge as parseEmbedElement,
|
|
10413
|
+
pe as parseFigureElement,
|
|
10414
|
+
Ke as parseImageElement,
|
|
10415
|
+
Mt as partialBlockToBlockForTesting,
|
|
10416
|
+
Fr as partialBlocksToBlocksForTesting,
|
|
10417
|
+
st as propsToAttributes,
|
|
10418
|
+
yn as sideMenuPluginKey,
|
|
10419
|
+
Vi as stylePropsToAttributes,
|
|
10420
|
+
it as tableContentToNodes,
|
|
10421
|
+
Q as tableHandlesPluginKey,
|
|
10422
|
+
Nr as uploadToTmpFilesDotOrg_DEV_ONLY,
|
|
10423
|
+
co as videoBlockConfig,
|
|
10424
|
+
po as videoParse,
|
|
10425
|
+
lo as videoPropSchema,
|
|
10426
|
+
uo as videoRender,
|
|
10427
|
+
ho as videoToExternalHTML,
|
|
10428
|
+
ge as wrapInBlockStructure
|
|
10319
10429
|
};
|
|
10320
10430
|
//# sourceMappingURL=blocknote.js.map
|