@jackuait/blok 0.8.3-beta.3 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blok.mjs +2 -2
- package/dist/chunks/{blok-AX-spzEU.mjs → blok-RJ3hyzDH.mjs} +1216 -1132
- package/dist/chunks/{constants-B-YnSMJS.mjs → constants-A3iVmQL8.mjs} +55 -55
- package/dist/chunks/{i18next-loader-BCAGutUy.mjs → i18next-loader-dH3UPF7S.mjs} +1 -1
- package/dist/chunks/{lightweight-i18n-CNUuUkuo.mjs → lightweight-i18n-1rbaxIZW.mjs} +1 -0
- package/dist/{messages-Z8dpjy_K2.mjs → chunks/messages--eH7tTJV2.mjs} +1 -0
- package/dist/chunks/{messages-Dmxk7uOK.mjs → messages-0zhE8A9X.mjs} +1 -0
- package/dist/{messages-UpoT1AS6.mjs → chunks/messages-517llQmh.mjs} +1 -0
- package/dist/chunks/{messages-B-x11A7Z.mjs → messages-7uCUVFea.mjs} +1 -0
- package/dist/{messages-ItP2i78l.mjs → chunks/messages-B0t2L3bi.mjs} +1 -0
- package/dist/{messages-DkaJV53s2.mjs → chunks/messages-B1kDfIN82.mjs} +1 -0
- package/dist/{messages-DffJ5W5G.mjs → chunks/messages-BDvpl6Ox.mjs} +1 -0
- package/dist/{messages-CjCjr0wW.mjs → chunks/messages-BG8Nq35G.mjs} +1 -0
- package/dist/{messages-BMUQ7kA62.mjs → chunks/messages-BGE43_6M.mjs} +1 -0
- package/dist/chunks/{messages-K453lCht2.mjs → messages-BGssMBWM2.mjs} +1 -0
- package/dist/chunks/{messages-2i0z2hFq2.mjs → messages-BSw88lIo2.mjs} +1 -0
- package/dist/{messages-D0KBToO12.mjs → chunks/messages-BW8arxf72.mjs} +1 -0
- package/dist/chunks/{messages-D6EtVUzk2.mjs → messages-BkES2MDr2.mjs} +1 -0
- package/dist/chunks/{messages-CbilQw5o2.mjs → messages-BsZz1Hnn2.mjs} +1 -0
- package/dist/{messages-tFDVfvWL.mjs → chunks/messages-BtUqUzMG2.mjs} +1 -0
- package/dist/{messages-BvIBkUCG2.mjs → chunks/messages-BwKs-9DF.mjs} +1 -0
- package/dist/{messages-D2Xo8E0P.mjs → chunks/messages-C0hQPZmh2.mjs} +1 -0
- package/dist/{messages-rgXeOQMh2.mjs → chunks/messages-C4X0xP3h.mjs} +1 -0
- package/dist/chunks/{messages-DlSDBHih.mjs → messages-C4ZAJzBh.mjs} +1 -0
- package/dist/{messages-Bkv2sk7Y.mjs → chunks/messages-C5-aaU2b.mjs} +1 -0
- package/dist/{messages-BcrsCh5-2.mjs → chunks/messages-C7plNvNE2.mjs} +1 -0
- package/dist/{messages-Bn77ieXA.mjs → chunks/messages-C912bk5I.mjs} +1 -0
- package/dist/chunks/{messages-BRa1Itk_.mjs → messages-C9aKfCro.mjs} +1 -0
- package/dist/{messages-BD3lSUU_.mjs → chunks/messages-CCH4OETw2.mjs} +1 -0
- package/dist/{messages-BFbAM_pK2.mjs → chunks/messages-CFfpHyTU.mjs} +1 -0
- package/dist/{messages-C9AvcT0K.mjs → chunks/messages-CGh56r-H2.mjs} +1 -0
- package/dist/{messages-CWIigMhw2.mjs → chunks/messages-COJ0CbVV2.mjs} +1 -0
- package/dist/{messages-CH8tCpAX.mjs → chunks/messages-CTuCPqpJ.mjs} +1 -0
- package/dist/{messages-D7dJJ7dx.mjs → chunks/messages-CaRSYuhO.mjs} +1 -0
- package/dist/{messages-BXvE3YB4.mjs → chunks/messages-CjIA--kO.mjs} +1 -0
- package/dist/chunks/{messages-CEVMB1TN2.mjs → messages-ComLU2T32.mjs} +1 -0
- package/dist/chunks/{messages-DAhzpf-j.mjs → messages-CqZ9vFyx.mjs} +1 -0
- package/dist/chunks/{messages-CCywXuFz2.mjs → messages-Ct9UUOrl2.mjs} +1 -0
- package/dist/{messages-DaZkRhoM.mjs → chunks/messages-D2OZ9dbO.mjs} +1 -0
- package/dist/{messages-BZg8xxIT.mjs → chunks/messages-D8JFu42v.mjs} +1 -0
- package/dist/{messages-CJd52qP7.mjs → chunks/messages-DAbCNake2.mjs} +1 -0
- package/dist/{messages-Oqm_fCLp.mjs → chunks/messages-DHHZUf_H2.mjs} +1 -0
- package/dist/{messages-DFlT_TM02.mjs → chunks/messages-DJxXZi1D2.mjs} +1 -0
- package/dist/{messages-Cuw_6akN.mjs → chunks/messages-DKNULJpc.mjs} +1 -0
- package/dist/chunks/{messages-CTtFH-AE.mjs → messages-DLPrj3Dh.mjs} +1 -0
- package/dist/{messages-D5Uk_qYf.mjs → chunks/messages-DQ6bFum9.mjs} +1 -0
- package/dist/chunks/{messages-DVDFAJaw.mjs → messages-DRUkmDVZ.mjs} +1 -0
- package/dist/chunks/{messages-D1eXOdyJ.mjs → messages-DZzoT0T_.mjs} +1 -0
- package/dist/chunks/{messages-B3VMWaO8.mjs → messages-D_6vPBzT.mjs} +1 -0
- package/dist/{messages-Bgu3IB_k.mjs → chunks/messages-Da-SOTFW.mjs} +1 -0
- package/dist/{messages-CY_Fj715.mjs → chunks/messages-DdEWnfAR.mjs} +1 -0
- package/dist/chunks/{messages-CF7WlKOY.mjs → messages-DeSSxLsh.mjs} +1 -0
- package/dist/chunks/{messages-CqoOMgIb2.mjs → messages-Df2RYuup2.mjs} +1 -0
- package/dist/chunks/{messages-CDZrOiaR.mjs → messages-DfU4yvkL.mjs} +1 -0
- package/dist/{messages-D8SS2hOs2.mjs → chunks/messages-Dkp-Eyu02.mjs} +1 -0
- package/dist/chunks/{messages-qt_Tsj1u2.mjs → messages-Dl03jd4b2.mjs} +1 -0
- package/dist/chunks/{messages-LGqROvB5.mjs → messages-Dl6SVT1Z.mjs} +1 -0
- package/dist/{messages-ikSI7M732.mjs → chunks/messages-DmJf9laH2.mjs} +1 -0
- package/dist/chunks/{messages-CTI66ZU52.mjs → messages-DngM4hda2.mjs} +1 -0
- package/dist/{messages-Bf0eqjDJ.mjs → chunks/messages-DnuhgHG0.mjs} +1 -0
- package/dist/chunks/{messages-Cqxe2gIN.mjs → messages-Dsapm4K9.mjs} +1 -0
- package/dist/chunks/{messages-BHMUmX3N.mjs → messages-DxtnwNPo.mjs} +1 -0
- package/dist/chunks/{messages-lu4RI1A3.mjs → messages-Dyku8Cut.mjs} +1 -0
- package/dist/chunks/{messages-ByeBRHpJ.mjs → messages-OdEuBvgf.mjs} +1 -0
- package/dist/{messages-Cr2hTJyi2.mjs → chunks/messages-Yj4Q1_uX2.mjs} +1 -0
- package/dist/chunks/{messages-SOew8O6I.mjs → messages-Z762-GLL.mjs} +1 -0
- package/dist/{messages-DlEdd01l2.mjs → chunks/messages-_5Pg5fKy2.mjs} +1 -0
- package/dist/chunks/{messages-B2Xnfn7m2.mjs → messages-cegxHurd2.mjs} +1 -0
- package/dist/chunks/{messages-CLcwMAAe.mjs → messages-gaxTO-87.mjs} +1 -0
- package/dist/{messages-CGD9LR8l.mjs → chunks/messages-qS8tM3Dk.mjs} +1 -0
- package/dist/chunks/{messages-fdO2V2XC.mjs → messages-v9NkxRcL.mjs} +1 -0
- package/dist/chunks/{messages-B6n2OYKJ.mjs → messages-zGdqNZbH.mjs} +1 -0
- package/dist/chunks/{tools-tDa2fh-J.mjs → tools-nT6zA9QL.mjs} +751 -688
- package/dist/full.mjs +11 -11
- package/dist/locales.mjs +68 -67
- package/dist/{chunks/messages-CyrZJ9dG.mjs → messages-3WhPEFd7.mjs} +1 -0
- package/dist/{messages-C5MKR_WT2.mjs → messages-A8aZS7d_2.mjs} +1 -0
- package/dist/{chunks/messages-4epWYTzK.mjs → messages-B2YeJw8s2.mjs} +1 -0
- package/dist/{chunks/messages-D2QcrPYF.mjs → messages-B2ZwD4n9.mjs} +1 -0
- package/dist/{messages-DAjtVSb6.mjs → messages-B3jq5Hpa.mjs} +1 -0
- package/dist/{chunks/messages-B38lWmza.mjs → messages-B7jZvo-m.mjs} +1 -0
- package/dist/{chunks/messages-Dxa27UhV2.mjs → messages-BE0DjTEC.mjs} +1 -0
- package/dist/{chunks/messages-PDaWSrFT.mjs → messages-BLEVLZve.mjs} +1 -0
- package/dist/{messages-Dd4OTpH3.mjs → messages-BPRR6TMf.mjs} +1 -0
- package/dist/{messages--PYnorLu2.mjs → messages-BRcLIBCd2.mjs} +1 -0
- package/dist/{chunks/messages-Dqoj0eKD2.mjs → messages-BRxNqmJ8.mjs} +1 -0
- package/dist/{messages-ierNgYE02.mjs → messages-BSLErTnW2.mjs} +1 -0
- package/dist/{chunks/messages-cjqgX4JV2.mjs → messages-BfTBVFd9.mjs} +1 -0
- package/dist/{messages-CIGa1j8-2.mjs → messages-Bm0nvUuj2.mjs} +1 -0
- package/dist/{chunks/messages-C35b_LVM.mjs → messages-BmnC-s4X.mjs} +1 -0
- package/dist/{messages-Dc93MR86.mjs → messages-Bsd4ruEY.mjs} +1 -0
- package/dist/{chunks/messages-DvZa_OtS2.mjs → messages-BxJv0qBn2.mjs} +1 -0
- package/dist/{messages-DjWAR34D.mjs → messages-C-4z1-Dh.mjs} +1 -0
- package/dist/{messages-C6UkeZ0y.mjs → messages-C52AiyVV.mjs} +1 -0
- package/dist/{chunks/messages-D7qp-JvC.mjs → messages-C5pBfa_W.mjs} +1 -0
- package/dist/{messages-olK9oNtb.mjs → messages-C6WJx6Z0.mjs} +1 -0
- package/dist/{messages-BRJBZB-H2.mjs → messages-C6o0FVy02.mjs} +1 -0
- package/dist/{messages-D9a5iSFC2.mjs → messages-C8JVJUp12.mjs} +1 -0
- package/dist/{chunks/messages-Bo2PcQoc.mjs → messages-C8ca-jEa.mjs} +1 -0
- package/dist/{messages-B2X5gO-s.mjs → messages-COgvIEeW.mjs} +1 -0
- package/dist/{messages-CqbeAhjH.mjs → messages-CUDbNJG5.mjs} +1 -0
- package/dist/{messages-DPECmAwT.mjs → messages-CZTcgUzd.mjs} +1 -0
- package/dist/{messages-Dl7LQ_fI.mjs → messages-CbVilNPE.mjs} +1 -0
- package/dist/{chunks/messages-B847kJa02.mjs → messages-CdX1odk_2.mjs} +1 -0
- package/dist/{chunks/messages-CTGjizuJ2.mjs → messages-Cnz_SHE32.mjs} +1 -0
- package/dist/{messages-C_YAmOyQ.mjs → messages-CoCy2JIP.mjs} +1 -0
- package/dist/{chunks/messages-BN78Am3l2.mjs → messages-Cpeko5kB.mjs} +1 -0
- package/dist/{chunks/messages-DEVxqfH0.mjs → messages-Ct468oX22.mjs} +1 -0
- package/dist/{chunks/messages-DJ_gZym52.mjs → messages-CvIxHHp92.mjs} +1 -0
- package/dist/{chunks/messages-BrsB1FRe.mjs → messages-CxHn7cs2.mjs} +1 -0
- package/dist/{chunks/messages-xG65ERBM2.mjs → messages-CxruHsuD2.mjs} +1 -0
- package/dist/{chunks/messages-B1mCwtgm2.mjs → messages-D1P0QGLz2.mjs} +1 -0
- package/dist/{chunks/messages-CiSiPyKp.mjs → messages-D2HwpoUE.mjs} +1 -0
- package/dist/{chunks/messages-Kqu8QyYy2.mjs → messages-D2Mf9z2D.mjs} +1 -0
- package/dist/{messages-DUPXmcZh.mjs → messages-D4mCIODv.mjs} +1 -0
- package/dist/{chunks/messages-DHJIlD2m.mjs → messages-D6qfWi6H2.mjs} +1 -0
- package/dist/{chunks/messages-Dc2wd0BC2.mjs → messages-DL000FUf2.mjs} +1 -0
- package/dist/{messages-DBuHaabF2.mjs → messages-DNAp0U4l2.mjs} +1 -0
- package/dist/{messages-DR2Lgl002.mjs → messages-DSX2HaeN2.mjs} +1 -0
- package/dist/{messages-Buf_f_-32.mjs → messages-DT4rHATO2.mjs} +1 -0
- package/dist/{chunks/messages-BleThZm5.mjs → messages-DTNfG4ZH.mjs} +1 -0
- package/dist/{messages-DCjAu6M72.mjs → messages-D_CUdqU12.mjs} +1 -0
- package/dist/{messages-DVReQ5EC.mjs → messages-DaOnbI6d.mjs} +1 -0
- package/dist/{chunks/messages-uQOWdLDn2.mjs → messages-Dbsx9m5q2.mjs} +1 -0
- package/dist/{chunks/messages-CxKX6wTt.mjs → messages-DdiPWkV8.mjs} +1 -0
- package/dist/{chunks/messages-CBa6-NHn.mjs → messages-DfEPVRdJ.mjs} +1 -0
- package/dist/{chunks/messages-DvUNk-e7.mjs → messages-DfXh-i9o.mjs} +1 -0
- package/dist/{chunks/messages-Bqk7cuZY.mjs → messages-DgGZsxBB.mjs} +1 -0
- package/dist/{chunks/messages-ClD_3Kmk.mjs → messages-DpGo_Da5.mjs} +1 -0
- package/dist/{chunks/messages-CAH4L_Mq2.mjs → messages-Dtih3ffa2.mjs} +1 -0
- package/dist/{chunks/messages-DYQ87v5m.mjs → messages-Du62vI49.mjs} +1 -0
- package/dist/{messages-CC596_yM.mjs → messages-HNAtlVax.mjs} +1 -0
- package/dist/{messages-Bw0kGTAV.mjs → messages-I03yFhup.mjs} +1 -0
- package/dist/{messages-syo0DKqf.mjs → messages-O6z1uabG.mjs} +1 -0
- package/dist/{chunks/messages-LiQ7ni4i2.mjs → messages-Phrqr7a6.mjs} +1 -0
- package/dist/{messages-B_idm-Pp.mjs → messages-VBFioL2M.mjs} +1 -0
- package/dist/{messages-BTFWPbHk2.mjs → messages-cokJPuUp2.mjs} +1 -0
- package/dist/{chunks/messages-B8nL5cPA2.mjs → messages-diSPQ2Da2.mjs} +1 -0
- package/dist/{chunks/messages-DMENc4jZ.mjs → messages-sNSXCkeB.mjs} +1 -0
- package/dist/{messages-CJ5pCncM.mjs → messages-yZj20Fvf.mjs} +1 -0
- package/dist/{messages-BR1Hlhdc2.mjs → messages-ypuLZyw12.mjs} +1 -0
- package/dist/{chunks/messages-JQR7Z2f0.mjs → messages-zHkURG6V2.mjs} +1 -0
- package/dist/react.mjs +2 -2
- package/dist/tools.mjs +3 -3
- package/package.json +1 -1
- package/src/components/i18n/locales/am/messages.json +1 -0
- package/src/components/i18n/locales/ar/messages.json +1 -0
- package/src/components/i18n/locales/az/messages.json +1 -0
- package/src/components/i18n/locales/bg/messages.json +1 -0
- package/src/components/i18n/locales/bn/messages.json +1 -0
- package/src/components/i18n/locales/bs/messages.json +1 -0
- package/src/components/i18n/locales/cs/messages.json +1 -0
- package/src/components/i18n/locales/da/messages.json +1 -0
- package/src/components/i18n/locales/de/messages.json +1 -0
- package/src/components/i18n/locales/dv/messages.json +1 -0
- package/src/components/i18n/locales/el/messages.json +1 -0
- package/src/components/i18n/locales/en/messages.json +1 -0
- package/src/components/i18n/locales/es/messages.json +1 -0
- package/src/components/i18n/locales/et/messages.json +1 -0
- package/src/components/i18n/locales/fa/messages.json +1 -0
- package/src/components/i18n/locales/fi/messages.json +1 -0
- package/src/components/i18n/locales/fil/messages.json +1 -0
- package/src/components/i18n/locales/fr/messages.json +1 -0
- package/src/components/i18n/locales/gu/messages.json +1 -0
- package/src/components/i18n/locales/he/messages.json +1 -0
- package/src/components/i18n/locales/hi/messages.json +1 -0
- package/src/components/i18n/locales/hr/messages.json +1 -0
- package/src/components/i18n/locales/hu/messages.json +1 -0
- package/src/components/i18n/locales/hy/messages.json +1 -0
- package/src/components/i18n/locales/id/messages.json +1 -0
- package/src/components/i18n/locales/it/messages.json +1 -0
- package/src/components/i18n/locales/ja/messages.json +1 -0
- package/src/components/i18n/locales/ka/messages.json +1 -0
- package/src/components/i18n/locales/km/messages.json +1 -0
- package/src/components/i18n/locales/kn/messages.json +1 -0
- package/src/components/i18n/locales/ko/messages.json +1 -0
- package/src/components/i18n/locales/ku/messages.json +1 -0
- package/src/components/i18n/locales/lo/messages.json +1 -0
- package/src/components/i18n/locales/lt/messages.json +1 -0
- package/src/components/i18n/locales/lv/messages.json +1 -0
- package/src/components/i18n/locales/mk/messages.json +1 -0
- package/src/components/i18n/locales/ml/messages.json +1 -0
- package/src/components/i18n/locales/mn/messages.json +1 -0
- package/src/components/i18n/locales/mr/messages.json +1 -0
- package/src/components/i18n/locales/ms/messages.json +1 -0
- package/src/components/i18n/locales/my/messages.json +1 -0
- package/src/components/i18n/locales/ne/messages.json +1 -0
- package/src/components/i18n/locales/nl/messages.json +1 -0
- package/src/components/i18n/locales/no/messages.json +1 -0
- package/src/components/i18n/locales/pa/messages.json +1 -0
- package/src/components/i18n/locales/pl/messages.json +1 -0
- package/src/components/i18n/locales/ps/messages.json +1 -0
- package/src/components/i18n/locales/pt/messages.json +1 -0
- package/src/components/i18n/locales/ro/messages.json +1 -0
- package/src/components/i18n/locales/ru/messages.json +1 -0
- package/src/components/i18n/locales/sd/messages.json +1 -0
- package/src/components/i18n/locales/si/messages.json +1 -0
- package/src/components/i18n/locales/sk/messages.json +1 -0
- package/src/components/i18n/locales/sl/messages.json +1 -0
- package/src/components/i18n/locales/sq/messages.json +1 -0
- package/src/components/i18n/locales/sr/messages.json +1 -0
- package/src/components/i18n/locales/sv/messages.json +1 -0
- package/src/components/i18n/locales/sw/messages.json +1 -0
- package/src/components/i18n/locales/ta/messages.json +1 -0
- package/src/components/i18n/locales/te/messages.json +1 -0
- package/src/components/i18n/locales/th/messages.json +1 -0
- package/src/components/i18n/locales/tr/messages.json +1 -0
- package/src/components/i18n/locales/ug/messages.json +1 -0
- package/src/components/i18n/locales/uk/messages.json +1 -0
- package/src/components/i18n/locales/ur/messages.json +1 -0
- package/src/components/i18n/locales/vi/messages.json +1 -0
- package/src/components/i18n/locales/yi/messages.json +1 -0
- package/src/components/i18n/locales/zh/messages.json +1 -0
- package/src/components/icons/index.ts +7 -0
- package/src/components/modules/blockEvents/composers/markdownShortcuts.ts +65 -2
- package/src/components/modules/blockEvents/constants.ts +11 -0
- package/src/components/utils/data-model-transform.ts +205 -9
- package/src/styles/main.css +6 -4
- package/src/tools/callout/constants.ts +1 -1
- package/src/tools/callout/emoji-picker/index.ts +0 -3
- package/src/tools/callout/index.ts +51 -0
- package/src/tools/divider/index.ts +96 -0
- package/src/tools/divider/types.ts +6 -0
- package/src/tools/index.ts +2 -0
- package/types/tools/divider.d.ts +11 -0
- package/types/tools-entry.d.ts +9 -3
package/src/styles/main.css
CHANGED
|
@@ -1164,16 +1164,18 @@
|
|
|
1164
1164
|
* Callout emoji vertical centering for heading first children.
|
|
1165
1165
|
* Headings have taller line boxes than the emoji button, so the emoji
|
|
1166
1166
|
* needs a top margin to shift its center down to match the heading's
|
|
1167
|
-
* first line center. Values: (heading-line-height − emoji-
|
|
1167
|
+
* first line center. Values: (heading-line-height − emoji-line-height) / 2 + 1px mt-px.
|
|
1168
|
+
* Emoji button: text-[1.5rem] leading-[1] → line-height 24px.
|
|
1169
|
+
* H1 text-3xl leading-[1.3] → 39px; H2 text-2xl → 31.2px; H3 text-xl → 26px.
|
|
1168
1170
|
*/
|
|
1169
1171
|
[data-blok-component="callout"] button:has(+ [data-blok-toggle-children] > :first-child h1) {
|
|
1170
|
-
margin-top:
|
|
1172
|
+
margin-top: 8.5px;
|
|
1171
1173
|
}
|
|
1172
1174
|
[data-blok-component="callout"] button:has(+ [data-blok-toggle-children] > :first-child h2) {
|
|
1173
|
-
margin-top:
|
|
1175
|
+
margin-top: 4.6px;
|
|
1174
1176
|
}
|
|
1175
1177
|
[data-blok-component="callout"] button:has(+ [data-blok-toggle-children] > :first-child h3) {
|
|
1176
|
-
margin-top:
|
|
1178
|
+
margin-top: 2px;
|
|
1177
1179
|
}
|
|
1178
1180
|
|
|
1179
1181
|
/**
|
|
@@ -26,5 +26,5 @@ export const DEFAULT_EMOJI = '💡';
|
|
|
26
26
|
|
|
27
27
|
// CSS — Tailwind classes
|
|
28
28
|
export const WRAPPER_STYLES = 'rounded-xl px-4 py-[5px] my-1 flex items-start gap-2';
|
|
29
|
-
export const EMOJI_BUTTON_STYLES = 'text-[1.
|
|
29
|
+
export const EMOJI_BUTTON_STYLES = 'text-[1.5rem] leading-[1] cursor-pointer bg-transparent border-0 px-0 py-[7px] flex-shrink-0 select-none';
|
|
30
30
|
export const CHILDREN_STYLES = 'flex-1 min-w-0';
|
|
@@ -246,7 +246,6 @@ export class EmojiPicker {
|
|
|
246
246
|
randomBtn.type = 'button';
|
|
247
247
|
randomBtn.setAttribute('data-emoji-picker-random', '');
|
|
248
248
|
randomBtn.setAttribute('aria-label', this.i18n.t(PICK_RANDOM_KEY));
|
|
249
|
-
randomBtn.title = this.i18n.t(PICK_RANDOM_KEY);
|
|
250
249
|
randomBtn.className = [
|
|
251
250
|
'flex-shrink-0 w-[34px] h-[34px] flex items-center justify-center rounded-lg',
|
|
252
251
|
'text-neutral-400 hover:bg-neutral-100 hover:text-neutral-600',
|
|
@@ -262,7 +261,6 @@ export class EmojiPicker {
|
|
|
262
261
|
removeBtn.type = 'button';
|
|
263
262
|
removeBtn.setAttribute('data-emoji-picker-remove', '');
|
|
264
263
|
removeBtn.setAttribute('aria-label', this.i18n.t(REMOVE_EMOJI_KEY));
|
|
265
|
-
removeBtn.title = this.i18n.t(REMOVE_EMOJI_KEY);
|
|
266
264
|
removeBtn.className = [
|
|
267
265
|
'flex-shrink-0 w-[34px] h-[34px] flex items-center justify-center rounded-lg',
|
|
268
266
|
'text-neutral-400 hover:bg-neutral-100 hover:text-neutral-600',
|
|
@@ -653,7 +651,6 @@ export class EmojiPicker {
|
|
|
653
651
|
const btn = document.createElement('button');
|
|
654
652
|
btn.type = 'button';
|
|
655
653
|
btn.textContent = this.getSkinnedNative(emoji);
|
|
656
|
-
btn.title = this.getDisplayName(emoji);
|
|
657
654
|
btn.setAttribute('data-emoji-native', emoji.native);
|
|
658
655
|
btn.className = [
|
|
659
656
|
'aspect-square flex items-center justify-center',
|
|
@@ -27,6 +27,35 @@ import {
|
|
|
27
27
|
DEFAULT_EMOJI,
|
|
28
28
|
} from './constants';
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Resolve emoji from legacy callout data fields
|
|
32
|
+
*/
|
|
33
|
+
function resolveLegacyEmoji(data: Record<string, unknown>): string {
|
|
34
|
+
if (data.isEmojiVisible === false) {
|
|
35
|
+
return '';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (typeof data.emoji === 'string' && data.emoji.length > 0) {
|
|
39
|
+
return data.emoji;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return DEFAULT_EMOJI;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Map legacy callout variant to backgroundColor preset name.
|
|
47
|
+
* Used when receiving data from older format that has variant instead of backgroundColor.
|
|
48
|
+
*/
|
|
49
|
+
const VARIANT_TO_BG_PRESET: Record<string, string | null> = {
|
|
50
|
+
general: null,
|
|
51
|
+
note: 'blue',
|
|
52
|
+
important: 'purple',
|
|
53
|
+
warning: 'orange',
|
|
54
|
+
additional: 'yellow',
|
|
55
|
+
recommendation: 'green',
|
|
56
|
+
caution: 'red',
|
|
57
|
+
};
|
|
58
|
+
|
|
30
59
|
export class CalloutTool implements BlockTool {
|
|
31
60
|
private readonly api: API;
|
|
32
61
|
private readonly readOnly: boolean;
|
|
@@ -47,6 +76,13 @@ export class CalloutTool implements BlockTool {
|
|
|
47
76
|
}
|
|
48
77
|
|
|
49
78
|
private normalizeData(data: Partial<CalloutData>): CalloutData {
|
|
79
|
+
const legacyData = data as Record<string, unknown>;
|
|
80
|
+
const hasLegacyFields = 'variant' in legacyData || 'isEmojiVisible' in legacyData;
|
|
81
|
+
|
|
82
|
+
if (hasLegacyFields) {
|
|
83
|
+
return this.normalizeLegacyData(legacyData);
|
|
84
|
+
}
|
|
85
|
+
|
|
50
86
|
return {
|
|
51
87
|
emoji: typeof data.emoji === 'string' ? data.emoji : DEFAULT_EMOJI,
|
|
52
88
|
textColor: typeof data.textColor === 'string' ? data.textColor : null,
|
|
@@ -54,6 +90,21 @@ export class CalloutTool implements BlockTool {
|
|
|
54
90
|
};
|
|
55
91
|
}
|
|
56
92
|
|
|
93
|
+
private normalizeLegacyData(data: Record<string, unknown>): CalloutData {
|
|
94
|
+
// Map variant to backgroundColor
|
|
95
|
+
const variant = typeof data.variant === 'string' ? data.variant : 'general';
|
|
96
|
+
const backgroundColor = variant in VARIANT_TO_BG_PRESET ? VARIANT_TO_BG_PRESET[variant] : null;
|
|
97
|
+
|
|
98
|
+
// Map isEmojiVisible + emoji to emoji string
|
|
99
|
+
const emoji = resolveLegacyEmoji(data);
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
emoji,
|
|
103
|
+
textColor: null,
|
|
104
|
+
backgroundColor: backgroundColor ?? null,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
57
108
|
public render(): HTMLElement {
|
|
58
109
|
const dom = buildCalloutDOM({
|
|
59
110
|
emoji: this._data.emoji,
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
BlockTool,
|
|
3
|
+
BlockToolConstructorOptions,
|
|
4
|
+
PasteConfig,
|
|
5
|
+
SanitizerConfig,
|
|
6
|
+
ToolboxConfig,
|
|
7
|
+
} from '../../../types';
|
|
8
|
+
import type { DividerData } from './types';
|
|
9
|
+
import { IconDivider } from '../../components/icons';
|
|
10
|
+
import { twMerge } from '../../components/utils/tw';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Divider block tool — renders a thin horizontal line separator.
|
|
14
|
+
* Contentless void block with no editable content or settings.
|
|
15
|
+
*/
|
|
16
|
+
export class DividerTool implements BlockTool {
|
|
17
|
+
/**
|
|
18
|
+
* Rendered wrapper element
|
|
19
|
+
*/
|
|
20
|
+
private element: HTMLElement | null = null;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @param _options - block tool constructor options (unused for divider)
|
|
24
|
+
*/
|
|
25
|
+
constructor(_options: BlockToolConstructorOptions<DividerData>) {}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Render a wrapper with a semantic <hr> element inside.
|
|
29
|
+
* Wrapper uses padding for spacing and minimal line-height so the
|
|
30
|
+
* toolbar positioning algorithm centers correctly on the divider line.
|
|
31
|
+
*/
|
|
32
|
+
public render(): HTMLElement {
|
|
33
|
+
const wrapper = document.createElement('div');
|
|
34
|
+
|
|
35
|
+
wrapper.className = twMerge('py-3', 'leading-[1px]');
|
|
36
|
+
|
|
37
|
+
const hr = document.createElement('hr');
|
|
38
|
+
|
|
39
|
+
hr.className = twMerge('border-t', 'border-border-primary', 'border-b-0', 'border-l-0', 'border-r-0');
|
|
40
|
+
wrapper.appendChild(hr);
|
|
41
|
+
this.element = wrapper;
|
|
42
|
+
|
|
43
|
+
return wrapper;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Return empty data — divider has no content
|
|
48
|
+
*/
|
|
49
|
+
public save(): DividerData {
|
|
50
|
+
return {} as DividerData;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Always valid — nothing to validate
|
|
55
|
+
*/
|
|
56
|
+
public validate(_data: DividerData): boolean {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Toolbox appearance
|
|
62
|
+
*/
|
|
63
|
+
public static get toolbox(): ToolboxConfig {
|
|
64
|
+
return {
|
|
65
|
+
icon: IconDivider,
|
|
66
|
+
titleKey: 'divider',
|
|
67
|
+
shortcut: '---',
|
|
68
|
+
searchTerms: ['hr', 'line', 'separator', 'rule', '---'],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Divider works in read-only mode
|
|
74
|
+
*/
|
|
75
|
+
public static get isReadOnlySupported(): boolean {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Paste three-or-more hyphens to create a divider
|
|
81
|
+
*/
|
|
82
|
+
public static get pasteConfig(): PasteConfig {
|
|
83
|
+
return {
|
|
84
|
+
patterns: {
|
|
85
|
+
divider: /^-{3,}$/,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Nothing to sanitize — no HTML content
|
|
92
|
+
*/
|
|
93
|
+
public static get sanitize(): SanitizerConfig {
|
|
94
|
+
return {};
|
|
95
|
+
}
|
|
96
|
+
}
|
package/src/tools/index.ts
CHANGED
|
@@ -26,6 +26,7 @@ export { ListItem as List } from './list';
|
|
|
26
26
|
export { Table } from './table';
|
|
27
27
|
export { ToggleItem as Toggle } from './toggle';
|
|
28
28
|
export { CalloutTool as Callout } from './callout';
|
|
29
|
+
export { DividerTool as Divider } from './divider';
|
|
29
30
|
|
|
30
31
|
// Inline tools
|
|
31
32
|
export { BoldInlineTool as Bold } from '../components/inline-tools/inline-tool-bold';
|
|
@@ -45,6 +46,7 @@ export const defaultBlockTools = {
|
|
|
45
46
|
table: {},
|
|
46
47
|
toggle: {},
|
|
47
48
|
callout: {},
|
|
49
|
+
divider: {},
|
|
48
50
|
} as const;
|
|
49
51
|
|
|
50
52
|
export const defaultInlineTools = {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BlockTool, BlockToolConstructable, BlockToolConstructorOptions, BlockToolData } from './block-tool';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Divider Tool's input and output data format.
|
|
5
|
+
* Empty — dividers have no configurable properties.
|
|
6
|
+
*/
|
|
7
|
+
export interface DividerData extends BlockToolData {}
|
|
8
|
+
|
|
9
|
+
export interface DividerConstructable extends BlockToolConstructable {
|
|
10
|
+
new(options: BlockToolConstructorOptions<DividerData>): BlockTool;
|
|
11
|
+
}
|
package/types/tools-entry.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { ParagraphConstructable, ParagraphData, ParagraphConfig } from './tools/
|
|
|
8
8
|
import { ListConstructable, ListData, ListConfig, ListStyle } from './tools/list';
|
|
9
9
|
import { TableConstructable, TableData, TableConfig, CellContent } from './tools/table';
|
|
10
10
|
import { ToggleConstructable, ToggleData, ToggleConfig } from './tools/toggle';
|
|
11
|
+
import { DividerConstructable, DividerData } from './tools/divider';
|
|
11
12
|
import { InlineToolConstructable } from './tools/inline-tool';
|
|
12
13
|
import { BlockTuneConstructable } from './block-tunes';
|
|
13
14
|
import { ToolSettings } from './tools';
|
|
@@ -18,6 +19,7 @@ export const Header: HeaderConstructable;
|
|
|
18
19
|
export const List: ListConstructable;
|
|
19
20
|
export const Table: TableConstructable;
|
|
20
21
|
export const Toggle: ToggleConstructable;
|
|
22
|
+
export const Divider: DividerConstructable;
|
|
21
23
|
|
|
22
24
|
// Re-export data and config types for convenience
|
|
23
25
|
export { HeaderData, HeaderConfig } from './tools/header';
|
|
@@ -25,6 +27,7 @@ export { ParagraphData, ParagraphConfig } from './tools/paragraph';
|
|
|
25
27
|
export { ListData, ListConfig, ListStyle } from './tools/list';
|
|
26
28
|
export { TableData, TableConfig, CellContent } from './tools/table';
|
|
27
29
|
export { ToggleData, ToggleConfig } from './tools/toggle';
|
|
30
|
+
export { DividerData } from './tools/divider';
|
|
28
31
|
|
|
29
32
|
// Inline tools
|
|
30
33
|
export const Bold: InlineToolConstructable;
|
|
@@ -42,10 +45,13 @@ export const Delete: BlockTuneConstructable;
|
|
|
42
45
|
* Default block tools configuration
|
|
43
46
|
*/
|
|
44
47
|
export const defaultBlockTools: {
|
|
45
|
-
readonly paragraph: { readonly
|
|
46
|
-
readonly header: {
|
|
47
|
-
readonly list: {
|
|
48
|
+
readonly paragraph: { readonly preserveBlank: true };
|
|
49
|
+
readonly header: {};
|
|
50
|
+
readonly list: {};
|
|
48
51
|
readonly table: {};
|
|
52
|
+
readonly toggle: {};
|
|
53
|
+
readonly callout: {};
|
|
54
|
+
readonly divider: {};
|
|
49
55
|
};
|
|
50
56
|
|
|
51
57
|
/**
|