@novaprose/core 0.6.0 → 0.8.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/README.md +20 -4
- package/dist/a11y.cjs +314 -0
- package/dist/a11y.cjs.map +1 -0
- package/dist/a11y.d.cts +51 -0
- package/dist/a11y.d.ts +51 -0
- package/dist/a11y.js +11 -0
- package/dist/a11y.js.map +1 -0
- package/dist/a11ychecker-7KQU7DD3.js +449 -0
- package/dist/a11ychecker-7KQU7DD3.js.map +1 -0
- package/dist/accordion-ui-FGN3I5UF.js +201 -0
- package/dist/accordion-ui-FGN3I5UF.js.map +1 -0
- package/dist/advcode-65Z2ELUB.js +51 -0
- package/dist/advcode-65Z2ELUB.js.map +1 -0
- package/dist/advcode-editor-WIOCY552.js +257 -0
- package/dist/advcode-editor-WIOCY552.js.map +1 -0
- package/dist/{advlist-K2U3VPH2.js → advlist-CEHE6YXS.js} +14 -20
- package/dist/advlist-CEHE6YXS.js.map +1 -0
- package/dist/advtable-ui-5CBOPTHW.js +364 -0
- package/dist/advtable-ui-5CBOPTHW.js.map +1 -0
- package/dist/ai-IRQYZHRK.js +1485 -0
- package/dist/ai-IRQYZHRK.js.map +1 -0
- package/dist/anchor-ui-NWIIRKGY.js +81 -0
- package/dist/anchor-ui-NWIIRKGY.js.map +1 -0
- package/dist/autocorrect-6GFLVDPC.js +851 -0
- package/dist/autocorrect-6GFLVDPC.js.map +1 -0
- package/dist/{autolink-XWDTLY37.js → autolink-N427KVQO.js} +13 -7
- package/dist/autolink-N427KVQO.js.map +1 -0
- package/dist/{autoresize-UB3GOA6D.js → autoresize-YRZAVCNO.js} +2 -2
- package/dist/autoresize-YRZAVCNO.js.map +1 -0
- package/dist/{autosave-MWNRUNU3.js → autosave-L7OZ3KLK.js} +9 -13
- package/dist/autosave-L7OZ3KLK.js.map +1 -0
- package/dist/casechange-5G6RAJ7K.js +201 -0
- package/dist/casechange-5G6RAJ7K.js.map +1 -0
- package/dist/{charmap-ADLYOIB3.js → charmap-5CBBDWOP.js} +9 -14
- package/dist/charmap-5CBBDWOP.js.map +1 -0
- package/dist/checklist-HM4VXZKY.js +189 -0
- package/dist/checklist-HM4VXZKY.js.map +1 -0
- package/dist/chunk-23ZLVT5D.js +163 -0
- package/dist/chunk-23ZLVT5D.js.map +1 -0
- package/dist/chunk-3BOK3S3T.js +26 -0
- package/dist/chunk-3BOK3S3T.js.map +1 -0
- package/dist/chunk-4I4AYH2K.js +101 -0
- package/dist/chunk-4I4AYH2K.js.map +1 -0
- package/dist/chunk-4VPDY3LF.js +27 -0
- package/dist/chunk-4VPDY3LF.js.map +1 -0
- package/dist/chunk-53AY5NAF.js +214 -0
- package/dist/chunk-53AY5NAF.js.map +1 -0
- package/dist/chunk-5VCESSQB.js +137 -0
- package/dist/chunk-5VCESSQB.js.map +1 -0
- package/dist/chunk-66INZHZ2.js +79 -0
- package/dist/chunk-66INZHZ2.js.map +1 -0
- package/dist/chunk-6LQM7G4V.js +159 -0
- package/dist/chunk-6LQM7G4V.js.map +1 -0
- package/dist/chunk-6YSQGFV7.js +893 -0
- package/dist/chunk-6YSQGFV7.js.map +1 -0
- package/dist/{chunk-GHEFKKRC.js → chunk-AC3YCAX4.js} +108 -29
- package/dist/chunk-AC3YCAX4.js.map +1 -0
- package/dist/{chunk-NPKAIW34.js → chunk-ADRPQLZ2.js} +50 -1
- package/dist/chunk-ADRPQLZ2.js.map +1 -0
- package/dist/chunk-ANE5ASXG.js +26 -0
- package/dist/chunk-ANE5ASXG.js.map +1 -0
- package/dist/{chunk-Z3ELZ77W.js → chunk-AP2PJFLB.js} +5 -2
- package/dist/chunk-AP2PJFLB.js.map +1 -0
- package/dist/chunk-AQV6FIKK.js +259 -0
- package/dist/chunk-AQV6FIKK.js.map +1 -0
- package/dist/chunk-AUQSATWL.js +322 -0
- package/dist/chunk-AUQSATWL.js.map +1 -0
- package/dist/chunk-C326LHHU.js +143 -0
- package/dist/chunk-C326LHHU.js.map +1 -0
- package/dist/chunk-DEYYVZ7O.js +393 -0
- package/dist/chunk-DEYYVZ7O.js.map +1 -0
- package/dist/chunk-EOJ5XHKA.js +160 -0
- package/dist/chunk-EOJ5XHKA.js.map +1 -0
- package/dist/chunk-EXX2S352.js +3642 -0
- package/dist/chunk-EXX2S352.js.map +1 -0
- package/dist/chunk-FTEA6L2Q.js +47 -0
- package/dist/chunk-FTEA6L2Q.js.map +1 -0
- package/dist/chunk-G74HNSB6.js +9 -0
- package/dist/chunk-G74HNSB6.js.map +1 -0
- package/dist/chunk-GHVB6SV4.js +177 -0
- package/dist/chunk-GHVB6SV4.js.map +1 -0
- package/dist/chunk-GTLE2HEW.js +108 -0
- package/dist/chunk-GTLE2HEW.js.map +1 -0
- package/dist/chunk-GXXXLPDQ.js +67 -0
- package/dist/chunk-GXXXLPDQ.js.map +1 -0
- package/dist/chunk-HC6RMBAD.js +163 -0
- package/dist/chunk-HC6RMBAD.js.map +1 -0
- package/dist/chunk-HNEAVVBC.js +98 -0
- package/dist/chunk-HNEAVVBC.js.map +1 -0
- package/dist/chunk-I7Y4KSM2.js +165 -0
- package/dist/chunk-I7Y4KSM2.js.map +1 -0
- package/dist/chunk-IG2BL4ON.js +127 -0
- package/dist/chunk-IG2BL4ON.js.map +1 -0
- package/dist/chunk-J6W2CDRF.js +425 -0
- package/dist/chunk-J6W2CDRF.js.map +1 -0
- package/dist/chunk-LVEQBNLX.js +207 -0
- package/dist/chunk-LVEQBNLX.js.map +1 -0
- package/dist/chunk-MZGNOHSY.js +176 -0
- package/dist/chunk-MZGNOHSY.js.map +1 -0
- package/dist/chunk-N32H37AJ.js +373 -0
- package/dist/chunk-N32H37AJ.js.map +1 -0
- package/dist/chunk-NTGEKGXU.js +263 -0
- package/dist/chunk-NTGEKGXU.js.map +1 -0
- package/dist/chunk-OFHGXYG3.js +140 -0
- package/dist/chunk-OFHGXYG3.js.map +1 -0
- package/dist/chunk-OOVNE6MB.js +28 -0
- package/dist/chunk-OOVNE6MB.js.map +1 -0
- package/dist/chunk-OQMMHWMZ.js +7 -0
- package/dist/chunk-OQMMHWMZ.js.map +1 -0
- package/dist/chunk-P2UU2NLT.js +1149 -0
- package/dist/chunk-P2UU2NLT.js.map +1 -0
- package/dist/{chunk-HZRIBOPW.js → chunk-QU3KXMYT.js} +45 -3
- package/dist/chunk-QU3KXMYT.js.map +1 -0
- package/dist/chunk-S2XZRKHA.js +29 -0
- package/dist/chunk-S2XZRKHA.js.map +1 -0
- package/dist/chunk-SCIRO4XK.js +144 -0
- package/dist/chunk-SCIRO4XK.js.map +1 -0
- package/dist/chunk-T3IRLTKK.js +158 -0
- package/dist/chunk-T3IRLTKK.js.map +1 -0
- package/dist/chunk-TABIUD2L.js +66 -0
- package/dist/chunk-TABIUD2L.js.map +1 -0
- package/dist/{chunk-7ON7PR5R.js → chunk-TAM2FHKG.js} +374 -52
- package/dist/chunk-TAM2FHKG.js.map +1 -0
- package/dist/chunk-UTMS2P2K.js +288 -0
- package/dist/chunk-UTMS2P2K.js.map +1 -0
- package/dist/{chunk-HPLT3XRZ.js → chunk-V7WUHUHM.js} +13 -1
- package/dist/chunk-V7WUHUHM.js.map +1 -0
- package/dist/chunk-VK6YF2AA.js +359 -0
- package/dist/chunk-VK6YF2AA.js.map +1 -0
- package/dist/chunk-WAOU5NGN.js +430 -0
- package/dist/chunk-WAOU5NGN.js.map +1 -0
- package/dist/chunk-XIH4SCO6.js +112 -0
- package/dist/chunk-XIH4SCO6.js.map +1 -0
- package/dist/chunk-XR7CY4NI.js +11 -0
- package/dist/chunk-XR7CY4NI.js.map +1 -0
- package/dist/chunk-YDF55N6Z.js +164 -0
- package/dist/chunk-YDF55N6Z.js.map +1 -0
- package/dist/chunk-YDPZCVXS.js +923 -0
- package/dist/chunk-YDPZCVXS.js.map +1 -0
- package/dist/chunk-YG5V7POU.js +137 -0
- package/dist/chunk-YG5V7POU.js.map +1 -0
- package/dist/chunk-YVSUR7E5.js +151 -0
- package/dist/chunk-YVSUR7E5.js.map +1 -0
- package/dist/codesample-GHWIC7PT.js +546 -0
- package/dist/codesample-GHWIC7PT.js.map +1 -0
- package/dist/{comments-panel-FYJE3U64.js → comments-panel-SOLBZ46Q.js} +12 -6
- package/dist/comments-panel-SOLBZ46Q.js.map +1 -0
- package/dist/{directionality-XOHJFSL6.js → directionality-EGQKGDZA.js} +16 -11
- package/dist/directionality-EGQKGDZA.js.map +1 -0
- package/dist/document-0ft41E6d.d.ts +39 -0
- package/dist/document-IQqDDT4v.d.cts +39 -0
- package/dist/docx.cjs +23518 -0
- package/dist/docx.cjs.map +1 -0
- package/dist/docx.d.cts +83 -0
- package/dist/docx.d.ts +83 -0
- package/dist/docx.js +1821 -0
- package/dist/docx.js.map +1 -0
- package/dist/draghandle-U6CYZHPA.js +389 -0
- package/dist/draghandle-U6CYZHPA.js.map +1 -0
- package/dist/editimage-5EWPSM22.js +683 -0
- package/dist/editimage-5EWPSM22.js.map +1 -0
- package/dist/editor-BCMxe1M4.d.cts +2888 -0
- package/dist/editor-Dmtwjw2u.d.ts +2888 -0
- package/dist/email-ELNMEQ6E.js +177 -0
- package/dist/email-ELNMEQ6E.js.map +1 -0
- package/dist/email.cjs +588 -0
- package/dist/email.cjs.map +1 -0
- package/dist/email.d.cts +7 -0
- package/dist/email.d.ts +7 -0
- package/dist/email.js +21 -0
- package/dist/email.js.map +1 -0
- package/dist/{emoticons-TP4N4ZGY.js → emoticons-EGHNZKSA.js} +9 -14
- package/dist/emoticons-EGHNZKSA.js.map +1 -0
- package/dist/exportpdf-4P7X3NY2.js +91 -0
- package/dist/exportpdf-4P7X3NY2.js.map +1 -0
- package/dist/exportword-JFJ3KTYZ.js +16 -0
- package/dist/exportword-JFJ3KTYZ.js.map +1 -0
- package/dist/footnotes-ui-FV6QRGDA.js +449 -0
- package/dist/footnotes-ui-FV6QRGDA.js.map +1 -0
- package/dist/form-dialog-SNWFPM2K.js +379 -0
- package/dist/form-dialog-SNWFPM2K.js.map +1 -0
- package/dist/formatpainter-IEXX27OJ.js +209 -0
- package/dist/formatpainter-IEXX27OJ.js.map +1 -0
- package/dist/fullpagehtml-ui-RE4C2NO5.js +220 -0
- package/dist/fullpagehtml-ui-RE4C2NO5.js.map +1 -0
- package/dist/html-rules-api-BLDDW9MO.d.cts +42 -0
- package/dist/html-rules-api-BLDDW9MO.d.ts +42 -0
- package/dist/html-rules.cjs +482 -0
- package/dist/html-rules.cjs.map +1 -0
- package/dist/html-rules.d.cts +89 -0
- package/dist/html-rules.d.ts +89 -0
- package/dist/html-rules.js +417 -0
- package/dist/html-rules.js.map +1 -0
- package/dist/i18n/de.cjs +670 -0
- package/dist/i18n/de.cjs.map +1 -0
- package/dist/i18n/de.d.cts +9 -0
- package/dist/i18n/de.d.ts +9 -0
- package/dist/i18n/de.js +649 -0
- package/dist/i18n/de.js.map +1 -0
- package/dist/i18n/es.cjs +670 -0
- package/dist/i18n/es.cjs.map +1 -0
- package/dist/i18n/es.d.cts +9 -0
- package/dist/i18n/es.d.ts +9 -0
- package/dist/i18n/es.js +649 -0
- package/dist/i18n/es.js.map +1 -0
- package/dist/i18n/fr.cjs +670 -0
- package/dist/i18n/fr.cjs.map +1 -0
- package/dist/i18n/fr.d.cts +9 -0
- package/dist/i18n/fr.d.ts +9 -0
- package/dist/i18n/fr.js +649 -0
- package/dist/i18n/fr.js.map +1 -0
- package/dist/i18n/it.cjs +670 -0
- package/dist/i18n/it.cjs.map +1 -0
- package/dist/i18n/it.d.cts +9 -0
- package/dist/i18n/it.d.ts +9 -0
- package/dist/i18n/it.js +649 -0
- package/dist/i18n/it.js.map +1 -0
- package/dist/i18n/pt-BR.cjs +670 -0
- package/dist/i18n/pt-BR.cjs.map +1 -0
- package/dist/i18n/pt-BR.d.cts +9 -0
- package/dist/i18n/pt-BR.d.ts +9 -0
- package/dist/i18n/pt-BR.js +649 -0
- package/dist/i18n/pt-BR.js.map +1 -0
- package/dist/i18n/ru.cjs +670 -0
- package/dist/i18n/ru.cjs.map +1 -0
- package/dist/i18n/ru.d.cts +10 -0
- package/dist/i18n/ru.d.ts +10 -0
- package/dist/i18n/ru.js +649 -0
- package/dist/i18n/ru.js.map +1 -0
- package/dist/importcss-JLNIRKGH.js +127 -0
- package/dist/importcss-JLNIRKGH.js.map +1 -0
- package/dist/importword-D7Z6RXGQ.js +73 -0
- package/dist/importword-D7Z6RXGQ.js.map +1 -0
- package/dist/index-CZ9yDvmQ.d.cts +235 -0
- package/dist/index-CZ9yDvmQ.d.ts +235 -0
- package/dist/index.cjs +29531 -10134
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +160 -1828
- package/dist/index.d.ts +160 -1828
- package/dist/index.js +212 -1480
- package/dist/index.js.map +1 -1
- package/dist/{insertdatetime-T4SEMQWP.js → insertdatetime-YW2VHYZH.js} +10 -16
- package/dist/insertdatetime-YW2VHYZH.js.map +1 -0
- package/dist/linkchecker-3S3MCPOS.js +287 -0
- package/dist/linkchecker-3S3MCPOS.js.map +1 -0
- package/dist/markdown-26O3N3T2.js +136 -0
- package/dist/markdown-26O3N3T2.js.map +1 -0
- package/dist/markdown.cjs +356 -0
- package/dist/markdown.cjs.map +1 -0
- package/dist/markdown.d.cts +25 -0
- package/dist/markdown.d.ts +25 -0
- package/dist/markdown.js +10 -0
- package/dist/markdown.js.map +1 -0
- package/dist/math-ui-RUTCHTRY.js +157 -0
- package/dist/math-ui-RUTCHTRY.js.map +1 -0
- package/dist/media-ui-36TE3CJD.js +123 -0
- package/dist/media-ui-36TE3CJD.js.map +1 -0
- package/dist/mediaembed-ui-ZNTGZ2SQ.js +207 -0
- package/dist/mediaembed-ui-ZNTGZ2SQ.js.map +1 -0
- package/dist/mentions-ui-O4IPWQT4.js +58 -0
- package/dist/mentions-ui-O4IPWQT4.js.map +1 -0
- package/dist/mergetags-ui-HS3Q2R36.js +73 -0
- package/dist/mergetags-ui-HS3Q2R36.js.map +1 -0
- package/dist/{nonbreaking-HG5HV6AL.js → nonbreaking-GYRUH4UO.js} +10 -9
- package/dist/nonbreaking-GYRUH4UO.js.map +1 -0
- package/dist/pagebreak-ui-I4ZPYK3U.js +50 -0
- package/dist/pagebreak-ui-I4ZPYK3U.js.map +1 -0
- package/dist/pageembed-ui-WOY6VWRJ.js +172 -0
- package/dist/pageembed-ui-WOY6VWRJ.js.map +1 -0
- package/dist/pagelayout-ui-Y2IM7FJQ.js +236 -0
- package/dist/pagelayout-ui-Y2IM7FJQ.js.map +1 -0
- package/dist/paste-office-3A6KWKCV.js +520 -0
- package/dist/paste-office-3A6KWKCV.js.map +1 -0
- package/dist/permanentpen-6D5LLKFX.js +206 -0
- package/dist/permanentpen-6D5LLKFX.js.map +1 -0
- package/dist/print-MZMLQIQX.js +178 -0
- package/dist/print-MZMLQIQX.js.map +1 -0
- package/dist/{quickbars-4NU4SIPL.js → quickbars-UZ2Q67TX.js} +24 -12
- package/dist/quickbars-UZ2Q67TX.js.map +1 -0
- package/dist/{revisionhistory-3YQPLPLM.js → revisionhistory-ACRB23HL.js} +48 -173
- package/dist/revisionhistory-ACRB23HL.js.map +1 -0
- package/dist/save-72ZLF6AO.js +120 -0
- package/dist/save-72ZLF6AO.js.map +1 -0
- package/dist/search-bar-HTZQNPD3.js +212 -0
- package/dist/search-bar-HTZQNPD3.js.map +1 -0
- package/dist/spellchecker-DJ7SP5JY.js +474 -0
- package/dist/spellchecker-DJ7SP5JY.js.map +1 -0
- package/dist/suggestions-panel-RJXC4LCM.js +596 -0
- package/dist/suggestions-panel-RJXC4LCM.js.map +1 -0
- package/dist/suggestions-ui-PODMNH7D.js +395 -0
- package/dist/suggestions-ui-PODMNH7D.js.map +1 -0
- package/dist/table-OBHE465Y.js +54 -0
- package/dist/table-OBHE465Y.js.map +1 -0
- package/dist/table-dialogs-UMIIZQYE.js +119 -0
- package/dist/table-dialogs-UMIIZQYE.js.map +1 -0
- package/dist/tableofcontents-ui-U2PYNPX6.js +167 -0
- package/dist/tableofcontents-ui-U2PYNPX6.js.map +1 -0
- package/dist/template-YYC2MGVH.js +278 -0
- package/dist/template-YYC2MGVH.js.map +1 -0
- package/dist/typography-EQUXUXIN.js +399 -0
- package/dist/typography-EQUXUXIN.js.map +1 -0
- package/dist/upload.cjs +160 -0
- package/dist/upload.cjs.map +1 -0
- package/dist/upload.d.cts +72 -0
- package/dist/upload.d.ts +72 -0
- package/dist/upload.js +132 -0
- package/dist/upload.js.map +1 -0
- package/dist/{visualblocks-RTAYJOGR.js → visualblocks-O5QW7ZDT.js} +10 -9
- package/dist/visualblocks-O5QW7ZDT.js.map +1 -0
- package/dist/visualchars-UQFRWQPE.js +134 -0
- package/dist/visualchars-UQFRWQPE.js.map +1 -0
- package/package.json +96 -6
- package/src/style.css +440 -508
- package/dist/advlist-K2U3VPH2.js.map +0 -1
- package/dist/autolink-XWDTLY37.js.map +0 -1
- package/dist/autoresize-UB3GOA6D.js.map +0 -1
- package/dist/autosave-MWNRUNU3.js.map +0 -1
- package/dist/charmap-ADLYOIB3.js.map +0 -1
- package/dist/chunk-435CRWKA.js +0 -983
- package/dist/chunk-435CRWKA.js.map +0 -1
- package/dist/chunk-46RIM5KP.js +0 -5949
- package/dist/chunk-46RIM5KP.js.map +0 -1
- package/dist/chunk-6RJENZXT.js +0 -104
- package/dist/chunk-6RJENZXT.js.map +0 -1
- package/dist/chunk-7ON7PR5R.js.map +0 -1
- package/dist/chunk-GHEFKKRC.js.map +0 -1
- package/dist/chunk-HPLT3XRZ.js.map +0 -1
- package/dist/chunk-HZRIBOPW.js.map +0 -1
- package/dist/chunk-NPKAIW34.js.map +0 -1
- package/dist/chunk-Z3ELZ77W.js.map +0 -1
- package/dist/comments-panel-FYJE3U64.js.map +0 -1
- package/dist/directionality-XOHJFSL6.js.map +0 -1
- package/dist/emoticons-TP4N4ZGY.js.map +0 -1
- package/dist/insertdatetime-T4SEMQWP.js.map +0 -1
- package/dist/nonbreaking-HG5HV6AL.js.map +0 -1
- package/dist/quickbars-4NU4SIPL.js.map +0 -1
- package/dist/revisionhistory-3YQPLPLM.js.map +0 -1
- package/dist/visualblocks-RTAYJOGR.js.map +0 -1
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import {
|
|
2
|
+
definePlugin
|
|
3
|
+
} from "./chunk-V7WUHUHM.js";
|
|
4
|
+
import {
|
|
5
|
+
h
|
|
6
|
+
} from "./chunk-QU3KXMYT.js";
|
|
7
|
+
import {
|
|
8
|
+
isSafeImageUrl,
|
|
9
|
+
isSafeLinkUrl
|
|
10
|
+
} from "./chunk-4VPDY3LF.js";
|
|
11
|
+
|
|
12
|
+
// src/plugins/mediaembed.ts
|
|
13
|
+
import { Plugin } from "prosemirror-state";
|
|
14
|
+
var CLASS_RE = /^[\w-]{1,60}$/;
|
|
15
|
+
function mediaEmbedOptions(context) {
|
|
16
|
+
const raw = context.options.pluginOptions?.mediaembed ?? {};
|
|
17
|
+
const maxWidth = Number(raw.maxWidth);
|
|
18
|
+
return {
|
|
19
|
+
className: typeof raw.className === "string" && CLASS_RE.test(raw.className) ? raw.className : "nova-card",
|
|
20
|
+
inlineStyles: raw.inlineStyles !== false,
|
|
21
|
+
maxWidth: Number.isFinite(maxWidth) && maxWidth >= 200 ? Math.min(2e3, Math.round(maxWidth)) : 650
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function cardText(value, max) {
|
|
25
|
+
return typeof value === "string" ? value.replace(/\s+/g, " ").trim().slice(0, max) : "";
|
|
26
|
+
}
|
|
27
|
+
function cardHref(value) {
|
|
28
|
+
if (typeof value !== "string") return null;
|
|
29
|
+
const href = value.trim();
|
|
30
|
+
return /^https?:\/\/[^\s/?#]/i.test(href) && href.length <= 2e3 && isSafeLinkUrl(href) ? href : null;
|
|
31
|
+
}
|
|
32
|
+
function cardImage(value) {
|
|
33
|
+
if (typeof value !== "string") return null;
|
|
34
|
+
const src = value.trim();
|
|
35
|
+
return /^https?:\/\/[^\s/?#]/i.test(src) && src.length <= 2e3 && isSafeImageUrl(src) ? src : null;
|
|
36
|
+
}
|
|
37
|
+
function hostOf(href) {
|
|
38
|
+
try {
|
|
39
|
+
return new URL(href).hostname.replace(/^www\./, "");
|
|
40
|
+
} catch {
|
|
41
|
+
return "";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function cardFields(attrs) {
|
|
45
|
+
const href = cardHref(attrs.href);
|
|
46
|
+
return {
|
|
47
|
+
href,
|
|
48
|
+
title: cardText(attrs.title, 300) || (href ? hostOf(href) : ""),
|
|
49
|
+
description: cardText(attrs.description, 500),
|
|
50
|
+
image: cardImage(attrs.image),
|
|
51
|
+
site: cardText(attrs.site, 100) || (href ? hostOf(href) : ""),
|
|
52
|
+
author: cardText(attrs.author, 100)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function buildNodes(context) {
|
|
56
|
+
const settings = mediaEmbedOptions(context);
|
|
57
|
+
const prefixes = [.../* @__PURE__ */ new Set([settings.className, "nova-card", "ephox-summary-card"])];
|
|
58
|
+
const part = (el, name) => el.querySelector(prefixes.map((p) => `.${p}-${name}`).join(", "));
|
|
59
|
+
return {
|
|
60
|
+
link_card: {
|
|
61
|
+
group: "block",
|
|
62
|
+
atom: true,
|
|
63
|
+
selectable: true,
|
|
64
|
+
draggable: true,
|
|
65
|
+
attrs: {
|
|
66
|
+
href: { default: "" },
|
|
67
|
+
title: { default: "" },
|
|
68
|
+
description: { default: "" },
|
|
69
|
+
image: { default: "" },
|
|
70
|
+
site: { default: "" },
|
|
71
|
+
author: { default: "" }
|
|
72
|
+
},
|
|
73
|
+
parseDOM: [
|
|
74
|
+
{
|
|
75
|
+
tag: "a, div",
|
|
76
|
+
// Before links (marks) and plain blocks.
|
|
77
|
+
priority: 70,
|
|
78
|
+
getAttrs: (dom) => {
|
|
79
|
+
const el = dom;
|
|
80
|
+
if (!prefixes.some((p) => el.classList.contains(p))) return false;
|
|
81
|
+
const href = cardHref(
|
|
82
|
+
el.getAttribute("href") ?? el.querySelector("a[href]")?.getAttribute("href")
|
|
83
|
+
);
|
|
84
|
+
if (!href) return false;
|
|
85
|
+
const thumbnail = part(el, "thumbnail");
|
|
86
|
+
const image = thumbnail?.getAttribute("src") ?? thumbnail?.querySelector("img")?.getAttribute("src") ?? "";
|
|
87
|
+
return {
|
|
88
|
+
href,
|
|
89
|
+
title: cardText(part(el, "title")?.textContent, 300),
|
|
90
|
+
description: cardText(part(el, "description")?.textContent, 500),
|
|
91
|
+
image: cardImage(image) ?? "",
|
|
92
|
+
site: cardText(part(el, "website")?.textContent, 100),
|
|
93
|
+
author: cardText(part(el, "author")?.textContent, 100)
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
toDOM: (node) => cardDOM(node, settings)
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
var style = (settings, css) => settings.inlineStyles ? css : null;
|
|
103
|
+
function cardDOM(node, settings) {
|
|
104
|
+
const f = cardFields(node.attrs);
|
|
105
|
+
const p = settings.className;
|
|
106
|
+
if (!f.href) return ["div", { class: p }, f.title];
|
|
107
|
+
const muted = "display: block; opacity: 0.75; font-size: 0.875em";
|
|
108
|
+
const text = [
|
|
109
|
+
[
|
|
110
|
+
"span",
|
|
111
|
+
{ class: `${p}-title`, style: style(settings, "display: block; font-weight: 600") },
|
|
112
|
+
f.title
|
|
113
|
+
]
|
|
114
|
+
];
|
|
115
|
+
if (f.description)
|
|
116
|
+
text.push([
|
|
117
|
+
"span",
|
|
118
|
+
{ class: `${p}-description`, style: style(settings, muted) },
|
|
119
|
+
f.description
|
|
120
|
+
]);
|
|
121
|
+
text.push(["span", { class: `${p}-website`, style: style(settings, muted) }, f.site]);
|
|
122
|
+
if (f.author)
|
|
123
|
+
text.push(["span", { class: `${p}-author`, style: style(settings, muted) }, f.author]);
|
|
124
|
+
return [
|
|
125
|
+
"a",
|
|
126
|
+
{
|
|
127
|
+
class: p,
|
|
128
|
+
href: f.href,
|
|
129
|
+
rel: "noopener noreferrer",
|
|
130
|
+
style: style(
|
|
131
|
+
settings,
|
|
132
|
+
`display: flex; flex-wrap: wrap; gap: 12px; max-width: ${settings.maxWidth}px; margin: 0.5em 0; padding: 12px; border: 1px solid rgb(127 127 127 / 0.35); border-radius: 8px; color: inherit; text-decoration: none; overflow: hidden`
|
|
133
|
+
)
|
|
134
|
+
},
|
|
135
|
+
...f.image ? [
|
|
136
|
+
[
|
|
137
|
+
"img",
|
|
138
|
+
{
|
|
139
|
+
class: `${p}-thumbnail`,
|
|
140
|
+
src: f.image,
|
|
141
|
+
alt: "",
|
|
142
|
+
loading: "lazy",
|
|
143
|
+
style: style(
|
|
144
|
+
settings,
|
|
145
|
+
"flex: none; width: 120px; height: 90px; object-fit: cover; border-radius: 4px"
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
] : [],
|
|
150
|
+
// Narrower than 180px beside the picture (a phone), the text goes under it.
|
|
151
|
+
["span", { style: style(settings, "display: block; flex: 1 1 180px; min-width: 0") }, ...text]
|
|
152
|
+
];
|
|
153
|
+
}
|
|
154
|
+
function cardView(node, settings) {
|
|
155
|
+
const dom = h("div", { className: "nova-card-view", contenteditable: "false" });
|
|
156
|
+
dom.style.maxWidth = `${settings.maxWidth}px`;
|
|
157
|
+
const render = (current) => {
|
|
158
|
+
const f = cardFields(current.attrs);
|
|
159
|
+
dom.replaceChildren(
|
|
160
|
+
...f.image ? [h("img", { className: "nova-card-view-image", src: f.image, alt: "" })] : [],
|
|
161
|
+
h(
|
|
162
|
+
"div",
|
|
163
|
+
{ className: "nova-card-view-text" },
|
|
164
|
+
h("div", { className: "nova-card-view-title" }, f.title),
|
|
165
|
+
f.description ? h("div", { className: "nova-card-view-description" }, f.description) : null,
|
|
166
|
+
h(
|
|
167
|
+
"div",
|
|
168
|
+
{ className: "nova-card-view-site" },
|
|
169
|
+
[f.site, f.author].filter(Boolean).join(" \xB7 ")
|
|
170
|
+
)
|
|
171
|
+
)
|
|
172
|
+
);
|
|
173
|
+
dom.title = f.href ?? "";
|
|
174
|
+
};
|
|
175
|
+
render(node);
|
|
176
|
+
return {
|
|
177
|
+
dom,
|
|
178
|
+
update(next) {
|
|
179
|
+
if (next.type !== node.type) return false;
|
|
180
|
+
node = next;
|
|
181
|
+
render(next);
|
|
182
|
+
return true;
|
|
183
|
+
},
|
|
184
|
+
ignoreMutation: () => true,
|
|
185
|
+
stopEvent: () => false
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
var mediaembed_default = definePlugin({
|
|
189
|
+
name: "mediaembed",
|
|
190
|
+
nodes: buildNodes,
|
|
191
|
+
prosemirrorPlugins: (editor) => {
|
|
192
|
+
const settings = mediaEmbedOptions(editor);
|
|
193
|
+
return [
|
|
194
|
+
new Plugin({ props: { nodeViews: { link_card: (node) => cardView(node, settings) } } })
|
|
195
|
+
];
|
|
196
|
+
},
|
|
197
|
+
load: () => import("./mediaembed-ui-ZNTGZ2SQ.js")
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
export {
|
|
201
|
+
cardText,
|
|
202
|
+
cardHref,
|
|
203
|
+
cardImage,
|
|
204
|
+
cardFields,
|
|
205
|
+
mediaembed_default
|
|
206
|
+
};
|
|
207
|
+
//# sourceMappingURL=chunk-LVEQBNLX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugins/mediaembed.ts"],"sourcesContent":["import type { DOMOutputSpec, Node as PMNode, NodeSpec } from 'prosemirror-model';\nimport { Plugin } from 'prosemirror-state';\nimport type { Editor } from '../editor';\nimport { definePlugin } from '../plugins';\nimport { h } from '../ui/dom';\nimport { isSafeImageUrl, isSafeLinkUrl } from '../url';\n\n/**\n * The mediaembed plugin: a link to a page becomes a card with its title, description, picture and\n * site, from your service (`resolve` or `serviceUrl`); a video link becomes a player (the media\n * plugin). Here are the card node and its view; asking the service and the buttons are in\n * mediaembed-ui.ts.\n *\n * Security: nothing from the service is put in as HTML. The card is built from text, its address\n * and picture are checked like any link and image, when parsing, from JSON and on output.\n */\n\nexport interface MediaEmbedOptions {\n /**\n * Your service: what a page is (its title, description, picture, site), through your server.\n * null when nothing is known about it: the link stays a link.\n */\n resolve?: (url: string, signal: AbortSignal) => Promise<EmbedInfo | null | undefined>;\n /** When `resolve` isn't given: a server that answers POST { url } with an EmbedInfo (or null). */\n serviceUrl?: string;\n /** The widest a card gets, in pixels (650). */\n maxWidth?: number;\n /** The card's look as inline styles too, so the page that shows it needs no CSS (yes). */\n inlineStyles?: boolean;\n /** The card's class; its parts get \"-title\", \"-description\", \"-thumbnail\", \"-website\", \"-author\". */\n className?: string;\n}\n\n/** What the service says about a page. Everything is optional; unknown fields are ignored. */\nexport interface EmbedInfo {\n /** 'video': a player (`video` is its address); 'photo': a picture (`image`); otherwise a card. */\n type?: 'link' | 'video' | 'photo' | 'rich';\n title?: string;\n description?: string;\n /** A picture for the card (or the photo itself). */\n image?: string;\n /** The site's name. */\n site?: string;\n author?: string;\n /** For a video: the player's address (YouTube, Vimeo or a video file). */\n video?: string;\n}\n\nconst CLASS_RE = /^[\\w-]{1,60}$/;\n\nexport function mediaEmbedOptions(context: { options: Editor['options'] }) {\n const raw = (context.options.pluginOptions?.mediaembed ?? {}) as MediaEmbedOptions;\n const maxWidth = Number(raw.maxWidth);\n return {\n className:\n typeof raw.className === 'string' && CLASS_RE.test(raw.className)\n ? raw.className\n : 'nova-card',\n inlineStyles: raw.inlineStyles !== false,\n maxWidth:\n Number.isFinite(maxWidth) && maxWidth >= 200 ? Math.min(2000, Math.round(maxWidth)) : 650,\n };\n}\n\ntype Settings = ReturnType<typeof mediaEmbedOptions>;\n\n/** A text field from anywhere (JSON, a service): a string, trimmed and cut to a sane length. */\nexport function cardText(value: unknown, max: number): string {\n return typeof value === 'string' ? value.replace(/\\s+/g, ' ').trim().slice(0, max) : '';\n}\n\n/** A card's address: an absolute http(s) link. */\nexport function cardHref(value: unknown): string | null {\n if (typeof value !== 'string') return null;\n const href = value.trim();\n return /^https?:\\/\\/[^\\s/?#]/i.test(href) && href.length <= 2000 && isSafeLinkUrl(href)\n ? href\n : null;\n}\n\n/** A card's picture: an absolute http(s) image address. */\nexport function cardImage(value: unknown): string | null {\n if (typeof value !== 'string') return null;\n const src = value.trim();\n return /^https?:\\/\\/[^\\s/?#]/i.test(src) && src.length <= 2000 && isSafeImageUrl(src)\n ? src\n : null;\n}\n\nexport function hostOf(href: string): string {\n try {\n return new URL(href).hostname.replace(/^www\\./, '');\n } catch {\n return '';\n }\n}\n\n/** The card's fields, checked: what a node from JSON (or a service) holds may be anything. */\nexport function cardFields(attrs: Record<string, unknown>) {\n const href = cardHref(attrs.href);\n return {\n href,\n title: cardText(attrs.title, 300) || (href ? hostOf(href) : ''),\n description: cardText(attrs.description, 500),\n image: cardImage(attrs.image),\n site: cardText(attrs.site, 100) || (href ? hostOf(href) : ''),\n author: cardText(attrs.author, 100),\n };\n}\n\ntype Part = 'title' | 'description' | 'thumbnail' | 'website' | 'author';\n\nfunction buildNodes(context: { options: Editor['options'] }): Record<string, NodeSpec> {\n const settings = mediaEmbedOptions(context);\n const prefixes = [...new Set([settings.className, 'nova-card', 'ephox-summary-card'])];\n /** A part of a card element, by its class (any of the known prefixes). */\n const part = (el: HTMLElement, name: Part) =>\n el.querySelector<HTMLElement>(prefixes.map((p) => `.${p}-${name}`).join(', '));\n return {\n link_card: {\n group: 'block',\n atom: true,\n selectable: true,\n draggable: true,\n attrs: {\n href: { default: '' },\n title: { default: '' },\n description: { default: '' },\n image: { default: '' },\n site: { default: '' },\n author: { default: '' },\n },\n parseDOM: [\n {\n tag: 'a, div',\n // Before links (marks) and plain blocks.\n priority: 70,\n getAttrs: (dom) => {\n const el = dom as HTMLElement;\n if (!prefixes.some((p) => el.classList.contains(p))) return false;\n const href = cardHref(\n el.getAttribute('href') ?? el.querySelector('a[href]')?.getAttribute('href'),\n );\n if (!href) return false;\n const thumbnail = part(el, 'thumbnail');\n const image =\n thumbnail?.getAttribute('src') ??\n thumbnail?.querySelector('img')?.getAttribute('src') ??\n '';\n return {\n href,\n title: cardText(part(el, 'title')?.textContent, 300),\n description: cardText(part(el, 'description')?.textContent, 500),\n image: cardImage(image) ?? '',\n site: cardText(part(el, 'website')?.textContent, 100),\n author: cardText(part(el, 'author')?.textContent, 100),\n };\n },\n },\n ],\n toDOM: (node) => cardDOM(node, settings),\n },\n };\n}\n\nconst style = (settings: Settings, css: string) => (settings.inlineStyles ? css : null);\n\n/** The card's HTML: a link holding a picture, the title, the description and the site. */\nfunction cardDOM(node: PMNode, settings: Settings): DOMOutputSpec {\n const f = cardFields(node.attrs);\n const p = settings.className;\n // A card that lost its address (JSON) is just its text.\n if (!f.href) return ['div', { class: p }, f.title];\n const muted = 'display: block; opacity: 0.75; font-size: 0.875em';\n const text: DOMOutputSpec[] = [\n [\n 'span',\n { class: `${p}-title`, style: style(settings, 'display: block; font-weight: 600') },\n f.title,\n ],\n ];\n if (f.description)\n text.push([\n 'span',\n { class: `${p}-description`, style: style(settings, muted) },\n f.description,\n ]);\n text.push(['span', { class: `${p}-website`, style: style(settings, muted) }, f.site]);\n if (f.author)\n text.push(['span', { class: `${p}-author`, style: style(settings, muted) }, f.author]);\n return [\n 'a',\n {\n class: p,\n href: f.href,\n rel: 'noopener noreferrer',\n style: style(\n settings,\n `display: flex; flex-wrap: wrap; gap: 12px; max-width: ${settings.maxWidth}px; margin: 0.5em 0; padding: 12px; ` +\n 'border: 1px solid rgb(127 127 127 / 0.35); border-radius: 8px; color: inherit; text-decoration: none; overflow: hidden',\n ),\n },\n ...((f.image\n ? [\n [\n 'img',\n {\n class: `${p}-thumbnail`,\n src: f.image,\n alt: '',\n loading: 'lazy',\n style: style(\n settings,\n 'flex: none; width: 120px; height: 90px; object-fit: cover; border-radius: 4px',\n ),\n },\n ],\n ]\n : []) as DOMOutputSpec[]),\n // Narrower than 180px beside the picture (a phone), the text goes under it.\n ['span', { style: style(settings, 'display: block; flex: 1 1 180px; min-width: 0') }, ...text],\n ] as DOMOutputSpec;\n}\n\n/** The card in the editor: the same look, without a working link (a click selects it). */\nfunction cardView(node: PMNode, settings: Settings) {\n const dom = h('div', { className: 'nova-card-view', contenteditable: 'false' });\n dom.style.maxWidth = `${settings.maxWidth}px`;\n const render = (current: PMNode) => {\n const f = cardFields(current.attrs);\n dom.replaceChildren(\n ...(f.image ? [h('img', { className: 'nova-card-view-image', src: f.image, alt: '' })] : []),\n h(\n 'div',\n { className: 'nova-card-view-text' },\n h('div', { className: 'nova-card-view-title' }, f.title),\n f.description ? h('div', { className: 'nova-card-view-description' }, f.description) : null,\n h(\n 'div',\n { className: 'nova-card-view-site' },\n [f.site, f.author].filter(Boolean).join(' · '),\n ),\n ),\n );\n dom.title = f.href ?? '';\n };\n render(node);\n return {\n dom,\n update(next: PMNode) {\n if (next.type !== node.type) return false;\n node = next;\n render(next);\n return true;\n },\n ignoreMutation: () => true,\n stopEvent: () => false,\n };\n}\n\nexport default definePlugin({\n name: 'mediaembed',\n nodes: buildNodes,\n prosemirrorPlugins: (editor) => {\n const settings = mediaEmbedOptions(editor);\n return [\n new Plugin({ props: { nodeViews: { link_card: (node) => cardView(node, settings) } } }),\n ];\n },\n load: () => import('./mediaembed-ui'),\n});\n"],"mappings":";;;;;;;;;;;;AACA,SAAS,cAAc;AA+CvB,IAAM,WAAW;AAEV,SAAS,kBAAkB,SAAyC;AACzE,QAAM,MAAO,QAAQ,QAAQ,eAAe,cAAc,CAAC;AAC3D,QAAM,WAAW,OAAO,IAAI,QAAQ;AACpC,SAAO;AAAA,IACL,WACE,OAAO,IAAI,cAAc,YAAY,SAAS,KAAK,IAAI,SAAS,IAC5D,IAAI,YACJ;AAAA,IACN,cAAc,IAAI,iBAAiB;AAAA,IACnC,UACE,OAAO,SAAS,QAAQ,KAAK,YAAY,MAAM,KAAK,IAAI,KAAM,KAAK,MAAM,QAAQ,CAAC,IAAI;AAAA,EAC1F;AACF;AAKO,SAAS,SAAS,OAAgB,KAAqB;AAC5D,SAAO,OAAO,UAAU,WAAW,MAAM,QAAQ,QAAQ,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG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M,QAAQ,EAAE,EAAE,EAAE,CAAC;AAAA,IACxF;AAAA,EACF;AAAA,EACA,MAAM,MAAM,OAAO,6BAAiB;AACtC,CAAC;","names":[]}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import {
|
|
2
|
+
icons
|
|
3
|
+
} from "./chunk-ADRPQLZ2.js";
|
|
4
|
+
import {
|
|
5
|
+
FOCUSABLE,
|
|
6
|
+
activeElement,
|
|
7
|
+
h,
|
|
8
|
+
icon,
|
|
9
|
+
listenDocument,
|
|
10
|
+
uniqueId
|
|
11
|
+
} from "./chunk-QU3KXMYT.js";
|
|
12
|
+
|
|
13
|
+
// src/ui/dialog.ts
|
|
14
|
+
function openDialog(options) {
|
|
15
|
+
const titleId = uniqueId("nova-dialog-title");
|
|
16
|
+
const error = h("p", { className: "nova-dialog-error", role: "alert", hidden: true });
|
|
17
|
+
const submit = h(
|
|
18
|
+
"button",
|
|
19
|
+
{ type: "submit", className: "nova-button nova-button-primary", hidden: !options.submitLabel },
|
|
20
|
+
options.submitLabel ?? ""
|
|
21
|
+
);
|
|
22
|
+
const cancel = h("button", { type: "button", className: "nova-button" }, options.cancelLabel);
|
|
23
|
+
const closeButton = h(
|
|
24
|
+
"button",
|
|
25
|
+
{ type: "button", className: "nova-btn nova-dialog-close", "aria-label": options.closeLabel },
|
|
26
|
+
icon(icons.close)
|
|
27
|
+
);
|
|
28
|
+
const form = h(
|
|
29
|
+
"form",
|
|
30
|
+
{
|
|
31
|
+
className: options.size === "large" ? "nova-dialog nova-dialog-large" : "nova-dialog",
|
|
32
|
+
role: "dialog",
|
|
33
|
+
"aria-modal": "true",
|
|
34
|
+
"aria-labelledby": titleId,
|
|
35
|
+
novalidate: true
|
|
36
|
+
},
|
|
37
|
+
h(
|
|
38
|
+
"header",
|
|
39
|
+
{ className: "nova-dialog-header" },
|
|
40
|
+
h("h2", { id: titleId }, options.title),
|
|
41
|
+
closeButton
|
|
42
|
+
),
|
|
43
|
+
h("div", { className: "nova-dialog-body" }, options.body, error),
|
|
44
|
+
h("footer", { className: "nova-dialog-footer" }, cancel, submit)
|
|
45
|
+
);
|
|
46
|
+
const backdrop = h("div", { className: "nova-dialog-backdrop" }, form);
|
|
47
|
+
options.host.append(backdrop);
|
|
48
|
+
let closed = false;
|
|
49
|
+
const close = () => {
|
|
50
|
+
if (closed) return;
|
|
51
|
+
closed = true;
|
|
52
|
+
backdrop.remove();
|
|
53
|
+
stopKeepFocus();
|
|
54
|
+
options.onClose?.();
|
|
55
|
+
options.returnFocus?.();
|
|
56
|
+
};
|
|
57
|
+
const setError = (message) => {
|
|
58
|
+
error.hidden = !message;
|
|
59
|
+
error.textContent = message ?? "";
|
|
60
|
+
};
|
|
61
|
+
const setBusy = (busy) => {
|
|
62
|
+
submit.disabled = busy;
|
|
63
|
+
form.setAttribute("aria-busy", String(busy));
|
|
64
|
+
};
|
|
65
|
+
form.addEventListener("submit", async (event) => {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
setError(null);
|
|
68
|
+
setBusy(true);
|
|
69
|
+
try {
|
|
70
|
+
const result = options.onSubmit ? await options.onSubmit() : true;
|
|
71
|
+
if (typeof result === "string") setError(result);
|
|
72
|
+
else if (result !== false) close();
|
|
73
|
+
} finally {
|
|
74
|
+
if (!closed) setBusy(false);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
cancel.addEventListener("click", close);
|
|
78
|
+
closeButton.addEventListener("click", close);
|
|
79
|
+
backdrop.addEventListener("mousedown", (event) => {
|
|
80
|
+
if (event.target === backdrop) close();
|
|
81
|
+
});
|
|
82
|
+
form.addEventListener("keydown", (event) => {
|
|
83
|
+
if (event.key === "Escape" && !event.defaultPrevented) {
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
event.stopPropagation();
|
|
86
|
+
close();
|
|
87
|
+
} else if (event.key === "Tab") {
|
|
88
|
+
const focusable = [...form.querySelectorAll(FOCUSABLE)].filter(
|
|
89
|
+
(el) => !el.hidden
|
|
90
|
+
);
|
|
91
|
+
const first2 = focusable[0];
|
|
92
|
+
const last = focusable[focusable.length - 1];
|
|
93
|
+
if (!first2 || !last) return;
|
|
94
|
+
if (event.shiftKey && activeElement(form) === first2) {
|
|
95
|
+
event.preventDefault();
|
|
96
|
+
last.focus();
|
|
97
|
+
} else if (!event.shiftKey && activeElement(form) === last) {
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
first2.focus();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
form.tabIndex = -1;
|
|
104
|
+
form.addEventListener("click", () => {
|
|
105
|
+
if (!closed && !form.contains(activeElement(form))) form.focus({ preventScroll: true });
|
|
106
|
+
});
|
|
107
|
+
const stopKeepFocus = listenDocument(form, "focusin", (_event, target) => {
|
|
108
|
+
const other = target instanceof Element && target.closest(".nova-dialog") !== null;
|
|
109
|
+
if (!form.contains(target) && !other) {
|
|
110
|
+
(form.querySelector(FOCUSABLE) ?? form).focus();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
const first = options.initialFocus ?? form.querySelector(".nova-dialog-body input, .nova-dialog-body textarea");
|
|
114
|
+
(first ?? (options.submitLabel ? submit : cancel)).focus();
|
|
115
|
+
return { el: form, close, setError, setBusy };
|
|
116
|
+
}
|
|
117
|
+
function textField(options) {
|
|
118
|
+
const id = uniqueId("nova-field");
|
|
119
|
+
const hintId = options.hint ? `${id}-hint` : void 0;
|
|
120
|
+
const input = h("input", {
|
|
121
|
+
id,
|
|
122
|
+
type: options.type ?? "text",
|
|
123
|
+
className: "nova-input",
|
|
124
|
+
value: options.value ?? "",
|
|
125
|
+
placeholder: options.placeholder,
|
|
126
|
+
required: options.required ?? false,
|
|
127
|
+
autocomplete: options.autocomplete ?? "off",
|
|
128
|
+
spellcheck: "false",
|
|
129
|
+
"aria-describedby": hintId
|
|
130
|
+
});
|
|
131
|
+
input.value = options.value ?? "";
|
|
132
|
+
const el = h(
|
|
133
|
+
"div",
|
|
134
|
+
{ className: "nova-field" },
|
|
135
|
+
h("label", { for: id, className: "nova-label" }, options.label),
|
|
136
|
+
input,
|
|
137
|
+
options.hint ? h("p", { id: hintId, className: "nova-hint" }, options.hint) : null
|
|
138
|
+
);
|
|
139
|
+
return { el, input };
|
|
140
|
+
}
|
|
141
|
+
function checkboxField(label, checked = false) {
|
|
142
|
+
const id = uniqueId("nova-check");
|
|
143
|
+
const input = h("input", { id, type: "checkbox", className: "nova-checkbox" });
|
|
144
|
+
input.checked = checked;
|
|
145
|
+
const el = h(
|
|
146
|
+
"div",
|
|
147
|
+
{ className: "nova-field nova-field-inline" },
|
|
148
|
+
input,
|
|
149
|
+
h("label", { for: id }, label)
|
|
150
|
+
);
|
|
151
|
+
return { el, input };
|
|
152
|
+
}
|
|
153
|
+
function selectField(options) {
|
|
154
|
+
const id = uniqueId("nova-field");
|
|
155
|
+
const select = h(
|
|
156
|
+
"select",
|
|
157
|
+
{ id, className: "nova-input nova-select" },
|
|
158
|
+
...options.options.map((o) => h("option", { value: o.value }, o.label))
|
|
159
|
+
);
|
|
160
|
+
select.value = options.value;
|
|
161
|
+
const el = h(
|
|
162
|
+
"div",
|
|
163
|
+
{ className: "nova-field" },
|
|
164
|
+
h("label", { for: id, className: "nova-label" }, options.label),
|
|
165
|
+
select
|
|
166
|
+
);
|
|
167
|
+
return { el, select };
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export {
|
|
171
|
+
openDialog,
|
|
172
|
+
textField,
|
|
173
|
+
checkboxField,
|
|
174
|
+
selectField
|
|
175
|
+
};
|
|
176
|
+
//# sourceMappingURL=chunk-MZGNOHSY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ui/dialog.ts"],"sourcesContent":["import { activeElement, FOCUSABLE, h, icon, listenDocument, uniqueId } from './dom';\nimport { icons } from './icons';\n\nexport interface DialogOptions {\n host: HTMLElement;\n title: string;\n body: HTMLElement;\n /** Without submitLabel the dialog is informational: the footer has only the cancelLabel button (\"Close\"). */\n submitLabel?: string;\n cancelLabel: string;\n closeLabel: string;\n /** Return false (or an error message) to keep the dialog open. */\n onSubmit?: () => boolean | string | void | Promise<boolean | string | void>;\n /** large — for the preview and the HTML source. */\n size?: 'normal' | 'large';\n onClose?: () => void;\n /** Where focus returns after closing. */\n returnFocus?: () => void;\n /** The element that gets focus on opening (the first field by default). */\n initialFocus?: HTMLElement;\n}\n\nexport interface DialogHandle {\n el: HTMLElement;\n close(): void;\n setError(message: string | null): void;\n setBusy(busy: boolean): void;\n}\n\n/**\n * A modal dialog: focus trap, Escape, focus return, Enter submits the form.\n * On narrow screens CSS turns it into a bottom sheet.\n */\nexport function openDialog(options: DialogOptions): DialogHandle {\n const titleId = uniqueId('nova-dialog-title');\n const error = h('p', { className: 'nova-dialog-error', role: 'alert', hidden: true });\n const submit = h(\n 'button',\n { type: 'submit', className: 'nova-button nova-button-primary', hidden: !options.submitLabel },\n options.submitLabel ?? '',\n );\n const cancel = h('button', { type: 'button', className: 'nova-button' }, options.cancelLabel);\n const closeButton = h(\n 'button',\n { type: 'button', className: 'nova-btn nova-dialog-close', 'aria-label': options.closeLabel },\n icon(icons.close),\n );\n\n const form = h(\n 'form',\n {\n className: options.size === 'large' ? 'nova-dialog nova-dialog-large' : 'nova-dialog',\n role: 'dialog',\n 'aria-modal': 'true',\n 'aria-labelledby': titleId,\n novalidate: true,\n },\n h(\n 'header',\n { className: 'nova-dialog-header' },\n h('h2', { id: titleId }, options.title),\n closeButton,\n ),\n h('div', { className: 'nova-dialog-body' }, options.body, error),\n h('footer', { className: 'nova-dialog-footer' }, cancel, submit),\n );\n const backdrop = h('div', { className: 'nova-dialog-backdrop' }, form);\n options.host.append(backdrop);\n\n let closed = false;\n const close = () => {\n if (closed) return;\n closed = true;\n backdrop.remove();\n stopKeepFocus();\n options.onClose?.();\n options.returnFocus?.();\n };\n\n const setError = (message: string | null) => {\n error.hidden = !message;\n error.textContent = message ?? '';\n };\n\n const setBusy = (busy: boolean) => {\n submit.disabled = busy;\n form.setAttribute('aria-busy', String(busy));\n };\n\n form.addEventListener('submit', async (event) => {\n event.preventDefault();\n setError(null);\n setBusy(true);\n try {\n const result = options.onSubmit ? await options.onSubmit() : true;\n if (typeof result === 'string') setError(result);\n else if (result !== false) close();\n } finally {\n if (!closed) setBusy(false);\n }\n });\n cancel.addEventListener('click', close);\n closeButton.addEventListener('click', close);\n backdrop.addEventListener('mousedown', (event) => {\n if (event.target === backdrop) close();\n });\n\n form.addEventListener('keydown', (event) => {\n // An Escape a field inside used itself (the code editor closing its search) leaves the dialog open.\n if (event.key === 'Escape' && !event.defaultPrevented) {\n event.preventDefault();\n event.stopPropagation();\n close();\n } else if (event.key === 'Tab') {\n const focusable = [...form.querySelectorAll<HTMLElement>(FOCUSABLE)].filter(\n (el) => !el.hidden,\n );\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n if (!first || !last) return;\n if (event.shiftKey && activeElement(form) === first) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && activeElement(form) === last) {\n event.preventDefault();\n first.focus();\n }\n }\n });\n\n // Safari doesn't focus a button or a radio on a click: focus falls to the page itself (no focusin),\n // where Escape and Tab no longer reach the dialog. A click inside keeps focus in the dialog.\n form.tabIndex = -1;\n form.addEventListener('click', () => {\n if (!closed && !form.contains(activeElement(form))) form.focus({ preventScroll: true });\n });\n\n // If focus still leaves (a click outside, programmatic focus), it is returned to the dialog.\n // The real target, inside a shadow root too (for a listener on document it is replaced by the host).\n const stopKeepFocus = listenDocument(form, 'focusin', (_event, target) => {\n // Another dialog (of another editor on the page) keeps its focus: two would pull it back and forth.\n const other = target instanceof Element && target.closest('.nova-dialog') !== null;\n if (!form.contains(target) && !other) {\n (form.querySelector<HTMLElement>(FOCUSABLE) ?? form).focus();\n }\n });\n\n const first =\n options.initialFocus ??\n form.querySelector<HTMLElement>('.nova-dialog-body input, .nova-dialog-body textarea');\n // Without input fields, focus goes to a visible button (submit may be hidden in informational dialogs).\n (first ?? (options.submitLabel ? submit : cancel)).focus();\n\n return { el: form, close, setError, setBusy };\n}\n\n// ---------- form fields ----------\n\nexport interface TextFieldOptions {\n label: string;\n value?: string;\n type?: 'text' | 'url';\n placeholder?: string;\n hint?: string;\n required?: boolean;\n autocomplete?: string;\n}\n\nexport function textField(options: TextFieldOptions): { el: HTMLElement; input: HTMLInputElement } {\n const id = uniqueId('nova-field');\n const hintId = options.hint ? `${id}-hint` : undefined;\n const input = h('input', {\n id,\n type: options.type ?? 'text',\n className: 'nova-input',\n value: options.value ?? '',\n placeholder: options.placeholder,\n required: options.required ?? false,\n autocomplete: options.autocomplete ?? 'off',\n spellcheck: 'false',\n 'aria-describedby': hintId,\n });\n input.value = options.value ?? '';\n const el = h(\n 'div',\n { className: 'nova-field' },\n h('label', { for: id, className: 'nova-label' }, options.label),\n input,\n options.hint ? h('p', { id: hintId, className: 'nova-hint' }, options.hint) : null,\n );\n return { el, input };\n}\n\nexport function checkboxField(\n label: string,\n checked = false,\n): { el: HTMLElement; input: HTMLInputElement } {\n const id = uniqueId('nova-check');\n const input = h('input', { id, type: 'checkbox', className: 'nova-checkbox' });\n input.checked = checked;\n const el = h(\n 'div',\n { className: 'nova-field nova-field-inline' },\n input,\n h('label', { for: id }, label),\n );\n return { el, input };\n}\n\nexport interface SelectFieldOptions {\n label: string;\n value: string;\n options: { value: string; label: string }[];\n}\n\n/** A drop-down list with a label, for property dialogs. */\nexport function selectField(options: SelectFieldOptions): {\n el: HTMLElement;\n select: HTMLSelectElement;\n} {\n const id = uniqueId('nova-field');\n const select = h(\n 'select',\n { id, className: 'nova-input nova-select' },\n ...options.options.map((o) => h('option', { value: o.value }, o.label)),\n );\n select.value = options.value;\n const el = h(\n 'div',\n { className: 'nova-field' },\n h('label', { for: id, className: 'nova-label' }, options.label),\n select,\n );\n return { el, select };\n}\n"],"mappings":";;;;;;;;;;;;;AAiCO,SAAS,WAAW,SAAsC;AAC/D,QAAM,UAAU,SAAS,mBAAmB;AAC5C,QAAM,QAAQ,EAAE,KAAK,EAAE,WA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