@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/src/tools/table/index.ts
CHANGED
|
@@ -71,6 +71,7 @@ const WRAPPER_EDIT_CLASSES = [
|
|
|
71
71
|
'after:left-0',
|
|
72
72
|
'after:right-0',
|
|
73
73
|
'after:h-10',
|
|
74
|
+
'after:pointer-events-none',
|
|
74
75
|
];
|
|
75
76
|
|
|
76
77
|
/**
|
|
@@ -405,9 +406,7 @@ export class Table implements BlockTool {
|
|
|
405
406
|
applyCellColors(gridEl, this.model.snapshot().content);
|
|
406
407
|
|
|
407
408
|
if (this.isNewTable) {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
firstEditable?.focus();
|
|
409
|
+
this.cellSelection?.selectRange({ minRow: 0, maxRow: 0, minCol: 0, maxCol: 0 });
|
|
411
410
|
}
|
|
412
411
|
}
|
|
413
412
|
|
|
@@ -79,6 +79,7 @@ export class TableAddControls {
|
|
|
79
79
|
private dragState: DragState | null = null;
|
|
80
80
|
|
|
81
81
|
private boundMouseMove: (e: MouseEvent) => void;
|
|
82
|
+
private boundDocumentMouseMove: (e: MouseEvent) => void;
|
|
82
83
|
private boundMouseLeave: () => void;
|
|
83
84
|
private boundAddRowClick: () => void;
|
|
84
85
|
private boundAddColClick: () => void;
|
|
@@ -110,6 +111,7 @@ export class TableAddControls {
|
|
|
110
111
|
this.onDragEnd = options.onDragEnd;
|
|
111
112
|
this.getNewColumnWidth = options.getNewColumnWidth;
|
|
112
113
|
this.boundMouseMove = this.handleMouseMove.bind(this);
|
|
114
|
+
this.boundDocumentMouseMove = this.handleDocumentMouseMove.bind(this);
|
|
113
115
|
this.boundMouseLeave = this.handleMouseLeave.bind(this);
|
|
114
116
|
this.boundPointerMove = this.handlePointerMove.bind(this);
|
|
115
117
|
this.boundPointerUp = this.handlePointerUp.bind(this);
|
|
@@ -126,10 +128,10 @@ export class TableAddControls {
|
|
|
126
128
|
|
|
127
129
|
this.wrapper.addEventListener('mousemove', this.boundMouseMove);
|
|
128
130
|
this.wrapper.addEventListener('mouseleave', this.boundMouseLeave);
|
|
131
|
+
document.addEventListener('mousemove', this.boundDocumentMouseMove);
|
|
129
132
|
|
|
130
133
|
this.addRowBtn.addEventListener('pointerdown', this.boundRowPointerDown);
|
|
131
134
|
this.addColBtn.addEventListener('pointerdown', this.boundColPointerDown);
|
|
132
|
-
|
|
133
135
|
}
|
|
134
136
|
|
|
135
137
|
/**
|
|
@@ -212,6 +214,7 @@ export class TableAddControls {
|
|
|
212
214
|
public destroy(): void {
|
|
213
215
|
this.wrapper.removeEventListener('mousemove', this.boundMouseMove);
|
|
214
216
|
this.wrapper.removeEventListener('mouseleave', this.boundMouseLeave);
|
|
217
|
+
document.removeEventListener('mousemove', this.boundDocumentMouseMove);
|
|
215
218
|
this.addRowBtn.removeEventListener('pointerdown', this.boundRowPointerDown);
|
|
216
219
|
this.addColBtn.removeEventListener('pointerdown', this.boundColPointerDown);
|
|
217
220
|
|
|
@@ -399,6 +402,31 @@ export class TableAddControls {
|
|
|
399
402
|
this.scheduleHideCol();
|
|
400
403
|
}
|
|
401
404
|
|
|
405
|
+
/**
|
|
406
|
+
* Document-level mousemove handler.
|
|
407
|
+
* Catches mouse movements outside the wrapper (e.g. in the ::after
|
|
408
|
+
* pseudo-element zone below the grid, which has pointer-events-none).
|
|
409
|
+
* Only delegates to handleMouseMove when the cursor is within the
|
|
410
|
+
* proximity zone around the grid to avoid unnecessary work.
|
|
411
|
+
*/
|
|
412
|
+
private handleDocumentMouseMove(e: MouseEvent): void {
|
|
413
|
+
if (this.wrapper.contains(e.target as Node)) {
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
const gridRect = this.grid.getBoundingClientRect();
|
|
418
|
+
const margin = PROXIMITY_PX;
|
|
419
|
+
const nearGrid =
|
|
420
|
+
e.clientX >= gridRect.left - margin &&
|
|
421
|
+
e.clientX <= gridRect.right + margin &&
|
|
422
|
+
e.clientY >= gridRect.top - margin &&
|
|
423
|
+
e.clientY <= gridRect.bottom + margin;
|
|
424
|
+
|
|
425
|
+
if (nearGrid) {
|
|
426
|
+
this.handleMouseMove(e);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
402
430
|
private showRow(): void {
|
|
403
431
|
this.clearRowTimeout();
|
|
404
432
|
|
|
@@ -86,6 +86,9 @@ export class TableCellBlocks {
|
|
|
86
86
|
/** Events deferred during structural operations, replayed or discarded afterward. */
|
|
87
87
|
private deferredEvents: Array<unknown> = [];
|
|
88
88
|
|
|
89
|
+
/** When true, handleBlockMutation skips claiming so exitTableForward's new block stays outside the grid. */
|
|
90
|
+
private isExitingTable = false;
|
|
91
|
+
|
|
89
92
|
constructor(options: TableCellBlocksOptions) {
|
|
90
93
|
this.api = options.api;
|
|
91
94
|
this.gridElement = options.gridElement;
|
|
@@ -140,6 +143,12 @@ export class TableCellBlocks {
|
|
|
140
143
|
|
|
141
144
|
return;
|
|
142
145
|
}
|
|
146
|
+
|
|
147
|
+
// ArrowDown at last row -> exit table
|
|
148
|
+
if (event.key === 'ArrowDown' && position.row === this.getRowCount() - 1) {
|
|
149
|
+
event.preventDefault();
|
|
150
|
+
this.exitTableForward();
|
|
151
|
+
}
|
|
143
152
|
}
|
|
144
153
|
|
|
145
154
|
/**
|
|
@@ -161,7 +170,12 @@ export class TableCellBlocks {
|
|
|
161
170
|
|
|
162
171
|
if (nextRow < this.getRowCount()) {
|
|
163
172
|
this.navigateToCell({ row: nextRow, col: 0 });
|
|
173
|
+
|
|
174
|
+
return;
|
|
164
175
|
}
|
|
176
|
+
|
|
177
|
+
// At the very last cell — exit the table by focusing or creating a block below
|
|
178
|
+
this.exitTableForward();
|
|
165
179
|
}
|
|
166
180
|
|
|
167
181
|
/**
|
|
@@ -182,7 +196,82 @@ export class TableCellBlocks {
|
|
|
182
196
|
|
|
183
197
|
if (prevRow >= 0) {
|
|
184
198
|
this.navigateToCell({ row: prevRow, col: this.getColumnCount() - 1 }, true);
|
|
199
|
+
|
|
200
|
+
return;
|
|
185
201
|
}
|
|
202
|
+
|
|
203
|
+
// At the very first cell — exit the table by focusing the block above
|
|
204
|
+
this.exitTableBackward();
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Exit the table by focusing the first block after it, or creating one if none exists.
|
|
209
|
+
*/
|
|
210
|
+
private exitTableForward(): void {
|
|
211
|
+
const tableIndex = this.api.blocks.getBlockIndex(this.tableBlockId);
|
|
212
|
+
|
|
213
|
+
if (tableIndex === undefined) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const blockAfterTable = this.findFirstBlockAfterTable(tableIndex);
|
|
218
|
+
|
|
219
|
+
if (blockAfterTable !== null) {
|
|
220
|
+
this.api.caret.setToBlock(blockAfterTable.id, 'start');
|
|
221
|
+
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* No block after the table — create a new default block.
|
|
227
|
+
* Set isExitingTable so handleBlockMutation does not claim the new block
|
|
228
|
+
* into a cell (the block-added event fires synchronously during insert).
|
|
229
|
+
*/
|
|
230
|
+
this.isExitingTable = true;
|
|
231
|
+
|
|
232
|
+
try {
|
|
233
|
+
const totalBlocks = this.api.blocks.getBlocksCount();
|
|
234
|
+
const newBlock = this.api.blocks.insert(undefined, {}, {}, totalBlocks, true);
|
|
235
|
+
|
|
236
|
+
this.api.caret.setToBlock(newBlock.id, 'start');
|
|
237
|
+
} finally {
|
|
238
|
+
this.isExitingTable = false;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Exit the table backward by focusing the block before the table.
|
|
244
|
+
* If no block exists before the table, do nothing.
|
|
245
|
+
*/
|
|
246
|
+
private exitTableBackward(): void {
|
|
247
|
+
const tableIndex = this.api.blocks.getBlockIndex(this.tableBlockId);
|
|
248
|
+
|
|
249
|
+
if (tableIndex === undefined || tableIndex === 0) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// The block immediately before the table in the flat array
|
|
254
|
+
const blockBefore = this.api.blocks.getBlockByIndex(tableIndex - 1);
|
|
255
|
+
|
|
256
|
+
if (blockBefore) {
|
|
257
|
+
this.api.caret.setToBlock(blockBefore.id, 'end');
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Scan the flat block array starting after the table block, skipping all blocks
|
|
263
|
+
* whose holder is inside the table grid, and return the first non-child block.
|
|
264
|
+
* Returns null if no such block exists.
|
|
265
|
+
*/
|
|
266
|
+
private findFirstBlockAfterTable(tableIndex: number): { id: string } | null {
|
|
267
|
+
const totalBlocks = this.api.blocks.getBlocksCount();
|
|
268
|
+
const candidates = Array.from({ length: totalBlocks - tableIndex - 1 }, (_, offset) =>
|
|
269
|
+
this.api.blocks.getBlockByIndex(tableIndex + 1 + offset)
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
return candidates.find(block =>
|
|
273
|
+
block !== null && block !== undefined && !this.gridElement.contains(block.holder)
|
|
274
|
+
) ?? null;
|
|
186
275
|
}
|
|
187
276
|
|
|
188
277
|
/**
|
|
@@ -481,6 +570,10 @@ export class TableCellBlocks {
|
|
|
481
570
|
return;
|
|
482
571
|
}
|
|
483
572
|
|
|
573
|
+
if (this.isExitingTable) {
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
|
|
484
577
|
if (!this.isBlockMutationEvent(data)) {
|
|
485
578
|
return;
|
|
486
579
|
}
|
|
@@ -32,12 +32,12 @@ export const TOGGLE_WRAPPER_STYLES = 'flex items-start';
|
|
|
32
32
|
/**
|
|
33
33
|
* Styles for the toggle arrow button
|
|
34
34
|
*/
|
|
35
|
-
export const ARROW_STYLES = 'flex-shrink-0 w-6 h-6 flex items-center justify-center cursor-pointer select-none rounded hover:bg-black/5 transition-all duration-200 ease-in-out mt-px';
|
|
35
|
+
export const ARROW_STYLES = 'flex-shrink-0 w-6 h-6 flex items-center justify-center cursor-pointer select-none rounded hover:bg-black/5 transition-all duration-200 ease-in-out mt-px focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:outline-none';
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* SVG icon for the toggle arrow
|
|
39
39
|
*/
|
|
40
|
-
export const ARROW_ICON = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4.5 2.5L8.5 6L4.5 9.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
40
|
+
export const ARROW_ICON = '<svg aria-hidden="true" width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4.5 2.5L8.5 6L4.5 9.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* Data attributes specific to the toggle tool
|
|
@@ -70,20 +70,40 @@ export const buildToggleItem = (context: ToggleDOMBuilderContext): ToggleBuildRe
|
|
|
70
70
|
return { wrapper, arrowElement, contentElement };
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Options for building arrow element
|
|
75
|
+
*/
|
|
76
|
+
export interface BuildArrowOptions {
|
|
77
|
+
/** Set contentEditable="false" on the arrow (used by Header to prevent caret entering arrow) */
|
|
78
|
+
contentEditableFalse?: boolean;
|
|
79
|
+
}
|
|
80
|
+
|
|
73
81
|
/**
|
|
74
82
|
* Build the arrow element for toggling open/closed state.
|
|
75
83
|
*
|
|
76
84
|
* @param isOpen - Whether the toggle is currently open
|
|
77
85
|
* @param onArrowClick - Callback when arrow is clicked
|
|
86
|
+
* @param options - Optional configuration
|
|
78
87
|
* @returns The arrow element
|
|
79
88
|
*/
|
|
80
|
-
const buildArrow = (
|
|
81
|
-
|
|
89
|
+
export const buildArrow = (
|
|
90
|
+
isOpen: boolean,
|
|
91
|
+
onArrowClick: () => void,
|
|
92
|
+
options: BuildArrowOptions = {}
|
|
93
|
+
): HTMLElement => {
|
|
94
|
+
const arrow = document.createElement('span');
|
|
82
95
|
arrow.className = ARROW_STYLES;
|
|
83
96
|
arrow.setAttribute(TOGGLE_ATTR.toggleArrow, '');
|
|
97
|
+
arrow.setAttribute(DATA_ATTR.mutationFree, 'true');
|
|
84
98
|
arrow.setAttribute('role', 'button');
|
|
85
|
-
arrow.setAttribute('tabindex', '
|
|
86
|
-
arrow.setAttribute('aria-label', '
|
|
99
|
+
arrow.setAttribute('tabindex', '0');
|
|
100
|
+
arrow.setAttribute('aria-label', isOpen ? 'Collapse' : 'Expand');
|
|
101
|
+
arrow.setAttribute('aria-expanded', String(isOpen));
|
|
102
|
+
|
|
103
|
+
if (options.contentEditableFalse === true) {
|
|
104
|
+
arrow.contentEditable = 'false';
|
|
105
|
+
}
|
|
106
|
+
|
|
87
107
|
arrow.innerHTML = ARROW_ICON;
|
|
88
108
|
|
|
89
109
|
if (isOpen) {
|
|
@@ -95,6 +115,14 @@ const buildArrow = (isOpen: boolean, onArrowClick: () => void): HTMLElement => {
|
|
|
95
115
|
onArrowClick();
|
|
96
116
|
});
|
|
97
117
|
|
|
118
|
+
arrow.addEventListener('keydown', (event: KeyboardEvent) => {
|
|
119
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
event.stopPropagation();
|
|
122
|
+
onArrowClick();
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
98
126
|
return arrow;
|
|
99
127
|
};
|
|
100
128
|
|
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
ConversionConfig,
|
|
14
14
|
ToolSanitizerConfig,
|
|
15
15
|
PasteConfig,
|
|
16
|
+
PasteEvent,
|
|
16
17
|
} from '../../../types';
|
|
17
18
|
import type { MenuConfig } from '../../../types/tools/menu-config';
|
|
18
19
|
|
|
@@ -115,6 +116,26 @@ export class ToggleItem implements BlockTool {
|
|
|
115
116
|
);
|
|
116
117
|
}
|
|
117
118
|
|
|
119
|
+
public onPaste(event: PasteEvent): void {
|
|
120
|
+
const detail = event.detail;
|
|
121
|
+
|
|
122
|
+
if (!('data' in detail)) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const content = detail.data as HTMLElement;
|
|
127
|
+
const summary = content.querySelector('summary');
|
|
128
|
+
const text = summary !== null ? summary.innerHTML : content.innerHTML;
|
|
129
|
+
|
|
130
|
+
this._data = { text };
|
|
131
|
+
|
|
132
|
+
const contentEl = this.getContentElement();
|
|
133
|
+
|
|
134
|
+
if (contentEl !== null) {
|
|
135
|
+
contentEl.innerHTML = text;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
118
139
|
public setData(newData: ToggleItemData): boolean {
|
|
119
140
|
const result = setToggleItemData(
|
|
120
141
|
this._data,
|
|
@@ -124,6 +145,8 @@ export class ToggleItem implements BlockTool {
|
|
|
124
145
|
|
|
125
146
|
this._data = result.newData;
|
|
126
147
|
|
|
148
|
+
this.updateChildrenVisibility();
|
|
149
|
+
|
|
127
150
|
return result.inPlace;
|
|
128
151
|
}
|
|
129
152
|
|
|
@@ -191,6 +214,8 @@ export class ToggleItem implements BlockTool {
|
|
|
191
214
|
|
|
192
215
|
if (event.key === 'Backspace') {
|
|
193
216
|
void this.handleBackspace(event);
|
|
217
|
+
|
|
218
|
+
return;
|
|
194
219
|
}
|
|
195
220
|
}
|
|
196
221
|
|
|
@@ -225,10 +250,6 @@ export class ToggleItem implements BlockTool {
|
|
|
225
250
|
}
|
|
226
251
|
}
|
|
227
252
|
|
|
228
|
-
public static get shortcut(): string {
|
|
229
|
-
return 'CMD+ALT+7';
|
|
230
|
-
}
|
|
231
|
-
|
|
232
253
|
public static get toolbox(): ToolboxConfig {
|
|
233
254
|
return {
|
|
234
255
|
icon: IconToggleList,
|
|
@@ -236,6 +257,7 @@ export class ToggleItem implements BlockTool {
|
|
|
236
257
|
titleKey: 'toggleList',
|
|
237
258
|
name: TOOL_NAME,
|
|
238
259
|
searchTerms: ['toggle', 'collapse', 'expand', 'accordion'],
|
|
260
|
+
shortcut: '>',
|
|
239
261
|
};
|
|
240
262
|
}
|
|
241
263
|
|
|
@@ -28,10 +28,13 @@ export interface ToggleKeyboardContext {
|
|
|
28
28
|
/**
|
|
29
29
|
* Handle Enter key - sync content from DOM and split the block at the caret position.
|
|
30
30
|
*
|
|
31
|
+
* When the toggle is open and the caret is at the end of the content,
|
|
32
|
+
* creates a child paragraph inside the toggle instead of splitting.
|
|
33
|
+
*
|
|
31
34
|
* @param context - The toggle keyboard context
|
|
32
35
|
*/
|
|
33
36
|
export const handleToggleEnter = async (context: ToggleKeyboardContext): Promise<void> => {
|
|
34
|
-
const { api, blockId, data, getContentElement, syncContentFromDOM } = context;
|
|
37
|
+
const { api, blockId, data, getContentElement, syncContentFromDOM, isOpen } = context;
|
|
35
38
|
|
|
36
39
|
syncContentFromDOM();
|
|
37
40
|
|
|
@@ -51,6 +54,18 @@ export const handleToggleEnter = async (context: ToggleKeyboardContext): Promise
|
|
|
51
54
|
|
|
52
55
|
const currentBlockIndex = api.blocks.getBlockIndex(blockId) ?? api.blocks.getCurrentBlockIndex();
|
|
53
56
|
|
|
57
|
+
/**
|
|
58
|
+
* When toggle is open and caret is at the end (no content after caret),
|
|
59
|
+
* create a child paragraph inside the toggle rather than a sibling toggle.
|
|
60
|
+
*/
|
|
61
|
+
if (isOpen && afterContent === '') {
|
|
62
|
+
const newBlock = api.blocks.insert('paragraph', { text: '' }, {}, currentBlockIndex + 1, true);
|
|
63
|
+
|
|
64
|
+
api.blocks.setBlockParent(newBlock.id, blockId);
|
|
65
|
+
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
54
69
|
api.blocks.splitBlock(
|
|
55
70
|
blockId,
|
|
56
71
|
{ text: beforeContent },
|
|
@@ -76,7 +91,9 @@ export const handleToggleBackspace = async (
|
|
|
76
91
|
context: ToggleKeyboardContext,
|
|
77
92
|
event: KeyboardEvent
|
|
78
93
|
): Promise<void> => {
|
|
79
|
-
const { api, blockId, data, getContentElement } = context;
|
|
94
|
+
const { api, blockId, data, getContentElement, syncContentFromDOM } = context;
|
|
95
|
+
|
|
96
|
+
syncContentFromDOM();
|
|
80
97
|
|
|
81
98
|
if (blockId === undefined) {
|
|
82
99
|
return;
|
|
@@ -56,6 +56,7 @@ export const updateArrowState = (arrowEl: HTMLElement, wrapper: HTMLElement, isO
|
|
|
56
56
|
|
|
57
57
|
style.transform = isOpen ? 'rotate(90deg)' : '';
|
|
58
58
|
arrowEl.setAttribute('aria-label', isOpen ? 'Collapse' : 'Expand');
|
|
59
|
+
arrowEl.setAttribute('aria-expanded', String(isOpen));
|
|
59
60
|
wrapper.setAttribute(TOGGLE_ATTR.toggleOpen, String(isOpen));
|
|
60
61
|
};
|
|
61
62
|
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Toggle Shortcuts - Manages the collapse/expand-all keyboard shortcut (CMD+ALT+T).
|
|
3
3
|
*
|
|
4
|
-
* Iterates all blocks in the editor and toggles all
|
|
5
|
-
*
|
|
6
|
-
* - If
|
|
4
|
+
* Iterates all blocks in the editor and toggles all collapsible blocks
|
|
5
|
+
* (toggle blocks and toggle headings):
|
|
6
|
+
* - If any collapsible block is collapsed, expands all
|
|
7
|
+
* - If all collapsible blocks are expanded, collapses all
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
import type { API } from '../../../types';
|
|
10
11
|
|
|
11
12
|
import { Shortcuts } from '../../components/utils/shortcuts';
|
|
12
13
|
|
|
13
|
-
import { TOGGLE_ATTR
|
|
14
|
+
import { TOGGLE_ATTR } from './constants';
|
|
14
15
|
|
|
15
16
|
const COLLAPSE_EXPAND_ALL_SHORTCUT = 'CMD+ALT+T';
|
|
16
17
|
|
|
@@ -29,12 +30,16 @@ export class ToggleShortcuts {
|
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Register the CMD+ALT+T shortcut on the document.
|
|
33
|
+
* Pre-clears any stale registration to handle cases where a previous editor
|
|
34
|
+
* instance was not fully destroyed (e.g. Storybook story switching).
|
|
32
35
|
*/
|
|
33
36
|
public register(): void {
|
|
34
37
|
if (this.registered) {
|
|
35
38
|
return;
|
|
36
39
|
}
|
|
37
40
|
|
|
41
|
+
Shortcuts.remove(document, COLLAPSE_EXPAND_ALL_SHORTCUT);
|
|
42
|
+
|
|
38
43
|
Shortcuts.add({
|
|
39
44
|
name: COLLAPSE_EXPAND_ALL_SHORTCUT,
|
|
40
45
|
on: document,
|
|
@@ -73,8 +78,8 @@ export class ToggleShortcuts {
|
|
|
73
78
|
}
|
|
74
79
|
|
|
75
80
|
/**
|
|
76
|
-
* Toggle all toggle blocks.
|
|
77
|
-
* If any
|
|
81
|
+
* Toggle all collapsible blocks (toggle blocks and toggle headings).
|
|
82
|
+
* If any is collapsed, expand all. If all are expanded, collapse all.
|
|
78
83
|
*/
|
|
79
84
|
private toggleAll(): void {
|
|
80
85
|
const blockCount = this.api.blocks.getBlocksCount();
|
|
@@ -83,12 +88,17 @@ export class ToggleShortcuts {
|
|
|
83
88
|
for (const i of Array.from({ length: blockCount }, (_, idx) => idx)) {
|
|
84
89
|
const block = this.api.blocks.getBlockByIndex(i);
|
|
85
90
|
|
|
86
|
-
if (block === undefined
|
|
91
|
+
if (block === undefined) {
|
|
87
92
|
continue;
|
|
88
93
|
}
|
|
89
94
|
|
|
90
95
|
const toggleWrapper = block.holder.querySelector(`[${TOGGLE_ATTR.toggleOpen}]`);
|
|
91
|
-
|
|
96
|
+
|
|
97
|
+
if (toggleWrapper === null) {
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const isOpen = toggleWrapper.getAttribute(TOGGLE_ATTR.toggleOpen) === 'true';
|
|
92
102
|
|
|
93
103
|
toggleBlocks.push({ call: (method: string) => block.call(method), isOpen });
|
|
94
104
|
}
|
|
@@ -78,6 +78,14 @@ export interface PopoverParams {
|
|
|
78
78
|
* Use 'auto' to fit content width.
|
|
79
79
|
*/
|
|
80
80
|
width?: string;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Optional element whose left edge should be used for horizontal positioning.
|
|
84
|
+
* When provided, the popover's left position uses this element's left coordinate
|
|
85
|
+
* instead of the trigger's left. Useful for aligning the toolbox popover to the
|
|
86
|
+
* block content area rather than to the plus button.
|
|
87
|
+
*/
|
|
88
|
+
leftAlignElement?: HTMLElement;
|
|
81
89
|
}
|
|
82
90
|
|
|
83
91
|
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { ae as s, t as f } from "./inline-tool-convert-CvFW2iie.mjs";
|
|
2
|
-
const a = {
|
|
3
|
-
wrapper: s(
|
|
4
|
-
"fixed z-2 bottom-5 left-5",
|
|
5
|
-
'font-[-apple-system,BlinkMacSystemFont,"Segoe_UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira_Sans","Droid_Sans","Helvetica_Neue",sans-serif]'
|
|
6
|
-
),
|
|
7
|
-
notification: s(
|
|
8
|
-
"relative w-[230px] mt-[15px] py-[13px] px-4",
|
|
9
|
-
"bg-white shadow-notify rounded-[5px]",
|
|
10
|
-
"text-sm leading-[1.4em] wrap-break-word",
|
|
11
|
-
'before:content-[""] before:absolute before:block before:top-0 before:left-0',
|
|
12
|
-
"before:w-[3px] before:h-[calc(100%-6px)] before:m-[3px] before:rounded-[5px] before:bg-transparent"
|
|
13
|
-
),
|
|
14
|
-
crossBtn: s(
|
|
15
|
-
"absolute top-[7px] right-[15px] w-2.5 h-2.5 p-[5px] opacity-55 cursor-pointer",
|
|
16
|
-
'before:content-[""] before:absolute before:left-[9px] before:top-[5px] before:h-3 before:w-0.5 before:bg-[#575d67] before:-rotate-45',
|
|
17
|
-
'after:content-[""] after:absolute after:left-[9px] after:top-[5px] after:h-3 after:w-0.5 after:bg-[#575d67] after:rotate-45',
|
|
18
|
-
"hover:opacity-100"
|
|
19
|
-
),
|
|
20
|
-
btnsWrapper: "flex flex-row flex-nowrap mt-[5px]",
|
|
21
|
-
btn: "border-none rounded-[3px] text-[13px] py-[5px] px-2.5 cursor-pointer last:ml-2.5",
|
|
22
|
-
okBtn: "bg-[#34c992] shadow-[0_1px_1px_0_rgba(18,49,35,0.05)] text-white hover:bg-[#2db583]",
|
|
23
|
-
cancelBtn: "bg-[#f2f5f7] shadow-[0_2px_1px_0_rgba(16,19,29,0)] text-[#656b7c] hover:bg-[#e9ecee]",
|
|
24
|
-
input: s(
|
|
25
|
-
"max-w-[130px] py-[5px] px-2.5 bg-[#f7f7f7] border-0 rounded-[3px]",
|
|
26
|
-
"text-[13px] text-[#656b7c] outline-hidden",
|
|
27
|
-
"placeholder:text-[#656b7c] focus:placeholder:text-[rgba(101,107,124,0.3)]"
|
|
28
|
-
),
|
|
29
|
-
successNotification: s(
|
|
30
|
-
"bg-[#fafffe]!",
|
|
31
|
-
"before:bg-[#41ffb1]!"
|
|
32
|
-
),
|
|
33
|
-
errorNotification: s(
|
|
34
|
-
"bg-[#fffbfb]!",
|
|
35
|
-
"before:bg-[#fb5d5d]!"
|
|
36
|
-
)
|
|
37
|
-
}, d = (e) => {
|
|
38
|
-
const t = document.createElement("DIV"), o = document.createElement("DIV"), r = e.message, n = e.style, c = () => n === "success" ? a.successNotification : n === "error" ? a.errorNotification : "";
|
|
39
|
-
return t.className = f(a.notification, c()), n ? t.setAttribute("data-blok-testid", `notification-${n}`) : t.setAttribute("data-blok-testid", "notification"), t.innerHTML = r, o.className = a.crossBtn, o.setAttribute("data-blok-testid", "notification-cross"), o.addEventListener("click", () => t.remove()), t.appendChild(o), t;
|
|
40
|
-
}, p = (e) => {
|
|
41
|
-
const t = d(e), o = document.createElement("div"), r = document.createElement("button"), n = document.createElement("button"), c = t.querySelector('[data-blok-testid="notification-cross"]'), i = e.cancelHandler, l = e.okHandler;
|
|
42
|
-
return o.className = a.btnsWrapper, o.setAttribute("data-blok-testid", "notification-buttons-wrapper"), r.innerHTML = e.okText || "Confirm", n.innerHTML = e.cancelText || "Cancel", r.className = s(a.btn, a.okBtn), n.className = s(a.btn, a.cancelBtn), r.setAttribute("data-blok-testid", "notification-confirm-button"), n.setAttribute("data-blok-testid", "notification-cancel-button"), i && typeof i == "function" && n.addEventListener("click", i), i && typeof i == "function" && c && c.addEventListener("click", i), l && typeof l == "function" && r.addEventListener("click", l), r.addEventListener("click", () => t.remove()), n.addEventListener("click", () => t.remove()), o.appendChild(r), o.appendChild(n), t.appendChild(o), t;
|
|
43
|
-
}, b = (e) => {
|
|
44
|
-
const t = d(e), o = document.createElement("div"), r = document.createElement("button"), n = document.createElement("input"), c = t.querySelector('[data-blok-testid="notification-cross"]'), i = e.cancelHandler, l = e.okHandler;
|
|
45
|
-
return o.className = a.btnsWrapper, r.innerHTML = e.okText || "Ok", r.className = s(a.btn, a.okBtn), n.className = a.input, n.setAttribute("data-blok-testid", "notification-input"), e.placeholder && n.setAttribute("placeholder", e.placeholder), e.default && (n.value = e.default), e.inputType && (n.type = e.inputType), i && typeof i == "function" && c && c.addEventListener("click", i), l && typeof l == "function" && r.addEventListener("click", () => {
|
|
46
|
-
l(n.value);
|
|
47
|
-
}), r.addEventListener("click", () => t.remove()), o.appendChild(n), o.appendChild(r), t.appendChild(o), t;
|
|
48
|
-
}, u = () => {
|
|
49
|
-
const e = document.createElement("DIV");
|
|
50
|
-
return e.className = a.wrapper, e.setAttribute("data-blok-testid", "notifier-container"), e;
|
|
51
|
-
}, m = 8e3, x = () => {
|
|
52
|
-
const e = document.querySelector('[data-blok-testid="notifier-container"]');
|
|
53
|
-
if (e)
|
|
54
|
-
return e;
|
|
55
|
-
const t = u();
|
|
56
|
-
return document.body.appendChild(t), t;
|
|
57
|
-
}, k = (e) => {
|
|
58
|
-
if (!e.message)
|
|
59
|
-
return;
|
|
60
|
-
const t = x(), o = e.time || m, r = (() => {
|
|
61
|
-
const n = e.type;
|
|
62
|
-
if (n === "confirm")
|
|
63
|
-
return p(e);
|
|
64
|
-
if (n === "prompt")
|
|
65
|
-
return b(e);
|
|
66
|
-
const c = d(e);
|
|
67
|
-
return window.setTimeout(() => {
|
|
68
|
-
c.remove();
|
|
69
|
-
}, o), c;
|
|
70
|
-
})();
|
|
71
|
-
t && r && (t.appendChild(r), r.className = `${r.className} animate-notify-bounce-in`, r.setAttribute("data-blok-bounce-in", "true"));
|
|
72
|
-
}, h = {
|
|
73
|
-
show: k
|
|
74
|
-
};
|
|
75
|
-
export {
|
|
76
|
-
h as Notifier,
|
|
77
|
-
k as show
|
|
78
|
-
};
|