@blocknote/core 0.31.2 → 0.31.3
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.cjs +7 -7
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +504 -483
- package/dist/blocknote.js.map +1 -1
- package/dist/{en-BXVKCwYt.cjs → en-C0Chm3Nc.cjs} +2 -2
- package/dist/{en-BXVKCwYt.cjs.map → en-C0Chm3Nc.cjs.map} +1 -1
- package/dist/{en-qGo6sk9V.js → en-CdzlzPhp.js} +4 -1
- package/dist/{en-qGo6sk9V.js.map → en-CdzlzPhp.js.map} +1 -1
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +62 -5
- package/dist/locales.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/webpack-stats.json +1 -1
- package/package.json +1 -1
- package/src/editor/Block.css +14 -19
- package/src/editor/BlockNoteExtensions.ts +1 -1
- package/src/extensions/Collaboration/ForkYDocPlugin.ts +26 -8
- package/src/extensions/Collaboration/UndoPlugin.ts +3 -2
- package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +16 -4
- package/src/i18n/locales/ar.ts +3 -0
- package/src/i18n/locales/de.ts +3 -0
- package/src/i18n/locales/en.ts +3 -0
- package/src/i18n/locales/es.ts +3 -0
- package/src/i18n/locales/fr.ts +3 -0
- package/src/i18n/locales/hr.ts +3 -0
- package/src/i18n/locales/is.ts +3 -0
- package/src/i18n/locales/it.ts +3 -0
- package/src/i18n/locales/ja.ts +3 -0
- package/src/i18n/locales/ko.ts +3 -0
- package/src/i18n/locales/nl.ts +3 -0
- package/src/i18n/locales/no.ts +3 -0
- package/src/i18n/locales/pl.ts +3 -0
- package/src/i18n/locales/pt.ts +3 -0
- package/src/i18n/locales/ru.ts +3 -0
- package/src/i18n/locales/sk.ts +3 -0
- package/src/i18n/locales/uk.ts +3 -0
- package/src/i18n/locales/vi.ts +3 -0
- package/src/i18n/locales/zh-tw.ts +3 -0
- package/src/i18n/locales/zh.ts +3 -0
- package/types/src/extensions/Collaboration/UndoPlugin.d.ts +4 -1
- package/types/src/i18n/locales/en.d.ts +3 -0
- package/types/src/i18n/locales/sk.d.ts +3 -0
package/dist/blocknote.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
var so = Object.defineProperty;
|
|
2
2
|
var io = (e, n, t) => n in e ? so(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
|
|
3
3
|
var p = (e, n, t) => io(e, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
-
import { Slice as K, Fragment as D, DOMSerializer as an, DOMParser as
|
|
5
|
-
import { ReplaceStep as cn, ReplaceAroundStep as
|
|
6
|
-
import { Extension as V, combineTransactionSteps as ln, getChangedRanges as dn, findChildrenInRange as
|
|
7
|
-
import { Plugin as A, PluginKey as U, TextSelection as H, NodeSelection as ge, Selection as
|
|
4
|
+
import { Slice as K, Fragment as D, DOMSerializer as an, DOMParser as We, Node as ao } from "prosemirror-model";
|
|
5
|
+
import { ReplaceStep as cn, ReplaceAroundStep as nt, Mapping as co } from "prosemirror-transform";
|
|
6
|
+
import { Extension as V, combineTransactionSteps as ln, getChangedRanges as dn, findChildrenInRange as ot, Node as te, Mark as ne, isTextSelection as un, InputRule as le, callOrReturn as lo, getExtensionField as uo, mergeAttributes as bt, selectionToInsertionEnd as po, isNodeSelection as rt, posToDOMRect as Ve, getMarkRange as At, findChildren as Nt, findParentNode as ho, extensions as ke, Editor as fo, createDocument as mo, getSchema as go } from "@tiptap/core";
|
|
7
|
+
import { Plugin as A, PluginKey as U, TextSelection as H, NodeSelection as ge, Selection as Oe, EditorState as bo } from "prosemirror-state";
|
|
8
8
|
import { v4 as pn } from "uuid";
|
|
9
9
|
import { createHighlightPlugin as ko } from "prosemirror-highlight";
|
|
10
10
|
import { createParser as wo } from "prosemirror-highlight/shiki";
|
|
11
11
|
import yo from "@tiptap/extension-bold";
|
|
12
12
|
import Co from "@tiptap/extension-code";
|
|
13
13
|
import vo from "@tiptap/extension-italic";
|
|
14
|
-
import
|
|
15
|
-
import
|
|
14
|
+
import So from "@tiptap/extension-strike";
|
|
15
|
+
import Eo from "@tiptap/extension-underline";
|
|
16
16
|
import { TableCell as Bo } from "@tiptap/extension-table-cell";
|
|
17
17
|
import { TableHeader as xo } from "@tiptap/extension-table-header";
|
|
18
|
-
import { goToNextCell as
|
|
18
|
+
import { goToNextCell as Ht, columnResizing as Mo, tableEditing as To, TableView as Po, CellSelection as Ee, TableMap as Dt, addRowBefore as Io, addRowAfter as Lo, addColumnBefore as Ao, addColumnAfter as No, deleteRow as Ho, deleteColumn as Do, mergeCells as Oo, splitCell as Ro } from "prosemirror-tables";
|
|
19
19
|
import { Gapcursor as Vo } from "@tiptap/extension-gapcursor";
|
|
20
20
|
import { History as Uo } from "@tiptap/extension-history";
|
|
21
21
|
import { Link as _o } from "@tiptap/extension-link";
|
|
22
22
|
import { Text as $o } from "@tiptap/extension-text";
|
|
23
|
-
import { yCursorPlugin as Fo, defaultSelectionBuilder as zo, ySyncPlugin as Wo, yUndoPlugin as jo, ySyncPluginKey as
|
|
23
|
+
import { yCursorPlugin as Fo, defaultSelectionBuilder as zo, ySyncPlugin as Wo, yUndoPlugin as jo, ySyncPluginKey as de, getRelativeSelection as Go, absolutePositionToRelativePosition as qo, relativePositionToAbsolutePosition as Ko, yUndoPluginKey as Ie, yCursorPluginKey as Jo, undoCommand as Xo, redoCommand as Yo } from "y-prosemirror";
|
|
24
24
|
import { DecorationSet as W, Decoration as J, EditorView as Zo } from "prosemirror-view";
|
|
25
|
-
import * as
|
|
25
|
+
import * as ie from "yjs";
|
|
26
26
|
import { undo as Qo, redo as er } from "prosemirror-history";
|
|
27
27
|
import { dropCursor as tr } from "prosemirror-dropcursor";
|
|
28
|
-
import { e as nr } from "./en-
|
|
28
|
+
import { e as nr } from "./en-CdzlzPhp.js";
|
|
29
29
|
function or(e, n = JSON.stringify) {
|
|
30
30
|
const t = {};
|
|
31
31
|
return e.filter((o) => {
|
|
@@ -39,7 +39,7 @@ function rr(e) {
|
|
|
39
39
|
);
|
|
40
40
|
return or(n);
|
|
41
41
|
}
|
|
42
|
-
const
|
|
42
|
+
const je = V.create({
|
|
43
43
|
name: "uniqueID",
|
|
44
44
|
// we’ll set a very high priority to make sure this runs first
|
|
45
45
|
// and is compatible with `appendTransaction` hooks of other extensions
|
|
@@ -128,7 +128,7 @@ const We = V.create({
|
|
|
128
128
|
t
|
|
129
129
|
), { mapping: h } = u;
|
|
130
130
|
if (dn(u).forEach(({ newRange: m }) => {
|
|
131
|
-
const g =
|
|
131
|
+
const g = ot(
|
|
132
132
|
r.doc,
|
|
133
133
|
m,
|
|
134
134
|
(w) => c.includes(w.type.name)
|
|
@@ -235,12 +235,12 @@ function Ot(e) {
|
|
|
235
235
|
function hn(e) {
|
|
236
236
|
return typeof e != "string" && e.type === "link";
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function ue(e) {
|
|
239
239
|
return typeof e != "string" && e.type === "text";
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function st(e) {
|
|
242
242
|
var n, t, o, r, s;
|
|
243
|
-
return
|
|
243
|
+
return kt(e) ? { ...e } : Ce(e) ? {
|
|
244
244
|
type: "tableCell",
|
|
245
245
|
content: [].concat(e.content),
|
|
246
246
|
props: {
|
|
@@ -265,14 +265,14 @@ function rt(e) {
|
|
|
265
265
|
function Ce(e) {
|
|
266
266
|
return e != null && typeof e != "string" && !Array.isArray(e) && e.type === "tableCell";
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function kt(e) {
|
|
269
269
|
return Ce(e) && e.props !== void 0 && e.content !== void 0;
|
|
270
270
|
}
|
|
271
271
|
function ve(e) {
|
|
272
|
-
return
|
|
272
|
+
return kt(e) ? e.props.colspan ?? 1 : 1;
|
|
273
273
|
}
|
|
274
|
-
function
|
|
275
|
-
return
|
|
274
|
+
function it(e) {
|
|
275
|
+
return kt(e) ? e.props.rowspan ?? 1 : 1;
|
|
276
276
|
}
|
|
277
277
|
class j extends Error {
|
|
278
278
|
constructor(n) {
|
|
@@ -291,7 +291,7 @@ function Z(e, n = "Ctrl") {
|
|
|
291
291
|
function Q(...e) {
|
|
292
292
|
return e.filter((n) => n).join(" ");
|
|
293
293
|
}
|
|
294
|
-
const
|
|
294
|
+
const Mc = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
295
295
|
function G(e, n, t, o) {
|
|
296
296
|
const r = document.createElement("div");
|
|
297
297
|
r.className = Q(
|
|
@@ -315,7 +315,7 @@ function G(e, n, t, o) {
|
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
317
|
const Rt = (e, n) => {
|
|
318
|
-
let t =
|
|
318
|
+
let t = he(e, n.pmSchema);
|
|
319
319
|
t.type.name === "blockContainer" && (t = t.firstChild);
|
|
320
320
|
const o = n.pmSchema.nodes[t.type.name].spec.toDOM;
|
|
321
321
|
if (o === void 0)
|
|
@@ -329,7 +329,7 @@ const Rt = (e, n) => {
|
|
|
329
329
|
);
|
|
330
330
|
return r;
|
|
331
331
|
};
|
|
332
|
-
function
|
|
332
|
+
function Tc(e) {
|
|
333
333
|
const n = e.querySelectorAll("p");
|
|
334
334
|
if (n.length > 1) {
|
|
335
335
|
const t = n[0];
|
|
@@ -339,7 +339,7 @@ function Mc(e) {
|
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
|
-
const
|
|
342
|
+
const M = {
|
|
343
343
|
backgroundColor: {
|
|
344
344
|
default: "default"
|
|
345
345
|
},
|
|
@@ -351,7 +351,7 @@ const T = {
|
|
|
351
351
|
values: ["left", "center", "right", "justify"]
|
|
352
352
|
}
|
|
353
353
|
}, fn = ["backgroundColor", "textColor"];
|
|
354
|
-
function
|
|
354
|
+
function Ue(e) {
|
|
355
355
|
return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
356
356
|
}
|
|
357
357
|
function Pc(e) {
|
|
@@ -369,7 +369,7 @@ function Be(e) {
|
|
|
369
369
|
// value is the same as its default, we don't display an HTML
|
|
370
370
|
// attribute for it.
|
|
371
371
|
parseHTML: (r) => {
|
|
372
|
-
const s = r.getAttribute(
|
|
372
|
+
const s = r.getAttribute(Ue(t));
|
|
373
373
|
if (s === null)
|
|
374
374
|
return null;
|
|
375
375
|
if (o.default === void 0 && o.type === "boolean" || o.default !== void 0 && typeof o.default == "boolean")
|
|
@@ -381,7 +381,7 @@ function Be(e) {
|
|
|
381
381
|
return s;
|
|
382
382
|
},
|
|
383
383
|
renderHTML: (r) => r[t] !== o.default ? {
|
|
384
|
-
[
|
|
384
|
+
[Ue(t)]: r[t]
|
|
385
385
|
} : {}
|
|
386
386
|
};
|
|
387
387
|
}), n;
|
|
@@ -399,7 +399,7 @@ function ir(e, n, t, o) {
|
|
|
399
399
|
throw new Error("Block type does not match");
|
|
400
400
|
return a;
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function Le(e, n, t, o, r = !1, s) {
|
|
403
403
|
const i = document.createElement("div");
|
|
404
404
|
if (s !== void 0)
|
|
405
405
|
for (const [a, c] of Object.entries(s))
|
|
@@ -410,7 +410,7 @@ function Ie(e, n, t, o, r = !1, s) {
|
|
|
410
410
|
), i.setAttribute("data-content-type", n);
|
|
411
411
|
for (const [a, c] of Object.entries(t)) {
|
|
412
412
|
const d = o[a].default;
|
|
413
|
-
!fn.includes(a) && c !== d && i.setAttribute(
|
|
413
|
+
!fn.includes(a) && c !== d && i.setAttribute(Ue(a), c);
|
|
414
414
|
}
|
|
415
415
|
return r && i.setAttribute("data-file-block", ""), i.appendChild(e.dom), e.contentDOM !== void 0 && (e.contentDOM.className = Q(
|
|
416
416
|
"bn-inline-content",
|
|
@@ -487,7 +487,7 @@ function xe(e, n) {
|
|
|
487
487
|
},
|
|
488
488
|
renderHTML({ HTMLAttributes: o }) {
|
|
489
489
|
const r = document.createElement("div");
|
|
490
|
-
return
|
|
490
|
+
return Le(
|
|
491
491
|
{
|
|
492
492
|
dom: r,
|
|
493
493
|
contentDOM: e.content === "inline" ? r : void 0
|
|
@@ -507,7 +507,7 @@ function xe(e, n) {
|
|
|
507
507
|
r,
|
|
508
508
|
this.editor,
|
|
509
509
|
e.type
|
|
510
|
-
), i = ((l = this.options.domAttributes) == null ? void 0 : l.blockContent) || {}, a = n.render(s, r), c =
|
|
510
|
+
), i = ((l = this.options.domAttributes) == null ? void 0 : l.blockContent) || {}, a = n.render(s, r), c = Le(
|
|
511
511
|
a,
|
|
512
512
|
s.type,
|
|
513
513
|
s.props,
|
|
@@ -527,7 +527,7 @@ function xe(e, n) {
|
|
|
527
527
|
toInternalHTML: (o, r) => {
|
|
528
528
|
var a;
|
|
529
529
|
const s = ((a = t.options.domAttributes) == null ? void 0 : a.blockContent) || {}, i = n.render(o, r);
|
|
530
|
-
return
|
|
530
|
+
return Le(
|
|
531
531
|
i,
|
|
532
532
|
o.type,
|
|
533
533
|
o.props,
|
|
@@ -546,7 +546,7 @@ function xe(e, n) {
|
|
|
546
546
|
o,
|
|
547
547
|
r
|
|
548
548
|
);
|
|
549
|
-
return i === void 0 && (i = n.render(o, r)),
|
|
549
|
+
return i === void 0 && (i = n.render(o, r)), Le(
|
|
550
550
|
i,
|
|
551
551
|
o.type,
|
|
552
552
|
o.props,
|
|
@@ -584,7 +584,7 @@ function X(e, n) {
|
|
|
584
584
|
node: i.nodeAfter
|
|
585
585
|
};
|
|
586
586
|
}
|
|
587
|
-
function
|
|
587
|
+
function wt(e, n) {
|
|
588
588
|
if (!e.type.isInGroup("bnBlock"))
|
|
589
589
|
throw new Error(
|
|
590
590
|
`Attempted to get bnBlock node at position but found node of different type ${e.type.name}`
|
|
@@ -637,42 +637,42 @@ function kt(e, n) {
|
|
|
637
637
|
}
|
|
638
638
|
}
|
|
639
639
|
function ee(e) {
|
|
640
|
-
return
|
|
640
|
+
return wt(e.node, e.posBeforeNode);
|
|
641
641
|
}
|
|
642
|
-
function
|
|
642
|
+
function Me(e) {
|
|
643
643
|
if (!e.nodeAfter)
|
|
644
644
|
throw new Error(
|
|
645
645
|
`Attempted to get blockContainer node at position ${e.pos} but a node at this position does not exist`
|
|
646
646
|
);
|
|
647
|
-
return
|
|
647
|
+
return wt(e.nodeAfter, e.pos);
|
|
648
648
|
}
|
|
649
649
|
function v(e) {
|
|
650
650
|
const n = X(e.doc, e.selection.anchor);
|
|
651
651
|
return ee(n);
|
|
652
652
|
}
|
|
653
|
-
function
|
|
653
|
+
function Ge(e) {
|
|
654
654
|
const n = X(e.doc, e.selection.anchor);
|
|
655
655
|
return ee(n);
|
|
656
656
|
}
|
|
657
|
-
function
|
|
657
|
+
function T(e) {
|
|
658
658
|
return "doc" in e ? e.doc.type.schema : e.type.schema;
|
|
659
659
|
}
|
|
660
660
|
function bn(e) {
|
|
661
661
|
return e.cached.blockNoteEditor;
|
|
662
662
|
}
|
|
663
|
-
function
|
|
663
|
+
function Te(e) {
|
|
664
664
|
return bn(e).schema;
|
|
665
665
|
}
|
|
666
|
-
function wt(e) {
|
|
667
|
-
return Me(e).blockSchema;
|
|
668
|
-
}
|
|
669
666
|
function yt(e) {
|
|
670
|
-
return
|
|
667
|
+
return Te(e).blockSchema;
|
|
668
|
+
}
|
|
669
|
+
function Ct(e) {
|
|
670
|
+
return Te(e).inlineContentSchema;
|
|
671
671
|
}
|
|
672
672
|
function be(e) {
|
|
673
|
-
return
|
|
673
|
+
return Te(e).styleSchema;
|
|
674
674
|
}
|
|
675
|
-
function
|
|
675
|
+
function vt(e) {
|
|
676
676
|
return bn(e).blockCache;
|
|
677
677
|
}
|
|
678
678
|
function kn(e, n, t) {
|
|
@@ -694,13 +694,13 @@ function kn(e, n, t) {
|
|
|
694
694
|
}), d.cells = a.content.content.map((u, h) => (r[l] || (r[l] = []), r[l][h] = u.type.name === "tableHeader", {
|
|
695
695
|
type: "tableCell",
|
|
696
696
|
content: u.content.content.map(
|
|
697
|
-
(m) =>
|
|
697
|
+
(m) => qe(m, n, t)
|
|
698
698
|
).reduce(
|
|
699
699
|
(m, g) => {
|
|
700
700
|
if (!m.length)
|
|
701
701
|
return g;
|
|
702
702
|
const b = m[m.length - 1], k = g[0];
|
|
703
|
-
return k &&
|
|
703
|
+
return k && ue(b) && ue(k) && JSON.stringify(b.styles) === JSON.stringify(k.styles) ? (b.text += `
|
|
704
704
|
` + k.text, m.push(...g.slice(1)), m) : (m.push(...g), m);
|
|
705
705
|
},
|
|
706
706
|
[]
|
|
@@ -720,13 +720,13 @@ function kn(e, n, t) {
|
|
|
720
720
|
r != null && r.every((c) => c[a]) && (o.headerCols = (o.headerCols ?? 0) + 1);
|
|
721
721
|
return o;
|
|
722
722
|
}
|
|
723
|
-
function
|
|
723
|
+
function qe(e, n, t) {
|
|
724
724
|
const o = [];
|
|
725
725
|
let r;
|
|
726
726
|
return e.content.forEach((s) => {
|
|
727
727
|
if (s.type.name === "hardBreak") {
|
|
728
728
|
if (r)
|
|
729
|
-
if (
|
|
729
|
+
if (ue(r))
|
|
730
730
|
r.text += `
|
|
731
731
|
`;
|
|
732
732
|
else if (Ot(r))
|
|
@@ -749,7 +749,7 @@ function Ge(e, n, t) {
|
|
|
749
749
|
return;
|
|
750
750
|
}
|
|
751
751
|
r && (o.push(r), r = void 0), o.push(
|
|
752
|
-
|
|
752
|
+
at(s, n, t)
|
|
753
753
|
);
|
|
754
754
|
return;
|
|
755
755
|
}
|
|
@@ -772,7 +772,7 @@ function Ge(e, n, t) {
|
|
|
772
772
|
else
|
|
773
773
|
throw new j(l.propSchema);
|
|
774
774
|
}
|
|
775
|
-
r ?
|
|
775
|
+
r ? ue(r) ? a ? (o.push(r), r = {
|
|
776
776
|
type: "link",
|
|
777
777
|
href: a.attrs.href,
|
|
778
778
|
content: [
|
|
@@ -823,7 +823,7 @@ function Ge(e, n, t) {
|
|
|
823
823
|
};
|
|
824
824
|
}), r && o.push(r), o;
|
|
825
825
|
}
|
|
826
|
-
function
|
|
826
|
+
function at(e, n, t) {
|
|
827
827
|
if (e.type.name === "text" || e.type.name === "link")
|
|
828
828
|
throw new Error("unexpected");
|
|
829
829
|
const o = {}, r = n[e.type.name];
|
|
@@ -834,7 +834,7 @@ function it(e, n, t) {
|
|
|
834
834
|
a in l && (o[a] = c);
|
|
835
835
|
}
|
|
836
836
|
let s;
|
|
837
|
-
return r.content === "styled" ? s =
|
|
837
|
+
return r.content === "styled" ? s = qe(
|
|
838
838
|
e,
|
|
839
839
|
n,
|
|
840
840
|
t
|
|
@@ -844,16 +844,16 @@ function it(e, n, t) {
|
|
|
844
844
|
content: s
|
|
845
845
|
};
|
|
846
846
|
}
|
|
847
|
-
function
|
|
847
|
+
function S(e, n, t = yt(n), o = Ct(n), r = be(n), s = vt(n)) {
|
|
848
848
|
var g;
|
|
849
849
|
if (!e.type.isInGroup("bnBlock"))
|
|
850
850
|
throw Error("Node should be a bnBlock, but is instead: " + e.type.name);
|
|
851
851
|
const i = s == null ? void 0 : s.get(e);
|
|
852
852
|
if (i)
|
|
853
853
|
return i;
|
|
854
|
-
const a =
|
|
854
|
+
const a = wt(e, 0);
|
|
855
855
|
let c = a.bnBlock.node.attrs.id;
|
|
856
|
-
c === null && (c =
|
|
856
|
+
c === null && (c = je.options.generateID());
|
|
857
857
|
const l = t[a.blockNoteType];
|
|
858
858
|
if (!l)
|
|
859
859
|
throw Error("Block is of an unrecognized type: " + a.blockNoteType);
|
|
@@ -868,7 +868,7 @@ function E(e, n, t = wt(n), o = yt(n), r = be(n), s = Ct(n)) {
|
|
|
868
868
|
const u = t[a.blockNoteType], h = [];
|
|
869
869
|
(g = a.childContainer) == null || g.node.forEach((b) => {
|
|
870
870
|
h.push(
|
|
871
|
-
|
|
871
|
+
S(
|
|
872
872
|
b,
|
|
873
873
|
n,
|
|
874
874
|
t,
|
|
@@ -882,7 +882,7 @@ function E(e, n, t = wt(n), o = yt(n), r = be(n), s = Ct(n)) {
|
|
|
882
882
|
if (u.content === "inline") {
|
|
883
883
|
if (!a.isBlockContainer)
|
|
884
884
|
throw new Error("impossible");
|
|
885
|
-
f =
|
|
885
|
+
f = qe(
|
|
886
886
|
a.blockContent.node,
|
|
887
887
|
o,
|
|
888
888
|
r
|
|
@@ -908,10 +908,10 @@ function E(e, n, t = wt(n), o = yt(n), r = be(n), s = Ct(n)) {
|
|
|
908
908
|
};
|
|
909
909
|
return s == null || s.set(e, m), m;
|
|
910
910
|
}
|
|
911
|
-
function lr(e, n, t =
|
|
911
|
+
function lr(e, n, t = yt(n), o = Ct(n), r = be(n), s = vt(n)) {
|
|
912
912
|
const i = [];
|
|
913
913
|
return e.firstChild.descendants((a) => (i.push(
|
|
914
|
-
|
|
914
|
+
S(
|
|
915
915
|
a,
|
|
916
916
|
n,
|
|
917
917
|
t,
|
|
@@ -921,7 +921,7 @@ function lr(e, n, t = wt(n), o = yt(n), r = be(n), s = Ct(n)) {
|
|
|
921
921
|
)
|
|
922
922
|
), !1)), i;
|
|
923
923
|
}
|
|
924
|
-
function dr(e, n, t =
|
|
924
|
+
function dr(e, n, t = yt(n), o = Ct(n), r = be(n), s = vt(n)) {
|
|
925
925
|
function i(a, c, l) {
|
|
926
926
|
if (a.type.name !== "blockGroup")
|
|
927
927
|
throw new Error("unexpected");
|
|
@@ -948,7 +948,7 @@ function dr(e, n, t = wt(n), o = yt(n), r = be(n), s = Ct(n)) {
|
|
|
948
948
|
u = P.blockCutAtStart, k && (h = P.blockCutAtEnd), d.push(...P.blocks);
|
|
949
949
|
return;
|
|
950
950
|
}
|
|
951
|
-
const w =
|
|
951
|
+
const w = S(
|
|
952
952
|
f,
|
|
953
953
|
n,
|
|
954
954
|
t,
|
|
@@ -992,7 +992,7 @@ function Vt(e, n, t, o) {
|
|
|
992
992
|
return e.dom.setAttribute("data-inline-content-type", n), Object.entries(t).filter(([r, s]) => {
|
|
993
993
|
const i = o[r];
|
|
994
994
|
return s !== i.default;
|
|
995
|
-
}).map(([r, s]) => [
|
|
995
|
+
}).map(([r, s]) => [Ue(r), s]).forEach(([r, s]) => e.dom.setAttribute(r, s)), e.contentDOM !== void 0 && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
996
996
|
}
|
|
997
997
|
function ur(e) {
|
|
998
998
|
return {
|
|
@@ -1055,7 +1055,7 @@ function Ic(e, n) {
|
|
|
1055
1055
|
},
|
|
1056
1056
|
renderHTML({ node: o }) {
|
|
1057
1057
|
const r = this.options.editor, s = n.render(
|
|
1058
|
-
|
|
1058
|
+
at(
|
|
1059
1059
|
o,
|
|
1060
1060
|
r.schema.inlineContentSchema,
|
|
1061
1061
|
r.schema.styleSchema
|
|
@@ -1075,7 +1075,7 @@ function Ic(e, n) {
|
|
|
1075
1075
|
addNodeView() {
|
|
1076
1076
|
return ({ node: o, getPos: r }) => {
|
|
1077
1077
|
const s = this.options.editor, i = n.render(
|
|
1078
|
-
|
|
1078
|
+
at(
|
|
1079
1079
|
o,
|
|
1080
1080
|
s.schema.inlineContentSchema,
|
|
1081
1081
|
s.schema.styleSchema
|
|
@@ -1126,7 +1126,7 @@ function yn(e, n) {
|
|
|
1126
1126
|
implementation: n
|
|
1127
1127
|
};
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1129
|
+
function ae(e, n) {
|
|
1130
1130
|
return yn(
|
|
1131
1131
|
{
|
|
1132
1132
|
type: e.name,
|
|
@@ -1183,7 +1183,7 @@ function Lc(e, n) {
|
|
|
1183
1183
|
});
|
|
1184
1184
|
}
|
|
1185
1185
|
function re(e) {
|
|
1186
|
-
const { height: n, width: t } =
|
|
1186
|
+
const { height: n, width: t } = St(e), o = new Array(n).fill(!1).map(() => new Array(t).fill(null)), r = (s, i) => {
|
|
1187
1187
|
for (let a = s; a < n; a++)
|
|
1188
1188
|
for (let c = i; c < t; c++)
|
|
1189
1189
|
if (!o[a][c])
|
|
@@ -1194,7 +1194,7 @@ function re(e) {
|
|
|
1194
1194
|
};
|
|
1195
1195
|
for (let s = 0; s < e.content.rows.length; s++)
|
|
1196
1196
|
for (let i = 0; i < e.content.rows[s].cells.length; i++) {
|
|
1197
|
-
const a =
|
|
1197
|
+
const a = st(e.content.rows[s].cells[i]), c = it(a), l = ve(a), { row: d, col: u } = r(s, i);
|
|
1198
1198
|
for (let h = d; h < d + c; h++)
|
|
1199
1199
|
for (let f = u; f < u + l; f++) {
|
|
1200
1200
|
if (o[h][f])
|
|
@@ -1212,13 +1212,13 @@ function re(e) {
|
|
|
1212
1212
|
}
|
|
1213
1213
|
return o;
|
|
1214
1214
|
}
|
|
1215
|
-
function
|
|
1215
|
+
function Se(e) {
|
|
1216
1216
|
const n = /* @__PURE__ */ new Set();
|
|
1217
1217
|
return e.map((t) => ({
|
|
1218
1218
|
cells: t.map((o) => n.has(o.row + ":" + o.col) ? !1 : (n.add(o.row + ":" + o.col), o.cell)).filter((o) => o !== !1)
|
|
1219
1219
|
}));
|
|
1220
1220
|
}
|
|
1221
|
-
function
|
|
1221
|
+
function pe(e, n, t = re(n)) {
|
|
1222
1222
|
for (let o = 0; o < t.length; o++)
|
|
1223
1223
|
for (let r = 0; r < t[o].length; r++) {
|
|
1224
1224
|
const s = t[o][r];
|
|
@@ -1229,7 +1229,7 @@ function ue(e, n, t = re(n)) {
|
|
|
1229
1229
|
`Unable to resolve relative table cell indices for table, cell at ${e.row},${e.col} is not occupied`
|
|
1230
1230
|
);
|
|
1231
1231
|
}
|
|
1232
|
-
function
|
|
1232
|
+
function St(e) {
|
|
1233
1233
|
const n = e.content.rows.length;
|
|
1234
1234
|
let t = 0;
|
|
1235
1235
|
return e.content.rows.forEach((o) => {
|
|
@@ -1249,7 +1249,7 @@ function vn(e, n, t = re(n)) {
|
|
|
1249
1249
|
cell: o.cell
|
|
1250
1250
|
};
|
|
1251
1251
|
}
|
|
1252
|
-
function
|
|
1252
|
+
function ct(e, n) {
|
|
1253
1253
|
var s;
|
|
1254
1254
|
const t = re(e);
|
|
1255
1255
|
if (n < 0 || n >= t.length)
|
|
@@ -1270,7 +1270,7 @@ function at(e, n) {
|
|
|
1270
1270
|
);
|
|
1271
1271
|
return r.filter((i, a) => r.findIndex((c) => c.row === i.row && c.col === i.col) === a);
|
|
1272
1272
|
}
|
|
1273
|
-
function
|
|
1273
|
+
function lt(e, n) {
|
|
1274
1274
|
var s;
|
|
1275
1275
|
const t = re(e);
|
|
1276
1276
|
if (n < 0 || n >= t[0].length)
|
|
@@ -1292,14 +1292,14 @@ function ct(e, n) {
|
|
|
1292
1292
|
return r.filter((i, a) => r.findIndex((c) => c.row === i.row && c.col === i.col) === a);
|
|
1293
1293
|
}
|
|
1294
1294
|
function kr(e, n, t, o = re(e)) {
|
|
1295
|
-
const { col: r } =
|
|
1295
|
+
const { col: r } = pe(
|
|
1296
1296
|
{
|
|
1297
1297
|
row: 0,
|
|
1298
1298
|
col: n
|
|
1299
1299
|
},
|
|
1300
1300
|
e,
|
|
1301
1301
|
o
|
|
1302
|
-
), { col: s } =
|
|
1302
|
+
), { col: s } = pe(
|
|
1303
1303
|
{
|
|
1304
1304
|
row: 0,
|
|
1305
1305
|
col: t
|
|
@@ -1310,17 +1310,17 @@ function kr(e, n, t, o = re(e)) {
|
|
|
1310
1310
|
return o.forEach((i) => {
|
|
1311
1311
|
const [a] = i.splice(r, 1);
|
|
1312
1312
|
i.splice(s, 0, a);
|
|
1313
|
-
}),
|
|
1313
|
+
}), Se(o);
|
|
1314
1314
|
}
|
|
1315
1315
|
function wr(e, n, t, o = re(e)) {
|
|
1316
|
-
const { row: r } =
|
|
1316
|
+
const { row: r } = pe(
|
|
1317
1317
|
{
|
|
1318
1318
|
row: n,
|
|
1319
1319
|
col: 0
|
|
1320
1320
|
},
|
|
1321
1321
|
e,
|
|
1322
1322
|
o
|
|
1323
|
-
), { row: s } =
|
|
1323
|
+
), { row: s } = pe(
|
|
1324
1324
|
{
|
|
1325
1325
|
row: t,
|
|
1326
1326
|
col: 0
|
|
@@ -1328,18 +1328,18 @@ function wr(e, n, t, o = re(e)) {
|
|
|
1328
1328
|
e,
|
|
1329
1329
|
o
|
|
1330
1330
|
), [i] = o.splice(r, 1);
|
|
1331
|
-
return o.splice(s, 0, i),
|
|
1331
|
+
return o.splice(s, 0, i), Se(o);
|
|
1332
1332
|
}
|
|
1333
|
-
function
|
|
1334
|
-
return e ? Ce(e) ?
|
|
1335
|
-
(n) => typeof n == "string" ? n.length === 0 :
|
|
1333
|
+
function dt(e) {
|
|
1334
|
+
return e ? Ce(e) ? dt(e.content) : typeof e == "string" ? e.length === 0 : Array.isArray(e) ? e.every(
|
|
1335
|
+
(n) => typeof n == "string" ? n.length === 0 : ue(n) ? n.text.length === 0 : hn(n) ? typeof n.content == "string" ? n.content.length === 0 : n.content.every((t) => t.text.length === 0) : !1
|
|
1336
1336
|
) : !1 : !0;
|
|
1337
1337
|
}
|
|
1338
1338
|
function yr(e, n, t = re(e)) {
|
|
1339
1339
|
if (n === "columns") {
|
|
1340
1340
|
let s = 0;
|
|
1341
1341
|
for (let i = t[0].length - 1; i >= 0 && t.every(
|
|
1342
|
-
(c) =>
|
|
1342
|
+
(c) => dt(c[i].cell) && c[i].colspan === 1
|
|
1343
1343
|
); i--)
|
|
1344
1344
|
s++;
|
|
1345
1345
|
for (let i = t.length - 1; i >= 0; i--) {
|
|
@@ -1349,18 +1349,18 @@ function yr(e, n, t = re(e)) {
|
|
|
1349
1349
|
);
|
|
1350
1350
|
t[i] = t[i].slice(0, a);
|
|
1351
1351
|
}
|
|
1352
|
-
return
|
|
1352
|
+
return Se(t);
|
|
1353
1353
|
}
|
|
1354
1354
|
let o = 0;
|
|
1355
1355
|
for (let s = t.length - 1; s >= 0 && t[s].every(
|
|
1356
|
-
(a) =>
|
|
1356
|
+
(a) => dt(a.cell) && a.rowspan === 1
|
|
1357
1357
|
); s--)
|
|
1358
1358
|
o++;
|
|
1359
1359
|
const r = Math.min(o, t.length - 1);
|
|
1360
|
-
return t.splice(t.length - r, r),
|
|
1360
|
+
return t.splice(t.length - r, r), Se(t);
|
|
1361
1361
|
}
|
|
1362
1362
|
function Cr(e, n, t, o = re(e)) {
|
|
1363
|
-
const { width: r, height: s } =
|
|
1363
|
+
const { width: r, height: s } = St(e);
|
|
1364
1364
|
if (n === "columns")
|
|
1365
1365
|
o.forEach((i, a) => {
|
|
1366
1366
|
if (t >= 0)
|
|
@@ -1370,7 +1370,7 @@ function Cr(e, n, t, o = re(e)) {
|
|
|
1370
1370
|
col: Math.max(...i.map((l) => l.col)) + 1,
|
|
1371
1371
|
rowspan: 1,
|
|
1372
1372
|
colspan: 1,
|
|
1373
|
-
cell:
|
|
1373
|
+
cell: st("")
|
|
1374
1374
|
});
|
|
1375
1375
|
else
|
|
1376
1376
|
i.splice(r + t, -1 * t);
|
|
@@ -1382,25 +1382,25 @@ function Cr(e, n, t, o = re(e)) {
|
|
|
1382
1382
|
col: l,
|
|
1383
1383
|
rowspan: 1,
|
|
1384
1384
|
colspan: 1,
|
|
1385
|
-
cell:
|
|
1385
|
+
cell: st("")
|
|
1386
1386
|
}));
|
|
1387
1387
|
o.push(a);
|
|
1388
1388
|
}
|
|
1389
1389
|
else t < 0 && o.splice(s + t, -1 * t);
|
|
1390
|
-
return
|
|
1390
|
+
return Se(o);
|
|
1391
1391
|
}
|
|
1392
|
-
function
|
|
1393
|
-
const o =
|
|
1394
|
-
if (!o.some((c) =>
|
|
1392
|
+
function Sn(e, n, t) {
|
|
1393
|
+
const o = ct(e, t);
|
|
1394
|
+
if (!o.some((c) => it(c.cell) > 1))
|
|
1395
1395
|
return !0;
|
|
1396
1396
|
let s = t, i = t;
|
|
1397
1397
|
return o.forEach((c) => {
|
|
1398
|
-
const l =
|
|
1398
|
+
const l = it(c.cell);
|
|
1399
1399
|
s = Math.max(s, c.row + l - 1), i = Math.min(i, c.row);
|
|
1400
1400
|
}), n < t ? t === s : t === i;
|
|
1401
1401
|
}
|
|
1402
|
-
function
|
|
1403
|
-
const o =
|
|
1402
|
+
function En(e, n, t) {
|
|
1403
|
+
const o = lt(e, t);
|
|
1404
1404
|
if (!o.some((c) => ve(c.cell) > 1))
|
|
1405
1405
|
return !0;
|
|
1406
1406
|
let s = t, i = t;
|
|
@@ -1410,7 +1410,7 @@ function Sn(e, n, t) {
|
|
|
1410
1410
|
}), n < t ? t === s : t === i;
|
|
1411
1411
|
}
|
|
1412
1412
|
function vr(e, n, t) {
|
|
1413
|
-
const o =
|
|
1413
|
+
const o = pe(e, t), r = pe(n, t);
|
|
1414
1414
|
return o.col === r.col;
|
|
1415
1415
|
}
|
|
1416
1416
|
function Ut(e, n, t, o) {
|
|
@@ -1429,11 +1429,11 @@ function Ut(e, n, t, o) {
|
|
|
1429
1429
|
return !o || !n.nodes[o].spec.code ? e.text.split(/(\n)/g).filter((i) => i.length > 0).map((i) => i === `
|
|
1430
1430
|
` ? n.nodes.hardBreak.createChecked() : n.text(i, r)) : e.text.length > 0 ? [n.text(e.text, r)] : [];
|
|
1431
1431
|
}
|
|
1432
|
-
function
|
|
1432
|
+
function Sr(e, n, t) {
|
|
1433
1433
|
const o = n.marks.link.create({
|
|
1434
1434
|
href: e.href
|
|
1435
1435
|
});
|
|
1436
|
-
return
|
|
1436
|
+
return ut(e.content, n, t).map(
|
|
1437
1437
|
(r) => {
|
|
1438
1438
|
if (r.type.name === "text")
|
|
1439
1439
|
return r.mark([...r.marks, o]);
|
|
@@ -1443,7 +1443,7 @@ function Er(e, n, t) {
|
|
|
1443
1443
|
}
|
|
1444
1444
|
);
|
|
1445
1445
|
}
|
|
1446
|
-
function
|
|
1446
|
+
function ut(e, n, t, o) {
|
|
1447
1447
|
const r = [];
|
|
1448
1448
|
if (typeof e == "string")
|
|
1449
1449
|
return r.push(
|
|
@@ -1464,22 +1464,22 @@ function F(e, n, t, o = be(n)) {
|
|
|
1464
1464
|
const r = [];
|
|
1465
1465
|
for (const s of e)
|
|
1466
1466
|
typeof s == "string" ? r.push(
|
|
1467
|
-
...
|
|
1468
|
-
) : hn(s) ? r.push(...
|
|
1469
|
-
...
|
|
1467
|
+
...ut(s, n, o, t)
|
|
1468
|
+
) : hn(s) ? r.push(...Sr(s, n, o)) : ue(s) ? r.push(
|
|
1469
|
+
...ut([s], n, o, t)
|
|
1470
1470
|
) : r.push(
|
|
1471
1471
|
Bn(s, n, o)
|
|
1472
1472
|
);
|
|
1473
1473
|
return r;
|
|
1474
1474
|
}
|
|
1475
|
-
function
|
|
1475
|
+
function Ke(e, n, t = be(n)) {
|
|
1476
1476
|
const o = [], r = new Array(e.headerRows ?? 0).fill(!0), s = new Array(e.headerCols ?? 0).fill(!0), i = e.columnWidths ?? [];
|
|
1477
1477
|
for (let a = 0; a < e.rows.length; a++) {
|
|
1478
1478
|
const c = e.rows[a], l = [], d = r[a];
|
|
1479
1479
|
for (let h = 0; h < c.cells.length; h++) {
|
|
1480
1480
|
const f = c.cells[h], m = s[h], g = void 0;
|
|
1481
1481
|
let b = null;
|
|
1482
|
-
const k =
|
|
1482
|
+
const k = pe(
|
|
1483
1483
|
{
|
|
1484
1484
|
row: a,
|
|
1485
1485
|
col: h
|
|
@@ -1542,19 +1542,19 @@ function Bn(e, n, t) {
|
|
|
1542
1542
|
);
|
|
1543
1543
|
o = n.nodes[r].createChecked(e.props, s);
|
|
1544
1544
|
} else if (e.content.type === "tableContent") {
|
|
1545
|
-
const s =
|
|
1545
|
+
const s = Ke(e.content, n, t);
|
|
1546
1546
|
o = n.nodes[r].createChecked(e.props, s);
|
|
1547
1547
|
} else
|
|
1548
1548
|
throw new j(e.content.type);
|
|
1549
1549
|
return o;
|
|
1550
1550
|
}
|
|
1551
|
-
function
|
|
1551
|
+
function he(e, n, t = be(n)) {
|
|
1552
1552
|
let o = e.id;
|
|
1553
|
-
o === void 0 && (o =
|
|
1553
|
+
o === void 0 && (o = je.options.generateID());
|
|
1554
1554
|
const r = [];
|
|
1555
1555
|
if (e.children)
|
|
1556
1556
|
for (const i of e.children)
|
|
1557
|
-
r.push(
|
|
1557
|
+
r.push(he(i, n, t));
|
|
1558
1558
|
if (!e.type || // can happen if block.type is not defined (this should create the default node)
|
|
1559
1559
|
n.nodes[e.type].isInGroup("blockContent")) {
|
|
1560
1560
|
const i = Bn(
|
|
@@ -1585,16 +1585,16 @@ function pe(e, n, t = be(n)) {
|
|
|
1585
1585
|
}
|
|
1586
1586
|
function _(e, n) {
|
|
1587
1587
|
let t, o;
|
|
1588
|
-
if (n.firstChild.descendants((r, s) => t ? !1 : !
|
|
1588
|
+
if (n.firstChild.descendants((r, s) => t ? !1 : !pt(r) || r.attrs.id !== e ? !0 : (t = r, o = s + 1, !1)), !(t === void 0 || o === void 0))
|
|
1589
1589
|
return {
|
|
1590
1590
|
node: t,
|
|
1591
1591
|
posBeforeNode: o
|
|
1592
1592
|
};
|
|
1593
1593
|
}
|
|
1594
|
-
function
|
|
1594
|
+
function pt(e) {
|
|
1595
1595
|
return e.type.isInGroup("bnBlock");
|
|
1596
1596
|
}
|
|
1597
|
-
function
|
|
1597
|
+
function Er(e, n) {
|
|
1598
1598
|
return e.id !== n.id || e.type !== n.type || JSON.stringify(e.props) !== JSON.stringify(n.props) || JSON.stringify(e.content) !== JSON.stringify(n.content);
|
|
1599
1599
|
}
|
|
1600
1600
|
function Br(e, n = []) {
|
|
@@ -1606,18 +1606,18 @@ function Br(e, n = []) {
|
|
|
1606
1606
|
} : t = {
|
|
1607
1607
|
type: "yjs-remote"
|
|
1608
1608
|
});
|
|
1609
|
-
const o =
|
|
1609
|
+
const o = T(e), r = ln(e.before, [
|
|
1610
1610
|
e,
|
|
1611
1611
|
...n
|
|
1612
|
-
]), s = dn(r), i = s.flatMap((u) =>
|
|
1612
|
+
]), s = dn(r), i = s.flatMap((u) => ot(
|
|
1613
1613
|
r.before,
|
|
1614
1614
|
u.oldRange,
|
|
1615
|
-
|
|
1616
|
-
)).map(({ node: u }) =>
|
|
1615
|
+
pt
|
|
1616
|
+
)).map(({ node: u }) => S(u, o)), a = s.flatMap((u) => ot(
|
|
1617
1617
|
r.doc,
|
|
1618
1618
|
u.newRange,
|
|
1619
|
-
|
|
1620
|
-
)).map(({ node: u }) =>
|
|
1619
|
+
pt
|
|
1620
|
+
)).map(({ node: u }) => S(u, o)), c = new Map(
|
|
1621
1621
|
a.map((u) => [u.id, u])
|
|
1622
1622
|
), l = new Map(
|
|
1623
1623
|
i.map((u) => [u.id, u])
|
|
@@ -1639,7 +1639,7 @@ function Br(e, n = []) {
|
|
|
1639
1639
|
for (const [u, h] of c)
|
|
1640
1640
|
if (l.has(u)) {
|
|
1641
1641
|
const f = l.get(u);
|
|
1642
|
-
|
|
1642
|
+
Er(f, h) && d.push({
|
|
1643
1643
|
type: "update",
|
|
1644
1644
|
block: h,
|
|
1645
1645
|
prevBlock: f,
|
|
@@ -1649,8 +1649,8 @@ function Br(e, n = []) {
|
|
|
1649
1649
|
return d;
|
|
1650
1650
|
}
|
|
1651
1651
|
function xr(e, n, t, o = "before") {
|
|
1652
|
-
const r = typeof t == "string" ? t : t.id, s =
|
|
1653
|
-
(d) =>
|
|
1652
|
+
const r = typeof t == "string" ? t : t.id, s = T(e), i = n.map(
|
|
1653
|
+
(d) => he(d, s)
|
|
1654
1654
|
), a = _(r, e.doc);
|
|
1655
1655
|
if (!a)
|
|
1656
1656
|
throw new Error(`Block with ID ${r} not found`);
|
|
@@ -1658,12 +1658,12 @@ function xr(e, n, t, o = "before") {
|
|
|
1658
1658
|
return o === "after" && (c += a.node.nodeSize), e.step(
|
|
1659
1659
|
new cn(c, c, new K(D.from(i), 0, 0))
|
|
1660
1660
|
), i.map(
|
|
1661
|
-
(d) =>
|
|
1661
|
+
(d) => S(d, s)
|
|
1662
1662
|
);
|
|
1663
1663
|
}
|
|
1664
1664
|
function _t(e, n, t) {
|
|
1665
|
-
const o =
|
|
1666
|
-
(d) =>
|
|
1665
|
+
const o = T(e), r = t.map(
|
|
1666
|
+
(d) => he(d, o)
|
|
1667
1667
|
), s = new Set(
|
|
1668
1668
|
n.map(
|
|
1669
1669
|
(d) => typeof d == "string" ? d : d.id
|
|
@@ -1675,7 +1675,7 @@ function _t(e, n, t) {
|
|
|
1675
1675
|
return !1;
|
|
1676
1676
|
if (!d.type.isInGroup("bnBlock") || !s.has(d.attrs.id))
|
|
1677
1677
|
return !0;
|
|
1678
|
-
if (i.push(
|
|
1678
|
+
if (i.push(S(d, o)), s.delete(d.attrs.id), t.length > 0 && d.attrs.id === a) {
|
|
1679
1679
|
const g = e.doc.nodeSize;
|
|
1680
1680
|
e.insert(u, r);
|
|
1681
1681
|
const b = e.doc.nodeSize;
|
|
@@ -1693,7 +1693,7 @@ function _t(e, n, t) {
|
|
|
1693
1693
|
);
|
|
1694
1694
|
}
|
|
1695
1695
|
return { insertedBlocks: r.map(
|
|
1696
|
-
(d) =>
|
|
1696
|
+
(d) => S(d, o)
|
|
1697
1697
|
), removedBlocks: i };
|
|
1698
1698
|
}
|
|
1699
1699
|
const I = (e, n) => ({
|
|
@@ -1701,13 +1701,13 @@ const I = (e, n) => ({
|
|
|
1701
1701
|
dispatch: o
|
|
1702
1702
|
}) => (o && xn(t, e, n), !0);
|
|
1703
1703
|
function xn(e, n, t, o, r) {
|
|
1704
|
-
const s =
|
|
1704
|
+
const s = Me(e.doc.resolve(n)), i = T(e);
|
|
1705
1705
|
if (o !== void 0 && r !== void 0 && o > r)
|
|
1706
1706
|
throw new Error("Invalid replaceFromPos or replaceToPos");
|
|
1707
1707
|
const a = i.nodes[s.blockNoteType], c = i.nodes[t.type || s.blockNoteType], l = c.isInGroup("bnBlock") ? c : i.nodes.blockContainer;
|
|
1708
1708
|
if (s.isBlockContainer && c.isInGroup("blockContent")) {
|
|
1709
1709
|
const d = o !== void 0 && o > s.blockContent.beforePos && o < s.blockContent.afterPos ? o - s.blockContent.beforePos - 1 : void 0, u = r !== void 0 && r > s.blockContent.beforePos && r < s.blockContent.afterPos ? r - s.blockContent.beforePos - 1 : void 0;
|
|
1710
|
-
$t(t, e, s),
|
|
1710
|
+
$t(t, e, s), Mr(
|
|
1711
1711
|
t,
|
|
1712
1712
|
e,
|
|
1713
1713
|
a,
|
|
@@ -1719,11 +1719,11 @@ function xn(e, n, t, o, r) {
|
|
|
1719
1719
|
} else if (!s.isBlockContainer && c.isInGroup("bnBlock"))
|
|
1720
1720
|
$t(t, e, s);
|
|
1721
1721
|
else {
|
|
1722
|
-
const d =
|
|
1722
|
+
const d = S(s.bnBlock.node, i);
|
|
1723
1723
|
e.replaceWith(
|
|
1724
1724
|
s.bnBlock.beforePos,
|
|
1725
1725
|
s.bnBlock.afterPos,
|
|
1726
|
-
|
|
1726
|
+
he(
|
|
1727
1727
|
{
|
|
1728
1728
|
children: d.children,
|
|
1729
1729
|
// if no children are passed in, use existing children
|
|
@@ -1739,8 +1739,8 @@ function xn(e, n, t, o, r) {
|
|
|
1739
1739
|
...t.props
|
|
1740
1740
|
});
|
|
1741
1741
|
}
|
|
1742
|
-
function
|
|
1743
|
-
const a =
|
|
1742
|
+
function Mr(e, n, t, o, r, s, i) {
|
|
1743
|
+
const a = T(n);
|
|
1744
1744
|
let c = "keep";
|
|
1745
1745
|
if (e.content)
|
|
1746
1746
|
if (typeof e.content == "string")
|
|
@@ -1752,7 +1752,7 @@ function Tr(e, n, t, o, r, s, i) {
|
|
|
1752
1752
|
else if (Array.isArray(e.content))
|
|
1753
1753
|
c = F(e.content, a, o.name);
|
|
1754
1754
|
else if (e.content.type === "tableContent")
|
|
1755
|
-
c =
|
|
1755
|
+
c = Ke(e.content, a);
|
|
1756
1756
|
else
|
|
1757
1757
|
throw new j(e.content.type);
|
|
1758
1758
|
else
|
|
@@ -1791,9 +1791,9 @@ function Tr(e, n, t, o, r, s, i) {
|
|
|
1791
1791
|
);
|
|
1792
1792
|
}
|
|
1793
1793
|
function $t(e, n, t) {
|
|
1794
|
-
const o =
|
|
1794
|
+
const o = T(n);
|
|
1795
1795
|
if (e.children !== void 0 && e.children.length > 0) {
|
|
1796
|
-
const r = e.children.map((s) =>
|
|
1796
|
+
const r = e.children.map((s) => he(s, o));
|
|
1797
1797
|
if (t.childContainer)
|
|
1798
1798
|
n.step(
|
|
1799
1799
|
new cn(
|
|
@@ -1812,7 +1812,7 @@ function $t(e, n, t) {
|
|
|
1812
1812
|
}
|
|
1813
1813
|
}
|
|
1814
1814
|
}
|
|
1815
|
-
function
|
|
1815
|
+
function Tr(e, n, t, o, r) {
|
|
1816
1816
|
const s = typeof n == "string" ? n : n.id, i = _(s, e.doc);
|
|
1817
1817
|
if (!i)
|
|
1818
1818
|
throw new Error(`Block with ID ${s} not found`);
|
|
@@ -1823,16 +1823,16 @@ function Mr(e, n, t, o, r) {
|
|
|
1823
1823
|
o,
|
|
1824
1824
|
r
|
|
1825
1825
|
);
|
|
1826
|
-
const a = e.doc.resolve(i.posBeforeNode + 1).node(), c =
|
|
1827
|
-
return
|
|
1826
|
+
const a = e.doc.resolve(i.posBeforeNode + 1).node(), c = T(e);
|
|
1827
|
+
return S(a, c);
|
|
1828
1828
|
}
|
|
1829
|
-
function
|
|
1829
|
+
function Mn(e) {
|
|
1830
1830
|
const n = Array.from(e.classList).filter(
|
|
1831
1831
|
(t) => !t.startsWith("bn-")
|
|
1832
1832
|
) || [];
|
|
1833
1833
|
n.length > 0 ? e.className = n.join(" ") : e.removeAttribute("class");
|
|
1834
1834
|
}
|
|
1835
|
-
function
|
|
1835
|
+
function Tn(e, n, t, o) {
|
|
1836
1836
|
let r;
|
|
1837
1837
|
if (n)
|
|
1838
1838
|
if (typeof n == "string")
|
|
@@ -1840,12 +1840,12 @@ function Mn(e, n, t, o) {
|
|
|
1840
1840
|
else if (Array.isArray(n))
|
|
1841
1841
|
r = F(n, e.pmSchema);
|
|
1842
1842
|
else if (n.type === "tableContent")
|
|
1843
|
-
r =
|
|
1843
|
+
r = Ke(n, e.pmSchema);
|
|
1844
1844
|
else
|
|
1845
1845
|
throw new j(n.type);
|
|
1846
1846
|
else throw new Error("blockContent is required");
|
|
1847
1847
|
const s = t.serializeFragment(D.from(r), o);
|
|
1848
|
-
return s.nodeType === 1 &&
|
|
1848
|
+
return s.nodeType === 1 && Mn(s), s;
|
|
1849
1849
|
}
|
|
1850
1850
|
function Pr(e, n, t, o, r, s, i) {
|
|
1851
1851
|
var g, b, k, w, C, B, P, $;
|
|
@@ -1853,10 +1853,10 @@ function Pr(e, n, t, o, r, s, i) {
|
|
|
1853
1853
|
let l = t.props;
|
|
1854
1854
|
if (!t.props) {
|
|
1855
1855
|
l = {};
|
|
1856
|
-
for (const [
|
|
1856
|
+
for (const [E, y] of Object.entries(
|
|
1857
1857
|
n.schema.blockSchema[t.type].propSchema
|
|
1858
1858
|
))
|
|
1859
|
-
y.default !== void 0 && (l[
|
|
1859
|
+
y.default !== void 0 && (l[E] = y.default);
|
|
1860
1860
|
}
|
|
1861
1861
|
const d = (b = (g = c.spec) == null ? void 0 : g.toDOM) == null ? void 0 : b.call(
|
|
1862
1862
|
g,
|
|
@@ -1866,26 +1866,26 @@ function Pr(e, n, t, o, r, s, i) {
|
|
|
1866
1866
|
})
|
|
1867
1867
|
), u = Array.from(d.dom.attributes), h = n.blockImplementations[t.type].implementation.toExternalHTML({ ...t, props: l }, n), f = a.createDocumentFragment();
|
|
1868
1868
|
if (h.dom.classList.contains("bn-block-content")) {
|
|
1869
|
-
const
|
|
1869
|
+
const E = [
|
|
1870
1870
|
...u,
|
|
1871
1871
|
...Array.from(h.dom.attributes)
|
|
1872
1872
|
].filter(
|
|
1873
1873
|
(y) => y.name.startsWith("data") && y.name !== "data-content-type" && y.name !== "data-file-block" && y.name !== "data-node-view-wrapper" && y.name !== "data-node-type" && y.name !== "data-id" && y.name !== "data-index" && y.name !== "data-editable"
|
|
1874
1874
|
);
|
|
1875
|
-
for (const y of
|
|
1875
|
+
for (const y of E)
|
|
1876
1876
|
h.dom.firstChild.setAttribute(y.name, y.value);
|
|
1877
|
-
|
|
1877
|
+
Mn(h.dom.firstChild), f.append(...Array.from(h.dom.childNodes));
|
|
1878
1878
|
} else
|
|
1879
1879
|
f.append(h.dom);
|
|
1880
1880
|
if (h.contentDOM && t.content) {
|
|
1881
|
-
const
|
|
1881
|
+
const E = Tn(
|
|
1882
1882
|
n,
|
|
1883
1883
|
t.content,
|
|
1884
1884
|
// TODO
|
|
1885
1885
|
o,
|
|
1886
1886
|
i
|
|
1887
1887
|
);
|
|
1888
|
-
h.contentDOM.appendChild(
|
|
1888
|
+
h.contentDOM.appendChild(E);
|
|
1889
1889
|
}
|
|
1890
1890
|
let m;
|
|
1891
1891
|
if (r.has(t.type) ? m = "OL" : s.has(t.type) && (m = "UL"), m) {
|
|
@@ -1893,14 +1893,14 @@ function Pr(e, n, t, o, r, s, i) {
|
|
|
1893
1893
|
const y = a.createElement(m);
|
|
1894
1894
|
m === "OL" && (l != null && l.start) && (l == null ? void 0 : l.start) !== 1 && y.setAttribute("start", l.start + ""), e.append(y);
|
|
1895
1895
|
}
|
|
1896
|
-
const
|
|
1897
|
-
|
|
1896
|
+
const E = a.createElement("li");
|
|
1897
|
+
E.append(f), e.lastChild.appendChild(E);
|
|
1898
1898
|
} else
|
|
1899
1899
|
e.append(f);
|
|
1900
1900
|
if (t.children && t.children.length > 0) {
|
|
1901
|
-
const
|
|
1901
|
+
const E = a.createDocumentFragment();
|
|
1902
1902
|
if (Pn(
|
|
1903
|
-
|
|
1903
|
+
E,
|
|
1904
1904
|
n,
|
|
1905
1905
|
t.children,
|
|
1906
1906
|
o,
|
|
@@ -1908,9 +1908,9 @@ function Pr(e, n, t, o, r, s, i) {
|
|
|
1908
1908
|
s,
|
|
1909
1909
|
i
|
|
1910
1910
|
), ((w = e.lastChild) == null ? void 0 : w.nodeName) === "UL" || ((C = e.lastChild) == null ? void 0 : C.nodeName) === "OL")
|
|
1911
|
-
for (; ((B =
|
|
1912
|
-
e.lastChild.lastChild.appendChild(
|
|
1913
|
-
n.pmSchema.nodes[t.type].isInGroup("blockContent") ? e.append(
|
|
1911
|
+
for (; ((B = E.firstChild) == null ? void 0 : B.nodeName) === "UL" || ((P = E.firstChild) == null ? void 0 : P.nodeName) === "OL"; )
|
|
1912
|
+
e.lastChild.lastChild.appendChild(E.firstChild);
|
|
1913
|
+
n.pmSchema.nodes[t.type].isInGroup("blockContent") ? e.append(E) : ($ = h.contentDOM) == null || $.append(E);
|
|
1914
1914
|
}
|
|
1915
1915
|
}
|
|
1916
1916
|
const Pn = (e, n, t, o, r, s, i) => {
|
|
@@ -1935,7 +1935,7 @@ const Pn = (e, n, t, o, r, s, i) => {
|
|
|
1935
1935
|
r,
|
|
1936
1936
|
s
|
|
1937
1937
|
), a;
|
|
1938
|
-
},
|
|
1938
|
+
}, Je = (e, n) => {
|
|
1939
1939
|
const t = an.fromSchema(e);
|
|
1940
1940
|
return {
|
|
1941
1941
|
exportBlocks: (o, r) => {
|
|
@@ -1950,7 +1950,7 @@ const Pn = (e, n, t, o, r, s, i) => {
|
|
|
1950
1950
|
return i.append(s), i.innerHTML;
|
|
1951
1951
|
},
|
|
1952
1952
|
exportInlineContent: (o, r) => {
|
|
1953
|
-
const s =
|
|
1953
|
+
const s = Tn(
|
|
1954
1954
|
n,
|
|
1955
1955
|
o,
|
|
1956
1956
|
t,
|
|
@@ -1968,7 +1968,7 @@ function Lr(e, n, t, o, r) {
|
|
|
1968
1968
|
else if (Array.isArray(n))
|
|
1969
1969
|
s = F(n, e.pmSchema, o);
|
|
1970
1970
|
else if (n.type === "tableContent")
|
|
1971
|
-
s =
|
|
1971
|
+
s = Ke(n, e.pmSchema);
|
|
1972
1972
|
else
|
|
1973
1973
|
throw new j(n.type);
|
|
1974
1974
|
else throw new Error("blockContent is required");
|
|
@@ -2045,7 +2045,7 @@ const Ln = (e, n, t, o) => {
|
|
|
2045
2045
|
return {
|
|
2046
2046
|
serializeBlocks: (o, r) => Ln(n, o, t, r).outerHTML
|
|
2047
2047
|
};
|
|
2048
|
-
},
|
|
2048
|
+
}, Xe = (e, n) => {
|
|
2049
2049
|
const t = e.querySelector(
|
|
2050
2050
|
n
|
|
2051
2051
|
);
|
|
@@ -2134,16 +2134,16 @@ const Ln = (e, n, t, o) => {
|
|
|
2134
2134
|
a.className = "bn-file-caption", a.textContent = e.props.caption, s.appendChild(a);
|
|
2135
2135
|
}
|
|
2136
2136
|
return i;
|
|
2137
|
-
},
|
|
2137
|
+
}, Bt = (e, n) => {
|
|
2138
2138
|
const t = document.createElement("figure"), o = document.createElement("figcaption");
|
|
2139
2139
|
return o.textContent = n, t.appendChild(e), t.appendChild(o), { dom: t };
|
|
2140
|
-
},
|
|
2140
|
+
}, Ye = (e, n) => {
|
|
2141
2141
|
const t = document.createElement("div"), o = document.createElement("p");
|
|
2142
2142
|
return o.textContent = n, t.appendChild(e), t.appendChild(o), {
|
|
2143
2143
|
dom: t
|
|
2144
2144
|
};
|
|
2145
2145
|
}, Ft = (e) => ({ url: e.src || void 0 }), Rr = '<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>', Vr = {
|
|
2146
|
-
backgroundColor:
|
|
2146
|
+
backgroundColor: M.backgroundColor,
|
|
2147
2147
|
// File name.
|
|
2148
2148
|
name: {
|
|
2149
2149
|
default: ""
|
|
@@ -2182,7 +2182,7 @@ const Ln = (e, n, t, o) => {
|
|
|
2182
2182
|
if (e.tagName === "AUDIO")
|
|
2183
2183
|
return e.closest("figure") ? void 0 : Ft(e);
|
|
2184
2184
|
if (e.tagName === "FIGURE") {
|
|
2185
|
-
const n =
|
|
2185
|
+
const n = Xe(e, "audio");
|
|
2186
2186
|
if (!n)
|
|
2187
2187
|
return;
|
|
2188
2188
|
const { targetElement: t, caption: o } = n;
|
|
@@ -2199,14 +2199,14 @@ const Ln = (e, n, t, o) => {
|
|
|
2199
2199
|
};
|
|
2200
2200
|
}
|
|
2201
2201
|
let n;
|
|
2202
|
-
return e.props.showPreview ? (n = document.createElement("audio"), n.src = e.props.url) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
2202
|
+
return e.props.showPreview ? (n = document.createElement("audio"), n.src = e.props.url) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Bt(n, e.props.caption) : Ye(n, e.props.caption) : {
|
|
2203
2203
|
dom: n
|
|
2204
2204
|
};
|
|
2205
2205
|
}, zr = xe(Ur, {
|
|
2206
2206
|
render: _r,
|
|
2207
2207
|
parse: $r,
|
|
2208
2208
|
toExternalHTML: Fr
|
|
2209
|
-
}), zt = Symbol.for("blocknote.shikiParser"),
|
|
2209
|
+
}), zt = Symbol.for("blocknote.shikiParser"), Ze = Symbol.for(
|
|
2210
2210
|
"blocknote.shikiHighlighterPromise"
|
|
2211
2211
|
), Wr = {
|
|
2212
2212
|
language: {
|
|
@@ -2241,7 +2241,7 @@ const Ln = (e, n, t, o) => {
|
|
|
2241
2241
|
const i = [...(t == null ? void 0 : t.className.split(" ")) || []].filter((a) => a.startsWith("language-")).map((a) => a.replace("language-", ""));
|
|
2242
2242
|
i.length > 0 && (o = i[0].toLowerCase());
|
|
2243
2243
|
}
|
|
2244
|
-
return o ?
|
|
2244
|
+
return o ? Qe(e.editor.settings.codeBlock, o) ?? o : null;
|
|
2245
2245
|
},
|
|
2246
2246
|
renderHTML: (n) => n.language ? {
|
|
2247
2247
|
class: `language-${n.language}`,
|
|
@@ -2322,12 +2322,12 @@ const Ln = (e, n, t, o) => {
|
|
|
2322
2322
|
"For syntax highlighting of code blocks, you must provide a `codeBlock.createHighlighter` function"
|
|
2323
2323
|
), r = !0), [];
|
|
2324
2324
|
if (!t)
|
|
2325
|
-
return n[
|
|
2325
|
+
return n[Ze] = n[Ze] || e.editor.settings.codeBlock.createHighlighter(), n[Ze].then(
|
|
2326
2326
|
(l) => {
|
|
2327
2327
|
t = l;
|
|
2328
2328
|
}
|
|
2329
2329
|
);
|
|
2330
|
-
const c =
|
|
2330
|
+
const c = Qe(
|
|
2331
2331
|
e.editor.settings.codeBlock,
|
|
2332
2332
|
a.language
|
|
2333
2333
|
);
|
|
@@ -2340,11 +2340,11 @@ const Ln = (e, n, t, o) => {
|
|
|
2340
2340
|
addInputRules() {
|
|
2341
2341
|
const e = this.options;
|
|
2342
2342
|
return [
|
|
2343
|
-
new
|
|
2343
|
+
new le({
|
|
2344
2344
|
find: /^```(.*?)\s$/,
|
|
2345
2345
|
handler: ({ state: n, range: t, match: o }) => {
|
|
2346
2346
|
const r = n.doc.resolve(t.from), s = o[1].trim(), i = {
|
|
2347
|
-
language:
|
|
2347
|
+
language: Qe(e.editor.settings.codeBlock, s) ?? s
|
|
2348
2348
|
};
|
|
2349
2349
|
if (!r.node(-1).canReplaceWith(
|
|
2350
2350
|
r.index(-1),
|
|
@@ -2393,7 +2393,7 @@ const Ln = (e, n, t, o) => {
|
|
|
2393
2393
|
jr,
|
|
2394
2394
|
Wr
|
|
2395
2395
|
);
|
|
2396
|
-
function
|
|
2396
|
+
function Qe(e, n) {
|
|
2397
2397
|
var t;
|
|
2398
2398
|
return (t = Object.entries(e.supportedLanguages).find(
|
|
2399
2399
|
([o, { aliases: r }]) => (r == null ? void 0 : r.includes(n)) || o === n
|
|
@@ -2425,7 +2425,7 @@ const qr = ne.create({
|
|
|
2425
2425
|
renderHTML({ HTMLAttributes: e }) {
|
|
2426
2426
|
return ["span", e, 0];
|
|
2427
2427
|
}
|
|
2428
|
-
}), Kr =
|
|
2428
|
+
}), Kr = ae(
|
|
2429
2429
|
qr,
|
|
2430
2430
|
"string"
|
|
2431
2431
|
), Jr = ne.create({
|
|
@@ -2452,8 +2452,8 @@ const qr = ne.create({
|
|
|
2452
2452
|
renderHTML({ HTMLAttributes: e }) {
|
|
2453
2453
|
return ["span", e, 0];
|
|
2454
2454
|
}
|
|
2455
|
-
}), Xr =
|
|
2456
|
-
backgroundColor:
|
|
2455
|
+
}), Xr = ae(Jr, "string"), Wt = (e) => ({ url: e.src || void 0 }), Yr = {
|
|
2456
|
+
backgroundColor: M.backgroundColor,
|
|
2457
2457
|
// File name.
|
|
2458
2458
|
name: {
|
|
2459
2459
|
default: ""
|
|
@@ -2475,7 +2475,7 @@ const qr = ne.create({
|
|
|
2475
2475
|
if (e.tagName === "EMBED")
|
|
2476
2476
|
return e.closest("figure") ? void 0 : Wt(e);
|
|
2477
2477
|
if (e.tagName === "FIGURE") {
|
|
2478
|
-
const n =
|
|
2478
|
+
const n = Xe(e, "embed");
|
|
2479
2479
|
if (!n)
|
|
2480
2480
|
return;
|
|
2481
2481
|
const { targetElement: t, caption: o } = n;
|
|
@@ -2492,7 +2492,7 @@ const qr = ne.create({
|
|
|
2492
2492
|
};
|
|
2493
2493
|
}
|
|
2494
2494
|
const n = document.createElement("a");
|
|
2495
|
-
return n.href = e.props.url, n.textContent = e.props.name || e.props.url, e.props.caption ?
|
|
2495
|
+
return n.href = e.props.url, n.textContent = e.props.name || e.props.url, e.props.caption ? Ye(n, e.props.caption) : {
|
|
2496
2496
|
dom: n
|
|
2497
2497
|
};
|
|
2498
2498
|
}, ns = xe(Zr, {
|
|
@@ -2500,7 +2500,7 @@ const qr = ne.create({
|
|
|
2500
2500
|
parse: es,
|
|
2501
2501
|
toExternalHTML: ts
|
|
2502
2502
|
}), An = {
|
|
2503
|
-
...
|
|
2503
|
+
...M,
|
|
2504
2504
|
level: { default: 1, values: [1, 2, 3] }
|
|
2505
2505
|
}, os = q({
|
|
2506
2506
|
name: "heading",
|
|
@@ -2511,7 +2511,7 @@ const qr = ne.create({
|
|
|
2511
2511
|
},
|
|
2512
2512
|
addInputRules() {
|
|
2513
2513
|
return [
|
|
2514
|
-
...[1, 2, 3].map((e) => new
|
|
2514
|
+
...[1, 2, 3].map((e) => new le({
|
|
2515
2515
|
find: new RegExp(`^(#{${e}})\\s$`),
|
|
2516
2516
|
handler: ({ state: n, chain: t, range: o }) => {
|
|
2517
2517
|
const r = v(n);
|
|
@@ -2619,7 +2619,7 @@ const qr = ne.create({
|
|
|
2619
2619
|
d.className = "bn-resize-handle", d.style.right = "4px";
|
|
2620
2620
|
let u, h = e.props.previewWidth;
|
|
2621
2621
|
const f = (C) => {
|
|
2622
|
-
var $,
|
|
2622
|
+
var $, E;
|
|
2623
2623
|
if (!u) {
|
|
2624
2624
|
!n.isEditable && o.contains(l) && o.contains(d) && (o.removeChild(l), o.removeChild(d));
|
|
2625
2625
|
return;
|
|
@@ -2627,7 +2627,7 @@ const qr = ne.create({
|
|
|
2627
2627
|
let B;
|
|
2628
2628
|
e.props.textAlignment === "center" ? u.handleUsed === "left" ? B = u.initialWidth + (u.initialClientX - C.clientX) * 2 : B = u.initialWidth + (C.clientX - u.initialClientX) * 2 : u.handleUsed === "left" ? B = u.initialWidth + u.initialClientX - C.clientX : B = u.initialWidth + C.clientX - u.initialClientX, h = Math.min(
|
|
2629
2629
|
Math.max(B, 64),
|
|
2630
|
-
((
|
|
2630
|
+
((E = ($ = n.domElement) == null ? void 0 : $.firstElementChild) == null ? void 0 : E.clientWidth) || Number.MAX_VALUE
|
|
2631
2631
|
), c.style.width = `${h}px`;
|
|
2632
2632
|
}, m = (C) => {
|
|
2633
2633
|
(!C.target || !c.contains(C.target) || !n.isEditable) && o.contains(l) && o.contains(d) && (o.removeChild(l), o.removeChild(d)), u && (u = void 0, n.updateBlock(e, {
|
|
@@ -2674,8 +2674,8 @@ const qr = ne.create({
|
|
|
2674
2674
|
const n = e.src || void 0, t = e.width || void 0;
|
|
2675
2675
|
return { url: n, previewWidth: t };
|
|
2676
2676
|
}, ss = '<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>', is = {
|
|
2677
|
-
textAlignment:
|
|
2678
|
-
backgroundColor:
|
|
2677
|
+
textAlignment: M.textAlignment,
|
|
2678
|
+
backgroundColor: M.backgroundColor,
|
|
2679
2679
|
// File name.
|
|
2680
2680
|
name: {
|
|
2681
2681
|
default: ""
|
|
@@ -2722,7 +2722,7 @@ const qr = ne.create({
|
|
|
2722
2722
|
if (e.tagName === "IMG")
|
|
2723
2723
|
return e.closest("figure") ? void 0 : jt(e);
|
|
2724
2724
|
if (e.tagName === "FIGURE") {
|
|
2725
|
-
const n =
|
|
2725
|
+
const n = Xe(e, "img");
|
|
2726
2726
|
if (!n)
|
|
2727
2727
|
return;
|
|
2728
2728
|
const { targetElement: t, caption: o } = n;
|
|
@@ -2739,7 +2739,7 @@ const qr = ne.create({
|
|
|
2739
2739
|
};
|
|
2740
2740
|
}
|
|
2741
2741
|
let n;
|
|
2742
|
-
return e.props.showPreview ? (n = document.createElement("img"), n.src = e.props.url, n.alt = e.props.name || e.props.caption || "BlockNote image", e.props.previewWidth && (n.width = e.props.previewWidth)) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
2742
|
+
return e.props.showPreview ? (n = document.createElement("img"), n.src = e.props.url, n.alt = e.props.name || e.props.caption || "BlockNote image", e.props.previewWidth && (n.width = e.props.previewWidth)) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Bt(n, e.props.caption) : Ye(n, e.props.caption) : {
|
|
2743
2743
|
dom: n
|
|
2744
2744
|
};
|
|
2745
2745
|
}, us = xe(as, {
|
|
@@ -2747,9 +2747,9 @@ const qr = ne.create({
|
|
|
2747
2747
|
parse: ls,
|
|
2748
2748
|
toExternalHTML: ds
|
|
2749
2749
|
});
|
|
2750
|
-
function
|
|
2750
|
+
function xt(e, n, t) {
|
|
2751
2751
|
var u, h, f;
|
|
2752
|
-
const o =
|
|
2752
|
+
const o = We.fromSchema(n), r = e, s = document.createElement("div");
|
|
2753
2753
|
s.setAttribute("data-node-type", "blockGroup");
|
|
2754
2754
|
for (const m of Array.from(r.childNodes))
|
|
2755
2755
|
s.appendChild(m.cloneNode(!0));
|
|
@@ -2798,9 +2798,9 @@ const Hn = (e, n, t) => ({
|
|
|
2798
2798
|
}
|
|
2799
2799
|
];
|
|
2800
2800
|
return r && o.tr.split(e, 2, a), !0;
|
|
2801
|
-
},
|
|
2801
|
+
}, Mt = (e) => {
|
|
2802
2802
|
const { blockInfo: n, selectionEmpty: t } = e.transact((s) => ({
|
|
2803
|
-
blockInfo:
|
|
2803
|
+
blockInfo: Ge(s),
|
|
2804
2804
|
selectionEmpty: s.selection.anchor === s.selection.head
|
|
2805
2805
|
}));
|
|
2806
2806
|
if (!n.isBlockContainer)
|
|
@@ -2823,7 +2823,7 @@ const Hn = (e, n, t) => ({
|
|
|
2823
2823
|
)
|
|
2824
2824
|
]);
|
|
2825
2825
|
}, ps = {
|
|
2826
|
-
...
|
|
2826
|
+
...M
|
|
2827
2827
|
}, hs = q({
|
|
2828
2828
|
name: "bulletListItem",
|
|
2829
2829
|
content: "inline*",
|
|
@@ -2834,7 +2834,7 @@ const Hn = (e, n, t) => ({
|
|
|
2834
2834
|
addInputRules() {
|
|
2835
2835
|
return [
|
|
2836
2836
|
// Creates an unordered list when starting with "-", "+", or "*".
|
|
2837
|
-
new
|
|
2837
|
+
new le({
|
|
2838
2838
|
find: new RegExp("^[-+*]\\s$"),
|
|
2839
2839
|
handler: ({ state: e, chain: n, range: t }) => {
|
|
2840
2840
|
const o = v(e);
|
|
@@ -2850,7 +2850,7 @@ const Hn = (e, n, t) => ({
|
|
|
2850
2850
|
},
|
|
2851
2851
|
addKeyboardShortcuts() {
|
|
2852
2852
|
return {
|
|
2853
|
-
Enter: () =>
|
|
2853
|
+
Enter: () => Mt(this.options.editor),
|
|
2854
2854
|
"Mod-Shift-8": () => {
|
|
2855
2855
|
const e = v(this.editor.state);
|
|
2856
2856
|
return !e.isBlockContainer || e.blockContent.node.type.spec.content !== "inline*" ? !0 : this.editor.commands.command(
|
|
@@ -2881,7 +2881,7 @@ const Hn = (e, n, t) => ({
|
|
|
2881
2881
|
},
|
|
2882
2882
|
// As `li` elements can contain multiple paragraphs, we need to merge their contents
|
|
2883
2883
|
// into a single one so that ProseMirror can parse everything correctly.
|
|
2884
|
-
getContent: (e, n) =>
|
|
2884
|
+
getContent: (e, n) => xt(e, n, this.name),
|
|
2885
2885
|
node: "bulletListItem"
|
|
2886
2886
|
}
|
|
2887
2887
|
];
|
|
@@ -2905,7 +2905,7 @@ const Hn = (e, n, t) => ({
|
|
|
2905
2905
|
hs,
|
|
2906
2906
|
ps
|
|
2907
2907
|
), Dn = {
|
|
2908
|
-
...
|
|
2908
|
+
...M,
|
|
2909
2909
|
checked: {
|
|
2910
2910
|
default: !1
|
|
2911
2911
|
}
|
|
@@ -2919,7 +2919,7 @@ const Hn = (e, n, t) => ({
|
|
|
2919
2919
|
addInputRules() {
|
|
2920
2920
|
return [
|
|
2921
2921
|
// Creates a checklist when starting with "[]" or "[X]".
|
|
2922
|
-
new
|
|
2922
|
+
new le({
|
|
2923
2923
|
find: new RegExp("\\[\\s*\\]\\s$"),
|
|
2924
2924
|
handler: ({ state: e, chain: n, range: t }) => {
|
|
2925
2925
|
const o = v(e);
|
|
@@ -2933,7 +2933,7 @@ const Hn = (e, n, t) => ({
|
|
|
2933
2933
|
).deleteRange({ from: t.from, to: t.to });
|
|
2934
2934
|
}
|
|
2935
2935
|
}),
|
|
2936
|
-
new
|
|
2936
|
+
new le({
|
|
2937
2937
|
find: new RegExp("\\[[Xx]\\]\\s$"),
|
|
2938
2938
|
handler: ({ state: e, chain: n, range: t }) => {
|
|
2939
2939
|
const o = v(e);
|
|
@@ -2951,7 +2951,7 @@ const Hn = (e, n, t) => ({
|
|
|
2951
2951
|
},
|
|
2952
2952
|
addKeyboardShortcuts() {
|
|
2953
2953
|
return {
|
|
2954
|
-
Enter: () =>
|
|
2954
|
+
Enter: () => Mt(this.options.editor),
|
|
2955
2955
|
"Mod-Shift-9": () => {
|
|
2956
2956
|
const e = v(this.editor.state);
|
|
2957
2957
|
return !e.isBlockContainer || e.blockContent.node.type.spec.content !== "inline*" ? !0 : this.editor.commands.command(
|
|
@@ -2995,7 +2995,7 @@ const Hn = (e, n, t) => ({
|
|
|
2995
2995
|
},
|
|
2996
2996
|
// As `li` elements can contain multiple paragraphs, we need to merge their contents
|
|
2997
2997
|
// into a single one so that ProseMirror can parse everything correctly.
|
|
2998
|
-
getContent: (e, n) =>
|
|
2998
|
+
getContent: (e, n) => xt(e, n, this.name),
|
|
2999
2999
|
node: "checkListItem"
|
|
3000
3000
|
}
|
|
3001
3001
|
];
|
|
@@ -3126,7 +3126,7 @@ const Hn = (e, n, t) => ({
|
|
|
3126
3126
|
}), r ? o : null;
|
|
3127
3127
|
}
|
|
3128
3128
|
}), On = {
|
|
3129
|
-
...
|
|
3129
|
+
...M,
|
|
3130
3130
|
start: { default: void 0, type: "number" }
|
|
3131
3131
|
}, ws = q({
|
|
3132
3132
|
name: "numberedListItem",
|
|
@@ -3150,7 +3150,7 @@ const Hn = (e, n, t) => ({
|
|
|
3150
3150
|
addInputRules() {
|
|
3151
3151
|
return [
|
|
3152
3152
|
// Creates an ordered list when starting with "1.".
|
|
3153
|
-
new
|
|
3153
|
+
new le({
|
|
3154
3154
|
find: new RegExp("^(\\d+)\\.\\s$"),
|
|
3155
3155
|
handler: ({ state: e, chain: n, range: t, match: o }) => {
|
|
3156
3156
|
const r = v(e);
|
|
@@ -3171,7 +3171,7 @@ const Hn = (e, n, t) => ({
|
|
|
3171
3171
|
},
|
|
3172
3172
|
addKeyboardShortcuts() {
|
|
3173
3173
|
return {
|
|
3174
|
-
Enter: () =>
|
|
3174
|
+
Enter: () => Mt(this.options.editor),
|
|
3175
3175
|
"Mod-Shift-7": () => {
|
|
3176
3176
|
const e = v(this.editor.state);
|
|
3177
3177
|
return !e.isBlockContainer || e.blockContent.node.type.spec.content !== "inline*" ? !0 : this.editor.commands.command(
|
|
@@ -3213,7 +3213,7 @@ const Hn = (e, n, t) => ({
|
|
|
3213
3213
|
},
|
|
3214
3214
|
// As `li` elements can contain multiple paragraphs, we need to merge their contents
|
|
3215
3215
|
// into a single one so that ProseMirror can parse everything correctly.
|
|
3216
|
-
getContent: (e, n) =>
|
|
3216
|
+
getContent: (e, n) => xt(e, n, this.name),
|
|
3217
3217
|
priority: 300,
|
|
3218
3218
|
node: "numberedListItem"
|
|
3219
3219
|
}
|
|
@@ -3238,7 +3238,7 @@ const Hn = (e, n, t) => ({
|
|
|
3238
3238
|
ws,
|
|
3239
3239
|
On
|
|
3240
3240
|
), Cs = {
|
|
3241
|
-
...
|
|
3241
|
+
...M
|
|
3242
3242
|
}, vs = q({
|
|
3243
3243
|
name: "paragraph",
|
|
3244
3244
|
content: "inline*",
|
|
@@ -3286,11 +3286,11 @@ const Hn = (e, n, t) => ({
|
|
|
3286
3286
|
((t = this.options.domAttributes) == null ? void 0 : t.inlineContent) || {}
|
|
3287
3287
|
);
|
|
3288
3288
|
}
|
|
3289
|
-
}),
|
|
3289
|
+
}), Ss = oe(
|
|
3290
3290
|
vs,
|
|
3291
3291
|
Cs
|
|
3292
|
-
),
|
|
3293
|
-
...
|
|
3292
|
+
), Es = {
|
|
3293
|
+
...M
|
|
3294
3294
|
}, Bs = q({
|
|
3295
3295
|
name: "quote",
|
|
3296
3296
|
content: "inline*",
|
|
@@ -3298,7 +3298,7 @@ const Hn = (e, n, t) => ({
|
|
|
3298
3298
|
addInputRules() {
|
|
3299
3299
|
return [
|
|
3300
3300
|
// Creates a block quote when starting with ">".
|
|
3301
|
-
new
|
|
3301
|
+
new le({
|
|
3302
3302
|
find: new RegExp("^>\\s$"),
|
|
3303
3303
|
handler: ({ state: e, chain: n, range: t }) => {
|
|
3304
3304
|
const o = v(e);
|
|
@@ -3352,19 +3352,19 @@ const Hn = (e, n, t) => ({
|
|
|
3352
3352
|
}
|
|
3353
3353
|
}), xs = oe(
|
|
3354
3354
|
Bs,
|
|
3355
|
-
|
|
3356
|
-
),
|
|
3355
|
+
Es
|
|
3356
|
+
), Ms = 35, Rn = 120, Ac = 31, Ts = V.create({
|
|
3357
3357
|
name: "BlockNoteTableExtension",
|
|
3358
3358
|
addProseMirrorPlugins: () => [
|
|
3359
|
-
|
|
3360
|
-
cellMinWidth:
|
|
3359
|
+
Mo({
|
|
3360
|
+
cellMinWidth: Ms,
|
|
3361
3361
|
defaultCellMinWidth: Rn,
|
|
3362
3362
|
// We set this to null as we implement our own node view in the table
|
|
3363
3363
|
// block content. This node view is the same as what's used by default,
|
|
3364
3364
|
// but is wrapped in a `blockContent` HTML element.
|
|
3365
3365
|
View: null
|
|
3366
3366
|
}),
|
|
3367
|
-
|
|
3367
|
+
To()
|
|
3368
3368
|
],
|
|
3369
3369
|
addKeyboardShortcuts() {
|
|
3370
3370
|
return {
|
|
@@ -3378,10 +3378,10 @@ const Hn = (e, n, t) => ({
|
|
|
3378
3378
|
},
|
|
3379
3379
|
// Enables navigating cells using the tab key.
|
|
3380
3380
|
Tab: () => this.editor.commands.command(
|
|
3381
|
-
({ state: e, dispatch: n, view: t }) =>
|
|
3381
|
+
({ state: e, dispatch: n, view: t }) => Ht(1)(e, n, t)
|
|
3382
3382
|
),
|
|
3383
3383
|
"Shift-Tab": () => this.editor.commands.command(
|
|
3384
|
-
({ state: e, dispatch: n, view: t }) =>
|
|
3384
|
+
({ state: e, dispatch: n, view: t }) => Ht(-1)(e, n, t)
|
|
3385
3385
|
)
|
|
3386
3386
|
};
|
|
3387
3387
|
},
|
|
@@ -3398,7 +3398,7 @@ const Hn = (e, n, t) => ({
|
|
|
3398
3398
|
};
|
|
3399
3399
|
}
|
|
3400
3400
|
}), Ps = {
|
|
3401
|
-
textColor:
|
|
3401
|
+
textColor: M.textColor
|
|
3402
3402
|
}, Is = q({
|
|
3403
3403
|
name: "table",
|
|
3404
3404
|
content: "tableRow+",
|
|
@@ -3499,13 +3499,13 @@ const Hn = (e, n, t) => ({
|
|
|
3499
3499
|
renderHTML({ HTMLAttributes: e }) {
|
|
3500
3500
|
return [
|
|
3501
3501
|
"tr",
|
|
3502
|
-
|
|
3502
|
+
bt(this.options.HTMLAttributes, e),
|
|
3503
3503
|
0
|
|
3504
3504
|
];
|
|
3505
3505
|
}
|
|
3506
3506
|
});
|
|
3507
3507
|
function Gt(e, n) {
|
|
3508
|
-
const o =
|
|
3508
|
+
const o = We.fromSchema(n).parse(e, {
|
|
3509
3509
|
topNode: n.nodes.blockGroup.create()
|
|
3510
3510
|
}), r = [];
|
|
3511
3511
|
return o.content.descendants((s) => {
|
|
@@ -3517,7 +3517,7 @@ const Ns = oe(
|
|
|
3517
3517
|
Is,
|
|
3518
3518
|
Ps,
|
|
3519
3519
|
[
|
|
3520
|
-
|
|
3520
|
+
Ts,
|
|
3521
3521
|
Ls,
|
|
3522
3522
|
xo.extend({
|
|
3523
3523
|
/**
|
|
@@ -3558,8 +3558,8 @@ const Ns = oe(
|
|
|
3558
3558
|
const n = e.src || void 0, t = e.width || void 0;
|
|
3559
3559
|
return { url: n, previewWidth: t };
|
|
3560
3560
|
}, Hs = '<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>', Ds = {
|
|
3561
|
-
textAlignment:
|
|
3562
|
-
backgroundColor:
|
|
3561
|
+
textAlignment: M.textAlignment,
|
|
3562
|
+
backgroundColor: M.backgroundColor,
|
|
3563
3563
|
// File name.
|
|
3564
3564
|
name: {
|
|
3565
3565
|
default: ""
|
|
@@ -3606,7 +3606,7 @@ const Ns = oe(
|
|
|
3606
3606
|
if (e.tagName === "VIDEO")
|
|
3607
3607
|
return e.closest("figure") ? void 0 : qt(e);
|
|
3608
3608
|
if (e.tagName === "FIGURE") {
|
|
3609
|
-
const n =
|
|
3609
|
+
const n = Xe(e, "video");
|
|
3610
3610
|
if (!n)
|
|
3611
3611
|
return;
|
|
3612
3612
|
const { targetElement: t, caption: o } = n;
|
|
@@ -3623,7 +3623,7 @@ const Ns = oe(
|
|
|
3623
3623
|
};
|
|
3624
3624
|
}
|
|
3625
3625
|
let n;
|
|
3626
|
-
return e.props.showPreview ? (n = document.createElement("video"), n.src = e.props.url, e.props.previewWidth && (n.width = e.props.previewWidth)) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ?
|
|
3626
|
+
return e.props.showPreview ? (n = document.createElement("video"), n.src = e.props.url, e.props.previewWidth && (n.width = e.props.previewWidth)) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Bt(n, e.props.caption) : Ye(n, e.props.caption) : {
|
|
3627
3627
|
dom: n
|
|
3628
3628
|
};
|
|
3629
3629
|
}, _s = xe(Os, {
|
|
@@ -3631,7 +3631,7 @@ const Ns = oe(
|
|
|
3631
3631
|
parse: Vs,
|
|
3632
3632
|
toExternalHTML: Us
|
|
3633
3633
|
}), Vn = {
|
|
3634
|
-
paragraph:
|
|
3634
|
+
paragraph: Ss,
|
|
3635
3635
|
heading: rs,
|
|
3636
3636
|
quote: xs,
|
|
3637
3637
|
codeBlock: Gr,
|
|
@@ -3644,11 +3644,11 @@ const Ns = oe(
|
|
|
3644
3644
|
video: _s,
|
|
3645
3645
|
audio: zr
|
|
3646
3646
|
}, $s = gn(Vn), Un = {
|
|
3647
|
-
bold:
|
|
3648
|
-
italic:
|
|
3649
|
-
underline:
|
|
3650
|
-
strike:
|
|
3651
|
-
code:
|
|
3647
|
+
bold: ae(yo, "boolean"),
|
|
3648
|
+
italic: ae(vo, "boolean"),
|
|
3649
|
+
underline: ae(Eo, "boolean"),
|
|
3650
|
+
strike: ae(So, "boolean"),
|
|
3651
|
+
code: ae(Co, "boolean"),
|
|
3652
3652
|
textColor: Xr,
|
|
3653
3653
|
backgroundColor: Kr
|
|
3654
3654
|
}, Nc = Cn(Un), _n = {
|
|
@@ -3676,13 +3676,13 @@ function Oc(e, n) {
|
|
|
3676
3676
|
return n.schema.blockSchema[e.type].isFileBlock && !e.props.url;
|
|
3677
3677
|
}
|
|
3678
3678
|
function js(e, n, t) {
|
|
3679
|
-
return n in t.schema.blockSchema && e in t.schema.blockSchema[n].propSchema && t.schema.blockSchema[n].propSchema[e] ===
|
|
3679
|
+
return n in t.schema.blockSchema && e in t.schema.blockSchema[n].propSchema && t.schema.blockSchema[n].propSchema[e] === M[e];
|
|
3680
3680
|
}
|
|
3681
3681
|
function Rc(e, n, t) {
|
|
3682
3682
|
return js(e, n.type, t);
|
|
3683
3683
|
}
|
|
3684
3684
|
function Kt(e) {
|
|
3685
|
-
return e instanceof
|
|
3685
|
+
return e instanceof Ee;
|
|
3686
3686
|
}
|
|
3687
3687
|
const Vc = async (e) => {
|
|
3688
3688
|
const n = new FormData();
|
|
@@ -3707,7 +3707,7 @@ function N(e, n) {
|
|
|
3707
3707
|
if (t.content === void 0)
|
|
3708
3708
|
throw new Error("Slash Menu open in a block that doesn't contain content.");
|
|
3709
3709
|
let o;
|
|
3710
|
-
return Array.isArray(t.content) && (t.content.length === 1 &&
|
|
3710
|
+
return Array.isArray(t.content) && (t.content.length === 1 && ue(t.content[0]) && t.content[0].type === "text" && t.content[0].text === "/" || t.content.length === 0) ? (o = e.updateBlock(t, n), e.setTextCursorPosition(o)) : (o = e.insertBlocks([n], t, "after")[0], e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)), Gs(e), o;
|
|
3711
3711
|
}
|
|
3712
3712
|
function Uc(e) {
|
|
3713
3713
|
const n = [];
|
|
@@ -3888,7 +3888,7 @@ function _c(e, n) {
|
|
|
3888
3888
|
).length !== 0
|
|
3889
3889
|
);
|
|
3890
3890
|
}
|
|
3891
|
-
function
|
|
3891
|
+
function et(e) {
|
|
3892
3892
|
return e && Object.fromEntries(
|
|
3893
3893
|
Object.entries(e).filter(([, n]) => n !== void 0)
|
|
3894
3894
|
);
|
|
@@ -3905,7 +3905,7 @@ class Pe {
|
|
|
3905
3905
|
p(this, "BlockNoteEditor", "only for types");
|
|
3906
3906
|
p(this, "Block", "only for types");
|
|
3907
3907
|
p(this, "PartialBlock", "only for types");
|
|
3908
|
-
this.blockSpecs =
|
|
3908
|
+
this.blockSpecs = et(n == null ? void 0 : n.blockSpecs) || Vn, this.inlineContentSpecs = et(n == null ? void 0 : n.inlineContentSpecs) || _n, this.styleSpecs = et(n == null ? void 0 : n.styleSpecs) || Un, this.blockSchema = gn(this.blockSpecs), this.inlineContentSchema = wn(
|
|
3909
3909
|
this.inlineContentSpecs
|
|
3910
3910
|
), this.styleSchema = Cn(this.styleSpecs);
|
|
3911
3911
|
}
|
|
@@ -3968,7 +3968,7 @@ function Fc(e) {
|
|
|
3968
3968
|
function Qs(e) {
|
|
3969
3969
|
return e.transact((n) => {
|
|
3970
3970
|
const t = X(n.doc, n.selection.anchor);
|
|
3971
|
-
if (n.selection instanceof
|
|
3971
|
+
if (n.selection instanceof Ee)
|
|
3972
3972
|
return {
|
|
3973
3973
|
type: "cell",
|
|
3974
3974
|
anchorBlockId: t.node.attrs.id,
|
|
@@ -4001,7 +4001,7 @@ function ei(e, n) {
|
|
|
4001
4001
|
);
|
|
4002
4002
|
let o;
|
|
4003
4003
|
if (n.type === "cell")
|
|
4004
|
-
o =
|
|
4004
|
+
o = Ee.create(
|
|
4005
4005
|
e.doc,
|
|
4006
4006
|
t + n.anchorCellOffset,
|
|
4007
4007
|
t + n.headCellOffset
|
|
@@ -4022,10 +4022,10 @@ function ei(e, n) {
|
|
|
4022
4022
|
}
|
|
4023
4023
|
e.setSelection(o);
|
|
4024
4024
|
}
|
|
4025
|
-
function
|
|
4026
|
-
return e.map((n) => n.type === "columnList" ? n.children.map((t) =>
|
|
4025
|
+
function ht(e) {
|
|
4026
|
+
return e.map((n) => n.type === "columnList" ? n.children.map((t) => ht(t.children)).flat() : {
|
|
4027
4027
|
...n,
|
|
4028
|
-
children:
|
|
4028
|
+
children: ht(n.children)
|
|
4029
4029
|
}).flat();
|
|
4030
4030
|
}
|
|
4031
4031
|
function Fn(e, n, t) {
|
|
@@ -4034,7 +4034,7 @@ function Fn(e, n, t) {
|
|
|
4034
4034
|
const r = ((i = e.getSelection()) == null ? void 0 : i.blocks) || [
|
|
4035
4035
|
e.getTextCursorPosition().block
|
|
4036
4036
|
], s = Qs(e);
|
|
4037
|
-
e.removeBlocks(r), e.insertBlocks(
|
|
4037
|
+
e.removeBlocks(r), e.insertBlocks(ht(r), n, t), ei(o, s);
|
|
4038
4038
|
});
|
|
4039
4039
|
}
|
|
4040
4040
|
function zn(e) {
|
|
@@ -4116,7 +4116,7 @@ function oi(e, n) {
|
|
|
4116
4116
|
), f = i.start, m = i.end;
|
|
4117
4117
|
o(
|
|
4118
4118
|
t.tr.step(
|
|
4119
|
-
new
|
|
4119
|
+
new nt(
|
|
4120
4120
|
f - (d ? 3 : 1),
|
|
4121
4121
|
m,
|
|
4122
4122
|
f,
|
|
@@ -4144,46 +4144,46 @@ function ri(e) {
|
|
|
4144
4144
|
}
|
|
4145
4145
|
function si(e) {
|
|
4146
4146
|
return e.transact((n) => {
|
|
4147
|
-
const { bnBlock: t } =
|
|
4147
|
+
const { bnBlock: t } = Ge(n);
|
|
4148
4148
|
return n.doc.resolve(t.beforePos).nodeBefore !== null;
|
|
4149
4149
|
});
|
|
4150
4150
|
}
|
|
4151
4151
|
function ii(e) {
|
|
4152
4152
|
return e.transact((n) => {
|
|
4153
|
-
const { bnBlock: t } =
|
|
4153
|
+
const { bnBlock: t } = Ge(n);
|
|
4154
4154
|
return n.doc.resolve(t.beforePos).depth > 1;
|
|
4155
4155
|
});
|
|
4156
4156
|
}
|
|
4157
4157
|
function ai(e, n) {
|
|
4158
|
-
const t = typeof n == "string" ? n : n.id, o =
|
|
4158
|
+
const t = typeof n == "string" ? n : n.id, o = T(e), r = _(t, e);
|
|
4159
4159
|
if (r)
|
|
4160
|
-
return
|
|
4160
|
+
return S(r.node, o);
|
|
4161
4161
|
}
|
|
4162
4162
|
function ci(e, n) {
|
|
4163
|
-
const t = typeof n == "string" ? n : n.id, o = _(t, e), r =
|
|
4163
|
+
const t = typeof n == "string" ? n : n.id, o = _(t, e), r = T(e);
|
|
4164
4164
|
if (!o)
|
|
4165
4165
|
return;
|
|
4166
4166
|
const i = e.resolve(o.posBeforeNode).nodeBefore;
|
|
4167
4167
|
if (i)
|
|
4168
|
-
return
|
|
4168
|
+
return S(i, r);
|
|
4169
4169
|
}
|
|
4170
4170
|
function li(e, n) {
|
|
4171
|
-
const t = typeof n == "string" ? n : n.id, o = _(t, e), r =
|
|
4171
|
+
const t = typeof n == "string" ? n : n.id, o = _(t, e), r = T(e);
|
|
4172
4172
|
if (!o)
|
|
4173
4173
|
return;
|
|
4174
4174
|
const i = e.resolve(
|
|
4175
4175
|
o.posBeforeNode + o.node.nodeSize
|
|
4176
4176
|
).nodeAfter;
|
|
4177
4177
|
if (i)
|
|
4178
|
-
return
|
|
4178
|
+
return S(i, r);
|
|
4179
4179
|
}
|
|
4180
4180
|
function di(e, n) {
|
|
4181
|
-
const t = typeof n == "string" ? n : n.id, o =
|
|
4181
|
+
const t = typeof n == "string" ? n : n.id, o = T(e), r = _(t, e);
|
|
4182
4182
|
if (!r)
|
|
4183
4183
|
return;
|
|
4184
4184
|
const s = e.resolve(r.posBeforeNode), i = s.node(), a = s.node(-1), c = a.type.name !== "doc" ? i.type.name === "blockGroup" ? a : i : void 0;
|
|
4185
4185
|
if (c)
|
|
4186
|
-
return
|
|
4186
|
+
return S(c, o);
|
|
4187
4187
|
}
|
|
4188
4188
|
function ui(e, n, t, o = { updateSelection: !0 }) {
|
|
4189
4189
|
let { from: r, to: s } = typeof n == "number" ? { from: n, to: n } : { from: n.from, to: n.to }, i = !0, a = !0, c = "";
|
|
@@ -4196,7 +4196,7 @@ function ui(e, n, t, o = { updateSelection: !0 }) {
|
|
|
4196
4196
|
return i ? e.insertText(c, r, s) : e.replaceWith(r, s, t), o.updateSelection && po(e, e.steps.length - 1, -1), !0;
|
|
4197
4197
|
}
|
|
4198
4198
|
function pi(e) {
|
|
4199
|
-
const n =
|
|
4199
|
+
const n = T(e);
|
|
4200
4200
|
if (e.selection.empty || "node" in e.selection)
|
|
4201
4201
|
return;
|
|
4202
4202
|
const t = e.doc.resolve(
|
|
@@ -4209,10 +4209,10 @@ function pi(e) {
|
|
|
4209
4209
|
throw new Error(
|
|
4210
4210
|
`Error getting selection - node not found at position ${u}`
|
|
4211
4211
|
);
|
|
4212
|
-
return
|
|
4212
|
+
return S(h, n);
|
|
4213
4213
|
}, s = [], i = t.sharedDepth(o.pos), a = t.index(i), c = o.index(i);
|
|
4214
4214
|
if (t.depth > i) {
|
|
4215
|
-
s.push(
|
|
4215
|
+
s.push(S(t.nodeAfter, n));
|
|
4216
4216
|
for (let l = t.depth; l > i; l--)
|
|
4217
4217
|
if (t.node(l).type.isInGroup("childContainer")) {
|
|
4218
4218
|
const u = t.index(l) + 1, h = t.node(l).childCount;
|
|
@@ -4232,7 +4232,7 @@ function pi(e) {
|
|
|
4232
4232
|
};
|
|
4233
4233
|
}
|
|
4234
4234
|
function hi(e, n, t) {
|
|
4235
|
-
const o = typeof n == "string" ? n : n.id, r = typeof t == "string" ? t : t.id, s =
|
|
4235
|
+
const o = typeof n == "string" ? n : n.id, r = typeof t == "string" ? t : t.id, s = T(e), i = Te(s);
|
|
4236
4236
|
if (o === r)
|
|
4237
4237
|
throw new Error(
|
|
4238
4238
|
`Attempting to set selection with the same anchor and head blocks (id ${o})`
|
|
@@ -4254,12 +4254,12 @@ function hi(e, n, t) {
|
|
|
4254
4254
|
);
|
|
4255
4255
|
let f, m;
|
|
4256
4256
|
if (u.content === "table") {
|
|
4257
|
-
const g =
|
|
4257
|
+
const g = Dt.get(l.blockContent.node);
|
|
4258
4258
|
f = l.blockContent.beforePos + g.positionAt(0, 0, l.blockContent.node) + 1 + 2;
|
|
4259
4259
|
} else
|
|
4260
4260
|
f = l.blockContent.beforePos + 1;
|
|
4261
4261
|
if (h.content === "table") {
|
|
4262
|
-
const g =
|
|
4262
|
+
const g = Dt.get(d.blockContent.node), b = d.blockContent.beforePos + g.positionAt(
|
|
4263
4263
|
g.height - 1,
|
|
4264
4264
|
g.width - 1,
|
|
4265
4265
|
d.blockContent.node
|
|
@@ -4270,7 +4270,7 @@ function hi(e, n, t) {
|
|
|
4270
4270
|
e.setSelection(H.create(e.doc, f, m));
|
|
4271
4271
|
}
|
|
4272
4272
|
function fi(e) {
|
|
4273
|
-
const n =
|
|
4273
|
+
const n = T(e);
|
|
4274
4274
|
let t = e.selection.$from, o = e.selection.$to;
|
|
4275
4275
|
for (; o.parentOffset >= o.parent.nodeSize - 2 && o.depth > 0; )
|
|
4276
4276
|
o = e.doc.resolve(o.pos + 1);
|
|
@@ -4293,17 +4293,17 @@ function fi(e) {
|
|
|
4293
4293
|
};
|
|
4294
4294
|
}
|
|
4295
4295
|
function mi(e) {
|
|
4296
|
-
const { bnBlock: n } =
|
|
4296
|
+
const { bnBlock: n } = Ge(e), t = T(e.doc), o = e.doc.resolve(n.beforePos), r = o.nodeBefore, s = e.doc.resolve(n.afterPos).nodeAfter;
|
|
4297
4297
|
let i;
|
|
4298
4298
|
return o.depth > 1 && (i = o.node(), i.type.isInGroup("bnBlock") || (i = o.node(o.depth - 1))), {
|
|
4299
|
-
block:
|
|
4300
|
-
prevBlock: r === null ? void 0 :
|
|
4301
|
-
nextBlock: s === null ? void 0 :
|
|
4302
|
-
parentBlock: i === void 0 ? void 0 :
|
|
4299
|
+
block: S(n.node, t),
|
|
4300
|
+
prevBlock: r === null ? void 0 : S(r, t),
|
|
4301
|
+
nextBlock: s === null ? void 0 : S(s, t),
|
|
4302
|
+
parentBlock: i === void 0 ? void 0 : S(i, t)
|
|
4303
4303
|
};
|
|
4304
4304
|
}
|
|
4305
4305
|
function qn(e, n, t = "start") {
|
|
4306
|
-
const o = typeof n == "string" ? n : n.id, r =
|
|
4306
|
+
const o = typeof n == "string" ? n : n.id, r = T(e.doc), s = Te(r), i = _(o, e.doc);
|
|
4307
4307
|
if (!i)
|
|
4308
4308
|
throw new Error(`Block with ID ${o} not found`);
|
|
4309
4309
|
const a = ee(i), c = s.blockSchema[a.blockNoteType].content;
|
|
@@ -4399,7 +4399,7 @@ function bi() {
|
|
|
4399
4399
|
};
|
|
4400
4400
|
return n;
|
|
4401
4401
|
}
|
|
4402
|
-
function
|
|
4402
|
+
function Pt(e) {
|
|
4403
4403
|
const n = fe;
|
|
4404
4404
|
if (!n)
|
|
4405
4405
|
throw new Error(
|
|
@@ -4411,8 +4411,8 @@ function Mt(e) {
|
|
|
4411
4411
|
}
|
|
4412
4412
|
async function ki(e, n, t, o) {
|
|
4413
4413
|
await Tt();
|
|
4414
|
-
const s =
|
|
4415
|
-
return
|
|
4414
|
+
const s = Je(n, t).exportBlocks(e, o);
|
|
4415
|
+
return Pt(s);
|
|
4416
4416
|
}
|
|
4417
4417
|
function wi(e) {
|
|
4418
4418
|
return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
|
|
@@ -4446,25 +4446,25 @@ function vi(e) {
|
|
|
4446
4446
|
});
|
|
4447
4447
|
}
|
|
4448
4448
|
let Jt = null;
|
|
4449
|
-
function
|
|
4449
|
+
function Si() {
|
|
4450
4450
|
return Jt || (Jt = document.implementation.createHTMLDocument("title"));
|
|
4451
4451
|
}
|
|
4452
4452
|
function Kn(e) {
|
|
4453
4453
|
if (typeof e == "string") {
|
|
4454
|
-
const n =
|
|
4454
|
+
const n = Si().createElement("div");
|
|
4455
4455
|
n.innerHTML = e, e = n;
|
|
4456
4456
|
}
|
|
4457
4457
|
return Ci(e), vi(e), e;
|
|
4458
4458
|
}
|
|
4459
4459
|
async function Jn(e, n) {
|
|
4460
|
-
const t = Kn(e), r =
|
|
4460
|
+
const t = Kn(e), r = We.fromSchema(n).parse(t, {
|
|
4461
4461
|
topNode: n.nodes.blockGroup.create()
|
|
4462
4462
|
}), s = [];
|
|
4463
4463
|
for (let i = 0; i < r.childCount; i++)
|
|
4464
|
-
s.push(
|
|
4464
|
+
s.push(S(r.child(i), n));
|
|
4465
4465
|
return s;
|
|
4466
4466
|
}
|
|
4467
|
-
function
|
|
4467
|
+
function Ei(e, n) {
|
|
4468
4468
|
const t = n.value ? n.value : "", o = {};
|
|
4469
4469
|
n.lang && (o["data-language"] = n.lang);
|
|
4470
4470
|
let r = {
|
|
@@ -4485,7 +4485,7 @@ async function Xn(e) {
|
|
|
4485
4485
|
return n.unified.unified().use(n.remarkParse.default).use(n.remarkGfm.default).use(n.remarkRehype.default, {
|
|
4486
4486
|
handlers: {
|
|
4487
4487
|
...n.remarkRehype.defaultHandlers,
|
|
4488
|
-
code:
|
|
4488
|
+
code: Ei
|
|
4489
4489
|
}
|
|
4490
4490
|
}).use(n.rehypeStringify.default).processSync(e).value;
|
|
4491
4491
|
}
|
|
@@ -4493,7 +4493,7 @@ async function Bi(e, n) {
|
|
|
4493
4493
|
const t = await Xn(e);
|
|
4494
4494
|
return Jn(t, n);
|
|
4495
4495
|
}
|
|
4496
|
-
const
|
|
4496
|
+
const It = [
|
|
4497
4497
|
"vscode-editor-data",
|
|
4498
4498
|
"blocknote/html",
|
|
4499
4499
|
"text/markdown",
|
|
@@ -4506,7 +4506,7 @@ function xi(e, n) {
|
|
|
4506
4506
|
throw new Error("The strings provided are not valid file extensions.");
|
|
4507
4507
|
return e === n;
|
|
4508
4508
|
}
|
|
4509
|
-
function
|
|
4509
|
+
function Mi(e, n) {
|
|
4510
4510
|
const t = e.split("/"), o = n.split("/");
|
|
4511
4511
|
if (t.length !== 2)
|
|
4512
4512
|
throw new Error(`The string ${e} is not a valid MIME type.`);
|
|
@@ -4534,7 +4534,7 @@ async function Yn(e, n) {
|
|
|
4534
4534
|
if (t === null)
|
|
4535
4535
|
return;
|
|
4536
4536
|
let o = null;
|
|
4537
|
-
for (const a of
|
|
4537
|
+
for (const a of It)
|
|
4538
4538
|
if (t.types.includes(a)) {
|
|
4539
4539
|
o = a;
|
|
4540
4540
|
break;
|
|
@@ -4553,7 +4553,7 @@ async function Yn(e, n) {
|
|
|
4553
4553
|
for (const d of s)
|
|
4554
4554
|
for (const u of d.fileBlockAccept || []) {
|
|
4555
4555
|
const h = u.startsWith("."), f = r[a].getAsFile();
|
|
4556
|
-
if (f && (!h && f.type &&
|
|
4556
|
+
if (f && (!h && f.type && Mi(r[a].type, u) || h && xi(
|
|
4557
4557
|
"." + f.name.split(".").pop(),
|
|
4558
4558
|
u
|
|
4559
4559
|
))) {
|
|
@@ -4599,7 +4599,7 @@ async function Yn(e, n) {
|
|
|
4599
4599
|
}
|
|
4600
4600
|
}
|
|
4601
4601
|
}
|
|
4602
|
-
const
|
|
4602
|
+
const Ti = (e) => V.create({
|
|
4603
4603
|
name: "dropFile",
|
|
4604
4604
|
addProseMirrorPlugins() {
|
|
4605
4605
|
return [
|
|
@@ -4610,7 +4610,7 @@ const Mi = (e) => V.create({
|
|
|
4610
4610
|
if (!e.isEditable)
|
|
4611
4611
|
return;
|
|
4612
4612
|
let o = null;
|
|
4613
|
-
for (const r of
|
|
4613
|
+
for (const r of It)
|
|
4614
4614
|
if (t.dataTransfer.types.includes(r)) {
|
|
4615
4615
|
o = r;
|
|
4616
4616
|
break;
|
|
@@ -4656,7 +4656,7 @@ function Wi({
|
|
|
4656
4656
|
return n.pasteText(c), !0;
|
|
4657
4657
|
}
|
|
4658
4658
|
let s;
|
|
4659
|
-
for (const c of
|
|
4659
|
+
for (const c of It)
|
|
4660
4660
|
if (e.clipboardData.types.includes(c)) {
|
|
4661
4661
|
s = c;
|
|
4662
4662
|
break;
|
|
@@ -4712,16 +4712,16 @@ function Zn(e) {
|
|
|
4712
4712
|
const n = [];
|
|
4713
4713
|
return e.descendants((t) => {
|
|
4714
4714
|
var r, s;
|
|
4715
|
-
const o =
|
|
4715
|
+
const o = T(t);
|
|
4716
4716
|
return t.type.name === "blockContainer" && ((r = t.firstChild) == null ? void 0 : r.type.name) === "blockGroup" ? !0 : t.type.name === "columnList" && t.childCount === 1 ? ((s = t.firstChild) == null || s.forEach((i) => {
|
|
4717
|
-
n.push(
|
|
4718
|
-
}), !1) : t.type.isInGroup("bnBlock") ? (n.push(
|
|
4717
|
+
n.push(S(i, o));
|
|
4718
|
+
}), !1) : t.type.isInGroup("bnBlock") ? (n.push(S(t, o)), !1) : !0;
|
|
4719
4719
|
}), n;
|
|
4720
4720
|
}
|
|
4721
4721
|
function Gi(e, n, t) {
|
|
4722
4722
|
var a;
|
|
4723
4723
|
let o = !1;
|
|
4724
|
-
const r = e.state.selection instanceof
|
|
4724
|
+
const r = e.state.selection instanceof Ee;
|
|
4725
4725
|
if (!r) {
|
|
4726
4726
|
const c = e.state.doc.slice(
|
|
4727
4727
|
e.state.selection.from,
|
|
@@ -4735,7 +4735,7 @@ function Gi(e, n, t) {
|
|
|
4735
4735
|
) === void 0, o && (n = c);
|
|
4736
4736
|
}
|
|
4737
4737
|
let s;
|
|
4738
|
-
const i =
|
|
4738
|
+
const i = Je(
|
|
4739
4739
|
e.state.schema,
|
|
4740
4740
|
t
|
|
4741
4741
|
);
|
|
@@ -4751,7 +4751,7 @@ function Gi(e, n, t) {
|
|
|
4751
4751
|
{}
|
|
4752
4752
|
)}</table>`;
|
|
4753
4753
|
} else if (o) {
|
|
4754
|
-
const c =
|
|
4754
|
+
const c = qe(
|
|
4755
4755
|
n,
|
|
4756
4756
|
t.schema.inlineContentSchema,
|
|
4757
4757
|
t.schema.styleSchema
|
|
@@ -4775,7 +4775,7 @@ function Qn(e, n) {
|
|
|
4775
4775
|
e,
|
|
4776
4776
|
o,
|
|
4777
4777
|
n
|
|
4778
|
-
), s =
|
|
4778
|
+
), s = Pt(r);
|
|
4779
4779
|
return { clipboardHTML: t, externalHTML: r, markdown: s };
|
|
4780
4780
|
}
|
|
4781
4781
|
const Yt = () => {
|
|
@@ -4838,9 +4838,9 @@ const Yt = () => {
|
|
|
4838
4838
|
types: ["blockContainer", "tableCell", "tableHeader"],
|
|
4839
4839
|
attributes: {
|
|
4840
4840
|
backgroundColor: {
|
|
4841
|
-
default:
|
|
4842
|
-
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") :
|
|
4843
|
-
renderHTML: (e) => e.backgroundColor ===
|
|
4841
|
+
default: M.backgroundColor.default,
|
|
4842
|
+
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : M.backgroundColor.default,
|
|
4843
|
+
renderHTML: (e) => e.backgroundColor === M.backgroundColor.default ? {} : {
|
|
4844
4844
|
"data-background-color": e.backgroundColor
|
|
4845
4845
|
}
|
|
4846
4846
|
}
|
|
@@ -4849,7 +4849,7 @@ const Yt = () => {
|
|
|
4849
4849
|
];
|
|
4850
4850
|
}
|
|
4851
4851
|
});
|
|
4852
|
-
class
|
|
4852
|
+
class Lt {
|
|
4853
4853
|
constructor() {
|
|
4854
4854
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
4855
4855
|
p(this, "callbacks", {});
|
|
@@ -4869,7 +4869,7 @@ class It {
|
|
|
4869
4869
|
this.callbacks = {};
|
|
4870
4870
|
}
|
|
4871
4871
|
}
|
|
4872
|
-
class L extends
|
|
4872
|
+
class L extends Lt {
|
|
4873
4873
|
// eslint-disable-next-line
|
|
4874
4874
|
constructor(...t) {
|
|
4875
4875
|
super();
|
|
@@ -4884,7 +4884,7 @@ class L extends It {
|
|
|
4884
4884
|
get priority() {
|
|
4885
4885
|
}
|
|
4886
4886
|
}
|
|
4887
|
-
const
|
|
4887
|
+
const Fe = class Fe extends L {
|
|
4888
4888
|
constructor(t) {
|
|
4889
4889
|
super();
|
|
4890
4890
|
p(this, "provider");
|
|
@@ -4892,7 +4892,7 @@ const $e = class $e extends L {
|
|
|
4892
4892
|
p(this, "renderCursor", (t, o) => {
|
|
4893
4893
|
let r = this.recentlyUpdatedCursors.get(o);
|
|
4894
4894
|
if (!r) {
|
|
4895
|
-
const s = (this.collaboration.renderCursor ??
|
|
4895
|
+
const s = (this.collaboration.renderCursor ?? Fe.defaultCursorRender)(t);
|
|
4896
4896
|
this.collaboration.showCursorLabels !== "always" && (s.addEventListener("mouseenter", () => {
|
|
4897
4897
|
const i = this.recentlyUpdatedCursors.get(o);
|
|
4898
4898
|
i.element.setAttribute("data-active", ""), i.hideTimeout && (clearTimeout(i.hideTimeout), this.recentlyUpdatedCursors.set(o, {
|
|
@@ -4946,7 +4946,7 @@ const $e = class $e extends L {
|
|
|
4946
4946
|
return 999;
|
|
4947
4947
|
}
|
|
4948
4948
|
};
|
|
4949
|
-
p(
|
|
4949
|
+
p(Fe, "defaultCursorRender", (t) => {
|
|
4950
4950
|
const o = document.createElement("span");
|
|
4951
4951
|
o.classList.add("bn-collaboration-cursor__base");
|
|
4952
4952
|
const r = document.createElement("span");
|
|
@@ -4954,8 +4954,8 @@ p($e, "defaultCursorRender", (t) => {
|
|
|
4954
4954
|
const s = document.createElement("span");
|
|
4955
4955
|
return s.classList.add("bn-collaboration-cursor__label"), s.setAttribute("style", `background-color: ${t.color}`), s.insertBefore(document.createTextNode(t.name), null), r.insertBefore(s, null), o.insertBefore(document.createTextNode(""), null), o.insertBefore(r, null), o.insertBefore(document.createTextNode(""), null), o;
|
|
4956
4956
|
});
|
|
4957
|
-
let
|
|
4958
|
-
class
|
|
4957
|
+
let _e = Fe;
|
|
4958
|
+
class ft extends L {
|
|
4959
4959
|
static key() {
|
|
4960
4960
|
return "ySyncPlugin";
|
|
4961
4961
|
}
|
|
@@ -4966,12 +4966,12 @@ class ht extends L {
|
|
|
4966
4966
|
return 1001;
|
|
4967
4967
|
}
|
|
4968
4968
|
}
|
|
4969
|
-
class
|
|
4969
|
+
class mt extends L {
|
|
4970
4970
|
static key() {
|
|
4971
4971
|
return "yUndoPlugin";
|
|
4972
4972
|
}
|
|
4973
|
-
constructor() {
|
|
4974
|
-
super(), this.addProsemirrorPlugin(jo());
|
|
4973
|
+
constructor({ editor: n }) {
|
|
4974
|
+
super(), this.addProsemirrorPlugin(jo({ trackedOrigins: [n] }));
|
|
4975
4975
|
}
|
|
4976
4976
|
get priority() {
|
|
4977
4977
|
return 1e3;
|
|
@@ -5007,7 +5007,7 @@ const eo = ne.create({
|
|
|
5007
5007
|
renderHTML({ HTMLAttributes: e }) {
|
|
5008
5008
|
return [
|
|
5009
5009
|
"span",
|
|
5010
|
-
|
|
5010
|
+
bt(e, {
|
|
5011
5011
|
class: "bn-thread-mark"
|
|
5012
5012
|
})
|
|
5013
5013
|
];
|
|
@@ -5021,7 +5021,7 @@ const eo = ne.create({
|
|
|
5021
5021
|
} : {};
|
|
5022
5022
|
}
|
|
5023
5023
|
});
|
|
5024
|
-
class Ji extends
|
|
5024
|
+
class Ji extends Lt {
|
|
5025
5025
|
constructor(t) {
|
|
5026
5026
|
super();
|
|
5027
5027
|
p(this, "userCache", /* @__PURE__ */ new Map());
|
|
@@ -5068,7 +5068,7 @@ class Ji extends It {
|
|
|
5068
5068
|
return this.on("update", t);
|
|
5069
5069
|
}
|
|
5070
5070
|
}
|
|
5071
|
-
const
|
|
5071
|
+
const Ae = new U("blocknote-comments"), Xi = "SET_SELECTED_THREAD_ID";
|
|
5072
5072
|
function Yi(e, n) {
|
|
5073
5073
|
const t = /* @__PURE__ */ new Map();
|
|
5074
5074
|
return e.descendants((o, r) => {
|
|
@@ -5145,7 +5145,7 @@ class Zi extends L {
|
|
|
5145
5145
|
const s = this;
|
|
5146
5146
|
this.addProsemirrorPlugin(
|
|
5147
5147
|
new A({
|
|
5148
|
-
key:
|
|
5148
|
+
key: Ae,
|
|
5149
5149
|
state: {
|
|
5150
5150
|
init() {
|
|
5151
5151
|
return {
|
|
@@ -5153,7 +5153,7 @@ class Zi extends L {
|
|
|
5153
5153
|
};
|
|
5154
5154
|
},
|
|
5155
5155
|
apply(i, a) {
|
|
5156
|
-
const c = i.getMeta(
|
|
5156
|
+
const c = i.getMeta(Ae);
|
|
5157
5157
|
if (!i.docChanged && !c)
|
|
5158
5158
|
return a;
|
|
5159
5159
|
const l = i.docChanged ? Yi(i.doc, s.markType) : s.threadPositions;
|
|
@@ -5181,7 +5181,7 @@ class Zi extends L {
|
|
|
5181
5181
|
props: {
|
|
5182
5182
|
decorations(i) {
|
|
5183
5183
|
var a;
|
|
5184
|
-
return ((a =
|
|
5184
|
+
return ((a = Ae.getState(i)) == null ? void 0 : a.decorations) ?? W.empty;
|
|
5185
5185
|
},
|
|
5186
5186
|
/**
|
|
5187
5187
|
* Handle click on a thread mark and mark it as selected
|
|
@@ -5225,7 +5225,7 @@ class Zi extends L {
|
|
|
5225
5225
|
selectThread(t, o = !0) {
|
|
5226
5226
|
var r, s;
|
|
5227
5227
|
if (this.selectedThreadId !== t && (this.selectedThreadId = t, this.emitStateUpdate(), this.editor.transact(
|
|
5228
|
-
(i) => i.setMeta(
|
|
5228
|
+
(i) => i.setMeta(Ae, {
|
|
5229
5229
|
name: Xi
|
|
5230
5230
|
})
|
|
5231
5231
|
), t && o)) {
|
|
@@ -5256,7 +5256,7 @@ class Zi extends L {
|
|
|
5256
5256
|
async createThread(t) {
|
|
5257
5257
|
const o = await this.threadStore.createThread(t);
|
|
5258
5258
|
if (this.threadStore.addThreadToDocument) {
|
|
5259
|
-
const r = this.editor.prosemirrorView, s = r.state.selection, i =
|
|
5259
|
+
const r = this.editor.prosemirrorView, s = r.state.selection, i = de.getState(r.state), a = {
|
|
5260
5260
|
prosemirror: {
|
|
5261
5261
|
head: s.head,
|
|
5262
5262
|
anchor: s.anchor
|
|
@@ -5332,7 +5332,7 @@ class Qi {
|
|
|
5332
5332
|
this.pmView.dom.removeEventListener("mousedown", this.mouseDownHandler), this.pmView.dom.removeEventListener("dragstart", this.dragstartHandler), this.pmView.root.removeEventListener("scroll", this.scrollHandler, !0);
|
|
5333
5333
|
}
|
|
5334
5334
|
}
|
|
5335
|
-
const
|
|
5335
|
+
const tt = new U(
|
|
5336
5336
|
"FilePanelPlugin"
|
|
5337
5337
|
);
|
|
5338
5338
|
class ea extends L {
|
|
@@ -5345,10 +5345,10 @@ class ea extends L {
|
|
|
5345
5345
|
});
|
|
5346
5346
|
this.addProsemirrorPlugin(
|
|
5347
5347
|
new A({
|
|
5348
|
-
key:
|
|
5348
|
+
key: tt,
|
|
5349
5349
|
view: (o) => (this.view = new Qi(
|
|
5350
5350
|
t,
|
|
5351
|
-
|
|
5351
|
+
tt,
|
|
5352
5352
|
o,
|
|
5353
5353
|
(r) => {
|
|
5354
5354
|
this.emit("update", r);
|
|
@@ -5365,8 +5365,8 @@ class ea extends L {
|
|
|
5365
5365
|
block: void 0
|
|
5366
5366
|
}),
|
|
5367
5367
|
apply: (o, r) => {
|
|
5368
|
-
const s = o.getMeta(
|
|
5369
|
-
return s || (!o.getMeta(
|
|
5368
|
+
const s = o.getMeta(tt);
|
|
5369
|
+
return s || (!o.getMeta(de) && (o.selectionSet || o.docChanged) ? { block: void 0 } : r);
|
|
5370
5370
|
}
|
|
5371
5371
|
}
|
|
5372
5372
|
})
|
|
@@ -5391,7 +5391,7 @@ class ta {
|
|
|
5391
5391
|
p(this, "preventShow", !1);
|
|
5392
5392
|
p(this, "shouldShow", ({ view: n, state: t, from: o, to: r }) => {
|
|
5393
5393
|
const { doc: s, selection: i } = t, { empty: a } = i, c = !s.textBetween(o, r).length && un(t.selection);
|
|
5394
|
-
if (i.$from.parent.type.spec.code ||
|
|
5394
|
+
if (i.$from.parent.type.spec.code || rt(i) && i.node.type.spec.code || a || c)
|
|
5395
5395
|
return !1;
|
|
5396
5396
|
const l = document.activeElement;
|
|
5397
5397
|
return !(!this.isElementWithinEditorWrapper(l) && n.editable);
|
|
@@ -5471,12 +5471,12 @@ class ta {
|
|
|
5471
5471
|
}
|
|
5472
5472
|
getSelectionBoundingBox() {
|
|
5473
5473
|
const { state: n } = this.pmView, { selection: t } = n, { ranges: o } = t, r = Math.min(...o.map((i) => i.$from.pos)), s = Math.max(...o.map((i) => i.$to.pos));
|
|
5474
|
-
if (
|
|
5474
|
+
if (rt(t)) {
|
|
5475
5475
|
const i = this.pmView.nodeDOM(r);
|
|
5476
5476
|
if (i)
|
|
5477
5477
|
return i.getBoundingClientRect();
|
|
5478
5478
|
}
|
|
5479
|
-
return
|
|
5479
|
+
return Ve(this.pmView, r, s);
|
|
5480
5480
|
}
|
|
5481
5481
|
}
|
|
5482
5482
|
const na = new U(
|
|
@@ -5521,7 +5521,7 @@ const ra = te.create({
|
|
|
5521
5521
|
return [{ tag: "br" }];
|
|
5522
5522
|
},
|
|
5523
5523
|
renderHTML({ HTMLAttributes: e }) {
|
|
5524
|
-
return ["br",
|
|
5524
|
+
return ["br", bt(this.options.HTMLAttributes, e)];
|
|
5525
5525
|
},
|
|
5526
5526
|
renderText() {
|
|
5527
5527
|
return `
|
|
@@ -5535,21 +5535,21 @@ const ra = te.create({
|
|
|
5535
5535
|
t.index(t.depth - 1),
|
|
5536
5536
|
t.depth - 1
|
|
5537
5537
|
);
|
|
5538
|
-
return
|
|
5538
|
+
return Me(
|
|
5539
5539
|
e.resolve(o)
|
|
5540
5540
|
);
|
|
5541
|
-
},
|
|
5541
|
+
}, Re = (e, n) => {
|
|
5542
5542
|
const t = e.resolve(n), o = t.index();
|
|
5543
5543
|
if (o === 0)
|
|
5544
5544
|
return;
|
|
5545
5545
|
const r = t.posAtIndex(o - 1);
|
|
5546
|
-
return
|
|
5546
|
+
return Me(
|
|
5547
5547
|
e.resolve(r)
|
|
5548
5548
|
);
|
|
5549
5549
|
}, to = (e, n) => {
|
|
5550
5550
|
for (; n.childContainer; ) {
|
|
5551
5551
|
const t = n.childContainer.node, o = e.resolve(n.childContainer.beforePos + 1).posAtIndex(t.childCount - 1);
|
|
5552
|
-
n =
|
|
5552
|
+
n = Me(e.resolve(o));
|
|
5553
5553
|
}
|
|
5554
5554
|
return n;
|
|
5555
5555
|
}, sa = (e, n) => e.isBlockContainer && e.blockContent.node.type.spec.content === "inline*" && e.blockContent.node.childCount > 0 && n.isBlockContainer && n.blockContent.node.type.spec.content === "inline*", ia = (e, n, t, o) => {
|
|
@@ -5585,7 +5585,7 @@ const ra = te.create({
|
|
|
5585
5585
|
state: n,
|
|
5586
5586
|
dispatch: t
|
|
5587
5587
|
}) => {
|
|
5588
|
-
const o = n.doc.resolve(e), r =
|
|
5588
|
+
const o = n.doc.resolve(e), r = Me(o), s = Re(
|
|
5589
5589
|
n.doc,
|
|
5590
5590
|
r.bnBlock.beforePos
|
|
5591
5591
|
);
|
|
@@ -5638,7 +5638,7 @@ const ra = te.create({
|
|
|
5638
5638
|
}),
|
|
5639
5639
|
() => r.command(({ state: s, dispatch: i }) => {
|
|
5640
5640
|
const a = v(s);
|
|
5641
|
-
if (!a.isBlockContainer || !(s.selection.from === a.blockContent.beforePos + 1) ||
|
|
5641
|
+
if (!a.isBlockContainer || !(s.selection.from === a.blockContent.beforePos + 1) || Re(
|
|
5642
5642
|
s.doc,
|
|
5643
5643
|
a.bnBlock.beforePos
|
|
5644
5644
|
))
|
|
@@ -5665,7 +5665,7 @@ const ra = te.create({
|
|
|
5665
5665
|
if (m)
|
|
5666
5666
|
if (g) {
|
|
5667
5667
|
s.tr.step(
|
|
5668
|
-
new
|
|
5668
|
+
new nt(
|
|
5669
5669
|
// replace entire column list
|
|
5670
5670
|
h.bnBlock.beforePos,
|
|
5671
5671
|
h.bnBlock.afterPos,
|
|
@@ -5682,7 +5682,7 @@ const ra = te.create({
|
|
|
5682
5682
|
s.tr.setSelection(H.between(k, k));
|
|
5683
5683
|
} else {
|
|
5684
5684
|
s.tr.step(
|
|
5685
|
-
new
|
|
5685
|
+
new nt(
|
|
5686
5686
|
// replace entire column list
|
|
5687
5687
|
h.bnBlock.beforePos,
|
|
5688
5688
|
h.bnBlock.afterPos,
|
|
@@ -5742,7 +5742,7 @@ const ra = te.create({
|
|
|
5742
5742
|
if (!i.isBlockContainer)
|
|
5743
5743
|
return !1;
|
|
5744
5744
|
if (i.blockContent.node.childCount === 0 && i.blockContent.node.type.spec.content === "inline*") {
|
|
5745
|
-
const c =
|
|
5745
|
+
const c = Re(
|
|
5746
5746
|
s.doc,
|
|
5747
5747
|
i.bnBlock.beforePos
|
|
5748
5748
|
);
|
|
@@ -5777,7 +5777,7 @@ const ra = te.create({
|
|
|
5777
5777
|
const i = v(s);
|
|
5778
5778
|
if (!i.isBlockContainer)
|
|
5779
5779
|
throw new Error("todo");
|
|
5780
|
-
const a = s.selection.from === i.blockContent.beforePos + 1, c = s.selection.empty, l =
|
|
5780
|
+
const a = s.selection.from === i.blockContent.beforePos + 1, c = s.selection.empty, l = Re(
|
|
5781
5781
|
s.doc,
|
|
5782
5782
|
i.bnBlock.beforePos
|
|
5783
5783
|
);
|
|
@@ -5825,42 +5825,53 @@ const ra = te.create({
|
|
|
5825
5825
|
}
|
|
5826
5826
|
return !1;
|
|
5827
5827
|
})
|
|
5828
|
-
]), t = (o = !1) => this.editor.commands.first(({ commands: r }) => [
|
|
5828
|
+
]), t = (o = !1) => this.editor.commands.first(({ commands: r, tr: s }) => [
|
|
5829
5829
|
// Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start
|
|
5830
5830
|
// of the block.
|
|
5831
|
-
() => r.command(({ state:
|
|
5832
|
-
const
|
|
5833
|
-
if (!
|
|
5831
|
+
() => r.command(({ state: i }) => {
|
|
5832
|
+
const a = v(i);
|
|
5833
|
+
if (!a.isBlockContainer)
|
|
5834
5834
|
return !1;
|
|
5835
|
-
const { bnBlock:
|
|
5836
|
-
return
|
|
5835
|
+
const { bnBlock: c, blockContent: l } = a, { depth: d } = i.doc.resolve(c.beforePos), u = i.selection.$anchor.parentOffset === 0, h = i.selection.anchor === i.selection.head, f = l.node.childCount === 0, m = d > 1;
|
|
5836
|
+
return u && h && f && m ? r.liftListItem("blockContainer") : !1;
|
|
5837
5837
|
}),
|
|
5838
5838
|
// Creates a hard break if block is configured to do so.
|
|
5839
|
-
() => r.command(({ state:
|
|
5840
|
-
const
|
|
5841
|
-
|
|
5839
|
+
() => r.command(({ state: i }) => {
|
|
5840
|
+
const a = v(i), c = this.options.editor.schema.blockSchema[a.blockNoteType].hardBreakShortcut ?? "shift+enter";
|
|
5841
|
+
if (c === "none")
|
|
5842
|
+
return !1;
|
|
5843
|
+
if (
|
|
5842
5844
|
// If shortcut is not configured, or is configured as "shift+enter",
|
|
5843
5845
|
// create a hard break for shift+enter, but not for enter.
|
|
5844
|
-
|
|
5846
|
+
c === "shift+enter" && o || // If shortcut is configured as "enter", create a hard break for
|
|
5845
5847
|
// both enter and shift+enter.
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5848
|
+
c === "enter"
|
|
5849
|
+
) {
|
|
5850
|
+
const l = s.storedMarks || s.selection.$head.marks().filter(
|
|
5851
|
+
(d) => this.editor.extensionManager.splittableMarks.includes(
|
|
5852
|
+
d.type.name
|
|
5853
|
+
)
|
|
5854
|
+
);
|
|
5855
|
+
return s.insert(
|
|
5856
|
+
s.selection.head,
|
|
5857
|
+
s.doc.type.schema.nodes.hardBreak.create()
|
|
5858
|
+
).ensureMarks(l), !0;
|
|
5859
|
+
}
|
|
5860
|
+
return !1;
|
|
5850
5861
|
}),
|
|
5851
5862
|
// Creates a new block and moves the selection to it if the current one is empty, while the selection is also
|
|
5852
5863
|
// empty & at the start of the block.
|
|
5853
|
-
() => r.command(({ state:
|
|
5854
|
-
const
|
|
5855
|
-
if (!
|
|
5864
|
+
() => r.command(({ state: i, dispatch: a }) => {
|
|
5865
|
+
const c = v(i);
|
|
5866
|
+
if (!c.isBlockContainer)
|
|
5856
5867
|
return !1;
|
|
5857
|
-
const { bnBlock:
|
|
5858
|
-
if (
|
|
5859
|
-
const
|
|
5860
|
-
if (
|
|
5861
|
-
const
|
|
5862
|
-
|
|
5863
|
-
new H(
|
|
5868
|
+
const { bnBlock: l, blockContent: d } = c, u = i.selection.$anchor.parentOffset === 0, h = i.selection.anchor === i.selection.head, f = d.node.childCount === 0;
|
|
5869
|
+
if (u && h && f) {
|
|
5870
|
+
const m = l.afterPos, g = m + 2;
|
|
5871
|
+
if (a) {
|
|
5872
|
+
const b = i.schema.nodes.blockContainer.createAndFill();
|
|
5873
|
+
i.tr.insert(m, b).scrollIntoView(), i.tr.setSelection(
|
|
5874
|
+
new H(i.doc.resolve(g))
|
|
5864
5875
|
);
|
|
5865
5876
|
}
|
|
5866
5877
|
return !0;
|
|
@@ -5869,16 +5880,16 @@ const ra = te.create({
|
|
|
5869
5880
|
}),
|
|
5870
5881
|
// Splits the current block, moving content inside that's after the cursor to a new text block below. Also
|
|
5871
5882
|
// deletes the selection beforehand, if it's not empty.
|
|
5872
|
-
() => r.command(({ state:
|
|
5873
|
-
const
|
|
5874
|
-
if (!
|
|
5883
|
+
() => r.command(({ state: i, chain: a }) => {
|
|
5884
|
+
const c = v(i);
|
|
5885
|
+
if (!c.isBlockContainer)
|
|
5875
5886
|
return !1;
|
|
5876
|
-
const { blockContent:
|
|
5877
|
-
return
|
|
5887
|
+
const { blockContent: l } = c, d = i.selection.$anchor.parentOffset === 0;
|
|
5888
|
+
return l.node.childCount === 0 ? !1 : (a().deleteSelection().command(
|
|
5878
5889
|
Hn(
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5890
|
+
i.selection.from,
|
|
5891
|
+
d,
|
|
5892
|
+
d
|
|
5882
5893
|
)
|
|
5883
5894
|
).run(), !0);
|
|
5884
5895
|
})
|
|
@@ -5924,7 +5935,7 @@ class ca {
|
|
|
5924
5935
|
const t = n.target, o = this.pmView.posAtDOM(t, 0) + 1, r = this.pmView.state.doc.resolve(o), s = r.marks();
|
|
5925
5936
|
for (const i of s)
|
|
5926
5937
|
if (i.type.name === this.pmView.state.schema.mark("link").type.name) {
|
|
5927
|
-
this.mouseHoveredLinkMark = i, this.mouseHoveredLinkMarkRange =
|
|
5938
|
+
this.mouseHoveredLinkMark = i, this.mouseHoveredLinkMarkRange = At(r, i.type, i.attrs) || void 0;
|
|
5928
5939
|
break;
|
|
5929
5940
|
}
|
|
5930
5941
|
}
|
|
@@ -5940,7 +5951,7 @@ class ca {
|
|
|
5940
5951
|
});
|
|
5941
5952
|
p(this, "scrollHandler", () => {
|
|
5942
5953
|
var n;
|
|
5943
|
-
this.linkMark !== void 0 && (n = this.state) != null && n.show && (this.state.referencePos =
|
|
5954
|
+
this.linkMark !== void 0 && (n = this.state) != null && n.show && (this.state.referencePos = Ve(
|
|
5944
5955
|
this.pmView,
|
|
5945
5956
|
this.linkMarkRange.from,
|
|
5946
5957
|
this.linkMarkRange.to
|
|
@@ -5967,7 +5978,7 @@ class ca {
|
|
|
5967
5978
|
editLink(n, t) {
|
|
5968
5979
|
var o;
|
|
5969
5980
|
this.editor.transact((r) => {
|
|
5970
|
-
const s =
|
|
5981
|
+
const s = T(r);
|
|
5971
5982
|
r.insertText(t, this.linkMarkRange.from, this.linkMarkRange.to), r.addMark(
|
|
5972
5983
|
this.linkMarkRange.from,
|
|
5973
5984
|
this.linkMarkRange.from + t.length,
|
|
@@ -5995,7 +6006,7 @@ class ca {
|
|
|
5995
6006
|
const c = this.pmView.state.selection.$from.marks();
|
|
5996
6007
|
for (const l of c)
|
|
5997
6008
|
if (l.type.name === this.pmView.state.schema.mark("link").type.name) {
|
|
5998
|
-
this.keyboardHoveredLinkMark = l, this.keyboardHoveredLinkMarkRange =
|
|
6009
|
+
this.keyboardHoveredLinkMark = l, this.keyboardHoveredLinkMarkRange = At(
|
|
5999
6010
|
this.pmView.state.selection.$from,
|
|
6000
6011
|
l.type,
|
|
6001
6012
|
l.attrs
|
|
@@ -6006,7 +6017,7 @@ class ca {
|
|
|
6006
6017
|
if (this.mouseHoveredLinkMark && o && (this.linkMark = this.mouseHoveredLinkMark, this.linkMarkRange = this.mouseHoveredLinkMarkRange), this.keyboardHoveredLinkMark && (this.linkMark = this.keyboardHoveredLinkMark, this.linkMarkRange = this.keyboardHoveredLinkMarkRange), this.linkMark && this.editor.isEditable) {
|
|
6007
6018
|
this.state = {
|
|
6008
6019
|
show: !0,
|
|
6009
|
-
referencePos:
|
|
6020
|
+
referencePos: Ve(
|
|
6010
6021
|
this.pmView,
|
|
6011
6022
|
this.linkMarkRange.from,
|
|
6012
6023
|
this.linkMarkRange.to
|
|
@@ -6270,12 +6281,12 @@ class ka extends L {
|
|
|
6270
6281
|
apply(t, o, r, s) {
|
|
6271
6282
|
if (o.currentTransactionOldBlockAttrs = {}, o.updatedBlocks.clear(), !t.docChanged || r.doc.eq(s.doc))
|
|
6272
6283
|
return o;
|
|
6273
|
-
const i = {}, a =
|
|
6284
|
+
const i = {}, a = Nt(
|
|
6274
6285
|
r.doc,
|
|
6275
6286
|
(d) => d.attrs.id
|
|
6276
6287
|
), c = new Map(
|
|
6277
6288
|
a.map((d) => [d.node.attrs.id, d])
|
|
6278
|
-
), l =
|
|
6289
|
+
), l = Nt(
|
|
6279
6290
|
s.doc,
|
|
6280
6291
|
(d) => d.attrs.id
|
|
6281
6292
|
);
|
|
@@ -6362,7 +6373,7 @@ function no(e, n) {
|
|
|
6362
6373
|
if (((o = e.getAttribute) == null ? void 0 : o.call(e, "data-node-type")) === "blockContainer")
|
|
6363
6374
|
return { node: e, id: e.getAttribute("data-id") };
|
|
6364
6375
|
}
|
|
6365
|
-
class
|
|
6376
|
+
class ce extends Oe {
|
|
6366
6377
|
constructor(t, o) {
|
|
6367
6378
|
super(t, o);
|
|
6368
6379
|
p(this, "nodes");
|
|
@@ -6373,13 +6384,13 @@ class ae extends De {
|
|
|
6373
6384
|
});
|
|
6374
6385
|
}
|
|
6375
6386
|
static create(t, o, r = o) {
|
|
6376
|
-
return new
|
|
6387
|
+
return new ce(t.resolve(o), t.resolve(r));
|
|
6377
6388
|
}
|
|
6378
6389
|
content() {
|
|
6379
6390
|
return new K(D.from(this.nodes), 0, 0);
|
|
6380
6391
|
}
|
|
6381
6392
|
eq(t) {
|
|
6382
|
-
if (!(t instanceof
|
|
6393
|
+
if (!(t instanceof ce) || this.nodes.length !== t.nodes.length || this.from !== t.from || this.to !== t.to)
|
|
6383
6394
|
return !1;
|
|
6384
6395
|
for (let o = 0; o < this.nodes.length; o++)
|
|
6385
6396
|
if (!this.nodes[o].eq(t.nodes[o]))
|
|
@@ -6388,7 +6399,7 @@ class ae extends De {
|
|
|
6388
6399
|
}
|
|
6389
6400
|
map(t, o) {
|
|
6390
6401
|
const r = o.mapResult(this.from), s = o.mapResult(this.to);
|
|
6391
|
-
return s.deleted ?
|
|
6402
|
+
return s.deleted ? Oe.near(t.resolve(r.pos)) : r.deleted ? Oe.near(t.resolve(s.pos)) : new ce(
|
|
6392
6403
|
t.resolve(r.pos),
|
|
6393
6404
|
t.resolve(s.pos)
|
|
6394
6405
|
);
|
|
@@ -6397,7 +6408,7 @@ class ae extends De {
|
|
|
6397
6408
|
return { type: "multiple-node", anchor: this.anchor, head: this.head };
|
|
6398
6409
|
}
|
|
6399
6410
|
}
|
|
6400
|
-
|
|
6411
|
+
Oe.jsonID("multiple-node", ce);
|
|
6401
6412
|
let z;
|
|
6402
6413
|
function ya(e, n) {
|
|
6403
6414
|
let t, o;
|
|
@@ -6447,18 +6458,18 @@ function Ca(e, n, t) {
|
|
|
6447
6458
|
throw new Error(`Block with ID ${n.id} not found`);
|
|
6448
6459
|
const s = r.posBeforeNode;
|
|
6449
6460
|
if (s != null) {
|
|
6450
|
-
const i = o.state.selection, a = o.state.doc, { from: c, to: l } = ya(i, a), d = c <= s && s < l, u = i.$anchor.node() !== i.$head.node() || i instanceof
|
|
6461
|
+
const i = o.state.selection, a = o.state.doc, { from: c, to: l } = ya(i, a), d = c <= s && s < l, u = i.$anchor.node() !== i.$head.node() || i instanceof ce;
|
|
6451
6462
|
d && u ? (o.dispatch(
|
|
6452
|
-
o.state.tr.setSelection(
|
|
6463
|
+
o.state.tr.setSelection(ce.create(a, c, l))
|
|
6453
6464
|
), on(o, c, l)) : (o.dispatch(
|
|
6454
6465
|
o.state.tr.setSelection(ge.create(o.state.doc, s))
|
|
6455
6466
|
), on(o, s));
|
|
6456
|
-
const h = o.state.selection.content(), f = t.pmSchema, m = o.serializeForClipboard(h).dom.innerHTML, g =
|
|
6467
|
+
const h = o.state.selection.content(), f = t.pmSchema, m = o.serializeForClipboard(h).dom.innerHTML, g = Je(f, t), b = Zn(h.content), k = g.exportBlocks(b, {}), w = Pt(k);
|
|
6457
6468
|
e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html", m), e.dataTransfer.setData("text/html", k), e.dataTransfer.setData("text/plain", w), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setDragImage(z, 0, 0);
|
|
6458
6469
|
}
|
|
6459
6470
|
}
|
|
6460
6471
|
const we = 0.1;
|
|
6461
|
-
function
|
|
6472
|
+
function gt(e, n, t, o = !0) {
|
|
6462
6473
|
const r = e.root.elementsFromPoint(
|
|
6463
6474
|
// bit hacky - offset x position to right to account for the width of sidemenu itself
|
|
6464
6475
|
n.left + (t === "editor" ? 50 : 0),
|
|
@@ -6466,7 +6477,7 @@ function mt(e, n, t, o = !0) {
|
|
|
6466
6477
|
);
|
|
6467
6478
|
for (const s of r)
|
|
6468
6479
|
if (e.dom.contains(s))
|
|
6469
|
-
return o && s.closest("[data-node-type=columnList]") ?
|
|
6480
|
+
return o && s.closest("[data-node-type=columnList]") ? gt(
|
|
6470
6481
|
e,
|
|
6471
6482
|
{
|
|
6472
6483
|
left: n.left + 50,
|
|
@@ -6485,14 +6496,14 @@ function va(e, n, t) {
|
|
|
6485
6496
|
top: e.y
|
|
6486
6497
|
}, s = r.left < o.left, i = r.left > o.right;
|
|
6487
6498
|
t === "viewport" && (s && (r.left = o.left + 10), i && (r.left = o.right - 10));
|
|
6488
|
-
let a =
|
|
6499
|
+
let a = gt(n, r, t);
|
|
6489
6500
|
if (!i && a) {
|
|
6490
6501
|
const c = a.node.getBoundingClientRect();
|
|
6491
|
-
r.left = c.right - 10, a =
|
|
6502
|
+
r.left = c.right - 10, a = gt(n, r, "viewport", !1);
|
|
6492
6503
|
}
|
|
6493
6504
|
return a;
|
|
6494
6505
|
}
|
|
6495
|
-
class
|
|
6506
|
+
class Sa {
|
|
6496
6507
|
constructor(n, t, o, r) {
|
|
6497
6508
|
p(this, "state");
|
|
6498
6509
|
p(this, "emitUpdate");
|
|
@@ -6599,7 +6610,7 @@ class Ea {
|
|
|
6599
6610
|
throw new Error("New drag was started while an existing drag is ongoing");
|
|
6600
6611
|
const o = document.createElement("div");
|
|
6601
6612
|
o.innerHTML = t;
|
|
6602
|
-
const s =
|
|
6613
|
+
const s = We.fromSchema(this.pmView.state.schema).parse(o, {
|
|
6603
6614
|
topNode: this.pmView.state.schema.nodes.blockGroup.create()
|
|
6604
6615
|
});
|
|
6605
6616
|
this.pmView.dragging = {
|
|
@@ -6723,7 +6734,7 @@ class Ea {
|
|
|
6723
6734
|
), this.pmView.root.removeEventListener("scroll", this.onScroll, !0);
|
|
6724
6735
|
}
|
|
6725
6736
|
}
|
|
6726
|
-
const
|
|
6737
|
+
const Ea = new U("SideMenuPlugin");
|
|
6727
6738
|
class Ba extends L {
|
|
6728
6739
|
constructor(t, o) {
|
|
6729
6740
|
super();
|
|
@@ -6758,8 +6769,8 @@ class Ba extends L {
|
|
|
6758
6769
|
});
|
|
6759
6770
|
this.editor = t, this.addProsemirrorPlugin(
|
|
6760
6771
|
new A({
|
|
6761
|
-
key:
|
|
6762
|
-
view: (r) => (this.view = new
|
|
6772
|
+
key: Ea,
|
|
6773
|
+
view: (r) => (this.view = new Sa(
|
|
6763
6774
|
t,
|
|
6764
6775
|
o,
|
|
6765
6776
|
r,
|
|
@@ -6777,19 +6788,19 @@ class Ba extends L {
|
|
|
6777
6788
|
return this.on("update", t);
|
|
6778
6789
|
}
|
|
6779
6790
|
}
|
|
6780
|
-
const
|
|
6791
|
+
const Ne = /* @__PURE__ */ new Map();
|
|
6781
6792
|
function xa(e) {
|
|
6782
|
-
if (
|
|
6783
|
-
return
|
|
6793
|
+
if (Ne.has(e))
|
|
6794
|
+
return Ne.get(e);
|
|
6784
6795
|
const n = new co();
|
|
6785
6796
|
return e._tiptapEditor.on("transaction", ({ transaction: t }) => {
|
|
6786
6797
|
n.appendMapping(t.mapping);
|
|
6787
6798
|
}), e._tiptapEditor.on("destroy", () => {
|
|
6788
|
-
|
|
6789
|
-
}),
|
|
6799
|
+
Ne.delete(e);
|
|
6800
|
+
}), Ne.set(e, n), n;
|
|
6790
6801
|
}
|
|
6791
|
-
function
|
|
6792
|
-
const o =
|
|
6802
|
+
function Ma(e, n, t = "left") {
|
|
6803
|
+
const o = de.getState(
|
|
6793
6804
|
e._tiptapEditor.state
|
|
6794
6805
|
);
|
|
6795
6806
|
if (!o) {
|
|
@@ -6803,7 +6814,7 @@ function Ta(e, n, t = "left") {
|
|
|
6803
6814
|
o.binding.mapping
|
|
6804
6815
|
);
|
|
6805
6816
|
return () => {
|
|
6806
|
-
const s =
|
|
6817
|
+
const s = de.getState(
|
|
6807
6818
|
e._tiptapEditor.state
|
|
6808
6819
|
), i = Ko(
|
|
6809
6820
|
s.doc,
|
|
@@ -6816,7 +6827,7 @@ function Ta(e, n, t = "left") {
|
|
|
6816
6827
|
return i + (t === "right" ? -1 : 0);
|
|
6817
6828
|
};
|
|
6818
6829
|
}
|
|
6819
|
-
const
|
|
6830
|
+
const Ta = ho((e) => e.type.name === "blockContainer");
|
|
6820
6831
|
class Pa {
|
|
6821
6832
|
constructor(n, t) {
|
|
6822
6833
|
p(this, "state");
|
|
@@ -6917,7 +6928,7 @@ class Ia extends L {
|
|
|
6917
6928
|
const c = r.getMeta(me);
|
|
6918
6929
|
if (typeof c == "object" && c !== null) {
|
|
6919
6930
|
s && this.closeMenu();
|
|
6920
|
-
const d =
|
|
6931
|
+
const d = Ma(
|
|
6921
6932
|
t,
|
|
6922
6933
|
a.selection.from - // Need to account for the trigger char that was inserted, so we offset the position by the length of the trigger character.
|
|
6923
6934
|
c.triggerCharacter.length
|
|
@@ -6967,7 +6978,7 @@ class Ia extends L {
|
|
|
6967
6978
|
if (s === void 0)
|
|
6968
6979
|
return null;
|
|
6969
6980
|
if (!s.deleteTriggerCharacter) {
|
|
6970
|
-
const i =
|
|
6981
|
+
const i = Ta(r.selection);
|
|
6971
6982
|
if (i)
|
|
6972
6983
|
return W.create(r.doc, [
|
|
6973
6984
|
J.node(
|
|
@@ -7161,7 +7172,7 @@ function rn(e) {
|
|
|
7161
7172
|
function Ha(e) {
|
|
7162
7173
|
R && (e instanceof Document ? e.body.removeChild(R) : e.removeChild(R), R = void 0);
|
|
7163
7174
|
}
|
|
7164
|
-
function
|
|
7175
|
+
function He(e) {
|
|
7165
7176
|
return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
|
|
7166
7177
|
}
|
|
7167
7178
|
function Da(e) {
|
|
@@ -7230,7 +7241,7 @@ class Ra {
|
|
|
7230
7241
|
);
|
|
7231
7242
|
if (!i)
|
|
7232
7243
|
throw new Error(`Block with ID ${r.id} not found`);
|
|
7233
|
-
const a =
|
|
7244
|
+
const a = S(
|
|
7234
7245
|
i.node,
|
|
7235
7246
|
this.editor.pmSchema,
|
|
7236
7247
|
this.editor.schema.blockSchema,
|
|
@@ -7257,7 +7268,7 @@ class Ra {
|
|
|
7257
7268
|
referencePosCell: w || (g = this.state) == null ? void 0 : g.referencePosCell
|
|
7258
7269
|
};
|
|
7259
7270
|
} else {
|
|
7260
|
-
const b =
|
|
7271
|
+
const b = He(t.domNode), k = He(t.domNode.parentElement), w = t.domNode.getBoundingClientRect();
|
|
7261
7272
|
if (this.state !== void 0 && this.state.show && this.tableId === r.id && this.state.rowIndex === k && this.state.colIndex === b)
|
|
7262
7273
|
return;
|
|
7263
7274
|
this.state = {
|
|
@@ -7299,7 +7310,7 @@ class Ra {
|
|
|
7299
7310
|
return;
|
|
7300
7311
|
const r = o[0];
|
|
7301
7312
|
let s = !1;
|
|
7302
|
-
const i =
|
|
7313
|
+
const i = He(r.parentElement), a = He(r), c = this.state.draggingState.draggedCellOrientation === "row" ? this.state.rowIndex : this.state.colIndex, d = (this.state.draggingState.draggedCellOrientation === "row" ? i : a) !== c;
|
|
7303
7314
|
(this.state.rowIndex !== i || this.state.colIndex !== a) && (this.state.rowIndex = i, this.state.colIndex = a, this.state.referencePosCell = r.getBoundingClientRect(), s = !0);
|
|
7304
7315
|
const u = this.state.draggingState.draggedCellOrientation === "row" ? t.top : t.left;
|
|
7305
7316
|
this.state.draggingState.mousePos !== u && (this.state.draggingState.mousePos = u, s = !0), s && this.emitUpdate(), d && this.editor.transact((f) => f.setMeta(ye, !0));
|
|
@@ -7314,7 +7325,7 @@ class Ra {
|
|
|
7314
7325
|
n.preventDefault();
|
|
7315
7326
|
const { draggingState: t, colIndex: o, rowIndex: r } = this.state, s = this.state.block.content.columnWidths;
|
|
7316
7327
|
if (t.draggedCellOrientation === "row") {
|
|
7317
|
-
if (!
|
|
7328
|
+
if (!Sn(
|
|
7318
7329
|
this.state.block,
|
|
7319
7330
|
t.originalIndex,
|
|
7320
7331
|
r
|
|
@@ -7333,7 +7344,7 @@ class Ra {
|
|
|
7333
7344
|
}
|
|
7334
7345
|
});
|
|
7335
7346
|
} else {
|
|
7336
|
-
if (!
|
|
7347
|
+
if (!En(
|
|
7337
7348
|
this.state.block,
|
|
7338
7349
|
t.originalIndex,
|
|
7339
7350
|
o
|
|
@@ -7378,7 +7389,7 @@ class Ra {
|
|
|
7378
7389
|
this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate();
|
|
7379
7390
|
return;
|
|
7380
7391
|
}
|
|
7381
|
-
const { height: n, width: t } =
|
|
7392
|
+
const { height: n, width: t } = St(
|
|
7382
7393
|
this.state.block
|
|
7383
7394
|
);
|
|
7384
7395
|
this.state.rowIndex !== void 0 && this.state.colIndex !== void 0 && (this.state.rowIndex >= n && (this.state.rowIndex = n - 1), this.state.colIndex >= t && (this.state.colIndex = t - 1));
|
|
@@ -7483,11 +7494,11 @@ class Va extends L {
|
|
|
7483
7494
|
p(this, "unfreezeHandles", () => {
|
|
7484
7495
|
this.view.menuFrozen = !1;
|
|
7485
7496
|
});
|
|
7486
|
-
p(this, "getCellsAtRowHandle", (t, o) =>
|
|
7497
|
+
p(this, "getCellsAtRowHandle", (t, o) => ct(t, o));
|
|
7487
7498
|
/**
|
|
7488
7499
|
* Get all the cells in a column of the table block.
|
|
7489
7500
|
*/
|
|
7490
|
-
p(this, "getCellsAtColumnHandle", (t, o) =>
|
|
7501
|
+
p(this, "getCellsAtColumnHandle", (t, o) => lt(t, o));
|
|
7491
7502
|
/**
|
|
7492
7503
|
* Sets the selection to the given cell or a range of cells.
|
|
7493
7504
|
* @returns The new state after the selection has been set.
|
|
@@ -7508,7 +7519,7 @@ class Va extends L {
|
|
|
7508
7519
|
l.posAtIndex(r.col)
|
|
7509
7520
|
), u = t.tr;
|
|
7510
7521
|
return u.setSelection(
|
|
7511
|
-
new
|
|
7522
|
+
new Ee(c, d)
|
|
7512
7523
|
), t.apply(u);
|
|
7513
7524
|
});
|
|
7514
7525
|
/**
|
|
@@ -7626,10 +7637,10 @@ class Va extends L {
|
|
|
7626
7637
|
if (r === void 0)
|
|
7627
7638
|
return;
|
|
7628
7639
|
const s = [], { block: i, draggingState: a } = this.view.state, { originalIndex: c, draggedCellOrientation: l } = a;
|
|
7629
|
-
if (r === c || !i || l === "row" && !
|
|
7640
|
+
if (r === c || !i || l === "row" && !Sn(i, c, r) || l === "col" && !En(i, c, r))
|
|
7630
7641
|
return W.create(o.doc, s);
|
|
7631
7642
|
const d = o.doc.resolve(this.view.tablePos + 1);
|
|
7632
|
-
return this.view.state.draggingState.draggedCellOrientation === "row" ?
|
|
7643
|
+
return this.view.state.draggingState.draggedCellOrientation === "row" ? ct(
|
|
7633
7644
|
this.view.state.block,
|
|
7634
7645
|
r
|
|
7635
7646
|
).forEach(({ row: h, col: f }) => {
|
|
@@ -7645,7 +7656,7 @@ class Va extends L {
|
|
|
7645
7656
|
return w.className = "bn-table-drop-cursor", w.style.left = "0", w.style.right = "0", r > c ? w.style.bottom = "-2px" : w.style.top = "-3px", w.style.height = "4px", w;
|
|
7646
7657
|
})
|
|
7647
7658
|
);
|
|
7648
|
-
}) :
|
|
7659
|
+
}) : lt(
|
|
7649
7660
|
this.view.state.block,
|
|
7650
7661
|
r
|
|
7651
7662
|
).forEach(({ row: h, col: f }) => {
|
|
@@ -7710,9 +7721,9 @@ const Ua = V.create({
|
|
|
7710
7721
|
types: ["blockContainer", "tableCell", "tableHeader"],
|
|
7711
7722
|
attributes: {
|
|
7712
7723
|
textColor: {
|
|
7713
|
-
default:
|
|
7714
|
-
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") :
|
|
7715
|
-
renderHTML: (e) => e.textColor ===
|
|
7724
|
+
default: M.textColor.default,
|
|
7725
|
+
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : M.textColor.default,
|
|
7726
|
+
renderHTML: (e) => e.textColor === M.textColor.default ? {} : {
|
|
7716
7727
|
"data-text-color": e.textColor
|
|
7717
7728
|
}
|
|
7718
7729
|
}
|
|
@@ -7875,7 +7886,7 @@ class Ga extends L {
|
|
|
7875
7886
|
throw new Error("type does not exist in other ydoc");
|
|
7876
7887
|
return o.get(s, t.constructor);
|
|
7877
7888
|
} else {
|
|
7878
|
-
const s = t._item, i = o.store.clients.get(s.id.client) ?? [], a =
|
|
7889
|
+
const s = t._item, i = o.store.clients.get(s.id.client) ?? [], a = ie.findIndexSS(i, s.id.clock);
|
|
7879
7890
|
return i[a].content.type;
|
|
7880
7891
|
}
|
|
7881
7892
|
}
|
|
@@ -7897,19 +7908,22 @@ class Ga extends L {
|
|
|
7897
7908
|
const t = this.collaboration.fragment;
|
|
7898
7909
|
if (!t)
|
|
7899
7910
|
throw new Error("No fragment to fork from");
|
|
7900
|
-
const o = new
|
|
7901
|
-
|
|
7911
|
+
const o = new ie.Doc();
|
|
7912
|
+
ie.applyUpdate(o, ie.encodeStateAsUpdate(t.doc));
|
|
7902
7913
|
const r = this.findTypeInOtherYdoc(t, o);
|
|
7903
7914
|
this.forkedState = {
|
|
7915
|
+
undoStack: Ie.getState(this.editor.prosemirrorState).undoManager.undoStack,
|
|
7904
7916
|
originalFragment: t,
|
|
7905
7917
|
forkedFragment: r
|
|
7906
7918
|
}, this.editor._tiptapEditor.unregisterPlugin([
|
|
7907
7919
|
Jo,
|
|
7908
|
-
|
|
7909
|
-
|
|
7920
|
+
Ie,
|
|
7921
|
+
de
|
|
7910
7922
|
]), this.editor._tiptapEditor.registerPlugin(
|
|
7911
|
-
new
|
|
7912
|
-
), this.editor._tiptapEditor.registerPlugin(
|
|
7923
|
+
new ft(r).plugins[0]
|
|
7924
|
+
), this.editor._tiptapEditor.registerPlugin(
|
|
7925
|
+
new mt({ editor: this.editor }).plugins[0]
|
|
7926
|
+
), this.emit("forked", !0);
|
|
7913
7927
|
}
|
|
7914
7928
|
/**
|
|
7915
7929
|
* Resume syncing the Y.js document to the remote
|
|
@@ -7919,21 +7933,28 @@ class Ga extends L {
|
|
|
7919
7933
|
merge({ keepChanges: t }) {
|
|
7920
7934
|
if (!this.forkedState)
|
|
7921
7935
|
return;
|
|
7922
|
-
this.editor._tiptapEditor.unregisterPlugin(
|
|
7923
|
-
const { originalFragment: o, forkedFragment: r } = this.forkedState;
|
|
7924
|
-
if (
|
|
7925
|
-
const s = he.encodeStateAsUpdate(r.doc);
|
|
7926
|
-
he.applyUpdate(o.doc, s);
|
|
7927
|
-
}
|
|
7928
|
-
this.editor.extensions.ySyncPlugin = new ht(o), this.editor.extensions.yCursorPlugin = new Ue(
|
|
7936
|
+
this.editor._tiptapEditor.unregisterPlugin(de), this.editor._tiptapEditor.unregisterPlugin(Ie);
|
|
7937
|
+
const { originalFragment: o, forkedFragment: r, undoStack: s } = this.forkedState;
|
|
7938
|
+
if (this.editor.extensions.ySyncPlugin = new ft(o), this.editor.extensions.yCursorPlugin = new _e(
|
|
7929
7939
|
this.collaboration
|
|
7930
|
-
), this.editor.extensions.yUndoPlugin = new
|
|
7940
|
+
), this.editor.extensions.yUndoPlugin = new mt({
|
|
7941
|
+
editor: this.editor
|
|
7942
|
+
}), this.editor._tiptapEditor.registerPlugin(
|
|
7931
7943
|
this.editor.extensions.ySyncPlugin.plugins[0]
|
|
7932
7944
|
), this.editor._tiptapEditor.registerPlugin(
|
|
7933
7945
|
this.editor.extensions.yCursorPlugin.plugins[0]
|
|
7934
7946
|
), this.editor._tiptapEditor.registerPlugin(
|
|
7935
7947
|
this.editor.extensions.yUndoPlugin.plugins[0]
|
|
7936
|
-
),
|
|
7948
|
+
), Ie.getState(
|
|
7949
|
+
this.editor.prosemirrorState
|
|
7950
|
+
).undoManager.undoStack = s, t) {
|
|
7951
|
+
const i = ie.encodeStateAsUpdate(
|
|
7952
|
+
r.doc,
|
|
7953
|
+
ie.encodeStateVector(o.doc)
|
|
7954
|
+
);
|
|
7955
|
+
ie.applyUpdate(o.doc, i, this.editor);
|
|
7956
|
+
}
|
|
7957
|
+
this.forkedState = void 0, this.emit("forked", !1);
|
|
7937
7958
|
}
|
|
7938
7959
|
}
|
|
7939
7960
|
const qa = (e) => {
|
|
@@ -7941,7 +7962,7 @@ const qa = (e) => {
|
|
|
7941
7962
|
const n = {}, t = Ka(e);
|
|
7942
7963
|
for (const s of t)
|
|
7943
7964
|
n[s.name] = s;
|
|
7944
|
-
e.collaboration && (n.ySyncPlugin = new
|
|
7965
|
+
e.collaboration && (n.ySyncPlugin = new ft(e.collaboration.fragment), n.yUndoPlugin = new mt({ editor: e.editor }), (r = e.collaboration.provider) != null && r.awareness && (n.yCursorPlugin = new _e(e.collaboration)), n.forkYDocPlugin = new Ga({
|
|
7945
7966
|
editor: e.editor,
|
|
7946
7967
|
collaboration: e.collaboration
|
|
7947
7968
|
})), n.formattingToolbar = new oa(
|
|
@@ -7980,7 +8001,7 @@ const Ka = (e) => {
|
|
|
7980
8001
|
})
|
|
7981
8002
|
]
|
|
7982
8003
|
}),
|
|
7983
|
-
|
|
8004
|
+
je.configure({
|
|
7984
8005
|
// everything from bnBlock group (nodes that represent a BlockNote block should have an id)
|
|
7985
8006
|
types: ["blockContainer", "columnList", "column"],
|
|
7986
8007
|
setIdAttribute: e.setIdAttribute
|
|
@@ -8050,7 +8071,7 @@ const Ka = (e) => {
|
|
|
8050
8071
|
e.editor,
|
|
8051
8072
|
e.pasteHandler || ((t) => t.defaultPasteHandler())
|
|
8052
8073
|
),
|
|
8053
|
-
|
|
8074
|
+
Ti(e.editor),
|
|
8054
8075
|
// This needs to be at the bottom of this list, because Key events (such as enter, when selecting a /command),
|
|
8055
8076
|
// should be handled before Enter handlers in other components like splitListItem
|
|
8056
8077
|
...e.trailingBlock === void 0 || e.trailingBlock ? [$a] : [],
|
|
@@ -8115,7 +8136,7 @@ function Za(e, n) {
|
|
|
8115
8136
|
}
|
|
8116
8137
|
return !0;
|
|
8117
8138
|
}
|
|
8118
|
-
const
|
|
8139
|
+
const ze = class ze extends fo {
|
|
8119
8140
|
constructor(t, o) {
|
|
8120
8141
|
super({ ...t, content: void 0 });
|
|
8121
8142
|
p(this, "_state");
|
|
@@ -8139,7 +8160,7 @@ const Fe = class Fe extends fo {
|
|
|
8139
8160
|
let a;
|
|
8140
8161
|
try {
|
|
8141
8162
|
const c = t == null ? void 0 : t.content.map(
|
|
8142
|
-
(l) =>
|
|
8163
|
+
(l) => he(l, this.schema, o).toJSON()
|
|
8143
8164
|
);
|
|
8144
8165
|
a = mo(
|
|
8145
8166
|
{
|
|
@@ -8255,18 +8276,18 @@ const Fe = class Fe extends fo {
|
|
|
8255
8276
|
), this.emit("create", { editor: this }), this.isInitialized = !0;
|
|
8256
8277
|
}
|
|
8257
8278
|
};
|
|
8258
|
-
p(
|
|
8279
|
+
p(ze, "create", (t, o) => {
|
|
8259
8280
|
var s, i;
|
|
8260
8281
|
const r = (s = globalThis == null ? void 0 : globalThis.window) == null ? void 0 : s.setTimeout;
|
|
8261
8282
|
typeof ((i = globalThis == null ? void 0 : globalThis.window) == null ? void 0 : i.setTimeout) < "u" && (globalThis.window.setTimeout = () => 0);
|
|
8262
8283
|
try {
|
|
8263
|
-
return new
|
|
8284
|
+
return new ze(t, o);
|
|
8264
8285
|
} finally {
|
|
8265
8286
|
r && (globalThis.window.setTimeout = r);
|
|
8266
8287
|
}
|
|
8267
8288
|
});
|
|
8268
|
-
let
|
|
8269
|
-
|
|
8289
|
+
let $e = ze;
|
|
8290
|
+
$e.prototype.createView = function() {
|
|
8270
8291
|
this.options.onPaste = this.options.onDrop = void 0;
|
|
8271
8292
|
};
|
|
8272
8293
|
const Qa = {
|
|
@@ -8274,9 +8295,9 @@ const Qa = {
|
|
|
8274
8295
|
enablePasteRules: !0,
|
|
8275
8296
|
enableCoreExtensions: !1
|
|
8276
8297
|
};
|
|
8277
|
-
class ro extends
|
|
8298
|
+
class ro extends Lt {
|
|
8278
8299
|
constructor(t) {
|
|
8279
|
-
var l, d, u, h, f, m, g, b, k, w, C, B, P, $,
|
|
8300
|
+
var l, d, u, h, f, m, g, b, k, w, C, B, P, $, E;
|
|
8280
8301
|
super();
|
|
8281
8302
|
/**
|
|
8282
8303
|
* The underlying prosemirror schema
|
|
@@ -8483,7 +8504,7 @@ class ro extends It {
|
|
|
8483
8504
|
] : [
|
|
8484
8505
|
{
|
|
8485
8506
|
type: "paragraph",
|
|
8486
|
-
id:
|
|
8507
|
+
id: je.options.generateID()
|
|
8487
8508
|
}
|
|
8488
8509
|
]);
|
|
8489
8510
|
if (!Array.isArray(i) || i.length === 0)
|
|
@@ -8518,13 +8539,13 @@ class ro extends It {
|
|
|
8518
8539
|
class: Q(
|
|
8519
8540
|
"bn-editor",
|
|
8520
8541
|
r.defaultStyles ? "bn-default-styles" : "",
|
|
8521
|
-
((
|
|
8542
|
+
((E = ($ = r.domAttributes) == null ? void 0 : $.editor) == null ? void 0 : E.class) || ""
|
|
8522
8543
|
)
|
|
8523
8544
|
},
|
|
8524
8545
|
transformPasted: Ya
|
|
8525
8546
|
}
|
|
8526
8547
|
};
|
|
8527
|
-
this.headless ? this.pmSchema = go(c.extensions) : (this._tiptapEditor =
|
|
8548
|
+
this.headless ? this.pmSchema = go(c.extensions) : (this._tiptapEditor = $e.create(
|
|
8528
8549
|
c,
|
|
8529
8550
|
this.schema.styleSchema
|
|
8530
8551
|
), this.pmSchema = this._tiptapEditor.schema), this.pmSchema.cached.blockNoteEditor = this, this.emit("create");
|
|
@@ -8845,7 +8866,7 @@ class ro extends It {
|
|
|
8845
8866
|
* @param update A partial block which defines how the existing block should be changed.
|
|
8846
8867
|
*/
|
|
8847
8868
|
updateBlock(t, o) {
|
|
8848
|
-
return this.transact((r) =>
|
|
8869
|
+
return this.transact((r) => Tr(r, t, o));
|
|
8849
8870
|
}
|
|
8850
8871
|
/**
|
|
8851
8872
|
* Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
|
|
@@ -9040,7 +9061,7 @@ class ro extends It {
|
|
|
9040
9061
|
* @returns The blocks, serialized as an HTML string.
|
|
9041
9062
|
*/
|
|
9042
9063
|
async blocksToHTMLLossy(t = this.document) {
|
|
9043
|
-
return
|
|
9064
|
+
return Je(this.pmSchema, this).exportBlocks(t, {});
|
|
9044
9065
|
}
|
|
9045
9066
|
/**
|
|
9046
9067
|
* Serializes blocks into an HTML string in the format that would normally be rendered by the editor.
|
|
@@ -9124,7 +9145,7 @@ class ro extends It {
|
|
|
9124
9145
|
if (this.headless)
|
|
9125
9146
|
return;
|
|
9126
9147
|
const r = (s) => {
|
|
9127
|
-
s.transaction.getMeta(
|
|
9148
|
+
s.transaction.getMeta(de) && !o || t(this);
|
|
9128
9149
|
};
|
|
9129
9150
|
return this._tiptapEditor.on("selectionUpdate", r), () => {
|
|
9130
9151
|
this._tiptapEditor.off("selectionUpdate", r);
|
|
@@ -9144,12 +9165,12 @@ class ro extends It {
|
|
|
9144
9165
|
if (!this.prosemirrorView)
|
|
9145
9166
|
return;
|
|
9146
9167
|
const { selection: t } = this.prosemirrorState, { ranges: o } = t, r = Math.min(...o.map((i) => i.$from.pos)), s = Math.max(...o.map((i) => i.$to.pos));
|
|
9147
|
-
if (
|
|
9168
|
+
if (rt(t)) {
|
|
9148
9169
|
const i = this.prosemirrorView.nodeDOM(r);
|
|
9149
9170
|
if (i)
|
|
9150
9171
|
return i.getBoundingClientRect();
|
|
9151
9172
|
}
|
|
9152
|
-
return
|
|
9173
|
+
return Ve(this.prosemirrorView, r, s);
|
|
9153
9174
|
}
|
|
9154
9175
|
get isEmpty() {
|
|
9155
9176
|
const t = this.document;
|
|
@@ -9321,9 +9342,9 @@ function qc(e) {
|
|
|
9321
9342
|
createStyleMapping: (n) => n
|
|
9322
9343
|
};
|
|
9323
9344
|
}
|
|
9324
|
-
let
|
|
9345
|
+
let De;
|
|
9325
9346
|
async function ec() {
|
|
9326
|
-
return
|
|
9347
|
+
return De || (De = (async () => {
|
|
9327
9348
|
const [e, n] = await Promise.all([
|
|
9328
9349
|
import("emoji-mart"),
|
|
9329
9350
|
// use a dynamic import to encourage bundle-splitting
|
|
@@ -9331,7 +9352,7 @@ async function ec() {
|
|
|
9331
9352
|
import("@emoji-mart/data")
|
|
9332
9353
|
]), t = "default" in e ? e.default : e, o = "default" in n ? n.default : n;
|
|
9333
9354
|
return await t.init({ data: o }), { emojiMart: t, emojiData: o };
|
|
9334
|
-
})(),
|
|
9355
|
+
})(), De);
|
|
9335
9356
|
}
|
|
9336
9357
|
async function Kc(e, n) {
|
|
9337
9358
|
if (!zs("text", e))
|
|
@@ -9364,7 +9385,7 @@ export {
|
|
|
9364
9385
|
pa as DEFAULT_LINK_PROTOCOL,
|
|
9365
9386
|
Ac as EMPTY_CELL_HEIGHT,
|
|
9366
9387
|
Rn as EMPTY_CELL_WIDTH,
|
|
9367
|
-
|
|
9388
|
+
Lt as EventEmitter,
|
|
9368
9389
|
Gc as Exporter,
|
|
9369
9390
|
Rr as FILE_AUDIO_ICON_SVG,
|
|
9370
9391
|
Dr as FILE_ICON_SVG,
|
|
@@ -9380,11 +9401,11 @@ export {
|
|
|
9380
9401
|
da as LinkToolbarProsemirrorPlugin,
|
|
9381
9402
|
Ys as PageBreak,
|
|
9382
9403
|
Ba as SideMenuProsemirrorPlugin,
|
|
9383
|
-
|
|
9404
|
+
Sa as SideMenuView,
|
|
9384
9405
|
Ia as SuggestionMenuProseMirrorPlugin,
|
|
9385
9406
|
Va as TableHandlesProsemirrorPlugin,
|
|
9386
9407
|
Ra as TableHandlesView,
|
|
9387
|
-
|
|
9408
|
+
je as UniqueID,
|
|
9388
9409
|
j as UnreachableCaseError,
|
|
9389
9410
|
ua as VALID_LINK_PROTOCOLS,
|
|
9390
9411
|
_s as VideoBlock,
|
|
@@ -9398,9 +9419,9 @@ export {
|
|
|
9398
9419
|
Vr as audioPropSchema,
|
|
9399
9420
|
_r as audioRender,
|
|
9400
9421
|
Fr as audioToExternalHTML,
|
|
9401
|
-
|
|
9422
|
+
he as blockToNode,
|
|
9402
9423
|
ki as blocksToMarkdown,
|
|
9403
|
-
|
|
9424
|
+
Ue as camelToDataKebab,
|
|
9404
9425
|
Rc as checkBlockHasDefaultProp,
|
|
9405
9426
|
Ws as checkBlockIsDefaultType,
|
|
9406
9427
|
Hc as checkBlockIsFileBlock,
|
|
@@ -9410,16 +9431,16 @@ export {
|
|
|
9410
9431
|
O as checkDefaultBlockTypeInSchema,
|
|
9411
9432
|
zs as checkDefaultInlineContentTypeInSchema,
|
|
9412
9433
|
Zs as checkPageBreakBlocksInSchema,
|
|
9413
|
-
|
|
9434
|
+
Pt as cleanHTMLToMarkdown,
|
|
9414
9435
|
Jc as combineByGroup,
|
|
9415
|
-
|
|
9436
|
+
qe as contentNodeToInlineContent,
|
|
9416
9437
|
kn as contentNodeToTableContent,
|
|
9417
9438
|
Hr as createAddFileButton,
|
|
9418
9439
|
xe as createBlockSpec,
|
|
9419
9440
|
oe as createBlockSpecFromStronglyTypedTiptapNode,
|
|
9420
9441
|
G as createDefaultBlockDOMOutputSpec,
|
|
9421
|
-
|
|
9422
|
-
|
|
9442
|
+
Je as createExternalHTMLExporter,
|
|
9443
|
+
Bt as createFigureWithCaption,
|
|
9423
9444
|
Et as createFileBlockWrapper,
|
|
9424
9445
|
Or as createFileNameWithIcon,
|
|
9425
9446
|
Ic as createInlineContentSpec,
|
|
@@ -9428,11 +9449,11 @@ export {
|
|
|
9428
9449
|
Nr as createInternalHTMLSerializer,
|
|
9429
9450
|
pr as createInternalInlineContentSpec,
|
|
9430
9451
|
yn as createInternalStyleSpec,
|
|
9431
|
-
|
|
9452
|
+
Ye as createLinkWithCaption,
|
|
9432
9453
|
Nn as createResizableFileBlockWrapper,
|
|
9433
9454
|
q as createStronglyTypedTiptapNode,
|
|
9434
9455
|
Lc as createStyleSpec,
|
|
9435
|
-
|
|
9456
|
+
ae as createStyleSpecFromTipTapMark,
|
|
9436
9457
|
zc as createSuggestionMenu,
|
|
9437
9458
|
$s as defaultBlockSchema,
|
|
9438
9459
|
Vn as defaultBlockSpecs,
|
|
@@ -9440,7 +9461,7 @@ export {
|
|
|
9440
9461
|
Wr as defaultCodeBlockPropSchema,
|
|
9441
9462
|
Fs as defaultInlineContentSchema,
|
|
9442
9463
|
_n as defaultInlineContentSpecs,
|
|
9443
|
-
|
|
9464
|
+
M as defaultProps,
|
|
9444
9465
|
Nc as defaultStyleSchema,
|
|
9445
9466
|
Un as defaultStyleSpecs,
|
|
9446
9467
|
lr as docToBlocks,
|
|
@@ -9455,23 +9476,23 @@ export {
|
|
|
9455
9476
|
Z as formatKeyboardShortcut,
|
|
9456
9477
|
na as formattingToolbarPluginKey,
|
|
9457
9478
|
ai as getBlock,
|
|
9458
|
-
|
|
9479
|
+
vt as getBlockCache,
|
|
9459
9480
|
ir as getBlockFromPos,
|
|
9460
9481
|
ee as getBlockInfo,
|
|
9461
|
-
|
|
9482
|
+
Me as getBlockInfoFromResolvedPos,
|
|
9462
9483
|
v as getBlockInfoFromSelection,
|
|
9463
|
-
|
|
9464
|
-
|
|
9484
|
+
Ge as getBlockInfoFromTransaction,
|
|
9485
|
+
wt as getBlockInfoWithManualOffset,
|
|
9465
9486
|
qa as getBlockNoteExtensions,
|
|
9466
|
-
|
|
9467
|
-
|
|
9487
|
+
Te as getBlockNoteSchema,
|
|
9488
|
+
yt as getBlockSchema,
|
|
9468
9489
|
gn as getBlockSchemaFromSpecs,
|
|
9469
9490
|
Br as getBlocksChangedByTransaction,
|
|
9470
9491
|
ve as getColspan,
|
|
9471
9492
|
Kc as getDefaultEmojiPickerItems,
|
|
9472
9493
|
Uc as getDefaultSlashMenuItems,
|
|
9473
9494
|
fr as getInlineContentParseRules,
|
|
9474
|
-
|
|
9495
|
+
Ct as getInlineContentSchema,
|
|
9475
9496
|
wn as getInlineContentSchemaFromSpecs,
|
|
9476
9497
|
X as getNearestBlockPos,
|
|
9477
9498
|
li as getNextBlock,
|
|
@@ -9479,9 +9500,9 @@ export {
|
|
|
9479
9500
|
Fc as getPageBreakSlashMenuItems,
|
|
9480
9501
|
di as getParentBlock,
|
|
9481
9502
|
cr as getParseRules,
|
|
9482
|
-
|
|
9503
|
+
T as getPmSchema,
|
|
9483
9504
|
ci as getPrevBlock,
|
|
9484
|
-
|
|
9505
|
+
it as getRowspan,
|
|
9485
9506
|
br as getStyleParseRules,
|
|
9486
9507
|
be as getStyleSchema,
|
|
9487
9508
|
Cn as getStyleSchemaFromSpecs,
|
|
@@ -9497,41 +9518,41 @@ export {
|
|
|
9497
9518
|
N as insertOrUpdateBlock,
|
|
9498
9519
|
sr as isAppleOS,
|
|
9499
9520
|
Ot as isLinkInlineContent,
|
|
9500
|
-
|
|
9521
|
+
pt as isNodeBlock,
|
|
9501
9522
|
hn as isPartialLinkInlineContent,
|
|
9502
9523
|
Ce as isPartialTableCell,
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9524
|
+
Mc as isSafari,
|
|
9525
|
+
ue as isStyledTextInlineContent,
|
|
9526
|
+
kt as isTableCell,
|
|
9506
9527
|
Kt as isTableCellSelection,
|
|
9507
9528
|
la as linkToolbarPluginKey,
|
|
9508
|
-
|
|
9529
|
+
st as mapTableCell,
|
|
9509
9530
|
qc as mappingFactory,
|
|
9510
9531
|
Bi as markdownToBlocks,
|
|
9511
9532
|
Xn as markdownToHTML,
|
|
9512
9533
|
Q as mergeCSSClasses,
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
9534
|
+
Tc as mergeParagraphs,
|
|
9535
|
+
S as nodeToBlock,
|
|
9536
|
+
at as nodeToCustomInlineContent,
|
|
9516
9537
|
qs as pageBreakConfig,
|
|
9517
9538
|
Js as pageBreakParse,
|
|
9518
9539
|
Ks as pageBreakRender,
|
|
9519
9540
|
$n as pageBreakSchema,
|
|
9520
9541
|
Xs as pageBreakToExternalHTML,
|
|
9521
9542
|
Wt as parseEmbedElement,
|
|
9522
|
-
|
|
9543
|
+
Xe as parseFigureElement,
|
|
9523
9544
|
Be as propsToAttributes,
|
|
9524
9545
|
dr as prosemirrorSliceToSlicedBlocks,
|
|
9525
9546
|
_t as removeAndInsertBlocks,
|
|
9526
9547
|
Qn as selectedFragmentToHTML,
|
|
9527
|
-
|
|
9548
|
+
Ze as shikiHighlighterPromiseSymbol,
|
|
9528
9549
|
zt as shikiParserSymbol,
|
|
9529
|
-
|
|
9550
|
+
Ea as sideMenuPluginKey,
|
|
9530
9551
|
mr as stylePropsToAttributes,
|
|
9531
|
-
|
|
9552
|
+
Ke as tableContentToNodes,
|
|
9532
9553
|
ye as tableHandlesPluginKey,
|
|
9533
|
-
|
|
9534
|
-
|
|
9554
|
+
Ma as trackPosition,
|
|
9555
|
+
Tr as updateBlock,
|
|
9535
9556
|
I as updateBlockCommand,
|
|
9536
9557
|
xn as updateBlockTr,
|
|
9537
9558
|
Vc as uploadToTmpFilesDotOrg_DEV_ONLY,
|
|
@@ -9541,6 +9562,6 @@ export {
|
|
|
9541
9562
|
Rs as videoRender,
|
|
9542
9563
|
Us as videoToExternalHTML,
|
|
9543
9564
|
$c as withPageBreak,
|
|
9544
|
-
|
|
9565
|
+
Le as wrapInBlockStructure
|
|
9545
9566
|
};
|
|
9546
9567
|
//# sourceMappingURL=blocknote.js.map
|