@jackuait/blok 0.9.0 → 0.10.0-beta.10
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/codemod/migrate-editorjs-to-blok.js +50 -2
- package/codemod/test.js +39 -6
- package/dist/blok.mjs +3 -3
- package/dist/chunks/_basePickBy-DISiGhsr.mjs +410 -0
- package/dist/chunks/_baseUniq-gAuHRtRF.mjs +1045 -0
- package/dist/chunks/_getTag-Aj56Wgor.mjs +26 -0
- package/dist/chunks/arc-D-pL2Ftf.mjs +80 -0
- package/dist/chunks/architecture-YZFGNWBL-CuqTb_ae.mjs +3 -0
- package/dist/chunks/architectureDiagram-Q4EWVU46-DS7mqjL2.mjs +4066 -0
- package/dist/chunks/array-BsrkCVSZ.mjs +6 -0
- package/dist/chunks/blockDiagram-DXYQGD6D-BTtcn4NG.mjs +3259 -0
- package/dist/chunks/{blok-RJ3hyzDH.mjs → blok-Bg3-zpSu.mjs} +2192 -2156
- package/dist/chunks/c-C6JXJf5K.mjs +5 -0
- package/dist/chunks/c4Diagram-AHTNJAMY-Y4Dcwcoo.mjs +2956 -0
- package/dist/chunks/ccount-C9Y7nqDe.mjs +10 -0
- package/dist/chunks/channel-Cln-eWE0.mjs +5 -0
- package/dist/chunks/chunk-2KRD3SAO-DkM7qh-k.mjs +20 -0
- package/dist/chunks/chunk-336JU56O-B17AtzlK.mjs +49 -0
- package/dist/chunks/chunk-426QAEUC-D6UAVUog.mjs +13 -0
- package/dist/chunks/chunk-4BX2VUAB-CgIkjF7Z.mjs +19 -0
- package/dist/chunks/chunk-4TB4RGXK-BUP4eON3.mjs +3250 -0
- package/dist/chunks/chunk-55IACEB6-zZ-IgaSt.mjs +8 -0
- package/dist/chunks/chunk-5FUZZQ4R-DsZnJYxM.mjs +3786 -0
- package/dist/chunks/chunk-5PVQY5BW-CORl9dnu.mjs +1692 -0
- package/dist/chunks/chunk-67CJDMHE-m0UKdcSH.mjs +20 -0
- package/dist/chunks/chunk-7N4EOEYR-DKNajFZd.mjs +29 -0
- package/dist/chunks/chunk-AA7GKIK3-BeLhNzKa.mjs +24 -0
- package/dist/chunks/chunk-BSJP7CBP-CJExmx8a.mjs +83 -0
- package/dist/chunks/chunk-CIAEETIT-CTikoJ19.mjs +20 -0
- package/dist/chunks/chunk-D6kmoKXy.mjs +20 -0
- package/dist/chunks/chunk-EDXVE4YY-DjInnnwb.mjs +26 -0
- package/dist/chunks/chunk-ENJZ2VHE-CIl5FRDA.mjs +566 -0
- package/dist/chunks/chunk-FMBD7UC4-DjV0W7UE.mjs +5 -0
- package/dist/chunks/chunk-FOC6F5B3-LmHCCWYY.mjs +20 -0
- package/dist/chunks/chunk-ICPOFSXX-BHZIN46A.mjs +3290 -0
- package/dist/chunks/chunk-K5T4RW27-BPZ6fFnW.mjs +16370 -0
- package/dist/chunks/chunk-KGLVRYIC-S1OQdW76.mjs +20 -0
- package/dist/chunks/chunk-LIHQZDEY-CjtyJlI6.mjs +55 -0
- package/dist/chunks/chunk-ORNJ4GCN-CdO0hAge.mjs +25 -0
- package/dist/chunks/chunk-OYMX7WX6-ApX8eV4o.mjs +2038 -0
- package/dist/chunks/chunk-QZHKN3VN-BGFuA6-k.mjs +12 -0
- package/dist/chunks/chunk-U2HBQHQK-B88ZUOTL.mjs +1875 -0
- package/dist/chunks/chunk-X2U36JSP-1VS5TyCr.mjs +68 -0
- package/dist/chunks/chunk-XPW4576I-BMupdrvo.mjs +1146 -0
- package/dist/chunks/chunk-YZCP3GAM-BQ7eEsm2.mjs +60 -0
- package/dist/chunks/chunk-ZZ45TVLE-D1xks9zd.mjs +33 -0
- package/dist/chunks/classDiagram-6PBFFD2Q-C59BZJxp.mjs +30 -0
- package/dist/chunks/classDiagram-v2-HSJHXN6E-7a0qeMsE.mjs +30 -0
- package/dist/chunks/clone-Ckjt1LtE.mjs +8 -0
- package/dist/chunks/{constants-A3iVmQL8.mjs → constants-D7zjGD5W.mjs} +529 -530
- package/dist/chunks/core-Bm6DWt7D.mjs +4501 -0
- package/dist/chunks/cose-bilkent-S5V4N54A-Bpcs2jA_.mjs +2246 -0
- package/dist/chunks/cpp-BdjvAny0.mjs +16 -0
- package/dist/chunks/csharp-YHxeHpeH.mjs +3 -0
- package/dist/chunks/css-DdLevFaX.mjs +3 -0
- package/dist/chunks/cytoscape.esm-BvD8wo00.mjs +18108 -0
- package/dist/chunks/dagre-CGNbYTKq.mjs +1536 -0
- package/dist/chunks/dagre-KV5264BT-DUD9ikgN.mjs +298 -0
- package/dist/chunks/dart-DrPWqfcC.mjs +3 -0
- package/dist/chunks/default-qigT1Xpq.mjs +4 -0
- package/dist/chunks/defaultLocale-ChuSeAxU.mjs +201 -0
- package/dist/chunks/diagram-5BDNPKRD-CZGfTYEe.mjs +112 -0
- package/dist/chunks/diagram-G4DWMVQ6-CuS0-h95.mjs +546 -0
- package/dist/chunks/diagram-MMDJMWI5-C-AEApYz.mjs +234 -0
- package/dist/chunks/diagram-TYMM5635-CiwAJVMq.mjs +144 -0
- package/dist/chunks/dist-Ctq-pyfb.mjs +59 -0
- package/dist/chunks/dockerfile-C68ALcaN.mjs +3 -0
- package/dist/chunks/engine-javascript-CJpnSvzf.mjs +2373 -0
- package/dist/chunks/erDiagram-SMLLAGMA-DeH5yck2.mjs +1712 -0
- package/dist/chunks/flowDiagram-DWJPFMVM-Cr6dwmQ5.mjs +4175 -0
- package/dist/chunks/ganttDiagram-T4ZO3ILL-K-divBg_.mjs +3083 -0
- package/dist/chunks/gitGraph-7Q5UKJZL-Dl-vQzrq.mjs +3 -0
- package/dist/chunks/gitGraphDiagram-UUTBAWPF-UytPZv72.mjs +792 -0
- package/dist/chunks/go-Fm5N96DN.mjs +3 -0
- package/dist/chunks/graphlib-Cye9EPNq.mjs +223 -0
- package/dist/chunks/graphql-BSnqmqgO.mjs +11 -0
- package/dist/chunks/html-BLNeZvnp.mjs +10 -0
- package/dist/chunks/{i18next-Ch0gVA3V.mjs → i18next-CXx5niYF.mjs} +1 -1
- package/dist/chunks/{i18next-loader-dH3UPF7S.mjs → i18next-loader-CwsYu0n6.mjs} +2 -2
- package/dist/chunks/info-OMHHGYJF-BOejJvJR.mjs +3 -0
- package/dist/chunks/infoDiagram-42DDH7IO-DuYnDbF3.mjs +29 -0
- package/dist/chunks/init-C6T-mugb.mjs +15 -0
- package/dist/chunks/ishikawaDiagram-UXIWVN3A-CHc59dLn.mjs +719 -0
- package/dist/chunks/java-83DWBpzu.mjs +5 -0
- package/dist/chunks/javascript-CBgeF1Xx.mjs +3 -0
- package/dist/chunks/journeyDiagram-VCZTEJTY-CD25C4_n.mjs +885 -0
- package/dist/chunks/json-BI17y-1H.mjs +3 -0
- package/dist/chunks/kanban-definition-6JOO6SKY-CTCT6N_p.mjs +980 -0
- package/dist/chunks/katex-CmTPfM0f.mjs +22026 -0
- package/dist/chunks/kotlin-DjnvsrfO.mjs +3 -0
- package/dist/chunks/latex-24n3TcOR.mjs +5 -0
- package/dist/chunks/{lightweight-i18n-1rbaxIZW.mjs → lightweight-i18n-Cvv8CWh4.mjs} +69 -2
- package/dist/chunks/line-Dct5pMmw.mjs +34 -0
- package/dist/chunks/linear-BRCpMvtr.mjs +289 -0
- package/dist/chunks/lua-DV0fuZWx.mjs +5 -0
- package/dist/chunks/markdown-BqQYT45f.mjs +3 -0
- package/dist/chunks/mdast-util-math-BlK2Zu-1.mjs +151 -0
- package/dist/chunks/mermaid-parser.core-CA3DKkuk.mjs +57 -0
- package/dist/chunks/mermaid-vF0cEnZ0.mjs +3 -0
- package/dist/chunks/mermaid.core-CA8nc1sZ.mjs +989 -0
- package/dist/{messages-DaOnbI6d.mjs → chunks/messages-8IHf7ZP3.mjs} +68 -1
- package/dist/chunks/{messages-C9aKfCro.mjs → messages-A_MkXDlG.mjs} +68 -1
- package/dist/{messages-BLEVLZve.mjs → chunks/messages-B0vPBsWq.mjs} +68 -1
- package/dist/chunks/{messages-C0hQPZmh2.mjs → messages-B2N4fUi72.mjs} +68 -1
- package/dist/{messages-HNAtlVax.mjs → chunks/messages-B4UMuyjT.mjs} +73 -6
- package/dist/chunks/{messages-DRUkmDVZ.mjs → messages-B9kmbUWV.mjs} +68 -1
- package/dist/{messages-Dbsx9m5q2.mjs → chunks/messages-BA8Iv99Y2.mjs} +68 -1
- package/dist/chunks/{messages-Da-SOTFW.mjs → messages-BAsb5CgZ.mjs} +68 -1
- package/dist/{messages-D1P0QGLz2.mjs → chunks/messages-BDZA10kl2.mjs} +68 -1
- package/dist/chunks/{messages-ComLU2T32.mjs → messages-BE6lHKwf.mjs} +68 -1
- package/dist/chunks/{messages-gaxTO-87.mjs → messages-BQYvBqm2.mjs} +68 -1
- package/dist/chunks/{messages-BwKs-9DF.mjs → messages-BSghd0ez.mjs} +68 -1
- package/dist/{messages-BPRR6TMf.mjs → chunks/messages-BUVhHx0q2.mjs} +68 -1
- package/dist/{messages-B7jZvo-m.mjs → chunks/messages-BVjoM7P0.mjs} +68 -1
- package/dist/{messages-C-4z1-Dh.mjs → chunks/messages-BXM80fdr2.mjs} +68 -1
- package/dist/{messages-Bm0nvUuj2.mjs → chunks/messages-BYlSMRkd.mjs} +68 -1
- package/dist/chunks/{messages-DLPrj3Dh.mjs → messages-BYxLFj7y.mjs} +68 -1
- package/dist/{messages-BRcLIBCd2.mjs → chunks/messages-BeFqtIrc2.mjs} +68 -1
- package/dist/{messages-zHkURG6V2.mjs → chunks/messages-Bfnq1xv4.mjs} +68 -1
- package/dist/chunks/{messages-Z762-GLL.mjs → messages-BhzzNkN-.mjs} +68 -1
- package/dist/chunks/{messages-COJ0CbVV2.mjs → messages-BjadX8jR2.mjs} +68 -1
- package/dist/{messages-B2ZwD4n9.mjs → chunks/messages-Bp8qin1R.mjs} +68 -1
- package/dist/chunks/{messages-DdEWnfAR.mjs → messages-Bphq_Bt3.mjs} +71 -4
- package/dist/{messages-CUDbNJG5.mjs → chunks/messages-Bxvi1ebN.mjs} +68 -1
- package/dist/chunks/{messages-B0t2L3bi.mjs → messages-C0HvoMPb.mjs} +68 -1
- package/dist/{messages-D6qfWi6H2.mjs → chunks/messages-C3aX3q0H.mjs} +68 -1
- package/dist/chunks/{messages-v9NkxRcL.mjs → messages-C6Mpiacw.mjs} +68 -1
- package/dist/chunks/{messages-CqZ9vFyx.mjs → messages-C7VGpihw.mjs} +69 -2
- package/dist/chunks/{messages-Yj4Q1_uX2.mjs → messages-CKBhDGI3.mjs} +69 -2
- package/dist/chunks/{messages-DxtnwNPo.mjs → messages-COO5xmcA.mjs} +68 -1
- package/dist/{messages-CZTcgUzd.mjs → chunks/messages-CSJ_zb3a2.mjs} +68 -1
- package/dist/{messages-A8aZS7d_2.mjs → chunks/messages-CSL-6xfb2.mjs} +68 -1
- package/dist/{messages-CxruHsuD2.mjs → chunks/messages-CVdpweyf2.mjs} +69 -2
- package/dist/{messages-D2Mf9z2D.mjs → chunks/messages-Cdf0W9H02.mjs} +68 -1
- package/dist/chunks/{messages-DAbCNake2.mjs → messages-Ck81cQkn2.mjs} +68 -1
- package/dist/chunks/{messages-Dyku8Cut.mjs → messages-Cmf6NhSC.mjs} +68 -1
- package/dist/chunks/{messages-DQ6bFum9.mjs → messages-Cs81Z_Bh.mjs} +68 -1
- package/dist/chunks/{messages-cegxHurd2.mjs → messages-Cu-Wevxs2.mjs} +68 -1
- package/dist/{messages-D2HwpoUE.mjs → chunks/messages-D3zojZ94.mjs} +69 -2
- package/dist/{messages-BfTBVFd9.mjs → chunks/messages-D55HRx5O2.mjs} +68 -1
- package/dist/chunks/{messages-Dl03jd4b2.mjs → messages-D9N2MvQx2.mjs} +68 -1
- package/dist/{messages-DfXh-i9o.mjs → chunks/messages-DG-4DPmP.mjs} +68 -1
- package/dist/chunks/{messages-DmJf9laH2.mjs → messages-DGL1ySqb2.mjs} +68 -1
- package/dist/chunks/{messages-DfU4yvkL.mjs → messages-DJoNVjqP.mjs} +68 -1
- package/dist/{messages-Bsd4ruEY.mjs → chunks/messages-DMVXnAYj.mjs} +70 -3
- package/dist/{messages-3WhPEFd7.mjs → chunks/messages-DOuS1Qge.mjs} +68 -1
- package/dist/chunks/{messages-B1kDfIN82.mjs → messages-DWu1r4gc2.mjs} +68 -1
- package/dist/{messages-Dtih3ffa2.mjs → chunks/messages-DlLXpgWM2.mjs} +68 -1
- package/dist/chunks/{messages-DKNULJpc.mjs → messages-DlonA3wa.mjs} +69 -2
- package/dist/{messages-C5pBfa_W.mjs → chunks/messages-Dr0Ekmbz.mjs} +81 -14
- package/dist/{messages-Du62vI49.mjs → chunks/messages-DzTk8bJ5.mjs} +68 -1
- package/dist/{messages-DNAp0U4l2.mjs → chunks/messages-FWfsxpBz.mjs} +68 -1
- package/dist/{messages-B2YeJw8s2.mjs → chunks/messages-G416eyjY.mjs} +68 -1
- package/dist/chunks/{messages-C5-aaU2b.mjs → messages-Je5YvxiY.mjs} +68 -1
- package/dist/chunks/{messages-DHHZUf_H2.mjs → messages-JyvWu4rf2.mjs} +68 -1
- package/dist/chunks/{messages-D_6vPBzT.mjs → messages-KdawW5Na.mjs} +68 -1
- package/dist/chunks/{messages-DnuhgHG0.mjs → messages-MxpWO1db.mjs} +68 -1
- package/dist/{messages-DT4rHATO2.mjs → chunks/messages-NEqrrYvE2.mjs} +68 -1
- package/dist/chunks/{messages-DeSSxLsh.mjs → messages-RInp1ytX.mjs} +68 -1
- package/dist/{messages-DfEPVRdJ.mjs → chunks/messages-TRUuyiFB.mjs} +68 -1
- package/dist/chunks/{messages--eH7tTJV2.mjs → messages-aZcy0JQq2.mjs} +68 -1
- package/dist/{messages-O6z1uabG.mjs → chunks/messages-iS34FHFB.mjs} +68 -1
- package/dist/{messages-BE0DjTEC.mjs → chunks/messages-ihCjSFJI2.mjs} +68 -1
- package/dist/chunks/{messages-_5Pg5fKy2.mjs → messages-jfVpL9c-2.mjs} +68 -1
- package/dist/chunks/{messages-CaRSYuhO.mjs → messages-p1mbe__S.mjs} +68 -1
- package/dist/chunks/{messages-BGssMBWM2.mjs → messages-rCd0Rrw6.mjs} +69 -2
- package/dist/{messages-COgvIEeW.mjs → chunks/messages-xuqyb6Ff2.mjs} +68 -1
- package/dist/chunks/micromark-extension-math-BbkUb36G.mjs +169 -0
- package/dist/chunks/micromark-factory-space-y4SDWQKm.mjs +36 -0
- package/dist/chunks/mindmap-definition-QFDTVHPH-hNnyBkEP.mjs +1013 -0
- package/dist/chunks/{notifier-Butv4Dvo.mjs → notifier-CuvTt9pe.mjs} +1 -1
- package/dist/chunks/objectWithoutProperties-D0XxKB4n.mjs +23 -0
- package/dist/chunks/one-light-DmNO_Y4X.mjs +4 -0
- package/dist/chunks/ordinal-B-kolV-i.mjs +65 -0
- package/dist/chunks/packet-4T2RLAQJ-B5ZMgwzZ.mjs +3 -0
- package/dist/chunks/path-rIMjg_tH.mjs +85 -0
- package/dist/chunks/php-DmXKyPwJ.mjs +18 -0
- package/dist/chunks/pie-ZZUOXDRM-B9l6y0XJ.mjs +3 -0
- package/dist/chunks/pieDiagram-DEJITSTG-Gw-fsc6U.mjs +179 -0
- package/dist/chunks/python-DfwfY9t5.mjs +3 -0
- package/dist/chunks/quadrantDiagram-34T5L4WZ-CQ5fGYI5.mjs +1960 -0
- package/dist/chunks/r-BD2D7qEW.mjs +5 -0
- package/dist/chunks/radar-PYXPWWZC-D5kYmUaB.mjs +3 -0
- package/dist/chunks/requirementDiagram-MS252O5E-DjWKB42c.mjs +2224 -0
- package/dist/chunks/rough.esm-cmMIcj7N.mjs +1353 -0
- package/dist/chunks/ruby-DdOo03Kg.mjs +33 -0
- package/dist/chunks/rust-DEDueB5R.mjs +3 -0
- package/dist/chunks/sankeyDiagram-XADWPNL6-BIN2evSB.mjs +909 -0
- package/dist/chunks/scala-CsjqvxE4.mjs +3 -0
- package/dist/chunks/sequenceDiagram-FGHM5R23-CQz2lMoS.mjs +4181 -0
- package/dist/chunks/shellscript-Bh5zEpnQ.mjs +3 -0
- package/dist/chunks/sql-D9CrOi1i.mjs +3 -0
- package/dist/chunks/src-DVJl6f6s.mjs +2149 -0
- package/dist/chunks/stateDiagram-FHFEXIEX-BIBFsF65.mjs +218 -0
- package/dist/chunks/stateDiagram-v2-QKLJ7IA2-BZUmAVw7.mjs +28 -0
- package/dist/chunks/swift-Dpyt0s2c.mjs +3 -0
- package/dist/chunks/timeline-definition-GMOUNBTQ-CzvQ7Lav.mjs +1084 -0
- package/dist/chunks/{tools-nT6zA9QL.mjs → tools-CrRhWn8L.mjs} +3043 -1303
- package/dist/chunks/treeView-SZITEDCU-BNtnNxpI.mjs +3 -0
- package/dist/chunks/treemap-W4RFUUIX-DYENULz2.mjs +3 -0
- package/dist/chunks/typescript-DO5cd4m8.mjs +5 -0
- package/dist/chunks/vennDiagram-DHZGUBPP-B0DmLQqe.mjs +1876 -0
- package/dist/chunks/vitesse-dark-CcorSKT2.mjs +4 -0
- package/dist/chunks/wardley-RL74JXVD-ByNHVBTb.mjs +3 -0
- package/dist/chunks/wardleyDiagram-NUSXRM2D-CzoKesUw.mjs +594 -0
- package/dist/chunks/xml-g8kXXALs.mjs +5 -0
- package/dist/chunks/xychartDiagram-5P7HB3ND-CixwR8r2.mjs +2017 -0
- package/dist/chunks/yaml-CrNNZyLb.mjs +3 -0
- package/dist/cli.mjs +1 -1
- package/dist/full.mjs +14 -14
- package/dist/locales.mjs +135 -68
- package/dist/markdown.mjs +3954 -0
- package/dist/{messages-D_CUdqU12.mjs → messages-5jvKxQNu2.mjs} +68 -1
- package/dist/{chunks/messages-CFfpHyTU.mjs → messages-7QD-X6XT2.mjs} +68 -1
- package/dist/{messages-CdX1odk_2.mjs → messages-96iaAUds2.mjs} +68 -1
- package/dist/{messages-C8ca-jEa.mjs → messages-B19o-Teb.mjs} +69 -2
- package/dist/{messages-I03yFhup.mjs → messages-B1ZUQagA.mjs} +68 -1
- package/dist/{chunks/messages-BSw88lIo2.mjs → messages-B7ieAJBd2.mjs} +68 -1
- package/dist/{messages-sNSXCkeB.mjs → messages-BECMxmfX.mjs} +68 -1
- package/dist/{messages-DgGZsxBB.mjs → messages-BIHc0KHY.mjs} +68 -1
- package/dist/{messages-yZj20Fvf.mjs → messages-BIoeoik5.mjs} +68 -1
- package/dist/{chunks/messages-D8JFu42v.mjs → messages-BJeGJksD.mjs} +68 -1
- package/dist/{messages-BSLErTnW2.mjs → messages-BRZX964b2.mjs} +68 -1
- package/dist/{chunks/messages-BW8arxf72.mjs → messages-BTQPpoM42.mjs} +68 -1
- package/dist/{messages-C52AiyVV.mjs → messages-BYNcD6uR.mjs} +68 -1
- package/dist/{messages-BxJv0qBn2.mjs → messages-BYmmMDrN2.mjs} +68 -1
- package/dist/{messages-CoCy2JIP.mjs → messages-BbYq1pk-.mjs} +68 -1
- package/dist/{messages-Cnz_SHE32.mjs → messages-BiUGXvYr2.mjs} +68 -1
- package/dist/{chunks/messages-Dl6SVT1Z.mjs → messages-BiiongNz2.mjs} +68 -1
- package/dist/{chunks/messages-C912bk5I.mjs → messages-Bm0Feca1.mjs} +69 -2
- package/dist/{chunks/messages-CTuCPqpJ.mjs → messages-BmAn22OX.mjs} +68 -1
- package/dist/{messages-DdiPWkV8.mjs → messages-Bq3F2Tp_.mjs} +68 -1
- package/dist/{chunks/messages-DJxXZi1D2.mjs → messages-BsycN_JI2.mjs} +68 -1
- package/dist/{chunks/messages-OdEuBvgf.mjs → messages-BwHs4cm1.mjs} +70 -3
- package/dist/{chunks/messages-C4ZAJzBh.mjs → messages-CJTy6JZt.mjs} +68 -1
- package/dist/{chunks/messages-D2OZ9dbO.mjs → messages-CR_L_UtK.mjs} +68 -1
- package/dist/{messages-ypuLZyw12.mjs → messages-CSUHBs4c2.mjs} +68 -1
- package/dist/{chunks/messages-BkES2MDr2.mjs → messages-CWIXvnDf2.mjs} +68 -1
- package/dist/{messages-Cpeko5kB.mjs → messages-CcF4y-E4.mjs} +68 -1
- package/dist/{messages-BmnC-s4X.mjs → messages-Ce6KVEbT.mjs} +68 -1
- package/dist/{messages-DTNfG4ZH.mjs → messages-Ci0KqX-J.mjs} +71 -4
- package/dist/{chunks/messages-CGh56r-H2.mjs → messages-CjbnogEC.mjs} +68 -1
- package/dist/{messages-B3jq5Hpa.mjs → messages-CmB406HW.mjs} +69 -2
- package/dist/{chunks/messages-BsZz1Hnn2.mjs → messages-CqXtJTpU.mjs} +68 -1
- package/dist/{messages-DL000FUf2.mjs → messages-D0aw5_0k2.mjs} +68 -1
- package/dist/{chunks/messages-Df2RYuup2.mjs → messages-D8FQWulF2.mjs} +68 -1
- package/dist/{messages-CxHn7cs2.mjs → messages-DBiVgUs2.mjs} +68 -1
- package/dist/{chunks/messages-Dsapm4K9.mjs → messages-DIJlIqlQ2.mjs} +68 -1
- package/dist/{chunks/messages-517llQmh.mjs → messages-DLX_iBDJ.mjs} +68 -1
- package/dist/{chunks/messages-BG8Nq35G.mjs → messages-DLlc9QPw.mjs} +68 -1
- package/dist/{messages-cokJPuUp2.mjs → messages-DMr62KiO2.mjs} +68 -1
- package/dist/{chunks/messages-Dkp-Eyu02.mjs → messages-DPA-mMWC2.mjs} +68 -1
- package/dist/{chunks/messages-7uCUVFea.mjs → messages-DTh9a8mR.mjs} +68 -1
- package/dist/{messages-VBFioL2M.mjs → messages-DY4IqlhY.mjs} +68 -1
- package/dist/{chunks/messages-C4X0xP3h.mjs → messages-DYTTu0O12.mjs} +68 -1
- package/dist/{messages-diSPQ2Da2.mjs → messages-DbySKTKt2.mjs} +69 -2
- package/dist/{chunks/messages-BGE43_6M.mjs → messages-Ddnj2iTG2.mjs} +68 -1
- package/dist/{chunks/messages-BtUqUzMG2.mjs → messages-DkLU_rWm.mjs} +68 -1
- package/dist/{messages-DSX2HaeN2.mjs → messages-Dl3Sv6Rq2.mjs} +68 -1
- package/dist/{chunks/messages-BDvpl6Ox.mjs → messages-Dl5Y2-Ia.mjs} +81 -14
- package/dist/{chunks/messages-C7plNvNE2.mjs → messages-DnG0ef8t2.mjs} +69 -2
- package/dist/{chunks/messages-qS8tM3Dk.mjs → messages-DnGJD4TL.mjs} +68 -1
- package/dist/{messages-Ct468oX22.mjs → messages-Dnp9N6RU2.mjs} +68 -1
- package/dist/{chunks/messages-CjIA--kO.mjs → messages-Dvn35ksS.mjs} +68 -1
- package/dist/{messages-BRxNqmJ8.mjs → messages-Dw__BcTj.mjs} +68 -1
- package/dist/{chunks/messages-0zhE8A9X.mjs → messages-Dy-Y_nEI.mjs} +68 -1
- package/dist/{chunks/messages-CCH4OETw2.mjs → messages-E_ZuzGDt.mjs} +68 -1
- package/dist/{chunks/messages-DZzoT0T_.mjs → messages-F2xRoY1w.mjs} +68 -1
- package/dist/{chunks/messages-zGdqNZbH.mjs → messages-Smt4GBbj.mjs} +73 -6
- package/dist/{messages-CvIxHHp92.mjs → messages-aMXpHt5X2.mjs} +68 -1
- package/dist/{messages-C8JVJUp12.mjs → messages-aWZH50vu2.mjs} +68 -1
- package/dist/{messages-Phrqr7a6.mjs → messages-dv19AkyJ.mjs} +68 -1
- package/dist/{chunks/messages-DngM4hda2.mjs → messages-hWwSRF-2.mjs} +68 -1
- package/dist/{messages-DpGo_Da5.mjs → messages-j7o5rT9s.mjs} +68 -1
- package/dist/{messages-C6WJx6Z0.mjs → messages-nUVjeh7K.mjs} +68 -1
- package/dist/{messages-CbVilNPE.mjs → messages-nlhESX9t.mjs} +68 -1
- package/dist/{messages-C6o0FVy02.mjs → messages-rk-A1Wa42.mjs} +69 -2
- package/dist/{messages-D4mCIODv.mjs → messages-xh2eOLvs.mjs} +68 -1
- package/dist/{chunks/messages-Ct9UUOrl2.mjs → messages-ynAe7ewZ.mjs} +68 -1
- package/dist/react.mjs +26 -25
- package/dist/tools.mjs +3 -3
- package/dist/vendor.LICENSE.txt +5404 -80
- package/package.json +16 -1
- package/src/components/blocks.ts +26 -1
- package/src/components/constants/data-attributes.ts +2 -2
- package/src/components/i18n/locales/am/messages.json +68 -1
- package/src/components/i18n/locales/ar/messages.json +68 -1
- package/src/components/i18n/locales/az/messages.json +68 -1
- package/src/components/i18n/locales/bg/messages.json +68 -1
- package/src/components/i18n/locales/bn/messages.json +68 -1
- package/src/components/i18n/locales/bs/messages.json +69 -2
- package/src/components/i18n/locales/cs/messages.json +70 -3
- package/src/components/i18n/locales/da/messages.json +71 -4
- package/src/components/i18n/locales/de/messages.json +73 -6
- package/src/components/i18n/locales/dv/messages.json +68 -1
- package/src/components/i18n/locales/el/messages.json +68 -1
- package/src/components/i18n/locales/en/messages.json +68 -1
- package/src/components/i18n/locales/es/messages.json +68 -1
- package/src/components/i18n/locales/et/messages.json +69 -2
- package/src/components/i18n/locales/fa/messages.json +68 -1
- package/src/components/i18n/locales/fi/messages.json +68 -1
- package/src/components/i18n/locales/fil/messages.json +81 -14
- package/src/components/i18n/locales/fr/messages.json +68 -1
- package/src/components/i18n/locales/gu/messages.json +68 -1
- package/src/components/i18n/locales/he/messages.json +68 -1
- package/src/components/i18n/locales/hi/messages.json +68 -1
- package/src/components/i18n/locales/hr/messages.json +69 -2
- package/src/components/i18n/locales/hu/messages.json +68 -1
- package/src/components/i18n/locales/hy/messages.json +68 -1
- package/src/components/i18n/locales/id/messages.json +68 -1
- package/src/components/i18n/locales/it/messages.json +68 -1
- package/src/components/i18n/locales/ja/messages.json +68 -1
- package/src/components/i18n/locales/ka/messages.json +68 -1
- package/src/components/i18n/locales/km/messages.json +68 -1
- package/src/components/i18n/locales/kn/messages.json +68 -1
- package/src/components/i18n/locales/ko/messages.json +68 -1
- package/src/components/i18n/locales/ku/messages.json +68 -1
- package/src/components/i18n/locales/lo/messages.json +68 -1
- package/src/components/i18n/locales/lt/messages.json +68 -1
- package/src/components/i18n/locales/lv/messages.json +68 -1
- package/src/components/i18n/locales/mk/messages.json +68 -1
- package/src/components/i18n/locales/ml/messages.json +68 -1
- package/src/components/i18n/locales/mn/messages.json +68 -1
- package/src/components/i18n/locales/mr/messages.json +68 -1
- package/src/components/i18n/locales/ms/messages.json +69 -2
- package/src/components/i18n/locales/my/messages.json +68 -1
- package/src/components/i18n/locales/ne/messages.json +68 -1
- package/src/components/i18n/locales/nl/messages.json +68 -1
- package/src/components/i18n/locales/no/messages.json +68 -1
- package/src/components/i18n/locales/pa/messages.json +68 -1
- package/src/components/i18n/locales/pl/messages.json +68 -1
- package/src/components/i18n/locales/ps/messages.json +68 -1
- package/src/components/i18n/locales/pt/messages.json +68 -1
- package/src/components/i18n/locales/ro/messages.json +68 -1
- package/src/components/i18n/locales/ru/messages.json +68 -1
- package/src/components/i18n/locales/sd/messages.json +68 -1
- package/src/components/i18n/locales/si/messages.json +68 -1
- package/src/components/i18n/locales/sk/messages.json +69 -2
- package/src/components/i18n/locales/sl/messages.json +69 -2
- package/src/components/i18n/locales/sq/messages.json +68 -1
- package/src/components/i18n/locales/sr/messages.json +68 -1
- package/src/components/i18n/locales/sv/messages.json +68 -1
- package/src/components/i18n/locales/sw/messages.json +68 -1
- package/src/components/i18n/locales/ta/messages.json +68 -1
- package/src/components/i18n/locales/te/messages.json +68 -1
- package/src/components/i18n/locales/th/messages.json +68 -1
- package/src/components/i18n/locales/tr/messages.json +68 -1
- package/src/components/i18n/locales/ug/messages.json +68 -1
- package/src/components/i18n/locales/uk/messages.json +68 -1
- package/src/components/i18n/locales/ur/messages.json +68 -1
- package/src/components/i18n/locales/vi/messages.json +68 -1
- package/src/components/i18n/locales/yi/messages.json +68 -1
- package/src/components/i18n/locales/zh/messages.json +68 -1
- package/src/components/icons/index.ts +78 -0
- 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/ui.ts +0 -3
- package/src/components/modules/blockEvents/composers/blockSelectionKeys.ts +20 -3
- 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/renderer.ts +17 -0
- package/src/components/modules/ui.ts +1 -13
- package/src/components/ui/toolbox.ts +9 -0
- package/src/components/utils/caret/boundaries.ts +15 -4
- package/src/components/utils/popover/popover-desktop.ts +11 -0
- 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/stories/EditorModes.stories.ts +0 -60
- package/src/styles/main.css +57 -2
- package/src/tools/callout/constants.ts +2 -1
- package/src/tools/callout/emoji-picker/index.ts +41 -2
- package/src/tools/callout/index.ts +25 -0
- package/src/tools/code/code-keyboard.ts +142 -0
- package/src/tools/code/constants.ts +96 -0
- package/src/tools/code/dom-builder.ts +181 -0
- package/src/tools/code/highlight-applier.ts +229 -0
- package/src/tools/code/index.ts +462 -0
- package/src/tools/code/katex-loader.ts +50 -0
- package/src/tools/code/language-picker.ts +241 -0
- package/src/tools/code/mermaid-loader.ts +45 -0
- package/src/tools/code/shiki-loader.ts +135 -0
- package/src/tools/divider/index.ts +11 -2
- package/src/tools/header/index.ts +2 -0
- package/src/tools/index.ts +6 -0
- 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/list/style-config.ts +3 -0
- package/src/tools/paragraph/index.ts +1 -0
- package/src/tools/quote/index.ts +229 -0
- package/src/tools/table/core/table-commands.ts +16 -0
- package/src/tools/table/core/table-controller.ts +29 -0
- package/src/tools/table/core/table-events.ts +17 -0
- package/src/tools/table/index.ts +220 -14
- package/src/tools/table/table-cell-blocks.ts +51 -6
- package/src/tools/table/table-cell-clipboard.ts +7 -2
- package/src/tools/table/table-cell-placement-picker.ts +133 -0
- package/src/tools/table/table-cell-selection.ts +174 -19
- package/src/tools/table/table-core.ts +321 -113
- package/src/tools/table/table-map.ts +279 -0
- package/src/tools/table/table-model.ts +901 -1
- package/src/tools/table/table-operations.ts +87 -44
- package/src/tools/table/table-resize.ts +19 -17
- package/src/tools/table/table-row-col-drag.ts +24 -10
- package/src/tools/table/types.ts +24 -2
- package/src/tools/toggle/index.ts +1 -0
- package/types/configs/blok-config.d.ts +7 -0
- package/types/data-attributes.d.ts +0 -1
- package/types/markdown.d.ts +2 -0
- package/types/tools/callout.d.ts +16 -0
- package/types/tools/code.d.ts +13 -0
- package/types/tools/quote.d.ts +13 -0
- package/types/tools/tool-settings.d.ts +7 -0
- package/types/tools-entry.d.ts +7 -0
- /package/dist/chunks/{am-CHDDMHkd.mjs → am-BxlkYGsI.mjs} +0 -0
- /package/dist/chunks/{ar-DoqfNqut.mjs → ar-9vlpr9V8.mjs} +0 -0
- /package/dist/chunks/{az-C34P9iEa.mjs → az-ON63W_FP.mjs} +0 -0
- /package/dist/chunks/{bg-jroXLY8Y.mjs → bg-CtXWTP5w.mjs} +0 -0
- /package/dist/chunks/{bn-BRI-WqxY.mjs → bn-BERvhXM4.mjs} +0 -0
- /package/dist/chunks/{bs-CCGUpNHu.mjs → bs-CBg8NVPG.mjs} +0 -0
- /package/dist/chunks/{cs-D5qZOGuc.mjs → cs-DeQddxS7.mjs} +0 -0
- /package/dist/chunks/{da-DrJ7W37K.mjs → da-DyTo-ec_.mjs} +0 -0
- /package/dist/chunks/{de-BW6-kp2c.mjs → de-Cu7545m1.mjs} +0 -0
- /package/dist/chunks/{el-C-Vc_Otu.mjs → el-oiubLRBq.mjs} +0 -0
- /package/dist/chunks/{es-B6fI5K9i.mjs → es-DZUC6Klv.mjs} +0 -0
- /package/dist/chunks/{et-BhVlZ-Yz.mjs → et-CDeklAog.mjs} +0 -0
- /package/dist/chunks/{fa-D55Ijdqa.mjs → fa-Cafp7_Li.mjs} +0 -0
- /package/dist/chunks/{fi-jNLjhKUQ.mjs → fi-BD_V_aVW.mjs} +0 -0
- /package/dist/chunks/{fil-DYd0T5aX.mjs → fil-Crsfbtx4.mjs} +0 -0
- /package/dist/chunks/{fr-yxy5xWw_.mjs → fr-BGGc04Zv.mjs} +0 -0
- /package/dist/chunks/{gu-CcY_LJe7.mjs → gu-Vg_BgCTp.mjs} +0 -0
- /package/dist/chunks/{he-DL9s7wNw.mjs → he-DTY9chlZ.mjs} +0 -0
- /package/dist/chunks/{hi-C8eGXgw5.mjs → hi-DChMXk0x.mjs} +0 -0
- /package/dist/chunks/{hr-DLpybOhU.mjs → hr-BWVgNU8k.mjs} +0 -0
- /package/dist/chunks/{hu-BkT0gT00.mjs → hu-B37awHXA.mjs} +0 -0
- /package/dist/chunks/{hy-CVFDCp2S.mjs → hy-DGC_GDHh.mjs} +0 -0
- /package/dist/chunks/{id-0P4W9Az0.mjs → id-V7cw6La2.mjs} +0 -0
- /package/dist/chunks/{it-mLY6_uoW.mjs → it-DrTGP8Rn.mjs} +0 -0
- /package/dist/chunks/{ja-7RkeRNWG.mjs → ja-DS4pbJEG.mjs} +0 -0
- /package/dist/chunks/{ka-C7Lx-Qsh.mjs → ka-BueyosRh.mjs} +0 -0
- /package/dist/chunks/{km-Q8udaraH.mjs → km-B0K891yW.mjs} +0 -0
- /package/dist/chunks/{kn-BiETM-iq.mjs → kn-BQ__skg8.mjs} +0 -0
- /package/dist/chunks/{ko-tiB80pF1.mjs → ko-BuPxi_7e.mjs} +0 -0
- /package/dist/chunks/{ku-CY-OABkR.mjs → ku-nQjwPRw2.mjs} +0 -0
- /package/dist/chunks/{lo-CTBhEnyk.mjs → lo-K5NVFoq1.mjs} +0 -0
- /package/dist/chunks/{lt-BHKHEtqK.mjs → lt-D3xD6Eb2.mjs} +0 -0
- /package/dist/chunks/{lv-DWxgtfUg.mjs → lv-DH13mzZj.mjs} +0 -0
- /package/dist/chunks/{mk-BjookGdx.mjs → mk-Bb48BcDA.mjs} +0 -0
- /package/dist/chunks/{ml-L-NnZcp9.mjs → ml-BHPEj1kD.mjs} +0 -0
- /package/dist/chunks/{mn-OMWi7Hl_.mjs → mn-BNGzpdI6.mjs} +0 -0
- /package/dist/chunks/{mr-B6JPzITo.mjs → mr-D5PgU-cH.mjs} +0 -0
- /package/dist/chunks/{ms-CG3S-sPB.mjs → ms-DPkxqKz5.mjs} +0 -0
- /package/dist/chunks/{my-BLAmGfhT.mjs → my-DZGcyfxy.mjs} +0 -0
- /package/dist/chunks/{native-BPcABu9z.mjs → native-D0cfLXsM.mjs} +0 -0
- /package/dist/chunks/{ne-D1JHLfYw.mjs → ne-BU_Wh4Wv.mjs} +0 -0
- /package/dist/chunks/{nl-Ca7Q8FnY.mjs → nl-DtAPk1mK.mjs} +0 -0
- /package/dist/chunks/{no-Coxcohcz.mjs → no-CdW3n3BY.mjs} +0 -0
- /package/dist/chunks/{objectSpread2-CyPxu8-u.mjs → objectSpread2-CWwMYL_U.mjs} +0 -0
- /package/dist/chunks/{pa-CCaXqpaI.mjs → pa-BacCHz87.mjs} +0 -0
- /package/dist/chunks/{pl-Cl_fAZ84.mjs → pl-8zBJbmhZ.mjs} +0 -0
- /package/dist/chunks/{ps-WD5qGAWy.mjs → ps-c6nGXD-W.mjs} +0 -0
- /package/dist/chunks/{pt-C4zvLfvq.mjs → pt-B5yR8Qhr.mjs} +0 -0
- /package/dist/chunks/{ro-DbefHcmM.mjs → ro-Nscylsqb.mjs} +0 -0
- /package/dist/chunks/{ru-uU1J14jd.mjs → ru-DxERQkVJ.mjs} +0 -0
- /package/dist/chunks/{sd-DKu368Ip.mjs → sd-5z-QY3q9.mjs} +0 -0
- /package/dist/chunks/{si-BsJCiPkZ.mjs → si-DTL0mzrx.mjs} +0 -0
- /package/dist/chunks/{sk-CD-a3SN6.mjs → sk-DrGczTvY.mjs} +0 -0
- /package/dist/chunks/{sl-CXhrPJe_.mjs → sl-D8nJjig4.mjs} +0 -0
- /package/dist/chunks/{sq-CTctCoFQ.mjs → sq-C74Hm3YL.mjs} +0 -0
- /package/dist/chunks/{sr-BZkhBwXj.mjs → sr-DAwB05Gj.mjs} +0 -0
- /package/dist/chunks/{sv-NmRZb_xi.mjs → sv-BkHBsN4y.mjs} +0 -0
- /package/dist/chunks/{sw-Be5ik3H6.mjs → sw-BBQLTq_z.mjs} +0 -0
- /package/dist/chunks/{ta-DsXh6neL.mjs → ta-DRRzdKky.mjs} +0 -0
- /package/dist/chunks/{te-CwpCbM8M.mjs → te-CedXLsKM.mjs} +0 -0
- /package/dist/chunks/{th-CcZ15OLk.mjs → th-DDOlGA0W.mjs} +0 -0
- /package/dist/chunks/{tr-q3bTgvhW.mjs → tr-ClgvwOlL.mjs} +0 -0
- /package/dist/chunks/{tw-DmW6-pCY.mjs → tw-CqxBf-1Y.mjs} +0 -0
- /package/dist/chunks/{ug-919EhLsL.mjs → ug-bXxwiinM.mjs} +0 -0
- /package/dist/chunks/{uk-aNMEzd0Y.mjs → uk-Dp46o_VT.mjs} +0 -0
- /package/dist/chunks/{ur-BwQI77sh.mjs → ur-MfEEhdFq.mjs} +0 -0
- /package/dist/chunks/{vi-Dxq806-F.mjs → vi-bt-3LPGO.mjs} +0 -0
- /package/dist/chunks/{zh-BcHuy1Ti.mjs → zh-Dgyb5Ly8.mjs} +0 -0
package/src/tools/table/index.ts
CHANGED
|
@@ -25,9 +25,10 @@ import {
|
|
|
25
25
|
} from './table-cell-clipboard';
|
|
26
26
|
import type { CellColorMode } from './table-cell-color-picker';
|
|
27
27
|
import { TableCellSelection } from './table-cell-selection';
|
|
28
|
-
import { TableGrid, ROW_ATTR, CELL_ATTR } from './table-core';
|
|
28
|
+
import { TableGrid, ROW_ATTR, CELL_ATTR, CELL_ROW_ATTR, CELL_COL_ATTR } from './table-core';
|
|
29
29
|
import {
|
|
30
30
|
applyCellColors,
|
|
31
|
+
applyCellPlacements,
|
|
31
32
|
applyPixelWidths,
|
|
32
33
|
computeHalfAvgWidth,
|
|
33
34
|
computeInitialColWidth,
|
|
@@ -54,7 +55,8 @@ import { TableRowColControls } from './table-row-col-controls';
|
|
|
54
55
|
import type { RowColAction } from './table-row-col-controls';
|
|
55
56
|
import { registerAdditionalRestrictedTools } from './table-restrictions';
|
|
56
57
|
import { TableScrollHaze } from './table-scroll-haze';
|
|
57
|
-
import type { ClipboardBlockData, LegacyCellContent, TableCellsClipboard, TableData, TableConfig } from './types';
|
|
58
|
+
import type { CellPlacement, ClipboardBlockData, LegacyCellContent, TableCellsClipboard, TableData, TableConfig } from './types';
|
|
59
|
+
import { isCellWithBlocks } from './types';
|
|
58
60
|
|
|
59
61
|
const DEFAULT_ROWS = 3;
|
|
60
62
|
const DEFAULT_COLS = 3;
|
|
@@ -200,6 +202,120 @@ export class Table implements BlockTool {
|
|
|
200
202
|
this.scrollHaze = null;
|
|
201
203
|
}
|
|
202
204
|
|
|
205
|
+
/**
|
|
206
|
+
* Rebuild the <tbody> from the current model state.
|
|
207
|
+
* Generates a new table via createGridFromModel (with correct colspan/rowspan),
|
|
208
|
+
* transplants existing block holders into the new cells, and swaps the tbody.
|
|
209
|
+
*/
|
|
210
|
+
private rebuildTableBody(): void {
|
|
211
|
+
const gridEl = this.gridElement;
|
|
212
|
+
|
|
213
|
+
if (!gridEl) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const oldTbody = gridEl.querySelector('tbody');
|
|
218
|
+
|
|
219
|
+
if (!oldTbody) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Collect all existing block holders by ID before replacing tbody
|
|
224
|
+
const blockHolders = new Map<string, HTMLElement>();
|
|
225
|
+
|
|
226
|
+
oldTbody.querySelectorAll('[data-blok-id]').forEach(el => {
|
|
227
|
+
const id = el.getAttribute('data-blok-id');
|
|
228
|
+
|
|
229
|
+
if (id) {
|
|
230
|
+
blockHolders.set(id, el as HTMLElement);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
// Build new table from model (has correct colspan/rowspan structure)
|
|
235
|
+
const newTable = this.grid.createGridFromModel(this.model);
|
|
236
|
+
const newTbody = newTable.querySelector('tbody');
|
|
237
|
+
|
|
238
|
+
if (!newTbody) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Move block holders from old cells to new cells
|
|
243
|
+
const content = this.model.snapshot().content;
|
|
244
|
+
|
|
245
|
+
this.mountBlockHoldersInNewTbody(content, newTbody, blockHolders);
|
|
246
|
+
|
|
247
|
+
// Replace old tbody with new
|
|
248
|
+
oldTbody.replaceWith(newTbody);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Mount block holders into the new tbody cells based on model content.
|
|
253
|
+
* Extracted to keep rebuildTableBody under nesting depth limit.
|
|
254
|
+
*/
|
|
255
|
+
private mountBlockHoldersInNewTbody(
|
|
256
|
+
content: TableData['content'],
|
|
257
|
+
newTbody: Element,
|
|
258
|
+
blockHolders: Map<string, HTMLElement>
|
|
259
|
+
): void {
|
|
260
|
+
content.forEach((rowData, r) => {
|
|
261
|
+
rowData.forEach((cellContent, c) => {
|
|
262
|
+
if (typeof cellContent === 'string') {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (cellContent.mergedInto) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const newCell = newTbody.querySelector(
|
|
271
|
+
`[${CELL_ROW_ATTR}="${r}"][${CELL_COL_ATTR}="${c}"]`
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
if (!newCell) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const container = newCell.querySelector(`[${CELL_BLOCKS_ATTR}]`);
|
|
279
|
+
|
|
280
|
+
if (!container) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
cellContent.blocks.forEach(blockId => {
|
|
285
|
+
const holder = blockHolders.get(blockId);
|
|
286
|
+
|
|
287
|
+
if (holder) {
|
|
288
|
+
container.appendChild(holder);
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Check if the model's content contains any merged cells.
|
|
297
|
+
*/
|
|
298
|
+
private modelHasMerges(): boolean {
|
|
299
|
+
const snapshot = this.model.snapshot();
|
|
300
|
+
|
|
301
|
+
return snapshot.content.some(row =>
|
|
302
|
+
row.some(cell =>
|
|
303
|
+
typeof cell !== 'string' && ((cell.colspan ?? 1) > 1 || (cell.rowspan ?? 1) > 1)
|
|
304
|
+
)
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Create a flat grid (no merge handling) using createGrid.
|
|
310
|
+
* Extracted from render() to keep it readable.
|
|
311
|
+
*/
|
|
312
|
+
private createFlatGrid(): HTMLTableElement {
|
|
313
|
+
const rows = this.initialContent?.length || this.config.rows || DEFAULT_ROWS;
|
|
314
|
+
const cols = this.initialContent?.reduce((max, row) => Math.max(max, row?.length ?? 0), 0) || this.config.cols || DEFAULT_COLS;
|
|
315
|
+
|
|
316
|
+
return this.grid.createGrid(rows, cols, this.model.colWidths);
|
|
317
|
+
}
|
|
318
|
+
|
|
203
319
|
/**
|
|
204
320
|
* Initialize all visual subsystems on a grid element.
|
|
205
321
|
* Shared by rendered(), setData(), and onPaste() to ensure consistent
|
|
@@ -220,6 +336,7 @@ export class Table implements BlockTool {
|
|
|
220
336
|
title: 'Table',
|
|
221
337
|
titleKey: 'tools.table.title',
|
|
222
338
|
searchTerms: ['table', 'grid', 'spreadsheet'],
|
|
339
|
+
searchTermKeys: ['table', 'grid', 'spreadsheet'],
|
|
223
340
|
};
|
|
224
341
|
}
|
|
225
342
|
|
|
@@ -233,7 +350,7 @@ export class Table implements BlockTool {
|
|
|
233
350
|
|
|
234
351
|
public static get pasteConfig(): PasteConfig {
|
|
235
352
|
return {
|
|
236
|
-
tags: ['TABLE', 'TR',
|
|
353
|
+
tags: ['TABLE', 'TR', { TH: { style: true } }, { TD: { style: true } }],
|
|
237
354
|
};
|
|
238
355
|
}
|
|
239
356
|
|
|
@@ -259,7 +376,7 @@ export class Table implements BlockTool {
|
|
|
259
376
|
|
|
260
377
|
return style.length > 0 ? { style: true } : {};
|
|
261
378
|
},
|
|
262
|
-
a: { href: true },
|
|
379
|
+
a: { href: true, target: '_blank', rel: 'nofollow' },
|
|
263
380
|
input: { type: true, checked: true },
|
|
264
381
|
},
|
|
265
382
|
};
|
|
@@ -308,12 +425,14 @@ export class Table implements BlockTool {
|
|
|
308
425
|
|
|
309
426
|
this.isNewTable = (this.initialContent?.length ?? 0) === 0;
|
|
310
427
|
|
|
311
|
-
const
|
|
312
|
-
const
|
|
428
|
+
const hasContent = (this.initialContent?.length ?? 0) > 0;
|
|
429
|
+
const hasMerges = hasContent && this.modelHasMerges();
|
|
313
430
|
|
|
314
|
-
const gridEl =
|
|
431
|
+
const gridEl = hasMerges
|
|
432
|
+
? this.grid.createGridFromModel(this.model)
|
|
433
|
+
: this.createFlatGrid();
|
|
315
434
|
|
|
316
|
-
if (
|
|
435
|
+
if (hasContent && !hasMerges) {
|
|
317
436
|
this.grid.fillGrid(gridEl, this.initialContent ?? []);
|
|
318
437
|
}
|
|
319
438
|
|
|
@@ -387,7 +506,9 @@ export class Table implements BlockTool {
|
|
|
387
506
|
|
|
388
507
|
if (this.readOnly) {
|
|
389
508
|
mountCellBlocksReadOnly(gridEl, content, this.api, this.blockId ?? '');
|
|
390
|
-
|
|
509
|
+
const snap = this.model.snapshot();
|
|
510
|
+
applyCellColors(gridEl, snap.content);
|
|
511
|
+
applyCellPlacements(gridEl, snap.content);
|
|
391
512
|
this.initScrollHaze();
|
|
392
513
|
|
|
393
514
|
return;
|
|
@@ -429,7 +550,9 @@ export class Table implements BlockTool {
|
|
|
429
550
|
}
|
|
430
551
|
|
|
431
552
|
this.initSubsystems(gridEl);
|
|
432
|
-
|
|
553
|
+
const snapInit = this.model.snapshot();
|
|
554
|
+
applyCellColors(gridEl, snapInit.content);
|
|
555
|
+
applyCellPlacements(gridEl, snapInit.content);
|
|
433
556
|
|
|
434
557
|
if (this.isNewTable) {
|
|
435
558
|
this.cellSelection?.selectRange({ minRow: 0, maxRow: 0, minCol: 0, maxCol: 0 });
|
|
@@ -473,7 +596,28 @@ export class Table implements BlockTool {
|
|
|
473
596
|
}
|
|
474
597
|
|
|
475
598
|
public save(_blockContent: HTMLElement): TableData {
|
|
476
|
-
|
|
599
|
+
const data = this.model.snapshot();
|
|
600
|
+
|
|
601
|
+
// Filter out block IDs that don't belong to this table.
|
|
602
|
+
// Corrupted data may contain cross-table references; persisting them
|
|
603
|
+
// causes DOM node stealing and data loss on subsequent renders.
|
|
604
|
+
data.content = data.content.map(row =>
|
|
605
|
+
row.map(cell => {
|
|
606
|
+
if (!isCellWithBlocks(cell)) {
|
|
607
|
+
return cell;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
const filtered = cell.blocks.filter(blockId => {
|
|
611
|
+
const block = this.api.blocks.getById?.(blockId);
|
|
612
|
+
|
|
613
|
+
return !block || block.parentId === this.blockId;
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
return { ...cell, blocks: filtered };
|
|
617
|
+
})
|
|
618
|
+
);
|
|
619
|
+
|
|
620
|
+
return data;
|
|
477
621
|
}
|
|
478
622
|
|
|
479
623
|
public validate(savedData: TableData): boolean {
|
|
@@ -540,7 +684,9 @@ export class Table implements BlockTool {
|
|
|
540
684
|
}
|
|
541
685
|
|
|
542
686
|
if (this.readOnly) {
|
|
543
|
-
|
|
687
|
+
const snapRO = this.model.snapshot();
|
|
688
|
+
applyCellColors(gridEl, snapRO.content);
|
|
689
|
+
applyCellPlacements(gridEl, snapRO.content);
|
|
544
690
|
|
|
545
691
|
return;
|
|
546
692
|
}
|
|
@@ -601,7 +747,9 @@ export class Table implements BlockTool {
|
|
|
601
747
|
this.rowColControls.restoreVisibleGrips(savedGripIndices.col, savedGripIndices.row);
|
|
602
748
|
}
|
|
603
749
|
|
|
604
|
-
|
|
750
|
+
const snapSet = this.model.snapshot();
|
|
751
|
+
applyCellColors(gridEl, snapSet.content);
|
|
752
|
+
applyCellPlacements(gridEl, snapSet.content);
|
|
605
753
|
}
|
|
606
754
|
|
|
607
755
|
public onPaste(event: HTMLPasteEvent): void {
|
|
@@ -694,7 +842,9 @@ export class Table implements BlockTool {
|
|
|
694
842
|
}, true);
|
|
695
843
|
|
|
696
844
|
this.initSubsystems(gridEl);
|
|
697
|
-
|
|
845
|
+
const snapPaste = this.model.snapshot();
|
|
846
|
+
applyCellColors(gridEl, snapPaste.content);
|
|
847
|
+
applyCellPlacements(gridEl, snapPaste.content);
|
|
698
848
|
}
|
|
699
849
|
}
|
|
700
850
|
|
|
@@ -1182,6 +1332,38 @@ export class Table implements BlockTool {
|
|
|
1182
1332
|
});
|
|
1183
1333
|
}
|
|
1184
1334
|
|
|
1335
|
+
private handleCellPlacementChange(cells: HTMLElement[], placement: CellPlacement): void {
|
|
1336
|
+
const gridEl = this.gridElement;
|
|
1337
|
+
|
|
1338
|
+
if (!gridEl) {
|
|
1339
|
+
return;
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
this.runTransactedStructuralOp(() => {
|
|
1343
|
+
for (const cell of cells) {
|
|
1344
|
+
const coord = getCellPosition(gridEl, cell);
|
|
1345
|
+
|
|
1346
|
+
if (!coord) {
|
|
1347
|
+
continue;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
this.model.setCellPlacement(coord.row, coord.col, placement === 'top-left' ? undefined : placement);
|
|
1351
|
+
|
|
1352
|
+
const blocksContainer = cell.querySelector<HTMLElement>(`[${CELL_BLOCKS_ATTR}]`);
|
|
1353
|
+
|
|
1354
|
+
if (!blocksContainer) {
|
|
1355
|
+
continue;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
if (placement === 'top-left') {
|
|
1359
|
+
blocksContainer.removeAttribute('data-blok-cell-placement');
|
|
1360
|
+
} else {
|
|
1361
|
+
blocksContainer.setAttribute('data-blok-cell-placement', placement);
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1185
1367
|
private collectCellBlockData(
|
|
1186
1368
|
cells: HTMLElement[],
|
|
1187
1369
|
): Array<{ row: number; col: number; blocks: ClipboardBlockData[]; color?: string; textColor?: string }> {
|
|
@@ -1332,6 +1514,30 @@ export class Table implements BlockTool {
|
|
|
1332
1514
|
onColorChange: (cells, color, mode) => {
|
|
1333
1515
|
this.handleCellColorChange(cells, color, mode);
|
|
1334
1516
|
},
|
|
1517
|
+
onPlacementChange: (cells, placement) => {
|
|
1518
|
+
this.handleCellPlacementChange(cells, placement);
|
|
1519
|
+
},
|
|
1520
|
+
getCellPlacement: (row, col) => {
|
|
1521
|
+
return this.model.getCellPlacement(row, col);
|
|
1522
|
+
},
|
|
1523
|
+
canMergeCells: (range) => {
|
|
1524
|
+
return this.model.canMergeCells(range);
|
|
1525
|
+
},
|
|
1526
|
+
onMergeCells: (range) => {
|
|
1527
|
+
this.runTransactedStructuralOp(() => {
|
|
1528
|
+
this.model.mergeCells(range);
|
|
1529
|
+
this.rebuildTableBody();
|
|
1530
|
+
});
|
|
1531
|
+
},
|
|
1532
|
+
isMergedCell: (row, col) => {
|
|
1533
|
+
return this.model.isMergedCell(row, col);
|
|
1534
|
+
},
|
|
1535
|
+
onSplitCell: (row, col) => {
|
|
1536
|
+
this.runTransactedStructuralOp(() => {
|
|
1537
|
+
this.model.splitCell(row, col);
|
|
1538
|
+
this.rebuildTableBody();
|
|
1539
|
+
});
|
|
1540
|
+
},
|
|
1335
1541
|
});
|
|
1336
1542
|
}
|
|
1337
1543
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { API } from '../../../types';
|
|
2
2
|
|
|
3
|
-
import { CELL_ATTR, ROW_ATTR } from './table-core';
|
|
3
|
+
import { CELL_ATTR, ROW_ATTR, CELL_COL_ATTR } from './table-core';
|
|
4
4
|
import type { TableModel } from './table-model';
|
|
5
5
|
import type { LegacyCellContent, CellContent } from './types';
|
|
6
6
|
import { isCellWithBlocks } from './types';
|
|
@@ -330,6 +330,12 @@ export class TableCellBlocks {
|
|
|
330
330
|
* Get the number of columns in the table (based on first row)
|
|
331
331
|
*/
|
|
332
332
|
private getColumnCount(): number {
|
|
333
|
+
const colgroup = this.gridElement.querySelector('colgroup');
|
|
334
|
+
|
|
335
|
+
if (colgroup) {
|
|
336
|
+
return colgroup.querySelectorAll('col').length;
|
|
337
|
+
}
|
|
338
|
+
|
|
333
339
|
const firstRow = this.gridElement.querySelector('[data-blok-table-row]');
|
|
334
340
|
|
|
335
341
|
return firstRow?.querySelectorAll('[data-blok-table-cell]').length ?? 0;
|
|
@@ -346,9 +352,7 @@ export class TableCellBlocks {
|
|
|
346
352
|
return null;
|
|
347
353
|
}
|
|
348
354
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
return (cells[col] as HTMLElement | undefined) ?? null;
|
|
355
|
+
return rowEl.querySelector<HTMLElement>(`[${CELL_COL_ATTR}="${col}"]`) ?? null;
|
|
352
356
|
}
|
|
353
357
|
|
|
354
358
|
/**
|
|
@@ -368,11 +372,10 @@ export class TableCellBlocks {
|
|
|
368
372
|
return;
|
|
369
373
|
}
|
|
370
374
|
|
|
371
|
-
const cells = row.querySelectorAll(`[${CELL_ATTR}]`);
|
|
372
375
|
const normalizedRow: CellContent[] = [];
|
|
373
376
|
|
|
374
377
|
rowData.forEach((cellContent, colIndex) => {
|
|
375
|
-
const cell =
|
|
378
|
+
const cell = row.querySelector<HTMLElement>(`[${CELL_COL_ATTR}="${colIndex}"]`);
|
|
376
379
|
|
|
377
380
|
if (!cell) {
|
|
378
381
|
return;
|
|
@@ -470,6 +473,12 @@ export class TableCellBlocks {
|
|
|
470
473
|
continue;
|
|
471
474
|
}
|
|
472
475
|
|
|
476
|
+
// Guard: skip blocks already mounted in another table cell's container.
|
|
477
|
+
// Without this, appendChild would steal the DOM node from the other table.
|
|
478
|
+
if (block.holder.closest(`[${CELL_BLOCKS_ATTR}]`)) {
|
|
479
|
+
continue;
|
|
480
|
+
}
|
|
481
|
+
|
|
473
482
|
container.appendChild(block.holder);
|
|
474
483
|
this.api.blocks.setBlockParent(blockId, this.tableBlockId);
|
|
475
484
|
mountedIds.push(blockId);
|
|
@@ -505,6 +514,12 @@ export class TableCellBlocks {
|
|
|
505
514
|
return;
|
|
506
515
|
}
|
|
507
516
|
|
|
517
|
+
// Guard: skip blocks already mounted in another table cell's container.
|
|
518
|
+
// Without this, insertBefore would steal the DOM node from the other table.
|
|
519
|
+
if (block.holder.closest(`[${CELL_BLOCKS_ATTR}]`)) {
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
|
|
508
523
|
// Insert at the correct DOM position based on the flat array order,
|
|
509
524
|
// so that pressing Enter on a non-last paragraph inserts the new block
|
|
510
525
|
// right after the current one instead of always at the end of the cell.
|
|
@@ -615,6 +630,12 @@ export class TableCellBlocks {
|
|
|
615
630
|
return;
|
|
616
631
|
}
|
|
617
632
|
|
|
633
|
+
if (type === 'block-moved') {
|
|
634
|
+
this.handleBlockMoved(detail);
|
|
635
|
+
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
|
|
618
639
|
if (type !== 'block-added') {
|
|
619
640
|
return;
|
|
620
641
|
}
|
|
@@ -753,6 +774,30 @@ export class TableCellBlocks {
|
|
|
753
774
|
this.schedulePendingCellCheck();
|
|
754
775
|
}
|
|
755
776
|
|
|
777
|
+
/**
|
|
778
|
+
* Handle a block-moved event: if the block left this table (its holder is
|
|
779
|
+
* no longer inside our grid), remove the stale reference from the model.
|
|
780
|
+
*
|
|
781
|
+
* Without this, cross-table moves leave ghost entries in the source table's
|
|
782
|
+
* model, causing the same block ID to appear in two tables' saved data.
|
|
783
|
+
*/
|
|
784
|
+
private handleBlockMoved(detail: { target: { id: string; holder: HTMLElement } }): void {
|
|
785
|
+
const blockId = detail.target.id;
|
|
786
|
+
const cellPos = this.model.findCellForBlock(blockId);
|
|
787
|
+
|
|
788
|
+
if (!cellPos) {
|
|
789
|
+
return;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
// If the holder is still inside our grid, the block was moved within
|
|
793
|
+
// this table — nothing to clean up.
|
|
794
|
+
if (this.gridElement.contains(detail.target.holder)) {
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
this.model.removeBlockFromCell(cellPos.row, cellPos.col, blockId);
|
|
799
|
+
}
|
|
800
|
+
|
|
756
801
|
/**
|
|
757
802
|
* Find the DOM cell's row/col position and add the block to the model.
|
|
758
803
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SanitizerConfig } from '../../../types/configs/sanitizer-config';
|
|
2
|
-
import type { ClipboardBlockData, TableCellsClipboard } from './types';
|
|
2
|
+
import type { CellPlacement, ClipboardBlockData, TableCellsClipboard } from './types';
|
|
3
3
|
import { mapToNearestPresetColor } from '../../components/utils/color-mapping';
|
|
4
4
|
import { clean } from '../../components/utils/sanitizer';
|
|
5
5
|
|
|
@@ -33,6 +33,7 @@ interface CellEntry {
|
|
|
33
33
|
blocks: ClipboardBlockData[];
|
|
34
34
|
color?: string;
|
|
35
35
|
textColor?: string;
|
|
36
|
+
placement?: CellPlacement;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
/**
|
|
@@ -73,6 +74,10 @@ export function serializeCellsToClipboard(entries: CellEntry[]): TableCellsClipb
|
|
|
73
74
|
if (entry.textColor !== undefined) {
|
|
74
75
|
cells[r][c].textColor = entry.textColor;
|
|
75
76
|
}
|
|
77
|
+
|
|
78
|
+
if (entry.placement !== undefined) {
|
|
79
|
+
cells[r][c].placement = entry.placement;
|
|
80
|
+
}
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
return { rows, cols, cells };
|
|
@@ -185,7 +190,7 @@ const CELL_SANITIZE_CONFIG: SanitizerConfig = {
|
|
|
185
190
|
i: true,
|
|
186
191
|
em: true,
|
|
187
192
|
br: true,
|
|
188
|
-
a: { href: true },
|
|
193
|
+
a: { href: true, target: '_blank', rel: 'nofollow' },
|
|
189
194
|
mark: (node: Element): { [attr: string]: boolean | string } => {
|
|
190
195
|
const el = node as HTMLElement;
|
|
191
196
|
const style = el.style;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { I18n } from '../../../types/api';
|
|
2
|
+
import type { CellPlacement } from './types';
|
|
3
|
+
|
|
4
|
+
interface PlacementPickerOptions {
|
|
5
|
+
i18n: I18n;
|
|
6
|
+
currentPlacement: CellPlacement | undefined;
|
|
7
|
+
onPlacementSelect: (placement: CellPlacement) => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface PlacementPickerResult {
|
|
11
|
+
element: HTMLDivElement;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const PLACEMENTS: CellPlacement[] = [
|
|
15
|
+
'top-left', 'top-center', 'top-right',
|
|
16
|
+
'middle-left', 'middle-center', 'middle-right',
|
|
17
|
+
'bottom-left', 'bottom-center', 'bottom-right',
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
const I18N_KEYS: Record<CellPlacement, string> = {
|
|
21
|
+
'top-left': 'tools.table.placementTopLeft',
|
|
22
|
+
'top-center': 'tools.table.placementTopCenter',
|
|
23
|
+
'top-right': 'tools.table.placementTopRight',
|
|
24
|
+
'middle-left': 'tools.table.placementMiddleLeft',
|
|
25
|
+
'middle-center': 'tools.table.placementMiddleCenter',
|
|
26
|
+
'middle-right': 'tools.table.placementMiddleRight',
|
|
27
|
+
'bottom-left': 'tools.table.placementBottomLeft',
|
|
28
|
+
'bottom-center': 'tools.table.placementBottomCenter',
|
|
29
|
+
'bottom-right': 'tools.table.placementBottomRight',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const V_ALIGN: Record<string, string> = {
|
|
33
|
+
top: 'flex-start',
|
|
34
|
+
middle: 'center',
|
|
35
|
+
bottom: 'flex-end',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const H_ALIGN: Record<string, string> = {
|
|
39
|
+
left: 'flex-start',
|
|
40
|
+
center: 'center',
|
|
41
|
+
right: 'flex-end',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const createCellPlacementPicker = (options: PlacementPickerOptions): PlacementPickerResult => {
|
|
45
|
+
const current = options.currentPlacement ?? 'top-left';
|
|
46
|
+
const wrapper = document.createElement('div');
|
|
47
|
+
|
|
48
|
+
wrapper.style.padding = '8px';
|
|
49
|
+
|
|
50
|
+
const grid = document.createElement('div');
|
|
51
|
+
|
|
52
|
+
grid.style.display = 'grid';
|
|
53
|
+
grid.style.gridTemplateColumns = 'repeat(3, 1fr)';
|
|
54
|
+
grid.style.gap = '3px';
|
|
55
|
+
|
|
56
|
+
const label = document.createElement('div');
|
|
57
|
+
|
|
58
|
+
label.style.textAlign = 'center';
|
|
59
|
+
label.style.fontSize = '11px';
|
|
60
|
+
label.style.marginTop = '6px';
|
|
61
|
+
label.style.color = 'var(--blok-text-secondary, #707684)';
|
|
62
|
+
label.textContent = options.i18n.t(I18N_KEYS[current]);
|
|
63
|
+
|
|
64
|
+
for (const placement of PLACEMENTS) {
|
|
65
|
+
const [vKey, hKey] = placement.split('-');
|
|
66
|
+
const cell = document.createElement('div');
|
|
67
|
+
|
|
68
|
+
cell.setAttribute('data-placement', placement);
|
|
69
|
+
cell.style.width = '32px';
|
|
70
|
+
cell.style.height = '26px';
|
|
71
|
+
cell.style.borderRadius = '3px';
|
|
72
|
+
cell.style.display = 'flex';
|
|
73
|
+
cell.style.flexDirection = 'column';
|
|
74
|
+
cell.style.alignItems = H_ALIGN[hKey];
|
|
75
|
+
cell.style.justifyContent = V_ALIGN[vKey];
|
|
76
|
+
cell.style.padding = '3px';
|
|
77
|
+
cell.style.cursor = 'pointer';
|
|
78
|
+
cell.style.gap = '1px';
|
|
79
|
+
|
|
80
|
+
if (placement === current) {
|
|
81
|
+
cell.setAttribute('data-active', 'true');
|
|
82
|
+
cell.style.outline = '2px solid var(--blok-color-primary, #388AE5)';
|
|
83
|
+
cell.style.outlineOffset = '-2px';
|
|
84
|
+
cell.style.backgroundColor = 'var(--blok-item-focus-bg, rgba(35, 131, 226, 0.14))';
|
|
85
|
+
} else {
|
|
86
|
+
cell.style.backgroundColor = 'var(--blok-bg-light, #eff2f5)';
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const line1 = document.createElement('div');
|
|
90
|
+
|
|
91
|
+
line1.style.width = '14px';
|
|
92
|
+
line1.style.height = '2px';
|
|
93
|
+
line1.style.borderRadius = '1px';
|
|
94
|
+
line1.style.backgroundColor = 'currentColor';
|
|
95
|
+
line1.style.opacity = '0.6';
|
|
96
|
+
|
|
97
|
+
const line2 = document.createElement('div');
|
|
98
|
+
|
|
99
|
+
line2.style.width = '9px';
|
|
100
|
+
line2.style.height = '2px';
|
|
101
|
+
line2.style.borderRadius = '1px';
|
|
102
|
+
line2.style.backgroundColor = 'currentColor';
|
|
103
|
+
line2.style.opacity = '0.3';
|
|
104
|
+
|
|
105
|
+
cell.appendChild(line1);
|
|
106
|
+
cell.appendChild(line2);
|
|
107
|
+
|
|
108
|
+
cell.addEventListener('click', () => {
|
|
109
|
+
grid.querySelectorAll('[data-placement]').forEach(el => {
|
|
110
|
+
const element = el as HTMLElement;
|
|
111
|
+
element.removeAttribute('data-active');
|
|
112
|
+
element.style.outline = '';
|
|
113
|
+
element.style.outlineOffset = '';
|
|
114
|
+
element.style.backgroundColor = 'var(--blok-bg-tertiary, #f0f0f0)';
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
cell.setAttribute('data-active', 'true');
|
|
118
|
+
cell.style.outline = '2px solid var(--blok-color-primary, #388AE5)';
|
|
119
|
+
cell.style.outlineOffset = '-2px';
|
|
120
|
+
cell.style.backgroundColor = 'var(--blok-item-focus-bg, rgba(35, 131, 226, 0.14))';
|
|
121
|
+
label.textContent = options.i18n.t(I18N_KEYS[placement]);
|
|
122
|
+
|
|
123
|
+
options.onPlacementSelect(placement);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
grid.appendChild(cell);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
wrapper.appendChild(grid);
|
|
130
|
+
wrapper.appendChild(label);
|
|
131
|
+
|
|
132
|
+
return { element: wrapper };
|
|
133
|
+
};
|