@blocknote/core 0.47.2 → 0.47.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 +4 -4
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +909 -869
- package/dist/blocknote.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +1 -1
- package/src/api/parsers/html/parseHTML.ts +2 -0
- package/src/api/parsers/html/util/normalizeWhitespace.ts +87 -0
- package/types/src/api/parsers/html/util/normalizeWhitespace.d.ts +6 -0
package/dist/blocknote.js
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
1
|
var Fe = Object.defineProperty;
|
|
2
|
-
var Ve = (
|
|
3
|
-
var k = (
|
|
4
|
-
import { Slice as F, Fragment as
|
|
5
|
-
import { ReplaceStep as Re, ReplaceAroundStep as
|
|
6
|
-
import { n as q, i as V, g as E, b as Z, a as C, t as Ge, U, q as D, r as z, d as
|
|
7
|
-
import { B as
|
|
2
|
+
var Ve = (o, e, t) => e in o ? Fe(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var k = (o, e, t) => Ve(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Slice as F, Fragment as M, DOMSerializer as me, DOMParser as Ue, Node as ze } from "prosemirror-model";
|
|
5
|
+
import { ReplaceStep as Re, ReplaceAroundStep as j } from "prosemirror-transform";
|
|
6
|
+
import { n as q, i as V, g as E, b as Z, a as C, t as Ge, U, q as D, r as z, d as We, s as je, u as qe, v, w as B, x as ke, y as Ke, z as be, A as K } from "./blockToNode-BNoNIXU7.js";
|
|
7
|
+
import { B as gs, G as Bs, C as ys, D as Cs, N as Ss, E as xs, O as Es, F as Ps, H as Ts, I as ws, L as Ms, J as vs, M as Is, K as As } from "./blockToNode-BNoNIXU7.js";
|
|
8
8
|
import { ak as G, al as Je, am as Ye, an as Qe, aj as P, a as Xe, ao as Ze, ap as et, a5 as tt, a8 as J, aq as ot, ar as nt, a6 as st, as as ee, a9 as ge, at as rt } from "./defaultBlocks-ZzGbYgQn.js";
|
|
9
|
-
import { aw as
|
|
9
|
+
import { aw as Ls, av as _s, E as Ds, F as Os, r as $s, N as Hs, a4 as Fs, ad as Vs, aG as Us, ax as zs, b as Rs, d as Gs, e as Ws, a0 as js, aM as qs, au as Ks, c as Js, f as Ys, ag as Qs, ah as Xs, aB as Zs, x as er, y as tr, A as or, z as nr, g as sr, h as rr, T as ir, j as ar, k as cr, l as lr, n as dr, o as ur, q as pr, s as fr, w as hr, aC as mr, aH as kr, B as br, C as gr, H as Br, I as yr, J as Cr, K as Sr, aE as xr, aI as Er, M as Pr, D as Tr, G as wr, S as Mr, O as vr, Q as Ir, W as Ar, U as Nr, _ as Lr, Z as _r, a2 as Dr, Y as Or, X as $r, R as Hr, $ as Fr, m as Vr, aN as Ur, ac as zr, aK as Rr, az as Gr, ab as Wr, af as jr, i as qr, ay as Kr, aD as Jr, ae as Yr, a7 as Qr, t as Xr, u as Zr, v as ei, aa as ti, aJ as oi, ai as ni, aL as si, a1 as ri, V as ii, p as ai, a3 as ci, aF as li, L as di, aO as ui, P as pi, aA as fi } from "./defaultBlocks-ZzGbYgQn.js";
|
|
10
10
|
import { l as it, m as Be, n as at, o as ct, p as lt, d as Y, F as dt, Y as ut, a as pt, b as ft, S as ht, B as ye, c as mt, L as kt, N as bt, P as gt, h as Bt, k as yt, H as Ct, j as St, f as xt, V as Et, e as Pt } from "./TrailingNode-GzE59m_7.js";
|
|
11
|
-
import { D as
|
|
12
|
-
import { s as Tt, B as
|
|
13
|
-
import { C as
|
|
14
|
-
import { Node as O, Extension as T, mergeAttributes as
|
|
11
|
+
import { D as mi, g as ki, T as bi, i as gi, s as Bi, t as yi } from "./TrailingNode-GzE59m_7.js";
|
|
12
|
+
import { s as Tt, B as wt } from "./BlockNoteSchema-ooiKsd5B.js";
|
|
13
|
+
import { C as Si, b as xi, c as Ei, a as Pi, g as Ti, u as wi, w as Mi } from "./BlockNoteSchema-ooiKsd5B.js";
|
|
14
|
+
import { Node as O, Extension as T, mergeAttributes as Mt, Mark as te, extensions as N, isNodeSelection as vt, posToDOMRect as It, selectionToInsertionEnd as At, findParentNodeClosestToPos as Nt, getSchema as Lt, createDocument as _t, Editor as Dt } from "@tiptap/core";
|
|
15
15
|
import { E as Ce } from "./EventEmitter-CjSwpTbz.js";
|
|
16
|
-
import { Fragment as R, Slice as
|
|
16
|
+
import { Fragment as R, Slice as W } from "@tiptap/pm/model";
|
|
17
17
|
import { e as Ot } from "./en-njEqD7AG.js";
|
|
18
18
|
import { inputRules as $t, InputRule as Ht } from "@handlewithcare/prosemirror-inputrules";
|
|
19
19
|
import { keymap as Ft } from "@tiptap/pm/keymap";
|
|
20
20
|
import { c as Vt, o as Ut } from "./BlockNoteExtension-C2X7LW-V.js";
|
|
21
|
-
import { a as
|
|
21
|
+
import { a as Ii } from "./BlockNoteExtension-C2X7LW-V.js";
|
|
22
22
|
import { Gapcursor as zt } from "@tiptap/extensions/gap-cursor";
|
|
23
23
|
import { Link as Rt } from "@tiptap/extension-link";
|
|
24
24
|
import { Text as Gt } from "@tiptap/extension-text";
|
|
25
25
|
import { NodeSelection as $, TextSelection as S, Plugin as oe } from "prosemirror-state";
|
|
26
26
|
import { CellSelection as ne, TableMap as re } from "prosemirror-tables";
|
|
27
|
-
import { S as
|
|
28
|
-
import
|
|
27
|
+
import { S as Wt } from "./ShowSelection-B0ch3unP.js";
|
|
28
|
+
import jt from "remark-gfm";
|
|
29
29
|
import qt from "remark-parse";
|
|
30
30
|
import Kt, { defaultHandlers as ie } from "remark-rehype";
|
|
31
31
|
import Jt from "rehype-stringify";
|
|
32
32
|
import { unified as Yt } from "unified";
|
|
33
33
|
import { TextSelection as Qt } from "@tiptap/pm/state";
|
|
34
|
-
function Xt(
|
|
34
|
+
function Xt(o, e) {
|
|
35
35
|
const t = [
|
|
36
36
|
{
|
|
37
|
-
tag: `[data-inline-content-type="${
|
|
38
|
-
contentElement: (
|
|
39
|
-
const s =
|
|
37
|
+
tag: `[data-inline-content-type="${o.type}"]`,
|
|
38
|
+
contentElement: (n) => {
|
|
39
|
+
const s = n;
|
|
40
40
|
return s.matches("[data-editable]") ? s : s.querySelector("[data-editable]") || s;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
];
|
|
44
44
|
return e && t.push({
|
|
45
45
|
tag: "*",
|
|
46
|
-
getAttrs(
|
|
47
|
-
if (typeof
|
|
46
|
+
getAttrs(n) {
|
|
47
|
+
if (typeof n == "string")
|
|
48
48
|
return !1;
|
|
49
|
-
const s = e == null ? void 0 : e(
|
|
49
|
+
const s = e == null ? void 0 : e(n);
|
|
50
50
|
return s === void 0 ? !1 : s;
|
|
51
51
|
}
|
|
52
52
|
}), t;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
var
|
|
54
|
+
function ps(o, e) {
|
|
55
|
+
var n;
|
|
56
56
|
const t = O.create({
|
|
57
|
-
name:
|
|
57
|
+
name: o.type,
|
|
58
58
|
inline: !0,
|
|
59
59
|
group: "inline",
|
|
60
|
-
draggable: (
|
|
61
|
-
selectable:
|
|
62
|
-
atom:
|
|
63
|
-
content:
|
|
60
|
+
draggable: (n = e.meta) == null ? void 0 : n.draggable,
|
|
61
|
+
selectable: o.content === "styled",
|
|
62
|
+
atom: o.content === "none",
|
|
63
|
+
content: o.content === "styled" ? "inline*" : "",
|
|
64
64
|
addAttributes() {
|
|
65
|
-
return Ye(
|
|
65
|
+
return Ye(o.propSchema);
|
|
66
66
|
},
|
|
67
67
|
addKeyboardShortcuts() {
|
|
68
|
-
return Je(
|
|
68
|
+
return Je(o);
|
|
69
69
|
},
|
|
70
70
|
parseHTML() {
|
|
71
71
|
return Xt(
|
|
72
|
-
|
|
72
|
+
o,
|
|
73
73
|
e.parse
|
|
74
74
|
);
|
|
75
75
|
},
|
|
@@ -88,9 +88,9 @@ function ls(n, e) {
|
|
|
88
88
|
);
|
|
89
89
|
return G(
|
|
90
90
|
i,
|
|
91
|
-
|
|
91
|
+
o.type,
|
|
92
92
|
s.attrs,
|
|
93
|
-
|
|
93
|
+
o.propSchema
|
|
94
94
|
);
|
|
95
95
|
},
|
|
96
96
|
addNodeView() {
|
|
@@ -113,16 +113,16 @@ function ls(n, e) {
|
|
|
113
113
|
);
|
|
114
114
|
return G(
|
|
115
115
|
a,
|
|
116
|
-
|
|
116
|
+
o.type,
|
|
117
117
|
r.attrs,
|
|
118
|
-
|
|
118
|
+
o.propSchema
|
|
119
119
|
);
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
return Qe(
|
|
124
124
|
t,
|
|
125
|
-
|
|
125
|
+
o.propSchema,
|
|
126
126
|
{
|
|
127
127
|
...e,
|
|
128
128
|
toExternalHTML: e.toExternalHTML,
|
|
@@ -134,76 +134,76 @@ function ls(n, e) {
|
|
|
134
134
|
);
|
|
135
135
|
return G(
|
|
136
136
|
l,
|
|
137
|
-
|
|
137
|
+
o.type,
|
|
138
138
|
s.props,
|
|
139
|
-
|
|
139
|
+
o.propSchema
|
|
140
140
|
);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
);
|
|
144
144
|
}
|
|
145
|
-
function Zt(
|
|
146
|
-
const s = typeof t == "string" ? t : t.id, r = E(
|
|
145
|
+
function Zt(o, e, t, n = "before") {
|
|
146
|
+
const s = typeof t == "string" ? t : t.id, r = E(o), i = e.map(
|
|
147
147
|
(d) => Z(d, r)
|
|
148
|
-
), l = P(s,
|
|
148
|
+
), l = P(s, o.doc);
|
|
149
149
|
if (!l)
|
|
150
150
|
throw new Error(`Block with ID ${s} not found`);
|
|
151
151
|
let a = l.posBeforeNode;
|
|
152
|
-
return
|
|
153
|
-
new Re(a, a, new F(
|
|
152
|
+
return n === "after" && (a += l.node.nodeSize), o.step(
|
|
153
|
+
new Re(a, a, new F(M.from(i), 0, 0))
|
|
154
154
|
), i.map(
|
|
155
155
|
(d) => C(d, r)
|
|
156
156
|
);
|
|
157
157
|
}
|
|
158
|
-
function Q(
|
|
159
|
-
if (!
|
|
158
|
+
function Q(o) {
|
|
159
|
+
if (!o || o.type.name !== "column")
|
|
160
160
|
throw new Error("Invalid columnPos: does not point to column node.");
|
|
161
|
-
const e =
|
|
161
|
+
const e = o.firstChild;
|
|
162
162
|
if (!e)
|
|
163
163
|
throw new Error("Invalid column: does not have child node.");
|
|
164
164
|
const t = e.firstChild;
|
|
165
165
|
if (!t)
|
|
166
166
|
throw new Error("Invalid blockContainer: does not have child node.");
|
|
167
|
-
return
|
|
167
|
+
return o.childCount === 1 && e.childCount === 1 && t.type.name === "paragraph" && t.content.content.length === 0;
|
|
168
168
|
}
|
|
169
|
-
function eo(
|
|
170
|
-
const t =
|
|
171
|
-
if (!
|
|
169
|
+
function eo(o, e) {
|
|
170
|
+
const t = o.doc.resolve(e), n = t.nodeAfter;
|
|
171
|
+
if (!n || n.type.name !== "columnList")
|
|
172
172
|
throw new Error(
|
|
173
173
|
"Invalid columnListPos: does not point to columnList node."
|
|
174
174
|
);
|
|
175
|
-
for (let s =
|
|
176
|
-
const r =
|
|
175
|
+
for (let s = n.childCount - 1; s >= 0; s--) {
|
|
176
|
+
const r = o.doc.resolve(t.pos + 1).posAtIndex(s), l = o.doc.resolve(r).nodeAfter;
|
|
177
177
|
if (!l || l.type.name !== "column")
|
|
178
178
|
throw new Error("Invalid columnPos: does not point to column node.");
|
|
179
|
-
Q(l) &&
|
|
179
|
+
Q(l) && o.delete(r, r + l.nodeSize);
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
function H(
|
|
183
|
-
eo(
|
|
184
|
-
const
|
|
185
|
-
if (!
|
|
182
|
+
function H(o, e) {
|
|
183
|
+
eo(o, e);
|
|
184
|
+
const n = o.doc.resolve(e).nodeAfter;
|
|
185
|
+
if (!n || n.type.name !== "columnList")
|
|
186
186
|
throw new Error(
|
|
187
187
|
"Invalid columnListPos: does not point to columnList node."
|
|
188
188
|
);
|
|
189
|
-
if (
|
|
189
|
+
if (n.childCount > 2)
|
|
190
190
|
return;
|
|
191
|
-
if (
|
|
191
|
+
if (n.childCount < 2)
|
|
192
192
|
throw new Error("Invalid columnList: contains fewer than two children.");
|
|
193
|
-
const s = e + 1, i =
|
|
193
|
+
const s = e + 1, i = o.doc.resolve(s).nodeAfter, l = e + n.nodeSize - 1, c = o.doc.resolve(l).nodeBefore;
|
|
194
194
|
if (!i || !c)
|
|
195
195
|
throw new Error("Invalid columnList: does not contain children.");
|
|
196
196
|
const d = Q(i), u = Q(c);
|
|
197
197
|
if (d && u) {
|
|
198
|
-
|
|
198
|
+
o.delete(e, e + n.nodeSize);
|
|
199
199
|
return;
|
|
200
200
|
}
|
|
201
201
|
if (d) {
|
|
202
|
-
|
|
203
|
-
new
|
|
202
|
+
o.step(
|
|
203
|
+
new j(
|
|
204
204
|
// Replaces `columnList`.
|
|
205
205
|
e,
|
|
206
|
-
e +
|
|
206
|
+
e + n.nodeSize,
|
|
207
207
|
// Replaces with content of last `column`.
|
|
208
208
|
l - c.nodeSize + 1,
|
|
209
209
|
l - 1,
|
|
@@ -216,11 +216,11 @@ function H(n, e) {
|
|
|
216
216
|
return;
|
|
217
217
|
}
|
|
218
218
|
if (u) {
|
|
219
|
-
|
|
220
|
-
new
|
|
219
|
+
o.step(
|
|
220
|
+
new j(
|
|
221
221
|
// Replaces `columnList`.
|
|
222
222
|
e,
|
|
223
|
-
e +
|
|
223
|
+
e + n.nodeSize,
|
|
224
224
|
// Replaces with content of first `column`.
|
|
225
225
|
s + 1,
|
|
226
226
|
s + i.nodeSize - 1,
|
|
@@ -233,29 +233,29 @@ function H(n, e) {
|
|
|
233
233
|
return;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
function ae(
|
|
237
|
-
const
|
|
238
|
-
(u) => Z(u,
|
|
236
|
+
function ae(o, e, t) {
|
|
237
|
+
const n = E(o), s = t.map(
|
|
238
|
+
(u) => Z(u, n)
|
|
239
239
|
), r = new Set(
|
|
240
240
|
e.map(
|
|
241
241
|
(u) => typeof u == "string" ? u : u.id
|
|
242
242
|
)
|
|
243
243
|
), i = [], l = /* @__PURE__ */ new Set(), a = typeof e[0] == "string" ? e[0] : e[0].id;
|
|
244
244
|
let c = 0;
|
|
245
|
-
if (
|
|
245
|
+
if (o.doc.descendants((u, p) => {
|
|
246
246
|
if (r.size === 0)
|
|
247
247
|
return !1;
|
|
248
248
|
if (!u.type.isInGroup("bnBlock") || !r.has(u.attrs.id))
|
|
249
249
|
return !0;
|
|
250
|
-
if (i.push(C(u,
|
|
251
|
-
const b =
|
|
252
|
-
|
|
253
|
-
const g =
|
|
250
|
+
if (i.push(C(u, n)), r.delete(u.attrs.id), t.length > 0 && u.attrs.id === a) {
|
|
251
|
+
const b = o.doc.nodeSize;
|
|
252
|
+
o.insert(p, s);
|
|
253
|
+
const g = o.doc.nodeSize;
|
|
254
254
|
c += b - g;
|
|
255
255
|
}
|
|
256
|
-
const h =
|
|
257
|
-
f.node().type.name === "column" ? l.add(f.before(-1)) : f.node().type.name === "columnList" && l.add(f.before()), f.node().type.name === "blockGroup" && f.node(f.depth - 1).type.name !== "doc" && f.node().childCount === 1 ?
|
|
258
|
-
const m =
|
|
256
|
+
const h = o.doc.nodeSize, f = o.doc.resolve(p - c);
|
|
257
|
+
f.node().type.name === "column" ? l.add(f.before(-1)) : f.node().type.name === "columnList" && l.add(f.before()), f.node().type.name === "blockGroup" && f.node(f.depth - 1).type.name !== "doc" && f.node().childCount === 1 ? o.delete(f.before(), f.after()) : o.delete(p - c, p - c + u.nodeSize);
|
|
258
|
+
const m = o.doc.nodeSize;
|
|
259
259
|
return c += h - m, !1;
|
|
260
260
|
}), r.size > 0) {
|
|
261
261
|
const u = [...r].join(`
|
|
@@ -264,31 +264,31 @@ function ae(n, e, t) {
|
|
|
264
264
|
"Blocks with the following IDs could not be found in the editor: " + u
|
|
265
265
|
);
|
|
266
266
|
}
|
|
267
|
-
return l.forEach((u) => H(
|
|
268
|
-
(u) => C(u,
|
|
267
|
+
return l.forEach((u) => H(o, u)), { insertedBlocks: s.map(
|
|
268
|
+
(u) => C(u, n)
|
|
269
269
|
), removedBlocks: i };
|
|
270
270
|
}
|
|
271
|
-
function to(
|
|
271
|
+
function to(o, e, t, n, s) {
|
|
272
272
|
let r;
|
|
273
273
|
if (e)
|
|
274
274
|
if (typeof e == "string")
|
|
275
|
-
r = V([e],
|
|
275
|
+
r = V([e], o.pmSchema, n);
|
|
276
276
|
else if (Array.isArray(e))
|
|
277
|
-
r = V(e,
|
|
277
|
+
r = V(e, o.pmSchema, n);
|
|
278
278
|
else if (e.type === "tableContent")
|
|
279
|
-
r = Ge(e,
|
|
279
|
+
r = Ge(e, o.pmSchema);
|
|
280
280
|
else
|
|
281
281
|
throw new U(e.type);
|
|
282
282
|
else throw new Error("blockContent is required");
|
|
283
283
|
const l = ((s == null ? void 0 : s.document) ?? document).createDocumentFragment();
|
|
284
284
|
for (const a of r)
|
|
285
|
-
if (a.type.name !== "text" &&
|
|
286
|
-
const c =
|
|
285
|
+
if (a.type.name !== "text" && o.schema.inlineContentSchema[a.type.name]) {
|
|
286
|
+
const c = o.schema.inlineContentSpecs[a.type.name].implementation;
|
|
287
287
|
if (c) {
|
|
288
288
|
const d = q(
|
|
289
289
|
a,
|
|
290
|
-
|
|
291
|
-
|
|
290
|
+
o.schema.inlineContentSchema,
|
|
291
|
+
o.schema.styleSchema
|
|
292
292
|
), u = c.render.call(
|
|
293
293
|
{
|
|
294
294
|
renderType: "dom",
|
|
@@ -297,7 +297,7 @@ function to(n, e, t, o, s) {
|
|
|
297
297
|
d,
|
|
298
298
|
() => {
|
|
299
299
|
},
|
|
300
|
-
|
|
300
|
+
o
|
|
301
301
|
);
|
|
302
302
|
if (u) {
|
|
303
303
|
if (l.appendChild(u.dom), u.contentDOM) {
|
|
@@ -315,8 +315,8 @@ function to(n, e, t, o, s) {
|
|
|
315
315
|
a.textContent
|
|
316
316
|
);
|
|
317
317
|
for (const d of a.marks.toReversed())
|
|
318
|
-
if (d.type.name in
|
|
319
|
-
const u =
|
|
318
|
+
if (d.type.name in o.schema.styleSpecs) {
|
|
319
|
+
const u = o.schema.styleSpecs[d.type.name].implementation.render(d.attrs.stringValue, o);
|
|
320
320
|
u.contentDOM.appendChild(c), c = u.dom;
|
|
321
321
|
} else {
|
|
322
322
|
const u = d.type.spec.toDOM(d, !0), p = me.renderSpec(document, u);
|
|
@@ -325,46 +325,46 @@ function to(n, e, t, o, s) {
|
|
|
325
325
|
l.appendChild(c);
|
|
326
326
|
} else {
|
|
327
327
|
const c = t.serializeFragment(
|
|
328
|
-
|
|
328
|
+
M.from([a]),
|
|
329
329
|
s
|
|
330
330
|
);
|
|
331
331
|
l.appendChild(c);
|
|
332
332
|
}
|
|
333
333
|
return l;
|
|
334
334
|
}
|
|
335
|
-
function oo(
|
|
335
|
+
function oo(o, e, t, n) {
|
|
336
336
|
var u, p, h, f, m;
|
|
337
|
-
const s =
|
|
337
|
+
const s = o.pmSchema.nodes.blockContainer, r = e.props || {};
|
|
338
338
|
for (const [b, g] of Object.entries(
|
|
339
|
-
|
|
339
|
+
o.schema.blockSchema[e.type].propSchema
|
|
340
340
|
))
|
|
341
341
|
!(b in r) && g.default !== void 0 && (r[b] = g.default);
|
|
342
|
-
const i = e.children || [], a =
|
|
342
|
+
const i = e.children || [], a = o.blockImplementations[e.type].implementation.render.call(
|
|
343
343
|
{
|
|
344
344
|
renderType: "dom",
|
|
345
345
|
props: void 0
|
|
346
346
|
},
|
|
347
347
|
{ ...e, props: r, children: i },
|
|
348
|
-
|
|
348
|
+
o
|
|
349
349
|
);
|
|
350
350
|
if (a.contentDOM && e.content) {
|
|
351
351
|
const b = to(
|
|
352
|
-
|
|
352
|
+
o,
|
|
353
353
|
e.content,
|
|
354
354
|
// TODO
|
|
355
355
|
t,
|
|
356
356
|
e.type,
|
|
357
|
-
|
|
357
|
+
n
|
|
358
358
|
);
|
|
359
359
|
a.contentDOM.appendChild(b);
|
|
360
360
|
}
|
|
361
|
-
if (
|
|
361
|
+
if (o.pmSchema.nodes[e.type].isInGroup("bnBlock")) {
|
|
362
362
|
if (e.children && e.children.length > 0) {
|
|
363
363
|
const b = Se(
|
|
364
|
-
|
|
364
|
+
o,
|
|
365
365
|
e.children,
|
|
366
366
|
t,
|
|
367
|
-
|
|
367
|
+
n
|
|
368
368
|
);
|
|
369
369
|
(u = a.contentDOM) == null || u.append(b);
|
|
370
370
|
}
|
|
@@ -378,66 +378,66 @@ function oo(n, e, t, o) {
|
|
|
378
378
|
})
|
|
379
379
|
);
|
|
380
380
|
return (f = d.contentDOM) == null || f.appendChild(a.dom), e.children && e.children.length > 0 && ((m = d.contentDOM) == null || m.appendChild(
|
|
381
|
-
xe(
|
|
381
|
+
xe(o, e.children, t, n)
|
|
382
382
|
)), d.dom;
|
|
383
383
|
}
|
|
384
|
-
function Se(
|
|
385
|
-
const r = ((
|
|
384
|
+
function Se(o, e, t, n) {
|
|
385
|
+
const r = ((n == null ? void 0 : n.document) ?? document).createDocumentFragment();
|
|
386
386
|
for (const i of e) {
|
|
387
|
-
const l = oo(
|
|
387
|
+
const l = oo(o, i, t, n);
|
|
388
388
|
r.appendChild(l);
|
|
389
389
|
}
|
|
390
390
|
return r;
|
|
391
391
|
}
|
|
392
|
-
const xe = (
|
|
392
|
+
const xe = (o, e, t, n) => {
|
|
393
393
|
var l;
|
|
394
|
-
const s =
|
|
394
|
+
const s = o.pmSchema.nodes.blockGroup, r = s.spec.toDOM(s.create({})), i = Se(o, e, t, n);
|
|
395
395
|
return (l = r.contentDOM) == null || l.appendChild(i), r.dom;
|
|
396
|
-
}, no = (
|
|
396
|
+
}, no = (o) => (o.querySelectorAll(
|
|
397
397
|
'[data-content-type="numberedListItem"]'
|
|
398
398
|
).forEach((t) => {
|
|
399
399
|
var s, r;
|
|
400
|
-
const
|
|
400
|
+
const n = (r = (s = t.closest(".bn-block-outer")) == null ? void 0 : s.previousElementSibling) == null ? void 0 : r.querySelector(
|
|
401
401
|
'[data-content-type="numberedListItem"]'
|
|
402
402
|
);
|
|
403
|
-
if (!
|
|
403
|
+
if (!n)
|
|
404
404
|
t.setAttribute(
|
|
405
405
|
"data-index",
|
|
406
406
|
t.getAttribute("data-start") || "1"
|
|
407
407
|
);
|
|
408
408
|
else {
|
|
409
|
-
const i =
|
|
409
|
+
const i = n.getAttribute("data-index");
|
|
410
410
|
t.setAttribute(
|
|
411
411
|
"data-index",
|
|
412
412
|
(parseInt(i || "0") + 1).toString()
|
|
413
413
|
);
|
|
414
414
|
}
|
|
415
|
-
}),
|
|
415
|
+
}), o), so = (o) => (o.querySelectorAll(
|
|
416
416
|
'[data-content-type="checkListItem"] input'
|
|
417
417
|
).forEach((t) => {
|
|
418
418
|
t.disabled = !0;
|
|
419
|
-
}),
|
|
419
|
+
}), o), ro = (o) => (o.querySelectorAll(
|
|
420
420
|
'.bn-toggle-wrapper[data-show-children="false"]'
|
|
421
421
|
).forEach((t) => {
|
|
422
422
|
t.setAttribute("data-show-children", "true");
|
|
423
|
-
}),
|
|
423
|
+
}), o), io = (o) => (o.querySelectorAll('[data-content-type="table"] table').forEach((t) => {
|
|
424
424
|
t.setAttribute(
|
|
425
425
|
"style",
|
|
426
426
|
`--default-cell-min-width: ${Xe}px;`
|
|
427
427
|
), t.setAttribute("data-show-children", "true");
|
|
428
|
-
}),
|
|
428
|
+
}), o), ao = (o) => (o.querySelectorAll('[data-content-type="table"] table').forEach((t) => {
|
|
429
429
|
var r;
|
|
430
|
-
const
|
|
431
|
-
|
|
430
|
+
const n = document.createElement("div");
|
|
431
|
+
n.className = "tableWrapper";
|
|
432
432
|
const s = document.createElement("div");
|
|
433
|
-
s.className = "tableWrapper-inner",
|
|
434
|
-
}),
|
|
433
|
+
s.className = "tableWrapper-inner", n.appendChild(s), (r = t.parentElement) == null || r.appendChild(n), n.appendChild(t);
|
|
434
|
+
}), o), co = (o) => (o.querySelectorAll(
|
|
435
435
|
".bn-inline-content:empty"
|
|
436
436
|
).forEach((t) => {
|
|
437
|
-
const
|
|
438
|
-
|
|
439
|
-
}),
|
|
440
|
-
const t = me.fromSchema(
|
|
437
|
+
const n = document.createElement("span");
|
|
438
|
+
n.className = "ProseMirror-trailingBreak", n.setAttribute("style", "display: inline-block;"), t.appendChild(n);
|
|
439
|
+
}), o), lo = (o, e) => {
|
|
440
|
+
const t = me.fromSchema(o), n = [
|
|
441
441
|
no,
|
|
442
442
|
so,
|
|
443
443
|
ro,
|
|
@@ -453,14 +453,14 @@ const xe = (n, e, t, o) => {
|
|
|
453
453
|
t,
|
|
454
454
|
r
|
|
455
455
|
);
|
|
456
|
-
for (const l of
|
|
456
|
+
for (const l of n)
|
|
457
457
|
i = l(i);
|
|
458
458
|
return i.outerHTML;
|
|
459
459
|
}
|
|
460
460
|
};
|
|
461
461
|
};
|
|
462
|
-
function uo(
|
|
463
|
-
return
|
|
462
|
+
function uo(o) {
|
|
463
|
+
return o.transact((e) => {
|
|
464
464
|
const t = D(e.doc, e.selection.anchor);
|
|
465
465
|
if (e.selection instanceof ne)
|
|
466
466
|
return {
|
|
@@ -475,117 +475,117 @@ function uo(n) {
|
|
|
475
475
|
anchorBlockId: t.node.attrs.id
|
|
476
476
|
};
|
|
477
477
|
{
|
|
478
|
-
const
|
|
478
|
+
const n = D(e.doc, e.selection.head);
|
|
479
479
|
return {
|
|
480
480
|
type: "text",
|
|
481
481
|
anchorBlockId: t.node.attrs.id,
|
|
482
|
-
headBlockId:
|
|
482
|
+
headBlockId: n.node.attrs.id,
|
|
483
483
|
anchorOffset: e.selection.anchor - t.posBeforeNode,
|
|
484
|
-
headOffset: e.selection.head -
|
|
484
|
+
headOffset: e.selection.head - n.posBeforeNode
|
|
485
485
|
};
|
|
486
486
|
}
|
|
487
487
|
});
|
|
488
488
|
}
|
|
489
|
-
function po(
|
|
489
|
+
function po(o, e) {
|
|
490
490
|
var s, r;
|
|
491
|
-
const t = (s = P(e.anchorBlockId,
|
|
491
|
+
const t = (s = P(e.anchorBlockId, o.doc)) == null ? void 0 : s.posBeforeNode;
|
|
492
492
|
if (t === void 0)
|
|
493
493
|
throw new Error(
|
|
494
494
|
`Could not find block with ID ${e.anchorBlockId} to update selection`
|
|
495
495
|
);
|
|
496
|
-
let
|
|
496
|
+
let n;
|
|
497
497
|
if (e.type === "cell")
|
|
498
|
-
|
|
499
|
-
|
|
498
|
+
n = ne.create(
|
|
499
|
+
o.doc,
|
|
500
500
|
t + e.anchorCellOffset,
|
|
501
501
|
t + e.headCellOffset
|
|
502
502
|
);
|
|
503
503
|
else if (e.type === "node")
|
|
504
|
-
|
|
504
|
+
n = $.create(o.doc, t + 1);
|
|
505
505
|
else {
|
|
506
|
-
const i = (r = P(e.headBlockId,
|
|
506
|
+
const i = (r = P(e.headBlockId, o.doc)) == null ? void 0 : r.posBeforeNode;
|
|
507
507
|
if (i === void 0)
|
|
508
508
|
throw new Error(
|
|
509
509
|
`Could not find block with ID ${e.headBlockId} to update selection`
|
|
510
510
|
);
|
|
511
|
-
|
|
512
|
-
|
|
511
|
+
n = S.create(
|
|
512
|
+
o.doc,
|
|
513
513
|
t + e.anchorOffset,
|
|
514
514
|
i + e.headOffset
|
|
515
515
|
);
|
|
516
516
|
}
|
|
517
|
-
|
|
517
|
+
o.setSelection(n);
|
|
518
518
|
}
|
|
519
|
-
function X(
|
|
520
|
-
return
|
|
519
|
+
function X(o) {
|
|
520
|
+
return o.map((e) => e.type === "columnList" ? e.children.map((t) => X(t.children)).flat() : {
|
|
521
521
|
...e,
|
|
522
522
|
children: X(e.children)
|
|
523
523
|
}).flat();
|
|
524
524
|
}
|
|
525
|
-
function Ee(
|
|
526
|
-
|
|
525
|
+
function Ee(o, e, t) {
|
|
526
|
+
o.transact((n) => {
|
|
527
527
|
var i;
|
|
528
|
-
const s = ((i =
|
|
529
|
-
|
|
530
|
-
], r = uo(
|
|
531
|
-
|
|
528
|
+
const s = ((i = o.getSelection()) == null ? void 0 : i.blocks) || [
|
|
529
|
+
o.getTextCursorPosition().block
|
|
530
|
+
], r = uo(o);
|
|
531
|
+
o.removeBlocks(s), o.insertBlocks(X(s), e, t), po(n, r);
|
|
532
532
|
});
|
|
533
533
|
}
|
|
534
|
-
function Pe(
|
|
535
|
-
return !
|
|
534
|
+
function Pe(o) {
|
|
535
|
+
return !o || o.type !== "columnList";
|
|
536
536
|
}
|
|
537
|
-
function Te(
|
|
538
|
-
let
|
|
539
|
-
if (e ? e.children.length > 0 ? (
|
|
537
|
+
function Te(o, e, t) {
|
|
538
|
+
let n, s;
|
|
539
|
+
if (e ? e.children.length > 0 ? (n = e.children[e.children.length - 1], s = "after") : (n = e, s = "before") : t && (n = t, s = "before"), !n || !s)
|
|
540
540
|
return;
|
|
541
|
-
const r =
|
|
542
|
-
return Pe(r) ? { referenceBlock:
|
|
543
|
-
|
|
544
|
-
s === "after" ?
|
|
541
|
+
const r = o.getParentBlock(n);
|
|
542
|
+
return Pe(r) ? { referenceBlock: n, placement: s } : Te(
|
|
543
|
+
o,
|
|
544
|
+
s === "after" ? n : o.getPrevBlock(n),
|
|
545
545
|
r
|
|
546
546
|
);
|
|
547
547
|
}
|
|
548
|
-
function
|
|
549
|
-
let
|
|
550
|
-
if (e ? e.children.length > 0 ? (
|
|
548
|
+
function we(o, e, t) {
|
|
549
|
+
let n, s;
|
|
550
|
+
if (e ? e.children.length > 0 ? (n = e.children[0], s = "before") : (n = e, s = "after") : t && (n = t, s = "after"), !n || !s)
|
|
551
551
|
return;
|
|
552
|
-
const r =
|
|
553
|
-
return Pe(r) ? { referenceBlock:
|
|
554
|
-
|
|
555
|
-
s === "before" ?
|
|
552
|
+
const r = o.getParentBlock(n);
|
|
553
|
+
return Pe(r) ? { referenceBlock: n, placement: s } : we(
|
|
554
|
+
o,
|
|
555
|
+
s === "before" ? n : o.getNextBlock(n),
|
|
556
556
|
r
|
|
557
557
|
);
|
|
558
558
|
}
|
|
559
|
-
function fo(
|
|
560
|
-
|
|
561
|
-
const e =
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
559
|
+
function fo(o) {
|
|
560
|
+
o.transact(() => {
|
|
561
|
+
const e = o.getSelection(), t = (e == null ? void 0 : e.blocks[0]) || o.getTextCursorPosition().block, n = Te(
|
|
562
|
+
o,
|
|
563
|
+
o.getPrevBlock(t),
|
|
564
|
+
o.getParentBlock(t)
|
|
565
565
|
);
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
566
|
+
n && Ee(
|
|
567
|
+
o,
|
|
568
|
+
n.referenceBlock,
|
|
569
|
+
n.placement
|
|
570
570
|
);
|
|
571
571
|
});
|
|
572
572
|
}
|
|
573
|
-
function ho(
|
|
574
|
-
|
|
575
|
-
const e =
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
573
|
+
function ho(o) {
|
|
574
|
+
o.transact(() => {
|
|
575
|
+
const e = o.getSelection(), t = (e == null ? void 0 : e.blocks[(e == null ? void 0 : e.blocks.length) - 1]) || o.getTextCursorPosition().block, n = we(
|
|
576
|
+
o,
|
|
577
|
+
o.getNextBlock(t),
|
|
578
|
+
o.getParentBlock(t)
|
|
579
579
|
);
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
580
|
+
n && Ee(
|
|
581
|
+
o,
|
|
582
|
+
n.referenceBlock,
|
|
583
|
+
n.placement
|
|
584
584
|
);
|
|
585
585
|
});
|
|
586
586
|
}
|
|
587
|
-
function mo(
|
|
588
|
-
const { $from:
|
|
587
|
+
function mo(o, e, t) {
|
|
588
|
+
const { $from: n, $to: s } = o.selection, r = n.blockRange(
|
|
589
589
|
s,
|
|
590
590
|
(f) => f.childCount > 0 && (f.type.name === "blockGroup" || f.type.name === "column")
|
|
591
591
|
// change necessary to not look at first item child type
|
|
@@ -598,16 +598,16 @@ function mo(n, e, t) {
|
|
|
598
598
|
const a = r.parent.child(i - 1);
|
|
599
599
|
if (a.type !== e)
|
|
600
600
|
return !1;
|
|
601
|
-
const c = a.lastChild && a.lastChild.type === t, d =
|
|
602
|
-
|
|
603
|
-
e.create(null,
|
|
601
|
+
const c = a.lastChild && a.lastChild.type === t, d = M.from(c ? e.create() : null), u = new F(
|
|
602
|
+
M.from(
|
|
603
|
+
e.create(null, M.from(t.create(null, d)))
|
|
604
604
|
// change necessary to create "groupType" instead of parent.type
|
|
605
605
|
),
|
|
606
606
|
c ? 3 : 1,
|
|
607
607
|
0
|
|
608
608
|
), p = r.start, h = r.end;
|
|
609
|
-
return
|
|
610
|
-
new
|
|
609
|
+
return o.step(
|
|
610
|
+
new j(
|
|
611
611
|
p - (c ? 3 : 1),
|
|
612
612
|
h,
|
|
613
613
|
p,
|
|
@@ -618,58 +618,58 @@ function mo(n, e, t) {
|
|
|
618
618
|
)
|
|
619
619
|
).scrollIntoView(), !0;
|
|
620
620
|
}
|
|
621
|
-
function
|
|
622
|
-
return
|
|
621
|
+
function Me(o) {
|
|
622
|
+
return o.transact((e) => mo(
|
|
623
623
|
e,
|
|
624
|
-
|
|
625
|
-
|
|
624
|
+
o.pmSchema.nodes.blockContainer,
|
|
625
|
+
o.pmSchema.nodes.blockGroup
|
|
626
626
|
));
|
|
627
627
|
}
|
|
628
|
-
function ko(
|
|
629
|
-
|
|
628
|
+
function ko(o) {
|
|
629
|
+
o._tiptapEditor.commands.liftListItem("blockContainer");
|
|
630
630
|
}
|
|
631
|
-
function bo(
|
|
632
|
-
return
|
|
631
|
+
function bo(o) {
|
|
632
|
+
return o.transact((e) => {
|
|
633
633
|
const { bnBlock: t } = z(e);
|
|
634
634
|
return e.doc.resolve(t.beforePos).nodeBefore !== null;
|
|
635
635
|
});
|
|
636
636
|
}
|
|
637
|
-
function go(
|
|
638
|
-
return
|
|
637
|
+
function go(o) {
|
|
638
|
+
return o.transact((e) => {
|
|
639
639
|
const { bnBlock: t } = z(e);
|
|
640
640
|
return e.doc.resolve(t.beforePos).depth > 1;
|
|
641
641
|
});
|
|
642
642
|
}
|
|
643
|
-
function Bo(
|
|
644
|
-
const t = typeof e == "string" ? e : e.id,
|
|
643
|
+
function Bo(o, e) {
|
|
644
|
+
const t = typeof e == "string" ? e : e.id, n = E(o), s = P(t, o);
|
|
645
645
|
if (s)
|
|
646
|
-
return C(s.node,
|
|
646
|
+
return C(s.node, n);
|
|
647
647
|
}
|
|
648
|
-
function yo(
|
|
649
|
-
const t = typeof e == "string" ? e : e.id,
|
|
650
|
-
if (!
|
|
648
|
+
function yo(o, e) {
|
|
649
|
+
const t = typeof e == "string" ? e : e.id, n = P(t, o), s = E(o);
|
|
650
|
+
if (!n)
|
|
651
651
|
return;
|
|
652
|
-
const i =
|
|
652
|
+
const i = o.resolve(n.posBeforeNode).nodeBefore;
|
|
653
653
|
if (i)
|
|
654
654
|
return C(i, s);
|
|
655
655
|
}
|
|
656
|
-
function Co(
|
|
657
|
-
const t = typeof e == "string" ? e : e.id,
|
|
658
|
-
if (!
|
|
656
|
+
function Co(o, e) {
|
|
657
|
+
const t = typeof e == "string" ? e : e.id, n = P(t, o), s = E(o);
|
|
658
|
+
if (!n)
|
|
659
659
|
return;
|
|
660
|
-
const i =
|
|
661
|
-
|
|
660
|
+
const i = o.resolve(
|
|
661
|
+
n.posBeforeNode + n.node.nodeSize
|
|
662
662
|
).nodeAfter;
|
|
663
663
|
if (i)
|
|
664
664
|
return C(i, s);
|
|
665
665
|
}
|
|
666
|
-
function So(
|
|
667
|
-
const t = typeof e == "string" ? e : e.id,
|
|
666
|
+
function So(o, e) {
|
|
667
|
+
const t = typeof e == "string" ? e : e.id, n = E(o), s = P(t, o);
|
|
668
668
|
if (!s)
|
|
669
669
|
return;
|
|
670
|
-
const r =
|
|
670
|
+
const r = o.resolve(s.posBeforeNode), i = r.node(), l = r.node(-1), a = l.type.name !== "doc" ? i.type.name === "blockGroup" ? l : i : void 0;
|
|
671
671
|
if (a)
|
|
672
|
-
return C(a,
|
|
672
|
+
return C(a, n);
|
|
673
673
|
}
|
|
674
674
|
class xo {
|
|
675
675
|
constructor(e) {
|
|
@@ -680,7 +680,7 @@ class xo {
|
|
|
680
680
|
* @returns A snapshot of all top-level (non-nested) blocks in the editor.
|
|
681
681
|
*/
|
|
682
682
|
get document() {
|
|
683
|
-
return this.editor.transact((e) =>
|
|
683
|
+
return this.editor.transact((e) => We(e.doc, this.editor.pmSchema));
|
|
684
684
|
}
|
|
685
685
|
/**
|
|
686
686
|
* Gets a snapshot of an existing block from the editor.
|
|
@@ -733,8 +733,8 @@ class xo {
|
|
|
733
733
|
* @param reverse Whether the blocks should be traversed in reverse order.
|
|
734
734
|
*/
|
|
735
735
|
forEachBlock(e, t = !1) {
|
|
736
|
-
const
|
|
737
|
-
t &&
|
|
736
|
+
const n = this.document.slice();
|
|
737
|
+
t && n.reverse();
|
|
738
738
|
function s(r) {
|
|
739
739
|
for (const i of r) {
|
|
740
740
|
if (e(i) === !1)
|
|
@@ -745,7 +745,7 @@ class xo {
|
|
|
745
745
|
}
|
|
746
746
|
return !0;
|
|
747
747
|
}
|
|
748
|
-
s(
|
|
748
|
+
s(n);
|
|
749
749
|
}
|
|
750
750
|
/**
|
|
751
751
|
* Inserts new blocks into the editor. If a block's `id` is undefined, BlockNote generates one automatically. Throws an
|
|
@@ -755,9 +755,9 @@ class xo {
|
|
|
755
755
|
* @param placement Whether the blocks should be inserted just before, just after, or nested inside the
|
|
756
756
|
* `referenceBlock`.
|
|
757
757
|
*/
|
|
758
|
-
insertBlocks(e, t,
|
|
758
|
+
insertBlocks(e, t, n = "before") {
|
|
759
759
|
return this.editor.transact(
|
|
760
|
-
(s) => Zt(s, e, t,
|
|
760
|
+
(s) => Zt(s, e, t, n)
|
|
761
761
|
);
|
|
762
762
|
}
|
|
763
763
|
/**
|
|
@@ -768,7 +768,7 @@ class xo {
|
|
|
768
768
|
* @param update A partial block which defines how the existing block should be changed.
|
|
769
769
|
*/
|
|
770
770
|
updateBlock(e, t) {
|
|
771
|
-
return this.editor.transact((
|
|
771
|
+
return this.editor.transact((n) => Ze(n, e, t));
|
|
772
772
|
}
|
|
773
773
|
/**
|
|
774
774
|
* Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
|
|
@@ -788,7 +788,7 @@ class xo {
|
|
|
788
788
|
*/
|
|
789
789
|
replaceBlocks(e, t) {
|
|
790
790
|
return this.editor.transact(
|
|
791
|
-
(
|
|
791
|
+
(n) => ae(n, e, t)
|
|
792
792
|
);
|
|
793
793
|
}
|
|
794
794
|
/**
|
|
@@ -801,7 +801,7 @@ class xo {
|
|
|
801
801
|
* Nests the block containing the text cursor into the block above it.
|
|
802
802
|
*/
|
|
803
803
|
nestBlock() {
|
|
804
|
-
|
|
804
|
+
Me(this.editor);
|
|
805
805
|
}
|
|
806
806
|
/**
|
|
807
807
|
* Checks if the block containing the text cursor is nested.
|
|
@@ -837,8 +837,8 @@ class Eo extends Ce {
|
|
|
837
837
|
super(), this.editor = e, e.on("create", () => {
|
|
838
838
|
e._tiptapEditor.on(
|
|
839
839
|
"update",
|
|
840
|
-
({ transaction: t, appendedTransactions:
|
|
841
|
-
this.emit("onChange", { editor: e, transaction: t, appendedTransactions:
|
|
840
|
+
({ transaction: t, appendedTransactions: n }) => {
|
|
841
|
+
this.emit("onChange", { editor: e, transaction: t, appendedTransactions: n });
|
|
842
842
|
}
|
|
843
843
|
), e._tiptapEditor.on("selectionUpdate", ({ transaction: t }) => {
|
|
844
844
|
this.emit("onSelectionChange", { editor: e, transaction: t });
|
|
@@ -853,7 +853,7 @@ class Eo extends Ce {
|
|
|
853
853
|
* Register a callback that will be called when the editor changes.
|
|
854
854
|
*/
|
|
855
855
|
onChange(e, t = !0) {
|
|
856
|
-
const
|
|
856
|
+
const n = ({
|
|
857
857
|
transaction: s,
|
|
858
858
|
appendedTransactions: r
|
|
859
859
|
}) => {
|
|
@@ -866,19 +866,19 @@ class Eo extends Ce {
|
|
|
866
866
|
}
|
|
867
867
|
});
|
|
868
868
|
};
|
|
869
|
-
return this.on("onChange",
|
|
870
|
-
this.off("onChange",
|
|
869
|
+
return this.on("onChange", n), () => {
|
|
870
|
+
this.off("onChange", n);
|
|
871
871
|
};
|
|
872
872
|
}
|
|
873
873
|
/**
|
|
874
874
|
* Register a callback that will be called when the selection changes.
|
|
875
875
|
*/
|
|
876
876
|
onSelectionChange(e, t = !1) {
|
|
877
|
-
const
|
|
877
|
+
const n = (s) => {
|
|
878
878
|
!t && ce(s.transaction) || e(this.editor);
|
|
879
879
|
};
|
|
880
|
-
return this.on("onSelectionChange",
|
|
881
|
-
this.off("onSelectionChange",
|
|
880
|
+
return this.on("onSelectionChange", n), () => {
|
|
881
|
+
this.off("onSelectionChange", n);
|
|
882
882
|
};
|
|
883
883
|
}
|
|
884
884
|
/**
|
|
@@ -898,118 +898,158 @@ class Eo extends Ce {
|
|
|
898
898
|
};
|
|
899
899
|
}
|
|
900
900
|
}
|
|
901
|
-
function ce(
|
|
902
|
-
return !!
|
|
901
|
+
function ce(o) {
|
|
902
|
+
return !!o.getMeta("y-sync$");
|
|
903
903
|
}
|
|
904
|
-
function Po(
|
|
905
|
-
return Array.prototype.indexOf.call(
|
|
904
|
+
function Po(o) {
|
|
905
|
+
return Array.prototype.indexOf.call(o.parentElement.childNodes, o);
|
|
906
906
|
}
|
|
907
|
-
function To(
|
|
908
|
-
return
|
|
907
|
+
function To(o) {
|
|
908
|
+
return o.nodeType === 3 && !/\S/.test(o.nodeValue || "");
|
|
909
909
|
}
|
|
910
|
-
function
|
|
911
|
-
|
|
912
|
-
const t = Po(e),
|
|
910
|
+
function wo(o) {
|
|
911
|
+
o.querySelectorAll("li > ul, li > ol").forEach((e) => {
|
|
912
|
+
const t = Po(e), n = e.parentElement, s = Array.from(n.childNodes).slice(
|
|
913
913
|
t + 1
|
|
914
914
|
);
|
|
915
915
|
e.remove(), s.forEach((r) => {
|
|
916
916
|
r.remove();
|
|
917
|
-
}),
|
|
917
|
+
}), n.insertAdjacentElement("afterend", e), s.reverse().forEach((r) => {
|
|
918
918
|
if (To(r))
|
|
919
919
|
return;
|
|
920
920
|
const i = document.createElement("li");
|
|
921
921
|
i.append(r), e.insertAdjacentElement("afterend", i);
|
|
922
|
-
}),
|
|
922
|
+
}), n.childNodes.length === 0 && n.remove();
|
|
923
923
|
});
|
|
924
924
|
}
|
|
925
|
-
function
|
|
926
|
-
|
|
925
|
+
function Mo(o) {
|
|
926
|
+
o.querySelectorAll("li + ul, li + ol").forEach((e) => {
|
|
927
927
|
var r, i;
|
|
928
|
-
const t = e.previousElementSibling,
|
|
929
|
-
t.insertAdjacentElement("afterend",
|
|
928
|
+
const t = e.previousElementSibling, n = document.createElement("div");
|
|
929
|
+
t.insertAdjacentElement("afterend", n), n.append(t);
|
|
930
930
|
const s = document.createElement("div");
|
|
931
|
-
for (s.setAttribute("data-node-type", "blockGroup"),
|
|
932
|
-
s.append(
|
|
931
|
+
for (s.setAttribute("data-node-type", "blockGroup"), n.append(s); ((r = n.nextElementSibling) == null ? void 0 : r.nodeName) === "UL" || ((i = n.nextElementSibling) == null ? void 0 : i.nodeName) === "OL"; )
|
|
932
|
+
s.append(n.nextElementSibling);
|
|
933
933
|
});
|
|
934
934
|
}
|
|
935
935
|
let le = null;
|
|
936
936
|
function vo() {
|
|
937
937
|
return le || (le = document.implementation.createHTMLDocument("title"));
|
|
938
938
|
}
|
|
939
|
-
function Io(
|
|
940
|
-
if (typeof
|
|
939
|
+
function Io(o) {
|
|
940
|
+
if (typeof o == "string") {
|
|
941
941
|
const e = vo().createElement("div");
|
|
942
|
-
e.innerHTML =
|
|
942
|
+
e.innerHTML = o, o = e;
|
|
943
943
|
}
|
|
944
|
-
return
|
|
944
|
+
return wo(o), Mo(o), o;
|
|
945
|
+
}
|
|
946
|
+
function Ao(o) {
|
|
947
|
+
const e = o.ownerDocument.createTreeWalker(
|
|
948
|
+
o,
|
|
949
|
+
// NodeFilter.SHOW_COMMENT
|
|
950
|
+
128
|
|
951
|
+
);
|
|
952
|
+
let t;
|
|
953
|
+
for (; t = e.nextNode(); )
|
|
954
|
+
if (/^\s*notionvc:/.test(t.nodeValue || ""))
|
|
955
|
+
return !0;
|
|
956
|
+
return !1;
|
|
957
|
+
}
|
|
958
|
+
function No(o) {
|
|
959
|
+
const e = /* @__PURE__ */ new Set(["PRE", "CODE"]), t = o.ownerDocument.createTreeWalker(
|
|
960
|
+
o,
|
|
961
|
+
// NodeFilter.SHOW_TEXT
|
|
962
|
+
4,
|
|
963
|
+
{
|
|
964
|
+
acceptNode(r) {
|
|
965
|
+
let i = r.parentElement;
|
|
966
|
+
for (; i && i !== o; ) {
|
|
967
|
+
if (e.has(i.tagName))
|
|
968
|
+
return 2;
|
|
969
|
+
i = i.parentElement;
|
|
970
|
+
}
|
|
971
|
+
return 1;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
), n = [];
|
|
975
|
+
let s;
|
|
976
|
+
for (; s = t.nextNode(); )
|
|
977
|
+
n.push(s);
|
|
978
|
+
for (const r of n)
|
|
979
|
+
r.nodeValue && /[\r\n]/.test(r.nodeValue) && (r.nodeValue = r.nodeValue.replace(/[ \t\r\n\f]+/g, " "));
|
|
980
|
+
}
|
|
981
|
+
function Lo(o) {
|
|
982
|
+
Ao(o) || No(o);
|
|
945
983
|
}
|
|
946
|
-
function ve(
|
|
947
|
-
const t = Io(
|
|
984
|
+
function ve(o, e) {
|
|
985
|
+
const t = Io(o);
|
|
986
|
+
Lo(t);
|
|
987
|
+
const s = Ue.fromSchema(e).parse(t, {
|
|
948
988
|
topNode: e.nodes.blockGroup.create()
|
|
949
989
|
}), r = [];
|
|
950
990
|
for (let i = 0; i < s.childCount; i++)
|
|
951
991
|
r.push(C(s.child(i), e));
|
|
952
992
|
return r;
|
|
953
993
|
}
|
|
954
|
-
function
|
|
955
|
-
const t = e.value ? e.value : "",
|
|
956
|
-
e.lang && (
|
|
994
|
+
function _o(o, e) {
|
|
995
|
+
const t = e.value ? e.value : "", n = {};
|
|
996
|
+
e.lang && (n["data-language"] = e.lang);
|
|
957
997
|
let s = {
|
|
958
998
|
type: "element",
|
|
959
999
|
tagName: "code",
|
|
960
|
-
properties:
|
|
1000
|
+
properties: n,
|
|
961
1001
|
children: [{ type: "text", value: t }]
|
|
962
1002
|
};
|
|
963
|
-
return e.meta && (s.data = { meta: e.meta }),
|
|
1003
|
+
return e.meta && (s.data = { meta: e.meta }), o.patch(e, s), s = o.applyData(e, s), s = {
|
|
964
1004
|
type: "element",
|
|
965
1005
|
tagName: "pre",
|
|
966
1006
|
properties: {},
|
|
967
1007
|
children: [s]
|
|
968
|
-
},
|
|
1008
|
+
}, o.patch(e, s), s;
|
|
969
1009
|
}
|
|
970
|
-
function
|
|
1010
|
+
function Do(o, e) {
|
|
971
1011
|
var r;
|
|
972
|
-
const t = String((e == null ? void 0 : e.url) || ""),
|
|
1012
|
+
const t = String((e == null ? void 0 : e.url) || ""), n = e != null && e.title ? String(e.title) : void 0;
|
|
973
1013
|
let s = {
|
|
974
1014
|
type: "element",
|
|
975
1015
|
tagName: "video",
|
|
976
1016
|
properties: {
|
|
977
1017
|
src: t,
|
|
978
|
-
"data-name":
|
|
1018
|
+
"data-name": n,
|
|
979
1019
|
"data-url": t,
|
|
980
1020
|
controls: !0
|
|
981
1021
|
},
|
|
982
1022
|
children: []
|
|
983
1023
|
};
|
|
984
|
-
return (r =
|
|
1024
|
+
return (r = o.patch) == null || r.call(o, e, s), s = o.applyData ? o.applyData(e, s) : s, s;
|
|
985
1025
|
}
|
|
986
|
-
function Ie(
|
|
987
|
-
return Yt().use(qt).use(
|
|
1026
|
+
function Ie(o) {
|
|
1027
|
+
return Yt().use(qt).use(jt).use(Kt, {
|
|
988
1028
|
handlers: {
|
|
989
1029
|
...ie,
|
|
990
|
-
image: (t,
|
|
991
|
-
const s = String((
|
|
992
|
-
return et(s) ?
|
|
1030
|
+
image: (t, n) => {
|
|
1031
|
+
const s = String((n == null ? void 0 : n.url) || "");
|
|
1032
|
+
return et(s) ? Do(t, n) : ie.image(t, n);
|
|
993
1033
|
},
|
|
994
|
-
code:
|
|
995
|
-
blockquote: (t,
|
|
1034
|
+
code: _o,
|
|
1035
|
+
blockquote: (t, n) => {
|
|
996
1036
|
const s = {
|
|
997
1037
|
type: "element",
|
|
998
1038
|
tagName: "blockquote",
|
|
999
1039
|
properties: {},
|
|
1000
1040
|
// The only difference from the original is that we don't wrap the children with line endings
|
|
1001
|
-
children: t.wrap(t.all(
|
|
1041
|
+
children: t.wrap(t.all(n), !1)
|
|
1002
1042
|
};
|
|
1003
|
-
return t.patch(
|
|
1043
|
+
return t.patch(n, s), t.applyData(n, s);
|
|
1004
1044
|
}
|
|
1005
1045
|
}
|
|
1006
|
-
}).use(Jt).processSync(
|
|
1046
|
+
}).use(Jt).processSync(o).value;
|
|
1007
1047
|
}
|
|
1008
|
-
function
|
|
1009
|
-
const t = Ie(
|
|
1048
|
+
function Oo(o, e) {
|
|
1049
|
+
const t = Ie(o);
|
|
1010
1050
|
return ve(t, e);
|
|
1011
1051
|
}
|
|
1012
|
-
class
|
|
1052
|
+
class $o {
|
|
1013
1053
|
constructor(e) {
|
|
1014
1054
|
this.editor = e;
|
|
1015
1055
|
}
|
|
@@ -1068,7 +1108,7 @@ class Lo {
|
|
|
1068
1108
|
* @returns The blocks parsed from the Markdown string.
|
|
1069
1109
|
*/
|
|
1070
1110
|
tryParseMarkdownToBlocks(e) {
|
|
1071
|
-
return
|
|
1111
|
+
return Oo(e, this.editor.pmSchema);
|
|
1072
1112
|
}
|
|
1073
1113
|
/**
|
|
1074
1114
|
* Paste HTML into the editor. Defaults to converting HTML to BlockNote HTML.
|
|
@@ -1077,12 +1117,12 @@ class Lo {
|
|
|
1077
1117
|
*/
|
|
1078
1118
|
pasteHTML(e, t = !1) {
|
|
1079
1119
|
var s;
|
|
1080
|
-
let
|
|
1120
|
+
let n = e;
|
|
1081
1121
|
if (!t) {
|
|
1082
1122
|
const r = this.tryParseHTMLToBlocks(e);
|
|
1083
|
-
|
|
1123
|
+
n = this.blocksToFullHTML(r);
|
|
1084
1124
|
}
|
|
1085
|
-
|
|
1125
|
+
n && ((s = this.editor.prosemirrorView) == null || s.pasteHTML(n));
|
|
1086
1126
|
}
|
|
1087
1127
|
/**
|
|
1088
1128
|
* Paste text into the editor. Defaults to interpreting text as markdown.
|
|
@@ -1109,28 +1149,28 @@ const se = [
|
|
|
1109
1149
|
"text/plain",
|
|
1110
1150
|
"Files"
|
|
1111
1151
|
];
|
|
1112
|
-
function
|
|
1113
|
-
if (!
|
|
1152
|
+
function Ho(o, e) {
|
|
1153
|
+
if (!o.startsWith(".") || !e.startsWith("."))
|
|
1114
1154
|
throw new Error("The strings provided are not valid file extensions.");
|
|
1115
|
-
return
|
|
1155
|
+
return o === e;
|
|
1116
1156
|
}
|
|
1117
|
-
function
|
|
1118
|
-
const t =
|
|
1157
|
+
function Fo(o, e) {
|
|
1158
|
+
const t = o.split("/"), n = e.split("/");
|
|
1119
1159
|
if (t.length !== 2)
|
|
1120
|
-
throw new Error(`The string ${
|
|
1121
|
-
if (
|
|
1160
|
+
throw new Error(`The string ${o} is not a valid MIME type.`);
|
|
1161
|
+
if (n.length !== 2)
|
|
1122
1162
|
throw new Error(`The string ${e} is not a valid MIME type.`);
|
|
1123
|
-
return t[1] === "*" ||
|
|
1163
|
+
return t[1] === "*" || n[1] === "*" ? t[0] === n[0] : (t[0] === "*" || n[0] === "*" || t[0] === n[0]) && t[1] === n[1];
|
|
1124
1164
|
}
|
|
1125
|
-
function de(
|
|
1165
|
+
function de(o, e, t, n = "after") {
|
|
1126
1166
|
let s;
|
|
1127
|
-
return Array.isArray(e.content) && e.content.length === 0 ? s =
|
|
1167
|
+
return Array.isArray(e.content) && e.content.length === 0 ? s = o.updateBlock(e, t).id : s = o.insertBlocks(
|
|
1128
1168
|
[t],
|
|
1129
1169
|
e,
|
|
1130
|
-
|
|
1170
|
+
n
|
|
1131
1171
|
)[0].id, s;
|
|
1132
1172
|
}
|
|
1133
|
-
async function Ae(
|
|
1173
|
+
async function Ae(o, e) {
|
|
1134
1174
|
var r;
|
|
1135
1175
|
if (!e.uploadFile) {
|
|
1136
1176
|
console.warn(
|
|
@@ -1138,26 +1178,26 @@ async function Ae(n, e) {
|
|
|
1138
1178
|
);
|
|
1139
1179
|
return;
|
|
1140
1180
|
}
|
|
1141
|
-
const t = "dataTransfer" in
|
|
1181
|
+
const t = "dataTransfer" in o ? o.dataTransfer : o.clipboardData;
|
|
1142
1182
|
if (t === null)
|
|
1143
1183
|
return;
|
|
1144
|
-
let
|
|
1184
|
+
let n = null;
|
|
1145
1185
|
for (const i of se)
|
|
1146
1186
|
if (t.types.includes(i)) {
|
|
1147
|
-
|
|
1187
|
+
n = i;
|
|
1148
1188
|
break;
|
|
1149
1189
|
}
|
|
1150
|
-
if (
|
|
1190
|
+
if (n !== "Files")
|
|
1151
1191
|
return;
|
|
1152
1192
|
const s = t.items;
|
|
1153
1193
|
if (s) {
|
|
1154
|
-
|
|
1194
|
+
o.preventDefault();
|
|
1155
1195
|
for (let i = 0; i < s.length; i++) {
|
|
1156
1196
|
let l = "file";
|
|
1157
1197
|
for (const c of Object.values(e.schema.blockSpecs))
|
|
1158
1198
|
for (const d of ((r = c.implementation.meta) == null ? void 0 : r.fileBlockAccept) || []) {
|
|
1159
1199
|
const u = d.startsWith("."), p = s[i].getAsFile();
|
|
1160
|
-
if (p && (!u && p.type &&
|
|
1200
|
+
if (p && (!u && p.type && Fo(s[i].type, d) || u && Ho(
|
|
1161
1201
|
"." + p.name.split(".").pop(),
|
|
1162
1202
|
d
|
|
1163
1203
|
))) {
|
|
@@ -1174,13 +1214,13 @@ async function Ae(n, e) {
|
|
|
1174
1214
|
}
|
|
1175
1215
|
};
|
|
1176
1216
|
let d;
|
|
1177
|
-
if (
|
|
1217
|
+
if (o.type === "paste") {
|
|
1178
1218
|
const h = e.getTextCursorPosition().block;
|
|
1179
1219
|
d = de(e, h, c);
|
|
1180
|
-
} else if (
|
|
1220
|
+
} else if (o.type === "drop") {
|
|
1181
1221
|
const h = {
|
|
1182
|
-
left:
|
|
1183
|
-
top:
|
|
1222
|
+
left: o.clientX,
|
|
1223
|
+
top: o.clientY
|
|
1184
1224
|
}, f = e.prosemirrorView.posAtCoords(h);
|
|
1185
1225
|
if (!f)
|
|
1186
1226
|
return;
|
|
@@ -1208,7 +1248,7 @@ async function Ae(n, e) {
|
|
|
1208
1248
|
}
|
|
1209
1249
|
}
|
|
1210
1250
|
}
|
|
1211
|
-
const
|
|
1251
|
+
const Vo = (o) => T.create({
|
|
1212
1252
|
name: "dropFile",
|
|
1213
1253
|
addProseMirrorPlugins() {
|
|
1214
1254
|
return [
|
|
@@ -1216,96 +1256,96 @@ const $o = (n) => T.create({
|
|
|
1216
1256
|
props: {
|
|
1217
1257
|
handleDOMEvents: {
|
|
1218
1258
|
drop(e, t) {
|
|
1219
|
-
if (!
|
|
1259
|
+
if (!o.isEditable)
|
|
1220
1260
|
return;
|
|
1221
|
-
let
|
|
1261
|
+
let n = null;
|
|
1222
1262
|
for (const s of se)
|
|
1223
1263
|
if (t.dataTransfer.types.includes(s)) {
|
|
1224
|
-
|
|
1264
|
+
n = s;
|
|
1225
1265
|
break;
|
|
1226
1266
|
}
|
|
1227
|
-
return
|
|
1267
|
+
return n === null ? !0 : n === "Files" ? (Ae(t, o), !0) : !1;
|
|
1228
1268
|
}
|
|
1229
1269
|
}
|
|
1230
1270
|
}
|
|
1231
1271
|
})
|
|
1232
1272
|
];
|
|
1233
1273
|
}
|
|
1234
|
-
}),
|
|
1235
|
-
async function
|
|
1274
|
+
}), Uo = /(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/, zo = /(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/, Ro = /\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/, Go = /(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/, Wo = /(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/, jo = /(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/, qo = /\n{2} {0,3}-{2,48}\n{2}/, Ko = /(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/, Jo = /(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/, Yo = /(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/, Qo = /^\s*\|(.+\|)+\s*$/m, Xo = /^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m, Zo = /^\s*\|(.+\|)+\s*$/m, en = (o) => Uo.test(o) || zo.test(o) || Ro.test(o) || Go.test(o) || Wo.test(o) || jo.test(o) || qo.test(o) || Ko.test(o) || Jo.test(o) || Yo.test(o) || Qo.test(o) || Xo.test(o) || Zo.test(o);
|
|
1275
|
+
async function tn(o, e) {
|
|
1236
1276
|
const { schema: t } = e.state;
|
|
1237
|
-
if (!
|
|
1277
|
+
if (!o.clipboardData)
|
|
1238
1278
|
return !1;
|
|
1239
|
-
const
|
|
1240
|
-
if (!
|
|
1279
|
+
const n = o.clipboardData.getData("text/plain");
|
|
1280
|
+
if (!n)
|
|
1241
1281
|
return !1;
|
|
1242
1282
|
if (!t.nodes.codeBlock)
|
|
1243
|
-
return e.pasteText(
|
|
1244
|
-
const s =
|
|
1283
|
+
return e.pasteText(n), !0;
|
|
1284
|
+
const s = o.clipboardData.getData("vscode-editor-data"), r = s ? JSON.parse(s) : void 0, i = r == null ? void 0 : r.mode;
|
|
1245
1285
|
return i ? (e.pasteHTML(
|
|
1246
|
-
`<pre><code class="language-${i}">${
|
|
1286
|
+
`<pre><code class="language-${i}">${n.replace(
|
|
1247
1287
|
/\r\n?/g,
|
|
1248
1288
|
`
|
|
1249
1289
|
`
|
|
1250
1290
|
)}</code></pre>`
|
|
1251
1291
|
), !0) : !1;
|
|
1252
1292
|
}
|
|
1253
|
-
function
|
|
1254
|
-
event:
|
|
1293
|
+
function on({
|
|
1294
|
+
event: o,
|
|
1255
1295
|
editor: e,
|
|
1256
1296
|
prioritizeMarkdownOverHTML: t,
|
|
1257
|
-
plainTextAsMarkdown:
|
|
1297
|
+
plainTextAsMarkdown: n
|
|
1258
1298
|
}) {
|
|
1259
1299
|
var l;
|
|
1260
1300
|
if (e.transact(
|
|
1261
1301
|
(a) => a.selection.$from.parent.type.spec.code && a.selection.$to.parent.type.spec.code
|
|
1262
1302
|
)) {
|
|
1263
|
-
const a = (l =
|
|
1303
|
+
const a = (l = o.clipboardData) == null ? void 0 : l.getData("text/plain");
|
|
1264
1304
|
if (a)
|
|
1265
1305
|
return e.pasteText(a), !0;
|
|
1266
1306
|
}
|
|
1267
1307
|
let r;
|
|
1268
1308
|
for (const a of se)
|
|
1269
|
-
if (
|
|
1309
|
+
if (o.clipboardData.types.includes(a)) {
|
|
1270
1310
|
r = a;
|
|
1271
1311
|
break;
|
|
1272
1312
|
}
|
|
1273
1313
|
if (!r)
|
|
1274
1314
|
return !0;
|
|
1275
1315
|
if (r === "vscode-editor-data")
|
|
1276
|
-
return
|
|
1316
|
+
return tn(o, e.prosemirrorView), !0;
|
|
1277
1317
|
if (r === "Files")
|
|
1278
|
-
return Ae(
|
|
1279
|
-
const i =
|
|
1318
|
+
return Ae(o, e), !0;
|
|
1319
|
+
const i = o.clipboardData.getData(r);
|
|
1280
1320
|
if (r === "blocknote/html")
|
|
1281
1321
|
return e.pasteHTML(i, !0), !0;
|
|
1282
1322
|
if (r === "text/markdown")
|
|
1283
1323
|
return e.pasteMarkdown(i), !0;
|
|
1284
1324
|
if (t) {
|
|
1285
|
-
const a =
|
|
1286
|
-
if (
|
|
1325
|
+
const a = o.clipboardData.getData("text/plain");
|
|
1326
|
+
if (en(a))
|
|
1287
1327
|
return e.pasteMarkdown(a), !0;
|
|
1288
1328
|
}
|
|
1289
|
-
return r === "text/html" ? (e.pasteHTML(i), !0) :
|
|
1329
|
+
return r === "text/html" ? (e.pasteHTML(i), !0) : n ? (e.pasteMarkdown(i), !0) : (e.pasteText(i), !0);
|
|
1290
1330
|
}
|
|
1291
|
-
const
|
|
1331
|
+
const nn = (o, e) => T.create({
|
|
1292
1332
|
name: "pasteFromClipboard",
|
|
1293
1333
|
addProseMirrorPlugins() {
|
|
1294
1334
|
return [
|
|
1295
1335
|
new oe({
|
|
1296
1336
|
props: {
|
|
1297
1337
|
handleDOMEvents: {
|
|
1298
|
-
paste(t,
|
|
1299
|
-
if (
|
|
1338
|
+
paste(t, n) {
|
|
1339
|
+
if (n.preventDefault(), !!o.isEditable)
|
|
1300
1340
|
return e({
|
|
1301
|
-
event:
|
|
1302
|
-
editor:
|
|
1341
|
+
event: n,
|
|
1342
|
+
editor: o,
|
|
1303
1343
|
defaultPasteHandler: ({
|
|
1304
1344
|
prioritizeMarkdownOverHTML: s = !0,
|
|
1305
1345
|
plainTextAsMarkdown: r = !0
|
|
1306
|
-
} = {}) =>
|
|
1307
|
-
event:
|
|
1308
|
-
editor:
|
|
1346
|
+
} = {}) => on({
|
|
1347
|
+
event: n,
|
|
1348
|
+
editor: o,
|
|
1309
1349
|
prioritizeMarkdownOverHTML: s,
|
|
1310
1350
|
plainTextAsMarkdown: r
|
|
1311
1351
|
})
|
|
@@ -1317,30 +1357,30 @@ const en = (n, e) => T.create({
|
|
|
1317
1357
|
];
|
|
1318
1358
|
}
|
|
1319
1359
|
});
|
|
1320
|
-
function
|
|
1360
|
+
function sn(o, e, t) {
|
|
1321
1361
|
var l;
|
|
1322
|
-
let
|
|
1323
|
-
const s =
|
|
1362
|
+
let n = !1;
|
|
1363
|
+
const s = o.state.selection instanceof ne;
|
|
1324
1364
|
if (!s) {
|
|
1325
|
-
const a =
|
|
1326
|
-
|
|
1327
|
-
|
|
1365
|
+
const a = o.state.doc.slice(
|
|
1366
|
+
o.state.selection.from,
|
|
1367
|
+
o.state.selection.to,
|
|
1328
1368
|
!1
|
|
1329
1369
|
).content, c = [];
|
|
1330
1370
|
for (let d = 0; d < a.childCount; d++)
|
|
1331
1371
|
c.push(a.child(d));
|
|
1332
|
-
|
|
1372
|
+
n = c.find(
|
|
1333
1373
|
(d) => d.type.isInGroup("bnBlock") || d.type.name === "blockGroup" || d.type.spec.group === "blockContent"
|
|
1334
|
-
) === void 0,
|
|
1374
|
+
) === void 0, n && (e = a);
|
|
1335
1375
|
}
|
|
1336
1376
|
let r;
|
|
1337
1377
|
const i = Be(
|
|
1338
|
-
|
|
1378
|
+
o.state.schema,
|
|
1339
1379
|
t
|
|
1340
1380
|
);
|
|
1341
1381
|
if (s) {
|
|
1342
1382
|
((l = e.firstChild) == null ? void 0 : l.type.name) === "table" && (e = e.firstChild.content);
|
|
1343
|
-
const a =
|
|
1383
|
+
const a = je(
|
|
1344
1384
|
e,
|
|
1345
1385
|
t.schema.inlineContentSchema,
|
|
1346
1386
|
t.schema.styleSchema
|
|
@@ -1349,7 +1389,7 @@ function tn(n, e, t) {
|
|
|
1349
1389
|
a,
|
|
1350
1390
|
{}
|
|
1351
1391
|
)}</table>`;
|
|
1352
|
-
} else if (
|
|
1392
|
+
} else if (n) {
|
|
1353
1393
|
const a = qe(
|
|
1354
1394
|
e,
|
|
1355
1395
|
t.schema.inlineContentSchema,
|
|
@@ -1362,40 +1402,40 @@ function tn(n, e, t) {
|
|
|
1362
1402
|
}
|
|
1363
1403
|
return r;
|
|
1364
1404
|
}
|
|
1365
|
-
function Ne(
|
|
1366
|
-
"node" in
|
|
1405
|
+
function Ne(o, e) {
|
|
1406
|
+
"node" in o.state.selection && o.state.selection.node.type.spec.group === "blockContent" && e.transact(
|
|
1367
1407
|
(i) => i.setSelection(
|
|
1368
|
-
new $(i.doc.resolve(
|
|
1408
|
+
new $(i.doc.resolve(o.state.selection.from - 1))
|
|
1369
1409
|
)
|
|
1370
1410
|
);
|
|
1371
|
-
const t =
|
|
1372
|
-
|
|
1373
|
-
).dom.innerHTML,
|
|
1374
|
-
n,
|
|
1411
|
+
const t = o.serializeForClipboard(
|
|
1412
|
+
o.state.selection.content()
|
|
1413
|
+
).dom.innerHTML, n = o.state.selection.content().content, s = sn(
|
|
1375
1414
|
o,
|
|
1415
|
+
n,
|
|
1376
1416
|
e
|
|
1377
1417
|
), r = ct(s);
|
|
1378
1418
|
return { clipboardHTML: t, externalHTML: s, markdown: r };
|
|
1379
1419
|
}
|
|
1380
1420
|
const ue = () => {
|
|
1381
|
-
const
|
|
1382
|
-
if (!
|
|
1421
|
+
const o = window.getSelection();
|
|
1422
|
+
if (!o || o.isCollapsed)
|
|
1383
1423
|
return !0;
|
|
1384
|
-
let e =
|
|
1424
|
+
let e = o.focusNode;
|
|
1385
1425
|
for (; e; ) {
|
|
1386
1426
|
if (e instanceof HTMLElement && e.getAttribute("contenteditable") === "false")
|
|
1387
1427
|
return !0;
|
|
1388
1428
|
e = e.parentElement;
|
|
1389
1429
|
}
|
|
1390
1430
|
return !1;
|
|
1391
|
-
}, pe = (
|
|
1431
|
+
}, pe = (o, e, t) => {
|
|
1392
1432
|
t.preventDefault(), t.clipboardData.clearData();
|
|
1393
|
-
const { clipboardHTML:
|
|
1433
|
+
const { clipboardHTML: n, externalHTML: s, markdown: r } = Ne(
|
|
1394
1434
|
e,
|
|
1395
|
-
|
|
1435
|
+
o
|
|
1396
1436
|
);
|
|
1397
|
-
t.clipboardData.setData("blocknote/html",
|
|
1398
|
-
},
|
|
1437
|
+
t.clipboardData.setData("blocknote/html", n), t.clipboardData.setData("text/html", s), t.clipboardData.setData("text/plain", r);
|
|
1438
|
+
}, rn = (o) => T.create({
|
|
1399
1439
|
name: "copyToClipboard",
|
|
1400
1440
|
addProseMirrorPlugins() {
|
|
1401
1441
|
return [
|
|
@@ -1403,10 +1443,10 @@ const ue = () => {
|
|
|
1403
1443
|
props: {
|
|
1404
1444
|
handleDOMEvents: {
|
|
1405
1445
|
copy(e, t) {
|
|
1406
|
-
return ue() || pe(
|
|
1446
|
+
return ue() || pe(o, e, t), !0;
|
|
1407
1447
|
},
|
|
1408
1448
|
cut(e, t) {
|
|
1409
|
-
return ue() || (pe(
|
|
1449
|
+
return ue() || (pe(o, e, t), e.editable && e.dispatch(e.state.tr.deleteSelection())), !0;
|
|
1410
1450
|
},
|
|
1411
1451
|
// This is for the use-case in which only a block without content
|
|
1412
1452
|
// is selected, e.g. an image block, and dragged (not using the
|
|
@@ -1414,22 +1454,22 @@ const ue = () => {
|
|
|
1414
1454
|
dragstart(e, t) {
|
|
1415
1455
|
if (!("node" in e.state.selection) || e.state.selection.node.type.spec.group !== "blockContent")
|
|
1416
1456
|
return;
|
|
1417
|
-
|
|
1457
|
+
o.transact(
|
|
1418
1458
|
(i) => i.setSelection(
|
|
1419
1459
|
new $(
|
|
1420
1460
|
i.doc.resolve(e.state.selection.from - 1)
|
|
1421
1461
|
)
|
|
1422
1462
|
)
|
|
1423
1463
|
), t.preventDefault(), t.dataTransfer.clearData();
|
|
1424
|
-
const { clipboardHTML:
|
|
1425
|
-
return t.dataTransfer.setData("blocknote/html",
|
|
1464
|
+
const { clipboardHTML: n, externalHTML: s, markdown: r } = Ne(e, o);
|
|
1465
|
+
return t.dataTransfer.setData("blocknote/html", n), t.dataTransfer.setData("text/html", s), t.dataTransfer.setData("text/plain", r), !0;
|
|
1426
1466
|
}
|
|
1427
1467
|
}
|
|
1428
1468
|
}
|
|
1429
1469
|
})
|
|
1430
1470
|
];
|
|
1431
1471
|
}
|
|
1432
|
-
}),
|
|
1472
|
+
}), an = T.create({
|
|
1433
1473
|
name: "blockBackgroundColor",
|
|
1434
1474
|
addGlobalAttributes() {
|
|
1435
1475
|
return [
|
|
@@ -1441,7 +1481,7 @@ const ue = () => {
|
|
|
1441
1481
|
}
|
|
1442
1482
|
];
|
|
1443
1483
|
}
|
|
1444
|
-
}),
|
|
1484
|
+
}), cn = O.create({
|
|
1445
1485
|
name: "hardBreak",
|
|
1446
1486
|
inline: !0,
|
|
1447
1487
|
group: "inline",
|
|
@@ -1451,91 +1491,91 @@ const ue = () => {
|
|
|
1451
1491
|
parseHTML() {
|
|
1452
1492
|
return [{ tag: "br" }];
|
|
1453
1493
|
},
|
|
1454
|
-
renderHTML({ HTMLAttributes:
|
|
1455
|
-
return ["br",
|
|
1494
|
+
renderHTML({ HTMLAttributes: o }) {
|
|
1495
|
+
return ["br", Mt(this.options.HTMLAttributes, o)];
|
|
1456
1496
|
},
|
|
1457
1497
|
renderText() {
|
|
1458
1498
|
return `
|
|
1459
1499
|
`;
|
|
1460
1500
|
}
|
|
1461
|
-
}),
|
|
1501
|
+
}), Le = (o, e) => {
|
|
1462
1502
|
var l;
|
|
1463
|
-
const t =
|
|
1503
|
+
const t = o.resolve(e), n = t.depth - 1, s = t.before(n), r = o.resolve(s).nodeAfter;
|
|
1464
1504
|
return r ? (l = r.type.spec.group) != null && l.includes("bnBlock") ? v(
|
|
1465
|
-
|
|
1466
|
-
) :
|
|
1467
|
-
},
|
|
1468
|
-
const t =
|
|
1469
|
-
if (
|
|
1505
|
+
o.resolve(s)
|
|
1506
|
+
) : Le(o, s) : void 0;
|
|
1507
|
+
}, _ = (o, e) => {
|
|
1508
|
+
const t = o.resolve(e), n = t.index();
|
|
1509
|
+
if (n === 0)
|
|
1470
1510
|
return;
|
|
1471
|
-
const s = t.posAtIndex(
|
|
1511
|
+
const s = t.posAtIndex(n - 1);
|
|
1472
1512
|
return v(
|
|
1473
|
-
|
|
1513
|
+
o.resolve(s)
|
|
1474
1514
|
);
|
|
1475
|
-
},
|
|
1476
|
-
const t =
|
|
1477
|
-
if (
|
|
1515
|
+
}, L = (o, e) => {
|
|
1516
|
+
const t = o.resolve(e), n = t.index();
|
|
1517
|
+
if (n === t.node().childCount - 1)
|
|
1478
1518
|
return;
|
|
1479
|
-
const s = t.posAtIndex(
|
|
1519
|
+
const s = t.posAtIndex(n + 1);
|
|
1480
1520
|
return v(
|
|
1481
|
-
|
|
1521
|
+
o.resolve(s)
|
|
1482
1522
|
);
|
|
1483
|
-
},
|
|
1523
|
+
}, _e = (o, e) => {
|
|
1484
1524
|
for (; e.childContainer; ) {
|
|
1485
|
-
const t = e.childContainer.node,
|
|
1486
|
-
e = v(
|
|
1525
|
+
const t = e.childContainer.node, n = o.resolve(e.childContainer.beforePos + 1).posAtIndex(t.childCount - 1);
|
|
1526
|
+
e = v(o.resolve(n));
|
|
1487
1527
|
}
|
|
1488
1528
|
return e;
|
|
1489
|
-
},
|
|
1490
|
-
if (!
|
|
1529
|
+
}, ln = (o, e) => o.isBlockContainer && o.blockContent.node.type.spec.content === "inline*" && o.blockContent.node.childCount > 0 && e.isBlockContainer && e.blockContent.node.type.spec.content === "inline*", dn = (o, e, t, n) => {
|
|
1530
|
+
if (!n.isBlockContainer)
|
|
1491
1531
|
throw new Error(
|
|
1492
|
-
`Attempted to merge block at position ${
|
|
1532
|
+
`Attempted to merge block at position ${n.bnBlock.beforePos} into previous block at position ${t.bnBlock.beforePos}, but next block is not a block container`
|
|
1493
1533
|
);
|
|
1494
|
-
if (
|
|
1495
|
-
const s =
|
|
1496
|
-
|
|
1497
|
-
), r =
|
|
1498
|
-
|
|
1534
|
+
if (n.childContainer) {
|
|
1535
|
+
const s = o.doc.resolve(
|
|
1536
|
+
n.childContainer.beforePos + 1
|
|
1537
|
+
), r = o.doc.resolve(
|
|
1538
|
+
n.childContainer.afterPos - 1
|
|
1499
1539
|
), i = s.blockRange(r);
|
|
1500
1540
|
if (e) {
|
|
1501
|
-
const l =
|
|
1502
|
-
|
|
1541
|
+
const l = o.doc.resolve(n.bnBlock.beforePos);
|
|
1542
|
+
o.tr.lift(i, l.depth);
|
|
1503
1543
|
}
|
|
1504
1544
|
}
|
|
1505
1545
|
if (e) {
|
|
1506
1546
|
if (!t.isBlockContainer)
|
|
1507
1547
|
throw new Error(
|
|
1508
|
-
`Attempted to merge block at position ${
|
|
1548
|
+
`Attempted to merge block at position ${n.bnBlock.beforePos} into previous block at position ${t.bnBlock.beforePos}, but previous block is not a block container`
|
|
1509
1549
|
);
|
|
1510
1550
|
e(
|
|
1511
|
-
|
|
1551
|
+
o.tr.delete(
|
|
1512
1552
|
t.blockContent.afterPos - 1,
|
|
1513
|
-
|
|
1553
|
+
n.blockContent.beforePos + 1
|
|
1514
1554
|
)
|
|
1515
1555
|
);
|
|
1516
1556
|
}
|
|
1517
1557
|
return !0;
|
|
1518
|
-
}, fe = (
|
|
1558
|
+
}, fe = (o) => ({
|
|
1519
1559
|
state: e,
|
|
1520
1560
|
dispatch: t
|
|
1521
1561
|
}) => {
|
|
1522
|
-
const
|
|
1562
|
+
const n = e.doc.resolve(o), s = v(n), r = _(
|
|
1523
1563
|
e.doc,
|
|
1524
1564
|
s.bnBlock.beforePos
|
|
1525
1565
|
);
|
|
1526
1566
|
if (!r)
|
|
1527
1567
|
return !1;
|
|
1528
|
-
const i =
|
|
1568
|
+
const i = _e(
|
|
1529
1569
|
e.doc,
|
|
1530
1570
|
r
|
|
1531
1571
|
);
|
|
1532
|
-
return
|
|
1533
|
-
},
|
|
1572
|
+
return ln(i, s) ? dn(e, t, i, s) : !1;
|
|
1573
|
+
}, un = T.create({
|
|
1534
1574
|
priority: 50,
|
|
1535
1575
|
// TODO: The shortcuts need a refactor. Do we want to use a command priority
|
|
1536
1576
|
// design as there is now, or clump the logic into a single function?
|
|
1537
1577
|
addKeyboardShortcuts() {
|
|
1538
|
-
const
|
|
1578
|
+
const o = () => this.editor.commands.first(({ chain: n, commands: s }) => [
|
|
1539
1579
|
// Deletes the selection if it's not empty.
|
|
1540
1580
|
() => s.deleteSelection(),
|
|
1541
1581
|
// Undoes an input rule if one was triggered in the last editor state change.
|
|
@@ -1567,14 +1607,14 @@ const ue = () => {
|
|
|
1567
1607
|
const i = B(r);
|
|
1568
1608
|
if (!i.isBlockContainer)
|
|
1569
1609
|
return !1;
|
|
1570
|
-
const { bnBlock: l, blockContent: a } = i, c =
|
|
1610
|
+
const { bnBlock: l, blockContent: a } = i, c = _(
|
|
1571
1611
|
r.doc,
|
|
1572
1612
|
i.bnBlock.beforePos
|
|
1573
1613
|
);
|
|
1574
1614
|
if (!c || !c.isBlockContainer || c.blockContent.node.type.spec.content !== "inline*")
|
|
1575
1615
|
return !1;
|
|
1576
1616
|
const d = r.selection.from === a.beforePos + 1, u = r.selection.empty, p = l.beforePos;
|
|
1577
|
-
return d && u ?
|
|
1617
|
+
return d && u ? n().command(fe(p)).scrollIntoView().run() : !1;
|
|
1578
1618
|
}),
|
|
1579
1619
|
// If the previous block is a columnList, moves the current block to
|
|
1580
1620
|
// the end of the last column in it.
|
|
@@ -1582,7 +1622,7 @@ const ue = () => {
|
|
|
1582
1622
|
const a = B(r);
|
|
1583
1623
|
if (!a.isBlockContainer)
|
|
1584
1624
|
return !1;
|
|
1585
|
-
const c =
|
|
1625
|
+
const c = _(
|
|
1586
1626
|
r.doc,
|
|
1587
1627
|
a.bnBlock.beforePos
|
|
1588
1628
|
);
|
|
@@ -1627,13 +1667,13 @@ const ue = () => {
|
|
|
1627
1667
|
if (!i.isBlockContainer)
|
|
1628
1668
|
return !1;
|
|
1629
1669
|
if (i.blockContent.node.childCount === 0 && i.blockContent.node.type.spec.content === "inline*") {
|
|
1630
|
-
const c =
|
|
1670
|
+
const c = _(
|
|
1631
1671
|
r.doc,
|
|
1632
1672
|
i.bnBlock.beforePos
|
|
1633
1673
|
);
|
|
1634
1674
|
if (!c || !c.isBlockContainer)
|
|
1635
1675
|
return !1;
|
|
1636
|
-
let d =
|
|
1676
|
+
let d = n();
|
|
1637
1677
|
if (i.childContainer && d.insertContentAt(
|
|
1638
1678
|
i.bnBlock.afterPos,
|
|
1639
1679
|
(a = i.childContainer) == null ? void 0 : a.node.content
|
|
@@ -1664,19 +1704,19 @@ const ue = () => {
|
|
|
1664
1704
|
const i = B(r);
|
|
1665
1705
|
if (!i.isBlockContainer)
|
|
1666
1706
|
return !1;
|
|
1667
|
-
const l = r.selection.from === i.blockContent.beforePos + 1, a = r.selection.empty, c =
|
|
1707
|
+
const l = r.selection.from === i.blockContent.beforePos + 1, a = r.selection.empty, c = _(
|
|
1668
1708
|
r.doc,
|
|
1669
1709
|
i.bnBlock.beforePos
|
|
1670
1710
|
);
|
|
1671
1711
|
if (c && l && a) {
|
|
1672
|
-
const d =
|
|
1712
|
+
const d = _e(
|
|
1673
1713
|
r.doc,
|
|
1674
1714
|
c
|
|
1675
1715
|
);
|
|
1676
1716
|
if (!d.isBlockContainer)
|
|
1677
1717
|
return !1;
|
|
1678
1718
|
if (d.blockContent.node.type.spec.content === "" || d.blockContent.node.type.spec.content === "inline*" && d.blockContent.node.childCount === 0)
|
|
1679
|
-
return
|
|
1719
|
+
return n().cut(
|
|
1680
1720
|
{
|
|
1681
1721
|
from: i.bnBlock.beforePos,
|
|
1682
1722
|
to: i.bnBlock.afterPos
|
|
@@ -1689,7 +1729,7 @@ const ue = () => {
|
|
|
1689
1729
|
}
|
|
1690
1730
|
return !1;
|
|
1691
1731
|
})
|
|
1692
|
-
]), e = () => this.editor.commands.first(({ chain:
|
|
1732
|
+
]), e = () => this.editor.commands.first(({ chain: n, commands: s }) => [
|
|
1693
1733
|
// Deletes the selection if it's not empty.
|
|
1694
1734
|
() => s.deleteSelection(),
|
|
1695
1735
|
// Deletes the first child block and un-nests its children, if the
|
|
@@ -1709,9 +1749,9 @@ const ue = () => {
|
|
|
1709
1749
|
return !1;
|
|
1710
1750
|
if (c && d) {
|
|
1711
1751
|
const h = u.blockContent.node, f = h.type.spec.content === "inline*", m = l.node.type.spec.content === "inline*";
|
|
1712
|
-
return
|
|
1752
|
+
return n().insertContentAt(
|
|
1713
1753
|
u.bnBlock.afterPos,
|
|
1714
|
-
((p = u.childContainer) == null ? void 0 : p.node.content) ||
|
|
1754
|
+
((p = u.childContainer) == null ? void 0 : p.node.content) || M.empty
|
|
1715
1755
|
).deleteRange(
|
|
1716
1756
|
// Deletes whole child container if there's only one child.
|
|
1717
1757
|
a.node.childCount === 1 ? {
|
|
@@ -1735,14 +1775,14 @@ const ue = () => {
|
|
|
1735
1775
|
const i = B(r);
|
|
1736
1776
|
if (!i.isBlockContainer)
|
|
1737
1777
|
return !1;
|
|
1738
|
-
const { bnBlock: l, blockContent: a } = i, c =
|
|
1778
|
+
const { bnBlock: l, blockContent: a } = i, c = L(
|
|
1739
1779
|
r.doc,
|
|
1740
1780
|
i.bnBlock.beforePos
|
|
1741
1781
|
);
|
|
1742
1782
|
if (!c || !c.isBlockContainer)
|
|
1743
1783
|
return !1;
|
|
1744
1784
|
const d = r.selection.from === a.afterPos - 1, u = r.selection.empty, p = l.afterPos;
|
|
1745
|
-
return d && u ?
|
|
1785
|
+
return d && u ? n().command(fe(p)).scrollIntoView().run() : !1;
|
|
1746
1786
|
}),
|
|
1747
1787
|
// If the previous block is a columnList, moves the current block to
|
|
1748
1788
|
// the end of the last column in it.
|
|
@@ -1750,7 +1790,7 @@ const ue = () => {
|
|
|
1750
1790
|
const a = B(r);
|
|
1751
1791
|
if (!a.isBlockContainer)
|
|
1752
1792
|
return !1;
|
|
1753
|
-
const c =
|
|
1793
|
+
const c = L(
|
|
1754
1794
|
r.doc,
|
|
1755
1795
|
a.bnBlock.beforePos
|
|
1756
1796
|
);
|
|
@@ -1807,10 +1847,10 @@ const ue = () => {
|
|
|
1807
1847
|
const { blockContent: l } = i, a = r.selection.from === l.afterPos - 1, c = r.selection.empty;
|
|
1808
1848
|
if (a && c) {
|
|
1809
1849
|
const u = (b, g) => {
|
|
1810
|
-
const x =
|
|
1850
|
+
const x = L(b, g);
|
|
1811
1851
|
if (x)
|
|
1812
1852
|
return x;
|
|
1813
|
-
const y =
|
|
1853
|
+
const y = Le(b, g);
|
|
1814
1854
|
if (y)
|
|
1815
1855
|
return u(
|
|
1816
1856
|
b,
|
|
@@ -1823,9 +1863,9 @@ const ue = () => {
|
|
|
1823
1863
|
if (!p || !p.isBlockContainer)
|
|
1824
1864
|
return !1;
|
|
1825
1865
|
const h = p.blockContent.node, f = h.type.spec.content === "inline*", m = l.node.type.spec.content === "inline*";
|
|
1826
|
-
return
|
|
1866
|
+
return n().insertContentAt(
|
|
1827
1867
|
p.bnBlock.afterPos,
|
|
1828
|
-
((d = p.childContainer) == null ? void 0 : d.node.content) ||
|
|
1868
|
+
((d = p.childContainer) == null ? void 0 : d.node.content) || M.empty
|
|
1829
1869
|
).deleteRange({
|
|
1830
1870
|
from: p.bnBlock.beforePos,
|
|
1831
1871
|
to: p.bnBlock.afterPos
|
|
@@ -1843,13 +1883,13 @@ const ue = () => {
|
|
|
1843
1883
|
if (!i.isBlockContainer)
|
|
1844
1884
|
return !1;
|
|
1845
1885
|
if (i.blockContent.node.childCount === 0 && i.blockContent.node.type.spec.content === "inline*") {
|
|
1846
|
-
const a =
|
|
1886
|
+
const a = L(
|
|
1847
1887
|
r.doc,
|
|
1848
1888
|
i.bnBlock.beforePos
|
|
1849
1889
|
);
|
|
1850
1890
|
if (!a || !a.isBlockContainer)
|
|
1851
1891
|
return !1;
|
|
1852
|
-
let c =
|
|
1892
|
+
let c = n();
|
|
1853
1893
|
if (a.blockContent.node.type.spec.content === "tableRow+") {
|
|
1854
1894
|
const f = i.bnBlock.afterPos + 1 + 1 + 1 + 1 + 1;
|
|
1855
1895
|
c = c.setTextSelection(
|
|
@@ -1874,7 +1914,7 @@ const ue = () => {
|
|
|
1874
1914
|
const i = B(r);
|
|
1875
1915
|
if (!i.isBlockContainer)
|
|
1876
1916
|
return !1;
|
|
1877
|
-
const l = r.selection.from === i.blockContent.afterPos - 1, a = r.selection.empty, c =
|
|
1917
|
+
const l = r.selection.from === i.blockContent.afterPos - 1, a = r.selection.empty, c = L(
|
|
1878
1918
|
r.doc,
|
|
1879
1919
|
i.bnBlock.beforePos
|
|
1880
1920
|
);
|
|
@@ -1882,7 +1922,7 @@ const ue = () => {
|
|
|
1882
1922
|
return !1;
|
|
1883
1923
|
if (c && l && a && (c.blockContent.node.type.spec.content === "" || c.blockContent.node.type.spec.content === "inline*" && c.blockContent.node.childCount === 0)) {
|
|
1884
1924
|
const u = c.bnBlock.node.lastChild.content;
|
|
1885
|
-
return
|
|
1925
|
+
return n().deleteRange({
|
|
1886
1926
|
from: c.bnBlock.beforePos,
|
|
1887
1927
|
to: c.bnBlock.afterPos
|
|
1888
1928
|
}).insertContentAt(
|
|
@@ -1892,7 +1932,7 @@ const ue = () => {
|
|
|
1892
1932
|
}
|
|
1893
1933
|
return !1;
|
|
1894
1934
|
})
|
|
1895
|
-
]), t = (
|
|
1935
|
+
]), t = (n = !1) => this.editor.commands.first(({ commands: s, tr: r }) => [
|
|
1896
1936
|
// Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start
|
|
1897
1937
|
// of the block.
|
|
1898
1938
|
() => s.command(({ state: i }) => {
|
|
@@ -1911,7 +1951,7 @@ const ue = () => {
|
|
|
1911
1951
|
if (
|
|
1912
1952
|
// If shortcut is not configured, or is configured as "shift+enter",
|
|
1913
1953
|
// create a hard break for shift+enter, but not for enter.
|
|
1914
|
-
a === "shift+enter" &&
|
|
1954
|
+
a === "shift+enter" && n || // If shortcut is configured as "enter", create a hard break for
|
|
1915
1955
|
// both enter and shift+enter.
|
|
1916
1956
|
a === "enter"
|
|
1917
1957
|
) {
|
|
@@ -1973,19 +2013,19 @@ const ue = () => {
|
|
|
1973
2013
|
})
|
|
1974
2014
|
]);
|
|
1975
2015
|
return {
|
|
1976
|
-
Backspace:
|
|
2016
|
+
Backspace: o,
|
|
1977
2017
|
Delete: e,
|
|
1978
2018
|
Enter: () => t(),
|
|
1979
2019
|
"Shift-Enter": () => t(!0),
|
|
1980
2020
|
// Always returning true for tab key presses ensures they're not captured by the browser. Otherwise, they blur the
|
|
1981
2021
|
// editor since the browser will try to use tab for keyboard navigation.
|
|
1982
2022
|
Tab: () => {
|
|
1983
|
-
var
|
|
1984
|
-
return this.options.tabBehavior !== "prefer-indent" && ((
|
|
2023
|
+
var n, s;
|
|
2024
|
+
return this.options.tabBehavior !== "prefer-indent" && ((n = this.options.editor.getExtension(Y)) != null && n.store.state || ((s = this.options.editor.getExtension(J)) == null ? void 0 : s.store.state) !== void 0) ? !1 : Me(this.options.editor);
|
|
1985
2025
|
},
|
|
1986
2026
|
"Shift-Tab": () => {
|
|
1987
|
-
var
|
|
1988
|
-
return this.options.tabBehavior !== "prefer-indent" && ((
|
|
2027
|
+
var n, s;
|
|
2028
|
+
return this.options.tabBehavior !== "prefer-indent" && ((n = this.options.editor.getExtension(Y)) != null && n.store.state || ((s = this.options.editor.getExtension(J)) == null ? void 0 : s.store.state) !== void 0) ? !1 : this.editor.commands.liftListItem("blockContainer");
|
|
1989
2029
|
},
|
|
1990
2030
|
"Shift-Mod-ArrowUp": () => (this.options.editor.moveBlocksUp(), !0),
|
|
1991
2031
|
"Shift-Mod-ArrowDown": () => (this.options.editor.moveBlocksDown(), !0),
|
|
@@ -1994,7 +2034,7 @@ const ue = () => {
|
|
|
1994
2034
|
"Shift-Mod-z": () => this.options.editor.redo()
|
|
1995
2035
|
};
|
|
1996
2036
|
}
|
|
1997
|
-
}),
|
|
2037
|
+
}), pn = te.create({
|
|
1998
2038
|
name: "insertion",
|
|
1999
2039
|
inclusive: !1,
|
|
2000
2040
|
excludes: "deletion modification insertion",
|
|
@@ -2004,8 +2044,8 @@ const ue = () => {
|
|
|
2004
2044
|
// note: validate is supported in prosemirror but not in tiptap, so this doesn't actually work (considered not critical)
|
|
2005
2045
|
};
|
|
2006
2046
|
},
|
|
2007
|
-
extendMarkSchema(
|
|
2008
|
-
return
|
|
2047
|
+
extendMarkSchema(o) {
|
|
2048
|
+
return o.name !== "insertion" ? {} : {
|
|
2009
2049
|
blocknoteIgnore: !0,
|
|
2010
2050
|
inclusive: !1,
|
|
2011
2051
|
toDOM(e, t) {
|
|
@@ -2032,7 +2072,7 @@ const ue = () => {
|
|
|
2032
2072
|
]
|
|
2033
2073
|
};
|
|
2034
2074
|
}
|
|
2035
|
-
}),
|
|
2075
|
+
}), fn = te.create({
|
|
2036
2076
|
name: "deletion",
|
|
2037
2077
|
inclusive: !1,
|
|
2038
2078
|
excludes: "insertion modification deletion",
|
|
@@ -2042,8 +2082,8 @@ const ue = () => {
|
|
|
2042
2082
|
// note: validate is supported in prosemirror but not in tiptap
|
|
2043
2083
|
};
|
|
2044
2084
|
},
|
|
2045
|
-
extendMarkSchema(
|
|
2046
|
-
return
|
|
2085
|
+
extendMarkSchema(o) {
|
|
2086
|
+
return o.name !== "deletion" ? {} : {
|
|
2047
2087
|
blocknoteIgnore: !0,
|
|
2048
2088
|
inclusive: !1,
|
|
2049
2089
|
// attrs: {
|
|
@@ -2073,7 +2113,7 @@ const ue = () => {
|
|
|
2073
2113
|
]
|
|
2074
2114
|
};
|
|
2075
2115
|
}
|
|
2076
|
-
}),
|
|
2116
|
+
}), hn = te.create({
|
|
2077
2117
|
name: "modification",
|
|
2078
2118
|
inclusive: !1,
|
|
2079
2119
|
excludes: "deletion insertion",
|
|
@@ -2086,8 +2126,8 @@ const ue = () => {
|
|
|
2086
2126
|
newValue: { default: null }
|
|
2087
2127
|
};
|
|
2088
2128
|
},
|
|
2089
|
-
extendMarkSchema(
|
|
2090
|
-
return
|
|
2129
|
+
extendMarkSchema(o) {
|
|
2130
|
+
return o.name !== "modification" ? {} : {
|
|
2091
2131
|
blocknoteIgnore: !0,
|
|
2092
2132
|
inclusive: !1,
|
|
2093
2133
|
// attrs: {
|
|
@@ -2136,7 +2176,7 @@ const ue = () => {
|
|
|
2136
2176
|
]
|
|
2137
2177
|
};
|
|
2138
2178
|
}
|
|
2139
|
-
}),
|
|
2179
|
+
}), mn = T.create({
|
|
2140
2180
|
name: "textAlignment",
|
|
2141
2181
|
addGlobalAttributes() {
|
|
2142
2182
|
return [
|
|
@@ -2149,16 +2189,16 @@ const ue = () => {
|
|
|
2149
2189
|
attributes: {
|
|
2150
2190
|
textAlignment: {
|
|
2151
2191
|
default: "left",
|
|
2152
|
-
parseHTML: (
|
|
2153
|
-
renderHTML: (
|
|
2154
|
-
"data-text-alignment":
|
|
2192
|
+
parseHTML: (o) => o.getAttribute("data-text-alignment"),
|
|
2193
|
+
renderHTML: (o) => o.textAlignment === "left" ? {} : {
|
|
2194
|
+
"data-text-alignment": o.textAlignment
|
|
2155
2195
|
}
|
|
2156
2196
|
}
|
|
2157
2197
|
}
|
|
2158
2198
|
}
|
|
2159
2199
|
];
|
|
2160
2200
|
}
|
|
2161
|
-
}),
|
|
2201
|
+
}), kn = T.create({
|
|
2162
2202
|
name: "blockTextColor",
|
|
2163
2203
|
addGlobalAttributes() {
|
|
2164
2204
|
return [
|
|
@@ -2170,13 +2210,13 @@ const ue = () => {
|
|
|
2170
2210
|
}
|
|
2171
2211
|
];
|
|
2172
2212
|
}
|
|
2173
|
-
}),
|
|
2213
|
+
}), bn = {
|
|
2174
2214
|
blockColor: "data-block-color",
|
|
2175
2215
|
blockStyle: "data-block-style",
|
|
2176
2216
|
id: "data-id",
|
|
2177
2217
|
depth: "data-depth",
|
|
2178
2218
|
depthChange: "data-depth-change"
|
|
2179
|
-
},
|
|
2219
|
+
}, gn = O.create({
|
|
2180
2220
|
name: "blockContainer",
|
|
2181
2221
|
group: "blockGroupChild bnBlock",
|
|
2182
2222
|
// A block always contains content, and optionally a blockGroup which contains nested blocks
|
|
@@ -2189,12 +2229,12 @@ const ue = () => {
|
|
|
2189
2229
|
return [
|
|
2190
2230
|
{
|
|
2191
2231
|
tag: "div[data-node-type=" + this.name + "]",
|
|
2192
|
-
getAttrs: (
|
|
2193
|
-
if (typeof
|
|
2232
|
+
getAttrs: (o) => {
|
|
2233
|
+
if (typeof o == "string")
|
|
2194
2234
|
return !1;
|
|
2195
2235
|
const e = {};
|
|
2196
|
-
for (const [t,
|
|
2197
|
-
|
|
2236
|
+
for (const [t, n] of Object.entries(bn))
|
|
2237
|
+
o.getAttribute(n) && (e[t] = o.getAttribute(n));
|
|
2198
2238
|
return e;
|
|
2199
2239
|
}
|
|
2200
2240
|
},
|
|
@@ -2205,25 +2245,25 @@ const ue = () => {
|
|
|
2205
2245
|
}
|
|
2206
2246
|
];
|
|
2207
2247
|
},
|
|
2208
|
-
renderHTML({ HTMLAttributes:
|
|
2248
|
+
renderHTML({ HTMLAttributes: o }) {
|
|
2209
2249
|
var s;
|
|
2210
2250
|
const e = document.createElement("div");
|
|
2211
2251
|
e.className = "bn-block-outer", e.setAttribute("data-node-type", "blockOuter");
|
|
2212
|
-
for (const [r, i] of Object.entries(
|
|
2252
|
+
for (const [r, i] of Object.entries(o))
|
|
2213
2253
|
r !== "class" && e.setAttribute(r, i);
|
|
2214
2254
|
const t = {
|
|
2215
2255
|
...((s = this.options.domAttributes) == null ? void 0 : s.block) || {},
|
|
2216
|
-
...
|
|
2217
|
-
},
|
|
2218
|
-
|
|
2256
|
+
...o
|
|
2257
|
+
}, n = document.createElement("div");
|
|
2258
|
+
n.className = ee("bn-block", t.class), n.setAttribute("data-node-type", this.name);
|
|
2219
2259
|
for (const [r, i] of Object.entries(t))
|
|
2220
|
-
r !== "class" &&
|
|
2221
|
-
return e.appendChild(
|
|
2260
|
+
r !== "class" && n.setAttribute(r, i);
|
|
2261
|
+
return e.appendChild(n), {
|
|
2222
2262
|
dom: e,
|
|
2223
|
-
contentDOM:
|
|
2263
|
+
contentDOM: n
|
|
2224
2264
|
};
|
|
2225
2265
|
}
|
|
2226
|
-
}),
|
|
2266
|
+
}), Bn = O.create({
|
|
2227
2267
|
name: "blockGroup",
|
|
2228
2268
|
group: "childContainer",
|
|
2229
2269
|
content: "blockGroupChild+",
|
|
@@ -2232,15 +2272,15 @@ const ue = () => {
|
|
|
2232
2272
|
return [
|
|
2233
2273
|
{
|
|
2234
2274
|
tag: "div",
|
|
2235
|
-
getAttrs: (
|
|
2275
|
+
getAttrs: (o) => typeof o == "string" ? !1 : o.getAttribute("data-node-type") === "blockGroup" ? null : !1
|
|
2236
2276
|
}
|
|
2237
2277
|
];
|
|
2238
2278
|
},
|
|
2239
|
-
renderHTML({ HTMLAttributes:
|
|
2240
|
-
var
|
|
2279
|
+
renderHTML({ HTMLAttributes: o }) {
|
|
2280
|
+
var n;
|
|
2241
2281
|
const e = {
|
|
2242
|
-
...((
|
|
2243
|
-
...
|
|
2282
|
+
...((n = this.options.domAttributes) == null ? void 0 : n.blockGroup) || {},
|
|
2283
|
+
...o
|
|
2244
2284
|
}, t = document.createElement("div");
|
|
2245
2285
|
t.className = ee(
|
|
2246
2286
|
"bn-block-group",
|
|
@@ -2253,25 +2293,25 @@ const ue = () => {
|
|
|
2253
2293
|
contentDOM: t
|
|
2254
2294
|
};
|
|
2255
2295
|
}
|
|
2256
|
-
}),
|
|
2296
|
+
}), yn = O.create({
|
|
2257
2297
|
name: "doc",
|
|
2258
2298
|
topNode: !0,
|
|
2259
2299
|
content: "blockGroup",
|
|
2260
2300
|
marks: "insertion modification deletion"
|
|
2261
|
-
}),
|
|
2262
|
-
({ options:
|
|
2301
|
+
}), Cn = Vt(
|
|
2302
|
+
({ options: o }) => ({
|
|
2263
2303
|
key: "collaboration",
|
|
2264
2304
|
blockNoteExtensions: [
|
|
2265
|
-
dt(
|
|
2266
|
-
ut(
|
|
2267
|
-
pt(
|
|
2305
|
+
dt(o),
|
|
2306
|
+
ut(o),
|
|
2307
|
+
pt(o),
|
|
2268
2308
|
ft(),
|
|
2269
|
-
ht(
|
|
2309
|
+
ht(o)
|
|
2270
2310
|
]
|
|
2271
2311
|
})
|
|
2272
2312
|
);
|
|
2273
2313
|
let he = !1;
|
|
2274
|
-
function
|
|
2314
|
+
function Sn(o, e) {
|
|
2275
2315
|
const t = [
|
|
2276
2316
|
N.ClipboardTextSerializer,
|
|
2277
2317
|
N.Commands,
|
|
@@ -2284,12 +2324,12 @@ function Bn(n, e) {
|
|
|
2284
2324
|
types: ["blockContainer", "columnList", "column"],
|
|
2285
2325
|
setIdAttribute: e.setIdAttribute
|
|
2286
2326
|
}),
|
|
2287
|
-
|
|
2327
|
+
cn,
|
|
2288
2328
|
Gt,
|
|
2289
2329
|
// marks:
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2330
|
+
pn,
|
|
2331
|
+
fn,
|
|
2332
|
+
hn,
|
|
2293
2333
|
Rt.extend({
|
|
2294
2334
|
inclusive: !1
|
|
2295
2335
|
}).configure({
|
|
@@ -2297,57 +2337,57 @@ function Bn(n, e) {
|
|
|
2297
2337
|
// only call this once if we have multiple editors installed. Or fix https://github.com/ueberdosis/tiptap/issues/5450
|
|
2298
2338
|
protocols: he ? [] : Et
|
|
2299
2339
|
}),
|
|
2300
|
-
...Object.values(
|
|
2301
|
-
editor:
|
|
2340
|
+
...Object.values(o.schema.styleSpecs).map((n) => n.implementation.mark.configure({
|
|
2341
|
+
editor: o
|
|
2302
2342
|
})),
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2343
|
+
kn,
|
|
2344
|
+
an,
|
|
2345
|
+
mn,
|
|
2306
2346
|
// make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)
|
|
2307
2347
|
T.create({
|
|
2308
2348
|
name: "OverrideEscape",
|
|
2309
2349
|
addKeyboardShortcuts: () => ({
|
|
2310
2350
|
Escape: () => {
|
|
2311
|
-
var
|
|
2312
|
-
return (
|
|
2351
|
+
var n;
|
|
2352
|
+
return (n = o.getExtension(ge)) != null && n.shown() ? !1 : (o.blur(), !0);
|
|
2313
2353
|
}
|
|
2314
2354
|
})
|
|
2315
2355
|
}),
|
|
2316
2356
|
// nodes
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
editor:
|
|
2357
|
+
yn,
|
|
2358
|
+
gn.configure({
|
|
2359
|
+
editor: o,
|
|
2320
2360
|
domAttributes: e.domAttributes
|
|
2321
2361
|
}),
|
|
2322
|
-
|
|
2323
|
-
editor:
|
|
2362
|
+
un.configure({
|
|
2363
|
+
editor: o,
|
|
2324
2364
|
tabBehavior: e.tabBehavior
|
|
2325
2365
|
}),
|
|
2326
|
-
|
|
2366
|
+
Bn.configure({
|
|
2327
2367
|
domAttributes: e.domAttributes
|
|
2328
2368
|
}),
|
|
2329
|
-
...Object.values(
|
|
2330
|
-
editor:
|
|
2369
|
+
...Object.values(o.schema.inlineContentSpecs).filter((n) => n.config !== "link" && n.config !== "text").map((n) => n.implementation.node.configure({
|
|
2370
|
+
editor: o
|
|
2331
2371
|
})),
|
|
2332
|
-
...Object.values(
|
|
2372
|
+
...Object.values(o.schema.blockSpecs).flatMap((n) => [
|
|
2333
2373
|
// the node extension implementations
|
|
2334
|
-
..."node" in
|
|
2335
|
-
|
|
2336
|
-
editor:
|
|
2374
|
+
..."node" in n.implementation ? [
|
|
2375
|
+
n.implementation.node.configure({
|
|
2376
|
+
editor: o,
|
|
2337
2377
|
domAttributes: e.domAttributes
|
|
2338
2378
|
})
|
|
2339
2379
|
] : []
|
|
2340
2380
|
]),
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
e.pasteHandler || ((
|
|
2381
|
+
rn(o),
|
|
2382
|
+
nn(
|
|
2383
|
+
o,
|
|
2384
|
+
e.pasteHandler || ((n) => n.defaultPasteHandler())
|
|
2345
2385
|
),
|
|
2346
|
-
|
|
2386
|
+
Vo(o)
|
|
2347
2387
|
];
|
|
2348
2388
|
return he = !0, t;
|
|
2349
2389
|
}
|
|
2350
|
-
function
|
|
2390
|
+
function xn(o, e) {
|
|
2351
2391
|
const t = [
|
|
2352
2392
|
ye(),
|
|
2353
2393
|
mt(e),
|
|
@@ -2356,14 +2396,14 @@ function yn(n, e) {
|
|
|
2356
2396
|
kt(e),
|
|
2357
2397
|
bt(),
|
|
2358
2398
|
gt(e),
|
|
2359
|
-
|
|
2399
|
+
Wt(e),
|
|
2360
2400
|
Bt(e),
|
|
2361
2401
|
ge(e),
|
|
2362
2402
|
...e.trailingBlock !== !1 ? [yt()] : []
|
|
2363
2403
|
];
|
|
2364
|
-
return e.collaboration ? t.push(
|
|
2404
|
+
return e.collaboration ? t.push(Cn(e.collaboration)) : t.push(Ct()), "table" in o.schema.blockSpecs && t.push(St(e)), e.animations !== !1 && t.push(xt()), t;
|
|
2365
2405
|
}
|
|
2366
|
-
class
|
|
2406
|
+
class En {
|
|
2367
2407
|
constructor(e, t) {
|
|
2368
2408
|
/**
|
|
2369
2409
|
* A set of extension keys which are disabled by the options
|
|
@@ -2387,27 +2427,27 @@ class Cn {
|
|
|
2387
2427
|
*/
|
|
2388
2428
|
k(this, "extensionPlugins", /* @__PURE__ */ new Map());
|
|
2389
2429
|
this.editor = e, this.options = t, e.onMount(() => {
|
|
2390
|
-
for (const
|
|
2391
|
-
if (
|
|
2392
|
-
const s = new window.AbortController(), r =
|
|
2430
|
+
for (const n of this.extensions)
|
|
2431
|
+
if (n.mount) {
|
|
2432
|
+
const s = new window.AbortController(), r = n.mount({
|
|
2393
2433
|
dom: e.prosemirrorView.dom,
|
|
2394
2434
|
root: e.prosemirrorView.root,
|
|
2395
2435
|
signal: s.signal
|
|
2396
2436
|
});
|
|
2397
2437
|
r && s.signal.addEventListener("abort", () => {
|
|
2398
2438
|
r();
|
|
2399
|
-
}), this.abortMap.set(
|
|
2439
|
+
}), this.abortMap.set(n, s);
|
|
2400
2440
|
}
|
|
2401
2441
|
}), e.onUnmount(() => {
|
|
2402
|
-
for (const [
|
|
2403
|
-
this.abortMap.delete(
|
|
2442
|
+
for (const [n, s] of this.abortMap.entries())
|
|
2443
|
+
this.abortMap.delete(n), s.abort();
|
|
2404
2444
|
}), this.disabledExtensions = new Set(t.disableExtensions || []);
|
|
2405
|
-
for (const
|
|
2406
|
-
this.addExtension(
|
|
2407
|
-
for (const
|
|
2408
|
-
this.addExtension(
|
|
2409
|
-
for (const
|
|
2410
|
-
for (const s of
|
|
2445
|
+
for (const n of xn(this.editor, this.options))
|
|
2446
|
+
this.addExtension(n);
|
|
2447
|
+
for (const n of this.options.extensions ?? [])
|
|
2448
|
+
this.addExtension(n);
|
|
2449
|
+
for (const n of Object.values(this.editor.schema.blockSpecs))
|
|
2450
|
+
for (const s of n.extensions ?? [])
|
|
2411
2451
|
this.addExtension(s);
|
|
2412
2452
|
}
|
|
2413
2453
|
/**
|
|
@@ -2422,8 +2462,8 @@ class Cn {
|
|
|
2422
2462
|
console.warn("No extensions found to register", e);
|
|
2423
2463
|
return;
|
|
2424
2464
|
}
|
|
2425
|
-
const
|
|
2426
|
-
for (const i of
|
|
2465
|
+
const n = t.map((i) => this.addExtension(i)).filter(Boolean), s = /* @__PURE__ */ new Set();
|
|
2466
|
+
for (const i of n)
|
|
2427
2467
|
i != null && i.tiptapExtensions && console.warn(
|
|
2428
2468
|
`Extension ${i.key} has tiptap extensions, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,
|
|
2429
2469
|
i
|
|
@@ -2446,12 +2486,12 @@ class Cn {
|
|
|
2446
2486
|
let t;
|
|
2447
2487
|
if (typeof e == "function" ? t = e({ editor: this.editor }) : t = e, !(!t || this.disabledExtensions.has(t.key))) {
|
|
2448
2488
|
if (typeof e == "function") {
|
|
2449
|
-
const
|
|
2450
|
-
typeof
|
|
2489
|
+
const n = t[Ut];
|
|
2490
|
+
typeof n == "function" && this.extensionFactories.set(n, t);
|
|
2451
2491
|
}
|
|
2452
2492
|
if (this.extensions.push(t), t.blockNoteExtensions)
|
|
2453
|
-
for (const
|
|
2454
|
-
this.addExtension(
|
|
2493
|
+
for (const n of t.blockNoteExtensions)
|
|
2494
|
+
this.addExtension(n);
|
|
2455
2495
|
return t;
|
|
2456
2496
|
}
|
|
2457
2497
|
}
|
|
@@ -2463,16 +2503,16 @@ class Cn {
|
|
|
2463
2503
|
resolveExtensions(e) {
|
|
2464
2504
|
const t = [];
|
|
2465
2505
|
if (typeof e == "function") {
|
|
2466
|
-
const
|
|
2467
|
-
|
|
2506
|
+
const n = this.extensionFactories.get(e);
|
|
2507
|
+
n && t.push(n);
|
|
2468
2508
|
} else if (Array.isArray(e))
|
|
2469
|
-
for (const
|
|
2470
|
-
t.push(...this.resolveExtensions(
|
|
2509
|
+
for (const n of e)
|
|
2510
|
+
t.push(...this.resolveExtensions(n));
|
|
2471
2511
|
else if (typeof e == "object" && "key" in e)
|
|
2472
2512
|
t.push(e);
|
|
2473
2513
|
else if (typeof e == "string") {
|
|
2474
|
-
const
|
|
2475
|
-
|
|
2514
|
+
const n = this.extensions.find((s) => s.key === e);
|
|
2515
|
+
n && t.push(n);
|
|
2476
2516
|
}
|
|
2477
2517
|
return t;
|
|
2478
2518
|
}
|
|
@@ -2488,7 +2528,7 @@ class Cn {
|
|
|
2488
2528
|
console.warn("No extensions found to unregister", e);
|
|
2489
2529
|
return;
|
|
2490
2530
|
}
|
|
2491
|
-
let
|
|
2531
|
+
let n = !1;
|
|
2492
2532
|
const s = /* @__PURE__ */ new Set();
|
|
2493
2533
|
for (const i of t) {
|
|
2494
2534
|
this.extensions = this.extensions.filter((a) => a !== i), this.extensionFactories.forEach((a, c) => {
|
|
@@ -2497,7 +2537,7 @@ class Cn {
|
|
|
2497
2537
|
const l = this.extensionPlugins.get(i);
|
|
2498
2538
|
l == null || l.forEach((a) => {
|
|
2499
2539
|
s.add(a);
|
|
2500
|
-
}), this.extensionPlugins.delete(i), i.tiptapExtensions && !
|
|
2540
|
+
}), this.extensionPlugins.delete(i), i.tiptapExtensions && !n && (n = !0, console.warn(
|
|
2501
2541
|
`Extension ${i.key} has tiptap extensions, but they will not be removed. Please separate the extension into multiple extensions if you want to remove them, or re-initialize the editor.`,
|
|
2502
2542
|
e
|
|
2503
2543
|
));
|
|
@@ -2512,20 +2552,20 @@ class Cn {
|
|
|
2512
2552
|
* @returns void
|
|
2513
2553
|
*/
|
|
2514
2554
|
updatePlugins(e) {
|
|
2515
|
-
const t = this.editor.prosemirrorState,
|
|
2555
|
+
const t = this.editor.prosemirrorState, n = t.reconfigure({
|
|
2516
2556
|
plugins: e(t.plugins.slice())
|
|
2517
2557
|
});
|
|
2518
|
-
this.editor.prosemirrorView.updateState(
|
|
2558
|
+
this.editor.prosemirrorView.updateState(n);
|
|
2519
2559
|
}
|
|
2520
2560
|
/**
|
|
2521
2561
|
* Get all the extensions that are registered to the editor
|
|
2522
2562
|
*/
|
|
2523
2563
|
getTiptapExtensions() {
|
|
2524
2564
|
var s;
|
|
2525
|
-
const e =
|
|
2565
|
+
const e = Sn(
|
|
2526
2566
|
this.editor,
|
|
2527
2567
|
this.options
|
|
2528
|
-
).filter((r) => !this.disabledExtensions.has(r.name)), t = Tt(this.extensions),
|
|
2568
|
+
).filter((r) => !this.disabledExtensions.has(r.name)), t = Tt(this.extensions), n = /* @__PURE__ */ new Map();
|
|
2529
2569
|
for (const r of this.extensions) {
|
|
2530
2570
|
r.tiptapExtensions && e.push(...r.tiptapExtensions);
|
|
2531
2571
|
const i = t(r.key), { plugins: l, inputRules: a } = this.getProsemirrorPluginsFromExtension(r);
|
|
@@ -2535,15 +2575,15 @@ class Cn {
|
|
|
2535
2575
|
priority: i,
|
|
2536
2576
|
addProseMirrorPlugins: () => l
|
|
2537
2577
|
})
|
|
2538
|
-
), a.length && (
|
|
2578
|
+
), a.length && (n.has(i) || n.set(i, []), n.get(i).push(...a));
|
|
2539
2579
|
}
|
|
2540
2580
|
e.push(
|
|
2541
2581
|
T.create({
|
|
2542
2582
|
name: "blocknote-input-rules",
|
|
2543
2583
|
addProseMirrorPlugins() {
|
|
2544
2584
|
const r = [];
|
|
2545
|
-
return Array.from(
|
|
2546
|
-
r.push(...
|
|
2585
|
+
return Array.from(n.keys()).sort().reverse().forEach((i) => {
|
|
2586
|
+
r.push(...n.get(i));
|
|
2547
2587
|
}), [$t({ rules: r })];
|
|
2548
2588
|
}
|
|
2549
2589
|
})
|
|
@@ -2560,8 +2600,8 @@ class Cn {
|
|
|
2560
2600
|
*/
|
|
2561
2601
|
getProsemirrorPluginsFromExtension(e) {
|
|
2562
2602
|
var s, r, i;
|
|
2563
|
-
const t = [...e.prosemirrorPlugins ?? []],
|
|
2564
|
-
return !((s = e.prosemirrorPlugins) != null && s.length) && !Object.keys(e.keyboardShortcuts || {}).length && !((r = e.inputRules) != null && r.length) ? { plugins: t, inputRules:
|
|
2603
|
+
const t = [...e.prosemirrorPlugins ?? []], n = [];
|
|
2604
|
+
return !((s = e.prosemirrorPlugins) != null && s.length) && !Object.keys(e.keyboardShortcuts || {}).length && !((r = e.inputRules) != null && r.length) ? { plugins: t, inputRules: n } : (this.extensionPlugins.set(e, t), (i = e.inputRules) != null && i.length && n.push(
|
|
2565
2605
|
...e.inputRules.map((l) => new Ht(l.find, (a, c, d, u) => {
|
|
2566
2606
|
const p = l.replace({
|
|
2567
2607
|
match: c,
|
|
@@ -2586,7 +2626,7 @@ class Cn {
|
|
|
2586
2626
|
])
|
|
2587
2627
|
)
|
|
2588
2628
|
)
|
|
2589
|
-
), { plugins: t, inputRules:
|
|
2629
|
+
), { plugins: t, inputRules: n });
|
|
2590
2630
|
}
|
|
2591
2631
|
/**
|
|
2592
2632
|
* Get all extensions
|
|
@@ -2598,7 +2638,7 @@ class Cn {
|
|
|
2598
2638
|
}
|
|
2599
2639
|
getExtension(e) {
|
|
2600
2640
|
if (typeof e == "string") {
|
|
2601
|
-
const t = this.extensions.find((
|
|
2641
|
+
const t = this.extensions.find((n) => n.key === e);
|
|
2602
2642
|
return t || void 0;
|
|
2603
2643
|
} else if (typeof e == "function") {
|
|
2604
2644
|
const t = this.extensionFactories.get(e);
|
|
@@ -2613,40 +2653,40 @@ class Cn {
|
|
|
2613
2653
|
return typeof e == "string" ? this.extensions.some((t) => t.key === e) : typeof e == "object" && "key" in e ? this.extensions.some((t) => t.key === e.key) : typeof e == "function" ? this.extensionFactories.has(e) : !1;
|
|
2614
2654
|
}
|
|
2615
2655
|
}
|
|
2616
|
-
function
|
|
2617
|
-
let { $from: t, $to:
|
|
2618
|
-
if (t.pos > t.start() && t.pos <
|
|
2619
|
-
const s =
|
|
2656
|
+
function Pn(o, e) {
|
|
2657
|
+
let { $from: t, $to: n } = e;
|
|
2658
|
+
if (t.pos > t.start() && t.pos < o.content.size) {
|
|
2659
|
+
const s = o.textBetween(t.pos, t.pos + 1);
|
|
2620
2660
|
if (/^[\w\p{P}]$/u.test(s)) {
|
|
2621
|
-
const i =
|
|
2622
|
-
i && (t =
|
|
2661
|
+
const i = o.textBetween(t.start(), t.pos).match(/[\w\p{P}]+$/u);
|
|
2662
|
+
i && (t = o.resolve(t.pos - i[0].length));
|
|
2623
2663
|
}
|
|
2624
2664
|
}
|
|
2625
|
-
if (
|
|
2626
|
-
const s =
|
|
2665
|
+
if (n.pos < n.end() && n.pos > 0) {
|
|
2666
|
+
const s = o.textBetween(n.pos - 1, n.pos);
|
|
2627
2667
|
if (/^[\w\p{P}]$/u.test(s)) {
|
|
2628
|
-
const i =
|
|
2629
|
-
i && (
|
|
2668
|
+
const i = o.textBetween(n.pos, n.end()).match(/^[\w\p{P}]+/u);
|
|
2669
|
+
i && (n = o.resolve(n.pos + i[0].length));
|
|
2630
2670
|
}
|
|
2631
2671
|
}
|
|
2632
|
-
return { $from: t, $to:
|
|
2672
|
+
return { $from: t, $to: n, from: t.pos, to: n.pos };
|
|
2633
2673
|
}
|
|
2634
|
-
function
|
|
2635
|
-
const e = E(
|
|
2636
|
-
if (
|
|
2674
|
+
function Tn(o) {
|
|
2675
|
+
const e = E(o);
|
|
2676
|
+
if (o.selection.empty || "node" in o.selection)
|
|
2637
2677
|
return;
|
|
2638
|
-
const t =
|
|
2639
|
-
D(
|
|
2640
|
-
),
|
|
2641
|
-
D(
|
|
2678
|
+
const t = o.doc.resolve(
|
|
2679
|
+
D(o.doc, o.selection.from).posBeforeNode
|
|
2680
|
+
), n = o.doc.resolve(
|
|
2681
|
+
D(o.doc, o.selection.to).posBeforeNode
|
|
2642
2682
|
), s = (c, d) => {
|
|
2643
|
-
const u = t.posAtIndex(c, d), p =
|
|
2683
|
+
const u = t.posAtIndex(c, d), p = o.doc.resolve(u).nodeAfter;
|
|
2644
2684
|
if (!p)
|
|
2645
2685
|
throw new Error(
|
|
2646
2686
|
`Error getting selection - node not found at position ${u}`
|
|
2647
2687
|
);
|
|
2648
2688
|
return C(p, e);
|
|
2649
|
-
}, r = [], i = t.sharedDepth(
|
|
2689
|
+
}, r = [], i = t.sharedDepth(n.pos), l = t.index(i), a = n.index(i);
|
|
2650
2690
|
if (t.depth > i) {
|
|
2651
2691
|
r.push(C(t.nodeAfter, e));
|
|
2652
2692
|
for (let c = t.depth; c > i; c--)
|
|
@@ -2661,28 +2701,28 @@ function xn(n) {
|
|
|
2661
2701
|
r.push(s(c, i));
|
|
2662
2702
|
if (r.length === 0)
|
|
2663
2703
|
throw new Error(
|
|
2664
|
-
`Error getting selection - selection doesn't span any blocks (${
|
|
2704
|
+
`Error getting selection - selection doesn't span any blocks (${o.selection})`
|
|
2665
2705
|
);
|
|
2666
2706
|
return {
|
|
2667
2707
|
blocks: r
|
|
2668
2708
|
};
|
|
2669
2709
|
}
|
|
2670
|
-
function
|
|
2671
|
-
const
|
|
2672
|
-
if (
|
|
2710
|
+
function wn(o, e, t) {
|
|
2711
|
+
const n = typeof e == "string" ? e : e.id, s = typeof t == "string" ? t : t.id, r = E(o), i = be(r);
|
|
2712
|
+
if (n === s)
|
|
2673
2713
|
throw new Error(
|
|
2674
|
-
`Attempting to set selection with the same anchor and head blocks (id ${
|
|
2714
|
+
`Attempting to set selection with the same anchor and head blocks (id ${n})`
|
|
2675
2715
|
);
|
|
2676
|
-
const l = P(
|
|
2716
|
+
const l = P(n, o.doc);
|
|
2677
2717
|
if (!l)
|
|
2678
|
-
throw new Error(`Block with ID ${
|
|
2679
|
-
const a = P(s,
|
|
2718
|
+
throw new Error(`Block with ID ${n} not found`);
|
|
2719
|
+
const a = P(s, o.doc);
|
|
2680
2720
|
if (!a)
|
|
2681
2721
|
throw new Error(`Block with ID ${s} not found`);
|
|
2682
2722
|
const c = K(l), d = K(a), u = i.blockSchema[c.blockNoteType], p = i.blockSchema[d.blockNoteType];
|
|
2683
2723
|
if (!c.isBlockContainer || u.content === "none")
|
|
2684
2724
|
throw new Error(
|
|
2685
|
-
`Attempting to set selection anchor in block without content (id ${
|
|
2725
|
+
`Attempting to set selection anchor in block without content (id ${n})`
|
|
2686
2726
|
);
|
|
2687
2727
|
if (!d.isBlockContainer || p.content === "none")
|
|
2688
2728
|
throw new Error(
|
|
@@ -2699,25 +2739,25 @@ function En(n, e, t) {
|
|
|
2699
2739
|
m.height - 1,
|
|
2700
2740
|
m.width - 1,
|
|
2701
2741
|
d.blockContent.node
|
|
2702
|
-
) + 1, g =
|
|
2742
|
+
) + 1, g = o.doc.resolve(b).nodeAfter.nodeSize;
|
|
2703
2743
|
f = b + g - 2;
|
|
2704
2744
|
} else
|
|
2705
2745
|
f = d.blockContent.afterPos - 1;
|
|
2706
|
-
|
|
2746
|
+
o.setSelection(S.create(o.doc, h, f));
|
|
2707
2747
|
}
|
|
2708
|
-
function
|
|
2709
|
-
const t = E(
|
|
2710
|
-
let s =
|
|
2748
|
+
function Mn(o, e = !1) {
|
|
2749
|
+
const t = E(o), n = e ? Pn(o.doc, o.selection) : o.selection;
|
|
2750
|
+
let s = n.$from, r = n.$to;
|
|
2711
2751
|
for (; r.parentOffset >= r.parent.nodeSize - 2 && r.depth > 0; )
|
|
2712
|
-
r =
|
|
2752
|
+
r = o.doc.resolve(r.pos + 1);
|
|
2713
2753
|
for (; r.parentOffset === 0 && r.depth > 0; )
|
|
2714
|
-
r =
|
|
2754
|
+
r = o.doc.resolve(r.pos - 1);
|
|
2715
2755
|
for (; s.parentOffset === 0 && s.depth > 0; )
|
|
2716
|
-
s =
|
|
2756
|
+
s = o.doc.resolve(s.pos - 1);
|
|
2717
2757
|
for (; s.parentOffset >= s.parent.nodeSize - 2 && s.depth > 0; )
|
|
2718
|
-
s =
|
|
2758
|
+
s = o.doc.resolve(s.pos + 1);
|
|
2719
2759
|
const i = Ke(
|
|
2720
|
-
|
|
2760
|
+
o.doc.slice(s.pos, r.pos, !0),
|
|
2721
2761
|
t
|
|
2722
2762
|
);
|
|
2723
2763
|
return {
|
|
@@ -2728,47 +2768,47 @@ function Pn(n, e = !1) {
|
|
|
2728
2768
|
...i
|
|
2729
2769
|
};
|
|
2730
2770
|
}
|
|
2731
|
-
function
|
|
2732
|
-
const { bnBlock: e } = z(
|
|
2771
|
+
function vn(o) {
|
|
2772
|
+
const { bnBlock: e } = z(o), t = E(o.doc), n = o.doc.resolve(e.beforePos), s = n.nodeBefore, r = o.doc.resolve(e.afterPos).nodeAfter;
|
|
2733
2773
|
let i;
|
|
2734
|
-
return
|
|
2774
|
+
return n.depth > 1 && (i = n.node(), i.type.isInGroup("bnBlock") || (i = n.node(n.depth - 1))), {
|
|
2735
2775
|
block: C(e.node, t),
|
|
2736
2776
|
prevBlock: s === null ? void 0 : C(s, t),
|
|
2737
2777
|
nextBlock: r === null ? void 0 : C(r, t),
|
|
2738
2778
|
parentBlock: i === void 0 ? void 0 : C(i, t)
|
|
2739
2779
|
};
|
|
2740
2780
|
}
|
|
2741
|
-
function De(
|
|
2742
|
-
const
|
|
2781
|
+
function De(o, e, t = "start") {
|
|
2782
|
+
const n = typeof e == "string" ? e : e.id, s = E(o.doc), r = be(s), i = P(n, o.doc);
|
|
2743
2783
|
if (!i)
|
|
2744
|
-
throw new Error(`Block with ID ${
|
|
2784
|
+
throw new Error(`Block with ID ${n} not found`);
|
|
2745
2785
|
const l = K(i), a = r.blockSchema[l.blockNoteType].content;
|
|
2746
2786
|
if (l.isBlockContainer) {
|
|
2747
2787
|
const c = l.blockContent;
|
|
2748
2788
|
if (a === "none") {
|
|
2749
|
-
|
|
2789
|
+
o.setSelection($.create(o.doc, c.beforePos));
|
|
2750
2790
|
return;
|
|
2751
2791
|
}
|
|
2752
2792
|
if (a === "inline")
|
|
2753
|
-
t === "start" ?
|
|
2754
|
-
S.create(
|
|
2755
|
-
) :
|
|
2756
|
-
S.create(
|
|
2793
|
+
t === "start" ? o.setSelection(
|
|
2794
|
+
S.create(o.doc, c.beforePos + 1)
|
|
2795
|
+
) : o.setSelection(
|
|
2796
|
+
S.create(o.doc, c.afterPos - 1)
|
|
2757
2797
|
);
|
|
2758
2798
|
else if (a === "table")
|
|
2759
|
-
t === "start" ?
|
|
2760
|
-
S.create(
|
|
2761
|
-
) :
|
|
2762
|
-
S.create(
|
|
2799
|
+
t === "start" ? o.setSelection(
|
|
2800
|
+
S.create(o.doc, c.beforePos + 4)
|
|
2801
|
+
) : o.setSelection(
|
|
2802
|
+
S.create(o.doc, c.afterPos - 4)
|
|
2763
2803
|
);
|
|
2764
2804
|
else
|
|
2765
2805
|
throw new U(a);
|
|
2766
2806
|
} else {
|
|
2767
2807
|
const c = t === "start" ? l.childContainer.node.firstChild : l.childContainer.node.lastChild;
|
|
2768
|
-
De(
|
|
2808
|
+
De(o, c.attrs.id, t);
|
|
2769
2809
|
}
|
|
2770
2810
|
}
|
|
2771
|
-
class
|
|
2811
|
+
class In {
|
|
2772
2812
|
constructor(e) {
|
|
2773
2813
|
this.editor = e;
|
|
2774
2814
|
}
|
|
@@ -2779,7 +2819,7 @@ class Mn {
|
|
|
2779
2819
|
* If the selection starts / ends halfway through a block, the returned data will contain the entire block.
|
|
2780
2820
|
*/
|
|
2781
2821
|
getSelection() {
|
|
2782
|
-
return this.editor.transact((e) =>
|
|
2822
|
+
return this.editor.transact((e) => Tn(e));
|
|
2783
2823
|
}
|
|
2784
2824
|
/**
|
|
2785
2825
|
* Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
|
|
@@ -2790,7 +2830,7 @@ class Mn {
|
|
|
2790
2830
|
*/
|
|
2791
2831
|
getSelectionCutBlocks(e = !1) {
|
|
2792
2832
|
return this.editor.transact(
|
|
2793
|
-
(t) =>
|
|
2833
|
+
(t) => Mn(t, e)
|
|
2794
2834
|
);
|
|
2795
2835
|
}
|
|
2796
2836
|
/**
|
|
@@ -2799,14 +2839,14 @@ class Mn {
|
|
|
2799
2839
|
* @param endBlock The identifier of the block that should be the end of the selection.
|
|
2800
2840
|
*/
|
|
2801
2841
|
setSelection(e, t) {
|
|
2802
|
-
return this.editor.transact((
|
|
2842
|
+
return this.editor.transact((n) => wn(n, e, t));
|
|
2803
2843
|
}
|
|
2804
2844
|
/**
|
|
2805
2845
|
* Gets a snapshot of the current text cursor position.
|
|
2806
2846
|
* @returns A snapshot of the current text cursor position.
|
|
2807
2847
|
*/
|
|
2808
2848
|
getTextCursorPosition() {
|
|
2809
|
-
return this.editor.transact((e) =>
|
|
2849
|
+
return this.editor.transact((e) => vn(e));
|
|
2810
2850
|
}
|
|
2811
2851
|
/**
|
|
2812
2852
|
* Sets the text cursor position to the start or end of an existing block. Throws an error if the target block could
|
|
@@ -2816,7 +2856,7 @@ class Mn {
|
|
|
2816
2856
|
*/
|
|
2817
2857
|
setTextCursorPosition(e, t = "start") {
|
|
2818
2858
|
return this.editor.transact(
|
|
2819
|
-
(
|
|
2859
|
+
(n) => De(n, e, t)
|
|
2820
2860
|
);
|
|
2821
2861
|
}
|
|
2822
2862
|
/**
|
|
@@ -2825,20 +2865,20 @@ class Mn {
|
|
|
2825
2865
|
getSelectionBoundingBox() {
|
|
2826
2866
|
if (!this.editor.prosemirrorView)
|
|
2827
2867
|
return;
|
|
2828
|
-
const { selection: e } = this.editor.prosemirrorState, { ranges: t } = e,
|
|
2868
|
+
const { selection: e } = this.editor.prosemirrorState, { ranges: t } = e, n = Math.min(...t.map((r) => r.$from.pos)), s = Math.max(...t.map((r) => r.$to.pos));
|
|
2829
2869
|
if (vt(e)) {
|
|
2830
|
-
const r = this.editor.prosemirrorView.nodeDOM(
|
|
2870
|
+
const r = this.editor.prosemirrorView.nodeDOM(n);
|
|
2831
2871
|
if (r)
|
|
2832
2872
|
return r.getBoundingClientRect();
|
|
2833
2873
|
}
|
|
2834
2874
|
return It(
|
|
2835
2875
|
this.editor.prosemirrorView,
|
|
2836
|
-
|
|
2876
|
+
n,
|
|
2837
2877
|
s
|
|
2838
2878
|
).toJSON();
|
|
2839
2879
|
}
|
|
2840
2880
|
}
|
|
2841
|
-
class
|
|
2881
|
+
class An {
|
|
2842
2882
|
constructor(e) {
|
|
2843
2883
|
/**
|
|
2844
2884
|
* Stores the currently active transaction, which is the accumulated transaction from all {@link dispatch} calls during a {@link transact} calls
|
|
@@ -2884,8 +2924,8 @@ class wn {
|
|
|
2884
2924
|
);
|
|
2885
2925
|
if (this.isInCan)
|
|
2886
2926
|
return this.canExec(e);
|
|
2887
|
-
const t = this.prosemirrorState,
|
|
2888
|
-
return e(t, (r) => this.prosemirrorView.dispatch(r),
|
|
2927
|
+
const t = this.prosemirrorState, n = this.prosemirrorView;
|
|
2928
|
+
return e(t, (r) => this.prosemirrorView.dispatch(r), n);
|
|
2889
2929
|
}
|
|
2890
2930
|
/**
|
|
2891
2931
|
* Check if a command can be executed. A command should return `false` if it is not valid in the current state.
|
|
@@ -2904,8 +2944,8 @@ class wn {
|
|
|
2904
2944
|
throw new Error(
|
|
2905
2945
|
"`canExec` should not be called within a `transact` call, move the `canExec` call outside of the `transact` call"
|
|
2906
2946
|
);
|
|
2907
|
-
const t = this.prosemirrorState,
|
|
2908
|
-
return e(t, void 0,
|
|
2947
|
+
const t = this.prosemirrorState, n = this.prosemirrorView;
|
|
2948
|
+
return e(t, void 0, n);
|
|
2909
2949
|
}
|
|
2910
2950
|
/**
|
|
2911
2951
|
* Execute a function within a "blocknote transaction".
|
|
@@ -2931,9 +2971,9 @@ class wn {
|
|
|
2931
2971
|
return e(this.activeTransaction);
|
|
2932
2972
|
try {
|
|
2933
2973
|
this.activeTransaction = this.editor._tiptapEditor.state.tr;
|
|
2934
|
-
const t = e(this.activeTransaction),
|
|
2935
|
-
return this.activeTransaction = null,
|
|
2936
|
-
(
|
|
2974
|
+
const t = e(this.activeTransaction), n = this.activeTransaction;
|
|
2975
|
+
return this.activeTransaction = null, n && // Only dispatch if the transaction was actually modified in some way
|
|
2976
|
+
(n.docChanged || n.selectionSet || n.scrolledIntoView || n.storedMarksSet || !n.isGeneric) && this.prosemirrorView.dispatch(n), t;
|
|
2937
2977
|
} finally {
|
|
2938
2978
|
this.activeTransaction = null;
|
|
2939
2979
|
}
|
|
@@ -3014,17 +3054,17 @@ class wn {
|
|
|
3014
3054
|
throw new Error("No redo plugin found");
|
|
3015
3055
|
}
|
|
3016
3056
|
}
|
|
3017
|
-
function
|
|
3057
|
+
function Nn(o, e, t, n = { updateSelection: !0 }) {
|
|
3018
3058
|
let { from: s, to: r } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, i = !0, l = !0, a = "";
|
|
3019
3059
|
if (t.forEach((c) => {
|
|
3020
3060
|
c.check(), i && c.isText && c.marks.length === 0 ? a += c.text : i = !1, l = l ? c.isBlock : !1;
|
|
3021
3061
|
}), s === r && l) {
|
|
3022
|
-
const { parent: c } =
|
|
3062
|
+
const { parent: c } = o.doc.resolve(s);
|
|
3023
3063
|
c.isTextblock && !c.type.spec.code && !c.childCount && (s -= 1, r += 1);
|
|
3024
3064
|
}
|
|
3025
|
-
return i ?
|
|
3065
|
+
return i ? o.insertText(a, s, r) : o.replaceWith(s, r, t), n.updateSelection && At(o, o.steps.length - 1, -1), !0;
|
|
3026
3066
|
}
|
|
3027
|
-
class
|
|
3067
|
+
class Ln {
|
|
3028
3068
|
constructor(e) {
|
|
3029
3069
|
this.editor = e;
|
|
3030
3070
|
}
|
|
@@ -3034,15 +3074,15 @@ class In {
|
|
|
3034
3074
|
* @param content can be a string, or array of partial inline content elements
|
|
3035
3075
|
*/
|
|
3036
3076
|
insertInlineContent(e, { updateSelection: t = !1 } = {}) {
|
|
3037
|
-
const
|
|
3077
|
+
const n = V(e, this.editor.pmSchema);
|
|
3038
3078
|
this.editor.transact((s) => {
|
|
3039
|
-
|
|
3079
|
+
Nn(
|
|
3040
3080
|
s,
|
|
3041
3081
|
{
|
|
3042
3082
|
from: s.selection.from,
|
|
3043
3083
|
to: s.selection.to
|
|
3044
3084
|
},
|
|
3045
|
-
|
|
3085
|
+
n,
|
|
3046
3086
|
{
|
|
3047
3087
|
updateSelection: t
|
|
3048
3088
|
}
|
|
@@ -3054,8 +3094,8 @@ class In {
|
|
|
3054
3094
|
*/
|
|
3055
3095
|
getActiveStyles() {
|
|
3056
3096
|
return this.editor.transact((e) => {
|
|
3057
|
-
const t = {},
|
|
3058
|
-
for (const s of
|
|
3097
|
+
const t = {}, n = e.selection.$to.marks();
|
|
3098
|
+
for (const s of n) {
|
|
3059
3099
|
const r = this.editor.schema.styleSchema[s.type.name];
|
|
3060
3100
|
if (!r) {
|
|
3061
3101
|
// Links are not considered styles in blocknote
|
|
@@ -3073,7 +3113,7 @@ class In {
|
|
|
3073
3113
|
* @param styles The styles to add.
|
|
3074
3114
|
*/
|
|
3075
3115
|
addStyles(e) {
|
|
3076
|
-
for (const [t,
|
|
3116
|
+
for (const [t, n] of Object.entries(e)) {
|
|
3077
3117
|
const s = this.editor.schema.styleSchema[t];
|
|
3078
3118
|
if (!s)
|
|
3079
3119
|
throw new Error(`style ${t} not found in styleSchema`);
|
|
@@ -3081,7 +3121,7 @@ class In {
|
|
|
3081
3121
|
this.editor._tiptapEditor.commands.setMark(t);
|
|
3082
3122
|
else if (s.propSchema === "string")
|
|
3083
3123
|
this.editor._tiptapEditor.commands.setMark(t, {
|
|
3084
|
-
stringValue:
|
|
3124
|
+
stringValue: n
|
|
3085
3125
|
});
|
|
3086
3126
|
else
|
|
3087
3127
|
throw new U(s.propSchema);
|
|
@@ -3100,7 +3140,7 @@ class In {
|
|
|
3100
3140
|
* @param styles The styles to toggle.
|
|
3101
3141
|
*/
|
|
3102
3142
|
toggleStyles(e) {
|
|
3103
|
-
for (const [t,
|
|
3143
|
+
for (const [t, n] of Object.entries(e)) {
|
|
3104
3144
|
const s = this.editor.schema.styleSchema[t];
|
|
3105
3145
|
if (!s)
|
|
3106
3146
|
throw new Error(`style ${t} not found in styleSchema`);
|
|
@@ -3108,7 +3148,7 @@ class In {
|
|
|
3108
3148
|
this.editor._tiptapEditor.commands.toggleMark(t);
|
|
3109
3149
|
else if (s.propSchema === "string")
|
|
3110
3150
|
this.editor._tiptapEditor.commands.toggleMark(t, {
|
|
3111
|
-
stringValue:
|
|
3151
|
+
stringValue: n
|
|
3112
3152
|
});
|
|
3113
3153
|
else
|
|
3114
3154
|
throw new U(s.propSchema);
|
|
@@ -3134,90 +3174,90 @@ class In {
|
|
|
3134
3174
|
createLink(e, t) {
|
|
3135
3175
|
if (e === "")
|
|
3136
3176
|
return;
|
|
3137
|
-
const
|
|
3177
|
+
const n = this.editor.pmSchema.mark("link", { href: e });
|
|
3138
3178
|
this.editor.transact((s) => {
|
|
3139
3179
|
const { from: r, to: i } = s.selection;
|
|
3140
|
-
t ? s.insertText(t, r, i).addMark(r, r + t.length,
|
|
3180
|
+
t ? s.insertText(t, r, i).addMark(r, r + t.length, n) : s.setSelection(Qt.create(s.doc, i)).addMark(
|
|
3141
3181
|
r,
|
|
3142
3182
|
i,
|
|
3143
|
-
|
|
3183
|
+
n
|
|
3144
3184
|
);
|
|
3145
3185
|
});
|
|
3146
3186
|
}
|
|
3147
3187
|
}
|
|
3148
|
-
function
|
|
3149
|
-
return Nt(
|
|
3188
|
+
function _n(o) {
|
|
3189
|
+
return Nt(o.state.selection.$from, (e) => e.type.name === "tableCell" || e.type.name === "tableHeader") !== void 0;
|
|
3150
3190
|
}
|
|
3151
|
-
function Oe(
|
|
3191
|
+
function Oe(o, e) {
|
|
3152
3192
|
var s;
|
|
3153
3193
|
const t = e.nodes.hardBreak;
|
|
3154
|
-
let
|
|
3155
|
-
return
|
|
3156
|
-
r.isTextblock && r.childCount > 0 ? (
|
|
3194
|
+
let n = R.empty;
|
|
3195
|
+
return o.forEach((r) => {
|
|
3196
|
+
r.isTextblock && r.childCount > 0 ? (n = n.append(r.content), n = n.addToEnd(t.create())) : r.isText ? n = n.addToEnd(r) : r.isBlock && r.childCount > 0 && (n = n.append(
|
|
3157
3197
|
Oe(r.content, e)
|
|
3158
|
-
),
|
|
3159
|
-
}), ((s =
|
|
3198
|
+
), n = n.addToEnd(t.create()));
|
|
3199
|
+
}), ((s = n.lastChild) == null ? void 0 : s.type) === t && (n = n.cut(0, n.size - 1)), n;
|
|
3160
3200
|
}
|
|
3161
|
-
function
|
|
3201
|
+
function Dn(o, e) {
|
|
3162
3202
|
const t = [];
|
|
3163
|
-
return
|
|
3164
|
-
r !== e && t.push(
|
|
3203
|
+
return o.forEach((n, s, r) => {
|
|
3204
|
+
r !== e && t.push(n);
|
|
3165
3205
|
}), R.from(t);
|
|
3166
3206
|
}
|
|
3167
|
-
function
|
|
3207
|
+
function On(o, e) {
|
|
3168
3208
|
const t = [];
|
|
3169
|
-
for (let
|
|
3170
|
-
if (
|
|
3209
|
+
for (let n = 0; n < o.childCount; n++)
|
|
3210
|
+
if (o.child(n).type.name === "tableRow")
|
|
3171
3211
|
if (t.length > 0 && t[t.length - 1].type.name === "table") {
|
|
3172
|
-
const s = t[t.length - 1], r = s.copy(s.content.addToEnd(
|
|
3212
|
+
const s = t[t.length - 1], r = s.copy(s.content.addToEnd(o.child(n)));
|
|
3173
3213
|
t[t.length - 1] = r;
|
|
3174
3214
|
} else {
|
|
3175
3215
|
const s = e.nodes.table.createChecked(
|
|
3176
3216
|
void 0,
|
|
3177
|
-
|
|
3217
|
+
o.child(n)
|
|
3178
3218
|
);
|
|
3179
3219
|
t.push(s);
|
|
3180
3220
|
}
|
|
3181
3221
|
else
|
|
3182
|
-
t.push(
|
|
3183
|
-
return
|
|
3222
|
+
t.push(o.child(n));
|
|
3223
|
+
return o = R.from(t), o;
|
|
3184
3224
|
}
|
|
3185
|
-
function
|
|
3186
|
-
let t = R.from(
|
|
3187
|
-
if (t =
|
|
3188
|
-
let
|
|
3225
|
+
function $n(o, e) {
|
|
3226
|
+
let t = R.from(o.content);
|
|
3227
|
+
if (t = On(t, e.state.schema), _n(e)) {
|
|
3228
|
+
let n = !1;
|
|
3189
3229
|
if (t.descendants((s) => {
|
|
3190
|
-
s.type.isInGroup("tableContent") && (
|
|
3191
|
-
}), !
|
|
3230
|
+
s.type.isInGroup("tableContent") && (n = !0);
|
|
3231
|
+
}), !n && // is the content valid for a table paragraph?
|
|
3192
3232
|
!e.state.schema.nodes.tableParagraph.validContent(t))
|
|
3193
|
-
return new
|
|
3233
|
+
return new W(
|
|
3194
3234
|
Oe(t, e.state.schema),
|
|
3195
3235
|
0,
|
|
3196
3236
|
0
|
|
3197
3237
|
);
|
|
3198
3238
|
}
|
|
3199
|
-
if (!
|
|
3200
|
-
return new
|
|
3201
|
-
for (let
|
|
3202
|
-
if (t.child(
|
|
3203
|
-
const s = [t.child(
|
|
3204
|
-
if (
|
|
3205
|
-
const i = t.child(
|
|
3206
|
-
(i.type.name === "bulletListItem" || i.type.name === "numberedListItem" || i.type.name === "checkListItem") && (s.push(t.child(
|
|
3239
|
+
if (!Hn(t, e))
|
|
3240
|
+
return new W(t, o.openStart, o.openEnd);
|
|
3241
|
+
for (let n = 0; n < t.childCount; n++)
|
|
3242
|
+
if (t.child(n).type.spec.group === "blockContent") {
|
|
3243
|
+
const s = [t.child(n)];
|
|
3244
|
+
if (n + 1 < t.childCount && t.child(n + 1).type.name === "blockGroup") {
|
|
3245
|
+
const i = t.child(n + 1).child(0).child(0);
|
|
3246
|
+
(i.type.name === "bulletListItem" || i.type.name === "numberedListItem" || i.type.name === "checkListItem") && (s.push(t.child(n + 1)), t = Dn(t, n + 1));
|
|
3207
3247
|
}
|
|
3208
3248
|
const r = e.state.schema.nodes.blockContainer.createChecked(
|
|
3209
3249
|
void 0,
|
|
3210
3250
|
s
|
|
3211
3251
|
);
|
|
3212
|
-
t = t.replaceChild(
|
|
3252
|
+
t = t.replaceChild(n, r);
|
|
3213
3253
|
}
|
|
3214
|
-
return new
|
|
3254
|
+
return new W(t, o.openStart, o.openEnd);
|
|
3215
3255
|
}
|
|
3216
|
-
function
|
|
3256
|
+
function Hn(o, e) {
|
|
3217
3257
|
var r, i;
|
|
3218
|
-
const t =
|
|
3258
|
+
const t = o.childCount === 1, n = ((r = o.firstChild) == null ? void 0 : r.type.spec.content) === "inline*", s = ((i = o.firstChild) == null ? void 0 : i.type.spec.content) === "tableRow+";
|
|
3219
3259
|
if (t) {
|
|
3220
|
-
if (
|
|
3260
|
+
if (n)
|
|
3221
3261
|
return !1;
|
|
3222
3262
|
if (s) {
|
|
3223
3263
|
const l = B(e.state);
|
|
@@ -3227,7 +3267,7 @@ function Dn(n, e) {
|
|
|
3227
3267
|
}
|
|
3228
3268
|
return !0;
|
|
3229
3269
|
}
|
|
3230
|
-
const
|
|
3270
|
+
const Fn = {
|
|
3231
3271
|
enableInputRules: !0,
|
|
3232
3272
|
enablePasteRules: !0,
|
|
3233
3273
|
enableCoreExtensions: !1
|
|
@@ -3322,61 +3362,61 @@ class $e extends Ce {
|
|
|
3322
3362
|
headers: ((p = t == null ? void 0 : t.tables) == null ? void 0 : p.headers) ?? !1
|
|
3323
3363
|
}
|
|
3324
3364
|
};
|
|
3325
|
-
const
|
|
3365
|
+
const n = {
|
|
3326
3366
|
defaultStyles: !0,
|
|
3327
|
-
schema: t.schema ||
|
|
3367
|
+
schema: t.schema || wt.create(),
|
|
3328
3368
|
...t,
|
|
3329
3369
|
placeholders: {
|
|
3330
3370
|
...this.dictionary.placeholders,
|
|
3331
3371
|
...t.placeholders
|
|
3332
3372
|
}
|
|
3333
3373
|
};
|
|
3334
|
-
if (this.schema =
|
|
3335
|
-
const y =
|
|
3336
|
-
this.uploadFile = async (I,
|
|
3374
|
+
if (this.schema = n.schema, this.blockImplementations = n.schema.blockSpecs, this.inlineContentImplementations = n.schema.inlineContentSpecs, this.styleImplementations = n.schema.styleSpecs, n.uploadFile) {
|
|
3375
|
+
const y = n.uploadFile;
|
|
3376
|
+
this.uploadFile = async (I, w) => {
|
|
3337
3377
|
this.onUploadStartCallbacks.forEach(
|
|
3338
|
-
(A) => A.apply(this, [
|
|
3378
|
+
(A) => A.apply(this, [w])
|
|
3339
3379
|
);
|
|
3340
3380
|
try {
|
|
3341
|
-
return await y(I,
|
|
3381
|
+
return await y(I, w);
|
|
3342
3382
|
} finally {
|
|
3343
3383
|
this.onUploadEndCallbacks.forEach(
|
|
3344
|
-
(A) => A.apply(this, [
|
|
3384
|
+
(A) => A.apply(this, [w])
|
|
3345
3385
|
);
|
|
3346
3386
|
}
|
|
3347
3387
|
};
|
|
3348
3388
|
}
|
|
3349
|
-
this.resolveFileUrl =
|
|
3389
|
+
this.resolveFileUrl = n.resolveFileUrl, this._eventManager = new Eo(this), this._extensionManager = new En(this, n);
|
|
3350
3390
|
const s = this._extensionManager.getTiptapExtensions(), r = this._extensionManager.hasExtension("ySync") || this._extensionManager.hasExtension("liveblocksExtension");
|
|
3351
|
-
r &&
|
|
3391
|
+
r && n.initialContent && console.warn(
|
|
3352
3392
|
"When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"
|
|
3353
3393
|
);
|
|
3354
3394
|
const i = {
|
|
3355
|
-
...
|
|
3356
|
-
...
|
|
3395
|
+
...Fn,
|
|
3396
|
+
...n._tiptapOptions,
|
|
3357
3397
|
element: null,
|
|
3358
|
-
autofocus:
|
|
3398
|
+
autofocus: n.autofocus ?? !1,
|
|
3359
3399
|
extensions: s,
|
|
3360
3400
|
editorProps: {
|
|
3361
|
-
...(h =
|
|
3401
|
+
...(h = n._tiptapOptions) == null ? void 0 : h.editorProps,
|
|
3362
3402
|
attributes: {
|
|
3363
3403
|
// As of TipTap v2.5.0 the tabIndex is removed when the editor is not
|
|
3364
3404
|
// editable, so you can't focus it. We want to revert this as we have
|
|
3365
3405
|
// UI behaviour that relies on it.
|
|
3366
3406
|
tabIndex: "0",
|
|
3367
|
-
...(m = (f =
|
|
3368
|
-
...(b =
|
|
3407
|
+
...(m = (f = n._tiptapOptions) == null ? void 0 : f.editorProps) == null ? void 0 : m.attributes,
|
|
3408
|
+
...(b = n.domAttributes) == null ? void 0 : b.editor,
|
|
3369
3409
|
class: ee(
|
|
3370
3410
|
"bn-editor",
|
|
3371
|
-
|
|
3372
|
-
((x = (g =
|
|
3411
|
+
n.defaultStyles ? "bn-default-styles" : "",
|
|
3412
|
+
((x = (g = n.domAttributes) == null ? void 0 : g.editor) == null ? void 0 : x.class) || ""
|
|
3373
3413
|
)
|
|
3374
3414
|
},
|
|
3375
|
-
transformPasted:
|
|
3415
|
+
transformPasted: $n
|
|
3376
3416
|
}
|
|
3377
3417
|
};
|
|
3378
3418
|
try {
|
|
3379
|
-
const y =
|
|
3419
|
+
const y = n.initialContent || (r ? [
|
|
3380
3420
|
{
|
|
3381
3421
|
type: "paragraph",
|
|
3382
3422
|
id: "initialBlockId"
|
|
@@ -3391,15 +3431,15 @@ class $e extends Ce {
|
|
|
3391
3431
|
throw new Error(
|
|
3392
3432
|
"initialContent must be a non-empty array of blocks, received: " + y
|
|
3393
3433
|
);
|
|
3394
|
-
const I =
|
|
3434
|
+
const I = Lt(i.extensions), w = y.map(
|
|
3395
3435
|
(He) => Z(He, I, this.schema.styleSchema).toJSON()
|
|
3396
|
-
), A =
|
|
3436
|
+
), A = _t(
|
|
3397
3437
|
{
|
|
3398
3438
|
type: "doc",
|
|
3399
3439
|
content: [
|
|
3400
3440
|
{
|
|
3401
3441
|
type: "blockGroup",
|
|
3402
|
-
content:
|
|
3442
|
+
content: w
|
|
3403
3443
|
}
|
|
3404
3444
|
]
|
|
3405
3445
|
},
|
|
@@ -3421,9 +3461,9 @@ class $e extends Ce {
|
|
|
3421
3461
|
this.pmSchema.nodes.doc.createAndFill = (...y) => {
|
|
3422
3462
|
if (l)
|
|
3423
3463
|
return l;
|
|
3424
|
-
const I = a.apply(this.pmSchema.nodes.doc, y),
|
|
3425
|
-
return
|
|
3426
|
-
}, this.pmSchema.cached.blockNoteEditor = this, this._blockManager = new xo(this), this._exportManager = new
|
|
3464
|
+
const I = a.apply(this.pmSchema.nodes.doc, y), w = JSON.parse(JSON.stringify(I.toJSON()));
|
|
3465
|
+
return w.content[0].content[0].attrs.id = "initialBlockId", l = ze.fromJSON(this.pmSchema, w), l;
|
|
3466
|
+
}, this.pmSchema.cached.blockNoteEditor = this, this._blockManager = new xo(this), this._exportManager = new $o(this), this._selectionManager = new In(this), this._stateManager = new An(this), this._styleManager = new Ln(this), this.emit("create");
|
|
3427
3467
|
}
|
|
3428
3468
|
static create(t) {
|
|
3429
3469
|
return new $e(t ?? {});
|
|
@@ -3529,14 +3569,14 @@ class $e extends Ce {
|
|
|
3529
3569
|
// TODO move to extension
|
|
3530
3570
|
onUploadStart(t) {
|
|
3531
3571
|
return this.onUploadStartCallbacks.push(t), () => {
|
|
3532
|
-
const
|
|
3533
|
-
|
|
3572
|
+
const n = this.onUploadStartCallbacks.indexOf(t);
|
|
3573
|
+
n > -1 && this.onUploadStartCallbacks.splice(n, 1);
|
|
3534
3574
|
};
|
|
3535
3575
|
}
|
|
3536
3576
|
onUploadEnd(t) {
|
|
3537
3577
|
return this.onUploadEndCallbacks.push(t), () => {
|
|
3538
|
-
const
|
|
3539
|
-
|
|
3578
|
+
const n = this.onUploadEndCallbacks.indexOf(t);
|
|
3579
|
+
n > -1 && this.onUploadEndCallbacks.splice(n, 1);
|
|
3540
3580
|
};
|
|
3541
3581
|
}
|
|
3542
3582
|
/**
|
|
@@ -3600,8 +3640,8 @@ class $e extends Ce {
|
|
|
3600
3640
|
* @param callback The callback to execute for each block. Returning `false` stops the traversal.
|
|
3601
3641
|
* @param reverse Whether the blocks should be traversed in reverse order.
|
|
3602
3642
|
*/
|
|
3603
|
-
forEachBlock(t,
|
|
3604
|
-
this._blockManager.forEachBlock(t,
|
|
3643
|
+
forEachBlock(t, n = !1) {
|
|
3644
|
+
this._blockManager.forEachBlock(t, n);
|
|
3605
3645
|
}
|
|
3606
3646
|
/**
|
|
3607
3647
|
* Executes a callback whenever the editor's contents change.
|
|
@@ -3642,8 +3682,8 @@ class $e extends Ce {
|
|
|
3642
3682
|
* @param targetBlock The identifier of an existing block that the text cursor should be moved to.
|
|
3643
3683
|
* @param placement Whether the text cursor should be placed at the start or end of the block.
|
|
3644
3684
|
*/
|
|
3645
|
-
setTextCursorPosition(t,
|
|
3646
|
-
return this._selectionManager.setTextCursorPosition(t,
|
|
3685
|
+
setTextCursorPosition(t, n = "start") {
|
|
3686
|
+
return this._selectionManager.setTextCursorPosition(t, n);
|
|
3647
3687
|
}
|
|
3648
3688
|
/**
|
|
3649
3689
|
* Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
|
|
@@ -3669,8 +3709,8 @@ class $e extends Ce {
|
|
|
3669
3709
|
* @param startBlock The identifier of the block that should be the start of the selection.
|
|
3670
3710
|
* @param endBlock The identifier of the block that should be the end of the selection.
|
|
3671
3711
|
*/
|
|
3672
|
-
setSelection(t,
|
|
3673
|
-
return this._selectionManager.setSelection(t,
|
|
3712
|
+
setSelection(t, n) {
|
|
3713
|
+
return this._selectionManager.setSelection(t, n);
|
|
3674
3714
|
}
|
|
3675
3715
|
/**
|
|
3676
3716
|
* Checks if the editor is currently editable, or if it's locked.
|
|
@@ -3694,10 +3734,10 @@ class $e extends Ce {
|
|
|
3694
3734
|
* @param placement Whether the blocks should be inserted just before, just after, or nested inside the
|
|
3695
3735
|
* `referenceBlock`.
|
|
3696
3736
|
*/
|
|
3697
|
-
insertBlocks(t,
|
|
3737
|
+
insertBlocks(t, n, s = "before") {
|
|
3698
3738
|
return this._blockManager.insertBlocks(
|
|
3699
3739
|
t,
|
|
3700
|
-
|
|
3740
|
+
n,
|
|
3701
3741
|
s
|
|
3702
3742
|
);
|
|
3703
3743
|
}
|
|
@@ -3708,8 +3748,8 @@ class $e extends Ce {
|
|
|
3708
3748
|
* @param blockToUpdate The block that should be updated.
|
|
3709
3749
|
* @param update A partial block which defines how the existing block should be changed.
|
|
3710
3750
|
*/
|
|
3711
|
-
updateBlock(t,
|
|
3712
|
-
return this._blockManager.updateBlock(t,
|
|
3751
|
+
updateBlock(t, n) {
|
|
3752
|
+
return this._blockManager.updateBlock(t, n);
|
|
3713
3753
|
}
|
|
3714
3754
|
/**
|
|
3715
3755
|
* Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
|
|
@@ -3725,8 +3765,8 @@ class $e extends Ce {
|
|
|
3725
3765
|
* @param blocksToRemove An array of blocks that should be replaced.
|
|
3726
3766
|
* @param blocksToInsert An array of partial blocks to replace the old ones with.
|
|
3727
3767
|
*/
|
|
3728
|
-
replaceBlocks(t,
|
|
3729
|
-
return this._blockManager.replaceBlocks(t,
|
|
3768
|
+
replaceBlocks(t, n) {
|
|
3769
|
+
return this._blockManager.replaceBlocks(t, n);
|
|
3730
3770
|
}
|
|
3731
3771
|
/**
|
|
3732
3772
|
* Undo the last action.
|
|
@@ -3745,8 +3785,8 @@ class $e extends Ce {
|
|
|
3745
3785
|
*
|
|
3746
3786
|
* @param content can be a string, or array of partial inline content elements
|
|
3747
3787
|
*/
|
|
3748
|
-
insertInlineContent(t, { updateSelection:
|
|
3749
|
-
this._styleManager.insertInlineContent(t, { updateSelection:
|
|
3788
|
+
insertInlineContent(t, { updateSelection: n = !1 } = {}) {
|
|
3789
|
+
this._styleManager.insertInlineContent(t, { updateSelection: n });
|
|
3750
3790
|
}
|
|
3751
3791
|
/**
|
|
3752
3792
|
* Gets the active text styles at the text cursor position or at the end of the current selection if it's active.
|
|
@@ -3792,8 +3832,8 @@ class $e extends Ce {
|
|
|
3792
3832
|
* @param url The link URL.
|
|
3793
3833
|
* @param text The text to display the link with.
|
|
3794
3834
|
*/
|
|
3795
|
-
createLink(t,
|
|
3796
|
-
this._styleManager.createLink(t,
|
|
3835
|
+
createLink(t, n) {
|
|
3836
|
+
this._styleManager.createLink(t, n);
|
|
3797
3837
|
}
|
|
3798
3838
|
/**
|
|
3799
3839
|
* Checks if the block containing the text cursor can be nested.
|
|
@@ -3892,8 +3932,8 @@ class $e extends Ce {
|
|
|
3892
3932
|
* @param callback The callback to execute.
|
|
3893
3933
|
* @returns A function to remove the callback.
|
|
3894
3934
|
*/
|
|
3895
|
-
onChange(t,
|
|
3896
|
-
return this._eventManager.onChange(t,
|
|
3935
|
+
onChange(t, n) {
|
|
3936
|
+
return this._eventManager.onChange(t, n);
|
|
3897
3937
|
}
|
|
3898
3938
|
/**
|
|
3899
3939
|
* A callback function that runs whenever the text cursor position or selection changes.
|
|
@@ -3901,10 +3941,10 @@ class $e extends Ce {
|
|
|
3901
3941
|
* @param callback The callback to execute.
|
|
3902
3942
|
* @returns A function to remove the callback.
|
|
3903
3943
|
*/
|
|
3904
|
-
onSelectionChange(t,
|
|
3944
|
+
onSelectionChange(t, n) {
|
|
3905
3945
|
return this._eventManager.onSelectionChange(
|
|
3906
3946
|
t,
|
|
3907
|
-
|
|
3947
|
+
n
|
|
3908
3948
|
);
|
|
3909
3949
|
}
|
|
3910
3950
|
/**
|
|
@@ -3945,8 +3985,8 @@ class $e extends Ce {
|
|
|
3945
3985
|
* @param html The HTML to paste.
|
|
3946
3986
|
* @param raw Whether to paste the HTML as is, or to convert it to BlockNote HTML.
|
|
3947
3987
|
*/
|
|
3948
|
-
pasteHTML(t,
|
|
3949
|
-
this._exportManager.pasteHTML(t,
|
|
3988
|
+
pasteHTML(t, n = !1) {
|
|
3989
|
+
this._exportManager.pasteHTML(t, n);
|
|
3950
3990
|
}
|
|
3951
3991
|
/**
|
|
3952
3992
|
* Paste text into the editor. Defaults to interpreting text as markdown.
|
|
@@ -3963,19 +4003,19 @@ class $e extends Ce {
|
|
|
3963
4003
|
return this._exportManager.pasteMarkdown(t);
|
|
3964
4004
|
}
|
|
3965
4005
|
}
|
|
3966
|
-
class
|
|
3967
|
-
constructor(e, t,
|
|
3968
|
-
this.mappings = t, this.options =
|
|
4006
|
+
class fs {
|
|
4007
|
+
constructor(e, t, n) {
|
|
4008
|
+
this.mappings = t, this.options = n;
|
|
3969
4009
|
}
|
|
3970
4010
|
async resolveFile(e) {
|
|
3971
|
-
var
|
|
3972
|
-
if (!((
|
|
4011
|
+
var n;
|
|
4012
|
+
if (!((n = this.options) != null && n.resolveFileUrl))
|
|
3973
4013
|
return (await fetch(e)).blob();
|
|
3974
4014
|
const t = await this.options.resolveFileUrl(e);
|
|
3975
4015
|
return t instanceof Blob ? t : (await fetch(t)).blob();
|
|
3976
4016
|
}
|
|
3977
4017
|
mapStyles(e) {
|
|
3978
|
-
return Object.entries(e).map(([
|
|
4018
|
+
return Object.entries(e).map(([n, s]) => this.mappings.styleMapping[n](s, this));
|
|
3979
4019
|
}
|
|
3980
4020
|
mapInlineContent(e) {
|
|
3981
4021
|
return this.mappings.inlineContentMapping[e.type](
|
|
@@ -3986,27 +4026,27 @@ class ds {
|
|
|
3986
4026
|
transformInlineContent(e) {
|
|
3987
4027
|
return e.map((t) => this.mapInlineContent(t));
|
|
3988
4028
|
}
|
|
3989
|
-
async mapBlock(e, t,
|
|
4029
|
+
async mapBlock(e, t, n, s) {
|
|
3990
4030
|
return this.mappings.blockMapping[e.type](
|
|
3991
4031
|
e,
|
|
3992
4032
|
this,
|
|
3993
4033
|
t,
|
|
3994
|
-
|
|
4034
|
+
n,
|
|
3995
4035
|
s
|
|
3996
4036
|
);
|
|
3997
4037
|
}
|
|
3998
4038
|
}
|
|
3999
|
-
function
|
|
4039
|
+
function hs(o) {
|
|
4000
4040
|
return {
|
|
4001
4041
|
createBlockMapping: (e) => e,
|
|
4002
4042
|
createInlineContentMapping: (e) => e,
|
|
4003
4043
|
createStyleMapping: (e) => e
|
|
4004
4044
|
};
|
|
4005
4045
|
}
|
|
4006
|
-
function
|
|
4007
|
-
const t = [...
|
|
4008
|
-
for (const
|
|
4009
|
-
for (const s of
|
|
4046
|
+
function ms(o, ...e) {
|
|
4047
|
+
const t = [...o];
|
|
4048
|
+
for (const n of e)
|
|
4049
|
+
for (const s of n) {
|
|
4010
4050
|
const r = t.findLastIndex(
|
|
4011
4051
|
(i) => i.group === s.group
|
|
4012
4052
|
);
|
|
@@ -4017,20 +4057,20 @@ function ps(n, ...e) {
|
|
|
4017
4057
|
export {
|
|
4018
4058
|
ye as BlockChangeExtension,
|
|
4019
4059
|
$e as BlockNoteEditor,
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4060
|
+
wt as BlockNoteSchema,
|
|
4061
|
+
Ls as COLORS_DARK_MODE_DEFAULT,
|
|
4062
|
+
_s as COLORS_DEFAULT,
|
|
4063
|
+
Si as CustomBlockNoteSchema,
|
|
4024
4064
|
Pt as DEFAULT_LINK_PROTOCOL,
|
|
4025
|
-
|
|
4065
|
+
mi as DRAG_EXCLUSION_CLASSNAME,
|
|
4026
4066
|
mt as DropCursorExtension,
|
|
4027
|
-
|
|
4067
|
+
Ds as EMPTY_CELL_HEIGHT,
|
|
4028
4068
|
Xe as EMPTY_CELL_WIDTH,
|
|
4029
4069
|
Ce as EventEmitter,
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4070
|
+
fs as Exporter,
|
|
4071
|
+
Os as FILE_AUDIO_ICON_SVG,
|
|
4072
|
+
$s as FILE_IMAGE_ICON_SVG,
|
|
4073
|
+
Hs as FILE_VIDEO_ICON_SVG,
|
|
4034
4074
|
J as FilePanelExtension,
|
|
4035
4075
|
dt as ForkYDocExtension,
|
|
4036
4076
|
Y as FormattingToolbarExtension,
|
|
@@ -4041,12 +4081,12 @@ export {
|
|
|
4041
4081
|
gt as PlaceholderExtension,
|
|
4042
4082
|
xt as PreviousBlockTypeExtension,
|
|
4043
4083
|
ht as SchemaMigration,
|
|
4044
|
-
|
|
4084
|
+
Wt as ShowSelectionExtension,
|
|
4045
4085
|
Bt as SideMenuExtension,
|
|
4046
|
-
|
|
4086
|
+
ki as SideMenuView,
|
|
4047
4087
|
ge as SuggestionMenu,
|
|
4048
4088
|
St as TableHandlesExtension,
|
|
4049
|
-
|
|
4089
|
+
bi as TableHandlesView,
|
|
4050
4090
|
yt as TrailingNodeExtension,
|
|
4051
4091
|
ke as UniqueID,
|
|
4052
4092
|
U as UnreachableCaseError,
|
|
@@ -4054,163 +4094,163 @@ export {
|
|
|
4054
4094
|
ut as YCursorExtension,
|
|
4055
4095
|
pt as YSyncExtension,
|
|
4056
4096
|
ft as YUndoExtension,
|
|
4057
|
-
|
|
4097
|
+
Fs as addDefaultPropsExternalHTML,
|
|
4058
4098
|
G as addInlineContentAttributes,
|
|
4059
4099
|
Je as addInlineContentKeyboardShortcuts,
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4100
|
+
Vs as addNodeAndExtensionsToSpec,
|
|
4101
|
+
Us as addStyleAttributes,
|
|
4102
|
+
zs as applyNonSelectableBlockFix,
|
|
4103
|
+
gs as assertEmpty,
|
|
4104
|
+
Rs as audioParse,
|
|
4105
|
+
Gs as audioRender,
|
|
4106
|
+
Ws as audioToExternalHTML,
|
|
4107
|
+
js as blockHasType,
|
|
4068
4108
|
Z as blockToNode,
|
|
4069
4109
|
at as blocksToMarkdown,
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4110
|
+
qs as camelToDataKebab,
|
|
4111
|
+
Ks as captureCellAnchor,
|
|
4112
|
+
xi as checkPageBreakBlocksInSchema,
|
|
4073
4113
|
ct as cleanHTMLToMarkdown,
|
|
4074
|
-
|
|
4114
|
+
ms as combineByGroup,
|
|
4075
4115
|
qe as contentNodeToInlineContent,
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4116
|
+
je as contentNodeToTableContent,
|
|
4117
|
+
Js as createAudioBlockConfig,
|
|
4118
|
+
Ys as createAudioBlockSpec,
|
|
4119
|
+
Qs as createBlockConfig,
|
|
4120
|
+
Xs as createBlockSpec,
|
|
4121
|
+
Zs as createBlockSpecFromTiptapNode,
|
|
4122
|
+
er as createBulletListItemBlockConfig,
|
|
4123
|
+
tr as createBulletListItemBlockSpec,
|
|
4124
|
+
or as createCheckListItemBlockSpec,
|
|
4125
|
+
nr as createCheckListItemConfig,
|
|
4126
|
+
sr as createCodeBlockConfig,
|
|
4127
|
+
rr as createCodeBlockSpec,
|
|
4128
|
+
ir as createDefaultBlockDOMOutputSpec,
|
|
4129
|
+
ar as createDividerBlockConfig,
|
|
4130
|
+
cr as createDividerBlockSpec,
|
|
4091
4131
|
Vt as createExtension,
|
|
4092
4132
|
Be as createExternalHTMLExporter,
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4133
|
+
lr as createFileBlockConfig,
|
|
4134
|
+
dr as createFileBlockSpec,
|
|
4135
|
+
ur as createHeadingBlockConfig,
|
|
4136
|
+
pr as createHeadingBlockSpec,
|
|
4137
|
+
fr as createImageBlockConfig,
|
|
4138
|
+
hr as createImageBlockSpec,
|
|
4139
|
+
ps as createInlineContentSpec,
|
|
4100
4140
|
Qe as createInlineContentSpecFromTipTapNode,
|
|
4101
4141
|
lo as createInternalHTMLSerializer,
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4142
|
+
mr as createInternalInlineContentSpec,
|
|
4143
|
+
kr as createInternalStyleSpec,
|
|
4144
|
+
br as createNumberedListItemBlockConfig,
|
|
4145
|
+
gr as createNumberedListItemBlockSpec,
|
|
4146
|
+
Ei as createPageBreakBlockConfig,
|
|
4147
|
+
Pi as createPageBreakBlockSpec,
|
|
4148
|
+
Br as createParagraphBlockConfig,
|
|
4149
|
+
yr as createParagraphBlockSpec,
|
|
4150
|
+
Cr as createQuoteBlockConfig,
|
|
4151
|
+
Sr as createQuoteBlockSpec,
|
|
4152
|
+
Ii as createStore,
|
|
4153
|
+
xr as createStyleSpec,
|
|
4154
|
+
Er as createStyleSpecFromTipTapMark,
|
|
4155
|
+
Pr as createTableBlockSpec,
|
|
4156
|
+
Tr as createToggleListItemBlockConfig,
|
|
4157
|
+
wr as createToggleListItemBlockSpec,
|
|
4158
|
+
Mr as createToggleWrapper,
|
|
4159
|
+
vr as createVideoBlockConfig,
|
|
4160
|
+
Ir as createVideoBlockSpec,
|
|
4161
|
+
Ar as defaultBlockSpecs,
|
|
4162
|
+
Nr as defaultBlockToHTML,
|
|
4163
|
+
Lr as defaultInlineContentSchema,
|
|
4164
|
+
_r as defaultInlineContentSpecs,
|
|
4165
|
+
Dr as defaultProps,
|
|
4166
|
+
Or as defaultStyleSchema,
|
|
4167
|
+
$r as defaultStyleSpecs,
|
|
4168
|
+
Hr as defaultToggledState,
|
|
4169
|
+
We as docToBlocks,
|
|
4170
|
+
Fr as editorHasBlockWithType,
|
|
4171
|
+
Pn as expandPMRangeToWords,
|
|
4172
|
+
Vr as fileParse,
|
|
4173
|
+
Ur as filenameFromURL,
|
|
4174
|
+
zr as filterSuggestionItems,
|
|
4135
4175
|
H as fixColumnList,
|
|
4136
|
-
|
|
4176
|
+
Rr as formatKeyboardShortcut,
|
|
4137
4177
|
tt as getBackgroundColorAttribute,
|
|
4138
4178
|
Bo as getBlock,
|
|
4139
|
-
|
|
4140
|
-
|
|
4179
|
+
Bs as getBlockCache,
|
|
4180
|
+
Gr as getBlockFromPos,
|
|
4141
4181
|
K as getBlockInfo,
|
|
4142
4182
|
v as getBlockInfoFromResolvedPos,
|
|
4143
4183
|
B as getBlockInfoFromSelection,
|
|
4144
4184
|
z as getBlockInfoFromTransaction,
|
|
4145
|
-
|
|
4185
|
+
ys as getBlockInfoWithManualOffset,
|
|
4146
4186
|
be as getBlockNoteSchema,
|
|
4147
|
-
|
|
4187
|
+
Cs as getBlockSchema,
|
|
4148
4188
|
it as getBlocksChangedByTransaction,
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4189
|
+
Ss as getColspan,
|
|
4190
|
+
gi as getDefaultEmojiPickerItems,
|
|
4191
|
+
Wr as getDefaultSlashMenuItems,
|
|
4152
4192
|
Xt as getInlineContentParseRules,
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4193
|
+
xs as getInlineContentSchema,
|
|
4194
|
+
jr as getInlineContentSchemaFromSpecs,
|
|
4195
|
+
qr as getLanguageId,
|
|
4156
4196
|
D as getNearestBlockPos,
|
|
4157
4197
|
Co as getNextBlock,
|
|
4158
4198
|
P as getNodeById,
|
|
4159
|
-
|
|
4199
|
+
Ti as getPageBreakSlashMenuItems,
|
|
4160
4200
|
So as getParentBlock,
|
|
4161
|
-
|
|
4201
|
+
Kr as getParseRules,
|
|
4162
4202
|
E as getPmSchema,
|
|
4163
4203
|
yo as getPrevBlock,
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4204
|
+
Es as getRowspan,
|
|
4205
|
+
Jr as getStyleParseRules,
|
|
4206
|
+
Ps as getStyleSchema,
|
|
4207
|
+
Yr as getStyleSchemaFromSpecs,
|
|
4208
|
+
Qr as getTextAlignmentAttribute,
|
|
4169
4209
|
st as getTextColorAttribute,
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4210
|
+
Xr as imageParse,
|
|
4211
|
+
Zr as imageRender,
|
|
4212
|
+
ei as imageToExternalHTML,
|
|
4173
4213
|
V as inlineContentToNodes,
|
|
4174
4214
|
Zt as insertBlocks,
|
|
4175
|
-
|
|
4176
|
-
|
|
4215
|
+
ti as insertOrUpdateBlockForSlashMenu,
|
|
4216
|
+
oi as isAppleOS,
|
|
4177
4217
|
Q as isEmptyColumn,
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4218
|
+
Ts as isLinkInlineContent,
|
|
4219
|
+
ni as isNodeBlock,
|
|
4220
|
+
ws as isPartialLinkInlineContent,
|
|
4221
|
+
Ms as isPartialTableCell,
|
|
4222
|
+
si as isSafari,
|
|
4223
|
+
vs as isStyledTextInlineContent,
|
|
4224
|
+
Is as isTableCell,
|
|
4225
|
+
ri as isTableCellSelection,
|
|
4186
4226
|
et as isVideoUrl,
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4227
|
+
As as mapTableCell,
|
|
4228
|
+
hs as mappingFactory,
|
|
4229
|
+
Oo as markdownToBlocks,
|
|
4190
4230
|
Ie as markdownToHTML,
|
|
4191
4231
|
ee as mergeCSSClasses,
|
|
4192
|
-
|
|
4232
|
+
ii as mergeParagraphs,
|
|
4193
4233
|
C as nodeToBlock,
|
|
4194
4234
|
q as nodeToCustomInlineContent,
|
|
4195
|
-
|
|
4196
|
-
|
|
4235
|
+
ai as parseAudioElement,
|
|
4236
|
+
ci as parseDefaultProps,
|
|
4197
4237
|
Ye as propsToAttributes,
|
|
4198
4238
|
Ke as prosemirrorSliceToSlicedBlocks,
|
|
4199
4239
|
ae as removeAndInsertBlocks,
|
|
4200
4240
|
eo as removeEmptyColumns,
|
|
4201
4241
|
Ne as selectedFragmentToHTML,
|
|
4202
|
-
|
|
4203
|
-
|
|
4242
|
+
Bi as sideMenuPluginKey,
|
|
4243
|
+
li as stylePropsToAttributes,
|
|
4204
4244
|
Ge as tableContentToNodes,
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4245
|
+
yi as tableHandlesPluginKey,
|
|
4246
|
+
di as tablePropSchema,
|
|
4247
|
+
ui as trackPosition,
|
|
4208
4248
|
Ze as updateBlock,
|
|
4209
4249
|
nt as updateBlockCommand,
|
|
4210
4250
|
rt as updateBlockTr,
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4251
|
+
wi as uploadToTmpFilesDotOrg_DEV_ONLY,
|
|
4252
|
+
pi as videoParse,
|
|
4253
|
+
Mi as withPageBreak,
|
|
4254
|
+
fi as wrapInBlockStructure
|
|
4215
4255
|
};
|
|
4216
4256
|
//# sourceMappingURL=blocknote.js.map
|