@jackuait/blok 0.13.0 → 0.13.2
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 +7 -2
- package/codemod/test.js +22 -2
- package/dist/blok.cjs +1 -1
- package/dist/blok.iife.js +29 -29
- package/dist/blok.mjs +2 -2
- package/dist/chunks/{blok-Cy7bijNZ.mjs → blok-Du6vYONn.mjs} +2166 -2182
- package/dist/chunks/{blok-DsB9tzWP.cjs → blok-Xu27QC2G.cjs} +13 -13
- package/dist/chunks/constants-DDTVRO2H.cjs +457 -0
- package/dist/chunks/{constants-CnxI96Oy.mjs → constants-DUuYY64n.mjs} +451 -246
- package/dist/chunks/{i18next-loader-BObGIOaH.cjs → i18next-loader-DC1uN-wc.cjs} +1 -1
- package/dist/chunks/{i18next-loader-BrDbxldT.mjs → i18next-loader-GIrBCFrC.mjs} +1 -1
- package/dist/chunks/{lightweight-i18n-Bw9zJMpT.cjs → lightweight-i18n-Bbl1cNYK.cjs} +1 -1
- package/dist/chunks/{lightweight-i18n-CFXiOjGR.mjs → lightweight-i18n-DF9Pupws.mjs} +2 -0
- package/dist/chunks/{messages-DLaesq4h2.cjs → messages-1qYt6EhZ2.cjs} +1 -1
- package/dist/chunks/{messages-BzCMWDCa.cjs → messages-2fxvN3Nb.cjs} +1 -1
- package/dist/chunks/{messages-CloQj-t82.mjs → messages-5AxgjKgf2.mjs} +2 -0
- package/dist/{messages-ByaREXXn.mjs → chunks/messages-AgmrT2Id.mjs} +2 -0
- package/dist/{messages-DV7zSwcU2.mjs → chunks/messages-AtUsRyWK2.mjs} +2 -0
- package/dist/chunks/{messages-23LJg97F.cjs → messages-B1Vs2HmR.cjs} +1 -1
- package/dist/{messages-Bgub7yIr.mjs → chunks/messages-B1k4DgVe.mjs} +4 -2
- package/dist/chunks/{messages-CyNE9mfW.cjs → messages-B1xgsCNQ.cjs} +1 -1
- package/dist/chunks/{messages-CK6NQlei2.mjs → messages-B2zrJyAc2.mjs} +2 -0
- package/dist/chunks/{messages-D9KllT5S.mjs → messages-B5CFhyI8.mjs} +2 -0
- package/dist/chunks/{messages-BFPJInnK.mjs → messages-B6You-RA.mjs} +7 -5
- package/dist/{messages-B8Ps9X7Q.mjs → chunks/messages-B6t1xShv.mjs} +2 -0
- package/dist/chunks/{messages-B5P29HKO2.cjs → messages-B780gS332.cjs} +1 -1
- package/dist/chunks/{messages-BBD0GeAN.mjs → messages-B7KbtBAE.mjs} +5 -3
- package/dist/chunks/{messages-CG1tpK3F.cjs → messages-B7T5Notn.cjs} +1 -1
- package/dist/{messages-DemkV5oa2.mjs → chunks/messages-BA2sVGrR2.mjs} +2 -0
- package/dist/chunks/{messages-B9q8LdZT.cjs → messages-BE9aZQ1Q.cjs} +1 -1
- package/dist/chunks/{messages-CPTia1Ip.cjs → messages-BIQpTYfm.cjs} +1 -1
- package/dist/chunks/{messages-BT-EUB5N.cjs → messages-BIRvUJ0t.cjs} +1 -1
- package/dist/chunks/{messages-BEkcSJKV.cjs → messages-BIodfkjv.cjs} +1 -1
- package/dist/chunks/{messages-_ysQiWQr.cjs → messages-BL-zBcuM.cjs} +1 -1
- package/dist/chunks/{messages-CSZTOxAh.mjs → messages-BNxTGhHu.mjs} +2 -0
- package/dist/chunks/{messages-CzG5xDaO.mjs → messages-BP77P9ER.mjs} +2 -0
- package/dist/chunks/{messages-BEM-ySlb2.cjs → messages-BQr0zpmu2.cjs} +1 -1
- package/dist/chunks/{messages-D4P5aWos2.cjs → messages-BTHi6rVW2.cjs} +1 -1
- package/dist/chunks/{messages-KTUVKXJd.mjs → messages-BVZONUH9.mjs} +3 -1
- package/dist/{messages-BvHpSkAX2.mjs → chunks/messages-BVarbXYD2.mjs} +2 -0
- package/dist/{messages-DiOm0iFp.mjs → chunks/messages-BWGqOZ9J.mjs} +2 -0
- package/dist/{messages-DIBytW9u.mjs → chunks/messages-BZ4d5yNH.mjs} +2 -0
- package/dist/chunks/{messages-WUvriTcu2.cjs → messages-BZOAdcmO2.cjs} +1 -1
- package/dist/chunks/{messages-CN9LNhoS2.mjs → messages-B_U10evN2.mjs} +4 -2
- package/dist/chunks/{messages-DPrZ8Z6d2.cjs → messages-BbsGeVs_2.cjs} +1 -1
- package/dist/chunks/{messages-3_7JWqT0.cjs → messages-Bc1NYJVS.cjs} +1 -1
- package/dist/chunks/{messages-D3EU-LRS.cjs → messages-BdORNG8X.cjs} +1 -1
- package/dist/chunks/{messages-BIOk-aTQ.cjs → messages-Bg2kheTv.cjs} +1 -1
- package/dist/chunks/{messages-DsAkJt8M.cjs → messages-Bj1eQtQw.cjs} +1 -1
- package/dist/chunks/{messages-CD6xvMw1.cjs → messages-BkJJCHNK.cjs} +1 -1
- package/dist/chunks/{messages-BIN5-zeZ.cjs → messages-BkdGQfIX.cjs} +1 -1
- package/dist/chunks/{messages-pKpKbxTh2.cjs → messages-BkgsB-cj2.cjs} +1 -1
- package/dist/{messages-DXCKUB0_.mjs → chunks/messages-BmdkDNYv.mjs} +4 -2
- package/dist/{messages-B66o_tQ42.mjs → chunks/messages-BmiN0JGP2.mjs} +2 -0
- package/dist/chunks/{messages-BG17trOF.cjs → messages-Bn0vGFEP.cjs} +1 -1
- package/dist/{messages-BpJopIVL2.mjs → chunks/messages-BoCUgrkI.mjs} +2 -0
- package/dist/chunks/{messages-B7dSyfsy.cjs → messages-BoIUXwWe.cjs} +1 -1
- package/dist/chunks/{messages-7oeFTHO4.cjs → messages-BpDEh8rW.cjs} +1 -1
- package/dist/{messages-DVSJBYhD.mjs → chunks/messages-BuYnNUtU2.mjs} +3 -1
- package/dist/{messages-D8SUKrMB.mjs → chunks/messages-BvuEffoe.mjs} +4 -2
- package/dist/{messages-DvIwCnTR.mjs → chunks/messages-BvupGuDw2.mjs} +2 -0
- package/dist/chunks/{messages-BZr0xR7X.cjs → messages-BwknPZJ8.cjs} +1 -1
- package/dist/{messages-5s1gGSm4.mjs → chunks/messages-BxKobpJ22.mjs} +2 -0
- package/dist/chunks/{messages-D_OfKMtO2.cjs → messages-ByicRCge2.cjs} +1 -1
- package/dist/{messages-DNDonN-x.mjs → chunks/messages-C03LZxma.mjs} +2 -0
- package/dist/{messages-CqrBLC_P.mjs → chunks/messages-C24IC_eR.mjs} +2 -0
- package/dist/chunks/{messages-CucO-8OV.cjs → messages-C2oBmyTn.cjs} +1 -1
- package/dist/chunks/{messages-CXZtG3Xs2.mjs → messages-C4bHKGnB2.mjs} +4 -2
- package/dist/chunks/{messages-DTceHV5d2.mjs → messages-C4sIqArW2.mjs} +2 -0
- package/dist/chunks/{messages-Ds1jRRkJ2.cjs → messages-C9wBMmxr2.cjs} +1 -1
- package/dist/chunks/{messages-DdMhxYfW.cjs → messages-CDK5-8vW.cjs} +1 -1
- package/dist/chunks/{messages-CP3f0qkN.cjs → messages-CKHbPcfh.cjs} +1 -1
- package/dist/{messages-Dt4Cw2PN2.mjs → chunks/messages-CMRjQYxi2.mjs} +3 -1
- package/dist/chunks/{messages-BJVhJhdz.cjs → messages-CNFfwTfw.cjs} +1 -1
- package/dist/chunks/{messages-C99hDoeM2.cjs → messages-CNiuofck2.cjs} +1 -1
- package/dist/chunks/{messages-CjgjbJ1H2.mjs → messages-COMdnGQV2.mjs} +4 -2
- package/dist/{messages-BfsTqQCr2.mjs → chunks/messages-CQg2_vmm.mjs} +2 -0
- package/dist/{messages-_OjohrXs.mjs → chunks/messages-CTWXEx_o.mjs} +6 -4
- package/dist/{messages-BJBdgowf.mjs → chunks/messages-CWTFEPbA2.mjs} +2 -0
- package/dist/chunks/{messages-l73qDsKl.cjs → messages-CWszAGkF.cjs} +1 -1
- package/dist/chunks/{messages-BGcdiqDM2.cjs → messages-CWzQNagc2.cjs} +1 -1
- package/dist/{messages-CaC0BVP72.mjs → chunks/messages-CXxz5HYQ.mjs} +2 -0
- package/dist/chunks/{messages-BvJTJwoq2.cjs → messages-CYf1gv722.cjs} +1 -1
- package/dist/{messages-DN_N2jK1.mjs → chunks/messages-CcboYTP8.mjs} +2 -0
- package/dist/{messages-DdGG7T30.mjs → chunks/messages-CdWXgq_r.mjs} +2 -0
- package/dist/chunks/{messages-pZC8rTng.cjs → messages-CfcCwbQo.cjs} +1 -1
- package/dist/chunks/{messages-DFJTssY7.cjs → messages-CkvqOnAR.cjs} +1 -1
- package/dist/chunks/{messages-BzbW5tIB2.cjs → messages-Cnrug7nz2.cjs} +1 -1
- package/dist/chunks/{messages-BUp0i-9G.cjs → messages-Cr51zCHy.cjs} +1 -1
- package/dist/chunks/{messages-Cz63p8bt2.cjs → messages-CsLvvl2F2.cjs} +1 -1
- package/dist/chunks/{messages-DrIzpqee.cjs → messages-CuO-Rx4g.cjs} +1 -1
- package/dist/chunks/messages-Cv4I3k1W2.cjs +1 -0
- package/dist/chunks/{messages-BScbCwsN.cjs → messages-CwHRv6g8.cjs} +1 -1
- package/dist/chunks/{messages-EUS1-T0-.mjs → messages-CyCl8la6.mjs} +2 -0
- package/dist/chunks/{messages-DOUT2sT62.cjs → messages-CzXnHfGb2.cjs} +1 -1
- package/dist/chunks/{messages-ndFXaPuJ.cjs → messages-D2QxLx1a.cjs} +1 -1
- package/dist/chunks/{messages-CDLJmxWA.cjs → messages-D4LUPpX_.cjs} +1 -1
- package/dist/{messages-DpQjOxzP.mjs → chunks/messages-D7YPlNAK.mjs} +2 -0
- package/dist/{messages-S0krg7sB.mjs → chunks/messages-DGHTTk1S2.mjs} +3 -1
- package/dist/chunks/{messages-wZhc9mFF2.mjs → messages-DHdoaaFq2.mjs} +6 -4
- package/dist/chunks/{messages-C0BMFvdy.mjs → messages-DI9Ifrgt.mjs} +2 -0
- package/dist/chunks/messages-DJFL-bxd2.cjs +1 -0
- package/dist/chunks/messages-DLEeNpMi2.cjs +1 -0
- package/dist/chunks/{messages-BpI1875E.mjs → messages-DNqFlfOd.mjs} +3 -1
- package/dist/chunks/{messages-mtoLIsYL.cjs → messages-DTNU_cq0.cjs} +1 -1
- package/dist/chunks/{messages-BxXGCWit.cjs → messages-DVKsYqpJ.cjs} +1 -1
- package/dist/chunks/{messages-BJNTs8dY.cjs → messages-DXlfz-nC.cjs} +1 -1
- package/dist/chunks/{messages-DKdgRSvy.cjs → messages-DbA_Zja3.cjs} +1 -1
- package/dist/chunks/{messages-CZ2th1UV2.cjs → messages-Dc2TTEx_2.cjs} +1 -1
- package/dist/chunks/{messages-Bh-GPq0T2.mjs → messages-Dd4nzvLj2.mjs} +2 -0
- package/dist/chunks/{messages-BISkpo37.cjs → messages-DeDMMmRC.cjs} +1 -1
- package/dist/chunks/{messages-C0Fr1grN.mjs → messages-DefZ3ihx.mjs} +2 -0
- package/dist/{messages-DC1fWdjB2.mjs → chunks/messages-DhZwMl9x2.mjs} +2 -0
- package/dist/chunks/{messages-BYT844Pj.mjs → messages-DiGsu5XN.mjs} +6 -4
- package/dist/chunks/{messages-xeJ5eVFo.cjs → messages-DlQNXqzr.cjs} +1 -1
- package/dist/{messages-CZYocA-2.mjs → chunks/messages-DlcI-0Sy.mjs} +2 -0
- package/dist/{messages-ZJE9VNzB2.mjs → chunks/messages-DmErSGPk2.mjs} +2 -0
- package/dist/chunks/{messages-h9Zi_9Gr.cjs → messages-DqMqZLcn.cjs} +1 -1
- package/dist/chunks/{messages-D_w-pjpG2.cjs → messages-DqqDuEE22.cjs} +1 -1
- package/dist/chunks/{messages-DW0CNDiw.mjs → messages-DsyO86r3.mjs} +2 -0
- package/dist/chunks/{messages-DgdjQ2JT.mjs → messages-DzY53I67.mjs} +2 -0
- package/dist/chunks/{messages-PeAC6FL2.cjs → messages-DzppdmWe.cjs} +1 -1
- package/dist/chunks/{messages-CkCgWAJW2.mjs → messages-GHsufIGi2.mjs} +4 -2
- package/dist/chunks/{messages-Diinl7nA2.cjs → messages-HzLF-BQL2.cjs} +1 -1
- package/dist/chunks/{messages-CoWmNHyu2.cjs → messages-Jb9n97oP2.cjs} +1 -1
- package/dist/chunks/{messages-2sqZ51ZE2.cjs → messages-K_vSdSoF2.cjs} +1 -1
- package/dist/{messages-D-K9TXl02.mjs → chunks/messages-LTkIIrSe2.mjs} +6 -4
- package/dist/chunks/{messages-zqNVwsuv.mjs → messages-MPF8o3EP.mjs} +2 -0
- package/dist/chunks/{messages-5HoTbob5.cjs → messages-Nh7wrRdm.cjs} +1 -1
- package/dist/chunks/{messages-B6ALGrrK2.mjs → messages-OSIAf0Wk2.mjs} +5 -3
- package/dist/chunks/{messages-P9sjeERx.mjs → messages-OYoN_rp1.mjs} +4 -2
- package/dist/chunks/messages-QHS-Ydg_.cjs +1 -0
- package/dist/chunks/{messages-DLphNjiM2.cjs → messages-SpiG5vT-2.cjs} +1 -1
- package/dist/chunks/{messages-RumMLtL32.mjs → messages-Uc3Uc2862.mjs} +3 -1
- package/dist/chunks/{messages-BP9zsQtc.mjs → messages-V8K7-1l2.mjs} +2 -0
- package/dist/chunks/{messages-BR1Rd5-u2.cjs → messages-XFaJzdhP2.cjs} +1 -1
- package/dist/{messages-B3GO2TNx2.mjs → chunks/messages-Z9mDYT3w.mjs} +2 -0
- package/dist/chunks/{messages-CEroCDzi.mjs → messages-ZHNvKiIX.mjs} +2 -0
- package/dist/chunks/{messages-C2irZQlh.mjs → messages-bSVgJ1cu.mjs} +3 -1
- package/dist/chunks/{messages-DlNTalkx2.mjs → messages-bjSJwsXK2.mjs} +2 -0
- package/dist/{messages-D_jk0Apm.mjs → chunks/messages-eyGOcbhV.mjs} +2 -0
- package/dist/chunks/{messages-DlvmJJK6.mjs → messages-fSeXd6-z.mjs} +3 -1
- package/dist/{messages-BYooY4mP2.mjs → chunks/messages-l5xHQb_m.mjs} +7 -5
- package/dist/{messages-D_pfhYg5.mjs → chunks/messages-rEsI_fAk.mjs} +5 -3
- package/dist/chunks/{messages-MxqZVywa2.mjs → messages-sqdfYuVj2.mjs} +2 -0
- package/dist/chunks/{messages-C-D80jVE.mjs → messages-vQ5kblO8.mjs} +2 -0
- package/dist/chunks/{messages-BwNXKlvA2.cjs → messages-y03BGg692.cjs} +1 -1
- package/dist/chunks/tools-DOuVjow8.cjs +116 -0
- package/dist/chunks/{tools-1xd7TPfu.mjs → tools-Tt-NXbRZ.mjs} +1816 -1637
- package/dist/full.cjs +1 -1
- package/dist/full.mjs +3 -3
- package/dist/locales.mjs +69 -67
- package/dist/{chunks/messages-CkdgHogc2.mjs → messages-1ufJbdRv2.mjs} +3 -1
- package/dist/{messages-cBA8dKoi.mjs → messages-3j4yi-DF.mjs} +5 -3
- package/dist/{chunks/messages-BGCpxpgG.mjs → messages-5USazVPA2.mjs} +2 -0
- package/dist/{chunks/messages-Cf9wwoye2.mjs → messages-7fwJIrld2.mjs} +2 -0
- package/dist/{messages-hVVP_eZE.mjs → messages-AycxTjmw.mjs} +2 -0
- package/dist/{messages-Bg5tERmS.mjs → messages-B3PWaMcw.mjs} +6 -4
- package/dist/{chunks/messages-Diozu4lJ.mjs → messages-B3oFjWq3.mjs} +4 -2
- package/dist/{chunks/messages-ByJ-nSXK.mjs → messages-B8Tq9Txy.mjs} +2 -0
- package/dist/{messages-CDJP_fbb2.mjs → messages-BDwU9rYR2.mjs} +4 -2
- package/dist/{messages-6ukS6d5Z.mjs → messages-BGzpwNrz.mjs} +2 -0
- package/dist/{chunks/messages-CHXG6lEA2.mjs → messages-BKCuCTFM.mjs} +2 -0
- package/dist/{chunks/messages-aGEPK1g12.mjs → messages-BSHFypGE2.mjs} +2 -0
- package/dist/{chunks/messages-OMGVF8X52.mjs → messages-BcD7xtJA.mjs} +3 -1
- package/dist/{messages-DA2x_UvX2.mjs → messages-Bj03XD-02.mjs} +6 -4
- package/dist/{chunks/messages-C3NrnRWC.mjs → messages-BkTBwYet.mjs} +2 -0
- package/dist/{messages-ZjCwxd3_2.mjs → messages-BmWP4vpV2.mjs} +2 -0
- package/dist/{chunks/messages-DDtwOfXf.mjs → messages-Bt4TLGth.mjs} +2 -0
- package/dist/{chunks/messages-Bly_2YUk.mjs → messages-BtDz-sw92.mjs} +2 -0
- package/dist/{messages-CTcNzaJJ2.mjs → messages-C2TRJroV2.mjs} +2 -0
- package/dist/{messages-CDRUbL17.mjs → messages-C31VIrlL.mjs} +2 -0
- package/dist/{messages-Yg8Y6PlG.mjs → messages-C8RMjnBe.mjs} +2 -0
- package/dist/{chunks/messages-BciKgfP4.mjs → messages-C9GFRcVj.mjs} +6 -4
- package/dist/{chunks/messages-0cSP25RB.mjs → messages-CAGQtm7T.mjs} +5 -3
- package/dist/{messages-_6tu8F-N.mjs → messages-CITYhXUz.mjs} +2 -0
- package/dist/{messages-BbaS2xgR2.mjs → messages-CIjSE2_O2.mjs} +5 -3
- package/dist/{messages-BQ7jJt9m.mjs → messages-CRR1VRO6.mjs} +2 -0
- package/dist/{chunks/messages-Da-9fv3U.mjs → messages-CTzO11jz.mjs} +2 -0
- package/dist/{messages-DaSzBuLF2.mjs → messages-CX8egsiA2.mjs} +2 -0
- package/dist/{messages-DccIq7002.mjs → messages-C_gdsU952.mjs} +4 -2
- package/dist/{messages-CXXQC9Vz.mjs → messages-C_mN4lx0.mjs} +3 -1
- package/dist/{chunks/messages-BI7NfKFe.mjs → messages-CacRpQpm.mjs} +4 -2
- package/dist/{chunks/messages-BCRpttn3.mjs → messages-Cdgz3urh.mjs} +2 -0
- package/dist/{messages-BaC-sNb4.mjs → messages-CgVEHCQ-.mjs} +3 -1
- package/dist/{chunks/messages-D_24p8E62.mjs → messages-CgaGkQi32.mjs} +2 -0
- package/dist/{chunks/messages-D3AyiRbO.mjs → messages-CmN2OfuB.mjs} +2 -0
- package/dist/{chunks/messages-CSierpa_2.mjs → messages-CntTlSE22.mjs} +2 -0
- package/dist/{messages-BK1sXq7X.mjs → messages-Cp0fjsey.mjs} +3 -1
- package/dist/{messages-DHOj5syv2.mjs → messages-Cx7sqvx02.mjs} +2 -0
- package/dist/{messages-CQUbgCd62.mjs → messages-CxX23Jsk2.mjs} +4 -2
- package/dist/{chunks/messages-DTqb7T61.mjs → messages-D-rvoUSJ.mjs} +2 -0
- package/dist/{messages-Bkbhk9kJ2.mjs → messages-D1Fjr4OK2.mjs} +2 -0
- package/dist/{chunks/messages-CSkYL3AP.mjs → messages-D4U4wkYM.mjs} +2 -0
- package/dist/{chunks/messages-DwuvQpsD.mjs → messages-D5qgCWmB2.mjs} +7 -5
- package/dist/{chunks/messages-a_XmI-x5.mjs → messages-D788KtGe.mjs} +2 -0
- package/dist/{chunks/messages-B4-oaYBZ.mjs → messages-DFfhoDWZ2.mjs} +2 -0
- package/dist/{messages-BgcWyc4R.mjs → messages-DKsyrVp5.mjs} +2 -0
- package/dist/{messages-B_Js-HRK.mjs → messages-DL7JAwpC.mjs} +2 -0
- package/dist/{chunks/messages-CSioKJVK2.mjs → messages-DNlrcG5Z.mjs} +2 -0
- package/dist/{chunks/messages-vGRE1OPk2.mjs → messages-DPqFBtJR.mjs} +2 -0
- package/dist/{chunks/messages-BTKAxpmi.mjs → messages-DQik3_xv2.mjs} +2 -0
- package/dist/{messages-BUksRT7Q.mjs → messages-DTkd9ND8.mjs} +7 -5
- package/dist/{messages-Br4tspi_2.mjs → messages-DXCyNanc2.mjs} +2 -0
- package/dist/{chunks/messages-CdJq8h3E.mjs → messages-D_WzyzUt.mjs} +2 -0
- package/dist/{chunks/messages-DC0r7l8x2.mjs → messages-Ddz6eH0-2.mjs} +2 -0
- package/dist/{messages-BqCRuWLo.mjs → messages-DiL61awK.mjs} +2 -0
- package/dist/{chunks/messages-DXaps_uI.mjs → messages-Dq2WEsEu.mjs} +2 -0
- package/dist/{chunks/messages-8qsQ7qZX2.mjs → messages-DqXJJPx9.mjs} +3 -1
- package/dist/{messages-jh3qE8dL.mjs → messages-Duk7VVeY.mjs} +3 -1
- package/dist/{messages-DQHRgl_P.mjs → messages-DzkZ434Z.mjs} +4 -2
- package/dist/{messages-DUdZKtlE.mjs → messages-JKXCsFKZ.mjs} +2 -0
- package/dist/{chunks/messages-C9-UAJuq.mjs → messages-NVepzgE3.mjs} +4 -2
- package/dist/{messages-omcUe0Za.mjs → messages-PQVh93mt.mjs} +2 -0
- package/dist/{chunks/messages-xRQMQj4w2.mjs → messages-ftPYsH6d2.mjs} +6 -4
- package/dist/{chunks/messages-Ddb_L6gp2.mjs → messages-gQ5PFa2t2.mjs} +2 -0
- package/dist/{messages-DzqQWiFx.mjs → messages-oIa8wahx.mjs} +2 -0
- package/dist/{messages-DO62ugjy2.mjs → messages-rpO1POP02.mjs} +3 -1
- package/dist/{messages-63r3O0932.mjs → messages-uy3FE24_2.mjs} +4 -2
- package/dist/react.cjs +1 -1
- package/dist/react.mjs +1 -1
- package/dist/tools.cjs +1 -1
- package/dist/tools.mjs +2 -2
- package/package.json +1 -1
- package/src/blok.ts +2 -0
- package/src/cli/commands/convert-html/block-builder.ts +13 -3
- package/src/components/i18n/locales/am/messages.json +2 -1
- package/src/components/i18n/locales/ar/messages.json +2 -1
- package/src/components/i18n/locales/az/messages.json +3 -2
- package/src/components/i18n/locales/bg/messages.json +2 -1
- package/src/components/i18n/locales/bn/messages.json +2 -1
- package/src/components/i18n/locales/bs/messages.json +6 -5
- package/src/components/i18n/locales/cs/messages.json +4 -3
- package/src/components/i18n/locales/da/messages.json +6 -5
- package/src/components/i18n/locales/de/messages.json +4 -3
- package/src/components/i18n/locales/dv/messages.json +2 -1
- package/src/components/i18n/locales/el/messages.json +2 -1
- package/src/components/i18n/locales/en/messages.json +2 -0
- package/src/components/i18n/locales/es/messages.json +3 -2
- package/src/components/i18n/locales/et/messages.json +3 -2
- package/src/components/i18n/locales/fa/messages.json +2 -1
- package/src/components/i18n/locales/fi/messages.json +3 -2
- package/src/components/i18n/locales/fil/messages.json +7 -6
- package/src/components/i18n/locales/fr/messages.json +4 -3
- package/src/components/i18n/locales/gu/messages.json +2 -1
- package/src/components/i18n/locales/he/messages.json +2 -1
- package/src/components/i18n/locales/hi/messages.json +2 -1
- package/src/components/i18n/locales/hr/messages.json +5 -4
- package/src/components/i18n/locales/hu/messages.json +4 -3
- package/src/components/i18n/locales/hy/messages.json +2 -1
- package/src/components/i18n/locales/id/messages.json +2 -1
- package/src/components/i18n/locales/it/messages.json +5 -4
- package/src/components/i18n/locales/ja/messages.json +2 -1
- package/src/components/i18n/locales/ka/messages.json +2 -1
- package/src/components/i18n/locales/km/messages.json +2 -1
- package/src/components/i18n/locales/kn/messages.json +2 -1
- package/src/components/i18n/locales/ko/messages.json +2 -1
- package/src/components/i18n/locales/ku/messages.json +2 -1
- package/src/components/i18n/locales/lo/messages.json +2 -1
- package/src/components/i18n/locales/lt/messages.json +3 -2
- package/src/components/i18n/locales/lv/messages.json +3 -2
- package/src/components/i18n/locales/mk/messages.json +2 -1
- package/src/components/i18n/locales/ml/messages.json +2 -1
- package/src/components/i18n/locales/mn/messages.json +2 -1
- package/src/components/i18n/locales/mr/messages.json +2 -1
- package/src/components/i18n/locales/ms/messages.json +4 -3
- package/src/components/i18n/locales/my/messages.json +2 -1
- package/src/components/i18n/locales/ne/messages.json +2 -1
- package/src/components/i18n/locales/nl/messages.json +4 -3
- package/src/components/i18n/locales/no/messages.json +4 -3
- package/src/components/i18n/locales/pa/messages.json +2 -1
- package/src/components/i18n/locales/pl/messages.json +4 -3
- package/src/components/i18n/locales/ps/messages.json +2 -1
- package/src/components/i18n/locales/pt/messages.json +6 -5
- package/src/components/i18n/locales/ro/messages.json +3 -2
- package/src/components/i18n/locales/ru/messages.json +2 -1
- package/src/components/i18n/locales/sd/messages.json +2 -1
- package/src/components/i18n/locales/si/messages.json +2 -1
- package/src/components/i18n/locales/sk/messages.json +6 -5
- package/src/components/i18n/locales/sl/messages.json +5 -4
- package/src/components/i18n/locales/sq/messages.json +3 -2
- package/src/components/i18n/locales/sr/messages.json +2 -1
- package/src/components/i18n/locales/sv/messages.json +7 -6
- package/src/components/i18n/locales/sw/messages.json +2 -1
- package/src/components/i18n/locales/ta/messages.json +2 -1
- package/src/components/i18n/locales/te/messages.json +2 -1
- package/src/components/i18n/locales/th/messages.json +2 -1
- package/src/components/i18n/locales/tr/messages.json +2 -1
- package/src/components/i18n/locales/ug/messages.json +2 -1
- package/src/components/i18n/locales/uk/messages.json +2 -1
- package/src/components/i18n/locales/ur/messages.json +2 -1
- package/src/components/i18n/locales/vi/messages.json +2 -1
- package/src/components/i18n/locales/yi/messages.json +2 -1
- package/src/components/i18n/locales/zh/messages.json +2 -1
- package/src/components/icons/index.ts +6 -3
- package/src/components/inline-tools/inline-tool-marker.ts +12 -0
- package/src/components/modules/api/blocks.ts +3 -0
- package/src/components/modules/paste/google-docs-preprocessor.ts +64 -28
- package/src/components/modules/paste/sanitizer-config.ts +10 -1
- package/src/components/modules/renderer.ts +7 -1
- package/src/components/modules/toolbar/blockSettings.ts +54 -7
- package/src/components/modules/toolbar/content-alignment.ts +89 -0
- package/src/components/modules/toolbar/index.ts +85 -61
- package/src/components/modules/ui.ts +28 -6
- package/src/components/modules/uiControllers/controllers/blockHover.ts +20 -0
- package/src/components/utils/color-mapping.ts +15 -0
- package/src/components/utils/color-migration.ts +10 -0
- package/src/components/utils/data-model-transform.ts +200 -0
- package/src/components/utils/default-page-colors.ts +130 -0
- package/src/components/utils/highlight-block-arrival.ts +50 -0
- package/src/components/utils/popover/popover-desktop.ts +23 -1
- package/src/styles/image.css +86 -0
- package/src/styles/keyframes.css +6 -0
- package/src/styles/main.css +17 -0
- package/src/tools/database/index.ts +3 -4
- package/src/tools/image/dimensions-from-svg.ts +53 -0
- package/src/tools/image/dimensions-from-url.ts +87 -0
- package/src/tools/image/error-state.ts +7 -2
- package/src/tools/image/index.ts +81 -7
- package/src/tools/image/probe-dimensions.ts +36 -0
- package/src/tools/image/ui.ts +46 -2
- package/src/tools/image/uploader.ts +12 -8
- package/src/tools/table/table-cell-clipboard.ts +17 -3
- package/types/tools/image.d.ts +16 -2
- package/dist/chunks/constants-JFG5JxhI.cjs +0 -457
- package/dist/chunks/messages-C-FUK4Ki2.cjs +0 -1
- package/dist/chunks/messages-CLkrVqVp.cjs +0 -1
- package/dist/chunks/messages-D9qYuzOY2.cjs +0 -1
- package/dist/chunks/messages-DEdX7dXt2.cjs +0 -1
- package/dist/chunks/tools-Cnlc1TxG.cjs +0 -116
package/src/tools/image/index.ts
CHANGED
|
@@ -38,6 +38,7 @@ import { ImageError } from './errors';
|
|
|
38
38
|
import { attachResizeHandle, type ResizeEdge } from './resizer';
|
|
39
39
|
import { widthForAspectChange } from './crop-math';
|
|
40
40
|
import {
|
|
41
|
+
applyAutoFull,
|
|
41
42
|
openLightbox,
|
|
42
43
|
renderCaptionRow,
|
|
43
44
|
renderImage,
|
|
@@ -46,6 +47,7 @@ import {
|
|
|
46
47
|
} from './ui';
|
|
47
48
|
import { openCropModal } from './crop-modal';
|
|
48
49
|
import { openAltPopover } from './alt-popover';
|
|
50
|
+
import { probeImageDimensions } from './probe-dimensions';
|
|
49
51
|
import { renderUploadingState, type UploadingStateElement } from './uploading-state';
|
|
50
52
|
import { Uploader, type UploadResult } from './uploader';
|
|
51
53
|
|
|
@@ -71,6 +73,7 @@ export class ImageTool implements BlockTool {
|
|
|
71
73
|
private lastSource: { kind: 'file'; file: File } | { kind: 'url'; url: string } | null = null;
|
|
72
74
|
private brokenImage = false;
|
|
73
75
|
private retrying = false;
|
|
76
|
+
private reloadAttempts = 0;
|
|
74
77
|
|
|
75
78
|
constructor(options: BlockToolConstructorOptions<ImageData, ImageConfig>) {
|
|
76
79
|
this.api = options.api;
|
|
@@ -101,6 +104,8 @@ export class ImageTool implements BlockTool {
|
|
|
101
104
|
if (this.data.frame !== undefined) out.frame = this.data.frame;
|
|
102
105
|
if (this.data.rounded !== undefined) out.rounded = this.data.rounded;
|
|
103
106
|
if (this.data.captionVisible !== undefined) out.captionVisible = this.data.captionVisible;
|
|
107
|
+
if (this.data.naturalWidth !== undefined) out.naturalWidth = this.data.naturalWidth;
|
|
108
|
+
if (this.data.naturalHeight !== undefined) out.naturalHeight = this.data.naturalHeight;
|
|
104
109
|
if (this.data.crop !== undefined) {
|
|
105
110
|
const { x, y, w, h, shape } = this.data.crop;
|
|
106
111
|
const isFull = x === 0 && y === 0 && w === 100 && h === 100;
|
|
@@ -155,6 +160,10 @@ export class ImageTool implements BlockTool {
|
|
|
155
160
|
}
|
|
156
161
|
}
|
|
157
162
|
|
|
163
|
+
private reportProgress = (percent: number): void => {
|
|
164
|
+
this.uploadingEl?.setProgress(percent);
|
|
165
|
+
};
|
|
166
|
+
|
|
158
167
|
private startUpload(file: File): void {
|
|
159
168
|
this.lastFileName = file.name;
|
|
160
169
|
this.lastSource = { kind: 'file', file };
|
|
@@ -163,7 +172,7 @@ export class ImageTool implements BlockTool {
|
|
|
163
172
|
this.brokenImage = false;
|
|
164
173
|
this.renderState();
|
|
165
174
|
void this.uploader
|
|
166
|
-
.handleFile(file)
|
|
175
|
+
.handleFile(file, { onProgress: this.reportProgress })
|
|
167
176
|
.then((result) => this.applyResult(result))
|
|
168
177
|
.catch((err) => this.applyError(err));
|
|
169
178
|
}
|
|
@@ -176,7 +185,7 @@ export class ImageTool implements BlockTool {
|
|
|
176
185
|
this.brokenImage = false;
|
|
177
186
|
this.renderState();
|
|
178
187
|
void this.uploader
|
|
179
|
-
.handleUrl(url)
|
|
188
|
+
.handleUrl(url, { onProgress: this.reportProgress })
|
|
180
189
|
.then((result) => this.applyResult(result))
|
|
181
190
|
.catch((err) => this.applyError(err));
|
|
182
191
|
}
|
|
@@ -194,8 +203,8 @@ export class ImageTool implements BlockTool {
|
|
|
194
203
|
);
|
|
195
204
|
if (retryBtn) retryBtn.disabled = true;
|
|
196
205
|
const promise = source.kind === 'file'
|
|
197
|
-
? this.uploader.handleFile(source.file)
|
|
198
|
-
: this.uploader.handleUrl(source.url);
|
|
206
|
+
? this.uploader.handleFile(source.file, { onProgress: this.reportProgress })
|
|
207
|
+
: this.uploader.handleUrl(source.url, { onProgress: this.reportProgress });
|
|
199
208
|
void promise
|
|
200
209
|
.then((result) => this.applyResult(result))
|
|
201
210
|
.catch((err) => this.applyError(err));
|
|
@@ -230,6 +239,46 @@ export class ImageTool implements BlockTool {
|
|
|
230
239
|
this.renderState();
|
|
231
240
|
}
|
|
232
241
|
|
|
242
|
+
private cacheNaturalDimensions(imgEl: HTMLImageElement): void {
|
|
243
|
+
const w = imgEl.naturalWidth;
|
|
244
|
+
const h = imgEl.naturalHeight;
|
|
245
|
+
if (w <= 0 || h <= 0) return;
|
|
246
|
+
if (this.data.naturalWidth === w && this.data.naturalHeight === h) return;
|
|
247
|
+
this.data.naturalWidth = w;
|
|
248
|
+
this.data.naturalHeight = h;
|
|
249
|
+
this.block.dispatchChange();
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
private applyLoadingDimensions(figure: HTMLElement, imgEl: HTMLImageElement, width: number, height: number): void {
|
|
253
|
+
if (figure.getAttribute('data-loading') !== 'true') return;
|
|
254
|
+
figure.style.setProperty('aspect-ratio', `${width} / ${height}`);
|
|
255
|
+
figure.style.setProperty('min-height', '0px');
|
|
256
|
+
imgEl.style.setProperty('min-height', '0px');
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
private handleImgLoadFailure(imgEl: HTMLImageElement, figure: HTMLElement): void {
|
|
260
|
+
if (this.reloadAttempts >= 1) {
|
|
261
|
+
figure.removeAttribute('data-loading');
|
|
262
|
+
this.applyBrokenImage();
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
this.reloadAttempts++;
|
|
266
|
+
figure.setAttribute('data-loading', 'true');
|
|
267
|
+
const src = this.data.url;
|
|
268
|
+
const cachedW = this.data.naturalWidth;
|
|
269
|
+
const cachedH = this.data.naturalHeight;
|
|
270
|
+
if (cachedW && cachedH) {
|
|
271
|
+
this.applyLoadingDimensions(figure, imgEl, cachedW, cachedH);
|
|
272
|
+
} else {
|
|
273
|
+
void probeImageDimensions(src).then((dims) => {
|
|
274
|
+
if (!dims) return;
|
|
275
|
+
this.applyLoadingDimensions(figure, imgEl, dims.width, dims.height);
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
imgEl.setAttribute('src', '');
|
|
279
|
+
imgEl.setAttribute('src', src);
|
|
280
|
+
}
|
|
281
|
+
|
|
233
282
|
private retryBrokenImage(): void {
|
|
234
283
|
this.brokenImage = false;
|
|
235
284
|
this.errorMessage = null;
|
|
@@ -527,7 +576,10 @@ export class ImageTool implements BlockTool {
|
|
|
527
576
|
if (!this.root) return;
|
|
528
577
|
const isBroken = this.brokenImage;
|
|
529
578
|
const el = renderErrorState({
|
|
530
|
-
|
|
579
|
+
variant: isBroken ? 'broken' : 'upload',
|
|
580
|
+
title: isBroken
|
|
581
|
+
? this.api.i18n.t('tools.image.errorImageFailedToLoad')
|
|
582
|
+
: this.api.i18n.t('tools.image.errorUploadFailedTitle'),
|
|
531
583
|
message: this.errorMessage ?? undefined,
|
|
532
584
|
onTryAgain: isBroken
|
|
533
585
|
? () => this.retryBrokenImage()
|
|
@@ -541,6 +593,9 @@ export class ImageTool implements BlockTool {
|
|
|
541
593
|
private renderRendered(): void {
|
|
542
594
|
if (!this.root) return;
|
|
543
595
|
const figure = renderImage(this.data);
|
|
596
|
+
if (this.data.naturalWidth && this.data.naturalHeight) {
|
|
597
|
+
figure.style.setProperty('aspect-ratio', `${this.data.naturalWidth} / ${this.data.naturalHeight}`);
|
|
598
|
+
}
|
|
544
599
|
|
|
545
600
|
const imgEl = figure.querySelector('img');
|
|
546
601
|
// FLIP origin: the visible element. With an active crop that's the crop wrapper
|
|
@@ -549,7 +604,15 @@ export class ImageTool implements BlockTool {
|
|
|
549
604
|
if (imgEl) {
|
|
550
605
|
imgEl.style.cursor = 'zoom-in';
|
|
551
606
|
imgEl.addEventListener('click', () => openLightbox({ url: this.data.url, alt: this.data.alt, fileName: this.data.fileName, crop: this.data.crop, origin: originEl, i18n: this.api.i18n, navigation: this.collectNavigation() }));
|
|
552
|
-
|
|
607
|
+
this.reloadAttempts = 0;
|
|
608
|
+
imgEl.addEventListener('error', () => this.handleImgLoadFailure(imgEl, figure));
|
|
609
|
+
imgEl.addEventListener('load', () => {
|
|
610
|
+
figure.removeAttribute('data-loading');
|
|
611
|
+
figure.style.removeProperty('aspect-ratio');
|
|
612
|
+
figure.style.removeProperty('min-height');
|
|
613
|
+
imgEl.style.removeProperty('min-height');
|
|
614
|
+
this.cacheNaturalDimensions(imgEl);
|
|
615
|
+
});
|
|
553
616
|
if (imgEl.complete && imgEl.naturalWidth === 0) {
|
|
554
617
|
this.applyBrokenImage();
|
|
555
618
|
return;
|
|
@@ -636,8 +699,19 @@ export class ImageTool implements BlockTool {
|
|
|
636
699
|
}
|
|
637
700
|
|
|
638
701
|
private observeOverlayWidth(figure: HTMLElement, overlay: HTMLElement): void {
|
|
639
|
-
const
|
|
702
|
+
const img = figure.querySelector<HTMLImageElement>('img');
|
|
703
|
+
const sync = (): void => {
|
|
704
|
+
if (this.root && img && img.naturalWidth > 0) {
|
|
705
|
+
const container = this.root.parentElement;
|
|
706
|
+
const containerWidth = container?.clientWidth ?? figure.clientWidth;
|
|
707
|
+
applyAutoFull(this.root, img, containerWidth);
|
|
708
|
+
}
|
|
709
|
+
updateOverlayCompact(overlay, figure.clientWidth, figure.clientHeight);
|
|
710
|
+
};
|
|
640
711
|
sync();
|
|
712
|
+
if (img && !img.complete) {
|
|
713
|
+
img.addEventListener('load', sync, { once: true });
|
|
714
|
+
}
|
|
641
715
|
if (typeof ResizeObserver === 'undefined') return;
|
|
642
716
|
this.overlayResizeObserver = new ResizeObserver(sync);
|
|
643
717
|
this.overlayResizeObserver.observe(figure);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { dimensionsFromSvg } from './dimensions-from-svg';
|
|
2
|
+
import { dimensionsFromUrl } from './dimensions-from-url';
|
|
3
|
+
|
|
4
|
+
type Dims = { width: number; height: number };
|
|
5
|
+
|
|
6
|
+
function probeViaImage(url: string): Promise<Dims | null> {
|
|
7
|
+
return new Promise((resolve) => {
|
|
8
|
+
const img = new Image();
|
|
9
|
+
img.onload = (): void => {
|
|
10
|
+
const width = img.naturalWidth;
|
|
11
|
+
const height = img.naturalHeight;
|
|
12
|
+
if (width > 0 && height > 0) {
|
|
13
|
+
resolve({ width, height });
|
|
14
|
+
} else {
|
|
15
|
+
resolve(null);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
img.onerror = (): void => resolve(null);
|
|
19
|
+
img.src = url;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Resolve an image's intrinsic dimensions ahead of display.
|
|
25
|
+
* Tries synchronous URL/filename parsing first (common CDN hints),
|
|
26
|
+
* falls back to parsing SVG text, finally loads the image via `new Image()`.
|
|
27
|
+
* Returns null when no strategy succeeds or the image has no intrinsic size.
|
|
28
|
+
*/
|
|
29
|
+
export async function probeImageDimensions(url: string): Promise<Dims | null> {
|
|
30
|
+
if (!url) return null;
|
|
31
|
+
const fromUrl = dimensionsFromUrl(url);
|
|
32
|
+
if (fromUrl) return fromUrl;
|
|
33
|
+
const fromSvg = await dimensionsFromSvg(url);
|
|
34
|
+
if (fromSvg) return fromSvg;
|
|
35
|
+
return probeViaImage(url);
|
|
36
|
+
}
|
package/src/tools/image/ui.ts
CHANGED
|
@@ -916,13 +916,57 @@ export interface OverlayState {
|
|
|
916
916
|
* to comfortably fit the full row (roughly sm-size territory).
|
|
917
917
|
*/
|
|
918
918
|
export const OVERLAY_COMPACT_THRESHOLD = 230;
|
|
919
|
+
/**
|
|
920
|
+
* Below this figure height the overlay collapses too — a short image can't
|
|
921
|
+
* fit the ~46px toolbar row without colliding with the resize handles.
|
|
922
|
+
*/
|
|
923
|
+
export const OVERLAY_COMPACT_HEIGHT_THRESHOLD = 80;
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* Predict whether an image would still render too short at full container
|
|
927
|
+
* width (data-size="full"). Used to force the layout to full + compact
|
|
928
|
+
* overlay for banner-shaped / tiny-natural images that otherwise collide
|
|
929
|
+
* with the resize handles and toolbar row.
|
|
930
|
+
*/
|
|
931
|
+
export function isTinyImage(
|
|
932
|
+
naturalWidth: number,
|
|
933
|
+
naturalHeight: number,
|
|
934
|
+
containerWidth: number,
|
|
935
|
+
heightThreshold: number = OVERLAY_COMPACT_HEIGHT_THRESHOLD
|
|
936
|
+
): boolean {
|
|
937
|
+
if (naturalWidth <= 0 || naturalHeight <= 0 || containerWidth <= 0) return false;
|
|
938
|
+
const fullWidthHeight = containerWidth * (naturalHeight / naturalWidth);
|
|
939
|
+
return fullWidthHeight < heightThreshold;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* Flag the block root for auto-full layout when the source image is too
|
|
944
|
+
* short to host the toolbar + resize handles at its default size. CSS keys
|
|
945
|
+
* off the attribute to override `data-size` and stretch the figure to the
|
|
946
|
+
* full container width.
|
|
947
|
+
*/
|
|
948
|
+
export function applyAutoFull(
|
|
949
|
+
root: HTMLElement,
|
|
950
|
+
img: Pick<HTMLImageElement, 'naturalWidth' | 'naturalHeight'>,
|
|
951
|
+
containerWidth: number
|
|
952
|
+
): void {
|
|
953
|
+
if (isTinyImage(img.naturalWidth, img.naturalHeight, containerWidth)) {
|
|
954
|
+
root.setAttribute('data-auto-full', 'true');
|
|
955
|
+
} else {
|
|
956
|
+
root.removeAttribute('data-auto-full');
|
|
957
|
+
}
|
|
958
|
+
}
|
|
919
959
|
|
|
920
960
|
export function updateOverlayCompact(
|
|
921
961
|
overlay: HTMLElement,
|
|
922
962
|
width: number,
|
|
923
|
-
|
|
963
|
+
height?: number,
|
|
964
|
+
threshold: number = OVERLAY_COMPACT_THRESHOLD,
|
|
965
|
+
heightThreshold: number = OVERLAY_COMPACT_HEIGHT_THRESHOLD
|
|
924
966
|
): void {
|
|
925
|
-
|
|
967
|
+
const tooNarrow = width > 0 && width < threshold;
|
|
968
|
+
const tooShort = height !== undefined && height > 0 && height < heightThreshold;
|
|
969
|
+
if (tooNarrow || tooShort) {
|
|
926
970
|
overlay.setAttribute('data-compact', 'true');
|
|
927
971
|
} else {
|
|
928
972
|
overlay.removeAttribute('data-compact');
|
|
@@ -7,6 +7,10 @@ export interface UploadResult {
|
|
|
7
7
|
fileName?: string;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
export interface UploadOptions {
|
|
11
|
+
onProgress?: (percent: number) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
function parseUrl(raw: string): URL | null {
|
|
11
15
|
try {
|
|
12
16
|
return new URL(raw);
|
|
@@ -38,33 +42,33 @@ function dataUrlToFile(dataUrl: string): File {
|
|
|
38
42
|
export class Uploader {
|
|
39
43
|
constructor(private readonly config: ImageConfig) {}
|
|
40
44
|
|
|
41
|
-
public async handleUrl(raw: string): Promise<UploadResult> {
|
|
45
|
+
public async handleUrl(raw: string, options: UploadOptions = {}): Promise<UploadResult> {
|
|
42
46
|
if (isImageDataUrl(raw)) {
|
|
43
|
-
return this.handleDataUrl(raw);
|
|
47
|
+
return this.handleDataUrl(raw, options);
|
|
44
48
|
}
|
|
45
49
|
this.validateUrl(raw);
|
|
46
50
|
if (this.config.uploader?.uploadByUrl) {
|
|
47
|
-
return this.config.uploader.uploadByUrl(raw);
|
|
51
|
+
return this.config.uploader.uploadByUrl(raw, { onProgress: options.onProgress });
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
return { url: raw };
|
|
51
55
|
}
|
|
52
56
|
|
|
53
|
-
public async handleFile(file: File): Promise<UploadResult> {
|
|
57
|
+
public async handleFile(file: File, options: UploadOptions = {}): Promise<UploadResult> {
|
|
54
58
|
this.validateFile(file);
|
|
55
59
|
if (this.config.uploader?.uploadByFile) {
|
|
56
|
-
return this.config.uploader.uploadByFile(file);
|
|
60
|
+
return this.config.uploader.uploadByFile(file, { onProgress: options.onProgress });
|
|
57
61
|
}
|
|
58
62
|
|
|
59
63
|
return { url: URL.createObjectURL(file), fileName: file.name };
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
private async handleDataUrl(raw: string): Promise<UploadResult> {
|
|
66
|
+
private async handleDataUrl(raw: string, options: UploadOptions): Promise<UploadResult> {
|
|
63
67
|
if (this.config.uploader?.uploadByUrl) {
|
|
64
|
-
return this.config.uploader.uploadByUrl(raw);
|
|
68
|
+
return this.config.uploader.uploadByUrl(raw, { onProgress: options.onProgress });
|
|
65
69
|
}
|
|
66
70
|
if (this.config.uploader?.uploadByFile) {
|
|
67
|
-
return this.handleFile(dataUrlToFile(raw));
|
|
71
|
+
return this.handleFile(dataUrlToFile(raw), options);
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
return { url: raw };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SanitizerConfig } from '../../../types/configs/sanitizer-config';
|
|
2
2
|
import type { CellPlacement, ClipboardBlockData, TableCellsClipboard } from './types';
|
|
3
3
|
import { mapToNearestPresetColor } from '../../components/utils/color-mapping';
|
|
4
|
+
import { isDefaultDarkBackground, isDefaultWhiteBackground } from '../../components/modules/paste/google-docs-preprocessor';
|
|
4
5
|
import { clean } from '../../components/utils/sanitizer';
|
|
5
6
|
|
|
6
7
|
/** Attribute name used to embed clipboard data on the HTML table element. */
|
|
@@ -245,7 +246,11 @@ function sanitizeCellHtml(td: Element): string {
|
|
|
245
246
|
const bgColor = bgMatch?.[1]?.trim();
|
|
246
247
|
|
|
247
248
|
const hasColor = color !== undefined && !isDefaultBlack(color);
|
|
248
|
-
|
|
249
|
+
// Filter resolved page bg (white/dark) so plain spans don't collapse onto gray preset.
|
|
250
|
+
const hasBgColor = bgColor !== undefined
|
|
251
|
+
&& bgColor !== 'transparent'
|
|
252
|
+
&& !isDefaultWhiteBackground(bgColor)
|
|
253
|
+
&& !isDefaultDarkBackground(bgColor);
|
|
249
254
|
|
|
250
255
|
if (!isBold && !isItalic && !hasColor && !hasBgColor) {
|
|
251
256
|
continue;
|
|
@@ -282,7 +287,11 @@ function sanitizeCellHtml(td: Element): string {
|
|
|
282
287
|
const bgColor = bgMatch?.[1]?.trim();
|
|
283
288
|
|
|
284
289
|
const hasColor = color !== undefined && !isDefaultBlack(color) && color !== 'inherit';
|
|
285
|
-
const hasBgColor = bgColor !== undefined
|
|
290
|
+
const hasBgColor = bgColor !== undefined
|
|
291
|
+
&& bgColor !== 'transparent'
|
|
292
|
+
&& bgColor !== 'inherit'
|
|
293
|
+
&& !isDefaultWhiteBackground(bgColor)
|
|
294
|
+
&& !isDefaultDarkBackground(bgColor);
|
|
286
295
|
|
|
287
296
|
if (!hasColor && !hasBgColor) {
|
|
288
297
|
continue;
|
|
@@ -372,7 +381,12 @@ export function parseGenericHtmlTable(html: string): TableCellsClipboard | null
|
|
|
372
381
|
const cellBgMatch = /background-color\s*:\s*([^;]+)/i.exec(tdStyle);
|
|
373
382
|
|
|
374
383
|
if (cellBgMatch?.[1]) {
|
|
375
|
-
|
|
384
|
+
const cellBg = cellBgMatch[1].trim();
|
|
385
|
+
|
|
386
|
+
// Skip resolved page bg (white/dark) so plain cells don't collapse onto gray preset.
|
|
387
|
+
if (!isDefaultWhiteBackground(cellBg) && !isDefaultDarkBackground(cellBg)) {
|
|
388
|
+
cell.color = mapToNearestPresetColor(cellBg, 'bg');
|
|
389
|
+
}
|
|
376
390
|
}
|
|
377
391
|
|
|
378
392
|
const cellTextColorMatch = /(?<![a-z-])color\s*:\s*([^;]+)/i.exec(tdStyle);
|
package/types/tools/image.d.ts
CHANGED
|
@@ -46,6 +46,20 @@ export interface ImageData extends BlockToolData {
|
|
|
46
46
|
alt?: string;
|
|
47
47
|
/** Original filename, when known */
|
|
48
48
|
fileName?: string;
|
|
49
|
+
/** Intrinsic pixel width of the source image. Cached after first successful load. */
|
|
50
|
+
naturalWidth?: number;
|
|
51
|
+
/** Intrinsic pixel height of the source image. Cached after first successful load. */
|
|
52
|
+
naturalHeight?: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Context passed to consumer-supplied upload methods. Currently exposes
|
|
57
|
+
* an `onProgress(percent)` hook so the upload bar in the editor can
|
|
58
|
+
* reflect real upload progress (0–100). Optional — consumers that don't
|
|
59
|
+
* report progress simply ignore it.
|
|
60
|
+
*/
|
|
61
|
+
export interface ImageUploadContext {
|
|
62
|
+
onProgress?(percent: number): void;
|
|
49
63
|
}
|
|
50
64
|
|
|
51
65
|
/**
|
|
@@ -53,8 +67,8 @@ export interface ImageData extends BlockToolData {
|
|
|
53
67
|
* the tool falls back to blob URLs (uploadByFile) or direct embed (uploadByUrl).
|
|
54
68
|
*/
|
|
55
69
|
export interface ImageUploader {
|
|
56
|
-
uploadByFile?(file: File): Promise<{ url: string; fileName?: string }>;
|
|
57
|
-
uploadByUrl?(url: string): Promise<{ url: string }>;
|
|
70
|
+
uploadByFile?(file: File, ctx?: ImageUploadContext): Promise<{ url: string; fileName?: string }>;
|
|
71
|
+
uploadByUrl?(url: string, ctx?: ImageUploadContext): Promise<{ url: string }>;
|
|
58
72
|
}
|
|
59
73
|
|
|
60
74
|
/**
|