@nldd/design-system 0.25.1 → 0.26.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/custom-elements.json +2845 -79
- package/dist/cdn/autoloader.js +141 -140
- package/dist/cdn/chunks/{accordion-B7KdKJno.js → accordion-DA4IlxS5.js} +4 -4
- package/dist/cdn/chunks/{accordion-item-CVy8Apta.js → accordion-item-Ca1o93cq.js} +9 -7
- package/dist/cdn/chunks/{activity-indicator-CpJVlX6K.js → activity-indicator-Cj4H0Mbz.js} +5 -5
- package/dist/cdn/chunks/{admonition-C89WHJ9a.js → admonition-CdZSoO8O.js} +9 -7
- package/dist/cdn/chunks/{avatar-Bf0OfAtQ.js → avatar-Dhqn-Dmv.js} +6 -6
- package/dist/cdn/chunks/{avatar-group-BeBAv2wB.js → avatar-group-B017eF-u.js} +15 -15
- package/dist/cdn/chunks/{badge-C43FvgkK.js → badge-Bep5B0_g.js} +5 -5
- package/dist/cdn/chunks/{banner-OWK0gwFb.js → banner-DGpIXuE2.js} +7 -7
- package/dist/cdn/chunks/{bar-split-view-Dj1WycIW.js → bar-split-view-CKwJxd3e.js} +5 -5
- package/dist/cdn/chunks/{blockquote-D_5MxcSi.js → blockquote-ChMgaOuI.js} +3 -3
- package/dist/cdn/chunks/{box-BUoxiA7b.js → box-BRmziG-6.js} +3 -3
- package/dist/cdn/chunks/{breadcrumbs-DXxJTACL.js → breadcrumbs-BeVO8bkQ.js} +5 -5
- package/dist/cdn/chunks/{button-bar-BSt-QQRG.js → button-bar-CLxOdalJ.js} +3 -3
- package/dist/cdn/chunks/{button-DpKyquzm.js → button-cHBkq_s7.js} +9 -9
- package/dist/cdn/chunks/{button-group-D5QJWJzh.js → button-group-BIvKtEIX.js} +2 -2
- package/dist/cdn/chunks/{card-Cz4f-dCf.js → card-B5gp9Zly.js} +8 -6
- package/dist/cdn/chunks/{cell-zFw2V9wD.js → cell-D4Nrd5Z9.js} +6 -6
- package/dist/cdn/chunks/{checkbox-BDp3O8Nc.js → checkbox-CeLTJhAc.js} +4 -4
- package/dist/cdn/chunks/checkbox-field-C8cU8fuf.js +244 -0
- package/dist/cdn/chunks/checkbox-group-CC72cq-P.js +103 -0
- package/dist/cdn/chunks/{class-map-C7ao595e.js → class-map-xzscTu4B.js} +1 -1
- package/dist/cdn/chunks/{code-editor-Chm9EG_v.js → code-editor-BNhlXTSl.js} +10 -10
- package/dist/cdn/chunks/{code-viewer-DX322d7w.js → code-viewer-D_JwouYO.js} +35 -35
- package/dist/cdn/chunks/{codemirror-input-BLMJQbHq.js → codemirror-input-DJ0wgYrc.js} +368 -368
- package/dist/cdn/chunks/{collection-Bf8HoSki.js → collection-BXvz_OtU.js} +8 -8
- package/dist/cdn/chunks/{combo-box-VuU_F54v.js → combo-box-8kbmoStb.js} +10 -9
- package/dist/cdn/chunks/{container-qVTgmbpz.js → container-Dq-2uHd5.js} +2 -2
- package/dist/cdn/chunks/{custom-element-C5yyaCZS.js → custom-element-DeaCQ2NP.js} +1 -1
- package/dist/cdn/chunks/{date-field-By9Q8151.js → date-field-CQg1_73u.js} +13 -13
- package/dist/cdn/chunks/{date-picker-DtA4PXCh.js → date-picker-CTMxGOiA.js} +10 -10
- package/dist/cdn/chunks/{decorate-CkbtFnic.js → decorate-CCYde2ES.js} +1 -1
- package/dist/cdn/chunks/described-by-mixin-BYFim7aO.js +62 -0
- package/dist/cdn/chunks/{description-cell-D2INE8A3.js → description-cell-GcVeCz2_.js} +6 -6
- package/dist/cdn/chunks/{dev-checks-UHHli7gE.js → dev-checks-CSlbfDuF.js} +43 -5
- package/dist/cdn/chunks/directive-helpers-DgaADFyY.js +24 -0
- package/dist/cdn/chunks/{dist-BG0xnVUi.js → dist-1OQdP4ho.js} +10 -10
- package/dist/cdn/chunks/{dist-C-T4uKP1.js → dist-5vPsM2aV.js} +8 -8
- package/dist/cdn/chunks/{dist-VXOtAJ-m.js → dist-B23jHvJ5.js} +15 -15
- package/dist/cdn/chunks/{dist-Cm51DQO4.js → dist-CNy2sPTt.js} +6 -6
- package/dist/cdn/chunks/{dist-B1pwN_VD.js → dist-CcpLhc4y.js} +7 -7
- package/dist/cdn/chunks/{dist-Ce38ZA7b.js → dist-CyDpBAaD.js} +7 -7
- package/dist/cdn/chunks/{dist-pCih3zzc.js → dist-D4SViUJx.js} +21 -21
- package/dist/cdn/chunks/{dist-qo8avphr.js → dist-DBxjWahH.js} +4 -4
- package/dist/cdn/chunks/{dist-BzfFo9Yu.js → dist-DLtwMUDc.js} +18 -18
- package/dist/cdn/chunks/{dist-Dg3ySzj7.js → dist-Da_liXcd.js} +124 -124
- package/dist/cdn/chunks/{dist-zxb4QZZG.js → dist-VCymi0hs.js} +250 -250
- package/dist/cdn/chunks/{divider-Cv_vyHvw.js → divider-8XD3xTbl.js} +2 -2
- package/dist/cdn/chunks/{document-tab-bar-CdOxr8KC.js → document-tab-bar-RBAmckHS.js} +9 -9
- package/dist/cdn/chunks/{dropdown-DC9J6k0P.js → dropdown-DVlxPcjr.js} +5 -5
- package/dist/cdn/chunks/field-button-controller-yvICuXoE.js +26 -0
- package/dist/cdn/chunks/{file-field-CsrTk4uk.js → file-field-BrHnFplX.js} +12 -12
- package/dist/cdn/chunks/{form-ClOD1OKh.js → form-DGHeGEIr.js} +1 -1
- package/dist/cdn/chunks/{form-actions-CwaXGj43.js → form-actions-CHwWKfMM.js} +2 -2
- package/dist/cdn/chunks/{form-field-LoX9v2Pa.js → form-field-CdTSI-8h.js} +21 -16
- package/dist/cdn/chunks/{form-section-i6piyKuy.js → form-section-CjECOIiZ.js} +1 -1
- package/dist/cdn/chunks/{full-bleed-section-6aAfCnez.js → full-bleed-section-CQgq4iGQ.js} +3 -3
- package/dist/cdn/chunks/{hero-CTQAayXT.js → hero-DhdcYt2N.js} +4 -4
- package/dist/cdn/chunks/{icon-button-DuEiOOoc.js → icon-button-DT_Bi4Ac.js} +17 -13
- package/dist/cdn/chunks/{icon-cell-uZkR3hZx.js → icon-cell-C-qrZAlN.js} +5 -5
- package/dist/cdn/chunks/{icon-B5kHyCz2.js → icon-qpmEfU9B.js} +2 -2
- package/dist/cdn/chunks/{identity-DR6DMjke.js → identity-DFmvuPkl.js} +6 -6
- package/dist/cdn/chunks/{if-defined-B7fJBsUt.js → if-defined-BINBE69I.js} +1 -1
- package/dist/cdn/chunks/{image-CuBUo_MQ.js → image-B4M3h1xJ.js} +8 -8
- package/dist/cdn/chunks/{inline-dialog-CZNkWJIA.js → inline-dialog-L-NvjANF.js} +6 -6
- package/dist/cdn/chunks/{just-in-time-education-qwg9hTDX.js → just-in-time-education-CWplH4r9.js} +5 -5
- package/dist/cdn/chunks/{kanban-Bkg-nZmX.js → kanban-B6Wa-2aM.js} +5 -5
- package/dist/cdn/chunks/{kanban-column-C8iRyRNY.js → kanban-column-D2-Xq79_.js} +4 -4
- package/dist/cdn/chunks/{keyboard-shortcut-Rq5IHU-e.js → keyboard-shortcut-Ci95olxF.js} +118 -47
- package/dist/cdn/chunks/{languages-DLHsACpp.js → languages-C9AGuuSS.js} +43 -32
- package/dist/cdn/chunks/{link-CgjFwaHP.js → link-BJB2a_fG.js} +36 -28
- package/dist/cdn/chunks/{link-group-5W0GAmTq.js → link-group-aNoedLZo.js} +2 -2
- package/dist/cdn/chunks/{list-BASqIKtP.js → list-CZWX62tH.js} +8 -8
- package/dist/cdn/chunks/{list-item-DTcPysIP.js → list-item-DHzsbK_S.js} +5 -5
- package/dist/cdn/chunks/{list-item-segment-CRw0y4kg.js → list-item-segment-CHLlU9Gg.js} +3 -3
- package/dist/cdn/chunks/{menu-CYILGTpB.js → menu-NGpB1SKq.js} +42 -22
- package/dist/cdn/chunks/{menu-bar-CL566HmJ.js → menu-bar-CJazkmY7.js} +6 -6
- package/dist/cdn/chunks/{menu-bar-item-C6OrUu_4.js → menu-bar-item-CSqXWNKE.js} +6 -6
- package/dist/cdn/chunks/{menu-divider-BtU9eBSb.js → menu-divider-Cn1hTpcM.js} +3 -3
- package/dist/cdn/chunks/{menu-group-r2TvdqJB.js → menu-group-C71K1Vmv.js} +4 -4
- package/dist/cdn/chunks/{menu-item-CS45jTLu.js → menu-item-TqBlQfI2.js} +4 -4
- package/dist/cdn/chunks/{menu.template-CF8Iau1s.js → menu.template-DthELYky.js} +21 -16
- package/dist/cdn/chunks/{modal-dialog-C9NBq8TO.js → modal-dialog-0V2HsrJC.js} +4 -4
- package/dist/cdn/chunks/{multi-line-text-field-BkxV0vqA.js → multi-line-text-field-BV4uUDoK.js} +60 -34
- package/dist/cdn/chunks/{navigation-split-view-DNrQYkg7.js → navigation-split-view-tPhkxEVD.js} +4 -4
- package/dist/cdn/chunks/{notification-Dzpy9hCc.js → notification-CZccv6qx.js} +6 -6
- package/dist/cdn/chunks/{number-field-BJCUe-bI.js → number-field-4R2blHda.js} +8 -8
- package/dist/cdn/chunks/{one-half-one-half-section-Ctw8ri5v.js → one-half-one-half-section-h2fLPQfP.js} +3 -3
- package/dist/cdn/chunks/{one-third-two-thirds-section-DxUUH8lS.js → one-third-two-thirds-section-mqUAH5lK.js} +3 -3
- package/dist/cdn/chunks/{one-time-code-field-DGDyqIMd.js → one-time-code-field-Bf_qymKd.js} +8 -7
- package/dist/cdn/chunks/{page-BpavFPML.js → page-Kipfvmi6.js} +4 -4
- package/dist/cdn/chunks/{page-footer-CVqmyulx.js → page-footer-DxE966Oe.js} +4 -4
- package/dist/cdn/chunks/{page-section-mixin-BHg-Wre9.js → page-section-mixin-DpF9JDpd.js} +3 -3
- package/dist/cdn/chunks/{pagination-BGZYq-eO.js → pagination-DUFFhaU8.js} +6 -6
- package/dist/cdn/chunks/{password-field-BIFfLAls.js → password-field-DdYAVmF3.js} +9 -9
- package/dist/cdn/chunks/{popover-TCW20ibN.js → popover-CRHxyhGx.js} +6 -6
- package/dist/cdn/chunks/{progress-bar-C4bLuJBa.js → progress-bar-BuYsjmSo.js} +7 -7
- package/dist/cdn/chunks/{progress-circle-BePtt89f.js → progress-circle-Cvu1bfNG.js} +7 -7
- package/dist/cdn/chunks/{radio-button-CLiuwjA1.js → radio-button-B_4AxWDx.js} +3 -3
- package/dist/cdn/chunks/{radio-button-field-BPva1mUv.js → radio-button-field-D7jIg6Oi.js} +6 -6
- package/dist/cdn/chunks/{radio-button-group-Z5s4obz6.js → radio-button-group-D_OezDhB.js} +12 -6
- package/dist/cdn/chunks/{render-marked-C3ypoEZM.js → render-marked-CIuiSS_8.js} +1 -1
- package/dist/cdn/chunks/{reorder-handle-cell-BB9b4T_d.js → reorder-handle-cell-DNPaZjSC.js} +4 -4
- package/dist/cdn/chunks/{reorder-handle-mixin-DBjNe6Rl.js → reorder-handle-mixin-CgvWq4fF.js} +2 -2
- package/dist/cdn/chunks/repeat-DfVuWl6o.js +57 -0
- package/dist/cdn/chunks/{return-focus-BzZWhXhc.js → return-focus-D0fF2hjd.js} +1 -1
- package/dist/cdn/chunks/{rich-text-DTxHo8E_.js → rich-text-CVHlMQY6.js} +3 -3
- package/dist/cdn/chunks/{row-header-mixin-BcwoEgu7.js → row-header-mixin-B25JK2B3.js} +2 -2
- package/dist/cdn/chunks/{scroll-fade-Dul0IfE1.js → scroll-fade-Dv57rTww.js} +2 -2
- package/dist/cdn/chunks/{search-field-BeZN7S8J.js → search-field-hmD_DXbG.js} +11 -11
- package/dist/cdn/chunks/{segmented-control-Dzu8xoqB.js → segmented-control-e8e-jYSw.js} +6 -6
- package/dist/cdn/chunks/{shadow-resets-Dlq8Oecv.js → shadow-resets-CRdvf-Ei.js} +2 -2
- package/dist/cdn/chunks/{sheet-DaQpfAep.js → sheet-D09y3J45.js} +4 -4
- package/dist/cdn/chunks/{shell-DSNgonKU.js → shell-CV3gooGg.js} +3 -3
- package/dist/cdn/chunks/{side-by-side-split-view-DhGbcDrs.js → side-by-side-split-view-Ckz1C9zk.js} +4 -4
- package/dist/cdn/chunks/{sidebar-section-BlJmPb9C.js → sidebar-section-CdyD-x4t.js} +7 -7
- package/dist/cdn/chunks/{simple-section-CYiTEFqN.js → simple-section-CEf38rBZ.js} +3 -3
- package/dist/cdn/chunks/{skip-link-CReOb-Ci.js → skip-link-DMRhATWw.js} +4 -4
- package/dist/cdn/chunks/{slider-DUEGol_V.js → slider-Db3FPiP6.js} +8 -8
- package/dist/cdn/chunks/{spacer-CPmyJDQq.js → spacer-BPFIYueo.js} +2 -2
- package/dist/cdn/chunks/{spacer-cell-DJEv0v6s.js → spacer-cell-kITa3CDV.js} +4 -4
- package/dist/cdn/chunks/{split-button-B3vfYAdy.js → split-button-CJs9-Nha.js} +7 -7
- package/dist/cdn/chunks/{split-view-divider-pSUpnEPX.js → split-view-divider-lHlM1Ss8.js} +2 -2
- package/dist/cdn/chunks/{split-view-pane-J1RVr_w1.js → split-view-pane-DlsbZtyo.js} +3 -3
- package/dist/cdn/chunks/{stacked-split-view-B67fT-Ch.js → stacked-split-view-uRSVhrMd.js} +4 -4
- package/dist/cdn/chunks/{static-html-BT4LOKbV.js → static-html-BahSPV_4.js} +1 -1
- package/dist/cdn/chunks/{status-bar-CGXqgNOf.js → status-bar-DCJLVpsW.js} +4 -4
- package/dist/cdn/chunks/{step-bar-DdsA2Egs.js → step-bar-CRR2jiyo.js} +6 -6
- package/dist/cdn/chunks/{step-cell-DsTAgMCx.js → step-cell-CbtKxJNJ.js} +5 -5
- package/dist/cdn/chunks/{stepper-DPqXiLQr.js → stepper-Con1_CnB.js} +6 -6
- package/dist/cdn/chunks/{style-map-B7yv7Y8k.js → style-map-uOwLerwV.js} +1 -1
- package/dist/cdn/chunks/{swatch-picker-D9QZmbNN.js → swatch-picker-Bqn0eaC9.js} +5 -5
- package/dist/cdn/chunks/{switch-CE2glvZQ.js → switch-CMQcLEBJ.js} +4 -4
- package/dist/cdn/chunks/{switch-field-Dr2LovXc.js → switch-field-D9kWq4Kw.js} +5 -5
- package/dist/cdn/chunks/{tab-bar-DYZbToZB.js → tab-bar-DXzyZI3V.js} +8 -8
- package/dist/cdn/chunks/{table-DoQMJbSg.js → table-CWACLpHx.js} +5 -5
- package/dist/cdn/chunks/{tag-DOX5nY-Z.js → tag-Bo4yJbtF.js} +4 -4
- package/dist/cdn/chunks/{term-CxGzPnhq.js → term-CQ379ZbN.js} +12 -12
- package/dist/cdn/chunks/{text-Dqe0uTK7.js → text-D-dFoj6N.js} +3 -3
- package/dist/cdn/chunks/{text-cell-ByGrujhK.js → text-cell-Be1hStxp.js} +8 -8
- package/dist/cdn/chunks/{text-editor-DT9oWQCT.js → text-editor-BjzQEBWm.js} +1372 -904
- package/dist/cdn/chunks/{text-field-DKz5IRAU.js → text-field-DA8nirp6.js} +47 -65
- package/dist/cdn/chunks/{time-field-Dh7nTwNc.js → time-field-Dd_TxJuf.js} +15 -15
- package/dist/cdn/chunks/{time-picker-Bp-l4JfF.js → time-picker-B0-rv1qp.js} +5 -5
- package/dist/cdn/chunks/{title-CdIWXNtc.js → title-DOoPdG_i.js} +4 -4
- package/dist/cdn/chunks/{title-cell-DNbP8l_x.js → title-cell-BzCNOMGr.js} +8 -8
- package/dist/cdn/chunks/{toggle-button-CPMxB3gN.js → toggle-button-9PbDHviQ.js} +60 -42
- package/dist/cdn/chunks/{toggle-button-group-ERWVyRX5.js → toggle-button-group-C-H-xp0M.js} +11 -5
- package/dist/cdn/chunks/{token-CG8dR3EH.js → token-CMKFC3gz.js} +5 -5
- package/dist/cdn/chunks/{token-field-B8wqHKan.js → token-field-D4-XHfnG.js} +11 -11
- package/dist/cdn/chunks/{toolbar-item-xJEewchW.js → toolbar-item-ZYoyKOyy.js} +3 -3
- package/dist/cdn/chunks/{toolbar-title-C08aG67Y.js → toolbar-title-FKtQ8ZC4.js} +4 -4
- package/dist/cdn/chunks/{toolbar-CiZoecHm.js → toolbar-z9OhEE5l.js} +8 -8
- package/dist/cdn/chunks/{toolbar.styles-DmAHodW4.js → toolbar.styles-DDjpdCHV.js} +3 -3
- package/dist/cdn/chunks/{tooltip-660R32cn.js → tooltip-BvRNYRo3.js} +5 -5
- package/dist/cdn/chunks/{top-navigation-bar-B1HFShH8.js → top-navigation-bar-BHPQntER.js} +17 -17
- package/dist/cdn/chunks/{top-title-bar-BLZZd0Iu.js → top-title-bar-BVjegLlh.js} +6 -6
- package/dist/cdn/chunks/{translations-CF08wvn-.js → translations-cJjO6nQV.js} +1 -1
- package/dist/cdn/chunks/{two-thirds-one-third-section-Dqz7UoSH.js → two-thirds-one-third-section-BdBHQuXc.js} +3 -3
- package/dist/cdn/chunks/{validation-list-D-bzOl5H.js → validation-list-5E3-3_95.js} +3 -3
- package/dist/cdn/chunks/{visibility-mixin-X9d6wHvR.js → visibility-mixin-DvRe3O8t.js} +2 -2
- package/dist/cdn/chunks/{visually-hidden-Cew5_ldu.js → visually-hidden-F85D_HcR.js} +2 -2
- package/dist/cdn/chunks/{window-DSgA26_c.js → window-CabW35M1.js} +5 -5
- package/dist/cdn/chunks/{with-translations-Boc5Daaj.js → with-translations-BHDG37HJ.js} +3 -3
- package/dist/components/actions/button/button.d.ts +1 -1
- package/dist/components/actions/button/button.js +1 -1
- package/dist/components/actions/button/button.template.js +1 -1
- package/dist/components/actions/icon-button/icon-button.d.ts +5 -1
- package/dist/components/actions/icon-button/icon-button.d.ts.map +1 -1
- package/dist/components/actions/icon-button/icon-button.js +10 -5
- package/dist/components/actions/icon-button/icon-button.js.map +1 -1
- package/dist/components/actions/menu/menu-item.d.ts +1 -1
- package/dist/components/actions/menu/menu-item.js +1 -1
- package/dist/components/actions/menu/menu.d.ts +13 -1
- package/dist/components/actions/menu/menu.d.ts.map +1 -1
- package/dist/components/actions/menu/menu.js +53 -2
- package/dist/components/actions/menu/menu.js.map +1 -1
- package/dist/components/actions/menu/menu.pointer.d.ts +6 -2
- package/dist/components/actions/menu/menu.pointer.d.ts.map +1 -1
- package/dist/components/actions/menu/menu.pointer.js +15 -5
- package/dist/components/actions/menu/menu.pointer.js.map +1 -1
- package/dist/components/actions/menu/menu.styles.d.ts.map +1 -1
- package/dist/components/actions/menu/menu.styles.js +16 -11
- package/dist/components/actions/menu/menu.styles.js.map +1 -1
- package/dist/components/actions/menu/menu.template.js +1 -1
- package/dist/components/content/accordion/accordion-item.styles.d.ts.map +1 -1
- package/dist/components/content/accordion/accordion-item.styles.js +5 -3
- package/dist/components/content/accordion/accordion-item.styles.js.map +1 -1
- package/dist/components/content/admonition/admonition.styles.d.ts.map +1 -1
- package/dist/components/content/admonition/admonition.styles.js +5 -3
- package/dist/components/content/admonition/admonition.styles.js.map +1 -1
- package/dist/components/content/icon/icon.d.ts +1 -1
- package/dist/components/content/icon/icon.js +1 -1
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.d.ts +16 -9
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.d.ts.map +1 -1
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.js +18 -12
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.styles.d.ts.map +1 -1
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.styles.js +26 -12
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.styles.js.map +1 -1
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.template.d.ts.map +1 -1
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.template.js +12 -3
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.template.js.map +1 -1
- package/dist/components/content/tooltip/tooltip.template.js +1 -1
- package/dist/components/forms/form-field/form-field.d.ts +3 -1
- package/dist/components/forms/form-field/form-field.d.ts.map +1 -1
- package/dist/components/forms/form-field/form-field.js +14 -3
- package/dist/components/forms/form-field/form-field.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/inputs/checkbox-field/checkbox-field.d.ts +44 -2
- package/dist/components/inputs/checkbox-field/checkbox-field.d.ts.map +1 -1
- package/dist/components/inputs/checkbox-field/checkbox-field.js +129 -9
- package/dist/components/inputs/checkbox-field/checkbox-field.js.map +1 -1
- package/dist/components/inputs/checkbox-field/checkbox-field.styles.d.ts.map +1 -1
- package/dist/components/inputs/checkbox-field/checkbox-field.styles.js +6 -0
- package/dist/components/inputs/checkbox-field/checkbox-field.styles.js.map +1 -1
- package/dist/components/inputs/checkbox-field/checkbox-field.template.d.ts.map +1 -1
- package/dist/components/inputs/checkbox-field/checkbox-field.template.js +18 -4
- package/dist/components/inputs/checkbox-field/checkbox-field.template.js.map +1 -1
- package/dist/components/inputs/checkbox-group/checkbox-group.d.ts +77 -0
- package/dist/components/inputs/checkbox-group/checkbox-group.d.ts.map +1 -0
- package/dist/components/inputs/checkbox-group/checkbox-group.js +188 -0
- package/dist/components/inputs/checkbox-group/checkbox-group.js.map +1 -0
- package/dist/components/inputs/checkbox-group/checkbox-group.styles.d.ts +2 -0
- package/dist/components/inputs/checkbox-group/checkbox-group.styles.d.ts.map +1 -0
- package/dist/components/inputs/checkbox-group/checkbox-group.styles.js +28 -0
- package/dist/components/inputs/checkbox-group/checkbox-group.styles.js.map +1 -0
- package/dist/components/inputs/checkbox-group/checkbox-group.template.d.ts +4 -0
- package/dist/components/inputs/checkbox-group/checkbox-group.template.d.ts.map +1 -0
- package/dist/components/inputs/checkbox-group/checkbox-group.template.js +9 -0
- package/dist/components/inputs/checkbox-group/checkbox-group.template.js.map +1 -0
- package/dist/components/inputs/combo-box/combo-box.d.ts +3 -0
- package/dist/components/inputs/combo-box/combo-box.d.ts.map +1 -1
- package/dist/components/inputs/combo-box/combo-box.js +3 -0
- package/dist/components/inputs/combo-box/combo-box.js.map +1 -1
- package/dist/components/inputs/combo-box/combo-box.styles.d.ts.map +1 -1
- package/dist/components/inputs/combo-box/combo-box.styles.js +1 -0
- package/dist/components/inputs/combo-box/combo-box.styles.js.map +1 -1
- package/dist/components/inputs/date-field/date-field.d.ts +3 -0
- package/dist/components/inputs/date-field/date-field.d.ts.map +1 -1
- package/dist/components/inputs/date-field/date-field.js +3 -0
- package/dist/components/inputs/date-field/date-field.js.map +1 -1
- package/dist/components/inputs/dropdown/dropdown.d.ts +4 -0
- package/dist/components/inputs/dropdown/dropdown.d.ts.map +1 -1
- package/dist/components/inputs/dropdown/dropdown.js +4 -0
- package/dist/components/inputs/dropdown/dropdown.js.map +1 -1
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.d.ts +8 -0
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.d.ts.map +1 -1
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.js +8 -0
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.js.map +1 -1
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.styles.d.ts.map +1 -1
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.styles.js +24 -2
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.styles.js.map +1 -1
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.template.d.ts.map +1 -1
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.template.js +3 -0
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.template.js.map +1 -1
- package/dist/components/inputs/number-field/number-field.d.ts +3 -0
- package/dist/components/inputs/number-field/number-field.d.ts.map +1 -1
- package/dist/components/inputs/number-field/number-field.js +3 -0
- package/dist/components/inputs/number-field/number-field.js.map +1 -1
- package/dist/components/inputs/one-time-code-field/one-time-code-field.d.ts +3 -0
- package/dist/components/inputs/one-time-code-field/one-time-code-field.d.ts.map +1 -1
- package/dist/components/inputs/one-time-code-field/one-time-code-field.js +3 -0
- package/dist/components/inputs/one-time-code-field/one-time-code-field.js.map +1 -1
- package/dist/components/inputs/one-time-code-field/one-time-code-field.styles.d.ts.map +1 -1
- package/dist/components/inputs/one-time-code-field/one-time-code-field.styles.js +1 -0
- package/dist/components/inputs/one-time-code-field/one-time-code-field.styles.js.map +1 -1
- package/dist/components/inputs/password-field/password-field.d.ts +3 -0
- package/dist/components/inputs/password-field/password-field.d.ts.map +1 -1
- package/dist/components/inputs/password-field/password-field.js +3 -0
- package/dist/components/inputs/password-field/password-field.js.map +1 -1
- package/dist/components/inputs/password-field/password-field.styles.js +1 -1
- package/dist/components/inputs/radio-button-field/radio-button-field.d.ts.map +1 -1
- package/dist/components/inputs/radio-button-field/radio-button-field.js +5 -0
- package/dist/components/inputs/radio-button-field/radio-button-field.js.map +1 -1
- package/dist/components/inputs/radio-button-group/radio-button-group.d.ts +5 -0
- package/dist/components/inputs/radio-button-group/radio-button-group.d.ts.map +1 -1
- package/dist/components/inputs/radio-button-group/radio-button-group.js +19 -9
- package/dist/components/inputs/radio-button-group/radio-button-group.js.map +1 -1
- package/dist/components/inputs/search-field/search-field.d.ts +3 -0
- package/dist/components/inputs/search-field/search-field.d.ts.map +1 -1
- package/dist/components/inputs/search-field/search-field.js +3 -0
- package/dist/components/inputs/search-field/search-field.js.map +1 -1
- package/dist/components/inputs/search-field/search-field.styles.js +1 -1
- package/dist/components/inputs/text-editor/text-editor.clipboard.d.ts +5 -2
- package/dist/components/inputs/text-editor/text-editor.clipboard.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.clipboard.js +23 -4
- package/dist/components/inputs/text-editor/text-editor.clipboard.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.code-copy.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.code-copy.js +38 -18
- package/dist/components/inputs/text-editor/text-editor.code-copy.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.commands.d.ts +8 -6
- package/dist/components/inputs/text-editor/text-editor.commands.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.commands.js +23 -9
- package/dist/components/inputs/text-editor/text-editor.commands.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.d.ts +26 -0
- package/dist/components/inputs/text-editor/text-editor.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.js +165 -15
- package/dist/components/inputs/text-editor/text-editor.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.list-input.d.ts +17 -0
- package/dist/components/inputs/text-editor/text-editor.list-input.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.list-input.js +133 -0
- package/dist/components/inputs/text-editor/text-editor.list-input.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.markdown.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.markdown.js +28 -1
- package/dist/components/inputs/text-editor/text-editor.markdown.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.mentions.d.ts +4 -2
- package/dist/components/inputs/text-editor/text-editor.mentions.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.mentions.js +9 -5
- package/dist/components/inputs/text-editor/text-editor.mentions.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.ordered-list.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.ordered-list.js +89 -18
- package/dist/components/inputs/text-editor/text-editor.ordered-list.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.paste.d.ts +10 -0
- package/dist/components/inputs/text-editor/text-editor.paste.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.paste.js +116 -0
- package/dist/components/inputs/text-editor/text-editor.paste.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.styles.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.styles.js +49 -2
- package/dist/components/inputs/text-editor/text-editor.styles.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.template.d.ts +1 -1
- package/dist/components/inputs/text-editor/text-editor.template.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.template.js +4 -3
- package/dist/components/inputs/text-editor/text-editor.template.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.toolbar.d.ts +53 -0
- package/dist/components/inputs/text-editor/text-editor.toolbar.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.toolbar.js +302 -0
- package/dist/components/inputs/text-editor/text-editor.toolbar.js.map +1 -0
- package/dist/components/inputs/text-field/text-field.d.ts +7 -13
- package/dist/components/inputs/text-field/text-field.d.ts.map +1 -1
- package/dist/components/inputs/text-field/text-field.js +8 -50
- package/dist/components/inputs/text-field/text-field.js.map +1 -1
- package/dist/components/inputs/text-field/text-field.styles.d.ts.map +1 -1
- package/dist/components/inputs/text-field/text-field.styles.js +1 -2
- package/dist/components/inputs/text-field/text-field.styles.js.map +1 -1
- package/dist/components/inputs/text-field/text-field.template.js +2 -2
- package/dist/components/inputs/text-field/text-field.template.js.map +1 -1
- package/dist/components/inputs/time-field/time-field.d.ts +3 -0
- package/dist/components/inputs/time-field/time-field.d.ts.map +1 -1
- package/dist/components/inputs/time-field/time-field.js +3 -0
- package/dist/components/inputs/time-field/time-field.js.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.d.ts +22 -2
- package/dist/components/inputs/toggle-button/toggle-button.d.ts.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.js +53 -7
- package/dist/components/inputs/toggle-button/toggle-button.js.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.styles.d.ts.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.styles.js +3 -1
- package/dist/components/inputs/toggle-button/toggle-button.styles.js.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.template.d.ts.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.template.js +6 -2
- package/dist/components/inputs/toggle-button/toggle-button.template.js.map +1 -1
- package/dist/components/inputs/toggle-button-group/toggle-button-group.d.ts +6 -1
- package/dist/components/inputs/toggle-button-group/toggle-button-group.d.ts.map +1 -1
- package/dist/components/inputs/toggle-button-group/toggle-button-group.js +20 -10
- package/dist/components/inputs/toggle-button-group/toggle-button-group.js.map +1 -1
- package/dist/components/inputs/token-field/token-field.d.ts +3 -0
- package/dist/components/inputs/token-field/token-field.d.ts.map +1 -1
- package/dist/components/inputs/token-field/token-field.js +3 -0
- package/dist/components/inputs/token-field/token-field.js.map +1 -1
- package/dist/components/layout/card/card.d.ts +2 -0
- package/dist/components/layout/card/card.d.ts.map +1 -1
- package/dist/components/layout/card/card.js +5 -2
- package/dist/components/layout/card/card.js.map +1 -1
- package/dist/components/navigation/link/link.d.ts +13 -3
- package/dist/components/navigation/link/link.d.ts.map +1 -1
- package/dist/components/navigation/link/link.js +25 -9
- package/dist/components/navigation/link/link.js.map +1 -1
- package/dist/components/status-and-feedback/step-bar/step-bar.styles.js +1 -1
- package/dist/css/dropdown.css +17 -0
- package/dist/css/global-open-font.css +1 -0
- package/dist/css/global.css +1 -0
- package/dist/css/rich-text.css +8 -2
- package/dist/css/variables.css +2 -1
- package/dist/nldd.min.js +941 -789
- package/dist/types/react.d.ts +151 -15
- package/dist/types/vue.d.ts +305 -45
- package/dist/utilities/autoloader.generated.d.ts.map +1 -1
- package/dist/utilities/autoloader.generated.js +1 -0
- package/dist/utilities/autoloader.generated.js.map +1 -1
- package/dist/utilities/codemirror/codemirror-element.d.ts +12 -1
- package/dist/utilities/codemirror/codemirror-element.d.ts.map +1 -1
- package/dist/utilities/codemirror/codemirror-element.js +23 -4
- package/dist/utilities/codemirror/codemirror-element.js.map +1 -1
- package/dist/utilities/codemirror/codemirror-input.d.ts +3 -0
- package/dist/utilities/codemirror/codemirror-input.d.ts.map +1 -1
- package/dist/utilities/codemirror/codemirror-input.js +14 -3
- package/dist/utilities/codemirror/codemirror-input.js.map +1 -1
- package/dist/utilities/described-by-mixin.d.ts +6 -0
- package/dist/utilities/described-by-mixin.d.ts.map +1 -1
- package/dist/utilities/described-by-mixin.js +81 -2
- package/dist/utilities/described-by-mixin.js.map +1 -1
- package/dist/utilities/dev-rules.generated.d.ts.map +1 -1
- package/dist/utilities/dev-rules.generated.js +46 -5
- package/dist/utilities/dev-rules.generated.js.map +1 -1
- package/dist/utilities/field-button-controller.d.ts +28 -0
- package/dist/utilities/field-button-controller.d.ts.map +1 -0
- package/dist/utilities/field-button-controller.js +56 -0
- package/dist/utilities/field-button-controller.js.map +1 -0
- package/dist/utilities/return-focus.d.ts.map +1 -1
- package/dist/utilities/return-focus.js +3 -0
- package/dist/utilities/return-focus.js.map +1 -1
- package/dist/utilities/shortcut.d.ts +14 -0
- package/dist/utilities/shortcut.d.ts.map +1 -1
- package/dist/utilities/shortcut.js +37 -1
- package/dist/utilities/shortcut.js.map +1 -1
- package/lint/data.generated.json +1 -1
- package/lint/linter.js +4 -1
- package/package.json +6 -2
- package/dist/cdn/chunks/checkbox-field-CSXV0prA.js +0 -162
- package/dist/cdn/chunks/described-by-mixin-DXC6jkCd.js +0 -35
- package/dist/cdn/chunks/repeat-s95Ixbpx.js +0 -76
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { $ as e,
|
|
2
|
-
import { a as ie, r as
|
|
3
|
-
import { t as
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
6
|
-
import { t as
|
|
7
|
-
import { t as
|
|
8
|
-
import "./icon-
|
|
9
|
-
import { a as
|
|
10
|
-
import "./avatar-
|
|
11
|
-
import { o as
|
|
12
|
-
import { t as
|
|
13
|
-
import { t as
|
|
14
|
-
import { t as
|
|
15
|
-
import { r as
|
|
1
|
+
import { $ as e, F as t, H as n, I as r, J as i, L as a, N as o, O as s, P as c, Q as l, R as u, U as d, Y as f, a as p, at as m, ct as h, et as g, j as _, k as v, n as ee, q as te, r as ne, rt as y, st as b, tt as x, ut as re } from "./languages-C9AGuuSS.js";
|
|
2
|
+
import { a as ie, n as ae, r as S } from "./custom-element-DeaCQ2NP.js";
|
|
3
|
+
import { t as oe } from "./reflect-non-default-Bu3rpCvg.js";
|
|
4
|
+
import { a as se, c as ce, d as le, f as ue, i as de, l as fe, n as pe, o as me, r as he, s as ge, t as _e, u as ve } from "./codemirror-input-DJ0wgYrc.js";
|
|
5
|
+
import { a as ye, i as be, r as xe, t as Se } from "./dist-Da_liXcd.js";
|
|
6
|
+
import { t as Ce } from "./custom-element-BW8Ua4c7.js";
|
|
7
|
+
import { t as we } from "./query-ChDzi9FQ.js";
|
|
8
|
+
import "./icon-qpmEfU9B.js";
|
|
9
|
+
import { a as Te, c as Ee, i as De, n as Oe } from "./dist-VCymi0hs.js";
|
|
10
|
+
import "./avatar-Dhqn-Dmv.js";
|
|
11
|
+
import { o as ke, t as C } from "./decorate-CCYde2ES.js";
|
|
12
|
+
import { t as Ae } from "./shadow-resets-CRdvf-Ei.js";
|
|
13
|
+
import { t as je } from "./text-editor.i18n-sJKiRQ4i.js";
|
|
14
|
+
import { t as Me } from "./translations-cJjO6nQV.js";
|
|
15
|
+
import { r as Ne } from "./element-state-B-44fVqq.js";
|
|
16
16
|
// src/components/inputs/text-editor/text-editor.labels.ts
|
|
17
|
-
var
|
|
17
|
+
var Pe = b.define();
|
|
18
18
|
// src/components/inputs/text-editor/text-editor.syntax.ts
|
|
19
|
-
function
|
|
20
|
-
for (let
|
|
19
|
+
function w(e, t, n, r) {
|
|
20
|
+
for (let i = s(e).resolveInner(t, n); i; i = i.parent) if (r(i)) return i;
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
|
-
var
|
|
24
|
-
function
|
|
25
|
-
return
|
|
23
|
+
var T = /* @__PURE__ */ new Set(["FencedCode", "CodeBlock"]), Fe = /* @__PURE__ */ new Set([...T, "InlineCode"]);
|
|
24
|
+
function E(e, t) {
|
|
25
|
+
return O(e, t, 1, T) !== null;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
27
|
+
function Ie(e, t) {
|
|
28
|
+
return O(e, t, 1, Fe) !== null;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function Le(e, t, n, r) {
|
|
31
31
|
for (let i = t; i <= n;) {
|
|
32
32
|
let t = e.doc.lineAt(i);
|
|
33
33
|
r(t.from), i = t.to + 1;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
return
|
|
36
|
+
function D(e, t) {
|
|
37
|
+
return s(e) !== s(t);
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
return
|
|
39
|
+
function Re(e, t) {
|
|
40
|
+
return O(e, t, 1, "HorizontalRule") !== null;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
return
|
|
42
|
+
function O(e, t, n, r) {
|
|
43
|
+
return w(e, t, n, typeof r == "string" ? (e) => e.name === r : (e) => r.has(e.name));
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function ze(e) {
|
|
46
46
|
let t = [];
|
|
47
47
|
for (let n = e.firstChild; n; n = n.nextSibling) n.name === "LinkMark" && t.push(n);
|
|
48
48
|
if (t.length < 2) return null;
|
|
@@ -53,35 +53,35 @@ function Le(e) {
|
|
|
53
53
|
} : null;
|
|
54
54
|
}
|
|
55
55
|
// src/components/inputs/text-editor/text-editor.mention.ts
|
|
56
|
-
var
|
|
57
|
-
function
|
|
58
|
-
return `[@${e.text.replace(/[[\]\\]/g, (e) => "\\" + e)}](${
|
|
56
|
+
var Be = "user:";
|
|
57
|
+
function Ve(e) {
|
|
58
|
+
return `[@${e.text.replace(/[[\]\\]/g, (e) => "\\" + e)}](${Be}${encodeURIComponent(e.id).replace(/[()<>]/g, (e) => "%" + e.charCodeAt(0).toString(16).toUpperCase())})`;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
return `${
|
|
60
|
+
function He(e) {
|
|
61
|
+
return `${Ve(e)} `;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function Ue(e) {
|
|
64
64
|
return e.replace(/\\([[\]\\])/g, "$1");
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function We(e) {
|
|
67
67
|
try {
|
|
68
68
|
return decodeURIComponent(e);
|
|
69
69
|
} catch {
|
|
70
70
|
return e;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
var
|
|
74
|
-
function
|
|
75
|
-
return e.startsWith(
|
|
73
|
+
var Ge = RegExp(`\\[(@[^\\]]*)\\]\\(${Be}[^)]*\\)`, "g");
|
|
74
|
+
function Ke(e) {
|
|
75
|
+
return e.startsWith(Be);
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function k(e, t) {
|
|
78
78
|
let n = t.getChild("URL");
|
|
79
|
-
return n !== null &&
|
|
79
|
+
return n !== null && Ke(e.sliceDoc(n.from, n.to));
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function qe(e, t, n) {
|
|
82
82
|
return e.from === e.to || e.from > t || e.to < n ? "none" : e.from === t && e.to === n ? "alone" : "within";
|
|
83
83
|
}
|
|
84
|
-
var
|
|
84
|
+
var Je = class extends t {
|
|
85
85
|
constructor(e, t, n) {
|
|
86
86
|
super(), this.label = e, this.id = t, this.selected = n;
|
|
87
87
|
}
|
|
@@ -97,71 +97,71 @@ var Ge = class extends f {
|
|
|
97
97
|
return n.className = "cm-md-mention-token-name", n.dataset.label = this.label, e.append(t, n), e;
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
|
-
function
|
|
101
|
-
let t = [],
|
|
102
|
-
return
|
|
103
|
-
if (
|
|
104
|
-
if (
|
|
105
|
-
let i =
|
|
106
|
-
if (!a || !
|
|
107
|
-
let o =
|
|
100
|
+
function Ye(e) {
|
|
101
|
+
let t = [], n = e.selection.main;
|
|
102
|
+
return s(e).iterate({ enter: (r) => {
|
|
103
|
+
if (Fe.has(r.name)) return !1;
|
|
104
|
+
if (r.name !== "Link") return;
|
|
105
|
+
let i = r.node, a = i.getChild("URL");
|
|
106
|
+
if (!a || !k(e, i)) return;
|
|
107
|
+
let o = ze(i);
|
|
108
108
|
if (!o) return;
|
|
109
|
-
let s =
|
|
110
|
-
t.push(
|
|
111
|
-
} }),
|
|
109
|
+
let s = Ue(e.sliceDoc(o.from, o.to).replace(/^@/, "")), c = We(e.sliceDoc(a.from, a.to).slice(5)), l = qe(n, i.from, i.to);
|
|
110
|
+
t.push(v.replace({ widget: new Je(s, c, l) }).range(i.from, i.to));
|
|
111
|
+
} }), v.set(t, !0);
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function Xe(e, t, n) {
|
|
114
114
|
let r = !1;
|
|
115
115
|
return e.between(0, 1e9, (e, i) => {
|
|
116
|
-
if (
|
|
116
|
+
if (qe(t, e, i) !== qe(n, e, i)) return r = !0, !1;
|
|
117
117
|
}), r;
|
|
118
118
|
}
|
|
119
|
-
var
|
|
120
|
-
create: (e) =>
|
|
121
|
-
update: (e, t) => t.docChanged ||
|
|
122
|
-
provide: (e) =>
|
|
123
|
-
}),
|
|
124
|
-
function
|
|
125
|
-
return
|
|
119
|
+
var Ze = h.define({
|
|
120
|
+
create: (e) => Ye(e),
|
|
121
|
+
update: (e, t) => t.docChanged || D(t.startState, t.state) ? Ye(t.state) : t.startState.selection.eq(t.state.selection) ? e : Xe(e, t.startState.selection.main, t.state.selection.main) ? Ye(t.state) : e,
|
|
122
|
+
provide: (e) => _.decorations.from(e)
|
|
123
|
+
}), Qe = _.atomicRanges.of((e) => e.state.field(Ze, !1) ?? v.none), $e = [y.highest(Ze), Qe];
|
|
124
|
+
function et(e, t, n) {
|
|
125
|
+
return w(e, t, n, (t) => t.name === "Link" && k(e, t));
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
let n =
|
|
127
|
+
function tt(e, t) {
|
|
128
|
+
let n = et(e, t, 1);
|
|
129
129
|
return n ? {
|
|
130
130
|
from: n.from,
|
|
131
131
|
to: n.to
|
|
132
132
|
} : null;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
let n =
|
|
134
|
+
function nt(e, t) {
|
|
135
|
+
let n = et(e, t, -1);
|
|
136
136
|
return n && n.to === t ? {
|
|
137
137
|
from: n.from,
|
|
138
138
|
to: n.to
|
|
139
139
|
} : null;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
let n =
|
|
141
|
+
function rt(e, t) {
|
|
142
|
+
let n = et(e, t, 1);
|
|
143
143
|
return n && n.from === t ? {
|
|
144
144
|
from: n.from,
|
|
145
145
|
to: n.to
|
|
146
146
|
} : null;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function it(e, t) {
|
|
149
149
|
let n = e.state.selection.main;
|
|
150
150
|
if (!n.empty) return !1;
|
|
151
|
-
let r = t < 0 ?
|
|
151
|
+
let r = t < 0 ? nt(e.state, n.head) : rt(e.state, n.head);
|
|
152
152
|
return r ? (e.dispatch({ selection: {
|
|
153
153
|
anchor: r.from,
|
|
154
154
|
head: r.to
|
|
155
155
|
} }), !0) : !1;
|
|
156
156
|
}
|
|
157
157
|
// src/components/inputs/text-editor/text-editor.caret.ts
|
|
158
|
-
function
|
|
159
|
-
let
|
|
160
|
-
if (!
|
|
161
|
-
let
|
|
162
|
-
if (
|
|
158
|
+
function at(e) {
|
|
159
|
+
let t = _.findFromDOM(e);
|
|
160
|
+
if (!t) return null;
|
|
161
|
+
let n = t.posAtDOM(e);
|
|
162
|
+
if (n <= t.state.doc.lineAt(n).from) return null;
|
|
163
163
|
try {
|
|
164
|
-
let e =
|
|
164
|
+
let e = t.coordsAtPos(n - 1, 1);
|
|
165
165
|
return e ? {
|
|
166
166
|
top: e.top,
|
|
167
167
|
bottom: e.bottom
|
|
@@ -171,7 +171,7 @@ function nt(e) {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
// src/components/inputs/text-editor/text-editor.links.ts
|
|
174
|
-
var
|
|
174
|
+
var ot = class extends t {
|
|
175
175
|
constructor(e, t) {
|
|
176
176
|
super(), this.href = e, this.ariaLabel = t(e);
|
|
177
177
|
}
|
|
@@ -188,7 +188,7 @@ var rt = class extends f {
|
|
|
188
188
|
return !0;
|
|
189
189
|
}
|
|
190
190
|
coordsAt(e, t, n) {
|
|
191
|
-
let r = e.getBoundingClientRect(), i =
|
|
191
|
+
let r = e.getBoundingClientRect(), i = at(e) ?? {
|
|
192
192
|
top: r.top,
|
|
193
193
|
bottom: r.bottom
|
|
194
194
|
}, a = getComputedStyle(e), o = n < 0 ? r.left - parseFloat(a.marginLeft) : r.right + parseFloat(a.marginRight);
|
|
@@ -200,90 +200,90 @@ var rt = class extends f {
|
|
|
200
200
|
};
|
|
201
201
|
}
|
|
202
202
|
};
|
|
203
|
-
function
|
|
203
|
+
function st(e) {
|
|
204
204
|
return e.replace(/^\[|\]$/g, "").trim().replace(/\s+/g, " ").toLowerCase();
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function ct(e) {
|
|
207
207
|
let t = /* @__PURE__ */ new Map();
|
|
208
|
-
return
|
|
208
|
+
return s(e).iterate({ enter: (n) => {
|
|
209
209
|
if (n.name !== "LinkReference") return;
|
|
210
210
|
let r = null, i = null;
|
|
211
|
-
for (let t = n.node.firstChild; t; t = t.nextSibling) t.name === "LinkLabel" ? r =
|
|
211
|
+
for (let t = n.node.firstChild; t; t = t.nextSibling) t.name === "LinkLabel" ? r = st(e.sliceDoc(t.from, t.to)) : t.name === "URL" && (i = e.sliceDoc(t.from, t.to));
|
|
212
212
|
r && i && !t.has(r) && t.set(r, i);
|
|
213
213
|
} }), t;
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function lt(e) {
|
|
216
216
|
let t = e.replace(/[\u0000-\u0020\u007f-\u009f]/g, "");
|
|
217
217
|
return !/^[a-z][a-z0-9+.-]*:/i.test(t) || /^(?:https?|mailto|tel):/i.test(t);
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function ut(e, t, n) {
|
|
220
220
|
let r = null;
|
|
221
221
|
for (let n = t.firstChild; n; n = n.nextSibling) {
|
|
222
222
|
if (n.name === "URL") {
|
|
223
223
|
let t = e.sliceDoc(n.from, n.to);
|
|
224
|
-
return t && !
|
|
224
|
+
return t && !Ke(t) && lt(t) ? t : null;
|
|
225
225
|
}
|
|
226
|
-
n.name === "LinkLabel" && (r =
|
|
226
|
+
n.name === "LinkLabel" && (r = st(e.sliceDoc(n.from, n.to)));
|
|
227
227
|
}
|
|
228
228
|
if (r) {
|
|
229
229
|
let e = n().get(r);
|
|
230
|
-
return e && !
|
|
230
|
+
return e && !Ke(e) && lt(e) ? e : null;
|
|
231
231
|
}
|
|
232
232
|
return null;
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function dt(e) {
|
|
235
235
|
for (let t = e.parent; t; t = t.parent) if (t.name === "Link" || t.name === "LinkReference" || t.name === "Image") return !0;
|
|
236
236
|
return !1;
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function ft(e, t) {
|
|
239
239
|
let n = e.sliceDoc(t.from, t.to);
|
|
240
|
-
if (!n ||
|
|
240
|
+
if (!n || Ke(n)) return null;
|
|
241
241
|
let r = n;
|
|
242
|
-
return /^[a-z][a-z0-9+.-]*:/i.test(n) || (/^www\./i.test(n) ? r = `https://${n}` : /^[^\s@]+@[^\s@]+$/.test(n) && (r = `mailto:${n}`)),
|
|
242
|
+
return /^[a-z][a-z0-9+.-]*:/i.test(n) || (/^www\./i.test(n) ? r = `https://${n}` : /^[^\s@]+@[^\s@]+$/.test(n) && (r = `mailto:${n}`)), lt(r) ? r : null;
|
|
243
243
|
}
|
|
244
|
-
function
|
|
245
|
-
let
|
|
246
|
-
widget: new
|
|
244
|
+
function pt(e, t) {
|
|
245
|
+
let n = new m(), r = s(e.state), i = null, a = () => i ?? (i = ct(e.state)), o = (e, r) => n.add(e, e, v.widget({
|
|
246
|
+
widget: new ot(r, t),
|
|
247
247
|
side: -1
|
|
248
248
|
}));
|
|
249
|
-
for (let { from: t, to: n } of e.visibleRanges)
|
|
249
|
+
for (let { from: t, to: n } of e.visibleRanges) r.iterate({
|
|
250
250
|
from: t,
|
|
251
251
|
to: n,
|
|
252
252
|
enter: (t) => {
|
|
253
253
|
if (t.name === "Link") {
|
|
254
|
-
let n =
|
|
255
|
-
n &&
|
|
256
|
-
} else if (t.name === "URL" && !
|
|
257
|
-
let n =
|
|
258
|
-
n &&
|
|
254
|
+
let n = ut(e.state, t.node, a);
|
|
255
|
+
n && o(t.to, n);
|
|
256
|
+
} else if (t.name === "URL" && !dt(t.node)) {
|
|
257
|
+
let n = ft(e.state, t.node);
|
|
258
|
+
n && o(t.to, n);
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
});
|
|
262
|
-
return
|
|
262
|
+
return n.finish();
|
|
263
263
|
}
|
|
264
|
-
function
|
|
265
|
-
return
|
|
264
|
+
function mt(e) {
|
|
265
|
+
return c.fromClass(class {
|
|
266
266
|
constructor(t) {
|
|
267
|
-
this.decorations =
|
|
267
|
+
this.decorations = pt(t, e);
|
|
268
268
|
}
|
|
269
269
|
update(t) {
|
|
270
|
-
(t.docChanged || t.viewportChanged ||
|
|
270
|
+
(t.docChanged || t.viewportChanged || D(t.startState, t.state) || t.transactions.some((e) => e.effects.some((e) => e.is(Pe)))) && (this.decorations = pt(t.view, e));
|
|
271
271
|
}
|
|
272
272
|
}, { decorations: (e) => e.decorations });
|
|
273
273
|
}
|
|
274
|
-
function
|
|
274
|
+
function ht(e, t) {
|
|
275
275
|
let n = null;
|
|
276
|
-
return
|
|
276
|
+
return w(e, t, -1, (r) => r.to === t ? r.name === "Link" ? ut(e, r, () => n ?? (n = ct(e))) !== null : r.name === "URL" && !dt(r) && ft(e, r) !== null : !1) !== null;
|
|
277
277
|
}
|
|
278
|
-
function
|
|
279
|
-
return
|
|
278
|
+
function gt(e, t) {
|
|
279
|
+
return w(e, t, -1, (n) => n.name === "URL" && n.to === t && !dt(n) && ft(e, n) !== null) !== null;
|
|
280
280
|
}
|
|
281
281
|
// src/components/inputs/text-editor/text-editor.emphasis.ts
|
|
282
|
-
var
|
|
282
|
+
var A = /* @__PURE__ */ new Map([
|
|
283
283
|
["StrongEmphasis", "**"],
|
|
284
284
|
["Emphasis", "*"],
|
|
285
285
|
["Strikethrough", "~~"]
|
|
286
|
-
]),
|
|
286
|
+
]), _t = /* @__PURE__ */ new Set([
|
|
287
287
|
"Paragraph",
|
|
288
288
|
"ATXHeading1",
|
|
289
289
|
"ATXHeading2",
|
|
@@ -294,21 +294,21 @@ var k = /* @__PURE__ */ new Map([
|
|
|
294
294
|
"SetextHeading1",
|
|
295
295
|
"SetextHeading2",
|
|
296
296
|
"TableCell"
|
|
297
|
-
]),
|
|
297
|
+
]), vt = /^\s*(?:\n\s*(?:(?:[-*+]|\d+[.)]|>|\[[ xX]\])\s*)*)*$/, yt = b.define({ map: (e, t) => ({
|
|
298
298
|
...e,
|
|
299
299
|
from: t.mapPos(e.from, 1),
|
|
300
300
|
to: t.mapPos(e.to, -1)
|
|
301
301
|
}) });
|
|
302
|
-
function
|
|
303
|
-
return
|
|
302
|
+
function bt(e, t, n) {
|
|
303
|
+
return w(e, t, n, (e) => A.has(e.name));
|
|
304
304
|
}
|
|
305
|
-
function
|
|
306
|
-
return
|
|
305
|
+
function xt(e, t) {
|
|
306
|
+
return O(e, t, 1, _t);
|
|
307
307
|
}
|
|
308
|
-
function
|
|
309
|
-
let { from: t, to: n } = e.selection.main, r =
|
|
308
|
+
function St(e) {
|
|
309
|
+
let { from: t, to: n } = e.selection.main, r = bt(e, t, -1), i = r && bt(e, n, 1);
|
|
310
310
|
if (!r || !i || r.from !== i.from || r.to !== i.to) return null;
|
|
311
|
-
let a =
|
|
311
|
+
let a = A.get(r.name).length;
|
|
312
312
|
return {
|
|
313
313
|
from: r.from,
|
|
314
314
|
to: r.to,
|
|
@@ -317,49 +317,49 @@ function vt(e) {
|
|
|
317
317
|
live: !0
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function Ct(e, t) {
|
|
321
321
|
let n = t.marker.length, { from: r, to: i } = e.selection.main;
|
|
322
322
|
if (r < t.from + n || i > t.to - n) return !1;
|
|
323
323
|
let a = e.sliceDoc(t.from, t.to);
|
|
324
324
|
if (a.length < 2 * n || !a.startsWith(t.marker) || !a.endsWith(t.marker)) return !1;
|
|
325
|
-
let o =
|
|
325
|
+
let o = xt(e, t.from);
|
|
326
326
|
if (!o || o.to < t.to) return !1;
|
|
327
|
-
let s =
|
|
327
|
+
let s = bt(e, t.from, 1);
|
|
328
328
|
return !(s && s.name === t.name && s.from === t.from);
|
|
329
329
|
}
|
|
330
|
-
function
|
|
330
|
+
function wt(e, t) {
|
|
331
331
|
return {
|
|
332
332
|
...e,
|
|
333
333
|
from: t.changes.mapPos(e.from, 1),
|
|
334
334
|
to: t.changes.mapPos(e.to, -1)
|
|
335
335
|
};
|
|
336
336
|
}
|
|
337
|
-
var
|
|
338
|
-
create: (e) =>
|
|
337
|
+
var j = h.define({
|
|
338
|
+
create: (e) => St(e),
|
|
339
339
|
update(e, t) {
|
|
340
340
|
if (e) {
|
|
341
|
-
let n =
|
|
341
|
+
let n = wt({
|
|
342
342
|
...e,
|
|
343
343
|
live: !1
|
|
344
344
|
}, t);
|
|
345
|
-
if (
|
|
345
|
+
if (Ct(t.state, n)) return n;
|
|
346
346
|
}
|
|
347
|
-
let n =
|
|
347
|
+
let n = St(t.state);
|
|
348
348
|
if (n) return n;
|
|
349
|
-
let r = t.effects.find((e) => e.is(
|
|
349
|
+
let r = t.effects.find((e) => e.is(yt));
|
|
350
350
|
return r ? {
|
|
351
351
|
...r.value,
|
|
352
352
|
live: !1
|
|
353
353
|
} : null;
|
|
354
354
|
}
|
|
355
355
|
});
|
|
356
|
-
function
|
|
356
|
+
function Tt(e, t) {
|
|
357
357
|
let n = t.marker.length, r = e.sliceDoc(t.from, t.to);
|
|
358
358
|
if (r.length < 2 * n || !r.startsWith(t.marker) || !r.endsWith(t.marker)) return null;
|
|
359
|
-
let i = r.slice(n, r.length - n), a = /^\s*/.exec(i)[0].length, o =
|
|
359
|
+
let i = r.slice(n, r.length - n), a = /^\s*/.exec(i)[0].length, o = xt(e, t.from), s = e.sliceDoc(t.from + n, Math.min(t.to - n, o ? o.to : t.to - n)), c = t.from + n + s.replace(/\s+$/, "").length;
|
|
360
360
|
if (c <= t.from + n + a) return null;
|
|
361
361
|
let l = t.to - n - c;
|
|
362
|
-
return !a && !l || !
|
|
362
|
+
return !a && !l || !vt.test(e.sliceDoc(c, t.to - n)) ? null : {
|
|
363
363
|
from: t.from,
|
|
364
364
|
to: t.to,
|
|
365
365
|
len: n,
|
|
@@ -367,7 +367,7 @@ function xt(e, t) {
|
|
|
367
367
|
trail: l
|
|
368
368
|
};
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function Et(e, t) {
|
|
371
371
|
let n = [];
|
|
372
372
|
return t.lead && n.push({
|
|
373
373
|
from: t.from,
|
|
@@ -383,7 +383,7 @@ function St(e, t) {
|
|
|
383
383
|
insert: e.sliceDoc(t.to - t.len - t.trail, t.to - t.len)
|
|
384
384
|
}), n;
|
|
385
385
|
}
|
|
386
|
-
function
|
|
386
|
+
function Dt(e, t, n) {
|
|
387
387
|
let r = t.from + t.len + t.lead, i = t.to - t.len - t.trail;
|
|
388
388
|
if (t.lead) {
|
|
389
389
|
if (e > t.from && e < t.from + t.len) return e + t.lead;
|
|
@@ -395,35 +395,35 @@ function Ct(e, t, n) {
|
|
|
395
395
|
}
|
|
396
396
|
return e;
|
|
397
397
|
}
|
|
398
|
-
function
|
|
399
|
-
let
|
|
400
|
-
if (!
|
|
401
|
-
let
|
|
398
|
+
function Ot(t, n, r) {
|
|
399
|
+
let i = Tt(t, n);
|
|
400
|
+
if (!i) return null;
|
|
401
|
+
let a = t.selection;
|
|
402
402
|
return {
|
|
403
|
-
changes:
|
|
404
|
-
selection:
|
|
403
|
+
changes: Et(t, i),
|
|
404
|
+
selection: e.create(a.ranges.map((t) => e.range(Dt(t.anchor, i, r), Dt(t.head, i, r))), a.mainIndex),
|
|
405
405
|
userEvent: "input.emphasis"
|
|
406
406
|
};
|
|
407
407
|
}
|
|
408
|
-
function
|
|
409
|
-
let n =
|
|
410
|
-
return n ?
|
|
408
|
+
function kt(e, t) {
|
|
409
|
+
let n = Tt(e, t);
|
|
410
|
+
return n ? Et(e, n) : [];
|
|
411
411
|
}
|
|
412
|
-
function
|
|
413
|
-
let t = e.state.field(
|
|
412
|
+
function At(e) {
|
|
413
|
+
let t = e.state.field(j, !1);
|
|
414
414
|
if (!t || t.live || e.state.readOnly) return;
|
|
415
|
-
let n =
|
|
415
|
+
let n = Ot(e.state, t, !0);
|
|
416
416
|
n && e.dispatch(n);
|
|
417
417
|
}
|
|
418
|
-
var
|
|
418
|
+
var jt = [j, c.fromClass(class {
|
|
419
419
|
constructor(e) {
|
|
420
420
|
this.view = e, this.pending = null, this.destroyed = !1;
|
|
421
421
|
}
|
|
422
422
|
update(e) {
|
|
423
|
-
this.pending && (this.pending =
|
|
424
|
-
let t = e.startState.field(
|
|
423
|
+
this.pending && (this.pending = wt(this.pending, e));
|
|
424
|
+
let t = e.startState.field(j);
|
|
425
425
|
if (!t) return;
|
|
426
|
-
let n =
|
|
426
|
+
let n = wt(t, e), r = e.state.field(j);
|
|
427
427
|
r && r.name === n.name && r.from === n.from && r.to === n.to || (this.pending = n, queueMicrotask(() => this.flush()));
|
|
428
428
|
}
|
|
429
429
|
flush() {
|
|
@@ -439,13 +439,83 @@ var Dt = [A, u.fromClass(class {
|
|
|
439
439
|
});
|
|
440
440
|
return;
|
|
441
441
|
}
|
|
442
|
-
let t =
|
|
442
|
+
let t = Ot(this.view.state, e, !1);
|
|
443
443
|
t && this.view.dispatch(t);
|
|
444
444
|
}
|
|
445
445
|
destroy() {
|
|
446
446
|
this.destroyed = !0;
|
|
447
447
|
}
|
|
448
|
-
})],
|
|
448
|
+
})], Mt = y.high(n.of([{
|
|
449
|
+
key: "Enter",
|
|
450
|
+
run: xe({ nonTightLists: !1 })
|
|
451
|
+
}, {
|
|
452
|
+
key: "Backspace",
|
|
453
|
+
run: Se
|
|
454
|
+
}])), M = /^( *)([-*+]|\d{1,9}[.)])( +|$)/, Nt = /^( *)([-*+]|\d{1,9}[.)]) ( *)([-*+]|\d{1,9}[.)]) $/, Pt = /^( +)([-*+]|\d{1,9}[.)]) $/, Ft = /^((?:> ?)*> )> $/, It = (e) => /\d/.test(e);
|
|
455
|
+
function N(e, t) {
|
|
456
|
+
let n = [], r = Infinity, i = 0;
|
|
457
|
+
for (let a = t - 1; a >= 1 && a > t - 500; a--) {
|
|
458
|
+
let t = e.doc.line(a).text;
|
|
459
|
+
if (t.trim() === "") {
|
|
460
|
+
if (++i >= 2) break;
|
|
461
|
+
continue;
|
|
462
|
+
}
|
|
463
|
+
let o = M.exec(t);
|
|
464
|
+
if (!o) {
|
|
465
|
+
if (/^\S/.test(t) && i > 0) break;
|
|
466
|
+
i = 0;
|
|
467
|
+
continue;
|
|
468
|
+
}
|
|
469
|
+
i = 0;
|
|
470
|
+
let s = o[1].length;
|
|
471
|
+
if (!(s >= r) && (n.push({
|
|
472
|
+
markerCol: s,
|
|
473
|
+
contentCol: s + o[2].length + Math.max(1, Math.min(o[3].length, 4))
|
|
474
|
+
}), r = s, s === 0)) break;
|
|
475
|
+
}
|
|
476
|
+
return n;
|
|
477
|
+
}
|
|
478
|
+
function Lt(e, t) {
|
|
479
|
+
return e.length === 0 ? 0 : t > e[0].markerCol ? e[0].contentCol : e.find((e) => e.markerCol <= t)?.markerCol ?? 0;
|
|
480
|
+
}
|
|
481
|
+
function Rt(e, t, n) {
|
|
482
|
+
let r = Ft.exec(n);
|
|
483
|
+
if (r) return r[1];
|
|
484
|
+
let i = Nt.exec(n);
|
|
485
|
+
if (i) {
|
|
486
|
+
let [, n, r, a, o] = i, s = N(e, t), c = `${" ".repeat(s.length ? s[0].contentCol : n.length + r.length + 1)}${o} `;
|
|
487
|
+
return a === "" ? It(r) === It(o) ? It(o) && parseInt(o, 10) === 1 && parseInt(r, 10) !== 1 ? c : `${n}${r} ` : `${n}${o} ` : c;
|
|
488
|
+
}
|
|
489
|
+
let a = Pt.exec(n);
|
|
490
|
+
if (a) {
|
|
491
|
+
let [, n, r] = a, i = Lt(N(e, t), n.length);
|
|
492
|
+
return i === n.length ? null : `${" ".repeat(i)}${r} `;
|
|
493
|
+
}
|
|
494
|
+
return null;
|
|
495
|
+
}
|
|
496
|
+
var zt = _.inputHandler.of((e, t, n, r) => {
|
|
497
|
+
if (r !== " " || t !== n || e.state.readOnly) return !1;
|
|
498
|
+
let i = e.state.doc.lineAt(t);
|
|
499
|
+
if (E(e.state, i.from)) return !1;
|
|
500
|
+
let a = i.text.slice(0, t - i.from) + " ", o = Rt(e.state, i.number, a);
|
|
501
|
+
return o === null || o === a ? !1 : (e.dispatch({
|
|
502
|
+
changes: {
|
|
503
|
+
from: t,
|
|
504
|
+
insert: " "
|
|
505
|
+
},
|
|
506
|
+
selection: { anchor: t + 1 },
|
|
507
|
+
userEvent: "input.type"
|
|
508
|
+
}), e.dispatch({
|
|
509
|
+
changes: {
|
|
510
|
+
from: i.from,
|
|
511
|
+
to: i.from + a.length,
|
|
512
|
+
insert: o
|
|
513
|
+
},
|
|
514
|
+
selection: { anchor: i.from + o.length },
|
|
515
|
+
userEvent: "input.complete",
|
|
516
|
+
annotations: ce.of("before")
|
|
517
|
+
}), !0);
|
|
518
|
+
}), Bt = {
|
|
449
519
|
ATXHeading1: "cm-md-h1",
|
|
450
520
|
ATXHeading2: "cm-md-h2",
|
|
451
521
|
ATXHeading3: "cm-md-h3",
|
|
@@ -458,7 +528,7 @@ var Dt = [A, u.fromClass(class {
|
|
|
458
528
|
InlineCode: "cm-md-code",
|
|
459
529
|
URL: "cm-md-url",
|
|
460
530
|
Blockquote: "cm-md-quote"
|
|
461
|
-
},
|
|
531
|
+
}, Vt = /* @__PURE__ */ new Set([
|
|
462
532
|
"HeaderMark",
|
|
463
533
|
"EmphasisMark",
|
|
464
534
|
"StrikethroughMark",
|
|
@@ -466,136 +536,156 @@ var Dt = [A, u.fromClass(class {
|
|
|
466
536
|
"QuoteMark",
|
|
467
537
|
"ListMark",
|
|
468
538
|
"LinkMark"
|
|
469
|
-
]),
|
|
470
|
-
function
|
|
471
|
-
return
|
|
539
|
+
]), Ht = v.mark({ class: "cm-md-mark" }), Ut = v.line({ class: "cm-md-quote-row" }), Wt = {};
|
|
540
|
+
function P(e) {
|
|
541
|
+
return Wt[e] ?? (Wt[e] = v.mark({
|
|
472
542
|
class: e,
|
|
473
543
|
inclusiveEnd: !0
|
|
474
544
|
}));
|
|
475
545
|
}
|
|
476
|
-
var
|
|
477
|
-
function
|
|
546
|
+
var Gt = v.line({ class: "cm-md-codeblock" }), Kt = v.line({ class: "cm-md-codeblock-first" }), qt = v.line({ class: "cm-md-codeblock-last" }), Jt = v.line({ class: "cm-md-codeblock-line-selected" });
|
|
547
|
+
function Yt(e, t, n, r) {
|
|
478
548
|
if (t.length === 0) return;
|
|
479
549
|
let i = e.doc.line(t[0]), a = e.doc.line(t[t.length - 1]), o = !n.empty && n.from <= i.from && n.to >= a.to;
|
|
480
550
|
t.forEach((i, a) => {
|
|
481
551
|
let s = e.doc.line(i);
|
|
482
|
-
if (r.push(
|
|
552
|
+
if (r.push(Gt.range(s.from)), a === 0 && r.push(Kt.range(s.from)), a === t.length - 1 && r.push(qt.range(s.from)), o) r.push(Jt.range(s.from));
|
|
483
553
|
else if (!n.empty) {
|
|
484
554
|
let e = Math.max(s.from, n.from), t = Math.min(s.to, n.to);
|
|
485
|
-
t > e && r.push(
|
|
555
|
+
t > e && r.push(P("cm-md-codeblock-selected").range(e, t));
|
|
486
556
|
}
|
|
487
557
|
});
|
|
488
558
|
}
|
|
489
|
-
function
|
|
559
|
+
function Xt(e, t, n, r, i) {
|
|
490
560
|
let a = e.doc.lineAt(t).number, o = e.doc.lineAt(Math.max(t, n - 1)).number, s = [];
|
|
491
561
|
for (let e = a; e <= o; e++) s.push(e);
|
|
492
|
-
|
|
562
|
+
Yt(e, s, r, i);
|
|
493
563
|
}
|
|
494
|
-
function
|
|
564
|
+
function Zt(e, t, n, r) {
|
|
495
565
|
let i = /* @__PURE__ */ new Set();
|
|
496
566
|
for (let n = t.firstChild; n; n = n.nextSibling) n.name === "CodeMark" && i.add(e.doc.lineAt(n.from).number);
|
|
497
567
|
let a = e.doc.lineAt(t.from).number, o = e.doc.lineAt(Math.max(t.from, t.to - 1)).number, s = [];
|
|
498
568
|
for (let e = a; e <= o; e++) i.has(e) || s.push(e);
|
|
499
|
-
|
|
500
|
-
}
|
|
501
|
-
function
|
|
502
|
-
|
|
503
|
-
}
|
|
504
|
-
function
|
|
505
|
-
let t = [],
|
|
506
|
-
for (let { from:
|
|
507
|
-
from:
|
|
508
|
-
to:
|
|
509
|
-
enter: (
|
|
510
|
-
if (
|
|
511
|
-
if (
|
|
512
|
-
|
|
569
|
+
Yt(e, s, n, r);
|
|
570
|
+
}
|
|
571
|
+
function Qt(e, t, n) {
|
|
572
|
+
k(e, t) || n.push(P("cm-md-link").range(t.from, t.to));
|
|
573
|
+
}
|
|
574
|
+
function $t(e) {
|
|
575
|
+
let t = [], n = e.state.selection.main;
|
|
576
|
+
for (let { from: r, to: i } of e.visibleRanges) s(e.state).iterate({
|
|
577
|
+
from: r,
|
|
578
|
+
to: i,
|
|
579
|
+
enter: (r) => {
|
|
580
|
+
if (r.from >= r.to) return;
|
|
581
|
+
if (r.name === "Link") {
|
|
582
|
+
Qt(e.state, r.node, t);
|
|
513
583
|
return;
|
|
514
584
|
}
|
|
515
|
-
if (
|
|
516
|
-
|
|
585
|
+
if (r.name === "FencedCode") {
|
|
586
|
+
Zt(e.state, r.node, n, t);
|
|
517
587
|
return;
|
|
518
588
|
}
|
|
519
|
-
if (
|
|
520
|
-
|
|
589
|
+
if (r.name === "CodeBlock") {
|
|
590
|
+
Xt(e.state, r.from, r.to, n, t);
|
|
521
591
|
return;
|
|
522
592
|
}
|
|
523
|
-
if (
|
|
524
|
-
t.push(
|
|
593
|
+
if (r.name === "URL" && !dt(r.node)) {
|
|
594
|
+
t.push(P("cm-md-autolink").range(r.from, r.to));
|
|
525
595
|
return;
|
|
526
596
|
}
|
|
527
|
-
|
|
528
|
-
let i =
|
|
597
|
+
r.name === "Blockquote" && r.node.parent?.name !== "Blockquote" && Le(e.state, r.from, r.to, (e) => t.push(Ut.range(e)));
|
|
598
|
+
let i = Bt[r.name];
|
|
529
599
|
if (i) {
|
|
530
|
-
if (i === "cm-md-code" && !
|
|
531
|
-
else if (t.push(
|
|
532
|
-
let e = Math.max(
|
|
533
|
-
i > e && t.push(
|
|
600
|
+
if (i === "cm-md-code" && !n.empty && n.from <= r.from && n.to >= r.to) t.push(P("cm-md-code cm-md-code-selected").range(r.from, r.to));
|
|
601
|
+
else if (t.push(P(i).range(r.from, r.to)), !n.empty && i === "cm-md-code") {
|
|
602
|
+
let e = Math.max(r.from, n.from), i = Math.min(r.to, n.to), a = (e === r.from ? " cm-md-code-selected-start" : "") + (i === r.to ? " cm-md-code-selected-end" : "");
|
|
603
|
+
i > e && t.push(P(`cm-md-code-selected${a}`).range(e, i));
|
|
534
604
|
}
|
|
535
|
-
} else
|
|
605
|
+
} else Vt.has(r.name) && t.push(Ht.range(r.from, r.to));
|
|
536
606
|
}
|
|
537
607
|
});
|
|
538
|
-
let
|
|
539
|
-
if (
|
|
540
|
-
let e =
|
|
541
|
-
t.push(
|
|
608
|
+
let r = e.state.field(j, !1);
|
|
609
|
+
if (r && !r.live) {
|
|
610
|
+
let e = r.marker.length;
|
|
611
|
+
t.push(P(Bt[r.name]).range(r.from, r.to)), t.push(Ht.range(r.from, r.from + e), Ht.range(r.to - e, r.to));
|
|
542
612
|
}
|
|
543
|
-
return
|
|
613
|
+
return v.set(t, !0);
|
|
544
614
|
}
|
|
545
|
-
var
|
|
615
|
+
var en = c.fromClass(class {
|
|
546
616
|
constructor(e) {
|
|
547
|
-
this.decorations =
|
|
617
|
+
this.decorations = $t(e);
|
|
548
618
|
}
|
|
549
619
|
update(e) {
|
|
550
|
-
(e.docChanged || e.viewportChanged || e.selectionSet ||
|
|
620
|
+
(e.docChanged || e.viewportChanged || e.selectionSet || D(e.startState, e.state)) && (this.decorations = $t(e.view));
|
|
551
621
|
}
|
|
552
|
-
}, { decorations: (e) => e.decorations }),
|
|
553
|
-
function
|
|
554
|
-
return
|
|
622
|
+
}, { decorations: (e) => e.decorations }), tn = /^((?:[ \t]*(?:[-*+][ \t]+(?:\[[ xX]\][ \t]+)?|\d+[.)][ \t]+|>[ \t]?))+)/;
|
|
623
|
+
function nn(e) {
|
|
624
|
+
return tn.exec(e)?.[1].length ?? 0;
|
|
555
625
|
}
|
|
556
|
-
var
|
|
557
|
-
function
|
|
558
|
-
return
|
|
626
|
+
var rn = v.mark({ class: "cm-md-listprefix" }), an = {};
|
|
627
|
+
function on(e) {
|
|
628
|
+
return an[e] ?? (an[e] = v.line({ attributes: { style: `text-indent:calc(${e} * var(--_text-editor-marker-advance) * -1);padding-left:calc(${e} * var(--_text-editor-marker-advance))` } }));
|
|
559
629
|
}
|
|
560
|
-
function
|
|
630
|
+
function sn(e) {
|
|
561
631
|
let t = [], n = 0;
|
|
562
632
|
for (let r = e.doc.iterLines(); !r.next().done;) {
|
|
563
|
-
let i = r.value, a =
|
|
564
|
-
if (a && a[1].length && !
|
|
633
|
+
let i = r.value, a = tn.exec(i);
|
|
634
|
+
if (a && a[1].length && !E(e, n) && !Re(e, n)) {
|
|
565
635
|
let e = a[1].length;
|
|
566
|
-
t.push(
|
|
636
|
+
t.push(on(e).range(n)), t.push(rn.range(n, n + e));
|
|
567
637
|
}
|
|
568
638
|
n += i.length + 1;
|
|
569
639
|
}
|
|
570
|
-
return
|
|
640
|
+
return v.set(t, !0);
|
|
571
641
|
}
|
|
572
|
-
var
|
|
573
|
-
create: (e) =>
|
|
574
|
-
update: (e, t) => t.docChanged ||
|
|
575
|
-
provide: (e) =>
|
|
576
|
-
}),
|
|
577
|
-
|
|
578
|
-
extensions: [
|
|
579
|
-
|
|
642
|
+
var cn = h.define({
|
|
643
|
+
create: (e) => sn(e),
|
|
644
|
+
update: (e, t) => t.docChanged || D(t.startState, t.state) ? sn(t.state) : e,
|
|
645
|
+
provide: (e) => _.decorations.from(e)
|
|
646
|
+
}), ln = [
|
|
647
|
+
be({
|
|
648
|
+
extensions: [
|
|
649
|
+
ye,
|
|
650
|
+
{ remove: ["IndentedCode"] },
|
|
651
|
+
{ parseBlock: [{
|
|
652
|
+
name: "IndentedText",
|
|
653
|
+
before: "FencedCode",
|
|
654
|
+
parse(e, t) {
|
|
655
|
+
if (t.indent < t.baseIndent + 4) return !1;
|
|
656
|
+
let n = e.lineStart + t.pos, r = t.text.slice(t.pos);
|
|
657
|
+
return e.addElement(e.elt("Paragraph", n, n + r.length, e.parser.parseInline(r, n))), e.nextLine(), !0;
|
|
658
|
+
}
|
|
659
|
+
}] }
|
|
660
|
+
],
|
|
661
|
+
codeLanguages: ee,
|
|
662
|
+
addKeymap: !1
|
|
580
663
|
}),
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
664
|
+
Mt,
|
|
665
|
+
zt,
|
|
666
|
+
en,
|
|
667
|
+
jt,
|
|
668
|
+
cn,
|
|
669
|
+
$e
|
|
670
|
+
], un = "[\\p{L}\\p{M}\\p{N}_.+-]*", dn = /* @__PURE__ */ new Map();
|
|
671
|
+
function fn(e, t) {
|
|
587
672
|
if (e.length !== 1 || /[\s\p{L}\p{N}_]/u.test(e)) return null;
|
|
588
673
|
let n = `${e}\u0000${t}`;
|
|
589
|
-
if (
|
|
674
|
+
if (dn.has(n)) return dn.get(n);
|
|
590
675
|
let r;
|
|
591
676
|
try {
|
|
592
|
-
|
|
677
|
+
let n = [
|
|
678
|
+
"*",
|
|
679
|
+
"_",
|
|
680
|
+
"~"
|
|
681
|
+
].filter((t) => t !== e).join(""), i = e.replace(/[\\^$.*+?()[\]{}|/]/g, "\\$&");
|
|
682
|
+
r = RegExp(`((?:^|[\\s\\p{Ps}\\p{Pi}"'])[${n}]*)(${i})(${t})$`, "u");
|
|
593
683
|
} catch {
|
|
594
|
-
r = t === "[\\p{L}\\p{M}\\p{N}_.+-]*" ? null :
|
|
684
|
+
r = t === "[\\p{L}\\p{M}\\p{N}_.+-]*" ? null : fn(e, un);
|
|
595
685
|
}
|
|
596
|
-
return
|
|
686
|
+
return dn.set(n, r), r;
|
|
597
687
|
}
|
|
598
|
-
function
|
|
688
|
+
function pn(e) {
|
|
599
689
|
return e.some(({ query: e }) => {
|
|
600
690
|
if (e === void 0) return !1;
|
|
601
691
|
try {
|
|
@@ -605,7 +695,7 @@ function en(e) {
|
|
|
605
695
|
}
|
|
606
696
|
});
|
|
607
697
|
}
|
|
608
|
-
function
|
|
698
|
+
function mn(e) {
|
|
609
699
|
let t = /* @__PURE__ */ new Map();
|
|
610
700
|
for (let n of e) {
|
|
611
701
|
let { trigger: e, query: r } = typeof n == "string" ? {
|
|
@@ -614,27 +704,27 @@ function tn(e) {
|
|
|
614
704
|
} : n;
|
|
615
705
|
(!t.has(e) || t.get(e) === void 0 && r !== void 0) && t.set(e, r);
|
|
616
706
|
}
|
|
617
|
-
return Array.from(t, ([e, t]) =>
|
|
707
|
+
return Array.from(t, ([e, t]) => fn(e, t ?? "[\\p{L}\\p{M}\\p{N}_.+-]*")).filter((e) => e !== null);
|
|
618
708
|
}
|
|
619
|
-
function
|
|
709
|
+
function hn(e, t, n) {
|
|
620
710
|
let r = e.doc.lineAt(t), i = e.sliceDoc(r.from, t), a = null;
|
|
621
|
-
for (let e of
|
|
711
|
+
for (let e of mn(n)) {
|
|
622
712
|
let t = e.exec(i);
|
|
623
713
|
t && (!a || t.index + t[1].length > a.index + a[1].length) && (a = t);
|
|
624
714
|
}
|
|
625
715
|
if (!a) return null;
|
|
626
716
|
let o = r.from + a.index + a[1].length;
|
|
627
|
-
return
|
|
717
|
+
return Ie(e, o) ? null : {
|
|
628
718
|
from: o,
|
|
629
719
|
to: t,
|
|
630
720
|
query: a[3],
|
|
631
721
|
trigger: a[2]
|
|
632
722
|
};
|
|
633
723
|
}
|
|
634
|
-
function
|
|
724
|
+
function gn(e) {
|
|
635
725
|
return (t) => `${e}${t.text} `;
|
|
636
726
|
}
|
|
637
|
-
function
|
|
727
|
+
function _n(e) {
|
|
638
728
|
let { candidate: t } = e;
|
|
639
729
|
if (t.avatar) {
|
|
640
730
|
let e = document.createElement("nldd-avatar");
|
|
@@ -650,17 +740,17 @@ function an(e) {
|
|
|
650
740
|
}
|
|
651
741
|
return null;
|
|
652
742
|
}
|
|
653
|
-
function
|
|
743
|
+
function vn(e) {
|
|
654
744
|
return e.candidate.avatar ? "cm-nldd-row-avatar" : "";
|
|
655
745
|
}
|
|
656
|
-
var
|
|
657
|
-
function
|
|
746
|
+
var F = b.define();
|
|
747
|
+
function yn(e, t, n) {
|
|
658
748
|
return async (r) => {
|
|
659
|
-
let i = e(), a =
|
|
749
|
+
let i = e(), a = hn(r.state, r.pos, i);
|
|
660
750
|
if (!a) return null;
|
|
661
751
|
let o = i.filter((e) => e.trigger === a.trigger), s = await Promise.all(o.map((e) => e.source(a.query))), c = [];
|
|
662
752
|
s.forEach((e, n) => {
|
|
663
|
-
let r = o[n], i = r.insert ??
|
|
753
|
+
let r = o[n], i = r.insert ?? gn(a.trigger);
|
|
664
754
|
for (let n of e ?? []) c.push({
|
|
665
755
|
label: `${a.trigger}${n.text}`,
|
|
666
756
|
detail: n.supportingText,
|
|
@@ -685,13 +775,13 @@ function sn(e, t, n) {
|
|
|
685
775
|
}
|
|
686
776
|
});
|
|
687
777
|
});
|
|
688
|
-
let l = c.length ? null :
|
|
778
|
+
let l = c.length ? null : bn(o, a.query, n), u = r.view;
|
|
689
779
|
if (u && !r.aborted && u.state.doc === r.state.doc) {
|
|
690
|
-
let e = u.state.field(
|
|
780
|
+
let e = u.state.field(I, !1), t = l === null ? null : {
|
|
691
781
|
from: a.from,
|
|
692
782
|
text: l
|
|
693
783
|
};
|
|
694
|
-
(e?.text !== t?.text || e?.from !== t?.from) && u.dispatch({ effects:
|
|
784
|
+
(e?.text !== t?.text || e?.from !== t?.from) && u.dispatch({ effects: F.of(t) });
|
|
695
785
|
}
|
|
696
786
|
return c.length ? {
|
|
697
787
|
from: a.from,
|
|
@@ -700,17 +790,17 @@ function sn(e, t, n) {
|
|
|
700
790
|
} : null;
|
|
701
791
|
};
|
|
702
792
|
}
|
|
703
|
-
function
|
|
793
|
+
function bn(e, t, n) {
|
|
704
794
|
for (let n of e) {
|
|
705
795
|
let e = n.emptyText?.(t);
|
|
706
796
|
if (e !== void 0) return e || null;
|
|
707
797
|
}
|
|
708
798
|
return n(t);
|
|
709
799
|
}
|
|
710
|
-
var
|
|
800
|
+
var I = h.define({
|
|
711
801
|
create: () => null,
|
|
712
802
|
update(e, t) {
|
|
713
|
-
for (let e of t.effects) if (e.is(
|
|
803
|
+
for (let e of t.effects) if (e.is(F)) return e.value;
|
|
714
804
|
if (!e) return null;
|
|
715
805
|
if (t.docChanged && (e = {
|
|
716
806
|
...e,
|
|
@@ -721,7 +811,7 @@ var N = b.define({
|
|
|
721
811
|
}
|
|
722
812
|
return e;
|
|
723
813
|
},
|
|
724
|
-
provide: (e) =>
|
|
814
|
+
provide: (e) => te.from(e, (e) => e && {
|
|
725
815
|
pos: e.from,
|
|
726
816
|
above: !1,
|
|
727
817
|
create: () => {
|
|
@@ -729,34 +819,34 @@ var N = b.define({
|
|
|
729
819
|
return t.className = "cm-nldd-typeahead-empty", t.textContent = e.text, { dom: t };
|
|
730
820
|
}
|
|
731
821
|
})
|
|
732
|
-
}),
|
|
733
|
-
|
|
822
|
+
}), xn = [
|
|
823
|
+
y.high(n.of([{
|
|
734
824
|
key: "Escape",
|
|
735
|
-
run: (e) => e.state.field(
|
|
825
|
+
run: (e) => e.state.field(I, !1) ? (e.dispatch({ effects: F.of(null) }), !0) : !1
|
|
736
826
|
}])),
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
827
|
+
_.focusChangeEffect.of((e, t) => !t && e.field(I, !1) ? F.of(null) : null),
|
|
828
|
+
_.updateListener.of((e) => {
|
|
829
|
+
De(e.state) === "active" && e.state.field(I, !1) && queueMicrotask(() => e.view.dispatch({ effects: F.of(null) }));
|
|
740
830
|
})
|
|
741
831
|
];
|
|
742
|
-
function
|
|
743
|
-
return
|
|
832
|
+
function Sn(e) {
|
|
833
|
+
return c.fromClass(class {
|
|
744
834
|
constructor(e) {
|
|
745
835
|
this.status = document.createElement("div"), this.status.className = "cm-nldd-typeahead-status", this.status.setAttribute("role", "status"), e.dom.append(this.status);
|
|
746
836
|
}
|
|
747
837
|
update(t) {
|
|
748
|
-
let n =
|
|
838
|
+
let n = De(t.state);
|
|
749
839
|
if (n === "pending") return;
|
|
750
|
-
let r = t.state.field(
|
|
751
|
-
r ? i = r.text : n === "active" && (i = e(
|
|
840
|
+
let r = t.state.field(I, !1), i = "";
|
|
841
|
+
r ? i = r.text : n === "active" && (i = e(Te(t.state).length)), this.status.textContent !== i && (this.status.textContent = i);
|
|
752
842
|
}
|
|
753
843
|
destroy() {
|
|
754
844
|
this.status.remove();
|
|
755
845
|
}
|
|
756
846
|
});
|
|
757
847
|
}
|
|
758
|
-
var
|
|
759
|
-
function
|
|
848
|
+
var L = 16;
|
|
849
|
+
function Cn() {
|
|
760
850
|
let e = document.createElement("div");
|
|
761
851
|
e.popover = "manual", e.className = "cm-nldd-popups";
|
|
762
852
|
let t = () => {
|
|
@@ -764,7 +854,7 @@ function dn() {
|
|
|
764
854
|
if (t !== e.matches(":popover-open")) try {
|
|
765
855
|
t ? e.showPopover() : e.hidePopover();
|
|
766
856
|
} catch {}
|
|
767
|
-
}, n =
|
|
857
|
+
}, n = c.define((n) => {
|
|
768
858
|
n.dom.appendChild(e);
|
|
769
859
|
let r = new MutationObserver(t);
|
|
770
860
|
return r.observe(e, {
|
|
@@ -774,123 +864,123 @@ function dn() {
|
|
|
774
864
|
r.disconnect(), e.remove();
|
|
775
865
|
} };
|
|
776
866
|
});
|
|
777
|
-
return [
|
|
867
|
+
return [i({
|
|
778
868
|
parent: e,
|
|
779
869
|
tooltipSpace: () => ({
|
|
780
|
-
left:
|
|
781
|
-
top:
|
|
782
|
-
right: window.innerWidth -
|
|
783
|
-
bottom: window.innerHeight -
|
|
870
|
+
left: L,
|
|
871
|
+
top: L,
|
|
872
|
+
right: window.innerWidth - L,
|
|
873
|
+
bottom: window.innerHeight - L
|
|
784
874
|
})
|
|
785
875
|
}), n];
|
|
786
876
|
}
|
|
787
|
-
function
|
|
788
|
-
let
|
|
789
|
-
t.docChanged &&
|
|
877
|
+
function wn(e, t, n = () => null, r = (e) => String(e)) {
|
|
878
|
+
let i = _.updateListener.of((t) => {
|
|
879
|
+
t.docChanged && De(t.state) === null && t.transactions.some((e) => e.isUserEvent("delete")) && hn(t.state, t.state.selection.main.head, e()) && Ee(t.view);
|
|
790
880
|
});
|
|
791
881
|
return [
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
override: [
|
|
882
|
+
Cn(),
|
|
883
|
+
Oe({
|
|
884
|
+
override: [yn(e, t, n)],
|
|
795
885
|
icons: !1,
|
|
796
886
|
addToOptions: [{
|
|
797
887
|
position: 20,
|
|
798
|
-
render:
|
|
888
|
+
render: _n
|
|
799
889
|
}],
|
|
800
|
-
optionClass:
|
|
890
|
+
optionClass: vn
|
|
801
891
|
}),
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
892
|
+
i,
|
|
893
|
+
I,
|
|
894
|
+
xn,
|
|
895
|
+
Sn(r)
|
|
806
896
|
];
|
|
807
897
|
}
|
|
808
898
|
// src/components/inputs/text-editor/text-editor.spellcheck.ts
|
|
809
|
-
var
|
|
899
|
+
var Tn = x.define(), En = /* @__PURE__ */ new Set([
|
|
810
900
|
"InlineCode",
|
|
811
901
|
"FencedCode",
|
|
812
902
|
"CodeBlock",
|
|
813
903
|
"URL",
|
|
814
904
|
"Autolink"
|
|
815
905
|
]);
|
|
816
|
-
function
|
|
817
|
-
return e.name === "Link" &&
|
|
906
|
+
function Dn(e, t) {
|
|
907
|
+
return e.name === "Link" && k(t, e.node);
|
|
818
908
|
}
|
|
819
|
-
var
|
|
820
|
-
function
|
|
821
|
-
let t = e.state.facet(
|
|
822
|
-
for (let { from:
|
|
823
|
-
from:
|
|
909
|
+
var On = Tn.of((e, t) => En.has(e.name) || Dn(e, t)), kn = v.mark({ attributes: { spellcheck: "false" } });
|
|
910
|
+
function An(e) {
|
|
911
|
+
let t = e.state.facet(Tn), n = new m(), r = s(e.state), i = -1;
|
|
912
|
+
for (let { from: a, to: o } of e.visibleRanges) r.iterate({
|
|
913
|
+
from: a,
|
|
824
914
|
to: o,
|
|
825
|
-
enter: (
|
|
826
|
-
if (t.some((t) => t(
|
|
915
|
+
enter: (r) => {
|
|
916
|
+
if (t.some((t) => t(r, e.state))) return r.to > r.from && r.from >= i && (n.add(r.from, r.to, kn), i = r.to), !1;
|
|
827
917
|
}
|
|
828
918
|
});
|
|
829
|
-
return
|
|
919
|
+
return n.finish();
|
|
830
920
|
}
|
|
831
|
-
var
|
|
921
|
+
var jn = c.fromClass(class {
|
|
832
922
|
constructor(e) {
|
|
833
|
-
this.decorations =
|
|
923
|
+
this.decorations = An(e);
|
|
834
924
|
}
|
|
835
925
|
update(e) {
|
|
836
|
-
(e.docChanged || e.viewportChanged ||
|
|
926
|
+
(e.docChanged || e.viewportChanged || D(e.startState, e.state)) && (this.decorations = An(e.view));
|
|
837
927
|
}
|
|
838
|
-
}, { decorations: (e) => e.decorations }),
|
|
928
|
+
}, { decorations: (e) => e.decorations }), Mn = x.define({ combine: (e) => e.some(Boolean) }), Nn = /* @__PURE__ */ new WeakMap(), Pn = _.domEventObservers({ keydown(e, t) {
|
|
839
929
|
let n = e.isTrusted && !e.isComposing && !e.shiftKey && !e.altKey && !e.ctrlKey && !e.metaKey;
|
|
840
|
-
|
|
930
|
+
Nn.set(t, n && (e.key === "Backspace" || e.key === "Delete") ? e.key : null);
|
|
841
931
|
} });
|
|
842
|
-
function
|
|
932
|
+
function Fn(e, t) {
|
|
843
933
|
let { node: n, offset: r } = e.domAtPos(t);
|
|
844
934
|
return n.nodeType === Node.TEXT_NODE ? {
|
|
845
935
|
node: n,
|
|
846
936
|
offset: r
|
|
847
937
|
} : null;
|
|
848
938
|
}
|
|
849
|
-
function
|
|
850
|
-
if (!e.state.facet(
|
|
939
|
+
function In(e, t) {
|
|
940
|
+
if (!e.state.facet(Mn) || Nn.get(e) !== t) return !1;
|
|
851
941
|
let { selection: n, doc: r } = e.state;
|
|
852
942
|
if (n.ranges.length > 1) return !1;
|
|
853
943
|
let { from: i, to: a, empty: o } = n.main, s = r.lineAt(i);
|
|
854
944
|
if (!/\S/.test(e.state.sliceDoc(s.from, i)) && !(t === "Delete" && o)) return !1;
|
|
855
|
-
let c =
|
|
945
|
+
let c = Fn(e, i);
|
|
856
946
|
if (!c) return !1;
|
|
857
947
|
if (!o) {
|
|
858
|
-
let t =
|
|
948
|
+
let t = Fn(e, a);
|
|
859
949
|
return t !== null && t.node === c.node && c.offset >= 1;
|
|
860
950
|
}
|
|
861
951
|
return t === "Backspace" ? c.offset >= 2 : c.offset >= 1 && c.offset <= c.node.length - 2;
|
|
862
952
|
}
|
|
863
|
-
function
|
|
953
|
+
function Ln() {
|
|
864
954
|
return [
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
955
|
+
_.contentAttributes.of({ spellcheck: "true" }),
|
|
956
|
+
On,
|
|
957
|
+
y.highest(jn),
|
|
958
|
+
Mn.of(!0),
|
|
959
|
+
Pn
|
|
870
960
|
];
|
|
871
961
|
}
|
|
872
|
-
function
|
|
962
|
+
function R(e) {
|
|
873
963
|
return e.includes("") ? e.split("").join("") : e;
|
|
874
964
|
}
|
|
875
|
-
function
|
|
965
|
+
function z(e) {
|
|
876
966
|
let t = [];
|
|
877
967
|
for (let n = e.indexOf(""); n !== -1; n = e.indexOf("", n + 1)) t.push(n);
|
|
878
968
|
return t;
|
|
879
969
|
}
|
|
880
|
-
function
|
|
970
|
+
function Rn(e, t) {
|
|
881
971
|
let n = e.indexOf(""), r = 0;
|
|
882
972
|
for (; n !== -1 && n < t;) r++, n = e.indexOf("", n + 1);
|
|
883
973
|
return r;
|
|
884
974
|
}
|
|
885
|
-
function
|
|
886
|
-
return t -
|
|
975
|
+
function B(e, t) {
|
|
976
|
+
return t - Rn(e, t);
|
|
887
977
|
}
|
|
888
|
-
function
|
|
978
|
+
function V(e, t) {
|
|
889
979
|
let n = t;
|
|
890
980
|
for (let t of e) t <= n && n++;
|
|
891
981
|
return n;
|
|
892
982
|
}
|
|
893
|
-
function
|
|
983
|
+
function zn(e, t, n = Un) {
|
|
894
984
|
let r = [];
|
|
895
985
|
for (let i of e) i.to <= i.from || (n(t, i.from, "start") && r.push({
|
|
896
986
|
pos: i.from,
|
|
@@ -901,13 +991,13 @@ function On(e, t, n = Mn) {
|
|
|
901
991
|
}));
|
|
902
992
|
return r;
|
|
903
993
|
}
|
|
904
|
-
function
|
|
994
|
+
function Bn(e) {
|
|
905
995
|
let t = /* @__PURE__ */ new Map();
|
|
906
996
|
for (let n of e) t.set(n.pos, (t.get(n.pos) ?? 0) + 1);
|
|
907
997
|
return t;
|
|
908
998
|
}
|
|
909
|
-
function
|
|
910
|
-
let r =
|
|
999
|
+
function Vn(e, t, n = Un) {
|
|
1000
|
+
let r = Bn(zn(t, t.length ? R(e) : "", n)), i = [], a = 0, o = 0;
|
|
911
1001
|
for (;;) {
|
|
912
1002
|
let t = 0;
|
|
913
1003
|
for (; a + t < e.length && e[a + t] === "";) t++;
|
|
@@ -923,37 +1013,37 @@ function An(e, t, n = Mn) {
|
|
|
923
1013
|
a++, o++;
|
|
924
1014
|
}
|
|
925
1015
|
}
|
|
926
|
-
var
|
|
927
|
-
function
|
|
928
|
-
let r = e.lastIndexOf("\n", t - 1) + 1, i = e.indexOf("\n", t) === -1 ? e.length : e.indexOf("\n", t), a = e.slice(r, i), o = a.match(
|
|
1016
|
+
var Hn = /^(\s*)(#{1,6}\s|[-*+]\s|\d+[.)]\s|>|`{3,}|~{3,})/;
|
|
1017
|
+
function Un(e, t, n) {
|
|
1018
|
+
let r = e.lastIndexOf("\n", t - 1) + 1, i = e.indexOf("\n", t) === -1 ? e.length : e.indexOf("\n", t), a = e.slice(r, i), o = a.match(Hn);
|
|
929
1019
|
return !(o && t < r + o[0].length || (a.slice(0, t - r).match(/~~/g) ?? []).length % 2 == 1);
|
|
930
1020
|
}
|
|
931
1021
|
// src/components/inputs/text-editor/text-editor.annotations.ts
|
|
932
|
-
var
|
|
933
|
-
function
|
|
934
|
-
return e.field(
|
|
1022
|
+
var Wn = b.define(), Gn = b.define(), Kn = b.define(), qn = b.define();
|
|
1023
|
+
function Jn(e) {
|
|
1024
|
+
return e.field(H, !1) ?? [];
|
|
935
1025
|
}
|
|
936
|
-
function
|
|
1026
|
+
function Yn(e, t) {
|
|
937
1027
|
return e.map((e) => ({
|
|
938
1028
|
id: e.id,
|
|
939
1029
|
from: Math.max(0, Math.min(e.start, t)),
|
|
940
1030
|
to: Math.max(0, Math.min(e.end, t))
|
|
941
1031
|
})).filter((e) => e.to > e.from);
|
|
942
1032
|
}
|
|
943
|
-
function
|
|
1033
|
+
function Xn(e, t) {
|
|
944
1034
|
return {
|
|
945
|
-
from:
|
|
946
|
-
to:
|
|
1035
|
+
from: V(t, e.from),
|
|
1036
|
+
to: V(t, e.to - 1) + 1
|
|
947
1037
|
};
|
|
948
1038
|
}
|
|
949
|
-
var
|
|
1039
|
+
var H = h.define({
|
|
950
1040
|
create: () => [],
|
|
951
1041
|
update: (e, t) => {
|
|
952
|
-
let n = t.effects.find((e) => e.is(
|
|
1042
|
+
let n = t.effects.find((e) => e.is(Gn));
|
|
953
1043
|
return n ? n.value : e;
|
|
954
1044
|
}
|
|
955
1045
|
});
|
|
956
|
-
function
|
|
1046
|
+
function Zn(e) {
|
|
957
1047
|
let t = [];
|
|
958
1048
|
for (let n of [...e].sort((e, t) => e.from - t.from || e.to - t.to)) {
|
|
959
1049
|
let e = t[t.length - 1];
|
|
@@ -965,13 +1055,13 @@ function zn(e) {
|
|
|
965
1055
|
}
|
|
966
1056
|
return t;
|
|
967
1057
|
}
|
|
968
|
-
var
|
|
969
|
-
function
|
|
970
|
-
return e.length >
|
|
1058
|
+
var Qn = 40;
|
|
1059
|
+
function $n(e) {
|
|
1060
|
+
return e.length > Qn ? `${e.slice(0, Qn)}…` : e;
|
|
971
1061
|
}
|
|
972
|
-
var
|
|
1062
|
+
var er = class extends t {
|
|
973
1063
|
constructor(e, t, n) {
|
|
974
|
-
super(), this.ids = e, this.quote = t, this.ariaLabel = n(e.length,
|
|
1064
|
+
super(), this.ids = e, this.quote = t, this.ariaLabel = n(e.length, $n(t));
|
|
975
1065
|
}
|
|
976
1066
|
eq(e) {
|
|
977
1067
|
return e.quote === this.quote && e.ids.length === this.ids.length && e.ids.every((e, t) => e === this.ids[t]) && e.ariaLabel === this.ariaLabel;
|
|
@@ -981,7 +1071,7 @@ var Hn = class extends f {
|
|
|
981
1071
|
return e.className = "cm-annotation-badge", e.type = "button", e.dataset.annotations = this.ids.join(" "), e.textContent = String(this.ids.length), e.setAttribute("aria-label", this.ariaLabel), e;
|
|
982
1072
|
}
|
|
983
1073
|
coordsAt(e, t, n) {
|
|
984
|
-
let r = e.getBoundingClientRect(), i = getComputedStyle(e), a =
|
|
1074
|
+
let r = e.getBoundingClientRect(), i = getComputedStyle(e), a = at(e) ?? {
|
|
985
1075
|
top: r.top,
|
|
986
1076
|
bottom: r.bottom
|
|
987
1077
|
}, o = e.closest(".cm-annotation"), s = o ? o.getClientRects() : null, c = s && s.length ? s[s.length - 1] : null, l = t <= 0 ? r.left - parseFloat(i.marginLeft) : c ? c.right : r.right + parseFloat(i.marginRight);
|
|
@@ -992,13 +1082,13 @@ var Hn = class extends f {
|
|
|
992
1082
|
bottom: a.bottom
|
|
993
1083
|
};
|
|
994
1084
|
}
|
|
995
|
-
},
|
|
1085
|
+
}, tr = v.mark({
|
|
996
1086
|
class: "cm-annotation",
|
|
997
1087
|
inclusiveEnd: !0
|
|
998
|
-
}),
|
|
1088
|
+
}), nr = v.mark({
|
|
999
1089
|
class: "cm-annotation is-selected",
|
|
1000
1090
|
inclusiveEnd: !0
|
|
1001
|
-
}),
|
|
1091
|
+
}), rr = v.mark({ class: "is-selected" }), ir = class e extends t {
|
|
1002
1092
|
eq(t) {
|
|
1003
1093
|
return t instanceof e;
|
|
1004
1094
|
}
|
|
@@ -1010,7 +1100,7 @@ var Hn = class extends f {
|
|
|
1010
1100
|
let r = e.nextElementSibling;
|
|
1011
1101
|
for (; r instanceof HTMLElement && r.classList.contains("cm-widgetBuffer");) r = r.nextElementSibling;
|
|
1012
1102
|
if (!(r instanceof HTMLElement) || !r.classList.contains("cm-annotation")) return null;
|
|
1013
|
-
let i = parseFloat(getComputedStyle(r).paddingInlineStart || "0"), a = r.getClientRects()[0] ?? r.getBoundingClientRect(), o =
|
|
1103
|
+
let i = parseFloat(getComputedStyle(r).paddingInlineStart || "0"), a = r.getClientRects()[0] ?? r.getBoundingClientRect(), o = at(e) ?? {
|
|
1014
1104
|
top: a.top,
|
|
1015
1105
|
bottom: a.bottom
|
|
1016
1106
|
}, s = t <= 0 ? a.left : a.left + i;
|
|
@@ -1021,12 +1111,12 @@ var Hn = class extends f {
|
|
|
1021
1111
|
bottom: o.bottom
|
|
1022
1112
|
};
|
|
1023
1113
|
}
|
|
1024
|
-
},
|
|
1114
|
+
}, ar = v.replace({ widget: new ir() }), or = v.mark({}), sr = v.mark({
|
|
1025
1115
|
class: "cm-annotation-tail",
|
|
1026
1116
|
inclusiveEnd: !0
|
|
1027
1117
|
});
|
|
1028
|
-
function
|
|
1029
|
-
let r =
|
|
1118
|
+
function cr(e, t, n) {
|
|
1119
|
+
let r = V(n, e.from), i = V(n, e.to - 1) + 1;
|
|
1030
1120
|
return {
|
|
1031
1121
|
docFrom: r,
|
|
1032
1122
|
textTo: i,
|
|
@@ -1034,63 +1124,63 @@ function Xn(e, t, n) {
|
|
|
1034
1124
|
endSent: i < t.length && t[i] === "" ? i : null
|
|
1035
1125
|
};
|
|
1036
1126
|
}
|
|
1037
|
-
var
|
|
1038
|
-
deco:
|
|
1039
|
-
atomic:
|
|
1127
|
+
var lr = {
|
|
1128
|
+
deco: v.none,
|
|
1129
|
+
atomic: v.none
|
|
1040
1130
|
};
|
|
1041
|
-
function
|
|
1042
|
-
if (!e.field(
|
|
1043
|
-
let n = e.doc.toString(), r = e.selection.main, i =
|
|
1131
|
+
function ur(e, t) {
|
|
1132
|
+
if (!e.field(H).length) return lr;
|
|
1133
|
+
let n = e.doc.toString(), r = e.selection.main, i = z(n), a = n.length - i.length, o = R(n), s = e.field(H).map((e) => ({
|
|
1044
1134
|
id: e.id,
|
|
1045
1135
|
from: Math.min(e.from, a),
|
|
1046
1136
|
to: Math.min(e.to, a)
|
|
1047
1137
|
})).filter((e) => e.to > e.from), c = [], l = [];
|
|
1048
|
-
for (let e of
|
|
1138
|
+
for (let e of Zn(s)) {
|
|
1049
1139
|
if (e.to <= e.from) continue;
|
|
1050
|
-
let { docFrom: a, textTo: s, startSent: u, endSent:
|
|
1051
|
-
if (c.push((
|
|
1052
|
-
let e = Math.max(a, r.from), t = Math.min(
|
|
1053
|
-
t > e && c.push(
|
|
1140
|
+
let { docFrom: a, textTo: s, startSent: u, endSent: d } = cr(e, n, i), f = o.slice(e.from, e.to), p = d === null ? s : s + 1, m = !r.empty && r.from <= a && r.to >= p;
|
|
1141
|
+
if (c.push((m ? nr : tr).range(a, p)), !m && !r.empty) {
|
|
1142
|
+
let e = Math.max(a, r.from), t = Math.min(p, r.to);
|
|
1143
|
+
t > e && c.push(rr.range(e, t));
|
|
1054
1144
|
}
|
|
1055
|
-
let
|
|
1056
|
-
|
|
1057
|
-
widget: new
|
|
1145
|
+
let h = d === null ? s : d + 1, g = n.slice(a, s).match(/\S+$/);
|
|
1146
|
+
g && c.push(sr.range(a + (g.index ?? 0), h)), d === null ? c.push(v.widget({
|
|
1147
|
+
widget: new er(e.ids, f, t),
|
|
1058
1148
|
side: -1
|
|
1059
|
-
}).range(s)) : (c.push(
|
|
1149
|
+
}).range(s)) : (c.push(v.replace({ widget: new er(e.ids, f, t) }).range(d, d + 1)), l.push(or.range(d, d + 1))), u !== null && (c.push(ar.range(u, u + 1)), l.push(or.range(u, u + 1)));
|
|
1060
1150
|
}
|
|
1061
1151
|
return {
|
|
1062
|
-
deco:
|
|
1063
|
-
atomic:
|
|
1152
|
+
deco: v.set(c, !0),
|
|
1153
|
+
atomic: v.set(l, !0)
|
|
1064
1154
|
};
|
|
1065
1155
|
}
|
|
1066
|
-
function
|
|
1067
|
-
return
|
|
1068
|
-
create: (t) =>
|
|
1069
|
-
update: (t, n) => t ===
|
|
1070
|
-
provide: (e) =>
|
|
1156
|
+
function dr(e) {
|
|
1157
|
+
return h.define({
|
|
1158
|
+
create: (t) => ur(t, e),
|
|
1159
|
+
update: (t, n) => t === lr && !n.state.field(H).length ? t : n.docChanged || !n.startState.selection.eq(n.state.selection) || n.effects.some((e) => e.is(Wn) || e.is(Pe)) ? ur(n.state, e) : t,
|
|
1160
|
+
provide: (e) => _.decorations.from(e, (e) => e.deco)
|
|
1071
1161
|
});
|
|
1072
1162
|
}
|
|
1073
|
-
var
|
|
1074
|
-
let t = e.effects.find((e) => e.is(
|
|
1075
|
-
if (!e.docChanged && !t || !(t || e.effects.some((e) => e.is(
|
|
1076
|
-
let n = e.newDoc.toString(), r =
|
|
1077
|
-
if (t) i =
|
|
1163
|
+
var fr = g.transactionFilter.of((e) => {
|
|
1164
|
+
let t = e.effects.find((e) => e.is(Wn));
|
|
1165
|
+
if (!e.docChanged && !t || !(t || e.effects.some((e) => e.is(qn) || e.is(Kn))) && !(e.startState.field(H, !1) ?? []).length) return e;
|
|
1166
|
+
let n = e.newDoc.toString(), r = R(n).length, i;
|
|
1167
|
+
if (t) i = Yn(t.value, r);
|
|
1078
1168
|
else {
|
|
1079
|
-
let t =
|
|
1080
|
-
i = (e.startState.field(
|
|
1169
|
+
let t = z(e.startState.doc.toString()), a = e.effects.find((e) => e.is(Kn))?.value;
|
|
1170
|
+
i = (e.startState.field(H, !1) ?? []).map((r) => {
|
|
1081
1171
|
if (a && r.from >= a.from && r.to <= a.to) return {
|
|
1082
1172
|
id: r.id,
|
|
1083
1173
|
from: a.insertAt + (r.from - a.from),
|
|
1084
1174
|
to: a.insertAt + (r.to - a.from)
|
|
1085
1175
|
};
|
|
1086
|
-
let i =
|
|
1176
|
+
let i = Xn(r, t), o = e.changes.mapPos(i.from, -1), s = e.changes.mapPos(i.to, 1);
|
|
1087
1177
|
return {
|
|
1088
1178
|
id: r.id,
|
|
1089
|
-
from:
|
|
1090
|
-
to:
|
|
1179
|
+
from: B(n, o),
|
|
1180
|
+
to: B(n, s)
|
|
1091
1181
|
};
|
|
1092
1182
|
}).filter((e) => e.to > e.from);
|
|
1093
|
-
let o = e.effects.find((e) => e.is(
|
|
1183
|
+
let o = e.effects.find((e) => e.is(qn))?.value;
|
|
1094
1184
|
o && (i = i.concat(o.anns.map((e) => ({
|
|
1095
1185
|
id: e.id,
|
|
1096
1186
|
from: Math.max(0, Math.min(o.at + e.from, r)),
|
|
@@ -1098,34 +1188,95 @@ var er = e.transactionFilter.of((e) => {
|
|
|
1098
1188
|
})).filter((e) => e.to > e.from)));
|
|
1099
1189
|
}
|
|
1100
1190
|
return [e, {
|
|
1101
|
-
changes:
|
|
1102
|
-
effects: [
|
|
1191
|
+
changes: Vn(n, Zn(i)),
|
|
1192
|
+
effects: [Gn.of(i)],
|
|
1103
1193
|
sequential: !0
|
|
1104
1194
|
}];
|
|
1105
|
-
}),
|
|
1106
|
-
if (!e.effects.some((e) => e.is(
|
|
1107
|
-
let t = e.startState.field(
|
|
1108
|
-
return [
|
|
1109
|
-
}),
|
|
1110
|
-
function
|
|
1111
|
-
let
|
|
1195
|
+
}), pr = ge.of((e) => {
|
|
1196
|
+
if (!e.effects.some((e) => e.is(Gn))) return [];
|
|
1197
|
+
let t = e.startState.field(H, !1) ?? [];
|
|
1198
|
+
return [Gn.of(t)];
|
|
1199
|
+
}), mr = [_.clipboardOutputFilter.of((e) => R(e)), _.clipboardInputFilter.of((e) => R(e))];
|
|
1200
|
+
function hr(e) {
|
|
1201
|
+
let t = dr(e), n = _.atomicRanges.of((e) => e.state.field(t).atomic);
|
|
1112
1202
|
return [
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1203
|
+
H,
|
|
1204
|
+
y.highest(t),
|
|
1205
|
+
n,
|
|
1206
|
+
fr,
|
|
1207
|
+
pr,
|
|
1208
|
+
mr
|
|
1119
1209
|
];
|
|
1120
1210
|
}
|
|
1211
|
+
// src/components/inputs/text-editor/text-editor.paste.ts
|
|
1212
|
+
var gr = /^([ \t]*)(?:[•◦▪‣·]|o(?=\t))[ \t]+/, _r = /^([ \t]*)([-*+]|\d{1,9}[.)])\t+/, vr = /^( *)([-*+]|\d{1,9}[.)]) $/;
|
|
1213
|
+
function yr(e) {
|
|
1214
|
+
let t = /^[ \t]*/.exec(e)[0], n = 0;
|
|
1215
|
+
for (let e of t) n = e === " " ? n + 4 - n % 4 : n + 1;
|
|
1216
|
+
return " ".repeat(n) + e.slice(t.length);
|
|
1217
|
+
}
|
|
1218
|
+
var br = (e) => /^ */.exec(e)[0].length;
|
|
1219
|
+
function xr(e, t) {
|
|
1220
|
+
let { from: n, to: r } = e.selection.main, i = e.doc.lineAt(n), a = O(e, n, 1, T) ?? O(e, i.from, 1, T);
|
|
1221
|
+
if (a && a.from < n) return null;
|
|
1222
|
+
let o = i.text.slice(0, n - i.from), s = vr.exec(o), c = !s && o.trim() !== "";
|
|
1223
|
+
if (c && (n !== i.to || e.doc.lineAt(r).to !== r)) return null;
|
|
1224
|
+
let l = t.split("\n").map((e) => yr(e.replace(gr, "$1- ").replace(_r, "$1$2 "))), u = l.filter((e) => e.trim() !== "");
|
|
1225
|
+
if (u.length === 0) return null;
|
|
1226
|
+
let d = Math.min(...u.map(br));
|
|
1227
|
+
l = l.map((e) => e.trim() === "" ? "" : e.slice(d));
|
|
1228
|
+
let f = l.find((e) => e.trim() !== ""), p = M.test(f) && /\S/.test(f.replace(M, ""));
|
|
1229
|
+
if (c && (!p || u.length < 2)) return null;
|
|
1230
|
+
let m = 0, h = n;
|
|
1231
|
+
if (c) {
|
|
1232
|
+
let t = N(e, i.number + 1);
|
|
1233
|
+
return t.length && (m = d > 0 ? t[0].contentCol : t[0].markerCol), {
|
|
1234
|
+
from: n,
|
|
1235
|
+
to: r,
|
|
1236
|
+
insert: "\n" + Sr(l, m).join("\n")
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1239
|
+
if (p) {
|
|
1240
|
+
let t = N(e, i.number);
|
|
1241
|
+
if (s) {
|
|
1242
|
+
h = i.from;
|
|
1243
|
+
let e = s[1].length;
|
|
1244
|
+
m = d > 0 ? t.length ? t[0].contentCol : e + s[2].length + 1 : e;
|
|
1245
|
+
} else h = i.from, t.length && (m = d > 0 || o.length > 0 ? t[0].contentCol : t[0].markerCol);
|
|
1246
|
+
l = Sr(l, m);
|
|
1247
|
+
} else if ((s || d === 0) && l.join("\n") === t) return null;
|
|
1248
|
+
let g = l.join("\n");
|
|
1249
|
+
return g === e.sliceDoc(h, n) + t ? null : {
|
|
1250
|
+
from: h,
|
|
1251
|
+
to: r,
|
|
1252
|
+
insert: g
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
function Sr(e, t) {
|
|
1256
|
+
let n = [];
|
|
1257
|
+
return e.map((e) => {
|
|
1258
|
+
if (e.trim() === "") return "";
|
|
1259
|
+
let r = br(e), i = M.exec(e);
|
|
1260
|
+
if (i) {
|
|
1261
|
+
for (; n.length && n[n.length - 1].orig >= r;) n.pop();
|
|
1262
|
+
let a = n.length ? n[n.length - 1].content : t;
|
|
1263
|
+
return n.push({
|
|
1264
|
+
orig: r,
|
|
1265
|
+
content: a + i[2].length + 1
|
|
1266
|
+
}), `${" ".repeat(a)}${i[2]} ${e.slice(i[0].length)}`;
|
|
1267
|
+
}
|
|
1268
|
+
let a = n[n.length - 1];
|
|
1269
|
+
return a && r > a.orig ? " ".repeat(a.content) + e.trimStart() : (n.length = 0, " ".repeat(t) + e.trimStart());
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1121
1272
|
// src/components/inputs/text-editor/text-editor.clipboard.ts
|
|
1122
|
-
var
|
|
1273
|
+
var Cr = class {
|
|
1123
1274
|
constructor() {
|
|
1124
1275
|
this.cut = null;
|
|
1125
1276
|
}
|
|
1126
1277
|
annotationsInSelection(e) {
|
|
1127
|
-
let { from: t, to: n } = e.state.selection.main, r = e.state.doc.toString(), i =
|
|
1128
|
-
return
|
|
1278
|
+
let { from: t, to: n } = e.state.selection.main, r = e.state.doc.toString(), i = B(r, t), a = B(r, n);
|
|
1279
|
+
return Jn(e.state).filter((e) => e.from >= i && e.to <= a).map((e) => ({
|
|
1129
1280
|
id: e.id,
|
|
1130
1281
|
from: e.from - i,
|
|
1131
1282
|
to: e.to - i
|
|
@@ -1133,7 +1284,7 @@ var ir = class {
|
|
|
1133
1284
|
}
|
|
1134
1285
|
selectedText(e) {
|
|
1135
1286
|
let { from: t, to: n } = e.state.selection.main;
|
|
1136
|
-
return
|
|
1287
|
+
return R(e.state.sliceDoc(t, n));
|
|
1137
1288
|
}
|
|
1138
1289
|
rememberCut(e) {
|
|
1139
1290
|
let { from: t, to: n } = e.state.selection.main;
|
|
@@ -1145,51 +1296,62 @@ var ir = class {
|
|
|
1145
1296
|
forget() {
|
|
1146
1297
|
this.cut = null;
|
|
1147
1298
|
}
|
|
1148
|
-
paste(e, t) {
|
|
1149
|
-
let
|
|
1150
|
-
if (!
|
|
1151
|
-
let
|
|
1152
|
-
...e.state.replaceSelection(
|
|
1299
|
+
paste(e, t, n = !1) {
|
|
1300
|
+
let r = R(t).replace(/\r\n?/g, "\n");
|
|
1301
|
+
if (!r || e.state.readOnly) return;
|
|
1302
|
+
let i = this.cut, a = !!(i && ((e, t) => e.replace(/\r\n/g, "\n") === t.replace(/\r\n/g, "\n"))(i.text, r) && i.anns.length > 0), o = B(e.state.doc.toString(), e.state.selection.main.from), s = a || n ? null : xr(e.state, r), c = e.state.selection.main.to, l = {
|
|
1303
|
+
...e.state.replaceSelection(r),
|
|
1153
1304
|
userEvent: "input.paste"
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
anns: r.anns
|
|
1305
|
+
}, u = e.state.update(a ? {
|
|
1306
|
+
...l,
|
|
1307
|
+
effects: qn.of({
|
|
1308
|
+
at: o,
|
|
1309
|
+
anns: i.anns
|
|
1160
1310
|
})
|
|
1161
|
-
} :
|
|
1311
|
+
} : l);
|
|
1312
|
+
if (e.dispatch(u), a && (this.cut = null), !s) return;
|
|
1313
|
+
let d = u.changes.mapPos(s.from, -1), f = u.changes.mapPos(c, 1);
|
|
1314
|
+
e.dispatch({
|
|
1315
|
+
changes: {
|
|
1316
|
+
from: d,
|
|
1317
|
+
to: f,
|
|
1318
|
+
insert: s.insert
|
|
1319
|
+
},
|
|
1320
|
+
selection: { anchor: d + s.insert.length },
|
|
1321
|
+
userEvent: "input.complete",
|
|
1322
|
+
annotations: ce.of("before")
|
|
1323
|
+
});
|
|
1162
1324
|
}
|
|
1163
|
-
},
|
|
1164
|
-
function
|
|
1165
|
-
|
|
1325
|
+
}, wr = 200, Tr = /* @__PURE__ */ new WeakSet();
|
|
1326
|
+
function Er(e) {
|
|
1327
|
+
Tr.has(e) || e.hasFocus || e.dispatch({ selection: { anchor: e.state.doc.length } });
|
|
1166
1328
|
}
|
|
1167
|
-
function
|
|
1168
|
-
let
|
|
1329
|
+
function Dr() {
|
|
1330
|
+
let e = 0, t = 0, n = () => (t = Date.now(), !1);
|
|
1169
1331
|
return [
|
|
1170
|
-
|
|
1171
|
-
e.transactions.some((e) => e.selection) &&
|
|
1332
|
+
_.updateListener.of((e) => {
|
|
1333
|
+
e.transactions.some((e) => e.selection) && Tr.add(e.view);
|
|
1172
1334
|
}),
|
|
1173
|
-
|
|
1174
|
-
focus: (
|
|
1175
|
-
keydown:
|
|
1176
|
-
pointerdown:
|
|
1177
|
-
touchstart:
|
|
1335
|
+
_.domEventHandlers({
|
|
1336
|
+
focus: (t, n) => (Tr.add(n), e = Date.now(), !1),
|
|
1337
|
+
keydown: n,
|
|
1338
|
+
pointerdown: n,
|
|
1339
|
+
touchstart: n
|
|
1178
1340
|
}),
|
|
1179
|
-
|
|
1180
|
-
if (
|
|
1181
|
-
let
|
|
1182
|
-
if (
|
|
1341
|
+
g.transactionFilter.of((n) => {
|
|
1342
|
+
if (n.docChanged || !n.selection || !n.isUserEvent("select") || n.isUserEvent("select.pointer") || Date.now() - e > wr || t >= e) return n;
|
|
1343
|
+
let r = n.startState.selection.main, i = n.selection.main;
|
|
1344
|
+
if (r.from === 0 || i.from !== 0) return n;
|
|
1183
1345
|
let a = i.anchor === 0 ? i.head : i.anchor;
|
|
1184
|
-
return a !==
|
|
1185
|
-
selection:
|
|
1346
|
+
return a !== r.anchor && a !== r.head ? n : {
|
|
1347
|
+
selection: n.startState.selection,
|
|
1186
1348
|
userEvent: "select"
|
|
1187
1349
|
};
|
|
1188
1350
|
})
|
|
1189
1351
|
];
|
|
1190
1352
|
}
|
|
1191
1353
|
// src/components/inputs/text-editor/text-editor.commands.ts
|
|
1192
|
-
var
|
|
1354
|
+
var Or = {
|
|
1193
1355
|
bold: !1,
|
|
1194
1356
|
italic: !1,
|
|
1195
1357
|
inlineCode: !1,
|
|
@@ -1202,68 +1364,68 @@ var lr = {
|
|
|
1202
1364
|
quote: !1,
|
|
1203
1365
|
heading: 0
|
|
1204
1366
|
};
|
|
1205
|
-
function
|
|
1206
|
-
return
|
|
1367
|
+
function U(e, t, n, r = 1) {
|
|
1368
|
+
return O(e.state, t, r, n);
|
|
1207
1369
|
}
|
|
1208
|
-
function
|
|
1209
|
-
let r =
|
|
1370
|
+
function kr(e, t, n) {
|
|
1371
|
+
let r = U(e, t, n, -1), i = U(e, t, n, 1);
|
|
1210
1372
|
return r && i && r.from === i.from && r.to === i.to ? i : null;
|
|
1211
1373
|
}
|
|
1212
|
-
function
|
|
1213
|
-
if (
|
|
1214
|
-
|
|
1215
|
-
let { state:
|
|
1216
|
-
|
|
1217
|
-
let
|
|
1218
|
-
if (!
|
|
1219
|
-
let
|
|
1220
|
-
if (
|
|
1221
|
-
let
|
|
1222
|
-
if (
|
|
1223
|
-
let
|
|
1224
|
-
from:
|
|
1225
|
-
to:
|
|
1226
|
-
name:
|
|
1227
|
-
marker:
|
|
1374
|
+
function W(t, n, r) {
|
|
1375
|
+
if (t.state.readOnly) return;
|
|
1376
|
+
Er(t);
|
|
1377
|
+
let { state: i } = t, a = n.length, o = i.field(j, !1);
|
|
1378
|
+
t.dispatch(i.changeByRange((s) => {
|
|
1379
|
+
let c = i.sliceDoc(s.from, s.to), l = /^\s*/.exec(c)[0].length;
|
|
1380
|
+
if (!s.empty && l === c.length) return { range: s };
|
|
1381
|
+
let u = s.from + l, d = s.to - /\s*$/.exec(c)[0].length, f = U(t, u, r) ?? (o && o.name === r && u >= o.from && d <= o.to ? o : null);
|
|
1382
|
+
if (f) {
|
|
1383
|
+
let t = i.sliceDoc(f.from + a, f.to - a);
|
|
1384
|
+
if (s.empty && u === f.to - a && t.trim()) {
|
|
1385
|
+
let t = {
|
|
1386
|
+
from: f.from,
|
|
1387
|
+
to: f.to,
|
|
1388
|
+
name: r,
|
|
1389
|
+
marker: i.sliceDoc(f.from, f.from + a),
|
|
1228
1390
|
live: !1
|
|
1229
|
-
},
|
|
1230
|
-
for (; /[ \t]/.test(
|
|
1391
|
+
}, n = A.has(r) ? kt(i, t) : [], o = f.to;
|
|
1392
|
+
for (; /[ \t]/.test(i.sliceDoc(o, o + 1));) o++;
|
|
1231
1393
|
return {
|
|
1232
|
-
changes:
|
|
1233
|
-
range:
|
|
1394
|
+
changes: n,
|
|
1395
|
+
range: e.cursor(o)
|
|
1234
1396
|
};
|
|
1235
1397
|
}
|
|
1236
|
-
let
|
|
1237
|
-
from:
|
|
1238
|
-
to:
|
|
1398
|
+
let n = i.changes([{
|
|
1399
|
+
from: f.from,
|
|
1400
|
+
to: f.from + a
|
|
1239
1401
|
}, {
|
|
1240
|
-
from:
|
|
1241
|
-
to:
|
|
1402
|
+
from: f.to - a,
|
|
1403
|
+
to: f.to
|
|
1242
1404
|
}]);
|
|
1243
1405
|
return {
|
|
1244
|
-
changes:
|
|
1245
|
-
range:
|
|
1406
|
+
changes: n,
|
|
1407
|
+
range: e.range(n.mapPos(s.anchor), n.mapPos(s.head))
|
|
1246
1408
|
};
|
|
1247
1409
|
}
|
|
1248
1410
|
return {
|
|
1249
1411
|
changes: [{
|
|
1250
|
-
from: l,
|
|
1251
|
-
insert: t
|
|
1252
|
-
}, {
|
|
1253
1412
|
from: u,
|
|
1254
|
-
insert:
|
|
1413
|
+
insert: n
|
|
1414
|
+
}, {
|
|
1415
|
+
from: d,
|
|
1416
|
+
insert: n
|
|
1255
1417
|
}],
|
|
1256
|
-
range:
|
|
1257
|
-
effects:
|
|
1258
|
-
from:
|
|
1259
|
-
to:
|
|
1260
|
-
name:
|
|
1261
|
-
marker:
|
|
1418
|
+
range: e.range(u + a, d + a),
|
|
1419
|
+
effects: s.empty && s === i.selection.main && A.has(r) ? yt.of({
|
|
1420
|
+
from: u,
|
|
1421
|
+
to: u + 2 * a,
|
|
1422
|
+
name: r,
|
|
1423
|
+
marker: n
|
|
1262
1424
|
}) : void 0
|
|
1263
1425
|
};
|
|
1264
|
-
})),
|
|
1426
|
+
})), t.focus();
|
|
1265
1427
|
}
|
|
1266
|
-
function
|
|
1428
|
+
function Ar(e, t) {
|
|
1267
1429
|
let n = e.text;
|
|
1268
1430
|
if (t === n) return null;
|
|
1269
1431
|
let r = 0;
|
|
@@ -1276,7 +1438,7 @@ function dr(e, t) {
|
|
|
1276
1438
|
insert: t.slice(r, t.length - i)
|
|
1277
1439
|
};
|
|
1278
1440
|
}
|
|
1279
|
-
function
|
|
1441
|
+
function jr(e, t) {
|
|
1280
1442
|
if (t.length) {
|
|
1281
1443
|
let { state: n } = e, r = n.changes(t), i = n.selection.main;
|
|
1282
1444
|
e.dispatch({
|
|
@@ -1289,7 +1451,7 @@ function fr(e, t) {
|
|
|
1289
1451
|
}
|
|
1290
1452
|
e.focus();
|
|
1291
1453
|
}
|
|
1292
|
-
function
|
|
1454
|
+
function G(e) {
|
|
1293
1455
|
let { state: t } = e, { from: n, to: r } = t.selection.main, i = t.doc.lineAt(n).number, a = t.doc.lineAt(r).number;
|
|
1294
1456
|
return {
|
|
1295
1457
|
first: i,
|
|
@@ -1297,74 +1459,74 @@ function H(e) {
|
|
|
1297
1459
|
loneBlank: i === a && t.doc.line(i).text.trim() === ""
|
|
1298
1460
|
};
|
|
1299
1461
|
}
|
|
1300
|
-
function
|
|
1462
|
+
function K(e, t) {
|
|
1301
1463
|
if (e.state.readOnly) return;
|
|
1302
|
-
let { state: n } = e, { first: r, last: i } =
|
|
1464
|
+
let { state: n } = e, { first: r, last: i } = G(e), a = [];
|
|
1303
1465
|
for (let e = r; e <= i; e++) {
|
|
1304
|
-
let r = n.doc.line(e), i =
|
|
1466
|
+
let r = n.doc.line(e), i = Ar(r, t(r.text));
|
|
1305
1467
|
i && a.push(i);
|
|
1306
1468
|
}
|
|
1307
|
-
|
|
1469
|
+
jr(e, a);
|
|
1308
1470
|
}
|
|
1309
|
-
function
|
|
1310
|
-
let { first: n, last: r } =
|
|
1471
|
+
function Mr(e, t) {
|
|
1472
|
+
let { first: n, last: r } = G(e);
|
|
1311
1473
|
for (let i = n; i <= r; i++) if (!t(e.state.doc.line(i).text)) return !1;
|
|
1312
1474
|
return !0;
|
|
1313
1475
|
}
|
|
1314
|
-
function
|
|
1315
|
-
|
|
1476
|
+
function Nr(e, t) {
|
|
1477
|
+
K(e, (e) => {
|
|
1316
1478
|
let n = e.match(/^(#{1,6})\s+/), r = n ? n[1].length : 0, i = n ? e.slice(n[0].length) : e;
|
|
1317
1479
|
return t === 0 || r === t ? i : `${"#".repeat(t)} ${i}`;
|
|
1318
1480
|
});
|
|
1319
1481
|
}
|
|
1320
|
-
function
|
|
1321
|
-
|
|
1482
|
+
function Pr(e, t) {
|
|
1483
|
+
K(e, (e) => {
|
|
1322
1484
|
let n = e.replace(/^#{1,6}\s+/, "");
|
|
1323
1485
|
return t === 0 ? n : `${"#".repeat(t)} ${n}`;
|
|
1324
1486
|
});
|
|
1325
1487
|
}
|
|
1326
|
-
function
|
|
1327
|
-
let t = /^(\s*)[-*+]\s+/, { loneBlank: n } =
|
|
1328
|
-
|
|
1488
|
+
function Fr(e) {
|
|
1489
|
+
let t = /^(\s*)[-*+]\s+/, { loneBlank: n } = G(e), r = !n && Mr(e, (e) => t.test(e) || e.trim() === "");
|
|
1490
|
+
K(e, (e) => e.trim() === "" && !n ? e : r ? e.replace(t, "$1") : t.test(e) ? e : e.replace(/^(\s*)/, "$1- "));
|
|
1329
1491
|
}
|
|
1330
|
-
var
|
|
1331
|
-
function
|
|
1332
|
-
let { loneBlank: t } =
|
|
1333
|
-
|
|
1492
|
+
var Ir = /^(\s*)[-*+]\s+\[[ xX]\]\s+/;
|
|
1493
|
+
function Lr(e) {
|
|
1494
|
+
let { loneBlank: t } = G(e), n = !t && Mr(e, (e) => Ir.test(e) || e.trim() === "");
|
|
1495
|
+
K(e, (e) => e.trim() === "" && !t ? e : n ? e.replace(Ir, "$1- ") : Ir.test(e) ? e : e.replace(q, "$1").replace(/^(\s*)/, "$1- [ ] "));
|
|
1334
1496
|
}
|
|
1335
|
-
var
|
|
1336
|
-
function
|
|
1497
|
+
var q = /^(\s*)(?:[-*+]|\d+[.)])(?:\s+|$)/, Rr = /^(\s*)\[[ xX]\]\s+/;
|
|
1498
|
+
function zr(e, t) {
|
|
1337
1499
|
if (e.state.readOnly) return;
|
|
1338
|
-
let { state: n } = e, { first: r, last: i, loneBlank: a } =
|
|
1500
|
+
let { state: n } = e, { first: r, last: i, loneBlank: a } = G(e), o = [], s = 0;
|
|
1339
1501
|
for (let e = r; e <= i; e++) {
|
|
1340
|
-
let r = n.doc.line(e), i = r.text.replace(
|
|
1502
|
+
let r = n.doc.line(e), i = r.text.replace(q, t === "none" ? "" : "$1"), c = i !== r.text, l = c ? i.replace(Rr, t === "none" ? "" : "$1") : i, u = l;
|
|
1341
1503
|
if (t !== "none" && (l.trim() !== "" || c || a)) {
|
|
1342
1504
|
s += 1;
|
|
1343
1505
|
let e = t === "bullet" ? "- " : t === "task" ? "- [ ] " : `${s}. `;
|
|
1344
1506
|
u = l.replace(/^(\s*)/, `$1${e}`);
|
|
1345
1507
|
}
|
|
1346
|
-
let d =
|
|
1508
|
+
let d = Ar(r, u);
|
|
1347
1509
|
d && o.push(d);
|
|
1348
1510
|
}
|
|
1349
|
-
|
|
1511
|
+
jr(e, o);
|
|
1350
1512
|
}
|
|
1351
|
-
function
|
|
1513
|
+
function Br(e, t, n) {
|
|
1352
1514
|
for (let r = t - 1; r >= 1; r--) {
|
|
1353
1515
|
let t = e.doc.line(r).text;
|
|
1354
1516
|
if (t.trim() === "") continue;
|
|
1355
|
-
let i = t.match(
|
|
1517
|
+
let i = t.match(q);
|
|
1356
1518
|
if (!i) return null;
|
|
1357
1519
|
if (n(i[1].length)) return i;
|
|
1358
1520
|
}
|
|
1359
1521
|
return null;
|
|
1360
1522
|
}
|
|
1361
|
-
function
|
|
1523
|
+
function Vr(e) {
|
|
1362
1524
|
if (e.state.readOnly) return;
|
|
1363
1525
|
let { state: t } = e, { from: n, to: r } = t.selection.main, i = t.doc.lineAt(n).number, a = t.doc.lineAt(r).number, o = [];
|
|
1364
1526
|
for (let e = i; e <= a; e++) {
|
|
1365
|
-
let n = t.doc.line(e), r = n.text.match(
|
|
1527
|
+
let n = t.doc.line(e), r = n.text.match(q);
|
|
1366
1528
|
if (!r) continue;
|
|
1367
|
-
let i = r[1].length, a =
|
|
1529
|
+
let i = r[1].length, a = Br(t, e, (e) => e <= i)?.[0].length ?? -1;
|
|
1368
1530
|
a > i && o.push({
|
|
1369
1531
|
from: n.from,
|
|
1370
1532
|
insert: " ".repeat(a - i)
|
|
@@ -1372,15 +1534,15 @@ function xr(e) {
|
|
|
1372
1534
|
}
|
|
1373
1535
|
o.length && e.dispatch({ changes: o }), e.focus();
|
|
1374
1536
|
}
|
|
1375
|
-
function
|
|
1537
|
+
function Hr(e) {
|
|
1376
1538
|
if (e.state.readOnly) return;
|
|
1377
1539
|
let { state: t } = e, { from: n, to: r } = t.selection.main, i = t.doc.lineAt(n).number, a = t.doc.lineAt(r).number, o = [];
|
|
1378
1540
|
for (let e = i; e <= a; e++) {
|
|
1379
|
-
let n = t.doc.line(e), r = n.text.match(
|
|
1541
|
+
let n = t.doc.line(e), r = n.text.match(q);
|
|
1380
1542
|
if (!r) continue;
|
|
1381
1543
|
let i = r[1].length;
|
|
1382
1544
|
if (i === 0) continue;
|
|
1383
|
-
let a =
|
|
1545
|
+
let a = Br(t, e, (e) => e < i)?.[1].length ?? 0;
|
|
1384
1546
|
o.push({
|
|
1385
1547
|
from: n.from,
|
|
1386
1548
|
to: n.from + (i - a)
|
|
@@ -1388,66 +1550,78 @@ function Sr(e) {
|
|
|
1388
1550
|
}
|
|
1389
1551
|
o.length && e.dispatch({ changes: o }), e.focus();
|
|
1390
1552
|
}
|
|
1391
|
-
function
|
|
1392
|
-
let { state: t } = e, n = t.doc.lineAt(t.selection.main.head), r = n.text.match(
|
|
1553
|
+
function Ur(e) {
|
|
1554
|
+
let { state: t } = e, n = t.doc.lineAt(t.selection.main.head), r = n.text.match(q);
|
|
1393
1555
|
if (!r) return !1;
|
|
1394
|
-
let i = r[1].length, a =
|
|
1556
|
+
let i = r[1].length, a = Br(t, n.number, (e) => e <= i);
|
|
1395
1557
|
return a !== null && a[0].length > i;
|
|
1396
1558
|
}
|
|
1397
|
-
function
|
|
1398
|
-
let t = e.state.doc.lineAt(e.state.selection.main.head).text.match(
|
|
1559
|
+
function Wr(e) {
|
|
1560
|
+
let t = e.state.doc.lineAt(e.state.selection.main.head).text.match(q);
|
|
1399
1561
|
return !!t && t[1].length > 0;
|
|
1400
1562
|
}
|
|
1401
|
-
function
|
|
1563
|
+
function Gr(e) {
|
|
1402
1564
|
if (e.state.readOnly) return !0;
|
|
1403
1565
|
let { state: t } = e, n = t.selection.main;
|
|
1404
1566
|
if (!n.empty) return !1;
|
|
1405
1567
|
let r = t.doc.lineAt(n.head), i = r.text.match(/^(\s*)(?:\d+[.)]|[-*+])\s/);
|
|
1406
|
-
if (!i || n.head !== r.from + i[0].length ||
|
|
1407
|
-
let a =
|
|
1568
|
+
if (!i || n.head !== r.from + i[0].length || E(t, r.from)) return !1;
|
|
1569
|
+
let a = i[1].length, o = a > 0 ? N(t, r.number).find((e) => e.markerCol < a) : void 0;
|
|
1570
|
+
if (o) {
|
|
1571
|
+
let t = r.from + a, i = " ".repeat(o.markerCol);
|
|
1572
|
+
return e.dispatch({
|
|
1573
|
+
changes: {
|
|
1574
|
+
from: r.from,
|
|
1575
|
+
to: t,
|
|
1576
|
+
insert: i
|
|
1577
|
+
},
|
|
1578
|
+
selection: { anchor: n.head - (a - i.length) },
|
|
1579
|
+
userEvent: "delete.backward"
|
|
1580
|
+
}), !0;
|
|
1581
|
+
}
|
|
1408
1582
|
return e.dispatch({
|
|
1409
1583
|
changes: {
|
|
1410
|
-
from:
|
|
1584
|
+
from: r.from,
|
|
1411
1585
|
to: r.from + i[0].length
|
|
1412
1586
|
},
|
|
1413
|
-
selection: { anchor:
|
|
1587
|
+
selection: { anchor: r.from },
|
|
1414
1588
|
userEvent: "delete.backward"
|
|
1415
1589
|
}), !0;
|
|
1416
1590
|
}
|
|
1417
|
-
function
|
|
1418
|
-
let t = /^(\s*)>\s?/, n =
|
|
1419
|
-
|
|
1591
|
+
function Kr(e) {
|
|
1592
|
+
let t = /^(\s*)>\s?/, n = Mr(e, (e) => t.test(e) || e.trim() === "");
|
|
1593
|
+
K(e, (e) => e.trim() === "" ? e : n ? e.replace(t, "$1") : t.test(e) ? e : e.replace(/^(\s*)/, "$1> "));
|
|
1420
1594
|
}
|
|
1421
|
-
function
|
|
1422
|
-
let n =
|
|
1423
|
-
return n && !
|
|
1595
|
+
function qr(e, t) {
|
|
1596
|
+
let n = U(e, t, "Link");
|
|
1597
|
+
return n && !k(e.state, n) ? n : null;
|
|
1424
1598
|
}
|
|
1425
|
-
function
|
|
1426
|
-
if (
|
|
1427
|
-
let
|
|
1428
|
-
if (
|
|
1429
|
-
let
|
|
1430
|
-
|
|
1599
|
+
function Jr(t, n = "") {
|
|
1600
|
+
if (t.state.readOnly) return;
|
|
1601
|
+
let r = qr(t, t.state.selection.main.head);
|
|
1602
|
+
if (r) {
|
|
1603
|
+
let n = t.state.sliceDoc(r.from, r.to).replace(/^\[(.*)\]\([^)]*\)$/, "$1");
|
|
1604
|
+
t.dispatch({
|
|
1431
1605
|
changes: {
|
|
1432
|
-
from:
|
|
1433
|
-
to:
|
|
1434
|
-
insert:
|
|
1606
|
+
from: r.from,
|
|
1607
|
+
to: r.to,
|
|
1608
|
+
insert: n
|
|
1435
1609
|
},
|
|
1436
|
-
selection:
|
|
1437
|
-
}),
|
|
1438
|
-
} else
|
|
1439
|
-
let
|
|
1440
|
-
return
|
|
1610
|
+
selection: e.range(r.from, r.from + n.length)
|
|
1611
|
+
}), t.focus();
|
|
1612
|
+
} else t.dispatch(t.state.changeByRange((r) => {
|
|
1613
|
+
let i = t.state.sliceDoc(r.from, r.to), a = `[${i}](${n})`, o;
|
|
1614
|
+
return o = i ? n ? r.from + a.length : r.from + 1 + i.length + 2 : r.from + 1, {
|
|
1441
1615
|
changes: {
|
|
1442
|
-
from:
|
|
1443
|
-
to:
|
|
1444
|
-
insert:
|
|
1616
|
+
from: r.from,
|
|
1617
|
+
to: r.to,
|
|
1618
|
+
insert: a
|
|
1445
1619
|
},
|
|
1446
|
-
range:
|
|
1620
|
+
range: e.cursor(o)
|
|
1447
1621
|
};
|
|
1448
|
-
})),
|
|
1622
|
+
})), t.focus();
|
|
1449
1623
|
}
|
|
1450
|
-
function
|
|
1624
|
+
function Yr(e) {
|
|
1451
1625
|
if (e.state.readOnly) return;
|
|
1452
1626
|
let { state: t } = e, { from: n, to: r } = t.selection.main, i = t.doc.lineAt(n), a = t.doc.lineAt(r), o = i.number > 1 ? t.doc.line(i.number - 1) : null, s = a.number < t.doc.lines ? t.doc.line(a.number + 1) : null;
|
|
1453
1627
|
o?.text.trim().startsWith("```") && s?.text.trim().startsWith("```") && o && s ? e.dispatch({ changes: [{
|
|
@@ -1464,112 +1638,126 @@ function kr(e) {
|
|
|
1464
1638
|
insert: "\n```"
|
|
1465
1639
|
}] }), e.focus();
|
|
1466
1640
|
}
|
|
1467
|
-
function
|
|
1468
|
-
let { state: t } = e, n = t.selection.main.head, r = t.field(
|
|
1641
|
+
function Xr(e) {
|
|
1642
|
+
let { state: t } = e, n = t.selection.main.head, r = t.field(j, !1), i = (t) => kr(e, n, t) !== null || r?.name === t, a = t.doc.lineAt(n).text, o = t.doc.lineAt(n).from, s = a.match(/^(#{1,6})\s/), c = E(t, o);
|
|
1469
1643
|
return {
|
|
1470
1644
|
bold: i("StrongEmphasis"),
|
|
1471
1645
|
italic: i("Emphasis"),
|
|
1472
1646
|
inlineCode: i("InlineCode"),
|
|
1473
1647
|
codeBlock: c,
|
|
1474
1648
|
strikethrough: i("Strikethrough"),
|
|
1475
|
-
link:
|
|
1476
|
-
bulletList: !c && /^\s*[-*+]\s/.test(a) && !
|
|
1649
|
+
link: qr(e, n) !== null,
|
|
1650
|
+
bulletList: !c && /^\s*[-*+]\s/.test(a) && !Re(t, o),
|
|
1477
1651
|
orderedList: !c && /^\s*\d+[.)]\s/.test(a),
|
|
1478
|
-
taskList: !c &&
|
|
1479
|
-
quote:
|
|
1652
|
+
taskList: !c && Ir.test(a),
|
|
1653
|
+
quote: U(e, o, "Blockquote") !== null,
|
|
1480
1654
|
heading: c || !s ? 0 : s[1].length
|
|
1481
1655
|
};
|
|
1482
1656
|
}
|
|
1483
1657
|
// src/components/inputs/text-editor/text-editor.keymap.ts
|
|
1484
|
-
var
|
|
1658
|
+
var Zr = [y.highest(n.of([{
|
|
1485
1659
|
key: "Backspace",
|
|
1486
|
-
run:
|
|
1487
|
-
}])),
|
|
1660
|
+
run: Gr
|
|
1661
|
+
}])), n.of([
|
|
1488
1662
|
{
|
|
1489
1663
|
key: "Mod-b",
|
|
1490
|
-
run: (e) => (
|
|
1664
|
+
run: (e) => (W(e, "**", "StrongEmphasis"), !0)
|
|
1491
1665
|
},
|
|
1492
1666
|
{
|
|
1493
1667
|
key: "Mod-i",
|
|
1494
|
-
run: (e) => (
|
|
1668
|
+
run: (e) => (W(e, "*", "Emphasis"), !0)
|
|
1495
1669
|
},
|
|
1496
1670
|
{
|
|
1497
1671
|
key: "Mod-e",
|
|
1498
|
-
run: (e) => (
|
|
1672
|
+
run: (e) => (W(e, "`", "InlineCode"), !0)
|
|
1499
1673
|
},
|
|
1500
1674
|
{
|
|
1501
1675
|
key: "Mod-k",
|
|
1502
|
-
run: (e) => (
|
|
1676
|
+
run: (e) => (Jr(e), !0)
|
|
1503
1677
|
},
|
|
1504
1678
|
{
|
|
1505
1679
|
key: "Backspace",
|
|
1506
|
-
run: (e) =>
|
|
1680
|
+
run: (e) => it(e, -1)
|
|
1507
1681
|
},
|
|
1508
1682
|
{
|
|
1509
1683
|
key: "Delete",
|
|
1510
|
-
run: (e) =>
|
|
1684
|
+
run: (e) => it(e, 1)
|
|
1511
1685
|
},
|
|
1512
1686
|
{
|
|
1513
1687
|
key: "Mod-]",
|
|
1514
|
-
run: (e) => (
|
|
1688
|
+
run: (e) => (Vr(e), !0)
|
|
1515
1689
|
},
|
|
1516
1690
|
{
|
|
1517
1691
|
key: "Mod-[",
|
|
1518
|
-
run: (e) => (
|
|
1692
|
+
run: (e) => (Hr(e), !0)
|
|
1519
1693
|
},
|
|
1520
1694
|
{
|
|
1521
1695
|
key: "Backspace",
|
|
1522
|
-
run: (e) => !
|
|
1523
|
-
shift:
|
|
1696
|
+
run: (e) => !In(e, "Backspace") && he(e),
|
|
1697
|
+
shift: he
|
|
1524
1698
|
},
|
|
1525
1699
|
{
|
|
1526
1700
|
key: "Delete",
|
|
1527
|
-
run: (e) => !
|
|
1701
|
+
run: (e) => !In(e, "Delete") && de(e)
|
|
1528
1702
|
},
|
|
1529
|
-
...
|
|
1530
|
-
...
|
|
1531
|
-
])],
|
|
1532
|
-
function
|
|
1533
|
-
let t = [], n = [], r =
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1703
|
+
...pe.filter((e) => e.key !== "Backspace" && e.key !== "Delete"),
|
|
1704
|
+
...me
|
|
1705
|
+
])], Qr = /^(\s*)(\d+)[.)](?=\s|$)/, $r = /^(?:[ ]{0,3}>[ ]?)*/, ei = /^\s*(?:```|~~~)/, ti = /^\s*[-*+]\s+\S/, ni = /^\s*(?:#{1,6}(?:\s|$)|[-*+](?:\s|$)|(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$)/, ri = 1e3;
|
|
1706
|
+
function ii(e) {
|
|
1707
|
+
let t = [], n = [], r = (e) => {
|
|
1708
|
+
let t = 0;
|
|
1709
|
+
for (; t < n.length && e >= n[t].content;) t++;
|
|
1710
|
+
return t;
|
|
1711
|
+
}, i = 0, a = !1, o = 0, s = -1;
|
|
1712
|
+
for (let c of e.split("\n")) {
|
|
1713
|
+
let e = i;
|
|
1714
|
+
if (i += c.length + 1, ei.test(c)) {
|
|
1715
|
+
a = !a, n.length = 0, o = 0, s = -1;
|
|
1538
1716
|
continue;
|
|
1539
1717
|
}
|
|
1540
|
-
if (
|
|
1541
|
-
let
|
|
1542
|
-
if (
|
|
1543
|
-
|
|
1544
|
-
|
|
1718
|
+
if (a) continue;
|
|
1719
|
+
let l = $r.exec(c)[0], u = c.slice(l.length), d = (l.match(/>/g) ?? []).length, f = Qr.exec(u);
|
|
1720
|
+
if (f) {
|
|
1721
|
+
let e = d * ri + f[1].length, t = r(e);
|
|
1722
|
+
e - Math.max(t > 0 ? n[t - 1].content : 0, d * ri) >= 4 && (f = null);
|
|
1723
|
+
}
|
|
1724
|
+
if (!f) {
|
|
1725
|
+
if (u.trim() === "") {
|
|
1726
|
+
++o >= 2 && (n.length = 0), s = -1;
|
|
1545
1727
|
continue;
|
|
1546
1728
|
}
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
for (; n.length && n[n.length - 1].indent >= e;) n.pop();
|
|
1729
|
+
if (o = 0, s >= d && n.length && !ni.test(u)) continue;
|
|
1730
|
+
s = ti.test(u) ? d : -1, n.length = r(d * ri + /^\s*/.exec(u)[0].length);
|
|
1550
1731
|
continue;
|
|
1551
1732
|
}
|
|
1552
|
-
|
|
1553
|
-
let
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
indent
|
|
1733
|
+
o = 0, s = u.slice(f[0].length).trim() === "" ? -1 : d;
|
|
1734
|
+
let p = f[1].length, m = d * ri + p, h = f[2], g = /^ */.exec(u.slice(f[0].length))[0].length, _ = m + f[0].length - p + (g >= 1 && g <= 4 ? g : 1), v = r(m), ee;
|
|
1735
|
+
if (v < n.length) {
|
|
1736
|
+
n.length = v + 1;
|
|
1737
|
+
let e = n[v];
|
|
1738
|
+
ee = e.next, e.next += 1, e.indent = m, e.content = _;
|
|
1739
|
+
} else ee = 1, n.push({
|
|
1740
|
+
indent: m,
|
|
1741
|
+
content: _,
|
|
1558
1742
|
next: 2
|
|
1559
|
-
})
|
|
1560
|
-
let
|
|
1561
|
-
if (
|
|
1562
|
-
let n = e +
|
|
1743
|
+
});
|
|
1744
|
+
let te = String(ee);
|
|
1745
|
+
if (te !== h) {
|
|
1746
|
+
let n = e + l.length + p;
|
|
1563
1747
|
t.push({
|
|
1564
1748
|
from: n,
|
|
1565
|
-
to: n +
|
|
1566
|
-
insert:
|
|
1749
|
+
to: n + h.length,
|
|
1750
|
+
insert: te
|
|
1567
1751
|
});
|
|
1568
1752
|
}
|
|
1569
1753
|
}
|
|
1570
1754
|
return t;
|
|
1571
1755
|
}
|
|
1572
|
-
function
|
|
1756
|
+
function ai(e) {
|
|
1757
|
+
let t = $r.exec(e)[0], n = e.slice(t.length);
|
|
1758
|
+
return n.trim() === "" ? "blank" : Qr.test(n) ? "ordered" : ni.test(n) || ei.test(n) ? "block" : `plain${(t.match(/>/g) ?? []).length}`;
|
|
1759
|
+
}
|
|
1760
|
+
function oi(e) {
|
|
1573
1761
|
let t = !1;
|
|
1574
1762
|
return e.changes.iterChanges((n, r, i, a, o) => {
|
|
1575
1763
|
if (t) return;
|
|
@@ -1578,27 +1766,27 @@ function Lr(e) {
|
|
|
1578
1766
|
t = !0;
|
|
1579
1767
|
return;
|
|
1580
1768
|
}
|
|
1581
|
-
let c = (e) =>
|
|
1582
|
-
(c(
|
|
1769
|
+
let c = (e) => ai(e) === "ordered", l = s.lineAt(n).text, u = e.newDoc.lineAt(i).text;
|
|
1770
|
+
(c(l) || c(u) || c(e.newDoc.lineAt(a).text) || ai(l) !== ai(u)) && (t = !0);
|
|
1583
1771
|
}), t;
|
|
1584
1772
|
}
|
|
1585
|
-
var
|
|
1586
|
-
if (!e.docChanged || !
|
|
1587
|
-
let t =
|
|
1773
|
+
var si = g.transactionFilter.of((e) => {
|
|
1774
|
+
if (e.annotation(re.remote) || !e.docChanged || !oi(e)) return e;
|
|
1775
|
+
let t = ii(e.newDoc.toString());
|
|
1588
1776
|
return t.length === 0 ? e : [e, {
|
|
1589
1777
|
changes: t,
|
|
1590
1778
|
sequential: !0
|
|
1591
1779
|
}];
|
|
1592
|
-
}),
|
|
1780
|
+
}), ci = b.define(), li = h.define({
|
|
1593
1781
|
create: () => null,
|
|
1594
1782
|
update(e, t) {
|
|
1595
|
-
for (let e of t.effects) if (e.is(
|
|
1783
|
+
for (let e of t.effects) if (e.is(ci)) return e.value;
|
|
1596
1784
|
return e === null ? null : t.changes.mapPos(e);
|
|
1597
1785
|
}
|
|
1598
|
-
}),
|
|
1786
|
+
}), ui = class {
|
|
1599
1787
|
constructor(e) {
|
|
1600
1788
|
this.view = e, this.cursor = null, this.readPos = () => {
|
|
1601
|
-
let e = this.view.state.field(
|
|
1789
|
+
let e = this.view.state.field(li);
|
|
1602
1790
|
if (e === null) return null;
|
|
1603
1791
|
let t = this.view.coordsAtPos(e, 1);
|
|
1604
1792
|
if (!t) return null;
|
|
@@ -1613,8 +1801,8 @@ var Rr = e.transactionFilter.of((e) => {
|
|
|
1613
1801
|
};
|
|
1614
1802
|
}
|
|
1615
1803
|
update(e) {
|
|
1616
|
-
let t = e.state.field(
|
|
1617
|
-
t === null ? this.remove() : (e.startState.field(
|
|
1804
|
+
let t = e.state.field(li);
|
|
1805
|
+
t === null ? this.remove() : (e.startState.field(li) !== t || e.docChanged || e.geometryChanged) && this.view.requestMeasure({
|
|
1618
1806
|
read: this.readPos,
|
|
1619
1807
|
write: this.drawCursor
|
|
1620
1808
|
});
|
|
@@ -1625,7 +1813,7 @@ var Rr = e.transactionFilter.of((e) => {
|
|
|
1625
1813
|
destroy() {
|
|
1626
1814
|
this.remove();
|
|
1627
1815
|
}
|
|
1628
|
-
},
|
|
1816
|
+
}, di = c.fromClass(ui), fi = class {
|
|
1629
1817
|
constructor(e) {
|
|
1630
1818
|
this.view = e, this.state = null, this.ghost = null, this.onMove = (e) => {
|
|
1631
1819
|
let t = this.state;
|
|
@@ -1639,11 +1827,11 @@ var Rr = e.transactionFilter.of((e) => {
|
|
|
1639
1827
|
x: e.clientX,
|
|
1640
1828
|
y: e.clientY
|
|
1641
1829
|
}) : null, r = n === null || n >= t.from && n <= t.to ? null : n;
|
|
1642
|
-
this.view.dispatch({ effects:
|
|
1830
|
+
this.view.dispatch({ effects: ci.of(r) });
|
|
1643
1831
|
}, this.onUp = (e) => {
|
|
1644
1832
|
this.removeListeners(), this.view.scrollDOM.style.cursor = "", this.clearGhost();
|
|
1645
1833
|
let t = this.state;
|
|
1646
|
-
if (this.state = null, this.view.dispatch({ effects:
|
|
1834
|
+
if (this.state = null, this.view.dispatch({ effects: ci.of(null) }), !t) return;
|
|
1647
1835
|
let n = this.view.posAtCoords({
|
|
1648
1836
|
x: e.clientX,
|
|
1649
1837
|
y: e.clientY
|
|
@@ -1651,7 +1839,7 @@ var Rr = e.transactionFilter.of((e) => {
|
|
|
1651
1839
|
if (!t.dragging) !t.isMention && n !== null && this.view.dispatch({ selection: { anchor: n } }), this.view.focus();
|
|
1652
1840
|
else {
|
|
1653
1841
|
if (this.isInside(e.clientX, e.clientY) && n !== null && (n < t.from || n > t.to)) {
|
|
1654
|
-
let e = this.view.state.doc.toString(), r =
|
|
1842
|
+
let e = this.view.state.doc.toString(), r = R(this.view.state.sliceDoc(t.from, t.to)), i = n > t.to ? n - (t.to - t.from) : n, a = B(e, t.from), o = B(e, t.to), s = B(e, n), c = s > o ? s - (o - a) : s;
|
|
1655
1843
|
this.view.dispatch({
|
|
1656
1844
|
changes: [{
|
|
1657
1845
|
from: t.from,
|
|
@@ -1664,7 +1852,7 @@ var Rr = e.transactionFilter.of((e) => {
|
|
|
1664
1852
|
anchor: i,
|
|
1665
1853
|
head: i + r.length
|
|
1666
1854
|
},
|
|
1667
|
-
effects:
|
|
1855
|
+
effects: Kn.of({
|
|
1668
1856
|
from: a,
|
|
1669
1857
|
to: o,
|
|
1670
1858
|
insertAt: c
|
|
@@ -1714,7 +1902,7 @@ var Rr = e.transactionFilter.of((e) => {
|
|
|
1714
1902
|
}
|
|
1715
1903
|
showGhost(e, t) {
|
|
1716
1904
|
let n = document.createElement("div");
|
|
1717
|
-
n.className = "cm-drag-ghost", n.textContent =
|
|
1905
|
+
n.className = "cm-drag-ghost", n.textContent = R(this.view.state.sliceDoc(e, t)).replace(Ge, "$1"), this.view.dom.appendChild(n), this.ghost = n;
|
|
1718
1906
|
}
|
|
1719
1907
|
moveGhost(e, t) {
|
|
1720
1908
|
this.ghost && (this.ghost.style.left = `${e + 12}px`, this.ghost.style.top = `${t + 12}px`);
|
|
@@ -1725,87 +1913,87 @@ var Rr = e.transactionFilter.of((e) => {
|
|
|
1725
1913
|
destroy() {
|
|
1726
1914
|
this.removeListeners(), this.clearGhost();
|
|
1727
1915
|
}
|
|
1728
|
-
},
|
|
1916
|
+
}, pi = c.fromClass(fi, { eventHandlers: { mousedown(e) {
|
|
1729
1917
|
return this.start(e);
|
|
1730
|
-
} } }),
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
],
|
|
1735
|
-
function
|
|
1918
|
+
} } }), mi = [
|
|
1919
|
+
li,
|
|
1920
|
+
di,
|
|
1921
|
+
pi
|
|
1922
|
+
], hi = 2, gi = /* @__PURE__ */ new WeakMap(), _i = f.define(), vi = /* @__PURE__ */ new WeakMap();
|
|
1923
|
+
function yi(e, t) {
|
|
1736
1924
|
let n = e.coordsAtPos(t, -1), r = e.coordsAtPos(t, 1);
|
|
1737
1925
|
return n && r ? {
|
|
1738
1926
|
before: n,
|
|
1739
1927
|
after: r
|
|
1740
1928
|
} : null;
|
|
1741
1929
|
}
|
|
1742
|
-
var
|
|
1743
|
-
function
|
|
1744
|
-
return Math.abs(e.before.top - e.after.top) <
|
|
1930
|
+
var bi = 8;
|
|
1931
|
+
function xi(e) {
|
|
1932
|
+
return Math.abs(e.before.top - e.after.top) < bi;
|
|
1745
1933
|
}
|
|
1746
|
-
function
|
|
1747
|
-
let r =
|
|
1748
|
-
if (r &&
|
|
1749
|
-
let i =
|
|
1934
|
+
function Si(e, t, n) {
|
|
1935
|
+
let r = yi(e, t);
|
|
1936
|
+
if (r && xi(r) && Math.abs(r.before.left - r.after.left) <= hi) return 1;
|
|
1937
|
+
let i = gi.get(e);
|
|
1750
1938
|
if (i && i.head === t) {
|
|
1751
1939
|
if (i.side !== "pointer") return i.side;
|
|
1752
|
-
let t =
|
|
1940
|
+
let t = vi.get(e);
|
|
1753
1941
|
if (t && r) return Math.abs(t.x - r.before.left) <= Math.abs(t.x - r.after.left) ? -1 : 1;
|
|
1754
1942
|
}
|
|
1755
1943
|
return n && n < 0 ? -1 : 1;
|
|
1756
1944
|
}
|
|
1757
|
-
var
|
|
1945
|
+
var Ci = _.domEventHandlers({
|
|
1758
1946
|
mousedown(e, t) {
|
|
1759
|
-
return
|
|
1947
|
+
return vi.set(t, {
|
|
1760
1948
|
x: e.clientX,
|
|
1761
1949
|
y: e.clientY
|
|
1762
1950
|
}), !1;
|
|
1763
1951
|
},
|
|
1764
1952
|
mousemove(e, t) {
|
|
1765
|
-
return e.buttons &&
|
|
1953
|
+
return e.buttons && vi.set(t, {
|
|
1766
1954
|
x: e.clientX,
|
|
1767
1955
|
y: e.clientY
|
|
1768
1956
|
}), !1;
|
|
1769
1957
|
},
|
|
1770
1958
|
touchstart(e, t) {
|
|
1771
1959
|
let n = e.touches[0];
|
|
1772
|
-
return n &&
|
|
1960
|
+
return n && vi.set(t, {
|
|
1773
1961
|
x: n.clientX,
|
|
1774
1962
|
y: n.clientY
|
|
1775
1963
|
}), !1;
|
|
1776
1964
|
}
|
|
1777
1965
|
});
|
|
1778
|
-
function
|
|
1779
|
-
return (
|
|
1780
|
-
let { main:
|
|
1781
|
-
return !
|
|
1782
|
-
selection:
|
|
1783
|
-
annotations:
|
|
1966
|
+
function wi(t) {
|
|
1967
|
+
return (n) => {
|
|
1968
|
+
let { main: r } = n.state.selection;
|
|
1969
|
+
return !r.empty || !ht(n.state, r.head) || !yi(n, r.head) || Si(n, r.head, r.assoc) === t ? !1 : (n.dispatch({
|
|
1970
|
+
selection: e.cursor(r.head, t),
|
|
1971
|
+
annotations: _i.of(t),
|
|
1784
1972
|
userEvent: "select"
|
|
1785
1973
|
}), !0);
|
|
1786
1974
|
};
|
|
1787
1975
|
}
|
|
1788
|
-
var
|
|
1976
|
+
var Ti = y.high(n.of([
|
|
1789
1977
|
{
|
|
1790
1978
|
key: "ArrowLeft",
|
|
1791
|
-
run:
|
|
1979
|
+
run: wi(-1)
|
|
1792
1980
|
},
|
|
1793
1981
|
{
|
|
1794
1982
|
key: "ArrowRight",
|
|
1795
|
-
run:
|
|
1983
|
+
run: wi(1)
|
|
1796
1984
|
},
|
|
1797
1985
|
{
|
|
1798
1986
|
key: "Backspace",
|
|
1799
|
-
run:
|
|
1987
|
+
run: wi(-1)
|
|
1800
1988
|
},
|
|
1801
1989
|
{
|
|
1802
1990
|
key: "Delete",
|
|
1803
|
-
run:
|
|
1991
|
+
run: wi(1)
|
|
1804
1992
|
}
|
|
1805
|
-
])),
|
|
1806
|
-
if (t !== n || !r || e.composing ||
|
|
1993
|
+
])), Ei = /^[\s<?!.,:*_~)]/, Di = _.inputHandler.of((e, t, n, r) => {
|
|
1994
|
+
if (t !== n || !r || e.composing || Ei.test(r)) return !1;
|
|
1807
1995
|
let { main: i } = e.state.selection;
|
|
1808
|
-
return !i.empty || i.head !== t || !
|
|
1996
|
+
return !i.empty || i.head !== t || !gt(e.state, t) || !yi(e, t) || Si(e, t, i.assoc) !== 1 ? !1 : (e.dispatch({
|
|
1809
1997
|
changes: {
|
|
1810
1998
|
from: t,
|
|
1811
1999
|
insert: ` ${r}`
|
|
@@ -1814,27 +2002,27 @@ var Qr = v.high(m.of([
|
|
|
1814
2002
|
userEvent: "input.type",
|
|
1815
2003
|
scrollIntoView: !0
|
|
1816
2004
|
}), !0);
|
|
1817
|
-
}),
|
|
1818
|
-
|
|
2005
|
+
}), Oi = [
|
|
2006
|
+
d({
|
|
1819
2007
|
above: !0,
|
|
1820
2008
|
class: "cm-nldd-cursorLayer",
|
|
1821
|
-
markers(
|
|
1822
|
-
let { state:
|
|
1823
|
-
for (let
|
|
1824
|
-
if (!
|
|
1825
|
-
let
|
|
1826
|
-
|
|
2009
|
+
markers(t) {
|
|
2010
|
+
let { state: n } = t, r = u(n), i = [];
|
|
2011
|
+
for (let a of n.selection.ranges) {
|
|
2012
|
+
if (!a.empty && !r.drawRangeCursor) continue;
|
|
2013
|
+
let s = a === n.selection.main ? "cm-cursor cm-cursor-primary" : "cm-cursor cm-cursor-secondary", c = e.cursor(a.head, Si(t, a.head, a.assoc));
|
|
2014
|
+
i.push(...o.forRange(t, s, c));
|
|
1827
2015
|
}
|
|
1828
|
-
return
|
|
2016
|
+
return i;
|
|
1829
2017
|
},
|
|
1830
2018
|
update(e, t) {
|
|
1831
2019
|
if (e.docChanged || e.selectionSet) {
|
|
1832
|
-
let { view: t } = e, n = e.state.selection.main.head, r =
|
|
2020
|
+
let { view: t } = e, n = e.state.selection.main.head, r = gi.get(t), i = r ? {
|
|
1833
2021
|
...r,
|
|
1834
2022
|
head: e.changes.mapPos(r.head)
|
|
1835
2023
|
} : null, a = e.startState.selection.main.head;
|
|
1836
2024
|
for (let t of e.transactions) {
|
|
1837
|
-
let r = t.annotation(
|
|
2025
|
+
let r = t.annotation(_i);
|
|
1838
2026
|
if (r) i = {
|
|
1839
2027
|
head: n,
|
|
1840
2028
|
side: r
|
|
@@ -1844,31 +2032,31 @@ var Qr = v.high(m.of([
|
|
|
1844
2032
|
side: "pointer"
|
|
1845
2033
|
};
|
|
1846
2034
|
else if (t.isUserEvent("input") || t.isUserEvent("delete.backward")) {
|
|
1847
|
-
let r = t.isUserEvent("input") &&
|
|
2035
|
+
let r = t.isUserEvent("input") && gt(e.state, n);
|
|
1848
2036
|
i = {
|
|
1849
2037
|
head: n,
|
|
1850
|
-
side:
|
|
2038
|
+
side: ht(e.state, n) && !ht(e.startState, a) && !r ? 1 : -1
|
|
1851
2039
|
};
|
|
1852
2040
|
} else t.isUserEvent("delete.forward") ? i = {
|
|
1853
2041
|
head: n,
|
|
1854
2042
|
side: 1
|
|
1855
2043
|
} : t.selection && (i = null);
|
|
1856
2044
|
}
|
|
1857
|
-
i ?
|
|
2045
|
+
i ? gi.set(t, i) : gi.delete(t);
|
|
1858
2046
|
}
|
|
1859
2047
|
return e.transactions.some((e) => e.selection) && (t.style.animationName = t.style.animationName === "cm-blink" ? "cm-blink2" : "cm-blink"), e.docChanged || e.selectionSet;
|
|
1860
2048
|
},
|
|
1861
2049
|
mount(e, t) {
|
|
1862
|
-
e.style.animationDuration = `${
|
|
2050
|
+
e.style.animationDuration = `${u(t.state).cursorBlinkRate}ms`;
|
|
1863
2051
|
}
|
|
1864
2052
|
}),
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
],
|
|
2053
|
+
Ci,
|
|
2054
|
+
Ti,
|
|
2055
|
+
Di
|
|
2056
|
+
], ki = x.define({ combine: (e) => e[0] ?? {
|
|
1869
2057
|
open: () => "Taak, open",
|
|
1870
2058
|
done: () => "Taak, afgerond"
|
|
1871
|
-
} }),
|
|
2059
|
+
} }), Ai = class extends t {
|
|
1872
2060
|
constructor(e, t) {
|
|
1873
2061
|
super(), this.checked = e, this.label = t;
|
|
1874
2062
|
}
|
|
@@ -1887,13 +2075,13 @@ var Qr = v.high(m.of([
|
|
|
1887
2075
|
return !1;
|
|
1888
2076
|
}
|
|
1889
2077
|
};
|
|
1890
|
-
function
|
|
1891
|
-
let n = e.facet(
|
|
1892
|
-
return
|
|
2078
|
+
function ji(e, t) {
|
|
2079
|
+
let n = e.facet(ki);
|
|
2080
|
+
return v.replace({ widget: new Ai(t, t ? n.done() : n.open()) });
|
|
1893
2081
|
}
|
|
1894
|
-
function
|
|
2082
|
+
function Mi(e) {
|
|
1895
2083
|
let t = [];
|
|
1896
|
-
return
|
|
2084
|
+
return s(e).iterate({ enter: (n) => {
|
|
1897
2085
|
if (n.name === "FencedCode" || n.name === "CodeBlock") return !1;
|
|
1898
2086
|
if (n.name === "TaskMarker") return t.push({
|
|
1899
2087
|
from: n.from,
|
|
@@ -1902,8 +2090,8 @@ function ai(e) {
|
|
|
1902
2090
|
}), !1;
|
|
1903
2091
|
} }), t;
|
|
1904
2092
|
}
|
|
1905
|
-
function
|
|
1906
|
-
let r =
|
|
2093
|
+
function Ni(e, t, n) {
|
|
2094
|
+
let r = Mi(e).filter((e) => e.from <= n && e.to >= t);
|
|
1907
2095
|
if (r.length === 0) return null;
|
|
1908
2096
|
let i = r.some((e) => !e.checked);
|
|
1909
2097
|
return r.map((e) => ({
|
|
@@ -1912,56 +2100,56 @@ function oi(e, t, n) {
|
|
|
1912
2100
|
insert: i ? "x" : " "
|
|
1913
2101
|
}));
|
|
1914
2102
|
}
|
|
1915
|
-
function
|
|
2103
|
+
function Pi(e) {
|
|
1916
2104
|
let { state: t } = e;
|
|
1917
2105
|
if (t.readOnly) return !1;
|
|
1918
2106
|
let n = t.selection.ranges.flatMap((e) => {
|
|
1919
2107
|
let n = t.doc.lineAt(e.from).from, r = t.doc.lineAt(e.to).to;
|
|
1920
|
-
return
|
|
2108
|
+
return Ni(t, n, r) ?? [];
|
|
1921
2109
|
});
|
|
1922
2110
|
return n.length !== 0 && (e.dispatch({
|
|
1923
2111
|
changes: n,
|
|
1924
2112
|
userEvent: "input.task"
|
|
1925
2113
|
}), !0);
|
|
1926
2114
|
}
|
|
1927
|
-
var
|
|
2115
|
+
var Fi = _.domEventHandlers({ mousedown(e, t) {
|
|
1928
2116
|
let n = e.target, r = n?.closest?.(".cm-md-task-box") ?? n?.closest?.(".cm-md-listprefix")?.querySelector(":scope > .cm-md-task-box");
|
|
1929
2117
|
if (!r || e.button !== 0) return !1;
|
|
1930
2118
|
if (e.preventDefault(), t.state.readOnly) return !0;
|
|
1931
|
-
let i = t.posAtDOM(r), a =
|
|
2119
|
+
let i = t.posAtDOM(r), a = Ni(t.state, i, i);
|
|
1932
2120
|
return a && t.dispatch({
|
|
1933
2121
|
changes: a,
|
|
1934
2122
|
userEvent: "input.task"
|
|
1935
2123
|
}), !0;
|
|
1936
2124
|
} });
|
|
1937
|
-
function
|
|
2125
|
+
function Ii(e) {
|
|
1938
2126
|
return [
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
2127
|
+
ki.of(e),
|
|
2128
|
+
Fi,
|
|
2129
|
+
y.high(n.of([{
|
|
1942
2130
|
key: "Mod-Enter",
|
|
1943
|
-
run:
|
|
2131
|
+
run: Pi
|
|
1944
2132
|
}]))
|
|
1945
2133
|
];
|
|
1946
2134
|
}
|
|
1947
2135
|
// src/components/inputs/text-editor/text-editor.hidden-syntax.ts
|
|
1948
|
-
var
|
|
2136
|
+
var Li = {
|
|
1949
2137
|
EmphasisMark: ["Emphasis", "StrongEmphasis"],
|
|
1950
2138
|
StrikethroughMark: ["Strikethrough"],
|
|
1951
2139
|
CodeMark: ["InlineCode"]
|
|
1952
|
-
},
|
|
1953
|
-
function
|
|
1954
|
-
return
|
|
2140
|
+
}, J = v.replace({}), Ri = v.mark({ class: "cm-md-bullet" }), zi = /^(\s*)[-*+]\s+\[[ xX]\](\s+)/, Bi = 2.5, Vi = {};
|
|
2141
|
+
function Hi(e) {
|
|
2142
|
+
return Vi[e] ?? (Vi[e] = v.line({ attributes: { style: `text-indent:calc(${e} * var(--_text-editor-marker-advance) * -1) !important;padding-left:calc(${e} * var(--_text-editor-marker-advance)) !important` } }));
|
|
1955
2143
|
}
|
|
1956
|
-
var
|
|
1957
|
-
function
|
|
2144
|
+
var Ui = v.mark({ class: "cm-md-ordinal" }), Wi = {};
|
|
2145
|
+
function Gi(e) {
|
|
1958
2146
|
let t = e.join(",");
|
|
1959
|
-
return
|
|
2147
|
+
return Wi[t] ?? (Wi[t] = v.line({
|
|
1960
2148
|
class: "cm-md-quote-line",
|
|
1961
2149
|
attributes: { style: `background-image:${e.map(() => "var(--_text-editor-quote-rule)").join(",")};background-position:${e.map((e) => `calc(${e} * var(--_text-editor-marker-advance)) 0`).join(",")}` }
|
|
1962
2150
|
}));
|
|
1963
2151
|
}
|
|
1964
|
-
var
|
|
2152
|
+
var Ki = v.mark({ class: "cm-md-quote-mark-hidden" }), qi = v.mark({ class: "cm-md-quote-gap" }), Ji = v.mark({ class: "cm-md-code-bare" }), Yi = class extends t {
|
|
1965
2153
|
toDOM() {
|
|
1966
2154
|
let e = document.createElement("span");
|
|
1967
2155
|
return e.className = "cm-md-rule", e.setAttribute("aria-hidden", "true"), e;
|
|
@@ -1972,31 +2160,31 @@ var yi = d.mark({ class: "cm-md-quote-mark-hidden" }), bi = d.mark({ class: "cm-
|
|
|
1972
2160
|
ignoreEvent() {
|
|
1973
2161
|
return !1;
|
|
1974
2162
|
}
|
|
1975
|
-
},
|
|
1976
|
-
function
|
|
2163
|
+
}, Xi = v.replace({ widget: new Yi() });
|
|
2164
|
+
function Zi(e) {
|
|
1977
2165
|
let t = e;
|
|
1978
2166
|
for (let n = e.parent; n; n = n.parent) n.name === "Blockquote" && (t = n);
|
|
1979
2167
|
return t;
|
|
1980
2168
|
}
|
|
1981
|
-
var
|
|
1982
|
-
function
|
|
2169
|
+
var Qi = 2, $i = {};
|
|
2170
|
+
function ea(e, t) {
|
|
1983
2171
|
var n;
|
|
1984
|
-
return
|
|
2172
|
+
return $i[n = `${e},${t}`] ?? ($i[n] = v.line({ attributes: { style: `text-indent:calc(${e} * var(--_text-editor-marker-advance) * -1) !important;padding-left:calc(${e + t} * var(--_text-editor-marker-advance)) !important` } }));
|
|
1985
2173
|
}
|
|
1986
|
-
function
|
|
1987
|
-
let
|
|
1988
|
-
return
|
|
2174
|
+
function ta(e, t) {
|
|
2175
|
+
let n = /* @__PURE__ */ new Map();
|
|
2176
|
+
return s(e).iterate({
|
|
1989
2177
|
from: t.from,
|
|
1990
2178
|
to: t.to,
|
|
1991
2179
|
enter: (t) => {
|
|
1992
|
-
t.name === "Blockquote" &&
|
|
2180
|
+
t.name === "Blockquote" && Le(e, t.from, t.to, (e) => n.set(e, (n.get(e) ?? 0) + 1));
|
|
1993
2181
|
}
|
|
1994
|
-
}),
|
|
2182
|
+
}), n;
|
|
1995
2183
|
}
|
|
1996
|
-
function
|
|
2184
|
+
function na(e, t) {
|
|
1997
2185
|
for (let n = e.doc.lineAt(t.to);; n = e.doc.line(n.number - 1)) if (/[^\s>]/.test(n.text) || n.from <= t.from) return n.from;
|
|
1998
2186
|
}
|
|
1999
|
-
function
|
|
2187
|
+
function ra(e, t) {
|
|
2000
2188
|
let n = [];
|
|
2001
2189
|
for (let r of t) {
|
|
2002
2190
|
let t = /^[ ]*/.exec(e.slice(r + 1))[0].length;
|
|
@@ -2004,113 +2192,113 @@ function Ai(e, t) {
|
|
|
2004
2192
|
}
|
|
2005
2193
|
return n;
|
|
2006
2194
|
}
|
|
2007
|
-
function
|
|
2008
|
-
let
|
|
2009
|
-
return
|
|
2195
|
+
function ia(e, t) {
|
|
2196
|
+
let n = /* @__PURE__ */ new Map();
|
|
2197
|
+
return s(e).iterate({
|
|
2010
2198
|
from: t.from,
|
|
2011
2199
|
to: t.to,
|
|
2012
2200
|
enter: (t) => {
|
|
2013
2201
|
if (t.name !== "QuoteMark") return;
|
|
2014
|
-
let
|
|
2015
|
-
i.push(t.from -
|
|
2202
|
+
let r = e.doc.lineAt(t.from), i = n.get(r.from) ?? [];
|
|
2203
|
+
i.push(t.from - r.from), n.set(r.from, i);
|
|
2016
2204
|
}
|
|
2017
|
-
}),
|
|
2205
|
+
}), n;
|
|
2018
2206
|
}
|
|
2019
|
-
function
|
|
2020
|
-
return !e.readOnly && e.facet(
|
|
2207
|
+
function aa(e) {
|
|
2208
|
+
return !e.readOnly && e.facet(_.editable);
|
|
2021
2209
|
}
|
|
2022
|
-
function
|
|
2023
|
-
return
|
|
2210
|
+
function oa(e, t, n) {
|
|
2211
|
+
return aa(e) && e.selection.ranges.some((e) => e.from <= n && e.to >= t);
|
|
2024
2212
|
}
|
|
2025
|
-
var
|
|
2213
|
+
var sa = v.replace({ block: !0 }), ca = v.replace({}), la = v.mark({ class: "cm-md-code-language" }), ua = /* @__PURE__ */ new Set([
|
|
2026
2214
|
"Document",
|
|
2027
2215
|
"Blockquote",
|
|
2028
2216
|
"BulletList",
|
|
2029
2217
|
"OrderedList",
|
|
2030
2218
|
"ListItem"
|
|
2031
2219
|
]);
|
|
2032
|
-
function
|
|
2220
|
+
function da(e) {
|
|
2033
2221
|
let t = [];
|
|
2034
|
-
return
|
|
2035
|
-
if (n.name !== "FencedCode") return
|
|
2036
|
-
if (
|
|
2222
|
+
return s(e).iterate({ enter: (n) => {
|
|
2223
|
+
if (n.name !== "FencedCode") return ua.has(n.name);
|
|
2224
|
+
if (oa(e, n.from, n.to)) return !1;
|
|
2037
2225
|
let r = n.node.getChildren("CodeMark").map((t) => e.doc.lineAt(t.from)), i = e.doc.lineAt(n.from).number;
|
|
2038
2226
|
if (e.doc.lineAt(n.to).number - i + 1 <= r.length) return !1;
|
|
2039
2227
|
let a = n.node.getChild("CodeInfo"), o = n.node.getChild("CodeMark");
|
|
2040
|
-
for (let [e, n] of r.entries()) e === 0 ? (t.push(
|
|
2228
|
+
for (let [e, n] of r.entries()) e === 0 ? (t.push(ca.range(o.from, a ? a.from : o.to)), a && t.push(la.range(a.from, a.to))) : t.push(sa.range(n.from, n.to));
|
|
2041
2229
|
return !1;
|
|
2042
|
-
} }),
|
|
2230
|
+
} }), v.set(t, !0);
|
|
2043
2231
|
}
|
|
2044
|
-
function
|
|
2232
|
+
function fa(e) {
|
|
2045
2233
|
let t = [];
|
|
2046
|
-
for (let
|
|
2047
|
-
from:
|
|
2048
|
-
to:
|
|
2049
|
-
enter: (e) => (e.name === "FencedCode" && t.push(e.from), e.name !== "FencedCode" &&
|
|
2234
|
+
for (let n of e.selection.ranges) s(e).iterate({
|
|
2235
|
+
from: n.from,
|
|
2236
|
+
to: n.to,
|
|
2237
|
+
enter: (e) => (e.name === "FencedCode" && t.push(e.from), e.name !== "FencedCode" && ua.has(e.name))
|
|
2050
2238
|
});
|
|
2051
2239
|
return t.join(",");
|
|
2052
2240
|
}
|
|
2053
|
-
var
|
|
2054
|
-
create:
|
|
2055
|
-
update: (e, t) => t.docChanged || t.reconfigured ||
|
|
2056
|
-
provide: (e) =>
|
|
2241
|
+
var pa = h.define({
|
|
2242
|
+
create: da,
|
|
2243
|
+
update: (e, t) => t.docChanged || t.reconfigured || D(t.startState, t.state) || t.selection && fa(t.startState) !== fa(t.state) ? da(t.state) : e,
|
|
2244
|
+
provide: (e) => _.decorations.from(e)
|
|
2057
2245
|
});
|
|
2058
|
-
function
|
|
2059
|
-
let { state: t } = e,
|
|
2060
|
-
for (let { from:
|
|
2061
|
-
from:
|
|
2062
|
-
to:
|
|
2246
|
+
function ma(e) {
|
|
2247
|
+
let { state: t } = e, n = (e, n) => oa(t, e, n), r = [];
|
|
2248
|
+
for (let { from: i, to: a } of e.visibleRanges) s(t).iterate({
|
|
2249
|
+
from: i,
|
|
2250
|
+
to: a,
|
|
2063
2251
|
enter: (e) => {
|
|
2064
|
-
let
|
|
2065
|
-
if (e.name === "HorizontalRule") return
|
|
2252
|
+
let i = e.node.parent;
|
|
2253
|
+
if (e.name === "HorizontalRule") return n(e.from, e.to) || r.push(Xi.range(e.from, e.to)), !1;
|
|
2066
2254
|
if (e.name === "Blockquote") {
|
|
2067
|
-
let
|
|
2068
|
-
if (
|
|
2069
|
-
let a =
|
|
2070
|
-
|
|
2255
|
+
let i = Zi(e.node);
|
|
2256
|
+
if (i !== e.node || n(i.from, i.to)) return;
|
|
2257
|
+
let a = ia(t, i), o = ta(t, i), s = na(t, i), c = [0];
|
|
2258
|
+
Le(t, i.from, i.to, (e) => {
|
|
2071
2259
|
if (e > s) return;
|
|
2072
|
-
let n = t.doc.lineAt(e),
|
|
2073
|
-
for (let [t, n] of l)
|
|
2074
|
-
let d =
|
|
2075
|
-
for (let t of d)
|
|
2076
|
-
let f =
|
|
2077
|
-
for (; h.length < p;) h.push(h.length ? h[h.length - 1] +
|
|
2078
|
-
let g = f.length ? (p - f.length) *
|
|
2079
|
-
g > 0 ?
|
|
2260
|
+
let n = t.doc.lineAt(e), i = a.get(e) ?? [], l = ra(n.text, i), u = l.reduce((e, [t, n]) => e + n - t, 0);
|
|
2261
|
+
for (let [t, n] of l) r.push(J.range(e + t, e + n));
|
|
2262
|
+
let d = i.filter((e) => /[^ \t]/.test(n.text.charAt(e + 1)));
|
|
2263
|
+
for (let t of d) r.push(qi.range(e + t, e + t + 1));
|
|
2264
|
+
let f = i.map((e) => e - l.filter(([t]) => t < e).reduce((e, [t, n]) => e + n - t, 0) + d.filter((t) => t < e).length), p = Math.max(1, o.get(e) ?? 0), m = nn(n.text) - u + d.length, h = (f.length ? f : c).slice(0, p);
|
|
2265
|
+
for (; h.length < p;) h.push(h.length ? h[h.length - 1] + Qi : 0);
|
|
2266
|
+
let g = f.length ? (p - f.length) * Qi : h[h.length - 1] + Qi;
|
|
2267
|
+
g > 0 ? r.push(ea(m, g).range(e)) : (u || d.length) && r.push(Hi(m).range(e)), r.push(Gi(h).range(e)), c = h;
|
|
2080
2268
|
});
|
|
2081
|
-
} else if (
|
|
2269
|
+
} else if (i) {
|
|
2082
2270
|
if (e.name === "QuoteMark") {
|
|
2083
|
-
let
|
|
2084
|
-
|
|
2271
|
+
let i = Zi(e.node), a = t.sliceDoc(e.to, e.to + 1) === " " ? e.to + 1 : e.to;
|
|
2272
|
+
n(i.from, i.to) || r.push(Ki.range(e.from, a));
|
|
2085
2273
|
} else if (e.name === "ListMark" && /^[-*+]$/.test(t.sliceDoc(e.from, e.to)) && /^[ \t]/.test(t.sliceDoc(e.to, e.to + 1))) {
|
|
2086
|
-
let
|
|
2087
|
-
if (
|
|
2088
|
-
let a =
|
|
2274
|
+
let i = t.doc.lineAt(e.from);
|
|
2275
|
+
if (n(i.from, i.to)) return;
|
|
2276
|
+
let a = zi.exec(i.text), o = a && e.node.parent?.getChild("Task")?.getChild("TaskMarker");
|
|
2089
2277
|
if (a && o) {
|
|
2090
|
-
|
|
2278
|
+
r.push(Hi(a[1].length + Bi + a[2].length).range(i.from), J.range(e.from, o.from), ji(t, /x/i.test(t.sliceDoc(o.from, o.to))).range(o.from, o.to));
|
|
2091
2279
|
return;
|
|
2092
2280
|
}
|
|
2093
|
-
|
|
2094
|
-
} else if (e.name === "ListMark" && /^\d+[.)]$/.test(t.sliceDoc(e.from, e.to)))
|
|
2095
|
-
else if (e.name === "HeaderMark" &&
|
|
2281
|
+
r.push(Ri.range(e.from, e.to));
|
|
2282
|
+
} else if (e.name === "ListMark" && /^\d+[.)]$/.test(t.sliceDoc(e.from, e.to))) r.push(Ui.range(e.from, e.to));
|
|
2283
|
+
else if (e.name === "HeaderMark" && i.name.startsWith("ATXHeading")) {
|
|
2096
2284
|
let a = t.sliceDoc(e.to, e.to + 1) === " " ? e.to + 1 : e.to;
|
|
2097
|
-
|
|
2285
|
+
n(i.from, i.to) || r.push(J.range(e.from, a));
|
|
2098
2286
|
} else if (e.name === "Link") {
|
|
2099
|
-
let
|
|
2100
|
-
if (!
|
|
2101
|
-
|
|
2102
|
-
} else if (
|
|
2103
|
-
let t =
|
|
2104
|
-
t && t.from > e.to &&
|
|
2287
|
+
let i = e.node.getChild("URL"), a = e.node.getChildren("LinkMark");
|
|
2288
|
+
if (!i || a.length < 2 || k(t, e.node)) return;
|
|
2289
|
+
n(e.from, e.to) || r.push(J.range(a[0].from, a[0].to), J.range(a[1].from, e.to));
|
|
2290
|
+
} else if (Li[e.name]?.includes(i.name) && !n(i.from, i.to) && (r.push(J.range(e.from, e.to)), e.name === "CodeMark" && e.from === i.from)) {
|
|
2291
|
+
let t = i.lastChild;
|
|
2292
|
+
t && t.from > e.to && r.push(Ji.range(e.to, t.from));
|
|
2105
2293
|
}
|
|
2106
2294
|
}
|
|
2107
2295
|
}
|
|
2108
2296
|
});
|
|
2109
|
-
return
|
|
2297
|
+
return v.set(r, !0);
|
|
2110
2298
|
}
|
|
2111
|
-
var
|
|
2299
|
+
var ha = 3, ga = class {
|
|
2112
2300
|
constructor(e) {
|
|
2113
|
-
this.view = e, this.layerObserver = new MutationObserver(() => this.mendSelection()), this.observing = !1, this.checked = "", this.mends = 0, this.decorations =
|
|
2301
|
+
this.view = e, this.layerObserver = new MutationObserver(() => this.mendSelection()), this.observing = !1, this.checked = "", this.mends = 0, this.decorations = ma(e), queueMicrotask(() => this.observeLayer());
|
|
2114
2302
|
}
|
|
2115
2303
|
observeLayer() {
|
|
2116
2304
|
if (this.observing) return;
|
|
@@ -2122,11 +2310,11 @@ var Hi = 3, Ui = class {
|
|
|
2122
2310
|
}), this.observing = !0);
|
|
2123
2311
|
}
|
|
2124
2312
|
update(e) {
|
|
2125
|
-
this.observeLayer(), (e.docChanged || e.selectionSet || e.viewportChanged ||
|
|
2313
|
+
this.observeLayer(), (e.docChanged || e.selectionSet || e.viewportChanged || D(e.startState, e.state) || e.transactions.some((e) => e.reconfigured)) && (this.decorations = ma(e.view));
|
|
2126
2314
|
}
|
|
2127
2315
|
mendSelection() {
|
|
2128
2316
|
let { view: e } = this, { from: t, to: n, empty: r } = e.state.selection.main, i = `${t}-${n}-${e.state.doc.length}`;
|
|
2129
|
-
if (i !== this.checked && (this.checked = i, this.mends = 0), r || this.mends >=
|
|
2317
|
+
if (i !== this.checked && (this.checked = i, this.mends = 0), r || this.mends >= ha) return;
|
|
2130
2318
|
let a = e.dom.querySelector(".cm-selectionLayer"), o = a ? [...a.querySelectorAll(".cm-selectionBackground")] : [];
|
|
2131
2319
|
if (o.length < 2) return;
|
|
2132
2320
|
let s = e.coordsAtPos(t, 1), c = e.coordsAtPos(n, -1);
|
|
@@ -2139,15 +2327,15 @@ var Hi = 3, Ui = class {
|
|
|
2139
2327
|
this.layerObserver.disconnect();
|
|
2140
2328
|
}
|
|
2141
2329
|
};
|
|
2142
|
-
function
|
|
2143
|
-
return [
|
|
2330
|
+
function _a() {
|
|
2331
|
+
return [y.highest(c.fromClass(ga, { decorations: (e) => e.decorations })), pa];
|
|
2144
2332
|
}
|
|
2145
2333
|
// src/components/inputs/text-editor/text-editor.selection.ts
|
|
2146
|
-
function
|
|
2334
|
+
function va(e) {
|
|
2147
2335
|
let t = e.dom.querySelector(".cm-selectionLayer");
|
|
2148
2336
|
if (!t) return;
|
|
2149
2337
|
let n = e.defaultLineHeight, r = e.contentDOM, i = r.getBoundingClientRect().right - (parseFloat(getComputedStyle(r).paddingRight) || 0);
|
|
2150
|
-
|
|
2338
|
+
ya([...t.querySelectorAll(".cm-selectionBackground")].map((t) => {
|
|
2151
2339
|
let r = t.getBoundingClientRect();
|
|
2152
2340
|
if (r.height >= n * 1.25) return {
|
|
2153
2341
|
piece: t,
|
|
@@ -2176,17 +2364,17 @@ function Gi(e) {
|
|
|
2176
2364
|
return Math.abs(c - s) > .25 && (e.style.top = `${c}px`, o.top = t.top + (c - s)), Math.abs(t.height - n) > .25 && (e.style.height = `${n}px`, o.height = n), o;
|
|
2177
2365
|
}), n);
|
|
2178
2366
|
}
|
|
2179
|
-
function
|
|
2367
|
+
function ya(e, t) {
|
|
2180
2368
|
let n = [...e].sort((e, t) => e.top - t.top);
|
|
2181
2369
|
for (let e = 1; e < n.length; e++) {
|
|
2182
2370
|
let r = n[e - 1], i = n[e].top - (r.top + r.height);
|
|
2183
2371
|
i > .25 && i < t / 2 && (r.piece.style.height = `${r.height + i}px`);
|
|
2184
2372
|
}
|
|
2185
2373
|
}
|
|
2186
|
-
var
|
|
2374
|
+
var ba = class {
|
|
2187
2375
|
constructor(e) {
|
|
2188
2376
|
this.view = e, this.observer = new MutationObserver(() => {
|
|
2189
|
-
|
|
2377
|
+
va(this.view), this.observer.takeRecords();
|
|
2190
2378
|
}), this.observing = !1, queueMicrotask(() => this.observe());
|
|
2191
2379
|
}
|
|
2192
2380
|
update() {
|
|
@@ -2204,7 +2392,7 @@ var qi = class {
|
|
|
2204
2392
|
destroy() {
|
|
2205
2393
|
this.observer.disconnect();
|
|
2206
2394
|
}
|
|
2207
|
-
},
|
|
2395
|
+
}, xa = c.fromClass(ba), Sa = ie`
|
|
2208
2396
|
|
|
2209
2397
|
|
|
2210
2398
|
/* # Host */
|
|
@@ -2218,9 +2406,16 @@ var qi = class {
|
|
|
2218
2406
|
--_text-editor-caret-ring-color: var(--semantics-surfaces-base-background-color);
|
|
2219
2407
|
--_text-editor-corner-radius: var(--primitives-corner-radius-lg);
|
|
2220
2408
|
--_text-editor-background-color: var(--semantics-input-fields-background-color);
|
|
2409
|
+
--_text-editor-toolbar-background-color: var(--_text-editor-background-color);
|
|
2410
|
+
--_text-editor-toolbar-divider: var(--semantics-dividers-thickness) solid var(--semantics-dividers-color);
|
|
2411
|
+
--_text-editor-toolbar-padding: var(--primitives-space-8);
|
|
2412
|
+
--_text-editor-toolbar-gap: var(--primitives-space-8);
|
|
2413
|
+
--_text-editor-toolbar-text-gap: var(--primitives-space-12);
|
|
2414
|
+
--_text-editor-stuck-gap: 0px;
|
|
2221
2415
|
--_text-editor-input-field-border-color: var(--semantics-input-fields-border-color);
|
|
2222
2416
|
--_text-editor-input-field-border-shadow: inset 0 0 0 var(--semantics-input-fields-border-width) var(--_text-editor-input-field-border-color);
|
|
2223
|
-
--_text-editor-
|
|
2417
|
+
--_text-editor-toolbar-z-index: 1;
|
|
2418
|
+
--_text-editor-input-field-border-z-index: 2;
|
|
2224
2419
|
--_text-editor-padding-block: var(--semantics-controls-md-inline-padding);
|
|
2225
2420
|
--_text-editor-padding-inline: var(--semantics-controls-md-inline-padding);
|
|
2226
2421
|
--_text-editor-content-color: var(--semantics-content-color);
|
|
@@ -2258,7 +2453,7 @@ var qi = class {
|
|
|
2258
2453
|
--_text-editor-bullet-color: var(--semantics-content-color);
|
|
2259
2454
|
--_text-editor-rule-thickness: var(--semantics-dividers-thickness);
|
|
2260
2455
|
--_text-editor-quote-border-width: var(--primitives-border-width-regular);
|
|
2261
|
-
--_text-editor-quote-border-color: var(--semantics-
|
|
2456
|
+
--_text-editor-quote-border-color: var(--semantics-blockquotes-border-color);
|
|
2262
2457
|
--_text-editor-quote-rule: linear-gradient(var(--_text-editor-quote-border-color), var(--_text-editor-quote-border-color));
|
|
2263
2458
|
--_text-editor-rule-color: var(--semantics-dividers-color);
|
|
2264
2459
|
--_text-editor-heading-marker-scale: 75%;
|
|
@@ -2340,7 +2535,7 @@ var qi = class {
|
|
|
2340
2535
|
--_text-editor-popup-message-padding-inline: var(--primitives-space-16);
|
|
2341
2536
|
--_text-editor-popup-message-color: var(--semantics-content-secondary-color);
|
|
2342
2537
|
|
|
2343
|
-
${
|
|
2538
|
+
${Ae}
|
|
2344
2539
|
display: flex;
|
|
2345
2540
|
min-height: 0;
|
|
2346
2541
|
flex-direction: column;
|
|
@@ -2368,6 +2563,9 @@ var qi = class {
|
|
|
2368
2563
|
--_text-editor-background-color: transparent;
|
|
2369
2564
|
--_text-editor-input-field-border-color: transparent;
|
|
2370
2565
|
--_text-editor-input-field-border-shadow: none;
|
|
2566
|
+
--_text-editor-toolbar-background-color: var(--context-background-color);
|
|
2567
|
+
--_text-editor-toolbar-padding: 0px;
|
|
2568
|
+
--_text-editor-stuck-gap: var(--_text-editor-toolbar-gap);
|
|
2371
2569
|
--_text-editor-padding-block: 0px;
|
|
2372
2570
|
/* Room for the caret's own ink at the first and last position of a line:
|
|
2373
2571
|
its width plus its ring. Without it the edge carets are clipped. */
|
|
@@ -2409,6 +2607,43 @@ var qi = class {
|
|
|
2409
2607
|
isolation: isolate;
|
|
2410
2608
|
}
|
|
2411
2609
|
|
|
2610
|
+
|
|
2611
|
+
/* # Toolbar */
|
|
2612
|
+
|
|
2613
|
+
slot[name="toolbar"] {
|
|
2614
|
+
display: block;
|
|
2615
|
+
order: -1;
|
|
2616
|
+
position: sticky;
|
|
2617
|
+
top: var(--context-inset-top, 0px);
|
|
2618
|
+
z-index: var(--_text-editor-toolbar-z-index);
|
|
2619
|
+
border-radius: inherit;
|
|
2620
|
+
background-color: var(--_text-editor-toolbar-background-color);
|
|
2621
|
+
padding: var(--_text-editor-toolbar-padding);
|
|
2622
|
+
border-end-start-radius: 0;
|
|
2623
|
+
border-end-end-radius: 0;
|
|
2624
|
+
border-block-end: var(--_text-editor-toolbar-divider);
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
slot[name="toolbar"][hidden] {
|
|
2628
|
+
display: none;
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
:host([embedded]) slot[name="toolbar"] {
|
|
2632
|
+
padding-block-end: var(--_text-editor-toolbar-gap);
|
|
2633
|
+
}
|
|
2634
|
+
|
|
2635
|
+
/* Stuck, the bar keeps a gap to the edge it sticks to, filled with its own
|
|
2636
|
+
background so the text scrolls under it. Offset and shadow, not padding:
|
|
2637
|
+
the text does not move when it starts to stick. */
|
|
2638
|
+
slot[name="toolbar"].is-stuck {
|
|
2639
|
+
top: calc(var(--context-inset-top, 0px) + var(--_text-editor-stuck-gap));
|
|
2640
|
+
box-shadow: 0 calc(-1 * var(--_text-editor-stuck-gap)) 0 0 var(--_text-editor-toolbar-background-color);
|
|
2641
|
+
}
|
|
2642
|
+
|
|
2643
|
+
:host([embedded]) .text-editor:has(> slot[name="toolbar"]:not([hidden])) .cm-content {
|
|
2644
|
+
padding-block-start: var(--_text-editor-toolbar-text-gap);
|
|
2645
|
+
}
|
|
2646
|
+
|
|
2412
2647
|
:host([disabled]) .text-editor {
|
|
2413
2648
|
opacity: var(--primitives-opacity-disabled);
|
|
2414
2649
|
pointer-events: none;
|
|
@@ -3276,36 +3511,36 @@ var qi = class {
|
|
|
3276
3511
|
}
|
|
3277
3512
|
`;
|
|
3278
3513
|
// src/components/inputs/text-editor/text-editor.template.ts
|
|
3279
|
-
function
|
|
3280
|
-
return
|
|
3514
|
+
function Ca(e) {
|
|
3515
|
+
return ke`<div class="text-editor"><slot name="toolbar" ?hidden=${!e._hasSlottedToolbar}></slot></div>`;
|
|
3281
3516
|
}
|
|
3282
3517
|
// src/components/inputs/text-editor/text-editor.code-copy.ts
|
|
3283
|
-
var
|
|
3518
|
+
var wa = x.define({ combine: (e) => e[0] ?? {
|
|
3284
3519
|
copy: () => "Kopieer",
|
|
3285
3520
|
success: () => "Gekopieerd",
|
|
3286
3521
|
failure: () => "Kopiëren mislukt"
|
|
3287
|
-
} }),
|
|
3288
|
-
function
|
|
3522
|
+
} }), Ta = 300, Ea = 2e3;
|
|
3523
|
+
function Da() {
|
|
3289
3524
|
return typeof window < "u" && window.isSecureContext && typeof navigator.clipboard?.writeText == "function";
|
|
3290
3525
|
}
|
|
3291
|
-
function
|
|
3292
|
-
let
|
|
3293
|
-
return
|
|
3526
|
+
function Oa(e, t) {
|
|
3527
|
+
let n = "";
|
|
3528
|
+
return s(e).iterate({
|
|
3294
3529
|
from: t,
|
|
3295
3530
|
to: t,
|
|
3296
|
-
enter: (
|
|
3297
|
-
if (
|
|
3298
|
-
let i =
|
|
3299
|
-
return i && (
|
|
3531
|
+
enter: (r) => {
|
|
3532
|
+
if (r.name !== "FencedCode" || r.from !== t) return;
|
|
3533
|
+
let i = r.node.getChild("CodeText");
|
|
3534
|
+
return i && (n = e.sliceDoc(i.from, i.to)), !1;
|
|
3300
3535
|
}
|
|
3301
|
-
}),
|
|
3536
|
+
}), n;
|
|
3302
3537
|
}
|
|
3303
|
-
function
|
|
3538
|
+
function Y(e, t, n) {
|
|
3304
3539
|
e.dataset.state = n, e.querySelector("nldd-icon").setAttribute("icon", n === "success" ? "check-mark" : "copy");
|
|
3305
3540
|
let r = n === "success" ? t.success() : n === "failure" ? t.failure() : t.copy();
|
|
3306
3541
|
e.querySelector(".cm-md-code-copy-text").textContent = r, e.nextElementSibling.textContent = n === "idle" ? "" : r;
|
|
3307
3542
|
}
|
|
3308
|
-
var
|
|
3543
|
+
var X = /* @__PURE__ */ new WeakMap(), ka = class extends t {
|
|
3309
3544
|
constructor(e, t, n) {
|
|
3310
3545
|
super(), this.lineFrom = e, this.focusable = t, this.label = n;
|
|
3311
3546
|
}
|
|
@@ -3313,7 +3548,7 @@ var ea = /* @__PURE__ */ new WeakMap(), ta = class extends f {
|
|
|
3313
3548
|
return e.lineFrom === this.lineFrom && e.focusable === this.focusable && e.label === this.label;
|
|
3314
3549
|
}
|
|
3315
3550
|
toDOM(e) {
|
|
3316
|
-
let t = () => e.state.facet(
|
|
3551
|
+
let t = () => e.state.facet(wa), n = document.createElement("button");
|
|
3317
3552
|
n.type = "button", n.className = "cm-md-code-copy", this.focusable || (n.tabIndex = -1);
|
|
3318
3553
|
let r = document.createElement("nldd-icon");
|
|
3319
3554
|
r.setAttribute("aria-hidden", "true"), r.className = "cm-md-code-copy-icon";
|
|
@@ -3322,81 +3557,267 @@ var ea = /* @__PURE__ */ new WeakMap(), ta = class extends f {
|
|
|
3322
3557
|
let a = document.createElement("span");
|
|
3323
3558
|
a.className = "cm-md-code-copy-status", a.setAttribute("role", "status"), n.append(r, i);
|
|
3324
3559
|
let o = document.createElement("span");
|
|
3325
|
-
|
|
3326
|
-
|
|
3560
|
+
o.className = "cm-md-code-copy-wrap", o.append(n, a), Y(n, t(), "idle"), n.addEventListener("mousedown", (e) => e.preventDefault());
|
|
3561
|
+
let s = "", c = (e) => {
|
|
3562
|
+
clearTimeout(X.get(o)), X.set(o, setTimeout(() => Y(n, t(), "idle"), e));
|
|
3563
|
+
}, l = () => {
|
|
3564
|
+
clearTimeout(X.get(o)), n.dataset.state !== "idle" && Y(n, t(), "idle");
|
|
3565
|
+
};
|
|
3566
|
+
return n.addEventListener("pointerdown", (e) => {
|
|
3567
|
+
s = e.pointerType;
|
|
3568
|
+
}), n.addEventListener("keydown", (e) => {
|
|
3569
|
+
s = "", e.key === "Escape" && l();
|
|
3570
|
+
}), n.addEventListener("click", async () => {
|
|
3571
|
+
clearTimeout(X.get(o));
|
|
3327
3572
|
try {
|
|
3328
|
-
await navigator.clipboard.writeText(
|
|
3573
|
+
await navigator.clipboard.writeText(Oa(e.state, e.state.doc.lineAt(e.posAtDOM(n)).from)), Y(n, t(), "success");
|
|
3329
3574
|
} catch {
|
|
3330
|
-
|
|
3575
|
+
Y(n, t(), "failure");
|
|
3331
3576
|
}
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
}), o;
|
|
3577
|
+
s && s !== "mouse" && c(Ea);
|
|
3578
|
+
}), n.addEventListener("pointerenter", () => clearTimeout(X.get(o))), n.addEventListener("pointerleave", () => {
|
|
3579
|
+
n.dataset.state === "idle" || n.matches(":focus") || c(Ta);
|
|
3580
|
+
}), n.addEventListener("blur", l), o;
|
|
3337
3581
|
}
|
|
3338
3582
|
destroy(e) {
|
|
3339
|
-
clearTimeout(
|
|
3583
|
+
clearTimeout(X.get(e));
|
|
3340
3584
|
}
|
|
3341
3585
|
ignoreEvent() {
|
|
3342
3586
|
return !0;
|
|
3343
3587
|
}
|
|
3344
3588
|
};
|
|
3345
|
-
function
|
|
3346
|
-
if (!
|
|
3347
|
-
let t = [],
|
|
3348
|
-
return
|
|
3349
|
-
if (
|
|
3350
|
-
let a = e.doc.lineAt(
|
|
3351
|
-
return t.push(
|
|
3352
|
-
widget: new
|
|
3589
|
+
function Aa(e) {
|
|
3590
|
+
if (!Da()) return v.none;
|
|
3591
|
+
let t = [], n = e.readOnly, r = e.facet(wa).copy();
|
|
3592
|
+
return s(e).iterate({ enter: (i) => {
|
|
3593
|
+
if (i.name !== "FencedCode") return;
|
|
3594
|
+
let a = e.doc.lineAt(i.from);
|
|
3595
|
+
return t.push(ja.range(a.from), v.widget({
|
|
3596
|
+
widget: new ka(a.from, n, r),
|
|
3353
3597
|
side: 1
|
|
3354
3598
|
}).range(a.to)), !1;
|
|
3355
|
-
} }),
|
|
3599
|
+
} }), v.set(t, !0);
|
|
3356
3600
|
}
|
|
3357
|
-
var
|
|
3358
|
-
function
|
|
3359
|
-
let n = t.state.facet(
|
|
3360
|
-
for (let e of t.dom.querySelectorAll(".cm-md-code-copy[data-state=\"
|
|
3601
|
+
var ja = v.line({ class: "cm-md-code-head" });
|
|
3602
|
+
function Ma(e, t) {
|
|
3603
|
+
let n = t.state.facet(wa);
|
|
3604
|
+
for (let e of t.dom.querySelectorAll(".cm-md-code-copy:not([data-state=\"idle\"])")) clearTimeout(X.get(e.parentElement)), Y(e, n, "idle");
|
|
3361
3605
|
return !1;
|
|
3362
3606
|
}
|
|
3363
|
-
var
|
|
3364
|
-
mousedown:
|
|
3365
|
-
keydown:
|
|
3607
|
+
var Na = _.domEventHandlers({
|
|
3608
|
+
mousedown: Ma,
|
|
3609
|
+
keydown: Ma
|
|
3366
3610
|
});
|
|
3367
|
-
function
|
|
3368
|
-
let
|
|
3369
|
-
create:
|
|
3370
|
-
update: (e, t) => t.docChanged || t.reconfigured ||
|
|
3371
|
-
provide: (e) =>
|
|
3611
|
+
function Pa(e) {
|
|
3612
|
+
let t = h.define({
|
|
3613
|
+
create: Aa,
|
|
3614
|
+
update: (e, t) => t.docChanged || t.reconfigured || D(t.startState, t.state) ? Aa(t.state) : e,
|
|
3615
|
+
provide: (e) => _.decorations.from(e)
|
|
3372
3616
|
});
|
|
3373
3617
|
return [
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3618
|
+
wa.of(e),
|
|
3619
|
+
t,
|
|
3620
|
+
Na
|
|
3377
3621
|
];
|
|
3378
3622
|
}
|
|
3379
|
-
// src/components/inputs/text-editor/text-editor.ts
|
|
3380
|
-
var
|
|
3623
|
+
// src/components/inputs/text-editor/text-editor.toolbar.ts
|
|
3624
|
+
var Z = "text-editor-command", Fa = "text-editor-for";
|
|
3625
|
+
function Ia(e) {
|
|
3626
|
+
let t = e.indexOf(":");
|
|
3627
|
+
if (t < 0) return [e.trim(), void 0];
|
|
3628
|
+
let n = e.slice(t + 1).trim();
|
|
3629
|
+
return [e.slice(0, t).trim(), /^\d+$/.test(n) ? Number(n) : n];
|
|
3630
|
+
}
|
|
3631
|
+
function La(e) {
|
|
3632
|
+
let { active: t } = e;
|
|
3633
|
+
return t.taskList ? "task" : t.orderedList ? "ordered" : t.bulletList ? "bullet" : "none";
|
|
3634
|
+
}
|
|
3635
|
+
var Ra = /* @__PURE__ */ new Set([
|
|
3636
|
+
"bold",
|
|
3637
|
+
"italic",
|
|
3638
|
+
"inlineCode",
|
|
3639
|
+
"strikethrough",
|
|
3640
|
+
"link",
|
|
3641
|
+
"quote",
|
|
3642
|
+
"codeBlock",
|
|
3643
|
+
"taskList"
|
|
3644
|
+
]);
|
|
3645
|
+
function za(e, t, n) {
|
|
3646
|
+
let { active: r } = n;
|
|
3647
|
+
return Ra.has(e) ? !!r[e] : e === "bulletList" ? r.bulletList && !r.taskList : e === "heading" ? r.heading === (typeof t == "number" ? t : 1) : e === "setHeading" ? !r.codeBlock && r.heading === (typeof t == "number" ? t : 0) : e === "setList" && !r.codeBlock && La(n) === (t ?? "none");
|
|
3648
|
+
}
|
|
3649
|
+
var Ba = /* @__PURE__ */ new Set([
|
|
3650
|
+
"bold",
|
|
3651
|
+
"italic",
|
|
3652
|
+
"strikethrough",
|
|
3653
|
+
"link"
|
|
3654
|
+
]), Va = /* @__PURE__ */ new Set([
|
|
3655
|
+
"inlineCode",
|
|
3656
|
+
"quote",
|
|
3657
|
+
"bulletList",
|
|
3658
|
+
"taskList",
|
|
3659
|
+
"setList",
|
|
3660
|
+
"heading"
|
|
3661
|
+
]);
|
|
3662
|
+
function Ha(e, t, n) {
|
|
3663
|
+
if (t.disabled) return !1;
|
|
3664
|
+
if (t.readonly) return e === "copy";
|
|
3665
|
+
let { active: r } = n;
|
|
3666
|
+
if (Ba.has(e)) return !r.inlineCode && !r.codeBlock;
|
|
3667
|
+
if (Va.has(e)) return !r.codeBlock;
|
|
3668
|
+
switch (e) {
|
|
3669
|
+
case "undo": return n.canUndo;
|
|
3670
|
+
case "redo": return n.canRedo;
|
|
3671
|
+
case "indent": return n.canIndent;
|
|
3672
|
+
case "outdent": return n.canOutdent;
|
|
3673
|
+
case "copy":
|
|
3674
|
+
case "cut": return !n.empty;
|
|
3675
|
+
default: return !0;
|
|
3676
|
+
}
|
|
3677
|
+
}
|
|
3678
|
+
var Ua = (e) => e.tagName.toLowerCase();
|
|
3679
|
+
function* Wa(e) {
|
|
3680
|
+
let t = e;
|
|
3681
|
+
for (; t;) t instanceof Element && (yield t), t = t.parentNode ?? (t instanceof ShadowRoot ? t.host : null);
|
|
3682
|
+
}
|
|
3683
|
+
function Ga(e) {
|
|
3684
|
+
let t = e.getRootNode();
|
|
3685
|
+
return t instanceof ShadowRoot && Ua(t.host) === "nldd-toolbar";
|
|
3686
|
+
}
|
|
3687
|
+
var Q = /* @__PURE__ */ new Set();
|
|
3688
|
+
function Ka(e) {
|
|
3689
|
+
for (let t of e.composedPath()) if (t instanceof Element) {
|
|
3690
|
+
if (Ua(t) === "nldd-text-editor") return null;
|
|
3691
|
+
if (t.hasAttribute(Z)) return Ga(t) ? null : t;
|
|
3692
|
+
}
|
|
3693
|
+
return null;
|
|
3694
|
+
}
|
|
3695
|
+
function qa(e) {
|
|
3696
|
+
for (let t of Wa(e)) {
|
|
3697
|
+
let e = t.getAttribute(Fa);
|
|
3698
|
+
if (e !== null) {
|
|
3699
|
+
if (e === "") return;
|
|
3700
|
+
for (let t of Q) if (t.target.id === e) return t;
|
|
3701
|
+
return;
|
|
3702
|
+
}
|
|
3703
|
+
for (let e of Q) if (e.target === t) return e;
|
|
3704
|
+
}
|
|
3705
|
+
}
|
|
3706
|
+
function Ja(e) {
|
|
3707
|
+
return (t) => {
|
|
3708
|
+
let n = Ka(t);
|
|
3709
|
+
(n && qa(n))?.handle(e, t, n);
|
|
3710
|
+
};
|
|
3711
|
+
}
|
|
3712
|
+
var Ya = [
|
|
3713
|
+
"click",
|
|
3714
|
+
"change",
|
|
3715
|
+
"select",
|
|
3716
|
+
"pointerdown",
|
|
3717
|
+
"keydown"
|
|
3718
|
+
].map((e) => [e, Ja(e)]), Xa = /* @__PURE__ */ new Set(["pointerdown", "keydown"]), Za = class {
|
|
3719
|
+
constructor(e, t) {
|
|
3720
|
+
this.target = e, this.focusText = t, this._listBeforePress = null;
|
|
3721
|
+
}
|
|
3722
|
+
connect() {
|
|
3723
|
+
if (Q.size === 0) for (let [e, t] of Ya) document.addEventListener(e, t, Xa.has(e));
|
|
3724
|
+
Q.add(this);
|
|
3725
|
+
}
|
|
3726
|
+
disconnect() {
|
|
3727
|
+
if (Q.delete(this), Q.size === 0) for (let [e, t] of Ya) document.removeEventListener(e, t, Xa.has(e));
|
|
3728
|
+
}
|
|
3729
|
+
controls() {
|
|
3730
|
+
let e = [...this.target.querySelectorAll(`[${Z}]`)], t = this.target.id, n = t ? [...document.querySelectorAll(`[${Fa}="${CSS.escape(t)}"]`)].flatMap((e) => [...e.hasAttribute(Z) ? [e] : [], ...e.querySelectorAll(`[${Z}]`)]) : [];
|
|
3731
|
+
return [...e, ...n].filter((e) => qa(e) === this);
|
|
3732
|
+
}
|
|
3733
|
+
_run(e) {
|
|
3734
|
+
let [t, n] = Ia(e);
|
|
3735
|
+
t === "setHeading" && this.target.getState().active.codeBlock && this.target.runCommand("codeBlock"), this.target.runCommand(t, n), queueMicrotask(this.focusText);
|
|
3736
|
+
}
|
|
3737
|
+
handle(e, t, n) {
|
|
3738
|
+
let r = Ua(n), [i] = Ia(n.getAttribute(Z));
|
|
3739
|
+
switch (e) {
|
|
3740
|
+
case "pointerdown":
|
|
3741
|
+
case "keydown":
|
|
3742
|
+
if (e === "keydown" && !["Enter", " "].includes(t.key)) return;
|
|
3743
|
+
this._listBeforePress = r === "nldd-segmented-control" ? La(this.target.getState()) : null;
|
|
3744
|
+
return;
|
|
3745
|
+
case "click":
|
|
3746
|
+
if (r === "nldd-menu-item") return;
|
|
3747
|
+
if (r === "nldd-segmented-control") {
|
|
3748
|
+
let e = t.target.closest?.("nldd-segmented-control-item");
|
|
3749
|
+
i === "setList" && e?.value && e.value !== "none" && e.value === this._listBeforePress && this._run("setList:none"), this._listBeforePress = null;
|
|
3750
|
+
return;
|
|
3751
|
+
}
|
|
3752
|
+
this._run(n.getAttribute(Z));
|
|
3753
|
+
return;
|
|
3754
|
+
case "change": {
|
|
3755
|
+
if (r !== "nldd-segmented-control") return;
|
|
3756
|
+
let e = n.value;
|
|
3757
|
+
e && this._run(`${i}:${e}`);
|
|
3758
|
+
return;
|
|
3759
|
+
}
|
|
3760
|
+
case "select": {
|
|
3761
|
+
if (r !== "nldd-menu-item") return;
|
|
3762
|
+
let e = n.getAttribute(Z), [, t] = Ia(e);
|
|
3763
|
+
if (n.getAttribute("type") === "radio" && za(i, t, this.target.getState())) return;
|
|
3764
|
+
this._run(e);
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3767
|
+
}
|
|
3768
|
+
reflect(e = this.target.getState()) {
|
|
3769
|
+
for (let t of this.controls()) {
|
|
3770
|
+
let [n, r] = Ia(t.getAttribute(Z)), i = Ua(t);
|
|
3771
|
+
t.toggleAttribute("disabled", !Ha(n, this.target, e)), i === "nldd-segmented-control" ? n === "setList" && (t.value = La(e)) : (i === "nldd-toggle-button" || i === "nldd-menu-item" || i === "nldd-segmented-control-item") && t.toggleAttribute("selected", za(n, r, e));
|
|
3772
|
+
}
|
|
3773
|
+
}
|
|
3774
|
+
}, Qa = class {
|
|
3775
|
+
constructor(e, t) {
|
|
3776
|
+
this.host = e, this.container = t, this._frame = 0, this._listening = !1, this._gap = 0, this._schedule = () => {
|
|
3777
|
+
this._frame || (this._frame = requestAnimationFrame(() => {
|
|
3778
|
+
this._frame = 0, this.check();
|
|
3779
|
+
}));
|
|
3780
|
+
};
|
|
3781
|
+
}
|
|
3782
|
+
_slot() {
|
|
3783
|
+
return this.container()?.querySelector("slot[name=\"toolbar\"]") ?? null;
|
|
3784
|
+
}
|
|
3785
|
+
update() {
|
|
3786
|
+
let e = this._slot(), t = !(!e || e.hidden) && this.host.hasAttribute("embedded");
|
|
3787
|
+
t || e?.classList.remove("is-stuck"), t && !this._listening ? (this._gap = parseFloat(getComputedStyle(e).getPropertyValue("--_text-editor-stuck-gap")) || 0, document.addEventListener("scroll", this._schedule, {
|
|
3788
|
+
capture: !0,
|
|
3789
|
+
passive: !0
|
|
3790
|
+
}), this._resize = new ResizeObserver(this._schedule), this._resize.observe(this.host), this._listening = !0) : !t && this._listening && this.stop(), this._schedule();
|
|
3791
|
+
}
|
|
3792
|
+
stop() {
|
|
3793
|
+
document.removeEventListener("scroll", this._schedule, { capture: !0 }), this._resize?.disconnect(), cancelAnimationFrame(this._frame), this._frame = 0, this._listening = !1;
|
|
3794
|
+
}
|
|
3795
|
+
check() {
|
|
3796
|
+
let e = this._slot();
|
|
3797
|
+
if (!e || !this._listening) return;
|
|
3798
|
+
let t = e.getBoundingClientRect().top - this.container().getBoundingClientRect().top, n = e.classList.contains("is-stuck") ? this._gap : 0;
|
|
3799
|
+
e.classList.toggle("is-stuck", t > n + .5);
|
|
3800
|
+
}
|
|
3801
|
+
}, $a = class extends _e {
|
|
3381
3802
|
constructor(...e) {
|
|
3382
|
-
super(...e), this.noSpellcheck = !1, this.wrap = !0, this.resize = "auto", this.embedded = !1, this.syntax = "
|
|
3803
|
+
super(...e), this.noSpellcheck = !1, this.wrap = !0, this.resize = "auto", this.embedded = !1, this.syntax = "hidden", this.typeaheads = [], this._mentionTypeahead = ((e) => ({
|
|
3383
3804
|
trigger: "@",
|
|
3384
3805
|
source: (t) => e.mentionSource?.(t) ?? [],
|
|
3385
|
-
insert:
|
|
3806
|
+
insert: He,
|
|
3386
3807
|
get query() {
|
|
3387
3808
|
return e.mentionQuery;
|
|
3388
3809
|
},
|
|
3389
3810
|
get emptyText() {
|
|
3390
3811
|
return e.mentionEmptyText;
|
|
3391
3812
|
}
|
|
3392
|
-
}))(this), this.annotatable = !1, this.annotations = [], this.translations = {}, this.rowsProperty = "--_text-editor-rows", this._wrapCompartment = new
|
|
3813
|
+
}))(this), this.annotatable = !1, this.annotations = [], this.translations = {}, this.rowsProperty = "--_text-editor-rows", this._wrapCompartment = new l(), this._spellcheckCompartment = new l(), this._historyCompartment = new l(), this._syntaxCompartment = new l(), this._toolbar = new Za(this, () => this.view?.focus()), this._stuck = new Qa(this, () => this._container ?? null), this._hasSlottedToolbar = !1, this._labels = null, this._clipboard = new Cr(), this._plainPaste = null, this._lastState = null, this._onMentionPointerDown = (e) => {
|
|
3393
3814
|
let t = e.target?.closest?.(".cm-md-mention-token");
|
|
3394
3815
|
if (!t || !this.view || this.view.state.readOnly) return;
|
|
3395
|
-
let n =
|
|
3816
|
+
let n = tt(this.view.state, this.view.posAtDOM(t));
|
|
3396
3817
|
n && (e.preventDefault(), e.stopPropagation(), this.view.dispatch({ selection: {
|
|
3397
3818
|
anchor: n.from,
|
|
3398
3819
|
head: n.to
|
|
3399
|
-
} }), this.view.focus(), e.button !== 0 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey || this.view.plugin(
|
|
3820
|
+
} }), this.view.focus(), e.button !== 0 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey || this.view.plugin(pi)?.startFor(e, n.from, n.to));
|
|
3400
3821
|
}, this._onAnnotationBadgeClick = (e) => {
|
|
3401
3822
|
let t = e.target?.closest?.(".cm-annotation-badge");
|
|
3402
3823
|
if (!t) return;
|
|
@@ -3414,8 +3835,21 @@ var sa = class extends he {
|
|
|
3414
3835
|
getEditorParent() {
|
|
3415
3836
|
return this._container;
|
|
3416
3837
|
}
|
|
3838
|
+
connectedCallback() {
|
|
3839
|
+
super.connectedCallback(), this._toolbar.connect(), this.hasUpdated && this._stuck.update();
|
|
3840
|
+
}
|
|
3841
|
+
disconnectedCallback() {
|
|
3842
|
+
super.disconnectedCallback(), this._toolbar.disconnect(), this._stuck.stop();
|
|
3843
|
+
}
|
|
3844
|
+
firstUpdated() {
|
|
3845
|
+
super.firstUpdated();
|
|
3846
|
+
let e = this.renderRoot.querySelector("slot[name=\"toolbar\"]");
|
|
3847
|
+
e.addEventListener("slotchange", () => {
|
|
3848
|
+
this._hasSlottedToolbar = e.assignedElements().length > 0, this._toolbar.reflect();
|
|
3849
|
+
});
|
|
3850
|
+
}
|
|
3417
3851
|
_t(e, t) {
|
|
3418
|
-
return
|
|
3852
|
+
return Me(this.translations, je, e, t);
|
|
3419
3853
|
}
|
|
3420
3854
|
_labelSignature() {
|
|
3421
3855
|
return [
|
|
@@ -3430,41 +3864,41 @@ var sa = class extends he {
|
|
|
3430
3864
|
}
|
|
3431
3865
|
buildExtensions() {
|
|
3432
3866
|
return [
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3867
|
+
ne,
|
|
3868
|
+
ln,
|
|
3869
|
+
wn(() => this._typeaheadLists(), (e) => this._onTypeaheadChosen(e), (e) => this._t(e ? "components.text-editor.typeahead-no-results-text" : "components.text-editor.typeahead-start-typing-text"), (e) => e === 1 ? this._t("components.text-editor.typeahead-one-result-text") : this._t("components.text-editor.typeahead-results-text", { count: e })),
|
|
3870
|
+
y.low(si),
|
|
3871
|
+
hr((e, t) => this._t("components.text-editor.annotation-count-label", {
|
|
3438
3872
|
count: e,
|
|
3439
3873
|
noun: this._t(e === 1 ? "components.text-editor.annotation-singular-lowercase" : "components.text-editor.annotation-plural-lowercase"),
|
|
3440
3874
|
quote: t
|
|
3441
3875
|
})),
|
|
3442
|
-
|
|
3443
|
-
|
|
3876
|
+
y.highest(mt((e) => this._t("components.text-editor.open-in-new-tab-label", { url: e }))),
|
|
3877
|
+
Pa({
|
|
3444
3878
|
copy: () => this._t("components.text-editor.copy-code-action"),
|
|
3445
3879
|
success: () => this._t("components.text-editor.code-copy-success-text"),
|
|
3446
3880
|
failure: () => this._t("components.text-editor.code-copy-failure-text")
|
|
3447
3881
|
}),
|
|
3448
|
-
|
|
3882
|
+
Ii({
|
|
3449
3883
|
open: () => this._t("components.text-editor.task-open-label"),
|
|
3450
3884
|
done: () => this._t("components.text-editor.task-done-label")
|
|
3451
3885
|
}),
|
|
3452
|
-
this._historyCompartment.of(
|
|
3886
|
+
this._historyCompartment.of(se()),
|
|
3453
3887
|
r(),
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3888
|
+
xa,
|
|
3889
|
+
Oi,
|
|
3890
|
+
Dr(),
|
|
3457
3891
|
a(),
|
|
3458
|
-
|
|
3459
|
-
|
|
3892
|
+
mi,
|
|
3893
|
+
Zr,
|
|
3460
3894
|
...this.inputExtensions(),
|
|
3461
|
-
this._wrapCompartment.of(this.wrap ?
|
|
3462
|
-
this._spellcheckCompartment.of(this.noSpellcheck ? [] :
|
|
3463
|
-
this._syntaxCompartment.of(this.syntax === "hidden" ?
|
|
3464
|
-
|
|
3895
|
+
this._wrapCompartment.of(this.wrap ? _.lineWrapping : []),
|
|
3896
|
+
this._spellcheckCompartment.of(this.noSpellcheck ? [] : Ln()),
|
|
3897
|
+
this._syntaxCompartment.of(this.syntax === "hidden" ? _a() : []),
|
|
3898
|
+
_.updateListener.of((e) => {
|
|
3465
3899
|
(e.docChanged || e.selectionSet) && this._emitState();
|
|
3466
3900
|
}),
|
|
3467
|
-
|
|
3901
|
+
_.domEventHandlers({
|
|
3468
3902
|
mousedown: (e, t) => {
|
|
3469
3903
|
if (e.detail < 3) return !1;
|
|
3470
3904
|
let n = t.posAtCoords({
|
|
@@ -3480,9 +3914,22 @@ var sa = class extends he {
|
|
|
3480
3914
|
},
|
|
3481
3915
|
cut: (e, t) => (this._clipboard.rememberCut(t), !1),
|
|
3482
3916
|
copy: () => (this._clipboard.forget(), !1),
|
|
3917
|
+
keydown: (e, t) => {
|
|
3918
|
+
if (clearTimeout(this._plainPaste?.timer), this._plainPaste = null, !((e.metaKey || e.ctrlKey) && e.shiftKey && e.code === "KeyV")) return !1;
|
|
3919
|
+
let n = {};
|
|
3920
|
+
return this._plainPaste = n, n.timer = setTimeout(() => {
|
|
3921
|
+
this._plainPaste === n && this.view === t && navigator.clipboard?.readText().then((e) => {
|
|
3922
|
+
this._plainPaste === n && (n.done = !0, this._clipboard.paste(t, e, !0), n.timer = setTimeout(() => {
|
|
3923
|
+
this._plainPaste === n && (this._plainPaste = null);
|
|
3924
|
+
}, 1e3));
|
|
3925
|
+
}, () => {});
|
|
3926
|
+
}, 100), !1;
|
|
3927
|
+
},
|
|
3483
3928
|
paste: (e, t) => {
|
|
3484
|
-
let n =
|
|
3485
|
-
|
|
3929
|
+
let n = this._plainPaste;
|
|
3930
|
+
if (clearTimeout(n?.timer), this._plainPaste = null, n?.done) return e.preventDefault(), !0;
|
|
3931
|
+
let r = !!n, i = e.clipboardData?.getData("text/plain");
|
|
3932
|
+
return i !== void 0 && (this._clipboard.paste(t, i, r), e.preventDefault(), !0);
|
|
3486
3933
|
}
|
|
3487
3934
|
})
|
|
3488
3935
|
];
|
|
@@ -3500,76 +3947,76 @@ var sa = class extends he {
|
|
|
3500
3947
|
};
|
|
3501
3948
|
}
|
|
3502
3949
|
docToValue(e) {
|
|
3503
|
-
return
|
|
3950
|
+
return R(e);
|
|
3504
3951
|
}
|
|
3505
3952
|
beforeChangeCheck(e) {
|
|
3506
|
-
|
|
3953
|
+
At(e);
|
|
3507
3954
|
}
|
|
3508
3955
|
onEditorMounted() {
|
|
3509
3956
|
super.onEditorMounted(), this.view?.contentDOM.addEventListener("pointerdown", this._onMentionPointerDown, !0), this.view?.contentDOM.addEventListener("click", this._onAnnotationBadgeClick), this._syncAnnotations(), this._emitState();
|
|
3510
3957
|
}
|
|
3511
3958
|
updated(e) {
|
|
3512
|
-
if (super.updated(e), import.meta.env?.DEV && e.has("typeaheads") &&
|
|
3513
|
-
let
|
|
3514
|
-
|
|
3959
|
+
if (super.updated(e), (e.has("disabled") || e.has("readonly")) && this._toolbar.reflect(), (e.has("embedded") || e.has("_hasSlottedToolbar")) && this.hasUpdated && this._stuck.update(), import.meta.env?.DEV && e.has("typeaheads") && Ne(this, "invalid-typeahead-query", pn(this.typeaheads)), !this.view) return;
|
|
3960
|
+
let t = this._labelSignature();
|
|
3961
|
+
t !== this._labels && (this._labels !== null && this.view.dispatch({ effects: Pe.of(null) }), this._labels = t), e.has("wrap") && this.reconfigure(this._wrapCompartment, this.wrap ? _.lineWrapping : []), e.has("syntax") && this.reconfigure(this._syntaxCompartment, this.syntax === "hidden" ? _a() : []), e.has("noSpellcheck") && (this.reconfigure(this._spellcheckCompartment, this.noSpellcheck ? [] : Ln()), this._redrawForSpellcheck()), (e.has("annotations") || e.has("annotatable")) && this._syncAnnotations();
|
|
3515
3962
|
}
|
|
3516
3963
|
_syncAnnotations() {
|
|
3517
3964
|
this.view?.dispatch({
|
|
3518
|
-
effects:
|
|
3519
|
-
annotations:
|
|
3965
|
+
effects: Wn.of(this.annotatable ? this.annotations : []),
|
|
3966
|
+
annotations: re.addToHistory.of(!1)
|
|
3520
3967
|
});
|
|
3521
3968
|
}
|
|
3522
3969
|
toggleBold() {
|
|
3523
|
-
this.view &&
|
|
3970
|
+
this.view && W(this.view, "**", "StrongEmphasis");
|
|
3524
3971
|
}
|
|
3525
3972
|
toggleItalic() {
|
|
3526
|
-
this.view &&
|
|
3973
|
+
this.view && W(this.view, "*", "Emphasis");
|
|
3527
3974
|
}
|
|
3528
3975
|
toggleInlineCode() {
|
|
3529
|
-
this.view &&
|
|
3976
|
+
this.view && W(this.view, "`", "InlineCode");
|
|
3530
3977
|
}
|
|
3531
3978
|
toggleStrikethrough() {
|
|
3532
|
-
this.view &&
|
|
3979
|
+
this.view && W(this.view, "~~", "Strikethrough");
|
|
3533
3980
|
}
|
|
3534
3981
|
toggleHeading(e) {
|
|
3535
|
-
this.view &&
|
|
3982
|
+
this.view && Nr(this.view, e);
|
|
3536
3983
|
}
|
|
3537
3984
|
setHeading(e) {
|
|
3538
|
-
this.view &&
|
|
3985
|
+
this.view && Pr(this.view, e);
|
|
3539
3986
|
}
|
|
3540
3987
|
toggleBulletList() {
|
|
3541
|
-
this.view &&
|
|
3988
|
+
this.view && Fr(this.view);
|
|
3542
3989
|
}
|
|
3543
3990
|
toggleTaskList() {
|
|
3544
|
-
this.view &&
|
|
3991
|
+
this.view && Lr(this.view);
|
|
3545
3992
|
}
|
|
3546
3993
|
setList(e) {
|
|
3547
|
-
this.view &&
|
|
3994
|
+
this.view && zr(this.view, e);
|
|
3548
3995
|
}
|
|
3549
3996
|
toggleQuote() {
|
|
3550
|
-
this.view &&
|
|
3997
|
+
this.view && Kr(this.view);
|
|
3551
3998
|
}
|
|
3552
3999
|
toggleLink(e = "") {
|
|
3553
|
-
this.view &&
|
|
4000
|
+
this.view && Jr(this.view, e);
|
|
3554
4001
|
}
|
|
3555
4002
|
toggleCodeBlock() {
|
|
3556
|
-
this.view &&
|
|
4003
|
+
this.view && Yr(this.view);
|
|
3557
4004
|
}
|
|
3558
4005
|
indent() {
|
|
3559
|
-
this.view &&
|
|
4006
|
+
this.view && Vr(this.view);
|
|
3560
4007
|
}
|
|
3561
4008
|
outdent() {
|
|
3562
|
-
this.view &&
|
|
4009
|
+
this.view && Hr(this.view);
|
|
3563
4010
|
}
|
|
3564
4011
|
undo() {
|
|
3565
|
-
this.view && (
|
|
4012
|
+
this.view && (le(this.view), this.view.focus());
|
|
3566
4013
|
}
|
|
3567
4014
|
redo() {
|
|
3568
|
-
this.view && (
|
|
4015
|
+
this.view && (fe(this.view), this.view.focus());
|
|
3569
4016
|
}
|
|
3570
4017
|
clearHistory() {
|
|
3571
4018
|
let e = this.view;
|
|
3572
|
-
e && (e.dispatch({ effects: this._historyCompartment.reconfigure([]) }), e.dispatch({ effects: this._historyCompartment.reconfigure(
|
|
4019
|
+
e && (e.dispatch({ effects: this._historyCompartment.reconfigure([]) }), e.dispatch({ effects: this._historyCompartment.reconfigure(se()) }), this._emitState());
|
|
3573
4020
|
}
|
|
3574
4021
|
async copy() {
|
|
3575
4022
|
if (!this.view || this.view.state.selection.main.empty) return;
|
|
@@ -3601,15 +4048,36 @@ var sa = class extends he {
|
|
|
3601
4048
|
}
|
|
3602
4049
|
insertAtCursor(e) {
|
|
3603
4050
|
if (!this.view || this.view.state.readOnly) return;
|
|
3604
|
-
let t =
|
|
4051
|
+
let t = R(e);
|
|
3605
4052
|
t && this.view.dispatch({
|
|
3606
4053
|
...this.view.state.replaceSelection(t),
|
|
3607
4054
|
userEvent: "input"
|
|
3608
4055
|
}), this.view.focus();
|
|
3609
4056
|
}
|
|
4057
|
+
applyChanges(e) {
|
|
4058
|
+
let t = this.view;
|
|
4059
|
+
if (!t || e.length === 0) return;
|
|
4060
|
+
let n = t.state.doc.toString(), r = z(n), i = n.length - r.length, a = [...e].sort((e, t) => e.from - t.from).map((e) => {
|
|
4061
|
+
let t = Math.max(0, Math.min(e.from, i)), a = Math.max(t, Math.min(e.to ?? t, i)), o = V(r, t), s = t === a ? o : V(r, a);
|
|
4062
|
+
for (; s > o && n[s - 1] === "";) s--;
|
|
4063
|
+
return {
|
|
4064
|
+
from: o,
|
|
4065
|
+
to: s,
|
|
4066
|
+
insert: R(e.insert ?? "")
|
|
4067
|
+
};
|
|
4068
|
+
});
|
|
4069
|
+
t.dispatch({
|
|
4070
|
+
changes: a,
|
|
4071
|
+
annotations: [re.remote.of(!0), re.addToHistory.of(!1)]
|
|
4072
|
+
});
|
|
4073
|
+
}
|
|
4074
|
+
setDoc(e) {
|
|
4075
|
+
let t = this.view, n = t && p(R(t.state.doc.toString()), e);
|
|
4076
|
+
n && this.applyChanges([n]);
|
|
4077
|
+
}
|
|
3610
4078
|
replaceRange(e, t, n) {
|
|
3611
4079
|
if (!this.view || this.view.state.readOnly) return;
|
|
3612
|
-
let r = this.view.state.doc.toString(), i =
|
|
4080
|
+
let r = this.view.state.doc.toString(), i = z(r), a = r.length - i.length, o = Math.max(0, Math.min(e, a)), s = Math.max(o, Math.min(t, a)), c = R(n), l = V(i, o), u = V(i, s);
|
|
3613
4081
|
this.view.dispatch({
|
|
3614
4082
|
changes: {
|
|
3615
4083
|
from: l,
|
|
@@ -3680,17 +4148,17 @@ var sa = class extends he {
|
|
|
3680
4148
|
case "paste":
|
|
3681
4149
|
this.paste();
|
|
3682
4150
|
break;
|
|
3683
|
-
default:
|
|
4151
|
+
default: Ne(this, "unknown-command", !0);
|
|
3684
4152
|
}
|
|
3685
4153
|
}
|
|
3686
4154
|
getState() {
|
|
3687
4155
|
return {
|
|
3688
|
-
active: this.view ?
|
|
4156
|
+
active: this.view ? Xr(this.view) : { ...Or },
|
|
3689
4157
|
empty: !this.view || this.view.state.selection.main.empty,
|
|
3690
|
-
canIndent: this.view ?
|
|
3691
|
-
canOutdent: this.view ?
|
|
3692
|
-
canUndo: this.view ?
|
|
3693
|
-
canRedo: this.view ?
|
|
4158
|
+
canIndent: this.view ? Ur(this.view) : !1,
|
|
4159
|
+
canOutdent: this.view ? Wr(this.view) : !1,
|
|
4160
|
+
canUndo: this.view ? ue(this.view.state) > 0 : !1,
|
|
4161
|
+
canRedo: this.view ? ve(this.view.state) > 0 : !1
|
|
3694
4162
|
};
|
|
3695
4163
|
}
|
|
3696
4164
|
getSelection() {
|
|
@@ -3702,11 +4170,11 @@ var sa = class extends he {
|
|
|
3702
4170
|
empty: !0,
|
|
3703
4171
|
rect: null
|
|
3704
4172
|
};
|
|
3705
|
-
let t = e.state.doc.toString(), n = e.state.selection.main, r =
|
|
4173
|
+
let t = e.state.doc.toString(), n = e.state.selection.main, r = B(t, n.from), i = B(t, n.to), a = e.coordsAtPos(n.from), o = e.coordsAtPos(n.to), s = a && o ? new DOMRect(Math.min(a.left, o.left), Math.min(a.top, o.top), Math.max(a.right, o.right) - Math.min(a.left, o.left), Math.max(a.bottom, o.bottom) - Math.min(a.top, o.top)) : null;
|
|
3706
4174
|
return {
|
|
3707
4175
|
start: r,
|
|
3708
4176
|
end: i,
|
|
3709
|
-
quote:
|
|
4177
|
+
quote: R(t).slice(r, i),
|
|
3710
4178
|
empty: n.empty,
|
|
3711
4179
|
rect: s
|
|
3712
4180
|
};
|
|
@@ -3714,8 +4182,8 @@ var sa = class extends he {
|
|
|
3714
4182
|
getAnnotations() {
|
|
3715
4183
|
let e = this.view;
|
|
3716
4184
|
if (!e) return [];
|
|
3717
|
-
let t =
|
|
3718
|
-
return
|
|
4185
|
+
let t = R(e.state.doc.toString());
|
|
4186
|
+
return Jn(e.state).map((e) => ({
|
|
3719
4187
|
id: e.id,
|
|
3720
4188
|
start: e.from,
|
|
3721
4189
|
end: e.to,
|
|
@@ -3724,7 +4192,7 @@ var sa = class extends he {
|
|
|
3724
4192
|
}
|
|
3725
4193
|
_emitState() {
|
|
3726
4194
|
let e = this.getState(), t = this._lastState;
|
|
3727
|
-
t && t.empty === e.empty && t.canIndent === e.canIndent && t.canOutdent === e.canOutdent && t.canUndo === e.canUndo && t.canRedo === e.canRedo && Object.keys(e.active).every((n) => t.active[n] === e.active[n]) || (this._lastState = e, this.dispatchEvent(new CustomEvent("state-change", {
|
|
4195
|
+
t && t.empty === e.empty && t.canIndent === e.canIndent && t.canOutdent === e.canOutdent && t.canUndo === e.canUndo && t.canRedo === e.canRedo && Object.keys(e.active).every((n) => t.active[n] === e.active[n]) || (this._lastState = e, this._toolbar.reflect(e), this.dispatchEvent(new CustomEvent("state-change", {
|
|
3728
4196
|
detail: e,
|
|
3729
4197
|
bubbles: !0,
|
|
3730
4198
|
composed: !0
|
|
@@ -3735,21 +4203,21 @@ var sa = class extends he {
|
|
|
3735
4203
|
}
|
|
3736
4204
|
_onTypeaheadChosen(e) {
|
|
3737
4205
|
if (!this.view) return;
|
|
3738
|
-
let t = this.view.state.doc.toString(), n =
|
|
4206
|
+
let t = this.view.state.doc.toString(), n = B(t, e.from);
|
|
3739
4207
|
if (e.typeahead === this._mentionTypeahead) {
|
|
3740
4208
|
let { id: t, text: r } = e.candidate;
|
|
3741
4209
|
this._emitMention({
|
|
3742
4210
|
id: t,
|
|
3743
4211
|
text: r,
|
|
3744
4212
|
from: n,
|
|
3745
|
-
to: n +
|
|
4213
|
+
to: n + Ve(e.candidate).length
|
|
3746
4214
|
});
|
|
3747
4215
|
} else this.dispatchEvent(new CustomEvent("typeahead", {
|
|
3748
4216
|
detail: {
|
|
3749
4217
|
trigger: e.trigger,
|
|
3750
4218
|
candidate: e.candidate,
|
|
3751
4219
|
from: n,
|
|
3752
|
-
to:
|
|
4220
|
+
to: B(t, e.to)
|
|
3753
4221
|
},
|
|
3754
4222
|
bubbles: !0,
|
|
3755
4223
|
composed: !0
|
|
@@ -3763,27 +4231,27 @@ var sa = class extends he {
|
|
|
3763
4231
|
}));
|
|
3764
4232
|
}
|
|
3765
4233
|
render() {
|
|
3766
|
-
return
|
|
4234
|
+
return Ca(this);
|
|
3767
4235
|
}
|
|
3768
|
-
}, $ = (
|
|
3769
|
-
|
|
4236
|
+
}, $ = ($a.styles = Sa, $a);
|
|
4237
|
+
C([S({
|
|
3770
4238
|
type: Boolean,
|
|
3771
4239
|
reflect: !0,
|
|
3772
4240
|
attribute: "no-spellcheck"
|
|
3773
|
-
})], $.prototype, "noSpellcheck", void 0),
|
|
4241
|
+
})], $.prototype, "noSpellcheck", void 0), C([S({
|
|
3774
4242
|
type: Boolean,
|
|
3775
4243
|
reflect: !0
|
|
3776
|
-
})], $.prototype, "wrap", void 0),
|
|
4244
|
+
})], $.prototype, "wrap", void 0), C([S({
|
|
3777
4245
|
reflect: !0,
|
|
3778
|
-
converter:
|
|
3779
|
-
})], $.prototype, "resize", void 0),
|
|
4246
|
+
converter: oe("auto")
|
|
4247
|
+
})], $.prototype, "resize", void 0), C([S({
|
|
3780
4248
|
type: Boolean,
|
|
3781
4249
|
reflect: !0
|
|
3782
|
-
})], $.prototype, "embedded", void 0),
|
|
4250
|
+
})], $.prototype, "embedded", void 0), C([S({
|
|
3783
4251
|
reflect: !0,
|
|
3784
|
-
converter:
|
|
3785
|
-
})], $.prototype, "syntax", void 0),
|
|
4252
|
+
converter: oe("hidden")
|
|
4253
|
+
})], $.prototype, "syntax", void 0), C([S({ attribute: !1 })], $.prototype, "mentionSource", void 0), C([S({ attribute: !1 })], $.prototype, "mentionQuery", void 0), C([S({ attribute: !1 })], $.prototype, "mentionEmptyText", void 0), C([S({ attribute: !1 })], $.prototype, "typeaheads", void 0), C([S({
|
|
3786
4254
|
type: Boolean,
|
|
3787
4255
|
reflect: !0
|
|
3788
|
-
})], $.prototype, "annotatable", void 0),
|
|
3789
|
-
export {
|
|
4256
|
+
})], $.prototype, "annotatable", void 0), C([S({ attribute: !1 })], $.prototype, "annotations", void 0), C([S({ type: Object })], $.prototype, "translations", void 0), C([we(".text-editor")], $.prototype, "_container", void 0), C([ae()], $.prototype, "_hasSlottedToolbar", void 0), $ = C([Ce("nldd-text-editor")], $);
|
|
4257
|
+
export { un as DEFAULT_TYPEAHEAD_QUERY, $ as NLDDTextEditor };
|