@blocknote/core 0.46.1 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BlockNoteSchema-DsMVJZv4.js → BlockNoteSchema-1r-ln0Q0.js} +2 -2
- package/dist/{BlockNoteSchema-DsMVJZv4.js.map → BlockNoteSchema-1r-ln0Q0.js.map} +1 -1
- package/dist/{BlockNoteSchema-qt4Czo0-.cjs → BlockNoteSchema-DT4bdXj5.cjs} +2 -2
- package/dist/{BlockNoteSchema-qt4Czo0-.cjs.map → BlockNoteSchema-DT4bdXj5.cjs.map} +1 -1
- package/dist/{TrailingNode-C-Kyrtf1.js → TrailingNode-DZag-Nvu.js} +476 -464
- package/dist/TrailingNode-DZag-Nvu.js.map +1 -0
- package/dist/TrailingNode-tesI8f7N.cjs +2 -0
- package/dist/TrailingNode-tesI8f7N.cjs.map +1 -0
- package/dist/blocknote.cjs +4 -4
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +1264 -1165
- package/dist/blocknote.js.map +1 -1
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +2 -2
- package/dist/{defaultBlocks-CXOCngjC.js → defaultBlocks-BSOEW3GR.js} +33 -29
- package/dist/defaultBlocks-BSOEW3GR.js.map +1 -0
- package/dist/defaultBlocks-D049Pbme.cjs +6 -0
- package/dist/defaultBlocks-D049Pbme.cjs.map +1 -0
- package/dist/extensions.cjs +1 -1
- package/dist/extensions.js +3 -3
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +813 -28
- package/dist/locales.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +1 -1
- package/src/api/exporters/html/internalHTMLSerializer.ts +146 -2
- package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +3 -0
- package/src/blocks/Code/block.ts +12 -8
- package/src/blocks/ListItem/CheckListItem/block.test.ts +61 -0
- package/src/blocks/ListItem/CheckListItem/block.ts +4 -0
- package/src/editor/Block.css +7 -3
- package/src/editor/editor.css +1 -0
- package/src/editor/transformPasted.ts +69 -0
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.ts +1 -0
- package/src/extensions/SideMenu/SideMenu.ts +44 -0
- package/src/extensions/TableHandles/TableHandles.ts +6 -2
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +37 -11
- package/src/i18n/locales/fa.ts +390 -0
- package/src/i18n/locales/index.ts +2 -0
- package/src/i18n/locales/uz.ts +421 -0
- package/src/schema/blocks/createSpec.ts +4 -2
- package/src/schema/blocks/types.ts +9 -0
- package/types/src/blocks/ListItem/CheckListItem/block.test.d.ts +1 -0
- package/types/src/i18n/locales/fa.d.ts +320 -0
- package/types/src/i18n/locales/index.d.ts +2 -0
- package/types/src/i18n/locales/uz.d.ts +2 -0
- package/types/src/schema/blocks/types.d.ts +9 -3
- package/dist/TrailingNode-C-Kyrtf1.js.map +0 -1
- package/dist/TrailingNode-W7GJVng5.cjs +0 -2
- package/dist/TrailingNode-W7GJVng5.cjs.map +0 -1
- package/dist/defaultBlocks-CXOCngjC.js.map +0 -1
- package/dist/defaultBlocks-IsUGVZIq.cjs +0 -6
- package/dist/defaultBlocks-IsUGVZIq.cjs.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var Ie = Object.defineProperty;
|
|
2
|
-
var Be = (n, e,
|
|
3
|
-
var b = (n, e,
|
|
2
|
+
var Be = (n, e, o) => e in n ? Ie(n, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : n[e] = o;
|
|
3
|
+
var b = (n, e, o) => Be(n, typeof e != "symbol" ? e + "" : e, o);
|
|
4
4
|
import { Plugin as T, PluginKey as P, NodeSelection as le, TextSelection as ce, Selection as N } from "prosemirror-state";
|
|
5
|
-
import { combineTransactionSteps as Te, getMarkRange as Pe, posToDOMRect as
|
|
6
|
-
import
|
|
5
|
+
import { combineTransactionSteps as Te, getMarkRange as Pe, posToDOMRect as De, findChildren as j } from "@tiptap/core";
|
|
6
|
+
import Oe from "fast-deep-equal";
|
|
7
7
|
import { i as q, t as Ae, U as Me, n as Ne, g as R, a as L, c as de, m as Re, e as ue, f as Le, h as Ve, j as He, k as Fe, l as $e, o as W, p as G } from "./blockToNode-BNoNIXU7.js";
|
|
8
|
-
import { ai as he, a2 as J, aj as me, $ as Ue, a1 as Q } from "./defaultBlocks-
|
|
9
|
-
import { c as
|
|
8
|
+
import { ai as he, a2 as J, aj as me, $ as Ue, a1 as Q } from "./defaultBlocks-BSOEW3GR.js";
|
|
9
|
+
import { c as C, a as H } from "./BlockNoteExtension-C2X7LW-V.js";
|
|
10
10
|
import { yCursorPlugin as _e, defaultSelectionBuilder as ze, ySyncPlugin as Ke, redoCommand as Ye, undoCommand as Xe, yUndoPlugin as je, yUndoPluginKey as Z } from "y-prosemirror";
|
|
11
11
|
import * as I from "yjs";
|
|
12
12
|
import { PluginKey as pe, Plugin as fe, TextSelection as qe } from "@tiptap/pm/state";
|
|
@@ -26,11 +26,11 @@ import { visit as ct } from "unist-util-visit";
|
|
|
26
26
|
import { splitCell as dt, mergeCells as ut, deleteRow as ht, deleteColumn as mt, addRowBefore as pt, addRowAfter as ft, addColumnBefore as gt, addColumnAfter as wt, CellSelection as yt } from "prosemirror-tables";
|
|
27
27
|
function ye(n) {
|
|
28
28
|
const e = Array.from(n.classList).filter(
|
|
29
|
-
(
|
|
29
|
+
(o) => !o.startsWith("bn-")
|
|
30
30
|
) || [];
|
|
31
31
|
e.length > 0 ? n.className = e.join(" ") : n.removeAttribute("class");
|
|
32
32
|
}
|
|
33
|
-
function be(n, e,
|
|
33
|
+
function be(n, e, o, t) {
|
|
34
34
|
var a;
|
|
35
35
|
let r;
|
|
36
36
|
if (e)
|
|
@@ -43,7 +43,7 @@ function be(n, e, t, o) {
|
|
|
43
43
|
else
|
|
44
44
|
throw new Me(e.type);
|
|
45
45
|
else throw new Error("blockContent is required");
|
|
46
|
-
const i = ((
|
|
46
|
+
const i = ((t == null ? void 0 : t.document) ?? document).createDocumentFragment();
|
|
47
47
|
for (const c of r)
|
|
48
48
|
if (c.type.name !== "text" && n.schema.inlineContentSchema[c.type.name]) {
|
|
49
49
|
const l = n.schema.inlineContentSpecs[c.type.name].implementation;
|
|
@@ -67,9 +67,9 @@ function be(n, e, t, o) {
|
|
|
67
67
|
);
|
|
68
68
|
if (h) {
|
|
69
69
|
if (i.appendChild(h.dom), h.contentDOM) {
|
|
70
|
-
const g =
|
|
70
|
+
const g = o.serializeFragment(
|
|
71
71
|
c.content,
|
|
72
|
-
|
|
72
|
+
t
|
|
73
73
|
);
|
|
74
74
|
h.contentDOM.dataset.editable = "", h.contentDOM.appendChild(g);
|
|
75
75
|
}
|
|
@@ -90,45 +90,48 @@ function be(n, e, t, o) {
|
|
|
90
90
|
}
|
|
91
91
|
i.appendChild(l);
|
|
92
92
|
} else {
|
|
93
|
-
const l =
|
|
93
|
+
const l = o.serializeFragment(
|
|
94
94
|
we.from([c]),
|
|
95
|
-
|
|
95
|
+
t
|
|
96
96
|
);
|
|
97
97
|
i.appendChild(l);
|
|
98
98
|
}
|
|
99
99
|
return i.childNodes.length === 1 && ((a = i.firstChild) == null ? void 0 : a.nodeType) === 1 && ye(i.firstChild), i;
|
|
100
100
|
}
|
|
101
|
-
function bt(n, e,
|
|
102
|
-
var w, y,
|
|
103
|
-
const c = (a == null ? void 0 : a.document) ?? document, l = e.pmSchema.nodes.blockContainer, u =
|
|
104
|
-
for (const [
|
|
105
|
-
e.schema.blockSchema[
|
|
101
|
+
function bt(n, e, o, t, r, s, i, a) {
|
|
102
|
+
var w, y, v, D, _, z, K, Y, X;
|
|
103
|
+
const c = (a == null ? void 0 : a.document) ?? document, l = e.pmSchema.nodes.blockContainer, u = o.props || {};
|
|
104
|
+
for (const [k, x] of Object.entries(
|
|
105
|
+
e.schema.blockSchema[o.type].propSchema
|
|
106
106
|
))
|
|
107
|
-
!(
|
|
107
|
+
!(k in u) && x.default !== void 0 && (u[k] = x.default);
|
|
108
108
|
const h = (y = (w = l.spec) == null ? void 0 : w.toDOM) == null ? void 0 : y.call(
|
|
109
109
|
w,
|
|
110
110
|
l.create({
|
|
111
|
-
id:
|
|
111
|
+
id: o.id,
|
|
112
112
|
...u
|
|
113
113
|
})
|
|
114
|
-
), g = Array.from(h.dom.attributes), m = e.blockImplementations[
|
|
114
|
+
), g = Array.from(h.dom.attributes), m = e.blockImplementations[o.type].implementation, p = ((v = m.toExternalHTML) == null ? void 0 : v.call(
|
|
115
115
|
{},
|
|
116
|
-
{ ...
|
|
117
|
-
e
|
|
116
|
+
{ ...o, props: u },
|
|
117
|
+
e,
|
|
118
|
+
{
|
|
119
|
+
nestingLevel: i
|
|
120
|
+
}
|
|
118
121
|
)) || m.render.call(
|
|
119
122
|
{},
|
|
120
|
-
{ ...
|
|
123
|
+
{ ...o, props: u },
|
|
121
124
|
e
|
|
122
125
|
), d = c.createDocumentFragment();
|
|
123
126
|
if (p.dom.classList.contains("bn-block-content")) {
|
|
124
|
-
const
|
|
127
|
+
const k = [
|
|
125
128
|
...g,
|
|
126
129
|
...Array.from(p.dom.attributes)
|
|
127
130
|
].filter(
|
|
128
|
-
(
|
|
131
|
+
(x) => x.name.startsWith("data") && x.name !== "data-content-type" && x.name !== "data-file-block" && x.name !== "data-node-view-wrapper" && x.name !== "data-node-type" && x.name !== "data-id" && x.name !== "data-editable"
|
|
129
132
|
);
|
|
130
|
-
for (const
|
|
131
|
-
p.dom.firstChild.setAttribute(
|
|
133
|
+
for (const x of k)
|
|
134
|
+
p.dom.firstChild.setAttribute(x.name, x.value);
|
|
132
135
|
ye(p.dom.firstChild), i > 0 && p.dom.firstChild.setAttribute(
|
|
133
136
|
"data-nesting-level",
|
|
134
137
|
i.toString()
|
|
@@ -138,134 +141,134 @@ function bt(n, e, t, o, r, s, i, a) {
|
|
|
138
141
|
"data-nesting-level",
|
|
139
142
|
i.toString()
|
|
140
143
|
);
|
|
141
|
-
if (p.contentDOM &&
|
|
142
|
-
const
|
|
144
|
+
if (p.contentDOM && o.content) {
|
|
145
|
+
const k = be(
|
|
143
146
|
e,
|
|
144
|
-
|
|
147
|
+
o.content,
|
|
145
148
|
// TODO
|
|
146
|
-
|
|
149
|
+
t,
|
|
147
150
|
a
|
|
148
151
|
);
|
|
149
|
-
p.contentDOM.appendChild(
|
|
152
|
+
p.contentDOM.appendChild(k);
|
|
150
153
|
}
|
|
151
154
|
let f;
|
|
152
|
-
if (r.has(
|
|
153
|
-
if (((
|
|
154
|
-
const
|
|
155
|
-
f === "OL" && "start" in u && u.start && (u == null ? void 0 : u.start) !== 1 &&
|
|
155
|
+
if (r.has(o.type) ? f = "OL" : s.has(o.type) && (f = "UL"), f) {
|
|
156
|
+
if (((D = n.lastChild) == null ? void 0 : D.nodeName) !== f) {
|
|
157
|
+
const k = c.createElement(f);
|
|
158
|
+
f === "OL" && "start" in u && u.start && (u == null ? void 0 : u.start) !== 1 && k.setAttribute("start", u.start + ""), n.append(k);
|
|
156
159
|
}
|
|
157
160
|
n.lastChild.appendChild(d);
|
|
158
161
|
} else
|
|
159
162
|
n.append(d);
|
|
160
|
-
if (
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
163
|
-
|
|
163
|
+
if (o.children && o.children.length > 0) {
|
|
164
|
+
const k = c.createDocumentFragment();
|
|
165
|
+
if (ke(
|
|
166
|
+
k,
|
|
164
167
|
e,
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
o.children,
|
|
169
|
+
t,
|
|
167
170
|
r,
|
|
168
171
|
s,
|
|
169
172
|
i + 1,
|
|
170
173
|
a
|
|
171
174
|
), ((_ = n.lastChild) == null ? void 0 : _.nodeName) === "UL" || ((z = n.lastChild) == null ? void 0 : z.nodeName) === "OL")
|
|
172
|
-
for (; ((K =
|
|
173
|
-
n.lastChild.lastChild.appendChild(
|
|
174
|
-
e.pmSchema.nodes[
|
|
175
|
+
for (; ((K = k.firstChild) == null ? void 0 : K.nodeName) === "UL" || ((Y = k.firstChild) == null ? void 0 : Y.nodeName) === "OL"; )
|
|
176
|
+
n.lastChild.lastChild.appendChild(k.firstChild);
|
|
177
|
+
e.pmSchema.nodes[o.type].isInGroup("blockContent") ? n.append(k) : (X = p.contentDOM) == null || X.append(k);
|
|
175
178
|
}
|
|
176
179
|
}
|
|
177
|
-
const
|
|
178
|
-
for (const c of
|
|
180
|
+
const ke = (n, e, o, t, r, s, i = 0, a) => {
|
|
181
|
+
for (const c of o)
|
|
179
182
|
bt(
|
|
180
183
|
n,
|
|
181
184
|
e,
|
|
182
185
|
c,
|
|
183
|
-
|
|
186
|
+
t,
|
|
184
187
|
r,
|
|
185
188
|
s,
|
|
186
189
|
i,
|
|
187
190
|
a
|
|
188
191
|
);
|
|
189
|
-
},
|
|
192
|
+
}, kt = (n, e, o, t, r, s) => {
|
|
190
193
|
const a = ((s == null ? void 0 : s.document) ?? document).createDocumentFragment();
|
|
191
|
-
return
|
|
194
|
+
return ke(
|
|
192
195
|
a,
|
|
193
196
|
n,
|
|
194
197
|
e,
|
|
195
|
-
t,
|
|
196
198
|
o,
|
|
199
|
+
t,
|
|
197
200
|
r,
|
|
198
201
|
0,
|
|
199
202
|
s
|
|
200
203
|
), a;
|
|
201
|
-
},
|
|
202
|
-
const
|
|
204
|
+
}, Ce = (n, e) => {
|
|
205
|
+
const o = ge.fromSchema(n);
|
|
203
206
|
return {
|
|
204
|
-
exportBlocks: (
|
|
205
|
-
const s =
|
|
207
|
+
exportBlocks: (t, r) => {
|
|
208
|
+
const s = kt(
|
|
206
209
|
e,
|
|
207
|
-
o,
|
|
208
210
|
t,
|
|
211
|
+
o,
|
|
209
212
|
/* @__PURE__ */ new Set(["numberedListItem"]),
|
|
210
213
|
/* @__PURE__ */ new Set(["bulletListItem", "checkListItem", "toggleListItem"]),
|
|
211
214
|
r
|
|
212
215
|
), i = document.createElement("div");
|
|
213
216
|
return i.append(s), i.innerHTML;
|
|
214
217
|
},
|
|
215
|
-
exportInlineContent: (
|
|
218
|
+
exportInlineContent: (t, r) => {
|
|
216
219
|
const s = be(
|
|
217
220
|
e,
|
|
218
|
-
o,
|
|
219
221
|
t,
|
|
222
|
+
o,
|
|
220
223
|
r
|
|
221
224
|
), i = document.createElement("div");
|
|
222
225
|
return i.append(s.cloneNode(!0)), i.innerHTML;
|
|
223
226
|
}
|
|
224
227
|
};
|
|
225
228
|
};
|
|
226
|
-
function
|
|
229
|
+
function Ct(n, e) {
|
|
227
230
|
if (e === 0)
|
|
228
231
|
return;
|
|
229
|
-
const
|
|
230
|
-
for (let
|
|
231
|
-
const r =
|
|
232
|
+
const o = n.resolve(e);
|
|
233
|
+
for (let t = o.depth; t > 0; t--) {
|
|
234
|
+
const r = o.node(t);
|
|
232
235
|
if (he(r))
|
|
233
236
|
return r.attrs.id;
|
|
234
237
|
}
|
|
235
238
|
}
|
|
236
|
-
function
|
|
239
|
+
function vt(n) {
|
|
237
240
|
return n.getMeta("paste") ? { type: "paste" } : n.getMeta("uiEvent") === "drop" ? { type: "drop" } : n.getMeta("history$") ? {
|
|
238
241
|
type: n.getMeta("history$").redo ? "redo" : "undo"
|
|
239
242
|
} : n.getMeta("y-sync$") ? n.getMeta("y-sync$").isUndoRedoOperation ? { type: "undo-redo" } : { type: "yjs-remote" } : { type: "local" };
|
|
240
243
|
}
|
|
241
244
|
function ee(n) {
|
|
242
|
-
const e = "__root__",
|
|
245
|
+
const e = "__root__", o = {}, t = {}, r = R(n);
|
|
243
246
|
return n.descendants((s, i) => {
|
|
244
247
|
if (!he(s))
|
|
245
248
|
return !0;
|
|
246
|
-
const a =
|
|
247
|
-
|
|
249
|
+
const a = Ct(n, i), c = a ?? e;
|
|
250
|
+
t[c] || (t[c] = []);
|
|
248
251
|
const l = L(s, r);
|
|
249
|
-
return
|
|
250
|
-
}), { byId:
|
|
252
|
+
return o[s.attrs.id] = { block: l, parentId: a }, t[c].push(s.attrs.id), !0;
|
|
253
|
+
}), { byId: o, childrenByParent: t };
|
|
251
254
|
}
|
|
252
255
|
function St(n, e) {
|
|
253
|
-
const
|
|
256
|
+
const o = /* @__PURE__ */ new Set();
|
|
254
257
|
if (!n || !e)
|
|
255
|
-
return
|
|
256
|
-
const
|
|
258
|
+
return o;
|
|
259
|
+
const t = new Set(n), r = e.filter((d) => t.has(d)), s = n.filter(
|
|
257
260
|
(d) => r.includes(d)
|
|
258
261
|
);
|
|
259
262
|
if (s.length <= 1 || r.length <= 1)
|
|
260
|
-
return
|
|
263
|
+
return o;
|
|
261
264
|
const i = {};
|
|
262
265
|
for (let d = 0; d < s.length; d++)
|
|
263
266
|
i[s[d]] = d;
|
|
264
267
|
const a = r.map((d) => i[d]), c = a.length, l = [], u = [], h = new Array(c).fill(-1), g = (d, f) => {
|
|
265
268
|
let w = 0, y = d.length;
|
|
266
269
|
for (; w < y; ) {
|
|
267
|
-
const
|
|
268
|
-
d[
|
|
270
|
+
const v = w + y >>> 1;
|
|
271
|
+
d[v] < f ? w = v + 1 : y = v;
|
|
269
272
|
}
|
|
270
273
|
return w;
|
|
271
274
|
};
|
|
@@ -278,30 +281,30 @@ function St(n, e) {
|
|
|
278
281
|
for (; p !== -1; )
|
|
279
282
|
m.add(p), p = h[p];
|
|
280
283
|
for (let d = 0; d < r.length; d++)
|
|
281
|
-
m.has(d) ||
|
|
282
|
-
return
|
|
284
|
+
m.has(d) || o.add(r[d]);
|
|
285
|
+
return o;
|
|
283
286
|
}
|
|
284
287
|
function xt(n, e = []) {
|
|
285
|
-
const
|
|
288
|
+
const o = vt(n), t = Te(n.before, [
|
|
286
289
|
n,
|
|
287
290
|
...e
|
|
288
291
|
]), r = ee(
|
|
289
|
-
|
|
292
|
+
t.before
|
|
290
293
|
), s = ee(
|
|
291
|
-
|
|
294
|
+
t.doc
|
|
292
295
|
), i = [], a = /* @__PURE__ */ new Set();
|
|
293
296
|
Object.keys(s.byId).filter((m) => !(m in r.byId)).forEach((m) => {
|
|
294
297
|
i.push({
|
|
295
298
|
type: "insert",
|
|
296
299
|
block: s.byId[m].block,
|
|
297
|
-
source:
|
|
300
|
+
source: o,
|
|
298
301
|
prevBlock: void 0
|
|
299
302
|
}), a.add(m);
|
|
300
303
|
}), Object.keys(r.byId).filter((m) => !(m in s.byId)).forEach((m) => {
|
|
301
304
|
i.push({
|
|
302
305
|
type: "delete",
|
|
303
306
|
block: r.byId[m].block,
|
|
304
|
-
source:
|
|
307
|
+
source: o,
|
|
305
308
|
prevBlock: void 0
|
|
306
309
|
}), a.add(m);
|
|
307
310
|
}), Object.keys(s.byId).filter((m) => m in r.byId).forEach((m) => {
|
|
@@ -311,17 +314,17 @@ function xt(n, e = []) {
|
|
|
311
314
|
type: "move",
|
|
312
315
|
block: d.block,
|
|
313
316
|
prevBlock: p.block,
|
|
314
|
-
source:
|
|
317
|
+
source: o,
|
|
315
318
|
prevParent: p.parentId ? (w = r.byId[p.parentId]) == null ? void 0 : w.block : void 0,
|
|
316
319
|
currentParent: d.parentId ? (y = s.byId[d.parentId]) == null ? void 0 : y.block : void 0
|
|
317
|
-
}), a.add(m)) :
|
|
320
|
+
}), a.add(m)) : Oe(
|
|
318
321
|
{ ...p.block, children: void 0 },
|
|
319
322
|
{ ...d.block, children: void 0 }
|
|
320
323
|
) || (i.push({
|
|
321
324
|
type: "update",
|
|
322
325
|
block: d.block,
|
|
323
326
|
prevBlock: p.block,
|
|
324
|
-
source:
|
|
327
|
+
source: o
|
|
325
328
|
}), a.add(m));
|
|
326
329
|
});
|
|
327
330
|
const c = r.childrenByParent, l = s.childrenByParent, u = "__root__", h = /* @__PURE__ */ new Set([
|
|
@@ -334,20 +337,20 @@ function xt(n, e = []) {
|
|
|
334
337
|
l[m]
|
|
335
338
|
);
|
|
336
339
|
p.size !== 0 && p.forEach((d) => {
|
|
337
|
-
var
|
|
340
|
+
var v, D;
|
|
338
341
|
const f = r.byId[d], w = s.byId[d];
|
|
339
342
|
!f || !w || f.parentId !== w.parentId || a.has(d) || (f.parentId ?? u) !== m || g.has(d) || (g.add(d), i.push({
|
|
340
343
|
type: "move",
|
|
341
344
|
block: w.block,
|
|
342
345
|
prevBlock: f.block,
|
|
343
|
-
source:
|
|
344
|
-
prevParent: f.parentId ? (
|
|
345
|
-
currentParent: w.parentId ? (
|
|
346
|
+
source: o,
|
|
347
|
+
prevParent: f.parentId ? (v = r.byId[f.parentId]) == null ? void 0 : v.block : void 0,
|
|
348
|
+
currentParent: w.parentId ? (D = s.byId[w.parentId]) == null ? void 0 : D.block : void 0
|
|
346
349
|
}), a.add(d));
|
|
347
350
|
});
|
|
348
351
|
}), i;
|
|
349
352
|
}
|
|
350
|
-
const fo =
|
|
353
|
+
const fo = C(() => {
|
|
351
354
|
const n = [];
|
|
352
355
|
return {
|
|
353
356
|
key: "blockChange",
|
|
@@ -355,10 +358,10 @@ const fo = k(() => {
|
|
|
355
358
|
new T({
|
|
356
359
|
key: new P("blockChange"),
|
|
357
360
|
filterTransaction: (e) => {
|
|
358
|
-
let
|
|
359
|
-
return n.reduce((
|
|
361
|
+
let o;
|
|
362
|
+
return n.reduce((t, r) => t === !1 ? t : r({
|
|
360
363
|
getChanges() {
|
|
361
|
-
return
|
|
364
|
+
return o || (o = xt(e), o);
|
|
362
365
|
},
|
|
363
366
|
tr: e
|
|
364
367
|
}) !== !1, !0);
|
|
@@ -379,32 +382,32 @@ const fo = k(() => {
|
|
|
379
382
|
};
|
|
380
383
|
});
|
|
381
384
|
function te(n) {
|
|
382
|
-
const e = n.charAt(0) === "#" ? n.substring(1, 7) : n,
|
|
385
|
+
const e = n.charAt(0) === "#" ? n.substring(1, 7) : n, o = parseInt(e.substring(0, 2), 16), t = parseInt(e.substring(2, 4), 16), r = parseInt(e.substring(4, 6), 16), i = [o / 255, t / 255, r / 255].map((c) => c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4));
|
|
383
386
|
return 0.2126 * i[0] + 0.7152 * i[1] + 0.0722 * i[2] <= 0.179;
|
|
384
387
|
}
|
|
385
388
|
function Et(n) {
|
|
386
389
|
const e = document.createElement("span");
|
|
387
390
|
e.classList.add("bn-collaboration-cursor__base");
|
|
388
|
-
const
|
|
389
|
-
|
|
391
|
+
const o = document.createElement("span");
|
|
392
|
+
o.setAttribute("contentedEditable", "false"), o.classList.add("bn-collaboration-cursor__caret"), o.setAttribute(
|
|
390
393
|
"style",
|
|
391
394
|
`background-color: ${n.color}; color: ${te(n.color) ? "white" : "black"}`
|
|
392
395
|
);
|
|
393
|
-
const
|
|
394
|
-
return
|
|
396
|
+
const t = document.createElement("span");
|
|
397
|
+
return t.classList.add("bn-collaboration-cursor__label"), t.setAttribute(
|
|
395
398
|
"style",
|
|
396
399
|
`background-color: ${n.color}; color: ${te(n.color) ? "white" : "black"}`
|
|
397
|
-
),
|
|
400
|
+
), t.insertBefore(document.createTextNode(n.name), null), o.insertBefore(t, null), e.insertBefore(document.createTextNode(""), null), e.insertBefore(o, null), e.insertBefore(document.createTextNode(""), null), e;
|
|
398
401
|
}
|
|
399
|
-
const oe =
|
|
402
|
+
const oe = C(
|
|
400
403
|
({ options: n }) => {
|
|
401
|
-
const e = /* @__PURE__ */ new Map(),
|
|
402
|
-
return
|
|
404
|
+
const e = /* @__PURE__ */ new Map(), o = n.provider && "awareness" in n.provider && typeof n.provider.awareness == "object" ? n.provider.awareness : void 0;
|
|
405
|
+
return o && ("setLocalStateField" in o && typeof o.setLocalStateField == "function" && o.setLocalStateField("user", n.user), "on" in o && typeof o.on == "function" && n.showCursorLabels !== "always" && o.on(
|
|
403
406
|
"change",
|
|
404
407
|
({
|
|
405
|
-
updated:
|
|
408
|
+
updated: t
|
|
406
409
|
}) => {
|
|
407
|
-
for (const r of
|
|
410
|
+
for (const r of t) {
|
|
408
411
|
const s = e.get(r);
|
|
409
412
|
s && (s.element.setAttribute("data-active", ""), s.hideTimeout && clearTimeout(s.hideTimeout), e.set(r, {
|
|
410
413
|
element: s.element,
|
|
@@ -417,12 +420,12 @@ const oe = k(
|
|
|
417
420
|
)), {
|
|
418
421
|
key: "yCursor",
|
|
419
422
|
prosemirrorPlugins: [
|
|
420
|
-
|
|
423
|
+
o ? _e(o, {
|
|
421
424
|
selectionBuilder: ze,
|
|
422
|
-
cursorBuilder(
|
|
425
|
+
cursorBuilder(t, r) {
|
|
423
426
|
let s = e.get(r);
|
|
424
427
|
if (!s) {
|
|
425
|
-
const i = (n.renderCursor ?? Et)(
|
|
428
|
+
const i = (n.renderCursor ?? Et)(t);
|
|
426
429
|
n.showCursorLabels !== "always" && (i.addEventListener("mouseenter", () => {
|
|
427
430
|
const a = e.get(r);
|
|
428
431
|
a.element.setAttribute("data-active", ""), a.hideTimeout && (clearTimeout(a.hideTimeout), e.set(r, {
|
|
@@ -447,18 +450,18 @@ const oe = k(
|
|
|
447
450
|
}) : void 0
|
|
448
451
|
].filter(Boolean),
|
|
449
452
|
dependsOn: ["ySync"],
|
|
450
|
-
updateUser(
|
|
451
|
-
|
|
453
|
+
updateUser(t) {
|
|
454
|
+
o == null || o.setLocalStateField("user", t);
|
|
452
455
|
}
|
|
453
456
|
};
|
|
454
457
|
}
|
|
455
|
-
), F =
|
|
458
|
+
), F = C(
|
|
456
459
|
({ options: n }) => ({
|
|
457
460
|
key: "ySync",
|
|
458
461
|
prosemirrorPlugins: [Ke(n.fragment)],
|
|
459
462
|
runsBefore: ["default"]
|
|
460
463
|
})
|
|
461
|
-
), $ =
|
|
464
|
+
), $ = C(() => ({
|
|
462
465
|
key: "yUndo",
|
|
463
466
|
prosemirrorPlugins: [je()],
|
|
464
467
|
dependsOn: ["yCursor", "ySync"],
|
|
@@ -466,33 +469,33 @@ const oe = k(
|
|
|
466
469
|
redoCommand: Ye
|
|
467
470
|
}));
|
|
468
471
|
function It(n, e) {
|
|
469
|
-
const
|
|
472
|
+
const o = n.doc;
|
|
470
473
|
if (n._item === null) {
|
|
471
|
-
const
|
|
472
|
-
(r) =>
|
|
474
|
+
const t = Array.from(o.share.keys()).find(
|
|
475
|
+
(r) => o.share.get(r) === n
|
|
473
476
|
);
|
|
474
|
-
if (
|
|
477
|
+
if (t == null)
|
|
475
478
|
throw new Error("type does not exist in other ydoc");
|
|
476
|
-
return e.get(
|
|
479
|
+
return e.get(t, n.constructor);
|
|
477
480
|
} else {
|
|
478
|
-
const
|
|
481
|
+
const t = n._item, r = e.store.clients.get(t.id.client) ?? [], s = I.findIndexSS(r, t.id.clock);
|
|
479
482
|
return r[s].content.type;
|
|
480
483
|
}
|
|
481
484
|
}
|
|
482
|
-
const go =
|
|
485
|
+
const go = C(
|
|
483
486
|
({ editor: n, options: e }) => {
|
|
484
|
-
let
|
|
485
|
-
const
|
|
487
|
+
let o;
|
|
488
|
+
const t = H({ isForked: !1 });
|
|
486
489
|
return {
|
|
487
490
|
key: "yForkDoc",
|
|
488
|
-
store:
|
|
491
|
+
store: t,
|
|
489
492
|
/**
|
|
490
493
|
* Fork the Y.js document from syncing to the remote,
|
|
491
494
|
* allowing modifications to the document without affecting the remote.
|
|
492
495
|
* These changes can later be rolled back or applied to the remote.
|
|
493
496
|
*/
|
|
494
497
|
fork() {
|
|
495
|
-
if (
|
|
498
|
+
if (o)
|
|
496
499
|
return;
|
|
497
500
|
const r = e.fragment;
|
|
498
501
|
if (!r)
|
|
@@ -500,7 +503,7 @@ const go = k(
|
|
|
500
503
|
const s = new I.Doc();
|
|
501
504
|
I.applyUpdate(s, I.encodeStateAsUpdate(r.doc));
|
|
502
505
|
const i = It(r, s);
|
|
503
|
-
|
|
506
|
+
o = {
|
|
504
507
|
undoStack: Z.getState(n.prosemirrorState).undoManager.undoStack,
|
|
505
508
|
originalFragment: r,
|
|
506
509
|
forkedFragment: i
|
|
@@ -517,7 +520,7 @@ const go = k(
|
|
|
517
520
|
F(a),
|
|
518
521
|
// No need to register the cursor plugin again, it's a local fork
|
|
519
522
|
$()
|
|
520
|
-
]),
|
|
523
|
+
]), t.setState({ isForked: !0 });
|
|
521
524
|
},
|
|
522
525
|
/**
|
|
523
526
|
* Resume syncing the Y.js document to the remote
|
|
@@ -525,10 +528,10 @@ const go = k(
|
|
|
525
528
|
* Otherwise, the original document will be restored and the changes will be discarded.
|
|
526
529
|
*/
|
|
527
530
|
merge({ keepChanges: r }) {
|
|
528
|
-
if (!
|
|
531
|
+
if (!o)
|
|
529
532
|
return;
|
|
530
533
|
n.unregisterExtension(["ySync", "yCursor", "yUndo"]);
|
|
531
|
-
const { originalFragment: s, forkedFragment: i, undoStack: a } =
|
|
534
|
+
const { originalFragment: s, forkedFragment: i, undoStack: a } = o;
|
|
532
535
|
if (n.registerExtension([
|
|
533
536
|
F(e),
|
|
534
537
|
oe(e),
|
|
@@ -542,28 +545,28 @@ const go = k(
|
|
|
542
545
|
);
|
|
543
546
|
I.applyUpdate(s.doc, c, n);
|
|
544
547
|
}
|
|
545
|
-
|
|
548
|
+
o = void 0, t.setState({ isForked: !1 });
|
|
546
549
|
}
|
|
547
550
|
};
|
|
548
551
|
}
|
|
549
|
-
),
|
|
550
|
-
e(n), n.forEach((
|
|
551
|
-
|
|
552
|
+
), ve = (n, e) => {
|
|
553
|
+
e(n), n.forEach((o) => {
|
|
554
|
+
o instanceof I.XmlElement && ve(o, e);
|
|
552
555
|
});
|
|
553
556
|
}, Bt = (n, e) => {
|
|
554
|
-
const
|
|
555
|
-
return n.forEach((
|
|
556
|
-
|
|
557
|
+
const o = /* @__PURE__ */ new Map();
|
|
558
|
+
return n.forEach((t) => {
|
|
559
|
+
t instanceof I.XmlElement && ve(t, (r) => {
|
|
557
560
|
if (r.nodeName === "blockContainer" && r.hasAttribute("id")) {
|
|
558
561
|
const s = r.getAttribute("textColor"), i = r.getAttribute("backgroundColor"), a = {
|
|
559
562
|
textColor: s === J.textColor.default ? void 0 : s,
|
|
560
563
|
backgroundColor: i === J.backgroundColor.default ? void 0 : i
|
|
561
564
|
};
|
|
562
|
-
(a.textColor || a.backgroundColor) &&
|
|
565
|
+
(a.textColor || a.backgroundColor) && o.set(r.getAttribute("id"), a);
|
|
563
566
|
}
|
|
564
567
|
});
|
|
565
|
-
}),
|
|
566
|
-
if (
|
|
568
|
+
}), o.size === 0 ? !1 : (e.doc.descendants((t, r) => {
|
|
569
|
+
if (t.type.name === "blockContainer" && o.has(t.attrs.id)) {
|
|
567
570
|
const s = e.doc.nodeAt(r + 1);
|
|
568
571
|
if (!s)
|
|
569
572
|
throw new Error("No element found");
|
|
@@ -571,23 +574,23 @@ const go = k(
|
|
|
571
574
|
// preserve existing attributes
|
|
572
575
|
...s.attrs,
|
|
573
576
|
// add the textColor and backgroundColor attributes
|
|
574
|
-
...
|
|
577
|
+
...o.get(t.attrs.id)
|
|
575
578
|
});
|
|
576
579
|
}
|
|
577
580
|
}), !0);
|
|
578
|
-
}, Tt = [Bt], wo =
|
|
581
|
+
}, Tt = [Bt], wo = C(
|
|
579
582
|
({ options: n }) => {
|
|
580
583
|
let e = !1;
|
|
581
|
-
const
|
|
584
|
+
const o = new pe("schemaMigration");
|
|
582
585
|
return {
|
|
583
586
|
key: "schemaMigration",
|
|
584
587
|
prosemirrorPlugins: [
|
|
585
588
|
new fe({
|
|
586
|
-
key:
|
|
587
|
-
appendTransaction: (
|
|
589
|
+
key: o,
|
|
590
|
+
appendTransaction: (t, r, s) => {
|
|
588
591
|
if (e || // If any of the transactions are not due to a yjs sync, we don't need to run the migration
|
|
589
|
-
!
|
|
590
|
-
|
|
592
|
+
!t.some((a) => a.getMeta("y-sync$")) || // If none of the transactions result in a document change, we don't need to run the migration
|
|
593
|
+
t.every((a) => !a.docChanged) || // If the fragment is still empty, we can't run the migration (since it has not yet been applied to the Y.Doc)
|
|
591
594
|
!n.fragment.firstChild)
|
|
592
595
|
return;
|
|
593
596
|
const i = s.tr;
|
|
@@ -600,7 +603,7 @@ const go = k(
|
|
|
600
603
|
]
|
|
601
604
|
};
|
|
602
605
|
}
|
|
603
|
-
), yo =
|
|
606
|
+
), yo = C(
|
|
604
607
|
({
|
|
605
608
|
editor: n,
|
|
606
609
|
options: e
|
|
@@ -614,25 +617,25 @@ const go = k(
|
|
|
614
617
|
})
|
|
615
618
|
]
|
|
616
619
|
})
|
|
617
|
-
), bo =
|
|
618
|
-
const e = H(!1),
|
|
620
|
+
), bo = C(({ editor: n }) => {
|
|
621
|
+
const e = H(!1), o = () => n.transact((t) => {
|
|
619
622
|
var s;
|
|
620
|
-
if (
|
|
623
|
+
if (t.selection.empty || t.selection instanceof le && (t.selection.node.type.spec.content === "inline*" || ((s = t.selection.node.firstChild) == null ? void 0 : s.type.spec.content) === "inline*") || t.selection instanceof ce && t.doc.textBetween(t.selection.from, t.selection.to).length === 0)
|
|
621
624
|
return !1;
|
|
622
625
|
let r = !1;
|
|
623
|
-
return
|
|
626
|
+
return t.selection.content().content.descendants((i) => (i.type.spec.code && (r = !0), !r)), !r;
|
|
624
627
|
});
|
|
625
628
|
return {
|
|
626
629
|
key: "formattingToolbar",
|
|
627
630
|
store: e,
|
|
628
|
-
mount({ dom:
|
|
631
|
+
mount({ dom: t, signal: r }) {
|
|
629
632
|
let s = !1;
|
|
630
633
|
const i = n.onChange(() => {
|
|
631
|
-
s || e.setState(
|
|
634
|
+
s || e.setState(o());
|
|
632
635
|
}), a = n.onSelectionChange(() => {
|
|
633
|
-
s || e.setState(
|
|
636
|
+
s || e.setState(o());
|
|
634
637
|
});
|
|
635
|
-
|
|
638
|
+
t.addEventListener(
|
|
636
639
|
"pointerdown",
|
|
637
640
|
() => {
|
|
638
641
|
s = !0, e.setState(!1);
|
|
@@ -641,10 +644,10 @@ const go = k(
|
|
|
641
644
|
), n.prosemirrorView.root.addEventListener(
|
|
642
645
|
"pointerup",
|
|
643
646
|
() => {
|
|
644
|
-
s = !1, n.isFocused() && e.setState(
|
|
647
|
+
s = !1, n.isFocused() && e.setState(o());
|
|
645
648
|
},
|
|
646
649
|
{ signal: r, capture: !0 }
|
|
647
|
-
),
|
|
650
|
+
), t.addEventListener(
|
|
648
651
|
"pointercancel",
|
|
649
652
|
() => {
|
|
650
653
|
s = !1;
|
|
@@ -658,12 +661,12 @@ const go = k(
|
|
|
658
661
|
});
|
|
659
662
|
}
|
|
660
663
|
};
|
|
661
|
-
}),
|
|
664
|
+
}), ko = C(() => ({
|
|
662
665
|
key: "history",
|
|
663
666
|
prosemirrorPlugins: [Qe()],
|
|
664
667
|
undoCommand: Je,
|
|
665
668
|
redoCommand: Ge
|
|
666
|
-
})),
|
|
669
|
+
})), Co = C(({ editor: n }) => {
|
|
667
670
|
function e(r) {
|
|
668
671
|
let s = n.prosemirrorView.nodeDOM(r);
|
|
669
672
|
for (; s && s.parentElement; ) {
|
|
@@ -673,7 +676,7 @@ const go = k(
|
|
|
673
676
|
}
|
|
674
677
|
return null;
|
|
675
678
|
}
|
|
676
|
-
function
|
|
679
|
+
function o(r, s) {
|
|
677
680
|
return n.transact((i) => {
|
|
678
681
|
const a = i.doc.resolve(r), c = a.marks().find((u) => u.type.name === s);
|
|
679
682
|
if (!c)
|
|
@@ -687,7 +690,7 @@ const go = k(
|
|
|
687
690
|
return i.doc.textBetween(l.from, l.to);
|
|
688
691
|
},
|
|
689
692
|
get position() {
|
|
690
|
-
return
|
|
693
|
+
return De(
|
|
691
694
|
n.prosemirrorView,
|
|
692
695
|
l.from,
|
|
693
696
|
l.to
|
|
@@ -696,27 +699,27 @@ const go = k(
|
|
|
696
699
|
};
|
|
697
700
|
});
|
|
698
701
|
}
|
|
699
|
-
function
|
|
702
|
+
function t() {
|
|
700
703
|
return n.transact((r) => {
|
|
701
704
|
const s = r.selection;
|
|
702
705
|
if (s.empty)
|
|
703
|
-
return
|
|
706
|
+
return o(s.anchor, "link");
|
|
704
707
|
});
|
|
705
708
|
}
|
|
706
709
|
return {
|
|
707
710
|
key: "linkToolbar",
|
|
708
|
-
getLinkAtSelection:
|
|
711
|
+
getLinkAtSelection: t,
|
|
709
712
|
getLinkElementAtPos: e,
|
|
710
|
-
getMarkAtPos:
|
|
713
|
+
getMarkAtPos: o,
|
|
711
714
|
getLinkAtElement(r) {
|
|
712
715
|
return n.transact(() => {
|
|
713
716
|
const s = n.prosemirrorView.posAtDOM(r, 0) + 1;
|
|
714
|
-
return
|
|
717
|
+
return o(s, "link");
|
|
715
718
|
});
|
|
716
719
|
},
|
|
717
720
|
editLink(r, s, i = n.transact((a) => a.selection.anchor)) {
|
|
718
721
|
n.transact((a) => {
|
|
719
|
-
const c = R(a), { range: l } =
|
|
722
|
+
const c = R(a), { range: l } = o(i + 1, "link") || {
|
|
720
723
|
range: {
|
|
721
724
|
from: a.selection.from,
|
|
722
725
|
to: a.selection.to
|
|
@@ -731,7 +734,7 @@ const go = k(
|
|
|
731
734
|
},
|
|
732
735
|
deleteLink(r = n.transact((s) => s.selection.anchor)) {
|
|
733
736
|
n.transact((s) => {
|
|
734
|
-
const i = R(s), { range: a } =
|
|
737
|
+
const i = R(s), { range: a } = o(r + 1, "link") || {
|
|
735
738
|
range: {
|
|
736
739
|
from: s.selection.from,
|
|
737
740
|
to: s.selection.to
|
|
@@ -744,7 +747,7 @@ const go = k(
|
|
|
744
747
|
}), n.prosemirrorView.focus();
|
|
745
748
|
}
|
|
746
749
|
};
|
|
747
|
-
}),
|
|
750
|
+
}), vo = [
|
|
748
751
|
"http",
|
|
749
752
|
"https",
|
|
750
753
|
"ftp",
|
|
@@ -755,7 +758,7 @@ const go = k(
|
|
|
755
758
|
"sms",
|
|
756
759
|
"cid",
|
|
757
760
|
"xmpp"
|
|
758
|
-
], So = "https", Pt = new P("node-selection-keyboard"), xo =
|
|
761
|
+
], So = "https", Pt = new P("node-selection-keyboard"), xo = C(
|
|
759
762
|
() => ({
|
|
760
763
|
key: "nodeSelectionKeyboard",
|
|
761
764
|
prosemirrorPlugins: [
|
|
@@ -768,15 +771,15 @@ const go = k(
|
|
|
768
771
|
return !1;
|
|
769
772
|
if (e.key.length === 1)
|
|
770
773
|
return e.preventDefault(), !0;
|
|
771
|
-
if (e.key === "Enter" && !e.shiftKey && !e.altKey && !e.ctrlKey && !e.metaKey) {
|
|
772
|
-
const
|
|
774
|
+
if (e.key === "Enter" && !e.isComposing && !e.shiftKey && !e.altKey && !e.ctrlKey && !e.metaKey) {
|
|
775
|
+
const o = n.state.tr;
|
|
773
776
|
return n.dispatch(
|
|
774
|
-
|
|
777
|
+
o.insert(
|
|
775
778
|
n.state.tr.selection.$to.after(),
|
|
776
779
|
n.state.schema.nodes.paragraph.createChecked()
|
|
777
780
|
).setSelection(
|
|
778
781
|
new ce(
|
|
779
|
-
|
|
782
|
+
o.doc.resolve(
|
|
780
783
|
n.state.tr.selection.$to.after() + 1
|
|
781
784
|
)
|
|
782
785
|
)
|
|
@@ -790,29 +793,29 @@ const go = k(
|
|
|
790
793
|
})
|
|
791
794
|
]
|
|
792
795
|
})
|
|
793
|
-
),
|
|
796
|
+
), Dt = new P("blocknote-placeholder"), Eo = C(
|
|
794
797
|
({
|
|
795
798
|
editor: n,
|
|
796
799
|
options: e
|
|
797
800
|
}) => {
|
|
798
|
-
const
|
|
801
|
+
const o = e.placeholders;
|
|
799
802
|
return {
|
|
800
803
|
key: "placeholder",
|
|
801
804
|
prosemirrorPlugins: [
|
|
802
805
|
new T({
|
|
803
|
-
key:
|
|
804
|
-
view: (
|
|
806
|
+
key: Dt,
|
|
807
|
+
view: (t) => {
|
|
805
808
|
const r = `placeholder-selector-${Ze()}`;
|
|
806
|
-
|
|
809
|
+
t.dom.classList.add(r);
|
|
807
810
|
const s = document.createElement("style"), i = n._tiptapEditor.options.injectNonce;
|
|
808
|
-
i && s.setAttribute("nonce", i),
|
|
811
|
+
i && s.setAttribute("nonce", i), t.root instanceof window.ShadowRoot ? t.root.append(s) : t.root.head.appendChild(s);
|
|
809
812
|
const a = s.sheet, c = (l = "") => `.${r} .bn-block-content${l} .bn-inline-content:has(> .ProseMirror-trailingBreak:only-child):before`;
|
|
810
813
|
try {
|
|
811
814
|
const {
|
|
812
815
|
default: l,
|
|
813
816
|
emptyDocument: u,
|
|
814
817
|
...h
|
|
815
|
-
} =
|
|
818
|
+
} = o || {};
|
|
816
819
|
for (const [p, d] of Object.entries(h)) {
|
|
817
820
|
const f = `[data-content-type="${p}"]`;
|
|
818
821
|
a.insertRule(
|
|
@@ -839,17 +842,17 @@ const go = k(
|
|
|
839
842
|
}
|
|
840
843
|
return {
|
|
841
844
|
destroy: () => {
|
|
842
|
-
|
|
845
|
+
t.root instanceof window.ShadowRoot ? t.root.removeChild(s) : t.root.head.removeChild(s);
|
|
843
846
|
}
|
|
844
847
|
};
|
|
845
848
|
},
|
|
846
849
|
props: {
|
|
847
|
-
decorations: (
|
|
848
|
-
const { doc: r, selection: s } =
|
|
850
|
+
decorations: (t) => {
|
|
851
|
+
const { doc: r, selection: s } = t;
|
|
849
852
|
if (!n.isEditable || !s.empty || s.$from.parent.type.spec.code)
|
|
850
853
|
return;
|
|
851
854
|
const i = [];
|
|
852
|
-
|
|
855
|
+
t.doc.content.size === 6 && i.push(
|
|
853
856
|
A.node(2, 4, {
|
|
854
857
|
"data-is-only-empty-block": "true"
|
|
855
858
|
})
|
|
@@ -870,7 +873,7 @@ const go = k(
|
|
|
870
873
|
]
|
|
871
874
|
};
|
|
872
875
|
}
|
|
873
|
-
), ne = new P("previous-blocks"),
|
|
876
|
+
), ne = new P("previous-blocks"), Ot = {
|
|
874
877
|
// Numbered List Items
|
|
875
878
|
index: "index",
|
|
876
879
|
// Headings
|
|
@@ -879,7 +882,7 @@ const go = k(
|
|
|
879
882
|
type: "type",
|
|
880
883
|
depth: "depth",
|
|
881
884
|
"depth-change": "depth-change"
|
|
882
|
-
}, Io =
|
|
885
|
+
}, Io = C(() => {
|
|
883
886
|
let n;
|
|
884
887
|
return {
|
|
885
888
|
key: "previousBlockType",
|
|
@@ -888,11 +891,11 @@ const go = k(
|
|
|
888
891
|
key: ne,
|
|
889
892
|
view(e) {
|
|
890
893
|
return {
|
|
891
|
-
update: async (
|
|
894
|
+
update: async (o, t) => {
|
|
892
895
|
var r;
|
|
893
|
-
((r = this.key) == null ? void 0 : r.getState(
|
|
894
|
-
|
|
895
|
-
|
|
896
|
+
((r = this.key) == null ? void 0 : r.getState(o.state).updatedBlocks.size) > 0 && (n = setTimeout(() => {
|
|
897
|
+
o.dispatch(
|
|
898
|
+
o.state.tr.setMeta(ne, { clearUpdate: !0 })
|
|
896
899
|
);
|
|
897
900
|
}, 0));
|
|
898
901
|
},
|
|
@@ -912,11 +915,11 @@ const go = k(
|
|
|
912
915
|
updatedBlocks: /* @__PURE__ */ new Set()
|
|
913
916
|
};
|
|
914
917
|
},
|
|
915
|
-
apply(e,
|
|
916
|
-
if (
|
|
917
|
-
return
|
|
918
|
+
apply(e, o, t, r) {
|
|
919
|
+
if (o.currentTransactionOldBlockAttrs = {}, o.updatedBlocks.clear(), !e.docChanged || t.doc.eq(r.doc))
|
|
920
|
+
return o;
|
|
918
921
|
const s = {}, i = j(
|
|
919
|
-
|
|
922
|
+
t.doc,
|
|
920
923
|
(l) => l.attrs.id
|
|
921
924
|
), a = new Map(
|
|
922
925
|
i.map((l) => [l.node.attrs.id, l])
|
|
@@ -936,31 +939,31 @@ const go = k(
|
|
|
936
939
|
index: h.attrs.index,
|
|
937
940
|
level: h.attrs.level,
|
|
938
941
|
type: h.type.name,
|
|
939
|
-
depth:
|
|
942
|
+
depth: t.doc.resolve(u.pos).depth
|
|
940
943
|
};
|
|
941
|
-
s[l.node.attrs.id] = p,
|
|
944
|
+
s[l.node.attrs.id] = p, o.currentTransactionOldBlockAttrs[l.node.attrs.id] = p, JSON.stringify(p) !== JSON.stringify(m) && (p["depth-change"] = p.depth - m.depth, o.updatedBlocks.add(l.node.attrs.id));
|
|
942
945
|
}
|
|
943
946
|
}
|
|
944
|
-
return
|
|
947
|
+
return o.prevTransactionOldBlockAttrs = s, o;
|
|
945
948
|
}
|
|
946
949
|
},
|
|
947
950
|
props: {
|
|
948
951
|
decorations(e) {
|
|
949
|
-
const
|
|
950
|
-
if (
|
|
952
|
+
const o = this.getState(e);
|
|
953
|
+
if (o.updatedBlocks.size === 0)
|
|
951
954
|
return;
|
|
952
|
-
const
|
|
955
|
+
const t = [];
|
|
953
956
|
return e.doc.descendants((r, s) => {
|
|
954
|
-
if (!r.attrs.id || !
|
|
957
|
+
if (!r.attrs.id || !o.updatedBlocks.has(r.attrs.id))
|
|
955
958
|
return;
|
|
956
|
-
const i =
|
|
959
|
+
const i = o.currentTransactionOldBlockAttrs[r.attrs.id], a = {};
|
|
957
960
|
for (const [l, u] of Object.entries(i))
|
|
958
|
-
a["data-prev-" +
|
|
961
|
+
a["data-prev-" + Ot[l]] = u || "none";
|
|
959
962
|
const c = A.node(s, s + r.nodeSize, {
|
|
960
963
|
...a
|
|
961
964
|
});
|
|
962
|
-
|
|
963
|
-
}), V.create(e.doc,
|
|
965
|
+
t.push(c);
|
|
966
|
+
}), V.create(e.doc, t);
|
|
964
967
|
}
|
|
965
968
|
}
|
|
966
969
|
})
|
|
@@ -968,35 +971,35 @@ const go = k(
|
|
|
968
971
|
};
|
|
969
972
|
});
|
|
970
973
|
function Se(n, e) {
|
|
971
|
-
var
|
|
972
|
-
for (; n && n.parentElement && n.parentElement !== e.dom && ((
|
|
974
|
+
var o, t;
|
|
975
|
+
for (; n && n.parentElement && n.parentElement !== e.dom && ((o = n.getAttribute) == null ? void 0 : o.call(n, "data-node-type")) !== "blockContainer"; )
|
|
973
976
|
n = n.parentElement;
|
|
974
|
-
if (((
|
|
977
|
+
if (((t = n.getAttribute) == null ? void 0 : t.call(n, "data-node-type")) === "blockContainer")
|
|
975
978
|
return { node: n, id: n.getAttribute("data-id") };
|
|
976
979
|
}
|
|
977
980
|
function At() {
|
|
978
981
|
const n = (e) => {
|
|
979
|
-
let
|
|
980
|
-
for (let
|
|
981
|
-
const r = e.children[
|
|
982
|
+
let o = e.children.length;
|
|
983
|
+
for (let t = 0; t < o; t++) {
|
|
984
|
+
const r = e.children[t];
|
|
982
985
|
if (r.type === "element" && (n(r), r.tagName === "u"))
|
|
983
986
|
if (r.children.length > 0) {
|
|
984
|
-
e.children.splice(
|
|
987
|
+
e.children.splice(t, 1, ...r.children);
|
|
985
988
|
const s = r.children.length - 1;
|
|
986
|
-
|
|
989
|
+
o += s, t += s;
|
|
987
990
|
} else
|
|
988
|
-
e.children.splice(
|
|
991
|
+
e.children.splice(t, 1), o--, t--;
|
|
989
992
|
}
|
|
990
993
|
};
|
|
991
994
|
return n;
|
|
992
995
|
}
|
|
993
996
|
function Mt() {
|
|
994
997
|
const n = (e) => {
|
|
995
|
-
var
|
|
998
|
+
var o;
|
|
996
999
|
if (e.children && "length" in e.children && e.children.length)
|
|
997
|
-
for (let
|
|
998
|
-
const r = e.children[
|
|
999
|
-
r.type === "element" && r.tagName === "input" && ((
|
|
1000
|
+
for (let t = e.children.length - 1; t >= 0; t--) {
|
|
1001
|
+
const r = e.children[t], s = t + 1 < e.children.length ? e.children[t + 1] : void 0;
|
|
1002
|
+
r.type === "element" && r.tagName === "input" && ((o = r.properties) == null ? void 0 : o.type) === "checkbox" && (s == null ? void 0 : s.type) === "element" && s.tagName === "p" ? (s.tagName = "span", s.children.splice(
|
|
1000
1003
|
0,
|
|
1001
1004
|
0,
|
|
1002
1005
|
lt(document.createTextNode(" "))
|
|
@@ -1007,11 +1010,11 @@ function Mt() {
|
|
|
1007
1010
|
}
|
|
1008
1011
|
function Nt() {
|
|
1009
1012
|
return (n) => {
|
|
1010
|
-
ct(n, "element", (e,
|
|
1013
|
+
ct(n, "element", (e, o, t) => {
|
|
1011
1014
|
var r, s, i, a;
|
|
1012
|
-
if (
|
|
1015
|
+
if (t && e.tagName === "video") {
|
|
1013
1016
|
const c = ((r = e.properties) == null ? void 0 : r.src) || ((s = e.properties) == null ? void 0 : s["data-url"]) || "", l = ((i = e.properties) == null ? void 0 : i.title) || ((a = e.properties) == null ? void 0 : a["data-name"]) || "";
|
|
1014
|
-
|
|
1017
|
+
t.children[o] = {
|
|
1015
1018
|
type: "text",
|
|
1016
1019
|
value: ``
|
|
1017
1020
|
};
|
|
@@ -1021,52 +1024,52 @@ function Nt() {
|
|
|
1021
1024
|
}
|
|
1022
1025
|
function xe(n) {
|
|
1023
1026
|
return at().use(nt, { fragment: !0 }).use(Nt).use(At).use(Mt).use(rt).use(st).use(it, {
|
|
1024
|
-
handlers: { text: (
|
|
1027
|
+
handlers: { text: (o) => o.value }
|
|
1025
1028
|
}).processSync(n).value;
|
|
1026
1029
|
}
|
|
1027
|
-
function Bo(n, e,
|
|
1028
|
-
const s =
|
|
1030
|
+
function Bo(n, e, o, t) {
|
|
1031
|
+
const s = Ce(e, o).exportBlocks(n, t);
|
|
1029
1032
|
return xe(s);
|
|
1030
1033
|
}
|
|
1031
1034
|
function Rt(n) {
|
|
1032
1035
|
const e = [];
|
|
1033
|
-
return n.descendants((
|
|
1036
|
+
return n.descendants((o) => {
|
|
1034
1037
|
var r, s;
|
|
1035
|
-
const
|
|
1036
|
-
return
|
|
1037
|
-
e.push(L(i,
|
|
1038
|
-
}), !1) :
|
|
1038
|
+
const t = R(o);
|
|
1039
|
+
return o.type.name === "blockContainer" && ((r = o.firstChild) == null ? void 0 : r.type.name) === "blockGroup" ? !0 : o.type.name === "columnList" && o.childCount === 1 ? ((s = o.firstChild) == null || s.forEach((i) => {
|
|
1040
|
+
e.push(L(i, t));
|
|
1041
|
+
}), !1) : o.type.isInGroup("bnBlock") ? (e.push(L(o, t)), !1) : !0;
|
|
1039
1042
|
}), e;
|
|
1040
1043
|
}
|
|
1041
1044
|
class B extends N {
|
|
1042
|
-
constructor(
|
|
1043
|
-
super(
|
|
1045
|
+
constructor(o, t) {
|
|
1046
|
+
super(o, t);
|
|
1044
1047
|
b(this, "nodes");
|
|
1045
|
-
const r =
|
|
1046
|
-
this.nodes = [],
|
|
1048
|
+
const r = o.node();
|
|
1049
|
+
this.nodes = [], o.doc.nodesBetween(o.pos, t.pos, (s, i, a) => {
|
|
1047
1050
|
if (a !== null && a.eq(r))
|
|
1048
1051
|
return this.nodes.push(s), !1;
|
|
1049
1052
|
});
|
|
1050
1053
|
}
|
|
1051
|
-
static create(
|
|
1052
|
-
return new B(
|
|
1054
|
+
static create(o, t, r = t) {
|
|
1055
|
+
return new B(o.resolve(t), o.resolve(r));
|
|
1053
1056
|
}
|
|
1054
1057
|
content() {
|
|
1055
1058
|
return new ot(we.from(this.nodes), 0, 0);
|
|
1056
1059
|
}
|
|
1057
|
-
eq(
|
|
1058
|
-
if (!(
|
|
1060
|
+
eq(o) {
|
|
1061
|
+
if (!(o instanceof B) || this.nodes.length !== o.nodes.length || this.from !== o.from || this.to !== o.to)
|
|
1059
1062
|
return !1;
|
|
1060
|
-
for (let
|
|
1061
|
-
if (!this.nodes[
|
|
1063
|
+
for (let t = 0; t < this.nodes.length; t++)
|
|
1064
|
+
if (!this.nodes[t].eq(o.nodes[t]))
|
|
1062
1065
|
return !1;
|
|
1063
1066
|
return !0;
|
|
1064
1067
|
}
|
|
1065
|
-
map(
|
|
1066
|
-
const r =
|
|
1067
|
-
return s.deleted ? N.near(
|
|
1068
|
-
|
|
1069
|
-
|
|
1068
|
+
map(o, t) {
|
|
1069
|
+
const r = t.mapResult(this.from), s = t.mapResult(this.to);
|
|
1070
|
+
return s.deleted ? N.near(o.resolve(r.pos)) : r.deleted ? N.near(o.resolve(s.pos)) : new B(
|
|
1071
|
+
o.resolve(r.pos),
|
|
1072
|
+
o.resolve(s.pos)
|
|
1070
1073
|
);
|
|
1071
1074
|
}
|
|
1072
1075
|
toJSON() {
|
|
@@ -1074,32 +1077,32 @@ class B extends N {
|
|
|
1074
1077
|
}
|
|
1075
1078
|
}
|
|
1076
1079
|
N.jsonID("multiple-node", B);
|
|
1077
|
-
let
|
|
1080
|
+
let E;
|
|
1078
1081
|
function Lt(n, e) {
|
|
1079
|
-
let
|
|
1082
|
+
let o, t;
|
|
1080
1083
|
const r = e.resolve(n.from).node().type.spec.group === "blockContent", s = e.resolve(n.to).node().type.spec.group === "blockContent", i = Math.min(n.$anchor.depth, n.$head.depth);
|
|
1081
1084
|
if (r && s) {
|
|
1082
1085
|
const a = n.$from.start(i - 1), c = n.$to.end(i - 1);
|
|
1083
|
-
|
|
1086
|
+
o = e.resolve(a - 1).pos, t = e.resolve(c + 1).pos;
|
|
1084
1087
|
} else
|
|
1085
|
-
|
|
1086
|
-
return { from:
|
|
1088
|
+
o = n.from, t = n.to;
|
|
1089
|
+
return { from: o, to: t };
|
|
1087
1090
|
}
|
|
1088
|
-
function re(n, e,
|
|
1089
|
-
e ===
|
|
1090
|
-
const
|
|
1091
|
+
function re(n, e, o = e) {
|
|
1092
|
+
e === o && (o += n.state.doc.resolve(e + 1).node().nodeSize);
|
|
1093
|
+
const t = n.domAtPos(e).node.cloneNode(!0), r = n.domAtPos(e).node, s = (h, g) => Array.prototype.indexOf.call(h.children, g), i = s(
|
|
1091
1094
|
r,
|
|
1092
1095
|
// Expects from position to be just before the first selected block.
|
|
1093
1096
|
n.domAtPos(e + 1).node.parentElement
|
|
1094
1097
|
), a = s(
|
|
1095
1098
|
r,
|
|
1096
1099
|
// Expects to position to be just after the last selected block.
|
|
1097
|
-
n.domAtPos(
|
|
1100
|
+
n.domAtPos(o - 1).node.parentElement
|
|
1098
1101
|
);
|
|
1099
1102
|
for (let h = r.childElementCount - 1; h >= 0; h--)
|
|
1100
|
-
(h > a || h < i) &&
|
|
1101
|
-
Ee(n.root),
|
|
1102
|
-
const c =
|
|
1103
|
+
(h > a || h < i) && t.removeChild(t.children[h]);
|
|
1104
|
+
Ee(n.root), E = t;
|
|
1105
|
+
const c = E.getElementsByTagName("iframe");
|
|
1103
1106
|
for (let h = 0; h < c.length; h++) {
|
|
1104
1107
|
const g = c[h], m = g.parentElement;
|
|
1105
1108
|
m && m.removeChild(g);
|
|
@@ -1107,35 +1110,35 @@ function re(n, e, t = e) {
|
|
|
1107
1110
|
const u = n.dom.className.split(" ").filter(
|
|
1108
1111
|
(h) => h !== "ProseMirror" && h !== "bn-root" && h !== "bn-editor"
|
|
1109
1112
|
).join(" ");
|
|
1110
|
-
|
|
1113
|
+
E.className = E.className + " bn-drag-preview " + u, n.root instanceof ShadowRoot ? n.root.appendChild(E) : n.root.body.appendChild(E);
|
|
1111
1114
|
}
|
|
1112
1115
|
function Ee(n) {
|
|
1113
|
-
|
|
1116
|
+
E !== void 0 && (n instanceof ShadowRoot ? n.removeChild(E) : n.body.removeChild(E), E = void 0);
|
|
1114
1117
|
}
|
|
1115
|
-
function Vt(n, e,
|
|
1116
|
-
if (!n.dataTransfer ||
|
|
1118
|
+
function Vt(n, e, o) {
|
|
1119
|
+
if (!n.dataTransfer || o.headless)
|
|
1117
1120
|
return;
|
|
1118
|
-
const
|
|
1121
|
+
const t = o.prosemirrorView, r = me(e.id, t.state.doc);
|
|
1119
1122
|
if (!r)
|
|
1120
1123
|
throw new Error(`Block with ID ${e.id} not found`);
|
|
1121
1124
|
const s = r.posBeforeNode;
|
|
1122
1125
|
if (s != null) {
|
|
1123
|
-
const i =
|
|
1124
|
-
u && h ? (
|
|
1125
|
-
|
|
1126
|
-
), re(
|
|
1127
|
-
|
|
1128
|
-
), re(
|
|
1129
|
-
const g =
|
|
1130
|
-
n.dataTransfer.clearData(), n.dataTransfer.setData("blocknote/html", p), n.dataTransfer.setData("text/html", w), n.dataTransfer.setData("text/plain", y), n.dataTransfer.effectAllowed = "move", n.dataTransfer.setDragImage(
|
|
1126
|
+
const i = t.state.selection, a = t.state.doc, { from: c, to: l } = Lt(i, a), u = c <= s && s < l, h = i.$anchor.node() !== i.$head.node() || i instanceof B;
|
|
1127
|
+
u && h ? (t.dispatch(
|
|
1128
|
+
t.state.tr.setSelection(B.create(a, c, l))
|
|
1129
|
+
), re(t, c, l)) : (t.dispatch(
|
|
1130
|
+
t.state.tr.setSelection(le.create(t.state.doc, s))
|
|
1131
|
+
), re(t, s));
|
|
1132
|
+
const g = t.state.selection.content(), m = o.pmSchema, p = t.serializeForClipboard(g).dom.innerHTML, d = Ce(m, o), f = Rt(g.content), w = d.exportBlocks(f, {}), y = xe(w);
|
|
1133
|
+
n.dataTransfer.clearData(), n.dataTransfer.setData("blocknote/html", p), n.dataTransfer.setData("text/html", w), n.dataTransfer.setData("text/plain", y), n.dataTransfer.effectAllowed = "move", n.dataTransfer.setDragImage(E, 0, 0);
|
|
1131
1134
|
}
|
|
1132
1135
|
}
|
|
1133
1136
|
const se = 250;
|
|
1134
|
-
function U(n, e,
|
|
1135
|
-
const
|
|
1136
|
-
for (const r of
|
|
1137
|
+
function U(n, e, o = !0) {
|
|
1138
|
+
const t = n.root.elementsFromPoint(e.left, e.top);
|
|
1139
|
+
for (const r of t)
|
|
1137
1140
|
if (n.dom.contains(r))
|
|
1138
|
-
return
|
|
1141
|
+
return o && r.closest("[data-node-type=columnList]") ? U(
|
|
1139
1142
|
n,
|
|
1140
1143
|
{
|
|
1141
1144
|
// TODO can we do better than this?
|
|
@@ -1149,14 +1152,14 @@ function U(n, e, t = !0) {
|
|
|
1149
1152
|
function Ht(n, e) {
|
|
1150
1153
|
if (!e.dom.firstChild)
|
|
1151
1154
|
return;
|
|
1152
|
-
const
|
|
1155
|
+
const o = e.dom.firstChild.getBoundingClientRect(), t = {
|
|
1153
1156
|
// Clamps the x position to the editor's bounding box.
|
|
1154
1157
|
left: Math.min(
|
|
1155
|
-
Math.max(
|
|
1156
|
-
|
|
1158
|
+
Math.max(o.left + 10, n.x),
|
|
1159
|
+
o.right - 10
|
|
1157
1160
|
),
|
|
1158
1161
|
top: n.y
|
|
1159
|
-
}, r = U(e,
|
|
1162
|
+
}, r = U(e, t);
|
|
1160
1163
|
if (!r)
|
|
1161
1164
|
return;
|
|
1162
1165
|
const s = r.node.getBoundingClientRect();
|
|
@@ -1170,7 +1173,7 @@ function Ht(n, e) {
|
|
|
1170
1173
|
);
|
|
1171
1174
|
}
|
|
1172
1175
|
class Ft {
|
|
1173
|
-
constructor(e,
|
|
1176
|
+
constructor(e, o, t) {
|
|
1174
1177
|
b(this, "state");
|
|
1175
1178
|
b(this, "emitUpdate");
|
|
1176
1179
|
b(this, "mousePos");
|
|
@@ -1181,7 +1184,7 @@ class Ft {
|
|
|
1181
1184
|
this.state = e, this.emitUpdate(this.state);
|
|
1182
1185
|
});
|
|
1183
1186
|
b(this, "updateStateFromMousePos", () => {
|
|
1184
|
-
var
|
|
1187
|
+
var t, r, s, i, a;
|
|
1185
1188
|
if (this.menuFrozen || !this.mousePos)
|
|
1186
1189
|
return;
|
|
1187
1190
|
const e = this.findClosestEditorElement({
|
|
@@ -1189,16 +1192,16 @@ class Ft {
|
|
|
1189
1192
|
clientY: this.mousePos.y
|
|
1190
1193
|
});
|
|
1191
1194
|
if ((e == null ? void 0 : e.element) !== this.pmView.dom || e.distance > se) {
|
|
1192
|
-
(
|
|
1195
|
+
(t = this.state) != null && t.show && (this.state.show = !1, this.updateState(this.state));
|
|
1193
1196
|
return;
|
|
1194
1197
|
}
|
|
1195
|
-
const
|
|
1196
|
-
if (!
|
|
1198
|
+
const o = Ht(this.mousePos, this.pmView);
|
|
1199
|
+
if (!o || !this.editor.isEditable) {
|
|
1197
1200
|
(r = this.state) != null && r.show && (this.state.show = !1, this.updateState(this.state));
|
|
1198
1201
|
return;
|
|
1199
1202
|
}
|
|
1200
|
-
if (!((s = this.state) != null && s.show && ((i = this.hoveredBlock) != null && i.hasAttribute("data-id")) && ((a = this.hoveredBlock) == null ? void 0 : a.getAttribute("data-id")) ===
|
|
1201
|
-
const c =
|
|
1203
|
+
if (!((s = this.state) != null && s.show && ((i = this.hoveredBlock) != null && i.hasAttribute("data-id")) && ((a = this.hoveredBlock) == null ? void 0 : a.getAttribute("data-id")) === o.id) && (this.hoveredBlock = o.node, this.editor.isEditable)) {
|
|
1204
|
+
const c = o.node.getBoundingClientRect(), l = o.node.closest("[data-node-type=column]");
|
|
1202
1205
|
this.state = {
|
|
1203
1206
|
show: !0,
|
|
1204
1207
|
referencePos: new DOMRect(
|
|
@@ -1239,12 +1242,12 @@ class Ft {
|
|
|
1239
1242
|
*/
|
|
1240
1243
|
b(this, "onDragStart", (e) => {
|
|
1241
1244
|
var i;
|
|
1242
|
-
const
|
|
1243
|
-
if (!
|
|
1245
|
+
const o = (i = e.dataTransfer) == null ? void 0 : i.getData("blocknote/html");
|
|
1246
|
+
if (!o || this.pmView.dragging)
|
|
1244
1247
|
return;
|
|
1245
|
-
const
|
|
1246
|
-
|
|
1247
|
-
const s = et.fromSchema(this.pmView.state.schema).parse(
|
|
1248
|
+
const t = document.createElement("div");
|
|
1249
|
+
t.innerHTML = o;
|
|
1250
|
+
const s = et.fromSchema(this.pmView.state.schema).parse(t, {
|
|
1248
1251
|
topNode: this.pmView.state.schema.nodes.blockGroup.create()
|
|
1249
1252
|
});
|
|
1250
1253
|
this.pmView.dragging = {
|
|
@@ -1256,17 +1259,17 @@ class Ft {
|
|
|
1256
1259
|
* Finds the closest editor visually to the given coordinates
|
|
1257
1260
|
*/
|
|
1258
1261
|
b(this, "findClosestEditorElement", (e) => {
|
|
1259
|
-
const
|
|
1260
|
-
if (
|
|
1262
|
+
const o = Array.from(this.pmView.root.querySelectorAll(".bn-editor"));
|
|
1263
|
+
if (o.length === 0)
|
|
1261
1264
|
return null;
|
|
1262
|
-
let
|
|
1263
|
-
return
|
|
1265
|
+
let t = o[0], r = Number.MAX_VALUE;
|
|
1266
|
+
return o.forEach((s) => {
|
|
1264
1267
|
const i = s.querySelector(".bn-block-group").getBoundingClientRect(), a = e.clientX < i.left ? i.left - e.clientX : e.clientX > i.right ? e.clientX - i.right : 0, c = e.clientY < i.top ? i.top - e.clientY : e.clientY > i.bottom ? e.clientY - i.bottom : 0, l = Math.sqrt(
|
|
1265
1268
|
Math.pow(a, 2) + Math.pow(c, 2)
|
|
1266
1269
|
);
|
|
1267
|
-
l < r && (r = l,
|
|
1270
|
+
l < r && (r = l, t = s);
|
|
1268
1271
|
}), {
|
|
1269
|
-
element:
|
|
1272
|
+
element: t,
|
|
1270
1273
|
distance: r
|
|
1271
1274
|
};
|
|
1272
1275
|
});
|
|
@@ -1284,7 +1287,8 @@ class Ft {
|
|
|
1284
1287
|
* The synthetic event is a necessary evil because we do not control prosemirror-dropcursor to be able to show the drop-cursor within the range we want
|
|
1285
1288
|
*/
|
|
1286
1289
|
b(this, "onDragOver", (e) => {
|
|
1287
|
-
|
|
1290
|
+
var r;
|
|
1291
|
+
if (e.synthetic || !(this.pmView.dragging !== null || this.isDragOrigin || ((r = e.dataTransfer) == null ? void 0 : r.types.includes("blocknote/html")) || e.target instanceof Node && this.pmView.dom.contains(e.target)))
|
|
1288
1292
|
return;
|
|
1289
1293
|
const t = this.getDragEventContext(e);
|
|
1290
1294
|
if (!t || !t.isDropPoint) {
|
|
@@ -1309,16 +1313,18 @@ class Ft {
|
|
|
1309
1313
|
* - Whether the drop event is within the bounds of the current editor instance
|
|
1310
1314
|
*/
|
|
1311
1315
|
b(this, "getDragEventContext", (e) => {
|
|
1312
|
-
var
|
|
1313
|
-
|
|
1314
|
-
|
|
1316
|
+
var l, u;
|
|
1317
|
+
if (!(this.pmView.dragging !== null || this.isDragOrigin || ((l = e.dataTransfer) == null ? void 0 : l.types.includes("blocknote/html")) || e.target instanceof Node && this.pmView.dom.contains(e.target)))
|
|
1318
|
+
return;
|
|
1319
|
+
const t = !((u = e.dataTransfer) != null && u.types.includes("blocknote/html")) && !!this.pmView.dragging, r = !!this.isDragOrigin, s = t || r, i = this.findClosestEditorElement(e);
|
|
1320
|
+
if (!i || i.distance > se)
|
|
1315
1321
|
return;
|
|
1316
|
-
const
|
|
1317
|
-
if (!(!
|
|
1322
|
+
const a = i.element === this.pmView.dom, c = a && i.distance === 0;
|
|
1323
|
+
if (!(!a && !s))
|
|
1318
1324
|
return {
|
|
1319
|
-
isDropPoint:
|
|
1320
|
-
isDropWithinEditorBounds:
|
|
1321
|
-
isDragOrigin:
|
|
1325
|
+
isDropPoint: a,
|
|
1326
|
+
isDropWithinEditorBounds: c,
|
|
1327
|
+
isDragOrigin: s
|
|
1322
1328
|
};
|
|
1323
1329
|
});
|
|
1324
1330
|
/**
|
|
@@ -1335,15 +1341,16 @@ class Ft {
|
|
|
1335
1341
|
* - Delete the dragged content from our editor after a delay
|
|
1336
1342
|
*/
|
|
1337
1343
|
b(this, "onDrop", (e) => {
|
|
1338
|
-
|
|
1344
|
+
var a;
|
|
1345
|
+
if (e.synthetic || !(this.pmView.dragging !== null || this.isDragOrigin || ((a = e.dataTransfer) == null ? void 0 : a.types.includes("blocknote/html")) || e.target instanceof Node && this.pmView.dom.contains(e.target)))
|
|
1339
1346
|
return;
|
|
1340
1347
|
const t = this.getDragEventContext(e);
|
|
1341
1348
|
if (!t) {
|
|
1342
1349
|
this.closeDropCursor();
|
|
1343
1350
|
return;
|
|
1344
1351
|
}
|
|
1345
|
-
const { isDropPoint:
|
|
1346
|
-
if (!
|
|
1352
|
+
const { isDropPoint: r, isDropWithinEditorBounds: s, isDragOrigin: i } = t;
|
|
1353
|
+
if (!s && r && this.dispatchSyntheticEvent(e), r) {
|
|
1347
1354
|
if (this.pmView.dragging)
|
|
1348
1355
|
return;
|
|
1349
1356
|
this.pmView.dispatch(
|
|
@@ -1355,7 +1362,7 @@ class Ft {
|
|
|
1355
1362
|
)
|
|
1356
1363
|
);
|
|
1357
1364
|
return;
|
|
1358
|
-
} else if (
|
|
1365
|
+
} else if (i) {
|
|
1359
1366
|
setTimeout(
|
|
1360
1367
|
() => this.pmView.dispatch(this.pmView.state.tr.deleteSelection()),
|
|
1361
1368
|
0
|
|
@@ -1367,18 +1374,18 @@ class Ft {
|
|
|
1367
1374
|
e.synthetic || (this.pmView.dragging = null);
|
|
1368
1375
|
});
|
|
1369
1376
|
b(this, "onKeyDown", (e) => {
|
|
1370
|
-
var
|
|
1371
|
-
(
|
|
1377
|
+
var o;
|
|
1378
|
+
(o = this.state) != null && o.show && this.editor.isFocused() && (this.state.show = !1, this.emitUpdate(this.state));
|
|
1372
1379
|
});
|
|
1373
1380
|
b(this, "onMouseMove", (e) => {
|
|
1374
1381
|
var s;
|
|
1375
1382
|
if (this.menuFrozen)
|
|
1376
1383
|
return;
|
|
1377
1384
|
this.mousePos = { x: e.clientX, y: e.clientY };
|
|
1378
|
-
const
|
|
1385
|
+
const o = this.pmView.dom.getBoundingClientRect(), t = this.mousePos.x > o.left && this.mousePos.x < o.right && this.mousePos.y > o.top && this.mousePos.y < o.bottom, r = this.pmView.dom.parentElement;
|
|
1379
1386
|
if (
|
|
1380
1387
|
// Cursor is within the editor area
|
|
1381
|
-
|
|
1388
|
+
t && // An element is hovered
|
|
1382
1389
|
e && e.target && // Element is outside the editor
|
|
1383
1390
|
!(r === e.target || r.contains(e.target))
|
|
1384
1391
|
) {
|
|
@@ -1387,10 +1394,10 @@ class Ft {
|
|
|
1387
1394
|
}
|
|
1388
1395
|
this.updateStateFromMousePos();
|
|
1389
1396
|
});
|
|
1390
|
-
this.editor = e, this.pmView =
|
|
1397
|
+
this.editor = e, this.pmView = o, this.emitUpdate = () => {
|
|
1391
1398
|
if (!this.state)
|
|
1392
1399
|
throw new Error("Attempting to update uninitialized side menu");
|
|
1393
|
-
|
|
1400
|
+
t(this.state);
|
|
1394
1401
|
}, this.pmView.root.addEventListener(
|
|
1395
1402
|
"dragstart",
|
|
1396
1403
|
this.onDragStart
|
|
@@ -1416,14 +1423,14 @@ class Ft {
|
|
|
1416
1423
|
);
|
|
1417
1424
|
}
|
|
1418
1425
|
dispatchSyntheticEvent(e) {
|
|
1419
|
-
const
|
|
1420
|
-
|
|
1421
|
-
Math.max(e.clientX,
|
|
1422
|
-
|
|
1423
|
-
),
|
|
1424
|
-
Math.max(e.clientY,
|
|
1425
|
-
|
|
1426
|
-
),
|
|
1426
|
+
const o = new Event(e.type, e), t = this.pmView.dom.firstChild.getBoundingClientRect();
|
|
1427
|
+
o.clientX = e.clientX, o.clientY = e.clientY, o.clientX = Math.min(
|
|
1428
|
+
Math.max(e.clientX, t.left),
|
|
1429
|
+
t.left + t.width
|
|
1430
|
+
), o.clientY = Math.min(
|
|
1431
|
+
Math.max(e.clientY, t.top),
|
|
1432
|
+
t.top + t.height
|
|
1433
|
+
), o.dataTransfer = e.dataTransfer, o.preventDefault = () => e.preventDefault(), o.synthetic = !0, this.pmView.dom.dispatchEvent(o);
|
|
1427
1434
|
}
|
|
1428
1435
|
// Needed in cases where the editor state updates without the mouse cursor
|
|
1429
1436
|
// moving, as some state updates can require a side menu update. For example,
|
|
@@ -1432,9 +1439,9 @@ class Ft {
|
|
|
1432
1439
|
// allowing the user to click the button again without moving the cursor. This
|
|
1433
1440
|
// would otherwise not update the side menu, and so clicking the button again
|
|
1434
1441
|
// would attempt to remove the same block again, causing an error.
|
|
1435
|
-
update(e,
|
|
1442
|
+
update(e, o) {
|
|
1436
1443
|
var r;
|
|
1437
|
-
!
|
|
1444
|
+
!o.doc.eq(this.pmView.state.doc) && ((r = this.state) != null && r.show) && this.updateStateFromMousePos();
|
|
1438
1445
|
}
|
|
1439
1446
|
destroy() {
|
|
1440
1447
|
var e;
|
|
@@ -1463,27 +1470,27 @@ class Ft {
|
|
|
1463
1470
|
);
|
|
1464
1471
|
}
|
|
1465
1472
|
}
|
|
1466
|
-
const $t = new pe("SideMenuPlugin"), To =
|
|
1473
|
+
const $t = new pe("SideMenuPlugin"), To = C(({ editor: n }) => {
|
|
1467
1474
|
let e;
|
|
1468
|
-
const
|
|
1475
|
+
const o = H(
|
|
1469
1476
|
void 0
|
|
1470
1477
|
);
|
|
1471
1478
|
return {
|
|
1472
1479
|
key: "sideMenu",
|
|
1473
|
-
store:
|
|
1480
|
+
store: o,
|
|
1474
1481
|
prosemirrorPlugins: [
|
|
1475
1482
|
new fe({
|
|
1476
1483
|
key: $t,
|
|
1477
|
-
view: (
|
|
1478
|
-
|
|
1484
|
+
view: (t) => (e = new Ft(n, t, (r) => {
|
|
1485
|
+
o.setState({ ...r });
|
|
1479
1486
|
}), e)
|
|
1480
1487
|
})
|
|
1481
1488
|
],
|
|
1482
1489
|
/**
|
|
1483
1490
|
* Handles drag & drop events for blocks.
|
|
1484
1491
|
*/
|
|
1485
|
-
blockDragStart(
|
|
1486
|
-
e && (e.isDragOrigin = !0), Vt(
|
|
1492
|
+
blockDragStart(t, r) {
|
|
1493
|
+
e && (e.isDragOrigin = !0), Vt(t, r, n);
|
|
1487
1494
|
},
|
|
1488
1495
|
/**
|
|
1489
1496
|
* Handles drag & drop events for blocks.
|
|
@@ -1509,12 +1516,12 @@ const $t = new pe("SideMenuPlugin"), To = k(({ editor: n }) => {
|
|
|
1509
1516
|
}
|
|
1510
1517
|
};
|
|
1511
1518
|
});
|
|
1512
|
-
let
|
|
1519
|
+
let S;
|
|
1513
1520
|
function ie(n) {
|
|
1514
|
-
|
|
1521
|
+
S || (S = document.createElement("div"), S.innerHTML = "_", S.style.opacity = "0", S.style.height = "1px", S.style.width = "1px", n instanceof Document ? n.body.appendChild(S) : n.appendChild(S));
|
|
1515
1522
|
}
|
|
1516
1523
|
function Ut(n) {
|
|
1517
|
-
|
|
1524
|
+
S && (n instanceof Document ? n.body.removeChild(S) : n.removeChild(S), S = void 0);
|
|
1518
1525
|
}
|
|
1519
1526
|
function M(n) {
|
|
1520
1527
|
return Array.prototype.indexOf.call(n.parentElement.childNodes, n);
|
|
@@ -1524,10 +1531,10 @@ function _t(n) {
|
|
|
1524
1531
|
for (; e && e.nodeName !== "TD" && e.nodeName !== "TH" && !e.classList.contains("tableWrapper"); ) {
|
|
1525
1532
|
if (e.classList.contains("ProseMirror"))
|
|
1526
1533
|
return;
|
|
1527
|
-
const
|
|
1528
|
-
if (!
|
|
1534
|
+
const o = e.parentNode;
|
|
1535
|
+
if (!o || !(o instanceof Element))
|
|
1529
1536
|
return;
|
|
1530
|
-
e =
|
|
1537
|
+
e = o;
|
|
1531
1538
|
}
|
|
1532
1539
|
return e.nodeName === "TD" || e.nodeName === "TH" ? {
|
|
1533
1540
|
type: "cell",
|
|
@@ -1540,12 +1547,12 @@ function _t(n) {
|
|
|
1540
1547
|
};
|
|
1541
1548
|
}
|
|
1542
1549
|
function zt(n, e) {
|
|
1543
|
-
const
|
|
1544
|
-
for (let
|
|
1545
|
-
t
|
|
1550
|
+
const o = e.querySelectorAll(n);
|
|
1551
|
+
for (let t = 0; t < o.length; t++)
|
|
1552
|
+
o[t].style.visibility = "hidden";
|
|
1546
1553
|
}
|
|
1547
1554
|
class Kt {
|
|
1548
|
-
constructor(e,
|
|
1555
|
+
constructor(e, o, t) {
|
|
1549
1556
|
b(this, "state");
|
|
1550
1557
|
b(this, "emitUpdate");
|
|
1551
1558
|
b(this, "tableId");
|
|
@@ -1561,27 +1568,27 @@ class Kt {
|
|
|
1561
1568
|
this.mouseState = "up", this.mouseMoveHandler(e);
|
|
1562
1569
|
});
|
|
1563
1570
|
b(this, "mouseMoveHandler", (e) => {
|
|
1564
|
-
var l, u, h, g, m, p, d;
|
|
1571
|
+
var l, u, h, g, m, p, d, f;
|
|
1565
1572
|
if (this.menuFrozen || this.mouseState === "selecting" || !(e.target instanceof Element) || !this.pmView.dom.contains(e.target))
|
|
1566
1573
|
return;
|
|
1567
|
-
const
|
|
1568
|
-
if ((
|
|
1574
|
+
const o = _t(e.target);
|
|
1575
|
+
if ((o == null ? void 0 : o.type) === "cell" && this.mouseState === "down" && !((l = this.state) != null && l.draggingState)) {
|
|
1569
1576
|
this.mouseState = "selecting", (u = this.state) != null && u.show && (this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate());
|
|
1570
1577
|
return;
|
|
1571
1578
|
}
|
|
1572
|
-
if (!
|
|
1579
|
+
if (!o || !this.editor.isEditable) {
|
|
1573
1580
|
(h = this.state) != null && h.show && (this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate());
|
|
1574
1581
|
return;
|
|
1575
1582
|
}
|
|
1576
|
-
if (!
|
|
1583
|
+
if (!o.tbodyNode)
|
|
1577
1584
|
return;
|
|
1578
|
-
const
|
|
1585
|
+
const t = o.tbodyNode.getBoundingClientRect(), r = Se(o.domNode, this.pmView);
|
|
1579
1586
|
if (!r)
|
|
1580
1587
|
return;
|
|
1581
1588
|
this.tableElement = r.node;
|
|
1582
1589
|
let s;
|
|
1583
1590
|
const i = this.editor.transact(
|
|
1584
|
-
(
|
|
1591
|
+
(w) => me(r.id, w.doc)
|
|
1585
1592
|
);
|
|
1586
1593
|
if (!i)
|
|
1587
1594
|
throw new Error(`Block with ID ${r.id} not found`);
|
|
@@ -1595,36 +1602,41 @@ class Kt {
|
|
|
1595
1602
|
if (Ue(this.editor, "table") && (this.tablePos = i.posBeforeNode + 1, s = a), !s)
|
|
1596
1603
|
return;
|
|
1597
1604
|
this.tableId = r.id;
|
|
1598
|
-
const c = (g =
|
|
1599
|
-
if ((
|
|
1600
|
-
const
|
|
1601
|
-
e.clientY <
|
|
1605
|
+
const c = (g = o.domNode.closest(".tableWrapper")) == null ? void 0 : g.querySelector(".table-widgets-container");
|
|
1606
|
+
if ((o == null ? void 0 : o.type) === "wrapper") {
|
|
1607
|
+
const w = e.clientY >= t.bottom - 1 && // -1 to account for fractions of pixels in "bottom"
|
|
1608
|
+
e.clientY < t.bottom + 20, y = e.clientX >= t.right - 1 && e.clientX < t.right + 20, v = (
|
|
1609
|
+
// always hide handles when the actively hovered table changed
|
|
1610
|
+
((m = this.state) == null ? void 0 : m.block.id) !== s.id || // make sure we don't hide existing handles (keep col / row index) when
|
|
1611
|
+
// we're hovering just above or to the right of a table
|
|
1612
|
+
e.clientX > t.right || e.clientY > t.bottom
|
|
1613
|
+
);
|
|
1602
1614
|
this.state = {
|
|
1603
1615
|
...this.state,
|
|
1604
1616
|
show: !0,
|
|
1605
|
-
showAddOrRemoveRowsButton:
|
|
1606
|
-
showAddOrRemoveColumnsButton:
|
|
1607
|
-
referencePosTable:
|
|
1617
|
+
showAddOrRemoveRowsButton: w,
|
|
1618
|
+
showAddOrRemoveColumnsButton: y,
|
|
1619
|
+
referencePosTable: t,
|
|
1608
1620
|
block: s,
|
|
1609
1621
|
widgetContainer: c,
|
|
1610
|
-
colIndex:
|
|
1611
|
-
rowIndex:
|
|
1612
|
-
referencePosCell:
|
|
1622
|
+
colIndex: v || (p = this.state) == null ? void 0 : p.colIndex,
|
|
1623
|
+
rowIndex: v || (d = this.state) == null ? void 0 : d.rowIndex,
|
|
1624
|
+
referencePosCell: v || (f = this.state) == null ? void 0 : f.referencePosCell
|
|
1613
1625
|
};
|
|
1614
1626
|
} else {
|
|
1615
|
-
const
|
|
1616
|
-
if (this.state !== void 0 && this.state.show && this.tableId === r.id && this.state.rowIndex ===
|
|
1627
|
+
const w = M(o.domNode), y = M(o.domNode.parentElement), v = o.domNode.getBoundingClientRect();
|
|
1628
|
+
if (this.state !== void 0 && this.state.show && this.tableId === r.id && this.state.rowIndex === y && this.state.colIndex === w)
|
|
1617
1629
|
return;
|
|
1618
1630
|
this.state = {
|
|
1619
1631
|
show: !0,
|
|
1620
|
-
showAddOrRemoveColumnsButton:
|
|
1621
|
-
showAddOrRemoveRowsButton:
|
|
1622
|
-
referencePosTable:
|
|
1632
|
+
showAddOrRemoveColumnsButton: w === s.content.rows[0].cells.length - 1,
|
|
1633
|
+
showAddOrRemoveRowsButton: y === s.content.rows.length - 1,
|
|
1634
|
+
referencePosTable: t,
|
|
1623
1635
|
block: s,
|
|
1624
1636
|
draggingState: void 0,
|
|
1625
|
-
referencePosCell:
|
|
1626
|
-
colIndex:
|
|
1627
|
-
rowIndex:
|
|
1637
|
+
referencePosCell: v,
|
|
1638
|
+
colIndex: w,
|
|
1639
|
+
rowIndex: y,
|
|
1628
1640
|
widgetContainer: c
|
|
1629
1641
|
};
|
|
1630
1642
|
}
|
|
@@ -1638,7 +1650,7 @@ class Kt {
|
|
|
1638
1650
|
".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline",
|
|
1639
1651
|
this.pmView.root
|
|
1640
1652
|
);
|
|
1641
|
-
const
|
|
1653
|
+
const o = {
|
|
1642
1654
|
left: Math.min(
|
|
1643
1655
|
Math.max(e.clientX, this.state.referencePosTable.left + 1),
|
|
1644
1656
|
this.state.referencePosTable.right - 1
|
|
@@ -1647,17 +1659,17 @@ class Kt {
|
|
|
1647
1659
|
Math.max(e.clientY, this.state.referencePosTable.top + 1),
|
|
1648
1660
|
this.state.referencePosTable.bottom - 1
|
|
1649
1661
|
)
|
|
1650
|
-
},
|
|
1662
|
+
}, t = this.pmView.root.elementsFromPoint(o.left, o.top).filter(
|
|
1651
1663
|
(m) => m.tagName === "TD" || m.tagName === "TH"
|
|
1652
1664
|
);
|
|
1653
|
-
if (
|
|
1665
|
+
if (t.length === 0)
|
|
1654
1666
|
return;
|
|
1655
|
-
const r =
|
|
1667
|
+
const r = t[0];
|
|
1656
1668
|
let s = !1;
|
|
1657
1669
|
const i = M(r.parentElement), a = M(r), c = this.state.draggingState.draggedCellOrientation === "row" ? this.state.rowIndex : this.state.colIndex, u = (this.state.draggingState.draggedCellOrientation === "row" ? i : a) !== c;
|
|
1658
1670
|
(this.state.rowIndex !== i || this.state.colIndex !== a) && (this.state.rowIndex = i, this.state.colIndex = a, this.state.referencePosCell = r.getBoundingClientRect(), s = !0);
|
|
1659
|
-
const h = this.state.draggingState.draggedCellOrientation === "row" ?
|
|
1660
|
-
this.state.draggingState.mousePos !== h && (this.state.draggingState.mousePos = h, s = !0), s && this.emitUpdate(), u && this.editor.transact((m) => m.setMeta(
|
|
1671
|
+
const h = this.state.draggingState.draggedCellOrientation === "row" ? o.top : o.left;
|
|
1672
|
+
this.state.draggingState.mousePos !== h && (this.state.draggingState.mousePos = h, s = !0), s && this.emitUpdate(), u && this.editor.transact((m) => m.setMeta(O, !0));
|
|
1661
1673
|
});
|
|
1662
1674
|
b(this, "dropHandler", (e) => {
|
|
1663
1675
|
if (this.mouseState = "up", this.state === void 0 || this.state.draggingState === void 0)
|
|
@@ -1667,17 +1679,17 @@ class Kt {
|
|
|
1667
1679
|
"Attempted to drop table row or column, but no table block was hovered prior."
|
|
1668
1680
|
);
|
|
1669
1681
|
e.preventDefault();
|
|
1670
|
-
const { draggingState:
|
|
1671
|
-
if (
|
|
1682
|
+
const { draggingState: o, colIndex: t, rowIndex: r } = this.state, s = this.state.block.content.columnWidths;
|
|
1683
|
+
if (o.draggedCellOrientation === "row") {
|
|
1672
1684
|
if (!de(
|
|
1673
1685
|
this.state.block,
|
|
1674
|
-
|
|
1686
|
+
o.originalIndex,
|
|
1675
1687
|
r
|
|
1676
1688
|
))
|
|
1677
1689
|
return !1;
|
|
1678
1690
|
const i = Re(
|
|
1679
1691
|
this.state.block,
|
|
1680
|
-
|
|
1692
|
+
o.originalIndex,
|
|
1681
1693
|
r
|
|
1682
1694
|
);
|
|
1683
1695
|
this.editor.updateBlock(this.state.block, {
|
|
@@ -1690,16 +1702,16 @@ class Kt {
|
|
|
1690
1702
|
} else {
|
|
1691
1703
|
if (!ue(
|
|
1692
1704
|
this.state.block,
|
|
1693
|
-
|
|
1694
|
-
|
|
1705
|
+
o.originalIndex,
|
|
1706
|
+
t
|
|
1695
1707
|
))
|
|
1696
1708
|
return !1;
|
|
1697
1709
|
const i = Le(
|
|
1698
1710
|
this.state.block,
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
), [a] = s.splice(
|
|
1702
|
-
s.splice(
|
|
1711
|
+
o.originalIndex,
|
|
1712
|
+
t
|
|
1713
|
+
), [a] = s.splice(o.originalIndex, 1);
|
|
1714
|
+
s.splice(t, 0, a), this.editor.updateBlock(this.state.block, {
|
|
1703
1715
|
type: "table",
|
|
1704
1716
|
content: {
|
|
1705
1717
|
...this.state.block.content,
|
|
@@ -1710,14 +1722,14 @@ class Kt {
|
|
|
1710
1722
|
}
|
|
1711
1723
|
return this.editor.setTextCursorPosition(this.state.block.id), !0;
|
|
1712
1724
|
});
|
|
1713
|
-
this.editor = e, this.pmView =
|
|
1725
|
+
this.editor = e, this.pmView = o, this.emitUpdate = () => {
|
|
1714
1726
|
if (!this.state)
|
|
1715
1727
|
throw new Error("Attempting to update uninitialized image toolbar");
|
|
1716
|
-
|
|
1717
|
-
},
|
|
1728
|
+
t(this.state);
|
|
1729
|
+
}, o.dom.addEventListener("mousemove", this.mouseMoveHandler), o.dom.addEventListener("mousedown", this.viewMousedownHandler), window.addEventListener("mouseup", this.mouseUpHandler), o.root.addEventListener(
|
|
1718
1730
|
"dragover",
|
|
1719
1731
|
this.dragOverHandler
|
|
1720
|
-
),
|
|
1732
|
+
), o.root.addEventListener(
|
|
1721
1733
|
"drop",
|
|
1722
1734
|
this.dropHandler
|
|
1723
1735
|
);
|
|
@@ -1733,20 +1745,20 @@ class Kt {
|
|
|
1733
1745
|
this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate();
|
|
1734
1746
|
return;
|
|
1735
1747
|
}
|
|
1736
|
-
const { height: e, width:
|
|
1748
|
+
const { height: e, width: o } = Ve(
|
|
1737
1749
|
this.state.block
|
|
1738
1750
|
);
|
|
1739
|
-
this.state.rowIndex !== void 0 && this.state.colIndex !== void 0 && (this.state.rowIndex >= e && (this.state.rowIndex = e - 1), this.state.colIndex >=
|
|
1740
|
-
const
|
|
1741
|
-
if (!
|
|
1751
|
+
this.state.rowIndex !== void 0 && this.state.colIndex !== void 0 && (this.state.rowIndex >= e && (this.state.rowIndex = e - 1), this.state.colIndex >= o && (this.state.colIndex = o - 1));
|
|
1752
|
+
const t = this.tableElement.querySelector("tbody");
|
|
1753
|
+
if (!t)
|
|
1742
1754
|
throw new Error(
|
|
1743
1755
|
"Table block does not contain a 'tbody' HTML element. This should never happen."
|
|
1744
1756
|
);
|
|
1745
1757
|
if (this.state.rowIndex !== void 0 && this.state.colIndex !== void 0) {
|
|
1746
|
-
const i =
|
|
1758
|
+
const i = t.children[this.state.rowIndex].children[this.state.colIndex];
|
|
1747
1759
|
i ? this.state.referencePosCell = i.getBoundingClientRect() : (this.state.rowIndex = void 0, this.state.colIndex = void 0);
|
|
1748
1760
|
}
|
|
1749
|
-
this.state.referencePosTable =
|
|
1761
|
+
this.state.referencePosTable = t.getBoundingClientRect(), this.emitUpdate();
|
|
1750
1762
|
}
|
|
1751
1763
|
destroy() {
|
|
1752
1764
|
this.pmView.dom.removeEventListener("mousemove", this.mouseMoveHandler), window.removeEventListener("mouseup", this.mouseUpHandler), this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler), this.pmView.root.removeEventListener(
|
|
@@ -1758,17 +1770,17 @@ class Kt {
|
|
|
1758
1770
|
);
|
|
1759
1771
|
}
|
|
1760
1772
|
}
|
|
1761
|
-
const
|
|
1773
|
+
const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
|
|
1762
1774
|
let e;
|
|
1763
|
-
const
|
|
1775
|
+
const o = H(void 0);
|
|
1764
1776
|
return {
|
|
1765
1777
|
key: "tableHandles",
|
|
1766
|
-
store:
|
|
1778
|
+
store: o,
|
|
1767
1779
|
prosemirrorPlugins: [
|
|
1768
1780
|
new T({
|
|
1769
|
-
key:
|
|
1770
|
-
view: (
|
|
1771
|
-
|
|
1781
|
+
key: O,
|
|
1782
|
+
view: (t) => (e = new Kt(n, t, (r) => {
|
|
1783
|
+
o.setState(
|
|
1772
1784
|
r.block ? {
|
|
1773
1785
|
...r,
|
|
1774
1786
|
draggingState: r.draggingState ? { ...r.draggingState } : void 0
|
|
@@ -1778,7 +1790,7 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
|
|
|
1778
1790
|
// We use decorations to render the drop cursor when dragging a table row
|
|
1779
1791
|
// or column. The decorations are updated in the `dragOverHandler` method.
|
|
1780
1792
|
props: {
|
|
1781
|
-
decorations: (
|
|
1793
|
+
decorations: (t) => {
|
|
1782
1794
|
if (e === void 0 || e.state === void 0 || e.state.draggingState === void 0 || e.tablePos === void 0)
|
|
1783
1795
|
return;
|
|
1784
1796
|
const r = e.state.draggingState.draggedCellOrientation === "row" ? e.state.rowIndex : e.state.colIndex;
|
|
@@ -1786,15 +1798,15 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
|
|
|
1786
1798
|
return;
|
|
1787
1799
|
const s = [], { block: i, draggingState: a } = e.state, { originalIndex: c, draggedCellOrientation: l } = a;
|
|
1788
1800
|
if (r === c || !i || l === "row" && !de(i, c, r) || l === "col" && !ue(i, c, r))
|
|
1789
|
-
return V.create(
|
|
1790
|
-
const u =
|
|
1801
|
+
return V.create(t.doc, s);
|
|
1802
|
+
const u = t.doc.resolve(e.tablePos + 1);
|
|
1791
1803
|
return e.state.draggingState.draggedCellOrientation === "row" ? G(
|
|
1792
1804
|
e.state.block,
|
|
1793
1805
|
r
|
|
1794
1806
|
).forEach(({ row: g, col: m }) => {
|
|
1795
|
-
const p =
|
|
1807
|
+
const p = t.doc.resolve(
|
|
1796
1808
|
u.posAtIndex(g) + 1
|
|
1797
|
-
), d =
|
|
1809
|
+
), d = t.doc.resolve(
|
|
1798
1810
|
p.posAtIndex(m) + 1
|
|
1799
1811
|
), f = d.node(), w = d.pos + (r > c ? f.nodeSize - 2 : 0);
|
|
1800
1812
|
s.push(
|
|
@@ -1808,9 +1820,9 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
|
|
|
1808
1820
|
e.state.block,
|
|
1809
1821
|
r
|
|
1810
1822
|
).forEach(({ row: g, col: m }) => {
|
|
1811
|
-
const p =
|
|
1823
|
+
const p = t.doc.resolve(
|
|
1812
1824
|
u.posAtIndex(g) + 1
|
|
1813
|
-
), d =
|
|
1825
|
+
), d = t.doc.resolve(
|
|
1814
1826
|
p.posAtIndex(m) + 1
|
|
1815
1827
|
), f = d.node(), w = d.pos + (r > c ? f.nodeSize - 2 : 0);
|
|
1816
1828
|
s.push(
|
|
@@ -1820,7 +1832,7 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
|
|
|
1820
1832
|
return y.className = "bn-table-drop-cursor", y.style.top = "0", y.style.bottom = "0", r > c ? y.style.right = "-2px" : y.style.left = "-3px", y.style.width = "4px", y;
|
|
1821
1833
|
})
|
|
1822
1834
|
);
|
|
1823
|
-
}), V.create(
|
|
1835
|
+
}), V.create(t.doc, s);
|
|
1824
1836
|
}
|
|
1825
1837
|
}
|
|
1826
1838
|
})
|
|
@@ -1829,7 +1841,7 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
|
|
|
1829
1841
|
* Callback that should be set on the `dragStart` event for whichever element
|
|
1830
1842
|
* is used as the column drag handle.
|
|
1831
1843
|
*/
|
|
1832
|
-
colDragStart(
|
|
1844
|
+
colDragStart(t) {
|
|
1833
1845
|
if (e === void 0 || e.state === void 0 || e.state.colIndex === void 0)
|
|
1834
1846
|
throw new Error(
|
|
1835
1847
|
"Attempted to drag table column, but no table block was hovered prior."
|
|
@@ -1837,21 +1849,21 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
|
|
|
1837
1849
|
e.state.draggingState = {
|
|
1838
1850
|
draggedCellOrientation: "col",
|
|
1839
1851
|
originalIndex: e.state.colIndex,
|
|
1840
|
-
mousePos:
|
|
1852
|
+
mousePos: t.clientX
|
|
1841
1853
|
}, e.emitUpdate(), n.transact(
|
|
1842
|
-
(r) => r.setMeta(
|
|
1854
|
+
(r) => r.setMeta(O, {
|
|
1843
1855
|
draggedCellOrientation: e.state.draggingState.draggedCellOrientation,
|
|
1844
1856
|
originalIndex: e.state.colIndex,
|
|
1845
1857
|
newIndex: e.state.colIndex,
|
|
1846
1858
|
tablePos: e.tablePos
|
|
1847
1859
|
})
|
|
1848
|
-
), !n.headless && (ie(n.prosemirrorView.root),
|
|
1860
|
+
), !n.headless && (ie(n.prosemirrorView.root), t.dataTransfer.setDragImage(S, 0, 0), t.dataTransfer.effectAllowed = "move");
|
|
1849
1861
|
},
|
|
1850
1862
|
/**
|
|
1851
1863
|
* Callback that should be set on the `dragStart` event for whichever element
|
|
1852
1864
|
* is used as the row drag handle.
|
|
1853
1865
|
*/
|
|
1854
|
-
rowDragStart(
|
|
1866
|
+
rowDragStart(t) {
|
|
1855
1867
|
if (e.state === void 0 || e.state.rowIndex === void 0)
|
|
1856
1868
|
throw new Error(
|
|
1857
1869
|
"Attempted to drag table row, but no table block was hovered prior."
|
|
@@ -1859,15 +1871,15 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
|
|
|
1859
1871
|
e.state.draggingState = {
|
|
1860
1872
|
draggedCellOrientation: "row",
|
|
1861
1873
|
originalIndex: e.state.rowIndex,
|
|
1862
|
-
mousePos:
|
|
1874
|
+
mousePos: t.clientY
|
|
1863
1875
|
}, e.emitUpdate(), n.transact(
|
|
1864
|
-
(r) => r.setMeta(
|
|
1876
|
+
(r) => r.setMeta(O, {
|
|
1865
1877
|
draggedCellOrientation: e.state.draggingState.draggedCellOrientation,
|
|
1866
1878
|
originalIndex: e.state.rowIndex,
|
|
1867
1879
|
newIndex: e.state.rowIndex,
|
|
1868
1880
|
tablePos: e.tablePos
|
|
1869
1881
|
})
|
|
1870
|
-
), !n.headless && (ie(n.prosemirrorView.root),
|
|
1882
|
+
), !n.headless && (ie(n.prosemirrorView.root), t.dataTransfer.setDragImage(S, 0, 0), t.dataTransfer.effectAllowed = "copyMove");
|
|
1871
1883
|
},
|
|
1872
1884
|
/**
|
|
1873
1885
|
* Callback that should be set on the `dragEnd` event for both the element
|
|
@@ -1878,7 +1890,7 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
|
|
|
1878
1890
|
throw new Error(
|
|
1879
1891
|
"Attempted to drag table row, but no table block was hovered prior."
|
|
1880
1892
|
);
|
|
1881
|
-
e.state.draggingState = void 0, e.emitUpdate(), n.transact((
|
|
1893
|
+
e.state.draggingState = void 0, e.emitUpdate(), n.transact((t) => t.setMeta(O, null)), !n.headless && Ut(n.prosemirrorView.root);
|
|
1882
1894
|
},
|
|
1883
1895
|
/**
|
|
1884
1896
|
* Freezes the drag handles. When frozen, they will stay attached to the same
|
|
@@ -1894,45 +1906,45 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
|
|
|
1894
1906
|
unfreezeHandles() {
|
|
1895
1907
|
e.menuFrozen = !1;
|
|
1896
1908
|
},
|
|
1897
|
-
getCellsAtRowHandle(
|
|
1898
|
-
return G(
|
|
1909
|
+
getCellsAtRowHandle(t, r) {
|
|
1910
|
+
return G(t, r);
|
|
1899
1911
|
},
|
|
1900
1912
|
/**
|
|
1901
1913
|
* Get all the cells in a column of the table block.
|
|
1902
1914
|
*/
|
|
1903
|
-
getCellsAtColumnHandle(
|
|
1904
|
-
return W(
|
|
1915
|
+
getCellsAtColumnHandle(t, r) {
|
|
1916
|
+
return W(t, r);
|
|
1905
1917
|
},
|
|
1906
1918
|
/**
|
|
1907
1919
|
* Sets the selection to the given cell or a range of cells.
|
|
1908
1920
|
* @returns The new state after the selection has been set.
|
|
1909
1921
|
*/
|
|
1910
|
-
setCellSelection(
|
|
1922
|
+
setCellSelection(t, r, s = r) {
|
|
1911
1923
|
if (!e)
|
|
1912
1924
|
throw new Error("Table handles view not initialized");
|
|
1913
|
-
const i =
|
|
1925
|
+
const i = t.doc.resolve(e.tablePos + 1), a = t.doc.resolve(
|
|
1914
1926
|
i.posAtIndex(r.row) + 1
|
|
1915
|
-
), c =
|
|
1927
|
+
), c = t.doc.resolve(
|
|
1916
1928
|
// No need for +1, since CellSelection expects the position before the cell
|
|
1917
1929
|
a.posAtIndex(r.col)
|
|
1918
|
-
), l =
|
|
1930
|
+
), l = t.doc.resolve(
|
|
1919
1931
|
i.posAtIndex(s.row) + 1
|
|
1920
|
-
), u =
|
|
1932
|
+
), u = t.doc.resolve(
|
|
1921
1933
|
// No need for +1, since CellSelection expects the position before the cell
|
|
1922
1934
|
l.posAtIndex(s.col)
|
|
1923
|
-
), h =
|
|
1935
|
+
), h = t.tr;
|
|
1924
1936
|
return h.setSelection(
|
|
1925
1937
|
new yt(c, u)
|
|
1926
|
-
),
|
|
1938
|
+
), t.apply(h);
|
|
1927
1939
|
},
|
|
1928
1940
|
/**
|
|
1929
1941
|
* Adds a row or column to the table using prosemirror-table commands
|
|
1930
1942
|
*/
|
|
1931
|
-
addRowOrColumn(
|
|
1943
|
+
addRowOrColumn(t, r) {
|
|
1932
1944
|
n.exec((s, i) => {
|
|
1933
1945
|
const a = this.setCellSelection(
|
|
1934
1946
|
s,
|
|
1935
|
-
r.orientation === "row" ? { row:
|
|
1947
|
+
r.orientation === "row" ? { row: t, col: 0 } : { row: 0, col: t }
|
|
1936
1948
|
);
|
|
1937
1949
|
return r.orientation === "row" ? r.side === "above" ? pt(a, i) : ft(a, i) : r.side === "left" ? gt(a, i) : wt(a, i);
|
|
1938
1950
|
});
|
|
@@ -1940,17 +1952,17 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
|
|
|
1940
1952
|
/**
|
|
1941
1953
|
* Removes a row or column from the table using prosemirror-table commands
|
|
1942
1954
|
*/
|
|
1943
|
-
removeRowOrColumn(
|
|
1955
|
+
removeRowOrColumn(t, r) {
|
|
1944
1956
|
return r === "row" ? n.exec((s, i) => {
|
|
1945
1957
|
const a = this.setCellSelection(s, {
|
|
1946
|
-
row:
|
|
1958
|
+
row: t,
|
|
1947
1959
|
col: 0
|
|
1948
1960
|
});
|
|
1949
1961
|
return ht(a, i);
|
|
1950
1962
|
}) : n.exec((s, i) => {
|
|
1951
1963
|
const a = this.setCellSelection(s, {
|
|
1952
1964
|
row: 0,
|
|
1953
|
-
col:
|
|
1965
|
+
col: t
|
|
1954
1966
|
});
|
|
1955
1967
|
return mt(a, i);
|
|
1956
1968
|
});
|
|
@@ -1958,12 +1970,12 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
|
|
|
1958
1970
|
/**
|
|
1959
1971
|
* Merges the cells in the table block.
|
|
1960
1972
|
*/
|
|
1961
|
-
mergeCells(
|
|
1973
|
+
mergeCells(t) {
|
|
1962
1974
|
return n.exec((r, s) => {
|
|
1963
|
-
const i =
|
|
1975
|
+
const i = t ? this.setCellSelection(
|
|
1964
1976
|
r,
|
|
1965
|
-
|
|
1966
|
-
|
|
1977
|
+
t.relativeStartCell,
|
|
1978
|
+
t.relativeEndCell
|
|
1967
1979
|
) : r;
|
|
1968
1980
|
return ut(i, s);
|
|
1969
1981
|
});
|
|
@@ -1972,9 +1984,9 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
|
|
|
1972
1984
|
* Splits the cell in the table block.
|
|
1973
1985
|
* If no cell is provided, the current cell selected will be split.
|
|
1974
1986
|
*/
|
|
1975
|
-
splitCell(
|
|
1987
|
+
splitCell(t) {
|
|
1976
1988
|
return n.exec((r, s) => {
|
|
1977
|
-
const i =
|
|
1989
|
+
const i = t ? this.setCellSelection(r, t) : r;
|
|
1978
1990
|
return dt(i, s);
|
|
1979
1991
|
});
|
|
1980
1992
|
},
|
|
@@ -1983,23 +1995,23 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
|
|
|
1983
1995
|
* @returns The start and end cells of the current cell selection.
|
|
1984
1996
|
*/
|
|
1985
1997
|
getCellSelection() {
|
|
1986
|
-
return n.transact((
|
|
1987
|
-
const r =
|
|
1998
|
+
return n.transact((t) => {
|
|
1999
|
+
const r = t.selection;
|
|
1988
2000
|
let s = r.$from, i = r.$to;
|
|
1989
2001
|
if (Q(r)) {
|
|
1990
2002
|
const { ranges: d } = r;
|
|
1991
2003
|
d.forEach((f) => {
|
|
1992
2004
|
s = f.$from.min(s ?? f.$from), i = f.$to.max(i ?? f.$to);
|
|
1993
2005
|
});
|
|
1994
|
-
} else if (s =
|
|
2006
|
+
} else if (s = t.doc.resolve(
|
|
1995
2007
|
r.$from.pos - r.$from.parentOffset - 1
|
|
1996
|
-
), i =
|
|
2008
|
+
), i = t.doc.resolve(
|
|
1997
2009
|
r.$to.pos - r.$to.parentOffset - 1
|
|
1998
2010
|
), s.pos === 0 || i.pos === 0)
|
|
1999
2011
|
return;
|
|
2000
|
-
const a =
|
|
2012
|
+
const a = t.doc.resolve(
|
|
2001
2013
|
s.pos - s.parentOffset - 1
|
|
2002
|
-
), c =
|
|
2014
|
+
), c = t.doc.resolve(i.pos - i.parentOffset - 1), l = t.doc.resolve(a.pos - a.parentOffset - 1), u = s.index(a.depth), h = a.index(l.depth), g = i.index(c.depth), m = c.index(l.depth), p = [];
|
|
2003
2015
|
for (let d = h; d <= m; d++)
|
|
2004
2016
|
for (let f = u; f <= g; f++)
|
|
2005
2017
|
p.push({ row: d, col: f });
|
|
@@ -2021,31 +2033,31 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
|
|
|
2021
2033
|
*
|
|
2022
2034
|
* Returns undefined when there is no cell selection, or the selection is not within a table.
|
|
2023
2035
|
*/
|
|
2024
|
-
getMergeDirection(
|
|
2036
|
+
getMergeDirection(t) {
|
|
2025
2037
|
return n.transact((r) => {
|
|
2026
2038
|
const s = Q(r.selection) ? r.selection : void 0;
|
|
2027
|
-
if (!s || !
|
|
2039
|
+
if (!s || !t || // Only offer the merge button if there is more than one cell selected.
|
|
2028
2040
|
s.ranges.length <= 1)
|
|
2029
2041
|
return;
|
|
2030
2042
|
const i = this.getCellSelection();
|
|
2031
2043
|
if (i)
|
|
2032
|
-
return $e(i.from, i.to,
|
|
2044
|
+
return $e(i.from, i.to, t) ? "vertical" : "horizontal";
|
|
2033
2045
|
});
|
|
2034
2046
|
},
|
|
2035
|
-
cropEmptyRowsOrColumns(
|
|
2036
|
-
return Fe(
|
|
2047
|
+
cropEmptyRowsOrColumns(t, r) {
|
|
2048
|
+
return Fe(t, r);
|
|
2037
2049
|
},
|
|
2038
|
-
addRowsOrColumns(
|
|
2039
|
-
return He(
|
|
2050
|
+
addRowsOrColumns(t, r, s) {
|
|
2051
|
+
return He(t, r, s);
|
|
2040
2052
|
}
|
|
2041
2053
|
};
|
|
2042
|
-
}), ae = new P("trailingNode"),
|
|
2054
|
+
}), ae = new P("trailingNode"), Do = C(() => ({
|
|
2043
2055
|
key: "trailingNode",
|
|
2044
2056
|
prosemirrorPlugins: [
|
|
2045
2057
|
new T({
|
|
2046
2058
|
key: ae,
|
|
2047
|
-
appendTransaction: (n, e,
|
|
2048
|
-
const { doc:
|
|
2059
|
+
appendTransaction: (n, e, o) => {
|
|
2060
|
+
const { doc: t, tr: r, schema: s } = o, i = ae.getState(o), a = t.content.size - 2, c = s.nodes.blockContainer, l = s.nodes.paragraph;
|
|
2049
2061
|
if (i)
|
|
2050
2062
|
return r.insert(
|
|
2051
2063
|
a,
|
|
@@ -2058,15 +2070,15 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
|
|
|
2058
2070
|
apply: (n, e) => {
|
|
2059
2071
|
if (!n.docChanged)
|
|
2060
2072
|
return e;
|
|
2061
|
-
let
|
|
2062
|
-
if (!
|
|
2073
|
+
let o = n.doc.lastChild;
|
|
2074
|
+
if (!o || o.type.name !== "blockGroup")
|
|
2063
2075
|
throw new Error("Expected blockGroup");
|
|
2064
|
-
if (
|
|
2076
|
+
if (o = o.lastChild, !o || o.type.name !== "blockContainer")
|
|
2065
2077
|
return !0;
|
|
2066
|
-
const
|
|
2067
|
-
if (!
|
|
2078
|
+
const t = o.firstChild;
|
|
2079
|
+
if (!t)
|
|
2068
2080
|
throw new Error("Expected blockContent");
|
|
2069
|
-
return
|
|
2081
|
+
return o.nodeSize > 4 || t.type.spec.content !== "inline*";
|
|
2070
2082
|
}
|
|
2071
2083
|
}
|
|
2072
2084
|
})
|
|
@@ -2076,13 +2088,13 @@ export {
|
|
|
2076
2088
|
fo as B,
|
|
2077
2089
|
yo as D,
|
|
2078
2090
|
go as F,
|
|
2079
|
-
|
|
2080
|
-
|
|
2091
|
+
ko as H,
|
|
2092
|
+
Co as L,
|
|
2081
2093
|
xo as N,
|
|
2082
2094
|
Eo as P,
|
|
2083
2095
|
wo as S,
|
|
2084
2096
|
Kt as T,
|
|
2085
|
-
|
|
2097
|
+
vo as V,
|
|
2086
2098
|
oe as Y,
|
|
2087
2099
|
F as a,
|
|
2088
2100
|
$ as b,
|
|
@@ -2092,13 +2104,13 @@ export {
|
|
|
2092
2104
|
Ft as f,
|
|
2093
2105
|
To as g,
|
|
2094
2106
|
Po as h,
|
|
2095
|
-
|
|
2107
|
+
Do as i,
|
|
2096
2108
|
xt as j,
|
|
2097
|
-
|
|
2109
|
+
Ce as k,
|
|
2098
2110
|
Bo as l,
|
|
2099
2111
|
xe as m,
|
|
2100
2112
|
Rt as n,
|
|
2101
2113
|
$t as s,
|
|
2102
|
-
|
|
2114
|
+
O as t
|
|
2103
2115
|
};
|
|
2104
|
-
//# sourceMappingURL=TrailingNode-
|
|
2116
|
+
//# sourceMappingURL=TrailingNode-DZag-Nvu.js.map
|