@blocknote/core 0.15.7 → 0.15.9
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 +1284 -1182
- 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/inlineContent/createSpec.ts +54 -5
- 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/inlineContent/createSpec.d.ts +3 -3
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 Rt, isNodeSelection as Vt, posToDOMRect as ve, 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
|
+
}, vi = {
|
|
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
|
+
}, wi = {
|
|
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
|
+
}, Sr = /* @__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: vi,
|
|
4322
|
+
pt: wi,
|
|
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), w = 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 && w.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,18 +4600,18 @@ 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 Mr(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));
|
|
@@ -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 we(e.content, t, i).map(
|
|
4633
4640
|
(n) => {
|
|
4634
4641
|
if (n.type.name === "text")
|
|
4635
4642
|
return n.mark([...n.marks, o]);
|
|
@@ -4639,7 +4646,7 @@ function Ci(e, t, i) {
|
|
|
4639
4646
|
}
|
|
4640
4647
|
);
|
|
4641
4648
|
}
|
|
4642
|
-
function
|
|
4649
|
+
function we(e, t, i) {
|
|
4643
4650
|
const o = [];
|
|
4644
4651
|
if (typeof e == "string")
|
|
4645
4652
|
return o.push(
|
|
@@ -4653,15 +4660,15 @@ function xe(e, t, i) {
|
|
|
4653
4660
|
o.push(...Re(n, t, i));
|
|
4654
4661
|
return o;
|
|
4655
4662
|
}
|
|
4656
|
-
function
|
|
4663
|
+
function R(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(...we(n, t, i)) : tt(n) ? o.push(...Ti(n, t, i)) : te(n) ? o.push(...we([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 = R(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 = R([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 = R(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 Ve(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
|
+
), w = 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 !== w) {
|
|
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(w)
|
|
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
|
+
Ve(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
|
+
Ve(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 V(...e) {
|
|
5082
5115
|
return e.filter((t) => t).join(" ");
|
|
5083
5116
|
}
|
|
5084
|
-
const
|
|
5085
|
-
function
|
|
5117
|
+
const Tr = () => /^((?!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 = V(
|
|
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 = V(
|
|
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
|
+
}, v = {
|
|
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 Br(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 = V(
|
|
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 = V(
|
|
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,18 @@ 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) {
|
|
5229
5262
|
const i = [
|
|
5230
5263
|
{
|
|
5231
5264
|
tag: "[data-content-type=" + e.type + "]",
|
|
@@ -5243,16 +5276,16 @@ function Ii(e, t) {
|
|
|
5243
5276
|
}), i;
|
|
5244
5277
|
}
|
|
5245
5278
|
function ce(e, t) {
|
|
5246
|
-
const i =
|
|
5279
|
+
const i = F({
|
|
5247
5280
|
name: e.type,
|
|
5248
5281
|
content: e.content === "inline" ? "inline*" : "",
|
|
5249
5282
|
group: "blockContent",
|
|
5250
5283
|
selectable: !0,
|
|
5251
5284
|
addAttributes() {
|
|
5252
|
-
return
|
|
5285
|
+
return st(e.propSchema);
|
|
5253
5286
|
},
|
|
5254
5287
|
parseHTML() {
|
|
5255
|
-
return
|
|
5288
|
+
return Pi(e, t.parse);
|
|
5256
5289
|
},
|
|
5257
5290
|
renderHTML() {
|
|
5258
5291
|
const o = document.createElement("div");
|
|
@@ -5263,13 +5296,13 @@ function ce(e, t) {
|
|
|
5263
5296
|
addNodeView() {
|
|
5264
5297
|
return ({ getPos: o }) => {
|
|
5265
5298
|
var l;
|
|
5266
|
-
const n = this.options.editor, r =
|
|
5299
|
+
const n = this.options.editor, r = Ni(
|
|
5267
5300
|
o,
|
|
5268
5301
|
n,
|
|
5269
5302
|
this.editor,
|
|
5270
5303
|
e.type
|
|
5271
5304
|
), a = ((l = this.options.domAttributes) == null ? void 0 : l.blockContent) || {}, s = t.render(r, n);
|
|
5272
|
-
return
|
|
5305
|
+
return ge(
|
|
5273
5306
|
s,
|
|
5274
5307
|
r.type,
|
|
5275
5308
|
r.props,
|
|
@@ -5283,12 +5316,12 @@ function ce(e, t) {
|
|
|
5283
5316
|
throw new Error(
|
|
5284
5317
|
"Node name does not match block type. This is a bug in BlockNote."
|
|
5285
5318
|
);
|
|
5286
|
-
return
|
|
5319
|
+
return lt(e, {
|
|
5287
5320
|
node: i,
|
|
5288
5321
|
toInternalHTML: (o, n) => {
|
|
5289
5322
|
var s;
|
|
5290
5323
|
const r = ((s = i.options.domAttributes) == null ? void 0 : s.blockContent) || {}, a = t.render(o, n);
|
|
5291
|
-
return
|
|
5324
|
+
return ge(
|
|
5292
5325
|
a,
|
|
5293
5326
|
o.type,
|
|
5294
5327
|
o.props,
|
|
@@ -5305,7 +5338,7 @@ function ce(e, t) {
|
|
|
5305
5338
|
o,
|
|
5306
5339
|
n
|
|
5307
5340
|
);
|
|
5308
|
-
return a === void 0 && (a = t.render(o, n)),
|
|
5341
|
+
return a === void 0 && (a = t.render(o, n)), ge(
|
|
5309
5342
|
a,
|
|
5310
5343
|
o.type,
|
|
5311
5344
|
o.props,
|
|
@@ -5315,10 +5348,10 @@ function ce(e, t) {
|
|
|
5315
5348
|
}
|
|
5316
5349
|
});
|
|
5317
5350
|
}
|
|
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]) => [
|
|
5351
|
+
function Fe(e, t, i, o) {
|
|
5352
|
+
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
5353
|
}
|
|
5321
|
-
function
|
|
5354
|
+
function Hi(e) {
|
|
5322
5355
|
return {
|
|
5323
5356
|
Backspace: ({ editor: t }) => {
|
|
5324
5357
|
const i = t.state.selection.$from;
|
|
@@ -5326,14 +5359,14 @@ function Ni(e) {
|
|
|
5326
5359
|
}
|
|
5327
5360
|
};
|
|
5328
5361
|
}
|
|
5329
|
-
function
|
|
5362
|
+
function Ui(e, t) {
|
|
5330
5363
|
return {
|
|
5331
5364
|
config: e,
|
|
5332
5365
|
implementation: t
|
|
5333
5366
|
};
|
|
5334
5367
|
}
|
|
5335
|
-
function
|
|
5336
|
-
return
|
|
5368
|
+
function Di(e, t) {
|
|
5369
|
+
return Ui(
|
|
5337
5370
|
{
|
|
5338
5371
|
type: e.name,
|
|
5339
5372
|
propSchema: t,
|
|
@@ -5344,12 +5377,12 @@ function Hi(e, t) {
|
|
|
5344
5377
|
}
|
|
5345
5378
|
);
|
|
5346
5379
|
}
|
|
5347
|
-
function
|
|
5380
|
+
function ct(e) {
|
|
5348
5381
|
return Object.fromEntries(
|
|
5349
5382
|
Object.entries(e).map(([t, i]) => [t, i.config])
|
|
5350
5383
|
);
|
|
5351
5384
|
}
|
|
5352
|
-
function
|
|
5385
|
+
function ji(e) {
|
|
5353
5386
|
return [
|
|
5354
5387
|
{
|
|
5355
5388
|
tag: `[data-inline-content-type="${e.type}"]`,
|
|
@@ -5360,7 +5393,7 @@ function Di(e) {
|
|
|
5360
5393
|
}
|
|
5361
5394
|
];
|
|
5362
5395
|
}
|
|
5363
|
-
function
|
|
5396
|
+
function Lr(e, t) {
|
|
5364
5397
|
const i = q.create({
|
|
5365
5398
|
name: e.type,
|
|
5366
5399
|
inline: !0,
|
|
@@ -5369,37 +5402,73 @@ function Mr(e, t) {
|
|
|
5369
5402
|
atom: e.content === "none",
|
|
5370
5403
|
content: e.content === "styled" ? "inline*" : "",
|
|
5371
5404
|
addAttributes() {
|
|
5372
|
-
return
|
|
5405
|
+
return st(e.propSchema);
|
|
5373
5406
|
},
|
|
5374
5407
|
addKeyboardShortcuts() {
|
|
5375
|
-
return
|
|
5408
|
+
return Hi(e);
|
|
5376
5409
|
},
|
|
5377
5410
|
parseHTML() {
|
|
5378
|
-
return
|
|
5411
|
+
return ji(e);
|
|
5379
5412
|
},
|
|
5380
5413
|
renderHTML({ node: o }) {
|
|
5381
5414
|
const n = this.options.editor, r = t.render(
|
|
5382
|
-
|
|
5415
|
+
xe(
|
|
5383
5416
|
o,
|
|
5384
5417
|
n.schema.inlineContentSchema,
|
|
5385
5418
|
n.schema.styleSchema
|
|
5386
|
-
)
|
|
5419
|
+
),
|
|
5387
5420
|
// TODO: fix cast
|
|
5421
|
+
() => {
|
|
5422
|
+
}
|
|
5388
5423
|
);
|
|
5389
|
-
return
|
|
5424
|
+
return Fe(
|
|
5390
5425
|
r,
|
|
5391
5426
|
e.type,
|
|
5392
5427
|
o.attrs,
|
|
5393
5428
|
e.propSchema
|
|
5394
5429
|
);
|
|
5430
|
+
},
|
|
5431
|
+
addNodeView() {
|
|
5432
|
+
return ({ node: o, getPos: n }) => {
|
|
5433
|
+
const r = this.options.editor, a = t.render(
|
|
5434
|
+
xe(
|
|
5435
|
+
o,
|
|
5436
|
+
r.schema.inlineContentSchema,
|
|
5437
|
+
r.schema.styleSchema
|
|
5438
|
+
),
|
|
5439
|
+
// TODO: fix cast
|
|
5440
|
+
(s) => {
|
|
5441
|
+
if (typeof n == "boolean")
|
|
5442
|
+
return;
|
|
5443
|
+
const l = R(
|
|
5444
|
+
[s],
|
|
5445
|
+
r._tiptapEditor.schema,
|
|
5446
|
+
r.schema.styleSchema
|
|
5447
|
+
);
|
|
5448
|
+
r._tiptapEditor.view.dispatch(
|
|
5449
|
+
r._tiptapEditor.view.state.tr.replaceWith(
|
|
5450
|
+
n(),
|
|
5451
|
+
n() + o.nodeSize,
|
|
5452
|
+
l
|
|
5453
|
+
)
|
|
5454
|
+
);
|
|
5455
|
+
}
|
|
5456
|
+
);
|
|
5457
|
+
return Fe(
|
|
5458
|
+
a,
|
|
5459
|
+
e.type,
|
|
5460
|
+
o.attrs,
|
|
5461
|
+
e.propSchema
|
|
5462
|
+
);
|
|
5463
|
+
};
|
|
5395
5464
|
}
|
|
5396
5465
|
});
|
|
5397
|
-
return
|
|
5466
|
+
return Di(
|
|
5398
5467
|
i,
|
|
5399
5468
|
e.propSchema
|
|
5400
5469
|
);
|
|
5401
5470
|
}
|
|
5402
|
-
function
|
|
5471
|
+
function zi(e) {
|
|
5403
5472
|
return e === "boolean" ? {} : {
|
|
5404
5473
|
stringValue: {
|
|
5405
5474
|
default: void 0,
|
|
@@ -5411,17 +5480,17 @@ function Ui(e) {
|
|
|
5411
5480
|
}
|
|
5412
5481
|
};
|
|
5413
5482
|
}
|
|
5414
|
-
function
|
|
5483
|
+
function Ri(e, t, i, o) {
|
|
5415
5484
|
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
5485
|
}
|
|
5417
|
-
function
|
|
5486
|
+
function ut(e, t) {
|
|
5418
5487
|
return {
|
|
5419
5488
|
config: e,
|
|
5420
5489
|
implementation: t
|
|
5421
5490
|
};
|
|
5422
5491
|
}
|
|
5423
|
-
function
|
|
5424
|
-
return
|
|
5492
|
+
function j(e, t) {
|
|
5493
|
+
return ut(
|
|
5425
5494
|
{
|
|
5426
5495
|
type: e.name,
|
|
5427
5496
|
propSchema: t
|
|
@@ -5431,12 +5500,12 @@ function U(e, t) {
|
|
|
5431
5500
|
}
|
|
5432
5501
|
);
|
|
5433
5502
|
}
|
|
5434
|
-
function
|
|
5503
|
+
function pt(e) {
|
|
5435
5504
|
return Object.fromEntries(
|
|
5436
5505
|
Object.entries(e).map(([t, i]) => [t, i.config])
|
|
5437
5506
|
);
|
|
5438
5507
|
}
|
|
5439
|
-
function
|
|
5508
|
+
function Vi(e) {
|
|
5440
5509
|
return [
|
|
5441
5510
|
{
|
|
5442
5511
|
tag: `[data-style-type="${e.type}"]`,
|
|
@@ -5447,14 +5516,14 @@ function zi(e) {
|
|
|
5447
5516
|
}
|
|
5448
5517
|
];
|
|
5449
5518
|
}
|
|
5450
|
-
function
|
|
5519
|
+
function Ir(e, t) {
|
|
5451
5520
|
const i = Ce.create({
|
|
5452
5521
|
name: e.type,
|
|
5453
5522
|
addAttributes() {
|
|
5454
|
-
return
|
|
5523
|
+
return zi(e.propSchema);
|
|
5455
5524
|
},
|
|
5456
5525
|
parseHTML() {
|
|
5457
|
-
return
|
|
5526
|
+
return Vi(e);
|
|
5458
5527
|
},
|
|
5459
5528
|
renderHTML({ mark: o }) {
|
|
5460
5529
|
let n;
|
|
@@ -5463,8 +5532,8 @@ function Tr(e, t) {
|
|
|
5463
5532
|
else if (e.propSchema === "string")
|
|
5464
5533
|
n = t.render(o.attrs.stringValue);
|
|
5465
5534
|
else
|
|
5466
|
-
throw new
|
|
5467
|
-
return
|
|
5535
|
+
throw new P(e.propSchema);
|
|
5536
|
+
return Ri(
|
|
5468
5537
|
n,
|
|
5469
5538
|
e.type,
|
|
5470
5539
|
o.attrs.stringValue,
|
|
@@ -5472,11 +5541,45 @@ function Tr(e, t) {
|
|
|
5472
5541
|
);
|
|
5473
5542
|
}
|
|
5474
5543
|
});
|
|
5475
|
-
return
|
|
5544
|
+
return ut(e, {
|
|
5476
5545
|
mark: i
|
|
5477
5546
|
});
|
|
5478
5547
|
}
|
|
5479
|
-
const ue = (e) => {
|
|
5548
|
+
const ue = (e, t, i, o, n) => {
|
|
5549
|
+
const r = document.createElement("div");
|
|
5550
|
+
if (r.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
5551
|
+
const a = Oi(
|
|
5552
|
+
e,
|
|
5553
|
+
t,
|
|
5554
|
+
o,
|
|
5555
|
+
n
|
|
5556
|
+
);
|
|
5557
|
+
r.appendChild(a.dom);
|
|
5558
|
+
const s = document.createElement("div");
|
|
5559
|
+
s.className = "bn-file-loading-preview", s.textContent = "Loading...";
|
|
5560
|
+
const l = t.onUploadStart((u) => {
|
|
5561
|
+
u === e.id && (r.removeChild(a.dom), r.appendChild(s));
|
|
5562
|
+
}), d = t.onUploadEnd((u) => {
|
|
5563
|
+
u === e.id && (r.removeChild(s), r.appendChild(a.dom));
|
|
5564
|
+
});
|
|
5565
|
+
return {
|
|
5566
|
+
dom: r,
|
|
5567
|
+
destroy: () => {
|
|
5568
|
+
var u;
|
|
5569
|
+
(u = a.destroy) == null || u.call(a), l(), d();
|
|
5570
|
+
}
|
|
5571
|
+
};
|
|
5572
|
+
} else if (e.props.showPreview === !1) {
|
|
5573
|
+
const a = ht(e).dom;
|
|
5574
|
+
return {
|
|
5575
|
+
dom: ne(e, a).dom
|
|
5576
|
+
};
|
|
5577
|
+
} else
|
|
5578
|
+
return r.appendChild(i.dom), {
|
|
5579
|
+
dom: r,
|
|
5580
|
+
destroy: i.destroy
|
|
5581
|
+
};
|
|
5582
|
+
}, ht = (e) => {
|
|
5480
5583
|
const t = document.createElement("div");
|
|
5481
5584
|
t.className = "bn-file-default-preview";
|
|
5482
5585
|
const i = document.createElement("div");
|
|
@@ -5485,14 +5588,14 @@ const ue = (e) => {
|
|
|
5485
5588
|
return o.className = "bn-file-default-preview-name", o.textContent = e.props.name || "", t.appendChild(i), t.appendChild(o), {
|
|
5486
5589
|
dom: t
|
|
5487
5590
|
};
|
|
5488
|
-
},
|
|
5591
|
+
}, ne = (e, t) => {
|
|
5489
5592
|
const i = document.createElement("div");
|
|
5490
5593
|
i.className = "bn-file-and-caption-wrapper";
|
|
5491
5594
|
const o = document.createElement("p");
|
|
5492
5595
|
return o.className = "bn-file-caption", o.textContent = e.props.caption, i.appendChild(t), i.appendChild(o), {
|
|
5493
5596
|
dom: i
|
|
5494
5597
|
};
|
|
5495
|
-
},
|
|
5598
|
+
}, Oi = (e, t, i, o) => {
|
|
5496
5599
|
const n = document.createElement("div");
|
|
5497
5600
|
n.className = "bn-add-file-button";
|
|
5498
5601
|
const r = document.createElement("div");
|
|
@@ -5526,7 +5629,7 @@ const ue = (e) => {
|
|
|
5526
5629
|
);
|
|
5527
5630
|
}
|
|
5528
5631
|
};
|
|
5529
|
-
},
|
|
5632
|
+
}, Ge = (e) => ({ url: e.src || void 0 }), pe = (e, t) => {
|
|
5530
5633
|
const i = e.querySelector(
|
|
5531
5634
|
t
|
|
5532
5635
|
);
|
|
@@ -5534,7 +5637,7 @@ const ue = (e) => {
|
|
|
5534
5637
|
return;
|
|
5535
5638
|
const o = e.querySelector("figcaption"), n = (o == null ? void 0 : o.textContent) ?? void 0;
|
|
5536
5639
|
return { targetElement: i, caption: n };
|
|
5537
|
-
},
|
|
5640
|
+
}, he = (e, t) => {
|
|
5538
5641
|
const i = document.createElement("div"), o = document.createElement("p");
|
|
5539
5642
|
return o.textContent = t, i.appendChild(e), i.appendChild(o), {
|
|
5540
5643
|
dom: i
|
|
@@ -5542,7 +5645,7 @@ const ue = (e) => {
|
|
|
5542
5645
|
}, Te = (e, t) => {
|
|
5543
5646
|
const i = document.createElement("figure"), o = document.createElement("figcaption");
|
|
5544
5647
|
return o.textContent = t, i.appendChild(e), i.appendChild(o), { dom: i };
|
|
5545
|
-
},
|
|
5648
|
+
}, mt = (e, t, i, o, n) => {
|
|
5546
5649
|
if (!e.props.previewWidth)
|
|
5547
5650
|
throw new Error("Block must have a `previewWidth` prop.");
|
|
5548
5651
|
const r = document.createElement("div");
|
|
@@ -5552,36 +5655,36 @@ const ue = (e) => {
|
|
|
5552
5655
|
const s = document.createElement("div");
|
|
5553
5656
|
s.className = "bn-visual-media-resize-handle", s.style.right = "4px";
|
|
5554
5657
|
let l;
|
|
5555
|
-
const d = (
|
|
5658
|
+
const d = (g) => {
|
|
5556
5659
|
if (!l) {
|
|
5557
5660
|
!t.isEditable && r.contains(a) && r.contains(s) && (r.removeChild(a), r.removeChild(s));
|
|
5558
5661
|
return;
|
|
5559
5662
|
}
|
|
5560
|
-
let
|
|
5561
|
-
e.props.textAlignment === "center" ? l.handleUsed === "left" ?
|
|
5562
|
-
const
|
|
5563
|
-
|
|
5564
|
-
}, u = (
|
|
5565
|
-
(!
|
|
5663
|
+
let k;
|
|
5664
|
+
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;
|
|
5665
|
+
const w = 64;
|
|
5666
|
+
k < w ? n(w) : k > t.domElement.firstElementChild.clientWidth ? n(t.domElement.firstElementChild.clientWidth) : n(k);
|
|
5667
|
+
}, u = (g) => {
|
|
5668
|
+
(!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
5669
|
props: {
|
|
5567
5670
|
previewWidth: o()
|
|
5568
5671
|
}
|
|
5569
5672
|
}));
|
|
5570
5673
|
}, p = () => {
|
|
5571
5674
|
t.isEditable && (r.appendChild(a), r.appendChild(s));
|
|
5572
|
-
}, h = (
|
|
5573
|
-
|
|
5574
|
-
}, m = (
|
|
5575
|
-
|
|
5675
|
+
}, h = (g) => {
|
|
5676
|
+
g.relatedTarget === a || g.relatedTarget === s || l || t.isEditable && r.contains(a) && r.contains(s) && (r.removeChild(a), r.removeChild(s));
|
|
5677
|
+
}, m = (g) => {
|
|
5678
|
+
g.preventDefault(), r.appendChild(a), r.appendChild(s), l = {
|
|
5576
5679
|
handleUsed: "left",
|
|
5577
5680
|
initialWidth: e.props.previewWidth,
|
|
5578
|
-
initialClientX:
|
|
5681
|
+
initialClientX: g.clientX
|
|
5579
5682
|
};
|
|
5580
|
-
},
|
|
5581
|
-
|
|
5683
|
+
}, f = (g) => {
|
|
5684
|
+
g.preventDefault(), r.appendChild(a), r.appendChild(s), l = {
|
|
5582
5685
|
handleUsed: "right",
|
|
5583
5686
|
initialWidth: e.props.previewWidth,
|
|
5584
|
-
initialClientX:
|
|
5687
|
+
initialClientX: g.clientX
|
|
5585
5688
|
};
|
|
5586
5689
|
};
|
|
5587
5690
|
return r.appendChild(i), window.addEventListener("mousemove", d), window.addEventListener("mouseup", u), i.addEventListener("mouseenter", p), i.addEventListener("mouseleave", h), a.addEventListener(
|
|
@@ -5589,7 +5692,7 @@ const ue = (e) => {
|
|
|
5589
5692
|
m
|
|
5590
5693
|
), s.addEventListener(
|
|
5591
5694
|
"mousedown",
|
|
5592
|
-
|
|
5695
|
+
f
|
|
5593
5696
|
), {
|
|
5594
5697
|
dom: r,
|
|
5595
5698
|
destroy: () => {
|
|
@@ -5598,12 +5701,12 @@ const ue = (e) => {
|
|
|
5598
5701
|
m
|
|
5599
5702
|
), s.removeEventListener(
|
|
5600
5703
|
"mousedown",
|
|
5601
|
-
|
|
5704
|
+
f
|
|
5602
5705
|
);
|
|
5603
5706
|
}
|
|
5604
5707
|
};
|
|
5605
|
-
},
|
|
5606
|
-
backgroundColor:
|
|
5708
|
+
}, We = (e) => ({ url: e.src || void 0 }), Fi = {
|
|
5709
|
+
backgroundColor: v.backgroundColor,
|
|
5607
5710
|
// File name.
|
|
5608
5711
|
name: {
|
|
5609
5712
|
default: ""
|
|
@@ -5619,59 +5722,41 @@ const ue = (e) => {
|
|
|
5619
5722
|
showPreview: {
|
|
5620
5723
|
default: !0
|
|
5621
5724
|
}
|
|
5622
|
-
},
|
|
5725
|
+
}, Gi = {
|
|
5623
5726
|
type: "audio",
|
|
5624
|
-
propSchema:
|
|
5727
|
+
propSchema: Fi,
|
|
5625
5728
|
content: "none",
|
|
5626
5729
|
isFileBlock: !0,
|
|
5627
5730
|
fileBlockAccept: ["audio/*"]
|
|
5628
|
-
},
|
|
5731
|
+
}, Wi = (e, t) => {
|
|
5629
5732
|
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) => {
|
|
5733
|
+
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>';
|
|
5734
|
+
const o = document.createElement("audio");
|
|
5735
|
+
o.className = "bn-audio", t.resolveFileUrl(e.props.url).then((r) => {
|
|
5736
|
+
o.src = r;
|
|
5737
|
+
}), o.controls = !0, o.contentEditable = "false", o.draggable = !1;
|
|
5738
|
+
const n = ne(e, o);
|
|
5739
|
+
return ue(
|
|
5740
|
+
e,
|
|
5741
|
+
t,
|
|
5742
|
+
n,
|
|
5743
|
+
t.dictionary.file_blocks.audio.add_button_text,
|
|
5744
|
+
i.firstElementChild
|
|
5745
|
+
);
|
|
5746
|
+
}, Ki = (e) => {
|
|
5662
5747
|
if (e.tagName === "AUDIO")
|
|
5663
|
-
return
|
|
5748
|
+
return We(e);
|
|
5664
5749
|
if (e.tagName === "FIGURE") {
|
|
5665
|
-
const t =
|
|
5750
|
+
const t = pe(e, "audio");
|
|
5666
5751
|
if (!t)
|
|
5667
5752
|
return;
|
|
5668
5753
|
const { targetElement: i, caption: o } = t;
|
|
5669
5754
|
return {
|
|
5670
|
-
...
|
|
5755
|
+
...We(i),
|
|
5671
5756
|
caption: o
|
|
5672
5757
|
};
|
|
5673
5758
|
}
|
|
5674
|
-
},
|
|
5759
|
+
}, $i = (e) => {
|
|
5675
5760
|
if (!e.props.url) {
|
|
5676
5761
|
const i = document.createElement("p");
|
|
5677
5762
|
return i.textContent = "Add audio", {
|
|
@@ -5679,15 +5764,15 @@ const ue = (e) => {
|
|
|
5679
5764
|
};
|
|
5680
5765
|
}
|
|
5681
5766
|
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) :
|
|
5767
|
+
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
5768
|
dom: t
|
|
5684
5769
|
};
|
|
5685
|
-
},
|
|
5686
|
-
render:
|
|
5687
|
-
parse:
|
|
5688
|
-
toExternalHTML:
|
|
5689
|
-
}),
|
|
5690
|
-
backgroundColor:
|
|
5770
|
+
}, qi = ce(Gi, {
|
|
5771
|
+
render: Wi,
|
|
5772
|
+
parse: Ki,
|
|
5773
|
+
toExternalHTML: $i
|
|
5774
|
+
}), Xi = {
|
|
5775
|
+
backgroundColor: v.backgroundColor,
|
|
5691
5776
|
// File name.
|
|
5692
5777
|
name: {
|
|
5693
5778
|
default: ""
|
|
@@ -5700,39 +5785,28 @@ const ue = (e) => {
|
|
|
5700
5785
|
caption: {
|
|
5701
5786
|
default: ""
|
|
5702
5787
|
}
|
|
5703
|
-
},
|
|
5788
|
+
}, Zi = {
|
|
5704
5789
|
type: "file",
|
|
5705
|
-
propSchema:
|
|
5790
|
+
propSchema: Xi,
|
|
5706
5791
|
content: "none",
|
|
5707
5792
|
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) => {
|
|
5793
|
+
}, Ji = (e, t) => {
|
|
5794
|
+
const i = ht(e).dom, o = ne(e, i);
|
|
5795
|
+
return ue(e, t, o);
|
|
5796
|
+
}, Yi = (e) => {
|
|
5723
5797
|
if (e.tagName === "EMBED")
|
|
5724
|
-
return
|
|
5798
|
+
return Ge(e);
|
|
5725
5799
|
if (e.tagName === "FIGURE") {
|
|
5726
|
-
const t =
|
|
5800
|
+
const t = pe(e, "embed");
|
|
5727
5801
|
if (!t)
|
|
5728
5802
|
return;
|
|
5729
5803
|
const { targetElement: i, caption: o } = t;
|
|
5730
5804
|
return {
|
|
5731
|
-
...
|
|
5805
|
+
...Ge(i),
|
|
5732
5806
|
caption: o
|
|
5733
5807
|
};
|
|
5734
5808
|
}
|
|
5735
|
-
},
|
|
5809
|
+
}, Qi = (e) => {
|
|
5736
5810
|
if (!e.props.url) {
|
|
5737
5811
|
const i = document.createElement("p");
|
|
5738
5812
|
return i.textContent = "Add file", {
|
|
@@ -5740,14 +5814,14 @@ const ue = (e) => {
|
|
|
5740
5814
|
};
|
|
5741
5815
|
}
|
|
5742
5816
|
const t = document.createElement("a");
|
|
5743
|
-
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ?
|
|
5817
|
+
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ? he(t, e.props.caption) : {
|
|
5744
5818
|
dom: t
|
|
5745
5819
|
};
|
|
5746
|
-
},
|
|
5747
|
-
render:
|
|
5748
|
-
parse:
|
|
5749
|
-
toExternalHTML:
|
|
5750
|
-
}),
|
|
5820
|
+
}, eo = ce(Zi, {
|
|
5821
|
+
render: Ji,
|
|
5822
|
+
parse: Yi,
|
|
5823
|
+
toExternalHTML: Qi
|
|
5824
|
+
}), Ar = async (e) => {
|
|
5751
5825
|
const t = new FormData();
|
|
5752
5826
|
return t.append("file", e), (await (await fetch("https://tmpfiles.org/api/v1/upload", {
|
|
5753
5827
|
method: "POST",
|
|
@@ -5756,12 +5830,12 @@ const ue = (e) => {
|
|
|
5756
5830
|
"tmpfiles.org/",
|
|
5757
5831
|
"tmpfiles.org/dl/"
|
|
5758
5832
|
);
|
|
5759
|
-
},
|
|
5833
|
+
}, Ke = (e) => {
|
|
5760
5834
|
const t = e.src || void 0, i = e.width || void 0;
|
|
5761
5835
|
return { url: t, previewWidth: i };
|
|
5762
|
-
},
|
|
5763
|
-
textAlignment:
|
|
5764
|
-
backgroundColor:
|
|
5836
|
+
}, to = {
|
|
5837
|
+
textAlignment: v.textAlignment,
|
|
5838
|
+
backgroundColor: v.backgroundColor,
|
|
5765
5839
|
// File name.
|
|
5766
5840
|
name: {
|
|
5767
5841
|
default: ""
|
|
@@ -5781,69 +5855,50 @@ const ue = (e) => {
|
|
|
5781
5855
|
previewWidth: {
|
|
5782
5856
|
default: 512
|
|
5783
5857
|
}
|
|
5784
|
-
},
|
|
5858
|
+
}, io = {
|
|
5785
5859
|
type: "image",
|
|
5786
|
-
propSchema:
|
|
5860
|
+
propSchema: to,
|
|
5787
5861
|
content: "none",
|
|
5788
5862
|
isFileBlock: !0,
|
|
5789
5863
|
fileBlockAccept: ["image/*"]
|
|
5790
|
-
},
|
|
5864
|
+
}, oo = (e, t) => {
|
|
5791
5865
|
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) => {
|
|
5866
|
+
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>';
|
|
5867
|
+
const o = document.createElement("img");
|
|
5868
|
+
o.className = "bn-visual-media", t.resolveFileUrl(e.props.url).then((a) => {
|
|
5869
|
+
o.src = a;
|
|
5870
|
+
}), o.alt = e.props.name || e.props.caption || "BlockNote image", o.contentEditable = "false", o.draggable = !1, o.width = Math.min(
|
|
5871
|
+
e.props.previewWidth,
|
|
5872
|
+
t.domElement.firstElementChild.clientWidth
|
|
5873
|
+
);
|
|
5874
|
+
const n = mt(
|
|
5875
|
+
e,
|
|
5876
|
+
t,
|
|
5877
|
+
o,
|
|
5878
|
+
() => o.width,
|
|
5879
|
+
(a) => o.width = a
|
|
5880
|
+
), r = ne(e, n.dom);
|
|
5881
|
+
return ue(
|
|
5882
|
+
e,
|
|
5883
|
+
t,
|
|
5884
|
+
r,
|
|
5885
|
+
t.dictionary.file_blocks.image.add_button_text,
|
|
5886
|
+
i.firstElementChild
|
|
5887
|
+
);
|
|
5888
|
+
}, no = (e) => {
|
|
5834
5889
|
if (e.tagName === "IMG")
|
|
5835
|
-
return
|
|
5890
|
+
return Ke(e);
|
|
5836
5891
|
if (e.tagName === "FIGURE") {
|
|
5837
|
-
const t =
|
|
5892
|
+
const t = pe(e, "img");
|
|
5838
5893
|
if (!t)
|
|
5839
5894
|
return;
|
|
5840
5895
|
const { targetElement: i, caption: o } = t;
|
|
5841
5896
|
return {
|
|
5842
|
-
...
|
|
5897
|
+
...Ke(i),
|
|
5843
5898
|
caption: o
|
|
5844
5899
|
};
|
|
5845
5900
|
}
|
|
5846
|
-
},
|
|
5901
|
+
}, ro = (e) => {
|
|
5847
5902
|
if (!e.props.url) {
|
|
5848
5903
|
const i = document.createElement("p");
|
|
5849
5904
|
return i.textContent = "Add image", {
|
|
@@ -5851,19 +5906,19 @@ const ue = (e) => {
|
|
|
5851
5906
|
};
|
|
5852
5907
|
}
|
|
5853
5908
|
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) :
|
|
5909
|
+
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
5910
|
dom: t
|
|
5856
5911
|
};
|
|
5857
|
-
},
|
|
5858
|
-
render:
|
|
5859
|
-
parse:
|
|
5860
|
-
toExternalHTML:
|
|
5861
|
-
}),
|
|
5912
|
+
}, ao = ce(io, {
|
|
5913
|
+
render: oo,
|
|
5914
|
+
parse: no,
|
|
5915
|
+
toExternalHTML: ro
|
|
5916
|
+
}), $e = (e) => {
|
|
5862
5917
|
const t = e.src || void 0, i = e.width || void 0;
|
|
5863
5918
|
return { url: t, previewWidth: i };
|
|
5864
|
-
},
|
|
5865
|
-
textAlignment:
|
|
5866
|
-
backgroundColor:
|
|
5919
|
+
}, so = {
|
|
5920
|
+
textAlignment: v.textAlignment,
|
|
5921
|
+
backgroundColor: v.backgroundColor,
|
|
5867
5922
|
// File name.
|
|
5868
5923
|
name: {
|
|
5869
5924
|
default: ""
|
|
@@ -5883,67 +5938,48 @@ const ue = (e) => {
|
|
|
5883
5938
|
previewWidth: {
|
|
5884
5939
|
default: 512
|
|
5885
5940
|
}
|
|
5886
|
-
},
|
|
5941
|
+
}, lo = {
|
|
5887
5942
|
type: "video",
|
|
5888
|
-
propSchema:
|
|
5943
|
+
propSchema: so,
|
|
5889
5944
|
content: "none",
|
|
5890
5945
|
isFileBlock: !0,
|
|
5891
5946
|
fileBlockAccept: ["video/*"]
|
|
5892
|
-
},
|
|
5947
|
+
}, co = (e, t) => {
|
|
5893
5948
|
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) => {
|
|
5949
|
+
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>';
|
|
5950
|
+
const o = document.createElement("video");
|
|
5951
|
+
o.className = "bn-visual-media", o.src = e.props.url, o.controls = !0, o.contentEditable = "false", o.draggable = !1, o.width = Math.min(
|
|
5952
|
+
e.props.previewWidth,
|
|
5953
|
+
t.domElement.firstElementChild.clientWidth
|
|
5954
|
+
);
|
|
5955
|
+
const n = mt(
|
|
5956
|
+
e,
|
|
5957
|
+
t,
|
|
5958
|
+
o,
|
|
5959
|
+
() => o.width,
|
|
5960
|
+
(a) => o.width = a
|
|
5961
|
+
), r = ne(e, n.dom);
|
|
5962
|
+
return ue(
|
|
5963
|
+
e,
|
|
5964
|
+
t,
|
|
5965
|
+
r,
|
|
5966
|
+
t.dictionary.file_blocks.video.add_button_text,
|
|
5967
|
+
i.firstElementChild
|
|
5968
|
+
);
|
|
5969
|
+
}, uo = (e) => {
|
|
5934
5970
|
if (e.tagName === "VIDEO")
|
|
5935
|
-
return
|
|
5971
|
+
return $e(e);
|
|
5936
5972
|
if (e.tagName === "FIGURE") {
|
|
5937
|
-
const t =
|
|
5973
|
+
const t = pe(e, "video");
|
|
5938
5974
|
if (!t)
|
|
5939
5975
|
return;
|
|
5940
5976
|
const { targetElement: i, caption: o } = t;
|
|
5941
5977
|
return {
|
|
5942
|
-
|
|
5978
|
+
...$e(i),
|
|
5943
5979
|
caption: o
|
|
5944
5980
|
};
|
|
5945
5981
|
}
|
|
5946
|
-
},
|
|
5982
|
+
}, po = (e) => {
|
|
5947
5983
|
if (!e.props.url) {
|
|
5948
5984
|
const i = document.createElement("p");
|
|
5949
5985
|
return i.textContent = "Add video", {
|
|
@@ -5951,14 +5987,14 @@ const ue = (e) => {
|
|
|
5951
5987
|
};
|
|
5952
5988
|
}
|
|
5953
5989
|
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) :
|
|
5990
|
+
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
5991
|
dom: t
|
|
5956
5992
|
};
|
|
5957
|
-
},
|
|
5958
|
-
render:
|
|
5959
|
-
parse:
|
|
5960
|
-
toExternalHTML:
|
|
5961
|
-
}),
|
|
5993
|
+
}, ho = ce(lo, {
|
|
5994
|
+
render: co,
|
|
5995
|
+
parse: uo,
|
|
5996
|
+
toExternalHTML: po
|
|
5997
|
+
}), mo = Ce.create({
|
|
5962
5998
|
name: "backgroundColor",
|
|
5963
5999
|
addAttributes() {
|
|
5964
6000
|
return {
|
|
@@ -5984,10 +6020,10 @@ const ue = (e) => {
|
|
|
5984
6020
|
renderHTML({ HTMLAttributes: e }) {
|
|
5985
6021
|
return ["span", e, 0];
|
|
5986
6022
|
}
|
|
5987
|
-
}),
|
|
5988
|
-
|
|
6023
|
+
}), fo = j(
|
|
6024
|
+
mo,
|
|
5989
6025
|
"string"
|
|
5990
|
-
),
|
|
6026
|
+
), go = Ce.create({
|
|
5991
6027
|
name: "textColor",
|
|
5992
6028
|
addAttributes() {
|
|
5993
6029
|
return {
|
|
@@ -6011,10 +6047,10 @@ const ue = (e) => {
|
|
|
6011
6047
|
renderHTML({ HTMLAttributes: e }) {
|
|
6012
6048
|
return ["span", e, 0];
|
|
6013
6049
|
}
|
|
6014
|
-
}),
|
|
6015
|
-
...
|
|
6050
|
+
}), bo = j(go, "string"), _o = {
|
|
6051
|
+
...v,
|
|
6016
6052
|
level: { default: 1, values: [1, 2, 3] }
|
|
6017
|
-
},
|
|
6053
|
+
}, ko = F({
|
|
6018
6054
|
name: "heading",
|
|
6019
6055
|
content: "inline*",
|
|
6020
6056
|
group: "blockContent",
|
|
@@ -6036,10 +6072,10 @@ const ue = (e) => {
|
|
|
6036
6072
|
},
|
|
6037
6073
|
addInputRules() {
|
|
6038
6074
|
return [
|
|
6039
|
-
...[1, 2, 3].map((e) => new
|
|
6075
|
+
...[1, 2, 3].map((e) => new ee({
|
|
6040
6076
|
find: new RegExp(`^(#{${e}})\\s$`),
|
|
6041
6077
|
handler: ({ state: t, chain: i, range: o }) => {
|
|
6042
|
-
|
|
6078
|
+
B(this.editor) === "inline*" && i().BNUpdateBlock(t.selection.from, {
|
|
6043
6079
|
type: "heading",
|
|
6044
6080
|
props: {
|
|
6045
6081
|
level: e
|
|
@@ -6051,7 +6087,7 @@ const ue = (e) => {
|
|
|
6051
6087
|
},
|
|
6052
6088
|
addKeyboardShortcuts() {
|
|
6053
6089
|
return {
|
|
6054
|
-
"Mod-Alt-1": () =>
|
|
6090
|
+
"Mod-Alt-1": () => B(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6055
6091
|
this.editor.state.selection.anchor,
|
|
6056
6092
|
{
|
|
6057
6093
|
type: "heading",
|
|
@@ -6060,7 +6096,7 @@ const ue = (e) => {
|
|
|
6060
6096
|
}
|
|
6061
6097
|
}
|
|
6062
6098
|
),
|
|
6063
|
-
"Mod-Alt-2": () =>
|
|
6099
|
+
"Mod-Alt-2": () => B(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6064
6100
|
this.editor.state.selection.anchor,
|
|
6065
6101
|
{
|
|
6066
6102
|
type: "heading",
|
|
@@ -6069,7 +6105,7 @@ const ue = (e) => {
|
|
|
6069
6105
|
}
|
|
6070
6106
|
}
|
|
6071
6107
|
),
|
|
6072
|
-
"Mod-Alt-3": () =>
|
|
6108
|
+
"Mod-Alt-3": () => B(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6073
6109
|
this.editor.state.selection.anchor,
|
|
6074
6110
|
{
|
|
6075
6111
|
type: "heading",
|
|
@@ -6107,7 +6143,7 @@ const ue = (e) => {
|
|
|
6107
6143
|
},
|
|
6108
6144
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
6109
6145
|
var i, o;
|
|
6110
|
-
return
|
|
6146
|
+
return O(
|
|
6111
6147
|
this.name,
|
|
6112
6148
|
`h${e.attrs.level}`,
|
|
6113
6149
|
{
|
|
@@ -6117,9 +6153,9 @@ const ue = (e) => {
|
|
|
6117
6153
|
((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
|
|
6118
6154
|
);
|
|
6119
6155
|
}
|
|
6120
|
-
}),
|
|
6121
|
-
|
|
6122
|
-
|
|
6156
|
+
}), yo = X(
|
|
6157
|
+
ko,
|
|
6158
|
+
_o
|
|
6123
6159
|
), Be = (e) => {
|
|
6124
6160
|
const { contentNode: t, contentType: i } = _(
|
|
6125
6161
|
e.state.doc,
|
|
@@ -6139,9 +6175,9 @@ const ue = (e) => {
|
|
|
6139
6175
|
a.command(() => t.childCount > 0 ? (r().deleteSelection().BNSplitBlock(n.selection.from, !0).run(), !0) : !1)
|
|
6140
6176
|
)
|
|
6141
6177
|
]);
|
|
6142
|
-
},
|
|
6143
|
-
...
|
|
6144
|
-
},
|
|
6178
|
+
}, vo = {
|
|
6179
|
+
...v
|
|
6180
|
+
}, wo = F({
|
|
6145
6181
|
name: "bulletListItem",
|
|
6146
6182
|
content: "inline*",
|
|
6147
6183
|
group: "blockContent",
|
|
@@ -6151,10 +6187,10 @@ const ue = (e) => {
|
|
|
6151
6187
|
addInputRules() {
|
|
6152
6188
|
return [
|
|
6153
6189
|
// Creates an unordered list when starting with "-", "+", or "*".
|
|
6154
|
-
new
|
|
6190
|
+
new ee({
|
|
6155
6191
|
find: new RegExp("^[-+*]\\s$"),
|
|
6156
6192
|
handler: ({ state: e, chain: t, range: i }) => {
|
|
6157
|
-
|
|
6193
|
+
B(this.editor) === "inline*" && t().BNUpdateBlock(e.selection.from, {
|
|
6158
6194
|
type: "bulletListItem",
|
|
6159
6195
|
props: {}
|
|
6160
6196
|
}).deleteRange({ from: i.from, to: i.to });
|
|
@@ -6165,7 +6201,7 @@ const ue = (e) => {
|
|
|
6165
6201
|
addKeyboardShortcuts() {
|
|
6166
6202
|
return {
|
|
6167
6203
|
Enter: () => Be(this.editor),
|
|
6168
|
-
"Mod-Shift-8": () =>
|
|
6204
|
+
"Mod-Shift-8": () => B(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6169
6205
|
this.editor.state.selection.anchor,
|
|
6170
6206
|
{
|
|
6171
6207
|
type: "bulletListItem",
|
|
@@ -6207,7 +6243,7 @@ const ue = (e) => {
|
|
|
6207
6243
|
},
|
|
6208
6244
|
renderHTML({ HTMLAttributes: e }) {
|
|
6209
6245
|
var t, i;
|
|
6210
|
-
return
|
|
6246
|
+
return O(
|
|
6211
6247
|
this.name,
|
|
6212
6248
|
// We use a <p> tag, because for <li> tags we'd need a <ul> element to put
|
|
6213
6249
|
// them in to be semantically correct, which we can't have due to the
|
|
@@ -6220,11 +6256,11 @@ const ue = (e) => {
|
|
|
6220
6256
|
((i = this.options.domAttributes) == null ? void 0 : i.inlineContent) || {}
|
|
6221
6257
|
);
|
|
6222
6258
|
}
|
|
6223
|
-
}),
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
),
|
|
6227
|
-
key:
|
|
6259
|
+
}), xo = X(
|
|
6260
|
+
wo,
|
|
6261
|
+
vo
|
|
6262
|
+
), Eo = new L("numbered-list-indexing"), Co = () => new x({
|
|
6263
|
+
key: Eo,
|
|
6228
6264
|
appendTransaction: (e, t, i) => {
|
|
6229
6265
|
const o = i.tr;
|
|
6230
6266
|
o.setMeta("numberedListIndexing", !0);
|
|
@@ -6240,10 +6276,10 @@ const ue = (e) => {
|
|
|
6240
6276
|
if (h === void 0)
|
|
6241
6277
|
return;
|
|
6242
6278
|
if (!(d.depth !== h.depth)) {
|
|
6243
|
-
const
|
|
6279
|
+
const f = h.contentNode;
|
|
6244
6280
|
if (h.contentType.name === "numberedListItem") {
|
|
6245
|
-
const
|
|
6246
|
-
s = (parseInt(
|
|
6281
|
+
const w = f.attrs.index;
|
|
6282
|
+
s = (parseInt(w) + 1).toString();
|
|
6247
6283
|
}
|
|
6248
6284
|
}
|
|
6249
6285
|
}
|
|
@@ -6253,9 +6289,9 @@ const ue = (e) => {
|
|
|
6253
6289
|
}
|
|
6254
6290
|
}), n ? o : null;
|
|
6255
6291
|
}
|
|
6256
|
-
}),
|
|
6257
|
-
...
|
|
6258
|
-
},
|
|
6292
|
+
}), So = {
|
|
6293
|
+
...v
|
|
6294
|
+
}, Mo = F({
|
|
6259
6295
|
name: "numberedListItem",
|
|
6260
6296
|
content: "inline*",
|
|
6261
6297
|
group: "blockContent",
|
|
@@ -6274,10 +6310,10 @@ const ue = (e) => {
|
|
|
6274
6310
|
addInputRules() {
|
|
6275
6311
|
return [
|
|
6276
6312
|
// Creates an ordered list when starting with "1.".
|
|
6277
|
-
new
|
|
6313
|
+
new ee({
|
|
6278
6314
|
find: new RegExp("^1\\.\\s$"),
|
|
6279
6315
|
handler: ({ state: e, chain: t, range: i }) => {
|
|
6280
|
-
|
|
6316
|
+
B(this.editor) === "inline*" && t().BNUpdateBlock(e.selection.from, {
|
|
6281
6317
|
type: "numberedListItem",
|
|
6282
6318
|
props: {}
|
|
6283
6319
|
}).deleteRange({ from: i.from, to: i.to });
|
|
@@ -6288,7 +6324,7 @@ const ue = (e) => {
|
|
|
6288
6324
|
addKeyboardShortcuts() {
|
|
6289
6325
|
return {
|
|
6290
6326
|
Enter: () => Be(this.editor),
|
|
6291
|
-
"Mod-Shift-7": () =>
|
|
6327
|
+
"Mod-Shift-7": () => B(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6292
6328
|
this.editor.state.selection.anchor,
|
|
6293
6329
|
{
|
|
6294
6330
|
type: "numberedListItem",
|
|
@@ -6298,7 +6334,7 @@ const ue = (e) => {
|
|
|
6298
6334
|
};
|
|
6299
6335
|
},
|
|
6300
6336
|
addProseMirrorPlugins() {
|
|
6301
|
-
return [
|
|
6337
|
+
return [Co()];
|
|
6302
6338
|
},
|
|
6303
6339
|
parseHTML() {
|
|
6304
6340
|
return [
|
|
@@ -6335,7 +6371,7 @@ const ue = (e) => {
|
|
|
6335
6371
|
},
|
|
6336
6372
|
renderHTML({ HTMLAttributes: e }) {
|
|
6337
6373
|
var t, i;
|
|
6338
|
-
return
|
|
6374
|
+
return O(
|
|
6339
6375
|
this.name,
|
|
6340
6376
|
// We use a <p> tag, because for <li> tags we'd need an <ol> element to
|
|
6341
6377
|
// put them in to be semantically correct, which we can't have due to the
|
|
@@ -6348,15 +6384,15 @@ const ue = (e) => {
|
|
|
6348
6384
|
((i = this.options.domAttributes) == null ? void 0 : i.inlineContent) || {}
|
|
6349
6385
|
);
|
|
6350
6386
|
}
|
|
6351
|
-
}),
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
),
|
|
6355
|
-
...
|
|
6387
|
+
}), To = X(
|
|
6388
|
+
Mo,
|
|
6389
|
+
So
|
|
6390
|
+
), Bo = {
|
|
6391
|
+
...v,
|
|
6356
6392
|
checked: {
|
|
6357
6393
|
default: !1
|
|
6358
6394
|
}
|
|
6359
|
-
},
|
|
6395
|
+
}, Lo = F({
|
|
6360
6396
|
name: "checkListItem",
|
|
6361
6397
|
content: "inline*",
|
|
6362
6398
|
group: "blockContent",
|
|
@@ -6375,10 +6411,10 @@ const ue = (e) => {
|
|
|
6375
6411
|
addInputRules() {
|
|
6376
6412
|
return [
|
|
6377
6413
|
// Creates a checklist when starting with "[]" or "[X]".
|
|
6378
|
-
new
|
|
6414
|
+
new ee({
|
|
6379
6415
|
find: new RegExp("\\[\\s*\\]\\s$"),
|
|
6380
6416
|
handler: ({ state: e, chain: t, range: i }) => {
|
|
6381
|
-
|
|
6417
|
+
B(this.editor) === "inline*" && t().BNUpdateBlock(e.selection.from, {
|
|
6382
6418
|
type: "checkListItem",
|
|
6383
6419
|
props: {
|
|
6384
6420
|
checked: !1
|
|
@@ -6386,10 +6422,10 @@ const ue = (e) => {
|
|
|
6386
6422
|
}).deleteRange({ from: i.from, to: i.to });
|
|
6387
6423
|
}
|
|
6388
6424
|
}),
|
|
6389
|
-
new
|
|
6425
|
+
new ee({
|
|
6390
6426
|
find: new RegExp("\\[[Xx]\\]\\s$"),
|
|
6391
6427
|
handler: ({ state: e, chain: t, range: i }) => {
|
|
6392
|
-
|
|
6428
|
+
B(this.editor) === "inline*" && t().BNUpdateBlock(e.selection.from, {
|
|
6393
6429
|
type: "checkListItem",
|
|
6394
6430
|
props: {
|
|
6395
6431
|
checked: !0
|
|
@@ -6402,7 +6438,7 @@ const ue = (e) => {
|
|
|
6402
6438
|
addKeyboardShortcuts() {
|
|
6403
6439
|
return {
|
|
6404
6440
|
Enter: () => Be(this.editor),
|
|
6405
|
-
"Mod-Shift-9": () =>
|
|
6441
|
+
"Mod-Shift-9": () => B(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6406
6442
|
this.editor.state.selection.anchor,
|
|
6407
6443
|
{
|
|
6408
6444
|
type: "checkListItem",
|
|
@@ -6453,7 +6489,7 @@ const ue = (e) => {
|
|
|
6453
6489
|
var r, a;
|
|
6454
6490
|
const i = document.createElement("input");
|
|
6455
6491
|
i.type = "checkbox", i.checked = e.attrs.checked, e.attrs.checked && i.setAttribute("checked", "");
|
|
6456
|
-
const { dom: o, contentDOM: n } =
|
|
6492
|
+
const { dom: o, contentDOM: n } = O(
|
|
6457
6493
|
this.name,
|
|
6458
6494
|
"p",
|
|
6459
6495
|
{
|
|
@@ -6486,7 +6522,7 @@ const ue = (e) => {
|
|
|
6486
6522
|
});
|
|
6487
6523
|
};
|
|
6488
6524
|
a.addEventListener("change", s);
|
|
6489
|
-
const { dom: l, contentDOM: d } =
|
|
6525
|
+
const { dom: l, contentDOM: d } = O(
|
|
6490
6526
|
this.name,
|
|
6491
6527
|
"p",
|
|
6492
6528
|
{
|
|
@@ -6508,18 +6544,18 @@ const ue = (e) => {
|
|
|
6508
6544
|
};
|
|
6509
6545
|
};
|
|
6510
6546
|
}
|
|
6511
|
-
}),
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
),
|
|
6515
|
-
...
|
|
6516
|
-
},
|
|
6547
|
+
}), Io = X(
|
|
6548
|
+
Lo,
|
|
6549
|
+
Bo
|
|
6550
|
+
), Ao = {
|
|
6551
|
+
...v
|
|
6552
|
+
}, No = F({
|
|
6517
6553
|
name: "paragraph",
|
|
6518
6554
|
content: "inline*",
|
|
6519
6555
|
group: "blockContent",
|
|
6520
6556
|
addKeyboardShortcuts() {
|
|
6521
6557
|
return {
|
|
6522
|
-
"Mod-Alt-0": () =>
|
|
6558
|
+
"Mod-Alt-0": () => B(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6523
6559
|
this.editor.state.selection.anchor,
|
|
6524
6560
|
{
|
|
6525
6561
|
type: "paragraph",
|
|
@@ -6544,7 +6580,7 @@ const ue = (e) => {
|
|
|
6544
6580
|
},
|
|
6545
6581
|
renderHTML({ HTMLAttributes: e }) {
|
|
6546
6582
|
var t, i;
|
|
6547
|
-
return
|
|
6583
|
+
return O(
|
|
6548
6584
|
this.name,
|
|
6549
6585
|
"p",
|
|
6550
6586
|
{
|
|
@@ -6554,16 +6590,16 @@ const ue = (e) => {
|
|
|
6554
6590
|
((i = this.options.domAttributes) == null ? void 0 : i.inlineContent) || {}
|
|
6555
6591
|
);
|
|
6556
6592
|
}
|
|
6557
|
-
}),
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
),
|
|
6593
|
+
}), Po = X(
|
|
6594
|
+
No,
|
|
6595
|
+
Ao
|
|
6596
|
+
), Ho = I.create({
|
|
6561
6597
|
name: "BlockNoteTableExtension",
|
|
6562
6598
|
addProseMirrorPlugins: () => [
|
|
6563
|
-
|
|
6599
|
+
ii({
|
|
6564
6600
|
cellMinWidth: 100
|
|
6565
6601
|
}),
|
|
6566
|
-
|
|
6602
|
+
oi()
|
|
6567
6603
|
],
|
|
6568
6604
|
addKeyboardShortcuts() {
|
|
6569
6605
|
return {
|
|
@@ -6584,14 +6620,14 @@ const ue = (e) => {
|
|
|
6584
6620
|
storage: e.storage
|
|
6585
6621
|
};
|
|
6586
6622
|
return {
|
|
6587
|
-
tableRole:
|
|
6588
|
-
|
|
6623
|
+
tableRole: Ut(
|
|
6624
|
+
Dt(e, "tableRole", t)
|
|
6589
6625
|
)
|
|
6590
6626
|
};
|
|
6591
6627
|
}
|
|
6592
|
-
}),
|
|
6593
|
-
...
|
|
6594
|
-
},
|
|
6628
|
+
}), Uo = {
|
|
6629
|
+
...v
|
|
6630
|
+
}, Do = F({
|
|
6595
6631
|
name: "table",
|
|
6596
6632
|
content: "tableRow+",
|
|
6597
6633
|
group: "blockContent",
|
|
@@ -6602,7 +6638,7 @@ const ue = (e) => {
|
|
|
6602
6638
|
},
|
|
6603
6639
|
renderHTML({ HTMLAttributes: e }) {
|
|
6604
6640
|
var t, i;
|
|
6605
|
-
return
|
|
6641
|
+
return O(
|
|
6606
6642
|
this.name,
|
|
6607
6643
|
"table",
|
|
6608
6644
|
{
|
|
@@ -6612,7 +6648,7 @@ const ue = (e) => {
|
|
|
6612
6648
|
((i = this.options.domAttributes) == null ? void 0 : i.inlineContent) || {}
|
|
6613
6649
|
);
|
|
6614
6650
|
}
|
|
6615
|
-
}),
|
|
6651
|
+
}), jo = q.create({
|
|
6616
6652
|
name: "tableParagraph",
|
|
6617
6653
|
group: "tableContent",
|
|
6618
6654
|
content: "inline*",
|
|
@@ -6633,72 +6669,72 @@ const ue = (e) => {
|
|
|
6633
6669
|
renderHTML({ HTMLAttributes: e }) {
|
|
6634
6670
|
return [
|
|
6635
6671
|
"p",
|
|
6636
|
-
|
|
6672
|
+
jt(this.options.HTMLAttributes, e),
|
|
6637
6673
|
0
|
|
6638
6674
|
];
|
|
6639
6675
|
}
|
|
6640
|
-
}),
|
|
6641
|
-
|
|
6642
|
-
|
|
6676
|
+
}), zo = X(
|
|
6677
|
+
Do,
|
|
6678
|
+
Uo,
|
|
6643
6679
|
[
|
|
6644
|
-
Ao,
|
|
6645
6680
|
Ho,
|
|
6646
|
-
|
|
6681
|
+
jo,
|
|
6682
|
+
ei.extend({
|
|
6647
6683
|
content: "tableContent"
|
|
6648
6684
|
}),
|
|
6649
|
-
|
|
6685
|
+
Qt.extend({
|
|
6650
6686
|
content: "tableContent"
|
|
6651
6687
|
}),
|
|
6652
|
-
|
|
6688
|
+
ti
|
|
6653
6689
|
]
|
|
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
|
-
},
|
|
6690
|
+
), ft = {
|
|
6691
|
+
paragraph: Po,
|
|
6692
|
+
heading: yo,
|
|
6693
|
+
bulletListItem: xo,
|
|
6694
|
+
numberedListItem: To,
|
|
6695
|
+
checkListItem: Io,
|
|
6696
|
+
table: zo,
|
|
6697
|
+
file: eo,
|
|
6698
|
+
image: ao,
|
|
6699
|
+
video: ho,
|
|
6700
|
+
audio: qi
|
|
6701
|
+
}, Ro = dt(ft), gt = {
|
|
6702
|
+
bold: j(qt, "boolean"),
|
|
6703
|
+
italic: j(Zt, "boolean"),
|
|
6704
|
+
underline: j(Yt, "boolean"),
|
|
6705
|
+
strike: j(Jt, "boolean"),
|
|
6706
|
+
code: j(Xt, "boolean"),
|
|
6707
|
+
textColor: bo,
|
|
6708
|
+
backgroundColor: fo
|
|
6709
|
+
}, Nr = pt(gt), bt = {
|
|
6674
6710
|
text: { config: "text", implementation: {} },
|
|
6675
6711
|
link: { config: "link", implementation: {} }
|
|
6676
|
-
},
|
|
6677
|
-
|
|
6712
|
+
}, Vo = ct(
|
|
6713
|
+
bt
|
|
6678
6714
|
);
|
|
6679
|
-
function
|
|
6680
|
-
return e in t.schema.blockSchema && t.schema.blockSchema[e] ===
|
|
6715
|
+
function T(e, t) {
|
|
6716
|
+
return e in t.schema.blockSchema && t.schema.blockSchema[e] === Ro[e];
|
|
6681
6717
|
}
|
|
6682
|
-
function
|
|
6683
|
-
return e in t.schema.inlineContentSchema && t.schema.inlineContentSchema[e] ===
|
|
6718
|
+
function Oo(e, t) {
|
|
6719
|
+
return e in t.schema.inlineContentSchema && t.schema.inlineContentSchema[e] === Vo[e];
|
|
6684
6720
|
}
|
|
6685
|
-
function
|
|
6686
|
-
return t.type === e && t.type in i.schema.blockSchema &&
|
|
6721
|
+
function Fo(e, t, i) {
|
|
6722
|
+
return t.type === e && t.type in i.schema.blockSchema && T(t.type, i);
|
|
6687
6723
|
}
|
|
6688
|
-
function
|
|
6724
|
+
function Pr(e, t) {
|
|
6689
6725
|
return e.type in t.schema.blockSchema && t.schema.blockSchema[e.type].isFileBlock || !1;
|
|
6690
6726
|
}
|
|
6691
|
-
function
|
|
6727
|
+
function Hr(e, t) {
|
|
6692
6728
|
return e.type in t.schema.blockSchema && t.schema.blockSchema[e.type].isFileBlock && "showPreview" in t.schema.blockSchema[e.type].propSchema || !1;
|
|
6693
6729
|
}
|
|
6694
|
-
function
|
|
6730
|
+
function Ur(e, t) {
|
|
6695
6731
|
return t.schema.blockSchema[e.type].isFileBlock && !e.props.url;
|
|
6696
6732
|
}
|
|
6697
|
-
function
|
|
6698
|
-
return t in i.schema.blockSchema && e in i.schema.blockSchema[t].propSchema && i.schema.blockSchema[t].propSchema[e] ===
|
|
6733
|
+
function Go(e, t, i) {
|
|
6734
|
+
return t in i.schema.blockSchema && e in i.schema.blockSchema[t].propSchema && i.schema.blockSchema[t].propSchema[e] === v[e];
|
|
6699
6735
|
}
|
|
6700
|
-
function
|
|
6701
|
-
return
|
|
6736
|
+
function Dr(e, t, i) {
|
|
6737
|
+
return Go(e, t.type, i);
|
|
6702
6738
|
}
|
|
6703
6739
|
function Le(e, t) {
|
|
6704
6740
|
let i, o;
|
|
@@ -6709,11 +6745,11 @@ function Le(e, t) {
|
|
|
6709
6745
|
posBeforeNode: o
|
|
6710
6746
|
};
|
|
6711
6747
|
}
|
|
6712
|
-
function
|
|
6748
|
+
function Wo(e, t, i = "before", o) {
|
|
6713
6749
|
const n = typeof t == "string" ? t : t.id, r = [];
|
|
6714
6750
|
for (const d of e)
|
|
6715
6751
|
r.push(
|
|
6716
|
-
|
|
6752
|
+
U(d, o.pmSchema, o.schema.styleSchema)
|
|
6717
6753
|
);
|
|
6718
6754
|
const { node: a, posBeforeNode: s } = Le(
|
|
6719
6755
|
n,
|
|
@@ -6738,7 +6774,7 @@ function Oo(e, t, i = "before", o) {
|
|
|
6738
6774
|
const l = [];
|
|
6739
6775
|
for (const d of r)
|
|
6740
6776
|
l.push(
|
|
6741
|
-
|
|
6777
|
+
C(
|
|
6742
6778
|
d,
|
|
6743
6779
|
o.schema.blockSchema,
|
|
6744
6780
|
o.schema.inlineContentSchema,
|
|
@@ -6748,11 +6784,11 @@ function Oo(e, t, i = "before", o) {
|
|
|
6748
6784
|
);
|
|
6749
6785
|
return l;
|
|
6750
6786
|
}
|
|
6751
|
-
function
|
|
6787
|
+
function Ko(e, t, i) {
|
|
6752
6788
|
const o = i._tiptapEditor, n = typeof e == "string" ? e : e.id, { posBeforeNode: r } = Le(n, o.state.doc);
|
|
6753
6789
|
o.commands.BNUpdateBlock(r + 1, t);
|
|
6754
6790
|
const a = o.state.doc.resolve(r + 1).node();
|
|
6755
|
-
return
|
|
6791
|
+
return C(
|
|
6756
6792
|
a,
|
|
6757
6793
|
i.schema.blockSchema,
|
|
6758
6794
|
i.schema.inlineContentSchema,
|
|
@@ -6760,7 +6796,7 @@ function Fo(e, t, i) {
|
|
|
6760
6796
|
i.blockCache
|
|
6761
6797
|
);
|
|
6762
6798
|
}
|
|
6763
|
-
function
|
|
6799
|
+
function _t(e, t, i) {
|
|
6764
6800
|
const o = t._tiptapEditor, n = o.state.tr, r = new Set(
|
|
6765
6801
|
e.map(
|
|
6766
6802
|
(l) => typeof l == "string" ? l : l.id
|
|
@@ -6773,7 +6809,7 @@ function gt(e, t, i) {
|
|
|
6773
6809
|
if (l.type.name !== "blockContainer" || !r.has(l.attrs.id))
|
|
6774
6810
|
return !0;
|
|
6775
6811
|
a.push(
|
|
6776
|
-
|
|
6812
|
+
C(
|
|
6777
6813
|
l,
|
|
6778
6814
|
t.schema.blockSchema,
|
|
6779
6815
|
t.schema.inlineContentSchema,
|
|
@@ -6794,16 +6830,16 @@ function gt(e, t, i) {
|
|
|
6794
6830
|
}
|
|
6795
6831
|
return t.dispatch(n), a;
|
|
6796
6832
|
}
|
|
6797
|
-
function
|
|
6798
|
-
return
|
|
6833
|
+
function $o(e, t) {
|
|
6834
|
+
return _t(e, t);
|
|
6799
6835
|
}
|
|
6800
|
-
function
|
|
6836
|
+
function qo(e, t, i) {
|
|
6801
6837
|
const o = [];
|
|
6802
6838
|
for (const s of t)
|
|
6803
6839
|
o.push(
|
|
6804
|
-
|
|
6840
|
+
U(s, i.pmSchema, i.schema.styleSchema)
|
|
6805
6841
|
);
|
|
6806
|
-
const n = typeof e[0] == "string" ? e[0] : e[0].id, r =
|
|
6842
|
+
const n = typeof e[0] == "string" ? e[0] : e[0].id, r = _t(
|
|
6807
6843
|
e,
|
|
6808
6844
|
i,
|
|
6809
6845
|
(s, l, d, u) => {
|
|
@@ -6818,7 +6854,7 @@ function Ko(e, t, i) {
|
|
|
6818
6854
|
), a = [];
|
|
6819
6855
|
for (const s of o)
|
|
6820
6856
|
a.push(
|
|
6821
|
-
|
|
6857
|
+
C(
|
|
6822
6858
|
s,
|
|
6823
6859
|
i.schema.blockSchema,
|
|
6824
6860
|
i.schema.inlineContentSchema,
|
|
@@ -6828,7 +6864,7 @@ function Ko(e, t, i) {
|
|
|
6828
6864
|
);
|
|
6829
6865
|
return { insertedBlocks: a, removedBlocks: r };
|
|
6830
6866
|
}
|
|
6831
|
-
function
|
|
6867
|
+
function Xo(e, t, i, o = { updateSelection: !0 }) {
|
|
6832
6868
|
const n = i._tiptapEditor.state.tr;
|
|
6833
6869
|
let { from: r, to: a } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, s = !0, l = !0, d = "";
|
|
6834
6870
|
if (t.forEach((u) => {
|
|
@@ -6837,9 +6873,9 @@ function Wo(e, t, i, o = { updateSelection: !0 }) {
|
|
|
6837
6873
|
const { parent: u } = n.doc.resolve(r);
|
|
6838
6874
|
u.isTextblock && !u.type.spec.code && !u.childCount && (r -= 1, a += 1);
|
|
6839
6875
|
}
|
|
6840
|
-
return s ? n.insertText(d, r, a) : n.replaceWith(r, a, t), o.updateSelection &&
|
|
6876
|
+
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
6877
|
}
|
|
6842
|
-
function
|
|
6878
|
+
function Zo() {
|
|
6843
6879
|
const e = (t) => {
|
|
6844
6880
|
let i = t.children.length;
|
|
6845
6881
|
for (let o = 0; o < i; o++) {
|
|
@@ -6855,8 +6891,8 @@ function $o() {
|
|
|
6855
6891
|
};
|
|
6856
6892
|
return e;
|
|
6857
6893
|
}
|
|
6858
|
-
function
|
|
6859
|
-
const e =
|
|
6894
|
+
function Jo() {
|
|
6895
|
+
const e = H;
|
|
6860
6896
|
if (!e)
|
|
6861
6897
|
throw new Error(
|
|
6862
6898
|
"simplifyBlocks requires ESM dependencies to be initialized"
|
|
@@ -6878,42 +6914,42 @@ function qo() {
|
|
|
6878
6914
|
return t;
|
|
6879
6915
|
}
|
|
6880
6916
|
function Ie(e) {
|
|
6881
|
-
const t =
|
|
6917
|
+
const t = H;
|
|
6882
6918
|
if (!t)
|
|
6883
6919
|
throw new Error(
|
|
6884
6920
|
"cleanHTMLToMarkdown requires ESM dependencies to be initialized"
|
|
6885
6921
|
);
|
|
6886
|
-
return t.unified.unified().use(t.rehypeParse.default, { fragment: !0 }).use(
|
|
6922
|
+
return t.unified.unified().use(t.rehypeParse.default, { fragment: !0 }).use(Zo).use(Jo).use(t.rehypeRemark.default).use(t.remarkGfm.default).use(t.remarkStringify.default, {
|
|
6887
6923
|
handlers: { text: (o) => o.value }
|
|
6888
6924
|
}).processSync(e).value;
|
|
6889
6925
|
}
|
|
6890
|
-
async function
|
|
6891
|
-
await
|
|
6926
|
+
async function Yo(e, t, i, o) {
|
|
6927
|
+
await ie();
|
|
6892
6928
|
const r = de(t, i).exportBlocks(e, o);
|
|
6893
6929
|
return Ie(r);
|
|
6894
6930
|
}
|
|
6895
|
-
function
|
|
6931
|
+
function Qo(e) {
|
|
6896
6932
|
return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
|
|
6897
6933
|
}
|
|
6898
|
-
function
|
|
6934
|
+
function en(e) {
|
|
6899
6935
|
return e.nodeType === 3 && !/\S/.test(e.nodeValue || "");
|
|
6900
6936
|
}
|
|
6901
|
-
function
|
|
6937
|
+
function tn(e) {
|
|
6902
6938
|
e.querySelectorAll("li > ul, li > ol").forEach((t) => {
|
|
6903
|
-
const i =
|
|
6939
|
+
const i = Qo(t), o = t.parentElement, n = Array.from(o.childNodes).slice(
|
|
6904
6940
|
i + 1
|
|
6905
6941
|
);
|
|
6906
6942
|
t.remove(), n.forEach((r) => {
|
|
6907
6943
|
r.remove();
|
|
6908
6944
|
}), o.insertAdjacentElement("afterend", t), n.reverse().forEach((r) => {
|
|
6909
|
-
if (
|
|
6945
|
+
if (en(r))
|
|
6910
6946
|
return;
|
|
6911
6947
|
const a = document.createElement("li");
|
|
6912
6948
|
a.append(r), t.insertAdjacentElement("afterend", a);
|
|
6913
6949
|
}), o.childNodes.length === 0 && o.remove();
|
|
6914
6950
|
});
|
|
6915
6951
|
}
|
|
6916
|
-
function
|
|
6952
|
+
function on(e) {
|
|
6917
6953
|
e.querySelectorAll("li + ul, li + ol").forEach((t) => {
|
|
6918
6954
|
var r, a;
|
|
6919
6955
|
const i = t.previousElementSibling, o = document.createElement("div");
|
|
@@ -6923,28 +6959,28 @@ function Qo(e) {
|
|
|
6923
6959
|
n.append(o.nextElementSibling);
|
|
6924
6960
|
});
|
|
6925
6961
|
}
|
|
6926
|
-
let
|
|
6927
|
-
function
|
|
6928
|
-
return
|
|
6962
|
+
let qe = null;
|
|
6963
|
+
function nn() {
|
|
6964
|
+
return qe || (qe = document.implementation.createHTMLDocument("title"));
|
|
6929
6965
|
}
|
|
6930
|
-
function
|
|
6966
|
+
function kt(e) {
|
|
6931
6967
|
if (typeof e == "string") {
|
|
6932
|
-
const t =
|
|
6968
|
+
const t = nn().createElement("div");
|
|
6933
6969
|
t.innerHTML = e, e = t;
|
|
6934
6970
|
}
|
|
6935
|
-
return
|
|
6971
|
+
return tn(e), on(e), e;
|
|
6936
6972
|
}
|
|
6937
|
-
async function
|
|
6938
|
-
const r =
|
|
6973
|
+
async function yt(e, t, i, o, n) {
|
|
6974
|
+
const r = kt(e), s = It.fromSchema(n).parse(r, {
|
|
6939
6975
|
topNode: n.nodes.blockGroup.create()
|
|
6940
6976
|
}), l = [];
|
|
6941
6977
|
for (let d = 0; d < s.childCount; d++)
|
|
6942
6978
|
l.push(
|
|
6943
|
-
|
|
6979
|
+
C(s.child(d), t, i, o)
|
|
6944
6980
|
);
|
|
6945
6981
|
return l;
|
|
6946
6982
|
}
|
|
6947
|
-
function
|
|
6983
|
+
function rn(e, t) {
|
|
6948
6984
|
const i = t.value ? t.value + `
|
|
6949
6985
|
` : "", o = {};
|
|
6950
6986
|
t.lang && (o["data-language"] = t.lang);
|
|
@@ -6961,14 +6997,14 @@ function tn(e, t) {
|
|
|
6961
6997
|
children: [n]
|
|
6962
6998
|
}, e.patch(t, n), n;
|
|
6963
6999
|
}
|
|
6964
|
-
async function
|
|
6965
|
-
const r = await
|
|
7000
|
+
async function an(e, t, i, o, n) {
|
|
7001
|
+
const r = await ie(), a = r.unified.unified().use(r.remarkParse.default).use(r.remarkGfm.default).use(r.remarkRehype.default, {
|
|
6966
7002
|
handlers: {
|
|
6967
7003
|
...r.remarkRehype.defaultHandlers,
|
|
6968
|
-
code:
|
|
7004
|
+
code: rn
|
|
6969
7005
|
}
|
|
6970
7006
|
}).use(r.rehypeStringify.default).processSync(e);
|
|
6971
|
-
return
|
|
7007
|
+
return yt(
|
|
6972
7008
|
a.value,
|
|
6973
7009
|
t,
|
|
6974
7010
|
i,
|
|
@@ -6996,7 +7032,7 @@ class Z {
|
|
|
6996
7032
|
this.callbacks = {};
|
|
6997
7033
|
}
|
|
6998
7034
|
}
|
|
6999
|
-
class
|
|
7035
|
+
class sn {
|
|
7000
7036
|
constructor(t, i, o, n) {
|
|
7001
7037
|
c(this, "state");
|
|
7002
7038
|
c(this, "emitUpdate");
|
|
@@ -7015,6 +7051,8 @@ class nn {
|
|
|
7015
7051
|
const i = this.pmView.root.querySelector(
|
|
7016
7052
|
`[data-node-type="blockContainer"][data-id="${this.state.block.id}"]`
|
|
7017
7053
|
);
|
|
7054
|
+
if (!i)
|
|
7055
|
+
return;
|
|
7018
7056
|
this.state.referencePos = i.getBoundingClientRect(), this.emitUpdate();
|
|
7019
7057
|
}
|
|
7020
7058
|
});
|
|
@@ -7035,6 +7073,8 @@ class nn {
|
|
|
7035
7073
|
const a = this.pmView.root.querySelector(
|
|
7036
7074
|
`[data-node-type="blockContainer"][data-id="${o.block.id}"]`
|
|
7037
7075
|
);
|
|
7076
|
+
if (!a)
|
|
7077
|
+
return;
|
|
7038
7078
|
this.state = {
|
|
7039
7079
|
show: !0,
|
|
7040
7080
|
referencePos: a.getBoundingClientRect(),
|
|
@@ -7048,25 +7088,31 @@ class nn {
|
|
|
7048
7088
|
this.pmView.dom.removeEventListener("mousedown", this.mouseDownHandler), this.pmView.dom.removeEventListener("dragstart", this.dragstartHandler), this.pmView.root.removeEventListener("scroll", this.scrollHandler, !0);
|
|
7049
7089
|
}
|
|
7050
7090
|
}
|
|
7051
|
-
const
|
|
7052
|
-
class
|
|
7091
|
+
const be = new L("FilePanelPlugin");
|
|
7092
|
+
class ln extends Z {
|
|
7053
7093
|
constructor(i) {
|
|
7054
7094
|
super();
|
|
7055
7095
|
c(this, "view");
|
|
7056
7096
|
c(this, "plugin");
|
|
7057
|
-
c(this, "closeMenu", () =>
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7097
|
+
c(this, "closeMenu", () => {
|
|
7098
|
+
var i;
|
|
7099
|
+
return (i = this.view) == null ? void 0 : i.closeMenu();
|
|
7100
|
+
});
|
|
7101
|
+
this.plugin = new x({
|
|
7102
|
+
key: be,
|
|
7103
|
+
view: (o) => (this.view = new sn(
|
|
7061
7104
|
i,
|
|
7062
|
-
|
|
7105
|
+
be,
|
|
7063
7106
|
o,
|
|
7064
7107
|
(n) => {
|
|
7065
7108
|
this.emit("update", n);
|
|
7066
7109
|
}
|
|
7067
7110
|
), this.view),
|
|
7068
7111
|
props: {
|
|
7069
|
-
handleKeyDown: (o, n) =>
|
|
7112
|
+
handleKeyDown: (o, n) => {
|
|
7113
|
+
var r;
|
|
7114
|
+
return n.key === "Escape" && this.shown ? ((r = this.view) == null || r.closeMenu(), !0) : !1;
|
|
7115
|
+
}
|
|
7070
7116
|
},
|
|
7071
7117
|
state: {
|
|
7072
7118
|
init: () => ({
|
|
@@ -7075,7 +7121,7 @@ class rn extends Z {
|
|
|
7075
7121
|
apply: (o) => {
|
|
7076
7122
|
var r;
|
|
7077
7123
|
return {
|
|
7078
|
-
block: (r = o.getMeta(
|
|
7124
|
+
block: (r = o.getMeta(be)) == null ? void 0 : r.block
|
|
7079
7125
|
};
|
|
7080
7126
|
}
|
|
7081
7127
|
}
|
|
@@ -7089,14 +7135,14 @@ class rn extends Z {
|
|
|
7089
7135
|
return this.on("update", i);
|
|
7090
7136
|
}
|
|
7091
7137
|
}
|
|
7092
|
-
class
|
|
7138
|
+
class dn {
|
|
7093
7139
|
constructor(t, i, o) {
|
|
7094
7140
|
c(this, "state");
|
|
7095
7141
|
c(this, "emitUpdate");
|
|
7096
7142
|
c(this, "preventHide", !1);
|
|
7097
7143
|
c(this, "preventShow", !1);
|
|
7098
7144
|
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 &&
|
|
7145
|
+
const { doc: r, selection: a } = t, { empty: s } = a, l = !r.textBetween(i, o).length && Rt(t.selection);
|
|
7100
7146
|
return !(!n.hasFocus() || s || l);
|
|
7101
7147
|
});
|
|
7102
7148
|
c(this, "blurHandler", (t) => {
|
|
@@ -7144,7 +7190,7 @@ class an {
|
|
|
7144
7190
|
const { state: o, composing: n } = t, { doc: r, selection: a } = o, s = i && i.doc.eq(r) && i.selection.eq(a);
|
|
7145
7191
|
if (n || s)
|
|
7146
7192
|
return;
|
|
7147
|
-
const { ranges: l } = a, d = Math.min(...l.map((
|
|
7193
|
+
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
7194
|
view: t,
|
|
7149
7195
|
state: o,
|
|
7150
7196
|
from: d,
|
|
@@ -7167,7 +7213,7 @@ class an {
|
|
|
7167
7213
|
}
|
|
7168
7214
|
getSelectionBoundingBox() {
|
|
7169
7215
|
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 (
|
|
7216
|
+
if (Vt(i)) {
|
|
7171
7217
|
const a = this.pmView.nodeDOM(n);
|
|
7172
7218
|
if (a)
|
|
7173
7219
|
return a.getBoundingClientRect();
|
|
@@ -7175,18 +7221,18 @@ class an {
|
|
|
7175
7221
|
return ve(this.pmView, n, r);
|
|
7176
7222
|
}
|
|
7177
7223
|
}
|
|
7178
|
-
const
|
|
7224
|
+
const cn = new L(
|
|
7179
7225
|
"FormattingToolbarPlugin"
|
|
7180
7226
|
);
|
|
7181
|
-
class
|
|
7227
|
+
class un extends Z {
|
|
7182
7228
|
constructor(i) {
|
|
7183
7229
|
super();
|
|
7184
7230
|
c(this, "view");
|
|
7185
7231
|
c(this, "plugin");
|
|
7186
7232
|
c(this, "closeMenu", () => this.view.closeMenu());
|
|
7187
|
-
this.plugin = new
|
|
7188
|
-
key:
|
|
7189
|
-
view: (o) => (this.view = new
|
|
7233
|
+
this.plugin = new x({
|
|
7234
|
+
key: cn,
|
|
7235
|
+
view: (o) => (this.view = new dn(i, o, (n) => {
|
|
7190
7236
|
this.emit("update", n);
|
|
7191
7237
|
}), this.view),
|
|
7192
7238
|
props: {
|
|
@@ -7202,7 +7248,7 @@ class ln extends Z {
|
|
|
7202
7248
|
return this.on("update", i);
|
|
7203
7249
|
}
|
|
7204
7250
|
}
|
|
7205
|
-
class
|
|
7251
|
+
class pn {
|
|
7206
7252
|
constructor(t, i, o) {
|
|
7207
7253
|
c(this, "state");
|
|
7208
7254
|
c(this, "emitUpdate");
|
|
@@ -7220,7 +7266,7 @@ class dn {
|
|
|
7220
7266
|
const i = t.target, o = this.pmView.posAtDOM(i, 0) + 1, n = this.pmView.state.doc.resolve(o), r = n.marks();
|
|
7221
7267
|
for (const a of r)
|
|
7222
7268
|
if (a.type.name === this.pmView.state.schema.mark("link").type.name) {
|
|
7223
|
-
this.mouseHoveredLinkMark = a, this.mouseHoveredLinkMarkRange =
|
|
7269
|
+
this.mouseHoveredLinkMark = a, this.mouseHoveredLinkMarkRange = De(n, a.type, a.attrs) || void 0;
|
|
7224
7270
|
break;
|
|
7225
7271
|
}
|
|
7226
7272
|
}
|
|
@@ -7292,7 +7338,7 @@ class dn {
|
|
|
7292
7338
|
const o = this.pmView.state.selection.$from.marks();
|
|
7293
7339
|
for (const n of o)
|
|
7294
7340
|
if (n.type.name === this.pmView.state.schema.mark("link").type.name) {
|
|
7295
|
-
this.keyboardHoveredLinkMark = n, this.keyboardHoveredLinkMarkRange =
|
|
7341
|
+
this.keyboardHoveredLinkMark = n, this.keyboardHoveredLinkMarkRange = De(
|
|
7296
7342
|
this.pmView.state.selection.$from,
|
|
7297
7343
|
n.type,
|
|
7298
7344
|
n.attrs
|
|
@@ -7329,8 +7375,8 @@ class dn {
|
|
|
7329
7375
|
);
|
|
7330
7376
|
}
|
|
7331
7377
|
}
|
|
7332
|
-
const
|
|
7333
|
-
class
|
|
7378
|
+
const hn = new L("LinkToolbarPlugin");
|
|
7379
|
+
class mn extends Z {
|
|
7334
7380
|
constructor(i) {
|
|
7335
7381
|
super();
|
|
7336
7382
|
c(this, "view");
|
|
@@ -7368,9 +7414,9 @@ class un extends Z {
|
|
|
7368
7414
|
this.view.stopMenuUpdateTimer();
|
|
7369
7415
|
});
|
|
7370
7416
|
c(this, "closeMenu", () => this.view.closeMenu());
|
|
7371
|
-
this.plugin = new
|
|
7372
|
-
key:
|
|
7373
|
-
view: (o) => (this.view = new
|
|
7417
|
+
this.plugin = new x({
|
|
7418
|
+
key: hn,
|
|
7419
|
+
view: (o) => (this.view = new pn(i, o, (n) => {
|
|
7374
7420
|
this.emit("update", n);
|
|
7375
7421
|
}), this.view),
|
|
7376
7422
|
props: {
|
|
@@ -7386,7 +7432,7 @@ class un extends Z {
|
|
|
7386
7432
|
return ((o = (i = this.view) == null ? void 0 : i.state) == null ? void 0 : o.show) || !1;
|
|
7387
7433
|
}
|
|
7388
7434
|
}
|
|
7389
|
-
class
|
|
7435
|
+
class G extends fe {
|
|
7390
7436
|
constructor(i, o) {
|
|
7391
7437
|
super(i, o);
|
|
7392
7438
|
c(this, "nodes");
|
|
@@ -7397,13 +7443,13 @@ class F extends ge {
|
|
|
7397
7443
|
});
|
|
7398
7444
|
}
|
|
7399
7445
|
static create(i, o, n = o) {
|
|
7400
|
-
return new
|
|
7446
|
+
return new G(i.resolve(o), i.resolve(n));
|
|
7401
7447
|
}
|
|
7402
7448
|
content() {
|
|
7403
|
-
return new
|
|
7449
|
+
return new z(N.from(this.nodes), 0, 0);
|
|
7404
7450
|
}
|
|
7405
7451
|
eq(i) {
|
|
7406
|
-
if (!(i instanceof
|
|
7452
|
+
if (!(i instanceof G) || this.nodes.length !== i.nodes.length || this.from !== i.from || this.to !== i.to)
|
|
7407
7453
|
return !1;
|
|
7408
7454
|
for (let o = 0; o < this.nodes.length; o++)
|
|
7409
7455
|
if (!this.nodes[o].eq(i.nodes[o]))
|
|
@@ -7412,7 +7458,7 @@ class F extends ge {
|
|
|
7412
7458
|
}
|
|
7413
7459
|
map(i, o) {
|
|
7414
7460
|
const n = o.mapResult(this.from), r = o.mapResult(this.to);
|
|
7415
|
-
return r.deleted ?
|
|
7461
|
+
return r.deleted ? fe.near(i.resolve(n.pos)) : n.deleted ? fe.near(i.resolve(r.pos)) : new G(
|
|
7416
7462
|
i.resolve(n.pos),
|
|
7417
7463
|
i.resolve(r.pos)
|
|
7418
7464
|
);
|
|
@@ -7421,23 +7467,23 @@ class F extends ge {
|
|
|
7421
7467
|
return { type: "node", anchor: this.anchor, head: this.head };
|
|
7422
7468
|
}
|
|
7423
7469
|
}
|
|
7424
|
-
let
|
|
7425
|
-
function
|
|
7470
|
+
let A;
|
|
7471
|
+
function me(e, t) {
|
|
7426
7472
|
var i, o;
|
|
7427
7473
|
for (; e && e.parentElement && e.parentElement !== t.dom && ((i = e.getAttribute) == null ? void 0 : i.call(e, "data-node-type")) !== "blockContainer"; )
|
|
7428
7474
|
e = e.parentElement;
|
|
7429
7475
|
if (((o = e.getAttribute) == null ? void 0 : o.call(e, "data-node-type")) === "blockContainer")
|
|
7430
7476
|
return { node: e, id: e.getAttribute("data-id") };
|
|
7431
7477
|
}
|
|
7432
|
-
function
|
|
7433
|
-
const i =
|
|
7478
|
+
function fn(e, t) {
|
|
7479
|
+
const i = me(e, t);
|
|
7434
7480
|
if (i && i.node.nodeType === 1) {
|
|
7435
7481
|
const o = t.docView, n = o.nearestDesc(i.node, !0);
|
|
7436
7482
|
return !n || n === o ? null : n.posBefore;
|
|
7437
7483
|
}
|
|
7438
7484
|
return null;
|
|
7439
7485
|
}
|
|
7440
|
-
function
|
|
7486
|
+
function gn(e, t) {
|
|
7441
7487
|
let i, o;
|
|
7442
7488
|
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
7489
|
if (n && r) {
|
|
@@ -7447,7 +7493,7 @@ function hn(e, t) {
|
|
|
7447
7493
|
i = e.from, o = e.to;
|
|
7448
7494
|
return { from: i, to: o };
|
|
7449
7495
|
}
|
|
7450
|
-
function
|
|
7496
|
+
function Xe(e, t, i = t) {
|
|
7451
7497
|
t === i && (i += e.state.doc.resolve(t + 1).node().nodeSize);
|
|
7452
7498
|
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
7499
|
n,
|
|
@@ -7460,16 +7506,16 @@ function $e(e, t, i = t) {
|
|
|
7460
7506
|
);
|
|
7461
7507
|
for (let u = n.childElementCount - 1; u >= 0; u--)
|
|
7462
7508
|
(u > s || u < a) && o.removeChild(o.children[u]);
|
|
7463
|
-
|
|
7509
|
+
vt(e.root), A = o;
|
|
7464
7510
|
const d = e.dom.className.split(" ").filter(
|
|
7465
7511
|
(u) => u !== "ProseMirror" && u !== "bn-root" && u !== "bn-editor"
|
|
7466
7512
|
).join(" ");
|
|
7467
|
-
|
|
7513
|
+
A.className = A.className + " bn-drag-preview " + d, e.root instanceof ShadowRoot ? e.root.appendChild(A) : e.root.body.appendChild(A);
|
|
7468
7514
|
}
|
|
7469
|
-
function
|
|
7470
|
-
|
|
7515
|
+
function vt(e) {
|
|
7516
|
+
A !== void 0 && (e instanceof ShadowRoot ? e.removeChild(A) : e.body.removeChild(A), A = void 0);
|
|
7471
7517
|
}
|
|
7472
|
-
function
|
|
7518
|
+
function bn(e, t) {
|
|
7473
7519
|
if (!e.dataTransfer)
|
|
7474
7520
|
return;
|
|
7475
7521
|
const i = t.prosemirrorView, o = i.dom.getBoundingClientRect(), n = {
|
|
@@ -7480,30 +7526,30 @@ function mn(e, t) {
|
|
|
7480
7526
|
let a;
|
|
7481
7527
|
for (const l of r)
|
|
7482
7528
|
if (i.dom.contains(l)) {
|
|
7483
|
-
a =
|
|
7529
|
+
a = me(l, i);
|
|
7484
7530
|
break;
|
|
7485
7531
|
}
|
|
7486
7532
|
if (!a)
|
|
7487
7533
|
return;
|
|
7488
|
-
const s =
|
|
7534
|
+
const s = fn(a.node, i);
|
|
7489
7535
|
if (s != null) {
|
|
7490
|
-
const l = i.state.selection, d = i.state.doc, { from: u, to: p } =
|
|
7536
|
+
const l = i.state.selection, d = i.state.doc, { from: u, to: p } = gn(l, d), h = u <= s && s < p, m = l.$anchor.node() !== l.$head.node() || l instanceof G;
|
|
7491
7537
|
h && m ? (i.dispatch(
|
|
7492
|
-
i.state.tr.setSelection(
|
|
7493
|
-
),
|
|
7494
|
-
i.state.tr.setSelection(
|
|
7495
|
-
),
|
|
7496
|
-
const
|
|
7497
|
-
|
|
7538
|
+
i.state.tr.setSelection(G.create(d, u, p))
|
|
7539
|
+
), Xe(i, u, p)) : (i.dispatch(
|
|
7540
|
+
i.state.tr.setSelection(le.create(i.state.doc, s))
|
|
7541
|
+
), Xe(i, s));
|
|
7542
|
+
const f = i.state.selection.content(), g = t.pmSchema, w = Me(g, t).serializeProseMirrorFragment(
|
|
7543
|
+
f.content,
|
|
7498
7544
|
{}
|
|
7499
|
-
),
|
|
7500
|
-
|
|
7545
|
+
), y = de(g, t).exportProseMirrorFragment(
|
|
7546
|
+
f.content,
|
|
7501
7547
|
{}
|
|
7502
|
-
),
|
|
7503
|
-
e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html",
|
|
7548
|
+
), S = Ie(y);
|
|
7549
|
+
e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html", w), 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
7550
|
}
|
|
7505
7551
|
}
|
|
7506
|
-
class
|
|
7552
|
+
class _n {
|
|
7507
7553
|
constructor(t, i, o) {
|
|
7508
7554
|
c(this, "state");
|
|
7509
7555
|
c(this, "emitUpdate");
|
|
@@ -7520,7 +7566,7 @@ class fn {
|
|
|
7520
7566
|
c(this, "menuFrozen", !1);
|
|
7521
7567
|
c(this, "updateState", () => {
|
|
7522
7568
|
var a, s, l, d;
|
|
7523
|
-
if (this.menuFrozen || !this.mousePos)
|
|
7569
|
+
if (this.menuFrozen || !this.mousePos || !this.pmView.dom.firstChild)
|
|
7524
7570
|
return;
|
|
7525
7571
|
const t = this.pmView.dom.firstChild.getBoundingClientRect();
|
|
7526
7572
|
this.horizontalPosAnchor = t.x;
|
|
@@ -7535,7 +7581,7 @@ class fn {
|
|
|
7535
7581
|
let n;
|
|
7536
7582
|
for (const u of o)
|
|
7537
7583
|
if (this.pmView.dom.contains(u)) {
|
|
7538
|
-
n =
|
|
7584
|
+
n = me(u, this.pmView);
|
|
7539
7585
|
break;
|
|
7540
7586
|
}
|
|
7541
7587
|
if (!n || !this.editor.isEditable) {
|
|
@@ -7600,7 +7646,7 @@ class fn {
|
|
|
7600
7646
|
left: t.clientX,
|
|
7601
7647
|
top: t.clientY
|
|
7602
7648
|
});
|
|
7603
|
-
if (!i || i.inside === -1) {
|
|
7649
|
+
if (!i || i.inside === -1 && this.pmView.dom.firstChild) {
|
|
7604
7650
|
const o = new Event("dragover", t), n = this.pmView.dom.firstChild.getBoundingClientRect();
|
|
7605
7651
|
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
7652
|
}
|
|
@@ -7630,14 +7676,14 @@ class fn {
|
|
|
7630
7676
|
this.updateState(), this.needUpdate && (this.emitUpdate(this.state), this.needUpdate = !1);
|
|
7631
7677
|
});
|
|
7632
7678
|
c(this, "onScroll", () => {
|
|
7633
|
-
var t;
|
|
7634
|
-
if ((t = this.state) != null && t.show) {
|
|
7635
|
-
const
|
|
7679
|
+
var t, i;
|
|
7680
|
+
if ((t = this.state) != null && t.show && ((i = this.hoveredBlock) != null && i.firstChild)) {
|
|
7681
|
+
const n = this.hoveredBlock.firstChild.getBoundingClientRect();
|
|
7636
7682
|
this.state.referencePos = new DOMRect(
|
|
7637
|
-
this.horizontalPosAnchoredAtRoot ? this.horizontalPosAnchor :
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7683
|
+
this.horizontalPosAnchoredAtRoot ? this.horizontalPosAnchor : n.x,
|
|
7684
|
+
n.y,
|
|
7685
|
+
n.width,
|
|
7686
|
+
n.height
|
|
7641
7687
|
), this.emitUpdate(this.state);
|
|
7642
7688
|
}
|
|
7643
7689
|
});
|
|
@@ -7645,14 +7691,14 @@ class fn {
|
|
|
7645
7691
|
if (!this.state)
|
|
7646
7692
|
throw new Error("Attempting to update uninitialized side menu");
|
|
7647
7693
|
o(this.state);
|
|
7648
|
-
}, this.horizontalPosAnchoredAtRoot = !0, this.horizontalPosAnchor = this.pmView.dom.firstChild.getBoundingClientRect().x, this.pmView.root.addEventListener(
|
|
7694
|
+
}, this.horizontalPosAnchoredAtRoot = !0, this.pmView.dom.firstChild && (this.horizontalPosAnchor = this.pmView.dom.firstChild.getBoundingClientRect().x), this.pmView.root.addEventListener(
|
|
7649
7695
|
"drop",
|
|
7650
7696
|
this.onDrop,
|
|
7651
7697
|
!0
|
|
7652
7698
|
), this.pmView.root.addEventListener(
|
|
7653
7699
|
"dragover",
|
|
7654
7700
|
this.onDragOver
|
|
7655
|
-
),
|
|
7701
|
+
), ie(), this.pmView.dom.addEventListener("dragstart", this.onDragStart), this.pmView.root.addEventListener(
|
|
7656
7702
|
"mousemove",
|
|
7657
7703
|
this.onMouseMove,
|
|
7658
7704
|
!0
|
|
@@ -7694,8 +7740,9 @@ class fn {
|
|
|
7694
7740
|
);
|
|
7695
7741
|
}
|
|
7696
7742
|
addBlock() {
|
|
7697
|
-
var l;
|
|
7698
|
-
(l = this.state) != null && l.show && (this.state.show = !1, this.emitUpdate(this.state))
|
|
7743
|
+
var l, d;
|
|
7744
|
+
if ((l = this.state) != null && l.show && (this.state.show = !1, this.emitUpdate(this.state)), !((d = this.hoveredBlock) != null && d.firstChild))
|
|
7745
|
+
return;
|
|
7699
7746
|
const i = this.hoveredBlock.firstChild.getBoundingClientRect(), o = this.pmView.posAtCoords({
|
|
7700
7747
|
left: i.left + i.width / 2,
|
|
7701
7748
|
top: i.top + i.height / 2
|
|
@@ -7710,15 +7757,15 @@ class fn {
|
|
|
7710
7757
|
return;
|
|
7711
7758
|
const { contentNode: r, startPos: a, endPos: s } = n;
|
|
7712
7759
|
if (r.type.spec.content !== "inline*" || r.textContent.length !== 0) {
|
|
7713
|
-
const
|
|
7714
|
-
this.editor._tiptapEditor.chain().BNCreateBlock(
|
|
7760
|
+
const u = s + 1, p = u + 2;
|
|
7761
|
+
this.editor._tiptapEditor.chain().BNCreateBlock(u).setTextSelection(p).run();
|
|
7715
7762
|
} else
|
|
7716
7763
|
this.editor._tiptapEditor.commands.setTextSelection(a + 1);
|
|
7717
7764
|
this.editor.openSuggestionMenu("/");
|
|
7718
7765
|
}
|
|
7719
7766
|
}
|
|
7720
|
-
const
|
|
7721
|
-
class
|
|
7767
|
+
const kn = new L("SideMenuPlugin");
|
|
7768
|
+
class yn extends Z {
|
|
7722
7769
|
constructor(i) {
|
|
7723
7770
|
super();
|
|
7724
7771
|
c(this, "view");
|
|
@@ -7732,12 +7779,12 @@ class bn extends Z {
|
|
|
7732
7779
|
* Handles drag & drop events for blocks.
|
|
7733
7780
|
*/
|
|
7734
7781
|
c(this, "blockDragStart", (i) => {
|
|
7735
|
-
this.view.isDragging = !0,
|
|
7782
|
+
this.view.isDragging = !0, bn(i, this.editor);
|
|
7736
7783
|
});
|
|
7737
7784
|
/**
|
|
7738
7785
|
* Handles drag & drop events for blocks.
|
|
7739
7786
|
*/
|
|
7740
|
-
c(this, "blockDragEnd", () =>
|
|
7787
|
+
c(this, "blockDragEnd", () => vt(this.editor.prosemirrorView.root));
|
|
7741
7788
|
/**
|
|
7742
7789
|
* Freezes the side menu. When frozen, the side menu will stay
|
|
7743
7790
|
* attached to the same block regardless of which block is hovered by the
|
|
@@ -7752,9 +7799,9 @@ class bn extends Z {
|
|
|
7752
7799
|
c(this, "unfreezeMenu", () => {
|
|
7753
7800
|
this.view.menuFrozen = !1, this.view.state.show = !1, this.view.emitUpdate(this.view.state);
|
|
7754
7801
|
});
|
|
7755
|
-
this.editor = i, this.plugin = new
|
|
7756
|
-
key:
|
|
7757
|
-
view: (o) => (this.view = new
|
|
7802
|
+
this.editor = i, this.plugin = new x({
|
|
7803
|
+
key: kn,
|
|
7804
|
+
view: (o) => (this.view = new _n(i, o, (n) => {
|
|
7758
7805
|
this.emit("update", n);
|
|
7759
7806
|
}), this.view)
|
|
7760
7807
|
});
|
|
@@ -7763,8 +7810,8 @@ class bn extends Z {
|
|
|
7763
7810
|
return this.on("update", i);
|
|
7764
7811
|
}
|
|
7765
7812
|
}
|
|
7766
|
-
const
|
|
7767
|
-
class
|
|
7813
|
+
const vn = Ot((e) => e.type.name === "blockContainer");
|
|
7814
|
+
class wn {
|
|
7768
7815
|
constructor(t, i) {
|
|
7769
7816
|
c(this, "state");
|
|
7770
7817
|
c(this, "emitUpdate");
|
|
@@ -7776,13 +7823,15 @@ class kn {
|
|
|
7776
7823
|
const o = (i = this.rootEl) == null ? void 0 : i.querySelector(
|
|
7777
7824
|
`[data-decoration-id="${this.pluginState.decorationId}"]`
|
|
7778
7825
|
);
|
|
7826
|
+
if (!o)
|
|
7827
|
+
return;
|
|
7779
7828
|
this.state.referencePos = o.getBoundingClientRect(), this.emitUpdate(this.pluginState.triggerCharacter);
|
|
7780
7829
|
}
|
|
7781
7830
|
});
|
|
7782
7831
|
c(this, "closeMenu", () => {
|
|
7783
7832
|
this.editor.dispatch(
|
|
7784
7833
|
this.editor._tiptapEditor.view.state.tr.setMeta(
|
|
7785
|
-
|
|
7834
|
+
W,
|
|
7786
7835
|
null
|
|
7787
7836
|
)
|
|
7788
7837
|
);
|
|
@@ -7805,7 +7854,7 @@ class kn {
|
|
|
7805
7854
|
}
|
|
7806
7855
|
update(t, i) {
|
|
7807
7856
|
var d;
|
|
7808
|
-
const o =
|
|
7857
|
+
const o = W.getState(i), n = W.getState(
|
|
7809
7858
|
t.state
|
|
7810
7859
|
), r = o === void 0 && n !== void 0, a = o !== void 0 && n === void 0;
|
|
7811
7860
|
if (!r && !(o !== void 0 && n !== void 0) && !a)
|
|
@@ -7817,7 +7866,7 @@ class kn {
|
|
|
7817
7866
|
const l = (d = this.rootEl) == null ? void 0 : d.querySelector(
|
|
7818
7867
|
`[data-decoration-id="${this.pluginState.decorationId}"]`
|
|
7819
7868
|
);
|
|
7820
|
-
this.editor.isEditable && (this.state = {
|
|
7869
|
+
this.editor.isEditable && l && (this.state = {
|
|
7821
7870
|
show: !0,
|
|
7822
7871
|
referencePos: l.getBoundingClientRect(),
|
|
7823
7872
|
query: this.pluginState.query
|
|
@@ -7828,8 +7877,8 @@ class kn {
|
|
|
7828
7877
|
(t = this.rootEl) == null || t.removeEventListener("scroll", this.handleScroll, !0);
|
|
7829
7878
|
}
|
|
7830
7879
|
}
|
|
7831
|
-
const
|
|
7832
|
-
class
|
|
7880
|
+
const W = new L("SuggestionMenuPlugin");
|
|
7881
|
+
class xn extends Z {
|
|
7833
7882
|
constructor(i) {
|
|
7834
7883
|
super();
|
|
7835
7884
|
c(this, "view");
|
|
@@ -7847,9 +7896,9 @@ class yn extends Z {
|
|
|
7847
7896
|
c(this, "closeMenu", () => this.view.closeMenu());
|
|
7848
7897
|
c(this, "clearQuery", () => this.view.clearQuery());
|
|
7849
7898
|
const o = this.triggerCharacters;
|
|
7850
|
-
this.plugin = new
|
|
7851
|
-
key:
|
|
7852
|
-
view: () => (this.view = new
|
|
7899
|
+
this.plugin = new x({
|
|
7900
|
+
key: W,
|
|
7901
|
+
view: () => (this.view = new wn(
|
|
7853
7902
|
i,
|
|
7854
7903
|
(n, r) => {
|
|
7855
7904
|
this.emit(`update ${n}`, r);
|
|
@@ -7863,7 +7912,7 @@ class yn extends Z {
|
|
|
7863
7912
|
apply(n, r, a, s) {
|
|
7864
7913
|
if (n.getMeta("orderedListIndexing") !== void 0)
|
|
7865
7914
|
return r;
|
|
7866
|
-
const l = n.getMeta(
|
|
7915
|
+
const l = n.getMeta(W);
|
|
7867
7916
|
if (typeof l == "object" && l !== null && r === void 0)
|
|
7868
7917
|
return {
|
|
7869
7918
|
triggerCharacter: l.triggerCharacter,
|
|
@@ -7895,7 +7944,7 @@ class yn extends Z {
|
|
|
7895
7944
|
handleTextInput(n, r, a, s) {
|
|
7896
7945
|
const l = this.getState(n.state);
|
|
7897
7946
|
return o.includes(s) && l === void 0 ? (n.dispatch(
|
|
7898
|
-
n.state.tr.insertText(s).scrollIntoView().setMeta(
|
|
7947
|
+
n.state.tr.insertText(s).scrollIntoView().setMeta(W, {
|
|
7899
7948
|
triggerCharacter: s
|
|
7900
7949
|
})
|
|
7901
7950
|
), !0) : !1;
|
|
@@ -7906,10 +7955,10 @@ class yn extends Z {
|
|
|
7906
7955
|
if (r === void 0)
|
|
7907
7956
|
return null;
|
|
7908
7957
|
if (!r.deleteTriggerCharacter) {
|
|
7909
|
-
const a =
|
|
7958
|
+
const a = vn(n.selection);
|
|
7910
7959
|
if (a)
|
|
7911
7960
|
return K.create(n.doc, [
|
|
7912
|
-
|
|
7961
|
+
$.node(
|
|
7913
7962
|
a.pos,
|
|
7914
7963
|
a.pos + a.node.nodeSize,
|
|
7915
7964
|
{
|
|
@@ -7921,7 +7970,7 @@ class yn extends Z {
|
|
|
7921
7970
|
]);
|
|
7922
7971
|
}
|
|
7923
7972
|
return K.create(n.doc, [
|
|
7924
|
-
|
|
7973
|
+
$.inline(
|
|
7925
7974
|
r.queryStartPos - r.triggerCharacter.length,
|
|
7926
7975
|
r.queryStartPos,
|
|
7927
7976
|
{
|
|
@@ -7943,32 +7992,32 @@ class yn extends Z {
|
|
|
7943
7992
|
return ((o = (i = this.view) == null ? void 0 : i.state) == null ? void 0 : o.show) || !1;
|
|
7944
7993
|
}
|
|
7945
7994
|
}
|
|
7946
|
-
function
|
|
7995
|
+
function jr(e, t) {
|
|
7947
7996
|
e.suggestionMenus.addTriggerCharacter(t);
|
|
7948
7997
|
}
|
|
7949
|
-
let
|
|
7950
|
-
function
|
|
7951
|
-
|
|
7998
|
+
let E;
|
|
7999
|
+
function Ze(e) {
|
|
8000
|
+
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
8001
|
}
|
|
7953
|
-
function
|
|
7954
|
-
|
|
8002
|
+
function En(e) {
|
|
8003
|
+
E && (e instanceof Document ? e.body.removeChild(E) : e.removeChild(E), E = void 0);
|
|
7955
8004
|
}
|
|
7956
8005
|
function re(e) {
|
|
7957
8006
|
return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
|
|
7958
8007
|
}
|
|
7959
|
-
function
|
|
8008
|
+
function Cn(e) {
|
|
7960
8009
|
for (; e && e.nodeName !== "TD" && e.nodeName !== "TH"; )
|
|
7961
8010
|
e = e.classList && e.classList.contains("ProseMirror") ? null : e.parentNode;
|
|
7962
8011
|
return e;
|
|
7963
8012
|
}
|
|
7964
|
-
function
|
|
8013
|
+
function Sn(e, t) {
|
|
7965
8014
|
e.forEach((i) => {
|
|
7966
8015
|
const o = t.querySelectorAll(i);
|
|
7967
8016
|
for (let n = 0; n < o.length; n++)
|
|
7968
8017
|
o[n].style.visibility = "hidden";
|
|
7969
8018
|
});
|
|
7970
8019
|
}
|
|
7971
|
-
class
|
|
8020
|
+
class Mn {
|
|
7972
8021
|
constructor(t, i, o) {
|
|
7973
8022
|
c(this, "state");
|
|
7974
8023
|
c(this, "emitUpdate");
|
|
@@ -7977,31 +8026,34 @@ class En {
|
|
|
7977
8026
|
c(this, "menuFrozen", !1);
|
|
7978
8027
|
c(this, "prevWasEditable", null);
|
|
7979
8028
|
c(this, "mouseMoveHandler", (t) => {
|
|
7980
|
-
var d;
|
|
8029
|
+
var d, u, p;
|
|
7981
8030
|
if (this.menuFrozen)
|
|
7982
8031
|
return;
|
|
7983
|
-
const i =
|
|
8032
|
+
const i = Cn(t.target);
|
|
7984
8033
|
if (!i || !this.editor.isEditable) {
|
|
7985
8034
|
(d = this.state) != null && d.show && (this.state.show = !1, this.emitUpdate());
|
|
7986
8035
|
return;
|
|
7987
8036
|
}
|
|
7988
|
-
const o = re(i), n = re(i.parentElement), r = i.getBoundingClientRect(), a = i.parentElement.parentElement
|
|
8037
|
+
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();
|
|
8038
|
+
if (!a)
|
|
8039
|
+
return;
|
|
8040
|
+
const s = me(i, this.pmView);
|
|
7989
8041
|
if (!s)
|
|
7990
8042
|
return;
|
|
7991
8043
|
let l;
|
|
7992
|
-
if (this.editor._tiptapEditor.state.doc.descendants((
|
|
8044
|
+
if (this.editor._tiptapEditor.state.doc.descendants((h, m) => {
|
|
7993
8045
|
if (typeof l < "u")
|
|
7994
8046
|
return !1;
|
|
7995
|
-
if (
|
|
8047
|
+
if (h.type.name !== "blockContainer" || h.attrs.id !== s.id)
|
|
7996
8048
|
return !0;
|
|
7997
|
-
const
|
|
7998
|
-
|
|
8049
|
+
const f = C(
|
|
8050
|
+
h,
|
|
7999
8051
|
this.editor.schema.blockSchema,
|
|
8000
8052
|
this.editor.schema.inlineContentSchema,
|
|
8001
8053
|
this.editor.schema.styleSchema,
|
|
8002
8054
|
this.editor.blockCache
|
|
8003
8055
|
);
|
|
8004
|
-
return
|
|
8056
|
+
return Fo("table", f, this.editor) && (this.tablePos = m + 1, l = f), !1;
|
|
8005
8057
|
}), !!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
8058
|
return this.state = {
|
|
8007
8059
|
show: !0,
|
|
@@ -8017,7 +8069,7 @@ class En {
|
|
|
8017
8069
|
var h;
|
|
8018
8070
|
if (((h = this.state) == null ? void 0 : h.draggingState) === void 0)
|
|
8019
8071
|
return;
|
|
8020
|
-
t.preventDefault(), t.dataTransfer.dropEffect = "move",
|
|
8072
|
+
t.preventDefault(), t.dataTransfer.dropEffect = "move", Sn(
|
|
8021
8073
|
[
|
|
8022
8074
|
"column-resize-handle",
|
|
8023
8075
|
"prosemirror-dropcursor-block",
|
|
@@ -8047,7 +8099,7 @@ class En {
|
|
|
8047
8099
|
(this.state.rowIndex !== a || this.state.colIndex !== s) && (this.state.rowIndex = a, this.state.colIndex = s, this.state.referencePosCell = n.getBoundingClientRect(), r = !0);
|
|
8048
8100
|
const p = this.state.draggingState.draggedCellOrientation === "row" ? i.top : i.left;
|
|
8049
8101
|
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(
|
|
8102
|
+
this.pmView.state.tr.setMeta(Q, !0)
|
|
8051
8103
|
);
|
|
8052
8104
|
});
|
|
8053
8105
|
c(this, "dropHandler", (t) => {
|
|
@@ -8104,8 +8156,8 @@ class En {
|
|
|
8104
8156
|
), this.pmView.root.removeEventListener("scroll", this.scrollHandler, !0);
|
|
8105
8157
|
}
|
|
8106
8158
|
}
|
|
8107
|
-
const
|
|
8108
|
-
class
|
|
8159
|
+
const Q = new L("TableHandlesPlugin");
|
|
8160
|
+
class Tn extends Z {
|
|
8109
8161
|
constructor(i) {
|
|
8110
8162
|
super();
|
|
8111
8163
|
c(this, "view");
|
|
@@ -8124,13 +8176,13 @@ class Cn extends Z {
|
|
|
8124
8176
|
originalIndex: this.view.state.colIndex,
|
|
8125
8177
|
mousePos: i.clientX
|
|
8126
8178
|
}, this.view.emitUpdate(), this.editor.dispatch(
|
|
8127
|
-
this.editor._tiptapEditor.state.tr.setMeta(
|
|
8179
|
+
this.editor._tiptapEditor.state.tr.setMeta(Q, {
|
|
8128
8180
|
draggedCellOrientation: this.view.state.draggingState.draggedCellOrientation,
|
|
8129
8181
|
originalIndex: this.view.state.colIndex,
|
|
8130
8182
|
newIndex: this.view.state.colIndex,
|
|
8131
8183
|
tablePos: this.view.tablePos
|
|
8132
8184
|
})
|
|
8133
|
-
),
|
|
8185
|
+
), Ze(this.editor._tiptapEditor.view.root), i.dataTransfer.setDragImage(E, 0, 0), i.dataTransfer.effectAllowed = "move";
|
|
8134
8186
|
});
|
|
8135
8187
|
/**
|
|
8136
8188
|
* Callback that should be set on the `dragStart` event for whichever element
|
|
@@ -8146,13 +8198,13 @@ class Cn extends Z {
|
|
|
8146
8198
|
originalIndex: this.view.state.rowIndex,
|
|
8147
8199
|
mousePos: i.clientY
|
|
8148
8200
|
}, this.view.emitUpdate(), this.editor.dispatch(
|
|
8149
|
-
this.editor._tiptapEditor.state.tr.setMeta(
|
|
8201
|
+
this.editor._tiptapEditor.state.tr.setMeta(Q, {
|
|
8150
8202
|
draggedCellOrientation: this.view.state.draggingState.draggedCellOrientation,
|
|
8151
8203
|
originalIndex: this.view.state.rowIndex,
|
|
8152
8204
|
newIndex: this.view.state.rowIndex,
|
|
8153
8205
|
tablePos: this.view.tablePos
|
|
8154
8206
|
})
|
|
8155
|
-
),
|
|
8207
|
+
), Ze(this.editor._tiptapEditor.view.root), i.dataTransfer.setDragImage(E, 0, 0), i.dataTransfer.effectAllowed = "copyMove";
|
|
8156
8208
|
});
|
|
8157
8209
|
/**
|
|
8158
8210
|
* Callback that should be set on the `dragEnd` event for both the element
|
|
@@ -8164,8 +8216,8 @@ class Cn extends Z {
|
|
|
8164
8216
|
"Attempted to drag table row, but no table block was hovered prior."
|
|
8165
8217
|
);
|
|
8166
8218
|
this.view.state.draggingState = void 0, this.view.emitUpdate(), this.editor.dispatch(
|
|
8167
|
-
this.editor._tiptapEditor.state.tr.setMeta(
|
|
8168
|
-
),
|
|
8219
|
+
this.editor._tiptapEditor.state.tr.setMeta(Q, null)
|
|
8220
|
+
), En(this.editor._tiptapEditor.view.root);
|
|
8169
8221
|
});
|
|
8170
8222
|
/**
|
|
8171
8223
|
* Freezes the drag handles. When frozen, they will stay attached to the same
|
|
@@ -8181,9 +8233,9 @@ class Cn extends Z {
|
|
|
8181
8233
|
c(this, "unfreezeHandles", () => {
|
|
8182
8234
|
this.view.menuFrozen = !1;
|
|
8183
8235
|
});
|
|
8184
|
-
this.editor = i, this.plugin = new
|
|
8185
|
-
key:
|
|
8186
|
-
view: (o) => (this.view = new
|
|
8236
|
+
this.editor = i, this.plugin = new x({
|
|
8237
|
+
key: Q,
|
|
8238
|
+
view: (o) => (this.view = new Mn(i, o, (n) => {
|
|
8187
8239
|
this.emit("update", n);
|
|
8188
8240
|
}), this.view),
|
|
8189
8241
|
// We use decorations to render the drop cursor when dragging a table row
|
|
@@ -8206,9 +8258,9 @@ class Cn extends Z {
|
|
|
8206
8258
|
), h = p.node(), m = p.pos + (n > this.view.state.draggingState.originalIndex ? h.nodeSize - 2 : 0);
|
|
8207
8259
|
r.push(
|
|
8208
8260
|
// The widget is a small bar which spans the width of the cell.
|
|
8209
|
-
|
|
8210
|
-
const
|
|
8211
|
-
return
|
|
8261
|
+
$.widget(m, () => {
|
|
8262
|
+
const f = document.createElement("div");
|
|
8263
|
+
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
8264
|
})
|
|
8213
8265
|
);
|
|
8214
8266
|
}
|
|
@@ -8221,7 +8273,7 @@ class Cn extends Z {
|
|
|
8221
8273
|
), p = u.node(), h = u.pos + (n > this.view.state.draggingState.originalIndex ? p.nodeSize - 2 : 0);
|
|
8222
8274
|
r.push(
|
|
8223
8275
|
// The widget is a small bar which spans the height of the cell.
|
|
8224
|
-
|
|
8276
|
+
$.widget(h, () => {
|
|
8225
8277
|
const m = document.createElement("div");
|
|
8226
8278
|
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
8279
|
})
|
|
@@ -8236,15 +8288,15 @@ class Cn extends Z {
|
|
|
8236
8288
|
return this.on("update", i);
|
|
8237
8289
|
}
|
|
8238
8290
|
}
|
|
8239
|
-
async function
|
|
8240
|
-
const i = e.state.selection.content().content, n =
|
|
8291
|
+
async function wt(e, t) {
|
|
8292
|
+
const i = e.state.selection.content().content, n = Me(
|
|
8241
8293
|
e.state.schema,
|
|
8242
8294
|
t
|
|
8243
|
-
)
|
|
8295
|
+
).serializeProseMirrorFragment(
|
|
8244
8296
|
i,
|
|
8245
8297
|
{}
|
|
8246
8298
|
);
|
|
8247
|
-
await
|
|
8299
|
+
await ie();
|
|
8248
8300
|
const a = de(
|
|
8249
8301
|
e.state.schema,
|
|
8250
8302
|
t
|
|
@@ -8254,24 +8306,27 @@ async function Xe(e, t) {
|
|
|
8254
8306
|
), s = await Ie(a);
|
|
8255
8307
|
return { internalHTML: n, externalHTML: a, plainText: s };
|
|
8256
8308
|
}
|
|
8257
|
-
const
|
|
8309
|
+
const Je = (e, t, i) => {
|
|
8310
|
+
i.preventDefault(), i.clipboardData.clearData(), "node" in t.state.selection && t.state.selection.node.type.spec.group === "blockContent" && e.dispatch(
|
|
8311
|
+
e._tiptapEditor.state.tr.setSelection(
|
|
8312
|
+
new le(t.state.doc.resolve(t.state.selection.from - 1))
|
|
8313
|
+
)
|
|
8314
|
+
), (async () => {
|
|
8315
|
+
const { internalHTML: o, externalHTML: n, plainText: r } = await wt(t, e);
|
|
8316
|
+
i.clipboardData.setData("blocknote/html", o), i.clipboardData.setData("text/html", n), i.clipboardData.setData("text/plain", r);
|
|
8317
|
+
})();
|
|
8318
|
+
}, Bn = (e) => I.create({
|
|
8258
8319
|
name: "copyToClipboard",
|
|
8259
8320
|
addProseMirrorPlugins() {
|
|
8260
8321
|
return [
|
|
8261
|
-
new
|
|
8322
|
+
new x({
|
|
8262
8323
|
props: {
|
|
8263
8324
|
handleDOMEvents: {
|
|
8264
8325
|
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;
|
|
8326
|
+
return Je(e, t, i), !0;
|
|
8327
|
+
},
|
|
8328
|
+
cut(t, i) {
|
|
8329
|
+
return Je(e, t, i), t.dispatch(t.state.tr.deleteSelection()), !0;
|
|
8275
8330
|
},
|
|
8276
8331
|
// This is for the use-case in which only a block without content
|
|
8277
8332
|
// is selected, e.g. an image block, and dragged (not using the
|
|
@@ -8280,12 +8335,12 @@ const Sn = (e) => T.create({
|
|
|
8280
8335
|
if ("node" in t.state.selection && t.state.selection.node.type.spec.group === "blockContent")
|
|
8281
8336
|
return e.dispatch(
|
|
8282
8337
|
e._tiptapEditor.state.tr.setSelection(
|
|
8283
|
-
new
|
|
8338
|
+
new le(
|
|
8284
8339
|
t.state.doc.resolve(t.state.selection.from - 1)
|
|
8285
8340
|
)
|
|
8286
8341
|
)
|
|
8287
8342
|
), i.preventDefault(), i.dataTransfer.clearData(), (async () => {
|
|
8288
|
-
const { internalHTML: o, externalHTML: n, plainText: r } = await
|
|
8343
|
+
const { internalHTML: o, externalHTML: n, plainText: r } = await wt(t, e);
|
|
8289
8344
|
i.dataTransfer.setData("blocknote/html", o), i.dataTransfer.setData("text/html", n), i.dataTransfer.setData("text/plain", r);
|
|
8290
8345
|
})(), !0;
|
|
8291
8346
|
}
|
|
@@ -8300,12 +8355,12 @@ const Sn = (e) => T.create({
|
|
|
8300
8355
|
"text/html",
|
|
8301
8356
|
"text/plain"
|
|
8302
8357
|
];
|
|
8303
|
-
function
|
|
8358
|
+
function Ln(e, t) {
|
|
8304
8359
|
if (!e.startsWith(".") || !t.startsWith("."))
|
|
8305
8360
|
throw new Error("The strings provided are not valid file extensions.");
|
|
8306
8361
|
return e === t;
|
|
8307
8362
|
}
|
|
8308
|
-
function
|
|
8363
|
+
function In(e, t) {
|
|
8309
8364
|
const i = e.split("/"), o = t.split("/");
|
|
8310
8365
|
if (i.length !== 2)
|
|
8311
8366
|
throw new Error(`The string ${e} is not a valid MIME type.`);
|
|
@@ -8313,7 +8368,7 @@ function Tn(e, t) {
|
|
|
8313
8368
|
throw new Error(`The string ${t} is not a valid MIME type.`);
|
|
8314
8369
|
return i[1] === "*" || o[1] === "*" ? i[0] === o[0] : (i[0] === "*" || o[0] === "*" || i[0] === o[0]) && i[1] === o[1];
|
|
8315
8370
|
}
|
|
8316
|
-
async function
|
|
8371
|
+
async function xt(e, t) {
|
|
8317
8372
|
if (!t.uploadFile)
|
|
8318
8373
|
return;
|
|
8319
8374
|
const i = "dataTransfer" in e ? e.dataTransfer : e.clipboardData;
|
|
@@ -8339,7 +8394,7 @@ async function yt(e, t) {
|
|
|
8339
8394
|
for (const d of r)
|
|
8340
8395
|
for (const u of d.fileBlockAccept || []) {
|
|
8341
8396
|
const p = u.startsWith("."), h = n[a].getAsFile();
|
|
8342
|
-
if (h && (!p && h.type &&
|
|
8397
|
+
if (h && (!p && h.type && In(n[a].type, u) || p && Ln(
|
|
8343
8398
|
"." + h.name.split(".").pop(),
|
|
8344
8399
|
u
|
|
8345
8400
|
))) {
|
|
@@ -8349,85 +8404,98 @@ async function yt(e, t) {
|
|
|
8349
8404
|
}
|
|
8350
8405
|
const l = n[a].getAsFile();
|
|
8351
8406
|
if (l) {
|
|
8352
|
-
const d =
|
|
8407
|
+
const d = {
|
|
8353
8408
|
type: s,
|
|
8354
8409
|
props: {
|
|
8355
|
-
name: l.name
|
|
8356
|
-
url: d
|
|
8410
|
+
name: l.name
|
|
8357
8411
|
}
|
|
8358
|
-
}
|
|
8359
|
-
|
|
8360
|
-
|
|
8361
|
-
t.
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
|
|
8412
|
+
};
|
|
8413
|
+
let u;
|
|
8414
|
+
if (e.type === "paste")
|
|
8415
|
+
u = t.insertBlocks(
|
|
8416
|
+
[d],
|
|
8417
|
+
t.getTextCursorPosition().block,
|
|
8418
|
+
"after"
|
|
8419
|
+
)[0].id;
|
|
8420
|
+
else if (e.type === "drop") {
|
|
8421
|
+
const m = {
|
|
8365
8422
|
left: e.clientX,
|
|
8366
8423
|
top: e.clientY
|
|
8367
|
-
},
|
|
8368
|
-
if (!
|
|
8424
|
+
}, f = t._tiptapEditor.view.posAtCoords(m);
|
|
8425
|
+
if (!f)
|
|
8369
8426
|
return;
|
|
8370
|
-
const
|
|
8427
|
+
const g = _(
|
|
8371
8428
|
t._tiptapEditor.state.doc,
|
|
8372
|
-
|
|
8429
|
+
f.pos
|
|
8373
8430
|
);
|
|
8374
|
-
t.insertBlocks(
|
|
8375
|
-
|
|
8431
|
+
u = t.insertBlocks(
|
|
8432
|
+
[d],
|
|
8433
|
+
g.id,
|
|
8434
|
+
"after"
|
|
8435
|
+
)[0].id;
|
|
8436
|
+
} else
|
|
8437
|
+
return;
|
|
8438
|
+
const p = await t.uploadFile(l, u), h = typeof p == "string" ? {
|
|
8439
|
+
props: {
|
|
8440
|
+
url: p
|
|
8441
|
+
}
|
|
8442
|
+
} : { ...p };
|
|
8443
|
+
t.updateBlock(u, h);
|
|
8376
8444
|
}
|
|
8377
8445
|
}
|
|
8378
8446
|
}
|
|
8379
|
-
const
|
|
8380
|
-
name: "
|
|
8447
|
+
const An = (e) => I.create({
|
|
8448
|
+
name: "dropFile",
|
|
8381
8449
|
addProseMirrorPlugins() {
|
|
8382
8450
|
return [
|
|
8383
|
-
new
|
|
8451
|
+
new x({
|
|
8384
8452
|
props: {
|
|
8385
8453
|
handleDOMEvents: {
|
|
8386
|
-
|
|
8387
|
-
if (
|
|
8454
|
+
drop(t, i) {
|
|
8455
|
+
if (!e.isEditable)
|
|
8388
8456
|
return;
|
|
8389
8457
|
let o = null;
|
|
8390
|
-
for (const
|
|
8391
|
-
if (i.
|
|
8392
|
-
o =
|
|
8458
|
+
for (const n of Ae)
|
|
8459
|
+
if (i.dataTransfer.types.includes(n)) {
|
|
8460
|
+
o = n;
|
|
8393
8461
|
break;
|
|
8394
8462
|
}
|
|
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;
|
|
8463
|
+
return o === null ? !0 : o === "Files" ? (xt(i, e), !0) : !1;
|
|
8401
8464
|
}
|
|
8402
8465
|
}
|
|
8403
8466
|
}
|
|
8404
8467
|
})
|
|
8405
8468
|
];
|
|
8406
8469
|
}
|
|
8407
|
-
}),
|
|
8408
|
-
name: "
|
|
8470
|
+
}), Nn = (e) => I.create({
|
|
8471
|
+
name: "pasteFromClipboard",
|
|
8409
8472
|
addProseMirrorPlugins() {
|
|
8410
8473
|
return [
|
|
8411
|
-
new
|
|
8474
|
+
new x({
|
|
8412
8475
|
props: {
|
|
8413
8476
|
handleDOMEvents: {
|
|
8414
|
-
|
|
8415
|
-
if (!e.isEditable)
|
|
8477
|
+
paste(t, i) {
|
|
8478
|
+
if (i.preventDefault(), !e.isEditable)
|
|
8416
8479
|
return;
|
|
8417
8480
|
let o = null;
|
|
8418
|
-
for (const
|
|
8419
|
-
if (i.
|
|
8420
|
-
o =
|
|
8481
|
+
for (const r of Ae)
|
|
8482
|
+
if (i.clipboardData.types.includes(r)) {
|
|
8483
|
+
o = r;
|
|
8421
8484
|
break;
|
|
8422
8485
|
}
|
|
8423
|
-
|
|
8486
|
+
if (o === null)
|
|
8487
|
+
return !0;
|
|
8488
|
+
if (o === "Files")
|
|
8489
|
+
return xt(i, e), !0;
|
|
8490
|
+
let n = i.clipboardData.getData(o);
|
|
8491
|
+
return o === "text/html" && (n = kt(n.trim()).innerHTML), e._tiptapEditor.view.pasteHTML(n), !0;
|
|
8424
8492
|
}
|
|
8425
8493
|
}
|
|
8426
8494
|
}
|
|
8427
8495
|
})
|
|
8428
8496
|
];
|
|
8429
8497
|
}
|
|
8430
|
-
}),
|
|
8498
|
+
}), Pn = I.create({
|
|
8431
8499
|
name: "blockBackgroundColor",
|
|
8432
8500
|
addGlobalAttributes() {
|
|
8433
8501
|
return [
|
|
@@ -8435,9 +8503,9 @@ const Bn = (e) => T.create({
|
|
|
8435
8503
|
types: ["blockContainer"],
|
|
8436
8504
|
attributes: {
|
|
8437
8505
|
backgroundColor: {
|
|
8438
|
-
default:
|
|
8439
|
-
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") :
|
|
8440
|
-
renderHTML: (e) => e.backgroundColor ===
|
|
8506
|
+
default: v.backgroundColor.default,
|
|
8507
|
+
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : v.backgroundColor.default,
|
|
8508
|
+
renderHTML: (e) => e.backgroundColor === v.backgroundColor.default ? {} : {
|
|
8441
8509
|
"data-background-color": e.backgroundColor
|
|
8442
8510
|
}
|
|
8443
8511
|
}
|
|
@@ -8445,7 +8513,7 @@ const Bn = (e) => T.create({
|
|
|
8445
8513
|
}
|
|
8446
8514
|
];
|
|
8447
8515
|
}
|
|
8448
|
-
}),
|
|
8516
|
+
}), Hn = I.create({
|
|
8449
8517
|
name: "textAlignment",
|
|
8450
8518
|
addGlobalAttributes() {
|
|
8451
8519
|
return [
|
|
@@ -8471,7 +8539,7 @@ const Bn = (e) => T.create({
|
|
|
8471
8539
|
}
|
|
8472
8540
|
];
|
|
8473
8541
|
}
|
|
8474
|
-
}),
|
|
8542
|
+
}), Un = I.create({
|
|
8475
8543
|
name: "blockTextColor",
|
|
8476
8544
|
addGlobalAttributes() {
|
|
8477
8545
|
return [
|
|
@@ -8479,9 +8547,9 @@ const Bn = (e) => T.create({
|
|
|
8479
8547
|
types: ["blockContainer"],
|
|
8480
8548
|
attributes: {
|
|
8481
8549
|
textColor: {
|
|
8482
|
-
default:
|
|
8483
|
-
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") :
|
|
8484
|
-
renderHTML: (e) => e.textColor ===
|
|
8550
|
+
default: v.textColor.default,
|
|
8551
|
+
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : v.textColor.default,
|
|
8552
|
+
renderHTML: (e) => e.textColor === v.textColor.default ? {} : {
|
|
8485
8553
|
"data-text-color": e.textColor
|
|
8486
8554
|
}
|
|
8487
8555
|
}
|
|
@@ -8489,12 +8557,12 @@ const Bn = (e) => T.create({
|
|
|
8489
8557
|
}
|
|
8490
8558
|
];
|
|
8491
8559
|
}
|
|
8492
|
-
}),
|
|
8560
|
+
}), Dn = I.create({
|
|
8493
8561
|
name: "trailingNode",
|
|
8494
8562
|
addProseMirrorPlugins() {
|
|
8495
|
-
const e = new
|
|
8563
|
+
const e = new L(this.name);
|
|
8496
8564
|
return [
|
|
8497
|
-
new
|
|
8565
|
+
new x({
|
|
8498
8566
|
key: e,
|
|
8499
8567
|
appendTransaction: (t, i, o) => {
|
|
8500
8568
|
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 +8592,8 @@ const Bn = (e) => T.create({
|
|
|
8524
8592
|
})
|
|
8525
8593
|
];
|
|
8526
8594
|
}
|
|
8527
|
-
}),
|
|
8528
|
-
key:
|
|
8595
|
+
}), jn = new L("non-editable-block"), zn = () => new x({
|
|
8596
|
+
key: jn,
|
|
8529
8597
|
props: {
|
|
8530
8598
|
handleKeyDown: (e, t) => {
|
|
8531
8599
|
if ("node" in e.state.selection) {
|
|
@@ -8540,7 +8608,7 @@ const Bn = (e) => T.create({
|
|
|
8540
8608
|
e.state.tr.selection.$to.after(),
|
|
8541
8609
|
e.state.schema.nodes.paragraph.create()
|
|
8542
8610
|
).setSelection(
|
|
8543
|
-
new
|
|
8611
|
+
new Y(
|
|
8544
8612
|
i.doc.resolve(e.state.tr.selection.$to.after() + 1)
|
|
8545
8613
|
)
|
|
8546
8614
|
)
|
|
@@ -8550,99 +8618,13 @@ const Bn = (e) => T.create({
|
|
|
8550
8618
|
return !1;
|
|
8551
8619
|
}
|
|
8552
8620
|
}
|
|
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 = {
|
|
8621
|
+
}), Rn = {
|
|
8640
8622
|
blockColor: "data-block-color",
|
|
8641
8623
|
blockStyle: "data-block-style",
|
|
8642
8624
|
id: "data-id",
|
|
8643
8625
|
depth: "data-depth",
|
|
8644
8626
|
depthChange: "data-depth-change"
|
|
8645
|
-
},
|
|
8627
|
+
}, Vn = q.create({
|
|
8646
8628
|
name: "blockContainer",
|
|
8647
8629
|
group: "blockContainer",
|
|
8648
8630
|
// A block always contains content, and optionally a blockGroup which contains nested blocks
|
|
@@ -8658,7 +8640,7 @@ const Bn = (e) => T.create({
|
|
|
8658
8640
|
if (typeof e == "string")
|
|
8659
8641
|
return !1;
|
|
8660
8642
|
const t = {};
|
|
8661
|
-
for (const [i, o] of Object.entries(
|
|
8643
|
+
for (const [i, o] of Object.entries(Rn))
|
|
8662
8644
|
e.getAttribute(o) && (t[i] = e.getAttribute(o));
|
|
8663
8645
|
return e.getAttribute("data-node-type") === "blockContainer" ? t : !1;
|
|
8664
8646
|
}
|
|
@@ -8675,7 +8657,7 @@ const Bn = (e) => T.create({
|
|
|
8675
8657
|
...((n = this.options.domAttributes) == null ? void 0 : n.block) || {},
|
|
8676
8658
|
...e
|
|
8677
8659
|
}, o = document.createElement("div");
|
|
8678
|
-
o.className =
|
|
8660
|
+
o.className = V("bn-block", i.class), o.setAttribute("data-node-type", this.name);
|
|
8679
8661
|
for (const [r, a] of Object.entries(i))
|
|
8680
8662
|
r !== "class" && o.setAttribute(r, a);
|
|
8681
8663
|
return t.appendChild(o), {
|
|
@@ -8709,7 +8691,7 @@ const Bn = (e) => T.create({
|
|
|
8709
8691
|
const h = [];
|
|
8710
8692
|
for (const m of t.children)
|
|
8711
8693
|
h.push(
|
|
8712
|
-
|
|
8694
|
+
U(
|
|
8713
8695
|
m,
|
|
8714
8696
|
i.schema,
|
|
8715
8697
|
this.options.editor.schema.styleSchema
|
|
@@ -8718,7 +8700,7 @@ const Bn = (e) => T.create({
|
|
|
8718
8700
|
s.childCount === 2 ? i.tr.replace(
|
|
8719
8701
|
r + l.nodeSize + 1,
|
|
8720
8702
|
a - 1,
|
|
8721
|
-
new
|
|
8703
|
+
new z(N.from(h), 0, 0)
|
|
8722
8704
|
) : i.tr.insert(
|
|
8723
8705
|
r + l.nodeSize,
|
|
8724
8706
|
i.schema.nodes.blockGroup.create({}, h)
|
|
@@ -8728,25 +8710,25 @@ const Bn = (e) => T.create({
|
|
|
8728
8710
|
let p = "keep";
|
|
8729
8711
|
if (t.content)
|
|
8730
8712
|
if (typeof t.content == "string")
|
|
8731
|
-
p =
|
|
8713
|
+
p = R(
|
|
8732
8714
|
[t.content],
|
|
8733
8715
|
i.schema,
|
|
8734
8716
|
this.options.editor.schema.styleSchema
|
|
8735
8717
|
);
|
|
8736
8718
|
else if (Array.isArray(t.content))
|
|
8737
|
-
p =
|
|
8719
|
+
p = R(
|
|
8738
8720
|
t.content,
|
|
8739
8721
|
i.schema,
|
|
8740
8722
|
this.options.editor.schema.styleSchema
|
|
8741
8723
|
);
|
|
8742
8724
|
else if (t.content.type === "tableContent")
|
|
8743
|
-
p =
|
|
8725
|
+
p = it(
|
|
8744
8726
|
t.content,
|
|
8745
8727
|
i.schema,
|
|
8746
8728
|
this.options.editor.schema.styleSchema
|
|
8747
8729
|
);
|
|
8748
8730
|
else
|
|
8749
|
-
throw new
|
|
8731
|
+
throw new P(t.content.type);
|
|
8750
8732
|
else {
|
|
8751
8733
|
const h = i.schema.nodes[d].spec.content, m = i.schema.nodes[u].spec.content;
|
|
8752
8734
|
h === "" || m !== h && (p = []);
|
|
@@ -8769,11 +8751,11 @@ const Bn = (e) => T.create({
|
|
|
8769
8751
|
p
|
|
8770
8752
|
)
|
|
8771
8753
|
).setSelection(
|
|
8772
|
-
i.schema.nodes[u].spec.content === "" ? new
|
|
8754
|
+
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
8755
|
// Need to offset the position as we have to get through the
|
|
8774
8756
|
// `tableRow` and `tableCell` nodes to get to the
|
|
8775
8757
|
// `tableParagraph` node we want to set the selection in.
|
|
8776
|
-
new
|
|
8758
|
+
new Y(i.tr.doc.resolve(r + 4))
|
|
8777
8759
|
)
|
|
8778
8760
|
), i.tr.setNodeMarkup(r - 1, void 0, {
|
|
8779
8761
|
...s.attrs,
|
|
@@ -8810,8 +8792,8 @@ const Bn = (e) => T.create({
|
|
|
8810
8792
|
if (a.childCount === 2) {
|
|
8811
8793
|
const m = t.doc.resolve(
|
|
8812
8794
|
l + s.nodeSize + 1
|
|
8813
|
-
),
|
|
8814
|
-
i && t.tr.lift(
|
|
8795
|
+
), f = t.doc.resolve(d - 1), g = m.blockRange(f);
|
|
8796
|
+
i && t.tr.lift(g, u - 1);
|
|
8815
8797
|
}
|
|
8816
8798
|
let p = e - 1, h = _(t.doc, p);
|
|
8817
8799
|
for (; h.numChildBlocks > 0; )
|
|
@@ -8821,10 +8803,10 @@ const Bn = (e) => T.create({
|
|
|
8821
8803
|
t.tr.deleteRange(l, l + s.nodeSize).replace(
|
|
8822
8804
|
p - 1,
|
|
8823
8805
|
l,
|
|
8824
|
-
new
|
|
8806
|
+
new z(s.content, 0, 0)
|
|
8825
8807
|
).scrollIntoView()
|
|
8826
8808
|
), t.tr.setSelection(
|
|
8827
|
-
new
|
|
8809
|
+
new Y(t.doc.resolve(p - 1))
|
|
8828
8810
|
)), !0;
|
|
8829
8811
|
},
|
|
8830
8812
|
// Splits a block at a given position. Content after the position is moved to a new block below, at the same
|
|
@@ -8837,27 +8819,27 @@ const Bn = (e) => T.create({
|
|
|
8837
8819
|
const r = _(o.doc, e);
|
|
8838
8820
|
if (r === void 0)
|
|
8839
8821
|
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
|
-
|
|
8822
|
+
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;
|
|
8823
|
+
return n && (o.tr.insert(f, m), o.tr.replace(
|
|
8824
|
+
g,
|
|
8825
|
+
g + 1,
|
|
8826
|
+
h.content.size > 0 ? new z(
|
|
8827
|
+
N.from(h),
|
|
8846
8828
|
u + 2,
|
|
8847
8829
|
u + 2
|
|
8848
8830
|
) : void 0
|
|
8849
8831
|
), t && o.tr.setBlockType(
|
|
8850
|
-
|
|
8851
|
-
|
|
8832
|
+
g,
|
|
8833
|
+
g,
|
|
8852
8834
|
o.schema.node(s).type,
|
|
8853
8835
|
i ? a.attrs : void 0
|
|
8854
8836
|
), o.tr.setSelection(
|
|
8855
|
-
new
|
|
8837
|
+
new Y(o.doc.resolve(g))
|
|
8856
8838
|
), o.tr.replace(
|
|
8857
8839
|
l + 1,
|
|
8858
8840
|
d - 1,
|
|
8859
|
-
p.content.size > 0 ? new
|
|
8860
|
-
|
|
8841
|
+
p.content.size > 0 ? new z(
|
|
8842
|
+
N.from(p),
|
|
8861
8843
|
u + 2,
|
|
8862
8844
|
u + 2
|
|
8863
8845
|
) : void 0
|
|
@@ -8866,7 +8848,7 @@ const Bn = (e) => T.create({
|
|
|
8866
8848
|
};
|
|
8867
8849
|
},
|
|
8868
8850
|
addProseMirrorPlugins() {
|
|
8869
|
-
return [
|
|
8851
|
+
return [zn()];
|
|
8870
8852
|
},
|
|
8871
8853
|
addKeyboardShortcuts() {
|
|
8872
8854
|
return {
|
|
@@ -8916,9 +8898,9 @@ const Bn = (e) => T.create({
|
|
|
8916
8898
|
n.selection.from
|
|
8917
8899
|
), l = s === n.doc.nodeSize - 4, d = n.selection.from === s - 1, u = n.selection.empty, p = r.childCount === 2;
|
|
8918
8900
|
if (!l && d && u && !p) {
|
|
8919
|
-
let h = a, m = s + 2,
|
|
8920
|
-
for (;
|
|
8921
|
-
h =
|
|
8901
|
+
let h = a, m = s + 2, f = n.doc.resolve(m).depth;
|
|
8902
|
+
for (; f < h; )
|
|
8903
|
+
h = f, m += 2, f = n.doc.resolve(m).depth;
|
|
8922
8904
|
return o.BNMergeBlocks(m - 1);
|
|
8923
8905
|
}
|
|
8924
8906
|
return !1;
|
|
@@ -8973,7 +8955,7 @@ const Bn = (e) => T.create({
|
|
|
8973
8955
|
}
|
|
8974
8956
|
};
|
|
8975
8957
|
}
|
|
8976
|
-
}),
|
|
8958
|
+
}), On = q.create({
|
|
8977
8959
|
name: "blockGroup",
|
|
8978
8960
|
group: "blockGroup",
|
|
8979
8961
|
content: "blockContainer+",
|
|
@@ -8991,7 +8973,7 @@ const Bn = (e) => T.create({
|
|
|
8991
8973
|
...((o = this.options.domAttributes) == null ? void 0 : o.blockGroup) || {},
|
|
8992
8974
|
...e
|
|
8993
8975
|
}, i = document.createElement("div");
|
|
8994
|
-
i.className =
|
|
8976
|
+
i.className = V(
|
|
8995
8977
|
"bn-block-group",
|
|
8996
8978
|
t.class
|
|
8997
8979
|
), i.setAttribute("data-node-type", "blockGroup");
|
|
@@ -9002,30 +8984,31 @@ const Bn = (e) => T.create({
|
|
|
9002
8984
|
contentDOM: i
|
|
9003
8985
|
};
|
|
9004
8986
|
}
|
|
9005
|
-
}),
|
|
8987
|
+
}), Fn = q.create({
|
|
9006
8988
|
name: "doc",
|
|
9007
8989
|
topNode: !0,
|
|
9008
8990
|
content: "blockGroup"
|
|
9009
|
-
}),
|
|
8991
|
+
}), Gn = (e) => {
|
|
9010
8992
|
var o;
|
|
9011
8993
|
const t = [
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
|
|
8994
|
+
J.ClipboardTextSerializer,
|
|
8995
|
+
J.Commands,
|
|
8996
|
+
J.Editable,
|
|
8997
|
+
J.FocusEvents,
|
|
8998
|
+
J.Tabindex,
|
|
9017
8999
|
// DevTools,
|
|
9018
|
-
|
|
9000
|
+
li,
|
|
9019
9001
|
// DropCursor,
|
|
9020
|
-
|
|
9021
|
-
types: ["blockContainer"]
|
|
9002
|
+
oe.configure({
|
|
9003
|
+
types: ["blockContainer"],
|
|
9004
|
+
setIdAttribute: e.setIdAttribute
|
|
9022
9005
|
}),
|
|
9023
|
-
|
|
9006
|
+
di.extend({ priority: 10 }),
|
|
9024
9007
|
// Comments,
|
|
9025
9008
|
// basics:
|
|
9026
|
-
|
|
9009
|
+
pi,
|
|
9027
9010
|
// marks:
|
|
9028
|
-
|
|
9011
|
+
ui.extend({
|
|
9029
9012
|
addKeyboardShortcuts() {
|
|
9030
9013
|
return {
|
|
9031
9014
|
"Mod-k": () => (this.editor.commands.toggleLink({ href: "" }), !0)
|
|
@@ -9033,11 +9016,11 @@ const Bn = (e) => T.create({
|
|
|
9033
9016
|
}
|
|
9034
9017
|
}),
|
|
9035
9018
|
...Object.values(e.styleSpecs).map((n) => n.implementation.mark),
|
|
9036
|
-
|
|
9037
|
-
|
|
9038
|
-
|
|
9019
|
+
Un,
|
|
9020
|
+
Pn,
|
|
9021
|
+
Hn,
|
|
9039
9022
|
// make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)
|
|
9040
|
-
|
|
9023
|
+
I.create({
|
|
9041
9024
|
name: "OverrideEscape",
|
|
9042
9025
|
addKeyboardShortcuts() {
|
|
9043
9026
|
return {
|
|
@@ -9046,12 +9029,12 @@ const Bn = (e) => T.create({
|
|
|
9046
9029
|
}
|
|
9047
9030
|
}),
|
|
9048
9031
|
// nodes
|
|
9049
|
-
|
|
9050
|
-
|
|
9032
|
+
Fn,
|
|
9033
|
+
Vn.configure({
|
|
9051
9034
|
editor: e.editor,
|
|
9052
9035
|
domAttributes: e.domAttributes
|
|
9053
9036
|
}),
|
|
9054
|
-
|
|
9037
|
+
On.configure({
|
|
9055
9038
|
domAttributes: e.domAttributes
|
|
9056
9039
|
}),
|
|
9057
9040
|
...Object.values(e.inlineContentSpecs).filter((n) => n.config !== "link" && n.config !== "text").map((n) => n.implementation.node.configure({
|
|
@@ -9071,17 +9054,17 @@ const Bn = (e) => T.create({
|
|
|
9071
9054
|
domAttributes: e.domAttributes
|
|
9072
9055
|
})
|
|
9073
9056
|
]),
|
|
9074
|
-
Sn(e.editor),
|
|
9075
9057
|
Bn(e.editor),
|
|
9076
|
-
|
|
9077
|
-
|
|
9058
|
+
Nn(e.editor),
|
|
9059
|
+
An(e.editor),
|
|
9060
|
+
si.configure({ width: 5, color: "#ddeeff" }),
|
|
9078
9061
|
// This needs to be at the bottom of this list, because Key events (such as enter, when selecting a /command),
|
|
9079
9062
|
// should be handled before Enter handlers in other components like splitListItem
|
|
9080
|
-
...e.trailingBlock === void 0 || e.trailingBlock ? [
|
|
9063
|
+
...e.trailingBlock === void 0 || e.trailingBlock ? [Dn] : []
|
|
9081
9064
|
];
|
|
9082
9065
|
if (e.collaboration) {
|
|
9083
9066
|
if (t.push(
|
|
9084
|
-
|
|
9067
|
+
ri.configure({
|
|
9085
9068
|
fragment: e.collaboration.fragment
|
|
9086
9069
|
})
|
|
9087
9070
|
), (o = e.collaboration.provider) != null && o.awareness) {
|
|
@@ -9094,7 +9077,7 @@ const Bn = (e) => T.create({
|
|
|
9094
9077
|
return a.insertBefore(l, null), a.insertBefore(s, null), a.insertBefore(d, null), a;
|
|
9095
9078
|
};
|
|
9096
9079
|
t.push(
|
|
9097
|
-
|
|
9080
|
+
ai.configure({
|
|
9098
9081
|
user: e.collaboration.user,
|
|
9099
9082
|
render: e.collaboration.renderCursor || n,
|
|
9100
9083
|
provider: e.collaboration.provider
|
|
@@ -9102,24 +9085,24 @@ const Bn = (e) => T.create({
|
|
|
9102
9085
|
);
|
|
9103
9086
|
}
|
|
9104
9087
|
} else
|
|
9105
|
-
t.push(
|
|
9088
|
+
t.push(ci);
|
|
9106
9089
|
const i = e.disableExtensions || [];
|
|
9107
9090
|
return t.filter((n) => !i.includes(n.name));
|
|
9108
9091
|
};
|
|
9109
|
-
function
|
|
9092
|
+
function Wn(e, t) {
|
|
9110
9093
|
const i = [];
|
|
9111
9094
|
return e.forEach((o, n, r) => {
|
|
9112
9095
|
r !== t && i.push(o);
|
|
9113
|
-
}),
|
|
9096
|
+
}), N.from(i);
|
|
9114
9097
|
}
|
|
9115
9098
|
function Kn(e, t) {
|
|
9116
|
-
let i =
|
|
9099
|
+
let i = N.from(e.content);
|
|
9117
9100
|
for (let o = 0; o < i.childCount; o++)
|
|
9118
9101
|
if (i.child(o).type.spec.group === "blockContent") {
|
|
9119
9102
|
const n = [i.child(o)];
|
|
9120
9103
|
if (o + 1 < i.childCount && i.child(o + 1).type.spec.group === "blockGroup") {
|
|
9121
9104
|
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 =
|
|
9105
|
+
(a.type.name === "bulletListItem" || a.type.name === "numberedListItem" || a.type.name === "checkListItem") && (n.push(i.child(o + 1)), i = Wn(i, o + 1));
|
|
9123
9106
|
}
|
|
9124
9107
|
const r = t.state.schema.nodes.blockContainer.create(
|
|
9125
9108
|
void 0,
|
|
@@ -9127,9 +9110,9 @@ function Kn(e, t) {
|
|
|
9127
9110
|
);
|
|
9128
9111
|
i = i.replaceChild(o, r);
|
|
9129
9112
|
}
|
|
9130
|
-
return new
|
|
9113
|
+
return new z(i, e.openStart, e.openEnd);
|
|
9131
9114
|
}
|
|
9132
|
-
function
|
|
9115
|
+
function _e(e) {
|
|
9133
9116
|
return e && Object.fromEntries(
|
|
9134
9117
|
Object.entries(e).filter(([, t]) => t !== void 0)
|
|
9135
9118
|
);
|
|
@@ -9146,15 +9129,15 @@ class Ne {
|
|
|
9146
9129
|
c(this, "BlockNoteEditor", "only for types");
|
|
9147
9130
|
c(this, "Block", "only for types");
|
|
9148
9131
|
c(this, "PartialBlock", "only for types");
|
|
9149
|
-
this.blockSpecs =
|
|
9132
|
+
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
9133
|
this.inlineContentSpecs
|
|
9151
|
-
), this.styleSchema =
|
|
9134
|
+
), this.styleSchema = pt(this.styleSpecs);
|
|
9152
9135
|
}
|
|
9153
9136
|
static create(t) {
|
|
9154
9137
|
return new Ne(t);
|
|
9155
9138
|
}
|
|
9156
9139
|
}
|
|
9157
|
-
class
|
|
9140
|
+
class Et extends Ft {
|
|
9158
9141
|
constructor(i, o) {
|
|
9159
9142
|
super({ ...i, content: void 0 });
|
|
9160
9143
|
c(this, "_state");
|
|
@@ -9173,14 +9156,14 @@ class wt extends Rt {
|
|
|
9173
9156
|
if (r)
|
|
9174
9157
|
return r;
|
|
9175
9158
|
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 =
|
|
9159
|
+
return u.content[0].content[0].attrs.id = "initialBlockId", r = At.fromJSON(n, u), r;
|
|
9177
9160
|
};
|
|
9178
9161
|
let s;
|
|
9179
9162
|
try {
|
|
9180
9163
|
const l = i == null ? void 0 : i.content.map(
|
|
9181
|
-
(d) =>
|
|
9164
|
+
(d) => U(d, this.schema, o).toJSON()
|
|
9182
9165
|
);
|
|
9183
|
-
s =
|
|
9166
|
+
s = Gt(
|
|
9184
9167
|
{
|
|
9185
9168
|
type: "doc",
|
|
9186
9169
|
content: [
|
|
@@ -9201,7 +9184,7 @@ class wt extends Rt {
|
|
|
9201
9184
|
"Error creating document from blocks passed as `initialContent`:\n" + +JSON.stringify(i.content)
|
|
9202
9185
|
);
|
|
9203
9186
|
}
|
|
9204
|
-
this._state =
|
|
9187
|
+
this._state = Kt.create({
|
|
9205
9188
|
doc: s,
|
|
9206
9189
|
schema: this.schema
|
|
9207
9190
|
// selection: selection || undefined,
|
|
@@ -9218,7 +9201,7 @@ class wt extends Rt {
|
|
|
9218
9201
|
*/
|
|
9219
9202
|
createViewAlternative() {
|
|
9220
9203
|
queueMicrotask(() => {
|
|
9221
|
-
this.view = new
|
|
9204
|
+
this.view = new ni(
|
|
9222
9205
|
{ mount: this.options.element },
|
|
9223
9206
|
// use mount option so that we reuse the existing element instead of creating a new one
|
|
9224
9207
|
{
|
|
@@ -9235,10 +9218,11 @@ class wt extends Rt {
|
|
|
9235
9218
|
});
|
|
9236
9219
|
}
|
|
9237
9220
|
}
|
|
9238
|
-
|
|
9221
|
+
Et.prototype.createView = function() {
|
|
9222
|
+
this.options.onPaste = this.options.onDrop = void 0;
|
|
9239
9223
|
};
|
|
9240
|
-
const
|
|
9241
|
-
key:
|
|
9224
|
+
const $n = new L("blocknote-placeholder"), qn = (e, t) => new x({
|
|
9225
|
+
key: $n,
|
|
9242
9226
|
view: () => {
|
|
9243
9227
|
const i = document.createElement("style"), o = e._tiptapEditor.options.injectNonce;
|
|
9244
9228
|
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 +9260,104 @@ const Wn = new M("blocknote-placeholder"), $n = (e, t) => new w({
|
|
|
9276
9260
|
const r = n.$anchor, a = r.parent;
|
|
9277
9261
|
if (a.content.size > 0)
|
|
9278
9262
|
return null;
|
|
9279
|
-
const s = r.before(), l =
|
|
9263
|
+
const s = r.before(), l = $.node(s, s + a.nodeSize, {
|
|
9280
9264
|
"data-is-empty-and-focused": "true"
|
|
9281
9265
|
});
|
|
9282
9266
|
return K.create(o, [l]);
|
|
9283
9267
|
}
|
|
9284
9268
|
}
|
|
9285
|
-
}),
|
|
9269
|
+
}), Ye = new L("previous-blocks"), Xn = {
|
|
9270
|
+
// Numbered List Items
|
|
9271
|
+
index: "index",
|
|
9272
|
+
// Headings
|
|
9273
|
+
level: "level",
|
|
9274
|
+
// All Blocks
|
|
9275
|
+
type: "type",
|
|
9276
|
+
depth: "depth",
|
|
9277
|
+
"depth-change": "depth-change"
|
|
9278
|
+
}, Zn = () => {
|
|
9279
|
+
let e;
|
|
9280
|
+
return new x({
|
|
9281
|
+
key: Ye,
|
|
9282
|
+
view(t) {
|
|
9283
|
+
return {
|
|
9284
|
+
update: async (i, o) => {
|
|
9285
|
+
var n;
|
|
9286
|
+
((n = this.key) == null ? void 0 : n.getState(i.state).updatedBlocks.size) > 0 && (e = setTimeout(() => {
|
|
9287
|
+
i.dispatch(
|
|
9288
|
+
i.state.tr.setMeta(Ye, { clearUpdate: !0 })
|
|
9289
|
+
);
|
|
9290
|
+
}, 0));
|
|
9291
|
+
},
|
|
9292
|
+
destroy: () => {
|
|
9293
|
+
e && clearTimeout(e);
|
|
9294
|
+
}
|
|
9295
|
+
};
|
|
9296
|
+
},
|
|
9297
|
+
state: {
|
|
9298
|
+
init() {
|
|
9299
|
+
return {
|
|
9300
|
+
// Block attributes, by block ID, from just before the previous transaction.
|
|
9301
|
+
prevTransactionOldBlockAttrs: {},
|
|
9302
|
+
// Block attributes, by block ID, from just before the current transaction.
|
|
9303
|
+
currentTransactionOldBlockAttrs: {},
|
|
9304
|
+
// Set of IDs of blocks whose attributes changed from the current transaction.
|
|
9305
|
+
updatedBlocks: /* @__PURE__ */ new Set()
|
|
9306
|
+
};
|
|
9307
|
+
},
|
|
9308
|
+
apply(t, i, o, n) {
|
|
9309
|
+
if (i.currentTransactionOldBlockAttrs = {}, i.updatedBlocks.clear(), !t.docChanged || o.doc.eq(n.doc))
|
|
9310
|
+
return i;
|
|
9311
|
+
const r = {}, a = je(o.doc, (d) => d.attrs.id), s = new Map(
|
|
9312
|
+
a.map((d) => [d.node.attrs.id, d])
|
|
9313
|
+
), l = je(n.doc, (d) => d.attrs.id);
|
|
9314
|
+
for (const d of l) {
|
|
9315
|
+
const u = s.get(d.node.attrs.id), p = u == null ? void 0 : u.node.firstChild, h = d.node.firstChild;
|
|
9316
|
+
if (u && p && h) {
|
|
9317
|
+
const m = {
|
|
9318
|
+
index: h.attrs.index,
|
|
9319
|
+
level: h.attrs.level,
|
|
9320
|
+
type: h.type.name,
|
|
9321
|
+
depth: n.doc.resolve(d.pos).depth
|
|
9322
|
+
};
|
|
9323
|
+
let f = {
|
|
9324
|
+
index: p.attrs.index,
|
|
9325
|
+
level: p.attrs.level,
|
|
9326
|
+
type: p.type.name,
|
|
9327
|
+
depth: o.doc.resolve(u.pos).depth
|
|
9328
|
+
};
|
|
9329
|
+
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));
|
|
9330
|
+
}
|
|
9331
|
+
}
|
|
9332
|
+
return i.prevTransactionOldBlockAttrs = r, i;
|
|
9333
|
+
}
|
|
9334
|
+
},
|
|
9335
|
+
props: {
|
|
9336
|
+
decorations(t) {
|
|
9337
|
+
const i = this.getState(t);
|
|
9338
|
+
if (i.updatedBlocks.size === 0)
|
|
9339
|
+
return;
|
|
9340
|
+
const o = [];
|
|
9341
|
+
return t.doc.descendants((n, r) => {
|
|
9342
|
+
if (!n.attrs.id || !i.updatedBlocks.has(n.attrs.id))
|
|
9343
|
+
return;
|
|
9344
|
+
const a = i.currentTransactionOldBlockAttrs[n.attrs.id], s = {};
|
|
9345
|
+
for (const [d, u] of Object.entries(a))
|
|
9346
|
+
s["data-prev-" + Xn[d]] = u || "none";
|
|
9347
|
+
const l = $.node(r, r + n.nodeSize, {
|
|
9348
|
+
...s
|
|
9349
|
+
});
|
|
9350
|
+
o.push(l);
|
|
9351
|
+
}), K.create(t.doc, o);
|
|
9352
|
+
}
|
|
9353
|
+
}
|
|
9354
|
+
});
|
|
9355
|
+
}, Jn = {
|
|
9286
9356
|
enableInputRules: !0,
|
|
9287
9357
|
enablePasteRules: !0,
|
|
9288
9358
|
enableCoreExtensions: !1
|
|
9289
9359
|
};
|
|
9290
|
-
class
|
|
9360
|
+
class Ct {
|
|
9291
9361
|
constructor(t) {
|
|
9292
9362
|
c(this, "_pmSchema");
|
|
9293
9363
|
/**
|
|
@@ -9338,6 +9408,8 @@ class vt {
|
|
|
9338
9408
|
* @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
9409
|
*/
|
|
9340
9410
|
c(this, "uploadFile");
|
|
9411
|
+
c(this, "onUploadStartCallbacks", []);
|
|
9412
|
+
c(this, "onUploadEndCallbacks", []);
|
|
9341
9413
|
c(this, "resolveFileUrl");
|
|
9342
9414
|
/**
|
|
9343
9415
|
* Mount the editor to a parent DOM element. Call mount(undefined) to clean up
|
|
@@ -9347,7 +9419,7 @@ class vt {
|
|
|
9347
9419
|
c(this, "mount", (t) => {
|
|
9348
9420
|
this._tiptapEditor.mount(t);
|
|
9349
9421
|
});
|
|
9350
|
-
var l, d, u, p, h, m,
|
|
9422
|
+
var l, d, u, p, h, m, f;
|
|
9351
9423
|
this.options = t;
|
|
9352
9424
|
const i = t;
|
|
9353
9425
|
if (i.onEditorContentChange)
|
|
@@ -9366,7 +9438,7 @@ class vt {
|
|
|
9366
9438
|
throw new Error(
|
|
9367
9439
|
"editable initialization option is deprecated, use <BlockNoteView editable={true/false} />, or alternatively editor.isEditable = true/false"
|
|
9368
9440
|
);
|
|
9369
|
-
this.dictionary = t.dictionary ||
|
|
9441
|
+
this.dictionary = t.dictionary || Qe;
|
|
9370
9442
|
const o = {
|
|
9371
9443
|
defaultStyles: !0,
|
|
9372
9444
|
schema: t.schema || Ne.create(),
|
|
@@ -9377,8 +9449,8 @@ class vt {
|
|
|
9377
9449
|
...t.placeholders
|
|
9378
9450
|
}
|
|
9379
9451
|
};
|
|
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 =
|
|
9452
|
+
this.schema = o.schema, this.blockImplementations = o.schema.blockSpecs, this.inlineContentImplementations = o.schema.inlineContentSpecs, this.styleImplementations = o.schema.styleSpecs, this.formattingToolbar = new un(this), this.linkToolbar = new mn(this), this.sideMenu = new yn(this), this.suggestionMenus = new xn(this), this.filePanel = new ln(this), T("table", this) && (this.tableHandles = new Tn(this));
|
|
9453
|
+
const n = Gn({
|
|
9382
9454
|
editor: this,
|
|
9383
9455
|
domAttributes: o.domAttributes || {},
|
|
9384
9456
|
blockSpecs: this.schema.blockSpecs,
|
|
@@ -9386,8 +9458,9 @@ class vt {
|
|
|
9386
9458
|
inlineContentSpecs: this.schema.inlineContentSpecs,
|
|
9387
9459
|
collaboration: o.collaboration,
|
|
9388
9460
|
trailingBlock: o.trailingBlock,
|
|
9389
|
-
disableExtensions: o.disableExtensions
|
|
9390
|
-
|
|
9461
|
+
disableExtensions: o.disableExtensions,
|
|
9462
|
+
setIdAttribute: o.setIdAttribute
|
|
9463
|
+
}), r = I.create({
|
|
9391
9464
|
name: "BlockNoteUIExtension",
|
|
9392
9465
|
addProseMirrorPlugins: () => [
|
|
9393
9466
|
this.formattingToolbar.plugin,
|
|
@@ -9396,10 +9469,26 @@ class vt {
|
|
|
9396
9469
|
this.suggestionMenus.plugin,
|
|
9397
9470
|
...this.filePanel ? [this.filePanel.plugin] : [],
|
|
9398
9471
|
...this.tableHandles ? [this.tableHandles.plugin] : [],
|
|
9399
|
-
|
|
9472
|
+
qn(this, o.placeholders),
|
|
9473
|
+
...this.options.animations ?? !0 ? [Zn()] : []
|
|
9400
9474
|
]
|
|
9401
9475
|
});
|
|
9402
|
-
n.push(r),
|
|
9476
|
+
if (n.push(r), o.uploadFile) {
|
|
9477
|
+
const g = o.uploadFile;
|
|
9478
|
+
this.uploadFile = async (k, w) => {
|
|
9479
|
+
this.onUploadStartCallbacks.forEach(
|
|
9480
|
+
(b) => b.apply(this, [w])
|
|
9481
|
+
);
|
|
9482
|
+
try {
|
|
9483
|
+
return await g(k, w);
|
|
9484
|
+
} finally {
|
|
9485
|
+
this.onUploadEndCallbacks.forEach(
|
|
9486
|
+
(b) => b.apply(this, [w])
|
|
9487
|
+
);
|
|
9488
|
+
}
|
|
9489
|
+
};
|
|
9490
|
+
}
|
|
9491
|
+
this.resolveFileUrl = o.resolveFileUrl || (async (g) => g), this.headless = o._headless, o.collaboration && o.initialContent && console.warn(
|
|
9403
9492
|
"When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"
|
|
9404
9493
|
);
|
|
9405
9494
|
const a = o.initialContent || (t.collaboration ? [
|
|
@@ -9410,7 +9499,7 @@ class vt {
|
|
|
9410
9499
|
] : [
|
|
9411
9500
|
{
|
|
9412
9501
|
type: "paragraph",
|
|
9413
|
-
id:
|
|
9502
|
+
id: oe.options.generateID()
|
|
9414
9503
|
}
|
|
9415
9504
|
]);
|
|
9416
9505
|
if (!Array.isArray(a) || a.length === 0)
|
|
@@ -9418,7 +9507,7 @@ class vt {
|
|
|
9418
9507
|
"initialContent must be a non-empty array of blocks, received: " + a
|
|
9419
9508
|
);
|
|
9420
9509
|
const s = {
|
|
9421
|
-
...
|
|
9510
|
+
...Jn,
|
|
9422
9511
|
...o._tiptapOptions,
|
|
9423
9512
|
content: a,
|
|
9424
9513
|
extensions: [
|
|
@@ -9434,16 +9523,16 @@ class vt {
|
|
|
9434
9523
|
tabIndex: "0",
|
|
9435
9524
|
...(p = (u = o._tiptapOptions) == null ? void 0 : u.editorProps) == null ? void 0 : p.attributes,
|
|
9436
9525
|
...(h = o.domAttributes) == null ? void 0 : h.editor,
|
|
9437
|
-
class:
|
|
9526
|
+
class: V(
|
|
9438
9527
|
"bn-editor",
|
|
9439
9528
|
o.defaultStyles ? "bn-default-styles" : "",
|
|
9440
|
-
((
|
|
9529
|
+
((f = (m = o.domAttributes) == null ? void 0 : m.editor) == null ? void 0 : f.class) || ""
|
|
9441
9530
|
)
|
|
9442
9531
|
},
|
|
9443
9532
|
transformPasted: Kn
|
|
9444
9533
|
}
|
|
9445
9534
|
};
|
|
9446
|
-
this.headless ? this._pmSchema =
|
|
9535
|
+
this.headless ? this._pmSchema = Wt(s.extensions) : (this._tiptapEditor = new Et(
|
|
9447
9536
|
s,
|
|
9448
9537
|
this.schema.styleSchema
|
|
9449
9538
|
), this._pmSchema = this._tiptapEditor.schema);
|
|
@@ -9452,7 +9541,7 @@ class vt {
|
|
|
9452
9541
|
return this._pmSchema;
|
|
9453
9542
|
}
|
|
9454
9543
|
static create(t = {}) {
|
|
9455
|
-
return new
|
|
9544
|
+
return new Ct(t);
|
|
9456
9545
|
}
|
|
9457
9546
|
dispatch(t) {
|
|
9458
9547
|
this._tiptapEditor.dispatch(t);
|
|
@@ -9469,6 +9558,18 @@ class vt {
|
|
|
9469
9558
|
focus() {
|
|
9470
9559
|
this._tiptapEditor.view.focus();
|
|
9471
9560
|
}
|
|
9561
|
+
onUploadStart(t) {
|
|
9562
|
+
return this.onUploadStartCallbacks.push(t), () => {
|
|
9563
|
+
const i = this.onUploadStartCallbacks.indexOf(t);
|
|
9564
|
+
i > -1 && this.onUploadStartCallbacks.splice(i, 1);
|
|
9565
|
+
};
|
|
9566
|
+
}
|
|
9567
|
+
onUploadEnd(t) {
|
|
9568
|
+
return this.onUploadEndCallbacks.push(t), () => {
|
|
9569
|
+
const i = this.onUploadEndCallbacks.indexOf(t);
|
|
9570
|
+
i > -1 && this.onUploadEndCallbacks.splice(i, 1);
|
|
9571
|
+
};
|
|
9572
|
+
}
|
|
9472
9573
|
/**
|
|
9473
9574
|
* @deprecated, use `editor.document` instead
|
|
9474
9575
|
*/
|
|
@@ -9482,7 +9583,7 @@ class vt {
|
|
|
9482
9583
|
get document() {
|
|
9483
9584
|
const t = [];
|
|
9484
9585
|
return this._tiptapEditor.state.doc.firstChild.descendants((i) => (t.push(
|
|
9485
|
-
|
|
9586
|
+
C(
|
|
9486
9587
|
i,
|
|
9487
9588
|
this.schema.blockSchema,
|
|
9488
9589
|
this.schema.inlineContentSchema,
|
|
@@ -9499,7 +9600,7 @@ class vt {
|
|
|
9499
9600
|
getBlock(t) {
|
|
9500
9601
|
const i = typeof t == "string" ? t : t.id;
|
|
9501
9602
|
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 =
|
|
9603
|
+
return this._tiptapEditor.state.doc.firstChild.descendants((n) => typeof o < "u" ? !1 : n.type.name !== "blockContainer" || n.attrs.id !== i ? !0 : (o = C(
|
|
9503
9604
|
n,
|
|
9504
9605
|
this.schema.blockSchema,
|
|
9505
9606
|
this.schema.inlineContentSchema,
|
|
@@ -9517,7 +9618,7 @@ class vt {
|
|
|
9517
9618
|
i && o.reverse();
|
|
9518
9619
|
function n(r) {
|
|
9519
9620
|
for (const a of r) {
|
|
9520
|
-
if (
|
|
9621
|
+
if (t(a) === !1)
|
|
9521
9622
|
return !1;
|
|
9522
9623
|
const s = i ? a.children.slice().reverse() : a.children;
|
|
9523
9624
|
if (!n(s))
|
|
@@ -9554,21 +9655,21 @@ class vt {
|
|
|
9554
9655
|
r > 0 && (s = this._tiptapEditor.state.doc.resolve(o - 2).node());
|
|
9555
9656
|
let l;
|
|
9556
9657
|
return r < a - 1 && (l = this._tiptapEditor.state.doc.resolve(n + 2).node()), {
|
|
9557
|
-
block:
|
|
9658
|
+
block: C(
|
|
9558
9659
|
t,
|
|
9559
9660
|
this.schema.blockSchema,
|
|
9560
9661
|
this.schema.inlineContentSchema,
|
|
9561
9662
|
this.schema.styleSchema,
|
|
9562
9663
|
this.blockCache
|
|
9563
9664
|
),
|
|
9564
|
-
prevBlock: s === void 0 ? void 0 :
|
|
9665
|
+
prevBlock: s === void 0 ? void 0 : C(
|
|
9565
9666
|
s,
|
|
9566
9667
|
this.schema.blockSchema,
|
|
9567
9668
|
this.schema.inlineContentSchema,
|
|
9568
9669
|
this.schema.styleSchema,
|
|
9569
9670
|
this.blockCache
|
|
9570
9671
|
),
|
|
9571
|
-
nextBlock: l === void 0 ? void 0 :
|
|
9672
|
+
nextBlock: l === void 0 ? void 0 : C(
|
|
9572
9673
|
l,
|
|
9573
9674
|
this.schema.blockSchema,
|
|
9574
9675
|
this.schema.inlineContentSchema,
|
|
@@ -9601,7 +9702,7 @@ class vt {
|
|
|
9601
9702
|
r + a.nodeSize - 4
|
|
9602
9703
|
);
|
|
9603
9704
|
else
|
|
9604
|
-
throw new
|
|
9705
|
+
throw new P(s);
|
|
9605
9706
|
}
|
|
9606
9707
|
/**
|
|
9607
9708
|
* Gets a snapshot of the current selection.
|
|
@@ -9615,7 +9716,7 @@ class vt {
|
|
|
9615
9716
|
return !0;
|
|
9616
9717
|
const n = o + i.nodeSize - 1, r = o + 1;
|
|
9617
9718
|
return n <= this._tiptapEditor.state.selection.from || r >= this._tiptapEditor.state.selection.to ? !0 : (t.push(
|
|
9618
|
-
|
|
9719
|
+
C(
|
|
9619
9720
|
this._tiptapEditor.state.doc.resolve(o).node(),
|
|
9620
9721
|
this.schema.blockSchema,
|
|
9621
9722
|
this.schema.inlineContentSchema,
|
|
@@ -9658,7 +9759,7 @@ class vt {
|
|
|
9658
9759
|
* `referenceBlock`. Inserts the blocks at the start of the existing block's children if "nested" is used.
|
|
9659
9760
|
*/
|
|
9660
9761
|
insertBlocks(t, i, o = "before") {
|
|
9661
|
-
return
|
|
9762
|
+
return Wo(t, i, o, this);
|
|
9662
9763
|
}
|
|
9663
9764
|
/**
|
|
9664
9765
|
* Updates an existing block in the editor. Since updatedBlock is a PartialBlock object, some fields might not be
|
|
@@ -9668,14 +9769,14 @@ class vt {
|
|
|
9668
9769
|
* @param update A partial block which defines how the existing block should be changed.
|
|
9669
9770
|
*/
|
|
9670
9771
|
updateBlock(t, i) {
|
|
9671
|
-
return
|
|
9772
|
+
return Ko(t, i, this);
|
|
9672
9773
|
}
|
|
9673
9774
|
/**
|
|
9674
9775
|
* Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
|
|
9675
9776
|
* @param blocksToRemove An array of identifiers for existing blocks that should be removed.
|
|
9676
9777
|
*/
|
|
9677
9778
|
removeBlocks(t) {
|
|
9678
|
-
return
|
|
9779
|
+
return $o(t, this);
|
|
9679
9780
|
}
|
|
9680
9781
|
/**
|
|
9681
9782
|
* Replaces existing blocks in the editor with new blocks. If the blocks that should be removed are not adjacent or
|
|
@@ -9685,7 +9786,7 @@ class vt {
|
|
|
9685
9786
|
* @param blocksToInsert An array of partial blocks to replace the old ones with.
|
|
9686
9787
|
*/
|
|
9687
9788
|
replaceBlocks(t, i) {
|
|
9688
|
-
return
|
|
9789
|
+
return qo(t, i, this);
|
|
9689
9790
|
}
|
|
9690
9791
|
/**
|
|
9691
9792
|
* Insert a piece of content at the current cursor position.
|
|
@@ -9693,12 +9794,12 @@ class vt {
|
|
|
9693
9794
|
* @param content can be a string, or array of partial inline content elements
|
|
9694
9795
|
*/
|
|
9695
9796
|
insertInlineContent(t) {
|
|
9696
|
-
const i =
|
|
9797
|
+
const i = R(
|
|
9697
9798
|
t,
|
|
9698
9799
|
this.pmSchema,
|
|
9699
9800
|
this.schema.styleSchema
|
|
9700
9801
|
);
|
|
9701
|
-
|
|
9802
|
+
Xo(
|
|
9702
9803
|
{
|
|
9703
9804
|
from: this._tiptapEditor.state.selection.from,
|
|
9704
9805
|
to: this._tiptapEditor.state.selection.to
|
|
@@ -9736,7 +9837,7 @@ class vt {
|
|
|
9736
9837
|
else if (n.propSchema === "string")
|
|
9737
9838
|
this._tiptapEditor.commands.setMark(i, { stringValue: o });
|
|
9738
9839
|
else
|
|
9739
|
-
throw new
|
|
9840
|
+
throw new P(n.propSchema);
|
|
9740
9841
|
}
|
|
9741
9842
|
}
|
|
9742
9843
|
/**
|
|
@@ -9761,7 +9862,7 @@ class vt {
|
|
|
9761
9862
|
else if (n.propSchema === "string")
|
|
9762
9863
|
this._tiptapEditor.commands.toggleMark(i, { stringValue: o });
|
|
9763
9864
|
else
|
|
9764
|
-
throw new
|
|
9865
|
+
throw new P(n.propSchema);
|
|
9765
9866
|
}
|
|
9766
9867
|
}
|
|
9767
9868
|
/**
|
|
@@ -9834,7 +9935,7 @@ class vt {
|
|
|
9834
9935
|
* @returns The blocks, serialized as an HTML string.
|
|
9835
9936
|
*/
|
|
9836
9937
|
async blocksToHTMLLossy(t = this.document) {
|
|
9837
|
-
return await
|
|
9938
|
+
return await ie(), de(this.pmSchema, this).exportBlocks(t, {});
|
|
9838
9939
|
}
|
|
9839
9940
|
/**
|
|
9840
9941
|
* Serializes blocks into an HTML string in the format that would normally be rendered by the editor.
|
|
@@ -9856,7 +9957,7 @@ class vt {
|
|
|
9856
9957
|
* @returns The blocks parsed from the HTML string.
|
|
9857
9958
|
*/
|
|
9858
9959
|
async tryParseHTMLToBlocks(t) {
|
|
9859
|
-
return
|
|
9960
|
+
return yt(
|
|
9860
9961
|
t,
|
|
9861
9962
|
this.schema.blockSchema,
|
|
9862
9963
|
this.schema.inlineContentSchema,
|
|
@@ -9871,7 +9972,7 @@ class vt {
|
|
|
9871
9972
|
* @returns The blocks, serialized as a Markdown string.
|
|
9872
9973
|
*/
|
|
9873
9974
|
async blocksToMarkdownLossy(t = this.document) {
|
|
9874
|
-
return
|
|
9975
|
+
return Yo(t, this.pmSchema, this, {});
|
|
9875
9976
|
}
|
|
9876
9977
|
/**
|
|
9877
9978
|
* Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on
|
|
@@ -9881,7 +9982,7 @@ class vt {
|
|
|
9881
9982
|
* @returns The blocks parsed from the Markdown string.
|
|
9882
9983
|
*/
|
|
9883
9984
|
async tryParseMarkdownToBlocks(t) {
|
|
9884
|
-
return
|
|
9985
|
+
return an(
|
|
9885
9986
|
t,
|
|
9886
9987
|
this.schema.blockSchema,
|
|
9887
9988
|
this.schema.inlineContentSchema,
|
|
@@ -9942,43 +10043,43 @@ class vt {
|
|
|
9942
10043
|
);
|
|
9943
10044
|
}
|
|
9944
10045
|
}
|
|
9945
|
-
let ae,
|
|
9946
|
-
async function
|
|
9947
|
-
if (!
|
|
10046
|
+
let ae, ke;
|
|
10047
|
+
async function zr(e, t) {
|
|
10048
|
+
if (!Oo("text", e))
|
|
9948
10049
|
return [];
|
|
9949
10050
|
if (!ae) {
|
|
9950
|
-
ae = import("@emoji-mart/data"),
|
|
10051
|
+
ae = import("@emoji-mart/data"), ke = await import("emoji-mart");
|
|
9951
10052
|
const n = (await ae).default;
|
|
9952
|
-
await
|
|
10053
|
+
await ke.init({ data: n });
|
|
9953
10054
|
}
|
|
9954
10055
|
const i = (await ae).default;
|
|
9955
|
-
return (t.trim() === "" ? Object.values(i.emojis) : await
|
|
10056
|
+
return (t.trim() === "" ? Object.values(i.emojis) : await ke.SearchIndex.search(t)).map((n) => ({
|
|
9956
10057
|
id: n.skins[0].native,
|
|
9957
10058
|
onItemClick: () => e.insertInlineContent(n.skins[0].native + " ")
|
|
9958
10059
|
}));
|
|
9959
10060
|
}
|
|
9960
|
-
function
|
|
10061
|
+
function Yn(e) {
|
|
9961
10062
|
let t = e.getTextCursorPosition().block, i = e.schema.blockSchema[t.type].content;
|
|
9962
10063
|
for (; i === "none"; )
|
|
9963
10064
|
t = e.getTextCursorPosition().nextBlock, i = e.schema.blockSchema[t.type].content, e.setTextCursorPosition(t, "end");
|
|
9964
10065
|
}
|
|
9965
|
-
function
|
|
10066
|
+
function M(e, t) {
|
|
9966
10067
|
const i = e.getTextCursorPosition().block;
|
|
9967
10068
|
if (i.content === void 0)
|
|
9968
10069
|
throw new Error("Slash Menu open in a block that doesn't contain content.");
|
|
9969
|
-
Array.isArray(i.content) && (i.content.length === 1 &&
|
|
10070
|
+
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
10071
|
e.getTextCursorPosition().nextBlock,
|
|
9971
10072
|
"end"
|
|
9972
10073
|
));
|
|
9973
10074
|
const o = e.getTextCursorPosition().block;
|
|
9974
|
-
return
|
|
10075
|
+
return Yn(e), o;
|
|
9975
10076
|
}
|
|
9976
|
-
function
|
|
10077
|
+
function Rr(e) {
|
|
9977
10078
|
const t = [];
|
|
9978
|
-
return
|
|
10079
|
+
return T("heading", e) && t.push(
|
|
9979
10080
|
{
|
|
9980
10081
|
onItemClick: () => {
|
|
9981
|
-
|
|
10082
|
+
M(e, {
|
|
9982
10083
|
type: "heading",
|
|
9983
10084
|
props: { level: 1 }
|
|
9984
10085
|
});
|
|
@@ -9989,7 +10090,7 @@ function Ur(e) {
|
|
|
9989
10090
|
},
|
|
9990
10091
|
{
|
|
9991
10092
|
onItemClick: () => {
|
|
9992
|
-
|
|
10093
|
+
M(e, {
|
|
9993
10094
|
type: "heading",
|
|
9994
10095
|
props: { level: 2 }
|
|
9995
10096
|
});
|
|
@@ -10000,7 +10101,7 @@ function Ur(e) {
|
|
|
10000
10101
|
},
|
|
10001
10102
|
{
|
|
10002
10103
|
onItemClick: () => {
|
|
10003
|
-
|
|
10104
|
+
M(e, {
|
|
10004
10105
|
type: "heading",
|
|
10005
10106
|
props: { level: 3 }
|
|
10006
10107
|
});
|
|
@@ -10009,45 +10110,45 @@ function Ur(e) {
|
|
|
10009
10110
|
key: "heading_3",
|
|
10010
10111
|
...e.dictionary.slash_menu.heading_3
|
|
10011
10112
|
}
|
|
10012
|
-
),
|
|
10113
|
+
), T("numberedListItem", e) && t.push({
|
|
10013
10114
|
onItemClick: () => {
|
|
10014
|
-
|
|
10115
|
+
M(e, {
|
|
10015
10116
|
type: "numberedListItem"
|
|
10016
10117
|
});
|
|
10017
10118
|
},
|
|
10018
10119
|
badge: D("Mod-Shift-7"),
|
|
10019
10120
|
key: "numbered_list",
|
|
10020
10121
|
...e.dictionary.slash_menu.numbered_list
|
|
10021
|
-
}),
|
|
10122
|
+
}), T("bulletListItem", e) && t.push({
|
|
10022
10123
|
onItemClick: () => {
|
|
10023
|
-
|
|
10124
|
+
M(e, {
|
|
10024
10125
|
type: "bulletListItem"
|
|
10025
10126
|
});
|
|
10026
10127
|
},
|
|
10027
10128
|
badge: D("Mod-Shift-8"),
|
|
10028
10129
|
key: "bullet_list",
|
|
10029
10130
|
...e.dictionary.slash_menu.bullet_list
|
|
10030
|
-
}),
|
|
10131
|
+
}), T("checkListItem", e) && t.push({
|
|
10031
10132
|
onItemClick: () => {
|
|
10032
|
-
|
|
10133
|
+
M(e, {
|
|
10033
10134
|
type: "checkListItem"
|
|
10034
10135
|
});
|
|
10035
10136
|
},
|
|
10036
10137
|
badge: D("Mod-Shift-9"),
|
|
10037
10138
|
key: "check_list",
|
|
10038
10139
|
...e.dictionary.slash_menu.check_list
|
|
10039
|
-
}),
|
|
10140
|
+
}), T("paragraph", e) && t.push({
|
|
10040
10141
|
onItemClick: () => {
|
|
10041
|
-
|
|
10142
|
+
M(e, {
|
|
10042
10143
|
type: "paragraph"
|
|
10043
10144
|
});
|
|
10044
10145
|
},
|
|
10045
10146
|
badge: D("Mod-Alt-0"),
|
|
10046
10147
|
key: "paragraph",
|
|
10047
10148
|
...e.dictionary.slash_menu.paragraph
|
|
10048
|
-
}),
|
|
10149
|
+
}), T("table", e) && t.push({
|
|
10049
10150
|
onItemClick: () => {
|
|
10050
|
-
|
|
10151
|
+
M(e, {
|
|
10051
10152
|
type: "table",
|
|
10052
10153
|
content: {
|
|
10053
10154
|
type: "tableContent",
|
|
@@ -10065,9 +10166,9 @@ function Ur(e) {
|
|
|
10065
10166
|
badge: void 0,
|
|
10066
10167
|
key: "table",
|
|
10067
10168
|
...e.dictionary.slash_menu.table
|
|
10068
|
-
}),
|
|
10169
|
+
}), T("image", e) && t.push({
|
|
10069
10170
|
onItemClick: () => {
|
|
10070
|
-
const i =
|
|
10171
|
+
const i = M(e, {
|
|
10071
10172
|
type: "image"
|
|
10072
10173
|
});
|
|
10073
10174
|
e.dispatch(
|
|
@@ -10078,9 +10179,9 @@ function Ur(e) {
|
|
|
10078
10179
|
},
|
|
10079
10180
|
key: "image",
|
|
10080
10181
|
...e.dictionary.slash_menu.image
|
|
10081
|
-
}),
|
|
10182
|
+
}), T("video", e) && t.push({
|
|
10082
10183
|
onItemClick: () => {
|
|
10083
|
-
const i =
|
|
10184
|
+
const i = M(e, {
|
|
10084
10185
|
type: "video"
|
|
10085
10186
|
});
|
|
10086
10187
|
e.dispatch(
|
|
@@ -10091,9 +10192,9 @@ function Ur(e) {
|
|
|
10091
10192
|
},
|
|
10092
10193
|
key: "video",
|
|
10093
10194
|
...e.dictionary.slash_menu.video
|
|
10094
|
-
}),
|
|
10195
|
+
}), T("audio", e) && t.push({
|
|
10095
10196
|
onItemClick: () => {
|
|
10096
|
-
const i =
|
|
10197
|
+
const i = M(e, {
|
|
10097
10198
|
type: "audio"
|
|
10098
10199
|
});
|
|
10099
10200
|
e.dispatch(
|
|
@@ -10104,9 +10205,9 @@ function Ur(e) {
|
|
|
10104
10205
|
},
|
|
10105
10206
|
key: "audio",
|
|
10106
10207
|
...e.dictionary.slash_menu.audio
|
|
10107
|
-
}),
|
|
10208
|
+
}), T("file", e) && t.push({
|
|
10108
10209
|
onItemClick: () => {
|
|
10109
|
-
const i =
|
|
10210
|
+
const i = M(e, {
|
|
10110
10211
|
type: "file"
|
|
10111
10212
|
});
|
|
10112
10213
|
e.dispatch(
|
|
@@ -10128,14 +10229,14 @@ function Ur(e) {
|
|
|
10128
10229
|
...e.dictionary.slash_menu.emoji
|
|
10129
10230
|
}), t;
|
|
10130
10231
|
}
|
|
10131
|
-
function
|
|
10232
|
+
function Vr(e, t) {
|
|
10132
10233
|
return e.filter(
|
|
10133
10234
|
({ title: i, aliases: o }) => i.toLowerCase().includes(t.toLowerCase()) || o && o.filter(
|
|
10134
10235
|
(n) => n.toLowerCase().includes(t.toLowerCase())
|
|
10135
10236
|
).length !== 0
|
|
10136
10237
|
);
|
|
10137
10238
|
}
|
|
10138
|
-
function
|
|
10239
|
+
function ye(e = "") {
|
|
10139
10240
|
return typeof e == "string" ? [
|
|
10140
10241
|
{
|
|
10141
10242
|
type: "text",
|
|
@@ -10144,22 +10245,22 @@ function we(e = "") {
|
|
|
10144
10245
|
}
|
|
10145
10246
|
] : e;
|
|
10146
10247
|
}
|
|
10147
|
-
function
|
|
10148
|
-
return typeof e == "string" ?
|
|
10248
|
+
function St(e) {
|
|
10249
|
+
return typeof e == "string" ? ye(e) : Array.isArray(e) ? e.flatMap((t) => typeof t == "string" ? ye(t) : tt(t) ? {
|
|
10149
10250
|
...t,
|
|
10150
|
-
content:
|
|
10151
|
-
} :
|
|
10251
|
+
content: ye(t.content)
|
|
10252
|
+
} : te(t) ? t : {
|
|
10152
10253
|
props: {},
|
|
10153
10254
|
...t,
|
|
10154
|
-
content:
|
|
10255
|
+
content: St(t.content)
|
|
10155
10256
|
}) : e;
|
|
10156
10257
|
}
|
|
10157
|
-
function
|
|
10258
|
+
function Or(e, t) {
|
|
10158
10259
|
return t.map(
|
|
10159
|
-
(i) =>
|
|
10260
|
+
(i) => Mt(e, i)
|
|
10160
10261
|
);
|
|
10161
10262
|
}
|
|
10162
|
-
function
|
|
10263
|
+
function Mt(e, t) {
|
|
10163
10264
|
const i = {
|
|
10164
10265
|
id: "",
|
|
10165
10266
|
type: t.type,
|
|
@@ -10174,147 +10275,148 @@ function Et(e, t) {
|
|
|
10174
10275
|
}
|
|
10175
10276
|
), {
|
|
10176
10277
|
...i,
|
|
10177
|
-
content:
|
|
10178
|
-
children: i.children.map((o) =>
|
|
10278
|
+
content: St(i.content),
|
|
10279
|
+
children: i.children.map((o) => Mt(e, o))
|
|
10179
10280
|
};
|
|
10180
10281
|
}
|
|
10181
|
-
function
|
|
10182
|
-
e.id || (e.id =
|
|
10282
|
+
function Qn(e) {
|
|
10283
|
+
e.id || (e.id = oe.options.generateID()), e.children && er(e.children);
|
|
10183
10284
|
}
|
|
10184
|
-
function
|
|
10285
|
+
function er(e) {
|
|
10185
10286
|
for (const t of e)
|
|
10186
|
-
|
|
10287
|
+
Qn(t);
|
|
10187
10288
|
}
|
|
10188
10289
|
export {
|
|
10189
|
-
|
|
10190
|
-
|
|
10290
|
+
qi as AudioBlock,
|
|
10291
|
+
Ct as BlockNoteEditor,
|
|
10191
10292
|
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
|
-
|
|
10293
|
+
eo as FileBlock,
|
|
10294
|
+
ln as FilePanelProsemirrorPlugin,
|
|
10295
|
+
sn as FilePanelView,
|
|
10296
|
+
un as FormattingToolbarProsemirrorPlugin,
|
|
10297
|
+
dn as FormattingToolbarView,
|
|
10298
|
+
yt as HTMLToBlocks,
|
|
10299
|
+
ao as ImageBlock,
|
|
10300
|
+
mn as LinkToolbarProsemirrorPlugin,
|
|
10301
|
+
yn as SideMenuProsemirrorPlugin,
|
|
10302
|
+
_n as SideMenuView,
|
|
10303
|
+
xn as SuggestionMenuProseMirrorPlugin,
|
|
10304
|
+
Tn as TableHandlesProsemirrorPlugin,
|
|
10305
|
+
Mn as TableHandlesView,
|
|
10306
|
+
oe as UniqueID,
|
|
10307
|
+
P as UnreachableCaseError,
|
|
10308
|
+
ho as VideoBlock,
|
|
10309
|
+
Qn as addIdsToBlock,
|
|
10310
|
+
er as addIdsToBlocks,
|
|
10311
|
+
Fe as addInlineContentAttributes,
|
|
10312
|
+
Hi as addInlineContentKeyboardShortcuts,
|
|
10313
|
+
Ri as addStyleAttributes,
|
|
10314
|
+
Mr as assertEmpty,
|
|
10315
|
+
Gi as audioBlockConfig,
|
|
10316
|
+
Ki as audioParse,
|
|
10317
|
+
Fi as audioPropSchema,
|
|
10318
|
+
Wi as audioRender,
|
|
10319
|
+
$i as audioToExternalHTML,
|
|
10320
|
+
U as blockToNode,
|
|
10321
|
+
Yo as blocksToMarkdown,
|
|
10322
|
+
se as camelToDataKebab,
|
|
10323
|
+
Dr as checkBlockHasDefaultProp,
|
|
10324
|
+
Fo as checkBlockIsDefaultType,
|
|
10325
|
+
Pr as checkBlockIsFileBlock,
|
|
10326
|
+
Ur as checkBlockIsFileBlockWithPlaceholder,
|
|
10327
|
+
Hr as checkBlockIsFileBlockWithPreview,
|
|
10328
|
+
Go as checkBlockTypeHasDefaultProp,
|
|
10329
|
+
T as checkDefaultBlockTypeInSchema,
|
|
10330
|
+
Oo as checkDefaultInlineContentTypeInSchema,
|
|
10230
10331
|
Ie as cleanHTMLToMarkdown,
|
|
10231
10332
|
Se as contentNodeToInlineContent,
|
|
10232
|
-
|
|
10333
|
+
Oi as createAddFileButton,
|
|
10233
10334
|
ce as createBlockSpec,
|
|
10234
10335
|
X as createBlockSpecFromStronglyTypedTiptapNode,
|
|
10235
|
-
|
|
10236
|
-
|
|
10336
|
+
O as createDefaultBlockDOMOutputSpec,
|
|
10337
|
+
ht as createDefaultFilePreview,
|
|
10237
10338
|
de as createExternalHTMLExporter,
|
|
10238
10339
|
Te as createFigureWithCaption,
|
|
10239
|
-
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10340
|
+
ne as createFileAndCaptionWrapper,
|
|
10341
|
+
ue as createFileBlockWrapper,
|
|
10342
|
+
Lr as createInlineContentSpec,
|
|
10343
|
+
Di as createInlineContentSpecFromTipTapNode,
|
|
10344
|
+
lt as createInternalBlockSpec,
|
|
10243
10345
|
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
|
-
|
|
10346
|
+
Ui as createInternalInlineContentSpec,
|
|
10347
|
+
ut as createInternalStyleSpec,
|
|
10348
|
+
he as createLinkWithCaption,
|
|
10349
|
+
mt as createResizeHandlesWrapper,
|
|
10350
|
+
F as createStronglyTypedTiptapNode,
|
|
10351
|
+
Ir as createStyleSpec,
|
|
10352
|
+
j as createStyleSpecFromTipTapMark,
|
|
10353
|
+
jr as createSuggestionMenu,
|
|
10354
|
+
Ro as defaultBlockSchema,
|
|
10355
|
+
ft as defaultBlockSpecs,
|
|
10356
|
+
Oe as defaultBlockToHTML,
|
|
10357
|
+
Vo as defaultInlineContentSchema,
|
|
10358
|
+
bt as defaultInlineContentSpecs,
|
|
10359
|
+
v as defaultProps,
|
|
10360
|
+
Nr as defaultStyleSchema,
|
|
10361
|
+
gt as defaultStyleSpecs,
|
|
10362
|
+
H as esmDependencies,
|
|
10363
|
+
Zi as fileBlockConfig,
|
|
10364
|
+
Yi as fileParse,
|
|
10365
|
+
Xi as filePropSchema,
|
|
10366
|
+
Ji as fileRender,
|
|
10367
|
+
Qi as fileToExternalHTML,
|
|
10368
|
+
Br as filenameFromURL,
|
|
10369
|
+
Vr as filterSuggestionItems,
|
|
10268
10370
|
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
|
-
|
|
10371
|
+
cn as formattingToolbarPluginKey,
|
|
10372
|
+
Ni as getBlockFromPos,
|
|
10373
|
+
Gn as getBlockNoteExtensions,
|
|
10374
|
+
dt as getBlockSchemaFromSpecs,
|
|
10375
|
+
B as getCurrentBlockContentType,
|
|
10376
|
+
zr as getDefaultEmojiPickerItems,
|
|
10377
|
+
Rr as getDefaultSlashMenuItems,
|
|
10378
|
+
me as getDraggableBlockFromElement,
|
|
10379
|
+
ji as getInlineContentParseRules,
|
|
10380
|
+
ct as getInlineContentSchemaFromSpecs,
|
|
10381
|
+
Pi as getParseRules,
|
|
10382
|
+
Vi as getStyleParseRules,
|
|
10383
|
+
pt as getStyleSchemaFromSpecs,
|
|
10384
|
+
io as imageBlockConfig,
|
|
10385
|
+
no as imageParse,
|
|
10386
|
+
to as imagePropSchema,
|
|
10387
|
+
oo as imageRender,
|
|
10388
|
+
ro as imageToExternalHTML,
|
|
10389
|
+
at as inheritedProps,
|
|
10390
|
+
ie as initializeESMDependencies,
|
|
10391
|
+
R as inlineContentToNodes,
|
|
10392
|
+
M as insertOrUpdateBlock,
|
|
10393
|
+
Ai as isAppleOS,
|
|
10292
10394
|
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
|
-
|
|
10395
|
+
tt as isPartialLinkInlineContent,
|
|
10396
|
+
Tr as isSafari,
|
|
10397
|
+
te as isStyledTextInlineContent,
|
|
10398
|
+
hn as linkToolbarPluginKey,
|
|
10399
|
+
Sr as locales,
|
|
10400
|
+
an as markdownToBlocks,
|
|
10401
|
+
V as mergeCSSClasses,
|
|
10402
|
+
C as nodeToBlock,
|
|
10403
|
+
xe as nodeToCustomInlineContent,
|
|
10404
|
+
Ge as parseEmbedElement,
|
|
10405
|
+
pe as parseFigureElement,
|
|
10406
|
+
Ke as parseImageElement,
|
|
10407
|
+
Mt as partialBlockToBlockForTesting,
|
|
10408
|
+
Or as partialBlocksToBlocksForTesting,
|
|
10409
|
+
st as propsToAttributes,
|
|
10410
|
+
kn as sideMenuPluginKey,
|
|
10411
|
+
zi as stylePropsToAttributes,
|
|
10412
|
+
it as tableContentToNodes,
|
|
10413
|
+
Q as tableHandlesPluginKey,
|
|
10414
|
+
Ar as uploadToTmpFilesDotOrg_DEV_ONLY,
|
|
10415
|
+
lo as videoBlockConfig,
|
|
10416
|
+
uo as videoParse,
|
|
10417
|
+
so as videoPropSchema,
|
|
10418
|
+
co as videoRender,
|
|
10419
|
+
po as videoToExternalHTML,
|
|
10420
|
+
ge as wrapInBlockStructure
|
|
10319
10421
|
};
|
|
10320
10422
|
//# sourceMappingURL=blocknote.js.map
|