@blocknote/core 0.47.0 → 0.47.1
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/{BlockNoteSchema-DT4bdXj5.cjs → BlockNoteSchema-CwhtPpVC.cjs} +2 -2
- package/dist/{BlockNoteSchema-DT4bdXj5.cjs.map → BlockNoteSchema-CwhtPpVC.cjs.map} +1 -1
- package/dist/{BlockNoteSchema-1r-ln0Q0.js → BlockNoteSchema-dmbNkHA-.js} +2 -2
- package/dist/{BlockNoteSchema-1r-ln0Q0.js.map → BlockNoteSchema-dmbNkHA-.js.map} +1 -1
- package/dist/TrailingNode-DHOdUVUO.cjs +2 -0
- package/dist/TrailingNode-DHOdUVUO.cjs.map +1 -0
- package/dist/{TrailingNode-DZag-Nvu.js → TrailingNode-F9hX_UlQ.js} +5 -3
- package/dist/TrailingNode-F9hX_UlQ.js.map +1 -0
- package/dist/blocknote.cjs +4 -4
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +1169 -954
- package/dist/blocknote.js.map +1 -1
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +2 -2
- package/dist/{defaultBlocks-D049Pbme.cjs → defaultBlocks-CSB5GiAu.cjs} +5 -5
- package/dist/defaultBlocks-CSB5GiAu.cjs.map +1 -0
- package/dist/{defaultBlocks-BSOEW3GR.js → defaultBlocks-Caw1U1oV.js} +47 -44
- package/dist/defaultBlocks-Caw1U1oV.js.map +1 -0
- package/dist/extensions.cjs +1 -1
- package/dist/extensions.js +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +1 -1
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +30 -7
- package/src/extensions/Collaboration/YCursorPlugin.ts +3 -1
- package/src/extensions/SuggestionMenu/SuggestionMenu.test.ts +191 -0
- package/src/extensions/SuggestionMenu/SuggestionMenu.ts +28 -11
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +433 -53
- package/src/schema/blocks/createSpec.ts +2 -0
- package/types/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.d.ts +5 -0
- package/types/src/extensions/SuggestionMenu/SuggestionMenu.d.ts +12 -3
- package/types/src/extensions/SuggestionMenu/SuggestionMenu.test.d.ts +1 -0
- package/dist/TrailingNode-DZag-Nvu.js.map +0 -1
- package/dist/TrailingNode-tesI8f7N.cjs +0 -2
- package/dist/TrailingNode-tesI8f7N.cjs.map +0 -1
- package/dist/defaultBlocks-BSOEW3GR.js.map +0 -1
- package/dist/defaultBlocks-D049Pbme.cjs.map +0 -1
package/dist/blocknote.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
var Fe = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { Slice as
|
|
5
|
-
import { ReplaceStep as
|
|
6
|
-
import { n as
|
|
7
|
-
import { B as
|
|
8
|
-
import { ak as
|
|
9
|
-
import { aw as
|
|
10
|
-
import { j as
|
|
11
|
-
import { s as
|
|
12
|
-
import { C as
|
|
13
|
-
import { Node as
|
|
14
|
-
import { E as
|
|
15
|
-
import { Fragment as
|
|
16
|
-
import { e as
|
|
17
|
-
import { inputRules as
|
|
2
|
+
var Ve = (n, e, t) => e in n ? Fe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var k = (n, e, t) => Ve(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Slice as F, Fragment as w, DOMSerializer as me, DOMParser as Ue, Node as ze } from "prosemirror-model";
|
|
5
|
+
import { ReplaceStep as Re, ReplaceAroundStep as W } 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 je, s as We, 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 ms, G as ks, C as bs, D as gs, N as Bs, E as ys, O as Cs, F as Ss, H as xs, I as Es, L as Ps, J as Ts, M as Ms, K as ws } from "./blockToNode-BNoNIXU7.js";
|
|
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-Caw1U1oV.js";
|
|
9
|
+
import { aw as Is, av as As, E as Ns, F as _s, r as Ls, N as Ds, a4 as Os, ad as $s, aG as Hs, ax as Fs, b as Vs, d as Us, e as zs, a0 as Rs, aM as Gs, au as js, c as Ws, f as qs, ag as Ks, ah as Js, aB as Ys, x as Qs, y as Xs, A as Zs, z as er, g as tr, h as or, T as nr, j as sr, k as rr, l as ir, n as ar, o as cr, q as lr, s as dr, w as ur, aC as pr, aH as fr, B as hr, C as mr, H as kr, I as br, J as gr, K as Br, aE as yr, aI as Cr, M as Sr, D as xr, G as Er, S as Pr, O as Tr, Q as Mr, W as wr, U as vr, _ as Ir, Z as Ar, a2 as Nr, Y as _r, X as Lr, R as Dr, $ as Or, m as $r, aN as Hr, aK as Fr, az as Vr, af as Ur, i as zr, ay as Rr, aD as Gr, ae as jr, a7 as Wr, t as qr, u as Kr, v as Jr, aJ as Yr, ai as Qr, aL as Xr, a1 as Zr, V as ei, p as ti, a3 as oi, aF as ni, L as si, aO as ri, P as ii, aA as ai } from "./defaultBlocks-Caw1U1oV.js";
|
|
10
|
+
import { j as it, k as Be, l as at, m as ct, n as lt, c as Y, F as dt, Y as ut, a as pt, b as ft, S as ht, B as ye, D as mt, L as kt, N as bt, P as gt, g as Bt, i as yt, H as Ct, h as St, e as xt, V as Et, d as Pt } from "./TrailingNode-F9hX_UlQ.js";
|
|
11
|
+
import { s as Tt, B as Mt } from "./BlockNoteSchema-dmbNkHA-.js";
|
|
12
|
+
import { C as li, b as di, c as ui, a as pi, g as fi, u as hi, w as mi } from "./BlockNoteSchema-dmbNkHA-.js";
|
|
13
|
+
import { Node as O, Extension as T, mergeAttributes as wt, Mark as te, extensions as N, isNodeSelection as vt, posToDOMRect as It, selectionToInsertionEnd as At, findParentNodeClosestToPos as Nt, getSchema as _t, createDocument as Lt, Editor as Dt } from "@tiptap/core";
|
|
14
|
+
import { E as Ce } from "./EventEmitter-CjSwpTbz.js";
|
|
15
|
+
import { Fragment as R, Slice as j } from "@tiptap/pm/model";
|
|
16
|
+
import { e as Ot } from "./en-njEqD7AG.js";
|
|
17
|
+
import { inputRules as $t, InputRule as Ht } from "@handlewithcare/prosemirror-inputrules";
|
|
18
18
|
import { keymap as Ft } from "@tiptap/pm/keymap";
|
|
19
|
-
import { c as
|
|
20
|
-
import { a as
|
|
21
|
-
import { Gapcursor as
|
|
22
|
-
import { Link as
|
|
23
|
-
import { Text as
|
|
24
|
-
import { NodeSelection as
|
|
25
|
-
import { CellSelection as
|
|
26
|
-
import { S as
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import { unified as
|
|
32
|
-
import { TextSelection as
|
|
33
|
-
function
|
|
19
|
+
import { c as Vt, o as Ut } from "./BlockNoteExtension-C2X7LW-V.js";
|
|
20
|
+
import { a as bi } from "./BlockNoteExtension-C2X7LW-V.js";
|
|
21
|
+
import { Gapcursor as zt } from "@tiptap/extensions/gap-cursor";
|
|
22
|
+
import { Link as Rt } from "@tiptap/extension-link";
|
|
23
|
+
import { Text as Gt } from "@tiptap/extension-text";
|
|
24
|
+
import { NodeSelection as $, TextSelection as S, Plugin as oe } from "prosemirror-state";
|
|
25
|
+
import { CellSelection as ne, TableMap as re } from "prosemirror-tables";
|
|
26
|
+
import { S as jt } from "./ShowSelection-B0ch3unP.js";
|
|
27
|
+
import Wt from "remark-gfm";
|
|
28
|
+
import qt from "remark-parse";
|
|
29
|
+
import Kt, { defaultHandlers as ie } from "remark-rehype";
|
|
30
|
+
import Jt from "rehype-stringify";
|
|
31
|
+
import { unified as Yt } from "unified";
|
|
32
|
+
import { TextSelection as Qt } from "@tiptap/pm/state";
|
|
33
|
+
function Xt(n, e) {
|
|
34
34
|
const t = [
|
|
35
35
|
{
|
|
36
36
|
tag: `[data-inline-content-type="${n.type}"]`,
|
|
@@ -50,9 +50,9 @@ function Yt(n, e) {
|
|
|
50
50
|
}
|
|
51
51
|
}), t;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function ls(n, e) {
|
|
54
54
|
var o;
|
|
55
|
-
const t =
|
|
55
|
+
const t = O.create({
|
|
56
56
|
name: n.type,
|
|
57
57
|
inline: !0,
|
|
58
58
|
group: "inline",
|
|
@@ -61,21 +61,21 @@ function is(n, e) {
|
|
|
61
61
|
atom: n.content === "none",
|
|
62
62
|
content: n.content === "styled" ? "inline*" : "",
|
|
63
63
|
addAttributes() {
|
|
64
|
-
return
|
|
64
|
+
return Ye(n.propSchema);
|
|
65
65
|
},
|
|
66
66
|
addKeyboardShortcuts() {
|
|
67
|
-
return
|
|
67
|
+
return Je(n);
|
|
68
68
|
},
|
|
69
69
|
parseHTML() {
|
|
70
|
-
return
|
|
70
|
+
return Xt(
|
|
71
71
|
n,
|
|
72
72
|
e.parse
|
|
73
73
|
);
|
|
74
74
|
},
|
|
75
75
|
renderHTML({ node: s }) {
|
|
76
|
-
const r = this.options.editor,
|
|
76
|
+
const r = this.options.editor, i = e.render.call(
|
|
77
77
|
{ renderType: "dom", props: void 0 },
|
|
78
|
-
|
|
78
|
+
q(
|
|
79
79
|
s,
|
|
80
80
|
r.schema.inlineContentSchema,
|
|
81
81
|
r.schema.styleSchema
|
|
@@ -85,8 +85,8 @@ function is(n, e) {
|
|
|
85
85
|
},
|
|
86
86
|
r
|
|
87
87
|
);
|
|
88
|
-
return
|
|
89
|
-
|
|
88
|
+
return G(
|
|
89
|
+
i,
|
|
90
90
|
n.type,
|
|
91
91
|
s.attrs,
|
|
92
92
|
n.propSchema
|
|
@@ -94,24 +94,24 @@ function is(n, e) {
|
|
|
94
94
|
},
|
|
95
95
|
addNodeView() {
|
|
96
96
|
return (s) => {
|
|
97
|
-
const { node: r, getPos:
|
|
97
|
+
const { node: r, getPos: i } = s, l = this.options.editor, a = e.render.call(
|
|
98
98
|
{ renderType: "nodeView", props: s },
|
|
99
|
-
|
|
99
|
+
q(
|
|
100
100
|
r,
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
l.schema.inlineContentSchema,
|
|
102
|
+
l.schema.styleSchema
|
|
103
103
|
),
|
|
104
104
|
// TODO: fix cast
|
|
105
|
-
(
|
|
106
|
-
const d =
|
|
107
|
-
u &&
|
|
105
|
+
(c) => {
|
|
106
|
+
const d = V([c], l.pmSchema), u = i();
|
|
107
|
+
u && l.transact(
|
|
108
108
|
(p) => p.replaceWith(u, u + r.nodeSize, d)
|
|
109
109
|
);
|
|
110
110
|
},
|
|
111
|
-
|
|
111
|
+
l
|
|
112
112
|
);
|
|
113
|
-
return
|
|
114
|
-
|
|
113
|
+
return G(
|
|
114
|
+
a,
|
|
115
115
|
n.type,
|
|
116
116
|
r.attrs,
|
|
117
117
|
n.propSchema
|
|
@@ -119,20 +119,20 @@ function is(n, e) {
|
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
|
-
return
|
|
122
|
+
return Qe(
|
|
123
123
|
t,
|
|
124
124
|
n.propSchema,
|
|
125
125
|
{
|
|
126
126
|
...e,
|
|
127
127
|
toExternalHTML: e.toExternalHTML,
|
|
128
|
-
render(s, r,
|
|
129
|
-
const
|
|
128
|
+
render(s, r, i) {
|
|
129
|
+
const l = e.render(
|
|
130
130
|
s,
|
|
131
131
|
r,
|
|
132
|
-
|
|
132
|
+
i
|
|
133
133
|
);
|
|
134
|
-
return
|
|
135
|
-
|
|
134
|
+
return G(
|
|
135
|
+
l,
|
|
136
136
|
n.type,
|
|
137
137
|
s.props,
|
|
138
138
|
n.propSchema
|
|
@@ -141,20 +141,20 @@ function is(n, e) {
|
|
|
141
141
|
}
|
|
142
142
|
);
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
const s = typeof t == "string" ? t : t.id, r =
|
|
146
|
-
(d) =>
|
|
147
|
-
),
|
|
148
|
-
if (!
|
|
144
|
+
function Zt(n, e, t, o = "before") {
|
|
145
|
+
const s = typeof t == "string" ? t : t.id, r = E(n), i = e.map(
|
|
146
|
+
(d) => Z(d, r)
|
|
147
|
+
), l = P(s, n.doc);
|
|
148
|
+
if (!l)
|
|
149
149
|
throw new Error(`Block with ID ${s} not found`);
|
|
150
|
-
let
|
|
151
|
-
return o === "after" && (
|
|
152
|
-
new
|
|
153
|
-
),
|
|
154
|
-
(d) =>
|
|
150
|
+
let a = l.posBeforeNode;
|
|
151
|
+
return o === "after" && (a += l.node.nodeSize), n.step(
|
|
152
|
+
new Re(a, a, new F(w.from(i), 0, 0))
|
|
153
|
+
), i.map(
|
|
154
|
+
(d) => C(d, r)
|
|
155
155
|
);
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function Q(n) {
|
|
158
158
|
if (!n || n.type.name !== "column")
|
|
159
159
|
throw new Error("Invalid columnPos: does not point to column node.");
|
|
160
160
|
const e = n.firstChild;
|
|
@@ -165,21 +165,21 @@ function q(n) {
|
|
|
165
165
|
throw new Error("Invalid blockContainer: does not have child node.");
|
|
166
166
|
return n.childCount === 1 && e.childCount === 1 && t.type.name === "paragraph" && t.content.content.length === 0;
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function eo(n, e) {
|
|
169
169
|
const t = n.doc.resolve(e), o = t.nodeAfter;
|
|
170
170
|
if (!o || o.type.name !== "columnList")
|
|
171
171
|
throw new Error(
|
|
172
172
|
"Invalid columnListPos: does not point to columnList node."
|
|
173
173
|
);
|
|
174
174
|
for (let s = o.childCount - 1; s >= 0; s--) {
|
|
175
|
-
const r = n.doc.resolve(t.pos + 1).posAtIndex(s),
|
|
176
|
-
if (!
|
|
175
|
+
const r = n.doc.resolve(t.pos + 1).posAtIndex(s), l = n.doc.resolve(r).nodeAfter;
|
|
176
|
+
if (!l || l.type.name !== "column")
|
|
177
177
|
throw new Error("Invalid columnPos: does not point to column node.");
|
|
178
|
-
|
|
178
|
+
Q(l) && n.delete(r, r + l.nodeSize);
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
function
|
|
182
|
-
|
|
181
|
+
function H(n, e) {
|
|
182
|
+
eo(n, e);
|
|
183
183
|
const o = n.doc.resolve(e).nodeAfter;
|
|
184
184
|
if (!o || o.type.name !== "columnList")
|
|
185
185
|
throw new Error(
|
|
@@ -189,25 +189,25 @@ function K(n, e) {
|
|
|
189
189
|
return;
|
|
190
190
|
if (o.childCount < 2)
|
|
191
191
|
throw new Error("Invalid columnList: contains fewer than two children.");
|
|
192
|
-
const s = e + 1,
|
|
193
|
-
if (!
|
|
192
|
+
const s = e + 1, i = n.doc.resolve(s).nodeAfter, l = e + o.nodeSize - 1, c = n.doc.resolve(l).nodeBefore;
|
|
193
|
+
if (!i || !c)
|
|
194
194
|
throw new Error("Invalid columnList: does not contain children.");
|
|
195
|
-
const d =
|
|
195
|
+
const d = Q(i), u = Q(c);
|
|
196
196
|
if (d && u) {
|
|
197
197
|
n.delete(e, e + o.nodeSize);
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
200
200
|
if (d) {
|
|
201
201
|
n.step(
|
|
202
|
-
new
|
|
202
|
+
new W(
|
|
203
203
|
// Replaces `columnList`.
|
|
204
204
|
e,
|
|
205
205
|
e + o.nodeSize,
|
|
206
206
|
// Replaces with content of last `column`.
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
l - c.nodeSize + 1,
|
|
208
|
+
l - 1,
|
|
209
209
|
// Doesn't append anything.
|
|
210
|
-
|
|
210
|
+
F.empty,
|
|
211
211
|
0,
|
|
212
212
|
!1
|
|
213
213
|
)
|
|
@@ -216,15 +216,15 @@ function K(n, e) {
|
|
|
216
216
|
}
|
|
217
217
|
if (u) {
|
|
218
218
|
n.step(
|
|
219
|
-
new
|
|
219
|
+
new W(
|
|
220
220
|
// Replaces `columnList`.
|
|
221
221
|
e,
|
|
222
222
|
e + o.nodeSize,
|
|
223
223
|
// Replaces with content of first `column`.
|
|
224
224
|
s + 1,
|
|
225
|
-
s +
|
|
225
|
+
s + i.nodeSize - 1,
|
|
226
226
|
// Doesn't append anything.
|
|
227
|
-
|
|
227
|
+
F.empty,
|
|
228
228
|
0,
|
|
229
229
|
!1
|
|
230
230
|
)
|
|
@@ -233,29 +233,29 @@ function K(n, e) {
|
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
function ae(n, e, t) {
|
|
236
|
-
const o =
|
|
237
|
-
(u) =>
|
|
236
|
+
const o = E(n), s = t.map(
|
|
237
|
+
(u) => Z(u, o)
|
|
238
238
|
), r = new Set(
|
|
239
239
|
e.map(
|
|
240
240
|
(u) => typeof u == "string" ? u : u.id
|
|
241
241
|
)
|
|
242
|
-
),
|
|
243
|
-
let
|
|
242
|
+
), i = [], l = /* @__PURE__ */ new Set(), a = typeof e[0] == "string" ? e[0] : e[0].id;
|
|
243
|
+
let c = 0;
|
|
244
244
|
if (n.doc.descendants((u, p) => {
|
|
245
245
|
if (r.size === 0)
|
|
246
246
|
return !1;
|
|
247
247
|
if (!u.type.isInGroup("bnBlock") || !r.has(u.attrs.id))
|
|
248
248
|
return !0;
|
|
249
|
-
if (
|
|
249
|
+
if (i.push(C(u, o)), r.delete(u.attrs.id), t.length > 0 && u.attrs.id === a) {
|
|
250
250
|
const b = n.doc.nodeSize;
|
|
251
251
|
n.insert(p, s);
|
|
252
252
|
const g = n.doc.nodeSize;
|
|
253
|
-
|
|
253
|
+
c += b - g;
|
|
254
254
|
}
|
|
255
|
-
const
|
|
256
|
-
f.node().type.name === "column" ?
|
|
257
|
-
const
|
|
258
|
-
return
|
|
255
|
+
const h = n.doc.nodeSize, f = n.doc.resolve(p - c);
|
|
256
|
+
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 ? n.delete(f.before(), f.after()) : n.delete(p - c, p - c + u.nodeSize);
|
|
257
|
+
const m = n.doc.nodeSize;
|
|
258
|
+
return c += h - m, !1;
|
|
259
259
|
}), r.size > 0) {
|
|
260
260
|
const u = [...r].join(`
|
|
261
261
|
`);
|
|
@@ -263,32 +263,32 @@ function ae(n, e, t) {
|
|
|
263
263
|
"Blocks with the following IDs could not be found in the editor: " + u
|
|
264
264
|
);
|
|
265
265
|
}
|
|
266
|
-
return
|
|
267
|
-
(u) =>
|
|
268
|
-
), removedBlocks:
|
|
266
|
+
return l.forEach((u) => H(n, u)), { insertedBlocks: s.map(
|
|
267
|
+
(u) => C(u, o)
|
|
268
|
+
), removedBlocks: i };
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function to(n, e, t, o, s) {
|
|
271
271
|
let r;
|
|
272
272
|
if (e)
|
|
273
273
|
if (typeof e == "string")
|
|
274
|
-
r =
|
|
274
|
+
r = V([e], n.pmSchema, o);
|
|
275
275
|
else if (Array.isArray(e))
|
|
276
|
-
r =
|
|
276
|
+
r = V(e, n.pmSchema, o);
|
|
277
277
|
else if (e.type === "tableContent")
|
|
278
|
-
r =
|
|
278
|
+
r = Ge(e, n.pmSchema);
|
|
279
279
|
else
|
|
280
|
-
throw new
|
|
280
|
+
throw new U(e.type);
|
|
281
281
|
else throw new Error("blockContent is required");
|
|
282
|
-
const
|
|
283
|
-
for (const
|
|
284
|
-
if (
|
|
285
|
-
const
|
|
286
|
-
if (
|
|
287
|
-
const d =
|
|
288
|
-
|
|
282
|
+
const l = ((s == null ? void 0 : s.document) ?? document).createDocumentFragment();
|
|
283
|
+
for (const a of r)
|
|
284
|
+
if (a.type.name !== "text" && n.schema.inlineContentSchema[a.type.name]) {
|
|
285
|
+
const c = n.schema.inlineContentSpecs[a.type.name].implementation;
|
|
286
|
+
if (c) {
|
|
287
|
+
const d = q(
|
|
288
|
+
a,
|
|
289
289
|
n.schema.inlineContentSchema,
|
|
290
290
|
n.schema.styleSchema
|
|
291
|
-
), u =
|
|
291
|
+
), u = c.render.call(
|
|
292
292
|
{
|
|
293
293
|
renderType: "dom",
|
|
294
294
|
props: void 0
|
|
@@ -299,9 +299,9 @@ function Zt(n, e, t, o, s) {
|
|
|
299
299
|
n
|
|
300
300
|
);
|
|
301
301
|
if (u) {
|
|
302
|
-
if (
|
|
302
|
+
if (l.appendChild(u.dom), u.contentDOM) {
|
|
303
303
|
const p = t.serializeFragment(
|
|
304
|
-
|
|
304
|
+
a.content,
|
|
305
305
|
s
|
|
306
306
|
);
|
|
307
307
|
u.contentDOM.dataset.editable = "", u.contentDOM.appendChild(p);
|
|
@@ -309,45 +309,45 @@ function Zt(n, e, t, o, s) {
|
|
|
309
309
|
continue;
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
-
} else if (
|
|
313
|
-
let
|
|
314
|
-
|
|
312
|
+
} else if (a.type.name === "text") {
|
|
313
|
+
let c = document.createTextNode(
|
|
314
|
+
a.textContent
|
|
315
315
|
);
|
|
316
|
-
for (const d of
|
|
316
|
+
for (const d of a.marks.toReversed())
|
|
317
317
|
if (d.type.name in n.schema.styleSpecs) {
|
|
318
318
|
const u = n.schema.styleSpecs[d.type.name].implementation.render(d.attrs.stringValue, n);
|
|
319
|
-
u.contentDOM.appendChild(
|
|
319
|
+
u.contentDOM.appendChild(c), c = u.dom;
|
|
320
320
|
} else {
|
|
321
|
-
const u = d.type.spec.toDOM(d, !0), p =
|
|
322
|
-
p.contentDOM.appendChild(
|
|
321
|
+
const u = d.type.spec.toDOM(d, !0), p = me.renderSpec(document, u);
|
|
322
|
+
p.contentDOM.appendChild(c), c = p.dom;
|
|
323
323
|
}
|
|
324
|
-
|
|
324
|
+
l.appendChild(c);
|
|
325
325
|
} else {
|
|
326
|
-
const
|
|
327
|
-
|
|
326
|
+
const c = t.serializeFragment(
|
|
327
|
+
w.from([a]),
|
|
328
328
|
s
|
|
329
329
|
);
|
|
330
|
-
|
|
330
|
+
l.appendChild(c);
|
|
331
331
|
}
|
|
332
|
-
return
|
|
332
|
+
return l;
|
|
333
333
|
}
|
|
334
|
-
function
|
|
335
|
-
var u, p,
|
|
334
|
+
function oo(n, e, t, o) {
|
|
335
|
+
var u, p, h, f, m;
|
|
336
336
|
const s = n.pmSchema.nodes.blockContainer, r = e.props || {};
|
|
337
337
|
for (const [b, g] of Object.entries(
|
|
338
338
|
n.schema.blockSchema[e.type].propSchema
|
|
339
339
|
))
|
|
340
340
|
!(b in r) && g.default !== void 0 && (r[b] = g.default);
|
|
341
|
-
const
|
|
341
|
+
const i = e.children || [], a = n.blockImplementations[e.type].implementation.render.call(
|
|
342
342
|
{
|
|
343
343
|
renderType: "dom",
|
|
344
344
|
props: void 0
|
|
345
345
|
},
|
|
346
|
-
{ ...e, props: r, children:
|
|
346
|
+
{ ...e, props: r, children: i },
|
|
347
347
|
n
|
|
348
348
|
);
|
|
349
|
-
if (
|
|
350
|
-
const b =
|
|
349
|
+
if (a.contentDOM && e.content) {
|
|
350
|
+
const b = to(
|
|
351
351
|
n,
|
|
352
352
|
e.content,
|
|
353
353
|
// TODO
|
|
@@ -355,44 +355,44 @@ function eo(n, e, t, o) {
|
|
|
355
355
|
e.type,
|
|
356
356
|
o
|
|
357
357
|
);
|
|
358
|
-
|
|
358
|
+
a.contentDOM.appendChild(b);
|
|
359
359
|
}
|
|
360
360
|
if (n.pmSchema.nodes[e.type].isInGroup("bnBlock")) {
|
|
361
361
|
if (e.children && e.children.length > 0) {
|
|
362
|
-
const b =
|
|
362
|
+
const b = Se(
|
|
363
363
|
n,
|
|
364
364
|
e.children,
|
|
365
365
|
t,
|
|
366
366
|
o
|
|
367
367
|
);
|
|
368
|
-
(u =
|
|
368
|
+
(u = a.contentDOM) == null || u.append(b);
|
|
369
369
|
}
|
|
370
|
-
return
|
|
370
|
+
return a.dom;
|
|
371
371
|
}
|
|
372
|
-
const d = (
|
|
372
|
+
const d = (h = (p = s.spec) == null ? void 0 : p.toDOM) == null ? void 0 : h.call(
|
|
373
373
|
p,
|
|
374
374
|
s.create({
|
|
375
375
|
id: e.id,
|
|
376
376
|
...r
|
|
377
377
|
})
|
|
378
378
|
);
|
|
379
|
-
return (f = d.contentDOM) == null || f.appendChild(
|
|
380
|
-
|
|
379
|
+
return (f = d.contentDOM) == null || f.appendChild(a.dom), e.children && e.children.length > 0 && ((m = d.contentDOM) == null || m.appendChild(
|
|
380
|
+
xe(n, e.children, t, o)
|
|
381
381
|
)), d.dom;
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function Se(n, e, t, o) {
|
|
384
384
|
const r = ((o == null ? void 0 : o.document) ?? document).createDocumentFragment();
|
|
385
|
-
for (const
|
|
386
|
-
const
|
|
387
|
-
r.appendChild(
|
|
385
|
+
for (const i of e) {
|
|
386
|
+
const l = oo(n, i, t, o);
|
|
387
|
+
r.appendChild(l);
|
|
388
388
|
}
|
|
389
389
|
return r;
|
|
390
390
|
}
|
|
391
|
-
const
|
|
392
|
-
var
|
|
393
|
-
const s = n.pmSchema.nodes.blockGroup, r = s.spec.toDOM(s.create({})),
|
|
394
|
-
return (
|
|
395
|
-
},
|
|
391
|
+
const xe = (n, e, t, o) => {
|
|
392
|
+
var l;
|
|
393
|
+
const s = n.pmSchema.nodes.blockGroup, r = s.spec.toDOM(s.create({})), i = Se(n, e, t, o);
|
|
394
|
+
return (l = r.contentDOM) == null || l.appendChild(i), r.dom;
|
|
395
|
+
}, no = (n) => (n.querySelectorAll(
|
|
396
396
|
'[data-content-type="numberedListItem"]'
|
|
397
397
|
).forEach((t) => {
|
|
398
398
|
var s, r;
|
|
@@ -405,76 +405,76 @@ const Ce = (n, e, t, o) => {
|
|
|
405
405
|
t.getAttribute("data-start") || "1"
|
|
406
406
|
);
|
|
407
407
|
else {
|
|
408
|
-
const
|
|
408
|
+
const i = o.getAttribute("data-index");
|
|
409
409
|
t.setAttribute(
|
|
410
410
|
"data-index",
|
|
411
|
-
(parseInt(
|
|
411
|
+
(parseInt(i || "0") + 1).toString()
|
|
412
412
|
);
|
|
413
413
|
}
|
|
414
|
-
}), n),
|
|
414
|
+
}), n), so = (n) => (n.querySelectorAll(
|
|
415
415
|
'[data-content-type="checkListItem"] input'
|
|
416
416
|
).forEach((t) => {
|
|
417
417
|
t.disabled = !0;
|
|
418
|
-
}), n),
|
|
418
|
+
}), n), ro = (n) => (n.querySelectorAll(
|
|
419
419
|
'.bn-toggle-wrapper[data-show-children="false"]'
|
|
420
420
|
).forEach((t) => {
|
|
421
421
|
t.setAttribute("data-show-children", "true");
|
|
422
|
-
}), n),
|
|
422
|
+
}), n), io = (n) => (n.querySelectorAll('[data-content-type="table"] table').forEach((t) => {
|
|
423
423
|
t.setAttribute(
|
|
424
424
|
"style",
|
|
425
|
-
`--default-cell-min-width: ${
|
|
425
|
+
`--default-cell-min-width: ${Xe}px;`
|
|
426
426
|
), t.setAttribute("data-show-children", "true");
|
|
427
|
-
}), n),
|
|
427
|
+
}), n), ao = (n) => (n.querySelectorAll('[data-content-type="table"] table').forEach((t) => {
|
|
428
428
|
var r;
|
|
429
429
|
const o = document.createElement("div");
|
|
430
430
|
o.className = "tableWrapper";
|
|
431
431
|
const s = document.createElement("div");
|
|
432
432
|
s.className = "tableWrapper-inner", o.appendChild(s), (r = t.parentElement) == null || r.appendChild(o), o.appendChild(t);
|
|
433
|
-
}), n),
|
|
433
|
+
}), n), co = (n) => (n.querySelectorAll(
|
|
434
434
|
".bn-inline-content:empty"
|
|
435
435
|
).forEach((t) => {
|
|
436
436
|
const o = document.createElement("span");
|
|
437
437
|
o.className = "ProseMirror-trailingBreak", o.setAttribute("style", "display: inline-block;"), t.appendChild(o);
|
|
438
|
-
}), n),
|
|
439
|
-
const t =
|
|
440
|
-
to,
|
|
441
|
-
oo,
|
|
438
|
+
}), n), lo = (n, e) => {
|
|
439
|
+
const t = me.fromSchema(n), o = [
|
|
442
440
|
no,
|
|
443
441
|
so,
|
|
444
442
|
ro,
|
|
445
|
-
|
|
443
|
+
io,
|
|
444
|
+
ao,
|
|
445
|
+
co
|
|
446
446
|
];
|
|
447
447
|
return {
|
|
448
448
|
serializeBlocks: (s, r) => {
|
|
449
|
-
let
|
|
449
|
+
let i = xe(
|
|
450
450
|
e,
|
|
451
451
|
s,
|
|
452
452
|
t,
|
|
453
453
|
r
|
|
454
454
|
);
|
|
455
|
-
for (const
|
|
456
|
-
|
|
457
|
-
return
|
|
455
|
+
for (const l of o)
|
|
456
|
+
i = l(i);
|
|
457
|
+
return i.outerHTML;
|
|
458
458
|
}
|
|
459
459
|
};
|
|
460
460
|
};
|
|
461
|
-
function
|
|
461
|
+
function uo(n) {
|
|
462
462
|
return n.transact((e) => {
|
|
463
|
-
const t =
|
|
464
|
-
if (e.selection instanceof
|
|
463
|
+
const t = D(e.doc, e.selection.anchor);
|
|
464
|
+
if (e.selection instanceof ne)
|
|
465
465
|
return {
|
|
466
466
|
type: "cell",
|
|
467
467
|
anchorBlockId: t.node.attrs.id,
|
|
468
468
|
anchorCellOffset: e.selection.$anchorCell.pos - t.posBeforeNode,
|
|
469
469
|
headCellOffset: e.selection.$headCell.pos - t.posBeforeNode
|
|
470
470
|
};
|
|
471
|
-
if (e.selection instanceof
|
|
471
|
+
if (e.selection instanceof $)
|
|
472
472
|
return {
|
|
473
473
|
type: "node",
|
|
474
474
|
anchorBlockId: t.node.attrs.id
|
|
475
475
|
};
|
|
476
476
|
{
|
|
477
|
-
const o =
|
|
477
|
+
const o = D(e.doc, e.selection.head);
|
|
478
478
|
return {
|
|
479
479
|
type: "text",
|
|
480
480
|
anchorBlockId: t.node.attrs.id,
|
|
@@ -485,79 +485,79 @@ function co(n) {
|
|
|
485
485
|
}
|
|
486
486
|
});
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function po(n, e) {
|
|
489
489
|
var s, r;
|
|
490
|
-
const t = (s =
|
|
490
|
+
const t = (s = P(e.anchorBlockId, n.doc)) == null ? void 0 : s.posBeforeNode;
|
|
491
491
|
if (t === void 0)
|
|
492
492
|
throw new Error(
|
|
493
493
|
`Could not find block with ID ${e.anchorBlockId} to update selection`
|
|
494
494
|
);
|
|
495
495
|
let o;
|
|
496
496
|
if (e.type === "cell")
|
|
497
|
-
o =
|
|
497
|
+
o = ne.create(
|
|
498
498
|
n.doc,
|
|
499
499
|
t + e.anchorCellOffset,
|
|
500
500
|
t + e.headCellOffset
|
|
501
501
|
);
|
|
502
502
|
else if (e.type === "node")
|
|
503
|
-
o =
|
|
503
|
+
o = $.create(n.doc, t + 1);
|
|
504
504
|
else {
|
|
505
|
-
const
|
|
506
|
-
if (
|
|
505
|
+
const i = (r = P(e.headBlockId, n.doc)) == null ? void 0 : r.posBeforeNode;
|
|
506
|
+
if (i === void 0)
|
|
507
507
|
throw new Error(
|
|
508
508
|
`Could not find block with ID ${e.headBlockId} to update selection`
|
|
509
509
|
);
|
|
510
|
-
o =
|
|
510
|
+
o = S.create(
|
|
511
511
|
n.doc,
|
|
512
512
|
t + e.anchorOffset,
|
|
513
|
-
|
|
513
|
+
i + e.headOffset
|
|
514
514
|
);
|
|
515
515
|
}
|
|
516
516
|
n.setSelection(o);
|
|
517
517
|
}
|
|
518
|
-
function
|
|
519
|
-
return n.map((e) => e.type === "columnList" ? e.children.map((t) =>
|
|
518
|
+
function X(n) {
|
|
519
|
+
return n.map((e) => e.type === "columnList" ? e.children.map((t) => X(t.children)).flat() : {
|
|
520
520
|
...e,
|
|
521
|
-
children:
|
|
521
|
+
children: X(e.children)
|
|
522
522
|
}).flat();
|
|
523
523
|
}
|
|
524
524
|
function Ee(n, e, t) {
|
|
525
525
|
n.transact((o) => {
|
|
526
|
-
var
|
|
527
|
-
const s = ((
|
|
526
|
+
var i;
|
|
527
|
+
const s = ((i = n.getSelection()) == null ? void 0 : i.blocks) || [
|
|
528
528
|
n.getTextCursorPosition().block
|
|
529
|
-
], r =
|
|
530
|
-
n.removeBlocks(s), n.insertBlocks(
|
|
529
|
+
], r = uo(n);
|
|
530
|
+
n.removeBlocks(s), n.insertBlocks(X(s), e, t), po(o, r);
|
|
531
531
|
});
|
|
532
532
|
}
|
|
533
|
-
function
|
|
533
|
+
function Pe(n) {
|
|
534
534
|
return !n || n.type !== "columnList";
|
|
535
535
|
}
|
|
536
|
-
function
|
|
536
|
+
function Te(n, e, t) {
|
|
537
537
|
let o, s;
|
|
538
538
|
if (e ? e.children.length > 0 ? (o = e.children[e.children.length - 1], s = "after") : (o = e, s = "before") : t && (o = t, s = "before"), !o || !s)
|
|
539
539
|
return;
|
|
540
540
|
const r = n.getParentBlock(o);
|
|
541
|
-
return
|
|
541
|
+
return Pe(r) ? { referenceBlock: o, placement: s } : Te(
|
|
542
542
|
n,
|
|
543
543
|
s === "after" ? o : n.getPrevBlock(o),
|
|
544
544
|
r
|
|
545
545
|
);
|
|
546
546
|
}
|
|
547
|
-
function
|
|
547
|
+
function Me(n, e, t) {
|
|
548
548
|
let o, s;
|
|
549
549
|
if (e ? e.children.length > 0 ? (o = e.children[0], s = "before") : (o = e, s = "after") : t && (o = t, s = "after"), !o || !s)
|
|
550
550
|
return;
|
|
551
551
|
const r = n.getParentBlock(o);
|
|
552
|
-
return
|
|
552
|
+
return Pe(r) ? { referenceBlock: o, placement: s } : Me(
|
|
553
553
|
n,
|
|
554
554
|
s === "before" ? o : n.getNextBlock(o),
|
|
555
555
|
r
|
|
556
556
|
);
|
|
557
557
|
}
|
|
558
|
-
function
|
|
558
|
+
function fo(n) {
|
|
559
559
|
n.transact(() => {
|
|
560
|
-
const e = n.getSelection(), t = (e == null ? void 0 : e.blocks[0]) || n.getTextCursorPosition().block, o =
|
|
560
|
+
const e = n.getSelection(), t = (e == null ? void 0 : e.blocks[0]) || n.getTextCursorPosition().block, o = Te(
|
|
561
561
|
n,
|
|
562
562
|
n.getPrevBlock(t),
|
|
563
563
|
n.getParentBlock(t)
|
|
@@ -569,9 +569,9 @@ function uo(n) {
|
|
|
569
569
|
);
|
|
570
570
|
});
|
|
571
571
|
}
|
|
572
|
-
function
|
|
572
|
+
function ho(n) {
|
|
573
573
|
n.transact(() => {
|
|
574
|
-
const e = n.getSelection(), t = (e == null ? void 0 : e.blocks[(e == null ? void 0 : e.blocks.length) - 1]) || n.getTextCursorPosition().block, o =
|
|
574
|
+
const e = n.getSelection(), t = (e == null ? void 0 : e.blocks[(e == null ? void 0 : e.blocks.length) - 1]) || n.getTextCursorPosition().block, o = Me(
|
|
575
575
|
n,
|
|
576
576
|
n.getNextBlock(t),
|
|
577
577
|
n.getParentBlock(t)
|
|
@@ -583,7 +583,7 @@ function po(n) {
|
|
|
583
583
|
);
|
|
584
584
|
});
|
|
585
585
|
}
|
|
586
|
-
function
|
|
586
|
+
function mo(n, e, t) {
|
|
587
587
|
const { $from: o, $to: s } = n.selection, r = o.blockRange(
|
|
588
588
|
s,
|
|
589
589
|
(f) => f.childCount > 0 && (f.type.name === "blockGroup" || f.type.name === "column")
|
|
@@ -591,86 +591,86 @@ function fo(n, e, t) {
|
|
|
591
591
|
);
|
|
592
592
|
if (!r)
|
|
593
593
|
return !1;
|
|
594
|
-
const
|
|
595
|
-
if (
|
|
594
|
+
const i = r.startIndex;
|
|
595
|
+
if (i === 0)
|
|
596
596
|
return !1;
|
|
597
|
-
const
|
|
598
|
-
if (
|
|
597
|
+
const a = r.parent.child(i - 1);
|
|
598
|
+
if (a.type !== e)
|
|
599
599
|
return !1;
|
|
600
|
-
const
|
|
601
|
-
|
|
602
|
-
e.create(null,
|
|
600
|
+
const c = a.lastChild && a.lastChild.type === t, d = w.from(c ? e.create() : null), u = new F(
|
|
601
|
+
w.from(
|
|
602
|
+
e.create(null, w.from(t.create(null, d)))
|
|
603
603
|
// change necessary to create "groupType" instead of parent.type
|
|
604
604
|
),
|
|
605
|
-
|
|
605
|
+
c ? 3 : 1,
|
|
606
606
|
0
|
|
607
|
-
), p = r.start,
|
|
607
|
+
), p = r.start, h = r.end;
|
|
608
608
|
return n.step(
|
|
609
|
-
new
|
|
610
|
-
p - (
|
|
611
|
-
|
|
609
|
+
new W(
|
|
610
|
+
p - (c ? 3 : 1),
|
|
611
|
+
h,
|
|
612
612
|
p,
|
|
613
|
-
|
|
613
|
+
h,
|
|
614
614
|
u,
|
|
615
615
|
1,
|
|
616
616
|
!0
|
|
617
617
|
)
|
|
618
618
|
).scrollIntoView(), !0;
|
|
619
619
|
}
|
|
620
|
-
function
|
|
621
|
-
return n.transact((e) =>
|
|
620
|
+
function we(n) {
|
|
621
|
+
return n.transact((e) => mo(
|
|
622
622
|
e,
|
|
623
623
|
n.pmSchema.nodes.blockContainer,
|
|
624
624
|
n.pmSchema.nodes.blockGroup
|
|
625
625
|
));
|
|
626
626
|
}
|
|
627
|
-
function
|
|
627
|
+
function ko(n) {
|
|
628
628
|
n._tiptapEditor.commands.liftListItem("blockContainer");
|
|
629
629
|
}
|
|
630
|
-
function
|
|
630
|
+
function bo(n) {
|
|
631
631
|
return n.transact((e) => {
|
|
632
|
-
const { bnBlock: t } =
|
|
632
|
+
const { bnBlock: t } = z(e);
|
|
633
633
|
return e.doc.resolve(t.beforePos).nodeBefore !== null;
|
|
634
634
|
});
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function go(n) {
|
|
637
637
|
return n.transact((e) => {
|
|
638
|
-
const { bnBlock: t } =
|
|
638
|
+
const { bnBlock: t } = z(e);
|
|
639
639
|
return e.doc.resolve(t.beforePos).depth > 1;
|
|
640
640
|
});
|
|
641
641
|
}
|
|
642
|
-
function
|
|
643
|
-
const t = typeof e == "string" ? e : e.id, o =
|
|
642
|
+
function Bo(n, e) {
|
|
643
|
+
const t = typeof e == "string" ? e : e.id, o = E(n), s = P(t, n);
|
|
644
644
|
if (s)
|
|
645
|
-
return
|
|
645
|
+
return C(s.node, o);
|
|
646
646
|
}
|
|
647
|
-
function
|
|
648
|
-
const t = typeof e == "string" ? e : e.id, o =
|
|
647
|
+
function yo(n, e) {
|
|
648
|
+
const t = typeof e == "string" ? e : e.id, o = P(t, n), s = E(n);
|
|
649
649
|
if (!o)
|
|
650
650
|
return;
|
|
651
|
-
const
|
|
652
|
-
if (
|
|
653
|
-
return
|
|
651
|
+
const i = n.resolve(o.posBeforeNode).nodeBefore;
|
|
652
|
+
if (i)
|
|
653
|
+
return C(i, s);
|
|
654
654
|
}
|
|
655
|
-
function
|
|
656
|
-
const t = typeof e == "string" ? e : e.id, o =
|
|
655
|
+
function Co(n, e) {
|
|
656
|
+
const t = typeof e == "string" ? e : e.id, o = P(t, n), s = E(n);
|
|
657
657
|
if (!o)
|
|
658
658
|
return;
|
|
659
|
-
const
|
|
659
|
+
const i = n.resolve(
|
|
660
660
|
o.posBeforeNode + o.node.nodeSize
|
|
661
661
|
).nodeAfter;
|
|
662
|
-
if (
|
|
663
|
-
return
|
|
662
|
+
if (i)
|
|
663
|
+
return C(i, s);
|
|
664
664
|
}
|
|
665
665
|
function So(n, e) {
|
|
666
|
-
const t = typeof e == "string" ? e : e.id, o =
|
|
666
|
+
const t = typeof e == "string" ? e : e.id, o = E(n), s = P(t, n);
|
|
667
667
|
if (!s)
|
|
668
668
|
return;
|
|
669
|
-
const r = n.resolve(s.posBeforeNode),
|
|
670
|
-
if (
|
|
671
|
-
return
|
|
669
|
+
const r = n.resolve(s.posBeforeNode), i = r.node(), l = r.node(-1), a = l.type.name !== "doc" ? i.type.name === "blockGroup" ? l : i : void 0;
|
|
670
|
+
if (a)
|
|
671
|
+
return C(a, o);
|
|
672
672
|
}
|
|
673
|
-
class
|
|
673
|
+
class xo {
|
|
674
674
|
constructor(e) {
|
|
675
675
|
this.editor = e;
|
|
676
676
|
}
|
|
@@ -679,7 +679,7 @@ class Bo {
|
|
|
679
679
|
* @returns A snapshot of all top-level (non-nested) blocks in the editor.
|
|
680
680
|
*/
|
|
681
681
|
get document() {
|
|
682
|
-
return this.editor.transact((e) =>
|
|
682
|
+
return this.editor.transact((e) => je(e.doc, this.editor.pmSchema));
|
|
683
683
|
}
|
|
684
684
|
/**
|
|
685
685
|
* Gets a snapshot of an existing block from the editor.
|
|
@@ -689,7 +689,7 @@ class Bo {
|
|
|
689
689
|
* matching block was found.
|
|
690
690
|
*/
|
|
691
691
|
getBlock(e) {
|
|
692
|
-
return this.editor.transact((t) =>
|
|
692
|
+
return this.editor.transact((t) => Bo(t.doc, e));
|
|
693
693
|
}
|
|
694
694
|
/**
|
|
695
695
|
* Gets a snapshot of the previous sibling of an existing block from the
|
|
@@ -701,7 +701,7 @@ class Bo {
|
|
|
701
701
|
* in the document.
|
|
702
702
|
*/
|
|
703
703
|
getPrevBlock(e) {
|
|
704
|
-
return this.editor.transact((t) =>
|
|
704
|
+
return this.editor.transact((t) => yo(t.doc, e));
|
|
705
705
|
}
|
|
706
706
|
/**
|
|
707
707
|
* Gets a snapshot of the next sibling of an existing block from the editor.
|
|
@@ -712,7 +712,7 @@ class Bo {
|
|
|
712
712
|
* the document.
|
|
713
713
|
*/
|
|
714
714
|
getNextBlock(e) {
|
|
715
|
-
return this.editor.transact((t) =>
|
|
715
|
+
return this.editor.transact((t) => Co(t.doc, e));
|
|
716
716
|
}
|
|
717
717
|
/**
|
|
718
718
|
* Gets a snapshot of the parent of an existing block from the editor.
|
|
@@ -735,11 +735,11 @@ class Bo {
|
|
|
735
735
|
const o = this.document.slice();
|
|
736
736
|
t && o.reverse();
|
|
737
737
|
function s(r) {
|
|
738
|
-
for (const
|
|
739
|
-
if (e(
|
|
738
|
+
for (const i of r) {
|
|
739
|
+
if (e(i) === !1)
|
|
740
740
|
return !1;
|
|
741
|
-
const
|
|
742
|
-
if (!s(
|
|
741
|
+
const l = t ? i.children.slice().reverse() : i.children;
|
|
742
|
+
if (!s(l))
|
|
743
743
|
return !1;
|
|
744
744
|
}
|
|
745
745
|
return !0;
|
|
@@ -756,7 +756,7 @@ class Bo {
|
|
|
756
756
|
*/
|
|
757
757
|
insertBlocks(e, t, o = "before") {
|
|
758
758
|
return this.editor.transact(
|
|
759
|
-
(s) =>
|
|
759
|
+
(s) => Zt(s, e, t, o)
|
|
760
760
|
);
|
|
761
761
|
}
|
|
762
762
|
/**
|
|
@@ -767,7 +767,7 @@ class Bo {
|
|
|
767
767
|
* @param update A partial block which defines how the existing block should be changed.
|
|
768
768
|
*/
|
|
769
769
|
updateBlock(e, t) {
|
|
770
|
-
return this.editor.transact((o) =>
|
|
770
|
+
return this.editor.transact((o) => Ze(o, e, t));
|
|
771
771
|
}
|
|
772
772
|
/**
|
|
773
773
|
* Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
|
|
@@ -794,25 +794,25 @@ class Bo {
|
|
|
794
794
|
* Checks if the block containing the text cursor can be nested.
|
|
795
795
|
*/
|
|
796
796
|
canNestBlock() {
|
|
797
|
-
return
|
|
797
|
+
return bo(this.editor);
|
|
798
798
|
}
|
|
799
799
|
/**
|
|
800
800
|
* Nests the block containing the text cursor into the block above it.
|
|
801
801
|
*/
|
|
802
802
|
nestBlock() {
|
|
803
|
-
|
|
803
|
+
we(this.editor);
|
|
804
804
|
}
|
|
805
805
|
/**
|
|
806
806
|
* Checks if the block containing the text cursor is nested.
|
|
807
807
|
*/
|
|
808
808
|
canUnnestBlock() {
|
|
809
|
-
return
|
|
809
|
+
return go(this.editor);
|
|
810
810
|
}
|
|
811
811
|
/**
|
|
812
812
|
* Lifts the block containing the text cursor out of its parent.
|
|
813
813
|
*/
|
|
814
814
|
unnestBlock() {
|
|
815
|
-
|
|
815
|
+
ko(this.editor);
|
|
816
816
|
}
|
|
817
817
|
/**
|
|
818
818
|
* Moves the selected blocks up. If the previous block has children, moves
|
|
@@ -820,7 +820,7 @@ class Bo {
|
|
|
820
820
|
* current blocks share a common parent, moves them out of & before it.
|
|
821
821
|
*/
|
|
822
822
|
moveBlocksUp() {
|
|
823
|
-
return
|
|
823
|
+
return fo(this.editor);
|
|
824
824
|
}
|
|
825
825
|
/**
|
|
826
826
|
* Moves the selected blocks down. If the next block has children, moves
|
|
@@ -828,10 +828,10 @@ class Bo {
|
|
|
828
828
|
* current blocks share a common parent, moves them out of & after it.
|
|
829
829
|
*/
|
|
830
830
|
moveBlocksDown() {
|
|
831
|
-
return
|
|
831
|
+
return ho(this.editor);
|
|
832
832
|
}
|
|
833
833
|
}
|
|
834
|
-
class
|
|
834
|
+
class Eo extends Ce {
|
|
835
835
|
constructor(e) {
|
|
836
836
|
super(), this.editor = e, e.on("create", () => {
|
|
837
837
|
e._tiptapEditor.on(
|
|
@@ -856,9 +856,9 @@ class Co extends Se {
|
|
|
856
856
|
transaction: s,
|
|
857
857
|
appendedTransactions: r
|
|
858
858
|
}) => {
|
|
859
|
-
!t &&
|
|
859
|
+
!t && ce(s) || e(this.editor, {
|
|
860
860
|
getChanges() {
|
|
861
|
-
return
|
|
861
|
+
return it(
|
|
862
862
|
s,
|
|
863
863
|
r
|
|
864
864
|
);
|
|
@@ -874,7 +874,7 @@ class Co extends Se {
|
|
|
874
874
|
*/
|
|
875
875
|
onSelectionChange(e, t = !1) {
|
|
876
876
|
const o = (s) => {
|
|
877
|
-
!t &&
|
|
877
|
+
!t && ce(s.transaction) || e(this.editor);
|
|
878
878
|
};
|
|
879
879
|
return this.on("onSelectionChange", o), () => {
|
|
880
880
|
this.off("onSelectionChange", o);
|
|
@@ -897,60 +897,60 @@ class Co extends Se {
|
|
|
897
897
|
};
|
|
898
898
|
}
|
|
899
899
|
}
|
|
900
|
-
function
|
|
900
|
+
function ce(n) {
|
|
901
901
|
return !!n.getMeta("y-sync$");
|
|
902
902
|
}
|
|
903
|
-
function
|
|
903
|
+
function Po(n) {
|
|
904
904
|
return Array.prototype.indexOf.call(n.parentElement.childNodes, n);
|
|
905
905
|
}
|
|
906
|
-
function
|
|
906
|
+
function To(n) {
|
|
907
907
|
return n.nodeType === 3 && !/\S/.test(n.nodeValue || "");
|
|
908
908
|
}
|
|
909
909
|
function Mo(n) {
|
|
910
910
|
n.querySelectorAll("li > ul, li > ol").forEach((e) => {
|
|
911
|
-
const t =
|
|
911
|
+
const t = Po(e), o = e.parentElement, s = Array.from(o.childNodes).slice(
|
|
912
912
|
t + 1
|
|
913
913
|
);
|
|
914
914
|
e.remove(), s.forEach((r) => {
|
|
915
915
|
r.remove();
|
|
916
916
|
}), o.insertAdjacentElement("afterend", e), s.reverse().forEach((r) => {
|
|
917
|
-
if (
|
|
917
|
+
if (To(r))
|
|
918
918
|
return;
|
|
919
|
-
const
|
|
920
|
-
|
|
919
|
+
const i = document.createElement("li");
|
|
920
|
+
i.append(r), e.insertAdjacentElement("afterend", i);
|
|
921
921
|
}), o.childNodes.length === 0 && o.remove();
|
|
922
922
|
});
|
|
923
923
|
}
|
|
924
924
|
function wo(n) {
|
|
925
925
|
n.querySelectorAll("li + ul, li + ol").forEach((e) => {
|
|
926
|
-
var r,
|
|
926
|
+
var r, i;
|
|
927
927
|
const t = e.previousElementSibling, o = document.createElement("div");
|
|
928
928
|
t.insertAdjacentElement("afterend", o), o.append(t);
|
|
929
929
|
const s = document.createElement("div");
|
|
930
|
-
for (s.setAttribute("data-node-type", "blockGroup"), o.append(s); ((r = o.nextElementSibling) == null ? void 0 : r.nodeName) === "UL" || ((
|
|
930
|
+
for (s.setAttribute("data-node-type", "blockGroup"), o.append(s); ((r = o.nextElementSibling) == null ? void 0 : r.nodeName) === "UL" || ((i = o.nextElementSibling) == null ? void 0 : i.nodeName) === "OL"; )
|
|
931
931
|
s.append(o.nextElementSibling);
|
|
932
932
|
});
|
|
933
933
|
}
|
|
934
|
-
let
|
|
935
|
-
function
|
|
936
|
-
return
|
|
934
|
+
let le = null;
|
|
935
|
+
function vo() {
|
|
936
|
+
return le || (le = document.implementation.createHTMLDocument("title"));
|
|
937
937
|
}
|
|
938
|
-
function
|
|
938
|
+
function Io(n) {
|
|
939
939
|
if (typeof n == "string") {
|
|
940
|
-
const e =
|
|
940
|
+
const e = vo().createElement("div");
|
|
941
941
|
e.innerHTML = n, n = e;
|
|
942
942
|
}
|
|
943
943
|
return Mo(n), wo(n), n;
|
|
944
944
|
}
|
|
945
|
-
function
|
|
946
|
-
const t =
|
|
945
|
+
function ve(n, e) {
|
|
946
|
+
const t = Io(n), s = Ue.fromSchema(e).parse(t, {
|
|
947
947
|
topNode: e.nodes.blockGroup.create()
|
|
948
948
|
}), r = [];
|
|
949
|
-
for (let
|
|
950
|
-
r.push(
|
|
949
|
+
for (let i = 0; i < s.childCount; i++)
|
|
950
|
+
r.push(C(s.child(i), e));
|
|
951
951
|
return r;
|
|
952
952
|
}
|
|
953
|
-
function
|
|
953
|
+
function Ao(n, e) {
|
|
954
954
|
const t = e.value ? e.value : "", o = {};
|
|
955
955
|
e.lang && (o["data-language"] = e.lang);
|
|
956
956
|
let s = {
|
|
@@ -966,7 +966,7 @@ function vo(n, e) {
|
|
|
966
966
|
children: [s]
|
|
967
967
|
}, n.patch(e, s), s;
|
|
968
968
|
}
|
|
969
|
-
function
|
|
969
|
+
function No(n, e) {
|
|
970
970
|
var r;
|
|
971
971
|
const t = String((e == null ? void 0 : e.url) || ""), o = e != null && e.title ? String(e.title) : void 0;
|
|
972
972
|
let s = {
|
|
@@ -982,15 +982,15 @@ function Io(n, e) {
|
|
|
982
982
|
};
|
|
983
983
|
return (r = n.patch) == null || r.call(n, e, s), s = n.applyData ? n.applyData(e, s) : s, s;
|
|
984
984
|
}
|
|
985
|
-
function
|
|
986
|
-
return
|
|
985
|
+
function Ie(n) {
|
|
986
|
+
return Yt().use(qt).use(Wt).use(Kt, {
|
|
987
987
|
handlers: {
|
|
988
|
-
...
|
|
988
|
+
...ie,
|
|
989
989
|
image: (t, o) => {
|
|
990
990
|
const s = String((o == null ? void 0 : o.url) || "");
|
|
991
|
-
return
|
|
991
|
+
return et(s) ? No(t, o) : ie.image(t, o);
|
|
992
992
|
},
|
|
993
|
-
code:
|
|
993
|
+
code: Ao,
|
|
994
994
|
blockquote: (t, o) => {
|
|
995
995
|
const s = {
|
|
996
996
|
type: "element",
|
|
@@ -1002,13 +1002,13 @@ function ve(n) {
|
|
|
1002
1002
|
return t.patch(o, s), t.applyData(o, s);
|
|
1003
1003
|
}
|
|
1004
1004
|
}
|
|
1005
|
-
}).use(
|
|
1005
|
+
}).use(Jt).processSync(n).value;
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1008
|
-
const t =
|
|
1009
|
-
return
|
|
1007
|
+
function _o(n, e) {
|
|
1008
|
+
const t = Ie(n);
|
|
1009
|
+
return ve(t, e);
|
|
1010
1010
|
}
|
|
1011
|
-
class
|
|
1011
|
+
class Lo {
|
|
1012
1012
|
constructor(e) {
|
|
1013
1013
|
this.editor = e;
|
|
1014
1014
|
}
|
|
@@ -1020,7 +1020,7 @@ class _o {
|
|
|
1020
1020
|
* @returns The blocks, serialized as an HTML string.
|
|
1021
1021
|
*/
|
|
1022
1022
|
blocksToHTMLLossy(e = this.editor.document) {
|
|
1023
|
-
return
|
|
1023
|
+
return Be(
|
|
1024
1024
|
this.editor.pmSchema,
|
|
1025
1025
|
this.editor
|
|
1026
1026
|
).exportBlocks(e, {});
|
|
@@ -1035,7 +1035,7 @@ class _o {
|
|
|
1035
1035
|
* @returns The blocks, serialized as an HTML string.
|
|
1036
1036
|
*/
|
|
1037
1037
|
blocksToFullHTML(e = this.editor.document) {
|
|
1038
|
-
return
|
|
1038
|
+
return lo(
|
|
1039
1039
|
this.editor.pmSchema,
|
|
1040
1040
|
this.editor
|
|
1041
1041
|
).serializeBlocks(e, {});
|
|
@@ -1048,7 +1048,7 @@ class _o {
|
|
|
1048
1048
|
* @returns The blocks parsed from the HTML string.
|
|
1049
1049
|
*/
|
|
1050
1050
|
tryParseHTMLToBlocks(e) {
|
|
1051
|
-
return
|
|
1051
|
+
return ve(e, this.editor.pmSchema);
|
|
1052
1052
|
}
|
|
1053
1053
|
/**
|
|
1054
1054
|
* Serializes blocks into a Markdown string. The output is simplified as Markdown does not support all features of
|
|
@@ -1057,7 +1057,7 @@ class _o {
|
|
|
1057
1057
|
* @returns The blocks, serialized as a Markdown string.
|
|
1058
1058
|
*/
|
|
1059
1059
|
blocksToMarkdownLossy(e = this.editor.document) {
|
|
1060
|
-
return
|
|
1060
|
+
return at(e, this.editor.pmSchema, this.editor, {});
|
|
1061
1061
|
}
|
|
1062
1062
|
/**
|
|
1063
1063
|
* Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on
|
|
@@ -1067,7 +1067,7 @@ class _o {
|
|
|
1067
1067
|
* @returns The blocks parsed from the Markdown string.
|
|
1068
1068
|
*/
|
|
1069
1069
|
tryParseMarkdownToBlocks(e) {
|
|
1070
|
-
return
|
|
1070
|
+
return _o(e, this.editor.pmSchema);
|
|
1071
1071
|
}
|
|
1072
1072
|
/**
|
|
1073
1073
|
* Paste HTML into the editor. Defaults to converting HTML to BlockNote HTML.
|
|
@@ -1096,11 +1096,11 @@ class _o {
|
|
|
1096
1096
|
* @param markdown The markdown to paste.
|
|
1097
1097
|
*/
|
|
1098
1098
|
pasteMarkdown(e) {
|
|
1099
|
-
const t =
|
|
1099
|
+
const t = Ie(e);
|
|
1100
1100
|
return this.pasteHTML(t);
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
|
-
const
|
|
1103
|
+
const se = [
|
|
1104
1104
|
"vscode-editor-data",
|
|
1105
1105
|
"blocknote/html",
|
|
1106
1106
|
"text/markdown",
|
|
@@ -1113,7 +1113,7 @@ function Do(n, e) {
|
|
|
1113
1113
|
throw new Error("The strings provided are not valid file extensions.");
|
|
1114
1114
|
return n === e;
|
|
1115
1115
|
}
|
|
1116
|
-
function
|
|
1116
|
+
function Oo(n, e) {
|
|
1117
1117
|
const t = n.split("/"), o = e.split("/");
|
|
1118
1118
|
if (t.length !== 2)
|
|
1119
1119
|
throw new Error(`The string ${n} is not a valid MIME type.`);
|
|
@@ -1121,7 +1121,7 @@ function Lo(n, e) {
|
|
|
1121
1121
|
throw new Error(`The string ${e} is not a valid MIME type.`);
|
|
1122
1122
|
return t[1] === "*" || o[1] === "*" ? t[0] === o[0] : (t[0] === "*" || o[0] === "*" || t[0] === o[0]) && t[1] === o[1];
|
|
1123
1123
|
}
|
|
1124
|
-
function
|
|
1124
|
+
function de(n, e, t, o = "after") {
|
|
1125
1125
|
let s;
|
|
1126
1126
|
return Array.isArray(e.content) && e.content.length === 0 ? s = n.updateBlock(e, t).id : s = n.insertBlocks(
|
|
1127
1127
|
[t],
|
|
@@ -1129,7 +1129,7 @@ function le(n, e, t, o = "after") {
|
|
|
1129
1129
|
o
|
|
1130
1130
|
)[0].id, s;
|
|
1131
1131
|
}
|
|
1132
|
-
async function
|
|
1132
|
+
async function Ae(n, e) {
|
|
1133
1133
|
var r;
|
|
1134
1134
|
if (!e.uploadFile) {
|
|
1135
1135
|
console.warn(
|
|
@@ -1141,9 +1141,9 @@ async function Ie(n, e) {
|
|
|
1141
1141
|
if (t === null)
|
|
1142
1142
|
return;
|
|
1143
1143
|
let o = null;
|
|
1144
|
-
for (const
|
|
1145
|
-
if (t.types.includes(
|
|
1146
|
-
o =
|
|
1144
|
+
for (const i of se)
|
|
1145
|
+
if (t.types.includes(i)) {
|
|
1146
|
+
o = i;
|
|
1147
1147
|
break;
|
|
1148
1148
|
}
|
|
1149
1149
|
if (o !== "Files")
|
|
@@ -1151,53 +1151,53 @@ async function Ie(n, e) {
|
|
|
1151
1151
|
const s = t.items;
|
|
1152
1152
|
if (s) {
|
|
1153
1153
|
n.preventDefault();
|
|
1154
|
-
for (let
|
|
1155
|
-
let
|
|
1156
|
-
for (const
|
|
1157
|
-
for (const d of ((r =
|
|
1158
|
-
const u = d.startsWith("."), p = s[
|
|
1159
|
-
if (p && (!u && p.type &&
|
|
1154
|
+
for (let i = 0; i < s.length; i++) {
|
|
1155
|
+
let l = "file";
|
|
1156
|
+
for (const c of Object.values(e.schema.blockSpecs))
|
|
1157
|
+
for (const d of ((r = c.implementation.meta) == null ? void 0 : r.fileBlockAccept) || []) {
|
|
1158
|
+
const u = d.startsWith("."), p = s[i].getAsFile();
|
|
1159
|
+
if (p && (!u && p.type && Oo(s[i].type, d) || u && Do(
|
|
1160
1160
|
"." + p.name.split(".").pop(),
|
|
1161
1161
|
d
|
|
1162
1162
|
))) {
|
|
1163
|
-
|
|
1163
|
+
l = c.config.type;
|
|
1164
1164
|
break;
|
|
1165
1165
|
}
|
|
1166
1166
|
}
|
|
1167
|
-
const
|
|
1168
|
-
if (
|
|
1169
|
-
const
|
|
1170
|
-
type:
|
|
1167
|
+
const a = s[i].getAsFile();
|
|
1168
|
+
if (a) {
|
|
1169
|
+
const c = {
|
|
1170
|
+
type: l,
|
|
1171
1171
|
props: {
|
|
1172
|
-
name:
|
|
1172
|
+
name: a.name
|
|
1173
1173
|
}
|
|
1174
1174
|
};
|
|
1175
1175
|
let d;
|
|
1176
1176
|
if (n.type === "paste") {
|
|
1177
|
-
const
|
|
1178
|
-
d =
|
|
1177
|
+
const h = e.getTextCursorPosition().block;
|
|
1178
|
+
d = de(e, h, c);
|
|
1179
1179
|
} else if (n.type === "drop") {
|
|
1180
|
-
const
|
|
1180
|
+
const h = {
|
|
1181
1181
|
left: n.clientX,
|
|
1182
1182
|
top: n.clientY
|
|
1183
|
-
}, f = e.prosemirrorView.posAtCoords(
|
|
1183
|
+
}, f = e.prosemirrorView.posAtCoords(h);
|
|
1184
1184
|
if (!f)
|
|
1185
1185
|
return;
|
|
1186
|
-
d = e.transact((
|
|
1186
|
+
d = e.transact((m) => {
|
|
1187
1187
|
var y;
|
|
1188
|
-
const b =
|
|
1188
|
+
const b = D(m.doc, f.pos), g = (y = e.domElement) == null ? void 0 : y.querySelector(
|
|
1189
1189
|
`[data-id="${b.node.attrs.id}"]`
|
|
1190
|
-
),
|
|
1191
|
-
return
|
|
1190
|
+
), x = g == null ? void 0 : g.getBoundingClientRect();
|
|
1191
|
+
return de(
|
|
1192
1192
|
e,
|
|
1193
1193
|
e.getBlock(b.node.attrs.id),
|
|
1194
|
-
|
|
1195
|
-
|
|
1194
|
+
c,
|
|
1195
|
+
x && (x.top + x.bottom) / 2 > h.top ? "before" : "after"
|
|
1196
1196
|
);
|
|
1197
1197
|
});
|
|
1198
1198
|
} else
|
|
1199
1199
|
return;
|
|
1200
|
-
const u = await e.uploadFile(
|
|
1200
|
+
const u = await e.uploadFile(a, d), p = typeof u == "string" ? {
|
|
1201
1201
|
props: {
|
|
1202
1202
|
url: u
|
|
1203
1203
|
}
|
|
@@ -1207,31 +1207,31 @@ async function Ie(n, e) {
|
|
|
1207
1207
|
}
|
|
1208
1208
|
}
|
|
1209
1209
|
}
|
|
1210
|
-
const
|
|
1210
|
+
const $o = (n) => T.create({
|
|
1211
1211
|
name: "dropFile",
|
|
1212
1212
|
addProseMirrorPlugins() {
|
|
1213
1213
|
return [
|
|
1214
|
-
new
|
|
1214
|
+
new oe({
|
|
1215
1215
|
props: {
|
|
1216
1216
|
handleDOMEvents: {
|
|
1217
1217
|
drop(e, t) {
|
|
1218
1218
|
if (!n.isEditable)
|
|
1219
1219
|
return;
|
|
1220
1220
|
let o = null;
|
|
1221
|
-
for (const s of
|
|
1221
|
+
for (const s of se)
|
|
1222
1222
|
if (t.dataTransfer.types.includes(s)) {
|
|
1223
1223
|
o = s;
|
|
1224
1224
|
break;
|
|
1225
1225
|
}
|
|
1226
|
-
return o === null ? !0 : o === "Files" ? (
|
|
1226
|
+
return o === null ? !0 : o === "Files" ? (Ae(t, n), !0) : !1;
|
|
1227
1227
|
}
|
|
1228
1228
|
}
|
|
1229
1229
|
}
|
|
1230
1230
|
})
|
|
1231
1231
|
];
|
|
1232
1232
|
}
|
|
1233
|
-
}),
|
|
1234
|
-
async function
|
|
1233
|
+
}), Ho = /(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/, Fo = /(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/, Vo = /\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/, Uo = /(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/, zo = /(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/, Ro = /(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/, Go = /\n{2} {0,3}-{2,48}\n{2}/, jo = /(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/, Wo = /(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/, qo = /(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/, Ko = /^\s*\|(.+\|)+\s*$/m, Jo = /^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m, Yo = /^\s*\|(.+\|)+\s*$/m, Qo = (n) => Ho.test(n) || Fo.test(n) || Vo.test(n) || Uo.test(n) || zo.test(n) || Ro.test(n) || Go.test(n) || jo.test(n) || Wo.test(n) || qo.test(n) || Ko.test(n) || Jo.test(n) || Yo.test(n);
|
|
1234
|
+
async function Xo(n, e) {
|
|
1235
1235
|
const { schema: t } = e.state;
|
|
1236
1236
|
if (!n.clipboardData)
|
|
1237
1237
|
return !1;
|
|
@@ -1240,58 +1240,58 @@ async function Yo(n, e) {
|
|
|
1240
1240
|
return !1;
|
|
1241
1241
|
if (!t.nodes.codeBlock)
|
|
1242
1242
|
return e.pasteText(o), !0;
|
|
1243
|
-
const s = n.clipboardData.getData("vscode-editor-data"), r = s ? JSON.parse(s) : void 0,
|
|
1244
|
-
return
|
|
1245
|
-
`<pre><code class="language-${
|
|
1243
|
+
const s = n.clipboardData.getData("vscode-editor-data"), r = s ? JSON.parse(s) : void 0, i = r == null ? void 0 : r.mode;
|
|
1244
|
+
return i ? (e.pasteHTML(
|
|
1245
|
+
`<pre><code class="language-${i}">${o.replace(
|
|
1246
1246
|
/\r\n?/g,
|
|
1247
1247
|
`
|
|
1248
1248
|
`
|
|
1249
1249
|
)}</code></pre>`
|
|
1250
1250
|
), !0) : !1;
|
|
1251
1251
|
}
|
|
1252
|
-
function
|
|
1252
|
+
function Zo({
|
|
1253
1253
|
event: n,
|
|
1254
1254
|
editor: e,
|
|
1255
1255
|
prioritizeMarkdownOverHTML: t,
|
|
1256
1256
|
plainTextAsMarkdown: o
|
|
1257
1257
|
}) {
|
|
1258
|
-
var
|
|
1258
|
+
var l;
|
|
1259
1259
|
if (e.transact(
|
|
1260
|
-
(
|
|
1260
|
+
(a) => a.selection.$from.parent.type.spec.code && a.selection.$to.parent.type.spec.code
|
|
1261
1261
|
)) {
|
|
1262
|
-
const
|
|
1263
|
-
if (
|
|
1264
|
-
return e.pasteText(
|
|
1262
|
+
const a = (l = n.clipboardData) == null ? void 0 : l.getData("text/plain");
|
|
1263
|
+
if (a)
|
|
1264
|
+
return e.pasteText(a), !0;
|
|
1265
1265
|
}
|
|
1266
1266
|
let r;
|
|
1267
|
-
for (const
|
|
1268
|
-
if (n.clipboardData.types.includes(
|
|
1269
|
-
r =
|
|
1267
|
+
for (const a of se)
|
|
1268
|
+
if (n.clipboardData.types.includes(a)) {
|
|
1269
|
+
r = a;
|
|
1270
1270
|
break;
|
|
1271
1271
|
}
|
|
1272
1272
|
if (!r)
|
|
1273
1273
|
return !0;
|
|
1274
1274
|
if (r === "vscode-editor-data")
|
|
1275
|
-
return
|
|
1275
|
+
return Xo(n, e.prosemirrorView), !0;
|
|
1276
1276
|
if (r === "Files")
|
|
1277
|
-
return
|
|
1278
|
-
const
|
|
1277
|
+
return Ae(n, e), !0;
|
|
1278
|
+
const i = n.clipboardData.getData(r);
|
|
1279
1279
|
if (r === "blocknote/html")
|
|
1280
|
-
return e.pasteHTML(
|
|
1280
|
+
return e.pasteHTML(i, !0), !0;
|
|
1281
1281
|
if (r === "text/markdown")
|
|
1282
|
-
return e.pasteMarkdown(
|
|
1282
|
+
return e.pasteMarkdown(i), !0;
|
|
1283
1283
|
if (t) {
|
|
1284
|
-
const
|
|
1285
|
-
if (
|
|
1286
|
-
return e.pasteMarkdown(
|
|
1284
|
+
const a = n.clipboardData.getData("text/plain");
|
|
1285
|
+
if (Qo(a))
|
|
1286
|
+
return e.pasteMarkdown(a), !0;
|
|
1287
1287
|
}
|
|
1288
|
-
return r === "text/html" ? (e.pasteHTML(
|
|
1288
|
+
return r === "text/html" ? (e.pasteHTML(i), !0) : o ? (e.pasteMarkdown(i), !0) : (e.pasteText(i), !0);
|
|
1289
1289
|
}
|
|
1290
|
-
const
|
|
1290
|
+
const en = (n, e) => T.create({
|
|
1291
1291
|
name: "pasteFromClipboard",
|
|
1292
1292
|
addProseMirrorPlugins() {
|
|
1293
1293
|
return [
|
|
1294
|
-
new
|
|
1294
|
+
new oe({
|
|
1295
1295
|
props: {
|
|
1296
1296
|
handleDOMEvents: {
|
|
1297
1297
|
paste(t, o) {
|
|
@@ -1302,7 +1302,7 @@ const Xo = (n, e) => x.create({
|
|
|
1302
1302
|
defaultPasteHandler: ({
|
|
1303
1303
|
prioritizeMarkdownOverHTML: s = !0,
|
|
1304
1304
|
plainTextAsMarkdown: r = !0
|
|
1305
|
-
} = {}) =>
|
|
1305
|
+
} = {}) => Zo({
|
|
1306
1306
|
event: o,
|
|
1307
1307
|
editor: n,
|
|
1308
1308
|
prioritizeMarkdownOverHTML: s,
|
|
@@ -1316,67 +1316,67 @@ const Xo = (n, e) => x.create({
|
|
|
1316
1316
|
];
|
|
1317
1317
|
}
|
|
1318
1318
|
});
|
|
1319
|
-
function
|
|
1320
|
-
var
|
|
1319
|
+
function tn(n, e, t) {
|
|
1320
|
+
var l;
|
|
1321
1321
|
let o = !1;
|
|
1322
|
-
const s = n.state.selection instanceof
|
|
1322
|
+
const s = n.state.selection instanceof ne;
|
|
1323
1323
|
if (!s) {
|
|
1324
|
-
const
|
|
1324
|
+
const a = n.state.doc.slice(
|
|
1325
1325
|
n.state.selection.from,
|
|
1326
1326
|
n.state.selection.to,
|
|
1327
1327
|
!1
|
|
1328
|
-
).content,
|
|
1329
|
-
for (let d = 0; d <
|
|
1330
|
-
|
|
1331
|
-
o =
|
|
1328
|
+
).content, c = [];
|
|
1329
|
+
for (let d = 0; d < a.childCount; d++)
|
|
1330
|
+
c.push(a.child(d));
|
|
1331
|
+
o = c.find(
|
|
1332
1332
|
(d) => d.type.isInGroup("bnBlock") || d.type.name === "blockGroup" || d.type.spec.group === "blockContent"
|
|
1333
|
-
) === void 0, o && (e =
|
|
1333
|
+
) === void 0, o && (e = a);
|
|
1334
1334
|
}
|
|
1335
1335
|
let r;
|
|
1336
|
-
const
|
|
1336
|
+
const i = Be(
|
|
1337
1337
|
n.state.schema,
|
|
1338
1338
|
t
|
|
1339
1339
|
);
|
|
1340
1340
|
if (s) {
|
|
1341
|
-
((
|
|
1342
|
-
const
|
|
1341
|
+
((l = e.firstChild) == null ? void 0 : l.type.name) === "table" && (e = e.firstChild.content);
|
|
1342
|
+
const a = We(
|
|
1343
1343
|
e,
|
|
1344
1344
|
t.schema.inlineContentSchema,
|
|
1345
1345
|
t.schema.styleSchema
|
|
1346
1346
|
);
|
|
1347
|
-
r = `<table>${
|
|
1348
|
-
|
|
1347
|
+
r = `<table>${i.exportInlineContent(
|
|
1348
|
+
a,
|
|
1349
1349
|
{}
|
|
1350
1350
|
)}</table>`;
|
|
1351
1351
|
} else if (o) {
|
|
1352
|
-
const
|
|
1352
|
+
const a = qe(
|
|
1353
1353
|
e,
|
|
1354
1354
|
t.schema.inlineContentSchema,
|
|
1355
1355
|
t.schema.styleSchema
|
|
1356
1356
|
);
|
|
1357
|
-
r =
|
|
1357
|
+
r = i.exportInlineContent(a, {});
|
|
1358
1358
|
} else {
|
|
1359
|
-
const
|
|
1360
|
-
r =
|
|
1359
|
+
const a = lt(e);
|
|
1360
|
+
r = i.exportBlocks(a, {});
|
|
1361
1361
|
}
|
|
1362
1362
|
return r;
|
|
1363
1363
|
}
|
|
1364
|
-
function
|
|
1364
|
+
function Ne(n, e) {
|
|
1365
1365
|
"node" in n.state.selection && n.state.selection.node.type.spec.group === "blockContent" && e.transact(
|
|
1366
|
-
(
|
|
1367
|
-
new
|
|
1366
|
+
(i) => i.setSelection(
|
|
1367
|
+
new $(i.doc.resolve(n.state.selection.from - 1))
|
|
1368
1368
|
)
|
|
1369
1369
|
);
|
|
1370
1370
|
const t = n.serializeForClipboard(
|
|
1371
1371
|
n.state.selection.content()
|
|
1372
|
-
).dom.innerHTML, o = n.state.selection.content().content, s =
|
|
1372
|
+
).dom.innerHTML, o = n.state.selection.content().content, s = tn(
|
|
1373
1373
|
n,
|
|
1374
1374
|
o,
|
|
1375
1375
|
e
|
|
1376
|
-
), r =
|
|
1376
|
+
), r = ct(s);
|
|
1377
1377
|
return { clipboardHTML: t, externalHTML: s, markdown: r };
|
|
1378
1378
|
}
|
|
1379
|
-
const
|
|
1379
|
+
const ue = () => {
|
|
1380
1380
|
const n = window.getSelection();
|
|
1381
1381
|
if (!n || n.isCollapsed)
|
|
1382
1382
|
return !0;
|
|
@@ -1387,25 +1387,25 @@ const de = () => {
|
|
|
1387
1387
|
e = e.parentElement;
|
|
1388
1388
|
}
|
|
1389
1389
|
return !1;
|
|
1390
|
-
},
|
|
1390
|
+
}, pe = (n, e, t) => {
|
|
1391
1391
|
t.preventDefault(), t.clipboardData.clearData();
|
|
1392
|
-
const { clipboardHTML: o, externalHTML: s, markdown: r } =
|
|
1392
|
+
const { clipboardHTML: o, externalHTML: s, markdown: r } = Ne(
|
|
1393
1393
|
e,
|
|
1394
1394
|
n
|
|
1395
1395
|
);
|
|
1396
1396
|
t.clipboardData.setData("blocknote/html", o), t.clipboardData.setData("text/html", s), t.clipboardData.setData("text/plain", r);
|
|
1397
|
-
},
|
|
1397
|
+
}, on = (n) => T.create({
|
|
1398
1398
|
name: "copyToClipboard",
|
|
1399
1399
|
addProseMirrorPlugins() {
|
|
1400
1400
|
return [
|
|
1401
|
-
new
|
|
1401
|
+
new oe({
|
|
1402
1402
|
props: {
|
|
1403
1403
|
handleDOMEvents: {
|
|
1404
1404
|
copy(e, t) {
|
|
1405
|
-
return
|
|
1405
|
+
return ue() || pe(n, e, t), !0;
|
|
1406
1406
|
},
|
|
1407
1407
|
cut(e, t) {
|
|
1408
|
-
return
|
|
1408
|
+
return ue() || (pe(n, e, t), e.editable && e.dispatch(e.state.tr.deleteSelection())), !0;
|
|
1409
1409
|
},
|
|
1410
1410
|
// This is for the use-case in which only a block without content
|
|
1411
1411
|
// is selected, e.g. an image block, and dragged (not using the
|
|
@@ -1414,13 +1414,13 @@ const de = () => {
|
|
|
1414
1414
|
if (!("node" in e.state.selection) || e.state.selection.node.type.spec.group !== "blockContent")
|
|
1415
1415
|
return;
|
|
1416
1416
|
n.transact(
|
|
1417
|
-
(
|
|
1418
|
-
new
|
|
1419
|
-
|
|
1417
|
+
(i) => i.setSelection(
|
|
1418
|
+
new $(
|
|
1419
|
+
i.doc.resolve(e.state.selection.from - 1)
|
|
1420
1420
|
)
|
|
1421
1421
|
)
|
|
1422
1422
|
), t.preventDefault(), t.dataTransfer.clearData();
|
|
1423
|
-
const { clipboardHTML: o, externalHTML: s, markdown: r } =
|
|
1423
|
+
const { clipboardHTML: o, externalHTML: s, markdown: r } = Ne(e, n);
|
|
1424
1424
|
return t.dataTransfer.setData("blocknote/html", o), t.dataTransfer.setData("text/html", s), t.dataTransfer.setData("text/plain", r), !0;
|
|
1425
1425
|
}
|
|
1426
1426
|
}
|
|
@@ -1428,19 +1428,19 @@ const de = () => {
|
|
|
1428
1428
|
})
|
|
1429
1429
|
];
|
|
1430
1430
|
}
|
|
1431
|
-
}),
|
|
1431
|
+
}), nn = T.create({
|
|
1432
1432
|
name: "blockBackgroundColor",
|
|
1433
1433
|
addGlobalAttributes() {
|
|
1434
1434
|
return [
|
|
1435
1435
|
{
|
|
1436
1436
|
types: ["tableCell", "tableHeader"],
|
|
1437
1437
|
attributes: {
|
|
1438
|
-
backgroundColor:
|
|
1438
|
+
backgroundColor: tt()
|
|
1439
1439
|
}
|
|
1440
1440
|
}
|
|
1441
1441
|
];
|
|
1442
1442
|
}
|
|
1443
|
-
}),
|
|
1443
|
+
}), sn = O.create({
|
|
1444
1444
|
name: "hardBreak",
|
|
1445
1445
|
inline: !0,
|
|
1446
1446
|
group: "inline",
|
|
@@ -1457,21 +1457,35 @@ const de = () => {
|
|
|
1457
1457
|
return `
|
|
1458
1458
|
`;
|
|
1459
1459
|
}
|
|
1460
|
-
}),
|
|
1460
|
+
}), _e = (n, e) => {
|
|
1461
|
+
var l;
|
|
1462
|
+
const t = n.resolve(e), o = t.depth - 1, s = t.before(o), r = n.resolve(s).nodeAfter;
|
|
1463
|
+
return r ? (l = r.type.spec.group) != null && l.includes("bnBlock") ? v(
|
|
1464
|
+
n.resolve(s)
|
|
1465
|
+
) : _e(n, s) : void 0;
|
|
1466
|
+
}, L = (n, e) => {
|
|
1461
1467
|
const t = n.resolve(e), o = t.index();
|
|
1462
1468
|
if (o === 0)
|
|
1463
1469
|
return;
|
|
1464
1470
|
const s = t.posAtIndex(o - 1);
|
|
1465
|
-
return
|
|
1471
|
+
return v(
|
|
1466
1472
|
n.resolve(s)
|
|
1467
1473
|
);
|
|
1468
|
-
},
|
|
1474
|
+
}, _ = (n, e) => {
|
|
1475
|
+
const t = n.resolve(e), o = t.index();
|
|
1476
|
+
if (o === t.node().childCount - 1)
|
|
1477
|
+
return;
|
|
1478
|
+
const s = t.posAtIndex(o + 1);
|
|
1479
|
+
return v(
|
|
1480
|
+
n.resolve(s)
|
|
1481
|
+
);
|
|
1482
|
+
}, Le = (n, e) => {
|
|
1469
1483
|
for (; e.childContainer; ) {
|
|
1470
1484
|
const t = e.childContainer.node, o = n.resolve(e.childContainer.beforePos + 1).posAtIndex(t.childCount - 1);
|
|
1471
|
-
e =
|
|
1485
|
+
e = v(n.resolve(o));
|
|
1472
1486
|
}
|
|
1473
1487
|
return e;
|
|
1474
|
-
},
|
|
1488
|
+
}, rn = (n, e) => n.isBlockContainer && n.blockContent.node.type.spec.content === "inline*" && n.blockContent.node.childCount > 0 && e.isBlockContainer && e.blockContent.node.type.spec.content === "inline*", an = (n, e, t, o) => {
|
|
1475
1489
|
if (!o.isBlockContainer)
|
|
1476
1490
|
throw new Error(
|
|
1477
1491
|
`Attempted to merge block at position ${o.bnBlock.beforePos} into previous block at position ${t.bnBlock.beforePos}, but next block is not a block container`
|
|
@@ -1481,10 +1495,10 @@ const de = () => {
|
|
|
1481
1495
|
o.childContainer.beforePos + 1
|
|
1482
1496
|
), r = n.doc.resolve(
|
|
1483
1497
|
o.childContainer.afterPos - 1
|
|
1484
|
-
),
|
|
1498
|
+
), i = s.blockRange(r);
|
|
1485
1499
|
if (e) {
|
|
1486
|
-
const
|
|
1487
|
-
n.tr.lift(
|
|
1500
|
+
const l = n.doc.resolve(o.bnBlock.beforePos);
|
|
1501
|
+
n.tr.lift(i, l.depth);
|
|
1488
1502
|
}
|
|
1489
1503
|
}
|
|
1490
1504
|
if (e) {
|
|
@@ -1500,22 +1514,22 @@ const de = () => {
|
|
|
1500
1514
|
);
|
|
1501
1515
|
}
|
|
1502
1516
|
return !0;
|
|
1503
|
-
},
|
|
1517
|
+
}, fe = (n) => ({
|
|
1504
1518
|
state: e,
|
|
1505
1519
|
dispatch: t
|
|
1506
1520
|
}) => {
|
|
1507
|
-
const o = e.doc.resolve(n), s =
|
|
1521
|
+
const o = e.doc.resolve(n), s = v(o), r = L(
|
|
1508
1522
|
e.doc,
|
|
1509
1523
|
s.bnBlock.beforePos
|
|
1510
1524
|
);
|
|
1511
1525
|
if (!r)
|
|
1512
1526
|
return !1;
|
|
1513
|
-
const
|
|
1527
|
+
const i = Le(
|
|
1514
1528
|
e.doc,
|
|
1515
1529
|
r
|
|
1516
1530
|
);
|
|
1517
|
-
return
|
|
1518
|
-
},
|
|
1531
|
+
return rn(i, s) ? an(e, t, i, s) : !1;
|
|
1532
|
+
}, cn = T.create({
|
|
1519
1533
|
priority: 50,
|
|
1520
1534
|
// TODO: The shortcuts need a refactor. Do we want to use a command priority
|
|
1521
1535
|
// design as there is now, or clump the logic into a single function?
|
|
@@ -1527,12 +1541,12 @@ const de = () => {
|
|
|
1527
1541
|
() => s.undoInputRule(),
|
|
1528
1542
|
// Reverts block content type to a paragraph if the selection is at the start of the block.
|
|
1529
1543
|
() => s.command(({ state: r }) => {
|
|
1530
|
-
const
|
|
1531
|
-
if (!
|
|
1544
|
+
const i = B(r);
|
|
1545
|
+
if (!i.isBlockContainer)
|
|
1532
1546
|
return !1;
|
|
1533
|
-
const
|
|
1534
|
-
return
|
|
1535
|
-
|
|
1547
|
+
const l = r.selection.from === i.blockContent.beforePos + 1, a = i.blockContent.node.type.name === "paragraph";
|
|
1548
|
+
return l && !a ? s.command(
|
|
1549
|
+
nt(i.bnBlock.beforePos, {
|
|
1536
1550
|
type: "paragraph",
|
|
1537
1551
|
props: {}
|
|
1538
1552
|
})
|
|
@@ -1540,80 +1554,104 @@ const de = () => {
|
|
|
1540
1554
|
}),
|
|
1541
1555
|
// Removes a level of nesting if the block is indented if the selection is at the start of the block.
|
|
1542
1556
|
() => s.command(({ state: r }) => {
|
|
1543
|
-
const
|
|
1544
|
-
if (!
|
|
1557
|
+
const i = B(r);
|
|
1558
|
+
if (!i.isBlockContainer)
|
|
1545
1559
|
return !1;
|
|
1546
|
-
const { blockContent:
|
|
1547
|
-
return r.selection.from ===
|
|
1560
|
+
const { blockContent: l } = i;
|
|
1561
|
+
return r.selection.from === l.beforePos + 1 ? s.liftListItem("blockContainer") : !1;
|
|
1548
1562
|
}),
|
|
1549
1563
|
// Merges block with the previous one if it isn't indented, and the selection is at the start of the
|
|
1550
1564
|
// block. The target block for merging must contain inline content.
|
|
1551
1565
|
() => s.command(({ state: r }) => {
|
|
1566
|
+
const i = B(r);
|
|
1567
|
+
if (!i.isBlockContainer)
|
|
1568
|
+
return !1;
|
|
1569
|
+
const { bnBlock: l, blockContent: a } = i, c = L(
|
|
1570
|
+
r.doc,
|
|
1571
|
+
i.bnBlock.beforePos
|
|
1572
|
+
);
|
|
1573
|
+
if (!c || !c.isBlockContainer || c.blockContent.node.type.spec.content !== "inline*")
|
|
1574
|
+
return !1;
|
|
1575
|
+
const d = r.selection.from === a.beforePos + 1, u = r.selection.empty, p = l.beforePos;
|
|
1576
|
+
return d && u ? o().command(fe(p)).scrollIntoView().run() : !1;
|
|
1577
|
+
}),
|
|
1578
|
+
// If the previous block is a columnList, moves the current block to
|
|
1579
|
+
// the end of the last column in it.
|
|
1580
|
+
() => s.command(({ state: r, tr: i, dispatch: l }) => {
|
|
1552
1581
|
const a = B(r);
|
|
1553
1582
|
if (!a.isBlockContainer)
|
|
1554
1583
|
return !1;
|
|
1555
|
-
const
|
|
1556
|
-
|
|
1584
|
+
const c = L(
|
|
1585
|
+
r.doc,
|
|
1586
|
+
a.bnBlock.beforePos
|
|
1587
|
+
);
|
|
1588
|
+
if (!c || c.isBlockContainer)
|
|
1589
|
+
return !1;
|
|
1590
|
+
if (l) {
|
|
1591
|
+
const d = c.bnBlock.afterPos - 1, u = i.doc.resolve(d - 1);
|
|
1592
|
+
return i.delete(
|
|
1593
|
+
a.bnBlock.beforePos,
|
|
1594
|
+
a.bnBlock.afterPos
|
|
1595
|
+
), i.insert(u.pos, a.bnBlock.node), i.setSelection(
|
|
1596
|
+
S.near(i.doc.resolve(u.pos + 1))
|
|
1597
|
+
), !0;
|
|
1598
|
+
}
|
|
1599
|
+
return !1;
|
|
1557
1600
|
}),
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1601
|
+
// If the block is the first in a column, moves it to the end of the
|
|
1602
|
+
// previous column. If there is no previous column, moves it above the
|
|
1603
|
+
// columnList.
|
|
1604
|
+
() => s.command(({ state: r, tr: i, dispatch: l }) => {
|
|
1605
|
+
const a = B(r);
|
|
1606
|
+
if (!a.isBlockContainer || !(i.selection.from === a.blockContent.beforePos + 1))
|
|
1561
1607
|
return !1;
|
|
1562
|
-
const d =
|
|
1608
|
+
const d = i.doc.resolve(a.bnBlock.beforePos);
|
|
1563
1609
|
if (d.nodeBefore || d.node().type.name !== "column")
|
|
1564
1610
|
return !1;
|
|
1565
|
-
const
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
)
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
), f.index() === 0 ? (K(a, k), a.insert(k, b), a.setSelection(
|
|
1575
|
-
M.near(a.doc.resolve(k))
|
|
1576
|
-
)) : (a.insert(f.pos - 1, b), a.setSelection(
|
|
1577
|
-
M.near(a.doc.resolve(f.pos - 1))
|
|
1578
|
-
), K(a, k));
|
|
1579
|
-
}
|
|
1580
|
-
return !0;
|
|
1611
|
+
const h = i.doc.resolve(a.bnBlock.beforePos), f = i.doc.resolve(h.before()), m = f.before();
|
|
1612
|
+
return l && (i.delete(
|
|
1613
|
+
a.bnBlock.beforePos,
|
|
1614
|
+
a.bnBlock.afterPos
|
|
1615
|
+
), H(i, m), f.pos === m + 1 ? (i.insert(m, a.bnBlock.node), i.setSelection(
|
|
1616
|
+
S.near(i.doc.resolve(m))
|
|
1617
|
+
)) : (i.insert(f.pos - 1, a.bnBlock.node), i.setSelection(
|
|
1618
|
+
S.near(i.doc.resolve(f.pos))
|
|
1619
|
+
))), !0;
|
|
1581
1620
|
}),
|
|
1582
1621
|
// Deletes the current block if it's an empty block with inline content,
|
|
1583
1622
|
// and moves the selection to the previous block.
|
|
1584
1623
|
() => s.command(({ state: r }) => {
|
|
1585
|
-
var
|
|
1586
|
-
const
|
|
1587
|
-
if (!
|
|
1624
|
+
var a;
|
|
1625
|
+
const i = B(r);
|
|
1626
|
+
if (!i.isBlockContainer)
|
|
1588
1627
|
return !1;
|
|
1589
|
-
if (
|
|
1590
|
-
const
|
|
1628
|
+
if (i.blockContent.node.childCount === 0 && i.blockContent.node.type.spec.content === "inline*") {
|
|
1629
|
+
const c = L(
|
|
1591
1630
|
r.doc,
|
|
1592
|
-
|
|
1631
|
+
i.bnBlock.beforePos
|
|
1593
1632
|
);
|
|
1594
|
-
if (!
|
|
1633
|
+
if (!c || !c.isBlockContainer)
|
|
1595
1634
|
return !1;
|
|
1596
1635
|
let d = o();
|
|
1597
|
-
if (
|
|
1598
|
-
|
|
1599
|
-
(
|
|
1600
|
-
),
|
|
1601
|
-
const
|
|
1636
|
+
if (i.childContainer && d.insertContentAt(
|
|
1637
|
+
i.bnBlock.afterPos,
|
|
1638
|
+
(a = i.childContainer) == null ? void 0 : a.node.content
|
|
1639
|
+
), c.blockContent.node.type.spec.content === "tableRow+") {
|
|
1640
|
+
const m = i.bnBlock.beforePos - 1 - 1 - 1 - 1 - 1;
|
|
1602
1641
|
d = d.setTextSelection(
|
|
1603
|
-
|
|
1642
|
+
m
|
|
1604
1643
|
);
|
|
1605
|
-
} else if (
|
|
1606
|
-
const u = l.blockContent.afterPos - l.blockContent.node.nodeSize;
|
|
1644
|
+
} else if (c.blockContent.node.type.spec.content === "")
|
|
1607
1645
|
d = d.setNodeSelection(
|
|
1608
|
-
|
|
1646
|
+
c.blockContent.beforePos
|
|
1609
1647
|
);
|
|
1610
|
-
|
|
1611
|
-
const u =
|
|
1648
|
+
else {
|
|
1649
|
+
const u = c.blockContent.afterPos - 1;
|
|
1612
1650
|
d = d.setTextSelection(u);
|
|
1613
1651
|
}
|
|
1614
1652
|
return d.deleteRange({
|
|
1615
|
-
from:
|
|
1616
|
-
to:
|
|
1653
|
+
from: i.bnBlock.beforePos,
|
|
1654
|
+
to: i.bnBlock.afterPos
|
|
1617
1655
|
}).scrollIntoView().run();
|
|
1618
1656
|
}
|
|
1619
1657
|
return !1;
|
|
@@ -1622,25 +1660,25 @@ const de = () => {
|
|
|
1622
1660
|
// when the selection is empty and at the start of the block. Moves the
|
|
1623
1661
|
// current block into the deleted block's place.
|
|
1624
1662
|
() => s.command(({ state: r }) => {
|
|
1625
|
-
const
|
|
1626
|
-
if (!
|
|
1627
|
-
|
|
1628
|
-
const
|
|
1663
|
+
const i = B(r);
|
|
1664
|
+
if (!i.isBlockContainer)
|
|
1665
|
+
return !1;
|
|
1666
|
+
const l = r.selection.from === i.blockContent.beforePos + 1, a = r.selection.empty, c = L(
|
|
1629
1667
|
r.doc,
|
|
1630
|
-
|
|
1668
|
+
i.bnBlock.beforePos
|
|
1631
1669
|
);
|
|
1632
|
-
if (
|
|
1633
|
-
const d =
|
|
1670
|
+
if (c && l && a) {
|
|
1671
|
+
const d = Le(
|
|
1634
1672
|
r.doc,
|
|
1635
|
-
|
|
1673
|
+
c
|
|
1636
1674
|
);
|
|
1637
1675
|
if (!d.isBlockContainer)
|
|
1638
|
-
|
|
1676
|
+
return !1;
|
|
1639
1677
|
if (d.blockContent.node.type.spec.content === "" || d.blockContent.node.type.spec.content === "inline*" && d.blockContent.node.childCount === 0)
|
|
1640
1678
|
return o().cut(
|
|
1641
1679
|
{
|
|
1642
|
-
from:
|
|
1643
|
-
to:
|
|
1680
|
+
from: i.bnBlock.beforePos,
|
|
1681
|
+
to: i.bnBlock.afterPos
|
|
1644
1682
|
},
|
|
1645
1683
|
d.bnBlock.afterPos
|
|
1646
1684
|
).deleteRange({
|
|
@@ -1650,51 +1688,228 @@ const de = () => {
|
|
|
1650
1688
|
}
|
|
1651
1689
|
return !1;
|
|
1652
1690
|
})
|
|
1653
|
-
]), e = () => this.editor.commands.first(({
|
|
1691
|
+
]), e = () => this.editor.commands.first(({ chain: o, commands: s }) => [
|
|
1654
1692
|
// Deletes the selection if it's not empty.
|
|
1655
|
-
() =>
|
|
1693
|
+
() => s.deleteSelection(),
|
|
1694
|
+
// Deletes the first child block and un-nests its children, if the
|
|
1695
|
+
// selection is empty and at the end of the current block. If both the
|
|
1696
|
+
// parent and child blocks have inline content, the child block's
|
|
1697
|
+
// content is appended to the parent's. The child block's own children
|
|
1698
|
+
// are unindented before it's deleted.
|
|
1699
|
+
() => s.command(({ state: r }) => {
|
|
1700
|
+
var p;
|
|
1701
|
+
const i = B(r);
|
|
1702
|
+
if (!i.isBlockContainer || !i.childContainer)
|
|
1703
|
+
return !1;
|
|
1704
|
+
const { blockContent: l, childContainer: a } = i, c = r.selection.from === l.afterPos - 1, d = r.selection.empty, u = v(
|
|
1705
|
+
r.doc.resolve(a.beforePos + 1)
|
|
1706
|
+
);
|
|
1707
|
+
if (!u.isBlockContainer)
|
|
1708
|
+
return !1;
|
|
1709
|
+
if (c && d) {
|
|
1710
|
+
const h = u.blockContent.node, f = h.type.spec.content === "inline*", m = l.node.type.spec.content === "inline*";
|
|
1711
|
+
return o().insertContentAt(
|
|
1712
|
+
u.bnBlock.afterPos,
|
|
1713
|
+
((p = u.childContainer) == null ? void 0 : p.node.content) || w.empty
|
|
1714
|
+
).deleteRange(
|
|
1715
|
+
// Deletes whole child container if there's only one child.
|
|
1716
|
+
a.node.childCount === 1 ? {
|
|
1717
|
+
from: a.beforePos,
|
|
1718
|
+
to: a.afterPos
|
|
1719
|
+
} : {
|
|
1720
|
+
from: u.bnBlock.beforePos,
|
|
1721
|
+
to: u.bnBlock.afterPos
|
|
1722
|
+
}
|
|
1723
|
+
).insertContentAt(
|
|
1724
|
+
r.selection.from,
|
|
1725
|
+
f && m ? h.content : null
|
|
1726
|
+
).setTextSelection(r.selection.from).scrollIntoView().run();
|
|
1727
|
+
}
|
|
1728
|
+
return !1;
|
|
1729
|
+
}),
|
|
1656
1730
|
// Merges block with the next one (at the same nesting level or lower),
|
|
1657
1731
|
// if one exists, the block has no children, and the selection is at the
|
|
1658
1732
|
// end of the block.
|
|
1659
|
-
() =>
|
|
1660
|
-
const
|
|
1661
|
-
if (!
|
|
1733
|
+
() => s.command(({ state: r }) => {
|
|
1734
|
+
const i = B(r);
|
|
1735
|
+
if (!i.isBlockContainer)
|
|
1662
1736
|
return !1;
|
|
1663
|
-
const {
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1737
|
+
const { bnBlock: l, blockContent: a } = i, c = _(
|
|
1738
|
+
r.doc,
|
|
1739
|
+
i.bnBlock.beforePos
|
|
1740
|
+
);
|
|
1741
|
+
if (!c || !c.isBlockContainer)
|
|
1742
|
+
return !1;
|
|
1743
|
+
const d = r.selection.from === a.afterPos - 1, u = r.selection.empty, p = l.afterPos;
|
|
1744
|
+
return d && u ? o().command(fe(p)).scrollIntoView().run() : !1;
|
|
1745
|
+
}),
|
|
1746
|
+
// If the previous block is a columnList, moves the current block to
|
|
1747
|
+
// the end of the last column in it.
|
|
1748
|
+
() => s.command(({ state: r, tr: i, dispatch: l }) => {
|
|
1749
|
+
const a = B(r);
|
|
1750
|
+
if (!a.isBlockContainer)
|
|
1751
|
+
return !1;
|
|
1752
|
+
const c = _(
|
|
1753
|
+
r.doc,
|
|
1754
|
+
a.bnBlock.beforePos
|
|
1755
|
+
);
|
|
1756
|
+
if (!c || c.isBlockContainer)
|
|
1757
|
+
return !1;
|
|
1758
|
+
if (l) {
|
|
1759
|
+
const d = c.bnBlock.beforePos + 1, u = i.doc.resolve(d + 1);
|
|
1760
|
+
return i.delete(
|
|
1761
|
+
u.pos,
|
|
1762
|
+
u.pos + u.nodeAfter.nodeSize
|
|
1763
|
+
), H(i, c.bnBlock.beforePos), i.insert(a.bnBlock.afterPos, u.nodeAfter), i.setSelection(
|
|
1764
|
+
S.near(i.doc.resolve(u.pos))
|
|
1765
|
+
), !0;
|
|
1766
|
+
}
|
|
1767
|
+
return !1;
|
|
1768
|
+
}),
|
|
1769
|
+
// If the block is the last in a column, moves it to the start of the
|
|
1770
|
+
// next column. If there is no next column, moves it below the
|
|
1771
|
+
// columnList.
|
|
1772
|
+
() => s.command(({ state: r, tr: i, dispatch: l }) => {
|
|
1773
|
+
const a = B(r);
|
|
1774
|
+
if (!a.isBlockContainer || !(i.selection.from === a.blockContent.afterPos - 1))
|
|
1775
|
+
return !1;
|
|
1776
|
+
const d = i.doc.resolve(a.bnBlock.afterPos);
|
|
1777
|
+
if (d.nodeAfter || d.node().type.name !== "column")
|
|
1778
|
+
return !1;
|
|
1779
|
+
const h = i.doc.resolve(a.bnBlock.afterPos), f = i.doc.resolve(h.after()), m = f.after();
|
|
1780
|
+
if (l) {
|
|
1781
|
+
const b = f.pos === m - 1 ? m : f.pos + 1, g = v(
|
|
1782
|
+
i.doc.resolve(b)
|
|
1783
|
+
);
|
|
1784
|
+
i.delete(
|
|
1785
|
+
g.bnBlock.beforePos,
|
|
1786
|
+
g.bnBlock.afterPos
|
|
1787
|
+
), H(
|
|
1788
|
+
i,
|
|
1789
|
+
m - f.node().nodeSize
|
|
1790
|
+
), i.insert(h.pos, g.bnBlock.node), i.setSelection(
|
|
1791
|
+
S.near(i.doc.resolve(b))
|
|
1792
|
+
);
|
|
1793
|
+
}
|
|
1794
|
+
return !0;
|
|
1795
|
+
}),
|
|
1796
|
+
// Deletes the next block at either the same or lower nesting level, if
|
|
1797
|
+
// the selection is empty and at the end of the block. If both the
|
|
1798
|
+
// current and next blocks have inline content, the next block's
|
|
1799
|
+
// content is appended to the current block's. The next block's own
|
|
1800
|
+
// children are unindented before it's deleted.
|
|
1801
|
+
() => s.command(({ state: r }) => {
|
|
1802
|
+
var d;
|
|
1803
|
+
const i = B(r);
|
|
1804
|
+
if (!i.isBlockContainer)
|
|
1805
|
+
return !1;
|
|
1806
|
+
const { blockContent: l } = i, a = r.selection.from === l.afterPos - 1, c = r.selection.empty;
|
|
1807
|
+
if (a && c) {
|
|
1808
|
+
const u = (b, g) => {
|
|
1809
|
+
const x = _(b, g);
|
|
1810
|
+
if (x)
|
|
1811
|
+
return x;
|
|
1812
|
+
const y = _e(b, g);
|
|
1813
|
+
if (y)
|
|
1814
|
+
return u(
|
|
1815
|
+
b,
|
|
1816
|
+
y.bnBlock.beforePos
|
|
1817
|
+
);
|
|
1818
|
+
}, p = u(
|
|
1819
|
+
r.doc,
|
|
1820
|
+
i.bnBlock.beforePos
|
|
1821
|
+
);
|
|
1822
|
+
if (!p || !p.isBlockContainer)
|
|
1823
|
+
return !1;
|
|
1824
|
+
const h = p.blockContent.node, f = h.type.spec.content === "inline*", m = l.node.type.spec.content === "inline*";
|
|
1825
|
+
return o().insertContentAt(
|
|
1826
|
+
p.bnBlock.afterPos,
|
|
1827
|
+
((d = p.childContainer) == null ? void 0 : d.node.content) || w.empty
|
|
1828
|
+
).deleteRange({
|
|
1829
|
+
from: p.bnBlock.beforePos,
|
|
1830
|
+
to: p.bnBlock.afterPos
|
|
1831
|
+
}).insertContentAt(
|
|
1832
|
+
r.selection.from,
|
|
1833
|
+
f && m ? h.content : null
|
|
1834
|
+
).setTextSelection(r.selection.from).scrollIntoView().run();
|
|
1835
|
+
}
|
|
1836
|
+
return !1;
|
|
1837
|
+
}),
|
|
1838
|
+
// Deletes the current block if it's an empty block with inline content,
|
|
1839
|
+
// and moves the selection to the next block.
|
|
1840
|
+
() => s.command(({ state: r }) => {
|
|
1841
|
+
const i = B(r);
|
|
1842
|
+
if (!i.isBlockContainer)
|
|
1843
|
+
return !1;
|
|
1844
|
+
if (i.blockContent.node.childCount === 0 && i.blockContent.node.type.spec.content === "inline*") {
|
|
1845
|
+
const a = _(
|
|
1846
|
+
r.doc,
|
|
1847
|
+
i.bnBlock.beforePos
|
|
1848
|
+
);
|
|
1849
|
+
if (!a || !a.isBlockContainer)
|
|
1850
|
+
return !1;
|
|
1851
|
+
let c = o();
|
|
1852
|
+
if (a.blockContent.node.type.spec.content === "tableRow+") {
|
|
1853
|
+
const f = i.bnBlock.afterPos + 1 + 1 + 1 + 1 + 1;
|
|
1854
|
+
c = c.setTextSelection(
|
|
1855
|
+
f
|
|
1856
|
+
);
|
|
1857
|
+
} else a.blockContent.node.type.spec.content === "" ? c = c.setNodeSelection(
|
|
1858
|
+
a.blockContent.beforePos
|
|
1859
|
+
) : c = c.setTextSelection(
|
|
1860
|
+
a.blockContent.beforePos + 1
|
|
1861
|
+
);
|
|
1862
|
+
return c.deleteRange({
|
|
1863
|
+
from: i.bnBlock.beforePos,
|
|
1864
|
+
to: i.bnBlock.afterPos
|
|
1865
|
+
}).scrollIntoView().run();
|
|
1866
|
+
}
|
|
1867
|
+
return !1;
|
|
1868
|
+
}),
|
|
1869
|
+
// Deletes next block if it contains no content and isn't a table,
|
|
1870
|
+
// when the selection is empty and at the end of the block. Moves the
|
|
1871
|
+
// current block into the deleted block's place.
|
|
1872
|
+
() => s.command(({ state: r }) => {
|
|
1873
|
+
const i = B(r);
|
|
1874
|
+
if (!i.isBlockContainer)
|
|
1875
|
+
return !1;
|
|
1876
|
+
const l = r.selection.from === i.blockContent.afterPos - 1, a = r.selection.empty, c = _(
|
|
1877
|
+
r.doc,
|
|
1878
|
+
i.bnBlock.beforePos
|
|
1879
|
+
);
|
|
1880
|
+
if (!c || !c.isBlockContainer)
|
|
1881
|
+
return !1;
|
|
1882
|
+
if (c && l && a && (c.blockContent.node.type.spec.content === "" || c.blockContent.node.type.spec.content === "inline*" && c.blockContent.node.childCount === 0)) {
|
|
1883
|
+
const u = c.bnBlock.node.lastChild.content;
|
|
1884
|
+
return o().deleteRange({
|
|
1885
|
+
from: c.bnBlock.beforePos,
|
|
1886
|
+
to: c.bnBlock.afterPos
|
|
1887
|
+
}).insertContentAt(i.bnBlock.afterPos, c.bnBlock.node.childCount === 2 ? u : null).run();
|
|
1673
1888
|
}
|
|
1674
1889
|
return !1;
|
|
1675
1890
|
})
|
|
1676
1891
|
]), t = (o = !1) => this.editor.commands.first(({ commands: s, tr: r }) => [
|
|
1677
1892
|
// Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start
|
|
1678
1893
|
// of the block.
|
|
1679
|
-
() => s.command(({ state:
|
|
1680
|
-
const
|
|
1681
|
-
if (!
|
|
1894
|
+
() => s.command(({ state: i }) => {
|
|
1895
|
+
const l = B(i);
|
|
1896
|
+
if (!l.isBlockContainer)
|
|
1682
1897
|
return !1;
|
|
1683
|
-
const { bnBlock:
|
|
1684
|
-
return u && p &&
|
|
1898
|
+
const { bnBlock: a, blockContent: c } = l, { depth: d } = i.doc.resolve(a.beforePos), u = i.selection.$anchor.parentOffset === 0, p = i.selection.anchor === i.selection.head, h = c.node.childCount === 0, f = d > 1;
|
|
1899
|
+
return u && p && h && f ? s.liftListItem("blockContainer") : !1;
|
|
1685
1900
|
}),
|
|
1686
1901
|
// Creates a hard break if block is configured to do so.
|
|
1687
|
-
() => s.command(({ state:
|
|
1688
|
-
var
|
|
1689
|
-
const
|
|
1690
|
-
if (
|
|
1902
|
+
() => s.command(({ state: i }) => {
|
|
1903
|
+
var c;
|
|
1904
|
+
const l = B(i), a = ((c = this.options.editor.schema.blockSchema[l.blockNoteType].meta) == null ? void 0 : c.hardBreakShortcut) ?? "shift+enter";
|
|
1905
|
+
if (a === "none")
|
|
1691
1906
|
return !1;
|
|
1692
1907
|
if (
|
|
1693
1908
|
// If shortcut is not configured, or is configured as "shift+enter",
|
|
1694
1909
|
// create a hard break for shift+enter, but not for enter.
|
|
1695
|
-
|
|
1910
|
+
a === "shift+enter" && o || // If shortcut is configured as "enter", create a hard break for
|
|
1696
1911
|
// both enter and shift+enter.
|
|
1697
|
-
|
|
1912
|
+
a === "enter"
|
|
1698
1913
|
) {
|
|
1699
1914
|
const d = r.storedMarks || r.selection.$head.marks().filter(
|
|
1700
1915
|
(u) => this.editor.extensionManager.splittableMarks.includes(
|
|
@@ -1710,27 +1925,27 @@ const de = () => {
|
|
|
1710
1925
|
}),
|
|
1711
1926
|
// Creates a new block and moves the selection to it if the current one is empty, while the selection is also
|
|
1712
1927
|
// empty & at the start of the block.
|
|
1713
|
-
() => s.command(({ state:
|
|
1714
|
-
var
|
|
1715
|
-
const
|
|
1716
|
-
if (!
|
|
1928
|
+
() => s.command(({ state: i, dispatch: l, tr: a }) => {
|
|
1929
|
+
var m;
|
|
1930
|
+
const c = B(i);
|
|
1931
|
+
if (!c.isBlockContainer)
|
|
1717
1932
|
return !1;
|
|
1718
|
-
const { bnBlock: d, blockContent: u } =
|
|
1719
|
-
if (p &&
|
|
1933
|
+
const { bnBlock: d, blockContent: u } = c, p = i.selection.$anchor.parentOffset === 0, h = i.selection.anchor === i.selection.head, f = u.node.childCount === 0;
|
|
1934
|
+
if (p && h && f) {
|
|
1720
1935
|
const b = d.afterPos, g = b + 2;
|
|
1721
|
-
if (
|
|
1722
|
-
const
|
|
1936
|
+
if (l) {
|
|
1937
|
+
const x = i.schema.nodes.blockContainer.createAndFill(
|
|
1723
1938
|
void 0,
|
|
1724
1939
|
[
|
|
1725
|
-
|
|
1726
|
-
(
|
|
1940
|
+
i.schema.nodes.paragraph.createAndFill() || void 0,
|
|
1941
|
+
(m = c.childContainer) == null ? void 0 : m.node
|
|
1727
1942
|
].filter((y) => y !== void 0)
|
|
1728
1943
|
);
|
|
1729
|
-
|
|
1730
|
-
new
|
|
1731
|
-
).scrollIntoView(),
|
|
1732
|
-
|
|
1733
|
-
|
|
1944
|
+
a.insert(b, x).setSelection(
|
|
1945
|
+
new S(a.doc.resolve(g))
|
|
1946
|
+
).scrollIntoView(), c.childContainer && a.delete(
|
|
1947
|
+
c.childContainer.beforePos,
|
|
1948
|
+
c.childContainer.afterPos
|
|
1734
1949
|
);
|
|
1735
1950
|
}
|
|
1736
1951
|
return !0;
|
|
@@ -1739,14 +1954,14 @@ const de = () => {
|
|
|
1739
1954
|
}),
|
|
1740
1955
|
// Splits the current block, moving content inside that's after the cursor to a new text block below. Also
|
|
1741
1956
|
// deletes the selection beforehand, if it's not empty.
|
|
1742
|
-
() => s.command(({ state:
|
|
1743
|
-
const
|
|
1744
|
-
if (!
|
|
1957
|
+
() => s.command(({ state: i, chain: l }) => {
|
|
1958
|
+
const a = B(i);
|
|
1959
|
+
if (!a.isBlockContainer)
|
|
1745
1960
|
return !1;
|
|
1746
|
-
const { blockContent:
|
|
1747
|
-
return
|
|
1748
|
-
|
|
1749
|
-
|
|
1961
|
+
const { blockContent: c } = a, d = i.selection.$anchor.parentOffset === 0;
|
|
1962
|
+
return c.node.childCount === 0 ? !1 : (l().deleteSelection().command(
|
|
1963
|
+
ot(
|
|
1964
|
+
i.selection.from,
|
|
1750
1965
|
d,
|
|
1751
1966
|
d
|
|
1752
1967
|
)
|
|
@@ -1762,11 +1977,11 @@ const de = () => {
|
|
|
1762
1977
|
// editor since the browser will try to use tab for keyboard navigation.
|
|
1763
1978
|
Tab: () => {
|
|
1764
1979
|
var o, s;
|
|
1765
|
-
return this.options.tabBehavior !== "prefer-indent" && ((o = this.options.editor.getExtension(
|
|
1980
|
+
return this.options.tabBehavior !== "prefer-indent" && ((o = this.options.editor.getExtension(Y)) != null && o.store.state || ((s = this.options.editor.getExtension(J)) == null ? void 0 : s.store.state) !== void 0) ? !1 : we(this.options.editor);
|
|
1766
1981
|
},
|
|
1767
1982
|
"Shift-Tab": () => {
|
|
1768
1983
|
var o, s;
|
|
1769
|
-
return this.options.tabBehavior !== "prefer-indent" && ((o = this.options.editor.getExtension(
|
|
1984
|
+
return this.options.tabBehavior !== "prefer-indent" && ((o = this.options.editor.getExtension(Y)) != null && o.store.state || ((s = this.options.editor.getExtension(J)) == null ? void 0 : s.store.state) !== void 0) ? !1 : this.editor.commands.liftListItem("blockContainer");
|
|
1770
1985
|
},
|
|
1771
1986
|
"Shift-Mod-ArrowUp": () => (this.options.editor.moveBlocksUp(), !0),
|
|
1772
1987
|
"Shift-Mod-ArrowDown": () => (this.options.editor.moveBlocksDown(), !0),
|
|
@@ -1775,7 +1990,7 @@ const de = () => {
|
|
|
1775
1990
|
"Shift-Mod-z": () => this.options.editor.redo()
|
|
1776
1991
|
};
|
|
1777
1992
|
}
|
|
1778
|
-
}),
|
|
1993
|
+
}), ln = te.create({
|
|
1779
1994
|
name: "insertion",
|
|
1780
1995
|
inclusive: !1,
|
|
1781
1996
|
excludes: "deletion modification insertion",
|
|
@@ -1813,7 +2028,7 @@ const de = () => {
|
|
|
1813
2028
|
]
|
|
1814
2029
|
};
|
|
1815
2030
|
}
|
|
1816
|
-
}),
|
|
2031
|
+
}), dn = te.create({
|
|
1817
2032
|
name: "deletion",
|
|
1818
2033
|
inclusive: !1,
|
|
1819
2034
|
excludes: "insertion modification deletion",
|
|
@@ -1854,7 +2069,7 @@ const de = () => {
|
|
|
1854
2069
|
]
|
|
1855
2070
|
};
|
|
1856
2071
|
}
|
|
1857
|
-
}),
|
|
2072
|
+
}), un = te.create({
|
|
1858
2073
|
name: "modification",
|
|
1859
2074
|
inclusive: !1,
|
|
1860
2075
|
excludes: "deletion insertion",
|
|
@@ -1917,7 +2132,7 @@ const de = () => {
|
|
|
1917
2132
|
]
|
|
1918
2133
|
};
|
|
1919
2134
|
}
|
|
1920
|
-
}),
|
|
2135
|
+
}), pn = T.create({
|
|
1921
2136
|
name: "textAlignment",
|
|
1922
2137
|
addGlobalAttributes() {
|
|
1923
2138
|
return [
|
|
@@ -1939,25 +2154,25 @@ const de = () => {
|
|
|
1939
2154
|
}
|
|
1940
2155
|
];
|
|
1941
2156
|
}
|
|
1942
|
-
}),
|
|
2157
|
+
}), fn = T.create({
|
|
1943
2158
|
name: "blockTextColor",
|
|
1944
2159
|
addGlobalAttributes() {
|
|
1945
2160
|
return [
|
|
1946
2161
|
{
|
|
1947
2162
|
types: ["table", "tableCell", "tableHeader"],
|
|
1948
2163
|
attributes: {
|
|
1949
|
-
textColor:
|
|
2164
|
+
textColor: st()
|
|
1950
2165
|
}
|
|
1951
2166
|
}
|
|
1952
2167
|
];
|
|
1953
2168
|
}
|
|
1954
|
-
}),
|
|
2169
|
+
}), hn = {
|
|
1955
2170
|
blockColor: "data-block-color",
|
|
1956
2171
|
blockStyle: "data-block-style",
|
|
1957
2172
|
id: "data-id",
|
|
1958
2173
|
depth: "data-depth",
|
|
1959
2174
|
depthChange: "data-depth-change"
|
|
1960
|
-
},
|
|
2175
|
+
}, mn = O.create({
|
|
1961
2176
|
name: "blockContainer",
|
|
1962
2177
|
group: "blockGroupChild bnBlock",
|
|
1963
2178
|
// A block always contains content, and optionally a blockGroup which contains nested blocks
|
|
@@ -1974,7 +2189,7 @@ const de = () => {
|
|
|
1974
2189
|
if (typeof n == "string")
|
|
1975
2190
|
return !1;
|
|
1976
2191
|
const e = {};
|
|
1977
|
-
for (const [t, o] of Object.entries(
|
|
2192
|
+
for (const [t, o] of Object.entries(hn))
|
|
1978
2193
|
n.getAttribute(o) && (e[t] = n.getAttribute(o));
|
|
1979
2194
|
return e;
|
|
1980
2195
|
}
|
|
@@ -1990,21 +2205,21 @@ const de = () => {
|
|
|
1990
2205
|
var s;
|
|
1991
2206
|
const e = document.createElement("div");
|
|
1992
2207
|
e.className = "bn-block-outer", e.setAttribute("data-node-type", "blockOuter");
|
|
1993
|
-
for (const [r,
|
|
1994
|
-
r !== "class" && e.setAttribute(r,
|
|
2208
|
+
for (const [r, i] of Object.entries(n))
|
|
2209
|
+
r !== "class" && e.setAttribute(r, i);
|
|
1995
2210
|
const t = {
|
|
1996
2211
|
...((s = this.options.domAttributes) == null ? void 0 : s.block) || {},
|
|
1997
2212
|
...n
|
|
1998
2213
|
}, o = document.createElement("div");
|
|
1999
|
-
o.className =
|
|
2000
|
-
for (const [r,
|
|
2001
|
-
r !== "class" && o.setAttribute(r,
|
|
2214
|
+
o.className = ee("bn-block", t.class), o.setAttribute("data-node-type", this.name);
|
|
2215
|
+
for (const [r, i] of Object.entries(t))
|
|
2216
|
+
r !== "class" && o.setAttribute(r, i);
|
|
2002
2217
|
return e.appendChild(o), {
|
|
2003
2218
|
dom: e,
|
|
2004
2219
|
contentDOM: o
|
|
2005
2220
|
};
|
|
2006
2221
|
}
|
|
2007
|
-
}),
|
|
2222
|
+
}), kn = O.create({
|
|
2008
2223
|
name: "blockGroup",
|
|
2009
2224
|
group: "childContainer",
|
|
2010
2225
|
content: "blockGroupChild+",
|
|
@@ -2023,7 +2238,7 @@ const de = () => {
|
|
|
2023
2238
|
...((o = this.options.domAttributes) == null ? void 0 : o.blockGroup) || {},
|
|
2024
2239
|
...n
|
|
2025
2240
|
}, t = document.createElement("div");
|
|
2026
|
-
t.className =
|
|
2241
|
+
t.className = ee(
|
|
2027
2242
|
"bn-block-group",
|
|
2028
2243
|
e.class
|
|
2029
2244
|
), t.setAttribute("data-node-type", "blockGroup");
|
|
@@ -2034,77 +2249,77 @@ const de = () => {
|
|
|
2034
2249
|
contentDOM: t
|
|
2035
2250
|
};
|
|
2036
2251
|
}
|
|
2037
|
-
}),
|
|
2252
|
+
}), bn = O.create({
|
|
2038
2253
|
name: "doc",
|
|
2039
2254
|
topNode: !0,
|
|
2040
2255
|
content: "blockGroup",
|
|
2041
2256
|
marks: "insertion modification deletion"
|
|
2042
|
-
}),
|
|
2257
|
+
}), gn = Vt(
|
|
2043
2258
|
({ options: n }) => ({
|
|
2044
2259
|
key: "collaboration",
|
|
2045
2260
|
blockNoteExtensions: [
|
|
2046
|
-
ct(n),
|
|
2047
|
-
lt(n),
|
|
2048
2261
|
dt(n),
|
|
2049
|
-
ut(),
|
|
2050
|
-
pt(n)
|
|
2262
|
+
ut(n),
|
|
2263
|
+
pt(n),
|
|
2264
|
+
ft(),
|
|
2265
|
+
ht(n)
|
|
2051
2266
|
]
|
|
2052
2267
|
})
|
|
2053
2268
|
);
|
|
2054
|
-
let
|
|
2055
|
-
function
|
|
2269
|
+
let he = !1;
|
|
2270
|
+
function Bn(n, e) {
|
|
2056
2271
|
const t = [
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2272
|
+
N.ClipboardTextSerializer,
|
|
2273
|
+
N.Commands,
|
|
2274
|
+
N.Editable,
|
|
2275
|
+
N.FocusEvents,
|
|
2276
|
+
N.Tabindex,
|
|
2277
|
+
zt,
|
|
2278
|
+
ke.configure({
|
|
2064
2279
|
// everything from bnBlock group (nodes that represent a BlockNote block should have an id)
|
|
2065
2280
|
types: ["blockContainer", "columnList", "column"],
|
|
2066
2281
|
setIdAttribute: e.setIdAttribute
|
|
2067
2282
|
}),
|
|
2068
|
-
|
|
2069
|
-
|
|
2283
|
+
sn,
|
|
2284
|
+
Gt,
|
|
2070
2285
|
// marks:
|
|
2071
|
-
an,
|
|
2072
|
-
cn,
|
|
2073
2286
|
ln,
|
|
2074
|
-
|
|
2287
|
+
dn,
|
|
2288
|
+
un,
|
|
2289
|
+
Rt.extend({
|
|
2075
2290
|
inclusive: !1
|
|
2076
2291
|
}).configure({
|
|
2077
|
-
defaultProtocol:
|
|
2292
|
+
defaultProtocol: Pt,
|
|
2078
2293
|
// only call this once if we have multiple editors installed. Or fix https://github.com/ueberdosis/tiptap/issues/5450
|
|
2079
|
-
protocols:
|
|
2294
|
+
protocols: he ? [] : Et
|
|
2080
2295
|
}),
|
|
2081
2296
|
...Object.values(n.schema.styleSpecs).map((o) => o.implementation.mark.configure({
|
|
2082
2297
|
editor: n
|
|
2083
2298
|
})),
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2299
|
+
fn,
|
|
2300
|
+
nn,
|
|
2301
|
+
pn,
|
|
2087
2302
|
// make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)
|
|
2088
|
-
|
|
2303
|
+
T.create({
|
|
2089
2304
|
name: "OverrideEscape",
|
|
2090
2305
|
addKeyboardShortcuts: () => ({
|
|
2091
2306
|
Escape: () => {
|
|
2092
2307
|
var o;
|
|
2093
|
-
return (o = n.getExtension(
|
|
2308
|
+
return (o = n.getExtension(ge)) != null && o.shown() ? !1 : (n.blur(), !0);
|
|
2094
2309
|
}
|
|
2095
2310
|
})
|
|
2096
2311
|
}),
|
|
2097
2312
|
// nodes
|
|
2098
|
-
|
|
2099
|
-
|
|
2313
|
+
bn,
|
|
2314
|
+
mn.configure({
|
|
2100
2315
|
editor: n,
|
|
2101
2316
|
domAttributes: e.domAttributes
|
|
2102
2317
|
}),
|
|
2103
|
-
|
|
2318
|
+
cn.configure({
|
|
2104
2319
|
editor: n,
|
|
2105
2320
|
tabBehavior: e.tabBehavior
|
|
2106
2321
|
}),
|
|
2107
|
-
|
|
2322
|
+
kn.configure({
|
|
2108
2323
|
domAttributes: e.domAttributes
|
|
2109
2324
|
}),
|
|
2110
2325
|
...Object.values(n.schema.inlineContentSpecs).filter((o) => o.config !== "link" && o.config !== "text").map((o) => o.implementation.node.configure({
|
|
@@ -2119,54 +2334,54 @@ function bn(n, e) {
|
|
|
2119
2334
|
})
|
|
2120
2335
|
] : []
|
|
2121
2336
|
]),
|
|
2122
|
-
|
|
2123
|
-
|
|
2337
|
+
on(n),
|
|
2338
|
+
en(
|
|
2124
2339
|
n,
|
|
2125
2340
|
e.pasteHandler || ((o) => o.defaultPasteHandler())
|
|
2126
2341
|
),
|
|
2127
|
-
|
|
2342
|
+
$o(n)
|
|
2128
2343
|
];
|
|
2129
|
-
return
|
|
2344
|
+
return he = !0, t;
|
|
2130
2345
|
}
|
|
2131
|
-
function
|
|
2346
|
+
function yn(n, e) {
|
|
2132
2347
|
const t = [
|
|
2133
2348
|
ye(),
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
ht(e),
|
|
2138
|
-
mt(),
|
|
2349
|
+
mt(e),
|
|
2350
|
+
J(e),
|
|
2351
|
+
Y(e),
|
|
2139
2352
|
kt(e),
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2353
|
+
bt(),
|
|
2354
|
+
gt(e),
|
|
2355
|
+
jt(e),
|
|
2356
|
+
Bt(e),
|
|
2357
|
+
ge(e),
|
|
2358
|
+
...e.trailingBlock !== !1 ? [yt()] : []
|
|
2144
2359
|
];
|
|
2145
|
-
return e.collaboration ? t.push(
|
|
2360
|
+
return e.collaboration ? t.push(gn(e.collaboration)) : t.push(Ct()), "table" in n.schema.blockSpecs && t.push(St(e)), e.animations !== !1 && t.push(xt()), t;
|
|
2146
2361
|
}
|
|
2147
|
-
class
|
|
2362
|
+
class Cn {
|
|
2148
2363
|
constructor(e, t) {
|
|
2149
2364
|
/**
|
|
2150
2365
|
* A set of extension keys which are disabled by the options
|
|
2151
2366
|
*/
|
|
2152
|
-
|
|
2367
|
+
k(this, "disabledExtensions", /* @__PURE__ */ new Set());
|
|
2153
2368
|
/**
|
|
2154
2369
|
* A list of all the extensions that are registered to the editor
|
|
2155
2370
|
*/
|
|
2156
|
-
|
|
2371
|
+
k(this, "extensions", []);
|
|
2157
2372
|
/**
|
|
2158
2373
|
* A map of all the abort controllers for each extension that has an init method defined
|
|
2159
2374
|
*/
|
|
2160
|
-
|
|
2375
|
+
k(this, "abortMap", /* @__PURE__ */ new Map());
|
|
2161
2376
|
/**
|
|
2162
2377
|
* A map of all the extension factories that are registered to the editor
|
|
2163
2378
|
*/
|
|
2164
|
-
|
|
2379
|
+
k(this, "extensionFactories", /* @__PURE__ */ new Map());
|
|
2165
2380
|
/**
|
|
2166
2381
|
* Because a single blocknote extension can both have it's own prosemirror plugins & additional generated ones (e.g. keymap & input rules plugins)
|
|
2167
2382
|
* We need to keep track of all the plugins for each extension, so that we can remove them when the extension is unregistered
|
|
2168
2383
|
*/
|
|
2169
|
-
|
|
2384
|
+
k(this, "extensionPlugins", /* @__PURE__ */ new Map());
|
|
2170
2385
|
this.editor = e, this.options = t, e.onMount(() => {
|
|
2171
2386
|
for (const o of this.extensions)
|
|
2172
2387
|
if (o.mount) {
|
|
@@ -2183,7 +2398,7 @@ class yn {
|
|
|
2183
2398
|
for (const [o, s] of this.abortMap.entries())
|
|
2184
2399
|
this.abortMap.delete(o), s.abort();
|
|
2185
2400
|
}), this.disabledExtensions = new Set(t.disableExtensions || []);
|
|
2186
|
-
for (const o of
|
|
2401
|
+
for (const o of yn(this.editor, this.options))
|
|
2187
2402
|
this.addExtension(o);
|
|
2188
2403
|
for (const o of this.options.extensions ?? [])
|
|
2189
2404
|
this.addExtension(o);
|
|
@@ -2203,20 +2418,20 @@ class yn {
|
|
|
2203
2418
|
console.warn("No extensions found to register", e);
|
|
2204
2419
|
return;
|
|
2205
2420
|
}
|
|
2206
|
-
const o = t.map((
|
|
2207
|
-
for (const
|
|
2208
|
-
|
|
2209
|
-
`Extension ${
|
|
2210
|
-
|
|
2211
|
-
), (r =
|
|
2212
|
-
`Extension ${
|
|
2213
|
-
|
|
2214
|
-
), this.getProsemirrorPluginsFromExtension(
|
|
2215
|
-
(
|
|
2216
|
-
s.add(
|
|
2421
|
+
const o = t.map((i) => this.addExtension(i)).filter(Boolean), s = /* @__PURE__ */ new Set();
|
|
2422
|
+
for (const i of o)
|
|
2423
|
+
i != null && i.tiptapExtensions && console.warn(
|
|
2424
|
+
`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.`,
|
|
2425
|
+
i
|
|
2426
|
+
), (r = i == null ? void 0 : i.inputRules) != null && r.length && console.warn(
|
|
2427
|
+
`Extension ${i.key} has input rules, 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.`,
|
|
2428
|
+
i
|
|
2429
|
+
), this.getProsemirrorPluginsFromExtension(i).plugins.forEach(
|
|
2430
|
+
(l) => {
|
|
2431
|
+
s.add(l);
|
|
2217
2432
|
}
|
|
2218
2433
|
);
|
|
2219
|
-
this.updatePlugins((
|
|
2434
|
+
this.updatePlugins((i) => [...i, ...s]);
|
|
2220
2435
|
}
|
|
2221
2436
|
/**
|
|
2222
2437
|
* Register an extension to the editor
|
|
@@ -2227,7 +2442,7 @@ class yn {
|
|
|
2227
2442
|
let t;
|
|
2228
2443
|
if (typeof e == "function" ? t = e({ editor: this.editor }) : t = e, !(!t || this.disabledExtensions.has(t.key))) {
|
|
2229
2444
|
if (typeof e == "function") {
|
|
2230
|
-
const o = t[
|
|
2445
|
+
const o = t[Ut];
|
|
2231
2446
|
typeof o == "function" && this.extensionFactories.set(o, t);
|
|
2232
2447
|
}
|
|
2233
2448
|
if (this.extensions.push(t), t.blockNoteExtensions)
|
|
@@ -2271,20 +2486,20 @@ class yn {
|
|
|
2271
2486
|
}
|
|
2272
2487
|
let o = !1;
|
|
2273
2488
|
const s = /* @__PURE__ */ new Set();
|
|
2274
|
-
for (const
|
|
2275
|
-
this.extensions = this.extensions.filter((
|
|
2276
|
-
|
|
2277
|
-
}), (r = this.abortMap.get(
|
|
2278
|
-
const
|
|
2279
|
-
|
|
2280
|
-
s.add(
|
|
2281
|
-
}), this.extensionPlugins.delete(
|
|
2282
|
-
`Extension ${
|
|
2489
|
+
for (const i of t) {
|
|
2490
|
+
this.extensions = this.extensions.filter((a) => a !== i), this.extensionFactories.forEach((a, c) => {
|
|
2491
|
+
a === i && this.extensionFactories.delete(c);
|
|
2492
|
+
}), (r = this.abortMap.get(i)) == null || r.abort(), this.abortMap.delete(i);
|
|
2493
|
+
const l = this.extensionPlugins.get(i);
|
|
2494
|
+
l == null || l.forEach((a) => {
|
|
2495
|
+
s.add(a);
|
|
2496
|
+
}), this.extensionPlugins.delete(i), i.tiptapExtensions && !o && (o = !0, console.warn(
|
|
2497
|
+
`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.`,
|
|
2283
2498
|
e
|
|
2284
2499
|
));
|
|
2285
2500
|
}
|
|
2286
2501
|
this.updatePlugins(
|
|
2287
|
-
(
|
|
2502
|
+
(i) => i.filter((l) => !s.has(l))
|
|
2288
2503
|
);
|
|
2289
2504
|
}
|
|
2290
2505
|
/**
|
|
@@ -2303,29 +2518,29 @@ class yn {
|
|
|
2303
2518
|
*/
|
|
2304
2519
|
getTiptapExtensions() {
|
|
2305
2520
|
var s;
|
|
2306
|
-
const e =
|
|
2521
|
+
const e = Bn(
|
|
2307
2522
|
this.editor,
|
|
2308
2523
|
this.options
|
|
2309
|
-
).filter((r) => !this.disabledExtensions.has(r.name)), t =
|
|
2524
|
+
).filter((r) => !this.disabledExtensions.has(r.name)), t = Tt(this.extensions), o = /* @__PURE__ */ new Map();
|
|
2310
2525
|
for (const r of this.extensions) {
|
|
2311
2526
|
r.tiptapExtensions && e.push(...r.tiptapExtensions);
|
|
2312
|
-
const
|
|
2313
|
-
|
|
2314
|
-
|
|
2527
|
+
const i = t(r.key), { plugins: l, inputRules: a } = this.getProsemirrorPluginsFromExtension(r);
|
|
2528
|
+
l.length && e.push(
|
|
2529
|
+
T.create({
|
|
2315
2530
|
name: r.key,
|
|
2316
|
-
priority:
|
|
2317
|
-
addProseMirrorPlugins: () =>
|
|
2531
|
+
priority: i,
|
|
2532
|
+
addProseMirrorPlugins: () => l
|
|
2318
2533
|
})
|
|
2319
|
-
),
|
|
2534
|
+
), a.length && (o.has(i) || o.set(i, []), o.get(i).push(...a));
|
|
2320
2535
|
}
|
|
2321
2536
|
e.push(
|
|
2322
|
-
|
|
2537
|
+
T.create({
|
|
2323
2538
|
name: "blocknote-input-rules",
|
|
2324
2539
|
addProseMirrorPlugins() {
|
|
2325
2540
|
const r = [];
|
|
2326
|
-
return Array.from(o.keys()).sort().reverse().forEach((
|
|
2327
|
-
r.push(...o.get(
|
|
2328
|
-
}), [
|
|
2541
|
+
return Array.from(o.keys()).sort().reverse().forEach((i) => {
|
|
2542
|
+
r.push(...o.get(i));
|
|
2543
|
+
}), [$t({ rules: r })];
|
|
2329
2544
|
}
|
|
2330
2545
|
})
|
|
2331
2546
|
);
|
|
@@ -2340,30 +2555,30 @@ class yn {
|
|
|
2340
2555
|
* - input rules
|
|
2341
2556
|
*/
|
|
2342
2557
|
getProsemirrorPluginsFromExtension(e) {
|
|
2343
|
-
var s, r,
|
|
2558
|
+
var s, r, i;
|
|
2344
2559
|
const t = [...e.prosemirrorPlugins ?? []], o = [];
|
|
2345
|
-
return !((s = e.prosemirrorPlugins) != null && s.length) && !Object.keys(e.keyboardShortcuts || {}).length && !((r = e.inputRules) != null && r.length) ? { plugins: t, inputRules: o } : (this.extensionPlugins.set(e, t), (
|
|
2346
|
-
...e.inputRules.map((
|
|
2347
|
-
const p =
|
|
2348
|
-
match:
|
|
2560
|
+
return !((s = e.prosemirrorPlugins) != null && s.length) && !Object.keys(e.keyboardShortcuts || {}).length && !((r = e.inputRules) != null && r.length) ? { plugins: t, inputRules: o } : (this.extensionPlugins.set(e, t), (i = e.inputRules) != null && i.length && o.push(
|
|
2561
|
+
...e.inputRules.map((l) => new Ht(l.find, (a, c, d, u) => {
|
|
2562
|
+
const p = l.replace({
|
|
2563
|
+
match: c,
|
|
2349
2564
|
range: { from: d, to: u },
|
|
2350
2565
|
editor: this.editor
|
|
2351
2566
|
});
|
|
2352
2567
|
if (p) {
|
|
2353
|
-
const
|
|
2354
|
-
if (this.editor.schema.blockSchema[
|
|
2568
|
+
const h = this.editor.getTextCursorPosition();
|
|
2569
|
+
if (this.editor.schema.blockSchema[h.block.type].content !== "inline")
|
|
2355
2570
|
return null;
|
|
2356
|
-
const f =
|
|
2357
|
-
return
|
|
2571
|
+
const f = z(a.tr), m = a.tr.deleteRange(d, u);
|
|
2572
|
+
return rt(m, f.bnBlock.beforePos, p), m;
|
|
2358
2573
|
}
|
|
2359
2574
|
return null;
|
|
2360
2575
|
}))
|
|
2361
2576
|
), Object.keys(e.keyboardShortcuts || {}).length && t.push(
|
|
2362
2577
|
Ft(
|
|
2363
2578
|
Object.fromEntries(
|
|
2364
|
-
Object.entries(e.keyboardShortcuts).map(([
|
|
2365
|
-
|
|
2366
|
-
() =>
|
|
2579
|
+
Object.entries(e.keyboardShortcuts).map(([l, a]) => [
|
|
2580
|
+
l,
|
|
2581
|
+
() => a({ editor: this.editor })
|
|
2367
2582
|
])
|
|
2368
2583
|
)
|
|
2369
2584
|
)
|
|
@@ -2399,47 +2614,47 @@ function Sn(n, e) {
|
|
|
2399
2614
|
if (t.pos > t.start() && t.pos < n.content.size) {
|
|
2400
2615
|
const s = n.textBetween(t.pos, t.pos + 1);
|
|
2401
2616
|
if (/^[\w\p{P}]$/u.test(s)) {
|
|
2402
|
-
const
|
|
2403
|
-
|
|
2617
|
+
const i = n.textBetween(t.start(), t.pos).match(/[\w\p{P}]+$/u);
|
|
2618
|
+
i && (t = n.resolve(t.pos - i[0].length));
|
|
2404
2619
|
}
|
|
2405
2620
|
}
|
|
2406
2621
|
if (o.pos < o.end() && o.pos > 0) {
|
|
2407
2622
|
const s = n.textBetween(o.pos - 1, o.pos);
|
|
2408
2623
|
if (/^[\w\p{P}]$/u.test(s)) {
|
|
2409
|
-
const
|
|
2410
|
-
|
|
2624
|
+
const i = n.textBetween(o.pos, o.end()).match(/^[\w\p{P}]+/u);
|
|
2625
|
+
i && (o = n.resolve(o.pos + i[0].length));
|
|
2411
2626
|
}
|
|
2412
2627
|
}
|
|
2413
2628
|
return { $from: t, $to: o, from: t.pos, to: o.pos };
|
|
2414
2629
|
}
|
|
2415
|
-
function
|
|
2416
|
-
const e =
|
|
2630
|
+
function xn(n) {
|
|
2631
|
+
const e = E(n);
|
|
2417
2632
|
if (n.selection.empty || "node" in n.selection)
|
|
2418
2633
|
return;
|
|
2419
2634
|
const t = n.doc.resolve(
|
|
2420
|
-
|
|
2635
|
+
D(n.doc, n.selection.from).posBeforeNode
|
|
2421
2636
|
), o = n.doc.resolve(
|
|
2422
|
-
|
|
2423
|
-
), s = (
|
|
2424
|
-
const u = t.posAtIndex(
|
|
2637
|
+
D(n.doc, n.selection.to).posBeforeNode
|
|
2638
|
+
), s = (c, d) => {
|
|
2639
|
+
const u = t.posAtIndex(c, d), p = n.doc.resolve(u).nodeAfter;
|
|
2425
2640
|
if (!p)
|
|
2426
2641
|
throw new Error(
|
|
2427
2642
|
`Error getting selection - node not found at position ${u}`
|
|
2428
2643
|
);
|
|
2429
|
-
return
|
|
2430
|
-
}, r = [],
|
|
2431
|
-
if (t.depth >
|
|
2432
|
-
r.push(
|
|
2433
|
-
for (let
|
|
2434
|
-
if (t.node(
|
|
2435
|
-
const u = t.index(
|
|
2436
|
-
for (let
|
|
2437
|
-
r.push(s(
|
|
2644
|
+
return C(p, e);
|
|
2645
|
+
}, r = [], i = t.sharedDepth(o.pos), l = t.index(i), a = o.index(i);
|
|
2646
|
+
if (t.depth > i) {
|
|
2647
|
+
r.push(C(t.nodeAfter, e));
|
|
2648
|
+
for (let c = t.depth; c > i; c--)
|
|
2649
|
+
if (t.node(c).type.isInGroup("childContainer")) {
|
|
2650
|
+
const u = t.index(c) + 1, p = t.node(c).childCount;
|
|
2651
|
+
for (let h = u; h < p; h++)
|
|
2652
|
+
r.push(s(h, c));
|
|
2438
2653
|
}
|
|
2439
2654
|
} else
|
|
2440
|
-
r.push(s(
|
|
2441
|
-
for (let
|
|
2442
|
-
r.push(s(
|
|
2655
|
+
r.push(s(l, i));
|
|
2656
|
+
for (let c = l + 1; c <= a; c++)
|
|
2657
|
+
r.push(s(c, i));
|
|
2443
2658
|
if (r.length === 0)
|
|
2444
2659
|
throw new Error(
|
|
2445
2660
|
`Error getting selection - selection doesn't span any blocks (${n.selection})`
|
|
@@ -2448,20 +2663,20 @@ function Bn(n) {
|
|
|
2448
2663
|
blocks: r
|
|
2449
2664
|
};
|
|
2450
2665
|
}
|
|
2451
|
-
function
|
|
2452
|
-
const o = typeof e == "string" ? e : e.id, s = typeof t == "string" ? t : t.id, r =
|
|
2666
|
+
function En(n, e, t) {
|
|
2667
|
+
const o = typeof e == "string" ? e : e.id, s = typeof t == "string" ? t : t.id, r = E(n), i = be(r);
|
|
2453
2668
|
if (o === s)
|
|
2454
2669
|
throw new Error(
|
|
2455
2670
|
`Attempting to set selection with the same anchor and head blocks (id ${o})`
|
|
2456
2671
|
);
|
|
2457
|
-
const
|
|
2458
|
-
if (!
|
|
2672
|
+
const l = P(o, n.doc);
|
|
2673
|
+
if (!l)
|
|
2459
2674
|
throw new Error(`Block with ID ${o} not found`);
|
|
2460
|
-
const
|
|
2461
|
-
if (!
|
|
2675
|
+
const a = P(s, n.doc);
|
|
2676
|
+
if (!a)
|
|
2462
2677
|
throw new Error(`Block with ID ${s} not found`);
|
|
2463
|
-
const
|
|
2464
|
-
if (!
|
|
2678
|
+
const c = K(l), d = K(a), u = i.blockSchema[c.blockNoteType], p = i.blockSchema[d.blockNoteType];
|
|
2679
|
+
if (!c.isBlockContainer || u.content === "none")
|
|
2465
2680
|
throw new Error(
|
|
2466
2681
|
`Attempting to set selection anchor in block without content (id ${o})`
|
|
2467
2682
|
);
|
|
@@ -2469,25 +2684,25 @@ function Cn(n, e, t) {
|
|
|
2469
2684
|
throw new Error(
|
|
2470
2685
|
`Attempting to set selection anchor in block without content (id ${s})`
|
|
2471
2686
|
);
|
|
2472
|
-
let
|
|
2687
|
+
let h, f;
|
|
2473
2688
|
if (u.content === "table") {
|
|
2474
|
-
const
|
|
2475
|
-
|
|
2689
|
+
const m = re.get(c.blockContent.node);
|
|
2690
|
+
h = c.blockContent.beforePos + m.positionAt(0, 0, c.blockContent.node) + 1 + 2;
|
|
2476
2691
|
} else
|
|
2477
|
-
|
|
2692
|
+
h = c.blockContent.beforePos + 1;
|
|
2478
2693
|
if (p.content === "table") {
|
|
2479
|
-
const
|
|
2480
|
-
|
|
2481
|
-
|
|
2694
|
+
const m = re.get(d.blockContent.node), b = d.blockContent.beforePos + m.positionAt(
|
|
2695
|
+
m.height - 1,
|
|
2696
|
+
m.width - 1,
|
|
2482
2697
|
d.blockContent.node
|
|
2483
2698
|
) + 1, g = n.doc.resolve(b).nodeAfter.nodeSize;
|
|
2484
2699
|
f = b + g - 2;
|
|
2485
2700
|
} else
|
|
2486
2701
|
f = d.blockContent.afterPos - 1;
|
|
2487
|
-
n.setSelection(
|
|
2702
|
+
n.setSelection(S.create(n.doc, h, f));
|
|
2488
2703
|
}
|
|
2489
|
-
function
|
|
2490
|
-
const t =
|
|
2704
|
+
function Pn(n, e = !1) {
|
|
2705
|
+
const t = E(n), o = e ? Sn(n.doc, n.selection) : n.selection;
|
|
2491
2706
|
let s = o.$from, r = o.$to;
|
|
2492
2707
|
for (; r.parentOffset >= r.parent.nodeSize - 2 && r.depth > 0; )
|
|
2493
2708
|
r = n.doc.resolve(r.pos + 1);
|
|
@@ -2497,7 +2712,7 @@ function En(n, e = !1) {
|
|
|
2497
2712
|
s = n.doc.resolve(s.pos - 1);
|
|
2498
2713
|
for (; s.parentOffset >= s.parent.nodeSize - 2 && s.depth > 0; )
|
|
2499
2714
|
s = n.doc.resolve(s.pos + 1);
|
|
2500
|
-
const
|
|
2715
|
+
const i = Ke(
|
|
2501
2716
|
n.doc.slice(s.pos, r.pos, !0),
|
|
2502
2717
|
t
|
|
2503
2718
|
);
|
|
@@ -2506,47 +2721,47 @@ function En(n, e = !1) {
|
|
|
2506
2721
|
startPos: s.pos,
|
|
2507
2722
|
endPos: r.pos
|
|
2508
2723
|
},
|
|
2509
|
-
...
|
|
2724
|
+
...i
|
|
2510
2725
|
};
|
|
2511
2726
|
}
|
|
2512
|
-
function
|
|
2513
|
-
const { bnBlock: e } =
|
|
2514
|
-
let
|
|
2515
|
-
return o.depth > 1 && (
|
|
2516
|
-
block:
|
|
2517
|
-
prevBlock: s === null ? void 0 :
|
|
2518
|
-
nextBlock: r === null ? void 0 :
|
|
2519
|
-
parentBlock:
|
|
2727
|
+
function Tn(n) {
|
|
2728
|
+
const { bnBlock: e } = z(n), t = E(n.doc), o = n.doc.resolve(e.beforePos), s = o.nodeBefore, r = n.doc.resolve(e.afterPos).nodeAfter;
|
|
2729
|
+
let i;
|
|
2730
|
+
return o.depth > 1 && (i = o.node(), i.type.isInGroup("bnBlock") || (i = o.node(o.depth - 1))), {
|
|
2731
|
+
block: C(e.node, t),
|
|
2732
|
+
prevBlock: s === null ? void 0 : C(s, t),
|
|
2733
|
+
nextBlock: r === null ? void 0 : C(r, t),
|
|
2734
|
+
parentBlock: i === void 0 ? void 0 : C(i, t)
|
|
2520
2735
|
};
|
|
2521
2736
|
}
|
|
2522
2737
|
function De(n, e, t = "start") {
|
|
2523
|
-
const o = typeof e == "string" ? e : e.id, s =
|
|
2524
|
-
if (!
|
|
2738
|
+
const o = typeof e == "string" ? e : e.id, s = E(n.doc), r = be(s), i = P(o, n.doc);
|
|
2739
|
+
if (!i)
|
|
2525
2740
|
throw new Error(`Block with ID ${o} not found`);
|
|
2526
|
-
const
|
|
2527
|
-
if (
|
|
2528
|
-
const
|
|
2529
|
-
if (
|
|
2530
|
-
n.setSelection(
|
|
2741
|
+
const l = K(i), a = r.blockSchema[l.blockNoteType].content;
|
|
2742
|
+
if (l.isBlockContainer) {
|
|
2743
|
+
const c = l.blockContent;
|
|
2744
|
+
if (a === "none") {
|
|
2745
|
+
n.setSelection($.create(n.doc, c.beforePos));
|
|
2531
2746
|
return;
|
|
2532
2747
|
}
|
|
2533
|
-
if (
|
|
2748
|
+
if (a === "inline")
|
|
2534
2749
|
t === "start" ? n.setSelection(
|
|
2535
|
-
|
|
2750
|
+
S.create(n.doc, c.beforePos + 1)
|
|
2536
2751
|
) : n.setSelection(
|
|
2537
|
-
|
|
2752
|
+
S.create(n.doc, c.afterPos - 1)
|
|
2538
2753
|
);
|
|
2539
|
-
else if (
|
|
2754
|
+
else if (a === "table")
|
|
2540
2755
|
t === "start" ? n.setSelection(
|
|
2541
|
-
|
|
2756
|
+
S.create(n.doc, c.beforePos + 4)
|
|
2542
2757
|
) : n.setSelection(
|
|
2543
|
-
|
|
2758
|
+
S.create(n.doc, c.afterPos - 4)
|
|
2544
2759
|
);
|
|
2545
2760
|
else
|
|
2546
|
-
throw new
|
|
2761
|
+
throw new U(a);
|
|
2547
2762
|
} else {
|
|
2548
|
-
const
|
|
2549
|
-
De(n,
|
|
2763
|
+
const c = t === "start" ? l.childContainer.node.firstChild : l.childContainer.node.lastChild;
|
|
2764
|
+
De(n, c.attrs.id, t);
|
|
2550
2765
|
}
|
|
2551
2766
|
}
|
|
2552
2767
|
class Mn {
|
|
@@ -2560,7 +2775,7 @@ class Mn {
|
|
|
2560
2775
|
* If the selection starts / ends halfway through a block, the returned data will contain the entire block.
|
|
2561
2776
|
*/
|
|
2562
2777
|
getSelection() {
|
|
2563
|
-
return this.editor.transact((e) =>
|
|
2778
|
+
return this.editor.transact((e) => xn(e));
|
|
2564
2779
|
}
|
|
2565
2780
|
/**
|
|
2566
2781
|
* Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
|
|
@@ -2570,7 +2785,7 @@ class Mn {
|
|
|
2570
2785
|
* only the part of the block that is included in the selection.
|
|
2571
2786
|
*/
|
|
2572
2787
|
getSelectionCutBlocks(e = !1) {
|
|
2573
|
-
return this.editor.transact((t) =>
|
|
2788
|
+
return this.editor.transact((t) => Pn(t, e));
|
|
2574
2789
|
}
|
|
2575
2790
|
/**
|
|
2576
2791
|
* Sets the selection to a range of blocks.
|
|
@@ -2578,14 +2793,14 @@ class Mn {
|
|
|
2578
2793
|
* @param endBlock The identifier of the block that should be the end of the selection.
|
|
2579
2794
|
*/
|
|
2580
2795
|
setSelection(e, t) {
|
|
2581
|
-
return this.editor.transact((o) =>
|
|
2796
|
+
return this.editor.transact((o) => En(o, e, t));
|
|
2582
2797
|
}
|
|
2583
2798
|
/**
|
|
2584
2799
|
* Gets a snapshot of the current text cursor position.
|
|
2585
2800
|
* @returns A snapshot of the current text cursor position.
|
|
2586
2801
|
*/
|
|
2587
2802
|
getTextCursorPosition() {
|
|
2588
|
-
return this.editor.transact((e) =>
|
|
2803
|
+
return this.editor.transact((e) => Tn(e));
|
|
2589
2804
|
}
|
|
2590
2805
|
/**
|
|
2591
2806
|
* Sets the text cursor position to the start or end of an existing block. Throws an error if the target block could
|
|
@@ -2605,12 +2820,12 @@ class Mn {
|
|
|
2605
2820
|
if (!this.editor.prosemirrorView)
|
|
2606
2821
|
return;
|
|
2607
2822
|
const { selection: e } = this.editor.prosemirrorState, { ranges: t } = e, o = Math.min(...t.map((r) => r.$from.pos)), s = Math.max(...t.map((r) => r.$to.pos));
|
|
2608
|
-
if (
|
|
2823
|
+
if (vt(e)) {
|
|
2609
2824
|
const r = this.editor.prosemirrorView.nodeDOM(o);
|
|
2610
2825
|
if (r)
|
|
2611
2826
|
return r.getBoundingClientRect();
|
|
2612
2827
|
}
|
|
2613
|
-
return
|
|
2828
|
+
return It(
|
|
2614
2829
|
this.editor.prosemirrorView,
|
|
2615
2830
|
o,
|
|
2616
2831
|
s
|
|
@@ -2622,9 +2837,9 @@ class wn {
|
|
|
2622
2837
|
/**
|
|
2623
2838
|
* Stores the currently active transaction, which is the accumulated transaction from all {@link dispatch} calls during a {@link transact} calls
|
|
2624
2839
|
*/
|
|
2625
|
-
|
|
2840
|
+
k(this, "activeTransaction", null);
|
|
2626
2841
|
// Flag to indicate if we're in a `can` call
|
|
2627
|
-
|
|
2842
|
+
k(this, "isInCan", !1);
|
|
2628
2843
|
this.editor = e;
|
|
2629
2844
|
}
|
|
2630
2845
|
/**
|
|
@@ -2793,17 +3008,17 @@ class wn {
|
|
|
2793
3008
|
throw new Error("No redo plugin found");
|
|
2794
3009
|
}
|
|
2795
3010
|
}
|
|
2796
|
-
function
|
|
2797
|
-
let { from: s, to: r } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to },
|
|
2798
|
-
if (t.forEach((
|
|
2799
|
-
|
|
2800
|
-
}), s === r &&
|
|
2801
|
-
const { parent:
|
|
2802
|
-
|
|
2803
|
-
}
|
|
2804
|
-
return
|
|
3011
|
+
function vn(n, e, t, o = { updateSelection: !0 }) {
|
|
3012
|
+
let { from: s, to: r } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, i = !0, l = !0, a = "";
|
|
3013
|
+
if (t.forEach((c) => {
|
|
3014
|
+
c.check(), i && c.isText && c.marks.length === 0 ? a += c.text : i = !1, l = l ? c.isBlock : !1;
|
|
3015
|
+
}), s === r && l) {
|
|
3016
|
+
const { parent: c } = n.doc.resolve(s);
|
|
3017
|
+
c.isTextblock && !c.type.spec.code && !c.childCount && (s -= 1, r += 1);
|
|
3018
|
+
}
|
|
3019
|
+
return i ? n.insertText(a, s, r) : n.replaceWith(s, r, t), o.updateSelection && At(n, n.steps.length - 1, -1), !0;
|
|
2805
3020
|
}
|
|
2806
|
-
class
|
|
3021
|
+
class In {
|
|
2807
3022
|
constructor(e) {
|
|
2808
3023
|
this.editor = e;
|
|
2809
3024
|
}
|
|
@@ -2813,9 +3028,9 @@ class Pn {
|
|
|
2813
3028
|
* @param content can be a string, or array of partial inline content elements
|
|
2814
3029
|
*/
|
|
2815
3030
|
insertInlineContent(e, { updateSelection: t = !1 } = {}) {
|
|
2816
|
-
const o =
|
|
3031
|
+
const o = V(e, this.editor.pmSchema);
|
|
2817
3032
|
this.editor.transact((s) => {
|
|
2818
|
-
|
|
3033
|
+
vn(
|
|
2819
3034
|
s,
|
|
2820
3035
|
{
|
|
2821
3036
|
from: s.selection.from,
|
|
@@ -2863,7 +3078,7 @@ class Pn {
|
|
|
2863
3078
|
stringValue: o
|
|
2864
3079
|
});
|
|
2865
3080
|
else
|
|
2866
|
-
throw new
|
|
3081
|
+
throw new U(s.propSchema);
|
|
2867
3082
|
}
|
|
2868
3083
|
}
|
|
2869
3084
|
/**
|
|
@@ -2890,7 +3105,7 @@ class Pn {
|
|
|
2890
3105
|
stringValue: o
|
|
2891
3106
|
});
|
|
2892
3107
|
else
|
|
2893
|
-
throw new
|
|
3108
|
+
throw new U(s.propSchema);
|
|
2894
3109
|
}
|
|
2895
3110
|
}
|
|
2896
3111
|
/**
|
|
@@ -2915,35 +3130,35 @@ class Pn {
|
|
|
2915
3130
|
return;
|
|
2916
3131
|
const o = this.editor.pmSchema.mark("link", { href: e });
|
|
2917
3132
|
this.editor.transact((s) => {
|
|
2918
|
-
const { from: r, to:
|
|
2919
|
-
t ? s.insertText(t, r,
|
|
3133
|
+
const { from: r, to: i } = s.selection;
|
|
3134
|
+
t ? s.insertText(t, r, i).addMark(r, r + t.length, o) : s.setSelection(Qt.create(s.doc, i)).addMark(
|
|
2920
3135
|
r,
|
|
2921
|
-
|
|
3136
|
+
i,
|
|
2922
3137
|
o
|
|
2923
3138
|
);
|
|
2924
3139
|
});
|
|
2925
3140
|
}
|
|
2926
3141
|
}
|
|
2927
|
-
function
|
|
2928
|
-
return
|
|
3142
|
+
function An(n) {
|
|
3143
|
+
return Nt(n.state.selection.$from, (e) => e.type.name === "tableCell" || e.type.name === "tableHeader") !== void 0;
|
|
2929
3144
|
}
|
|
2930
|
-
function
|
|
3145
|
+
function Oe(n, e) {
|
|
2931
3146
|
var s;
|
|
2932
3147
|
const t = e.nodes.hardBreak;
|
|
2933
|
-
let o =
|
|
3148
|
+
let o = R.empty;
|
|
2934
3149
|
return n.forEach((r) => {
|
|
2935
3150
|
r.isTextblock && r.childCount > 0 ? (o = o.append(r.content), o = o.addToEnd(t.create())) : r.isText ? o = o.addToEnd(r) : r.isBlock && r.childCount > 0 && (o = o.append(
|
|
2936
|
-
|
|
3151
|
+
Oe(r.content, e)
|
|
2937
3152
|
), o = o.addToEnd(t.create()));
|
|
2938
3153
|
}), ((s = o.lastChild) == null ? void 0 : s.type) === t && (o = o.cut(0, o.size - 1)), o;
|
|
2939
3154
|
}
|
|
2940
|
-
function
|
|
3155
|
+
function Nn(n, e) {
|
|
2941
3156
|
const t = [];
|
|
2942
3157
|
return n.forEach((o, s, r) => {
|
|
2943
3158
|
r !== e && t.push(o);
|
|
2944
|
-
}),
|
|
3159
|
+
}), R.from(t);
|
|
2945
3160
|
}
|
|
2946
|
-
function
|
|
3161
|
+
function _n(n, e) {
|
|
2947
3162
|
const t = [];
|
|
2948
3163
|
for (let o = 0; o < n.childCount; o++)
|
|
2949
3164
|
if (n.child(o).type.name === "tableRow")
|
|
@@ -2959,30 +3174,30 @@ function An(n, e) {
|
|
|
2959
3174
|
}
|
|
2960
3175
|
else
|
|
2961
3176
|
t.push(n.child(o));
|
|
2962
|
-
return n =
|
|
3177
|
+
return n = R.from(t), n;
|
|
2963
3178
|
}
|
|
2964
|
-
function
|
|
2965
|
-
let t =
|
|
2966
|
-
if (t =
|
|
3179
|
+
function Ln(n, e) {
|
|
3180
|
+
let t = R.from(n.content);
|
|
3181
|
+
if (t = _n(t, e.state.schema), An(e)) {
|
|
2967
3182
|
let o = !1;
|
|
2968
3183
|
if (t.descendants((s) => {
|
|
2969
3184
|
s.type.isInGroup("tableContent") && (o = !0);
|
|
2970
3185
|
}), !o && // is the content valid for a table paragraph?
|
|
2971
3186
|
!e.state.schema.nodes.tableParagraph.validContent(t))
|
|
2972
|
-
return new
|
|
2973
|
-
|
|
3187
|
+
return new j(
|
|
3188
|
+
Oe(t, e.state.schema),
|
|
2974
3189
|
0,
|
|
2975
3190
|
0
|
|
2976
3191
|
);
|
|
2977
3192
|
}
|
|
2978
3193
|
if (!Dn(t, e))
|
|
2979
|
-
return new
|
|
3194
|
+
return new j(t, n.openStart, n.openEnd);
|
|
2980
3195
|
for (let o = 0; o < t.childCount; o++)
|
|
2981
3196
|
if (t.child(o).type.spec.group === "blockContent") {
|
|
2982
3197
|
const s = [t.child(o)];
|
|
2983
3198
|
if (o + 1 < t.childCount && t.child(o + 1).type.name === "blockGroup") {
|
|
2984
|
-
const
|
|
2985
|
-
(
|
|
3199
|
+
const i = t.child(o + 1).child(0).child(0);
|
|
3200
|
+
(i.type.name === "bulletListItem" || i.type.name === "numberedListItem" || i.type.name === "checkListItem") && (s.push(t.child(o + 1)), t = Nn(t, o + 1));
|
|
2986
3201
|
}
|
|
2987
3202
|
const r = e.state.schema.nodes.blockContainer.createChecked(
|
|
2988
3203
|
void 0,
|
|
@@ -2990,58 +3205,58 @@ function _n(n, e) {
|
|
|
2990
3205
|
);
|
|
2991
3206
|
t = t.replaceChild(o, r);
|
|
2992
3207
|
}
|
|
2993
|
-
return new
|
|
3208
|
+
return new j(t, n.openStart, n.openEnd);
|
|
2994
3209
|
}
|
|
2995
3210
|
function Dn(n, e) {
|
|
2996
|
-
var r,
|
|
2997
|
-
const t = n.childCount === 1, o = ((r = n.firstChild) == null ? void 0 : r.type.spec.content) === "inline*", s = ((
|
|
3211
|
+
var r, i;
|
|
3212
|
+
const t = n.childCount === 1, o = ((r = n.firstChild) == null ? void 0 : r.type.spec.content) === "inline*", s = ((i = n.firstChild) == null ? void 0 : i.type.spec.content) === "tableRow+";
|
|
2998
3213
|
if (t) {
|
|
2999
3214
|
if (o)
|
|
3000
3215
|
return !1;
|
|
3001
3216
|
if (s) {
|
|
3002
|
-
const
|
|
3003
|
-
if (
|
|
3004
|
-
return !(
|
|
3217
|
+
const l = B(e.state);
|
|
3218
|
+
if (l.isBlockContainer)
|
|
3219
|
+
return !(l.blockContent.node.type.spec.content === "tableRow+");
|
|
3005
3220
|
}
|
|
3006
3221
|
}
|
|
3007
3222
|
return !0;
|
|
3008
3223
|
}
|
|
3009
|
-
const
|
|
3224
|
+
const On = {
|
|
3010
3225
|
enableInputRules: !0,
|
|
3011
3226
|
enablePasteRules: !0,
|
|
3012
3227
|
enableCoreExtensions: !1
|
|
3013
3228
|
};
|
|
3014
|
-
class
|
|
3229
|
+
class $e extends Ce {
|
|
3015
3230
|
constructor(t) {
|
|
3016
|
-
var
|
|
3231
|
+
var c, d, u, p, h, f, m, b, g, x;
|
|
3017
3232
|
super();
|
|
3018
3233
|
/**
|
|
3019
3234
|
* The underlying prosemirror schema
|
|
3020
3235
|
*/
|
|
3021
|
-
|
|
3022
|
-
|
|
3236
|
+
k(this, "pmSchema");
|
|
3237
|
+
k(this, "_tiptapEditor");
|
|
3023
3238
|
/**
|
|
3024
3239
|
* Used by React to store a reference to an `ElementRenderer` helper utility to make sure we can render React elements
|
|
3025
3240
|
* in the correct context (used by `ReactRenderUtil`)
|
|
3026
3241
|
*/
|
|
3027
|
-
|
|
3242
|
+
k(this, "elementRenderer", null);
|
|
3028
3243
|
/**
|
|
3029
3244
|
* Cache of all blocks. This makes sure we don't have to "recompute" blocks if underlying Prosemirror Nodes haven't changed.
|
|
3030
3245
|
* This is especially useful when we want to keep track of the same block across multiple operations,
|
|
3031
3246
|
* with this cache, blocks stay the same object reference (referential equality with ===).
|
|
3032
3247
|
*/
|
|
3033
|
-
|
|
3248
|
+
k(this, "blockCache", /* @__PURE__ */ new WeakMap());
|
|
3034
3249
|
/**
|
|
3035
3250
|
* The dictionary contains translations for the editor.
|
|
3036
3251
|
*/
|
|
3037
|
-
|
|
3252
|
+
k(this, "dictionary");
|
|
3038
3253
|
/**
|
|
3039
3254
|
* The schema of the editor. The schema defines which Blocks, InlineContent, and Styles are available in the editor.
|
|
3040
3255
|
*/
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3256
|
+
k(this, "schema");
|
|
3257
|
+
k(this, "blockImplementations");
|
|
3258
|
+
k(this, "inlineContentImplementations");
|
|
3259
|
+
k(this, "styleImplementations");
|
|
3045
3260
|
/**
|
|
3046
3261
|
* The `uploadFile` method is what the editor uses when files need to be uploaded (for example when selecting an image to upload).
|
|
3047
3262
|
* This method should set when creating the editor as this is application-specific.
|
|
@@ -3051,51 +3266,51 @@ class Ne extends Se {
|
|
|
3051
3266
|
* @param file The file that should be uploaded.
|
|
3052
3267
|
* @returns The URL of the uploaded file OR an object containing props that should be set on the file block (such as an id)
|
|
3053
3268
|
*/
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3269
|
+
k(this, "uploadFile");
|
|
3270
|
+
k(this, "onUploadStartCallbacks", []);
|
|
3271
|
+
k(this, "onUploadEndCallbacks", []);
|
|
3272
|
+
k(this, "resolveFileUrl");
|
|
3058
3273
|
/**
|
|
3059
3274
|
* Editor settings
|
|
3060
3275
|
*/
|
|
3061
|
-
|
|
3276
|
+
k(this, "settings");
|
|
3062
3277
|
// Manager instances
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3278
|
+
k(this, "_blockManager");
|
|
3279
|
+
k(this, "_eventManager");
|
|
3280
|
+
k(this, "_exportManager");
|
|
3281
|
+
k(this, "_extensionManager");
|
|
3282
|
+
k(this, "_selectionManager");
|
|
3283
|
+
k(this, "_stateManager");
|
|
3284
|
+
k(this, "_styleManager");
|
|
3070
3285
|
/**
|
|
3071
3286
|
* Remove extension(s) from the editor
|
|
3072
3287
|
*/
|
|
3073
|
-
|
|
3288
|
+
k(this, "unregisterExtension", (...t) => this._extensionManager.unregisterExtension(...t));
|
|
3074
3289
|
/**
|
|
3075
3290
|
* Register extension(s) to the editor
|
|
3076
3291
|
*/
|
|
3077
|
-
|
|
3292
|
+
k(this, "registerExtension", (...t) => this._extensionManager.registerExtension(...t));
|
|
3078
3293
|
/**
|
|
3079
3294
|
* Get an extension from the editor
|
|
3080
3295
|
*/
|
|
3081
|
-
|
|
3296
|
+
k(this, "getExtension", (...t) => this._extensionManager.getExtension(...t));
|
|
3082
3297
|
/**
|
|
3083
3298
|
* Mount the editor to a DOM element.
|
|
3084
3299
|
*
|
|
3085
3300
|
* @warning Not needed to call manually when using React, use BlockNoteView to take care of mounting
|
|
3086
3301
|
*/
|
|
3087
|
-
|
|
3302
|
+
k(this, "mount", (t) => {
|
|
3088
3303
|
this._tiptapEditor.mount({ mount: t });
|
|
3089
3304
|
});
|
|
3090
3305
|
/**
|
|
3091
3306
|
* Unmount the editor from the DOM element it is bound to
|
|
3092
3307
|
*/
|
|
3093
|
-
|
|
3308
|
+
k(this, "unmount", () => {
|
|
3094
3309
|
this._tiptapEditor.unmount();
|
|
3095
3310
|
});
|
|
3096
|
-
this.options = t, this.dictionary = t.dictionary ||
|
|
3311
|
+
this.options = t, this.dictionary = t.dictionary || Ot, this.settings = {
|
|
3097
3312
|
tables: {
|
|
3098
|
-
splitCells: ((
|
|
3313
|
+
splitCells: ((c = t == null ? void 0 : t.tables) == null ? void 0 : c.splitCells) ?? !1,
|
|
3099
3314
|
cellBackgroundColor: ((d = t == null ? void 0 : t.tables) == null ? void 0 : d.cellBackgroundColor) ?? !1,
|
|
3100
3315
|
cellTextColor: ((u = t == null ? void 0 : t.tables) == null ? void 0 : u.cellTextColor) ?? !1,
|
|
3101
3316
|
headers: ((p = t == null ? void 0 : t.tables) == null ? void 0 : p.headers) ?? !1
|
|
@@ -3112,46 +3327,46 @@ class Ne extends Se {
|
|
|
3112
3327
|
};
|
|
3113
3328
|
if (this.schema = o.schema, this.blockImplementations = o.schema.blockSpecs, this.inlineContentImplementations = o.schema.inlineContentSpecs, this.styleImplementations = o.schema.styleSpecs, o.uploadFile) {
|
|
3114
3329
|
const y = o.uploadFile;
|
|
3115
|
-
this.uploadFile = async (
|
|
3330
|
+
this.uploadFile = async (I, M) => {
|
|
3116
3331
|
this.onUploadStartCallbacks.forEach(
|
|
3117
|
-
(
|
|
3332
|
+
(A) => A.apply(this, [M])
|
|
3118
3333
|
);
|
|
3119
3334
|
try {
|
|
3120
|
-
return await y(
|
|
3335
|
+
return await y(I, M);
|
|
3121
3336
|
} finally {
|
|
3122
3337
|
this.onUploadEndCallbacks.forEach(
|
|
3123
|
-
(
|
|
3338
|
+
(A) => A.apply(this, [M])
|
|
3124
3339
|
);
|
|
3125
3340
|
}
|
|
3126
3341
|
};
|
|
3127
3342
|
}
|
|
3128
|
-
this.resolveFileUrl = o.resolveFileUrl, this._eventManager = new
|
|
3343
|
+
this.resolveFileUrl = o.resolveFileUrl, this._eventManager = new Eo(this), this._extensionManager = new Cn(this, o);
|
|
3129
3344
|
const s = this._extensionManager.getTiptapExtensions(), r = this._extensionManager.hasExtension("ySync") || this._extensionManager.hasExtension("liveblocksExtension");
|
|
3130
3345
|
r && o.initialContent && console.warn(
|
|
3131
3346
|
"When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"
|
|
3132
3347
|
);
|
|
3133
|
-
const
|
|
3134
|
-
...
|
|
3348
|
+
const i = {
|
|
3349
|
+
...On,
|
|
3135
3350
|
...o._tiptapOptions,
|
|
3136
3351
|
element: null,
|
|
3137
3352
|
autofocus: o.autofocus ?? !1,
|
|
3138
3353
|
extensions: s,
|
|
3139
3354
|
editorProps: {
|
|
3140
|
-
...(
|
|
3355
|
+
...(h = o._tiptapOptions) == null ? void 0 : h.editorProps,
|
|
3141
3356
|
attributes: {
|
|
3142
3357
|
// As of TipTap v2.5.0 the tabIndex is removed when the editor is not
|
|
3143
3358
|
// editable, so you can't focus it. We want to revert this as we have
|
|
3144
3359
|
// UI behaviour that relies on it.
|
|
3145
3360
|
tabIndex: "0",
|
|
3146
|
-
...(
|
|
3361
|
+
...(m = (f = o._tiptapOptions) == null ? void 0 : f.editorProps) == null ? void 0 : m.attributes,
|
|
3147
3362
|
...(b = o.domAttributes) == null ? void 0 : b.editor,
|
|
3148
|
-
class:
|
|
3363
|
+
class: ee(
|
|
3149
3364
|
"bn-editor",
|
|
3150
3365
|
o.defaultStyles ? "bn-default-styles" : "",
|
|
3151
|
-
((
|
|
3366
|
+
((x = (g = o.domAttributes) == null ? void 0 : g.editor) == null ? void 0 : x.class) || ""
|
|
3152
3367
|
)
|
|
3153
3368
|
},
|
|
3154
|
-
transformPasted:
|
|
3369
|
+
transformPasted: Ln
|
|
3155
3370
|
}
|
|
3156
3371
|
};
|
|
3157
3372
|
try {
|
|
@@ -3163,31 +3378,31 @@ class Ne extends Se {
|
|
|
3163
3378
|
] : [
|
|
3164
3379
|
{
|
|
3165
3380
|
type: "paragraph",
|
|
3166
|
-
id:
|
|
3381
|
+
id: ke.options.generateID()
|
|
3167
3382
|
}
|
|
3168
3383
|
]);
|
|
3169
3384
|
if (!Array.isArray(y) || y.length === 0)
|
|
3170
3385
|
throw new Error(
|
|
3171
3386
|
"initialContent must be a non-empty array of blocks, received: " + y
|
|
3172
3387
|
);
|
|
3173
|
-
const
|
|
3174
|
-
(
|
|
3175
|
-
),
|
|
3388
|
+
const I = _t(i.extensions), M = y.map(
|
|
3389
|
+
(He) => Z(He, I, this.schema.styleSchema).toJSON()
|
|
3390
|
+
), A = Lt(
|
|
3176
3391
|
{
|
|
3177
3392
|
type: "doc",
|
|
3178
3393
|
content: [
|
|
3179
3394
|
{
|
|
3180
3395
|
type: "blockGroup",
|
|
3181
|
-
content:
|
|
3396
|
+
content: M
|
|
3182
3397
|
}
|
|
3183
3398
|
]
|
|
3184
3399
|
},
|
|
3185
|
-
|
|
3186
|
-
|
|
3400
|
+
I,
|
|
3401
|
+
i.parseOptions
|
|
3187
3402
|
);
|
|
3188
3403
|
this._tiptapEditor = new Dt({
|
|
3189
|
-
...
|
|
3190
|
-
content:
|
|
3404
|
+
...i,
|
|
3405
|
+
content: A.toJSON()
|
|
3191
3406
|
}), this.pmSchema = this._tiptapEditor.schema;
|
|
3192
3407
|
} catch (y) {
|
|
3193
3408
|
throw new Error(
|
|
@@ -3195,17 +3410,17 @@ class Ne extends Se {
|
|
|
3195
3410
|
{ cause: y }
|
|
3196
3411
|
);
|
|
3197
3412
|
}
|
|
3198
|
-
let
|
|
3199
|
-
const
|
|
3413
|
+
let l;
|
|
3414
|
+
const a = this.pmSchema.nodes.doc.createAndFill;
|
|
3200
3415
|
this.pmSchema.nodes.doc.createAndFill = (...y) => {
|
|
3201
|
-
if (
|
|
3202
|
-
return
|
|
3203
|
-
const
|
|
3204
|
-
return
|
|
3205
|
-
}, this.pmSchema.cached.blockNoteEditor = this, this._blockManager = new
|
|
3416
|
+
if (l)
|
|
3417
|
+
return l;
|
|
3418
|
+
const I = a.apply(this.pmSchema.nodes.doc, y), M = JSON.parse(JSON.stringify(I.toJSON()));
|
|
3419
|
+
return M.content[0].content[0].attrs.id = "initialBlockId", l = ze.fromJSON(this.pmSchema, M), l;
|
|
3420
|
+
}, this.pmSchema.cached.blockNoteEditor = this, this._blockManager = new xo(this), this._exportManager = new Lo(this), this._selectionManager = new Mn(this), this._stateManager = new wn(this), this._styleManager = new In(this), this.emit("create");
|
|
3206
3421
|
}
|
|
3207
3422
|
static create(t) {
|
|
3208
|
-
return new
|
|
3423
|
+
return new $e(t ?? {});
|
|
3209
3424
|
}
|
|
3210
3425
|
/**
|
|
3211
3426
|
* BlockNote extensions that are added to the editor, keyed by the extension key
|
|
@@ -3742,7 +3957,7 @@ class Ne extends Se {
|
|
|
3742
3957
|
return this._exportManager.pasteMarkdown(t);
|
|
3743
3958
|
}
|
|
3744
3959
|
}
|
|
3745
|
-
class
|
|
3960
|
+
class ds {
|
|
3746
3961
|
constructor(e, t, o) {
|
|
3747
3962
|
this.mappings = t, this.options = o;
|
|
3748
3963
|
}
|
|
@@ -3775,191 +3990,191 @@ class cs {
|
|
|
3775
3990
|
);
|
|
3776
3991
|
}
|
|
3777
3992
|
}
|
|
3778
|
-
function
|
|
3993
|
+
function us(n) {
|
|
3779
3994
|
return {
|
|
3780
3995
|
createBlockMapping: (e) => e,
|
|
3781
3996
|
createInlineContentMapping: (e) => e,
|
|
3782
3997
|
createStyleMapping: (e) => e
|
|
3783
3998
|
};
|
|
3784
3999
|
}
|
|
3785
|
-
function
|
|
4000
|
+
function ps(n, ...e) {
|
|
3786
4001
|
const t = [...n];
|
|
3787
4002
|
for (const o of e)
|
|
3788
4003
|
for (const s of o) {
|
|
3789
4004
|
const r = t.findLastIndex(
|
|
3790
|
-
(
|
|
4005
|
+
(i) => i.group === s.group
|
|
3791
4006
|
);
|
|
3792
4007
|
r === -1 ? t.push(s) : t.splice(r + 1, 0, s);
|
|
3793
4008
|
}
|
|
3794
4009
|
return t;
|
|
3795
4010
|
}
|
|
3796
4011
|
export {
|
|
3797
|
-
|
|
4012
|
+
$e as BlockNoteEditor,
|
|
3798
4013
|
Mt as BlockNoteSchema,
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
4014
|
+
Is as COLORS_DARK_MODE_DEFAULT,
|
|
4015
|
+
As as COLORS_DEFAULT,
|
|
4016
|
+
li as CustomBlockNoteSchema,
|
|
4017
|
+
Ns as EMPTY_CELL_HEIGHT,
|
|
4018
|
+
Xe as EMPTY_CELL_WIDTH,
|
|
4019
|
+
Ce as EventEmitter,
|
|
4020
|
+
ds as Exporter,
|
|
4021
|
+
_s as FILE_AUDIO_ICON_SVG,
|
|
4022
|
+
Ls as FILE_IMAGE_ICON_SVG,
|
|
3808
4023
|
Ds as FILE_VIDEO_ICON_SVG,
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
4024
|
+
ve as HTMLToBlocks,
|
|
4025
|
+
ke as UniqueID,
|
|
4026
|
+
U as UnreachableCaseError,
|
|
4027
|
+
Os as addDefaultPropsExternalHTML,
|
|
4028
|
+
G as addInlineContentAttributes,
|
|
4029
|
+
Je as addInlineContentKeyboardShortcuts,
|
|
4030
|
+
$s as addNodeAndExtensionsToSpec,
|
|
4031
|
+
Hs as addStyleAttributes,
|
|
3817
4032
|
Fs as applyNonSelectableBlockFix,
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
4033
|
+
ms as assertEmpty,
|
|
4034
|
+
Vs as audioParse,
|
|
4035
|
+
Us as audioRender,
|
|
4036
|
+
zs as audioToExternalHTML,
|
|
4037
|
+
Rs as blockHasType,
|
|
4038
|
+
Z as blockToNode,
|
|
4039
|
+
at as blocksToMarkdown,
|
|
4040
|
+
Gs as camelToDataKebab,
|
|
4041
|
+
js as captureCellAnchor,
|
|
4042
|
+
di as checkPageBreakBlocksInSchema,
|
|
4043
|
+
ct as cleanHTMLToMarkdown,
|
|
4044
|
+
ps as combineByGroup,
|
|
4045
|
+
qe as contentNodeToInlineContent,
|
|
4046
|
+
We as contentNodeToTableContent,
|
|
4047
|
+
Ws as createAudioBlockConfig,
|
|
4048
|
+
qs as createAudioBlockSpec,
|
|
4049
|
+
Ks as createBlockConfig,
|
|
4050
|
+
Js as createBlockSpec,
|
|
4051
|
+
Ys as createBlockSpecFromTiptapNode,
|
|
4052
|
+
Qs as createBulletListItemBlockConfig,
|
|
4053
|
+
Xs as createBulletListItemBlockSpec,
|
|
4054
|
+
Zs as createCheckListItemBlockSpec,
|
|
4055
|
+
er as createCheckListItemConfig,
|
|
4056
|
+
tr as createCodeBlockConfig,
|
|
4057
|
+
or as createCodeBlockSpec,
|
|
4058
|
+
nr as createDefaultBlockDOMOutputSpec,
|
|
4059
|
+
sr as createDividerBlockConfig,
|
|
4060
|
+
rr as createDividerBlockSpec,
|
|
4061
|
+
Vt as createExtension,
|
|
4062
|
+
Be as createExternalHTMLExporter,
|
|
4063
|
+
ir as createFileBlockConfig,
|
|
4064
|
+
ar as createFileBlockSpec,
|
|
4065
|
+
cr as createHeadingBlockConfig,
|
|
4066
|
+
lr as createHeadingBlockSpec,
|
|
4067
|
+
dr as createImageBlockConfig,
|
|
4068
|
+
ur as createImageBlockSpec,
|
|
4069
|
+
ls as createInlineContentSpec,
|
|
4070
|
+
Qe as createInlineContentSpecFromTipTapNode,
|
|
4071
|
+
lo as createInternalHTMLSerializer,
|
|
4072
|
+
pr as createInternalInlineContentSpec,
|
|
4073
|
+
fr as createInternalStyleSpec,
|
|
4074
|
+
hr as createNumberedListItemBlockConfig,
|
|
4075
|
+
mr as createNumberedListItemBlockSpec,
|
|
4076
|
+
ui as createPageBreakBlockConfig,
|
|
4077
|
+
pi as createPageBreakBlockSpec,
|
|
4078
|
+
kr as createParagraphBlockConfig,
|
|
4079
|
+
br as createParagraphBlockSpec,
|
|
4080
|
+
gr as createQuoteBlockConfig,
|
|
4081
|
+
Br as createQuoteBlockSpec,
|
|
4082
|
+
bi as createStore,
|
|
4083
|
+
yr as createStyleSpec,
|
|
4084
|
+
Cr as createStyleSpecFromTipTapMark,
|
|
3870
4085
|
Sr as createTableBlockSpec,
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
4086
|
+
xr as createToggleListItemBlockConfig,
|
|
4087
|
+
Er as createToggleListItemBlockSpec,
|
|
4088
|
+
Pr as createToggleWrapper,
|
|
4089
|
+
Tr as createVideoBlockConfig,
|
|
3875
4090
|
Mr as createVideoBlockSpec,
|
|
3876
4091
|
wr as defaultBlockSpecs,
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
4092
|
+
vr as defaultBlockToHTML,
|
|
4093
|
+
Ir as defaultInlineContentSchema,
|
|
4094
|
+
Ar as defaultInlineContentSpecs,
|
|
4095
|
+
Nr as defaultProps,
|
|
4096
|
+
_r as defaultStyleSchema,
|
|
4097
|
+
Lr as defaultStyleSpecs,
|
|
3883
4098
|
Dr as defaultToggledState,
|
|
3884
|
-
|
|
3885
|
-
|
|
4099
|
+
je as docToBlocks,
|
|
4100
|
+
Or as editorHasBlockWithType,
|
|
3886
4101
|
Sn as expandPMRangeToWords,
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
4102
|
+
$r as fileParse,
|
|
4103
|
+
Hr as filenameFromURL,
|
|
4104
|
+
H as fixColumnList,
|
|
3890
4105
|
Fr as formatKeyboardShortcut,
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
4106
|
+
tt as getBackgroundColorAttribute,
|
|
4107
|
+
Bo as getBlock,
|
|
4108
|
+
ks as getBlockCache,
|
|
4109
|
+
Vr as getBlockFromPos,
|
|
4110
|
+
K as getBlockInfo,
|
|
4111
|
+
v as getBlockInfoFromResolvedPos,
|
|
3897
4112
|
B as getBlockInfoFromSelection,
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
4113
|
+
z as getBlockInfoFromTransaction,
|
|
4114
|
+
bs as getBlockInfoWithManualOffset,
|
|
4115
|
+
be as getBlockNoteSchema,
|
|
4116
|
+
gs as getBlockSchema,
|
|
4117
|
+
it as getBlocksChangedByTransaction,
|
|
4118
|
+
Bs as getColspan,
|
|
4119
|
+
Xt as getInlineContentParseRules,
|
|
4120
|
+
ys as getInlineContentSchema,
|
|
4121
|
+
Ur as getInlineContentSchemaFromSpecs,
|
|
4122
|
+
zr as getLanguageId,
|
|
4123
|
+
D as getNearestBlockPos,
|
|
4124
|
+
Co as getNextBlock,
|
|
4125
|
+
P as getNodeById,
|
|
4126
|
+
fi as getPageBreakSlashMenuItems,
|
|
3912
4127
|
So as getParentBlock,
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
4128
|
+
Rr as getParseRules,
|
|
4129
|
+
E as getPmSchema,
|
|
4130
|
+
yo as getPrevBlock,
|
|
4131
|
+
Cs as getRowspan,
|
|
4132
|
+
Gr as getStyleParseRules,
|
|
3918
4133
|
Ss as getStyleSchema,
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
4134
|
+
jr as getStyleSchemaFromSpecs,
|
|
4135
|
+
Wr as getTextAlignmentAttribute,
|
|
4136
|
+
st as getTextColorAttribute,
|
|
4137
|
+
qr as imageParse,
|
|
4138
|
+
Kr as imageRender,
|
|
4139
|
+
Jr as imageToExternalHTML,
|
|
4140
|
+
V as inlineContentToNodes,
|
|
4141
|
+
Zt as insertBlocks,
|
|
4142
|
+
Yr as isAppleOS,
|
|
4143
|
+
Q as isEmptyColumn,
|
|
4144
|
+
xs as isLinkInlineContent,
|
|
4145
|
+
Qr as isNodeBlock,
|
|
4146
|
+
Es as isPartialLinkInlineContent,
|
|
4147
|
+
Ps as isPartialTableCell,
|
|
4148
|
+
Xr as isSafari,
|
|
4149
|
+
Ts as isStyledTextInlineContent,
|
|
3935
4150
|
Ms as isTableCell,
|
|
3936
|
-
|
|
3937
|
-
|
|
4151
|
+
Zr as isTableCellSelection,
|
|
4152
|
+
et as isVideoUrl,
|
|
3938
4153
|
ws as mapTableCell,
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
4154
|
+
us as mappingFactory,
|
|
4155
|
+
_o as markdownToBlocks,
|
|
4156
|
+
Ie as markdownToHTML,
|
|
4157
|
+
ee as mergeCSSClasses,
|
|
4158
|
+
ei as mergeParagraphs,
|
|
4159
|
+
C as nodeToBlock,
|
|
4160
|
+
q as nodeToCustomInlineContent,
|
|
4161
|
+
ti as parseAudioElement,
|
|
4162
|
+
oi as parseDefaultProps,
|
|
4163
|
+
Ye as propsToAttributes,
|
|
4164
|
+
Ke as prosemirrorSliceToSlicedBlocks,
|
|
3950
4165
|
ae as removeAndInsertBlocks,
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
4166
|
+
eo as removeEmptyColumns,
|
|
4167
|
+
Ne as selectedFragmentToHTML,
|
|
4168
|
+
ni as stylePropsToAttributes,
|
|
4169
|
+
Ge as tableContentToNodes,
|
|
4170
|
+
si as tablePropSchema,
|
|
4171
|
+
ri as trackPosition,
|
|
4172
|
+
Ze as updateBlock,
|
|
4173
|
+
nt as updateBlockCommand,
|
|
4174
|
+
rt as updateBlockTr,
|
|
4175
|
+
hi as uploadToTmpFilesDotOrg_DEV_ONLY,
|
|
4176
|
+
ii as videoParse,
|
|
4177
|
+
mi as withPageBreak,
|
|
4178
|
+
ai as wrapInBlockStructure
|
|
3964
4179
|
};
|
|
3965
4180
|
//# sourceMappingURL=blocknote.js.map
|