@jackuait/blok 0.8.2 → 0.8.3-beta.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/dist/blok.mjs +2 -2
- package/dist/chunks/am-CHDDMHkd.mjs +16490 -0
- package/dist/chunks/ar-DoqfNqut.mjs +19245 -0
- package/dist/chunks/az-C34P9iEa.mjs +14694 -0
- package/dist/chunks/bg-jroXLY8Y.mjs +15432 -0
- package/dist/chunks/{blok-GAbVCHTV.mjs → blok-0-8moMz9.mjs} +2090 -2052
- package/dist/chunks/bn-BRI-WqxY.mjs +16150 -0
- package/dist/chunks/bs-CCGUpNHu.mjs +12536 -0
- package/dist/chunks/{constants-CyDHDZyH.mjs → constants-PWnlOOrQ.mjs} +211 -172
- package/dist/chunks/cs-D5qZOGuc.mjs +22809 -0
- package/dist/chunks/da-DrJ7W37K.mjs +14573 -0
- package/dist/chunks/de-BW6-kp2c.mjs +16366 -0
- package/dist/chunks/el-C-Vc_Otu.mjs +16339 -0
- package/dist/chunks/es-B6fI5K9i.mjs +13597 -0
- package/dist/chunks/et-BhVlZ-Yz.mjs +14747 -0
- package/dist/chunks/fa-D55Ijdqa.mjs +16368 -0
- package/dist/chunks/fi-jNLjhKUQ.mjs +14408 -0
- package/dist/chunks/fil-DYd0T5aX.mjs +15915 -0
- package/dist/chunks/fr-yxy5xWw_.mjs +17010 -0
- package/dist/chunks/gu-CcY_LJe7.mjs +19021 -0
- package/dist/chunks/he-DL9s7wNw.mjs +15047 -0
- package/dist/chunks/hi-C8eGXgw5.mjs +15946 -0
- package/dist/chunks/hr-DLpybOhU.mjs +15099 -0
- package/dist/chunks/hu-BkT0gT00.mjs +16564 -0
- package/dist/chunks/hy-CVFDCp2S.mjs +12823 -0
- package/dist/chunks/{i18next-loader-p-7ioTwr.mjs → i18next-loader-BCAGutUy.mjs} +2 -2
- package/dist/chunks/id-0P4W9Az0.mjs +16690 -0
- package/dist/chunks/it-mLY6_uoW.mjs +19054 -0
- package/dist/chunks/ja-7RkeRNWG.mjs +15708 -0
- package/dist/chunks/ka-C7Lx-Qsh.mjs +13049 -0
- package/dist/chunks/km-Q8udaraH.mjs +12319 -0
- package/dist/chunks/kn-BiETM-iq.mjs +19123 -0
- package/dist/chunks/ko-tiB80pF1.mjs +17322 -0
- package/dist/chunks/ku-CY-OABkR.mjs +236 -0
- package/dist/chunks/{lightweight-i18n-BPeH69Dl.mjs → lightweight-i18n-CNUuUkuo.mjs} +31 -1
- package/dist/chunks/lo-CTBhEnyk.mjs +13576 -0
- package/dist/chunks/lt-BHKHEtqK.mjs +14587 -0
- package/dist/chunks/lv-DWxgtfUg.mjs +15042 -0
- package/dist/chunks/{messages-BHf_VcXb2.mjs → messages-2i0z2hFq2.mjs} +32 -2
- package/dist/{messages-8zo-T-Nx2.mjs → chunks/messages-4epWYTzK.mjs} +32 -2
- package/dist/chunks/{messages-DgZnRQRS.mjs → messages-B-x11A7Z.mjs} +32 -2
- package/dist/chunks/{messages-C03I_oR-2.mjs → messages-B1mCwtgm2.mjs} +32 -2
- package/dist/{messages-C5hD5pSd2.mjs → chunks/messages-B2Xnfn7m2.mjs} +32 -2
- package/dist/chunks/{messages-B-i-d1Bc.mjs → messages-B38lWmza.mjs} +32 -2
- package/dist/{messages-BRC9E_sp.mjs → chunks/messages-B3VMWaO8.mjs} +32 -2
- package/dist/{messages-BrcgNZOJ.mjs → chunks/messages-B6n2OYKJ.mjs} +32 -2
- package/dist/chunks/{messages-CIugNDDO2.mjs → messages-B847kJa02.mjs} +32 -2
- package/dist/chunks/{messages-CH_cexo62.mjs → messages-B8nL5cPA2.mjs} +32 -2
- package/dist/chunks/{messages-Bdk5tBNu.mjs → messages-BHMUmX3N.mjs} +32 -2
- package/dist/chunks/{messages-LL3Tflph.mjs → messages-BN78Am3l2.mjs} +32 -2
- package/dist/chunks/{messages-BIrkzbBP.mjs → messages-BRa1Itk_.mjs} +32 -2
- package/dist/chunks/{messages-BtS6JWMT.mjs → messages-BleThZm5.mjs} +32 -2
- package/dist/{messages-DHJ1fZLL.mjs → chunks/messages-Bo2PcQoc.mjs} +32 -2
- package/dist/{messages-D5rnT-BC.mjs → chunks/messages-Bqk7cuZY.mjs} +32 -2
- package/dist/chunks/{messages-Di7mfvB8.mjs → messages-BrsB1FRe.mjs} +32 -2
- package/dist/{messages-CsmTziC6.mjs → chunks/messages-ByeBRHpJ.mjs} +32 -2
- package/dist/{messages-C7Rz00Tp.mjs → chunks/messages-C35b_LVM.mjs} +32 -2
- package/dist/{messages-Co26RSCV2.mjs → chunks/messages-CAH4L_Mq2.mjs} +32 -2
- package/dist/chunks/{messages-BMzmli1K.mjs → messages-CBa6-NHn.mjs} +32 -2
- package/dist/chunks/{messages-wUoSWFsJ2.mjs → messages-CCywXuFz2.mjs} +32 -2
- package/dist/chunks/{messages-4OvVdaG52.mjs → messages-CDZrOiaR.mjs} +32 -2
- package/dist/{messages-C92tAUYT2.mjs → chunks/messages-CEVMB1TN2.mjs} +32 -2
- package/dist/{messages-CHeucLGl2.mjs → chunks/messages-CF7WlKOY.mjs} +32 -2
- package/dist/{messages-D_-rh8gl.mjs → chunks/messages-CLcwMAAe.mjs} +32 -2
- package/dist/chunks/{messages-Df69rfTF2.mjs → messages-CTGjizuJ2.mjs} +32 -2
- package/dist/chunks/{messages-Ehx9YYeb2.mjs → messages-CTI66ZU52.mjs} +32 -2
- package/dist/{messages-C9LsEUfG.mjs → chunks/messages-CTtFH-AE.mjs} +32 -2
- package/dist/{messages-BB8umWL1.mjs → chunks/messages-CbilQw5o2.mjs} +32 -2
- package/dist/chunks/{messages-BAgTIgPH.mjs → messages-CiSiPyKp.mjs} +32 -2
- package/dist/chunks/{messages-5thhSeME.mjs → messages-ClD_3Kmk.mjs} +32 -2
- package/dist/chunks/{messages--aM83pib2.mjs → messages-CqoOMgIb2.mjs} +32 -2
- package/dist/chunks/{messages-EDTq4Q52.mjs → messages-Cqxe2gIN.mjs} +32 -2
- package/dist/chunks/{messages-SsrFJhTN.mjs → messages-CxKX6wTt.mjs} +32 -2
- package/dist/chunks/{messages-DUp8NnKT.mjs → messages-CyrZJ9dG.mjs} +32 -2
- package/dist/{messages-EIeWKoc5.mjs → chunks/messages-D1eXOdyJ.mjs} +32 -2
- package/dist/chunks/{messages-ohtcmr1w.mjs → messages-D2QcrPYF.mjs} +32 -2
- package/dist/{messages-DV29fJMD2.mjs → chunks/messages-D6EtVUzk2.mjs} +32 -2
- package/dist/{messages-C4HpNHfK.mjs → chunks/messages-D7qp-JvC.mjs} +32 -2
- package/dist/chunks/{messages-Dr-Ig3sw.mjs → messages-DAhzpf-j.mjs} +32 -2
- package/dist/chunks/{messages-DKChC8Qu.mjs → messages-DEVxqfH0.mjs} +32 -2
- package/dist/{messages-CkIRmpfZ2.mjs → chunks/messages-DHJIlD2m.mjs} +32 -2
- package/dist/{messages-CmoTIebG2.mjs → chunks/messages-DJ_gZym52.mjs} +32 -2
- package/dist/{messages-Cu7Lr1wp.mjs → chunks/messages-DMENc4jZ.mjs} +32 -2
- package/dist/chunks/{messages-BAC7nLeM.mjs → messages-DVDFAJaw.mjs} +32 -2
- package/dist/chunks/{messages-Co4WFeQ8.mjs → messages-DYQ87v5m.mjs} +32 -2
- package/dist/chunks/{messages-BO_jtRbZ2.mjs → messages-Dc2wd0BC2.mjs} +32 -2
- package/dist/{messages-F7cRf-20.mjs → chunks/messages-DlSDBHih.mjs} +32 -2
- package/dist/chunks/{messages-Nz8C7Znm.mjs → messages-Dmxk7uOK.mjs} +32 -2
- package/dist/chunks/{messages-8pf7gRQm2.mjs → messages-Dqoj0eKD2.mjs} +32 -2
- package/dist/{messages-BD_U2EnE.mjs → chunks/messages-DvUNk-e7.mjs} +32 -2
- package/dist/{messages-CTFwu5-h2.mjs → chunks/messages-DvZa_OtS2.mjs} +32 -2
- package/dist/chunks/{messages-CSpfBhlK2.mjs → messages-Dxa27UhV2.mjs} +32 -2
- package/dist/chunks/{messages-D14soBOO.mjs → messages-JQR7Z2f0.mjs} +32 -2
- package/dist/{messages-bRqMCja-2.mjs → chunks/messages-K453lCht2.mjs} +32 -2
- package/dist/{messages-B9ythxux.mjs → chunks/messages-Kqu8QyYy2.mjs} +32 -2
- package/dist/{messages-CWzET_9H2.mjs → chunks/messages-LGqROvB5.mjs} +32 -2
- package/dist/{messages-JwMkLben.mjs → chunks/messages-LiQ7ni4i2.mjs} +32 -2
- package/dist/{messages-B21zLG6b.mjs → chunks/messages-PDaWSrFT.mjs} +32 -2
- package/dist/{messages-ouO9js8Z.mjs → chunks/messages-SOew8O6I.mjs} +32 -2
- package/dist/{messages-SepwOOcg.mjs → chunks/messages-cjqgX4JV2.mjs} +32 -2
- package/dist/chunks/{messages-BARPMN7R.mjs → messages-fdO2V2XC.mjs} +32 -2
- package/dist/chunks/{messages-DDpgr0B1.mjs → messages-lu4RI1A3.mjs} +32 -2
- package/dist/{messages-D_cAZ4Ic2.mjs → chunks/messages-qt_Tsj1u2.mjs} +32 -2
- package/dist/chunks/{messages-BDTgiBJY2.mjs → messages-uQOWdLDn2.mjs} +32 -2
- package/dist/chunks/{messages-FCmAVA792.mjs → messages-xG65ERBM2.mjs} +32 -2
- package/dist/chunks/mk-BjookGdx.mjs +16800 -0
- package/dist/chunks/ml-L-NnZcp9.mjs +13558 -0
- package/dist/chunks/mn-OMWi7Hl_.mjs +12107 -0
- package/dist/chunks/mr-B6JPzITo.mjs +17324 -0
- package/dist/chunks/ms-CG3S-sPB.mjs +14999 -0
- package/dist/chunks/my-BLAmGfhT.mjs +12534 -0
- package/dist/chunks/native-BPcABu9z.mjs +107 -0
- package/dist/chunks/ne-D1JHLfYw.mjs +13248 -0
- package/dist/chunks/nl-Ca7Q8FnY.mjs +16693 -0
- package/dist/chunks/no-Coxcohcz.mjs +14767 -0
- package/dist/chunks/pa-CCaXqpaI.mjs +17220 -0
- package/dist/chunks/pl-Cl_fAZ84.mjs +17221 -0
- package/dist/chunks/ps-WD5qGAWy.mjs +12185 -0
- package/dist/chunks/pt-C4zvLfvq.mjs +16334 -0
- package/dist/chunks/ro-DbefHcmM.mjs +18857 -0
- package/dist/chunks/ru-uU1J14jd.mjs +17485 -0
- package/dist/chunks/sd-DKu368Ip.mjs +10889 -0
- package/dist/chunks/si-BsJCiPkZ.mjs +12721 -0
- package/dist/chunks/sk-CD-a3SN6.mjs +19081 -0
- package/dist/chunks/sl-CXhrPJe_.mjs +15682 -0
- package/dist/chunks/sq-CTctCoFQ.mjs +15278 -0
- package/dist/chunks/sr-BZkhBwXj.mjs +14524 -0
- package/dist/chunks/sv-NmRZb_xi.mjs +12855 -0
- package/dist/chunks/sw-Be5ik3H6.mjs +14315 -0
- package/dist/chunks/ta-DsXh6neL.mjs +16836 -0
- package/dist/chunks/te-CwpCbM8M.mjs +18588 -0
- package/dist/chunks/th-CcZ15OLk.mjs +13894 -0
- package/dist/chunks/{tools-CW1RAIvp.mjs → tools-BBmJ8jqK.mjs} +1417 -761
- package/dist/chunks/tr-q3bTgvhW.mjs +16318 -0
- package/dist/chunks/ug-919EhLsL.mjs +9816 -0
- package/dist/chunks/uk-aNMEzd0Y.mjs +16725 -0
- package/dist/chunks/ur-BwQI77sh.mjs +18051 -0
- package/dist/chunks/vi-Dxq806-F.mjs +14006 -0
- package/dist/chunks/zh-BcHuy1Ti.mjs +16334 -0
- package/dist/full.mjs +10 -10
- package/dist/locales.mjs +98 -68
- package/dist/{messages-qV14y_oA2.mjs → messages--PYnorLu2.mjs} +32 -2
- package/dist/{messages-Cy3Ne_M9.mjs → messages-B2X5gO-s.mjs} +32 -2
- package/dist/{chunks/messages-D1SqLcxI2.mjs → messages-BD3lSUU_.mjs} +32 -2
- package/dist/{chunks/messages-CIZkNCpW.mjs → messages-BFbAM_pK2.mjs} +32 -2
- package/dist/{chunks/messages-CIBuZccC.mjs → messages-BMUQ7kA62.mjs} +32 -2
- package/dist/{messages-CrWsU4Xw2.mjs → messages-BR1Hlhdc2.mjs} +32 -2
- package/dist/{chunks/messages-D2uBlGXR2.mjs → messages-BRJBZB-H2.mjs} +32 -2
- package/dist/{chunks/messages-OIelQDL32.mjs → messages-BTFWPbHk2.mjs} +32 -2
- package/dist/{messages-EwoT2jof.mjs → messages-BXvE3YB4.mjs} +32 -2
- package/dist/{messages-CqNzlpWi.mjs → messages-BZg8xxIT.mjs} +32 -2
- package/dist/{messages-BAZK-8Zb.mjs → messages-B_idm-Pp.mjs} +32 -2
- package/dist/{messages-LyzjEEIj2.mjs → messages-BcrsCh5-2.mjs} +32 -2
- package/dist/{chunks/messages-DPoPrTiZ.mjs → messages-Bf0eqjDJ.mjs} +32 -2
- package/dist/{messages-CKmmJ9tW.mjs → messages-Bgu3IB_k.mjs} +32 -2
- package/dist/{chunks/messages-DeLzropc.mjs → messages-Bkv2sk7Y.mjs} +32 -2
- package/dist/{messages-rM6YFLZH.mjs → messages-Bn77ieXA.mjs} +32 -2
- package/dist/{messages-CTPFrtK92.mjs → messages-Buf_f_-32.mjs} +32 -2
- package/dist/{messages-ouRGTAKo2.mjs → messages-BvIBkUCG2.mjs} +32 -2
- package/dist/{chunks/messages-DVg69mRj.mjs → messages-Bw0kGTAV.mjs} +32 -2
- package/dist/{chunks/messages-CWp6-Y8f2.mjs → messages-C5MKR_WT2.mjs} +32 -2
- package/dist/{chunks/messages-N72K1hw3.mjs → messages-C6UkeZ0y.mjs} +32 -2
- package/dist/{messages-CzZAfGif.mjs → messages-C9AvcT0K.mjs} +32 -2
- package/dist/{chunks/messages-D0IKicWg.mjs → messages-CC596_yM.mjs} +32 -2
- package/dist/{messages-DiSeSE8p.mjs → messages-CGD9LR8l.mjs} +32 -2
- package/dist/{messages-Tx25QErT.mjs → messages-CH8tCpAX.mjs} +32 -2
- package/dist/{chunks/messages-DfsHFEWa.mjs → messages-CIGa1j8-2.mjs} +32 -2
- package/dist/{messages-TI0u6Ked.mjs → messages-CJ5pCncM.mjs} +32 -2
- package/dist/{chunks/messages-DEGzGmEQ2.mjs → messages-CJd52qP7.mjs} +32 -2
- package/dist/{messages-Bm8I_Li12.mjs → messages-CWIigMhw2.mjs} +32 -2
- package/dist/{messages-JZhs_0pf.mjs → messages-CY_Fj715.mjs} +32 -2
- package/dist/{messages-BSLYh59S.mjs → messages-C_YAmOyQ.mjs} +32 -2
- package/dist/{messages-CIxT1nSh.mjs → messages-CjCjr0wW.mjs} +32 -2
- package/dist/{messages-Dr9L1psl.mjs → messages-CqbeAhjH.mjs} +32 -2
- package/dist/{messages-BTR3QlIb2.mjs → messages-Cr2hTJyi2.mjs} +32 -2
- package/dist/{chunks/messages-BKjLgO5d.mjs → messages-Cuw_6akN.mjs} +32 -2
- package/dist/{messages-lEyiemqU2.mjs → messages-D0KBToO12.mjs} +32 -2
- package/dist/{messages-1_FCq0It.mjs → messages-D2Xo8E0P.mjs} +32 -2
- package/dist/{messages-Djhu5RJd.mjs → messages-D5Uk_qYf.mjs} +32 -2
- package/dist/{messages-CHWfj4ik.mjs → messages-D7dJJ7dx.mjs} +32 -2
- package/dist/{chunks/messages-DmrsEYQm2.mjs → messages-D8SS2hOs2.mjs} +32 -2
- package/dist/{chunks/messages-DQOk-dTH.mjs → messages-D9a5iSFC2.mjs} +32 -2
- package/dist/{messages-BSwhWcYw.mjs → messages-DAjtVSb6.mjs} +32 -2
- package/dist/{messages-BZXBdD_S2.mjs → messages-DBuHaabF2.mjs} +32 -2
- package/dist/{chunks/messages-CuRN1_ep2.mjs → messages-DCjAu6M72.mjs} +32 -2
- package/dist/{messages-CKX9iXIb2.mjs → messages-DFlT_TM02.mjs} +32 -2
- package/dist/{chunks/messages-DlM9TmqS2.mjs → messages-DPECmAwT.mjs} +32 -2
- package/dist/{chunks/messages-DhGHk-Ma2.mjs → messages-DR2Lgl002.mjs} +32 -2
- package/dist/{messages-DDiP6yex.mjs → messages-DUPXmcZh.mjs} +32 -2
- package/dist/{chunks/messages-CoRQE_Jc.mjs → messages-DVReQ5EC.mjs} +32 -2
- package/dist/{chunks/messages-BvlSf_pu.mjs → messages-DaZkRhoM.mjs} +32 -2
- package/dist/{chunks/messages-B9zocutJ.mjs → messages-Dc93MR86.mjs} +32 -2
- package/dist/{messages-Dc7ZzqYN.mjs → messages-Dd4OTpH3.mjs} +32 -2
- package/dist/{chunks/messages-BsYzg2le.mjs → messages-DffJ5W5G.mjs} +32 -2
- package/dist/{messages-D8iCBMg7.mjs → messages-DjWAR34D.mjs} +32 -2
- package/dist/{messages-BzZ8LahA2.mjs → messages-DkaJV53s2.mjs} +32 -2
- package/dist/{chunks/messages-stUQR58d.mjs → messages-Dl7LQ_fI.mjs} +32 -2
- package/dist/{chunks/messages-B_fFjpX12.mjs → messages-DlEdd01l2.mjs} +32 -2
- package/dist/{chunks/messages-5ohIWynJ.mjs → messages-ItP2i78l.mjs} +32 -2
- package/dist/{messages-DDJOu049.mjs → messages-Oqm_fCLp.mjs} +32 -2
- package/dist/{chunks/messages-DrXNb1gu.mjs → messages-UpoT1AS6.mjs} +32 -2
- package/dist/{chunks/messages-COkQfKa72.mjs → messages-Z8dpjy_K2.mjs} +32 -2
- package/dist/{messages-mVLfVtQX2.mjs → messages-ierNgYE02.mjs} +32 -2
- package/dist/{messages-DToWAonn2.mjs → messages-ikSI7M732.mjs} +32 -2
- package/dist/{chunks/messages-DKCoHa5D.mjs → messages-olK9oNtb.mjs} +32 -2
- package/dist/{messages-CsnglxbV2.mjs → messages-rgXeOQMh2.mjs} +32 -2
- package/dist/{chunks/messages-CDJLoStb.mjs → messages-syo0DKqf.mjs} +32 -2
- package/dist/{chunks/messages-BgaGPFuy2.mjs → messages-tFDVfvWL.mjs} +32 -2
- package/dist/react.mjs +2 -2
- package/dist/tools.mjs +3 -3
- package/dist/vendor.LICENSE.txt +34 -0
- package/package.json +3 -1
- package/src/components/i18n/locales/am/messages.json +32 -2
- package/src/components/i18n/locales/ar/messages.json +32 -2
- package/src/components/i18n/locales/az/messages.json +32 -2
- package/src/components/i18n/locales/bg/messages.json +32 -2
- package/src/components/i18n/locales/bn/messages.json +32 -2
- package/src/components/i18n/locales/bs/messages.json +32 -2
- package/src/components/i18n/locales/cs/messages.json +32 -2
- package/src/components/i18n/locales/da/messages.json +32 -2
- package/src/components/i18n/locales/de/messages.json +32 -2
- package/src/components/i18n/locales/dv/messages.json +32 -2
- package/src/components/i18n/locales/el/messages.json +32 -2
- package/src/components/i18n/locales/en/messages.json +31 -1
- package/src/components/i18n/locales/es/messages.json +32 -2
- package/src/components/i18n/locales/et/messages.json +32 -2
- package/src/components/i18n/locales/fa/messages.json +32 -2
- package/src/components/i18n/locales/fi/messages.json +32 -2
- package/src/components/i18n/locales/fil/messages.json +32 -2
- package/src/components/i18n/locales/fr/messages.json +32 -2
- package/src/components/i18n/locales/gu/messages.json +32 -2
- package/src/components/i18n/locales/he/messages.json +32 -2
- package/src/components/i18n/locales/hi/messages.json +32 -2
- package/src/components/i18n/locales/hr/messages.json +32 -2
- package/src/components/i18n/locales/hu/messages.json +32 -2
- package/src/components/i18n/locales/hy/messages.json +32 -2
- package/src/components/i18n/locales/id/messages.json +32 -2
- package/src/components/i18n/locales/it/messages.json +32 -2
- package/src/components/i18n/locales/ja/messages.json +32 -2
- package/src/components/i18n/locales/ka/messages.json +32 -2
- package/src/components/i18n/locales/km/messages.json +32 -2
- package/src/components/i18n/locales/kn/messages.json +32 -2
- package/src/components/i18n/locales/ko/messages.json +32 -2
- package/src/components/i18n/locales/ku/messages.json +32 -2
- package/src/components/i18n/locales/lo/messages.json +32 -2
- package/src/components/i18n/locales/lt/messages.json +32 -2
- package/src/components/i18n/locales/lv/messages.json +32 -2
- package/src/components/i18n/locales/mk/messages.json +32 -2
- package/src/components/i18n/locales/ml/messages.json +32 -2
- package/src/components/i18n/locales/mn/messages.json +32 -2
- package/src/components/i18n/locales/mr/messages.json +32 -2
- package/src/components/i18n/locales/ms/messages.json +32 -2
- package/src/components/i18n/locales/my/messages.json +32 -2
- package/src/components/i18n/locales/ne/messages.json +32 -2
- package/src/components/i18n/locales/nl/messages.json +32 -2
- package/src/components/i18n/locales/no/messages.json +32 -2
- package/src/components/i18n/locales/pa/messages.json +32 -2
- package/src/components/i18n/locales/pl/messages.json +32 -2
- package/src/components/i18n/locales/ps/messages.json +32 -2
- package/src/components/i18n/locales/pt/messages.json +32 -2
- package/src/components/i18n/locales/ro/messages.json +32 -2
- package/src/components/i18n/locales/ru/messages.json +32 -2
- package/src/components/i18n/locales/sd/messages.json +32 -2
- package/src/components/i18n/locales/si/messages.json +32 -2
- package/src/components/i18n/locales/sk/messages.json +32 -2
- package/src/components/i18n/locales/sl/messages.json +32 -2
- package/src/components/i18n/locales/sq/messages.json +32 -2
- package/src/components/i18n/locales/sr/messages.json +32 -2
- package/src/components/i18n/locales/sv/messages.json +32 -2
- package/src/components/i18n/locales/sw/messages.json +32 -2
- package/src/components/i18n/locales/ta/messages.json +32 -2
- package/src/components/i18n/locales/te/messages.json +32 -2
- package/src/components/i18n/locales/th/messages.json +32 -2
- package/src/components/i18n/locales/tr/messages.json +32 -2
- package/src/components/i18n/locales/ug/messages.json +32 -2
- package/src/components/i18n/locales/uk/messages.json +32 -2
- package/src/components/i18n/locales/ur/messages.json +32 -2
- package/src/components/i18n/locales/vi/messages.json +32 -2
- package/src/components/i18n/locales/yi/messages.json +32 -2
- package/src/components/i18n/locales/zh/messages.json +32 -2
- package/src/components/icons/index.ts +98 -0
- package/src/components/modules/api/i18n.ts +1 -0
- package/src/components/modules/blockEvents/composers/keyboardNavigation.ts +22 -5
- package/src/components/modules/blockManager/operations.ts +1 -0
- package/src/components/modules/toolbar/index.ts +102 -7
- package/src/components/modules/toolbar/plus-button.ts +17 -5
- package/src/components/modules/uiControllers/controllers/blockHover.ts +36 -9
- package/src/components/modules/uiControllers/handlers/touch.ts +20 -8
- package/src/components/tools/factory.ts +4 -0
- package/src/components/ui/toolbox.ts +38 -3
- package/src/components/utils/popover/popover-desktop.ts +48 -71
- package/src/components/utils/popover/popover-position.ts +105 -0
- package/src/stories/MarkerColors.stories.ts +8 -1
- package/src/styles/main.css +121 -17
- package/src/tools/callout/block-operations.ts +17 -0
- package/src/tools/callout/callout-keyboard.ts +45 -0
- package/src/tools/callout/constants.ts +30 -0
- package/src/tools/callout/dom-builder.ts +53 -0
- package/src/tools/callout/emoji-picker/emoji-data.ts +105 -0
- package/src/tools/callout/emoji-picker/emoji-locale.ts +165 -0
- package/src/tools/callout/emoji-picker/index.ts +762 -0
- package/src/tools/callout/emoji-picker/locales/am.json +1 -0
- package/src/tools/callout/emoji-picker/locales/ar.json +1 -0
- package/src/tools/callout/emoji-picker/locales/az.json +1 -0
- package/src/tools/callout/emoji-picker/locales/bg.json +1 -0
- package/src/tools/callout/emoji-picker/locales/bn.json +1 -0
- package/src/tools/callout/emoji-picker/locales/bs.json +1 -0
- package/src/tools/callout/emoji-picker/locales/cs.json +1 -0
- package/src/tools/callout/emoji-picker/locales/da.json +1 -0
- package/src/tools/callout/emoji-picker/locales/de.json +1 -0
- package/src/tools/callout/emoji-picker/locales/el.json +1 -0
- package/src/tools/callout/emoji-picker/locales/es.json +1 -0
- package/src/tools/callout/emoji-picker/locales/et.json +1 -0
- package/src/tools/callout/emoji-picker/locales/fa.json +1 -0
- package/src/tools/callout/emoji-picker/locales/fi.json +1 -0
- package/src/tools/callout/emoji-picker/locales/fil.json +1 -0
- package/src/tools/callout/emoji-picker/locales/fr.json +1 -0
- package/src/tools/callout/emoji-picker/locales/gu.json +1 -0
- package/src/tools/callout/emoji-picker/locales/he.json +1 -0
- package/src/tools/callout/emoji-picker/locales/hi.json +1 -0
- package/src/tools/callout/emoji-picker/locales/hr.json +1 -0
- package/src/tools/callout/emoji-picker/locales/hu.json +1 -0
- package/src/tools/callout/emoji-picker/locales/hy.json +1 -0
- package/src/tools/callout/emoji-picker/locales/id.json +1 -0
- package/src/tools/callout/emoji-picker/locales/it.json +1 -0
- package/src/tools/callout/emoji-picker/locales/ja.json +1 -0
- package/src/tools/callout/emoji-picker/locales/ka.json +1 -0
- package/src/tools/callout/emoji-picker/locales/km.json +1 -0
- package/src/tools/callout/emoji-picker/locales/kn.json +1 -0
- package/src/tools/callout/emoji-picker/locales/ko.json +1 -0
- package/src/tools/callout/emoji-picker/locales/ku.json +1 -0
- package/src/tools/callout/emoji-picker/locales/lo.json +1 -0
- package/src/tools/callout/emoji-picker/locales/lt.json +1 -0
- package/src/tools/callout/emoji-picker/locales/lv.json +1 -0
- package/src/tools/callout/emoji-picker/locales/mk.json +1 -0
- package/src/tools/callout/emoji-picker/locales/ml.json +1 -0
- package/src/tools/callout/emoji-picker/locales/mn.json +1 -0
- package/src/tools/callout/emoji-picker/locales/mr.json +1 -0
- package/src/tools/callout/emoji-picker/locales/ms.json +1 -0
- package/src/tools/callout/emoji-picker/locales/my.json +1 -0
- package/src/tools/callout/emoji-picker/locales/ne.json +1 -0
- package/src/tools/callout/emoji-picker/locales/nl.json +1 -0
- package/src/tools/callout/emoji-picker/locales/no.json +1 -0
- package/src/tools/callout/emoji-picker/locales/pa.json +1 -0
- package/src/tools/callout/emoji-picker/locales/pl.json +1 -0
- package/src/tools/callout/emoji-picker/locales/ps.json +1 -0
- package/src/tools/callout/emoji-picker/locales/pt.json +1 -0
- package/src/tools/callout/emoji-picker/locales/ro.json +1 -0
- package/src/tools/callout/emoji-picker/locales/ru.json +1 -0
- package/src/tools/callout/emoji-picker/locales/sd.json +1 -0
- package/src/tools/callout/emoji-picker/locales/si.json +1 -0
- package/src/tools/callout/emoji-picker/locales/sk.json +1 -0
- package/src/tools/callout/emoji-picker/locales/sl.json +1 -0
- package/src/tools/callout/emoji-picker/locales/sq.json +1 -0
- package/src/tools/callout/emoji-picker/locales/sr.json +1 -0
- package/src/tools/callout/emoji-picker/locales/sv.json +1 -0
- package/src/tools/callout/emoji-picker/locales/sw.json +1 -0
- package/src/tools/callout/emoji-picker/locales/ta.json +1 -0
- package/src/tools/callout/emoji-picker/locales/te.json +1 -0
- package/src/tools/callout/emoji-picker/locales/th.json +1 -0
- package/src/tools/callout/emoji-picker/locales/tr.json +1 -0
- package/src/tools/callout/emoji-picker/locales/ug.json +1 -0
- package/src/tools/callout/emoji-picker/locales/uk.json +1 -0
- package/src/tools/callout/emoji-picker/locales/ur.json +1 -0
- package/src/tools/callout/emoji-picker/locales/vi.json +1 -0
- package/src/tools/callout/emoji-picker/locales/zh.json +1 -0
- package/src/tools/callout/index.ts +338 -0
- package/src/tools/callout/types.ts +11 -0
- package/src/tools/header/header-toggle-keyboard.ts +3 -2
- package/src/tools/header/index.ts +1 -1
- package/src/tools/index.ts +2 -0
- package/src/tools/toggle/index.ts +1 -1
- package/src/tools/toggle/toggle-keyboard.ts +29 -1
- package/types/api/i18n.d.ts +7 -0
- package/types/tools-entry.d.ts +0 -4
- /package/dist/chunks/{i18next-DymC16cN.mjs → i18next-Ch0gVA3V.mjs} +0 -0
- /package/dist/chunks/{notifier-BqYxvxnV.mjs → notifier-Butv4Dvo.mjs} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $ as e,
|
|
2
|
-
import { t as
|
|
3
|
-
import { n as
|
|
1
|
+
import { $ as e, $t as t, A as n, At as r, B as i, Ct as a, D as o, Dt as s, Et as c, F as l, Ft as u, G as d, Gn as f, Gt as p, H as m, Ht as h, I as g, J as ee, Jt as _, K as te, L as ne, M as re, Mt as ie, N as ae, Nt as oe, O as se, Ot as ce, P as le, Pt as ue, Q as de, Qt as fe, R as pe, Rn as me, Rt as he, Tt as ge, U as _e, Ut as v, V as ve, W as ye, Wn as y, X as be, Y as xe, Yt as b, Z as Se, _t as Ce, a as we, at as Te, bt as Ee, c as De, d as Oe, et as ke, f as Ae, ft as je, g as Me, gt as Ne, h as Pe, ht as Fe, i as Ie, it as Le, j as Re, jt as ze, kt as Be, l as Ve, lt as He, mn as Ue, mt as We, n as Ge, nt as Ke, o as qe, ot as Je, p as Ye, pt as Xe, q as Ze, r as Qe, rt as $e, s as et, st as tt, t as nt, tt as rt, u as x, ut as it, v as at, vt as ot, wt as st, xt as ct, yt as lt, z as ut } from "./constants-PWnlOOrQ.mjs";
|
|
2
|
+
import { t as S } from "./objectSpread2-CyPxu8-u.mjs";
|
|
3
|
+
import { n as C } from "./tw-DmW6-pCY.mjs";
|
|
4
4
|
//#region src/components/utils/html.ts
|
|
5
|
-
var
|
|
5
|
+
var dt = (e) => {
|
|
6
6
|
if (!e || !e.includes("data-blok-fake-background")) return e;
|
|
7
7
|
let t = document.createElement("div");
|
|
8
8
|
return t.innerHTML = e, t.querySelectorAll("[data-blok-fake-background=\"true\"]").forEach((e) => {
|
|
@@ -12,7 +12,7 @@ var et = (e) => {
|
|
|
12
12
|
t.removeChild(e);
|
|
13
13
|
}
|
|
14
14
|
}), t.innerHTML;
|
|
15
|
-
},
|
|
15
|
+
}, w = [
|
|
16
16
|
"empty:before:pointer-events-none",
|
|
17
17
|
"empty:before:text-gray-text",
|
|
18
18
|
"empty:before:cursor-text",
|
|
@@ -21,7 +21,7 @@ var et = (e) => {
|
|
|
21
21
|
"data-[blok-empty=true]:before:text-gray-text",
|
|
22
22
|
"data-[blok-empty=true]:before:cursor-text",
|
|
23
23
|
"data-[blok-empty=true]:before:content-[attr(data-placeholder)]"
|
|
24
|
-
],
|
|
24
|
+
], ft = [
|
|
25
25
|
"empty:before:pointer-events-none",
|
|
26
26
|
"empty:before:text-gray-text",
|
|
27
27
|
"empty:before:cursor-text",
|
|
@@ -30,7 +30,7 @@ var et = (e) => {
|
|
|
30
30
|
"data-[empty=true]:before:text-gray-text",
|
|
31
31
|
"data-[empty=true]:before:cursor-text",
|
|
32
32
|
"data-[empty=true]:before:content-[attr(data-blok-placeholder-active)]"
|
|
33
|
-
],
|
|
33
|
+
], pt = [
|
|
34
34
|
"empty:focus:before:pointer-events-none",
|
|
35
35
|
"empty:focus:before:text-gray-text",
|
|
36
36
|
"empty:focus:before:cursor-text",
|
|
@@ -39,7 +39,7 @@ var et = (e) => {
|
|
|
39
39
|
"[&[data-empty=true]:focus]:before:text-gray-text",
|
|
40
40
|
"[&[data-empty=true]:focus]:before:cursor-text",
|
|
41
41
|
"[&[data-empty=true]:focus]:before:content-[attr(data-blok-placeholder-active)]"
|
|
42
|
-
],
|
|
42
|
+
], mt = [
|
|
43
43
|
"empty:in-data-[blok-empty=true]:before:pointer-events-none",
|
|
44
44
|
"empty:in-data-[blok-empty=true]:before:text-gray-text",
|
|
45
45
|
"empty:in-data-[blok-empty=true]:before:cursor-text",
|
|
@@ -48,25 +48,25 @@ var et = (e) => {
|
|
|
48
48
|
"[[data-blok-empty=true]_&[data-empty=true]]:before:text-gray-text",
|
|
49
49
|
"[[data-blok-empty=true]_&[data-empty=true]]:before:cursor-text",
|
|
50
50
|
"[[data-blok-empty=true]_&[data-empty=true]]:before:content-[attr(data-blok-placeholder-active)]"
|
|
51
|
-
],
|
|
51
|
+
], ht = (e) => {
|
|
52
52
|
let t = e.innerHTML.trim();
|
|
53
53
|
return t === "" || t === "<br>";
|
|
54
|
-
},
|
|
54
|
+
}, gt = (e) => {
|
|
55
55
|
e.innerHTML === "<br>" && (e.innerHTML = "");
|
|
56
56
|
let t = window.getSelection();
|
|
57
57
|
if (!t) return;
|
|
58
58
|
let n = document.createRange();
|
|
59
59
|
n.selectNodeContents(e), n.collapse(!0), t.removeAllRanges(), t.addRange(n);
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
e.setAttribute(n, t == null ? "" : t), e.addEventListener("focus", () =>
|
|
64
|
-
},
|
|
60
|
+
}, _t = (e) => {
|
|
61
|
+
ht(e) && gt(e);
|
|
62
|
+
}, vt = (e, t, n = "data-placeholder") => {
|
|
63
|
+
e.setAttribute(n, t == null ? "" : t), e.addEventListener("focus", () => _t(e));
|
|
64
|
+
}, yt, bt = (e) => {
|
|
65
65
|
let t = document.createElement("div");
|
|
66
66
|
t.innerHTML = e.trim();
|
|
67
67
|
let n = document.createDocumentFragment();
|
|
68
68
|
return n.append(...Array.from(t.childNodes)), n;
|
|
69
|
-
},
|
|
69
|
+
}, xt = class e {
|
|
70
70
|
static get DEFAULT_PLACEHOLDER() {
|
|
71
71
|
return "tools.paragraph.placeholder";
|
|
72
72
|
}
|
|
@@ -85,9 +85,9 @@ var et = (e) => {
|
|
|
85
85
|
}
|
|
86
86
|
drawView() {
|
|
87
87
|
let t = document.createElement("DIV");
|
|
88
|
-
t.className =
|
|
88
|
+
t.className = C(this.api.styles.block, e.WRAPPER_CLASSES, pt, mt), t.setAttribute(y.tool, "paragraph"), t.contentEditable = "false";
|
|
89
89
|
let n = this.buildInlineStyles();
|
|
90
|
-
return Object.keys(n).length > 0 && Object.assign(t.style, n), this._data.text ? t.innerHTML = this._data.text : this.readOnly && (t.innerHTML = "<br>"), this.readOnly || (t.contentEditable = "true", t.addEventListener("keyup", this.onKeyUp),
|
|
90
|
+
return Object.keys(n).length > 0 && Object.assign(t.style, n), this._data.text ? t.innerHTML = this._data.text : this.readOnly && (t.innerHTML = "<br>"), this.readOnly || (t.contentEditable = "true", t.addEventListener("keyup", this.onKeyUp), vt(t, this.api.i18n.t(this._placeholder), "data-blok-placeholder-active")), t;
|
|
91
91
|
}
|
|
92
92
|
render() {
|
|
93
93
|
return this._element = this.drawView(), this._element;
|
|
@@ -95,14 +95,14 @@ var et = (e) => {
|
|
|
95
95
|
merge(e) {
|
|
96
96
|
if (!this._element) return;
|
|
97
97
|
this._data.text += e.text;
|
|
98
|
-
let t =
|
|
98
|
+
let t = bt(e.text);
|
|
99
99
|
this._element.appendChild(t), this._element.normalize();
|
|
100
100
|
}
|
|
101
101
|
validate(e) {
|
|
102
102
|
return !(e.text.trim() === "" && !this._preserveBlank);
|
|
103
103
|
}
|
|
104
104
|
save(e) {
|
|
105
|
-
return { text:
|
|
105
|
+
return { text: dt(e.innerHTML) };
|
|
106
106
|
}
|
|
107
107
|
onPaste(e) {
|
|
108
108
|
let t = e.detail;
|
|
@@ -134,7 +134,7 @@ var et = (e) => {
|
|
|
134
134
|
}
|
|
135
135
|
static get toolbox() {
|
|
136
136
|
return {
|
|
137
|
-
icon:
|
|
137
|
+
icon: Fe,
|
|
138
138
|
title: "Text",
|
|
139
139
|
titleKey: "text",
|
|
140
140
|
searchTerms: [
|
|
@@ -145,7 +145,7 @@ var et = (e) => {
|
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
|
-
|
|
148
|
+
yt = xt, yt.WRAPPER_CLASSES = [
|
|
149
149
|
"leading-[1.5]",
|
|
150
150
|
"outline-hidden",
|
|
151
151
|
"mt-px",
|
|
@@ -155,54 +155,54 @@ ct = ut, ct.WRAPPER_CLASSES = [
|
|
|
155
155
|
];
|
|
156
156
|
//#endregion
|
|
157
157
|
//#region src/tools/toggle/dom-builder.ts
|
|
158
|
-
var
|
|
158
|
+
var St = (e) => {
|
|
159
159
|
let { data: t, readOnly: n, isOpen: r, keydownHandler: i, onArrowClick: a, onBodyPlaceholderClick: o } = e, s = document.createElement("div");
|
|
160
|
-
s.className =
|
|
160
|
+
s.className = we, s.setAttribute(y.tool, Ye), s.setAttribute(x.toggleOpen, String(r));
|
|
161
161
|
let c = document.createElement("div");
|
|
162
|
-
c.className =
|
|
163
|
-
let l =
|
|
162
|
+
c.className = Ae;
|
|
163
|
+
let l = Ct(r, a, {}, e.ariaLabels), u = Tt(t, n, i);
|
|
164
164
|
c.appendChild(l), c.appendChild(u);
|
|
165
|
-
let d =
|
|
166
|
-
return f.className =
|
|
165
|
+
let d = wt(o, e.bodyPlaceholderText), f = document.createElement("div");
|
|
166
|
+
return f.className = Oe, f.setAttribute(x.toggleChildren, ""), f.setAttribute("data-blok-mutation-free", "true"), f.id = `toggle-children-${Date.now()}-${Math.random().toString(36).slice(2)}`, l.setAttribute("aria-controls", f.id), s.appendChild(c), s.appendChild(d), s.appendChild(f), {
|
|
167
167
|
wrapper: s,
|
|
168
168
|
arrowElement: l,
|
|
169
169
|
contentElement: u,
|
|
170
170
|
bodyPlaceholderElement: d,
|
|
171
171
|
childContainerElement: f
|
|
172
172
|
};
|
|
173
|
-
},
|
|
173
|
+
}, Ct = (e, t, n = {}, r = {
|
|
174
174
|
collapse: "Collapse",
|
|
175
175
|
expand: "Expand"
|
|
176
176
|
}) => {
|
|
177
177
|
let i = document.createElement("span");
|
|
178
|
-
i.className =
|
|
178
|
+
i.className = Ie, i.setAttribute(x.toggleArrow, ""), i.setAttribute(y.mutationFree, "true"), i.setAttribute("role", "button"), i.setAttribute("tabindex", "0"), i.setAttribute("aria-label", e ? r.collapse : r.expand), i.setAttribute("aria-expanded", String(e)), n.contentEditableFalse === !0 && (i.contentEditable = "false"), i.innerHTML = Qe;
|
|
179
179
|
let a = i.querySelector("svg");
|
|
180
180
|
return a && (a.style.transition = "transform 200ms ease-in-out", e && (a.style.transform = "rotate(90deg)")), t && (i.addEventListener("click", (e) => {
|
|
181
181
|
e.stopPropagation(), t();
|
|
182
182
|
}), i.addEventListener("keydown", (e) => {
|
|
183
183
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), t());
|
|
184
184
|
})), i;
|
|
185
|
-
},
|
|
185
|
+
}, wt = (e, t) => {
|
|
186
186
|
let n = document.createElement("div");
|
|
187
|
-
return n.className =
|
|
188
|
-
},
|
|
187
|
+
return n.className = et, n.setAttribute(x.toggleBodyPlaceholder, ""), n.setAttribute("data-blok-mutation-free", "true"), n.textContent = t, e && n.addEventListener("click", e), n;
|
|
188
|
+
}, Tt = (e, t, n) => {
|
|
189
189
|
let r = document.createElement("div");
|
|
190
|
-
return r.className =
|
|
191
|
-
},
|
|
192
|
-
let t =
|
|
193
|
-
return t.contentElement &&
|
|
194
|
-
},
|
|
190
|
+
return r.className = C(De, ft, mt), r.setAttribute(x.toggleContent, ""), r.contentEditable = t ? "false" : "true", r.innerHTML = e.text, n && r.addEventListener("keydown", n), r;
|
|
191
|
+
}, Et = (e) => {
|
|
192
|
+
let t = St(e);
|
|
193
|
+
return t.contentElement && vt(t.contentElement, e.placeholder, "data-blok-placeholder-active"), t;
|
|
194
|
+
}, T = (e, t, n, r = {
|
|
195
195
|
collapse: "Collapse",
|
|
196
196
|
expand: "Expand"
|
|
197
197
|
}) => {
|
|
198
198
|
let i = e.querySelector("svg");
|
|
199
|
-
i && (i.style.transform = n ? "rotate(90deg)" : ""), e.setAttribute("aria-label", n ? r.collapse : r.expand), e.setAttribute("aria-expanded", String(n)), t.setAttribute(
|
|
200
|
-
},
|
|
199
|
+
i && (i.style.transform = n ? "rotate(90deg)" : ""), e.setAttribute("aria-label", n ? r.collapse : r.expand), e.setAttribute("aria-expanded", String(n)), t.setAttribute(x.toggleOpen, String(n));
|
|
200
|
+
}, Dt = (e, t, n, r, i) => {
|
|
201
201
|
let a = e.blocks.getChildren(t);
|
|
202
202
|
!n && r && i && r.contains(document.activeElement) && i.focus();
|
|
203
203
|
for (let e of a) r && e.holder.parentElement !== r && r.appendChild(e.holder), n ? e.holder.classList.remove("hidden") : e.holder.classList.add("hidden");
|
|
204
204
|
r && (n ? r.removeAttribute("aria-hidden") : r.setAttribute("aria-hidden", "true"));
|
|
205
|
-
},
|
|
205
|
+
}, Ot = (e, t, n, r, i) => {
|
|
206
206
|
if (e === null) return;
|
|
207
207
|
if (i) {
|
|
208
208
|
e.classList.add("hidden");
|
|
@@ -210,27 +210,33 @@ var dt = (e) => {
|
|
|
210
210
|
}
|
|
211
211
|
let a = t.blocks.getChildren(n);
|
|
212
212
|
r && a.length === 0 ? e.classList.remove("hidden") : e.classList.add("hidden");
|
|
213
|
-
},
|
|
213
|
+
}, kt = async (e) => {
|
|
214
214
|
var t;
|
|
215
215
|
let { api: n, blockId: r, data: i, getContentElement: a, syncContentFromDOM: o, isOpen: s } = e;
|
|
216
216
|
if (o(), r === void 0) return;
|
|
217
217
|
let c = a(), l = window.getSelection();
|
|
218
218
|
if (!c || !l || l.rangeCount === 0) return;
|
|
219
|
-
let { beforeContent: u, afterContent: d } =
|
|
219
|
+
let { beforeContent: u, afterContent: d } = Mt(c, l.getRangeAt(0)), f = (t = n.blocks.getBlockIndex(r)) == null ? n.blocks.getCurrentBlockIndex() : t;
|
|
220
220
|
if (s && d === "") {
|
|
221
|
-
let e = n.blocks.insertInsideParent(r,
|
|
222
|
-
n.caret.setToBlock(
|
|
221
|
+
let e = jt(n, r, f), t = n.blocks.insertInsideParent(r, e);
|
|
222
|
+
n.caret.setToBlock(t.id, "start");
|
|
223
223
|
return;
|
|
224
224
|
}
|
|
225
|
-
n.blocks.splitBlock(r, { text: u },
|
|
226
|
-
},
|
|
225
|
+
n.blocks.splitBlock(r, { text: u }, Ye, { text: d }, f + 1), i.text = u;
|
|
226
|
+
}, At = async (e, t) => {
|
|
227
227
|
let { api: n, blockId: r, data: i, getContentElement: a, syncContentFromDOM: o } = e;
|
|
228
228
|
if (o(), r === void 0) return;
|
|
229
229
|
let s = a();
|
|
230
|
-
if (!s || !
|
|
231
|
-
let
|
|
232
|
-
|
|
233
|
-
},
|
|
230
|
+
if (!s || !he(s)) return;
|
|
231
|
+
let c = i.text;
|
|
232
|
+
c === "" && (t.preventDefault(), await n.blocks.convert(r, "paragraph", { text: c }));
|
|
233
|
+
}, jt = (e, t, n) => {
|
|
234
|
+
var r;
|
|
235
|
+
let i = e.blocks.getChildren(t);
|
|
236
|
+
if (i.length === 0) return n + 1;
|
|
237
|
+
let a = i[i.length - 1], o = (r = e.blocks.getBlockIndex(a.id)) == null ? n : r;
|
|
238
|
+
return jt(e, a.id, o);
|
|
239
|
+
}, Mt = (e, t) => {
|
|
234
240
|
if (!e.lastChild) return {
|
|
235
241
|
beforeContent: "",
|
|
236
242
|
afterContent: ""
|
|
@@ -246,16 +252,16 @@ var dt = (e) => {
|
|
|
246
252
|
beforeContent: i.innerHTML,
|
|
247
253
|
afterContent: a.innerHTML
|
|
248
254
|
};
|
|
249
|
-
},
|
|
255
|
+
}, Nt = async (e) => {
|
|
250
256
|
var t;
|
|
251
257
|
let { api: n, blockId: r, getContentElement: i, syncContentFromDOM: a, isOpen: o, currentLevel: s } = e;
|
|
252
258
|
if (a(), r === void 0) return;
|
|
253
259
|
let c = i(), l = window.getSelection();
|
|
254
260
|
if (!c || !l || l.rangeCount === 0) return;
|
|
255
|
-
let { beforeContent: u, afterContent: d } =
|
|
261
|
+
let { beforeContent: u, afterContent: d } = Mt(c, l.getRangeAt(0)), f = (t = n.blocks.getBlockIndex(r)) == null ? n.blocks.getCurrentBlockIndex() : t;
|
|
256
262
|
if (o && d === "") {
|
|
257
|
-
let e = n.blocks.insertInsideParent(r,
|
|
258
|
-
n.caret.setToBlock(
|
|
263
|
+
let e = jt(n, r, f), t = n.blocks.insertInsideParent(r, e);
|
|
264
|
+
n.caret.setToBlock(t.id, "start");
|
|
259
265
|
return;
|
|
260
266
|
}
|
|
261
267
|
n.blocks.splitBlock(r, {
|
|
@@ -267,17 +273,17 @@ var dt = (e) => {
|
|
|
267
273
|
level: s,
|
|
268
274
|
isToggleable: !0
|
|
269
275
|
}, f + 1);
|
|
270
|
-
},
|
|
276
|
+
}, Pt = async (e, t) => {
|
|
271
277
|
let { api: n, blockId: r, getText: i, getContentElement: a, syncContentFromDOM: o, currentLevel: s } = e;
|
|
272
278
|
if (o(), r === void 0) return;
|
|
273
|
-
let
|
|
274
|
-
if (!
|
|
275
|
-
let
|
|
276
|
-
|
|
277
|
-
text:
|
|
279
|
+
let c = a();
|
|
280
|
+
if (!c || !he(c)) return;
|
|
281
|
+
let l = i();
|
|
282
|
+
l === "" && (t.preventDefault(), await n.blocks.convert(r, "header", {
|
|
283
|
+
text: l,
|
|
278
284
|
level: s
|
|
279
285
|
}));
|
|
280
|
-
},
|
|
286
|
+
}, Ft, It = class e {
|
|
281
287
|
constructor({ data: e, config: t, api: n, readOnly: r, block: i }) {
|
|
282
288
|
var a;
|
|
283
289
|
this._arrowElement = null, this._wrapper = null, this._headerRow = null, this._childContainerElement = null, this._bodyPlaceholderElement = null, this.handleKeyDown = (e) => {
|
|
@@ -285,10 +291,10 @@ var dt = (e) => {
|
|
|
285
291
|
e.preventDefault(), this.handleEnter();
|
|
286
292
|
return;
|
|
287
293
|
}
|
|
288
|
-
e.key === "Backspace" &&
|
|
294
|
+
e.key === "Backspace" && Pt(this.createKeyboardContext(), e);
|
|
289
295
|
}, this.handleBlockChanged = (e) => {
|
|
290
296
|
this.isBlockChangedPayload(e) && (e.event.type === "block-removed" || e.event.type === "block-added") && this.updateBodyPlaceholderVisibility();
|
|
291
|
-
}, this.api = n, this.readOnly = r, this._settings = t || {}, this._data = this.normalizeData(e), this._isOpen = (a = this._data.isOpen) == null ? !
|
|
297
|
+
}, this.api = n, this.readOnly = r, this._settings = t || {}, this._data = this.normalizeData(e), this._isOpen = (a = this._data.isOpen) == null ? !0 : a, this._element = this.getTag(), i && (this.blockId = i.id), !r && this._data.isToggleable && this.api.events.on("block changed", this.handleBlockChanged);
|
|
292
298
|
}
|
|
293
299
|
get _CSS() {
|
|
294
300
|
return {
|
|
@@ -311,7 +317,7 @@ var dt = (e) => {
|
|
|
311
317
|
if (e.isToggleable === !0 && (r.isToggleable = !0), typeof e.isOpen == "boolean" && (r.isOpen = e.isOpen), r.text) {
|
|
312
318
|
let e = document.createElement("div");
|
|
313
319
|
e.innerHTML = r.text;
|
|
314
|
-
let t = e.querySelector(`[${
|
|
320
|
+
let t = e.querySelector(`[${x.toggleArrow}]`);
|
|
315
321
|
t && (t.remove(), r.text = e.innerHTML);
|
|
316
322
|
}
|
|
317
323
|
return r;
|
|
@@ -326,13 +332,13 @@ var dt = (e) => {
|
|
|
326
332
|
this.api.events.off("block changed", this.handleBlockChanged), this._element.removeEventListener("keydown", this.handleKeyDown);
|
|
327
333
|
}
|
|
328
334
|
expand() {
|
|
329
|
-
!this._data.isToggleable || this._isOpen || (this._isOpen = !0, this._arrowElement && this._element &&
|
|
335
|
+
!this._data.isToggleable || this._isOpen || (this._isOpen = !0, this._arrowElement && this._element && T(this._arrowElement, this._element, this._isOpen, {
|
|
330
336
|
collapse: this.api.i18n.t("tools.toggle.ariaLabelCollapse"),
|
|
331
337
|
expand: this.api.i18n.t("tools.toggle.ariaLabelExpand")
|
|
332
338
|
}), this.updateChildrenVisibility(), this.updateBodyPlaceholderVisibility());
|
|
333
339
|
}
|
|
334
340
|
collapse() {
|
|
335
|
-
!this._data.isToggleable || !this._isOpen || (this._isOpen = !1, this._arrowElement && this._element &&
|
|
341
|
+
!this._data.isToggleable || !this._isOpen || (this._isOpen = !1, this._arrowElement && this._element && T(this._arrowElement, this._element, this._isOpen, {
|
|
336
342
|
collapse: this.api.i18n.t("tools.toggle.ariaLabelCollapse"),
|
|
337
343
|
expand: this.api.i18n.t("tools.toggle.ariaLabelExpand")
|
|
338
344
|
}), this.updateChildrenVisibility(), this.updateBodyPlaceholderVisibility());
|
|
@@ -360,14 +366,14 @@ var dt = (e) => {
|
|
|
360
366
|
merge(e) {
|
|
361
367
|
let t = document.createElement("div");
|
|
362
368
|
t.innerHTML = e.text;
|
|
363
|
-
let n = t.querySelector(`[${
|
|
369
|
+
let n = t.querySelector(`[${x.toggleArrow}]`);
|
|
364
370
|
n && n.remove(), this._element.insertAdjacentHTML("beforeend", t.innerHTML);
|
|
365
371
|
}
|
|
366
372
|
validate(e) {
|
|
367
373
|
return typeof e.text == "string";
|
|
368
374
|
}
|
|
369
375
|
setData(e) {
|
|
370
|
-
return this._data = this.normalizeData(e), typeof e.text == "string" && (this._element.innerHTML = e.text), this._data.isToggleable && typeof this._data.isOpen == "boolean" && (this._isOpen = this._data.isOpen, this._arrowElement && this._element &&
|
|
376
|
+
return this._data = this.normalizeData(e), typeof e.text == "string" && (this._element.innerHTML = e.text), this._data.isToggleable && typeof this._data.isOpen == "boolean" && (this._isOpen = this._data.isOpen, this._arrowElement && this._element && T(this._arrowElement, this._element, this._isOpen, {
|
|
371
377
|
collapse: this.api.i18n.t("tools.toggle.ariaLabelCollapse"),
|
|
372
378
|
expand: this.api.i18n.t("tools.toggle.ariaLabelExpand")
|
|
373
379
|
}), this.updateChildrenVisibility(), this.updateBodyPlaceholderVisibility()), !0;
|
|
@@ -406,13 +412,13 @@ var dt = (e) => {
|
|
|
406
412
|
e.innerHTML = this._element.innerHTML, this._element.parentNode.replaceChild(e, this._element), this._element = e;
|
|
407
413
|
}
|
|
408
414
|
if (t.text !== void 0 && (this._element.innerHTML = this._data.text || ""), this._data.isToggleable) {
|
|
409
|
-
if (this._element.setAttribute(
|
|
410
|
-
else if (!this._wrapper.querySelector(`[${
|
|
415
|
+
if (this._element.setAttribute(x.toggleOpen, String(this._isOpen)), this._element.className = C(e.BASE_STYLES, this.currentLevel.styles, w, "pl-8"), !this._wrapper) this.createToggleWrapper();
|
|
416
|
+
else if (!this._wrapper.querySelector(`[${x.toggleArrow}]`)) {
|
|
411
417
|
var n;
|
|
412
418
|
let e = this.buildArrow();
|
|
413
419
|
this._arrowElement = e, ((n = this._headerRow) == null ? this._wrapper : n).prepend(e);
|
|
414
420
|
}
|
|
415
|
-
} else if (this._element.removeAttribute(
|
|
421
|
+
} else if (this._element.removeAttribute(x.toggleOpen), this._element.className = C(e.BASE_STYLES, this.currentLevel.styles, w), this._arrowElement = null, this._wrapper) {
|
|
416
422
|
let e = this._wrapper.parentNode;
|
|
417
423
|
e && e.replaceChild(this._element, this._wrapper), this._wrapper = null, this._headerRow = null;
|
|
418
424
|
}
|
|
@@ -422,14 +428,14 @@ var dt = (e) => {
|
|
|
422
428
|
}
|
|
423
429
|
getTag() {
|
|
424
430
|
let t = document.createElement(this.currentLevel.tag);
|
|
425
|
-
t.innerHTML = this._data.text || "", t.className =
|
|
431
|
+
t.innerHTML = this._data.text || "", t.className = C(e.BASE_STYLES, this.currentLevel.styles, w, this._data.isToggleable ? "pl-8" : "");
|
|
426
432
|
let { inlineStyles: n } = this.currentLevel;
|
|
427
|
-
n && Object.assign(t.style, n), t.setAttribute(
|
|
433
|
+
n && Object.assign(t.style, n), t.setAttribute(y.tool, "header"), t.contentEditable = this.readOnly ? "false" : "true", this._data.isToggleable && t.setAttribute(x.toggleOpen, String(this._isOpen));
|
|
428
434
|
let r = this.api.i18n.t(this.currentLevel.nameKey), i = this.resolvePlaceholderText(r);
|
|
429
|
-
return this.readOnly ? t.setAttribute("data-placeholder", i) :
|
|
435
|
+
return this.readOnly ? t.setAttribute("data-placeholder", i) : vt(t, i), !this.readOnly && this._data.isToggleable && t.addEventListener("keydown", this.handleKeyDown), t;
|
|
430
436
|
}
|
|
431
437
|
buildArrow() {
|
|
432
|
-
let e =
|
|
438
|
+
let e = Ct(this._isOpen, () => this.toggleOpen(), {}, {
|
|
433
439
|
collapse: this.api.i18n.t("tools.toggle.ariaLabelCollapse"),
|
|
434
440
|
expand: this.api.i18n.t("tools.toggle.ariaLabelExpand")
|
|
435
441
|
});
|
|
@@ -441,9 +447,9 @@ var dt = (e) => {
|
|
|
441
447
|
let n = this.buildArrow();
|
|
442
448
|
this._arrowElement = n, t.appendChild(n), t.appendChild(this._element), e.appendChild(t);
|
|
443
449
|
let r = document.createElement("div");
|
|
444
|
-
r.className =
|
|
450
|
+
r.className = C(et, "pl-8"), r.setAttribute(x.toggleBodyPlaceholder, ""), r.setAttribute("data-blok-mutation-free", "true"), r.textContent = this.api.i18n.t("tools.toggle.bodyPlaceholder"), this.readOnly || r.addEventListener("click", () => this.handleBodyPlaceholderClick()), this._bodyPlaceholderElement = r, e.appendChild(r);
|
|
445
451
|
let i = document.createElement("div");
|
|
446
|
-
return i.className = "pl-8", i.setAttribute(
|
|
452
|
+
return i.className = "pl-8", i.setAttribute(x.toggleChildren, ""), i.setAttribute("data-blok-mutation-free", "true"), this._childContainerElement = i, e.appendChild(i), e;
|
|
447
453
|
}
|
|
448
454
|
createToggleWrapper() {
|
|
449
455
|
let e = this._element.parentNode;
|
|
@@ -468,19 +474,19 @@ var dt = (e) => {
|
|
|
468
474
|
}
|
|
469
475
|
async handleEnter() {
|
|
470
476
|
var e = this;
|
|
471
|
-
await
|
|
477
|
+
await Nt(e.createKeyboardContext()), e.updateChildrenVisibility(), e.updateBodyPlaceholderVisibility();
|
|
472
478
|
}
|
|
473
479
|
toggleOpen() {
|
|
474
|
-
this._isOpen = !this._isOpen, this._arrowElement && this._element &&
|
|
480
|
+
this._isOpen = !this._isOpen, this._arrowElement && this._element && T(this._arrowElement, this._element, this._isOpen, {
|
|
475
481
|
collapse: this.api.i18n.t("tools.toggle.ariaLabelCollapse"),
|
|
476
482
|
expand: this.api.i18n.t("tools.toggle.ariaLabelExpand")
|
|
477
483
|
}), this.updateChildrenVisibility(), this.updateBodyPlaceholderVisibility();
|
|
478
484
|
}
|
|
479
485
|
updateChildrenVisibility() {
|
|
480
|
-
this.blockId !== void 0 &&
|
|
486
|
+
this.blockId !== void 0 && Dt(this.api, this.blockId, this._isOpen, this._childContainerElement, this._arrowElement);
|
|
481
487
|
}
|
|
482
488
|
updateBodyPlaceholderVisibility() {
|
|
483
|
-
this.blockId !== void 0 &&
|
|
489
|
+
this.blockId !== void 0 && Ot(this._bodyPlaceholderElement, this.api, this.blockId, this._isOpen, this.readOnly);
|
|
484
490
|
}
|
|
485
491
|
handleBodyPlaceholderClick() {
|
|
486
492
|
var e;
|
|
@@ -558,9 +564,9 @@ var dt = (e) => {
|
|
|
558
564
|
],
|
|
559
565
|
shortcut: "#".repeat(e.number)
|
|
560
566
|
})), n = {
|
|
561
|
-
1:
|
|
562
|
-
2:
|
|
563
|
-
3:
|
|
567
|
+
1: Ne,
|
|
568
|
+
2: Ce,
|
|
569
|
+
3: ot
|
|
564
570
|
}, r = e.DEFAULT_LEVELS.filter((e) => e.number <= 3).map((e) => ({
|
|
565
571
|
icon: n[e.number],
|
|
566
572
|
title: `Toggle heading ${e.number}`,
|
|
@@ -581,13 +587,13 @@ var dt = (e) => {
|
|
|
581
587
|
return [...t, ...r];
|
|
582
588
|
}
|
|
583
589
|
};
|
|
584
|
-
|
|
590
|
+
Ft = It, Ft.BASE_STYLES = "py-[7px] px-[2px] m-0 leading-[1.3]! outline-hidden [&_p]:p-0! [&_p]:m-0! [&_div]:p-0! [&_div]:m-0!", Ft.DEFAULT_LEVELS = [
|
|
585
591
|
{
|
|
586
592
|
number: 1,
|
|
587
593
|
tag: "H1",
|
|
588
594
|
nameKey: "tools.header.heading1",
|
|
589
595
|
name: "Heading 1",
|
|
590
|
-
icon:
|
|
596
|
+
icon: m,
|
|
591
597
|
styles: "text-3xl font-semibold mt-8 mb-px"
|
|
592
598
|
},
|
|
593
599
|
{
|
|
@@ -595,7 +601,7 @@ Ct = wt, Ct.BASE_STYLES = "py-[7px] px-[2px] m-0 leading-[1.3]! outline-hidden [
|
|
|
595
601
|
tag: "H2",
|
|
596
602
|
nameKey: "tools.header.heading2",
|
|
597
603
|
name: "Heading 2",
|
|
598
|
-
icon:
|
|
604
|
+
icon: _e,
|
|
599
605
|
styles: "text-2xl font-semibold mt-[26px] mb-px"
|
|
600
606
|
},
|
|
601
607
|
{
|
|
@@ -603,7 +609,7 @@ Ct = wt, Ct.BASE_STYLES = "py-[7px] px-[2px] m-0 leading-[1.3]! outline-hidden [
|
|
|
603
609
|
tag: "H3",
|
|
604
610
|
nameKey: "tools.header.heading3",
|
|
605
611
|
name: "Heading 3",
|
|
606
|
-
icon:
|
|
612
|
+
icon: ye,
|
|
607
613
|
styles: "text-xl font-semibold mt-5 mb-px"
|
|
608
614
|
},
|
|
609
615
|
{
|
|
@@ -611,7 +617,7 @@ Ct = wt, Ct.BASE_STYLES = "py-[7px] px-[2px] m-0 leading-[1.3]! outline-hidden [
|
|
|
611
617
|
tag: "H4",
|
|
612
618
|
nameKey: "tools.header.heading4",
|
|
613
619
|
name: "Heading 4",
|
|
614
|
-
icon:
|
|
620
|
+
icon: d,
|
|
615
621
|
styles: "text-lg font-semibold mt-3 mb-px"
|
|
616
622
|
},
|
|
617
623
|
{
|
|
@@ -619,7 +625,7 @@ Ct = wt, Ct.BASE_STYLES = "py-[7px] px-[2px] m-0 leading-[1.3]! outline-hidden [
|
|
|
619
625
|
tag: "H5",
|
|
620
626
|
nameKey: "tools.header.heading5",
|
|
621
627
|
name: "Heading 5",
|
|
622
|
-
icon:
|
|
628
|
+
icon: te,
|
|
623
629
|
styles: "text-base font-semibold mt-3 mb-px"
|
|
624
630
|
},
|
|
625
631
|
{
|
|
@@ -627,16 +633,16 @@ Ct = wt, Ct.BASE_STYLES = "py-[7px] px-[2px] m-0 leading-[1.3]! outline-hidden [
|
|
|
627
633
|
tag: "H6",
|
|
628
634
|
nameKey: "tools.header.heading6",
|
|
629
635
|
name: "Heading 6",
|
|
630
|
-
icon:
|
|
636
|
+
icon: Ze,
|
|
631
637
|
styles: "text-sm font-semibold mt-3 mb-px"
|
|
632
638
|
}
|
|
633
639
|
];
|
|
634
640
|
//#endregion
|
|
635
641
|
//#region src/tools/list/constants.ts
|
|
636
|
-
var
|
|
642
|
+
var Lt = "outline-hidden py-[7px] mt-[2px] mb-px", Rt = "outline-hidden pl-0.5 leading-[1.5] items-start", zt = "flex items-start pl-0.5", Bt = "mt-0.5 w-5 mr-2 h-5 cursor-pointer accent-current", Vt = "tools.list.placeholder", Ht = "list", Ut = {
|
|
637
643
|
contentContainer: "list-content-container",
|
|
638
644
|
checklistContent: "list-checklist-content"
|
|
639
|
-
},
|
|
645
|
+
}, Wt = (e, t) => {
|
|
640
646
|
let n = e;
|
|
641
647
|
n._placeholder = t, Object.defineProperty(n, "getPlaceholder", {
|
|
642
648
|
value: () => n._placeholder,
|
|
@@ -644,8 +650,8 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
644
650
|
enumerable: !0,
|
|
645
651
|
configurable: !1
|
|
646
652
|
});
|
|
647
|
-
},
|
|
648
|
-
let { data: t, keydownHandler: n, readOnly: r } = e, i =
|
|
653
|
+
}, Gt = (e) => {
|
|
654
|
+
let { data: t, keydownHandler: n, readOnly: r } = e, i = Kt(e), a = t.style === "checklist" ? Jt(e) : qt(e);
|
|
649
655
|
i.appendChild(a), !r && n && i.addEventListener("keydown", n);
|
|
650
656
|
let o = a.querySelector("[data-list-marker]"), s = a.querySelector("input[type=\"checkbox\"]"), c = a.querySelector("[contenteditable]");
|
|
651
657
|
return {
|
|
@@ -654,49 +660,49 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
654
660
|
markerElement: o,
|
|
655
661
|
checkboxElement: s
|
|
656
662
|
};
|
|
657
|
-
},
|
|
663
|
+
}, Kt = (e) => {
|
|
658
664
|
var t;
|
|
659
665
|
let { data: n } = e, r = document.createElement("div");
|
|
660
|
-
return r.className =
|
|
661
|
-
},
|
|
666
|
+
return r.className = Lt, r.setAttribute(y.tool, Ht), r.setAttribute("data-list-style", n.style), r.setAttribute("data-list-depth", String((t = n.depth) == null ? 0 : t)), n.start !== void 0 && n.start !== 1 && r.setAttribute("data-list-start", String(n.start)), r;
|
|
667
|
+
}, qt = (e) => {
|
|
662
668
|
var t;
|
|
663
669
|
let { data: n, itemColor: r, itemSize: i, placeholder: a } = e, o = document.createElement("div");
|
|
664
|
-
o.setAttribute("role", "listitem"), o.className =
|
|
670
|
+
o.setAttribute("role", "listitem"), o.className = C(Rt, "flex", ...w), r && (o.style.color = r), i && (o.style.fontSize = i);
|
|
665
671
|
let s = (t = n.depth) == null ? 0 : t;
|
|
666
672
|
if (s > 0) {
|
|
667
673
|
let e = n.style === "ordered" ? 26 : 27;
|
|
668
674
|
o.style.marginLeft = `${s * e}px`;
|
|
669
675
|
}
|
|
670
|
-
let c =
|
|
676
|
+
let c = Yt(n.style, s);
|
|
671
677
|
c.setAttribute("data-list-marker", "true"), c.setAttribute("data-blok-mutation-free", "true"), o.appendChild(c);
|
|
672
678
|
let l = document.createElement("div");
|
|
673
|
-
return l.className =
|
|
674
|
-
},
|
|
679
|
+
return l.className = C("flex-1 min-w-0 outline-hidden", ...w), l.setAttribute("data-blok-testid", Ut.contentContainer), l.contentEditable = e.readOnly ? "false" : "true", l.innerHTML = n.text, Wt(l, a), o.appendChild(l), o;
|
|
680
|
+
}, Jt = (e) => {
|
|
675
681
|
var t;
|
|
676
682
|
let { data: n, itemColor: r, itemSize: i, placeholder: a, readOnly: o } = e, s = document.createElement("div");
|
|
677
|
-
s.setAttribute("role", "listitem"), s.className =
|
|
683
|
+
s.setAttribute("role", "listitem"), s.className = zt, r && (s.style.color = r), i && (s.style.fontSize = i);
|
|
678
684
|
let c = (t = n.depth) == null ? 0 : t;
|
|
679
685
|
c > 0 && (s.style.marginLeft = `${c * 27}px`);
|
|
680
686
|
let l = document.createElement("input");
|
|
681
|
-
l.type = "checkbox", l.className =
|
|
687
|
+
l.type = "checkbox", l.className = Bt, l.checked = !!n.checked, l.disabled = o;
|
|
682
688
|
let u = document.createElement("div");
|
|
683
|
-
return u.className =
|
|
684
|
-
},
|
|
689
|
+
return u.className = C("flex-1 outline-hidden leading-[1.5]", n.checked ? "line-through opacity-60" : "", ...w), u.setAttribute("data-blok-testid", Ut.checklistContent), u.setAttribute("data-checked", String(n.checked)), u.contentEditable = o ? "false" : "true", u.innerHTML = n.text, Wt(u, a), s.appendChild(l), s.appendChild(u), s;
|
|
690
|
+
}, Yt = (e, t) => {
|
|
685
691
|
let n = document.createElement("span");
|
|
686
|
-
return n.className = "shrink-0 select-none", n.setAttribute("aria-hidden", "true"), n.contentEditable = "false", e === "ordered" ? (n.textContent = "1.", n.className =
|
|
687
|
-
},
|
|
692
|
+
return n.className = "shrink-0 select-none", n.setAttribute("aria-hidden", "true"), n.contentEditable = "false", e === "ordered" ? (n.textContent = "1.", n.className = C(n.className, "text-right"), n.style.paddingRight = "11px", n.style.minWidth = "fit-content") : (n.textContent = Xt(t), n.className = C(n.className, "w-6 text-center flex justify-center"), n.style.paddingLeft = "1px", n.style.paddingRight = "13px", n.style.fontSize = "24px", n.style.fontFamily = "Arial", n.style.lineHeight = "1.5rem"), n;
|
|
693
|
+
}, Xt = (e) => {
|
|
688
694
|
let t = [
|
|
689
695
|
"•",
|
|
690
696
|
"◦",
|
|
691
697
|
"▪"
|
|
692
698
|
];
|
|
693
699
|
return t[e % t.length];
|
|
694
|
-
},
|
|
700
|
+
}, Zt = (e) => {
|
|
695
701
|
let { data: t, readOnly: n, placeholder: r, itemColor: i, itemSize: a, element: o, setupItemPlaceholder: s, onCheckboxChange: c, keydownHandler: l } = e;
|
|
696
702
|
if (!o) return null;
|
|
697
703
|
let u = o.parentNode;
|
|
698
704
|
if (!u) return null;
|
|
699
|
-
let d =
|
|
705
|
+
let d = Gt({
|
|
700
706
|
data: t,
|
|
701
707
|
readOnly: n,
|
|
702
708
|
placeholder: r,
|
|
@@ -711,14 +717,14 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
711
717
|
});
|
|
712
718
|
}
|
|
713
719
|
return u.replaceChild(d.wrapper, o), d.wrapper;
|
|
714
|
-
},
|
|
720
|
+
}, Qt = (e, t, n) => {
|
|
715
721
|
if (!t) return e;
|
|
716
|
-
let r = n(), i =
|
|
717
|
-
text: r ?
|
|
722
|
+
let r = n(), i = S({
|
|
723
|
+
text: r ? dt(r.innerHTML) : e.text,
|
|
718
724
|
style: e.style
|
|
719
725
|
}, e.style === "checklist" ? { checked: !!e.checked } : {});
|
|
720
726
|
return e.start !== void 0 && e.start !== 1 && (i.start = e.start), e.depth !== void 0 && e.depth > 0 && (i.depth = e.depth), i;
|
|
721
|
-
},
|
|
727
|
+
}, $t = (e, t, n, r, i) => {
|
|
722
728
|
var a, o;
|
|
723
729
|
if (!n) return {
|
|
724
730
|
newData: e,
|
|
@@ -729,7 +735,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
729
735
|
newData: e,
|
|
730
736
|
inPlace: !1
|
|
731
737
|
};
|
|
732
|
-
let d = "depth" in t ? t.depth : 0, f =
|
|
738
|
+
let d = "depth" in t ? t.depth : 0, f = S(S(S({}, e), t), {}, { depth: d }), p = r();
|
|
733
739
|
if (p && typeof t.text == "string" && (p.innerHTML = t.text), s !== c) return i.adjustDepthTo(c), i.updateMarkerForDepth(c, u), {
|
|
734
740
|
newData: f,
|
|
735
741
|
inPlace: !0
|
|
@@ -742,7 +748,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
742
748
|
newData: f,
|
|
743
749
|
inPlace: !0
|
|
744
750
|
};
|
|
745
|
-
},
|
|
751
|
+
}, en = (e, t) => {
|
|
746
752
|
let { element: n, getContentElement: r, parseHTML: i, data: a } = e;
|
|
747
753
|
if (!n) return;
|
|
748
754
|
a.text += t.text;
|
|
@@ -751,29 +757,29 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
751
757
|
let e = i(t.text);
|
|
752
758
|
o.appendChild(e), o.normalize();
|
|
753
759
|
}
|
|
754
|
-
},
|
|
760
|
+
}, tn = (e, t, n, r) => e.map((e) => ({
|
|
755
761
|
icon: e.icon,
|
|
756
762
|
title: n(`toolNames.${e.titleKey}`),
|
|
757
763
|
onActivate: () => r(e.style),
|
|
758
764
|
closeOnActivate: !0,
|
|
759
765
|
isActive: t === e.style
|
|
760
|
-
})),
|
|
766
|
+
})), nn = (e) => {
|
|
761
767
|
if (!e) return;
|
|
762
768
|
let t = (e.getAttribute("style") || "").match(/margin-left:\s*(\d+)px/);
|
|
763
769
|
if (!t) return;
|
|
764
770
|
let n = parseInt(t[1], 10);
|
|
765
771
|
return n > 0 ? { left: n } : void 0;
|
|
766
|
-
},
|
|
772
|
+
}, rn = (e) => {
|
|
767
773
|
let t = e.closest("[data-list-depth]");
|
|
768
774
|
if (!t) return;
|
|
769
775
|
let n = t.getAttribute("data-list-depth");
|
|
770
776
|
if (n === null) return;
|
|
771
777
|
let r = parseInt(n, 10);
|
|
772
778
|
return r > 0 ? { left: r * 27 } : void 0;
|
|
773
|
-
},
|
|
774
|
-
let t =
|
|
775
|
-
return t === void 0 ?
|
|
776
|
-
},
|
|
779
|
+
}, an = (e) => {
|
|
780
|
+
let t = nn(e.closest("[role=\"listitem\"]") || e.querySelector("[role=\"listitem\"]"));
|
|
781
|
+
return t === void 0 ? rn(e) : t;
|
|
782
|
+
}, on = (e, t) => {
|
|
777
783
|
let n = document.createRange();
|
|
778
784
|
if (n.setStart(e, 0), n.setEnd(t.startContainer, t.startOffset), !e.lastChild) return {
|
|
779
785
|
beforeContent: "",
|
|
@@ -781,32 +787,32 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
781
787
|
};
|
|
782
788
|
let r = document.createRange();
|
|
783
789
|
return r.setStart(t.endContainer, t.endOffset), r.setEndAfter(e.lastChild), {
|
|
784
|
-
beforeContent:
|
|
785
|
-
afterContent:
|
|
790
|
+
beforeContent: sn(n.cloneContents()),
|
|
791
|
+
afterContent: sn(r.cloneContents())
|
|
786
792
|
};
|
|
787
|
-
},
|
|
793
|
+
}, sn = (e) => {
|
|
788
794
|
let t = document.createElement("div");
|
|
789
795
|
return t.appendChild(e), t.innerHTML;
|
|
790
|
-
},
|
|
796
|
+
}, cn = (e) => {
|
|
791
797
|
let t = document.createElement("div");
|
|
792
798
|
t.innerHTML = e.trim();
|
|
793
799
|
let n = document.createDocumentFragment();
|
|
794
800
|
return n.append(...Array.from(t.childNodes)), n;
|
|
795
|
-
},
|
|
801
|
+
}, ln = (e, t) => {
|
|
796
802
|
let n = document.createRange();
|
|
797
803
|
return n.selectNodeContents(e), n.setEnd(t.startContainer, t.startOffset), n.toString().length === 0;
|
|
798
|
-
},
|
|
804
|
+
}, un = (e, t) => {
|
|
799
805
|
let n = document.createRange();
|
|
800
806
|
n.selectNodeContents(e), n.setEnd(t.startContainer, t.startOffset);
|
|
801
807
|
let r = n.toString().length === 0, i = document.createRange();
|
|
802
808
|
i.selectNodeContents(e), i.setStart(t.endContainer, t.endOffset);
|
|
803
809
|
let a = i.toString().length === 0;
|
|
804
810
|
return r && a;
|
|
805
|
-
},
|
|
811
|
+
}, dn = (e) => {
|
|
806
812
|
if (typeof e != "object" || !e) return !1;
|
|
807
813
|
let t = Object.entries(e).find(([e]) => e === "items");
|
|
808
814
|
return t === void 0 ? !1 : Array.isArray(t[1]);
|
|
809
|
-
},
|
|
815
|
+
}, fn = (e) => typeof e == "object" && !!e, pn = (e) => typeof e == "string" ? e : "", mn = (e, t) => e === "unordered" || e === "ordered" || e === "checklist" ? e : t, hn = (e) => !!e, gn = (e, t) => typeof e == "number" ? e : t, _n = (e, t) => {
|
|
810
816
|
let n = t.defaultStyle || "unordered";
|
|
811
817
|
if (!e || typeof e != "object") return {
|
|
812
818
|
text: "",
|
|
@@ -814,18 +820,18 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
814
820
|
checked: !1,
|
|
815
821
|
depth: 0
|
|
816
822
|
};
|
|
817
|
-
if (
|
|
823
|
+
if (dn(e)) {
|
|
818
824
|
let t = e.items[0], r = (t == null ? void 0 : t.content) || "", i = (t == null ? void 0 : t.checked) || !1;
|
|
819
|
-
return
|
|
825
|
+
return S({
|
|
820
826
|
text: r,
|
|
821
827
|
style: e.style || n,
|
|
822
828
|
checked: !!i,
|
|
823
829
|
depth: 0
|
|
824
830
|
}, e.start !== void 0 && e.start !== 1 ? { start: e.start } : {});
|
|
825
831
|
}
|
|
826
|
-
if (
|
|
827
|
-
let t =
|
|
828
|
-
return
|
|
832
|
+
if (fn(e)) {
|
|
833
|
+
let t = pn(e.text), r = mn(e.style, n), i = hn(e.checked), a = gn(e.depth, 0), o = e.start, s = typeof o == "number" && o !== void 0 && o !== 1 ? o : void 0;
|
|
834
|
+
return S({
|
|
829
835
|
text: t,
|
|
830
836
|
style: r,
|
|
831
837
|
checked: i,
|
|
@@ -838,7 +844,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
838
844
|
checked: !1,
|
|
839
845
|
depth: 0
|
|
840
846
|
};
|
|
841
|
-
},
|
|
847
|
+
}, vn = class {
|
|
842
848
|
constructor(e) {
|
|
843
849
|
this.blocks = e;
|
|
844
850
|
}
|
|
@@ -866,7 +872,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
866
872
|
let n = (t = e.holder) == null || (t = t.querySelector("[role=\"listitem\"]")) == null ? void 0 : t.getAttribute("style"), r = n == null ? void 0 : n.match(/margin-left:\s*(\d+)px/);
|
|
867
873
|
return r ? Math.round(parseInt(r[1], 10) / 27) : 0;
|
|
868
874
|
}
|
|
869
|
-
},
|
|
875
|
+
}, yn = (e, t) => {
|
|
870
876
|
if (!e) return null;
|
|
871
877
|
if (t === "checklist") {
|
|
872
878
|
let t = e.querySelector("[contenteditable]");
|
|
@@ -874,15 +880,15 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
874
880
|
}
|
|
875
881
|
let n = e.querySelector("[data-blok-testid=\"list-content-container\"]");
|
|
876
882
|
return n instanceof HTMLElement ? n : null;
|
|
877
|
-
},
|
|
883
|
+
}, bn = (e, t, n) => {
|
|
878
884
|
e && e.setAttribute("data-list-depth", String(n));
|
|
879
885
|
let r = e == null ? void 0 : e.querySelector("[role=\"listitem\"]");
|
|
880
886
|
r instanceof HTMLElement && (r.style.marginLeft = n > 0 ? `${n * 27}px` : ""), t.depth = n;
|
|
881
|
-
},
|
|
887
|
+
}, xn = (e, t) => t.getBlockDepth(e), Sn = (e, t) => t.getBlockStyle(e), Cn = (e, t) => t.getBulletCharacter(e), wn = (e, t, n, r, i) => {
|
|
882
888
|
var a;
|
|
883
889
|
let o = e ? (a = r.getBlockIndex(e)) == null ? r.getCurrentBlockIndex() : a : r.getCurrentBlockIndex();
|
|
884
890
|
return o <= 0 ? 0 : i.getSiblingIndex(o, t, n);
|
|
885
|
-
},
|
|
891
|
+
}, Tn = (e, t, n, r, i, a) => {
|
|
886
892
|
var o;
|
|
887
893
|
if (e === 0) {
|
|
888
894
|
var s;
|
|
@@ -890,10 +896,10 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
890
896
|
}
|
|
891
897
|
let c = n ? (o = i.getBlockIndex(n)) == null ? i.getCurrentBlockIndex() : o : i.getCurrentBlockIndex(), l = a.findFirstItemIndex(c - 1, t, e, r.style);
|
|
892
898
|
return l === null ? 1 : a.getBlockStartValue(l);
|
|
893
|
-
},
|
|
894
|
-
let o =
|
|
899
|
+
}, En = (e, t, n, r, i, a) => {
|
|
900
|
+
let o = Tn(e, t, r, n, i, a) + e;
|
|
895
901
|
return a.formatNumber(o, t);
|
|
896
|
-
},
|
|
902
|
+
}, Dn = (e, t, n, r) => r.findGroupStart(e, t, n), On = (e, t, n, r) => {
|
|
897
903
|
if (!e) return;
|
|
898
904
|
let i = e.holder, a = i == null ? void 0 : i.querySelector("[data-list-style=\"ordered\"]");
|
|
899
905
|
if (!a) return;
|
|
@@ -901,9 +907,9 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
901
907
|
if (!o) return;
|
|
902
908
|
let s = t.getBlockIndex(e.id);
|
|
903
909
|
if (s == null) return;
|
|
904
|
-
let c =
|
|
910
|
+
let c = xn(e, n), l = Sn(e, r) || "ordered", u = r.getSiblingIndex(s, c, l), d = r.getGroupStartValue(s, c, u, l) + u;
|
|
905
911
|
o.textContent = r.formatNumber(d, c);
|
|
906
|
-
},
|
|
912
|
+
}, kn = (e, t, n, r, i, a, o, s) => {
|
|
907
913
|
let c = (e) => {
|
|
908
914
|
if (e >= t) return;
|
|
909
915
|
if (e === n) {
|
|
@@ -912,25 +918,25 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
912
918
|
}
|
|
913
919
|
let l = a.getBlockByIndex(e);
|
|
914
920
|
if (!l || l.name !== "list") return;
|
|
915
|
-
let u =
|
|
921
|
+
let u = xn(l, o);
|
|
916
922
|
if (!(u < r)) {
|
|
917
923
|
if (u > r) {
|
|
918
924
|
c(e + 1);
|
|
919
925
|
return;
|
|
920
926
|
}
|
|
921
|
-
|
|
927
|
+
Sn(l, s) === i && (On(l, a, o, s), c(e + 1));
|
|
922
928
|
}
|
|
923
929
|
};
|
|
924
930
|
c(e);
|
|
925
|
-
},
|
|
931
|
+
}, An = (e, t, n) => {
|
|
926
932
|
let r = e.getBlocksCount();
|
|
927
933
|
Array.from({ length: r }, (e, t) => t).forEach((r) => {
|
|
928
934
|
let i = e.getBlockByIndex(r);
|
|
929
935
|
if (!i || i.name !== "list") return;
|
|
930
936
|
let a = i.holder;
|
|
931
|
-
a != null && a.querySelector("[data-list-style=\"ordered\"]") &&
|
|
937
|
+
a != null && a.querySelector("[data-list-style=\"ordered\"]") && On(i, e, t, n);
|
|
932
938
|
});
|
|
933
|
-
},
|
|
939
|
+
}, E = (e, t, n = "end") => {
|
|
934
940
|
let r = () => {
|
|
935
941
|
let r = t.holder;
|
|
936
942
|
if (!r) return;
|
|
@@ -946,7 +952,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
946
952
|
n === "start" ? (o.setStart(i, 0), o.collapse(!0)) : (o.selectNodeContents(i), o.collapse(!1)), a.removeAllRanges(), a.addRange(o), e.caret.updateLastCaretAfterPosition();
|
|
947
953
|
}, i = t.holder;
|
|
948
954
|
(i == null ? void 0 : i.querySelector("[contenteditable=\"true\"]")) instanceof HTMLElement ? r() : requestAnimationFrame(() => r());
|
|
949
|
-
},
|
|
955
|
+
}, jn = async (e) => {
|
|
950
956
|
var t;
|
|
951
957
|
let { api: n, blockId: r, data: i, element: a, getContentElement: o } = e, s = window.getSelection();
|
|
952
958
|
if (!s || !a) return;
|
|
@@ -954,49 +960,49 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
954
960
|
if (!c) return;
|
|
955
961
|
let l = c.innerHTML.trim();
|
|
956
962
|
if (l === "" || l === "<br>") {
|
|
957
|
-
await
|
|
963
|
+
await Mn(e);
|
|
958
964
|
return;
|
|
959
965
|
}
|
|
960
|
-
let { beforeContent: u, afterContent: d } =
|
|
966
|
+
let { beforeContent: u, afterContent: d } = on(c, s.getRangeAt(0)), f = r ? (t = n.blocks.getBlockIndex(r)) == null ? n.blocks.getCurrentBlockIndex() : t : n.blocks.getCurrentBlockIndex();
|
|
961
967
|
if (!r) {
|
|
962
|
-
c.innerHTML = u, i.text = u,
|
|
968
|
+
c.innerHTML = u, i.text = u, E(n, n.blocks.insert(Ht, S(S({
|
|
963
969
|
text: d,
|
|
964
970
|
style: i.style
|
|
965
971
|
}, i.style === "checklist" ? { checked: !!i.checked } : {}), {}, { depth: i.depth }), void 0, f + 1, !0), "start");
|
|
966
972
|
return;
|
|
967
973
|
}
|
|
968
|
-
let p = n.blocks.splitBlock(r, { text: u },
|
|
974
|
+
let p = n.blocks.splitBlock(r, { text: u }, Ht, S(S({
|
|
969
975
|
text: d,
|
|
970
976
|
style: i.style
|
|
971
977
|
}, i.style === "checklist" ? { checked: !!i.checked } : {}), {}, { depth: i.depth }), f + 1);
|
|
972
|
-
i.text = u,
|
|
973
|
-
},
|
|
978
|
+
i.text = u, E(n, p, "start");
|
|
979
|
+
}, Mn = async (e) => {
|
|
974
980
|
let { api: t, blockId: n, getDepth: r } = e;
|
|
975
981
|
if (r() > 0) {
|
|
976
|
-
await
|
|
982
|
+
await Fn(e);
|
|
977
983
|
return;
|
|
978
984
|
}
|
|
979
|
-
n !== void 0 &&
|
|
980
|
-
},
|
|
985
|
+
n !== void 0 && E(t, await t.blocks.convert(n, "paragraph", { text: "" }), "start");
|
|
986
|
+
}, Nn = async (e, t) => {
|
|
981
987
|
let { api: n, blockId: r, data: i, element: a, getContentElement: o, getDepth: s, syncContentFromDOM: c } = e, l = window.getSelection();
|
|
982
988
|
if (!l || !a) return;
|
|
983
989
|
let u = l.getRangeAt(0), d = o();
|
|
984
990
|
if (!d) return;
|
|
985
991
|
c();
|
|
986
992
|
let f = i.text, p = s();
|
|
987
|
-
if (
|
|
993
|
+
if (un(d, u) && !l.isCollapsed) {
|
|
988
994
|
t.preventDefault(), d.innerHTML = "", i.text = "";
|
|
989
995
|
let e = document.createRange();
|
|
990
996
|
e.setStart(d, 0), e.collapse(!0), l.removeAllRanges(), l.addRange(e);
|
|
991
997
|
return;
|
|
992
998
|
}
|
|
993
|
-
if (!
|
|
999
|
+
if (!ln(d, u) || (t.preventDefault(), r === void 0)) return;
|
|
994
1000
|
let m = await n.blocks.convert(r, "paragraph", { text: f });
|
|
995
1001
|
p > 0 && requestAnimationFrame(() => {
|
|
996
1002
|
let e = m.holder;
|
|
997
1003
|
e && (e.style.marginLeft = `${p * 27}px`, e.setAttribute("data-blok-depth", String(p)));
|
|
998
|
-
}),
|
|
999
|
-
},
|
|
1004
|
+
}), E(n, m, "start");
|
|
1005
|
+
}, Pn = async (e, t) => {
|
|
1000
1006
|
let { api: n, blockId: r, data: i, syncContentFromDOM: a, getDepth: o } = e, s = n.blocks.getCurrentBlockIndex();
|
|
1001
1007
|
if (s === 0) return;
|
|
1002
1008
|
let c = n.blocks.getBlockByIndex(s - 1);
|
|
@@ -1005,15 +1011,15 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1005
1011
|
if (l > t.getBlockDepth(c)) return;
|
|
1006
1012
|
a();
|
|
1007
1013
|
let u = l + 1;
|
|
1008
|
-
i.depth = u,
|
|
1009
|
-
},
|
|
1014
|
+
i.depth = u, E(n, await n.blocks.update(r || "", S(S({}, i), {}, { depth: u })));
|
|
1015
|
+
}, Fn = async (e) => {
|
|
1010
1016
|
let { api: t, blockId: n, data: r, syncContentFromDOM: i, getDepth: a } = e, o = a();
|
|
1011
1017
|
if (o === 0) return;
|
|
1012
1018
|
i();
|
|
1013
1019
|
let s = o - 1;
|
|
1014
|
-
r.depth = s,
|
|
1015
|
-
},
|
|
1016
|
-
let { data: t, readOnly: n, placeholder: r, itemColor: i, itemSize: a, setupItemPlaceholder: o, onCheckboxChange: s, keydownHandler: c } = e, l =
|
|
1020
|
+
r.depth = s, E(t, await t.blocks.update(n || "", S(S({}, r), {}, { depth: s })));
|
|
1021
|
+
}, In = (e) => {
|
|
1022
|
+
let { data: t, readOnly: n, placeholder: r, itemColor: i, itemSize: a, setupItemPlaceholder: o, onCheckboxChange: s, keydownHandler: c } = e, l = Gt({
|
|
1017
1023
|
data: t,
|
|
1018
1024
|
readOnly: n,
|
|
1019
1025
|
placeholder: r,
|
|
@@ -1028,14 +1034,14 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1028
1034
|
});
|
|
1029
1035
|
}
|
|
1030
1036
|
return l.wrapper;
|
|
1031
|
-
},
|
|
1037
|
+
}, Ln = (e) => {
|
|
1032
1038
|
let t = (e) => {
|
|
1033
1039
|
if (e <= 0) return "";
|
|
1034
1040
|
let n = e - 1;
|
|
1035
1041
|
return t(Math.floor(n / 26)) + String.fromCharCode(97 + n % 26);
|
|
1036
1042
|
};
|
|
1037
1043
|
return t(e);
|
|
1038
|
-
},
|
|
1044
|
+
}, Rn = (e) => {
|
|
1039
1045
|
let t = [
|
|
1040
1046
|
[1e3, "m"],
|
|
1041
1047
|
[900, "cm"],
|
|
@@ -1056,7 +1062,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1056
1062
|
return e >= i ? a + n(e - i, r) : n(e, r + 1);
|
|
1057
1063
|
};
|
|
1058
1064
|
return n(e, 0);
|
|
1059
|
-
},
|
|
1065
|
+
}, zn = class {
|
|
1060
1066
|
constructor(e) {
|
|
1061
1067
|
this.blocks = e;
|
|
1062
1068
|
}
|
|
@@ -1082,7 +1088,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1082
1088
|
}
|
|
1083
1089
|
formatNumber(e, t) {
|
|
1084
1090
|
let n = t % 3;
|
|
1085
|
-
return n === 1 ? `${
|
|
1091
|
+
return n === 1 ? `${Ln(e)}.` : n === 2 ? `${Rn(e)}.` : `${e}.`;
|
|
1086
1092
|
}
|
|
1087
1093
|
getGroupStartValue(e, t, n, r) {
|
|
1088
1094
|
if (n === 0) return this.getBlockStartValue(e);
|
|
@@ -1137,9 +1143,9 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1137
1143
|
let a = this.getBlockDepth(i);
|
|
1138
1144
|
return a < n ? t : a > n ? this.findGroupStartRecursive(e - 1, t, n, r) : this.getBlockStyle(i) === r ? this.findGroupStartRecursive(e - 1, e, n, r) : t;
|
|
1139
1145
|
}
|
|
1140
|
-
},
|
|
1146
|
+
}, Bn = { value: !1 }, Vn = class {
|
|
1141
1147
|
constructor(e) {
|
|
1142
|
-
this.blocks = e, this.depthValidator = new
|
|
1148
|
+
this.blocks = e, this.depthValidator = new vn(e), this.markerCalculator = new zn(e);
|
|
1143
1149
|
}
|
|
1144
1150
|
updateMarker(e, t, n) {
|
|
1145
1151
|
let r = e.querySelector("[data-list-marker]");
|
|
@@ -1166,8 +1172,8 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1166
1172
|
}
|
|
1167
1173
|
}
|
|
1168
1174
|
scheduleUpdateAll() {
|
|
1169
|
-
|
|
1170
|
-
|
|
1175
|
+
Bn.value || (Bn.value = !0, requestAnimationFrame(() => {
|
|
1176
|
+
Bn.value = !1, this.updateAllMarkers();
|
|
1171
1177
|
}));
|
|
1172
1178
|
}
|
|
1173
1179
|
findListGroupStartIndex(e, t, n) {
|
|
@@ -1206,12 +1212,12 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1206
1212
|
})() : c) + s;
|
|
1207
1213
|
r.textContent = this.markerCalculator.formatNumber(l, a);
|
|
1208
1214
|
}
|
|
1209
|
-
},
|
|
1215
|
+
}, Hn = (e) => e instanceof HTMLElement, Un = new Set(/* @__PURE__ */ "decimal.decimal-leading-zero.lower-roman.upper-roman.lower-greek.lower-latin.upper-latin.lower-alpha.upper-alpha.arabic-indic.armenian.bengali.cambodian.cjk-decimal.devanagari.georgian.gujarati.gurmukhi.hebrew.kannada.khmer.lao.malayalam.mongolian.myanmar.oriya.persian.telugu.thai.tibetan".split(".")), Wn = new Set([
|
|
1210
1216
|
"disc",
|
|
1211
1217
|
"circle",
|
|
1212
1218
|
"square",
|
|
1213
1219
|
"none"
|
|
1214
|
-
]),
|
|
1220
|
+
]), Gn = (e) => {
|
|
1215
1221
|
let t = e.getAttribute("data-list-style");
|
|
1216
1222
|
if (t === "ordered") return "ordered";
|
|
1217
1223
|
if (t === "unordered") return "unordered";
|
|
@@ -1220,24 +1226,24 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1220
1226
|
let r = n.match(/list-style-type\s*:\s*([^;]+)/);
|
|
1221
1227
|
if (!r) return null;
|
|
1222
1228
|
let i = r[1].trim().toLowerCase();
|
|
1223
|
-
return
|
|
1224
|
-
},
|
|
1229
|
+
return Un.has(i) ? "ordered" : Wn.has(i) ? "unordered" : null;
|
|
1230
|
+
}, Kn = (e, t) => {
|
|
1225
1231
|
let n = e.parentElement;
|
|
1226
|
-
return (n == null ? void 0 : n.tagName) === "OL" ? "ordered" : (n == null ? void 0 : n.tagName) === "UL" ? e.querySelector("input[type=\"checkbox\"]") ? "checklist" : "unordered" :
|
|
1227
|
-
},
|
|
1232
|
+
return (n == null ? void 0 : n.tagName) === "OL" ? "ordered" : (n == null ? void 0 : n.tagName) === "UL" ? e.querySelector("input[type=\"checkbox\"]") ? "checklist" : "unordered" : Gn(e) || t;
|
|
1233
|
+
}, qn = (e) => {
|
|
1228
1234
|
let t = e.innerHTML || e.textContent || "", n = e.querySelector("input[type=\"checkbox\"]");
|
|
1229
1235
|
return {
|
|
1230
1236
|
text: t,
|
|
1231
1237
|
checked: n instanceof HTMLInputElement ? n.checked : !1
|
|
1232
1238
|
};
|
|
1233
|
-
},
|
|
1239
|
+
}, Jn = (e) => {
|
|
1234
1240
|
let t = e.getAttribute("aria-level");
|
|
1235
1241
|
if (t) {
|
|
1236
1242
|
let e = parseInt(t, 10);
|
|
1237
1243
|
return Math.max(0, e - 1);
|
|
1238
1244
|
}
|
|
1239
1245
|
return 0;
|
|
1240
|
-
},
|
|
1246
|
+
}, Yn = () => ({ text: {
|
|
1241
1247
|
br: !0,
|
|
1242
1248
|
a: {
|
|
1243
1249
|
href: !0,
|
|
@@ -1246,38 +1252,38 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1246
1252
|
},
|
|
1247
1253
|
b: !0,
|
|
1248
1254
|
i: !0
|
|
1249
|
-
} }),
|
|
1255
|
+
} }), Xn = () => ({ tags: [{ li: {
|
|
1250
1256
|
style: !0,
|
|
1251
1257
|
"aria-level": !0
|
|
1252
|
-
} }] }),
|
|
1258
|
+
} }] }), Zn = () => ({
|
|
1253
1259
|
export: (e) => e.text,
|
|
1254
1260
|
import: (e) => ({
|
|
1255
1261
|
text: e,
|
|
1256
1262
|
style: "unordered",
|
|
1257
1263
|
checked: !1
|
|
1258
1264
|
})
|
|
1259
|
-
}),
|
|
1265
|
+
}), Qn = [
|
|
1260
1266
|
{
|
|
1261
1267
|
name: "bulletedList",
|
|
1262
1268
|
titleKey: "bulletedList",
|
|
1263
1269
|
style: "unordered",
|
|
1264
|
-
icon:
|
|
1270
|
+
icon: $e
|
|
1265
1271
|
},
|
|
1266
1272
|
{
|
|
1267
1273
|
name: "numberedList",
|
|
1268
1274
|
titleKey: "numberedList",
|
|
1269
1275
|
style: "ordered",
|
|
1270
|
-
icon:
|
|
1276
|
+
icon: Te
|
|
1271
1277
|
},
|
|
1272
1278
|
{
|
|
1273
1279
|
name: "todoList",
|
|
1274
1280
|
titleKey: "todoList",
|
|
1275
1281
|
style: "checklist",
|
|
1276
|
-
icon:
|
|
1282
|
+
icon: Le
|
|
1277
1283
|
}
|
|
1278
|
-
],
|
|
1284
|
+
], $n = () => [
|
|
1279
1285
|
{
|
|
1280
|
-
icon:
|
|
1286
|
+
icon: $e,
|
|
1281
1287
|
title: "Bulleted list",
|
|
1282
1288
|
titleKey: "bulletedList",
|
|
1283
1289
|
data: { style: "unordered" },
|
|
@@ -1291,7 +1297,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1291
1297
|
shortcut: "-"
|
|
1292
1298
|
},
|
|
1293
1299
|
{
|
|
1294
|
-
icon:
|
|
1300
|
+
icon: Te,
|
|
1295
1301
|
title: "Numbered list",
|
|
1296
1302
|
titleKey: "numberedList",
|
|
1297
1303
|
data: { style: "ordered" },
|
|
@@ -1305,7 +1311,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1305
1311
|
shortcut: "1."
|
|
1306
1312
|
},
|
|
1307
1313
|
{
|
|
1308
|
-
icon:
|
|
1314
|
+
icon: Le,
|
|
1309
1315
|
title: "To-do list",
|
|
1310
1316
|
titleKey: "todoList",
|
|
1311
1317
|
data: { style: "checklist" },
|
|
@@ -1319,24 +1325,24 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1319
1325
|
],
|
|
1320
1326
|
shortcut: "[]"
|
|
1321
1327
|
}
|
|
1322
|
-
],
|
|
1328
|
+
], er = class {
|
|
1323
1329
|
constructor({ data: e, config: t, api: n, readOnly: r, block: i }) {
|
|
1324
1330
|
this._element = null, this.handleBlockChanged = (e) => {
|
|
1325
1331
|
if (this.isBlockChangedEventPayload(e) && (e.event.type === "block-removed" || e.event.type === "block-added")) {
|
|
1326
1332
|
var t;
|
|
1327
1333
|
(t = this.markerManager) == null || t.scheduleUpdateAll();
|
|
1328
1334
|
}
|
|
1329
|
-
}, this.api = n, this.readOnly = r, this._settings = t || {}, this._data = this.normalizeData(e), this.depthValidator = new
|
|
1335
|
+
}, this.api = n, this.readOnly = r, this._settings = t || {}, this._data = this.normalizeData(e), this.depthValidator = new vn(n.blocks), this.markerCalculator = new zn(n.blocks), this.markerManager = this._data.style === "ordered" ? new Vn(n.blocks) : null, i && (this.blockId = i.id), this._data.style === "ordered" && this.api.events.on("block changed", this.handleBlockChanged);
|
|
1330
1336
|
}
|
|
1331
1337
|
isBlockChangedEventPayload(e) {
|
|
1332
1338
|
return typeof e == "object" && !!e && "event" in e && typeof e.event == "object" && e.event !== null && "type" in e.event && typeof e.event.type == "string";
|
|
1333
1339
|
}
|
|
1334
1340
|
normalizeData(e) {
|
|
1335
|
-
return
|
|
1341
|
+
return _n(e, this._settings);
|
|
1336
1342
|
}
|
|
1337
1343
|
get availableStyles() {
|
|
1338
1344
|
let e = this._settings.styles;
|
|
1339
|
-
return !e || e.length === 0 ?
|
|
1345
|
+
return !e || e.length === 0 ? Qn : Qn.filter((t) => e.includes(t.style));
|
|
1340
1346
|
}
|
|
1341
1347
|
get itemColor() {
|
|
1342
1348
|
return this._settings.itemColor;
|
|
@@ -1345,13 +1351,13 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1345
1351
|
return this._settings.itemSize;
|
|
1346
1352
|
}
|
|
1347
1353
|
get placeholder() {
|
|
1348
|
-
return this.api.i18n.t(
|
|
1354
|
+
return this.api.i18n.t(Vt);
|
|
1349
1355
|
}
|
|
1350
1356
|
setupItemPlaceholder(e) {
|
|
1351
|
-
this.readOnly ||
|
|
1357
|
+
this.readOnly || vt(e, this.placeholder);
|
|
1352
1358
|
}
|
|
1353
1359
|
render() {
|
|
1354
|
-
return this._element =
|
|
1360
|
+
return this._element = In({
|
|
1355
1361
|
data: this._data,
|
|
1356
1362
|
readOnly: this.readOnly,
|
|
1357
1363
|
placeholder: this.placeholder,
|
|
@@ -1382,31 +1388,31 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1382
1388
|
n !== r && this.adjustDepthTo(r);
|
|
1383
1389
|
}
|
|
1384
1390
|
adjustDepthTo(e) {
|
|
1385
|
-
|
|
1391
|
+
bn(this._element, this._data, e);
|
|
1386
1392
|
}
|
|
1387
1393
|
removed() {
|
|
1388
1394
|
var e;
|
|
1389
1395
|
this._data.style === "ordered" && (this.api.events.off("block changed", this.handleBlockChanged), (e = this.markerManager) == null || e.scheduleUpdateAll());
|
|
1390
1396
|
}
|
|
1391
1397
|
updateAllOrderedListMarkers() {
|
|
1392
|
-
|
|
1398
|
+
An(this.api.blocks, this.depthValidator, this.markerCalculator);
|
|
1393
1399
|
}
|
|
1394
1400
|
updateMarker() {
|
|
1395
1401
|
var e;
|
|
1396
1402
|
let t = (e = this._element) == null ? void 0 : e.querySelector("[data-list-marker]");
|
|
1397
1403
|
if (!t) return;
|
|
1398
1404
|
let n = this.getDepth();
|
|
1399
|
-
t.textContent =
|
|
1405
|
+
t.textContent = En(wn(this.blockId, n, this._data.style, this.api.blocks, this.markerCalculator), n, this._data, this.blockId, this.api.blocks, this.markerCalculator);
|
|
1400
1406
|
}
|
|
1401
1407
|
updateSiblingListMarkers() {
|
|
1402
1408
|
var e;
|
|
1403
1409
|
let t = this.blockId ? (e = this.api.blocks.getBlockIndex(this.blockId)) == null ? this.api.blocks.getCurrentBlockIndex() : e : this.api.blocks.getCurrentBlockIndex(), n = this.getDepth(), r = this._data.style, i = this.api.blocks.getBlocksCount();
|
|
1404
|
-
|
|
1410
|
+
kn(Dn(t, n, r, this.markerCalculator), i, t, n, r, this.api.blocks, this.depthValidator, this.markerCalculator);
|
|
1405
1411
|
}
|
|
1406
1412
|
updateMarkerForDepth(e, t) {
|
|
1407
1413
|
var n;
|
|
1408
1414
|
let r = (n = this._element) == null ? void 0 : n.querySelector("[aria-hidden=\"true\"]");
|
|
1409
|
-
r instanceof HTMLElement && (t === "ordered" ? r.textContent =
|
|
1415
|
+
r instanceof HTMLElement && (t === "ordered" ? r.textContent = En(wn(this.blockId, e, this._data.style, this.api.blocks, this.markerCalculator), e, this._data, this.blockId, this.api.blocks, this.markerCalculator) : r.textContent = Cn(e, this.markerCalculator));
|
|
1410
1416
|
}
|
|
1411
1417
|
updateCheckboxState(e) {
|
|
1412
1418
|
var t;
|
|
@@ -1436,7 +1442,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1436
1442
|
}
|
|
1437
1443
|
async handleEnter() {
|
|
1438
1444
|
var e = this;
|
|
1439
|
-
await
|
|
1445
|
+
await jn({
|
|
1440
1446
|
api: e.api,
|
|
1441
1447
|
blockId: e.blockId,
|
|
1442
1448
|
data: e._data,
|
|
@@ -1448,7 +1454,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1448
1454
|
}
|
|
1449
1455
|
async handleBackspace(e) {
|
|
1450
1456
|
var t = this;
|
|
1451
|
-
await
|
|
1457
|
+
await Nn({
|
|
1452
1458
|
api: t.api,
|
|
1453
1459
|
blockId: t.blockId,
|
|
1454
1460
|
data: t._data,
|
|
@@ -1460,7 +1466,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1460
1466
|
}
|
|
1461
1467
|
async handleIndent() {
|
|
1462
1468
|
var e = this;
|
|
1463
|
-
await
|
|
1469
|
+
await Pn({
|
|
1464
1470
|
api: e.api,
|
|
1465
1471
|
blockId: e.blockId,
|
|
1466
1472
|
data: e._data,
|
|
@@ -1472,7 +1478,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1472
1478
|
}
|
|
1473
1479
|
async handleOutdent() {
|
|
1474
1480
|
var e = this;
|
|
1475
|
-
await
|
|
1481
|
+
await Fn({
|
|
1476
1482
|
api: e.api,
|
|
1477
1483
|
blockId: e.blockId,
|
|
1478
1484
|
data: e._data,
|
|
@@ -1490,10 +1496,10 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1490
1496
|
n instanceof HTMLInputElement && (this._data.checked = n.checked);
|
|
1491
1497
|
}
|
|
1492
1498
|
getContentElement() {
|
|
1493
|
-
return
|
|
1499
|
+
return yn(this._element, this._data.style);
|
|
1494
1500
|
}
|
|
1495
1501
|
renderSettings() {
|
|
1496
|
-
return
|
|
1502
|
+
return tn(this.availableStyles, this._data.style, this.api.i18n.t, (e) => this.setStyle(e));
|
|
1497
1503
|
}
|
|
1498
1504
|
setStyle(e) {
|
|
1499
1505
|
let t = this._data.style;
|
|
@@ -1503,7 +1509,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1503
1509
|
}
|
|
1504
1510
|
}
|
|
1505
1511
|
rerender() {
|
|
1506
|
-
let e =
|
|
1512
|
+
let e = Zt({
|
|
1507
1513
|
data: this._data,
|
|
1508
1514
|
readOnly: this.readOnly,
|
|
1509
1515
|
placeholder: this.placeholder,
|
|
@@ -1522,10 +1528,10 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1522
1528
|
return typeof e.text == "string";
|
|
1523
1529
|
}
|
|
1524
1530
|
save() {
|
|
1525
|
-
return
|
|
1531
|
+
return Qt(this._data, this._element, this.getContentElement.bind(this));
|
|
1526
1532
|
}
|
|
1527
1533
|
setData(e) {
|
|
1528
|
-
let t =
|
|
1534
|
+
let t = $t(this._data, e, this._element, this.getContentElement.bind(this), {
|
|
1529
1535
|
adjustDepthTo: this.adjustDepthTo.bind(this),
|
|
1530
1536
|
updateMarkerForDepth: this.updateMarkerForDepth.bind(this),
|
|
1531
1537
|
updateCheckboxState: this.updateCheckboxState.bind(this)
|
|
@@ -1533,31 +1539,31 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1533
1539
|
return this._data = t.newData, t.inPlace;
|
|
1534
1540
|
}
|
|
1535
1541
|
merge(e) {
|
|
1536
|
-
|
|
1542
|
+
en({
|
|
1537
1543
|
data: this._data,
|
|
1538
1544
|
element: this._element,
|
|
1539
1545
|
getContentElement: this.getContentElement.bind(this),
|
|
1540
|
-
parseHTML:
|
|
1546
|
+
parseHTML: cn
|
|
1541
1547
|
}, e);
|
|
1542
1548
|
}
|
|
1543
1549
|
static get conversionConfig() {
|
|
1544
|
-
return
|
|
1550
|
+
return Zn();
|
|
1545
1551
|
}
|
|
1546
1552
|
static get sanitize() {
|
|
1547
|
-
return
|
|
1553
|
+
return Yn();
|
|
1548
1554
|
}
|
|
1549
1555
|
static get pasteConfig() {
|
|
1550
|
-
return
|
|
1556
|
+
return Xn();
|
|
1551
1557
|
}
|
|
1552
1558
|
onPaste(e) {
|
|
1553
1559
|
let t = e.detail;
|
|
1554
1560
|
if (!("data" in t)) return;
|
|
1555
1561
|
let n = t.data;
|
|
1556
|
-
if (!
|
|
1557
|
-
let { text: r, checked: i } =
|
|
1562
|
+
if (!Hn(n)) return;
|
|
1563
|
+
let { text: r, checked: i } = qn(n), a = Jn(n);
|
|
1558
1564
|
this._data = {
|
|
1559
1565
|
text: r,
|
|
1560
|
-
style:
|
|
1566
|
+
style: Kn(n, this._data.style),
|
|
1561
1567
|
checked: i,
|
|
1562
1568
|
depth: a
|
|
1563
1569
|
}, this.rerender();
|
|
@@ -1566,18 +1572,18 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1566
1572
|
return !0;
|
|
1567
1573
|
}
|
|
1568
1574
|
getContentOffset(e) {
|
|
1569
|
-
return
|
|
1575
|
+
return an(e);
|
|
1570
1576
|
}
|
|
1571
1577
|
static get toolbox() {
|
|
1572
|
-
return
|
|
1578
|
+
return $n();
|
|
1573
1579
|
}
|
|
1574
|
-
},
|
|
1580
|
+
}, tr = "data-blok-table-add-row", nr = "data-blok-table-add-col", rr = 150, ir = 5, ar = 40, or = [
|
|
1575
1581
|
"flex",
|
|
1576
1582
|
"items-center",
|
|
1577
1583
|
"justify-center",
|
|
1578
1584
|
"transition-opacity",
|
|
1579
1585
|
"duration-150"
|
|
1580
|
-
],
|
|
1586
|
+
], sr = [
|
|
1581
1587
|
"flex",
|
|
1582
1588
|
"items-center",
|
|
1583
1589
|
"justify-center",
|
|
@@ -1585,7 +1591,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1585
1591
|
"border-gray-300",
|
|
1586
1592
|
"rounded-full",
|
|
1587
1593
|
"group-hover/add:bg-gray-50"
|
|
1588
|
-
],
|
|
1594
|
+
], cr = "12", lr = class {
|
|
1589
1595
|
constructor(e) {
|
|
1590
1596
|
this.rowHideTimeout = null, this.colHideTimeout = null, this.rowVisible = !1, this.colVisible = !1, this.interactive = !0, this.dragState = null, this.scrollContainer = null, this.boundScrollHandler = null, this.scrollContainerResizeObserver = null, this.wrapper = e.wrapper, this.grid = e.grid, this.i18n = e.i18n, this.boundAddRowClick = e.onAddRow, this.boundAddColClick = e.onAddColumn, this.onDragStart = e.onDragStart, this.onDragAddRow = e.onDragAddRow, this.onDragRemoveRow = e.onDragRemoveRow, this.onDragAddCol = e.onDragAddCol, this.onDragRemoveCol = e.onDragRemoveCol, this.onDragEnd = e.onDragEnd, this.getNewColumnWidth = e.getNewColumnWidth, this.boundMouseMove = this.handleMouseMove.bind(this), this.boundDocumentMouseMove = this.handleDocumentMouseMove.bind(this), this.boundMouseLeave = this.handleMouseLeave.bind(this), this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundPointerCancel = this.handlePointerCancel.bind(this), this.boundRowPointerDown = (e) => this.handlePointerDown("row", e), this.boundColPointerDown = (e) => this.handlePointerDown("col", e), this.addRowBtn = this.createAddRowButton(), this.addColBtn = this.createAddColumnButton(), this.wrapper.appendChild(this.addRowBtn), this.wrapper.appendChild(this.addColBtn), this.syncRowButtonWidth(), this.wrapper.addEventListener("mousemove", this.boundMouseMove), this.wrapper.addEventListener("mouseleave", this.boundMouseLeave), document.addEventListener("mousemove", this.boundDocumentMouseMove), this.addRowBtn.addEventListener("pointerdown", this.boundRowPointerDown), this.addColBtn.addEventListener("pointerdown", this.boundColPointerDown);
|
|
1591
1597
|
}
|
|
@@ -1658,10 +1664,10 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1658
1664
|
}
|
|
1659
1665
|
handlePointerMove(e) {
|
|
1660
1666
|
if (!this.dragState) return;
|
|
1661
|
-
let { axis: t, startPos:
|
|
1662
|
-
for (; this.dragState.addedCount <
|
|
1663
|
-
for (; this.dragState.addedCount >
|
|
1664
|
-
Math.abs(
|
|
1667
|
+
let { axis: t, startPos: n, unitSize: r } = this.dragState, i = (t === "row" ? e.clientY : e.clientX) - n, a = Math.floor(i / r);
|
|
1668
|
+
for (; this.dragState.addedCount < a;) t === "row" ? this.onDragAddRow() : this.onDragAddCol(), this.dragState.addedCount++;
|
|
1669
|
+
for (; this.dragState.addedCount > a;) t === "row" ? this.onDragRemoveRow() : this.onDragRemoveCol(), this.dragState.addedCount--;
|
|
1670
|
+
Math.abs(i) > ir && !this.dragState.didDrag && (this.dragState.didDrag = !0, document.body.style.cursor = t === "row" ? "row-resize" : "col-resize", h(), this.onDragStart());
|
|
1665
1671
|
}
|
|
1666
1672
|
handlePointerUp(e) {
|
|
1667
1673
|
if (!this.dragState) return;
|
|
@@ -1690,14 +1696,14 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1690
1696
|
}
|
|
1691
1697
|
handleMouseMove(e) {
|
|
1692
1698
|
let t = this.grid.getBoundingClientRect(), n = this.grid.parentElement, r = n !== null && n !== this.wrapper ? Math.min(t.right, n.getBoundingClientRect().right) : t.right, i = Math.abs(e.clientY - t.bottom), a = Math.abs(e.clientX - r);
|
|
1693
|
-
i <=
|
|
1699
|
+
i <= ar ? this.showRow() : this.scheduleHideRow(), a <= ar ? this.showCol() : this.scheduleHideCol();
|
|
1694
1700
|
}
|
|
1695
1701
|
handleMouseLeave() {
|
|
1696
1702
|
this.scheduleHideRow(), this.scheduleHideCol();
|
|
1697
1703
|
}
|
|
1698
1704
|
handleDocumentMouseMove(e) {
|
|
1699
1705
|
if (this.wrapper.contains(e.target)) return;
|
|
1700
|
-
let t = this.grid.getBoundingClientRect(), n =
|
|
1706
|
+
let t = this.grid.getBoundingClientRect(), n = ar;
|
|
1701
1707
|
e.clientX >= t.left - n && e.clientX <= t.right + n && e.clientY >= t.top - n && e.clientY <= t.bottom + n && this.handleMouseMove(e);
|
|
1702
1708
|
}
|
|
1703
1709
|
showRow() {
|
|
@@ -1710,13 +1716,13 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1710
1716
|
var e;
|
|
1711
1717
|
!this.rowVisible || this.rowHideTimeout !== null || ((e = this.dragState) == null ? void 0 : e.axis) === "row" || (this.rowHideTimeout = setTimeout(() => {
|
|
1712
1718
|
this.addRowBtn.style.opacity = "0", this.addRowBtn.style.pointerEvents = "none", this.rowVisible = !1, this.rowHideTimeout = null;
|
|
1713
|
-
},
|
|
1719
|
+
}, rr));
|
|
1714
1720
|
}
|
|
1715
1721
|
scheduleHideCol() {
|
|
1716
1722
|
var e;
|
|
1717
1723
|
!this.colVisible || this.colHideTimeout !== null || ((e = this.dragState) == null ? void 0 : e.axis) === "col" || (this.colHideTimeout = setTimeout(() => {
|
|
1718
1724
|
this.addColBtn.style.opacity = "0", this.addColBtn.style.pointerEvents = "none", this.colVisible = !1, this.colHideTimeout = null;
|
|
1719
|
-
},
|
|
1725
|
+
}, rr));
|
|
1720
1726
|
}
|
|
1721
1727
|
clearRowTimeout() {
|
|
1722
1728
|
this.rowHideTimeout !== null && (clearTimeout(this.rowHideTimeout), this.rowHideTimeout = null);
|
|
@@ -1726,25 +1732,25 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1726
1732
|
}
|
|
1727
1733
|
createAddRowButton() {
|
|
1728
1734
|
let e = document.createElement("div");
|
|
1729
|
-
e.className =
|
|
1735
|
+
e.className = C(or, "group/add", "items-start", "cursor-row-resize"), e.setAttribute(tr, ""), e.setAttribute("contenteditable", "false"), e.style.opacity = "0", e.style.pointerEvents = "none", e.style.position = "absolute", e.style.left = "0", e.style.bottom = "-36px", e.style.zIndex = "1", e.style.height = "32px";
|
|
1730
1736
|
let t = document.createElement("div");
|
|
1731
|
-
return t.className =
|
|
1737
|
+
return t.className = C(sr), t.style.width = "100%", t.style.height = "16px", this.appendIcon(t), e.appendChild(t), v(e, Pe([this.i18n.t("tools.table.clickToAddRow"), this.i18n.t("tools.table.dragToAddRemoveRows")]), {
|
|
1732
1738
|
placement: "bottom",
|
|
1733
1739
|
marginTop: -16
|
|
1734
1740
|
}), e;
|
|
1735
1741
|
}
|
|
1736
1742
|
createAddColumnButton() {
|
|
1737
1743
|
let e = document.createElement("div");
|
|
1738
|
-
e.className =
|
|
1744
|
+
e.className = C(or, "group/add", "justify-start", "cursor-col-resize"), e.setAttribute(nr, ""), e.setAttribute("contenteditable", "false"), e.style.opacity = "0", e.style.pointerEvents = "none", e.style.position = "absolute", e.style.right = "-36px", e.style.top = "0px", e.style.bottom = "0px", e.style.width = "32px";
|
|
1739
1745
|
let t = document.createElement("div");
|
|
1740
|
-
return t.className =
|
|
1746
|
+
return t.className = C(sr), t.style.width = "16px", t.style.height = "100%", this.appendIcon(t), e.appendChild(t), v(e, Pe([this.i18n.t("tools.table.clickToAddColumn"), this.i18n.t("tools.table.dragToAddRemoveColumns")]), { placement: "bottom" }), e;
|
|
1741
1747
|
}
|
|
1742
|
-
appendIcon(
|
|
1743
|
-
|
|
1744
|
-
let
|
|
1745
|
-
|
|
1748
|
+
appendIcon(e) {
|
|
1749
|
+
e.insertAdjacentHTML("beforeend", it);
|
|
1750
|
+
let t = e.querySelector("svg");
|
|
1751
|
+
t && (t.setAttribute("width", cr), t.setAttribute("height", cr), t.setAttribute("viewBox", "0 0 24 24"), t.classList.add("text-gray-500", "pointer-events-none"));
|
|
1746
1752
|
}
|
|
1747
|
-
},
|
|
1753
|
+
}, D = "data-blok-table-row", O = "data-blok-table-cell", ur = "1px solid var(--blok-table-border)", dr = ["flex"], fr = [
|
|
1748
1754
|
"py-1",
|
|
1749
1755
|
"px-2",
|
|
1750
1756
|
"min-h-[2em]",
|
|
@@ -1752,37 +1758,37 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1752
1758
|
"leading-none",
|
|
1753
1759
|
"text-sm",
|
|
1754
1760
|
"cursor-text"
|
|
1755
|
-
],
|
|
1761
|
+
], pr = (e) => {
|
|
1756
1762
|
let t = Math.round(100 / e * 100) / 100;
|
|
1757
1763
|
return Array.from({ length: e }, () => t);
|
|
1758
|
-
},
|
|
1764
|
+
}, mr = class {
|
|
1759
1765
|
constructor(e) {
|
|
1760
1766
|
this.readOnly = e.readOnly;
|
|
1761
1767
|
}
|
|
1762
1768
|
createGrid(e, t, n) {
|
|
1763
1769
|
let r = document.createElement("div");
|
|
1764
|
-
r.style.borderTop =
|
|
1765
|
-
let i = n == null ?
|
|
1770
|
+
r.style.borderTop = ur, r.style.borderLeft = ur;
|
|
1771
|
+
let i = n == null ? pr(t) : n;
|
|
1766
1772
|
return Array.from({ length: e }).forEach(() => {
|
|
1767
1773
|
r.appendChild(this.createRow(t, i));
|
|
1768
1774
|
}), r;
|
|
1769
1775
|
}
|
|
1770
1776
|
fillGrid(e, t) {}
|
|
1771
1777
|
addRow(e, t) {
|
|
1772
|
-
let n = this.getColumnCount(e), r = this.getRawCellWidths(e), i = this.createRow(n, r), a = e.querySelectorAll(`[${
|
|
1778
|
+
let n = this.getColumnCount(e), r = this.getRawCellWidths(e), i = this.createRow(n, r), a = e.querySelectorAll(`[${D}]`);
|
|
1773
1779
|
return t !== void 0 && t < a.length ? e.insertBefore(i, a[t]) : e.appendChild(i), i;
|
|
1774
1780
|
}
|
|
1775
1781
|
deleteRow(e, t) {
|
|
1776
|
-
let n = e.querySelectorAll(`[${
|
|
1782
|
+
let n = e.querySelectorAll(`[${D}]`);
|
|
1777
1783
|
t < n.length && n[t].remove();
|
|
1778
1784
|
}
|
|
1779
1785
|
addColumn(e, t, n, r) {
|
|
1780
|
-
let i = e.querySelectorAll(`[${
|
|
1786
|
+
let i = e.querySelectorAll(`[${D}]`), a = this.getColumnCount(e), o = n !== void 0 && n.length === a, s = o || this.detectWidthUnit(e) === "px";
|
|
1781
1787
|
return o && this.convertToPixelWidths(i, n), s ? (this.addColumnPx(i, a, t, r), !0) : (this.addColumnPercent(i, a, t), !0);
|
|
1782
1788
|
}
|
|
1783
1789
|
convertToPixelWidths(e, t) {
|
|
1784
1790
|
e.forEach((e) => {
|
|
1785
|
-
e.querySelectorAll(`[${
|
|
1791
|
+
e.querySelectorAll(`[${O}]`).forEach((e, n) => {
|
|
1786
1792
|
if (n < t.length) {
|
|
1787
1793
|
let r = e;
|
|
1788
1794
|
r.style.width = `${t[n]}px`;
|
|
@@ -1793,7 +1799,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1793
1799
|
addColumnPx(e, t, n, r) {
|
|
1794
1800
|
let i = r == null ? this.computeHalfAvgPxWidth(e, t) : r;
|
|
1795
1801
|
e.forEach((e) => {
|
|
1796
|
-
let t = e.querySelectorAll(`[${
|
|
1802
|
+
let t = e.querySelectorAll(`[${O}]`), r = n === void 0 || n >= t.length, a = this.createCell(`${i}px`);
|
|
1797
1803
|
if (!r) {
|
|
1798
1804
|
e.insertBefore(a, t[n]);
|
|
1799
1805
|
return;
|
|
@@ -1802,17 +1808,17 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1802
1808
|
});
|
|
1803
1809
|
}
|
|
1804
1810
|
computeHalfAvgPxWidth(e, t) {
|
|
1805
|
-
let n = e[0], r = n == null ? void 0 : n.querySelectorAll(`[${
|
|
1811
|
+
let n = e[0], r = n == null ? void 0 : n.querySelectorAll(`[${O}]`), i = Array.from(r == null ? [] : r).reduce((e, t) => e + (parseFloat(t.style.width) || 0), 0);
|
|
1806
1812
|
return t > 0 ? Math.round(i / t / 2 * 100) / 100 : 0;
|
|
1807
1813
|
}
|
|
1808
1814
|
addColumnPercent(e, t, n) {
|
|
1809
1815
|
let r = 1 - .5 / t;
|
|
1810
1816
|
e.forEach((e) => {
|
|
1811
|
-
e.querySelectorAll(`[${
|
|
1817
|
+
e.querySelectorAll(`[${O}]`).forEach((e) => {
|
|
1812
1818
|
let n = e, i = parseFloat(n.style.width) || 100 / t, a = Math.round(i * r * 100) / 100;
|
|
1813
1819
|
n.style.width = `${a}%`;
|
|
1814
1820
|
});
|
|
1815
|
-
let i = Math.round(100 / t / 2 * 100) / 100, a = e.querySelectorAll(`[${
|
|
1821
|
+
let i = Math.round(100 / t / 2 * 100) / 100, a = e.querySelectorAll(`[${O}]`), o = n === void 0 || n >= a.length, s = this.createCell(`${i}%`);
|
|
1816
1822
|
if (!o) {
|
|
1817
1823
|
e.insertBefore(s, a[n]);
|
|
1818
1824
|
return;
|
|
@@ -1821,77 +1827,77 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1821
1827
|
});
|
|
1822
1828
|
}
|
|
1823
1829
|
deleteColumn(e, t) {
|
|
1824
|
-
e.querySelectorAll(`[${
|
|
1825
|
-
let n = e.querySelectorAll(`[${
|
|
1830
|
+
e.querySelectorAll(`[${D}]`).forEach((e) => {
|
|
1831
|
+
let n = e.querySelectorAll(`[${O}]`);
|
|
1826
1832
|
t >= n.length || n[t].remove();
|
|
1827
1833
|
});
|
|
1828
1834
|
}
|
|
1829
1835
|
moveRow(e, t, n) {
|
|
1830
1836
|
if (t === n) return;
|
|
1831
|
-
let r = Array.from(e.querySelectorAll(`[${
|
|
1837
|
+
let r = Array.from(e.querySelectorAll(`[${D}]`));
|
|
1832
1838
|
if (t >= r.length || n >= r.length) return;
|
|
1833
1839
|
let i = r[t];
|
|
1834
1840
|
i.remove();
|
|
1835
|
-
let a = Array.from(e.querySelectorAll(`[${
|
|
1841
|
+
let a = Array.from(e.querySelectorAll(`[${D}]`));
|
|
1836
1842
|
n >= a.length ? e.appendChild(i) : e.insertBefore(i, a[n]);
|
|
1837
1843
|
}
|
|
1838
1844
|
moveColumn(e, t, n) {
|
|
1839
|
-
t !== n && e.querySelectorAll(`[${
|
|
1840
|
-
let r = Array.from(e.querySelectorAll(`[${
|
|
1845
|
+
t !== n && e.querySelectorAll(`[${D}]`).forEach((e) => {
|
|
1846
|
+
let r = Array.from(e.querySelectorAll(`[${O}]`));
|
|
1841
1847
|
if (t >= r.length || n >= r.length) return;
|
|
1842
1848
|
let i = r[t];
|
|
1843
1849
|
i.remove();
|
|
1844
|
-
let a = Array.from(e.querySelectorAll(`[${
|
|
1850
|
+
let a = Array.from(e.querySelectorAll(`[${O}]`));
|
|
1845
1851
|
n >= a.length ? e.appendChild(i) : e.insertBefore(i, a[n]);
|
|
1846
1852
|
});
|
|
1847
1853
|
}
|
|
1848
1854
|
getRowCount(e) {
|
|
1849
|
-
return e.querySelectorAll(`[${
|
|
1855
|
+
return e.querySelectorAll(`[${D}]`).length;
|
|
1850
1856
|
}
|
|
1851
1857
|
getColumnCount(e) {
|
|
1852
|
-
let t = e.querySelector(`[${
|
|
1853
|
-
return t ? t.querySelectorAll(`[${
|
|
1858
|
+
let t = e.querySelector(`[${D}]`);
|
|
1859
|
+
return t ? t.querySelectorAll(`[${O}]`).length : 0;
|
|
1854
1860
|
}
|
|
1855
1861
|
getCell(e, t, n) {
|
|
1856
|
-
let r = e.querySelectorAll(`[${
|
|
1862
|
+
let r = e.querySelectorAll(`[${D}]`);
|
|
1857
1863
|
if (t >= r.length) return null;
|
|
1858
|
-
let i = r[t].querySelectorAll(`[${
|
|
1864
|
+
let i = r[t].querySelectorAll(`[${O}]`);
|
|
1859
1865
|
return n >= i.length ? null : i[n];
|
|
1860
1866
|
}
|
|
1861
1867
|
getColWidths(e) {
|
|
1862
|
-
let t = e.querySelector(`[${
|
|
1868
|
+
let t = e.querySelector(`[${D}]`);
|
|
1863
1869
|
if (!t) return [];
|
|
1864
|
-
let n = t.querySelectorAll(`[${
|
|
1870
|
+
let n = t.querySelectorAll(`[${O}]`), r = [];
|
|
1865
1871
|
return n.forEach((e) => {
|
|
1866
1872
|
let t = parseFloat(e.style.width);
|
|
1867
1873
|
r.push(isNaN(t) ? 0 : t);
|
|
1868
1874
|
}), r;
|
|
1869
1875
|
}
|
|
1870
1876
|
detectWidthUnit(e) {
|
|
1871
|
-
let t = e.querySelector(`[${
|
|
1877
|
+
let t = e.querySelector(`[${D}]`);
|
|
1872
1878
|
if (!t) return "%";
|
|
1873
|
-
let n = t.querySelector(`[${
|
|
1879
|
+
let n = t.querySelector(`[${O}]`);
|
|
1874
1880
|
return n && n.style.width.endsWith("px") ? "px" : "%";
|
|
1875
1881
|
}
|
|
1876
1882
|
getRawCellWidths(e) {
|
|
1877
|
-
let t = e.querySelector(`[${
|
|
1883
|
+
let t = e.querySelector(`[${D}]`);
|
|
1878
1884
|
if (!t) return [];
|
|
1879
|
-
let n = t.querySelectorAll(`[${
|
|
1885
|
+
let n = t.querySelectorAll(`[${O}]`);
|
|
1880
1886
|
return Array.from(n).map((e) => e.style.width);
|
|
1881
1887
|
}
|
|
1882
1888
|
createRow(e, t) {
|
|
1883
1889
|
let n = document.createElement("div");
|
|
1884
|
-
return n.className =
|
|
1890
|
+
return n.className = C(dr), n.setAttribute(D, ""), Array.from({ length: e }).forEach((e, r) => {
|
|
1885
1891
|
n.appendChild(this.createCell(t[r]));
|
|
1886
1892
|
}), n;
|
|
1887
1893
|
}
|
|
1888
1894
|
createCell(e) {
|
|
1889
1895
|
let t = document.createElement("div");
|
|
1890
|
-
t.className =
|
|
1896
|
+
t.className = C(fr), t.style.borderRight = ur, t.style.borderBottom = ur, t.style.flexShrink = "0", t.style.overflow = "hidden", t.style.overflowWrap = "break-word", e !== void 0 && (t.style.width = typeof e == "string" ? e : `${e}%`), t.setAttribute(O, "");
|
|
1891
1897
|
let n = document.createElement("div");
|
|
1892
|
-
return n.setAttribute(
|
|
1898
|
+
return n.setAttribute(A, ""), t.appendChild(n), t;
|
|
1893
1899
|
}
|
|
1894
|
-
},
|
|
1900
|
+
}, k = (e) => typeof e == "object" && !!e && "blocks" in e, A = "data-blok-table-cell-blocks", hr = class {
|
|
1895
1901
|
constructor(e) {
|
|
1896
1902
|
var t;
|
|
1897
1903
|
this._activeCellWithBlocks = null, this.cellsPendingCheck = /* @__PURE__ */ new Set(), this.pendingCheckScheduled = !1, this.removedBlockCells = /* @__PURE__ */ new Map(), this.deferredEvents = [], this.isExitingTable = !1, this.handleBlockMutation = (e) => {
|
|
@@ -1913,9 +1919,9 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1913
1919
|
this.claimBlockForCell(i.cell, n.target.id), this.syncBlockToModel(i.cell, n.target.id), this.cellsPendingCheck.delete(i.cell);
|
|
1914
1920
|
return;
|
|
1915
1921
|
}
|
|
1916
|
-
let a = n.target.holder, o = a.closest(`[${
|
|
1922
|
+
let a = n.target.holder, o = a.closest(`[${A}]`);
|
|
1917
1923
|
o && this.stripPlaceholders(o);
|
|
1918
|
-
let s = o && !this.model.findCellForBlock(n.target.id) ? o.closest(`[${
|
|
1924
|
+
let s = o && !this.model.findCellForBlock(n.target.id) ? o.closest(`[${O}]`) : null;
|
|
1919
1925
|
if (s && this.syncBlockToModel(s, n.target.id), o) return;
|
|
1920
1926
|
if (!this.gridElement.contains(a)) {
|
|
1921
1927
|
let e = this.api.blocks.getBlockIndex(this.tableBlockId), t = e === void 0 ? null : this.api.blocks.getBlockByIndex(e);
|
|
@@ -1931,11 +1937,11 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
1931
1937
|
}, this.handleCellBlankSpaceClick = (e) => {
|
|
1932
1938
|
let t = e.target;
|
|
1933
1939
|
if (!t) return;
|
|
1934
|
-
let n = t.hasAttribute(
|
|
1940
|
+
let n = t.hasAttribute(O), r = t.hasAttribute(A);
|
|
1935
1941
|
if (!n && !r) return;
|
|
1936
|
-
let i = n ? t : t.closest(`[${
|
|
1942
|
+
let i = n ? t : t.closest(`[${O}]`);
|
|
1937
1943
|
if (!i) return;
|
|
1938
|
-
let a = n ? i.querySelector(`[${
|
|
1944
|
+
let a = n ? i.querySelector(`[${A}]`) : t;
|
|
1939
1945
|
if (!a) return;
|
|
1940
1946
|
let o = a.querySelectorAll("[data-blok-id]"), s = o[o.length - 1];
|
|
1941
1947
|
if (!s) return;
|
|
@@ -2033,7 +2039,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
2033
2039
|
this.clearActiveCellWithBlocks();
|
|
2034
2040
|
let r = this.getCell(e.row, e.col);
|
|
2035
2041
|
if (!r) return;
|
|
2036
|
-
let i = r.querySelector(`[${
|
|
2042
|
+
let i = r.querySelector(`[${A}]`);
|
|
2037
2043
|
if (!i) return;
|
|
2038
2044
|
let a = i.querySelectorAll("[contenteditable=\"true\"]");
|
|
2039
2045
|
a.length !== 0 && ((t ? a[a.length - 1] : a[0]).focus(), (n = this.onNavigateToCell) == null || n.call(this, e));
|
|
@@ -2052,18 +2058,18 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
2052
2058
|
return r ? (n = r.querySelectorAll("[data-blok-table-cell]")[t]) == null ? null : n : null;
|
|
2053
2059
|
}
|
|
2054
2060
|
initializeCells(e) {
|
|
2055
|
-
let t = this.gridElement.querySelectorAll(`[${
|
|
2061
|
+
let t = this.gridElement.querySelectorAll(`[${D}]`), n = [];
|
|
2056
2062
|
return e.forEach((e, r) => {
|
|
2057
2063
|
let i = t[r];
|
|
2058
2064
|
if (!i) return;
|
|
2059
|
-
let a = i.querySelectorAll(`[${
|
|
2065
|
+
let a = i.querySelectorAll(`[${O}]`), o = [];
|
|
2060
2066
|
e.forEach((e, t) => {
|
|
2061
2067
|
let n = a[t];
|
|
2062
2068
|
if (!n) return;
|
|
2063
|
-
let r = n.querySelector(`[${
|
|
2069
|
+
let r = n.querySelector(`[${A}]`);
|
|
2064
2070
|
if (!r) return;
|
|
2065
|
-
let i =
|
|
2066
|
-
if (
|
|
2071
|
+
let i = k(e) && e.blocks.length > 0 ? [...e.blocks] : null, s = i ? this.mountBlocksInCell(r, i) : [], c = {};
|
|
2072
|
+
if (k(e) && (e.color !== void 0 && (c.color = e.color), e.textColor !== void 0 && (c.textColor = e.textColor)), s.length > 0) o.push(S({ blocks: i == null ? s : i }, c));
|
|
2067
2073
|
else {
|
|
2068
2074
|
var l;
|
|
2069
2075
|
let t = typeof e == "string" ? e : (l = e.text) == null ? "" : l, n = t.split(/<br\s*\/?>/i).map((e) => e.trim()).filter(Boolean), a = n.length > 0 ? n : [t], s = [];
|
|
@@ -2071,7 +2077,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
2071
2077
|
let t = this.api.blocks.insert("paragraph", { text: e }, {}, this.api.blocks.getBlocksCount(), !1);
|
|
2072
2078
|
r.appendChild(t.holder), this.api.blocks.setBlockParent(t.id, this.tableBlockId), s.push(t.id);
|
|
2073
2079
|
}
|
|
2074
|
-
o.push(
|
|
2080
|
+
o.push(S({ blocks: i === null ? s : [...i, ...s] }, c));
|
|
2075
2081
|
}
|
|
2076
2082
|
this.stripPlaceholders(r);
|
|
2077
2083
|
}), n.push(o);
|
|
@@ -2096,7 +2102,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
2096
2102
|
}
|
|
2097
2103
|
claimBlockForCell(e, t) {
|
|
2098
2104
|
var n, r;
|
|
2099
|
-
let i = e.querySelector(`[${
|
|
2105
|
+
let i = e.querySelector(`[${A}]`);
|
|
2100
2106
|
if (!i) return;
|
|
2101
2107
|
let a = this.api.blocks.getBlockIndex(t);
|
|
2102
2108
|
if (a === void 0) return;
|
|
@@ -2110,12 +2116,12 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
2110
2116
|
}
|
|
2111
2117
|
findCellForAdjacentBlock(e) {
|
|
2112
2118
|
if (e < 0 || e >= this.api.blocks.getBlocksCount()) return null;
|
|
2113
|
-
let t = this.api.blocks.getBlockByIndex(e), n = t == null ? void 0 : t.holder.closest(`[${
|
|
2119
|
+
let t = this.api.blocks.getBlockByIndex(e), n = t == null ? void 0 : t.holder.closest(`[${O}]`);
|
|
2114
2120
|
return n && this.gridElement.contains(n) ? n : null;
|
|
2115
2121
|
}
|
|
2116
2122
|
ensureCellHasBlock(e) {
|
|
2117
2123
|
var t, n;
|
|
2118
|
-
let r = e.querySelector(`[${
|
|
2124
|
+
let r = e.querySelector(`[${A}]`);
|
|
2119
2125
|
r && r.querySelector("[data-blok-id]") === null && ((t = (n = this.api.blocks).transactWithoutCapture) == null || t.call(n, () => {
|
|
2120
2126
|
let t = this.api.blocks.insert("paragraph", { text: "" }, {}, this.api.blocks.getBlocksCount(), !0);
|
|
2121
2127
|
r.appendChild(t.holder), this.api.blocks.setBlockParent(t.id, this.tableBlockId), this.syncBlockToModel(e, t.id), this.stripPlaceholders(r);
|
|
@@ -2137,11 +2143,11 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
2137
2143
|
n && this.model.addBlockToCell(n.row, n.col, t);
|
|
2138
2144
|
}
|
|
2139
2145
|
getCellPosition(e) {
|
|
2140
|
-
let t = e.closest(`[${
|
|
2146
|
+
let t = e.closest(`[${D}]`);
|
|
2141
2147
|
if (!t) return null;
|
|
2142
|
-
let n = Array.from(this.gridElement.querySelectorAll(`[${
|
|
2148
|
+
let n = Array.from(this.gridElement.querySelectorAll(`[${D}]`)).indexOf(t);
|
|
2143
2149
|
if (n < 0) return null;
|
|
2144
|
-
let r = Array.from(t.querySelectorAll(`[${
|
|
2150
|
+
let r = Array.from(t.querySelectorAll(`[${O}]`)).indexOf(e);
|
|
2145
2151
|
return r < 0 ? null : {
|
|
2146
2152
|
row: n,
|
|
2147
2153
|
col: r
|
|
@@ -2149,7 +2155,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
2149
2155
|
}
|
|
2150
2156
|
recordRemovedBlockCell(e) {
|
|
2151
2157
|
if (e.index === void 0) return;
|
|
2152
|
-
let t = e.target.holder.closest(`[${
|
|
2158
|
+
let t = e.target.holder.closest(`[${O}]`);
|
|
2153
2159
|
t && this.gridElement.contains(t) && this.removedBlockCells.set(e.target.id, {
|
|
2154
2160
|
cell: t,
|
|
2155
2161
|
index: e.index
|
|
@@ -2197,7 +2203,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
2197
2203
|
getBlockIdsFromCells(e) {
|
|
2198
2204
|
let t = [];
|
|
2199
2205
|
return Array.from(e).forEach((e) => {
|
|
2200
|
-
let n = e.querySelector(`[${
|
|
2206
|
+
let n = e.querySelector(`[${A}]`);
|
|
2201
2207
|
n && n.querySelectorAll("[data-blok-id]").forEach((e) => {
|
|
2202
2208
|
let n = e.getAttribute("data-blok-id");
|
|
2203
2209
|
n && t.push(n);
|
|
@@ -2210,7 +2216,7 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
2210
2216
|
});
|
|
2211
2217
|
}
|
|
2212
2218
|
deleteAllBlocks() {
|
|
2213
|
-
let e = this.gridElement.querySelectorAll(`[${
|
|
2219
|
+
let e = this.gridElement.querySelectorAll(`[${O}]`), t = this.getBlockIdsFromCells(e);
|
|
2214
2220
|
this.deleteBlocks(t);
|
|
2215
2221
|
}
|
|
2216
2222
|
destroy() {
|
|
@@ -2227,18 +2233,18 @@ var Tt = "outline-hidden py-[7px] mt-[2px] mb-px", Et = "outline-hidden pl-0.5 l
|
|
|
2227
2233
|
};
|
|
2228
2234
|
//#endregion
|
|
2229
2235
|
//#region src/components/shared/color-picker.ts
|
|
2230
|
-
function
|
|
2236
|
+
function gr() {
|
|
2231
2237
|
var e, t;
|
|
2232
2238
|
let n = document.documentElement.getAttribute("data-blok-theme");
|
|
2233
|
-
return n === "dark" ?
|
|
2239
|
+
return n === "dark" ? ue : n === "light" ? oe : typeof window < "u" && (e = (t = window).matchMedia) != null && e.call(t, "(prefers-color-scheme: dark)").matches ? ue : oe;
|
|
2234
2240
|
}
|
|
2235
|
-
function
|
|
2241
|
+
function _r(e, t) {
|
|
2236
2242
|
if (e === t) return !0;
|
|
2237
|
-
let n =
|
|
2243
|
+
let n = ie(e), r = ie(t);
|
|
2238
2244
|
return n === null || r === null ? !1 : n[0] === r[0] && n[1] === r[1] && n[2] === r[2];
|
|
2239
2245
|
}
|
|
2240
|
-
var
|
|
2241
|
-
function
|
|
2246
|
+
var vr = "var(--blok-swatch-neutral-bg)";
|
|
2247
|
+
function yr(e) {
|
|
2242
2248
|
let { i18n: t, modes: n, testIdPrefix: r, onColorSelect: i } = e, a = { activeColors: Object.fromEntries(n.map((e) => [e.key, null])) }, o = document.createElement("div");
|
|
2243
2249
|
o.setAttribute("data-blok-testid", `${r}-picker`), o.className = "flex flex-col gap-3 p-2";
|
|
2244
2250
|
let s = [];
|
|
@@ -2251,21 +2257,21 @@ function sr(e) {
|
|
|
2251
2257
|
a.className = "grid gap-1", a.style.gridTemplateColumns = "repeat(5, 2.25rem)", s.push(a), n.appendChild(i), n.appendChild(a), o.appendChild(n);
|
|
2252
2258
|
});
|
|
2253
2259
|
let c = (e) => {
|
|
2254
|
-
let o = s[e], c = n[e], l =
|
|
2260
|
+
let o = s[e], c = n[e], l = gr();
|
|
2255
2261
|
o.innerHTML = "";
|
|
2256
2262
|
let u = a.activeColors[c.key], d = document.createElement("button"), f = u === null;
|
|
2257
|
-
d.setAttribute("data-blok-testid", `${r}-swatch-${c.key}-default`), d.className =
|
|
2263
|
+
d.setAttribute("data-blok-testid", `${r}-swatch-${c.key}-default`), d.className = C("w-9 h-9 rounded-md cursor-pointer border-none outline-hidden", "flex items-center justify-center text-sm font-semibold", "transition-[box-shadow,transform] ring-inset hover:ring-2 hover:ring-swatch-ring-hover active:scale-90", f && "ring-2 ring-swatch-ring-hover"), d.textContent = c.presetField === "text" ? "A" : "", c.presetField === "text" && (d.style.color = "var(--blok-text-primary)"), d.style.backgroundColor = vr, d.addEventListener("click", () => {
|
|
2258
2264
|
i(null, c.key);
|
|
2259
2265
|
});
|
|
2260
2266
|
let p = t.t("tools.colorPicker.defaultSwatchLabel").replace("{default}", t.t("tools.marker.default")).replace("{mode}", t.t(c.labelKey).toLowerCase());
|
|
2261
|
-
|
|
2267
|
+
v(d, p.charAt(0).toUpperCase() + p.slice(1), { placement: "top" }), o.appendChild(d);
|
|
2262
2268
|
for (let e of l) {
|
|
2263
|
-
let n = document.createElement("button"), a = c.presetField === "text" ? e.text : e.bg, s = u !== null &&
|
|
2264
|
-
n.setAttribute("data-blok-testid", `${r}-swatch-${c.key}-${e.name}`), n.className =
|
|
2269
|
+
let n = document.createElement("button"), a = c.presetField === "text" ? e.text : e.bg, s = u !== null && _r(a, u);
|
|
2270
|
+
n.setAttribute("data-blok-testid", `${r}-swatch-${c.key}-${e.name}`), n.className = C("w-9 h-9 rounded-md cursor-pointer border-none outline-hidden", "flex items-center justify-center text-sm font-semibold", "transition-[box-shadow,transform] ring-inset hover:ring-2 hover:ring-swatch-ring-hover active:scale-90", s && "ring-2 ring-swatch-ring-hover"), n.textContent = c.presetField === "text" ? "A" : "", c.presetField === "text" ? (n.style.color = e.text, n.style.backgroundColor = vr) : (n.style.color = l === ue ? e.text : "#37352f", n.style.backgroundColor = e.bg), n.addEventListener("click", () => {
|
|
2265
2271
|
i(a, c.key);
|
|
2266
2272
|
});
|
|
2267
2273
|
let d = t.t("tools.colorPicker.colorSwatchLabel").replace("{color}", t.t("tools.colorPicker.color." + e.name)).replace("{mode}", t.t(c.labelKey).toLowerCase());
|
|
2268
|
-
|
|
2274
|
+
v(n, d.charAt(0).toUpperCase() + d.slice(1), { placement: "top" }), o.appendChild(n);
|
|
2269
2275
|
}
|
|
2270
2276
|
}, l = () => {
|
|
2271
2277
|
n.forEach((e, t) => c(t));
|
|
@@ -2284,8 +2290,8 @@ function sr(e) {
|
|
|
2284
2290
|
}
|
|
2285
2291
|
//#endregion
|
|
2286
2292
|
//#region src/tools/table/table-cell-color-picker.ts
|
|
2287
|
-
var
|
|
2288
|
-
let t =
|
|
2293
|
+
var br = (e) => {
|
|
2294
|
+
let t = yr({
|
|
2289
2295
|
i18n: e.i18n,
|
|
2290
2296
|
testIdPrefix: "cell-color",
|
|
2291
2297
|
modes: [{
|
|
@@ -2302,40 +2308,40 @@ var cr = (e) => {
|
|
|
2302
2308
|
}
|
|
2303
2309
|
});
|
|
2304
2310
|
return { element: t.element };
|
|
2305
|
-
},
|
|
2311
|
+
}, xr = (e, t, n) => {
|
|
2306
2312
|
t === "col" ? Object.assign(e.style, { height: `${n}px` }) : Object.assign(e.style, { width: `${n}px` });
|
|
2307
|
-
},
|
|
2313
|
+
}, Sr = [
|
|
2308
2314
|
[2, 2],
|
|
2309
2315
|
[8, 2],
|
|
2310
2316
|
[2, 7],
|
|
2311
2317
|
[8, 7],
|
|
2312
2318
|
[2, 12],
|
|
2313
2319
|
[8, 12]
|
|
2314
|
-
],
|
|
2320
|
+
], Cr = [
|
|
2315
2321
|
[2, 2],
|
|
2316
2322
|
[7, 2],
|
|
2317
2323
|
[12, 2],
|
|
2318
2324
|
[2, 8],
|
|
2319
2325
|
[7, 8],
|
|
2320
2326
|
[12, 8]
|
|
2321
|
-
],
|
|
2327
|
+
], wr = (e) => {
|
|
2322
2328
|
let t = document.createElementNS("http://www.w3.org/2000/svg", "svg"), n = e === "horizontal";
|
|
2323
2329
|
t.setAttribute("width", n ? "14" : "10"), t.setAttribute("height", n ? "10" : "14"), t.setAttribute("viewBox", n ? "0 0 14 10" : "0 0 10 14"), t.setAttribute("fill", "currentColor"), t.classList.add("opacity-0", "transition-opacity", "duration-150", "text-gray-400", "pointer-events-none");
|
|
2324
|
-
let r = n ?
|
|
2330
|
+
let r = n ? Cr : Sr;
|
|
2325
2331
|
for (let [e, n] of r) {
|
|
2326
2332
|
let r = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
2327
2333
|
r.setAttribute("cx", String(e)), r.setAttribute("cy", String(n)), r.setAttribute("r", "1.5"), t.appendChild(r);
|
|
2328
2334
|
}
|
|
2329
2335
|
return t;
|
|
2330
|
-
},
|
|
2336
|
+
}, Tr = (e, t) => {
|
|
2331
2337
|
t === "col" ? Object.assign(e.style, { height: "16px" }) : Object.assign(e.style, { width: "16px" }), e.classList.add("bg-gray-200"), e.classList.remove("bg-gray-300");
|
|
2332
2338
|
let n = e.querySelector("svg");
|
|
2333
2339
|
n && (n.classList.remove("opacity-0"), n.classList.add("opacity-100"));
|
|
2334
|
-
},
|
|
2335
|
-
|
|
2340
|
+
}, Er = (e, t, n) => {
|
|
2341
|
+
xr(e, t, n), e.classList.remove("bg-gray-200"), e.classList.add("bg-gray-300");
|
|
2336
2342
|
let r = e.querySelector("svg");
|
|
2337
2343
|
r && (r.classList.add("opacity-0"), r.classList.remove("opacity-100"));
|
|
2338
|
-
},
|
|
2344
|
+
}, Dr = "data-blok-table-cell-selected", Or = "2px solid #3b82f6", kr = "data-blok-table-selection-pill", Ar = 16, jr = 20, Mr = 4, Nr = [
|
|
2339
2345
|
"absolute",
|
|
2340
2346
|
"z-3",
|
|
2341
2347
|
"rounded-sm",
|
|
@@ -2348,7 +2354,7 @@ var cr = (e) => {
|
|
|
2348
2354
|
"overflow-hidden",
|
|
2349
2355
|
"cursor-pointer",
|
|
2350
2356
|
"bg-blue-500"
|
|
2351
|
-
],
|
|
2357
|
+
], Pr = (e) => e.style.userSelect === "none", Fr = class {
|
|
2352
2358
|
constructor(e) {
|
|
2353
2359
|
this.anchorCell = null, this.extentCell = null, this.isSelecting = !1, this.hasSelection = !1, this.selectedCells = [], this.overlay = null, this.pill = null, this.pillPopover = null, this.resizeObserver = null, this.lastPaintedRange = null, this.grid = e.grid, this.rectangleSelection = e.rectangleSelection, this.onSelectionActiveChange = e.onSelectionActiveChange, this.onClearContent = e.onClearContent, this.onCopy = e.onCopy, this.onCut = e.onCut, this.onCopyViaButton = e.onCopyViaButton, this.onColorChange = e.onColorChange, this.onSelectionRangeChange = e.onSelectionRangeChange, this.onPointerDragActiveChange = e.onPointerDragActiveChange, this.isPopoverOpen = e.isPopoverOpen, this.i18n = e.i18n, this.grid.style.position = "relative", this.boundPointerDown = this.handlePointerDown.bind(this), this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundClearSelection = this.handleClearSelection.bind(this), this.boundCancelRectangle = this.handleCancelRectangle.bind(this), this.boundKeyDown = this.handleKeyDown.bind(this), this.boundCopyHandler = this.handleCopy.bind(this), this.boundCutHandler = this.handleCut.bind(this), this.boundPreventDragStart = this.handleDragStart.bind(this), this.grid.addEventListener("pointerdown", this.boundPointerDown), this.grid.addEventListener("dragstart", this.boundPreventDragStart), document.addEventListener("keydown", this.boundKeyDown), document.addEventListener("copy", this.boundCopyHandler), document.addEventListener("cut", this.boundCutHandler);
|
|
2354
2360
|
}
|
|
@@ -2365,7 +2371,7 @@ var cr = (e) => {
|
|
|
2365
2371
|
r !== 0 && this.showProgrammaticSelection(e, 0, e, r - 1);
|
|
2366
2372
|
}
|
|
2367
2373
|
selectColumn(e) {
|
|
2368
|
-
let t = this.grid.querySelectorAll(`[${
|
|
2374
|
+
let t = this.grid.querySelectorAll(`[${D}]`).length;
|
|
2369
2375
|
t !== 0 && this.showProgrammaticSelection(0, e, t - 1, e);
|
|
2370
2376
|
}
|
|
2371
2377
|
clearActiveSelection() {
|
|
@@ -2382,9 +2388,9 @@ var cr = (e) => {
|
|
|
2382
2388
|
}
|
|
2383
2389
|
handlePointerDown(e) {
|
|
2384
2390
|
var t;
|
|
2385
|
-
if (
|
|
2391
|
+
if (Pr(this.grid) || e.button !== 0) return;
|
|
2386
2392
|
let n = e.target;
|
|
2387
|
-
if (n.closest("[data-blok-table-grip]") || n.closest("[data-blok-table-resize]") || n.closest(`[${
|
|
2393
|
+
if (n.closest("[data-blok-table-grip]") || n.closest("[data-blok-table-resize]") || n.closest(`[${kr}]`)) return;
|
|
2388
2394
|
let r = this.resolveCellCoord(n);
|
|
2389
2395
|
r && (this.hasSelection && this.lastPaintedRange !== null && this.lastPaintedRange.minRow === r.row && this.lastPaintedRange.maxRow === r.row && this.lastPaintedRange.minCol === r.col && this.lastPaintedRange.maxCol === r.col ? document.removeEventListener("pointerdown", this.boundClearSelection) : this.hasSelection && this.clearSelection(), this.anchorCell = r, this.isSelecting = !1, (t = this.onPointerDragActiveChange) == null || t.call(this, !0), document.addEventListener("mousemove", this.boundCancelRectangle, !0), document.addEventListener("pointermove", this.boundPointerMove), document.addEventListener("pointerup", this.boundPointerUp), document.addEventListener("pointercancel", this.boundPointerUp));
|
|
2390
2396
|
}
|
|
@@ -2426,7 +2432,7 @@ var cr = (e) => {
|
|
|
2426
2432
|
}
|
|
2427
2433
|
handleClearSelection(e) {
|
|
2428
2434
|
let t = e.target;
|
|
2429
|
-
t instanceof HTMLElement && t.closest(`[${
|
|
2435
|
+
t instanceof HTMLElement && t.closest(`[${kr}]`) || t instanceof HTMLElement && t.closest("[data-blok-popover-opened]") !== null || (this.pillPopover !== null && this.destroyPillPopover(), document.removeEventListener("pointerdown", this.boundClearSelection), this.clearSelection());
|
|
2430
2436
|
}
|
|
2431
2437
|
handleKeyDown(e) {
|
|
2432
2438
|
var t;
|
|
@@ -2449,7 +2455,7 @@ var cr = (e) => {
|
|
|
2449
2455
|
}
|
|
2450
2456
|
restoreModifiedCells() {
|
|
2451
2457
|
this.destroyPillPopover(), this.disconnectResizeObserver(), this.selectedCells.forEach((e) => {
|
|
2452
|
-
e.removeAttribute(
|
|
2458
|
+
e.removeAttribute(Dr);
|
|
2453
2459
|
}), this.pill && (this.pill.remove(), this.pill = null), this.overlay && (this.overlay.remove(), this.overlay = null), this.selectedCells = [];
|
|
2454
2460
|
}
|
|
2455
2461
|
showProgrammaticSelection(e, t, n, r) {
|
|
@@ -2470,7 +2476,7 @@ var cr = (e) => {
|
|
|
2470
2476
|
var e, t;
|
|
2471
2477
|
if (!this.anchorCell || !this.extentCell) return;
|
|
2472
2478
|
this.selectedCells.forEach((e) => {
|
|
2473
|
-
e.removeAttribute(
|
|
2479
|
+
e.removeAttribute(Dr);
|
|
2474
2480
|
}), this.selectedCells = [];
|
|
2475
2481
|
let n = Math.min(this.anchorCell.row, this.extentCell.row), r = Math.max(this.anchorCell.row, this.extentCell.row), i = Math.min(this.anchorCell.col, this.extentCell.col), a = Math.max(this.anchorCell.col, this.extentCell.col);
|
|
2476
2482
|
this.lastPaintedRange = {
|
|
@@ -2479,20 +2485,20 @@ var cr = (e) => {
|
|
|
2479
2485
|
minCol: i,
|
|
2480
2486
|
maxCol: a
|
|
2481
2487
|
};
|
|
2482
|
-
let o = this.grid.querySelectorAll(`[${
|
|
2488
|
+
let o = this.grid.querySelectorAll(`[${D}]`);
|
|
2483
2489
|
this.selectedCells = this.collectCellsInRange(o, n, r, i, a), this.selectedCells.forEach((e) => {
|
|
2484
|
-
e.setAttribute(
|
|
2490
|
+
e.setAttribute(Dr, "");
|
|
2485
2491
|
});
|
|
2486
|
-
let s = (e = o[n]) == null ? void 0 : e.querySelectorAll(`[${
|
|
2492
|
+
let s = (e = o[n]) == null ? void 0 : e.querySelectorAll(`[${O}]`)[i], c = (t = o[r]) == null ? void 0 : t.querySelectorAll(`[${O}]`)[a];
|
|
2487
2493
|
if (!s || !c) return;
|
|
2488
|
-
let l = this.grid.getBoundingClientRect(), u = s.getBoundingClientRect(), d = c.getBoundingClientRect(), f = getComputedStyle(this.grid), p = parseFloat(f.borderTopWidth) || 0, m = parseFloat(f.borderLeftWidth) || 0, h = d.right - u.left + 1, g = d.bottom - u.top + 1,
|
|
2489
|
-
this.overlay || (this.overlay = document.createElement("div"), this.overlay.setAttribute("data-blok-table-selection-overlay", ""), this.overlay.style.position = "absolute", this.overlay.style.border =
|
|
2494
|
+
let l = this.grid.getBoundingClientRect(), u = s.getBoundingClientRect(), d = c.getBoundingClientRect(), f = getComputedStyle(this.grid), p = parseFloat(f.borderTopWidth) || 0, m = parseFloat(f.borderLeftWidth) || 0, h = d.right - u.left + 1, g = d.bottom - u.top + 1, ee = u.top - l.top - p - 1, _ = u.left - l.left - m - 1;
|
|
2495
|
+
this.overlay || (this.overlay = document.createElement("div"), this.overlay.setAttribute("data-blok-table-selection-overlay", ""), this.overlay.style.position = "absolute", this.overlay.style.border = Or, this.overlay.style.pointerEvents = "none", this.overlay.style.boxSizing = "border-box", this.overlay.style.borderRadius = "2px", this.grid.appendChild(this.overlay)), this.overlay.style.top = `${ee}px`, this.overlay.style.left = `${_}px`, this.overlay.style.width = `${h}px`, this.overlay.style.height = `${g}px`, this.pill || (this.pill = this.createPill(), this.grid.appendChild(this.pill)), this.pill.style.left = `${_ + h - 1}px`, this.pill.style.top = `${ee + g / 2}px`, this.observeCellResizes();
|
|
2490
2496
|
}
|
|
2491
2497
|
repositionOverlay() {
|
|
2492
2498
|
var e, t;
|
|
2493
2499
|
let n = this.lastPaintedRange;
|
|
2494
2500
|
if (!n || !this.overlay) return;
|
|
2495
|
-
let r = this.grid.querySelectorAll(`[${
|
|
2501
|
+
let r = this.grid.querySelectorAll(`[${D}]`), i = (e = r[n.minRow]) == null ? void 0 : e.querySelectorAll(`[${O}]`)[n.minCol], a = (t = r[n.maxRow]) == null ? void 0 : t.querySelectorAll(`[${O}]`)[n.maxCol];
|
|
2496
2502
|
if (!i || !a) return;
|
|
2497
2503
|
let o = this.grid.getBoundingClientRect(), s = i.getBoundingClientRect(), c = a.getBoundingClientRect(), l = getComputedStyle(this.grid), u = parseFloat(l.borderTopWidth) || 0, d = parseFloat(l.borderLeftWidth) || 0, f = c.right - s.left + 1, p = c.bottom - s.top + 1, m = s.top - o.top - u - 1, h = s.left - o.left - d - 1;
|
|
2498
2504
|
this.overlay.style.top = `${m}px`, this.overlay.style.left = `${h}px`, this.overlay.style.width = `${f}px`, this.overlay.style.height = `${p}px`, this.pill && (this.pill.style.left = `${h + f - 1}px`, this.pill.style.top = `${m + p / 2}px`);
|
|
@@ -2510,8 +2516,8 @@ var cr = (e) => {
|
|
|
2510
2516
|
}
|
|
2511
2517
|
createPill() {
|
|
2512
2518
|
let e = document.createElement("div");
|
|
2513
|
-
e.setAttribute(
|
|
2514
|
-
let t =
|
|
2519
|
+
e.setAttribute(kr, ""), e.setAttribute("contenteditable", "false"), e.className = C(Nr), e.style.width = `${Mr}px`, e.style.height = `${jr}px`, e.style.pointerEvents = "auto", e.style.transform = "translate(-50%, -50%)", e.style.outline = "2px solid var(--blok-table-grip-outline, transparent)";
|
|
2520
|
+
let t = wr("vertical");
|
|
2515
2521
|
return t.classList.remove("text-gray-400"), t.classList.add("text-white"), e.appendChild(t), e.addEventListener("mouseenter", () => {
|
|
2516
2522
|
this.pillPopover === null && this.expandPill();
|
|
2517
2523
|
}), e.addEventListener("mouseleave", () => {
|
|
@@ -2523,33 +2529,33 @@ var cr = (e) => {
|
|
|
2523
2529
|
openPillPopover() {
|
|
2524
2530
|
if (this.destroyPillPopover(), !this.pill) return;
|
|
2525
2531
|
this.expandPill();
|
|
2526
|
-
let e =
|
|
2532
|
+
let e = t === "Meta" ? "⌘C" : "Ctrl+C", r = [];
|
|
2527
2533
|
if (this.onColorChange !== void 0) {
|
|
2528
|
-
let { element: e } =
|
|
2534
|
+
let { element: e } = br({
|
|
2529
2535
|
i18n: this.i18n,
|
|
2530
2536
|
onColorSelect: (e, t) => {
|
|
2531
2537
|
var n;
|
|
2532
2538
|
(n = this.onColorChange) == null || n.call(this, [...this.selectedCells], e, t);
|
|
2533
2539
|
}
|
|
2534
2540
|
});
|
|
2535
|
-
|
|
2536
|
-
icon:
|
|
2541
|
+
r.push({
|
|
2542
|
+
icon: tt,
|
|
2537
2543
|
title: this.i18n.t("tools.table.cellColor"),
|
|
2538
2544
|
name: "cellColor",
|
|
2539
2545
|
children: {
|
|
2540
2546
|
items: [{
|
|
2541
|
-
type:
|
|
2547
|
+
type: _.Html,
|
|
2542
2548
|
element: e
|
|
2543
2549
|
}],
|
|
2544
2550
|
isFlippable: !1
|
|
2545
2551
|
}
|
|
2546
2552
|
});
|
|
2547
2553
|
}
|
|
2548
|
-
this.pillPopover = new
|
|
2554
|
+
this.pillPopover = new Me({
|
|
2549
2555
|
items: [
|
|
2550
|
-
...
|
|
2556
|
+
...r,
|
|
2551
2557
|
{
|
|
2552
|
-
icon:
|
|
2558
|
+
icon: n,
|
|
2553
2559
|
title: this.i18n.t("tools.table.copySelection"),
|
|
2554
2560
|
secondaryLabel: e,
|
|
2555
2561
|
closeOnActivate: !0,
|
|
@@ -2559,7 +2565,7 @@ var cr = (e) => {
|
|
|
2559
2565
|
}
|
|
2560
2566
|
},
|
|
2561
2567
|
{
|
|
2562
|
-
icon:
|
|
2568
|
+
icon: Re,
|
|
2563
2569
|
title: this.i18n.t("tools.table.clearSelection"),
|
|
2564
2570
|
secondaryLabel: "Del",
|
|
2565
2571
|
closeOnActivate: !0,
|
|
@@ -2571,19 +2577,19 @@ var cr = (e) => {
|
|
|
2571
2577
|
],
|
|
2572
2578
|
trigger: this.pill,
|
|
2573
2579
|
flippable: !0
|
|
2574
|
-
}), this.pillPopover.on(
|
|
2580
|
+
}), this.pillPopover.on(at.Closed, () => {
|
|
2575
2581
|
this.pillPopover !== null && (this.destroyPillPopover(), this.collapsePill());
|
|
2576
2582
|
}), this.pillPopover.show();
|
|
2577
2583
|
}
|
|
2578
2584
|
expandPill() {
|
|
2579
2585
|
if (!this.pill) return;
|
|
2580
|
-
this.pill.style.width = `${
|
|
2586
|
+
this.pill.style.width = `${Ar}px`;
|
|
2581
2587
|
let e = this.pill.querySelector("svg");
|
|
2582
2588
|
e && (e.classList.remove("opacity-0"), e.classList.add("opacity-100"));
|
|
2583
2589
|
}
|
|
2584
2590
|
collapsePill() {
|
|
2585
2591
|
if (!this.pill) return;
|
|
2586
|
-
this.pill.style.width = `${
|
|
2592
|
+
this.pill.style.width = `${Mr}px`;
|
|
2587
2593
|
let e = this.pill.querySelector("svg");
|
|
2588
2594
|
e && (e.classList.add("opacity-0"), e.classList.remove("opacity-100"));
|
|
2589
2595
|
}
|
|
@@ -2594,13 +2600,13 @@ var cr = (e) => {
|
|
|
2594
2600
|
}
|
|
2595
2601
|
}
|
|
2596
2602
|
resolveCellCoord(e) {
|
|
2597
|
-
let t = e.closest(`[${
|
|
2603
|
+
let t = e.closest(`[${O}]`);
|
|
2598
2604
|
if (!t) return null;
|
|
2599
|
-
let n = t.closest(`[${
|
|
2605
|
+
let n = t.closest(`[${D}]`);
|
|
2600
2606
|
if (!n || !this.grid.contains(n)) return null;
|
|
2601
|
-
let r = Array.from(this.grid.querySelectorAll(`[${
|
|
2607
|
+
let r = Array.from(this.grid.querySelectorAll(`[${D}]`)).indexOf(n);
|
|
2602
2608
|
if (r < 0) return null;
|
|
2603
|
-
let i = Array.from(n.querySelectorAll(`[${
|
|
2609
|
+
let i = Array.from(n.querySelectorAll(`[${O}]`)).indexOf(t);
|
|
2604
2610
|
return i < 0 ? null : {
|
|
2605
2611
|
row: r,
|
|
2606
2612
|
col: i
|
|
@@ -2609,7 +2615,7 @@ var cr = (e) => {
|
|
|
2609
2615
|
clampExtentToEdge(e) {
|
|
2610
2616
|
var t, n, r, i, a, o;
|
|
2611
2617
|
if (!this.anchorCell || !this.isSelecting) return;
|
|
2612
|
-
let s = this.grid.getBoundingClientRect(), c = this.grid.querySelectorAll(`[${
|
|
2618
|
+
let s = this.grid.getBoundingClientRect(), c = this.grid.querySelectorAll(`[${D}]`), l = c.length, u = (t = (n = c[0]) == null ? void 0 : n.querySelectorAll("[data-blok-table-cell]").length) == null ? 0 : t;
|
|
2613
2619
|
if (l === 0 || u === 0) return;
|
|
2614
2620
|
let d = {
|
|
2615
2621
|
row: this.clampAxis(e.clientY, s.top, s.bottom, l, (r = (i = this.extentCell) == null ? void 0 : i.row) == null ? this.anchorCell.row : r),
|
|
@@ -2619,106 +2625,106 @@ var cr = (e) => {
|
|
|
2619
2625
|
}
|
|
2620
2626
|
collectCellsInRange(e, t, n, r, i) {
|
|
2621
2627
|
return Array.from(e).slice(t, n + 1).flatMap((e) => {
|
|
2622
|
-
let t = e.querySelectorAll(`[${
|
|
2628
|
+
let t = e.querySelectorAll(`[${O}]`);
|
|
2623
2629
|
return Array.from(t).slice(r, i + 1).filter((e) => e instanceof HTMLElement);
|
|
2624
2630
|
});
|
|
2625
2631
|
}
|
|
2626
2632
|
clampAxis(e, t, n, r, i) {
|
|
2627
2633
|
return e < t ? 0 : e > n ? r - 1 : i;
|
|
2628
2634
|
}
|
|
2629
|
-
},
|
|
2630
|
-
let t = e.querySelector(`[${
|
|
2635
|
+
}, j = (e) => {
|
|
2636
|
+
let t = e.querySelector(`[${D}]`);
|
|
2631
2637
|
if (!t) return [];
|
|
2632
|
-
let n = t.querySelectorAll(`[${
|
|
2638
|
+
let n = t.querySelectorAll(`[${O}]`);
|
|
2633
2639
|
return Array.from(n).map((e) => e.getBoundingClientRect().width);
|
|
2634
|
-
},
|
|
2640
|
+
}, Ir = (e, t) => {
|
|
2635
2641
|
let n = t.reduce((e, t) => e + t, 0), r = e;
|
|
2636
|
-
r.style.width = `${n + 1}px`, e.querySelectorAll(`[${
|
|
2637
|
-
e.querySelectorAll(`[${
|
|
2642
|
+
r.style.width = `${n + 1}px`, e.querySelectorAll(`[${D}]`).forEach((e) => {
|
|
2643
|
+
e.querySelectorAll(`[${O}]`).forEach((e, n) => {
|
|
2638
2644
|
if (n < t.length) {
|
|
2639
2645
|
let r = e;
|
|
2640
2646
|
r.style.width = `${t[n]}px`;
|
|
2641
2647
|
}
|
|
2642
2648
|
});
|
|
2643
2649
|
});
|
|
2644
|
-
},
|
|
2645
|
-
let n = Array.from(e.querySelectorAll(`[${
|
|
2650
|
+
}, Lr = (e, t) => {
|
|
2651
|
+
let n = Array.from(e.querySelectorAll(`[${D}]`)), r = n.findIndex((e) => Array.from(e.querySelectorAll(`[${O}]`)).includes(t));
|
|
2646
2652
|
return r === -1 ? null : {
|
|
2647
2653
|
row: r,
|
|
2648
|
-
col: Array.from(n[r].querySelectorAll(`[${
|
|
2654
|
+
col: Array.from(n[r].querySelectorAll(`[${O}]`)).indexOf(t)
|
|
2649
2655
|
};
|
|
2650
|
-
},
|
|
2656
|
+
}, Rr = (e) => {
|
|
2651
2657
|
var t;
|
|
2652
|
-
let n = e.querySelector(`[${
|
|
2658
|
+
let n = e.querySelector(`[${A}]`);
|
|
2653
2659
|
return n ? ((t = n.textContent) == null ? "" : t).trim().length === 0 : !0;
|
|
2654
|
-
},
|
|
2655
|
-
let n = e.querySelectorAll(`[${
|
|
2660
|
+
}, zr = (e, t) => {
|
|
2661
|
+
let n = e.querySelectorAll(`[${D}]`)[t];
|
|
2656
2662
|
if (!n) return !0;
|
|
2657
|
-
let r = n.querySelectorAll(`[${
|
|
2658
|
-
return Array.from(r).every((e) =>
|
|
2659
|
-
},
|
|
2660
|
-
let n = e.querySelectorAll(`[${
|
|
2663
|
+
let r = n.querySelectorAll(`[${O}]`);
|
|
2664
|
+
return Array.from(r).every((e) => Rr(e));
|
|
2665
|
+
}, Br = (e, t) => {
|
|
2666
|
+
let n = e.querySelectorAll(`[${D}]`);
|
|
2661
2667
|
return Array.from(n).every((e) => {
|
|
2662
|
-
let n = e.querySelectorAll(`[${
|
|
2663
|
-
return !n ||
|
|
2668
|
+
let n = e.querySelectorAll(`[${O}]`)[t];
|
|
2669
|
+
return !n || Rr(n);
|
|
2664
2670
|
});
|
|
2665
|
-
},
|
|
2666
|
-
let t = e.querySelectorAll(`[${
|
|
2671
|
+
}, Vr = (e) => {
|
|
2672
|
+
let t = e.querySelectorAll(`[${D}]`), n = t[0];
|
|
2667
2673
|
if (!n) return;
|
|
2668
|
-
let r = n.querySelectorAll(`[${
|
|
2674
|
+
let r = n.querySelectorAll(`[${O}]`), i = Array.from(r).reduce((e, t) => e + (parseFloat(t.style.width) || 0), 0);
|
|
2669
2675
|
if (i <= 0) return;
|
|
2670
2676
|
let a = 100 / i;
|
|
2671
2677
|
t.forEach((e) => {
|
|
2672
|
-
e.querySelectorAll(`[${
|
|
2678
|
+
e.querySelectorAll(`[${O}]`).forEach((e) => {
|
|
2673
2679
|
let t = e, n = parseFloat(t.style.width) || 0;
|
|
2674
2680
|
t.style.width = `${Math.round(n * a * 100) / 100}%`;
|
|
2675
2681
|
});
|
|
2676
2682
|
});
|
|
2677
|
-
},
|
|
2683
|
+
}, Hr = (e, t, n) => {
|
|
2678
2684
|
if (!e) return e;
|
|
2679
2685
|
let r = [...e], [i] = r.splice(t, 1);
|
|
2680
2686
|
return r.splice(n, 0, i), r;
|
|
2681
|
-
},
|
|
2687
|
+
}, Ur = (e, t) => {
|
|
2682
2688
|
if (!e) return e;
|
|
2683
2689
|
let n = [...e];
|
|
2684
2690
|
return n.splice(t, 1), n.length > 0 ? n : void 0;
|
|
2685
|
-
},
|
|
2686
|
-
let a = n == null ?
|
|
2691
|
+
}, Wr = (e, t, n, r, i) => {
|
|
2692
|
+
let a = n == null ? j(e) : n, o = r === void 0 ? M(a) : Math.round(r / 2 * 100) / 100;
|
|
2687
2693
|
i.addColumn(e, t, a, o);
|
|
2688
2694
|
let s = [...a];
|
|
2689
2695
|
return s.splice(t, 0, o), s;
|
|
2690
|
-
}, M = (e) => Math.round(e.reduce((e, t) => e + t, 0) / e.length / 2 * 100) / 100,
|
|
2696
|
+
}, M = (e) => Math.round(e.reduce((e, t) => e + t, 0) / e.length / 2 * 100) / 100, Gr = (e) => e.length === 0 ? 0 : Math.round(e.reduce((e, t) => e + t, 0) / e.length * 100) / 100, Kr = (e, t, n) => {
|
|
2691
2697
|
var r;
|
|
2692
2698
|
if (!e) return [];
|
|
2693
|
-
let i = e.querySelectorAll(`[${
|
|
2699
|
+
let i = e.querySelectorAll(`[${D}]`)[n];
|
|
2694
2700
|
return i ? (r = t == null ? void 0 : t.getBlockIdsFromCells(i.querySelectorAll("[data-blok-table-cell]"))) == null ? [] : r : [];
|
|
2695
|
-
},
|
|
2701
|
+
}, qr = (e, t, n) => {
|
|
2696
2702
|
var r;
|
|
2697
2703
|
if (!e) return [];
|
|
2698
|
-
let i = e.querySelectorAll(`[${
|
|
2704
|
+
let i = e.querySelectorAll(`[${D}]`), a = [];
|
|
2699
2705
|
return i.forEach((e) => {
|
|
2700
|
-
let t = e.querySelectorAll(`[${
|
|
2706
|
+
let t = e.querySelectorAll(`[${O}]`);
|
|
2701
2707
|
n < t.length && a.push(t[n]);
|
|
2702
2708
|
}), (r = t == null ? void 0 : t.getBlockIdsFromCells(a)) == null ? [] : r;
|
|
2703
2709
|
}, N = (e, t) => {
|
|
2704
|
-
e.querySelectorAll(`[${
|
|
2710
|
+
e.querySelectorAll(`[${O}]`).forEach((e) => {
|
|
2705
2711
|
t == null || t.ensureCellHasBlock(e);
|
|
2706
2712
|
});
|
|
2707
|
-
},
|
|
2708
|
-
let i = e.querySelectorAll(`[${
|
|
2713
|
+
}, Jr = (e, t, n, r) => {
|
|
2714
|
+
let i = e.querySelectorAll(`[${D}]`);
|
|
2709
2715
|
t.forEach((e, t) => {
|
|
2710
2716
|
let r = i[t];
|
|
2711
2717
|
if (!r) return;
|
|
2712
|
-
let a = r.querySelectorAll(`[${
|
|
2718
|
+
let a = r.querySelectorAll(`[${O}]`);
|
|
2713
2719
|
e.forEach((e, t) => {
|
|
2714
2720
|
var r;
|
|
2715
2721
|
let i = a[t];
|
|
2716
2722
|
if (!i) return;
|
|
2717
|
-
let o = i.querySelector(`[${
|
|
2723
|
+
let o = i.querySelector(`[${A}]`);
|
|
2718
2724
|
if (!o) return;
|
|
2719
2725
|
let s = o.querySelectorAll("[data-blok-id]").length > 0;
|
|
2720
|
-
if (!(!
|
|
2721
|
-
if (!
|
|
2726
|
+
if (!(!k(e) && s)) {
|
|
2727
|
+
if (!k(e)) {
|
|
2722
2728
|
o.innerHTML = e;
|
|
2723
2729
|
return;
|
|
2724
2730
|
}
|
|
@@ -2737,7 +2743,7 @@ var cr = (e) => {
|
|
|
2737
2743
|
}
|
|
2738
2744
|
});
|
|
2739
2745
|
});
|
|
2740
|
-
},
|
|
2746
|
+
}, Yr = (e, t) => {
|
|
2741
2747
|
var n, r, i, a, o, s, c;
|
|
2742
2748
|
if (!(typeof e == "object" && e && "content" in e)) {
|
|
2743
2749
|
var l, u;
|
|
@@ -2757,40 +2763,40 @@ var cr = (e) => {
|
|
|
2757
2763
|
colWidths: m,
|
|
2758
2764
|
initialColWidth: d.initialColWidth
|
|
2759
2765
|
};
|
|
2760
|
-
},
|
|
2766
|
+
}, Xr = (e, t) => {
|
|
2761
2767
|
e.addEventListener("keydown", (n) => {
|
|
2762
|
-
let r = n.target.closest(`[${
|
|
2768
|
+
let r = n.target.closest(`[${O}]`);
|
|
2763
2769
|
if (!r) return;
|
|
2764
|
-
let i =
|
|
2770
|
+
let i = Lr(e, r);
|
|
2765
2771
|
i && (t == null || t.handleKeyDown(n, i));
|
|
2766
2772
|
});
|
|
2767
|
-
},
|
|
2768
|
-
e == null || e.classList.add(...
|
|
2773
|
+
}, Zr = ["overflow-x-auto", "overflow-y-hidden"], Qr = (e) => {
|
|
2774
|
+
e == null || e.classList.add(...Zr);
|
|
2769
2775
|
}, P = (e, t) => {
|
|
2770
2776
|
if (!e) return;
|
|
2771
|
-
let n = e.querySelectorAll(`[${
|
|
2777
|
+
let n = e.querySelectorAll(`[${D}]`);
|
|
2772
2778
|
n.forEach((e) => {
|
|
2773
2779
|
e.removeAttribute("data-blok-table-heading");
|
|
2774
2780
|
}), t && n.length > 0 && n[0].setAttribute("data-blok-table-heading", "");
|
|
2775
2781
|
}, F = (e, t) => {
|
|
2776
|
-
let n = e.querySelectorAll(`[${
|
|
2782
|
+
let n = e.querySelectorAll(`[${D}]`);
|
|
2777
2783
|
t.forEach((e, t) => {
|
|
2778
2784
|
if (t >= n.length) return;
|
|
2779
|
-
let r = n[t].querySelectorAll(`[${
|
|
2785
|
+
let r = n[t].querySelectorAll(`[${O}]`);
|
|
2780
2786
|
e.forEach((e, t) => {
|
|
2781
2787
|
if (t >= r.length) return;
|
|
2782
2788
|
let n = r[t];
|
|
2783
|
-
|
|
2789
|
+
k(e) && e.color ? n.style.backgroundColor = e.color : n.style.backgroundColor = "", k(e) && e.textColor ? n.style.color = e.textColor : n.style.color = "";
|
|
2784
2790
|
});
|
|
2785
2791
|
});
|
|
2786
2792
|
}, I = (e, t) => {
|
|
2787
|
-
e && (e.querySelectorAll(`[${
|
|
2793
|
+
e && (e.querySelectorAll(`[${O}]`).forEach((e) => {
|
|
2788
2794
|
e.removeAttribute("data-blok-table-heading-col");
|
|
2789
|
-
}), t && e.querySelectorAll(`[${
|
|
2790
|
-
let t = e.querySelector(`[${
|
|
2795
|
+
}), t && e.querySelectorAll(`[${D}]`).forEach((e) => {
|
|
2796
|
+
let t = e.querySelector(`[${O}]`);
|
|
2791
2797
|
t && t.setAttribute("data-blok-table-heading-col", "");
|
|
2792
2798
|
}));
|
|
2793
|
-
},
|
|
2799
|
+
}, $r = (e) => !!(/^#[0-9a-f]{3,4}$/i.test(e) || /^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(e) || /^rgba?\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+\s*(,\s*[\d.]+\s*)?\)$/i.test(e) || /^hsla?\(\s*[\d.]+\s*,\s*[\d.]+%\s*,\s*[\d.]+%\s*(,\s*[\d.]+\s*)?\)$/i.test(e) || e === "transparent"), ei = class {
|
|
2794
2800
|
constructor(e) {
|
|
2795
2801
|
var t, n, r;
|
|
2796
2802
|
this.withHeadingsValue = (t = e == null ? void 0 : e.withHeadings) == null ? !1 : t, this.withHeadingColumnValue = (n = e == null ? void 0 : e.withHeadingColumn) == null ? !1 : n, this.stretchedValue = (r = e == null ? void 0 : e.stretched) == null ? !1 : r, this.colWidthsValue = e != null && e.colWidths ? [...e.colWidths] : void 0, this.initialColWidthValue = e == null ? void 0 : e.initialColWidth, this.contentGrid = this.normalizeContent(e == null ? void 0 : e.content), this.blockCellMap = /* @__PURE__ */ new Map(), this.rebuildBlockCellMap();
|
|
@@ -2863,13 +2869,13 @@ var cr = (e) => {
|
|
|
2863
2869
|
return this.isInBounds(e, t) ? [...this.contentGrid[e][t].blocks] : [];
|
|
2864
2870
|
}
|
|
2865
2871
|
setCellColor(e, t, n) {
|
|
2866
|
-
this.isInBounds(e, t) && (n === void 0 ? delete this.contentGrid[e][t].color :
|
|
2872
|
+
this.isInBounds(e, t) && (n === void 0 ? delete this.contentGrid[e][t].color : $r(n) && (this.contentGrid[e][t].color = n));
|
|
2867
2873
|
}
|
|
2868
2874
|
getCellColor(e, t) {
|
|
2869
2875
|
if (this.isInBounds(e, t)) return this.contentGrid[e][t].color;
|
|
2870
2876
|
}
|
|
2871
2877
|
setCellTextColor(e, t, n) {
|
|
2872
|
-
this.isInBounds(e, t) && (n === void 0 ? delete this.contentGrid[e][t].textColor :
|
|
2878
|
+
this.isInBounds(e, t) && (n === void 0 ? delete this.contentGrid[e][t].textColor : $r(n) && (this.contentGrid[e][t].textColor = n));
|
|
2873
2879
|
}
|
|
2874
2880
|
getCellTextColor(e, t) {
|
|
2875
2881
|
if (this.isInBounds(e, t)) return this.contentGrid[e][t].textColor;
|
|
@@ -3007,9 +3013,9 @@ var cr = (e) => {
|
|
|
3007
3013
|
return !e || !Array.isArray(e) ? [] : e.map((e) => (e == null ? [] : e).map((e) => this.normalizeCell(e)));
|
|
3008
3014
|
}
|
|
3009
3015
|
normalizeCell(e) {
|
|
3010
|
-
if (
|
|
3016
|
+
if (k(e)) {
|
|
3011
3017
|
let t = { blocks: [...e.blocks] };
|
|
3012
|
-
return e.color !== void 0 &&
|
|
3018
|
+
return e.color !== void 0 && $r(e.color) && (t.color = e.color), e.textColor !== void 0 && $r(e.textColor) && (t.textColor = e.textColor), t;
|
|
3013
3019
|
}
|
|
3014
3020
|
return { blocks: [] };
|
|
3015
3021
|
}
|
|
@@ -3042,7 +3048,7 @@ var cr = (e) => {
|
|
|
3042
3048
|
for (let n of this.contentGrid) e < n.length && t.push(...n[e].blocks);
|
|
3043
3049
|
return t;
|
|
3044
3050
|
}
|
|
3045
|
-
},
|
|
3051
|
+
}, ti = "data-blok-table-resize", ni = "data-blok-table-cell", ri = "data-blok-table-row", ii = 50, ai = 16, oi = class {
|
|
3046
3052
|
get enabled() {
|
|
3047
3053
|
return this._enabled;
|
|
3048
3054
|
}
|
|
@@ -3069,7 +3075,7 @@ var cr = (e) => {
|
|
|
3069
3075
|
}
|
|
3070
3076
|
createHandle(e) {
|
|
3071
3077
|
let t = document.createElement("div"), n = this.getHandleLeftPx(e);
|
|
3072
|
-
return t.setAttribute(
|
|
3078
|
+
return t.setAttribute(ti, ""), t.setAttribute("data-col", String(e)), t.style.position = "absolute", t.style.top = "-1px", t.style.bottom = "0px", t.style.width = `${ai}px`, t.style.left = `${n - ai / 2}px`, t.style.cursor = "col-resize", t.style.zIndex = "2", t.style.background = "linear-gradient(to right, transparent 7px, #3b82f6 7px, #3b82f6 9px, transparent 9px)", t.style.opacity = "0", t.style.transition = "opacity 150ms ease", t.setAttribute("contenteditable", "false"), t.addEventListener("mouseenter", () => {
|
|
3073
3079
|
this.isDragging || (t.style.opacity = "1");
|
|
3074
3080
|
}), t.addEventListener("mouseleave", () => {
|
|
3075
3081
|
this.isDragging || (t.style.opacity = "0");
|
|
@@ -3081,14 +3087,14 @@ var cr = (e) => {
|
|
|
3081
3087
|
updateHandlePositions() {
|
|
3082
3088
|
this.handles.forEach((e, t) => {
|
|
3083
3089
|
let n = this.getHandleLeftPx(t), r = e;
|
|
3084
|
-
r.style.left = `${n -
|
|
3090
|
+
r.style.left = `${n - ai / 2}px`;
|
|
3085
3091
|
});
|
|
3086
3092
|
}
|
|
3087
3093
|
onPointerDown(e) {
|
|
3088
3094
|
var t;
|
|
3089
3095
|
if (!this._enabled) return;
|
|
3090
3096
|
let n = e.target;
|
|
3091
|
-
if (!n.hasAttribute(
|
|
3097
|
+
if (!n.hasAttribute(ti)) return;
|
|
3092
3098
|
e.preventDefault(), this.needsInitialApply && (this.applyWidths(), this.updateHandlePositions(), this.needsInitialApply = !1);
|
|
3093
3099
|
let r = n.getAttribute("data-col");
|
|
3094
3100
|
r !== null && (this.dragColIndex = Number(r), this.isDragging = !0, this.dragStartX = e.clientX, this.startColWidth = this.colWidths[this.dragColIndex], this.dragRowCells = this.resolveRowCells(), (t = this.onDragStart) == null || t.call(this), this.gridEl.style.userSelect = "none", n.style.opacity = "1", n.setPointerCapture && n.setPointerCapture(e.pointerId), document.addEventListener("pointermove", this.boundPointerMove), document.addEventListener("pointerup", this.boundPointerUp));
|
|
@@ -3096,7 +3102,7 @@ var cr = (e) => {
|
|
|
3096
3102
|
onPointerMove(e) {
|
|
3097
3103
|
var t, n;
|
|
3098
3104
|
if (!this.isDragging) return;
|
|
3099
|
-
let r = e.clientX - this.dragStartX, i = this.startColWidth + r, a = Math.max(
|
|
3105
|
+
let r = e.clientX - this.dragStartX, i = this.startColWidth + r, a = Math.max(ii, i);
|
|
3100
3106
|
this.colWidths[this.dragColIndex] = a, this.applyWidths((t = this.dragRowCells) == null ? void 0 : t), this.updateHandlePositions(), (n = this.onDrag) == null || n.call(this);
|
|
3101
3107
|
}
|
|
3102
3108
|
onPointerUp() {
|
|
@@ -3106,8 +3112,8 @@ var cr = (e) => {
|
|
|
3106
3112
|
e && (e.style.opacity = "0"), document.removeEventListener("pointermove", this.boundPointerMove), document.removeEventListener("pointerup", this.boundPointerUp), this.dragRowCells = null, this.onChange([...this.colWidths]);
|
|
3107
3113
|
}
|
|
3108
3114
|
resolveRowCells() {
|
|
3109
|
-
let e = this.gridEl.querySelectorAll(`[${
|
|
3110
|
-
return Array.from(e, (e) => Array.from(e.querySelectorAll(`[${
|
|
3115
|
+
let e = this.gridEl.querySelectorAll(`[${ri}]`);
|
|
3116
|
+
return Array.from(e, (e) => Array.from(e.querySelectorAll(`[${ni}]`)));
|
|
3111
3117
|
}
|
|
3112
3118
|
applyWidths(e = this.resolveRowCells()) {
|
|
3113
3119
|
let t = this.colWidths.reduce((e, t) => e + t, 0);
|
|
@@ -3117,7 +3123,7 @@ var cr = (e) => {
|
|
|
3117
3123
|
});
|
|
3118
3124
|
});
|
|
3119
3125
|
}
|
|
3120
|
-
},
|
|
3126
|
+
}, si = (e, t, n) => (n.grid.addRow(e, t), N(e, n.cellBlocks), {
|
|
3121
3127
|
pendingHighlight: {
|
|
3122
3128
|
type: "row",
|
|
3123
3129
|
index: t
|
|
@@ -3126,8 +3132,8 @@ var cr = (e) => {
|
|
|
3126
3132
|
colWidths: n.data.colWidths,
|
|
3127
3133
|
withHeadings: n.data.withHeadings,
|
|
3128
3134
|
withHeadingColumn: n.data.withHeadingColumn
|
|
3129
|
-
}),
|
|
3130
|
-
let r =
|
|
3135
|
+
}), ci = (e, t, n) => {
|
|
3136
|
+
let r = Wr(e, t, n.data.colWidths, n.data.initialColWidth, n.grid);
|
|
3131
3137
|
return N(e, n.cellBlocks), {
|
|
3132
3138
|
pendingHighlight: {
|
|
3133
3139
|
type: "col",
|
|
@@ -3138,7 +3144,7 @@ var cr = (e) => {
|
|
|
3138
3144
|
withHeadings: n.data.withHeadings,
|
|
3139
3145
|
withHeadingColumn: n.data.withHeadingColumn
|
|
3140
3146
|
};
|
|
3141
|
-
},
|
|
3147
|
+
}, li = (e, t, n, r) => (r.grid.moveRow(e, t, n), {
|
|
3142
3148
|
pendingHighlight: null,
|
|
3143
3149
|
moveSelection: {
|
|
3144
3150
|
type: "row",
|
|
@@ -3147,16 +3153,16 @@ var cr = (e) => {
|
|
|
3147
3153
|
colWidths: r.data.colWidths,
|
|
3148
3154
|
withHeadings: r.data.withHeadings,
|
|
3149
3155
|
withHeadingColumn: r.data.withHeadingColumn
|
|
3150
|
-
}),
|
|
3156
|
+
}), ui = (e, t, n, r) => (r.grid.moveColumn(e, t, n), {
|
|
3151
3157
|
pendingHighlight: null,
|
|
3152
3158
|
moveSelection: {
|
|
3153
3159
|
type: "col",
|
|
3154
3160
|
index: n
|
|
3155
3161
|
},
|
|
3156
|
-
colWidths:
|
|
3162
|
+
colWidths: Hr(r.data.colWidths, t, n),
|
|
3157
3163
|
withHeadings: r.data.withHeadings,
|
|
3158
3164
|
withHeadingColumn: r.data.withHeadingColumn
|
|
3159
|
-
}),
|
|
3165
|
+
}), di = (e, t, n) => {
|
|
3160
3166
|
var r, i;
|
|
3161
3167
|
return (r = n.cellBlocks) == null || r.deleteBlocks((i = n.blocksToDelete) == null ? [] : i), n.grid.deleteRow(e, t), {
|
|
3162
3168
|
pendingHighlight: {
|
|
@@ -3168,11 +3174,11 @@ var cr = (e) => {
|
|
|
3168
3174
|
withHeadings: n.data.withHeadings,
|
|
3169
3175
|
withHeadingColumn: n.data.withHeadingColumn
|
|
3170
3176
|
};
|
|
3171
|
-
},
|
|
3177
|
+
}, fi = (e, t, n) => {
|
|
3172
3178
|
var r, i;
|
|
3173
3179
|
(r = n.cellBlocks) == null || r.deleteBlocks((i = n.blocksToDelete) == null ? [] : i), n.grid.deleteColumn(e, t);
|
|
3174
|
-
let a =
|
|
3175
|
-
return a ?
|
|
3180
|
+
let a = Ur(n.data.colWidths, t);
|
|
3181
|
+
return a ? Ir(e, a) : Vr(e), {
|
|
3176
3182
|
pendingHighlight: {
|
|
3177
3183
|
type: "col",
|
|
3178
3184
|
index: t < n.grid.getColumnCount(e) ? t : t - 1
|
|
@@ -3182,16 +3188,16 @@ var cr = (e) => {
|
|
|
3182
3188
|
withHeadings: n.data.withHeadings,
|
|
3183
3189
|
withHeadingColumn: n.data.withHeadingColumn
|
|
3184
3190
|
};
|
|
3185
|
-
},
|
|
3191
|
+
}, pi = (e, t, n) => {
|
|
3186
3192
|
switch (t.type) {
|
|
3187
|
-
case "insert-row-above": return
|
|
3188
|
-
case "insert-row-below": return
|
|
3189
|
-
case "insert-col-left": return
|
|
3190
|
-
case "insert-col-right": return
|
|
3191
|
-
case "move-row": return
|
|
3192
|
-
case "move-col": return
|
|
3193
|
-
case "delete-row": return
|
|
3194
|
-
case "delete-col": return
|
|
3193
|
+
case "insert-row-above": return si(e, t.index, n);
|
|
3194
|
+
case "insert-row-below": return si(e, t.index + 1, n);
|
|
3195
|
+
case "insert-col-left": return ci(e, t.index, n);
|
|
3196
|
+
case "insert-col-right": return ci(e, t.index + 1, n);
|
|
3197
|
+
case "move-row": return li(e, t.fromIndex, t.toIndex, n);
|
|
3198
|
+
case "move-col": return ui(e, t.fromIndex, t.toIndex, n);
|
|
3199
|
+
case "delete-row": return di(e, t.index, n);
|
|
3200
|
+
case "delete-col": return fi(e, t.index, n);
|
|
3195
3201
|
case "toggle-heading": return {
|
|
3196
3202
|
pendingHighlight: {
|
|
3197
3203
|
type: "row",
|
|
@@ -3213,13 +3219,13 @@ var cr = (e) => {
|
|
|
3213
3219
|
withHeadingColumn: !n.data.withHeadingColumn
|
|
3214
3220
|
};
|
|
3215
3221
|
}
|
|
3216
|
-
},
|
|
3217
|
-
let t = e.querySelector(`[${
|
|
3218
|
-
return t ? Array.from(t.querySelectorAll(`[${
|
|
3222
|
+
}, mi = 10, hi = "data-blok-table-drag-ghost", gi = (e) => {
|
|
3223
|
+
let t = e.querySelector(`[${D}]`);
|
|
3224
|
+
return t ? Array.from(t.querySelectorAll(`[${O}]`)).reduce((e, t) => {
|
|
3219
3225
|
let n = e[e.length - 1];
|
|
3220
3226
|
return [...e, n + t.offsetWidth];
|
|
3221
3227
|
}, [0]) : [0];
|
|
3222
|
-
},
|
|
3228
|
+
}, _i = class {
|
|
3223
3229
|
constructor(e) {
|
|
3224
3230
|
var t;
|
|
3225
3231
|
this.isDragging = !1, this.dragType = null, this.dragFromIndex = -1, this.dragStartX = 0, this.dragStartY = 0, this.dropIndicator = null, this.dragOverlayCells = [], this.ghostEl = null, this.ghostOffsetX = 0, this.ghostOffsetY = 0, this.resolveTracking = null, this.grid = e.grid, this.onAction = e.onAction, this.onDragStateChange = (t = e.onDragStateChange) == null ? null : t, this.boundDocPointerMove = this.handleDocPointerMove.bind(this), this.boundDocPointerUp = this.handleDocPointerUp.bind(this), this.boundDocPointerCancel = this.handleDocPointerCancel.bind(this);
|
|
@@ -3238,7 +3244,7 @@ var cr = (e) => {
|
|
|
3238
3244
|
}
|
|
3239
3245
|
handleDocPointerMove(e) {
|
|
3240
3246
|
let t = Math.abs(e.clientX - this.dragStartX), n = Math.abs(e.clientY - this.dragStartY);
|
|
3241
|
-
!this.isDragging && (t >
|
|
3247
|
+
!this.isDragging && (t > mi || n > mi) && (this.isDragging = !0, this.startDrag()), this.isDragging && (this.updateDragIndicator(e), this.updateGhostPosition(e));
|
|
3242
3248
|
}
|
|
3243
3249
|
handleDocPointerUp(e) {
|
|
3244
3250
|
if (document.removeEventListener("pointermove", this.boundDocPointerMove), document.removeEventListener("pointerup", this.boundDocPointerUp), document.removeEventListener("pointercancel", this.boundDocPointerCancel), this.isDragging) {
|
|
@@ -3259,7 +3265,7 @@ var cr = (e) => {
|
|
|
3259
3265
|
this.grid.style.userSelect = "none", document.body.style.cursor = "grabbing", (e = this.onDragStateChange) == null || e.call(this, !0, this.dragType), this.highlightSourceCells(), this.createDropIndicator(), this.createGhost();
|
|
3260
3266
|
}
|
|
3261
3267
|
highlightSourceCells() {
|
|
3262
|
-
let e = this.grid.querySelectorAll(`[${
|
|
3268
|
+
let e = this.grid.querySelectorAll(`[${D}]`);
|
|
3263
3269
|
if (this.dragType === "row") {
|
|
3264
3270
|
this.highlightRowCells(e);
|
|
3265
3271
|
return;
|
|
@@ -3270,7 +3276,7 @@ var cr = (e) => {
|
|
|
3270
3276
|
let t = e[this.dragFromIndex];
|
|
3271
3277
|
if (!t) return;
|
|
3272
3278
|
let n = this.getDragSourceBg();
|
|
3273
|
-
t.querySelectorAll(`[${
|
|
3279
|
+
t.querySelectorAll(`[${O}]`).forEach((e) => {
|
|
3274
3280
|
let t = e;
|
|
3275
3281
|
t.style.backgroundColor = n, t.style.opacity = "0.7", this.dragOverlayCells.push(t);
|
|
3276
3282
|
});
|
|
@@ -3278,7 +3284,7 @@ var cr = (e) => {
|
|
|
3278
3284
|
highlightColumnCells(e) {
|
|
3279
3285
|
let t = this.getDragSourceBg();
|
|
3280
3286
|
e.forEach((e) => {
|
|
3281
|
-
let n = e.querySelectorAll(`[${
|
|
3287
|
+
let n = e.querySelectorAll(`[${O}]`);
|
|
3282
3288
|
if (this.dragFromIndex >= n.length) return;
|
|
3283
3289
|
let r = n[this.dragFromIndex];
|
|
3284
3290
|
r.style.backgroundColor = t, r.style.opacity = "0.7", this.dragOverlayCells.push(r);
|
|
@@ -3297,7 +3303,7 @@ var cr = (e) => {
|
|
|
3297
3303
|
let e = this.dropIndicator.style;
|
|
3298
3304
|
if (e.position = "absolute", e.backgroundColor = "#3b82f6", e.borderRadius = "1.5px", e.zIndex = "5", e.pointerEvents = "none", this.dropIndicator.setAttribute("contenteditable", "false"), this.dragType === "row") e.height = "3px", e.left = "-1px", e.right = "0", e.transition = "top 100ms ease";
|
|
3299
3305
|
else {
|
|
3300
|
-
let t = this.grid.querySelectorAll(`[${
|
|
3306
|
+
let t = this.grid.querySelectorAll(`[${D}]`), n = t[t.length - 1], r = n ? n.offsetTop + n.offsetHeight : 0;
|
|
3301
3307
|
e.width = "3px", e.top = "-1px", e.height = `${r + 1}px`, e.transition = "left 100ms ease";
|
|
3302
3308
|
}
|
|
3303
3309
|
this.grid.appendChild(this.dropIndicator);
|
|
@@ -3319,7 +3325,7 @@ var cr = (e) => {
|
|
|
3319
3325
|
updateColIndicator(e, t) {
|
|
3320
3326
|
var n;
|
|
3321
3327
|
if (!this.dropIndicator) return;
|
|
3322
|
-
let r = e.clientX - t.left, i = this.getColDropIndex(r), a =
|
|
3328
|
+
let r = e.clientX - t.left, i = this.getColDropIndex(r), a = gi(this.grid);
|
|
3323
3329
|
this.dropIndicator.style.left = `${((n = a[i]) == null ? 0 : n) - 1.5}px`;
|
|
3324
3330
|
}
|
|
3325
3331
|
finishDrag(e) {
|
|
@@ -3348,7 +3354,7 @@ var cr = (e) => {
|
|
|
3348
3354
|
}
|
|
3349
3355
|
createGhost() {
|
|
3350
3356
|
let e = document.createElement("div");
|
|
3351
|
-
e.setAttribute(
|
|
3357
|
+
e.setAttribute(hi, ""), e.setAttribute("contenteditable", "false");
|
|
3352
3358
|
let t = e.style;
|
|
3353
3359
|
t.position = "fixed", t.pointerEvents = "none", t.opacity = "0.5", t.zIndex = "50", t.borderRadius = "4px", t.overflow = "hidden", t.boxShadow = this.isDarkMode() ? "0 8px 24px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08)" : "0 4px 12px rgba(0, 0, 0, 0.15)", this.ghostEl = e;
|
|
3354
3360
|
let n = this.getSourceRect();
|
|
@@ -3359,22 +3365,22 @@ var cr = (e) => {
|
|
|
3359
3365
|
}
|
|
3360
3366
|
getRowSourceRect() {
|
|
3361
3367
|
var e;
|
|
3362
|
-
let t = this.grid.querySelectorAll(`[${
|
|
3368
|
+
let t = this.grid.querySelectorAll(`[${D}]`)[this.dragFromIndex];
|
|
3363
3369
|
return (e = t == null ? void 0 : t.getBoundingClientRect()) == null ? null : e;
|
|
3364
3370
|
}
|
|
3365
3371
|
getColSourceRect() {
|
|
3366
|
-
let e = this.grid.querySelectorAll(`[${
|
|
3372
|
+
let e = this.grid.querySelectorAll(`[${D}]`), t = e[0], n = e[e.length - 1];
|
|
3367
3373
|
if (!t || !n) return null;
|
|
3368
|
-
let r = t.querySelectorAll(`[${
|
|
3374
|
+
let r = t.querySelectorAll(`[${O}]`)[this.dragFromIndex], i = n.querySelectorAll(`[${O}]`)[this.dragFromIndex];
|
|
3369
3375
|
if (!r || !i) return null;
|
|
3370
3376
|
let a = r.getBoundingClientRect(), o = i.getBoundingClientRect();
|
|
3371
3377
|
return new DOMRect(a.left, a.top, a.width, o.bottom - a.top);
|
|
3372
3378
|
}
|
|
3373
3379
|
buildRowGhost() {
|
|
3374
|
-
let e = this.grid.querySelectorAll(`[${
|
|
3380
|
+
let e = this.grid.querySelectorAll(`[${D}]`)[this.dragFromIndex];
|
|
3375
3381
|
if (!e || !this.ghostEl) return;
|
|
3376
3382
|
let t = this.ghostEl.style;
|
|
3377
|
-
t.display = "flex", t.height = `${e.offsetHeight}px`, e.querySelectorAll(`[${
|
|
3383
|
+
t.display = "flex", t.height = `${e.offsetHeight}px`, e.querySelectorAll(`[${O}]`).forEach((e) => {
|
|
3378
3384
|
var t;
|
|
3379
3385
|
let n = e, r = n.cloneNode(!0);
|
|
3380
3386
|
r.style.width = `${n.offsetWidth}px`, r.style.flexShrink = "0", r.removeAttribute("contenteditable"), (t = this.ghostEl) == null || t.appendChild(r);
|
|
@@ -3382,10 +3388,10 @@ var cr = (e) => {
|
|
|
3382
3388
|
}
|
|
3383
3389
|
buildColumnGhost() {
|
|
3384
3390
|
if (!this.ghostEl) return;
|
|
3385
|
-
let e = this.grid.querySelectorAll(`[${
|
|
3391
|
+
let e = this.grid.querySelectorAll(`[${D}]`), t = this.ghostEl.style;
|
|
3386
3392
|
t.display = "flex", t.flexDirection = "column", e.forEach((e) => {
|
|
3387
3393
|
var t;
|
|
3388
|
-
let n = e.querySelectorAll(`[${
|
|
3394
|
+
let n = e.querySelectorAll(`[${O}]`);
|
|
3389
3395
|
if (this.dragFromIndex >= n.length) return;
|
|
3390
3396
|
let r = n[this.dragFromIndex], i = r.cloneNode(!0);
|
|
3391
3397
|
i.style.width = `${r.offsetWidth}px`, i.style.height = `${r.offsetHeight}px`, i.removeAttribute("contenteditable"), (t = this.ghostEl) == null || t.appendChild(i);
|
|
@@ -3397,7 +3403,7 @@ var cr = (e) => {
|
|
|
3397
3403
|
this.dragType === "row" && (t.top = `${e.clientY - this.ghostOffsetY}px`), this.dragType === "col" && (t.left = `${e.clientX - this.ghostOffsetX}px`);
|
|
3398
3404
|
}
|
|
3399
3405
|
getRowDropIndex(e) {
|
|
3400
|
-
let t = Array.from(this.grid.querySelectorAll(`[${
|
|
3406
|
+
let t = Array.from(this.grid.querySelectorAll(`[${D}]`)), n = t.map((e) => e.offsetTop);
|
|
3401
3407
|
if (t.length > 0) {
|
|
3402
3408
|
let e = t[t.length - 1];
|
|
3403
3409
|
n.push(e.offsetTop + e.offsetHeight);
|
|
@@ -3406,7 +3412,7 @@ var cr = (e) => {
|
|
|
3406
3412
|
return r.indexOf(i);
|
|
3407
3413
|
}
|
|
3408
3414
|
getRowDropTopPx(e) {
|
|
3409
|
-
let t = this.grid.querySelectorAll(`[${
|
|
3415
|
+
let t = this.grid.querySelectorAll(`[${D}]`);
|
|
3410
3416
|
if (e < t.length) return t[e].offsetTop;
|
|
3411
3417
|
if (t.length > 0) {
|
|
3412
3418
|
let e = t[t.length - 1];
|
|
@@ -3415,10 +3421,10 @@ var cr = (e) => {
|
|
|
3415
3421
|
return 0;
|
|
3416
3422
|
}
|
|
3417
3423
|
getColDropIndex(e) {
|
|
3418
|
-
let t =
|
|
3424
|
+
let t = gi(this.grid).map((t) => Math.abs(e - t)), n = Math.min(...t);
|
|
3419
3425
|
return t.indexOf(n);
|
|
3420
3426
|
}
|
|
3421
|
-
},
|
|
3427
|
+
}, vi = [
|
|
3422
3428
|
"flex",
|
|
3423
3429
|
"items-center",
|
|
3424
3430
|
"select-none",
|
|
@@ -3430,7 +3436,7 @@ var cr = (e) => {
|
|
|
3430
3436
|
"mb-px",
|
|
3431
3437
|
"cursor-pointer",
|
|
3432
3438
|
"can-hover:hover:bg-item-hover-bg"
|
|
3433
|
-
],
|
|
3439
|
+
], yi = [
|
|
3434
3440
|
"flex",
|
|
3435
3441
|
"items-center",
|
|
3436
3442
|
"justify-center",
|
|
@@ -3439,13 +3445,13 @@ var cr = (e) => {
|
|
|
3439
3445
|
"mr-2",
|
|
3440
3446
|
"[&_svg]:w-icon",
|
|
3441
3447
|
"[&_svg]:h-icon"
|
|
3442
|
-
],
|
|
3448
|
+
], bi = [
|
|
3443
3449
|
"mr-auto",
|
|
3444
3450
|
"truncate",
|
|
3445
3451
|
"text-sm",
|
|
3446
3452
|
"font-medium",
|
|
3447
3453
|
"leading-5"
|
|
3448
|
-
],
|
|
3454
|
+
], xi = [
|
|
3449
3455
|
"relative",
|
|
3450
3456
|
"w-[30px]",
|
|
3451
3457
|
"h-[18px]",
|
|
@@ -3455,7 +3461,7 @@ var cr = (e) => {
|
|
|
3455
3461
|
"ease-out",
|
|
3456
3462
|
"shrink-0",
|
|
3457
3463
|
"ml-2"
|
|
3458
|
-
],
|
|
3464
|
+
], Si = [
|
|
3459
3465
|
"absolute",
|
|
3460
3466
|
"top-[2px]",
|
|
3461
3467
|
"w-[14px]",
|
|
@@ -3465,85 +3471,85 @@ var cr = (e) => {
|
|
|
3465
3471
|
"transition-[left]",
|
|
3466
3472
|
"duration-[220ms]",
|
|
3467
3473
|
"[transition-timing-function:cubic-bezier(0.34,1.56,0.64,1)]"
|
|
3468
|
-
],
|
|
3474
|
+
], Ci = (e) => {
|
|
3469
3475
|
let { icon: t, label: n, isActive: r, onToggle: i } = e, a = { active: r }, o = document.createElement("div");
|
|
3470
|
-
o.className =
|
|
3476
|
+
o.className = C(vi);
|
|
3471
3477
|
let s = document.createElement("div");
|
|
3472
|
-
s.className =
|
|
3478
|
+
s.className = C(yi), s.innerHTML = t, o.appendChild(s);
|
|
3473
3479
|
let c = document.createElement("span");
|
|
3474
|
-
c.className =
|
|
3480
|
+
c.className = C(bi), c.textContent = n, o.appendChild(c);
|
|
3475
3481
|
let l = document.createElement("div");
|
|
3476
|
-
l.className =
|
|
3482
|
+
l.className = C(xi);
|
|
3477
3483
|
let u = document.createElement("div");
|
|
3478
|
-
u.className =
|
|
3484
|
+
u.className = C(Si), l.appendChild(u), o.appendChild(l);
|
|
3479
3485
|
let d = () => {
|
|
3480
3486
|
l.style.backgroundColor = a.active ? "var(--blok-toggle-on-bg)" : "var(--blok-toggle-off-bg)", u.style.left = a.active ? "14px" : "2px", u.style.backgroundColor = a.active ? "var(--blok-toggle-thumb-on-bg)" : "", u.style.boxShadow = a.active ? "0 1px 3px rgba(0,0,0,0.35), 0 0 0 1px rgba(0,0,0,0.04)" : "0 1px 3px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.06)";
|
|
3481
3487
|
};
|
|
3482
3488
|
return d(), o.addEventListener("click", (e) => {
|
|
3483
3489
|
e.stopPropagation(), a.active = !a.active, d(), i(a.active);
|
|
3484
3490
|
}), o;
|
|
3485
|
-
},
|
|
3486
|
-
let
|
|
3487
|
-
type:
|
|
3488
|
-
element:
|
|
3489
|
-
icon:
|
|
3490
|
-
label:
|
|
3491
|
-
isActive:
|
|
3491
|
+
}, wi = (t, n) => {
|
|
3492
|
+
let r = t === 0 ? [{
|
|
3493
|
+
type: _.Html,
|
|
3494
|
+
element: Ci({
|
|
3495
|
+
icon: xe,
|
|
3496
|
+
label: n.i18n.t("tools.table.headerColumn"),
|
|
3497
|
+
isActive: n.isHeadingColumn(),
|
|
3492
3498
|
onToggle: () => {
|
|
3493
|
-
|
|
3499
|
+
n.onAction({ type: "toggle-heading-column" });
|
|
3494
3500
|
}
|
|
3495
3501
|
})
|
|
3496
|
-
}, { type:
|
|
3497
|
-
icon:
|
|
3498
|
-
title:
|
|
3502
|
+
}, { type: _.Separator }] : [], i = [{
|
|
3503
|
+
icon: e,
|
|
3504
|
+
title: n.i18n.t("tools.table.insertColumnLeft"),
|
|
3499
3505
|
closeOnActivate: !0,
|
|
3500
3506
|
onActivate: () => {
|
|
3501
|
-
|
|
3507
|
+
n.onAction({
|
|
3502
3508
|
type: "insert-col-left",
|
|
3503
|
-
index:
|
|
3509
|
+
index: t
|
|
3504
3510
|
});
|
|
3505
3511
|
}
|
|
3506
3512
|
}, {
|
|
3507
|
-
icon:
|
|
3508
|
-
title:
|
|
3513
|
+
icon: ke,
|
|
3514
|
+
title: n.i18n.t("tools.table.insertColumnRight"),
|
|
3509
3515
|
closeOnActivate: !0,
|
|
3510
3516
|
onActivate: () => {
|
|
3511
|
-
|
|
3517
|
+
n.onAction({
|
|
3512
3518
|
type: "insert-col-right",
|
|
3513
|
-
index:
|
|
3519
|
+
index: t
|
|
3514
3520
|
});
|
|
3515
3521
|
}
|
|
3516
|
-
}],
|
|
3517
|
-
icon:
|
|
3518
|
-
title:
|
|
3522
|
+
}], a = n.getColumnCount() > 1, o = [{ type: _.Separator }, {
|
|
3523
|
+
icon: Ee,
|
|
3524
|
+
title: n.i18n.t("tools.table.deleteColumn"),
|
|
3519
3525
|
isDestructive: !0,
|
|
3520
|
-
isDisabled: !
|
|
3526
|
+
isDisabled: !a,
|
|
3521
3527
|
closeOnActivate: !0,
|
|
3522
3528
|
onActivate: () => {
|
|
3523
|
-
|
|
3529
|
+
n.onAction({
|
|
3524
3530
|
type: "delete-col",
|
|
3525
|
-
index:
|
|
3531
|
+
index: t
|
|
3526
3532
|
});
|
|
3527
3533
|
}
|
|
3528
3534
|
}];
|
|
3529
3535
|
return [
|
|
3530
|
-
...n,
|
|
3531
3536
|
...r,
|
|
3532
|
-
...
|
|
3537
|
+
...i,
|
|
3538
|
+
...o
|
|
3533
3539
|
];
|
|
3534
|
-
},
|
|
3540
|
+
}, Ti = (e, t) => {
|
|
3535
3541
|
let n = e === 0 ? [{
|
|
3536
|
-
type:
|
|
3537
|
-
element:
|
|
3538
|
-
icon:
|
|
3542
|
+
type: _.Html,
|
|
3543
|
+
element: Ci({
|
|
3544
|
+
icon: be,
|
|
3539
3545
|
label: t.i18n.t("tools.table.headerRow"),
|
|
3540
3546
|
isActive: t.isHeadingRow(),
|
|
3541
3547
|
onToggle: () => {
|
|
3542
3548
|
t.onAction({ type: "toggle-heading" });
|
|
3543
3549
|
}
|
|
3544
3550
|
})
|
|
3545
|
-
}, { type:
|
|
3546
|
-
icon:
|
|
3551
|
+
}, { type: _.Separator }] : [], r = [{
|
|
3552
|
+
icon: Se,
|
|
3547
3553
|
title: t.i18n.t("tools.table.insertRowAbove"),
|
|
3548
3554
|
closeOnActivate: !0,
|
|
3549
3555
|
onActivate: () => {
|
|
@@ -3553,7 +3559,7 @@ var cr = (e) => {
|
|
|
3553
3559
|
});
|
|
3554
3560
|
}
|
|
3555
3561
|
}, {
|
|
3556
|
-
icon:
|
|
3562
|
+
icon: de,
|
|
3557
3563
|
title: t.i18n.t("tools.table.insertRowBelow"),
|
|
3558
3564
|
closeOnActivate: !0,
|
|
3559
3565
|
onActivate: () => {
|
|
@@ -3562,11 +3568,11 @@ var cr = (e) => {
|
|
|
3562
3568
|
index: e
|
|
3563
3569
|
});
|
|
3564
3570
|
}
|
|
3565
|
-
}],
|
|
3566
|
-
icon:
|
|
3571
|
+
}], i = t.getRowCount() > 1, a = [{ type: _.Separator }, {
|
|
3572
|
+
icon: Ee,
|
|
3567
3573
|
title: t.i18n.t("tools.table.deleteRow"),
|
|
3568
3574
|
isDestructive: !0,
|
|
3569
|
-
isDisabled: !
|
|
3575
|
+
isDisabled: !i,
|
|
3570
3576
|
closeOnActivate: !0,
|
|
3571
3577
|
onActivate: () => {
|
|
3572
3578
|
t.onAction({
|
|
@@ -3577,29 +3583,29 @@ var cr = (e) => {
|
|
|
3577
3583
|
}];
|
|
3578
3584
|
return [
|
|
3579
3585
|
...n,
|
|
3580
|
-
...
|
|
3581
|
-
...
|
|
3586
|
+
...r,
|
|
3587
|
+
...a
|
|
3582
3588
|
];
|
|
3583
|
-
},
|
|
3589
|
+
}, Ei = (e, t, n, r, i) => {
|
|
3584
3590
|
i.destroyPopover(), i.clearHideTimeout();
|
|
3585
3591
|
let a = e === "col" ? n.col[t] : n.row[t];
|
|
3586
3592
|
if (!a) return {
|
|
3587
3593
|
popover: null,
|
|
3588
3594
|
grip: null
|
|
3589
3595
|
};
|
|
3590
|
-
let o = new
|
|
3591
|
-
items: e === "col" ?
|
|
3596
|
+
let o = new Me({
|
|
3597
|
+
items: e === "col" ? wi(t, r) : Ti(t, r),
|
|
3592
3598
|
trigger: a,
|
|
3593
3599
|
flippable: !0
|
|
3594
3600
|
});
|
|
3595
|
-
return o.on(
|
|
3601
|
+
return o.on(at.Closed, () => {
|
|
3596
3602
|
var e;
|
|
3597
3603
|
i.destroyPopover(), i.applyVisibleClasses(a), i.scheduleHideAll(), (e = i.onGripPopoverClose) == null || e.call(i);
|
|
3598
3604
|
}), i.hideAllGripsExcept(a), i.applyActiveClasses(a), e === "col" ? a.style.height = "16px" : a.style.width = "16px", {
|
|
3599
3605
|
popover: o,
|
|
3600
3606
|
grip: a
|
|
3601
3607
|
};
|
|
3602
|
-
},
|
|
3608
|
+
}, Di = "data-blok-table-grip", Oi = "data-blok-table-grip-col", ki = "data-blok-table-grip-row", Ai = 150, ji = 24, Mi = 4, Ni = 4, Pi = 20, Fi = [
|
|
3603
3609
|
"absolute",
|
|
3604
3610
|
"z-3",
|
|
3605
3611
|
"rounded-sm",
|
|
@@ -3612,25 +3618,25 @@ var cr = (e) => {
|
|
|
3612
3618
|
"items-center",
|
|
3613
3619
|
"justify-center",
|
|
3614
3620
|
"overflow-hidden"
|
|
3615
|
-
],
|
|
3621
|
+
], Ii = [
|
|
3616
3622
|
"bg-gray-300",
|
|
3617
3623
|
"opacity-0",
|
|
3618
3624
|
"pointer-events-none"
|
|
3619
|
-
],
|
|
3625
|
+
], Li = [
|
|
3620
3626
|
"bg-gray-300",
|
|
3621
3627
|
"opacity-100",
|
|
3622
3628
|
"pointer-events-auto"
|
|
3623
|
-
],
|
|
3629
|
+
], Ri = [
|
|
3624
3630
|
"bg-blue-500",
|
|
3625
3631
|
"text-white",
|
|
3626
3632
|
"opacity-100",
|
|
3627
3633
|
"pointer-events-auto"
|
|
3628
|
-
],
|
|
3634
|
+
], zi = class {
|
|
3629
3635
|
constructor(e) {
|
|
3630
3636
|
this.colGrips = [], this.rowGrips = [], this.popoverState = {
|
|
3631
3637
|
popover: null,
|
|
3632
3638
|
grip: null
|
|
3633
|
-
}, this.lockedGrip = null, this.hideTimeout = null, this.activeColGripIndex = -1, this.activeRowGripIndex = -1, this.isInsideTable = !1, this.rowResizeObserver = null, this.boundScrollHandler = null, this.grid = e.grid, this.overlay = e.overlay, this.scrollContainer = e.scrollContainer, this.getColumnCount = e.getColumnCount, this.getRowCount = e.getRowCount, this.isHeadingRow = e.isHeadingRow, this.isHeadingColumn = e.isHeadingColumn, this.onAction = e.onAction, this.onGripClick = e.onGripClick, this.onGripPopoverClose = e.onGripPopoverClose, this.i18n = e.i18n, this.drag = new
|
|
3639
|
+
}, this.lockedGrip = null, this.hideTimeout = null, this.activeColGripIndex = -1, this.activeRowGripIndex = -1, this.isInsideTable = !1, this.rowResizeObserver = null, this.boundScrollHandler = null, this.grid = e.grid, this.overlay = e.overlay, this.scrollContainer = e.scrollContainer, this.getColumnCount = e.getColumnCount, this.getRowCount = e.getRowCount, this.isHeadingRow = e.isHeadingRow, this.isHeadingColumn = e.isHeadingColumn, this.onAction = e.onAction, this.onGripClick = e.onGripClick, this.onGripPopoverClose = e.onGripPopoverClose, this.i18n = e.i18n, this.drag = new _i({
|
|
3634
3640
|
grid: this.grid,
|
|
3635
3641
|
onAction: this.onAction,
|
|
3636
3642
|
onDragStateChange: (t, n) => {
|
|
@@ -3651,7 +3657,7 @@ var cr = (e) => {
|
|
|
3651
3657
|
}
|
|
3652
3658
|
handleUnlockGrip(e) {
|
|
3653
3659
|
document.removeEventListener("pointerdown", this.boundUnlockGrip), this.lockedGrip && (this.applyIdleClasses(this.lockedGrip), this.lockedGrip = null);
|
|
3654
|
-
let t = e.target instanceof HTMLElement ? e.target : null, n = t == null ? void 0 : t.closest(`[${
|
|
3660
|
+
let t = e.target instanceof HTMLElement ? e.target : null, n = t == null ? void 0 : t.closest(`[${O}]`);
|
|
3655
3661
|
if (n) {
|
|
3656
3662
|
let e = this.getCellPosition(n);
|
|
3657
3663
|
e && (this.clearHideTimeout(), this.showColGrip(e.col), this.showRowGrip(e.row), this.isInsideTable = !0);
|
|
@@ -3698,18 +3704,18 @@ var cr = (e) => {
|
|
|
3698
3704
|
}
|
|
3699
3705
|
createGripElement(e, t) {
|
|
3700
3706
|
let n = document.createElement("div");
|
|
3701
|
-
n.className =
|
|
3702
|
-
let r = e === "col" ?
|
|
3703
|
-
return n.style.width = `${r}px`, n.style.height = `${i}px`, n.style.transform = "translate(-50%, -50%)", n.style.outline = "2px solid var(--blok-table-grip-outline, transparent)", n.appendChild(
|
|
3704
|
-
this.overlay && this.clearHideTimeout(), this.isGripInteractionLocked() ||
|
|
3707
|
+
n.className = C(Fi, Ii), n.setAttribute(Di, ""), n.setAttribute(e === "col" ? Oi : ki, String(t)), n.setAttribute("contenteditable", "false");
|
|
3708
|
+
let r = e === "col" ? ji : Ni, i = e === "col" ? Mi : Pi, a = e === "col" ? Mi : Ni;
|
|
3709
|
+
return n.style.width = `${r}px`, n.style.height = `${i}px`, n.style.transform = "translate(-50%, -50%)", n.style.outline = "2px solid var(--blok-table-grip-outline, transparent)", n.appendChild(wr(e === "col" ? "horizontal" : "vertical")), n.addEventListener("pointerdown", this.boundPointerDown), n.addEventListener("mouseenter", () => {
|
|
3710
|
+
this.overlay && this.clearHideTimeout(), this.isGripInteractionLocked() || Tr(n, e);
|
|
3705
3711
|
}), n.addEventListener("mouseleave", () => {
|
|
3706
|
-
this.isGripInteractionLocked() || (
|
|
3712
|
+
this.isGripInteractionLocked() || (Er(n, e, a), this.overlay && this.scheduleHideAll());
|
|
3707
3713
|
}), n;
|
|
3708
3714
|
}
|
|
3709
3715
|
positionGrips() {
|
|
3710
|
-
let e = this.grid.querySelectorAll(`[${
|
|
3716
|
+
let e = this.grid.querySelectorAll(`[${D}]`);
|
|
3711
3717
|
if (!e[0]) return;
|
|
3712
|
-
let t =
|
|
3718
|
+
let t = gi(this.grid), n = this.overlay && this.scrollContainer ? this.scrollContainer.scrollLeft : 0, r = this.overlay && this.scrollContainer ? this.scrollContainer.clientWidth : Infinity;
|
|
3713
3719
|
this.colGrips.forEach((e, i) => {
|
|
3714
3720
|
if (i + 1 >= t.length) return;
|
|
3715
3721
|
let a = (t[i] + t[i + 1]) / 2 - n, o = e.style;
|
|
@@ -3724,7 +3730,7 @@ var cr = (e) => {
|
|
|
3724
3730
|
var e;
|
|
3725
3731
|
(e = this.rowResizeObserver) == null || e.disconnect(), this.rowResizeObserver = new ResizeObserver(() => {
|
|
3726
3732
|
this.positionGrips();
|
|
3727
|
-
}), this.grid.querySelectorAll(`[${
|
|
3733
|
+
}), this.grid.querySelectorAll(`[${D}]`).forEach((e) => {
|
|
3728
3734
|
var t;
|
|
3729
3735
|
(t = this.rowResizeObserver) == null || t.observe(e);
|
|
3730
3736
|
});
|
|
@@ -3734,7 +3740,7 @@ var cr = (e) => {
|
|
|
3734
3740
|
}
|
|
3735
3741
|
handleMouseOver(e) {
|
|
3736
3742
|
if (this.isGripInteractionLocked()) return;
|
|
3737
|
-
let t = e.target.closest(`[${
|
|
3743
|
+
let t = e.target.closest(`[${O}]`);
|
|
3738
3744
|
if (!t) return;
|
|
3739
3745
|
this.clearHideTimeout();
|
|
3740
3746
|
let n = this.getCellPosition(t);
|
|
@@ -3744,11 +3750,11 @@ var cr = (e) => {
|
|
|
3744
3750
|
this.isGripInteractionLocked() || this.scheduleHideAll();
|
|
3745
3751
|
}
|
|
3746
3752
|
getCellPosition(e) {
|
|
3747
|
-
let t = e.closest(`[${
|
|
3753
|
+
let t = e.closest(`[${D}]`);
|
|
3748
3754
|
if (!t) return null;
|
|
3749
|
-
let n = Array.from(this.grid.querySelectorAll(`[${
|
|
3755
|
+
let n = Array.from(this.grid.querySelectorAll(`[${D}]`)).indexOf(t);
|
|
3750
3756
|
if (n < 0) return null;
|
|
3751
|
-
let r = Array.from(t.querySelectorAll(`[${
|
|
3757
|
+
let r = Array.from(t.querySelectorAll(`[${O}]`)).indexOf(e);
|
|
3752
3758
|
return r < 0 ? null : {
|
|
3753
3759
|
row: n,
|
|
3754
3760
|
col: r
|
|
@@ -3777,13 +3783,13 @@ var cr = (e) => {
|
|
|
3777
3783
|
this.activeRowGripIndex >= 0 && this.activeRowGripIndex < this.rowGrips.length && this.applyIdleClasses(this.rowGrips[this.activeRowGripIndex]), this.activeRowGripIndex = -1;
|
|
3778
3784
|
}
|
|
3779
3785
|
applyVisibleClasses(e) {
|
|
3780
|
-
let t = e, n = t.hasAttribute(
|
|
3781
|
-
|
|
3786
|
+
let t = e, n = t.hasAttribute(Oi);
|
|
3787
|
+
xr(t, n ? "col" : "row", n ? Mi : Ni), this.isInsideTable && (t.style.transition = "none"), t.className = C(Fi, Li), t.setAttribute("data-blok-table-grip-visible", ""), this.isInsideTable && (t.offsetHeight, t.style.transition = "");
|
|
3782
3788
|
let r = t.querySelector("svg");
|
|
3783
3789
|
r && (r.classList.remove("text-white", "opacity-100"), r.classList.add("text-gray-400", "opacity-0"));
|
|
3784
3790
|
}
|
|
3785
3791
|
applyActiveClasses(e) {
|
|
3786
|
-
Object.assign(e, { className:
|
|
3792
|
+
Object.assign(e, { className: C(Fi, Ri) }), e.setAttribute("data-blok-table-grip-visible", "");
|
|
3787
3793
|
let t = e.querySelector("svg");
|
|
3788
3794
|
t && (t.classList.remove("text-gray-400", "opacity-0"), t.classList.add("text-white", "opacity-100"));
|
|
3789
3795
|
}
|
|
@@ -3793,8 +3799,8 @@ var cr = (e) => {
|
|
|
3793
3799
|
});
|
|
3794
3800
|
}
|
|
3795
3801
|
applyIdleClasses(e) {
|
|
3796
|
-
let t = e, n = t.hasAttribute(
|
|
3797
|
-
this.isInsideTable && (t.style.transition = "none"),
|
|
3802
|
+
let t = e, n = t.hasAttribute(Oi), r = n ? "col" : "row", i = n ? Mi + 12 : Ni + 12;
|
|
3803
|
+
this.isInsideTable && (t.style.transition = "none"), xr(t, r, i), t.className = C(Fi, Ii), t.removeAttribute("data-blok-table-grip-visible");
|
|
3798
3804
|
let a = t.querySelector("svg");
|
|
3799
3805
|
a && (a.classList.add("opacity-0"), a.classList.remove("opacity-100")), this.isInsideTable && (t.offsetHeight, t.style.transition = "");
|
|
3800
3806
|
}
|
|
@@ -3807,13 +3813,13 @@ var cr = (e) => {
|
|
|
3807
3813
|
scheduleHideAll() {
|
|
3808
3814
|
this.hideTimeout = setTimeout(() => {
|
|
3809
3815
|
this.hideColGrip(), this.hideRowGrip(), this.isInsideTable = !1, this.hideTimeout = null;
|
|
3810
|
-
},
|
|
3816
|
+
}, Ai);
|
|
3811
3817
|
}
|
|
3812
3818
|
clearHideTimeout() {
|
|
3813
3819
|
this.hideTimeout !== null && (clearTimeout(this.hideTimeout), this.hideTimeout = null);
|
|
3814
3820
|
}
|
|
3815
3821
|
handlePointerDown(e) {
|
|
3816
|
-
let t = e.target.closest(`[${
|
|
3822
|
+
let t = e.target.closest(`[${Di}]`);
|
|
3817
3823
|
if (!t) return;
|
|
3818
3824
|
e.preventDefault(), e.stopPropagation();
|
|
3819
3825
|
let n = this.detectGripType(t);
|
|
@@ -3822,12 +3828,12 @@ var cr = (e) => {
|
|
|
3822
3828
|
});
|
|
3823
3829
|
}
|
|
3824
3830
|
detectGripType(e) {
|
|
3825
|
-
let t = e.getAttribute(
|
|
3831
|
+
let t = e.getAttribute(Oi);
|
|
3826
3832
|
if (t !== null) return {
|
|
3827
3833
|
type: "col",
|
|
3828
3834
|
index: Number(t)
|
|
3829
3835
|
};
|
|
3830
|
-
let n = e.getAttribute(
|
|
3836
|
+
let n = e.getAttribute(ki);
|
|
3831
3837
|
return n === null ? null : {
|
|
3832
3838
|
type: "row",
|
|
3833
3839
|
index: Number(n)
|
|
@@ -3835,7 +3841,7 @@ var cr = (e) => {
|
|
|
3835
3841
|
}
|
|
3836
3842
|
openPopover(e, t) {
|
|
3837
3843
|
var n, r;
|
|
3838
|
-
this.popoverState =
|
|
3844
|
+
this.popoverState = Ei(e, t, {
|
|
3839
3845
|
col: this.colGrips,
|
|
3840
3846
|
row: this.rowGrips
|
|
3841
3847
|
}, {
|
|
@@ -3864,7 +3870,7 @@ var cr = (e) => {
|
|
|
3864
3870
|
}, e.destroy();
|
|
3865
3871
|
}
|
|
3866
3872
|
}
|
|
3867
|
-
},
|
|
3873
|
+
}, Bi = "data-blok-table-haze", Vi = "data-blok-table-haze-visible", Hi = 1, Ui = [
|
|
3868
3874
|
"absolute",
|
|
3869
3875
|
"top-0",
|
|
3870
3876
|
"bottom-0",
|
|
@@ -3874,17 +3880,17 @@ var cr = (e) => {
|
|
|
3874
3880
|
"transition-opacity",
|
|
3875
3881
|
"duration-150",
|
|
3876
3882
|
"z-1"
|
|
3877
|
-
],
|
|
3883
|
+
], Wi = [
|
|
3878
3884
|
"left-0",
|
|
3879
3885
|
"bg-linear-to-r",
|
|
3880
3886
|
"from-white/80",
|
|
3881
3887
|
"to-transparent"
|
|
3882
|
-
],
|
|
3888
|
+
], Gi = [
|
|
3883
3889
|
"right-5",
|
|
3884
3890
|
"bg-linear-to-l",
|
|
3885
3891
|
"from-white/80",
|
|
3886
3892
|
"to-transparent"
|
|
3887
|
-
],
|
|
3893
|
+
], Ki = class {
|
|
3888
3894
|
constructor() {
|
|
3889
3895
|
this.leftHaze = null, this.rightHaze = null, this.scrollContainer = null, this.boundOnScroll = null, this.ticking = !1;
|
|
3890
3896
|
}
|
|
@@ -3904,7 +3910,7 @@ var cr = (e) => {
|
|
|
3904
3910
|
}
|
|
3905
3911
|
createHazeElement(e) {
|
|
3906
3912
|
let t = document.createElement("div");
|
|
3907
|
-
return t.setAttribute(
|
|
3913
|
+
return t.setAttribute(Bi, e), t.setAttribute("aria-hidden", "true"), t.classList.add(...Ui, ...e === "left" ? Wi : Gi), t;
|
|
3908
3914
|
}
|
|
3909
3915
|
syncVisibility() {
|
|
3910
3916
|
let e = this.scrollContainer;
|
|
@@ -3915,12 +3921,12 @@ var cr = (e) => {
|
|
|
3915
3921
|
return;
|
|
3916
3922
|
}
|
|
3917
3923
|
let { scrollLeft: n, scrollWidth: r, clientWidth: i } = e, a = r - i;
|
|
3918
|
-
this.setVisible(this.leftHaze, n >
|
|
3924
|
+
this.setVisible(this.leftHaze, n > Hi), this.setVisible(this.rightHaze, a > Hi && n < a - Hi);
|
|
3919
3925
|
}
|
|
3920
3926
|
setVisible(e, t) {
|
|
3921
|
-
e && (t ? e.setAttribute(
|
|
3927
|
+
e && (t ? e.setAttribute(Vi, "") : e.removeAttribute(Vi));
|
|
3922
3928
|
}
|
|
3923
|
-
},
|
|
3929
|
+
}, qi = 3, Ji = 3, Yi = ["my-2", "pr-5"], Xi = [
|
|
3924
3930
|
"relative",
|
|
3925
3931
|
"mb-7",
|
|
3926
3932
|
"after:content-[\"\"]",
|
|
@@ -3930,11 +3936,11 @@ var cr = (e) => {
|
|
|
3930
3936
|
"after:right-0",
|
|
3931
3937
|
"after:h-10",
|
|
3932
3938
|
"after:pointer-events-none"
|
|
3933
|
-
],
|
|
3939
|
+
], Zi = class {
|
|
3934
3940
|
constructor({ data: e, config: t, api: n, readOnly: r, block: i }) {
|
|
3935
3941
|
this.initialContent = null, this.resize = null, this.addControls = null, this.rowColControls = null, this.cellBlocks = null, this.cellSelection = null, this.scrollHaze = null, this.element = null, this.gridElement = null, this.scrollContainer = null, this.gripOverlay = null, this.pendingHighlight = null, this.isNewTable = !1, this.unregisterRestrictedTools = null, this.setDataGeneration = 0, this.structuralOpDepth = 0, this.api = n, this.readOnly = r, this.config = t == null ? {} : t;
|
|
3936
|
-
let a =
|
|
3937
|
-
this.initialContent = a.content, this.grid = new
|
|
3942
|
+
let a = Yr(e, this.config);
|
|
3943
|
+
this.initialContent = a.content, this.grid = new mr({ readOnly: r }), this.model = new ei(a), this.blockId = i == null ? void 0 : i.id, this.config.restrictedTools !== void 0 && (this.unregisterRestrictedTools = Ue(this.config.restrictedTools));
|
|
3938
3944
|
}
|
|
3939
3945
|
runStructuralOp(e, t = !1) {
|
|
3940
3946
|
this.structuralOpDepth++;
|
|
@@ -3969,7 +3975,7 @@ var cr = (e) => {
|
|
|
3969
3975
|
}
|
|
3970
3976
|
static get toolbox() {
|
|
3971
3977
|
return {
|
|
3972
|
-
icon:
|
|
3978
|
+
icon: We,
|
|
3973
3979
|
title: "Table",
|
|
3974
3980
|
titleKey: "tools.table.title",
|
|
3975
3981
|
searchTerms: [
|
|
@@ -4002,7 +4008,7 @@ var cr = (e) => {
|
|
|
4002
4008
|
em: !0,
|
|
4003
4009
|
mark: (e) => {
|
|
4004
4010
|
let t = e.style, n = Array.from({ length: t.length }, (e, n) => t.item(n));
|
|
4005
|
-
for (let e of n)
|
|
4011
|
+
for (let e of n) a.has(e) || t.removeProperty(e);
|
|
4006
4012
|
return t.length > 0 ? { style: !0 } : {};
|
|
4007
4013
|
},
|
|
4008
4014
|
a: { href: !0 },
|
|
@@ -4023,26 +4029,26 @@ var cr = (e) => {
|
|
|
4023
4029
|
render() {
|
|
4024
4030
|
var e, t, n, r, i, a;
|
|
4025
4031
|
let o = document.createElement("div");
|
|
4026
|
-
o.className =
|
|
4027
|
-
let s = ((n = this.initialContent) == null ? void 0 : n.length) || this.config.rows ||
|
|
4032
|
+
o.className = C(Yi, !this.readOnly && Xi), o.setAttribute(y.tool, "table"), this.readOnly && o.setAttribute("data-blok-table-readonly", ""), this.isNewTable = ((e = (t = this.initialContent) == null ? void 0 : t.length) == null ? 0 : e) === 0;
|
|
4033
|
+
let s = ((n = this.initialContent) == null ? void 0 : n.length) || this.config.rows || qi, c = ((r = this.initialContent) == null ? void 0 : r.reduce((e, t) => {
|
|
4028
4034
|
var n;
|
|
4029
4035
|
return Math.max(e, (n = t == null ? void 0 : t.length) == null ? 0 : n);
|
|
4030
|
-
}, 0)) || this.config.cols ||
|
|
4036
|
+
}, 0)) || this.config.cols || Ji, l = this.grid.createGrid(s, c, this.model.colWidths);
|
|
4031
4037
|
if (((i = (a = this.initialContent) == null ? void 0 : a.length) == null ? 0 : i) > 0) {
|
|
4032
4038
|
var u;
|
|
4033
4039
|
this.grid.fillGrid(l, (u = this.initialContent) == null ? [] : u);
|
|
4034
4040
|
}
|
|
4035
|
-
if (this.model.colWidths &&
|
|
4041
|
+
if (this.model.colWidths && Ir(l, this.model.colWidths), this.gridElement = l, this.model.colWidths || !this.readOnly) {
|
|
4036
4042
|
let e = document.createElement("div");
|
|
4037
4043
|
e.setAttribute("data-blok-table-scroll", "");
|
|
4038
|
-
let t = this.model.colWidths ?
|
|
4044
|
+
let t = this.model.colWidths ? Zr : [];
|
|
4039
4045
|
e.classList.add(...t), e.appendChild(l), o.appendChild(e), this.scrollContainer = e;
|
|
4040
4046
|
} else o.appendChild(l), this.scrollContainer = null;
|
|
4041
4047
|
if (!this.readOnly) {
|
|
4042
4048
|
let e = document.createElement("div");
|
|
4043
4049
|
e.setAttribute("data-blok-table-grip-overlay", ""), e.style.position = "absolute", e.style.inset = "0", e.style.pointerEvents = "none", e.style.zIndex = "3", o.appendChild(e), this.gripOverlay = e;
|
|
4044
4050
|
}
|
|
4045
|
-
return this.element = o, this.model.withHeadings && P(this.gridElement, this.model.withHeadings), this.model.withHeadingColumn && I(this.gridElement, this.model.withHeadingColumn), this.readOnly || (this.initCellBlocks(l),
|
|
4051
|
+
return this.element = o, this.model.withHeadings && P(this.gridElement, this.model.withHeadings), this.model.withHeadingColumn && I(this.gridElement, this.model.withHeadingColumn), this.readOnly || (this.initCellBlocks(l), Xr(l, this.cellBlocks)), o;
|
|
4046
4052
|
}
|
|
4047
4053
|
rendered() {
|
|
4048
4054
|
if (!this.element || this.initialContent === null) return;
|
|
@@ -4051,20 +4057,20 @@ var cr = (e) => {
|
|
|
4051
4057
|
let t = this.initialContent;
|
|
4052
4058
|
if (this.initialContent = null, this.readOnly) {
|
|
4053
4059
|
var n;
|
|
4054
|
-
|
|
4060
|
+
Jr(e, t, this.api, (n = this.blockId) == null ? "" : n), F(e, this.model.snapshot().content), this.initScrollHaze();
|
|
4055
4061
|
return;
|
|
4056
4062
|
}
|
|
4057
4063
|
if (this.runTransactedStructuralOp(() => {
|
|
4058
4064
|
var n, r;
|
|
4059
|
-
let i = (n = (r = this.cellBlocks) == null ? void 0 : r.initializeCells(t)) == null ? t : n, a = this.isNewTable && i.length === 0 ? Array.from(e.querySelectorAll(`[${
|
|
4060
|
-
let t = e.querySelectorAll(`[${
|
|
4065
|
+
let i = (n = (r = this.cellBlocks) == null ? void 0 : r.initializeCells(t)) == null ? t : n, a = this.isNewTable && i.length === 0 ? Array.from(e.querySelectorAll(`[${D}]`), (e) => {
|
|
4066
|
+
let t = e.querySelectorAll(`[${O}]`).length;
|
|
4061
4067
|
return Array.from({ length: t }, () => ({ blocks: [] }));
|
|
4062
4068
|
}) : i;
|
|
4063
|
-
this.model.replaceAll(
|
|
4069
|
+
this.model.replaceAll(S(S({}, this.model.snapshot()), {}, { content: a })), this.isNewTable && N(e, this.cellBlocks), this.removeGhostChildren();
|
|
4064
4070
|
}, !0), this.model.initialColWidth === void 0) {
|
|
4065
4071
|
var r;
|
|
4066
|
-
let t = (r = this.model.colWidths) == null ?
|
|
4067
|
-
this.model.setInitialColWidth(t.length > 0 ?
|
|
4072
|
+
let t = (r = this.model.colWidths) == null ? j(e) : r;
|
|
4073
|
+
this.model.setInitialColWidth(t.length > 0 ? Gr(t) : void 0);
|
|
4068
4074
|
}
|
|
4069
4075
|
if (this.initSubsystems(e), F(e, this.model.snapshot().content), this.isNewTable) {
|
|
4070
4076
|
var i;
|
|
@@ -4094,7 +4100,7 @@ var cr = (e) => {
|
|
|
4094
4100
|
setData(e) {
|
|
4095
4101
|
var t, n, r, i, a;
|
|
4096
4102
|
this.setDataGeneration++;
|
|
4097
|
-
let o = this.setDataGeneration, s =
|
|
4103
|
+
let o = this.setDataGeneration, s = Yr(S(S({}, this.model.snapshot()), e), this.config);
|
|
4098
4104
|
this.initialContent = s.content, this.model.replaceAll(s), this.api.blocks.isSyncingFromYjs || this.runStructuralOp(() => {
|
|
4099
4105
|
var e;
|
|
4100
4106
|
(e = this.cellBlocks) == null || e.deleteAllBlocks();
|
|
@@ -4116,12 +4122,12 @@ var cr = (e) => {
|
|
|
4116
4122
|
let i = (e = (t = (n = this.cellBlocks) == null ? void 0 : n.initializeCells((r = this.initialContent) == null ? [] : r)) == null ? this.initialContent : t) == null ? [] : e;
|
|
4117
4123
|
if (o === this.setDataGeneration) {
|
|
4118
4124
|
if (this.api.blocks.isSyncingFromYjs && i.length === 0 && f) {
|
|
4119
|
-
let e = Array.from(f.querySelectorAll(`[${
|
|
4120
|
-
let t = e.querySelectorAll(`[${
|
|
4125
|
+
let e = Array.from(f.querySelectorAll(`[${D}]`), (e) => {
|
|
4126
|
+
let t = e.querySelectorAll(`[${O}]`).length;
|
|
4121
4127
|
return Array.from({ length: t }, () => ({ blocks: [] }));
|
|
4122
4128
|
});
|
|
4123
|
-
this.model.replaceAll(
|
|
4124
|
-
} else this.model.replaceAll(
|
|
4129
|
+
this.model.replaceAll(S(S({}, this.model.snapshot()), {}, { content: e })), N(f, this.cellBlocks);
|
|
4130
|
+
} else this.model.replaceAll(S(S({}, this.model.snapshot()), {}, { content: i }));
|
|
4125
4131
|
this.initialContent = null;
|
|
4126
4132
|
}
|
|
4127
4133
|
}, !0), o === this.setDataGeneration && (this.initSubsystems(f), l !== null && this.cellSelection !== null && this.cellSelection.selectRange(l), u !== null && this.rowColControls !== null && this.rowColControls.restoreVisibleGrips(u.col, u.row), F(f, this.model.snapshot().content)));
|
|
@@ -4129,37 +4135,37 @@ var cr = (e) => {
|
|
|
4129
4135
|
}
|
|
4130
4136
|
onPaste(e) {
|
|
4131
4137
|
var t, n;
|
|
4132
|
-
let
|
|
4133
|
-
|
|
4134
|
-
let t = e.querySelectorAll("td, th"), n = [],
|
|
4138
|
+
let i = e.detail.data, a = i.querySelectorAll("tr"), o = [], s = [];
|
|
4139
|
+
a.forEach((e) => {
|
|
4140
|
+
let t = e.querySelectorAll("td, th"), n = [], i = [];
|
|
4135
4141
|
t.forEach((e) => {
|
|
4136
4142
|
var t;
|
|
4137
4143
|
n.push(e.innerHTML);
|
|
4138
|
-
let
|
|
4139
|
-
|
|
4140
|
-
let
|
|
4141
|
-
|
|
4142
|
-
}), n.length > 0 && (
|
|
4144
|
+
let a = (t = e.getAttribute("style")) == null ? "" : t, o = {}, s = /background-color\s*:\s*([^;]+)/i.exec(a);
|
|
4145
|
+
s != null && s[1] && (o.color = r(s[1].trim(), "bg"));
|
|
4146
|
+
let l = (/* @__PURE__ */ RegExp("(?<![a-z-])color\\s*:\\s*([^;]+)", "i")).exec(a);
|
|
4147
|
+
l != null && l[1] && !c(l[1].trim()) && (o.textColor = r(l[1].trim(), "text")), i.push(o);
|
|
4148
|
+
}), n.length > 0 && (o.push(n), s.push(i));
|
|
4143
4149
|
});
|
|
4144
|
-
let
|
|
4145
|
-
this.initialContent =
|
|
4150
|
+
let l = i.querySelector("thead") !== null, u = ((t = a[0]) == null ? void 0 : t.querySelector("th")) !== null, d = l || u;
|
|
4151
|
+
this.initialContent = o, this.model.setWithHeadings(d), this.model.setWithHeadingColumn(!1), this.model.setColWidths(void 0), this.runStructuralOp(() => {
|
|
4146
4152
|
var e;
|
|
4147
4153
|
(e = this.cellBlocks) == null || e.deleteAllBlocks();
|
|
4148
4154
|
}, !0), (n = this.cellBlocks) == null || n.destroy(), this.teardownSubsystems();
|
|
4149
|
-
let
|
|
4150
|
-
if (!(
|
|
4151
|
-
let
|
|
4152
|
-
|
|
4153
|
-
let
|
|
4154
|
-
!this.readOnly &&
|
|
4155
|
+
let f = this.element;
|
|
4156
|
+
if (!(f != null && f.parentNode)) return;
|
|
4157
|
+
let p = this.render();
|
|
4158
|
+
f.parentNode.replaceChild(p, f);
|
|
4159
|
+
let m = this.gridElement;
|
|
4160
|
+
!this.readOnly && m && (this.runStructuralOp(() => {
|
|
4155
4161
|
var e, t, n, r;
|
|
4156
4162
|
let i = (e = (t = (n = this.cellBlocks) == null ? void 0 : n.initializeCells((r = this.initialContent) == null ? [] : r)) == null ? this.initialContent : t) == null ? [] : e;
|
|
4157
|
-
this.model.replaceAll(
|
|
4163
|
+
this.model.replaceAll(S(S({}, this.model.snapshot()), {}, { content: i })), this.initialContent = null, s.forEach((e, t) => {
|
|
4158
4164
|
e.forEach((e, n) => {
|
|
4159
4165
|
e.color !== void 0 && this.model.setCellColor(t, n, e.color), e.textColor !== void 0 && this.model.setCellTextColor(t, n, e.textColor);
|
|
4160
4166
|
});
|
|
4161
4167
|
});
|
|
4162
|
-
}, !0), this.initSubsystems(
|
|
4168
|
+
}, !0), this.initSubsystems(m), F(m, this.model.snapshot().content));
|
|
4163
4169
|
}
|
|
4164
4170
|
destroy() {
|
|
4165
4171
|
var e, t;
|
|
@@ -4186,22 +4192,22 @@ var cr = (e) => {
|
|
|
4186
4192
|
});
|
|
4187
4193
|
}
|
|
4188
4194
|
getBlockIdsInRow(e) {
|
|
4189
|
-
return
|
|
4195
|
+
return Kr(this.element, this.cellBlocks, e);
|
|
4190
4196
|
}
|
|
4191
4197
|
getBlockIdsInColumn(e) {
|
|
4192
|
-
return
|
|
4198
|
+
return qr(this.element, this.cellBlocks, e);
|
|
4193
4199
|
}
|
|
4194
4200
|
initAddControls(e) {
|
|
4195
4201
|
var t;
|
|
4196
4202
|
if ((t = this.addControls) == null || t.destroy(), !this.element) return;
|
|
4197
4203
|
let n = { addedCols: 0 };
|
|
4198
|
-
this.addControls = new
|
|
4204
|
+
this.addControls = new lr({
|
|
4199
4205
|
wrapper: this.element,
|
|
4200
4206
|
grid: e,
|
|
4201
4207
|
i18n: this.api.i18n,
|
|
4202
4208
|
getNewColumnWidth: () => {
|
|
4203
4209
|
var t;
|
|
4204
|
-
let n = (t = this.model.colWidths) == null ?
|
|
4210
|
+
let n = (t = this.model.colWidths) == null ? j(e) : t;
|
|
4205
4211
|
return this.model.initialColWidth === void 0 ? M(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
|
|
4206
4212
|
},
|
|
4207
4213
|
onAddRow: () => {
|
|
@@ -4213,7 +4219,7 @@ var cr = (e) => {
|
|
|
4213
4219
|
onAddColumn: () => {
|
|
4214
4220
|
this.runTransactedStructuralOp(() => {
|
|
4215
4221
|
var t, n, r;
|
|
4216
|
-
let i = (t = this.model.colWidths) == null ?
|
|
4222
|
+
let i = (t = this.model.colWidths) == null ? j(e) : t, a = this.model.initialColWidth === void 0 ? M(i) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
|
|
4217
4223
|
this.grid.addColumn(e, void 0, i, a), this.model.addColumn(void 0, a), this.model.setColWidths([...i, a]), N(e, this.cellBlocks), I(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (n = this.rowColControls) == null || n.refresh(), this.scrollContainer && (this.scrollContainer.scrollLeft = this.scrollContainer.scrollWidth), (r = this.addControls) == null || r.syncRowButtonWidth();
|
|
4218
4224
|
});
|
|
4219
4225
|
},
|
|
@@ -4229,7 +4235,7 @@ var cr = (e) => {
|
|
|
4229
4235
|
onDragRemoveRow: () => {
|
|
4230
4236
|
this.runTransactedStructuralOp(() => {
|
|
4231
4237
|
let t = this.grid.getRowCount(e);
|
|
4232
|
-
if (t > 1 &&
|
|
4238
|
+
if (t > 1 && zr(e, t - 1)) {
|
|
4233
4239
|
var n;
|
|
4234
4240
|
let { blocksToDelete: r } = this.model.deleteRow(t - 1);
|
|
4235
4241
|
(n = this.cellBlocks) == null || n.deleteBlocks(r), this.grid.deleteRow(e, t - 1);
|
|
@@ -4239,19 +4245,19 @@ var cr = (e) => {
|
|
|
4239
4245
|
onDragAddCol: () => {
|
|
4240
4246
|
this.runTransactedStructuralOp(() => {
|
|
4241
4247
|
var t;
|
|
4242
|
-
let r = (t = this.model.colWidths) == null ?
|
|
4243
|
-
this.grid.addColumn(e, void 0, r, i), this.model.addColumn(void 0, i), this.model.setColWidths(a),
|
|
4248
|
+
let r = (t = this.model.colWidths) == null ? j(e) : t, i = this.model.initialColWidth === void 0 ? M(r) : Math.round(this.model.initialColWidth / 2 * 100) / 100, a = [...r, i];
|
|
4249
|
+
this.grid.addColumn(e, void 0, r, i), this.model.addColumn(void 0, i), this.model.setColWidths(a), Ir(e, a), N(e, this.cellBlocks), I(this.gridElement, this.model.withHeadingColumn), this.initResize(e), n.addedCols++, this.scrollContainer && (this.scrollContainer.scrollLeft = this.scrollContainer.scrollWidth);
|
|
4244
4250
|
});
|
|
4245
4251
|
},
|
|
4246
4252
|
onDragRemoveCol: () => {
|
|
4247
4253
|
this.runTransactedStructuralOp(() => {
|
|
4248
4254
|
var t;
|
|
4249
4255
|
let r = this.grid.getColumnCount(e);
|
|
4250
|
-
if (r <= 1 || !
|
|
4256
|
+
if (r <= 1 || !Br(e, r - 1)) return;
|
|
4251
4257
|
let { blocksToDelete: i } = this.model.deleteColumn(r - 1);
|
|
4252
4258
|
(t = this.cellBlocks) == null || t.deleteBlocks(i), this.grid.deleteColumn(e, r - 1);
|
|
4253
4259
|
let a = this.model.colWidths;
|
|
4254
|
-
a &&
|
|
4260
|
+
a && Ir(e, a), this.initResize(e), n.addedCols--;
|
|
4255
4261
|
});
|
|
4256
4262
|
},
|
|
4257
4263
|
onDragEnd: () => {
|
|
@@ -4262,7 +4268,7 @@ var cr = (e) => {
|
|
|
4262
4268
|
}
|
|
4263
4269
|
initRowColControls(e) {
|
|
4264
4270
|
var t, n, r;
|
|
4265
|
-
(t = this.rowColControls) == null || t.destroy(), this.element && (this.rowColControls = new
|
|
4271
|
+
(t = this.rowColControls) == null || t.destroy(), this.element && (this.rowColControls = new zi({
|
|
4266
4272
|
grid: e,
|
|
4267
4273
|
overlay: (n = this.gripOverlay) == null ? void 0 : n,
|
|
4268
4274
|
scrollContainer: (r = this.scrollContainer) == null ? void 0 : r,
|
|
@@ -4310,7 +4316,7 @@ var cr = (e) => {
|
|
|
4310
4316
|
this.runTransactedStructuralOp(() => {
|
|
4311
4317
|
var r, i;
|
|
4312
4318
|
if (n !== this.setDataGeneration || this.gridElement !== e) return;
|
|
4313
|
-
let a = this.model.colWidths, { blocksToDelete: o } = this.syncModelForAction(t), s =
|
|
4319
|
+
let a = this.model.colWidths, { blocksToDelete: o } = this.syncModelForAction(t), s = pi(e, t, {
|
|
4314
4320
|
grid: this.grid,
|
|
4315
4321
|
data: {
|
|
4316
4322
|
colWidths: a,
|
|
@@ -4368,10 +4374,10 @@ var cr = (e) => {
|
|
|
4368
4374
|
initResize(e) {
|
|
4369
4375
|
var t, n;
|
|
4370
4376
|
(t = this.resize) == null || t.destroy();
|
|
4371
|
-
let r = this.model.colWidths === void 0, i = (n = this.model.colWidths) == null ?
|
|
4372
|
-
r ||
|
|
4377
|
+
let r = this.model.colWidths === void 0, i = (n = this.model.colWidths) == null ? j(e) : n;
|
|
4378
|
+
r || Qr(this.ensureScrollContainer()), this.resize = new oi(e, i, (e) => {
|
|
4373
4379
|
var t, n, r;
|
|
4374
|
-
this.model.setColWidths(e),
|
|
4380
|
+
this.model.setColWidths(e), Qr(this.ensureScrollContainer()), (t = this.rowColControls) == null || t.positionGrips(), (n = this.addControls) == null || n.syncRowButtonWidth(), (r = this.scrollHaze) == null || r.update();
|
|
4375
4381
|
}, () => {
|
|
4376
4382
|
var e;
|
|
4377
4383
|
(e = this.rowColControls) == null || e.hideAllGrips();
|
|
@@ -4382,7 +4388,7 @@ var cr = (e) => {
|
|
|
4382
4388
|
}
|
|
4383
4389
|
initCellBlocks(e) {
|
|
4384
4390
|
var t;
|
|
4385
|
-
this.cellBlocks = new
|
|
4391
|
+
this.cellBlocks = new hr({
|
|
4386
4392
|
api: this.api,
|
|
4387
4393
|
gridElement: e,
|
|
4388
4394
|
tableBlockId: (t = this.blockId) == null ? "" : t,
|
|
@@ -4393,13 +4399,13 @@ var cr = (e) => {
|
|
|
4393
4399
|
handleCellCopy(e, t) {
|
|
4394
4400
|
let n = this.collectCellBlockData(e);
|
|
4395
4401
|
if (n.length === 0) return;
|
|
4396
|
-
let r =
|
|
4397
|
-
t.setData("text/html",
|
|
4402
|
+
let r = Be(n);
|
|
4403
|
+
t.setData("text/html", st(r)), t.setData("text/plain", ge(r));
|
|
4398
4404
|
}
|
|
4399
4405
|
handleCellCopyViaButton(e) {
|
|
4400
4406
|
let t = this.collectCellBlockData(e);
|
|
4401
4407
|
if (t.length === 0) return;
|
|
4402
|
-
let n =
|
|
4408
|
+
let n = Be(t), r = st(n), i = ge(n), a = new Blob([r], { type: "text/html" }), o = new Blob([i], { type: "text/plain" });
|
|
4403
4409
|
navigator.clipboard.write([new ClipboardItem({
|
|
4404
4410
|
"text/html": a,
|
|
4405
4411
|
"text/plain": o
|
|
@@ -4409,7 +4415,7 @@ var cr = (e) => {
|
|
|
4409
4415
|
let r = this.gridElement;
|
|
4410
4416
|
r && this.runTransactedStructuralOp(() => {
|
|
4411
4417
|
for (let i of e) {
|
|
4412
|
-
let e =
|
|
4418
|
+
let e = Lr(r, i);
|
|
4413
4419
|
e && (n === "backgroundColor" ? (this.model.setCellColor(e.row, e.col, t == null ? void 0 : t), i.style.backgroundColor = t == null ? "" : t) : (this.model.setCellTextColor(e.row, e.col, t == null ? void 0 : t), i.style.color = t == null ? "" : t));
|
|
4414
4420
|
}
|
|
4415
4421
|
});
|
|
@@ -4417,12 +4423,12 @@ var cr = (e) => {
|
|
|
4417
4423
|
collectCellBlockData(e) {
|
|
4418
4424
|
let t = this.gridElement;
|
|
4419
4425
|
if (!t) return [];
|
|
4420
|
-
let n = Array.from(t.querySelectorAll(`[${
|
|
4426
|
+
let n = Array.from(t.querySelectorAll(`[${D}]`));
|
|
4421
4427
|
return e.map((e) => {
|
|
4422
4428
|
var t;
|
|
4423
|
-
let r = e.closest(`[${
|
|
4429
|
+
let r = e.closest(`[${D}]`);
|
|
4424
4430
|
if (!r) return null;
|
|
4425
|
-
let i = n.indexOf(r), a = Array.from(r.querySelectorAll(`[${
|
|
4431
|
+
let i = n.indexOf(r), a = Array.from(r.querySelectorAll(`[${O}]`)).indexOf(e), o = e.querySelector(`[${A}]`), s = [];
|
|
4426
4432
|
if (!o) return {
|
|
4427
4433
|
row: i,
|
|
4428
4434
|
col: a,
|
|
@@ -4434,7 +4440,7 @@ var cr = (e) => {
|
|
|
4434
4440
|
let n = this.api.blocks.getBlockIndex(t);
|
|
4435
4441
|
if (n === void 0) return;
|
|
4436
4442
|
let r = this.api.blocks.getBlockByIndex(n);
|
|
4437
|
-
r && s.push(
|
|
4443
|
+
r && s.push(S({
|
|
4438
4444
|
tool: r.name,
|
|
4439
4445
|
data: r.preservedData
|
|
4440
4446
|
}, Object.keys(r.preservedTunes).length > 0 ? { tunes: r.preservedTunes } : {}));
|
|
@@ -4445,7 +4451,7 @@ var cr = (e) => {
|
|
|
4445
4451
|
data: { text: c }
|
|
4446
4452
|
});
|
|
4447
4453
|
let l = this.model.getCellColor(i, a), u = this.model.getCellTextColor(i, a);
|
|
4448
|
-
return
|
|
4454
|
+
return S(S({
|
|
4449
4455
|
row: i,
|
|
4450
4456
|
col: a,
|
|
4451
4457
|
blocks: s
|
|
@@ -4456,7 +4462,7 @@ var cr = (e) => {
|
|
|
4456
4462
|
var t;
|
|
4457
4463
|
(t = this.cellSelection) == null || t.destroy();
|
|
4458
4464
|
let n = this.api.rectangleSelection;
|
|
4459
|
-
this.cellSelection = new
|
|
4465
|
+
this.cellSelection = new Fr({
|
|
4460
4466
|
grid: e,
|
|
4461
4467
|
rectangleSelection: n,
|
|
4462
4468
|
i18n: this.api.i18n,
|
|
@@ -4483,7 +4489,7 @@ var cr = (e) => {
|
|
|
4483
4489
|
t.deleteBlocks(n);
|
|
4484
4490
|
let r = this.gridElement;
|
|
4485
4491
|
if (r) for (let t of e) {
|
|
4486
|
-
let e =
|
|
4492
|
+
let e = Lr(r, t);
|
|
4487
4493
|
e && (this.model.setCellColor(e.row, e.col, void 0), this.model.setCellTextColor(e.row, e.col, void 0), t.style.backgroundColor = "", t.style.color = "");
|
|
4488
4494
|
}
|
|
4489
4495
|
});
|
|
@@ -4504,7 +4510,7 @@ var cr = (e) => {
|
|
|
4504
4510
|
}
|
|
4505
4511
|
initScrollHaze() {
|
|
4506
4512
|
var e;
|
|
4507
|
-
(e = this.scrollHaze) == null || e.destroy(), !(!this.element || !this.scrollContainer) && (this.scrollHaze = new
|
|
4513
|
+
(e = this.scrollHaze) == null || e.destroy(), !(!this.element || !this.scrollContainer) && (this.scrollHaze = new Ki(), this.scrollHaze.init(this.element, this.scrollContainer));
|
|
4508
4514
|
}
|
|
4509
4515
|
initGridPasteListener(e) {
|
|
4510
4516
|
e.addEventListener("paste", (t) => {
|
|
@@ -4513,21 +4519,21 @@ var cr = (e) => {
|
|
|
4513
4519
|
}
|
|
4514
4520
|
handleGridPaste(e, t) {
|
|
4515
4521
|
if (this.readOnly || !e.clipboardData || e.defaultPrevented) return;
|
|
4516
|
-
let n = e.clipboardData.getData("text/html"), r =
|
|
4522
|
+
let n = e.clipboardData.getData("text/html"), r = s(n), i = r === null ? ce(n) : null, a = r == null ? i : r;
|
|
4517
4523
|
if (!a || i !== null && new DOMParser().parseFromString(n, "text/html").querySelectorAll("table").length > 1) return;
|
|
4518
4524
|
let o = document.activeElement;
|
|
4519
4525
|
if (!o) return;
|
|
4520
|
-
let
|
|
4521
|
-
if (!
|
|
4522
|
-
let
|
|
4523
|
-
if (!
|
|
4526
|
+
let c = o.closest(`[${O}]`);
|
|
4527
|
+
if (!c || !t.contains(c)) return;
|
|
4528
|
+
let l = c.closest(`[${D}]`);
|
|
4529
|
+
if (!l) return;
|
|
4524
4530
|
if (a.rows === 1 && a.cols === 1) {
|
|
4525
4531
|
e.preventDefault(), e.stopPropagation(), this.insertSingleCellPayloadInline(a.cells[0][0]);
|
|
4526
4532
|
return;
|
|
4527
4533
|
}
|
|
4528
4534
|
e.preventDefault(), e.stopPropagation();
|
|
4529
|
-
let
|
|
4530
|
-
this.pastePayloadIntoCells(t, a,
|
|
4535
|
+
let u = Array.from(t.querySelectorAll(`[${D}]`)).indexOf(l), d = Array.from(l.querySelectorAll(`[${O}]`)).indexOf(c);
|
|
4536
|
+
this.pastePayloadIntoCells(t, a, u, d);
|
|
4531
4537
|
}
|
|
4532
4538
|
insertSingleCellPayloadInline(e) {
|
|
4533
4539
|
let t = e.blocks.map((e) => typeof e.data.text == "string" ? e.data.text : "").filter(Boolean).join("<br>");
|
|
@@ -4547,11 +4553,11 @@ var cr = (e) => {
|
|
|
4547
4553
|
this.runTransactedStructuralOp(() => {
|
|
4548
4554
|
var i, a;
|
|
4549
4555
|
this.expandGridForPaste(e, n + t.rows, r + t.cols);
|
|
4550
|
-
let o = e.querySelectorAll(`[${
|
|
4556
|
+
let o = e.querySelectorAll(`[${D}]`);
|
|
4551
4557
|
Array.from({ length: t.rows }, (e, t) => t).forEach((e) => {
|
|
4552
4558
|
let i = o[n + e];
|
|
4553
4559
|
if (!i) return;
|
|
4554
|
-
let a = i.querySelectorAll(`[${
|
|
4560
|
+
let a = i.querySelectorAll(`[${O}]`);
|
|
4555
4561
|
Array.from({ length: t.cols }, (e, t) => t).forEach((i) => {
|
|
4556
4562
|
let o = a[r + i];
|
|
4557
4563
|
if (o) {
|
|
@@ -4566,7 +4572,7 @@ var cr = (e) => {
|
|
|
4566
4572
|
});
|
|
4567
4573
|
}), this.initResize(e), (i = this.addControls) == null || i.syncRowButtonWidth(), (a = this.rowColControls) == null || a.refresh();
|
|
4568
4574
|
});
|
|
4569
|
-
let i = e.querySelectorAll(`[${
|
|
4575
|
+
let i = e.querySelectorAll(`[${D}]`)[n + t.rows - 1], a = i == null ? void 0 : i.querySelectorAll(`[${O}]`)[r + t.cols - 1];
|
|
4570
4576
|
if (!a || !this.cellBlocks || !this.api.caret) return;
|
|
4571
4577
|
let o = this.cellBlocks.getBlockIdsFromCells([a]), s = o[o.length - 1];
|
|
4572
4578
|
s !== void 0 && this.api.caret.setToBlock(s, "end");
|
|
@@ -4577,7 +4583,7 @@ var cr = (e) => {
|
|
|
4577
4583
|
this.grid.addRow(e), this.model.addRow(), N(e, this.cellBlocks), P(this.gridElement, this.model.withHeadings), I(this.gridElement, this.model.withHeadingColumn);
|
|
4578
4584
|
}), Array.from({ length: Math.max(0, n - i) }).forEach(() => {
|
|
4579
4585
|
var t;
|
|
4580
|
-
let n = (t = this.model.colWidths) == null ?
|
|
4586
|
+
let n = (t = this.model.colWidths) == null ? j(e) : t, r = this.model.initialColWidth === void 0 ? M(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
|
|
4581
4587
|
this.grid.addColumn(e, void 0, n, r), this.model.addColumn(void 0, r), this.model.setColWidths([...n, r]), N(e, this.cellBlocks), I(this.gridElement, this.model.withHeadingColumn);
|
|
4582
4588
|
});
|
|
4583
4589
|
}
|
|
@@ -4586,7 +4592,7 @@ var cr = (e) => {
|
|
|
4586
4592
|
let t = this.cellBlocks.getBlockIdsFromCells([e]);
|
|
4587
4593
|
this.cellBlocks.deleteBlocks(t);
|
|
4588
4594
|
}
|
|
4589
|
-
let n = e.querySelector(`[${
|
|
4595
|
+
let n = e.querySelector(`[${A}]`);
|
|
4590
4596
|
if (n) {
|
|
4591
4597
|
if (t.blocks.length === 0) {
|
|
4592
4598
|
var r;
|
|
@@ -4600,19 +4606,19 @@ var cr = (e) => {
|
|
|
4600
4606
|
}
|
|
4601
4607
|
}
|
|
4602
4608
|
}
|
|
4603
|
-
},
|
|
4609
|
+
}, Qi = (e) => {
|
|
4604
4610
|
let t = document.createElement("div");
|
|
4605
4611
|
t.innerHTML = e.trim();
|
|
4606
4612
|
let n = document.createDocumentFragment();
|
|
4607
4613
|
return n.append(...Array.from(t.childNodes)), n;
|
|
4608
|
-
},
|
|
4614
|
+
}, $i = (e, t, n, r) => {
|
|
4609
4615
|
if (!t) return e;
|
|
4610
4616
|
let i = n();
|
|
4611
4617
|
return {
|
|
4612
|
-
text: i ?
|
|
4618
|
+
text: i ? dt(i.innerHTML) : e.text,
|
|
4613
4619
|
isOpen: r
|
|
4614
4620
|
};
|
|
4615
|
-
},
|
|
4621
|
+
}, ea = (e, t) => {
|
|
4616
4622
|
let { data: n, getContentElement: r } = e;
|
|
4617
4623
|
n.text += t.text;
|
|
4618
4624
|
let i = r();
|
|
@@ -4620,23 +4626,23 @@ var cr = (e) => {
|
|
|
4620
4626
|
let n = e.parseHTML(t.text);
|
|
4621
4627
|
i.appendChild(n), i.normalize();
|
|
4622
4628
|
}
|
|
4623
|
-
},
|
|
4629
|
+
}, ta = (e, t, n) => {
|
|
4624
4630
|
let r = n();
|
|
4625
4631
|
if (!r) return {
|
|
4626
4632
|
newData: e,
|
|
4627
4633
|
inPlace: !1
|
|
4628
4634
|
};
|
|
4629
|
-
let i =
|
|
4635
|
+
let i = S(S({}, e), t);
|
|
4630
4636
|
return typeof t.text == "string" && (r.innerHTML = t.text), {
|
|
4631
4637
|
newData: i,
|
|
4632
4638
|
inPlace: !0
|
|
4633
4639
|
};
|
|
4634
|
-
},
|
|
4640
|
+
}, na = class e {
|
|
4635
4641
|
constructor({ data: e, config: t, api: n, readOnly: r, block: i }) {
|
|
4636
4642
|
var a;
|
|
4637
4643
|
this._element = null, this._contentElement = null, this._arrowElement = null, this._bodyPlaceholderElement = null, this._childContainerElement = null, this.handleBlockChanged = (e) => {
|
|
4638
4644
|
this.isBlockChangedPayload(e) && (e.event.type === "block-removed" || e.event.type === "block-added") && this.updateBodyPlaceholderVisibility();
|
|
4639
|
-
}, this.api = n, this.readOnly = r, this._settings = t || {}, this._data = this.normalizeData(e), this._isOpen = (a = this._data.isOpen) == null ? !
|
|
4645
|
+
}, this.api = n, this.readOnly = r, this._settings = t || {}, this._data = this.normalizeData(e), this._isOpen = (a = this._data.isOpen) == null ? !0 : a, i && (this.blockId = i.id), r || this.api.events.on("block changed", this.handleBlockChanged);
|
|
4640
4646
|
}
|
|
4641
4647
|
normalizeData(e) {
|
|
4642
4648
|
if (typeof e == "object" && e && "text" in e) {
|
|
@@ -4651,11 +4657,11 @@ var cr = (e) => {
|
|
|
4651
4657
|
}
|
|
4652
4658
|
get placeholder() {
|
|
4653
4659
|
if (this._settings.placeholder) return this._settings.placeholder;
|
|
4654
|
-
let e = this.api.i18n.t(
|
|
4660
|
+
let e = this.api.i18n.t(Ve);
|
|
4655
4661
|
return e === "tools.toggle.placeholder" ? "Toggle" : e;
|
|
4656
4662
|
}
|
|
4657
4663
|
render() {
|
|
4658
|
-
let e =
|
|
4664
|
+
let e = Et({
|
|
4659
4665
|
data: this._data,
|
|
4660
4666
|
readOnly: this.readOnly,
|
|
4661
4667
|
isOpen: this._isOpen,
|
|
@@ -4663,10 +4669,10 @@ var cr = (e) => {
|
|
|
4663
4669
|
keydownHandler: this.readOnly ? null : this.handleKeyDown.bind(this),
|
|
4664
4670
|
onArrowClick: () => this.toggleOpen(),
|
|
4665
4671
|
onBodyPlaceholderClick: this.readOnly ? null : () => this.handleBodyPlaceholderClick(),
|
|
4666
|
-
bodyPlaceholderText: this.api.i18n.t(
|
|
4672
|
+
bodyPlaceholderText: this.api.i18n.t(qe),
|
|
4667
4673
|
ariaLabels: {
|
|
4668
|
-
collapse: this.api.i18n.t(
|
|
4669
|
-
expand: this.api.i18n.t(
|
|
4674
|
+
collapse: this.api.i18n.t(nt),
|
|
4675
|
+
expand: this.api.i18n.t(Ge)
|
|
4670
4676
|
}
|
|
4671
4677
|
});
|
|
4672
4678
|
return this._element = e.wrapper, this._contentElement = e.contentElement, this._arrowElement = e.arrowElement, this._bodyPlaceholderElement = e.bodyPlaceholderElement, this._childContainerElement = e.childContainerElement, this._element;
|
|
@@ -4675,31 +4681,31 @@ var cr = (e) => {
|
|
|
4675
4681
|
this.updateChildrenVisibility(), this.updateBodyPlaceholderVisibility();
|
|
4676
4682
|
}
|
|
4677
4683
|
save() {
|
|
4678
|
-
return
|
|
4684
|
+
return $i(this._data, this._element, this.getContentElement.bind(this), this._isOpen);
|
|
4679
4685
|
}
|
|
4680
4686
|
validate(e) {
|
|
4681
4687
|
return !0;
|
|
4682
4688
|
}
|
|
4683
4689
|
merge(e) {
|
|
4684
|
-
|
|
4690
|
+
ea({
|
|
4685
4691
|
data: this._data,
|
|
4686
4692
|
getContentElement: this.getContentElement.bind(this),
|
|
4687
|
-
parseHTML:
|
|
4693
|
+
parseHTML: Qi
|
|
4688
4694
|
}, e);
|
|
4689
4695
|
}
|
|
4690
4696
|
onPaste(t) {
|
|
4691
4697
|
let n = t.detail;
|
|
4692
4698
|
if (!("data" in n)) return;
|
|
4693
|
-
let r = n.data, i = r.querySelector("summary"), a =
|
|
4699
|
+
let r = n.data, i = r.querySelector("summary"), a = p(i === null ? r.innerHTML : i.innerHTML, e.sanitize.text);
|
|
4694
4700
|
this._data = { text: a };
|
|
4695
4701
|
let o = this.getContentElement();
|
|
4696
4702
|
o !== null && (o.innerHTML = a);
|
|
4697
4703
|
}
|
|
4698
4704
|
setData(e) {
|
|
4699
|
-
let t =
|
|
4700
|
-
return this._data = t.newData, typeof this._data.isOpen == "boolean" && (this._isOpen = this._data.isOpen), this._arrowElement && this._element &&
|
|
4701
|
-
collapse: this.api.i18n.t(
|
|
4702
|
-
expand: this.api.i18n.t(
|
|
4705
|
+
let t = ta(this._data, e, this.getContentElement.bind(this));
|
|
4706
|
+
return this._data = t.newData, typeof this._data.isOpen == "boolean" && (this._isOpen = this._data.isOpen), this._arrowElement && this._element && T(this._arrowElement, this._element, this._isOpen, {
|
|
4707
|
+
collapse: this.api.i18n.t(nt),
|
|
4708
|
+
expand: this.api.i18n.t(Ge)
|
|
4703
4709
|
}), this.updateChildrenVisibility(), this.updateBodyPlaceholderVisibility(), t.inPlace;
|
|
4704
4710
|
}
|
|
4705
4711
|
renderSettings() {
|
|
@@ -4721,19 +4727,19 @@ var cr = (e) => {
|
|
|
4721
4727
|
return this._contentElement;
|
|
4722
4728
|
}
|
|
4723
4729
|
setOpenState(e) {
|
|
4724
|
-
this._isOpen = e, this._arrowElement && this._element &&
|
|
4725
|
-
collapse: this.api.i18n.t(
|
|
4726
|
-
expand: this.api.i18n.t(
|
|
4730
|
+
this._isOpen = e, this._arrowElement && this._element && T(this._arrowElement, this._element, this._isOpen, {
|
|
4731
|
+
collapse: this.api.i18n.t(nt),
|
|
4732
|
+
expand: this.api.i18n.t(Ge)
|
|
4727
4733
|
}), this.updateChildrenVisibility(), this.updateBodyPlaceholderVisibility();
|
|
4728
4734
|
}
|
|
4729
4735
|
toggleOpen() {
|
|
4730
4736
|
this.setOpenState(!this._isOpen);
|
|
4731
4737
|
}
|
|
4732
4738
|
updateChildrenVisibility() {
|
|
4733
|
-
this.blockId !== void 0 &&
|
|
4739
|
+
this.blockId !== void 0 && Dt(this.api, this.blockId, this._isOpen, this._childContainerElement, this._arrowElement);
|
|
4734
4740
|
}
|
|
4735
4741
|
updateBodyPlaceholderVisibility() {
|
|
4736
|
-
this.blockId !== void 0 &&
|
|
4742
|
+
this.blockId !== void 0 && Ot(this._bodyPlaceholderElement, this.api, this.blockId, this._isOpen, this.readOnly);
|
|
4737
4743
|
}
|
|
4738
4744
|
handleBodyPlaceholderClick() {
|
|
4739
4745
|
var e;
|
|
@@ -4769,10 +4775,10 @@ var cr = (e) => {
|
|
|
4769
4775
|
}
|
|
4770
4776
|
async handleEnter() {
|
|
4771
4777
|
var e = this;
|
|
4772
|
-
await
|
|
4778
|
+
await kt(e.createKeyboardContext()), e.updateBodyPlaceholderVisibility();
|
|
4773
4779
|
}
|
|
4774
4780
|
async handleBackspace(e) {
|
|
4775
|
-
await
|
|
4781
|
+
await At(this.createKeyboardContext(), e);
|
|
4776
4782
|
}
|
|
4777
4783
|
syncContentFromDOM() {
|
|
4778
4784
|
let e = this.getContentElement();
|
|
@@ -4780,10 +4786,10 @@ var cr = (e) => {
|
|
|
4780
4786
|
}
|
|
4781
4787
|
static get toolbox() {
|
|
4782
4788
|
return {
|
|
4783
|
-
icon:
|
|
4789
|
+
icon: lt,
|
|
4784
4790
|
title: "Toggle list",
|
|
4785
4791
|
titleKey: "toggleList",
|
|
4786
|
-
name:
|
|
4792
|
+
name: Ye,
|
|
4787
4793
|
searchTerms: [
|
|
4788
4794
|
"toggle",
|
|
4789
4795
|
"collapse",
|
|
@@ -4822,31 +4828,680 @@ var cr = (e) => {
|
|
|
4822
4828
|
static get isReadOnlySupported() {
|
|
4823
4829
|
return !0;
|
|
4824
4830
|
}
|
|
4831
|
+
}, ra = "callout", ia = "tools.callout.color", aa = "tools.callout.editIcon", oa = "tools.callout.addEmoji", sa = "tools.callout.removeEmoji", ca = "tools.callout.filterEmojis", la = "tools.callout.calloutEmojiCategory", ua = "tools.callout.noEmojisFound", da = "tools.callout.pickRandom", fa = "tools.callout.skinTone", pa = "tools.callout.emojiCategoryPeople", ma = "tools.callout.emojiCategoryNature", ha = "tools.callout.emojiCategoryFood", ga = "tools.callout.emojiCategoryActivity", _a = "tools.callout.emojiCategoryTravel", va = "tools.callout.emojiCategoryObjects", ya = "tools.callout.emojiCategorySymbols", ba = "tools.callout.emojiCategoryFlags", xa = "💡", Sa = "rounded-xl px-4 py-[5px] my-1 flex items-start gap-2", Ca = "text-[1.25rem] cursor-pointer bg-transparent border-0 px-0 py-[7px] flex-shrink-0 select-none", wa = "flex-1 min-w-0";
|
|
4832
|
+
//#endregion
|
|
4833
|
+
//#region src/tools/callout/dom-builder.ts
|
|
4834
|
+
function Ta(e) {
|
|
4835
|
+
let { emoji: t, readOnly: n, addEmojiLabel: r } = e, i = document.createElement("div");
|
|
4836
|
+
i.className = Sa;
|
|
4837
|
+
let a = document.createElement("button");
|
|
4838
|
+
a.type = "button", a.className = Ca, a.textContent = t || "", a.setAttribute("aria-label", t === "" ? r : t), a.setAttribute("tabindex", "0"), a.setAttribute("data-blok-testid", "callout-emoji-btn"), n && (a.disabled = !0);
|
|
4839
|
+
let o = document.createElement("div");
|
|
4840
|
+
return o.className = wa, o.setAttribute(x.toggleChildren, ""), o.setAttribute("data-blok-child-toolbar", ""), o.setAttribute("data-blok-mutation-free", "true"), i.appendChild(a), i.appendChild(o), {
|
|
4841
|
+
wrapper: i,
|
|
4842
|
+
emojiButton: a,
|
|
4843
|
+
childContainer: o
|
|
4844
|
+
};
|
|
4845
|
+
}
|
|
4846
|
+
//#endregion
|
|
4847
|
+
//#region src/tools/callout/block-operations.ts
|
|
4848
|
+
function Ea(e) {
|
|
4849
|
+
return {
|
|
4850
|
+
emoji: e.emoji,
|
|
4851
|
+
textColor: e.textColor,
|
|
4852
|
+
backgroundColor: e.backgroundColor
|
|
4853
|
+
};
|
|
4854
|
+
}
|
|
4855
|
+
//#endregion
|
|
4856
|
+
//#region src/tools/callout/callout-keyboard.ts
|
|
4857
|
+
async function Da(e) {
|
|
4858
|
+
if (e.calloutBlockId === void 0) return;
|
|
4859
|
+
let t = e.api.blocks.getChildren(e.calloutBlockId);
|
|
4860
|
+
if (e.event.preventDefault(), t.length <= 1) {
|
|
4861
|
+
await e.api.blocks.convert(e.calloutBlockId, "paragraph");
|
|
4862
|
+
return;
|
|
4863
|
+
}
|
|
4864
|
+
let n = e.api.blocks.getBlockIndex(e.firstChildBlockId);
|
|
4865
|
+
n !== void 0 && await e.api.blocks.delete(n);
|
|
4866
|
+
let r = e.api.blocks.getBlockIndex(e.calloutBlockId);
|
|
4867
|
+
r !== void 0 && r > 0 && e.api.caret.setToBlock(r - 1, "end");
|
|
4868
|
+
}
|
|
4869
|
+
//#endregion
|
|
4870
|
+
//#region src/tools/callout/emoji-picker/emoji-data.ts
|
|
4871
|
+
var Oa = [
|
|
4872
|
+
"💡",
|
|
4873
|
+
"👉",
|
|
4874
|
+
"☝️",
|
|
4875
|
+
"✅",
|
|
4876
|
+
"⚠️",
|
|
4877
|
+
"🔑",
|
|
4878
|
+
"🔥",
|
|
4879
|
+
"📌",
|
|
4880
|
+
"✂️",
|
|
4881
|
+
"❓",
|
|
4882
|
+
"🚫",
|
|
4883
|
+
"⏰",
|
|
4884
|
+
"♻️",
|
|
4885
|
+
"🔒",
|
|
4886
|
+
"📖",
|
|
4887
|
+
"👣",
|
|
4888
|
+
"➡️",
|
|
4889
|
+
"📢",
|
|
4890
|
+
"🛠️",
|
|
4891
|
+
"⚙️"
|
|
4892
|
+
], ka = { data: null };
|
|
4893
|
+
function Aa(e, t) {
|
|
4894
|
+
let n = [];
|
|
4895
|
+
for (let r of e.emojis) {
|
|
4896
|
+
let i = t[r];
|
|
4897
|
+
if (i === void 0) continue;
|
|
4898
|
+
let a = i.skins[0];
|
|
4899
|
+
a !== void 0 && n.push({
|
|
4900
|
+
native: a.native,
|
|
4901
|
+
skins: i.skins.map((e) => e.native),
|
|
4902
|
+
id: i.id,
|
|
4903
|
+
name: i.name,
|
|
4904
|
+
keywords: i.keywords,
|
|
4905
|
+
category: e.id
|
|
4906
|
+
});
|
|
4907
|
+
}
|
|
4908
|
+
return n;
|
|
4909
|
+
}
|
|
4910
|
+
async function ja() {
|
|
4911
|
+
if (ka.data !== null) return ka.data;
|
|
4912
|
+
let e = await import("./native-BPcABu9z.mjs"), t = "default" in e && e.default !== void 0 ? e.default : e, n = t.categories.flatMap((e) => Aa(e, t.emojis));
|
|
4913
|
+
return ka.data = n, n;
|
|
4914
|
+
}
|
|
4915
|
+
function Ma(e, t, n) {
|
|
4916
|
+
let r = t.toLowerCase();
|
|
4917
|
+
return e.filter((e) => {
|
|
4918
|
+
if (e.name.toLowerCase().includes(r) || e.keywords.some((e) => e.includes(r))) return !0;
|
|
4919
|
+
let t = n == null ? void 0 : n[e.native];
|
|
4920
|
+
return t === void 0 ? !1 : t.n.toLowerCase().includes(r) || t.k !== void 0 && t.k.some((e) => e.toLowerCase().includes(r));
|
|
4921
|
+
});
|
|
4922
|
+
}
|
|
4923
|
+
function Na(e) {
|
|
4924
|
+
let t = /* @__PURE__ */ new Map();
|
|
4925
|
+
for (let r of e) {
|
|
4926
|
+
var n;
|
|
4927
|
+
let e = (n = t.get(r.category)) == null ? [] : n;
|
|
4928
|
+
e.push(r), t.set(r.category, e);
|
|
4929
|
+
}
|
|
4930
|
+
return t;
|
|
4931
|
+
}
|
|
4932
|
+
//#endregion
|
|
4933
|
+
//#region src/tools/callout/emoji-picker/emoji-locale.ts
|
|
4934
|
+
var Pa = /* @__PURE__ */ new Map(), Fa = {
|
|
4935
|
+
am: () => import("./am-CHDDMHkd.mjs"),
|
|
4936
|
+
ar: () => import("./ar-DoqfNqut.mjs"),
|
|
4937
|
+
az: () => import("./az-C34P9iEa.mjs"),
|
|
4938
|
+
bg: () => import("./bg-jroXLY8Y.mjs"),
|
|
4939
|
+
bn: () => import("./bn-BRI-WqxY.mjs"),
|
|
4940
|
+
bs: () => import("./bs-CCGUpNHu.mjs"),
|
|
4941
|
+
cs: () => import("./cs-D5qZOGuc.mjs"),
|
|
4942
|
+
da: () => import("./da-DrJ7W37K.mjs"),
|
|
4943
|
+
de: () => import("./de-BW6-kp2c.mjs"),
|
|
4944
|
+
el: () => import("./el-C-Vc_Otu.mjs"),
|
|
4945
|
+
es: () => import("./es-B6fI5K9i.mjs"),
|
|
4946
|
+
et: () => import("./et-BhVlZ-Yz.mjs"),
|
|
4947
|
+
fa: () => import("./fa-D55Ijdqa.mjs"),
|
|
4948
|
+
fi: () => import("./fi-jNLjhKUQ.mjs"),
|
|
4949
|
+
fil: () => import("./fil-DYd0T5aX.mjs"),
|
|
4950
|
+
fr: () => import("./fr-yxy5xWw_.mjs"),
|
|
4951
|
+
gu: () => import("./gu-CcY_LJe7.mjs"),
|
|
4952
|
+
he: () => import("./he-DL9s7wNw.mjs"),
|
|
4953
|
+
hi: () => import("./hi-C8eGXgw5.mjs"),
|
|
4954
|
+
hr: () => import("./hr-DLpybOhU.mjs"),
|
|
4955
|
+
hu: () => import("./hu-BkT0gT00.mjs"),
|
|
4956
|
+
hy: () => import("./hy-CVFDCp2S.mjs"),
|
|
4957
|
+
id: () => import("./id-0P4W9Az0.mjs"),
|
|
4958
|
+
it: () => import("./it-mLY6_uoW.mjs"),
|
|
4959
|
+
ja: () => import("./ja-7RkeRNWG.mjs"),
|
|
4960
|
+
ka: () => import("./ka-C7Lx-Qsh.mjs"),
|
|
4961
|
+
km: () => import("./km-Q8udaraH.mjs"),
|
|
4962
|
+
kn: () => import("./kn-BiETM-iq.mjs"),
|
|
4963
|
+
ko: () => import("./ko-tiB80pF1.mjs"),
|
|
4964
|
+
ku: () => import("./ku-CY-OABkR.mjs"),
|
|
4965
|
+
lo: () => import("./lo-CTBhEnyk.mjs"),
|
|
4966
|
+
lt: () => import("./lt-BHKHEtqK.mjs"),
|
|
4967
|
+
lv: () => import("./lv-DWxgtfUg.mjs"),
|
|
4968
|
+
mk: () => import("./mk-BjookGdx.mjs"),
|
|
4969
|
+
ml: () => import("./ml-L-NnZcp9.mjs"),
|
|
4970
|
+
mn: () => import("./mn-OMWi7Hl_.mjs"),
|
|
4971
|
+
mr: () => import("./mr-B6JPzITo.mjs"),
|
|
4972
|
+
ms: () => import("./ms-CG3S-sPB.mjs"),
|
|
4973
|
+
my: () => import("./my-BLAmGfhT.mjs"),
|
|
4974
|
+
ne: () => import("./ne-D1JHLfYw.mjs"),
|
|
4975
|
+
nl: () => import("./nl-Ca7Q8FnY.mjs"),
|
|
4976
|
+
no: () => import("./no-Coxcohcz.mjs"),
|
|
4977
|
+
pa: () => import("./pa-CCaXqpaI.mjs"),
|
|
4978
|
+
pl: () => import("./pl-Cl_fAZ84.mjs"),
|
|
4979
|
+
ps: () => import("./ps-WD5qGAWy.mjs"),
|
|
4980
|
+
pt: () => import("./pt-C4zvLfvq.mjs"),
|
|
4981
|
+
ro: () => import("./ro-DbefHcmM.mjs"),
|
|
4982
|
+
ru: () => import("./ru-uU1J14jd.mjs"),
|
|
4983
|
+
sd: () => import("./sd-DKu368Ip.mjs"),
|
|
4984
|
+
si: () => import("./si-BsJCiPkZ.mjs"),
|
|
4985
|
+
sk: () => import("./sk-CD-a3SN6.mjs"),
|
|
4986
|
+
sl: () => import("./sl-CXhrPJe_.mjs"),
|
|
4987
|
+
sq: () => import("./sq-CTctCoFQ.mjs"),
|
|
4988
|
+
sr: () => import("./sr-BZkhBwXj.mjs"),
|
|
4989
|
+
sv: () => import("./sv-NmRZb_xi.mjs"),
|
|
4990
|
+
sw: () => import("./sw-Be5ik3H6.mjs"),
|
|
4991
|
+
ta: () => import("./ta-DsXh6neL.mjs"),
|
|
4992
|
+
te: () => import("./te-CwpCbM8M.mjs"),
|
|
4993
|
+
th: () => import("./th-CcZ15OLk.mjs"),
|
|
4994
|
+
tr: () => import("./tr-q3bTgvhW.mjs"),
|
|
4995
|
+
ug: () => import("./ug-919EhLsL.mjs"),
|
|
4996
|
+
uk: () => import("./uk-aNMEzd0Y.mjs"),
|
|
4997
|
+
ur: () => import("./ur-BwQI77sh.mjs"),
|
|
4998
|
+
vi: () => import("./vi-Dxq806-F.mjs"),
|
|
4999
|
+
zh: () => import("./zh-BcHuy1Ti.mjs")
|
|
5000
|
+
};
|
|
5001
|
+
async function Ia(e) {
|
|
5002
|
+
if (e === "en") return null;
|
|
5003
|
+
let t = Pa.get(e);
|
|
5004
|
+
if (t !== void 0) return t;
|
|
5005
|
+
let n = Fa[e];
|
|
5006
|
+
if (n === void 0) return null;
|
|
5007
|
+
try {
|
|
5008
|
+
let t = (await n()).default;
|
|
5009
|
+
return Pa.set(e, t), t;
|
|
5010
|
+
} catch (e) {
|
|
5011
|
+
return null;
|
|
5012
|
+
}
|
|
5013
|
+
}
|
|
5014
|
+
//#endregion
|
|
5015
|
+
//#region src/tools/callout/emoji-picker/index.ts
|
|
5016
|
+
var La = {
|
|
5017
|
+
callout: la,
|
|
5018
|
+
people: pa,
|
|
5019
|
+
nature: ma,
|
|
5020
|
+
foods: ha,
|
|
5021
|
+
activity: ga,
|
|
5022
|
+
places: _a,
|
|
5023
|
+
objects: va,
|
|
5024
|
+
symbols: ya,
|
|
5025
|
+
flags: ba
|
|
5026
|
+
}, Ra = [
|
|
5027
|
+
["callout", ut],
|
|
5028
|
+
["people", ne],
|
|
5029
|
+
["nature", pe],
|
|
5030
|
+
["foods", i],
|
|
5031
|
+
["activity", re],
|
|
5032
|
+
["places", le],
|
|
5033
|
+
["objects", g],
|
|
5034
|
+
["symbols", l],
|
|
5035
|
+
["flags", ae]
|
|
5036
|
+
], za = [
|
|
5037
|
+
"✋",
|
|
5038
|
+
"✋🏻",
|
|
5039
|
+
"✋🏼",
|
|
5040
|
+
"✋🏽",
|
|
5041
|
+
"✋🏾",
|
|
5042
|
+
"✋🏿"
|
|
5043
|
+
], Ba = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><rect x=\"1.5\" y=\"1.5\" width=\"11\" height=\"11\" rx=\"2\" stroke=\"currentColor\" stroke-width=\"1.2\"/><circle cx=\"4.5\" cy=\"4.5\" r=\".9\" fill=\"currentColor\"/><circle cx=\"7\" cy=\"7\" r=\".9\" fill=\"currentColor\"/><circle cx=\"9.5\" cy=\"9.5\" r=\".9\" fill=\"currentColor\"/></svg>", Va = class {
|
|
5044
|
+
constructor(e) {
|
|
5045
|
+
this._localeData = null, this._open = !1, this._allEmojis = [], this._skinTone = 0, this._showingEmptyState = !1, this._anchorEl = null, this._backdrop = null, this._savedOverflow = "", this._navButtons = /* @__PURE__ */ new Map(), this._sectionEls = /* @__PURE__ */ new Map(), this._activeNavId = "", this._navRafId = 0, this._skinToneButtons = [], this.onSelect = e.onSelect, this.onRemove = e.onRemove, this.i18n = e.i18n, this._locale = e.locale, this._element = this.buildElement();
|
|
5046
|
+
let t = this._element.querySelector("[data-emoji-picker-body]"), n = this._element.querySelector("[data-emoji-picker-nav]"), r = this._element.querySelector("input[type=\"text\"]");
|
|
5047
|
+
if (t === null || n === null || r === null) throw Error("EmojiPicker: failed to build required elements");
|
|
5048
|
+
this._body = t, this._nav = n, this._filterInput = r, this._body.addEventListener("scroll", () => {
|
|
5049
|
+
cancelAnimationFrame(this._navRafId), this._navRafId = requestAnimationFrame(() => this.updateActiveNav());
|
|
5050
|
+
}, { passive: !0 });
|
|
5051
|
+
}
|
|
5052
|
+
getElement() {
|
|
5053
|
+
return this._element;
|
|
5054
|
+
}
|
|
5055
|
+
isOpen() {
|
|
5056
|
+
return this._open;
|
|
5057
|
+
}
|
|
5058
|
+
async open(e) {
|
|
5059
|
+
var t = this;
|
|
5060
|
+
if (t._anchorEl = e, t._open = !0, t._filterInput.value = "", t._element.setAttribute("data-theme", t.resolveTheme()), t._allEmojis.length === 0 && (t._allEmojis = await ja()), t._locale !== "en" && t._localeData === null) {
|
|
5061
|
+
let e = await Ia(t._locale);
|
|
5062
|
+
e !== null && (t._localeData = e);
|
|
5063
|
+
}
|
|
5064
|
+
t.renderEmojiGrid(t._allEmojis), t.showBackdrop(), t._element.style.animation = "none", t._element.hidden = !1, t.position(e), t._element.offsetHeight, t._element.style.animation = "", t._filterInput.focus();
|
|
5065
|
+
}
|
|
5066
|
+
close() {
|
|
5067
|
+
var e;
|
|
5068
|
+
this._open = !1, this._element.hidden = !0, this.closeSkinTonePopover(), this.removeBackdrop(), (e = this._anchorEl) == null || e.focus();
|
|
5069
|
+
}
|
|
5070
|
+
buildElement() {
|
|
5071
|
+
let e = document.createElement("div");
|
|
5072
|
+
e.setAttribute("data-blok-emoji-picker", ""), e.className = [
|
|
5073
|
+
"fixed z-50 w-[400px] overflow-hidden rounded-xl",
|
|
5074
|
+
"border border-neutral-200/70 bg-white shadow-2xl",
|
|
5075
|
+
"theme-dark:border-neutral-700/50 theme-dark:bg-neutral-900"
|
|
5076
|
+
].join(" "), e.hidden = !0;
|
|
5077
|
+
let t = document.createElement("div");
|
|
5078
|
+
t.className = "flex items-center gap-2.5 px-3 pt-3 pb-2";
|
|
5079
|
+
let n = document.createElement("div");
|
|
5080
|
+
n.className = "relative flex-1 min-w-0";
|
|
5081
|
+
let r = document.createElement("span");
|
|
5082
|
+
r.className = ["pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 flex items-center", "text-neutral-400 theme-dark:text-neutral-500 [&>svg]:w-[16px] [&>svg]:h-[16px]"].join(" "), r.innerHTML = je;
|
|
5083
|
+
let i = document.createElement("input");
|
|
5084
|
+
i.type = "text", i.placeholder = this.i18n.t(ca), i.className = [
|
|
5085
|
+
"w-full text-[13px] rounded-lg py-[7px] pl-8 pr-3 outline-hidden",
|
|
5086
|
+
"bg-neutral-100 text-neutral-800 placeholder:text-neutral-400",
|
|
5087
|
+
"theme-dark:bg-neutral-800 theme-dark:text-neutral-200 theme-dark:placeholder:text-neutral-500",
|
|
5088
|
+
"focus:ring-2 focus:ring-neutral-300/60 theme-dark:focus:ring-neutral-600/60",
|
|
5089
|
+
"transition-shadow duration-150"
|
|
5090
|
+
].join(" "), i.addEventListener("input", () => this.handleFilterChange(i.value)), n.appendChild(r), n.appendChild(i);
|
|
5091
|
+
let a = document.createElement("div");
|
|
5092
|
+
a.className = "relative flex-shrink-0";
|
|
5093
|
+
let o = document.createElement("button");
|
|
5094
|
+
o.type = "button", o.setAttribute("data-emoji-picker-skin-toggle", ""), o.setAttribute("aria-label", this.i18n.t(fa)), o.title = this.i18n.t(fa), o.className = [
|
|
5095
|
+
"w-[28px] h-[28px] flex items-center justify-center rounded-lg",
|
|
5096
|
+
"text-[14px] leading-none cursor-pointer select-none",
|
|
5097
|
+
"hover:bg-neutral-100 theme-dark:hover:bg-neutral-800",
|
|
5098
|
+
"active:scale-90 transition-all duration-100"
|
|
5099
|
+
].join(" "), o.textContent = za[this._skinTone], o.addEventListener("click", () => this.toggleSkinTonePopover()), this._skinToneToggle = o, a.appendChild(o), this._skinTonePopover = this.buildSkinTonePopover(), a.appendChild(this._skinTonePopover);
|
|
5100
|
+
let s = document.createElement("button");
|
|
5101
|
+
s.type = "button", s.setAttribute("data-emoji-picker-random", ""), s.setAttribute("aria-label", this.i18n.t(da)), s.title = this.i18n.t(da), s.className = [
|
|
5102
|
+
"flex-shrink-0 w-[34px] h-[34px] flex items-center justify-center rounded-lg",
|
|
5103
|
+
"text-neutral-400 hover:bg-neutral-100 hover:text-neutral-600",
|
|
5104
|
+
"theme-dark:hover:bg-neutral-800 theme-dark:hover:text-neutral-300",
|
|
5105
|
+
"transition-colors duration-100 cursor-pointer"
|
|
5106
|
+
].join(" "), s.innerHTML = Ba, s.addEventListener("click", () => this.pickRandom()), v(s, this.i18n.t(da), { placement: "bottom" });
|
|
5107
|
+
let c = document.createElement("button");
|
|
5108
|
+
c.type = "button", c.setAttribute("data-emoji-picker-remove", ""), c.setAttribute("aria-label", this.i18n.t(sa)), c.title = this.i18n.t(sa), c.className = [
|
|
5109
|
+
"flex-shrink-0 w-[34px] h-[34px] flex items-center justify-center rounded-lg",
|
|
5110
|
+
"text-neutral-400 hover:bg-neutral-100 hover:text-neutral-600",
|
|
5111
|
+
"theme-dark:hover:bg-neutral-800 theme-dark:hover:text-neutral-300",
|
|
5112
|
+
"transition-colors duration-100 cursor-pointer"
|
|
5113
|
+
].join(" "), c.innerHTML = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><path d=\"M3.5 3.5l7 7M10.5 3.5l-7 7\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"/></svg>", c.addEventListener("click", () => {
|
|
5114
|
+
this.onRemove(), this.close();
|
|
5115
|
+
}), v(c, this.i18n.t(sa), { placement: "bottom" });
|
|
5116
|
+
let l = document.createElement("div");
|
|
5117
|
+
l.className = "flex items-center gap-1", l.appendChild(s), l.appendChild(c), t.appendChild(n), t.appendChild(a), t.appendChild(l), e.appendChild(t);
|
|
5118
|
+
let u = document.createElement("div");
|
|
5119
|
+
u.setAttribute("data-emoji-picker-body", ""), u.className = "overflow-y-auto max-h-[260px] px-1.5 pb-2", e.appendChild(u);
|
|
5120
|
+
let d = document.createElement("div");
|
|
5121
|
+
return d.setAttribute("data-emoji-picker-nav", ""), d.className = ["flex items-center gap-1 px-2 pt-1 pb-1", "border-t border-neutral-100 theme-dark:border-neutral-800"].join(" "), e.appendChild(d), e.addEventListener("mousedown", (e) => {
|
|
5122
|
+
let t = e.target;
|
|
5123
|
+
!this._skinTonePopover.hidden && !this._skinTonePopover.contains(t) && !this._skinToneToggle.contains(t) && this.closeSkinTonePopover();
|
|
5124
|
+
}), e.addEventListener("keydown", (e) => {
|
|
5125
|
+
if (e.key === "Escape") {
|
|
5126
|
+
if (!this._skinTonePopover.hidden) {
|
|
5127
|
+
this.closeSkinTonePopover();
|
|
5128
|
+
return;
|
|
5129
|
+
}
|
|
5130
|
+
this.close();
|
|
5131
|
+
}
|
|
5132
|
+
}), e;
|
|
5133
|
+
}
|
|
5134
|
+
buildSkinTonePopover() {
|
|
5135
|
+
let e = document.createElement("div");
|
|
5136
|
+
e.setAttribute("data-emoji-picker-skin-tone", ""), e.className = [
|
|
5137
|
+
"absolute right-0 top-full mt-1.5 z-20",
|
|
5138
|
+
"flex items-center gap-0.5 p-1 rounded-xl",
|
|
5139
|
+
"bg-white border border-neutral-200/70 shadow-lg",
|
|
5140
|
+
"theme-dark:bg-neutral-800 theme-dark:border-neutral-700/50"
|
|
5141
|
+
].join(" "), e.hidden = !0, this._skinToneButtons = [];
|
|
5142
|
+
for (let [t, n] of za.entries()) {
|
|
5143
|
+
let r = document.createElement("button");
|
|
5144
|
+
r.type = "button", r.textContent = n, r.setAttribute("aria-label", `${this.i18n.t(fa)} ${t + 1}`), r.className = [
|
|
5145
|
+
"w-[32px] h-[32px] flex items-center justify-center rounded-lg",
|
|
5146
|
+
"text-[1.2rem] leading-none cursor-pointer select-none",
|
|
5147
|
+
"hover:bg-neutral-100 theme-dark:hover:bg-neutral-700",
|
|
5148
|
+
"active:scale-90 transition-all duration-100"
|
|
5149
|
+
].join(" "), this.applySkinToneActiveStyle(r, t === this._skinTone), r.addEventListener("click", () => {
|
|
5150
|
+
this.setSkinTone(t), this.closeSkinTonePopover();
|
|
5151
|
+
}), e.appendChild(r), this._skinToneButtons.push(r);
|
|
5152
|
+
}
|
|
5153
|
+
return e;
|
|
5154
|
+
}
|
|
5155
|
+
applySkinToneActiveStyle(e, t) {
|
|
5156
|
+
let n = [
|
|
5157
|
+
"bg-neutral-100",
|
|
5158
|
+
"theme-dark:bg-neutral-700",
|
|
5159
|
+
"ring-2",
|
|
5160
|
+
"ring-neutral-300/60",
|
|
5161
|
+
"theme-dark:ring-neutral-600/60"
|
|
5162
|
+
];
|
|
5163
|
+
t ? e.classList.add(...n) : e.classList.remove(...n);
|
|
5164
|
+
}
|
|
5165
|
+
toggleSkinTonePopover() {
|
|
5166
|
+
this._skinTonePopover.hidden = !this._skinTonePopover.hidden, this.updateSkinToneToggleActive();
|
|
5167
|
+
}
|
|
5168
|
+
closeSkinTonePopover() {
|
|
5169
|
+
this._skinTonePopover.hidden = !0, this.updateSkinToneToggleActive();
|
|
5170
|
+
}
|
|
5171
|
+
updateSkinToneToggleActive() {
|
|
5172
|
+
let e = !this._skinTonePopover.hidden, t = ["bg-neutral-100", "theme-dark:bg-neutral-700"];
|
|
5173
|
+
e ? this._skinToneToggle.classList.add(...t) : this._skinToneToggle.classList.remove(...t);
|
|
5174
|
+
}
|
|
5175
|
+
setSkinTone(e) {
|
|
5176
|
+
this._skinTone = e, this._skinToneToggle.textContent = za[e];
|
|
5177
|
+
for (let [t, n] of this._skinToneButtons.entries()) this.applySkinToneActiveStyle(n, t === e);
|
|
5178
|
+
let t = Array.from(this._body.querySelectorAll("[data-emoji-native]"));
|
|
5179
|
+
for (let e of t) {
|
|
5180
|
+
let t = e.getAttribute("data-emoji-native");
|
|
5181
|
+
if (t === null) continue;
|
|
5182
|
+
let n = this._allEmojis.find((e) => e.native === t);
|
|
5183
|
+
n !== void 0 && (e.textContent = this.getSkinnedNative(n));
|
|
5184
|
+
}
|
|
5185
|
+
}
|
|
5186
|
+
pickRandom() {
|
|
5187
|
+
if (this._allEmojis.length === 0) return;
|
|
5188
|
+
let e = Math.floor(Math.random() * this._allEmojis.length), t = this._allEmojis[e];
|
|
5189
|
+
t !== void 0 && this.onSelect(this.getSkinnedNative(t));
|
|
5190
|
+
}
|
|
5191
|
+
buildCategoryNav(e) {
|
|
5192
|
+
this._nav.innerHTML = "", this._navButtons.clear(), this._activeNavId = "";
|
|
5193
|
+
for (let [t, n] of Ra) {
|
|
5194
|
+
if (!e.has(t)) continue;
|
|
5195
|
+
let r = this.translateCategory(t), i = document.createElement("button");
|
|
5196
|
+
i.type = "button", i.innerHTML = n, i.title = r, i.setAttribute("aria-label", r), i.setAttribute("data-emoji-nav", t), i.className = [
|
|
5197
|
+
"flex-1 h-[36px] flex items-center justify-center",
|
|
5198
|
+
"rounded-lg cursor-pointer opacity-50",
|
|
5199
|
+
"text-neutral-500 theme-dark:text-neutral-400",
|
|
5200
|
+
"[&>svg]:w-[20px] [&>svg]:h-[20px]",
|
|
5201
|
+
"hover:opacity-100 hover:bg-neutral-100",
|
|
5202
|
+
"theme-dark:hover:bg-neutral-800",
|
|
5203
|
+
"transition-all duration-100"
|
|
5204
|
+
].join(" "), i.addEventListener("click", () => this.scrollToSection(t)), this._nav.appendChild(i), this._navButtons.set(t, i);
|
|
5205
|
+
}
|
|
5206
|
+
}
|
|
5207
|
+
scrollToSection(e) {
|
|
5208
|
+
let t = this._sectionEls.get(e);
|
|
5209
|
+
if (t === void 0) return;
|
|
5210
|
+
let n = this._body.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
5211
|
+
this._body.scrollTo({
|
|
5212
|
+
top: this._body.scrollTop + (r.top - n.top),
|
|
5213
|
+
behavior: "smooth"
|
|
5214
|
+
});
|
|
5215
|
+
}
|
|
5216
|
+
updateActiveNav() {
|
|
5217
|
+
let e = this._body.getBoundingClientRect().top, t = [...this._sectionEls.entries()].filter(([, t]) => t.getBoundingClientRect().top - e <= 20).reduce((e, [t]) => t, "");
|
|
5218
|
+
if (t !== this._activeNavId) {
|
|
5219
|
+
this._activeNavId = t;
|
|
5220
|
+
for (let [e, n] of this._navButtons) e === t ? (n.classList.remove("opacity-50"), n.classList.add("opacity-100", "bg-neutral-100", "theme-dark:bg-neutral-800")) : (n.classList.remove("opacity-100", "bg-neutral-100", "theme-dark:bg-neutral-800"), n.classList.add("opacity-50"));
|
|
5221
|
+
}
|
|
5222
|
+
}
|
|
5223
|
+
getSkinnedNative(e) {
|
|
5224
|
+
var t;
|
|
5225
|
+
return (t = e.skins[this._skinTone]) == null ? e.native : t;
|
|
5226
|
+
}
|
|
5227
|
+
handleFilterChange(e) {
|
|
5228
|
+
if (e.trim() === "") {
|
|
5229
|
+
this._nav.hidden = !1, this.renderEmojiGrid(this._allEmojis);
|
|
5230
|
+
return;
|
|
5231
|
+
}
|
|
5232
|
+
this._nav.hidden = !0;
|
|
5233
|
+
let t = Ma(this._allEmojis, e, this._localeData);
|
|
5234
|
+
if (t.length === 0) this._showingEmptyState || this.renderEmptyState();
|
|
5235
|
+
else {
|
|
5236
|
+
this._body.innerHTML = "", this._sectionEls.clear(), this._showingEmptyState = !1;
|
|
5237
|
+
let e = Na(t);
|
|
5238
|
+
for (let [t, n] of e) {
|
|
5239
|
+
let e = this.buildSection(this.translateCategory(t), n);
|
|
5240
|
+
e.setAttribute("data-emoji-section", t), this._sectionEls.set(t, e), this._body.appendChild(e);
|
|
5241
|
+
}
|
|
5242
|
+
}
|
|
5243
|
+
}
|
|
5244
|
+
renderEmojiGrid(e) {
|
|
5245
|
+
this._body.innerHTML = "", this._sectionEls.clear(), this._showingEmptyState = !1;
|
|
5246
|
+
let t = /* @__PURE__ */ new Set(), n = Oa.map((t) => e.find((e) => e.native === t)).filter((e) => e !== void 0);
|
|
5247
|
+
if (n.length > 0) {
|
|
5248
|
+
t.add("callout");
|
|
5249
|
+
let e = this.buildSection(this.translateCategory("callout"), n);
|
|
5250
|
+
e.setAttribute("data-emoji-section", "callout"), this._sectionEls.set("callout", e), this._body.appendChild(e);
|
|
5251
|
+
}
|
|
5252
|
+
let r = Na(e);
|
|
5253
|
+
for (let [e, n] of r) {
|
|
5254
|
+
t.add(e);
|
|
5255
|
+
let r = this.buildSection(this.translateCategory(e), n);
|
|
5256
|
+
r.setAttribute("data-emoji-section", e), this._sectionEls.set(e, r), this._body.appendChild(r);
|
|
5257
|
+
}
|
|
5258
|
+
this.buildCategoryNav(t), this._nav.hidden = !1, requestAnimationFrame(() => this.updateActiveNav());
|
|
5259
|
+
}
|
|
5260
|
+
renderEmptyState() {
|
|
5261
|
+
this._body.innerHTML = "", this._showingEmptyState = !0, this._sectionEls.clear();
|
|
5262
|
+
let e = document.createElement("div");
|
|
5263
|
+
e.className = [
|
|
5264
|
+
"flex flex-col items-center justify-center py-10",
|
|
5265
|
+
"text-neutral-400 theme-dark:text-neutral-500 select-none",
|
|
5266
|
+
"animate-[blok-emoji-empty-in_300ms_ease-out_both]"
|
|
5267
|
+
].join(" ");
|
|
5268
|
+
let t = document.createElement("span");
|
|
5269
|
+
t.className = "mb-3 opacity-20 [&>svg]:w-9 [&>svg]:h-9", t.innerHTML = je;
|
|
5270
|
+
let n = document.createElement("span");
|
|
5271
|
+
n.className = "text-[13px] font-medium", n.textContent = this.i18n.t(ua), e.appendChild(t), e.appendChild(n), this._body.appendChild(e);
|
|
5272
|
+
}
|
|
5273
|
+
translateCategory(e) {
|
|
5274
|
+
let t = La[e];
|
|
5275
|
+
return t === void 0 ? e : this.i18n.t(t);
|
|
5276
|
+
}
|
|
5277
|
+
buildSection(e, t) {
|
|
5278
|
+
let n = document.createElement("div"), r = document.createElement("div");
|
|
5279
|
+
return r.className = [
|
|
5280
|
+
"text-[11px] font-semibold uppercase tracking-wider px-2 pt-3 pb-1.5",
|
|
5281
|
+
"text-neutral-400/80 theme-dark:text-neutral-500/80",
|
|
5282
|
+
"sticky top-0 bg-white theme-dark:bg-neutral-900 z-10"
|
|
5283
|
+
].join(" "), r.textContent = e, n.appendChild(r), n.appendChild(this.buildGrid(t)), n;
|
|
5284
|
+
}
|
|
5285
|
+
getDisplayName(e) {
|
|
5286
|
+
var t, n;
|
|
5287
|
+
return ((t = (n = this._localeData) == null || (n = n[e.native]) == null ? void 0 : n.n) == null ? e.name : t).toLocaleLowerCase();
|
|
5288
|
+
}
|
|
5289
|
+
buildGrid(e) {
|
|
5290
|
+
let t = document.createElement("div");
|
|
5291
|
+
t.className = "grid grid-cols-10 gap-0.5 px-0.5 pt-1";
|
|
5292
|
+
for (let n of e) {
|
|
5293
|
+
let e = document.createElement("button");
|
|
5294
|
+
e.type = "button", e.textContent = this.getSkinnedNative(n), e.title = this.getDisplayName(n), e.setAttribute("data-emoji-native", n.native), e.className = [
|
|
5295
|
+
"aspect-square flex items-center justify-center",
|
|
5296
|
+
"text-[1.25rem] leading-none rounded-lg cursor-pointer",
|
|
5297
|
+
"hover:bg-neutral-100 theme-dark:hover:bg-neutral-800",
|
|
5298
|
+
"hover:scale-110 active:scale-95",
|
|
5299
|
+
"transition-transform duration-75"
|
|
5300
|
+
].join(" "), e.addEventListener("click", () => {
|
|
5301
|
+
this.onSelect(this.getSkinnedNative(n)), this.close();
|
|
5302
|
+
}), v(e, this.getDisplayName(n), { placement: "bottom" }), t.appendChild(e);
|
|
5303
|
+
}
|
|
5304
|
+
return t;
|
|
5305
|
+
}
|
|
5306
|
+
resolveTheme() {
|
|
5307
|
+
let e = document.documentElement.getAttribute("data-blok-theme");
|
|
5308
|
+
return e === "dark" ? "dark" : e === "light" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
5309
|
+
}
|
|
5310
|
+
showBackdrop() {
|
|
5311
|
+
var e;
|
|
5312
|
+
this.removeBackdrop();
|
|
5313
|
+
let t = document.createElement("div");
|
|
5314
|
+
t.setAttribute("data-blok-emoji-picker-backdrop", ""), t.style.position = "fixed", t.style.inset = "0", t.style.zIndex = "50", t.addEventListener("mousedown", (e) => {
|
|
5315
|
+
e.target === t && this.close();
|
|
5316
|
+
}), (e = this._element.parentElement) == null || e.insertBefore(t, this._element), t.appendChild(this._element), this._backdrop = t, this._savedOverflow = document.documentElement.style.overflow, document.documentElement.style.overflow = "hidden";
|
|
5317
|
+
}
|
|
5318
|
+
removeBackdrop() {
|
|
5319
|
+
var e;
|
|
5320
|
+
this._backdrop !== null && (document.documentElement.style.overflow = this._savedOverflow, (e = this._backdrop.parentElement) == null || e.insertBefore(this._element, this._backdrop), this._backdrop.remove(), this._backdrop = null);
|
|
5321
|
+
}
|
|
5322
|
+
position(e) {
|
|
5323
|
+
let t = e.getBoundingClientRect(), n = this._element.getBoundingClientRect(), r = window.innerHeight, i = window.innerWidth, a = t.bottom + n.height > r ? t.top - n.height - 4 : t.bottom + 4, o = t.left - 8, s = o + n.width > i ? t.right - n.width : Math.max(0, o);
|
|
5324
|
+
this._element.style.top = `${a}px`, this._element.style.left = `${s}px`;
|
|
5325
|
+
}
|
|
5326
|
+
}, Ha = class {
|
|
5327
|
+
constructor({ data: e, api: t, readOnly: n, block: r }) {
|
|
5328
|
+
this._dom = null, this._emojiPicker = null, this._colorPicker = null, this.api = t, this.readOnly = n, this._data = this.normalizeData(e), r && (this.blockId = r.id);
|
|
5329
|
+
}
|
|
5330
|
+
normalizeData(e) {
|
|
5331
|
+
return {
|
|
5332
|
+
emoji: typeof e.emoji == "string" ? e.emoji : xa,
|
|
5333
|
+
textColor: typeof e.textColor == "string" ? e.textColor : null,
|
|
5334
|
+
backgroundColor: typeof e.backgroundColor == "string" ? e.backgroundColor : null
|
|
5335
|
+
};
|
|
5336
|
+
}
|
|
5337
|
+
render() {
|
|
5338
|
+
let e = Ta({
|
|
5339
|
+
emoji: this._data.emoji,
|
|
5340
|
+
readOnly: this.readOnly,
|
|
5341
|
+
addEmojiLabel: this.api.i18n.t(oa)
|
|
5342
|
+
});
|
|
5343
|
+
return this._dom = e, this.applyColors(), this.readOnly || (e.emojiButton.addEventListener("click", () => this.openEmojiPicker()), e.emojiButton.addEventListener("keydown", (e) => {
|
|
5344
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.openEmojiPicker());
|
|
5345
|
+
}), e.childContainer.addEventListener("keydown", (e) => {
|
|
5346
|
+
e.key === "Backspace" && this.handleChildBackspace(e);
|
|
5347
|
+
})), e.wrapper;
|
|
5348
|
+
}
|
|
5349
|
+
rendered() {
|
|
5350
|
+
if (this.blockId === void 0 || this._dom === null) return;
|
|
5351
|
+
let e = this.api.blocks.getChildren(this.blockId);
|
|
5352
|
+
for (let t of e) t.holder.parentElement !== this._dom.childContainer && this._dom.childContainer.appendChild(t.holder);
|
|
5353
|
+
if (e.length === 0) {
|
|
5354
|
+
let e = this.api.blocks.getBlockIndex(this.blockId);
|
|
5355
|
+
if (e !== void 0) {
|
|
5356
|
+
let t = this.api.blocks.insertInsideParent(this.blockId, e + 1);
|
|
5357
|
+
this._dom.childContainer.appendChild(t.holder), this.api.caret.setToBlock(t.id, "start");
|
|
5358
|
+
}
|
|
5359
|
+
}
|
|
5360
|
+
}
|
|
5361
|
+
save() {
|
|
5362
|
+
return Ea({
|
|
5363
|
+
emoji: this._data.emoji,
|
|
5364
|
+
textColor: this._data.textColor,
|
|
5365
|
+
backgroundColor: this._data.backgroundColor
|
|
5366
|
+
});
|
|
5367
|
+
}
|
|
5368
|
+
validate(e) {
|
|
5369
|
+
return !0;
|
|
5370
|
+
}
|
|
5371
|
+
renderSettings() {
|
|
5372
|
+
if (this._colorPicker === null) {
|
|
5373
|
+
let e = yr({
|
|
5374
|
+
i18n: this.api.i18n,
|
|
5375
|
+
testIdPrefix: "callout-color",
|
|
5376
|
+
modes: [{
|
|
5377
|
+
key: "color",
|
|
5378
|
+
labelKey: "tools.marker.textColor",
|
|
5379
|
+
presetField: "text"
|
|
5380
|
+
}, {
|
|
5381
|
+
key: "background-color",
|
|
5382
|
+
labelKey: "tools.marker.background",
|
|
5383
|
+
presetField: "bg"
|
|
5384
|
+
}],
|
|
5385
|
+
onColorSelect: (t, n) => {
|
|
5386
|
+
let r = t === null ? null : ze(t, n === "color" ? "text" : "bg");
|
|
5387
|
+
n === "color" ? this._data.textColor = r : this._data.backgroundColor = r, e.setActiveColor(t, n), this.applyColors();
|
|
5388
|
+
}
|
|
5389
|
+
});
|
|
5390
|
+
this._colorPicker = e;
|
|
5391
|
+
}
|
|
5392
|
+
return this.syncPickerActiveColors(), [{
|
|
5393
|
+
icon: ne,
|
|
5394
|
+
title: this.api.i18n.t(aa),
|
|
5395
|
+
name: "callout-edit-icon",
|
|
5396
|
+
closeOnActivate: !0,
|
|
5397
|
+
onActivate: () => this.openEmojiPicker()
|
|
5398
|
+
}, {
|
|
5399
|
+
icon: He,
|
|
5400
|
+
title: this.api.i18n.t(ia),
|
|
5401
|
+
name: "callout-color",
|
|
5402
|
+
children: { items: [{
|
|
5403
|
+
type: _.Html,
|
|
5404
|
+
element: this._colorPicker.element
|
|
5405
|
+
}] }
|
|
5406
|
+
}];
|
|
5407
|
+
}
|
|
5408
|
+
removed() {}
|
|
5409
|
+
syncPickerActiveColors() {
|
|
5410
|
+
if (this._colorPicker === null) return;
|
|
5411
|
+
let e = this._data.textColor, t = this._data.backgroundColor;
|
|
5412
|
+
this._colorPicker.setActiveColor(e === null ? null : u(e, "text"), "color"), this._colorPicker.setActiveColor(t === null ? null : u(t, "bg"), "background-color");
|
|
5413
|
+
}
|
|
5414
|
+
applyColors() {
|
|
5415
|
+
if (this._dom === null) return;
|
|
5416
|
+
let { textColor: e, backgroundColor: t } = this._data;
|
|
5417
|
+
if (e === null ? this._dom.wrapper.style.color = "" : this._dom.wrapper.style.color = u(e, "text"), t !== null) {
|
|
5418
|
+
let e = u(t, "bg");
|
|
5419
|
+
this._dom.wrapper.style.backgroundColor = e, this._dom.wrapper.style.border = "", this._dom.wrapper.style.setProperty("--blok-search-input-bg", `light-dark(color-mix(in srgb, ${e} 70%, white), color-mix(in srgb, ${e} 85%, white))`);
|
|
5420
|
+
} else this._dom.wrapper.style.backgroundColor = "", this._dom.wrapper.style.border = "1px solid var(--blok-callout-default-border, #e5e7eb)", this._dom.wrapper.style.removeProperty("--blok-search-input-bg"), this._dom.wrapper.style.removeProperty("--blok-search-input-border");
|
|
5421
|
+
}
|
|
5422
|
+
handleChildBackspace(e) {
|
|
5423
|
+
if (this.blockId === void 0 || this._dom === null) return;
|
|
5424
|
+
let t = this.api.blocks.getChildren(this.blockId);
|
|
5425
|
+
if (t.length === 0) return;
|
|
5426
|
+
let n = t[0], r = e.target;
|
|
5427
|
+
if (!n.holder.contains(r)) return;
|
|
5428
|
+
let i = window.getSelection(), a = i !== null && i.rangeCount > 0 && i.getRangeAt(0).startOffset === 0 && i.getRangeAt(0).collapsed;
|
|
5429
|
+
n.holder.textContent !== "" || !a || Da({
|
|
5430
|
+
api: this.api,
|
|
5431
|
+
calloutBlockId: this.blockId,
|
|
5432
|
+
firstChildBlockId: n.id,
|
|
5433
|
+
event: e
|
|
5434
|
+
});
|
|
5435
|
+
}
|
|
5436
|
+
openEmojiPicker() {
|
|
5437
|
+
this._dom !== null && (this._emojiPicker === null && (this._emojiPicker = new Va({
|
|
5438
|
+
onSelect: (e) => this.setEmoji(e),
|
|
5439
|
+
onRemove: () => this.setEmoji(""),
|
|
5440
|
+
i18n: this.api.i18n,
|
|
5441
|
+
locale: this.api.i18n.getLocale()
|
|
5442
|
+
}), document.body.appendChild(this._emojiPicker.getElement())), this._emojiPicker.open(this._dom.emojiButton));
|
|
5443
|
+
}
|
|
5444
|
+
setEmoji(e) {
|
|
5445
|
+
this._data.emoji = e, this._dom !== null && (this._dom.emojiButton.textContent = e, this._dom.emojiButton.setAttribute("aria-label", e === "" ? this.api.i18n.t(oa) : e));
|
|
5446
|
+
}
|
|
5447
|
+
static get toolbox() {
|
|
5448
|
+
return {
|
|
5449
|
+
icon: se,
|
|
5450
|
+
title: "Callout",
|
|
5451
|
+
titleKey: "callout",
|
|
5452
|
+
name: ra,
|
|
5453
|
+
searchTerms: [
|
|
5454
|
+
"callout",
|
|
5455
|
+
"note",
|
|
5456
|
+
"info",
|
|
5457
|
+
"warning",
|
|
5458
|
+
"tip",
|
|
5459
|
+
"alert"
|
|
5460
|
+
]
|
|
5461
|
+
};
|
|
5462
|
+
}
|
|
5463
|
+
static get conversionConfig() {
|
|
5464
|
+
return { import: () => ({
|
|
5465
|
+
emoji: xa,
|
|
5466
|
+
textColor: null,
|
|
5467
|
+
backgroundColor: null
|
|
5468
|
+
}) };
|
|
5469
|
+
}
|
|
5470
|
+
static get sanitize() {
|
|
5471
|
+
return {
|
|
5472
|
+
emoji: !1,
|
|
5473
|
+
textColor: !1,
|
|
5474
|
+
backgroundColor: !1
|
|
5475
|
+
};
|
|
5476
|
+
}
|
|
5477
|
+
static get isReadOnlySupported() {
|
|
5478
|
+
return !0;
|
|
5479
|
+
}
|
|
4825
5480
|
}, L = (e) => {
|
|
4826
5481
|
let t = e.tagName;
|
|
4827
5482
|
return t === "B" || t === "STRONG";
|
|
4828
|
-
},
|
|
5483
|
+
}, Ua = (e) => !!(e && e.nodeType === Node.ELEMENT_NODE && L(e)), Wa = (e) => e.textContent.length === 0, R = (e) => e ? e.nodeType === Node.ELEMENT_NODE && L(e) ? z(e) : R(e.parentNode) : null, z = (e) => {
|
|
4829
5484
|
if (e.tagName === "STRONG") return e;
|
|
4830
5485
|
let t = document.createElement("strong");
|
|
4831
5486
|
for (e.hasAttributes() && Array.from(e.attributes).forEach((e) => {
|
|
4832
5487
|
t.setAttribute(e.name, e.value);
|
|
4833
5488
|
}); e.firstChild;) t.appendChild(e.firstChild);
|
|
4834
5489
|
return e.replaceWith(t), t;
|
|
4835
|
-
},
|
|
5490
|
+
}, Ga = (e) => {
|
|
4836
5491
|
let t = e.nextSibling;
|
|
4837
5492
|
if ((t == null ? void 0 : t.nodeType) === Node.TEXT_NODE) return t;
|
|
4838
5493
|
let n = e.parentNode;
|
|
4839
5494
|
if (!n) return null;
|
|
4840
5495
|
let r = e.ownerDocument.createTextNode("");
|
|
4841
5496
|
return n.insertBefore(r, t), r;
|
|
4842
|
-
},
|
|
5497
|
+
}, Ka = (e) => {
|
|
4843
5498
|
if (!e.boldElement.isConnected) return null;
|
|
4844
|
-
let t = z(e.boldElement), n = e.boundary, r = n.isConnected && n.previousSibling === t ? n :
|
|
5499
|
+
let t = z(e.boldElement), n = e.boundary, r = n.isConnected && n.previousSibling === t ? n : Ga(t);
|
|
4845
5500
|
return r ? {
|
|
4846
5501
|
boundary: r,
|
|
4847
5502
|
boldElement: t
|
|
4848
5503
|
} : null;
|
|
4849
|
-
},
|
|
5504
|
+
}, qa = (e, t) => e ? e === t || t.contains(e) : !1, Ja, B = {
|
|
4850
5505
|
COLLAPSED_LENGTH: "data-blok-bold-collapsed-length",
|
|
4851
5506
|
COLLAPSED_ACTIVE: "data-blok-bold-collapsed-active",
|
|
4852
5507
|
PREV_LENGTH: "data-blok-bold-prev-length",
|
|
@@ -4899,7 +5554,7 @@ var cr = (e) => {
|
|
|
4899
5554
|
}
|
|
4900
5555
|
exit(e, t) {
|
|
4901
5556
|
let n = z(t), r = n.parentNode;
|
|
4902
|
-
if (r) return
|
|
5557
|
+
if (r) return Wa(n) ? this.removeEmptyBoldElement(e, n, r) : this.exitBoldWithContent(e, n, r);
|
|
4903
5558
|
}
|
|
4904
5559
|
removeEmptyBoldElement(e, t, n) {
|
|
4905
5560
|
let r = document.createRange();
|
|
@@ -4923,7 +5578,7 @@ var cr = (e) => {
|
|
|
4923
5578
|
}
|
|
4924
5579
|
maintain() {
|
|
4925
5580
|
if (!(typeof document > "u")) for (let e of Array.from(this.records)) {
|
|
4926
|
-
let t =
|
|
5581
|
+
let t = Ka(e);
|
|
4927
5582
|
if (!t) {
|
|
4928
5583
|
this.records.delete(e);
|
|
4929
5584
|
continue;
|
|
@@ -4956,7 +5611,7 @@ var cr = (e) => {
|
|
|
4956
5611
|
}
|
|
4957
5612
|
synchronize(e) {
|
|
4958
5613
|
var t, n;
|
|
4959
|
-
let r = (t = e == null ? void 0 : e.anchorNode) == null ? e == null ? void 0 : e.focusNode : t, i = r && r.nodeType === Node.ELEMENT_NODE ? r : r == null ? void 0 : r.parentElement, a = (n = i == null ? void 0 : i.closest(y
|
|
5614
|
+
let r = (t = e == null ? void 0 : e.anchorNode) == null ? e == null ? void 0 : e.focusNode : t, i = r && r.nodeType === Node.ELEMENT_NODE ? r : r == null ? void 0 : r.parentElement, a = (n = i == null ? void 0 : i.closest(f(y.editor))) == null ? i == null ? void 0 : i.ownerDocument : n;
|
|
4960
5615
|
if (!a) return;
|
|
4961
5616
|
let o = `strong[${B.COLLAPSED_ACTIVE}="true"]`;
|
|
4962
5617
|
a.querySelectorAll(o).forEach((t) => {
|
|
@@ -4973,16 +5628,16 @@ var cr = (e) => {
|
|
|
4973
5628
|
if (u && !t.hasAttribute(B.LEADING_WHITESPACE) && t.setAttribute(B.LEADING_WHITESPACE, u[0]), l.length === 0) return;
|
|
4974
5629
|
let d = t.textContent, f = d + l, p = (n = t.getAttribute(B.LEADING_WHITESPACE)) == null ? "" : n, m = p.length > 0 && d.length === 0 && !f.startsWith(p) ? p + f : f, h = document.createTextNode(m);
|
|
4975
5630
|
for (; t.firstChild;) t.removeChild(t.firstChild);
|
|
4976
|
-
if (t.appendChild(h), !(e != null && e.isCollapsed) || !
|
|
4977
|
-
let g = document.createRange(),
|
|
4978
|
-
g.setStart(h,
|
|
5631
|
+
if (t.appendChild(h), !(e != null && e.isCollapsed) || !qa(e.focusNode, o)) return;
|
|
5632
|
+
let g = document.createRange(), ee = h.textContent.length;
|
|
5633
|
+
g.setStart(h, ee), g.collapse(!0), e.removeAllRanges(), e.addRange(g);
|
|
4979
5634
|
});
|
|
4980
5635
|
}
|
|
4981
5636
|
enforceLengths(e) {
|
|
4982
5637
|
var t;
|
|
4983
5638
|
let n = (t = e == null ? void 0 : e.anchorNode) == null ? e == null ? void 0 : e.focusNode : t;
|
|
4984
5639
|
if (!n) return;
|
|
4985
|
-
let r = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement, i = r == null ? void 0 : r.closest(y
|
|
5640
|
+
let r = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement, i = r == null ? void 0 : r.closest(f(y.editor));
|
|
4986
5641
|
i && i.querySelectorAll(`strong[${B.COLLAPSED_LENGTH}]`).forEach((t) => {
|
|
4987
5642
|
var n;
|
|
4988
5643
|
let r = t.getAttribute(B.COLLAPSED_LENGTH);
|
|
@@ -4997,7 +5652,7 @@ var cr = (e) => {
|
|
|
4997
5652
|
let r = document.createTextNode(n);
|
|
4998
5653
|
(m = t.parentNode) == null || m.insertBefore(r, t.nextSibling);
|
|
4999
5654
|
}
|
|
5000
|
-
if (p && t.removeAttribute(B.PREV_LENGTH), e != null && e.isCollapsed && s &&
|
|
5655
|
+
if (p && t.removeAttribute(B.PREV_LENGTH), e != null && e.isCollapsed && s && qa(e.focusNode, t)) {
|
|
5001
5656
|
let t = document.createRange(), n = s.textContent.length;
|
|
5002
5657
|
t.setStart(s, n), t.collapse(!0), e.removeAllRanges(), e.addRange(t);
|
|
5003
5658
|
}
|
|
@@ -5091,10 +5746,10 @@ var cr = (e) => {
|
|
|
5091
5746
|
return t.tagName === "STRONG" || t.tagName === "B";
|
|
5092
5747
|
}
|
|
5093
5748
|
};
|
|
5094
|
-
|
|
5749
|
+
Ja = V, Ja.instance = null;
|
|
5095
5750
|
//#endregion
|
|
5096
5751
|
//#region src/components/inline-tools/services/bold-normalization-pass.ts
|
|
5097
|
-
var
|
|
5752
|
+
var Ya = {
|
|
5098
5753
|
convertLegacyTags: !0,
|
|
5099
5754
|
normalizeWhitespace: !0,
|
|
5100
5755
|
removeEmpty: !0,
|
|
@@ -5102,7 +5757,7 @@ var Xi = {
|
|
|
5102
5757
|
preserveNode: null
|
|
5103
5758
|
}, H = class e {
|
|
5104
5759
|
constructor(e) {
|
|
5105
|
-
this.options =
|
|
5760
|
+
this.options = S(S({}, Ya), e);
|
|
5106
5761
|
}
|
|
5107
5762
|
run(e) {
|
|
5108
5763
|
if (typeof document > "u") return;
|
|
@@ -5155,16 +5810,16 @@ var Xi = {
|
|
|
5155
5810
|
t.includes("\xA0") && (e.textContent = t.replace(/\u00A0/g, " "));
|
|
5156
5811
|
}
|
|
5157
5812
|
isEmptyAndSafe(e) {
|
|
5158
|
-
return e.textContent.length !== 0 || V.getInstance().isActivePlaceholder(e) ? !1 : !(this.options.preserveNode &&
|
|
5813
|
+
return e.textContent.length !== 0 || V.getInstance().isActivePlaceholder(e) ? !1 : !(this.options.preserveNode && qa(this.options.preserveNode, e));
|
|
5159
5814
|
}
|
|
5160
5815
|
mergeWithAdjacent(e) {
|
|
5161
5816
|
let t = e.previousSibling;
|
|
5162
|
-
if (t &&
|
|
5817
|
+
if (t && Ua(t)) {
|
|
5163
5818
|
this.mergeStrongNodes(t, e);
|
|
5164
5819
|
return;
|
|
5165
5820
|
}
|
|
5166
5821
|
let n = e.nextSibling;
|
|
5167
|
-
n &&
|
|
5822
|
+
n && Ua(n) && this.mergeStrongNodes(e, n);
|
|
5168
5823
|
}
|
|
5169
5824
|
mergeStrongNodes(e, t) {
|
|
5170
5825
|
let n = z(e), r = z(t);
|
|
@@ -5176,9 +5831,9 @@ var Xi = {
|
|
|
5176
5831
|
let r = (t = e == null ? void 0 : e.anchorNode) == null ? e == null ? void 0 : e.focusNode : t;
|
|
5177
5832
|
if (!r) return null;
|
|
5178
5833
|
let i = r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement;
|
|
5179
|
-
return i ? ((n = i.closest("[data-blok-component=\"paragraph\"]")) == null ? i.closest(y
|
|
5834
|
+
return i ? ((n = i.closest("[data-blok-component=\"paragraph\"]")) == null ? i.closest(f(y.elementContent)) : n) || i.closest(f(y.editor)) : null;
|
|
5180
5835
|
}
|
|
5181
|
-
},
|
|
5836
|
+
}, Xa, Za = class e {
|
|
5182
5837
|
constructor() {
|
|
5183
5838
|
this.handlers = /* @__PURE__ */ new Map(), this.listenersRegistered = !1, this.handleSelectionChange = () => {
|
|
5184
5839
|
let e = this.getSelection();
|
|
@@ -5235,10 +5890,10 @@ var Xi = {
|
|
|
5235
5890
|
return !(t.meta && !n || t.ctrl && !e.ctrlKey);
|
|
5236
5891
|
}
|
|
5237
5892
|
};
|
|
5238
|
-
|
|
5893
|
+
Xa = Za, Xa.instance = null;
|
|
5239
5894
|
//#endregion
|
|
5240
5895
|
//#region src/components/inline-tools/utils/formatting-range-utils.ts
|
|
5241
|
-
var
|
|
5896
|
+
var Qa = (e, t) => {
|
|
5242
5897
|
try {
|
|
5243
5898
|
return e.intersectsNode(t);
|
|
5244
5899
|
} catch (n) {
|
|
@@ -5247,26 +5902,26 @@ var $i = (e, t) => {
|
|
|
5247
5902
|
let i = e.compareBoundaryPoints(Range.END_TO_START, r) > 0, a = e.compareBoundaryPoints(Range.START_TO_END, r) < 0;
|
|
5248
5903
|
return i && a;
|
|
5249
5904
|
}
|
|
5250
|
-
},
|
|
5905
|
+
}, $a = (e) => {
|
|
5251
5906
|
var t;
|
|
5252
5907
|
let n = e.commonAncestorContainer, r = n.nodeType === Node.TEXT_NODE ? (t = n.parentNode) == null ? n : t : n;
|
|
5253
|
-
return document.createTreeWalker(r, NodeFilter.SHOW_TEXT, { acceptNode: (t) =>
|
|
5254
|
-
}, U = (e, t, n) => !e || e === n ? null : e.nodeType === Node.ELEMENT_NODE && t(e) ? e : U(e.parentNode, t, n),
|
|
5908
|
+
return document.createTreeWalker(r, NodeFilter.SHOW_TEXT, { acceptNode: (t) => Qa(e, t) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT });
|
|
5909
|
+
}, U = (e, t, n) => !e || e === n ? null : e.nodeType === Node.ELEMENT_NODE && t(e) ? e : U(e.parentNode, t, n), W = (e, t) => U(e, t) !== null, G = (e, t, n = {}) => {
|
|
5255
5910
|
if (e.collapsed) return U(e.startContainer, t) !== null;
|
|
5256
|
-
let r =
|
|
5911
|
+
let r = $a(e), i = [];
|
|
5257
5912
|
for (; r.nextNode();) {
|
|
5258
5913
|
let e = r.currentNode, t = e.textContent;
|
|
5259
5914
|
n.ignoreWhitespace && t.trim().length === 0 || t.length !== 0 && i.push(e);
|
|
5260
5915
|
}
|
|
5261
|
-
return i.length === 0 ? U(e.startContainer, t) !== null : i.every((e) =>
|
|
5262
|
-
},
|
|
5263
|
-
let n = /* @__PURE__ */ new Set(), r =
|
|
5916
|
+
return i.length === 0 ? U(e.startContainer, t) !== null : i.every((e) => W(e, t));
|
|
5917
|
+
}, K = (e, t) => {
|
|
5918
|
+
let n = /* @__PURE__ */ new Set(), r = $a(e);
|
|
5264
5919
|
for (; r.nextNode();) {
|
|
5265
5920
|
let e = U(r.currentNode, t);
|
|
5266
5921
|
e && n.add(e);
|
|
5267
5922
|
}
|
|
5268
5923
|
return Array.from(n);
|
|
5269
|
-
},
|
|
5924
|
+
}, q, eo = class e {
|
|
5270
5925
|
static get sanitize() {
|
|
5271
5926
|
return {
|
|
5272
5927
|
strong: {},
|
|
@@ -5278,7 +5933,7 @@ var $i = (e, t) => {
|
|
|
5278
5933
|
}
|
|
5279
5934
|
static initializeGlobalListeners() {
|
|
5280
5935
|
if (typeof document > "u") return !1;
|
|
5281
|
-
let t =
|
|
5936
|
+
let t = Za.getInstance();
|
|
5282
5937
|
return t.hasHandler("bold") ? !0 : (t.register("bold", {
|
|
5283
5938
|
shortcut: {
|
|
5284
5939
|
key: "b",
|
|
@@ -5360,7 +6015,7 @@ var $i = (e, t) => {
|
|
|
5360
6015
|
let e = document.createRange();
|
|
5361
6016
|
return e.setStartBefore(s), e.setEndAfter(c), r.removeAllRanges(), r.addRange(e), e;
|
|
5362
6017
|
})() || r.removeAllRanges(), H.normalizeAroundSelection(r), n.forEach((e) => {
|
|
5363
|
-
|
|
6018
|
+
Wa(e) && e.remove();
|
|
5364
6019
|
}), this.notifySelectionChange();
|
|
5365
6020
|
}
|
|
5366
6021
|
replaceRangeWithHtml(t, n) {
|
|
@@ -5400,7 +6055,7 @@ var $i = (e, t) => {
|
|
|
5400
6055
|
n.selectNodeContents(e), t.removeAllRanges(), t.addRange(n);
|
|
5401
6056
|
}
|
|
5402
6057
|
isRangeBold(e, t) {
|
|
5403
|
-
return
|
|
6058
|
+
return G(e, L, t);
|
|
5404
6059
|
}
|
|
5405
6060
|
removeNestedBold(e) {
|
|
5406
6061
|
e.querySelectorAll("b,strong").forEach((e) => {
|
|
@@ -5443,7 +6098,7 @@ var $i = (e, t) => {
|
|
|
5443
6098
|
updateToolbarButtonState() {
|
|
5444
6099
|
let e = window.getSelection();
|
|
5445
6100
|
if (!e) return;
|
|
5446
|
-
let t = e.anchorNode, n = (t == null ? void 0 : t.nodeType) === Node.ELEMENT_NODE ? t : t == null ? void 0 : t.parentElement, r = n == null ? void 0 : n.closest(y
|
|
6101
|
+
let t = e.anchorNode, n = (t == null ? void 0 : t.nodeType) === Node.ELEMENT_NODE ? t : t == null ? void 0 : t.parentElement, r = n == null ? void 0 : n.closest(f(y.editor));
|
|
5447
6102
|
if (!r) return;
|
|
5448
6103
|
let i = r.querySelector("[data-blok-testid=inline-toolbar]");
|
|
5449
6104
|
if (!(i instanceof HTMLElement)) return;
|
|
@@ -5485,7 +6140,7 @@ var $i = (e, t) => {
|
|
|
5485
6140
|
}
|
|
5486
6141
|
static findBlokScopeFromNode(e) {
|
|
5487
6142
|
let t = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
|
|
5488
|
-
return !t || typeof t.closest != "function" ? null : t.closest(`${y
|
|
6143
|
+
return !t || typeof t.closest != "function" ? null : t.closest(`${f(y.interface)}, ${f(y.editor)}`);
|
|
5489
6144
|
}
|
|
5490
6145
|
static getBoundaryBold(t) {
|
|
5491
6146
|
let n = t.startContainer;
|
|
@@ -5496,18 +6151,18 @@ var $i = (e, t) => {
|
|
|
5496
6151
|
if (e.startOffset === n) return R(t);
|
|
5497
6152
|
if (e.startOffset !== 0) return null;
|
|
5498
6153
|
let r = t.previousSibling;
|
|
5499
|
-
return
|
|
6154
|
+
return Ua(r) ? r : null;
|
|
5500
6155
|
}
|
|
5501
6156
|
static getBoundaryBoldForElement(e, t) {
|
|
5502
6157
|
if (e.startOffset <= 0) return null;
|
|
5503
6158
|
let n = t.childNodes[e.startOffset - 1];
|
|
5504
|
-
return
|
|
6159
|
+
return Ua(n) ? n : null;
|
|
5505
6160
|
}
|
|
5506
6161
|
static isSelectionInsideBlok(e) {
|
|
5507
6162
|
let t = e.anchorNode;
|
|
5508
6163
|
if (!t) return !1;
|
|
5509
6164
|
let n = t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement;
|
|
5510
|
-
return !!(n != null && n.closest(y
|
|
6165
|
+
return !!(n != null && n.closest(f(y.editor)));
|
|
5511
6166
|
}
|
|
5512
6167
|
getRangeHtmlWithoutBold(e) {
|
|
5513
6168
|
let t = e.cloneContents();
|
|
@@ -5520,16 +6175,16 @@ var $i = (e, t) => {
|
|
|
5520
6175
|
return t.innerHTML = e, t.content;
|
|
5521
6176
|
}
|
|
5522
6177
|
collectBoldAncestors(e) {
|
|
5523
|
-
return
|
|
6178
|
+
return K(e, L);
|
|
5524
6179
|
}
|
|
5525
6180
|
};
|
|
5526
|
-
|
|
6181
|
+
q = eo, q.isInline = !0, q.title = "Bold", q.titleKey = "bold", q.markerSequence = 0, q.isProcessingMutation = !1, q.instances = /* @__PURE__ */ new Set(), q.guardKeydownListenerRegistered = !1, q.shortcut = "CMD+B";
|
|
5527
6182
|
//#endregion
|
|
5528
6183
|
//#region src/components/inline-tools/inline-tool-italic.ts
|
|
5529
|
-
var
|
|
6184
|
+
var J, to = (e) => {
|
|
5530
6185
|
let t = e.tagName;
|
|
5531
6186
|
return t === "I" || t === "EM";
|
|
5532
|
-
},
|
|
6187
|
+
}, no = class {
|
|
5533
6188
|
static get sanitize() {
|
|
5534
6189
|
return {
|
|
5535
6190
|
i: {},
|
|
@@ -5538,7 +6193,7 @@ var q, ra = (e) => {
|
|
|
5538
6193
|
}
|
|
5539
6194
|
render() {
|
|
5540
6195
|
return {
|
|
5541
|
-
icon:
|
|
6196
|
+
icon: rt,
|
|
5542
6197
|
name: "italic",
|
|
5543
6198
|
onActivate: () => {
|
|
5544
6199
|
this.toggleItalic();
|
|
@@ -5578,7 +6233,7 @@ var q, ra = (e) => {
|
|
|
5578
6233
|
return this.isRangeItalic(t, { ignoreWhitespace: !0 });
|
|
5579
6234
|
}
|
|
5580
6235
|
isRangeItalic(e, t) {
|
|
5581
|
-
return
|
|
6236
|
+
return G(e, to, t);
|
|
5582
6237
|
}
|
|
5583
6238
|
wrapWithItalic(e) {
|
|
5584
6239
|
let t = this.getRangeHtmlWithoutItalic(e), n = this.replaceRangeWithHtml(e, `<i>${t}</i>`), r = window.getSelection();
|
|
@@ -5604,13 +6259,13 @@ var q, ra = (e) => {
|
|
|
5604
6259
|
});
|
|
5605
6260
|
}
|
|
5606
6261
|
hasItalicParent(e) {
|
|
5607
|
-
return
|
|
6262
|
+
return W(e, to);
|
|
5608
6263
|
}
|
|
5609
6264
|
findItalicElement(e) {
|
|
5610
|
-
return U(e,
|
|
6265
|
+
return U(e, to);
|
|
5611
6266
|
}
|
|
5612
6267
|
collectItalicAncestors(e) {
|
|
5613
|
-
return
|
|
6268
|
+
return K(e, to);
|
|
5614
6269
|
}
|
|
5615
6270
|
getRangeHtmlWithoutItalic(e) {
|
|
5616
6271
|
let t = e.cloneContents();
|
|
@@ -5667,10 +6322,10 @@ var q, ra = (e) => {
|
|
|
5667
6322
|
n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
|
|
5668
6323
|
}
|
|
5669
6324
|
};
|
|
5670
|
-
|
|
6325
|
+
J = no, J.isInline = !0, J.title = "Italic", J.titleKey = "italic", J.shortcut = "CMD+I";
|
|
5671
6326
|
//#endregion
|
|
5672
6327
|
//#region src/components/inline-tools/inline-tool-link.ts
|
|
5673
|
-
var
|
|
6328
|
+
var Y, ro = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text-left cursor-pointer can-hover:hover:bg-item-hover-bg transition-colors", io = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text-left pointer-events-none", ao = class {
|
|
5674
6329
|
static get sanitize() {
|
|
5675
6330
|
return { a: {
|
|
5676
6331
|
href: !0,
|
|
@@ -5690,17 +6345,17 @@ var J, aa = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text
|
|
|
5690
6345
|
button: null
|
|
5691
6346
|
}, this.inputOpened = !1, this.unlinkAvailable = !1, this.handleButtonClick = (e) => {
|
|
5692
6347
|
!this.inputOpened || !this.unlinkAvailable || (e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation(), this.restoreSelection(), this.unlink(), this.inlineToolbar.close());
|
|
5693
|
-
}, this.toolbar = e.toolbar, this.inlineToolbar = e.inlineToolbar, this.notifier = e.notifier, this.i18n = e.i18n, this.selection = new
|
|
6348
|
+
}, this.toolbar = e.toolbar, this.inlineToolbar = e.inlineToolbar, this.notifier = e.notifier, this.i18n = e.i18n, this.selection = new b(), this.nodes.input = this.createInput(), this.nodes.suggestion = this.createSuggestion(), this.nodes.inputWrapper = document.createElement("div"), this.nodes.inputWrapper.append(this.nodes.input, this.nodes.suggestion);
|
|
5694
6349
|
}
|
|
5695
6350
|
render() {
|
|
5696
6351
|
return {
|
|
5697
|
-
icon:
|
|
6352
|
+
icon: Ke,
|
|
5698
6353
|
name: "link",
|
|
5699
6354
|
isActive: () => !!this.selection.findParentTag("A"),
|
|
5700
6355
|
children: {
|
|
5701
6356
|
hideChevron: !0,
|
|
5702
6357
|
items: [{
|
|
5703
|
-
type:
|
|
6358
|
+
type: _.Html,
|
|
5704
6359
|
element: this.nodes.inputWrapper
|
|
5705
6360
|
}],
|
|
5706
6361
|
onOpen: () => {
|
|
@@ -5730,7 +6385,7 @@ var J, aa = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text
|
|
|
5730
6385
|
let t = document.createElement("div");
|
|
5731
6386
|
t.className = "mt-1 mb-0.5 h-px bg-link-input-border";
|
|
5732
6387
|
let n = document.createElement("button");
|
|
5733
|
-
n.type = "button", n.className =
|
|
6388
|
+
n.type = "button", n.className = ro, n.setAttribute("data-link-suggestion-row", "");
|
|
5734
6389
|
let r = document.createElement("span");
|
|
5735
6390
|
r.className = "text-gray-text shrink-0 flex [&>svg]:size-7", r.setAttribute("data-link-suggestion-icon", "");
|
|
5736
6391
|
let i = document.createElement("span");
|
|
@@ -5748,20 +6403,20 @@ var J, aa = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text
|
|
|
5748
6403
|
return;
|
|
5749
6404
|
}
|
|
5750
6405
|
let n = this.isLinkComplete(t), { icon: r, label: i } = this.getLinkTypeInfo(t), a = this.nodes.suggestion.querySelector("[data-link-suggestion-icon]"), o = this.nodes.suggestion.querySelector("[data-link-suggestion-url]"), s = this.nodes.suggestion.querySelector("[data-link-suggestion-type]"), c = this.nodes.suggestion.querySelector("[data-link-suggestion-row]");
|
|
5751
|
-
a && (a.innerHTML = r, a.className = `${n ? "text-gray-text" : "text-gray-text opacity-40"} shrink-0 flex [&>svg]:size-7`), o && (o.textContent = t, o.className = `block text-xs font-medium truncate ${n ? "text-text-primary" : "text-gray-text"}`), s && (s.textContent = n ? i : "Keep typing to add a link", s.className = "block text-[10.5px] text-gray-text leading-tight mt-px"), c && (c.className = n ?
|
|
6406
|
+
a && (a.innerHTML = r, a.className = `${n ? "text-gray-text" : "text-gray-text opacity-40"} shrink-0 flex [&>svg]:size-7`), o && (o.textContent = t, o.className = `block text-xs font-medium truncate ${n ? "text-text-primary" : "text-gray-text"}`), s && (s.textContent = n ? i : "Keep typing to add a link", s.className = "block text-[10.5px] text-gray-text leading-tight mt-px"), c && (c.className = n ? ro : io), this.nodes.suggestion.classList.remove("hidden");
|
|
5752
6407
|
}
|
|
5753
6408
|
isLinkComplete(e) {
|
|
5754
6409
|
return /^https?:\/\//i.test(e) ? e.replace(/^https?:\/\//i, "").length > 0 : /^\w+:\/\//.test(e) ? e.replace(/^\w+:\/\//, "").length > 0 : /^\w+:/.test(e) ? e.slice(e.indexOf(":") + 1).length > 0 : e.startsWith("//") ? e.slice(2).length > 0 : e.startsWith("#") ? e.length > 1 : e.startsWith("/") ? !0 : /\.[a-zA-Z]{2,}/.test(e) || /^\d{1,3}(\.\d{1,3}){3}/.test(e);
|
|
5755
6410
|
}
|
|
5756
6411
|
getLinkTypeInfo(e) {
|
|
5757
6412
|
return e.startsWith("mailto:") ? {
|
|
5758
|
-
icon:
|
|
6413
|
+
icon: Je,
|
|
5759
6414
|
label: "Email address"
|
|
5760
6415
|
} : e.startsWith("#") ? {
|
|
5761
|
-
icon:
|
|
6416
|
+
icon: ee,
|
|
5762
6417
|
label: "Jump to section"
|
|
5763
6418
|
} : {
|
|
5764
|
-
icon:
|
|
6419
|
+
icon: ve,
|
|
5765
6420
|
label: "Link to web page"
|
|
5766
6421
|
};
|
|
5767
6422
|
}
|
|
@@ -5786,7 +6441,7 @@ var J, aa = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text
|
|
|
5786
6441
|
let e = t.getAttribute("href");
|
|
5787
6442
|
this.nodes.input.value = e === null ? "" : e;
|
|
5788
6443
|
} else this.nodes.input.value = "";
|
|
5789
|
-
this.updateSuggestion(this.nodes.input.value), this.nodes.input.className =
|
|
6444
|
+
this.updateSuggestion(this.nodes.input.value), this.nodes.input.className = C(this.INPUT_BASE_CLASSES, "block"), this.setBooleanStateAttribute(this.nodes.input, this.DATA_ATTRIBUTES.inputOpened, !0), this.selection.setFakeBackground(), this.selection.save(), e && this.focusInputWithRetry(), this.inputOpened = !0;
|
|
5790
6445
|
}
|
|
5791
6446
|
focusInputWithRetry() {
|
|
5792
6447
|
this.nodes.input && (this.nodes.input.focus(), !(typeof window > "u" || typeof document > "u") && window.setTimeout(() => {
|
|
@@ -5797,7 +6452,7 @@ var J, aa = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text
|
|
|
5797
6452
|
}, 0));
|
|
5798
6453
|
}
|
|
5799
6454
|
getButtonElement() {
|
|
5800
|
-
let e = document.querySelector(`${y
|
|
6455
|
+
let e = document.querySelector(`${f(y.interface, fe)} [data-blok-item-name="link"]`);
|
|
5801
6456
|
return e && e !== this.nodes.button && (e.addEventListener("click", this.handleButtonClick, !0), this.nodes.button = e), e;
|
|
5802
6457
|
}
|
|
5803
6458
|
updateButtonStateAttributes(e) {
|
|
@@ -5811,7 +6466,7 @@ var J, aa = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text
|
|
|
5811
6466
|
(this.selection.isFakeBackgroundEnabled || e && this.selection.savedSelectionRange) && this.restoreSelection(), this.nodes.input && (this.nodes.input.className = this.INPUT_BASE_CLASSES, this.setBooleanStateAttribute(this.nodes.input, this.DATA_ATTRIBUTES.inputOpened, !1), this.nodes.input.value = "", (t = this.nodes.suggestion) == null || t.classList.add("hidden"), this.updateButtonStateAttributes(!1), this.unlinkAvailable = !1, e && this.selection.clearSaved(), this.inputOpened = !1);
|
|
5812
6467
|
}
|
|
5813
6468
|
restoreSelection() {
|
|
5814
|
-
let e = new
|
|
6469
|
+
let e = new b(), t = b.isAtBlok;
|
|
5815
6470
|
if (t && e.save(), this.selection.removeFakeBackground(), this.selection.restore(), !t && this.selection.savedSelectionRange) {
|
|
5816
6471
|
let e = this.selection.savedSelectionRange.commonAncestorContainer, t = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
|
|
5817
6472
|
t == null || t.focus();
|
|
@@ -5835,7 +6490,7 @@ var J, aa = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text
|
|
|
5835
6490
|
this.notifier.show({
|
|
5836
6491
|
message: this.i18n.t("tools.link.invalidLink"),
|
|
5837
6492
|
style: "error"
|
|
5838
|
-
}),
|
|
6493
|
+
}), me("Incorrect Link pasted", "warn", t);
|
|
5839
6494
|
return;
|
|
5840
6495
|
}
|
|
5841
6496
|
let n = this.prepareLink(t);
|
|
@@ -5858,7 +6513,7 @@ var J, aa = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text
|
|
|
5858
6513
|
this.selection.expandToTag(t), t.href = e, t.target = "_blank", t.rel = "nofollow";
|
|
5859
6514
|
return;
|
|
5860
6515
|
}
|
|
5861
|
-
let n =
|
|
6516
|
+
let n = b.range;
|
|
5862
6517
|
if (!n) return;
|
|
5863
6518
|
let r = document.createElement("a");
|
|
5864
6519
|
r.href = e, r.target = "_blank", r.rel = "nofollow", r.appendChild(n.extractContents()), n.insertNode(r), this.selection.expandToTag(r);
|
|
@@ -5877,13 +6532,13 @@ var J, aa = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text
|
|
|
5877
6532
|
e && e.setAttribute(t, n ? "true" : "false");
|
|
5878
6533
|
}
|
|
5879
6534
|
};
|
|
5880
|
-
|
|
6535
|
+
Y = ao, Y.isInline = !0, Y.title = "Link", Y.titleKey = "link", Y.shortcut = "CMD+K";
|
|
5881
6536
|
//#endregion
|
|
5882
6537
|
//#region src/components/inline-tools/utils/marker-dom-utils.ts
|
|
5883
|
-
var
|
|
6538
|
+
var X = (e) => e.tagName === "MARK", oo = (e) => U(e, X), Z, so = {
|
|
5884
6539
|
color: "background-color",
|
|
5885
6540
|
"background-color": "color"
|
|
5886
|
-
},
|
|
6541
|
+
}, co = class e {
|
|
5887
6542
|
static get sanitize() {
|
|
5888
6543
|
return { mark: (t) => {
|
|
5889
6544
|
let n = t.style, r = Array.from({ length: n.length }, (e, t) => n.item(t));
|
|
@@ -5892,7 +6547,7 @@ var Y = (e) => e.tagName === "MARK", ca = (e) => U(e, Y), X, la = {
|
|
|
5892
6547
|
} };
|
|
5893
6548
|
}
|
|
5894
6549
|
constructor({ api: e }) {
|
|
5895
|
-
this.colorMode = "color", this.activeTextColor = null, this.activeBgColor = null, this.i18n = e.i18n, this.inlineToolbar = e.inlineToolbar, this.selection = new
|
|
6550
|
+
this.colorMode = "color", this.activeTextColor = null, this.activeBgColor = null, this.i18n = e.i18n, this.inlineToolbar = e.inlineToolbar, this.selection = new b(), this.picker = yr({
|
|
5896
6551
|
i18n: this.i18n,
|
|
5897
6552
|
testIdPrefix: "marker",
|
|
5898
6553
|
modes: [{
|
|
@@ -5911,12 +6566,12 @@ var Y = (e) => e.tagName === "MARK", ca = (e) => U(e, Y), X, la = {
|
|
|
5911
6566
|
}
|
|
5912
6567
|
render() {
|
|
5913
6568
|
return {
|
|
5914
|
-
icon:
|
|
6569
|
+
icon: tt,
|
|
5915
6570
|
name: "marker",
|
|
5916
6571
|
isActive: () => {
|
|
5917
6572
|
let e = window.getSelection();
|
|
5918
6573
|
if (!e || e.rangeCount === 0) return !1;
|
|
5919
|
-
let t = e.getRangeAt(0), n =
|
|
6574
|
+
let t = e.getRangeAt(0), n = G(t, X, { ignoreWhitespace: !0 });
|
|
5920
6575
|
if (n) {
|
|
5921
6576
|
let e = this.detectBothSelectionColors(t);
|
|
5922
6577
|
this.updateToolbarColors(e.text, e.bg);
|
|
@@ -5926,7 +6581,7 @@ var Y = (e) => e.tagName === "MARK", ca = (e) => U(e, Y), X, la = {
|
|
|
5926
6581
|
children: {
|
|
5927
6582
|
hideChevron: !0,
|
|
5928
6583
|
items: [{
|
|
5929
|
-
type:
|
|
6584
|
+
type: _.Html,
|
|
5930
6585
|
element: this.picker.element
|
|
5931
6586
|
}],
|
|
5932
6587
|
onOpen: () => {
|
|
@@ -5967,10 +6622,10 @@ var Y = (e) => e.tagName === "MARK", ca = (e) => U(e, Y), X, la = {
|
|
|
5967
6622
|
if (!r || r.rangeCount === 0) return;
|
|
5968
6623
|
let i = r.getRangeAt(0), a = i.startContainer, o = i.startOffset, s = i.endContainer, c = i.endOffset, l = i.toString(), u = i.commonAncestorContainer, d = u.nodeType === Node.ELEMENT_NODE ? u : u.parentElement, f = d != null && d.closest("mark") ? (t = (n = d.closest("mark")) == null ? void 0 : n.parentElement) == null ? d : t : d;
|
|
5969
6624
|
this.splitMarksAtBoundaries(i);
|
|
5970
|
-
let p =
|
|
6625
|
+
let p = K(i, X);
|
|
5971
6626
|
for (let t of p) {
|
|
5972
6627
|
t.style.removeProperty(e);
|
|
5973
|
-
let n =
|
|
6628
|
+
let n = so[e], r = t.style.getPropertyValue(n);
|
|
5974
6629
|
r !== "" && r !== "transparent" ? this.ensureTransparentBg(t) : this.unwrapElement(t);
|
|
5975
6630
|
}
|
|
5976
6631
|
let m = a.isConnected, h = s.isConnected;
|
|
@@ -5998,7 +6653,7 @@ var Y = (e) => e.tagName === "MARK", ca = (e) => U(e, Y), X, la = {
|
|
|
5998
6653
|
this.selection.removeFakeBackground(), this.selection.savedSelectionRange && this.selection.restore(), this.selection.clearSaved();
|
|
5999
6654
|
}
|
|
6000
6655
|
detectBothSelectionColors(e) {
|
|
6001
|
-
let t =
|
|
6656
|
+
let t = oo(e.startContainer);
|
|
6002
6657
|
if (!t) return {
|
|
6003
6658
|
text: null,
|
|
6004
6659
|
bg: null
|
|
@@ -6018,7 +6673,7 @@ var Y = (e) => e.tagName === "MARK", ca = (e) => U(e, Y), X, la = {
|
|
|
6018
6673
|
text: null,
|
|
6019
6674
|
bg: null
|
|
6020
6675
|
};
|
|
6021
|
-
let t =
|
|
6676
|
+
let t = oo(e.getRangeAt(0).startContainer);
|
|
6022
6677
|
if (!t) return {
|
|
6023
6678
|
text: null,
|
|
6024
6679
|
bg: null
|
|
@@ -6038,14 +6693,14 @@ var Y = (e) => e.tagName === "MARK", ca = (e) => U(e, Y), X, la = {
|
|
|
6038
6693
|
this.selection.savedSelectionRange && (this.selection.removeFakeBackground(), this.selection.restore(), this.selection.clearSaved());
|
|
6039
6694
|
}
|
|
6040
6695
|
findContainingMark(e) {
|
|
6041
|
-
let t =
|
|
6696
|
+
let t = oo(e.startContainer), n = oo(e.endContainer);
|
|
6042
6697
|
return t && t === n ? t : null;
|
|
6043
6698
|
}
|
|
6044
6699
|
removeNestedMarkStyle(e, t) {
|
|
6045
|
-
let n =
|
|
6700
|
+
let n = K(e, X);
|
|
6046
6701
|
for (let e of n) {
|
|
6047
6702
|
e.style.removeProperty(t);
|
|
6048
|
-
let n =
|
|
6703
|
+
let n = so[t], r = e.style.getPropertyValue(n);
|
|
6049
6704
|
r !== "" && r !== "transparent" ? this.ensureTransparentBg(e) : this.unwrapElement(e);
|
|
6050
6705
|
}
|
|
6051
6706
|
}
|
|
@@ -6076,7 +6731,7 @@ var Y = (e) => e.tagName === "MARK", ca = (e) => U(e, Y), X, la = {
|
|
|
6076
6731
|
}
|
|
6077
6732
|
}
|
|
6078
6733
|
splitMarksAtBoundaries(e) {
|
|
6079
|
-
let t =
|
|
6734
|
+
let t = K(e, X);
|
|
6080
6735
|
for (let n of t) {
|
|
6081
6736
|
let t = document.createRange();
|
|
6082
6737
|
t.selectNodeContents(n);
|
|
@@ -6141,20 +6796,20 @@ var Y = (e) => e.tagName === "MARK", ca = (e) => U(e, Y), X, la = {
|
|
|
6141
6796
|
}
|
|
6142
6797
|
resolveToVar(e, t) {
|
|
6143
6798
|
if (e.startsWith("var(")) return e;
|
|
6144
|
-
let n = t === "color" ? "text" : "bg", r =
|
|
6145
|
-
return r === null ? e :
|
|
6799
|
+
let n = t === "color" ? "text" : "bg", r = ze(e, n);
|
|
6800
|
+
return r === null ? e : u(r, n);
|
|
6146
6801
|
}
|
|
6147
6802
|
};
|
|
6148
|
-
|
|
6803
|
+
Z = co, Z.isInline = !0, Z.title = "Color", Z.titleKey = "marker", Z.shortcut = "CMD+SHIFT+H", Z.ALLOWED_STYLE_PROPS = new Set(["color", "background-color"]);
|
|
6149
6804
|
//#endregion
|
|
6150
6805
|
//#region src/components/inline-tools/inline-tool-underline.ts
|
|
6151
|
-
var
|
|
6806
|
+
var Q, lo = (e) => e.tagName === "U", uo = class {
|
|
6152
6807
|
static get sanitize() {
|
|
6153
6808
|
return { u: {} };
|
|
6154
6809
|
}
|
|
6155
6810
|
render() {
|
|
6156
6811
|
return {
|
|
6157
|
-
icon:
|
|
6812
|
+
icon: ct,
|
|
6158
6813
|
name: "underline",
|
|
6159
6814
|
onActivate: () => {
|
|
6160
6815
|
this.toggleUnderline();
|
|
@@ -6194,7 +6849,7 @@ var Z, da = (e) => e.tagName === "U", fa = class {
|
|
|
6194
6849
|
return this.isRangeUnderline(t, { ignoreWhitespace: !0 });
|
|
6195
6850
|
}
|
|
6196
6851
|
isRangeUnderline(e, t) {
|
|
6197
|
-
return
|
|
6852
|
+
return G(e, lo, t);
|
|
6198
6853
|
}
|
|
6199
6854
|
wrapWithUnderline(e) {
|
|
6200
6855
|
let t = this.getRangeHtmlWithoutUnderline(e), n = this.replaceRangeWithHtml(e, `<u>${t}</u>`), r = window.getSelection();
|
|
@@ -6220,13 +6875,13 @@ var Z, da = (e) => e.tagName === "U", fa = class {
|
|
|
6220
6875
|
});
|
|
6221
6876
|
}
|
|
6222
6877
|
hasUnderlineParent(e) {
|
|
6223
|
-
return
|
|
6878
|
+
return W(e, lo);
|
|
6224
6879
|
}
|
|
6225
6880
|
findUnderlineElement(e) {
|
|
6226
|
-
return U(e,
|
|
6881
|
+
return U(e, lo);
|
|
6227
6882
|
}
|
|
6228
6883
|
collectUnderlineAncestors(e) {
|
|
6229
|
-
return
|
|
6884
|
+
return K(e, lo);
|
|
6230
6885
|
}
|
|
6231
6886
|
getRangeHtmlWithoutUnderline(e) {
|
|
6232
6887
|
let t = e.cloneContents();
|
|
@@ -6283,16 +6938,16 @@ var Z, da = (e) => e.tagName === "U", fa = class {
|
|
|
6283
6938
|
n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
|
|
6284
6939
|
}
|
|
6285
6940
|
};
|
|
6286
|
-
|
|
6941
|
+
Q = uo, Q.isInline = !0, Q.title = "Underline", Q.titleKey = "underline", Q.shortcut = "CMD+U";
|
|
6287
6942
|
//#endregion
|
|
6288
6943
|
//#region src/components/inline-tools/inline-tool-strikethrough.ts
|
|
6289
|
-
var
|
|
6944
|
+
var $, fo = (e) => e.tagName === "S", po = class {
|
|
6290
6945
|
static get sanitize() {
|
|
6291
6946
|
return { s: {} };
|
|
6292
6947
|
}
|
|
6293
6948
|
render() {
|
|
6294
6949
|
return {
|
|
6295
|
-
icon:
|
|
6950
|
+
icon: Xe,
|
|
6296
6951
|
name: "strikethrough",
|
|
6297
6952
|
onActivate: () => {
|
|
6298
6953
|
this.toggleStrikethrough();
|
|
@@ -6332,7 +6987,7 @@ var Q, $ = (e) => e.tagName === "S", pa = class {
|
|
|
6332
6987
|
return this.isRangeStrikethrough(t, { ignoreWhitespace: !0 });
|
|
6333
6988
|
}
|
|
6334
6989
|
isRangeStrikethrough(e, t) {
|
|
6335
|
-
return
|
|
6990
|
+
return G(e, fo, t);
|
|
6336
6991
|
}
|
|
6337
6992
|
wrapWithStrikethrough(e) {
|
|
6338
6993
|
let t = this.getRangeHtmlWithoutStrikethrough(e), n = this.replaceRangeWithHtml(e, `<s>${t}</s>`), r = window.getSelection();
|
|
@@ -6358,13 +7013,13 @@ var Q, $ = (e) => e.tagName === "S", pa = class {
|
|
|
6358
7013
|
});
|
|
6359
7014
|
}
|
|
6360
7015
|
hasStrikethroughParent(e) {
|
|
6361
|
-
return
|
|
7016
|
+
return W(e, fo);
|
|
6362
7017
|
}
|
|
6363
7018
|
findStrikethroughElement(e) {
|
|
6364
|
-
return U(e,
|
|
7019
|
+
return U(e, fo);
|
|
6365
7020
|
}
|
|
6366
7021
|
collectStrikethroughAncestors(e) {
|
|
6367
|
-
return
|
|
7022
|
+
return K(e, fo);
|
|
6368
7023
|
}
|
|
6369
7024
|
getRangeHtmlWithoutStrikethrough(e) {
|
|
6370
7025
|
let t = e.cloneContents();
|
|
@@ -6421,16 +7076,17 @@ var Q, $ = (e) => e.tagName === "S", pa = class {
|
|
|
6421
7076
|
n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
|
|
6422
7077
|
}
|
|
6423
7078
|
};
|
|
6424
|
-
|
|
7079
|
+
$ = po, $.isInline = !0, $.title = "Strikethrough", $.titleKey = "strikethrough", $.shortcut = "CMD+SHIFT+S";
|
|
6425
7080
|
//#endregion
|
|
6426
7081
|
//#region src/tools/index.ts
|
|
6427
|
-
var
|
|
7082
|
+
var mo = {
|
|
6428
7083
|
paragraph: { preserveBlank: !0 },
|
|
6429
7084
|
header: {},
|
|
6430
7085
|
list: {},
|
|
6431
7086
|
table: {},
|
|
6432
|
-
toggle: {}
|
|
6433
|
-
|
|
7087
|
+
toggle: {},
|
|
7088
|
+
callout: {}
|
|
7089
|
+
}, ho = {
|
|
6434
7090
|
bold: {},
|
|
6435
7091
|
italic: {},
|
|
6436
7092
|
link: {},
|
|
@@ -6439,4 +7095,4 @@ var ma = {
|
|
|
6439
7095
|
strikethrough: {}
|
|
6440
7096
|
};
|
|
6441
7097
|
//#endregion
|
|
6442
|
-
export {
|
|
7098
|
+
export { co as a, eo as c, Zi as d, er as f, uo as i, Ha as l, xt as m, ho as n, ao as o, It as p, po as r, no as s, mo as t, na as u };
|