@jackuait/blok 0.10.0-beta.4 → 0.10.0-beta.6
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 +3 -3
- package/dist/chunks/{blok-D_0qAdUd.mjs → blok-BdlR_lX6.mjs} +2073 -2034
- package/dist/chunks/chunk-Byubey_H.mjs +20 -0
- package/dist/chunks/{constants-DxSXr7kd.mjs → constants-Cp8O0UfP.mjs} +524 -550
- package/dist/chunks/default-DIfXCS2E.mjs +4 -0
- package/dist/chunks/{i18next-G6FKbZqA.mjs → i18next-KNC_XV5x.mjs} +1 -1
- package/dist/chunks/{i18next-loader-CwNimni3.mjs → i18next-loader-oDO9ZKUV.mjs} +2 -2
- package/dist/chunks/katex-NjLaA6AJ.mjs +22026 -0
- package/dist/chunks/{lightweight-i18n-DWCdzAw0.mjs → lightweight-i18n-DTySD6f6.mjs} +16 -18
- package/dist/chunks/mdast-util-math-yS0EygZV.mjs +151 -0
- package/dist/{messages-DVQNjdPk.mjs → chunks/messages-5ArOv8cj.mjs} +3 -17
- package/dist/chunks/{messages-Czny5pPT2.mjs → messages-876bKyUj2.mjs} +3 -17
- package/dist/{messages-JhoVMjfX2.mjs → chunks/messages-9l49jauY.mjs} +3 -17
- package/dist/{messages-D3cAcyzj.mjs → chunks/messages-B5aAzExz.mjs} +3 -17
- package/dist/chunks/{messages-CmrMwBv3.mjs → messages-B5fKJXd6.mjs} +3 -17
- package/dist/chunks/{messages-DBpXyvRe2.mjs → messages-B9N__q552.mjs} +3 -17
- package/dist/{messages-CVcQD-9u.mjs → chunks/messages-BAP2OAQk.mjs} +3 -17
- package/dist/chunks/{messages-R2W_rGOo2.mjs → messages-BDXl53cy2.mjs} +3 -17
- package/dist/{messages-CM5fsPo02.mjs → chunks/messages-BGCQCeWd.mjs} +3 -17
- package/dist/{messages-DtrSrdfE2.mjs → chunks/messages-BHhbHLoq.mjs} +3 -17
- package/dist/{messages-C6Y4Jv2N.mjs → chunks/messages-BMq9k_lI.mjs} +3 -17
- package/dist/{messages-DjJQoYvP2.mjs → chunks/messages-BXSXk3oS2.mjs} +3 -17
- package/dist/{messages-pgPcitDH.mjs → chunks/messages-BXn9Vzbx2.mjs} +3 -17
- package/dist/chunks/{messages-DR09nkcZ.mjs → messages-BaoJwsEZ.mjs} +3 -17
- package/dist/{messages-CdlsTFB1.mjs → chunks/messages-BbfLRqLh2.mjs} +3 -17
- package/dist/{messages-BvgTQLf72.mjs → chunks/messages-BhcYsC_M2.mjs} +3 -17
- package/dist/chunks/{messages-Cdx4QMR1.mjs → messages-BlO_37l_.mjs} +3 -17
- package/dist/{messages--S8_taOd2.mjs → chunks/messages-BlcRm2I3.mjs} +3 -17
- package/dist/{messages-DbxbxUiK2.mjs → chunks/messages-Btr121zI2.mjs} +3 -17
- package/dist/chunks/{messages-p4byLfvR.mjs → messages-BxBID_0B.mjs} +3 -17
- package/dist/chunks/{messages-Cs9XBt4T.mjs → messages-ByAqzAhB.mjs} +3 -17
- package/dist/chunks/{messages-JQKFJo7C.mjs → messages-C-jA6Rf7.mjs} +3 -17
- package/dist/{messages-BAcH6PtT2.mjs → chunks/messages-C5aCWL7B.mjs} +3 -17
- package/dist/{messages-BCG_evLg.mjs → chunks/messages-CF_PfacZ.mjs} +3 -17
- package/dist/{messages-B-4fku2H2.mjs → chunks/messages-CKRJDX0K2.mjs} +3 -17
- package/dist/chunks/{messages-CrMfiGu5.mjs → messages-CL3mCbi6.mjs} +3 -17
- package/dist/chunks/{messages-BnznaKEP2.mjs → messages-CNEJxD8q2.mjs} +3 -17
- package/dist/{messages-hTpeKUaW.mjs → chunks/messages-CZ5Sbf8U.mjs} +3 -17
- package/dist/chunks/{messages-CljStrYi.mjs → messages-CcyIKgGU.mjs} +3 -17
- package/dist/{messages-Dcyrzdxa2.mjs → chunks/messages-CdzF0Hvl.mjs} +3 -17
- package/dist/chunks/{messages-IDEUsFhQ2.mjs → messages-CgedvWCf.mjs} +3 -17
- package/dist/chunks/{messages-CmXADeab2.mjs → messages-CjVPwkVy.mjs} +3 -17
- package/dist/chunks/{messages-wLSVQbsA2.mjs → messages-CnQydQJd2.mjs} +3 -17
- package/dist/chunks/{messages-BS1nOvZ-.mjs → messages-CqgEz7C5.mjs} +3 -17
- package/dist/{messages-BCuTVHBV.mjs → chunks/messages-CvlMT1e62.mjs} +3 -17
- package/dist/{messages-CYX48nfg.mjs → chunks/messages-CyxDkx8a.mjs} +3 -17
- package/dist/chunks/{messages-ClRHDxzh.mjs → messages-D7n_wJK7.mjs} +3 -17
- package/dist/chunks/{messages-Dplnp19q.mjs → messages-D8-N0FmU.mjs} +3 -17
- package/dist/chunks/{messages-DAVsuDWh2.mjs → messages-D8dKkyII2.mjs} +3 -17
- package/dist/chunks/{messages-B3s2vra72.mjs → messages-DGD6BiGd.mjs} +3 -17
- package/dist/chunks/{messages-DHCVA7XQ.mjs → messages-DJO0ERQT.mjs} +3 -17
- package/dist/chunks/{messages-B7MIRzCa2.mjs → messages-DMyRdafk2.mjs} +3 -17
- package/dist/chunks/{messages-C-b6tPad2.mjs → messages-DN-194c32.mjs} +3 -17
- package/dist/chunks/{messages-BW_7lfqG2.mjs → messages-DQ5ng0_t2.mjs} +3 -17
- package/dist/{messages-DUBHHfEt.mjs → chunks/messages-DRv4g-IA.mjs} +3 -17
- package/dist/chunks/{messages-xfjdrZmx.mjs → messages-DSO2U-ul.mjs} +3 -17
- package/dist/{messages-CgzbJ8_l2.mjs → chunks/messages-DUGEqDEG.mjs} +3 -17
- package/dist/{messages-DA-o8X3A.mjs → chunks/messages-DVKifYlq.mjs} +3 -17
- package/dist/{messages-tsHpMdDT2.mjs → chunks/messages-DWD0ry9x.mjs} +3 -17
- package/dist/{messages-Dddxv8-f2.mjs → chunks/messages-DYizZHT2.mjs} +3 -17
- package/dist/chunks/{messages-Csvm4mtA.mjs → messages-DZwCufSb.mjs} +3 -17
- package/dist/{messages-BJ7BuFZi.mjs → chunks/messages-DdmWzF5M.mjs} +3 -17
- package/dist/{messages-Bo_FUvVH.mjs → chunks/messages-DgEGJECT.mjs} +3 -17
- package/dist/chunks/{messages-Bpda_3PM2.mjs → messages-Dgng6KN8.mjs} +3 -17
- package/dist/{messages-CBzd_x7H.mjs → chunks/messages-DkTxBa1V.mjs} +3 -17
- package/dist/{messages-Bio7KYsr2.mjs → chunks/messages-DnJHflSh.mjs} +3 -17
- package/dist/{messages-CjmSrt1D.mjs → chunks/messages-DopbvJlg.mjs} +3 -17
- package/dist/{messages-DIRha_gg2.mjs → chunks/messages-Dux1S0-D2.mjs} +3 -17
- package/dist/chunks/{messages-1Raf1IK82.mjs → messages-Dw2rmKMi2.mjs} +3 -17
- package/dist/chunks/{messages-D5IgUbBD2.mjs → messages-Dz3UhEco2.mjs} +3 -17
- package/dist/{messages-C6OJvnJg2.mjs → chunks/messages-FYl9woii2.mjs} +3 -17
- package/dist/{messages-BBvDbp62.mjs → chunks/messages-Jps5Tc77.mjs} +3 -17
- package/dist/chunks/{messages-Dfpi8pDY.mjs → messages-NJsvFwJj.mjs} +3 -17
- package/dist/chunks/{messages-DPykxECP2.mjs → messages-SSDr5fGF2.mjs} +3 -17
- package/dist/{messages-BXI3qIos.mjs → chunks/messages-bmwto4UV.mjs} +3 -17
- package/dist/{messages-CBdQ3XP9.mjs → chunks/messages-vN4T4r67.mjs} +3 -17
- package/dist/{messages-tK67CBqn.mjs → chunks/messages-yszqJukE.mjs} +3 -17
- package/dist/chunks/micromark-extension-math-CCEGWpdz.mjs +169 -0
- package/dist/chunks/micromark-factory-space-WwmyBO_J.mjs +36 -0
- package/dist/chunks/{notifier-Butv4Dvo.mjs → notifier-BOwxj_Ok.mjs} +1 -1
- package/dist/chunks/{objectSpread2-BY4mgzrQ.mjs → objectSpread2-CWwMYL_U.mjs} +1 -1
- package/dist/chunks/{tools-DVZ3zU40.mjs → tools-DGOsJbHH.mjs} +1816 -2916
- package/dist/full.mjs +14 -14
- package/dist/locales.mjs +82 -84
- package/dist/markdown.mjs +3962 -0
- package/dist/{messages-DqyqEw1_.mjs → messages--cUQf9JX.mjs} +3 -17
- package/dist/{messages-BtxaN-xx.mjs → messages-12_eyAo-.mjs} +3 -17
- package/dist/{chunks/messages-LxumrNue2.mjs → messages-B3Yhiycb2.mjs} +3 -17
- package/dist/{chunks/messages-Cqc-6rfh2.mjs → messages-B4lhNMKm2.mjs} +3 -17
- package/dist/{chunks/messages-B0ffBqzr.mjs → messages-BOE2mzCj2.mjs} +3 -17
- package/dist/{chunks/messages-BaPZuLjN.mjs → messages-BPL7riv-.mjs} +3 -17
- package/dist/{messages-DD5pW0zJ.mjs → messages-BYQ769S5.mjs} +3 -17
- package/dist/{chunks/messages-C11byid72.mjs → messages-B_sKqaeK.mjs} +3 -17
- package/dist/{messages-BmNaAyKS.mjs → messages-Bdk4ocMI.mjs} +3 -17
- package/dist/{chunks/messages-6mikOS4D2.mjs → messages-BeI2HORe2.mjs} +3 -17
- package/dist/{chunks/messages-u2yxkNTE2.mjs → messages-Bug6Du35.mjs} +3 -17
- package/dist/{messages-eTourT12.mjs → messages-C2veeQpU.mjs} +3 -17
- package/dist/{messages-BokEflKa.mjs → messages-C5Uufygq.mjs} +3 -17
- package/dist/{chunks/messages-BPog17132.mjs → messages-C8f1I5EQ2.mjs} +3 -17
- package/dist/{chunks/messages-ID1PHnMv.mjs → messages-CBPiFbEf2.mjs} +3 -17
- package/dist/{messages-DZEcrbmH.mjs → messages-CByBLxWk.mjs} +3 -17
- package/dist/{chunks/messages-BgVEGd4c.mjs → messages-CD8K1g_t2.mjs} +3 -17
- package/dist/{messages-Dkg99bfr2.mjs → messages-CEEzfqMO2.mjs} +3 -17
- package/dist/{messages-DV9e1DW7.mjs → messages-CNNcKuGH.mjs} +3 -17
- package/dist/{messages-C30Vz-UZ2.mjs → messages-CSl0Wla62.mjs} +3 -17
- package/dist/{messages-fLi0P2dP.mjs → messages-CUzBNjnc.mjs} +3 -17
- package/dist/{chunks/messages-DJA6fb_P2.mjs → messages-CWEL1WDy2.mjs} +3 -17
- package/dist/{messages-BcFQFcJ92.mjs → messages-C_HmWyXc2.mjs} +3 -17
- package/dist/{chunks/messages-CpzO7KRA.mjs → messages-Cb3wXGnc.mjs} +3 -17
- package/dist/{messages-C5XPUD9T2.mjs → messages-Cd23UgLV2.mjs} +3 -17
- package/dist/{chunks/messages-DSjXen8E.mjs → messages-Cg1CF4pw.mjs} +3 -17
- package/dist/{messages-i4S6q64n2.mjs → messages-CgEDVri-2.mjs} +3 -17
- package/dist/{messages-CHJ5SOZI.mjs → messages-ChTWmxS8.mjs} +3 -17
- package/dist/{messages-BVKZK-3t.mjs → messages-Cho2VTAX.mjs} +3 -17
- package/dist/{chunks/messages-d0Ky6QjR.mjs → messages-CkySRhtd2.mjs} +3 -17
- package/dist/{chunks/messages-C1OqT_nL.mjs → messages-Clsh86WQ.mjs} +3 -17
- package/dist/{chunks/messages-BrFl5773.mjs → messages-CsiGzUSP2.mjs} +3 -17
- package/dist/{messages-BKjqW08U.mjs → messages-Cv-DKlZd.mjs} +3 -17
- package/dist/{messages-BGsDZTQp2.mjs → messages-CvvbLyTy2.mjs} +3 -17
- package/dist/{chunks/messages-DA7Zk-Cy.mjs → messages-CwCEcbWG.mjs} +3 -17
- package/dist/{chunks/messages-DQ5AyNCU.mjs → messages-D38h5XlF.mjs} +3 -17
- package/dist/{chunks/messages-DC7TX-YT.mjs → messages-D7juvhHp.mjs} +3 -17
- package/dist/{chunks/messages-BdnSVKOw.mjs → messages-D8WvwU42.mjs} +3 -17
- package/dist/{chunks/messages-Df87zXXG.mjs → messages-DACg1XAu.mjs} +3 -17
- package/dist/{messages-BBq0M604.mjs → messages-DIKCwGog.mjs} +3 -17
- package/dist/{messages-Ccd587Yn.mjs → messages-DJU4YLij.mjs} +3 -17
- package/dist/{chunks/messages-Dm4YVlrm.mjs → messages-DQN1y6E9.mjs} +3 -17
- package/dist/{messages-CqkRG9mH.mjs → messages-DRU_IgoW.mjs} +3 -17
- package/dist/{chunks/messages-DT7fRpCy.mjs → messages-DbZsJAff.mjs} +3 -17
- package/dist/{messages-upqrRZQH2.mjs → messages-Dg2CDXZi2.mjs} +3 -17
- package/dist/{messages-DJKLtW7u.mjs → messages-Dj79y02X.mjs} +3 -17
- package/dist/{chunks/messages-Ct7AMBS82.mjs → messages-DjWfVYHS2.mjs} +3 -17
- package/dist/{chunks/messages-B2pW6jO_.mjs → messages-DkvQ-6HC2.mjs} +3 -17
- package/dist/{chunks/messages-ZJ0b1C3a.mjs → messages-DnhEzmXJ2.mjs} +3 -17
- package/dist/{chunks/messages-BgsPQXfP.mjs → messages-DqJTZbwt.mjs} +3 -17
- package/dist/{chunks/messages-DUDgFEEe2.mjs → messages-Dq_v7slw2.mjs} +3 -17
- package/dist/{chunks/messages-CyNsByCY.mjs → messages-En8LDjUB.mjs} +3 -17
- package/dist/{chunks/messages-FHrCEJmY2.mjs → messages-JK9Okzsy2.mjs} +3 -17
- package/dist/{messages-DnatBKPm.mjs → messages-KSxF8eib.mjs} +3 -17
- package/dist/{chunks/messages-DD7BI6BK.mjs → messages-KbYSpNrE.mjs} +3 -17
- package/dist/{messages-BvgXeMSL2.mjs → messages-KqWQKmIu2.mjs} +3 -17
- package/dist/{messages-BSe3QDnQ.mjs → messages-PvMdmlxI.mjs} +3 -17
- package/dist/{chunks/messages-DJkIeapn.mjs → messages-So3SHdIc2.mjs} +3 -17
- package/dist/{messages-BywbKcPC.mjs → messages-X80Nh0ib.mjs} +3 -17
- package/dist/{messages-DOTJ2NvJ.mjs → messages-hrSlVSHp.mjs} +3 -17
- package/dist/{messages-DJT4Bt_02.mjs → messages-mipkPgwQ2.mjs} +3 -17
- package/dist/{messages-xEI8gEDK.mjs → messages-nOe1gJYu.mjs} +3 -17
- package/dist/{messages-Bk984gRE2.mjs → messages-rbox5gSb2.mjs} +3 -17
- package/dist/{chunks/messages-CgRvtOEY.mjs → messages-uCsQjz7M.mjs} +3 -17
- package/dist/{chunks/messages-BbdNugdi.mjs → messages-vcoib5Ga.mjs} +3 -17
- package/dist/{chunks/messages-CvfKofOP.mjs → messages-vptt-pVF.mjs} +3 -17
- package/dist/{chunks/messages-BkCjgGxc.mjs → messages-x353UCBI.mjs} +3 -17
- package/dist/react.mjs +3 -3
- package/dist/tools.mjs +3 -3
- package/dist/vendor.LICENSE.txt +1622 -182
- package/package.json +15 -2
- package/src/components/blocks.ts +26 -1
- package/src/components/i18n/locales/am/messages.json +3 -17
- package/src/components/i18n/locales/ar/messages.json +3 -17
- package/src/components/i18n/locales/az/messages.json +3 -17
- package/src/components/i18n/locales/bg/messages.json +3 -17
- package/src/components/i18n/locales/bn/messages.json +3 -17
- package/src/components/i18n/locales/bs/messages.json +3 -17
- package/src/components/i18n/locales/cs/messages.json +3 -17
- package/src/components/i18n/locales/da/messages.json +3 -17
- package/src/components/i18n/locales/de/messages.json +3 -17
- package/src/components/i18n/locales/dv/messages.json +3 -17
- package/src/components/i18n/locales/el/messages.json +3 -17
- package/src/components/i18n/locales/en/messages.json +15 -17
- package/src/components/i18n/locales/es/messages.json +3 -17
- package/src/components/i18n/locales/et/messages.json +3 -17
- package/src/components/i18n/locales/fa/messages.json +3 -17
- package/src/components/i18n/locales/fi/messages.json +3 -17
- package/src/components/i18n/locales/fil/messages.json +3 -17
- package/src/components/i18n/locales/fr/messages.json +3 -17
- package/src/components/i18n/locales/gu/messages.json +3 -17
- package/src/components/i18n/locales/he/messages.json +3 -17
- package/src/components/i18n/locales/hi/messages.json +3 -17
- package/src/components/i18n/locales/hr/messages.json +3 -17
- package/src/components/i18n/locales/hu/messages.json +3 -17
- package/src/components/i18n/locales/hy/messages.json +3 -17
- package/src/components/i18n/locales/id/messages.json +3 -17
- package/src/components/i18n/locales/it/messages.json +3 -17
- package/src/components/i18n/locales/ja/messages.json +3 -17
- package/src/components/i18n/locales/ka/messages.json +3 -17
- package/src/components/i18n/locales/km/messages.json +3 -17
- package/src/components/i18n/locales/kn/messages.json +3 -17
- package/src/components/i18n/locales/ko/messages.json +3 -17
- package/src/components/i18n/locales/ku/messages.json +3 -17
- package/src/components/i18n/locales/lo/messages.json +3 -17
- package/src/components/i18n/locales/lt/messages.json +3 -17
- package/src/components/i18n/locales/lv/messages.json +3 -17
- package/src/components/i18n/locales/mk/messages.json +3 -17
- package/src/components/i18n/locales/ml/messages.json +3 -17
- package/src/components/i18n/locales/mn/messages.json +3 -17
- package/src/components/i18n/locales/mr/messages.json +3 -17
- package/src/components/i18n/locales/ms/messages.json +3 -17
- package/src/components/i18n/locales/my/messages.json +3 -17
- package/src/components/i18n/locales/ne/messages.json +3 -17
- package/src/components/i18n/locales/nl/messages.json +3 -17
- package/src/components/i18n/locales/no/messages.json +3 -17
- package/src/components/i18n/locales/pa/messages.json +3 -17
- package/src/components/i18n/locales/pl/messages.json +3 -17
- package/src/components/i18n/locales/ps/messages.json +3 -17
- package/src/components/i18n/locales/pt/messages.json +3 -17
- package/src/components/i18n/locales/ro/messages.json +3 -17
- package/src/components/i18n/locales/ru/messages.json +3 -17
- package/src/components/i18n/locales/sd/messages.json +3 -17
- package/src/components/i18n/locales/si/messages.json +3 -17
- package/src/components/i18n/locales/sk/messages.json +3 -17
- package/src/components/i18n/locales/sl/messages.json +3 -17
- package/src/components/i18n/locales/sq/messages.json +3 -17
- package/src/components/i18n/locales/sr/messages.json +3 -17
- package/src/components/i18n/locales/sv/messages.json +3 -17
- package/src/components/i18n/locales/sw/messages.json +3 -17
- package/src/components/i18n/locales/ta/messages.json +3 -17
- package/src/components/i18n/locales/te/messages.json +3 -17
- package/src/components/i18n/locales/th/messages.json +3 -17
- package/src/components/i18n/locales/tr/messages.json +3 -17
- package/src/components/i18n/locales/ug/messages.json +3 -17
- package/src/components/i18n/locales/uk/messages.json +3 -17
- package/src/components/i18n/locales/ur/messages.json +3 -17
- package/src/components/i18n/locales/vi/messages.json +3 -17
- package/src/components/i18n/locales/yi/messages.json +3 -17
- package/src/components/i18n/locales/zh/messages.json +3 -17
- package/src/components/icons/index.ts +30 -56
- package/src/components/inline-tools/inline-tool-code.ts +399 -0
- package/src/components/modules/api/blocks.ts +17 -0
- package/src/components/modules/api/tools.ts +0 -19
- package/src/components/modules/blockEvents/composers/blockSelectionKeys.ts +20 -3
- package/src/components/modules/blockEvents/composers/keyboardNavigation.ts +5 -5
- package/src/components/modules/blockManager/blockManager.ts +0 -11
- package/src/components/modules/blockManager/event-binder.ts +1 -12
- package/src/components/modules/paste/handlers/html-handler.ts +13 -10
- package/src/components/modules/paste/handlers/index.ts +1 -0
- package/src/components/modules/paste/index.ts +6 -0
- package/src/components/modules/themeManager.ts +1 -3
- package/src/components/modules/toolbar/blockSettings.ts +1 -0
- package/src/components/modules/toolbar/inline/index.ts +3 -0
- package/src/components/modules/uiControllers/controllers/keyboard.ts +0 -29
- package/src/components/modules/uiControllers/controllers/selection.ts +2 -14
- package/src/components/ui/toolbox.ts +1 -0
- package/src/components/utils/popover/popover-position.ts +2 -4
- package/src/markdown/index.ts +63 -0
- package/src/markdown/markdown-handler.ts +110 -0
- package/src/markdown/mdast-to-blocks.ts +418 -0
- package/src/markdown/phrasing-to-html.ts +60 -0
- package/src/markdown/types.ts +42 -0
- package/src/styles/main.css +0 -1139
- package/src/tools/callout/index.ts +24 -0
- package/src/tools/code/code-keyboard.ts +135 -0
- package/src/tools/code/constants.ts +73 -0
- package/src/tools/code/dom-builder.ts +146 -0
- package/src/tools/code/index.ts +322 -0
- package/src/tools/code/katex-loader.ts +50 -0
- package/src/tools/code/language-picker.ts +241 -0
- package/src/tools/divider/index.ts +9 -1
- package/src/tools/index.ts +4 -2
- package/src/tools/list/block-operations.ts +3 -1
- package/src/tools/list/depth-validator.ts +4 -7
- package/src/tools/list/dom-builder.ts +5 -3
- package/src/tools/list/index.ts +21 -3
- package/src/tools/list/list-helpers.ts +9 -2
- package/src/tools/list/list-keyboard.ts +56 -14
- package/src/tools/list/list-lifecycle.ts +3 -1
- package/src/tools/list/marker-calculator.ts +37 -0
- package/src/tools/list/ordered-marker-manager.ts +4 -2
- package/src/tools/table/index.ts +2 -2
- package/src/tools/table/table-cell-clipboard.ts +1 -1
- package/types/api/tools.d.ts +0 -18
- package/types/markdown.d.ts +2 -0
- package/types/tools/code.d.ts +11 -0
- package/src/tools/database/database-backend-sync.ts +0 -101
- package/src/tools/database/database-board-view.ts +0 -301
- package/src/tools/database/database-card-drag.ts +0 -306
- package/src/tools/database/database-card-drawer.ts +0 -546
- package/src/tools/database/database-column-controls.ts +0 -46
- package/src/tools/database/database-column-drag.ts +0 -262
- package/src/tools/database/database-keyboard.ts +0 -35
- package/src/tools/database/database-list-row-drag.ts +0 -245
- package/src/tools/database/database-list-view.ts +0 -333
- package/src/tools/database/database-model.ts +0 -246
- package/src/tools/database/database-property-type-popover.ts +0 -108
- package/src/tools/database/database-tab-bar.ts +0 -532
- package/src/tools/database/database-view-popover.ts +0 -109
- package/src/tools/database/database-view-renderer.ts +0 -25
- package/src/tools/database/index.ts +0 -948
- package/src/tools/database/types.ts +0 -144
- /package/dist/chunks/{am-CHDDMHkd.mjs → am-CS-JjQ0N.mjs} +0 -0
- /package/dist/chunks/{ar-DoqfNqut.mjs → ar-Dt4XzR5U.mjs} +0 -0
- /package/dist/chunks/{az-C34P9iEa.mjs → az-CaDTXby8.mjs} +0 -0
- /package/dist/chunks/{bg-jroXLY8Y.mjs → bg-D1pLog-R.mjs} +0 -0
- /package/dist/chunks/{bn-BRI-WqxY.mjs → bn-Db_ae60m.mjs} +0 -0
- /package/dist/chunks/{bs-CCGUpNHu.mjs → bs-DJTg1R9e.mjs} +0 -0
- /package/dist/chunks/{cs-D5qZOGuc.mjs → cs-_Gc21gSL.mjs} +0 -0
- /package/dist/chunks/{da-DrJ7W37K.mjs → da-xDB8uhCd.mjs} +0 -0
- /package/dist/chunks/{de-BW6-kp2c.mjs → de-B6gVjh1Z.mjs} +0 -0
- /package/dist/chunks/{el-C-Vc_Otu.mjs → el-ClbRSnOs.mjs} +0 -0
- /package/dist/chunks/{es-B6fI5K9i.mjs → es-CuY9rnLK.mjs} +0 -0
- /package/dist/chunks/{et-BhVlZ-Yz.mjs → et-BLu5lDVc.mjs} +0 -0
- /package/dist/chunks/{fa-D55Ijdqa.mjs → fa-P3gnrZH8.mjs} +0 -0
- /package/dist/chunks/{fi-jNLjhKUQ.mjs → fi-B8PVHLjq.mjs} +0 -0
- /package/dist/chunks/{fil-DYd0T5aX.mjs → fil-B9JII5iF.mjs} +0 -0
- /package/dist/chunks/{fr-yxy5xWw_.mjs → fr-BWLDZdcc.mjs} +0 -0
- /package/dist/chunks/{gu-CcY_LJe7.mjs → gu-BH3R_s4c.mjs} +0 -0
- /package/dist/chunks/{he-DL9s7wNw.mjs → he-CCmeCVR_.mjs} +0 -0
- /package/dist/chunks/{hi-C8eGXgw5.mjs → hi-BBav00DN.mjs} +0 -0
- /package/dist/chunks/{hr-DLpybOhU.mjs → hr-B5ZX0r9G.mjs} +0 -0
- /package/dist/chunks/{hu-BkT0gT00.mjs → hu-1jgDa3YU.mjs} +0 -0
- /package/dist/chunks/{hy-CVFDCp2S.mjs → hy-LX4Kp2PE.mjs} +0 -0
- /package/dist/chunks/{id-0P4W9Az0.mjs → id-CcG40D1H.mjs} +0 -0
- /package/dist/chunks/{it-mLY6_uoW.mjs → it-Cb8_K72W.mjs} +0 -0
- /package/dist/chunks/{ja-7RkeRNWG.mjs → ja-ipCH91mv.mjs} +0 -0
- /package/dist/chunks/{ka-C7Lx-Qsh.mjs → ka-BRvREIgq.mjs} +0 -0
- /package/dist/chunks/{km-Q8udaraH.mjs → km-BJwVw7Fg.mjs} +0 -0
- /package/dist/chunks/{kn-BiETM-iq.mjs → kn-BPgUazCC.mjs} +0 -0
- /package/dist/chunks/{ko-tiB80pF1.mjs → ko-CQLzxe7k.mjs} +0 -0
- /package/dist/chunks/{ku-CY-OABkR.mjs → ku-BHhHu8Iz.mjs} +0 -0
- /package/dist/chunks/{lo-CTBhEnyk.mjs → lo-DsTgYblY.mjs} +0 -0
- /package/dist/chunks/{lt-BHKHEtqK.mjs → lt-CDzHJm71.mjs} +0 -0
- /package/dist/chunks/{lv-DWxgtfUg.mjs → lv-MLLIAnIX.mjs} +0 -0
- /package/dist/chunks/{mk-BjookGdx.mjs → mk-DQdmUquZ.mjs} +0 -0
- /package/dist/chunks/{ml-L-NnZcp9.mjs → ml-DqehZnra.mjs} +0 -0
- /package/dist/chunks/{mn-OMWi7Hl_.mjs → mn-4cFkKFjW.mjs} +0 -0
- /package/dist/chunks/{mr-B6JPzITo.mjs → mr-DWiztOP4.mjs} +0 -0
- /package/dist/chunks/{ms-CG3S-sPB.mjs → ms-BSz-iSnc.mjs} +0 -0
- /package/dist/chunks/{my-BLAmGfhT.mjs → my-DbtbM1MW.mjs} +0 -0
- /package/dist/chunks/{native-BPcABu9z.mjs → native-CzYG0YgY.mjs} +0 -0
- /package/dist/chunks/{ne-D1JHLfYw.mjs → ne-CqALWw_f.mjs} +0 -0
- /package/dist/chunks/{nl-Ca7Q8FnY.mjs → nl-D_ra6RvH.mjs} +0 -0
- /package/dist/chunks/{no-Coxcohcz.mjs → no-Cg_kz_jl.mjs} +0 -0
- /package/dist/chunks/{pa-CCaXqpaI.mjs → pa-NLAsNqwY.mjs} +0 -0
- /package/dist/chunks/{pl-Cl_fAZ84.mjs → pl-NHKp4YDg.mjs} +0 -0
- /package/dist/chunks/{ps-WD5qGAWy.mjs → ps-D1zEqNeg.mjs} +0 -0
- /package/dist/chunks/{pt-C4zvLfvq.mjs → pt-DBtqbUEB.mjs} +0 -0
- /package/dist/chunks/{ro-DbefHcmM.mjs → ro-lqr63ai5.mjs} +0 -0
- /package/dist/chunks/{ru-uU1J14jd.mjs → ru-BycNnDyN.mjs} +0 -0
- /package/dist/chunks/{sd-DKu368Ip.mjs → sd-DpHpIN9Z.mjs} +0 -0
- /package/dist/chunks/{si-BsJCiPkZ.mjs → si-BwiwaC7N.mjs} +0 -0
- /package/dist/chunks/{sk-CD-a3SN6.mjs → sk-CqRHT2Gp.mjs} +0 -0
- /package/dist/chunks/{sl-CXhrPJe_.mjs → sl-DA348uQ_.mjs} +0 -0
- /package/dist/chunks/{sq-CTctCoFQ.mjs → sq-D7JNgve1.mjs} +0 -0
- /package/dist/chunks/{sr-BZkhBwXj.mjs → sr-D8RK6Kwp.mjs} +0 -0
- /package/dist/chunks/{sv-NmRZb_xi.mjs → sv-dwgT67ZG.mjs} +0 -0
- /package/dist/chunks/{sw-Be5ik3H6.mjs → sw-ZRRJnkem.mjs} +0 -0
- /package/dist/chunks/{ta-DsXh6neL.mjs → ta-5x4L5Krl.mjs} +0 -0
- /package/dist/chunks/{te-CwpCbM8M.mjs → te-BZpEimwA.mjs} +0 -0
- /package/dist/chunks/{th-CcZ15OLk.mjs → th-Bhr-33kv.mjs} +0 -0
- /package/dist/chunks/{tr-q3bTgvhW.mjs → tr-6tSNKGNB.mjs} +0 -0
- /package/dist/chunks/{tw-DmW6-pCY.mjs → tw-CqxBf-1Y.mjs} +0 -0
- /package/dist/chunks/{ug-919EhLsL.mjs → ug-_e-jvr2b.mjs} +0 -0
- /package/dist/chunks/{uk-aNMEzd0Y.mjs → uk-DooSc2Ja.mjs} +0 -0
- /package/dist/chunks/{ur-BwQI77sh.mjs → ur-rb-krkIO.mjs} +0 -0
- /package/dist/chunks/{vi-Dxq806-F.mjs → vi-CQkLn2AQ.mjs} +0 -0
- /package/dist/chunks/{zh-BcHuy1Ti.mjs → zh-CXQ40Q2_.mjs} +0 -0
|
@@ -34,24 +34,21 @@ export class ListDepthValidator {
|
|
|
34
34
|
* Calculate the maximum allowed depth at a given block index.
|
|
35
35
|
*
|
|
36
36
|
* Rules:
|
|
37
|
-
* 1. First
|
|
37
|
+
* 1. First-in-group items (index 0 or previous block is not a list) are uncapped
|
|
38
38
|
* 2. For other items: maxDepth = previousListItem.depth + 1
|
|
39
|
-
* 3. If previous block is not a list item, maxDepth = 0
|
|
40
39
|
*
|
|
41
40
|
* @param blockIndex - The index of the block
|
|
42
|
-
* @returns The maximum allowed depth (0 or more)
|
|
41
|
+
* @returns The maximum allowed depth (0 or more, or Infinity for first-in-group)
|
|
43
42
|
*/
|
|
44
43
|
getMaxAllowedDepth(blockIndex: number): number {
|
|
45
|
-
// First item must be at depth 0
|
|
46
44
|
if (blockIndex === 0) {
|
|
47
|
-
return
|
|
45
|
+
return 1;
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
const previousBlock = this.blocks.getBlockByIndex(blockIndex - 1);
|
|
51
49
|
|
|
52
|
-
// If previous block doesn't exist or isn't a list item, max depth is 0
|
|
53
50
|
if (!previousBlock || previousBlock.name !== TOOL_NAME) {
|
|
54
|
-
return
|
|
51
|
+
return 1;
|
|
55
52
|
}
|
|
56
53
|
|
|
57
54
|
// Max depth is previous item's depth + 1
|
|
@@ -69,6 +69,8 @@ export interface DOMBuilderContext {
|
|
|
69
69
|
itemSize?: string;
|
|
70
70
|
/** Optional keydown event handler */
|
|
71
71
|
keydownHandler?: ((event: KeyboardEvent) => void) | null;
|
|
72
|
+
/** Visual depth for marker display (overrides data.depth for marker only) */
|
|
73
|
+
markerDepth?: number;
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
/**
|
|
@@ -149,7 +151,7 @@ export const buildWrapper = (context: DOMBuilderContext): HTMLElement => {
|
|
|
149
151
|
* @returns The list item element containing marker and content
|
|
150
152
|
*/
|
|
151
153
|
export const buildStandardContent = (context: DOMBuilderContext): HTMLElement => {
|
|
152
|
-
const { data, itemColor, itemSize, placeholder } = context;
|
|
154
|
+
const { data, itemColor, itemSize, placeholder, markerDepth } = context;
|
|
153
155
|
|
|
154
156
|
const item = document.createElement('div');
|
|
155
157
|
item.setAttribute('role', 'listitem');
|
|
@@ -170,8 +172,8 @@ export const buildStandardContent = (context: DOMBuilderContext): HTMLElement =>
|
|
|
170
172
|
item.style.marginLeft = `${depth * indent}px`;
|
|
171
173
|
}
|
|
172
174
|
|
|
173
|
-
// Create marker element
|
|
174
|
-
const marker = createMarker(data.style, depth);
|
|
175
|
+
// Create marker element (use visual depth for marker display when provided)
|
|
176
|
+
const marker = createMarker(data.style, markerDepth ?? depth);
|
|
175
177
|
marker.setAttribute('data-list-marker', 'true');
|
|
176
178
|
marker.setAttribute('data-blok-mutation-free', 'true');
|
|
177
179
|
item.appendChild(marker);
|
package/src/tools/list/index.ts
CHANGED
|
@@ -124,12 +124,19 @@ export class ListItem implements BlockTool {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
public render(): HTMLElement {
|
|
127
|
+
const blockIndex = this.blockId
|
|
128
|
+
? this.api.blocks.getBlockIndex(this.blockId) ?? this.api.blocks.getCurrentBlockIndex()
|
|
129
|
+
: this.api.blocks.getCurrentBlockIndex();
|
|
130
|
+
const depth = this._data.depth ?? 0;
|
|
131
|
+
const markerDepth = this.markerCalculator.getVisualDepth(blockIndex, depth);
|
|
132
|
+
|
|
127
133
|
this._element = renderListItem({
|
|
128
134
|
data: this._data,
|
|
129
135
|
readOnly: this.readOnly,
|
|
130
136
|
placeholder: this.placeholder,
|
|
131
137
|
itemColor: this.itemColor,
|
|
132
138
|
itemSize: this.itemSize,
|
|
139
|
+
markerDepth,
|
|
133
140
|
setupItemPlaceholder: this.setupItemPlaceholder.bind(this),
|
|
134
141
|
onCheckboxChange: (checked, content) => {
|
|
135
142
|
this._data.checked = checked;
|
|
@@ -226,13 +233,18 @@ export class ListItem implements BlockTool {
|
|
|
226
233
|
return;
|
|
227
234
|
}
|
|
228
235
|
|
|
236
|
+
const blockIndex = this.blockId
|
|
237
|
+
? this.api.blocks.getBlockIndex(this.blockId) ?? this.api.blocks.getCurrentBlockIndex()
|
|
238
|
+
: this.api.blocks.getCurrentBlockIndex();
|
|
239
|
+
const visualDepth = this.markerCalculator.getVisualDepth(blockIndex, newDepth);
|
|
240
|
+
|
|
229
241
|
if (style === 'ordered') {
|
|
230
242
|
const siblingIndex = getSiblingIndex(this.blockId, newDepth, this._data.style, this.api.blocks, this.markerCalculator);
|
|
231
243
|
const markerText = getOrderedMarkerText(siblingIndex, newDepth, this._data, this.blockId, this.api.blocks, this.markerCalculator);
|
|
232
244
|
|
|
233
245
|
marker.textContent = markerText;
|
|
234
246
|
} else {
|
|
235
|
-
const bulletChar = getBulletCharacter(
|
|
247
|
+
const bulletChar = getBulletCharacter(visualDepth, this.markerCalculator);
|
|
236
248
|
|
|
237
249
|
marker.textContent = bulletChar;
|
|
238
250
|
}
|
|
@@ -295,7 +307,7 @@ export class ListItem implements BlockTool {
|
|
|
295
307
|
getDepth: this.getDepth.bind(this),
|
|
296
308
|
};
|
|
297
309
|
|
|
298
|
-
await handleEnter(context);
|
|
310
|
+
await handleEnter(context, this.depthValidator);
|
|
299
311
|
}
|
|
300
312
|
|
|
301
313
|
private async handleBackspace(event: KeyboardEvent): Promise<void> {
|
|
@@ -337,7 +349,7 @@ export class ListItem implements BlockTool {
|
|
|
337
349
|
getDepth: this.getDepth.bind(this),
|
|
338
350
|
};
|
|
339
351
|
|
|
340
|
-
await handleOutdent(context);
|
|
352
|
+
await handleOutdent(context, this.depthValidator);
|
|
341
353
|
}
|
|
342
354
|
|
|
343
355
|
private syncContentFromDOM(): void {
|
|
@@ -375,12 +387,18 @@ export class ListItem implements BlockTool {
|
|
|
375
387
|
}
|
|
376
388
|
|
|
377
389
|
private rerender(): void {
|
|
390
|
+
const blockIndex = this.blockId
|
|
391
|
+
? this.api.blocks.getBlockIndex(this.blockId) ?? this.api.blocks.getCurrentBlockIndex()
|
|
392
|
+
: this.api.blocks.getCurrentBlockIndex();
|
|
393
|
+
const depth = this._data.depth ?? 0;
|
|
394
|
+
|
|
378
395
|
const newElement = rerenderListItem({
|
|
379
396
|
data: this._data,
|
|
380
397
|
readOnly: this.readOnly,
|
|
381
398
|
placeholder: this.placeholder,
|
|
382
399
|
itemColor: this.itemColor,
|
|
383
400
|
itemSize: this.itemSize,
|
|
401
|
+
markerDepth: this.markerCalculator.getVisualDepth(blockIndex, depth),
|
|
384
402
|
element: this._element,
|
|
385
403
|
setupItemPlaceholder: this.setupItemPlaceholder.bind(this),
|
|
386
404
|
onCheckboxChange: (checked, content) => {
|
|
@@ -166,7 +166,13 @@ export const getOrderedMarkerText = (
|
|
|
166
166
|
): string => {
|
|
167
167
|
const startValue = getListStartValue(index, depth, blockId, data, blocks, markerCalculator);
|
|
168
168
|
const actualNumber = startValue + index;
|
|
169
|
-
|
|
169
|
+
|
|
170
|
+
const blockIndex = blockId
|
|
171
|
+
? blocks.getBlockIndex(blockId) ?? blocks.getCurrentBlockIndex()
|
|
172
|
+
: blocks.getCurrentBlockIndex();
|
|
173
|
+
const visualDepth = markerCalculator.getVisualDepth(blockIndex, depth);
|
|
174
|
+
|
|
175
|
+
return markerCalculator.formatNumber(actualNumber, visualDepth);
|
|
170
176
|
}
|
|
171
177
|
|
|
172
178
|
/**
|
|
@@ -216,7 +222,8 @@ export const updateBlockMarker = (
|
|
|
216
222
|
|
|
217
223
|
const startValue = markerCalculator.getGroupStartValue(blockIndex, blockDepth, siblingIndex, blockStyle);
|
|
218
224
|
const actualNumber = startValue + siblingIndex;
|
|
219
|
-
const
|
|
225
|
+
const visualDepth = markerCalculator.getVisualDepth(blockIndex, blockDepth);
|
|
226
|
+
const markerText = markerCalculator.formatNumber(actualNumber, visualDepth);
|
|
220
227
|
|
|
221
228
|
marker.textContent = markerText;
|
|
222
229
|
}
|
|
@@ -32,7 +32,10 @@ export interface KeyboardContext {
|
|
|
32
32
|
/**
|
|
33
33
|
* Handle Enter key - split content or exit list
|
|
34
34
|
*/
|
|
35
|
-
export const handleEnter = async (
|
|
35
|
+
export const handleEnter = async (
|
|
36
|
+
context: KeyboardContext,
|
|
37
|
+
depthValidator?: ListDepthValidator
|
|
38
|
+
): Promise<void> => {
|
|
36
39
|
const { api, blockId, data, element, getContentElement } = context;
|
|
37
40
|
|
|
38
41
|
const selection = window.getSelection();
|
|
@@ -45,7 +48,7 @@ export const handleEnter = async (context: KeyboardContext): Promise<void> => {
|
|
|
45
48
|
|
|
46
49
|
// If current item is empty, handle based on depth
|
|
47
50
|
if (currentContent === '' || currentContent === '<br>') {
|
|
48
|
-
await exitListOrOutdent(context);
|
|
51
|
+
await exitListOrOutdent(context, depthValidator);
|
|
49
52
|
return;
|
|
50
53
|
}
|
|
51
54
|
|
|
@@ -98,13 +101,16 @@ export const handleEnter = async (context: KeyboardContext): Promise<void> => {
|
|
|
98
101
|
/**
|
|
99
102
|
* Exit list or outdent when pressing Enter on empty item
|
|
100
103
|
*/
|
|
101
|
-
const exitListOrOutdent = async (
|
|
104
|
+
const exitListOrOutdent = async (
|
|
105
|
+
context: KeyboardContext,
|
|
106
|
+
depthValidator?: ListDepthValidator
|
|
107
|
+
): Promise<void> => {
|
|
102
108
|
const { api, blockId, getDepth } = context;
|
|
103
109
|
const currentDepth = getDepth();
|
|
104
110
|
|
|
105
111
|
// If nested, outdent instead of exiting
|
|
106
112
|
if (currentDepth > 0) {
|
|
107
|
-
await handleOutdent(context);
|
|
113
|
+
await handleOutdent(context, depthValidator);
|
|
108
114
|
return;
|
|
109
115
|
}
|
|
110
116
|
|
|
@@ -193,16 +199,11 @@ export const handleIndent = async(
|
|
|
193
199
|
const { api, blockId, data, syncContentFromDOM, getDepth } = context;
|
|
194
200
|
|
|
195
201
|
const currentBlockIndex = api.blocks.getCurrentBlockIndex();
|
|
196
|
-
if (currentBlockIndex === 0) return;
|
|
197
|
-
|
|
198
|
-
const previousBlock = api.blocks.getBlockByIndex(currentBlockIndex - 1);
|
|
199
|
-
if (!previousBlock || previousBlock.name !== TOOL_NAME) return;
|
|
200
|
-
|
|
201
202
|
const currentDepth = getDepth();
|
|
202
|
-
const
|
|
203
|
+
const maxAllowedDepth = depthValidator.getMaxAllowedDepth(currentBlockIndex);
|
|
203
204
|
|
|
204
|
-
// Can only indent
|
|
205
|
-
if (currentDepth
|
|
205
|
+
// Can only indent if current depth is below the maximum
|
|
206
|
+
if (currentDepth >= maxAllowedDepth) return;
|
|
206
207
|
|
|
207
208
|
// Sync current content before updating
|
|
208
209
|
syncContentFromDOM();
|
|
@@ -222,9 +223,45 @@ export const handleIndent = async(
|
|
|
222
223
|
};
|
|
223
224
|
|
|
224
225
|
/**
|
|
225
|
-
*
|
|
226
|
+
* Reduce depth by 1 for all descendant list items following the given block.
|
|
227
|
+
* Stops at non-list blocks or blocks with depth <= the parent's original depth.
|
|
226
228
|
*/
|
|
227
|
-
|
|
229
|
+
const cascadeDepthReduction = async (
|
|
230
|
+
api: API,
|
|
231
|
+
blockId: string | undefined,
|
|
232
|
+
parentOriginalDepth: number,
|
|
233
|
+
depthValidator: ListDepthValidator
|
|
234
|
+
): Promise<void> => {
|
|
235
|
+
const startIndex = blockId
|
|
236
|
+
? api.blocks.getBlockIndex(blockId) ?? api.blocks.getCurrentBlockIndex()
|
|
237
|
+
: api.blocks.getCurrentBlockIndex();
|
|
238
|
+
const blocksCount = api.blocks.getBlocksCount();
|
|
239
|
+
|
|
240
|
+
const processDescendant = async (index: number): Promise<void> => {
|
|
241
|
+
if (index >= blocksCount) return;
|
|
242
|
+
|
|
243
|
+
const block = api.blocks.getBlockByIndex(index);
|
|
244
|
+
|
|
245
|
+
if (!block || block.name !== TOOL_NAME) return;
|
|
246
|
+
|
|
247
|
+
const blockDepth = depthValidator.getBlockDepth(block);
|
|
248
|
+
|
|
249
|
+
if (blockDepth <= parentOriginalDepth) return;
|
|
250
|
+
|
|
251
|
+
await api.blocks.update(block.id, { depth: blockDepth - 1 });
|
|
252
|
+
await processDescendant(index + 1);
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
await processDescendant(startIndex + 1);
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Handle Shift+Tab key - outdent the list item and cascade to descendants
|
|
260
|
+
*/
|
|
261
|
+
export const handleOutdent = async(
|
|
262
|
+
context: KeyboardContext,
|
|
263
|
+
depthValidator?: ListDepthValidator
|
|
264
|
+
): Promise<void> => {
|
|
228
265
|
const { api, blockId, data, syncContentFromDOM, getDepth } = context;
|
|
229
266
|
|
|
230
267
|
const currentDepth = getDepth();
|
|
@@ -245,6 +282,11 @@ export const handleOutdent = async(context: KeyboardContext): Promise<void> => {
|
|
|
245
282
|
depth: newDepth,
|
|
246
283
|
});
|
|
247
284
|
|
|
285
|
+
// Cascade depth reduction to descendant list items
|
|
286
|
+
if (depthValidator) {
|
|
287
|
+
await cascadeDepthReduction(api, blockId, currentDepth, depthValidator);
|
|
288
|
+
}
|
|
289
|
+
|
|
248
290
|
// Restore focus to the updated block after DOM has been updated
|
|
249
291
|
setCaretToBlockContent(api, updatedBlock);
|
|
250
292
|
};
|
|
@@ -16,6 +16,7 @@ export interface RenderContext {
|
|
|
16
16
|
placeholder: string;
|
|
17
17
|
itemColor: string | undefined;
|
|
18
18
|
itemSize: string | undefined;
|
|
19
|
+
markerDepth?: number;
|
|
19
20
|
setupItemPlaceholder: (element: HTMLElement) => void;
|
|
20
21
|
onCheckboxChange: (checked: boolean, content: HTMLElement | null) => void;
|
|
21
22
|
keydownHandler: ((event: KeyboardEvent) => void) | undefined;
|
|
@@ -25,7 +26,7 @@ export interface RenderContext {
|
|
|
25
26
|
* Render the list item
|
|
26
27
|
*/
|
|
27
28
|
export const renderListItem = (context: RenderContext): HTMLElement => {
|
|
28
|
-
const { data, readOnly, placeholder, itemColor, itemSize, setupItemPlaceholder, onCheckboxChange, keydownHandler } = context;
|
|
29
|
+
const { data, readOnly, placeholder, itemColor, itemSize, markerDepth, setupItemPlaceholder, onCheckboxChange, keydownHandler } = context;
|
|
29
30
|
|
|
30
31
|
const result = buildListItem({
|
|
31
32
|
data,
|
|
@@ -33,6 +34,7 @@ export const renderListItem = (context: RenderContext): HTMLElement => {
|
|
|
33
34
|
placeholder,
|
|
34
35
|
itemColor,
|
|
35
36
|
itemSize,
|
|
37
|
+
markerDepth,
|
|
36
38
|
keydownHandler,
|
|
37
39
|
});
|
|
38
40
|
|
|
@@ -191,6 +191,43 @@ export class ListMarkerCalculator {
|
|
|
191
191
|
return this.findFirstItemIndex(index - 1, targetDepth, remainingCount - 1, targetStyle);
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
+
/**
|
|
195
|
+
* Get the base depth of the contiguous list run containing the block at blockIndex.
|
|
196
|
+
* Walks backward until a non-list block or the start of the editor is reached,
|
|
197
|
+
* then returns the depth of the first list item in that run.
|
|
198
|
+
*
|
|
199
|
+
* @param blockIndex - The block index to look up
|
|
200
|
+
* @returns The depth of the first list item in the run
|
|
201
|
+
*/
|
|
202
|
+
getGroupBaseDepth(blockIndex: number): number {
|
|
203
|
+
const findFirstListIndex = (index: number): number => {
|
|
204
|
+
if (index <= 0) {
|
|
205
|
+
return 0;
|
|
206
|
+
}
|
|
207
|
+
const prevBlock = this.blocks.getBlockByIndex(index - 1);
|
|
208
|
+
if (!prevBlock || prevBlock.name !== TOOL_NAME) {
|
|
209
|
+
return index;
|
|
210
|
+
}
|
|
211
|
+
return findFirstListIndex(index - 1);
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const firstListIndex = findFirstListIndex(blockIndex);
|
|
215
|
+
const firstBlock = this.blocks.getBlockByIndex(firstListIndex);
|
|
216
|
+
return this.getBlockDepth(firstBlock);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Get the visual depth for marker display.
|
|
221
|
+
* Returns the depth relative to the list group's base, clamped to >= 0.
|
|
222
|
+
*
|
|
223
|
+
* @param blockIndex - The block index
|
|
224
|
+
* @param actualDepth - The block's actual depth
|
|
225
|
+
* @returns The visual depth for marker formatting
|
|
226
|
+
*/
|
|
227
|
+
getVisualDepth(blockIndex: number, actualDepth: number): number {
|
|
228
|
+
return Math.max(0, actualDepth - this.getGroupBaseDepth(blockIndex));
|
|
229
|
+
}
|
|
230
|
+
|
|
194
231
|
/**
|
|
195
232
|
* Get the depth of a block by reading from its DOM.
|
|
196
233
|
*/
|
|
@@ -77,7 +77,8 @@ export class OrderedMarkerManager {
|
|
|
77
77
|
: startValue;
|
|
78
78
|
|
|
79
79
|
const actualNumber = actualStartValue + siblingIndex;
|
|
80
|
-
const
|
|
80
|
+
const visualDepth = this.markerCalculator.getVisualDepth(blockIndex, blockDepth);
|
|
81
|
+
const markerText = this.markerCalculator.formatNumber(actualNumber, visualDepth);
|
|
81
82
|
|
|
82
83
|
marker.textContent = markerText;
|
|
83
84
|
}
|
|
@@ -241,7 +242,8 @@ export class OrderedMarkerManager {
|
|
|
241
242
|
: startValue;
|
|
242
243
|
|
|
243
244
|
const actualNumber = actualStartValue + siblingIndex;
|
|
244
|
-
const
|
|
245
|
+
const visualDepth = this.markerCalculator.getVisualDepth(blockIndex, blockDepth);
|
|
246
|
+
const markerText = this.markerCalculator.formatNumber(actualNumber, visualDepth);
|
|
245
247
|
|
|
246
248
|
marker.textContent = markerText;
|
|
247
249
|
}
|
package/src/tools/table/index.ts
CHANGED
|
@@ -234,7 +234,7 @@ export class Table implements BlockTool {
|
|
|
234
234
|
|
|
235
235
|
public static get pasteConfig(): PasteConfig {
|
|
236
236
|
return {
|
|
237
|
-
tags: ['TABLE', 'TR',
|
|
237
|
+
tags: ['TABLE', 'TR', { TH: { style: true } }, { TD: { style: true } }],
|
|
238
238
|
};
|
|
239
239
|
}
|
|
240
240
|
|
|
@@ -260,7 +260,7 @@ export class Table implements BlockTool {
|
|
|
260
260
|
|
|
261
261
|
return style.length > 0 ? { style: true } : {};
|
|
262
262
|
},
|
|
263
|
-
a: { href: true },
|
|
263
|
+
a: { href: true, target: '_blank', rel: 'nofollow' },
|
|
264
264
|
input: { type: true, checked: true },
|
|
265
265
|
},
|
|
266
266
|
};
|
|
@@ -185,7 +185,7 @@ const CELL_SANITIZE_CONFIG: SanitizerConfig = {
|
|
|
185
185
|
i: true,
|
|
186
186
|
em: true,
|
|
187
187
|
br: true,
|
|
188
|
-
a: { href: true },
|
|
188
|
+
a: { href: true, target: '_blank', rel: 'nofollow' },
|
|
189
189
|
mark: (node: Element): { [attr: string]: boolean | string } => {
|
|
190
190
|
const el = node as HTMLElement;
|
|
191
191
|
const style = el.style;
|
package/types/api/tools.d.ts
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
import { BlockToolAdapter } from '../tools/adapters/block-tool-adapter';
|
|
2
|
-
import { ToolConstructable, ToolSettings } from '../tools';
|
|
3
|
-
import { ThemeMode } from './theme';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Tools-related configuration that can be passed to a nested Blok instance.
|
|
7
|
-
*/
|
|
8
|
-
export interface ToolsConfig {
|
|
9
|
-
tools: { [toolName: string]: ToolConstructable | ToolSettings } | undefined;
|
|
10
|
-
inlineToolbar?: string[] | boolean;
|
|
11
|
-
tunes?: string[];
|
|
12
|
-
theme?: ThemeMode;
|
|
13
|
-
}
|
|
14
2
|
|
|
15
3
|
/**
|
|
16
4
|
* Describes methods for accessing installed Blok tools
|
|
@@ -20,10 +8,4 @@ export interface Tools {
|
|
|
20
8
|
* Returns all available Block Tools
|
|
21
9
|
*/
|
|
22
10
|
getBlockTools(): BlockToolAdapter[];
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Returns the tools-related configuration of the current editor instance.
|
|
26
|
-
* Useful for creating nested Blok editors with the same tools.
|
|
27
|
-
*/
|
|
28
|
-
getToolsConfig(): ToolsConfig;
|
|
29
11
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BlockToolData } from './block-tool-data';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Code block tool data format.
|
|
5
|
+
*/
|
|
6
|
+
export interface CodeData extends BlockToolData {
|
|
7
|
+
/** Raw code text (not HTML) */
|
|
8
|
+
code: string;
|
|
9
|
+
/** Language identifier, e.g. "javascript", "plain text" */
|
|
10
|
+
language: string;
|
|
11
|
+
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import type { DatabaseAdapter, PropertyDefinition, DatabaseRow, DatabaseViewConfig } from './types';
|
|
2
|
-
|
|
3
|
-
const UPDATE_DEBOUNCE_MS = 500;
|
|
4
|
-
|
|
5
|
-
export class DatabaseBackendSync {
|
|
6
|
-
private readonly adapter: DatabaseAdapter | undefined;
|
|
7
|
-
private readonly onError: ((error: unknown) => void) | undefined;
|
|
8
|
-
private readonly pendingTimers = new Map<string, ReturnType<typeof setTimeout>>();
|
|
9
|
-
private readonly pendingUpdates = new Map<string, Parameters<DatabaseAdapter['updateRow']>[0]>();
|
|
10
|
-
|
|
11
|
-
constructor(adapter?: DatabaseAdapter, onError?: (error: unknown) => void) {
|
|
12
|
-
this.adapter = adapter;
|
|
13
|
-
this.onError = onError;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
private async safeCall<T>(fn: (adapter: DatabaseAdapter) => Promise<T>): Promise<T | undefined> {
|
|
17
|
-
if (this.adapter === undefined) return undefined;
|
|
18
|
-
try { return await fn(this.adapter); }
|
|
19
|
-
catch (error) { this.onError?.(error); return undefined; }
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// ─── Load ───
|
|
23
|
-
|
|
24
|
-
async syncLoadDatabase(): Promise<{ schema: PropertyDefinition[]; rows: Record<string, DatabaseRow>; views: DatabaseViewConfig[] } | undefined> {
|
|
25
|
-
return this.safeCall((a) => a.loadDatabase());
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// ─── Row operations ───
|
|
29
|
-
|
|
30
|
-
async syncCreateRow(params: Parameters<DatabaseAdapter['createRow']>[0]): Promise<ReturnType<DatabaseAdapter['createRow']> extends Promise<infer R> ? R | undefined : never> {
|
|
31
|
-
return this.safeCall((a) => a.createRow(params));
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
syncUpdateRow(params: Parameters<DatabaseAdapter['updateRow']>[0]): void {
|
|
35
|
-
if (this.adapter === undefined) return;
|
|
36
|
-
const { rowId } = params;
|
|
37
|
-
const existing = this.pendingTimers.get(rowId);
|
|
38
|
-
if (existing !== undefined) clearTimeout(existing);
|
|
39
|
-
this.pendingUpdates.set(rowId, params);
|
|
40
|
-
this.pendingTimers.set(rowId, setTimeout(() => { this.flushRow(rowId); }, UPDATE_DEBOUNCE_MS));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
async syncMoveRow(params: Parameters<DatabaseAdapter['moveRow']>[0]): Promise<ReturnType<DatabaseAdapter['moveRow']> extends Promise<infer R> ? R | undefined : never> {
|
|
44
|
-
this.flushRow(params.rowId);
|
|
45
|
-
|
|
46
|
-
return this.safeCall((a) => a.moveRow(params));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async syncDeleteRow(params: Parameters<DatabaseAdapter['deleteRow']>[0]): Promise<void> {
|
|
50
|
-
await this.safeCall((a) => a.deleteRow(params));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// ─── Property operations ───
|
|
54
|
-
|
|
55
|
-
async syncCreateProperty(params: Parameters<DatabaseAdapter['createProperty']>[0]): Promise<ReturnType<DatabaseAdapter['createProperty']> extends Promise<infer R> ? R | undefined : never> {
|
|
56
|
-
return this.safeCall((a) => a.createProperty(params));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async syncUpdateProperty(params: Parameters<DatabaseAdapter['updateProperty']>[0]): Promise<ReturnType<DatabaseAdapter['updateProperty']> extends Promise<infer R> ? R | undefined : never> {
|
|
60
|
-
return this.safeCall((a) => a.updateProperty(params));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async syncDeleteProperty(params: Parameters<DatabaseAdapter['deleteProperty']>[0]): Promise<void> {
|
|
64
|
-
await this.safeCall((a) => a.deleteProperty(params));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// ─── View operations ───
|
|
68
|
-
|
|
69
|
-
async syncCreateView(params: Parameters<DatabaseAdapter['createView']>[0]): Promise<ReturnType<DatabaseAdapter['createView']> extends Promise<infer R> ? R | undefined : never> {
|
|
70
|
-
return this.safeCall((a) => a.createView(params));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
async syncUpdateView(params: Parameters<DatabaseAdapter['updateView']>[0]): Promise<ReturnType<DatabaseAdapter['updateView']> extends Promise<infer R> ? R | undefined : never> {
|
|
74
|
-
return this.safeCall((a) => a.updateView(params));
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
async syncDeleteView(params: Parameters<DatabaseAdapter['deleteView']>[0]): Promise<void> {
|
|
78
|
-
await this.safeCall((a) => a.deleteView(params));
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// ─── Flush & destroy ───
|
|
82
|
-
|
|
83
|
-
flushPendingUpdates(): void {
|
|
84
|
-
for (const rowId of this.pendingTimers.keys()) { this.flushRow(rowId); }
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
destroy(): void {
|
|
88
|
-
for (const timer of this.pendingTimers.values()) clearTimeout(timer);
|
|
89
|
-
this.pendingTimers.clear();
|
|
90
|
-
this.pendingUpdates.clear();
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
private flushRow(rowId: string): void {
|
|
94
|
-
const timer = this.pendingTimers.get(rowId);
|
|
95
|
-
if (timer !== undefined) clearTimeout(timer);
|
|
96
|
-
this.pendingTimers.delete(rowId);
|
|
97
|
-
const params = this.pendingUpdates.get(rowId);
|
|
98
|
-
this.pendingUpdates.delete(rowId);
|
|
99
|
-
if (params !== undefined) void this.safeCall((a) => a.updateRow(params));
|
|
100
|
-
}
|
|
101
|
-
}
|