@blocknote/core 0.46.2 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BlockNoteSchema-BkXw8HJ6.js → BlockNoteSchema-1r-ln0Q0.js} +2 -2
- package/dist/{BlockNoteSchema-BkXw8HJ6.js.map → BlockNoteSchema-1r-ln0Q0.js.map} +1 -1
- package/dist/{BlockNoteSchema-DmFDeA0n.cjs → BlockNoteSchema-DT4bdXj5.cjs} +2 -2
- package/dist/{BlockNoteSchema-DmFDeA0n.cjs.map → BlockNoteSchema-DT4bdXj5.cjs.map} +1 -1
- package/dist/{TrailingNode-CxM966vN.js → TrailingNode-DZag-Nvu.js} +448 -444
- package/dist/TrailingNode-DZag-Nvu.js.map +1 -0
- package/dist/TrailingNode-tesI8f7N.cjs +2 -0
- package/dist/TrailingNode-tesI8f7N.cjs.map +1 -0
- package/dist/blocknote.cjs +4 -4
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +1053 -1014
- package/dist/blocknote.js.map +1 -1
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +2 -2
- package/dist/{defaultBlocks-DE5GNdJH.js → defaultBlocks-BSOEW3GR.js} +3 -3
- package/dist/defaultBlocks-BSOEW3GR.js.map +1 -0
- package/dist/defaultBlocks-D049Pbme.cjs +6 -0
- package/dist/defaultBlocks-D049Pbme.cjs.map +1 -0
- package/dist/extensions.cjs +1 -1
- package/dist/extensions.js +3 -3
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +813 -28
- package/dist/locales.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +1 -1
- package/src/blocks/ListItem/CheckListItem/block.test.ts +61 -0
- package/src/blocks/ListItem/CheckListItem/block.ts +4 -0
- package/src/editor/Block.css +2 -2
- package/src/editor/transformPasted.ts +69 -0
- package/src/extensions/SideMenu/SideMenu.ts +44 -0
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +37 -11
- package/src/i18n/locales/fa.ts +390 -0
- package/src/i18n/locales/index.ts +2 -0
- package/src/i18n/locales/uz.ts +421 -0
- package/types/src/blocks/ListItem/CheckListItem/block.test.d.ts +1 -0
- package/types/src/i18n/locales/fa.d.ts +320 -0
- package/types/src/i18n/locales/index.d.ts +2 -0
- package/types/src/i18n/locales/uz.d.ts +2 -0
- package/dist/TrailingNode-CxM966vN.js.map +0 -1
- package/dist/TrailingNode-D-CZ76FS.cjs +0 -2
- package/dist/TrailingNode-D-CZ76FS.cjs.map +0 -1
- package/dist/defaultBlocks-DE5GNdJH.js.map +0 -1
- package/dist/defaultBlocks-DosClM5E.cjs +0 -6
- package/dist/defaultBlocks-DosClM5E.cjs.map +0 -1
package/dist/blocknote.js
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var h = (
|
|
4
|
-
import { Slice as N, Fragment as A, DOMSerializer as he, DOMParser 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 xt, B as
|
|
12
|
-
import { C as
|
|
13
|
-
import { Node as D, Extension as
|
|
1
|
+
var Fe = Object.defineProperty;
|
|
2
|
+
var $e = (n, e, t) => e in n ? Fe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var h = (n, e, t) => $e(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Slice as N, Fragment as A, DOMSerializer as he, DOMParser as He, Node as Ve } from "prosemirror-model";
|
|
5
|
+
import { ReplaceStep as Ue, ReplaceAroundStep as z } from "prosemirror-transform";
|
|
6
|
+
import { n as G, i as O, g as C, b as Q, a as S, t as ze, U as F, q as _, r as $, d as Ge, s as Re, u as je, v as X, w as B, x as me, y as We, z as ke, A as R } from "./blockToNode-BNoNIXU7.js";
|
|
7
|
+
import { B as fs, G as hs, C as ms, D as ks, N as bs, E as gs, O as ys, F as Ss, H as Bs, I as Cs, L as Es, J as xs, M as Ms, K as ws } from "./blockToNode-BNoNIXU7.js";
|
|
8
|
+
import { ak as V, al as qe, am as Ke, an as Je, aj as E, a as Ye, ao as Qe, ap as Xe, a5 as Ze, a8 as j, aq as et, ar as tt, a6 as ot, as as Z, a9 as be, at as nt } from "./defaultBlocks-BSOEW3GR.js";
|
|
9
|
+
import { aw as Ps, av as vs, E as Is, F as As, r as _s, N as Ds, a4 as Ls, ad as Ns, aG as Os, ax as Fs, b as $s, d as Hs, e as Vs, a0 as Us, aM as zs, au as Gs, c as Rs, f as js, ag as Ws, ah as qs, aB as Ks, x as Js, y as Ys, A as Qs, z as Xs, g as Zs, h as er, T as tr, j as or, k as nr, l as sr, n as rr, o as ar, q as ir, s as cr, w as lr, aC as dr, aH as ur, B as pr, C as fr, H as hr, I as mr, J as kr, K as br, aE as gr, aI as yr, M as Sr, D as Br, G as Cr, S as Er, O as xr, Q as Mr, W as wr, U as Tr, _ as Pr, Z as vr, a2 as Ir, Y as Ar, X as _r, R as Dr, $ as Lr, m as Nr, aN as Or, aK as Fr, az as $r, af as Hr, i as Vr, ay as Ur, aD as zr, ae as Gr, a7 as Rr, t as jr, u as Wr, v as qr, aJ as Kr, ai as Jr, aL as Yr, a1 as Qr, V as Xr, p as Zr, a3 as ea, aF as ta, L as oa, aO as na, P as sa, aA as ra } from "./defaultBlocks-BSOEW3GR.js";
|
|
10
|
+
import { j as st, k as ge, l as rt, m as at, n as it, c as W, F as ct, Y as lt, a as dt, b as ut, S as pt, B as ye, D as ft, L as ht, N as mt, P as kt, g as bt, i as gt, H as yt, h as St, e as Bt, V as Ct, d as Et } from "./TrailingNode-DZag-Nvu.js";
|
|
11
|
+
import { s as xt, B as Mt } from "./BlockNoteSchema-1r-ln0Q0.js";
|
|
12
|
+
import { C as ia, b as ca, c as la, a as da, g as ua, u as pa, w as fa } from "./BlockNoteSchema-1r-ln0Q0.js";
|
|
13
|
+
import { Node as D, Extension as x, mergeAttributes as wt, Mark as ee, extensions as I, isNodeSelection as Tt, posToDOMRect as Pt, selectionToInsertionEnd as vt, findParentNodeClosestToPos as It, getSchema as At, createDocument as _t, Editor as Dt } from "@tiptap/core";
|
|
14
14
|
import { E as Se } from "./EventEmitter-CjSwpTbz.js";
|
|
15
|
-
import { Fragment as
|
|
16
|
-
import { e as
|
|
17
|
-
import { inputRules as
|
|
18
|
-
import { keymap as
|
|
19
|
-
import { c as
|
|
20
|
-
import { a as
|
|
21
|
-
import { Gapcursor as
|
|
22
|
-
import { Link as
|
|
23
|
-
import { Text as
|
|
24
|
-
import { NodeSelection as L, TextSelection 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
|
|
15
|
+
import { Fragment as H, Slice as U } from "@tiptap/pm/model";
|
|
16
|
+
import { e as Lt } from "./en-njEqD7AG.js";
|
|
17
|
+
import { inputRules as Nt, InputRule as Ot } from "@handlewithcare/prosemirror-inputrules";
|
|
18
|
+
import { keymap as Ft } from "@tiptap/pm/keymap";
|
|
19
|
+
import { c as $t, o as Ht } from "./BlockNoteExtension-C2X7LW-V.js";
|
|
20
|
+
import { a as ma } from "./BlockNoteExtension-C2X7LW-V.js";
|
|
21
|
+
import { Gapcursor as Vt } from "@tiptap/extensions/gap-cursor";
|
|
22
|
+
import { Link as Ut } from "@tiptap/extension-link";
|
|
23
|
+
import { Text as zt } from "@tiptap/extension-text";
|
|
24
|
+
import { NodeSelection as L, TextSelection as M, Plugin as te } from "prosemirror-state";
|
|
25
|
+
import { CellSelection as oe, TableMap as se } from "prosemirror-tables";
|
|
26
|
+
import { S as Gt } from "./ShowSelection-B0ch3unP.js";
|
|
27
|
+
import Rt from "remark-gfm";
|
|
28
|
+
import jt from "remark-parse";
|
|
29
|
+
import Wt, { defaultHandlers as re } from "remark-rehype";
|
|
30
|
+
import qt from "rehype-stringify";
|
|
31
|
+
import { unified as Kt } from "unified";
|
|
32
|
+
import { TextSelection as Jt } from "@tiptap/pm/state";
|
|
33
|
+
function Yt(n, e) {
|
|
34
34
|
const t = [
|
|
35
35
|
{
|
|
36
|
-
tag: `[data-inline-content-type="${
|
|
37
|
-
contentElement: (
|
|
38
|
-
const s =
|
|
36
|
+
tag: `[data-inline-content-type="${n.type}"]`,
|
|
37
|
+
contentElement: (o) => {
|
|
38
|
+
const s = o;
|
|
39
39
|
return s.matches("[data-editable]") ? s : s.querySelector("[data-editable]") || s;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
];
|
|
43
43
|
return e && t.push({
|
|
44
44
|
tag: "*",
|
|
45
|
-
getAttrs(
|
|
46
|
-
if (typeof
|
|
45
|
+
getAttrs(o) {
|
|
46
|
+
if (typeof o == "string")
|
|
47
47
|
return !1;
|
|
48
|
-
const s = e == null ? void 0 : e(
|
|
48
|
+
const s = e == null ? void 0 : e(o);
|
|
49
49
|
return s === void 0 ? !1 : s;
|
|
50
50
|
}
|
|
51
51
|
}), t;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
var
|
|
53
|
+
function is(n, e) {
|
|
54
|
+
var o;
|
|
55
55
|
const t = D.create({
|
|
56
|
-
name:
|
|
56
|
+
name: n.type,
|
|
57
57
|
inline: !0,
|
|
58
58
|
group: "inline",
|
|
59
|
-
draggable: (
|
|
60
|
-
selectable:
|
|
61
|
-
atom:
|
|
62
|
-
content:
|
|
59
|
+
draggable: (o = e.meta) == null ? void 0 : o.draggable,
|
|
60
|
+
selectable: n.content === "styled",
|
|
61
|
+
atom: n.content === "none",
|
|
62
|
+
content: n.content === "styled" ? "inline*" : "",
|
|
63
63
|
addAttributes() {
|
|
64
|
-
return
|
|
64
|
+
return Ke(n.propSchema);
|
|
65
65
|
},
|
|
66
66
|
addKeyboardShortcuts() {
|
|
67
|
-
return
|
|
67
|
+
return qe(n);
|
|
68
68
|
},
|
|
69
69
|
parseHTML() {
|
|
70
|
-
return
|
|
71
|
-
|
|
70
|
+
return Yt(
|
|
71
|
+
n,
|
|
72
72
|
e.parse
|
|
73
73
|
);
|
|
74
74
|
},
|
|
75
75
|
renderHTML({ node: s }) {
|
|
76
76
|
const r = this.options.editor, a = e.render.call(
|
|
77
77
|
{ renderType: "dom", props: void 0 },
|
|
78
|
-
|
|
78
|
+
G(
|
|
79
79
|
s,
|
|
80
80
|
r.schema.inlineContentSchema,
|
|
81
81
|
r.schema.styleSchema
|
|
@@ -85,18 +85,18 @@ function ss(o, e) {
|
|
|
85
85
|
},
|
|
86
86
|
r
|
|
87
87
|
);
|
|
88
|
-
return
|
|
88
|
+
return V(
|
|
89
89
|
a,
|
|
90
|
-
|
|
90
|
+
n.type,
|
|
91
91
|
s.attrs,
|
|
92
|
-
|
|
92
|
+
n.propSchema
|
|
93
93
|
);
|
|
94
94
|
},
|
|
95
95
|
addNodeView() {
|
|
96
96
|
return (s) => {
|
|
97
97
|
const { node: r, getPos: a } = s, c = this.options.editor, i = e.render.call(
|
|
98
98
|
{ renderType: "nodeView", props: s },
|
|
99
|
-
|
|
99
|
+
G(
|
|
100
100
|
r,
|
|
101
101
|
c.schema.inlineContentSchema,
|
|
102
102
|
c.schema.styleSchema
|
|
@@ -110,18 +110,18 @@ function ss(o, e) {
|
|
|
110
110
|
},
|
|
111
111
|
c
|
|
112
112
|
);
|
|
113
|
-
return
|
|
113
|
+
return V(
|
|
114
114
|
i,
|
|
115
|
-
|
|
115
|
+
n.type,
|
|
116
116
|
r.attrs,
|
|
117
|
-
|
|
117
|
+
n.propSchema
|
|
118
118
|
);
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
|
-
return
|
|
122
|
+
return Je(
|
|
123
123
|
t,
|
|
124
|
-
|
|
124
|
+
n.propSchema,
|
|
125
125
|
{
|
|
126
126
|
...e,
|
|
127
127
|
toExternalHTML: e.toExternalHTML,
|
|
@@ -131,78 +131,78 @@ function ss(o, e) {
|
|
|
131
131
|
r,
|
|
132
132
|
a
|
|
133
133
|
);
|
|
134
|
-
return
|
|
134
|
+
return V(
|
|
135
135
|
c,
|
|
136
|
-
|
|
136
|
+
n.type,
|
|
137
137
|
s.props,
|
|
138
|
-
|
|
138
|
+
n.propSchema
|
|
139
139
|
);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
);
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
const s = typeof t == "string" ? t : t.id, r = C(
|
|
146
|
-
(d) =>
|
|
147
|
-
), c =
|
|
144
|
+
function Qt(n, e, t, o = "before") {
|
|
145
|
+
const s = typeof t == "string" ? t : t.id, r = C(n), a = e.map(
|
|
146
|
+
(d) => Q(d, r)
|
|
147
|
+
), c = E(s, n.doc);
|
|
148
148
|
if (!c)
|
|
149
149
|
throw new Error(`Block with ID ${s} not found`);
|
|
150
150
|
let i = c.posBeforeNode;
|
|
151
|
-
return
|
|
152
|
-
new
|
|
151
|
+
return o === "after" && (i += c.node.nodeSize), n.step(
|
|
152
|
+
new Ue(i, i, new N(A.from(a), 0, 0))
|
|
153
153
|
), a.map(
|
|
154
|
-
(d) =>
|
|
154
|
+
(d) => S(d, r)
|
|
155
155
|
);
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
if (!
|
|
157
|
+
function q(n) {
|
|
158
|
+
if (!n || n.type.name !== "column")
|
|
159
159
|
throw new Error("Invalid columnPos: does not point to column node.");
|
|
160
|
-
const e =
|
|
160
|
+
const e = n.firstChild;
|
|
161
161
|
if (!e)
|
|
162
162
|
throw new Error("Invalid column: does not have child node.");
|
|
163
163
|
const t = e.firstChild;
|
|
164
164
|
if (!t)
|
|
165
165
|
throw new Error("Invalid blockContainer: does not have child node.");
|
|
166
|
-
return
|
|
166
|
+
return n.childCount === 1 && e.childCount === 1 && t.type.name === "paragraph" && t.content.content.length === 0;
|
|
167
167
|
}
|
|
168
|
-
function
|
|
169
|
-
const t =
|
|
170
|
-
if (!
|
|
168
|
+
function Xt(n, e) {
|
|
169
|
+
const t = n.doc.resolve(e), o = t.nodeAfter;
|
|
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
|
-
for (let s =
|
|
175
|
-
const r =
|
|
174
|
+
for (let s = o.childCount - 1; s >= 0; s--) {
|
|
175
|
+
const r = n.doc.resolve(t.pos + 1).posAtIndex(s), c = n.doc.resolve(r).nodeAfter;
|
|
176
176
|
if (!c || c.type.name !== "column")
|
|
177
177
|
throw new Error("Invalid columnPos: does not point to column node.");
|
|
178
|
-
|
|
178
|
+
q(c) && n.delete(r, r + c.nodeSize);
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
function
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
if (!
|
|
181
|
+
function K(n, e) {
|
|
182
|
+
Xt(n, e);
|
|
183
|
+
const o = n.doc.resolve(e).nodeAfter;
|
|
184
|
+
if (!o || o.type.name !== "columnList")
|
|
185
185
|
throw new Error(
|
|
186
186
|
"Invalid columnListPos: does not point to columnList node."
|
|
187
187
|
);
|
|
188
|
-
if (
|
|
188
|
+
if (o.childCount > 2)
|
|
189
189
|
return;
|
|
190
|
-
if (
|
|
190
|
+
if (o.childCount < 2)
|
|
191
191
|
throw new Error("Invalid columnList: contains fewer than two children.");
|
|
192
|
-
const s = e + 1, a =
|
|
192
|
+
const s = e + 1, a = n.doc.resolve(s).nodeAfter, c = e + o.nodeSize - 1, l = n.doc.resolve(c).nodeBefore;
|
|
193
193
|
if (!a || !l)
|
|
194
194
|
throw new Error("Invalid columnList: does not contain children.");
|
|
195
|
-
const d =
|
|
195
|
+
const d = q(a), u = q(l);
|
|
196
196
|
if (d && u) {
|
|
197
|
-
|
|
197
|
+
n.delete(e, e + o.nodeSize);
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
200
200
|
if (d) {
|
|
201
|
-
|
|
202
|
-
new
|
|
201
|
+
n.step(
|
|
202
|
+
new z(
|
|
203
203
|
// Replaces `columnList`.
|
|
204
204
|
e,
|
|
205
|
-
e +
|
|
205
|
+
e + o.nodeSize,
|
|
206
206
|
// Replaces with content of last `column`.
|
|
207
207
|
c - l.nodeSize + 1,
|
|
208
208
|
c - 1,
|
|
@@ -215,11 +215,11 @@ function W(o, e) {
|
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
217
217
|
if (u) {
|
|
218
|
-
|
|
219
|
-
new
|
|
218
|
+
n.step(
|
|
219
|
+
new z(
|
|
220
220
|
// Replaces `columnList`.
|
|
221
221
|
e,
|
|
222
|
-
e +
|
|
222
|
+
e + o.nodeSize,
|
|
223
223
|
// Replaces with content of first `column`.
|
|
224
224
|
s + 1,
|
|
225
225
|
s + a.nodeSize - 1,
|
|
@@ -232,29 +232,29 @@ function W(o, e) {
|
|
|
232
232
|
return;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
function ae(
|
|
236
|
-
const
|
|
237
|
-
(u) =>
|
|
235
|
+
function ae(n, e, t) {
|
|
236
|
+
const o = C(n), s = t.map(
|
|
237
|
+
(u) => Q(u, o)
|
|
238
238
|
), r = new Set(
|
|
239
239
|
e.map(
|
|
240
240
|
(u) => typeof u == "string" ? u : u.id
|
|
241
241
|
)
|
|
242
242
|
), a = [], c = /* @__PURE__ */ new Set(), i = typeof e[0] == "string" ? e[0] : e[0].id;
|
|
243
243
|
let l = 0;
|
|
244
|
-
if (
|
|
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 (a.push(
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
const
|
|
253
|
-
l +=
|
|
249
|
+
if (a.push(S(u, o)), r.delete(u.attrs.id), t.length > 0 && u.attrs.id === i) {
|
|
250
|
+
const b = n.doc.nodeSize;
|
|
251
|
+
n.insert(p, s);
|
|
252
|
+
const g = n.doc.nodeSize;
|
|
253
|
+
l += b - g;
|
|
254
254
|
}
|
|
255
|
-
const m =
|
|
256
|
-
f.node().type.name === "column" ? c.add(f.before(-1)) : f.node().type.name === "columnList" && c.add(f.before()), f.node().type.name === "blockGroup" && f.node(f.depth - 1).type.name !== "doc" && f.node().childCount === 1 ?
|
|
257
|
-
const k =
|
|
255
|
+
const m = n.doc.nodeSize, f = n.doc.resolve(p - l);
|
|
256
|
+
f.node().type.name === "column" ? c.add(f.before(-1)) : f.node().type.name === "columnList" && c.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 - l, p - l + u.nodeSize);
|
|
257
|
+
const k = n.doc.nodeSize;
|
|
258
258
|
return l += m - k, !1;
|
|
259
259
|
}), r.size > 0) {
|
|
260
260
|
const u = [...r].join(`
|
|
@@ -263,31 +263,31 @@ function ae(o, e, t) {
|
|
|
263
263
|
"Blocks with the following IDs could not be found in the editor: " + u
|
|
264
264
|
);
|
|
265
265
|
}
|
|
266
|
-
return c.forEach((u) =>
|
|
267
|
-
(u) =>
|
|
266
|
+
return c.forEach((u) => K(n, u)), { insertedBlocks: s.map(
|
|
267
|
+
(u) => S(u, o)
|
|
268
268
|
), removedBlocks: a };
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function Zt(n, e, t, o, s) {
|
|
271
271
|
let r;
|
|
272
272
|
if (e)
|
|
273
273
|
if (typeof e == "string")
|
|
274
|
-
r = O([e],
|
|
274
|
+
r = O([e], n.pmSchema, o);
|
|
275
275
|
else if (Array.isArray(e))
|
|
276
|
-
r = O(e,
|
|
276
|
+
r = O(e, n.pmSchema, o);
|
|
277
277
|
else if (e.type === "tableContent")
|
|
278
|
-
r =
|
|
278
|
+
r = ze(e, n.pmSchema);
|
|
279
279
|
else
|
|
280
280
|
throw new F(e.type);
|
|
281
281
|
else throw new Error("blockContent is required");
|
|
282
282
|
const c = ((s == null ? void 0 : s.document) ?? document).createDocumentFragment();
|
|
283
283
|
for (const i of r)
|
|
284
|
-
if (i.type.name !== "text" &&
|
|
285
|
-
const l =
|
|
284
|
+
if (i.type.name !== "text" && n.schema.inlineContentSchema[i.type.name]) {
|
|
285
|
+
const l = n.schema.inlineContentSpecs[i.type.name].implementation;
|
|
286
286
|
if (l) {
|
|
287
|
-
const d =
|
|
287
|
+
const d = G(
|
|
288
288
|
i,
|
|
289
|
-
|
|
290
|
-
|
|
289
|
+
n.schema.inlineContentSchema,
|
|
290
|
+
n.schema.styleSchema
|
|
291
291
|
), u = l.render.call(
|
|
292
292
|
{
|
|
293
293
|
renderType: "dom",
|
|
@@ -296,7 +296,7 @@ function Qt(o, e, t, n, s) {
|
|
|
296
296
|
d,
|
|
297
297
|
() => {
|
|
298
298
|
},
|
|
299
|
-
|
|
299
|
+
n
|
|
300
300
|
);
|
|
301
301
|
if (u) {
|
|
302
302
|
if (c.appendChild(u.dom), u.contentDOM) {
|
|
@@ -314,8 +314,8 @@ function Qt(o, e, t, n, s) {
|
|
|
314
314
|
i.textContent
|
|
315
315
|
);
|
|
316
316
|
for (const d of i.marks.toReversed())
|
|
317
|
-
if (d.type.name in
|
|
318
|
-
const u =
|
|
317
|
+
if (d.type.name in n.schema.styleSpecs) {
|
|
318
|
+
const u = n.schema.styleSpecs[d.type.name].implementation.render(d.attrs.stringValue, n);
|
|
319
319
|
u.contentDOM.appendChild(l), l = u.dom;
|
|
320
320
|
} else {
|
|
321
321
|
const u = d.type.spec.toDOM(d, !0), p = he.renderSpec(document, u);
|
|
@@ -331,41 +331,41 @@ function Qt(o, e, t, n, s) {
|
|
|
331
331
|
}
|
|
332
332
|
return c;
|
|
333
333
|
}
|
|
334
|
-
function
|
|
334
|
+
function eo(n, e, t, o) {
|
|
335
335
|
var u, p, m, f, k;
|
|
336
|
-
const s =
|
|
337
|
-
for (const [
|
|
338
|
-
|
|
336
|
+
const s = n.pmSchema.nodes.blockContainer, r = e.props || {};
|
|
337
|
+
for (const [b, g] of Object.entries(
|
|
338
|
+
n.schema.blockSchema[e.type].propSchema
|
|
339
339
|
))
|
|
340
|
-
!(
|
|
341
|
-
const a = e.children || [], i =
|
|
340
|
+
!(b in r) && g.default !== void 0 && (r[b] = g.default);
|
|
341
|
+
const a = e.children || [], i = n.blockImplementations[e.type].implementation.render.call(
|
|
342
342
|
{
|
|
343
343
|
renderType: "dom",
|
|
344
344
|
props: void 0
|
|
345
345
|
},
|
|
346
346
|
{ ...e, props: r, children: a },
|
|
347
|
-
|
|
347
|
+
n
|
|
348
348
|
);
|
|
349
349
|
if (i.contentDOM && e.content) {
|
|
350
|
-
const
|
|
351
|
-
|
|
350
|
+
const b = Zt(
|
|
351
|
+
n,
|
|
352
352
|
e.content,
|
|
353
353
|
// TODO
|
|
354
354
|
t,
|
|
355
355
|
e.type,
|
|
356
|
-
|
|
356
|
+
o
|
|
357
357
|
);
|
|
358
|
-
i.contentDOM.appendChild(
|
|
358
|
+
i.contentDOM.appendChild(b);
|
|
359
359
|
}
|
|
360
|
-
if (
|
|
360
|
+
if (n.pmSchema.nodes[e.type].isInGroup("bnBlock")) {
|
|
361
361
|
if (e.children && e.children.length > 0) {
|
|
362
|
-
const
|
|
363
|
-
|
|
362
|
+
const b = Be(
|
|
363
|
+
n,
|
|
364
364
|
e.children,
|
|
365
365
|
t,
|
|
366
|
-
|
|
366
|
+
o
|
|
367
367
|
);
|
|
368
|
-
(u = i.contentDOM) == null || u.append(
|
|
368
|
+
(u = i.contentDOM) == null || u.append(b);
|
|
369
369
|
}
|
|
370
370
|
return i.dom;
|
|
371
371
|
}
|
|
@@ -377,72 +377,72 @@ function Xt(o, e, t, n) {
|
|
|
377
377
|
})
|
|
378
378
|
);
|
|
379
379
|
return (f = d.contentDOM) == null || f.appendChild(i.dom), e.children && e.children.length > 0 && ((k = d.contentDOM) == null || k.appendChild(
|
|
380
|
-
Ce(
|
|
380
|
+
Ce(n, e.children, t, o)
|
|
381
381
|
)), d.dom;
|
|
382
382
|
}
|
|
383
|
-
function Be(
|
|
384
|
-
const r = ((
|
|
383
|
+
function Be(n, e, t, o) {
|
|
384
|
+
const r = ((o == null ? void 0 : o.document) ?? document).createDocumentFragment();
|
|
385
385
|
for (const a of e) {
|
|
386
|
-
const c =
|
|
386
|
+
const c = eo(n, a, t, o);
|
|
387
387
|
r.appendChild(c);
|
|
388
388
|
}
|
|
389
389
|
return r;
|
|
390
390
|
}
|
|
391
|
-
const Ce = (
|
|
391
|
+
const Ce = (n, e, t, o) => {
|
|
392
392
|
var c;
|
|
393
|
-
const s =
|
|
393
|
+
const s = n.pmSchema.nodes.blockGroup, r = s.spec.toDOM(s.create({})), a = Be(n, e, t, o);
|
|
394
394
|
return (c = r.contentDOM) == null || c.appendChild(a), r.dom;
|
|
395
|
-
},
|
|
395
|
+
}, to = (n) => (n.querySelectorAll(
|
|
396
396
|
'[data-content-type="numberedListItem"]'
|
|
397
397
|
).forEach((t) => {
|
|
398
398
|
var s, r;
|
|
399
|
-
const
|
|
399
|
+
const o = (r = (s = t.closest(".bn-block-outer")) == null ? void 0 : s.previousElementSibling) == null ? void 0 : r.querySelector(
|
|
400
400
|
'[data-content-type="numberedListItem"]'
|
|
401
401
|
);
|
|
402
|
-
if (!
|
|
402
|
+
if (!o)
|
|
403
403
|
t.setAttribute(
|
|
404
404
|
"data-index",
|
|
405
405
|
t.getAttribute("data-start") || "1"
|
|
406
406
|
);
|
|
407
407
|
else {
|
|
408
|
-
const a =
|
|
408
|
+
const a = o.getAttribute("data-index");
|
|
409
409
|
t.setAttribute(
|
|
410
410
|
"data-index",
|
|
411
411
|
(parseInt(a || "0") + 1).toString()
|
|
412
412
|
);
|
|
413
413
|
}
|
|
414
|
-
}),
|
|
414
|
+
}), n), oo = (n) => (n.querySelectorAll(
|
|
415
415
|
'[data-content-type="checkListItem"] input'
|
|
416
416
|
).forEach((t) => {
|
|
417
417
|
t.disabled = !0;
|
|
418
|
-
}),
|
|
418
|
+
}), n), no = (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
|
-
}),
|
|
422
|
+
}), n), so = (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: ${Ye}px;`
|
|
426
426
|
), t.setAttribute("data-show-children", "true");
|
|
427
|
-
}),
|
|
427
|
+
}), n), ro = (n) => (n.querySelectorAll('[data-content-type="table"] table').forEach((t) => {
|
|
428
428
|
var r;
|
|
429
|
-
const
|
|
430
|
-
|
|
429
|
+
const o = document.createElement("div");
|
|
430
|
+
o.className = "tableWrapper";
|
|
431
431
|
const s = document.createElement("div");
|
|
432
|
-
s.className = "tableWrapper-inner",
|
|
433
|
-
}),
|
|
432
|
+
s.className = "tableWrapper-inner", o.appendChild(s), (r = t.parentElement) == null || r.appendChild(o), o.appendChild(t);
|
|
433
|
+
}), n), ao = (n) => (n.querySelectorAll(
|
|
434
434
|
".bn-inline-content:empty"
|
|
435
435
|
).forEach((t) => {
|
|
436
|
-
const
|
|
437
|
-
|
|
438
|
-
}),
|
|
439
|
-
const t = he.fromSchema(
|
|
440
|
-
Zt,
|
|
441
|
-
eo,
|
|
436
|
+
const o = document.createElement("span");
|
|
437
|
+
o.className = "ProseMirror-trailingBreak", o.setAttribute("style", "display: inline-block;"), t.appendChild(o);
|
|
438
|
+
}), n), io = (n, e) => {
|
|
439
|
+
const t = he.fromSchema(n), o = [
|
|
442
440
|
to,
|
|
443
441
|
oo,
|
|
444
442
|
no,
|
|
445
|
-
so
|
|
443
|
+
so,
|
|
444
|
+
ro,
|
|
445
|
+
ao
|
|
446
446
|
];
|
|
447
447
|
return {
|
|
448
448
|
serializeBlocks: (s, r) => {
|
|
@@ -452,16 +452,16 @@ const Ce = (o, e, t, n) => {
|
|
|
452
452
|
t,
|
|
453
453
|
r
|
|
454
454
|
);
|
|
455
|
-
for (const c of
|
|
455
|
+
for (const c of o)
|
|
456
456
|
a = c(a);
|
|
457
457
|
return a.outerHTML;
|
|
458
458
|
}
|
|
459
459
|
};
|
|
460
460
|
};
|
|
461
|
-
function
|
|
462
|
-
return
|
|
461
|
+
function co(n) {
|
|
462
|
+
return n.transact((e) => {
|
|
463
463
|
const t = _(e.doc, e.selection.anchor);
|
|
464
|
-
if (e.selection instanceof
|
|
464
|
+
if (e.selection instanceof oe)
|
|
465
465
|
return {
|
|
466
466
|
type: "cell",
|
|
467
467
|
anchorBlockId: t.node.attrs.id,
|
|
@@ -474,117 +474,117 @@ function ao(o) {
|
|
|
474
474
|
anchorBlockId: t.node.attrs.id
|
|
475
475
|
};
|
|
476
476
|
{
|
|
477
|
-
const
|
|
477
|
+
const o = _(e.doc, e.selection.head);
|
|
478
478
|
return {
|
|
479
479
|
type: "text",
|
|
480
480
|
anchorBlockId: t.node.attrs.id,
|
|
481
|
-
headBlockId:
|
|
481
|
+
headBlockId: o.node.attrs.id,
|
|
482
482
|
anchorOffset: e.selection.anchor - t.posBeforeNode,
|
|
483
|
-
headOffset: e.selection.head -
|
|
483
|
+
headOffset: e.selection.head - o.posBeforeNode
|
|
484
484
|
};
|
|
485
485
|
}
|
|
486
486
|
});
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function lo(n, e) {
|
|
489
489
|
var s, r;
|
|
490
|
-
const t = (s =
|
|
490
|
+
const t = (s = E(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
|
-
let
|
|
495
|
+
let o;
|
|
496
496
|
if (e.type === "cell")
|
|
497
|
-
|
|
498
|
-
|
|
497
|
+
o = oe.create(
|
|
498
|
+
n.doc,
|
|
499
499
|
t + e.anchorCellOffset,
|
|
500
500
|
t + e.headCellOffset
|
|
501
501
|
);
|
|
502
502
|
else if (e.type === "node")
|
|
503
|
-
|
|
503
|
+
o = L.create(n.doc, t + 1);
|
|
504
504
|
else {
|
|
505
|
-
const a = (r =
|
|
505
|
+
const a = (r = E(e.headBlockId, n.doc)) == null ? void 0 : r.posBeforeNode;
|
|
506
506
|
if (a === void 0)
|
|
507
507
|
throw new Error(
|
|
508
508
|
`Could not find block with ID ${e.headBlockId} to update selection`
|
|
509
509
|
);
|
|
510
|
-
|
|
511
|
-
|
|
510
|
+
o = M.create(
|
|
511
|
+
n.doc,
|
|
512
512
|
t + e.anchorOffset,
|
|
513
513
|
a + e.headOffset
|
|
514
514
|
);
|
|
515
515
|
}
|
|
516
|
-
|
|
516
|
+
n.setSelection(o);
|
|
517
517
|
}
|
|
518
|
-
function
|
|
519
|
-
return
|
|
518
|
+
function J(n) {
|
|
519
|
+
return n.map((e) => e.type === "columnList" ? e.children.map((t) => J(t.children)).flat() : {
|
|
520
520
|
...e,
|
|
521
|
-
children:
|
|
521
|
+
children: J(e.children)
|
|
522
522
|
}).flat();
|
|
523
523
|
}
|
|
524
|
-
function
|
|
525
|
-
|
|
524
|
+
function Ee(n, e, t) {
|
|
525
|
+
n.transact((o) => {
|
|
526
526
|
var a;
|
|
527
|
-
const s = ((a =
|
|
528
|
-
|
|
529
|
-
], r =
|
|
530
|
-
|
|
527
|
+
const s = ((a = n.getSelection()) == null ? void 0 : a.blocks) || [
|
|
528
|
+
n.getTextCursorPosition().block
|
|
529
|
+
], r = co(n);
|
|
530
|
+
n.removeBlocks(s), n.insertBlocks(J(s), e, t), lo(o, r);
|
|
531
531
|
});
|
|
532
532
|
}
|
|
533
|
-
function
|
|
534
|
-
return !
|
|
533
|
+
function xe(n) {
|
|
534
|
+
return !n || n.type !== "columnList";
|
|
535
535
|
}
|
|
536
|
-
function
|
|
537
|
-
let
|
|
538
|
-
if (e ? e.children.length > 0 ? (
|
|
536
|
+
function Me(n, e, t) {
|
|
537
|
+
let o, s;
|
|
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
|
-
const r =
|
|
541
|
-
return
|
|
542
|
-
|
|
543
|
-
s === "after" ?
|
|
540
|
+
const r = n.getParentBlock(o);
|
|
541
|
+
return xe(r) ? { referenceBlock: o, placement: s } : Me(
|
|
542
|
+
n,
|
|
543
|
+
s === "after" ? o : n.getPrevBlock(o),
|
|
544
544
|
r
|
|
545
545
|
);
|
|
546
546
|
}
|
|
547
|
-
function
|
|
548
|
-
let
|
|
549
|
-
if (e ? e.children.length > 0 ? (
|
|
547
|
+
function we(n, e, t) {
|
|
548
|
+
let o, s;
|
|
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
|
-
const r =
|
|
552
|
-
return
|
|
553
|
-
|
|
554
|
-
s === "before" ?
|
|
551
|
+
const r = n.getParentBlock(o);
|
|
552
|
+
return xe(r) ? { referenceBlock: o, placement: s } : we(
|
|
553
|
+
n,
|
|
554
|
+
s === "before" ? o : n.getNextBlock(o),
|
|
555
555
|
r
|
|
556
556
|
);
|
|
557
557
|
}
|
|
558
|
-
function
|
|
559
|
-
|
|
560
|
-
const e =
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
558
|
+
function uo(n) {
|
|
559
|
+
n.transact(() => {
|
|
560
|
+
const e = n.getSelection(), t = (e == null ? void 0 : e.blocks[0]) || n.getTextCursorPosition().block, o = Me(
|
|
561
|
+
n,
|
|
562
|
+
n.getPrevBlock(t),
|
|
563
|
+
n.getParentBlock(t)
|
|
564
564
|
);
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
565
|
+
o && Ee(
|
|
566
|
+
n,
|
|
567
|
+
o.referenceBlock,
|
|
568
|
+
o.placement
|
|
569
569
|
);
|
|
570
570
|
});
|
|
571
571
|
}
|
|
572
|
-
function
|
|
573
|
-
|
|
574
|
-
const e =
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
572
|
+
function po(n) {
|
|
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 = we(
|
|
575
|
+
n,
|
|
576
|
+
n.getNextBlock(t),
|
|
577
|
+
n.getParentBlock(t)
|
|
578
578
|
);
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
579
|
+
o && Ee(
|
|
580
|
+
n,
|
|
581
|
+
o.referenceBlock,
|
|
582
|
+
o.placement
|
|
583
583
|
);
|
|
584
584
|
});
|
|
585
585
|
}
|
|
586
|
-
function
|
|
587
|
-
const { $from:
|
|
586
|
+
function fo(n, e, t) {
|
|
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")
|
|
590
590
|
// change necessary to not look at first item child type
|
|
@@ -605,8 +605,8 @@ function uo(o, e, t) {
|
|
|
605
605
|
l ? 3 : 1,
|
|
606
606
|
0
|
|
607
607
|
), p = r.start, m = r.end;
|
|
608
|
-
return
|
|
609
|
-
new
|
|
608
|
+
return n.step(
|
|
609
|
+
new z(
|
|
610
610
|
p - (l ? 3 : 1),
|
|
611
611
|
m,
|
|
612
612
|
p,
|
|
@@ -617,60 +617,60 @@ function uo(o, e, t) {
|
|
|
617
617
|
)
|
|
618
618
|
).scrollIntoView(), !0;
|
|
619
619
|
}
|
|
620
|
-
function Te(
|
|
621
|
-
return
|
|
620
|
+
function Te(n) {
|
|
621
|
+
return n.transact((e) => fo(
|
|
622
622
|
e,
|
|
623
|
-
|
|
624
|
-
|
|
623
|
+
n.pmSchema.nodes.blockContainer,
|
|
624
|
+
n.pmSchema.nodes.blockGroup
|
|
625
625
|
));
|
|
626
626
|
}
|
|
627
|
-
function
|
|
628
|
-
|
|
627
|
+
function ho(n) {
|
|
628
|
+
n._tiptapEditor.commands.liftListItem("blockContainer");
|
|
629
629
|
}
|
|
630
|
-
function
|
|
631
|
-
return
|
|
630
|
+
function mo(n) {
|
|
631
|
+
return n.transact((e) => {
|
|
632
632
|
const { bnBlock: t } = $(e);
|
|
633
633
|
return e.doc.resolve(t.beforePos).nodeBefore !== null;
|
|
634
634
|
});
|
|
635
635
|
}
|
|
636
|
-
function
|
|
637
|
-
return
|
|
636
|
+
function ko(n) {
|
|
637
|
+
return n.transact((e) => {
|
|
638
638
|
const { bnBlock: t } = $(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,
|
|
642
|
+
function bo(n, e) {
|
|
643
|
+
const t = typeof e == "string" ? e : e.id, o = C(n), s = E(t, n);
|
|
644
644
|
if (s)
|
|
645
|
-
return
|
|
645
|
+
return S(s.node, o);
|
|
646
646
|
}
|
|
647
|
-
function
|
|
648
|
-
const t = typeof e == "string" ? e : e.id,
|
|
649
|
-
if (!
|
|
647
|
+
function go(n, e) {
|
|
648
|
+
const t = typeof e == "string" ? e : e.id, o = E(t, n), s = C(n);
|
|
649
|
+
if (!o)
|
|
650
650
|
return;
|
|
651
|
-
const a =
|
|
651
|
+
const a = n.resolve(o.posBeforeNode).nodeBefore;
|
|
652
652
|
if (a)
|
|
653
|
-
return
|
|
653
|
+
return S(a, s);
|
|
654
654
|
}
|
|
655
|
-
function
|
|
656
|
-
const t = typeof e == "string" ? e : e.id,
|
|
657
|
-
if (!
|
|
655
|
+
function yo(n, e) {
|
|
656
|
+
const t = typeof e == "string" ? e : e.id, o = E(t, n), s = C(n);
|
|
657
|
+
if (!o)
|
|
658
658
|
return;
|
|
659
|
-
const a =
|
|
660
|
-
|
|
659
|
+
const a = n.resolve(
|
|
660
|
+
o.posBeforeNode + o.node.nodeSize
|
|
661
661
|
).nodeAfter;
|
|
662
662
|
if (a)
|
|
663
|
-
return
|
|
663
|
+
return S(a, s);
|
|
664
664
|
}
|
|
665
|
-
function
|
|
666
|
-
const t = typeof e == "string" ? e : e.id,
|
|
665
|
+
function So(n, e) {
|
|
666
|
+
const t = typeof e == "string" ? e : e.id, o = C(n), s = E(t, n);
|
|
667
667
|
if (!s)
|
|
668
668
|
return;
|
|
669
|
-
const r =
|
|
669
|
+
const r = n.resolve(s.posBeforeNode), a = r.node(), c = r.node(-1), i = c.type.name !== "doc" ? a.type.name === "blockGroup" ? c : a : void 0;
|
|
670
670
|
if (i)
|
|
671
|
-
return
|
|
671
|
+
return S(i, o);
|
|
672
672
|
}
|
|
673
|
-
class
|
|
673
|
+
class Bo {
|
|
674
674
|
constructor(e) {
|
|
675
675
|
this.editor = e;
|
|
676
676
|
}
|
|
@@ -679,7 +679,7 @@ class yo {
|
|
|
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) => Ge(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 yo {
|
|
|
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 yo {
|
|
|
701
701
|
* in the document.
|
|
702
702
|
*/
|
|
703
703
|
getPrevBlock(e) {
|
|
704
|
-
return this.editor.transact((t) =>
|
|
704
|
+
return this.editor.transact((t) => go(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 yo {
|
|
|
712
712
|
* the document.
|
|
713
713
|
*/
|
|
714
714
|
getNextBlock(e) {
|
|
715
|
-
return this.editor.transact((t) =>
|
|
715
|
+
return this.editor.transact((t) => yo(t.doc, e));
|
|
716
716
|
}
|
|
717
717
|
/**
|
|
718
718
|
* Gets a snapshot of the parent of an existing block from the editor.
|
|
@@ -723,7 +723,7 @@ class yo {
|
|
|
723
723
|
*/
|
|
724
724
|
getParentBlock(e) {
|
|
725
725
|
return this.editor.transact(
|
|
726
|
-
(t) =>
|
|
726
|
+
(t) => So(t.doc, e)
|
|
727
727
|
);
|
|
728
728
|
}
|
|
729
729
|
/**
|
|
@@ -732,8 +732,8 @@ class yo {
|
|
|
732
732
|
* @param reverse Whether the blocks should be traversed in reverse order.
|
|
733
733
|
*/
|
|
734
734
|
forEachBlock(e, t = !1) {
|
|
735
|
-
const
|
|
736
|
-
t &&
|
|
735
|
+
const o = this.document.slice();
|
|
736
|
+
t && o.reverse();
|
|
737
737
|
function s(r) {
|
|
738
738
|
for (const a of r) {
|
|
739
739
|
if (e(a) === !1)
|
|
@@ -744,7 +744,7 @@ class yo {
|
|
|
744
744
|
}
|
|
745
745
|
return !0;
|
|
746
746
|
}
|
|
747
|
-
s(
|
|
747
|
+
s(o);
|
|
748
748
|
}
|
|
749
749
|
/**
|
|
750
750
|
* Inserts new blocks into the editor. If a block's `id` is undefined, BlockNote generates one automatically. Throws an
|
|
@@ -754,9 +754,9 @@ class yo {
|
|
|
754
754
|
* @param placement Whether the blocks should be inserted just before, just after, or nested inside the
|
|
755
755
|
* `referenceBlock`.
|
|
756
756
|
*/
|
|
757
|
-
insertBlocks(e, t,
|
|
757
|
+
insertBlocks(e, t, o = "before") {
|
|
758
758
|
return this.editor.transact(
|
|
759
|
-
(s) =>
|
|
759
|
+
(s) => Qt(s, e, t, o)
|
|
760
760
|
);
|
|
761
761
|
}
|
|
762
762
|
/**
|
|
@@ -767,7 +767,7 @@ class yo {
|
|
|
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((
|
|
770
|
+
return this.editor.transact((o) => Qe(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.
|
|
@@ -787,14 +787,14 @@ class yo {
|
|
|
787
787
|
*/
|
|
788
788
|
replaceBlocks(e, t) {
|
|
789
789
|
return this.editor.transact(
|
|
790
|
-
(
|
|
790
|
+
(o) => ae(o, e, t)
|
|
791
791
|
);
|
|
792
792
|
}
|
|
793
793
|
/**
|
|
794
794
|
* Checks if the block containing the text cursor can be nested.
|
|
795
795
|
*/
|
|
796
796
|
canNestBlock() {
|
|
797
|
-
return
|
|
797
|
+
return mo(this.editor);
|
|
798
798
|
}
|
|
799
799
|
/**
|
|
800
800
|
* Nests the block containing the text cursor into the block above it.
|
|
@@ -806,13 +806,13 @@ class yo {
|
|
|
806
806
|
* Checks if the block containing the text cursor is nested.
|
|
807
807
|
*/
|
|
808
808
|
canUnnestBlock() {
|
|
809
|
-
return
|
|
809
|
+
return ko(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
|
+
ho(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 yo {
|
|
|
820
820
|
* current blocks share a common parent, moves them out of & before it.
|
|
821
821
|
*/
|
|
822
822
|
moveBlocksUp() {
|
|
823
|
-
return
|
|
823
|
+
return uo(this.editor);
|
|
824
824
|
}
|
|
825
825
|
/**
|
|
826
826
|
* Moves the selected blocks down. If the next block has children, moves
|
|
@@ -828,16 +828,16 @@ class yo {
|
|
|
828
828
|
* current blocks share a common parent, moves them out of & after it.
|
|
829
829
|
*/
|
|
830
830
|
moveBlocksDown() {
|
|
831
|
-
return
|
|
831
|
+
return po(this.editor);
|
|
832
832
|
}
|
|
833
833
|
}
|
|
834
|
-
class
|
|
834
|
+
class Co extends Se {
|
|
835
835
|
constructor(e) {
|
|
836
836
|
super(), this.editor = e, e.on("create", () => {
|
|
837
837
|
e._tiptapEditor.on(
|
|
838
838
|
"update",
|
|
839
|
-
({ transaction: t, appendedTransactions:
|
|
840
|
-
this.emit("onChange", { editor: e, transaction: t, appendedTransactions:
|
|
839
|
+
({ transaction: t, appendedTransactions: o }) => {
|
|
840
|
+
this.emit("onChange", { editor: e, transaction: t, appendedTransactions: o });
|
|
841
841
|
}
|
|
842
842
|
), e._tiptapEditor.on("selectionUpdate", ({ transaction: t }) => {
|
|
843
843
|
this.emit("onSelectionChange", { editor: e, transaction: t });
|
|
@@ -852,32 +852,32 @@ class So extends Se {
|
|
|
852
852
|
* Register a callback that will be called when the editor changes.
|
|
853
853
|
*/
|
|
854
854
|
onChange(e, t = !0) {
|
|
855
|
-
const
|
|
855
|
+
const o = ({
|
|
856
856
|
transaction: s,
|
|
857
857
|
appendedTransactions: r
|
|
858
858
|
}) => {
|
|
859
859
|
!t && ie(s) || e(this.editor, {
|
|
860
860
|
getChanges() {
|
|
861
|
-
return
|
|
861
|
+
return st(
|
|
862
862
|
s,
|
|
863
863
|
r
|
|
864
864
|
);
|
|
865
865
|
}
|
|
866
866
|
});
|
|
867
867
|
};
|
|
868
|
-
return this.on("onChange",
|
|
869
|
-
this.off("onChange",
|
|
868
|
+
return this.on("onChange", o), () => {
|
|
869
|
+
this.off("onChange", o);
|
|
870
870
|
};
|
|
871
871
|
}
|
|
872
872
|
/**
|
|
873
873
|
* Register a callback that will be called when the selection changes.
|
|
874
874
|
*/
|
|
875
875
|
onSelectionChange(e, t = !1) {
|
|
876
|
-
const
|
|
876
|
+
const o = (s) => {
|
|
877
877
|
!t && ie(s.transaction) || e(this.editor);
|
|
878
878
|
};
|
|
879
|
-
return this.on("onSelectionChange",
|
|
880
|
-
this.off("onSelectionChange",
|
|
879
|
+
return this.on("onSelectionChange", o), () => {
|
|
880
|
+
this.off("onSelectionChange", o);
|
|
881
881
|
};
|
|
882
882
|
}
|
|
883
883
|
/**
|
|
@@ -897,118 +897,118 @@ class So extends Se {
|
|
|
897
897
|
};
|
|
898
898
|
}
|
|
899
899
|
}
|
|
900
|
-
function ie(
|
|
901
|
-
return !!
|
|
900
|
+
function ie(n) {
|
|
901
|
+
return !!n.getMeta("y-sync$");
|
|
902
902
|
}
|
|
903
|
-
function
|
|
904
|
-
return Array.prototype.indexOf.call(
|
|
903
|
+
function Eo(n) {
|
|
904
|
+
return Array.prototype.indexOf.call(n.parentElement.childNodes, n);
|
|
905
905
|
}
|
|
906
|
-
function
|
|
907
|
-
return
|
|
906
|
+
function xo(n) {
|
|
907
|
+
return n.nodeType === 3 && !/\S/.test(n.nodeValue || "");
|
|
908
908
|
}
|
|
909
|
-
function
|
|
910
|
-
|
|
911
|
-
const t =
|
|
909
|
+
function Mo(n) {
|
|
910
|
+
n.querySelectorAll("li > ul, li > ol").forEach((e) => {
|
|
911
|
+
const t = Eo(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
|
-
}),
|
|
917
|
-
if (
|
|
916
|
+
}), o.insertAdjacentElement("afterend", e), s.reverse().forEach((r) => {
|
|
917
|
+
if (xo(r))
|
|
918
918
|
return;
|
|
919
919
|
const a = document.createElement("li");
|
|
920
920
|
a.append(r), e.insertAdjacentElement("afterend", a);
|
|
921
|
-
}),
|
|
921
|
+
}), o.childNodes.length === 0 && o.remove();
|
|
922
922
|
});
|
|
923
923
|
}
|
|
924
|
-
function
|
|
925
|
-
|
|
924
|
+
function wo(n) {
|
|
925
|
+
n.querySelectorAll("li + ul, li + ol").forEach((e) => {
|
|
926
926
|
var r, a;
|
|
927
|
-
const t = e.previousElementSibling,
|
|
928
|
-
t.insertAdjacentElement("afterend",
|
|
927
|
+
const t = e.previousElementSibling, o = document.createElement("div");
|
|
928
|
+
t.insertAdjacentElement("afterend", o), o.append(t);
|
|
929
929
|
const s = document.createElement("div");
|
|
930
|
-
for (s.setAttribute("data-node-type", "blockGroup"),
|
|
931
|
-
s.append(
|
|
930
|
+
for (s.setAttribute("data-node-type", "blockGroup"), o.append(s); ((r = o.nextElementSibling) == null ? void 0 : r.nodeName) === "UL" || ((a = o.nextElementSibling) == null ? void 0 : a.nodeName) === "OL"; )
|
|
931
|
+
s.append(o.nextElementSibling);
|
|
932
932
|
});
|
|
933
933
|
}
|
|
934
934
|
let ce = null;
|
|
935
|
-
function
|
|
935
|
+
function To() {
|
|
936
936
|
return ce || (ce = document.implementation.createHTMLDocument("title"));
|
|
937
937
|
}
|
|
938
|
-
function
|
|
939
|
-
if (typeof
|
|
940
|
-
const e =
|
|
941
|
-
e.innerHTML =
|
|
938
|
+
function Po(n) {
|
|
939
|
+
if (typeof n == "string") {
|
|
940
|
+
const e = To().createElement("div");
|
|
941
|
+
e.innerHTML = n, n = e;
|
|
942
942
|
}
|
|
943
|
-
return
|
|
943
|
+
return Mo(n), wo(n), n;
|
|
944
944
|
}
|
|
945
|
-
function Pe(
|
|
946
|
-
const t =
|
|
945
|
+
function Pe(n, e) {
|
|
946
|
+
const t = Po(n), s = He.fromSchema(e).parse(t, {
|
|
947
947
|
topNode: e.nodes.blockGroup.create()
|
|
948
948
|
}), r = [];
|
|
949
949
|
for (let a = 0; a < s.childCount; a++)
|
|
950
|
-
r.push(
|
|
950
|
+
r.push(S(s.child(a), e));
|
|
951
951
|
return r;
|
|
952
952
|
}
|
|
953
|
-
function
|
|
954
|
-
const t = e.value ? e.value : "",
|
|
955
|
-
e.lang && (
|
|
953
|
+
function vo(n, e) {
|
|
954
|
+
const t = e.value ? e.value : "", o = {};
|
|
955
|
+
e.lang && (o["data-language"] = e.lang);
|
|
956
956
|
let s = {
|
|
957
957
|
type: "element",
|
|
958
958
|
tagName: "code",
|
|
959
|
-
properties:
|
|
959
|
+
properties: o,
|
|
960
960
|
children: [{ type: "text", value: t }]
|
|
961
961
|
};
|
|
962
|
-
return e.meta && (s.data = { meta: e.meta }),
|
|
962
|
+
return e.meta && (s.data = { meta: e.meta }), n.patch(e, s), s = n.applyData(e, s), s = {
|
|
963
963
|
type: "element",
|
|
964
964
|
tagName: "pre",
|
|
965
965
|
properties: {},
|
|
966
966
|
children: [s]
|
|
967
|
-
},
|
|
967
|
+
}, n.patch(e, s), s;
|
|
968
968
|
}
|
|
969
|
-
function
|
|
969
|
+
function Io(n, e) {
|
|
970
970
|
var r;
|
|
971
|
-
const t = String((e == null ? void 0 : e.url) || ""),
|
|
971
|
+
const t = String((e == null ? void 0 : e.url) || ""), o = e != null && e.title ? String(e.title) : void 0;
|
|
972
972
|
let s = {
|
|
973
973
|
type: "element",
|
|
974
974
|
tagName: "video",
|
|
975
975
|
properties: {
|
|
976
976
|
src: t,
|
|
977
|
-
"data-name":
|
|
977
|
+
"data-name": o,
|
|
978
978
|
"data-url": t,
|
|
979
979
|
controls: !0
|
|
980
980
|
},
|
|
981
981
|
children: []
|
|
982
982
|
};
|
|
983
|
-
return (r =
|
|
983
|
+
return (r = n.patch) == null || r.call(n, e, s), s = n.applyData ? n.applyData(e, s) : s, s;
|
|
984
984
|
}
|
|
985
|
-
function ve(
|
|
986
|
-
return
|
|
985
|
+
function ve(n) {
|
|
986
|
+
return Kt().use(jt).use(Rt).use(Wt, {
|
|
987
987
|
handlers: {
|
|
988
988
|
...re,
|
|
989
|
-
image: (t,
|
|
990
|
-
const s = String((
|
|
991
|
-
return
|
|
989
|
+
image: (t, o) => {
|
|
990
|
+
const s = String((o == null ? void 0 : o.url) || "");
|
|
991
|
+
return Xe(s) ? Io(t, o) : re.image(t, o);
|
|
992
992
|
},
|
|
993
|
-
code:
|
|
994
|
-
blockquote: (t,
|
|
993
|
+
code: vo,
|
|
994
|
+
blockquote: (t, o) => {
|
|
995
995
|
const s = {
|
|
996
996
|
type: "element",
|
|
997
997
|
tagName: "blockquote",
|
|
998
998
|
properties: {},
|
|
999
999
|
// The only difference from the original is that we don't wrap the children with line endings
|
|
1000
|
-
children: t.wrap(t.all(
|
|
1000
|
+
children: t.wrap(t.all(o), !1)
|
|
1001
1001
|
};
|
|
1002
|
-
return t.patch(
|
|
1002
|
+
return t.patch(o, s), t.applyData(o, s);
|
|
1003
1003
|
}
|
|
1004
1004
|
}
|
|
1005
|
-
}).use(
|
|
1005
|
+
}).use(qt).processSync(n).value;
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1008
|
-
const t = ve(
|
|
1007
|
+
function Ao(n, e) {
|
|
1008
|
+
const t = ve(n);
|
|
1009
1009
|
return Pe(t, e);
|
|
1010
1010
|
}
|
|
1011
|
-
class
|
|
1011
|
+
class _o {
|
|
1012
1012
|
constructor(e) {
|
|
1013
1013
|
this.editor = e;
|
|
1014
1014
|
}
|
|
@@ -1020,7 +1020,7 @@ class Io {
|
|
|
1020
1020
|
* @returns The blocks, serialized as an HTML string.
|
|
1021
1021
|
*/
|
|
1022
1022
|
blocksToHTMLLossy(e = this.editor.document) {
|
|
1023
|
-
return
|
|
1023
|
+
return ge(
|
|
1024
1024
|
this.editor.pmSchema,
|
|
1025
1025
|
this.editor
|
|
1026
1026
|
).exportBlocks(e, {});
|
|
@@ -1035,7 +1035,7 @@ class Io {
|
|
|
1035
1035
|
* @returns The blocks, serialized as an HTML string.
|
|
1036
1036
|
*/
|
|
1037
1037
|
blocksToFullHTML(e = this.editor.document) {
|
|
1038
|
-
return
|
|
1038
|
+
return io(
|
|
1039
1039
|
this.editor.pmSchema,
|
|
1040
1040
|
this.editor
|
|
1041
1041
|
).serializeBlocks(e, {});
|
|
@@ -1057,7 +1057,7 @@ class Io {
|
|
|
1057
1057
|
* @returns The blocks, serialized as a Markdown string.
|
|
1058
1058
|
*/
|
|
1059
1059
|
blocksToMarkdownLossy(e = this.editor.document) {
|
|
1060
|
-
return
|
|
1060
|
+
return rt(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 Io {
|
|
|
1067
1067
|
* @returns The blocks parsed from the Markdown string.
|
|
1068
1068
|
*/
|
|
1069
1069
|
tryParseMarkdownToBlocks(e) {
|
|
1070
|
-
return
|
|
1070
|
+
return Ao(e, this.editor.pmSchema);
|
|
1071
1071
|
}
|
|
1072
1072
|
/**
|
|
1073
1073
|
* Paste HTML into the editor. Defaults to converting HTML to BlockNote HTML.
|
|
@@ -1076,12 +1076,12 @@ class Io {
|
|
|
1076
1076
|
*/
|
|
1077
1077
|
pasteHTML(e, t = !1) {
|
|
1078
1078
|
var s;
|
|
1079
|
-
let
|
|
1079
|
+
let o = e;
|
|
1080
1080
|
if (!t) {
|
|
1081
1081
|
const r = this.tryParseHTMLToBlocks(e);
|
|
1082
|
-
|
|
1082
|
+
o = this.blocksToFullHTML(r);
|
|
1083
1083
|
}
|
|
1084
|
-
|
|
1084
|
+
o && ((s = this.editor.prosemirrorView) == null || s.pasteHTML(o));
|
|
1085
1085
|
}
|
|
1086
1086
|
/**
|
|
1087
1087
|
* Paste text into the editor. Defaults to interpreting text as markdown.
|
|
@@ -1100,7 +1100,7 @@ class Io {
|
|
|
1100
1100
|
return this.pasteHTML(t);
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
|
-
const
|
|
1103
|
+
const ne = [
|
|
1104
1104
|
"vscode-editor-data",
|
|
1105
1105
|
"blocknote/html",
|
|
1106
1106
|
"text/markdown",
|
|
@@ -1108,28 +1108,28 @@ const oe = [
|
|
|
1108
1108
|
"text/plain",
|
|
1109
1109
|
"Files"
|
|
1110
1110
|
];
|
|
1111
|
-
function
|
|
1112
|
-
if (!
|
|
1111
|
+
function Do(n, e) {
|
|
1112
|
+
if (!n.startsWith(".") || !e.startsWith("."))
|
|
1113
1113
|
throw new Error("The strings provided are not valid file extensions.");
|
|
1114
|
-
return
|
|
1114
|
+
return n === e;
|
|
1115
1115
|
}
|
|
1116
|
-
function
|
|
1117
|
-
const t =
|
|
1116
|
+
function Lo(n, e) {
|
|
1117
|
+
const t = n.split("/"), o = e.split("/");
|
|
1118
1118
|
if (t.length !== 2)
|
|
1119
|
-
throw new Error(`The string ${
|
|
1120
|
-
if (
|
|
1119
|
+
throw new Error(`The string ${n} is not a valid MIME type.`);
|
|
1120
|
+
if (o.length !== 2)
|
|
1121
1121
|
throw new Error(`The string ${e} is not a valid MIME type.`);
|
|
1122
|
-
return t[1] === "*" ||
|
|
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 le(
|
|
1124
|
+
function le(n, e, t, o = "after") {
|
|
1125
1125
|
let s;
|
|
1126
|
-
return Array.isArray(e.content) && e.content.length === 0 ? s =
|
|
1126
|
+
return Array.isArray(e.content) && e.content.length === 0 ? s = n.updateBlock(e, t).id : s = n.insertBlocks(
|
|
1127
1127
|
[t],
|
|
1128
1128
|
e,
|
|
1129
|
-
|
|
1129
|
+
o
|
|
1130
1130
|
)[0].id, s;
|
|
1131
1131
|
}
|
|
1132
|
-
async function Ie(
|
|
1132
|
+
async function Ie(n, e) {
|
|
1133
1133
|
var r;
|
|
1134
1134
|
if (!e.uploadFile) {
|
|
1135
1135
|
console.warn(
|
|
@@ -1137,26 +1137,26 @@ async function Ie(o, e) {
|
|
|
1137
1137
|
);
|
|
1138
1138
|
return;
|
|
1139
1139
|
}
|
|
1140
|
-
const t = "dataTransfer" in
|
|
1140
|
+
const t = "dataTransfer" in n ? n.dataTransfer : n.clipboardData;
|
|
1141
1141
|
if (t === null)
|
|
1142
1142
|
return;
|
|
1143
|
-
let
|
|
1144
|
-
for (const a of
|
|
1143
|
+
let o = null;
|
|
1144
|
+
for (const a of ne)
|
|
1145
1145
|
if (t.types.includes(a)) {
|
|
1146
|
-
|
|
1146
|
+
o = a;
|
|
1147
1147
|
break;
|
|
1148
1148
|
}
|
|
1149
|
-
if (
|
|
1149
|
+
if (o !== "Files")
|
|
1150
1150
|
return;
|
|
1151
1151
|
const s = t.items;
|
|
1152
1152
|
if (s) {
|
|
1153
|
-
|
|
1153
|
+
n.preventDefault();
|
|
1154
1154
|
for (let a = 0; a < s.length; a++) {
|
|
1155
1155
|
let c = "file";
|
|
1156
1156
|
for (const l of Object.values(e.schema.blockSpecs))
|
|
1157
1157
|
for (const d of ((r = l.implementation.meta) == null ? void 0 : r.fileBlockAccept) || []) {
|
|
1158
1158
|
const u = d.startsWith("."), p = s[a].getAsFile();
|
|
1159
|
-
if (p && (!u && p.type &&
|
|
1159
|
+
if (p && (!u && p.type && Lo(s[a].type, d) || u && Do(
|
|
1160
1160
|
"." + p.name.split(".").pop(),
|
|
1161
1161
|
d
|
|
1162
1162
|
))) {
|
|
@@ -1173,26 +1173,26 @@ async function Ie(o, e) {
|
|
|
1173
1173
|
}
|
|
1174
1174
|
};
|
|
1175
1175
|
let d;
|
|
1176
|
-
if (
|
|
1176
|
+
if (n.type === "paste") {
|
|
1177
1177
|
const m = e.getTextCursorPosition().block;
|
|
1178
1178
|
d = le(e, m, l);
|
|
1179
|
-
} else if (
|
|
1179
|
+
} else if (n.type === "drop") {
|
|
1180
1180
|
const m = {
|
|
1181
|
-
left:
|
|
1182
|
-
top:
|
|
1181
|
+
left: n.clientX,
|
|
1182
|
+
top: n.clientY
|
|
1183
1183
|
}, f = e.prosemirrorView.posAtCoords(m);
|
|
1184
1184
|
if (!f)
|
|
1185
1185
|
return;
|
|
1186
1186
|
d = e.transact((k) => {
|
|
1187
|
-
var
|
|
1188
|
-
const
|
|
1189
|
-
`[data-id="${
|
|
1190
|
-
),
|
|
1187
|
+
var y;
|
|
1188
|
+
const b = _(k.doc, f.pos), g = (y = e.domElement) == null ? void 0 : y.querySelector(
|
|
1189
|
+
`[data-id="${b.node.attrs.id}"]`
|
|
1190
|
+
), w = g == null ? void 0 : g.getBoundingClientRect();
|
|
1191
1191
|
return le(
|
|
1192
1192
|
e,
|
|
1193
|
-
e.getBlock(
|
|
1193
|
+
e.getBlock(b.node.attrs.id),
|
|
1194
1194
|
l,
|
|
1195
|
-
|
|
1195
|
+
w && (w.top + w.bottom) / 2 > m.top ? "before" : "after"
|
|
1196
1196
|
);
|
|
1197
1197
|
});
|
|
1198
1198
|
} else
|
|
@@ -1207,104 +1207,104 @@ async function Ie(o, e) {
|
|
|
1207
1207
|
}
|
|
1208
1208
|
}
|
|
1209
1209
|
}
|
|
1210
|
-
const
|
|
1210
|
+
const No = (n) => x.create({
|
|
1211
1211
|
name: "dropFile",
|
|
1212
1212
|
addProseMirrorPlugins() {
|
|
1213
1213
|
return [
|
|
1214
|
-
new
|
|
1214
|
+
new te({
|
|
1215
1215
|
props: {
|
|
1216
1216
|
handleDOMEvents: {
|
|
1217
1217
|
drop(e, t) {
|
|
1218
|
-
if (!
|
|
1218
|
+
if (!n.isEditable)
|
|
1219
1219
|
return;
|
|
1220
|
-
let
|
|
1221
|
-
for (const s of
|
|
1220
|
+
let o = null;
|
|
1221
|
+
for (const s of ne)
|
|
1222
1222
|
if (t.dataTransfer.types.includes(s)) {
|
|
1223
|
-
|
|
1223
|
+
o = s;
|
|
1224
1224
|
break;
|
|
1225
1225
|
}
|
|
1226
|
-
return
|
|
1226
|
+
return o === null ? !0 : o === "Files" ? (Ie(t, n), !0) : !1;
|
|
1227
1227
|
}
|
|
1228
1228
|
}
|
|
1229
1229
|
}
|
|
1230
1230
|
})
|
|
1231
1231
|
];
|
|
1232
1232
|
}
|
|
1233
|
-
}),
|
|
1234
|
-
async function
|
|
1233
|
+
}), Oo = /(^|\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)/, $o = /\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/, Ho = /(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/, Vo = /(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/, Uo = /(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/, zo = /\n{2} {0,3}-{2,48}\n{2}/, Go = /(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/, Ro = /(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/, jo = /(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/, Wo = /^\s*\|(.+\|)+\s*$/m, qo = /^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m, Ko = /^\s*\|(.+\|)+\s*$/m, Jo = (n) => Oo.test(n) || Fo.test(n) || $o.test(n) || Ho.test(n) || Vo.test(n) || Uo.test(n) || zo.test(n) || Go.test(n) || Ro.test(n) || jo.test(n) || Wo.test(n) || qo.test(n) || Ko.test(n);
|
|
1234
|
+
async function Yo(n, e) {
|
|
1235
1235
|
const { schema: t } = e.state;
|
|
1236
|
-
if (!
|
|
1236
|
+
if (!n.clipboardData)
|
|
1237
1237
|
return !1;
|
|
1238
|
-
const
|
|
1239
|
-
if (!
|
|
1238
|
+
const o = n.clipboardData.getData("text/plain");
|
|
1239
|
+
if (!o)
|
|
1240
1240
|
return !1;
|
|
1241
1241
|
if (!t.nodes.codeBlock)
|
|
1242
|
-
return e.pasteText(
|
|
1243
|
-
const s =
|
|
1242
|
+
return e.pasteText(o), !0;
|
|
1243
|
+
const s = n.clipboardData.getData("vscode-editor-data"), r = s ? JSON.parse(s) : void 0, a = r == null ? void 0 : r.mode;
|
|
1244
1244
|
return a ? (e.pasteHTML(
|
|
1245
|
-
`<pre><code class="language-${a}">${
|
|
1245
|
+
`<pre><code class="language-${a}">${o.replace(
|
|
1246
1246
|
/\r\n?/g,
|
|
1247
1247
|
`
|
|
1248
1248
|
`
|
|
1249
1249
|
)}</code></pre>`
|
|
1250
1250
|
), !0) : !1;
|
|
1251
1251
|
}
|
|
1252
|
-
function
|
|
1253
|
-
event:
|
|
1252
|
+
function Qo({
|
|
1253
|
+
event: n,
|
|
1254
1254
|
editor: e,
|
|
1255
1255
|
prioritizeMarkdownOverHTML: t,
|
|
1256
|
-
plainTextAsMarkdown:
|
|
1256
|
+
plainTextAsMarkdown: o
|
|
1257
1257
|
}) {
|
|
1258
1258
|
var c;
|
|
1259
1259
|
if (e.transact(
|
|
1260
1260
|
(i) => i.selection.$from.parent.type.spec.code && i.selection.$to.parent.type.spec.code
|
|
1261
1261
|
)) {
|
|
1262
|
-
const i = (c =
|
|
1262
|
+
const i = (c = n.clipboardData) == null ? void 0 : c.getData("text/plain");
|
|
1263
1263
|
if (i)
|
|
1264
1264
|
return e.pasteText(i), !0;
|
|
1265
1265
|
}
|
|
1266
1266
|
let r;
|
|
1267
|
-
for (const i of
|
|
1268
|
-
if (
|
|
1267
|
+
for (const i of ne)
|
|
1268
|
+
if (n.clipboardData.types.includes(i)) {
|
|
1269
1269
|
r = i;
|
|
1270
1270
|
break;
|
|
1271
1271
|
}
|
|
1272
1272
|
if (!r)
|
|
1273
1273
|
return !0;
|
|
1274
1274
|
if (r === "vscode-editor-data")
|
|
1275
|
-
return
|
|
1275
|
+
return Yo(n, e.prosemirrorView), !0;
|
|
1276
1276
|
if (r === "Files")
|
|
1277
|
-
return Ie(
|
|
1278
|
-
const a =
|
|
1277
|
+
return Ie(n, e), !0;
|
|
1278
|
+
const a = n.clipboardData.getData(r);
|
|
1279
1279
|
if (r === "blocknote/html")
|
|
1280
1280
|
return e.pasteHTML(a, !0), !0;
|
|
1281
1281
|
if (r === "text/markdown")
|
|
1282
1282
|
return e.pasteMarkdown(a), !0;
|
|
1283
1283
|
if (t) {
|
|
1284
|
-
const i =
|
|
1285
|
-
if (
|
|
1284
|
+
const i = n.clipboardData.getData("text/plain");
|
|
1285
|
+
if (Jo(i))
|
|
1286
1286
|
return e.pasteMarkdown(i), !0;
|
|
1287
1287
|
}
|
|
1288
|
-
return r === "text/html" ? (e.pasteHTML(a), !0) :
|
|
1288
|
+
return r === "text/html" ? (e.pasteHTML(a), !0) : o ? (e.pasteMarkdown(a), !0) : (e.pasteText(a), !0);
|
|
1289
1289
|
}
|
|
1290
|
-
const
|
|
1290
|
+
const Xo = (n, e) => x.create({
|
|
1291
1291
|
name: "pasteFromClipboard",
|
|
1292
1292
|
addProseMirrorPlugins() {
|
|
1293
1293
|
return [
|
|
1294
|
-
new
|
|
1294
|
+
new te({
|
|
1295
1295
|
props: {
|
|
1296
1296
|
handleDOMEvents: {
|
|
1297
|
-
paste(t,
|
|
1298
|
-
if (
|
|
1297
|
+
paste(t, o) {
|
|
1298
|
+
if (o.preventDefault(), !!n.isEditable)
|
|
1299
1299
|
return e({
|
|
1300
|
-
event:
|
|
1301
|
-
editor:
|
|
1300
|
+
event: o,
|
|
1301
|
+
editor: n,
|
|
1302
1302
|
defaultPasteHandler: ({
|
|
1303
1303
|
prioritizeMarkdownOverHTML: s = !0,
|
|
1304
1304
|
plainTextAsMarkdown: r = !0
|
|
1305
|
-
} = {}) =>
|
|
1306
|
-
event:
|
|
1307
|
-
editor:
|
|
1305
|
+
} = {}) => Qo({
|
|
1306
|
+
event: o,
|
|
1307
|
+
editor: n,
|
|
1308
1308
|
prioritizeMarkdownOverHTML: s,
|
|
1309
1309
|
plainTextAsMarkdown: r
|
|
1310
1310
|
})
|
|
@@ -1316,30 +1316,30 @@ const Yo = (o, e) => E.create({
|
|
|
1316
1316
|
];
|
|
1317
1317
|
}
|
|
1318
1318
|
});
|
|
1319
|
-
function
|
|
1319
|
+
function Zo(n, e, t) {
|
|
1320
1320
|
var c;
|
|
1321
|
-
let
|
|
1322
|
-
const s =
|
|
1321
|
+
let o = !1;
|
|
1322
|
+
const s = n.state.selection instanceof oe;
|
|
1323
1323
|
if (!s) {
|
|
1324
|
-
const i =
|
|
1325
|
-
|
|
1326
|
-
|
|
1324
|
+
const i = n.state.doc.slice(
|
|
1325
|
+
n.state.selection.from,
|
|
1326
|
+
n.state.selection.to,
|
|
1327
1327
|
!1
|
|
1328
1328
|
).content, l = [];
|
|
1329
1329
|
for (let d = 0; d < i.childCount; d++)
|
|
1330
1330
|
l.push(i.child(d));
|
|
1331
|
-
|
|
1331
|
+
o = l.find(
|
|
1332
1332
|
(d) => d.type.isInGroup("bnBlock") || d.type.name === "blockGroup" || d.type.spec.group === "blockContent"
|
|
1333
|
-
) === void 0,
|
|
1333
|
+
) === void 0, o && (e = i);
|
|
1334
1334
|
}
|
|
1335
1335
|
let r;
|
|
1336
|
-
const a =
|
|
1337
|
-
|
|
1336
|
+
const a = ge(
|
|
1337
|
+
n.state.schema,
|
|
1338
1338
|
t
|
|
1339
1339
|
);
|
|
1340
1340
|
if (s) {
|
|
1341
1341
|
((c = e.firstChild) == null ? void 0 : c.type.name) === "table" && (e = e.firstChild.content);
|
|
1342
|
-
const i =
|
|
1342
|
+
const i = Re(
|
|
1343
1343
|
e,
|
|
1344
1344
|
t.schema.inlineContentSchema,
|
|
1345
1345
|
t.schema.styleSchema
|
|
@@ -1348,64 +1348,64 @@ function Qo(o, e, t) {
|
|
|
1348
1348
|
i,
|
|
1349
1349
|
{}
|
|
1350
1350
|
)}</table>`;
|
|
1351
|
-
} else if (
|
|
1352
|
-
const i =
|
|
1351
|
+
} else if (o) {
|
|
1352
|
+
const i = je(
|
|
1353
1353
|
e,
|
|
1354
1354
|
t.schema.inlineContentSchema,
|
|
1355
1355
|
t.schema.styleSchema
|
|
1356
1356
|
);
|
|
1357
1357
|
r = a.exportInlineContent(i, {});
|
|
1358
1358
|
} else {
|
|
1359
|
-
const i =
|
|
1359
|
+
const i = it(e);
|
|
1360
1360
|
r = a.exportBlocks(i, {});
|
|
1361
1361
|
}
|
|
1362
1362
|
return r;
|
|
1363
1363
|
}
|
|
1364
|
-
function Ae(
|
|
1365
|
-
"node" in
|
|
1364
|
+
function Ae(n, e) {
|
|
1365
|
+
"node" in n.state.selection && n.state.selection.node.type.spec.group === "blockContent" && e.transact(
|
|
1366
1366
|
(a) => a.setSelection(
|
|
1367
|
-
new L(a.doc.resolve(
|
|
1367
|
+
new L(a.doc.resolve(n.state.selection.from - 1))
|
|
1368
1368
|
)
|
|
1369
1369
|
);
|
|
1370
|
-
const t =
|
|
1371
|
-
|
|
1372
|
-
).dom.innerHTML,
|
|
1373
|
-
o,
|
|
1370
|
+
const t = n.serializeForClipboard(
|
|
1371
|
+
n.state.selection.content()
|
|
1372
|
+
).dom.innerHTML, o = n.state.selection.content().content, s = Zo(
|
|
1374
1373
|
n,
|
|
1374
|
+
o,
|
|
1375
1375
|
e
|
|
1376
|
-
), r =
|
|
1376
|
+
), r = at(s);
|
|
1377
1377
|
return { clipboardHTML: t, externalHTML: s, markdown: r };
|
|
1378
1378
|
}
|
|
1379
1379
|
const de = () => {
|
|
1380
|
-
const
|
|
1381
|
-
if (!
|
|
1380
|
+
const n = window.getSelection();
|
|
1381
|
+
if (!n || n.isCollapsed)
|
|
1382
1382
|
return !0;
|
|
1383
|
-
let e =
|
|
1383
|
+
let e = n.focusNode;
|
|
1384
1384
|
for (; e; ) {
|
|
1385
1385
|
if (e instanceof HTMLElement && e.getAttribute("contenteditable") === "false")
|
|
1386
1386
|
return !0;
|
|
1387
1387
|
e = e.parentElement;
|
|
1388
1388
|
}
|
|
1389
1389
|
return !1;
|
|
1390
|
-
}, ue = (
|
|
1390
|
+
}, ue = (n, e, t) => {
|
|
1391
1391
|
t.preventDefault(), t.clipboardData.clearData();
|
|
1392
|
-
const { clipboardHTML:
|
|
1392
|
+
const { clipboardHTML: o, externalHTML: s, markdown: r } = Ae(
|
|
1393
1393
|
e,
|
|
1394
|
-
|
|
1394
|
+
n
|
|
1395
1395
|
);
|
|
1396
|
-
t.clipboardData.setData("blocknote/html",
|
|
1397
|
-
},
|
|
1396
|
+
t.clipboardData.setData("blocknote/html", o), t.clipboardData.setData("text/html", s), t.clipboardData.setData("text/plain", r);
|
|
1397
|
+
}, en = (n) => x.create({
|
|
1398
1398
|
name: "copyToClipboard",
|
|
1399
1399
|
addProseMirrorPlugins() {
|
|
1400
1400
|
return [
|
|
1401
|
-
new
|
|
1401
|
+
new te({
|
|
1402
1402
|
props: {
|
|
1403
1403
|
handleDOMEvents: {
|
|
1404
1404
|
copy(e, t) {
|
|
1405
|
-
return de() || ue(
|
|
1405
|
+
return de() || ue(n, e, t), !0;
|
|
1406
1406
|
},
|
|
1407
1407
|
cut(e, t) {
|
|
1408
|
-
return de() || (ue(
|
|
1408
|
+
return de() || (ue(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
|
|
@@ -1413,34 +1413,34 @@ const de = () => {
|
|
|
1413
1413
|
dragstart(e, t) {
|
|
1414
1414
|
if (!("node" in e.state.selection) || e.state.selection.node.type.spec.group !== "blockContent")
|
|
1415
1415
|
return;
|
|
1416
|
-
|
|
1416
|
+
n.transact(
|
|
1417
1417
|
(a) => a.setSelection(
|
|
1418
1418
|
new L(
|
|
1419
1419
|
a.doc.resolve(e.state.selection.from - 1)
|
|
1420
1420
|
)
|
|
1421
1421
|
)
|
|
1422
1422
|
), t.preventDefault(), t.dataTransfer.clearData();
|
|
1423
|
-
const { clipboardHTML:
|
|
1424
|
-
return t.dataTransfer.setData("blocknote/html",
|
|
1423
|
+
const { clipboardHTML: o, externalHTML: s, markdown: r } = Ae(e, n);
|
|
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
|
}
|
|
1427
1427
|
}
|
|
1428
1428
|
})
|
|
1429
1429
|
];
|
|
1430
1430
|
}
|
|
1431
|
-
}),
|
|
1431
|
+
}), tn = x.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: Ze()
|
|
1439
1439
|
}
|
|
1440
1440
|
}
|
|
1441
1441
|
];
|
|
1442
1442
|
}
|
|
1443
|
-
}),
|
|
1443
|
+
}), on = D.create({
|
|
1444
1444
|
name: "hardBreak",
|
|
1445
1445
|
inline: !0,
|
|
1446
1446
|
group: "inline",
|
|
@@ -1450,61 +1450,61 @@ const de = () => {
|
|
|
1450
1450
|
parseHTML() {
|
|
1451
1451
|
return [{ tag: "br" }];
|
|
1452
1452
|
},
|
|
1453
|
-
renderHTML({ HTMLAttributes:
|
|
1454
|
-
return ["br", wt(this.options.HTMLAttributes,
|
|
1453
|
+
renderHTML({ HTMLAttributes: n }) {
|
|
1454
|
+
return ["br", wt(this.options.HTMLAttributes, n)];
|
|
1455
1455
|
},
|
|
1456
1456
|
renderText() {
|
|
1457
1457
|
return `
|
|
1458
1458
|
`;
|
|
1459
1459
|
}
|
|
1460
|
-
}),
|
|
1461
|
-
const t =
|
|
1462
|
-
if (
|
|
1460
|
+
}), Y = (n, e) => {
|
|
1461
|
+
const t = n.resolve(e), o = t.index();
|
|
1462
|
+
if (o === 0)
|
|
1463
1463
|
return;
|
|
1464
|
-
const s = t.posAtIndex(
|
|
1465
|
-
return
|
|
1466
|
-
|
|
1464
|
+
const s = t.posAtIndex(o - 1);
|
|
1465
|
+
return X(
|
|
1466
|
+
n.resolve(s)
|
|
1467
1467
|
);
|
|
1468
|
-
}, _e = (
|
|
1468
|
+
}, _e = (n, e) => {
|
|
1469
1469
|
for (; e.childContainer; ) {
|
|
1470
|
-
const t = e.childContainer.node,
|
|
1471
|
-
e =
|
|
1470
|
+
const t = e.childContainer.node, o = n.resolve(e.childContainer.beforePos + 1).posAtIndex(t.childCount - 1);
|
|
1471
|
+
e = X(n.resolve(o));
|
|
1472
1472
|
}
|
|
1473
1473
|
return e;
|
|
1474
|
-
},
|
|
1475
|
-
if (!
|
|
1474
|
+
}, nn = (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*", sn = (n, e, t, o) => {
|
|
1475
|
+
if (!o.isBlockContainer)
|
|
1476
1476
|
throw new Error(
|
|
1477
|
-
`Attempted to merge block at position ${
|
|
1477
|
+
`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`
|
|
1478
1478
|
);
|
|
1479
|
-
if (
|
|
1480
|
-
const s =
|
|
1481
|
-
|
|
1482
|
-
), r =
|
|
1483
|
-
|
|
1479
|
+
if (o.childContainer) {
|
|
1480
|
+
const s = n.doc.resolve(
|
|
1481
|
+
o.childContainer.beforePos + 1
|
|
1482
|
+
), r = n.doc.resolve(
|
|
1483
|
+
o.childContainer.afterPos - 1
|
|
1484
1484
|
), a = s.blockRange(r);
|
|
1485
1485
|
if (e) {
|
|
1486
|
-
const c =
|
|
1487
|
-
|
|
1486
|
+
const c = n.doc.resolve(o.bnBlock.beforePos);
|
|
1487
|
+
n.tr.lift(a, c.depth);
|
|
1488
1488
|
}
|
|
1489
1489
|
}
|
|
1490
1490
|
if (e) {
|
|
1491
1491
|
if (!t.isBlockContainer)
|
|
1492
1492
|
throw new Error(
|
|
1493
|
-
`Attempted to merge block at position ${
|
|
1493
|
+
`Attempted to merge block at position ${o.bnBlock.beforePos} into previous block at position ${t.bnBlock.beforePos}, but previous block is not a block container`
|
|
1494
1494
|
);
|
|
1495
1495
|
e(
|
|
1496
|
-
|
|
1496
|
+
n.tr.delete(
|
|
1497
1497
|
t.blockContent.afterPos - 1,
|
|
1498
|
-
|
|
1498
|
+
o.blockContent.beforePos + 1
|
|
1499
1499
|
)
|
|
1500
1500
|
);
|
|
1501
1501
|
}
|
|
1502
1502
|
return !0;
|
|
1503
|
-
}, pe = (
|
|
1503
|
+
}, pe = (n) => ({
|
|
1504
1504
|
state: e,
|
|
1505
1505
|
dispatch: t
|
|
1506
1506
|
}) => {
|
|
1507
|
-
const
|
|
1507
|
+
const o = e.doc.resolve(n), s = X(o), r = Y(
|
|
1508
1508
|
e.doc,
|
|
1509
1509
|
s.bnBlock.beforePos
|
|
1510
1510
|
);
|
|
@@ -1514,13 +1514,13 @@ const de = () => {
|
|
|
1514
1514
|
e.doc,
|
|
1515
1515
|
r
|
|
1516
1516
|
);
|
|
1517
|
-
return
|
|
1518
|
-
},
|
|
1517
|
+
return nn(a, s) ? sn(e, t, a, s) : !1;
|
|
1518
|
+
}, rn = x.create({
|
|
1519
1519
|
priority: 50,
|
|
1520
1520
|
// TODO: The shortcuts need a refactor. Do we want to use a command priority
|
|
1521
1521
|
// design as there is now, or clump the logic into a single function?
|
|
1522
1522
|
addKeyboardShortcuts() {
|
|
1523
|
-
const
|
|
1523
|
+
const n = () => this.editor.commands.first(({ chain: o, commands: s }) => [
|
|
1524
1524
|
// Deletes the selection if it's not empty.
|
|
1525
1525
|
() => s.deleteSelection(),
|
|
1526
1526
|
// Undoes an input rule if one was triggered in the last editor state change.
|
|
@@ -1532,7 +1532,7 @@ const de = () => {
|
|
|
1532
1532
|
return !1;
|
|
1533
1533
|
const c = r.selection.from === a.blockContent.beforePos + 1, i = a.blockContent.node.type.name === "paragraph";
|
|
1534
1534
|
return c && !i ? s.command(
|
|
1535
|
-
|
|
1535
|
+
tt(a.bnBlock.beforePos, {
|
|
1536
1536
|
type: "paragraph",
|
|
1537
1537
|
props: {}
|
|
1538
1538
|
})
|
|
@@ -1553,7 +1553,7 @@ const de = () => {
|
|
|
1553
1553
|
if (!a.isBlockContainer)
|
|
1554
1554
|
return !1;
|
|
1555
1555
|
const { bnBlock: c, blockContent: i } = a, l = r.selection.from === i.beforePos + 1, d = r.selection.empty, u = c.beforePos;
|
|
1556
|
-
return l && d ?
|
|
1556
|
+
return l && d ? o().command(pe(u)).scrollIntoView().run() : !1;
|
|
1557
1557
|
}),
|
|
1558
1558
|
() => s.command(({ state: r, tr: a, dispatch: c }) => {
|
|
1559
1559
|
const i = B(r);
|
|
@@ -1564,50 +1564,54 @@ const de = () => {
|
|
|
1564
1564
|
return !1;
|
|
1565
1565
|
const m = a.doc.resolve(i.bnBlock.beforePos), f = a.doc.resolve(m.before()), k = f.before();
|
|
1566
1566
|
if (c) {
|
|
1567
|
-
const
|
|
1567
|
+
const b = a.doc.slice(
|
|
1568
1568
|
i.bnBlock.beforePos,
|
|
1569
1569
|
i.bnBlock.afterPos
|
|
1570
1570
|
).content;
|
|
1571
1571
|
a.delete(
|
|
1572
1572
|
i.bnBlock.beforePos,
|
|
1573
1573
|
i.bnBlock.afterPos
|
|
1574
|
-
), f.index() === 0 ? (
|
|
1575
|
-
|
|
1576
|
-
)) : (a.insert(f.pos - 1,
|
|
1577
|
-
|
|
1578
|
-
),
|
|
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
1579
|
}
|
|
1580
1580
|
return !0;
|
|
1581
1581
|
}),
|
|
1582
1582
|
// Deletes the current block if it's an empty block with inline content,
|
|
1583
1583
|
// and moves the selection to the previous block.
|
|
1584
1584
|
() => s.command(({ state: r }) => {
|
|
1585
|
+
var i;
|
|
1585
1586
|
const a = B(r);
|
|
1586
1587
|
if (!a.isBlockContainer)
|
|
1587
1588
|
return !1;
|
|
1588
1589
|
if (a.blockContent.node.childCount === 0 && a.blockContent.node.type.spec.content === "inline*") {
|
|
1589
|
-
const
|
|
1590
|
+
const l = Y(
|
|
1590
1591
|
r.doc,
|
|
1591
1592
|
a.bnBlock.beforePos
|
|
1592
1593
|
);
|
|
1593
|
-
if (!
|
|
1594
|
+
if (!l || !l.isBlockContainer)
|
|
1594
1595
|
return !1;
|
|
1595
|
-
let
|
|
1596
|
-
if (
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1596
|
+
let d = o();
|
|
1597
|
+
if (a.childContainer && d.insertContentAt(
|
|
1598
|
+
a.bnBlock.afterPos,
|
|
1599
|
+
(i = a.childContainer) == null ? void 0 : i.node.content
|
|
1600
|
+
), l.blockContent.node.type.spec.content === "tableRow+") {
|
|
1601
|
+
const k = a.bnBlock.beforePos - 1 - 1 - 1 - 1 - 1;
|
|
1602
|
+
d = d.setTextSelection(
|
|
1603
|
+
k
|
|
1600
1604
|
);
|
|
1601
|
-
} else if (
|
|
1602
|
-
const
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
+
} else if (l.blockContent.node.type.spec.content === "") {
|
|
1606
|
+
const u = l.blockContent.afterPos - l.blockContent.node.nodeSize;
|
|
1607
|
+
d = d.setNodeSelection(
|
|
1608
|
+
u
|
|
1605
1609
|
);
|
|
1606
1610
|
} else {
|
|
1607
|
-
const
|
|
1608
|
-
|
|
1611
|
+
const u = l.blockContent.afterPos - 1;
|
|
1612
|
+
d = d.setTextSelection(u);
|
|
1609
1613
|
}
|
|
1610
|
-
return
|
|
1614
|
+
return d.deleteRange({
|
|
1611
1615
|
from: a.bnBlock.beforePos,
|
|
1612
1616
|
to: a.bnBlock.afterPos
|
|
1613
1617
|
}).scrollIntoView().run();
|
|
@@ -1621,7 +1625,7 @@ const de = () => {
|
|
|
1621
1625
|
const a = B(r);
|
|
1622
1626
|
if (!a.isBlockContainer)
|
|
1623
1627
|
throw new Error("todo");
|
|
1624
|
-
const c = r.selection.from === a.blockContent.beforePos + 1, i = r.selection.empty, l =
|
|
1628
|
+
const c = r.selection.from === a.blockContent.beforePos + 1, i = r.selection.empty, l = Y(
|
|
1625
1629
|
r.doc,
|
|
1626
1630
|
a.bnBlock.beforePos
|
|
1627
1631
|
);
|
|
@@ -1633,7 +1637,7 @@ const de = () => {
|
|
|
1633
1637
|
if (!d.isBlockContainer)
|
|
1634
1638
|
throw new Error("todo");
|
|
1635
1639
|
if (d.blockContent.node.type.spec.content === "" || d.blockContent.node.type.spec.content === "inline*" && d.blockContent.node.childCount === 0)
|
|
1636
|
-
return
|
|
1640
|
+
return o().cut(
|
|
1637
1641
|
{
|
|
1638
1642
|
from: a.bnBlock.beforePos,
|
|
1639
1643
|
to: a.bnBlock.afterPos
|
|
@@ -1646,13 +1650,13 @@ const de = () => {
|
|
|
1646
1650
|
}
|
|
1647
1651
|
return !1;
|
|
1648
1652
|
})
|
|
1649
|
-
]), e = () => this.editor.commands.first(({ commands:
|
|
1653
|
+
]), e = () => this.editor.commands.first(({ commands: o }) => [
|
|
1650
1654
|
// Deletes the selection if it's not empty.
|
|
1651
|
-
() =>
|
|
1655
|
+
() => o.deleteSelection(),
|
|
1652
1656
|
// Merges block with the next one (at the same nesting level or lower),
|
|
1653
1657
|
// if one exists, the block has no children, and the selection is at the
|
|
1654
1658
|
// end of the block.
|
|
1655
|
-
() =>
|
|
1659
|
+
() => o.command(({ state: s }) => {
|
|
1656
1660
|
const r = B(s);
|
|
1657
1661
|
if (!r.isBlockContainer)
|
|
1658
1662
|
return !1;
|
|
@@ -1662,14 +1666,14 @@ const de = () => {
|
|
|
1662
1666
|
childContainer: i
|
|
1663
1667
|
} = r, { depth: l } = s.doc.resolve(a.beforePos), d = a.afterPos === s.doc.nodeSize - 3, u = s.selection.from === c.afterPos - 1, p = s.selection.empty;
|
|
1664
1668
|
if (!d && u && p && !(i !== void 0)) {
|
|
1665
|
-
let f = l, k = a.afterPos + 1,
|
|
1666
|
-
for (;
|
|
1667
|
-
f =
|
|
1668
|
-
return
|
|
1669
|
+
let f = l, k = a.afterPos + 1, b = s.doc.resolve(k).depth;
|
|
1670
|
+
for (; b < f; )
|
|
1671
|
+
f = b, k += 2, b = s.doc.resolve(k).depth;
|
|
1672
|
+
return o.command(pe(k - 1));
|
|
1669
1673
|
}
|
|
1670
1674
|
return !1;
|
|
1671
1675
|
})
|
|
1672
|
-
]), t = (
|
|
1676
|
+
]), t = (o = !1) => this.editor.commands.first(({ commands: s, tr: r }) => [
|
|
1673
1677
|
// Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start
|
|
1674
1678
|
// of the block.
|
|
1675
1679
|
() => s.command(({ state: a }) => {
|
|
@@ -1688,7 +1692,7 @@ const de = () => {
|
|
|
1688
1692
|
if (
|
|
1689
1693
|
// If shortcut is not configured, or is configured as "shift+enter",
|
|
1690
1694
|
// create a hard break for shift+enter, but not for enter.
|
|
1691
|
-
i === "shift+enter" &&
|
|
1695
|
+
i === "shift+enter" && o || // If shortcut is configured as "enter", create a hard break for
|
|
1692
1696
|
// both enter and shift+enter.
|
|
1693
1697
|
i === "enter"
|
|
1694
1698
|
) {
|
|
@@ -1706,17 +1710,27 @@ const de = () => {
|
|
|
1706
1710
|
}),
|
|
1707
1711
|
// Creates a new block and moves the selection to it if the current one is empty, while the selection is also
|
|
1708
1712
|
// empty & at the start of the block.
|
|
1709
|
-
() => s.command(({ state: a, dispatch: c }) => {
|
|
1710
|
-
|
|
1711
|
-
|
|
1713
|
+
() => s.command(({ state: a, dispatch: c, tr: i }) => {
|
|
1714
|
+
var k;
|
|
1715
|
+
const l = B(a);
|
|
1716
|
+
if (!l.isBlockContainer)
|
|
1712
1717
|
return !1;
|
|
1713
|
-
const { bnBlock:
|
|
1714
|
-
if (
|
|
1715
|
-
const
|
|
1718
|
+
const { bnBlock: d, blockContent: u } = l, p = a.selection.$anchor.parentOffset === 0, m = a.selection.anchor === a.selection.head, f = u.node.childCount === 0;
|
|
1719
|
+
if (p && m && f) {
|
|
1720
|
+
const b = d.afterPos, g = b + 2;
|
|
1716
1721
|
if (c) {
|
|
1717
|
-
const
|
|
1718
|
-
|
|
1719
|
-
|
|
1722
|
+
const w = a.schema.nodes.blockContainer.createAndFill(
|
|
1723
|
+
void 0,
|
|
1724
|
+
[
|
|
1725
|
+
a.schema.nodes.paragraph.createAndFill() || void 0,
|
|
1726
|
+
(k = l.childContainer) == null ? void 0 : k.node
|
|
1727
|
+
].filter((y) => y !== void 0)
|
|
1728
|
+
);
|
|
1729
|
+
i.insert(b, w).setSelection(
|
|
1730
|
+
new M(i.doc.resolve(g))
|
|
1731
|
+
).scrollIntoView(), l.childContainer && i.delete(
|
|
1732
|
+
l.childContainer.beforePos,
|
|
1733
|
+
l.childContainer.afterPos
|
|
1720
1734
|
);
|
|
1721
1735
|
}
|
|
1722
1736
|
return !0;
|
|
@@ -1731,7 +1745,7 @@ const de = () => {
|
|
|
1731
1745
|
return !1;
|
|
1732
1746
|
const { blockContent: l } = i, d = a.selection.$anchor.parentOffset === 0;
|
|
1733
1747
|
return l.node.childCount === 0 ? !1 : (c().deleteSelection().command(
|
|
1734
|
-
|
|
1748
|
+
et(
|
|
1735
1749
|
a.selection.from,
|
|
1736
1750
|
d,
|
|
1737
1751
|
d
|
|
@@ -1740,19 +1754,19 @@ const de = () => {
|
|
|
1740
1754
|
})
|
|
1741
1755
|
]);
|
|
1742
1756
|
return {
|
|
1743
|
-
Backspace:
|
|
1757
|
+
Backspace: n,
|
|
1744
1758
|
Delete: e,
|
|
1745
1759
|
Enter: () => t(),
|
|
1746
1760
|
"Shift-Enter": () => t(!0),
|
|
1747
1761
|
// Always returning true for tab key presses ensures they're not captured by the browser. Otherwise, they blur the
|
|
1748
1762
|
// editor since the browser will try to use tab for keyboard navigation.
|
|
1749
1763
|
Tab: () => {
|
|
1750
|
-
var
|
|
1751
|
-
return this.options.tabBehavior !== "prefer-indent" && ((
|
|
1764
|
+
var o, s;
|
|
1765
|
+
return this.options.tabBehavior !== "prefer-indent" && ((o = this.options.editor.getExtension(W)) != null && o.store.state || ((s = this.options.editor.getExtension(j)) == null ? void 0 : s.store.state) !== void 0) ? !1 : Te(this.options.editor);
|
|
1752
1766
|
},
|
|
1753
1767
|
"Shift-Tab": () => {
|
|
1754
|
-
var
|
|
1755
|
-
return this.options.tabBehavior !== "prefer-indent" && ((
|
|
1768
|
+
var o, s;
|
|
1769
|
+
return this.options.tabBehavior !== "prefer-indent" && ((o = this.options.editor.getExtension(W)) != null && o.store.state || ((s = this.options.editor.getExtension(j)) == null ? void 0 : s.store.state) !== void 0) ? !1 : this.editor.commands.liftListItem("blockContainer");
|
|
1756
1770
|
},
|
|
1757
1771
|
"Shift-Mod-ArrowUp": () => (this.options.editor.moveBlocksUp(), !0),
|
|
1758
1772
|
"Shift-Mod-ArrowDown": () => (this.options.editor.moveBlocksDown(), !0),
|
|
@@ -1761,7 +1775,7 @@ const de = () => {
|
|
|
1761
1775
|
"Shift-Mod-z": () => this.options.editor.redo()
|
|
1762
1776
|
};
|
|
1763
1777
|
}
|
|
1764
|
-
}),
|
|
1778
|
+
}), an = ee.create({
|
|
1765
1779
|
name: "insertion",
|
|
1766
1780
|
inclusive: !1,
|
|
1767
1781
|
excludes: "deletion modification insertion",
|
|
@@ -1771,8 +1785,8 @@ const de = () => {
|
|
|
1771
1785
|
// note: validate is supported in prosemirror but not in tiptap, so this doesn't actually work (considered not critical)
|
|
1772
1786
|
};
|
|
1773
1787
|
},
|
|
1774
|
-
extendMarkSchema(
|
|
1775
|
-
return
|
|
1788
|
+
extendMarkSchema(n) {
|
|
1789
|
+
return n.name !== "insertion" ? {} : {
|
|
1776
1790
|
blocknoteIgnore: !0,
|
|
1777
1791
|
inclusive: !1,
|
|
1778
1792
|
toDOM(e, t) {
|
|
@@ -1799,7 +1813,7 @@ const de = () => {
|
|
|
1799
1813
|
]
|
|
1800
1814
|
};
|
|
1801
1815
|
}
|
|
1802
|
-
}),
|
|
1816
|
+
}), cn = ee.create({
|
|
1803
1817
|
name: "deletion",
|
|
1804
1818
|
inclusive: !1,
|
|
1805
1819
|
excludes: "insertion modification deletion",
|
|
@@ -1809,8 +1823,8 @@ const de = () => {
|
|
|
1809
1823
|
// note: validate is supported in prosemirror but not in tiptap
|
|
1810
1824
|
};
|
|
1811
1825
|
},
|
|
1812
|
-
extendMarkSchema(
|
|
1813
|
-
return
|
|
1826
|
+
extendMarkSchema(n) {
|
|
1827
|
+
return n.name !== "deletion" ? {} : {
|
|
1814
1828
|
blocknoteIgnore: !0,
|
|
1815
1829
|
inclusive: !1,
|
|
1816
1830
|
// attrs: {
|
|
@@ -1840,7 +1854,7 @@ const de = () => {
|
|
|
1840
1854
|
]
|
|
1841
1855
|
};
|
|
1842
1856
|
}
|
|
1843
|
-
}),
|
|
1857
|
+
}), ln = ee.create({
|
|
1844
1858
|
name: "modification",
|
|
1845
1859
|
inclusive: !1,
|
|
1846
1860
|
excludes: "deletion insertion",
|
|
@@ -1853,8 +1867,8 @@ const de = () => {
|
|
|
1853
1867
|
newValue: { default: null }
|
|
1854
1868
|
};
|
|
1855
1869
|
},
|
|
1856
|
-
extendMarkSchema(
|
|
1857
|
-
return
|
|
1870
|
+
extendMarkSchema(n) {
|
|
1871
|
+
return n.name !== "modification" ? {} : {
|
|
1858
1872
|
blocknoteIgnore: !0,
|
|
1859
1873
|
inclusive: !1,
|
|
1860
1874
|
// attrs: {
|
|
@@ -1903,7 +1917,7 @@ const de = () => {
|
|
|
1903
1917
|
]
|
|
1904
1918
|
};
|
|
1905
1919
|
}
|
|
1906
|
-
}),
|
|
1920
|
+
}), dn = x.create({
|
|
1907
1921
|
name: "textAlignment",
|
|
1908
1922
|
addGlobalAttributes() {
|
|
1909
1923
|
return [
|
|
@@ -1916,34 +1930,34 @@ const de = () => {
|
|
|
1916
1930
|
attributes: {
|
|
1917
1931
|
textAlignment: {
|
|
1918
1932
|
default: "left",
|
|
1919
|
-
parseHTML: (
|
|
1920
|
-
renderHTML: (
|
|
1921
|
-
"data-text-alignment":
|
|
1933
|
+
parseHTML: (n) => n.getAttribute("data-text-alignment"),
|
|
1934
|
+
renderHTML: (n) => n.textAlignment === "left" ? {} : {
|
|
1935
|
+
"data-text-alignment": n.textAlignment
|
|
1922
1936
|
}
|
|
1923
1937
|
}
|
|
1924
1938
|
}
|
|
1925
1939
|
}
|
|
1926
1940
|
];
|
|
1927
1941
|
}
|
|
1928
|
-
}),
|
|
1942
|
+
}), un = x.create({
|
|
1929
1943
|
name: "blockTextColor",
|
|
1930
1944
|
addGlobalAttributes() {
|
|
1931
1945
|
return [
|
|
1932
1946
|
{
|
|
1933
1947
|
types: ["table", "tableCell", "tableHeader"],
|
|
1934
1948
|
attributes: {
|
|
1935
|
-
textColor:
|
|
1949
|
+
textColor: ot()
|
|
1936
1950
|
}
|
|
1937
1951
|
}
|
|
1938
1952
|
];
|
|
1939
1953
|
}
|
|
1940
|
-
}),
|
|
1954
|
+
}), pn = {
|
|
1941
1955
|
blockColor: "data-block-color",
|
|
1942
1956
|
blockStyle: "data-block-style",
|
|
1943
1957
|
id: "data-id",
|
|
1944
1958
|
depth: "data-depth",
|
|
1945
1959
|
depthChange: "data-depth-change"
|
|
1946
|
-
},
|
|
1960
|
+
}, fn = D.create({
|
|
1947
1961
|
name: "blockContainer",
|
|
1948
1962
|
group: "blockGroupChild bnBlock",
|
|
1949
1963
|
// A block always contains content, and optionally a blockGroup which contains nested blocks
|
|
@@ -1956,12 +1970,12 @@ const de = () => {
|
|
|
1956
1970
|
return [
|
|
1957
1971
|
{
|
|
1958
1972
|
tag: "div[data-node-type=" + this.name + "]",
|
|
1959
|
-
getAttrs: (
|
|
1960
|
-
if (typeof
|
|
1973
|
+
getAttrs: (n) => {
|
|
1974
|
+
if (typeof n == "string")
|
|
1961
1975
|
return !1;
|
|
1962
1976
|
const e = {};
|
|
1963
|
-
for (const [t,
|
|
1964
|
-
|
|
1977
|
+
for (const [t, o] of Object.entries(pn))
|
|
1978
|
+
n.getAttribute(o) && (e[t] = n.getAttribute(o));
|
|
1965
1979
|
return e;
|
|
1966
1980
|
}
|
|
1967
1981
|
},
|
|
@@ -1972,25 +1986,25 @@ const de = () => {
|
|
|
1972
1986
|
}
|
|
1973
1987
|
];
|
|
1974
1988
|
},
|
|
1975
|
-
renderHTML({ HTMLAttributes:
|
|
1989
|
+
renderHTML({ HTMLAttributes: n }) {
|
|
1976
1990
|
var s;
|
|
1977
1991
|
const e = document.createElement("div");
|
|
1978
1992
|
e.className = "bn-block-outer", e.setAttribute("data-node-type", "blockOuter");
|
|
1979
|
-
for (const [r, a] of Object.entries(
|
|
1993
|
+
for (const [r, a] of Object.entries(n))
|
|
1980
1994
|
r !== "class" && e.setAttribute(r, a);
|
|
1981
1995
|
const t = {
|
|
1982
1996
|
...((s = this.options.domAttributes) == null ? void 0 : s.block) || {},
|
|
1983
|
-
...
|
|
1984
|
-
},
|
|
1985
|
-
|
|
1997
|
+
...n
|
|
1998
|
+
}, o = document.createElement("div");
|
|
1999
|
+
o.className = Z("bn-block", t.class), o.setAttribute("data-node-type", this.name);
|
|
1986
2000
|
for (const [r, a] of Object.entries(t))
|
|
1987
|
-
r !== "class" &&
|
|
1988
|
-
return e.appendChild(
|
|
2001
|
+
r !== "class" && o.setAttribute(r, a);
|
|
2002
|
+
return e.appendChild(o), {
|
|
1989
2003
|
dom: e,
|
|
1990
|
-
contentDOM:
|
|
2004
|
+
contentDOM: o
|
|
1991
2005
|
};
|
|
1992
2006
|
}
|
|
1993
|
-
}),
|
|
2007
|
+
}), hn = D.create({
|
|
1994
2008
|
name: "blockGroup",
|
|
1995
2009
|
group: "childContainer",
|
|
1996
2010
|
content: "blockGroupChild+",
|
|
@@ -1999,17 +2013,17 @@ const de = () => {
|
|
|
1999
2013
|
return [
|
|
2000
2014
|
{
|
|
2001
2015
|
tag: "div",
|
|
2002
|
-
getAttrs: (
|
|
2016
|
+
getAttrs: (n) => typeof n == "string" ? !1 : n.getAttribute("data-node-type") === "blockGroup" ? null : !1
|
|
2003
2017
|
}
|
|
2004
2018
|
];
|
|
2005
2019
|
},
|
|
2006
|
-
renderHTML({ HTMLAttributes:
|
|
2007
|
-
var
|
|
2020
|
+
renderHTML({ HTMLAttributes: n }) {
|
|
2021
|
+
var o;
|
|
2008
2022
|
const e = {
|
|
2009
|
-
...((
|
|
2010
|
-
...
|
|
2023
|
+
...((o = this.options.domAttributes) == null ? void 0 : o.blockGroup) || {},
|
|
2024
|
+
...n
|
|
2011
2025
|
}, t = document.createElement("div");
|
|
2012
|
-
t.className =
|
|
2026
|
+
t.className = Z(
|
|
2013
2027
|
"bn-block-group",
|
|
2014
2028
|
e.class
|
|
2015
2029
|
), t.setAttribute("data-node-type", "blockGroup");
|
|
@@ -2020,117 +2034,117 @@ const de = () => {
|
|
|
2020
2034
|
contentDOM: t
|
|
2021
2035
|
};
|
|
2022
2036
|
}
|
|
2023
|
-
}),
|
|
2037
|
+
}), mn = D.create({
|
|
2024
2038
|
name: "doc",
|
|
2025
2039
|
topNode: !0,
|
|
2026
2040
|
content: "blockGroup",
|
|
2027
2041
|
marks: "insertion modification deletion"
|
|
2028
|
-
}),
|
|
2029
|
-
({ options:
|
|
2042
|
+
}), kn = $t(
|
|
2043
|
+
({ options: n }) => ({
|
|
2030
2044
|
key: "collaboration",
|
|
2031
2045
|
blockNoteExtensions: [
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2046
|
+
ct(n),
|
|
2047
|
+
lt(n),
|
|
2048
|
+
dt(n),
|
|
2049
|
+
ut(),
|
|
2050
|
+
pt(n)
|
|
2037
2051
|
]
|
|
2038
2052
|
})
|
|
2039
2053
|
);
|
|
2040
2054
|
let fe = !1;
|
|
2041
|
-
function
|
|
2055
|
+
function bn(n, e) {
|
|
2042
2056
|
const t = [
|
|
2043
2057
|
I.ClipboardTextSerializer,
|
|
2044
2058
|
I.Commands,
|
|
2045
2059
|
I.Editable,
|
|
2046
2060
|
I.FocusEvents,
|
|
2047
2061
|
I.Tabindex,
|
|
2048
|
-
|
|
2062
|
+
Vt,
|
|
2049
2063
|
me.configure({
|
|
2050
2064
|
// everything from bnBlock group (nodes that represent a BlockNote block should have an id)
|
|
2051
2065
|
types: ["blockContainer", "columnList", "column"],
|
|
2052
2066
|
setIdAttribute: e.setIdAttribute
|
|
2053
2067
|
}),
|
|
2054
|
-
|
|
2055
|
-
|
|
2068
|
+
on,
|
|
2069
|
+
zt,
|
|
2056
2070
|
// marks:
|
|
2057
|
-
sn,
|
|
2058
|
-
rn,
|
|
2059
2071
|
an,
|
|
2060
|
-
|
|
2072
|
+
cn,
|
|
2073
|
+
ln,
|
|
2074
|
+
Ut.extend({
|
|
2061
2075
|
inclusive: !1
|
|
2062
2076
|
}).configure({
|
|
2063
|
-
defaultProtocol:
|
|
2077
|
+
defaultProtocol: Et,
|
|
2064
2078
|
// only call this once if we have multiple editors installed. Or fix https://github.com/ueberdosis/tiptap/issues/5450
|
|
2065
|
-
protocols: fe ? [] :
|
|
2079
|
+
protocols: fe ? [] : Ct
|
|
2066
2080
|
}),
|
|
2067
|
-
...Object.values(
|
|
2068
|
-
editor:
|
|
2081
|
+
...Object.values(n.schema.styleSpecs).map((o) => o.implementation.mark.configure({
|
|
2082
|
+
editor: n
|
|
2069
2083
|
})),
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2084
|
+
un,
|
|
2085
|
+
tn,
|
|
2086
|
+
dn,
|
|
2073
2087
|
// make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)
|
|
2074
|
-
|
|
2088
|
+
x.create({
|
|
2075
2089
|
name: "OverrideEscape",
|
|
2076
2090
|
addKeyboardShortcuts: () => ({
|
|
2077
2091
|
Escape: () => {
|
|
2078
|
-
var
|
|
2079
|
-
return (
|
|
2092
|
+
var o;
|
|
2093
|
+
return (o = n.getExtension(be)) != null && o.shown() ? !1 : (n.blur(), !0);
|
|
2080
2094
|
}
|
|
2081
2095
|
})
|
|
2082
2096
|
}),
|
|
2083
2097
|
// nodes
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
editor:
|
|
2098
|
+
mn,
|
|
2099
|
+
fn.configure({
|
|
2100
|
+
editor: n,
|
|
2087
2101
|
domAttributes: e.domAttributes
|
|
2088
2102
|
}),
|
|
2089
|
-
|
|
2090
|
-
editor:
|
|
2103
|
+
rn.configure({
|
|
2104
|
+
editor: n,
|
|
2091
2105
|
tabBehavior: e.tabBehavior
|
|
2092
2106
|
}),
|
|
2093
|
-
|
|
2107
|
+
hn.configure({
|
|
2094
2108
|
domAttributes: e.domAttributes
|
|
2095
2109
|
}),
|
|
2096
|
-
...Object.values(
|
|
2097
|
-
editor:
|
|
2110
|
+
...Object.values(n.schema.inlineContentSpecs).filter((o) => o.config !== "link" && o.config !== "text").map((o) => o.implementation.node.configure({
|
|
2111
|
+
editor: n
|
|
2098
2112
|
})),
|
|
2099
|
-
...Object.values(
|
|
2113
|
+
...Object.values(n.schema.blockSpecs).flatMap((o) => [
|
|
2100
2114
|
// the node extension implementations
|
|
2101
|
-
..."node" in
|
|
2102
|
-
|
|
2103
|
-
editor:
|
|
2115
|
+
..."node" in o.implementation ? [
|
|
2116
|
+
o.implementation.node.configure({
|
|
2117
|
+
editor: n,
|
|
2104
2118
|
domAttributes: e.domAttributes
|
|
2105
2119
|
})
|
|
2106
2120
|
] : []
|
|
2107
2121
|
]),
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
e.pasteHandler || ((
|
|
2122
|
+
en(n),
|
|
2123
|
+
Xo(
|
|
2124
|
+
n,
|
|
2125
|
+
e.pasteHandler || ((o) => o.defaultPasteHandler())
|
|
2112
2126
|
),
|
|
2113
|
-
|
|
2127
|
+
No(n)
|
|
2114
2128
|
];
|
|
2115
2129
|
return fe = !0, t;
|
|
2116
2130
|
}
|
|
2117
|
-
function
|
|
2131
|
+
function gn(n, e) {
|
|
2118
2132
|
const t = [
|
|
2119
2133
|
ye(),
|
|
2120
|
-
pt(e),
|
|
2121
|
-
G(e),
|
|
2122
|
-
R(e),
|
|
2123
2134
|
ft(e),
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2135
|
+
j(e),
|
|
2136
|
+
W(e),
|
|
2137
|
+
ht(e),
|
|
2138
|
+
mt(),
|
|
2127
2139
|
kt(e),
|
|
2128
|
-
|
|
2140
|
+
Gt(e),
|
|
2141
|
+
bt(e),
|
|
2142
|
+
be(e),
|
|
2129
2143
|
...e.trailingBlock !== !1 ? [gt()] : []
|
|
2130
2144
|
];
|
|
2131
|
-
return e.collaboration ? t.push(
|
|
2145
|
+
return e.collaboration ? t.push(kn(e.collaboration)) : t.push(yt()), "table" in n.schema.blockSpecs && t.push(St(e)), e.animations !== !1 && t.push(Bt()), t;
|
|
2132
2146
|
}
|
|
2133
|
-
class
|
|
2147
|
+
class yn {
|
|
2134
2148
|
constructor(e, t) {
|
|
2135
2149
|
/**
|
|
2136
2150
|
* A set of extension keys which are disabled by the options
|
|
@@ -2154,27 +2168,27 @@ class gn {
|
|
|
2154
2168
|
*/
|
|
2155
2169
|
h(this, "extensionPlugins", /* @__PURE__ */ new Map());
|
|
2156
2170
|
this.editor = e, this.options = t, e.onMount(() => {
|
|
2157
|
-
for (const
|
|
2158
|
-
if (
|
|
2159
|
-
const s = new window.AbortController(), r =
|
|
2171
|
+
for (const o of this.extensions)
|
|
2172
|
+
if (o.mount) {
|
|
2173
|
+
const s = new window.AbortController(), r = o.mount({
|
|
2160
2174
|
dom: e.prosemirrorView.dom,
|
|
2161
2175
|
root: e.prosemirrorView.root,
|
|
2162
2176
|
signal: s.signal
|
|
2163
2177
|
});
|
|
2164
2178
|
r && s.signal.addEventListener("abort", () => {
|
|
2165
2179
|
r();
|
|
2166
|
-
}), this.abortMap.set(
|
|
2180
|
+
}), this.abortMap.set(o, s);
|
|
2167
2181
|
}
|
|
2168
2182
|
}), e.onUnmount(() => {
|
|
2169
|
-
for (const [
|
|
2170
|
-
this.abortMap.delete(
|
|
2183
|
+
for (const [o, s] of this.abortMap.entries())
|
|
2184
|
+
this.abortMap.delete(o), s.abort();
|
|
2171
2185
|
}), this.disabledExtensions = new Set(t.disableExtensions || []);
|
|
2172
|
-
for (const
|
|
2173
|
-
this.addExtension(
|
|
2174
|
-
for (const
|
|
2175
|
-
this.addExtension(
|
|
2176
|
-
for (const
|
|
2177
|
-
for (const s of
|
|
2186
|
+
for (const o of gn(this.editor, this.options))
|
|
2187
|
+
this.addExtension(o);
|
|
2188
|
+
for (const o of this.options.extensions ?? [])
|
|
2189
|
+
this.addExtension(o);
|
|
2190
|
+
for (const o of Object.values(this.editor.schema.blockSpecs))
|
|
2191
|
+
for (const s of o.extensions ?? [])
|
|
2178
2192
|
this.addExtension(s);
|
|
2179
2193
|
}
|
|
2180
2194
|
/**
|
|
@@ -2189,8 +2203,8 @@ class gn {
|
|
|
2189
2203
|
console.warn("No extensions found to register", e);
|
|
2190
2204
|
return;
|
|
2191
2205
|
}
|
|
2192
|
-
const
|
|
2193
|
-
for (const a of
|
|
2206
|
+
const o = t.map((a) => this.addExtension(a)).filter(Boolean), s = /* @__PURE__ */ new Set();
|
|
2207
|
+
for (const a of o)
|
|
2194
2208
|
a != null && a.tiptapExtensions && console.warn(
|
|
2195
2209
|
`Extension ${a.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.`,
|
|
2196
2210
|
a
|
|
@@ -2213,12 +2227,12 @@ class gn {
|
|
|
2213
2227
|
let t;
|
|
2214
2228
|
if (typeof e == "function" ? t = e({ editor: this.editor }) : t = e, !(!t || this.disabledExtensions.has(t.key))) {
|
|
2215
2229
|
if (typeof e == "function") {
|
|
2216
|
-
const
|
|
2217
|
-
typeof
|
|
2230
|
+
const o = t[Ht];
|
|
2231
|
+
typeof o == "function" && this.extensionFactories.set(o, t);
|
|
2218
2232
|
}
|
|
2219
2233
|
if (this.extensions.push(t), t.blockNoteExtensions)
|
|
2220
|
-
for (const
|
|
2221
|
-
this.addExtension(
|
|
2234
|
+
for (const o of t.blockNoteExtensions)
|
|
2235
|
+
this.addExtension(o);
|
|
2222
2236
|
return t;
|
|
2223
2237
|
}
|
|
2224
2238
|
}
|
|
@@ -2230,16 +2244,16 @@ class gn {
|
|
|
2230
2244
|
resolveExtensions(e) {
|
|
2231
2245
|
const t = [];
|
|
2232
2246
|
if (typeof e == "function") {
|
|
2233
|
-
const
|
|
2234
|
-
|
|
2247
|
+
const o = this.extensionFactories.get(e);
|
|
2248
|
+
o && t.push(o);
|
|
2235
2249
|
} else if (Array.isArray(e))
|
|
2236
|
-
for (const
|
|
2237
|
-
t.push(...this.resolveExtensions(
|
|
2250
|
+
for (const o of e)
|
|
2251
|
+
t.push(...this.resolveExtensions(o));
|
|
2238
2252
|
else if (typeof e == "object" && "key" in e)
|
|
2239
2253
|
t.push(e);
|
|
2240
2254
|
else if (typeof e == "string") {
|
|
2241
|
-
const
|
|
2242
|
-
|
|
2255
|
+
const o = this.extensions.find((s) => s.key === e);
|
|
2256
|
+
o && t.push(o);
|
|
2243
2257
|
}
|
|
2244
2258
|
return t;
|
|
2245
2259
|
}
|
|
@@ -2255,7 +2269,7 @@ class gn {
|
|
|
2255
2269
|
console.warn("No extensions found to unregister", e);
|
|
2256
2270
|
return;
|
|
2257
2271
|
}
|
|
2258
|
-
let
|
|
2272
|
+
let o = !1;
|
|
2259
2273
|
const s = /* @__PURE__ */ new Set();
|
|
2260
2274
|
for (const a of t) {
|
|
2261
2275
|
this.extensions = this.extensions.filter((i) => i !== a), this.extensionFactories.forEach((i, l) => {
|
|
@@ -2264,7 +2278,7 @@ class gn {
|
|
|
2264
2278
|
const c = this.extensionPlugins.get(a);
|
|
2265
2279
|
c == null || c.forEach((i) => {
|
|
2266
2280
|
s.add(i);
|
|
2267
|
-
}), this.extensionPlugins.delete(a), a.tiptapExtensions && !
|
|
2281
|
+
}), this.extensionPlugins.delete(a), a.tiptapExtensions && !o && (o = !0, console.warn(
|
|
2268
2282
|
`Extension ${a.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.`,
|
|
2269
2283
|
e
|
|
2270
2284
|
));
|
|
@@ -2279,39 +2293,39 @@ class gn {
|
|
|
2279
2293
|
* @returns void
|
|
2280
2294
|
*/
|
|
2281
2295
|
updatePlugins(e) {
|
|
2282
|
-
const t = this.editor.prosemirrorState,
|
|
2296
|
+
const t = this.editor.prosemirrorState, o = t.reconfigure({
|
|
2283
2297
|
plugins: e(t.plugins.slice())
|
|
2284
2298
|
});
|
|
2285
|
-
this.editor.prosemirrorView.updateState(
|
|
2299
|
+
this.editor.prosemirrorView.updateState(o);
|
|
2286
2300
|
}
|
|
2287
2301
|
/**
|
|
2288
2302
|
* Get all the extensions that are registered to the editor
|
|
2289
2303
|
*/
|
|
2290
2304
|
getTiptapExtensions() {
|
|
2291
2305
|
var s;
|
|
2292
|
-
const e =
|
|
2306
|
+
const e = bn(
|
|
2293
2307
|
this.editor,
|
|
2294
2308
|
this.options
|
|
2295
|
-
).filter((r) => !this.disabledExtensions.has(r.name)), t = xt(this.extensions),
|
|
2309
|
+
).filter((r) => !this.disabledExtensions.has(r.name)), t = xt(this.extensions), o = /* @__PURE__ */ new Map();
|
|
2296
2310
|
for (const r of this.extensions) {
|
|
2297
2311
|
r.tiptapExtensions && e.push(...r.tiptapExtensions);
|
|
2298
2312
|
const a = t(r.key), { plugins: c, inputRules: i } = this.getProsemirrorPluginsFromExtension(r);
|
|
2299
2313
|
c.length && e.push(
|
|
2300
|
-
|
|
2314
|
+
x.create({
|
|
2301
2315
|
name: r.key,
|
|
2302
2316
|
priority: a,
|
|
2303
2317
|
addProseMirrorPlugins: () => c
|
|
2304
2318
|
})
|
|
2305
|
-
), i.length && (
|
|
2319
|
+
), i.length && (o.has(a) || o.set(a, []), o.get(a).push(...i));
|
|
2306
2320
|
}
|
|
2307
2321
|
e.push(
|
|
2308
|
-
|
|
2322
|
+
x.create({
|
|
2309
2323
|
name: "blocknote-input-rules",
|
|
2310
2324
|
addProseMirrorPlugins() {
|
|
2311
2325
|
const r = [];
|
|
2312
|
-
return Array.from(
|
|
2313
|
-
r.push(...
|
|
2314
|
-
}), [
|
|
2326
|
+
return Array.from(o.keys()).sort().reverse().forEach((a) => {
|
|
2327
|
+
r.push(...o.get(a));
|
|
2328
|
+
}), [Nt({ rules: r })];
|
|
2315
2329
|
}
|
|
2316
2330
|
})
|
|
2317
2331
|
);
|
|
@@ -2327,9 +2341,9 @@ class gn {
|
|
|
2327
2341
|
*/
|
|
2328
2342
|
getProsemirrorPluginsFromExtension(e) {
|
|
2329
2343
|
var s, r, a;
|
|
2330
|
-
const t = [...e.prosemirrorPlugins ?? []],
|
|
2331
|
-
return !((s = e.prosemirrorPlugins) != null && s.length) && !Object.keys(e.keyboardShortcuts || {}).length && !((r = e.inputRules) != null && r.length) ? { plugins: t, inputRules:
|
|
2332
|
-
...e.inputRules.map((c) => new
|
|
2344
|
+
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), (a = e.inputRules) != null && a.length && o.push(
|
|
2346
|
+
...e.inputRules.map((c) => new Ot(c.find, (i, l, d, u) => {
|
|
2333
2347
|
const p = c.replace({
|
|
2334
2348
|
match: l,
|
|
2335
2349
|
range: { from: d, to: u },
|
|
@@ -2340,12 +2354,12 @@ class gn {
|
|
|
2340
2354
|
if (this.editor.schema.blockSchema[m.block.type].content !== "inline")
|
|
2341
2355
|
return null;
|
|
2342
2356
|
const f = $(i.tr), k = i.tr.deleteRange(d, u);
|
|
2343
|
-
return
|
|
2357
|
+
return nt(k, f.bnBlock.beforePos, p), k;
|
|
2344
2358
|
}
|
|
2345
2359
|
return null;
|
|
2346
2360
|
}))
|
|
2347
2361
|
), Object.keys(e.keyboardShortcuts || {}).length && t.push(
|
|
2348
|
-
|
|
2362
|
+
Ft(
|
|
2349
2363
|
Object.fromEntries(
|
|
2350
2364
|
Object.entries(e.keyboardShortcuts).map(([c, i]) => [
|
|
2351
2365
|
c,
|
|
@@ -2353,7 +2367,7 @@ class gn {
|
|
|
2353
2367
|
])
|
|
2354
2368
|
)
|
|
2355
2369
|
)
|
|
2356
|
-
), { plugins: t, inputRules:
|
|
2370
|
+
), { plugins: t, inputRules: o });
|
|
2357
2371
|
}
|
|
2358
2372
|
/**
|
|
2359
2373
|
* Get all extensions
|
|
@@ -2365,7 +2379,7 @@ class gn {
|
|
|
2365
2379
|
}
|
|
2366
2380
|
getExtension(e) {
|
|
2367
2381
|
if (typeof e == "string") {
|
|
2368
|
-
const t = this.extensions.find((
|
|
2382
|
+
const t = this.extensions.find((o) => o.key === e);
|
|
2369
2383
|
return t || void 0;
|
|
2370
2384
|
} else if (typeof e == "function") {
|
|
2371
2385
|
const t = this.extensionFactories.get(e);
|
|
@@ -2380,42 +2394,42 @@ class gn {
|
|
|
2380
2394
|
return typeof e == "string" ? this.extensions.some((t) => t.key === e) : typeof e == "object" && "key" in e ? this.extensions.some((t) => t.key === e.key) : typeof e == "function" ? this.extensionFactories.has(e) : !1;
|
|
2381
2395
|
}
|
|
2382
2396
|
}
|
|
2383
|
-
function
|
|
2384
|
-
let { $from: t, $to:
|
|
2385
|
-
if (t.pos > t.start() && t.pos <
|
|
2386
|
-
const s =
|
|
2397
|
+
function Sn(n, e) {
|
|
2398
|
+
let { $from: t, $to: o } = e;
|
|
2399
|
+
if (t.pos > t.start() && t.pos < n.content.size) {
|
|
2400
|
+
const s = n.textBetween(t.pos, t.pos + 1);
|
|
2387
2401
|
if (/^[\w\p{P}]$/u.test(s)) {
|
|
2388
|
-
const a =
|
|
2389
|
-
a && (t =
|
|
2402
|
+
const a = n.textBetween(t.start(), t.pos).match(/[\w\p{P}]+$/u);
|
|
2403
|
+
a && (t = n.resolve(t.pos - a[0].length));
|
|
2390
2404
|
}
|
|
2391
2405
|
}
|
|
2392
|
-
if (
|
|
2393
|
-
const s =
|
|
2406
|
+
if (o.pos < o.end() && o.pos > 0) {
|
|
2407
|
+
const s = n.textBetween(o.pos - 1, o.pos);
|
|
2394
2408
|
if (/^[\w\p{P}]$/u.test(s)) {
|
|
2395
|
-
const a =
|
|
2396
|
-
a && (
|
|
2409
|
+
const a = n.textBetween(o.pos, o.end()).match(/^[\w\p{P}]+/u);
|
|
2410
|
+
a && (o = n.resolve(o.pos + a[0].length));
|
|
2397
2411
|
}
|
|
2398
2412
|
}
|
|
2399
|
-
return { $from: t, $to:
|
|
2413
|
+
return { $from: t, $to: o, from: t.pos, to: o.pos };
|
|
2400
2414
|
}
|
|
2401
|
-
function
|
|
2402
|
-
const e = C(
|
|
2403
|
-
if (
|
|
2415
|
+
function Bn(n) {
|
|
2416
|
+
const e = C(n);
|
|
2417
|
+
if (n.selection.empty || "node" in n.selection)
|
|
2404
2418
|
return;
|
|
2405
|
-
const t =
|
|
2406
|
-
_(
|
|
2407
|
-
),
|
|
2408
|
-
_(
|
|
2419
|
+
const t = n.doc.resolve(
|
|
2420
|
+
_(n.doc, n.selection.from).posBeforeNode
|
|
2421
|
+
), o = n.doc.resolve(
|
|
2422
|
+
_(n.doc, n.selection.to).posBeforeNode
|
|
2409
2423
|
), s = (l, d) => {
|
|
2410
|
-
const u = t.posAtIndex(l, d), p =
|
|
2424
|
+
const u = t.posAtIndex(l, d), p = n.doc.resolve(u).nodeAfter;
|
|
2411
2425
|
if (!p)
|
|
2412
2426
|
throw new Error(
|
|
2413
2427
|
`Error getting selection - node not found at position ${u}`
|
|
2414
2428
|
);
|
|
2415
|
-
return
|
|
2416
|
-
}, r = [], a = t.sharedDepth(
|
|
2429
|
+
return S(p, e);
|
|
2430
|
+
}, r = [], a = t.sharedDepth(o.pos), c = t.index(a), i = o.index(a);
|
|
2417
2431
|
if (t.depth > a) {
|
|
2418
|
-
r.push(
|
|
2432
|
+
r.push(S(t.nodeAfter, e));
|
|
2419
2433
|
for (let l = t.depth; l > a; l--)
|
|
2420
2434
|
if (t.node(l).type.isInGroup("childContainer")) {
|
|
2421
2435
|
const u = t.index(l) + 1, p = t.node(l).childCount;
|
|
@@ -2428,28 +2442,28 @@ function yn(o) {
|
|
|
2428
2442
|
r.push(s(l, a));
|
|
2429
2443
|
if (r.length === 0)
|
|
2430
2444
|
throw new Error(
|
|
2431
|
-
`Error getting selection - selection doesn't span any blocks (${
|
|
2445
|
+
`Error getting selection - selection doesn't span any blocks (${n.selection})`
|
|
2432
2446
|
);
|
|
2433
2447
|
return {
|
|
2434
2448
|
blocks: r
|
|
2435
2449
|
};
|
|
2436
2450
|
}
|
|
2437
|
-
function
|
|
2438
|
-
const
|
|
2439
|
-
if (
|
|
2451
|
+
function Cn(n, e, t) {
|
|
2452
|
+
const o = typeof e == "string" ? e : e.id, s = typeof t == "string" ? t : t.id, r = C(n), a = ke(r);
|
|
2453
|
+
if (o === s)
|
|
2440
2454
|
throw new Error(
|
|
2441
|
-
`Attempting to set selection with the same anchor and head blocks (id ${
|
|
2455
|
+
`Attempting to set selection with the same anchor and head blocks (id ${o})`
|
|
2442
2456
|
);
|
|
2443
|
-
const c =
|
|
2457
|
+
const c = E(o, n.doc);
|
|
2444
2458
|
if (!c)
|
|
2445
|
-
throw new Error(`Block with ID ${
|
|
2446
|
-
const i =
|
|
2459
|
+
throw new Error(`Block with ID ${o} not found`);
|
|
2460
|
+
const i = E(s, n.doc);
|
|
2447
2461
|
if (!i)
|
|
2448
2462
|
throw new Error(`Block with ID ${s} not found`);
|
|
2449
|
-
const l =
|
|
2463
|
+
const l = R(c), d = R(i), u = a.blockSchema[l.blockNoteType], p = a.blockSchema[d.blockNoteType];
|
|
2450
2464
|
if (!l.isBlockContainer || u.content === "none")
|
|
2451
2465
|
throw new Error(
|
|
2452
|
-
`Attempting to set selection anchor in block without content (id ${
|
|
2466
|
+
`Attempting to set selection anchor in block without content (id ${o})`
|
|
2453
2467
|
);
|
|
2454
2468
|
if (!d.isBlockContainer || p.content === "none")
|
|
2455
2469
|
throw new Error(
|
|
@@ -2462,29 +2476,29 @@ function Sn(o, e, t) {
|
|
|
2462
2476
|
} else
|
|
2463
2477
|
m = l.blockContent.beforePos + 1;
|
|
2464
2478
|
if (p.content === "table") {
|
|
2465
|
-
const k = se.get(d.blockContent.node),
|
|
2479
|
+
const k = se.get(d.blockContent.node), b = d.blockContent.beforePos + k.positionAt(
|
|
2466
2480
|
k.height - 1,
|
|
2467
2481
|
k.width - 1,
|
|
2468
2482
|
d.blockContent.node
|
|
2469
|
-
) + 1,
|
|
2470
|
-
f =
|
|
2483
|
+
) + 1, g = n.doc.resolve(b).nodeAfter.nodeSize;
|
|
2484
|
+
f = b + g - 2;
|
|
2471
2485
|
} else
|
|
2472
2486
|
f = d.blockContent.afterPos - 1;
|
|
2473
|
-
|
|
2487
|
+
n.setSelection(M.create(n.doc, m, f));
|
|
2474
2488
|
}
|
|
2475
|
-
function
|
|
2476
|
-
const t = C(
|
|
2477
|
-
let s =
|
|
2489
|
+
function En(n, e = !1) {
|
|
2490
|
+
const t = C(n), o = e ? Sn(n.doc, n.selection) : n.selection;
|
|
2491
|
+
let s = o.$from, r = o.$to;
|
|
2478
2492
|
for (; r.parentOffset >= r.parent.nodeSize - 2 && r.depth > 0; )
|
|
2479
|
-
r =
|
|
2493
|
+
r = n.doc.resolve(r.pos + 1);
|
|
2480
2494
|
for (; r.parentOffset === 0 && r.depth > 0; )
|
|
2481
|
-
r =
|
|
2495
|
+
r = n.doc.resolve(r.pos - 1);
|
|
2482
2496
|
for (; s.parentOffset === 0 && s.depth > 0; )
|
|
2483
|
-
s =
|
|
2497
|
+
s = n.doc.resolve(s.pos - 1);
|
|
2484
2498
|
for (; s.parentOffset >= s.parent.nodeSize - 2 && s.depth > 0; )
|
|
2485
|
-
s =
|
|
2486
|
-
const a =
|
|
2487
|
-
|
|
2499
|
+
s = n.doc.resolve(s.pos + 1);
|
|
2500
|
+
const a = We(
|
|
2501
|
+
n.doc.slice(s.pos, r.pos, !0),
|
|
2488
2502
|
t
|
|
2489
2503
|
);
|
|
2490
2504
|
return {
|
|
@@ -2495,47 +2509,47 @@ function Bn(o, e = !1) {
|
|
|
2495
2509
|
...a
|
|
2496
2510
|
};
|
|
2497
2511
|
}
|
|
2498
|
-
function
|
|
2499
|
-
const { bnBlock: e } = $(
|
|
2512
|
+
function xn(n) {
|
|
2513
|
+
const { bnBlock: e } = $(n), t = C(n.doc), o = n.doc.resolve(e.beforePos), s = o.nodeBefore, r = n.doc.resolve(e.afterPos).nodeAfter;
|
|
2500
2514
|
let a;
|
|
2501
|
-
return
|
|
2502
|
-
block:
|
|
2503
|
-
prevBlock: s === null ? void 0 :
|
|
2504
|
-
nextBlock: r === null ? void 0 :
|
|
2505
|
-
parentBlock: a === void 0 ? void 0 :
|
|
2515
|
+
return o.depth > 1 && (a = o.node(), a.type.isInGroup("bnBlock") || (a = o.node(o.depth - 1))), {
|
|
2516
|
+
block: S(e.node, t),
|
|
2517
|
+
prevBlock: s === null ? void 0 : S(s, t),
|
|
2518
|
+
nextBlock: r === null ? void 0 : S(r, t),
|
|
2519
|
+
parentBlock: a === void 0 ? void 0 : S(a, t)
|
|
2506
2520
|
};
|
|
2507
2521
|
}
|
|
2508
|
-
function De(
|
|
2509
|
-
const
|
|
2522
|
+
function De(n, e, t = "start") {
|
|
2523
|
+
const o = typeof e == "string" ? e : e.id, s = C(n.doc), r = ke(s), a = E(o, n.doc);
|
|
2510
2524
|
if (!a)
|
|
2511
|
-
throw new Error(`Block with ID ${
|
|
2512
|
-
const c =
|
|
2525
|
+
throw new Error(`Block with ID ${o} not found`);
|
|
2526
|
+
const c = R(a), i = r.blockSchema[c.blockNoteType].content;
|
|
2513
2527
|
if (c.isBlockContainer) {
|
|
2514
2528
|
const l = c.blockContent;
|
|
2515
2529
|
if (i === "none") {
|
|
2516
|
-
|
|
2530
|
+
n.setSelection(L.create(n.doc, l.beforePos));
|
|
2517
2531
|
return;
|
|
2518
2532
|
}
|
|
2519
2533
|
if (i === "inline")
|
|
2520
|
-
t === "start" ?
|
|
2521
|
-
|
|
2522
|
-
) :
|
|
2523
|
-
|
|
2534
|
+
t === "start" ? n.setSelection(
|
|
2535
|
+
M.create(n.doc, l.beforePos + 1)
|
|
2536
|
+
) : n.setSelection(
|
|
2537
|
+
M.create(n.doc, l.afterPos - 1)
|
|
2524
2538
|
);
|
|
2525
2539
|
else if (i === "table")
|
|
2526
|
-
t === "start" ?
|
|
2527
|
-
|
|
2528
|
-
) :
|
|
2529
|
-
|
|
2540
|
+
t === "start" ? n.setSelection(
|
|
2541
|
+
M.create(n.doc, l.beforePos + 4)
|
|
2542
|
+
) : n.setSelection(
|
|
2543
|
+
M.create(n.doc, l.afterPos - 4)
|
|
2530
2544
|
);
|
|
2531
2545
|
else
|
|
2532
2546
|
throw new F(i);
|
|
2533
2547
|
} else {
|
|
2534
2548
|
const l = t === "start" ? c.childContainer.node.firstChild : c.childContainer.node.lastChild;
|
|
2535
|
-
De(
|
|
2549
|
+
De(n, l.attrs.id, t);
|
|
2536
2550
|
}
|
|
2537
2551
|
}
|
|
2538
|
-
class
|
|
2552
|
+
class Mn {
|
|
2539
2553
|
constructor(e) {
|
|
2540
2554
|
this.editor = e;
|
|
2541
2555
|
}
|
|
@@ -2546,7 +2560,7 @@ class xn {
|
|
|
2546
2560
|
* If the selection starts / ends halfway through a block, the returned data will contain the entire block.
|
|
2547
2561
|
*/
|
|
2548
2562
|
getSelection() {
|
|
2549
|
-
return this.editor.transact((e) =>
|
|
2563
|
+
return this.editor.transact((e) => Bn(e));
|
|
2550
2564
|
}
|
|
2551
2565
|
/**
|
|
2552
2566
|
* Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
|
|
@@ -2556,7 +2570,7 @@ class xn {
|
|
|
2556
2570
|
* only the part of the block that is included in the selection.
|
|
2557
2571
|
*/
|
|
2558
2572
|
getSelectionCutBlocks(e = !1) {
|
|
2559
|
-
return this.editor.transact((t) =>
|
|
2573
|
+
return this.editor.transact((t) => En(t, e));
|
|
2560
2574
|
}
|
|
2561
2575
|
/**
|
|
2562
2576
|
* Sets the selection to a range of blocks.
|
|
@@ -2564,14 +2578,14 @@ class xn {
|
|
|
2564
2578
|
* @param endBlock The identifier of the block that should be the end of the selection.
|
|
2565
2579
|
*/
|
|
2566
2580
|
setSelection(e, t) {
|
|
2567
|
-
return this.editor.transact((
|
|
2581
|
+
return this.editor.transact((o) => Cn(o, e, t));
|
|
2568
2582
|
}
|
|
2569
2583
|
/**
|
|
2570
2584
|
* Gets a snapshot of the current text cursor position.
|
|
2571
2585
|
* @returns A snapshot of the current text cursor position.
|
|
2572
2586
|
*/
|
|
2573
2587
|
getTextCursorPosition() {
|
|
2574
|
-
return this.editor.transact((e) =>
|
|
2588
|
+
return this.editor.transact((e) => xn(e));
|
|
2575
2589
|
}
|
|
2576
2590
|
/**
|
|
2577
2591
|
* Sets the text cursor position to the start or end of an existing block. Throws an error if the target block could
|
|
@@ -2581,7 +2595,7 @@ class xn {
|
|
|
2581
2595
|
*/
|
|
2582
2596
|
setTextCursorPosition(e, t = "start") {
|
|
2583
2597
|
return this.editor.transact(
|
|
2584
|
-
(
|
|
2598
|
+
(o) => De(o, e, t)
|
|
2585
2599
|
);
|
|
2586
2600
|
}
|
|
2587
2601
|
/**
|
|
@@ -2590,20 +2604,20 @@ class xn {
|
|
|
2590
2604
|
getSelectionBoundingBox() {
|
|
2591
2605
|
if (!this.editor.prosemirrorView)
|
|
2592
2606
|
return;
|
|
2593
|
-
const { selection: e } = this.editor.prosemirrorState, { ranges: t } = e,
|
|
2594
|
-
if (
|
|
2595
|
-
const r = this.editor.prosemirrorView.nodeDOM(
|
|
2607
|
+
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 (Tt(e)) {
|
|
2609
|
+
const r = this.editor.prosemirrorView.nodeDOM(o);
|
|
2596
2610
|
if (r)
|
|
2597
2611
|
return r.getBoundingClientRect();
|
|
2598
2612
|
}
|
|
2599
|
-
return
|
|
2613
|
+
return Pt(
|
|
2600
2614
|
this.editor.prosemirrorView,
|
|
2601
|
-
|
|
2615
|
+
o,
|
|
2602
2616
|
s
|
|
2603
2617
|
).toJSON();
|
|
2604
2618
|
}
|
|
2605
2619
|
}
|
|
2606
|
-
class
|
|
2620
|
+
class wn {
|
|
2607
2621
|
constructor(e) {
|
|
2608
2622
|
/**
|
|
2609
2623
|
* Stores the currently active transaction, which is the accumulated transaction from all {@link dispatch} calls during a {@link transact} calls
|
|
@@ -2649,8 +2663,8 @@ class En {
|
|
|
2649
2663
|
);
|
|
2650
2664
|
if (this.isInCan)
|
|
2651
2665
|
return this.canExec(e);
|
|
2652
|
-
const t = this.prosemirrorState,
|
|
2653
|
-
return e(t, (r) => this.prosemirrorView.dispatch(r),
|
|
2666
|
+
const t = this.prosemirrorState, o = this.prosemirrorView;
|
|
2667
|
+
return e(t, (r) => this.prosemirrorView.dispatch(r), o);
|
|
2654
2668
|
}
|
|
2655
2669
|
/**
|
|
2656
2670
|
* Check if a command can be executed. A command should return `false` if it is not valid in the current state.
|
|
@@ -2669,8 +2683,8 @@ class En {
|
|
|
2669
2683
|
throw new Error(
|
|
2670
2684
|
"`canExec` should not be called within a `transact` call, move the `canExec` call outside of the `transact` call"
|
|
2671
2685
|
);
|
|
2672
|
-
const t = this.prosemirrorState,
|
|
2673
|
-
return e(t, void 0,
|
|
2686
|
+
const t = this.prosemirrorState, o = this.prosemirrorView;
|
|
2687
|
+
return e(t, void 0, o);
|
|
2674
2688
|
}
|
|
2675
2689
|
/**
|
|
2676
2690
|
* Execute a function within a "blocknote transaction".
|
|
@@ -2696,9 +2710,9 @@ class En {
|
|
|
2696
2710
|
return e(this.activeTransaction);
|
|
2697
2711
|
try {
|
|
2698
2712
|
this.activeTransaction = this.editor._tiptapEditor.state.tr;
|
|
2699
|
-
const t = e(this.activeTransaction),
|
|
2700
|
-
return this.activeTransaction = null,
|
|
2701
|
-
(
|
|
2713
|
+
const t = e(this.activeTransaction), o = this.activeTransaction;
|
|
2714
|
+
return this.activeTransaction = null, o && // Only dispatch if the transaction was actually modified in some way
|
|
2715
|
+
(o.docChanged || o.selectionSet || o.scrolledIntoView || o.storedMarksSet || !o.isGeneric) && this.prosemirrorView.dispatch(o), t;
|
|
2702
2716
|
} finally {
|
|
2703
2717
|
this.activeTransaction = null;
|
|
2704
2718
|
}
|
|
@@ -2779,17 +2793,17 @@ class En {
|
|
|
2779
2793
|
throw new Error("No redo plugin found");
|
|
2780
2794
|
}
|
|
2781
2795
|
}
|
|
2782
|
-
function
|
|
2796
|
+
function Tn(n, e, t, o = { updateSelection: !0 }) {
|
|
2783
2797
|
let { from: s, to: r } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, a = !0, c = !0, i = "";
|
|
2784
2798
|
if (t.forEach((l) => {
|
|
2785
2799
|
l.check(), a && l.isText && l.marks.length === 0 ? i += l.text : a = !1, c = c ? l.isBlock : !1;
|
|
2786
2800
|
}), s === r && c) {
|
|
2787
|
-
const { parent: l } =
|
|
2801
|
+
const { parent: l } = n.doc.resolve(s);
|
|
2788
2802
|
l.isTextblock && !l.type.spec.code && !l.childCount && (s -= 1, r += 1);
|
|
2789
2803
|
}
|
|
2790
|
-
return a ?
|
|
2804
|
+
return a ? n.insertText(i, s, r) : n.replaceWith(s, r, t), o.updateSelection && vt(n, n.steps.length - 1, -1), !0;
|
|
2791
2805
|
}
|
|
2792
|
-
class
|
|
2806
|
+
class Pn {
|
|
2793
2807
|
constructor(e) {
|
|
2794
2808
|
this.editor = e;
|
|
2795
2809
|
}
|
|
@@ -2799,15 +2813,15 @@ class Mn {
|
|
|
2799
2813
|
* @param content can be a string, or array of partial inline content elements
|
|
2800
2814
|
*/
|
|
2801
2815
|
insertInlineContent(e, { updateSelection: t = !1 } = {}) {
|
|
2802
|
-
const
|
|
2816
|
+
const o = O(e, this.editor.pmSchema);
|
|
2803
2817
|
this.editor.transact((s) => {
|
|
2804
|
-
|
|
2818
|
+
Tn(
|
|
2805
2819
|
s,
|
|
2806
2820
|
{
|
|
2807
2821
|
from: s.selection.from,
|
|
2808
2822
|
to: s.selection.to
|
|
2809
2823
|
},
|
|
2810
|
-
|
|
2824
|
+
o,
|
|
2811
2825
|
{
|
|
2812
2826
|
updateSelection: t
|
|
2813
2827
|
}
|
|
@@ -2819,8 +2833,8 @@ class Mn {
|
|
|
2819
2833
|
*/
|
|
2820
2834
|
getActiveStyles() {
|
|
2821
2835
|
return this.editor.transact((e) => {
|
|
2822
|
-
const t = {},
|
|
2823
|
-
for (const s of
|
|
2836
|
+
const t = {}, o = e.selection.$to.marks();
|
|
2837
|
+
for (const s of o) {
|
|
2824
2838
|
const r = this.editor.schema.styleSchema[s.type.name];
|
|
2825
2839
|
if (!r) {
|
|
2826
2840
|
// Links are not considered styles in blocknote
|
|
@@ -2838,7 +2852,7 @@ class Mn {
|
|
|
2838
2852
|
* @param styles The styles to add.
|
|
2839
2853
|
*/
|
|
2840
2854
|
addStyles(e) {
|
|
2841
|
-
for (const [t,
|
|
2855
|
+
for (const [t, o] of Object.entries(e)) {
|
|
2842
2856
|
const s = this.editor.schema.styleSchema[t];
|
|
2843
2857
|
if (!s)
|
|
2844
2858
|
throw new Error(`style ${t} not found in styleSchema`);
|
|
@@ -2846,7 +2860,7 @@ class Mn {
|
|
|
2846
2860
|
this.editor._tiptapEditor.commands.setMark(t);
|
|
2847
2861
|
else if (s.propSchema === "string")
|
|
2848
2862
|
this.editor._tiptapEditor.commands.setMark(t, {
|
|
2849
|
-
stringValue:
|
|
2863
|
+
stringValue: o
|
|
2850
2864
|
});
|
|
2851
2865
|
else
|
|
2852
2866
|
throw new F(s.propSchema);
|
|
@@ -2865,7 +2879,7 @@ class Mn {
|
|
|
2865
2879
|
* @param styles The styles to toggle.
|
|
2866
2880
|
*/
|
|
2867
2881
|
toggleStyles(e) {
|
|
2868
|
-
for (const [t,
|
|
2882
|
+
for (const [t, o] of Object.entries(e)) {
|
|
2869
2883
|
const s = this.editor.schema.styleSchema[t];
|
|
2870
2884
|
if (!s)
|
|
2871
2885
|
throw new Error(`style ${t} not found in styleSchema`);
|
|
@@ -2873,7 +2887,7 @@ class Mn {
|
|
|
2873
2887
|
this.editor._tiptapEditor.commands.toggleMark(t);
|
|
2874
2888
|
else if (s.propSchema === "string")
|
|
2875
2889
|
this.editor._tiptapEditor.commands.toggleMark(t, {
|
|
2876
|
-
stringValue:
|
|
2890
|
+
stringValue: o
|
|
2877
2891
|
});
|
|
2878
2892
|
else
|
|
2879
2893
|
throw new F(s.propSchema);
|
|
@@ -2899,65 +2913,90 @@ class Mn {
|
|
|
2899
2913
|
createLink(e, t) {
|
|
2900
2914
|
if (e === "")
|
|
2901
2915
|
return;
|
|
2902
|
-
const
|
|
2916
|
+
const o = this.editor.pmSchema.mark("link", { href: e });
|
|
2903
2917
|
this.editor.transact((s) => {
|
|
2904
2918
|
const { from: r, to: a } = s.selection;
|
|
2905
|
-
t ? s.insertText(t, r, a).addMark(r, r + t.length,
|
|
2919
|
+
t ? s.insertText(t, r, a).addMark(r, r + t.length, o) : s.setSelection(Jt.create(s.doc, a)).addMark(
|
|
2906
2920
|
r,
|
|
2907
2921
|
a,
|
|
2908
|
-
|
|
2922
|
+
o
|
|
2909
2923
|
);
|
|
2910
2924
|
});
|
|
2911
2925
|
}
|
|
2912
2926
|
}
|
|
2913
|
-
function
|
|
2927
|
+
function vn(n) {
|
|
2928
|
+
return It(n.state.selection.$from, (e) => e.type.name === "tableCell" || e.type.name === "tableHeader") !== void 0;
|
|
2929
|
+
}
|
|
2930
|
+
function Le(n, e) {
|
|
2931
|
+
var s;
|
|
2932
|
+
const t = e.nodes.hardBreak;
|
|
2933
|
+
let o = H.empty;
|
|
2934
|
+
return n.forEach((r) => {
|
|
2935
|
+
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
|
+
Le(r.content, e)
|
|
2937
|
+
), o = o.addToEnd(t.create()));
|
|
2938
|
+
}), ((s = o.lastChild) == null ? void 0 : s.type) === t && (o = o.cut(0, o.size - 1)), o;
|
|
2939
|
+
}
|
|
2940
|
+
function In(n, e) {
|
|
2914
2941
|
const t = [];
|
|
2915
|
-
return
|
|
2916
|
-
r !== e && t.push(
|
|
2917
|
-
}),
|
|
2942
|
+
return n.forEach((o, s, r) => {
|
|
2943
|
+
r !== e && t.push(o);
|
|
2944
|
+
}), H.from(t);
|
|
2918
2945
|
}
|
|
2919
|
-
function
|
|
2946
|
+
function An(n, e) {
|
|
2920
2947
|
const t = [];
|
|
2921
|
-
for (let
|
|
2922
|
-
if (
|
|
2948
|
+
for (let o = 0; o < n.childCount; o++)
|
|
2949
|
+
if (n.child(o).type.name === "tableRow")
|
|
2923
2950
|
if (t.length > 0 && t[t.length - 1].type.name === "table") {
|
|
2924
|
-
const s = t[t.length - 1], r = s.copy(s.content.addToEnd(
|
|
2951
|
+
const s = t[t.length - 1], r = s.copy(s.content.addToEnd(n.child(o)));
|
|
2925
2952
|
t[t.length - 1] = r;
|
|
2926
2953
|
} else {
|
|
2927
2954
|
const s = e.nodes.table.createChecked(
|
|
2928
2955
|
void 0,
|
|
2929
|
-
|
|
2956
|
+
n.child(o)
|
|
2930
2957
|
);
|
|
2931
2958
|
t.push(s);
|
|
2932
2959
|
}
|
|
2933
2960
|
else
|
|
2934
|
-
t.push(
|
|
2935
|
-
return
|
|
2936
|
-
}
|
|
2937
|
-
function
|
|
2938
|
-
let t =
|
|
2939
|
-
if (t =
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
(
|
|
2961
|
+
t.push(n.child(o));
|
|
2962
|
+
return n = H.from(t), n;
|
|
2963
|
+
}
|
|
2964
|
+
function _n(n, e) {
|
|
2965
|
+
let t = H.from(n.content);
|
|
2966
|
+
if (t = An(t, e.state.schema), vn(e)) {
|
|
2967
|
+
let o = !1;
|
|
2968
|
+
if (t.descendants((s) => {
|
|
2969
|
+
s.type.isInGroup("tableContent") && (o = !0);
|
|
2970
|
+
}), !o && // is the content valid for a table paragraph?
|
|
2971
|
+
!e.state.schema.nodes.tableParagraph.validContent(t))
|
|
2972
|
+
return new U(
|
|
2973
|
+
Le(t, e.state.schema),
|
|
2974
|
+
0,
|
|
2975
|
+
0
|
|
2976
|
+
);
|
|
2977
|
+
}
|
|
2978
|
+
if (!Dn(t, e))
|
|
2979
|
+
return new U(t, n.openStart, n.openEnd);
|
|
2980
|
+
for (let o = 0; o < t.childCount; o++)
|
|
2981
|
+
if (t.child(o).type.spec.group === "blockContent") {
|
|
2982
|
+
const s = [t.child(o)];
|
|
2983
|
+
if (o + 1 < t.childCount && t.child(o + 1).type.name === "blockGroup") {
|
|
2984
|
+
const a = t.child(o + 1).child(0).child(0);
|
|
2985
|
+
(a.type.name === "bulletListItem" || a.type.name === "numberedListItem" || a.type.name === "checkListItem") && (s.push(t.child(o + 1)), t = In(t, o + 1));
|
|
2947
2986
|
}
|
|
2948
2987
|
const r = e.state.schema.nodes.blockContainer.createChecked(
|
|
2949
2988
|
void 0,
|
|
2950
2989
|
s
|
|
2951
2990
|
);
|
|
2952
|
-
t = t.replaceChild(
|
|
2991
|
+
t = t.replaceChild(o, r);
|
|
2953
2992
|
}
|
|
2954
|
-
return new
|
|
2993
|
+
return new U(t, n.openStart, n.openEnd);
|
|
2955
2994
|
}
|
|
2956
|
-
function
|
|
2995
|
+
function Dn(n, e) {
|
|
2957
2996
|
var r, a;
|
|
2958
|
-
const t =
|
|
2997
|
+
const t = n.childCount === 1, o = ((r = n.firstChild) == null ? void 0 : r.type.spec.content) === "inline*", s = ((a = n.firstChild) == null ? void 0 : a.type.spec.content) === "tableRow+";
|
|
2959
2998
|
if (t) {
|
|
2960
|
-
if (
|
|
2999
|
+
if (o)
|
|
2961
3000
|
return !1;
|
|
2962
3001
|
if (s) {
|
|
2963
3002
|
const c = B(e.state);
|
|
@@ -2967,14 +3006,14 @@ function In(o, e) {
|
|
|
2967
3006
|
}
|
|
2968
3007
|
return !0;
|
|
2969
3008
|
}
|
|
2970
|
-
const
|
|
3009
|
+
const Ln = {
|
|
2971
3010
|
enableInputRules: !0,
|
|
2972
3011
|
enablePasteRules: !0,
|
|
2973
3012
|
enableCoreExtensions: !1
|
|
2974
3013
|
};
|
|
2975
|
-
class
|
|
3014
|
+
class Ne extends Se {
|
|
2976
3015
|
constructor(t) {
|
|
2977
|
-
var l, d, u, p, m, f, k,
|
|
3016
|
+
var l, d, u, p, m, f, k, b, g, w;
|
|
2978
3017
|
super();
|
|
2979
3018
|
/**
|
|
2980
3019
|
* The underlying prosemirror schema
|
|
@@ -3054,7 +3093,7 @@ class Le extends Se {
|
|
|
3054
3093
|
h(this, "unmount", () => {
|
|
3055
3094
|
this._tiptapEditor.unmount();
|
|
3056
3095
|
});
|
|
3057
|
-
this.options = t, this.dictionary = t.dictionary ||
|
|
3096
|
+
this.options = t, this.dictionary = t.dictionary || Lt, this.settings = {
|
|
3058
3097
|
tables: {
|
|
3059
3098
|
splitCells: ((l = t == null ? void 0 : t.tables) == null ? void 0 : l.splitCells) ?? !1,
|
|
3060
3099
|
cellBackgroundColor: ((d = t == null ? void 0 : t.tables) == null ? void 0 : d.cellBackgroundColor) ?? !1,
|
|
@@ -3062,61 +3101,61 @@ class Le extends Se {
|
|
|
3062
3101
|
headers: ((p = t == null ? void 0 : t.tables) == null ? void 0 : p.headers) ?? !1
|
|
3063
3102
|
}
|
|
3064
3103
|
};
|
|
3065
|
-
const
|
|
3104
|
+
const o = {
|
|
3066
3105
|
defaultStyles: !0,
|
|
3067
|
-
schema: t.schema ||
|
|
3106
|
+
schema: t.schema || Mt.create(),
|
|
3068
3107
|
...t,
|
|
3069
3108
|
placeholders: {
|
|
3070
3109
|
...this.dictionary.placeholders,
|
|
3071
3110
|
...t.placeholders
|
|
3072
3111
|
}
|
|
3073
3112
|
};
|
|
3074
|
-
if (this.schema =
|
|
3075
|
-
const
|
|
3076
|
-
this.uploadFile = async (P,
|
|
3113
|
+
if (this.schema = o.schema, this.blockImplementations = o.schema.blockSpecs, this.inlineContentImplementations = o.schema.inlineContentSpecs, this.styleImplementations = o.schema.styleSpecs, o.uploadFile) {
|
|
3114
|
+
const y = o.uploadFile;
|
|
3115
|
+
this.uploadFile = async (P, T) => {
|
|
3077
3116
|
this.onUploadStartCallbacks.forEach(
|
|
3078
|
-
(v) => v.apply(this, [
|
|
3117
|
+
(v) => v.apply(this, [T])
|
|
3079
3118
|
);
|
|
3080
3119
|
try {
|
|
3081
|
-
return await
|
|
3120
|
+
return await y(P, T);
|
|
3082
3121
|
} finally {
|
|
3083
3122
|
this.onUploadEndCallbacks.forEach(
|
|
3084
|
-
(v) => v.apply(this, [
|
|
3123
|
+
(v) => v.apply(this, [T])
|
|
3085
3124
|
);
|
|
3086
3125
|
}
|
|
3087
3126
|
};
|
|
3088
3127
|
}
|
|
3089
|
-
this.resolveFileUrl =
|
|
3128
|
+
this.resolveFileUrl = o.resolveFileUrl, this._eventManager = new Co(this), this._extensionManager = new yn(this, o);
|
|
3090
3129
|
const s = this._extensionManager.getTiptapExtensions(), r = this._extensionManager.hasExtension("ySync") || this._extensionManager.hasExtension("liveblocksExtension");
|
|
3091
|
-
r &&
|
|
3130
|
+
r && o.initialContent && console.warn(
|
|
3092
3131
|
"When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"
|
|
3093
3132
|
);
|
|
3094
3133
|
const a = {
|
|
3095
|
-
...
|
|
3096
|
-
...
|
|
3134
|
+
...Ln,
|
|
3135
|
+
...o._tiptapOptions,
|
|
3097
3136
|
element: null,
|
|
3098
|
-
autofocus:
|
|
3137
|
+
autofocus: o.autofocus ?? !1,
|
|
3099
3138
|
extensions: s,
|
|
3100
3139
|
editorProps: {
|
|
3101
|
-
...(m =
|
|
3140
|
+
...(m = o._tiptapOptions) == null ? void 0 : m.editorProps,
|
|
3102
3141
|
attributes: {
|
|
3103
3142
|
// As of TipTap v2.5.0 the tabIndex is removed when the editor is not
|
|
3104
3143
|
// editable, so you can't focus it. We want to revert this as we have
|
|
3105
3144
|
// UI behaviour that relies on it.
|
|
3106
3145
|
tabIndex: "0",
|
|
3107
|
-
...(k = (f =
|
|
3108
|
-
...(
|
|
3109
|
-
class:
|
|
3146
|
+
...(k = (f = o._tiptapOptions) == null ? void 0 : f.editorProps) == null ? void 0 : k.attributes,
|
|
3147
|
+
...(b = o.domAttributes) == null ? void 0 : b.editor,
|
|
3148
|
+
class: Z(
|
|
3110
3149
|
"bn-editor",
|
|
3111
|
-
|
|
3112
|
-
((
|
|
3150
|
+
o.defaultStyles ? "bn-default-styles" : "",
|
|
3151
|
+
((w = (g = o.domAttributes) == null ? void 0 : g.editor) == null ? void 0 : w.class) || ""
|
|
3113
3152
|
)
|
|
3114
3153
|
},
|
|
3115
|
-
transformPasted:
|
|
3154
|
+
transformPasted: _n
|
|
3116
3155
|
}
|
|
3117
3156
|
};
|
|
3118
3157
|
try {
|
|
3119
|
-
const
|
|
3158
|
+
const y = o.initialContent || (r ? [
|
|
3120
3159
|
{
|
|
3121
3160
|
type: "paragraph",
|
|
3122
3161
|
id: "initialBlockId"
|
|
@@ -3127,46 +3166,46 @@ class Le extends Se {
|
|
|
3127
3166
|
id: me.options.generateID()
|
|
3128
3167
|
}
|
|
3129
3168
|
]);
|
|
3130
|
-
if (!Array.isArray(
|
|
3169
|
+
if (!Array.isArray(y) || y.length === 0)
|
|
3131
3170
|
throw new Error(
|
|
3132
|
-
"initialContent must be a non-empty array of blocks, received: " +
|
|
3171
|
+
"initialContent must be a non-empty array of blocks, received: " + y
|
|
3133
3172
|
);
|
|
3134
|
-
const P =
|
|
3135
|
-
(
|
|
3136
|
-
), v =
|
|
3173
|
+
const P = At(a.extensions), T = y.map(
|
|
3174
|
+
(Oe) => Q(Oe, P, this.schema.styleSchema).toJSON()
|
|
3175
|
+
), v = _t(
|
|
3137
3176
|
{
|
|
3138
3177
|
type: "doc",
|
|
3139
3178
|
content: [
|
|
3140
3179
|
{
|
|
3141
3180
|
type: "blockGroup",
|
|
3142
|
-
content:
|
|
3181
|
+
content: T
|
|
3143
3182
|
}
|
|
3144
3183
|
]
|
|
3145
3184
|
},
|
|
3146
3185
|
P,
|
|
3147
3186
|
a.parseOptions
|
|
3148
3187
|
);
|
|
3149
|
-
this._tiptapEditor = new
|
|
3188
|
+
this._tiptapEditor = new Dt({
|
|
3150
3189
|
...a,
|
|
3151
3190
|
content: v.toJSON()
|
|
3152
3191
|
}), this.pmSchema = this._tiptapEditor.schema;
|
|
3153
|
-
} catch (
|
|
3192
|
+
} catch (y) {
|
|
3154
3193
|
throw new Error(
|
|
3155
3194
|
"Error creating document from blocks passed as `initialContent`",
|
|
3156
|
-
{ cause:
|
|
3195
|
+
{ cause: y }
|
|
3157
3196
|
);
|
|
3158
3197
|
}
|
|
3159
3198
|
let c;
|
|
3160
3199
|
const i = this.pmSchema.nodes.doc.createAndFill;
|
|
3161
|
-
this.pmSchema.nodes.doc.createAndFill = (...
|
|
3200
|
+
this.pmSchema.nodes.doc.createAndFill = (...y) => {
|
|
3162
3201
|
if (c)
|
|
3163
3202
|
return c;
|
|
3164
|
-
const P = i.apply(this.pmSchema.nodes.doc,
|
|
3165
|
-
return
|
|
3166
|
-
}, this.pmSchema.cached.blockNoteEditor = this, this._blockManager = new
|
|
3203
|
+
const P = i.apply(this.pmSchema.nodes.doc, y), T = JSON.parse(JSON.stringify(P.toJSON()));
|
|
3204
|
+
return T.content[0].content[0].attrs.id = "initialBlockId", c = Ve.fromJSON(this.pmSchema, T), c;
|
|
3205
|
+
}, this.pmSchema.cached.blockNoteEditor = this, this._blockManager = new Bo(this), this._exportManager = new _o(this), this._selectionManager = new Mn(this), this._stateManager = new wn(this), this._styleManager = new Pn(this), this.emit("create");
|
|
3167
3206
|
}
|
|
3168
3207
|
static create(t) {
|
|
3169
|
-
return new
|
|
3208
|
+
return new Ne(t ?? {});
|
|
3170
3209
|
}
|
|
3171
3210
|
/**
|
|
3172
3211
|
* BlockNote extensions that are added to the editor, keyed by the extension key
|
|
@@ -3269,14 +3308,14 @@ class Le extends Se {
|
|
|
3269
3308
|
// TODO move to extension
|
|
3270
3309
|
onUploadStart(t) {
|
|
3271
3310
|
return this.onUploadStartCallbacks.push(t), () => {
|
|
3272
|
-
const
|
|
3273
|
-
|
|
3311
|
+
const o = this.onUploadStartCallbacks.indexOf(t);
|
|
3312
|
+
o > -1 && this.onUploadStartCallbacks.splice(o, 1);
|
|
3274
3313
|
};
|
|
3275
3314
|
}
|
|
3276
3315
|
onUploadEnd(t) {
|
|
3277
3316
|
return this.onUploadEndCallbacks.push(t), () => {
|
|
3278
|
-
const
|
|
3279
|
-
|
|
3317
|
+
const o = this.onUploadEndCallbacks.indexOf(t);
|
|
3318
|
+
o > -1 && this.onUploadEndCallbacks.splice(o, 1);
|
|
3280
3319
|
};
|
|
3281
3320
|
}
|
|
3282
3321
|
/**
|
|
@@ -3340,8 +3379,8 @@ class Le extends Se {
|
|
|
3340
3379
|
* @param callback The callback to execute for each block. Returning `false` stops the traversal.
|
|
3341
3380
|
* @param reverse Whether the blocks should be traversed in reverse order.
|
|
3342
3381
|
*/
|
|
3343
|
-
forEachBlock(t,
|
|
3344
|
-
this._blockManager.forEachBlock(t,
|
|
3382
|
+
forEachBlock(t, o = !1) {
|
|
3383
|
+
this._blockManager.forEachBlock(t, o);
|
|
3345
3384
|
}
|
|
3346
3385
|
/**
|
|
3347
3386
|
* Executes a callback whenever the editor's contents change.
|
|
@@ -3382,8 +3421,8 @@ class Le extends Se {
|
|
|
3382
3421
|
* @param targetBlock The identifier of an existing block that the text cursor should be moved to.
|
|
3383
3422
|
* @param placement Whether the text cursor should be placed at the start or end of the block.
|
|
3384
3423
|
*/
|
|
3385
|
-
setTextCursorPosition(t,
|
|
3386
|
-
return this._selectionManager.setTextCursorPosition(t,
|
|
3424
|
+
setTextCursorPosition(t, o = "start") {
|
|
3425
|
+
return this._selectionManager.setTextCursorPosition(t, o);
|
|
3387
3426
|
}
|
|
3388
3427
|
/**
|
|
3389
3428
|
* Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
|
|
@@ -3409,8 +3448,8 @@ class Le extends Se {
|
|
|
3409
3448
|
* @param startBlock The identifier of the block that should be the start of the selection.
|
|
3410
3449
|
* @param endBlock The identifier of the block that should be the end of the selection.
|
|
3411
3450
|
*/
|
|
3412
|
-
setSelection(t,
|
|
3413
|
-
return this._selectionManager.setSelection(t,
|
|
3451
|
+
setSelection(t, o) {
|
|
3452
|
+
return this._selectionManager.setSelection(t, o);
|
|
3414
3453
|
}
|
|
3415
3454
|
/**
|
|
3416
3455
|
* Checks if the editor is currently editable, or if it's locked.
|
|
@@ -3434,10 +3473,10 @@ class Le extends Se {
|
|
|
3434
3473
|
* @param placement Whether the blocks should be inserted just before, just after, or nested inside the
|
|
3435
3474
|
* `referenceBlock`.
|
|
3436
3475
|
*/
|
|
3437
|
-
insertBlocks(t,
|
|
3476
|
+
insertBlocks(t, o, s = "before") {
|
|
3438
3477
|
return this._blockManager.insertBlocks(
|
|
3439
3478
|
t,
|
|
3440
|
-
|
|
3479
|
+
o,
|
|
3441
3480
|
s
|
|
3442
3481
|
);
|
|
3443
3482
|
}
|
|
@@ -3448,8 +3487,8 @@ class Le extends Se {
|
|
|
3448
3487
|
* @param blockToUpdate The block that should be updated.
|
|
3449
3488
|
* @param update A partial block which defines how the existing block should be changed.
|
|
3450
3489
|
*/
|
|
3451
|
-
updateBlock(t,
|
|
3452
|
-
return this._blockManager.updateBlock(t,
|
|
3490
|
+
updateBlock(t, o) {
|
|
3491
|
+
return this._blockManager.updateBlock(t, o);
|
|
3453
3492
|
}
|
|
3454
3493
|
/**
|
|
3455
3494
|
* Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
|
|
@@ -3465,8 +3504,8 @@ class Le extends Se {
|
|
|
3465
3504
|
* @param blocksToRemove An array of blocks that should be replaced.
|
|
3466
3505
|
* @param blocksToInsert An array of partial blocks to replace the old ones with.
|
|
3467
3506
|
*/
|
|
3468
|
-
replaceBlocks(t,
|
|
3469
|
-
return this._blockManager.replaceBlocks(t,
|
|
3507
|
+
replaceBlocks(t, o) {
|
|
3508
|
+
return this._blockManager.replaceBlocks(t, o);
|
|
3470
3509
|
}
|
|
3471
3510
|
/**
|
|
3472
3511
|
* Undo the last action.
|
|
@@ -3485,8 +3524,8 @@ class Le extends Se {
|
|
|
3485
3524
|
*
|
|
3486
3525
|
* @param content can be a string, or array of partial inline content elements
|
|
3487
3526
|
*/
|
|
3488
|
-
insertInlineContent(t, { updateSelection:
|
|
3489
|
-
this._styleManager.insertInlineContent(t, { updateSelection:
|
|
3527
|
+
insertInlineContent(t, { updateSelection: o = !1 } = {}) {
|
|
3528
|
+
this._styleManager.insertInlineContent(t, { updateSelection: o });
|
|
3490
3529
|
}
|
|
3491
3530
|
/**
|
|
3492
3531
|
* Gets the active text styles at the text cursor position or at the end of the current selection if it's active.
|
|
@@ -3532,8 +3571,8 @@ class Le extends Se {
|
|
|
3532
3571
|
* @param url The link URL.
|
|
3533
3572
|
* @param text The text to display the link with.
|
|
3534
3573
|
*/
|
|
3535
|
-
createLink(t,
|
|
3536
|
-
this._styleManager.createLink(t,
|
|
3574
|
+
createLink(t, o) {
|
|
3575
|
+
this._styleManager.createLink(t, o);
|
|
3537
3576
|
}
|
|
3538
3577
|
/**
|
|
3539
3578
|
* Checks if the block containing the text cursor can be nested.
|
|
@@ -3632,8 +3671,8 @@ class Le extends Se {
|
|
|
3632
3671
|
* @param callback The callback to execute.
|
|
3633
3672
|
* @returns A function to remove the callback.
|
|
3634
3673
|
*/
|
|
3635
|
-
onChange(t,
|
|
3636
|
-
return this._eventManager.onChange(t,
|
|
3674
|
+
onChange(t, o) {
|
|
3675
|
+
return this._eventManager.onChange(t, o);
|
|
3637
3676
|
}
|
|
3638
3677
|
/**
|
|
3639
3678
|
* A callback function that runs whenever the text cursor position or selection changes.
|
|
@@ -3641,10 +3680,10 @@ class Le extends Se {
|
|
|
3641
3680
|
* @param callback The callback to execute.
|
|
3642
3681
|
* @returns A function to remove the callback.
|
|
3643
3682
|
*/
|
|
3644
|
-
onSelectionChange(t,
|
|
3683
|
+
onSelectionChange(t, o) {
|
|
3645
3684
|
return this._eventManager.onSelectionChange(
|
|
3646
3685
|
t,
|
|
3647
|
-
|
|
3686
|
+
o
|
|
3648
3687
|
);
|
|
3649
3688
|
}
|
|
3650
3689
|
/**
|
|
@@ -3685,8 +3724,8 @@ class Le extends Se {
|
|
|
3685
3724
|
* @param html The HTML to paste.
|
|
3686
3725
|
* @param raw Whether to paste the HTML as is, or to convert it to BlockNote HTML.
|
|
3687
3726
|
*/
|
|
3688
|
-
pasteHTML(t,
|
|
3689
|
-
this._exportManager.pasteHTML(t,
|
|
3727
|
+
pasteHTML(t, o = !1) {
|
|
3728
|
+
this._exportManager.pasteHTML(t, o);
|
|
3690
3729
|
}
|
|
3691
3730
|
/**
|
|
3692
3731
|
* Paste text into the editor. Defaults to interpreting text as markdown.
|
|
@@ -3703,19 +3742,19 @@ class Le extends Se {
|
|
|
3703
3742
|
return this._exportManager.pasteMarkdown(t);
|
|
3704
3743
|
}
|
|
3705
3744
|
}
|
|
3706
|
-
class
|
|
3707
|
-
constructor(e, t,
|
|
3708
|
-
this.mappings = t, this.options =
|
|
3745
|
+
class cs {
|
|
3746
|
+
constructor(e, t, o) {
|
|
3747
|
+
this.mappings = t, this.options = o;
|
|
3709
3748
|
}
|
|
3710
3749
|
async resolveFile(e) {
|
|
3711
|
-
var
|
|
3712
|
-
if (!((
|
|
3750
|
+
var o;
|
|
3751
|
+
if (!((o = this.options) != null && o.resolveFileUrl))
|
|
3713
3752
|
return (await fetch(e)).blob();
|
|
3714
3753
|
const t = await this.options.resolveFileUrl(e);
|
|
3715
3754
|
return t instanceof Blob ? t : (await fetch(t)).blob();
|
|
3716
3755
|
}
|
|
3717
3756
|
mapStyles(e) {
|
|
3718
|
-
return Object.entries(e).map(([
|
|
3757
|
+
return Object.entries(e).map(([o, s]) => this.mappings.styleMapping[o](s, this));
|
|
3719
3758
|
}
|
|
3720
3759
|
mapInlineContent(e) {
|
|
3721
3760
|
return this.mappings.inlineContentMapping[e.type](
|
|
@@ -3726,27 +3765,27 @@ class rs {
|
|
|
3726
3765
|
transformInlineContent(e) {
|
|
3727
3766
|
return e.map((t) => this.mapInlineContent(t));
|
|
3728
3767
|
}
|
|
3729
|
-
async mapBlock(e, t,
|
|
3768
|
+
async mapBlock(e, t, o, s) {
|
|
3730
3769
|
return this.mappings.blockMapping[e.type](
|
|
3731
3770
|
e,
|
|
3732
3771
|
this,
|
|
3733
3772
|
t,
|
|
3734
|
-
|
|
3773
|
+
o,
|
|
3735
3774
|
s
|
|
3736
3775
|
);
|
|
3737
3776
|
}
|
|
3738
3777
|
}
|
|
3739
|
-
function
|
|
3778
|
+
function ls(n) {
|
|
3740
3779
|
return {
|
|
3741
3780
|
createBlockMapping: (e) => e,
|
|
3742
3781
|
createInlineContentMapping: (e) => e,
|
|
3743
3782
|
createStyleMapping: (e) => e
|
|
3744
3783
|
};
|
|
3745
3784
|
}
|
|
3746
|
-
function
|
|
3747
|
-
const t = [...
|
|
3748
|
-
for (const
|
|
3749
|
-
for (const s of
|
|
3785
|
+
function ds(n, ...e) {
|
|
3786
|
+
const t = [...n];
|
|
3787
|
+
for (const o of e)
|
|
3788
|
+
for (const s of o) {
|
|
3750
3789
|
const r = t.findLastIndex(
|
|
3751
3790
|
(a) => a.group === s.group
|
|
3752
3791
|
);
|
|
@@ -3755,172 +3794,172 @@ function is(o, ...e) {
|
|
|
3755
3794
|
return t;
|
|
3756
3795
|
}
|
|
3757
3796
|
export {
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3797
|
+
Ne as BlockNoteEditor,
|
|
3798
|
+
Mt as BlockNoteSchema,
|
|
3799
|
+
Ps as COLORS_DARK_MODE_DEFAULT,
|
|
3800
|
+
vs as COLORS_DEFAULT,
|
|
3801
|
+
ia as CustomBlockNoteSchema,
|
|
3802
|
+
Is as EMPTY_CELL_HEIGHT,
|
|
3803
|
+
Ye as EMPTY_CELL_WIDTH,
|
|
3765
3804
|
Se as EventEmitter,
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3805
|
+
cs as Exporter,
|
|
3806
|
+
As as FILE_AUDIO_ICON_SVG,
|
|
3807
|
+
_s as FILE_IMAGE_ICON_SVG,
|
|
3808
|
+
Ds as FILE_VIDEO_ICON_SVG,
|
|
3770
3809
|
Pe as HTMLToBlocks,
|
|
3771
3810
|
me as UniqueID,
|
|
3772
3811
|
F as UnreachableCaseError,
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
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
|
-
|
|
3812
|
+
Ls as addDefaultPropsExternalHTML,
|
|
3813
|
+
V as addInlineContentAttributes,
|
|
3814
|
+
qe as addInlineContentKeyboardShortcuts,
|
|
3815
|
+
Ns as addNodeAndExtensionsToSpec,
|
|
3816
|
+
Os as addStyleAttributes,
|
|
3817
|
+
Fs as applyNonSelectableBlockFix,
|
|
3818
|
+
fs as assertEmpty,
|
|
3819
|
+
$s as audioParse,
|
|
3820
|
+
Hs as audioRender,
|
|
3821
|
+
Vs as audioToExternalHTML,
|
|
3822
|
+
Us as blockHasType,
|
|
3823
|
+
Q as blockToNode,
|
|
3824
|
+
rt as blocksToMarkdown,
|
|
3825
|
+
zs as camelToDataKebab,
|
|
3826
|
+
Gs as captureCellAnchor,
|
|
3827
|
+
ca as checkPageBreakBlocksInSchema,
|
|
3828
|
+
at as cleanHTMLToMarkdown,
|
|
3829
|
+
ds as combineByGroup,
|
|
3830
|
+
je as contentNodeToInlineContent,
|
|
3831
|
+
Re as contentNodeToTableContent,
|
|
3832
|
+
Rs as createAudioBlockConfig,
|
|
3833
|
+
js as createAudioBlockSpec,
|
|
3834
|
+
Ws as createBlockConfig,
|
|
3835
|
+
qs as createBlockSpec,
|
|
3836
|
+
Ks as createBlockSpecFromTiptapNode,
|
|
3837
|
+
Js as createBulletListItemBlockConfig,
|
|
3838
|
+
Ys as createBulletListItemBlockSpec,
|
|
3839
|
+
Qs as createCheckListItemBlockSpec,
|
|
3840
|
+
Xs as createCheckListItemConfig,
|
|
3841
|
+
Zs as createCodeBlockConfig,
|
|
3842
|
+
er as createCodeBlockSpec,
|
|
3843
|
+
tr as createDefaultBlockDOMOutputSpec,
|
|
3844
|
+
or as createDividerBlockConfig,
|
|
3845
|
+
nr as createDividerBlockSpec,
|
|
3846
|
+
$t as createExtension,
|
|
3847
|
+
ge as createExternalHTMLExporter,
|
|
3848
|
+
sr as createFileBlockConfig,
|
|
3849
|
+
rr as createFileBlockSpec,
|
|
3850
|
+
ar as createHeadingBlockConfig,
|
|
3851
|
+
ir as createHeadingBlockSpec,
|
|
3852
|
+
cr as createImageBlockConfig,
|
|
3853
|
+
lr as createImageBlockSpec,
|
|
3854
|
+
is as createInlineContentSpec,
|
|
3855
|
+
Je as createInlineContentSpecFromTipTapNode,
|
|
3856
|
+
io as createInternalHTMLSerializer,
|
|
3857
|
+
dr as createInternalInlineContentSpec,
|
|
3858
|
+
ur as createInternalStyleSpec,
|
|
3859
|
+
pr as createNumberedListItemBlockConfig,
|
|
3860
|
+
fr as createNumberedListItemBlockSpec,
|
|
3861
|
+
la as createPageBreakBlockConfig,
|
|
3862
|
+
da as createPageBreakBlockSpec,
|
|
3863
|
+
hr as createParagraphBlockConfig,
|
|
3864
|
+
mr as createParagraphBlockSpec,
|
|
3865
|
+
kr as createQuoteBlockConfig,
|
|
3866
|
+
br as createQuoteBlockSpec,
|
|
3867
|
+
ma as createStore,
|
|
3868
|
+
gr as createStyleSpec,
|
|
3869
|
+
yr as createStyleSpecFromTipTapMark,
|
|
3870
|
+
Sr as createTableBlockSpec,
|
|
3871
|
+
Br as createToggleListItemBlockConfig,
|
|
3872
|
+
Cr as createToggleListItemBlockSpec,
|
|
3873
|
+
Er as createToggleWrapper,
|
|
3874
|
+
xr as createVideoBlockConfig,
|
|
3875
|
+
Mr as createVideoBlockSpec,
|
|
3876
|
+
wr as defaultBlockSpecs,
|
|
3877
|
+
Tr as defaultBlockToHTML,
|
|
3878
|
+
Pr as defaultInlineContentSchema,
|
|
3879
|
+
vr as defaultInlineContentSpecs,
|
|
3880
|
+
Ir as defaultProps,
|
|
3881
|
+
Ar as defaultStyleSchema,
|
|
3882
|
+
_r as defaultStyleSpecs,
|
|
3883
|
+
Dr as defaultToggledState,
|
|
3884
|
+
Ge as docToBlocks,
|
|
3885
|
+
Lr as editorHasBlockWithType,
|
|
3886
|
+
Sn as expandPMRangeToWords,
|
|
3887
|
+
Nr as fileParse,
|
|
3888
|
+
Or as filenameFromURL,
|
|
3889
|
+
K as fixColumnList,
|
|
3890
|
+
Fr as formatKeyboardShortcut,
|
|
3891
|
+
Ze as getBackgroundColorAttribute,
|
|
3892
|
+
bo as getBlock,
|
|
3893
|
+
hs as getBlockCache,
|
|
3894
|
+
$r as getBlockFromPos,
|
|
3895
|
+
R as getBlockInfo,
|
|
3896
|
+
X as getBlockInfoFromResolvedPos,
|
|
3858
3897
|
B as getBlockInfoFromSelection,
|
|
3859
3898
|
$ as getBlockInfoFromTransaction,
|
|
3860
|
-
|
|
3899
|
+
ms as getBlockInfoWithManualOffset,
|
|
3861
3900
|
ke as getBlockNoteSchema,
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3901
|
+
ks as getBlockSchema,
|
|
3902
|
+
st as getBlocksChangedByTransaction,
|
|
3903
|
+
bs as getColspan,
|
|
3904
|
+
Yt as getInlineContentParseRules,
|
|
3905
|
+
gs as getInlineContentSchema,
|
|
3906
|
+
Hr as getInlineContentSchemaFromSpecs,
|
|
3907
|
+
Vr as getLanguageId,
|
|
3869
3908
|
_ as getNearestBlockPos,
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3909
|
+
yo as getNextBlock,
|
|
3910
|
+
E as getNodeById,
|
|
3911
|
+
ua as getPageBreakSlashMenuItems,
|
|
3912
|
+
So as getParentBlock,
|
|
3913
|
+
Ur as getParseRules,
|
|
3875
3914
|
C as getPmSchema,
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3915
|
+
go as getPrevBlock,
|
|
3916
|
+
ys as getRowspan,
|
|
3917
|
+
zr as getStyleParseRules,
|
|
3918
|
+
Ss as getStyleSchema,
|
|
3919
|
+
Gr as getStyleSchemaFromSpecs,
|
|
3920
|
+
Rr as getTextAlignmentAttribute,
|
|
3921
|
+
ot as getTextColorAttribute,
|
|
3922
|
+
jr as imageParse,
|
|
3923
|
+
Wr as imageRender,
|
|
3924
|
+
qr as imageToExternalHTML,
|
|
3886
3925
|
O as inlineContentToNodes,
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3926
|
+
Qt as insertBlocks,
|
|
3927
|
+
Kr as isAppleOS,
|
|
3928
|
+
q as isEmptyColumn,
|
|
3929
|
+
Bs as isLinkInlineContent,
|
|
3930
|
+
Jr as isNodeBlock,
|
|
3931
|
+
Cs as isPartialLinkInlineContent,
|
|
3932
|
+
Es as isPartialTableCell,
|
|
3933
|
+
Yr as isSafari,
|
|
3934
|
+
xs as isStyledTextInlineContent,
|
|
3935
|
+
Ms as isTableCell,
|
|
3936
|
+
Qr as isTableCellSelection,
|
|
3937
|
+
Xe as isVideoUrl,
|
|
3938
|
+
ws as mapTableCell,
|
|
3939
|
+
ls as mappingFactory,
|
|
3940
|
+
Ao as markdownToBlocks,
|
|
3902
3941
|
ve as markdownToHTML,
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3942
|
+
Z as mergeCSSClasses,
|
|
3943
|
+
Xr as mergeParagraphs,
|
|
3944
|
+
S as nodeToBlock,
|
|
3945
|
+
G as nodeToCustomInlineContent,
|
|
3946
|
+
Zr as parseAudioElement,
|
|
3947
|
+
ea as parseDefaultProps,
|
|
3948
|
+
Ke as propsToAttributes,
|
|
3949
|
+
We as prosemirrorSliceToSlicedBlocks,
|
|
3911
3950
|
ae as removeAndInsertBlocks,
|
|
3912
|
-
|
|
3951
|
+
Xt as removeEmptyColumns,
|
|
3913
3952
|
Ae as selectedFragmentToHTML,
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3953
|
+
ta as stylePropsToAttributes,
|
|
3954
|
+
ze as tableContentToNodes,
|
|
3955
|
+
oa as tablePropSchema,
|
|
3956
|
+
na as trackPosition,
|
|
3957
|
+
Qe as updateBlock,
|
|
3958
|
+
tt as updateBlockCommand,
|
|
3959
|
+
nt as updateBlockTr,
|
|
3960
|
+
pa as uploadToTmpFilesDotOrg_DEV_ONLY,
|
|
3961
|
+
sa as videoParse,
|
|
3962
|
+
fa as withPageBreak,
|
|
3963
|
+
ra as wrapInBlockStructure
|
|
3925
3964
|
};
|
|
3926
3965
|
//# sourceMappingURL=blocknote.js.map
|