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