@jackuait/blok 0.6.0-beta.4 → 0.6.0-beta.5
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-DK-97ZTf.mjs → blok-XA2L0_-K.mjs} +1216 -1178
- package/dist/chunks/{i18next-loader-CRollibS.mjs → i18next-loader-Ci2zhA-n.mjs} +1 -1
- package/dist/chunks/{index-jgHmMDND.mjs → index-R38OiQ_d.mjs} +1 -1
- package/dist/chunks/{inline-tool-convert-BIwvipPw.mjs → inline-tool-convert-e3PyuxB6.mjs} +88 -73
- package/dist/chunks/{messages-C5b7hr_E.mjs → messages-1fC8IMyX.mjs} +16 -2
- package/dist/{messages-BPqWKx5Z.mjs → chunks/messages-49thXXGz.mjs} +16 -2
- package/dist/{messages-LvFKBBPa.mjs → chunks/messages-7W4d0DwD.mjs} +15 -1
- package/dist/{messages-Bn253WWC.mjs → chunks/messages-9SihnaXQ.mjs} +14 -0
- package/dist/{messages-Bf6Y3_GI.mjs → chunks/messages-B1Aww8q7.mjs} +16 -2
- package/dist/{messages-D00OjS2n.mjs → chunks/messages-B9fe4dQJ.mjs} +15 -1
- package/dist/{messages-pA5TvcAj.mjs → chunks/messages-BB5z9Uba.mjs} +14 -0
- package/dist/chunks/{messages-wdqp4610.mjs → messages-BC86qLvI.mjs} +17 -3
- package/dist/chunks/{messages-o24dK6CU.mjs → messages-BELRf6DU.mjs} +16 -2
- package/dist/chunks/{messages-CUZ1x1QD.mjs → messages-BFG6Wlgy.mjs} +16 -2
- package/dist/chunks/{messages-CQj2JU2j.mjs → messages-BGxiFoZf.mjs} +15 -1
- package/dist/{messages-B5puUm7R.mjs → chunks/messages-BL0tXcDf.mjs} +15 -1
- package/dist/{messages-CyDU5lz9.mjs → chunks/messages-BMv4xwIr.mjs} +16 -2
- package/dist/chunks/{messages-CkFT2gle.mjs → messages-BNe6LuHW.mjs} +14 -0
- package/dist/chunks/{messages-JGsXAReJ.mjs → messages-BU2nlrLK.mjs} +16 -2
- package/dist/chunks/{messages-srxrv8Yh.mjs → messages-BWF-zUpY.mjs} +17 -3
- package/dist/{messages-CXHd9SUK.mjs → chunks/messages-BYyy6Wqf.mjs} +14 -0
- package/dist/{messages-Cyi2AMmz.mjs → chunks/messages-Bfiw5w_W.mjs} +16 -2
- package/dist/chunks/{messages-B5jGUnOy.mjs → messages-Bmu_S7GM.mjs} +14 -0
- package/dist/chunks/{messages-BmKCChWZ.mjs → messages-BoJc_p1r.mjs} +14 -0
- package/dist/chunks/{messages-CvaqJFN-.mjs → messages-BogRq8lt.mjs} +15 -1
- package/dist/chunks/{messages-NP1myMGI.mjs → messages-BrPFGbM-.mjs} +14 -0
- package/dist/chunks/{messages-BiExzWJv.mjs → messages-C99mq906.mjs} +15 -1
- package/dist/chunks/{messages-BrJHUxQL.mjs → messages-CJdUsQ-c.mjs} +15 -1
- package/dist/{messages-CrsJ1TEJ.mjs → chunks/messages-CLhcMlTc.mjs} +15 -1
- package/dist/{messages-CnvW8Slp.mjs → chunks/messages-CMkNSDTo.mjs} +17 -3
- package/dist/chunks/{messages-B9Oba7sq.mjs → messages-CY8_RyFE.mjs} +15 -1
- package/dist/chunks/{messages-B5hdXZwA.mjs → messages-CZygwLwM.mjs} +15 -1
- package/dist/chunks/{messages-CVeWVKsV.mjs → messages-CnwibSvh.mjs} +14 -0
- package/dist/chunks/{messages-DbVquYKN.mjs → messages-CqWJcCbY.mjs} +14 -0
- package/dist/{messages-Dg92dXZ5.mjs → chunks/messages-CvGLfqmV.mjs} +14 -0
- package/dist/{messages-AHESHJm_.mjs → chunks/messages-CzTufCHu.mjs} +14 -0
- package/dist/chunks/{messages-Cj-t1bdy.mjs → messages-CznZadDf.mjs} +15 -1
- package/dist/chunks/{messages-DMQIHGRj.mjs → messages-D-ZtY5v0.mjs} +14 -0
- package/dist/chunks/{messages-rRSHQDCX.mjs → messages-D1Hv8XGo.mjs} +14 -0
- package/dist/chunks/{messages-0tDXLuyH.mjs → messages-D5C3J9qr.mjs} +15 -1
- package/dist/chunks/{messages-RvMHb2Ht.mjs → messages-D5iv1Kox.mjs} +16 -2
- package/dist/{messages-zSzDzXej.mjs → chunks/messages-DBRw-7Zc.mjs} +16 -2
- package/dist/chunks/{messages-CeCjVKMW.mjs → messages-DBn76jVV.mjs} +16 -2
- package/dist/{messages-DOlC_Tty.mjs → chunks/messages-DChXyvh2.mjs} +15 -1
- package/dist/chunks/{messages-C7I_AVH2.mjs → messages-DJDG55Vq.mjs} +16 -2
- package/dist/{messages-DDLgIPDF.mjs → chunks/messages-DLfR5bMd.mjs} +16 -2
- package/dist/{messages-CbhuIWRJ.mjs → chunks/messages-DT4dP5uK.mjs} +15 -1
- package/dist/chunks/{messages-B66ZSDCJ.mjs → messages-DhLKYm2j.mjs} +15 -1
- package/dist/{messages-BlpqL8vG.mjs → chunks/messages-DjvaFRqx.mjs} +16 -2
- package/dist/{messages-BA0rcTCY.mjs → chunks/messages-DnIhyAJk.mjs} +18 -4
- package/dist/chunks/{messages-DV6shA9b.mjs → messages-DnXLrlHh.mjs} +14 -0
- package/dist/chunks/{messages-DcKOuncK.mjs → messages-DprmQg6V.mjs} +16 -2
- package/dist/{messages-CJoBtXU6.mjs → chunks/messages-DqM1LFg5.mjs} +14 -0
- package/dist/chunks/{messages-CySyfkMU.mjs → messages-DsVNtdgM.mjs} +15 -1
- package/dist/chunks/{messages-DnbbyJT3.mjs → messages-Dz9L52ol.mjs} +16 -2
- package/dist/chunks/{messages-Cu08aLS3.mjs → messages-EL5ARzmK.mjs} +16 -2
- package/dist/chunks/{messages-Q4kc_ZtL.mjs → messages-JELdtT6E.mjs} +15 -1
- package/dist/{messages-DY94ykcE.mjs → chunks/messages-LPVfA-8K.mjs} +14 -0
- package/dist/{messages-Cr-RJ7YB.mjs → chunks/messages-O5tQus_0.mjs} +14 -0
- package/dist/chunks/{messages-CbMyJSzS.mjs → messages-Q7AO_FLv.mjs} +17 -3
- package/dist/chunks/{messages-GC2PhgV3.mjs → messages-QtoE8uEv.mjs} +15 -1
- package/dist/chunks/{messages-2_xedlYw.mjs → messages-R3hUSvr3.mjs} +15 -1
- package/dist/chunks/{messages-zS1AXZ0y.mjs → messages-UX4gkere.mjs} +15 -1
- package/dist/{messages-CUy1vn-b.mjs → chunks/messages-Xq8UmkVs.mjs} +14 -0
- package/dist/chunks/{messages-BBJgd5jG.mjs → messages-Z9nEU2xK.mjs} +16 -2
- package/dist/chunks/{messages-Cm9aLHeX.mjs → messages-_ErNTNhk.mjs} +15 -1
- package/dist/chunks/{messages-JZUhXTuV.mjs → messages-_ncGrKHh.mjs} +16 -2
- package/dist/chunks/{messages-ftMcCEuO.mjs → messages-kep5wtm4.mjs} +15 -1
- package/dist/chunks/{messages-DteYq0rv.mjs → messages-uKX8WBaD.mjs} +16 -2
- package/dist/chunks/{messages-Bdv-IkfG.mjs → messages-w7v1GNaE.mjs} +15 -1
- package/dist/{messages-BeUhMpsr.mjs → chunks/messages-wp_1b1hD.mjs} +15 -1
- package/dist/full.mjs +2 -2
- package/dist/locales.mjs +102 -88
- package/dist/{messages-C5b7hr_E.mjs → messages-1fC8IMyX.mjs} +16 -2
- package/dist/{chunks/messages-BPqWKx5Z.mjs → messages-49thXXGz.mjs} +16 -2
- package/dist/{chunks/messages-LvFKBBPa.mjs → messages-7W4d0DwD.mjs} +15 -1
- package/dist/{chunks/messages-Bn253WWC.mjs → messages-9SihnaXQ.mjs} +14 -0
- package/dist/{chunks/messages-Bf6Y3_GI.mjs → messages-B1Aww8q7.mjs} +16 -2
- package/dist/{chunks/messages-D00OjS2n.mjs → messages-B9fe4dQJ.mjs} +15 -1
- package/dist/{chunks/messages-pA5TvcAj.mjs → messages-BB5z9Uba.mjs} +14 -0
- package/dist/{messages-wdqp4610.mjs → messages-BC86qLvI.mjs} +17 -3
- package/dist/{messages-o24dK6CU.mjs → messages-BELRf6DU.mjs} +16 -2
- package/dist/{messages-CUZ1x1QD.mjs → messages-BFG6Wlgy.mjs} +16 -2
- package/dist/{messages-CQj2JU2j.mjs → messages-BGxiFoZf.mjs} +15 -1
- package/dist/{chunks/messages-B5puUm7R.mjs → messages-BL0tXcDf.mjs} +15 -1
- package/dist/{chunks/messages-CyDU5lz9.mjs → messages-BMv4xwIr.mjs} +16 -2
- package/dist/{messages-CkFT2gle.mjs → messages-BNe6LuHW.mjs} +14 -0
- package/dist/{messages-JGsXAReJ.mjs → messages-BU2nlrLK.mjs} +16 -2
- package/dist/{messages-srxrv8Yh.mjs → messages-BWF-zUpY.mjs} +17 -3
- package/dist/{chunks/messages-CXHd9SUK.mjs → messages-BYyy6Wqf.mjs} +14 -0
- package/dist/{chunks/messages-Cyi2AMmz.mjs → messages-Bfiw5w_W.mjs} +16 -2
- package/dist/{messages-B5jGUnOy.mjs → messages-Bmu_S7GM.mjs} +14 -0
- package/dist/{messages-BmKCChWZ.mjs → messages-BoJc_p1r.mjs} +14 -0
- package/dist/{messages-CvaqJFN-.mjs → messages-BogRq8lt.mjs} +15 -1
- package/dist/{messages-NP1myMGI.mjs → messages-BrPFGbM-.mjs} +14 -0
- package/dist/{messages-BiExzWJv.mjs → messages-C99mq906.mjs} +15 -1
- package/dist/{messages-BrJHUxQL.mjs → messages-CJdUsQ-c.mjs} +15 -1
- package/dist/{chunks/messages-CrsJ1TEJ.mjs → messages-CLhcMlTc.mjs} +15 -1
- package/dist/{chunks/messages-CnvW8Slp.mjs → messages-CMkNSDTo.mjs} +17 -3
- package/dist/{messages-B9Oba7sq.mjs → messages-CY8_RyFE.mjs} +15 -1
- package/dist/{messages-B5hdXZwA.mjs → messages-CZygwLwM.mjs} +15 -1
- package/dist/{messages-CVeWVKsV.mjs → messages-CnwibSvh.mjs} +14 -0
- package/dist/{messages-DbVquYKN.mjs → messages-CqWJcCbY.mjs} +14 -0
- package/dist/{chunks/messages-Dg92dXZ5.mjs → messages-CvGLfqmV.mjs} +14 -0
- package/dist/{chunks/messages-AHESHJm_.mjs → messages-CzTufCHu.mjs} +14 -0
- package/dist/{messages-Cj-t1bdy.mjs → messages-CznZadDf.mjs} +15 -1
- package/dist/{messages-DMQIHGRj.mjs → messages-D-ZtY5v0.mjs} +14 -0
- package/dist/{messages-rRSHQDCX.mjs → messages-D1Hv8XGo.mjs} +14 -0
- package/dist/{messages-0tDXLuyH.mjs → messages-D5C3J9qr.mjs} +15 -1
- package/dist/{messages-RvMHb2Ht.mjs → messages-D5iv1Kox.mjs} +16 -2
- package/dist/{chunks/messages-zSzDzXej.mjs → messages-DBRw-7Zc.mjs} +16 -2
- package/dist/{messages-CeCjVKMW.mjs → messages-DBn76jVV.mjs} +16 -2
- package/dist/{chunks/messages-DOlC_Tty.mjs → messages-DChXyvh2.mjs} +15 -1
- package/dist/{messages-C7I_AVH2.mjs → messages-DJDG55Vq.mjs} +16 -2
- package/dist/{chunks/messages-DDLgIPDF.mjs → messages-DLfR5bMd.mjs} +16 -2
- package/dist/{chunks/messages-CbhuIWRJ.mjs → messages-DT4dP5uK.mjs} +15 -1
- package/dist/{messages-B66ZSDCJ.mjs → messages-DhLKYm2j.mjs} +15 -1
- package/dist/{chunks/messages-BlpqL8vG.mjs → messages-DjvaFRqx.mjs} +16 -2
- package/dist/{chunks/messages-BA0rcTCY.mjs → messages-DnIhyAJk.mjs} +18 -4
- package/dist/{messages-DV6shA9b.mjs → messages-DnXLrlHh.mjs} +14 -0
- package/dist/{messages-DcKOuncK.mjs → messages-DprmQg6V.mjs} +16 -2
- package/dist/{chunks/messages-CJoBtXU6.mjs → messages-DqM1LFg5.mjs} +14 -0
- package/dist/{messages-CySyfkMU.mjs → messages-DsVNtdgM.mjs} +15 -1
- package/dist/{messages-DnbbyJT3.mjs → messages-Dz9L52ol.mjs} +16 -2
- package/dist/{messages-Cu08aLS3.mjs → messages-EL5ARzmK.mjs} +16 -2
- package/dist/{messages-Q4kc_ZtL.mjs → messages-JELdtT6E.mjs} +15 -1
- package/dist/{chunks/messages-DY94ykcE.mjs → messages-LPVfA-8K.mjs} +14 -0
- package/dist/{chunks/messages-Cr-RJ7YB.mjs → messages-O5tQus_0.mjs} +14 -0
- package/dist/{messages-CbMyJSzS.mjs → messages-Q7AO_FLv.mjs} +17 -3
- package/dist/{messages-GC2PhgV3.mjs → messages-QtoE8uEv.mjs} +15 -1
- package/dist/{messages-2_xedlYw.mjs → messages-R3hUSvr3.mjs} +15 -1
- package/dist/{messages-zS1AXZ0y.mjs → messages-UX4gkere.mjs} +15 -1
- package/dist/{chunks/messages-CUy1vn-b.mjs → messages-Xq8UmkVs.mjs} +14 -0
- package/dist/{messages-BBJgd5jG.mjs → messages-Z9nEU2xK.mjs} +16 -2
- package/dist/{messages-Cm9aLHeX.mjs → messages-_ErNTNhk.mjs} +15 -1
- package/dist/{messages-JZUhXTuV.mjs → messages-_ncGrKHh.mjs} +16 -2
- package/dist/{messages-ftMcCEuO.mjs → messages-kep5wtm4.mjs} +15 -1
- package/dist/{messages-DteYq0rv.mjs → messages-uKX8WBaD.mjs} +16 -2
- package/dist/{messages-Bdv-IkfG.mjs → messages-w7v1GNaE.mjs} +15 -1
- package/dist/{chunks/messages-BeUhMpsr.mjs → messages-wp_1b1hD.mjs} +15 -1
- package/dist/tools.mjs +854 -719
- package/package.json +5 -9
- package/src/components/i18n/locales/am/messages.json +15 -1
- package/src/components/i18n/locales/ar/messages.json +14 -0
- package/src/components/i18n/locales/az/messages.json +14 -0
- package/src/components/i18n/locales/bg/messages.json +14 -0
- package/src/components/i18n/locales/bn/messages.json +15 -1
- package/src/components/i18n/locales/bs/messages.json +15 -1
- package/src/components/i18n/locales/cs/messages.json +14 -0
- package/src/components/i18n/locales/da/messages.json +14 -0
- package/src/components/i18n/locales/de/messages.json +14 -0
- package/src/components/i18n/locales/dv/messages.json +15 -1
- package/src/components/i18n/locales/el/messages.json +15 -1
- package/src/components/i18n/locales/en/messages.json +14 -0
- package/src/components/i18n/locales/es/messages.json +14 -0
- package/src/components/i18n/locales/et/messages.json +14 -0
- package/src/components/i18n/locales/fa/messages.json +15 -1
- package/src/components/i18n/locales/fi/messages.json +15 -1
- package/src/components/i18n/locales/fil/messages.json +14 -0
- package/src/components/i18n/locales/fr/messages.json +15 -1
- package/src/components/i18n/locales/gu/messages.json +15 -1
- package/src/components/i18n/locales/he/messages.json +14 -0
- package/src/components/i18n/locales/hi/messages.json +15 -1
- package/src/components/i18n/locales/hr/messages.json +14 -0
- package/src/components/i18n/locales/hu/messages.json +14 -0
- package/src/components/i18n/locales/hy/messages.json +16 -2
- package/src/components/i18n/locales/id/messages.json +16 -2
- package/src/components/i18n/locales/it/messages.json +14 -0
- package/src/components/i18n/locales/ja/messages.json +14 -0
- package/src/components/i18n/locales/ka/messages.json +15 -1
- package/src/components/i18n/locales/km/messages.json +16 -2
- package/src/components/i18n/locales/kn/messages.json +16 -2
- package/src/components/i18n/locales/ko/messages.json +14 -0
- package/src/components/i18n/locales/ku/messages.json +16 -2
- package/src/components/i18n/locales/lo/messages.json +15 -1
- package/src/components/i18n/locales/lt/messages.json +15 -1
- package/src/components/i18n/locales/lv/messages.json +15 -1
- package/src/components/i18n/locales/mk/messages.json +16 -2
- package/src/components/i18n/locales/ml/messages.json +16 -2
- package/src/components/i18n/locales/mn/messages.json +16 -2
- package/src/components/i18n/locales/mr/messages.json +15 -1
- package/src/components/i18n/locales/ms/messages.json +16 -2
- package/src/components/i18n/locales/my/messages.json +16 -2
- package/src/components/i18n/locales/ne/messages.json +15 -1
- package/src/components/i18n/locales/nl/messages.json +15 -1
- package/src/components/i18n/locales/no/messages.json +16 -2
- package/src/components/i18n/locales/pa/messages.json +15 -1
- package/src/components/i18n/locales/pl/messages.json +14 -0
- package/src/components/i18n/locales/ps/messages.json +17 -3
- package/src/components/i18n/locales/pt/messages.json +14 -0
- package/src/components/i18n/locales/ro/messages.json +15 -1
- package/src/components/i18n/locales/ru/messages.json +14 -0
- package/src/components/i18n/locales/sd/messages.json +16 -2
- package/src/components/i18n/locales/si/messages.json +15 -1
- package/src/components/i18n/locales/sk/messages.json +15 -1
- package/src/components/i18n/locales/sl/messages.json +16 -2
- package/src/components/i18n/locales/sq/messages.json +16 -2
- package/src/components/i18n/locales/sr/messages.json +16 -2
- package/src/components/i18n/locales/sv/messages.json +16 -2
- package/src/components/i18n/locales/sw/messages.json +16 -2
- package/src/components/i18n/locales/ta/messages.json +16 -2
- package/src/components/i18n/locales/te/messages.json +15 -1
- package/src/components/i18n/locales/th/messages.json +15 -1
- package/src/components/i18n/locales/tr/messages.json +15 -1
- package/src/components/i18n/locales/ug/messages.json +16 -2
- package/src/components/i18n/locales/uk/messages.json +15 -1
- package/src/components/i18n/locales/ur/messages.json +15 -1
- package/src/components/i18n/locales/vi/messages.json +16 -2
- package/src/components/i18n/locales/yi/messages.json +16 -2
- package/src/components/i18n/locales/zh/messages.json +15 -1
- package/src/components/modules/api/blocks.ts +17 -2
- package/src/components/modules/blockEvents/composers/markdownShortcuts.ts +12 -1
- package/src/components/modules/toolbar/index.ts +29 -7
- package/src/components/modules/ui.ts +46 -68
- package/src/components/modules/uiControllers/controllers/blockHover.ts +40 -61
- package/src/components/ui/toolbox.ts +41 -6
- package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.ts +3 -1
- package/src/components/utils/popover/popover-desktop.ts +27 -8
- package/src/tools/table/index.ts +67 -70
- package/src/tools/table/table-add-controls.ts +25 -7
- package/src/tools/table/table-cell-blocks.ts +62 -0
- package/src/tools/table/table-cell-selection.ts +70 -46
- package/src/tools/table/table-core.ts +20 -15
- package/src/tools/table/table-grip-visuals.ts +4 -4
- package/src/tools/table/table-operations.ts +22 -12
- package/src/tools/table/table-restrictions.ts +64 -0
- package/src/tools/table/table-row-col-action-handler.ts +190 -0
- package/src/tools/table/table-row-col-controls.ts +91 -182
- package/src/tools/table/table-row-col-drag.ts +4 -4
- package/src/tools/table/table-row-col-popover.ts +225 -0
- package/src/tools/table/types.ts +2 -0
- package/types/utils/popover/popover.d.ts +7 -0
package/dist/tools.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var ke = Object.defineProperty, xe = Object.defineProperties;
|
|
2
|
+
var Te = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var xt = Object.getOwnPropertySymbols;
|
|
4
|
+
var Re = Object.prototype.hasOwnProperty, Le = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Tt = (i, t, e) => t in i ? ke(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, x = (i, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var e of
|
|
10
|
-
Le.call(t, e) &&
|
|
7
|
+
Re.call(t, e) && Tt(i, e, t[e]);
|
|
8
|
+
if (xt)
|
|
9
|
+
for (var e of xt(t))
|
|
10
|
+
Le.call(t, e) && Tt(i, e, t[e]);
|
|
11
11
|
return i;
|
|
12
|
-
}, tt = (i, t) =>
|
|
13
|
-
import { t as v, D as E, am as
|
|
14
|
-
import { ab as
|
|
12
|
+
}, tt = (i, t) => xe(i, Te(t));
|
|
13
|
+
import { t as v, D as E, am as Be, an as Ie, _ as De, ao as Ne, ap as He, aq as Pe, ar as _e, as as Oe, at as Me, au as Qt, av as te, aw as ee, o as We, p as Rt, a5 as Lt, a3 as $e, ax as Ge, J as ne, Q as se, P as q, ay as qe, az as Fe, a0 as oe, aA as ze, aB as Ve, aC as Ue, aD as Ke, aE as je, z as H, aF as Xe, aG as Ye, S as et, aH as Ze, l as Je, a8 as Qe } from "./chunks/inline-tool-convert-e3PyuxB6.mjs";
|
|
14
|
+
import { ab as xo } from "./chunks/inline-tool-convert-e3PyuxB6.mjs";
|
|
15
15
|
const ie = (i) => {
|
|
16
16
|
if (!i || !i.includes("data-blok-fake-background"))
|
|
17
17
|
return i;
|
|
@@ -24,7 +24,7 @@ const ie = (i) => {
|
|
|
24
24
|
s.removeChild(n);
|
|
25
25
|
}
|
|
26
26
|
}), t.innerHTML;
|
|
27
|
-
},
|
|
27
|
+
}, dt = [
|
|
28
28
|
"empty:before:pointer-events-none",
|
|
29
29
|
"empty:before:text-gray-text",
|
|
30
30
|
"empty:before:cursor-text",
|
|
@@ -33,7 +33,7 @@ const ie = (i) => {
|
|
|
33
33
|
"[&[data-blok-empty=true]]:before:text-gray-text",
|
|
34
34
|
"[&[data-blok-empty=true]]:before:cursor-text",
|
|
35
35
|
"[&[data-blok-empty=true]]:before:content-[attr(data-placeholder)]"
|
|
36
|
-
],
|
|
36
|
+
], tn = [
|
|
37
37
|
"empty:focus:before:pointer-events-none",
|
|
38
38
|
"empty:focus:before:text-gray-text",
|
|
39
39
|
"empty:focus:before:cursor-text",
|
|
@@ -42,22 +42,22 @@ const ie = (i) => {
|
|
|
42
42
|
"[&[data-empty=true]:focus]:before:text-gray-text",
|
|
43
43
|
"[&[data-empty=true]:focus]:before:cursor-text",
|
|
44
44
|
"[&[data-empty=true]:focus]:before:content-[attr(data-blok-placeholder-active)]"
|
|
45
|
-
],
|
|
45
|
+
], en = (i) => {
|
|
46
46
|
const t = i.innerHTML.trim();
|
|
47
47
|
return t === "" || t === "<br>";
|
|
48
|
-
},
|
|
48
|
+
}, nn = (i) => {
|
|
49
49
|
i.innerHTML === "<br>" && (i.innerHTML = "");
|
|
50
50
|
const t = window.getSelection();
|
|
51
51
|
if (!t) return;
|
|
52
52
|
const e = document.createRange();
|
|
53
53
|
e.selectNodeContents(i), e.collapse(!0), t.removeAllRanges(), t.addRange(e);
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
},
|
|
54
|
+
}, sn = (i) => {
|
|
55
|
+
en(i) && nn(i);
|
|
56
|
+
}, Et = (i, t, e = "data-placeholder") => {
|
|
57
57
|
i.setAttribute(e, t != null ? t : "");
|
|
58
|
-
const n = () =>
|
|
58
|
+
const n = () => sn(i);
|
|
59
59
|
i.addEventListener("focus", n), i.addEventListener("input", n);
|
|
60
|
-
},
|
|
60
|
+
}, on = (i) => {
|
|
61
61
|
const t = document.createElement("div");
|
|
62
62
|
t.innerHTML = i.trim();
|
|
63
63
|
const e = document.createDocumentFragment();
|
|
@@ -110,10 +110,10 @@ const ie = (i) => {
|
|
|
110
110
|
t.className = v(
|
|
111
111
|
this.api.styles.block,
|
|
112
112
|
Q.WRAPPER_CLASSES,
|
|
113
|
-
|
|
113
|
+
tn
|
|
114
114
|
), t.setAttribute(E.tool, "paragraph"), t.contentEditable = "false";
|
|
115
115
|
const e = this.buildInlineStyles();
|
|
116
|
-
return Object.keys(e).length > 0 && Object.assign(t.style, e), this._data.text && (t.innerHTML = this._data.text), this.readOnly ? t.setAttribute("data-blok-placeholder-active", this.api.i18n.t(this._placeholder)) : (t.contentEditable = "true", t.addEventListener("keyup", this.onKeyUp),
|
|
116
|
+
return Object.keys(e).length > 0 && Object.assign(t.style, e), this._data.text && (t.innerHTML = this._data.text), this.readOnly ? t.setAttribute("data-blok-placeholder-active", this.api.i18n.t(this._placeholder)) : (t.contentEditable = "true", t.addEventListener("keyup", this.onKeyUp), Et(t, this.api.i18n.t(this._placeholder), "data-blok-placeholder-active")), t;
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
119
119
|
* Return Tool's view
|
|
@@ -133,7 +133,7 @@ const ie = (i) => {
|
|
|
133
133
|
if (!this._element)
|
|
134
134
|
return;
|
|
135
135
|
this._data.text += t.text;
|
|
136
|
-
const e =
|
|
136
|
+
const e = on(t.text);
|
|
137
137
|
this._element.appendChild(e), this._element.normalize();
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
@@ -224,7 +224,7 @@ const ie = (i) => {
|
|
|
224
224
|
*/
|
|
225
225
|
static get toolbox() {
|
|
226
226
|
return {
|
|
227
|
-
icon:
|
|
227
|
+
icon: Be,
|
|
228
228
|
title: "Text",
|
|
229
229
|
titleKey: "text",
|
|
230
230
|
searchTerms: ["p", "paragraph", "plain"]
|
|
@@ -239,8 +239,8 @@ Q.WRAPPER_CLASSES = [
|
|
|
239
239
|
"[&>p:first-of-type]:mt-0",
|
|
240
240
|
"[&>p:last-of-type]:mb-0"
|
|
241
241
|
];
|
|
242
|
-
let
|
|
243
|
-
const
|
|
242
|
+
let Bt = Q;
|
|
243
|
+
const O = class O {
|
|
244
244
|
/**
|
|
245
245
|
* Render plugin's main Element and fill it with saved data
|
|
246
246
|
*
|
|
@@ -327,9 +327,9 @@ const q = class q {
|
|
|
327
327
|
buildSettingsFromToolboxEntries(t) {
|
|
328
328
|
return t.map((e) => {
|
|
329
329
|
var c, d, h, p;
|
|
330
|
-
const n = e.data, s = (c = n == null ? void 0 : n.level) != null ? c : this.defaultLevel.number, o =
|
|
330
|
+
const n = e.data, s = (c = n == null ? void 0 : n.level) != null ? c : this.defaultLevel.number, o = O.DEFAULT_LEVELS.find((m) => m.number === s), r = (d = o == null ? void 0 : o.name) != null ? d : `Heading ${s}`, l = this.resolveToolboxEntryTitle(e, r);
|
|
331
331
|
return {
|
|
332
|
-
icon: (p = (h = e.icon) != null ? h : o == null ? void 0 : o.icon) != null ? p :
|
|
332
|
+
icon: (p = (h = e.icon) != null ? h : o == null ? void 0 : o.icon) != null ? p : Ie,
|
|
333
333
|
title: l,
|
|
334
334
|
onActivate: () => this.setLevel(s),
|
|
335
335
|
closeOnActivate: !0,
|
|
@@ -348,7 +348,7 @@ const q = class q {
|
|
|
348
348
|
* @returns Resolved title string
|
|
349
349
|
*/
|
|
350
350
|
resolveToolboxEntryTitle(t, e) {
|
|
351
|
-
return
|
|
351
|
+
return De(this.api.i18n, t, e);
|
|
352
352
|
}
|
|
353
353
|
/**
|
|
354
354
|
* Callback for Block's settings buttons
|
|
@@ -450,9 +450,9 @@ const q = class q {
|
|
|
450
450
|
*/
|
|
451
451
|
getTag() {
|
|
452
452
|
const t = document.createElement(this.currentLevel.tag);
|
|
453
|
-
t.innerHTML = this._data.text || "", t.className = v(
|
|
453
|
+
t.innerHTML = this._data.text || "", t.className = v(O.BASE_STYLES, this.currentLevel.styles, dt);
|
|
454
454
|
const { inlineStyles: e } = this.currentLevel;
|
|
455
|
-
return e && Object.assign(t.style, e), t.setAttribute(E.tool, "header"), t.contentEditable = this.readOnly ? "false" : "true", this.readOnly ? t.setAttribute("data-placeholder", this.api.i18n.t(this._settings.placeholder || "")) :
|
|
455
|
+
return e && Object.assign(t.style, e), t.setAttribute(E.tool, "header"), t.contentEditable = this.readOnly ? "false" : "true", this.readOnly ? t.setAttribute("data-placeholder", this.api.i18n.t(this._settings.placeholder || "")) : Et(t, this.api.i18n.t(this._settings.placeholder || "")), t;
|
|
456
456
|
}
|
|
457
457
|
/**
|
|
458
458
|
* Get current level
|
|
@@ -480,7 +480,7 @@ const q = class q {
|
|
|
480
480
|
* @returns Level array
|
|
481
481
|
*/
|
|
482
482
|
get levels() {
|
|
483
|
-
const t = this._settings.levelOverrides || {}, e =
|
|
483
|
+
const t = this._settings.levelOverrides || {}, e = O.DEFAULT_LEVELS.map((s) => {
|
|
484
484
|
var l;
|
|
485
485
|
const o = t[s.number] || {}, r = {};
|
|
486
486
|
return o.size && (r.fontSize = o.size), o.marginTop && (r.marginTop = o.marginTop), o.marginBottom && (r.marginBottom = o.marginBottom), {
|
|
@@ -537,7 +537,7 @@ const q = class q {
|
|
|
537
537
|
* @returns ToolboxConfig array with entries for H1-H6
|
|
538
538
|
*/
|
|
539
539
|
static get toolbox() {
|
|
540
|
-
return
|
|
540
|
+
return O.DEFAULT_LEVELS.map((t) => ({
|
|
541
541
|
icon: t.icon,
|
|
542
542
|
title: t.name,
|
|
543
543
|
titleKey: t.nameKey,
|
|
@@ -548,16 +548,16 @@ const q = class q {
|
|
|
548
548
|
}));
|
|
549
549
|
}
|
|
550
550
|
};
|
|
551
|
-
|
|
552
|
-
{ number: 1, tag: "H1", nameKey: "tools.header.heading1", name: "Heading 1", icon:
|
|
553
|
-
{ number: 2, tag: "H2", nameKey: "tools.header.heading2", name: "Heading 2", icon:
|
|
551
|
+
O.BASE_STYLES = "py-[3px] px-[2px] m-0 !leading-[1.3] outline-none [&_p]:!p-0 [&_p]:!m-0 [&_div]:!p-0 [&_div]:!m-0", O.DEFAULT_LEVELS = [
|
|
552
|
+
{ number: 1, tag: "H1", nameKey: "tools.header.heading1", name: "Heading 1", icon: Ne, styles: "text-4xl font-bold mt-8 mb-1" },
|
|
553
|
+
{ number: 2, tag: "H2", nameKey: "tools.header.heading2", name: "Heading 2", icon: He, styles: "text-3xl font-semibold mt-6 mb-px" },
|
|
554
554
|
{ number: 3, tag: "H3", nameKey: "tools.header.heading3", name: "Heading 3", icon: Pe, styles: "text-2xl font-semibold mt-4 mb-px" },
|
|
555
555
|
{ number: 4, tag: "H4", nameKey: "tools.header.heading4", name: "Heading 4", icon: _e, styles: "text-xl font-semibold mt-3 mb-px" },
|
|
556
|
-
{ number: 5, tag: "H5", nameKey: "tools.header.heading5", name: "Heading 5", icon:
|
|
556
|
+
{ number: 5, tag: "H5", nameKey: "tools.header.heading5", name: "Heading 5", icon: Oe, styles: "text-base font-semibold mt-3 mb-px" },
|
|
557
557
|
{ number: 6, tag: "H6", nameKey: "tools.header.heading6", name: "Heading 6", icon: Me, styles: "text-sm font-semibold mt-3 mb-px" }
|
|
558
558
|
];
|
|
559
|
-
let
|
|
560
|
-
const
|
|
559
|
+
let It = O;
|
|
560
|
+
const F = 24, rn = "outline-none py-[3px] mt-[2px] mb-px", ln = "outline-none pl-0.5 leading-[1.6em]", an = "flex items-start pl-0.5", cn = "mt-1 w-4 mr-2 h-4 cursor-pointer accent-current", dn = "tools.list.placeholder", w = "list", re = {
|
|
561
561
|
contentContainer: "list-content-container",
|
|
562
562
|
checklistContent: "list-checklist-content"
|
|
563
563
|
}, le = (i, t) => {
|
|
@@ -569,7 +569,7 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
|
|
|
569
569
|
configurable: !1
|
|
570
570
|
});
|
|
571
571
|
}, ae = (i) => {
|
|
572
|
-
const { data: t, keydownHandler: e, readOnly: n } = i, s =
|
|
572
|
+
const { data: t, keydownHandler: e, readOnly: n } = i, s = hn(i), o = t.style === "checklist" ? pn(i) : un(i);
|
|
573
573
|
s.appendChild(o), !n && e && s.addEventListener("keydown", e);
|
|
574
574
|
const r = o.querySelector("[data-list-marker]"), l = o.querySelector('input[type="checkbox"]'), a = o.querySelector("[contenteditable]");
|
|
575
575
|
return {
|
|
@@ -578,47 +578,47 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
|
|
|
578
578
|
markerElement: r,
|
|
579
579
|
checkboxElement: l
|
|
580
580
|
};
|
|
581
|
-
},
|
|
581
|
+
}, hn = (i) => {
|
|
582
582
|
var n;
|
|
583
583
|
const { data: t } = i, e = document.createElement("div");
|
|
584
|
-
return e.className =
|
|
585
|
-
},
|
|
584
|
+
return e.className = rn, e.setAttribute(E.tool, w), e.setAttribute("data-list-style", t.style), e.setAttribute("data-list-depth", String((n = t.depth) != null ? n : 0)), t.start !== void 0 && t.start !== 1 && e.setAttribute("data-list-start", String(t.start)), e;
|
|
585
|
+
}, un = (i) => {
|
|
586
586
|
var c;
|
|
587
587
|
const { data: t, itemColor: e, itemSize: n, placeholder: s } = i, o = document.createElement("div");
|
|
588
|
-
o.setAttribute("role", "listitem"), o.className = v(
|
|
588
|
+
o.setAttribute("role", "listitem"), o.className = v(ln, "flex", ...dt), e && (o.style.color = e), n && (o.style.fontSize = n);
|
|
589
589
|
const r = (c = t.depth) != null ? c : 0;
|
|
590
|
-
r > 0 && (o.style.marginLeft = `${r *
|
|
591
|
-
const l =
|
|
590
|
+
r > 0 && (o.style.marginLeft = `${r * F}px`);
|
|
591
|
+
const l = gn(t.style, r);
|
|
592
592
|
l.setAttribute("data-list-marker", "true"), l.setAttribute("data-blok-mutation-free", "true"), o.appendChild(l);
|
|
593
593
|
const a = document.createElement("div");
|
|
594
|
-
return a.className = v("flex-1 min-w-0 outline-none", ...
|
|
595
|
-
},
|
|
594
|
+
return a.className = v("flex-1 min-w-0 outline-none", ...dt), a.setAttribute("data-blok-testid", re.contentContainer), a.contentEditable = i.readOnly ? "false" : "true", a.innerHTML = t.text, le(a, s), o.appendChild(a), o;
|
|
595
|
+
}, pn = (i) => {
|
|
596
596
|
var d;
|
|
597
597
|
const { data: t, itemColor: e, itemSize: n, placeholder: s, readOnly: o } = i, r = document.createElement("div");
|
|
598
|
-
r.setAttribute("role", "listitem"), r.className =
|
|
598
|
+
r.setAttribute("role", "listitem"), r.className = an, e && (r.style.color = e), n && (r.style.fontSize = n);
|
|
599
599
|
const l = (d = t.depth) != null ? d : 0;
|
|
600
|
-
l > 0 && (r.style.marginLeft = `${l *
|
|
600
|
+
l > 0 && (r.style.marginLeft = `${l * F}px`);
|
|
601
601
|
const a = document.createElement("input");
|
|
602
|
-
a.type = "checkbox", a.className =
|
|
602
|
+
a.type = "checkbox", a.className = cn, a.checked = !!t.checked, a.disabled = o;
|
|
603
603
|
const c = document.createElement("div");
|
|
604
604
|
return c.className = v(
|
|
605
605
|
"flex-1 outline-none leading-[1.6em]",
|
|
606
606
|
t.checked ? "line-through opacity-60" : "",
|
|
607
|
-
...
|
|
607
|
+
...dt
|
|
608
608
|
), c.setAttribute("data-blok-testid", re.checklistContent), c.setAttribute("data-checked", String(t.checked)), c.contentEditable = o ? "false" : "true", c.innerHTML = t.text, le(c, s), r.appendChild(a), r.appendChild(c), r;
|
|
609
|
-
},
|
|
609
|
+
}, gn = (i, t) => {
|
|
610
610
|
const e = document.createElement("span");
|
|
611
611
|
if (e.className = "flex-shrink-0 select-none", e.setAttribute("aria-hidden", "true"), e.contentEditable = "false", i === "ordered")
|
|
612
612
|
e.textContent = "1.", e.className = v(e.className, "text-right"), e.style.paddingRight = "11px", e.style.minWidth = "fit-content";
|
|
613
613
|
else {
|
|
614
|
-
const n =
|
|
614
|
+
const n = fn(t);
|
|
615
615
|
e.textContent = n, e.className = v(e.className, "w-6 text-center flex justify-center"), e.style.paddingLeft = "1px", e.style.paddingRight = "13px", e.style.fontSize = "24px", e.style.fontFamily = "Arial";
|
|
616
616
|
}
|
|
617
617
|
return e;
|
|
618
|
-
},
|
|
618
|
+
}, fn = (i) => {
|
|
619
619
|
const t = ["•", "◦", "▪"];
|
|
620
620
|
return t[i % t.length];
|
|
621
|
-
},
|
|
621
|
+
}, mn = (i) => {
|
|
622
622
|
const { data: t, readOnly: e, placeholder: n, itemColor: s, itemSize: o, element: r, setupItemPlaceholder: l, onCheckboxChange: a, keydownHandler: c } = i;
|
|
623
623
|
if (!r) return null;
|
|
624
624
|
const d = r.parentNode;
|
|
@@ -638,7 +638,7 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
|
|
|
638
638
|
});
|
|
639
639
|
}
|
|
640
640
|
return d.replaceChild(h.wrapper, r), h.wrapper;
|
|
641
|
-
},
|
|
641
|
+
}, Cn = (i, t, e) => {
|
|
642
642
|
if (!t) return i;
|
|
643
643
|
const n = e(), o = {
|
|
644
644
|
text: n ? ie(n.innerHTML) : i.text,
|
|
@@ -646,18 +646,18 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
|
|
|
646
646
|
checked: i.checked
|
|
647
647
|
};
|
|
648
648
|
return i.start !== void 0 && i.start !== 1 && (o.start = i.start), i.depth !== void 0 && i.depth > 0 && (o.depth = i.depth), o;
|
|
649
|
-
},
|
|
649
|
+
}, yn = (i, t, e, n, s) => {
|
|
650
650
|
var f, y, b;
|
|
651
651
|
if (!e)
|
|
652
652
|
return { newData: i, inPlace: !1 };
|
|
653
653
|
const o = (f = i.depth) != null ? f : 0, r = (y = t.depth) != null ? y : 0, l = i.style, a = t.style;
|
|
654
654
|
if (l !== a)
|
|
655
655
|
return { newData: i, inPlace: !1 };
|
|
656
|
-
const c = "depth" in t ? t.depth : 0, d = tt(
|
|
656
|
+
const c = "depth" in t ? t.depth : 0, d = tt(x(x({}, i), t), {
|
|
657
657
|
depth: c
|
|
658
658
|
}), h = n();
|
|
659
659
|
return h && typeof t.text == "string" && (h.innerHTML = t.text), o !== r ? (s.adjustDepthTo(r), s.updateMarkerForDepth(r, a), { newData: d, inPlace: !0 }) : (a === "checklist" && s.updateCheckboxState((b = t.checked) != null ? b : !1), { newData: d, inPlace: !0 });
|
|
660
|
-
},
|
|
660
|
+
}, bn = (i, t) => {
|
|
661
661
|
const { element: e, getContentElement: n, parseHTML: s, data: o } = i;
|
|
662
662
|
if (!e)
|
|
663
663
|
return;
|
|
@@ -667,13 +667,13 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
|
|
|
667
667
|
const l = s(t.text);
|
|
668
668
|
r.appendChild(l), r.normalize();
|
|
669
669
|
}
|
|
670
|
-
},
|
|
670
|
+
}, vn = (i, t, e, n) => i.map((s) => ({
|
|
671
671
|
icon: s.icon,
|
|
672
672
|
title: e(`toolNames.${s.titleKey}`),
|
|
673
673
|
onActivate: () => n(s.style),
|
|
674
674
|
closeOnActivate: !0,
|
|
675
675
|
isActive: t === s.style
|
|
676
|
-
})),
|
|
676
|
+
})), Sn = (i) => {
|
|
677
677
|
if (!i)
|
|
678
678
|
return;
|
|
679
679
|
const e = (i.getAttribute("style") || "").match(/margin-left:\s*(\d+)px/);
|
|
@@ -681,7 +681,7 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
|
|
|
681
681
|
return;
|
|
682
682
|
const n = parseInt(e[1], 10);
|
|
683
683
|
return n > 0 ? { left: n } : void 0;
|
|
684
|
-
},
|
|
684
|
+
}, wn = (i) => {
|
|
685
685
|
const t = i.closest("[data-list-depth]");
|
|
686
686
|
if (!t)
|
|
687
687
|
return;
|
|
@@ -689,11 +689,11 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
|
|
|
689
689
|
if (e === null)
|
|
690
690
|
return;
|
|
691
691
|
const n = parseInt(e, 10);
|
|
692
|
-
return n > 0 ? { left: n *
|
|
693
|
-
},
|
|
694
|
-
const t = i.closest('[role="listitem"]') || i.querySelector('[role="listitem"]'), e =
|
|
695
|
-
return e !== void 0 ? e :
|
|
696
|
-
},
|
|
692
|
+
return n > 0 ? { left: n * F } : void 0;
|
|
693
|
+
}, An = (i) => {
|
|
694
|
+
const t = i.closest('[role="listitem"]') || i.querySelector('[role="listitem"]'), e = Sn(t);
|
|
695
|
+
return e !== void 0 ? e : wn(i);
|
|
696
|
+
}, En = (i, t) => {
|
|
697
697
|
const e = document.createRange();
|
|
698
698
|
if (e.setStart(i, 0), e.setEnd(t.startContainer, t.startOffset), !i.lastChild)
|
|
699
699
|
return {
|
|
@@ -702,33 +702,33 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
|
|
|
702
702
|
};
|
|
703
703
|
const n = document.createRange();
|
|
704
704
|
return n.setStart(t.endContainer, t.endOffset), n.setEndAfter(i.lastChild), {
|
|
705
|
-
beforeContent:
|
|
706
|
-
afterContent:
|
|
705
|
+
beforeContent: Dt(e.cloneContents()),
|
|
706
|
+
afterContent: Dt(n.cloneContents())
|
|
707
707
|
};
|
|
708
|
-
},
|
|
708
|
+
}, Dt = (i) => {
|
|
709
709
|
const t = document.createElement("div");
|
|
710
710
|
return t.appendChild(i), t.innerHTML;
|
|
711
|
-
},
|
|
711
|
+
}, kn = (i) => {
|
|
712
712
|
const t = document.createElement("div");
|
|
713
713
|
t.innerHTML = i.trim();
|
|
714
714
|
const e = document.createDocumentFragment();
|
|
715
715
|
return e.append(...Array.from(t.childNodes)), e;
|
|
716
|
-
},
|
|
716
|
+
}, xn = (i, t) => {
|
|
717
717
|
const e = document.createRange();
|
|
718
718
|
return e.selectNodeContents(i), e.setEnd(t.startContainer, t.startOffset), e.toString().length === 0;
|
|
719
|
-
},
|
|
719
|
+
}, Tn = (i, t) => {
|
|
720
720
|
const e = document.createRange();
|
|
721
721
|
e.selectNodeContents(i), e.setEnd(t.startContainer, t.startOffset);
|
|
722
722
|
const n = e.toString().length === 0, s = document.createRange();
|
|
723
723
|
s.selectNodeContents(i), s.setStart(t.endContainer, t.endOffset);
|
|
724
724
|
const o = s.toString().length === 0;
|
|
725
725
|
return n && o;
|
|
726
|
-
},
|
|
726
|
+
}, Rn = (i) => {
|
|
727
727
|
if (typeof i != "object" || i === null)
|
|
728
728
|
return !1;
|
|
729
729
|
const e = Object.entries(i).find(([n]) => n === "items");
|
|
730
730
|
return e === void 0 ? !1 : Array.isArray(e[1]);
|
|
731
|
-
}, Ln = (i) => typeof i == "object" && i !== null,
|
|
731
|
+
}, Ln = (i) => typeof i == "object" && i !== null, Bn = (i) => typeof i == "string" ? i : "", In = (i, t) => i === "unordered" || i === "ordered" || i === "checklist" ? i : t, Dn = (i) => !!i, Nn = (i, t) => typeof i == "number" ? i : t, Hn = (i, t) => {
|
|
732
732
|
const e = t.defaultStyle || "unordered";
|
|
733
733
|
if (!i || typeof i != "object")
|
|
734
734
|
return {
|
|
@@ -737,9 +737,9 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
|
|
|
737
737
|
checked: !1,
|
|
738
738
|
depth: 0
|
|
739
739
|
};
|
|
740
|
-
if (
|
|
740
|
+
if (Rn(i)) {
|
|
741
741
|
const n = i.items[0], s = (n == null ? void 0 : n.content) || "", o = (n == null ? void 0 : n.checked) || !1;
|
|
742
|
-
return
|
|
742
|
+
return x({
|
|
743
743
|
text: s,
|
|
744
744
|
style: i.style || e,
|
|
745
745
|
checked: !!o,
|
|
@@ -747,8 +747,8 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
|
|
|
747
747
|
}, i.start !== void 0 && i.start !== 1 ? { start: i.start } : {});
|
|
748
748
|
}
|
|
749
749
|
if (Ln(i)) {
|
|
750
|
-
const n =
|
|
751
|
-
return
|
|
750
|
+
const n = Bn(i.text), s = In(i.style, e), o = Dn(i.checked), r = Nn(i.depth, 0), l = i.start, a = typeof l == "number" && l !== void 0 && l !== 1 ? l : void 0;
|
|
751
|
+
return x({
|
|
752
752
|
text: n,
|
|
753
753
|
style: s,
|
|
754
754
|
checked: o,
|
|
@@ -819,7 +819,7 @@ class ce {
|
|
|
819
819
|
if (!t)
|
|
820
820
|
return 0;
|
|
821
821
|
const e = (o = (s = t.holder) == null ? void 0 : s.querySelector('[role="listitem"]')) == null ? void 0 : o.getAttribute("style"), n = e == null ? void 0 : e.match(/margin-left:\s*(\d+)px/);
|
|
822
|
-
return n ? Math.round(parseInt(n[1], 10) /
|
|
822
|
+
return n ? Math.round(parseInt(n[1], 10) / F) : 0;
|
|
823
823
|
}
|
|
824
824
|
}
|
|
825
825
|
const Pn = (i, t) => {
|
|
@@ -833,8 +833,8 @@ const Pn = (i, t) => {
|
|
|
833
833
|
}, _n = (i, t, e) => {
|
|
834
834
|
i && i.setAttribute("data-list-depth", String(e));
|
|
835
835
|
const n = i == null ? void 0 : i.querySelector('[role="listitem"]');
|
|
836
|
-
n instanceof HTMLElement && (n.style.marginLeft = e > 0 ? `${e *
|
|
837
|
-
}, de = (i, t) => t.getBlockDepth(i), he = (i, t) => t.getBlockStyle(i),
|
|
836
|
+
n instanceof HTMLElement && (n.style.marginLeft = e > 0 ? `${e * F}px` : ""), t.depth = e;
|
|
837
|
+
}, de = (i, t) => t.getBlockDepth(i), he = (i, t) => t.getBlockStyle(i), On = (i, t) => t.getBulletCharacter(i), Nt = (i, t, e, n, s) => {
|
|
838
838
|
var r;
|
|
839
839
|
const o = i && (r = n.getBlockIndex(i)) != null ? r : n.getCurrentBlockIndex();
|
|
840
840
|
return o <= 0 ? 0 : s.getSiblingIndex(o, t, e);
|
|
@@ -849,10 +849,10 @@ const Pn = (i, t) => {
|
|
|
849
849
|
n.style
|
|
850
850
|
);
|
|
851
851
|
return l === null ? 1 : o.getBlockStartValue(l);
|
|
852
|
-
},
|
|
852
|
+
}, Ht = (i, t, e, n, s, o) => {
|
|
853
853
|
const l = Mn(i, t, n, e, s, o) + i;
|
|
854
854
|
return o.formatNumber(l, t);
|
|
855
|
-
},
|
|
855
|
+
}, Wn = (i, t, e, n) => n.findGroupStart(i, t, e), ue = (i, t, e, n) => {
|
|
856
856
|
if (!i)
|
|
857
857
|
return;
|
|
858
858
|
const s = i.holder, o = s == null ? void 0 : s.querySelector('[data-list-style="ordered"]');
|
|
@@ -896,7 +896,7 @@ const Pn = (i, t) => {
|
|
|
896
896
|
const r = o.holder;
|
|
897
897
|
r != null && r.querySelector('[data-list-style="ordered"]') && ue(o, i, t, e);
|
|
898
898
|
});
|
|
899
|
-
},
|
|
899
|
+
}, j = (i, t, e = "end") => {
|
|
900
900
|
requestAnimationFrame(() => {
|
|
901
901
|
const n = t.holder;
|
|
902
902
|
if (!n) return;
|
|
@@ -911,7 +911,7 @@ const Pn = (i, t) => {
|
|
|
911
911
|
const r = document.createRange();
|
|
912
912
|
e === "start" ? (r.setStart(s, 0), r.collapse(!0)) : (r.selectNodeContents(s), r.collapse(!1)), o.removeAllRanges(), o.addRange(r), i.caret.updateLastCaretAfterPosition();
|
|
913
913
|
});
|
|
914
|
-
},
|
|
914
|
+
}, qn = async (i) => {
|
|
915
915
|
var f;
|
|
916
916
|
const { api: t, blockId: e, data: n, element: s, getContentElement: o } = i, r = window.getSelection();
|
|
917
917
|
if (!r || !s) return;
|
|
@@ -919,10 +919,10 @@ const Pn = (i, t) => {
|
|
|
919
919
|
if (!l) return;
|
|
920
920
|
const a = l.innerHTML.trim();
|
|
921
921
|
if (a === "" || a === "<br>") {
|
|
922
|
-
await
|
|
922
|
+
await Fn(i);
|
|
923
923
|
return;
|
|
924
924
|
}
|
|
925
|
-
const c = r.getRangeAt(0), { beforeContent: d, afterContent: h } =
|
|
925
|
+
const c = r.getRangeAt(0), { beforeContent: d, afterContent: h } = En(l, c), p = e && (f = t.blocks.getBlockIndex(e)) != null ? f : t.blocks.getCurrentBlockIndex();
|
|
926
926
|
if (!e) {
|
|
927
927
|
l.innerHTML = d, n.text = d;
|
|
928
928
|
const y = t.blocks.insert(w, {
|
|
@@ -931,7 +931,7 @@ const Pn = (i, t) => {
|
|
|
931
931
|
checked: !1,
|
|
932
932
|
depth: n.depth
|
|
933
933
|
}, void 0, p + 1, !0);
|
|
934
|
-
|
|
934
|
+
j(t, y, "start");
|
|
935
935
|
return;
|
|
936
936
|
}
|
|
937
937
|
const m = t.blocks.splitBlock(
|
|
@@ -946,8 +946,8 @@ const Pn = (i, t) => {
|
|
|
946
946
|
},
|
|
947
947
|
p + 1
|
|
948
948
|
);
|
|
949
|
-
n.text = d,
|
|
950
|
-
},
|
|
949
|
+
n.text = d, j(t, m, "start");
|
|
950
|
+
}, Fn = async (i) => {
|
|
951
951
|
const { api: t, blockId: e, getDepth: n } = i;
|
|
952
952
|
if (n() > 0) {
|
|
953
953
|
await pe(i);
|
|
@@ -956,28 +956,28 @@ const Pn = (i, t) => {
|
|
|
956
956
|
if (e === void 0)
|
|
957
957
|
return;
|
|
958
958
|
const o = await t.blocks.convert(e, "paragraph", { text: "" });
|
|
959
|
-
|
|
960
|
-
},
|
|
959
|
+
j(t, o, "start");
|
|
960
|
+
}, zn = async (i, t) => {
|
|
961
961
|
const { api: e, blockId: n, data: s, element: o, getContentElement: r, getDepth: l, syncContentFromDOM: a } = i, c = window.getSelection();
|
|
962
962
|
if (!c || !o) return;
|
|
963
963
|
const d = c.getRangeAt(0), h = r();
|
|
964
964
|
if (!h) return;
|
|
965
965
|
a();
|
|
966
966
|
const p = s.text, m = l();
|
|
967
|
-
if (
|
|
967
|
+
if (Tn(h, d) && !c.isCollapsed) {
|
|
968
968
|
t.preventDefault(), h.innerHTML = "", s.text = "";
|
|
969
969
|
const b = document.createRange();
|
|
970
970
|
b.setStart(h, 0), b.collapse(!0), c.removeAllRanges(), c.addRange(b);
|
|
971
971
|
return;
|
|
972
972
|
}
|
|
973
|
-
if (!
|
|
973
|
+
if (!xn(h, d) || (t.preventDefault(), n === void 0))
|
|
974
974
|
return;
|
|
975
975
|
const y = await e.blocks.convert(n, "paragraph", { text: p });
|
|
976
976
|
m > 0 && requestAnimationFrame(() => {
|
|
977
977
|
const b = y.holder;
|
|
978
|
-
b && (b.style.marginLeft = `${m *
|
|
979
|
-
}),
|
|
980
|
-
},
|
|
978
|
+
b && (b.style.marginLeft = `${m * F}px`, b.setAttribute("data-blok-depth", String(m)));
|
|
979
|
+
}), j(e, y, "start");
|
|
980
|
+
}, Vn = async (i, t) => {
|
|
981
981
|
const { api: e, blockId: n, data: s, syncContentFromDOM: o, getDepth: r } = i, l = e.blocks.getCurrentBlockIndex();
|
|
982
982
|
if (l === 0) return;
|
|
983
983
|
const a = e.blocks.getBlockByIndex(l - 1);
|
|
@@ -987,21 +987,21 @@ const Pn = (i, t) => {
|
|
|
987
987
|
o();
|
|
988
988
|
const h = c + 1;
|
|
989
989
|
s.depth = h;
|
|
990
|
-
const p = await e.blocks.update(n || "", tt(
|
|
990
|
+
const p = await e.blocks.update(n || "", tt(x({}, s), {
|
|
991
991
|
depth: h
|
|
992
992
|
}));
|
|
993
|
-
|
|
993
|
+
j(e, p);
|
|
994
994
|
}, pe = async (i) => {
|
|
995
995
|
const { api: t, blockId: e, data: n, syncContentFromDOM: s, getDepth: o } = i, r = o();
|
|
996
996
|
if (r === 0) return;
|
|
997
997
|
s();
|
|
998
998
|
const l = r - 1;
|
|
999
999
|
n.depth = l;
|
|
1000
|
-
const a = await t.blocks.update(e || "", tt(
|
|
1000
|
+
const a = await t.blocks.update(e || "", tt(x({}, n), {
|
|
1001
1001
|
depth: l
|
|
1002
1002
|
}));
|
|
1003
|
-
|
|
1004
|
-
},
|
|
1003
|
+
j(t, a);
|
|
1004
|
+
}, Un = (i) => {
|
|
1005
1005
|
const { data: t, readOnly: e, placeholder: n, itemColor: s, itemSize: o, setupItemPlaceholder: r, onCheckboxChange: l, keydownHandler: a } = i, c = ae({
|
|
1006
1006
|
data: t,
|
|
1007
1007
|
readOnly: e,
|
|
@@ -1017,14 +1017,14 @@ const Pn = (i, t) => {
|
|
|
1017
1017
|
});
|
|
1018
1018
|
}
|
|
1019
1019
|
return c.wrapper;
|
|
1020
|
-
},
|
|
1020
|
+
}, Kn = (i) => {
|
|
1021
1021
|
const t = (e) => {
|
|
1022
1022
|
if (e <= 0) return "";
|
|
1023
1023
|
const n = e - 1;
|
|
1024
1024
|
return t(Math.floor(n / 26)) + String.fromCharCode(97 + n % 26);
|
|
1025
1025
|
};
|
|
1026
1026
|
return t(i);
|
|
1027
|
-
},
|
|
1027
|
+
}, jn = (i) => {
|
|
1028
1028
|
const t = [
|
|
1029
1029
|
[1e3, "m"],
|
|
1030
1030
|
[900, "cm"],
|
|
@@ -1105,7 +1105,7 @@ class ge {
|
|
|
1105
1105
|
*/
|
|
1106
1106
|
formatNumber(t, e) {
|
|
1107
1107
|
const n = e % 3;
|
|
1108
|
-
return n === 1 ? `${
|
|
1108
|
+
return n === 1 ? `${Kn(t)}.` : n === 2 ? `${jn(t)}.` : `${t}.`;
|
|
1109
1109
|
}
|
|
1110
1110
|
/**
|
|
1111
1111
|
* Get the start value for a list group.
|
|
@@ -1158,7 +1158,7 @@ class ge {
|
|
|
1158
1158
|
if (!t)
|
|
1159
1159
|
return 0;
|
|
1160
1160
|
const e = (o = (s = t.holder) == null ? void 0 : s.querySelector('[role="listitem"]')) == null ? void 0 : o.getAttribute("style"), n = e == null ? void 0 : e.match(/margin-left:\s*(\d+)px/);
|
|
1161
|
-
return n ? Math.round(parseInt(n[1], 10) /
|
|
1161
|
+
return n ? Math.round(parseInt(n[1], 10) / F) : 0;
|
|
1162
1162
|
}
|
|
1163
1163
|
/**
|
|
1164
1164
|
* Get the style of a block by reading from its DOM.
|
|
@@ -1201,8 +1201,8 @@ class ge {
|
|
|
1201
1201
|
return r < n ? e : r > n ? this.findGroupStartRecursive(t - 1, e, n, s) : this.getBlockStyle(o) !== s ? e : this.findGroupStartRecursive(t - 1, t, n, s);
|
|
1202
1202
|
}
|
|
1203
1203
|
}
|
|
1204
|
-
const
|
|
1205
|
-
class
|
|
1204
|
+
const ut = { value: !1 };
|
|
1205
|
+
class Xn {
|
|
1206
1206
|
constructor(t) {
|
|
1207
1207
|
this.blocks = t, this.depthValidator = new ce(t), this.markerCalculator = new ge(t);
|
|
1208
1208
|
}
|
|
@@ -1256,8 +1256,8 @@ class jn {
|
|
|
1256
1256
|
* Uses a static flag to deduplicate multiple calls in the same frame.
|
|
1257
1257
|
*/
|
|
1258
1258
|
scheduleUpdateAll() {
|
|
1259
|
-
|
|
1260
|
-
|
|
1259
|
+
ut.value || (ut.value = !0, requestAnimationFrame(() => {
|
|
1260
|
+
ut.value = !1, this.updateAllMarkers();
|
|
1261
1261
|
}));
|
|
1262
1262
|
}
|
|
1263
1263
|
/**
|
|
@@ -1319,7 +1319,7 @@ class jn {
|
|
|
1319
1319
|
s.textContent = p;
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
|
-
const
|
|
1322
|
+
const Yn = (i) => i instanceof HTMLElement, Zn = /* @__PURE__ */ new Set([
|
|
1323
1323
|
"decimal",
|
|
1324
1324
|
"decimal-leading-zero",
|
|
1325
1325
|
"lower-roman",
|
|
@@ -1350,12 +1350,12 @@ const Xn = (i) => i instanceof HTMLElement, Yn = /* @__PURE__ */ new Set([
|
|
|
1350
1350
|
"telugu",
|
|
1351
1351
|
"thai",
|
|
1352
1352
|
"tibetan"
|
|
1353
|
-
]),
|
|
1353
|
+
]), Jn = /* @__PURE__ */ new Set([
|
|
1354
1354
|
"disc",
|
|
1355
1355
|
"circle",
|
|
1356
1356
|
"square",
|
|
1357
1357
|
"none"
|
|
1358
|
-
]),
|
|
1358
|
+
]), Qn = (i) => {
|
|
1359
1359
|
const t = i.getAttribute("data-list-style");
|
|
1360
1360
|
if (t === "ordered") return "ordered";
|
|
1361
1361
|
if (t === "unordered") return "unordered";
|
|
@@ -1364,25 +1364,25 @@ const Xn = (i) => i instanceof HTMLElement, Yn = /* @__PURE__ */ new Set([
|
|
|
1364
1364
|
const n = e.match(/list-style-type\s*:\s*([^;]+)/);
|
|
1365
1365
|
if (!n) return null;
|
|
1366
1366
|
const s = n[1].trim().toLowerCase();
|
|
1367
|
-
return
|
|
1368
|
-
},
|
|
1367
|
+
return Zn.has(s) ? "ordered" : Jn.has(s) ? "unordered" : null;
|
|
1368
|
+
}, ts = (i, t) => {
|
|
1369
1369
|
const e = i.parentElement;
|
|
1370
1370
|
if ((e == null ? void 0 : e.tagName) === "OL") return "ordered";
|
|
1371
1371
|
if ((e == null ? void 0 : e.tagName) === "UL")
|
|
1372
1372
|
return i.querySelector('input[type="checkbox"]') ? "checklist" : "unordered";
|
|
1373
|
-
const n =
|
|
1373
|
+
const n = Qn(i);
|
|
1374
1374
|
return n || t;
|
|
1375
|
-
},
|
|
1375
|
+
}, es = (i) => {
|
|
1376
1376
|
const t = i.innerHTML || i.textContent || "", e = i.querySelector('input[type="checkbox"]'), n = e instanceof HTMLInputElement ? e.checked : !1;
|
|
1377
1377
|
return { text: t, checked: n };
|
|
1378
|
-
},
|
|
1378
|
+
}, ns = (i) => {
|
|
1379
1379
|
const t = i.getAttribute("aria-level");
|
|
1380
1380
|
if (t) {
|
|
1381
1381
|
const e = parseInt(t, 10);
|
|
1382
1382
|
return Math.max(0, e - 1);
|
|
1383
1383
|
}
|
|
1384
1384
|
return 0;
|
|
1385
|
-
},
|
|
1385
|
+
}, ss = () => ({
|
|
1386
1386
|
text: {
|
|
1387
1387
|
br: !0,
|
|
1388
1388
|
a: {
|
|
@@ -1394,7 +1394,7 @@ const Xn = (i) => i instanceof HTMLElement, Yn = /* @__PURE__ */ new Set([
|
|
|
1394
1394
|
i: !0,
|
|
1395
1395
|
mark: !0
|
|
1396
1396
|
}
|
|
1397
|
-
}),
|
|
1397
|
+
}), os = () => ({
|
|
1398
1398
|
tags: [
|
|
1399
1399
|
{
|
|
1400
1400
|
li: {
|
|
@@ -1405,7 +1405,7 @@ const Xn = (i) => i instanceof HTMLElement, Yn = /* @__PURE__ */ new Set([
|
|
|
1405
1405
|
}
|
|
1406
1406
|
}
|
|
1407
1407
|
]
|
|
1408
|
-
}),
|
|
1408
|
+
}), is = () => ({
|
|
1409
1409
|
export: (i) => i.text,
|
|
1410
1410
|
import: (i) => ({
|
|
1411
1411
|
text: i,
|
|
@@ -1417,23 +1417,23 @@ const Xn = (i) => i instanceof HTMLElement, Yn = /* @__PURE__ */ new Set([
|
|
|
1417
1417
|
name: "bulletedList",
|
|
1418
1418
|
titleKey: "bulletedList",
|
|
1419
1419
|
style: "unordered",
|
|
1420
|
-
icon:
|
|
1420
|
+
icon: Qt
|
|
1421
1421
|
},
|
|
1422
1422
|
{
|
|
1423
1423
|
name: "numberedList",
|
|
1424
1424
|
titleKey: "numberedList",
|
|
1425
1425
|
style: "ordered",
|
|
1426
|
-
icon:
|
|
1426
|
+
icon: te
|
|
1427
1427
|
},
|
|
1428
1428
|
{
|
|
1429
1429
|
name: "todoList",
|
|
1430
1430
|
titleKey: "todoList",
|
|
1431
1431
|
style: "checklist",
|
|
1432
|
-
icon:
|
|
1432
|
+
icon: ee
|
|
1433
1433
|
}
|
|
1434
|
-
],
|
|
1434
|
+
], rs = () => [
|
|
1435
1435
|
{
|
|
1436
|
-
icon:
|
|
1436
|
+
icon: Qt,
|
|
1437
1437
|
title: "Bulleted list",
|
|
1438
1438
|
titleKey: "bulletedList",
|
|
1439
1439
|
data: { style: "unordered" },
|
|
@@ -1442,7 +1442,7 @@ const Xn = (i) => i instanceof HTMLElement, Yn = /* @__PURE__ */ new Set([
|
|
|
1442
1442
|
shortcut: "-"
|
|
1443
1443
|
},
|
|
1444
1444
|
{
|
|
1445
|
-
icon:
|
|
1445
|
+
icon: te,
|
|
1446
1446
|
title: "Numbered list",
|
|
1447
1447
|
titleKey: "numberedList",
|
|
1448
1448
|
data: { style: "ordered" },
|
|
@@ -1451,7 +1451,7 @@ const Xn = (i) => i instanceof HTMLElement, Yn = /* @__PURE__ */ new Set([
|
|
|
1451
1451
|
shortcut: "1."
|
|
1452
1452
|
},
|
|
1453
1453
|
{
|
|
1454
|
-
icon:
|
|
1454
|
+
icon: ee,
|
|
1455
1455
|
title: "To-do list",
|
|
1456
1456
|
titleKey: "todoList",
|
|
1457
1457
|
data: { style: "checklist" },
|
|
@@ -1460,18 +1460,18 @@ const Xn = (i) => i instanceof HTMLElement, Yn = /* @__PURE__ */ new Set([
|
|
|
1460
1460
|
shortcut: "[]"
|
|
1461
1461
|
}
|
|
1462
1462
|
];
|
|
1463
|
-
class
|
|
1463
|
+
class vo {
|
|
1464
1464
|
constructor({ data: t, config: e, api: n, readOnly: s, block: o }) {
|
|
1465
1465
|
this._element = null, this.handleBlockChanged = (r) => {
|
|
1466
1466
|
var l;
|
|
1467
1467
|
this.isBlockChangedEventPayload(r) && (r.event.type === "block-removed" || r.event.type === "block-added") && ((l = this.markerManager) == null || l.scheduleUpdateAll());
|
|
1468
|
-
}, this.api = n, this.readOnly = s, this._settings = e || {}, this._data = this.normalizeData(t), this.depthValidator = new ce(n.blocks), this.markerCalculator = new ge(n.blocks), this.markerManager = this._data.style === "ordered" ? new
|
|
1468
|
+
}, this.api = n, this.readOnly = s, this._settings = e || {}, this._data = this.normalizeData(t), this.depthValidator = new ce(n.blocks), this.markerCalculator = new ge(n.blocks), this.markerManager = this._data.style === "ordered" ? new Xn(n.blocks) : null, o && (this.blockId = o.id), this._data.style === "ordered" && this.api.events.on("block changed", this.handleBlockChanged);
|
|
1469
1469
|
}
|
|
1470
1470
|
isBlockChangedEventPayload(t) {
|
|
1471
1471
|
return typeof t == "object" && t !== null && "event" in t && typeof t.event == "object" && t.event !== null && "type" in t.event && typeof t.event.type == "string";
|
|
1472
1472
|
}
|
|
1473
1473
|
normalizeData(t) {
|
|
1474
|
-
return
|
|
1474
|
+
return Hn(t, this._settings);
|
|
1475
1475
|
}
|
|
1476
1476
|
get availableStyles() {
|
|
1477
1477
|
const t = this._settings.styles;
|
|
@@ -1484,13 +1484,13 @@ class ao {
|
|
|
1484
1484
|
return this._settings.itemSize;
|
|
1485
1485
|
}
|
|
1486
1486
|
get placeholder() {
|
|
1487
|
-
return this.api.i18n.t(
|
|
1487
|
+
return this.api.i18n.t(dn);
|
|
1488
1488
|
}
|
|
1489
1489
|
setupItemPlaceholder(t) {
|
|
1490
|
-
this.readOnly ||
|
|
1490
|
+
this.readOnly || Et(t, this.placeholder);
|
|
1491
1491
|
}
|
|
1492
1492
|
render() {
|
|
1493
|
-
return this._element =
|
|
1493
|
+
return this._element = Un({
|
|
1494
1494
|
data: this._data,
|
|
1495
1495
|
readOnly: this.readOnly,
|
|
1496
1496
|
placeholder: this.placeholder,
|
|
@@ -1535,12 +1535,12 @@ class ao {
|
|
|
1535
1535
|
const t = (o = this._element) == null ? void 0 : o.querySelector("[data-list-marker]");
|
|
1536
1536
|
if (!t)
|
|
1537
1537
|
return;
|
|
1538
|
-
const e = this.getDepth(), n =
|
|
1538
|
+
const e = this.getDepth(), n = Nt(this.blockId, e, this._data.style, this.api.blocks, this.markerCalculator), s = Ht(n, e, this._data, this.blockId, this.api.blocks, this.markerCalculator);
|
|
1539
1539
|
t.textContent = s;
|
|
1540
1540
|
}
|
|
1541
1541
|
updateSiblingListMarkers() {
|
|
1542
1542
|
var r;
|
|
1543
|
-
const t = this.blockId ? (r = this.api.blocks.getBlockIndex(this.blockId)) != null ? r : this.api.blocks.getCurrentBlockIndex() : this.api.blocks.getCurrentBlockIndex(), e = this.getDepth(), n = this._data.style, s = this.api.blocks.getBlocksCount(), o =
|
|
1543
|
+
const t = this.blockId ? (r = this.api.blocks.getBlockIndex(this.blockId)) != null ? r : this.api.blocks.getCurrentBlockIndex() : this.api.blocks.getCurrentBlockIndex(), e = this.getDepth(), n = this._data.style, s = this.api.blocks.getBlocksCount(), o = Wn(t, e, n, this.markerCalculator);
|
|
1544
1544
|
$n(o, s, t, e, n, this.api.blocks, this.depthValidator, this.markerCalculator);
|
|
1545
1545
|
}
|
|
1546
1546
|
updateMarkerForDepth(t, e) {
|
|
@@ -1548,10 +1548,10 @@ class ao {
|
|
|
1548
1548
|
const n = (s = this._element) == null ? void 0 : s.querySelector('[aria-hidden="true"]');
|
|
1549
1549
|
if (n instanceof HTMLElement)
|
|
1550
1550
|
if (e === "ordered") {
|
|
1551
|
-
const o =
|
|
1551
|
+
const o = Nt(this.blockId, t, this._data.style, this.api.blocks, this.markerCalculator), r = Ht(o, t, this._data, this.blockId, this.api.blocks, this.markerCalculator);
|
|
1552
1552
|
n.textContent = r;
|
|
1553
1553
|
} else {
|
|
1554
|
-
const o =
|
|
1554
|
+
const o = On(t, this.markerCalculator);
|
|
1555
1555
|
n.textContent = o;
|
|
1556
1556
|
}
|
|
1557
1557
|
}
|
|
@@ -1591,7 +1591,7 @@ class ao {
|
|
|
1591
1591
|
syncContentFromDOM: this.syncContentFromDOM.bind(this),
|
|
1592
1592
|
getDepth: this.getDepth.bind(this)
|
|
1593
1593
|
};
|
|
1594
|
-
await
|
|
1594
|
+
await qn(t);
|
|
1595
1595
|
}
|
|
1596
1596
|
async handleBackspace(t) {
|
|
1597
1597
|
const e = {
|
|
@@ -1603,7 +1603,7 @@ class ao {
|
|
|
1603
1603
|
syncContentFromDOM: this.syncContentFromDOM.bind(this),
|
|
1604
1604
|
getDepth: this.getDepth.bind(this)
|
|
1605
1605
|
};
|
|
1606
|
-
await
|
|
1606
|
+
await zn(e, t);
|
|
1607
1607
|
}
|
|
1608
1608
|
async handleIndent() {
|
|
1609
1609
|
const t = {
|
|
@@ -1615,7 +1615,7 @@ class ao {
|
|
|
1615
1615
|
syncContentFromDOM: this.syncContentFromDOM.bind(this),
|
|
1616
1616
|
getDepth: this.getDepth.bind(this)
|
|
1617
1617
|
};
|
|
1618
|
-
await
|
|
1618
|
+
await Vn(t, this.depthValidator);
|
|
1619
1619
|
}
|
|
1620
1620
|
async handleOutdent() {
|
|
1621
1621
|
const t = {
|
|
@@ -1641,7 +1641,7 @@ class ao {
|
|
|
1641
1641
|
return Pn(this._element, this._data.style);
|
|
1642
1642
|
}
|
|
1643
1643
|
renderSettings() {
|
|
1644
|
-
return
|
|
1644
|
+
return vn(this.availableStyles, this._data.style, this.api.i18n.t, (t) => this.setStyle(t));
|
|
1645
1645
|
}
|
|
1646
1646
|
setStyle(t) {
|
|
1647
1647
|
const e = this._data.style;
|
|
@@ -1650,7 +1650,7 @@ class ao {
|
|
|
1650
1650
|
});
|
|
1651
1651
|
}
|
|
1652
1652
|
rerender() {
|
|
1653
|
-
const t =
|
|
1653
|
+
const t = mn({
|
|
1654
1654
|
data: this._data,
|
|
1655
1655
|
readOnly: this.readOnly,
|
|
1656
1656
|
placeholder: this.placeholder,
|
|
@@ -1669,10 +1669,10 @@ class ao {
|
|
|
1669
1669
|
return typeof t.text == "string";
|
|
1670
1670
|
}
|
|
1671
1671
|
save() {
|
|
1672
|
-
return
|
|
1672
|
+
return Cn(this._data, this._element, this.getContentElement.bind(this));
|
|
1673
1673
|
}
|
|
1674
1674
|
setData(t) {
|
|
1675
|
-
const e =
|
|
1675
|
+
const e = yn(
|
|
1676
1676
|
this._data,
|
|
1677
1677
|
t,
|
|
1678
1678
|
this._element,
|
|
@@ -1686,35 +1686,35 @@ class ao {
|
|
|
1686
1686
|
return this._data = e.newData, e.inPlace;
|
|
1687
1687
|
}
|
|
1688
1688
|
merge(t) {
|
|
1689
|
-
|
|
1689
|
+
bn(
|
|
1690
1690
|
{
|
|
1691
1691
|
data: this._data,
|
|
1692
1692
|
element: this._element,
|
|
1693
1693
|
getContentElement: this.getContentElement.bind(this),
|
|
1694
|
-
parseHTML:
|
|
1694
|
+
parseHTML: kn
|
|
1695
1695
|
},
|
|
1696
1696
|
t
|
|
1697
1697
|
);
|
|
1698
1698
|
}
|
|
1699
1699
|
static get conversionConfig() {
|
|
1700
|
-
return
|
|
1700
|
+
return is();
|
|
1701
1701
|
}
|
|
1702
1702
|
static get sanitize() {
|
|
1703
|
-
return
|
|
1703
|
+
return ss();
|
|
1704
1704
|
}
|
|
1705
1705
|
static get pasteConfig() {
|
|
1706
|
-
return
|
|
1706
|
+
return os();
|
|
1707
1707
|
}
|
|
1708
1708
|
onPaste(t) {
|
|
1709
1709
|
const e = t.detail;
|
|
1710
1710
|
if (!("data" in e)) return;
|
|
1711
1711
|
const n = e.data;
|
|
1712
|
-
if (!
|
|
1712
|
+
if (!Yn(n))
|
|
1713
1713
|
return;
|
|
1714
|
-
const { text: s, checked: o } =
|
|
1714
|
+
const { text: s, checked: o } = es(n), r = ns(n);
|
|
1715
1715
|
this._data = {
|
|
1716
1716
|
text: s,
|
|
1717
|
-
style:
|
|
1717
|
+
style: ts(n, this._data.style),
|
|
1718
1718
|
checked: o,
|
|
1719
1719
|
depth: r
|
|
1720
1720
|
}, this.rerender();
|
|
@@ -1723,19 +1723,19 @@ class ao {
|
|
|
1723
1723
|
return !0;
|
|
1724
1724
|
}
|
|
1725
1725
|
getContentOffset(t) {
|
|
1726
|
-
return
|
|
1726
|
+
return An(t);
|
|
1727
1727
|
}
|
|
1728
1728
|
static get toolbox() {
|
|
1729
|
-
return
|
|
1729
|
+
return rs();
|
|
1730
1730
|
}
|
|
1731
1731
|
}
|
|
1732
|
-
const
|
|
1732
|
+
const ls = "data-blok-table-add-row", as = "data-blok-table-add-col", _t = 150, cs = 5, Ot = 40, Mt = [
|
|
1733
1733
|
"flex",
|
|
1734
1734
|
"items-center",
|
|
1735
1735
|
"justify-center",
|
|
1736
1736
|
"transition-opacity",
|
|
1737
1737
|
"duration-150"
|
|
1738
|
-
],
|
|
1738
|
+
], Wt = [
|
|
1739
1739
|
"flex",
|
|
1740
1740
|
"items-center",
|
|
1741
1741
|
"justify-center",
|
|
@@ -1744,9 +1744,9 @@ const rs = "data-blok-table-add-row", ls = "data-blok-table-add-col", _t = 150,
|
|
|
1744
1744
|
"rounded-full",
|
|
1745
1745
|
"group-hover/add:bg-gray-50"
|
|
1746
1746
|
], $t = "12";
|
|
1747
|
-
class
|
|
1747
|
+
class ds {
|
|
1748
1748
|
constructor(t) {
|
|
1749
|
-
this.rowHideTimeout = null, this.colHideTimeout = null, this.rowVisible = !1, this.colVisible = !1, this.dragState = null, this.wrapper = t.wrapper, this.grid = t.grid, this.boundAddRowClick = t.onAddRow, this.boundAddColClick = t.onAddColumn, this.onDragStart = t.onDragStart, this.onDragAddRow = t.onDragAddRow, this.onDragRemoveRow = t.onDragRemoveRow, this.onDragAddCol = t.onDragAddCol, this.onDragRemoveCol = t.onDragRemoveCol, this.onDragEnd = t.onDragEnd, this.boundMouseMove = this.handleMouseMove.bind(this), this.boundMouseLeave = this.handleMouseLeave.bind(this), this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundRowPointerDown = (e) => this.handlePointerDown("row", e), this.boundColPointerDown = (e) => this.handlePointerDown("col", e), this.addRowBtn = this.createAddRowButton(), this.addColBtn = this.createAddColumnButton(), this.wrapper.appendChild(this.addRowBtn), this.grid.appendChild(this.addColBtn), this.syncRowButtonWidth(), this.wrapper.addEventListener("mousemove", this.boundMouseMove), this.wrapper.addEventListener("mouseleave", this.boundMouseLeave), this.addRowBtn.addEventListener("pointerdown", this.boundRowPointerDown), this.addColBtn.addEventListener("pointerdown", this.boundColPointerDown);
|
|
1749
|
+
this.rowHideTimeout = null, this.colHideTimeout = null, this.rowVisible = !1, this.colVisible = !1, this.dragState = null, this.wrapper = t.wrapper, this.grid = t.grid, this.i18n = t.i18n, this.boundAddRowClick = t.onAddRow, this.boundAddColClick = t.onAddColumn, this.onDragStart = t.onDragStart, this.onDragAddRow = t.onDragAddRow, this.onDragRemoveRow = t.onDragRemoveRow, this.onDragAddCol = t.onDragAddCol, this.onDragRemoveCol = t.onDragRemoveCol, this.onDragEnd = t.onDragEnd, this.boundMouseMove = this.handleMouseMove.bind(this), this.boundMouseLeave = this.handleMouseLeave.bind(this), this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundRowPointerDown = (e) => this.handlePointerDown("row", e), this.boundColPointerDown = (e) => this.handlePointerDown("col", e), this.addRowBtn = this.createAddRowButton(), this.addColBtn = this.createAddColumnButton(), this.wrapper.appendChild(this.addRowBtn), this.grid.appendChild(this.addColBtn), this.syncRowButtonWidth(), this.wrapper.addEventListener("mousemove", this.boundMouseMove), this.wrapper.addEventListener("mouseleave", this.boundMouseLeave), this.addRowBtn.addEventListener("pointerdown", this.boundRowPointerDown), this.addColBtn.addEventListener("pointerdown", this.boundColPointerDown);
|
|
1750
1750
|
}
|
|
1751
1751
|
/**
|
|
1752
1752
|
* Match the add-row button width to the grid's explicit width.
|
|
@@ -1771,8 +1771,11 @@ class cs {
|
|
|
1771
1771
|
* Disables pointer events and hover effects during cell selection.
|
|
1772
1772
|
*/
|
|
1773
1773
|
setInteractive(t) {
|
|
1774
|
-
|
|
1775
|
-
|
|
1774
|
+
if (!t) {
|
|
1775
|
+
this.addRowBtn.style.pointerEvents = "none", this.addColBtn.style.pointerEvents = "none";
|
|
1776
|
+
return;
|
|
1777
|
+
}
|
|
1778
|
+
this.addRowBtn.style.pointerEvents = this.rowVisible ? "" : "none", this.addColBtn.style.pointerEvents = this.colVisible ? "" : "none";
|
|
1776
1779
|
}
|
|
1777
1780
|
destroy() {
|
|
1778
1781
|
if (this.wrapper.removeEventListener("mousemove", this.boundMouseMove), this.wrapper.removeEventListener("mouseleave", this.boundMouseLeave), this.addRowBtn.removeEventListener("pointerdown", this.boundRowPointerDown), this.addColBtn.removeEventListener("pointerdown", this.boundColPointerDown), this.dragState) {
|
|
@@ -1803,7 +1806,7 @@ class cs {
|
|
|
1803
1806
|
e === "row" ? this.onDragAddRow() : this.onDragAddCol(), this.dragState.addedCount++;
|
|
1804
1807
|
for (; this.dragState.addedCount > l; )
|
|
1805
1808
|
e === "row" ? this.onDragRemoveRow() : this.onDragRemoveCol(), this.dragState.addedCount--;
|
|
1806
|
-
Math.abs(r) >
|
|
1809
|
+
Math.abs(r) > cs && !this.dragState.didDrag && (this.dragState.didDrag = !0, document.body.style.cursor = e === "row" ? "row-resize" : "col-resize", We(), this.onDragStart());
|
|
1807
1810
|
}
|
|
1808
1811
|
handlePointerUp(t) {
|
|
1809
1812
|
if (!this.dragState)
|
|
@@ -1828,27 +1831,27 @@ class cs {
|
|
|
1828
1831
|
}
|
|
1829
1832
|
handleMouseMove(t) {
|
|
1830
1833
|
const e = this.grid.getBoundingClientRect(), n = Math.abs(t.clientY - e.bottom), s = Math.abs(t.clientX - e.right);
|
|
1831
|
-
n <=
|
|
1834
|
+
n <= Ot ? this.showRow() : this.scheduleHideRow(), s <= Ot ? this.showCol() : this.scheduleHideCol();
|
|
1832
1835
|
}
|
|
1833
1836
|
handleMouseLeave() {
|
|
1834
1837
|
this.scheduleHideRow(), this.scheduleHideCol();
|
|
1835
1838
|
}
|
|
1836
1839
|
showRow() {
|
|
1837
|
-
this.clearRowTimeout(), this.rowVisible || (this.addRowBtn.style.opacity = "1", this.rowVisible = !0);
|
|
1840
|
+
this.clearRowTimeout(), this.rowVisible || (this.addRowBtn.style.opacity = "1", this.addRowBtn.style.pointerEvents = "", this.rowVisible = !0);
|
|
1838
1841
|
}
|
|
1839
1842
|
showCol() {
|
|
1840
|
-
this.clearColTimeout(), this.colVisible || (this.addColBtn.style.opacity = "1", this.colVisible = !0);
|
|
1843
|
+
this.clearColTimeout(), this.colVisible || (this.addColBtn.style.opacity = "1", this.addColBtn.style.pointerEvents = "", this.colVisible = !0);
|
|
1841
1844
|
}
|
|
1842
1845
|
scheduleHideRow() {
|
|
1843
1846
|
var t;
|
|
1844
1847
|
!this.rowVisible || this.rowHideTimeout !== null || ((t = this.dragState) == null ? void 0 : t.axis) === "row" || (this.rowHideTimeout = setTimeout(() => {
|
|
1845
|
-
this.addRowBtn.style.opacity = "0", this.rowVisible = !1, this.rowHideTimeout = null;
|
|
1848
|
+
this.addRowBtn.style.opacity = "0", this.addRowBtn.style.pointerEvents = "none", this.rowVisible = !1, this.rowHideTimeout = null;
|
|
1846
1849
|
}, _t));
|
|
1847
1850
|
}
|
|
1848
1851
|
scheduleHideCol() {
|
|
1849
1852
|
var t;
|
|
1850
1853
|
!this.colVisible || this.colHideTimeout !== null || ((t = this.dragState) == null ? void 0 : t.axis) === "col" || (this.colHideTimeout = setTimeout(() => {
|
|
1851
|
-
this.addColBtn.style.opacity = "0", this.colVisible = !1, this.colHideTimeout = null;
|
|
1854
|
+
this.addColBtn.style.opacity = "0", this.addColBtn.style.pointerEvents = "none", this.colVisible = !1, this.colHideTimeout = null;
|
|
1852
1855
|
}, _t));
|
|
1853
1856
|
}
|
|
1854
1857
|
clearRowTimeout() {
|
|
@@ -1859,20 +1862,20 @@ class cs {
|
|
|
1859
1862
|
}
|
|
1860
1863
|
createAddRowButton() {
|
|
1861
1864
|
const t = document.createElement("div");
|
|
1862
|
-
t.className = v(Mt, "group/add", "items-start", "cursor-row-resize"), t.setAttribute(
|
|
1865
|
+
t.className = v(Mt, "group/add", "items-start", "cursor-row-resize"), t.setAttribute(ls, ""), t.setAttribute("contenteditable", "false"), t.style.opacity = "0", t.style.pointerEvents = "none", t.style.position = "absolute", t.style.left = "0", t.style.bottom = "-36px", t.style.boxSizing = "content-box", t.style.width = "100%", t.style.height = "32px", t.style.padding = "4px 8px 0", t.style.marginLeft = "-8px";
|
|
1863
1866
|
const e = document.createElement("div");
|
|
1864
|
-
return e.className = v(
|
|
1865
|
-
"
|
|
1866
|
-
"
|
|
1867
|
+
return e.className = v(Wt), e.style.width = "100%", e.style.height = "16px", this.appendIcon(e), t.appendChild(e), Rt(t, Lt([
|
|
1868
|
+
this.i18n.t("tools.table.clickToAddRow"),
|
|
1869
|
+
this.i18n.t("tools.table.dragToAddRemoveRows")
|
|
1867
1870
|
]), { placement: "bottom", marginTop: -16 }), t;
|
|
1868
1871
|
}
|
|
1869
1872
|
createAddColumnButton() {
|
|
1870
1873
|
const t = document.createElement("div");
|
|
1871
|
-
t.className = v(Mt, "group/add", "justify-start", "cursor-col-resize"), t.setAttribute(
|
|
1874
|
+
t.className = v(Mt, "group/add", "justify-start", "cursor-col-resize"), t.setAttribute(as, ""), t.setAttribute("contenteditable", "false"), t.style.opacity = "0", t.style.pointerEvents = "none", t.style.position = "absolute", t.style.right = "-36px", t.style.top = "0px", t.style.bottom = "0px", t.style.width = "32px";
|
|
1872
1875
|
const e = document.createElement("div");
|
|
1873
|
-
return e.className = v(
|
|
1874
|
-
"
|
|
1875
|
-
"
|
|
1876
|
+
return e.className = v(Wt), e.style.width = "16px", e.style.height = "100%", this.appendIcon(e), t.appendChild(e), Rt(t, Lt([
|
|
1877
|
+
this.i18n.t("tools.table.clickToAddColumn"),
|
|
1878
|
+
this.i18n.t("tools.table.dragToAddRemoveColumns")
|
|
1876
1879
|
]), { placement: "bottom" }), t;
|
|
1877
1880
|
}
|
|
1878
1881
|
appendIcon(t) {
|
|
@@ -1881,20 +1884,21 @@ class cs {
|
|
|
1881
1884
|
e && (e.setAttribute("width", $t), e.setAttribute("height", $t), e.setAttribute("viewBox", "0 0 24 24"), e.classList.add("text-gray-500", "pointer-events-none"));
|
|
1882
1885
|
}
|
|
1883
1886
|
}
|
|
1884
|
-
const g = "data-blok-table-row", u = "data-blok-table-cell",
|
|
1887
|
+
const g = "data-blok-table-row", u = "data-blok-table-cell", P = 1, nt = `${P}px solid #d1d5db`, hs = [
|
|
1885
1888
|
"flex"
|
|
1886
|
-
],
|
|
1889
|
+
], us = [
|
|
1887
1890
|
"py-1",
|
|
1888
1891
|
"px-2",
|
|
1889
1892
|
"min-h-[2em]",
|
|
1890
1893
|
"outline-none",
|
|
1891
1894
|
"leading-normal",
|
|
1892
|
-
"text-sm"
|
|
1893
|
-
|
|
1895
|
+
"text-sm",
|
|
1896
|
+
"cursor-text"
|
|
1897
|
+
], ps = (i) => {
|
|
1894
1898
|
const t = Math.round(100 / i * 100) / 100;
|
|
1895
1899
|
return Array.from({ length: i }, () => t);
|
|
1896
1900
|
};
|
|
1897
|
-
class
|
|
1901
|
+
class gs {
|
|
1898
1902
|
constructor(t) {
|
|
1899
1903
|
this.readOnly = t.readOnly;
|
|
1900
1904
|
}
|
|
@@ -1904,7 +1908,7 @@ class ps {
|
|
|
1904
1908
|
createGrid(t, e, n) {
|
|
1905
1909
|
const s = document.createElement("div");
|
|
1906
1910
|
s.style.borderTop = nt, s.style.borderLeft = nt;
|
|
1907
|
-
const o = n != null ? n :
|
|
1911
|
+
const o = n != null ? n : ps(e);
|
|
1908
1912
|
return Array.from({ length: t }).forEach(() => {
|
|
1909
1913
|
s.appendChild(this.createRow(e, o));
|
|
1910
1914
|
}), s;
|
|
@@ -1950,9 +1954,9 @@ class ps {
|
|
|
1950
1954
|
* those widths and the new column is added in px mode. This prevents
|
|
1951
1955
|
* existing columns from shrinking when the table is in percent mode.
|
|
1952
1956
|
*/
|
|
1953
|
-
addColumn(t, e, n) {
|
|
1954
|
-
const
|
|
1955
|
-
return
|
|
1957
|
+
addColumn(t, e, n, s) {
|
|
1958
|
+
const o = t.querySelectorAll(`[${g}]`), r = this.getColumnCount(t), l = n !== void 0 && n.length === r, a = l || this.detectWidthUnit(t) === "px";
|
|
1959
|
+
return l && this.convertToPixelWidths(o, n), a ? (this.addColumnPx(o, r, e, s), !0) : (this.addColumnPercent(o, r, e), !0);
|
|
1956
1960
|
}
|
|
1957
1961
|
/**
|
|
1958
1962
|
* Convert all cells in each row to the given pixel widths
|
|
@@ -1968,22 +1972,26 @@ class ps {
|
|
|
1968
1972
|
});
|
|
1969
1973
|
}
|
|
1970
1974
|
/**
|
|
1971
|
-
* Add column in px mode: keep existing widths, add new column at half the average
|
|
1975
|
+
* Add column in px mode: keep existing widths, add new column at given width or half the average
|
|
1972
1976
|
*/
|
|
1973
|
-
addColumnPx(t, e, n) {
|
|
1974
|
-
const
|
|
1975
|
-
|
|
1976
|
-
0
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
const c = a.querySelectorAll(`[${u}]`), d = n === void 0 || n >= c.length, h = this.createCell(`${l}px`);
|
|
1980
|
-
if (!d) {
|
|
1981
|
-
a.insertBefore(h, c[n]);
|
|
1977
|
+
addColumnPx(t, e, n, s) {
|
|
1978
|
+
const o = s != null ? s : this.computeHalfAvgPxWidth(t, e);
|
|
1979
|
+
t.forEach((r) => {
|
|
1980
|
+
const l = r.querySelectorAll(`[${u}]`), a = n === void 0 || n >= l.length, c = this.createCell(`${o}px`);
|
|
1981
|
+
if (!a) {
|
|
1982
|
+
r.insertBefore(c, l[n]);
|
|
1982
1983
|
return;
|
|
1983
1984
|
}
|
|
1984
|
-
|
|
1985
|
+
r.appendChild(c);
|
|
1985
1986
|
});
|
|
1986
1987
|
}
|
|
1988
|
+
computeHalfAvgPxWidth(t, e) {
|
|
1989
|
+
const n = t[0], s = n == null ? void 0 : n.querySelectorAll(`[${u}]`), o = Array.from(s != null ? s : []).reduce(
|
|
1990
|
+
(r, l) => r + (parseFloat(l.style.width) || 0),
|
|
1991
|
+
0
|
|
1992
|
+
);
|
|
1993
|
+
return e > 0 ? Math.round(o / e / 2 * 100) / 100 : 0;
|
|
1994
|
+
}
|
|
1987
1995
|
/**
|
|
1988
1996
|
* Add column in % mode: shrink existing columns slightly and add new column at half the average width
|
|
1989
1997
|
*/
|
|
@@ -2083,7 +2091,7 @@ class ps {
|
|
|
2083
2091
|
* Get cell content as block references
|
|
2084
2092
|
*/
|
|
2085
2093
|
getCellContent(t) {
|
|
2086
|
-
const e = t.querySelector(`[${
|
|
2094
|
+
const e = t.querySelector(`[${k}]`);
|
|
2087
2095
|
if (!e)
|
|
2088
2096
|
return { blocks: [] };
|
|
2089
2097
|
const n = e.querySelectorAll("[data-blok-id]");
|
|
@@ -2117,7 +2125,7 @@ class ps {
|
|
|
2117
2125
|
*/
|
|
2118
2126
|
createRow(t, e) {
|
|
2119
2127
|
const n = document.createElement("div");
|
|
2120
|
-
return n.className = v(
|
|
2128
|
+
return n.className = v(hs), n.setAttribute(g, ""), Array.from({ length: t }).forEach((s, o) => {
|
|
2121
2129
|
n.appendChild(this.createCell(e[o]));
|
|
2122
2130
|
}), n;
|
|
2123
2131
|
}
|
|
@@ -2126,13 +2134,13 @@ class ps {
|
|
|
2126
2134
|
*/
|
|
2127
2135
|
createCell(t) {
|
|
2128
2136
|
const e = document.createElement("div");
|
|
2129
|
-
e.className = v(
|
|
2137
|
+
e.className = v(us), e.style.borderRight = nt, e.style.borderBottom = nt, e.style.flexShrink = "0", e.style.overflow = "hidden", e.style.overflowWrap = "break-word", t !== void 0 && (e.style.width = typeof t == "string" ? t : `${t}%`), e.setAttribute(u, "");
|
|
2130
2138
|
const n = document.createElement("div");
|
|
2131
|
-
return n.setAttribute(
|
|
2139
|
+
return n.setAttribute(k, ""), e.appendChild(n), e;
|
|
2132
2140
|
}
|
|
2133
2141
|
}
|
|
2134
|
-
const
|
|
2135
|
-
class
|
|
2142
|
+
const Ct = (i) => typeof i == "object" && i !== null && "blocks" in i, k = "data-blok-table-cell-blocks";
|
|
2143
|
+
class fs {
|
|
2136
2144
|
constructor(t) {
|
|
2137
2145
|
this._activeCellWithBlocks = null, this.cellsPendingCheck = /* @__PURE__ */ new Set(), this.pendingCheckScheduled = !1, this.removedBlockCells = /* @__PURE__ */ new Map(), this.handleBlockMutation = (e) => {
|
|
2138
2146
|
if (!this.isBlockMutationEvent(e))
|
|
@@ -2154,14 +2162,32 @@ class gs {
|
|
|
2154
2162
|
this.claimBlockForCell(r, s.target.id), this.cellsPendingCheck.delete(r);
|
|
2155
2163
|
return;
|
|
2156
2164
|
}
|
|
2157
|
-
const a = s.target.holder.closest(`[${
|
|
2165
|
+
const a = s.target.holder.closest(`[${k}]`);
|
|
2158
2166
|
if (a) {
|
|
2159
2167
|
this.stripPlaceholders(a);
|
|
2160
2168
|
return;
|
|
2161
2169
|
}
|
|
2162
2170
|
const c = this.findCellForNewBlock(o);
|
|
2163
2171
|
c && (this.claimBlockForCell(c, s.target.id), this.cellsPendingCheck.delete(c));
|
|
2164
|
-
}, this.
|
|
2172
|
+
}, this.handleCellBlankSpaceClick = (e) => {
|
|
2173
|
+
const n = e.target;
|
|
2174
|
+
if (!n)
|
|
2175
|
+
return;
|
|
2176
|
+
const s = n.hasAttribute(u), o = n.hasAttribute(k);
|
|
2177
|
+
if (!s && !o)
|
|
2178
|
+
return;
|
|
2179
|
+
const r = s ? n : n.closest(`[${u}]`);
|
|
2180
|
+
if (!r)
|
|
2181
|
+
return;
|
|
2182
|
+
const l = s ? r.querySelector(`[${k}]`) : n;
|
|
2183
|
+
if (!l)
|
|
2184
|
+
return;
|
|
2185
|
+
const a = l.querySelectorAll("[data-blok-id]"), c = a[a.length - 1];
|
|
2186
|
+
if (!c)
|
|
2187
|
+
return;
|
|
2188
|
+
const d = c.getAttribute("data-blok-id");
|
|
2189
|
+
d && this.api.caret.setToBlock(d, "end");
|
|
2190
|
+
}, this.api = t.api, this.gridElement = t.gridElement, this.onNavigateToCell = t.onNavigateToCell, this.api.events.on("block changed", this.handleBlockMutation), this.gridElement.addEventListener("click", this.handleCellBlankSpaceClick);
|
|
2165
2191
|
}
|
|
2166
2192
|
/**
|
|
2167
2193
|
* Get the currently active cell that contains blocks
|
|
@@ -2231,7 +2257,7 @@ class gs {
|
|
|
2231
2257
|
const n = this.getCell(t.row, t.col);
|
|
2232
2258
|
if (!n)
|
|
2233
2259
|
return;
|
|
2234
|
-
const s = n.querySelector(`[${
|
|
2260
|
+
const s = n.querySelector(`[${k}]`);
|
|
2235
2261
|
if (!s)
|
|
2236
2262
|
return;
|
|
2237
2263
|
const o = s.querySelectorAll('[contenteditable="true"]');
|
|
@@ -2277,9 +2303,9 @@ class gs {
|
|
|
2277
2303
|
const h = l[d];
|
|
2278
2304
|
if (!h)
|
|
2279
2305
|
return;
|
|
2280
|
-
const p = h.querySelector(`[${
|
|
2306
|
+
const p = h.querySelector(`[${k}]`);
|
|
2281
2307
|
if (p) {
|
|
2282
|
-
if (
|
|
2308
|
+
if (Ct(c))
|
|
2283
2309
|
this.mountBlocksInCell(p, c.blocks), a.push(c);
|
|
2284
2310
|
else {
|
|
2285
2311
|
const m = typeof c == "string" ? c : "", f = this.api.blocks.insert("paragraph", { text: m }, {}, this.api.blocks.getBlocksCount(), !1);
|
|
@@ -2317,7 +2343,7 @@ class gs {
|
|
|
2317
2343
|
* Move a block's DOM holder into a cell's blocks container.
|
|
2318
2344
|
*/
|
|
2319
2345
|
claimBlockForCell(t, e) {
|
|
2320
|
-
const n = t.querySelector(`[${
|
|
2346
|
+
const n = t.querySelector(`[${k}]`);
|
|
2321
2347
|
if (!n)
|
|
2322
2348
|
return;
|
|
2323
2349
|
const s = this.api.blocks.getBlockIndex(e);
|
|
@@ -2349,7 +2375,7 @@ class gs {
|
|
|
2349
2375
|
* If the blocks container is empty, insert an empty paragraph.
|
|
2350
2376
|
*/
|
|
2351
2377
|
ensureCellHasBlock(t) {
|
|
2352
|
-
const e = t.querySelector(`[${
|
|
2378
|
+
const e = t.querySelector(`[${k}]`);
|
|
2353
2379
|
if (!e || e.querySelector("[data-blok-id]") !== null)
|
|
2354
2380
|
return;
|
|
2355
2381
|
const s = this.api.blocks.insert("paragraph", { text: "" }, {}, this.api.blocks.getBlocksCount(), !0);
|
|
@@ -2391,7 +2417,7 @@ class gs {
|
|
|
2391
2417
|
getBlockIdsFromCells(t) {
|
|
2392
2418
|
const e = [];
|
|
2393
2419
|
return Array.from(t).forEach((s) => {
|
|
2394
|
-
const o = s.querySelector(`[${
|
|
2420
|
+
const o = s.querySelector(`[${k}]`);
|
|
2395
2421
|
o && o.querySelectorAll("[data-blok-id]").forEach((r) => {
|
|
2396
2422
|
const l = r.getAttribute("data-blok-id");
|
|
2397
2423
|
l && e.push(l);
|
|
@@ -2406,28 +2432,36 @@ class gs {
|
|
|
2406
2432
|
this.api.blocks.delete(n);
|
|
2407
2433
|
});
|
|
2408
2434
|
}
|
|
2435
|
+
/**
|
|
2436
|
+
* Delete all blocks managed by this table from the BlockManager.
|
|
2437
|
+
* Called before the table block itself is removed to prevent orphaned cell blocks.
|
|
2438
|
+
*/
|
|
2439
|
+
deleteAllBlocks() {
|
|
2440
|
+
const t = this.gridElement.querySelectorAll(`[${u}]`), e = this.getBlockIdsFromCells(t);
|
|
2441
|
+
this.deleteBlocks(e);
|
|
2442
|
+
}
|
|
2409
2443
|
/**
|
|
2410
2444
|
* Clean up event listeners
|
|
2411
2445
|
*/
|
|
2412
2446
|
destroy() {
|
|
2413
|
-
this.api.events.off("block changed", this.handleBlockMutation), this._activeCellWithBlocks = null, this.cellsPendingCheck.clear(), this.removedBlockCells.clear();
|
|
2447
|
+
this.gridElement.removeEventListener("click", this.handleCellBlankSpaceClick), this.api.events.off("block changed", this.handleBlockMutation), this._activeCellWithBlocks = null, this.cellsPendingCheck.clear(), this.removedBlockCells.clear();
|
|
2414
2448
|
}
|
|
2415
2449
|
}
|
|
2416
|
-
const
|
|
2450
|
+
const X = 16, ms = [
|
|
2417
2451
|
[2, 2],
|
|
2418
2452
|
[8, 2],
|
|
2419
2453
|
[2, 7],
|
|
2420
2454
|
[8, 7],
|
|
2421
2455
|
[2, 12],
|
|
2422
2456
|
[8, 12]
|
|
2423
|
-
],
|
|
2457
|
+
], Cs = [
|
|
2424
2458
|
[2, 2],
|
|
2425
2459
|
[7, 2],
|
|
2426
2460
|
[12, 2],
|
|
2427
2461
|
[2, 8],
|
|
2428
2462
|
[7, 8],
|
|
2429
2463
|
[12, 8]
|
|
2430
|
-
],
|
|
2464
|
+
], fe = (i) => {
|
|
2431
2465
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg"), e = i === "horizontal";
|
|
2432
2466
|
t.setAttribute("width", e ? "14" : "10"), t.setAttribute("height", e ? "10" : "14"), t.setAttribute("viewBox", e ? "0 0 14 10" : "0 0 10 14"), t.setAttribute("fill", "currentColor"), t.classList.add(
|
|
2433
2467
|
"opacity-0",
|
|
@@ -2436,21 +2470,21 @@ const K = 16, fs = [
|
|
|
2436
2470
|
"text-gray-400",
|
|
2437
2471
|
"pointer-events-none"
|
|
2438
2472
|
);
|
|
2439
|
-
const n = e ?
|
|
2473
|
+
const n = e ? Cs : ms;
|
|
2440
2474
|
for (const [s, o] of n) {
|
|
2441
2475
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
2442
2476
|
r.setAttribute("cx", String(s)), r.setAttribute("cy", String(o)), r.setAttribute("r", "1.5"), t.appendChild(r);
|
|
2443
2477
|
}
|
|
2444
2478
|
return t;
|
|
2445
|
-
},
|
|
2446
|
-
t === "col" ? i.style
|
|
2479
|
+
}, ys = (i, t) => {
|
|
2480
|
+
t === "col" ? Object.assign(i.style, { height: `${X}px` }) : Object.assign(i.style, { width: `${X}px` }), i.classList.add("bg-gray-200"), i.classList.remove("bg-gray-300");
|
|
2447
2481
|
const e = i.querySelector("svg");
|
|
2448
2482
|
e && (e.classList.remove("opacity-0"), e.classList.add("opacity-100"));
|
|
2449
|
-
},
|
|
2450
|
-
t === "col" ? i.style
|
|
2483
|
+
}, pt = (i, t, e) => {
|
|
2484
|
+
t === "col" ? Object.assign(i.style, { height: `${e}px` }) : Object.assign(i.style, { width: `${e}px` }), i.classList.remove("bg-gray-200"), i.classList.add("bg-gray-300");
|
|
2451
2485
|
const n = i.querySelector("svg");
|
|
2452
2486
|
n && (n.classList.add("opacity-0"), n.classList.remove("opacity-100"));
|
|
2453
|
-
},
|
|
2487
|
+
}, gt = "data-blok-table-cell-selected", bs = "2px solid #3b82f6", ft = "data-blok-table-selection-pill", vs = 16, Ss = 20, Gt = 4, ws = [
|
|
2454
2488
|
"absolute",
|
|
2455
2489
|
"z-[3]",
|
|
2456
2490
|
"rounded",
|
|
@@ -2463,13 +2497,13 @@ const K = 16, fs = [
|
|
|
2463
2497
|
"overflow-hidden",
|
|
2464
2498
|
"cursor-pointer",
|
|
2465
2499
|
"bg-blue-500"
|
|
2466
|
-
],
|
|
2467
|
-
class
|
|
2500
|
+
], As = (i) => i.style.userSelect === "none";
|
|
2501
|
+
class Es {
|
|
2468
2502
|
constructor(t) {
|
|
2469
|
-
this.anchorCell = null, this.extentCell = null, this.isSelecting = !1, this.hasSelection = !1, this.selectedCells = [], this.overlay = null, this.pill = null, this.pillPopover = null, this.grid = t.grid, this.rectangleSelection = t.rectangleSelection, this.onSelectionActiveChange = t.onSelectionActiveChange, this.onClearContent = t.onClearContent, this.grid.style.position = "relative", this.boundPointerDown = this.handlePointerDown.bind(this), this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundClearSelection = this.handleClearSelection.bind(this), this.boundCancelRectangle = this.handleCancelRectangle.bind(this), this.grid.addEventListener("pointerdown", this.boundPointerDown);
|
|
2503
|
+
this.anchorCell = null, this.extentCell = null, this.isSelecting = !1, this.hasSelection = !1, this.selectedCells = [], this.overlay = null, this.pill = null, this.pillPopover = null, this.grid = t.grid, this.rectangleSelection = t.rectangleSelection, this.onSelectionActiveChange = t.onSelectionActiveChange, this.onClearContent = t.onClearContent, this.i18n = t.i18n, this.grid.style.position = "relative", this.boundPointerDown = this.handlePointerDown.bind(this), this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundClearSelection = this.handleClearSelection.bind(this), this.boundCancelRectangle = this.handleCancelRectangle.bind(this), this.boundKeyDown = this.handleKeyDown.bind(this), this.grid.addEventListener("pointerdown", this.boundPointerDown), document.addEventListener("keydown", this.boundKeyDown);
|
|
2470
2504
|
}
|
|
2471
2505
|
destroy() {
|
|
2472
|
-
this.destroyPillPopover(), this.clearSelection(), this.grid.removeEventListener("pointerdown", this.boundPointerDown), document.removeEventListener("pointermove", this.boundPointerMove), document.removeEventListener("pointerup", this.boundPointerUp), document.removeEventListener("pointerdown", this.boundClearSelection), document.removeEventListener("mousemove", this.boundCancelRectangle, !0);
|
|
2506
|
+
this.destroyPillPopover(), this.clearSelection(), this.grid.removeEventListener("pointerdown", this.boundPointerDown), document.removeEventListener("pointermove", this.boundPointerMove), document.removeEventListener("pointerup", this.boundPointerUp), document.removeEventListener("pointerdown", this.boundClearSelection), document.removeEventListener("mousemove", this.boundCancelRectangle, !0), document.removeEventListener("keydown", this.boundKeyDown);
|
|
2473
2507
|
}
|
|
2474
2508
|
/**
|
|
2475
2509
|
* Programmatically select an entire row.
|
|
@@ -2493,10 +2527,10 @@ class As {
|
|
|
2493
2527
|
this.clearSelection();
|
|
2494
2528
|
}
|
|
2495
2529
|
handlePointerDown(t) {
|
|
2496
|
-
if (
|
|
2530
|
+
if (As(this.grid) || t.button !== 0)
|
|
2497
2531
|
return;
|
|
2498
2532
|
const e = t.target;
|
|
2499
|
-
if (e.closest("[data-blok-table-grip]") || e.closest("[data-blok-table-resize]") || e.closest(`[${
|
|
2533
|
+
if (e.closest("[data-blok-table-grip]") || e.closest("[data-blok-table-resize]") || e.closest(`[${ft}]`))
|
|
2500
2534
|
return;
|
|
2501
2535
|
const n = this.resolveCellCoord(e);
|
|
2502
2536
|
n && (this.hasSelection && this.clearSelection(), this.anchorCell = n, this.isSelecting = !1, document.addEventListener("mousemove", this.boundCancelRectangle, !0), document.addEventListener("pointermove", this.boundPointerMove), document.addEventListener("pointerup", this.boundPointerUp));
|
|
@@ -2532,7 +2566,11 @@ class As {
|
|
|
2532
2566
|
}
|
|
2533
2567
|
handleClearSelection(t) {
|
|
2534
2568
|
const e = t.target;
|
|
2535
|
-
e instanceof HTMLElement && e.closest(`[${
|
|
2569
|
+
e instanceof HTMLElement && e.closest(`[${ft}]`) || this.pillPopover === null && (document.removeEventListener("pointerdown", this.boundClearSelection), this.clearSelection());
|
|
2570
|
+
}
|
|
2571
|
+
handleKeyDown(t) {
|
|
2572
|
+
var e;
|
|
2573
|
+
this.hasSelection && (t.key !== "Delete" && t.key !== "Backspace" || (t.preventDefault(), (e = this.onClearContent) == null || e.call(this, [...this.selectedCells]), this.clearSelection()));
|
|
2536
2574
|
}
|
|
2537
2575
|
clearSelection() {
|
|
2538
2576
|
var e;
|
|
@@ -2541,7 +2579,7 @@ class As {
|
|
|
2541
2579
|
}
|
|
2542
2580
|
restoreModifiedCells() {
|
|
2543
2581
|
this.destroyPillPopover(), this.selectedCells.forEach((t) => {
|
|
2544
|
-
t.removeAttribute(
|
|
2582
|
+
t.removeAttribute(gt);
|
|
2545
2583
|
}), this.pill && (this.pill.remove(), this.pill = null), this.overlay && (this.overlay.remove(), this.overlay = null), this.selectedCells = [];
|
|
2546
2584
|
}
|
|
2547
2585
|
showProgrammaticSelection(t, e, n, s) {
|
|
@@ -2551,35 +2589,26 @@ class As {
|
|
|
2551
2589
|
});
|
|
2552
2590
|
}
|
|
2553
2591
|
paintSelection() {
|
|
2554
|
-
var
|
|
2592
|
+
var I, D;
|
|
2555
2593
|
if (!this.anchorCell || !this.extentCell)
|
|
2556
2594
|
return;
|
|
2557
|
-
this.selectedCells.forEach((
|
|
2558
|
-
|
|
2595
|
+
this.selectedCells.forEach((M) => {
|
|
2596
|
+
M.removeAttribute(gt);
|
|
2559
2597
|
}), this.selectedCells = [];
|
|
2560
2598
|
const t = Math.min(this.anchorCell.row, this.extentCell.row), e = Math.max(this.anchorCell.row, this.extentCell.row), n = Math.min(this.anchorCell.col, this.extentCell.col), s = Math.max(this.anchorCell.col, this.extentCell.col), o = this.grid.querySelectorAll(`[${g}]`);
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
const _ = T.querySelectorAll(`[${u}]`);
|
|
2566
|
-
for (let H = n; H <= s; H++) {
|
|
2567
|
-
const J = _[H];
|
|
2568
|
-
J && (J.setAttribute(ht, ""), this.selectedCells.push(J));
|
|
2569
|
-
}
|
|
2570
|
-
}
|
|
2571
|
-
const r = (D = o[t]) == null ? void 0 : D.querySelectorAll(`[${u}]`)[n], l = (N = o[e]) == null ? void 0 : N.querySelectorAll(`[${u}]`)[s];
|
|
2599
|
+
this.selectedCells = this.collectCellsInRange(o, t, e, n, s), this.selectedCells.forEach((M) => {
|
|
2600
|
+
M.setAttribute(gt, "");
|
|
2601
|
+
});
|
|
2602
|
+
const r = (I = o[t]) == null ? void 0 : I.querySelectorAll(`[${u}]`)[n], l = (D = o[e]) == null ? void 0 : D.querySelectorAll(`[${u}]`)[s];
|
|
2572
2603
|
if (!r || !l)
|
|
2573
2604
|
return;
|
|
2574
|
-
const a = this.grid.getBoundingClientRect(), c = r.getBoundingClientRect(), d = l.getBoundingClientRect(), h = getComputedStyle(this.grid), p = parseFloat(h.borderTopWidth) || 0, m = parseFloat(h.borderLeftWidth) || 0;
|
|
2575
|
-
|
|
2576
|
-
const b = d.right - c.left + 1, I = d.bottom - c.top + 1;
|
|
2577
|
-
f -= 1, y -= 1, this.overlay || (this.overlay = document.createElement("div"), this.overlay.setAttribute("data-blok-table-selection-overlay", ""), this.overlay.style.position = "absolute", this.overlay.style.border = ys, this.overlay.style.pointerEvents = "none", this.overlay.style.boxSizing = "border-box", this.overlay.style.borderRadius = "2px", this.grid.appendChild(this.overlay)), this.overlay.style.top = `${f}px`, this.overlay.style.left = `${y}px`, this.overlay.style.width = `${b}px`, this.overlay.style.height = `${I}px`, this.pill || (this.pill = this.createPill(), this.grid.appendChild(this.pill)), this.pill.style.left = `${y + b - 1}px`, this.pill.style.top = `${f + I / 2}px`;
|
|
2605
|
+
const a = this.grid.getBoundingClientRect(), c = r.getBoundingClientRect(), d = l.getBoundingClientRect(), h = getComputedStyle(this.grid), p = parseFloat(h.borderTopWidth) || 0, m = parseFloat(h.borderLeftWidth) || 0, f = d.right - c.left + 1, y = d.bottom - c.top + 1, b = c.top - a.top - p - 1, B = c.left - a.left - m - 1;
|
|
2606
|
+
this.overlay || (this.overlay = document.createElement("div"), this.overlay.setAttribute("data-blok-table-selection-overlay", ""), this.overlay.style.position = "absolute", this.overlay.style.border = bs, this.overlay.style.pointerEvents = "none", this.overlay.style.boxSizing = "border-box", this.overlay.style.borderRadius = "2px", this.grid.appendChild(this.overlay)), this.overlay.style.top = `${b}px`, this.overlay.style.left = `${B}px`, this.overlay.style.width = `${f}px`, this.overlay.style.height = `${y}px`, this.pill || (this.pill = this.createPill(), this.grid.appendChild(this.pill)), this.pill.style.left = `${B + f - 1}px`, this.pill.style.top = `${b + y / 2}px`;
|
|
2578
2607
|
}
|
|
2579
2608
|
createPill() {
|
|
2580
2609
|
const t = document.createElement("div");
|
|
2581
|
-
t.setAttribute(
|
|
2582
|
-
const e =
|
|
2610
|
+
t.setAttribute(ft, ""), t.setAttribute("contenteditable", "false"), t.className = v(ws), t.style.width = `${Gt}px`, t.style.height = `${Ss}px`, t.style.pointerEvents = "auto", t.style.transform = "translate(-50%, -50%)", t.style.outline = "2px solid white";
|
|
2611
|
+
const e = fe("vertical");
|
|
2583
2612
|
return e.classList.remove("text-gray-400"), e.classList.add("text-white"), t.appendChild(e), t.addEventListener("mouseenter", () => {
|
|
2584
2613
|
this.pillPopover === null && this.expandPill();
|
|
2585
2614
|
}), t.addEventListener("mouseleave", () => {
|
|
@@ -2595,7 +2624,7 @@ class As {
|
|
|
2595
2624
|
const t = [
|
|
2596
2625
|
{
|
|
2597
2626
|
icon: Ge,
|
|
2598
|
-
title: "
|
|
2627
|
+
title: this.i18n.t("tools.table.clearSelection"),
|
|
2599
2628
|
closeOnActivate: !0,
|
|
2600
2629
|
onActivate: () => {
|
|
2601
2630
|
var e;
|
|
@@ -2603,25 +2632,25 @@ class As {
|
|
|
2603
2632
|
}
|
|
2604
2633
|
}
|
|
2605
2634
|
];
|
|
2606
|
-
this.pillPopover = new
|
|
2635
|
+
this.pillPopover = new ne({
|
|
2607
2636
|
items: t,
|
|
2608
2637
|
trigger: this.pill,
|
|
2609
2638
|
flippable: !0
|
|
2610
|
-
}), this.pillPopover.on(
|
|
2639
|
+
}), this.pillPopover.on(se.Closed, () => {
|
|
2611
2640
|
this.pillPopover !== null && (this.destroyPillPopover(), this.collapsePill());
|
|
2612
2641
|
}), this.pillPopover.show();
|
|
2613
2642
|
}
|
|
2614
2643
|
expandPill() {
|
|
2615
2644
|
if (!this.pill)
|
|
2616
2645
|
return;
|
|
2617
|
-
this.pill.style.width = `${
|
|
2646
|
+
this.pill.style.width = `${vs}px`;
|
|
2618
2647
|
const t = this.pill.querySelector("svg");
|
|
2619
2648
|
t && (t.classList.remove("opacity-0"), t.classList.add("opacity-100"));
|
|
2620
2649
|
}
|
|
2621
2650
|
collapsePill() {
|
|
2622
2651
|
if (!this.pill)
|
|
2623
2652
|
return;
|
|
2624
|
-
this.pill.style.width = `${
|
|
2653
|
+
this.pill.style.width = `${Gt}px`;
|
|
2625
2654
|
const t = this.pill.querySelector("svg");
|
|
2626
2655
|
t && (t.classList.add("opacity-0"), t.classList.remove("opacity-100"));
|
|
2627
2656
|
}
|
|
@@ -2651,15 +2680,24 @@ class As {
|
|
|
2651
2680
|
const e = this.grid.getBoundingClientRect(), n = this.grid.querySelectorAll(`[${g}]`), s = n.length, o = (d = (c = n[0]) == null ? void 0 : c.querySelectorAll(`[${u}]`).length) != null ? d : 0;
|
|
2652
2681
|
if (s === 0 || o === 0)
|
|
2653
2682
|
return;
|
|
2654
|
-
|
|
2655
|
-
t.clientY < e.top ? r = 0 : t.clientY > e.bottom ? r = s - 1 : r = (p = (h = this.extentCell) == null ? void 0 : h.row) != null ? p : this.anchorCell.row;
|
|
2656
|
-
let l;
|
|
2657
|
-
t.clientX < e.left ? l = 0 : t.clientX > e.right ? l = o - 1 : l = (f = (m = this.extentCell) == null ? void 0 : m.col) != null ? f : this.anchorCell.col;
|
|
2658
|
-
const a = { row: r, col: l };
|
|
2683
|
+
const r = this.clampAxis(t.clientY, e.top, e.bottom, s, (p = (h = this.extentCell) == null ? void 0 : h.row) != null ? p : this.anchorCell.row), l = this.clampAxis(t.clientX, e.left, e.right, o, (f = (m = this.extentCell) == null ? void 0 : m.col) != null ? f : this.anchorCell.col), a = { row: r, col: l };
|
|
2659
2684
|
(!this.extentCell || this.extentCell.row !== a.row || this.extentCell.col !== a.col) && (this.extentCell = a, this.paintSelection());
|
|
2660
2685
|
}
|
|
2686
|
+
collectCellsInRange(t, e, n, s, o) {
|
|
2687
|
+
return Array.from(t).slice(e, n + 1).flatMap((r) => {
|
|
2688
|
+
const l = r.querySelectorAll(`[${u}]`);
|
|
2689
|
+
return Array.from(l).slice(s, o + 1).filter((a) => a instanceof HTMLElement);
|
|
2690
|
+
});
|
|
2691
|
+
}
|
|
2692
|
+
/**
|
|
2693
|
+
* Clamp a pointer coordinate to an axis range, returning the edge index
|
|
2694
|
+
* when outside or the fallback when inside.
|
|
2695
|
+
*/
|
|
2696
|
+
clampAxis(t, e, n, s, o) {
|
|
2697
|
+
return t < e ? 0 : t > n ? s - 1 : o;
|
|
2698
|
+
}
|
|
2661
2699
|
}
|
|
2662
|
-
const
|
|
2700
|
+
const J = (i) => {
|
|
2663
2701
|
const t = i.querySelector(`[${g}]`);
|
|
2664
2702
|
if (!t)
|
|
2665
2703
|
return [];
|
|
@@ -2667,9 +2705,9 @@ const lt = (i) => {
|
|
|
2667
2705
|
return Array.from(e).map(
|
|
2668
2706
|
(n) => n.getBoundingClientRect().width
|
|
2669
2707
|
);
|
|
2670
|
-
},
|
|
2708
|
+
}, ct = (i, t) => {
|
|
2671
2709
|
const e = t.reduce((o, r) => o + r, 0), n = i;
|
|
2672
|
-
n.style.width = `${e +
|
|
2710
|
+
n.style.width = `${e + P}px`, i.querySelectorAll(`[${g}]`).forEach((o) => {
|
|
2673
2711
|
o.querySelectorAll(`[${u}]`).forEach((l, a) => {
|
|
2674
2712
|
if (a < t.length) {
|
|
2675
2713
|
const c = l;
|
|
@@ -2677,29 +2715,29 @@ const lt = (i) => {
|
|
|
2677
2715
|
}
|
|
2678
2716
|
});
|
|
2679
2717
|
});
|
|
2680
|
-
},
|
|
2718
|
+
}, ks = (i, t) => {
|
|
2681
2719
|
const e = Array.from(i.querySelectorAll(`[${g}]`)), n = e.findIndex((r) => Array.from(r.querySelectorAll(`[${u}]`)).includes(t));
|
|
2682
2720
|
if (n === -1)
|
|
2683
2721
|
return null;
|
|
2684
2722
|
const o = Array.from(e[n].querySelectorAll(`[${u}]`)).indexOf(t);
|
|
2685
2723
|
return { row: n, col: o };
|
|
2686
|
-
},
|
|
2724
|
+
}, me = (i) => {
|
|
2687
2725
|
var e;
|
|
2688
|
-
const t = i.querySelector(`[${
|
|
2726
|
+
const t = i.querySelector(`[${k}]`);
|
|
2689
2727
|
return t ? ((e = t.textContent) != null ? e : "").trim().length === 0 : !0;
|
|
2690
|
-
},
|
|
2728
|
+
}, xs = (i, t) => {
|
|
2691
2729
|
const n = i.querySelectorAll(`[${g}]`)[t];
|
|
2692
2730
|
if (!n)
|
|
2693
2731
|
return !0;
|
|
2694
2732
|
const s = n.querySelectorAll(`[${u}]`);
|
|
2695
|
-
return Array.from(s).every((o) =>
|
|
2696
|
-
},
|
|
2733
|
+
return Array.from(s).every((o) => me(o));
|
|
2734
|
+
}, Ts = (i, t) => {
|
|
2697
2735
|
const e = i.querySelectorAll(`[${g}]`);
|
|
2698
2736
|
return Array.from(e).every((n) => {
|
|
2699
2737
|
const o = n.querySelectorAll(`[${u}]`)[t];
|
|
2700
|
-
return !o ||
|
|
2738
|
+
return !o || me(o);
|
|
2701
2739
|
});
|
|
2702
|
-
},
|
|
2740
|
+
}, Rs = (i) => {
|
|
2703
2741
|
const t = i.querySelectorAll(`[${g}]`), e = t[0];
|
|
2704
2742
|
if (!e)
|
|
2705
2743
|
return;
|
|
@@ -2721,28 +2759,26 @@ const lt = (i) => {
|
|
|
2721
2759
|
return i;
|
|
2722
2760
|
const n = [...i], [s] = n.splice(t, 1);
|
|
2723
2761
|
return n.splice(e, 0, s), n;
|
|
2724
|
-
},
|
|
2762
|
+
}, Bs = (i, t) => {
|
|
2725
2763
|
if (!i)
|
|
2726
2764
|
return i;
|
|
2727
2765
|
const e = [...i];
|
|
2728
2766
|
return e.splice(t, 1), e.length > 0 ? e : void 0;
|
|
2729
|
-
},
|
|
2767
|
+
}, Is = (i, t, e, n) => {
|
|
2730
2768
|
var l;
|
|
2731
|
-
const s = (l = e.colWidths) != null ? l :
|
|
2732
|
-
n.addColumn(i, t, s);
|
|
2733
|
-
const
|
|
2734
|
-
s.reduce((a, c) => a + c, 0) / s.length / 2 * 100
|
|
2735
|
-
) / 100, r = [...s];
|
|
2769
|
+
const s = (l = e.colWidths) != null ? l : J(i), o = e.initialColWidth !== void 0 ? Math.round(e.initialColWidth / 2 * 100) / 100 : yt(s);
|
|
2770
|
+
n.addColumn(i, t, s, o);
|
|
2771
|
+
const r = [...s];
|
|
2736
2772
|
return r.splice(t, 0, o), r;
|
|
2737
|
-
},
|
|
2773
|
+
}, yt = (i) => Math.round(
|
|
2738
2774
|
i.reduce((t, e) => t + e, 0) / i.length / 2 * 100
|
|
2739
|
-
) / 100,
|
|
2775
|
+
) / 100, Ds = (i) => i.length === 0 ? 0 : Math.round(i.reduce((t, e) => t + e, 0) / i.length * 100) / 100, Ns = (i, t, e) => {
|
|
2740
2776
|
var o;
|
|
2741
2777
|
if (!i)
|
|
2742
2778
|
return [];
|
|
2743
2779
|
const s = i.querySelectorAll(`[${g}]`)[e];
|
|
2744
2780
|
return s ? (o = t == null ? void 0 : t.getBlockIdsFromCells(s.querySelectorAll(`[${u}]`))) != null ? o : [] : [];
|
|
2745
|
-
},
|
|
2781
|
+
}, Hs = (i, t, e) => {
|
|
2746
2782
|
var o;
|
|
2747
2783
|
if (!i)
|
|
2748
2784
|
return [];
|
|
@@ -2751,14 +2787,14 @@ const lt = (i) => {
|
|
|
2751
2787
|
const l = r.querySelectorAll(`[${u}]`);
|
|
2752
2788
|
e < l.length && s.push(l[e]);
|
|
2753
2789
|
}), (o = t == null ? void 0 : t.getBlockIdsFromCells(s)) != null ? o : [];
|
|
2754
|
-
},
|
|
2790
|
+
}, bt = (i, t, e, n) => {
|
|
2755
2791
|
const o = i.querySelectorAll(`[${g}]`)[t];
|
|
2756
2792
|
if (o && n) {
|
|
2757
2793
|
const r = o.querySelectorAll(`[${u}]`);
|
|
2758
2794
|
n.deleteBlocks(n.getBlockIdsFromCells(r));
|
|
2759
2795
|
}
|
|
2760
2796
|
e.deleteRow(i, t);
|
|
2761
|
-
},
|
|
2797
|
+
}, vt = (i, t, e, n, s) => {
|
|
2762
2798
|
if (s) {
|
|
2763
2799
|
const o = i.querySelectorAll(`[${g}]`), r = [];
|
|
2764
2800
|
o.forEach((l) => {
|
|
@@ -2766,12 +2802,12 @@ const lt = (i) => {
|
|
|
2766
2802
|
t < a.length && r.push(a[t]);
|
|
2767
2803
|
}), s.deleteBlocks(s.getBlockIdsFromCells(r));
|
|
2768
2804
|
}
|
|
2769
|
-
return n.deleteColumn(i, t),
|
|
2770
|
-
},
|
|
2805
|
+
return n.deleteColumn(i, t), Bs(e, t);
|
|
2806
|
+
}, V = (i, t) => {
|
|
2771
2807
|
i.querySelectorAll(`[${u}]`).forEach((n) => {
|
|
2772
2808
|
t == null || t.ensureCellHasBlock(n);
|
|
2773
2809
|
});
|
|
2774
|
-
},
|
|
2810
|
+
}, Ps = (i, t, e) => {
|
|
2775
2811
|
const n = i.querySelectorAll(`[${g}]`);
|
|
2776
2812
|
t.forEach((s, o) => {
|
|
2777
2813
|
const r = n[o];
|
|
@@ -2782,11 +2818,12 @@ const lt = (i) => {
|
|
|
2782
2818
|
const d = l[c];
|
|
2783
2819
|
if (!d)
|
|
2784
2820
|
return;
|
|
2785
|
-
const h = d.querySelector(`[${
|
|
2786
|
-
if (h)
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2821
|
+
const h = d.querySelector(`[${k}]`);
|
|
2822
|
+
if (!h)
|
|
2823
|
+
return;
|
|
2824
|
+
const p = h.querySelectorAll("[data-blok-id]").length > 0;
|
|
2825
|
+
if (!(!Ct(a) && p)) {
|
|
2826
|
+
if (!Ct(a)) {
|
|
2790
2827
|
const m = typeof a == "string" ? a : "", f = e.blocks.insert(
|
|
2791
2828
|
"paragraph",
|
|
2792
2829
|
{ text: m },
|
|
@@ -2797,17 +2834,17 @@ const lt = (i) => {
|
|
|
2797
2834
|
f != null && f.holder && h.appendChild(f.holder);
|
|
2798
2835
|
return;
|
|
2799
2836
|
}
|
|
2800
|
-
for (const
|
|
2801
|
-
const
|
|
2802
|
-
if (
|
|
2837
|
+
for (const m of a.blocks) {
|
|
2838
|
+
const f = e.blocks.getBlockIndex(m);
|
|
2839
|
+
if (f === void 0)
|
|
2803
2840
|
continue;
|
|
2804
|
-
const
|
|
2805
|
-
|
|
2841
|
+
const y = e.blocks.getBlockByIndex(f);
|
|
2842
|
+
y && h.appendChild(y.holder);
|
|
2806
2843
|
}
|
|
2807
2844
|
}
|
|
2808
2845
|
});
|
|
2809
2846
|
});
|
|
2810
|
-
},
|
|
2847
|
+
}, _s = (i, t) => {
|
|
2811
2848
|
var l, a, c, d, h, p, m, f, y, b;
|
|
2812
2849
|
if (!(typeof i == "object" && i !== null && "content" in i))
|
|
2813
2850
|
return {
|
|
@@ -2822,19 +2859,20 @@ const lt = (i) => {
|
|
|
2822
2859
|
withHeadingColumn: (m = n.withHeadingColumn) != null ? m : !1,
|
|
2823
2860
|
stretched: (y = (f = n.stretched) != null ? f : t.stretched) != null ? y : !1,
|
|
2824
2861
|
content: (b = n.content) != null ? b : [],
|
|
2825
|
-
colWidths: r
|
|
2862
|
+
colWidths: r,
|
|
2863
|
+
initialColWidth: n.initialColWidth
|
|
2826
2864
|
};
|
|
2827
|
-
},
|
|
2865
|
+
}, Os = (i, t) => {
|
|
2828
2866
|
i.addEventListener("keydown", (e) => {
|
|
2829
2867
|
const s = e.target.closest(`[${u}]`);
|
|
2830
2868
|
if (!s)
|
|
2831
2869
|
return;
|
|
2832
|
-
const o =
|
|
2870
|
+
const o = ks(i, s);
|
|
2833
2871
|
o && (t == null || t.handleKeyDown(e, o));
|
|
2834
2872
|
});
|
|
2835
|
-
},
|
|
2836
|
-
i == null || i.classList.add(...
|
|
2837
|
-
},
|
|
2873
|
+
}, Ce = ["overflow-x-auto", "pt-[9px]", "pl-[9px]"], qt = (i) => {
|
|
2874
|
+
i == null || i.classList.add(...Ce);
|
|
2875
|
+
}, st = (i, t) => {
|
|
2838
2876
|
if (!i)
|
|
2839
2877
|
return;
|
|
2840
2878
|
const e = i.firstElementChild;
|
|
@@ -2844,7 +2882,7 @@ const lt = (i) => {
|
|
|
2844
2882
|
n.forEach((s) => {
|
|
2845
2883
|
s.removeAttribute("data-blok-table-heading");
|
|
2846
2884
|
}), t && n.length > 0 && n[0].setAttribute("data-blok-table-heading", "");
|
|
2847
|
-
},
|
|
2885
|
+
}, z = (i, t) => {
|
|
2848
2886
|
if (!i)
|
|
2849
2887
|
return;
|
|
2850
2888
|
const e = i.firstElementChild;
|
|
@@ -2856,8 +2894,8 @@ const lt = (i) => {
|
|
|
2856
2894
|
const r = o.querySelector(`[${u}]`);
|
|
2857
2895
|
r && r.setAttribute("data-blok-table-heading-col", "");
|
|
2858
2896
|
});
|
|
2859
|
-
},
|
|
2860
|
-
class
|
|
2897
|
+
}, Ft = "data-blok-table-resize", Ms = "data-blok-table-cell", Ws = "data-blok-table-row", $s = 50, mt = 16;
|
|
2898
|
+
class Gs {
|
|
2861
2899
|
constructor(t, e, n, s, o, r = !1) {
|
|
2862
2900
|
this._enabled = !0, this.isDragging = !1, this.dragStartX = 0, this.dragColIndex = -1, this.startColWidth = 0, this.handles = [], this.gridEl = t, this.colWidths = [...e], this.onChange = n, this.onDragStart = s != null ? s : null, this.onDrag = o != null ? o : null, this.needsInitialApply = r, this.boundPointerDown = this.onPointerDown.bind(this), this.boundPointerMove = this.onPointerMove.bind(this), this.boundPointerUp = this.onPointerUp.bind(this), this.gridEl.style.position = "relative", r || this.applyWidths(), this.createHandles(), this.gridEl.addEventListener("pointerdown", this.boundPointerDown);
|
|
2863
2901
|
}
|
|
@@ -2884,7 +2922,7 @@ class Os {
|
|
|
2884
2922
|
}
|
|
2885
2923
|
createHandle(t) {
|
|
2886
2924
|
const e = document.createElement("div"), n = this.getHandleLeftPx(t);
|
|
2887
|
-
return e.setAttribute(
|
|
2925
|
+
return e.setAttribute(Ft, ""), e.setAttribute("data-col", String(t)), e.style.position = "absolute", e.style.top = `-${P}px`, e.style.bottom = "0px", e.style.width = `${mt}px`, e.style.left = `${n - mt / 2}px`, e.style.cursor = "col-resize", e.style.zIndex = "2", e.style.background = "linear-gradient(to right, transparent 7px, #3b82f6 7px, #3b82f6 9px, transparent 9px)", e.style.opacity = "0", e.style.transition = "opacity 150ms ease", e.setAttribute("contenteditable", "false"), e.addEventListener("mouseenter", () => {
|
|
2888
2926
|
this.isDragging || (e.style.opacity = "1");
|
|
2889
2927
|
}), e.addEventListener("mouseleave", () => {
|
|
2890
2928
|
this.isDragging || (e.style.opacity = "0");
|
|
@@ -2896,7 +2934,7 @@ class Os {
|
|
|
2896
2934
|
updateHandlePositions() {
|
|
2897
2935
|
this.handles.forEach((t, e) => {
|
|
2898
2936
|
const n = this.getHandleLeftPx(e), s = t;
|
|
2899
|
-
s.style.left = `${n -
|
|
2937
|
+
s.style.left = `${n - mt / 2}px`;
|
|
2900
2938
|
});
|
|
2901
2939
|
}
|
|
2902
2940
|
onPointerDown(t) {
|
|
@@ -2904,7 +2942,7 @@ class Os {
|
|
|
2904
2942
|
if (!this._enabled)
|
|
2905
2943
|
return;
|
|
2906
2944
|
const e = t.target;
|
|
2907
|
-
if (!e.hasAttribute(
|
|
2945
|
+
if (!e.hasAttribute(Ft))
|
|
2908
2946
|
return;
|
|
2909
2947
|
t.preventDefault(), this.needsInitialApply && (this.applyWidths(), this.updateHandlePositions(), this.needsInitialApply = !1);
|
|
2910
2948
|
const n = e.getAttribute("data-col");
|
|
@@ -2914,7 +2952,7 @@ class Os {
|
|
|
2914
2952
|
var o;
|
|
2915
2953
|
if (!this.isDragging)
|
|
2916
2954
|
return;
|
|
2917
|
-
const e = t.clientX - this.dragStartX, n = this.startColWidth + e, s = Math.max(
|
|
2955
|
+
const e = t.clientX - this.dragStartX, n = this.startColWidth + e, s = Math.max($s, n);
|
|
2918
2956
|
this.colWidths[this.dragColIndex] = s, this.applyWidths(), this.updateHandlePositions(), (o = this.onDrag) == null || o.call(this);
|
|
2919
2957
|
}
|
|
2920
2958
|
onPointerUp() {
|
|
@@ -2926,8 +2964,8 @@ class Os {
|
|
|
2926
2964
|
}
|
|
2927
2965
|
applyWidths() {
|
|
2928
2966
|
const t = this.colWidths.reduce((n, s) => n + s, 0);
|
|
2929
|
-
this.gridEl.style.width = `${t +
|
|
2930
|
-
n.querySelectorAll(`[${
|
|
2967
|
+
this.gridEl.style.width = `${t + P}px`, this.gridEl.querySelectorAll(`[${Ws}]`).forEach((n) => {
|
|
2968
|
+
n.querySelectorAll(`[${Ms}]`).forEach((o, r) => {
|
|
2931
2969
|
if (r < this.colWidths.length) {
|
|
2932
2970
|
const l = o;
|
|
2933
2971
|
l.style.width = `${this.colWidths[r]}px`;
|
|
@@ -2936,69 +2974,90 @@ class Os {
|
|
|
2936
2974
|
});
|
|
2937
2975
|
}
|
|
2938
2976
|
}
|
|
2939
|
-
const
|
|
2940
|
-
"
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
"items-center",
|
|
2954
|
-
"justify-center",
|
|
2955
|
-
"w-[26px]",
|
|
2956
|
-
"h-[26px]",
|
|
2957
|
-
"mr-2",
|
|
2958
|
-
"[&_svg]:w-icon",
|
|
2959
|
-
"[&_svg]:h-icon"
|
|
2960
|
-
], Ws = [
|
|
2961
|
-
"mr-auto",
|
|
2962
|
-
"truncate",
|
|
2963
|
-
"text-sm",
|
|
2964
|
-
"font-medium",
|
|
2965
|
-
"leading-5"
|
|
2966
|
-
], qs = [
|
|
2967
|
-
"relative",
|
|
2968
|
-
"w-[34px]",
|
|
2969
|
-
"h-[20px]",
|
|
2970
|
-
"rounded-full",
|
|
2971
|
-
"transition-colors",
|
|
2972
|
-
"duration-200",
|
|
2973
|
-
"shrink-0"
|
|
2974
|
-
], Fs = [
|
|
2975
|
-
"absolute",
|
|
2976
|
-
"top-[2px]",
|
|
2977
|
-
"w-4",
|
|
2978
|
-
"h-4",
|
|
2979
|
-
"rounded-full",
|
|
2980
|
-
"bg-white",
|
|
2981
|
-
"shadow-sm",
|
|
2982
|
-
"transition-[left]",
|
|
2983
|
-
"duration-200"
|
|
2984
|
-
], Ut = (i) => {
|
|
2985
|
-
const { icon: t, label: e, isActive: n, onToggle: s } = i, o = { active: n }, r = document.createElement("div");
|
|
2986
|
-
r.className = v($s);
|
|
2987
|
-
const l = document.createElement("div");
|
|
2988
|
-
l.className = v(Gs), l.innerHTML = t, r.appendChild(l);
|
|
2989
|
-
const a = document.createElement("span");
|
|
2990
|
-
a.className = v(Ws), a.textContent = e, r.appendChild(a);
|
|
2991
|
-
const c = document.createElement("div");
|
|
2992
|
-
c.className = v(qs);
|
|
2993
|
-
const d = document.createElement("div");
|
|
2994
|
-
d.className = v(Fs), c.appendChild(d), r.appendChild(c);
|
|
2995
|
-
const h = () => {
|
|
2996
|
-
c.style.backgroundColor = o.active ? "#3b82f6" : "#d1d5db", d.style.left = o.active ? "16px" : "2px";
|
|
2977
|
+
const zt = (i, t, e) => (e.grid.addRow(i, t), V(i, e.cellBlocks), {
|
|
2978
|
+
pendingHighlight: { type: "row", index: t },
|
|
2979
|
+
moveSelection: null,
|
|
2980
|
+
colWidths: e.data.colWidths,
|
|
2981
|
+
withHeadings: e.data.withHeadings,
|
|
2982
|
+
withHeadingColumn: e.data.withHeadingColumn
|
|
2983
|
+
}), Vt = (i, t, e) => {
|
|
2984
|
+
const n = Is(i, t, e.data, e.grid);
|
|
2985
|
+
return V(i, e.cellBlocks), {
|
|
2986
|
+
pendingHighlight: { type: "col", index: t },
|
|
2987
|
+
moveSelection: null,
|
|
2988
|
+
colWidths: n,
|
|
2989
|
+
withHeadings: e.data.withHeadings,
|
|
2990
|
+
withHeadingColumn: e.data.withHeadingColumn
|
|
2997
2991
|
};
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
}
|
|
3001
|
-
|
|
2992
|
+
}, qs = (i, t, e, n) => (n.grid.moveRow(i, t, e), {
|
|
2993
|
+
pendingHighlight: null,
|
|
2994
|
+
moveSelection: { type: "row", index: e },
|
|
2995
|
+
colWidths: n.data.colWidths,
|
|
2996
|
+
withHeadings: n.data.withHeadings,
|
|
2997
|
+
withHeadingColumn: n.data.withHeadingColumn
|
|
2998
|
+
}), Fs = (i, t, e, n) => (n.grid.moveColumn(i, t, e), {
|
|
2999
|
+
pendingHighlight: null,
|
|
3000
|
+
moveSelection: { type: "col", index: e },
|
|
3001
|
+
colWidths: Ls(n.data.colWidths, t, e),
|
|
3002
|
+
withHeadings: n.data.withHeadings,
|
|
3003
|
+
withHeadingColumn: n.data.withHeadingColumn
|
|
3004
|
+
}), zs = (i, t, e) => {
|
|
3005
|
+
bt(i, t, e.grid, e.cellBlocks);
|
|
3006
|
+
const n = e.grid.getRowCount(i);
|
|
3007
|
+
return {
|
|
3008
|
+
pendingHighlight: { type: "row", index: t < n ? t : t - 1 },
|
|
3009
|
+
moveSelection: null,
|
|
3010
|
+
colWidths: e.data.colWidths,
|
|
3011
|
+
withHeadings: e.data.withHeadings,
|
|
3012
|
+
withHeadingColumn: e.data.withHeadingColumn
|
|
3013
|
+
};
|
|
3014
|
+
}, Vs = (i, t, e) => {
|
|
3015
|
+
const n = vt(i, t, e.data.colWidths, e.grid, e.cellBlocks);
|
|
3016
|
+
n ? ct(i, n) : Rs(i);
|
|
3017
|
+
const s = e.grid.getColumnCount(i);
|
|
3018
|
+
return {
|
|
3019
|
+
pendingHighlight: { type: "col", index: t < s ? t : t - 1 },
|
|
3020
|
+
moveSelection: null,
|
|
3021
|
+
colWidths: n,
|
|
3022
|
+
withHeadings: e.data.withHeadings,
|
|
3023
|
+
withHeadingColumn: e.data.withHeadingColumn
|
|
3024
|
+
};
|
|
3025
|
+
}, Us = (i, t, e) => {
|
|
3026
|
+
switch (t.type) {
|
|
3027
|
+
case "insert-row-above":
|
|
3028
|
+
return zt(i, t.index, e);
|
|
3029
|
+
case "insert-row-below":
|
|
3030
|
+
return zt(i, t.index + 1, e);
|
|
3031
|
+
case "insert-col-left":
|
|
3032
|
+
return Vt(i, t.index, e);
|
|
3033
|
+
case "insert-col-right":
|
|
3034
|
+
return Vt(i, t.index + 1, e);
|
|
3035
|
+
case "move-row":
|
|
3036
|
+
return qs(i, t.fromIndex, t.toIndex, e);
|
|
3037
|
+
case "move-col":
|
|
3038
|
+
return Fs(i, t.fromIndex, t.toIndex, e);
|
|
3039
|
+
case "delete-row":
|
|
3040
|
+
return zs(i, t.index, e);
|
|
3041
|
+
case "delete-col":
|
|
3042
|
+
return Vs(i, t.index, e);
|
|
3043
|
+
case "toggle-heading":
|
|
3044
|
+
return {
|
|
3045
|
+
pendingHighlight: { type: "row", index: 0 },
|
|
3046
|
+
moveSelection: null,
|
|
3047
|
+
colWidths: e.data.colWidths,
|
|
3048
|
+
withHeadings: !e.data.withHeadings,
|
|
3049
|
+
withHeadingColumn: e.data.withHeadingColumn
|
|
3050
|
+
};
|
|
3051
|
+
case "toggle-heading-column":
|
|
3052
|
+
return {
|
|
3053
|
+
pendingHighlight: { type: "col", index: 0 },
|
|
3054
|
+
moveSelection: null,
|
|
3055
|
+
colWidths: e.data.colWidths,
|
|
3056
|
+
withHeadings: e.data.withHeadings,
|
|
3057
|
+
withHeadingColumn: !e.data.withHeadingColumn
|
|
3058
|
+
};
|
|
3059
|
+
}
|
|
3060
|
+
}, Ut = 10, Ks = "data-blok-table-drag-ghost", St = (i) => {
|
|
3002
3061
|
const t = i.querySelector(`[${g}]`);
|
|
3003
3062
|
return t ? Array.from(t.querySelectorAll(`[${u}]`)).reduce(
|
|
3004
3063
|
(n, s) => {
|
|
@@ -3008,7 +3067,7 @@ const $s = [
|
|
|
3008
3067
|
[0]
|
|
3009
3068
|
) : [0];
|
|
3010
3069
|
};
|
|
3011
|
-
class
|
|
3070
|
+
class js {
|
|
3012
3071
|
constructor(t) {
|
|
3013
3072
|
var e;
|
|
3014
3073
|
this.isDragging = !1, this.dragType = null, this.dragFromIndex = -1, this.dragStartX = 0, this.dragStartY = 0, this.dropIndicator = null, this.dragOverlayCells = [], this.ghostEl = null, this.ghostOffsetX = 0, this.ghostOffsetY = 0, this.resolveTracking = null, this.grid = t.grid, this.onAction = t.onAction, this.onDragStateChange = (e = t.onDragStateChange) != null ? e : null, this.boundDocPointerMove = this.handleDocPointerMove.bind(this), this.boundDocPointerUp = this.handleDocPointerUp.bind(this);
|
|
@@ -3032,7 +3091,7 @@ class Vs {
|
|
|
3032
3091
|
}
|
|
3033
3092
|
handleDocPointerMove(t) {
|
|
3034
3093
|
const e = Math.abs(t.clientX - this.dragStartX), n = Math.abs(t.clientY - this.dragStartY);
|
|
3035
|
-
!this.isDragging && (e >
|
|
3094
|
+
!this.isDragging && (e > Ut || n > Ut) && (this.isDragging = !0, this.startDrag()), this.isDragging && (this.updateDragIndicator(t), this.updateGhostPosition(t));
|
|
3036
3095
|
}
|
|
3037
3096
|
handleDocPointerUp(t) {
|
|
3038
3097
|
var e, n;
|
|
@@ -3056,7 +3115,7 @@ class Vs {
|
|
|
3056
3115
|
return;
|
|
3057
3116
|
e.querySelectorAll(`[${u}]`).forEach((s) => {
|
|
3058
3117
|
const o = s;
|
|
3059
|
-
o.style.backgroundColor = "#
|
|
3118
|
+
o.style.backgroundColor = "#f3f4f6", o.style.opacity = "0.7", this.dragOverlayCells.push(o);
|
|
3060
3119
|
});
|
|
3061
3120
|
}
|
|
3062
3121
|
highlightColumnCells(t) {
|
|
@@ -3065,17 +3124,17 @@ class Vs {
|
|
|
3065
3124
|
if (this.dragFromIndex >= n.length)
|
|
3066
3125
|
return;
|
|
3067
3126
|
const s = n[this.dragFromIndex];
|
|
3068
|
-
s.style.backgroundColor = "#
|
|
3127
|
+
s.style.backgroundColor = "#f3f4f6", s.style.opacity = "0.7", this.dragOverlayCells.push(s);
|
|
3069
3128
|
});
|
|
3070
3129
|
}
|
|
3071
3130
|
createDropIndicator() {
|
|
3072
3131
|
this.dropIndicator = document.createElement("div");
|
|
3073
3132
|
const t = this.dropIndicator.style;
|
|
3074
3133
|
if (t.position = "absolute", t.backgroundColor = "#3b82f6", t.borderRadius = "1.5px", t.zIndex = "5", t.pointerEvents = "none", this.dropIndicator.setAttribute("contenteditable", "false"), this.dragType === "row")
|
|
3075
|
-
t.height = "3px", t.left = `${
|
|
3134
|
+
t.height = "3px", t.left = `${-P}px`, t.right = "0", t.transition = "top 100ms ease";
|
|
3076
3135
|
else {
|
|
3077
3136
|
const e = this.grid.querySelectorAll(`[${g}]`), n = e[e.length - 1], s = n ? n.offsetTop + n.offsetHeight : 0;
|
|
3078
|
-
t.width = "3px", t.top = `${
|
|
3137
|
+
t.width = "3px", t.top = `${-P}px`, t.height = `${s + P}px`, t.transition = "left 100ms ease";
|
|
3079
3138
|
}
|
|
3080
3139
|
this.grid.appendChild(this.dropIndicator);
|
|
3081
3140
|
}
|
|
@@ -3099,7 +3158,7 @@ class Vs {
|
|
|
3099
3158
|
var r;
|
|
3100
3159
|
if (!this.dropIndicator)
|
|
3101
3160
|
return;
|
|
3102
|
-
const n = t.clientX - e.left, s = this.getColDropIndex(n), o =
|
|
3161
|
+
const n = t.clientX - e.left, s = this.getColDropIndex(n), o = St(this.grid);
|
|
3103
3162
|
this.dropIndicator.style.left = `${((r = o[s]) != null ? r : 0) - 1.5}px`;
|
|
3104
3163
|
}
|
|
3105
3164
|
finishDrag(t) {
|
|
@@ -3120,7 +3179,7 @@ class Vs {
|
|
|
3120
3179
|
}
|
|
3121
3180
|
createGhost() {
|
|
3122
3181
|
const t = document.createElement("div");
|
|
3123
|
-
t.setAttribute(
|
|
3182
|
+
t.setAttribute(Ks, ""), t.setAttribute("contenteditable", "false");
|
|
3124
3183
|
const e = t.style;
|
|
3125
3184
|
e.position = "fixed", e.pointerEvents = "none", e.opacity = "0.5", e.zIndex = "50", e.borderRadius = "4px", e.overflow = "hidden", e.boxShadow = "0 4px 12px rgba(0,0,0,0.15)", this.ghostEl = t;
|
|
3126
3185
|
const n = this.getSourceRect();
|
|
@@ -3194,11 +3253,177 @@ class Vs {
|
|
|
3194
3253
|
return 0;
|
|
3195
3254
|
}
|
|
3196
3255
|
getColDropIndex(t) {
|
|
3197
|
-
const n =
|
|
3256
|
+
const n = St(this.grid).map((o) => Math.abs(t - o)), s = Math.min(...n);
|
|
3198
3257
|
return n.indexOf(s);
|
|
3199
3258
|
}
|
|
3200
3259
|
}
|
|
3201
|
-
const
|
|
3260
|
+
const Xs = [
|
|
3261
|
+
"flex",
|
|
3262
|
+
"items-center",
|
|
3263
|
+
"select-none",
|
|
3264
|
+
"border-none",
|
|
3265
|
+
"bg-transparent",
|
|
3266
|
+
"rounded-md",
|
|
3267
|
+
"p-[var(--item-padding)]",
|
|
3268
|
+
"text-text-primary",
|
|
3269
|
+
"mb-px",
|
|
3270
|
+
"cursor-pointer",
|
|
3271
|
+
"can-hover:hover:bg-item-hover-bg"
|
|
3272
|
+
], Ys = [
|
|
3273
|
+
"flex",
|
|
3274
|
+
"items-center",
|
|
3275
|
+
"justify-center",
|
|
3276
|
+
"w-[26px]",
|
|
3277
|
+
"h-[26px]",
|
|
3278
|
+
"mr-2",
|
|
3279
|
+
"[&_svg]:w-icon",
|
|
3280
|
+
"[&_svg]:h-icon"
|
|
3281
|
+
], Zs = [
|
|
3282
|
+
"mr-auto",
|
|
3283
|
+
"truncate",
|
|
3284
|
+
"text-sm",
|
|
3285
|
+
"font-medium",
|
|
3286
|
+
"leading-5"
|
|
3287
|
+
], Js = [
|
|
3288
|
+
"relative",
|
|
3289
|
+
"w-[34px]",
|
|
3290
|
+
"h-[20px]",
|
|
3291
|
+
"rounded-full",
|
|
3292
|
+
"transition-colors",
|
|
3293
|
+
"duration-200",
|
|
3294
|
+
"shrink-0"
|
|
3295
|
+
], Qs = [
|
|
3296
|
+
"absolute",
|
|
3297
|
+
"top-[2px]",
|
|
3298
|
+
"w-4",
|
|
3299
|
+
"h-4",
|
|
3300
|
+
"rounded-full",
|
|
3301
|
+
"bg-white",
|
|
3302
|
+
"shadow-sm",
|
|
3303
|
+
"transition-[left]",
|
|
3304
|
+
"duration-200"
|
|
3305
|
+
], ye = (i) => {
|
|
3306
|
+
const { icon: t, label: e, isActive: n, onToggle: s } = i, o = { active: n }, r = document.createElement("div");
|
|
3307
|
+
r.className = v(Xs);
|
|
3308
|
+
const l = document.createElement("div");
|
|
3309
|
+
l.className = v(Ys), l.innerHTML = t, r.appendChild(l);
|
|
3310
|
+
const a = document.createElement("span");
|
|
3311
|
+
a.className = v(Zs), a.textContent = e, r.appendChild(a);
|
|
3312
|
+
const c = document.createElement("div");
|
|
3313
|
+
c.className = v(Js);
|
|
3314
|
+
const d = document.createElement("div");
|
|
3315
|
+
d.className = v(Qs), c.appendChild(d), r.appendChild(c);
|
|
3316
|
+
const h = () => {
|
|
3317
|
+
c.style.backgroundColor = o.active ? "#3b82f6" : "#d1d5db", d.style.left = o.active ? "16px" : "2px";
|
|
3318
|
+
};
|
|
3319
|
+
return h(), r.addEventListener("click", (p) => {
|
|
3320
|
+
p.stopPropagation(), o.active = !o.active, h(), s(o.active);
|
|
3321
|
+
}), r;
|
|
3322
|
+
}, to = (i, t) => {
|
|
3323
|
+
const e = i === 0 ? [
|
|
3324
|
+
{
|
|
3325
|
+
type: q.Html,
|
|
3326
|
+
element: ye({
|
|
3327
|
+
icon: Ue,
|
|
3328
|
+
label: t.i18n.t("tools.table.headerColumn"),
|
|
3329
|
+
isActive: t.isHeadingColumn(),
|
|
3330
|
+
onToggle: () => {
|
|
3331
|
+
t.onAction({ type: "toggle-heading-column" });
|
|
3332
|
+
}
|
|
3333
|
+
})
|
|
3334
|
+
},
|
|
3335
|
+
{ type: q.Separator }
|
|
3336
|
+
] : [], n = [
|
|
3337
|
+
{
|
|
3338
|
+
icon: qe,
|
|
3339
|
+
title: t.i18n.t("tools.table.insertColumnLeft"),
|
|
3340
|
+
closeOnActivate: !0,
|
|
3341
|
+
onActivate: () => {
|
|
3342
|
+
t.onAction({ type: "insert-col-left", index: i });
|
|
3343
|
+
}
|
|
3344
|
+
},
|
|
3345
|
+
{
|
|
3346
|
+
icon: Fe,
|
|
3347
|
+
title: t.i18n.t("tools.table.insertColumnRight"),
|
|
3348
|
+
closeOnActivate: !0,
|
|
3349
|
+
onActivate: () => {
|
|
3350
|
+
t.onAction({ type: "insert-col-right", index: i });
|
|
3351
|
+
}
|
|
3352
|
+
}
|
|
3353
|
+
], s = t.getColumnCount() > 1, o = [
|
|
3354
|
+
{ type: q.Separator },
|
|
3355
|
+
{
|
|
3356
|
+
icon: oe,
|
|
3357
|
+
title: t.i18n.t("tools.table.deleteColumn"),
|
|
3358
|
+
isDestructive: !0,
|
|
3359
|
+
isDisabled: !s,
|
|
3360
|
+
closeOnActivate: !0,
|
|
3361
|
+
onActivate: () => {
|
|
3362
|
+
t.onAction({ type: "delete-col", index: i });
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
];
|
|
3366
|
+
return [...e, ...n, ...o];
|
|
3367
|
+
}, eo = (i, t) => {
|
|
3368
|
+
const e = i === 0 ? [
|
|
3369
|
+
{
|
|
3370
|
+
type: q.Html,
|
|
3371
|
+
element: ye({
|
|
3372
|
+
icon: Ke,
|
|
3373
|
+
label: t.i18n.t("tools.table.headerRow"),
|
|
3374
|
+
isActive: t.isHeadingRow(),
|
|
3375
|
+
onToggle: () => {
|
|
3376
|
+
t.onAction({ type: "toggle-heading" });
|
|
3377
|
+
}
|
|
3378
|
+
})
|
|
3379
|
+
},
|
|
3380
|
+
{ type: q.Separator }
|
|
3381
|
+
] : [], n = [
|
|
3382
|
+
{
|
|
3383
|
+
icon: ze,
|
|
3384
|
+
title: t.i18n.t("tools.table.insertRowAbove"),
|
|
3385
|
+
closeOnActivate: !0,
|
|
3386
|
+
onActivate: () => {
|
|
3387
|
+
t.onAction({ type: "insert-row-above", index: i });
|
|
3388
|
+
}
|
|
3389
|
+
},
|
|
3390
|
+
{
|
|
3391
|
+
icon: Ve,
|
|
3392
|
+
title: t.i18n.t("tools.table.insertRowBelow"),
|
|
3393
|
+
closeOnActivate: !0,
|
|
3394
|
+
onActivate: () => {
|
|
3395
|
+
t.onAction({ type: "insert-row-below", index: i });
|
|
3396
|
+
}
|
|
3397
|
+
}
|
|
3398
|
+
], s = t.getRowCount() > 1, o = [
|
|
3399
|
+
{ type: q.Separator },
|
|
3400
|
+
{
|
|
3401
|
+
icon: oe,
|
|
3402
|
+
title: t.i18n.t("tools.table.deleteRow"),
|
|
3403
|
+
isDestructive: !0,
|
|
3404
|
+
isDisabled: !s,
|
|
3405
|
+
closeOnActivate: !0,
|
|
3406
|
+
onActivate: () => {
|
|
3407
|
+
t.onAction({ type: "delete-row", index: i });
|
|
3408
|
+
}
|
|
3409
|
+
}
|
|
3410
|
+
];
|
|
3411
|
+
return [...e, ...n, ...o];
|
|
3412
|
+
}, no = (i, t, e, n, s) => {
|
|
3413
|
+
s.destroyPopover(), s.clearHideTimeout();
|
|
3414
|
+
const o = i === "col" ? e.col[t] : e.row[t];
|
|
3415
|
+
if (!o)
|
|
3416
|
+
return { popover: null, grip: null };
|
|
3417
|
+
const r = i === "col" ? to(t, n) : eo(t, n), l = new ne({
|
|
3418
|
+
items: r,
|
|
3419
|
+
trigger: o,
|
|
3420
|
+
flippable: !0
|
|
3421
|
+
});
|
|
3422
|
+
return l.on(se.Closed, () => {
|
|
3423
|
+
var a;
|
|
3424
|
+
s.destroyPopover(), s.applyVisibleClasses(o), s.scheduleHideAll(), (a = s.onGripPopoverClose) == null || a.call(s);
|
|
3425
|
+
}), s.hideAllGripsExcept(o), s.applyActiveClasses(o), i === "col" ? o.style.height = `${X}px` : o.style.width = `${X}px`, { popover: l, grip: o };
|
|
3426
|
+
}, Kt = "data-blok-table-grip", ot = "data-blok-table-grip-col", jt = "data-blok-table-grip-row", so = 150, oo = 24, it = 4, rt = 4, io = 20, lt = [
|
|
3202
3427
|
"absolute",
|
|
3203
3428
|
"z-[3]",
|
|
3204
3429
|
"rounded",
|
|
@@ -3211,23 +3436,23 @@ const jt = "data-blok-table-grip", mt = "data-blok-table-grip-col", Xt = "data-b
|
|
|
3211
3436
|
"items-center",
|
|
3212
3437
|
"justify-center",
|
|
3213
3438
|
"overflow-hidden"
|
|
3214
|
-
],
|
|
3439
|
+
], Xt = [
|
|
3215
3440
|
"bg-gray-300",
|
|
3216
3441
|
"opacity-0",
|
|
3217
3442
|
"pointer-events-none"
|
|
3218
|
-
],
|
|
3443
|
+
], ro = [
|
|
3219
3444
|
"bg-gray-300",
|
|
3220
3445
|
"opacity-100",
|
|
3221
3446
|
"pointer-events-auto"
|
|
3222
|
-
],
|
|
3447
|
+
], lo = [
|
|
3223
3448
|
"bg-blue-500",
|
|
3224
3449
|
"text-white",
|
|
3225
3450
|
"opacity-100",
|
|
3226
3451
|
"pointer-events-auto"
|
|
3227
3452
|
];
|
|
3228
|
-
class
|
|
3453
|
+
class ao {
|
|
3229
3454
|
constructor(t) {
|
|
3230
|
-
this.colGrips = [], this.rowGrips = [], this.
|
|
3455
|
+
this.colGrips = [], this.rowGrips = [], this.popoverState = { popover: null, grip: null }, this.lockedGrip = null, this.hideTimeout = null, this.activeColGripIndex = -1, this.activeRowGripIndex = -1, this.isInsideTable = !1, this.rowResizeObserver = null, this.grid = t.grid, this.getColumnCount = t.getColumnCount, this.getRowCount = t.getRowCount, this.isHeadingRow = t.isHeadingRow, this.isHeadingColumn = t.isHeadingColumn, this.onAction = t.onAction, this.onGripClick = t.onGripClick, this.onGripPopoverClose = t.onGripPopoverClose, this.i18n = t.i18n, this.drag = new js({
|
|
3231
3456
|
grid: this.grid,
|
|
3232
3457
|
onAction: this.onAction,
|
|
3233
3458
|
onDragStateChange: (e, n) => {
|
|
@@ -3248,7 +3473,7 @@ class Zs {
|
|
|
3248
3473
|
*/
|
|
3249
3474
|
setActiveGrip(t, e) {
|
|
3250
3475
|
const n = t === "col" ? this.colGrips[e] : this.rowGrips[e];
|
|
3251
|
-
n && (this.unlockGrip(), this.hideAllGripsExcept(n), this.applyActiveClasses(n), t === "col" ? n.style.height = `${
|
|
3476
|
+
n && (this.unlockGrip(), this.hideAllGripsExcept(n), this.applyActiveClasses(n), t === "col" ? n.style.height = `${X}px` : n.style.width = `${X}px`, this.lockedGrip = n, requestAnimationFrame(() => {
|
|
3252
3477
|
document.addEventListener("pointerdown", this.boundUnlockGrip);
|
|
3253
3478
|
}));
|
|
3254
3479
|
}
|
|
@@ -3269,19 +3494,20 @@ class Zs {
|
|
|
3269
3494
|
}), Array.from({ length: e }).forEach((n, s) => {
|
|
3270
3495
|
const o = this.createGripElement("row", s);
|
|
3271
3496
|
this.rowGrips.push(o), this.grid.appendChild(o);
|
|
3272
|
-
}), this.positionGrips();
|
|
3497
|
+
}), this.positionGrips(), this.observeRowHeights();
|
|
3273
3498
|
}
|
|
3274
3499
|
destroyGrips() {
|
|
3275
|
-
|
|
3500
|
+
var t;
|
|
3501
|
+
(t = this.rowResizeObserver) == null || t.disconnect(), this.rowResizeObserver = null, this.colGrips.forEach((e) => e.remove()), this.rowGrips.forEach((e) => e.remove()), this.colGrips = [], this.rowGrips = [], this.activeColGripIndex = -1, this.activeRowGripIndex = -1, this.isInsideTable = !1;
|
|
3276
3502
|
}
|
|
3277
3503
|
createGripElement(t, e) {
|
|
3278
3504
|
const n = document.createElement("div");
|
|
3279
|
-
n.className = v(
|
|
3280
|
-
const s = t === "col" ?
|
|
3281
|
-
return n.style.width = `${s}px`, n.style.height = `${o}px`, n.style.transform = "translate(-50%, -50%)", n.style.outline = "2px solid white", n.appendChild(
|
|
3282
|
-
this.isGripInteractionLocked() ||
|
|
3505
|
+
n.className = v(lt, Xt), n.setAttribute(Kt, ""), n.setAttribute(t === "col" ? ot : jt, String(e)), n.setAttribute("contenteditable", "false");
|
|
3506
|
+
const s = t === "col" ? oo : rt, o = t === "col" ? it : io, r = t === "col" ? it : rt;
|
|
3507
|
+
return n.style.width = `${s}px`, n.style.height = `${o}px`, n.style.transform = "translate(-50%, -50%)", n.style.outline = "2px solid white", n.appendChild(fe(t === "col" ? "horizontal" : "vertical")), n.addEventListener("pointerdown", this.boundPointerDown), n.addEventListener("mouseenter", () => {
|
|
3508
|
+
this.isGripInteractionLocked() || ys(n, t);
|
|
3283
3509
|
}), n.addEventListener("mouseleave", () => {
|
|
3284
|
-
this.isGripInteractionLocked() ||
|
|
3510
|
+
this.isGripInteractionLocked() || pt(n, t, r);
|
|
3285
3511
|
}), n;
|
|
3286
3512
|
}
|
|
3287
3513
|
/**
|
|
@@ -3292,21 +3518,33 @@ class Zs {
|
|
|
3292
3518
|
const t = this.grid.querySelectorAll(`[${g}]`);
|
|
3293
3519
|
if (!t[0])
|
|
3294
3520
|
return;
|
|
3295
|
-
const n =
|
|
3521
|
+
const n = St(this.grid);
|
|
3296
3522
|
this.colGrips.forEach((s, o) => {
|
|
3297
3523
|
if (o + 1 >= n.length)
|
|
3298
3524
|
return;
|
|
3299
3525
|
const r = (n[o] + n[o + 1]) / 2, l = s.style;
|
|
3300
|
-
l.top = `${
|
|
3526
|
+
l.top = `${-P / 2}px`, l.left = `${r}px`;
|
|
3301
3527
|
}), this.rowGrips.forEach((s, o) => {
|
|
3302
3528
|
if (o >= t.length)
|
|
3303
3529
|
return;
|
|
3304
3530
|
const r = t[o], l = r.offsetTop + r.offsetHeight / 2, a = s.style;
|
|
3305
|
-
a.left = `${
|
|
3531
|
+
a.left = `${-P / 2}px`, a.top = `${l}px`;
|
|
3532
|
+
});
|
|
3533
|
+
}
|
|
3534
|
+
/**
|
|
3535
|
+
* Set up ResizeObserver to watch for row height changes and reposition grips.
|
|
3536
|
+
*/
|
|
3537
|
+
observeRowHeights() {
|
|
3538
|
+
var e;
|
|
3539
|
+
(e = this.rowResizeObserver) == null || e.disconnect(), this.rowResizeObserver = new ResizeObserver(() => {
|
|
3540
|
+
this.positionGrips();
|
|
3541
|
+
}), this.grid.querySelectorAll(`[${g}]`).forEach((n) => {
|
|
3542
|
+
var s;
|
|
3543
|
+
(s = this.rowResizeObserver) == null || s.observe(n);
|
|
3306
3544
|
});
|
|
3307
3545
|
}
|
|
3308
3546
|
isGripInteractionLocked() {
|
|
3309
|
-
return this.
|
|
3547
|
+
return this.popoverState.popover !== null || this.lockedGrip !== null;
|
|
3310
3548
|
}
|
|
3311
3549
|
handleMouseOver(t) {
|
|
3312
3550
|
if (this.isGripInteractionLocked())
|
|
@@ -3316,7 +3554,7 @@ class Zs {
|
|
|
3316
3554
|
return;
|
|
3317
3555
|
this.clearHideTimeout();
|
|
3318
3556
|
const s = this.getCellPosition(n);
|
|
3319
|
-
s && (this.showColGrip(s.col), this.showRowGrip(s.row));
|
|
3557
|
+
s && (this.showColGrip(s.col), this.showRowGrip(s.row), this.isInsideTable = !0);
|
|
3320
3558
|
}
|
|
3321
3559
|
handleMouseLeave() {
|
|
3322
3560
|
this.isGripInteractionLocked() || this.scheduleHideAll();
|
|
@@ -3340,14 +3578,14 @@ class Zs {
|
|
|
3340
3578
|
const e = t ? "" : "none";
|
|
3341
3579
|
[...this.colGrips, ...this.rowGrips].forEach((n) => {
|
|
3342
3580
|
const s = n;
|
|
3343
|
-
!t && n === this.
|
|
3581
|
+
!t && n === this.popoverState.grip || (s.style.display = e);
|
|
3344
3582
|
});
|
|
3345
3583
|
}
|
|
3346
3584
|
/**
|
|
3347
3585
|
* Immediately hide all grips (no delay). Used when resize drag starts.
|
|
3348
3586
|
*/
|
|
3349
3587
|
hideAllGrips() {
|
|
3350
|
-
this.clearHideTimeout(), this.hideColGrip(), this.hideRowGrip();
|
|
3588
|
+
this.clearHideTimeout(), this.hideColGrip(), this.hideRowGrip(), this.isInsideTable = !1;
|
|
3351
3589
|
}
|
|
3352
3590
|
showColGrip(t) {
|
|
3353
3591
|
this.activeColGripIndex !== t && (this.hideColGrip(), this.activeColGripIndex = t, this.applyVisibleClasses(this.colGrips[t]));
|
|
@@ -3362,13 +3600,13 @@ class Zs {
|
|
|
3362
3600
|
this.activeRowGripIndex >= 0 && this.activeRowGripIndex < this.rowGrips.length && this.applyIdleClasses(this.rowGrips[this.activeRowGripIndex]), this.activeRowGripIndex = -1;
|
|
3363
3601
|
}
|
|
3364
3602
|
applyVisibleClasses(t) {
|
|
3365
|
-
const e = t;
|
|
3366
|
-
e.className = v(
|
|
3367
|
-
const
|
|
3368
|
-
|
|
3603
|
+
const e = t, n = e.hasAttribute(ot);
|
|
3604
|
+
pt(e, n ? "col" : "row", n ? it : rt), this.isInsideTable && (e.style.transition = "none"), e.className = v(lt, ro), e.setAttribute("data-blok-table-grip-visible", ""), this.isInsideTable && (e.offsetHeight, e.style.transition = "");
|
|
3605
|
+
const r = e.querySelector("svg");
|
|
3606
|
+
r && (r.classList.remove("text-white"), r.classList.add("text-gray-400"));
|
|
3369
3607
|
}
|
|
3370
3608
|
applyActiveClasses(t) {
|
|
3371
|
-
t
|
|
3609
|
+
Object.assign(t, { className: v(lt, lo) }), t.setAttribute("data-blok-table-grip-visible", "");
|
|
3372
3610
|
const e = t.querySelector("svg");
|
|
3373
3611
|
e && (e.classList.remove("text-gray-400", "opacity-0"), e.classList.add("text-white", "opacity-100"));
|
|
3374
3612
|
}
|
|
@@ -3378,8 +3616,8 @@ class Zs {
|
|
|
3378
3616
|
});
|
|
3379
3617
|
}
|
|
3380
3618
|
applyIdleClasses(t) {
|
|
3381
|
-
const e = t, n = e.hasAttribute(
|
|
3382
|
-
|
|
3619
|
+
const e = t, n = e.hasAttribute(ot), s = n ? "col" : "row", o = 12, r = n ? it + o : rt + o;
|
|
3620
|
+
this.isInsideTable && (e.style.transition = "none"), pt(e, s, r), e.className = v(lt, Xt), e.removeAttribute("data-blok-table-grip-visible"), this.isInsideTable && (e.offsetHeight, e.style.transition = "");
|
|
3383
3621
|
}
|
|
3384
3622
|
handleDragStateChange(t, e) {
|
|
3385
3623
|
[...this.colGrips, ...this.rowGrips].forEach((n) => {
|
|
@@ -3389,15 +3627,15 @@ class Zs {
|
|
|
3389
3627
|
}
|
|
3390
3628
|
scheduleHideAll() {
|
|
3391
3629
|
this.hideTimeout = setTimeout(() => {
|
|
3392
|
-
this.hideColGrip(), this.hideRowGrip(), this.hideTimeout = null;
|
|
3393
|
-
},
|
|
3630
|
+
this.hideColGrip(), this.hideRowGrip(), this.isInsideTable = !1, this.hideTimeout = null;
|
|
3631
|
+
}, so);
|
|
3394
3632
|
}
|
|
3395
3633
|
clearHideTimeout() {
|
|
3396
3634
|
this.hideTimeout !== null && (clearTimeout(this.hideTimeout), this.hideTimeout = null);
|
|
3397
3635
|
}
|
|
3398
3636
|
// ── Click / Drag discrimination ──────────────────────────────
|
|
3399
3637
|
handlePointerDown(t) {
|
|
3400
|
-
const n = t.target.closest(`[${
|
|
3638
|
+
const n = t.target.closest(`[${Kt}]`);
|
|
3401
3639
|
if (!n)
|
|
3402
3640
|
return;
|
|
3403
3641
|
t.preventDefault(), t.stopPropagation();
|
|
@@ -3407,141 +3645,58 @@ class Zs {
|
|
|
3407
3645
|
});
|
|
3408
3646
|
}
|
|
3409
3647
|
detectGripType(t) {
|
|
3410
|
-
const e = t.getAttribute(
|
|
3648
|
+
const e = t.getAttribute(ot);
|
|
3411
3649
|
if (e !== null)
|
|
3412
3650
|
return { type: "col", index: Number(e) };
|
|
3413
|
-
const n = t.getAttribute(
|
|
3651
|
+
const n = t.getAttribute(jt);
|
|
3414
3652
|
return n !== null ? { type: "row", index: Number(n) } : null;
|
|
3415
3653
|
}
|
|
3416
3654
|
// ── Popover menus ────────────────────────────────────────────
|
|
3417
3655
|
openPopover(t, e) {
|
|
3418
|
-
var
|
|
3419
|
-
this.
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
const s = t === "col" ? this.buildColumnMenu(e) : this.buildRowMenu(e);
|
|
3424
|
-
this.activePopover = new se({
|
|
3425
|
-
items: s,
|
|
3426
|
-
trigger: n,
|
|
3427
|
-
flippable: !0
|
|
3428
|
-
}), this.activePopoverGrip = n, this.activePopover.on(oe.Closed, () => {
|
|
3429
|
-
var r;
|
|
3430
|
-
this.activePopover !== null && (this.destroyPopover(), this.applyVisibleClasses(n), this.scheduleHideAll(), (r = this.onGripPopoverClose) == null || r.call(this));
|
|
3431
|
-
}), this.hideAllGripsExcept(n), this.applyActiveClasses(n), t === "col" ? n.style.height = `${K}px` : n.style.width = `${K}px`, this.activePopover.show(), (o = this.onGripClick) == null || o.call(this, t, e);
|
|
3432
|
-
}
|
|
3433
|
-
destroyPopover() {
|
|
3434
|
-
if (this.activePopover !== null) {
|
|
3435
|
-
const t = this.activePopover;
|
|
3436
|
-
this.activePopover = null, this.activePopoverGrip = null, t.destroy();
|
|
3437
|
-
}
|
|
3438
|
-
}
|
|
3439
|
-
buildColumnMenu(t) {
|
|
3440
|
-
const e = t === 0 ? [
|
|
3441
|
-
{
|
|
3442
|
-
type: F.Html,
|
|
3443
|
-
element: Ut({
|
|
3444
|
-
icon: Ve,
|
|
3445
|
-
label: "Header column",
|
|
3446
|
-
isActive: this.isHeadingColumn(),
|
|
3447
|
-
onToggle: () => {
|
|
3448
|
-
this.onAction({ type: "toggle-heading-column" });
|
|
3449
|
-
}
|
|
3450
|
-
})
|
|
3451
|
-
},
|
|
3452
|
-
{ type: F.Separator }
|
|
3453
|
-
] : [], n = [
|
|
3656
|
+
var n, s;
|
|
3657
|
+
this.popoverState = no(
|
|
3658
|
+
t,
|
|
3659
|
+
e,
|
|
3660
|
+
{ col: this.colGrips, row: this.rowGrips },
|
|
3454
3661
|
{
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3662
|
+
getColumnCount: this.getColumnCount,
|
|
3663
|
+
getRowCount: this.getRowCount,
|
|
3664
|
+
isHeadingRow: this.isHeadingRow,
|
|
3665
|
+
isHeadingColumn: this.isHeadingColumn,
|
|
3666
|
+
onAction: this.onAction,
|
|
3667
|
+
i18n: this.i18n
|
|
3461
3668
|
},
|
|
3462
3669
|
{
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3670
|
+
clearHideTimeout: () => this.clearHideTimeout(),
|
|
3671
|
+
hideAllGripsExcept: (o) => this.hideAllGripsExcept(o),
|
|
3672
|
+
applyActiveClasses: (o) => this.applyActiveClasses(o),
|
|
3673
|
+
applyVisibleClasses: (o) => this.applyVisibleClasses(o),
|
|
3674
|
+
scheduleHideAll: () => this.scheduleHideAll(),
|
|
3675
|
+
destroyPopover: () => this.destroyPopover(),
|
|
3676
|
+
onGripPopoverClose: this.onGripPopoverClose
|
|
3469
3677
|
}
|
|
3470
|
-
|
|
3471
|
-
{ type: F.Separator },
|
|
3472
|
-
{
|
|
3473
|
-
icon: Lt,
|
|
3474
|
-
title: "Delete",
|
|
3475
|
-
isDestructive: !0,
|
|
3476
|
-
isDisabled: !s,
|
|
3477
|
-
closeOnActivate: !0,
|
|
3478
|
-
onActivate: () => {
|
|
3479
|
-
this.onAction({ type: "delete-col", index: t });
|
|
3480
|
-
}
|
|
3481
|
-
}
|
|
3482
|
-
];
|
|
3483
|
-
return [...e, ...n, ...o];
|
|
3678
|
+
), (n = this.popoverState.popover) == null || n.show(), (s = this.onGripClick) == null || s.call(this, t, e);
|
|
3484
3679
|
}
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
icon: Ue,
|
|
3491
|
-
label: "Header row",
|
|
3492
|
-
isActive: this.isHeadingRow(),
|
|
3493
|
-
onToggle: () => {
|
|
3494
|
-
this.onAction({ type: "toggle-heading" });
|
|
3495
|
-
}
|
|
3496
|
-
})
|
|
3497
|
-
},
|
|
3498
|
-
{ type: F.Separator }
|
|
3499
|
-
] : [], n = [
|
|
3500
|
-
{
|
|
3501
|
-
icon: Fe,
|
|
3502
|
-
title: "Insert Row Above",
|
|
3503
|
-
closeOnActivate: !0,
|
|
3504
|
-
onActivate: () => {
|
|
3505
|
-
this.onAction({ type: "insert-row-above", index: t });
|
|
3506
|
-
}
|
|
3507
|
-
},
|
|
3508
|
-
{
|
|
3509
|
-
icon: ze,
|
|
3510
|
-
title: "Insert Row Below",
|
|
3511
|
-
closeOnActivate: !0,
|
|
3512
|
-
onActivate: () => {
|
|
3513
|
-
this.onAction({ type: "insert-row-below", index: t });
|
|
3514
|
-
}
|
|
3515
|
-
}
|
|
3516
|
-
], s = this.getRowCount() > 1, o = [
|
|
3517
|
-
{ type: F.Separator },
|
|
3518
|
-
{
|
|
3519
|
-
icon: Lt,
|
|
3520
|
-
title: "Delete",
|
|
3521
|
-
isDestructive: !0,
|
|
3522
|
-
isDisabled: !s,
|
|
3523
|
-
closeOnActivate: !0,
|
|
3524
|
-
onActivate: () => {
|
|
3525
|
-
this.onAction({ type: "delete-row", index: t });
|
|
3526
|
-
}
|
|
3527
|
-
}
|
|
3528
|
-
];
|
|
3529
|
-
return [...e, ...n, ...o];
|
|
3680
|
+
destroyPopover() {
|
|
3681
|
+
if (this.popoverState.popover !== null) {
|
|
3682
|
+
const t = this.popoverState.popover;
|
|
3683
|
+
this.popoverState = { popover: null, grip: null }, t.destroy();
|
|
3684
|
+
}
|
|
3530
3685
|
}
|
|
3531
3686
|
}
|
|
3532
|
-
const
|
|
3687
|
+
const co = 3, ho = 3, uo = [
|
|
3533
3688
|
"my-2",
|
|
3534
3689
|
"pr-5"
|
|
3535
|
-
],
|
|
3690
|
+
], po = [
|
|
3536
3691
|
"relative"
|
|
3537
3692
|
];
|
|
3538
|
-
class
|
|
3693
|
+
class So {
|
|
3539
3694
|
constructor({ data: t, config: e, api: n, readOnly: s, block: o }) {
|
|
3540
|
-
this.resize = null, this.addControls = null, this.rowColControls = null, this.cellBlocks = null, this.cellSelection = null, this.element = null, this.pendingHighlight = null, this.api = n, this.readOnly = s, this.config = e != null ? e : {}, this.data =
|
|
3695
|
+
this.resize = null, this.addControls = null, this.rowColControls = null, this.cellBlocks = null, this.cellSelection = null, this.element = null, this.pendingHighlight = null, this.api = n, this.readOnly = s, this.config = e != null ? e : {}, this.data = _s(t, e != null ? e : {}), this.grid = new gs({ readOnly: s }), this.blockId = o == null ? void 0 : o.id;
|
|
3541
3696
|
}
|
|
3542
3697
|
static get toolbox() {
|
|
3543
3698
|
return {
|
|
3544
|
-
icon:
|
|
3699
|
+
icon: je,
|
|
3545
3700
|
title: "Table",
|
|
3546
3701
|
titleKey: "tools.table.title",
|
|
3547
3702
|
searchTerms: ["table", "grid", "spreadsheet"]
|
|
@@ -3572,31 +3727,35 @@ class co {
|
|
|
3572
3727
|
render() {
|
|
3573
3728
|
var o;
|
|
3574
3729
|
const t = document.createElement("div");
|
|
3575
|
-
t.className = v(
|
|
3576
|
-
const e = this.data.content.length || this.config.rows ||
|
|
3577
|
-
return this.data.content.length > 0 && this.grid.fillGrid(s, this.data.content), this.data.colWidths &&
|
|
3730
|
+
t.className = v(uo, !this.readOnly && po, this.data.colWidths && Ce), t.setAttribute(E.tool, "table"), this.readOnly && t.setAttribute("data-blok-table-readonly", "");
|
|
3731
|
+
const e = this.data.content.length || this.config.rows || co, n = ((o = this.data.content[0]) == null ? void 0 : o.length) || this.config.cols || ho, s = this.grid.createGrid(e, n, this.data.colWidths);
|
|
3732
|
+
return this.data.content.length > 0 && this.grid.fillGrid(s, this.data.content), this.data.colWidths && ct(s, this.data.colWidths), t.appendChild(s), this.element = t, this.data.withHeadings && st(this.element, this.data.withHeadings), this.data.withHeadingColumn && z(this.element, this.data.withHeadingColumn), this.readOnly || (this.initCellBlocks(s), Os(s, this.cellBlocks)), t;
|
|
3578
3733
|
}
|
|
3579
3734
|
rendered() {
|
|
3580
|
-
var e, n;
|
|
3735
|
+
var e, n, s;
|
|
3581
3736
|
if (!this.element)
|
|
3582
3737
|
return;
|
|
3583
3738
|
const t = this.element.firstElementChild;
|
|
3584
3739
|
if (t) {
|
|
3585
3740
|
if (this.readOnly) {
|
|
3586
|
-
|
|
3741
|
+
Ps(t, this.data.content, this.api);
|
|
3587
3742
|
return;
|
|
3588
3743
|
}
|
|
3589
|
-
this.data.content = (n = (e = this.cellBlocks) == null ? void 0 : e.initializeCells(this.data.content)) != null ? n : this.data.content, this.
|
|
3744
|
+
if (this.data.content = (n = (e = this.cellBlocks) == null ? void 0 : e.initializeCells(this.data.content)) != null ? n : this.data.content, this.data.initialColWidth === void 0) {
|
|
3745
|
+
const o = (s = this.data.colWidths) != null ? s : J(t);
|
|
3746
|
+
this.data.initialColWidth = o.length > 0 ? Ds(o) : void 0;
|
|
3747
|
+
}
|
|
3748
|
+
this.initResize(t), this.initAddControls(t), this.initRowColControls(t), this.initCellSelection(t);
|
|
3590
3749
|
}
|
|
3591
3750
|
}
|
|
3592
3751
|
save(t) {
|
|
3593
3752
|
const e = t.firstElementChild, n = this.data.colWidths, s = this.readOnly ? this.data.content : this.grid.getData(e);
|
|
3594
|
-
return
|
|
3753
|
+
return x(x({
|
|
3595
3754
|
withHeadings: this.data.withHeadings,
|
|
3596
3755
|
withHeadingColumn: this.data.withHeadingColumn,
|
|
3597
3756
|
stretched: this.data.stretched,
|
|
3598
3757
|
content: s
|
|
3599
|
-
}, n ? { colWidths: n } : {});
|
|
3758
|
+
}, n ? { colWidths: n } : {}), this.data.initialColWidth !== void 0 ? { initialColWidth: this.data.initialColWidth } : {});
|
|
3600
3759
|
}
|
|
3601
3760
|
validate(t) {
|
|
3602
3761
|
return t.content.length > 0;
|
|
@@ -3624,73 +3783,78 @@ class co {
|
|
|
3624
3783
|
!this.readOnly && c && (this.initResize(c), this.initAddControls(c), this.initRowColControls(c));
|
|
3625
3784
|
}
|
|
3626
3785
|
destroy() {
|
|
3627
|
-
var t, e, n, s, o;
|
|
3628
|
-
(t = this.
|
|
3786
|
+
var t, e, n, s, o, r;
|
|
3787
|
+
(t = this.cellBlocks) == null || t.deleteAllBlocks(), (e = this.resize) == null || e.destroy(), this.resize = null, (n = this.addControls) == null || n.destroy(), this.addControls = null, (s = this.rowColControls) == null || s.destroy(), this.rowColControls = null, (o = this.cellBlocks) == null || o.destroy(), this.cellBlocks = null, (r = this.cellSelection) == null || r.destroy(), this.cellSelection = null, this.element = null;
|
|
3629
3788
|
}
|
|
3630
3789
|
deleteRowWithCleanup(t) {
|
|
3631
3790
|
var n;
|
|
3632
3791
|
const e = (n = this.element) == null ? void 0 : n.firstElementChild;
|
|
3633
|
-
e &&
|
|
3792
|
+
e && bt(e, t, this.grid, this.cellBlocks);
|
|
3634
3793
|
}
|
|
3635
3794
|
deleteColumnWithCleanup(t) {
|
|
3636
3795
|
var n;
|
|
3637
3796
|
const e = (n = this.element) == null ? void 0 : n.firstElementChild;
|
|
3638
|
-
e && (this.data.colWidths =
|
|
3797
|
+
e && (this.data.colWidths = vt(e, t, this.data.colWidths, this.grid, this.cellBlocks));
|
|
3639
3798
|
}
|
|
3640
3799
|
getBlockIdsInRow(t) {
|
|
3641
|
-
return
|
|
3800
|
+
return Ns(this.element, this.cellBlocks, t);
|
|
3642
3801
|
}
|
|
3643
3802
|
getBlockIdsInColumn(t) {
|
|
3644
|
-
return
|
|
3803
|
+
return Hs(this.element, this.cellBlocks, t);
|
|
3645
3804
|
}
|
|
3646
3805
|
initAddControls(t) {
|
|
3647
|
-
var
|
|
3648
|
-
(
|
|
3806
|
+
var n;
|
|
3807
|
+
if ((n = this.addControls) == null || n.destroy(), !this.element)
|
|
3808
|
+
return;
|
|
3809
|
+
const e = { addedCols: 0 };
|
|
3810
|
+
this.addControls = new ds({
|
|
3649
3811
|
wrapper: this.element,
|
|
3650
3812
|
grid: t,
|
|
3813
|
+
i18n: this.api.i18n,
|
|
3651
3814
|
onAddRow: () => {
|
|
3652
|
-
var
|
|
3653
|
-
this.grid.addRow(t),
|
|
3815
|
+
var s, o;
|
|
3816
|
+
this.grid.addRow(t), V(t, this.cellBlocks), st(this.element, this.data.withHeadings), z(this.element, this.data.withHeadingColumn), this.initResize(t), (s = this.addControls) == null || s.syncRowButtonWidth(), (o = this.rowColControls) == null || o.refresh();
|
|
3654
3817
|
},
|
|
3655
3818
|
onAddColumn: () => {
|
|
3656
|
-
var
|
|
3657
|
-
const
|
|
3658
|
-
this.grid.addColumn(t, void 0,
|
|
3819
|
+
var r, l, a;
|
|
3820
|
+
const s = (r = this.data.colWidths) != null ? r : J(t), o = this.data.initialColWidth !== void 0 ? Math.round(this.data.initialColWidth / 2 * 100) / 100 : yt(s);
|
|
3821
|
+
this.grid.addColumn(t, void 0, s, o), this.data.colWidths = [...s, o], V(t, this.cellBlocks), z(this.element, this.data.withHeadingColumn), this.initResize(t), (l = this.addControls) == null || l.syncRowButtonWidth(), (a = this.rowColControls) == null || a.refresh();
|
|
3659
3822
|
},
|
|
3660
3823
|
onDragStart: () => {
|
|
3661
|
-
var
|
|
3662
|
-
this.resize && (this.resize.enabled = !1), (
|
|
3824
|
+
var s, o;
|
|
3825
|
+
this.resize && (this.resize.enabled = !1), (s = this.rowColControls) == null || s.hideAllGrips(), (o = this.rowColControls) == null || o.setGripsDisplay(!1);
|
|
3663
3826
|
},
|
|
3664
3827
|
onDragAddRow: () => {
|
|
3665
|
-
this.grid.addRow(t),
|
|
3828
|
+
this.grid.addRow(t), V(t, this.cellBlocks), st(this.element, this.data.withHeadings), z(this.element, this.data.withHeadingColumn);
|
|
3666
3829
|
},
|
|
3667
3830
|
onDragRemoveRow: () => {
|
|
3668
|
-
const
|
|
3669
|
-
|
|
3831
|
+
const s = this.grid.getRowCount(t);
|
|
3832
|
+
s > 1 && xs(t, s - 1) && bt(t, s - 1, this.grid, this.cellBlocks);
|
|
3670
3833
|
},
|
|
3671
3834
|
onDragAddCol: () => {
|
|
3672
|
-
var
|
|
3673
|
-
const
|
|
3674
|
-
this.grid.addColumn(t, void 0,
|
|
3835
|
+
var r;
|
|
3836
|
+
const s = (r = this.data.colWidths) != null ? r : J(t), o = this.data.initialColWidth !== void 0 ? Math.round(this.data.initialColWidth / 2 * 100) / 100 : yt(s);
|
|
3837
|
+
this.grid.addColumn(t, void 0, s, o), this.data.colWidths = [...s, o], ct(t, this.data.colWidths), V(t, this.cellBlocks), z(this.element, this.data.withHeadingColumn), this.initResize(t), e.addedCols++, this.element && (this.element.scrollLeft = this.element.scrollWidth);
|
|
3675
3838
|
},
|
|
3676
3839
|
onDragRemoveCol: () => {
|
|
3677
|
-
const
|
|
3678
|
-
|
|
3840
|
+
const s = this.grid.getColumnCount(t);
|
|
3841
|
+
s <= 1 || !Ts(t, s - 1) || (this.data.colWidths = vt(t, s - 1, this.data.colWidths, this.grid, this.cellBlocks), this.data.colWidths && ct(t, this.data.colWidths), this.initResize(t), e.addedCols--);
|
|
3679
3842
|
},
|
|
3680
3843
|
onDragEnd: () => {
|
|
3681
|
-
var
|
|
3682
|
-
this.initResize(t), (
|
|
3844
|
+
var s, o;
|
|
3845
|
+
this.initResize(t), (s = this.addControls) == null || s.syncRowButtonWidth(), (o = this.rowColControls) == null || o.refresh(), this.element && (this.element.scrollLeft = e.addedCols > 0 ? this.element.scrollWidth : 0), e.addedCols = 0;
|
|
3683
3846
|
}
|
|
3684
|
-
})
|
|
3847
|
+
});
|
|
3685
3848
|
}
|
|
3686
3849
|
initRowColControls(t) {
|
|
3687
3850
|
var e;
|
|
3688
|
-
(e = this.rowColControls) == null || e.destroy(), this.element && (this.rowColControls = new
|
|
3851
|
+
(e = this.rowColControls) == null || e.destroy(), this.element && (this.rowColControls = new ao({
|
|
3689
3852
|
grid: t,
|
|
3690
3853
|
getColumnCount: () => this.grid.getColumnCount(t),
|
|
3691
3854
|
getRowCount: () => this.grid.getRowCount(t),
|
|
3692
3855
|
isHeadingRow: () => this.data.withHeadings,
|
|
3693
3856
|
isHeadingColumn: () => this.data.withHeadingColumn,
|
|
3857
|
+
i18n: this.api.i18n,
|
|
3694
3858
|
onAction: (n) => this.handleRowColAction(t, n),
|
|
3695
3859
|
onDragStateChange: (n) => {
|
|
3696
3860
|
var s;
|
|
@@ -3714,57 +3878,27 @@ class co {
|
|
|
3714
3878
|
}));
|
|
3715
3879
|
}
|
|
3716
3880
|
handleRowColAction(t, e) {
|
|
3717
|
-
var
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
break;
|
|
3728
|
-
case "insert-col-right":
|
|
3729
|
-
this.data.colWidths = qt(t, e.index + 1, this.data, this.grid), W(t, this.cellBlocks), this.pendingHighlight = { type: "col", index: e.index + 1 };
|
|
3730
|
-
break;
|
|
3731
|
-
case "move-row":
|
|
3732
|
-
this.grid.moveRow(t, e.fromIndex, e.toIndex);
|
|
3733
|
-
break;
|
|
3734
|
-
case "move-col":
|
|
3735
|
-
this.grid.moveColumn(t, e.fromIndex, e.toIndex), this.data.colWidths = Ls(this.data.colWidths, e.fromIndex, e.toIndex);
|
|
3736
|
-
break;
|
|
3737
|
-
case "delete-row": {
|
|
3738
|
-
pt(t, e.index, this.grid, this.cellBlocks);
|
|
3739
|
-
const o = this.grid.getRowCount(t), r = e.index < o ? e.index : e.index - 1;
|
|
3740
|
-
this.pendingHighlight = { type: "row", index: r };
|
|
3741
|
-
break;
|
|
3742
|
-
}
|
|
3743
|
-
case "delete-col": {
|
|
3744
|
-
this.data.colWidths = gt(t, e.index, this.data.colWidths, this.grid, this.cellBlocks), this.data.colWidths ? st(t, this.data.colWidths) : Ts(t);
|
|
3745
|
-
const o = this.grid.getColumnCount(t), r = e.index < o ? e.index : e.index - 1;
|
|
3746
|
-
this.pendingHighlight = { type: "col", index: r };
|
|
3747
|
-
break;
|
|
3748
|
-
}
|
|
3749
|
-
case "toggle-heading":
|
|
3750
|
-
this.data.withHeadings = !this.data.withHeadings, this.pendingHighlight = { type: "row", index: 0 };
|
|
3751
|
-
break;
|
|
3752
|
-
case "toggle-heading-column":
|
|
3753
|
-
this.data.withHeadingColumn = !this.data.withHeadingColumn, this.pendingHighlight = { type: "col", index: 0 };
|
|
3754
|
-
break;
|
|
3755
|
-
}
|
|
3756
|
-
ot(this.element, this.data.withHeadings), U(this.element, this.data.withHeadingColumn), this.initResize(t), (n = this.addControls) == null || n.syncRowButtonWidth(), (s = this.rowColControls) == null || s.refresh();
|
|
3881
|
+
var r, l, a, c, d;
|
|
3882
|
+
const n = Us(
|
|
3883
|
+
t,
|
|
3884
|
+
e,
|
|
3885
|
+
{ grid: this.grid, data: this.data, cellBlocks: this.cellBlocks }
|
|
3886
|
+
);
|
|
3887
|
+
if (this.data.colWidths = n.colWidths, this.data.withHeadings = n.withHeadings, this.data.withHeadingColumn = n.withHeadingColumn, this.pendingHighlight = n.pendingHighlight, st(this.element, this.data.withHeadings), z(this.element, this.data.withHeadingColumn), this.initResize(t), (r = this.addControls) == null || r.syncRowButtonWidth(), (l = this.rowColControls) == null || l.refresh(), !n.moveSelection)
|
|
3888
|
+
return;
|
|
3889
|
+
const { type: s, index: o } = n.moveSelection;
|
|
3890
|
+
s === "row" ? (a = this.cellSelection) == null || a.selectRow(o) : (c = this.cellSelection) == null || c.selectColumn(o), (d = this.rowColControls) == null || d.setActiveGrip(s, o);
|
|
3757
3891
|
}
|
|
3758
3892
|
initResize(t) {
|
|
3759
3893
|
var s, o;
|
|
3760
3894
|
(s = this.resize) == null || s.destroy();
|
|
3761
|
-
const e = this.data.colWidths === void 0, n = (o = this.data.colWidths) != null ? o :
|
|
3762
|
-
e ||
|
|
3895
|
+
const e = this.data.colWidths === void 0, n = (o = this.data.colWidths) != null ? o : J(t);
|
|
3896
|
+
e || qt(this.element), this.resize = new Gs(
|
|
3763
3897
|
t,
|
|
3764
3898
|
n,
|
|
3765
3899
|
(r) => {
|
|
3766
3900
|
var l;
|
|
3767
|
-
this.data.colWidths = r,
|
|
3901
|
+
this.data.colWidths = r, qt(this.element), (l = this.rowColControls) == null || l.positionGrips();
|
|
3768
3902
|
},
|
|
3769
3903
|
() => {
|
|
3770
3904
|
var r;
|
|
@@ -3779,7 +3913,7 @@ class co {
|
|
|
3779
3913
|
}
|
|
3780
3914
|
initCellBlocks(t) {
|
|
3781
3915
|
var e;
|
|
3782
|
-
this.cellBlocks = new
|
|
3916
|
+
this.cellBlocks = new fs({
|
|
3783
3917
|
api: this.api,
|
|
3784
3918
|
gridElement: t,
|
|
3785
3919
|
tableBlockId: (e = this.blockId) != null ? e : ""
|
|
@@ -3789,10 +3923,11 @@ class co {
|
|
|
3789
3923
|
var n;
|
|
3790
3924
|
(n = this.cellSelection) == null || n.destroy();
|
|
3791
3925
|
const e = this.api.rectangleSelection;
|
|
3792
|
-
this.cellSelection = new
|
|
3926
|
+
this.cellSelection = new Es({
|
|
3793
3927
|
grid: t,
|
|
3794
3928
|
rectangleSelection: e,
|
|
3795
3929
|
// Pass reference
|
|
3930
|
+
i18n: this.api.i18n,
|
|
3796
3931
|
onSelectionActiveChange: (s) => {
|
|
3797
3932
|
var o, r;
|
|
3798
3933
|
this.resize && (this.resize.enabled = !s), (o = this.addControls) == null || o.setInteractive(!s), (r = this.rowColControls) == null || r.setGripsDisplay(!s);
|
|
@@ -3806,10 +3941,10 @@ class co {
|
|
|
3806
3941
|
});
|
|
3807
3942
|
}
|
|
3808
3943
|
}
|
|
3809
|
-
const
|
|
3944
|
+
const G = (i) => {
|
|
3810
3945
|
const t = i.tagName;
|
|
3811
3946
|
return t === "B" || t === "STRONG";
|
|
3812
|
-
},
|
|
3947
|
+
}, ht = (i) => !!(i && i.nodeType === Node.ELEMENT_NODE && G(i)), be = (i) => i.textContent.length === 0, N = (i) => i ? i.nodeType === Node.ELEMENT_NODE && G(i) ? _(i) : N(i.parentNode) : null, _ = (i) => {
|
|
3813
3948
|
if (i.tagName === "STRONG")
|
|
3814
3949
|
return i;
|
|
3815
3950
|
const t = document.createElement("strong");
|
|
@@ -3818,7 +3953,7 @@ const z = (i) => {
|
|
|
3818
3953
|
}); i.firstChild; )
|
|
3819
3954
|
t.appendChild(i.firstChild);
|
|
3820
3955
|
return i.replaceWith(t), t;
|
|
3821
|
-
},
|
|
3956
|
+
}, go = (i) => {
|
|
3822
3957
|
const t = i.nextSibling;
|
|
3823
3958
|
if ((t == null ? void 0 : t.nodeType) === Node.TEXT_NODE)
|
|
3824
3959
|
return t;
|
|
@@ -3827,20 +3962,20 @@ const z = (i) => {
|
|
|
3827
3962
|
return null;
|
|
3828
3963
|
const n = i.ownerDocument.createTextNode("");
|
|
3829
3964
|
return e.insertBefore(n, t), n;
|
|
3830
|
-
},
|
|
3965
|
+
}, fo = (i) => {
|
|
3831
3966
|
if (!i.boldElement.isConnected)
|
|
3832
3967
|
return null;
|
|
3833
|
-
const t =
|
|
3968
|
+
const t = _(i.boldElement), e = i.boundary, s = e.isConnected && e.previousSibling === t ? e : go(t);
|
|
3834
3969
|
return s ? {
|
|
3835
3970
|
boundary: s,
|
|
3836
3971
|
boldElement: t
|
|
3837
3972
|
} : null;
|
|
3838
|
-
},
|
|
3973
|
+
}, wt = (i, t) => i ? i === t || t.contains(i) : !1, S = {
|
|
3839
3974
|
COLLAPSED_LENGTH: "data-blok-bold-collapsed-length",
|
|
3840
3975
|
COLLAPSED_ACTIVE: "data-blok-bold-collapsed-active",
|
|
3841
3976
|
PREV_LENGTH: "data-blok-bold-prev-length",
|
|
3842
3977
|
LEADING_WHITESPACE: "data-blok-bold-leading-ws"
|
|
3843
|
-
},
|
|
3978
|
+
}, L = class L {
|
|
3844
3979
|
constructor() {
|
|
3845
3980
|
this.records = /* @__PURE__ */ new Set();
|
|
3846
3981
|
}
|
|
@@ -3848,13 +3983,13 @@ const z = (i) => {
|
|
|
3848
3983
|
* Get the singleton instance
|
|
3849
3984
|
*/
|
|
3850
3985
|
static getInstance() {
|
|
3851
|
-
return
|
|
3986
|
+
return L.instance || (L.instance = new L()), L.instance;
|
|
3852
3987
|
}
|
|
3853
3988
|
/**
|
|
3854
3989
|
* Reset the singleton instance (for testing)
|
|
3855
3990
|
*/
|
|
3856
3991
|
static reset() {
|
|
3857
|
-
|
|
3992
|
+
L.instance && L.instance.records.clear(), L.instance = null;
|
|
3858
3993
|
}
|
|
3859
3994
|
/**
|
|
3860
3995
|
* Check if there are any active exit records
|
|
@@ -3923,7 +4058,7 @@ const z = (i) => {
|
|
|
3923
4058
|
* @param boldElement - The bold element to exit from
|
|
3924
4059
|
*/
|
|
3925
4060
|
exit(t, e) {
|
|
3926
|
-
const n =
|
|
4061
|
+
const n = _(e), s = n.parentNode;
|
|
3927
4062
|
if (s)
|
|
3928
4063
|
return be(n) ? this.removeEmptyBoldElement(t, n, s) : this.exitBoldWithContent(t, n, s);
|
|
3929
4064
|
}
|
|
@@ -3953,7 +4088,7 @@ const z = (i) => {
|
|
|
3953
4088
|
maintain() {
|
|
3954
4089
|
if (typeof document != "undefined")
|
|
3955
4090
|
for (const t of Array.from(this.records)) {
|
|
3956
|
-
const e =
|
|
4091
|
+
const e = fo(t);
|
|
3957
4092
|
if (!e) {
|
|
3958
4093
|
this.records.delete(t);
|
|
3959
4094
|
continue;
|
|
@@ -3990,12 +4125,12 @@ const z = (i) => {
|
|
|
3990
4125
|
*/
|
|
3991
4126
|
synchronize(t) {
|
|
3992
4127
|
var r, l;
|
|
3993
|
-
const e = (r = t == null ? void 0 : t.anchorNode) != null ? r : t == null ? void 0 : t.focusNode, n = e && e.nodeType === Node.ELEMENT_NODE ? e : e == null ? void 0 : e.parentElement, s = (l = n == null ? void 0 : n.closest(
|
|
4128
|
+
const e = (r = t == null ? void 0 : t.anchorNode) != null ? r : t == null ? void 0 : t.focusNode, n = e && e.nodeType === Node.ELEMENT_NODE ? e : e == null ? void 0 : e.parentElement, s = (l = n == null ? void 0 : n.closest(H(E.editor))) != null ? l : n == null ? void 0 : n.ownerDocument;
|
|
3994
4129
|
if (!s)
|
|
3995
4130
|
return;
|
|
3996
4131
|
const o = `strong[${S.COLLAPSED_ACTIVE}="true"]`;
|
|
3997
4132
|
s.querySelectorAll(o).forEach((a) => {
|
|
3998
|
-
var
|
|
4133
|
+
var kt;
|
|
3999
4134
|
const c = a.getAttribute(S.PREV_LENGTH), d = a.previousSibling;
|
|
4000
4135
|
if (!c || !d || d.nodeType !== Node.TEXT_NODE)
|
|
4001
4136
|
return;
|
|
@@ -4010,13 +4145,13 @@ const z = (i) => {
|
|
|
4010
4145
|
const b = y.match(/^[\u00A0\s]+/);
|
|
4011
4146
|
if (b && !a.hasAttribute(S.LEADING_WHITESPACE) && a.setAttribute(S.LEADING_WHITESPACE, b[0]), y.length === 0)
|
|
4012
4147
|
return;
|
|
4013
|
-
const
|
|
4148
|
+
const B = a.textContent, I = B + y, D = (kt = a.getAttribute(S.LEADING_WHITESPACE)) != null ? kt : "", W = D.length > 0 && B.length === 0 && !I.startsWith(D) ? D + I : I, $ = document.createTextNode(W);
|
|
4014
4149
|
for (; a.firstChild; )
|
|
4015
4150
|
a.removeChild(a.firstChild);
|
|
4016
|
-
if (a.appendChild(
|
|
4151
|
+
if (a.appendChild($), !(t != null && t.isCollapsed) || !wt(t.focusNode, p))
|
|
4017
4152
|
return;
|
|
4018
|
-
const
|
|
4019
|
-
|
|
4153
|
+
const Z = document.createRange(), Ee = $.textContent.length;
|
|
4154
|
+
Z.setStart($, Ee), Z.collapse(!0), t.removeAllRanges(), t.addRange(Z);
|
|
4020
4155
|
});
|
|
4021
4156
|
}
|
|
4022
4157
|
/**
|
|
@@ -4028,27 +4163,27 @@ const z = (i) => {
|
|
|
4028
4163
|
const e = (r = t == null ? void 0 : t.anchorNode) != null ? r : t == null ? void 0 : t.focusNode;
|
|
4029
4164
|
if (!e)
|
|
4030
4165
|
return;
|
|
4031
|
-
const n = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement, s = n == null ? void 0 : n.closest(
|
|
4166
|
+
const n = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement, s = n == null ? void 0 : n.closest(H(E.editor));
|
|
4032
4167
|
if (!s)
|
|
4033
4168
|
return;
|
|
4034
4169
|
s.querySelectorAll(`strong[${S.COLLAPSED_LENGTH}]`).forEach((l) => {
|
|
4035
|
-
var
|
|
4170
|
+
var D, M;
|
|
4036
4171
|
const a = l.getAttribute(S.COLLAPSED_LENGTH);
|
|
4037
4172
|
if (!a)
|
|
4038
4173
|
return;
|
|
4039
4174
|
const c = Number(a), d = l.textContent;
|
|
4040
4175
|
if (!Number.isFinite(c))
|
|
4041
4176
|
return;
|
|
4042
|
-
const h = d.length > c, p = h ? this.splitCollapsedBoldText(l, c, d) : null, m = l.getAttribute(S.PREV_LENGTH), f = m ? Number(m) : NaN, y = l.previousSibling, b = (y == null ? void 0 : y.nodeType) === Node.TEXT_NODE ? y : null,
|
|
4043
|
-
if (
|
|
4044
|
-
const
|
|
4045
|
-
b.textContent =
|
|
4046
|
-
const
|
|
4047
|
-
(
|
|
4177
|
+
const h = d.length > c, p = h ? this.splitCollapsedBoldText(l, c, d) : null, m = l.getAttribute(S.PREV_LENGTH), f = m ? Number(m) : NaN, y = l.previousSibling, b = (y == null ? void 0 : y.nodeType) === Node.TEXT_NODE ? y : null, B = (D = b == null ? void 0 : b.textContent) != null ? D : "", I = !!(m && Number.isFinite(f) && b && B.length > f);
|
|
4178
|
+
if (I && b) {
|
|
4179
|
+
const W = B.slice(0, f), $ = B.slice(f);
|
|
4180
|
+
b.textContent = W;
|
|
4181
|
+
const Z = document.createTextNode($);
|
|
4182
|
+
(M = l.parentNode) == null || M.insertBefore(Z, l.nextSibling);
|
|
4048
4183
|
}
|
|
4049
|
-
if (
|
|
4050
|
-
const
|
|
4051
|
-
|
|
4184
|
+
if (I && l.removeAttribute(S.PREV_LENGTH), t != null && t.isCollapsed && p && wt(t.focusNode, l)) {
|
|
4185
|
+
const W = document.createRange(), $ = p.textContent.length;
|
|
4186
|
+
W.setStart(p, $), W.collapse(!0), t.removeAllRanges(), t.addRange(W);
|
|
4052
4187
|
}
|
|
4053
4188
|
h && l.removeAttribute(S.COLLAPSED_LENGTH);
|
|
4054
4189
|
});
|
|
@@ -4108,7 +4243,7 @@ const z = (i) => {
|
|
|
4108
4243
|
const e = t.getRangeAt(0);
|
|
4109
4244
|
if (!e.collapsed)
|
|
4110
4245
|
return;
|
|
4111
|
-
const n =
|
|
4246
|
+
const n = N(e.startContainer);
|
|
4112
4247
|
(n == null ? void 0 : n.getAttribute(S.COLLAPSED_ACTIVE)) !== "true" && (this.moveCaretFromElementContainer(t, e) || this.moveCaretFromTextContainer(t, e));
|
|
4113
4248
|
}
|
|
4114
4249
|
/**
|
|
@@ -4167,7 +4302,7 @@ const z = (i) => {
|
|
|
4167
4302
|
this.setCaret(t, n, o.length);
|
|
4168
4303
|
return;
|
|
4169
4304
|
}
|
|
4170
|
-
const l =
|
|
4305
|
+
const l = N(n);
|
|
4171
4306
|
if (!l || e.startOffset !== n.textContent.length)
|
|
4172
4307
|
return;
|
|
4173
4308
|
const a = this.ensureFollowingTextNode(l, l.nextSibling);
|
|
@@ -4213,22 +4348,22 @@ const z = (i) => {
|
|
|
4213
4348
|
return e.tagName === "STRONG" || e.tagName === "B";
|
|
4214
4349
|
}
|
|
4215
4350
|
};
|
|
4216
|
-
|
|
4217
|
-
let A =
|
|
4218
|
-
const
|
|
4351
|
+
L.instance = null;
|
|
4352
|
+
let A = L;
|
|
4353
|
+
const mo = {
|
|
4219
4354
|
convertLegacyTags: !0,
|
|
4220
4355
|
normalizeWhitespace: !0,
|
|
4221
4356
|
removeEmpty: !0,
|
|
4222
4357
|
mergeAdjacent: !0,
|
|
4223
4358
|
preserveNode: null
|
|
4224
4359
|
};
|
|
4225
|
-
class
|
|
4360
|
+
class R {
|
|
4226
4361
|
/**
|
|
4227
4362
|
* Create a new normalization pass with specified options
|
|
4228
4363
|
* @param options - Configuration for the normalization pass
|
|
4229
4364
|
*/
|
|
4230
4365
|
constructor(t) {
|
|
4231
|
-
this.options =
|
|
4366
|
+
this.options = x(x({}, mo), t);
|
|
4232
4367
|
}
|
|
4233
4368
|
/**
|
|
4234
4369
|
* Run normalization on a scoped element
|
|
@@ -4246,10 +4381,10 @@ class x {
|
|
|
4246
4381
|
* @param options - Optional normalization configuration
|
|
4247
4382
|
*/
|
|
4248
4383
|
static normalizeAroundSelection(t, e) {
|
|
4249
|
-
const n =
|
|
4384
|
+
const n = R.findScopeFromSelection(t);
|
|
4250
4385
|
if (!n)
|
|
4251
4386
|
return;
|
|
4252
|
-
new
|
|
4387
|
+
new R(e).run(n);
|
|
4253
4388
|
}
|
|
4254
4389
|
/**
|
|
4255
4390
|
* Phase 1: Traverse the scope and normalize text nodes while collecting elements
|
|
@@ -4294,7 +4429,7 @@ class x {
|
|
|
4294
4429
|
processCollectedElements(t, e) {
|
|
4295
4430
|
this.options.convertLegacyTags && t.forEach((n) => {
|
|
4296
4431
|
if (n.isConnected) {
|
|
4297
|
-
const s =
|
|
4432
|
+
const s = _(n);
|
|
4298
4433
|
e.push(s);
|
|
4299
4434
|
}
|
|
4300
4435
|
}), e.forEach((n) => {
|
|
@@ -4324,7 +4459,7 @@ class x {
|
|
|
4324
4459
|
* @returns true if the element is empty and doesn't contain the preserved node
|
|
4325
4460
|
*/
|
|
4326
4461
|
isEmptyAndSafe(t) {
|
|
4327
|
-
return !(t.textContent.length === 0) || A.getInstance().isActivePlaceholder(t) ? !1 : !(this.options.preserveNode &&
|
|
4462
|
+
return !(t.textContent.length === 0) || A.getInstance().isActivePlaceholder(t) ? !1 : !(this.options.preserveNode && wt(this.options.preserveNode, t));
|
|
4328
4463
|
}
|
|
4329
4464
|
/**
|
|
4330
4465
|
* Merge a <strong> element with adjacent <strong> siblings
|
|
@@ -4332,12 +4467,12 @@ class x {
|
|
|
4332
4467
|
*/
|
|
4333
4468
|
mergeWithAdjacent(t) {
|
|
4334
4469
|
const e = t.previousSibling;
|
|
4335
|
-
if (e &&
|
|
4470
|
+
if (e && ht(e)) {
|
|
4336
4471
|
this.mergeStrongNodes(e, t);
|
|
4337
4472
|
return;
|
|
4338
4473
|
}
|
|
4339
4474
|
const n = t.nextSibling;
|
|
4340
|
-
n &&
|
|
4475
|
+
n && ht(n) && this.mergeStrongNodes(t, n);
|
|
4341
4476
|
}
|
|
4342
4477
|
/**
|
|
4343
4478
|
* Merge two <strong> elements by moving children from right to left
|
|
@@ -4345,7 +4480,7 @@ class x {
|
|
|
4345
4480
|
* @param right - The right strong element to merge from
|
|
4346
4481
|
*/
|
|
4347
4482
|
mergeStrongNodes(t, e) {
|
|
4348
|
-
const n =
|
|
4483
|
+
const n = _(t), s = _(e);
|
|
4349
4484
|
for (; s.firstChild; )
|
|
4350
4485
|
n.appendChild(s.firstChild);
|
|
4351
4486
|
s.remove();
|
|
@@ -4363,11 +4498,11 @@ class x {
|
|
|
4363
4498
|
const n = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
|
|
4364
4499
|
if (!n)
|
|
4365
4500
|
return null;
|
|
4366
|
-
const s = (l = n.closest('[data-blok-component="paragraph"]')) != null ? l : n.closest(
|
|
4367
|
-
return s || n.closest(
|
|
4501
|
+
const s = (l = n.closest('[data-blok-component="paragraph"]')) != null ? l : n.closest(H(E.elementContent));
|
|
4502
|
+
return s || n.closest(H(E.editor));
|
|
4368
4503
|
}
|
|
4369
4504
|
}
|
|
4370
|
-
const
|
|
4505
|
+
const T = class T {
|
|
4371
4506
|
constructor() {
|
|
4372
4507
|
this.handlers = /* @__PURE__ */ new Map(), this.listenersRegistered = !1, this.handleSelectionChange = () => {
|
|
4373
4508
|
const t = this.getSelection();
|
|
@@ -4400,13 +4535,13 @@ const k = class k {
|
|
|
4400
4535
|
* Get the singleton instance
|
|
4401
4536
|
*/
|
|
4402
4537
|
static getInstance() {
|
|
4403
|
-
return
|
|
4538
|
+
return T.instance || (T.instance = new T()), T.instance;
|
|
4404
4539
|
}
|
|
4405
4540
|
/**
|
|
4406
4541
|
* Reset the singleton instance (for testing)
|
|
4407
4542
|
*/
|
|
4408
4543
|
static reset() {
|
|
4409
|
-
|
|
4544
|
+
T.instance && (T.instance.removeListeners(), T.instance.handlers.clear()), T.instance = null;
|
|
4410
4545
|
}
|
|
4411
4546
|
/**
|
|
4412
4547
|
* Register a handler for an inline tool
|
|
@@ -4458,9 +4593,9 @@ const k = class k {
|
|
|
4458
4593
|
return !(e.meta && !o || e.ctrl && !t.ctrlKey);
|
|
4459
4594
|
}
|
|
4460
4595
|
};
|
|
4461
|
-
|
|
4462
|
-
let
|
|
4463
|
-
const
|
|
4596
|
+
T.instance = null;
|
|
4597
|
+
let At = T;
|
|
4598
|
+
const Co = (i, t) => {
|
|
4464
4599
|
try {
|
|
4465
4600
|
return i.intersectsNode(t);
|
|
4466
4601
|
} catch (e) {
|
|
@@ -4473,21 +4608,21 @@ const io = (i, t) => {
|
|
|
4473
4608
|
i.commonAncestorContainer,
|
|
4474
4609
|
NodeFilter.SHOW_TEXT,
|
|
4475
4610
|
{
|
|
4476
|
-
acceptNode: (t) =>
|
|
4611
|
+
acceptNode: (t) => Co(i, t) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT
|
|
4477
4612
|
}
|
|
4478
|
-
),
|
|
4613
|
+
), Y = (i, t) => i ? i.nodeType === Node.ELEMENT_NODE && t(i) ? i : Y(i.parentNode, t) : null, Se = (i, t) => Y(i, t) !== null, we = (i, t, e = {}) => {
|
|
4479
4614
|
if (i.collapsed)
|
|
4480
|
-
return
|
|
4615
|
+
return Y(i.startContainer, t) !== null;
|
|
4481
4616
|
const n = ve(i), s = [];
|
|
4482
4617
|
for (; n.nextNode(); ) {
|
|
4483
4618
|
const o = n.currentNode, r = o.textContent;
|
|
4484
4619
|
e.ignoreWhitespace && r.trim().length === 0 || r.length !== 0 && s.push(o);
|
|
4485
4620
|
}
|
|
4486
|
-
return s.length === 0 ?
|
|
4621
|
+
return s.length === 0 ? Y(i.startContainer, t) !== null : s.every((o) => Se(o, t));
|
|
4487
4622
|
}, Ae = (i, t) => {
|
|
4488
4623
|
const e = /* @__PURE__ */ new Set(), n = ve(i);
|
|
4489
4624
|
for (; n.nextNode(); ) {
|
|
4490
|
-
const s =
|
|
4625
|
+
const s = Y(n.currentNode, t);
|
|
4491
4626
|
s && e.add(s);
|
|
4492
4627
|
}
|
|
4493
4628
|
return Array.from(e);
|
|
@@ -4515,7 +4650,7 @@ const io = (i, t) => {
|
|
|
4515
4650
|
static initializeGlobalListeners() {
|
|
4516
4651
|
if (typeof document == "undefined")
|
|
4517
4652
|
return !1;
|
|
4518
|
-
const t =
|
|
4653
|
+
const t = At.getInstance();
|
|
4519
4654
|
return t.hasHandler("bold") || (t.register("bold", {
|
|
4520
4655
|
shortcut: { key: "b", meta: !0 },
|
|
4521
4656
|
onShortcut: (e, n) => {
|
|
@@ -4528,7 +4663,7 @@ const io = (i, t) => {
|
|
|
4528
4663
|
onInput: (e, n) => {
|
|
4529
4664
|
C.refreshSelectionState("input");
|
|
4530
4665
|
},
|
|
4531
|
-
onBeforeInput: (e) => e.inputType !== "formatBold" ? !1 : (
|
|
4666
|
+
onBeforeInput: (e) => e.inputType !== "formatBold" ? !1 : (R.normalizeAroundSelection(window.getSelection()), !0),
|
|
4532
4667
|
isRelevant: (e) => C.isSelectionInsideBlok(e)
|
|
4533
4668
|
}), C.guardKeydownListenerRegistered || (document.addEventListener("keydown", (e) => {
|
|
4534
4669
|
A.getInstance().guardBoundaryKeydown(e);
|
|
@@ -4540,7 +4675,7 @@ const io = (i, t) => {
|
|
|
4540
4675
|
* @param right - The right strong element to merge from
|
|
4541
4676
|
*/
|
|
4542
4677
|
static mergeStrongNodes(t, e) {
|
|
4543
|
-
const n =
|
|
4678
|
+
const n = _(t), s = _(e);
|
|
4544
4679
|
for (; s.firstChild; )
|
|
4545
4680
|
n.appendChild(s.firstChild);
|
|
4546
4681
|
return s.remove(), n;
|
|
@@ -4550,7 +4685,7 @@ const io = (i, t) => {
|
|
|
4550
4685
|
*/
|
|
4551
4686
|
render() {
|
|
4552
4687
|
return {
|
|
4553
|
-
icon:
|
|
4688
|
+
icon: Xe,
|
|
4554
4689
|
name: "bold",
|
|
4555
4690
|
onActivate: () => {
|
|
4556
4691
|
this.toggleBold();
|
|
@@ -4594,11 +4729,11 @@ const io = (i, t) => {
|
|
|
4594
4729
|
s && n && (s.removeAllRanges(), s.addRange(n));
|
|
4595
4730
|
const o = this.findBoldElementFromRangeOrSelection(n, s);
|
|
4596
4731
|
if (!o) {
|
|
4597
|
-
|
|
4732
|
+
R.normalizeAroundSelection(s), this.notifySelectionChange();
|
|
4598
4733
|
return;
|
|
4599
4734
|
}
|
|
4600
4735
|
const r = this.mergeAdjacentBold(o);
|
|
4601
|
-
this.selectElementContents(r),
|
|
4736
|
+
this.selectElementContents(r), R.normalizeAroundSelection(s), this.notifySelectionChange();
|
|
4602
4737
|
}
|
|
4603
4738
|
/**
|
|
4604
4739
|
* Remove bold tags (<strong>) while preserving content
|
|
@@ -4612,7 +4747,7 @@ const io = (i, t) => {
|
|
|
4612
4747
|
s.setAttribute("data-blok-bold-marker", `unwrap-${C.markerSequence++}`), s.appendChild(o), this.removeNestedBold(s), t.insertNode(s);
|
|
4613
4748
|
const r = document.createRange();
|
|
4614
4749
|
for (r.selectNodeContents(s), n.removeAllRanges(), n.addRange(r); ; ) {
|
|
4615
|
-
const d =
|
|
4750
|
+
const d = N(s);
|
|
4616
4751
|
if (!d)
|
|
4617
4752
|
break;
|
|
4618
4753
|
this.moveMarkerOutOfBold(s, d);
|
|
@@ -4621,7 +4756,7 @@ const io = (i, t) => {
|
|
|
4621
4756
|
this.unwrapElement(s), (l && a ? (() => {
|
|
4622
4757
|
const d = document.createRange();
|
|
4623
4758
|
return d.setStartBefore(l), d.setEndAfter(a), n.removeAllRanges(), n.addRange(d), d;
|
|
4624
|
-
})() : void 0) || n.removeAllRanges(),
|
|
4759
|
+
})() : void 0) || n.removeAllRanges(), R.normalizeAroundSelection(n), e.forEach((d) => {
|
|
4625
4760
|
be(d) && d.remove();
|
|
4626
4761
|
}), this.notifySelectionChange();
|
|
4627
4762
|
}
|
|
@@ -4687,7 +4822,7 @@ const io = (i, t) => {
|
|
|
4687
4822
|
* @param options.ignoreWhitespace - Whether to ignore whitespace-only text nodes
|
|
4688
4823
|
*/
|
|
4689
4824
|
isRangeBold(t, e) {
|
|
4690
|
-
return we(t,
|
|
4825
|
+
return we(t, G, e);
|
|
4691
4826
|
}
|
|
4692
4827
|
/**
|
|
4693
4828
|
* Remove nested bold tags from a root node
|
|
@@ -4719,20 +4854,20 @@ const io = (i, t) => {
|
|
|
4719
4854
|
*/
|
|
4720
4855
|
findBoldElementFromRangeOrSelection(t, e) {
|
|
4721
4856
|
if (!t)
|
|
4722
|
-
return e ?
|
|
4723
|
-
const n =
|
|
4857
|
+
return e ? N(e.focusNode) : null;
|
|
4858
|
+
const n = N(t.startContainer);
|
|
4724
4859
|
if (n)
|
|
4725
4860
|
return n;
|
|
4726
|
-
const s =
|
|
4727
|
-
return s || (t.startContainer.nodeType === Node.ELEMENT_NODE &&
|
|
4861
|
+
const s = N(t.commonAncestorContainer);
|
|
4862
|
+
return s || (t.startContainer.nodeType === Node.ELEMENT_NODE && G(t.startContainer) ? t.startContainer : null);
|
|
4728
4863
|
}
|
|
4729
4864
|
/**
|
|
4730
4865
|
* Merge adjacent bold elements into a single element
|
|
4731
4866
|
* @param element - The bold element to merge with adjacent elements
|
|
4732
4867
|
*/
|
|
4733
4868
|
mergeAdjacentBold(t) {
|
|
4734
|
-
const e =
|
|
4735
|
-
return o && o.nodeType === Node.ELEMENT_NODE &&
|
|
4869
|
+
const e = _(t), n = e.previousSibling, s = n && n.nodeType === Node.ELEMENT_NODE && G(n) ? C.mergeStrongNodes(n, e) : e, o = s.nextSibling;
|
|
4870
|
+
return o && o.nodeType === Node.ELEMENT_NODE && G(o) ? C.mergeStrongNodes(s, o) : s;
|
|
4736
4871
|
}
|
|
4737
4872
|
/**
|
|
4738
4873
|
* Toggle bold formatting for a collapsed selection (caret position)
|
|
@@ -4742,13 +4877,13 @@ const io = (i, t) => {
|
|
|
4742
4877
|
const t = window.getSelection();
|
|
4743
4878
|
if (!t || t.rangeCount === 0)
|
|
4744
4879
|
return;
|
|
4745
|
-
const e = t.getRangeAt(0), n =
|
|
4880
|
+
const e = t.getRangeAt(0), n = N(e.startContainer), s = (() => {
|
|
4746
4881
|
if (n && n.getAttribute(A.ATTR.COLLAPSED_ACTIVE) !== "true")
|
|
4747
4882
|
return A.getInstance().exit(t, n);
|
|
4748
4883
|
const o = n != null ? n : C.getBoundaryBold(e);
|
|
4749
4884
|
return o ? A.getInstance().exit(t, o) : this.startCollapsedBold(e);
|
|
4750
4885
|
})();
|
|
4751
|
-
document.dispatchEvent(new Event("selectionchange")), s && (t.removeAllRanges(), t.addRange(s)),
|
|
4886
|
+
document.dispatchEvent(new Event("selectionchange")), s && (t.removeAllRanges(), t.addRange(s)), R.normalizeAroundSelection(t), this.notifySelectionChange();
|
|
4752
4887
|
}
|
|
4753
4888
|
/**
|
|
4754
4889
|
* Insert a bold wrapper at the caret so newly typed text becomes bold
|
|
@@ -4756,7 +4891,7 @@ const io = (i, t) => {
|
|
|
4756
4891
|
*/
|
|
4757
4892
|
startCollapsedBold(t) {
|
|
4758
4893
|
const n = A.getInstance().enter(t, (o) => this.mergeAdjacentBold(o)), s = window.getSelection();
|
|
4759
|
-
return
|
|
4894
|
+
return R.normalizeAroundSelection(s), s && n && (s.removeAllRanges(), s.addRange(n)), this.notifySelectionChange(), n;
|
|
4760
4895
|
}
|
|
4761
4896
|
/**
|
|
4762
4897
|
* Notify listeners that the selection state has changed
|
|
@@ -4771,7 +4906,7 @@ const io = (i, t) => {
|
|
|
4771
4906
|
const t = window.getSelection();
|
|
4772
4907
|
if (!t)
|
|
4773
4908
|
return;
|
|
4774
|
-
const e = t.anchorNode, n = (e == null ? void 0 : e.nodeType) === Node.ELEMENT_NODE ? e : e == null ? void 0 : e.parentElement, s = n == null ? void 0 : n.closest(
|
|
4909
|
+
const e = t.anchorNode, n = (e == null ? void 0 : e.nodeType) === Node.ELEMENT_NODE ? e : e == null ? void 0 : e.parentElement, s = n == null ? void 0 : n.closest(H(E.editor));
|
|
4775
4910
|
if (!s)
|
|
4776
4911
|
return;
|
|
4777
4912
|
const o = s.querySelector("[data-blok-testid=inline-toolbar]");
|
|
@@ -4788,7 +4923,7 @@ const io = (i, t) => {
|
|
|
4788
4923
|
*/
|
|
4789
4924
|
static refreshSelectionState(t) {
|
|
4790
4925
|
const e = window.getSelection();
|
|
4791
|
-
A.getInstance().enforceLengths(e), A.getInstance().maintain(), A.getInstance().synchronize(e),
|
|
4926
|
+
A.getInstance().enforceLengths(e), A.getInstance().maintain(), A.getInstance().synchronize(e), R.normalizeAroundSelection(e, { normalizeWhitespace: !1 }), t === "input" && e && A.getInstance().moveCaretAfterBoundaryBold(e);
|
|
4792
4927
|
}
|
|
4793
4928
|
/**
|
|
4794
4929
|
* Ensure mutation observer is registered to convert legacy <b> tags
|
|
@@ -4801,7 +4936,7 @@ const io = (i, t) => {
|
|
|
4801
4936
|
C.isProcessingMutation = !0;
|
|
4802
4937
|
try {
|
|
4803
4938
|
const n = (s) => {
|
|
4804
|
-
s && new
|
|
4939
|
+
s && new R({ mergeAdjacent: !1, removeEmpty: !1, normalizeWhitespace: !1 }).run(s);
|
|
4805
4940
|
};
|
|
4806
4941
|
e.forEach((s) => {
|
|
4807
4942
|
s.addedNodes.forEach((o) => {
|
|
@@ -4826,7 +4961,7 @@ const io = (i, t) => {
|
|
|
4826
4961
|
*/
|
|
4827
4962
|
static findBlokScopeFromNode(t) {
|
|
4828
4963
|
const e = t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement;
|
|
4829
|
-
return !e || typeof e.closest != "function" ? null : e.closest(`${
|
|
4964
|
+
return !e || typeof e.closest != "function" ? null : e.closest(`${H(E.interface)}, ${H(E.editor)}`);
|
|
4830
4965
|
}
|
|
4831
4966
|
/**
|
|
4832
4967
|
* Get a bold element at the boundary of a collapsed range
|
|
@@ -4844,11 +4979,11 @@ const io = (i, t) => {
|
|
|
4844
4979
|
static getBoundaryBoldForText(t, e) {
|
|
4845
4980
|
const n = e.textContent.length;
|
|
4846
4981
|
if (t.startOffset === n)
|
|
4847
|
-
return
|
|
4982
|
+
return N(e);
|
|
4848
4983
|
if (t.startOffset !== 0)
|
|
4849
4984
|
return null;
|
|
4850
4985
|
const s = e.previousSibling;
|
|
4851
|
-
return
|
|
4986
|
+
return ht(s) ? s : null;
|
|
4852
4987
|
}
|
|
4853
4988
|
/**
|
|
4854
4989
|
* Get boundary bold when caret container is an element
|
|
@@ -4859,7 +4994,7 @@ const io = (i, t) => {
|
|
|
4859
4994
|
if (t.startOffset <= 0)
|
|
4860
4995
|
return null;
|
|
4861
4996
|
const n = e.childNodes[t.startOffset - 1];
|
|
4862
|
-
return
|
|
4997
|
+
return ht(n) ? n : null;
|
|
4863
4998
|
}
|
|
4864
4999
|
/**
|
|
4865
5000
|
* Check if a selection is inside the blok
|
|
@@ -4870,7 +5005,7 @@ const io = (i, t) => {
|
|
|
4870
5005
|
if (!e)
|
|
4871
5006
|
return !1;
|
|
4872
5007
|
const n = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
|
|
4873
|
-
return !!(n != null && n.closest(
|
|
5008
|
+
return !!(n != null && n.closest(H(E.editor)));
|
|
4874
5009
|
}
|
|
4875
5010
|
/**
|
|
4876
5011
|
* Get HTML content of a range with bold tags removed
|
|
@@ -4895,15 +5030,15 @@ const io = (i, t) => {
|
|
|
4895
5030
|
* @param range - The range to search for bold ancestors
|
|
4896
5031
|
*/
|
|
4897
5032
|
collectBoldAncestors(t) {
|
|
4898
|
-
return Ae(t,
|
|
5033
|
+
return Ae(t, G);
|
|
4899
5034
|
}
|
|
4900
5035
|
};
|
|
4901
5036
|
C.isInline = !0, C.title = "Bold", C.titleKey = "bold", C.markerSequence = 0, C.isProcessingMutation = !1, C.instances = /* @__PURE__ */ new Set(), C.guardKeydownListenerRegistered = !1, C.shortcut = "CMD+B";
|
|
4902
|
-
let
|
|
4903
|
-
const
|
|
5037
|
+
let Yt = C;
|
|
5038
|
+
const at = (i) => {
|
|
4904
5039
|
const t = i.tagName;
|
|
4905
5040
|
return t === "I" || t === "EM";
|
|
4906
|
-
},
|
|
5041
|
+
}, U = class U {
|
|
4907
5042
|
/**
|
|
4908
5043
|
* Sanitizer Rule
|
|
4909
5044
|
* Leave <i> and <em> tags
|
|
@@ -4920,7 +5055,7 @@ const rt = (i) => {
|
|
|
4920
5055
|
*/
|
|
4921
5056
|
render() {
|
|
4922
5057
|
return {
|
|
4923
|
-
icon:
|
|
5058
|
+
icon: Ye,
|
|
4924
5059
|
name: "italic",
|
|
4925
5060
|
onActivate: () => {
|
|
4926
5061
|
this.toggleItalic();
|
|
@@ -4979,7 +5114,7 @@ const rt = (i) => {
|
|
|
4979
5114
|
* @param options - Options for checking italic status
|
|
4980
5115
|
*/
|
|
4981
5116
|
isRangeItalic(t, e) {
|
|
4982
|
-
return we(t,
|
|
5117
|
+
return we(t, at, e);
|
|
4983
5118
|
}
|
|
4984
5119
|
/**
|
|
4985
5120
|
* Wrap selection with <i> tag
|
|
@@ -5019,21 +5154,21 @@ const rt = (i) => {
|
|
|
5019
5154
|
* @param node - The node to check
|
|
5020
5155
|
*/
|
|
5021
5156
|
hasItalicParent(t) {
|
|
5022
|
-
return Se(t,
|
|
5157
|
+
return Se(t, at);
|
|
5023
5158
|
}
|
|
5024
5159
|
/**
|
|
5025
5160
|
* Find an italic element in the parent chain
|
|
5026
5161
|
* @param node - The node to start searching from
|
|
5027
5162
|
*/
|
|
5028
5163
|
findItalicElement(t) {
|
|
5029
|
-
return
|
|
5164
|
+
return Y(t, at);
|
|
5030
5165
|
}
|
|
5031
5166
|
/**
|
|
5032
5167
|
* Collect all italic ancestor elements within a range
|
|
5033
5168
|
* @param range - The range to search for italic ancestors
|
|
5034
5169
|
*/
|
|
5035
5170
|
collectItalicAncestors(t) {
|
|
5036
|
-
return Ae(t,
|
|
5171
|
+
return Ae(t, at);
|
|
5037
5172
|
}
|
|
5038
5173
|
/**
|
|
5039
5174
|
* Get HTML content of a range with italic tags removed
|
|
@@ -5120,9 +5255,9 @@ const rt = (i) => {
|
|
|
5120
5255
|
n.insertBefore(l, e.nextSibling), n.insertBefore(t, l);
|
|
5121
5256
|
}
|
|
5122
5257
|
};
|
|
5123
|
-
|
|
5124
|
-
let
|
|
5125
|
-
const
|
|
5258
|
+
U.isInline = !0, U.title = "Italic", U.titleKey = "italic", U.shortcut = "CMD+I";
|
|
5259
|
+
let Zt = U;
|
|
5260
|
+
const K = class K {
|
|
5126
5261
|
/**
|
|
5127
5262
|
* @param api - Blok API
|
|
5128
5263
|
*/
|
|
@@ -5157,7 +5292,7 @@ const X = class X {
|
|
|
5157
5292
|
*/
|
|
5158
5293
|
render() {
|
|
5159
5294
|
return {
|
|
5160
|
-
icon:
|
|
5295
|
+
icon: Ze,
|
|
5161
5296
|
name: "link",
|
|
5162
5297
|
isActive: () => !!this.selection.findParentTag("A"),
|
|
5163
5298
|
children: {
|
|
@@ -5165,7 +5300,7 @@ const X = class X {
|
|
|
5165
5300
|
width: "200px",
|
|
5166
5301
|
items: [
|
|
5167
5302
|
{
|
|
5168
|
-
type:
|
|
5303
|
+
type: q.Html,
|
|
5169
5304
|
// Input is created in constructor, so it's always available here
|
|
5170
5305
|
element: this.nodes.input
|
|
5171
5306
|
}
|
|
@@ -5216,7 +5351,7 @@ const X = class X {
|
|
|
5216
5351
|
*/
|
|
5217
5352
|
getButtonElement() {
|
|
5218
5353
|
const t = document.querySelector(
|
|
5219
|
-
`${
|
|
5354
|
+
`${H(E.interface, Qe)} [data-blok-item-name="link"]`
|
|
5220
5355
|
);
|
|
5221
5356
|
return t && t !== this.nodes.button && (t.addEventListener("click", this.handleButtonClick, !0), this.nodes.button = t), t;
|
|
5222
5357
|
}
|
|
@@ -5273,7 +5408,7 @@ const X = class X {
|
|
|
5273
5408
|
this.notifier.show({
|
|
5274
5409
|
message: this.i18n.t("tools.link.invalidLink"),
|
|
5275
5410
|
style: "error"
|
|
5276
|
-
}),
|
|
5411
|
+
}), Je("Incorrect Link pasted", "warn", e);
|
|
5277
5412
|
return;
|
|
5278
5413
|
}
|
|
5279
5414
|
const n = this.prepareLink(e);
|
|
@@ -5350,27 +5485,27 @@ const X = class X {
|
|
|
5350
5485
|
t && t.setAttribute(e, n ? "true" : "false");
|
|
5351
5486
|
}
|
|
5352
5487
|
};
|
|
5353
|
-
|
|
5354
|
-
let
|
|
5355
|
-
const
|
|
5488
|
+
K.isInline = !0, K.title = "Link", K.titleKey = "link", K.shortcut = "CMD+K";
|
|
5489
|
+
let Jt = K;
|
|
5490
|
+
const wo = {
|
|
5356
5491
|
paragraph: { preserveBlank: !0 },
|
|
5357
5492
|
header: {},
|
|
5358
5493
|
list: {},
|
|
5359
5494
|
table: {}
|
|
5360
|
-
},
|
|
5495
|
+
}, Ao = {
|
|
5361
5496
|
bold: {},
|
|
5362
5497
|
italic: {},
|
|
5363
5498
|
link: {}
|
|
5364
5499
|
};
|
|
5365
5500
|
export {
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5501
|
+
Yt as Bold,
|
|
5502
|
+
xo as Convert,
|
|
5503
|
+
It as Header,
|
|
5504
|
+
Zt as Italic,
|
|
5505
|
+
Jt as Link,
|
|
5506
|
+
vo as List,
|
|
5507
|
+
Bt as Paragraph,
|
|
5508
|
+
So as Table,
|
|
5509
|
+
wo as defaultBlockTools,
|
|
5510
|
+
Ao as defaultInlineTools
|
|
5376
5511
|
};
|