@blocknote/xl-multi-column 0.47.1 → 0.47.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocknote-xl-multi-column.cjs +1 -1
- package/dist/blocknote-xl-multi-column.cjs.map +1 -1
- package/dist/blocknote-xl-multi-column.js +381 -485
- package/dist/blocknote-xl-multi-column.js.map +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +3 -3
- package/src/blocks/Columns/index.ts +2 -0
- package/src/extensions/DropCursor/multiColumnDropCursor.ts +112 -0
- package/src/extensions/DropCursor/multiColumnHandleDropPlugin.ts +162 -0
- package/src/index.ts +1 -1
- package/types/src/extensions/DropCursor/multiColumnDropCursor.d.ts +21 -0
- package/types/src/extensions/DropCursor/multiColumnHandleDropPlugin.d.ts +16 -0
- package/types/src/index.d.ts +1 -1
- package/src/extensions/DropCursor/MultiColumnDropCursorPlugin.ts +0 -508
- package/types/src/extensions/DropCursor/MultiColumnDropCursorPlugin.d.ts +0 -11
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { DecorationSet as
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
const oe = {
|
|
1
|
+
var U = Object.defineProperty;
|
|
2
|
+
var G = (e, t, o) => t in e ? U(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
|
+
var m = (e, t, o) => G(e, typeof t != "symbol" ? t + "" : t, o);
|
|
4
|
+
import { getNearestBlockPos as K, createExtension as X, getBlockInfo as F, nodeToBlock as y, UniqueID as Z, getNodeById as k, createBlockSpecFromTiptapNode as M, BlockNoteSchema as q } from "@blocknote/core";
|
|
5
|
+
import { Plugin as I, PluginKey as V } from "prosemirror-state";
|
|
6
|
+
import { Extension as Y, Node as L } from "@tiptap/core";
|
|
7
|
+
import { SideMenuExtension as _, insertOrUpdateBlockForSlashMenu as P } from "@blocknote/core/extensions";
|
|
8
|
+
import { DecorationSet as E, Decoration as x } from "prosemirror-view";
|
|
9
|
+
import { jsx as S } from "react/jsx-runtime";
|
|
10
|
+
import g from "react";
|
|
11
|
+
const $ = {
|
|
13
12
|
slash_menu: {
|
|
14
13
|
two_columns: {
|
|
15
14
|
title: "عمودان",
|
|
@@ -24,7 +23,7 @@ const oe = {
|
|
|
24
23
|
group: "الكتل الأساسية"
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
|
-
},
|
|
26
|
+
}, J = {
|
|
28
27
|
slash_menu: {
|
|
29
28
|
two_columns: {
|
|
30
29
|
title: "Zwei Spalten",
|
|
@@ -39,7 +38,7 @@ const oe = {
|
|
|
39
38
|
group: "Grundlegende Blöcke"
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
|
-
},
|
|
41
|
+
}, Q = {
|
|
43
42
|
slash_menu: {
|
|
44
43
|
two_columns: {
|
|
45
44
|
title: "Two Columns",
|
|
@@ -54,7 +53,7 @@ const oe = {
|
|
|
54
53
|
group: "Basic blocks"
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
|
-
},
|
|
56
|
+
}, ee = {
|
|
58
57
|
slash_menu: {
|
|
59
58
|
two_columns: {
|
|
60
59
|
title: "Dos Columnas",
|
|
@@ -69,7 +68,7 @@ const oe = {
|
|
|
69
68
|
group: "Bloques básicos"
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
|
-
},
|
|
71
|
+
}, te = {
|
|
73
72
|
slash_menu: {
|
|
74
73
|
two_columns: {
|
|
75
74
|
title: "Deux Colonnes",
|
|
@@ -84,7 +83,7 @@ const oe = {
|
|
|
84
83
|
group: "Blocs de base"
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
|
-
},
|
|
86
|
+
}, oe = {
|
|
88
87
|
slash_menu: {
|
|
89
88
|
two_columns: {
|
|
90
89
|
title: "Dva Stupca",
|
|
@@ -99,7 +98,7 @@ const oe = {
|
|
|
99
98
|
group: "Osnovni blokovi"
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
|
-
},
|
|
101
|
+
}, ne = {
|
|
103
102
|
slash_menu: {
|
|
104
103
|
two_columns: {
|
|
105
104
|
title: "Tvær Dálkar",
|
|
@@ -114,7 +113,7 @@ const oe = {
|
|
|
114
113
|
group: "Grunnblokkar"
|
|
115
114
|
}
|
|
116
115
|
}
|
|
117
|
-
},
|
|
116
|
+
}, ie = {
|
|
118
117
|
slash_menu: {
|
|
119
118
|
two_columns: {
|
|
120
119
|
title: "二列",
|
|
@@ -129,7 +128,7 @@ const oe = {
|
|
|
129
128
|
group: "基本ブロック"
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
|
-
},
|
|
131
|
+
}, re = {
|
|
133
132
|
slash_menu: {
|
|
134
133
|
two_columns: {
|
|
135
134
|
title: "두 열",
|
|
@@ -144,7 +143,7 @@ const oe = {
|
|
|
144
143
|
group: "기본 블록"
|
|
145
144
|
}
|
|
146
145
|
}
|
|
147
|
-
},
|
|
146
|
+
}, le = {
|
|
148
147
|
slash_menu: {
|
|
149
148
|
two_columns: {
|
|
150
149
|
title: "Twee Kolommen",
|
|
@@ -159,7 +158,7 @@ const oe = {
|
|
|
159
158
|
group: "Basisblokken"
|
|
160
159
|
}
|
|
161
160
|
}
|
|
162
|
-
},
|
|
161
|
+
}, se = {
|
|
163
162
|
slash_menu: {
|
|
164
163
|
two_columns: {
|
|
165
164
|
title: "Dwie Kolumny",
|
|
@@ -174,7 +173,7 @@ const oe = {
|
|
|
174
173
|
group: "Podstawowe bloki"
|
|
175
174
|
}
|
|
176
175
|
}
|
|
177
|
-
},
|
|
176
|
+
}, ue = {
|
|
178
177
|
slash_menu: {
|
|
179
178
|
two_columns: {
|
|
180
179
|
title: "Duas Colunas",
|
|
@@ -189,7 +188,7 @@ const oe = {
|
|
|
189
188
|
group: "Blocos básicos"
|
|
190
189
|
}
|
|
191
190
|
}
|
|
192
|
-
},
|
|
191
|
+
}, ae = {
|
|
193
192
|
slash_menu: {
|
|
194
193
|
two_columns: {
|
|
195
194
|
title: "Два Столбца",
|
|
@@ -204,7 +203,7 @@ const oe = {
|
|
|
204
203
|
group: "Базовые блоки"
|
|
205
204
|
}
|
|
206
205
|
}
|
|
207
|
-
},
|
|
206
|
+
}, ce = {
|
|
208
207
|
slash_menu: {
|
|
209
208
|
two_columns: {
|
|
210
209
|
title: "Hai Cột",
|
|
@@ -219,7 +218,7 @@ const oe = {
|
|
|
219
218
|
group: "Khối cơ bản"
|
|
220
219
|
}
|
|
221
220
|
}
|
|
222
|
-
},
|
|
221
|
+
}, de = {
|
|
223
222
|
slash_menu: {
|
|
224
223
|
two_columns: {
|
|
225
224
|
title: "两列",
|
|
@@ -234,166 +233,285 @@ const oe = {
|
|
|
234
233
|
group: "基础"
|
|
235
234
|
}
|
|
236
235
|
}
|
|
237
|
-
},
|
|
236
|
+
}, He = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
238
237
|
__proto__: null,
|
|
239
|
-
ar:
|
|
240
|
-
de:
|
|
241
|
-
en:
|
|
242
|
-
es:
|
|
243
|
-
fr:
|
|
244
|
-
hr:
|
|
245
|
-
is:
|
|
246
|
-
ja:
|
|
247
|
-
ko:
|
|
248
|
-
nl:
|
|
249
|
-
pl:
|
|
250
|
-
pt:
|
|
251
|
-
ru:
|
|
252
|
-
vi:
|
|
253
|
-
zh:
|
|
238
|
+
ar: $,
|
|
239
|
+
de: J,
|
|
240
|
+
en: Q,
|
|
241
|
+
es: ee,
|
|
242
|
+
fr: te,
|
|
243
|
+
hr: oe,
|
|
244
|
+
is: ne,
|
|
245
|
+
ja: ie,
|
|
246
|
+
ko: re,
|
|
247
|
+
nl: le,
|
|
248
|
+
pl: se,
|
|
249
|
+
pt: ue,
|
|
250
|
+
ru: ae,
|
|
251
|
+
vi: ce,
|
|
252
|
+
zh: de
|
|
254
253
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
255
|
-
function
|
|
256
|
-
if (!
|
|
254
|
+
function N(e) {
|
|
255
|
+
if (!e.dictionary.multi_column)
|
|
257
256
|
throw new Error("Multi-column dictionary not found");
|
|
258
|
-
return
|
|
257
|
+
return e.dictionary.multi_column;
|
|
258
|
+
}
|
|
259
|
+
const B = 0.1;
|
|
260
|
+
function j(e, t, o) {
|
|
261
|
+
const n = t.posAtCoords({
|
|
262
|
+
left: e.clientX,
|
|
263
|
+
top: e.clientY
|
|
264
|
+
});
|
|
265
|
+
if (!n)
|
|
266
|
+
return null;
|
|
267
|
+
const u = K(o.doc, n.pos);
|
|
268
|
+
let l = o.doc.resolve(u.posBeforeNode);
|
|
269
|
+
l.parent.type.name === "column" && (l = o.doc.resolve(l.before()));
|
|
270
|
+
const s = {
|
|
271
|
+
posBeforeNode: l.pos,
|
|
272
|
+
node: l.nodeAfter
|
|
273
|
+
}, i = t.nodeDOM(s.posBeforeNode);
|
|
274
|
+
if (i === null)
|
|
275
|
+
return {
|
|
276
|
+
position: "regular",
|
|
277
|
+
posBeforeNode: s.posBeforeNode,
|
|
278
|
+
node: s.node
|
|
279
|
+
};
|
|
280
|
+
const r = i.getBoundingClientRect();
|
|
281
|
+
let a = "regular";
|
|
282
|
+
return e.clientX <= r.left + r.width * B ? a = "left" : e.clientX >= r.right - r.width * B && (a = "right"), {
|
|
283
|
+
position: a,
|
|
284
|
+
posBeforeNode: s.posBeforeNode,
|
|
285
|
+
node: s.node
|
|
286
|
+
};
|
|
259
287
|
}
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
288
|
+
const ze = {
|
|
289
|
+
hooks: {
|
|
290
|
+
computeDropPosition: (e) => {
|
|
291
|
+
const t = j(
|
|
292
|
+
e.event,
|
|
293
|
+
e.view,
|
|
294
|
+
e.view.state
|
|
295
|
+
);
|
|
296
|
+
return t === null || t.position === "regular" ? e.defaultPosition : {
|
|
297
|
+
pos: t.posBeforeNode,
|
|
298
|
+
orientation: t.position === "left" ? "block-vertical-left" : "block-vertical-right"
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
function me(e) {
|
|
304
|
+
return new I({
|
|
305
|
+
props: {
|
|
306
|
+
handleDrop(t, o, n, u) {
|
|
307
|
+
const l = j(o, t, t.state);
|
|
308
|
+
if (l === null)
|
|
309
|
+
return !1;
|
|
310
|
+
const s = F(l);
|
|
311
|
+
if (l.position === "regular" || n.content.childCount === 0)
|
|
312
|
+
return !1;
|
|
313
|
+
const i = y(
|
|
314
|
+
n.content.child(0),
|
|
315
|
+
e.pmSchema
|
|
316
|
+
);
|
|
317
|
+
if (s.blockNoteType === "column") {
|
|
318
|
+
const r = t.state.doc.resolve(s.bnBlock.beforePos).node(), a = y(
|
|
319
|
+
r,
|
|
320
|
+
e.pmSchema
|
|
321
|
+
);
|
|
322
|
+
let c = 0;
|
|
323
|
+
a.children.forEach((d) => {
|
|
324
|
+
c += d.props.width;
|
|
325
|
+
});
|
|
326
|
+
const h = c / a.children.length;
|
|
327
|
+
if (h < 0.99 || h > 1.01) {
|
|
328
|
+
const d = 1 / h;
|
|
329
|
+
a.children.forEach((w) => {
|
|
330
|
+
w.props.width = w.props.width * d;
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
const p = a.children.findIndex(
|
|
334
|
+
(d) => d.id === s.bnBlock.node.attrs.id
|
|
335
|
+
), b = a.children.map((d) => ({
|
|
336
|
+
...d,
|
|
337
|
+
children: d.children.filter(
|
|
338
|
+
(w) => w.id !== i.id
|
|
339
|
+
)
|
|
340
|
+
})).filter((d) => d.children.length > 0).toSpliced(l.position === "left" ? p : p + 1, 0, {
|
|
341
|
+
type: "column",
|
|
342
|
+
children: [i],
|
|
343
|
+
props: {},
|
|
344
|
+
content: void 0,
|
|
345
|
+
id: Z.options.generateID()
|
|
346
|
+
});
|
|
347
|
+
e.getBlock(i.id) && e.removeBlocks([i]), e.updateBlock(a, {
|
|
348
|
+
children: b
|
|
349
|
+
});
|
|
350
|
+
} else {
|
|
351
|
+
const r = y(s.bnBlock.node, e.pmSchema);
|
|
352
|
+
if (r.id === i.id)
|
|
353
|
+
return !0;
|
|
354
|
+
const a = l.position === "left" ? [i, r] : [r, i];
|
|
355
|
+
e.getBlock(i.id) && e.removeBlocks([i]), e.replaceBlocks(
|
|
356
|
+
[r],
|
|
357
|
+
[
|
|
358
|
+
{
|
|
359
|
+
type: "columnList",
|
|
360
|
+
children: a.map((c) => ({
|
|
361
|
+
type: "column",
|
|
362
|
+
children: [c]
|
|
363
|
+
}))
|
|
364
|
+
}
|
|
365
|
+
]
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
return !0;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
const he = X(
|
|
374
|
+
({ editor: e }) => ({
|
|
375
|
+
key: "multiColumnDropHandler",
|
|
376
|
+
prosemirrorPlugins: [me(e)]
|
|
377
|
+
})
|
|
378
|
+
), f = new V("ColumnResizePlugin");
|
|
379
|
+
class pe {
|
|
380
|
+
constructor(t, o) {
|
|
381
|
+
m(this, "editor");
|
|
382
|
+
m(this, "view");
|
|
383
|
+
m(this, "RESIZE_MARGIN_WIDTH_PX", 20);
|
|
384
|
+
m(this, "COLUMN_MIN_WIDTH_PERCENT", 0.5);
|
|
385
|
+
m(this, "getColumnHoverOrDefaultState", (t) => {
|
|
268
386
|
if (!this.editor.isEditable)
|
|
269
387
|
return { type: "default" };
|
|
270
|
-
const
|
|
271
|
-
if (!this.view.dom.contains(
|
|
388
|
+
const o = t.target;
|
|
389
|
+
if (!this.view.dom.contains(o))
|
|
272
390
|
return { type: "default" };
|
|
273
|
-
const n =
|
|
391
|
+
const n = o.closest(
|
|
274
392
|
".bn-block-column"
|
|
275
393
|
);
|
|
276
394
|
if (!n)
|
|
277
395
|
return { type: "default" };
|
|
278
|
-
const
|
|
279
|
-
if (!
|
|
396
|
+
const u = t.clientX, l = n.getBoundingClientRect(), s = u < l.left + this.RESIZE_MARGIN_WIDTH_PX ? "left" : u > l.right - this.RESIZE_MARGIN_WIDTH_PX ? "right" : "none", i = s === "left" ? n.previousElementSibling : s === "right" ? n.nextElementSibling : void 0;
|
|
397
|
+
if (!i)
|
|
280
398
|
return { type: "default" };
|
|
281
|
-
const
|
|
282
|
-
|
|
399
|
+
const r = s === "left" ? i : n, a = s === "left" ? n : i, c = r.getAttribute("data-id"), h = a.getAttribute("data-id"), p = k(c, this.view.state.doc), b = k(
|
|
400
|
+
h,
|
|
283
401
|
this.view.state.doc
|
|
284
402
|
);
|
|
285
|
-
if (!
|
|
403
|
+
if (!p || !b || !p.posBeforeNode)
|
|
286
404
|
throw new Error("Column not found");
|
|
287
405
|
return {
|
|
288
406
|
type: "hover",
|
|
289
407
|
leftColumn: {
|
|
290
|
-
element:
|
|
291
|
-
id:
|
|
292
|
-
...
|
|
408
|
+
element: r,
|
|
409
|
+
id: c,
|
|
410
|
+
...p
|
|
293
411
|
},
|
|
294
412
|
rightColumn: {
|
|
295
|
-
element:
|
|
296
|
-
id:
|
|
297
|
-
...
|
|
413
|
+
element: a,
|
|
414
|
+
id: h,
|
|
415
|
+
...b
|
|
298
416
|
}
|
|
299
417
|
};
|
|
300
418
|
});
|
|
301
419
|
// When the user mouses down near the boundary between two columns, we
|
|
302
420
|
// want to set the plugin state to resize, so the columns can be resized
|
|
303
421
|
// by moving the mouse.
|
|
304
|
-
|
|
305
|
-
var
|
|
306
|
-
let
|
|
307
|
-
if (
|
|
422
|
+
m(this, "mouseDownHandler", (t) => {
|
|
423
|
+
var r;
|
|
424
|
+
let o = this.getColumnHoverOrDefaultState(t);
|
|
425
|
+
if (o.type === "default")
|
|
308
426
|
return;
|
|
309
|
-
|
|
310
|
-
const n =
|
|
311
|
-
|
|
427
|
+
t.preventDefault();
|
|
428
|
+
const n = t.clientX, u = o.leftColumn.element.getBoundingClientRect().width, l = o.rightColumn.element.getBoundingClientRect().width, s = o.leftColumn.node.attrs.width, i = o.rightColumn.node.attrs.width;
|
|
429
|
+
o = {
|
|
312
430
|
type: "resize",
|
|
313
431
|
startPos: n,
|
|
314
432
|
leftColumn: {
|
|
315
|
-
...
|
|
316
|
-
widthPx:
|
|
317
|
-
widthPercent:
|
|
433
|
+
...o.leftColumn,
|
|
434
|
+
widthPx: u,
|
|
435
|
+
widthPercent: s
|
|
318
436
|
},
|
|
319
437
|
rightColumn: {
|
|
320
|
-
...
|
|
321
|
-
widthPx:
|
|
322
|
-
widthPercent:
|
|
438
|
+
...o.rightColumn,
|
|
439
|
+
widthPx: l,
|
|
440
|
+
widthPercent: i
|
|
323
441
|
}
|
|
324
442
|
}, this.view.dispatch(
|
|
325
|
-
this.view.state.tr.setMeta(
|
|
326
|
-
), (
|
|
443
|
+
this.view.state.tr.setMeta(f, o)
|
|
444
|
+
), (r = this.editor.getExtension(_)) == null || r.freezeMenu();
|
|
327
445
|
});
|
|
328
446
|
// If the plugin isn't in a resize state, we want to update it to either a
|
|
329
447
|
// hover state if the mouse is near the boundary between two columns, or
|
|
330
448
|
// default otherwise. If the plugin is in a resize state, we want to
|
|
331
449
|
// update the column widths based on the horizontal mouse movement.
|
|
332
|
-
|
|
333
|
-
var
|
|
334
|
-
const
|
|
335
|
-
if (!
|
|
450
|
+
m(this, "mouseMoveHandler", (t) => {
|
|
451
|
+
var r, a;
|
|
452
|
+
const o = f.getState(this.view.state);
|
|
453
|
+
if (!o)
|
|
336
454
|
return;
|
|
337
|
-
if (
|
|
338
|
-
const
|
|
339
|
-
if (
|
|
455
|
+
if (o.type !== "resize") {
|
|
456
|
+
const c = this.getColumnHoverOrDefaultState(t), h = o.type === "default" && c.type === "default", p = o.type !== "default" && c.type !== "default" && o.leftColumn.id === c.leftColumn.id && o.rightColumn.id === c.rightColumn.id;
|
|
457
|
+
if (h || p || c.type === "hover" && ((a = (r = this.editor.getExtension(_)) == null ? void 0 : r.store.state) != null && a.show))
|
|
340
458
|
return;
|
|
341
459
|
this.view.dispatch(
|
|
342
|
-
this.view.state.tr.setMeta(
|
|
460
|
+
this.view.state.tr.setMeta(f, c)
|
|
343
461
|
);
|
|
344
462
|
return;
|
|
345
463
|
}
|
|
346
|
-
const
|
|
347
|
-
let
|
|
348
|
-
|
|
464
|
+
const u = (t.clientX - o.startPos) * o.leftColumn.widthPercent, l = (o.leftColumn.widthPx + u) / o.leftColumn.widthPx - 1;
|
|
465
|
+
let s = o.leftColumn.widthPercent + l, i = o.rightColumn.widthPercent - l;
|
|
466
|
+
s < this.COLUMN_MIN_WIDTH_PERCENT ? (i -= this.COLUMN_MIN_WIDTH_PERCENT - s, s = this.COLUMN_MIN_WIDTH_PERCENT) : i < this.COLUMN_MIN_WIDTH_PERCENT && (s -= this.COLUMN_MIN_WIDTH_PERCENT - i, i = this.COLUMN_MIN_WIDTH_PERCENT), this.view.dispatch(
|
|
349
467
|
this.view.state.tr.setNodeAttribute(
|
|
350
|
-
|
|
468
|
+
o.leftColumn.posBeforeNode,
|
|
351
469
|
"width",
|
|
352
|
-
|
|
470
|
+
s
|
|
353
471
|
).setNodeAttribute(
|
|
354
|
-
|
|
472
|
+
o.rightColumn.posBeforeNode,
|
|
355
473
|
"width",
|
|
356
|
-
|
|
474
|
+
i
|
|
357
475
|
).setMeta("addToHistory", !1)
|
|
358
476
|
);
|
|
359
477
|
});
|
|
360
478
|
// If the plugin is in a resize state, we want to revert it to a default
|
|
361
479
|
// or hover, depending on where the mouse cursor is, when the user
|
|
362
480
|
// releases the mouse button.
|
|
363
|
-
|
|
364
|
-
var
|
|
365
|
-
const
|
|
366
|
-
if (!
|
|
481
|
+
m(this, "mouseUpHandler", (t) => {
|
|
482
|
+
var u;
|
|
483
|
+
const o = f.getState(this.view.state);
|
|
484
|
+
if (!o || o.type !== "resize")
|
|
367
485
|
return;
|
|
368
|
-
const n = this.getColumnHoverOrDefaultState(
|
|
486
|
+
const n = this.getColumnHoverOrDefaultState(t);
|
|
369
487
|
this.view.dispatch(
|
|
370
|
-
this.view.state.tr.setMeta(
|
|
371
|
-
), (
|
|
488
|
+
this.view.state.tr.setMeta(f, n)
|
|
489
|
+
), (u = this.editor.getExtension(_)) == null || u.unfreezeMenu();
|
|
372
490
|
});
|
|
373
|
-
this.editor =
|
|
491
|
+
this.editor = t, this.view = o, this.view.dom.addEventListener("mousedown", this.mouseDownHandler), document.body.addEventListener("mousemove", this.mouseMoveHandler), document.body.addEventListener("mouseup", this.mouseUpHandler);
|
|
374
492
|
}
|
|
375
493
|
destroy() {
|
|
376
494
|
this.view.dom.removeEventListener("mousedown", this.mouseDownHandler), document.body.removeEventListener("mousemove", this.mouseMoveHandler), document.body.removeEventListener("mouseup", this.mouseUpHandler);
|
|
377
495
|
}
|
|
378
496
|
}
|
|
379
|
-
const
|
|
380
|
-
key:
|
|
497
|
+
const fe = (e) => new I({
|
|
498
|
+
key: f,
|
|
381
499
|
props: {
|
|
382
500
|
// This adds a border between the columns when the user is
|
|
383
501
|
// resizing them or when the cursor is near their boundary.
|
|
384
|
-
decorations: (
|
|
385
|
-
const
|
|
386
|
-
return !
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
502
|
+
decorations: (t) => {
|
|
503
|
+
const o = f.getState(t);
|
|
504
|
+
return !o || o.type === "default" ? E.empty : E.create(t.doc, [
|
|
505
|
+
x.node(
|
|
506
|
+
o.leftColumn.posBeforeNode,
|
|
507
|
+
o.leftColumn.posBeforeNode + o.leftColumn.node.nodeSize,
|
|
390
508
|
{
|
|
391
509
|
style: "box-shadow: 4px 0 0 #ccc; cursor: col-resize"
|
|
392
510
|
}
|
|
393
511
|
),
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
512
|
+
x.node(
|
|
513
|
+
o.rightColumn.posBeforeNode,
|
|
514
|
+
o.rightColumn.posBeforeNode + o.rightColumn.node.nodeSize,
|
|
397
515
|
{
|
|
398
516
|
style: "cursor: col-resize"
|
|
399
517
|
}
|
|
@@ -403,18 +521,18 @@ const we = (o) => new H({
|
|
|
403
521
|
},
|
|
404
522
|
state: {
|
|
405
523
|
init: () => ({ type: "default" }),
|
|
406
|
-
apply: (
|
|
407
|
-
const n =
|
|
408
|
-
return n === void 0 ?
|
|
524
|
+
apply: (t, o) => {
|
|
525
|
+
const n = t.getMeta(f);
|
|
526
|
+
return n === void 0 ? o : n;
|
|
409
527
|
}
|
|
410
528
|
},
|
|
411
|
-
view: (
|
|
412
|
-
}),
|
|
529
|
+
view: (t) => new pe(e, t)
|
|
530
|
+
}), ge = (e) => Y.create({
|
|
413
531
|
name: "columnResize",
|
|
414
532
|
addProseMirrorPlugins() {
|
|
415
|
-
return [
|
|
533
|
+
return [fe(e)];
|
|
416
534
|
}
|
|
417
|
-
}),
|
|
535
|
+
}), be = L.create({
|
|
418
536
|
name: "column",
|
|
419
537
|
group: "bnBlock childContainer",
|
|
420
538
|
// A block always contains content, and optionally a blockGroup which contains nested blocks
|
|
@@ -438,16 +556,16 @@ const we = (o) => new H({
|
|
|
438
556
|
// value, which handles all the resizing for us, instead of manually
|
|
439
557
|
// having to set the `width` property of each column.
|
|
440
558
|
default: 1,
|
|
441
|
-
parseHTML: (
|
|
442
|
-
const
|
|
443
|
-
if (
|
|
559
|
+
parseHTML: (e) => {
|
|
560
|
+
const t = e.getAttribute("data-width");
|
|
561
|
+
if (t === null)
|
|
444
562
|
return null;
|
|
445
|
-
const
|
|
446
|
-
return isFinite(
|
|
563
|
+
const o = parseFloat(t);
|
|
564
|
+
return isFinite(o) ? o : null;
|
|
447
565
|
},
|
|
448
|
-
renderHTML: (
|
|
449
|
-
"data-width":
|
|
450
|
-
style: `flex-grow: ${
|
|
566
|
+
renderHTML: (e) => ({
|
|
567
|
+
"data-width": e.width.toString(),
|
|
568
|
+
style: `flex-grow: ${e.width};`
|
|
451
569
|
})
|
|
452
570
|
}
|
|
453
571
|
};
|
|
@@ -456,24 +574,24 @@ const we = (o) => new H({
|
|
|
456
574
|
return [
|
|
457
575
|
{
|
|
458
576
|
tag: "div",
|
|
459
|
-
getAttrs: (
|
|
577
|
+
getAttrs: (e) => typeof e == "string" ? !1 : e.getAttribute("data-node-type") === this.name ? {} : !1
|
|
460
578
|
}
|
|
461
579
|
];
|
|
462
580
|
},
|
|
463
|
-
renderHTML({ HTMLAttributes:
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
for (const [
|
|
467
|
-
|
|
581
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
582
|
+
const t = document.createElement("div");
|
|
583
|
+
t.className = "bn-block-column", t.setAttribute("data-node-type", this.name);
|
|
584
|
+
for (const [o, n] of Object.entries(e))
|
|
585
|
+
t.setAttribute(o, n);
|
|
468
586
|
return {
|
|
469
|
-
dom:
|
|
470
|
-
contentDOM:
|
|
587
|
+
dom: t,
|
|
588
|
+
contentDOM: t
|
|
471
589
|
};
|
|
472
590
|
},
|
|
473
591
|
addExtensions() {
|
|
474
|
-
return [
|
|
592
|
+
return [ge(this.options.editor)];
|
|
475
593
|
}
|
|
476
|
-
}),
|
|
594
|
+
}), we = L.create({
|
|
477
595
|
name: "columnList",
|
|
478
596
|
group: "childContainer bnBlock blockGroupChild",
|
|
479
597
|
// A block always contains content, and optionally a blockGroup which contains nested blocks
|
|
@@ -487,23 +605,23 @@ const we = (o) => new H({
|
|
|
487
605
|
return [
|
|
488
606
|
{
|
|
489
607
|
tag: "div",
|
|
490
|
-
getAttrs: (
|
|
608
|
+
getAttrs: (e) => typeof e == "string" ? !1 : e.getAttribute("data-node-type") === this.name ? {} : !1
|
|
491
609
|
}
|
|
492
610
|
];
|
|
493
611
|
},
|
|
494
|
-
renderHTML({ HTMLAttributes:
|
|
495
|
-
const
|
|
496
|
-
|
|
497
|
-
for (const [
|
|
498
|
-
|
|
499
|
-
return
|
|
500
|
-
dom:
|
|
501
|
-
contentDOM:
|
|
612
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
613
|
+
const t = document.createElement("div");
|
|
614
|
+
t.className = "bn-block-column-list", t.setAttribute("data-node-type", this.name);
|
|
615
|
+
for (const [o, n] of Object.entries(e))
|
|
616
|
+
t.setAttribute(o, n);
|
|
617
|
+
return t.style.display = "flex", {
|
|
618
|
+
dom: t,
|
|
619
|
+
contentDOM: t
|
|
502
620
|
};
|
|
503
621
|
}
|
|
504
|
-
}),
|
|
622
|
+
}), H = M(
|
|
505
623
|
{
|
|
506
|
-
node:
|
|
624
|
+
node: be,
|
|
507
625
|
type: "column",
|
|
508
626
|
content: "none"
|
|
509
627
|
},
|
|
@@ -511,374 +629,151 @@ const we = (o) => new H({
|
|
|
511
629
|
width: {
|
|
512
630
|
default: 1
|
|
513
631
|
}
|
|
514
|
-
}
|
|
515
|
-
)
|
|
632
|
+
},
|
|
633
|
+
[he()]
|
|
634
|
+
), z = M(
|
|
516
635
|
{
|
|
517
|
-
node:
|
|
636
|
+
node: we,
|
|
518
637
|
type: "columnList",
|
|
519
638
|
content: "none"
|
|
520
639
|
},
|
|
521
640
|
{}
|
|
522
|
-
),
|
|
641
|
+
), D = q.create({
|
|
523
642
|
blockSpecs: {
|
|
524
|
-
column:
|
|
525
|
-
columnList:
|
|
643
|
+
column: H,
|
|
644
|
+
columnList: z
|
|
526
645
|
}
|
|
527
|
-
}),
|
|
646
|
+
}), Re = (e) => e.extend({
|
|
528
647
|
blockSpecs: {
|
|
529
|
-
column:
|
|
530
|
-
columnList:
|
|
648
|
+
column: H,
|
|
649
|
+
columnList: z
|
|
531
650
|
}
|
|
532
|
-
})
|
|
533
|
-
|
|
534
|
-
return { left: o.clientX, top: o.clientY };
|
|
535
|
-
}
|
|
536
|
-
function Ge(o) {
|
|
537
|
-
const e = o.editor;
|
|
538
|
-
return new H({
|
|
539
|
-
view(t) {
|
|
540
|
-
return new _e(t, o);
|
|
541
|
-
},
|
|
542
|
-
props: {
|
|
543
|
-
handleDrop(t, n, s, d) {
|
|
544
|
-
const c = t.posAtCoords(ke(n));
|
|
545
|
-
if (!c)
|
|
546
|
-
throw new Error("Could not get event position");
|
|
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")
|
|
550
|
-
return !1;
|
|
551
|
-
const u = x(
|
|
552
|
-
s.content.child(0),
|
|
553
|
-
e.pmSchema
|
|
554
|
-
// TODO: cache?
|
|
555
|
-
);
|
|
556
|
-
if (i.blockNoteType === "column") {
|
|
557
|
-
const m = t.state.doc.resolve(i.bnBlock.beforePos).node(), h = x(
|
|
558
|
-
m,
|
|
559
|
-
e.pmSchema
|
|
560
|
-
);
|
|
561
|
-
let f = 0;
|
|
562
|
-
h.children.forEach((b) => {
|
|
563
|
-
f += b.props.width;
|
|
564
|
-
});
|
|
565
|
-
const w = f / h.children.length;
|
|
566
|
-
if (w < 0.99 || w > 1.01) {
|
|
567
|
-
const b = 1 / w;
|
|
568
|
-
h.children.forEach((y) => {
|
|
569
|
-
y.props.width = y.props.width * b;
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
const O = h.children.findIndex(
|
|
573
|
-
(b) => b.id === i.bnBlock.node.attrs.id
|
|
574
|
-
), K = h.children.map((b) => ({
|
|
575
|
-
...b,
|
|
576
|
-
children: b.children.filter(
|
|
577
|
-
(y) => y.id !== u.id
|
|
578
|
-
)
|
|
579
|
-
})).filter((b) => b.children.length > 0).toSpliced(r === "left" ? O : O + 1, 0, {
|
|
580
|
-
type: "column",
|
|
581
|
-
children: [u],
|
|
582
|
-
props: {},
|
|
583
|
-
content: void 0,
|
|
584
|
-
id: J.options.generateID()
|
|
585
|
-
});
|
|
586
|
-
e.getBlock(u.id) && e.removeBlocks([u]), e.updateBlock(h, {
|
|
587
|
-
children: K
|
|
588
|
-
});
|
|
589
|
-
} else {
|
|
590
|
-
const m = x(i.bnBlock.node, e.pmSchema);
|
|
591
|
-
if (m.id === u.id)
|
|
592
|
-
return;
|
|
593
|
-
const h = r === "left" ? [u, m] : [m, u];
|
|
594
|
-
e.getBlock(u.id) && e.removeBlocks([u]), e.replaceBlocks(
|
|
595
|
-
[m],
|
|
596
|
-
[
|
|
597
|
-
{
|
|
598
|
-
type: "columnList",
|
|
599
|
-
children: h.map((f) => ({
|
|
600
|
-
type: "column",
|
|
601
|
-
children: [f]
|
|
602
|
-
}))
|
|
603
|
-
}
|
|
604
|
-
]
|
|
605
|
-
);
|
|
606
|
-
}
|
|
607
|
-
return !0;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
});
|
|
611
|
-
}
|
|
612
|
-
class _e {
|
|
613
|
-
constructor(e, t) {
|
|
614
|
-
p(this, "width");
|
|
615
|
-
p(this, "color");
|
|
616
|
-
p(this, "class");
|
|
617
|
-
p(this, "cursorPos");
|
|
618
|
-
p(this, "element", null);
|
|
619
|
-
p(this, "timeout");
|
|
620
|
-
p(this, "handlers");
|
|
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) => {
|
|
622
|
-
const s = (d) => {
|
|
623
|
-
this[n](d);
|
|
624
|
-
};
|
|
625
|
-
return e.dom.addEventListener(
|
|
626
|
-
n,
|
|
627
|
-
s,
|
|
628
|
-
// drop event captured in bubbling phase to make sure
|
|
629
|
-
// "cursorPos" is set to undefined before the "handleDrop" handler is called
|
|
630
|
-
// (otherwise an error could be thrown, see https://github.com/TypeCellOS/BlockNote/pull/1240)
|
|
631
|
-
n === "drop" ? !0 : void 0
|
|
632
|
-
), { name: n, handler: s };
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
|
-
destroy() {
|
|
636
|
-
this.handlers.forEach(
|
|
637
|
-
({ name: e, handler: t }) => this.editorView.dom.removeEventListener(
|
|
638
|
-
e,
|
|
639
|
-
t,
|
|
640
|
-
e === "drop" ? !0 : void 0
|
|
641
|
-
)
|
|
642
|
-
);
|
|
643
|
-
}
|
|
644
|
-
update(e, t) {
|
|
645
|
-
this.cursorPos != null && t.doc !== e.state.doc && (this.cursorPos.pos > e.state.doc.content.size ? this.setCursor(void 0) : this.updateOverlay());
|
|
646
|
-
}
|
|
647
|
-
setCursor(e) {
|
|
648
|
-
var t, n;
|
|
649
|
-
e === this.cursorPos || (e == null ? void 0 : e.pos) === ((t = this.cursorPos) == null ? void 0 : t.pos) && (e == null ? void 0 : e.position) === ((n = this.cursorPos) == null ? void 0 : n.position) || (this.cursorPos = e, e ? this.updateOverlay() : (this.element.parentNode.removeChild(this.element), this.element = null));
|
|
650
|
-
}
|
|
651
|
-
updateOverlay() {
|
|
652
|
-
if (!this.cursorPos)
|
|
653
|
-
throw new Error("updateOverlay called with no cursor position");
|
|
654
|
-
const e = this.editorView.state.doc.resolve(this.cursorPos.pos), t = !e.parent.inlineContent;
|
|
655
|
-
let n;
|
|
656
|
-
const s = this.editorView.dom, d = s.getBoundingClientRect(), c = d.width / s.offsetWidth, l = d.height / s.offsetHeight;
|
|
657
|
-
if (t) {
|
|
658
|
-
const r = e.nodeBefore, u = e.nodeAfter;
|
|
659
|
-
if (r || u)
|
|
660
|
-
if (this.cursorPos.position === "left" || this.cursorPos.position === "right") {
|
|
661
|
-
const m = this.editorView.nodeDOM(this.cursorPos.pos);
|
|
662
|
-
if (!m)
|
|
663
|
-
throw new Error("nodeDOM returned null in updateOverlay");
|
|
664
|
-
const h = m.getBoundingClientRect(), f = this.width / 2 * l, w = this.cursorPos.position === "left" ? h.left : h.right;
|
|
665
|
-
n = {
|
|
666
|
-
left: w - f,
|
|
667
|
-
right: w + f,
|
|
668
|
-
top: h.top,
|
|
669
|
-
bottom: h.bottom
|
|
670
|
-
// left: blockRect.left,
|
|
671
|
-
// right: blockRect.right,
|
|
672
|
-
};
|
|
673
|
-
} else {
|
|
674
|
-
const m = this.editorView.nodeDOM(
|
|
675
|
-
this.cursorPos.pos - (r ? r.nodeSize : 0)
|
|
676
|
-
);
|
|
677
|
-
if (m) {
|
|
678
|
-
const h = m.getBoundingClientRect();
|
|
679
|
-
let f = r ? h.bottom : h.top;
|
|
680
|
-
r && u && (f = (f + this.editorView.nodeDOM(this.cursorPos.pos).getBoundingClientRect().top) / 2);
|
|
681
|
-
const w = this.width / 2 * l;
|
|
682
|
-
this.cursorPos.position === "regular" && (n = {
|
|
683
|
-
left: h.left,
|
|
684
|
-
right: h.right,
|
|
685
|
-
top: f - w,
|
|
686
|
-
bottom: f + w
|
|
687
|
-
});
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
if (!n) {
|
|
692
|
-
const r = this.editorView.coordsAtPos(this.cursorPos.pos), u = this.width / 2 * c;
|
|
693
|
-
n = {
|
|
694
|
-
left: r.left - u,
|
|
695
|
-
right: r.left + u,
|
|
696
|
-
top: r.top,
|
|
697
|
-
bottom: r.bottom
|
|
698
|
-
};
|
|
699
|
-
}
|
|
700
|
-
const i = this.editorView.dom.offsetParent;
|
|
701
|
-
this.element || (this.element = i.appendChild(document.createElement("div")), this.class && (this.element.className = this.class), this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none;", this.color && (this.element.style.backgroundColor = this.color)), this.element.classList.toggle("prosemirror-dropcursor-block", t), this.element.classList.toggle(
|
|
702
|
-
"prosemirror-dropcursor-vertical",
|
|
703
|
-
this.cursorPos.position !== "regular"
|
|
704
|
-
), this.element.classList.toggle("prosemirror-dropcursor-inline", !t);
|
|
705
|
-
let g, a;
|
|
706
|
-
if (!i || i === document.body && getComputedStyle(i).position === "static")
|
|
707
|
-
g = -window.scrollX, a = -window.scrollY;
|
|
708
|
-
else {
|
|
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;
|
|
711
|
-
}
|
|
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";
|
|
713
|
-
}
|
|
714
|
-
scheduleRemoval(e) {
|
|
715
|
-
clearTimeout(this.timeout), this.timeout = setTimeout(() => this.setCursor(void 0), e);
|
|
716
|
-
}
|
|
717
|
-
// this gets executed on every mouse move when dragging (drag over)
|
|
718
|
-
dragover(e) {
|
|
719
|
-
if (!this.editorView.editable)
|
|
720
|
-
return;
|
|
721
|
-
const t = this.editorView.posAtCoords({
|
|
722
|
-
left: e.clientX,
|
|
723
|
-
top: e.clientY
|
|
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;
|
|
725
|
-
if (t && !d) {
|
|
726
|
-
let c = "regular", l = t.pos;
|
|
727
|
-
const i = V(this.editorView.state, t), a = this.editorView.nodeDOM(i.posBeforeNode).getBoundingClientRect();
|
|
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) {
|
|
729
|
-
const r = te(
|
|
730
|
-
this.editorView.state.doc,
|
|
731
|
-
l,
|
|
732
|
-
this.editorView.dragging.slice
|
|
733
|
-
);
|
|
734
|
-
r != null && (l = r);
|
|
735
|
-
}
|
|
736
|
-
this.setCursor({ pos: l, position: c }), this.scheduleRemoval(5e3);
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
dragend() {
|
|
740
|
-
this.scheduleRemoval(20);
|
|
741
|
-
}
|
|
742
|
-
drop() {
|
|
743
|
-
this.setCursor(void 0);
|
|
744
|
-
}
|
|
745
|
-
dragleave(e) {
|
|
746
|
-
(e.target === this.editorView.dom || !this.editorView.dom.contains(e.relatedTarget)) && this.setCursor(void 0);
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
function V(o, e) {
|
|
750
|
-
const t = Q(o.doc, e.pos);
|
|
751
|
-
let n = o.doc.resolve(t.posBeforeNode);
|
|
752
|
-
return n.parent.type.name === "column" && (n = o.doc.resolve(n.before())), {
|
|
753
|
-
posBeforeNode: n.pos,
|
|
754
|
-
node: n.nodeAfter
|
|
755
|
-
};
|
|
756
|
-
}
|
|
757
|
-
var X = {
|
|
651
|
+
});
|
|
652
|
+
var R = {
|
|
758
653
|
color: void 0,
|
|
759
654
|
size: void 0,
|
|
760
655
|
className: void 0,
|
|
761
656
|
style: void 0,
|
|
762
657
|
attr: void 0
|
|
763
|
-
},
|
|
764
|
-
function
|
|
765
|
-
if (
|
|
766
|
-
var
|
|
658
|
+
}, O = g.createContext && /* @__PURE__ */ g.createContext(R), Ce = ["attr", "size", "title"];
|
|
659
|
+
function ve(e, t) {
|
|
660
|
+
if (e == null) return {};
|
|
661
|
+
var o = ye(e, t), n, u;
|
|
767
662
|
if (Object.getOwnPropertySymbols) {
|
|
768
|
-
var
|
|
769
|
-
for (
|
|
770
|
-
n =
|
|
663
|
+
var l = Object.getOwnPropertySymbols(e);
|
|
664
|
+
for (u = 0; u < l.length; u++)
|
|
665
|
+
n = l[u], !(t.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (o[n] = e[n]);
|
|
771
666
|
}
|
|
772
|
-
return
|
|
667
|
+
return o;
|
|
773
668
|
}
|
|
774
|
-
function
|
|
775
|
-
if (
|
|
776
|
-
var
|
|
777
|
-
for (var n in
|
|
778
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
779
|
-
if (
|
|
780
|
-
|
|
669
|
+
function ye(e, t) {
|
|
670
|
+
if (e == null) return {};
|
|
671
|
+
var o = {};
|
|
672
|
+
for (var n in e)
|
|
673
|
+
if (Object.prototype.hasOwnProperty.call(e, n)) {
|
|
674
|
+
if (t.indexOf(n) >= 0) continue;
|
|
675
|
+
o[n] = e[n];
|
|
781
676
|
}
|
|
782
|
-
return
|
|
677
|
+
return o;
|
|
783
678
|
}
|
|
784
|
-
function
|
|
785
|
-
return
|
|
786
|
-
for (var
|
|
787
|
-
var
|
|
788
|
-
for (var n in
|
|
789
|
-
Object.prototype.hasOwnProperty.call(
|
|
679
|
+
function C() {
|
|
680
|
+
return C = Object.assign ? Object.assign.bind() : function(e) {
|
|
681
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
682
|
+
var o = arguments[t];
|
|
683
|
+
for (var n in o)
|
|
684
|
+
Object.prototype.hasOwnProperty.call(o, n) && (e[n] = o[n]);
|
|
790
685
|
}
|
|
791
|
-
return
|
|
792
|
-
},
|
|
686
|
+
return e;
|
|
687
|
+
}, C.apply(this, arguments);
|
|
793
688
|
}
|
|
794
|
-
function
|
|
795
|
-
var
|
|
689
|
+
function T(e, t) {
|
|
690
|
+
var o = Object.keys(e);
|
|
796
691
|
if (Object.getOwnPropertySymbols) {
|
|
797
|
-
var n = Object.getOwnPropertySymbols(
|
|
798
|
-
|
|
799
|
-
return Object.getOwnPropertyDescriptor(
|
|
800
|
-
})),
|
|
692
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
693
|
+
t && (n = n.filter(function(u) {
|
|
694
|
+
return Object.getOwnPropertyDescriptor(e, u).enumerable;
|
|
695
|
+
})), o.push.apply(o, n);
|
|
801
696
|
}
|
|
802
|
-
return
|
|
697
|
+
return o;
|
|
803
698
|
}
|
|
804
|
-
function
|
|
805
|
-
for (var
|
|
806
|
-
var
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
|
810
|
-
Object.defineProperty(
|
|
699
|
+
function v(e) {
|
|
700
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
701
|
+
var o = arguments[t] != null ? arguments[t] : {};
|
|
702
|
+
t % 2 ? T(Object(o), !0).forEach(function(n) {
|
|
703
|
+
_e(e, n, o[n]);
|
|
704
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(o)) : T(Object(o)).forEach(function(n) {
|
|
705
|
+
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(o, n));
|
|
811
706
|
});
|
|
812
707
|
}
|
|
813
|
-
return
|
|
708
|
+
return e;
|
|
814
709
|
}
|
|
815
|
-
function
|
|
816
|
-
return
|
|
710
|
+
function _e(e, t, o) {
|
|
711
|
+
return t = ke(t), t in e ? Object.defineProperty(e, t, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = o, e;
|
|
817
712
|
}
|
|
818
|
-
function
|
|
819
|
-
var
|
|
820
|
-
return typeof
|
|
713
|
+
function ke(e) {
|
|
714
|
+
var t = Pe(e, "string");
|
|
715
|
+
return typeof t == "symbol" ? t : t + "";
|
|
821
716
|
}
|
|
822
|
-
function
|
|
823
|
-
if (typeof
|
|
824
|
-
var
|
|
825
|
-
if (
|
|
826
|
-
var n =
|
|
717
|
+
function Pe(e, t) {
|
|
718
|
+
if (typeof e != "object" || !e) return e;
|
|
719
|
+
var o = e[Symbol.toPrimitive];
|
|
720
|
+
if (o !== void 0) {
|
|
721
|
+
var n = o.call(e, t);
|
|
827
722
|
if (typeof n != "object") return n;
|
|
828
723
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
829
724
|
}
|
|
830
|
-
return (
|
|
725
|
+
return (t === "string" ? String : Number)(e);
|
|
831
726
|
}
|
|
832
|
-
function
|
|
833
|
-
return
|
|
834
|
-
key:
|
|
835
|
-
},
|
|
727
|
+
function W(e) {
|
|
728
|
+
return e && e.map((t, o) => /* @__PURE__ */ g.createElement(t.tag, v({
|
|
729
|
+
key: o
|
|
730
|
+
}, t.attr), W(t.child)));
|
|
836
731
|
}
|
|
837
|
-
function
|
|
838
|
-
return (
|
|
839
|
-
attr:
|
|
840
|
-
},
|
|
732
|
+
function A(e) {
|
|
733
|
+
return (t) => /* @__PURE__ */ g.createElement(Ee, C({
|
|
734
|
+
attr: v({}, e.attr)
|
|
735
|
+
}, t), W(e.child));
|
|
841
736
|
}
|
|
842
|
-
function
|
|
843
|
-
var
|
|
737
|
+
function Ee(e) {
|
|
738
|
+
var t = (o) => {
|
|
844
739
|
var {
|
|
845
740
|
attr: n,
|
|
846
|
-
size:
|
|
847
|
-
title:
|
|
848
|
-
} =
|
|
849
|
-
return
|
|
741
|
+
size: u,
|
|
742
|
+
title: l
|
|
743
|
+
} = e, s = ve(e, Ce), i = u || o.size || "1em", r;
|
|
744
|
+
return o.className && (r = o.className), e.className && (r = (r ? r + " " : "") + e.className), /* @__PURE__ */ g.createElement("svg", C({
|
|
850
745
|
stroke: "currentColor",
|
|
851
746
|
fill: "currentColor",
|
|
852
747
|
strokeWidth: "0"
|
|
853
|
-
},
|
|
854
|
-
className:
|
|
855
|
-
style:
|
|
856
|
-
color:
|
|
857
|
-
},
|
|
858
|
-
height:
|
|
859
|
-
width:
|
|
748
|
+
}, o.attr, n, s, {
|
|
749
|
+
className: r,
|
|
750
|
+
style: v(v({
|
|
751
|
+
color: e.color || o.color
|
|
752
|
+
}, o.style), e.style),
|
|
753
|
+
height: i,
|
|
754
|
+
width: i,
|
|
860
755
|
xmlns: "http://www.w3.org/2000/svg"
|
|
861
|
-
}),
|
|
756
|
+
}), l && /* @__PURE__ */ g.createElement("title", null, l), e.children);
|
|
862
757
|
};
|
|
863
|
-
return
|
|
758
|
+
return O !== void 0 ? /* @__PURE__ */ g.createElement(O.Consumer, null, (o) => t(o)) : t(R);
|
|
864
759
|
}
|
|
865
|
-
function
|
|
866
|
-
return
|
|
760
|
+
function xe(e) {
|
|
761
|
+
return A({ 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: [] }] })(e);
|
|
867
762
|
}
|
|
868
|
-
function
|
|
869
|
-
return
|
|
763
|
+
function Se(e) {
|
|
764
|
+
return A({ 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: [] }] })(e);
|
|
870
765
|
}
|
|
871
|
-
function
|
|
872
|
-
return "column" in
|
|
766
|
+
function Ne(e) {
|
|
767
|
+
return "column" in e.schema.blockSchema && e.schema.blockSchema.columnList === D.blockSchema.columnList && "column" in e.schema.blockSchema && e.schema.blockSchema.column === D.blockSchema.column;
|
|
873
768
|
}
|
|
874
|
-
function
|
|
875
|
-
const
|
|
876
|
-
return
|
|
769
|
+
function We(e) {
|
|
770
|
+
const t = [];
|
|
771
|
+
return Ne(e) && t.push(
|
|
877
772
|
{
|
|
878
|
-
...
|
|
879
|
-
icon: /* @__PURE__ */
|
|
773
|
+
...N(e).slash_menu.two_columns,
|
|
774
|
+
icon: /* @__PURE__ */ S(xe, { size: 18 }),
|
|
880
775
|
onItemClick: () => {
|
|
881
|
-
|
|
776
|
+
P(e, {
|
|
882
777
|
type: "columnList",
|
|
883
778
|
children: [
|
|
884
779
|
{
|
|
@@ -902,10 +797,10 @@ function Ke(o) {
|
|
|
902
797
|
}
|
|
903
798
|
},
|
|
904
799
|
{
|
|
905
|
-
...
|
|
906
|
-
icon: /* @__PURE__ */
|
|
800
|
+
...N(e).slash_menu.three_columns,
|
|
801
|
+
icon: /* @__PURE__ */ S(Se, { size: 18 }),
|
|
907
802
|
onItemClick: () => {
|
|
908
|
-
|
|
803
|
+
P(e, {
|
|
909
804
|
type: "columnList",
|
|
910
805
|
children: [
|
|
911
806
|
{
|
|
@@ -936,17 +831,18 @@ function Ke(o) {
|
|
|
936
831
|
});
|
|
937
832
|
}
|
|
938
833
|
}
|
|
939
|
-
),
|
|
834
|
+
), t;
|
|
940
835
|
}
|
|
941
836
|
export {
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
837
|
+
H as ColumnBlock,
|
|
838
|
+
z as ColumnListBlock,
|
|
839
|
+
Ne as checkMultiColumnBlocksInSchema,
|
|
840
|
+
j as detectEdgePosition,
|
|
841
|
+
N as getMultiColumnDictionary,
|
|
842
|
+
We as getMultiColumnSlashMenuItems,
|
|
843
|
+
He as locales,
|
|
844
|
+
ze as multiColumnDropCursor,
|
|
845
|
+
D as multiColumnSchema,
|
|
846
|
+
Re as withMultiColumn
|
|
951
847
|
};
|
|
952
848
|
//# sourceMappingURL=blocknote-xl-multi-column.js.map
|