@blocknote/core 0.46.1 → 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-DsMVJZv4.js → BlockNoteSchema-1r-ln0Q0.js} +2 -2
- package/dist/{BlockNoteSchema-DsMVJZv4.js.map → BlockNoteSchema-1r-ln0Q0.js.map} +1 -1
- package/dist/{BlockNoteSchema-qt4Czo0-.cjs → BlockNoteSchema-DT4bdXj5.cjs} +2 -2
- package/dist/{BlockNoteSchema-qt4Czo0-.cjs.map → BlockNoteSchema-DT4bdXj5.cjs.map} +1 -1
- package/dist/{TrailingNode-C-Kyrtf1.js → TrailingNode-DZag-Nvu.js} +476 -464
- 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 +1264 -1165
- package/dist/blocknote.js.map +1 -1
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +2 -2
- package/dist/{defaultBlocks-CXOCngjC.js → defaultBlocks-BSOEW3GR.js} +33 -29
- 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/api/exporters/html/internalHTMLSerializer.ts +146 -2
- package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +3 -0
- package/src/blocks/Code/block.ts +12 -8
- package/src/blocks/ListItem/CheckListItem/block.test.ts +61 -0
- package/src/blocks/ListItem/CheckListItem/block.ts +4 -0
- package/src/editor/Block.css +7 -3
- package/src/editor/editor.css +1 -0
- package/src/editor/transformPasted.ts +69 -0
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.ts +1 -0
- package/src/extensions/SideMenu/SideMenu.ts +44 -0
- package/src/extensions/TableHandles/TableHandles.ts +6 -2
- 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/src/schema/blocks/createSpec.ts +4 -2
- package/src/schema/blocks/types.ts +9 -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/types/src/schema/blocks/types.d.ts +9 -3
- package/dist/TrailingNode-C-Kyrtf1.js.map +0 -1
- package/dist/TrailingNode-W7GJVng5.cjs +0 -2
- package/dist/TrailingNode-W7GJVng5.cjs.map +0 -1
- package/dist/defaultBlocks-CXOCngjC.js.map +0 -1
- package/dist/defaultBlocks-IsUGVZIq.cjs +0 -6
- package/dist/defaultBlocks-IsUGVZIq.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
|
|
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 M, Plugin 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 Ke(
|
|
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
|
-
const r = this.options.editor,
|
|
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,124 +85,124 @@ function Qn(o, e) {
|
|
|
85
85
|
},
|
|
86
86
|
r
|
|
87
87
|
);
|
|
88
|
-
return
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
return V(
|
|
89
|
+
a,
|
|
90
|
+
n.type,
|
|
91
91
|
s.attrs,
|
|
92
|
-
|
|
92
|
+
n.propSchema
|
|
93
93
|
);
|
|
94
94
|
},
|
|
95
95
|
addNodeView() {
|
|
96
96
|
return (s) => {
|
|
97
|
-
const { node: r, getPos:
|
|
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
|
|
103
103
|
),
|
|
104
104
|
// TODO: fix cast
|
|
105
105
|
(l) => {
|
|
106
|
-
const d = O([l], c.pmSchema), u =
|
|
106
|
+
const d = O([l], c.pmSchema), u = a();
|
|
107
107
|
u && c.transact(
|
|
108
108
|
(p) => p.replaceWith(u, u + r.nodeSize, d)
|
|
109
109
|
);
|
|
110
110
|
},
|
|
111
111
|
c
|
|
112
112
|
);
|
|
113
|
-
return
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
return V(
|
|
114
|
+
i,
|
|
115
|
+
n.type,
|
|
116
116
|
r.attrs,
|
|
117
|
-
|
|
117
|
+
n.propSchema
|
|
118
118
|
);
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
122
|
return Je(
|
|
123
123
|
t,
|
|
124
|
-
|
|
124
|
+
n.propSchema,
|
|
125
125
|
{
|
|
126
126
|
...e,
|
|
127
127
|
toExternalHTML: e.toExternalHTML,
|
|
128
|
-
render(s, r,
|
|
128
|
+
render(s, r, a) {
|
|
129
129
|
const c = e.render(
|
|
130
130
|
s,
|
|
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
|
-
let
|
|
151
|
-
return
|
|
152
|
-
new
|
|
153
|
-
),
|
|
154
|
-
(d) =>
|
|
150
|
+
let i = c.posBeforeNode;
|
|
151
|
+
return o === "after" && (i += c.node.nodeSize), n.step(
|
|
152
|
+
new Ue(i, i, new N(A.from(a), 0, 0))
|
|
153
|
+
), a.map(
|
|
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,
|
|
193
|
-
if (!
|
|
192
|
+
const s = e + 1, a = n.doc.resolve(s).nodeAfter, c = e + o.nodeSize - 1, l = n.doc.resolve(c).nodeBefore;
|
|
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,14 +215,14 @@ 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
|
-
s +
|
|
225
|
+
s + a.nodeSize - 1,
|
|
226
226
|
// Doesn't append anything.
|
|
227
227
|
N.empty,
|
|
228
228
|
0,
|
|
@@ -232,29 +232,29 @@ function W(o, e) {
|
|
|
232
232
|
return;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
function
|
|
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 (
|
|
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 ie(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) =>
|
|
268
|
-
), removedBlocks:
|
|
266
|
+
return c.forEach((u) => K(n, u)), { insertedBlocks: s.map(
|
|
267
|
+
(u) => S(u, o)
|
|
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
|
-
for (const
|
|
284
|
-
if (
|
|
285
|
-
const l =
|
|
283
|
+
for (const i of r)
|
|
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 =
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
287
|
+
const d = G(
|
|
288
|
+
i,
|
|
289
|
+
n.schema.inlineContentSchema,
|
|
290
|
+
n.schema.styleSchema
|
|
291
291
|
), u = l.render.call(
|
|
292
292
|
{
|
|
293
293
|
renderType: "dom",
|
|
@@ -296,12 +296,12 @@ function Yt(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) {
|
|
303
303
|
const p = t.serializeFragment(
|
|
304
|
-
|
|
304
|
+
i.content,
|
|
305
305
|
s
|
|
306
306
|
);
|
|
307
307
|
u.contentDOM.dataset.editable = "", u.contentDOM.appendChild(p);
|
|
@@ -309,13 +309,13 @@ function Yt(o, e, t, n, s) {
|
|
|
309
309
|
continue;
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
-
} else if (
|
|
312
|
+
} else if (i.type.name === "text") {
|
|
313
313
|
let l = document.createTextNode(
|
|
314
|
-
|
|
314
|
+
i.textContent
|
|
315
315
|
);
|
|
316
|
-
for (const d of
|
|
317
|
-
if (d.type.name in
|
|
318
|
-
const u =
|
|
316
|
+
for (const d of i.marks.toReversed())
|
|
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);
|
|
@@ -324,50 +324,50 @@ function Yt(o, e, t, n, s) {
|
|
|
324
324
|
c.appendChild(l);
|
|
325
325
|
} else {
|
|
326
326
|
const l = t.serializeFragment(
|
|
327
|
-
A.from([
|
|
327
|
+
A.from([i]),
|
|
328
328
|
s
|
|
329
329
|
);
|
|
330
330
|
c.appendChild(l);
|
|
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
|
|
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
|
-
{ ...e, props: r, children:
|
|
347
|
-
|
|
346
|
+
{ ...e, props: r, children: a },
|
|
347
|
+
n
|
|
348
348
|
);
|
|
349
|
-
if (
|
|
350
|
-
const
|
|
351
|
-
|
|
349
|
+
if (i.contentDOM && e.content) {
|
|
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
|
-
|
|
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 =
|
|
368
|
+
(u = i.contentDOM) == null || u.append(b);
|
|
369
369
|
}
|
|
370
|
-
return
|
|
370
|
+
return i.dom;
|
|
371
371
|
}
|
|
372
372
|
const d = (m = (p = s.spec) == null ? void 0 : p.toDOM) == null ? void 0 : m.call(
|
|
373
373
|
p,
|
|
@@ -376,32 +376,92 @@ function Qt(o, e, t, n) {
|
|
|
376
376
|
...r
|
|
377
377
|
})
|
|
378
378
|
);
|
|
379
|
-
return (f = d.contentDOM) == null || f.appendChild(
|
|
380
|
-
Ce(
|
|
379
|
+
return (f = d.contentDOM) == null || f.appendChild(i.dom), e.children && e.children.length > 0 && ((k = d.contentDOM) == null || k.appendChild(
|
|
380
|
+
Ce(n, e.children, t, o)
|
|
381
381
|
)), d.dom;
|
|
382
382
|
}
|
|
383
|
-
function Be(
|
|
384
|
-
const r = ((
|
|
385
|
-
for (const
|
|
386
|
-
const c =
|
|
383
|
+
function Be(n, e, t, o) {
|
|
384
|
+
const r = ((o == null ? void 0 : o.document) ?? document).createDocumentFragment();
|
|
385
|
+
for (const a of e) {
|
|
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 =
|
|
394
|
-
return (c = r.contentDOM) == null || c.appendChild(
|
|
395
|
-
},
|
|
396
|
-
|
|
393
|
+
const s = n.pmSchema.nodes.blockGroup, r = s.spec.toDOM(s.create({})), a = Be(n, e, t, o);
|
|
394
|
+
return (c = r.contentDOM) == null || c.appendChild(a), r.dom;
|
|
395
|
+
}, to = (n) => (n.querySelectorAll(
|
|
396
|
+
'[data-content-type="numberedListItem"]'
|
|
397
|
+
).forEach((t) => {
|
|
398
|
+
var s, r;
|
|
399
|
+
const o = (r = (s = t.closest(".bn-block-outer")) == null ? void 0 : s.previousElementSibling) == null ? void 0 : r.querySelector(
|
|
400
|
+
'[data-content-type="numberedListItem"]'
|
|
401
|
+
);
|
|
402
|
+
if (!o)
|
|
403
|
+
t.setAttribute(
|
|
404
|
+
"data-index",
|
|
405
|
+
t.getAttribute("data-start") || "1"
|
|
406
|
+
);
|
|
407
|
+
else {
|
|
408
|
+
const a = o.getAttribute("data-index");
|
|
409
|
+
t.setAttribute(
|
|
410
|
+
"data-index",
|
|
411
|
+
(parseInt(a || "0") + 1).toString()
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
}), n), oo = (n) => (n.querySelectorAll(
|
|
415
|
+
'[data-content-type="checkListItem"] input'
|
|
416
|
+
).forEach((t) => {
|
|
417
|
+
t.disabled = !0;
|
|
418
|
+
}), n), no = (n) => (n.querySelectorAll(
|
|
419
|
+
'.bn-toggle-wrapper[data-show-children="false"]'
|
|
420
|
+
).forEach((t) => {
|
|
421
|
+
t.setAttribute("data-show-children", "true");
|
|
422
|
+
}), n), so = (n) => (n.querySelectorAll('[data-content-type="table"] table').forEach((t) => {
|
|
423
|
+
t.setAttribute(
|
|
424
|
+
"style",
|
|
425
|
+
`--default-cell-min-width: ${Ye}px;`
|
|
426
|
+
), t.setAttribute("data-show-children", "true");
|
|
427
|
+
}), n), ro = (n) => (n.querySelectorAll('[data-content-type="table"] table').forEach((t) => {
|
|
428
|
+
var r;
|
|
429
|
+
const o = document.createElement("div");
|
|
430
|
+
o.className = "tableWrapper";
|
|
431
|
+
const s = document.createElement("div");
|
|
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
|
+
".bn-inline-content:empty"
|
|
435
|
+
).forEach((t) => {
|
|
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 = [
|
|
440
|
+
to,
|
|
441
|
+
oo,
|
|
442
|
+
no,
|
|
443
|
+
so,
|
|
444
|
+
ro,
|
|
445
|
+
ao
|
|
446
|
+
];
|
|
397
447
|
return {
|
|
398
|
-
serializeBlocks: (
|
|
448
|
+
serializeBlocks: (s, r) => {
|
|
449
|
+
let a = Ce(
|
|
450
|
+
e,
|
|
451
|
+
s,
|
|
452
|
+
t,
|
|
453
|
+
r
|
|
454
|
+
);
|
|
455
|
+
for (const c of o)
|
|
456
|
+
a = c(a);
|
|
457
|
+
return a.outerHTML;
|
|
458
|
+
}
|
|
399
459
|
};
|
|
400
460
|
};
|
|
401
|
-
function
|
|
402
|
-
return
|
|
461
|
+
function co(n) {
|
|
462
|
+
return n.transact((e) => {
|
|
403
463
|
const t = _(e.doc, e.selection.anchor);
|
|
404
|
-
if (e.selection instanceof
|
|
464
|
+
if (e.selection instanceof oe)
|
|
405
465
|
return {
|
|
406
466
|
type: "cell",
|
|
407
467
|
anchorBlockId: t.node.attrs.id,
|
|
@@ -414,130 +474,130 @@ function Zt(o) {
|
|
|
414
474
|
anchorBlockId: t.node.attrs.id
|
|
415
475
|
};
|
|
416
476
|
{
|
|
417
|
-
const
|
|
477
|
+
const o = _(e.doc, e.selection.head);
|
|
418
478
|
return {
|
|
419
479
|
type: "text",
|
|
420
480
|
anchorBlockId: t.node.attrs.id,
|
|
421
|
-
headBlockId:
|
|
481
|
+
headBlockId: o.node.attrs.id,
|
|
422
482
|
anchorOffset: e.selection.anchor - t.posBeforeNode,
|
|
423
|
-
headOffset: e.selection.head -
|
|
483
|
+
headOffset: e.selection.head - o.posBeforeNode
|
|
424
484
|
};
|
|
425
485
|
}
|
|
426
486
|
});
|
|
427
487
|
}
|
|
428
|
-
function
|
|
488
|
+
function lo(n, e) {
|
|
429
489
|
var s, r;
|
|
430
|
-
const t = (s =
|
|
490
|
+
const t = (s = E(e.anchorBlockId, n.doc)) == null ? void 0 : s.posBeforeNode;
|
|
431
491
|
if (t === void 0)
|
|
432
492
|
throw new Error(
|
|
433
493
|
`Could not find block with ID ${e.anchorBlockId} to update selection`
|
|
434
494
|
);
|
|
435
|
-
let
|
|
495
|
+
let o;
|
|
436
496
|
if (e.type === "cell")
|
|
437
|
-
|
|
438
|
-
|
|
497
|
+
o = oe.create(
|
|
498
|
+
n.doc,
|
|
439
499
|
t + e.anchorCellOffset,
|
|
440
500
|
t + e.headCellOffset
|
|
441
501
|
);
|
|
442
502
|
else if (e.type === "node")
|
|
443
|
-
|
|
503
|
+
o = L.create(n.doc, t + 1);
|
|
444
504
|
else {
|
|
445
|
-
const
|
|
446
|
-
if (
|
|
505
|
+
const a = (r = E(e.headBlockId, n.doc)) == null ? void 0 : r.posBeforeNode;
|
|
506
|
+
if (a === void 0)
|
|
447
507
|
throw new Error(
|
|
448
508
|
`Could not find block with ID ${e.headBlockId} to update selection`
|
|
449
509
|
);
|
|
450
|
-
|
|
451
|
-
|
|
510
|
+
o = M.create(
|
|
511
|
+
n.doc,
|
|
452
512
|
t + e.anchorOffset,
|
|
453
|
-
|
|
513
|
+
a + e.headOffset
|
|
454
514
|
);
|
|
455
515
|
}
|
|
456
|
-
|
|
516
|
+
n.setSelection(o);
|
|
457
517
|
}
|
|
458
|
-
function
|
|
459
|
-
return
|
|
518
|
+
function J(n) {
|
|
519
|
+
return n.map((e) => e.type === "columnList" ? e.children.map((t) => J(t.children)).flat() : {
|
|
460
520
|
...e,
|
|
461
|
-
children:
|
|
521
|
+
children: J(e.children)
|
|
462
522
|
}).flat();
|
|
463
523
|
}
|
|
464
|
-
function
|
|
465
|
-
|
|
466
|
-
var
|
|
467
|
-
const s = ((
|
|
468
|
-
|
|
469
|
-
], r =
|
|
470
|
-
|
|
524
|
+
function Ee(n, e, t) {
|
|
525
|
+
n.transact((o) => {
|
|
526
|
+
var a;
|
|
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);
|
|
471
531
|
});
|
|
472
532
|
}
|
|
473
|
-
function
|
|
474
|
-
return !
|
|
533
|
+
function xe(n) {
|
|
534
|
+
return !n || n.type !== "columnList";
|
|
475
535
|
}
|
|
476
|
-
function Me(
|
|
477
|
-
let
|
|
478
|
-
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)
|
|
479
539
|
return;
|
|
480
|
-
const r =
|
|
481
|
-
return
|
|
482
|
-
|
|
483
|
-
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),
|
|
484
544
|
r
|
|
485
545
|
);
|
|
486
546
|
}
|
|
487
|
-
function we(
|
|
488
|
-
let
|
|
489
|
-
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)
|
|
490
550
|
return;
|
|
491
|
-
const r =
|
|
492
|
-
return
|
|
493
|
-
|
|
494
|
-
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),
|
|
495
555
|
r
|
|
496
556
|
);
|
|
497
557
|
}
|
|
498
|
-
function
|
|
499
|
-
|
|
500
|
-
const e =
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
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)
|
|
504
564
|
);
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
565
|
+
o && Ee(
|
|
566
|
+
n,
|
|
567
|
+
o.referenceBlock,
|
|
568
|
+
o.placement
|
|
509
569
|
);
|
|
510
570
|
});
|
|
511
571
|
}
|
|
512
|
-
function
|
|
513
|
-
|
|
514
|
-
const e =
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
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)
|
|
518
578
|
);
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
579
|
+
o && Ee(
|
|
580
|
+
n,
|
|
581
|
+
o.referenceBlock,
|
|
582
|
+
o.placement
|
|
523
583
|
);
|
|
524
584
|
});
|
|
525
585
|
}
|
|
526
|
-
function
|
|
527
|
-
const { $from:
|
|
586
|
+
function fo(n, e, t) {
|
|
587
|
+
const { $from: o, $to: s } = n.selection, r = o.blockRange(
|
|
528
588
|
s,
|
|
529
589
|
(f) => f.childCount > 0 && (f.type.name === "blockGroup" || f.type.name === "column")
|
|
530
590
|
// change necessary to not look at first item child type
|
|
531
591
|
);
|
|
532
592
|
if (!r)
|
|
533
593
|
return !1;
|
|
534
|
-
const
|
|
535
|
-
if (
|
|
594
|
+
const a = r.startIndex;
|
|
595
|
+
if (a === 0)
|
|
536
596
|
return !1;
|
|
537
|
-
const
|
|
538
|
-
if (
|
|
597
|
+
const i = r.parent.child(a - 1);
|
|
598
|
+
if (i.type !== e)
|
|
539
599
|
return !1;
|
|
540
|
-
const l =
|
|
600
|
+
const l = i.lastChild && i.lastChild.type === t, d = A.from(l ? e.create() : null), u = new N(
|
|
541
601
|
A.from(
|
|
542
602
|
e.create(null, A.from(t.create(null, d)))
|
|
543
603
|
// change necessary to create "groupType" instead of parent.type
|
|
@@ -545,8 +605,8 @@ function no(o, e, t) {
|
|
|
545
605
|
l ? 3 : 1,
|
|
546
606
|
0
|
|
547
607
|
), p = r.start, m = r.end;
|
|
548
|
-
return
|
|
549
|
-
new
|
|
608
|
+
return n.step(
|
|
609
|
+
new z(
|
|
550
610
|
p - (l ? 3 : 1),
|
|
551
611
|
m,
|
|
552
612
|
p,
|
|
@@ -557,60 +617,60 @@ function no(o, e, t) {
|
|
|
557
617
|
)
|
|
558
618
|
).scrollIntoView(), !0;
|
|
559
619
|
}
|
|
560
|
-
function Te(
|
|
561
|
-
return
|
|
620
|
+
function Te(n) {
|
|
621
|
+
return n.transact((e) => fo(
|
|
562
622
|
e,
|
|
563
|
-
|
|
564
|
-
|
|
623
|
+
n.pmSchema.nodes.blockContainer,
|
|
624
|
+
n.pmSchema.nodes.blockGroup
|
|
565
625
|
));
|
|
566
626
|
}
|
|
567
|
-
function
|
|
568
|
-
|
|
627
|
+
function ho(n) {
|
|
628
|
+
n._tiptapEditor.commands.liftListItem("blockContainer");
|
|
569
629
|
}
|
|
570
|
-
function
|
|
571
|
-
return
|
|
630
|
+
function mo(n) {
|
|
631
|
+
return n.transact((e) => {
|
|
572
632
|
const { bnBlock: t } = $(e);
|
|
573
633
|
return e.doc.resolve(t.beforePos).nodeBefore !== null;
|
|
574
634
|
});
|
|
575
635
|
}
|
|
576
|
-
function
|
|
577
|
-
return
|
|
636
|
+
function ko(n) {
|
|
637
|
+
return n.transact((e) => {
|
|
578
638
|
const { bnBlock: t } = $(e);
|
|
579
639
|
return e.doc.resolve(t.beforePos).depth > 1;
|
|
580
640
|
});
|
|
581
641
|
}
|
|
582
|
-
function
|
|
583
|
-
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);
|
|
584
644
|
if (s)
|
|
585
|
-
return
|
|
645
|
+
return S(s.node, o);
|
|
586
646
|
}
|
|
587
|
-
function
|
|
588
|
-
const t = typeof e == "string" ? e : e.id,
|
|
589
|
-
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)
|
|
590
650
|
return;
|
|
591
|
-
const
|
|
592
|
-
if (
|
|
593
|
-
return
|
|
651
|
+
const a = n.resolve(o.posBeforeNode).nodeBefore;
|
|
652
|
+
if (a)
|
|
653
|
+
return S(a, s);
|
|
594
654
|
}
|
|
595
|
-
function
|
|
596
|
-
const t = typeof e == "string" ? e : e.id,
|
|
597
|
-
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)
|
|
598
658
|
return;
|
|
599
|
-
const
|
|
600
|
-
|
|
659
|
+
const a = n.resolve(
|
|
660
|
+
o.posBeforeNode + o.node.nodeSize
|
|
601
661
|
).nodeAfter;
|
|
602
|
-
if (
|
|
603
|
-
return
|
|
662
|
+
if (a)
|
|
663
|
+
return S(a, s);
|
|
604
664
|
}
|
|
605
|
-
function
|
|
606
|
-
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);
|
|
607
667
|
if (!s)
|
|
608
668
|
return;
|
|
609
|
-
const r =
|
|
610
|
-
if (
|
|
611
|
-
return
|
|
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
|
+
if (i)
|
|
671
|
+
return S(i, o);
|
|
612
672
|
}
|
|
613
|
-
class
|
|
673
|
+
class Bo {
|
|
614
674
|
constructor(e) {
|
|
615
675
|
this.editor = e;
|
|
616
676
|
}
|
|
@@ -619,7 +679,7 @@ class po {
|
|
|
619
679
|
* @returns A snapshot of all top-level (non-nested) blocks in the editor.
|
|
620
680
|
*/
|
|
621
681
|
get document() {
|
|
622
|
-
return this.editor.transact((e) =>
|
|
682
|
+
return this.editor.transact((e) => Ge(e.doc, this.editor.pmSchema));
|
|
623
683
|
}
|
|
624
684
|
/**
|
|
625
685
|
* Gets a snapshot of an existing block from the editor.
|
|
@@ -629,7 +689,7 @@ class po {
|
|
|
629
689
|
* matching block was found.
|
|
630
690
|
*/
|
|
631
691
|
getBlock(e) {
|
|
632
|
-
return this.editor.transact((t) =>
|
|
692
|
+
return this.editor.transact((t) => bo(t.doc, e));
|
|
633
693
|
}
|
|
634
694
|
/**
|
|
635
695
|
* Gets a snapshot of the previous sibling of an existing block from the
|
|
@@ -641,7 +701,7 @@ class po {
|
|
|
641
701
|
* in the document.
|
|
642
702
|
*/
|
|
643
703
|
getPrevBlock(e) {
|
|
644
|
-
return this.editor.transact((t) =>
|
|
704
|
+
return this.editor.transact((t) => go(t.doc, e));
|
|
645
705
|
}
|
|
646
706
|
/**
|
|
647
707
|
* Gets a snapshot of the next sibling of an existing block from the editor.
|
|
@@ -652,7 +712,7 @@ class po {
|
|
|
652
712
|
* the document.
|
|
653
713
|
*/
|
|
654
714
|
getNextBlock(e) {
|
|
655
|
-
return this.editor.transact((t) =>
|
|
715
|
+
return this.editor.transact((t) => yo(t.doc, e));
|
|
656
716
|
}
|
|
657
717
|
/**
|
|
658
718
|
* Gets a snapshot of the parent of an existing block from the editor.
|
|
@@ -663,7 +723,7 @@ class po {
|
|
|
663
723
|
*/
|
|
664
724
|
getParentBlock(e) {
|
|
665
725
|
return this.editor.transact(
|
|
666
|
-
(t) =>
|
|
726
|
+
(t) => So(t.doc, e)
|
|
667
727
|
);
|
|
668
728
|
}
|
|
669
729
|
/**
|
|
@@ -672,19 +732,19 @@ class po {
|
|
|
672
732
|
* @param reverse Whether the blocks should be traversed in reverse order.
|
|
673
733
|
*/
|
|
674
734
|
forEachBlock(e, t = !1) {
|
|
675
|
-
const
|
|
676
|
-
t &&
|
|
735
|
+
const o = this.document.slice();
|
|
736
|
+
t && o.reverse();
|
|
677
737
|
function s(r) {
|
|
678
|
-
for (const
|
|
679
|
-
if (e(
|
|
738
|
+
for (const a of r) {
|
|
739
|
+
if (e(a) === !1)
|
|
680
740
|
return !1;
|
|
681
|
-
const c = t ?
|
|
741
|
+
const c = t ? a.children.slice().reverse() : a.children;
|
|
682
742
|
if (!s(c))
|
|
683
743
|
return !1;
|
|
684
744
|
}
|
|
685
745
|
return !0;
|
|
686
746
|
}
|
|
687
|
-
s(
|
|
747
|
+
s(o);
|
|
688
748
|
}
|
|
689
749
|
/**
|
|
690
750
|
* Inserts new blocks into the editor. If a block's `id` is undefined, BlockNote generates one automatically. Throws an
|
|
@@ -694,9 +754,9 @@ class po {
|
|
|
694
754
|
* @param placement Whether the blocks should be inserted just before, just after, or nested inside the
|
|
695
755
|
* `referenceBlock`.
|
|
696
756
|
*/
|
|
697
|
-
insertBlocks(e, t,
|
|
757
|
+
insertBlocks(e, t, o = "before") {
|
|
698
758
|
return this.editor.transact(
|
|
699
|
-
(s) =>
|
|
759
|
+
(s) => Qt(s, e, t, o)
|
|
700
760
|
);
|
|
701
761
|
}
|
|
702
762
|
/**
|
|
@@ -707,7 +767,7 @@ class po {
|
|
|
707
767
|
* @param update A partial block which defines how the existing block should be changed.
|
|
708
768
|
*/
|
|
709
769
|
updateBlock(e, t) {
|
|
710
|
-
return this.editor.transact((
|
|
770
|
+
return this.editor.transact((o) => Qe(o, e, t));
|
|
711
771
|
}
|
|
712
772
|
/**
|
|
713
773
|
* Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
|
|
@@ -715,7 +775,7 @@ class po {
|
|
|
715
775
|
*/
|
|
716
776
|
removeBlocks(e) {
|
|
717
777
|
return this.editor.transact(
|
|
718
|
-
(t) =>
|
|
778
|
+
(t) => ae(t, e, []).removedBlocks
|
|
719
779
|
);
|
|
720
780
|
}
|
|
721
781
|
/**
|
|
@@ -727,14 +787,14 @@ class po {
|
|
|
727
787
|
*/
|
|
728
788
|
replaceBlocks(e, t) {
|
|
729
789
|
return this.editor.transact(
|
|
730
|
-
(
|
|
790
|
+
(o) => ae(o, e, t)
|
|
731
791
|
);
|
|
732
792
|
}
|
|
733
793
|
/**
|
|
734
794
|
* Checks if the block containing the text cursor can be nested.
|
|
735
795
|
*/
|
|
736
796
|
canNestBlock() {
|
|
737
|
-
return
|
|
797
|
+
return mo(this.editor);
|
|
738
798
|
}
|
|
739
799
|
/**
|
|
740
800
|
* Nests the block containing the text cursor into the block above it.
|
|
@@ -746,13 +806,13 @@ class po {
|
|
|
746
806
|
* Checks if the block containing the text cursor is nested.
|
|
747
807
|
*/
|
|
748
808
|
canUnnestBlock() {
|
|
749
|
-
return
|
|
809
|
+
return ko(this.editor);
|
|
750
810
|
}
|
|
751
811
|
/**
|
|
752
812
|
* Lifts the block containing the text cursor out of its parent.
|
|
753
813
|
*/
|
|
754
814
|
unnestBlock() {
|
|
755
|
-
|
|
815
|
+
ho(this.editor);
|
|
756
816
|
}
|
|
757
817
|
/**
|
|
758
818
|
* Moves the selected blocks up. If the previous block has children, moves
|
|
@@ -760,7 +820,7 @@ class po {
|
|
|
760
820
|
* current blocks share a common parent, moves them out of & before it.
|
|
761
821
|
*/
|
|
762
822
|
moveBlocksUp() {
|
|
763
|
-
return
|
|
823
|
+
return uo(this.editor);
|
|
764
824
|
}
|
|
765
825
|
/**
|
|
766
826
|
* Moves the selected blocks down. If the next block has children, moves
|
|
@@ -768,16 +828,16 @@ class po {
|
|
|
768
828
|
* current blocks share a common parent, moves them out of & after it.
|
|
769
829
|
*/
|
|
770
830
|
moveBlocksDown() {
|
|
771
|
-
return
|
|
831
|
+
return po(this.editor);
|
|
772
832
|
}
|
|
773
833
|
}
|
|
774
|
-
class
|
|
834
|
+
class Co extends Se {
|
|
775
835
|
constructor(e) {
|
|
776
836
|
super(), this.editor = e, e.on("create", () => {
|
|
777
837
|
e._tiptapEditor.on(
|
|
778
838
|
"update",
|
|
779
|
-
({ transaction: t, appendedTransactions:
|
|
780
|
-
this.emit("onChange", { editor: e, transaction: t, appendedTransactions:
|
|
839
|
+
({ transaction: t, appendedTransactions: o }) => {
|
|
840
|
+
this.emit("onChange", { editor: e, transaction: t, appendedTransactions: o });
|
|
781
841
|
}
|
|
782
842
|
), e._tiptapEditor.on("selectionUpdate", ({ transaction: t }) => {
|
|
783
843
|
this.emit("onSelectionChange", { editor: e, transaction: t });
|
|
@@ -792,32 +852,32 @@ class fo extends Se {
|
|
|
792
852
|
* Register a callback that will be called when the editor changes.
|
|
793
853
|
*/
|
|
794
854
|
onChange(e, t = !0) {
|
|
795
|
-
const
|
|
855
|
+
const o = ({
|
|
796
856
|
transaction: s,
|
|
797
857
|
appendedTransactions: r
|
|
798
858
|
}) => {
|
|
799
|
-
!t &&
|
|
859
|
+
!t && ie(s) || e(this.editor, {
|
|
800
860
|
getChanges() {
|
|
801
|
-
return
|
|
861
|
+
return st(
|
|
802
862
|
s,
|
|
803
863
|
r
|
|
804
864
|
);
|
|
805
865
|
}
|
|
806
866
|
});
|
|
807
867
|
};
|
|
808
|
-
return this.on("onChange",
|
|
809
|
-
this.off("onChange",
|
|
868
|
+
return this.on("onChange", o), () => {
|
|
869
|
+
this.off("onChange", o);
|
|
810
870
|
};
|
|
811
871
|
}
|
|
812
872
|
/**
|
|
813
873
|
* Register a callback that will be called when the selection changes.
|
|
814
874
|
*/
|
|
815
875
|
onSelectionChange(e, t = !1) {
|
|
816
|
-
const
|
|
817
|
-
!t &&
|
|
876
|
+
const o = (s) => {
|
|
877
|
+
!t && ie(s.transaction) || e(this.editor);
|
|
818
878
|
};
|
|
819
|
-
return this.on("onSelectionChange",
|
|
820
|
-
this.off("onSelectionChange",
|
|
879
|
+
return this.on("onSelectionChange", o), () => {
|
|
880
|
+
this.off("onSelectionChange", o);
|
|
821
881
|
};
|
|
822
882
|
}
|
|
823
883
|
/**
|
|
@@ -837,118 +897,118 @@ class fo extends Se {
|
|
|
837
897
|
};
|
|
838
898
|
}
|
|
839
899
|
}
|
|
840
|
-
function
|
|
841
|
-
return !!
|
|
900
|
+
function ie(n) {
|
|
901
|
+
return !!n.getMeta("y-sync$");
|
|
842
902
|
}
|
|
843
|
-
function
|
|
844
|
-
return Array.prototype.indexOf.call(
|
|
903
|
+
function Eo(n) {
|
|
904
|
+
return Array.prototype.indexOf.call(n.parentElement.childNodes, n);
|
|
845
905
|
}
|
|
846
|
-
function
|
|
847
|
-
return
|
|
906
|
+
function xo(n) {
|
|
907
|
+
return n.nodeType === 3 && !/\S/.test(n.nodeValue || "");
|
|
848
908
|
}
|
|
849
|
-
function
|
|
850
|
-
|
|
851
|
-
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(
|
|
852
912
|
t + 1
|
|
853
913
|
);
|
|
854
914
|
e.remove(), s.forEach((r) => {
|
|
855
915
|
r.remove();
|
|
856
|
-
}),
|
|
857
|
-
if (
|
|
916
|
+
}), o.insertAdjacentElement("afterend", e), s.reverse().forEach((r) => {
|
|
917
|
+
if (xo(r))
|
|
858
918
|
return;
|
|
859
|
-
const
|
|
860
|
-
|
|
861
|
-
}),
|
|
919
|
+
const a = document.createElement("li");
|
|
920
|
+
a.append(r), e.insertAdjacentElement("afterend", a);
|
|
921
|
+
}), o.childNodes.length === 0 && o.remove();
|
|
862
922
|
});
|
|
863
923
|
}
|
|
864
|
-
function
|
|
865
|
-
|
|
866
|
-
var r,
|
|
867
|
-
const t = e.previousElementSibling,
|
|
868
|
-
t.insertAdjacentElement("afterend",
|
|
924
|
+
function wo(n) {
|
|
925
|
+
n.querySelectorAll("li + ul, li + ol").forEach((e) => {
|
|
926
|
+
var r, a;
|
|
927
|
+
const t = e.previousElementSibling, o = document.createElement("div");
|
|
928
|
+
t.insertAdjacentElement("afterend", o), o.append(t);
|
|
869
929
|
const s = document.createElement("div");
|
|
870
|
-
for (s.setAttribute("data-node-type", "blockGroup"),
|
|
871
|
-
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);
|
|
872
932
|
});
|
|
873
933
|
}
|
|
874
934
|
let ce = null;
|
|
875
|
-
function
|
|
935
|
+
function To() {
|
|
876
936
|
return ce || (ce = document.implementation.createHTMLDocument("title"));
|
|
877
937
|
}
|
|
878
|
-
function
|
|
879
|
-
if (typeof
|
|
880
|
-
const e =
|
|
881
|
-
e.innerHTML =
|
|
938
|
+
function Po(n) {
|
|
939
|
+
if (typeof n == "string") {
|
|
940
|
+
const e = To().createElement("div");
|
|
941
|
+
e.innerHTML = n, n = e;
|
|
882
942
|
}
|
|
883
|
-
return
|
|
943
|
+
return Mo(n), wo(n), n;
|
|
884
944
|
}
|
|
885
|
-
function Pe(
|
|
886
|
-
const t =
|
|
945
|
+
function Pe(n, e) {
|
|
946
|
+
const t = Po(n), s = He.fromSchema(e).parse(t, {
|
|
887
947
|
topNode: e.nodes.blockGroup.create()
|
|
888
948
|
}), r = [];
|
|
889
|
-
for (let
|
|
890
|
-
r.push(
|
|
949
|
+
for (let a = 0; a < s.childCount; a++)
|
|
950
|
+
r.push(S(s.child(a), e));
|
|
891
951
|
return r;
|
|
892
952
|
}
|
|
893
|
-
function
|
|
894
|
-
const t = e.value ? e.value : "",
|
|
895
|
-
e.lang && (
|
|
953
|
+
function vo(n, e) {
|
|
954
|
+
const t = e.value ? e.value : "", o = {};
|
|
955
|
+
e.lang && (o["data-language"] = e.lang);
|
|
896
956
|
let s = {
|
|
897
957
|
type: "element",
|
|
898
958
|
tagName: "code",
|
|
899
|
-
properties:
|
|
959
|
+
properties: o,
|
|
900
960
|
children: [{ type: "text", value: t }]
|
|
901
961
|
};
|
|
902
|
-
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 = {
|
|
903
963
|
type: "element",
|
|
904
964
|
tagName: "pre",
|
|
905
965
|
properties: {},
|
|
906
966
|
children: [s]
|
|
907
|
-
},
|
|
967
|
+
}, n.patch(e, s), s;
|
|
908
968
|
}
|
|
909
|
-
function
|
|
969
|
+
function Io(n, e) {
|
|
910
970
|
var r;
|
|
911
|
-
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;
|
|
912
972
|
let s = {
|
|
913
973
|
type: "element",
|
|
914
974
|
tagName: "video",
|
|
915
975
|
properties: {
|
|
916
976
|
src: t,
|
|
917
|
-
"data-name":
|
|
977
|
+
"data-name": o,
|
|
918
978
|
"data-url": t,
|
|
919
979
|
controls: !0
|
|
920
980
|
},
|
|
921
981
|
children: []
|
|
922
982
|
};
|
|
923
|
-
return (r =
|
|
983
|
+
return (r = n.patch) == null || r.call(n, e, s), s = n.applyData ? n.applyData(e, s) : s, s;
|
|
924
984
|
}
|
|
925
|
-
function ve(
|
|
926
|
-
return
|
|
985
|
+
function ve(n) {
|
|
986
|
+
return Kt().use(jt).use(Rt).use(Wt, {
|
|
927
987
|
handlers: {
|
|
928
988
|
...re,
|
|
929
|
-
image: (t,
|
|
930
|
-
const s = String((
|
|
931
|
-
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);
|
|
932
992
|
},
|
|
933
|
-
code:
|
|
934
|
-
blockquote: (t,
|
|
993
|
+
code: vo,
|
|
994
|
+
blockquote: (t, o) => {
|
|
935
995
|
const s = {
|
|
936
996
|
type: "element",
|
|
937
997
|
tagName: "blockquote",
|
|
938
998
|
properties: {},
|
|
939
999
|
// The only difference from the original is that we don't wrap the children with line endings
|
|
940
|
-
children: t.wrap(t.all(
|
|
1000
|
+
children: t.wrap(t.all(o), !1)
|
|
941
1001
|
};
|
|
942
|
-
return t.patch(
|
|
1002
|
+
return t.patch(o, s), t.applyData(o, s);
|
|
943
1003
|
}
|
|
944
1004
|
}
|
|
945
|
-
}).use(
|
|
1005
|
+
}).use(qt).processSync(n).value;
|
|
946
1006
|
}
|
|
947
|
-
function
|
|
948
|
-
const t = ve(
|
|
1007
|
+
function Ao(n, e) {
|
|
1008
|
+
const t = ve(n);
|
|
949
1009
|
return Pe(t, e);
|
|
950
1010
|
}
|
|
951
|
-
class
|
|
1011
|
+
class _o {
|
|
952
1012
|
constructor(e) {
|
|
953
1013
|
this.editor = e;
|
|
954
1014
|
}
|
|
@@ -960,7 +1020,7 @@ class xo {
|
|
|
960
1020
|
* @returns The blocks, serialized as an HTML string.
|
|
961
1021
|
*/
|
|
962
1022
|
blocksToHTMLLossy(e = this.editor.document) {
|
|
963
|
-
return
|
|
1023
|
+
return ge(
|
|
964
1024
|
this.editor.pmSchema,
|
|
965
1025
|
this.editor
|
|
966
1026
|
).exportBlocks(e, {});
|
|
@@ -975,7 +1035,7 @@ class xo {
|
|
|
975
1035
|
* @returns The blocks, serialized as an HTML string.
|
|
976
1036
|
*/
|
|
977
1037
|
blocksToFullHTML(e = this.editor.document) {
|
|
978
|
-
return
|
|
1038
|
+
return io(
|
|
979
1039
|
this.editor.pmSchema,
|
|
980
1040
|
this.editor
|
|
981
1041
|
).serializeBlocks(e, {});
|
|
@@ -997,7 +1057,7 @@ class xo {
|
|
|
997
1057
|
* @returns The blocks, serialized as a Markdown string.
|
|
998
1058
|
*/
|
|
999
1059
|
blocksToMarkdownLossy(e = this.editor.document) {
|
|
1000
|
-
return
|
|
1060
|
+
return rt(e, this.editor.pmSchema, this.editor, {});
|
|
1001
1061
|
}
|
|
1002
1062
|
/**
|
|
1003
1063
|
* Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on
|
|
@@ -1007,7 +1067,7 @@ class xo {
|
|
|
1007
1067
|
* @returns The blocks parsed from the Markdown string.
|
|
1008
1068
|
*/
|
|
1009
1069
|
tryParseMarkdownToBlocks(e) {
|
|
1010
|
-
return
|
|
1070
|
+
return Ao(e, this.editor.pmSchema);
|
|
1011
1071
|
}
|
|
1012
1072
|
/**
|
|
1013
1073
|
* Paste HTML into the editor. Defaults to converting HTML to BlockNote HTML.
|
|
@@ -1016,12 +1076,12 @@ class xo {
|
|
|
1016
1076
|
*/
|
|
1017
1077
|
pasteHTML(e, t = !1) {
|
|
1018
1078
|
var s;
|
|
1019
|
-
let
|
|
1079
|
+
let o = e;
|
|
1020
1080
|
if (!t) {
|
|
1021
1081
|
const r = this.tryParseHTMLToBlocks(e);
|
|
1022
|
-
|
|
1082
|
+
o = this.blocksToFullHTML(r);
|
|
1023
1083
|
}
|
|
1024
|
-
|
|
1084
|
+
o && ((s = this.editor.prosemirrorView) == null || s.pasteHTML(o));
|
|
1025
1085
|
}
|
|
1026
1086
|
/**
|
|
1027
1087
|
* Paste text into the editor. Defaults to interpreting text as markdown.
|
|
@@ -1040,7 +1100,7 @@ class xo {
|
|
|
1040
1100
|
return this.pasteHTML(t);
|
|
1041
1101
|
}
|
|
1042
1102
|
}
|
|
1043
|
-
const
|
|
1103
|
+
const ne = [
|
|
1044
1104
|
"vscode-editor-data",
|
|
1045
1105
|
"blocknote/html",
|
|
1046
1106
|
"text/markdown",
|
|
@@ -1048,28 +1108,28 @@ const oe = [
|
|
|
1048
1108
|
"text/plain",
|
|
1049
1109
|
"Files"
|
|
1050
1110
|
];
|
|
1051
|
-
function
|
|
1052
|
-
if (!
|
|
1111
|
+
function Do(n, e) {
|
|
1112
|
+
if (!n.startsWith(".") || !e.startsWith("."))
|
|
1053
1113
|
throw new Error("The strings provided are not valid file extensions.");
|
|
1054
|
-
return
|
|
1114
|
+
return n === e;
|
|
1055
1115
|
}
|
|
1056
|
-
function
|
|
1057
|
-
const t =
|
|
1116
|
+
function Lo(n, e) {
|
|
1117
|
+
const t = n.split("/"), o = e.split("/");
|
|
1058
1118
|
if (t.length !== 2)
|
|
1059
|
-
throw new Error(`The string ${
|
|
1060
|
-
if (
|
|
1119
|
+
throw new Error(`The string ${n} is not a valid MIME type.`);
|
|
1120
|
+
if (o.length !== 2)
|
|
1061
1121
|
throw new Error(`The string ${e} is not a valid MIME type.`);
|
|
1062
|
-
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];
|
|
1063
1123
|
}
|
|
1064
|
-
function le(
|
|
1124
|
+
function le(n, e, t, o = "after") {
|
|
1065
1125
|
let s;
|
|
1066
|
-
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(
|
|
1067
1127
|
[t],
|
|
1068
1128
|
e,
|
|
1069
|
-
|
|
1129
|
+
o
|
|
1070
1130
|
)[0].id, s;
|
|
1071
1131
|
}
|
|
1072
|
-
async function Ie(
|
|
1132
|
+
async function Ie(n, e) {
|
|
1073
1133
|
var r;
|
|
1074
1134
|
if (!e.uploadFile) {
|
|
1075
1135
|
console.warn(
|
|
@@ -1077,26 +1137,26 @@ async function Ie(o, e) {
|
|
|
1077
1137
|
);
|
|
1078
1138
|
return;
|
|
1079
1139
|
}
|
|
1080
|
-
const t = "dataTransfer" in
|
|
1140
|
+
const t = "dataTransfer" in n ? n.dataTransfer : n.clipboardData;
|
|
1081
1141
|
if (t === null)
|
|
1082
1142
|
return;
|
|
1083
|
-
let
|
|
1084
|
-
for (const
|
|
1085
|
-
if (t.types.includes(
|
|
1086
|
-
|
|
1143
|
+
let o = null;
|
|
1144
|
+
for (const a of ne)
|
|
1145
|
+
if (t.types.includes(a)) {
|
|
1146
|
+
o = a;
|
|
1087
1147
|
break;
|
|
1088
1148
|
}
|
|
1089
|
-
if (
|
|
1149
|
+
if (o !== "Files")
|
|
1090
1150
|
return;
|
|
1091
1151
|
const s = t.items;
|
|
1092
1152
|
if (s) {
|
|
1093
|
-
|
|
1094
|
-
for (let
|
|
1153
|
+
n.preventDefault();
|
|
1154
|
+
for (let a = 0; a < s.length; a++) {
|
|
1095
1155
|
let c = "file";
|
|
1096
1156
|
for (const l of Object.values(e.schema.blockSpecs))
|
|
1097
1157
|
for (const d of ((r = l.implementation.meta) == null ? void 0 : r.fileBlockAccept) || []) {
|
|
1098
|
-
const u = d.startsWith("."), p = s[
|
|
1099
|
-
if (p && (!u && p.type &&
|
|
1158
|
+
const u = d.startsWith("."), p = s[a].getAsFile();
|
|
1159
|
+
if (p && (!u && p.type && Lo(s[a].type, d) || u && Do(
|
|
1100
1160
|
"." + p.name.split(".").pop(),
|
|
1101
1161
|
d
|
|
1102
1162
|
))) {
|
|
@@ -1104,40 +1164,40 @@ async function Ie(o, e) {
|
|
|
1104
1164
|
break;
|
|
1105
1165
|
}
|
|
1106
1166
|
}
|
|
1107
|
-
const
|
|
1108
|
-
if (
|
|
1167
|
+
const i = s[a].getAsFile();
|
|
1168
|
+
if (i) {
|
|
1109
1169
|
const l = {
|
|
1110
1170
|
type: c,
|
|
1111
1171
|
props: {
|
|
1112
|
-
name:
|
|
1172
|
+
name: i.name
|
|
1113
1173
|
}
|
|
1114
1174
|
};
|
|
1115
1175
|
let d;
|
|
1116
|
-
if (
|
|
1176
|
+
if (n.type === "paste") {
|
|
1117
1177
|
const m = e.getTextCursorPosition().block;
|
|
1118
1178
|
d = le(e, m, l);
|
|
1119
|
-
} else if (
|
|
1179
|
+
} else if (n.type === "drop") {
|
|
1120
1180
|
const m = {
|
|
1121
|
-
left:
|
|
1122
|
-
top:
|
|
1181
|
+
left: n.clientX,
|
|
1182
|
+
top: n.clientY
|
|
1123
1183
|
}, f = e.prosemirrorView.posAtCoords(m);
|
|
1124
1184
|
if (!f)
|
|
1125
1185
|
return;
|
|
1126
1186
|
d = e.transact((k) => {
|
|
1127
|
-
var
|
|
1128
|
-
const
|
|
1129
|
-
`[data-id="${
|
|
1130
|
-
),
|
|
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();
|
|
1131
1191
|
return le(
|
|
1132
1192
|
e,
|
|
1133
|
-
e.getBlock(
|
|
1193
|
+
e.getBlock(b.node.attrs.id),
|
|
1134
1194
|
l,
|
|
1135
|
-
|
|
1195
|
+
w && (w.top + w.bottom) / 2 > m.top ? "before" : "after"
|
|
1136
1196
|
);
|
|
1137
1197
|
});
|
|
1138
1198
|
} else
|
|
1139
1199
|
return;
|
|
1140
|
-
const u = await e.uploadFile(
|
|
1200
|
+
const u = await e.uploadFile(i, d), p = typeof u == "string" ? {
|
|
1141
1201
|
props: {
|
|
1142
1202
|
url: u
|
|
1143
1203
|
}
|
|
@@ -1147,104 +1207,104 @@ async function Ie(o, e) {
|
|
|
1147
1207
|
}
|
|
1148
1208
|
}
|
|
1149
1209
|
}
|
|
1150
|
-
const
|
|
1210
|
+
const No = (n) => x.create({
|
|
1151
1211
|
name: "dropFile",
|
|
1152
1212
|
addProseMirrorPlugins() {
|
|
1153
1213
|
return [
|
|
1154
|
-
new
|
|
1214
|
+
new te({
|
|
1155
1215
|
props: {
|
|
1156
1216
|
handleDOMEvents: {
|
|
1157
1217
|
drop(e, t) {
|
|
1158
|
-
if (!
|
|
1218
|
+
if (!n.isEditable)
|
|
1159
1219
|
return;
|
|
1160
|
-
let
|
|
1161
|
-
for (const s of
|
|
1220
|
+
let o = null;
|
|
1221
|
+
for (const s of ne)
|
|
1162
1222
|
if (t.dataTransfer.types.includes(s)) {
|
|
1163
|
-
|
|
1223
|
+
o = s;
|
|
1164
1224
|
break;
|
|
1165
1225
|
}
|
|
1166
|
-
return
|
|
1226
|
+
return o === null ? !0 : o === "Files" ? (Ie(t, n), !0) : !1;
|
|
1167
1227
|
}
|
|
1168
1228
|
}
|
|
1169
1229
|
}
|
|
1170
1230
|
})
|
|
1171
1231
|
];
|
|
1172
1232
|
}
|
|
1173
|
-
}),
|
|
1174
|
-
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) {
|
|
1175
1235
|
const { schema: t } = e.state;
|
|
1176
|
-
if (!
|
|
1236
|
+
if (!n.clipboardData)
|
|
1177
1237
|
return !1;
|
|
1178
|
-
const
|
|
1179
|
-
if (!
|
|
1238
|
+
const o = n.clipboardData.getData("text/plain");
|
|
1239
|
+
if (!o)
|
|
1180
1240
|
return !1;
|
|
1181
1241
|
if (!t.nodes.codeBlock)
|
|
1182
|
-
return e.pasteText(
|
|
1183
|
-
const s =
|
|
1184
|
-
return
|
|
1185
|
-
`<pre><code class="language-${
|
|
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
|
+
return a ? (e.pasteHTML(
|
|
1245
|
+
`<pre><code class="language-${a}">${o.replace(
|
|
1186
1246
|
/\r\n?/g,
|
|
1187
1247
|
`
|
|
1188
1248
|
`
|
|
1189
1249
|
)}</code></pre>`
|
|
1190
1250
|
), !0) : !1;
|
|
1191
1251
|
}
|
|
1192
|
-
function
|
|
1193
|
-
event:
|
|
1252
|
+
function Qo({
|
|
1253
|
+
event: n,
|
|
1194
1254
|
editor: e,
|
|
1195
1255
|
prioritizeMarkdownOverHTML: t,
|
|
1196
|
-
plainTextAsMarkdown:
|
|
1256
|
+
plainTextAsMarkdown: o
|
|
1197
1257
|
}) {
|
|
1198
1258
|
var c;
|
|
1199
1259
|
if (e.transact(
|
|
1200
|
-
(
|
|
1260
|
+
(i) => i.selection.$from.parent.type.spec.code && i.selection.$to.parent.type.spec.code
|
|
1201
1261
|
)) {
|
|
1202
|
-
const
|
|
1203
|
-
if (
|
|
1204
|
-
return e.pasteText(
|
|
1262
|
+
const i = (c = n.clipboardData) == null ? void 0 : c.getData("text/plain");
|
|
1263
|
+
if (i)
|
|
1264
|
+
return e.pasteText(i), !0;
|
|
1205
1265
|
}
|
|
1206
1266
|
let r;
|
|
1207
|
-
for (const
|
|
1208
|
-
if (
|
|
1209
|
-
r =
|
|
1267
|
+
for (const i of ne)
|
|
1268
|
+
if (n.clipboardData.types.includes(i)) {
|
|
1269
|
+
r = i;
|
|
1210
1270
|
break;
|
|
1211
1271
|
}
|
|
1212
1272
|
if (!r)
|
|
1213
1273
|
return !0;
|
|
1214
1274
|
if (r === "vscode-editor-data")
|
|
1215
|
-
return
|
|
1275
|
+
return Yo(n, e.prosemirrorView), !0;
|
|
1216
1276
|
if (r === "Files")
|
|
1217
|
-
return Ie(
|
|
1218
|
-
const
|
|
1277
|
+
return Ie(n, e), !0;
|
|
1278
|
+
const a = n.clipboardData.getData(r);
|
|
1219
1279
|
if (r === "blocknote/html")
|
|
1220
|
-
return e.pasteHTML(
|
|
1280
|
+
return e.pasteHTML(a, !0), !0;
|
|
1221
1281
|
if (r === "text/markdown")
|
|
1222
|
-
return e.pasteMarkdown(
|
|
1282
|
+
return e.pasteMarkdown(a), !0;
|
|
1223
1283
|
if (t) {
|
|
1224
|
-
const
|
|
1225
|
-
if (
|
|
1226
|
-
return e.pasteMarkdown(
|
|
1284
|
+
const i = n.clipboardData.getData("text/plain");
|
|
1285
|
+
if (Jo(i))
|
|
1286
|
+
return e.pasteMarkdown(i), !0;
|
|
1227
1287
|
}
|
|
1228
|
-
return r === "text/html" ? (e.pasteHTML(
|
|
1288
|
+
return r === "text/html" ? (e.pasteHTML(a), !0) : o ? (e.pasteMarkdown(a), !0) : (e.pasteText(a), !0);
|
|
1229
1289
|
}
|
|
1230
|
-
const
|
|
1290
|
+
const Xo = (n, e) => x.create({
|
|
1231
1291
|
name: "pasteFromClipboard",
|
|
1232
1292
|
addProseMirrorPlugins() {
|
|
1233
1293
|
return [
|
|
1234
|
-
new
|
|
1294
|
+
new te({
|
|
1235
1295
|
props: {
|
|
1236
1296
|
handleDOMEvents: {
|
|
1237
|
-
paste(t,
|
|
1238
|
-
if (
|
|
1297
|
+
paste(t, o) {
|
|
1298
|
+
if (o.preventDefault(), !!n.isEditable)
|
|
1239
1299
|
return e({
|
|
1240
|
-
event:
|
|
1241
|
-
editor:
|
|
1300
|
+
event: o,
|
|
1301
|
+
editor: n,
|
|
1242
1302
|
defaultPasteHandler: ({
|
|
1243
1303
|
prioritizeMarkdownOverHTML: s = !0,
|
|
1244
1304
|
plainTextAsMarkdown: r = !0
|
|
1245
|
-
} = {}) =>
|
|
1246
|
-
event:
|
|
1247
|
-
editor:
|
|
1305
|
+
} = {}) => Qo({
|
|
1306
|
+
event: o,
|
|
1307
|
+
editor: n,
|
|
1248
1308
|
prioritizeMarkdownOverHTML: s,
|
|
1249
1309
|
plainTextAsMarkdown: r
|
|
1250
1310
|
})
|
|
@@ -1256,96 +1316,96 @@ const Go = (o, e) => E.create({
|
|
|
1256
1316
|
];
|
|
1257
1317
|
}
|
|
1258
1318
|
});
|
|
1259
|
-
function
|
|
1319
|
+
function Zo(n, e, t) {
|
|
1260
1320
|
var c;
|
|
1261
|
-
let
|
|
1262
|
-
const s =
|
|
1321
|
+
let o = !1;
|
|
1322
|
+
const s = n.state.selection instanceof oe;
|
|
1263
1323
|
if (!s) {
|
|
1264
|
-
const
|
|
1265
|
-
|
|
1266
|
-
|
|
1324
|
+
const i = n.state.doc.slice(
|
|
1325
|
+
n.state.selection.from,
|
|
1326
|
+
n.state.selection.to,
|
|
1267
1327
|
!1
|
|
1268
1328
|
).content, l = [];
|
|
1269
|
-
for (let d = 0; d <
|
|
1270
|
-
l.push(
|
|
1271
|
-
|
|
1329
|
+
for (let d = 0; d < i.childCount; d++)
|
|
1330
|
+
l.push(i.child(d));
|
|
1331
|
+
o = l.find(
|
|
1272
1332
|
(d) => d.type.isInGroup("bnBlock") || d.type.name === "blockGroup" || d.type.spec.group === "blockContent"
|
|
1273
|
-
) === void 0,
|
|
1333
|
+
) === void 0, o && (e = i);
|
|
1274
1334
|
}
|
|
1275
1335
|
let r;
|
|
1276
|
-
const
|
|
1277
|
-
|
|
1336
|
+
const a = ge(
|
|
1337
|
+
n.state.schema,
|
|
1278
1338
|
t
|
|
1279
1339
|
);
|
|
1280
1340
|
if (s) {
|
|
1281
1341
|
((c = e.firstChild) == null ? void 0 : c.type.name) === "table" && (e = e.firstChild.content);
|
|
1282
|
-
const
|
|
1342
|
+
const i = Re(
|
|
1283
1343
|
e,
|
|
1284
1344
|
t.schema.inlineContentSchema,
|
|
1285
1345
|
t.schema.styleSchema
|
|
1286
1346
|
);
|
|
1287
|
-
r = `<table>${
|
|
1288
|
-
|
|
1347
|
+
r = `<table>${a.exportInlineContent(
|
|
1348
|
+
i,
|
|
1289
1349
|
{}
|
|
1290
1350
|
)}</table>`;
|
|
1291
|
-
} else if (
|
|
1292
|
-
const
|
|
1351
|
+
} else if (o) {
|
|
1352
|
+
const i = je(
|
|
1293
1353
|
e,
|
|
1294
1354
|
t.schema.inlineContentSchema,
|
|
1295
1355
|
t.schema.styleSchema
|
|
1296
1356
|
);
|
|
1297
|
-
r =
|
|
1357
|
+
r = a.exportInlineContent(i, {});
|
|
1298
1358
|
} else {
|
|
1299
|
-
const
|
|
1300
|
-
r =
|
|
1359
|
+
const i = it(e);
|
|
1360
|
+
r = a.exportBlocks(i, {});
|
|
1301
1361
|
}
|
|
1302
1362
|
return r;
|
|
1303
1363
|
}
|
|
1304
|
-
function Ae(
|
|
1305
|
-
"node" in
|
|
1306
|
-
(
|
|
1307
|
-
new L(
|
|
1364
|
+
function Ae(n, e) {
|
|
1365
|
+
"node" in n.state.selection && n.state.selection.node.type.spec.group === "blockContent" && e.transact(
|
|
1366
|
+
(a) => a.setSelection(
|
|
1367
|
+
new L(a.doc.resolve(n.state.selection.from - 1))
|
|
1308
1368
|
)
|
|
1309
1369
|
);
|
|
1310
|
-
const t =
|
|
1311
|
-
|
|
1312
|
-
).dom.innerHTML,
|
|
1313
|
-
o,
|
|
1370
|
+
const t = n.serializeForClipboard(
|
|
1371
|
+
n.state.selection.content()
|
|
1372
|
+
).dom.innerHTML, o = n.state.selection.content().content, s = Zo(
|
|
1314
1373
|
n,
|
|
1374
|
+
o,
|
|
1315
1375
|
e
|
|
1316
|
-
), r =
|
|
1376
|
+
), r = at(s);
|
|
1317
1377
|
return { clipboardHTML: t, externalHTML: s, markdown: r };
|
|
1318
1378
|
}
|
|
1319
1379
|
const de = () => {
|
|
1320
|
-
const
|
|
1321
|
-
if (!
|
|
1380
|
+
const n = window.getSelection();
|
|
1381
|
+
if (!n || n.isCollapsed)
|
|
1322
1382
|
return !0;
|
|
1323
|
-
let e =
|
|
1383
|
+
let e = n.focusNode;
|
|
1324
1384
|
for (; e; ) {
|
|
1325
1385
|
if (e instanceof HTMLElement && e.getAttribute("contenteditable") === "false")
|
|
1326
1386
|
return !0;
|
|
1327
1387
|
e = e.parentElement;
|
|
1328
1388
|
}
|
|
1329
1389
|
return !1;
|
|
1330
|
-
}, ue = (
|
|
1390
|
+
}, ue = (n, e, t) => {
|
|
1331
1391
|
t.preventDefault(), t.clipboardData.clearData();
|
|
1332
|
-
const { clipboardHTML:
|
|
1392
|
+
const { clipboardHTML: o, externalHTML: s, markdown: r } = Ae(
|
|
1333
1393
|
e,
|
|
1334
|
-
|
|
1394
|
+
n
|
|
1335
1395
|
);
|
|
1336
|
-
t.clipboardData.setData("blocknote/html",
|
|
1337
|
-
},
|
|
1396
|
+
t.clipboardData.setData("blocknote/html", o), t.clipboardData.setData("text/html", s), t.clipboardData.setData("text/plain", r);
|
|
1397
|
+
}, en = (n) => x.create({
|
|
1338
1398
|
name: "copyToClipboard",
|
|
1339
1399
|
addProseMirrorPlugins() {
|
|
1340
1400
|
return [
|
|
1341
|
-
new
|
|
1401
|
+
new te({
|
|
1342
1402
|
props: {
|
|
1343
1403
|
handleDOMEvents: {
|
|
1344
1404
|
copy(e, t) {
|
|
1345
|
-
return de() || ue(
|
|
1405
|
+
return de() || ue(n, e, t), !0;
|
|
1346
1406
|
},
|
|
1347
1407
|
cut(e, t) {
|
|
1348
|
-
return de() || (ue(
|
|
1408
|
+
return de() || (ue(n, e, t), e.editable && e.dispatch(e.state.tr.deleteSelection())), !0;
|
|
1349
1409
|
},
|
|
1350
1410
|
// This is for the use-case in which only a block without content
|
|
1351
1411
|
// is selected, e.g. an image block, and dragged (not using the
|
|
@@ -1353,34 +1413,34 @@ const de = () => {
|
|
|
1353
1413
|
dragstart(e, t) {
|
|
1354
1414
|
if (!("node" in e.state.selection) || e.state.selection.node.type.spec.group !== "blockContent")
|
|
1355
1415
|
return;
|
|
1356
|
-
|
|
1357
|
-
(
|
|
1416
|
+
n.transact(
|
|
1417
|
+
(a) => a.setSelection(
|
|
1358
1418
|
new L(
|
|
1359
|
-
|
|
1419
|
+
a.doc.resolve(e.state.selection.from - 1)
|
|
1360
1420
|
)
|
|
1361
1421
|
)
|
|
1362
1422
|
), t.preventDefault(), t.dataTransfer.clearData();
|
|
1363
|
-
const { clipboardHTML:
|
|
1364
|
-
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;
|
|
1365
1425
|
}
|
|
1366
1426
|
}
|
|
1367
1427
|
}
|
|
1368
1428
|
})
|
|
1369
1429
|
];
|
|
1370
1430
|
}
|
|
1371
|
-
}),
|
|
1431
|
+
}), tn = x.create({
|
|
1372
1432
|
name: "blockBackgroundColor",
|
|
1373
1433
|
addGlobalAttributes() {
|
|
1374
1434
|
return [
|
|
1375
1435
|
{
|
|
1376
1436
|
types: ["tableCell", "tableHeader"],
|
|
1377
1437
|
attributes: {
|
|
1378
|
-
backgroundColor:
|
|
1438
|
+
backgroundColor: Ze()
|
|
1379
1439
|
}
|
|
1380
1440
|
}
|
|
1381
1441
|
];
|
|
1382
1442
|
}
|
|
1383
|
-
}),
|
|
1443
|
+
}), on = D.create({
|
|
1384
1444
|
name: "hardBreak",
|
|
1385
1445
|
inline: !0,
|
|
1386
1446
|
group: "inline",
|
|
@@ -1390,89 +1450,89 @@ const de = () => {
|
|
|
1390
1450
|
parseHTML() {
|
|
1391
1451
|
return [{ tag: "br" }];
|
|
1392
1452
|
},
|
|
1393
|
-
renderHTML({ HTMLAttributes:
|
|
1394
|
-
return ["br",
|
|
1453
|
+
renderHTML({ HTMLAttributes: n }) {
|
|
1454
|
+
return ["br", wt(this.options.HTMLAttributes, n)];
|
|
1395
1455
|
},
|
|
1396
1456
|
renderText() {
|
|
1397
1457
|
return `
|
|
1398
1458
|
`;
|
|
1399
1459
|
}
|
|
1400
|
-
}),
|
|
1401
|
-
const t =
|
|
1402
|
-
if (
|
|
1460
|
+
}), Y = (n, e) => {
|
|
1461
|
+
const t = n.resolve(e), o = t.index();
|
|
1462
|
+
if (o === 0)
|
|
1403
1463
|
return;
|
|
1404
|
-
const s = t.posAtIndex(
|
|
1405
|
-
return
|
|
1406
|
-
|
|
1464
|
+
const s = t.posAtIndex(o - 1);
|
|
1465
|
+
return X(
|
|
1466
|
+
n.resolve(s)
|
|
1407
1467
|
);
|
|
1408
|
-
}, _e = (
|
|
1468
|
+
}, _e = (n, e) => {
|
|
1409
1469
|
for (; e.childContainer; ) {
|
|
1410
|
-
const t = e.childContainer.node,
|
|
1411
|
-
e =
|
|
1470
|
+
const t = e.childContainer.node, o = n.resolve(e.childContainer.beforePos + 1).posAtIndex(t.childCount - 1);
|
|
1471
|
+
e = X(n.resolve(o));
|
|
1412
1472
|
}
|
|
1413
1473
|
return e;
|
|
1414
|
-
},
|
|
1415
|
-
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)
|
|
1416
1476
|
throw new Error(
|
|
1417
|
-
`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`
|
|
1418
1478
|
);
|
|
1419
|
-
if (
|
|
1420
|
-
const s =
|
|
1421
|
-
|
|
1422
|
-
), r =
|
|
1423
|
-
|
|
1424
|
-
),
|
|
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
|
+
), a = s.blockRange(r);
|
|
1425
1485
|
if (e) {
|
|
1426
|
-
const c =
|
|
1427
|
-
|
|
1486
|
+
const c = n.doc.resolve(o.bnBlock.beforePos);
|
|
1487
|
+
n.tr.lift(a, c.depth);
|
|
1428
1488
|
}
|
|
1429
1489
|
}
|
|
1430
1490
|
if (e) {
|
|
1431
1491
|
if (!t.isBlockContainer)
|
|
1432
1492
|
throw new Error(
|
|
1433
|
-
`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`
|
|
1434
1494
|
);
|
|
1435
1495
|
e(
|
|
1436
|
-
|
|
1496
|
+
n.tr.delete(
|
|
1437
1497
|
t.blockContent.afterPos - 1,
|
|
1438
|
-
|
|
1498
|
+
o.blockContent.beforePos + 1
|
|
1439
1499
|
)
|
|
1440
1500
|
);
|
|
1441
1501
|
}
|
|
1442
1502
|
return !0;
|
|
1443
|
-
}, pe = (
|
|
1503
|
+
}, pe = (n) => ({
|
|
1444
1504
|
state: e,
|
|
1445
1505
|
dispatch: t
|
|
1446
1506
|
}) => {
|
|
1447
|
-
const
|
|
1507
|
+
const o = e.doc.resolve(n), s = X(o), r = Y(
|
|
1448
1508
|
e.doc,
|
|
1449
1509
|
s.bnBlock.beforePos
|
|
1450
1510
|
);
|
|
1451
1511
|
if (!r)
|
|
1452
1512
|
return !1;
|
|
1453
|
-
const
|
|
1513
|
+
const a = _e(
|
|
1454
1514
|
e.doc,
|
|
1455
1515
|
r
|
|
1456
1516
|
);
|
|
1457
|
-
return
|
|
1458
|
-
},
|
|
1517
|
+
return nn(a, s) ? sn(e, t, a, s) : !1;
|
|
1518
|
+
}, rn = x.create({
|
|
1459
1519
|
priority: 50,
|
|
1460
1520
|
// TODO: The shortcuts need a refactor. Do we want to use a command priority
|
|
1461
1521
|
// design as there is now, or clump the logic into a single function?
|
|
1462
1522
|
addKeyboardShortcuts() {
|
|
1463
|
-
const
|
|
1523
|
+
const n = () => this.editor.commands.first(({ chain: o, commands: s }) => [
|
|
1464
1524
|
// Deletes the selection if it's not empty.
|
|
1465
1525
|
() => s.deleteSelection(),
|
|
1466
1526
|
// Undoes an input rule if one was triggered in the last editor state change.
|
|
1467
1527
|
() => s.undoInputRule(),
|
|
1468
1528
|
// Reverts block content type to a paragraph if the selection is at the start of the block.
|
|
1469
1529
|
() => s.command(({ state: r }) => {
|
|
1470
|
-
const
|
|
1471
|
-
if (!
|
|
1530
|
+
const a = B(r);
|
|
1531
|
+
if (!a.isBlockContainer)
|
|
1472
1532
|
return !1;
|
|
1473
|
-
const c = r.selection.from ===
|
|
1474
|
-
return c && !
|
|
1475
|
-
|
|
1533
|
+
const c = r.selection.from === a.blockContent.beforePos + 1, i = a.blockContent.node.type.name === "paragraph";
|
|
1534
|
+
return c && !i ? s.command(
|
|
1535
|
+
tt(a.bnBlock.beforePos, {
|
|
1476
1536
|
type: "paragraph",
|
|
1477
1537
|
props: {}
|
|
1478
1538
|
})
|
|
@@ -1480,76 +1540,80 @@ const de = () => {
|
|
|
1480
1540
|
}),
|
|
1481
1541
|
// Removes a level of nesting if the block is indented if the selection is at the start of the block.
|
|
1482
1542
|
() => s.command(({ state: r }) => {
|
|
1483
|
-
const
|
|
1484
|
-
if (!
|
|
1543
|
+
const a = B(r);
|
|
1544
|
+
if (!a.isBlockContainer)
|
|
1485
1545
|
return !1;
|
|
1486
|
-
const { blockContent: c } =
|
|
1546
|
+
const { blockContent: c } = a;
|
|
1487
1547
|
return r.selection.from === c.beforePos + 1 ? s.liftListItem("blockContainer") : !1;
|
|
1488
1548
|
}),
|
|
1489
1549
|
// Merges block with the previous one if it isn't indented, and the selection is at the start of the
|
|
1490
1550
|
// block. The target block for merging must contain inline content.
|
|
1491
1551
|
() => s.command(({ state: r }) => {
|
|
1492
|
-
const
|
|
1493
|
-
if (!
|
|
1552
|
+
const a = B(r);
|
|
1553
|
+
if (!a.isBlockContainer)
|
|
1494
1554
|
return !1;
|
|
1495
|
-
const { bnBlock: c, blockContent:
|
|
1496
|
-
return l && d ?
|
|
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 ? o().command(pe(u)).scrollIntoView().run() : !1;
|
|
1497
1557
|
}),
|
|
1498
|
-
() => s.command(({ state: r, tr:
|
|
1499
|
-
const
|
|
1500
|
-
if (!
|
|
1558
|
+
() => s.command(({ state: r, tr: a, dispatch: c }) => {
|
|
1559
|
+
const i = B(r);
|
|
1560
|
+
if (!i.isBlockContainer || !(a.selection.from === i.blockContent.beforePos + 1))
|
|
1501
1561
|
return !1;
|
|
1502
|
-
const d =
|
|
1562
|
+
const d = a.doc.resolve(i.bnBlock.beforePos);
|
|
1503
1563
|
if (d.nodeBefore || d.node().type.name !== "column")
|
|
1504
1564
|
return !1;
|
|
1505
|
-
const m =
|
|
1565
|
+
const m = a.doc.resolve(i.bnBlock.beforePos), f = a.doc.resolve(m.before()), k = f.before();
|
|
1506
1566
|
if (c) {
|
|
1507
|
-
const
|
|
1508
|
-
|
|
1509
|
-
|
|
1567
|
+
const b = a.doc.slice(
|
|
1568
|
+
i.bnBlock.beforePos,
|
|
1569
|
+
i.bnBlock.afterPos
|
|
1510
1570
|
).content;
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
), f.index() === 0 ? (
|
|
1515
|
-
M.near(
|
|
1516
|
-
)) : (
|
|
1517
|
-
M.near(
|
|
1518
|
-
),
|
|
1571
|
+
a.delete(
|
|
1572
|
+
i.bnBlock.beforePos,
|
|
1573
|
+
i.bnBlock.afterPos
|
|
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));
|
|
1519
1579
|
}
|
|
1520
1580
|
return !0;
|
|
1521
1581
|
}),
|
|
1522
1582
|
// Deletes the current block if it's an empty block with inline content,
|
|
1523
1583
|
// and moves the selection to the previous block.
|
|
1524
1584
|
() => s.command(({ state: r }) => {
|
|
1525
|
-
|
|
1526
|
-
|
|
1585
|
+
var i;
|
|
1586
|
+
const a = B(r);
|
|
1587
|
+
if (!a.isBlockContainer)
|
|
1527
1588
|
return !1;
|
|
1528
|
-
if (
|
|
1529
|
-
const
|
|
1589
|
+
if (a.blockContent.node.childCount === 0 && a.blockContent.node.type.spec.content === "inline*") {
|
|
1590
|
+
const l = Y(
|
|
1530
1591
|
r.doc,
|
|
1531
|
-
|
|
1592
|
+
a.bnBlock.beforePos
|
|
1532
1593
|
);
|
|
1533
|
-
if (!
|
|
1594
|
+
if (!l || !l.isBlockContainer)
|
|
1534
1595
|
return !1;
|
|
1535
|
-
let
|
|
1536
|
-
if (a.
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
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
|
|
1540
1604
|
);
|
|
1541
|
-
} else if (
|
|
1542
|
-
const
|
|
1543
|
-
|
|
1544
|
-
|
|
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
|
|
1545
1609
|
);
|
|
1546
1610
|
} else {
|
|
1547
|
-
const
|
|
1548
|
-
|
|
1611
|
+
const u = l.blockContent.afterPos - 1;
|
|
1612
|
+
d = d.setTextSelection(u);
|
|
1549
1613
|
}
|
|
1550
|
-
return
|
|
1551
|
-
from:
|
|
1552
|
-
to:
|
|
1614
|
+
return d.deleteRange({
|
|
1615
|
+
from: a.bnBlock.beforePos,
|
|
1616
|
+
to: a.bnBlock.afterPos
|
|
1553
1617
|
}).scrollIntoView().run();
|
|
1554
1618
|
}
|
|
1555
1619
|
return !1;
|
|
@@ -1558,14 +1622,14 @@ const de = () => {
|
|
|
1558
1622
|
// when the selection is empty and at the start of the block. Moves the
|
|
1559
1623
|
// current block into the deleted block's place.
|
|
1560
1624
|
() => s.command(({ state: r }) => {
|
|
1561
|
-
const
|
|
1562
|
-
if (!
|
|
1625
|
+
const a = B(r);
|
|
1626
|
+
if (!a.isBlockContainer)
|
|
1563
1627
|
throw new Error("todo");
|
|
1564
|
-
const c = r.selection.from ===
|
|
1628
|
+
const c = r.selection.from === a.blockContent.beforePos + 1, i = r.selection.empty, l = Y(
|
|
1565
1629
|
r.doc,
|
|
1566
|
-
|
|
1630
|
+
a.bnBlock.beforePos
|
|
1567
1631
|
);
|
|
1568
|
-
if (l && c &&
|
|
1632
|
+
if (l && c && i) {
|
|
1569
1633
|
const d = _e(
|
|
1570
1634
|
r.doc,
|
|
1571
1635
|
l
|
|
@@ -1573,10 +1637,10 @@ const de = () => {
|
|
|
1573
1637
|
if (!d.isBlockContainer)
|
|
1574
1638
|
throw new Error("todo");
|
|
1575
1639
|
if (d.blockContent.node.type.spec.content === "" || d.blockContent.node.type.spec.content === "inline*" && d.blockContent.node.childCount === 0)
|
|
1576
|
-
return
|
|
1640
|
+
return o().cut(
|
|
1577
1641
|
{
|
|
1578
|
-
from:
|
|
1579
|
-
to:
|
|
1642
|
+
from: a.bnBlock.beforePos,
|
|
1643
|
+
to: a.bnBlock.afterPos
|
|
1580
1644
|
},
|
|
1581
1645
|
d.bnBlock.afterPos
|
|
1582
1646
|
).deleteRange({
|
|
@@ -1586,51 +1650,51 @@ const de = () => {
|
|
|
1586
1650
|
}
|
|
1587
1651
|
return !1;
|
|
1588
1652
|
})
|
|
1589
|
-
]), e = () => this.editor.commands.first(({ commands:
|
|
1653
|
+
]), e = () => this.editor.commands.first(({ commands: o }) => [
|
|
1590
1654
|
// Deletes the selection if it's not empty.
|
|
1591
|
-
() =>
|
|
1655
|
+
() => o.deleteSelection(),
|
|
1592
1656
|
// Merges block with the next one (at the same nesting level or lower),
|
|
1593
1657
|
// if one exists, the block has no children, and the selection is at the
|
|
1594
1658
|
// end of the block.
|
|
1595
|
-
() =>
|
|
1659
|
+
() => o.command(({ state: s }) => {
|
|
1596
1660
|
const r = B(s);
|
|
1597
1661
|
if (!r.isBlockContainer)
|
|
1598
1662
|
return !1;
|
|
1599
1663
|
const {
|
|
1600
|
-
bnBlock:
|
|
1664
|
+
bnBlock: a,
|
|
1601
1665
|
blockContent: c,
|
|
1602
|
-
childContainer:
|
|
1603
|
-
} = r, { depth: l } = s.doc.resolve(
|
|
1604
|
-
if (!d && u && p && !(
|
|
1605
|
-
let f = l, k =
|
|
1606
|
-
for (;
|
|
1607
|
-
f =
|
|
1608
|
-
return
|
|
1666
|
+
childContainer: i
|
|
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;
|
|
1668
|
+
if (!d && u && p && !(i !== void 0)) {
|
|
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));
|
|
1609
1673
|
}
|
|
1610
1674
|
return !1;
|
|
1611
1675
|
})
|
|
1612
|
-
]), t = (
|
|
1676
|
+
]), t = (o = !1) => this.editor.commands.first(({ commands: s, tr: r }) => [
|
|
1613
1677
|
// Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start
|
|
1614
1678
|
// of the block.
|
|
1615
|
-
() => s.command(({ state:
|
|
1616
|
-
const c = B(
|
|
1679
|
+
() => s.command(({ state: a }) => {
|
|
1680
|
+
const c = B(a);
|
|
1617
1681
|
if (!c.isBlockContainer)
|
|
1618
1682
|
return !1;
|
|
1619
|
-
const { bnBlock:
|
|
1683
|
+
const { bnBlock: i, blockContent: l } = c, { depth: d } = a.doc.resolve(i.beforePos), u = a.selection.$anchor.parentOffset === 0, p = a.selection.anchor === a.selection.head, m = l.node.childCount === 0, f = d > 1;
|
|
1620
1684
|
return u && p && m && f ? s.liftListItem("blockContainer") : !1;
|
|
1621
1685
|
}),
|
|
1622
1686
|
// Creates a hard break if block is configured to do so.
|
|
1623
|
-
() => s.command(({ state:
|
|
1687
|
+
() => s.command(({ state: a }) => {
|
|
1624
1688
|
var l;
|
|
1625
|
-
const c = B(
|
|
1626
|
-
if (
|
|
1689
|
+
const c = B(a), i = ((l = this.options.editor.schema.blockSchema[c.blockNoteType].meta) == null ? void 0 : l.hardBreakShortcut) ?? "shift+enter";
|
|
1690
|
+
if (i === "none")
|
|
1627
1691
|
return !1;
|
|
1628
1692
|
if (
|
|
1629
1693
|
// If shortcut is not configured, or is configured as "shift+enter",
|
|
1630
1694
|
// create a hard break for shift+enter, but not for enter.
|
|
1631
|
-
|
|
1695
|
+
i === "shift+enter" && o || // If shortcut is configured as "enter", create a hard break for
|
|
1632
1696
|
// both enter and shift+enter.
|
|
1633
|
-
|
|
1697
|
+
i === "enter"
|
|
1634
1698
|
) {
|
|
1635
1699
|
const d = r.storedMarks || r.selection.$head.marks().filter(
|
|
1636
1700
|
(u) => this.editor.extensionManager.splittableMarks.includes(
|
|
@@ -1646,17 +1710,27 @@ const de = () => {
|
|
|
1646
1710
|
}),
|
|
1647
1711
|
// Creates a new block and moves the selection to it if the current one is empty, while the selection is also
|
|
1648
1712
|
// empty & at the start of the block.
|
|
1649
|
-
() => s.command(({ state:
|
|
1650
|
-
|
|
1651
|
-
|
|
1713
|
+
() => s.command(({ state: a, dispatch: c, tr: i }) => {
|
|
1714
|
+
var k;
|
|
1715
|
+
const l = B(a);
|
|
1716
|
+
if (!l.isBlockContainer)
|
|
1652
1717
|
return !1;
|
|
1653
|
-
const { bnBlock:
|
|
1654
|
-
if (
|
|
1655
|
-
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;
|
|
1656
1721
|
if (c) {
|
|
1657
|
-
const
|
|
1658
|
-
|
|
1659
|
-
|
|
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
|
|
1660
1734
|
);
|
|
1661
1735
|
}
|
|
1662
1736
|
return !0;
|
|
@@ -1665,14 +1739,14 @@ const de = () => {
|
|
|
1665
1739
|
}),
|
|
1666
1740
|
// Splits the current block, moving content inside that's after the cursor to a new text block below. Also
|
|
1667
1741
|
// deletes the selection beforehand, if it's not empty.
|
|
1668
|
-
() => s.command(({ state:
|
|
1669
|
-
const
|
|
1670
|
-
if (!
|
|
1742
|
+
() => s.command(({ state: a, chain: c }) => {
|
|
1743
|
+
const i = B(a);
|
|
1744
|
+
if (!i.isBlockContainer)
|
|
1671
1745
|
return !1;
|
|
1672
|
-
const { blockContent: l } =
|
|
1746
|
+
const { blockContent: l } = i, d = a.selection.$anchor.parentOffset === 0;
|
|
1673
1747
|
return l.node.childCount === 0 ? !1 : (c().deleteSelection().command(
|
|
1674
|
-
|
|
1675
|
-
|
|
1748
|
+
et(
|
|
1749
|
+
a.selection.from,
|
|
1676
1750
|
d,
|
|
1677
1751
|
d
|
|
1678
1752
|
)
|
|
@@ -1680,19 +1754,19 @@ const de = () => {
|
|
|
1680
1754
|
})
|
|
1681
1755
|
]);
|
|
1682
1756
|
return {
|
|
1683
|
-
Backspace:
|
|
1757
|
+
Backspace: n,
|
|
1684
1758
|
Delete: e,
|
|
1685
1759
|
Enter: () => t(),
|
|
1686
1760
|
"Shift-Enter": () => t(!0),
|
|
1687
1761
|
// Always returning true for tab key presses ensures they're not captured by the browser. Otherwise, they blur the
|
|
1688
1762
|
// editor since the browser will try to use tab for keyboard navigation.
|
|
1689
1763
|
Tab: () => {
|
|
1690
|
-
var
|
|
1691
|
-
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);
|
|
1692
1766
|
},
|
|
1693
1767
|
"Shift-Tab": () => {
|
|
1694
|
-
var
|
|
1695
|
-
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");
|
|
1696
1770
|
},
|
|
1697
1771
|
"Shift-Mod-ArrowUp": () => (this.options.editor.moveBlocksUp(), !0),
|
|
1698
1772
|
"Shift-Mod-ArrowDown": () => (this.options.editor.moveBlocksDown(), !0),
|
|
@@ -1701,7 +1775,7 @@ const de = () => {
|
|
|
1701
1775
|
"Shift-Mod-z": () => this.options.editor.redo()
|
|
1702
1776
|
};
|
|
1703
1777
|
}
|
|
1704
|
-
}),
|
|
1778
|
+
}), an = ee.create({
|
|
1705
1779
|
name: "insertion",
|
|
1706
1780
|
inclusive: !1,
|
|
1707
1781
|
excludes: "deletion modification insertion",
|
|
@@ -1711,8 +1785,8 @@ const de = () => {
|
|
|
1711
1785
|
// note: validate is supported in prosemirror but not in tiptap, so this doesn't actually work (considered not critical)
|
|
1712
1786
|
};
|
|
1713
1787
|
},
|
|
1714
|
-
extendMarkSchema(
|
|
1715
|
-
return
|
|
1788
|
+
extendMarkSchema(n) {
|
|
1789
|
+
return n.name !== "insertion" ? {} : {
|
|
1716
1790
|
blocknoteIgnore: !0,
|
|
1717
1791
|
inclusive: !1,
|
|
1718
1792
|
toDOM(e, t) {
|
|
@@ -1739,7 +1813,7 @@ const de = () => {
|
|
|
1739
1813
|
]
|
|
1740
1814
|
};
|
|
1741
1815
|
}
|
|
1742
|
-
}),
|
|
1816
|
+
}), cn = ee.create({
|
|
1743
1817
|
name: "deletion",
|
|
1744
1818
|
inclusive: !1,
|
|
1745
1819
|
excludes: "insertion modification deletion",
|
|
@@ -1749,8 +1823,8 @@ const de = () => {
|
|
|
1749
1823
|
// note: validate is supported in prosemirror but not in tiptap
|
|
1750
1824
|
};
|
|
1751
1825
|
},
|
|
1752
|
-
extendMarkSchema(
|
|
1753
|
-
return
|
|
1826
|
+
extendMarkSchema(n) {
|
|
1827
|
+
return n.name !== "deletion" ? {} : {
|
|
1754
1828
|
blocknoteIgnore: !0,
|
|
1755
1829
|
inclusive: !1,
|
|
1756
1830
|
// attrs: {
|
|
@@ -1780,7 +1854,7 @@ const de = () => {
|
|
|
1780
1854
|
]
|
|
1781
1855
|
};
|
|
1782
1856
|
}
|
|
1783
|
-
}),
|
|
1857
|
+
}), ln = ee.create({
|
|
1784
1858
|
name: "modification",
|
|
1785
1859
|
inclusive: !1,
|
|
1786
1860
|
excludes: "deletion insertion",
|
|
@@ -1793,8 +1867,8 @@ const de = () => {
|
|
|
1793
1867
|
newValue: { default: null }
|
|
1794
1868
|
};
|
|
1795
1869
|
},
|
|
1796
|
-
extendMarkSchema(
|
|
1797
|
-
return
|
|
1870
|
+
extendMarkSchema(n) {
|
|
1871
|
+
return n.name !== "modification" ? {} : {
|
|
1798
1872
|
blocknoteIgnore: !0,
|
|
1799
1873
|
inclusive: !1,
|
|
1800
1874
|
// attrs: {
|
|
@@ -1843,7 +1917,7 @@ const de = () => {
|
|
|
1843
1917
|
]
|
|
1844
1918
|
};
|
|
1845
1919
|
}
|
|
1846
|
-
}),
|
|
1920
|
+
}), dn = x.create({
|
|
1847
1921
|
name: "textAlignment",
|
|
1848
1922
|
addGlobalAttributes() {
|
|
1849
1923
|
return [
|
|
@@ -1856,34 +1930,34 @@ const de = () => {
|
|
|
1856
1930
|
attributes: {
|
|
1857
1931
|
textAlignment: {
|
|
1858
1932
|
default: "left",
|
|
1859
|
-
parseHTML: (
|
|
1860
|
-
renderHTML: (
|
|
1861
|
-
"data-text-alignment":
|
|
1933
|
+
parseHTML: (n) => n.getAttribute("data-text-alignment"),
|
|
1934
|
+
renderHTML: (n) => n.textAlignment === "left" ? {} : {
|
|
1935
|
+
"data-text-alignment": n.textAlignment
|
|
1862
1936
|
}
|
|
1863
1937
|
}
|
|
1864
1938
|
}
|
|
1865
1939
|
}
|
|
1866
1940
|
];
|
|
1867
1941
|
}
|
|
1868
|
-
}),
|
|
1942
|
+
}), un = x.create({
|
|
1869
1943
|
name: "blockTextColor",
|
|
1870
1944
|
addGlobalAttributes() {
|
|
1871
1945
|
return [
|
|
1872
1946
|
{
|
|
1873
1947
|
types: ["table", "tableCell", "tableHeader"],
|
|
1874
1948
|
attributes: {
|
|
1875
|
-
textColor:
|
|
1949
|
+
textColor: ot()
|
|
1876
1950
|
}
|
|
1877
1951
|
}
|
|
1878
1952
|
];
|
|
1879
1953
|
}
|
|
1880
|
-
}),
|
|
1954
|
+
}), pn = {
|
|
1881
1955
|
blockColor: "data-block-color",
|
|
1882
1956
|
blockStyle: "data-block-style",
|
|
1883
1957
|
id: "data-id",
|
|
1884
1958
|
depth: "data-depth",
|
|
1885
1959
|
depthChange: "data-depth-change"
|
|
1886
|
-
},
|
|
1960
|
+
}, fn = D.create({
|
|
1887
1961
|
name: "blockContainer",
|
|
1888
1962
|
group: "blockGroupChild bnBlock",
|
|
1889
1963
|
// A block always contains content, and optionally a blockGroup which contains nested blocks
|
|
@@ -1896,12 +1970,12 @@ const de = () => {
|
|
|
1896
1970
|
return [
|
|
1897
1971
|
{
|
|
1898
1972
|
tag: "div[data-node-type=" + this.name + "]",
|
|
1899
|
-
getAttrs: (
|
|
1900
|
-
if (typeof
|
|
1973
|
+
getAttrs: (n) => {
|
|
1974
|
+
if (typeof n == "string")
|
|
1901
1975
|
return !1;
|
|
1902
1976
|
const e = {};
|
|
1903
|
-
for (const [t,
|
|
1904
|
-
|
|
1977
|
+
for (const [t, o] of Object.entries(pn))
|
|
1978
|
+
n.getAttribute(o) && (e[t] = n.getAttribute(o));
|
|
1905
1979
|
return e;
|
|
1906
1980
|
}
|
|
1907
1981
|
},
|
|
@@ -1912,25 +1986,25 @@ const de = () => {
|
|
|
1912
1986
|
}
|
|
1913
1987
|
];
|
|
1914
1988
|
},
|
|
1915
|
-
renderHTML({ HTMLAttributes:
|
|
1989
|
+
renderHTML({ HTMLAttributes: n }) {
|
|
1916
1990
|
var s;
|
|
1917
1991
|
const e = document.createElement("div");
|
|
1918
1992
|
e.className = "bn-block-outer", e.setAttribute("data-node-type", "blockOuter");
|
|
1919
|
-
for (const [r,
|
|
1920
|
-
r !== "class" && e.setAttribute(r,
|
|
1993
|
+
for (const [r, a] of Object.entries(n))
|
|
1994
|
+
r !== "class" && e.setAttribute(r, a);
|
|
1921
1995
|
const t = {
|
|
1922
1996
|
...((s = this.options.domAttributes) == null ? void 0 : s.block) || {},
|
|
1923
|
-
...
|
|
1924
|
-
},
|
|
1925
|
-
|
|
1926
|
-
for (const [r,
|
|
1927
|
-
r !== "class" &&
|
|
1928
|
-
return e.appendChild(
|
|
1997
|
+
...n
|
|
1998
|
+
}, o = document.createElement("div");
|
|
1999
|
+
o.className = Z("bn-block", t.class), o.setAttribute("data-node-type", this.name);
|
|
2000
|
+
for (const [r, a] of Object.entries(t))
|
|
2001
|
+
r !== "class" && o.setAttribute(r, a);
|
|
2002
|
+
return e.appendChild(o), {
|
|
1929
2003
|
dom: e,
|
|
1930
|
-
contentDOM:
|
|
2004
|
+
contentDOM: o
|
|
1931
2005
|
};
|
|
1932
2006
|
}
|
|
1933
|
-
}),
|
|
2007
|
+
}), hn = D.create({
|
|
1934
2008
|
name: "blockGroup",
|
|
1935
2009
|
group: "childContainer",
|
|
1936
2010
|
content: "blockGroupChild+",
|
|
@@ -1939,17 +2013,17 @@ const de = () => {
|
|
|
1939
2013
|
return [
|
|
1940
2014
|
{
|
|
1941
2015
|
tag: "div",
|
|
1942
|
-
getAttrs: (
|
|
2016
|
+
getAttrs: (n) => typeof n == "string" ? !1 : n.getAttribute("data-node-type") === "blockGroup" ? null : !1
|
|
1943
2017
|
}
|
|
1944
2018
|
];
|
|
1945
2019
|
},
|
|
1946
|
-
renderHTML({ HTMLAttributes:
|
|
1947
|
-
var
|
|
2020
|
+
renderHTML({ HTMLAttributes: n }) {
|
|
2021
|
+
var o;
|
|
1948
2022
|
const e = {
|
|
1949
|
-
...((
|
|
1950
|
-
...
|
|
2023
|
+
...((o = this.options.domAttributes) == null ? void 0 : o.blockGroup) || {},
|
|
2024
|
+
...n
|
|
1951
2025
|
}, t = document.createElement("div");
|
|
1952
|
-
t.className =
|
|
2026
|
+
t.className = Z(
|
|
1953
2027
|
"bn-block-group",
|
|
1954
2028
|
e.class
|
|
1955
2029
|
), t.setAttribute("data-node-type", "blockGroup");
|
|
@@ -1960,117 +2034,117 @@ const de = () => {
|
|
|
1960
2034
|
contentDOM: t
|
|
1961
2035
|
};
|
|
1962
2036
|
}
|
|
1963
|
-
}),
|
|
2037
|
+
}), mn = D.create({
|
|
1964
2038
|
name: "doc",
|
|
1965
2039
|
topNode: !0,
|
|
1966
2040
|
content: "blockGroup",
|
|
1967
2041
|
marks: "insertion modification deletion"
|
|
1968
|
-
}),
|
|
1969
|
-
({ options:
|
|
2042
|
+
}), kn = $t(
|
|
2043
|
+
({ options: n }) => ({
|
|
1970
2044
|
key: "collaboration",
|
|
1971
2045
|
blockNoteExtensions: [
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
2046
|
+
ct(n),
|
|
2047
|
+
lt(n),
|
|
2048
|
+
dt(n),
|
|
2049
|
+
ut(),
|
|
2050
|
+
pt(n)
|
|
1977
2051
|
]
|
|
1978
2052
|
})
|
|
1979
2053
|
);
|
|
1980
2054
|
let fe = !1;
|
|
1981
|
-
function
|
|
2055
|
+
function bn(n, e) {
|
|
1982
2056
|
const t = [
|
|
1983
2057
|
I.ClipboardTextSerializer,
|
|
1984
2058
|
I.Commands,
|
|
1985
2059
|
I.Editable,
|
|
1986
2060
|
I.FocusEvents,
|
|
1987
2061
|
I.Tabindex,
|
|
1988
|
-
|
|
2062
|
+
Vt,
|
|
1989
2063
|
me.configure({
|
|
1990
2064
|
// everything from bnBlock group (nodes that represent a BlockNote block should have an id)
|
|
1991
2065
|
types: ["blockContainer", "columnList", "column"],
|
|
1992
2066
|
setIdAttribute: e.setIdAttribute
|
|
1993
2067
|
}),
|
|
1994
|
-
|
|
1995
|
-
|
|
2068
|
+
on,
|
|
2069
|
+
zt,
|
|
1996
2070
|
// marks:
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2071
|
+
an,
|
|
2072
|
+
cn,
|
|
2073
|
+
ln,
|
|
2074
|
+
Ut.extend({
|
|
2001
2075
|
inclusive: !1
|
|
2002
2076
|
}).configure({
|
|
2003
|
-
defaultProtocol:
|
|
2077
|
+
defaultProtocol: Et,
|
|
2004
2078
|
// only call this once if we have multiple editors installed. Or fix https://github.com/ueberdosis/tiptap/issues/5450
|
|
2005
|
-
protocols: fe ? [] :
|
|
2079
|
+
protocols: fe ? [] : Ct
|
|
2006
2080
|
}),
|
|
2007
|
-
...Object.values(
|
|
2008
|
-
editor:
|
|
2081
|
+
...Object.values(n.schema.styleSpecs).map((o) => o.implementation.mark.configure({
|
|
2082
|
+
editor: n
|
|
2009
2083
|
})),
|
|
2084
|
+
un,
|
|
2010
2085
|
tn,
|
|
2011
|
-
|
|
2012
|
-
en,
|
|
2086
|
+
dn,
|
|
2013
2087
|
// make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)
|
|
2014
|
-
|
|
2088
|
+
x.create({
|
|
2015
2089
|
name: "OverrideEscape",
|
|
2016
2090
|
addKeyboardShortcuts: () => ({
|
|
2017
2091
|
Escape: () => {
|
|
2018
|
-
var
|
|
2019
|
-
return (
|
|
2092
|
+
var o;
|
|
2093
|
+
return (o = n.getExtension(be)) != null && o.shown() ? !1 : (n.blur(), !0);
|
|
2020
2094
|
}
|
|
2021
2095
|
})
|
|
2022
2096
|
}),
|
|
2023
2097
|
// nodes
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
editor:
|
|
2098
|
+
mn,
|
|
2099
|
+
fn.configure({
|
|
2100
|
+
editor: n,
|
|
2027
2101
|
domAttributes: e.domAttributes
|
|
2028
2102
|
}),
|
|
2029
|
-
|
|
2030
|
-
editor:
|
|
2103
|
+
rn.configure({
|
|
2104
|
+
editor: n,
|
|
2031
2105
|
tabBehavior: e.tabBehavior
|
|
2032
2106
|
}),
|
|
2033
|
-
|
|
2107
|
+
hn.configure({
|
|
2034
2108
|
domAttributes: e.domAttributes
|
|
2035
2109
|
}),
|
|
2036
|
-
...Object.values(
|
|
2037
|
-
editor:
|
|
2110
|
+
...Object.values(n.schema.inlineContentSpecs).filter((o) => o.config !== "link" && o.config !== "text").map((o) => o.implementation.node.configure({
|
|
2111
|
+
editor: n
|
|
2038
2112
|
})),
|
|
2039
|
-
...Object.values(
|
|
2113
|
+
...Object.values(n.schema.blockSpecs).flatMap((o) => [
|
|
2040
2114
|
// the node extension implementations
|
|
2041
|
-
..."node" in
|
|
2042
|
-
|
|
2043
|
-
editor:
|
|
2115
|
+
..."node" in o.implementation ? [
|
|
2116
|
+
o.implementation.node.configure({
|
|
2117
|
+
editor: n,
|
|
2044
2118
|
domAttributes: e.domAttributes
|
|
2045
2119
|
})
|
|
2046
2120
|
] : []
|
|
2047
2121
|
]),
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
e.pasteHandler || ((
|
|
2122
|
+
en(n),
|
|
2123
|
+
Xo(
|
|
2124
|
+
n,
|
|
2125
|
+
e.pasteHandler || ((o) => o.defaultPasteHandler())
|
|
2052
2126
|
),
|
|
2053
|
-
|
|
2127
|
+
No(n)
|
|
2054
2128
|
];
|
|
2055
2129
|
return fe = !0, t;
|
|
2056
2130
|
}
|
|
2057
|
-
function
|
|
2131
|
+
function gn(n, e) {
|
|
2058
2132
|
const t = [
|
|
2059
2133
|
ye(),
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
pt(e),
|
|
2064
|
-
ft(),
|
|
2134
|
+
ft(e),
|
|
2135
|
+
j(e),
|
|
2136
|
+
W(e),
|
|
2065
2137
|
ht(e),
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2138
|
+
mt(),
|
|
2139
|
+
kt(e),
|
|
2140
|
+
Gt(e),
|
|
2141
|
+
bt(e),
|
|
2142
|
+
be(e),
|
|
2143
|
+
...e.trailingBlock !== !1 ? [gt()] : []
|
|
2070
2144
|
];
|
|
2071
|
-
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;
|
|
2072
2146
|
}
|
|
2073
|
-
class
|
|
2147
|
+
class yn {
|
|
2074
2148
|
constructor(e, t) {
|
|
2075
2149
|
/**
|
|
2076
2150
|
* A set of extension keys which are disabled by the options
|
|
@@ -2094,27 +2168,27 @@ class dn {
|
|
|
2094
2168
|
*/
|
|
2095
2169
|
h(this, "extensionPlugins", /* @__PURE__ */ new Map());
|
|
2096
2170
|
this.editor = e, this.options = t, e.onMount(() => {
|
|
2097
|
-
for (const
|
|
2098
|
-
if (
|
|
2099
|
-
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({
|
|
2100
2174
|
dom: e.prosemirrorView.dom,
|
|
2101
2175
|
root: e.prosemirrorView.root,
|
|
2102
2176
|
signal: s.signal
|
|
2103
2177
|
});
|
|
2104
2178
|
r && s.signal.addEventListener("abort", () => {
|
|
2105
2179
|
r();
|
|
2106
|
-
}), this.abortMap.set(
|
|
2180
|
+
}), this.abortMap.set(o, s);
|
|
2107
2181
|
}
|
|
2108
2182
|
}), e.onUnmount(() => {
|
|
2109
|
-
for (const [
|
|
2110
|
-
this.abortMap.delete(
|
|
2183
|
+
for (const [o, s] of this.abortMap.entries())
|
|
2184
|
+
this.abortMap.delete(o), s.abort();
|
|
2111
2185
|
}), this.disabledExtensions = new Set(t.disableExtensions || []);
|
|
2112
|
-
for (const
|
|
2113
|
-
this.addExtension(
|
|
2114
|
-
for (const
|
|
2115
|
-
this.addExtension(
|
|
2116
|
-
for (const
|
|
2117
|
-
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 ?? [])
|
|
2118
2192
|
this.addExtension(s);
|
|
2119
2193
|
}
|
|
2120
2194
|
/**
|
|
@@ -2129,20 +2203,20 @@ class dn {
|
|
|
2129
2203
|
console.warn("No extensions found to register", e);
|
|
2130
2204
|
return;
|
|
2131
2205
|
}
|
|
2132
|
-
const
|
|
2133
|
-
for (const
|
|
2134
|
-
|
|
2135
|
-
`Extension ${
|
|
2136
|
-
|
|
2137
|
-
), (r =
|
|
2138
|
-
`Extension ${
|
|
2139
|
-
|
|
2140
|
-
), this.getProsemirrorPluginsFromExtension(
|
|
2206
|
+
const o = t.map((a) => this.addExtension(a)).filter(Boolean), s = /* @__PURE__ */ new Set();
|
|
2207
|
+
for (const a of o)
|
|
2208
|
+
a != null && a.tiptapExtensions && console.warn(
|
|
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.`,
|
|
2210
|
+
a
|
|
2211
|
+
), (r = a == null ? void 0 : a.inputRules) != null && r.length && console.warn(
|
|
2212
|
+
`Extension ${a.key} has input rules, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,
|
|
2213
|
+
a
|
|
2214
|
+
), this.getProsemirrorPluginsFromExtension(a).plugins.forEach(
|
|
2141
2215
|
(c) => {
|
|
2142
2216
|
s.add(c);
|
|
2143
2217
|
}
|
|
2144
2218
|
);
|
|
2145
|
-
this.updatePlugins((
|
|
2219
|
+
this.updatePlugins((a) => [...a, ...s]);
|
|
2146
2220
|
}
|
|
2147
2221
|
/**
|
|
2148
2222
|
* Register an extension to the editor
|
|
@@ -2153,12 +2227,12 @@ class dn {
|
|
|
2153
2227
|
let t;
|
|
2154
2228
|
if (typeof e == "function" ? t = e({ editor: this.editor }) : t = e, !(!t || this.disabledExtensions.has(t.key))) {
|
|
2155
2229
|
if (typeof e == "function") {
|
|
2156
|
-
const
|
|
2157
|
-
typeof
|
|
2230
|
+
const o = t[Ht];
|
|
2231
|
+
typeof o == "function" && this.extensionFactories.set(o, t);
|
|
2158
2232
|
}
|
|
2159
2233
|
if (this.extensions.push(t), t.blockNoteExtensions)
|
|
2160
|
-
for (const
|
|
2161
|
-
this.addExtension(
|
|
2234
|
+
for (const o of t.blockNoteExtensions)
|
|
2235
|
+
this.addExtension(o);
|
|
2162
2236
|
return t;
|
|
2163
2237
|
}
|
|
2164
2238
|
}
|
|
@@ -2170,16 +2244,16 @@ class dn {
|
|
|
2170
2244
|
resolveExtensions(e) {
|
|
2171
2245
|
const t = [];
|
|
2172
2246
|
if (typeof e == "function") {
|
|
2173
|
-
const
|
|
2174
|
-
|
|
2247
|
+
const o = this.extensionFactories.get(e);
|
|
2248
|
+
o && t.push(o);
|
|
2175
2249
|
} else if (Array.isArray(e))
|
|
2176
|
-
for (const
|
|
2177
|
-
t.push(...this.resolveExtensions(
|
|
2250
|
+
for (const o of e)
|
|
2251
|
+
t.push(...this.resolveExtensions(o));
|
|
2178
2252
|
else if (typeof e == "object" && "key" in e)
|
|
2179
2253
|
t.push(e);
|
|
2180
2254
|
else if (typeof e == "string") {
|
|
2181
|
-
const
|
|
2182
|
-
|
|
2255
|
+
const o = this.extensions.find((s) => s.key === e);
|
|
2256
|
+
o && t.push(o);
|
|
2183
2257
|
}
|
|
2184
2258
|
return t;
|
|
2185
2259
|
}
|
|
@@ -2195,22 +2269,22 @@ class dn {
|
|
|
2195
2269
|
console.warn("No extensions found to unregister", e);
|
|
2196
2270
|
return;
|
|
2197
2271
|
}
|
|
2198
|
-
let
|
|
2272
|
+
let o = !1;
|
|
2199
2273
|
const s = /* @__PURE__ */ new Set();
|
|
2200
|
-
for (const
|
|
2201
|
-
this.extensions = this.extensions.filter((
|
|
2202
|
-
|
|
2203
|
-
}), (r = this.abortMap.get(
|
|
2204
|
-
const c = this.extensionPlugins.get(
|
|
2205
|
-
c == null || c.forEach((
|
|
2206
|
-
s.add(
|
|
2207
|
-
}), this.extensionPlugins.delete(
|
|
2208
|
-
`Extension ${
|
|
2274
|
+
for (const a of t) {
|
|
2275
|
+
this.extensions = this.extensions.filter((i) => i !== a), this.extensionFactories.forEach((i, l) => {
|
|
2276
|
+
i === a && this.extensionFactories.delete(l);
|
|
2277
|
+
}), (r = this.abortMap.get(a)) == null || r.abort(), this.abortMap.delete(a);
|
|
2278
|
+
const c = this.extensionPlugins.get(a);
|
|
2279
|
+
c == null || c.forEach((i) => {
|
|
2280
|
+
s.add(i);
|
|
2281
|
+
}), this.extensionPlugins.delete(a), a.tiptapExtensions && !o && (o = !0, console.warn(
|
|
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.`,
|
|
2209
2283
|
e
|
|
2210
2284
|
));
|
|
2211
2285
|
}
|
|
2212
2286
|
this.updatePlugins(
|
|
2213
|
-
(
|
|
2287
|
+
(a) => a.filter((c) => !s.has(c))
|
|
2214
2288
|
);
|
|
2215
2289
|
}
|
|
2216
2290
|
/**
|
|
@@ -2219,39 +2293,39 @@ class dn {
|
|
|
2219
2293
|
* @returns void
|
|
2220
2294
|
*/
|
|
2221
2295
|
updatePlugins(e) {
|
|
2222
|
-
const t = this.editor.prosemirrorState,
|
|
2296
|
+
const t = this.editor.prosemirrorState, o = t.reconfigure({
|
|
2223
2297
|
plugins: e(t.plugins.slice())
|
|
2224
2298
|
});
|
|
2225
|
-
this.editor.prosemirrorView.updateState(
|
|
2299
|
+
this.editor.prosemirrorView.updateState(o);
|
|
2226
2300
|
}
|
|
2227
2301
|
/**
|
|
2228
2302
|
* Get all the extensions that are registered to the editor
|
|
2229
2303
|
*/
|
|
2230
2304
|
getTiptapExtensions() {
|
|
2231
2305
|
var s;
|
|
2232
|
-
const e =
|
|
2306
|
+
const e = bn(
|
|
2233
2307
|
this.editor,
|
|
2234
2308
|
this.options
|
|
2235
|
-
).filter((r) => !this.disabledExtensions.has(r.name)), t =
|
|
2309
|
+
).filter((r) => !this.disabledExtensions.has(r.name)), t = xt(this.extensions), o = /* @__PURE__ */ new Map();
|
|
2236
2310
|
for (const r of this.extensions) {
|
|
2237
2311
|
r.tiptapExtensions && e.push(...r.tiptapExtensions);
|
|
2238
|
-
const
|
|
2312
|
+
const a = t(r.key), { plugins: c, inputRules: i } = this.getProsemirrorPluginsFromExtension(r);
|
|
2239
2313
|
c.length && e.push(
|
|
2240
|
-
|
|
2314
|
+
x.create({
|
|
2241
2315
|
name: r.key,
|
|
2242
|
-
priority:
|
|
2316
|
+
priority: a,
|
|
2243
2317
|
addProseMirrorPlugins: () => c
|
|
2244
2318
|
})
|
|
2245
|
-
),
|
|
2319
|
+
), i.length && (o.has(a) || o.set(a, []), o.get(a).push(...i));
|
|
2246
2320
|
}
|
|
2247
2321
|
e.push(
|
|
2248
|
-
|
|
2322
|
+
x.create({
|
|
2249
2323
|
name: "blocknote-input-rules",
|
|
2250
2324
|
addProseMirrorPlugins() {
|
|
2251
2325
|
const r = [];
|
|
2252
|
-
return Array.from(
|
|
2253
|
-
r.push(...
|
|
2254
|
-
}), [
|
|
2326
|
+
return Array.from(o.keys()).sort().reverse().forEach((a) => {
|
|
2327
|
+
r.push(...o.get(a));
|
|
2328
|
+
}), [Nt({ rules: r })];
|
|
2255
2329
|
}
|
|
2256
2330
|
})
|
|
2257
2331
|
);
|
|
@@ -2266,10 +2340,10 @@ class dn {
|
|
|
2266
2340
|
* - input rules
|
|
2267
2341
|
*/
|
|
2268
2342
|
getProsemirrorPluginsFromExtension(e) {
|
|
2269
|
-
var s, r,
|
|
2270
|
-
const t = [...e.prosemirrorPlugins ?? []],
|
|
2271
|
-
return !((s = e.prosemirrorPlugins) != null && s.length) && !Object.keys(e.keyboardShortcuts || {}).length && !((r = e.inputRules) != null && r.length) ? { plugins: t, inputRules:
|
|
2272
|
-
...e.inputRules.map((c) => new
|
|
2343
|
+
var s, r, a;
|
|
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) => {
|
|
2273
2347
|
const p = c.replace({
|
|
2274
2348
|
match: l,
|
|
2275
2349
|
range: { from: d, to: u },
|
|
@@ -2279,21 +2353,21 @@ class dn {
|
|
|
2279
2353
|
const m = this.editor.getTextCursorPosition();
|
|
2280
2354
|
if (this.editor.schema.blockSchema[m.block.type].content !== "inline")
|
|
2281
2355
|
return null;
|
|
2282
|
-
const f = $(
|
|
2283
|
-
return
|
|
2356
|
+
const f = $(i.tr), k = i.tr.deleteRange(d, u);
|
|
2357
|
+
return nt(k, f.bnBlock.beforePos, p), k;
|
|
2284
2358
|
}
|
|
2285
2359
|
return null;
|
|
2286
2360
|
}))
|
|
2287
2361
|
), Object.keys(e.keyboardShortcuts || {}).length && t.push(
|
|
2288
|
-
|
|
2362
|
+
Ft(
|
|
2289
2363
|
Object.fromEntries(
|
|
2290
|
-
Object.entries(e.keyboardShortcuts).map(([c,
|
|
2364
|
+
Object.entries(e.keyboardShortcuts).map(([c, i]) => [
|
|
2291
2365
|
c,
|
|
2292
|
-
() =>
|
|
2366
|
+
() => i({ editor: this.editor })
|
|
2293
2367
|
])
|
|
2294
2368
|
)
|
|
2295
2369
|
)
|
|
2296
|
-
), { plugins: t, inputRules:
|
|
2370
|
+
), { plugins: t, inputRules: o });
|
|
2297
2371
|
}
|
|
2298
2372
|
/**
|
|
2299
2373
|
* Get all extensions
|
|
@@ -2305,7 +2379,7 @@ class dn {
|
|
|
2305
2379
|
}
|
|
2306
2380
|
getExtension(e) {
|
|
2307
2381
|
if (typeof e == "string") {
|
|
2308
|
-
const t = this.extensions.find((
|
|
2382
|
+
const t = this.extensions.find((o) => o.key === e);
|
|
2309
2383
|
return t || void 0;
|
|
2310
2384
|
} else if (typeof e == "function") {
|
|
2311
2385
|
const t = this.extensionFactories.get(e);
|
|
@@ -2320,76 +2394,76 @@ class dn {
|
|
|
2320
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;
|
|
2321
2395
|
}
|
|
2322
2396
|
}
|
|
2323
|
-
function
|
|
2324
|
-
let { $from: t, $to:
|
|
2325
|
-
if (t.pos > t.start() && t.pos <
|
|
2326
|
-
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);
|
|
2327
2401
|
if (/^[\w\p{P}]$/u.test(s)) {
|
|
2328
|
-
const
|
|
2329
|
-
|
|
2402
|
+
const a = n.textBetween(t.start(), t.pos).match(/[\w\p{P}]+$/u);
|
|
2403
|
+
a && (t = n.resolve(t.pos - a[0].length));
|
|
2330
2404
|
}
|
|
2331
2405
|
}
|
|
2332
|
-
if (
|
|
2333
|
-
const s =
|
|
2406
|
+
if (o.pos < o.end() && o.pos > 0) {
|
|
2407
|
+
const s = n.textBetween(o.pos - 1, o.pos);
|
|
2334
2408
|
if (/^[\w\p{P}]$/u.test(s)) {
|
|
2335
|
-
const
|
|
2336
|
-
|
|
2409
|
+
const a = n.textBetween(o.pos, o.end()).match(/^[\w\p{P}]+/u);
|
|
2410
|
+
a && (o = n.resolve(o.pos + a[0].length));
|
|
2337
2411
|
}
|
|
2338
2412
|
}
|
|
2339
|
-
return { $from: t, $to:
|
|
2413
|
+
return { $from: t, $to: o, from: t.pos, to: o.pos };
|
|
2340
2414
|
}
|
|
2341
|
-
function
|
|
2342
|
-
const e = C(
|
|
2343
|
-
if (
|
|
2415
|
+
function Bn(n) {
|
|
2416
|
+
const e = C(n);
|
|
2417
|
+
if (n.selection.empty || "node" in n.selection)
|
|
2344
2418
|
return;
|
|
2345
|
-
const t =
|
|
2346
|
-
_(
|
|
2347
|
-
),
|
|
2348
|
-
_(
|
|
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
|
|
2349
2423
|
), s = (l, d) => {
|
|
2350
|
-
const u = t.posAtIndex(l, d), p =
|
|
2424
|
+
const u = t.posAtIndex(l, d), p = n.doc.resolve(u).nodeAfter;
|
|
2351
2425
|
if (!p)
|
|
2352
2426
|
throw new Error(
|
|
2353
2427
|
`Error getting selection - node not found at position ${u}`
|
|
2354
2428
|
);
|
|
2355
|
-
return
|
|
2356
|
-
}, r = [],
|
|
2357
|
-
if (t.depth >
|
|
2358
|
-
r.push(
|
|
2359
|
-
for (let l = t.depth; l >
|
|
2429
|
+
return S(p, e);
|
|
2430
|
+
}, r = [], a = t.sharedDepth(o.pos), c = t.index(a), i = o.index(a);
|
|
2431
|
+
if (t.depth > a) {
|
|
2432
|
+
r.push(S(t.nodeAfter, e));
|
|
2433
|
+
for (let l = t.depth; l > a; l--)
|
|
2360
2434
|
if (t.node(l).type.isInGroup("childContainer")) {
|
|
2361
2435
|
const u = t.index(l) + 1, p = t.node(l).childCount;
|
|
2362
2436
|
for (let m = u; m < p; m++)
|
|
2363
2437
|
r.push(s(m, l));
|
|
2364
2438
|
}
|
|
2365
2439
|
} else
|
|
2366
|
-
r.push(s(c,
|
|
2367
|
-
for (let l = c + 1; l <=
|
|
2368
|
-
r.push(s(l,
|
|
2440
|
+
r.push(s(c, a));
|
|
2441
|
+
for (let l = c + 1; l <= i; l++)
|
|
2442
|
+
r.push(s(l, a));
|
|
2369
2443
|
if (r.length === 0)
|
|
2370
2444
|
throw new Error(
|
|
2371
|
-
`Error getting selection - selection doesn't span any blocks (${
|
|
2445
|
+
`Error getting selection - selection doesn't span any blocks (${n.selection})`
|
|
2372
2446
|
);
|
|
2373
2447
|
return {
|
|
2374
2448
|
blocks: r
|
|
2375
2449
|
};
|
|
2376
2450
|
}
|
|
2377
|
-
function
|
|
2378
|
-
const
|
|
2379
|
-
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)
|
|
2380
2454
|
throw new Error(
|
|
2381
|
-
`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})`
|
|
2382
2456
|
);
|
|
2383
|
-
const c =
|
|
2457
|
+
const c = E(o, n.doc);
|
|
2384
2458
|
if (!c)
|
|
2385
|
-
throw new Error(`Block with ID ${
|
|
2386
|
-
const
|
|
2387
|
-
if (!
|
|
2459
|
+
throw new Error(`Block with ID ${o} not found`);
|
|
2460
|
+
const i = E(s, n.doc);
|
|
2461
|
+
if (!i)
|
|
2388
2462
|
throw new Error(`Block with ID ${s} not found`);
|
|
2389
|
-
const l =
|
|
2463
|
+
const l = R(c), d = R(i), u = a.blockSchema[l.blockNoteType], p = a.blockSchema[d.blockNoteType];
|
|
2390
2464
|
if (!l.isBlockContainer || u.content === "none")
|
|
2391
2465
|
throw new Error(
|
|
2392
|
-
`Attempting to set selection anchor in block without content (id ${
|
|
2466
|
+
`Attempting to set selection anchor in block without content (id ${o})`
|
|
2393
2467
|
);
|
|
2394
2468
|
if (!d.isBlockContainer || p.content === "none")
|
|
2395
2469
|
throw new Error(
|
|
@@ -2402,29 +2476,29 @@ function fn(o, e, t) {
|
|
|
2402
2476
|
} else
|
|
2403
2477
|
m = l.blockContent.beforePos + 1;
|
|
2404
2478
|
if (p.content === "table") {
|
|
2405
|
-
const k = se.get(d.blockContent.node),
|
|
2479
|
+
const k = se.get(d.blockContent.node), b = d.blockContent.beforePos + k.positionAt(
|
|
2406
2480
|
k.height - 1,
|
|
2407
2481
|
k.width - 1,
|
|
2408
2482
|
d.blockContent.node
|
|
2409
|
-
) + 1,
|
|
2410
|
-
f =
|
|
2483
|
+
) + 1, g = n.doc.resolve(b).nodeAfter.nodeSize;
|
|
2484
|
+
f = b + g - 2;
|
|
2411
2485
|
} else
|
|
2412
2486
|
f = d.blockContent.afterPos - 1;
|
|
2413
|
-
|
|
2487
|
+
n.setSelection(M.create(n.doc, m, f));
|
|
2414
2488
|
}
|
|
2415
|
-
function
|
|
2416
|
-
const t = C(
|
|
2417
|
-
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;
|
|
2418
2492
|
for (; r.parentOffset >= r.parent.nodeSize - 2 && r.depth > 0; )
|
|
2419
|
-
r =
|
|
2493
|
+
r = n.doc.resolve(r.pos + 1);
|
|
2420
2494
|
for (; r.parentOffset === 0 && r.depth > 0; )
|
|
2421
|
-
r =
|
|
2495
|
+
r = n.doc.resolve(r.pos - 1);
|
|
2422
2496
|
for (; s.parentOffset === 0 && s.depth > 0; )
|
|
2423
|
-
s =
|
|
2497
|
+
s = n.doc.resolve(s.pos - 1);
|
|
2424
2498
|
for (; s.parentOffset >= s.parent.nodeSize - 2 && s.depth > 0; )
|
|
2425
|
-
s =
|
|
2426
|
-
const
|
|
2427
|
-
|
|
2499
|
+
s = n.doc.resolve(s.pos + 1);
|
|
2500
|
+
const a = We(
|
|
2501
|
+
n.doc.slice(s.pos, r.pos, !0),
|
|
2428
2502
|
t
|
|
2429
2503
|
);
|
|
2430
2504
|
return {
|
|
@@ -2432,50 +2506,50 @@ function hn(o, e = !1) {
|
|
|
2432
2506
|
startPos: s.pos,
|
|
2433
2507
|
endPos: r.pos
|
|
2434
2508
|
},
|
|
2435
|
-
...
|
|
2509
|
+
...a
|
|
2436
2510
|
};
|
|
2437
2511
|
}
|
|
2438
|
-
function
|
|
2439
|
-
const { bnBlock: e } = $(
|
|
2440
|
-
let
|
|
2441
|
-
return
|
|
2442
|
-
block:
|
|
2443
|
-
prevBlock: s === null ? void 0 :
|
|
2444
|
-
nextBlock: r === null ? void 0 :
|
|
2445
|
-
parentBlock:
|
|
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;
|
|
2514
|
+
let a;
|
|
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)
|
|
2446
2520
|
};
|
|
2447
2521
|
}
|
|
2448
|
-
function De(
|
|
2449
|
-
const
|
|
2450
|
-
if (!
|
|
2451
|
-
throw new Error(`Block with ID ${
|
|
2452
|
-
const c =
|
|
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);
|
|
2524
|
+
if (!a)
|
|
2525
|
+
throw new Error(`Block with ID ${o} not found`);
|
|
2526
|
+
const c = R(a), i = r.blockSchema[c.blockNoteType].content;
|
|
2453
2527
|
if (c.isBlockContainer) {
|
|
2454
2528
|
const l = c.blockContent;
|
|
2455
|
-
if (
|
|
2456
|
-
|
|
2529
|
+
if (i === "none") {
|
|
2530
|
+
n.setSelection(L.create(n.doc, l.beforePos));
|
|
2457
2531
|
return;
|
|
2458
2532
|
}
|
|
2459
|
-
if (
|
|
2460
|
-
t === "start" ?
|
|
2461
|
-
M.create(
|
|
2462
|
-
) :
|
|
2463
|
-
M.create(
|
|
2533
|
+
if (i === "inline")
|
|
2534
|
+
t === "start" ? n.setSelection(
|
|
2535
|
+
M.create(n.doc, l.beforePos + 1)
|
|
2536
|
+
) : n.setSelection(
|
|
2537
|
+
M.create(n.doc, l.afterPos - 1)
|
|
2464
2538
|
);
|
|
2465
|
-
else if (
|
|
2466
|
-
t === "start" ?
|
|
2467
|
-
M.create(
|
|
2468
|
-
) :
|
|
2469
|
-
M.create(
|
|
2539
|
+
else if (i === "table")
|
|
2540
|
+
t === "start" ? n.setSelection(
|
|
2541
|
+
M.create(n.doc, l.beforePos + 4)
|
|
2542
|
+
) : n.setSelection(
|
|
2543
|
+
M.create(n.doc, l.afterPos - 4)
|
|
2470
2544
|
);
|
|
2471
2545
|
else
|
|
2472
|
-
throw new F(
|
|
2546
|
+
throw new F(i);
|
|
2473
2547
|
} else {
|
|
2474
2548
|
const l = t === "start" ? c.childContainer.node.firstChild : c.childContainer.node.lastChild;
|
|
2475
|
-
De(
|
|
2549
|
+
De(n, l.attrs.id, t);
|
|
2476
2550
|
}
|
|
2477
2551
|
}
|
|
2478
|
-
class
|
|
2552
|
+
class Mn {
|
|
2479
2553
|
constructor(e) {
|
|
2480
2554
|
this.editor = e;
|
|
2481
2555
|
}
|
|
@@ -2486,7 +2560,7 @@ class kn {
|
|
|
2486
2560
|
* If the selection starts / ends halfway through a block, the returned data will contain the entire block.
|
|
2487
2561
|
*/
|
|
2488
2562
|
getSelection() {
|
|
2489
|
-
return this.editor.transact((e) =>
|
|
2563
|
+
return this.editor.transact((e) => Bn(e));
|
|
2490
2564
|
}
|
|
2491
2565
|
/**
|
|
2492
2566
|
* Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
|
|
@@ -2496,7 +2570,7 @@ class kn {
|
|
|
2496
2570
|
* only the part of the block that is included in the selection.
|
|
2497
2571
|
*/
|
|
2498
2572
|
getSelectionCutBlocks(e = !1) {
|
|
2499
|
-
return this.editor.transact((t) =>
|
|
2573
|
+
return this.editor.transact((t) => En(t, e));
|
|
2500
2574
|
}
|
|
2501
2575
|
/**
|
|
2502
2576
|
* Sets the selection to a range of blocks.
|
|
@@ -2504,14 +2578,14 @@ class kn {
|
|
|
2504
2578
|
* @param endBlock The identifier of the block that should be the end of the selection.
|
|
2505
2579
|
*/
|
|
2506
2580
|
setSelection(e, t) {
|
|
2507
|
-
return this.editor.transact((
|
|
2581
|
+
return this.editor.transact((o) => Cn(o, e, t));
|
|
2508
2582
|
}
|
|
2509
2583
|
/**
|
|
2510
2584
|
* Gets a snapshot of the current text cursor position.
|
|
2511
2585
|
* @returns A snapshot of the current text cursor position.
|
|
2512
2586
|
*/
|
|
2513
2587
|
getTextCursorPosition() {
|
|
2514
|
-
return this.editor.transact((e) =>
|
|
2588
|
+
return this.editor.transact((e) => xn(e));
|
|
2515
2589
|
}
|
|
2516
2590
|
/**
|
|
2517
2591
|
* Sets the text cursor position to the start or end of an existing block. Throws an error if the target block could
|
|
@@ -2521,7 +2595,7 @@ class kn {
|
|
|
2521
2595
|
*/
|
|
2522
2596
|
setTextCursorPosition(e, t = "start") {
|
|
2523
2597
|
return this.editor.transact(
|
|
2524
|
-
(
|
|
2598
|
+
(o) => De(o, e, t)
|
|
2525
2599
|
);
|
|
2526
2600
|
}
|
|
2527
2601
|
/**
|
|
@@ -2530,20 +2604,20 @@ class kn {
|
|
|
2530
2604
|
getSelectionBoundingBox() {
|
|
2531
2605
|
if (!this.editor.prosemirrorView)
|
|
2532
2606
|
return;
|
|
2533
|
-
const { selection: e } = this.editor.prosemirrorState, { ranges: t } = e,
|
|
2534
|
-
if (
|
|
2535
|
-
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);
|
|
2536
2610
|
if (r)
|
|
2537
2611
|
return r.getBoundingClientRect();
|
|
2538
2612
|
}
|
|
2539
|
-
return
|
|
2613
|
+
return Pt(
|
|
2540
2614
|
this.editor.prosemirrorView,
|
|
2541
|
-
|
|
2615
|
+
o,
|
|
2542
2616
|
s
|
|
2543
2617
|
).toJSON();
|
|
2544
2618
|
}
|
|
2545
2619
|
}
|
|
2546
|
-
class
|
|
2620
|
+
class wn {
|
|
2547
2621
|
constructor(e) {
|
|
2548
2622
|
/**
|
|
2549
2623
|
* Stores the currently active transaction, which is the accumulated transaction from all {@link dispatch} calls during a {@link transact} calls
|
|
@@ -2589,8 +2663,8 @@ class gn {
|
|
|
2589
2663
|
);
|
|
2590
2664
|
if (this.isInCan)
|
|
2591
2665
|
return this.canExec(e);
|
|
2592
|
-
const t = this.prosemirrorState,
|
|
2593
|
-
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);
|
|
2594
2668
|
}
|
|
2595
2669
|
/**
|
|
2596
2670
|
* Check if a command can be executed. A command should return `false` if it is not valid in the current state.
|
|
@@ -2609,8 +2683,8 @@ class gn {
|
|
|
2609
2683
|
throw new Error(
|
|
2610
2684
|
"`canExec` should not be called within a `transact` call, move the `canExec` call outside of the `transact` call"
|
|
2611
2685
|
);
|
|
2612
|
-
const t = this.prosemirrorState,
|
|
2613
|
-
return e(t, void 0,
|
|
2686
|
+
const t = this.prosemirrorState, o = this.prosemirrorView;
|
|
2687
|
+
return e(t, void 0, o);
|
|
2614
2688
|
}
|
|
2615
2689
|
/**
|
|
2616
2690
|
* Execute a function within a "blocknote transaction".
|
|
@@ -2636,9 +2710,9 @@ class gn {
|
|
|
2636
2710
|
return e(this.activeTransaction);
|
|
2637
2711
|
try {
|
|
2638
2712
|
this.activeTransaction = this.editor._tiptapEditor.state.tr;
|
|
2639
|
-
const t = e(this.activeTransaction),
|
|
2640
|
-
return this.activeTransaction = null,
|
|
2641
|
-
(
|
|
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;
|
|
2642
2716
|
} finally {
|
|
2643
2717
|
this.activeTransaction = null;
|
|
2644
2718
|
}
|
|
@@ -2719,17 +2793,17 @@ class gn {
|
|
|
2719
2793
|
throw new Error("No redo plugin found");
|
|
2720
2794
|
}
|
|
2721
2795
|
}
|
|
2722
|
-
function
|
|
2723
|
-
let { from: s, to: r } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to },
|
|
2796
|
+
function Tn(n, e, t, o = { updateSelection: !0 }) {
|
|
2797
|
+
let { from: s, to: r } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, a = !0, c = !0, i = "";
|
|
2724
2798
|
if (t.forEach((l) => {
|
|
2725
|
-
l.check(),
|
|
2799
|
+
l.check(), a && l.isText && l.marks.length === 0 ? i += l.text : a = !1, c = c ? l.isBlock : !1;
|
|
2726
2800
|
}), s === r && c) {
|
|
2727
|
-
const { parent: l } =
|
|
2801
|
+
const { parent: l } = n.doc.resolve(s);
|
|
2728
2802
|
l.isTextblock && !l.type.spec.code && !l.childCount && (s -= 1, r += 1);
|
|
2729
2803
|
}
|
|
2730
|
-
return
|
|
2804
|
+
return a ? n.insertText(i, s, r) : n.replaceWith(s, r, t), o.updateSelection && vt(n, n.steps.length - 1, -1), !0;
|
|
2731
2805
|
}
|
|
2732
|
-
class
|
|
2806
|
+
class Pn {
|
|
2733
2807
|
constructor(e) {
|
|
2734
2808
|
this.editor = e;
|
|
2735
2809
|
}
|
|
@@ -2739,15 +2813,15 @@ class yn {
|
|
|
2739
2813
|
* @param content can be a string, or array of partial inline content elements
|
|
2740
2814
|
*/
|
|
2741
2815
|
insertInlineContent(e, { updateSelection: t = !1 } = {}) {
|
|
2742
|
-
const
|
|
2816
|
+
const o = O(e, this.editor.pmSchema);
|
|
2743
2817
|
this.editor.transact((s) => {
|
|
2744
|
-
|
|
2818
|
+
Tn(
|
|
2745
2819
|
s,
|
|
2746
2820
|
{
|
|
2747
2821
|
from: s.selection.from,
|
|
2748
2822
|
to: s.selection.to
|
|
2749
2823
|
},
|
|
2750
|
-
|
|
2824
|
+
o,
|
|
2751
2825
|
{
|
|
2752
2826
|
updateSelection: t
|
|
2753
2827
|
}
|
|
@@ -2759,8 +2833,8 @@ class yn {
|
|
|
2759
2833
|
*/
|
|
2760
2834
|
getActiveStyles() {
|
|
2761
2835
|
return this.editor.transact((e) => {
|
|
2762
|
-
const t = {},
|
|
2763
|
-
for (const s of
|
|
2836
|
+
const t = {}, o = e.selection.$to.marks();
|
|
2837
|
+
for (const s of o) {
|
|
2764
2838
|
const r = this.editor.schema.styleSchema[s.type.name];
|
|
2765
2839
|
if (!r) {
|
|
2766
2840
|
// Links are not considered styles in blocknote
|
|
@@ -2778,7 +2852,7 @@ class yn {
|
|
|
2778
2852
|
* @param styles The styles to add.
|
|
2779
2853
|
*/
|
|
2780
2854
|
addStyles(e) {
|
|
2781
|
-
for (const [t,
|
|
2855
|
+
for (const [t, o] of Object.entries(e)) {
|
|
2782
2856
|
const s = this.editor.schema.styleSchema[t];
|
|
2783
2857
|
if (!s)
|
|
2784
2858
|
throw new Error(`style ${t} not found in styleSchema`);
|
|
@@ -2786,7 +2860,7 @@ class yn {
|
|
|
2786
2860
|
this.editor._tiptapEditor.commands.setMark(t);
|
|
2787
2861
|
else if (s.propSchema === "string")
|
|
2788
2862
|
this.editor._tiptapEditor.commands.setMark(t, {
|
|
2789
|
-
stringValue:
|
|
2863
|
+
stringValue: o
|
|
2790
2864
|
});
|
|
2791
2865
|
else
|
|
2792
2866
|
throw new F(s.propSchema);
|
|
@@ -2805,7 +2879,7 @@ class yn {
|
|
|
2805
2879
|
* @param styles The styles to toggle.
|
|
2806
2880
|
*/
|
|
2807
2881
|
toggleStyles(e) {
|
|
2808
|
-
for (const [t,
|
|
2882
|
+
for (const [t, o] of Object.entries(e)) {
|
|
2809
2883
|
const s = this.editor.schema.styleSchema[t];
|
|
2810
2884
|
if (!s)
|
|
2811
2885
|
throw new Error(`style ${t} not found in styleSchema`);
|
|
@@ -2813,7 +2887,7 @@ class yn {
|
|
|
2813
2887
|
this.editor._tiptapEditor.commands.toggleMark(t);
|
|
2814
2888
|
else if (s.propSchema === "string")
|
|
2815
2889
|
this.editor._tiptapEditor.commands.toggleMark(t, {
|
|
2816
|
-
stringValue:
|
|
2890
|
+
stringValue: o
|
|
2817
2891
|
});
|
|
2818
2892
|
else
|
|
2819
2893
|
throw new F(s.propSchema);
|
|
@@ -2839,65 +2913,90 @@ class yn {
|
|
|
2839
2913
|
createLink(e, t) {
|
|
2840
2914
|
if (e === "")
|
|
2841
2915
|
return;
|
|
2842
|
-
const
|
|
2916
|
+
const o = this.editor.pmSchema.mark("link", { href: e });
|
|
2843
2917
|
this.editor.transact((s) => {
|
|
2844
|
-
const { from: r, to:
|
|
2845
|
-
t ? s.insertText(t, r,
|
|
2918
|
+
const { from: r, to: a } = s.selection;
|
|
2919
|
+
t ? s.insertText(t, r, a).addMark(r, r + t.length, o) : s.setSelection(Jt.create(s.doc, a)).addMark(
|
|
2846
2920
|
r,
|
|
2847
|
-
|
|
2848
|
-
|
|
2921
|
+
a,
|
|
2922
|
+
o
|
|
2849
2923
|
);
|
|
2850
2924
|
});
|
|
2851
2925
|
}
|
|
2852
2926
|
}
|
|
2853
|
-
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) {
|
|
2854
2941
|
const t = [];
|
|
2855
|
-
return
|
|
2856
|
-
r !== e && t.push(
|
|
2857
|
-
}),
|
|
2942
|
+
return n.forEach((o, s, r) => {
|
|
2943
|
+
r !== e && t.push(o);
|
|
2944
|
+
}), H.from(t);
|
|
2858
2945
|
}
|
|
2859
|
-
function
|
|
2946
|
+
function An(n, e) {
|
|
2860
2947
|
const t = [];
|
|
2861
|
-
for (let
|
|
2862
|
-
if (
|
|
2948
|
+
for (let o = 0; o < n.childCount; o++)
|
|
2949
|
+
if (n.child(o).type.name === "tableRow")
|
|
2863
2950
|
if (t.length > 0 && t[t.length - 1].type.name === "table") {
|
|
2864
|
-
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)));
|
|
2865
2952
|
t[t.length - 1] = r;
|
|
2866
2953
|
} else {
|
|
2867
2954
|
const s = e.nodes.table.createChecked(
|
|
2868
2955
|
void 0,
|
|
2869
|
-
|
|
2956
|
+
n.child(o)
|
|
2870
2957
|
);
|
|
2871
2958
|
t.push(s);
|
|
2872
2959
|
}
|
|
2873
2960
|
else
|
|
2874
|
-
t.push(
|
|
2875
|
-
return
|
|
2876
|
-
}
|
|
2877
|
-
function
|
|
2878
|
-
let t =
|
|
2879
|
-
if (t =
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
(
|
|
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));
|
|
2887
2986
|
}
|
|
2888
2987
|
const r = e.state.schema.nodes.blockContainer.createChecked(
|
|
2889
2988
|
void 0,
|
|
2890
2989
|
s
|
|
2891
2990
|
);
|
|
2892
|
-
t = t.replaceChild(
|
|
2991
|
+
t = t.replaceChild(o, r);
|
|
2893
2992
|
}
|
|
2894
|
-
return new
|
|
2993
|
+
return new U(t, n.openStart, n.openEnd);
|
|
2895
2994
|
}
|
|
2896
|
-
function
|
|
2897
|
-
var r,
|
|
2898
|
-
const t =
|
|
2995
|
+
function Dn(n, e) {
|
|
2996
|
+
var r, a;
|
|
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+";
|
|
2899
2998
|
if (t) {
|
|
2900
|
-
if (
|
|
2999
|
+
if (o)
|
|
2901
3000
|
return !1;
|
|
2902
3001
|
if (s) {
|
|
2903
3002
|
const c = B(e.state);
|
|
@@ -2907,14 +3006,14 @@ function xn(o, e) {
|
|
|
2907
3006
|
}
|
|
2908
3007
|
return !0;
|
|
2909
3008
|
}
|
|
2910
|
-
const
|
|
3009
|
+
const Ln = {
|
|
2911
3010
|
enableInputRules: !0,
|
|
2912
3011
|
enablePasteRules: !0,
|
|
2913
3012
|
enableCoreExtensions: !1
|
|
2914
3013
|
};
|
|
2915
|
-
class
|
|
3014
|
+
class Ne extends Se {
|
|
2916
3015
|
constructor(t) {
|
|
2917
|
-
var l, d, u, p, m, f, k,
|
|
3016
|
+
var l, d, u, p, m, f, k, b, g, w;
|
|
2918
3017
|
super();
|
|
2919
3018
|
/**
|
|
2920
3019
|
* The underlying prosemirror schema
|
|
@@ -2994,7 +3093,7 @@ class Le extends Se {
|
|
|
2994
3093
|
h(this, "unmount", () => {
|
|
2995
3094
|
this._tiptapEditor.unmount();
|
|
2996
3095
|
});
|
|
2997
|
-
this.options = t, this.dictionary = t.dictionary ||
|
|
3096
|
+
this.options = t, this.dictionary = t.dictionary || Lt, this.settings = {
|
|
2998
3097
|
tables: {
|
|
2999
3098
|
splitCells: ((l = t == null ? void 0 : t.tables) == null ? void 0 : l.splitCells) ?? !1,
|
|
3000
3099
|
cellBackgroundColor: ((d = t == null ? void 0 : t.tables) == null ? void 0 : d.cellBackgroundColor) ?? !1,
|
|
@@ -3002,61 +3101,61 @@ class Le extends Se {
|
|
|
3002
3101
|
headers: ((p = t == null ? void 0 : t.tables) == null ? void 0 : p.headers) ?? !1
|
|
3003
3102
|
}
|
|
3004
3103
|
};
|
|
3005
|
-
const
|
|
3104
|
+
const o = {
|
|
3006
3105
|
defaultStyles: !0,
|
|
3007
|
-
schema: t.schema ||
|
|
3106
|
+
schema: t.schema || Mt.create(),
|
|
3008
3107
|
...t,
|
|
3009
3108
|
placeholders: {
|
|
3010
3109
|
...this.dictionary.placeholders,
|
|
3011
3110
|
...t.placeholders
|
|
3012
3111
|
}
|
|
3013
3112
|
};
|
|
3014
|
-
if (this.schema =
|
|
3015
|
-
const
|
|
3016
|
-
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) => {
|
|
3017
3116
|
this.onUploadStartCallbacks.forEach(
|
|
3018
|
-
(v) => v.apply(this, [
|
|
3117
|
+
(v) => v.apply(this, [T])
|
|
3019
3118
|
);
|
|
3020
3119
|
try {
|
|
3021
|
-
return await
|
|
3120
|
+
return await y(P, T);
|
|
3022
3121
|
} finally {
|
|
3023
3122
|
this.onUploadEndCallbacks.forEach(
|
|
3024
|
-
(v) => v.apply(this, [
|
|
3123
|
+
(v) => v.apply(this, [T])
|
|
3025
3124
|
);
|
|
3026
3125
|
}
|
|
3027
3126
|
};
|
|
3028
3127
|
}
|
|
3029
|
-
this.resolveFileUrl =
|
|
3128
|
+
this.resolveFileUrl = o.resolveFileUrl, this._eventManager = new Co(this), this._extensionManager = new yn(this, o);
|
|
3030
3129
|
const s = this._extensionManager.getTiptapExtensions(), r = this._extensionManager.hasExtension("ySync") || this._extensionManager.hasExtension("liveblocksExtension");
|
|
3031
|
-
r &&
|
|
3130
|
+
r && o.initialContent && console.warn(
|
|
3032
3131
|
"When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"
|
|
3033
3132
|
);
|
|
3034
|
-
const
|
|
3035
|
-
...
|
|
3036
|
-
...
|
|
3133
|
+
const a = {
|
|
3134
|
+
...Ln,
|
|
3135
|
+
...o._tiptapOptions,
|
|
3037
3136
|
element: null,
|
|
3038
|
-
autofocus:
|
|
3137
|
+
autofocus: o.autofocus ?? !1,
|
|
3039
3138
|
extensions: s,
|
|
3040
3139
|
editorProps: {
|
|
3041
|
-
...(m =
|
|
3140
|
+
...(m = o._tiptapOptions) == null ? void 0 : m.editorProps,
|
|
3042
3141
|
attributes: {
|
|
3043
3142
|
// As of TipTap v2.5.0 the tabIndex is removed when the editor is not
|
|
3044
3143
|
// editable, so you can't focus it. We want to revert this as we have
|
|
3045
3144
|
// UI behaviour that relies on it.
|
|
3046
3145
|
tabIndex: "0",
|
|
3047
|
-
...(k = (f =
|
|
3048
|
-
...(
|
|
3049
|
-
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(
|
|
3050
3149
|
"bn-editor",
|
|
3051
|
-
|
|
3052
|
-
((
|
|
3150
|
+
o.defaultStyles ? "bn-default-styles" : "",
|
|
3151
|
+
((w = (g = o.domAttributes) == null ? void 0 : g.editor) == null ? void 0 : w.class) || ""
|
|
3053
3152
|
)
|
|
3054
3153
|
},
|
|
3055
|
-
transformPasted:
|
|
3154
|
+
transformPasted: _n
|
|
3056
3155
|
}
|
|
3057
3156
|
};
|
|
3058
3157
|
try {
|
|
3059
|
-
const
|
|
3158
|
+
const y = o.initialContent || (r ? [
|
|
3060
3159
|
{
|
|
3061
3160
|
type: "paragraph",
|
|
3062
3161
|
id: "initialBlockId"
|
|
@@ -3067,46 +3166,46 @@ class Le extends Se {
|
|
|
3067
3166
|
id: me.options.generateID()
|
|
3068
3167
|
}
|
|
3069
3168
|
]);
|
|
3070
|
-
if (!Array.isArray(
|
|
3169
|
+
if (!Array.isArray(y) || y.length === 0)
|
|
3071
3170
|
throw new Error(
|
|
3072
|
-
"initialContent must be a non-empty array of blocks, received: " +
|
|
3171
|
+
"initialContent must be a non-empty array of blocks, received: " + y
|
|
3073
3172
|
);
|
|
3074
|
-
const P =
|
|
3075
|
-
(
|
|
3076
|
-
), v =
|
|
3173
|
+
const P = At(a.extensions), T = y.map(
|
|
3174
|
+
(Oe) => Q(Oe, P, this.schema.styleSchema).toJSON()
|
|
3175
|
+
), v = _t(
|
|
3077
3176
|
{
|
|
3078
3177
|
type: "doc",
|
|
3079
3178
|
content: [
|
|
3080
3179
|
{
|
|
3081
3180
|
type: "blockGroup",
|
|
3082
|
-
content:
|
|
3181
|
+
content: T
|
|
3083
3182
|
}
|
|
3084
3183
|
]
|
|
3085
3184
|
},
|
|
3086
3185
|
P,
|
|
3087
|
-
|
|
3186
|
+
a.parseOptions
|
|
3088
3187
|
);
|
|
3089
|
-
this._tiptapEditor = new
|
|
3090
|
-
...
|
|
3188
|
+
this._tiptapEditor = new Dt({
|
|
3189
|
+
...a,
|
|
3091
3190
|
content: v.toJSON()
|
|
3092
3191
|
}), this.pmSchema = this._tiptapEditor.schema;
|
|
3093
|
-
} catch (
|
|
3192
|
+
} catch (y) {
|
|
3094
3193
|
throw new Error(
|
|
3095
3194
|
"Error creating document from blocks passed as `initialContent`",
|
|
3096
|
-
{ cause:
|
|
3195
|
+
{ cause: y }
|
|
3097
3196
|
);
|
|
3098
3197
|
}
|
|
3099
3198
|
let c;
|
|
3100
|
-
const
|
|
3101
|
-
this.pmSchema.nodes.doc.createAndFill = (...
|
|
3199
|
+
const i = this.pmSchema.nodes.doc.createAndFill;
|
|
3200
|
+
this.pmSchema.nodes.doc.createAndFill = (...y) => {
|
|
3102
3201
|
if (c)
|
|
3103
3202
|
return c;
|
|
3104
|
-
const P =
|
|
3105
|
-
return
|
|
3106
|
-
}, 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");
|
|
3107
3206
|
}
|
|
3108
3207
|
static create(t) {
|
|
3109
|
-
return new
|
|
3208
|
+
return new Ne(t ?? {});
|
|
3110
3209
|
}
|
|
3111
3210
|
/**
|
|
3112
3211
|
* BlockNote extensions that are added to the editor, keyed by the extension key
|
|
@@ -3209,14 +3308,14 @@ class Le extends Se {
|
|
|
3209
3308
|
// TODO move to extension
|
|
3210
3309
|
onUploadStart(t) {
|
|
3211
3310
|
return this.onUploadStartCallbacks.push(t), () => {
|
|
3212
|
-
const
|
|
3213
|
-
|
|
3311
|
+
const o = this.onUploadStartCallbacks.indexOf(t);
|
|
3312
|
+
o > -1 && this.onUploadStartCallbacks.splice(o, 1);
|
|
3214
3313
|
};
|
|
3215
3314
|
}
|
|
3216
3315
|
onUploadEnd(t) {
|
|
3217
3316
|
return this.onUploadEndCallbacks.push(t), () => {
|
|
3218
|
-
const
|
|
3219
|
-
|
|
3317
|
+
const o = this.onUploadEndCallbacks.indexOf(t);
|
|
3318
|
+
o > -1 && this.onUploadEndCallbacks.splice(o, 1);
|
|
3220
3319
|
};
|
|
3221
3320
|
}
|
|
3222
3321
|
/**
|
|
@@ -3280,8 +3379,8 @@ class Le extends Se {
|
|
|
3280
3379
|
* @param callback The callback to execute for each block. Returning `false` stops the traversal.
|
|
3281
3380
|
* @param reverse Whether the blocks should be traversed in reverse order.
|
|
3282
3381
|
*/
|
|
3283
|
-
forEachBlock(t,
|
|
3284
|
-
this._blockManager.forEachBlock(t,
|
|
3382
|
+
forEachBlock(t, o = !1) {
|
|
3383
|
+
this._blockManager.forEachBlock(t, o);
|
|
3285
3384
|
}
|
|
3286
3385
|
/**
|
|
3287
3386
|
* Executes a callback whenever the editor's contents change.
|
|
@@ -3322,8 +3421,8 @@ class Le extends Se {
|
|
|
3322
3421
|
* @param targetBlock The identifier of an existing block that the text cursor should be moved to.
|
|
3323
3422
|
* @param placement Whether the text cursor should be placed at the start or end of the block.
|
|
3324
3423
|
*/
|
|
3325
|
-
setTextCursorPosition(t,
|
|
3326
|
-
return this._selectionManager.setTextCursorPosition(t,
|
|
3424
|
+
setTextCursorPosition(t, o = "start") {
|
|
3425
|
+
return this._selectionManager.setTextCursorPosition(t, o);
|
|
3327
3426
|
}
|
|
3328
3427
|
/**
|
|
3329
3428
|
* Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
|
|
@@ -3349,8 +3448,8 @@ class Le extends Se {
|
|
|
3349
3448
|
* @param startBlock The identifier of the block that should be the start of the selection.
|
|
3350
3449
|
* @param endBlock The identifier of the block that should be the end of the selection.
|
|
3351
3450
|
*/
|
|
3352
|
-
setSelection(t,
|
|
3353
|
-
return this._selectionManager.setSelection(t,
|
|
3451
|
+
setSelection(t, o) {
|
|
3452
|
+
return this._selectionManager.setSelection(t, o);
|
|
3354
3453
|
}
|
|
3355
3454
|
/**
|
|
3356
3455
|
* Checks if the editor is currently editable, or if it's locked.
|
|
@@ -3374,10 +3473,10 @@ class Le extends Se {
|
|
|
3374
3473
|
* @param placement Whether the blocks should be inserted just before, just after, or nested inside the
|
|
3375
3474
|
* `referenceBlock`.
|
|
3376
3475
|
*/
|
|
3377
|
-
insertBlocks(t,
|
|
3476
|
+
insertBlocks(t, o, s = "before") {
|
|
3378
3477
|
return this._blockManager.insertBlocks(
|
|
3379
3478
|
t,
|
|
3380
|
-
|
|
3479
|
+
o,
|
|
3381
3480
|
s
|
|
3382
3481
|
);
|
|
3383
3482
|
}
|
|
@@ -3388,8 +3487,8 @@ class Le extends Se {
|
|
|
3388
3487
|
* @param blockToUpdate The block that should be updated.
|
|
3389
3488
|
* @param update A partial block which defines how the existing block should be changed.
|
|
3390
3489
|
*/
|
|
3391
|
-
updateBlock(t,
|
|
3392
|
-
return this._blockManager.updateBlock(t,
|
|
3490
|
+
updateBlock(t, o) {
|
|
3491
|
+
return this._blockManager.updateBlock(t, o);
|
|
3393
3492
|
}
|
|
3394
3493
|
/**
|
|
3395
3494
|
* Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
|
|
@@ -3405,8 +3504,8 @@ class Le extends Se {
|
|
|
3405
3504
|
* @param blocksToRemove An array of blocks that should be replaced.
|
|
3406
3505
|
* @param blocksToInsert An array of partial blocks to replace the old ones with.
|
|
3407
3506
|
*/
|
|
3408
|
-
replaceBlocks(t,
|
|
3409
|
-
return this._blockManager.replaceBlocks(t,
|
|
3507
|
+
replaceBlocks(t, o) {
|
|
3508
|
+
return this._blockManager.replaceBlocks(t, o);
|
|
3410
3509
|
}
|
|
3411
3510
|
/**
|
|
3412
3511
|
* Undo the last action.
|
|
@@ -3425,8 +3524,8 @@ class Le extends Se {
|
|
|
3425
3524
|
*
|
|
3426
3525
|
* @param content can be a string, or array of partial inline content elements
|
|
3427
3526
|
*/
|
|
3428
|
-
insertInlineContent(t, { updateSelection:
|
|
3429
|
-
this._styleManager.insertInlineContent(t, { updateSelection:
|
|
3527
|
+
insertInlineContent(t, { updateSelection: o = !1 } = {}) {
|
|
3528
|
+
this._styleManager.insertInlineContent(t, { updateSelection: o });
|
|
3430
3529
|
}
|
|
3431
3530
|
/**
|
|
3432
3531
|
* Gets the active text styles at the text cursor position or at the end of the current selection if it's active.
|
|
@@ -3472,8 +3571,8 @@ class Le extends Se {
|
|
|
3472
3571
|
* @param url The link URL.
|
|
3473
3572
|
* @param text The text to display the link with.
|
|
3474
3573
|
*/
|
|
3475
|
-
createLink(t,
|
|
3476
|
-
this._styleManager.createLink(t,
|
|
3574
|
+
createLink(t, o) {
|
|
3575
|
+
this._styleManager.createLink(t, o);
|
|
3477
3576
|
}
|
|
3478
3577
|
/**
|
|
3479
3578
|
* Checks if the block containing the text cursor can be nested.
|
|
@@ -3572,8 +3671,8 @@ class Le extends Se {
|
|
|
3572
3671
|
* @param callback The callback to execute.
|
|
3573
3672
|
* @returns A function to remove the callback.
|
|
3574
3673
|
*/
|
|
3575
|
-
onChange(t,
|
|
3576
|
-
return this._eventManager.onChange(t,
|
|
3674
|
+
onChange(t, o) {
|
|
3675
|
+
return this._eventManager.onChange(t, o);
|
|
3577
3676
|
}
|
|
3578
3677
|
/**
|
|
3579
3678
|
* A callback function that runs whenever the text cursor position or selection changes.
|
|
@@ -3581,10 +3680,10 @@ class Le extends Se {
|
|
|
3581
3680
|
* @param callback The callback to execute.
|
|
3582
3681
|
* @returns A function to remove the callback.
|
|
3583
3682
|
*/
|
|
3584
|
-
onSelectionChange(t,
|
|
3683
|
+
onSelectionChange(t, o) {
|
|
3585
3684
|
return this._eventManager.onSelectionChange(
|
|
3586
3685
|
t,
|
|
3587
|
-
|
|
3686
|
+
o
|
|
3588
3687
|
);
|
|
3589
3688
|
}
|
|
3590
3689
|
/**
|
|
@@ -3625,8 +3724,8 @@ class Le extends Se {
|
|
|
3625
3724
|
* @param html The HTML to paste.
|
|
3626
3725
|
* @param raw Whether to paste the HTML as is, or to convert it to BlockNote HTML.
|
|
3627
3726
|
*/
|
|
3628
|
-
pasteHTML(t,
|
|
3629
|
-
this._exportManager.pasteHTML(t,
|
|
3727
|
+
pasteHTML(t, o = !1) {
|
|
3728
|
+
this._exportManager.pasteHTML(t, o);
|
|
3630
3729
|
}
|
|
3631
3730
|
/**
|
|
3632
3731
|
* Paste text into the editor. Defaults to interpreting text as markdown.
|
|
@@ -3643,19 +3742,19 @@ class Le extends Se {
|
|
|
3643
3742
|
return this._exportManager.pasteMarkdown(t);
|
|
3644
3743
|
}
|
|
3645
3744
|
}
|
|
3646
|
-
class
|
|
3647
|
-
constructor(e, t,
|
|
3648
|
-
this.mappings = t, this.options =
|
|
3745
|
+
class cs {
|
|
3746
|
+
constructor(e, t, o) {
|
|
3747
|
+
this.mappings = t, this.options = o;
|
|
3649
3748
|
}
|
|
3650
3749
|
async resolveFile(e) {
|
|
3651
|
-
var
|
|
3652
|
-
if (!((
|
|
3750
|
+
var o;
|
|
3751
|
+
if (!((o = this.options) != null && o.resolveFileUrl))
|
|
3653
3752
|
return (await fetch(e)).blob();
|
|
3654
3753
|
const t = await this.options.resolveFileUrl(e);
|
|
3655
3754
|
return t instanceof Blob ? t : (await fetch(t)).blob();
|
|
3656
3755
|
}
|
|
3657
3756
|
mapStyles(e) {
|
|
3658
|
-
return Object.entries(e).map(([
|
|
3757
|
+
return Object.entries(e).map(([o, s]) => this.mappings.styleMapping[o](s, this));
|
|
3659
3758
|
}
|
|
3660
3759
|
mapInlineContent(e) {
|
|
3661
3760
|
return this.mappings.inlineContentMapping[e.type](
|
|
@@ -3666,201 +3765,201 @@ class Xn {
|
|
|
3666
3765
|
transformInlineContent(e) {
|
|
3667
3766
|
return e.map((t) => this.mapInlineContent(t));
|
|
3668
3767
|
}
|
|
3669
|
-
async mapBlock(e, t,
|
|
3768
|
+
async mapBlock(e, t, o, s) {
|
|
3670
3769
|
return this.mappings.blockMapping[e.type](
|
|
3671
3770
|
e,
|
|
3672
3771
|
this,
|
|
3673
3772
|
t,
|
|
3674
|
-
|
|
3773
|
+
o,
|
|
3675
3774
|
s
|
|
3676
3775
|
);
|
|
3677
3776
|
}
|
|
3678
3777
|
}
|
|
3679
|
-
function
|
|
3778
|
+
function ls(n) {
|
|
3680
3779
|
return {
|
|
3681
3780
|
createBlockMapping: (e) => e,
|
|
3682
3781
|
createInlineContentMapping: (e) => e,
|
|
3683
3782
|
createStyleMapping: (e) => e
|
|
3684
3783
|
};
|
|
3685
3784
|
}
|
|
3686
|
-
function
|
|
3687
|
-
const t = [...
|
|
3688
|
-
for (const
|
|
3689
|
-
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) {
|
|
3690
3789
|
const r = t.findLastIndex(
|
|
3691
|
-
(
|
|
3790
|
+
(a) => a.group === s.group
|
|
3692
3791
|
);
|
|
3693
3792
|
r === -1 ? t.push(s) : t.splice(r + 1, 0, s);
|
|
3694
3793
|
}
|
|
3695
3794
|
return t;
|
|
3696
3795
|
}
|
|
3697
3796
|
export {
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
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,
|
|
3705
3804
|
Se as EventEmitter,
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
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,
|
|
3710
3809
|
Pe as HTMLToBlocks,
|
|
3711
3810
|
me as UniqueID,
|
|
3712
3811
|
F as UnreachableCaseError,
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
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,
|
|
3756
3855
|
Je as createInlineContentSpecFromTipTapNode,
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
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
|
-
|
|
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,
|
|
3798
3897
|
B as getBlockInfoFromSelection,
|
|
3799
3898
|
$ as getBlockInfoFromTransaction,
|
|
3800
|
-
|
|
3899
|
+
ms as getBlockInfoWithManualOffset,
|
|
3801
3900
|
ke as getBlockNoteSchema,
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
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,
|
|
3809
3908
|
_ as getNearestBlockPos,
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3909
|
+
yo as getNextBlock,
|
|
3910
|
+
E as getNodeById,
|
|
3911
|
+
ua as getPageBreakSlashMenuItems,
|
|
3912
|
+
So as getParentBlock,
|
|
3913
|
+
Ur as getParseRules,
|
|
3815
3914
|
C as getPmSchema,
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
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,
|
|
3826
3925
|
O as inlineContentToNodes,
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
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,
|
|
3842
3941
|
ve as markdownToHTML,
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3942
|
+
Z as mergeCSSClasses,
|
|
3943
|
+
Xr as mergeParagraphs,
|
|
3944
|
+
S as nodeToBlock,
|
|
3945
|
+
G as nodeToCustomInlineContent,
|
|
3946
|
+
Zr as parseAudioElement,
|
|
3947
|
+
ea as parseDefaultProps,
|
|
3849
3948
|
Ke as propsToAttributes,
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3949
|
+
We as prosemirrorSliceToSlicedBlocks,
|
|
3950
|
+
ae as removeAndInsertBlocks,
|
|
3951
|
+
Xt as removeEmptyColumns,
|
|
3853
3952
|
Ae as selectedFragmentToHTML,
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
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
|
|
3865
3964
|
};
|
|
3866
3965
|
//# sourceMappingURL=blocknote.js.map
|