@jackuait/blok 0.6.0-beta.6 → 0.6.0-beta.8
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/blok.mjs +2 -2
- package/dist/chunks/{blok-BOtlKwVO.mjs → blok-bzxy6Olq.mjs} +187 -173
- package/dist/chunks/{i18next-loader-CJNShSyT.mjs → i18next-loader-CzL6YHyQ.mjs} +1 -1
- package/dist/chunks/{index-BUAPAChM.mjs → index-DSSrx_Co.mjs} +1 -1
- package/dist/chunks/{inline-tool-convert-UoYdJJic.mjs → inline-tool-convert-D4SXxjDd.mjs} +1 -1
- package/dist/full.mjs +2 -2
- package/dist/tools.mjs +39 -39
- package/package.json +1 -1
- package/src/components/modules/api/blocks.ts +18 -0
- package/src/components/modules/rectangleSelection.ts +6 -3
- package/src/components/modules/saver.ts +3 -2
- package/src/components/modules/toolbar/index.ts +52 -16
- package/src/components/modules/toolbar/plus-button.ts +22 -1
- package/src/tools/table/table-add-controls.ts +1 -1
- package/src/tools/table/table-cell-blocks.ts +6 -0
- package/types/api/blocks.d.ts +8 -0
|
@@ -9,7 +9,7 @@ var Io = (s, t, e) => t in s ? qi(s, t, { enumerable: !0, configurable: !0, writ
|
|
|
9
9
|
for (var e of Ce(t))
|
|
10
10
|
cs.call(t, e) && Io(s, e, t[e]);
|
|
11
11
|
return s;
|
|
12
|
-
},
|
|
12
|
+
}, j = (s, t) => Zi(s, Ji(t));
|
|
13
13
|
var Eo = (s, t) => {
|
|
14
14
|
var e = {};
|
|
15
15
|
for (var o in s)
|
|
@@ -20,7 +20,7 @@ var Eo = (s, t) => {
|
|
|
20
20
|
return e;
|
|
21
21
|
};
|
|
22
22
|
var Ie = (s, t, e) => Io(s, typeof t != "symbol" ? t + "" : t, e);
|
|
23
|
-
import { L as uo, l as C, c as Qi, i as z, a as k, S as w, D as y, t as O, b as I, P as G, E as yn, g as wt, d as tl, e as gr, f as $e, h as
|
|
23
|
+
import { L as uo, l as C, c as Qi, i as z, a as k, S as w, D as y, t as O, b as I, P as G, E as yn, g as wt, d as tl, e as gr, f as $e, h as ot, j as A, k as le, m as Ut, n as kr, s as el, o as po, p as Bn, q as wn, r as T, u as Vo, v as hs, F as ae, w as Wo, x as ds, y as us, z as ut, A as ol, B as nl, C as sl, I as rl, G as Xo, H as Ke, J as ce, K as Mt, M as br, N as Ot, O as K, Q as Ht, R as il, T as ll, U as ps, V as al, W as cl, X as hl, Y as dl, Z as ul, _ as mr, $ as pl, a0 as yr, a1 as Br, a2 as Ct, a3 as fl, a4 as wr, a5 as vr, a6 as gl, a7 as kl, a8 as bl, a9 as ml, aa as yl, ab as Bl, ac as fs, ad as xr, ae as wl, af as vl, ag as xl, ah as Tl, ai as Sl, aj as Cl, ak as Il, al as El } from "./inline-tool-convert-D4SXxjDd.mjs";
|
|
24
24
|
function Ml(s) {
|
|
25
25
|
return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
|
|
26
26
|
}
|
|
@@ -928,7 +928,7 @@ class jl {
|
|
|
928
928
|
});
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
|
-
var
|
|
931
|
+
var st = /* @__PURE__ */ ((s) => (s.RENDERED = "rendered", s.MOVED = "moved", s.UPDATED = "updated", s.REMOVED = "removed", s.ON_PASTE = "onPaste", s))(st || {});
|
|
932
932
|
class vn extends yn {
|
|
933
933
|
/**
|
|
934
934
|
* @param options - block constructor options
|
|
@@ -1411,6 +1411,7 @@ class Ul extends x {
|
|
|
1411
1411
|
update: this.update,
|
|
1412
1412
|
composeBlockData: this.composeBlockData,
|
|
1413
1413
|
convert: this.convert,
|
|
1414
|
+
setBlockParent: (t, e) => this.setBlockParent(t, e),
|
|
1414
1415
|
stopBlockMutationWatching: (t) => this.stopBlockMutationWatching(t),
|
|
1415
1416
|
splitBlock: this.splitBlock
|
|
1416
1417
|
};
|
|
@@ -1436,7 +1437,7 @@ class Ul extends x {
|
|
|
1436
1437
|
getBlockIndex(t) {
|
|
1437
1438
|
const e = this.Blok.BlockManager.getBlockById(t);
|
|
1438
1439
|
if (!e) {
|
|
1439
|
-
|
|
1440
|
+
ot("There is no block with id `" + t + "`", "warn");
|
|
1440
1441
|
return;
|
|
1441
1442
|
}
|
|
1442
1443
|
return this.Blok.BlockManager.getBlockIndex(e);
|
|
@@ -1448,7 +1449,7 @@ class Ul extends x {
|
|
|
1448
1449
|
getBlockByIndex(t) {
|
|
1449
1450
|
const e = this.Blok.BlockManager.getBlockByIndex(t);
|
|
1450
1451
|
if (e === void 0) {
|
|
1451
|
-
|
|
1452
|
+
ot("There is no block at index `" + t + "`", "warn");
|
|
1452
1453
|
return;
|
|
1453
1454
|
}
|
|
1454
1455
|
return new et(e);
|
|
@@ -1459,7 +1460,7 @@ class Ul extends x {
|
|
|
1459
1460
|
*/
|
|
1460
1461
|
getById(t) {
|
|
1461
1462
|
const e = this.Blok.BlockManager.getBlockById(t);
|
|
1462
|
-
return e === void 0 ? (
|
|
1463
|
+
return e === void 0 ? (ot("There is no block with id `" + t + "`", "warn"), null) : new et(e);
|
|
1463
1464
|
}
|
|
1464
1465
|
/**
|
|
1465
1466
|
* Get Block API object by any child html element
|
|
@@ -1469,7 +1470,7 @@ class Ul extends x {
|
|
|
1469
1470
|
var o, n;
|
|
1470
1471
|
const e = this.Blok.BlockManager.getBlock(t);
|
|
1471
1472
|
if (e === void 0) {
|
|
1472
|
-
|
|
1473
|
+
ot(`There is no block corresponding to element <${(n = (o = t.tagName) == null ? void 0 : o.toLowerCase()) != null ? n : "unknown"}>`, "warn");
|
|
1473
1474
|
return;
|
|
1474
1475
|
}
|
|
1475
1476
|
return new et(e);
|
|
@@ -1498,13 +1499,13 @@ class Ul extends x {
|
|
|
1498
1499
|
async delete(t = this.Blok.BlockManager.currentBlockIndex) {
|
|
1499
1500
|
const e = this.Blok.BlockManager.getBlockByIndex(t);
|
|
1500
1501
|
if (e === void 0) {
|
|
1501
|
-
|
|
1502
|
+
ot(`There is no block at index \`${t}\``, "warn");
|
|
1502
1503
|
return;
|
|
1503
1504
|
}
|
|
1504
1505
|
try {
|
|
1505
1506
|
await this.Blok.BlockManager.removeBlock(e);
|
|
1506
1507
|
} catch (o) {
|
|
1507
|
-
|
|
1508
|
+
ot(o, "warn");
|
|
1508
1509
|
return;
|
|
1509
1510
|
}
|
|
1510
1511
|
this.Blok.BlockManager.blocks.length === 0 && this.Blok.BlockManager.insert(), this.Blok.BlockManager.currentBlock && this.Blok.Caret.setToBlock(this.Blok.BlockManager.currentBlock, this.Blok.Caret.positions.END), this.Blok.Toolbar.close();
|
|
@@ -1532,6 +1533,19 @@ class Ul extends x {
|
|
|
1532
1533
|
async renderFromHTML(t) {
|
|
1533
1534
|
return await this.Blok.BlockManager.clear(), this.Blok.Paste.processText(t, !0);
|
|
1534
1535
|
}
|
|
1536
|
+
/**
|
|
1537
|
+
* Sets the parent of a block, updating both the block's parentId and the parent's contentIds.
|
|
1538
|
+
* @param blockId - id of the block to reparent
|
|
1539
|
+
* @param parentId - id of the new parent block, or null for root level
|
|
1540
|
+
*/
|
|
1541
|
+
setBlockParent(t, e) {
|
|
1542
|
+
const o = this.Blok.BlockManager.getBlockById(t);
|
|
1543
|
+
if (o === void 0) {
|
|
1544
|
+
ot("There is no block with id `" + t + "`", "warn");
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
this.Blok.BlockManager.setBlockParent(o, e);
|
|
1548
|
+
}
|
|
1535
1549
|
/**
|
|
1536
1550
|
* Stops mutation watching on a block at the specified index.
|
|
1537
1551
|
* This is used to prevent spurious block-changed events during block replacement.
|
|
@@ -1783,7 +1797,7 @@ class ql {
|
|
|
1783
1797
|
* @returns {Promise<NotifierModule>} loaded notifier module
|
|
1784
1798
|
*/
|
|
1785
1799
|
loadNotifierModule() {
|
|
1786
|
-
return this.notifierModule !== null ? Promise.resolve(this.notifierModule) : (this.loadingPromise === null && (this.loadingPromise = import("./index-
|
|
1800
|
+
return this.notifierModule !== null ? Promise.resolve(this.notifierModule) : (this.loadingPromise === null && (this.loadingPromise = import("./index-DSSrx_Co.mjs").then((t) => {
|
|
1787
1801
|
const e = t;
|
|
1788
1802
|
if (!this.isNotifierModule(e))
|
|
1789
1803
|
throw new Error('notifier module does not expose a "show" method.');
|
|
@@ -1919,8 +1933,8 @@ function ta() {
|
|
|
1919
1933
|
}
|
|
1920
1934
|
var b = i(f), g;
|
|
1921
1935
|
b && (g = Array.prototype.some.call(f.childNodes, n));
|
|
1922
|
-
var m = !!u.parentNode, v = n(u) && n(f) && m, S = f.nodeName.toLowerCase(),
|
|
1923
|
-
if (Q || c(f,
|
|
1936
|
+
var m = !!u.parentNode, v = n(u) && n(f) && m, S = f.nodeName.toLowerCase(), L = a(this.config, S, f), Q = b && g;
|
|
1937
|
+
if (Q || c(f, L) || !this.config.keepNestedBlockElements && v) {
|
|
1924
1938
|
if (!(f.nodeName === "SCRIPT" || f.nodeName === "STYLE"))
|
|
1925
1939
|
for (; f.childNodes.length > 0; )
|
|
1926
1940
|
u.insertBefore(f.childNodes[0], f);
|
|
@@ -1929,7 +1943,7 @@ function ta() {
|
|
|
1929
1943
|
}
|
|
1930
1944
|
for (var X = 0; X < f.attributes.length; X += 1) {
|
|
1931
1945
|
var St = f.attributes[X];
|
|
1932
|
-
h(St,
|
|
1946
|
+
h(St, L, f) && (f.removeAttribute(St.name), X = X - 1);
|
|
1933
1947
|
}
|
|
1934
1948
|
this._sanitize(d, f);
|
|
1935
1949
|
} while (f = p.nextSibling());
|
|
@@ -1959,7 +1973,7 @@ function ta() {
|
|
|
1959
1973
|
var ea = ta();
|
|
1960
1974
|
const oa = /* @__PURE__ */ Ml(ea), na = /^\s*(?:javascript\s*:|data\s*:\s*text\s*\/\s*html)/i, sa = /\s*(?:href|src)\s*=\s*(?:"\s*(?:javascript\s*:|data\s*:\s*text\s*\/\s*html)[^"]*"|'\s*(?:javascript\s*:|data\s*:\s*text\s*\/\s*html)[^']*|(?:javascript\s*:|data\s*:\s*text\s*\/\s*html)[^ \t\r\n>]*)/gi, fo = (s, t, e = {}) => s.map((o) => {
|
|
1961
1975
|
const n = I(t) ? t(o.tool) : t, r = n != null ? n : {};
|
|
1962
|
-
return A(r) && z(r) && z(e) ? o :
|
|
1976
|
+
return A(r) && z(r) && z(e) ? o : j(B({}, o), {
|
|
1963
1977
|
data: xn(o.data, r, e)
|
|
1964
1978
|
});
|
|
1965
1979
|
}), ct = (s, t = {}) => {
|
|
@@ -2140,7 +2154,7 @@ class ba extends x {
|
|
|
2140
2154
|
var r, i;
|
|
2141
2155
|
const t = "Blok's content can not be saved in read-only mode";
|
|
2142
2156
|
if (this.Blok.ReadOnly.isEnabled)
|
|
2143
|
-
throw
|
|
2157
|
+
throw ot(t, "warn"), new Error(t);
|
|
2144
2158
|
const e = await this.Blok.Saver.save();
|
|
2145
2159
|
if (e !== void 0)
|
|
2146
2160
|
return e;
|
|
@@ -2268,7 +2282,7 @@ class Ba extends x {
|
|
|
2268
2282
|
*/
|
|
2269
2283
|
toggleBlockSettings(t) {
|
|
2270
2284
|
if (this.Blok.BlockManager.currentBlockIndex === -1) {
|
|
2271
|
-
|
|
2285
|
+
ot("Could't toggle the Toolbar because there is no block selected ", "warn");
|
|
2272
2286
|
return;
|
|
2273
2287
|
}
|
|
2274
2288
|
(t != null ? t : !this.Blok.BlockSettings.opened) ? (this.Blok.Toolbar.moveAndOpen(), this.Blok.BlockSettings.open()) : this.Blok.BlockSettings.close();
|
|
@@ -2279,7 +2293,7 @@ class Ba extends x {
|
|
|
2279
2293
|
*/
|
|
2280
2294
|
toggleToolbox(t) {
|
|
2281
2295
|
if (this.Blok.BlockManager.currentBlockIndex === -1) {
|
|
2282
|
-
|
|
2296
|
+
ot("Could't toggle the Toolbox because there is no block selected ", "warn");
|
|
2283
2297
|
return;
|
|
2284
2298
|
}
|
|
2285
2299
|
(t != null ? t : !this.Blok.Toolbar.toolbox.opened) ? (this.Blok.Toolbar.moveAndOpen(), this.Blok.Toolbar.toolbox.open()) : this.Blok.Toolbar.toolbox.close();
|
|
@@ -2508,30 +2522,30 @@ const In = () => new we(), za = (s) => {
|
|
|
2508
2522
|
}, Ya = (s, t) => {
|
|
2509
2523
|
const e = s.cbuf.length;
|
|
2510
2524
|
e - s.cpos < t && (s.bufs.push(new Uint8Array(s.cbuf.buffer, 0, s.cpos)), s.cbuf = new Uint8Array(Jt(e, t) * 2), s.cpos = 0);
|
|
2511
|
-
},
|
|
2525
|
+
}, _ = (s, t) => {
|
|
2512
2526
|
const e = s.cbuf.length;
|
|
2513
2527
|
s.cpos === e && (s.bufs.push(s.cbuf), s.cbuf = new Uint8Array(e * 2), s.cpos = 0), s.cbuf[s.cpos++] = t;
|
|
2514
|
-
}, Qo =
|
|
2528
|
+
}, Qo = _, E = (s, t) => {
|
|
2515
2529
|
for (; t > ne; )
|
|
2516
|
-
|
|
2517
|
-
|
|
2530
|
+
_(s, We | ne & t), t = ft(t / 128);
|
|
2531
|
+
_(s, ne & t);
|
|
2518
2532
|
}, En = (s, t) => {
|
|
2519
2533
|
const e = Ea(t);
|
|
2520
|
-
for (e && (t = -t),
|
|
2521
|
-
|
|
2534
|
+
for (e && (t = -t), _(s, (t > ws ? We : 0) | (e ? Mr : 0) | ws & t), t = ft(t / 64); t > 0; )
|
|
2535
|
+
_(s, (t > ne ? We : 0) | ne & t), t = ft(t / 128);
|
|
2522
2536
|
}, tn = new Uint8Array(3e4), $a = tn.length / 3, Ka = (s, t) => {
|
|
2523
2537
|
if (t.length < $a) {
|
|
2524
2538
|
const e = ue.encodeInto(t, tn).written || 0;
|
|
2525
2539
|
E(s, e);
|
|
2526
2540
|
for (let o = 0; o < e; o++)
|
|
2527
|
-
|
|
2541
|
+
_(s, tn[o]);
|
|
2528
2542
|
} else
|
|
2529
2543
|
Z(s, ja(t));
|
|
2530
2544
|
}, Va = (s, t) => {
|
|
2531
2545
|
const e = unescape(encodeURIComponent(t)), o = e.length;
|
|
2532
2546
|
E(s, o);
|
|
2533
2547
|
for (let n = 0; n < o; n++)
|
|
2534
|
-
|
|
2548
|
+
_(
|
|
2535
2549
|
s,
|
|
2536
2550
|
/** @type {number} */
|
|
2537
2551
|
e.codePointAt(n)
|
|
@@ -2552,25 +2566,25 @@ ue.encodeInto ? Ka : Va, Mn = (s, t) => {
|
|
|
2552
2566
|
), Ss = new DataView(new ArrayBuffer(4)), qa = (s) => (Ss.setFloat32(0, s), Ss.getFloat32(0) === s), pe = (s, t) => {
|
|
2553
2567
|
switch (typeof t) {
|
|
2554
2568
|
case "string":
|
|
2555
|
-
|
|
2569
|
+
_(s, 119), Ft(s, t);
|
|
2556
2570
|
break;
|
|
2557
2571
|
case "number":
|
|
2558
|
-
Ra(t) && Le(t) <= Da ? (
|
|
2572
|
+
Ra(t) && Le(t) <= Da ? (_(s, 125), En(s, t)) : qa(t) ? (_(s, 124), Wa(s, t)) : (_(s, 123), Xa(s, t));
|
|
2559
2573
|
break;
|
|
2560
2574
|
case "bigint":
|
|
2561
|
-
|
|
2575
|
+
_(s, 122), Ga(s, t);
|
|
2562
2576
|
break;
|
|
2563
2577
|
case "object":
|
|
2564
2578
|
if (t === null)
|
|
2565
|
-
|
|
2579
|
+
_(s, 126);
|
|
2566
2580
|
else if ($t(t)) {
|
|
2567
|
-
|
|
2581
|
+
_(s, 117), E(s, t.length);
|
|
2568
2582
|
for (let e = 0; e < t.length; e++)
|
|
2569
2583
|
pe(s, t[e]);
|
|
2570
2584
|
} else if (t instanceof Uint8Array)
|
|
2571
|
-
|
|
2585
|
+
_(s, 116), Z(s, t);
|
|
2572
2586
|
else {
|
|
2573
|
-
|
|
2587
|
+
_(s, 118);
|
|
2574
2588
|
const e = Object.keys(t);
|
|
2575
2589
|
E(s, e.length);
|
|
2576
2590
|
for (let o = 0; o < e.length; o++) {
|
|
@@ -2580,10 +2594,10 @@ ue.encodeInto ? Ka : Va, Mn = (s, t) => {
|
|
|
2580
2594
|
}
|
|
2581
2595
|
break;
|
|
2582
2596
|
case "boolean":
|
|
2583
|
-
|
|
2597
|
+
_(s, t ? 120 : 121);
|
|
2584
2598
|
break;
|
|
2585
2599
|
default:
|
|
2586
|
-
|
|
2600
|
+
_(s, 127);
|
|
2587
2601
|
}
|
|
2588
2602
|
};
|
|
2589
2603
|
class Cs extends we {
|
|
@@ -3006,7 +3020,7 @@ class Ln extends $ {
|
|
|
3006
3020
|
return !o && (e == null || e.extend(null, "custom prop", t == null ? void 0 : t.constructor.name, "failed to check custom prop")), o;
|
|
3007
3021
|
}
|
|
3008
3022
|
}
|
|
3009
|
-
const
|
|
3023
|
+
const F = (s) => new Ln(s);
|
|
3010
3024
|
N(Ln);
|
|
3011
3025
|
class go extends $ {
|
|
3012
3026
|
/**
|
|
@@ -3128,7 +3142,7 @@ let qe = lo;
|
|
|
3128
3142
|
const Ic = (s) => (
|
|
3129
3143
|
/** @type {any} */
|
|
3130
3144
|
new qe(s)
|
|
3131
|
-
), Ec = N(qe), Mc =
|
|
3145
|
+
), Ec = N(qe), Mc = F((s) => s != null && (s.constructor === Object || s.constructor == null));
|
|
3132
3146
|
class Fr extends $ {
|
|
3133
3147
|
/**
|
|
3134
3148
|
* @param {Keys} keys
|
|
@@ -3194,7 +3208,7 @@ class zr extends $ {
|
|
|
3194
3208
|
return !o && (e == null || e.extend(null, "Array", "")), o;
|
|
3195
3209
|
}
|
|
3196
3210
|
}
|
|
3197
|
-
const Yr = (...s) => new zr(s), Rc = N(zr), Oc =
|
|
3211
|
+
const Yr = (...s) => new zr(s), Rc = N(zr), Oc = F((s) => $t(s));
|
|
3198
3212
|
class $r extends $ {
|
|
3199
3213
|
/**
|
|
3200
3214
|
* @param {new (...args:any) => T} constructor
|
|
@@ -3233,7 +3247,7 @@ class _c extends $ {
|
|
|
3233
3247
|
return !o && (e == null || e.extend(null, "function", typeof t)), o;
|
|
3234
3248
|
}
|
|
3235
3249
|
}
|
|
3236
|
-
const Pc = N(_c), Hc =
|
|
3250
|
+
const Pc = N(_c), Hc = F((s) => typeof s == "function");
|
|
3237
3251
|
class Fc extends $ {
|
|
3238
3252
|
/**
|
|
3239
3253
|
* @param {T} v
|
|
@@ -3273,23 +3287,23 @@ Ie(bo, "_dilutes", !0);
|
|
|
3273
3287
|
const Qt = (...s) => s.findIndex((t) => Ze.check(t)) >= 0 ? Qt(...s.map((t) => ke(t)).map((t) => Ze.check(t) ? t.shape : [t]).flat(1)) : s.length === 1 ? s[0] : new bo(s), Ze = (
|
|
3274
3288
|
/** @type {Schema<$Union<any>>} */
|
|
3275
3289
|
N(bo)
|
|
3276
|
-
), Kr = () => !0, Je =
|
|
3290
|
+
), Kr = () => !0, Je = F(Kr), jc = (
|
|
3277
3291
|
/** @type {Schema<Schema<any>>} */
|
|
3278
3292
|
N(Ln, (s) => s.shape === Kr)
|
|
3279
|
-
), _n =
|
|
3293
|
+
), _n = F((s) => typeof s == "bigint"), Uc = (
|
|
3280
3294
|
/** @type {Schema<Schema<BigInt>>} */
|
|
3281
|
-
|
|
3282
|
-
), Vr =
|
|
3283
|
-
|
|
3284
|
-
const jt =
|
|
3295
|
+
F((s) => s === _n)
|
|
3296
|
+
), Vr = F((s) => typeof s == "symbol");
|
|
3297
|
+
F((s) => s === Vr);
|
|
3298
|
+
const jt = F((s) => typeof s == "number"), Wr = (
|
|
3285
3299
|
/** @type {Schema<Schema<number>>} */
|
|
3286
|
-
|
|
3287
|
-
), Kt =
|
|
3300
|
+
F((s) => s === jt)
|
|
3301
|
+
), Kt = F((s) => typeof s == "string"), Xr = (
|
|
3288
3302
|
/** @type {Schema<Schema<string>>} */
|
|
3289
|
-
|
|
3290
|
-
), mo =
|
|
3303
|
+
F((s) => s === Kt)
|
|
3304
|
+
), mo = F((s) => typeof s == "boolean"), zc = (
|
|
3291
3305
|
/** @type {Schema<Schema<Boolean>>} */
|
|
3292
|
-
|
|
3306
|
+
F((s) => s === mo)
|
|
3293
3307
|
), Gr = ko(void 0);
|
|
3294
3308
|
N(go, (s) => s.shape.length === 1 && s.shape[0] === void 0);
|
|
3295
3309
|
ko(void 0);
|
|
@@ -3447,12 +3461,12 @@ const Vc = (s) => new Kc(
|
|
|
3447
3461
|
/** @type {Document} */
|
|
3448
3462
|
typeof document != "undefined" ? document : {}
|
|
3449
3463
|
);
|
|
3450
|
-
|
|
3464
|
+
F((s) => s.nodeType === Zc);
|
|
3451
3465
|
typeof DOMParser != "undefined" && new DOMParser();
|
|
3452
|
-
|
|
3453
|
-
|
|
3466
|
+
F((s) => s.nodeType === Xc);
|
|
3467
|
+
F((s) => s.nodeType === Gc);
|
|
3454
3468
|
const Wc = (s) => Ta(s, (t, e) => `${e}:${t};`).join(""), Xc = Bo.ELEMENT_NODE, Gc = Bo.TEXT_NODE, qc = Bo.DOCUMENT_NODE, Zc = Bo.DOCUMENT_FRAGMENT_NODE;
|
|
3455
|
-
|
|
3469
|
+
F((s) => s.nodeType === qc);
|
|
3456
3470
|
const mt = Symbol, Zr = mt(), Jr = mt(), Jc = mt(), Qc = mt(), th = mt(), Qr = mt(), eh = mt(), Pn = mt(), oh = mt(), nh = (s) => {
|
|
3457
3471
|
var n;
|
|
3458
3472
|
s.length === 1 && ((n = s[0]) == null ? void 0 : n.constructor) === Function && (s = /** @type {Array<string|Symbol|Object|number>} */
|
|
@@ -3701,14 +3715,14 @@ class Rt extends Ir {
|
|
|
3701
3715
|
*/
|
|
3702
3716
|
get(t, e = (
|
|
3703
3717
|
/** @type {any} */
|
|
3704
|
-
|
|
3718
|
+
P
|
|
3705
3719
|
)) {
|
|
3706
3720
|
const o = Zt(this.share, t, () => {
|
|
3707
3721
|
const r = new e();
|
|
3708
3722
|
return r._integrate(this, null), r;
|
|
3709
3723
|
}), n = o.constructor;
|
|
3710
|
-
if (e !==
|
|
3711
|
-
if (n ===
|
|
3724
|
+
if (e !== P && n !== e)
|
|
3725
|
+
if (n === P) {
|
|
3712
3726
|
const r = new e();
|
|
3713
3727
|
r._map = o._map, o._map.forEach(
|
|
3714
3728
|
/** @param {Item?} n */
|
|
@@ -3810,7 +3824,7 @@ class Rt extends Ir {
|
|
|
3810
3824
|
/** @type {ContentDoc} */
|
|
3811
3825
|
t.content
|
|
3812
3826
|
);
|
|
3813
|
-
e.doc = new Rt(
|
|
3827
|
+
e.doc = new Rt(j(B({ guid: this.guid }, e.opts), { shouldLoad: !1 })), e.doc._item = t, M(
|
|
3814
3828
|
/** @type {any} */
|
|
3815
3829
|
t.parent.doc,
|
|
3816
3830
|
(o) => {
|
|
@@ -4429,7 +4443,7 @@ class Ih extends Ir {
|
|
|
4429
4443
|
addToScope(t) {
|
|
4430
4444
|
const e = new Set(this.scope);
|
|
4431
4445
|
t = $t(t) ? t : [t], t.forEach((o) => {
|
|
4432
|
-
e.has(o) || (e.add(o), (o instanceof
|
|
4446
|
+
e.has(o) || (e.add(o), (o instanceof P ? o.doc !== this.doc : o !== this.doc) && ei("[yjs#509] Not same Y.Doc"), this.scope.push(o));
|
|
4433
4447
|
});
|
|
4434
4448
|
}
|
|
4435
4449
|
/**
|
|
@@ -4741,7 +4755,7 @@ const Ah = (s) => {
|
|
|
4741
4755
|
s._item.parent;
|
|
4742
4756
|
ri(o._eH, e, t);
|
|
4743
4757
|
};
|
|
4744
|
-
class
|
|
4758
|
+
class P {
|
|
4745
4759
|
constructor() {
|
|
4746
4760
|
this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH = Ns(), this._dEH = Ns(), this._searchMarker = null;
|
|
4747
4761
|
}
|
|
@@ -4966,7 +4980,7 @@ const di = (s, t, e) => {
|
|
|
4966
4980
|
)), n.integrate(s, 0);
|
|
4967
4981
|
break;
|
|
4968
4982
|
default:
|
|
4969
|
-
if (d instanceof
|
|
4983
|
+
if (d instanceof P)
|
|
4970
4984
|
n = new R(D(i, W(l, i)), n, n && n.lastId, a, a && a.id, t, null, new Tt(d)), n.integrate(s, 0);
|
|
4971
4985
|
else
|
|
4972
4986
|
throw new Error("Unexpected content type in insert operation");
|
|
@@ -5044,7 +5058,7 @@ const di = (s, t, e) => {
|
|
|
5044
5058
|
);
|
|
5045
5059
|
break;
|
|
5046
5060
|
default:
|
|
5047
|
-
if (o instanceof
|
|
5061
|
+
if (o instanceof P)
|
|
5048
5062
|
l = new Tt(o);
|
|
5049
5063
|
else
|
|
5050
5064
|
throw new Error("Unexpected content type");
|
|
@@ -5084,7 +5098,7 @@ const di = (s, t, e) => {
|
|
|
5084
5098
|
};
|
|
5085
5099
|
class Lh extends wo {
|
|
5086
5100
|
}
|
|
5087
|
-
class At extends
|
|
5101
|
+
class At extends P {
|
|
5088
5102
|
constructor() {
|
|
5089
5103
|
super(), this._prelimContent = [], this._searchMarker = [];
|
|
5090
5104
|
}
|
|
@@ -5131,7 +5145,7 @@ class At extends _ {
|
|
|
5131
5145
|
clone() {
|
|
5132
5146
|
const t = new At();
|
|
5133
5147
|
return t.insert(0, this.toArray().map(
|
|
5134
|
-
(e) => e instanceof
|
|
5148
|
+
(e) => e instanceof P ? (
|
|
5135
5149
|
/** @type {typeof el} */
|
|
5136
5150
|
e.clone()
|
|
5137
5151
|
) : e
|
|
@@ -5247,7 +5261,7 @@ class At extends _ {
|
|
|
5247
5261
|
* @return {Array<any>}
|
|
5248
5262
|
*/
|
|
5249
5263
|
toJSON() {
|
|
5250
|
-
return this.map((t) => t instanceof
|
|
5264
|
+
return this.map((t) => t instanceof P ? t.toJSON() : t);
|
|
5251
5265
|
}
|
|
5252
5266
|
/**
|
|
5253
5267
|
* Returns an Array with the result of calling a provided function on every
|
|
@@ -5296,7 +5310,7 @@ class _h extends wo {
|
|
|
5296
5310
|
super(t, e), this.keysChanged = o;
|
|
5297
5311
|
}
|
|
5298
5312
|
}
|
|
5299
|
-
class J extends
|
|
5313
|
+
class J extends P {
|
|
5300
5314
|
/**
|
|
5301
5315
|
*
|
|
5302
5316
|
* @param {Iterable<readonly [string, any]>=} entries - an optional iterable to initialize the YMap
|
|
@@ -5335,7 +5349,7 @@ class J extends _ {
|
|
|
5335
5349
|
clone() {
|
|
5336
5350
|
const t = new J();
|
|
5337
5351
|
return this.forEach((e, o) => {
|
|
5338
|
-
t.set(o, e instanceof
|
|
5352
|
+
t.set(o, e instanceof P ? (
|
|
5339
5353
|
/** @type {typeof value} */
|
|
5340
5354
|
e.clone()
|
|
5341
5355
|
) : e);
|
|
@@ -5362,7 +5376,7 @@ class J extends _ {
|
|
|
5362
5376
|
return this._map.forEach((o, n) => {
|
|
5363
5377
|
if (!o.deleted) {
|
|
5364
5378
|
const r = o.content.getContent()[o.length - 1];
|
|
5365
|
-
t[n] = r instanceof
|
|
5379
|
+
t[n] = r instanceof P ? r.toJSON() : r;
|
|
5366
5380
|
}
|
|
5367
5381
|
}), t;
|
|
5368
5382
|
}
|
|
@@ -5515,7 +5529,7 @@ class rn {
|
|
|
5515
5529
|
*/
|
|
5516
5530
|
forward() {
|
|
5517
5531
|
switch (this.right === null && gt(), this.right.content.constructor) {
|
|
5518
|
-
case
|
|
5532
|
+
case H:
|
|
5519
5533
|
this.right.deleted || te(
|
|
5520
5534
|
this.currentAttributes,
|
|
5521
5535
|
/** @type {ContentFormat} */
|
|
@@ -5532,7 +5546,7 @@ class rn {
|
|
|
5532
5546
|
const Ys = (s, t, e) => {
|
|
5533
5547
|
for (; t.right !== null && e > 0; ) {
|
|
5534
5548
|
switch (t.right.content.constructor) {
|
|
5535
|
-
case
|
|
5549
|
+
case H:
|
|
5536
5550
|
t.right.deleted || te(
|
|
5537
5551
|
t.currentAttributes,
|
|
5538
5552
|
/** @type {ContentFormat} */
|
|
@@ -5556,7 +5570,7 @@ const Ys = (s, t, e) => {
|
|
|
5556
5570
|
return Ys(s, i, e);
|
|
5557
5571
|
}
|
|
5558
5572
|
}, Bi = (s, t, e, o) => {
|
|
5559
|
-
for (; e.right !== null && (e.right.deleted === !0 || e.right.content.constructor ===
|
|
5573
|
+
for (; e.right !== null && (e.right.deleted === !0 || e.right.content.constructor === H && Bt(
|
|
5560
5574
|
o.get(
|
|
5561
5575
|
/** @type {ContentFormat} */
|
|
5562
5576
|
e.right.content.key
|
|
@@ -5570,7 +5584,7 @@ const Ys = (s, t, e) => {
|
|
|
5570
5584
|
), e.forward();
|
|
5571
5585
|
const n = s.doc, r = n.clientID;
|
|
5572
5586
|
o.forEach((i, l) => {
|
|
5573
|
-
const a = e.left, c = e.right, h = new R(D(r, W(n.store, r)), a, a && a.lastId, c, c && c.id, t, null, new
|
|
5587
|
+
const a = e.left, c = e.right, h = new R(D(r, W(n.store, r)), a, a && a.lastId, c, c && c.id, t, null, new H(l, i));
|
|
5574
5588
|
h.integrate(s, 0), e.right = h, e.forward();
|
|
5575
5589
|
});
|
|
5576
5590
|
}, te = (s, t) => {
|
|
@@ -5579,7 +5593,7 @@ const Ys = (s, t, e) => {
|
|
|
5579
5593
|
}, wi = (s, t) => {
|
|
5580
5594
|
var e;
|
|
5581
5595
|
for (; s.right !== null; ) {
|
|
5582
|
-
if (!(s.right.deleted || s.right.content.constructor ===
|
|
5596
|
+
if (!(s.right.deleted || s.right.content.constructor === H && Bt(
|
|
5583
5597
|
(e = t[
|
|
5584
5598
|
/** @type {ContentFormat} */
|
|
5585
5599
|
s.right.content.key
|
|
@@ -5597,7 +5611,7 @@ const Ys = (s, t, e) => {
|
|
|
5597
5611
|
if (!Bt(h, c)) {
|
|
5598
5612
|
i.set(a, h);
|
|
5599
5613
|
const { left: d, right: u } = e;
|
|
5600
|
-
e.right = new R(D(r, W(n.store, r)), d, d && d.lastId, u, u && u.id, t, null, new
|
|
5614
|
+
e.right = new R(D(r, W(n.store, r)), d, d && d.lastId, u, u && u.id, t, null, new H(a, c)), e.right.integrate(s, 0), e.forward();
|
|
5601
5615
|
}
|
|
5602
5616
|
}
|
|
5603
5617
|
return i;
|
|
@@ -5610,17 +5624,17 @@ const Ys = (s, t, e) => {
|
|
|
5610
5624
|
const l = vi(s, t, e, n), a = o.constructor === String ? new bt(
|
|
5611
5625
|
/** @type {string} */
|
|
5612
5626
|
o
|
|
5613
|
-
) : o instanceof
|
|
5627
|
+
) : o instanceof P ? new Tt(o) : new ee(o);
|
|
5614
5628
|
let { left: c, right: h, index: d } = e;
|
|
5615
5629
|
t._searchMarker && be(t._searchMarker, e.index, a.getLength()), h = new R(D(i, W(r.store, i)), c, c && c.lastId, h, h && h.id, t, null, a), h.integrate(s, 0), e.right = h, e.index = d, e.forward(), Bi(s, t, e, l);
|
|
5616
5630
|
}, $s = (s, t, e, o, n) => {
|
|
5617
5631
|
const r = s.doc, i = r.clientID;
|
|
5618
5632
|
wi(e, n);
|
|
5619
5633
|
const l = vi(s, t, e, n);
|
|
5620
|
-
t: for (; e.right !== null && (o > 0 || l.size > 0 && (e.right.deleted || e.right.content.constructor ===
|
|
5634
|
+
t: for (; e.right !== null && (o > 0 || l.size > 0 && (e.right.deleted || e.right.content.constructor === H)); ) {
|
|
5621
5635
|
if (!e.right.deleted)
|
|
5622
5636
|
switch (e.right.content.constructor) {
|
|
5623
|
-
case
|
|
5637
|
+
case H: {
|
|
5624
5638
|
const { key: a, value: c } = (
|
|
5625
5639
|
/** @type {ContentFormat} */
|
|
5626
5640
|
e.right.content
|
|
@@ -5657,7 +5671,7 @@ const Ys = (s, t, e) => {
|
|
|
5657
5671
|
let r = t;
|
|
5658
5672
|
const i = at();
|
|
5659
5673
|
for (; r && (!r.countable || r.deleted); ) {
|
|
5660
|
-
if (!r.deleted && r.content.constructor ===
|
|
5674
|
+
if (!r.deleted && r.content.constructor === H) {
|
|
5661
5675
|
const d = (
|
|
5662
5676
|
/** @type {ContentFormat} */
|
|
5663
5677
|
r.content
|
|
@@ -5671,7 +5685,7 @@ const Ys = (s, t, e) => {
|
|
|
5671
5685
|
if (e === t && (a = !0), !t.deleted) {
|
|
5672
5686
|
const d = t.content;
|
|
5673
5687
|
switch (d.constructor) {
|
|
5674
|
-
case
|
|
5688
|
+
case H: {
|
|
5675
5689
|
const { key: u, value: p } = (
|
|
5676
5690
|
/** @type {ContentFormat} */
|
|
5677
5691
|
d
|
|
@@ -5694,7 +5708,7 @@ const Ys = (s, t, e) => {
|
|
|
5694
5708
|
t = t.right;
|
|
5695
5709
|
const e = /* @__PURE__ */ new Set();
|
|
5696
5710
|
for (; t && (t.deleted || !t.countable); ) {
|
|
5697
|
-
if (!t.deleted && t.content.constructor ===
|
|
5711
|
+
if (!t.deleted && t.content.constructor === H) {
|
|
5698
5712
|
const o = (
|
|
5699
5713
|
/** @type {ContentFormat} */
|
|
5700
5714
|
t.content.key
|
|
@@ -5717,7 +5731,7 @@ const Ys = (s, t, e) => {
|
|
|
5717
5731
|
for (; n; ) {
|
|
5718
5732
|
if (n.deleted === !1)
|
|
5719
5733
|
switch (n.content.constructor) {
|
|
5720
|
-
case
|
|
5734
|
+
case H:
|
|
5721
5735
|
te(
|
|
5722
5736
|
i,
|
|
5723
5737
|
/** @type {ContentFormat} */
|
|
@@ -5744,7 +5758,7 @@ const Ys = (s, t, e) => {
|
|
|
5744
5758
|
n,
|
|
5745
5759
|
(i) => {
|
|
5746
5760
|
!i.deleted && /** @type {Item} */
|
|
5747
|
-
i.content.constructor ===
|
|
5761
|
+
i.content.constructor === H && i.constructor !== yt && t.add(
|
|
5748
5762
|
/** @type {any} */
|
|
5749
5763
|
i.parent
|
|
5750
5764
|
);
|
|
@@ -5763,7 +5777,7 @@ const Ys = (s, t, e) => {
|
|
|
5763
5777
|
/** @type {YText} */
|
|
5764
5778
|
n.parent
|
|
5765
5779
|
);
|
|
5766
|
-
n.content.constructor ===
|
|
5780
|
+
n.content.constructor === H ? t.add(r) : Ph(o, n);
|
|
5767
5781
|
});
|
|
5768
5782
|
for (const n of t)
|
|
5769
5783
|
Hh(n);
|
|
@@ -5867,7 +5881,7 @@ class jh extends wo {
|
|
|
5867
5881
|
this.adds(i) ? this.deletes(i) || (l !== "insert" && (u(), l = "insert"), c += /** @type {ContentString} */
|
|
5868
5882
|
i.content.str) : this.deletes(i) ? (l !== "delete" && (u(), l = "delete"), d += i.length) : i.deleted || (l !== "retain" && (u(), l = "retain"), h += i.length);
|
|
5869
5883
|
break;
|
|
5870
|
-
case
|
|
5884
|
+
case H: {
|
|
5871
5885
|
const { key: g, value: m } = (
|
|
5872
5886
|
/** @type {ContentFormat} */
|
|
5873
5887
|
i.content
|
|
@@ -5911,7 +5925,7 @@ class jh extends wo {
|
|
|
5911
5925
|
);
|
|
5912
5926
|
}
|
|
5913
5927
|
}
|
|
5914
|
-
class oo extends
|
|
5928
|
+
class oo extends P {
|
|
5915
5929
|
/**
|
|
5916
5930
|
* @param {String} [string] The initial value of the YText.
|
|
5917
5931
|
*/
|
|
@@ -6068,7 +6082,7 @@ class oo extends _ {
|
|
|
6068
6082
|
n.push(u);
|
|
6069
6083
|
break;
|
|
6070
6084
|
}
|
|
6071
|
-
case
|
|
6085
|
+
case H:
|
|
6072
6086
|
Lt(a, t) && (c(), te(
|
|
6073
6087
|
r,
|
|
6074
6088
|
/** @type {ContentFormat} */
|
|
@@ -6269,7 +6283,7 @@ class jo {
|
|
|
6269
6283
|
), done: !1 });
|
|
6270
6284
|
}
|
|
6271
6285
|
}
|
|
6272
|
-
class Wt extends
|
|
6286
|
+
class Wt extends P {
|
|
6273
6287
|
constructor() {
|
|
6274
6288
|
super(), this._prelimContent = [];
|
|
6275
6289
|
}
|
|
@@ -6309,7 +6323,7 @@ class Wt extends _ {
|
|
|
6309
6323
|
*/
|
|
6310
6324
|
clone() {
|
|
6311
6325
|
const t = new Wt();
|
|
6312
|
-
return t.insert(0, this.toArray().map((e) => e instanceof
|
|
6326
|
+
return t.insert(0, this.toArray().map((e) => e instanceof P ? e.clone() : e)), t;
|
|
6313
6327
|
}
|
|
6314
6328
|
get length() {
|
|
6315
6329
|
var t;
|
|
@@ -6441,7 +6455,7 @@ class Wt extends _ {
|
|
|
6441
6455
|
insertAfter(t, e) {
|
|
6442
6456
|
if (this.doc !== null)
|
|
6443
6457
|
M(this.doc, (o) => {
|
|
6444
|
-
const n = t && t instanceof
|
|
6458
|
+
const n = t && t instanceof P ? t._item : t;
|
|
6445
6459
|
to(o, this, n, e);
|
|
6446
6460
|
});
|
|
6447
6461
|
else {
|
|
@@ -6594,7 +6608,7 @@ class ye extends Wt {
|
|
|
6594
6608
|
/** @type {any} */
|
|
6595
6609
|
o
|
|
6596
6610
|
);
|
|
6597
|
-
}), t.insert(0, this.toArray().map((o) => o instanceof
|
|
6611
|
+
}), t.insert(0, this.toArray().map((o) => o instanceof P ? o.clone() : o)), t;
|
|
6598
6612
|
}
|
|
6599
6613
|
/**
|
|
6600
6614
|
* Returns the XML serialization of this YXmlElement.
|
|
@@ -6970,7 +6984,7 @@ class no {
|
|
|
6970
6984
|
return 1;
|
|
6971
6985
|
}
|
|
6972
6986
|
}
|
|
6973
|
-
const Yh = (s, t) => new Rt(
|
|
6987
|
+
const Yh = (s, t) => new Rt(j(B({ guid: s }, t), { shouldLoad: t.shouldLoad || t.autoLoad || !1 }));
|
|
6974
6988
|
class So {
|
|
6975
6989
|
/**
|
|
6976
6990
|
* @param {Doc} doc
|
|
@@ -7125,7 +7139,7 @@ class ee {
|
|
|
7125
7139
|
return 5;
|
|
7126
7140
|
}
|
|
7127
7141
|
}
|
|
7128
|
-
class
|
|
7142
|
+
class H {
|
|
7129
7143
|
/**
|
|
7130
7144
|
* @param {string} key
|
|
7131
7145
|
* @param {Object} value
|
|
@@ -7155,7 +7169,7 @@ class P {
|
|
|
7155
7169
|
* @return {ContentFormat}
|
|
7156
7170
|
*/
|
|
7157
7171
|
copy() {
|
|
7158
|
-
return new
|
|
7172
|
+
return new H(this.key, this.value);
|
|
7159
7173
|
}
|
|
7160
7174
|
/**
|
|
7161
7175
|
* @param {number} _offset
|
|
@@ -9044,7 +9058,7 @@ class md extends Co {
|
|
|
9044
9058
|
const i = o.getBlockByIndex(r);
|
|
9045
9059
|
if (!i)
|
|
9046
9060
|
continue;
|
|
9047
|
-
const l = await i.save(), a = await o.update(i,
|
|
9061
|
+
const l = await i.save(), a = await o.update(i, j(B({}, l), {
|
|
9048
9062
|
depth: Math.max(0, this.getListBlockDepth(i) + t)
|
|
9049
9063
|
}));
|
|
9050
9064
|
a.selected = !0;
|
|
@@ -9334,7 +9348,7 @@ class Bd extends Co {
|
|
|
9334
9348
|
const i = r.textContent || "", l = o.holder.getAttribute("data-blok-depth"), a = l ? parseInt(l, 10) : 0, c = fd.exec(i);
|
|
9335
9349
|
if (c) {
|
|
9336
9350
|
this.Blok.YjsManager.stopCapturing();
|
|
9337
|
-
const S = ((v = c[1]) == null ? void 0 : v.toLowerCase()) === "x",
|
|
9351
|
+
const S = ((v = c[1]) == null ? void 0 : v.toLowerCase()) === "x", L = c[1] !== void 0 ? 4 : 3, Q = this.extractRemainingHtml(r, L), X = this.getCaretOffset(r) - L, St = t.replace(o, Pt, B({
|
|
9338
9352
|
text: Q,
|
|
9339
9353
|
style: "checklist",
|
|
9340
9354
|
checked: S
|
|
@@ -9343,8 +9357,8 @@ class Bd extends Co {
|
|
|
9343
9357
|
}
|
|
9344
9358
|
if (gd.exec(i)) {
|
|
9345
9359
|
this.Blok.YjsManager.stopCapturing();
|
|
9346
|
-
const S = 2,
|
|
9347
|
-
text:
|
|
9360
|
+
const S = 2, L = this.extractRemainingHtml(r, S), Q = this.getCaretOffset(r) - S, X = t.replace(o, Pt, B({
|
|
9361
|
+
text: L,
|
|
9348
9362
|
style: "unordered",
|
|
9349
9363
|
checked: !1
|
|
9350
9364
|
}, a > 0 ? { depth: a } : {}));
|
|
@@ -9709,7 +9723,7 @@ class zo {
|
|
|
9709
9723
|
const r = t - 1, i = Math.max(0, r), l = this.blocks[i], a = t > 0 ? "afterend" : "beforebegin";
|
|
9710
9724
|
this.insertToDOM(n, a, l);
|
|
9711
9725
|
}
|
|
9712
|
-
this.blocks.splice(t, 0, n), n.call(
|
|
9726
|
+
this.blocks.splice(t, 0, n), n.call(st.MOVED, {
|
|
9713
9727
|
fromIndex: e,
|
|
9714
9728
|
toIndex: t
|
|
9715
9729
|
});
|
|
@@ -9728,7 +9742,7 @@ class zo {
|
|
|
9728
9742
|
const n = t > this.length ? this.length : t;
|
|
9729
9743
|
if (o) {
|
|
9730
9744
|
const l = this.blocks[n];
|
|
9731
|
-
l.call(
|
|
9745
|
+
l.call(st.REMOVED), l.destroy(), l.holder.remove();
|
|
9732
9746
|
}
|
|
9733
9747
|
const r = o ? 1 : 0;
|
|
9734
9748
|
if (this.blocks.splice(n, r, e), n > 0) {
|
|
@@ -9752,7 +9766,7 @@ class zo {
|
|
|
9752
9766
|
if (!(t in this.blocks))
|
|
9753
9767
|
throw Error("Incorrect index");
|
|
9754
9768
|
const o = this.blocks[t];
|
|
9755
|
-
o.holder.replaceWith(e.holder), o.call(
|
|
9769
|
+
o.holder.replaceWith(e.holder), o.call(st.REMOVED), this.blocks[t] = e, e.call(st.RENDERED);
|
|
9756
9770
|
}
|
|
9757
9771
|
/**
|
|
9758
9772
|
* Inserts several blocks at once
|
|
@@ -9764,14 +9778,14 @@ class zo {
|
|
|
9764
9778
|
for (const n of t)
|
|
9765
9779
|
o.appendChild(n.holder);
|
|
9766
9780
|
if (!this.length) {
|
|
9767
|
-
this.blocks.push(...t), this.workingArea.appendChild(o), t.forEach((n) => n.call(
|
|
9781
|
+
this.blocks.push(...t), this.workingArea.appendChild(o), t.forEach((n) => n.call(st.RENDERED));
|
|
9768
9782
|
return;
|
|
9769
9783
|
}
|
|
9770
9784
|
if (e > 0) {
|
|
9771
9785
|
const n = Math.min(e - 1, this.length - 1);
|
|
9772
9786
|
this.blocks[n].holder.after(o);
|
|
9773
9787
|
}
|
|
9774
|
-
e === 0 && this.workingArea.prepend(o), this.blocks.splice(e, 0, ...t), t.forEach((n) => n.call(
|
|
9788
|
+
e === 0 && this.workingArea.prepend(o), this.blocks.splice(e, 0, ...t), t.forEach((n) => n.call(st.RENDERED));
|
|
9775
9789
|
}
|
|
9776
9790
|
/**
|
|
9777
9791
|
* Remove block
|
|
@@ -9779,13 +9793,13 @@ class zo {
|
|
|
9779
9793
|
*/
|
|
9780
9794
|
remove(t) {
|
|
9781
9795
|
const e = isNaN(t) ? this.length - 1 : t, o = this.blocks[e];
|
|
9782
|
-
o.call(
|
|
9796
|
+
o.call(st.REMOVED), o.destroy(), o.holder.remove(), this.blocks.splice(e, 1);
|
|
9783
9797
|
}
|
|
9784
9798
|
/**
|
|
9785
9799
|
* Remove all blocks
|
|
9786
9800
|
*/
|
|
9787
9801
|
removeAll() {
|
|
9788
|
-
this.workingArea.innerHTML = "", this.blocks.forEach((t) => t.call(
|
|
9802
|
+
this.workingArea.innerHTML = "", this.blocks.forEach((t) => t.call(st.REMOVED)), this.blocks.length = 0;
|
|
9789
9803
|
}
|
|
9790
9804
|
/**
|
|
9791
9805
|
* Insert Block after passed target
|
|
@@ -9820,7 +9834,7 @@ class zo {
|
|
|
9820
9834
|
* @param {Block} target — Block related to position
|
|
9821
9835
|
*/
|
|
9822
9836
|
insertToDOM(t, e, o) {
|
|
9823
|
-
e && o !== void 0 ? o.holder.insertAdjacentElement(e, t.holder) : this.workingArea.appendChild(t.holder), t.call(
|
|
9837
|
+
e && o !== void 0 ? o.holder.insertAdjacentElement(e, t.holder) : this.workingArea.appendChild(t.holder), t.call(st.RENDERED);
|
|
9824
9838
|
}
|
|
9825
9839
|
}
|
|
9826
9840
|
class xd {
|
|
@@ -10418,7 +10432,7 @@ class Ad {
|
|
|
10418
10432
|
skipYjsSync: !0
|
|
10419
10433
|
}, n);
|
|
10420
10434
|
this.yjsSync.withAtomicOperation(() => void r.ready.then(() => {
|
|
10421
|
-
r.call(
|
|
10435
|
+
r.call(st.ON_PASTE, e), r.refreshToolRootElement();
|
|
10422
10436
|
}).catch((l) => {
|
|
10423
10437
|
C(`${t}: onPaste callback call is failed`, "error", l);
|
|
10424
10438
|
}));
|
|
@@ -10799,7 +10813,7 @@ class _d {
|
|
|
10799
10813
|
return (this.registeredShortcuts.get(t) || []).find(({ name: n }) => n === e);
|
|
10800
10814
|
}
|
|
10801
10815
|
}
|
|
10802
|
-
const
|
|
10816
|
+
const nt = new _d();
|
|
10803
10817
|
class Pd {
|
|
10804
10818
|
/**
|
|
10805
10819
|
* @param wrapper - Editor wrapper element
|
|
@@ -10816,17 +10830,17 @@ class Pd {
|
|
|
10816
10830
|
setTimeout(() => {
|
|
10817
10831
|
const t = ["CMD+SHIFT+UP", "CMD+SHIFT+DOWN"];
|
|
10818
10832
|
for (const e of this.registeredShortcutNames)
|
|
10819
|
-
|
|
10833
|
+
nt.remove(document, e);
|
|
10820
10834
|
this.registeredShortcutNames.length = 0;
|
|
10821
10835
|
for (const e of t)
|
|
10822
|
-
|
|
10823
|
-
|
|
10836
|
+
nt.remove(document, e);
|
|
10837
|
+
nt.add({
|
|
10824
10838
|
name: "CMD+SHIFT+UP",
|
|
10825
10839
|
on: document,
|
|
10826
10840
|
handler: (e) => {
|
|
10827
10841
|
this.shouldHandleShortcut(e) && (e.preventDefault(), this.handlers.onMoveUp());
|
|
10828
10842
|
}
|
|
10829
|
-
}), this.registeredShortcutNames.push("CMD+SHIFT+UP"),
|
|
10843
|
+
}), this.registeredShortcutNames.push("CMD+SHIFT+UP"), nt.add({
|
|
10830
10844
|
name: "CMD+SHIFT+DOWN",
|
|
10831
10845
|
on: document,
|
|
10832
10846
|
handler: (e) => {
|
|
@@ -10840,7 +10854,7 @@ class Pd {
|
|
|
10840
10854
|
*/
|
|
10841
10855
|
unregister() {
|
|
10842
10856
|
for (const t of this.registeredShortcutNames)
|
|
10843
|
-
|
|
10857
|
+
nt.remove(document, t);
|
|
10844
10858
|
this.registeredShortcutNames.length = 0;
|
|
10845
10859
|
}
|
|
10846
10860
|
/**
|
|
@@ -11681,7 +11695,7 @@ class jd extends x {
|
|
|
11681
11695
|
* to select all and copy them
|
|
11682
11696
|
*/
|
|
11683
11697
|
prepare() {
|
|
11684
|
-
this.selection = new w(),
|
|
11698
|
+
this.selection = new w(), nt.add({
|
|
11685
11699
|
name: "CMD+A",
|
|
11686
11700
|
handler: (t) => {
|
|
11687
11701
|
const { BlockManager: e, ReadOnly: o } = this.Blok;
|
|
@@ -11861,7 +11875,7 @@ class jd extends x {
|
|
|
11861
11875
|
* De-registers Shortcut CMD+A
|
|
11862
11876
|
*/
|
|
11863
11877
|
destroy() {
|
|
11864
|
-
|
|
11878
|
+
nt.remove(this.Blok.UI.nodes.redactor, "CMD+A");
|
|
11865
11879
|
}
|
|
11866
11880
|
/**
|
|
11867
11881
|
* First CMD+A selects all input content by native behaviour,
|
|
@@ -12759,7 +12773,7 @@ class Gd {
|
|
|
12759
12773
|
updateTarget(t, e) {
|
|
12760
12774
|
if (this.state.type !== "dragging")
|
|
12761
12775
|
throw new Error(`Cannot update target from state "${this.state.type}", must be dragging`);
|
|
12762
|
-
this.state =
|
|
12776
|
+
this.state = j(B({}, this.state), {
|
|
12763
12777
|
targetBlock: t,
|
|
12764
12778
|
targetEdge: e
|
|
12765
12779
|
});
|
|
@@ -13607,7 +13621,7 @@ class lu extends x {
|
|
|
13607
13621
|
async ensureI18nextLoaded(t, e) {
|
|
13608
13622
|
if (this.i18nextWrapper !== null)
|
|
13609
13623
|
return;
|
|
13610
|
-
const { loadI18next: o } = await import("./i18next-loader-
|
|
13624
|
+
const { loadI18next: o } = await import("./i18next-loader-CzL6YHyQ.mjs");
|
|
13611
13625
|
this.i18nextWrapper = await o(t, e);
|
|
13612
13626
|
}
|
|
13613
13627
|
/**
|
|
@@ -13781,7 +13795,7 @@ class Se {
|
|
|
13781
13795
|
* Process paste of single Block tool content.
|
|
13782
13796
|
*/
|
|
13783
13797
|
async processSingleBlock(t, e) {
|
|
13784
|
-
const { Caret: o, BlockManager: n } = this.Blok, { currentBlock: r } = n, { Dom: i } = await import("./inline-tool-convert-
|
|
13798
|
+
const { Caret: o, BlockManager: n } = this.Blok, { currentBlock: r } = n, { Dom: i } = await import("./inline-tool-convert-D4SXxjDd.mjs").then((a) => a.aI), l = i;
|
|
13785
13799
|
if (!r || t.tool !== r.name || !l.containsOnlyInlineElements(t.content.innerHTML)) {
|
|
13786
13800
|
await this.insertBlock(t, e);
|
|
13787
13801
|
return;
|
|
@@ -14568,13 +14582,13 @@ class uu extends x {
|
|
|
14568
14582
|
const i = r.getBoundingClientRect(), l = this.getScrollTop(), a = e - l;
|
|
14569
14583
|
if (!(a >= i.top && a <= i.bottom))
|
|
14570
14584
|
return;
|
|
14571
|
-
const h = this.getScrollLeft(), d = t - h, u = d >=
|
|
14572
|
-
!
|
|
14585
|
+
const h = this.getScrollLeft(), d = t - h, u = this.Blok.UI.contentRect, p = d >= u.left && d <= u.right, f = document.elementFromPoint(t - h, a);
|
|
14586
|
+
!f || (!f.closest(ut(y.toolbar)) && !o && (this.Blok.BlockSelection.allBlocksSelected = !1, this.clearSelection(), this.stackOfSelected = []), [
|
|
14573
14587
|
ut(y.elementContent),
|
|
14574
14588
|
ut(y.toolbar),
|
|
14575
14589
|
ut(y.popover),
|
|
14576
14590
|
rl
|
|
14577
|
-
].some((
|
|
14591
|
+
].some((v) => !!f.closest(v))) || (p && this.Blok.Toolbar.close(), this.mousedown = !0, this.startX = t, this.startY = e);
|
|
14578
14592
|
}
|
|
14579
14593
|
/**
|
|
14580
14594
|
* Clear all params to end selection
|
|
@@ -14886,7 +14900,7 @@ const pu = (s) => typeof s == "object" && "text" in s && !("content" in s), Yi =
|
|
|
14886
14900
|
const n = xu(o.data, o.tunes);
|
|
14887
14901
|
t.push(...n);
|
|
14888
14902
|
} else
|
|
14889
|
-
t.push(
|
|
14903
|
+
t.push(j(B({}, o), {
|
|
14890
14904
|
id: (e = o.id) != null ? e : wt()
|
|
14891
14905
|
}));
|
|
14892
14906
|
return t;
|
|
@@ -14973,26 +14987,26 @@ class Du extends x {
|
|
|
14973
14987
|
const { tunes: h, id: d, parent: u, content: p } = c, f = c.type, g = ((S) => typeof S == "object" && S !== null)(c.data) ? c.data : {}, m = o.available.has(f) ? {
|
|
14974
14988
|
tool: f,
|
|
14975
14989
|
data: g
|
|
14976
|
-
} : (
|
|
14990
|
+
} : (ot(`Tool «${f}» is not found. Check 'tools' property at the Blok config.`, "warn"), {
|
|
14977
14991
|
tool: o.stubTool,
|
|
14978
14992
|
data: this.composeStubDataForTool(f, g, d)
|
|
14979
14993
|
});
|
|
14980
|
-
return ((S,
|
|
14994
|
+
return ((S, L) => {
|
|
14981
14995
|
try {
|
|
14982
14996
|
return n.composeBlock({
|
|
14983
14997
|
id: d,
|
|
14984
14998
|
tool: S,
|
|
14985
|
-
data:
|
|
14999
|
+
data: L,
|
|
14986
15000
|
tunes: h,
|
|
14987
15001
|
parentId: u,
|
|
14988
15002
|
contentIds: p
|
|
14989
15003
|
});
|
|
14990
15004
|
} catch (Q) {
|
|
14991
15005
|
C(`Block «${S}» skipped because of plugins error`, "error", {
|
|
14992
|
-
data:
|
|
15006
|
+
data: L,
|
|
14993
15007
|
error: Q
|
|
14994
15008
|
});
|
|
14995
|
-
const X = this.composeStubDataForTool(S,
|
|
15009
|
+
const X = this.composeStubDataForTool(S, L, d);
|
|
14996
15010
|
return n.composeBlock({
|
|
14997
15011
|
id: d,
|
|
14998
15012
|
tool: o.stubTool,
|
|
@@ -15062,7 +15076,7 @@ class Ru extends x {
|
|
|
15062
15076
|
} catch (i) {
|
|
15063
15077
|
this.lastSaveError = i;
|
|
15064
15078
|
const l = i instanceof Error ? i : new Error(String(i));
|
|
15065
|
-
|
|
15079
|
+
ot("Saving failed due to the Error %o", "error", l);
|
|
15066
15080
|
return;
|
|
15067
15081
|
}
|
|
15068
15082
|
}
|
|
@@ -15079,7 +15093,7 @@ class Ru extends x {
|
|
|
15079
15093
|
isValid: !1
|
|
15080
15094
|
};
|
|
15081
15095
|
const r = await t.validate(n.data);
|
|
15082
|
-
return
|
|
15096
|
+
return j(B({}, n), {
|
|
15083
15097
|
isValid: r,
|
|
15084
15098
|
parentId: t.parentId,
|
|
15085
15099
|
contentIds: t.contentIds
|
|
@@ -15094,7 +15108,8 @@ class Ru extends x {
|
|
|
15094
15108
|
var i, l, a;
|
|
15095
15109
|
const e = [];
|
|
15096
15110
|
t.forEach(({ id: c, tool: h, data: d, tunes: u, isValid: p, parentId: f, contentIds: b }) => {
|
|
15097
|
-
|
|
15111
|
+
const g = f != null;
|
|
15112
|
+
if (!p && !g) {
|
|
15098
15113
|
C(`Block «${h}» skipped because saved data is invalid`);
|
|
15099
15114
|
return;
|
|
15100
15115
|
}
|
|
@@ -15110,13 +15125,13 @@ class Ru extends x {
|
|
|
15110
15125
|
C("Stub block data is malformed and was skipped");
|
|
15111
15126
|
return;
|
|
15112
15127
|
}
|
|
15113
|
-
const
|
|
15128
|
+
const m = u === void 0 || z(u), v = b !== void 0 && b.length > 0, S = B(B(B({
|
|
15114
15129
|
id: c,
|
|
15115
15130
|
type: h,
|
|
15116
15131
|
data: d
|
|
15117
|
-
}, !
|
|
15132
|
+
}, !m && {
|
|
15118
15133
|
tunes: u
|
|
15119
|
-
}),
|
|
15134
|
+
}), g && {
|
|
15120
15135
|
parent: f
|
|
15121
15136
|
}), v && {
|
|
15122
15137
|
content: b
|
|
@@ -15152,7 +15167,7 @@ class Ru extends x {
|
|
|
15152
15167
|
), i = t.map((l) => B({}, l));
|
|
15153
15168
|
return n.forEach(({ index: l }, a) => {
|
|
15154
15169
|
const c = r[a];
|
|
15155
|
-
i[l] =
|
|
15170
|
+
i[l] = j(B({}, i[l]), {
|
|
15156
15171
|
data: c.data
|
|
15157
15172
|
});
|
|
15158
15173
|
}), i;
|
|
@@ -15189,7 +15204,7 @@ class Ru extends x {
|
|
|
15189
15204
|
if (z(e))
|
|
15190
15205
|
return;
|
|
15191
15206
|
const o = t.preservedTunes;
|
|
15192
|
-
return
|
|
15207
|
+
return j(B({
|
|
15193
15208
|
id: t.id,
|
|
15194
15209
|
tool: t.name,
|
|
15195
15210
|
data: e
|
|
@@ -15216,7 +15231,7 @@ class ur extends ce {
|
|
|
15216
15231
|
]
|
|
15217
15232
|
});
|
|
15218
15233
|
super(
|
|
15219
|
-
|
|
15234
|
+
j(B({}, t), {
|
|
15220
15235
|
flipper: o
|
|
15221
15236
|
}),
|
|
15222
15237
|
{
|
|
@@ -16139,7 +16154,7 @@ class Hu extends yn {
|
|
|
16139
16154
|
* @param {string} shortcut - shortcut according to the ShortcutData Module format
|
|
16140
16155
|
*/
|
|
16141
16156
|
enableShortcutForTool(t, e) {
|
|
16142
|
-
|
|
16157
|
+
nt.add({
|
|
16143
16158
|
name: e,
|
|
16144
16159
|
on: this.api.ui.nodes.redactor,
|
|
16145
16160
|
handler: async (o) => {
|
|
@@ -16163,7 +16178,7 @@ class Hu extends yn {
|
|
|
16163
16178
|
removeAllShortcuts() {
|
|
16164
16179
|
this.toolsToBeDisplayed.forEach((t) => {
|
|
16165
16180
|
const e = t.shortcut;
|
|
16166
|
-
e &&
|
|
16181
|
+
e && nt.remove(this.api.ui.nodes.redactor, e);
|
|
16167
16182
|
});
|
|
16168
16183
|
}
|
|
16169
16184
|
/**
|
|
@@ -16326,14 +16341,17 @@ class Uu {
|
|
|
16326
16341
|
* @param insertAbove - if true, insert above the current block instead of below
|
|
16327
16342
|
*/
|
|
16328
16343
|
handleClick(t = !1) {
|
|
16329
|
-
var
|
|
16344
|
+
var m, v;
|
|
16330
16345
|
const { BlockManager: e, BlockSettings: o, BlockSelection: n, Caret: r } = this.getBlok();
|
|
16331
|
-
if (o.opened && o.close(), n.anyBlockSelected && n.clearSelection(), (
|
|
16346
|
+
if (o.opened && o.close(), n.anyBlockSelected && n.clearSelection(), (m = w.get()) == null || m.removeAllRanges(), this.getToolboxOpened()) {
|
|
16332
16347
|
this.closeToolbox();
|
|
16333
16348
|
return;
|
|
16334
16349
|
}
|
|
16335
|
-
const i = this.hoveredBlockInternal, l = (i == null ? void 0 : i.name) === "paragraph", a = l && ((
|
|
16336
|
-
|
|
16350
|
+
const i = this.hoveredBlockInternal, l = (i == null ? void 0 : i.name) === "paragraph", a = l && ((v = i.pluginsContent.textContent) == null ? void 0 : v.startsWith("/")), c = l && i.isEmpty, h = i !== null ? e.getBlockIndex(i) : e.currentBlockIndex, d = t ? h : h + 1, u = e.blocks.slice(d), p = (S) => {
|
|
16351
|
+
var L;
|
|
16352
|
+
return ((L = S.holder.parentElement) == null ? void 0 : L.closest('[data-blok-testid="block-wrapper"]')) !== null;
|
|
16353
|
+
}, f = !t && i && u.length > 0 ? u.findIndex((S) => !p(S)) : 0, b = d + (f === -1 ? u.length : f), g = c || a ? i : e.insertDefaultBlockAtIndex(b, !0);
|
|
16354
|
+
g !== i && p(g) && (i == null || i.holder.after(g.holder)), a ? r.setToBlock(g, r.positions.DEFAULT, 1) : (r.setToBlock(g, r.positions.START), r.insertContentAtCaretPosition("/")), this.moveAndOpenToolbar(g), this.openToolbox();
|
|
16337
16355
|
}
|
|
16338
16356
|
}
|
|
16339
16357
|
class zu {
|
|
@@ -16612,7 +16630,7 @@ class Ku extends x {
|
|
|
16612
16630
|
super({
|
|
16613
16631
|
config: t,
|
|
16614
16632
|
eventsDispatcher: e
|
|
16615
|
-
}), this.hoveredBlock = null, this.explicitlyClosed = !1, this.toolboxInstance = null, this.onBlockSettingsOpen = () => {
|
|
16633
|
+
}), this.hoveredBlock = null, this.explicitlyClosed = !1, this.hoveredBlockIsFromTableCell = !1, this.toolboxInstance = null, this.onBlockSettingsOpen = () => {
|
|
16616
16634
|
this.Blok.UI.nodes.wrapper.setAttribute(y.blockSettingsOpened, "true");
|
|
16617
16635
|
}, this.onBlockSettingsClose = () => {
|
|
16618
16636
|
this.Blok.UI.nodes.wrapper.removeAttribute(y.blockSettingsOpened);
|
|
@@ -16685,7 +16703,7 @@ class Ku extends x {
|
|
|
16685
16703
|
C("toolbox.open() called before initialization is finished", "warn");
|
|
16686
16704
|
return;
|
|
16687
16705
|
}
|
|
16688
|
-
this.hoveredBlock && (this.Blok.BlockManager.currentBlock = this.hoveredBlock), this.toolboxInstance.open();
|
|
16706
|
+
this.hoveredBlock && !this.hoveredBlockIsFromTableCell && (this.Blok.BlockManager.currentBlock = this.hoveredBlock), this.toolboxInstance.open();
|
|
16689
16707
|
},
|
|
16690
16708
|
toggle: () => {
|
|
16691
16709
|
if (this.toolboxInstance === null) {
|
|
@@ -16755,24 +16773,23 @@ class Ku extends x {
|
|
|
16755
16773
|
const o = t != null ? t : this.Blok.BlockManager.currentBlock;
|
|
16756
16774
|
if (!o)
|
|
16757
16775
|
return;
|
|
16776
|
+
this.hoveredBlockIsFromTableCell = o.holder.closest("[data-blok-table-cell-blocks]") !== null;
|
|
16758
16777
|
const n = this.resolveTableCellBlock(o);
|
|
16759
|
-
if (!n) {
|
|
16760
|
-
this.close();
|
|
16761
|
-
return;
|
|
16762
|
-
}
|
|
16763
16778
|
this.hoveredBlock && this.hoveredBlock !== n && this.hoveredBlock.cleanupDraggable(), this.hoveredBlock = n, this.plusButtonHandler.setHoveredBlock(n), this.settingsTogglerHandler.setHoveredBlock(n), this.positioner.setHoveredTarget(e != null ? e : null), this.positioner.resetCachedPosition();
|
|
16764
16779
|
const { wrapper: r, plusButton: i, settingsToggler: l } = this.nodes;
|
|
16765
16780
|
if (!r || !i)
|
|
16766
16781
|
return;
|
|
16767
|
-
const a =
|
|
16768
|
-
|
|
16782
|
+
const a = this.hoveredBlockIsFromTableCell ? "none" : "";
|
|
16783
|
+
i.style.display = a, l && (l.style.display = a);
|
|
16784
|
+
const c = n.holder, { isMobile: h } = this.Blok.UI, d = this.positioner.calculateToolbarY(
|
|
16785
|
+
{ targetBlock: n, hoveredTarget: e != null ? e : null, isMobile: h },
|
|
16769
16786
|
i
|
|
16770
16787
|
);
|
|
16771
|
-
if (
|
|
16788
|
+
if (d === null)
|
|
16772
16789
|
return;
|
|
16773
|
-
this.positioner.moveToY(this.nodes,
|
|
16774
|
-
const
|
|
16775
|
-
this.Blok.BlockManager.blocks.length === 1 && n.isEmpty && !
|
|
16790
|
+
this.positioner.moveToY(this.nodes, d), c.appendChild(r), l && !this.Blok.ReadOnly.isEnabled && n.setupDraggable(l, this.Blok.DragManager), this.positioner.applyContentOffset(this.nodes, n);
|
|
16791
|
+
const u = n.getTunes(), p = u.toolTunes.length > 0 || u.commonTunes.length > 0;
|
|
16792
|
+
this.Blok.BlockManager.blocks.length === 1 && n.isEmpty && !p ? this.blockTunesToggler.hide() : this.blockTunesToggler.show(), this.open();
|
|
16776
16793
|
}
|
|
16777
16794
|
/**
|
|
16778
16795
|
* Move Toolbar to the specified block (or first selected block) and open it for multi-block selection.
|
|
@@ -16792,18 +16809,15 @@ class Ku extends x {
|
|
|
16792
16809
|
this.toolboxInstance.opened && this.toolboxInstance.close(), this.explicitlyClosed = !1;
|
|
16793
16810
|
const o = t != null ? t : e[0];
|
|
16794
16811
|
this.hoveredBlock && this.hoveredBlock !== o && this.hoveredBlock.cleanupDraggable(), this.hoveredBlock = o, this.plusButtonHandler.setHoveredBlock(o), this.settingsTogglerHandler.setHoveredBlock(o), this.positioner.setHoveredTarget(null), this.positioner.resetCachedPosition();
|
|
16795
|
-
const { wrapper: n, plusButton: r } = this.nodes;
|
|
16812
|
+
const { wrapper: n, plusButton: r, settingsToggler: i } = this.nodes;
|
|
16796
16813
|
if (!n || !r)
|
|
16797
16814
|
return;
|
|
16798
|
-
|
|
16815
|
+
r.style.display = "", i && (i.style.display = "");
|
|
16816
|
+
const l = o.holder, a = this.positioner.calculateToolbarY(
|
|
16799
16817
|
{ targetBlock: o, hoveredTarget: null, isMobile: !1 },
|
|
16800
16818
|
r
|
|
16801
16819
|
);
|
|
16802
|
-
|
|
16803
|
-
return;
|
|
16804
|
-
this.positioner.moveToY(this.nodes, l), i.appendChild(n);
|
|
16805
|
-
const { settingsToggler: a } = this.nodes;
|
|
16806
|
-
a && !this.Blok.ReadOnly.isEnabled && o.setupDraggable(a, this.Blok.DragManager), this.positioner.applyContentOffset(this.nodes, o), this.blockTunesToggler.show(), this.open();
|
|
16820
|
+
a !== null && (this.positioner.moveToY(this.nodes, a), l.appendChild(n), i && !this.Blok.ReadOnly.isEnabled && o.setupDraggable(i, this.Blok.DragManager), this.positioner.applyContentOffset(this.nodes, o), this.blockTunesToggler.show(), this.open());
|
|
16807
16821
|
}
|
|
16808
16822
|
/**
|
|
16809
16823
|
* Close the Toolbar
|
|
@@ -16811,7 +16825,7 @@ class Ku extends x {
|
|
|
16811
16825
|
*/
|
|
16812
16826
|
close(t) {
|
|
16813
16827
|
var e, o, n, r;
|
|
16814
|
-
this.Blok.ReadOnly.isEnabled || ((e = this.nodes.wrapper) == null || e.classList.remove(this.CSS.toolbarOpened), (o = this.nodes.wrapper) == null || o.classList.add(this.CSS.toolbarClosed), (n = this.nodes.wrapper) == null || n.removeAttribute("data-blok-opened"), this.blockActions.hide(), (r = this.toolboxInstance) == null || r.close(), this.Blok.BlockSettings.close(), this.hoveredBlock = null, (t == null ? void 0 : t.setExplicitlyClosed) !== !1 && (this.explicitlyClosed = !0), this.nodes.plusButton && (this.nodes.plusButton.style.display = ""), this.nodes.actions && (this.nodes.actions.style.transform = ""), this.positioner.setHoveredTarget(null), this.reset());
|
|
16828
|
+
this.Blok.ReadOnly.isEnabled || ((e = this.nodes.wrapper) == null || e.classList.remove(this.CSS.toolbarOpened), (o = this.nodes.wrapper) == null || o.classList.add(this.CSS.toolbarClosed), (n = this.nodes.wrapper) == null || n.removeAttribute("data-blok-opened"), this.blockActions.hide(), (r = this.toolboxInstance) == null || r.close(), this.Blok.BlockSettings.close(), this.hoveredBlock = null, this.hoveredBlockIsFromTableCell = !1, (t == null ? void 0 : t.setExplicitlyClosed) !== !1 && (this.explicitlyClosed = !0), this.nodes.plusButton && (this.nodes.plusButton.style.display = ""), this.nodes.settingsToggler && (this.nodes.settingsToggler.style.display = ""), this.nodes.actions && (this.nodes.actions.style.transform = ""), this.positioner.setHoveredTarget(null), this.reset());
|
|
16815
16829
|
}
|
|
16816
16830
|
/**
|
|
16817
16831
|
* Prevents the settings menu from opening on the next mouseup event
|
|
@@ -16833,7 +16847,7 @@ class Ku extends x {
|
|
|
16833
16847
|
* Uses the DOM attribute directly to avoid cross-module dependency on the table tool.
|
|
16834
16848
|
*
|
|
16835
16849
|
* @param block - the block to resolve
|
|
16836
|
-
* @returns the parent table block if inside a cell, the original block otherwise
|
|
16850
|
+
* @returns the parent table block if inside a cell, the original block otherwise
|
|
16837
16851
|
*/
|
|
16838
16852
|
resolveTableCellBlock(t) {
|
|
16839
16853
|
var n;
|
|
@@ -16841,7 +16855,7 @@ class Ku extends x {
|
|
|
16841
16855
|
if (!e)
|
|
16842
16856
|
return t;
|
|
16843
16857
|
const o = e.closest('[data-blok-testid="block-wrapper"]');
|
|
16844
|
-
return o && (n = this.Blok.BlockManager.getBlockByChildNode(o)) != null ? n :
|
|
16858
|
+
return o && (n = this.Blok.BlockManager.getBlockByChildNode(o)) != null ? n : t;
|
|
16845
16859
|
}
|
|
16846
16860
|
/**
|
|
16847
16861
|
* Reset the Toolbar position to prevent DOM height growth, for example after blocks deletion
|
|
@@ -17133,14 +17147,14 @@ class Xu {
|
|
|
17133
17147
|
if (t instanceof HTMLElement)
|
|
17134
17148
|
return i;
|
|
17135
17149
|
if (t.type === G.Html)
|
|
17136
|
-
return i.push(
|
|
17150
|
+
return i.push(j(B(B({}, l), t), {
|
|
17137
17151
|
type: G.Html
|
|
17138
17152
|
})), i;
|
|
17139
17153
|
if (t.type === G.Separator)
|
|
17140
17154
|
return i.push({
|
|
17141
17155
|
type: G.Separator
|
|
17142
17156
|
}), i;
|
|
17143
|
-
const a =
|
|
17157
|
+
const a = j(B(B({}, l), t), {
|
|
17144
17158
|
type: G.Default
|
|
17145
17159
|
});
|
|
17146
17160
|
return i.push(a), "children" in a && r && i.push({
|
|
@@ -17348,7 +17362,7 @@ class tp {
|
|
|
17348
17362
|
*/
|
|
17349
17363
|
destroy() {
|
|
17350
17364
|
for (const [, t] of this.registeredShortcuts.entries())
|
|
17351
|
-
|
|
17365
|
+
nt.remove(document, t);
|
|
17352
17366
|
this.registeredShortcuts.clear(), this.shortcutsRegistered = !1;
|
|
17353
17367
|
}
|
|
17354
17368
|
/**
|
|
@@ -17379,7 +17393,7 @@ class tp {
|
|
|
17379
17393
|
*/
|
|
17380
17394
|
enableShortcuts(t, e) {
|
|
17381
17395
|
const o = this.registeredShortcuts.get(t);
|
|
17382
|
-
o !== e && (this.isShortcutTakenByAnotherTool(t, e) || (o !== void 0 && (
|
|
17396
|
+
o !== e && (this.isShortcutTakenByAnotherTool(t, e) || (o !== void 0 && (nt.remove(document, o), this.registeredShortcuts.delete(t)), nt.add({
|
|
17383
17397
|
name: e,
|
|
17384
17398
|
handler: (n) => {
|
|
17385
17399
|
const { BlockManager: r } = this.getBlok(), { currentBlock: i } = r;
|
|
@@ -17586,7 +17600,7 @@ class op extends x {
|
|
|
17586
17600
|
* Shows Inline Toolbar
|
|
17587
17601
|
*/
|
|
17588
17602
|
async open() {
|
|
17589
|
-
var i, l, a, c, h, d, u, p, f, b, g, m, v, S,
|
|
17603
|
+
var i, l, a, c, h, d, u, p, f, b, g, m, v, S, L, Q, X, St, rs, is, ls;
|
|
17590
17604
|
if (this.opened || (this.initialize(), this.opened = !0, this.popover && ((l = (i = this.popover).hide) == null || l.call(i), (c = (a = this.popover).destroy) == null || c.call(a), this.popover = null), this.createToolsInstances(), !this.nodes.wrapper))
|
|
17591
17605
|
return;
|
|
17592
17606
|
this.nodes.wrapper.innerHTML = "";
|
|
@@ -17599,7 +17613,7 @@ class op extends x {
|
|
|
17599
17613
|
search: this.Blok.I18n.t("popover.search")
|
|
17600
17614
|
}
|
|
17601
17615
|
});
|
|
17602
|
-
const o = (S = (g = (b = this.popover).getMountElement) == null ? void 0 : g.call(b)) != null ? S : (v = (m = this.popover).getElement) == null ? void 0 : v.call(m), n = (Q = (
|
|
17616
|
+
const o = (S = (g = (b = this.popover).getMountElement) == null ? void 0 : g.call(b)) != null ? S : (v = (m = this.popover).getElement) == null ? void 0 : v.call(m), n = (Q = (L = this.popover).getElement) == null ? void 0 : Q.call(L), r = (rs = (St = (X = this.popover.size) == null ? void 0 : X.width) != null ? St : n == null ? void 0 : n.getBoundingClientRect().width) != null ? rs : 0;
|
|
17603
17617
|
this.applyPosition(r), o && this.nodes.wrapper && this.nodes.wrapper.appendChild(o), (ls = (is = this.popover).show) == null || ls.call(is);
|
|
17604
17618
|
}
|
|
17605
17619
|
/**
|
|
@@ -17774,7 +17788,7 @@ class np extends Qn {
|
|
|
17774
17788
|
* @param readOnly - True if Blok is in read-only mode
|
|
17775
17789
|
*/
|
|
17776
17790
|
create(t, e, o) {
|
|
17777
|
-
const n = this.toolbox, r = n !== void 0 ?
|
|
17791
|
+
const n = this.toolbox, r = n !== void 0 ? j(B({}, this.settings), { _toolboxEntries: n }) : this.settings;
|
|
17778
17792
|
return new this.constructable({
|
|
17779
17793
|
data: t,
|
|
17780
17794
|
block: e,
|
|
@@ -18037,7 +18051,7 @@ class ip {
|
|
|
18037
18051
|
},
|
|
18038
18052
|
getEnglishTranslation: (r) => e.i18n.getEnglishTranslation(r)
|
|
18039
18053
|
};
|
|
18040
|
-
return
|
|
18054
|
+
return j(B({}, e), {
|
|
18041
18055
|
i18n: n
|
|
18042
18056
|
});
|
|
18043
18057
|
}
|
|
@@ -19299,8 +19313,8 @@ class mp {
|
|
|
19299
19313
|
};
|
|
19300
19314
|
if (A(t)) {
|
|
19301
19315
|
const e = t, o = e.config;
|
|
19302
|
-
return
|
|
19303
|
-
config:
|
|
19316
|
+
return j(B({}, e), {
|
|
19317
|
+
config: j(B({}, A(o) ? o : {}), {
|
|
19304
19318
|
preserveBlank: !0
|
|
19305
19319
|
})
|
|
19306
19320
|
});
|
|
@@ -19436,7 +19450,7 @@ const Sp = Ke(), ie = class ie {
|
|
|
19436
19450
|
}
|
|
19437
19451
|
}).forEach(([g, m]) => {
|
|
19438
19452
|
Object.entries(m).forEach(([v, S]) => {
|
|
19439
|
-
const
|
|
19453
|
+
const L = g, Q = t.moduleInstances.API.methods[L];
|
|
19440
19454
|
this[S] = Q[v];
|
|
19441
19455
|
});
|
|
19442
19456
|
});
|