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