@blocknote/core 0.11.1 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocknote.js +160 -154
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +5 -5
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +3 -3
- package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +13 -0
- package/src/editor/BlockNoteEditor.ts +7 -7
- package/src/pm-nodes/BlockContainer.ts +0 -4
- package/types/src/editor/BlockNoteEditor.d.ts +2 -2
package/dist/blocknote.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var pe = Object.defineProperty;
|
|
2
2
|
var he = (n, t, e) => t in n ? pe(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
3
|
var u = (n, t, e) => (he(n, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
-
import { Slice as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import { Slice as R, Fragment as H, DOMSerializer as ht, DOMParser as me, Node as fe } from "prosemirror-model";
|
|
5
|
+
import _t from "rehype-parse";
|
|
6
|
+
import Rt from "rehype-stringify";
|
|
7
7
|
import { unified as mt } from "unified";
|
|
8
|
-
import { Extension as N, combineTransactionSteps as ge, getChangedRanges as be, findChildrenInRange as ke, Node as j, Mark as ft, InputRule as gt, callOrReturn as ye, getExtensionField as we, mergeAttributes as ve, isNodeSelection as Se, posToDOMRect as dt, getMarkRange as
|
|
8
|
+
import { Extension as N, combineTransactionSteps as ge, getChangedRanges as be, findChildrenInRange as ke, Node as j, Mark as ft, InputRule as gt, callOrReturn as ye, getExtensionField as we, mergeAttributes as ve, isNodeSelection as Se, posToDOMRect as dt, getMarkRange as Tt, findParentNode as Ee, findChildren as Mt, extensions as X, Editor as Ce } from "@tiptap/core";
|
|
9
9
|
import { Plugin as x, PluginKey as L, Selection as at, NodeSelection as rt, TextSelection as nt } from "prosemirror-state";
|
|
10
10
|
import { v4 as Te } from "uuid";
|
|
11
|
-
import { fromDom as
|
|
11
|
+
import { fromDom as xt } from "hast-util-from-dom";
|
|
12
12
|
import Me from "@tiptap/extension-bold";
|
|
13
13
|
import xe from "@tiptap/extension-code";
|
|
14
14
|
import Be from "@tiptap/extension-italic";
|
|
@@ -19,7 +19,7 @@ import { TableHeader as Ne } from "@tiptap/extension-table-header";
|
|
|
19
19
|
import { TableRow as Ae } from "@tiptap/extension-table-row";
|
|
20
20
|
import { columnResizing as Pe, tableEditing as De } from "prosemirror-tables";
|
|
21
21
|
import Oe from "rehype-remark";
|
|
22
|
-
import
|
|
22
|
+
import zt from "remark-gfm";
|
|
23
23
|
import _e from "remark-stringify";
|
|
24
24
|
import Re from "remark-parse";
|
|
25
25
|
import ze, { defaultHandlers as Ve } from "remark-rehype";
|
|
@@ -136,12 +136,12 @@ const Q = N.create({
|
|
|
136
136
|
let v;
|
|
137
137
|
const C = (v = a.doc.nodeAt(g)) === null || v === void 0 ? void 0 : v.attrs[c];
|
|
138
138
|
if (C === null) {
|
|
139
|
-
const
|
|
140
|
-
if (o.doc.content.findDiffStart(
|
|
141
|
-
const
|
|
139
|
+
const V = o.doc.type.createAndFill().content;
|
|
140
|
+
if (o.doc.content.findDiffStart(V) === null) {
|
|
141
|
+
const F = JSON.parse(
|
|
142
142
|
JSON.stringify(r.doc.toJSON())
|
|
143
143
|
);
|
|
144
|
-
if (
|
|
144
|
+
if (F.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(F.content) === JSON.stringify(V.toJSON())) {
|
|
145
145
|
a.setNodeMarkup(g, void 0, {
|
|
146
146
|
...k.attrs,
|
|
147
147
|
[c]: "initialBlockId"
|
|
@@ -216,7 +216,7 @@ const Q = N.create({
|
|
|
216
216
|
a.push(c);
|
|
217
217
|
}), H.from(a);
|
|
218
218
|
};
|
|
219
|
-
return t = !1, new
|
|
219
|
+
return t = !1, new R(
|
|
220
220
|
i(e.content),
|
|
221
221
|
e.openStart,
|
|
222
222
|
e.openEnd
|
|
@@ -227,7 +227,7 @@ const Q = N.create({
|
|
|
227
227
|
];
|
|
228
228
|
}
|
|
229
229
|
});
|
|
230
|
-
function
|
|
230
|
+
function Vt(n) {
|
|
231
231
|
const t = n.attrs.id, e = n.firstChild, o = e.type, r = n.childCount === 2 ? n.lastChild.childCount : 0;
|
|
232
232
|
return {
|
|
233
233
|
id: t,
|
|
@@ -257,7 +257,7 @@ function w(n, t) {
|
|
|
257
257
|
break;
|
|
258
258
|
a -= 1, s = r.node(a);
|
|
259
259
|
}
|
|
260
|
-
const { id: l, contentNode: c, contentType: d, numChildBlocks: p } =
|
|
260
|
+
const { id: l, contentNode: c, contentType: d, numChildBlocks: p } = Vt(s), m = r.start(a), h = r.end(a);
|
|
261
261
|
return {
|
|
262
262
|
id: l,
|
|
263
263
|
node: s,
|
|
@@ -269,10 +269,10 @@ function w(n, t) {
|
|
|
269
269
|
depth: a
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function Bt(n) {
|
|
273
273
|
return n.type === "link";
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function Ft(n) {
|
|
276
276
|
return typeof n != "string" && n.type === "link";
|
|
277
277
|
}
|
|
278
278
|
function Z(n) {
|
|
@@ -283,7 +283,7 @@ class A extends Error {
|
|
|
283
283
|
super(`Unreachable case: ${t}`);
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function It(n, t, e) {
|
|
287
287
|
const o = [];
|
|
288
288
|
for (const [r, i] of Object.entries(n.styles)) {
|
|
289
289
|
const s = e[r];
|
|
@@ -317,25 +317,25 @@ function ut(n, t, e) {
|
|
|
317
317
|
const o = [];
|
|
318
318
|
if (typeof n == "string")
|
|
319
319
|
return o.push(
|
|
320
|
-
...
|
|
320
|
+
...It(
|
|
321
321
|
{ type: "text", text: n, styles: {} },
|
|
322
322
|
t,
|
|
323
323
|
e
|
|
324
324
|
)
|
|
325
325
|
), o;
|
|
326
326
|
for (const r of n)
|
|
327
|
-
o.push(...
|
|
327
|
+
o.push(...It(r, t, e));
|
|
328
328
|
return o;
|
|
329
329
|
}
|
|
330
330
|
function bt(n, t, e) {
|
|
331
331
|
const o = [];
|
|
332
332
|
for (const r of n)
|
|
333
|
-
typeof r == "string" ? o.push(...ut(r, t, e)) :
|
|
334
|
-
|
|
333
|
+
typeof r == "string" ? o.push(...ut(r, t, e)) : Ft(r) ? o.push(...Ye(r, t, e)) : Z(r) ? o.push(...ut([r], t, e)) : o.push(
|
|
334
|
+
$t(r, t, e)
|
|
335
335
|
);
|
|
336
336
|
return o;
|
|
337
337
|
}
|
|
338
|
-
function
|
|
338
|
+
function Ut(n, t, e) {
|
|
339
339
|
const o = [];
|
|
340
340
|
for (const r of n.rows) {
|
|
341
341
|
const i = [];
|
|
@@ -357,7 +357,7 @@ function Ft(n, t, e) {
|
|
|
357
357
|
}
|
|
358
358
|
return o;
|
|
359
359
|
}
|
|
360
|
-
function
|
|
360
|
+
function $t(n, t, e) {
|
|
361
361
|
let o, r = n.type;
|
|
362
362
|
if (r === void 0 && (r = "paragraph"), !t.nodes[r])
|
|
363
363
|
throw new Error(`node type ${r} not found in schema`);
|
|
@@ -372,7 +372,7 @@ function Ut(n, t, e) {
|
|
|
372
372
|
const i = bt(n.content, t, e);
|
|
373
373
|
o = t.nodes[r].create(n.props, i);
|
|
374
374
|
} else if (n.content.type === "tableContent") {
|
|
375
|
-
const i =
|
|
375
|
+
const i = Ut(n.content, t, e);
|
|
376
376
|
o = t.nodes[r].create(n.props, i);
|
|
377
377
|
} else
|
|
378
378
|
throw new A(n.content.type);
|
|
@@ -381,7 +381,7 @@ function Ut(n, t, e) {
|
|
|
381
381
|
function O(n, t, e) {
|
|
382
382
|
let o = n.id;
|
|
383
383
|
o === void 0 && (o = Q.options.generateID());
|
|
384
|
-
const r =
|
|
384
|
+
const r = $t(
|
|
385
385
|
n,
|
|
386
386
|
t,
|
|
387
387
|
e
|
|
@@ -427,7 +427,7 @@ function kt(n, t, e) {
|
|
|
427
427
|
if (Z(r))
|
|
428
428
|
r.text += `
|
|
429
429
|
`;
|
|
430
|
-
else if (
|
|
430
|
+
else if (Bt(r))
|
|
431
431
|
r.content[r.content.length - 1].text += `
|
|
432
432
|
`;
|
|
433
433
|
else
|
|
@@ -443,7 +443,7 @@ function kt(n, t, e) {
|
|
|
443
443
|
}
|
|
444
444
|
if (i.type.name !== "link" && i.type.name !== "text" && t[i.type.name]) {
|
|
445
445
|
r && (o.push(r), r = void 0), o.push(
|
|
446
|
-
|
|
446
|
+
Gt(i, t, e)
|
|
447
447
|
);
|
|
448
448
|
return;
|
|
449
449
|
}
|
|
@@ -477,7 +477,7 @@ function kt(n, t, e) {
|
|
|
477
477
|
type: "text",
|
|
478
478
|
text: i.textContent,
|
|
479
479
|
styles: s
|
|
480
|
-
}) :
|
|
480
|
+
}) : Bt(r) && (a ? r.href === a.attrs.href ? JSON.stringify(
|
|
481
481
|
r.content[r.content.length - 1].styles
|
|
482
482
|
) === JSON.stringify(s) ? r.content[r.content.length - 1].text += i.textContent : r.content.push({
|
|
483
483
|
type: "text",
|
|
@@ -514,7 +514,7 @@ function kt(n, t, e) {
|
|
|
514
514
|
};
|
|
515
515
|
}), r && o.push(r), o;
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function Gt(n, t, e) {
|
|
518
518
|
if (n.type.name === "text" || n.type.name === "link")
|
|
519
519
|
throw new Error("unexpected");
|
|
520
520
|
const o = {}, r = t[n.type.name];
|
|
@@ -543,7 +543,7 @@ function M(n, t, e, o, r) {
|
|
|
543
543
|
const i = r == null ? void 0 : r.get(n);
|
|
544
544
|
if (i)
|
|
545
545
|
return i;
|
|
546
|
-
const s =
|
|
546
|
+
const s = Vt(n);
|
|
547
547
|
let a = s.id;
|
|
548
548
|
a === null && (a = Q.options.generateID());
|
|
549
549
|
const l = {};
|
|
@@ -599,7 +599,7 @@ function M(n, t, e, o, r) {
|
|
|
599
599
|
function Qe(n) {
|
|
600
600
|
return n.document || window.document;
|
|
601
601
|
}
|
|
602
|
-
const
|
|
602
|
+
const jt = (n, t, e, o, r) => {
|
|
603
603
|
if (!e.nodes[n.type.name])
|
|
604
604
|
throw new Error("Serializer is missing a node type: " + n.type.name);
|
|
605
605
|
const { dom: i, contentDOM: s } = ht.renderSpec(
|
|
@@ -642,7 +642,7 @@ const Gt = (n, t, e, o, r) => {
|
|
|
642
642
|
e.serializeFragment(n.content, t, s);
|
|
643
643
|
}
|
|
644
644
|
return i;
|
|
645
|
-
},
|
|
645
|
+
}, Wt = (n, t) => {
|
|
646
646
|
const e = t.serializeFragment(n), o = document.createElement("div");
|
|
647
647
|
return o.appendChild(e), o.innerHTML;
|
|
648
648
|
};
|
|
@@ -673,10 +673,10 @@ function tn(n) {
|
|
|
673
673
|
a -= f, r -= f, i = void 0;
|
|
674
674
|
}
|
|
675
675
|
if (m) {
|
|
676
|
-
i || (i =
|
|
676
|
+
i || (i = xt(
|
|
677
677
|
document.createElement(h)
|
|
678
678
|
));
|
|
679
|
-
const f =
|
|
679
|
+
const f = xt(
|
|
680
680
|
document.createElement("li")
|
|
681
681
|
);
|
|
682
682
|
f.children.push(d.children[0]), p !== null && f.children.push(...p.children), i.children.push(f);
|
|
@@ -697,18 +697,18 @@ function tn(n) {
|
|
|
697
697
|
}
|
|
698
698
|
const st = (n, t) => {
|
|
699
699
|
const e = ht.fromSchema(n);
|
|
700
|
-
return e.serializeNodeInner = (o, r) =>
|
|
700
|
+
return e.serializeNodeInner = (o, r) => jt(o, r, e, t, !0), e.exportProseMirrorFragment = (o) => mt().use(_t, { fragment: !0 }).use(tn, {
|
|
701
701
|
orderedListItemBlockTypes: /* @__PURE__ */ new Set(["numberedListItem"]),
|
|
702
702
|
unorderedListItemBlockTypes: /* @__PURE__ */ new Set(["bulletListItem"])
|
|
703
|
-
}).use(
|
|
703
|
+
}).use(Rt).processSync(Wt(o, e)).value, e.exportBlocks = (o) => {
|
|
704
704
|
const r = o.map(
|
|
705
705
|
(s) => O(s, n, t.styleSchema)
|
|
706
706
|
), i = n.nodes.blockGroup.create(null, r);
|
|
707
707
|
return e.exportProseMirrorFragment(H.from(i));
|
|
708
708
|
}, e;
|
|
709
|
-
},
|
|
709
|
+
}, qt = (n, t) => {
|
|
710
710
|
const e = ht.fromSchema(n);
|
|
711
|
-
return e.serializeNodeInner = (o, r) =>
|
|
711
|
+
return e.serializeNodeInner = (o, r) => jt(o, r, e, t, !1), e.serializeProseMirrorFragment = (o) => Wt(o, e), e.serializeBlocks = (o) => {
|
|
712
712
|
const r = o.map(
|
|
713
713
|
(s) => O(s, n, t.styleSchema)
|
|
714
714
|
), i = n.nodes.blockGroup.create(null, r);
|
|
@@ -727,19 +727,19 @@ const st = (n, t) => {
|
|
|
727
727
|
function Mr(n) {
|
|
728
728
|
return en() ? n.replace("Mod", "⌘") : n.replace("Mod", "Ctrl");
|
|
729
729
|
}
|
|
730
|
-
function
|
|
730
|
+
function z(...n) {
|
|
731
731
|
return n.filter((t) => t).join(" ");
|
|
732
732
|
}
|
|
733
733
|
function tt(n, t, e, o) {
|
|
734
734
|
const r = document.createElement("div");
|
|
735
|
-
r.className =
|
|
735
|
+
r.className = z(
|
|
736
736
|
"bn-block-content",
|
|
737
737
|
e.class
|
|
738
738
|
), r.setAttribute("data-content-type", n);
|
|
739
739
|
for (const [s, a] of Object.entries(e))
|
|
740
740
|
s !== "class" && r.setAttribute(s, a);
|
|
741
741
|
const i = document.createElement(t);
|
|
742
|
-
i.className =
|
|
742
|
+
i.className = z(
|
|
743
743
|
"bn-inline-content",
|
|
744
744
|
o.class
|
|
745
745
|
);
|
|
@@ -752,7 +752,7 @@ function tt(n, t, e, o) {
|
|
|
752
752
|
contentDOM: i
|
|
753
753
|
};
|
|
754
754
|
}
|
|
755
|
-
const
|
|
755
|
+
const Lt = (n, t) => {
|
|
756
756
|
const e = O(
|
|
757
757
|
n,
|
|
758
758
|
t._tiptapEditor.schema,
|
|
@@ -779,13 +779,13 @@ const It = (n, t) => {
|
|
|
779
779
|
default: "left",
|
|
780
780
|
values: ["left", "center", "right", "justify"]
|
|
781
781
|
}
|
|
782
|
-
},
|
|
782
|
+
}, Kt = ["backgroundColor", "textColor"];
|
|
783
783
|
function it(n) {
|
|
784
784
|
return "data-" + n.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
785
785
|
}
|
|
786
|
-
function
|
|
786
|
+
function Xt(n) {
|
|
787
787
|
const t = {};
|
|
788
|
-
return Object.entries(n).filter(([e, o]) => !
|
|
788
|
+
return Object.entries(n).filter(([e, o]) => !Kt.includes(e)).forEach(([e, o]) => {
|
|
789
789
|
t[e] = {
|
|
790
790
|
default: o.default,
|
|
791
791
|
keepOnSplit: !0,
|
|
@@ -825,13 +825,13 @@ function lt(n, t, e, o, r) {
|
|
|
825
825
|
if (r !== void 0)
|
|
826
826
|
for (const [s, a] of Object.entries(r))
|
|
827
827
|
s !== "class" && i.setAttribute(s, a);
|
|
828
|
-
i.className =
|
|
828
|
+
i.className = z(
|
|
829
829
|
"bn-block-content",
|
|
830
830
|
(r == null ? void 0 : r.class) || ""
|
|
831
831
|
), i.setAttribute("data-content-type", t);
|
|
832
832
|
for (const [s, a] of Object.entries(e))
|
|
833
|
-
!
|
|
834
|
-
return i.appendChild(n.dom), n.contentDOM !== void 0 && (n.contentDOM.className =
|
|
833
|
+
!Kt.includes(s) && a !== o[s].default && i.setAttribute(it(s), a);
|
|
834
|
+
return i.appendChild(n.dom), n.contentDOM !== void 0 && (n.contentDOM.className = z(
|
|
835
835
|
"bn-inline-content",
|
|
836
836
|
n.contentDOM.className
|
|
837
837
|
), n.contentDOM.setAttribute("data-editable", "")), {
|
|
@@ -842,14 +842,14 @@ function lt(n, t, e, o, r) {
|
|
|
842
842
|
function W(n) {
|
|
843
843
|
return j.create(n);
|
|
844
844
|
}
|
|
845
|
-
function
|
|
845
|
+
function Jt(n, t) {
|
|
846
846
|
return {
|
|
847
847
|
config: n,
|
|
848
848
|
implementation: t
|
|
849
849
|
};
|
|
850
850
|
}
|
|
851
851
|
function et(n, t, e) {
|
|
852
|
-
return
|
|
852
|
+
return Jt(
|
|
853
853
|
{
|
|
854
854
|
type: n.name,
|
|
855
855
|
content: n.config.content === "inline*" ? "inline" : n.config.content === "tableRow+" ? "table" : "none",
|
|
@@ -858,13 +858,13 @@ function et(n, t, e) {
|
|
|
858
858
|
{
|
|
859
859
|
node: n,
|
|
860
860
|
requiredExtensions: e,
|
|
861
|
-
toInternalHTML:
|
|
862
|
-
toExternalHTML:
|
|
861
|
+
toInternalHTML: Lt,
|
|
862
|
+
toExternalHTML: Lt
|
|
863
863
|
// parse: () => undefined, // parse rules are in node already
|
|
864
864
|
}
|
|
865
865
|
);
|
|
866
866
|
}
|
|
867
|
-
function
|
|
867
|
+
function Yt(n) {
|
|
868
868
|
return Object.fromEntries(
|
|
869
869
|
Object.entries(n).map(([t, e]) => [t, e.config])
|
|
870
870
|
);
|
|
@@ -893,7 +893,7 @@ function rn(n, t) {
|
|
|
893
893
|
group: "blockContent",
|
|
894
894
|
selectable: !0,
|
|
895
895
|
addAttributes() {
|
|
896
|
-
return
|
|
896
|
+
return Xt(n.propSchema);
|
|
897
897
|
},
|
|
898
898
|
parseHTML() {
|
|
899
899
|
return on(n, t.parse);
|
|
@@ -927,7 +927,7 @@ function rn(n, t) {
|
|
|
927
927
|
throw new Error(
|
|
928
928
|
"Node name does not match block type. This is a bug in BlockNote."
|
|
929
929
|
);
|
|
930
|
-
return
|
|
930
|
+
return Jt(n, {
|
|
931
931
|
node: e,
|
|
932
932
|
toInternalHTML: (o, r) => {
|
|
933
933
|
var a;
|
|
@@ -987,7 +987,7 @@ function cn(n, t) {
|
|
|
987
987
|
}
|
|
988
988
|
);
|
|
989
989
|
}
|
|
990
|
-
function
|
|
990
|
+
function Zt(n) {
|
|
991
991
|
return Object.fromEntries(
|
|
992
992
|
Object.entries(n).map(([t, e]) => [t, e.config])
|
|
993
993
|
);
|
|
@@ -1012,7 +1012,7 @@ function xr(n, t) {
|
|
|
1012
1012
|
atom: n.content === "none",
|
|
1013
1013
|
content: n.content === "styled" ? "inline*" : "",
|
|
1014
1014
|
addAttributes() {
|
|
1015
|
-
return
|
|
1015
|
+
return Xt(n.propSchema);
|
|
1016
1016
|
},
|
|
1017
1017
|
addKeyboardShortcuts() {
|
|
1018
1018
|
return an(n);
|
|
@@ -1022,7 +1022,7 @@ function xr(n, t) {
|
|
|
1022
1022
|
},
|
|
1023
1023
|
renderHTML({ node: o }) {
|
|
1024
1024
|
const r = this.options.editor, i = t.render(
|
|
1025
|
-
|
|
1025
|
+
Gt(
|
|
1026
1026
|
o,
|
|
1027
1027
|
r.inlineContentSchema,
|
|
1028
1028
|
r.styleSchema
|
|
@@ -1057,14 +1057,14 @@ function un(n) {
|
|
|
1057
1057
|
function pn(n, t, e, o) {
|
|
1058
1058
|
return n.dom.setAttribute("data-style-type", t), o === "string" && n.dom.setAttribute("data-value", e), n.contentDOM !== void 0 && n.contentDOM.setAttribute("data-editable", ""), n;
|
|
1059
1059
|
}
|
|
1060
|
-
function
|
|
1060
|
+
function Qt(n, t) {
|
|
1061
1061
|
return {
|
|
1062
1062
|
config: n,
|
|
1063
1063
|
implementation: t
|
|
1064
1064
|
};
|
|
1065
1065
|
}
|
|
1066
|
-
function
|
|
1067
|
-
return
|
|
1066
|
+
function _(n, t) {
|
|
1067
|
+
return Qt(
|
|
1068
1068
|
{
|
|
1069
1069
|
type: n.name,
|
|
1070
1070
|
propSchema: t
|
|
@@ -1074,7 +1074,7 @@ function R(n, t) {
|
|
|
1074
1074
|
}
|
|
1075
1075
|
);
|
|
1076
1076
|
}
|
|
1077
|
-
function
|
|
1077
|
+
function te(n) {
|
|
1078
1078
|
return Object.fromEntries(
|
|
1079
1079
|
Object.entries(n).map(([t, e]) => [t, e.config])
|
|
1080
1080
|
);
|
|
@@ -1115,7 +1115,7 @@ function Br(n, t) {
|
|
|
1115
1115
|
);
|
|
1116
1116
|
}
|
|
1117
1117
|
});
|
|
1118
|
-
return
|
|
1118
|
+
return Qt(n, {
|
|
1119
1119
|
mark: e
|
|
1120
1120
|
});
|
|
1121
1121
|
}
|
|
@@ -1145,7 +1145,7 @@ const mn = ft.create({
|
|
|
1145
1145
|
renderHTML({ HTMLAttributes: n }) {
|
|
1146
1146
|
return ["span", n, 0];
|
|
1147
1147
|
}
|
|
1148
|
-
}), fn =
|
|
1148
|
+
}), fn = _(
|
|
1149
1149
|
mn,
|
|
1150
1150
|
"string"
|
|
1151
1151
|
), gn = ft.create({
|
|
@@ -1172,7 +1172,7 @@ const mn = ft.create({
|
|
|
1172
1172
|
renderHTML({ HTMLAttributes: n }) {
|
|
1173
1173
|
return ["span", n, 0];
|
|
1174
1174
|
}
|
|
1175
|
-
}), bn =
|
|
1175
|
+
}), bn = _(gn, "string"), kn = {
|
|
1176
1176
|
...B,
|
|
1177
1177
|
level: { default: 1, values: [1, 2, 3] }
|
|
1178
1178
|
}, yn = W({
|
|
@@ -1397,7 +1397,7 @@ const En = {
|
|
|
1397
1397
|
width: {
|
|
1398
1398
|
default: 512
|
|
1399
1399
|
}
|
|
1400
|
-
},
|
|
1400
|
+
}, Ht = (n) => {
|
|
1401
1401
|
switch (n) {
|
|
1402
1402
|
case "left":
|
|
1403
1403
|
return "flex-start";
|
|
@@ -1408,9 +1408,9 @@ const En = {
|
|
|
1408
1408
|
default:
|
|
1409
1409
|
return "flex-start";
|
|
1410
1410
|
}
|
|
1411
|
-
},
|
|
1411
|
+
}, Nt = 64, Cn = (n, t) => {
|
|
1412
1412
|
const e = document.createElement("div");
|
|
1413
|
-
e.className = "bn-image-block-content-wrapper", e.style.alignItems =
|
|
1413
|
+
e.className = "bn-image-block-content-wrapper", e.style.alignItems = Ht(
|
|
1414
1414
|
n.props.textAlignment
|
|
1415
1415
|
);
|
|
1416
1416
|
const o = document.createElement("div");
|
|
@@ -1438,7 +1438,7 @@ const En = {
|
|
|
1438
1438
|
var K;
|
|
1439
1439
|
const b = ((K = t.getSelection()) == null ? void 0 : K.blocks) || [];
|
|
1440
1440
|
[t.getTextCursorPosition().block, ...b].find(
|
|
1441
|
-
(
|
|
1441
|
+
(F) => F.id === n.id
|
|
1442
1442
|
) !== void 0 ? (o.style.outline = "4px solid rgb(100, 160, 255)", s.style.outline = "4px solid rgb(100, 160, 255)") : (o.style.outline = "", s.style.outline = "");
|
|
1443
1443
|
};
|
|
1444
1444
|
t.onEditorContentChange(m), t.onEditorSelectionChange(m);
|
|
@@ -1449,7 +1449,7 @@ const En = {
|
|
|
1449
1449
|
return;
|
|
1450
1450
|
}
|
|
1451
1451
|
let T;
|
|
1452
|
-
|
|
1452
|
+
Ht(n.props.textAlignment) === "center" ? h.handleUsed === "left" ? T = h.initialWidth + (h.initialClientX - b.clientX) * 2 : T = h.initialWidth + (b.clientX - h.initialClientX) * 2 : h.handleUsed === "left" ? T = h.initialWidth + h.initialClientX - b.clientX : T = h.initialWidth + b.clientX - h.initialClientX, T < Nt ? l.style.width = `${Nt}px` : T > t.domElement.firstElementChild.clientWidth ? l.style.width = `${t.domElement.firstElementChild.clientWidth}px` : l.style.width = `${T}px`;
|
|
1453
1453
|
}, y = (b) => {
|
|
1454
1454
|
(!b.target || !a.contains(b.target) || !t.isEditable) && a.contains(c) && a.contains(d) && (a.removeChild(c), a.removeChild(d)), h && (h = void 0, t.updateBlock(n, {
|
|
1455
1455
|
type: "image",
|
|
@@ -1542,7 +1542,7 @@ const En = {
|
|
|
1542
1542
|
};
|
|
1543
1543
|
}
|
|
1544
1544
|
}
|
|
1545
|
-
),
|
|
1545
|
+
), yt = (n) => {
|
|
1546
1546
|
const { node: t, contentType: e } = w(
|
|
1547
1547
|
n.state.doc,
|
|
1548
1548
|
n.state.selection.from
|
|
@@ -1583,7 +1583,7 @@ const En = {
|
|
|
1583
1583
|
},
|
|
1584
1584
|
addKeyboardShortcuts() {
|
|
1585
1585
|
return {
|
|
1586
|
-
Enter: () =>
|
|
1586
|
+
Enter: () => yt(this.editor),
|
|
1587
1587
|
"Mod-Shift-8": () => this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
|
|
1588
1588
|
type: "bulletListItem",
|
|
1589
1589
|
props: {}
|
|
@@ -1702,7 +1702,7 @@ const En = {
|
|
|
1702
1702
|
},
|
|
1703
1703
|
addKeyboardShortcuts() {
|
|
1704
1704
|
return {
|
|
1705
|
-
Enter: () =>
|
|
1705
|
+
Enter: () => yt(this.editor),
|
|
1706
1706
|
"Mod-Shift-7": () => this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
|
|
1707
1707
|
type: "numberedListItem",
|
|
1708
1708
|
props: {}
|
|
@@ -1769,6 +1769,15 @@ const En = {
|
|
|
1769
1769
|
name: "paragraph",
|
|
1770
1770
|
content: "inline*",
|
|
1771
1771
|
group: "blockContent",
|
|
1772
|
+
addKeyboardShortcuts() {
|
|
1773
|
+
return {
|
|
1774
|
+
Enter: () => yt(this.editor),
|
|
1775
|
+
"Mod-Alt-0": () => this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
|
|
1776
|
+
type: "paragraph",
|
|
1777
|
+
props: {}
|
|
1778
|
+
})
|
|
1779
|
+
};
|
|
1780
|
+
},
|
|
1772
1781
|
parseHTML() {
|
|
1773
1782
|
return [
|
|
1774
1783
|
{ tag: "div[data-content-type=" + this.name + "]" },
|
|
@@ -1884,21 +1893,21 @@ const En = {
|
|
|
1884
1893
|
numberedListItem: An,
|
|
1885
1894
|
image: Tn,
|
|
1886
1895
|
table: Fn
|
|
1887
|
-
}, ne =
|
|
1888
|
-
bold:
|
|
1889
|
-
italic:
|
|
1890
|
-
underline:
|
|
1891
|
-
strike:
|
|
1892
|
-
code:
|
|
1896
|
+
}, ne = Yt(ee), oe = {
|
|
1897
|
+
bold: _(Me, "boolean"),
|
|
1898
|
+
italic: _(Be, "boolean"),
|
|
1899
|
+
underline: _(Le, "boolean"),
|
|
1900
|
+
strike: _(Ie, "boolean"),
|
|
1901
|
+
code: _(xe, "boolean"),
|
|
1893
1902
|
textColor: bn,
|
|
1894
1903
|
backgroundColor: fn
|
|
1895
|
-
}, Ir =
|
|
1904
|
+
}, Ir = te(oe), re = {
|
|
1896
1905
|
text: { config: "text", implementation: {} },
|
|
1897
1906
|
link: { config: "link", implementation: {} }
|
|
1898
|
-
}, Lr =
|
|
1907
|
+
}, Lr = Zt(
|
|
1899
1908
|
re
|
|
1900
1909
|
);
|
|
1901
|
-
function
|
|
1910
|
+
function wt(n, t) {
|
|
1902
1911
|
let e, o;
|
|
1903
1912
|
if (t.firstChild.descendants((r, i) => e ? !1 : r.type.name !== "blockContainer" || r.attrs.id !== n ? !0 : (e = r, o = i + 1, !1)), e === void 0 || o === void 0)
|
|
1904
1913
|
throw Error("Could not find block in the editor with matching ID.");
|
|
@@ -1913,7 +1922,7 @@ function Un(n, t, e = "before", o) {
|
|
|
1913
1922
|
s.push(
|
|
1914
1923
|
O(d, r.schema, o.styleSchema)
|
|
1915
1924
|
);
|
|
1916
|
-
const { node: a, posBeforeNode: l } =
|
|
1925
|
+
const { node: a, posBeforeNode: l } = wt(i, r.state.doc);
|
|
1917
1926
|
if (e === "before" && r.view.dispatch(
|
|
1918
1927
|
r.state.tr.insert(l, s)
|
|
1919
1928
|
), e === "after" && r.view.dispatch(
|
|
@@ -1944,7 +1953,7 @@ function Un(n, t, e = "before", o) {
|
|
|
1944
1953
|
return c;
|
|
1945
1954
|
}
|
|
1946
1955
|
function $n(n, t, e) {
|
|
1947
|
-
const o = e._tiptapEditor, r = typeof n == "string" ? n : n.id, { posBeforeNode: i } =
|
|
1956
|
+
const o = e._tiptapEditor, r = typeof n == "string" ? n : n.id, { posBeforeNode: i } = wt(r, o.state.doc);
|
|
1948
1957
|
o.commands.BNUpdateBlock(i + 1, t);
|
|
1949
1958
|
const s = o.state.doc.resolve(i + 1).node();
|
|
1950
1959
|
return M(
|
|
@@ -2037,12 +2046,12 @@ function Wn() {
|
|
|
2037
2046
|
};
|
|
2038
2047
|
return n;
|
|
2039
2048
|
}
|
|
2040
|
-
function
|
|
2041
|
-
return mt().use(
|
|
2049
|
+
function vt(n) {
|
|
2050
|
+
return mt().use(_t, { fragment: !0 }).use(Wn).use(Oe).use(zt).use(_e).processSync(n).value;
|
|
2042
2051
|
}
|
|
2043
2052
|
function qn(n, t, e) {
|
|
2044
2053
|
const r = st(t, e).exportBlocks(n);
|
|
2045
|
-
return
|
|
2054
|
+
return vt(r);
|
|
2046
2055
|
}
|
|
2047
2056
|
function Kn(n) {
|
|
2048
2057
|
return Array.prototype.indexOf.call(n.parentElement.childNodes, n);
|
|
@@ -2110,12 +2119,12 @@ function Zn(n, t) {
|
|
|
2110
2119
|
}, n.patch(t, r), r;
|
|
2111
2120
|
}
|
|
2112
2121
|
function Qn(n, t, e, o, r) {
|
|
2113
|
-
const i = mt().use(Re).use(
|
|
2122
|
+
const i = mt().use(Re).use(zt).use(ze, {
|
|
2114
2123
|
handlers: {
|
|
2115
2124
|
...Ve,
|
|
2116
2125
|
code: Zn
|
|
2117
2126
|
}
|
|
2118
|
-
}).use(
|
|
2127
|
+
}).use(Rt).processSync(n);
|
|
2119
2128
|
return ae(
|
|
2120
2129
|
i.value,
|
|
2121
2130
|
t,
|
|
@@ -2245,7 +2254,7 @@ class oo {
|
|
|
2245
2254
|
), i = r.marks();
|
|
2246
2255
|
for (const s of i)
|
|
2247
2256
|
if (s.type.name === this.pmView.state.schema.mark("link").type.name) {
|
|
2248
|
-
this.mouseHoveredHyperlinkMark = s, this.mouseHoveredHyperlinkMarkRange =
|
|
2257
|
+
this.mouseHoveredHyperlinkMark = s, this.mouseHoveredHyperlinkMarkRange = Tt(
|
|
2249
2258
|
r,
|
|
2250
2259
|
s.type,
|
|
2251
2260
|
s.attrs
|
|
@@ -2313,7 +2322,7 @@ class oo {
|
|
|
2313
2322
|
const o = this.pmView.state.selection.$from.marks();
|
|
2314
2323
|
for (const r of o)
|
|
2315
2324
|
if (r.type.name === this.pmView.state.schema.mark("link").type.name) {
|
|
2316
|
-
this.keyboardHoveredHyperlinkMark = r, this.keyboardHoveredHyperlinkMarkRange =
|
|
2325
|
+
this.keyboardHoveredHyperlinkMark = r, this.keyboardHoveredHyperlinkMarkRange = Tt(
|
|
2317
2326
|
this.pmView.state.selection.$from,
|
|
2318
2327
|
r.type,
|
|
2319
2328
|
r.attrs
|
|
@@ -2594,7 +2603,7 @@ const lo = (n, t, e, o, r = () => [], i = () => {
|
|
|
2594
2603
|
});
|
|
2595
2604
|
}
|
|
2596
2605
|
};
|
|
2597
|
-
},
|
|
2606
|
+
}, St = new L("SlashMenuPlugin");
|
|
2598
2607
|
class co extends q {
|
|
2599
2608
|
constructor(e, o) {
|
|
2600
2609
|
super();
|
|
@@ -2605,7 +2614,7 @@ class co extends q {
|
|
|
2605
2614
|
(i) => {
|
|
2606
2615
|
this.emit("update", i);
|
|
2607
2616
|
},
|
|
2608
|
-
|
|
2617
|
+
St,
|
|
2609
2618
|
"/",
|
|
2610
2619
|
(i) => o.filter(
|
|
2611
2620
|
({ name: s, aliases: a }) => s.toLowerCase().startsWith(i.toLowerCase()) || a && a.filter(
|
|
@@ -2634,7 +2643,7 @@ class U extends at {
|
|
|
2634
2643
|
return new U(e.resolve(o), e.resolve(r));
|
|
2635
2644
|
}
|
|
2636
2645
|
content() {
|
|
2637
|
-
return new
|
|
2646
|
+
return new R(H.from(this.nodes), 0, 0);
|
|
2638
2647
|
}
|
|
2639
2648
|
eq(e) {
|
|
2640
2649
|
if (!(e instanceof U) || this.nodes.length !== e.nodes.length || this.from !== e.from || this.to !== e.to)
|
|
@@ -2656,7 +2665,7 @@ class U extends at {
|
|
|
2656
2665
|
}
|
|
2657
2666
|
}
|
|
2658
2667
|
let D;
|
|
2659
|
-
function
|
|
2668
|
+
function Et(n, t) {
|
|
2660
2669
|
var r;
|
|
2661
2670
|
if (!t.dom.isConnected)
|
|
2662
2671
|
return;
|
|
@@ -2672,7 +2681,7 @@ function St(n, t) {
|
|
|
2672
2681
|
}
|
|
2673
2682
|
}
|
|
2674
2683
|
function uo(n, t) {
|
|
2675
|
-
const e =
|
|
2684
|
+
const e = Et(n, t);
|
|
2676
2685
|
if (e && e.node.nodeType === 1) {
|
|
2677
2686
|
const o = t.docView, r = o.nearestDesc(e.node, !0);
|
|
2678
2687
|
return !r || r === o ? null : r.posBefore;
|
|
@@ -2689,7 +2698,7 @@ function po(n, t) {
|
|
|
2689
2698
|
e = n.from, o = n.to;
|
|
2690
2699
|
return { from: e, to: o };
|
|
2691
2700
|
}
|
|
2692
|
-
function
|
|
2701
|
+
function At(n, t, e = t) {
|
|
2693
2702
|
t === e && (e += n.state.doc.resolve(t + 1).node().nodeSize);
|
|
2694
2703
|
const o = n.domAtPos(t).node.cloneNode(!0), r = n.domAtPos(t).node, i = (d, p) => Array.prototype.indexOf.call(d.children, p), s = i(
|
|
2695
2704
|
r,
|
|
@@ -2723,14 +2732,14 @@ function ho(n, t) {
|
|
|
2723
2732
|
const s = e.state.selection, a = e.state.doc, { from: l, to: c } = po(s, a), d = l <= i && i < c, p = s.$anchor.node() !== s.$head.node() || s instanceof U;
|
|
2724
2733
|
d && p ? (e.dispatch(
|
|
2725
2734
|
e.state.tr.setSelection(U.create(a, l, c))
|
|
2726
|
-
),
|
|
2735
|
+
), At(e, l, c)) : (e.dispatch(
|
|
2727
2736
|
e.state.tr.setSelection(rt.create(e.state.doc, i))
|
|
2728
|
-
),
|
|
2729
|
-
const m = e.state.selection.content(), h = t._tiptapEditor.schema, y =
|
|
2737
|
+
), At(e, i));
|
|
2738
|
+
const m = e.state.selection.content(), h = t._tiptapEditor.schema, y = qt(h, t).serializeProseMirrorFragment(
|
|
2730
2739
|
m.content
|
|
2731
2740
|
), E = st(h, t).exportProseMirrorFragment(
|
|
2732
2741
|
m.content
|
|
2733
|
-
), k =
|
|
2742
|
+
), k = vt(E);
|
|
2734
2743
|
n.dataTransfer.clearData(), n.dataTransfer.setData("blocknote/html", y), n.dataTransfer.setData("text/html", E), n.dataTransfer.setData("text/plain", k), n.dataTransfer.effectAllowed = "move", n.dataTransfer.setDragImage(D, 0, 0), e.dragging = { slice: m, move: !0 };
|
|
2735
2744
|
}
|
|
2736
2745
|
}
|
|
@@ -2812,7 +2821,7 @@ class mo {
|
|
|
2812
2821
|
left: e.left + e.width / 2,
|
|
2813
2822
|
// take middle of editor
|
|
2814
2823
|
top: t.clientY
|
|
2815
|
-
}, a =
|
|
2824
|
+
}, a = Et(s, this.pmView);
|
|
2816
2825
|
if (!a || !this.editor.isEditable) {
|
|
2817
2826
|
(d = this.sideMenuState) != null && d.show && (this.sideMenuState.show = !1, this.updateSideMenu(this.sideMenuState));
|
|
2818
2827
|
return;
|
|
@@ -2877,7 +2886,7 @@ class mo {
|
|
|
2877
2886
|
} else
|
|
2878
2887
|
this.editor._tiptapEditor.commands.setTextSelection(s + 1);
|
|
2879
2888
|
this.pmView.focus(), this.pmView.dispatch(
|
|
2880
|
-
this.pmView.state.tr.scrollIntoView().setMeta(
|
|
2889
|
+
this.pmView.state.tr.scrollIntoView().setMeta(St, {
|
|
2881
2890
|
// TODO import suggestion plugin key
|
|
2882
2891
|
activate: !0,
|
|
2883
2892
|
type: "drag"
|
|
@@ -3036,7 +3045,7 @@ const ko = (n = ne) => {
|
|
|
3036
3045
|
}), t;
|
|
3037
3046
|
};
|
|
3038
3047
|
let I;
|
|
3039
|
-
function
|
|
3048
|
+
function Pt() {
|
|
3040
3049
|
I || (I = document.createElement("div"), I.innerHTML = "_", I.style.opacity = "0", I.style.height = "1px", I.style.width = "1px", document.body.appendChild(I));
|
|
3041
3050
|
}
|
|
3042
3051
|
function yo() {
|
|
@@ -3074,7 +3083,7 @@ class So {
|
|
|
3074
3083
|
(c = this.state) != null && c.show && (this.state.show = !1, this.updateState());
|
|
3075
3084
|
return;
|
|
3076
3085
|
}
|
|
3077
|
-
const o = ot(e), r = ot(e.parentElement), i = e.getBoundingClientRect(), s = e.parentElement.parentElement.getBoundingClientRect(), a =
|
|
3086
|
+
const o = ot(e), r = ot(e.parentElement), i = e.getBoundingClientRect(), s = e.parentElement.parentElement.getBoundingClientRect(), a = Et(i, this.pmView);
|
|
3078
3087
|
if (!a)
|
|
3079
3088
|
throw new Error(
|
|
3080
3089
|
"Found table cell element, but could not find surrounding blockContent element."
|
|
@@ -3203,7 +3212,7 @@ class Eo extends q {
|
|
|
3203
3212
|
newIndex: this.view.state.colIndex,
|
|
3204
3213
|
tablePos: this.view.tablePos
|
|
3205
3214
|
})
|
|
3206
|
-
),
|
|
3215
|
+
), Pt(), e.dataTransfer.setDragImage(I, 0, 0), e.dataTransfer.effectAllowed = "move";
|
|
3207
3216
|
});
|
|
3208
3217
|
/**
|
|
3209
3218
|
* Callback that should be set on the `dragStart` event for whichever element
|
|
@@ -3225,7 +3234,7 @@ class Eo extends q {
|
|
|
3225
3234
|
newIndex: this.view.state.rowIndex,
|
|
3226
3235
|
tablePos: this.view.tablePos
|
|
3227
3236
|
})
|
|
3228
|
-
),
|
|
3237
|
+
), Pt(), e.dataTransfer.setDragImage(I, 0, 0), e.dataTransfer.effectAllowed = "copyMove";
|
|
3229
3238
|
});
|
|
3230
3239
|
/**
|
|
3231
3240
|
* Callback that should be set on the `dragEnd` event for both the element
|
|
@@ -3305,14 +3314,14 @@ class Eo extends q {
|
|
|
3305
3314
|
return this.on("update", e);
|
|
3306
3315
|
}
|
|
3307
3316
|
}
|
|
3308
|
-
function
|
|
3309
|
-
const e = n.state.selection.content().content, r =
|
|
3317
|
+
function Dt(n, t) {
|
|
3318
|
+
const e = n.state.selection.content().content, r = qt(
|
|
3310
3319
|
n.state.schema,
|
|
3311
3320
|
t
|
|
3312
3321
|
).serializeProseMirrorFragment(e), s = st(
|
|
3313
3322
|
n.state.schema,
|
|
3314
3323
|
t
|
|
3315
|
-
).exportProseMirrorFragment(e), a =
|
|
3324
|
+
).exportProseMirrorFragment(e), a = vt(s);
|
|
3316
3325
|
return { internalHTML: r, externalHTML: s, plainText: a };
|
|
3317
3326
|
}
|
|
3318
3327
|
const Co = (n) => N.create({
|
|
@@ -3330,7 +3339,7 @@ const Co = (n) => N.create({
|
|
|
3330
3339
|
)
|
|
3331
3340
|
)
|
|
3332
3341
|
);
|
|
3333
|
-
const { internalHTML: o, externalHTML: r, plainText: i } =
|
|
3342
|
+
const { internalHTML: o, externalHTML: r, plainText: i } = Dt(t, n);
|
|
3334
3343
|
return e.clipboardData.setData("blocknote/html", o), e.clipboardData.setData("text/html", r), e.clipboardData.setData("text/plain", i), !0;
|
|
3335
3344
|
},
|
|
3336
3345
|
// This is for the use-case in which only a block without content
|
|
@@ -3346,7 +3355,7 @@ const Co = (n) => N.create({
|
|
|
3346
3355
|
)
|
|
3347
3356
|
)
|
|
3348
3357
|
), e.preventDefault(), e.dataTransfer.clearData();
|
|
3349
|
-
const { internalHTML: o, externalHTML: r, plainText: i } =
|
|
3358
|
+
const { internalHTML: o, externalHTML: r, plainText: i } = Dt(t, n);
|
|
3350
3359
|
return e.dataTransfer.setData("blocknote/html", o), e.dataTransfer.setData("text/html", r), e.dataTransfer.setData("text/plain", i), !0;
|
|
3351
3360
|
}
|
|
3352
3361
|
}
|
|
@@ -3424,7 +3433,7 @@ const Co = (n) => N.create({
|
|
|
3424
3433
|
key: Bo,
|
|
3425
3434
|
props: {
|
|
3426
3435
|
decorations: (n) => {
|
|
3427
|
-
const { doc: t, selection: e } = n, o =
|
|
3436
|
+
const { doc: t, selection: e } = n, o = St.getState(n), r = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: i } = e, s = [];
|
|
3428
3437
|
if (r)
|
|
3429
3438
|
return t.descendants((a, l) => {
|
|
3430
3439
|
const c = i >= l && i <= l + a.nodeSize, d = !a.isLeaf && !a.childCount;
|
|
@@ -3523,7 +3532,7 @@ const Co = (n) => N.create({
|
|
|
3523
3532
|
"node" in n.state.selection && t.key.length === 1 && !t.ctrlKey && !t.altKey && !t.metaKey && !t.shiftKey && t.preventDefault();
|
|
3524
3533
|
}
|
|
3525
3534
|
}
|
|
3526
|
-
}),
|
|
3535
|
+
}), Ot = new L("previous-blocks"), Do = {
|
|
3527
3536
|
// Numbered List Items
|
|
3528
3537
|
index: "index",
|
|
3529
3538
|
// Headings
|
|
@@ -3535,14 +3544,14 @@ const Co = (n) => N.create({
|
|
|
3535
3544
|
}, Oo = () => {
|
|
3536
3545
|
let n;
|
|
3537
3546
|
return new x({
|
|
3538
|
-
key:
|
|
3547
|
+
key: Ot,
|
|
3539
3548
|
view(t) {
|
|
3540
3549
|
return {
|
|
3541
3550
|
update: async (e, o) => {
|
|
3542
3551
|
var r;
|
|
3543
3552
|
((r = this.key) == null ? void 0 : r.getState(e.state).updatedBlocks.size) > 0 && (n = setTimeout(() => {
|
|
3544
3553
|
e.dispatch(
|
|
3545
|
-
e.state.tr.setMeta(
|
|
3554
|
+
e.state.tr.setMeta(Ot, { clearUpdate: !0 })
|
|
3546
3555
|
);
|
|
3547
3556
|
}, 0));
|
|
3548
3557
|
},
|
|
@@ -3565,9 +3574,9 @@ const Co = (n) => N.create({
|
|
|
3565
3574
|
apply(t, e, o, r) {
|
|
3566
3575
|
if (e.currentTransactionOldBlockAttrs = {}, e.updatedBlocks.clear(), !t.docChanged || o.doc.eq(r.doc))
|
|
3567
3576
|
return e;
|
|
3568
|
-
const i = {}, s =
|
|
3577
|
+
const i = {}, s = Mt(o.doc, (c) => c.attrs.id), a = new Map(
|
|
3569
3578
|
s.map((c) => [c.node.attrs.id, c])
|
|
3570
|
-
), l =
|
|
3579
|
+
), l = Mt(r.doc, (c) => c.attrs.id);
|
|
3571
3580
|
for (const c of l) {
|
|
3572
3581
|
const d = a.get(c.node.attrs.id), p = d == null ? void 0 : d.node.firstChild, m = c.node.firstChild;
|
|
3573
3582
|
if (d && p && m) {
|
|
@@ -3648,7 +3657,7 @@ const Co = (n) => N.create({
|
|
|
3648
3657
|
...((r = this.options.domAttributes) == null ? void 0 : r.blockContainer) || {},
|
|
3649
3658
|
...n
|
|
3650
3659
|
}, o = document.createElement("div");
|
|
3651
|
-
o.className =
|
|
3660
|
+
o.className = z("bn-block", e.class), o.setAttribute("data-node-type", this.name);
|
|
3652
3661
|
for (const [i, s] of Object.entries(e))
|
|
3653
3662
|
i !== "class" && o.setAttribute(i, s);
|
|
3654
3663
|
return t.appendChild(o), {
|
|
@@ -3691,7 +3700,7 @@ const Co = (n) => N.create({
|
|
|
3691
3700
|
a.childCount === 2 ? e.tr.replace(
|
|
3692
3701
|
i + l.nodeSize + 1,
|
|
3693
3702
|
s - 1,
|
|
3694
|
-
new
|
|
3703
|
+
new R(H.from(m), 0, 0)
|
|
3695
3704
|
) : e.tr.insert(
|
|
3696
3705
|
i + l.nodeSize,
|
|
3697
3706
|
e.schema.nodes.blockGroup.create({}, m)
|
|
@@ -3709,7 +3718,7 @@ const Co = (n) => N.create({
|
|
|
3709
3718
|
this.options.editor.styleSchema
|
|
3710
3719
|
);
|
|
3711
3720
|
else if (t.content.type === "tableContent")
|
|
3712
|
-
p =
|
|
3721
|
+
p = Ut(
|
|
3713
3722
|
t.content,
|
|
3714
3723
|
e.schema,
|
|
3715
3724
|
this.options.editor.styleSchema
|
|
@@ -3790,7 +3799,7 @@ const Co = (n) => N.create({
|
|
|
3790
3799
|
t.tr.deleteRange(l, l + a.nodeSize).replace(
|
|
3791
3800
|
p - 1,
|
|
3792
3801
|
l,
|
|
3793
|
-
new
|
|
3802
|
+
new R(a.content, 0, 0)
|
|
3794
3803
|
).scrollIntoView()
|
|
3795
3804
|
), t.tr.setSelection(
|
|
3796
3805
|
new nt(t.doc.resolve(p - 1))
|
|
@@ -3806,7 +3815,7 @@ const Co = (n) => N.create({
|
|
|
3806
3815
|
return o && (e.tr.insert(h, m), e.tr.replace(
|
|
3807
3816
|
f,
|
|
3808
3817
|
f + 1,
|
|
3809
|
-
p.content.size > 0 ? new
|
|
3818
|
+
p.content.size > 0 ? new R(
|
|
3810
3819
|
H.from(p),
|
|
3811
3820
|
c + 2,
|
|
3812
3821
|
c + 2
|
|
@@ -3821,7 +3830,7 @@ const Co = (n) => N.create({
|
|
|
3821
3830
|
), e.tr.replace(
|
|
3822
3831
|
a + 1,
|
|
3823
3832
|
l - 1,
|
|
3824
|
-
d.content.size > 0 ? new
|
|
3833
|
+
d.content.size > 0 ? new R(
|
|
3825
3834
|
H.from(d),
|
|
3826
3835
|
c + 2,
|
|
3827
3836
|
c + 2
|
|
@@ -3925,10 +3934,7 @@ const Co = (n) => N.create({
|
|
|
3925
3934
|
// Always returning true for tab key presses ensures they're not captured by the browser. Otherwise, they blur the
|
|
3926
3935
|
// editor since the browser will try to use tab for keyboard navigation.
|
|
3927
3936
|
Tab: () => (this.editor.commands.sinkListItem("blockContainer"), !0),
|
|
3928
|
-
"Shift-Tab": () => (this.editor.commands.liftListItem("blockContainer"), !0)
|
|
3929
|
-
"Mod-Alt-0": () => this.editor.commands.BNCreateBlock(
|
|
3930
|
-
this.editor.state.selection.anchor + 2
|
|
3931
|
-
)
|
|
3937
|
+
"Shift-Tab": () => (this.editor.commands.liftListItem("blockContainer"), !0)
|
|
3932
3938
|
};
|
|
3933
3939
|
}
|
|
3934
3940
|
}), zo = j.create({
|
|
@@ -3949,7 +3955,7 @@ const Co = (n) => N.create({
|
|
|
3949
3955
|
...((o = this.options.domAttributes) == null ? void 0 : o.blockGroup) || {},
|
|
3950
3956
|
...n
|
|
3951
3957
|
}, e = document.createElement("div");
|
|
3952
|
-
e.className =
|
|
3958
|
+
e.className = z(
|
|
3953
3959
|
"bn-block-group",
|
|
3954
3960
|
t.class
|
|
3955
3961
|
), e.setAttribute("data-node-type", "blockGroup");
|
|
@@ -4072,7 +4078,7 @@ function $o(n, t) {
|
|
|
4072
4078
|
);
|
|
4073
4079
|
e = e.replaceChild(o, i);
|
|
4074
4080
|
}
|
|
4075
|
-
return new
|
|
4081
|
+
return new R(e, n.openStart, n.openEnd);
|
|
4076
4082
|
}
|
|
4077
4083
|
const Go = {
|
|
4078
4084
|
enableInputRules: !0,
|
|
@@ -4106,9 +4112,9 @@ class ce {
|
|
|
4106
4112
|
inlineContentSpecs: t.inlineContentSpecs || re,
|
|
4107
4113
|
...t
|
|
4108
4114
|
};
|
|
4109
|
-
this.blockSchema =
|
|
4115
|
+
this.blockSchema = Yt(e.blockSpecs), this.inlineContentSchema = Zt(
|
|
4110
4116
|
e.inlineContentSpecs
|
|
4111
|
-
), this.styleSchema =
|
|
4117
|
+
), this.styleSchema = te(e.styleSpecs), this.blockImplementations = e.blockSpecs, this.inlineContentImplementations = e.inlineContentSpecs, this.styleImplementations = e.styleSpecs, this.sideMenu = new go(this), this.formattingToolbar = new no(this), this.slashMenu = new co(
|
|
4112
4118
|
this,
|
|
4113
4119
|
e.slashMenuItems || ko(this.blockSchema)
|
|
4114
4120
|
), this.hyperlinkToolbar = new io(this), this.imageToolbar = new Sn(this), this.blockSchema.table === ne.table && (this.tableHandles = new Eo(this));
|
|
@@ -4143,16 +4149,16 @@ class ce {
|
|
|
4143
4149
|
...Go,
|
|
4144
4150
|
...e._tiptapOptions,
|
|
4145
4151
|
onBeforeCreate(k) {
|
|
4146
|
-
var T,
|
|
4147
|
-
(
|
|
4152
|
+
var T, V;
|
|
4153
|
+
(V = (T = e._tiptapOptions) == null ? void 0 : T.onBeforeCreate) == null || V.call(T, k);
|
|
4148
4154
|
const g = k.editor.schema;
|
|
4149
4155
|
let v;
|
|
4150
4156
|
const C = g.nodes.doc.createAndFill;
|
|
4151
4157
|
g.nodes.doc.createAndFill = (...K) => {
|
|
4152
4158
|
if (v)
|
|
4153
4159
|
return v;
|
|
4154
|
-
const
|
|
4155
|
-
return
|
|
4160
|
+
const F = C.apply(g.nodes.doc, K), Ct = JSON.parse(JSON.stringify(F.toJSON()));
|
|
4161
|
+
return Ct.content[0].content[0].attrs.id = "initialBlockId", v = fe.fromJSON(g, Ct), v;
|
|
4156
4162
|
};
|
|
4157
4163
|
const b = g.node(
|
|
4158
4164
|
"doc",
|
|
@@ -4186,7 +4192,7 @@ class ce {
|
|
|
4186
4192
|
attributes: {
|
|
4187
4193
|
...(f = (h = e._tiptapOptions) == null ? void 0 : h.editorProps) == null ? void 0 : f.attributes,
|
|
4188
4194
|
...(y = e.domAttributes) == null ? void 0 : y.editor,
|
|
4189
|
-
class:
|
|
4195
|
+
class: z(
|
|
4190
4196
|
"bn-root",
|
|
4191
4197
|
"bn-editor",
|
|
4192
4198
|
e.defaultStyles ? "bn-default-styles" : "",
|
|
@@ -4322,7 +4328,7 @@ class ce {
|
|
|
4322
4328
|
* @param placement Whether the text cursor should be placed at the start or end of the block.
|
|
4323
4329
|
*/
|
|
4324
4330
|
setTextCursorPosition(t, e = "start") {
|
|
4325
|
-
const o = typeof t == "string" ? t : t.id, { posBeforeNode: r } =
|
|
4331
|
+
const o = typeof t == "string" ? t : t.id, { posBeforeNode: r } = wt(o, this._tiptapEditor.state.doc), { startPos: i, contentNode: s } = w(
|
|
4326
4332
|
this._tiptapEditor.state.doc,
|
|
4327
4333
|
r + 2
|
|
4328
4334
|
), a = this.blockSchema[s.type.name].content;
|
|
@@ -4607,7 +4613,7 @@ function ct(n = "") {
|
|
|
4607
4613
|
] : n;
|
|
4608
4614
|
}
|
|
4609
4615
|
function de(n) {
|
|
4610
|
-
return typeof n == "string" ? ct(n) : Array.isArray(n) ? n.flatMap((t) => typeof t == "string" ? ct(t) :
|
|
4616
|
+
return typeof n == "string" ? ct(n) : Array.isArray(n) ? n.flatMap((t) => typeof t == "string" ? ct(t) : Ft(t) ? {
|
|
4611
4617
|
...t,
|
|
4612
4618
|
content: ct(t.content)
|
|
4613
4619
|
} : Z(t) ? t : {
|
|
@@ -4674,13 +4680,13 @@ export {
|
|
|
4674
4680
|
st as createExternalHTMLExporter,
|
|
4675
4681
|
xr as createInlineContentSpec,
|
|
4676
4682
|
cn as createInlineContentSpecFromTipTapNode,
|
|
4677
|
-
|
|
4678
|
-
|
|
4683
|
+
Jt as createInternalBlockSpec,
|
|
4684
|
+
qt as createInternalHTMLSerializer,
|
|
4679
4685
|
ln as createInternalInlineContentSpec,
|
|
4680
|
-
|
|
4686
|
+
Qt as createInternalStyleSpec,
|
|
4681
4687
|
W as createStronglyTypedTiptapNode,
|
|
4682
4688
|
Br as createStyleSpec,
|
|
4683
|
-
|
|
4689
|
+
_ as createStyleSpecFromTipTapMark,
|
|
4684
4690
|
ne as defaultBlockSchema,
|
|
4685
4691
|
ee as defaultBlockSpecs,
|
|
4686
4692
|
Lr as defaultInlineContentSchema,
|
|
@@ -4692,33 +4698,33 @@ export {
|
|
|
4692
4698
|
eo as formattingToolbarPluginKey,
|
|
4693
4699
|
nn as getBlockFromPos,
|
|
4694
4700
|
Fo as getBlockNoteExtensions,
|
|
4695
|
-
|
|
4701
|
+
Yt as getBlockSchemaFromSpecs,
|
|
4696
4702
|
ko as getDefaultSlashMenuItems,
|
|
4697
|
-
|
|
4703
|
+
Et as getDraggableBlockFromCoords,
|
|
4698
4704
|
dn as getInlineContentParseRules,
|
|
4699
|
-
|
|
4705
|
+
Zt as getInlineContentSchemaFromSpecs,
|
|
4700
4706
|
on as getParseRules,
|
|
4701
4707
|
hn as getStyleParseRules,
|
|
4702
|
-
|
|
4708
|
+
te as getStyleSchemaFromSpecs,
|
|
4703
4709
|
ro as hyperlinkToolbarPluginKey,
|
|
4704
4710
|
Y as imageToolbarPluginKey,
|
|
4705
|
-
|
|
4711
|
+
Kt as inheritedProps,
|
|
4706
4712
|
bt as inlineContentToNodes,
|
|
4707
4713
|
en as isAppleOS,
|
|
4708
|
-
|
|
4709
|
-
|
|
4714
|
+
Bt as isLinkInlineContent,
|
|
4715
|
+
Ft as isPartialLinkInlineContent,
|
|
4710
4716
|
Z as isStyledTextInlineContent,
|
|
4711
|
-
|
|
4717
|
+
z as mergeCSSClasses,
|
|
4712
4718
|
M as nodeToBlock,
|
|
4713
|
-
|
|
4719
|
+
Gt as nodeToCustomInlineContent,
|
|
4714
4720
|
ue as partialBlockToBlockForTesting,
|
|
4715
4721
|
Hr as partialBlocksToBlocksForTesting,
|
|
4716
|
-
|
|
4722
|
+
Xt as propsToAttributes,
|
|
4717
4723
|
lo as setupSuggestionsMenu,
|
|
4718
4724
|
fo as sideMenuPluginKey,
|
|
4719
|
-
|
|
4725
|
+
St as slashMenuPluginKey,
|
|
4720
4726
|
un as stylePropsToAttributes,
|
|
4721
|
-
|
|
4727
|
+
Ut as tableContentToNodes,
|
|
4722
4728
|
J as tableHandlesPluginKey,
|
|
4723
4729
|
Tr as uploadToTmpFilesDotOrg_DEV_ONLY,
|
|
4724
4730
|
lt as wrapInBlockStructure
|