@blocknote/xl-multi-column 0.42.3 → 0.44.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/blocknote-xl-multi-column.cjs +1 -1
- package/dist/blocknote-xl-multi-column.cjs.map +1 -1
- package/dist/blocknote-xl-multi-column.js +158 -155
- package/dist/blocknote-xl-multi-column.js.map +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +3 -3
- package/src/extensions/ColumnResize/ColumnResizeExtension.ts +7 -3
- package/src/extensions/SuggestionMenu/getMultiColumnSlashMenuItems.tsx +3 -3
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var p = (o, e, t) =>
|
|
4
|
-
import { Extension as
|
|
5
|
-
import { getNodeById as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
var F = Object.defineProperty;
|
|
2
|
+
var Y = (o, e, t) => e in o ? F(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var p = (o, e, t) => Y(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Extension as Z, Node as j } from "@tiptap/core";
|
|
5
|
+
import { getNodeById as S, createBlockSpecFromTiptapNode as z, BlockNoteSchema as q, getBlockInfo as $, nodeToBlock as x, UniqueID as J, getNearestBlockPos as Q } from "@blocknote/core";
|
|
6
|
+
import { SideMenuExtension as E, insertOrUpdateBlockForSlashMenu as B } from "@blocknote/core/extensions";
|
|
7
|
+
import { Plugin as H, PluginKey as ee } from "prosemirror-state";
|
|
8
|
+
import { DecorationSet as D, Decoration as N } from "prosemirror-view";
|
|
9
|
+
import { dropPoint as te } from "prosemirror-transform";
|
|
10
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
10
11
|
import v from "react";
|
|
11
|
-
const
|
|
12
|
+
const oe = {
|
|
12
13
|
slash_menu: {
|
|
13
14
|
two_columns: {
|
|
14
15
|
title: "عمودان",
|
|
@@ -23,7 +24,7 @@ const te = {
|
|
|
23
24
|
group: "الكتل الأساسية"
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
|
-
},
|
|
27
|
+
}, ne = {
|
|
27
28
|
slash_menu: {
|
|
28
29
|
two_columns: {
|
|
29
30
|
title: "Zwei Spalten",
|
|
@@ -38,7 +39,7 @@ const te = {
|
|
|
38
39
|
group: "Grundlegende Blöcke"
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
},
|
|
42
|
+
}, ie = {
|
|
42
43
|
slash_menu: {
|
|
43
44
|
two_columns: {
|
|
44
45
|
title: "Two Columns",
|
|
@@ -53,7 +54,7 @@ const te = {
|
|
|
53
54
|
group: "Basic blocks"
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
},
|
|
57
|
+
}, se = {
|
|
57
58
|
slash_menu: {
|
|
58
59
|
two_columns: {
|
|
59
60
|
title: "Dos Columnas",
|
|
@@ -68,7 +69,7 @@ const te = {
|
|
|
68
69
|
group: "Bloques básicos"
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
|
-
},
|
|
72
|
+
}, re = {
|
|
72
73
|
slash_menu: {
|
|
73
74
|
two_columns: {
|
|
74
75
|
title: "Deux Colonnes",
|
|
@@ -83,7 +84,7 @@ const te = {
|
|
|
83
84
|
group: "Blocs de base"
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
|
-
},
|
|
87
|
+
}, le = {
|
|
87
88
|
slash_menu: {
|
|
88
89
|
two_columns: {
|
|
89
90
|
title: "Dva Stupca",
|
|
@@ -98,7 +99,7 @@ const te = {
|
|
|
98
99
|
group: "Osnovni blokovi"
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
|
-
},
|
|
102
|
+
}, ce = {
|
|
102
103
|
slash_menu: {
|
|
103
104
|
two_columns: {
|
|
104
105
|
title: "Tvær Dálkar",
|
|
@@ -113,7 +114,7 @@ const te = {
|
|
|
113
114
|
group: "Grunnblokkar"
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
|
-
},
|
|
117
|
+
}, ae = {
|
|
117
118
|
slash_menu: {
|
|
118
119
|
two_columns: {
|
|
119
120
|
title: "二列",
|
|
@@ -128,7 +129,7 @@ const te = {
|
|
|
128
129
|
group: "基本ブロック"
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
|
-
},
|
|
132
|
+
}, ue = {
|
|
132
133
|
slash_menu: {
|
|
133
134
|
two_columns: {
|
|
134
135
|
title: "두 열",
|
|
@@ -143,7 +144,7 @@ const te = {
|
|
|
143
144
|
group: "기본 블록"
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
|
-
},
|
|
147
|
+
}, de = {
|
|
147
148
|
slash_menu: {
|
|
148
149
|
two_columns: {
|
|
149
150
|
title: "Twee Kolommen",
|
|
@@ -158,7 +159,7 @@ const te = {
|
|
|
158
159
|
group: "Basisblokken"
|
|
159
160
|
}
|
|
160
161
|
}
|
|
161
|
-
},
|
|
162
|
+
}, he = {
|
|
162
163
|
slash_menu: {
|
|
163
164
|
two_columns: {
|
|
164
165
|
title: "Dwie Kolumny",
|
|
@@ -173,7 +174,7 @@ const te = {
|
|
|
173
174
|
group: "Podstawowe bloki"
|
|
174
175
|
}
|
|
175
176
|
}
|
|
176
|
-
},
|
|
177
|
+
}, me = {
|
|
177
178
|
slash_menu: {
|
|
178
179
|
two_columns: {
|
|
179
180
|
title: "Duas Colunas",
|
|
@@ -188,7 +189,7 @@ const te = {
|
|
|
188
189
|
group: "Blocos básicos"
|
|
189
190
|
}
|
|
190
191
|
}
|
|
191
|
-
},
|
|
192
|
+
}, pe = {
|
|
192
193
|
slash_menu: {
|
|
193
194
|
two_columns: {
|
|
194
195
|
title: "Два Столбца",
|
|
@@ -203,7 +204,7 @@ const te = {
|
|
|
203
204
|
group: "Базовые блоки"
|
|
204
205
|
}
|
|
205
206
|
}
|
|
206
|
-
},
|
|
207
|
+
}, fe = {
|
|
207
208
|
slash_menu: {
|
|
208
209
|
two_columns: {
|
|
209
210
|
title: "Hai Cột",
|
|
@@ -218,7 +219,7 @@ const te = {
|
|
|
218
219
|
group: "Khối cơ bản"
|
|
219
220
|
}
|
|
220
221
|
}
|
|
221
|
-
},
|
|
222
|
+
}, ge = {
|
|
222
223
|
slash_menu: {
|
|
223
224
|
two_columns: {
|
|
224
225
|
title: "两列",
|
|
@@ -233,31 +234,31 @@ const te = {
|
|
|
233
234
|
group: "基础"
|
|
234
235
|
}
|
|
235
236
|
}
|
|
236
|
-
},
|
|
237
|
+
}, Xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
237
238
|
__proto__: null,
|
|
238
|
-
ar:
|
|
239
|
-
de:
|
|
240
|
-
en:
|
|
241
|
-
es:
|
|
242
|
-
fr:
|
|
243
|
-
hr:
|
|
244
|
-
is:
|
|
245
|
-
ja:
|
|
246
|
-
ko:
|
|
247
|
-
nl:
|
|
248
|
-
pl:
|
|
249
|
-
pt:
|
|
250
|
-
ru:
|
|
251
|
-
vi:
|
|
252
|
-
zh:
|
|
239
|
+
ar: oe,
|
|
240
|
+
de: ne,
|
|
241
|
+
en: ie,
|
|
242
|
+
es: se,
|
|
243
|
+
fr: re,
|
|
244
|
+
hr: le,
|
|
245
|
+
is: ce,
|
|
246
|
+
ja: ae,
|
|
247
|
+
ko: ue,
|
|
248
|
+
nl: de,
|
|
249
|
+
pl: he,
|
|
250
|
+
pt: me,
|
|
251
|
+
ru: pe,
|
|
252
|
+
vi: fe,
|
|
253
|
+
zh: ge
|
|
253
254
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
254
|
-
function
|
|
255
|
+
function M(o) {
|
|
255
256
|
if (!o.dictionary.multi_column)
|
|
256
257
|
throw new Error("Multi-column dictionary not found");
|
|
257
258
|
return o.dictionary.multi_column;
|
|
258
259
|
}
|
|
259
|
-
const C = new
|
|
260
|
-
class
|
|
260
|
+
const C = new ee("ColumnResizePlugin");
|
|
261
|
+
class be {
|
|
261
262
|
constructor(e, t) {
|
|
262
263
|
p(this, "editor");
|
|
263
264
|
p(this, "view");
|
|
@@ -274,11 +275,11 @@ class ge {
|
|
|
274
275
|
);
|
|
275
276
|
if (!n)
|
|
276
277
|
return { type: "default" };
|
|
277
|
-
const
|
|
278
|
+
const s = e.clientX, d = n.getBoundingClientRect(), c = s < d.left + this.RESIZE_MARGIN_WIDTH_PX ? "left" : s > d.right - this.RESIZE_MARGIN_WIDTH_PX ? "right" : "none", l = c === "left" ? n.previousElementSibling : c === "right" ? n.nextElementSibling : void 0;
|
|
278
279
|
if (!l)
|
|
279
280
|
return { type: "default" };
|
|
280
|
-
const i = c === "left" ? l : n, g = c === "left" ? n : l, a = i.getAttribute("data-id"),
|
|
281
|
-
|
|
281
|
+
const i = c === "left" ? l : n, g = c === "left" ? n : l, a = i.getAttribute("data-id"), r = g.getAttribute("data-id"), u = S(a, this.view.state.doc), m = S(
|
|
282
|
+
r,
|
|
282
283
|
this.view.state.doc
|
|
283
284
|
);
|
|
284
285
|
if (!u || !m || !u.posBeforeNode)
|
|
@@ -292,7 +293,7 @@ class ge {
|
|
|
292
293
|
},
|
|
293
294
|
rightColumn: {
|
|
294
295
|
element: g,
|
|
295
|
-
id:
|
|
296
|
+
id: r,
|
|
296
297
|
...m
|
|
297
298
|
}
|
|
298
299
|
};
|
|
@@ -301,17 +302,18 @@ class ge {
|
|
|
301
302
|
// want to set the plugin state to resize, so the columns can be resized
|
|
302
303
|
// by moving the mouse.
|
|
303
304
|
p(this, "mouseDownHandler", (e) => {
|
|
305
|
+
var i;
|
|
304
306
|
let t = this.getColumnHoverOrDefaultState(e);
|
|
305
307
|
if (t.type === "default")
|
|
306
308
|
return;
|
|
307
309
|
e.preventDefault();
|
|
308
|
-
const n = e.clientX,
|
|
310
|
+
const n = e.clientX, s = t.leftColumn.element.getBoundingClientRect().width, d = t.rightColumn.element.getBoundingClientRect().width, c = t.leftColumn.node.attrs.width, l = t.rightColumn.node.attrs.width;
|
|
309
311
|
t = {
|
|
310
312
|
type: "resize",
|
|
311
313
|
startPos: n,
|
|
312
314
|
leftColumn: {
|
|
313
315
|
...t.leftColumn,
|
|
314
|
-
widthPx:
|
|
316
|
+
widthPx: s,
|
|
315
317
|
widthPercent: c
|
|
316
318
|
},
|
|
317
319
|
rightColumn: {
|
|
@@ -321,7 +323,7 @@ class ge {
|
|
|
321
323
|
}
|
|
322
324
|
}, this.view.dispatch(
|
|
323
325
|
this.view.state.tr.setMeta(C, t)
|
|
324
|
-
), this.editor.
|
|
326
|
+
), (i = this.editor.getExtension(E)) == null || i.freezeMenu();
|
|
325
327
|
});
|
|
326
328
|
// If the plugin isn't in a resize state, we want to update it to either a
|
|
327
329
|
// hover state if the mouse is near the boundary between two columns, or
|
|
@@ -333,15 +335,15 @@ class ge {
|
|
|
333
335
|
if (!t)
|
|
334
336
|
return;
|
|
335
337
|
if (t.type !== "resize") {
|
|
336
|
-
const a = this.getColumnHoverOrDefaultState(e),
|
|
337
|
-
if (
|
|
338
|
+
const a = this.getColumnHoverOrDefaultState(e), r = t.type === "default" && a.type === "default", u = t.type !== "default" && a.type !== "default" && t.leftColumn.id === a.leftColumn.id && t.rightColumn.id === a.rightColumn.id;
|
|
339
|
+
if (r || u || a.type === "hover" && ((g = (i = this.editor.getExtension(E)) == null ? void 0 : i.store.state) != null && g.show))
|
|
338
340
|
return;
|
|
339
341
|
this.view.dispatch(
|
|
340
342
|
this.view.state.tr.setMeta(C, a)
|
|
341
343
|
);
|
|
342
344
|
return;
|
|
343
345
|
}
|
|
344
|
-
const
|
|
346
|
+
const s = (e.clientX - t.startPos) * t.leftColumn.widthPercent, d = (t.leftColumn.widthPx + s) / t.leftColumn.widthPx - 1;
|
|
345
347
|
let c = t.leftColumn.widthPercent + d, l = t.rightColumn.widthPercent - d;
|
|
346
348
|
c < this.COLUMN_MIN_WIDTH_PERCENT ? (l -= this.COLUMN_MIN_WIDTH_PERCENT - c, c = this.COLUMN_MIN_WIDTH_PERCENT) : l < this.COLUMN_MIN_WIDTH_PERCENT && (c -= this.COLUMN_MIN_WIDTH_PERCENT - l, l = this.COLUMN_MIN_WIDTH_PERCENT), this.view.dispatch(
|
|
347
349
|
this.view.state.tr.setNodeAttribute(
|
|
@@ -359,13 +361,14 @@ class ge {
|
|
|
359
361
|
// or hover, depending on where the mouse cursor is, when the user
|
|
360
362
|
// releases the mouse button.
|
|
361
363
|
p(this, "mouseUpHandler", (e) => {
|
|
364
|
+
var s;
|
|
362
365
|
const t = C.getState(this.view.state);
|
|
363
366
|
if (!t || t.type !== "resize")
|
|
364
367
|
return;
|
|
365
368
|
const n = this.getColumnHoverOrDefaultState(e);
|
|
366
369
|
this.view.dispatch(
|
|
367
370
|
this.view.state.tr.setMeta(C, n)
|
|
368
|
-
), this.editor.
|
|
371
|
+
), (s = this.editor.getExtension(E)) == null || s.unfreezeMenu();
|
|
369
372
|
});
|
|
370
373
|
this.editor = e, this.view = t, this.view.dom.addEventListener("mousedown", this.mouseDownHandler), document.body.addEventListener("mousemove", this.mouseMoveHandler), document.body.addEventListener("mouseup", this.mouseUpHandler);
|
|
371
374
|
}
|
|
@@ -373,7 +376,7 @@ class ge {
|
|
|
373
376
|
this.view.dom.removeEventListener("mousedown", this.mouseDownHandler), document.body.removeEventListener("mousemove", this.mouseMoveHandler), document.body.removeEventListener("mouseup", this.mouseUpHandler);
|
|
374
377
|
}
|
|
375
378
|
}
|
|
376
|
-
const
|
|
379
|
+
const we = (o) => new H({
|
|
377
380
|
key: C,
|
|
378
381
|
props: {
|
|
379
382
|
// This adds a border between the columns when the user is
|
|
@@ -381,14 +384,14 @@ const be = (o) => new z({
|
|
|
381
384
|
decorations: (e) => {
|
|
382
385
|
const t = C.getState(e);
|
|
383
386
|
return !t || t.type === "default" ? D.empty : D.create(e.doc, [
|
|
384
|
-
|
|
387
|
+
N.node(
|
|
385
388
|
t.leftColumn.posBeforeNode,
|
|
386
389
|
t.leftColumn.posBeforeNode + t.leftColumn.node.nodeSize,
|
|
387
390
|
{
|
|
388
391
|
style: "box-shadow: 4px 0 0 #ccc; cursor: col-resize"
|
|
389
392
|
}
|
|
390
393
|
),
|
|
391
|
-
|
|
394
|
+
N.node(
|
|
392
395
|
t.rightColumn.posBeforeNode,
|
|
393
396
|
t.rightColumn.posBeforeNode + t.rightColumn.node.nodeSize,
|
|
394
397
|
{
|
|
@@ -405,13 +408,13 @@ const be = (o) => new z({
|
|
|
405
408
|
return n === void 0 ? t : n;
|
|
406
409
|
}
|
|
407
410
|
},
|
|
408
|
-
view: (e) => new
|
|
409
|
-
}),
|
|
411
|
+
view: (e) => new be(o, e)
|
|
412
|
+
}), Ce = (o) => Z.create({
|
|
410
413
|
name: "columnResize",
|
|
411
414
|
addProseMirrorPlugins() {
|
|
412
|
-
return [
|
|
415
|
+
return [we(o)];
|
|
413
416
|
}
|
|
414
|
-
}),
|
|
417
|
+
}), ve = j.create({
|
|
415
418
|
name: "column",
|
|
416
419
|
group: "bnBlock childContainer",
|
|
417
420
|
// A block always contains content, and optionally a blockGroup which contains nested blocks
|
|
@@ -468,9 +471,9 @@ const be = (o) => new z({
|
|
|
468
471
|
};
|
|
469
472
|
},
|
|
470
473
|
addExtensions() {
|
|
471
|
-
return [
|
|
474
|
+
return [Ce(this.options.editor)];
|
|
472
475
|
}
|
|
473
|
-
}),
|
|
476
|
+
}), ye = j.create({
|
|
474
477
|
name: "columnList",
|
|
475
478
|
group: "childContainer bnBlock blockGroupChild",
|
|
476
479
|
// A block always contains content, and optionally a blockGroup which contains nested blocks
|
|
@@ -498,9 +501,9 @@ const be = (o) => new z({
|
|
|
498
501
|
contentDOM: e
|
|
499
502
|
};
|
|
500
503
|
}
|
|
501
|
-
}),
|
|
504
|
+
}), W = z(
|
|
502
505
|
{
|
|
503
|
-
node:
|
|
506
|
+
node: ve,
|
|
504
507
|
type: "column",
|
|
505
508
|
content: "none"
|
|
506
509
|
},
|
|
@@ -509,44 +512,44 @@ const be = (o) => new z({
|
|
|
509
512
|
default: 1
|
|
510
513
|
}
|
|
511
514
|
}
|
|
512
|
-
),
|
|
515
|
+
), A = z(
|
|
513
516
|
{
|
|
514
|
-
node:
|
|
517
|
+
node: ye,
|
|
515
518
|
type: "columnList",
|
|
516
519
|
content: "none"
|
|
517
520
|
},
|
|
518
521
|
{}
|
|
519
|
-
),
|
|
522
|
+
), I = q.create({
|
|
520
523
|
blockSpecs: {
|
|
521
|
-
column:
|
|
522
|
-
columnList:
|
|
524
|
+
column: W,
|
|
525
|
+
columnList: A
|
|
523
526
|
}
|
|
524
|
-
}),
|
|
527
|
+
}), Ue = (o) => o.extend({
|
|
525
528
|
blockSpecs: {
|
|
526
|
-
column:
|
|
527
|
-
columnList:
|
|
529
|
+
column: W,
|
|
530
|
+
columnList: A
|
|
528
531
|
}
|
|
529
532
|
}), k = 0.1;
|
|
530
|
-
function
|
|
533
|
+
function ke(o) {
|
|
531
534
|
return { left: o.clientX, top: o.clientY };
|
|
532
535
|
}
|
|
533
|
-
function
|
|
536
|
+
function Ge(o) {
|
|
534
537
|
const e = o.editor;
|
|
535
|
-
return new
|
|
538
|
+
return new H({
|
|
536
539
|
view(t) {
|
|
537
|
-
return new
|
|
540
|
+
return new _e(t, o);
|
|
538
541
|
},
|
|
539
542
|
props: {
|
|
540
|
-
handleDrop(t, n,
|
|
541
|
-
const c = t.posAtCoords(
|
|
543
|
+
handleDrop(t, n, s, d) {
|
|
544
|
+
const c = t.posAtCoords(ke(n));
|
|
542
545
|
if (!c)
|
|
543
546
|
throw new Error("Could not get event position");
|
|
544
|
-
const l =
|
|
545
|
-
let
|
|
546
|
-
if (n.clientX <= a.left + a.width * k && (
|
|
547
|
+
const l = V(t.state, c), i = $(l), a = t.nodeDOM(l.posBeforeNode).getBoundingClientRect();
|
|
548
|
+
let r = "regular";
|
|
549
|
+
if (n.clientX <= a.left + a.width * k && (r = "left"), n.clientX >= a.right - a.width * k && (r = "right"), r === "regular")
|
|
547
550
|
return !1;
|
|
548
551
|
const u = x(
|
|
549
|
-
|
|
552
|
+
s.content.child(0),
|
|
550
553
|
e.pmSchema
|
|
551
554
|
// TODO: cache?
|
|
552
555
|
);
|
|
@@ -566,28 +569,28 @@ function Xe(o) {
|
|
|
566
569
|
y.props.width = y.props.width * b;
|
|
567
570
|
});
|
|
568
571
|
}
|
|
569
|
-
const
|
|
572
|
+
const O = h.children.findIndex(
|
|
570
573
|
(b) => b.id === i.bnBlock.node.attrs.id
|
|
571
|
-
),
|
|
574
|
+
), K = h.children.map((b) => ({
|
|
572
575
|
...b,
|
|
573
576
|
children: b.children.filter(
|
|
574
577
|
(y) => y.id !== u.id
|
|
575
578
|
)
|
|
576
|
-
})).filter((b) => b.children.length > 0).toSpliced(
|
|
579
|
+
})).filter((b) => b.children.length > 0).toSpliced(r === "left" ? O : O + 1, 0, {
|
|
577
580
|
type: "column",
|
|
578
581
|
children: [u],
|
|
579
582
|
props: {},
|
|
580
583
|
content: void 0,
|
|
581
|
-
id:
|
|
584
|
+
id: J.options.generateID()
|
|
582
585
|
});
|
|
583
586
|
e.getBlock(u.id) && e.removeBlocks([u]), e.updateBlock(h, {
|
|
584
|
-
children:
|
|
587
|
+
children: K
|
|
585
588
|
});
|
|
586
589
|
} else {
|
|
587
590
|
const m = x(i.bnBlock.node, e.pmSchema);
|
|
588
591
|
if (m.id === u.id)
|
|
589
592
|
return;
|
|
590
|
-
const h =
|
|
593
|
+
const h = r === "left" ? [u, m] : [m, u];
|
|
591
594
|
e.getBlock(u.id) && e.removeBlocks([u]), e.replaceBlocks(
|
|
592
595
|
[m],
|
|
593
596
|
[
|
|
@@ -606,7 +609,7 @@ function Xe(o) {
|
|
|
606
609
|
}
|
|
607
610
|
});
|
|
608
611
|
}
|
|
609
|
-
class
|
|
612
|
+
class _e {
|
|
610
613
|
constructor(e, t) {
|
|
611
614
|
p(this, "width");
|
|
612
615
|
p(this, "color");
|
|
@@ -616,17 +619,17 @@ class ke {
|
|
|
616
619
|
p(this, "timeout");
|
|
617
620
|
p(this, "handlers");
|
|
618
621
|
this.editorView = e, this.width = t.width ?? 1, this.color = t.color === !1 ? void 0 : t.color || "black", this.class = t.class, this.handlers = ["dragover", "dragend", "drop", "dragleave"].map((n) => {
|
|
619
|
-
const
|
|
622
|
+
const s = (d) => {
|
|
620
623
|
this[n](d);
|
|
621
624
|
};
|
|
622
625
|
return e.dom.addEventListener(
|
|
623
626
|
n,
|
|
624
|
-
|
|
627
|
+
s,
|
|
625
628
|
// drop event captured in bubbling phase to make sure
|
|
626
629
|
// "cursorPos" is set to undefined before the "handleDrop" handler is called
|
|
627
630
|
// (otherwise an error could be thrown, see https://github.com/TypeCellOS/BlockNote/pull/1240)
|
|
628
631
|
n === "drop" ? !0 : void 0
|
|
629
|
-
), { name: n, handler:
|
|
632
|
+
), { name: n, handler: s };
|
|
630
633
|
});
|
|
631
634
|
}
|
|
632
635
|
destroy() {
|
|
@@ -650,10 +653,10 @@ class ke {
|
|
|
650
653
|
throw new Error("updateOverlay called with no cursor position");
|
|
651
654
|
const e = this.editorView.state.doc.resolve(this.cursorPos.pos), t = !e.parent.inlineContent;
|
|
652
655
|
let n;
|
|
653
|
-
const
|
|
656
|
+
const s = this.editorView.dom, d = s.getBoundingClientRect(), c = d.width / s.offsetWidth, l = d.height / s.offsetHeight;
|
|
654
657
|
if (t) {
|
|
655
|
-
const
|
|
656
|
-
if (
|
|
658
|
+
const r = e.nodeBefore, u = e.nodeAfter;
|
|
659
|
+
if (r || u)
|
|
657
660
|
if (this.cursorPos.position === "left" || this.cursorPos.position === "right") {
|
|
658
661
|
const m = this.editorView.nodeDOM(this.cursorPos.pos);
|
|
659
662
|
if (!m)
|
|
@@ -669,12 +672,12 @@ class ke {
|
|
|
669
672
|
};
|
|
670
673
|
} else {
|
|
671
674
|
const m = this.editorView.nodeDOM(
|
|
672
|
-
this.cursorPos.pos - (
|
|
675
|
+
this.cursorPos.pos - (r ? r.nodeSize : 0)
|
|
673
676
|
);
|
|
674
677
|
if (m) {
|
|
675
678
|
const h = m.getBoundingClientRect();
|
|
676
|
-
let f =
|
|
677
|
-
|
|
679
|
+
let f = r ? h.bottom : h.top;
|
|
680
|
+
r && u && (f = (f + this.editorView.nodeDOM(this.cursorPos.pos).getBoundingClientRect().top) / 2);
|
|
678
681
|
const w = this.width / 2 * l;
|
|
679
682
|
this.cursorPos.position === "regular" && (n = {
|
|
680
683
|
left: h.left,
|
|
@@ -686,12 +689,12 @@ class ke {
|
|
|
686
689
|
}
|
|
687
690
|
}
|
|
688
691
|
if (!n) {
|
|
689
|
-
const
|
|
692
|
+
const r = this.editorView.coordsAtPos(this.cursorPos.pos), u = this.width / 2 * c;
|
|
690
693
|
n = {
|
|
691
|
-
left:
|
|
692
|
-
right:
|
|
693
|
-
top:
|
|
694
|
-
bottom:
|
|
694
|
+
left: r.left - u,
|
|
695
|
+
right: r.left + u,
|
|
696
|
+
top: r.top,
|
|
697
|
+
bottom: r.bottom
|
|
695
698
|
};
|
|
696
699
|
}
|
|
697
700
|
const i = this.editorView.dom.offsetParent;
|
|
@@ -703,8 +706,8 @@ class ke {
|
|
|
703
706
|
if (!i || i === document.body && getComputedStyle(i).position === "static")
|
|
704
707
|
g = -window.scrollX, a = -window.scrollY;
|
|
705
708
|
else {
|
|
706
|
-
const
|
|
707
|
-
g =
|
|
709
|
+
const r = i.getBoundingClientRect(), u = r.width / i.offsetWidth, m = r.height / i.offsetHeight;
|
|
710
|
+
g = r.left - i.scrollLeft * u, a = r.top - i.scrollTop * m;
|
|
708
711
|
}
|
|
709
712
|
this.element.style.left = (n.left - g) / c + "px", this.element.style.top = (n.top - a) / l + "px", this.element.style.width = (n.right - n.left) / c + "px", this.element.style.height = (n.bottom - n.top) / l + "px";
|
|
710
713
|
}
|
|
@@ -718,17 +721,17 @@ class ke {
|
|
|
718
721
|
const t = this.editorView.posAtCoords({
|
|
719
722
|
left: e.clientX,
|
|
720
723
|
top: e.clientY
|
|
721
|
-
}), n = t && t.inside >= 0 && this.editorView.state.doc.nodeAt(t.inside),
|
|
724
|
+
}), n = t && t.inside >= 0 && this.editorView.state.doc.nodeAt(t.inside), s = n && n.type.spec.disableDropCursor, d = typeof s == "function" ? s(this.editorView, t, e) : s;
|
|
722
725
|
if (t && !d) {
|
|
723
726
|
let c = "regular", l = t.pos;
|
|
724
|
-
const i =
|
|
727
|
+
const i = V(this.editorView.state, t), a = this.editorView.nodeDOM(i.posBeforeNode).getBoundingClientRect();
|
|
725
728
|
if (e.clientX <= a.left + a.width * k && (c = "left", l = i.posBeforeNode), e.clientX >= a.right - a.width * k && (c = "right", l = i.posBeforeNode), c === "regular" && this.editorView.dragging && this.editorView.dragging.slice) {
|
|
726
|
-
const
|
|
729
|
+
const r = te(
|
|
727
730
|
this.editorView.state.doc,
|
|
728
731
|
l,
|
|
729
732
|
this.editorView.dragging.slice
|
|
730
733
|
);
|
|
731
|
-
|
|
734
|
+
r != null && (l = r);
|
|
732
735
|
}
|
|
733
736
|
this.setCursor({ pos: l, position: c }), this.scheduleRemoval(5e3);
|
|
734
737
|
}
|
|
@@ -743,32 +746,32 @@ class ke {
|
|
|
743
746
|
(e.target === this.editorView.dom || !this.editorView.dom.contains(e.relatedTarget)) && this.setCursor(void 0);
|
|
744
747
|
}
|
|
745
748
|
}
|
|
746
|
-
function
|
|
747
|
-
const t =
|
|
749
|
+
function V(o, e) {
|
|
750
|
+
const t = Q(o.doc, e.pos);
|
|
748
751
|
let n = o.doc.resolve(t.posBeforeNode);
|
|
749
752
|
return n.parent.type.name === "column" && (n = o.doc.resolve(n.before())), {
|
|
750
753
|
posBeforeNode: n.pos,
|
|
751
754
|
node: n.nodeAfter
|
|
752
755
|
};
|
|
753
756
|
}
|
|
754
|
-
var
|
|
757
|
+
var X = {
|
|
755
758
|
color: void 0,
|
|
756
759
|
size: void 0,
|
|
757
760
|
className: void 0,
|
|
758
761
|
style: void 0,
|
|
759
762
|
attr: void 0
|
|
760
|
-
},
|
|
761
|
-
function
|
|
763
|
+
}, L = v.createContext && /* @__PURE__ */ v.createContext(X), Pe = ["attr", "size", "title"];
|
|
764
|
+
function xe(o, e) {
|
|
762
765
|
if (o == null) return {};
|
|
763
|
-
var t =
|
|
766
|
+
var t = Ee(o, e), n, s;
|
|
764
767
|
if (Object.getOwnPropertySymbols) {
|
|
765
768
|
var d = Object.getOwnPropertySymbols(o);
|
|
766
|
-
for (
|
|
767
|
-
n = d[
|
|
769
|
+
for (s = 0; s < d.length; s++)
|
|
770
|
+
n = d[s], !(e.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(o, n) && (t[n] = o[n]);
|
|
768
771
|
}
|
|
769
772
|
return t;
|
|
770
773
|
}
|
|
771
|
-
function
|
|
774
|
+
function Ee(o, e) {
|
|
772
775
|
if (o == null) return {};
|
|
773
776
|
var t = {};
|
|
774
777
|
for (var n in o)
|
|
@@ -788,12 +791,12 @@ function _() {
|
|
|
788
791
|
return o;
|
|
789
792
|
}, _.apply(this, arguments);
|
|
790
793
|
}
|
|
791
|
-
function
|
|
794
|
+
function R(o, e) {
|
|
792
795
|
var t = Object.keys(o);
|
|
793
796
|
if (Object.getOwnPropertySymbols) {
|
|
794
797
|
var n = Object.getOwnPropertySymbols(o);
|
|
795
|
-
e && (n = n.filter(function(
|
|
796
|
-
return Object.getOwnPropertyDescriptor(o,
|
|
798
|
+
e && (n = n.filter(function(s) {
|
|
799
|
+
return Object.getOwnPropertyDescriptor(o, s).enumerable;
|
|
797
800
|
})), t.push.apply(t, n);
|
|
798
801
|
}
|
|
799
802
|
return t;
|
|
@@ -801,18 +804,18 @@ function L(o, e) {
|
|
|
801
804
|
function P(o) {
|
|
802
805
|
for (var e = 1; e < arguments.length; e++) {
|
|
803
806
|
var t = arguments[e] != null ? arguments[e] : {};
|
|
804
|
-
e % 2 ?
|
|
805
|
-
|
|
806
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(o, Object.getOwnPropertyDescriptors(t)) :
|
|
807
|
+
e % 2 ? R(Object(t), !0).forEach(function(n) {
|
|
808
|
+
Oe(o, n, t[n]);
|
|
809
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(o, Object.getOwnPropertyDescriptors(t)) : R(Object(t)).forEach(function(n) {
|
|
807
810
|
Object.defineProperty(o, n, Object.getOwnPropertyDescriptor(t, n));
|
|
808
811
|
});
|
|
809
812
|
}
|
|
810
813
|
return o;
|
|
811
814
|
}
|
|
812
|
-
function
|
|
813
|
-
return e =
|
|
815
|
+
function Oe(o, e, t) {
|
|
816
|
+
return e = Se(e), e in o ? Object.defineProperty(o, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : o[e] = t, o;
|
|
814
817
|
}
|
|
815
|
-
function
|
|
818
|
+
function Se(o) {
|
|
816
819
|
var e = Be(o, "string");
|
|
817
820
|
return typeof e == "symbol" ? e : e + "";
|
|
818
821
|
}
|
|
@@ -826,23 +829,23 @@ function Be(o, e) {
|
|
|
826
829
|
}
|
|
827
830
|
return (e === "string" ? String : Number)(o);
|
|
828
831
|
}
|
|
829
|
-
function
|
|
832
|
+
function U(o) {
|
|
830
833
|
return o && o.map((e, t) => /* @__PURE__ */ v.createElement(e.tag, P({
|
|
831
834
|
key: t
|
|
832
|
-
}, e.attr),
|
|
835
|
+
}, e.attr), U(e.child)));
|
|
833
836
|
}
|
|
834
|
-
function
|
|
837
|
+
function G(o) {
|
|
835
838
|
return (e) => /* @__PURE__ */ v.createElement(De, _({
|
|
836
839
|
attr: P({}, o.attr)
|
|
837
|
-
}, e),
|
|
840
|
+
}, e), U(o.child));
|
|
838
841
|
}
|
|
839
842
|
function De(o) {
|
|
840
843
|
var e = (t) => {
|
|
841
844
|
var {
|
|
842
845
|
attr: n,
|
|
843
|
-
size:
|
|
846
|
+
size: s,
|
|
844
847
|
title: d
|
|
845
|
-
} = o, c =
|
|
848
|
+
} = o, c = xe(o, Pe), l = s || t.size || "1em", i;
|
|
846
849
|
return t.className && (i = t.className), o.className && (i = (i ? i + " " : "") + o.className), /* @__PURE__ */ v.createElement("svg", _({
|
|
847
850
|
stroke: "currentColor",
|
|
848
851
|
fill: "currentColor",
|
|
@@ -857,23 +860,23 @@ function De(o) {
|
|
|
857
860
|
xmlns: "http://www.w3.org/2000/svg"
|
|
858
861
|
}), d && /* @__PURE__ */ v.createElement("title", null, d), o.children);
|
|
859
862
|
};
|
|
860
|
-
return
|
|
861
|
-
}
|
|
862
|
-
function Se(o) {
|
|
863
|
-
return U({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M3 3m0 1a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1zm9 -1v18" }, child: [] }] })(o);
|
|
863
|
+
return L !== void 0 ? /* @__PURE__ */ v.createElement(L.Consumer, null, (t) => e(t)) : e(X);
|
|
864
864
|
}
|
|
865
865
|
function Ne(o) {
|
|
866
|
-
return
|
|
866
|
+
return G({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M3 3m0 1a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1zm9 -1v18" }, child: [] }] })(o);
|
|
867
867
|
}
|
|
868
868
|
function Te(o) {
|
|
869
|
-
return "
|
|
869
|
+
return G({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M3 3m0 1a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1zm6 -1v18m6 -18v18" }, child: [] }] })(o);
|
|
870
|
+
}
|
|
871
|
+
function Me(o) {
|
|
872
|
+
return "column" in o.schema.blockSchema && o.schema.blockSchema.columnList === I.blockSchema.columnList && "column" in o.schema.blockSchema && o.schema.blockSchema.column === I.blockSchema.column;
|
|
870
873
|
}
|
|
871
|
-
function
|
|
874
|
+
function Ke(o) {
|
|
872
875
|
const e = [];
|
|
873
|
-
return
|
|
876
|
+
return Me(o) && e.push(
|
|
874
877
|
{
|
|
875
|
-
...
|
|
876
|
-
icon: /* @__PURE__ */
|
|
878
|
+
...M(o).slash_menu.two_columns,
|
|
879
|
+
icon: /* @__PURE__ */ T(Ne, { size: 18 }),
|
|
877
880
|
onItemClick: () => {
|
|
878
881
|
B(o, {
|
|
879
882
|
type: "columnList",
|
|
@@ -899,8 +902,8 @@ function Ue(o) {
|
|
|
899
902
|
}
|
|
900
903
|
},
|
|
901
904
|
{
|
|
902
|
-
...
|
|
903
|
-
icon: /* @__PURE__ */
|
|
905
|
+
...M(o).slash_menu.three_columns,
|
|
906
|
+
icon: /* @__PURE__ */ T(Te, { size: 18 }),
|
|
904
907
|
onItemClick: () => {
|
|
905
908
|
B(o, {
|
|
906
909
|
type: "columnList",
|
|
@@ -936,14 +939,14 @@ function Ue(o) {
|
|
|
936
939
|
), e;
|
|
937
940
|
}
|
|
938
941
|
export {
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
942
|
+
W as ColumnBlock,
|
|
943
|
+
A as ColumnListBlock,
|
|
944
|
+
Me as checkMultiColumnBlocksInSchema,
|
|
945
|
+
M as getMultiColumnDictionary,
|
|
946
|
+
Ke as getMultiColumnSlashMenuItems,
|
|
947
|
+
Xe as locales,
|
|
948
|
+
Ge as multiColumnDropCursor,
|
|
949
|
+
I as multiColumnSchema,
|
|
950
|
+
Ue as withMultiColumn
|
|
948
951
|
};
|
|
949
952
|
//# sourceMappingURL=blocknote-xl-multi-column.js.map
|