@jackuait/blok 0.7.0-beta.1 → 0.7.0-beta.3
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/README.md +20 -4
- package/dist/blok.mjs +2 -2
- package/dist/chunks/{blok-ob9Fwr1L.mjs → blok-BlyYiZTm.mjs} +1840 -1654
- package/dist/chunks/{inline-tool-convert-CvFW2iie.mjs → constants-DEy4jBO5.mjs} +316 -297
- package/dist/chunks/{i18next-loader-Bu3vFvye.mjs → i18next-loader-Cfbv-x6v.mjs} +1 -1
- package/dist/chunks/index-Cu1w-sLZ.mjs +130 -0
- package/dist/chunks/{messages-D2NOpHn9.mjs → messages-0Pxnqd4N.mjs} +7 -0
- package/dist/chunks/{messages-GSByFygY.mjs → messages-0ZXYUq7S.mjs} +7 -0
- package/dist/{messages-BUl_Rcnj.mjs → chunks/messages-2OD2uUDS.mjs} +9 -2
- package/dist/{messages-CgTq3QhU.mjs → chunks/messages-7cEMfYzh.mjs} +7 -0
- package/dist/{messages-DlJbPF2T.mjs → chunks/messages-8mwfda1Q.mjs} +7 -0
- package/dist/{messages-D9ndgBnU.mjs → chunks/messages-B-FqWsBM.mjs} +7 -0
- package/dist/{messages-B217znr-.mjs → chunks/messages-B1jzqWiQ.mjs} +7 -0
- package/dist/{messages-BcpCubnC.mjs → chunks/messages-B5wk4Ezz.mjs} +7 -0
- package/dist/chunks/{messages-DRXWF0PV.mjs → messages-BAZ5Ld8x.mjs} +7 -0
- package/dist/{messages-CRJ_mchV.mjs → chunks/messages-BBhGp198.mjs} +7 -0
- package/dist/chunks/{messages-yHcs38yI.mjs → messages-BC9IjIb7.mjs} +7 -0
- package/dist/chunks/{messages-Cr94GzbX.mjs → messages-BFEmpeV-.mjs} +7 -0
- package/dist/chunks/{messages-ucTVgS5G.mjs → messages-BGqzTZy0.mjs} +7 -0
- package/dist/{messages-begYOTgC.mjs → chunks/messages-BICs1abK.mjs} +7 -0
- package/dist/chunks/{messages-DVQvl8Qj.mjs → messages-BJX6rOnd.mjs} +7 -0
- package/dist/chunks/{messages-Chb7k3Rg.mjs → messages-BL2bXRhN.mjs} +7 -0
- package/dist/{messages-Phkd7XmE.mjs → chunks/messages-BMs5qdlH.mjs} +7 -0
- package/dist/chunks/{messages-Cjjo7yHR.mjs → messages-BRsjUNwB.mjs} +7 -0
- package/dist/chunks/{messages-D4qqwVgQ.mjs → messages-BSqV8OUR.mjs} +7 -0
- package/dist/chunks/{messages-DviiFSv2.mjs → messages-BTqu3DfG.mjs} +7 -0
- package/dist/chunks/{messages-0AbcLMLm.mjs → messages-BXnDEsur.mjs} +7 -0
- package/dist/{messages-CmR9ftc_.mjs → chunks/messages-BYcre4-6.mjs} +7 -0
- package/dist/{messages-wmi-iFkH.mjs → chunks/messages-BZ9LRJf-.mjs} +7 -0
- package/dist/chunks/{messages-D00x4S8o.mjs → messages-BgypBy7y.mjs} +7 -0
- package/dist/{messages-96kNZDll.mjs → chunks/messages-BsuGf70G.mjs} +7 -0
- package/dist/chunks/{messages-v3GipbFl.mjs → messages-BwaoF4lQ.mjs} +7 -0
- package/dist/{messages-DDTQgImT.mjs → chunks/messages-C1l8_7-y.mjs} +7 -0
- package/dist/{messages-B1FZ8lxU.mjs → chunks/messages-C5NA_r9v.mjs} +7 -0
- package/dist/{messages-Cs8zmZ3L.mjs → chunks/messages-C6zgZ5pA.mjs} +7 -0
- package/dist/chunks/{messages-ZjUAIWb1.mjs → messages-CAo5ghFI.mjs} +7 -0
- package/dist/{messages-D5S1Dnpm.mjs → chunks/messages-CH9qlJ9I.mjs} +7 -0
- package/dist/{messages-D7u2bmP2.mjs → chunks/messages-CI0HqAeS.mjs} +7 -0
- package/dist/{messages-DH_jBeED.mjs → chunks/messages-CJJtms9k.mjs} +7 -0
- package/dist/{messages-CDBLbUOQ.mjs → chunks/messages-CM2hJqk6.mjs} +7 -0
- package/dist/chunks/{messages-8IPXkrDl.mjs → messages-CRMiDPIQ.mjs} +7 -0
- package/dist/chunks/{messages-Dzzn6XoD.mjs → messages-CWsZuBj1.mjs} +7 -0
- package/dist/chunks/{messages-CW4c4cRk.mjs → messages-C_gLHo6A.mjs} +7 -0
- package/dist/{messages-CH4hrauY.mjs → chunks/messages-Cbu-NUDn.mjs} +7 -0
- package/dist/{messages-RonBBCnh.mjs → chunks/messages-Cjb_MCeh.mjs} +7 -0
- package/dist/chunks/{messages-BJ6zrz2j.mjs → messages-ClXYO9Wn.mjs} +7 -0
- package/dist/chunks/{messages-CrCYPCk3.mjs → messages-CsH20vhP.mjs} +7 -0
- package/dist/{messages-CzK0LEhb.mjs → chunks/messages-CsjAGhzA.mjs} +7 -0
- package/dist/chunks/{messages-BZlmVRwn.mjs → messages-Cx7VKFOE.mjs} +7 -0
- package/dist/chunks/{messages-0E0AkrNu.mjs → messages-D3JeBwxo.mjs} +7 -0
- package/dist/chunks/{messages-D85FqxgY.mjs → messages-D541fieJ.mjs} +7 -0
- package/dist/{messages-4v4MuVEc.mjs → chunks/messages-D7XPdglc.mjs} +7 -0
- package/dist/{messages-BC8IN4Bf.mjs → chunks/messages-DBhylfvt.mjs} +7 -0
- package/dist/chunks/{messages-B8WNljW3.mjs → messages-DCA120lW.mjs} +7 -0
- package/dist/chunks/{messages-Cr49Nt3U.mjs → messages-DCf_xZMN.mjs} +7 -0
- package/dist/chunks/{messages-VDriF5Qy.mjs → messages-DDwXKCpe.mjs} +7 -0
- package/dist/{messages-b1EdvUm0.mjs → chunks/messages-DNKDlxcy.mjs} +7 -0
- package/dist/{messages-L_kl2Qvh.mjs → chunks/messages-DPvEjrGK.mjs} +7 -0
- package/dist/chunks/{messages-62v-CLC-.mjs → messages-DQ-AkNxA.mjs} +7 -0
- package/dist/chunks/{messages-DdK-nFGm.mjs → messages-DVuvkNap.mjs} +7 -0
- package/dist/{messages-DnVlmiNT.mjs → chunks/messages-DaglyqUT.mjs} +7 -0
- package/dist/{messages-Bm-E4iRC.mjs → chunks/messages-Di0bAfwA.mjs} +7 -0
- package/dist/{messages-D1mn7Zd5.mjs → chunks/messages-DuLct0Yr.mjs} +7 -0
- package/dist/{messages-8DeO60Oo.mjs → chunks/messages-DzEYYhZh.mjs} +7 -0
- package/dist/chunks/{messages-CfiyT2Wi.mjs → messages-DznNGAB2.mjs} +7 -0
- package/dist/chunks/{messages-DXktiao_.mjs → messages-DzoIzyu8.mjs} +7 -0
- package/dist/{messages-C_4otP7U.mjs → chunks/messages-QYOGmket.mjs} +7 -0
- package/dist/chunks/{messages-nefz1S71.mjs → messages-cEjGDAgI.mjs} +7 -0
- package/dist/chunks/{messages-jrncnb-H.mjs → messages-ddhvrdpE.mjs} +7 -0
- package/dist/chunks/{messages-DzqM3Fel.mjs → messages-mwfNK5nZ.mjs} +7 -0
- package/dist/chunks/{messages-Cl6ayUaq.mjs → messages-nG_vNDte.mjs} +7 -0
- package/dist/{messages-C4jL-90N.mjs → chunks/messages-tDq3Owh7.mjs} +7 -0
- package/dist/{messages-BI43k_BD.mjs → chunks/messages-x6VJVZKx.mjs} +7 -0
- package/dist/full.mjs +2 -2
- package/dist/locales.mjs +87 -80
- package/dist/{messages-D2NOpHn9.mjs → messages-0Pxnqd4N.mjs} +7 -0
- package/dist/{messages-GSByFygY.mjs → messages-0ZXYUq7S.mjs} +7 -0
- package/dist/{chunks/messages-BUl_Rcnj.mjs → messages-2OD2uUDS.mjs} +9 -2
- package/dist/{chunks/messages-CgTq3QhU.mjs → messages-7cEMfYzh.mjs} +7 -0
- package/dist/{chunks/messages-DlJbPF2T.mjs → messages-8mwfda1Q.mjs} +7 -0
- package/dist/{chunks/messages-D9ndgBnU.mjs → messages-B-FqWsBM.mjs} +7 -0
- package/dist/{chunks/messages-B217znr-.mjs → messages-B1jzqWiQ.mjs} +7 -0
- package/dist/{chunks/messages-BcpCubnC.mjs → messages-B5wk4Ezz.mjs} +7 -0
- package/dist/{messages-DRXWF0PV.mjs → messages-BAZ5Ld8x.mjs} +7 -0
- package/dist/{chunks/messages-CRJ_mchV.mjs → messages-BBhGp198.mjs} +7 -0
- package/dist/{messages-yHcs38yI.mjs → messages-BC9IjIb7.mjs} +7 -0
- package/dist/{messages-Cr94GzbX.mjs → messages-BFEmpeV-.mjs} +7 -0
- package/dist/{messages-ucTVgS5G.mjs → messages-BGqzTZy0.mjs} +7 -0
- package/dist/{chunks/messages-begYOTgC.mjs → messages-BICs1abK.mjs} +7 -0
- package/dist/{messages-DVQvl8Qj.mjs → messages-BJX6rOnd.mjs} +7 -0
- package/dist/{messages-Chb7k3Rg.mjs → messages-BL2bXRhN.mjs} +7 -0
- package/dist/{chunks/messages-Phkd7XmE.mjs → messages-BMs5qdlH.mjs} +7 -0
- package/dist/{messages-Cjjo7yHR.mjs → messages-BRsjUNwB.mjs} +7 -0
- package/dist/{messages-D4qqwVgQ.mjs → messages-BSqV8OUR.mjs} +7 -0
- package/dist/{messages-DviiFSv2.mjs → messages-BTqu3DfG.mjs} +7 -0
- package/dist/{messages-0AbcLMLm.mjs → messages-BXnDEsur.mjs} +7 -0
- package/dist/{chunks/messages-CmR9ftc_.mjs → messages-BYcre4-6.mjs} +7 -0
- package/dist/{chunks/messages-wmi-iFkH.mjs → messages-BZ9LRJf-.mjs} +7 -0
- package/dist/{messages-D00x4S8o.mjs → messages-BgypBy7y.mjs} +7 -0
- package/dist/{chunks/messages-96kNZDll.mjs → messages-BsuGf70G.mjs} +7 -0
- package/dist/{messages-v3GipbFl.mjs → messages-BwaoF4lQ.mjs} +7 -0
- package/dist/{chunks/messages-DDTQgImT.mjs → messages-C1l8_7-y.mjs} +7 -0
- package/dist/{chunks/messages-B1FZ8lxU.mjs → messages-C5NA_r9v.mjs} +7 -0
- package/dist/{chunks/messages-Cs8zmZ3L.mjs → messages-C6zgZ5pA.mjs} +7 -0
- package/dist/{messages-ZjUAIWb1.mjs → messages-CAo5ghFI.mjs} +7 -0
- package/dist/{chunks/messages-D5S1Dnpm.mjs → messages-CH9qlJ9I.mjs} +7 -0
- package/dist/{chunks/messages-D7u2bmP2.mjs → messages-CI0HqAeS.mjs} +7 -0
- package/dist/{chunks/messages-DH_jBeED.mjs → messages-CJJtms9k.mjs} +7 -0
- package/dist/{chunks/messages-CDBLbUOQ.mjs → messages-CM2hJqk6.mjs} +7 -0
- package/dist/{messages-8IPXkrDl.mjs → messages-CRMiDPIQ.mjs} +7 -0
- package/dist/{messages-Dzzn6XoD.mjs → messages-CWsZuBj1.mjs} +7 -0
- package/dist/{messages-CW4c4cRk.mjs → messages-C_gLHo6A.mjs} +7 -0
- package/dist/{chunks/messages-CH4hrauY.mjs → messages-Cbu-NUDn.mjs} +7 -0
- package/dist/{chunks/messages-RonBBCnh.mjs → messages-Cjb_MCeh.mjs} +7 -0
- package/dist/{messages-BJ6zrz2j.mjs → messages-ClXYO9Wn.mjs} +7 -0
- package/dist/{messages-CrCYPCk3.mjs → messages-CsH20vhP.mjs} +7 -0
- package/dist/{chunks/messages-CzK0LEhb.mjs → messages-CsjAGhzA.mjs} +7 -0
- package/dist/{messages-BZlmVRwn.mjs → messages-Cx7VKFOE.mjs} +7 -0
- package/dist/{messages-0E0AkrNu.mjs → messages-D3JeBwxo.mjs} +7 -0
- package/dist/{messages-D85FqxgY.mjs → messages-D541fieJ.mjs} +7 -0
- package/dist/{chunks/messages-4v4MuVEc.mjs → messages-D7XPdglc.mjs} +7 -0
- package/dist/{chunks/messages-BC8IN4Bf.mjs → messages-DBhylfvt.mjs} +7 -0
- package/dist/{messages-B8WNljW3.mjs → messages-DCA120lW.mjs} +7 -0
- package/dist/{messages-Cr49Nt3U.mjs → messages-DCf_xZMN.mjs} +7 -0
- package/dist/{messages-VDriF5Qy.mjs → messages-DDwXKCpe.mjs} +7 -0
- package/dist/{chunks/messages-b1EdvUm0.mjs → messages-DNKDlxcy.mjs} +7 -0
- package/dist/{chunks/messages-L_kl2Qvh.mjs → messages-DPvEjrGK.mjs} +7 -0
- package/dist/{messages-62v-CLC-.mjs → messages-DQ-AkNxA.mjs} +7 -0
- package/dist/{messages-DdK-nFGm.mjs → messages-DVuvkNap.mjs} +7 -0
- package/dist/{chunks/messages-DnVlmiNT.mjs → messages-DaglyqUT.mjs} +7 -0
- package/dist/{chunks/messages-Bm-E4iRC.mjs → messages-Di0bAfwA.mjs} +7 -0
- package/dist/{chunks/messages-D1mn7Zd5.mjs → messages-DuLct0Yr.mjs} +7 -0
- package/dist/{chunks/messages-8DeO60Oo.mjs → messages-DzEYYhZh.mjs} +7 -0
- package/dist/{messages-CfiyT2Wi.mjs → messages-DznNGAB2.mjs} +7 -0
- package/dist/{messages-DXktiao_.mjs → messages-DzoIzyu8.mjs} +7 -0
- package/dist/{chunks/messages-C_4otP7U.mjs → messages-QYOGmket.mjs} +7 -0
- package/dist/{messages-nefz1S71.mjs → messages-cEjGDAgI.mjs} +7 -0
- package/dist/{messages-jrncnb-H.mjs → messages-ddhvrdpE.mjs} +7 -0
- package/dist/{messages-DzqM3Fel.mjs → messages-mwfNK5nZ.mjs} +7 -0
- package/dist/{messages-Cl6ayUaq.mjs → messages-nG_vNDte.mjs} +7 -0
- package/dist/{chunks/messages-C4jL-90N.mjs → messages-tDq3Owh7.mjs} +7 -0
- package/dist/{chunks/messages-BI43k_BD.mjs → messages-x6VJVZKx.mjs} +7 -0
- package/dist/tools.mjs +443 -338
- package/package.json +1 -1
- package/src/components/i18n/locales/am/messages.json +7 -0
- package/src/components/i18n/locales/ar/messages.json +7 -0
- package/src/components/i18n/locales/az/messages.json +7 -0
- package/src/components/i18n/locales/bg/messages.json +7 -0
- package/src/components/i18n/locales/bn/messages.json +7 -0
- package/src/components/i18n/locales/bs/messages.json +7 -0
- package/src/components/i18n/locales/cs/messages.json +7 -0
- package/src/components/i18n/locales/da/messages.json +7 -0
- package/src/components/i18n/locales/de/messages.json +7 -0
- package/src/components/i18n/locales/dv/messages.json +7 -0
- package/src/components/i18n/locales/el/messages.json +7 -0
- package/src/components/i18n/locales/en/messages.json +7 -0
- package/src/components/i18n/locales/es/messages.json +7 -0
- package/src/components/i18n/locales/et/messages.json +7 -0
- package/src/components/i18n/locales/fa/messages.json +7 -0
- package/src/components/i18n/locales/fi/messages.json +7 -0
- package/src/components/i18n/locales/fil/messages.json +7 -0
- package/src/components/i18n/locales/fr/messages.json +7 -0
- package/src/components/i18n/locales/gu/messages.json +7 -0
- package/src/components/i18n/locales/he/messages.json +7 -0
- package/src/components/i18n/locales/hi/messages.json +7 -0
- package/src/components/i18n/locales/hr/messages.json +7 -0
- package/src/components/i18n/locales/hu/messages.json +7 -0
- package/src/components/i18n/locales/hy/messages.json +7 -0
- package/src/components/i18n/locales/id/messages.json +7 -0
- package/src/components/i18n/locales/it/messages.json +7 -0
- package/src/components/i18n/locales/ja/messages.json +7 -0
- package/src/components/i18n/locales/ka/messages.json +7 -0
- package/src/components/i18n/locales/km/messages.json +7 -0
- package/src/components/i18n/locales/kn/messages.json +7 -0
- package/src/components/i18n/locales/ko/messages.json +7 -0
- package/src/components/i18n/locales/ku/messages.json +7 -0
- package/src/components/i18n/locales/lo/messages.json +7 -0
- package/src/components/i18n/locales/lt/messages.json +7 -0
- package/src/components/i18n/locales/lv/messages.json +7 -0
- package/src/components/i18n/locales/mk/messages.json +7 -0
- package/src/components/i18n/locales/ml/messages.json +7 -0
- package/src/components/i18n/locales/mn/messages.json +7 -0
- package/src/components/i18n/locales/mr/messages.json +7 -0
- package/src/components/i18n/locales/ms/messages.json +7 -0
- package/src/components/i18n/locales/my/messages.json +7 -0
- package/src/components/i18n/locales/ne/messages.json +7 -0
- package/src/components/i18n/locales/nl/messages.json +7 -0
- package/src/components/i18n/locales/no/messages.json +7 -0
- package/src/components/i18n/locales/pa/messages.json +7 -0
- package/src/components/i18n/locales/pl/messages.json +7 -0
- package/src/components/i18n/locales/ps/messages.json +7 -0
- package/src/components/i18n/locales/pt/messages.json +7 -0
- package/src/components/i18n/locales/ro/messages.json +7 -0
- package/src/components/i18n/locales/ru/messages.json +7 -0
- package/src/components/i18n/locales/sd/messages.json +7 -0
- package/src/components/i18n/locales/si/messages.json +7 -0
- package/src/components/i18n/locales/sk/messages.json +7 -0
- package/src/components/i18n/locales/sl/messages.json +7 -0
- package/src/components/i18n/locales/sq/messages.json +7 -0
- package/src/components/i18n/locales/sr/messages.json +7 -0
- package/src/components/i18n/locales/sv/messages.json +7 -0
- package/src/components/i18n/locales/sw/messages.json +7 -0
- package/src/components/i18n/locales/ta/messages.json +7 -0
- package/src/components/i18n/locales/te/messages.json +7 -0
- package/src/components/i18n/locales/th/messages.json +7 -0
- package/src/components/i18n/locales/tr/messages.json +7 -0
- package/src/components/i18n/locales/ug/messages.json +7 -0
- package/src/components/i18n/locales/uk/messages.json +7 -0
- package/src/components/i18n/locales/ur/messages.json +7 -0
- package/src/components/i18n/locales/vi/messages.json +7 -0
- package/src/components/i18n/locales/yi/messages.json +7 -0
- package/src/components/i18n/locales/zh/messages.json +7 -0
- package/src/components/modules/blockEvents/composers/keyboardNavigation.ts +44 -2
- package/src/components/modules/blockEvents/index.ts +1 -3
- package/src/components/modules/blockManager/blockManager.ts +16 -0
- package/src/components/modules/blockManager/operations.ts +106 -9
- package/src/components/modules/blockSelection.ts +2 -0
- package/src/components/modules/caret.ts +49 -4
- package/src/components/modules/drag/DragController.ts +34 -2
- package/src/components/modules/paste/handlers/blok-data-handler.ts +50 -3
- package/src/components/modules/toolbar/index.ts +11 -16
- package/src/components/modules/ui.ts +22 -0
- package/src/components/ui/toolbox.ts +19 -3
- package/src/components/utils/notifier/draw.ts +116 -14
- package/src/components/utils/notifier/index.ts +31 -4
- package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.const.ts +2 -2
- package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.ts +6 -7
- package/src/components/utils/popover/components/popover-item/popover-item-separator/popover-item-separator.const.ts +2 -2
- package/src/components/utils/popover/popover-abstract.ts +2 -0
- package/src/components/utils/popover/popover-desktop.ts +39 -2
- package/src/stories/Block.stories.ts +21 -0
- package/src/stories/EditorModes.stories.ts +19 -0
- package/src/stories/InlineToolbar.stories.ts +41 -9
- package/src/stories/MarkerColors.stories.ts +48 -52
- package/src/stories/Notifier.stories.ts +19 -1
- package/src/stories/Placeholder.stories.ts +12 -0
- package/src/stories/Popover.stories.ts +26 -0
- package/src/stories/Selection.stories.ts +6 -0
- package/src/stories/Table.stories.ts +12 -0
- package/src/stories/Toolbar.stories.ts +9 -0
- package/src/stories/Toolbox.stories.ts +4 -0
- package/src/stories/Tooltip.stories.ts +6 -0
- package/src/stories/helpers.ts +63 -8
- package/src/styles/main.css +46 -0
- package/src/tools/header/index.ts +121 -22
- package/src/tools/table/index.ts +2 -3
- package/src/tools/table/table-add-controls.ts +29 -1
- package/src/tools/table/table-cell-blocks.ts +93 -0
- package/src/tools/toggle/constants.ts +2 -2
- package/src/tools/toggle/dom-builder.ts +32 -4
- package/src/tools/toggle/index.ts +26 -4
- package/src/tools/toggle/toggle-keyboard.ts +19 -2
- package/src/tools/toggle/toggle-lifecycle.ts +1 -0
- package/src/tools/toggle/toggle-shortcuts.ts +18 -8
- package/types/utils/popover/popover.d.ts +8 -0
- package/dist/chunks/index-CZmRzRIX.mjs +0 -78
package/dist/tools.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
var Ye = Object.defineProperty, Xe = Object.defineProperties;
|
|
2
2
|
var Ze = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
3
|
+
var $t = Object.getOwnPropertySymbols;
|
|
4
4
|
var Je = Object.prototype.hasOwnProperty, Qe = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
5
|
+
var Ft = (r, t, e) => t in r ? Ye(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, T = (r, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
|
-
Je.call(t, e) &&
|
|
8
|
-
if (
|
|
9
|
-
for (var e of
|
|
10
|
-
Qe.call(t, e) &&
|
|
7
|
+
Je.call(t, e) && Ft(r, e, t[e]);
|
|
8
|
+
if ($t)
|
|
9
|
+
for (var e of $t(t))
|
|
10
|
+
Qe.call(t, e) && Ft(r, e, t[e]);
|
|
11
11
|
return r;
|
|
12
12
|
}, V = (r, t) => Xe(r, Ze(t));
|
|
13
|
-
import { t as w, D as B,
|
|
14
|
-
import { ao as Ii } from "./chunks/
|
|
15
|
-
const
|
|
13
|
+
import { t as w, D as B, az as tn, aA as en, ar as D, aB as ke, aC as Dt, aD as nn, aE as Mt, aF as on, aG as sn, aa as rn, aH as ln, aI as an, aJ as cn, aK as dn, aL as hn, aM as un, aN as pn, aO as gn, aP as fn, aQ as Ee, aR as Ae, aS as xe, n as mn, o as qt, ah as zt, af as Cn, aT as bn, aU as Vt, P as F, aV as Te, aW as yn, aX as vn, X as Re, a1 as Be, aY as Sn, aZ as wn, a_ as kn, ac as Le, a$ as En, b0 as An, b1 as xn, b2 as Tn, b3 as Rn, b4 as Bn, O as Kt, b5 as Ln, b6 as Ut, b7 as jt, b8 as Yt, R as In, b9 as Dn, x as Hn, ba as Xt, bb as Pn, K as $, bc as On, bd as Nn, S as lt, be as _n, l as Mn, ak as Gn } from "./chunks/constants-DEy4jBO5.mjs";
|
|
14
|
+
import { ao as Ii } from "./chunks/constants-DEy4jBO5.mjs";
|
|
15
|
+
const Gt = (r) => {
|
|
16
16
|
if (!r || !r.includes("data-blok-fake-background"))
|
|
17
17
|
return r;
|
|
18
18
|
const t = document.createElement("div");
|
|
@@ -33,7 +33,7 @@ const Nt = (r) => {
|
|
|
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
|
+
], Wn = [
|
|
37
37
|
"empty:focus:before:pointer-events-none",
|
|
38
38
|
"empty:focus:before:text-gray-text",
|
|
39
39
|
"empty:focus:before:cursor-text",
|
|
@@ -42,7 +42,7 @@ const Nt = (r) => {
|
|
|
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
|
+
], $n = [
|
|
46
46
|
"empty:in-data-[blok-empty=true]:before:pointer-events-none",
|
|
47
47
|
"empty:in-data-[blok-empty=true]:before:text-gray-text",
|
|
48
48
|
"empty:in-data-[blok-empty=true]:before:cursor-text",
|
|
@@ -51,22 +51,22 @@ const Nt = (r) => {
|
|
|
51
51
|
"[[data-blok-empty=true]_&[data-empty=true]]:before:text-gray-text",
|
|
52
52
|
"[[data-blok-empty=true]_&[data-empty=true]]:before:cursor-text",
|
|
53
53
|
"[[data-blok-empty=true]_&[data-empty=true]]:before:content-[attr(data-blok-placeholder-active)]"
|
|
54
|
-
],
|
|
54
|
+
], Fn = (r) => {
|
|
55
55
|
const t = r.innerHTML.trim();
|
|
56
56
|
return t === "" || t === "<br>";
|
|
57
|
-
},
|
|
57
|
+
}, qn = (r) => {
|
|
58
58
|
r.innerHTML === "<br>" && (r.innerHTML = "");
|
|
59
59
|
const t = window.getSelection();
|
|
60
60
|
if (!t) return;
|
|
61
61
|
const e = document.createRange();
|
|
62
62
|
e.selectNodeContents(r), e.collapse(!0), t.removeAllRanges(), t.addRange(e);
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
},
|
|
63
|
+
}, zn = (r) => {
|
|
64
|
+
Fn(r) && qn(r);
|
|
65
|
+
}, kt = (r, t, e = "data-placeholder") => {
|
|
66
66
|
r.setAttribute(e, t != null ? t : "");
|
|
67
|
-
const n = () =>
|
|
67
|
+
const n = () => zn(r);
|
|
68
68
|
r.addEventListener("focus", n), r.addEventListener("input", n);
|
|
69
|
-
},
|
|
69
|
+
}, Vn = (r) => {
|
|
70
70
|
const t = document.createElement("div");
|
|
71
71
|
t.innerHTML = r.trim();
|
|
72
72
|
const e = document.createDocumentFragment();
|
|
@@ -119,11 +119,11 @@ const Nt = (r) => {
|
|
|
119
119
|
t.className = w(
|
|
120
120
|
this.api.styles.block,
|
|
121
121
|
ht.WRAPPER_CLASSES,
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
Wn,
|
|
123
|
+
$n
|
|
124
124
|
), t.setAttribute(B.tool, "paragraph"), t.contentEditable = "false";
|
|
125
125
|
const e = this.buildInlineStyles();
|
|
126
|
-
return Object.keys(e).length > 0 && Object.assign(t.style, e), this._data.text ? t.innerHTML = this._data.text : this.readOnly && (t.innerHTML = "<br>"), this.readOnly || (t.contentEditable = "true", t.addEventListener("keyup", this.onKeyUp),
|
|
126
|
+
return Object.keys(e).length > 0 && Object.assign(t.style, e), this._data.text ? t.innerHTML = this._data.text : this.readOnly && (t.innerHTML = "<br>"), this.readOnly || (t.contentEditable = "true", t.addEventListener("keyup", this.onKeyUp), kt(t, this.api.i18n.t(this._placeholder), "data-blok-placeholder-active")), t;
|
|
127
127
|
}
|
|
128
128
|
/**
|
|
129
129
|
* Return Tool's view
|
|
@@ -143,7 +143,7 @@ const Nt = (r) => {
|
|
|
143
143
|
if (!this._element)
|
|
144
144
|
return;
|
|
145
145
|
this._data.text += t.text;
|
|
146
|
-
const e =
|
|
146
|
+
const e = Vn(t.text);
|
|
147
147
|
this._element.appendChild(e), this._element.normalize();
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
@@ -164,7 +164,7 @@ const Nt = (r) => {
|
|
|
164
164
|
*/
|
|
165
165
|
save(t) {
|
|
166
166
|
return {
|
|
167
|
-
text:
|
|
167
|
+
text: Gt(t.innerHTML)
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
@@ -256,31 +256,29 @@ ht.WRAPPER_CLASSES = [
|
|
|
256
256
|
"[&>p:first-of-type]:mt-0",
|
|
257
257
|
"[&>p:last-of-type]:mb-0"
|
|
258
258
|
];
|
|
259
|
-
let
|
|
260
|
-
const
|
|
261
|
-
toggleOpen: "data-blok-toggle-open",
|
|
262
|
-
toggleArrow: "data-blok-toggle-arrow",
|
|
263
|
-
toggleContent: "data-blok-toggle-content"
|
|
264
|
-
}, Vn = (r) => {
|
|
259
|
+
let Zt = ht;
|
|
260
|
+
const Kn = (r) => {
|
|
265
261
|
const { data: t, readOnly: e, isOpen: n, keydownHandler: o, onArrowClick: s } = r, i = document.createElement("div");
|
|
266
|
-
i.className = w(
|
|
267
|
-
const l =
|
|
262
|
+
i.className = w(nn, Dt), i.setAttribute(B.tool, Mt), i.setAttribute(D.toggleOpen, String(n));
|
|
263
|
+
const l = Ie(n, s), a = Un(t, e, o);
|
|
268
264
|
return i.appendChild(l), i.appendChild(a), { wrapper: i, arrowElement: l, contentElement: a };
|
|
269
|
-
},
|
|
270
|
-
const
|
|
271
|
-
return
|
|
272
|
-
|
|
273
|
-
}),
|
|
265
|
+
}, Ie = (r, t, e = {}) => {
|
|
266
|
+
const n = document.createElement("span");
|
|
267
|
+
return n.className = en, n.setAttribute(D.toggleArrow, ""), n.setAttribute(B.mutationFree, "true"), n.setAttribute("role", "button"), n.setAttribute("tabindex", "0"), n.setAttribute("aria-label", r ? "Collapse" : "Expand"), n.setAttribute("aria-expanded", String(r)), e.contentEditableFalse === !0 && (n.contentEditable = "false"), n.innerHTML = ke, r && (n.style.transform = "rotate(90deg)"), n.addEventListener("click", (o) => {
|
|
268
|
+
o.stopPropagation(), t();
|
|
269
|
+
}), n.addEventListener("keydown", (o) => {
|
|
270
|
+
(o.key === "Enter" || o.key === " ") && (o.preventDefault(), o.stopPropagation(), t());
|
|
271
|
+
}), n;
|
|
274
272
|
}, Un = (r, t, e) => {
|
|
275
273
|
const n = document.createElement("div");
|
|
276
|
-
return n.className =
|
|
274
|
+
return n.className = on, n.setAttribute(D.toggleContent, ""), n.contentEditable = t ? "false" : "true", n.innerHTML = r.text, e && n.addEventListener("keydown", e), n;
|
|
277
275
|
}, jn = (r) => {
|
|
278
|
-
const t =
|
|
279
|
-
return t.contentElement &&
|
|
280
|
-
},
|
|
276
|
+
const t = Kn(r);
|
|
277
|
+
return t.contentElement && kt(t.contentElement, r.placeholder), t;
|
|
278
|
+
}, vt = (r, t, e) => {
|
|
281
279
|
const { style: n } = r;
|
|
282
|
-
n.transform = e ? "rotate(90deg)" : "", r.setAttribute("aria-label", e ? "Collapse" : "Expand"), t.setAttribute(
|
|
283
|
-
},
|
|
280
|
+
n.transform = e ? "rotate(90deg)" : "", r.setAttribute("aria-label", e ? "Collapse" : "Expand"), r.setAttribute("aria-expanded", String(e)), t.setAttribute(D.toggleOpen, String(e));
|
|
281
|
+
}, Ht = (r, t, e) => {
|
|
284
282
|
const n = r.blocks.getChildren(t);
|
|
285
283
|
for (const o of n)
|
|
286
284
|
e ? o.holder.classList.remove("hidden") : o.holder.classList.add("hidden");
|
|
@@ -330,7 +328,13 @@ const _t = "toggle", Yt = "tools.toggle.placeholder", qn = "outline-hidden py-[3
|
|
|
330
328
|
text: t.text || "",
|
|
331
329
|
level: n ? e : this.defaultLevel.number
|
|
332
330
|
};
|
|
333
|
-
|
|
331
|
+
if (t.isToggleable === !0 && (o.isToggleable = !0), o.text) {
|
|
332
|
+
const s = document.createElement("div");
|
|
333
|
+
s.innerHTML = o.text;
|
|
334
|
+
const i = s.querySelector(`[${D.toggleArrow}]`);
|
|
335
|
+
i && (i.remove(), o.text = s.innerHTML);
|
|
336
|
+
}
|
|
337
|
+
return o;
|
|
334
338
|
}
|
|
335
339
|
/**
|
|
336
340
|
* Return Tool's view
|
|
@@ -347,6 +351,20 @@ const _t = "toggle", Yt = "tools.toggle.placeholder", qn = "outline-hidden py-[3
|
|
|
347
351
|
rendered() {
|
|
348
352
|
this._data.isToggleable && this.updateChildrenVisibility();
|
|
349
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* Expand the toggle heading (no-op if not toggleable or already expanded).
|
|
356
|
+
* Can be called externally via block.call('expand').
|
|
357
|
+
*/
|
|
358
|
+
expand() {
|
|
359
|
+
!this._data.isToggleable || this._isOpen || (this._isOpen = !0, this._arrowElement && this._element && vt(this._arrowElement, this._element, this._isOpen), this.updateChildrenVisibility());
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Collapse the toggle heading (no-op if not toggleable or already collapsed).
|
|
363
|
+
* Can be called externally via block.call('collapse').
|
|
364
|
+
*/
|
|
365
|
+
collapse() {
|
|
366
|
+
!this._data.isToggleable || !this._isOpen || (this._isOpen = !1, this._arrowElement && this._element && vt(this._arrowElement, this._element, this._isOpen), this.updateChildrenVisibility());
|
|
367
|
+
}
|
|
350
368
|
/**
|
|
351
369
|
* Returns header block tunes config
|
|
352
370
|
*
|
|
@@ -367,7 +385,7 @@ const _t = "toggle", Yt = "tools.toggle.placeholder", qn = "outline-hidden py-[3
|
|
|
367
385
|
};
|
|
368
386
|
}), o = Array.isArray(n) ? n : [n], s = this.api.i18n.t("tools.header.toggleHeading");
|
|
369
387
|
return o.push({
|
|
370
|
-
icon:
|
|
388
|
+
icon: ke,
|
|
371
389
|
title: s !== "tools.header.toggleHeading" ? s : "Toggle heading",
|
|
372
390
|
onActivate: () => this.toggleIsToggleable(),
|
|
373
391
|
closeOnActivate: !0,
|
|
@@ -387,7 +405,7 @@ const _t = "toggle", Yt = "tools.toggle.placeholder", qn = "outline-hidden py-[3
|
|
|
387
405
|
var c, d, h, u;
|
|
388
406
|
const n = e.data, o = (c = n == null ? void 0 : n.level) != null ? c : this.defaultLevel.number, s = P.DEFAULT_LEVELS.find((p) => p.number === o), i = (d = s == null ? void 0 : s.name) != null ? d : `Heading ${o}`, l = this.resolveToolboxEntryTitle(e, i);
|
|
389
407
|
return {
|
|
390
|
-
icon: (u = (h = e.icon) != null ? h : s == null ? void 0 : s.icon) != null ? u :
|
|
408
|
+
icon: (u = (h = e.icon) != null ? h : s == null ? void 0 : s.icon) != null ? u : sn,
|
|
391
409
|
title: l,
|
|
392
410
|
onActivate: () => this.setLevel(o),
|
|
393
411
|
closeOnActivate: !0,
|
|
@@ -406,7 +424,7 @@ const _t = "toggle", Yt = "tools.toggle.placeholder", qn = "outline-hidden py-[3
|
|
|
406
424
|
* @returns Resolved title string
|
|
407
425
|
*/
|
|
408
426
|
resolveToolboxEntryTitle(t, e) {
|
|
409
|
-
return
|
|
427
|
+
return rn(this.api.i18n, t, e);
|
|
410
428
|
}
|
|
411
429
|
/**
|
|
412
430
|
* Callback for Block's settings buttons
|
|
@@ -427,7 +445,12 @@ const _t = "toggle", Yt = "tools.toggle.placeholder", qn = "outline-hidden py-[3
|
|
|
427
445
|
* @param data - saved data to merge with current block
|
|
428
446
|
*/
|
|
429
447
|
merge(t) {
|
|
430
|
-
|
|
448
|
+
const e = document.createElement("div");
|
|
449
|
+
e.innerHTML = t.text;
|
|
450
|
+
const n = e.querySelector(`[${D.toggleArrow}]`);
|
|
451
|
+
n && n.remove();
|
|
452
|
+
const o = e.innerHTML, s = this._element.querySelector(`[${D.toggleArrow}]`);
|
|
453
|
+
s && s.remove(), this._element.insertAdjacentHTML("beforeend", o), s && this._data.isToggleable && this._element.prepend(s);
|
|
431
454
|
}
|
|
432
455
|
/**
|
|
433
456
|
* Validate Text block data:
|
|
@@ -446,11 +469,13 @@ const _t = "toggle", Yt = "tools.toggle.placeholder", qn = "outline-hidden py-[3
|
|
|
446
469
|
* @returns saved data
|
|
447
470
|
*/
|
|
448
471
|
save(t) {
|
|
449
|
-
const e = {
|
|
450
|
-
|
|
472
|
+
const e = t.cloneNode(!0), n = e.querySelector(`[${D.toggleArrow}]`);
|
|
473
|
+
n && n.remove();
|
|
474
|
+
const o = {
|
|
475
|
+
text: e.innerHTML,
|
|
451
476
|
level: this.currentLevel.number
|
|
452
477
|
};
|
|
453
|
-
return this._data.isToggleable === !0 && (
|
|
478
|
+
return this._data.isToggleable === !0 && (o.isToggleable = !0), o;
|
|
454
479
|
}
|
|
455
480
|
/**
|
|
456
481
|
* Allow Header to be converted to/from other blocks
|
|
@@ -487,7 +512,8 @@ const _t = "toggle", Yt = "tools.toggle.placeholder", qn = "outline-hidden py-[3
|
|
|
487
512
|
* @returns Current data
|
|
488
513
|
*/
|
|
489
514
|
get data() {
|
|
490
|
-
|
|
515
|
+
const t = this._element.querySelector(`[${D.toggleArrow}]`);
|
|
516
|
+
return t && t.remove(), this._data.text = this._element.innerHTML, t && this._data.isToggleable && this._element.prepend(t), this._data.level = this.currentLevel.number, this._data;
|
|
491
517
|
}
|
|
492
518
|
/**
|
|
493
519
|
* Store data in plugin:
|
|
@@ -502,13 +528,13 @@ const _t = "toggle", Yt = "tools.toggle.placeholder", qn = "outline-hidden py-[3
|
|
|
502
528
|
e.innerHTML = this._element.innerHTML, this._element.parentNode.replaceChild(e, this._element), this._element = e;
|
|
503
529
|
}
|
|
504
530
|
if (t.text !== void 0 && (this._element.innerHTML = this._data.text || ""), this._data.isToggleable) {
|
|
505
|
-
if (this._element.setAttribute(
|
|
531
|
+
if (this._element.setAttribute(D.toggleOpen, String(this._isOpen)), !this._element.querySelector(`[${D.toggleArrow}]`)) {
|
|
506
532
|
const e = this.buildArrow();
|
|
507
533
|
this._arrowElement = e, this._element.prepend(e);
|
|
508
534
|
}
|
|
509
|
-
this._element.className = w(P.BASE_STYLES, this.currentLevel.styles, nt,
|
|
535
|
+
this._element.className = w(P.BASE_STYLES, this.currentLevel.styles, nt, Dt);
|
|
510
536
|
} else
|
|
511
|
-
this._element.removeAttribute(
|
|
537
|
+
this._element.removeAttribute(D.toggleOpen), this._arrowElement = null, this._element.className = w(P.BASE_STYLES, this.currentLevel.styles, nt);
|
|
512
538
|
}
|
|
513
539
|
/**
|
|
514
540
|
* Get tag for target level
|
|
@@ -518,14 +544,14 @@ const _t = "toggle", Yt = "tools.toggle.placeholder", qn = "outline-hidden py-[3
|
|
|
518
544
|
*/
|
|
519
545
|
getTag() {
|
|
520
546
|
const t = document.createElement(this.currentLevel.tag);
|
|
521
|
-
t.innerHTML = this._data.text || "", t.className = w(P.BASE_STYLES, this.currentLevel.styles, nt, this._data.isToggleable ?
|
|
547
|
+
t.innerHTML = this._data.text || "", t.className = w(P.BASE_STYLES, this.currentLevel.styles, nt, this._data.isToggleable ? Dt : "");
|
|
522
548
|
const { inlineStyles: e } = this.currentLevel;
|
|
523
549
|
if (e && Object.assign(t.style, e), t.setAttribute(B.tool, "header"), t.contentEditable = this.readOnly ? "false" : "true", this._data.isToggleable) {
|
|
524
|
-
t.setAttribute(
|
|
550
|
+
t.setAttribute(D.toggleOpen, String(this._isOpen));
|
|
525
551
|
const n = this.buildArrow();
|
|
526
552
|
this._arrowElement = n, t.prepend(n);
|
|
527
553
|
}
|
|
528
|
-
return this.readOnly ? t.setAttribute("data-placeholder", this.api.i18n.t(this._settings.placeholder || "")) :
|
|
554
|
+
return this.readOnly ? t.setAttribute("data-placeholder", this.api.i18n.t(this._settings.placeholder || "")) : kt(t, this.api.i18n.t(this._settings.placeholder || "")), t;
|
|
529
555
|
}
|
|
530
556
|
/**
|
|
531
557
|
* Build the arrow element for toggle heading.
|
|
@@ -533,18 +559,16 @@ const _t = "toggle", Yt = "tools.toggle.placeholder", qn = "outline-hidden py-[3
|
|
|
533
559
|
* @returns The arrow element
|
|
534
560
|
*/
|
|
535
561
|
buildArrow() {
|
|
536
|
-
|
|
537
|
-
return t.className = Be, t.setAttribute(W.toggleArrow, ""), t.setAttribute("role", "button"), t.setAttribute("tabindex", "-1"), t.setAttribute("aria-label", "Expand"), t.contentEditable = "false", t.innerHTML = It, this._isOpen && (t.style.transform = "rotate(90deg)"), t.addEventListener("click", (e) => {
|
|
538
|
-
e.stopPropagation(), this.toggleOpen();
|
|
539
|
-
}), t;
|
|
562
|
+
return Ie(this._isOpen, () => this.toggleOpen(), { contentEditableFalse: !0 });
|
|
540
563
|
}
|
|
541
564
|
/**
|
|
542
565
|
* Toggle the isToggleable state on/off.
|
|
543
566
|
* Called from the settings menu.
|
|
544
567
|
*/
|
|
545
568
|
toggleIsToggleable() {
|
|
569
|
+
var e;
|
|
546
570
|
const t = this._data.isToggleable === !0;
|
|
547
|
-
this.data = {
|
|
571
|
+
t && (Ht(this.api, (e = this.blockId) != null ? e : "", !0), this._isOpen = !1), this.data = {
|
|
548
572
|
level: this._data.level,
|
|
549
573
|
text: this._data.text,
|
|
550
574
|
isToggleable: !t || void 0
|
|
@@ -554,13 +578,13 @@ const _t = "toggle", Yt = "tools.toggle.placeholder", qn = "outline-hidden py-[3
|
|
|
554
578
|
* Toggle the open/closed state of the toggle heading.
|
|
555
579
|
*/
|
|
556
580
|
toggleOpen() {
|
|
557
|
-
this._isOpen = !this._isOpen, this._arrowElement && this._element &&
|
|
581
|
+
this._isOpen = !this._isOpen, this._arrowElement && this._element && vt(this._arrowElement, this._element, this._isOpen), this.updateChildrenVisibility();
|
|
558
582
|
}
|
|
559
583
|
/**
|
|
560
584
|
* Show or hide child blocks based on the toggle's open state.
|
|
561
585
|
*/
|
|
562
586
|
updateChildrenVisibility() {
|
|
563
|
-
this.blockId !== void 0 &&
|
|
587
|
+
this.blockId !== void 0 && Ht(this.api, this.blockId, this._isOpen);
|
|
564
588
|
}
|
|
565
589
|
/**
|
|
566
590
|
* Get current level
|
|
@@ -654,9 +678,9 @@ const _t = "toggle", Yt = "tools.toggle.placeholder", qn = "outline-hidden py-[3
|
|
|
654
678
|
searchTerms: [`h${o.number}`, "title", "header", "heading"],
|
|
655
679
|
shortcut: "#".repeat(o.number)
|
|
656
680
|
})), e = {
|
|
657
|
-
1:
|
|
658
|
-
2:
|
|
659
|
-
3:
|
|
681
|
+
1: fn,
|
|
682
|
+
2: gn,
|
|
683
|
+
3: pn
|
|
660
684
|
}, n = P.DEFAULT_LEVELS.filter((o) => o.number <= 3).map((o) => ({
|
|
661
685
|
icon: e[o.number],
|
|
662
686
|
title: `Toggle heading ${o.number}`,
|
|
@@ -669,18 +693,18 @@ const _t = "toggle", Yt = "tools.toggle.placeholder", qn = "outline-hidden py-[3
|
|
|
669
693
|
}
|
|
670
694
|
};
|
|
671
695
|
P.BASE_STYLES = "py-[3px] px-[2px] m-0 leading-[1.3]! outline-hidden [&_p]:p-0! [&_p]:m-0! [&_div]:p-0! [&_div]:m-0!", P.DEFAULT_LEVELS = [
|
|
672
|
-
{ number: 1, tag: "H1", nameKey: "tools.header.heading1", name: "Heading 1", icon:
|
|
673
|
-
{ number: 2, tag: "H2", nameKey: "tools.header.heading2", name: "Heading 2", icon:
|
|
674
|
-
{ number: 3, tag: "H3", nameKey: "tools.header.heading3", name: "Heading 3", icon:
|
|
675
|
-
{ number: 4, tag: "H4", nameKey: "tools.header.heading4", name: "Heading 4", icon:
|
|
676
|
-
{ number: 5, tag: "H5", nameKey: "tools.header.heading5", name: "Heading 5", icon:
|
|
677
|
-
{ number: 6, tag: "H6", nameKey: "tools.header.heading6", name: "Heading 6", icon:
|
|
696
|
+
{ number: 1, tag: "H1", nameKey: "tools.header.heading1", name: "Heading 1", icon: ln, styles: "text-4xl font-bold mt-8 mb-1" },
|
|
697
|
+
{ number: 2, tag: "H2", nameKey: "tools.header.heading2", name: "Heading 2", icon: an, styles: "text-3xl font-semibold mt-6 mb-px" },
|
|
698
|
+
{ number: 3, tag: "H3", nameKey: "tools.header.heading3", name: "Heading 3", icon: cn, styles: "text-2xl font-semibold mt-4 mb-px" },
|
|
699
|
+
{ number: 4, tag: "H4", nameKey: "tools.header.heading4", name: "Heading 4", icon: dn, styles: "text-xl font-semibold mt-3 mb-px" },
|
|
700
|
+
{ number: 5, tag: "H5", nameKey: "tools.header.heading5", name: "Heading 5", icon: hn, styles: "text-base font-semibold mt-3 mb-px" },
|
|
701
|
+
{ number: 6, tag: "H6", nameKey: "tools.header.heading6", name: "Heading 6", icon: un, styles: "text-sm font-semibold mt-3 mb-px" }
|
|
678
702
|
];
|
|
679
|
-
let
|
|
703
|
+
let Jt = P;
|
|
680
704
|
const Q = 24, Yn = "outline-hidden py-[3px] mt-[2px] mb-px", Xn = "outline-hidden pl-0.5 leading-[1.6em]", Zn = "flex items-start pl-0.5", Jn = "mt-1 w-4 mr-2 h-4 cursor-pointer accent-current", Qn = "tools.list.placeholder", L = "list", De = {
|
|
681
705
|
contentContainer: "list-content-container",
|
|
682
706
|
checklistContent: "list-checklist-content"
|
|
683
|
-
},
|
|
707
|
+
}, He = (r, t) => {
|
|
684
708
|
const e = r;
|
|
685
709
|
e._placeholder = t, Object.defineProperty(e, "getPlaceholder", {
|
|
686
710
|
value: () => e._placeholder,
|
|
@@ -688,7 +712,7 @@ const Q = 24, Yn = "outline-hidden py-[3px] mt-[2px] mb-px", Xn = "outline-hidde
|
|
|
688
712
|
enumerable: !0,
|
|
689
713
|
configurable: !1
|
|
690
714
|
});
|
|
691
|
-
},
|
|
715
|
+
}, Pe = (r) => {
|
|
692
716
|
const { data: t, keydownHandler: e, readOnly: n } = r, o = to(r), s = t.style === "checklist" ? no(r) : eo(r);
|
|
693
717
|
o.appendChild(s), !n && e && o.addEventListener("keydown", e);
|
|
694
718
|
const i = s.querySelector("[data-list-marker]"), l = s.querySelector('input[type="checkbox"]'), a = s.querySelector("[contenteditable]");
|
|
@@ -711,7 +735,7 @@ const Q = 24, Yn = "outline-hidden py-[3px] mt-[2px] mb-px", Xn = "outline-hidde
|
|
|
711
735
|
const l = oo(t.style, i);
|
|
712
736
|
l.setAttribute("data-list-marker", "true"), l.setAttribute("data-blok-mutation-free", "true"), s.appendChild(l);
|
|
713
737
|
const a = document.createElement("div");
|
|
714
|
-
return a.className = w("flex-1 min-w-0 outline-hidden", ...nt), a.setAttribute("data-blok-testid", De.contentContainer), a.contentEditable = r.readOnly ? "false" : "true", a.innerHTML = t.text,
|
|
738
|
+
return a.className = w("flex-1 min-w-0 outline-hidden", ...nt), a.setAttribute("data-blok-testid", De.contentContainer), a.contentEditable = r.readOnly ? "false" : "true", a.innerHTML = t.text, He(a, o), s.appendChild(a), s;
|
|
715
739
|
}, no = (r) => {
|
|
716
740
|
var d;
|
|
717
741
|
const { data: t, itemColor: e, itemSize: n, placeholder: o, readOnly: s } = r, i = document.createElement("div");
|
|
@@ -725,7 +749,7 @@ const Q = 24, Yn = "outline-hidden py-[3px] mt-[2px] mb-px", Xn = "outline-hidde
|
|
|
725
749
|
"flex-1 outline-hidden leading-[1.6em]",
|
|
726
750
|
t.checked ? "line-through opacity-60" : "",
|
|
727
751
|
...nt
|
|
728
|
-
), c.setAttribute("data-blok-testid", De.checklistContent), c.setAttribute("data-checked", String(t.checked)), c.contentEditable = s ? "false" : "true", c.innerHTML = t.text,
|
|
752
|
+
), c.setAttribute("data-blok-testid", De.checklistContent), c.setAttribute("data-checked", String(t.checked)), c.contentEditable = s ? "false" : "true", c.innerHTML = t.text, He(c, o), i.appendChild(a), i.appendChild(c), i;
|
|
729
753
|
}, oo = (r, t) => {
|
|
730
754
|
const e = document.createElement("span");
|
|
731
755
|
if (e.className = "shrink-0 select-none", e.setAttribute("aria-hidden", "true"), e.contentEditable = "false", r === "ordered")
|
|
@@ -743,7 +767,7 @@ const Q = 24, Yn = "outline-hidden py-[3px] mt-[2px] mb-px", Xn = "outline-hidde
|
|
|
743
767
|
if (!i) return null;
|
|
744
768
|
const d = i.parentNode;
|
|
745
769
|
if (!d) return null;
|
|
746
|
-
const h =
|
|
770
|
+
const h = Pe({
|
|
747
771
|
data: t,
|
|
748
772
|
readOnly: e,
|
|
749
773
|
placeholder: n,
|
|
@@ -761,7 +785,7 @@ const Q = 24, Yn = "outline-hidden py-[3px] mt-[2px] mb-px", Xn = "outline-hidde
|
|
|
761
785
|
}, ro = (r, t, e) => {
|
|
762
786
|
if (!t) return r;
|
|
763
787
|
const n = e(), s = {
|
|
764
|
-
text: n ?
|
|
788
|
+
text: n ? Gt(n.innerHTML) : r.text,
|
|
765
789
|
style: r.style,
|
|
766
790
|
checked: r.checked
|
|
767
791
|
};
|
|
@@ -822,10 +846,10 @@ const Q = 24, Yn = "outline-hidden py-[3px] mt-[2px] mb-px", Xn = "outline-hidde
|
|
|
822
846
|
};
|
|
823
847
|
const n = document.createRange();
|
|
824
848
|
return n.setStart(t.endContainer, t.endOffset), n.setEndAfter(r.lastChild), {
|
|
825
|
-
beforeContent:
|
|
826
|
-
afterContent:
|
|
849
|
+
beforeContent: Qt(e.cloneContents()),
|
|
850
|
+
afterContent: Qt(n.cloneContents())
|
|
827
851
|
};
|
|
828
|
-
},
|
|
852
|
+
}, Qt = (r) => {
|
|
829
853
|
const t = document.createElement("div");
|
|
830
854
|
return t.appendChild(r), t.innerHTML;
|
|
831
855
|
}, fo = (r) => {
|
|
@@ -954,7 +978,7 @@ const Ao = (r, t) => {
|
|
|
954
978
|
r && r.setAttribute("data-list-depth", String(e));
|
|
955
979
|
const n = r == null ? void 0 : r.querySelector('[role="listitem"]');
|
|
956
980
|
n instanceof HTMLElement && (n.style.marginLeft = e > 0 ? `${e * Q}px` : ""), t.depth = e;
|
|
957
|
-
}, Ne = (r, t) => t.getBlockDepth(r), _e = (r, t) => t.getBlockStyle(r), To = (r, t) => t.getBulletCharacter(r),
|
|
981
|
+
}, Ne = (r, t) => t.getBlockDepth(r), _e = (r, t) => t.getBlockStyle(r), To = (r, t) => t.getBulletCharacter(r), te = (r, t, e, n, o) => {
|
|
958
982
|
var i;
|
|
959
983
|
const s = r && (i = n.getBlockIndex(r)) != null ? i : n.getCurrentBlockIndex();
|
|
960
984
|
return s <= 0 ? 0 : o.getSiblingIndex(s, t, e);
|
|
@@ -969,7 +993,7 @@ const Ao = (r, t) => {
|
|
|
969
993
|
n.style
|
|
970
994
|
);
|
|
971
995
|
return l === null ? 1 : s.getBlockStartValue(l);
|
|
972
|
-
},
|
|
996
|
+
}, ee = (r, t, e, n, o, s) => {
|
|
973
997
|
const l = Ro(r, t, n, e, o, s) + r;
|
|
974
998
|
return s.formatNumber(l, t);
|
|
975
999
|
}, Bo = (r, t, e, n) => n.findGroupStart(r, t, e), Me = (r, t, e, n) => {
|
|
@@ -1040,7 +1064,7 @@ const Ao = (r, t) => {
|
|
|
1040
1064
|
if (!l) return;
|
|
1041
1065
|
const a = l.innerHTML.trim();
|
|
1042
1066
|
if (a === "" || a === "<br>") {
|
|
1043
|
-
await
|
|
1067
|
+
await Ho(r);
|
|
1044
1068
|
return;
|
|
1045
1069
|
}
|
|
1046
1070
|
const c = i.getRangeAt(0), { beforeContent: d, afterContent: h } = go(l, c), u = e && (g = t.blocks.getBlockIndex(e)) != null ? g : t.blocks.getCurrentBlockIndex();
|
|
@@ -1068,7 +1092,7 @@ const Ao = (r, t) => {
|
|
|
1068
1092
|
u + 1
|
|
1069
1093
|
);
|
|
1070
1094
|
n.text = d, ot(t, p, "start");
|
|
1071
|
-
},
|
|
1095
|
+
}, Ho = async (r) => {
|
|
1072
1096
|
const { api: t, blockId: e, getDepth: n } = r;
|
|
1073
1097
|
if (n() > 0) {
|
|
1074
1098
|
await Ge(r);
|
|
@@ -1078,7 +1102,7 @@ const Ao = (r, t) => {
|
|
|
1078
1102
|
return;
|
|
1079
1103
|
const s = await t.blocks.convert(e, "paragraph", { text: "" });
|
|
1080
1104
|
ot(t, s, "start");
|
|
1081
|
-
},
|
|
1105
|
+
}, Po = async (r, t) => {
|
|
1082
1106
|
const { api: e, blockId: n, data: o, element: s, getContentElement: i, getDepth: l, syncContentFromDOM: a } = r, c = window.getSelection();
|
|
1083
1107
|
if (!c || !s) return;
|
|
1084
1108
|
const d = c.getRangeAt(0), h = i();
|
|
@@ -1123,7 +1147,7 @@ const Ao = (r, t) => {
|
|
|
1123
1147
|
}));
|
|
1124
1148
|
ot(t, a);
|
|
1125
1149
|
}, No = (r) => {
|
|
1126
|
-
const { data: t, readOnly: e, placeholder: n, itemColor: o, itemSize: s, setupItemPlaceholder: i, onCheckboxChange: l, keydownHandler: a } = r, c =
|
|
1150
|
+
const { data: t, readOnly: e, placeholder: n, itemColor: o, itemSize: s, setupItemPlaceholder: i, onCheckboxChange: l, keydownHandler: a } = r, c = Pe({
|
|
1127
1151
|
data: t,
|
|
1128
1152
|
readOnly: e,
|
|
1129
1153
|
placeholder: n,
|
|
@@ -1322,7 +1346,7 @@ class We {
|
|
|
1322
1346
|
return i < n ? e : i > n ? this.findGroupStartRecursive(t - 1, e, n, o) : this.getBlockStyle(s) !== o ? e : this.findGroupStartRecursive(t - 1, t, n, o);
|
|
1323
1347
|
}
|
|
1324
1348
|
}
|
|
1325
|
-
const
|
|
1349
|
+
const Et = { value: !1 };
|
|
1326
1350
|
class Go {
|
|
1327
1351
|
constructor(t) {
|
|
1328
1352
|
this.blocks = t, this.depthValidator = new Oe(t), this.markerCalculator = new We(t);
|
|
@@ -1377,8 +1401,8 @@ class Go {
|
|
|
1377
1401
|
* Uses a static flag to deduplicate multiple calls in the same frame.
|
|
1378
1402
|
*/
|
|
1379
1403
|
scheduleUpdateAll() {
|
|
1380
|
-
|
|
1381
|
-
|
|
1404
|
+
Et.value || (Et.value = !0, requestAnimationFrame(() => {
|
|
1405
|
+
Et.value = !1, this.updateAllMarkers();
|
|
1382
1406
|
}));
|
|
1383
1407
|
}
|
|
1384
1408
|
/**
|
|
@@ -1532,28 +1556,28 @@ const Wo = (r) => r instanceof HTMLElement, $o = /* @__PURE__ */ new Set([
|
|
|
1532
1556
|
style: "unordered",
|
|
1533
1557
|
checked: !1
|
|
1534
1558
|
})
|
|
1535
|
-
}),
|
|
1559
|
+
}), ne = [
|
|
1536
1560
|
{
|
|
1537
1561
|
name: "bulletedList",
|
|
1538
1562
|
titleKey: "bulletedList",
|
|
1539
1563
|
style: "unordered",
|
|
1540
|
-
icon:
|
|
1564
|
+
icon: Ee
|
|
1541
1565
|
},
|
|
1542
1566
|
{
|
|
1543
1567
|
name: "numberedList",
|
|
1544
1568
|
titleKey: "numberedList",
|
|
1545
1569
|
style: "ordered",
|
|
1546
|
-
icon:
|
|
1570
|
+
icon: Ae
|
|
1547
1571
|
},
|
|
1548
1572
|
{
|
|
1549
1573
|
name: "todoList",
|
|
1550
1574
|
titleKey: "todoList",
|
|
1551
1575
|
style: "checklist",
|
|
1552
|
-
icon:
|
|
1576
|
+
icon: xe
|
|
1553
1577
|
}
|
|
1554
1578
|
], Xo = () => [
|
|
1555
1579
|
{
|
|
1556
|
-
icon:
|
|
1580
|
+
icon: Ee,
|
|
1557
1581
|
title: "Bulleted list",
|
|
1558
1582
|
titleKey: "bulletedList",
|
|
1559
1583
|
data: { style: "unordered" },
|
|
@@ -1562,7 +1586,7 @@ const Wo = (r) => r instanceof HTMLElement, $o = /* @__PURE__ */ new Set([
|
|
|
1562
1586
|
shortcut: "-"
|
|
1563
1587
|
},
|
|
1564
1588
|
{
|
|
1565
|
-
icon:
|
|
1589
|
+
icon: Ae,
|
|
1566
1590
|
title: "Numbered list",
|
|
1567
1591
|
titleKey: "numberedList",
|
|
1568
1592
|
data: { style: "ordered" },
|
|
@@ -1571,7 +1595,7 @@ const Wo = (r) => r instanceof HTMLElement, $o = /* @__PURE__ */ new Set([
|
|
|
1571
1595
|
shortcut: "1."
|
|
1572
1596
|
},
|
|
1573
1597
|
{
|
|
1574
|
-
icon:
|
|
1598
|
+
icon: xe,
|
|
1575
1599
|
title: "To-do list",
|
|
1576
1600
|
titleKey: "todoList",
|
|
1577
1601
|
data: { style: "checklist" },
|
|
@@ -1595,7 +1619,7 @@ class Ei {
|
|
|
1595
1619
|
}
|
|
1596
1620
|
get availableStyles() {
|
|
1597
1621
|
const t = this._settings.styles;
|
|
1598
|
-
return !t || t.length === 0 ?
|
|
1622
|
+
return !t || t.length === 0 ? ne : ne.filter((e) => t.includes(e.style));
|
|
1599
1623
|
}
|
|
1600
1624
|
get itemColor() {
|
|
1601
1625
|
return this._settings.itemColor;
|
|
@@ -1607,7 +1631,7 @@ class Ei {
|
|
|
1607
1631
|
return this.api.i18n.t(Qn);
|
|
1608
1632
|
}
|
|
1609
1633
|
setupItemPlaceholder(t) {
|
|
1610
|
-
this.readOnly ||
|
|
1634
|
+
this.readOnly || kt(t, this.placeholder);
|
|
1611
1635
|
}
|
|
1612
1636
|
render() {
|
|
1613
1637
|
return this._element = No({
|
|
@@ -1655,7 +1679,7 @@ class Ei {
|
|
|
1655
1679
|
const t = (s = this._element) == null ? void 0 : s.querySelector("[data-list-marker]");
|
|
1656
1680
|
if (!t)
|
|
1657
1681
|
return;
|
|
1658
|
-
const e = this.getDepth(), n =
|
|
1682
|
+
const e = this.getDepth(), n = te(this.blockId, e, this._data.style, this.api.blocks, this.markerCalculator), o = ee(n, e, this._data, this.blockId, this.api.blocks, this.markerCalculator);
|
|
1659
1683
|
t.textContent = o;
|
|
1660
1684
|
}
|
|
1661
1685
|
updateSiblingListMarkers() {
|
|
@@ -1668,7 +1692,7 @@ class Ei {
|
|
|
1668
1692
|
const n = (o = this._element) == null ? void 0 : o.querySelector('[aria-hidden="true"]');
|
|
1669
1693
|
if (n instanceof HTMLElement)
|
|
1670
1694
|
if (e === "ordered") {
|
|
1671
|
-
const s =
|
|
1695
|
+
const s = te(this.blockId, t, this._data.style, this.api.blocks, this.markerCalculator), i = ee(s, t, this._data, this.blockId, this.api.blocks, this.markerCalculator);
|
|
1672
1696
|
n.textContent = i;
|
|
1673
1697
|
} else {
|
|
1674
1698
|
const s = To(t, this.markerCalculator);
|
|
@@ -1723,7 +1747,7 @@ class Ei {
|
|
|
1723
1747
|
syncContentFromDOM: this.syncContentFromDOM.bind(this),
|
|
1724
1748
|
getDepth: this.getDepth.bind(this)
|
|
1725
1749
|
};
|
|
1726
|
-
await
|
|
1750
|
+
await Po(e, t);
|
|
1727
1751
|
}
|
|
1728
1752
|
async handleIndent() {
|
|
1729
1753
|
const t = {
|
|
@@ -1849,13 +1873,13 @@ class Ei {
|
|
|
1849
1873
|
return Xo();
|
|
1850
1874
|
}
|
|
1851
1875
|
}
|
|
1852
|
-
const Zo = "data-blok-table-add-row", Jo = "data-blok-table-add-col",
|
|
1876
|
+
const Zo = "data-blok-table-add-row", Jo = "data-blok-table-add-col", oe = 150, Qo = 5, At = 40, se = [
|
|
1853
1877
|
"flex",
|
|
1854
1878
|
"items-center",
|
|
1855
1879
|
"justify-center",
|
|
1856
1880
|
"transition-opacity",
|
|
1857
1881
|
"duration-150"
|
|
1858
|
-
],
|
|
1882
|
+
], ie = [
|
|
1859
1883
|
"flex",
|
|
1860
1884
|
"items-center",
|
|
1861
1885
|
"justify-center",
|
|
@@ -1863,10 +1887,10 @@ const Zo = "data-blok-table-add-row", Jo = "data-blok-table-add-col", ee = 150,
|
|
|
1863
1887
|
"border-gray-300",
|
|
1864
1888
|
"rounded-full",
|
|
1865
1889
|
"group-hover/add:bg-gray-50"
|
|
1866
|
-
],
|
|
1890
|
+
], re = "12";
|
|
1867
1891
|
class ts {
|
|
1868
1892
|
constructor(t) {
|
|
1869
|
-
this.rowHideTimeout = null, this.colHideTimeout = null, this.rowVisible = !1, this.colVisible = !1, this.interactive = !0, 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.getNewColumnWidth = t.getNewColumnWidth, 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.boundPointerCancel = this.handlePointerCancel.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.wrapper.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);
|
|
1893
|
+
this.rowHideTimeout = null, this.colHideTimeout = null, this.rowVisible = !1, this.colVisible = !1, this.interactive = !0, 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.getNewColumnWidth = t.getNewColumnWidth, this.boundMouseMove = this.handleMouseMove.bind(this), this.boundDocumentMouseMove = this.handleDocumentMouseMove.bind(this), this.boundMouseLeave = this.handleMouseLeave.bind(this), this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundPointerCancel = this.handlePointerCancel.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.wrapper.appendChild(this.addColBtn), this.syncRowButtonWidth(), this.wrapper.addEventListener("mousemove", this.boundMouseMove), this.wrapper.addEventListener("mouseleave", this.boundMouseLeave), document.addEventListener("mousemove", this.boundDocumentMouseMove), this.addRowBtn.addEventListener("pointerdown", this.boundRowPointerDown), this.addColBtn.addEventListener("pointerdown", this.boundColPointerDown);
|
|
1870
1894
|
}
|
|
1871
1895
|
/**
|
|
1872
1896
|
* Match the add-row button width and horizontal position to the grid.
|
|
@@ -1909,7 +1933,7 @@ class ts {
|
|
|
1909
1933
|
this.addRowBtn.style.pointerEvents = this.rowVisible ? "" : "none", this.addColBtn.style.pointerEvents = this.colVisible ? "" : "none";
|
|
1910
1934
|
}
|
|
1911
1935
|
destroy() {
|
|
1912
|
-
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) {
|
|
1936
|
+
if (this.wrapper.removeEventListener("mousemove", this.boundMouseMove), this.wrapper.removeEventListener("mouseleave", this.boundMouseLeave), document.removeEventListener("mousemove", this.boundDocumentMouseMove), this.addRowBtn.removeEventListener("pointerdown", this.boundRowPointerDown), this.addColBtn.removeEventListener("pointerdown", this.boundColPointerDown), this.dragState) {
|
|
1913
1937
|
const t = this.dragState.axis === "row" ? this.addRowBtn : this.addColBtn;
|
|
1914
1938
|
t.removeEventListener("pointermove", this.boundPointerMove), t.removeEventListener("pointerup", this.boundPointerUp), t.removeEventListener("pointercancel", this.boundPointerCancel), document.body.style.cursor = "", this.dragState = null;
|
|
1915
1939
|
}
|
|
@@ -1937,7 +1961,7 @@ class ts {
|
|
|
1937
1961
|
e === "row" ? this.onDragAddRow() : this.onDragAddCol(), this.dragState.addedCount++;
|
|
1938
1962
|
for (; this.dragState.addedCount > l; )
|
|
1939
1963
|
e === "row" ? this.onDragRemoveRow() : this.onDragRemoveCol(), this.dragState.addedCount--;
|
|
1940
|
-
Math.abs(i) > Qo && !this.dragState.didDrag && (this.dragState.didDrag = !0, document.body.style.cursor = e === "row" ? "row-resize" : "col-resize",
|
|
1964
|
+
Math.abs(i) > Qo && !this.dragState.didDrag && (this.dragState.didDrag = !0, document.body.style.cursor = e === "row" ? "row-resize" : "col-resize", mn(), this.onDragStart());
|
|
1941
1965
|
}
|
|
1942
1966
|
handlePointerUp(t) {
|
|
1943
1967
|
if (!this.dragState)
|
|
@@ -1974,11 +1998,24 @@ class ts {
|
|
|
1974
1998
|
}
|
|
1975
1999
|
handleMouseMove(t) {
|
|
1976
2000
|
const e = this.grid.getBoundingClientRect(), n = this.grid.parentElement, s = n !== null && n !== this.wrapper ? Math.min(e.right, n.getBoundingClientRect().right) : e.right, i = Math.abs(t.clientY - e.bottom), l = Math.abs(t.clientX - s);
|
|
1977
|
-
i <=
|
|
2001
|
+
i <= At ? this.showRow() : this.scheduleHideRow(), l <= At ? this.showCol() : this.scheduleHideCol();
|
|
1978
2002
|
}
|
|
1979
2003
|
handleMouseLeave() {
|
|
1980
2004
|
this.scheduleHideRow(), this.scheduleHideCol();
|
|
1981
2005
|
}
|
|
2006
|
+
/**
|
|
2007
|
+
* Document-level mousemove handler.
|
|
2008
|
+
* Catches mouse movements outside the wrapper (e.g. in the ::after
|
|
2009
|
+
* pseudo-element zone below the grid, which has pointer-events-none).
|
|
2010
|
+
* Only delegates to handleMouseMove when the cursor is within the
|
|
2011
|
+
* proximity zone around the grid to avoid unnecessary work.
|
|
2012
|
+
*/
|
|
2013
|
+
handleDocumentMouseMove(t) {
|
|
2014
|
+
if (this.wrapper.contains(t.target))
|
|
2015
|
+
return;
|
|
2016
|
+
const e = this.grid.getBoundingClientRect(), n = At;
|
|
2017
|
+
t.clientX >= e.left - n && t.clientX <= e.right + n && t.clientY >= e.top - n && t.clientY <= e.bottom + n && this.handleMouseMove(t);
|
|
2018
|
+
}
|
|
1982
2019
|
showRow() {
|
|
1983
2020
|
this.clearRowTimeout(), this.rowVisible || (this.addRowBtn.style.opacity = "1", this.addRowBtn.style.pointerEvents = this.interactive ? "" : "none", this.rowVisible = !0);
|
|
1984
2021
|
}
|
|
@@ -1989,13 +2026,13 @@ class ts {
|
|
|
1989
2026
|
var t;
|
|
1990
2027
|
!this.rowVisible || this.rowHideTimeout !== null || ((t = this.dragState) == null ? void 0 : t.axis) === "row" || (this.rowHideTimeout = setTimeout(() => {
|
|
1991
2028
|
this.addRowBtn.style.opacity = "0", this.addRowBtn.style.pointerEvents = "none", this.rowVisible = !1, this.rowHideTimeout = null;
|
|
1992
|
-
},
|
|
2029
|
+
}, oe));
|
|
1993
2030
|
}
|
|
1994
2031
|
scheduleHideCol() {
|
|
1995
2032
|
var t;
|
|
1996
2033
|
!this.colVisible || this.colHideTimeout !== null || ((t = this.dragState) == null ? void 0 : t.axis) === "col" || (this.colHideTimeout = setTimeout(() => {
|
|
1997
2034
|
this.addColBtn.style.opacity = "0", this.addColBtn.style.pointerEvents = "none", this.colVisible = !1, this.colHideTimeout = null;
|
|
1998
|
-
},
|
|
2035
|
+
}, oe));
|
|
1999
2036
|
}
|
|
2000
2037
|
clearRowTimeout() {
|
|
2001
2038
|
this.rowHideTimeout !== null && (clearTimeout(this.rowHideTimeout), this.rowHideTimeout = null);
|
|
@@ -2005,26 +2042,26 @@ class ts {
|
|
|
2005
2042
|
}
|
|
2006
2043
|
createAddRowButton() {
|
|
2007
2044
|
const t = document.createElement("div");
|
|
2008
|
-
t.className = w(
|
|
2045
|
+
t.className = w(se, "group/add", "items-start", "cursor-row-resize"), t.setAttribute(Zo, ""), 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.zIndex = "1", t.style.height = "32px";
|
|
2009
2046
|
const e = document.createElement("div");
|
|
2010
|
-
return e.className = w(
|
|
2047
|
+
return e.className = w(ie), e.style.width = "100%", e.style.height = "16px", this.appendIcon(e), t.appendChild(e), qt(t, zt([
|
|
2011
2048
|
this.i18n.t("tools.table.clickToAddRow"),
|
|
2012
2049
|
this.i18n.t("tools.table.dragToAddRemoveRows")
|
|
2013
2050
|
]), { placement: "bottom", marginTop: -16 }), t;
|
|
2014
2051
|
}
|
|
2015
2052
|
createAddColumnButton() {
|
|
2016
2053
|
const t = document.createElement("div");
|
|
2017
|
-
t.className = w(
|
|
2054
|
+
t.className = w(se, "group/add", "justify-start", "cursor-col-resize"), t.setAttribute(Jo, ""), 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";
|
|
2018
2055
|
const e = document.createElement("div");
|
|
2019
|
-
return e.className = w(
|
|
2056
|
+
return e.className = w(ie), e.style.width = "16px", e.style.height = "100%", this.appendIcon(e), t.appendChild(e), qt(t, zt([
|
|
2020
2057
|
this.i18n.t("tools.table.clickToAddColumn"),
|
|
2021
2058
|
this.i18n.t("tools.table.dragToAddRemoveColumns")
|
|
2022
2059
|
]), { placement: "bottom" }), t;
|
|
2023
2060
|
}
|
|
2024
2061
|
appendIcon(t) {
|
|
2025
|
-
t.insertAdjacentHTML("beforeend",
|
|
2062
|
+
t.insertAdjacentHTML("beforeend", Cn);
|
|
2026
2063
|
const e = t.querySelector("svg");
|
|
2027
|
-
e && (e.setAttribute("width",
|
|
2064
|
+
e && (e.setAttribute("width", re), e.setAttribute("height", re), e.setAttribute("viewBox", "0 0 24 24"), e.classList.add("text-gray-500", "pointer-events-none"));
|
|
2028
2065
|
}
|
|
2029
2066
|
}
|
|
2030
2067
|
const y = "data-blok-table-row", b = "data-blok-table-cell", q = 1, pt = `${q}px solid #d1d5db`, es = [
|
|
@@ -2254,19 +2291,19 @@ class ss {
|
|
|
2254
2291
|
const e = document.createElement("div");
|
|
2255
2292
|
e.className = w(ns), e.style.borderRight = pt, e.style.borderBottom = pt, 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(b, "");
|
|
2256
2293
|
const n = document.createElement("div");
|
|
2257
|
-
return n.setAttribute(
|
|
2294
|
+
return n.setAttribute(H, ""), e.appendChild(n), e;
|
|
2258
2295
|
}
|
|
2259
2296
|
}
|
|
2260
|
-
const Z = (r) => typeof r == "object" && r !== null && "blocks" in r,
|
|
2297
|
+
const Z = (r) => typeof r == "object" && r !== null && "blocks" in r, H = "data-blok-table-cell-blocks";
|
|
2261
2298
|
class is {
|
|
2262
2299
|
constructor(t) {
|
|
2263
2300
|
var e;
|
|
2264
|
-
this._activeCellWithBlocks = null, this.cellsPendingCheck = /* @__PURE__ */ new Set(), this.pendingCheckScheduled = !1, this.removedBlockCells = /* @__PURE__ */ new Map(), this.deferredEvents = [], this.handleBlockMutation = (n) => {
|
|
2301
|
+
this._activeCellWithBlocks = null, this.cellsPendingCheck = /* @__PURE__ */ new Set(), this.pendingCheckScheduled = !1, this.removedBlockCells = /* @__PURE__ */ new Map(), this.deferredEvents = [], this.isExitingTable = !1, this.handleBlockMutation = (n) => {
|
|
2265
2302
|
if (this.isStructuralOpActive()) {
|
|
2266
2303
|
this.deferredEvents.push(n);
|
|
2267
2304
|
return;
|
|
2268
2305
|
}
|
|
2269
|
-
if (!this.isBlockMutationEvent(n))
|
|
2306
|
+
if (this.isExitingTable || !this.isBlockMutationEvent(n))
|
|
2270
2307
|
return;
|
|
2271
2308
|
const { type: o, detail: s } = n.event;
|
|
2272
2309
|
if (o === "block-removed") {
|
|
@@ -2283,7 +2320,7 @@ class is {
|
|
|
2283
2320
|
this.claimBlockForCell(l.cell, s.target.id), this.syncBlockToModel(l.cell, s.target.id), this.cellsPendingCheck.delete(l.cell);
|
|
2284
2321
|
return;
|
|
2285
2322
|
}
|
|
2286
|
-
const a = s.target.holder, c = a.closest(`[${
|
|
2323
|
+
const a = s.target.holder, c = a.closest(`[${H}]`);
|
|
2287
2324
|
c && this.stripPlaceholders(c);
|
|
2288
2325
|
const d = c && !this.model.findCellForBlock(s.target.id) ? c.closest(`[${b}]`) : null;
|
|
2289
2326
|
if (d && this.syncBlockToModel(d, s.target.id), c)
|
|
@@ -2302,13 +2339,13 @@ class is {
|
|
|
2302
2339
|
const o = n.target;
|
|
2303
2340
|
if (!o)
|
|
2304
2341
|
return;
|
|
2305
|
-
const s = o.hasAttribute(b), i = o.hasAttribute(
|
|
2342
|
+
const s = o.hasAttribute(b), i = o.hasAttribute(H);
|
|
2306
2343
|
if (!s && !i)
|
|
2307
2344
|
return;
|
|
2308
2345
|
const l = s ? o : o.closest(`[${b}]`);
|
|
2309
2346
|
if (!l)
|
|
2310
2347
|
return;
|
|
2311
|
-
const a = s ? l.querySelector(`[${
|
|
2348
|
+
const a = s ? l.querySelector(`[${H}]`) : o;
|
|
2312
2349
|
if (!a)
|
|
2313
2350
|
return;
|
|
2314
2351
|
const c = a.querySelectorAll("[data-blok-id]"), d = c[c.length - 1];
|
|
@@ -2350,6 +2387,7 @@ class is {
|
|
|
2350
2387
|
t.preventDefault(), this.handleShiftTabNavigation(e);
|
|
2351
2388
|
return;
|
|
2352
2389
|
}
|
|
2390
|
+
t.key === "ArrowDown" && e.row === this.getRowCount() - 1 && (t.preventDefault(), this.exitTableForward());
|
|
2353
2391
|
}
|
|
2354
2392
|
/**
|
|
2355
2393
|
* Handle Tab navigation to next cell
|
|
@@ -2361,7 +2399,11 @@ class is {
|
|
|
2361
2399
|
return;
|
|
2362
2400
|
}
|
|
2363
2401
|
const o = t.row + 1;
|
|
2364
|
-
o < this.getRowCount()
|
|
2402
|
+
if (o < this.getRowCount()) {
|
|
2403
|
+
this.navigateToCell({ row: o, col: 0 });
|
|
2404
|
+
return;
|
|
2405
|
+
}
|
|
2406
|
+
this.exitTableForward();
|
|
2365
2407
|
}
|
|
2366
2408
|
/**
|
|
2367
2409
|
* Handle Shift+Tab navigation to previous cell
|
|
@@ -2373,7 +2415,57 @@ class is {
|
|
|
2373
2415
|
return;
|
|
2374
2416
|
}
|
|
2375
2417
|
const n = t.row - 1;
|
|
2376
|
-
n >= 0
|
|
2418
|
+
if (n >= 0) {
|
|
2419
|
+
this.navigateToCell({ row: n, col: this.getColumnCount() - 1 }, !0);
|
|
2420
|
+
return;
|
|
2421
|
+
}
|
|
2422
|
+
this.exitTableBackward();
|
|
2423
|
+
}
|
|
2424
|
+
/**
|
|
2425
|
+
* Exit the table by focusing the first block after it, or creating one if none exists.
|
|
2426
|
+
*/
|
|
2427
|
+
exitTableForward() {
|
|
2428
|
+
const t = this.api.blocks.getBlockIndex(this.tableBlockId);
|
|
2429
|
+
if (t === void 0)
|
|
2430
|
+
return;
|
|
2431
|
+
const e = this.findFirstBlockAfterTable(t);
|
|
2432
|
+
if (e !== null) {
|
|
2433
|
+
this.api.caret.setToBlock(e.id, "start");
|
|
2434
|
+
return;
|
|
2435
|
+
}
|
|
2436
|
+
this.isExitingTable = !0;
|
|
2437
|
+
try {
|
|
2438
|
+
const n = this.api.blocks.getBlocksCount(), o = this.api.blocks.insert(void 0, {}, {}, n, !0);
|
|
2439
|
+
this.api.caret.setToBlock(o.id, "start");
|
|
2440
|
+
} finally {
|
|
2441
|
+
this.isExitingTable = !1;
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2444
|
+
/**
|
|
2445
|
+
* Exit the table backward by focusing the block before the table.
|
|
2446
|
+
* If no block exists before the table, do nothing.
|
|
2447
|
+
*/
|
|
2448
|
+
exitTableBackward() {
|
|
2449
|
+
const t = this.api.blocks.getBlockIndex(this.tableBlockId);
|
|
2450
|
+
if (t === void 0 || t === 0)
|
|
2451
|
+
return;
|
|
2452
|
+
const e = this.api.blocks.getBlockByIndex(t - 1);
|
|
2453
|
+
e && this.api.caret.setToBlock(e.id, "end");
|
|
2454
|
+
}
|
|
2455
|
+
/**
|
|
2456
|
+
* Scan the flat block array starting after the table block, skipping all blocks
|
|
2457
|
+
* whose holder is inside the table grid, and return the first non-child block.
|
|
2458
|
+
* Returns null if no such block exists.
|
|
2459
|
+
*/
|
|
2460
|
+
findFirstBlockAfterTable(t) {
|
|
2461
|
+
var o;
|
|
2462
|
+
const e = this.api.blocks.getBlocksCount();
|
|
2463
|
+
return (o = Array.from(
|
|
2464
|
+
{ length: e - t - 1 },
|
|
2465
|
+
(s, i) => this.api.blocks.getBlockByIndex(t + 1 + i)
|
|
2466
|
+
).find(
|
|
2467
|
+
(s) => s != null && !this.gridElement.contains(s.holder)
|
|
2468
|
+
)) != null ? o : null;
|
|
2377
2469
|
}
|
|
2378
2470
|
/**
|
|
2379
2471
|
* Navigate to a different cell, focusing the appropriate contenteditable element
|
|
@@ -2386,7 +2478,7 @@ class is {
|
|
|
2386
2478
|
const n = this.getCell(t.row, t.col);
|
|
2387
2479
|
if (!n)
|
|
2388
2480
|
return;
|
|
2389
|
-
const o = n.querySelector(`[${
|
|
2481
|
+
const o = n.querySelector(`[${H}]`);
|
|
2390
2482
|
if (!o)
|
|
2391
2483
|
return;
|
|
2392
2484
|
const s = o.querySelectorAll('[contenteditable="true"]');
|
|
@@ -2434,7 +2526,7 @@ class is {
|
|
|
2434
2526
|
const h = l[d];
|
|
2435
2527
|
if (!h)
|
|
2436
2528
|
return;
|
|
2437
|
-
const u = h.querySelector(`[${
|
|
2529
|
+
const u = h.querySelector(`[${H}]`);
|
|
2438
2530
|
if (!u)
|
|
2439
2531
|
return;
|
|
2440
2532
|
const p = Z(c) && c.blocks.length > 0 ? [...c.blocks] : null, g = p ? this.mountBlocksInCell(u, p) : [], f = {};
|
|
@@ -2484,7 +2576,7 @@ class is {
|
|
|
2484
2576
|
* Move a block's DOM holder into a cell's blocks container.
|
|
2485
2577
|
*/
|
|
2486
2578
|
claimBlockForCell(t, e) {
|
|
2487
|
-
const n = t.querySelector(`[${
|
|
2579
|
+
const n = t.querySelector(`[${H}]`);
|
|
2488
2580
|
if (!n)
|
|
2489
2581
|
return;
|
|
2490
2582
|
const o = this.api.blocks.getBlockIndex(e);
|
|
@@ -2516,7 +2608,7 @@ class is {
|
|
|
2516
2608
|
* If the blocks container is empty, insert an empty paragraph.
|
|
2517
2609
|
*/
|
|
2518
2610
|
ensureCellHasBlock(t) {
|
|
2519
|
-
const e = t.querySelector(`[${
|
|
2611
|
+
const e = t.querySelector(`[${H}]`);
|
|
2520
2612
|
if (!e || e.querySelector("[data-blok-id]") !== null)
|
|
2521
2613
|
return;
|
|
2522
2614
|
const o = this.api.blocks.insert("paragraph", { text: "" }, {}, this.api.blocks.getBlocksCount(), !0);
|
|
@@ -2657,7 +2749,7 @@ class is {
|
|
|
2657
2749
|
getBlockIdsFromCells(t) {
|
|
2658
2750
|
const e = [];
|
|
2659
2751
|
return Array.from(t).forEach((o) => {
|
|
2660
|
-
const s = o.querySelector(`[${
|
|
2752
|
+
const s = o.querySelector(`[${H}]`);
|
|
2661
2753
|
s && s.querySelectorAll("[data-blok-id]").forEach((i) => {
|
|
2662
2754
|
const l = i.getAttribute("data-blok-id");
|
|
2663
2755
|
l && e.push(l);
|
|
@@ -2707,7 +2799,7 @@ class is {
|
|
|
2707
2799
|
function rs(r, t) {
|
|
2708
2800
|
if (r === t)
|
|
2709
2801
|
return !0;
|
|
2710
|
-
const e =
|
|
2802
|
+
const e = Vt(r), n = Vt(t);
|
|
2711
2803
|
return e === null || n === null ? !1 : e[0] === n[0] && e[1] === n[1] && e[2] === n[2];
|
|
2712
2804
|
}
|
|
2713
2805
|
const ls = "flex-1 py-1.5 text-xs text-center rounded-md cursor-pointer border-none transition-colors", as = "#f7f7f5";
|
|
@@ -2735,7 +2827,7 @@ function $e(r) {
|
|
|
2735
2827
|
const u = () => {
|
|
2736
2828
|
h.innerHTML = "";
|
|
2737
2829
|
const f = e[i.modeIndex];
|
|
2738
|
-
for (const m of
|
|
2830
|
+
for (const m of bn) {
|
|
2739
2831
|
const C = document.createElement("button"), v = f.presetField === "text" ? m.text : m.bg, k = i.activeColor !== null && rs(v, i.activeColor);
|
|
2740
2832
|
C.setAttribute("data-blok-testid", `${n}-swatch-${m.name}`), C.className = w(
|
|
2741
2833
|
"w-8 h-8 rounded-md cursor-pointer border-none",
|
|
@@ -2809,11 +2901,11 @@ const cs = (r) => ({ element: $e({
|
|
|
2809
2901
|
t === "col" ? Object.assign(r.style, { height: `${j}px` }) : Object.assign(r.style, { width: `${j}px` }), r.classList.add("bg-gray-200"), r.classList.remove("bg-gray-300");
|
|
2810
2902
|
const e = r.querySelector("svg");
|
|
2811
2903
|
e && (e.classList.remove("opacity-0"), e.classList.add("opacity-100"));
|
|
2812
|
-
},
|
|
2904
|
+
}, xt = (r, t, e) => {
|
|
2813
2905
|
t === "col" ? Object.assign(r.style, { height: `${e}px` }) : Object.assign(r.style, { width: `${e}px` }), r.classList.remove("bg-gray-200"), r.classList.add("bg-gray-300");
|
|
2814
2906
|
const n = r.querySelector("svg");
|
|
2815
2907
|
n && (n.classList.add("opacity-0"), n.classList.remove("opacity-100"));
|
|
2816
|
-
},
|
|
2908
|
+
}, Tt = "data-blok-table-cell-selected", ps = "2px solid #3b82f6", Rt = "data-blok-table-selection-pill", gs = 16, fs = 20, le = 4, ms = [
|
|
2817
2909
|
"absolute",
|
|
2818
2910
|
"z-3",
|
|
2819
2911
|
"rounded-sm",
|
|
@@ -2880,7 +2972,7 @@ class bs {
|
|
|
2880
2972
|
if (Cs(this.grid) || t.button !== 0)
|
|
2881
2973
|
return;
|
|
2882
2974
|
const e = t.target;
|
|
2883
|
-
if (e.closest("[data-blok-table-grip]") || e.closest("[data-blok-table-resize]") || e.closest(`[${
|
|
2975
|
+
if (e.closest("[data-blok-table-grip]") || e.closest("[data-blok-table-resize]") || e.closest(`[${Rt}]`))
|
|
2884
2976
|
return;
|
|
2885
2977
|
const n = this.resolveCellCoord(e);
|
|
2886
2978
|
if (!n)
|
|
@@ -2922,7 +3014,7 @@ class bs {
|
|
|
2922
3014
|
}
|
|
2923
3015
|
handleClearSelection(t) {
|
|
2924
3016
|
const e = t.target;
|
|
2925
|
-
e instanceof HTMLElement && e.closest(`[${
|
|
3017
|
+
e instanceof HTMLElement && e.closest(`[${Rt}]`) || e instanceof HTMLElement && e.closest("[data-blok-popover-opened]") !== null || (this.pillPopover !== null && this.destroyPillPopover(), document.removeEventListener("pointerdown", this.boundClearSelection), this.clearSelection());
|
|
2926
3018
|
}
|
|
2927
3019
|
handleKeyDown(t) {
|
|
2928
3020
|
var e;
|
|
@@ -2943,7 +3035,7 @@ class bs {
|
|
|
2943
3035
|
}
|
|
2944
3036
|
restoreModifiedCells() {
|
|
2945
3037
|
this.destroyPillPopover(), this.disconnectResizeObserver(), this.selectedCells.forEach((t) => {
|
|
2946
|
-
t.removeAttribute(
|
|
3038
|
+
t.removeAttribute(Tt);
|
|
2947
3039
|
}), this.pill && (this.pill.remove(), this.pill = null), this.overlay && (this.overlay.remove(), this.overlay = null), this.selectedCells = [];
|
|
2948
3040
|
}
|
|
2949
3041
|
showProgrammaticSelection(t, e, n, o) {
|
|
@@ -2955,13 +3047,13 @@ class bs {
|
|
|
2955
3047
|
if (!this.anchorCell || !this.extentCell)
|
|
2956
3048
|
return;
|
|
2957
3049
|
this.selectedCells.forEach((x) => {
|
|
2958
|
-
x.removeAttribute(
|
|
3050
|
+
x.removeAttribute(Tt);
|
|
2959
3051
|
}), this.selectedCells = [];
|
|
2960
3052
|
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), o = Math.max(this.anchorCell.col, this.extentCell.col);
|
|
2961
3053
|
this.lastPaintedRange = { minRow: t, maxRow: e, minCol: n, maxCol: o };
|
|
2962
3054
|
const s = this.grid.querySelectorAll(`[${y}]`);
|
|
2963
3055
|
this.selectedCells = this.collectCellsInRange(s, t, e, n, o), this.selectedCells.forEach((x) => {
|
|
2964
|
-
x.setAttribute(
|
|
3056
|
+
x.setAttribute(Tt, "");
|
|
2965
3057
|
});
|
|
2966
3058
|
const i = (v = s[t]) == null ? void 0 : v.querySelectorAll(`[${b}]`)[n], l = (k = s[e]) == null ? void 0 : k.querySelectorAll(`[${b}]`)[o];
|
|
2967
3059
|
if (!i || !l)
|
|
@@ -3002,7 +3094,7 @@ class bs {
|
|
|
3002
3094
|
}
|
|
3003
3095
|
createPill() {
|
|
3004
3096
|
const t = document.createElement("div");
|
|
3005
|
-
t.setAttribute(
|
|
3097
|
+
t.setAttribute(Rt, ""), t.setAttribute("contenteditable", "false"), t.className = w(ms), t.style.width = `${le}px`, t.style.height = `${fs}px`, t.style.pointerEvents = "auto", t.style.transform = "translate(-50%, -50%)", t.style.outline = "2px solid white";
|
|
3006
3098
|
const e = Fe("vertical");
|
|
3007
3099
|
return e.classList.remove("text-gray-400"), e.classList.add("text-white"), t.appendChild(e), t.addEventListener("mouseenter", () => {
|
|
3008
3100
|
this.pillPopover === null && this.expandPill();
|
|
@@ -3016,7 +3108,7 @@ class bs {
|
|
|
3016
3108
|
if (this.destroyPillPopover(), !this.pill)
|
|
3017
3109
|
return;
|
|
3018
3110
|
this.expandPill();
|
|
3019
|
-
const t =
|
|
3111
|
+
const t = Sn === "Meta" ? "⌘C" : "Ctrl+C", e = [];
|
|
3020
3112
|
if (this.onColorChange !== void 0) {
|
|
3021
3113
|
const { element: o } = cs({
|
|
3022
3114
|
i18n: this.i18n,
|
|
@@ -3026,7 +3118,7 @@ class bs {
|
|
|
3026
3118
|
}
|
|
3027
3119
|
});
|
|
3028
3120
|
e.push({
|
|
3029
|
-
icon:
|
|
3121
|
+
icon: Te,
|
|
3030
3122
|
title: this.i18n.t("tools.table.cellColor"),
|
|
3031
3123
|
name: "cellColor",
|
|
3032
3124
|
children: {
|
|
@@ -3042,7 +3134,7 @@ class bs {
|
|
|
3042
3134
|
const n = [
|
|
3043
3135
|
...e,
|
|
3044
3136
|
{
|
|
3045
|
-
icon:
|
|
3137
|
+
icon: yn,
|
|
3046
3138
|
title: this.i18n.t("tools.table.copySelection"),
|
|
3047
3139
|
secondaryLabel: t,
|
|
3048
3140
|
closeOnActivate: !0,
|
|
@@ -3052,7 +3144,7 @@ class bs {
|
|
|
3052
3144
|
}
|
|
3053
3145
|
},
|
|
3054
3146
|
{
|
|
3055
|
-
icon:
|
|
3147
|
+
icon: vn,
|
|
3056
3148
|
title: this.i18n.t("tools.table.clearSelection"),
|
|
3057
3149
|
secondaryLabel: "Del",
|
|
3058
3150
|
closeOnActivate: !0,
|
|
@@ -3062,11 +3154,11 @@ class bs {
|
|
|
3062
3154
|
}
|
|
3063
3155
|
}
|
|
3064
3156
|
];
|
|
3065
|
-
this.pillPopover = new
|
|
3157
|
+
this.pillPopover = new Re({
|
|
3066
3158
|
items: n,
|
|
3067
3159
|
trigger: this.pill,
|
|
3068
3160
|
flippable: !0
|
|
3069
|
-
}), this.pillPopover.on(
|
|
3161
|
+
}), this.pillPopover.on(Be.Closed, () => {
|
|
3070
3162
|
this.pillPopover !== null && (this.destroyPillPopover(), this.collapsePill());
|
|
3071
3163
|
}), this.pillPopover.show();
|
|
3072
3164
|
}
|
|
@@ -3080,7 +3172,7 @@ class bs {
|
|
|
3080
3172
|
collapsePill() {
|
|
3081
3173
|
if (!this.pill)
|
|
3082
3174
|
return;
|
|
3083
|
-
this.pill.style.width = `${
|
|
3175
|
+
this.pill.style.width = `${le}px`;
|
|
3084
3176
|
const t = this.pill.querySelector("svg");
|
|
3085
3177
|
t && (t.classList.add("opacity-0"), t.classList.remove("opacity-100"));
|
|
3086
3178
|
}
|
|
@@ -3135,7 +3227,7 @@ const Y = (r) => {
|
|
|
3135
3227
|
return Array.from(e).map(
|
|
3136
3228
|
(n) => n.getBoundingClientRect().width
|
|
3137
3229
|
);
|
|
3138
|
-
},
|
|
3230
|
+
}, St = (r, t) => {
|
|
3139
3231
|
const e = t.reduce((s, i) => s + i, 0), n = r;
|
|
3140
3232
|
n.style.width = `${e + q}px`, r.querySelectorAll(`[${y}]`).forEach((s) => {
|
|
3141
3233
|
s.querySelectorAll(`[${b}]`).forEach((l, a) => {
|
|
@@ -3145,7 +3237,7 @@ const Y = (r) => {
|
|
|
3145
3237
|
}
|
|
3146
3238
|
});
|
|
3147
3239
|
});
|
|
3148
|
-
},
|
|
3240
|
+
}, Pt = (r, t) => {
|
|
3149
3241
|
const e = Array.from(r.querySelectorAll(`[${y}]`)), n = e.findIndex((i) => Array.from(i.querySelectorAll(`[${b}]`)).includes(t));
|
|
3150
3242
|
if (n === -1)
|
|
3151
3243
|
return null;
|
|
@@ -3153,7 +3245,7 @@ const Y = (r) => {
|
|
|
3153
3245
|
return { row: n, col: s };
|
|
3154
3246
|
}, qe = (r) => {
|
|
3155
3247
|
var e;
|
|
3156
|
-
const t = r.querySelector(`[${
|
|
3248
|
+
const t = r.querySelector(`[${H}]`);
|
|
3157
3249
|
return t ? ((e = t.textContent) != null ? e : "").trim().length === 0 : !0;
|
|
3158
3250
|
}, ys = (r, t) => {
|
|
3159
3251
|
const n = r.querySelectorAll(`[${y}]`)[t];
|
|
@@ -3216,7 +3308,7 @@ const Y = (r) => {
|
|
|
3216
3308
|
const l = i.querySelectorAll(`[${b}]`);
|
|
3217
3309
|
e < l.length && o.push(l[e]);
|
|
3218
3310
|
}), (s = t == null ? void 0 : t.getBlockIdsFromCells(o)) != null ? s : [];
|
|
3219
|
-
},
|
|
3311
|
+
}, M = (r, t) => {
|
|
3220
3312
|
r.querySelectorAll(`[${b}]`).forEach((n) => {
|
|
3221
3313
|
t == null || t.ensureCellHasBlock(n);
|
|
3222
3314
|
});
|
|
@@ -3232,7 +3324,7 @@ const Y = (r) => {
|
|
|
3232
3324
|
const h = a[d];
|
|
3233
3325
|
if (!h)
|
|
3234
3326
|
return;
|
|
3235
|
-
const u = h.querySelector(`[${
|
|
3327
|
+
const u = h.querySelector(`[${H}]`);
|
|
3236
3328
|
if (!u)
|
|
3237
3329
|
return;
|
|
3238
3330
|
const p = u.querySelectorAll("[data-blok-id]").length > 0;
|
|
@@ -3257,7 +3349,7 @@ const Y = (r) => {
|
|
|
3257
3349
|
}
|
|
3258
3350
|
});
|
|
3259
3351
|
});
|
|
3260
|
-
},
|
|
3352
|
+
}, ae = (r, t) => {
|
|
3261
3353
|
var l, a, c, d, h, u, p, g, f, m;
|
|
3262
3354
|
if (!(typeof r == "object" && r !== null && "content" in r))
|
|
3263
3355
|
return {
|
|
@@ -3280,10 +3372,10 @@ const Y = (r) => {
|
|
|
3280
3372
|
const o = e.target.closest(`[${b}]`);
|
|
3281
3373
|
if (!o)
|
|
3282
3374
|
return;
|
|
3283
|
-
const s =
|
|
3375
|
+
const s = Pt(r, o);
|
|
3284
3376
|
s && (t == null || t.handleKeyDown(e, s));
|
|
3285
3377
|
});
|
|
3286
|
-
}, ze = ["overflow-x-auto", "overflow-y-hidden"],
|
|
3378
|
+
}, ze = ["overflow-x-auto", "overflow-y-hidden"], ce = (r) => {
|
|
3287
3379
|
r == null || r.classList.add(...ze);
|
|
3288
3380
|
}, it = (r, t) => {
|
|
3289
3381
|
if (!r)
|
|
@@ -3644,8 +3736,8 @@ class Ls {
|
|
|
3644
3736
|
return e;
|
|
3645
3737
|
}
|
|
3646
3738
|
}
|
|
3647
|
-
const
|
|
3648
|
-
class
|
|
3739
|
+
const de = "data-blok-table-resize", Is = "data-blok-table-cell", Ds = "data-blok-table-row", Hs = 50, Bt = 16;
|
|
3740
|
+
class Ps {
|
|
3649
3741
|
constructor(t, e, n, o, s, i = !1) {
|
|
3650
3742
|
this._enabled = !0, this.isDragging = !1, this.dragStartX = 0, this.dragColIndex = -1, this.startColWidth = 0, this.dragRowCells = null, this.handles = [], this.gridEl = t, this.colWidths = [...e], this.onChange = n, this.onDragStart = o != null ? o : null, this.onDrag = s != null ? s : null, this.needsInitialApply = i, this.boundPointerDown = this.onPointerDown.bind(this), this.boundPointerMove = this.onPointerMove.bind(this), this.boundPointerUp = this.onPointerUp.bind(this), this.gridEl.style.position = "relative", i || this.applyWidths(), this.createHandles(), this.gridEl.addEventListener("pointerdown", this.boundPointerDown);
|
|
3651
3743
|
}
|
|
@@ -3672,7 +3764,7 @@ class Hs {
|
|
|
3672
3764
|
}
|
|
3673
3765
|
createHandle(t) {
|
|
3674
3766
|
const e = document.createElement("div"), n = this.getHandleLeftPx(t);
|
|
3675
|
-
return e.setAttribute(
|
|
3767
|
+
return e.setAttribute(de, ""), e.setAttribute("data-col", String(t)), e.style.position = "absolute", e.style.top = `-${q}px`, e.style.bottom = "0px", e.style.width = `${Bt}px`, e.style.left = `${n - Bt / 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", () => {
|
|
3676
3768
|
this.isDragging || (e.style.opacity = "1");
|
|
3677
3769
|
}), e.addEventListener("mouseleave", () => {
|
|
3678
3770
|
this.isDragging || (e.style.opacity = "0");
|
|
@@ -3684,7 +3776,7 @@ class Hs {
|
|
|
3684
3776
|
updateHandlePositions() {
|
|
3685
3777
|
this.handles.forEach((t, e) => {
|
|
3686
3778
|
const n = this.getHandleLeftPx(e), o = t;
|
|
3687
|
-
o.style.left = `${n -
|
|
3779
|
+
o.style.left = `${n - Bt / 2}px`;
|
|
3688
3780
|
});
|
|
3689
3781
|
}
|
|
3690
3782
|
onPointerDown(t) {
|
|
@@ -3692,7 +3784,7 @@ class Hs {
|
|
|
3692
3784
|
if (!this._enabled)
|
|
3693
3785
|
return;
|
|
3694
3786
|
const e = t.target;
|
|
3695
|
-
if (!e.hasAttribute(
|
|
3787
|
+
if (!e.hasAttribute(de))
|
|
3696
3788
|
return;
|
|
3697
3789
|
t.preventDefault(), this.needsInitialApply && (this.applyWidths(), this.updateHandlePositions(), this.needsInitialApply = !1);
|
|
3698
3790
|
const n = e.getAttribute("data-col");
|
|
@@ -3702,7 +3794,7 @@ class Hs {
|
|
|
3702
3794
|
var s, i;
|
|
3703
3795
|
if (!this.isDragging)
|
|
3704
3796
|
return;
|
|
3705
|
-
const e = t.clientX - this.dragStartX, n = this.startColWidth + e, o = Math.max(
|
|
3797
|
+
const e = t.clientX - this.dragStartX, n = this.startColWidth + e, o = Math.max(Hs, n);
|
|
3706
3798
|
this.colWidths[this.dragColIndex] = o, this.applyWidths((s = this.dragRowCells) != null ? s : void 0), this.updateHandlePositions(), (i = this.onDrag) == null || i.call(this);
|
|
3707
3799
|
}
|
|
3708
3800
|
onPointerUp() {
|
|
@@ -3725,15 +3817,15 @@ class Hs {
|
|
|
3725
3817
|
});
|
|
3726
3818
|
}
|
|
3727
3819
|
}
|
|
3728
|
-
const
|
|
3820
|
+
const he = (r, t, e) => (e.grid.addRow(r, t), M(r, e.cellBlocks), {
|
|
3729
3821
|
pendingHighlight: { type: "row", index: t },
|
|
3730
3822
|
moveSelection: null,
|
|
3731
3823
|
colWidths: e.data.colWidths,
|
|
3732
3824
|
withHeadings: e.data.withHeadings,
|
|
3733
3825
|
withHeadingColumn: e.data.withHeadingColumn
|
|
3734
|
-
}),
|
|
3826
|
+
}), ue = (r, t, e) => {
|
|
3735
3827
|
const n = Es(r, t, e.data.colWidths, e.data.initialColWidth, e.grid);
|
|
3736
|
-
return
|
|
3828
|
+
return M(r, e.cellBlocks), {
|
|
3737
3829
|
pendingHighlight: { type: "col", index: t },
|
|
3738
3830
|
moveSelection: null,
|
|
3739
3831
|
colWidths: n,
|
|
@@ -3767,7 +3859,7 @@ const de = (r, t, e) => (e.grid.addRow(r, t), _(r, e.cellBlocks), {
|
|
|
3767
3859
|
var i, l;
|
|
3768
3860
|
(l = e.cellBlocks) == null || l.deleteBlocks((i = e.blocksToDelete) != null ? i : []), e.grid.deleteColumn(r, t);
|
|
3769
3861
|
const n = ks(e.data.colWidths, t);
|
|
3770
|
-
n ?
|
|
3862
|
+
n ? St(r, n) : Ss(r);
|
|
3771
3863
|
const o = e.grid.getColumnCount(r);
|
|
3772
3864
|
return {
|
|
3773
3865
|
pendingHighlight: { type: "col", index: t < o ? t : t - 1 },
|
|
@@ -3779,13 +3871,13 @@ const de = (r, t, e) => (e.grid.addRow(r, t), _(r, e.cellBlocks), {
|
|
|
3779
3871
|
}, Gs = (r, t, e) => {
|
|
3780
3872
|
switch (t.type) {
|
|
3781
3873
|
case "insert-row-above":
|
|
3782
|
-
return
|
|
3874
|
+
return he(r, t.index, e);
|
|
3783
3875
|
case "insert-row-below":
|
|
3784
|
-
return
|
|
3876
|
+
return he(r, t.index + 1, e);
|
|
3785
3877
|
case "insert-col-left":
|
|
3786
|
-
return
|
|
3878
|
+
return ue(r, t.index, e);
|
|
3787
3879
|
case "insert-col-right":
|
|
3788
|
-
return
|
|
3880
|
+
return ue(r, t.index + 1, e);
|
|
3789
3881
|
case "move-row":
|
|
3790
3882
|
return Os(r, t.fromIndex, t.toIndex, e);
|
|
3791
3883
|
case "move-col":
|
|
@@ -3811,7 +3903,7 @@ const de = (r, t, e) => (e.grid.addRow(r, t), _(r, e.cellBlocks), {
|
|
|
3811
3903
|
withHeadingColumn: !e.data.withHeadingColumn
|
|
3812
3904
|
};
|
|
3813
3905
|
}
|
|
3814
|
-
},
|
|
3906
|
+
}, pe = 10, Ws = "data-blok-table-drag-ghost", Ot = (r) => {
|
|
3815
3907
|
const t = r.querySelector(`[${y}]`);
|
|
3816
3908
|
return t ? Array.from(t.querySelectorAll(`[${b}]`)).reduce(
|
|
3817
3909
|
(n, o) => {
|
|
@@ -3845,7 +3937,7 @@ class $s {
|
|
|
3845
3937
|
}
|
|
3846
3938
|
handleDocPointerMove(t) {
|
|
3847
3939
|
const e = Math.abs(t.clientX - this.dragStartX), n = Math.abs(t.clientY - this.dragStartY);
|
|
3848
|
-
!this.isDragging && (e >
|
|
3940
|
+
!this.isDragging && (e > pe || n > pe) && (this.isDragging = !0, this.startDrag()), this.isDragging && (this.updateDragIndicator(t), this.updateGhostPosition(t));
|
|
3849
3941
|
}
|
|
3850
3942
|
handleDocPointerUp(t) {
|
|
3851
3943
|
var e, n;
|
|
@@ -3920,7 +4012,7 @@ class $s {
|
|
|
3920
4012
|
var i;
|
|
3921
4013
|
if (!this.dropIndicator)
|
|
3922
4014
|
return;
|
|
3923
|
-
const n = t.clientX - e.left, o = this.getColDropIndex(n), s =
|
|
4015
|
+
const n = t.clientX - e.left, o = this.getColDropIndex(n), s = Ot(this.grid);
|
|
3924
4016
|
this.dropIndicator.style.left = `${((i = s[o]) != null ? i : 0) - 1.5}px`;
|
|
3925
4017
|
}
|
|
3926
4018
|
finishDrag(t) {
|
|
@@ -4015,7 +4107,7 @@ class $s {
|
|
|
4015
4107
|
return 0;
|
|
4016
4108
|
}
|
|
4017
4109
|
getColDropIndex(t) {
|
|
4018
|
-
const n =
|
|
4110
|
+
const n = Ot(this.grid).map((s) => Math.abs(t - s)), o = Math.min(...n);
|
|
4019
4111
|
return n.indexOf(o);
|
|
4020
4112
|
}
|
|
4021
4113
|
}
|
|
@@ -4086,7 +4178,7 @@ const Fs = [
|
|
|
4086
4178
|
{
|
|
4087
4179
|
type: F.Html,
|
|
4088
4180
|
element: Ve({
|
|
4089
|
-
icon:
|
|
4181
|
+
icon: xn,
|
|
4090
4182
|
label: t.i18n.t("tools.table.headerColumn"),
|
|
4091
4183
|
isActive: t.isHeadingColumn(),
|
|
4092
4184
|
onToggle: () => {
|
|
@@ -4097,7 +4189,7 @@ const Fs = [
|
|
|
4097
4189
|
{ type: F.Separator }
|
|
4098
4190
|
] : [], n = [
|
|
4099
4191
|
{
|
|
4100
|
-
icon:
|
|
4192
|
+
icon: wn,
|
|
4101
4193
|
title: t.i18n.t("tools.table.insertColumnLeft"),
|
|
4102
4194
|
closeOnActivate: !0,
|
|
4103
4195
|
onActivate: () => {
|
|
@@ -4105,7 +4197,7 @@ const Fs = [
|
|
|
4105
4197
|
}
|
|
4106
4198
|
},
|
|
4107
4199
|
{
|
|
4108
|
-
icon:
|
|
4200
|
+
icon: kn,
|
|
4109
4201
|
title: t.i18n.t("tools.table.insertColumnRight"),
|
|
4110
4202
|
closeOnActivate: !0,
|
|
4111
4203
|
onActivate: () => {
|
|
@@ -4115,7 +4207,7 @@ const Fs = [
|
|
|
4115
4207
|
], o = t.getColumnCount() > 1, s = [
|
|
4116
4208
|
{ type: F.Separator },
|
|
4117
4209
|
{
|
|
4118
|
-
icon:
|
|
4210
|
+
icon: Le,
|
|
4119
4211
|
title: t.i18n.t("tools.table.deleteColumn"),
|
|
4120
4212
|
isDestructive: !0,
|
|
4121
4213
|
isDisabled: !o,
|
|
@@ -4131,7 +4223,7 @@ const Fs = [
|
|
|
4131
4223
|
{
|
|
4132
4224
|
type: F.Html,
|
|
4133
4225
|
element: Ve({
|
|
4134
|
-
icon:
|
|
4226
|
+
icon: Tn,
|
|
4135
4227
|
label: t.i18n.t("tools.table.headerRow"),
|
|
4136
4228
|
isActive: t.isHeadingRow(),
|
|
4137
4229
|
onToggle: () => {
|
|
@@ -4142,7 +4234,7 @@ const Fs = [
|
|
|
4142
4234
|
{ type: F.Separator }
|
|
4143
4235
|
] : [], n = [
|
|
4144
4236
|
{
|
|
4145
|
-
icon:
|
|
4237
|
+
icon: En,
|
|
4146
4238
|
title: t.i18n.t("tools.table.insertRowAbove"),
|
|
4147
4239
|
closeOnActivate: !0,
|
|
4148
4240
|
onActivate: () => {
|
|
@@ -4150,7 +4242,7 @@ const Fs = [
|
|
|
4150
4242
|
}
|
|
4151
4243
|
},
|
|
4152
4244
|
{
|
|
4153
|
-
icon:
|
|
4245
|
+
icon: An,
|
|
4154
4246
|
title: t.i18n.t("tools.table.insertRowBelow"),
|
|
4155
4247
|
closeOnActivate: !0,
|
|
4156
4248
|
onActivate: () => {
|
|
@@ -4160,7 +4252,7 @@ const Fs = [
|
|
|
4160
4252
|
], o = t.getRowCount() > 1, s = [
|
|
4161
4253
|
{ type: F.Separator },
|
|
4162
4254
|
{
|
|
4163
|
-
icon:
|
|
4255
|
+
icon: Le,
|
|
4164
4256
|
title: t.i18n.t("tools.table.deleteRow"),
|
|
4165
4257
|
isDestructive: !0,
|
|
4166
4258
|
isDisabled: !o,
|
|
@@ -4176,16 +4268,16 @@ const Fs = [
|
|
|
4176
4268
|
const s = r === "col" ? e.col[t] : e.row[t];
|
|
4177
4269
|
if (!s)
|
|
4178
4270
|
return { popover: null, grip: null };
|
|
4179
|
-
const i = r === "col" ? Us(t, n) : js(t, n), l = new
|
|
4271
|
+
const i = r === "col" ? Us(t, n) : js(t, n), l = new Re({
|
|
4180
4272
|
items: i,
|
|
4181
4273
|
trigger: s,
|
|
4182
4274
|
flippable: !0
|
|
4183
4275
|
});
|
|
4184
|
-
return l.on(
|
|
4276
|
+
return l.on(Be.Closed, () => {
|
|
4185
4277
|
var a;
|
|
4186
4278
|
o.destroyPopover(), o.applyVisibleClasses(s), o.scheduleHideAll(), (a = o.onGripPopoverClose) == null || a.call(o);
|
|
4187
4279
|
}), o.hideAllGripsExcept(s), o.applyActiveClasses(s), r === "col" ? s.style.height = `${j}px` : s.style.width = `${j}px`, { popover: l, grip: s };
|
|
4188
|
-
},
|
|
4280
|
+
}, ge = "data-blok-table-grip", ft = "data-blok-table-grip-col", fe = "data-blok-table-grip-row", Xs = 150, Zs = 24, mt = 4, Ct = 4, Js = 20, bt = [
|
|
4189
4281
|
"absolute",
|
|
4190
4282
|
"z-3",
|
|
4191
4283
|
"rounded-sm",
|
|
@@ -4198,7 +4290,7 @@ const Fs = [
|
|
|
4198
4290
|
"items-center",
|
|
4199
4291
|
"justify-center",
|
|
4200
4292
|
"overflow-hidden"
|
|
4201
|
-
],
|
|
4293
|
+
], me = [
|
|
4202
4294
|
"bg-gray-300",
|
|
4203
4295
|
"opacity-0",
|
|
4204
4296
|
"pointer-events-none"
|
|
@@ -4295,12 +4387,12 @@ class ei {
|
|
|
4295
4387
|
}
|
|
4296
4388
|
createGripElement(t, e) {
|
|
4297
4389
|
const n = document.createElement("div");
|
|
4298
|
-
n.className = w(bt,
|
|
4390
|
+
n.className = w(bt, me), n.setAttribute(ge, ""), n.setAttribute(t === "col" ? ft : fe, String(e)), n.setAttribute("contenteditable", "false");
|
|
4299
4391
|
const o = t === "col" ? Zs : Ct, s = t === "col" ? mt : Js, i = t === "col" ? mt : Ct;
|
|
4300
4392
|
return n.style.width = `${o}px`, n.style.height = `${s}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", () => {
|
|
4301
4393
|
this.overlay && this.clearHideTimeout(), this.isGripInteractionLocked() || us(n, t);
|
|
4302
4394
|
}), n.addEventListener("mouseleave", () => {
|
|
4303
|
-
this.isGripInteractionLocked() || (
|
|
4395
|
+
this.isGripInteractionLocked() || (xt(n, t, i), this.overlay && this.scheduleHideAll());
|
|
4304
4396
|
}), n;
|
|
4305
4397
|
}
|
|
4306
4398
|
/**
|
|
@@ -4311,7 +4403,7 @@ class ei {
|
|
|
4311
4403
|
const t = this.grid.querySelectorAll(`[${y}]`);
|
|
4312
4404
|
if (!t[0])
|
|
4313
4405
|
return;
|
|
4314
|
-
const n =
|
|
4406
|
+
const n = Ot(this.grid), o = this.overlay && this.scrollContainer ? this.scrollContainer.scrollLeft : 0, s = this.overlay && this.scrollContainer ? this.scrollContainer.clientWidth : 1 / 0;
|
|
4315
4407
|
this.colGrips.forEach((i, l) => {
|
|
4316
4408
|
if (l + 1 >= n.length)
|
|
4317
4409
|
return;
|
|
@@ -4394,7 +4486,7 @@ class ei {
|
|
|
4394
4486
|
}
|
|
4395
4487
|
applyVisibleClasses(t) {
|
|
4396
4488
|
const e = t, n = e.hasAttribute(ft);
|
|
4397
|
-
|
|
4489
|
+
xt(e, n ? "col" : "row", n ? mt : Ct), this.isInsideTable && (e.style.transition = "none"), e.className = w(bt, Qs), e.setAttribute("data-blok-table-grip-visible", ""), this.isInsideTable && (e.offsetHeight, e.style.transition = "");
|
|
4398
4490
|
const i = e.querySelector("svg");
|
|
4399
4491
|
i && (i.classList.remove("text-white"), i.classList.add("text-gray-400"));
|
|
4400
4492
|
}
|
|
@@ -4410,7 +4502,7 @@ class ei {
|
|
|
4410
4502
|
}
|
|
4411
4503
|
applyIdleClasses(t) {
|
|
4412
4504
|
const e = t, n = e.hasAttribute(ft), o = n ? "col" : "row", s = 12, i = n ? mt + s : Ct + s;
|
|
4413
|
-
this.isInsideTable && (e.style.transition = "none"),
|
|
4505
|
+
this.isInsideTable && (e.style.transition = "none"), xt(e, o, i), e.className = w(bt, me), e.removeAttribute("data-blok-table-grip-visible"), this.isInsideTable && (e.offsetHeight, e.style.transition = "");
|
|
4414
4506
|
}
|
|
4415
4507
|
handleDragStateChange(t, e) {
|
|
4416
4508
|
[...this.colGrips, ...this.rowGrips].forEach((n) => {
|
|
@@ -4428,7 +4520,7 @@ class ei {
|
|
|
4428
4520
|
}
|
|
4429
4521
|
// ── Click / Drag discrimination ──────────────────────────────
|
|
4430
4522
|
handlePointerDown(t) {
|
|
4431
|
-
const n = t.target.closest(`[${
|
|
4523
|
+
const n = t.target.closest(`[${ge}]`);
|
|
4432
4524
|
if (!n)
|
|
4433
4525
|
return;
|
|
4434
4526
|
t.preventDefault(), t.stopPropagation();
|
|
@@ -4441,7 +4533,7 @@ class ei {
|
|
|
4441
4533
|
const e = t.getAttribute(ft);
|
|
4442
4534
|
if (e !== null)
|
|
4443
4535
|
return { type: "col", index: Number(e) };
|
|
4444
|
-
const n = t.getAttribute(
|
|
4536
|
+
const n = t.getAttribute(fe);
|
|
4445
4537
|
return n !== null ? { type: "row", index: Number(n) } : null;
|
|
4446
4538
|
}
|
|
4447
4539
|
// ── Popover menus ────────────────────────────────────────────
|
|
@@ -4477,7 +4569,7 @@ class ei {
|
|
|
4477
4569
|
}
|
|
4478
4570
|
}
|
|
4479
4571
|
}
|
|
4480
|
-
const ni = "data-blok-table-haze",
|
|
4572
|
+
const ni = "data-blok-table-haze", Ce = "data-blok-table-haze-visible", Lt = 1, oi = [
|
|
4481
4573
|
"absolute",
|
|
4482
4574
|
"top-0",
|
|
4483
4575
|
"bottom-0",
|
|
@@ -4542,10 +4634,10 @@ class ri {
|
|
|
4542
4634
|
return;
|
|
4543
4635
|
}
|
|
4544
4636
|
const { scrollLeft: o, scrollWidth: s, clientWidth: i } = t, l = s - i;
|
|
4545
|
-
this.setVisible(this.leftHaze, o >
|
|
4637
|
+
this.setVisible(this.leftHaze, o > Lt), this.setVisible(this.rightHaze, l > Lt && o < l - Lt);
|
|
4546
4638
|
}
|
|
4547
4639
|
setVisible(t, e) {
|
|
4548
|
-
t && (e ? t.setAttribute(
|
|
4640
|
+
t && (e ? t.setAttribute(Ce, "") : t.removeAttribute(Ce));
|
|
4549
4641
|
}
|
|
4550
4642
|
}
|
|
4551
4643
|
const li = 3, ai = 3, ci = [
|
|
@@ -4558,13 +4650,14 @@ const li = 3, ai = 3, ci = [
|
|
|
4558
4650
|
"after:-bottom-10",
|
|
4559
4651
|
"after:left-0",
|
|
4560
4652
|
"after:right-0",
|
|
4561
|
-
"after:h-10"
|
|
4653
|
+
"after:h-10",
|
|
4654
|
+
"after:pointer-events-none"
|
|
4562
4655
|
];
|
|
4563
4656
|
class Ai {
|
|
4564
4657
|
constructor({ data: t, config: e, api: n, readOnly: o, block: s }) {
|
|
4565
4658
|
this.initialContent = null, this.resize = null, this.addControls = null, this.rowColControls = null, this.cellBlocks = null, this.cellSelection = null, this.scrollHaze = null, this.element = null, this.gridElement = null, this.scrollContainer = null, this.gripOverlay = null, this.pendingHighlight = null, this.isNewTable = !1, this.unregisterRestrictedTools = null, this.setDataGeneration = 0, this.structuralOpDepth = 0, this.api = n, this.readOnly = o, this.config = e != null ? e : {};
|
|
4566
|
-
const i =
|
|
4567
|
-
this.initialContent = i.content, this.grid = new ss({ readOnly: o }), this.model = new Ls(i), this.blockId = s == null ? void 0 : s.id, this.config.restrictedTools !== void 0 && (this.unregisterRestrictedTools =
|
|
4659
|
+
const i = ae(t, this.config);
|
|
4660
|
+
this.initialContent = i.content, this.grid = new ss({ readOnly: o }), this.model = new Ls(i), this.blockId = s == null ? void 0 : s.id, this.config.restrictedTools !== void 0 && (this.unregisterRestrictedTools = Rn(this.config.restrictedTools));
|
|
4568
4661
|
}
|
|
4569
4662
|
/**
|
|
4570
4663
|
* Execute a function within a structural operation lock.
|
|
@@ -4620,7 +4713,7 @@ class Ai {
|
|
|
4620
4713
|
}
|
|
4621
4714
|
static get toolbox() {
|
|
4622
4715
|
return {
|
|
4623
|
-
icon:
|
|
4716
|
+
icon: Bn,
|
|
4624
4717
|
title: "Table",
|
|
4625
4718
|
titleKey: "tools.table.title",
|
|
4626
4719
|
searchTerms: ["table", "grid", "spreadsheet"]
|
|
@@ -4668,7 +4761,7 @@ class Ai {
|
|
|
4668
4761
|
var g;
|
|
4669
4762
|
return Math.max(u, (g = p == null ? void 0 : p.length) != null ? g : 0);
|
|
4670
4763
|
}, 0)) || this.config.cols || ai, o = this.grid.createGrid(e, n, this.model.colWidths);
|
|
4671
|
-
if (((d = (c = this.initialContent) == null ? void 0 : c.length) != null ? d : 0) > 0 && this.grid.fillGrid(o, (h = this.initialContent) != null ? h : []), this.model.colWidths &&
|
|
4764
|
+
if (((d = (c = this.initialContent) == null ? void 0 : c.length) != null ? d : 0) > 0 && this.grid.fillGrid(o, (h = this.initialContent) != null ? h : []), this.model.colWidths && St(o, this.model.colWidths), this.gridElement = o, this.model.colWidths || !this.readOnly) {
|
|
4672
4765
|
const u = document.createElement("div");
|
|
4673
4766
|
u.setAttribute("data-blok-table-scroll", "");
|
|
4674
4767
|
const p = this.model.colWidths ? ze : [];
|
|
@@ -4682,7 +4775,7 @@ class Ai {
|
|
|
4682
4775
|
return this.element = t, this.model.withHeadings && it(this.gridElement, this.model.withHeadings), this.model.withHeadingColumn && K(this.gridElement, this.model.withHeadingColumn), this.readOnly || (this.initCellBlocks(o), Bs(o, this.cellBlocks)), t;
|
|
4683
4776
|
}
|
|
4684
4777
|
rendered() {
|
|
4685
|
-
var n, o;
|
|
4778
|
+
var n, o, s;
|
|
4686
4779
|
if (!this.element || this.initialContent === null)
|
|
4687
4780
|
return;
|
|
4688
4781
|
const t = this.gridElement;
|
|
@@ -4694,22 +4787,19 @@ class Ai {
|
|
|
4694
4787
|
return;
|
|
4695
4788
|
}
|
|
4696
4789
|
if (this.runTransactedStructuralOp(() => {
|
|
4697
|
-
var
|
|
4698
|
-
const
|
|
4699
|
-
const
|
|
4700
|
-
return Array.from({ length:
|
|
4701
|
-
}) :
|
|
4790
|
+
var a, c;
|
|
4791
|
+
const i = (c = (a = this.cellBlocks) == null ? void 0 : a.initializeCells(e)) != null ? c : e, l = this.isNewTable && i.length === 0 ? Array.from(t.querySelectorAll(`[${y}]`), (d) => {
|
|
4792
|
+
const h = d.querySelectorAll(`[${b}]`).length;
|
|
4793
|
+
return Array.from({ length: h }, () => ({ blocks: [] }));
|
|
4794
|
+
}) : i;
|
|
4702
4795
|
this.model.replaceAll(V(T({}, this.model.snapshot()), {
|
|
4703
|
-
content:
|
|
4704
|
-
})), this.isNewTable &&
|
|
4796
|
+
content: l
|
|
4797
|
+
})), this.isNewTable && M(t, this.cellBlocks);
|
|
4705
4798
|
}, !0), this.model.initialColWidth === void 0) {
|
|
4706
|
-
const
|
|
4707
|
-
this.model.setInitialColWidth(
|
|
4708
|
-
}
|
|
4709
|
-
if (this.initSubsystems(t), rt(t, this.model.snapshot().content), this.isNewTable) {
|
|
4710
|
-
const s = t.querySelector('[contenteditable="true"]');
|
|
4711
|
-
s == null || s.focus();
|
|
4799
|
+
const i = (o = this.model.colWidths) != null ? o : Y(t);
|
|
4800
|
+
this.model.setInitialColWidth(i.length > 0 ? As(i) : void 0);
|
|
4712
4801
|
}
|
|
4802
|
+
this.initSubsystems(t), rt(t, this.model.snapshot().content), this.isNewTable && ((s = this.cellSelection) == null || s.selectRange({ minRow: 0, maxRow: 0, minCol: 0, maxCol: 0 }));
|
|
4713
4803
|
}
|
|
4714
4804
|
save(t) {
|
|
4715
4805
|
return this.model.snapshot();
|
|
@@ -4724,7 +4814,7 @@ class Ai {
|
|
|
4724
4814
|
setData(t) {
|
|
4725
4815
|
var c, d, h, u, p;
|
|
4726
4816
|
this.setDataGeneration++;
|
|
4727
|
-
const e = this.setDataGeneration, n =
|
|
4817
|
+
const e = this.setDataGeneration, n = ae(
|
|
4728
4818
|
T(T({}, this.model.snapshot()), t),
|
|
4729
4819
|
this.config
|
|
4730
4820
|
);
|
|
@@ -4756,7 +4846,7 @@ class Ai {
|
|
|
4756
4846
|
});
|
|
4757
4847
|
this.model.replaceAll(V(T({}, this.model.snapshot()), {
|
|
4758
4848
|
content: k
|
|
4759
|
-
})),
|
|
4849
|
+
})), M(a, this.cellBlocks);
|
|
4760
4850
|
} else
|
|
4761
4851
|
this.model.replaceAll(V(T({}, this.model.snapshot()), {
|
|
4762
4852
|
content: g
|
|
@@ -4772,12 +4862,12 @@ class Ai {
|
|
|
4772
4862
|
n.forEach((g) => {
|
|
4773
4863
|
const f = g.querySelectorAll("td, th"), m = [], C = [];
|
|
4774
4864
|
f.forEach((v) => {
|
|
4775
|
-
var
|
|
4865
|
+
var _;
|
|
4776
4866
|
m.push(v.innerHTML);
|
|
4777
|
-
const k = (
|
|
4778
|
-
E != null && E[1] && (x.color =
|
|
4867
|
+
const k = (_ = v.getAttribute("style")) != null ? _ : "", x = {}, E = /background-color\s*:\s*([^;]+)/i.exec(k);
|
|
4868
|
+
E != null && E[1] && (x.color = Kt(E[1].trim(), "bg"));
|
|
4779
4869
|
const A = new RegExp("(?<![a-z-])color\\s*:\\s*([^;]+)", "i").exec(k);
|
|
4780
|
-
A != null && A[1] && !
|
|
4870
|
+
A != null && A[1] && !Ln(A[1].trim()) && (x.textColor = Kt(A[1].trim(), "text")), C.push(x);
|
|
4781
4871
|
}), m.length > 0 && (o.push(m), s.push(C));
|
|
4782
4872
|
});
|
|
4783
4873
|
const i = e.querySelector("thead") !== null, l = ((u = n[0]) == null ? void 0 : u.querySelector("th")) !== null, a = i || l;
|
|
@@ -4846,14 +4936,14 @@ class Ai {
|
|
|
4846
4936
|
onAddRow: () => {
|
|
4847
4937
|
this.runTransactedStructuralOp(() => {
|
|
4848
4938
|
var o, s;
|
|
4849
|
-
this.grid.addRow(t), this.model.addRow(),
|
|
4939
|
+
this.grid.addRow(t), this.model.addRow(), M(t, this.cellBlocks), it(this.gridElement, this.model.withHeadings), K(this.gridElement, this.model.withHeadingColumn), this.initResize(t), (o = this.addControls) == null || o.syncRowButtonWidth(), (s = this.rowColControls) == null || s.refresh();
|
|
4850
4940
|
});
|
|
4851
4941
|
},
|
|
4852
4942
|
onAddColumn: () => {
|
|
4853
4943
|
this.runTransactedStructuralOp(() => {
|
|
4854
4944
|
var i, l, a;
|
|
4855
4945
|
const o = (i = this.model.colWidths) != null ? i : Y(t), s = this.model.initialColWidth !== void 0 ? Math.round(this.model.initialColWidth / 2 * 100) / 100 : at(o);
|
|
4856
|
-
this.grid.addColumn(t, void 0, o, s), this.model.addColumn(void 0, s), this.model.setColWidths([...o, s]),
|
|
4946
|
+
this.grid.addColumn(t, void 0, o, s), this.model.addColumn(void 0, s), this.model.setColWidths([...o, s]), M(t, this.cellBlocks), K(this.gridElement, this.model.withHeadingColumn), this.initResize(t), (l = this.addControls) == null || l.syncRowButtonWidth(), (a = this.rowColControls) == null || a.refresh(), this.scrollContainer && (this.scrollContainer.scrollLeft = this.scrollContainer.scrollWidth);
|
|
4857
4947
|
});
|
|
4858
4948
|
},
|
|
4859
4949
|
onDragStart: () => {
|
|
@@ -4862,7 +4952,7 @@ class Ai {
|
|
|
4862
4952
|
},
|
|
4863
4953
|
onDragAddRow: () => {
|
|
4864
4954
|
this.runTransactedStructuralOp(() => {
|
|
4865
|
-
this.grid.addRow(t), this.model.addRow(),
|
|
4955
|
+
this.grid.addRow(t), this.model.addRow(), M(t, this.cellBlocks), it(this.gridElement, this.model.withHeadings), K(this.gridElement, this.model.withHeadingColumn);
|
|
4866
4956
|
});
|
|
4867
4957
|
},
|
|
4868
4958
|
onDragRemoveRow: () => {
|
|
@@ -4879,7 +4969,7 @@ class Ai {
|
|
|
4879
4969
|
this.runTransactedStructuralOp(() => {
|
|
4880
4970
|
var l;
|
|
4881
4971
|
const o = (l = this.model.colWidths) != null ? l : Y(t), s = this.model.initialColWidth !== void 0 ? Math.round(this.model.initialColWidth / 2 * 100) / 100 : at(o), i = [...o, s];
|
|
4882
|
-
this.grid.addColumn(t, void 0, o, s), this.model.addColumn(void 0, s), this.model.setColWidths(i),
|
|
4972
|
+
this.grid.addColumn(t, void 0, o, s), this.model.addColumn(void 0, s), this.model.setColWidths(i), St(t, i), M(t, this.cellBlocks), K(this.gridElement, this.model.withHeadingColumn), this.initResize(t), e.addedCols++, this.scrollContainer && (this.scrollContainer.scrollLeft = this.scrollContainer.scrollWidth);
|
|
4883
4973
|
});
|
|
4884
4974
|
},
|
|
4885
4975
|
onDragRemoveCol: () => {
|
|
@@ -4891,7 +4981,7 @@ class Ai {
|
|
|
4891
4981
|
const { blocksToDelete: s } = this.model.deleteColumn(o - 1);
|
|
4892
4982
|
(l = this.cellBlocks) == null || l.deleteBlocks(s), this.grid.deleteColumn(t, o - 1);
|
|
4893
4983
|
const i = this.model.colWidths;
|
|
4894
|
-
i &&
|
|
4984
|
+
i && St(t, i), this.initResize(t), e.addedCols--;
|
|
4895
4985
|
});
|
|
4896
4986
|
},
|
|
4897
4987
|
onDragEnd: () => {
|
|
@@ -4991,12 +5081,12 @@ class Ai {
|
|
|
4991
5081
|
var o, s;
|
|
4992
5082
|
(o = this.resize) == null || o.destroy();
|
|
4993
5083
|
const e = this.model.colWidths === void 0, n = (s = this.model.colWidths) != null ? s : Y(t);
|
|
4994
|
-
e ||
|
|
5084
|
+
e || ce(this.ensureScrollContainer()), this.resize = new Ps(
|
|
4995
5085
|
t,
|
|
4996
5086
|
n,
|
|
4997
5087
|
(i) => {
|
|
4998
5088
|
var l, a, c;
|
|
4999
|
-
this.model.setColWidths(i),
|
|
5089
|
+
this.model.setColWidths(i), ce(this.ensureScrollContainer()), (l = this.rowColControls) == null || l.positionGrips(), (a = this.addControls) == null || a.syncRowButtonWidth(), (c = this.scrollHaze) == null || c.update();
|
|
5000
5090
|
},
|
|
5001
5091
|
() => {
|
|
5002
5092
|
var i;
|
|
@@ -5023,14 +5113,14 @@ class Ai {
|
|
|
5023
5113
|
const n = this.collectCellBlockData(t);
|
|
5024
5114
|
if (n.length === 0)
|
|
5025
5115
|
return;
|
|
5026
|
-
const o =
|
|
5027
|
-
e.setData("text/html",
|
|
5116
|
+
const o = Ut(n);
|
|
5117
|
+
e.setData("text/html", jt(o)), e.setData("text/plain", Yt(o));
|
|
5028
5118
|
}
|
|
5029
5119
|
handleCellCopyViaButton(t) {
|
|
5030
5120
|
const e = this.collectCellBlockData(t);
|
|
5031
5121
|
if (e.length === 0)
|
|
5032
5122
|
return;
|
|
5033
|
-
const n =
|
|
5123
|
+
const n = Ut(e), o = jt(n), s = Yt(n), i = new Blob([o], { type: "text/html" }), l = new Blob([s], { type: "text/plain" });
|
|
5034
5124
|
navigator.clipboard.write([
|
|
5035
5125
|
new ClipboardItem({
|
|
5036
5126
|
"text/html": i,
|
|
@@ -5042,7 +5132,7 @@ class Ai {
|
|
|
5042
5132
|
const o = this.gridElement;
|
|
5043
5133
|
o && this.runTransactedStructuralOp(() => {
|
|
5044
5134
|
for (const s of t) {
|
|
5045
|
-
const i =
|
|
5135
|
+
const i = Pt(o, s);
|
|
5046
5136
|
i && (n === "backgroundColor" ? (this.model.setCellColor(i.row, i.col, e != null ? e : void 0), s.style.backgroundColor = e != null ? e : "") : (this.model.setCellTextColor(i.row, i.col, e != null ? e : void 0), s.style.color = e != null ? e : ""));
|
|
5047
5137
|
}
|
|
5048
5138
|
});
|
|
@@ -5057,7 +5147,7 @@ class Ai {
|
|
|
5057
5147
|
const s = o.closest(`[${y}]`);
|
|
5058
5148
|
if (!s)
|
|
5059
5149
|
return null;
|
|
5060
|
-
const i = n.indexOf(s), a = Array.from(s.querySelectorAll(`[${b}]`)).indexOf(o), c = o.querySelector(`[${
|
|
5150
|
+
const i = n.indexOf(s), a = Array.from(s.querySelectorAll(`[${b}]`)).indexOf(o), c = o.querySelector(`[${H}]`), d = [];
|
|
5061
5151
|
if (!c)
|
|
5062
5152
|
return { row: i, col: a, blocks: d };
|
|
5063
5153
|
c.querySelectorAll("[data-blok-id]").forEach((f) => {
|
|
@@ -5115,7 +5205,7 @@ class Ai {
|
|
|
5115
5205
|
const l = this.gridElement;
|
|
5116
5206
|
if (l)
|
|
5117
5207
|
for (const a of o) {
|
|
5118
|
-
const c =
|
|
5208
|
+
const c = Pt(l, a);
|
|
5119
5209
|
c && (this.model.setCellColor(c.row, c.col, void 0), this.model.setCellTextColor(c.row, c.col, void 0), a.style.backgroundColor = "", a.style.color = "");
|
|
5120
5210
|
}
|
|
5121
5211
|
});
|
|
@@ -5146,7 +5236,7 @@ class Ai {
|
|
|
5146
5236
|
handleGridPaste(t, e) {
|
|
5147
5237
|
if (this.readOnly || !t.clipboardData || t.defaultPrevented)
|
|
5148
5238
|
return;
|
|
5149
|
-
const n = t.clipboardData.getData("text/html"), o =
|
|
5239
|
+
const n = t.clipboardData.getData("text/html"), o = In(n), s = o === null ? Dn(n) : null, i = o != null ? o : s;
|
|
5150
5240
|
if (!i || s !== null && new DOMParser().parseFromString(n, "text/html").querySelectorAll("table").length > 1)
|
|
5151
5241
|
return;
|
|
5152
5242
|
const l = document.activeElement;
|
|
@@ -5178,8 +5268,8 @@ class Ai {
|
|
|
5178
5268
|
if (C) {
|
|
5179
5269
|
const A = e.cells[p][m];
|
|
5180
5270
|
this.pasteCellPayload(C, A);
|
|
5181
|
-
const
|
|
5182
|
-
this.model.setCellBlocks(n + p, o + m,
|
|
5271
|
+
const _ = (k = (v = this.cellBlocks) == null ? void 0 : v.getBlockIdsFromCells([C])) != null ? k : [];
|
|
5272
|
+
this.model.setCellBlocks(n + p, o + m, _);
|
|
5183
5273
|
const ut = n + p, st = o + m;
|
|
5184
5274
|
this.model.setCellColor(ut, st, A.color), C.style.backgroundColor = (x = A.color) != null ? x : "", this.model.setCellTextColor(ut, st, A.textColor), C.style.color = (E = A.textColor) != null ? E : "";
|
|
5185
5275
|
}
|
|
@@ -5198,11 +5288,11 @@ class Ai {
|
|
|
5198
5288
|
expandGridForPaste(t, e, n) {
|
|
5199
5289
|
const o = this.grid.getRowCount(t), s = this.grid.getColumnCount(t);
|
|
5200
5290
|
Array.from({ length: Math.max(0, e - o) }).forEach(() => {
|
|
5201
|
-
this.grid.addRow(t), this.model.addRow(),
|
|
5291
|
+
this.grid.addRow(t), this.model.addRow(), M(t, this.cellBlocks), it(this.gridElement, this.model.withHeadings), K(this.gridElement, this.model.withHeadingColumn);
|
|
5202
5292
|
}), Array.from({ length: Math.max(0, n - s) }).forEach(() => {
|
|
5203
5293
|
var a;
|
|
5204
5294
|
const i = (a = this.model.colWidths) != null ? a : Y(t), l = this.model.initialColWidth !== void 0 ? Math.round(this.model.initialColWidth / 2 * 100) / 100 : at(i);
|
|
5205
|
-
this.grid.addColumn(t, void 0, i, l), this.model.addColumn(void 0, l), this.model.setColWidths([...i, l]),
|
|
5295
|
+
this.grid.addColumn(t, void 0, i, l), this.model.addColumn(void 0, l), this.model.setColWidths([...i, l]), M(t, this.cellBlocks), K(this.gridElement, this.model.withHeadingColumn);
|
|
5206
5296
|
});
|
|
5207
5297
|
}
|
|
5208
5298
|
/**
|
|
@@ -5214,7 +5304,7 @@ class Ai {
|
|
|
5214
5304
|
const i = this.cellBlocks.getBlockIdsFromCells([t]);
|
|
5215
5305
|
this.cellBlocks.deleteBlocks(i);
|
|
5216
5306
|
}
|
|
5217
|
-
const n = t.querySelector(`[${
|
|
5307
|
+
const n = t.querySelector(`[${H}]`);
|
|
5218
5308
|
if (n) {
|
|
5219
5309
|
if (e.blocks.length === 0) {
|
|
5220
5310
|
(o = this.cellBlocks) == null || o.ensureCellHasBlock(t);
|
|
@@ -5241,7 +5331,7 @@ const hi = (r) => {
|
|
|
5241
5331
|
}, ui = (r, t, e) => {
|
|
5242
5332
|
if (!t) return r;
|
|
5243
5333
|
const n = e();
|
|
5244
|
-
return { text: n ?
|
|
5334
|
+
return { text: n ? Gt(n.innerHTML) : r.text };
|
|
5245
5335
|
}, pi = (r, t) => {
|
|
5246
5336
|
const { data: e, getContentElement: n } = r;
|
|
5247
5337
|
e.text += t.text;
|
|
@@ -5257,30 +5347,35 @@ const hi = (r) => {
|
|
|
5257
5347
|
const o = T(T({}, r), t);
|
|
5258
5348
|
return typeof t.text == "string" && (n.innerHTML = t.text), { newData: o, inPlace: !0 };
|
|
5259
5349
|
}, fi = async (r) => {
|
|
5260
|
-
var
|
|
5261
|
-
const { api: t, blockId: e, data: n, getContentElement: o, syncContentFromDOM: s } = r;
|
|
5350
|
+
var p;
|
|
5351
|
+
const { api: t, blockId: e, data: n, getContentElement: o, syncContentFromDOM: s, isOpen: i } = r;
|
|
5262
5352
|
if (s(), e === void 0)
|
|
5263
5353
|
return;
|
|
5264
|
-
const
|
|
5265
|
-
if (!
|
|
5354
|
+
const l = o(), a = window.getSelection();
|
|
5355
|
+
if (!l || !a || a.rangeCount === 0)
|
|
5356
|
+
return;
|
|
5357
|
+
const c = a.getRangeAt(0), { beforeContent: d, afterContent: h } = Ci(l, c), u = (p = t.blocks.getBlockIndex(e)) != null ? p : t.blocks.getCurrentBlockIndex();
|
|
5358
|
+
if (i && h === "") {
|
|
5359
|
+
const g = t.blocks.insert("paragraph", { text: "" }, {}, u + 1, !0);
|
|
5360
|
+
t.blocks.setBlockParent(g.id, e);
|
|
5266
5361
|
return;
|
|
5267
|
-
|
|
5362
|
+
}
|
|
5268
5363
|
t.blocks.splitBlock(
|
|
5269
5364
|
e,
|
|
5270
|
-
{ text: c },
|
|
5271
|
-
_t,
|
|
5272
5365
|
{ text: d },
|
|
5273
|
-
|
|
5274
|
-
|
|
5366
|
+
Mt,
|
|
5367
|
+
{ text: h },
|
|
5368
|
+
u + 1
|
|
5369
|
+
), n.text = d;
|
|
5275
5370
|
}, mi = async (r, t) => {
|
|
5276
|
-
const { api: e, blockId: n, data: o, getContentElement: s } = r;
|
|
5277
|
-
if (n === void 0)
|
|
5371
|
+
const { api: e, blockId: n, data: o, getContentElement: s, syncContentFromDOM: i } = r;
|
|
5372
|
+
if (i(), n === void 0)
|
|
5278
5373
|
return;
|
|
5279
|
-
const
|
|
5280
|
-
if (!
|
|
5374
|
+
const l = s();
|
|
5375
|
+
if (!l || !Hn(l))
|
|
5281
5376
|
return;
|
|
5282
|
-
const
|
|
5283
|
-
|
|
5377
|
+
const a = o.text;
|
|
5378
|
+
a === "" && (t.preventDefault(), await e.blocks.convert(n, "paragraph", { text: a }));
|
|
5284
5379
|
}, Ci = (r, t) => {
|
|
5285
5380
|
if (!r.lastChild)
|
|
5286
5381
|
return { beforeContent: "", afterContent: "" };
|
|
@@ -5308,8 +5403,8 @@ class xi {
|
|
|
5308
5403
|
get placeholder() {
|
|
5309
5404
|
if (this._settings.placeholder)
|
|
5310
5405
|
return this._settings.placeholder;
|
|
5311
|
-
const t = this.api.i18n.t(
|
|
5312
|
-
return t !==
|
|
5406
|
+
const t = this.api.i18n.t(Xt);
|
|
5407
|
+
return t !== Xt ? t : "Toggle";
|
|
5313
5408
|
}
|
|
5314
5409
|
render() {
|
|
5315
5410
|
const t = jn({
|
|
@@ -5341,13 +5436,22 @@ class xi {
|
|
|
5341
5436
|
t
|
|
5342
5437
|
);
|
|
5343
5438
|
}
|
|
5439
|
+
onPaste(t) {
|
|
5440
|
+
const e = t.detail;
|
|
5441
|
+
if (!("data" in e))
|
|
5442
|
+
return;
|
|
5443
|
+
const n = e.data, o = n.querySelector("summary"), s = o !== null ? o.innerHTML : n.innerHTML;
|
|
5444
|
+
this._data = { text: s };
|
|
5445
|
+
const i = this.getContentElement();
|
|
5446
|
+
i !== null && (i.innerHTML = s);
|
|
5447
|
+
}
|
|
5344
5448
|
setData(t) {
|
|
5345
5449
|
const e = gi(
|
|
5346
5450
|
this._data,
|
|
5347
5451
|
t,
|
|
5348
5452
|
this.getContentElement.bind(this)
|
|
5349
5453
|
);
|
|
5350
|
-
return this._data = e.newData, e.inPlace;
|
|
5454
|
+
return this._data = e.newData, this.updateChildrenVisibility(), e.inPlace;
|
|
5351
5455
|
}
|
|
5352
5456
|
renderSettings() {
|
|
5353
5457
|
return [];
|
|
@@ -5370,20 +5474,23 @@ class xi {
|
|
|
5370
5474
|
return this._contentElement;
|
|
5371
5475
|
}
|
|
5372
5476
|
setOpenState(t) {
|
|
5373
|
-
this._isOpen = t, this._arrowElement && this._element &&
|
|
5477
|
+
this._isOpen = t, this._arrowElement && this._element && vt(this._arrowElement, this._element, this._isOpen), this.updateChildrenVisibility();
|
|
5374
5478
|
}
|
|
5375
5479
|
toggleOpen() {
|
|
5376
5480
|
this.setOpenState(!this._isOpen);
|
|
5377
5481
|
}
|
|
5378
5482
|
updateChildrenVisibility() {
|
|
5379
|
-
this.blockId !== void 0 &&
|
|
5483
|
+
this.blockId !== void 0 && Ht(this.api, this.blockId, this._isOpen);
|
|
5380
5484
|
}
|
|
5381
5485
|
handleKeyDown(t) {
|
|
5382
5486
|
if (t.key === "Enter" && !t.shiftKey) {
|
|
5383
5487
|
t.preventDefault(), this.handleEnter();
|
|
5384
5488
|
return;
|
|
5385
5489
|
}
|
|
5386
|
-
t.key === "Backspace"
|
|
5490
|
+
if (t.key === "Backspace") {
|
|
5491
|
+
this.handleBackspace(t);
|
|
5492
|
+
return;
|
|
5493
|
+
}
|
|
5387
5494
|
}
|
|
5388
5495
|
createKeyboardContext() {
|
|
5389
5496
|
return {
|
|
@@ -5409,16 +5516,14 @@ class xi {
|
|
|
5409
5516
|
const t = this.getContentElement();
|
|
5410
5517
|
t && (this._data.text = t.innerHTML);
|
|
5411
5518
|
}
|
|
5412
|
-
static get shortcut() {
|
|
5413
|
-
return "CMD+ALT+7";
|
|
5414
|
-
}
|
|
5415
5519
|
static get toolbox() {
|
|
5416
5520
|
return {
|
|
5417
|
-
icon:
|
|
5521
|
+
icon: Pn,
|
|
5418
5522
|
title: "Toggle list",
|
|
5419
5523
|
titleKey: "toggleList",
|
|
5420
|
-
name:
|
|
5421
|
-
searchTerms: ["toggle", "collapse", "expand", "accordion"]
|
|
5524
|
+
name: Mt,
|
|
5525
|
+
searchTerms: ["toggle", "collapse", "expand", "accordion"],
|
|
5526
|
+
shortcut: ">"
|
|
5422
5527
|
};
|
|
5423
5528
|
}
|
|
5424
5529
|
static get conversionConfig() {
|
|
@@ -5458,7 +5563,7 @@ class xi {
|
|
|
5458
5563
|
const X = (r) => {
|
|
5459
5564
|
const t = r.tagName;
|
|
5460
5565
|
return t === "B" || t === "STRONG";
|
|
5461
|
-
},
|
|
5566
|
+
}, wt = (r) => !!(r && r.nodeType === Node.ELEMENT_NODE && X(r)), Ke = (r) => r.textContent.length === 0, W = (r) => r ? r.nodeType === Node.ELEMENT_NODE && X(r) ? z(r) : W(r.parentNode) : null, z = (r) => {
|
|
5462
5567
|
if (r.tagName === "STRONG")
|
|
5463
5568
|
return r;
|
|
5464
5569
|
const t = document.createElement("strong");
|
|
@@ -5484,12 +5589,12 @@ const X = (r) => {
|
|
|
5484
5589
|
boundary: o,
|
|
5485
5590
|
boldElement: t
|
|
5486
5591
|
} : null;
|
|
5487
|
-
},
|
|
5592
|
+
}, Nt = (r, t) => r ? r === t || t.contains(r) : !1, R = {
|
|
5488
5593
|
COLLAPSED_LENGTH: "data-blok-bold-collapsed-length",
|
|
5489
5594
|
COLLAPSED_ACTIVE: "data-blok-bold-collapsed-active",
|
|
5490
5595
|
PREV_LENGTH: "data-blok-bold-prev-length",
|
|
5491
5596
|
LEADING_WHITESPACE: "data-blok-bold-leading-ws"
|
|
5492
|
-
},
|
|
5597
|
+
}, G = class G {
|
|
5493
5598
|
constructor() {
|
|
5494
5599
|
this.records = /* @__PURE__ */ new Set();
|
|
5495
5600
|
}
|
|
@@ -5497,13 +5602,13 @@ const X = (r) => {
|
|
|
5497
5602
|
* Get the singleton instance
|
|
5498
5603
|
*/
|
|
5499
5604
|
static getInstance() {
|
|
5500
|
-
return
|
|
5605
|
+
return G.instance || (G.instance = new G()), G.instance;
|
|
5501
5606
|
}
|
|
5502
5607
|
/**
|
|
5503
5608
|
* Reset the singleton instance (for testing)
|
|
5504
5609
|
*/
|
|
5505
5610
|
static reset() {
|
|
5506
|
-
|
|
5611
|
+
G.instance && G.instance.records.clear(), G.instance = null;
|
|
5507
5612
|
}
|
|
5508
5613
|
/**
|
|
5509
5614
|
* Check if there are any active exit records
|
|
@@ -5662,10 +5767,10 @@ const X = (r) => {
|
|
|
5662
5767
|
const C = a.textContent, v = C + f, k = (st = a.getAttribute(R.LEADING_WHITESPACE)) != null ? st : "", E = k.length > 0 && C.length === 0 && !v.startsWith(k) ? k + v : v, A = document.createTextNode(E);
|
|
5663
5768
|
for (; a.firstChild; )
|
|
5664
5769
|
a.removeChild(a.firstChild);
|
|
5665
|
-
if (a.appendChild(A), !(t != null && t.isCollapsed) || !
|
|
5770
|
+
if (a.appendChild(A), !(t != null && t.isCollapsed) || !Nt(t.focusNode, u))
|
|
5666
5771
|
return;
|
|
5667
|
-
const
|
|
5668
|
-
|
|
5772
|
+
const _ = document.createRange(), ut = A.textContent.length;
|
|
5773
|
+
_.setStart(A, ut), _.collapse(!0), t.removeAllRanges(), t.addRange(_);
|
|
5669
5774
|
});
|
|
5670
5775
|
}
|
|
5671
5776
|
/**
|
|
@@ -5692,10 +5797,10 @@ const X = (r) => {
|
|
|
5692
5797
|
if (v && m) {
|
|
5693
5798
|
const E = C.slice(0, g), A = C.slice(g);
|
|
5694
5799
|
m.textContent = E;
|
|
5695
|
-
const
|
|
5696
|
-
(x = l.parentNode) == null || x.insertBefore(
|
|
5800
|
+
const _ = document.createTextNode(A);
|
|
5801
|
+
(x = l.parentNode) == null || x.insertBefore(_, l.nextSibling);
|
|
5697
5802
|
}
|
|
5698
|
-
if (v && l.removeAttribute(R.PREV_LENGTH), t != null && t.isCollapsed && u &&
|
|
5803
|
+
if (v && l.removeAttribute(R.PREV_LENGTH), t != null && t.isCollapsed && u && Nt(t.focusNode, l)) {
|
|
5699
5804
|
const E = document.createRange(), A = u.textContent.length;
|
|
5700
5805
|
E.setStart(u, A), E.collapse(!0), t.removeAllRanges(), t.addRange(E);
|
|
5701
5806
|
}
|
|
@@ -5757,7 +5862,7 @@ const X = (r) => {
|
|
|
5757
5862
|
const e = t.getRangeAt(0);
|
|
5758
5863
|
if (!e.collapsed)
|
|
5759
5864
|
return;
|
|
5760
|
-
const n =
|
|
5865
|
+
const n = W(e.startContainer);
|
|
5761
5866
|
(n == null ? void 0 : n.getAttribute(R.COLLAPSED_ACTIVE)) !== "true" && (this.moveCaretFromElementContainer(t, e) || this.moveCaretFromTextContainer(t, e));
|
|
5762
5867
|
}
|
|
5763
5868
|
/**
|
|
@@ -5816,7 +5921,7 @@ const X = (r) => {
|
|
|
5816
5921
|
this.setCaret(t, n, s.length);
|
|
5817
5922
|
return;
|
|
5818
5923
|
}
|
|
5819
|
-
const l =
|
|
5924
|
+
const l = W(n);
|
|
5820
5925
|
if (!l || e.startOffset !== n.textContent.length)
|
|
5821
5926
|
return;
|
|
5822
5927
|
const a = this.ensureFollowingTextNode(l, l.nextSibling);
|
|
@@ -5862,8 +5967,8 @@ const X = (r) => {
|
|
|
5862
5967
|
return e.tagName === "STRONG" || e.tagName === "B";
|
|
5863
5968
|
}
|
|
5864
5969
|
};
|
|
5865
|
-
|
|
5866
|
-
let I =
|
|
5970
|
+
G.instance = null;
|
|
5971
|
+
let I = G;
|
|
5867
5972
|
const vi = {
|
|
5868
5973
|
convertLegacyTags: !0,
|
|
5869
5974
|
normalizeWhitespace: !0,
|
|
@@ -5871,7 +5976,7 @@ const vi = {
|
|
|
5871
5976
|
mergeAdjacent: !0,
|
|
5872
5977
|
preserveNode: null
|
|
5873
5978
|
};
|
|
5874
|
-
class
|
|
5979
|
+
class N {
|
|
5875
5980
|
/**
|
|
5876
5981
|
* Create a new normalization pass with specified options
|
|
5877
5982
|
* @param options - Configuration for the normalization pass
|
|
@@ -5895,10 +6000,10 @@ class O {
|
|
|
5895
6000
|
* @param options - Optional normalization configuration
|
|
5896
6001
|
*/
|
|
5897
6002
|
static normalizeAroundSelection(t, e) {
|
|
5898
|
-
const n =
|
|
6003
|
+
const n = N.findScopeFromSelection(t);
|
|
5899
6004
|
if (!n)
|
|
5900
6005
|
return;
|
|
5901
|
-
new
|
|
6006
|
+
new N(e).run(n);
|
|
5902
6007
|
}
|
|
5903
6008
|
/**
|
|
5904
6009
|
* Phase 1: Traverse the scope and normalize text nodes while collecting elements
|
|
@@ -5973,7 +6078,7 @@ class O {
|
|
|
5973
6078
|
* @returns true if the element is empty and doesn't contain the preserved node
|
|
5974
6079
|
*/
|
|
5975
6080
|
isEmptyAndSafe(t) {
|
|
5976
|
-
return !(t.textContent.length === 0) || I.getInstance().isActivePlaceholder(t) ? !1 : !(this.options.preserveNode &&
|
|
6081
|
+
return !(t.textContent.length === 0) || I.getInstance().isActivePlaceholder(t) ? !1 : !(this.options.preserveNode && Nt(this.options.preserveNode, t));
|
|
5977
6082
|
}
|
|
5978
6083
|
/**
|
|
5979
6084
|
* Merge a <strong> element with adjacent <strong> siblings
|
|
@@ -5981,12 +6086,12 @@ class O {
|
|
|
5981
6086
|
*/
|
|
5982
6087
|
mergeWithAdjacent(t) {
|
|
5983
6088
|
const e = t.previousSibling;
|
|
5984
|
-
if (e &&
|
|
6089
|
+
if (e && wt(e)) {
|
|
5985
6090
|
this.mergeStrongNodes(e, t);
|
|
5986
6091
|
return;
|
|
5987
6092
|
}
|
|
5988
6093
|
const n = t.nextSibling;
|
|
5989
|
-
n &&
|
|
6094
|
+
n && wt(n) && this.mergeStrongNodes(t, n);
|
|
5990
6095
|
}
|
|
5991
6096
|
/**
|
|
5992
6097
|
* Merge two <strong> elements by moving children from right to left
|
|
@@ -6016,7 +6121,7 @@ class O {
|
|
|
6016
6121
|
return o || n.closest($(B.editor));
|
|
6017
6122
|
}
|
|
6018
6123
|
}
|
|
6019
|
-
const
|
|
6124
|
+
const O = class O {
|
|
6020
6125
|
constructor() {
|
|
6021
6126
|
this.handlers = /* @__PURE__ */ new Map(), this.listenersRegistered = !1, this.handleSelectionChange = () => {
|
|
6022
6127
|
const t = this.getSelection();
|
|
@@ -6049,13 +6154,13 @@ const H = class H {
|
|
|
6049
6154
|
* Get the singleton instance
|
|
6050
6155
|
*/
|
|
6051
6156
|
static getInstance() {
|
|
6052
|
-
return
|
|
6157
|
+
return O.instance || (O.instance = new O()), O.instance;
|
|
6053
6158
|
}
|
|
6054
6159
|
/**
|
|
6055
6160
|
* Reset the singleton instance (for testing)
|
|
6056
6161
|
*/
|
|
6057
6162
|
static reset() {
|
|
6058
|
-
|
|
6163
|
+
O.instance && (O.instance.removeListeners(), O.instance.handlers.clear()), O.instance = null;
|
|
6059
6164
|
}
|
|
6060
6165
|
/**
|
|
6061
6166
|
* Register a handler for an inline tool
|
|
@@ -6107,8 +6212,8 @@ const H = class H {
|
|
|
6107
6212
|
return !(e.meta && !s || e.ctrl && !t.ctrlKey);
|
|
6108
6213
|
}
|
|
6109
6214
|
};
|
|
6110
|
-
|
|
6111
|
-
let
|
|
6215
|
+
O.instance = null;
|
|
6216
|
+
let _t = O;
|
|
6112
6217
|
const Si = (r, t) => {
|
|
6113
6218
|
try {
|
|
6114
6219
|
return r.intersectsNode(t);
|
|
@@ -6124,7 +6229,7 @@ const Si = (r, t) => {
|
|
|
6124
6229
|
{
|
|
6125
6230
|
acceptNode: (t) => Si(r, t) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT
|
|
6126
6231
|
}
|
|
6127
|
-
), J = (r, t, e) => !r || r === e ? null : r.nodeType === Node.ELEMENT_NODE && t(r) ? r : J(r.parentNode, t, e), je = (r, t) => J(r, t) !== null,
|
|
6232
|
+
), J = (r, t, e) => !r || r === e ? null : r.nodeType === Node.ELEMENT_NODE && t(r) ? r : J(r.parentNode, t, e), je = (r, t) => J(r, t) !== null, Wt = (r, t, e = {}) => {
|
|
6128
6233
|
if (r.collapsed)
|
|
6129
6234
|
return J(r.startContainer, t) !== null;
|
|
6130
6235
|
const n = Ue(r), o = [];
|
|
@@ -6164,7 +6269,7 @@ const Si = (r, t) => {
|
|
|
6164
6269
|
static initializeGlobalListeners() {
|
|
6165
6270
|
if (typeof document == "undefined")
|
|
6166
6271
|
return !1;
|
|
6167
|
-
const t =
|
|
6272
|
+
const t = _t.getInstance();
|
|
6168
6273
|
return t.hasHandler("bold") || (t.register("bold", {
|
|
6169
6274
|
shortcut: { key: "b", meta: !0 },
|
|
6170
6275
|
onShortcut: (e, n) => {
|
|
@@ -6177,7 +6282,7 @@ const Si = (r, t) => {
|
|
|
6177
6282
|
onInput: (e, n) => {
|
|
6178
6283
|
S.refreshSelectionState("input");
|
|
6179
6284
|
},
|
|
6180
|
-
onBeforeInput: (e) => e.inputType !== "formatBold" ? !1 : (
|
|
6285
|
+
onBeforeInput: (e) => e.inputType !== "formatBold" ? !1 : (N.normalizeAroundSelection(window.getSelection()), !0),
|
|
6181
6286
|
isRelevant: (e) => S.isSelectionInsideBlok(e)
|
|
6182
6287
|
}), S.guardKeydownListenerRegistered || (document.addEventListener("keydown", (e) => {
|
|
6183
6288
|
I.getInstance().guardBoundaryKeydown(e);
|
|
@@ -6199,7 +6304,7 @@ const Si = (r, t) => {
|
|
|
6199
6304
|
*/
|
|
6200
6305
|
render() {
|
|
6201
6306
|
return {
|
|
6202
|
-
icon:
|
|
6307
|
+
icon: On,
|
|
6203
6308
|
name: "bold",
|
|
6204
6309
|
onActivate: () => {
|
|
6205
6310
|
this.toggleBold();
|
|
@@ -6243,11 +6348,11 @@ const Si = (r, t) => {
|
|
|
6243
6348
|
o && n && (o.removeAllRanges(), o.addRange(n));
|
|
6244
6349
|
const s = this.findBoldElementFromRangeOrSelection(n, o);
|
|
6245
6350
|
if (!s) {
|
|
6246
|
-
|
|
6351
|
+
N.normalizeAroundSelection(o), this.notifySelectionChange();
|
|
6247
6352
|
return;
|
|
6248
6353
|
}
|
|
6249
6354
|
const i = this.mergeAdjacentBold(s);
|
|
6250
|
-
this.selectElementContents(i),
|
|
6355
|
+
this.selectElementContents(i), N.normalizeAroundSelection(o), this.notifySelectionChange();
|
|
6251
6356
|
}
|
|
6252
6357
|
/**
|
|
6253
6358
|
* Remove bold tags (<strong>) while preserving content
|
|
@@ -6261,7 +6366,7 @@ const Si = (r, t) => {
|
|
|
6261
6366
|
o.setAttribute("data-blok-bold-marker", `unwrap-${S.markerSequence++}`), o.appendChild(s), this.removeNestedBold(o), t.insertNode(o);
|
|
6262
6367
|
const i = document.createRange();
|
|
6263
6368
|
for (i.selectNodeContents(o), n.removeAllRanges(), n.addRange(i); ; ) {
|
|
6264
|
-
const d =
|
|
6369
|
+
const d = W(o);
|
|
6265
6370
|
if (!d)
|
|
6266
6371
|
break;
|
|
6267
6372
|
this.moveMarkerOutOfBold(o, d);
|
|
@@ -6270,7 +6375,7 @@ const Si = (r, t) => {
|
|
|
6270
6375
|
this.unwrapElement(o), l && a && (() => {
|
|
6271
6376
|
const d = document.createRange();
|
|
6272
6377
|
return d.setStartBefore(l), d.setEndAfter(a), n.removeAllRanges(), n.addRange(d), d;
|
|
6273
|
-
})() || n.removeAllRanges(),
|
|
6378
|
+
})() || n.removeAllRanges(), N.normalizeAroundSelection(n), e.forEach((d) => {
|
|
6274
6379
|
Ke(d) && d.remove();
|
|
6275
6380
|
}), this.notifySelectionChange();
|
|
6276
6381
|
}
|
|
@@ -6336,7 +6441,7 @@ const Si = (r, t) => {
|
|
|
6336
6441
|
* @param options.ignoreWhitespace - Whether to ignore whitespace-only text nodes
|
|
6337
6442
|
*/
|
|
6338
6443
|
isRangeBold(t, e) {
|
|
6339
|
-
return
|
|
6444
|
+
return Wt(t, X, e);
|
|
6340
6445
|
}
|
|
6341
6446
|
/**
|
|
6342
6447
|
* Remove nested bold tags from a root node
|
|
@@ -6368,11 +6473,11 @@ const Si = (r, t) => {
|
|
|
6368
6473
|
*/
|
|
6369
6474
|
findBoldElementFromRangeOrSelection(t, e) {
|
|
6370
6475
|
if (!t)
|
|
6371
|
-
return e ?
|
|
6372
|
-
const n =
|
|
6476
|
+
return e ? W(e.focusNode) : null;
|
|
6477
|
+
const n = W(t.startContainer);
|
|
6373
6478
|
if (n)
|
|
6374
6479
|
return n;
|
|
6375
|
-
const o =
|
|
6480
|
+
const o = W(t.commonAncestorContainer);
|
|
6376
6481
|
return o || (t.startContainer.nodeType === Node.ELEMENT_NODE && X(t.startContainer) ? t.startContainer : null);
|
|
6377
6482
|
}
|
|
6378
6483
|
/**
|
|
@@ -6391,13 +6496,13 @@ const Si = (r, t) => {
|
|
|
6391
6496
|
const t = window.getSelection();
|
|
6392
6497
|
if (!t || t.rangeCount === 0)
|
|
6393
6498
|
return;
|
|
6394
|
-
const e = t.getRangeAt(0), n =
|
|
6499
|
+
const e = t.getRangeAt(0), n = W(e.startContainer), o = (() => {
|
|
6395
6500
|
if (n && n.getAttribute(I.ATTR.COLLAPSED_ACTIVE) !== "true")
|
|
6396
6501
|
return I.getInstance().exit(t, n);
|
|
6397
6502
|
const s = n != null ? n : S.getBoundaryBold(e);
|
|
6398
6503
|
return s ? I.getInstance().exit(t, s) : this.startCollapsedBold(e);
|
|
6399
6504
|
})();
|
|
6400
|
-
document.dispatchEvent(new Event("selectionchange")), o && (t.removeAllRanges(), t.addRange(o)),
|
|
6505
|
+
document.dispatchEvent(new Event("selectionchange")), o && (t.removeAllRanges(), t.addRange(o)), N.normalizeAroundSelection(t), this.notifySelectionChange();
|
|
6401
6506
|
}
|
|
6402
6507
|
/**
|
|
6403
6508
|
* Insert a bold wrapper at the caret so newly typed text becomes bold
|
|
@@ -6405,7 +6510,7 @@ const Si = (r, t) => {
|
|
|
6405
6510
|
*/
|
|
6406
6511
|
startCollapsedBold(t) {
|
|
6407
6512
|
const n = I.getInstance().enter(t, (s) => this.mergeAdjacentBold(s)), o = window.getSelection();
|
|
6408
|
-
return
|
|
6513
|
+
return N.normalizeAroundSelection(o), o && n && (o.removeAllRanges(), o.addRange(n)), this.notifySelectionChange(), n;
|
|
6409
6514
|
}
|
|
6410
6515
|
/**
|
|
6411
6516
|
* Notify listeners that the selection state has changed
|
|
@@ -6437,7 +6542,7 @@ const Si = (r, t) => {
|
|
|
6437
6542
|
*/
|
|
6438
6543
|
static refreshSelectionState(t) {
|
|
6439
6544
|
const e = window.getSelection();
|
|
6440
|
-
I.getInstance().enforceLengths(e), I.getInstance().maintain(), I.getInstance().synchronize(e),
|
|
6545
|
+
I.getInstance().enforceLengths(e), I.getInstance().maintain(), I.getInstance().synchronize(e), N.normalizeAroundSelection(e, { normalizeWhitespace: !1 }), t === "input" && e && I.getInstance().moveCaretAfterBoundaryBold(e);
|
|
6441
6546
|
}
|
|
6442
6547
|
/**
|
|
6443
6548
|
* Ensure mutation observer is registered to convert legacy <b> tags
|
|
@@ -6450,7 +6555,7 @@ const Si = (r, t) => {
|
|
|
6450
6555
|
S.isProcessingMutation = !0;
|
|
6451
6556
|
try {
|
|
6452
6557
|
const n = (o) => {
|
|
6453
|
-
o && new
|
|
6558
|
+
o && new N({ mergeAdjacent: !1, removeEmpty: !1, normalizeWhitespace: !1 }).run(o);
|
|
6454
6559
|
};
|
|
6455
6560
|
e.forEach((o) => {
|
|
6456
6561
|
o.addedNodes.forEach((s) => {
|
|
@@ -6493,11 +6598,11 @@ const Si = (r, t) => {
|
|
|
6493
6598
|
static getBoundaryBoldForText(t, e) {
|
|
6494
6599
|
const n = e.textContent.length;
|
|
6495
6600
|
if (t.startOffset === n)
|
|
6496
|
-
return
|
|
6601
|
+
return W(e);
|
|
6497
6602
|
if (t.startOffset !== 0)
|
|
6498
6603
|
return null;
|
|
6499
6604
|
const o = e.previousSibling;
|
|
6500
|
-
return
|
|
6605
|
+
return wt(o) ? o : null;
|
|
6501
6606
|
}
|
|
6502
6607
|
/**
|
|
6503
6608
|
* Get boundary bold when caret container is an element
|
|
@@ -6508,7 +6613,7 @@ const Si = (r, t) => {
|
|
|
6508
6613
|
if (t.startOffset <= 0)
|
|
6509
6614
|
return null;
|
|
6510
6615
|
const n = e.childNodes[t.startOffset - 1];
|
|
6511
|
-
return
|
|
6616
|
+
return wt(n) ? n : null;
|
|
6512
6617
|
}
|
|
6513
6618
|
/**
|
|
6514
6619
|
* Check if a selection is inside the blok
|
|
@@ -6548,7 +6653,7 @@ const Si = (r, t) => {
|
|
|
6548
6653
|
}
|
|
6549
6654
|
};
|
|
6550
6655
|
S.isInline = !0, S.title = "Bold", S.titleKey = "bold", S.markerSequence = 0, S.isProcessingMutation = !1, S.instances = /* @__PURE__ */ new Set(), S.guardKeydownListenerRegistered = !1, S.shortcut = "CMD+B";
|
|
6551
|
-
let
|
|
6656
|
+
let be = S;
|
|
6552
6657
|
const yt = (r) => {
|
|
6553
6658
|
const t = r.tagName;
|
|
6554
6659
|
return t === "I" || t === "EM";
|
|
@@ -6569,7 +6674,7 @@ const yt = (r) => {
|
|
|
6569
6674
|
*/
|
|
6570
6675
|
render() {
|
|
6571
6676
|
return {
|
|
6572
|
-
icon:
|
|
6677
|
+
icon: Nn,
|
|
6573
6678
|
name: "italic",
|
|
6574
6679
|
onActivate: () => {
|
|
6575
6680
|
this.toggleItalic();
|
|
@@ -6628,7 +6733,7 @@ const yt = (r) => {
|
|
|
6628
6733
|
* @param options - Options for checking italic status
|
|
6629
6734
|
*/
|
|
6630
6735
|
isRangeItalic(t, e) {
|
|
6631
|
-
return
|
|
6736
|
+
return Wt(t, yt, e);
|
|
6632
6737
|
}
|
|
6633
6738
|
/**
|
|
6634
6739
|
* Wrap selection with <i> tag
|
|
@@ -6770,7 +6875,7 @@ const yt = (r) => {
|
|
|
6770
6875
|
}
|
|
6771
6876
|
};
|
|
6772
6877
|
tt.isInline = !0, tt.title = "Italic", tt.titleKey = "italic", tt.shortcut = "CMD+I";
|
|
6773
|
-
let
|
|
6878
|
+
let ye = tt;
|
|
6774
6879
|
const et = class et {
|
|
6775
6880
|
/**
|
|
6776
6881
|
* @param api - Blok API
|
|
@@ -6806,7 +6911,7 @@ const et = class et {
|
|
|
6806
6911
|
*/
|
|
6807
6912
|
render() {
|
|
6808
6913
|
return {
|
|
6809
|
-
icon:
|
|
6914
|
+
icon: _n,
|
|
6810
6915
|
name: "link",
|
|
6811
6916
|
isActive: () => !!this.selection.findParentTag("A"),
|
|
6812
6917
|
children: {
|
|
@@ -6865,7 +6970,7 @@ const et = class et {
|
|
|
6865
6970
|
*/
|
|
6866
6971
|
getButtonElement() {
|
|
6867
6972
|
const t = document.querySelector(
|
|
6868
|
-
`${$(B.interface,
|
|
6973
|
+
`${$(B.interface, Gn)} [data-blok-item-name="link"]`
|
|
6869
6974
|
);
|
|
6870
6975
|
return t && t !== this.nodes.button && (t.addEventListener("click", this.handleButtonClick, !0), this.nodes.button = t), t;
|
|
6871
6976
|
}
|
|
@@ -6922,7 +7027,7 @@ const et = class et {
|
|
|
6922
7027
|
this.notifier.show({
|
|
6923
7028
|
message: this.i18n.t("tools.link.invalidLink"),
|
|
6924
7029
|
style: "error"
|
|
6925
|
-
}),
|
|
7030
|
+
}), Mn("Incorrect Link pasted", "warn", e);
|
|
6926
7031
|
return;
|
|
6927
7032
|
}
|
|
6928
7033
|
const n = this.prepareLink(e);
|
|
@@ -7000,8 +7105,8 @@ const et = class et {
|
|
|
7000
7105
|
}
|
|
7001
7106
|
};
|
|
7002
7107
|
et.isInline = !0, et.title = "Link", et.titleKey = "link", et.shortcut = "CMD+K";
|
|
7003
|
-
let
|
|
7004
|
-
const ct = (r) => r.tagName === "MARK",
|
|
7108
|
+
let ve = et;
|
|
7109
|
+
const ct = (r) => r.tagName === "MARK", It = (r) => J(r, ct), Se = {
|
|
7005
7110
|
color: "background-color",
|
|
7006
7111
|
"background-color": "color"
|
|
7007
7112
|
}, U = class U {
|
|
@@ -7043,14 +7148,14 @@ const ct = (r) => r.tagName === "MARK", Bt = (r) => J(r, ct), ve = {
|
|
|
7043
7148
|
*/
|
|
7044
7149
|
render() {
|
|
7045
7150
|
return {
|
|
7046
|
-
icon:
|
|
7151
|
+
icon: Te,
|
|
7047
7152
|
name: "marker",
|
|
7048
7153
|
isActive: () => {
|
|
7049
7154
|
const t = window.getSelection();
|
|
7050
7155
|
if (!t || t.rangeCount === 0)
|
|
7051
7156
|
return !1;
|
|
7052
7157
|
const e = t.getRangeAt(0);
|
|
7053
|
-
return
|
|
7158
|
+
return Wt(e, ct, { ignoreWhitespace: !0 });
|
|
7054
7159
|
},
|
|
7055
7160
|
children: {
|
|
7056
7161
|
hideChevron: !0,
|
|
@@ -7112,7 +7217,7 @@ const ct = (r) => r.tagName === "MARK", Bt = (r) => J(r, ct), ve = {
|
|
|
7112
7217
|
const n = e.getRangeAt(0), o = n.startContainer, s = n.startOffset, i = n.endContainer, l = n.endOffset, a = n.toString(), c = n.commonAncestorContainer, d = c.nodeType === Node.ELEMENT_NODE ? c : c.parentElement, h = d != null && d.closest("mark") && (m = (f = d.closest("mark")) == null ? void 0 : f.parentElement) != null ? m : d, u = dt(n, ct);
|
|
7113
7218
|
for (const C of u) {
|
|
7114
7219
|
C.style.removeProperty(t);
|
|
7115
|
-
const v =
|
|
7220
|
+
const v = Se[t], k = C.style.getPropertyValue(v);
|
|
7116
7221
|
k !== "" && k !== "transparent" ? this.ensureTransparentBg(C) : this.unwrapElement(C);
|
|
7117
7222
|
}
|
|
7118
7223
|
const p = o.isConnected, g = i.isConnected;
|
|
@@ -7149,7 +7254,7 @@ const ct = (r) => r.tagName === "MARK", Bt = (r) => J(r, ct), ve = {
|
|
|
7149
7254
|
const t = window.getSelection();
|
|
7150
7255
|
if (!t || t.rangeCount === 0)
|
|
7151
7256
|
return null;
|
|
7152
|
-
const e = t.getRangeAt(0), n =
|
|
7257
|
+
const e = t.getRangeAt(0), n = It(e.startContainer);
|
|
7153
7258
|
if (!n)
|
|
7154
7259
|
return null;
|
|
7155
7260
|
const o = n.style.getPropertyValue("color");
|
|
@@ -7169,7 +7274,7 @@ const ct = (r) => r.tagName === "MARK", Bt = (r) => J(r, ct), ve = {
|
|
|
7169
7274
|
* @param range - The range to check
|
|
7170
7275
|
*/
|
|
7171
7276
|
findContainingMark(t) {
|
|
7172
|
-
const e =
|
|
7277
|
+
const e = It(t.startContainer), n = It(t.endContainer);
|
|
7173
7278
|
return e && e === n ? e : null;
|
|
7174
7279
|
}
|
|
7175
7280
|
/**
|
|
@@ -7181,7 +7286,7 @@ const ct = (r) => r.tagName === "MARK", Bt = (r) => J(r, ct), ve = {
|
|
|
7181
7286
|
const n = dt(t, ct);
|
|
7182
7287
|
for (const o of n) {
|
|
7183
7288
|
o.style.removeProperty(e);
|
|
7184
|
-
const s =
|
|
7289
|
+
const s = Se[e], i = o.style.getPropertyValue(s);
|
|
7185
7290
|
i !== "" && i !== "transparent" ? this.ensureTransparentBg(o) : this.unwrapElement(o);
|
|
7186
7291
|
}
|
|
7187
7292
|
}
|
|
@@ -7328,7 +7433,7 @@ const ct = (r) => r.tagName === "MARK", Bt = (r) => J(r, ct), ve = {
|
|
|
7328
7433
|
}
|
|
7329
7434
|
};
|
|
7330
7435
|
U.isInline = !0, U.title = "Color", U.titleKey = "marker", U.shortcut = "CMD+SHIFT+H", U.ALLOWED_STYLE_PROPS = /* @__PURE__ */ new Set(["color", "background-color"]);
|
|
7331
|
-
let
|
|
7436
|
+
let we = U;
|
|
7332
7437
|
const Ti = {
|
|
7333
7438
|
paragraph: { preserveBlank: !0 },
|
|
7334
7439
|
header: {},
|
|
@@ -7342,14 +7447,14 @@ const Ti = {
|
|
|
7342
7447
|
marker: {}
|
|
7343
7448
|
};
|
|
7344
7449
|
export {
|
|
7345
|
-
|
|
7450
|
+
be as Bold,
|
|
7346
7451
|
Ii as Convert,
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7452
|
+
Jt as Header,
|
|
7453
|
+
ye as Italic,
|
|
7454
|
+
ve as Link,
|
|
7350
7455
|
Ei as List,
|
|
7351
|
-
|
|
7352
|
-
|
|
7456
|
+
we as Marker,
|
|
7457
|
+
Zt as Paragraph,
|
|
7353
7458
|
Ai as Table,
|
|
7354
7459
|
xi as Toggle,
|
|
7355
7460
|
Ti as defaultBlockTools,
|