@jackuait/blok 0.6.0-beta.9 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blok.mjs +2 -2
- package/dist/chunks/{blok-Bn6Q_o8h.mjs → blok-BAh1rvUC.mjs} +3410 -2927
- package/dist/chunks/i18next-B47TKgbU.mjs +1303 -0
- package/dist/chunks/{i18next-loader-DjR4d8M7.mjs → i18next-loader-CHtGO6IK.mjs} +2 -2
- package/dist/chunks/{index-oe38cp86.mjs → index-DBWWKrDe.mjs} +12 -12
- package/dist/chunks/{inline-tool-convert-SRTkyaZn.mjs → inline-tool-convert-DduRc0fF.mjs} +1467 -951
- package/dist/chunks/{messages-BogRq8lt.mjs → messages-0AbcLMLm.mjs} +6 -0
- package/dist/chunks/{messages-DJDG55Vq.mjs → messages-0E0AkrNu.mjs} +6 -0
- package/dist/{messages-DnXLrlHh.mjs → chunks/messages-4v4MuVEc.mjs} +6 -0
- package/dist/chunks/{messages-DnIhyAJk.mjs → messages-62v-CLC-.mjs} +6 -0
- package/dist/chunks/{messages-Dzwxv9v1.mjs → messages-8DeO60Oo.mjs} +6 -0
- package/dist/chunks/{messages-B1Aww8q7.mjs → messages-8IPXkrDl.mjs} +6 -0
- package/dist/{messages-uKX8WBaD.mjs → chunks/messages-96kNZDll.mjs} +6 -0
- package/dist/chunks/{messages-BL0tXcDf.mjs → messages-B1FZ8lxU.mjs} +6 -0
- package/dist/{messages-DBn76jVV.mjs → chunks/messages-B217znr-.mjs} +8 -2
- package/dist/{messages-DT4dP5uK.mjs → chunks/messages-B8WNljW3.mjs} +6 -0
- package/dist/chunks/{messages-BdeLo0N9.mjs → messages-BC8IN4Bf.mjs} +6 -0
- package/dist/{messages-CZygwLwM.mjs → chunks/messages-BI43k_BD.mjs} +6 -0
- package/dist/{messages-CzTufCHu.mjs → chunks/messages-BJ6zrz2j.mjs} +6 -0
- package/dist/{messages-BoJc_p1r.mjs → chunks/messages-BUl_Rcnj.mjs} +6 -0
- package/dist/chunks/{messages-CnwibSvh.mjs → messages-BZlmVRwn.mjs} +6 -0
- package/dist/{messages-C2htQ_3F.mjs → chunks/messages-BcpCubnC.mjs} +6 -0
- package/dist/{messages-D5C3J9qr.mjs → chunks/messages-Bm-E4iRC.mjs} +6 -0
- package/dist/chunks/{messages-BELRf6DU.mjs → messages-C4jL-90N.mjs} +6 -0
- package/dist/chunks/{messages-1fC8IMyX.mjs → messages-CDBLbUOQ.mjs} +6 -0
- package/dist/chunks/{messages-7QoX8DkW.mjs → messages-CH4hrauY.mjs} +6 -0
- package/dist/{messages-Dz9L52ol.mjs → chunks/messages-CRJ_mchV.mjs} +6 -0
- package/dist/chunks/{messages-JELdtT6E.mjs → messages-CW4c4cRk.mjs} +6 -0
- package/dist/chunks/{messages-CKI54h6O.mjs → messages-C_4otP7U.mjs} +6 -0
- package/dist/{messages-R3hUSvr3.mjs → chunks/messages-CfiyT2Wi.mjs} +6 -0
- package/dist/{messages-CJdUsQ-c.mjs → chunks/messages-CgTq3QhU.mjs} +6 -0
- package/dist/chunks/{messages-D1Hv8XGo.mjs → messages-Chb7k3Rg.mjs} +6 -0
- package/dist/{messages-Q7AO_FLv.mjs → chunks/messages-Cjjo7yHR.mjs} +6 -0
- package/dist/{messages-C99mq906.mjs → chunks/messages-Cl6ayUaq.mjs} +6 -0
- package/dist/chunks/{messages-Diu6jAaR.mjs → messages-CmR9ftc_.mjs} +6 -0
- package/dist/chunks/{messages-LPVfA-8K.mjs → messages-Cr49Nt3U.mjs} +6 -0
- package/dist/chunks/{messages-DqM1LFg5.mjs → messages-Cr94GzbX.mjs} +6 -0
- package/dist/{messages-BWF-zUpY.mjs → chunks/messages-CrCYPCk3.mjs} +6 -0
- package/dist/{messages-D-ZtY5v0.mjs → chunks/messages-Cs8zmZ3L.mjs} +6 -0
- package/dist/{messages-DprmQg6V.mjs → chunks/messages-CzK0LEhb.mjs} +6 -0
- package/dist/chunks/{messages-BSbjsyHY.mjs → messages-D00x4S8o.mjs} +6 -0
- package/dist/chunks/{messages-Xq8UmkVs.mjs → messages-D1mn7Zd5.mjs} +6 -0
- package/dist/chunks/{messages-BC86qLvI.mjs → messages-D2NOpHn9.mjs} +6 -0
- package/dist/{messages-kep5wtm4.mjs → chunks/messages-D4qqwVgQ.mjs} +6 -0
- package/dist/chunks/{messages-7W4d0DwD.mjs → messages-D5S1Dnpm.mjs} +6 -0
- package/dist/{messages-CY8_RyFE.mjs → chunks/messages-D7u2bmP2.mjs} +6 -0
- package/dist/chunks/{messages-BFG6Wlgy.mjs → messages-D85FqxgY.mjs} +6 -0
- package/dist/{messages-DLfR5bMd.mjs → chunks/messages-D9ndgBnU.mjs} +6 -0
- package/dist/{messages-CVw84KdI.mjs → chunks/messages-DDTQgImT.mjs} +6 -0
- package/dist/{messages-_ErNTNhk.mjs → chunks/messages-DH_jBeED.mjs} +6 -0
- package/dist/chunks/{messages-CMkNSDTo.mjs → messages-DRXWF0PV.mjs} +6 -0
- package/dist/chunks/{messages-BYyy6Wqf.mjs → messages-DVQvl8Qj.mjs} +6 -0
- package/dist/chunks/{messages-CznZadDf.mjs → messages-DXktiao_.mjs} +6 -0
- package/dist/chunks/{messages-DhLKYm2j.mjs → messages-DdK-nFGm.mjs} +6 -0
- package/dist/chunks/{messages-BMXCuEKO.mjs → messages-DlJbPF2T.mjs} +6 -0
- package/dist/chunks/{messages-CvGLfqmV.mjs → messages-DnVlmiNT.mjs} +6 -0
- package/dist/{messages-Z9nEU2xK.mjs → chunks/messages-DviiFSv2.mjs} +6 -0
- package/dist/chunks/{messages-BB5z9Uba.mjs → messages-DzqM3Fel.mjs} +6 -0
- package/dist/{messages-w7v1GNaE.mjs → chunks/messages-Dzzn6XoD.mjs} +6 -0
- package/dist/{messages-CqWJcCbY.mjs → chunks/messages-GSByFygY.mjs} +6 -0
- package/dist/chunks/{messages-_ncGrKHh.mjs → messages-L_kl2Qvh.mjs} +6 -0
- package/dist/chunks/{messages-BrPFGbM-.mjs → messages-Phkd7XmE.mjs} +6 -0
- package/dist/{messages-BU2nlrLK.mjs → chunks/messages-RonBBCnh.mjs} +6 -0
- package/dist/{messages-Bmu_S7GM.mjs → chunks/messages-VDriF5Qy.mjs} +6 -0
- package/dist/{messages-CLhcMlTc.mjs → chunks/messages-ZjUAIWb1.mjs} +6 -0
- package/dist/{messages-9SihnaXQ.mjs → chunks/messages-b1EdvUm0.mjs} +6 -0
- package/dist/{messages-DvFLX36Q.mjs → chunks/messages-begYOTgC.mjs} +6 -0
- package/dist/{messages-BMv4xwIr.mjs → chunks/messages-jrncnb-H.mjs} +6 -0
- package/dist/{messages-D5iv1Kox.mjs → chunks/messages-nefz1S71.mjs} +6 -0
- package/dist/{messages-CQwpzUFp.mjs → chunks/messages-ucTVgS5G.mjs} +6 -0
- package/dist/chunks/{messages-DBRw-7Zc.mjs → messages-v3GipbFl.mjs} +6 -0
- package/dist/{messages-C9eaarcK.mjs → chunks/messages-wmi-iFkH.mjs} +6 -0
- package/dist/chunks/{messages-O5tQus_0.mjs → messages-yHcs38yI.mjs} +6 -0
- package/dist/full.mjs +2 -2
- package/dist/locales.mjs +90 -84
- package/dist/{messages-BogRq8lt.mjs → messages-0AbcLMLm.mjs} +6 -0
- package/dist/{messages-DJDG55Vq.mjs → messages-0E0AkrNu.mjs} +6 -0
- package/dist/{chunks/messages-DnXLrlHh.mjs → messages-4v4MuVEc.mjs} +6 -0
- package/dist/{messages-DnIhyAJk.mjs → messages-62v-CLC-.mjs} +6 -0
- package/dist/{messages-Dzwxv9v1.mjs → messages-8DeO60Oo.mjs} +6 -0
- package/dist/{messages-B1Aww8q7.mjs → messages-8IPXkrDl.mjs} +6 -0
- package/dist/{chunks/messages-uKX8WBaD.mjs → messages-96kNZDll.mjs} +6 -0
- package/dist/{messages-BL0tXcDf.mjs → messages-B1FZ8lxU.mjs} +6 -0
- package/dist/{chunks/messages-DBn76jVV.mjs → messages-B217znr-.mjs} +8 -2
- package/dist/{chunks/messages-DT4dP5uK.mjs → messages-B8WNljW3.mjs} +6 -0
- package/dist/{messages-BdeLo0N9.mjs → messages-BC8IN4Bf.mjs} +6 -0
- package/dist/{chunks/messages-CZygwLwM.mjs → messages-BI43k_BD.mjs} +6 -0
- package/dist/{chunks/messages-CzTufCHu.mjs → messages-BJ6zrz2j.mjs} +6 -0
- package/dist/{chunks/messages-BoJc_p1r.mjs → messages-BUl_Rcnj.mjs} +6 -0
- package/dist/{messages-CnwibSvh.mjs → messages-BZlmVRwn.mjs} +6 -0
- package/dist/{chunks/messages-C2htQ_3F.mjs → messages-BcpCubnC.mjs} +6 -0
- package/dist/{chunks/messages-D5C3J9qr.mjs → messages-Bm-E4iRC.mjs} +6 -0
- package/dist/{messages-BELRf6DU.mjs → messages-C4jL-90N.mjs} +6 -0
- package/dist/{messages-1fC8IMyX.mjs → messages-CDBLbUOQ.mjs} +6 -0
- package/dist/{messages-7QoX8DkW.mjs → messages-CH4hrauY.mjs} +6 -0
- package/dist/{chunks/messages-Dz9L52ol.mjs → messages-CRJ_mchV.mjs} +6 -0
- package/dist/{messages-JELdtT6E.mjs → messages-CW4c4cRk.mjs} +6 -0
- package/dist/{messages-CKI54h6O.mjs → messages-C_4otP7U.mjs} +6 -0
- package/dist/{chunks/messages-R3hUSvr3.mjs → messages-CfiyT2Wi.mjs} +6 -0
- package/dist/{chunks/messages-CJdUsQ-c.mjs → messages-CgTq3QhU.mjs} +6 -0
- package/dist/{messages-D1Hv8XGo.mjs → messages-Chb7k3Rg.mjs} +6 -0
- package/dist/{chunks/messages-Q7AO_FLv.mjs → messages-Cjjo7yHR.mjs} +6 -0
- package/dist/{chunks/messages-C99mq906.mjs → messages-Cl6ayUaq.mjs} +6 -0
- package/dist/{messages-Diu6jAaR.mjs → messages-CmR9ftc_.mjs} +6 -0
- package/dist/{messages-LPVfA-8K.mjs → messages-Cr49Nt3U.mjs} +6 -0
- package/dist/{messages-DqM1LFg5.mjs → messages-Cr94GzbX.mjs} +6 -0
- package/dist/{chunks/messages-BWF-zUpY.mjs → messages-CrCYPCk3.mjs} +6 -0
- package/dist/{chunks/messages-D-ZtY5v0.mjs → messages-Cs8zmZ3L.mjs} +6 -0
- package/dist/{chunks/messages-DprmQg6V.mjs → messages-CzK0LEhb.mjs} +6 -0
- package/dist/{messages-BSbjsyHY.mjs → messages-D00x4S8o.mjs} +6 -0
- package/dist/{messages-Xq8UmkVs.mjs → messages-D1mn7Zd5.mjs} +6 -0
- package/dist/{messages-BC86qLvI.mjs → messages-D2NOpHn9.mjs} +6 -0
- package/dist/{chunks/messages-kep5wtm4.mjs → messages-D4qqwVgQ.mjs} +6 -0
- package/dist/{messages-7W4d0DwD.mjs → messages-D5S1Dnpm.mjs} +6 -0
- package/dist/{chunks/messages-CY8_RyFE.mjs → messages-D7u2bmP2.mjs} +6 -0
- package/dist/{messages-BFG6Wlgy.mjs → messages-D85FqxgY.mjs} +6 -0
- package/dist/{chunks/messages-DLfR5bMd.mjs → messages-D9ndgBnU.mjs} +6 -0
- package/dist/{chunks/messages-CVw84KdI.mjs → messages-DDTQgImT.mjs} +6 -0
- package/dist/{chunks/messages-_ErNTNhk.mjs → messages-DH_jBeED.mjs} +6 -0
- package/dist/{messages-CMkNSDTo.mjs → messages-DRXWF0PV.mjs} +6 -0
- package/dist/{messages-BYyy6Wqf.mjs → messages-DVQvl8Qj.mjs} +6 -0
- package/dist/{messages-CznZadDf.mjs → messages-DXktiao_.mjs} +6 -0
- package/dist/{messages-DhLKYm2j.mjs → messages-DdK-nFGm.mjs} +6 -0
- package/dist/{messages-BMXCuEKO.mjs → messages-DlJbPF2T.mjs} +6 -0
- package/dist/{messages-CvGLfqmV.mjs → messages-DnVlmiNT.mjs} +6 -0
- package/dist/{chunks/messages-Z9nEU2xK.mjs → messages-DviiFSv2.mjs} +6 -0
- package/dist/{messages-BB5z9Uba.mjs → messages-DzqM3Fel.mjs} +6 -0
- package/dist/{chunks/messages-w7v1GNaE.mjs → messages-Dzzn6XoD.mjs} +6 -0
- package/dist/{chunks/messages-CqWJcCbY.mjs → messages-GSByFygY.mjs} +6 -0
- package/dist/{messages-_ncGrKHh.mjs → messages-L_kl2Qvh.mjs} +6 -0
- package/dist/{messages-BrPFGbM-.mjs → messages-Phkd7XmE.mjs} +6 -0
- package/dist/{chunks/messages-BU2nlrLK.mjs → messages-RonBBCnh.mjs} +6 -0
- package/dist/{chunks/messages-Bmu_S7GM.mjs → messages-VDriF5Qy.mjs} +6 -0
- package/dist/{chunks/messages-CLhcMlTc.mjs → messages-ZjUAIWb1.mjs} +6 -0
- package/dist/{chunks/messages-9SihnaXQ.mjs → messages-b1EdvUm0.mjs} +6 -0
- package/dist/{chunks/messages-DvFLX36Q.mjs → messages-begYOTgC.mjs} +6 -0
- package/dist/{chunks/messages-BMv4xwIr.mjs → messages-jrncnb-H.mjs} +6 -0
- package/dist/{chunks/messages-D5iv1Kox.mjs → messages-nefz1S71.mjs} +6 -0
- package/dist/{chunks/messages-CQwpzUFp.mjs → messages-ucTVgS5G.mjs} +6 -0
- package/dist/{messages-DBRw-7Zc.mjs → messages-v3GipbFl.mjs} +6 -0
- package/dist/{chunks/messages-C9eaarcK.mjs → messages-wmi-iFkH.mjs} +6 -0
- package/dist/{messages-O5tQus_0.mjs → messages-yHcs38yI.mjs} +6 -0
- package/dist/tools.mjs +3190 -1690
- package/dist/vendor.LICENSE.txt +109 -109
- package/package.json +43 -57
- package/src/blok.ts +12 -0
- package/src/components/__module.ts +21 -0
- package/src/components/block/api.ts +17 -0
- package/src/components/block/style-manager.ts +6 -2
- package/src/components/block/tool-renderer.ts +33 -30
- package/src/components/blocks.ts +132 -15
- package/src/components/i18n/locales/am/messages.json +6 -0
- package/src/components/i18n/locales/ar/messages.json +6 -0
- package/src/components/i18n/locales/az/messages.json +6 -0
- package/src/components/i18n/locales/bg/messages.json +6 -0
- package/src/components/i18n/locales/bn/messages.json +6 -0
- package/src/components/i18n/locales/bs/messages.json +6 -0
- package/src/components/i18n/locales/cs/messages.json +6 -0
- package/src/components/i18n/locales/da/messages.json +6 -0
- package/src/components/i18n/locales/de/messages.json +6 -0
- package/src/components/i18n/locales/dv/messages.json +6 -0
- package/src/components/i18n/locales/el/messages.json +6 -0
- package/src/components/i18n/locales/en/messages.json +6 -0
- package/src/components/i18n/locales/es/messages.json +6 -0
- package/src/components/i18n/locales/et/messages.json +6 -0
- package/src/components/i18n/locales/fa/messages.json +6 -0
- package/src/components/i18n/locales/fi/messages.json +6 -0
- package/src/components/i18n/locales/fil/messages.json +6 -0
- package/src/components/i18n/locales/fr/messages.json +6 -0
- package/src/components/i18n/locales/gu/messages.json +6 -0
- package/src/components/i18n/locales/he/messages.json +6 -0
- package/src/components/i18n/locales/hi/messages.json +6 -0
- package/src/components/i18n/locales/hr/messages.json +6 -0
- package/src/components/i18n/locales/hu/messages.json +6 -0
- package/src/components/i18n/locales/hy/messages.json +6 -0
- package/src/components/i18n/locales/id/messages.json +6 -0
- package/src/components/i18n/locales/it/messages.json +6 -0
- package/src/components/i18n/locales/ja/messages.json +6 -0
- package/src/components/i18n/locales/ka/messages.json +6 -0
- package/src/components/i18n/locales/km/messages.json +6 -0
- package/src/components/i18n/locales/kn/messages.json +6 -0
- package/src/components/i18n/locales/ko/messages.json +6 -0
- package/src/components/i18n/locales/ku/messages.json +6 -0
- package/src/components/i18n/locales/lo/messages.json +6 -0
- package/src/components/i18n/locales/lt/messages.json +6 -0
- package/src/components/i18n/locales/lv/messages.json +6 -0
- package/src/components/i18n/locales/mk/messages.json +6 -0
- package/src/components/i18n/locales/ml/messages.json +6 -0
- package/src/components/i18n/locales/mn/messages.json +6 -0
- package/src/components/i18n/locales/mr/messages.json +6 -0
- package/src/components/i18n/locales/ms/messages.json +6 -0
- package/src/components/i18n/locales/my/messages.json +6 -0
- package/src/components/i18n/locales/ne/messages.json +6 -0
- package/src/components/i18n/locales/nl/messages.json +6 -0
- package/src/components/i18n/locales/no/messages.json +6 -0
- package/src/components/i18n/locales/pa/messages.json +6 -0
- package/src/components/i18n/locales/pl/messages.json +6 -0
- package/src/components/i18n/locales/ps/messages.json +6 -0
- package/src/components/i18n/locales/pt/messages.json +6 -0
- package/src/components/i18n/locales/ro/messages.json +6 -0
- package/src/components/i18n/locales/ru/messages.json +6 -0
- package/src/components/i18n/locales/sd/messages.json +6 -0
- package/src/components/i18n/locales/si/messages.json +6 -0
- package/src/components/i18n/locales/sk/messages.json +6 -0
- package/src/components/i18n/locales/sl/messages.json +6 -0
- package/src/components/i18n/locales/sq/messages.json +6 -0
- package/src/components/i18n/locales/sr/messages.json +6 -0
- package/src/components/i18n/locales/sv/messages.json +6 -0
- package/src/components/i18n/locales/sw/messages.json +6 -0
- package/src/components/i18n/locales/ta/messages.json +6 -0
- package/src/components/i18n/locales/te/messages.json +6 -0
- package/src/components/i18n/locales/th/messages.json +6 -0
- package/src/components/i18n/locales/tr/messages.json +6 -0
- package/src/components/i18n/locales/ug/messages.json +6 -0
- package/src/components/i18n/locales/uk/messages.json +6 -0
- package/src/components/i18n/locales/ur/messages.json +6 -0
- package/src/components/i18n/locales/vi/messages.json +6 -0
- package/src/components/i18n/locales/yi/messages.json +6 -0
- package/src/components/i18n/locales/zh/messages.json +6 -0
- package/src/components/icons/index.ts +17 -0
- package/src/components/inline-tools/inline-tool-link.ts +1 -1
- package/src/components/inline-tools/inline-tool-marker.ts +737 -0
- package/src/components/inline-tools/utils/formatting-range-utils.ts +6 -3
- package/src/components/inline-tools/utils/marker-dom-utils.ts +17 -0
- package/src/components/modules/api/blocks.ts +34 -9
- package/src/components/modules/blockEvents/composers/keyboardNavigation.ts +75 -29
- package/src/components/modules/blockEvents/index.ts +13 -5
- package/src/components/modules/blockManager/blockManager.ts +81 -2
- package/src/components/modules/blockManager/hierarchy.ts +20 -2
- package/src/components/modules/blockManager/operations.ts +70 -35
- package/src/components/modules/blockManager/repository.ts +22 -0
- package/src/components/modules/blockManager/types.ts +3 -1
- package/src/components/modules/blockManager/yjs-sync.ts +173 -39
- package/src/components/modules/blockSelection.ts +3 -0
- package/src/components/modules/crossBlockSelection.ts +11 -3
- package/src/components/modules/drag/preview/DragPreview.ts +10 -2
- package/src/components/modules/drag/target/DropTargetDetector.ts +100 -11
- package/src/components/modules/drag/utils/drag.constants.ts +1 -1
- package/src/components/modules/normalizeInlineImages.ts +263 -0
- package/src/components/modules/paste/google-docs-preprocessor.ts +197 -0
- package/src/components/modules/paste/handlers/base.ts +43 -2
- package/src/components/modules/paste/handlers/html-handler.ts +1 -1
- package/src/components/modules/paste/handlers/index.ts +1 -0
- package/src/components/modules/paste/handlers/table-cells-handler.ts +104 -0
- package/src/components/modules/paste/index.ts +20 -3
- package/src/components/modules/readonly.ts +8 -2
- package/src/components/modules/rectangleSelection.ts +5 -2
- package/src/components/modules/renderer.ts +35 -0
- package/src/components/modules/saver.ts +52 -2
- package/src/components/modules/toolbar/blockSettings.ts +52 -44
- package/src/components/modules/toolbar/index.ts +124 -17
- package/src/components/modules/toolbar/inline/index.ts +4 -4
- package/src/components/modules/toolbar/plus-button.ts +3 -3
- package/src/components/modules/toolbar/settings-toggler.ts +3 -3
- package/src/components/modules/toolbar/styles.ts +7 -7
- package/src/components/modules/ui.ts +6 -6
- package/src/components/modules/uiControllers/controllers/blockHover.ts +16 -2
- package/src/components/modules/uiControllers/handlers/touch.ts +83 -10
- package/src/components/modules/yjs/block-observer.ts +9 -3
- package/src/components/modules/yjs/document-store.ts +10 -7
- package/src/components/modules/yjs/types.ts +8 -6
- package/src/components/modules/yjs/undo-history.ts +90 -11
- package/src/components/selection/fake-background/shadows.ts +1 -1
- package/src/components/shared/color-picker.ts +211 -0
- package/src/components/shared/color-presets.ts +25 -0
- package/src/components/ui/toolbox.ts +19 -11
- package/src/components/utils/color-mapping.ts +241 -0
- package/src/components/utils/notifier/draw.ts +9 -9
- package/src/components/utils/placeholder.ts +24 -8
- 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 +14 -12
- package/src/components/utils/popover/components/search-input/search-input.const.ts +2 -2
- package/src/components/utils/popover/popover-abstract.ts +27 -3
- package/src/components/utils/popover/popover-desktop.ts +26 -3
- package/src/components/utils/popover/popover-inline.ts +14 -1
- package/src/components/utils/popover/popover-mobile.ts +4 -4
- package/src/components/utils/popover/popover.const.ts +2 -2
- package/src/components/utils/sanitizer.ts +24 -3
- package/src/components/utils/tw.ts +17 -5
- package/src/stories/Header.stories.ts +106 -0
- package/src/stories/MarkerColors.stories.ts +730 -0
- package/src/stories/Popover.stories.ts +1 -3
- package/src/stories/Table.stories.ts +1662 -0
- package/src/styles/main.css +207 -37
- package/src/tools/header/index.ts +1 -1
- package/src/tools/index.ts +3 -1
- package/src/tools/list/caret-manager.ts +28 -10
- package/src/tools/list/constants.ts +2 -2
- package/src/tools/list/dom-builder.ts +3 -3
- package/src/tools/list/static-configs.ts +0 -1
- package/src/tools/paragraph/index.ts +9 -5
- package/src/tools/table/core/table-commands.ts +99 -0
- package/src/tools/table/core/table-controller.ts +231 -0
- package/src/tools/table/core/table-events.ts +102 -0
- package/src/tools/table/index.ts +1070 -174
- package/src/tools/table/ownership/table-event-broker.ts +74 -0
- package/src/tools/table/ownership/table-ownership-registry.ts +126 -0
- package/src/tools/table/table-add-controls.ts +85 -15
- package/src/tools/table/table-cell-blocks.ts +336 -38
- package/src/tools/table/table-cell-clipboard.ts +415 -0
- package/src/tools/table/table-cell-color-picker.ts +34 -0
- package/src/tools/table/table-cell-selection.ts +264 -15
- package/src/tools/table/table-core.ts +3 -42
- package/src/tools/table/table-heading-toggle.ts +2 -2
- package/src/tools/table/table-model.ts +623 -0
- package/src/tools/table/table-operations.ts +59 -78
- package/src/tools/table/table-resize.ts +15 -11
- package/src/tools/table/table-restrictions.ts +69 -3
- package/src/tools/table/table-row-col-action-handler.ts +22 -7
- package/src/tools/table/table-row-col-controls.ts +129 -12
- package/src/tools/table/table-row-col-drag.ts +14 -0
- package/src/tools/table/table-scroll-haze.ts +152 -0
- package/src/tools/table/types.ts +22 -1
- package/src/tools/table/view/table-cell-blocks-adapter.ts +47 -0
- package/src/variants/blok-minimum.ts +13 -0
- package/types/api/block.d.ts +13 -0
- package/types/api/blocks.d.ts +16 -0
- package/types/tools/table.d.ts +2 -0
- package/dist/chunks/i18next-CugVlwWp.mjs +0 -1292
- package/src/tools/table/data-normalizer.ts +0 -32
|
@@ -171,8 +171,16 @@ export class UndoHistory {
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
if (event.type === 'undo' && this.caretUndoStack.length > 0) {
|
|
174
|
-
// Update the 'after' position of the most recent undo entry
|
|
175
174
|
const lastEntry = this.caretUndoStack[this.caretUndoStack.length - 1];
|
|
175
|
+
|
|
176
|
+
// Backfill the 'before' position if the initial capture failed
|
|
177
|
+
// (e.g., for table cell paragraphs where the debounced selectionchange
|
|
178
|
+
// hadn't set currentBlock yet when the first character was typed)
|
|
179
|
+
if (lastEntry.before === null && this.pendingCaretBefore !== null) {
|
|
180
|
+
lastEntry.before = this.pendingCaretBefore;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Update the 'after' position of the most recent undo entry
|
|
176
184
|
lastEntry.after = this.captureCaretSnapshot();
|
|
177
185
|
}
|
|
178
186
|
|
|
@@ -195,6 +203,12 @@ export class UndoHistory {
|
|
|
195
203
|
* Restores caret position after the undo operation.
|
|
196
204
|
*/
|
|
197
205
|
public undo(): void {
|
|
206
|
+
// Save scroll position before DOM manipulation. Removing focused elements
|
|
207
|
+
// from the DOM (e.g., undoing an Enter in a table cell removes cell paragraph
|
|
208
|
+
// blocks) can cause the browser to scroll to the top. We restore scroll after
|
|
209
|
+
// caret restoration to catch cases where the referenced block no longer exists.
|
|
210
|
+
const savedScrollY = window.scrollY;
|
|
211
|
+
|
|
198
212
|
// Check if the last operation was a move (or group of moves)
|
|
199
213
|
const lastMoveGroup = this.moveUndoStack.pop();
|
|
200
214
|
|
|
@@ -212,6 +226,7 @@ export class UndoHistory {
|
|
|
212
226
|
const caretEntry = this.caretUndoStack.pop();
|
|
213
227
|
|
|
214
228
|
this.pushCaretAndRestore(caretEntry, this.caretRedoStack, 'before');
|
|
229
|
+
this.restoreScrollIfJumped(savedScrollY);
|
|
215
230
|
|
|
216
231
|
return;
|
|
217
232
|
}
|
|
@@ -223,6 +238,7 @@ export class UndoHistory {
|
|
|
223
238
|
const caretEntry = this.caretUndoStack.pop();
|
|
224
239
|
|
|
225
240
|
this.pushCaretAndRestore(caretEntry, this.caretRedoStack, 'before');
|
|
241
|
+
this.restoreScrollIfJumped(savedScrollY);
|
|
226
242
|
}
|
|
227
243
|
|
|
228
244
|
/**
|
|
@@ -231,6 +247,9 @@ export class UndoHistory {
|
|
|
231
247
|
* Restores caret position after the redo operation.
|
|
232
248
|
*/
|
|
233
249
|
public redo(): void {
|
|
250
|
+
// Save scroll position before DOM manipulation (same rationale as undo).
|
|
251
|
+
const savedScrollY = window.scrollY;
|
|
252
|
+
|
|
234
253
|
// Check if the last undone operation was a move (or group of moves)
|
|
235
254
|
const lastMoveGroup = this.moveRedoStack.pop();
|
|
236
255
|
|
|
@@ -247,6 +266,7 @@ export class UndoHistory {
|
|
|
247
266
|
const caretEntry = this.caretRedoStack.pop();
|
|
248
267
|
|
|
249
268
|
this.pushCaretAndRestore(caretEntry, this.caretUndoStack, 'after');
|
|
269
|
+
this.restoreScrollIfJumped(savedScrollY);
|
|
250
270
|
|
|
251
271
|
return;
|
|
252
272
|
}
|
|
@@ -258,6 +278,7 @@ export class UndoHistory {
|
|
|
258
278
|
const caretEntry = this.caretRedoStack.pop();
|
|
259
279
|
|
|
260
280
|
this.pushCaretAndRestore(caretEntry, this.caretUndoStack, 'after');
|
|
281
|
+
this.restoreScrollIfJumped(savedScrollY);
|
|
261
282
|
}
|
|
262
283
|
|
|
263
284
|
/**
|
|
@@ -273,7 +294,17 @@ export class UndoHistory {
|
|
|
273
294
|
}
|
|
274
295
|
|
|
275
296
|
stack.push(entry);
|
|
276
|
-
|
|
297
|
+
|
|
298
|
+
// Use the requested position, falling back to the other one when the
|
|
299
|
+
// requested snapshot wasn't captured (e.g., the debounced selectionchange
|
|
300
|
+
// hadn't set currentBlock for table cell paragraphs).
|
|
301
|
+
// The fallback offset will be clamped to the actual text length by the
|
|
302
|
+
// caret restore logic, so the caret ends up at a reasonable position.
|
|
303
|
+
const snapshot = position === 'before'
|
|
304
|
+
? entry.before ?? entry.after
|
|
305
|
+
: entry.after ?? entry.before;
|
|
306
|
+
|
|
307
|
+
this.restoreCaretSnapshot(snapshot);
|
|
277
308
|
}
|
|
278
309
|
|
|
279
310
|
/**
|
|
@@ -418,18 +449,30 @@ export class UndoHistory {
|
|
|
418
449
|
}
|
|
419
450
|
|
|
420
451
|
const { BlockManager } = this.blok;
|
|
421
|
-
|
|
452
|
+
|
|
453
|
+
// If currentBlock is not set (e.g., debounced selectionchange hasn't fired yet
|
|
454
|
+
// for nested blocks like table cell paragraphs), resolve it from the selection.
|
|
455
|
+
const currentBlock = BlockManager.currentBlock ?? (() => {
|
|
456
|
+
const anchorNode = window.getSelection()?.anchorNode;
|
|
457
|
+
|
|
458
|
+
if (anchorNode !== null && anchorNode !== undefined) {
|
|
459
|
+
return BlockManager.setCurrentBlockByChildNode(anchorNode);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
return undefined;
|
|
463
|
+
})();
|
|
422
464
|
|
|
423
465
|
if (currentBlock === undefined) {
|
|
424
466
|
return null;
|
|
425
467
|
}
|
|
426
468
|
|
|
427
469
|
const currentInput = currentBlock.currentInput;
|
|
470
|
+
const offset = currentInput !== undefined ? getCaretOffset(currentInput) : 0;
|
|
428
471
|
|
|
429
472
|
return {
|
|
430
473
|
blockId: currentBlock.id,
|
|
431
474
|
inputIndex: currentBlock.currentInputIndex,
|
|
432
|
-
offset
|
|
475
|
+
offset,
|
|
433
476
|
};
|
|
434
477
|
}
|
|
435
478
|
|
|
@@ -461,14 +504,27 @@ export class UndoHistory {
|
|
|
461
504
|
lastEntry.after = this.captureCaretSnapshot();
|
|
462
505
|
}
|
|
463
506
|
|
|
507
|
+
/**
|
|
508
|
+
* Restore scroll position if it jumped far from the original position.
|
|
509
|
+
* This catches cases where caret restoration focused a distant block
|
|
510
|
+
* (e.g., the referenced block was removed during undo and the fallback
|
|
511
|
+
* set focus to the first block at the top of the article).
|
|
512
|
+
*/
|
|
513
|
+
private restoreScrollIfJumped(savedScrollY: number): void {
|
|
514
|
+
if (Math.abs(window.scrollY - savedScrollY) > window.innerHeight) {
|
|
515
|
+
window.scrollTo(0, savedScrollY);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
464
519
|
/**
|
|
465
520
|
* Restore caret position from a snapshot.
|
|
466
|
-
* Handles edge cases: null snapshot, deleted block, invalid input index
|
|
467
|
-
*
|
|
521
|
+
* Handles edge cases: null snapshot, deleted block, invalid input index,
|
|
522
|
+
* and disconnected inputs (e.g., after table DOM rebuild during undo).
|
|
468
523
|
*/
|
|
469
524
|
private restoreCaretSnapshot(snapshot: CaretSnapshot | null): void {
|
|
470
525
|
if (snapshot === null) {
|
|
471
|
-
|
|
526
|
+
// No snapshot available — preserve whatever focus state exists after the
|
|
527
|
+
// DOM update rather than actively destroying the selection.
|
|
472
528
|
return;
|
|
473
529
|
}
|
|
474
530
|
|
|
@@ -488,12 +544,35 @@ export class UndoHistory {
|
|
|
488
544
|
// Get the specific input within the block
|
|
489
545
|
const input = block.inputs[snapshot.inputIndex];
|
|
490
546
|
|
|
491
|
-
if (input !== undefined) {
|
|
547
|
+
if (input !== undefined && input.isConnected) {
|
|
492
548
|
Caret.setToInput(input, Caret.positions.DEFAULT, snapshot.offset);
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
// Input is disconnected or doesn't exist (e.g., the block was removed from
|
|
553
|
+
// a table cell during undo but still exists in BlockManager). Try to find
|
|
554
|
+
// a connected sibling block in the same parent context.
|
|
555
|
+
if (block.parentId != null) {
|
|
556
|
+
const lastConnectedSibling = BlockManager.blocks
|
|
557
|
+
.filter(b => b.parentId === block.parentId && b.id !== block.id && b.inputs.length > 0 && b.inputs[0].isConnected)
|
|
558
|
+
.at(-1);
|
|
559
|
+
|
|
560
|
+
if (lastConnectedSibling !== undefined) {
|
|
561
|
+
Caret.setToBlock(lastConnectedSibling, Caret.positions.END);
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
// No connected siblings — try the parent block itself
|
|
566
|
+
const parentBlock = BlockManager.getBlockById(block.parentId);
|
|
567
|
+
|
|
568
|
+
if (parentBlock !== undefined) {
|
|
569
|
+
Caret.setToBlock(parentBlock, Caret.positions.START);
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
496
572
|
}
|
|
573
|
+
|
|
574
|
+
// Fall back to block start
|
|
575
|
+
Caret.setToBlock(block, Caret.positions.START);
|
|
497
576
|
}
|
|
498
577
|
|
|
499
578
|
/**
|
|
@@ -195,7 +195,7 @@ export class FakeBackgroundShadows {
|
|
|
195
195
|
/**
|
|
196
196
|
* Calculates bottom extension for a line, accounting for gap to next line
|
|
197
197
|
* The bottom extension fills the gap up to where the next line's top extension begins
|
|
198
|
-
* This prevents overlap: line N's bottom shadow meets line N+1's top shadow exactly
|
|
198
|
+
* This prevents overlap: line N's bottom shadow-sm meets line N+1's top shadow exactly
|
|
199
199
|
* @param baseExtension - the base extension value
|
|
200
200
|
* @param isLastLine - whether this is the last line
|
|
201
201
|
* @param lineGroups - grouped line rectangles
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import type { I18n } from '../../../types/api';
|
|
2
|
+
import { parseColor } from '../utils/color-mapping';
|
|
3
|
+
import { twMerge } from '../utils/tw';
|
|
4
|
+
import { COLOR_PRESETS } from './color-presets';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Compare two CSS color strings for equality by their parsed RGB tuples.
|
|
8
|
+
* Handles hex vs rgb() format mismatches (e.g. '#d44c47' vs 'rgb(212, 76, 71)').
|
|
9
|
+
*/
|
|
10
|
+
function colorsEqual(a: string, b: string): boolean {
|
|
11
|
+
if (a === b) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const rgbA = parseColor(a);
|
|
16
|
+
const rgbB = parseColor(b);
|
|
17
|
+
|
|
18
|
+
if (rgbA === null || rgbB === null) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return rgbA[0] === rgbB[0] && rgbA[1] === rgbB[1] && rgbA[2] === rgbB[2];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Describes one tab in the color picker (e.g. "Text" or "Background")
|
|
27
|
+
*/
|
|
28
|
+
export interface ColorPickerMode {
|
|
29
|
+
key: string;
|
|
30
|
+
labelKey: string;
|
|
31
|
+
presetField: 'text' | 'bg';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Options for the shared color picker factory
|
|
36
|
+
*/
|
|
37
|
+
export interface ColorPickerOptions {
|
|
38
|
+
i18n: I18n;
|
|
39
|
+
modes: [ColorPickerMode, ColorPickerMode];
|
|
40
|
+
defaultModeIndex?: number;
|
|
41
|
+
testIdPrefix: string;
|
|
42
|
+
onColorSelect: (color: string | null, modeKey: string) => void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Handle returned by createColorPicker with the DOM element and control methods
|
|
47
|
+
*/
|
|
48
|
+
export interface ColorPickerHandle {
|
|
49
|
+
element: HTMLDivElement;
|
|
50
|
+
/**
|
|
51
|
+
* Set the currently active color for visual indication on the matching swatch.
|
|
52
|
+
* Pass null to clear any active indicator.
|
|
53
|
+
* @param color - CSS color value or null to clear
|
|
54
|
+
* @param modeKey - The mode key (e.g. 'color', 'background-color') to match the correct preset field
|
|
55
|
+
*/
|
|
56
|
+
setActiveColor: (color: string | null, modeKey: string) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Reset the picker state (tab index) back to defaultModeIndex.
|
|
59
|
+
* Call this when the picker is reopened to ensure consistent initial state.
|
|
60
|
+
*/
|
|
61
|
+
reset: () => void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Base Tailwind classes shared by tab buttons
|
|
66
|
+
*/
|
|
67
|
+
const TAB_BASE_CLASSES = 'flex-1 py-1.5 text-xs text-center rounded-md cursor-pointer border-none transition-colors';
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Neutral background for text-mode swatches so they render as visible buttons
|
|
71
|
+
*/
|
|
72
|
+
const SWATCH_NEUTRAL_BG = '#f7f7f5';
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Creates a color picker element with two tabs (e.g. Text / Background),
|
|
76
|
+
* a 5-column swatch grid, and a "Default" reset button.
|
|
77
|
+
*
|
|
78
|
+
* Shared between the marker inline tool and the table cell color popover.
|
|
79
|
+
*/
|
|
80
|
+
export function createColorPicker(options: ColorPickerOptions): ColorPickerHandle {
|
|
81
|
+
const { i18n, modes, testIdPrefix, onColorSelect } = options;
|
|
82
|
+
const defaultModeIndex = options.defaultModeIndex ?? 0;
|
|
83
|
+
const state = { modeIndex: defaultModeIndex, activeColor: null as string | null };
|
|
84
|
+
|
|
85
|
+
const wrapper = document.createElement('div');
|
|
86
|
+
|
|
87
|
+
wrapper.setAttribute('data-blok-testid', `${testIdPrefix}-picker`);
|
|
88
|
+
wrapper.className = 'flex flex-col gap-2 p-2';
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Tab row
|
|
92
|
+
*/
|
|
93
|
+
const tabRow = document.createElement('div');
|
|
94
|
+
|
|
95
|
+
tabRow.className = 'flex gap-0.5 mb-0.5';
|
|
96
|
+
|
|
97
|
+
const tabButtons: HTMLButtonElement[] = [];
|
|
98
|
+
|
|
99
|
+
modes.forEach((mode, modeIndex) => {
|
|
100
|
+
const tab = document.createElement('button');
|
|
101
|
+
|
|
102
|
+
tab.setAttribute('data-blok-testid', `${testIdPrefix}-tab-${mode.key}`);
|
|
103
|
+
tab.textContent = i18n.t(mode.labelKey);
|
|
104
|
+
tab.addEventListener('click', () => {
|
|
105
|
+
state.modeIndex = modeIndex;
|
|
106
|
+
updateTabs();
|
|
107
|
+
renderSwatches();
|
|
108
|
+
});
|
|
109
|
+
tabButtons.push(tab);
|
|
110
|
+
tabRow.appendChild(tab);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const updateTabs = (): void => {
|
|
114
|
+
for (const [index, button] of tabButtons.entries()) {
|
|
115
|
+
button.className = twMerge(
|
|
116
|
+
TAB_BASE_CLASSES,
|
|
117
|
+
index === state.modeIndex ? 'bg-item-hover-bg font-medium' : 'bg-transparent hover:bg-item-hover-bg/50'
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Color grid
|
|
124
|
+
*/
|
|
125
|
+
const grid = document.createElement('div');
|
|
126
|
+
|
|
127
|
+
grid.setAttribute('data-blok-testid', `${testIdPrefix}-grid`);
|
|
128
|
+
grid.className = 'grid grid-cols-5 gap-1.5';
|
|
129
|
+
|
|
130
|
+
const renderSwatches = (): void => {
|
|
131
|
+
grid.innerHTML = '';
|
|
132
|
+
|
|
133
|
+
const currentMode = modes[state.modeIndex];
|
|
134
|
+
|
|
135
|
+
for (const preset of COLOR_PRESETS) {
|
|
136
|
+
const swatch = document.createElement('button');
|
|
137
|
+
const swatchColor = currentMode.presetField === 'text' ? preset.text : preset.bg;
|
|
138
|
+
const isActive = state.activeColor !== null && colorsEqual(swatchColor, state.activeColor);
|
|
139
|
+
|
|
140
|
+
swatch.setAttribute('data-blok-testid', `${testIdPrefix}-swatch-${preset.name}`);
|
|
141
|
+
swatch.className = twMerge(
|
|
142
|
+
'w-8 h-8 rounded-md cursor-pointer border-none',
|
|
143
|
+
'flex items-center justify-center text-sm font-semibold',
|
|
144
|
+
'transition-shadow ring-inset hover:ring-2 hover:ring-black/10',
|
|
145
|
+
isActive && 'ring-2 ring-black/30'
|
|
146
|
+
);
|
|
147
|
+
swatch.textContent = 'A';
|
|
148
|
+
|
|
149
|
+
if (currentMode.presetField === 'text') {
|
|
150
|
+
swatch.style.color = preset.text;
|
|
151
|
+
swatch.style.backgroundColor = SWATCH_NEUTRAL_BG;
|
|
152
|
+
} else {
|
|
153
|
+
swatch.style.color = '';
|
|
154
|
+
swatch.style.backgroundColor = preset.bg;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
swatch.addEventListener('click', () => {
|
|
158
|
+
onColorSelect(swatchColor, currentMode.key);
|
|
159
|
+
});
|
|
160
|
+
grid.appendChild(swatch);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Default button
|
|
166
|
+
*/
|
|
167
|
+
const defaultBtn = document.createElement('button');
|
|
168
|
+
|
|
169
|
+
defaultBtn.setAttribute('data-blok-testid', `${testIdPrefix}-default-btn`);
|
|
170
|
+
defaultBtn.className = twMerge(
|
|
171
|
+
'w-full py-1.5 text-xs text-center rounded-md cursor-pointer',
|
|
172
|
+
'bg-transparent border-none hover:bg-item-hover-bg',
|
|
173
|
+
'mt-0.5 transition-colors'
|
|
174
|
+
);
|
|
175
|
+
defaultBtn.textContent = i18n.t('tools.marker.default');
|
|
176
|
+
defaultBtn.addEventListener('click', () => {
|
|
177
|
+
onColorSelect(null, modes[state.modeIndex].key);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Assemble
|
|
182
|
+
*/
|
|
183
|
+
updateTabs();
|
|
184
|
+
renderSwatches();
|
|
185
|
+
|
|
186
|
+
wrapper.appendChild(tabRow);
|
|
187
|
+
wrapper.appendChild(grid);
|
|
188
|
+
wrapper.appendChild(defaultBtn);
|
|
189
|
+
|
|
190
|
+
return {
|
|
191
|
+
element: wrapper,
|
|
192
|
+
setActiveColor: (color: string | null, modeKey: string) => {
|
|
193
|
+
state.activeColor = color;
|
|
194
|
+
|
|
195
|
+
const matchingIndex = modes.findIndex((m) => m.key === modeKey);
|
|
196
|
+
|
|
197
|
+
if (matchingIndex !== -1) {
|
|
198
|
+
state.modeIndex = matchingIndex;
|
|
199
|
+
updateTabs();
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
renderSwatches();
|
|
203
|
+
},
|
|
204
|
+
reset: () => {
|
|
205
|
+
state.modeIndex = defaultModeIndex;
|
|
206
|
+
state.activeColor = null;
|
|
207
|
+
updateTabs();
|
|
208
|
+
renderSwatches();
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared color preset used across marker and table cell color pickers.
|
|
3
|
+
*/
|
|
4
|
+
export interface ColorPreset {
|
|
5
|
+
name: string;
|
|
6
|
+
text: string;
|
|
7
|
+
bg: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Ten Notion-style color presets.
|
|
12
|
+
* `text` is used for foreground (text-color mode), `bg` for background swatches.
|
|
13
|
+
*/
|
|
14
|
+
export const COLOR_PRESETS: ColorPreset[] = [
|
|
15
|
+
{ name: 'gray', text: '#787774', bg: '#f1f1ef' },
|
|
16
|
+
{ name: 'brown', text: '#9f6b53', bg: '#f4eeee' },
|
|
17
|
+
{ name: 'orange', text: '#d9730d', bg: '#fbecdd' },
|
|
18
|
+
{ name: 'yellow', text: '#cb9b00', bg: '#fbf3db' },
|
|
19
|
+
{ name: 'green', text: '#448361', bg: '#edf3ec' },
|
|
20
|
+
{ name: 'teal', text: '#2b9a8f', bg: '#e4f5f3' },
|
|
21
|
+
{ name: 'blue', text: '#337ea9', bg: '#e7f3f8' },
|
|
22
|
+
{ name: 'purple', text: '#9065b0', bg: '#f6f3f9' },
|
|
23
|
+
{ name: 'pink', text: '#c14c8a', bg: '#f9f0f5' },
|
|
24
|
+
{ name: 'red', text: '#d44c47', bg: '#fdebec' },
|
|
25
|
+
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getRestrictedTools } from '../../tools/table/table-restrictions';
|
|
2
2
|
import { Dom } from '../dom';
|
|
3
3
|
import { BlokMobileLayoutToggled } from '../events';
|
|
4
4
|
import { SelectionUtils } from '../selection';
|
|
@@ -388,22 +388,30 @@ export class Toolbox extends EventsDispatcher<ToolboxEventMap> {
|
|
|
388
388
|
|
|
389
389
|
/**
|
|
390
390
|
* Toggles hidden state for all popover items belonging to restricted tools.
|
|
391
|
-
*
|
|
392
|
-
*
|
|
391
|
+
* Matches by tool registration name so that tools with custom entry names
|
|
392
|
+
* (e.g., list tool with entries named bulleted-list, numbered-list, check-list)
|
|
393
|
+
* are correctly restricted.
|
|
393
394
|
*/
|
|
394
395
|
private toggleRestrictedToolsHidden(isHidden: boolean): void {
|
|
395
|
-
|
|
396
|
-
|
|
396
|
+
const restrictedTools = getRestrictedTools();
|
|
397
|
+
|
|
398
|
+
for (const tool of this.toolsToBeDisplayed) {
|
|
399
|
+
if (!restrictedTools.includes(tool.name)) {
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
const toolboxEntries = tool.toolbox;
|
|
404
|
+
|
|
405
|
+
if (!toolboxEntries) {
|
|
397
406
|
continue;
|
|
398
407
|
}
|
|
399
408
|
|
|
400
|
-
const
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
409
|
+
const entries = Array.isArray(toolboxEntries) ? toolboxEntries : [toolboxEntries];
|
|
410
|
+
|
|
411
|
+
for (const entry of entries) {
|
|
412
|
+
const entryName = entry.name ?? tool.name;
|
|
404
413
|
|
|
405
|
-
|
|
406
|
-
this.popover?.toggleItemHiddenByName(name, isHidden);
|
|
414
|
+
this.popover?.toggleItemHiddenByName(entryName, isHidden);
|
|
407
415
|
}
|
|
408
416
|
}
|
|
409
417
|
}
|