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