@blocknote/core 0.15.10 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocknote.js +1019 -957
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +6 -6
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +2 -2
- package/src/api/blockManipulation/blockManipulation.test.ts +7 -32
- package/src/api/clipboard/__snapshots__/childToParent.html +1 -0
- package/src/api/clipboard/__snapshots__/childrenToNextParent.html +1 -0
- package/src/api/clipboard/__snapshots__/childrenToNextParentsChildren.html +1 -0
- package/src/api/clipboard/__snapshots__/image.html +1 -0
- package/src/api/clipboard/__snapshots__/multipleStyledText.html +1 -0
- package/src/api/clipboard/__snapshots__/nestedImage.html +1 -0
- package/src/api/clipboard/__snapshots__/partialChildToParent.html +1 -0
- package/src/api/clipboard/__snapshots__/styledText.html +1 -0
- package/src/api/clipboard/__snapshots__/tableAllCells.html +1 -0
- package/src/api/clipboard/__snapshots__/tableCell.html +1 -0
- package/src/api/clipboard/__snapshots__/tableCellText.html +1 -0
- package/src/api/clipboard/__snapshots__/tableRow.html +1 -0
- package/src/api/clipboard/__snapshots__/unstyledText.html +1 -0
- package/src/api/clipboard/clipboard.test.ts +284 -0
- package/src/api/{parsers → clipboard/fromClipboard}/fileDropExtension.ts +2 -2
- package/src/api/{parsers → clipboard/fromClipboard}/handleFileInsertion.ts +4 -4
- package/src/api/{parsers → clipboard/fromClipboard}/pasteExtension.ts +14 -7
- package/src/api/{exporters → clipboard/toClipboard}/copyExtension.ts +70 -43
- package/src/api/exporters/html/externalHTMLExporter.ts +14 -7
- package/src/api/exporters/html/htmlConversion.test.ts +4 -147
- package/src/api/exporters/html/internalHTMLSerializer.ts +5 -2
- package/src/api/parsers/html/parseHTML.test.ts +3 -6
- package/src/api/parsers/markdown/__snapshots__/pasted/complex.json +319 -0
- package/src/api/parsers/markdown/__snapshots__/pasted/issue-226-1.json +81 -0
- package/src/api/parsers/{html/__snapshots__/paste/parse-deep-nested-content.json → markdown/__snapshots__/pasted/issue-226-2.json} +35 -110
- package/src/api/parsers/markdown/__snapshots__/pasted/nested.json +81 -0
- package/src/api/parsers/markdown/__snapshots__/pasted/non-nested.json +81 -0
- package/src/api/parsers/markdown/__snapshots__/pasted/styled.json +61 -0
- package/src/api/parsers/markdown/parseMarkdown.test.ts +15 -0
- package/src/api/testUtil/paste.ts +46 -0
- package/src/blocks/TableBlockContent/TableBlockContent.ts +0 -1
- package/src/editor/BlockNoteEditor.ts +2 -2
- package/src/editor/BlockNoteExtensions.ts +3 -3
- package/src/editor/BlockNoteTipTapEditor.ts +34 -7
- package/src/editor/transformPasted.ts +34 -2
- package/src/extensions/SideMenu/SideMenuPlugin.ts +6 -7
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +26 -0
- package/src/schema/blocks/createSpec.ts +20 -15
- package/types/src/api/clipboard/clipboard.test.d.ts +1 -0
- package/types/src/api/clipboard/fromClipboard/fileDropExtension.d.ts +6 -0
- package/types/src/api/{parsers → clipboard/fromClipboard}/handleFileInsertion.d.ts +2 -2
- package/types/src/api/clipboard/fromClipboard/pasteExtension.d.ts +6 -0
- package/types/src/api/clipboard/toClipboard/copyExtension.d.ts +12 -0
- package/types/src/api/exporters/html/externalHTMLExporter.d.ts +1 -0
- package/types/src/api/testUtil/paste.d.ts +2 -0
- package/types/src/editor/BlockNoteEditor.d.ts +1 -1
- package/types/src/editor/BlockNoteTipTapEditor.d.ts +2 -1
- package/types/src/editor/transformPasted.d.ts +8 -1
- package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +3 -0
- package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionLeavesBlockChildren.html +0 -1
- package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionSpansBlocksChildren.html +0 -1
- package/src/api/parsers/html/__snapshots__/paste/parse-google-docs-html.json +0 -476
- package/types/src/api/exporters/copyExtension.d.ts +0 -6
- package/types/src/api/parsers/fileDropExtension.d.ts +0 -6
- package/types/src/api/parsers/pasteExtension.d.ts +0 -6
- /package/src/api/{exporters/html/__snapshots_fragment_edge_cases__/selectionWithinBlockChildren.html → clipboard/__snapshots__/multipleChildren.html} +0 -0
- /package/src/api/{parsers → clipboard/fromClipboard}/acceptedMIMETypes.ts +0 -0
- /package/src/api/parsers/html/__snapshots__/{paste/list-test.json → list-test.json} +0 -0
- /package/src/api/parsers/html/__snapshots__/{paste/parse-basic-block-types.json → parse-basic-block-types.json} +0 -0
- /package/src/api/parsers/html/__snapshots__/{paste/parse-div-with-inline-content.json → parse-div-with-inline-content.json} +0 -0
- /package/src/api/parsers/html/__snapshots__/{paste/parse-divs.json → parse-divs.json} +0 -0
- /package/src/api/parsers/html/__snapshots__/{paste/parse-fake-image-caption.json → parse-fake-image-caption.json} +0 -0
- /package/src/api/parsers/html/__snapshots__/{paste/parse-image-in-paragraph.json → parse-image-in-paragraph.json} +0 -0
- /package/src/api/parsers/html/__snapshots__/{paste/parse-mixed-nested-lists.json → parse-mixed-nested-lists.json} +0 -0
- /package/src/api/parsers/html/__snapshots__/{paste/parse-nested-lists-with-paragraphs.json → parse-nested-lists-with-paragraphs.json} +0 -0
- /package/src/api/parsers/html/__snapshots__/{paste/parse-nested-lists.json → parse-nested-lists.json} +0 -0
- /package/src/api/parsers/html/__snapshots__/{paste/parse-notion-html.json → parse-notion-html.json} +0 -0
- /package/src/api/parsers/html/__snapshots__/{paste/parse-two-divs.json → parse-two-divs.json} +0 -0
- /package/types/src/api/{parsers → clipboard/fromClipboard}/acceptedMIMETypes.d.ts +0 -0
package/dist/blocknote.js
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var c = (e, t, i) =>
|
|
4
|
-
import { Slice as z, Fragment 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
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
|
|
1
|
+
var Lt = Object.defineProperty;
|
|
2
|
+
var It = (e, t, i) => t in e ? Lt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
|
|
3
|
+
var c = (e, t, i) => It(e, typeof t != "symbol" ? t + "" : t, i);
|
|
4
|
+
import { Slice as z, Fragment as I, DOMSerializer as R, DOMParser as At, Node as Nt } from "prosemirror-model";
|
|
5
|
+
import { Extension as A, combineTransactionSteps as Pt, getChangedRanges as Ht, findChildrenInRange as Ut, Node as X, Mark as Me, InputRule as te, callOrReturn as Dt, getExtensionField as jt, mergeAttributes as zt, selectionToInsertionEnd as Rt, isTextSelection as Vt, isNodeSelection as Ot, posToDOMRect as Ee, getMarkRange as je, findParentNode as Ft, extensions as Y, Editor as Gt, createDocument as Wt, findChildren as ze, getSchema as Kt } from "@tiptap/core";
|
|
6
|
+
import { Plugin as v, PluginKey as B, Selection as ke, NodeSelection as pe, TextSelection as Q, EditorState as $t } from "prosemirror-state";
|
|
7
|
+
import { v4 as qt } from "uuid";
|
|
8
|
+
import Xt from "@tiptap/extension-bold";
|
|
9
|
+
import Zt from "@tiptap/extension-code";
|
|
10
|
+
import Jt from "@tiptap/extension-italic";
|
|
11
|
+
import Yt from "@tiptap/extension-strike";
|
|
12
|
+
import Qt from "@tiptap/extension-underline";
|
|
13
|
+
import { TableCell as ei } from "@tiptap/extension-table-cell";
|
|
14
|
+
import { TableHeader as ti } from "@tiptap/extension-table-header";
|
|
15
|
+
import { TableRow as ii } from "@tiptap/extension-table-row";
|
|
16
|
+
import { columnResizing as oi, tableEditing as ni, CellSelection as ri } from "prosemirror-tables";
|
|
17
|
+
import * as et from "prosemirror-view";
|
|
18
|
+
import { DecorationSet as $, Decoration as q, EditorView as ai } from "prosemirror-view";
|
|
19
|
+
import si from "@tiptap/extension-collaboration";
|
|
20
|
+
import li from "@tiptap/extension-collaboration-cursor";
|
|
21
|
+
import { Dropcursor as di } from "@tiptap/extension-dropcursor";
|
|
22
|
+
import { Gapcursor as ci } from "@tiptap/extension-gapcursor";
|
|
23
|
+
import { HardBreak as ui } from "@tiptap/extension-hard-break";
|
|
24
|
+
import { History as pi } from "@tiptap/extension-history";
|
|
25
|
+
import { Link as hi } from "@tiptap/extension-link";
|
|
26
|
+
import { Text as mi } from "@tiptap/extension-text";
|
|
27
|
+
const fi = {
|
|
27
28
|
slash_menu: {
|
|
28
29
|
heading: {
|
|
29
30
|
title: "عنوان 1",
|
|
@@ -313,7 +314,7 @@ const hi = {
|
|
|
313
314
|
generic: {
|
|
314
315
|
ctrl_shortcut: "Ctrl"
|
|
315
316
|
}
|
|
316
|
-
},
|
|
317
|
+
}, gi = {
|
|
317
318
|
slash_menu: {
|
|
318
319
|
heading: {
|
|
319
320
|
title: "Überschrift 1",
|
|
@@ -618,7 +619,7 @@ const hi = {
|
|
|
618
619
|
generic: {
|
|
619
620
|
ctrl_shortcut: "Strg"
|
|
620
621
|
}
|
|
621
|
-
},
|
|
622
|
+
}, tt = {
|
|
622
623
|
slash_menu: {
|
|
623
624
|
heading: {
|
|
624
625
|
title: "Heading 1",
|
|
@@ -924,7 +925,7 @@ const hi = {
|
|
|
924
925
|
generic: {
|
|
925
926
|
ctrl_shortcut: "Ctrl"
|
|
926
927
|
}
|
|
927
|
-
},
|
|
928
|
+
}, bi = {
|
|
928
929
|
slash_menu: {
|
|
929
930
|
heading: {
|
|
930
931
|
title: "Encabezado 1",
|
|
@@ -1197,7 +1198,7 @@ const hi = {
|
|
|
1197
1198
|
generic: {
|
|
1198
1199
|
ctrl_shortcut: "Ctrl"
|
|
1199
1200
|
}
|
|
1200
|
-
},
|
|
1201
|
+
}, _i = {
|
|
1201
1202
|
slash_menu: {
|
|
1202
1203
|
heading: {
|
|
1203
1204
|
title: "Titre 1",
|
|
@@ -1502,7 +1503,7 @@ const hi = {
|
|
|
1502
1503
|
generic: {
|
|
1503
1504
|
ctrl_shortcut: "Ctrl"
|
|
1504
1505
|
}
|
|
1505
|
-
},
|
|
1506
|
+
}, ki = {
|
|
1506
1507
|
slash_menu: {
|
|
1507
1508
|
heading: {
|
|
1508
1509
|
title: "Fyrirsögn 1",
|
|
@@ -1799,7 +1800,7 @@ const hi = {
|
|
|
1799
1800
|
generic: {
|
|
1800
1801
|
ctrl_shortcut: "Ctrl"
|
|
1801
1802
|
}
|
|
1802
|
-
},
|
|
1803
|
+
}, yi = {
|
|
1803
1804
|
slash_menu: {
|
|
1804
1805
|
heading: {
|
|
1805
1806
|
title: "見出し1",
|
|
@@ -2124,7 +2125,7 @@ const hi = {
|
|
|
2124
2125
|
generic: {
|
|
2125
2126
|
ctrl_shortcut: "Ctrl"
|
|
2126
2127
|
}
|
|
2127
|
-
},
|
|
2128
|
+
}, wi = {
|
|
2128
2129
|
slash_menu: {
|
|
2129
2130
|
heading: {
|
|
2130
2131
|
title: "제목1",
|
|
@@ -2442,7 +2443,7 @@ const hi = {
|
|
|
2442
2443
|
generic: {
|
|
2443
2444
|
ctrl_shortcut: "Ctrl"
|
|
2444
2445
|
}
|
|
2445
|
-
},
|
|
2446
|
+
}, vi = {
|
|
2446
2447
|
slash_menu: {
|
|
2447
2448
|
heading: {
|
|
2448
2449
|
title: "Kop 1",
|
|
@@ -2747,7 +2748,7 @@ const hi = {
|
|
|
2747
2748
|
generic: {
|
|
2748
2749
|
ctrl_shortcut: "Ctrl"
|
|
2749
2750
|
}
|
|
2750
|
-
},
|
|
2751
|
+
}, xi = {
|
|
2751
2752
|
slash_menu: {
|
|
2752
2753
|
heading: {
|
|
2753
2754
|
title: "Nagłówek 1",
|
|
@@ -3036,7 +3037,7 @@ const hi = {
|
|
|
3036
3037
|
generic: {
|
|
3037
3038
|
ctrl_shortcut: "Ctrl"
|
|
3038
3039
|
}
|
|
3039
|
-
},
|
|
3040
|
+
}, Ei = {
|
|
3040
3041
|
slash_menu: {
|
|
3041
3042
|
heading: {
|
|
3042
3043
|
title: "Título",
|
|
@@ -3333,7 +3334,7 @@ const hi = {
|
|
|
3333
3334
|
generic: {
|
|
3334
3335
|
ctrl_shortcut: "Ctrl"
|
|
3335
3336
|
}
|
|
3336
|
-
},
|
|
3337
|
+
}, Ci = {
|
|
3337
3338
|
slash_menu: {
|
|
3338
3339
|
heading: {
|
|
3339
3340
|
title: "Заголовок 1 уровня",
|
|
@@ -3665,7 +3666,7 @@ const hi = {
|
|
|
3665
3666
|
generic: {
|
|
3666
3667
|
ctrl_shortcut: "Ctrl"
|
|
3667
3668
|
}
|
|
3668
|
-
},
|
|
3669
|
+
}, Si = {
|
|
3669
3670
|
slash_menu: {
|
|
3670
3671
|
heading: {
|
|
3671
3672
|
title: "Tiêu đề H1",
|
|
@@ -3969,7 +3970,7 @@ const hi = {
|
|
|
3969
3970
|
generic: {
|
|
3970
3971
|
ctrl_shortcut: "Ctrl"
|
|
3971
3972
|
}
|
|
3972
|
-
},
|
|
3973
|
+
}, Mi = {
|
|
3973
3974
|
slash_menu: {
|
|
3974
3975
|
heading: {
|
|
3975
3976
|
title: "一级标题",
|
|
@@ -4307,25 +4308,25 @@ const hi = {
|
|
|
4307
4308
|
generic: {
|
|
4308
4309
|
ctrl_shortcut: "Ctrl"
|
|
4309
4310
|
}
|
|
4310
|
-
},
|
|
4311
|
+
}, Ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4311
4312
|
__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:
|
|
4313
|
+
ar: fi,
|
|
4314
|
+
de: gi,
|
|
4315
|
+
en: tt,
|
|
4316
|
+
es: bi,
|
|
4317
|
+
fr: _i,
|
|
4318
|
+
is: ki,
|
|
4319
|
+
ja: yi,
|
|
4320
|
+
ko: wi,
|
|
4321
|
+
nl: vi,
|
|
4322
|
+
pl: xi,
|
|
4323
|
+
pt: Ei,
|
|
4324
|
+
ru: Ci,
|
|
4325
|
+
vi: Si,
|
|
4326
|
+
zh: Mi
|
|
4326
4327
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4327
4328
|
let H;
|
|
4328
|
-
async function
|
|
4329
|
+
async function oe() {
|
|
4329
4330
|
if (H)
|
|
4330
4331
|
return H;
|
|
4331
4332
|
const e = await Promise.all([
|
|
@@ -4353,20 +4354,20 @@ async function ie() {
|
|
|
4353
4354
|
rehypeFormat: e[9]
|
|
4354
4355
|
}, H;
|
|
4355
4356
|
}
|
|
4356
|
-
function
|
|
4357
|
+
function Ti(e, t = JSON.stringify) {
|
|
4357
4358
|
const i = {};
|
|
4358
4359
|
return e.filter((o) => {
|
|
4359
4360
|
const n = t(o);
|
|
4360
4361
|
return Object.prototype.hasOwnProperty.call(i, n) ? !1 : i[n] = !0;
|
|
4361
4362
|
});
|
|
4362
4363
|
}
|
|
4363
|
-
function
|
|
4364
|
+
function Bi(e) {
|
|
4364
4365
|
const t = e.filter(
|
|
4365
4366
|
(o, n) => e.indexOf(o) !== n
|
|
4366
4367
|
);
|
|
4367
|
-
return
|
|
4368
|
+
return Ti(t);
|
|
4368
4369
|
}
|
|
4369
|
-
const
|
|
4370
|
+
const ne = A.create({
|
|
4370
4371
|
name: "uniqueID",
|
|
4371
4372
|
// we’ll set a very high priority to make sure this runs first
|
|
4372
4373
|
// and is compatible with `appendTransaction` hooks of other extensions
|
|
@@ -4381,7 +4382,7 @@ const oe = I.create({
|
|
|
4381
4382
|
const e = window.__TEST_OPTIONS;
|
|
4382
4383
|
return e.mockID === void 0 ? e.mockID = 0 : e.mockID++, e.mockID.toString();
|
|
4383
4384
|
}
|
|
4384
|
-
return
|
|
4385
|
+
return qt();
|
|
4385
4386
|
},
|
|
4386
4387
|
filterTransaction: null
|
|
4387
4388
|
};
|
|
@@ -4441,50 +4442,50 @@ const oe = I.create({
|
|
|
4441
4442
|
addProseMirrorPlugins() {
|
|
4442
4443
|
let e = null, t = !1;
|
|
4443
4444
|
return [
|
|
4444
|
-
new
|
|
4445
|
-
key: new
|
|
4445
|
+
new v({
|
|
4446
|
+
key: new B("uniqueID"),
|
|
4446
4447
|
appendTransaction: (i, o, n) => {
|
|
4447
4448
|
const r = i.some((f) => f.docChanged) && !o.doc.eq(n.doc), a = this.options.filterTransaction && i.some((f) => {
|
|
4448
|
-
let g,
|
|
4449
|
-
return !(!((
|
|
4449
|
+
let g, _;
|
|
4450
|
+
return !(!((_ = (g = this.options).filterTransaction) === null || _ === void 0) && _.call(g, f));
|
|
4450
4451
|
});
|
|
4451
4452
|
if (!r || a)
|
|
4452
4453
|
return;
|
|
4453
|
-
const { tr: s } = n, { types: l, attributeName: d, generateID: u } = this.options, p =
|
|
4454
|
+
const { tr: s } = n, { types: l, attributeName: d, generateID: u } = this.options, p = Pt(
|
|
4454
4455
|
o.doc,
|
|
4455
4456
|
i
|
|
4456
4457
|
), { mapping: h } = p;
|
|
4457
|
-
if (
|
|
4458
|
-
const g =
|
|
4458
|
+
if (Ht(p).forEach(({ newRange: f }) => {
|
|
4459
|
+
const g = Ut(
|
|
4459
4460
|
n.doc,
|
|
4460
4461
|
f,
|
|
4461
4462
|
(b) => l.includes(b.type.name)
|
|
4462
|
-
),
|
|
4463
|
-
g.forEach(({ node: b, pos:
|
|
4464
|
-
let
|
|
4465
|
-
const
|
|
4466
|
-
if (
|
|
4467
|
-
const
|
|
4468
|
-
if (o.doc.content.findDiffStart(
|
|
4469
|
-
const
|
|
4463
|
+
), _ = g.map(({ node: b }) => b.attrs[d]).filter((b) => b !== null), x = Bi(_);
|
|
4464
|
+
g.forEach(({ node: b, pos: w }) => {
|
|
4465
|
+
let L;
|
|
4466
|
+
const He = (L = s.doc.nodeAt(w)) === null || L === void 0 ? void 0 : L.attrs[d];
|
|
4467
|
+
if (He === null) {
|
|
4468
|
+
const Ue = o.doc.type.createAndFill().content;
|
|
4469
|
+
if (o.doc.content.findDiffStart(Ue) === null) {
|
|
4470
|
+
const De = JSON.parse(
|
|
4470
4471
|
JSON.stringify(n.doc.toJSON())
|
|
4471
4472
|
);
|
|
4472
|
-
if (
|
|
4473
|
-
s.setNodeMarkup(
|
|
4473
|
+
if (De.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(De.content) === JSON.stringify(Ue.toJSON())) {
|
|
4474
|
+
s.setNodeMarkup(w, void 0, {
|
|
4474
4475
|
...b.attrs,
|
|
4475
4476
|
[d]: "initialBlockId"
|
|
4476
4477
|
});
|
|
4477
4478
|
return;
|
|
4478
4479
|
}
|
|
4479
4480
|
}
|
|
4480
|
-
s.setNodeMarkup(
|
|
4481
|
+
s.setNodeMarkup(w, void 0, {
|
|
4481
4482
|
...b.attrs,
|
|
4482
4483
|
[d]: u()
|
|
4483
4484
|
});
|
|
4484
4485
|
return;
|
|
4485
4486
|
}
|
|
4486
|
-
const { deleted:
|
|
4487
|
-
|
|
4487
|
+
const { deleted: Bt } = h.invert().mapResult(w);
|
|
4488
|
+
Bt && x.includes(He) && s.setNodeMarkup(w, void 0, {
|
|
4488
4489
|
...b.attrs,
|
|
4489
4490
|
[d]: u()
|
|
4490
4491
|
});
|
|
@@ -4542,7 +4543,7 @@ const oe = I.create({
|
|
|
4542
4543
|
l.marks
|
|
4543
4544
|
);
|
|
4544
4545
|
s.push(d);
|
|
4545
|
-
}),
|
|
4546
|
+
}), I.from(s);
|
|
4546
4547
|
};
|
|
4547
4548
|
return t = !1, new z(
|
|
4548
4549
|
r(i.content),
|
|
@@ -4555,7 +4556,7 @@ const oe = I.create({
|
|
|
4555
4556
|
];
|
|
4556
4557
|
}
|
|
4557
4558
|
});
|
|
4558
|
-
function
|
|
4559
|
+
function it(e) {
|
|
4559
4560
|
const t = e.attrs.id, i = e.firstChild, o = i.type, n = e.childCount === 2 ? e.lastChild.childCount : 0;
|
|
4560
4561
|
return {
|
|
4561
4562
|
id: t,
|
|
@@ -4565,7 +4566,7 @@ function et(e) {
|
|
|
4565
4566
|
numChildBlocks: n
|
|
4566
4567
|
};
|
|
4567
4568
|
}
|
|
4568
|
-
function
|
|
4569
|
+
function k(e, t) {
|
|
4569
4570
|
const o = e.nodeSize - 2;
|
|
4570
4571
|
if (t <= 1)
|
|
4571
4572
|
for (t = 2; e.resolve(t).parent.type.name !== "blockContainer" && t < o; )
|
|
@@ -4585,7 +4586,7 @@ function _(e, t) {
|
|
|
4585
4586
|
break;
|
|
4586
4587
|
s -= 1, a = n.node(s);
|
|
4587
4588
|
}
|
|
4588
|
-
const { id: l, contentNode: d, contentType: u, numChildBlocks: p } =
|
|
4589
|
+
const { id: l, contentNode: d, contentType: u, numChildBlocks: p } = it(a), h = n.start(s), m = n.end(s);
|
|
4589
4590
|
return {
|
|
4590
4591
|
id: l,
|
|
4591
4592
|
node: a,
|
|
@@ -4597,13 +4598,13 @@ function _(e, t) {
|
|
|
4597
4598
|
depth: s
|
|
4598
4599
|
};
|
|
4599
4600
|
}
|
|
4600
|
-
function
|
|
4601
|
+
function Re(e) {
|
|
4601
4602
|
return e.type === "link";
|
|
4602
4603
|
}
|
|
4603
|
-
function
|
|
4604
|
+
function ot(e) {
|
|
4604
4605
|
return typeof e != "string" && e.type === "link";
|
|
4605
4606
|
}
|
|
4606
|
-
function
|
|
4607
|
+
function ie(e) {
|
|
4607
4608
|
return typeof e != "string" && e.type === "text";
|
|
4608
4609
|
}
|
|
4609
4610
|
class P extends Error {
|
|
@@ -4611,7 +4612,7 @@ class P extends Error {
|
|
|
4611
4612
|
super(`Unreachable case: ${t}`);
|
|
4612
4613
|
}
|
|
4613
4614
|
}
|
|
4614
|
-
function
|
|
4615
|
+
function Ar(e, t = !0) {
|
|
4615
4616
|
const { "data-test": i, ...o } = e;
|
|
4616
4617
|
if (Object.keys(o).length > 0 && t)
|
|
4617
4618
|
throw new Error("Object must be empty " + JSON.stringify(e));
|
|
@@ -4632,11 +4633,11 @@ function Ve(e, t, i) {
|
|
|
4632
4633
|
return e.text.split(/(\n)/g).filter((n) => n.length > 0).map((n) => n === `
|
|
4633
4634
|
` ? t.nodes.hardBreak.create() : t.text(n, o));
|
|
4634
4635
|
}
|
|
4635
|
-
function
|
|
4636
|
+
function Li(e, t, i) {
|
|
4636
4637
|
const o = t.marks.link.create({
|
|
4637
4638
|
href: e.href
|
|
4638
4639
|
});
|
|
4639
|
-
return
|
|
4640
|
+
return Ce(e.content, t, i).map(
|
|
4640
4641
|
(n) => {
|
|
4641
4642
|
if (n.type.name === "text")
|
|
4642
4643
|
return n.mark([...n.marks, o]);
|
|
@@ -4646,7 +4647,7 @@ function Ti(e, t, i) {
|
|
|
4646
4647
|
}
|
|
4647
4648
|
);
|
|
4648
4649
|
}
|
|
4649
|
-
function
|
|
4650
|
+
function Ce(e, t, i) {
|
|
4650
4651
|
const o = [];
|
|
4651
4652
|
if (typeof e == "string")
|
|
4652
4653
|
return o.push(
|
|
@@ -4663,12 +4664,12 @@ function ve(e, t, i) {
|
|
|
4663
4664
|
function V(e, t, i) {
|
|
4664
4665
|
const o = [];
|
|
4665
4666
|
for (const n of e)
|
|
4666
|
-
typeof n == "string" ? o.push(...
|
|
4667
|
-
|
|
4667
|
+
typeof n == "string" ? o.push(...Ce(n, t, i)) : ot(n) ? o.push(...Li(n, t, i)) : ie(n) ? o.push(...Ce([n], t, i)) : o.push(
|
|
4668
|
+
rt(n, t, i)
|
|
4668
4669
|
);
|
|
4669
4670
|
return o;
|
|
4670
4671
|
}
|
|
4671
|
-
function
|
|
4672
|
+
function nt(e, t, i) {
|
|
4672
4673
|
const o = [];
|
|
4673
4674
|
for (const n of e.rows) {
|
|
4674
4675
|
const r = [];
|
|
@@ -4690,7 +4691,7 @@ function it(e, t, i) {
|
|
|
4690
4691
|
}
|
|
4691
4692
|
return o;
|
|
4692
4693
|
}
|
|
4693
|
-
function
|
|
4694
|
+
function rt(e, t, i) {
|
|
4694
4695
|
let o, n = e.type;
|
|
4695
4696
|
if (n === void 0 && (n = "paragraph"), !t.nodes[n])
|
|
4696
4697
|
throw new Error(`node type ${n} not found in schema`);
|
|
@@ -4703,7 +4704,7 @@ function ot(e, t, i) {
|
|
|
4703
4704
|
const r = V(e.content, t, i);
|
|
4704
4705
|
o = t.nodes[n].create(e.props, r);
|
|
4705
4706
|
} else if (e.content.type === "tableContent") {
|
|
4706
|
-
const r =
|
|
4707
|
+
const r = nt(e.content, t, i);
|
|
4707
4708
|
o = t.nodes[n].create(e.props, r);
|
|
4708
4709
|
} else
|
|
4709
4710
|
throw new P(e.content.type);
|
|
@@ -4711,8 +4712,8 @@ function ot(e, t, i) {
|
|
|
4711
4712
|
}
|
|
4712
4713
|
function U(e, t, i) {
|
|
4713
4714
|
let o = e.id;
|
|
4714
|
-
o === void 0 && (o =
|
|
4715
|
-
const n =
|
|
4715
|
+
o === void 0 && (o = ne.options.generateID());
|
|
4716
|
+
const n = rt(
|
|
4716
4717
|
e,
|
|
4717
4718
|
t,
|
|
4718
4719
|
i
|
|
@@ -4729,7 +4730,7 @@ function U(e, t, i) {
|
|
|
4729
4730
|
r.length > 0 ? [n, a] : n
|
|
4730
4731
|
);
|
|
4731
4732
|
}
|
|
4732
|
-
function
|
|
4733
|
+
function Ii(e, t, i) {
|
|
4733
4734
|
const o = {
|
|
4734
4735
|
type: "tableContent",
|
|
4735
4736
|
rows: []
|
|
@@ -4740,7 +4741,7 @@ function Bi(e, t, i) {
|
|
|
4740
4741
|
};
|
|
4741
4742
|
n.content.forEach((a) => {
|
|
4742
4743
|
r.cells.push(
|
|
4743
|
-
|
|
4744
|
+
Te(
|
|
4744
4745
|
a.firstChild,
|
|
4745
4746
|
t,
|
|
4746
4747
|
i
|
|
@@ -4749,16 +4750,16 @@ function Bi(e, t, i) {
|
|
|
4749
4750
|
}), o.rows.push(r);
|
|
4750
4751
|
}), o;
|
|
4751
4752
|
}
|
|
4752
|
-
function
|
|
4753
|
+
function Te(e, t, i) {
|
|
4753
4754
|
const o = [];
|
|
4754
4755
|
let n;
|
|
4755
4756
|
return e.content.forEach((r) => {
|
|
4756
4757
|
if (r.type.name === "hardBreak") {
|
|
4757
4758
|
if (n)
|
|
4758
|
-
if (
|
|
4759
|
+
if (ie(n))
|
|
4759
4760
|
n.text += `
|
|
4760
4761
|
`;
|
|
4761
|
-
else if (
|
|
4762
|
+
else if (Re(n))
|
|
4762
4763
|
n.content[n.content.length - 1].text += `
|
|
4763
4764
|
`;
|
|
4764
4765
|
else
|
|
@@ -4774,7 +4775,7 @@ function Se(e, t, i) {
|
|
|
4774
4775
|
}
|
|
4775
4776
|
if (r.type.name !== "link" && r.type.name !== "text" && t[r.type.name]) {
|
|
4776
4777
|
n && (o.push(n), n = void 0), o.push(
|
|
4777
|
-
|
|
4778
|
+
Se(r, t, i)
|
|
4778
4779
|
);
|
|
4779
4780
|
return;
|
|
4780
4781
|
}
|
|
@@ -4794,7 +4795,7 @@ function Se(e, t, i) {
|
|
|
4794
4795
|
else
|
|
4795
4796
|
throw new P(d.propSchema);
|
|
4796
4797
|
}
|
|
4797
|
-
n ?
|
|
4798
|
+
n ? ie(n) ? s ? (o.push(n), n = {
|
|
4798
4799
|
type: "link",
|
|
4799
4800
|
href: s.attrs.href,
|
|
4800
4801
|
content: [
|
|
@@ -4808,7 +4809,7 @@ function Se(e, t, i) {
|
|
|
4808
4809
|
type: "text",
|
|
4809
4810
|
text: r.textContent,
|
|
4810
4811
|
styles: a
|
|
4811
|
-
}) :
|
|
4812
|
+
}) : Re(n) && (s ? n.href === s.attrs.href ? JSON.stringify(
|
|
4812
4813
|
n.content[n.content.length - 1].styles
|
|
4813
4814
|
) === JSON.stringify(a) ? n.content[n.content.length - 1].text += r.textContent : n.content.push({
|
|
4814
4815
|
type: "text",
|
|
@@ -4845,7 +4846,7 @@ function Se(e, t, i) {
|
|
|
4845
4846
|
};
|
|
4846
4847
|
}), n && o.push(n), o;
|
|
4847
4848
|
}
|
|
4848
|
-
function
|
|
4849
|
+
function Se(e, t, i) {
|
|
4849
4850
|
if (e.type.name === "text" || e.type.name === "link")
|
|
4850
4851
|
throw new Error("unexpected");
|
|
4851
4852
|
const o = {}, n = t[e.type.name];
|
|
@@ -4856,7 +4857,7 @@ function xe(e, t, i) {
|
|
|
4856
4857
|
s in d && (o[s] = l);
|
|
4857
4858
|
}
|
|
4858
4859
|
let r;
|
|
4859
|
-
return n.content === "styled" ? r =
|
|
4860
|
+
return n.content === "styled" ? r = Te(
|
|
4860
4861
|
e,
|
|
4861
4862
|
t,
|
|
4862
4863
|
i
|
|
@@ -4874,9 +4875,9 @@ function C(e, t, i, o, n) {
|
|
|
4874
4875
|
const r = n == null ? void 0 : n.get(e);
|
|
4875
4876
|
if (r)
|
|
4876
4877
|
return r;
|
|
4877
|
-
const a =
|
|
4878
|
+
const a = it(e);
|
|
4878
4879
|
let s = a.id;
|
|
4879
|
-
s === null && (s =
|
|
4880
|
+
s === null && (s = ne.options.generateID());
|
|
4880
4881
|
const l = {};
|
|
4881
4882
|
for (const [m, f] of Object.entries({
|
|
4882
4883
|
...e.attrs,
|
|
@@ -4887,8 +4888,8 @@ function C(e, t, i, o, n) {
|
|
|
4887
4888
|
throw Error(
|
|
4888
4889
|
"Block is of an unrecognized type: " + a.contentType.name
|
|
4889
4890
|
);
|
|
4890
|
-
const
|
|
4891
|
-
m in
|
|
4891
|
+
const _ = g.propSchema;
|
|
4892
|
+
m in _ && (l[m] = f);
|
|
4892
4893
|
}
|
|
4893
4894
|
const d = t[a.contentType.name], u = [];
|
|
4894
4895
|
for (let m = 0; m < a.numChildBlocks; m++)
|
|
@@ -4903,13 +4904,13 @@ function C(e, t, i, o, n) {
|
|
|
4903
4904
|
);
|
|
4904
4905
|
let p;
|
|
4905
4906
|
if (d.content === "inline")
|
|
4906
|
-
p =
|
|
4907
|
+
p = Te(
|
|
4907
4908
|
a.contentNode,
|
|
4908
4909
|
i,
|
|
4909
4910
|
o
|
|
4910
4911
|
);
|
|
4911
4912
|
else if (d.content === "table")
|
|
4912
|
-
p =
|
|
4913
|
+
p = Ii(
|
|
4913
4914
|
a.contentNode,
|
|
4914
4915
|
i,
|
|
4915
4916
|
o
|
|
@@ -4927,14 +4928,14 @@ function C(e, t, i, o, n) {
|
|
|
4927
4928
|
};
|
|
4928
4929
|
return n == null || n.set(e, h), h;
|
|
4929
4930
|
}
|
|
4930
|
-
function
|
|
4931
|
+
function Ai(e) {
|
|
4931
4932
|
return e.document || window.document;
|
|
4932
4933
|
}
|
|
4933
|
-
const
|
|
4934
|
+
const at = (e, t, i, o, n) => {
|
|
4934
4935
|
if (!i.nodes[e.type.name])
|
|
4935
4936
|
throw new Error("Serializer is missing a node type: " + e.type.name);
|
|
4936
|
-
const { dom: r, contentDOM: a } =
|
|
4937
|
-
|
|
4937
|
+
const { dom: r, contentDOM: a } = R.renderSpec(
|
|
4938
|
+
Ai(t),
|
|
4938
4939
|
i.nodes[e.type.name](e)
|
|
4939
4940
|
);
|
|
4940
4941
|
if (a) {
|
|
@@ -4965,7 +4966,7 @@ const nt = (e, t, i, o, n) => {
|
|
|
4965
4966
|
a.appendChild(p.dom);
|
|
4966
4967
|
}
|
|
4967
4968
|
l !== void 0 && i.serializeFragment(
|
|
4968
|
-
|
|
4969
|
+
I.from(l),
|
|
4969
4970
|
t,
|
|
4970
4971
|
a
|
|
4971
4972
|
);
|
|
@@ -4973,11 +4974,11 @@ const nt = (e, t, i, o, n) => {
|
|
|
4973
4974
|
i.serializeFragment(e.content, t, a);
|
|
4974
4975
|
}
|
|
4975
4976
|
return r;
|
|
4976
|
-
},
|
|
4977
|
+
}, st = (e, t, i) => {
|
|
4977
4978
|
const o = t.serializeFragment(e, i), n = document.createElement("div");
|
|
4978
4979
|
return n.appendChild(o), n.innerHTML;
|
|
4979
4980
|
};
|
|
4980
|
-
function
|
|
4981
|
+
function Oe(e, t) {
|
|
4981
4982
|
var o;
|
|
4982
4983
|
const i = (((o = e.properties) == null ? void 0 : o.className) || []).filter(
|
|
4983
4984
|
(n) => !n.startsWith("bn-")
|
|
@@ -4988,7 +4989,7 @@ function Re(e, t) {
|
|
|
4988
4989
|
className: i.length > 0 ? i : void 0
|
|
4989
4990
|
};
|
|
4990
4991
|
}
|
|
4991
|
-
function
|
|
4992
|
+
function Ni(e) {
|
|
4992
4993
|
const t = H;
|
|
4993
4994
|
if (!t)
|
|
4994
4995
|
throw new Error(
|
|
@@ -5006,11 +5007,11 @@ function Ii(e) {
|
|
|
5006
5007
|
let r = n.children.length, a;
|
|
5007
5008
|
for (let l = 0; l < r; l++) {
|
|
5008
5009
|
const u = n.children[l].children[0], p = u.children.find((b) => {
|
|
5009
|
-
const
|
|
5010
|
-
return
|
|
5010
|
+
const w = b.properties, L = w == null ? void 0 : w.className;
|
|
5011
|
+
return L == null ? void 0 : L.includes("bn-block-content");
|
|
5011
5012
|
}), h = u.children.find((b) => {
|
|
5012
|
-
const
|
|
5013
|
-
return
|
|
5013
|
+
const w = b.properties, L = w == null ? void 0 : w.className;
|
|
5014
|
+
return L == null ? void 0 : L.includes("bn-block-group");
|
|
5014
5015
|
}), m = Object.fromEntries(
|
|
5015
5016
|
Object.entries(u.properties || {}).filter(
|
|
5016
5017
|
([b]) => b.startsWith("data") && b !== "dataId" && b !== "dataNodeType"
|
|
@@ -5027,12 +5028,12 @@ function Ii(e) {
|
|
|
5027
5028
|
n.children.splice(l, 1, ...h.children), o(n);
|
|
5028
5029
|
return;
|
|
5029
5030
|
}
|
|
5030
|
-
const
|
|
5031
|
+
const _ = i.has(
|
|
5031
5032
|
p.properties.dataContentType
|
|
5032
|
-
),
|
|
5033
|
+
), x = _ ? e.orderedListItemBlockTypes.has(
|
|
5033
5034
|
p.properties.dataContentType
|
|
5034
5035
|
) ? "ol" : "ul" : null;
|
|
5035
|
-
if (h && o(h), a && a.tagName !==
|
|
5036
|
+
if (h && o(h), a && a.tagName !== x) {
|
|
5036
5037
|
n.children.splice(
|
|
5037
5038
|
l - a.children.length,
|
|
5038
5039
|
a.children.length,
|
|
@@ -5041,9 +5042,9 @@ function Ii(e) {
|
|
|
5041
5042
|
const b = a.children.length - 1;
|
|
5042
5043
|
l -= b, r -= b, a = void 0;
|
|
5043
5044
|
}
|
|
5044
|
-
if (
|
|
5045
|
+
if (_) {
|
|
5045
5046
|
a || (a = t.hastUtilFromDom.fromDom(
|
|
5046
|
-
document.createElement(
|
|
5047
|
+
document.createElement(x)
|
|
5047
5048
|
));
|
|
5048
5049
|
const b = t.hastUtilFromDom.fromDom(
|
|
5049
5050
|
document.createElement("li")
|
|
@@ -5052,12 +5053,12 @@ function Ii(e) {
|
|
|
5052
5053
|
} else if (h) {
|
|
5053
5054
|
n.children.splice(l + 1, 0, ...h.children);
|
|
5054
5055
|
const b = p.children[0];
|
|
5055
|
-
|
|
5056
|
-
const
|
|
5057
|
-
l +=
|
|
5056
|
+
Oe(b, g), n.children[l] = b;
|
|
5057
|
+
const w = h.children.length;
|
|
5058
|
+
l += w, r += w;
|
|
5058
5059
|
} else {
|
|
5059
5060
|
const b = p.children[0];
|
|
5060
|
-
|
|
5061
|
+
Oe(b, g), n.children[l] = b;
|
|
5061
5062
|
}
|
|
5062
5063
|
}
|
|
5063
5064
|
a && n.children.splice(
|
|
@@ -5068,63 +5069,72 @@ function Ii(e) {
|
|
|
5068
5069
|
};
|
|
5069
5070
|
return o;
|
|
5070
5071
|
}
|
|
5071
|
-
const
|
|
5072
|
+
const he = (e, t) => {
|
|
5072
5073
|
const i = H;
|
|
5073
5074
|
if (!i)
|
|
5074
5075
|
throw new Error(
|
|
5075
5076
|
"External HTML exporter requires ESM dependencies to be initialized"
|
|
5076
5077
|
);
|
|
5077
|
-
const o =
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5078
|
+
const o = new R(
|
|
5079
|
+
R.nodesFromSchema(e),
|
|
5080
|
+
R.marksFromSchema(e)
|
|
5081
|
+
);
|
|
5082
|
+
return o.serializeNodeInner = (n, r) => at(n, r, o, t, !0), o.exportProseMirrorFragment = (n, r) => {
|
|
5083
|
+
let a = i.unified.unified().use(i.rehypeParse.default, { fragment: !0 });
|
|
5084
|
+
return r.simplifyBlocks !== !1 && (a = a.use(Ni, {
|
|
5085
|
+
orderedListItemBlockTypes: /* @__PURE__ */ new Set(["numberedListItem"]),
|
|
5086
|
+
unorderedListItemBlockTypes: /* @__PURE__ */ new Set([
|
|
5087
|
+
"bulletListItem",
|
|
5088
|
+
"checkListItem"
|
|
5089
|
+
])
|
|
5090
|
+
})), a = a.use(i.rehypeStringify.default).processSync(st(n, o, r)), a.value;
|
|
5091
|
+
}, o.exportBlocks = (n, r) => {
|
|
5085
5092
|
const a = n.map(
|
|
5086
5093
|
(l) => U(l, e, t.schema.styleSchema)
|
|
5087
5094
|
), s = e.nodes.blockGroup.create(null, a);
|
|
5088
5095
|
return o.exportProseMirrorFragment(
|
|
5089
|
-
|
|
5096
|
+
I.from(s),
|
|
5090
5097
|
r
|
|
5091
5098
|
);
|
|
5092
5099
|
}, o;
|
|
5093
|
-
},
|
|
5094
|
-
const i =
|
|
5095
|
-
|
|
5100
|
+
}, Pi = (e, t) => {
|
|
5101
|
+
const i = new R(
|
|
5102
|
+
R.nodesFromSchema(e),
|
|
5103
|
+
R.marksFromSchema(e)
|
|
5104
|
+
);
|
|
5105
|
+
return i.serializeNodeInner = (o, n) => at(o, n, i, t, !1), i.serializeProseMirrorFragment = (o, n) => st(o, i, n), i.serializeBlocks = (o, n) => {
|
|
5096
5106
|
const r = o.map(
|
|
5097
5107
|
(s) => U(s, e, t.schema.styleSchema)
|
|
5098
5108
|
), a = e.nodes.blockGroup.create(null, r);
|
|
5099
5109
|
return i.serializeProseMirrorFragment(
|
|
5100
|
-
|
|
5110
|
+
I.from(a),
|
|
5101
5111
|
n
|
|
5102
5112
|
);
|
|
5103
5113
|
}, i;
|
|
5104
|
-
},
|
|
5105
|
-
const { contentType: t } =
|
|
5114
|
+
}, T = (e) => {
|
|
5115
|
+
const { contentType: t } = k(
|
|
5106
5116
|
e.state.doc,
|
|
5107
5117
|
e.state.selection.from
|
|
5108
5118
|
);
|
|
5109
5119
|
return t.spec.content;
|
|
5110
|
-
},
|
|
5120
|
+
}, Hi = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
|
|
5111
5121
|
function D(e, t = "Ctrl") {
|
|
5112
|
-
return
|
|
5122
|
+
return Hi() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
|
|
5113
5123
|
}
|
|
5114
|
-
function
|
|
5124
|
+
function O(...e) {
|
|
5115
5125
|
return e.filter((t) => t).join(" ");
|
|
5116
5126
|
}
|
|
5117
|
-
const
|
|
5118
|
-
function
|
|
5127
|
+
const Nr = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
5128
|
+
function F(e, t, i, o) {
|
|
5119
5129
|
const n = document.createElement("div");
|
|
5120
|
-
n.className =
|
|
5130
|
+
n.className = O(
|
|
5121
5131
|
"bn-block-content",
|
|
5122
5132
|
i.class
|
|
5123
5133
|
), n.setAttribute("data-content-type", e);
|
|
5124
5134
|
for (const [a, s] of Object.entries(i))
|
|
5125
5135
|
a !== "class" && n.setAttribute(a, s);
|
|
5126
5136
|
const r = document.createElement(t);
|
|
5127
|
-
r.className =
|
|
5137
|
+
r.className = O(
|
|
5128
5138
|
"bn-inline-content",
|
|
5129
5139
|
o.class
|
|
5130
5140
|
);
|
|
@@ -5137,7 +5147,7 @@ function O(e, t, i, o) {
|
|
|
5137
5147
|
contentDOM: r
|
|
5138
5148
|
};
|
|
5139
5149
|
}
|
|
5140
|
-
const
|
|
5150
|
+
const Fe = (e, t) => {
|
|
5141
5151
|
const i = U(e, t.pmSchema, t.schema.styleSchema).firstChild, o = t.pmSchema.nodes[i.type.name].spec.toDOM;
|
|
5142
5152
|
if (o === void 0)
|
|
5143
5153
|
throw new Error(
|
|
@@ -5149,7 +5159,7 @@ const Oe = (e, t) => {
|
|
|
5149
5159
|
"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."
|
|
5150
5160
|
);
|
|
5151
5161
|
return n;
|
|
5152
|
-
},
|
|
5162
|
+
}, y = {
|
|
5153
5163
|
backgroundColor: {
|
|
5154
5164
|
default: "default"
|
|
5155
5165
|
},
|
|
@@ -5160,18 +5170,18 @@ const Oe = (e, t) => {
|
|
|
5160
5170
|
default: "left",
|
|
5161
5171
|
values: ["left", "center", "right", "justify"]
|
|
5162
5172
|
}
|
|
5163
|
-
},
|
|
5164
|
-
function
|
|
5173
|
+
}, lt = ["backgroundColor", "textColor"];
|
|
5174
|
+
function de(e) {
|
|
5165
5175
|
return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
5166
5176
|
}
|
|
5167
|
-
function
|
|
5177
|
+
function Pr(e) {
|
|
5168
5178
|
const t = e.split("/");
|
|
5169
5179
|
return !t.length || // invalid?
|
|
5170
5180
|
t[t.length - 1] === "" ? e : t[t.length - 1];
|
|
5171
5181
|
}
|
|
5172
|
-
function
|
|
5182
|
+
function dt(e) {
|
|
5173
5183
|
const t = {};
|
|
5174
|
-
return Object.entries(e).filter(([i, o]) => !
|
|
5184
|
+
return Object.entries(e).filter(([i, o]) => !lt.includes(i)).forEach(([i, o]) => {
|
|
5175
5185
|
t[i] = {
|
|
5176
5186
|
default: o.default,
|
|
5177
5187
|
keepOnSplit: !0,
|
|
@@ -5179,7 +5189,7 @@ function st(e) {
|
|
|
5179
5189
|
// value is the same as its default, we don't display an HTML
|
|
5180
5190
|
// attribute for it.
|
|
5181
5191
|
parseHTML: (n) => {
|
|
5182
|
-
const r = n.getAttribute(
|
|
5192
|
+
const r = n.getAttribute(de(i));
|
|
5183
5193
|
if (r === null)
|
|
5184
5194
|
return null;
|
|
5185
5195
|
if (typeof o.default == "boolean")
|
|
@@ -5191,12 +5201,12 @@ function st(e) {
|
|
|
5191
5201
|
return r;
|
|
5192
5202
|
},
|
|
5193
5203
|
renderHTML: (n) => n[i] !== o.default ? {
|
|
5194
|
-
[
|
|
5204
|
+
[de(i)]: n[i]
|
|
5195
5205
|
} : {}
|
|
5196
5206
|
};
|
|
5197
5207
|
}), t;
|
|
5198
5208
|
}
|
|
5199
|
-
function
|
|
5209
|
+
function Ui(e, t, i, o) {
|
|
5200
5210
|
if (typeof e == "boolean")
|
|
5201
5211
|
throw new Error(
|
|
5202
5212
|
"Cannot find node position as getPos is a boolean, not a function."
|
|
@@ -5209,18 +5219,18 @@ function Ni(e, t, i, o) {
|
|
|
5209
5219
|
throw new Error("Block type does not match");
|
|
5210
5220
|
return s;
|
|
5211
5221
|
}
|
|
5212
|
-
function
|
|
5222
|
+
function ae(e, t, i, o, n = !1, r) {
|
|
5213
5223
|
const a = document.createElement("div");
|
|
5214
5224
|
if (r !== void 0)
|
|
5215
5225
|
for (const [s, l] of Object.entries(r))
|
|
5216
5226
|
s !== "class" && a.setAttribute(s, l);
|
|
5217
|
-
a.className =
|
|
5227
|
+
a.className = O(
|
|
5218
5228
|
"bn-block-content",
|
|
5219
5229
|
(r == null ? void 0 : r.class) || ""
|
|
5220
5230
|
), a.setAttribute("data-content-type", t);
|
|
5221
5231
|
for (const [s, l] of Object.entries(i))
|
|
5222
|
-
!
|
|
5223
|
-
return n && a.setAttribute("data-file-block", ""), a.appendChild(e.dom), e.contentDOM !== void 0 && (e.contentDOM.className =
|
|
5232
|
+
!lt.includes(s) && l !== o[s].default && a.setAttribute(de(s), l);
|
|
5233
|
+
return n && a.setAttribute("data-file-block", ""), a.appendChild(e.dom), e.contentDOM !== void 0 && (e.contentDOM.className = O(
|
|
5224
5234
|
"bn-inline-content",
|
|
5225
5235
|
e.contentDOM.className
|
|
5226
5236
|
), e.contentDOM.setAttribute("data-editable", "")), {
|
|
@@ -5228,17 +5238,17 @@ function ge(e, t, i, o, n = !1, r) {
|
|
|
5228
5238
|
dom: a
|
|
5229
5239
|
};
|
|
5230
5240
|
}
|
|
5231
|
-
function
|
|
5232
|
-
return
|
|
5241
|
+
function G(e) {
|
|
5242
|
+
return X.create(e);
|
|
5233
5243
|
}
|
|
5234
|
-
function
|
|
5244
|
+
function ct(e, t) {
|
|
5235
5245
|
return {
|
|
5236
5246
|
config: e,
|
|
5237
5247
|
implementation: t
|
|
5238
5248
|
};
|
|
5239
5249
|
}
|
|
5240
|
-
function
|
|
5241
|
-
return
|
|
5250
|
+
function Z(e, t, i) {
|
|
5251
|
+
return ct(
|
|
5242
5252
|
{
|
|
5243
5253
|
type: e.name,
|
|
5244
5254
|
content: e.config.content === "inline*" ? "inline" : e.config.content === "tableRow+" ? "table" : "none",
|
|
@@ -5247,23 +5257,23 @@ function X(e, t, i) {
|
|
|
5247
5257
|
{
|
|
5248
5258
|
node: e,
|
|
5249
5259
|
requiredExtensions: i,
|
|
5250
|
-
toInternalHTML:
|
|
5251
|
-
toExternalHTML:
|
|
5260
|
+
toInternalHTML: Fe,
|
|
5261
|
+
toExternalHTML: Fe
|
|
5252
5262
|
// parse: () => undefined, // parse rules are in node already
|
|
5253
5263
|
}
|
|
5254
5264
|
);
|
|
5255
5265
|
}
|
|
5256
|
-
function
|
|
5266
|
+
function ut(e) {
|
|
5257
5267
|
return Object.fromEntries(
|
|
5258
5268
|
Object.entries(e).map(([t, i]) => [t, i.config])
|
|
5259
5269
|
);
|
|
5260
5270
|
}
|
|
5261
|
-
function
|
|
5262
|
-
e.stopEvent = (i) => i.type === "
|
|
5271
|
+
function Di(e, t) {
|
|
5272
|
+
e.stopEvent = (i) => (i.type === "mousedown" && setTimeout(() => {
|
|
5263
5273
|
t.view.dom.blur();
|
|
5264
|
-
}, 10), !0)
|
|
5274
|
+
}, 10), !0);
|
|
5265
5275
|
}
|
|
5266
|
-
function
|
|
5276
|
+
function ji(e, t) {
|
|
5267
5277
|
const i = [
|
|
5268
5278
|
{
|
|
5269
5279
|
tag: "[data-content-type=" + e.type + "]",
|
|
@@ -5280,40 +5290,47 @@ function Hi(e, t) {
|
|
|
5280
5290
|
}
|
|
5281
5291
|
}), i;
|
|
5282
5292
|
}
|
|
5283
|
-
function
|
|
5284
|
-
const i =
|
|
5293
|
+
function me(e, t) {
|
|
5294
|
+
const i = G({
|
|
5285
5295
|
name: e.type,
|
|
5286
5296
|
content: e.content === "inline" ? "inline*" : "",
|
|
5287
5297
|
group: "blockContent",
|
|
5288
5298
|
selectable: e.isSelectable ?? !0,
|
|
5289
5299
|
addAttributes() {
|
|
5290
|
-
return
|
|
5300
|
+
return dt(e.propSchema);
|
|
5291
5301
|
},
|
|
5292
5302
|
parseHTML() {
|
|
5293
|
-
return
|
|
5303
|
+
return ji(e, t.parse);
|
|
5294
5304
|
},
|
|
5295
|
-
renderHTML() {
|
|
5296
|
-
const
|
|
5297
|
-
return
|
|
5298
|
-
|
|
5299
|
-
|
|
5305
|
+
renderHTML({ HTMLAttributes: o }) {
|
|
5306
|
+
const n = document.createElement("div");
|
|
5307
|
+
return n.setAttribute("data-tmp-placeholder", "true"), ae(
|
|
5308
|
+
{
|
|
5309
|
+
dom: n
|
|
5310
|
+
},
|
|
5311
|
+
e.type,
|
|
5312
|
+
{},
|
|
5313
|
+
e.propSchema,
|
|
5314
|
+
e.isFileBlock,
|
|
5315
|
+
o
|
|
5316
|
+
);
|
|
5300
5317
|
},
|
|
5301
5318
|
addNodeView() {
|
|
5302
5319
|
return ({ getPos: o }) => {
|
|
5303
5320
|
var d;
|
|
5304
|
-
const n = this.options.editor, r =
|
|
5321
|
+
const n = this.options.editor, r = Ui(
|
|
5305
5322
|
o,
|
|
5306
5323
|
n,
|
|
5307
5324
|
this.editor,
|
|
5308
5325
|
e.type
|
|
5309
|
-
), a = ((d = this.options.domAttributes) == null ? void 0 : d.blockContent) || {}, s = t.render(r, n), l =
|
|
5326
|
+
), a = ((d = this.options.domAttributes) == null ? void 0 : d.blockContent) || {}, s = t.render(r, n), l = ae(
|
|
5310
5327
|
s,
|
|
5311
5328
|
r.type,
|
|
5312
5329
|
r.props,
|
|
5313
5330
|
e.propSchema,
|
|
5314
5331
|
a
|
|
5315
5332
|
);
|
|
5316
|
-
return e.isSelectable === !1 &&
|
|
5333
|
+
return e.isSelectable === !1 && Di(l, this.editor), l;
|
|
5317
5334
|
};
|
|
5318
5335
|
}
|
|
5319
5336
|
});
|
|
@@ -5321,12 +5338,12 @@ function ce(e, t) {
|
|
|
5321
5338
|
throw new Error(
|
|
5322
5339
|
"Node name does not match block type. This is a bug in BlockNote."
|
|
5323
5340
|
);
|
|
5324
|
-
return
|
|
5341
|
+
return ct(e, {
|
|
5325
5342
|
node: i,
|
|
5326
5343
|
toInternalHTML: (o, n) => {
|
|
5327
5344
|
var s;
|
|
5328
5345
|
const r = ((s = i.options.domAttributes) == null ? void 0 : s.blockContent) || {}, a = t.render(o, n);
|
|
5329
|
-
return
|
|
5346
|
+
return ae(
|
|
5330
5347
|
a,
|
|
5331
5348
|
o.type,
|
|
5332
5349
|
o.props,
|
|
@@ -5343,7 +5360,7 @@ function ce(e, t) {
|
|
|
5343
5360
|
o,
|
|
5344
5361
|
n
|
|
5345
5362
|
);
|
|
5346
|
-
return a === void 0 && (a = t.render(o, n)),
|
|
5363
|
+
return a === void 0 && (a = t.render(o, n)), ae(
|
|
5347
5364
|
a,
|
|
5348
5365
|
o.type,
|
|
5349
5366
|
o.props,
|
|
@@ -5353,10 +5370,10 @@ function ce(e, t) {
|
|
|
5353
5370
|
}
|
|
5354
5371
|
});
|
|
5355
5372
|
}
|
|
5356
|
-
function
|
|
5357
|
-
return e.dom.setAttribute("data-inline-content-type", t), Object.entries(i).filter(([n, r]) => r !== o[n].default).map(([n, r]) => [
|
|
5373
|
+
function Ge(e, t, i, o) {
|
|
5374
|
+
return e.dom.setAttribute("data-inline-content-type", t), Object.entries(i).filter(([n, r]) => r !== o[n].default).map(([n, r]) => [de(n), r]).forEach(([n, r]) => e.dom.setAttribute(n, r)), e.contentDOM !== void 0 && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
5358
5375
|
}
|
|
5359
|
-
function
|
|
5376
|
+
function zi(e) {
|
|
5360
5377
|
return {
|
|
5361
5378
|
Backspace: ({ editor: t }) => {
|
|
5362
5379
|
const i = t.state.selection.$from;
|
|
@@ -5364,14 +5381,14 @@ function Ui(e) {
|
|
|
5364
5381
|
}
|
|
5365
5382
|
};
|
|
5366
5383
|
}
|
|
5367
|
-
function
|
|
5384
|
+
function Ri(e, t) {
|
|
5368
5385
|
return {
|
|
5369
5386
|
config: e,
|
|
5370
5387
|
implementation: t
|
|
5371
5388
|
};
|
|
5372
5389
|
}
|
|
5373
|
-
function
|
|
5374
|
-
return
|
|
5390
|
+
function Vi(e, t) {
|
|
5391
|
+
return Ri(
|
|
5375
5392
|
{
|
|
5376
5393
|
type: e.name,
|
|
5377
5394
|
propSchema: t,
|
|
@@ -5382,12 +5399,12 @@ function ji(e, t) {
|
|
|
5382
5399
|
}
|
|
5383
5400
|
);
|
|
5384
5401
|
}
|
|
5385
|
-
function
|
|
5402
|
+
function pt(e) {
|
|
5386
5403
|
return Object.fromEntries(
|
|
5387
5404
|
Object.entries(e).map(([t, i]) => [t, i.config])
|
|
5388
5405
|
);
|
|
5389
5406
|
}
|
|
5390
|
-
function
|
|
5407
|
+
function Oi(e) {
|
|
5391
5408
|
return [
|
|
5392
5409
|
{
|
|
5393
5410
|
tag: `[data-inline-content-type="${e.type}"]`,
|
|
@@ -5398,8 +5415,8 @@ function zi(e) {
|
|
|
5398
5415
|
}
|
|
5399
5416
|
];
|
|
5400
5417
|
}
|
|
5401
|
-
function
|
|
5402
|
-
const i =
|
|
5418
|
+
function Hr(e, t) {
|
|
5419
|
+
const i = X.create({
|
|
5403
5420
|
name: e.type,
|
|
5404
5421
|
inline: !0,
|
|
5405
5422
|
group: "inline",
|
|
@@ -5407,17 +5424,17 @@ function Ir(e, t) {
|
|
|
5407
5424
|
atom: e.content === "none",
|
|
5408
5425
|
content: e.content === "styled" ? "inline*" : "",
|
|
5409
5426
|
addAttributes() {
|
|
5410
|
-
return
|
|
5427
|
+
return dt(e.propSchema);
|
|
5411
5428
|
},
|
|
5412
5429
|
addKeyboardShortcuts() {
|
|
5413
|
-
return
|
|
5430
|
+
return zi(e);
|
|
5414
5431
|
},
|
|
5415
5432
|
parseHTML() {
|
|
5416
|
-
return
|
|
5433
|
+
return Oi(e);
|
|
5417
5434
|
},
|
|
5418
5435
|
renderHTML({ node: o }) {
|
|
5419
5436
|
const n = this.options.editor, r = t.render(
|
|
5420
|
-
|
|
5437
|
+
Se(
|
|
5421
5438
|
o,
|
|
5422
5439
|
n.schema.inlineContentSchema,
|
|
5423
5440
|
n.schema.styleSchema
|
|
@@ -5427,7 +5444,7 @@ function Ir(e, t) {
|
|
|
5427
5444
|
},
|
|
5428
5445
|
n
|
|
5429
5446
|
);
|
|
5430
|
-
return
|
|
5447
|
+
return Ge(
|
|
5431
5448
|
r,
|
|
5432
5449
|
e.type,
|
|
5433
5450
|
o.attrs,
|
|
@@ -5437,7 +5454,7 @@ function Ir(e, t) {
|
|
|
5437
5454
|
addNodeView() {
|
|
5438
5455
|
return ({ node: o, getPos: n }) => {
|
|
5439
5456
|
const r = this.options.editor, a = t.render(
|
|
5440
|
-
|
|
5457
|
+
Se(
|
|
5441
5458
|
o,
|
|
5442
5459
|
r.schema.inlineContentSchema,
|
|
5443
5460
|
r.schema.styleSchema
|
|
@@ -5461,7 +5478,7 @@ function Ir(e, t) {
|
|
|
5461
5478
|
},
|
|
5462
5479
|
r
|
|
5463
5480
|
);
|
|
5464
|
-
return
|
|
5481
|
+
return Ge(
|
|
5465
5482
|
a,
|
|
5466
5483
|
e.type,
|
|
5467
5484
|
o.attrs,
|
|
@@ -5470,12 +5487,12 @@ function Ir(e, t) {
|
|
|
5470
5487
|
};
|
|
5471
5488
|
}
|
|
5472
5489
|
});
|
|
5473
|
-
return
|
|
5490
|
+
return Vi(
|
|
5474
5491
|
i,
|
|
5475
5492
|
e.propSchema
|
|
5476
5493
|
);
|
|
5477
5494
|
}
|
|
5478
|
-
function
|
|
5495
|
+
function Fi(e) {
|
|
5479
5496
|
return e === "boolean" ? {} : {
|
|
5480
5497
|
stringValue: {
|
|
5481
5498
|
default: void 0,
|
|
@@ -5487,17 +5504,17 @@ function Vi(e) {
|
|
|
5487
5504
|
}
|
|
5488
5505
|
};
|
|
5489
5506
|
}
|
|
5490
|
-
function
|
|
5507
|
+
function Gi(e, t, i, o) {
|
|
5491
5508
|
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;
|
|
5492
5509
|
}
|
|
5493
|
-
function
|
|
5510
|
+
function ht(e, t) {
|
|
5494
5511
|
return {
|
|
5495
5512
|
config: e,
|
|
5496
5513
|
implementation: t
|
|
5497
5514
|
};
|
|
5498
5515
|
}
|
|
5499
5516
|
function j(e, t) {
|
|
5500
|
-
return
|
|
5517
|
+
return ht(
|
|
5501
5518
|
{
|
|
5502
5519
|
type: e.name,
|
|
5503
5520
|
propSchema: t
|
|
@@ -5507,12 +5524,12 @@ function j(e, t) {
|
|
|
5507
5524
|
}
|
|
5508
5525
|
);
|
|
5509
5526
|
}
|
|
5510
|
-
function
|
|
5527
|
+
function mt(e) {
|
|
5511
5528
|
return Object.fromEntries(
|
|
5512
5529
|
Object.entries(e).map(([t, i]) => [t, i.config])
|
|
5513
5530
|
);
|
|
5514
5531
|
}
|
|
5515
|
-
function
|
|
5532
|
+
function Wi(e) {
|
|
5516
5533
|
return [
|
|
5517
5534
|
{
|
|
5518
5535
|
tag: `[data-style-type="${e.type}"]`,
|
|
@@ -5523,14 +5540,14 @@ function Oi(e) {
|
|
|
5523
5540
|
}
|
|
5524
5541
|
];
|
|
5525
5542
|
}
|
|
5526
|
-
function
|
|
5527
|
-
const i =
|
|
5543
|
+
function Ur(e, t) {
|
|
5544
|
+
const i = Me.create({
|
|
5528
5545
|
name: e.type,
|
|
5529
5546
|
addAttributes() {
|
|
5530
|
-
return
|
|
5547
|
+
return Fi(e.propSchema);
|
|
5531
5548
|
},
|
|
5532
5549
|
parseHTML() {
|
|
5533
|
-
return
|
|
5550
|
+
return Wi(e);
|
|
5534
5551
|
},
|
|
5535
5552
|
renderHTML({ mark: o }) {
|
|
5536
5553
|
let n;
|
|
@@ -5540,7 +5557,7 @@ function Ar(e, t) {
|
|
|
5540
5557
|
n = t.render(o.attrs.stringValue);
|
|
5541
5558
|
else
|
|
5542
5559
|
throw new P(e.propSchema);
|
|
5543
|
-
return
|
|
5560
|
+
return Gi(
|
|
5544
5561
|
n,
|
|
5545
5562
|
e.type,
|
|
5546
5563
|
o.attrs.stringValue,
|
|
@@ -5548,14 +5565,14 @@ function Ar(e, t) {
|
|
|
5548
5565
|
);
|
|
5549
5566
|
}
|
|
5550
5567
|
});
|
|
5551
|
-
return
|
|
5568
|
+
return ht(e, {
|
|
5552
5569
|
mark: i
|
|
5553
5570
|
});
|
|
5554
5571
|
}
|
|
5555
|
-
const
|
|
5572
|
+
const fe = (e, t, i, o, n) => {
|
|
5556
5573
|
const r = document.createElement("div");
|
|
5557
5574
|
if (r.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
5558
|
-
const a =
|
|
5575
|
+
const a = Ki(
|
|
5559
5576
|
e,
|
|
5560
5577
|
t,
|
|
5561
5578
|
o,
|
|
@@ -5577,16 +5594,16 @@ const ue = (e, t, i, o, n) => {
|
|
|
5577
5594
|
}
|
|
5578
5595
|
};
|
|
5579
5596
|
} else if (e.props.showPreview === !1) {
|
|
5580
|
-
const a =
|
|
5597
|
+
const a = ft(e).dom;
|
|
5581
5598
|
return {
|
|
5582
|
-
dom:
|
|
5599
|
+
dom: re(e, a).dom
|
|
5583
5600
|
};
|
|
5584
5601
|
} else
|
|
5585
5602
|
return r.appendChild(i.dom), {
|
|
5586
5603
|
dom: r,
|
|
5587
5604
|
destroy: i.destroy
|
|
5588
5605
|
};
|
|
5589
|
-
},
|
|
5606
|
+
}, ft = (e) => {
|
|
5590
5607
|
const t = document.createElement("div");
|
|
5591
5608
|
t.className = "bn-file-default-preview";
|
|
5592
5609
|
const i = document.createElement("div");
|
|
@@ -5595,14 +5612,14 @@ const ue = (e, t, i, o, n) => {
|
|
|
5595
5612
|
return o.className = "bn-file-default-preview-name", o.textContent = e.props.name || "", t.appendChild(i), t.appendChild(o), {
|
|
5596
5613
|
dom: t
|
|
5597
5614
|
};
|
|
5598
|
-
},
|
|
5615
|
+
}, re = (e, t) => {
|
|
5599
5616
|
const i = document.createElement("div");
|
|
5600
5617
|
i.className = "bn-file-and-caption-wrapper";
|
|
5601
5618
|
const o = document.createElement("p");
|
|
5602
5619
|
return o.className = "bn-file-caption", o.textContent = e.props.caption, i.appendChild(t), i.appendChild(o), {
|
|
5603
5620
|
dom: i
|
|
5604
5621
|
};
|
|
5605
|
-
},
|
|
5622
|
+
}, Ki = (e, t, i, o) => {
|
|
5606
5623
|
const n = document.createElement("div");
|
|
5607
5624
|
n.className = "bn-add-file-button";
|
|
5608
5625
|
const r = document.createElement("div");
|
|
@@ -5636,7 +5653,7 @@ const ue = (e, t, i, o, n) => {
|
|
|
5636
5653
|
);
|
|
5637
5654
|
}
|
|
5638
5655
|
};
|
|
5639
|
-
},
|
|
5656
|
+
}, We = (e) => ({ url: e.src || void 0 }), ge = (e, t) => {
|
|
5640
5657
|
const i = e.querySelector(
|
|
5641
5658
|
t
|
|
5642
5659
|
);
|
|
@@ -5644,15 +5661,15 @@ const ue = (e, t, i, o, n) => {
|
|
|
5644
5661
|
return;
|
|
5645
5662
|
const o = e.querySelector("figcaption"), n = (o == null ? void 0 : o.textContent) ?? void 0;
|
|
5646
5663
|
return { targetElement: i, caption: n };
|
|
5647
|
-
},
|
|
5664
|
+
}, be = (e, t) => {
|
|
5648
5665
|
const i = document.createElement("div"), o = document.createElement("p");
|
|
5649
5666
|
return o.textContent = t, i.appendChild(e), i.appendChild(o), {
|
|
5650
5667
|
dom: i
|
|
5651
5668
|
};
|
|
5652
|
-
},
|
|
5669
|
+
}, Be = (e, t) => {
|
|
5653
5670
|
const i = document.createElement("figure"), o = document.createElement("figcaption");
|
|
5654
5671
|
return o.textContent = t, i.appendChild(e), i.appendChild(o), { dom: i };
|
|
5655
|
-
},
|
|
5672
|
+
}, gt = (e, t, i, o, n) => {
|
|
5656
5673
|
if (!e.props.previewWidth)
|
|
5657
5674
|
throw new Error("Block must have a `previewWidth` prop.");
|
|
5658
5675
|
const r = document.createElement("div");
|
|
@@ -5667,10 +5684,10 @@ const ue = (e, t, i, o, n) => {
|
|
|
5667
5684
|
!t.isEditable && r.contains(a) && r.contains(s) && (r.removeChild(a), r.removeChild(s));
|
|
5668
5685
|
return;
|
|
5669
5686
|
}
|
|
5670
|
-
let
|
|
5671
|
-
e.props.textAlignment === "center" ? l.handleUsed === "left" ?
|
|
5672
|
-
const
|
|
5673
|
-
|
|
5687
|
+
let _;
|
|
5688
|
+
e.props.textAlignment === "center" ? l.handleUsed === "left" ? _ = l.initialWidth + (l.initialClientX - g.clientX) * 2 : _ = l.initialWidth + (g.clientX - l.initialClientX) * 2 : l.handleUsed === "left" ? _ = l.initialWidth + l.initialClientX - g.clientX : _ = l.initialWidth + g.clientX - l.initialClientX;
|
|
5689
|
+
const x = 64;
|
|
5690
|
+
_ < x ? n(x) : _ > t.domElement.firstElementChild.clientWidth ? n(t.domElement.firstElementChild.clientWidth) : n(_);
|
|
5674
5691
|
}, u = (g) => {
|
|
5675
5692
|
(!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, {
|
|
5676
5693
|
props: {
|
|
@@ -5712,8 +5729,8 @@ const ue = (e, t, i, o, n) => {
|
|
|
5712
5729
|
);
|
|
5713
5730
|
}
|
|
5714
5731
|
};
|
|
5715
|
-
},
|
|
5716
|
-
backgroundColor:
|
|
5732
|
+
}, Ke = (e) => ({ url: e.src || void 0 }), $i = {
|
|
5733
|
+
backgroundColor: y.backgroundColor,
|
|
5717
5734
|
// File name.
|
|
5718
5735
|
name: {
|
|
5719
5736
|
default: ""
|
|
@@ -5729,41 +5746,41 @@ const ue = (e, t, i, o, n) => {
|
|
|
5729
5746
|
showPreview: {
|
|
5730
5747
|
default: !0
|
|
5731
5748
|
}
|
|
5732
|
-
},
|
|
5749
|
+
}, qi = {
|
|
5733
5750
|
type: "audio",
|
|
5734
|
-
propSchema:
|
|
5751
|
+
propSchema: $i,
|
|
5735
5752
|
content: "none",
|
|
5736
5753
|
isFileBlock: !0,
|
|
5737
5754
|
fileBlockAccept: ["audio/*"]
|
|
5738
|
-
},
|
|
5755
|
+
}, Xi = (e, t) => {
|
|
5739
5756
|
const i = document.createElement("div");
|
|
5740
5757
|
i.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"></path></svg>';
|
|
5741
5758
|
const o = document.createElement("audio");
|
|
5742
5759
|
o.className = "bn-audio", t.resolveFileUrl(e.props.url).then((r) => {
|
|
5743
5760
|
o.src = r;
|
|
5744
5761
|
}), o.controls = !0, o.contentEditable = "false", o.draggable = !1;
|
|
5745
|
-
const n =
|
|
5746
|
-
return
|
|
5762
|
+
const n = re(e, o);
|
|
5763
|
+
return fe(
|
|
5747
5764
|
e,
|
|
5748
5765
|
t,
|
|
5749
5766
|
n,
|
|
5750
5767
|
t.dictionary.file_blocks.audio.add_button_text,
|
|
5751
5768
|
i.firstElementChild
|
|
5752
5769
|
);
|
|
5753
|
-
},
|
|
5770
|
+
}, Zi = (e) => {
|
|
5754
5771
|
if (e.tagName === "AUDIO")
|
|
5755
|
-
return
|
|
5772
|
+
return Ke(e);
|
|
5756
5773
|
if (e.tagName === "FIGURE") {
|
|
5757
|
-
const t =
|
|
5774
|
+
const t = ge(e, "audio");
|
|
5758
5775
|
if (!t)
|
|
5759
5776
|
return;
|
|
5760
5777
|
const { targetElement: i, caption: o } = t;
|
|
5761
5778
|
return {
|
|
5762
|
-
...
|
|
5779
|
+
...Ke(i),
|
|
5763
5780
|
caption: o
|
|
5764
5781
|
};
|
|
5765
5782
|
}
|
|
5766
|
-
},
|
|
5783
|
+
}, Ji = (e) => {
|
|
5767
5784
|
if (!e.props.url) {
|
|
5768
5785
|
const i = document.createElement("p");
|
|
5769
5786
|
return i.textContent = "Add audio", {
|
|
@@ -5771,15 +5788,15 @@ const ue = (e, t, i, o, n) => {
|
|
|
5771
5788
|
};
|
|
5772
5789
|
}
|
|
5773
5790
|
let t;
|
|
5774
|
-
return e.props.showPreview ? (t = document.createElement("audio"), t.src = e.props.url) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
5791
|
+
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 ? Be(t, e.props.caption) : be(t, e.props.caption) : {
|
|
5775
5792
|
dom: t
|
|
5776
5793
|
};
|
|
5777
|
-
},
|
|
5778
|
-
render:
|
|
5779
|
-
parse:
|
|
5780
|
-
toExternalHTML:
|
|
5781
|
-
}),
|
|
5782
|
-
backgroundColor:
|
|
5794
|
+
}, Yi = me(qi, {
|
|
5795
|
+
render: Xi,
|
|
5796
|
+
parse: Zi,
|
|
5797
|
+
toExternalHTML: Ji
|
|
5798
|
+
}), Qi = {
|
|
5799
|
+
backgroundColor: y.backgroundColor,
|
|
5783
5800
|
// File name.
|
|
5784
5801
|
name: {
|
|
5785
5802
|
default: ""
|
|
@@ -5792,28 +5809,28 @@ const ue = (e, t, i, o, n) => {
|
|
|
5792
5809
|
caption: {
|
|
5793
5810
|
default: ""
|
|
5794
5811
|
}
|
|
5795
|
-
},
|
|
5812
|
+
}, eo = {
|
|
5796
5813
|
type: "file",
|
|
5797
|
-
propSchema:
|
|
5814
|
+
propSchema: Qi,
|
|
5798
5815
|
content: "none",
|
|
5799
5816
|
isFileBlock: !0
|
|
5800
|
-
},
|
|
5801
|
-
const i =
|
|
5802
|
-
return
|
|
5803
|
-
},
|
|
5817
|
+
}, to = (e, t) => {
|
|
5818
|
+
const i = ft(e).dom, o = re(e, i);
|
|
5819
|
+
return fe(e, t, o);
|
|
5820
|
+
}, io = (e) => {
|
|
5804
5821
|
if (e.tagName === "EMBED")
|
|
5805
|
-
return
|
|
5822
|
+
return We(e);
|
|
5806
5823
|
if (e.tagName === "FIGURE") {
|
|
5807
|
-
const t =
|
|
5824
|
+
const t = ge(e, "embed");
|
|
5808
5825
|
if (!t)
|
|
5809
5826
|
return;
|
|
5810
5827
|
const { targetElement: i, caption: o } = t;
|
|
5811
5828
|
return {
|
|
5812
|
-
...
|
|
5829
|
+
...We(i),
|
|
5813
5830
|
caption: o
|
|
5814
5831
|
};
|
|
5815
5832
|
}
|
|
5816
|
-
},
|
|
5833
|
+
}, oo = (e) => {
|
|
5817
5834
|
if (!e.props.url) {
|
|
5818
5835
|
const i = document.createElement("p");
|
|
5819
5836
|
return i.textContent = "Add file", {
|
|
@@ -5821,14 +5838,14 @@ const ue = (e, t, i, o, n) => {
|
|
|
5821
5838
|
};
|
|
5822
5839
|
}
|
|
5823
5840
|
const t = document.createElement("a");
|
|
5824
|
-
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ?
|
|
5841
|
+
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ? be(t, e.props.caption) : {
|
|
5825
5842
|
dom: t
|
|
5826
5843
|
};
|
|
5827
|
-
},
|
|
5828
|
-
render:
|
|
5829
|
-
parse:
|
|
5830
|
-
toExternalHTML:
|
|
5831
|
-
}),
|
|
5844
|
+
}, no = me(eo, {
|
|
5845
|
+
render: to,
|
|
5846
|
+
parse: io,
|
|
5847
|
+
toExternalHTML: oo
|
|
5848
|
+
}), Dr = async (e) => {
|
|
5832
5849
|
const t = new FormData();
|
|
5833
5850
|
return t.append("file", e), (await (await fetch("https://tmpfiles.org/api/v1/upload", {
|
|
5834
5851
|
method: "POST",
|
|
@@ -5837,12 +5854,12 @@ const ue = (e, t, i, o, n) => {
|
|
|
5837
5854
|
"tmpfiles.org/",
|
|
5838
5855
|
"tmpfiles.org/dl/"
|
|
5839
5856
|
);
|
|
5840
|
-
},
|
|
5857
|
+
}, $e = (e) => {
|
|
5841
5858
|
const t = e.src || void 0, i = e.width || void 0;
|
|
5842
5859
|
return { url: t, previewWidth: i };
|
|
5843
|
-
},
|
|
5844
|
-
textAlignment:
|
|
5845
|
-
backgroundColor:
|
|
5860
|
+
}, ro = {
|
|
5861
|
+
textAlignment: y.textAlignment,
|
|
5862
|
+
backgroundColor: y.backgroundColor,
|
|
5846
5863
|
// File name.
|
|
5847
5864
|
name: {
|
|
5848
5865
|
default: ""
|
|
@@ -5862,13 +5879,13 @@ const ue = (e, t, i, o, n) => {
|
|
|
5862
5879
|
previewWidth: {
|
|
5863
5880
|
default: 512
|
|
5864
5881
|
}
|
|
5865
|
-
},
|
|
5882
|
+
}, ao = {
|
|
5866
5883
|
type: "image",
|
|
5867
|
-
propSchema:
|
|
5884
|
+
propSchema: ro,
|
|
5868
5885
|
content: "none",
|
|
5869
5886
|
isFileBlock: !0,
|
|
5870
5887
|
fileBlockAccept: ["image/*"]
|
|
5871
|
-
},
|
|
5888
|
+
}, so = (e, t) => {
|
|
5872
5889
|
const i = document.createElement("div");
|
|
5873
5890
|
i.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z"></path></svg>';
|
|
5874
5891
|
const o = document.createElement("img");
|
|
@@ -5878,34 +5895,34 @@ const ue = (e, t, i, o, n) => {
|
|
|
5878
5895
|
e.props.previewWidth,
|
|
5879
5896
|
t.domElement.firstElementChild.clientWidth
|
|
5880
5897
|
);
|
|
5881
|
-
const n =
|
|
5898
|
+
const n = gt(
|
|
5882
5899
|
e,
|
|
5883
5900
|
t,
|
|
5884
5901
|
o,
|
|
5885
5902
|
() => o.width,
|
|
5886
5903
|
(a) => o.width = a
|
|
5887
|
-
), r =
|
|
5888
|
-
return
|
|
5904
|
+
), r = re(e, n.dom);
|
|
5905
|
+
return fe(
|
|
5889
5906
|
e,
|
|
5890
5907
|
t,
|
|
5891
5908
|
r,
|
|
5892
5909
|
t.dictionary.file_blocks.image.add_button_text,
|
|
5893
5910
|
i.firstElementChild
|
|
5894
5911
|
);
|
|
5895
|
-
},
|
|
5912
|
+
}, lo = (e) => {
|
|
5896
5913
|
if (e.tagName === "IMG")
|
|
5897
|
-
return
|
|
5914
|
+
return $e(e);
|
|
5898
5915
|
if (e.tagName === "FIGURE") {
|
|
5899
|
-
const t =
|
|
5916
|
+
const t = ge(e, "img");
|
|
5900
5917
|
if (!t)
|
|
5901
5918
|
return;
|
|
5902
5919
|
const { targetElement: i, caption: o } = t;
|
|
5903
5920
|
return {
|
|
5904
|
-
|
|
5921
|
+
...$e(i),
|
|
5905
5922
|
caption: o
|
|
5906
5923
|
};
|
|
5907
5924
|
}
|
|
5908
|
-
},
|
|
5925
|
+
}, co = (e) => {
|
|
5909
5926
|
if (!e.props.url) {
|
|
5910
5927
|
const i = document.createElement("p");
|
|
5911
5928
|
return i.textContent = "Add image", {
|
|
@@ -5913,19 +5930,19 @@ const ue = (e, t, i, o, n) => {
|
|
|
5913
5930
|
};
|
|
5914
5931
|
}
|
|
5915
5932
|
let t;
|
|
5916
|
-
return e.props.showPreview ? (t = document.createElement("img"), t.src = e.props.url, t.alt = e.props.name || e.props.caption || "BlockNote image", t.width = e.props.previewWidth) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
5933
|
+
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 ? Be(t, e.props.caption) : be(t, e.props.caption) : {
|
|
5917
5934
|
dom: t
|
|
5918
5935
|
};
|
|
5919
|
-
},
|
|
5920
|
-
render:
|
|
5921
|
-
parse:
|
|
5922
|
-
toExternalHTML:
|
|
5923
|
-
}),
|
|
5936
|
+
}, uo = me(ao, {
|
|
5937
|
+
render: so,
|
|
5938
|
+
parse: lo,
|
|
5939
|
+
toExternalHTML: co
|
|
5940
|
+
}), qe = (e) => {
|
|
5924
5941
|
const t = e.src || void 0, i = e.width || void 0;
|
|
5925
5942
|
return { url: t, previewWidth: i };
|
|
5926
|
-
},
|
|
5927
|
-
textAlignment:
|
|
5928
|
-
backgroundColor:
|
|
5943
|
+
}, po = {
|
|
5944
|
+
textAlignment: y.textAlignment,
|
|
5945
|
+
backgroundColor: y.backgroundColor,
|
|
5929
5946
|
// File name.
|
|
5930
5947
|
name: {
|
|
5931
5948
|
default: ""
|
|
@@ -5945,13 +5962,13 @@ const ue = (e, t, i, o, n) => {
|
|
|
5945
5962
|
previewWidth: {
|
|
5946
5963
|
default: 512
|
|
5947
5964
|
}
|
|
5948
|
-
},
|
|
5965
|
+
}, ho = {
|
|
5949
5966
|
type: "video",
|
|
5950
|
-
propSchema:
|
|
5967
|
+
propSchema: po,
|
|
5951
5968
|
content: "none",
|
|
5952
5969
|
isFileBlock: !0,
|
|
5953
5970
|
fileBlockAccept: ["video/*"]
|
|
5954
|
-
},
|
|
5971
|
+
}, mo = (e, t) => {
|
|
5955
5972
|
const i = document.createElement("div");
|
|
5956
5973
|
i.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z"></path></svg>';
|
|
5957
5974
|
const o = document.createElement("video");
|
|
@@ -5959,34 +5976,34 @@ const ue = (e, t, i, o, n) => {
|
|
|
5959
5976
|
e.props.previewWidth,
|
|
5960
5977
|
t.domElement.firstElementChild.clientWidth
|
|
5961
5978
|
);
|
|
5962
|
-
const n =
|
|
5979
|
+
const n = gt(
|
|
5963
5980
|
e,
|
|
5964
5981
|
t,
|
|
5965
5982
|
o,
|
|
5966
5983
|
() => o.width,
|
|
5967
5984
|
(a) => o.width = a
|
|
5968
|
-
), r =
|
|
5969
|
-
return
|
|
5985
|
+
), r = re(e, n.dom);
|
|
5986
|
+
return fe(
|
|
5970
5987
|
e,
|
|
5971
5988
|
t,
|
|
5972
5989
|
r,
|
|
5973
5990
|
t.dictionary.file_blocks.video.add_button_text,
|
|
5974
5991
|
i.firstElementChild
|
|
5975
5992
|
);
|
|
5976
|
-
},
|
|
5993
|
+
}, fo = (e) => {
|
|
5977
5994
|
if (e.tagName === "VIDEO")
|
|
5978
|
-
return
|
|
5995
|
+
return qe(e);
|
|
5979
5996
|
if (e.tagName === "FIGURE") {
|
|
5980
|
-
const t =
|
|
5997
|
+
const t = ge(e, "video");
|
|
5981
5998
|
if (!t)
|
|
5982
5999
|
return;
|
|
5983
6000
|
const { targetElement: i, caption: o } = t;
|
|
5984
6001
|
return {
|
|
5985
|
-
|
|
6002
|
+
...qe(i),
|
|
5986
6003
|
caption: o
|
|
5987
6004
|
};
|
|
5988
6005
|
}
|
|
5989
|
-
},
|
|
6006
|
+
}, go = (e) => {
|
|
5990
6007
|
if (!e.props.url) {
|
|
5991
6008
|
const i = document.createElement("p");
|
|
5992
6009
|
return i.textContent = "Add video", {
|
|
@@ -5994,14 +6011,14 @@ const ue = (e, t, i, o, n) => {
|
|
|
5994
6011
|
};
|
|
5995
6012
|
}
|
|
5996
6013
|
let t;
|
|
5997
|
-
return e.props.showPreview ? (t = document.createElement("video"), t.src = e.props.url, t.width = e.props.previewWidth) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
6014
|
+
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 ? Be(t, e.props.caption) : be(t, e.props.caption) : {
|
|
5998
6015
|
dom: t
|
|
5999
6016
|
};
|
|
6000
|
-
},
|
|
6001
|
-
render:
|
|
6002
|
-
parse:
|
|
6003
|
-
toExternalHTML:
|
|
6004
|
-
}),
|
|
6017
|
+
}, bo = me(ho, {
|
|
6018
|
+
render: mo,
|
|
6019
|
+
parse: fo,
|
|
6020
|
+
toExternalHTML: go
|
|
6021
|
+
}), _o = Me.create({
|
|
6005
6022
|
name: "backgroundColor",
|
|
6006
6023
|
addAttributes() {
|
|
6007
6024
|
return {
|
|
@@ -6027,10 +6044,10 @@ const ue = (e, t, i, o, n) => {
|
|
|
6027
6044
|
renderHTML({ HTMLAttributes: e }) {
|
|
6028
6045
|
return ["span", e, 0];
|
|
6029
6046
|
}
|
|
6030
|
-
}),
|
|
6031
|
-
|
|
6047
|
+
}), ko = j(
|
|
6048
|
+
_o,
|
|
6032
6049
|
"string"
|
|
6033
|
-
),
|
|
6050
|
+
), yo = Me.create({
|
|
6034
6051
|
name: "textColor",
|
|
6035
6052
|
addAttributes() {
|
|
6036
6053
|
return {
|
|
@@ -6054,10 +6071,10 @@ const ue = (e, t, i, o, n) => {
|
|
|
6054
6071
|
renderHTML({ HTMLAttributes: e }) {
|
|
6055
6072
|
return ["span", e, 0];
|
|
6056
6073
|
}
|
|
6057
|
-
}),
|
|
6058
|
-
...
|
|
6074
|
+
}), wo = j(yo, "string"), vo = {
|
|
6075
|
+
...y,
|
|
6059
6076
|
level: { default: 1, values: [1, 2, 3] }
|
|
6060
|
-
},
|
|
6077
|
+
}, xo = G({
|
|
6061
6078
|
name: "heading",
|
|
6062
6079
|
content: "inline*",
|
|
6063
6080
|
group: "blockContent",
|
|
@@ -6079,10 +6096,10 @@ const ue = (e, t, i, o, n) => {
|
|
|
6079
6096
|
},
|
|
6080
6097
|
addInputRules() {
|
|
6081
6098
|
return [
|
|
6082
|
-
...[1, 2, 3].map((e) => new
|
|
6099
|
+
...[1, 2, 3].map((e) => new te({
|
|
6083
6100
|
find: new RegExp(`^(#{${e}})\\s$`),
|
|
6084
6101
|
handler: ({ state: t, chain: i, range: o }) => {
|
|
6085
|
-
|
|
6102
|
+
T(this.editor) === "inline*" && i().BNUpdateBlock(t.selection.from, {
|
|
6086
6103
|
type: "heading",
|
|
6087
6104
|
props: {
|
|
6088
6105
|
level: e
|
|
@@ -6094,7 +6111,7 @@ const ue = (e, t, i, o, n) => {
|
|
|
6094
6111
|
},
|
|
6095
6112
|
addKeyboardShortcuts() {
|
|
6096
6113
|
return {
|
|
6097
|
-
"Mod-Alt-1": () =>
|
|
6114
|
+
"Mod-Alt-1": () => T(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6098
6115
|
this.editor.state.selection.anchor,
|
|
6099
6116
|
{
|
|
6100
6117
|
type: "heading",
|
|
@@ -6103,7 +6120,7 @@ const ue = (e, t, i, o, n) => {
|
|
|
6103
6120
|
}
|
|
6104
6121
|
}
|
|
6105
6122
|
),
|
|
6106
|
-
"Mod-Alt-2": () =>
|
|
6123
|
+
"Mod-Alt-2": () => T(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6107
6124
|
this.editor.state.selection.anchor,
|
|
6108
6125
|
{
|
|
6109
6126
|
type: "heading",
|
|
@@ -6112,7 +6129,7 @@ const ue = (e, t, i, o, n) => {
|
|
|
6112
6129
|
}
|
|
6113
6130
|
}
|
|
6114
6131
|
),
|
|
6115
|
-
"Mod-Alt-3": () =>
|
|
6132
|
+
"Mod-Alt-3": () => T(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6116
6133
|
this.editor.state.selection.anchor,
|
|
6117
6134
|
{
|
|
6118
6135
|
type: "heading",
|
|
@@ -6150,7 +6167,7 @@ const ue = (e, t, i, o, n) => {
|
|
|
6150
6167
|
},
|
|
6151
6168
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
6152
6169
|
var i, o;
|
|
6153
|
-
return
|
|
6170
|
+
return F(
|
|
6154
6171
|
this.name,
|
|
6155
6172
|
`h${e.attrs.level}`,
|
|
6156
6173
|
{
|
|
@@ -6160,11 +6177,11 @@ const ue = (e, t, i, o, n) => {
|
|
|
6160
6177
|
((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
|
|
6161
6178
|
);
|
|
6162
6179
|
}
|
|
6163
|
-
}),
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
),
|
|
6167
|
-
const { contentNode: t, contentType: i } =
|
|
6180
|
+
}), Eo = Z(
|
|
6181
|
+
xo,
|
|
6182
|
+
vo
|
|
6183
|
+
), Le = (e) => {
|
|
6184
|
+
const { contentNode: t, contentType: i } = k(
|
|
6168
6185
|
e.state.doc,
|
|
6169
6186
|
e.state.selection.from
|
|
6170
6187
|
), o = e.state.selection.anchor === e.state.selection.head;
|
|
@@ -6182,9 +6199,9 @@ const ue = (e, t, i, o, n) => {
|
|
|
6182
6199
|
a.command(() => t.childCount > 0 ? (r().deleteSelection().BNSplitBlock(n.selection.from, !0).run(), !0) : !1)
|
|
6183
6200
|
)
|
|
6184
6201
|
]);
|
|
6185
|
-
},
|
|
6186
|
-
...
|
|
6187
|
-
},
|
|
6202
|
+
}, Co = {
|
|
6203
|
+
...y
|
|
6204
|
+
}, So = G({
|
|
6188
6205
|
name: "bulletListItem",
|
|
6189
6206
|
content: "inline*",
|
|
6190
6207
|
group: "blockContent",
|
|
@@ -6194,10 +6211,10 @@ const ue = (e, t, i, o, n) => {
|
|
|
6194
6211
|
addInputRules() {
|
|
6195
6212
|
return [
|
|
6196
6213
|
// Creates an unordered list when starting with "-", "+", or "*".
|
|
6197
|
-
new
|
|
6214
|
+
new te({
|
|
6198
6215
|
find: new RegExp("^[-+*]\\s$"),
|
|
6199
6216
|
handler: ({ state: e, chain: t, range: i }) => {
|
|
6200
|
-
|
|
6217
|
+
T(this.editor) === "inline*" && t().BNUpdateBlock(e.selection.from, {
|
|
6201
6218
|
type: "bulletListItem",
|
|
6202
6219
|
props: {}
|
|
6203
6220
|
}).deleteRange({ from: i.from, to: i.to });
|
|
@@ -6207,8 +6224,8 @@ const ue = (e, t, i, o, n) => {
|
|
|
6207
6224
|
},
|
|
6208
6225
|
addKeyboardShortcuts() {
|
|
6209
6226
|
return {
|
|
6210
|
-
Enter: () =>
|
|
6211
|
-
"Mod-Shift-8": () =>
|
|
6227
|
+
Enter: () => Le(this.editor),
|
|
6228
|
+
"Mod-Shift-8": () => T(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6212
6229
|
this.editor.state.selection.anchor,
|
|
6213
6230
|
{
|
|
6214
6231
|
type: "bulletListItem",
|
|
@@ -6250,7 +6267,7 @@ const ue = (e, t, i, o, n) => {
|
|
|
6250
6267
|
},
|
|
6251
6268
|
renderHTML({ HTMLAttributes: e }) {
|
|
6252
6269
|
var t, i;
|
|
6253
|
-
return
|
|
6270
|
+
return F(
|
|
6254
6271
|
this.name,
|
|
6255
6272
|
// We use a <p> tag, because for <li> tags we'd need a <ul> element to put
|
|
6256
6273
|
// them in to be semantically correct, which we can't have due to the
|
|
@@ -6263,11 +6280,11 @@ const ue = (e, t, i, o, n) => {
|
|
|
6263
6280
|
((i = this.options.domAttributes) == null ? void 0 : i.inlineContent) || {}
|
|
6264
6281
|
);
|
|
6265
6282
|
}
|
|
6266
|
-
}),
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
),
|
|
6270
|
-
key:
|
|
6283
|
+
}), Mo = Z(
|
|
6284
|
+
So,
|
|
6285
|
+
Co
|
|
6286
|
+
), To = new B("numbered-list-indexing"), Bo = () => new v({
|
|
6287
|
+
key: To,
|
|
6271
6288
|
appendTransaction: (e, t, i) => {
|
|
6272
6289
|
const o = i.tr;
|
|
6273
6290
|
o.setMeta("numberedListIndexing", !0);
|
|
@@ -6275,18 +6292,18 @@ const ue = (e, t, i, o, n) => {
|
|
|
6275
6292
|
return i.doc.descendants((r, a) => {
|
|
6276
6293
|
if (r.type.name === "blockContainer" && r.firstChild.type.name === "numberedListItem") {
|
|
6277
6294
|
let s = "1";
|
|
6278
|
-
const l = a === 1, d =
|
|
6295
|
+
const l = a === 1, d = k(o.doc, a + 1);
|
|
6279
6296
|
if (d === void 0)
|
|
6280
6297
|
return;
|
|
6281
6298
|
if (!l) {
|
|
6282
|
-
const h =
|
|
6299
|
+
const h = k(o.doc, a - 2);
|
|
6283
6300
|
if (h === void 0)
|
|
6284
6301
|
return;
|
|
6285
6302
|
if (!(d.depth !== h.depth)) {
|
|
6286
6303
|
const f = h.contentNode;
|
|
6287
6304
|
if (h.contentType.name === "numberedListItem") {
|
|
6288
|
-
const
|
|
6289
|
-
s = (parseInt(
|
|
6305
|
+
const x = f.attrs.index;
|
|
6306
|
+
s = (parseInt(x) + 1).toString();
|
|
6290
6307
|
}
|
|
6291
6308
|
}
|
|
6292
6309
|
}
|
|
@@ -6296,9 +6313,9 @@ const ue = (e, t, i, o, n) => {
|
|
|
6296
6313
|
}
|
|
6297
6314
|
}), n ? o : null;
|
|
6298
6315
|
}
|
|
6299
|
-
}),
|
|
6300
|
-
...
|
|
6301
|
-
},
|
|
6316
|
+
}), Lo = {
|
|
6317
|
+
...y
|
|
6318
|
+
}, Io = G({
|
|
6302
6319
|
name: "numberedListItem",
|
|
6303
6320
|
content: "inline*",
|
|
6304
6321
|
group: "blockContent",
|
|
@@ -6317,10 +6334,10 @@ const ue = (e, t, i, o, n) => {
|
|
|
6317
6334
|
addInputRules() {
|
|
6318
6335
|
return [
|
|
6319
6336
|
// Creates an ordered list when starting with "1.".
|
|
6320
|
-
new
|
|
6337
|
+
new te({
|
|
6321
6338
|
find: new RegExp("^1\\.\\s$"),
|
|
6322
6339
|
handler: ({ state: e, chain: t, range: i }) => {
|
|
6323
|
-
|
|
6340
|
+
T(this.editor) === "inline*" && t().BNUpdateBlock(e.selection.from, {
|
|
6324
6341
|
type: "numberedListItem",
|
|
6325
6342
|
props: {}
|
|
6326
6343
|
}).deleteRange({ from: i.from, to: i.to });
|
|
@@ -6330,8 +6347,8 @@ const ue = (e, t, i, o, n) => {
|
|
|
6330
6347
|
},
|
|
6331
6348
|
addKeyboardShortcuts() {
|
|
6332
6349
|
return {
|
|
6333
|
-
Enter: () =>
|
|
6334
|
-
"Mod-Shift-7": () =>
|
|
6350
|
+
Enter: () => Le(this.editor),
|
|
6351
|
+
"Mod-Shift-7": () => T(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6335
6352
|
this.editor.state.selection.anchor,
|
|
6336
6353
|
{
|
|
6337
6354
|
type: "numberedListItem",
|
|
@@ -6341,7 +6358,7 @@ const ue = (e, t, i, o, n) => {
|
|
|
6341
6358
|
};
|
|
6342
6359
|
},
|
|
6343
6360
|
addProseMirrorPlugins() {
|
|
6344
|
-
return [
|
|
6361
|
+
return [Bo()];
|
|
6345
6362
|
},
|
|
6346
6363
|
parseHTML() {
|
|
6347
6364
|
return [
|
|
@@ -6378,7 +6395,7 @@ const ue = (e, t, i, o, n) => {
|
|
|
6378
6395
|
},
|
|
6379
6396
|
renderHTML({ HTMLAttributes: e }) {
|
|
6380
6397
|
var t, i;
|
|
6381
|
-
return
|
|
6398
|
+
return F(
|
|
6382
6399
|
this.name,
|
|
6383
6400
|
// We use a <p> tag, because for <li> tags we'd need an <ol> element to
|
|
6384
6401
|
// put them in to be semantically correct, which we can't have due to the
|
|
@@ -6391,15 +6408,15 @@ const ue = (e, t, i, o, n) => {
|
|
|
6391
6408
|
((i = this.options.domAttributes) == null ? void 0 : i.inlineContent) || {}
|
|
6392
6409
|
);
|
|
6393
6410
|
}
|
|
6394
|
-
}),
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
),
|
|
6398
|
-
...
|
|
6411
|
+
}), Ao = Z(
|
|
6412
|
+
Io,
|
|
6413
|
+
Lo
|
|
6414
|
+
), No = {
|
|
6415
|
+
...y,
|
|
6399
6416
|
checked: {
|
|
6400
6417
|
default: !1
|
|
6401
6418
|
}
|
|
6402
|
-
},
|
|
6419
|
+
}, Po = G({
|
|
6403
6420
|
name: "checkListItem",
|
|
6404
6421
|
content: "inline*",
|
|
6405
6422
|
group: "blockContent",
|
|
@@ -6418,10 +6435,10 @@ const ue = (e, t, i, o, n) => {
|
|
|
6418
6435
|
addInputRules() {
|
|
6419
6436
|
return [
|
|
6420
6437
|
// Creates a checklist when starting with "[]" or "[X]".
|
|
6421
|
-
new
|
|
6438
|
+
new te({
|
|
6422
6439
|
find: new RegExp("\\[\\s*\\]\\s$"),
|
|
6423
6440
|
handler: ({ state: e, chain: t, range: i }) => {
|
|
6424
|
-
|
|
6441
|
+
T(this.editor) === "inline*" && t().BNUpdateBlock(e.selection.from, {
|
|
6425
6442
|
type: "checkListItem",
|
|
6426
6443
|
props: {
|
|
6427
6444
|
checked: !1
|
|
@@ -6429,10 +6446,10 @@ const ue = (e, t, i, o, n) => {
|
|
|
6429
6446
|
}).deleteRange({ from: i.from, to: i.to });
|
|
6430
6447
|
}
|
|
6431
6448
|
}),
|
|
6432
|
-
new
|
|
6449
|
+
new te({
|
|
6433
6450
|
find: new RegExp("\\[[Xx]\\]\\s$"),
|
|
6434
6451
|
handler: ({ state: e, chain: t, range: i }) => {
|
|
6435
|
-
|
|
6452
|
+
T(this.editor) === "inline*" && t().BNUpdateBlock(e.selection.from, {
|
|
6436
6453
|
type: "checkListItem",
|
|
6437
6454
|
props: {
|
|
6438
6455
|
checked: !0
|
|
@@ -6444,8 +6461,8 @@ const ue = (e, t, i, o, n) => {
|
|
|
6444
6461
|
},
|
|
6445
6462
|
addKeyboardShortcuts() {
|
|
6446
6463
|
return {
|
|
6447
|
-
Enter: () =>
|
|
6448
|
-
"Mod-Shift-9": () =>
|
|
6464
|
+
Enter: () => Le(this.editor),
|
|
6465
|
+
"Mod-Shift-9": () => T(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6449
6466
|
this.editor.state.selection.anchor,
|
|
6450
6467
|
{
|
|
6451
6468
|
type: "checkListItem",
|
|
@@ -6496,7 +6513,7 @@ const ue = (e, t, i, o, n) => {
|
|
|
6496
6513
|
var r, a;
|
|
6497
6514
|
const i = document.createElement("input");
|
|
6498
6515
|
i.type = "checkbox", i.checked = e.attrs.checked, e.attrs.checked && i.setAttribute("checked", "");
|
|
6499
|
-
const { dom: o, contentDOM: n } =
|
|
6516
|
+
const { dom: o, contentDOM: n } = F(
|
|
6500
6517
|
this.name,
|
|
6501
6518
|
"p",
|
|
6502
6519
|
{
|
|
@@ -6529,7 +6546,7 @@ const ue = (e, t, i, o, n) => {
|
|
|
6529
6546
|
});
|
|
6530
6547
|
};
|
|
6531
6548
|
a.addEventListener("change", s);
|
|
6532
|
-
const { dom: l, contentDOM: d } =
|
|
6549
|
+
const { dom: l, contentDOM: d } = F(
|
|
6533
6550
|
this.name,
|
|
6534
6551
|
"p",
|
|
6535
6552
|
{
|
|
@@ -6551,18 +6568,18 @@ const ue = (e, t, i, o, n) => {
|
|
|
6551
6568
|
};
|
|
6552
6569
|
};
|
|
6553
6570
|
}
|
|
6554
|
-
}),
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
),
|
|
6558
|
-
...
|
|
6559
|
-
},
|
|
6571
|
+
}), Ho = Z(
|
|
6572
|
+
Po,
|
|
6573
|
+
No
|
|
6574
|
+
), Uo = {
|
|
6575
|
+
...y
|
|
6576
|
+
}, Do = G({
|
|
6560
6577
|
name: "paragraph",
|
|
6561
6578
|
content: "inline*",
|
|
6562
6579
|
group: "blockContent",
|
|
6563
6580
|
addKeyboardShortcuts() {
|
|
6564
6581
|
return {
|
|
6565
|
-
"Mod-Alt-0": () =>
|
|
6582
|
+
"Mod-Alt-0": () => T(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6566
6583
|
this.editor.state.selection.anchor,
|
|
6567
6584
|
{
|
|
6568
6585
|
type: "paragraph",
|
|
@@ -6587,7 +6604,7 @@ const ue = (e, t, i, o, n) => {
|
|
|
6587
6604
|
},
|
|
6588
6605
|
renderHTML({ HTMLAttributes: e }) {
|
|
6589
6606
|
var t, i;
|
|
6590
|
-
return
|
|
6607
|
+
return F(
|
|
6591
6608
|
this.name,
|
|
6592
6609
|
"p",
|
|
6593
6610
|
{
|
|
@@ -6597,16 +6614,16 @@ const ue = (e, t, i, o, n) => {
|
|
|
6597
6614
|
((i = this.options.domAttributes) == null ? void 0 : i.inlineContent) || {}
|
|
6598
6615
|
);
|
|
6599
6616
|
}
|
|
6600
|
-
}),
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
),
|
|
6617
|
+
}), jo = Z(
|
|
6618
|
+
Do,
|
|
6619
|
+
Uo
|
|
6620
|
+
), zo = A.create({
|
|
6604
6621
|
name: "BlockNoteTableExtension",
|
|
6605
6622
|
addProseMirrorPlugins: () => [
|
|
6606
|
-
|
|
6623
|
+
oi({
|
|
6607
6624
|
cellMinWidth: 100
|
|
6608
6625
|
}),
|
|
6609
|
-
|
|
6626
|
+
ni()
|
|
6610
6627
|
],
|
|
6611
6628
|
addKeyboardShortcuts() {
|
|
6612
6629
|
return {
|
|
@@ -6627,14 +6644,14 @@ const ue = (e, t, i, o, n) => {
|
|
|
6627
6644
|
storage: e.storage
|
|
6628
6645
|
};
|
|
6629
6646
|
return {
|
|
6630
|
-
tableRole:
|
|
6631
|
-
|
|
6647
|
+
tableRole: Dt(
|
|
6648
|
+
jt(e, "tableRole", t)
|
|
6632
6649
|
)
|
|
6633
6650
|
};
|
|
6634
6651
|
}
|
|
6635
|
-
}),
|
|
6636
|
-
...
|
|
6637
|
-
},
|
|
6652
|
+
}), Ro = {
|
|
6653
|
+
...y
|
|
6654
|
+
}, Vo = G({
|
|
6638
6655
|
name: "table",
|
|
6639
6656
|
content: "tableRow+",
|
|
6640
6657
|
group: "blockContent",
|
|
@@ -6645,7 +6662,7 @@ const ue = (e, t, i, o, n) => {
|
|
|
6645
6662
|
},
|
|
6646
6663
|
renderHTML({ HTMLAttributes: e }) {
|
|
6647
6664
|
var t, i;
|
|
6648
|
-
return
|
|
6665
|
+
return F(
|
|
6649
6666
|
this.name,
|
|
6650
6667
|
"table",
|
|
6651
6668
|
{
|
|
@@ -6655,13 +6672,12 @@ const ue = (e, t, i, o, n) => {
|
|
|
6655
6672
|
((i = this.options.domAttributes) == null ? void 0 : i.inlineContent) || {}
|
|
6656
6673
|
);
|
|
6657
6674
|
}
|
|
6658
|
-
}),
|
|
6675
|
+
}), Oo = X.create({
|
|
6659
6676
|
name: "tableParagraph",
|
|
6660
6677
|
group: "tableContent",
|
|
6661
6678
|
content: "inline*",
|
|
6662
6679
|
parseHTML() {
|
|
6663
6680
|
return [
|
|
6664
|
-
{ tag: "td" },
|
|
6665
6681
|
{
|
|
6666
6682
|
tag: "p",
|
|
6667
6683
|
getAttrs: (e) => {
|
|
@@ -6676,74 +6692,74 @@ const ue = (e, t, i, o, n) => {
|
|
|
6676
6692
|
renderHTML({ HTMLAttributes: e }) {
|
|
6677
6693
|
return [
|
|
6678
6694
|
"p",
|
|
6679
|
-
|
|
6695
|
+
zt(this.options.HTMLAttributes, e),
|
|
6680
6696
|
0
|
|
6681
6697
|
];
|
|
6682
6698
|
}
|
|
6683
|
-
}),
|
|
6684
|
-
|
|
6685
|
-
|
|
6699
|
+
}), Fo = Z(
|
|
6700
|
+
Vo,
|
|
6701
|
+
Ro,
|
|
6686
6702
|
[
|
|
6687
|
-
Uo,
|
|
6688
6703
|
zo,
|
|
6689
|
-
|
|
6704
|
+
Oo,
|
|
6705
|
+
ti.extend({
|
|
6690
6706
|
content: "tableContent"
|
|
6691
6707
|
}),
|
|
6692
|
-
|
|
6708
|
+
ei.extend({
|
|
6693
6709
|
content: "tableContent"
|
|
6694
6710
|
}),
|
|
6695
|
-
|
|
6711
|
+
ii
|
|
6696
6712
|
]
|
|
6697
|
-
),
|
|
6698
|
-
paragraph:
|
|
6699
|
-
heading:
|
|
6700
|
-
bulletListItem:
|
|
6701
|
-
numberedListItem:
|
|
6702
|
-
checkListItem:
|
|
6703
|
-
table:
|
|
6704
|
-
file:
|
|
6705
|
-
image:
|
|
6706
|
-
video:
|
|
6707
|
-
audio:
|
|
6708
|
-
},
|
|
6709
|
-
bold: j(
|
|
6710
|
-
italic: j(
|
|
6711
|
-
underline: j(
|
|
6712
|
-
strike: j(
|
|
6713
|
-
code: j(
|
|
6714
|
-
textColor:
|
|
6715
|
-
backgroundColor:
|
|
6716
|
-
},
|
|
6713
|
+
), bt = {
|
|
6714
|
+
paragraph: jo,
|
|
6715
|
+
heading: Eo,
|
|
6716
|
+
bulletListItem: Mo,
|
|
6717
|
+
numberedListItem: Ao,
|
|
6718
|
+
checkListItem: Ho,
|
|
6719
|
+
table: Fo,
|
|
6720
|
+
file: no,
|
|
6721
|
+
image: uo,
|
|
6722
|
+
video: bo,
|
|
6723
|
+
audio: Yi
|
|
6724
|
+
}, Go = ut(bt), _t = {
|
|
6725
|
+
bold: j(Xt, "boolean"),
|
|
6726
|
+
italic: j(Jt, "boolean"),
|
|
6727
|
+
underline: j(Qt, "boolean"),
|
|
6728
|
+
strike: j(Yt, "boolean"),
|
|
6729
|
+
code: j(Zt, "boolean"),
|
|
6730
|
+
textColor: wo,
|
|
6731
|
+
backgroundColor: ko
|
|
6732
|
+
}, jr = mt(_t), kt = {
|
|
6717
6733
|
text: { config: "text", implementation: {} },
|
|
6718
6734
|
link: { config: "link", implementation: {} }
|
|
6719
|
-
},
|
|
6720
|
-
|
|
6735
|
+
}, Wo = pt(
|
|
6736
|
+
kt
|
|
6721
6737
|
);
|
|
6722
|
-
function
|
|
6723
|
-
return e in t.schema.blockSchema && t.schema.blockSchema[e] ===
|
|
6738
|
+
function M(e, t) {
|
|
6739
|
+
return e in t.schema.blockSchema && t.schema.blockSchema[e] === Go[e];
|
|
6724
6740
|
}
|
|
6725
|
-
function
|
|
6726
|
-
return e in t.schema.inlineContentSchema && t.schema.inlineContentSchema[e] ===
|
|
6741
|
+
function Ko(e, t) {
|
|
6742
|
+
return e in t.schema.inlineContentSchema && t.schema.inlineContentSchema[e] === Wo[e];
|
|
6727
6743
|
}
|
|
6728
|
-
function
|
|
6729
|
-
return t.type === e && t.type in i.schema.blockSchema &&
|
|
6744
|
+
function $o(e, t, i) {
|
|
6745
|
+
return t.type === e && t.type in i.schema.blockSchema && M(t.type, i);
|
|
6730
6746
|
}
|
|
6731
|
-
function
|
|
6747
|
+
function zr(e, t) {
|
|
6732
6748
|
return e.type in t.schema.blockSchema && t.schema.blockSchema[e.type].isFileBlock || !1;
|
|
6733
6749
|
}
|
|
6734
|
-
function
|
|
6750
|
+
function Rr(e, t) {
|
|
6735
6751
|
return e.type in t.schema.blockSchema && t.schema.blockSchema[e.type].isFileBlock && "showPreview" in t.schema.blockSchema[e.type].propSchema || !1;
|
|
6736
6752
|
}
|
|
6737
|
-
function
|
|
6753
|
+
function Vr(e, t) {
|
|
6738
6754
|
return t.schema.blockSchema[e.type].isFileBlock && !e.props.url;
|
|
6739
6755
|
}
|
|
6740
|
-
function
|
|
6741
|
-
return t in i.schema.blockSchema && e in i.schema.blockSchema[t].propSchema && i.schema.blockSchema[t].propSchema[e] ===
|
|
6756
|
+
function qo(e, t, i) {
|
|
6757
|
+
return t in i.schema.blockSchema && e in i.schema.blockSchema[t].propSchema && i.schema.blockSchema[t].propSchema[e] === y[e];
|
|
6742
6758
|
}
|
|
6743
|
-
function
|
|
6744
|
-
return
|
|
6759
|
+
function Or(e, t, i) {
|
|
6760
|
+
return qo(e, t.type, i);
|
|
6745
6761
|
}
|
|
6746
|
-
function
|
|
6762
|
+
function Ie(e, t) {
|
|
6747
6763
|
let i, o;
|
|
6748
6764
|
if (t.firstChild.descendants((n, r) => i ? !1 : n.type.name !== "blockContainer" || n.attrs.id !== e ? !0 : (i = n, o = r + 1, !1)), i === void 0 || o === void 0)
|
|
6749
6765
|
throw Error("Could not find block in the editor with matching ID.");
|
|
@@ -6752,13 +6768,13 @@ function Le(e, t) {
|
|
|
6752
6768
|
posBeforeNode: o
|
|
6753
6769
|
};
|
|
6754
6770
|
}
|
|
6755
|
-
function
|
|
6771
|
+
function Xo(e, t, i = "before", o) {
|
|
6756
6772
|
const n = typeof t == "string" ? t : t.id, r = [];
|
|
6757
6773
|
for (const d of e)
|
|
6758
6774
|
r.push(
|
|
6759
6775
|
U(d, o.pmSchema, o.schema.styleSchema)
|
|
6760
6776
|
);
|
|
6761
|
-
const { node: a, posBeforeNode: s } =
|
|
6777
|
+
const { node: a, posBeforeNode: s } = Ie(
|
|
6762
6778
|
n,
|
|
6763
6779
|
o._tiptapEditor.state.doc
|
|
6764
6780
|
);
|
|
@@ -6791,8 +6807,8 @@ function Ko(e, t, i = "before", o) {
|
|
|
6791
6807
|
);
|
|
6792
6808
|
return l;
|
|
6793
6809
|
}
|
|
6794
|
-
function
|
|
6795
|
-
const o = i._tiptapEditor, n = typeof e == "string" ? e : e.id, { posBeforeNode: r } =
|
|
6810
|
+
function Zo(e, t, i) {
|
|
6811
|
+
const o = i._tiptapEditor, n = typeof e == "string" ? e : e.id, { posBeforeNode: r } = Ie(n, o.state.doc);
|
|
6796
6812
|
o.commands.BNUpdateBlock(r + 1, t);
|
|
6797
6813
|
const a = o.state.doc.resolve(r + 1).node();
|
|
6798
6814
|
return C(
|
|
@@ -6803,7 +6819,7 @@ function $o(e, t, i) {
|
|
|
6803
6819
|
i.blockCache
|
|
6804
6820
|
);
|
|
6805
6821
|
}
|
|
6806
|
-
function
|
|
6822
|
+
function yt(e, t, i) {
|
|
6807
6823
|
const o = t._tiptapEditor, n = o.state.tr, r = new Set(
|
|
6808
6824
|
e.map(
|
|
6809
6825
|
(l) => typeof l == "string" ? l : l.id
|
|
@@ -6837,16 +6853,16 @@ function _t(e, t, i) {
|
|
|
6837
6853
|
}
|
|
6838
6854
|
return t.dispatch(n), a;
|
|
6839
6855
|
}
|
|
6840
|
-
function
|
|
6841
|
-
return
|
|
6856
|
+
function Jo(e, t) {
|
|
6857
|
+
return yt(e, t);
|
|
6842
6858
|
}
|
|
6843
|
-
function
|
|
6859
|
+
function Yo(e, t, i) {
|
|
6844
6860
|
const o = [];
|
|
6845
6861
|
for (const s of t)
|
|
6846
6862
|
o.push(
|
|
6847
6863
|
U(s, i.pmSchema, i.schema.styleSchema)
|
|
6848
6864
|
);
|
|
6849
|
-
const n = typeof e[0] == "string" ? e[0] : e[0].id, r =
|
|
6865
|
+
const n = typeof e[0] == "string" ? e[0] : e[0].id, r = yt(
|
|
6850
6866
|
e,
|
|
6851
6867
|
i,
|
|
6852
6868
|
(s, l, d, u) => {
|
|
@@ -6871,7 +6887,7 @@ function Xo(e, t, i) {
|
|
|
6871
6887
|
);
|
|
6872
6888
|
return { insertedBlocks: a, removedBlocks: r };
|
|
6873
6889
|
}
|
|
6874
|
-
function
|
|
6890
|
+
function Qo(e, t, i, o = { updateSelection: !0 }) {
|
|
6875
6891
|
const n = i._tiptapEditor.state.tr;
|
|
6876
6892
|
let { from: r, to: a } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, s = !0, l = !0, d = "";
|
|
6877
6893
|
if (t.forEach((u) => {
|
|
@@ -6880,9 +6896,9 @@ function Zo(e, t, i, o = { updateSelection: !0 }) {
|
|
|
6880
6896
|
const { parent: u } = n.doc.resolve(r);
|
|
6881
6897
|
u.isTextblock && !u.type.spec.code && !u.childCount && (r -= 1, a += 1);
|
|
6882
6898
|
}
|
|
6883
|
-
return s ? n.insertText(d, r, a) : n.replaceWith(r, a, t), o.updateSelection &&
|
|
6899
|
+
return s ? n.insertText(d, r, a) : n.replaceWith(r, a, t), o.updateSelection && Rt(n, n.steps.length - 1, -1), i.dispatch(n), !0;
|
|
6884
6900
|
}
|
|
6885
|
-
function
|
|
6901
|
+
function en() {
|
|
6886
6902
|
const e = (t) => {
|
|
6887
6903
|
let i = t.children.length;
|
|
6888
6904
|
for (let o = 0; o < i; o++) {
|
|
@@ -6898,7 +6914,7 @@ function Jo() {
|
|
|
6898
6914
|
};
|
|
6899
6915
|
return e;
|
|
6900
6916
|
}
|
|
6901
|
-
function
|
|
6917
|
+
function tn() {
|
|
6902
6918
|
const e = H;
|
|
6903
6919
|
if (!e)
|
|
6904
6920
|
throw new Error(
|
|
@@ -6920,43 +6936,43 @@ function Yo() {
|
|
|
6920
6936
|
};
|
|
6921
6937
|
return t;
|
|
6922
6938
|
}
|
|
6923
|
-
function
|
|
6939
|
+
function Ae(e) {
|
|
6924
6940
|
const t = H;
|
|
6925
6941
|
if (!t)
|
|
6926
6942
|
throw new Error(
|
|
6927
6943
|
"cleanHTMLToMarkdown requires ESM dependencies to be initialized"
|
|
6928
6944
|
);
|
|
6929
|
-
return t.unified.unified().use(t.rehypeParse.default, { fragment: !0 }).use(
|
|
6945
|
+
return t.unified.unified().use(t.rehypeParse.default, { fragment: !0 }).use(en).use(tn).use(t.rehypeRemark.default).use(t.remarkGfm.default).use(t.remarkStringify.default, {
|
|
6930
6946
|
handlers: { text: (o) => o.value }
|
|
6931
6947
|
}).processSync(e).value;
|
|
6932
6948
|
}
|
|
6933
|
-
async function
|
|
6934
|
-
await
|
|
6935
|
-
const r =
|
|
6936
|
-
return
|
|
6949
|
+
async function on(e, t, i, o) {
|
|
6950
|
+
await oe();
|
|
6951
|
+
const r = he(t, i).exportBlocks(e, o);
|
|
6952
|
+
return Ae(r);
|
|
6937
6953
|
}
|
|
6938
|
-
function
|
|
6954
|
+
function nn(e) {
|
|
6939
6955
|
return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
|
|
6940
6956
|
}
|
|
6941
|
-
function
|
|
6957
|
+
function rn(e) {
|
|
6942
6958
|
return e.nodeType === 3 && !/\S/.test(e.nodeValue || "");
|
|
6943
6959
|
}
|
|
6944
|
-
function
|
|
6960
|
+
function an(e) {
|
|
6945
6961
|
e.querySelectorAll("li > ul, li > ol").forEach((t) => {
|
|
6946
|
-
const i =
|
|
6962
|
+
const i = nn(t), o = t.parentElement, n = Array.from(o.childNodes).slice(
|
|
6947
6963
|
i + 1
|
|
6948
6964
|
);
|
|
6949
6965
|
t.remove(), n.forEach((r) => {
|
|
6950
6966
|
r.remove();
|
|
6951
6967
|
}), o.insertAdjacentElement("afterend", t), n.reverse().forEach((r) => {
|
|
6952
|
-
if (
|
|
6968
|
+
if (rn(r))
|
|
6953
6969
|
return;
|
|
6954
6970
|
const a = document.createElement("li");
|
|
6955
6971
|
a.append(r), t.insertAdjacentElement("afterend", a);
|
|
6956
6972
|
}), o.childNodes.length === 0 && o.remove();
|
|
6957
6973
|
});
|
|
6958
6974
|
}
|
|
6959
|
-
function
|
|
6975
|
+
function sn(e) {
|
|
6960
6976
|
e.querySelectorAll("li + ul, li + ol").forEach((t) => {
|
|
6961
6977
|
var r, a;
|
|
6962
6978
|
const i = t.previousElementSibling, o = document.createElement("div");
|
|
@@ -6966,19 +6982,19 @@ function nn(e) {
|
|
|
6966
6982
|
n.append(o.nextElementSibling);
|
|
6967
6983
|
});
|
|
6968
6984
|
}
|
|
6969
|
-
let
|
|
6970
|
-
function
|
|
6971
|
-
return
|
|
6985
|
+
let Xe = null;
|
|
6986
|
+
function ln() {
|
|
6987
|
+
return Xe || (Xe = document.implementation.createHTMLDocument("title"));
|
|
6972
6988
|
}
|
|
6973
|
-
function
|
|
6989
|
+
function wt(e) {
|
|
6974
6990
|
if (typeof e == "string") {
|
|
6975
|
-
const t =
|
|
6991
|
+
const t = ln().createElement("div");
|
|
6976
6992
|
t.innerHTML = e, e = t;
|
|
6977
6993
|
}
|
|
6978
|
-
return
|
|
6994
|
+
return an(e), sn(e), e;
|
|
6979
6995
|
}
|
|
6980
|
-
async function
|
|
6981
|
-
const r =
|
|
6996
|
+
async function vt(e, t, i, o, n) {
|
|
6997
|
+
const r = wt(e), s = At.fromSchema(n).parse(r, {
|
|
6982
6998
|
topNode: n.nodes.blockGroup.create()
|
|
6983
6999
|
}), l = [];
|
|
6984
7000
|
for (let d = 0; d < s.childCount; d++)
|
|
@@ -6987,7 +7003,7 @@ async function yt(e, t, i, o, n) {
|
|
|
6987
7003
|
);
|
|
6988
7004
|
return l;
|
|
6989
7005
|
}
|
|
6990
|
-
function
|
|
7006
|
+
function dn(e, t) {
|
|
6991
7007
|
const i = t.value ? t.value + `
|
|
6992
7008
|
` : "", o = {};
|
|
6993
7009
|
t.lang && (o["data-language"] = t.lang);
|
|
@@ -7004,14 +7020,14 @@ function an(e, t) {
|
|
|
7004
7020
|
children: [n]
|
|
7005
7021
|
}, e.patch(t, n), n;
|
|
7006
7022
|
}
|
|
7007
|
-
async function
|
|
7008
|
-
const r = await
|
|
7023
|
+
async function cn(e, t, i, o, n) {
|
|
7024
|
+
const r = await oe(), a = r.unified.unified().use(r.remarkParse.default).use(r.remarkGfm.default).use(r.remarkRehype.default, {
|
|
7009
7025
|
handlers: {
|
|
7010
7026
|
...r.remarkRehype.defaultHandlers,
|
|
7011
|
-
code:
|
|
7027
|
+
code: dn
|
|
7012
7028
|
}
|
|
7013
7029
|
}).use(r.rehypeStringify.default).processSync(e);
|
|
7014
|
-
return
|
|
7030
|
+
return vt(
|
|
7015
7031
|
a.value,
|
|
7016
7032
|
t,
|
|
7017
7033
|
i,
|
|
@@ -7019,7 +7035,7 @@ async function sn(e, t, i, o, n) {
|
|
|
7019
7035
|
n
|
|
7020
7036
|
);
|
|
7021
7037
|
}
|
|
7022
|
-
class
|
|
7038
|
+
class J {
|
|
7023
7039
|
constructor() {
|
|
7024
7040
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
7025
7041
|
c(this, "callbacks", {});
|
|
@@ -7039,7 +7055,7 @@ class Z {
|
|
|
7039
7055
|
this.callbacks = {};
|
|
7040
7056
|
}
|
|
7041
7057
|
}
|
|
7042
|
-
class
|
|
7058
|
+
class un {
|
|
7043
7059
|
constructor(t, i, o, n) {
|
|
7044
7060
|
c(this, "state");
|
|
7045
7061
|
c(this, "emitUpdate");
|
|
@@ -7095,8 +7111,8 @@ class ln {
|
|
|
7095
7111
|
this.pmView.dom.removeEventListener("mousedown", this.mouseDownHandler), this.pmView.dom.removeEventListener("dragstart", this.dragstartHandler), this.pmView.root.removeEventListener("scroll", this.scrollHandler, !0);
|
|
7096
7112
|
}
|
|
7097
7113
|
}
|
|
7098
|
-
const
|
|
7099
|
-
class
|
|
7114
|
+
const ye = new B("FilePanelPlugin");
|
|
7115
|
+
class pn extends J {
|
|
7100
7116
|
constructor(i) {
|
|
7101
7117
|
super();
|
|
7102
7118
|
c(this, "view");
|
|
@@ -7105,11 +7121,11 @@ class dn extends Z {
|
|
|
7105
7121
|
var i;
|
|
7106
7122
|
return (i = this.view) == null ? void 0 : i.closeMenu();
|
|
7107
7123
|
});
|
|
7108
|
-
this.plugin = new
|
|
7109
|
-
key:
|
|
7110
|
-
view: (o) => (this.view = new
|
|
7124
|
+
this.plugin = new v({
|
|
7125
|
+
key: ye,
|
|
7126
|
+
view: (o) => (this.view = new un(
|
|
7111
7127
|
i,
|
|
7112
|
-
|
|
7128
|
+
ye,
|
|
7113
7129
|
o,
|
|
7114
7130
|
(n) => {
|
|
7115
7131
|
this.emit("update", n);
|
|
@@ -7128,7 +7144,7 @@ class dn extends Z {
|
|
|
7128
7144
|
apply: (o) => {
|
|
7129
7145
|
var r;
|
|
7130
7146
|
return {
|
|
7131
|
-
block: (r = o.getMeta(
|
|
7147
|
+
block: (r = o.getMeta(ye)) == null ? void 0 : r.block
|
|
7132
7148
|
};
|
|
7133
7149
|
}
|
|
7134
7150
|
}
|
|
@@ -7142,7 +7158,7 @@ class dn extends Z {
|
|
|
7142
7158
|
return this.on("update", i);
|
|
7143
7159
|
}
|
|
7144
7160
|
}
|
|
7145
|
-
class
|
|
7161
|
+
class hn {
|
|
7146
7162
|
constructor(t, i, o) {
|
|
7147
7163
|
c(this, "state");
|
|
7148
7164
|
c(this, "emitUpdate");
|
|
@@ -7220,26 +7236,26 @@ class cn {
|
|
|
7220
7236
|
}
|
|
7221
7237
|
getSelectionBoundingBox() {
|
|
7222
7238
|
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));
|
|
7223
|
-
if (
|
|
7239
|
+
if (Ot(i)) {
|
|
7224
7240
|
const a = this.pmView.nodeDOM(n);
|
|
7225
7241
|
if (a)
|
|
7226
7242
|
return a.getBoundingClientRect();
|
|
7227
7243
|
}
|
|
7228
|
-
return
|
|
7244
|
+
return Ee(this.pmView, n, r);
|
|
7229
7245
|
}
|
|
7230
7246
|
}
|
|
7231
|
-
const
|
|
7247
|
+
const mn = new B(
|
|
7232
7248
|
"FormattingToolbarPlugin"
|
|
7233
7249
|
);
|
|
7234
|
-
class
|
|
7250
|
+
class fn extends J {
|
|
7235
7251
|
constructor(i) {
|
|
7236
7252
|
super();
|
|
7237
7253
|
c(this, "view");
|
|
7238
7254
|
c(this, "plugin");
|
|
7239
7255
|
c(this, "closeMenu", () => this.view.closeMenu());
|
|
7240
|
-
this.plugin = new
|
|
7241
|
-
key:
|
|
7242
|
-
view: (o) => (this.view = new
|
|
7256
|
+
this.plugin = new v({
|
|
7257
|
+
key: mn,
|
|
7258
|
+
view: (o) => (this.view = new hn(i, o, (n) => {
|
|
7243
7259
|
this.emit("update", n);
|
|
7244
7260
|
}), this.view),
|
|
7245
7261
|
props: {
|
|
@@ -7255,7 +7271,7 @@ class pn extends Z {
|
|
|
7255
7271
|
return this.on("update", i);
|
|
7256
7272
|
}
|
|
7257
7273
|
}
|
|
7258
|
-
class
|
|
7274
|
+
class gn {
|
|
7259
7275
|
constructor(t, i, o) {
|
|
7260
7276
|
c(this, "state");
|
|
7261
7277
|
c(this, "emitUpdate");
|
|
@@ -7273,7 +7289,7 @@ class hn {
|
|
|
7273
7289
|
const i = t.target, o = this.pmView.posAtDOM(i, 0) + 1, n = this.pmView.state.doc.resolve(o), r = n.marks();
|
|
7274
7290
|
for (const a of r)
|
|
7275
7291
|
if (a.type.name === this.pmView.state.schema.mark("link").type.name) {
|
|
7276
|
-
this.mouseHoveredLinkMark = a, this.mouseHoveredLinkMarkRange =
|
|
7292
|
+
this.mouseHoveredLinkMark = a, this.mouseHoveredLinkMarkRange = je(n, a.type, a.attrs) || void 0;
|
|
7277
7293
|
break;
|
|
7278
7294
|
}
|
|
7279
7295
|
}
|
|
@@ -7289,7 +7305,7 @@ class hn {
|
|
|
7289
7305
|
});
|
|
7290
7306
|
c(this, "scrollHandler", () => {
|
|
7291
7307
|
var t;
|
|
7292
|
-
this.linkMark !== void 0 && (t = this.state) != null && t.show && (this.state.referencePos =
|
|
7308
|
+
this.linkMark !== void 0 && (t = this.state) != null && t.show && (this.state.referencePos = Ee(
|
|
7293
7309
|
this.pmView,
|
|
7294
7310
|
this.linkMarkRange.from,
|
|
7295
7311
|
this.linkMarkRange.to
|
|
@@ -7345,7 +7361,7 @@ class hn {
|
|
|
7345
7361
|
const o = this.pmView.state.selection.$from.marks();
|
|
7346
7362
|
for (const n of o)
|
|
7347
7363
|
if (n.type.name === this.pmView.state.schema.mark("link").type.name) {
|
|
7348
|
-
this.keyboardHoveredLinkMark = n, this.keyboardHoveredLinkMarkRange =
|
|
7364
|
+
this.keyboardHoveredLinkMark = n, this.keyboardHoveredLinkMarkRange = je(
|
|
7349
7365
|
this.pmView.state.selection.$from,
|
|
7350
7366
|
n.type,
|
|
7351
7367
|
n.attrs
|
|
@@ -7356,7 +7372,7 @@ class hn {
|
|
|
7356
7372
|
if (this.mouseHoveredLinkMark && (this.linkMark = this.mouseHoveredLinkMark, this.linkMarkRange = this.mouseHoveredLinkMarkRange), this.keyboardHoveredLinkMark && (this.linkMark = this.keyboardHoveredLinkMark, this.linkMarkRange = this.keyboardHoveredLinkMarkRange), this.linkMark && this.editor.isEditable) {
|
|
7357
7373
|
this.state = {
|
|
7358
7374
|
show: !0,
|
|
7359
|
-
referencePos:
|
|
7375
|
+
referencePos: Ee(
|
|
7360
7376
|
this.pmView,
|
|
7361
7377
|
this.linkMarkRange.from,
|
|
7362
7378
|
this.linkMarkRange.to
|
|
@@ -7382,8 +7398,8 @@ class hn {
|
|
|
7382
7398
|
);
|
|
7383
7399
|
}
|
|
7384
7400
|
}
|
|
7385
|
-
const
|
|
7386
|
-
class
|
|
7401
|
+
const bn = new B("LinkToolbarPlugin");
|
|
7402
|
+
class _n extends J {
|
|
7387
7403
|
constructor(i) {
|
|
7388
7404
|
super();
|
|
7389
7405
|
c(this, "view");
|
|
@@ -7421,9 +7437,9 @@ class fn extends Z {
|
|
|
7421
7437
|
this.view.stopMenuUpdateTimer();
|
|
7422
7438
|
});
|
|
7423
7439
|
c(this, "closeMenu", () => this.view.closeMenu());
|
|
7424
|
-
this.plugin = new
|
|
7425
|
-
key:
|
|
7426
|
-
view: (o) => (this.view = new
|
|
7440
|
+
this.plugin = new v({
|
|
7441
|
+
key: bn,
|
|
7442
|
+
view: (o) => (this.view = new gn(i, o, (n) => {
|
|
7427
7443
|
this.emit("update", n);
|
|
7428
7444
|
}), this.view),
|
|
7429
7445
|
props: {
|
|
@@ -7439,7 +7455,7 @@ class fn extends Z {
|
|
|
7439
7455
|
return ((o = (i = this.view) == null ? void 0 : i.state) == null ? void 0 : o.show) || !1;
|
|
7440
7456
|
}
|
|
7441
7457
|
}
|
|
7442
|
-
class
|
|
7458
|
+
class W extends ke {
|
|
7443
7459
|
constructor(i, o) {
|
|
7444
7460
|
super(i, o);
|
|
7445
7461
|
c(this, "nodes");
|
|
@@ -7450,13 +7466,13 @@ class G extends fe {
|
|
|
7450
7466
|
});
|
|
7451
7467
|
}
|
|
7452
7468
|
static create(i, o, n = o) {
|
|
7453
|
-
return new
|
|
7469
|
+
return new W(i.resolve(o), i.resolve(n));
|
|
7454
7470
|
}
|
|
7455
7471
|
content() {
|
|
7456
|
-
return new z(
|
|
7472
|
+
return new z(I.from(this.nodes), 0, 0);
|
|
7457
7473
|
}
|
|
7458
7474
|
eq(i) {
|
|
7459
|
-
if (!(i instanceof
|
|
7475
|
+
if (!(i instanceof W) || this.nodes.length !== i.nodes.length || this.from !== i.from || this.to !== i.to)
|
|
7460
7476
|
return !1;
|
|
7461
7477
|
for (let o = 0; o < this.nodes.length; o++)
|
|
7462
7478
|
if (!this.nodes[o].eq(i.nodes[o]))
|
|
@@ -7465,7 +7481,7 @@ class G extends fe {
|
|
|
7465
7481
|
}
|
|
7466
7482
|
map(i, o) {
|
|
7467
7483
|
const n = o.mapResult(this.from), r = o.mapResult(this.to);
|
|
7468
|
-
return r.deleted ?
|
|
7484
|
+
return r.deleted ? ke.near(i.resolve(n.pos)) : n.deleted ? ke.near(i.resolve(r.pos)) : new W(
|
|
7469
7485
|
i.resolve(n.pos),
|
|
7470
7486
|
i.resolve(r.pos)
|
|
7471
7487
|
);
|
|
@@ -7474,23 +7490,23 @@ class G extends fe {
|
|
|
7474
7490
|
return { type: "node", anchor: this.anchor, head: this.head };
|
|
7475
7491
|
}
|
|
7476
7492
|
}
|
|
7477
|
-
let
|
|
7478
|
-
function
|
|
7493
|
+
let N;
|
|
7494
|
+
function _e(e, t) {
|
|
7479
7495
|
var i, o;
|
|
7480
7496
|
for (; e && e.parentElement && e.parentElement !== t.dom && ((i = e.getAttribute) == null ? void 0 : i.call(e, "data-node-type")) !== "blockContainer"; )
|
|
7481
7497
|
e = e.parentElement;
|
|
7482
7498
|
if (((o = e.getAttribute) == null ? void 0 : o.call(e, "data-node-type")) === "blockContainer")
|
|
7483
7499
|
return { node: e, id: e.getAttribute("data-id") };
|
|
7484
7500
|
}
|
|
7485
|
-
function
|
|
7486
|
-
const i =
|
|
7501
|
+
function kn(e, t) {
|
|
7502
|
+
const i = _e(e, t);
|
|
7487
7503
|
if (i && i.node.nodeType === 1) {
|
|
7488
7504
|
const o = t.docView, n = o.nearestDesc(i.node, !0);
|
|
7489
7505
|
return !n || n === o ? null : n.posBefore;
|
|
7490
7506
|
}
|
|
7491
7507
|
return null;
|
|
7492
7508
|
}
|
|
7493
|
-
function
|
|
7509
|
+
function yn(e, t) {
|
|
7494
7510
|
let i, o;
|
|
7495
7511
|
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);
|
|
7496
7512
|
if (n && r) {
|
|
@@ -7500,7 +7516,7 @@ function bn(e, t) {
|
|
|
7500
7516
|
i = e.from, o = e.to;
|
|
7501
7517
|
return { from: i, to: o };
|
|
7502
7518
|
}
|
|
7503
|
-
function
|
|
7519
|
+
function Ze(e, t, i = t) {
|
|
7504
7520
|
t === i && (i += e.state.doc.resolve(t + 1).node().nodeSize);
|
|
7505
7521
|
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(
|
|
7506
7522
|
n,
|
|
@@ -7513,16 +7529,16 @@ function Xe(e, t, i = t) {
|
|
|
7513
7529
|
);
|
|
7514
7530
|
for (let u = n.childElementCount - 1; u >= 0; u--)
|
|
7515
7531
|
(u > s || u < a) && o.removeChild(o.children[u]);
|
|
7516
|
-
|
|
7532
|
+
xt(e.root), N = o;
|
|
7517
7533
|
const d = e.dom.className.split(" ").filter(
|
|
7518
7534
|
(u) => u !== "ProseMirror" && u !== "bn-root" && u !== "bn-editor"
|
|
7519
7535
|
).join(" ");
|
|
7520
|
-
|
|
7536
|
+
N.className = N.className + " bn-drag-preview " + d, e.root instanceof ShadowRoot ? e.root.appendChild(N) : e.root.body.appendChild(N);
|
|
7521
7537
|
}
|
|
7522
|
-
function
|
|
7523
|
-
|
|
7538
|
+
function xt(e) {
|
|
7539
|
+
N !== void 0 && (e instanceof ShadowRoot ? e.removeChild(N) : e.body.removeChild(N), N = void 0);
|
|
7524
7540
|
}
|
|
7525
|
-
function
|
|
7541
|
+
function wn(e, t) {
|
|
7526
7542
|
if (!e.dataTransfer)
|
|
7527
7543
|
return;
|
|
7528
7544
|
const i = t.prosemirrorView, o = i.dom.getBoundingClientRect(), n = {
|
|
@@ -7533,30 +7549,30 @@ function _n(e, t) {
|
|
|
7533
7549
|
let a;
|
|
7534
7550
|
for (const l of r)
|
|
7535
7551
|
if (i.dom.contains(l)) {
|
|
7536
|
-
a =
|
|
7552
|
+
a = _e(l, i);
|
|
7537
7553
|
break;
|
|
7538
7554
|
}
|
|
7539
7555
|
if (!a)
|
|
7540
7556
|
return;
|
|
7541
|
-
const s =
|
|
7557
|
+
const s = kn(a.node, i);
|
|
7542
7558
|
if (s != null) {
|
|
7543
|
-
const l = i.state.selection, d = i.state.doc, { from: u, to: p } =
|
|
7559
|
+
const l = i.state.selection, d = i.state.doc, { from: u, to: p } = yn(l, d), h = u <= s && s < p, m = l.$anchor.node() !== l.$head.node() || l instanceof W;
|
|
7544
7560
|
h && m ? (i.dispatch(
|
|
7545
|
-
i.state.tr.setSelection(
|
|
7546
|
-
),
|
|
7547
|
-
i.state.tr.setSelection(
|
|
7548
|
-
),
|
|
7549
|
-
const f = i.state.selection.content(), g = t.pmSchema,
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
),
|
|
7561
|
+
i.state.tr.setSelection(W.create(d, u, p))
|
|
7562
|
+
), Ze(i, u, p)) : (i.dispatch(
|
|
7563
|
+
i.state.tr.setSelection(pe.create(i.state.doc, s))
|
|
7564
|
+
), Ze(i, s));
|
|
7565
|
+
const f = i.state.selection.content(), g = t.pmSchema, _ = et.__serializeForClipboard(
|
|
7566
|
+
i,
|
|
7567
|
+
f
|
|
7568
|
+
).dom.innerHTML, b = he(g, t).exportProseMirrorFragment(
|
|
7553
7569
|
f.content,
|
|
7554
7570
|
{}
|
|
7555
|
-
),
|
|
7556
|
-
e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html",
|
|
7571
|
+
), w = Ae(b);
|
|
7572
|
+
e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html", _), e.dataTransfer.setData("text/html", b), e.dataTransfer.setData("text/plain", w), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setDragImage(N, 0, 0), i.dragging = { slice: f, move: !0 };
|
|
7557
7573
|
}
|
|
7558
7574
|
}
|
|
7559
|
-
class
|
|
7575
|
+
class vn {
|
|
7560
7576
|
constructor(t, i, o) {
|
|
7561
7577
|
c(this, "state");
|
|
7562
7578
|
c(this, "emitUpdate");
|
|
@@ -7588,7 +7604,7 @@ class kn {
|
|
|
7588
7604
|
let n;
|
|
7589
7605
|
for (const u of o)
|
|
7590
7606
|
if (this.pmView.dom.contains(u)) {
|
|
7591
|
-
n =
|
|
7607
|
+
n = _e(u, this.pmView);
|
|
7592
7608
|
break;
|
|
7593
7609
|
}
|
|
7594
7610
|
if (!n || !this.editor.isEditable) {
|
|
@@ -7705,7 +7721,7 @@ class kn {
|
|
|
7705
7721
|
), this.pmView.root.addEventListener(
|
|
7706
7722
|
"dragover",
|
|
7707
7723
|
this.onDragOver
|
|
7708
|
-
),
|
|
7724
|
+
), oe(), this.pmView.dom.addEventListener("dragstart", this.onDragStart), this.pmView.root.addEventListener(
|
|
7709
7725
|
"mousemove",
|
|
7710
7726
|
this.onMouseMove,
|
|
7711
7727
|
!0
|
|
@@ -7756,7 +7772,7 @@ class kn {
|
|
|
7756
7772
|
});
|
|
7757
7773
|
if (!o)
|
|
7758
7774
|
return;
|
|
7759
|
-
const n =
|
|
7775
|
+
const n = k(
|
|
7760
7776
|
this.editor._tiptapEditor.state.doc,
|
|
7761
7777
|
o.pos
|
|
7762
7778
|
);
|
|
@@ -7771,8 +7787,8 @@ class kn {
|
|
|
7771
7787
|
this.editor.openSuggestionMenu("/");
|
|
7772
7788
|
}
|
|
7773
7789
|
}
|
|
7774
|
-
const
|
|
7775
|
-
class
|
|
7790
|
+
const xn = new B("SideMenuPlugin");
|
|
7791
|
+
class En extends J {
|
|
7776
7792
|
constructor(i) {
|
|
7777
7793
|
super();
|
|
7778
7794
|
c(this, "view");
|
|
@@ -7786,12 +7802,12 @@ class wn extends Z {
|
|
|
7786
7802
|
* Handles drag & drop events for blocks.
|
|
7787
7803
|
*/
|
|
7788
7804
|
c(this, "blockDragStart", (i) => {
|
|
7789
|
-
this.view.isDragging = !0,
|
|
7805
|
+
this.view.isDragging = !0, wn(i, this.editor);
|
|
7790
7806
|
});
|
|
7791
7807
|
/**
|
|
7792
7808
|
* Handles drag & drop events for blocks.
|
|
7793
7809
|
*/
|
|
7794
|
-
c(this, "blockDragEnd", () =>
|
|
7810
|
+
c(this, "blockDragEnd", () => xt(this.editor.prosemirrorView.root));
|
|
7795
7811
|
/**
|
|
7796
7812
|
* Freezes the side menu. When frozen, the side menu will stay
|
|
7797
7813
|
* attached to the same block regardless of which block is hovered by the
|
|
@@ -7806,9 +7822,9 @@ class wn extends Z {
|
|
|
7806
7822
|
c(this, "unfreezeMenu", () => {
|
|
7807
7823
|
this.view.menuFrozen = !1, this.view.state.show = !1, this.view.emitUpdate(this.view.state);
|
|
7808
7824
|
});
|
|
7809
|
-
this.editor = i, this.plugin = new
|
|
7810
|
-
key:
|
|
7811
|
-
view: (o) => (this.view = new
|
|
7825
|
+
this.editor = i, this.plugin = new v({
|
|
7826
|
+
key: xn,
|
|
7827
|
+
view: (o) => (this.view = new vn(i, o, (n) => {
|
|
7812
7828
|
this.emit("update", n);
|
|
7813
7829
|
}), this.view)
|
|
7814
7830
|
});
|
|
@@ -7817,8 +7833,8 @@ class wn extends Z {
|
|
|
7817
7833
|
return this.on("update", i);
|
|
7818
7834
|
}
|
|
7819
7835
|
}
|
|
7820
|
-
const
|
|
7821
|
-
class
|
|
7836
|
+
const Cn = Ft((e) => e.type.name === "blockContainer");
|
|
7837
|
+
class Sn {
|
|
7822
7838
|
constructor(t, i) {
|
|
7823
7839
|
c(this, "state");
|
|
7824
7840
|
c(this, "emitUpdate");
|
|
@@ -7838,7 +7854,7 @@ class xn {
|
|
|
7838
7854
|
c(this, "closeMenu", () => {
|
|
7839
7855
|
this.editor.dispatch(
|
|
7840
7856
|
this.editor._tiptapEditor.view.state.tr.setMeta(
|
|
7841
|
-
|
|
7857
|
+
K,
|
|
7842
7858
|
null
|
|
7843
7859
|
)
|
|
7844
7860
|
);
|
|
@@ -7861,7 +7877,7 @@ class xn {
|
|
|
7861
7877
|
}
|
|
7862
7878
|
update(t, i) {
|
|
7863
7879
|
var d;
|
|
7864
|
-
const o =
|
|
7880
|
+
const o = K.getState(i), n = K.getState(
|
|
7865
7881
|
t.state
|
|
7866
7882
|
), r = o === void 0 && n !== void 0, a = o !== void 0 && n === void 0;
|
|
7867
7883
|
if (!r && !(o !== void 0 && n !== void 0) && !a)
|
|
@@ -7884,8 +7900,8 @@ class xn {
|
|
|
7884
7900
|
(t = this.rootEl) == null || t.removeEventListener("scroll", this.handleScroll, !0);
|
|
7885
7901
|
}
|
|
7886
7902
|
}
|
|
7887
|
-
const
|
|
7888
|
-
class
|
|
7903
|
+
const K = new B("SuggestionMenuPlugin");
|
|
7904
|
+
class Mn extends J {
|
|
7889
7905
|
constructor(i) {
|
|
7890
7906
|
super();
|
|
7891
7907
|
c(this, "view");
|
|
@@ -7903,9 +7919,9 @@ class En extends Z {
|
|
|
7903
7919
|
c(this, "closeMenu", () => this.view.closeMenu());
|
|
7904
7920
|
c(this, "clearQuery", () => this.view.clearQuery());
|
|
7905
7921
|
const o = this.triggerCharacters;
|
|
7906
|
-
this.plugin = new
|
|
7907
|
-
key:
|
|
7908
|
-
view: () => (this.view = new
|
|
7922
|
+
this.plugin = new v({
|
|
7923
|
+
key: K,
|
|
7924
|
+
view: () => (this.view = new Sn(
|
|
7909
7925
|
i,
|
|
7910
7926
|
(n, r) => {
|
|
7911
7927
|
this.emit(`update ${n}`, r);
|
|
@@ -7919,7 +7935,7 @@ class En extends Z {
|
|
|
7919
7935
|
apply(n, r, a, s) {
|
|
7920
7936
|
if (n.getMeta("orderedListIndexing") !== void 0)
|
|
7921
7937
|
return r;
|
|
7922
|
-
const l = n.getMeta(
|
|
7938
|
+
const l = n.getMeta(K);
|
|
7923
7939
|
if (typeof l == "object" && l !== null && r === void 0)
|
|
7924
7940
|
return {
|
|
7925
7941
|
triggerCharacter: l.triggerCharacter,
|
|
@@ -7951,7 +7967,7 @@ class En extends Z {
|
|
|
7951
7967
|
handleTextInput(n, r, a, s) {
|
|
7952
7968
|
const l = this.getState(n.state);
|
|
7953
7969
|
return o.includes(s) && l === void 0 ? (n.dispatch(
|
|
7954
|
-
n.state.tr.insertText(s).scrollIntoView().setMeta(
|
|
7970
|
+
n.state.tr.insertText(s).scrollIntoView().setMeta(K, {
|
|
7955
7971
|
triggerCharacter: s
|
|
7956
7972
|
})
|
|
7957
7973
|
), !0) : !1;
|
|
@@ -7962,10 +7978,10 @@ class En extends Z {
|
|
|
7962
7978
|
if (r === void 0)
|
|
7963
7979
|
return null;
|
|
7964
7980
|
if (!r.deleteTriggerCharacter) {
|
|
7965
|
-
const a =
|
|
7981
|
+
const a = Cn(n.selection);
|
|
7966
7982
|
if (a)
|
|
7967
|
-
return
|
|
7968
|
-
|
|
7983
|
+
return $.create(n.doc, [
|
|
7984
|
+
q.node(
|
|
7969
7985
|
a.pos,
|
|
7970
7986
|
a.pos + a.node.nodeSize,
|
|
7971
7987
|
{
|
|
@@ -7976,8 +7992,8 @@ class En extends Z {
|
|
|
7976
7992
|
)
|
|
7977
7993
|
]);
|
|
7978
7994
|
}
|
|
7979
|
-
return
|
|
7980
|
-
|
|
7995
|
+
return $.create(n.doc, [
|
|
7996
|
+
q.inline(
|
|
7981
7997
|
r.queryStartPos - r.triggerCharacter.length,
|
|
7982
7998
|
r.queryStartPos,
|
|
7983
7999
|
{
|
|
@@ -7999,68 +8015,75 @@ class En extends Z {
|
|
|
7999
8015
|
return ((o = (i = this.view) == null ? void 0 : i.state) == null ? void 0 : o.show) || !1;
|
|
8000
8016
|
}
|
|
8001
8017
|
}
|
|
8002
|
-
function
|
|
8018
|
+
function Fr(e, t) {
|
|
8003
8019
|
e.suggestionMenus.addTriggerCharacter(t);
|
|
8004
8020
|
}
|
|
8005
8021
|
let E;
|
|
8006
|
-
function
|
|
8022
|
+
function Je(e) {
|
|
8007
8023
|
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));
|
|
8008
8024
|
}
|
|
8009
|
-
function
|
|
8025
|
+
function Tn(e) {
|
|
8010
8026
|
E && (e instanceof Document ? e.body.removeChild(E) : e.removeChild(E), E = void 0);
|
|
8011
8027
|
}
|
|
8012
|
-
function
|
|
8028
|
+
function se(e) {
|
|
8013
8029
|
return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
|
|
8014
8030
|
}
|
|
8015
|
-
function
|
|
8031
|
+
function Bn(e) {
|
|
8016
8032
|
for (; e && e.nodeName !== "TD" && e.nodeName !== "TH"; )
|
|
8017
8033
|
e = e.classList && e.classList.contains("ProseMirror") ? null : e.parentNode;
|
|
8018
8034
|
return e;
|
|
8019
8035
|
}
|
|
8020
|
-
function
|
|
8036
|
+
function Ln(e, t) {
|
|
8021
8037
|
e.forEach((i) => {
|
|
8022
8038
|
const o = t.querySelectorAll(i);
|
|
8023
8039
|
for (let n = 0; n < o.length; n++)
|
|
8024
8040
|
o[n].style.visibility = "hidden";
|
|
8025
8041
|
});
|
|
8026
8042
|
}
|
|
8027
|
-
class
|
|
8043
|
+
class In {
|
|
8028
8044
|
constructor(t, i, o) {
|
|
8029
8045
|
c(this, "state");
|
|
8030
8046
|
c(this, "emitUpdate");
|
|
8031
8047
|
c(this, "tableId");
|
|
8032
8048
|
c(this, "tablePos");
|
|
8033
8049
|
c(this, "menuFrozen", !1);
|
|
8050
|
+
c(this, "mouseState", "up");
|
|
8034
8051
|
c(this, "prevWasEditable", null);
|
|
8052
|
+
c(this, "viewMousedownHandler", () => {
|
|
8053
|
+
this.mouseState = "down";
|
|
8054
|
+
});
|
|
8055
|
+
c(this, "viewMouseupHandler", (t) => {
|
|
8056
|
+
this.mouseState = "up", this.mouseMoveHandler(t);
|
|
8057
|
+
});
|
|
8035
8058
|
c(this, "mouseMoveHandler", (t) => {
|
|
8036
|
-
var d, u, p;
|
|
8037
|
-
if (this.menuFrozen)
|
|
8059
|
+
var d, u, p, h;
|
|
8060
|
+
if (this.menuFrozen || (this.mouseState === "down" && (this.mouseState = "selecting", (d = this.state) != null && d.show && (this.state.show = !1, this.emitUpdate())), this.mouseState === "selecting"))
|
|
8038
8061
|
return;
|
|
8039
|
-
const i =
|
|
8062
|
+
const i = Bn(t.target);
|
|
8040
8063
|
if (!i || !this.editor.isEditable) {
|
|
8041
|
-
(
|
|
8064
|
+
(u = this.state) != null && u.show && (this.state.show = !1, this.emitUpdate());
|
|
8042
8065
|
return;
|
|
8043
8066
|
}
|
|
8044
|
-
const o =
|
|
8067
|
+
const o = se(i), n = se(i.parentElement), r = i.getBoundingClientRect(), a = (h = (p = i.parentElement) == null ? void 0 : p.parentElement) == null ? void 0 : h.getBoundingClientRect();
|
|
8045
8068
|
if (!a)
|
|
8046
8069
|
return;
|
|
8047
|
-
const s =
|
|
8070
|
+
const s = _e(i, this.pmView);
|
|
8048
8071
|
if (!s)
|
|
8049
8072
|
return;
|
|
8050
8073
|
let l;
|
|
8051
|
-
if (this.editor._tiptapEditor.state.doc.descendants((
|
|
8074
|
+
if (this.editor._tiptapEditor.state.doc.descendants((m, f) => {
|
|
8052
8075
|
if (typeof l < "u")
|
|
8053
8076
|
return !1;
|
|
8054
|
-
if (
|
|
8077
|
+
if (m.type.name !== "blockContainer" || m.attrs.id !== s.id)
|
|
8055
8078
|
return !0;
|
|
8056
|
-
const
|
|
8057
|
-
|
|
8079
|
+
const g = C(
|
|
8080
|
+
m,
|
|
8058
8081
|
this.editor.schema.blockSchema,
|
|
8059
8082
|
this.editor.schema.inlineContentSchema,
|
|
8060
8083
|
this.editor.schema.styleSchema,
|
|
8061
8084
|
this.editor.blockCache
|
|
8062
8085
|
);
|
|
8063
|
-
return
|
|
8086
|
+
return $o("table", g, this.editor) && (this.tablePos = f + 1, l = g), !1;
|
|
8064
8087
|
}), !!l && (this.tableId = s.id, !(this.state !== void 0 && this.state.show && this.tableId === s.id && this.state.rowIndex === n && this.state.colIndex === o)))
|
|
8065
8088
|
return this.state = {
|
|
8066
8089
|
show: !0,
|
|
@@ -8076,7 +8099,7 @@ class Tn {
|
|
|
8076
8099
|
var h;
|
|
8077
8100
|
if (((h = this.state) == null ? void 0 : h.draggingState) === void 0)
|
|
8078
8101
|
return;
|
|
8079
|
-
t.preventDefault(), t.dataTransfer.dropEffect = "move",
|
|
8102
|
+
t.preventDefault(), t.dataTransfer.dropEffect = "move", Ln(
|
|
8080
8103
|
[
|
|
8081
8104
|
"column-resize-handle",
|
|
8082
8105
|
"prosemirror-dropcursor-block",
|
|
@@ -8102,11 +8125,11 @@ class Tn {
|
|
|
8102
8125
|
);
|
|
8103
8126
|
const n = o[0];
|
|
8104
8127
|
let r = !1;
|
|
8105
|
-
const a =
|
|
8128
|
+
const a = se(n.parentElement), s = se(n), l = this.state.draggingState.draggedCellOrientation === "row" ? this.state.rowIndex : this.state.colIndex, u = (this.state.draggingState.draggedCellOrientation === "row" ? a : s) !== l;
|
|
8106
8129
|
(this.state.rowIndex !== a || this.state.colIndex !== s) && (this.state.rowIndex = a, this.state.colIndex = s, this.state.referencePosCell = n.getBoundingClientRect(), r = !0);
|
|
8107
8130
|
const p = this.state.draggingState.draggedCellOrientation === "row" ? i.top : i.left;
|
|
8108
8131
|
this.state.draggingState.mousePos !== p && (this.state.draggingState.mousePos = p, r = !0), r && this.emitUpdate(), u && this.editor.dispatch(
|
|
8109
|
-
this.pmView.state.tr.setMeta(
|
|
8132
|
+
this.pmView.state.tr.setMeta(ee, !0)
|
|
8110
8133
|
);
|
|
8111
8134
|
});
|
|
8112
8135
|
c(this, "dropHandler", (t) => {
|
|
@@ -8148,7 +8171,7 @@ class Tn {
|
|
|
8148
8171
|
if (!this.state)
|
|
8149
8172
|
throw new Error("Attempting to update uninitialized image toolbar");
|
|
8150
8173
|
o(this.state);
|
|
8151
|
-
}, i.dom.addEventListener("mousemove", this.mouseMoveHandler), i.root.addEventListener(
|
|
8174
|
+
}, i.dom.addEventListener("mousemove", this.mouseMoveHandler), i.dom.addEventListener("mousedown", this.viewMousedownHandler), i.dom.addEventListener("mouseup", this.viewMouseupHandler), i.root.addEventListener(
|
|
8152
8175
|
"dragover",
|
|
8153
8176
|
this.dragOverHandler
|
|
8154
8177
|
), i.root.addEventListener("drop", this.dropHandler), i.root.addEventListener("scroll", this.scrollHandler, !0);
|
|
@@ -8163,8 +8186,8 @@ class Tn {
|
|
|
8163
8186
|
), this.pmView.root.removeEventListener("scroll", this.scrollHandler, !0);
|
|
8164
8187
|
}
|
|
8165
8188
|
}
|
|
8166
|
-
const
|
|
8167
|
-
class
|
|
8189
|
+
const ee = new B("TableHandlesPlugin");
|
|
8190
|
+
class An extends J {
|
|
8168
8191
|
constructor(i) {
|
|
8169
8192
|
super();
|
|
8170
8193
|
c(this, "view");
|
|
@@ -8183,13 +8206,13 @@ class Bn extends Z {
|
|
|
8183
8206
|
originalIndex: this.view.state.colIndex,
|
|
8184
8207
|
mousePos: i.clientX
|
|
8185
8208
|
}, this.view.emitUpdate(), this.editor.dispatch(
|
|
8186
|
-
this.editor._tiptapEditor.state.tr.setMeta(
|
|
8209
|
+
this.editor._tiptapEditor.state.tr.setMeta(ee, {
|
|
8187
8210
|
draggedCellOrientation: this.view.state.draggingState.draggedCellOrientation,
|
|
8188
8211
|
originalIndex: this.view.state.colIndex,
|
|
8189
8212
|
newIndex: this.view.state.colIndex,
|
|
8190
8213
|
tablePos: this.view.tablePos
|
|
8191
8214
|
})
|
|
8192
|
-
),
|
|
8215
|
+
), Je(this.editor._tiptapEditor.view.root), i.dataTransfer.setDragImage(E, 0, 0), i.dataTransfer.effectAllowed = "move";
|
|
8193
8216
|
});
|
|
8194
8217
|
/**
|
|
8195
8218
|
* Callback that should be set on the `dragStart` event for whichever element
|
|
@@ -8205,13 +8228,13 @@ class Bn extends Z {
|
|
|
8205
8228
|
originalIndex: this.view.state.rowIndex,
|
|
8206
8229
|
mousePos: i.clientY
|
|
8207
8230
|
}, this.view.emitUpdate(), this.editor.dispatch(
|
|
8208
|
-
this.editor._tiptapEditor.state.tr.setMeta(
|
|
8231
|
+
this.editor._tiptapEditor.state.tr.setMeta(ee, {
|
|
8209
8232
|
draggedCellOrientation: this.view.state.draggingState.draggedCellOrientation,
|
|
8210
8233
|
originalIndex: this.view.state.rowIndex,
|
|
8211
8234
|
newIndex: this.view.state.rowIndex,
|
|
8212
8235
|
tablePos: this.view.tablePos
|
|
8213
8236
|
})
|
|
8214
|
-
),
|
|
8237
|
+
), Je(this.editor._tiptapEditor.view.root), i.dataTransfer.setDragImage(E, 0, 0), i.dataTransfer.effectAllowed = "copyMove";
|
|
8215
8238
|
});
|
|
8216
8239
|
/**
|
|
8217
8240
|
* Callback that should be set on the `dragEnd` event for both the element
|
|
@@ -8223,8 +8246,8 @@ class Bn extends Z {
|
|
|
8223
8246
|
"Attempted to drag table row, but no table block was hovered prior."
|
|
8224
8247
|
);
|
|
8225
8248
|
this.view.state.draggingState = void 0, this.view.emitUpdate(), this.editor.dispatch(
|
|
8226
|
-
this.editor._tiptapEditor.state.tr.setMeta(
|
|
8227
|
-
),
|
|
8249
|
+
this.editor._tiptapEditor.state.tr.setMeta(ee, null)
|
|
8250
|
+
), Tn(this.editor._tiptapEditor.view.root);
|
|
8228
8251
|
});
|
|
8229
8252
|
/**
|
|
8230
8253
|
* Freezes the drag handles. When frozen, they will stay attached to the same
|
|
@@ -8240,9 +8263,9 @@ class Bn extends Z {
|
|
|
8240
8263
|
c(this, "unfreezeHandles", () => {
|
|
8241
8264
|
this.view.menuFrozen = !1;
|
|
8242
8265
|
});
|
|
8243
|
-
this.editor = i, this.plugin = new
|
|
8244
|
-
key:
|
|
8245
|
-
view: (o) => (this.view = new
|
|
8266
|
+
this.editor = i, this.plugin = new v({
|
|
8267
|
+
key: ee,
|
|
8268
|
+
view: (o) => (this.view = new In(i, o, (n) => {
|
|
8246
8269
|
this.emit("update", n);
|
|
8247
8270
|
}), this.view),
|
|
8248
8271
|
// We use decorations to render the drop cursor when dragging a table row
|
|
@@ -8253,7 +8276,7 @@ class Bn extends Z {
|
|
|
8253
8276
|
return;
|
|
8254
8277
|
const n = this.view.state.draggingState.draggedCellOrientation === "row" ? this.view.state.rowIndex : this.view.state.colIndex, r = [];
|
|
8255
8278
|
if (n === this.view.state.draggingState.originalIndex)
|
|
8256
|
-
return
|
|
8279
|
+
return $.create(o.doc, r);
|
|
8257
8280
|
const a = o.doc.resolve(this.view.tablePos + 1), s = a.node();
|
|
8258
8281
|
if (this.view.state.draggingState.draggedCellOrientation === "row") {
|
|
8259
8282
|
const l = o.doc.resolve(
|
|
@@ -8265,7 +8288,7 @@ class Bn extends Z {
|
|
|
8265
8288
|
), h = p.node(), m = p.pos + (n > this.view.state.draggingState.originalIndex ? h.nodeSize - 2 : 0);
|
|
8266
8289
|
r.push(
|
|
8267
8290
|
// The widget is a small bar which spans the width of the cell.
|
|
8268
|
-
|
|
8291
|
+
q.widget(m, () => {
|
|
8269
8292
|
const f = document.createElement("div");
|
|
8270
8293
|
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;
|
|
8271
8294
|
})
|
|
@@ -8280,13 +8303,13 @@ class Bn extends Z {
|
|
|
8280
8303
|
), p = u.node(), h = u.pos + (n > this.view.state.draggingState.originalIndex ? p.nodeSize - 2 : 0);
|
|
8281
8304
|
r.push(
|
|
8282
8305
|
// The widget is a small bar which spans the height of the cell.
|
|
8283
|
-
|
|
8306
|
+
q.widget(h, () => {
|
|
8284
8307
|
const m = document.createElement("div");
|
|
8285
8308
|
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;
|
|
8286
8309
|
})
|
|
8287
8310
|
);
|
|
8288
8311
|
}
|
|
8289
|
-
return
|
|
8312
|
+
return $.create(o.doc, r);
|
|
8290
8313
|
}
|
|
8291
8314
|
}
|
|
8292
8315
|
});
|
|
@@ -8295,45 +8318,57 @@ class Bn extends Z {
|
|
|
8295
8318
|
return this.on("update", i);
|
|
8296
8319
|
}
|
|
8297
8320
|
}
|
|
8298
|
-
async function
|
|
8299
|
-
|
|
8300
|
-
|
|
8301
|
-
|
|
8302
|
-
|
|
8303
|
-
i,
|
|
8304
|
-
{}
|
|
8321
|
+
async function Et(e, t) {
|
|
8322
|
+
"node" in e.state.selection && e.state.selection.node.type.spec.group === "blockContent" && t.dispatch(
|
|
8323
|
+
t._tiptapEditor.state.tr.setSelection(
|
|
8324
|
+
new pe(e.state.doc.resolve(e.state.selection.from - 1))
|
|
8325
|
+
)
|
|
8305
8326
|
);
|
|
8306
|
-
|
|
8307
|
-
|
|
8327
|
+
const i = et.__serializeForClipboard(
|
|
8328
|
+
e,
|
|
8329
|
+
e.state.selection.content()
|
|
8330
|
+
).dom.innerHTML;
|
|
8331
|
+
let o = e.state.selection.content().content, n = !1;
|
|
8332
|
+
const r = e.state.selection instanceof ri;
|
|
8333
|
+
if (!r) {
|
|
8334
|
+
const d = e.state.doc.slice(
|
|
8335
|
+
e.state.selection.from,
|
|
8336
|
+
e.state.selection.to,
|
|
8337
|
+
!1
|
|
8338
|
+
).content, u = [];
|
|
8339
|
+
for (let p = 0; p < d.childCount; p++)
|
|
8340
|
+
u.push(d.child(p));
|
|
8341
|
+
n = u.find(
|
|
8342
|
+
(p) => p.type.name === "blockContainer" || p.type.name === "blockGroup" || p.type.spec.group === "blockContent"
|
|
8343
|
+
) === void 0, n && (o = d);
|
|
8344
|
+
}
|
|
8345
|
+
await oe();
|
|
8346
|
+
const s = he(
|
|
8308
8347
|
e.state.schema,
|
|
8309
8348
|
t
|
|
8310
8349
|
).exportProseMirrorFragment(
|
|
8311
|
-
|
|
8312
|
-
{}
|
|
8313
|
-
),
|
|
8314
|
-
return {
|
|
8315
|
-
}
|
|
8316
|
-
const
|
|
8317
|
-
i.preventDefault(), i.clipboardData.clearData(),
|
|
8318
|
-
e
|
|
8319
|
-
new le(t.state.doc.resolve(t.state.selection.from - 1))
|
|
8320
|
-
)
|
|
8321
|
-
), (async () => {
|
|
8322
|
-
const { internalHTML: o, externalHTML: n, plainText: r } = await vt(t, e);
|
|
8350
|
+
o,
|
|
8351
|
+
{ simplifyBlocks: !n && !r }
|
|
8352
|
+
), l = Ae(s);
|
|
8353
|
+
return { clipboardHTML: i, externalHTML: s, markdown: l };
|
|
8354
|
+
}
|
|
8355
|
+
const Ye = (e, t, i) => {
|
|
8356
|
+
i.preventDefault(), i.clipboardData.clearData(), (async () => {
|
|
8357
|
+
const { clipboardHTML: o, externalHTML: n, markdown: r } = await Et(t, e);
|
|
8323
8358
|
i.clipboardData.setData("blocknote/html", o), i.clipboardData.setData("text/html", n), i.clipboardData.setData("text/plain", r);
|
|
8324
8359
|
})();
|
|
8325
|
-
},
|
|
8360
|
+
}, Nn = (e) => A.create({
|
|
8326
8361
|
name: "copyToClipboard",
|
|
8327
8362
|
addProseMirrorPlugins() {
|
|
8328
8363
|
return [
|
|
8329
|
-
new
|
|
8364
|
+
new v({
|
|
8330
8365
|
props: {
|
|
8331
8366
|
handleDOMEvents: {
|
|
8332
8367
|
copy(t, i) {
|
|
8333
|
-
return
|
|
8368
|
+
return Ye(e, t, i), !0;
|
|
8334
8369
|
},
|
|
8335
8370
|
cut(t, i) {
|
|
8336
|
-
return
|
|
8371
|
+
return Ye(e, t, i), t.dispatch(t.state.tr.deleteSelection()), !0;
|
|
8337
8372
|
},
|
|
8338
8373
|
// This is for the use-case in which only a block without content
|
|
8339
8374
|
// is selected, e.g. an image block, and dragged (not using the
|
|
@@ -8342,12 +8377,12 @@ const Je = (e, t, i) => {
|
|
|
8342
8377
|
if ("node" in t.state.selection && t.state.selection.node.type.spec.group === "blockContent")
|
|
8343
8378
|
return e.dispatch(
|
|
8344
8379
|
e._tiptapEditor.state.tr.setSelection(
|
|
8345
|
-
new
|
|
8380
|
+
new pe(
|
|
8346
8381
|
t.state.doc.resolve(t.state.selection.from - 1)
|
|
8347
8382
|
)
|
|
8348
8383
|
)
|
|
8349
8384
|
), i.preventDefault(), i.dataTransfer.clearData(), (async () => {
|
|
8350
|
-
const {
|
|
8385
|
+
const { clipboardHTML: o, externalHTML: n, markdown: r } = await Et(t, e);
|
|
8351
8386
|
i.dataTransfer.setData("blocknote/html", o), i.dataTransfer.setData("text/html", n), i.dataTransfer.setData("text/plain", r);
|
|
8352
8387
|
})(), !0;
|
|
8353
8388
|
}
|
|
@@ -8356,18 +8391,18 @@ const Je = (e, t, i) => {
|
|
|
8356
8391
|
})
|
|
8357
8392
|
];
|
|
8358
8393
|
}
|
|
8359
|
-
}),
|
|
8394
|
+
}), Ne = [
|
|
8360
8395
|
"blocknote/html",
|
|
8361
8396
|
"Files",
|
|
8362
8397
|
"text/html",
|
|
8363
8398
|
"text/plain"
|
|
8364
8399
|
];
|
|
8365
|
-
function
|
|
8400
|
+
function Pn(e, t) {
|
|
8366
8401
|
if (!e.startsWith(".") || !t.startsWith("."))
|
|
8367
8402
|
throw new Error("The strings provided are not valid file extensions.");
|
|
8368
8403
|
return e === t;
|
|
8369
8404
|
}
|
|
8370
|
-
function
|
|
8405
|
+
function Hn(e, t) {
|
|
8371
8406
|
const i = e.split("/"), o = t.split("/");
|
|
8372
8407
|
if (i.length !== 2)
|
|
8373
8408
|
throw new Error(`The string ${e} is not a valid MIME type.`);
|
|
@@ -8375,14 +8410,14 @@ function An(e, t) {
|
|
|
8375
8410
|
throw new Error(`The string ${t} is not a valid MIME type.`);
|
|
8376
8411
|
return i[1] === "*" || o[1] === "*" ? i[0] === o[0] : (i[0] === "*" || o[0] === "*" || i[0] === o[0]) && i[1] === o[1];
|
|
8377
8412
|
}
|
|
8378
|
-
async function
|
|
8413
|
+
async function Ct(e, t) {
|
|
8379
8414
|
if (!t.uploadFile)
|
|
8380
8415
|
return;
|
|
8381
8416
|
const i = "dataTransfer" in e ? e.dataTransfer : e.clipboardData;
|
|
8382
8417
|
if (i === null)
|
|
8383
8418
|
return;
|
|
8384
8419
|
let o = null;
|
|
8385
|
-
for (const a of
|
|
8420
|
+
for (const a of Ne)
|
|
8386
8421
|
if (i.types.includes(a)) {
|
|
8387
8422
|
o = a;
|
|
8388
8423
|
break;
|
|
@@ -8401,7 +8436,7 @@ async function xt(e, t) {
|
|
|
8401
8436
|
for (const d of r)
|
|
8402
8437
|
for (const u of d.fileBlockAccept || []) {
|
|
8403
8438
|
const p = u.startsWith("."), h = n[a].getAsFile();
|
|
8404
|
-
if (h && (!p && h.type &&
|
|
8439
|
+
if (h && (!p && h.type && Hn(n[a].type, u) || p && Pn(
|
|
8405
8440
|
"." + h.name.split(".").pop(),
|
|
8406
8441
|
u
|
|
8407
8442
|
))) {
|
|
@@ -8431,7 +8466,7 @@ async function xt(e, t) {
|
|
|
8431
8466
|
}, f = t._tiptapEditor.view.posAtCoords(m);
|
|
8432
8467
|
if (!f)
|
|
8433
8468
|
return;
|
|
8434
|
-
const g =
|
|
8469
|
+
const g = k(
|
|
8435
8470
|
t._tiptapEditor.state.doc,
|
|
8436
8471
|
f.pos
|
|
8437
8472
|
);
|
|
@@ -8451,58 +8486,58 @@ async function xt(e, t) {
|
|
|
8451
8486
|
}
|
|
8452
8487
|
}
|
|
8453
8488
|
}
|
|
8454
|
-
const
|
|
8489
|
+
const Un = (e) => A.create({
|
|
8455
8490
|
name: "dropFile",
|
|
8456
8491
|
addProseMirrorPlugins() {
|
|
8457
8492
|
return [
|
|
8458
|
-
new
|
|
8493
|
+
new v({
|
|
8459
8494
|
props: {
|
|
8460
8495
|
handleDOMEvents: {
|
|
8461
8496
|
drop(t, i) {
|
|
8462
8497
|
if (!e.isEditable)
|
|
8463
8498
|
return;
|
|
8464
8499
|
let o = null;
|
|
8465
|
-
for (const n of
|
|
8500
|
+
for (const n of Ne)
|
|
8466
8501
|
if (i.dataTransfer.types.includes(n)) {
|
|
8467
8502
|
o = n;
|
|
8468
8503
|
break;
|
|
8469
8504
|
}
|
|
8470
|
-
return o === null ? !0 : o === "Files" ? (
|
|
8505
|
+
return o === null ? !0 : o === "Files" ? (Ct(i, e), !0) : !1;
|
|
8471
8506
|
}
|
|
8472
8507
|
}
|
|
8473
8508
|
}
|
|
8474
8509
|
})
|
|
8475
8510
|
];
|
|
8476
8511
|
}
|
|
8477
|
-
}),
|
|
8512
|
+
}), Dn = (e) => A.create({
|
|
8478
8513
|
name: "pasteFromClipboard",
|
|
8479
8514
|
addProseMirrorPlugins() {
|
|
8480
8515
|
return [
|
|
8481
|
-
new
|
|
8516
|
+
new v({
|
|
8482
8517
|
props: {
|
|
8483
8518
|
handleDOMEvents: {
|
|
8484
8519
|
paste(t, i) {
|
|
8485
8520
|
if (i.preventDefault(), !e.isEditable)
|
|
8486
8521
|
return;
|
|
8487
|
-
let o
|
|
8488
|
-
for (const r of
|
|
8522
|
+
let o;
|
|
8523
|
+
for (const r of Ne)
|
|
8489
8524
|
if (i.clipboardData.types.includes(r)) {
|
|
8490
8525
|
o = r;
|
|
8491
8526
|
break;
|
|
8492
8527
|
}
|
|
8493
|
-
if (o
|
|
8528
|
+
if (!o)
|
|
8494
8529
|
return !0;
|
|
8495
8530
|
if (o === "Files")
|
|
8496
|
-
return
|
|
8531
|
+
return Ct(i, e), !0;
|
|
8497
8532
|
let n = i.clipboardData.getData(o);
|
|
8498
|
-
return o === "text/html"
|
|
8533
|
+
return o === "blocknote/html" ? (e._tiptapEditor.view.pasteHTML(n), !0) : o === "text/html" ? (n = wt(n.trim()).innerHTML, e._tiptapEditor.view.pasteHTML(n), !0) : (e._tiptapEditor.view.pasteText(n), !0);
|
|
8499
8534
|
}
|
|
8500
8535
|
}
|
|
8501
8536
|
}
|
|
8502
8537
|
})
|
|
8503
8538
|
];
|
|
8504
8539
|
}
|
|
8505
|
-
}),
|
|
8540
|
+
}), jn = A.create({
|
|
8506
8541
|
name: "blockBackgroundColor",
|
|
8507
8542
|
addGlobalAttributes() {
|
|
8508
8543
|
return [
|
|
@@ -8510,9 +8545,9 @@ const Nn = (e) => I.create({
|
|
|
8510
8545
|
types: ["blockContainer"],
|
|
8511
8546
|
attributes: {
|
|
8512
8547
|
backgroundColor: {
|
|
8513
|
-
default:
|
|
8514
|
-
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") :
|
|
8515
|
-
renderHTML: (e) => e.backgroundColor ===
|
|
8548
|
+
default: y.backgroundColor.default,
|
|
8549
|
+
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : y.backgroundColor.default,
|
|
8550
|
+
renderHTML: (e) => e.backgroundColor === y.backgroundColor.default ? {} : {
|
|
8516
8551
|
"data-background-color": e.backgroundColor
|
|
8517
8552
|
}
|
|
8518
8553
|
}
|
|
@@ -8520,7 +8555,7 @@ const Nn = (e) => I.create({
|
|
|
8520
8555
|
}
|
|
8521
8556
|
];
|
|
8522
8557
|
}
|
|
8523
|
-
}),
|
|
8558
|
+
}), zn = A.create({
|
|
8524
8559
|
name: "textAlignment",
|
|
8525
8560
|
addGlobalAttributes() {
|
|
8526
8561
|
return [
|
|
@@ -8546,7 +8581,7 @@ const Nn = (e) => I.create({
|
|
|
8546
8581
|
}
|
|
8547
8582
|
];
|
|
8548
8583
|
}
|
|
8549
|
-
}),
|
|
8584
|
+
}), Rn = A.create({
|
|
8550
8585
|
name: "blockTextColor",
|
|
8551
8586
|
addGlobalAttributes() {
|
|
8552
8587
|
return [
|
|
@@ -8554,9 +8589,9 @@ const Nn = (e) => I.create({
|
|
|
8554
8589
|
types: ["blockContainer"],
|
|
8555
8590
|
attributes: {
|
|
8556
8591
|
textColor: {
|
|
8557
|
-
default:
|
|
8558
|
-
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") :
|
|
8559
|
-
renderHTML: (e) => e.textColor ===
|
|
8592
|
+
default: y.textColor.default,
|
|
8593
|
+
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : y.textColor.default,
|
|
8594
|
+
renderHTML: (e) => e.textColor === y.textColor.default ? {} : {
|
|
8560
8595
|
"data-text-color": e.textColor
|
|
8561
8596
|
}
|
|
8562
8597
|
}
|
|
@@ -8564,12 +8599,12 @@ const Nn = (e) => I.create({
|
|
|
8564
8599
|
}
|
|
8565
8600
|
];
|
|
8566
8601
|
}
|
|
8567
|
-
}),
|
|
8602
|
+
}), Vn = A.create({
|
|
8568
8603
|
name: "trailingNode",
|
|
8569
8604
|
addProseMirrorPlugins() {
|
|
8570
|
-
const e = new
|
|
8605
|
+
const e = new B(this.name);
|
|
8571
8606
|
return [
|
|
8572
|
-
new
|
|
8607
|
+
new v({
|
|
8573
8608
|
key: e,
|
|
8574
8609
|
appendTransaction: (t, i, o) => {
|
|
8575
8610
|
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;
|
|
@@ -8599,8 +8634,8 @@ const Nn = (e) => I.create({
|
|
|
8599
8634
|
})
|
|
8600
8635
|
];
|
|
8601
8636
|
}
|
|
8602
|
-
}),
|
|
8603
|
-
key:
|
|
8637
|
+
}), On = new B("non-editable-block"), Fn = () => new v({
|
|
8638
|
+
key: On,
|
|
8604
8639
|
props: {
|
|
8605
8640
|
handleKeyDown: (e, t) => {
|
|
8606
8641
|
if ("node" in e.state.selection) {
|
|
@@ -8615,7 +8650,7 @@ const Nn = (e) => I.create({
|
|
|
8615
8650
|
e.state.tr.selection.$to.after(),
|
|
8616
8651
|
e.state.schema.nodes.paragraph.create()
|
|
8617
8652
|
).setSelection(
|
|
8618
|
-
new
|
|
8653
|
+
new Q(
|
|
8619
8654
|
i.doc.resolve(e.state.tr.selection.$to.after() + 1)
|
|
8620
8655
|
)
|
|
8621
8656
|
)
|
|
@@ -8625,13 +8660,13 @@ const Nn = (e) => I.create({
|
|
|
8625
8660
|
return !1;
|
|
8626
8661
|
}
|
|
8627
8662
|
}
|
|
8628
|
-
}),
|
|
8663
|
+
}), Gn = {
|
|
8629
8664
|
blockColor: "data-block-color",
|
|
8630
8665
|
blockStyle: "data-block-style",
|
|
8631
8666
|
id: "data-id",
|
|
8632
8667
|
depth: "data-depth",
|
|
8633
8668
|
depthChange: "data-depth-change"
|
|
8634
|
-
},
|
|
8669
|
+
}, Wn = X.create({
|
|
8635
8670
|
name: "blockContainer",
|
|
8636
8671
|
group: "blockContainer",
|
|
8637
8672
|
// A block always contains content, and optionally a blockGroup which contains nested blocks
|
|
@@ -8647,7 +8682,7 @@ const Nn = (e) => I.create({
|
|
|
8647
8682
|
if (typeof e == "string")
|
|
8648
8683
|
return !1;
|
|
8649
8684
|
const t = {};
|
|
8650
|
-
for (const [i, o] of Object.entries(
|
|
8685
|
+
for (const [i, o] of Object.entries(Gn))
|
|
8651
8686
|
e.getAttribute(o) && (t[i] = e.getAttribute(o));
|
|
8652
8687
|
return e.getAttribute("data-node-type") === "blockContainer" ? t : !1;
|
|
8653
8688
|
}
|
|
@@ -8664,7 +8699,7 @@ const Nn = (e) => I.create({
|
|
|
8664
8699
|
...((n = this.options.domAttributes) == null ? void 0 : n.block) || {},
|
|
8665
8700
|
...e
|
|
8666
8701
|
}, o = document.createElement("div");
|
|
8667
|
-
o.className =
|
|
8702
|
+
o.className = O("bn-block", i.class), o.setAttribute("data-node-type", this.name);
|
|
8668
8703
|
for (const [r, a] of Object.entries(i))
|
|
8669
8704
|
r !== "class" && o.setAttribute(r, a);
|
|
8670
8705
|
return t.appendChild(o), {
|
|
@@ -8681,7 +8716,7 @@ const Nn = (e) => I.create({
|
|
|
8681
8716
|
},
|
|
8682
8717
|
// Deletes a block at a given position.
|
|
8683
8718
|
BNDeleteBlock: (e) => ({ state: t, dispatch: i }) => {
|
|
8684
|
-
const o =
|
|
8719
|
+
const o = k(t.doc, e);
|
|
8685
8720
|
if (o === void 0)
|
|
8686
8721
|
return !1;
|
|
8687
8722
|
const { startPos: n, endPos: r } = o;
|
|
@@ -8689,7 +8724,7 @@ const Nn = (e) => I.create({
|
|
|
8689
8724
|
},
|
|
8690
8725
|
// Updates a block at a given position.
|
|
8691
8726
|
BNUpdateBlock: (e, t) => ({ state: i, dispatch: o }) => {
|
|
8692
|
-
const n =
|
|
8727
|
+
const n = k(i.doc, e);
|
|
8693
8728
|
if (n === void 0)
|
|
8694
8729
|
return !1;
|
|
8695
8730
|
const { startPos: r, endPos: a, node: s, contentNode: l } = n;
|
|
@@ -8707,7 +8742,7 @@ const Nn = (e) => I.create({
|
|
|
8707
8742
|
s.childCount === 2 ? i.tr.replace(
|
|
8708
8743
|
r + l.nodeSize + 1,
|
|
8709
8744
|
a - 1,
|
|
8710
|
-
new z(
|
|
8745
|
+
new z(I.from(h), 0, 0)
|
|
8711
8746
|
) : i.tr.insert(
|
|
8712
8747
|
r + l.nodeSize,
|
|
8713
8748
|
i.schema.nodes.blockGroup.create({}, h)
|
|
@@ -8729,7 +8764,7 @@ const Nn = (e) => I.create({
|
|
|
8729
8764
|
this.options.editor.schema.styleSchema
|
|
8730
8765
|
);
|
|
8731
8766
|
else if (t.content.type === "tableContent")
|
|
8732
|
-
p =
|
|
8767
|
+
p = nt(
|
|
8733
8768
|
t.content,
|
|
8734
8769
|
i.schema,
|
|
8735
8770
|
this.options.editor.schema.styleSchema
|
|
@@ -8758,11 +8793,11 @@ const Nn = (e) => I.create({
|
|
|
8758
8793
|
p
|
|
8759
8794
|
)
|
|
8760
8795
|
).setSelection(
|
|
8761
|
-
i.schema.nodes[u].spec.content === "" ? new
|
|
8796
|
+
i.schema.nodes[u].spec.content === "" ? new pe(i.tr.doc.resolve(r)) : i.schema.nodes[u].spec.content === "inline*" ? new Q(i.tr.doc.resolve(r)) : (
|
|
8762
8797
|
// Need to offset the position as we have to get through the
|
|
8763
8798
|
// `tableRow` and `tableCell` nodes to get to the
|
|
8764
8799
|
// `tableParagraph` node we want to set the selection in.
|
|
8765
|
-
new
|
|
8800
|
+
new Q(i.tr.doc.resolve(r + 4))
|
|
8766
8801
|
)
|
|
8767
8802
|
), i.tr.setNodeMarkup(r - 1, void 0, {
|
|
8768
8803
|
...s.attrs,
|
|
@@ -8792,7 +8827,7 @@ const Nn = (e) => I.create({
|
|
|
8792
8827
|
const o = t.doc.resolve(e + 1).node().type.name === "blockContainer", n = t.doc.resolve(e - 1).node().type.name === "blockContainer";
|
|
8793
8828
|
if (!o || !n)
|
|
8794
8829
|
return !1;
|
|
8795
|
-
const r =
|
|
8830
|
+
const r = k(
|
|
8796
8831
|
t.doc,
|
|
8797
8832
|
e + 1
|
|
8798
8833
|
), { node: a, contentNode: s, startPos: l, endPos: d, depth: u } = r;
|
|
@@ -8802,9 +8837,9 @@ const Nn = (e) => I.create({
|
|
|
8802
8837
|
), f = t.doc.resolve(d - 1), g = m.blockRange(f);
|
|
8803
8838
|
i && t.tr.lift(g, u - 1);
|
|
8804
8839
|
}
|
|
8805
|
-
let p = e - 1, h =
|
|
8840
|
+
let p = e - 1, h = k(t.doc, p);
|
|
8806
8841
|
for (; h.numChildBlocks > 0; )
|
|
8807
|
-
if (p--, h =
|
|
8842
|
+
if (p--, h = k(t.doc, p), h === void 0)
|
|
8808
8843
|
return !1;
|
|
8809
8844
|
return i && (i(
|
|
8810
8845
|
t.tr.deleteRange(l, l + s.nodeSize).replace(
|
|
@@ -8813,7 +8848,7 @@ const Nn = (e) => I.create({
|
|
|
8813
8848
|
new z(s.content, 0, 0)
|
|
8814
8849
|
).scrollIntoView()
|
|
8815
8850
|
), t.tr.setSelection(
|
|
8816
|
-
new
|
|
8851
|
+
new Q(t.doc.resolve(p - 1))
|
|
8817
8852
|
)), !0;
|
|
8818
8853
|
},
|
|
8819
8854
|
// Splits a block at a given position. Content after the position is moved to a new block below, at the same
|
|
@@ -8823,7 +8858,7 @@ const Nn = (e) => I.create({
|
|
|
8823
8858
|
// - `keepProps` is usually true when `keepType` is true, except for when
|
|
8824
8859
|
// creating new list item blocks with Enter.
|
|
8825
8860
|
BNSplitBlock: (e, t, i) => ({ state: o, dispatch: n }) => {
|
|
8826
|
-
const r =
|
|
8861
|
+
const r = k(o.doc, e);
|
|
8827
8862
|
if (r === void 0)
|
|
8828
8863
|
return !1;
|
|
8829
8864
|
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;
|
|
@@ -8831,7 +8866,7 @@ const Nn = (e) => I.create({
|
|
|
8831
8866
|
g,
|
|
8832
8867
|
g + 1,
|
|
8833
8868
|
h.content.size > 0 ? new z(
|
|
8834
|
-
|
|
8869
|
+
I.from(h),
|
|
8835
8870
|
u + 2,
|
|
8836
8871
|
u + 2
|
|
8837
8872
|
) : void 0
|
|
@@ -8841,12 +8876,12 @@ const Nn = (e) => I.create({
|
|
|
8841
8876
|
o.schema.node(s).type,
|
|
8842
8877
|
i ? a.attrs : void 0
|
|
8843
8878
|
), o.tr.setSelection(
|
|
8844
|
-
new
|
|
8879
|
+
new Q(o.doc.resolve(g))
|
|
8845
8880
|
), o.tr.replace(
|
|
8846
8881
|
l + 1,
|
|
8847
8882
|
d - 1,
|
|
8848
8883
|
p.content.size > 0 ? new z(
|
|
8849
|
-
|
|
8884
|
+
I.from(p),
|
|
8850
8885
|
u + 2,
|
|
8851
8886
|
u + 2
|
|
8852
8887
|
) : void 0
|
|
@@ -8855,7 +8890,7 @@ const Nn = (e) => I.create({
|
|
|
8855
8890
|
};
|
|
8856
8891
|
},
|
|
8857
8892
|
addProseMirrorPlugins() {
|
|
8858
|
-
return [
|
|
8893
|
+
return [Fn()];
|
|
8859
8894
|
},
|
|
8860
8895
|
addKeyboardShortcuts() {
|
|
8861
8896
|
return {
|
|
@@ -8866,7 +8901,7 @@ const Nn = (e) => I.create({
|
|
|
8866
8901
|
() => o.undoInputRule(),
|
|
8867
8902
|
// Reverts block content type to a paragraph if the selection is at the start of the block.
|
|
8868
8903
|
() => o.command(({ state: n }) => {
|
|
8869
|
-
const { contentType: r, startPos: a } =
|
|
8904
|
+
const { contentType: r, startPos: a } = k(
|
|
8870
8905
|
n.doc,
|
|
8871
8906
|
n.selection.from
|
|
8872
8907
|
), s = n.selection.from === a + 1, l = r.name === "paragraph";
|
|
@@ -8877,7 +8912,7 @@ const Nn = (e) => I.create({
|
|
|
8877
8912
|
}),
|
|
8878
8913
|
// Removes a level of nesting if the block is indented if the selection is at the start of the block.
|
|
8879
8914
|
() => o.command(({ state: n }) => {
|
|
8880
|
-
const { startPos: r } =
|
|
8915
|
+
const { startPos: r } = k(
|
|
8881
8916
|
n.doc,
|
|
8882
8917
|
n.selection.from
|
|
8883
8918
|
);
|
|
@@ -8886,7 +8921,7 @@ const Nn = (e) => I.create({
|
|
|
8886
8921
|
// Merges block with the previous one if it isn't indented, isn't the first block in the doc, and the selection
|
|
8887
8922
|
// is at the start of the block.
|
|
8888
8923
|
() => o.command(({ state: n }) => {
|
|
8889
|
-
const { depth: r, startPos: a } =
|
|
8924
|
+
const { depth: r, startPos: a } = k(
|
|
8890
8925
|
n.doc,
|
|
8891
8926
|
n.selection.from
|
|
8892
8927
|
), s = n.selection.from === a + 1, l = n.selection.empty, d = a === 2, u = a - 1;
|
|
@@ -8900,7 +8935,7 @@ const Nn = (e) => I.create({
|
|
|
8900
8935
|
// if one exists, the block has no children, and the selection is at the
|
|
8901
8936
|
// end of the block.
|
|
8902
8937
|
() => o.command(({ state: n }) => {
|
|
8903
|
-
const { node: r, depth: a, endPos: s } =
|
|
8938
|
+
const { node: r, depth: a, endPos: s } = k(
|
|
8904
8939
|
n.doc,
|
|
8905
8940
|
n.selection.from
|
|
8906
8941
|
), l = s === n.doc.nodeSize - 4, d = n.selection.from === s - 1, u = n.selection.empty, p = r.childCount === 2;
|
|
@@ -8917,7 +8952,7 @@ const Nn = (e) => I.create({
|
|
|
8917
8952
|
// Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start
|
|
8918
8953
|
// of the block.
|
|
8919
8954
|
() => o.command(({ state: n }) => {
|
|
8920
|
-
const { contentNode: r, depth: a } =
|
|
8955
|
+
const { contentNode: r, depth: a } = k(
|
|
8921
8956
|
n.doc,
|
|
8922
8957
|
n.selection.from
|
|
8923
8958
|
), s = n.selection.$anchor.parentOffset === 0, l = n.selection.anchor === n.selection.head, d = r.childCount === 0, u = a > 2;
|
|
@@ -8926,7 +8961,7 @@ const Nn = (e) => I.create({
|
|
|
8926
8961
|
// Creates a new block and moves the selection to it if the current one is empty, while the selection is also
|
|
8927
8962
|
// empty & at the start of the block.
|
|
8928
8963
|
() => o.command(({ state: n, chain: r }) => {
|
|
8929
|
-
const { contentNode: a, endPos: s } =
|
|
8964
|
+
const { contentNode: a, endPos: s } = k(
|
|
8930
8965
|
n.doc,
|
|
8931
8966
|
n.selection.from
|
|
8932
8967
|
), l = n.selection.$anchor.parentOffset === 0, d = n.selection.anchor === n.selection.head, u = a.childCount === 0;
|
|
@@ -8939,7 +8974,7 @@ const Nn = (e) => I.create({
|
|
|
8939
8974
|
// Splits the current block, moving content inside that's after the cursor to a new text block below. Also
|
|
8940
8975
|
// deletes the selection beforehand, if it's not empty.
|
|
8941
8976
|
() => o.command(({ state: n, chain: r }) => {
|
|
8942
|
-
const { contentNode: a } =
|
|
8977
|
+
const { contentNode: a } = k(
|
|
8943
8978
|
n.doc,
|
|
8944
8979
|
n.selection.from
|
|
8945
8980
|
), s = n.selection.$anchor.parentOffset === 0;
|
|
@@ -8962,7 +8997,7 @@ const Nn = (e) => I.create({
|
|
|
8962
8997
|
}
|
|
8963
8998
|
};
|
|
8964
8999
|
}
|
|
8965
|
-
}),
|
|
9000
|
+
}), Kn = X.create({
|
|
8966
9001
|
name: "blockGroup",
|
|
8967
9002
|
group: "blockGroup",
|
|
8968
9003
|
content: "blockContainer+",
|
|
@@ -8980,7 +9015,7 @@ const Nn = (e) => I.create({
|
|
|
8980
9015
|
...((o = this.options.domAttributes) == null ? void 0 : o.blockGroup) || {},
|
|
8981
9016
|
...e
|
|
8982
9017
|
}, i = document.createElement("div");
|
|
8983
|
-
i.className =
|
|
9018
|
+
i.className = O(
|
|
8984
9019
|
"bn-block-group",
|
|
8985
9020
|
t.class
|
|
8986
9021
|
), i.setAttribute("data-node-type", "blockGroup");
|
|
@@ -8991,31 +9026,31 @@ const Nn = (e) => I.create({
|
|
|
8991
9026
|
contentDOM: i
|
|
8992
9027
|
};
|
|
8993
9028
|
}
|
|
8994
|
-
}),
|
|
9029
|
+
}), $n = X.create({
|
|
8995
9030
|
name: "doc",
|
|
8996
9031
|
topNode: !0,
|
|
8997
9032
|
content: "blockGroup"
|
|
8998
|
-
}),
|
|
9033
|
+
}), qn = (e) => {
|
|
8999
9034
|
var o;
|
|
9000
9035
|
const t = [
|
|
9001
|
-
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
|
|
9036
|
+
Y.ClipboardTextSerializer,
|
|
9037
|
+
Y.Commands,
|
|
9038
|
+
Y.Editable,
|
|
9039
|
+
Y.FocusEvents,
|
|
9040
|
+
Y.Tabindex,
|
|
9006
9041
|
// DevTools,
|
|
9007
|
-
|
|
9042
|
+
ci,
|
|
9008
9043
|
// DropCursor,
|
|
9009
|
-
|
|
9044
|
+
ne.configure({
|
|
9010
9045
|
types: ["blockContainer"],
|
|
9011
9046
|
setIdAttribute: e.setIdAttribute
|
|
9012
9047
|
}),
|
|
9013
|
-
|
|
9048
|
+
ui.extend({ priority: 10 }),
|
|
9014
9049
|
// Comments,
|
|
9015
9050
|
// basics:
|
|
9016
|
-
|
|
9051
|
+
mi,
|
|
9017
9052
|
// marks:
|
|
9018
|
-
|
|
9053
|
+
hi.extend({
|
|
9019
9054
|
addKeyboardShortcuts() {
|
|
9020
9055
|
return {
|
|
9021
9056
|
"Mod-k": () => (this.editor.commands.toggleLink({ href: "" }), !0)
|
|
@@ -9023,11 +9058,11 @@ const Nn = (e) => I.create({
|
|
|
9023
9058
|
}
|
|
9024
9059
|
}),
|
|
9025
9060
|
...Object.values(e.styleSpecs).map((n) => n.implementation.mark),
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9061
|
+
Rn,
|
|
9062
|
+
jn,
|
|
9063
|
+
zn,
|
|
9029
9064
|
// make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)
|
|
9030
|
-
|
|
9065
|
+
A.create({
|
|
9031
9066
|
name: "OverrideEscape",
|
|
9032
9067
|
addKeyboardShortcuts() {
|
|
9033
9068
|
return {
|
|
@@ -9036,12 +9071,12 @@ const Nn = (e) => I.create({
|
|
|
9036
9071
|
}
|
|
9037
9072
|
}),
|
|
9038
9073
|
// nodes
|
|
9039
|
-
|
|
9040
|
-
|
|
9074
|
+
$n,
|
|
9075
|
+
Wn.configure({
|
|
9041
9076
|
editor: e.editor,
|
|
9042
9077
|
domAttributes: e.domAttributes
|
|
9043
9078
|
}),
|
|
9044
|
-
|
|
9079
|
+
Kn.configure({
|
|
9045
9080
|
domAttributes: e.domAttributes
|
|
9046
9081
|
}),
|
|
9047
9082
|
...Object.values(e.inlineContentSpecs).filter((n) => n.config !== "link" && n.config !== "text").map((n) => n.implementation.node.configure({
|
|
@@ -9061,17 +9096,17 @@ const Nn = (e) => I.create({
|
|
|
9061
9096
|
domAttributes: e.domAttributes
|
|
9062
9097
|
})
|
|
9063
9098
|
]),
|
|
9064
|
-
Ln(e.editor),
|
|
9065
|
-
Pn(e.editor),
|
|
9066
9099
|
Nn(e.editor),
|
|
9067
|
-
|
|
9100
|
+
Dn(e.editor),
|
|
9101
|
+
Un(e.editor),
|
|
9102
|
+
di.configure({ width: 5, color: "#ddeeff" }),
|
|
9068
9103
|
// This needs to be at the bottom of this list, because Key events (such as enter, when selecting a /command),
|
|
9069
9104
|
// should be handled before Enter handlers in other components like splitListItem
|
|
9070
|
-
...e.trailingBlock === void 0 || e.trailingBlock ? [
|
|
9105
|
+
...e.trailingBlock === void 0 || e.trailingBlock ? [Vn] : []
|
|
9071
9106
|
];
|
|
9072
9107
|
if (e.collaboration) {
|
|
9073
9108
|
if (t.push(
|
|
9074
|
-
|
|
9109
|
+
si.configure({
|
|
9075
9110
|
fragment: e.collaboration.fragment
|
|
9076
9111
|
})
|
|
9077
9112
|
), (o = e.collaboration.provider) != null && o.awareness) {
|
|
@@ -9084,7 +9119,7 @@ const Nn = (e) => I.create({
|
|
|
9084
9119
|
return a.insertBefore(l, null), a.insertBefore(s, null), a.insertBefore(d, null), a;
|
|
9085
9120
|
};
|
|
9086
9121
|
t.push(
|
|
9087
|
-
|
|
9122
|
+
li.configure({
|
|
9088
9123
|
user: e.collaboration.user,
|
|
9089
9124
|
render: e.collaboration.renderCursor || n,
|
|
9090
9125
|
provider: e.collaboration.provider
|
|
@@ -9092,24 +9127,40 @@ const Nn = (e) => I.create({
|
|
|
9092
9127
|
);
|
|
9093
9128
|
}
|
|
9094
9129
|
} else
|
|
9095
|
-
t.push(
|
|
9130
|
+
t.push(pi);
|
|
9096
9131
|
const i = e.disableExtensions || [];
|
|
9097
9132
|
return t.filter((n) => !i.includes(n.name));
|
|
9098
9133
|
};
|
|
9099
|
-
function
|
|
9134
|
+
function Xn(e, t) {
|
|
9100
9135
|
const i = [];
|
|
9101
9136
|
return e.forEach((o, n, r) => {
|
|
9102
9137
|
r !== t && i.push(o);
|
|
9103
|
-
}),
|
|
9138
|
+
}), I.from(i);
|
|
9139
|
+
}
|
|
9140
|
+
function Zn(e, t) {
|
|
9141
|
+
const i = [];
|
|
9142
|
+
for (let o = 0; o < e.childCount; o++)
|
|
9143
|
+
if (e.child(o).type.name === "tableRow")
|
|
9144
|
+
if (i.length > 0 && i[i.length - 1].type.name === "table") {
|
|
9145
|
+
const n = i[i.length - 1], r = n.copy(n.content.addToEnd(e.child(o)));
|
|
9146
|
+
i[i.length - 1] = r;
|
|
9147
|
+
} else {
|
|
9148
|
+
const n = t.nodes.table.create(void 0, e.child(o));
|
|
9149
|
+
i.push(n);
|
|
9150
|
+
}
|
|
9151
|
+
else
|
|
9152
|
+
i.push(e.child(o));
|
|
9153
|
+
return e = I.from(i), e;
|
|
9104
9154
|
}
|
|
9105
|
-
function
|
|
9106
|
-
let i =
|
|
9155
|
+
function Jn(e, t) {
|
|
9156
|
+
let i = I.from(e.content);
|
|
9157
|
+
i = Zn(i, t.state.schema);
|
|
9107
9158
|
for (let o = 0; o < i.childCount; o++)
|
|
9108
9159
|
if (i.child(o).type.spec.group === "blockContent") {
|
|
9109
9160
|
const n = [i.child(o)];
|
|
9110
9161
|
if (o + 1 < i.childCount && i.child(o + 1).type.spec.group === "blockGroup") {
|
|
9111
9162
|
const a = i.child(o + 1).child(0).child(0);
|
|
9112
|
-
(a.type.name === "bulletListItem" || a.type.name === "numberedListItem" || a.type.name === "checkListItem") && (n.push(i.child(o + 1)), i =
|
|
9163
|
+
(a.type.name === "bulletListItem" || a.type.name === "numberedListItem" || a.type.name === "checkListItem") && (n.push(i.child(o + 1)), i = Xn(i, o + 1));
|
|
9113
9164
|
}
|
|
9114
9165
|
const r = t.state.schema.nodes.blockContainer.create(
|
|
9115
9166
|
void 0,
|
|
@@ -9119,12 +9170,12 @@ function $n(e, t) {
|
|
|
9119
9170
|
}
|
|
9120
9171
|
return new z(i, e.openStart, e.openEnd);
|
|
9121
9172
|
}
|
|
9122
|
-
function
|
|
9173
|
+
function we(e) {
|
|
9123
9174
|
return e && Object.fromEntries(
|
|
9124
9175
|
Object.entries(e).filter(([, t]) => t !== void 0)
|
|
9125
9176
|
);
|
|
9126
9177
|
}
|
|
9127
|
-
class
|
|
9178
|
+
class Pe {
|
|
9128
9179
|
constructor(t) {
|
|
9129
9180
|
c(this, "blockSpecs");
|
|
9130
9181
|
c(this, "inlineContentSpecs");
|
|
@@ -9136,15 +9187,15 @@ class Ne {
|
|
|
9136
9187
|
c(this, "BlockNoteEditor", "only for types");
|
|
9137
9188
|
c(this, "Block", "only for types");
|
|
9138
9189
|
c(this, "PartialBlock", "only for types");
|
|
9139
|
-
this.blockSpecs =
|
|
9190
|
+
this.blockSpecs = we(t == null ? void 0 : t.blockSpecs) || bt, this.inlineContentSpecs = we(t == null ? void 0 : t.inlineContentSpecs) || kt, this.styleSpecs = we(t == null ? void 0 : t.styleSpecs) || _t, this.blockSchema = ut(this.blockSpecs), this.inlineContentSchema = pt(
|
|
9140
9191
|
this.inlineContentSpecs
|
|
9141
|
-
), this.styleSchema =
|
|
9192
|
+
), this.styleSchema = mt(this.styleSpecs);
|
|
9142
9193
|
}
|
|
9143
9194
|
static create(t) {
|
|
9144
|
-
return new
|
|
9195
|
+
return new Pe(t);
|
|
9145
9196
|
}
|
|
9146
9197
|
}
|
|
9147
|
-
class
|
|
9198
|
+
const ue = class ue extends Gt {
|
|
9148
9199
|
constructor(i, o) {
|
|
9149
9200
|
super({ ...i, content: void 0 });
|
|
9150
9201
|
c(this, "_state");
|
|
@@ -9163,14 +9214,14 @@ class Et extends Ft {
|
|
|
9163
9214
|
if (r)
|
|
9164
9215
|
return r;
|
|
9165
9216
|
const d = a.apply(n.nodes.doc, l), u = JSON.parse(JSON.stringify(d.toJSON()));
|
|
9166
|
-
return u.content[0].content[0].attrs.id = "initialBlockId", r =
|
|
9217
|
+
return u.content[0].content[0].attrs.id = "initialBlockId", r = Nt.fromJSON(n, u), r;
|
|
9167
9218
|
};
|
|
9168
9219
|
let s;
|
|
9169
9220
|
try {
|
|
9170
9221
|
const l = i == null ? void 0 : i.content.map(
|
|
9171
9222
|
(d) => U(d, this.schema, o).toJSON()
|
|
9172
9223
|
);
|
|
9173
|
-
s =
|
|
9224
|
+
s = Wt(
|
|
9174
9225
|
{
|
|
9175
9226
|
type: "doc",
|
|
9176
9227
|
content: [
|
|
@@ -9191,7 +9242,7 @@ class Et extends Ft {
|
|
|
9191
9242
|
"Error creating document from blocks passed as `initialContent`:\n" + +JSON.stringify(i.content)
|
|
9192
9243
|
);
|
|
9193
9244
|
}
|
|
9194
|
-
this._state =
|
|
9245
|
+
this._state = $t.create({
|
|
9195
9246
|
doc: s,
|
|
9196
9247
|
schema: this.schema
|
|
9197
9248
|
// selection: selection || undefined,
|
|
@@ -9208,7 +9259,7 @@ class Et extends Ft {
|
|
|
9208
9259
|
*/
|
|
9209
9260
|
createViewAlternative() {
|
|
9210
9261
|
queueMicrotask(() => {
|
|
9211
|
-
this.view = new
|
|
9262
|
+
this.view = new ai(
|
|
9212
9263
|
{ mount: this.options.element },
|
|
9213
9264
|
// use mount option so that we reuse the existing element instead of creating a new one
|
|
9214
9265
|
{
|
|
@@ -9221,15 +9272,26 @@ class Et extends Ft {
|
|
|
9221
9272
|
const i = this.state.reconfigure({
|
|
9222
9273
|
plugins: this.extensionManager.plugins
|
|
9223
9274
|
});
|
|
9224
|
-
this.view.updateState(i), this.createNodeViews();
|
|
9275
|
+
this.view.updateState(i), this.createNodeViews(), this.commands.focus(this.options.autofocus), this.emit("create", { editor: this }), this.isInitialized = !0;
|
|
9225
9276
|
});
|
|
9226
9277
|
}
|
|
9227
|
-
}
|
|
9228
|
-
|
|
9278
|
+
};
|
|
9279
|
+
c(ue, "create", (i, o) => {
|
|
9280
|
+
var r, a;
|
|
9281
|
+
const n = (r = globalThis == null ? void 0 : globalThis.window) == null ? void 0 : r.setTimeout;
|
|
9282
|
+
typeof ((a = globalThis == null ? void 0 : globalThis.window) == null ? void 0 : a.setTimeout) < "u" && (globalThis.window.setTimeout = () => 0);
|
|
9283
|
+
try {
|
|
9284
|
+
return new ue(i, o);
|
|
9285
|
+
} finally {
|
|
9286
|
+
n && (globalThis.window.setTimeout = n);
|
|
9287
|
+
}
|
|
9288
|
+
});
|
|
9289
|
+
let ce = ue;
|
|
9290
|
+
ce.prototype.createView = function() {
|
|
9229
9291
|
this.options.onPaste = this.options.onDrop = void 0;
|
|
9230
9292
|
};
|
|
9231
|
-
const
|
|
9232
|
-
key:
|
|
9293
|
+
const Yn = new B("blocknote-placeholder"), Qn = (e, t) => new v({
|
|
9294
|
+
key: Yn,
|
|
9233
9295
|
view: () => {
|
|
9234
9296
|
const i = document.createElement("style"), o = e._tiptapEditor.options.injectNonce;
|
|
9235
9297
|
o && i.setAttribute("nonce", o), e._tiptapEditor.view.root instanceof ShadowRoot ? e._tiptapEditor.view.root.append(i) : e._tiptapEditor.view.root.head.appendChild(i);
|
|
@@ -9267,13 +9329,13 @@ const qn = new L("blocknote-placeholder"), Xn = (e, t) => new x({
|
|
|
9267
9329
|
const r = n.$anchor, a = r.parent;
|
|
9268
9330
|
if (a.content.size > 0)
|
|
9269
9331
|
return null;
|
|
9270
|
-
const s = r.before(), l =
|
|
9332
|
+
const s = r.before(), l = q.node(s, s + a.nodeSize, {
|
|
9271
9333
|
"data-is-empty-and-focused": "true"
|
|
9272
9334
|
});
|
|
9273
|
-
return
|
|
9335
|
+
return $.create(o, [l]);
|
|
9274
9336
|
}
|
|
9275
9337
|
}
|
|
9276
|
-
}),
|
|
9338
|
+
}), Qe = new B("previous-blocks"), er = {
|
|
9277
9339
|
// Numbered List Items
|
|
9278
9340
|
index: "index",
|
|
9279
9341
|
// Headings
|
|
@@ -9282,17 +9344,17 @@ const qn = new L("blocknote-placeholder"), Xn = (e, t) => new x({
|
|
|
9282
9344
|
type: "type",
|
|
9283
9345
|
depth: "depth",
|
|
9284
9346
|
"depth-change": "depth-change"
|
|
9285
|
-
},
|
|
9347
|
+
}, tr = () => {
|
|
9286
9348
|
let e;
|
|
9287
|
-
return new
|
|
9288
|
-
key:
|
|
9349
|
+
return new v({
|
|
9350
|
+
key: Qe,
|
|
9289
9351
|
view(t) {
|
|
9290
9352
|
return {
|
|
9291
9353
|
update: async (i, o) => {
|
|
9292
9354
|
var n;
|
|
9293
9355
|
((n = this.key) == null ? void 0 : n.getState(i.state).updatedBlocks.size) > 0 && (e = setTimeout(() => {
|
|
9294
9356
|
i.dispatch(
|
|
9295
|
-
i.state.tr.setMeta(
|
|
9357
|
+
i.state.tr.setMeta(Qe, { clearUpdate: !0 })
|
|
9296
9358
|
);
|
|
9297
9359
|
}, 0));
|
|
9298
9360
|
},
|
|
@@ -9315,9 +9377,9 @@ const qn = new L("blocknote-placeholder"), Xn = (e, t) => new x({
|
|
|
9315
9377
|
apply(t, i, o, n) {
|
|
9316
9378
|
if (i.currentTransactionOldBlockAttrs = {}, i.updatedBlocks.clear(), !t.docChanged || o.doc.eq(n.doc))
|
|
9317
9379
|
return i;
|
|
9318
|
-
const r = {}, a =
|
|
9380
|
+
const r = {}, a = ze(o.doc, (d) => d.attrs.id), s = new Map(
|
|
9319
9381
|
a.map((d) => [d.node.attrs.id, d])
|
|
9320
|
-
), l =
|
|
9382
|
+
), l = ze(n.doc, (d) => d.attrs.id);
|
|
9321
9383
|
for (const d of l) {
|
|
9322
9384
|
const u = s.get(d.node.attrs.id), p = u == null ? void 0 : u.node.firstChild, h = d.node.firstChild;
|
|
9323
9385
|
if (u && p && h) {
|
|
@@ -9350,21 +9412,21 @@ const qn = new L("blocknote-placeholder"), Xn = (e, t) => new x({
|
|
|
9350
9412
|
return;
|
|
9351
9413
|
const a = i.currentTransactionOldBlockAttrs[n.attrs.id], s = {};
|
|
9352
9414
|
for (const [d, u] of Object.entries(a))
|
|
9353
|
-
s["data-prev-" +
|
|
9354
|
-
const l =
|
|
9415
|
+
s["data-prev-" + er[d]] = u || "none";
|
|
9416
|
+
const l = q.node(r, r + n.nodeSize, {
|
|
9355
9417
|
...s
|
|
9356
9418
|
});
|
|
9357
9419
|
o.push(l);
|
|
9358
|
-
}),
|
|
9420
|
+
}), $.create(t.doc, o);
|
|
9359
9421
|
}
|
|
9360
9422
|
}
|
|
9361
9423
|
});
|
|
9362
|
-
},
|
|
9424
|
+
}, ir = {
|
|
9363
9425
|
enableInputRules: !0,
|
|
9364
9426
|
enablePasteRules: !0,
|
|
9365
9427
|
enableCoreExtensions: !1
|
|
9366
9428
|
};
|
|
9367
|
-
class
|
|
9429
|
+
class St {
|
|
9368
9430
|
constructor(t) {
|
|
9369
9431
|
c(this, "_pmSchema");
|
|
9370
9432
|
/**
|
|
@@ -9445,10 +9507,10 @@ class Ct {
|
|
|
9445
9507
|
throw new Error(
|
|
9446
9508
|
"editable initialization option is deprecated, use <BlockNoteView editable={true/false} />, or alternatively editor.isEditable = true/false"
|
|
9447
9509
|
);
|
|
9448
|
-
this.dictionary = t.dictionary ||
|
|
9510
|
+
this.dictionary = t.dictionary || tt;
|
|
9449
9511
|
const o = {
|
|
9450
9512
|
defaultStyles: !0,
|
|
9451
|
-
schema: t.schema ||
|
|
9513
|
+
schema: t.schema || Pe.create(),
|
|
9452
9514
|
_headless: !1,
|
|
9453
9515
|
...t,
|
|
9454
9516
|
placeholders: {
|
|
@@ -9456,8 +9518,8 @@ class Ct {
|
|
|
9456
9518
|
...t.placeholders
|
|
9457
9519
|
}
|
|
9458
9520
|
};
|
|
9459
|
-
this.schema = o.schema, this.blockImplementations = o.schema.blockSpecs, this.inlineContentImplementations = o.schema.inlineContentSpecs, this.styleImplementations = o.schema.styleSpecs, this.formattingToolbar = new
|
|
9460
|
-
const n =
|
|
9521
|
+
this.schema = o.schema, this.blockImplementations = o.schema.blockSpecs, this.inlineContentImplementations = o.schema.inlineContentSpecs, this.styleImplementations = o.schema.styleSpecs, this.formattingToolbar = new fn(this), this.linkToolbar = new _n(this), this.sideMenu = new En(this), this.suggestionMenus = new Mn(this), this.filePanel = new pn(this), M("table", this) && (this.tableHandles = new An(this));
|
|
9522
|
+
const n = qn({
|
|
9461
9523
|
editor: this,
|
|
9462
9524
|
domAttributes: o.domAttributes || {},
|
|
9463
9525
|
blockSpecs: this.schema.blockSpecs,
|
|
@@ -9467,7 +9529,7 @@ class Ct {
|
|
|
9467
9529
|
trailingBlock: o.trailingBlock,
|
|
9468
9530
|
disableExtensions: o.disableExtensions,
|
|
9469
9531
|
setIdAttribute: o.setIdAttribute
|
|
9470
|
-
}), r =
|
|
9532
|
+
}), r = A.create({
|
|
9471
9533
|
name: "BlockNoteUIExtension",
|
|
9472
9534
|
addProseMirrorPlugins: () => [
|
|
9473
9535
|
this.formattingToolbar.plugin,
|
|
@@ -9476,21 +9538,21 @@ class Ct {
|
|
|
9476
9538
|
this.suggestionMenus.plugin,
|
|
9477
9539
|
...this.filePanel ? [this.filePanel.plugin] : [],
|
|
9478
9540
|
...this.tableHandles ? [this.tableHandles.plugin] : [],
|
|
9479
|
-
|
|
9480
|
-
...this.options.animations ?? !0 ? [
|
|
9541
|
+
Qn(this, o.placeholders),
|
|
9542
|
+
...this.options.animations ?? !0 ? [tr()] : []
|
|
9481
9543
|
]
|
|
9482
9544
|
});
|
|
9483
9545
|
if (n.push(r), o.uploadFile) {
|
|
9484
9546
|
const g = o.uploadFile;
|
|
9485
|
-
this.uploadFile = async (
|
|
9547
|
+
this.uploadFile = async (_, x) => {
|
|
9486
9548
|
this.onUploadStartCallbacks.forEach(
|
|
9487
|
-
(b) => b.apply(this, [
|
|
9549
|
+
(b) => b.apply(this, [x])
|
|
9488
9550
|
);
|
|
9489
9551
|
try {
|
|
9490
|
-
return await g(
|
|
9552
|
+
return await g(_, x);
|
|
9491
9553
|
} finally {
|
|
9492
9554
|
this.onUploadEndCallbacks.forEach(
|
|
9493
|
-
(b) => b.apply(this, [
|
|
9555
|
+
(b) => b.apply(this, [x])
|
|
9494
9556
|
);
|
|
9495
9557
|
}
|
|
9496
9558
|
};
|
|
@@ -9506,7 +9568,7 @@ class Ct {
|
|
|
9506
9568
|
] : [
|
|
9507
9569
|
{
|
|
9508
9570
|
type: "paragraph",
|
|
9509
|
-
id:
|
|
9571
|
+
id: ne.options.generateID()
|
|
9510
9572
|
}
|
|
9511
9573
|
]);
|
|
9512
9574
|
if (!Array.isArray(a) || a.length === 0)
|
|
@@ -9514,7 +9576,7 @@ class Ct {
|
|
|
9514
9576
|
"initialContent must be a non-empty array of blocks, received: " + a
|
|
9515
9577
|
);
|
|
9516
9578
|
const s = {
|
|
9517
|
-
...
|
|
9579
|
+
...ir,
|
|
9518
9580
|
...o._tiptapOptions,
|
|
9519
9581
|
content: a,
|
|
9520
9582
|
extensions: [
|
|
@@ -9530,16 +9592,16 @@ class Ct {
|
|
|
9530
9592
|
tabIndex: "0",
|
|
9531
9593
|
...(p = (u = o._tiptapOptions) == null ? void 0 : u.editorProps) == null ? void 0 : p.attributes,
|
|
9532
9594
|
...(h = o.domAttributes) == null ? void 0 : h.editor,
|
|
9533
|
-
class:
|
|
9595
|
+
class: O(
|
|
9534
9596
|
"bn-editor",
|
|
9535
9597
|
o.defaultStyles ? "bn-default-styles" : "",
|
|
9536
9598
|
((f = (m = o.domAttributes) == null ? void 0 : m.editor) == null ? void 0 : f.class) || ""
|
|
9537
9599
|
)
|
|
9538
9600
|
},
|
|
9539
|
-
transformPasted:
|
|
9601
|
+
transformPasted: Jn
|
|
9540
9602
|
}
|
|
9541
9603
|
};
|
|
9542
|
-
this.headless ? this._pmSchema =
|
|
9604
|
+
this.headless ? this._pmSchema = Kt(s.extensions) : (this._tiptapEditor = ce.create(
|
|
9543
9605
|
s,
|
|
9544
9606
|
this.schema.styleSchema
|
|
9545
9607
|
), this._pmSchema = this._tiptapEditor.schema);
|
|
@@ -9548,7 +9610,7 @@ class Ct {
|
|
|
9548
9610
|
return this._pmSchema;
|
|
9549
9611
|
}
|
|
9550
9612
|
static create(t = {}) {
|
|
9551
|
-
return new
|
|
9613
|
+
return new St(t);
|
|
9552
9614
|
}
|
|
9553
9615
|
dispatch(t) {
|
|
9554
9616
|
this._tiptapEditor.dispatch(t);
|
|
@@ -9654,7 +9716,7 @@ class Ct {
|
|
|
9654
9716
|
* @returns A snapshot of the current text cursor position.
|
|
9655
9717
|
*/
|
|
9656
9718
|
getTextCursorPosition() {
|
|
9657
|
-
const { node: t, depth: i, startPos: o, endPos: n } =
|
|
9719
|
+
const { node: t, depth: i, startPos: o, endPos: n } = k(
|
|
9658
9720
|
this._tiptapEditor.state.doc,
|
|
9659
9721
|
this._tiptapEditor.state.selection.from
|
|
9660
9722
|
), r = this._tiptapEditor.state.doc.resolve(n).index(i - 1), a = this._tiptapEditor.state.doc.resolve(n + 1).node().childCount;
|
|
@@ -9692,7 +9754,7 @@ class Ct {
|
|
|
9692
9754
|
* @param placement Whether the text cursor should be placed at the start or end of the block.
|
|
9693
9755
|
*/
|
|
9694
9756
|
setTextCursorPosition(t, i = "start") {
|
|
9695
|
-
const o = typeof t == "string" ? t : t.id, { posBeforeNode: n } =
|
|
9757
|
+
const o = typeof t == "string" ? t : t.id, { posBeforeNode: n } = Ie(o, this._tiptapEditor.state.doc), { startPos: r, contentNode: a } = k(
|
|
9696
9758
|
this._tiptapEditor.state.doc,
|
|
9697
9759
|
n + 2
|
|
9698
9760
|
), s = this.schema.blockSchema[a.type.name].content;
|
|
@@ -9766,7 +9828,7 @@ class Ct {
|
|
|
9766
9828
|
* `referenceBlock`. Inserts the blocks at the start of the existing block's children if "nested" is used.
|
|
9767
9829
|
*/
|
|
9768
9830
|
insertBlocks(t, i, o = "before") {
|
|
9769
|
-
return
|
|
9831
|
+
return Xo(t, i, o, this);
|
|
9770
9832
|
}
|
|
9771
9833
|
/**
|
|
9772
9834
|
* Updates an existing block in the editor. Since updatedBlock is a PartialBlock object, some fields might not be
|
|
@@ -9776,14 +9838,14 @@ class Ct {
|
|
|
9776
9838
|
* @param update A partial block which defines how the existing block should be changed.
|
|
9777
9839
|
*/
|
|
9778
9840
|
updateBlock(t, i) {
|
|
9779
|
-
return
|
|
9841
|
+
return Zo(t, i, this);
|
|
9780
9842
|
}
|
|
9781
9843
|
/**
|
|
9782
9844
|
* Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
|
|
9783
9845
|
* @param blocksToRemove An array of identifiers for existing blocks that should be removed.
|
|
9784
9846
|
*/
|
|
9785
9847
|
removeBlocks(t) {
|
|
9786
|
-
return
|
|
9848
|
+
return Jo(t, this);
|
|
9787
9849
|
}
|
|
9788
9850
|
/**
|
|
9789
9851
|
* Replaces existing blocks in the editor with new blocks. If the blocks that should be removed are not adjacent or
|
|
@@ -9793,7 +9855,7 @@ class Ct {
|
|
|
9793
9855
|
* @param blocksToInsert An array of partial blocks to replace the old ones with.
|
|
9794
9856
|
*/
|
|
9795
9857
|
replaceBlocks(t, i) {
|
|
9796
|
-
return
|
|
9858
|
+
return Yo(t, i, this);
|
|
9797
9859
|
}
|
|
9798
9860
|
/**
|
|
9799
9861
|
* Insert a piece of content at the current cursor position.
|
|
@@ -9806,7 +9868,7 @@ class Ct {
|
|
|
9806
9868
|
this.pmSchema,
|
|
9807
9869
|
this.schema.styleSchema
|
|
9808
9870
|
);
|
|
9809
|
-
|
|
9871
|
+
Qo(
|
|
9810
9872
|
{
|
|
9811
9873
|
from: this._tiptapEditor.state.selection.from,
|
|
9812
9874
|
to: this._tiptapEditor.state.selection.to
|
|
@@ -9906,7 +9968,7 @@ class Ct {
|
|
|
9906
9968
|
* Checks if the block containing the text cursor can be nested.
|
|
9907
9969
|
*/
|
|
9908
9970
|
canNestBlock() {
|
|
9909
|
-
const { startPos: t, depth: i } =
|
|
9971
|
+
const { startPos: t, depth: i } = k(
|
|
9910
9972
|
this._tiptapEditor.state.doc,
|
|
9911
9973
|
this._tiptapEditor.state.selection.from
|
|
9912
9974
|
);
|
|
@@ -9922,7 +9984,7 @@ class Ct {
|
|
|
9922
9984
|
* Checks if the block containing the text cursor is nested.
|
|
9923
9985
|
*/
|
|
9924
9986
|
canUnnestBlock() {
|
|
9925
|
-
const { depth: t } =
|
|
9987
|
+
const { depth: t } = k(
|
|
9926
9988
|
this._tiptapEditor.state.doc,
|
|
9927
9989
|
this._tiptapEditor.state.selection.from
|
|
9928
9990
|
);
|
|
@@ -9942,7 +10004,7 @@ class Ct {
|
|
|
9942
10004
|
* @returns The blocks, serialized as an HTML string.
|
|
9943
10005
|
*/
|
|
9944
10006
|
async blocksToHTMLLossy(t = this.document) {
|
|
9945
|
-
return await
|
|
10007
|
+
return await oe(), he(this.pmSchema, this).exportBlocks(t, {});
|
|
9946
10008
|
}
|
|
9947
10009
|
/**
|
|
9948
10010
|
* Serializes blocks into an HTML string in the format that would normally be rendered by the editor.
|
|
@@ -9954,7 +10016,7 @@ class Ct {
|
|
|
9954
10016
|
* @returns The blocks, serialized as an HTML string.
|
|
9955
10017
|
*/
|
|
9956
10018
|
async blocksToFullHTML(t) {
|
|
9957
|
-
return
|
|
10019
|
+
return Pi(this.pmSchema, this).serializeBlocks(t, {});
|
|
9958
10020
|
}
|
|
9959
10021
|
/**
|
|
9960
10022
|
* Parses blocks from an HTML string. Tries to create `Block` objects out of any HTML block-level elements, and
|
|
@@ -9964,7 +10026,7 @@ class Ct {
|
|
|
9964
10026
|
* @returns The blocks parsed from the HTML string.
|
|
9965
10027
|
*/
|
|
9966
10028
|
async tryParseHTMLToBlocks(t) {
|
|
9967
|
-
return
|
|
10029
|
+
return vt(
|
|
9968
10030
|
t,
|
|
9969
10031
|
this.schema.blockSchema,
|
|
9970
10032
|
this.schema.inlineContentSchema,
|
|
@@ -9979,7 +10041,7 @@ class Ct {
|
|
|
9979
10041
|
* @returns The blocks, serialized as a Markdown string.
|
|
9980
10042
|
*/
|
|
9981
10043
|
async blocksToMarkdownLossy(t = this.document) {
|
|
9982
|
-
return
|
|
10044
|
+
return on(t, this.pmSchema, this, {});
|
|
9983
10045
|
}
|
|
9984
10046
|
/**
|
|
9985
10047
|
* Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on
|
|
@@ -9989,7 +10051,7 @@ class Ct {
|
|
|
9989
10051
|
* @returns The blocks parsed from the Markdown string.
|
|
9990
10052
|
*/
|
|
9991
10053
|
async tryParseMarkdownToBlocks(t) {
|
|
9992
|
-
return
|
|
10054
|
+
return cn(
|
|
9993
10055
|
t,
|
|
9994
10056
|
this.schema.blockSchema,
|
|
9995
10057
|
this.schema.inlineContentSchema,
|
|
@@ -10050,43 +10112,43 @@ class Ct {
|
|
|
10050
10112
|
);
|
|
10051
10113
|
}
|
|
10052
10114
|
}
|
|
10053
|
-
let
|
|
10054
|
-
async function
|
|
10055
|
-
if (!
|
|
10115
|
+
let le, ve;
|
|
10116
|
+
async function Gr(e, t) {
|
|
10117
|
+
if (!Ko("text", e))
|
|
10056
10118
|
return [];
|
|
10057
|
-
if (!
|
|
10058
|
-
|
|
10059
|
-
const n = (await
|
|
10060
|
-
await
|
|
10119
|
+
if (!le) {
|
|
10120
|
+
le = import("@emoji-mart/data"), ve = await import("emoji-mart");
|
|
10121
|
+
const n = (await le).default;
|
|
10122
|
+
await ve.init({ data: n });
|
|
10061
10123
|
}
|
|
10062
|
-
const i = (await
|
|
10063
|
-
return (t.trim() === "" ? Object.values(i.emojis) : await
|
|
10124
|
+
const i = (await le).default;
|
|
10125
|
+
return (t.trim() === "" ? Object.values(i.emojis) : await ve.SearchIndex.search(t)).map((n) => ({
|
|
10064
10126
|
id: n.skins[0].native,
|
|
10065
10127
|
onItemClick: () => e.insertInlineContent(n.skins[0].native + " ")
|
|
10066
10128
|
}));
|
|
10067
10129
|
}
|
|
10068
|
-
function
|
|
10130
|
+
function or(e) {
|
|
10069
10131
|
let t = e.getTextCursorPosition().block, i = e.schema.blockSchema[t.type].content;
|
|
10070
10132
|
for (; i === "none"; )
|
|
10071
10133
|
t = e.getTextCursorPosition().nextBlock, i = e.schema.blockSchema[t.type].content, e.setTextCursorPosition(t, "end");
|
|
10072
10134
|
}
|
|
10073
|
-
function
|
|
10135
|
+
function S(e, t) {
|
|
10074
10136
|
const i = e.getTextCursorPosition().block;
|
|
10075
10137
|
if (i.content === void 0)
|
|
10076
10138
|
throw new Error("Slash Menu open in a block that doesn't contain content.");
|
|
10077
|
-
Array.isArray(i.content) && (i.content.length === 1 &&
|
|
10139
|
+
Array.isArray(i.content) && (i.content.length === 1 && ie(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(
|
|
10078
10140
|
e.getTextCursorPosition().nextBlock,
|
|
10079
10141
|
"end"
|
|
10080
10142
|
));
|
|
10081
10143
|
const o = e.getTextCursorPosition().block;
|
|
10082
|
-
return
|
|
10144
|
+
return or(e), o;
|
|
10083
10145
|
}
|
|
10084
|
-
function
|
|
10146
|
+
function Wr(e) {
|
|
10085
10147
|
const t = [];
|
|
10086
|
-
return
|
|
10148
|
+
return M("heading", e) && t.push(
|
|
10087
10149
|
{
|
|
10088
10150
|
onItemClick: () => {
|
|
10089
|
-
|
|
10151
|
+
S(e, {
|
|
10090
10152
|
type: "heading",
|
|
10091
10153
|
props: { level: 1 }
|
|
10092
10154
|
});
|
|
@@ -10097,7 +10159,7 @@ function Rr(e) {
|
|
|
10097
10159
|
},
|
|
10098
10160
|
{
|
|
10099
10161
|
onItemClick: () => {
|
|
10100
|
-
|
|
10162
|
+
S(e, {
|
|
10101
10163
|
type: "heading",
|
|
10102
10164
|
props: { level: 2 }
|
|
10103
10165
|
});
|
|
@@ -10108,7 +10170,7 @@ function Rr(e) {
|
|
|
10108
10170
|
},
|
|
10109
10171
|
{
|
|
10110
10172
|
onItemClick: () => {
|
|
10111
|
-
|
|
10173
|
+
S(e, {
|
|
10112
10174
|
type: "heading",
|
|
10113
10175
|
props: { level: 3 }
|
|
10114
10176
|
});
|
|
@@ -10117,45 +10179,45 @@ function Rr(e) {
|
|
|
10117
10179
|
key: "heading_3",
|
|
10118
10180
|
...e.dictionary.slash_menu.heading_3
|
|
10119
10181
|
}
|
|
10120
|
-
),
|
|
10182
|
+
), M("numberedListItem", e) && t.push({
|
|
10121
10183
|
onItemClick: () => {
|
|
10122
|
-
|
|
10184
|
+
S(e, {
|
|
10123
10185
|
type: "numberedListItem"
|
|
10124
10186
|
});
|
|
10125
10187
|
},
|
|
10126
10188
|
badge: D("Mod-Shift-7"),
|
|
10127
10189
|
key: "numbered_list",
|
|
10128
10190
|
...e.dictionary.slash_menu.numbered_list
|
|
10129
|
-
}),
|
|
10191
|
+
}), M("bulletListItem", e) && t.push({
|
|
10130
10192
|
onItemClick: () => {
|
|
10131
|
-
|
|
10193
|
+
S(e, {
|
|
10132
10194
|
type: "bulletListItem"
|
|
10133
10195
|
});
|
|
10134
10196
|
},
|
|
10135
10197
|
badge: D("Mod-Shift-8"),
|
|
10136
10198
|
key: "bullet_list",
|
|
10137
10199
|
...e.dictionary.slash_menu.bullet_list
|
|
10138
|
-
}),
|
|
10200
|
+
}), M("checkListItem", e) && t.push({
|
|
10139
10201
|
onItemClick: () => {
|
|
10140
|
-
|
|
10202
|
+
S(e, {
|
|
10141
10203
|
type: "checkListItem"
|
|
10142
10204
|
});
|
|
10143
10205
|
},
|
|
10144
10206
|
badge: D("Mod-Shift-9"),
|
|
10145
10207
|
key: "check_list",
|
|
10146
10208
|
...e.dictionary.slash_menu.check_list
|
|
10147
|
-
}),
|
|
10209
|
+
}), M("paragraph", e) && t.push({
|
|
10148
10210
|
onItemClick: () => {
|
|
10149
|
-
|
|
10211
|
+
S(e, {
|
|
10150
10212
|
type: "paragraph"
|
|
10151
10213
|
});
|
|
10152
10214
|
},
|
|
10153
10215
|
badge: D("Mod-Alt-0"),
|
|
10154
10216
|
key: "paragraph",
|
|
10155
10217
|
...e.dictionary.slash_menu.paragraph
|
|
10156
|
-
}),
|
|
10218
|
+
}), M("table", e) && t.push({
|
|
10157
10219
|
onItemClick: () => {
|
|
10158
|
-
|
|
10220
|
+
S(e, {
|
|
10159
10221
|
type: "table",
|
|
10160
10222
|
content: {
|
|
10161
10223
|
type: "tableContent",
|
|
@@ -10173,9 +10235,9 @@ function Rr(e) {
|
|
|
10173
10235
|
badge: void 0,
|
|
10174
10236
|
key: "table",
|
|
10175
10237
|
...e.dictionary.slash_menu.table
|
|
10176
|
-
}),
|
|
10238
|
+
}), M("image", e) && t.push({
|
|
10177
10239
|
onItemClick: () => {
|
|
10178
|
-
const i =
|
|
10240
|
+
const i = S(e, {
|
|
10179
10241
|
type: "image"
|
|
10180
10242
|
});
|
|
10181
10243
|
e.dispatch(
|
|
@@ -10186,9 +10248,9 @@ function Rr(e) {
|
|
|
10186
10248
|
},
|
|
10187
10249
|
key: "image",
|
|
10188
10250
|
...e.dictionary.slash_menu.image
|
|
10189
|
-
}),
|
|
10251
|
+
}), M("video", e) && t.push({
|
|
10190
10252
|
onItemClick: () => {
|
|
10191
|
-
const i =
|
|
10253
|
+
const i = S(e, {
|
|
10192
10254
|
type: "video"
|
|
10193
10255
|
});
|
|
10194
10256
|
e.dispatch(
|
|
@@ -10199,9 +10261,9 @@ function Rr(e) {
|
|
|
10199
10261
|
},
|
|
10200
10262
|
key: "video",
|
|
10201
10263
|
...e.dictionary.slash_menu.video
|
|
10202
|
-
}),
|
|
10264
|
+
}), M("audio", e) && t.push({
|
|
10203
10265
|
onItemClick: () => {
|
|
10204
|
-
const i =
|
|
10266
|
+
const i = S(e, {
|
|
10205
10267
|
type: "audio"
|
|
10206
10268
|
});
|
|
10207
10269
|
e.dispatch(
|
|
@@ -10212,9 +10274,9 @@ function Rr(e) {
|
|
|
10212
10274
|
},
|
|
10213
10275
|
key: "audio",
|
|
10214
10276
|
...e.dictionary.slash_menu.audio
|
|
10215
|
-
}),
|
|
10277
|
+
}), M("file", e) && t.push({
|
|
10216
10278
|
onItemClick: () => {
|
|
10217
|
-
const i =
|
|
10279
|
+
const i = S(e, {
|
|
10218
10280
|
type: "file"
|
|
10219
10281
|
});
|
|
10220
10282
|
e.dispatch(
|
|
@@ -10236,14 +10298,14 @@ function Rr(e) {
|
|
|
10236
10298
|
...e.dictionary.slash_menu.emoji
|
|
10237
10299
|
}), t;
|
|
10238
10300
|
}
|
|
10239
|
-
function
|
|
10301
|
+
function Kr(e, t) {
|
|
10240
10302
|
return e.filter(
|
|
10241
10303
|
({ title: i, aliases: o }) => i.toLowerCase().includes(t.toLowerCase()) || o && o.filter(
|
|
10242
10304
|
(n) => n.toLowerCase().includes(t.toLowerCase())
|
|
10243
10305
|
).length !== 0
|
|
10244
10306
|
);
|
|
10245
10307
|
}
|
|
10246
|
-
function
|
|
10308
|
+
function xe(e = "") {
|
|
10247
10309
|
return typeof e == "string" ? [
|
|
10248
10310
|
{
|
|
10249
10311
|
type: "text",
|
|
@@ -10252,22 +10314,22 @@ function ye(e = "") {
|
|
|
10252
10314
|
}
|
|
10253
10315
|
] : e;
|
|
10254
10316
|
}
|
|
10255
|
-
function
|
|
10256
|
-
return typeof e == "string" ?
|
|
10317
|
+
function Mt(e) {
|
|
10318
|
+
return typeof e == "string" ? xe(e) : Array.isArray(e) ? e.flatMap((t) => typeof t == "string" ? xe(t) : ot(t) ? {
|
|
10257
10319
|
...t,
|
|
10258
|
-
content:
|
|
10259
|
-
} :
|
|
10320
|
+
content: xe(t.content)
|
|
10321
|
+
} : ie(t) ? t : {
|
|
10260
10322
|
props: {},
|
|
10261
10323
|
...t,
|
|
10262
|
-
content:
|
|
10324
|
+
content: Mt(t.content)
|
|
10263
10325
|
}) : e;
|
|
10264
10326
|
}
|
|
10265
|
-
function
|
|
10327
|
+
function $r(e, t) {
|
|
10266
10328
|
return t.map(
|
|
10267
|
-
(i) =>
|
|
10329
|
+
(i) => Tt(e, i)
|
|
10268
10330
|
);
|
|
10269
10331
|
}
|
|
10270
|
-
function
|
|
10332
|
+
function Tt(e, t) {
|
|
10271
10333
|
const i = {
|
|
10272
10334
|
id: "",
|
|
10273
10335
|
type: t.type,
|
|
@@ -10282,149 +10344,149 @@ function Mt(e, t) {
|
|
|
10282
10344
|
}
|
|
10283
10345
|
), {
|
|
10284
10346
|
...i,
|
|
10285
|
-
content:
|
|
10286
|
-
children: i.children.map((o) =>
|
|
10347
|
+
content: Mt(i.content),
|
|
10348
|
+
children: i.children.map((o) => Tt(e, o))
|
|
10287
10349
|
};
|
|
10288
10350
|
}
|
|
10289
|
-
function
|
|
10290
|
-
e.id || (e.id =
|
|
10351
|
+
function nr(e) {
|
|
10352
|
+
e.id || (e.id = ne.options.generateID()), e.children && rr(e.children);
|
|
10291
10353
|
}
|
|
10292
|
-
function
|
|
10354
|
+
function rr(e) {
|
|
10293
10355
|
for (const t of e)
|
|
10294
|
-
|
|
10356
|
+
nr(t);
|
|
10295
10357
|
}
|
|
10296
10358
|
export {
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10359
|
+
Yi as AudioBlock,
|
|
10360
|
+
St as BlockNoteEditor,
|
|
10361
|
+
Pe as BlockNoteSchema,
|
|
10362
|
+
no as FileBlock,
|
|
10363
|
+
pn as FilePanelProsemirrorPlugin,
|
|
10364
|
+
un as FilePanelView,
|
|
10365
|
+
fn as FormattingToolbarProsemirrorPlugin,
|
|
10366
|
+
hn as FormattingToolbarView,
|
|
10367
|
+
vt as HTMLToBlocks,
|
|
10368
|
+
uo as ImageBlock,
|
|
10369
|
+
_n as LinkToolbarProsemirrorPlugin,
|
|
10370
|
+
En as SideMenuProsemirrorPlugin,
|
|
10371
|
+
vn as SideMenuView,
|
|
10372
|
+
Mn as SuggestionMenuProseMirrorPlugin,
|
|
10373
|
+
An as TableHandlesProsemirrorPlugin,
|
|
10374
|
+
In as TableHandlesView,
|
|
10375
|
+
ne as UniqueID,
|
|
10314
10376
|
P as UnreachableCaseError,
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10377
|
+
bo as VideoBlock,
|
|
10378
|
+
nr as addIdsToBlock,
|
|
10379
|
+
rr as addIdsToBlocks,
|
|
10380
|
+
Ge as addInlineContentAttributes,
|
|
10381
|
+
zi as addInlineContentKeyboardShortcuts,
|
|
10382
|
+
Gi as addStyleAttributes,
|
|
10383
|
+
Di as applyNonSelectableBlockFix,
|
|
10384
|
+
Ar as assertEmpty,
|
|
10385
|
+
qi as audioBlockConfig,
|
|
10386
|
+
Zi as audioParse,
|
|
10387
|
+
$i as audioPropSchema,
|
|
10388
|
+
Xi as audioRender,
|
|
10389
|
+
Ji as audioToExternalHTML,
|
|
10328
10390
|
U as blockToNode,
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
|
|
10347
|
-
|
|
10348
|
-
|
|
10349
|
-
|
|
10350
|
-
|
|
10351
|
-
|
|
10352
|
-
|
|
10353
|
-
|
|
10354
|
-
|
|
10355
|
-
|
|
10356
|
-
|
|
10357
|
-
|
|
10358
|
-
|
|
10359
|
-
|
|
10391
|
+
on as blocksToMarkdown,
|
|
10392
|
+
de as camelToDataKebab,
|
|
10393
|
+
Or as checkBlockHasDefaultProp,
|
|
10394
|
+
$o as checkBlockIsDefaultType,
|
|
10395
|
+
zr as checkBlockIsFileBlock,
|
|
10396
|
+
Vr as checkBlockIsFileBlockWithPlaceholder,
|
|
10397
|
+
Rr as checkBlockIsFileBlockWithPreview,
|
|
10398
|
+
qo as checkBlockTypeHasDefaultProp,
|
|
10399
|
+
M as checkDefaultBlockTypeInSchema,
|
|
10400
|
+
Ko as checkDefaultInlineContentTypeInSchema,
|
|
10401
|
+
Ae as cleanHTMLToMarkdown,
|
|
10402
|
+
Te as contentNodeToInlineContent,
|
|
10403
|
+
Ki as createAddFileButton,
|
|
10404
|
+
me as createBlockSpec,
|
|
10405
|
+
Z as createBlockSpecFromStronglyTypedTiptapNode,
|
|
10406
|
+
F as createDefaultBlockDOMOutputSpec,
|
|
10407
|
+
ft as createDefaultFilePreview,
|
|
10408
|
+
he as createExternalHTMLExporter,
|
|
10409
|
+
Be as createFigureWithCaption,
|
|
10410
|
+
re as createFileAndCaptionWrapper,
|
|
10411
|
+
fe as createFileBlockWrapper,
|
|
10412
|
+
Hr as createInlineContentSpec,
|
|
10413
|
+
Vi as createInlineContentSpecFromTipTapNode,
|
|
10414
|
+
ct as createInternalBlockSpec,
|
|
10415
|
+
Pi as createInternalHTMLSerializer,
|
|
10416
|
+
Ri as createInternalInlineContentSpec,
|
|
10417
|
+
ht as createInternalStyleSpec,
|
|
10418
|
+
be as createLinkWithCaption,
|
|
10419
|
+
gt as createResizeHandlesWrapper,
|
|
10420
|
+
G as createStronglyTypedTiptapNode,
|
|
10421
|
+
Ur as createStyleSpec,
|
|
10360
10422
|
j as createStyleSpecFromTipTapMark,
|
|
10361
|
-
|
|
10362
|
-
|
|
10363
|
-
|
|
10364
|
-
|
|
10365
|
-
|
|
10366
|
-
|
|
10367
|
-
|
|
10368
|
-
|
|
10369
|
-
|
|
10423
|
+
Fr as createSuggestionMenu,
|
|
10424
|
+
Go as defaultBlockSchema,
|
|
10425
|
+
bt as defaultBlockSpecs,
|
|
10426
|
+
Fe as defaultBlockToHTML,
|
|
10427
|
+
Wo as defaultInlineContentSchema,
|
|
10428
|
+
kt as defaultInlineContentSpecs,
|
|
10429
|
+
y as defaultProps,
|
|
10430
|
+
jr as defaultStyleSchema,
|
|
10431
|
+
_t as defaultStyleSpecs,
|
|
10370
10432
|
H as esmDependencies,
|
|
10371
|
-
|
|
10372
|
-
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
|
|
10377
|
-
|
|
10433
|
+
eo as fileBlockConfig,
|
|
10434
|
+
io as fileParse,
|
|
10435
|
+
Qi as filePropSchema,
|
|
10436
|
+
to as fileRender,
|
|
10437
|
+
oo as fileToExternalHTML,
|
|
10438
|
+
Pr as filenameFromURL,
|
|
10439
|
+
Kr as filterSuggestionItems,
|
|
10378
10440
|
D as formatKeyboardShortcut,
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
|
|
10382
|
-
|
|
10383
|
-
|
|
10384
|
-
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
|
|
10441
|
+
mn as formattingToolbarPluginKey,
|
|
10442
|
+
Ui as getBlockFromPos,
|
|
10443
|
+
qn as getBlockNoteExtensions,
|
|
10444
|
+
ut as getBlockSchemaFromSpecs,
|
|
10445
|
+
T as getCurrentBlockContentType,
|
|
10446
|
+
Gr as getDefaultEmojiPickerItems,
|
|
10447
|
+
Wr as getDefaultSlashMenuItems,
|
|
10448
|
+
_e as getDraggableBlockFromElement,
|
|
10449
|
+
Oi as getInlineContentParseRules,
|
|
10450
|
+
pt as getInlineContentSchemaFromSpecs,
|
|
10451
|
+
ji as getParseRules,
|
|
10452
|
+
Wi as getStyleParseRules,
|
|
10453
|
+
mt as getStyleSchemaFromSpecs,
|
|
10454
|
+
ao as imageBlockConfig,
|
|
10455
|
+
lo as imageParse,
|
|
10456
|
+
ro as imagePropSchema,
|
|
10457
|
+
so as imageRender,
|
|
10458
|
+
co as imageToExternalHTML,
|
|
10459
|
+
lt as inheritedProps,
|
|
10460
|
+
oe as initializeESMDependencies,
|
|
10399
10461
|
V as inlineContentToNodes,
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10462
|
+
S as insertOrUpdateBlock,
|
|
10463
|
+
Hi as isAppleOS,
|
|
10464
|
+
Re as isLinkInlineContent,
|
|
10465
|
+
ot as isPartialLinkInlineContent,
|
|
10466
|
+
Nr as isSafari,
|
|
10467
|
+
ie as isStyledTextInlineContent,
|
|
10468
|
+
bn as linkToolbarPluginKey,
|
|
10469
|
+
Ir as locales,
|
|
10470
|
+
cn as markdownToBlocks,
|
|
10471
|
+
O as mergeCSSClasses,
|
|
10410
10472
|
C as nodeToBlock,
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
|
|
10417
|
-
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
|
|
10424
|
-
|
|
10425
|
-
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10473
|
+
Se as nodeToCustomInlineContent,
|
|
10474
|
+
We as parseEmbedElement,
|
|
10475
|
+
ge as parseFigureElement,
|
|
10476
|
+
$e as parseImageElement,
|
|
10477
|
+
Tt as partialBlockToBlockForTesting,
|
|
10478
|
+
$r as partialBlocksToBlocksForTesting,
|
|
10479
|
+
dt as propsToAttributes,
|
|
10480
|
+
xn as sideMenuPluginKey,
|
|
10481
|
+
Fi as stylePropsToAttributes,
|
|
10482
|
+
nt as tableContentToNodes,
|
|
10483
|
+
ee as tableHandlesPluginKey,
|
|
10484
|
+
Dr as uploadToTmpFilesDotOrg_DEV_ONLY,
|
|
10485
|
+
ho as videoBlockConfig,
|
|
10486
|
+
fo as videoParse,
|
|
10487
|
+
po as videoPropSchema,
|
|
10488
|
+
mo as videoRender,
|
|
10489
|
+
go as videoToExternalHTML,
|
|
10490
|
+
ae as wrapInBlockStructure
|
|
10429
10491
|
};
|
|
10430
10492
|
//# sourceMappingURL=blocknote.js.map
|