@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,393 @@
|
|
|
1
|
+
import {
|
|
2
|
+
activeElement,
|
|
3
|
+
h,
|
|
4
|
+
logicalKey
|
|
5
|
+
} from "./chunk-QU3KXMYT.js";
|
|
6
|
+
|
|
7
|
+
// src/i18n/en.ts
|
|
8
|
+
var en = {
|
|
9
|
+
"toolbar.label": "Formatting",
|
|
10
|
+
"toolbar.options": "options",
|
|
11
|
+
"editor.label": "Rich text editor",
|
|
12
|
+
"editor.required": "Please fill in this field.",
|
|
13
|
+
undo: "Undo",
|
|
14
|
+
redo: "Redo",
|
|
15
|
+
bold: "Bold",
|
|
16
|
+
italic: "Italic",
|
|
17
|
+
underline: "Underline",
|
|
18
|
+
strike: "Strikethrough",
|
|
19
|
+
code: "Inline code",
|
|
20
|
+
subscript: "Subscript",
|
|
21
|
+
superscript: "Superscript",
|
|
22
|
+
link: "Link",
|
|
23
|
+
unlink: "Remove link",
|
|
24
|
+
image: "Image",
|
|
25
|
+
bulletList: "Bulleted list",
|
|
26
|
+
orderedList: "Numbered list",
|
|
27
|
+
indent: "Increase indent",
|
|
28
|
+
outdent: "Decrease indent",
|
|
29
|
+
align: "Alignment",
|
|
30
|
+
alignLeft: "Align left",
|
|
31
|
+
alignCenter: "Align center",
|
|
32
|
+
alignRight: "Align right",
|
|
33
|
+
alignJustify: "Justify",
|
|
34
|
+
blockquote: "Quote",
|
|
35
|
+
codeBlock: "Code block",
|
|
36
|
+
moveBlockUp: "Move block up",
|
|
37
|
+
moveBlockDown: "Move block down",
|
|
38
|
+
horizontalRule: "Horizontal line",
|
|
39
|
+
clearFormatting: "Clear formatting",
|
|
40
|
+
more: "More",
|
|
41
|
+
moreFormats: "More formatting",
|
|
42
|
+
blocks: "Text style",
|
|
43
|
+
styles: "Formats",
|
|
44
|
+
"styles.headings": "Headings",
|
|
45
|
+
"styles.inline": "Inline",
|
|
46
|
+
"styles.blocks": "Blocks",
|
|
47
|
+
"styles.align": "Align",
|
|
48
|
+
paragraph: "Paragraph",
|
|
49
|
+
h1: "Heading 1",
|
|
50
|
+
h2: "Heading 2",
|
|
51
|
+
h3: "Heading 3",
|
|
52
|
+
h4: "Heading 4",
|
|
53
|
+
h5: "Heading 5",
|
|
54
|
+
h6: "Heading 6",
|
|
55
|
+
fontFamily: "Font",
|
|
56
|
+
fontSize: "Font size",
|
|
57
|
+
lineHeight: "Line height",
|
|
58
|
+
default: "Default",
|
|
59
|
+
textColor: "Text color",
|
|
60
|
+
backgroundColor: "Highlight color",
|
|
61
|
+
removeColor: "Remove color",
|
|
62
|
+
customColor: "Custom color",
|
|
63
|
+
"dialog.cancel": "Cancel",
|
|
64
|
+
"dialog.save": "Save",
|
|
65
|
+
"dialog.insert": "Insert",
|
|
66
|
+
"dialog.close": "Close",
|
|
67
|
+
"dialog.required": "This field is required",
|
|
68
|
+
"dialog.invalid": "Check the format",
|
|
69
|
+
"link.title": "Insert link",
|
|
70
|
+
"link.editTitle": "Edit link",
|
|
71
|
+
"link.url": "URL",
|
|
72
|
+
"link.text": "Text to display",
|
|
73
|
+
"link.tooltip": "Title (tooltip)",
|
|
74
|
+
"link.newTab": "Open in new tab",
|
|
75
|
+
"link.open": "Open link",
|
|
76
|
+
"link.edit": "Edit link",
|
|
77
|
+
"link.copy": "Copy link",
|
|
78
|
+
"link.copied": "Link copied",
|
|
79
|
+
"link.invalid": "This URL is not allowed",
|
|
80
|
+
"image.title": "Insert image",
|
|
81
|
+
"image.url": "Image URL",
|
|
82
|
+
"image.alt": "Alternative text",
|
|
83
|
+
"image.altHint": "Describe the image for people using screen readers",
|
|
84
|
+
"image.upload": "Upload",
|
|
85
|
+
"image.drop": "Drop an image here or click to choose",
|
|
86
|
+
"image.uploading": "Uploading image\u2026",
|
|
87
|
+
"image.uploadFailed": "Image upload failed",
|
|
88
|
+
"image.retry": "Retry",
|
|
89
|
+
"image.retrying": "Connection problem \u2014 retrying the upload\u2026",
|
|
90
|
+
"image.invalid": "This image URL is not allowed",
|
|
91
|
+
"image.or": "or",
|
|
92
|
+
"image.toolbar": "Image options",
|
|
93
|
+
"image.alignLeft": "Float left",
|
|
94
|
+
"image.alignCenter": "Center",
|
|
95
|
+
"image.alignRight": "Float right",
|
|
96
|
+
"image.editAlt": "Alternative text",
|
|
97
|
+
"image.size": "Size",
|
|
98
|
+
"image.sizeSmall": "Small (25%)",
|
|
99
|
+
"image.sizeMedium": "Medium (50%)",
|
|
100
|
+
"image.sizeLarge": "Large (75%)",
|
|
101
|
+
"image.sizeFull": "Full width",
|
|
102
|
+
"image.sizeOriginal": "Original size",
|
|
103
|
+
"image.delete": "Remove image",
|
|
104
|
+
"image.caption": "Caption",
|
|
105
|
+
"image.captionPlaceholder": "Add a caption\u2026",
|
|
106
|
+
"status.words": "{count} words",
|
|
107
|
+
"announce.on": "{name} on",
|
|
108
|
+
"announce.off": "{name} off",
|
|
109
|
+
"status.resize": "Resize editor",
|
|
110
|
+
"dialog.browse": "Browse",
|
|
111
|
+
"dialog.dropFiles": "Drop files here or",
|
|
112
|
+
"dialog.fileType": "This file type is not allowed",
|
|
113
|
+
"dialog.fileTooLarge": "The file is too large",
|
|
114
|
+
"dialog.removeFile": "Remove",
|
|
115
|
+
pasteAsText: "Paste as text",
|
|
116
|
+
"menu.label": "Menu",
|
|
117
|
+
"menu.file": "File",
|
|
118
|
+
"menu.edit": "Edit",
|
|
119
|
+
"menu.view": "View",
|
|
120
|
+
"menu.insert": "Insert",
|
|
121
|
+
"menu.format": "Format",
|
|
122
|
+
"menu.table": "Table",
|
|
123
|
+
"menu.tools": "Tools",
|
|
124
|
+
"menu.help": "Help",
|
|
125
|
+
selectAll: "Select all",
|
|
126
|
+
print: "Print",
|
|
127
|
+
"table.rows": "Rows",
|
|
128
|
+
"table.cols": "Columns",
|
|
129
|
+
"table.invalidSize": "Enter a number from 1 to 50",
|
|
130
|
+
"quickbars.selection": "Quick formatting",
|
|
131
|
+
"quickbars.insert": "Quick insert",
|
|
132
|
+
"search.title": "Find and replace",
|
|
133
|
+
"search.find": "Find",
|
|
134
|
+
"search.replace": "Replace with",
|
|
135
|
+
"search.next": "Next match",
|
|
136
|
+
"search.prev": "Previous match",
|
|
137
|
+
"search.replaceOne": "Replace",
|
|
138
|
+
"search.replaceAll": "Replace all",
|
|
139
|
+
"search.matchCase": "Match case",
|
|
140
|
+
"search.wholeWord": "Whole words only",
|
|
141
|
+
"search.count": "{current} of {total}",
|
|
142
|
+
"search.none": "No results",
|
|
143
|
+
fullscreen: "Fullscreen",
|
|
144
|
+
preview: "Preview",
|
|
145
|
+
sourceCode: "Source code",
|
|
146
|
+
help: "Keyboard shortcuts",
|
|
147
|
+
"help.formatting": "Text formatting",
|
|
148
|
+
"help.blocks": "Paragraphs and lists",
|
|
149
|
+
"help.editing": "Editing",
|
|
150
|
+
"help.navigation": "Navigation",
|
|
151
|
+
"help.slash": "Insert block (slash commands)",
|
|
152
|
+
"help.toMenubar": "Move to the menu bar",
|
|
153
|
+
"help.toToolbar": "Move to the toolbar",
|
|
154
|
+
"help.toContextToolbar": "Move to the image/table toolbar",
|
|
155
|
+
"help.toEditor": "Back to the text",
|
|
156
|
+
"help.nextCell": "Next table cell",
|
|
157
|
+
table: "Table",
|
|
158
|
+
"table.insert": "Insert table",
|
|
159
|
+
"table.size": "{rows} \xD7 {cols}",
|
|
160
|
+
"table.toolbar": "Table options",
|
|
161
|
+
"table.rowBefore": "Insert row above",
|
|
162
|
+
"table.rowAfter": "Insert row below",
|
|
163
|
+
"table.rowDelete": "Delete row",
|
|
164
|
+
"table.colBefore": "Insert column left",
|
|
165
|
+
"table.colAfter": "Insert column right",
|
|
166
|
+
"table.colDelete": "Delete column",
|
|
167
|
+
"table.merge": "Merge cells",
|
|
168
|
+
"table.split": "Split cell",
|
|
169
|
+
"table.rowHeader": "Header row",
|
|
170
|
+
"table.colHeader": "Header column",
|
|
171
|
+
"table.cellBackground": "Cell background",
|
|
172
|
+
"table.delete": "Delete table",
|
|
173
|
+
"table.sort": "Sort",
|
|
174
|
+
"table.sortAsc": "Sort A \u2192 Z, 1 \u2192 9",
|
|
175
|
+
"table.sortDesc": "Sort Z \u2192 A, 9 \u2192 1",
|
|
176
|
+
"table.props": "Table properties",
|
|
177
|
+
"table.style": "Style",
|
|
178
|
+
"table.styleDefault": "Default",
|
|
179
|
+
"table.width": "Width",
|
|
180
|
+
"table.widthHint": "For example 100% or 600px. Leave empty to fit the content.",
|
|
181
|
+
"table.invalidWidth": "Enter a width such as 100% or 600px",
|
|
182
|
+
"table.align": "Alignment on the page",
|
|
183
|
+
"table.alignDefault": "Default",
|
|
184
|
+
"table.alignCenter": "Center",
|
|
185
|
+
"table.alignRight": "Right",
|
|
186
|
+
"table.cellProps": "Cell properties",
|
|
187
|
+
"table.valign": "Vertical alignment",
|
|
188
|
+
"table.valignTop": "Top",
|
|
189
|
+
"table.valignMiddle": "Middle",
|
|
190
|
+
"table.valignBottom": "Bottom",
|
|
191
|
+
"table.cellType": "Cell type",
|
|
192
|
+
"table.cellData": "Data cell",
|
|
193
|
+
"table.cellHeader": "Header cell",
|
|
194
|
+
"table.colWidth": "Column width, px",
|
|
195
|
+
"table.colWidthHint": "Leave empty to fit the content.",
|
|
196
|
+
"table.invalidColWidth": "Enter a number from 24 to 4000",
|
|
197
|
+
"slash.label": "Commands",
|
|
198
|
+
"slash.empty": "No matching commands"
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
// src/i18n/index.ts
|
|
202
|
+
var userPacks = {};
|
|
203
|
+
var builtin = { en };
|
|
204
|
+
var warned = /* @__PURE__ */ new Set();
|
|
205
|
+
var pluginPacks = {};
|
|
206
|
+
function flatten(labels) {
|
|
207
|
+
const out = {};
|
|
208
|
+
for (const [key, value] of Object.entries(labels)) {
|
|
209
|
+
if (typeof value === "string") out[key] = value;
|
|
210
|
+
else value.forEach((item, i) => out[`${key}.${i}`] = item);
|
|
211
|
+
}
|
|
212
|
+
return out;
|
|
213
|
+
}
|
|
214
|
+
var loaders = {};
|
|
215
|
+
var loading = {};
|
|
216
|
+
function install(lang, messages, below = false) {
|
|
217
|
+
userPacks[lang] = below ? { ...messages, ...userPacks[lang] } : { ...userPacks[lang], ...messages };
|
|
218
|
+
builtin[lang] = { ...en, ...userPacks[lang] };
|
|
219
|
+
}
|
|
220
|
+
function registerLanguage(code, messages) {
|
|
221
|
+
const lang = code.toLowerCase();
|
|
222
|
+
if (typeof messages === "function") loaders[lang] = messages;
|
|
223
|
+
else install(lang, messages);
|
|
224
|
+
}
|
|
225
|
+
function hasLanguage(code) {
|
|
226
|
+
const lang = code.toLowerCase();
|
|
227
|
+
return lang in builtin || lang.split("-")[0] in builtin;
|
|
228
|
+
}
|
|
229
|
+
function loadLanguage(code) {
|
|
230
|
+
const lang = code.toLowerCase();
|
|
231
|
+
const base = lang.split("-")[0];
|
|
232
|
+
const key = lang in loaders ? lang : base in loaders ? base : null;
|
|
233
|
+
if (!key) return Promise.resolve(hasLanguage(lang));
|
|
234
|
+
return loading[key] ??= loaders[key]().then(
|
|
235
|
+
(module) => {
|
|
236
|
+
install(
|
|
237
|
+
key,
|
|
238
|
+
module.default ?? module,
|
|
239
|
+
true
|
|
240
|
+
);
|
|
241
|
+
return true;
|
|
242
|
+
},
|
|
243
|
+
(error) => {
|
|
244
|
+
loading[key] = void 0;
|
|
245
|
+
throw error;
|
|
246
|
+
}
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
function registerPluginMessages(namespace, dict) {
|
|
250
|
+
const packs = pluginPacks[namespace] ??= {};
|
|
251
|
+
for (const [lang, labels] of Object.entries(dict)) {
|
|
252
|
+
if (labels) packs[lang] = { ...packs[lang], ...flatten(labels) };
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function getPluginMessages() {
|
|
256
|
+
return pluginPacks;
|
|
257
|
+
}
|
|
258
|
+
var interpolate = (template, params) => params ? template.replace(/\{(\w+)\}/g, (_, name) => String(params[name] ?? `{${name}}`)) : template;
|
|
259
|
+
function createTranslator(language = "en", overrides = {}) {
|
|
260
|
+
const code = language.toLowerCase();
|
|
261
|
+
const base = code.split("-")[0];
|
|
262
|
+
const pack = builtin[code] ?? builtin[base] ?? en;
|
|
263
|
+
if (pack === en && base !== "en" && !warned.has(base)) {
|
|
264
|
+
warned.add(base);
|
|
265
|
+
console.warn(
|
|
266
|
+
code in loaders || base in loaders ? `[nova] language "${language}" is not loaded yet, using English. Load it before creating the editor: await loadLanguage('${language}');` : `[nova] language "${language}" is not registered, using English. import pack from '@novaprose/core/i18n/${base}'; registerLanguage('${base}', pack);`
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
const messages = { ...en, ...pack, ...overrides };
|
|
270
|
+
const user = { ...userPacks[base], ...userPacks[code] };
|
|
271
|
+
const own = overrides;
|
|
272
|
+
return (key, params) => {
|
|
273
|
+
const core = messages[key];
|
|
274
|
+
if (core !== void 0) return interpolate(core, params);
|
|
275
|
+
const dot = key.indexOf(".");
|
|
276
|
+
const dict = dot > 0 ? pluginPacks[key.slice(0, dot)] : void 0;
|
|
277
|
+
const name = key.slice(dot + 1);
|
|
278
|
+
const template = own[key] ?? user[key] ?? dict?.[code]?.[name] ?? dict?.[base]?.[name] ?? dict?.en?.[name] ?? key;
|
|
279
|
+
return interpolate(template, params);
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// src/plugins/shared.ts
|
|
284
|
+
function pickLabels(editor, namespace, dict) {
|
|
285
|
+
registerPluginMessages(namespace, dict);
|
|
286
|
+
const out = {};
|
|
287
|
+
for (const [key, value] of Object.entries(dict.en)) {
|
|
288
|
+
out[key] = typeof value === "string" ? editor.ui.t(`${namespace}.${key}`) : value.map((_, i) => editor.ui.t(`${namespace}.${key}.${i}`));
|
|
289
|
+
}
|
|
290
|
+
return out;
|
|
291
|
+
}
|
|
292
|
+
function insertText(editor, text) {
|
|
293
|
+
const { state, dispatch } = editor.view;
|
|
294
|
+
dispatch(state.tr.insertText(text).scrollIntoView());
|
|
295
|
+
editor.focus();
|
|
296
|
+
}
|
|
297
|
+
function symbolPanel(options) {
|
|
298
|
+
const search = h("input", {
|
|
299
|
+
type: "search",
|
|
300
|
+
className: "nova-input nova-symbols-search",
|
|
301
|
+
placeholder: options.searchLabel,
|
|
302
|
+
"aria-label": options.searchLabel
|
|
303
|
+
});
|
|
304
|
+
const list = h("div", { className: "nova-symbols-list" });
|
|
305
|
+
const panel = h("div", { className: `nova-symbols ${options.className}` }, search, list);
|
|
306
|
+
const render = (query) => {
|
|
307
|
+
const q = query.trim().toLowerCase();
|
|
308
|
+
const sections = options.groups.map((group) => ({
|
|
309
|
+
title: group.title,
|
|
310
|
+
items: q ? group.items.filter(([s, name]) => name.includes(q) || s === q) : group.items
|
|
311
|
+
})).filter((g) => g.items.length);
|
|
312
|
+
if (!sections.length) {
|
|
313
|
+
list.replaceChildren(h("div", { className: "nova-symbols-empty" }, options.emptyText));
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
list.replaceChildren(
|
|
317
|
+
...sections.map(
|
|
318
|
+
(section) => h(
|
|
319
|
+
"div",
|
|
320
|
+
{ className: "nova-symbols-group", role: "group", "aria-label": section.title },
|
|
321
|
+
h("div", { className: "nova-symbols-title" }, section.title),
|
|
322
|
+
h(
|
|
323
|
+
"div",
|
|
324
|
+
{ className: "nova-symbols-grid" },
|
|
325
|
+
...section.items.map(
|
|
326
|
+
([symbol, name]) => h(
|
|
327
|
+
"button",
|
|
328
|
+
{
|
|
329
|
+
type: "button",
|
|
330
|
+
className: "nova-symbols-cell",
|
|
331
|
+
title: name,
|
|
332
|
+
"aria-label": name,
|
|
333
|
+
onclick: () => options.onPick(symbol)
|
|
334
|
+
},
|
|
335
|
+
symbol
|
|
336
|
+
)
|
|
337
|
+
)
|
|
338
|
+
)
|
|
339
|
+
)
|
|
340
|
+
)
|
|
341
|
+
);
|
|
342
|
+
};
|
|
343
|
+
search.addEventListener("input", () => render(search.value));
|
|
344
|
+
search.addEventListener("keydown", (event) => {
|
|
345
|
+
if (event.key === "ArrowDown") {
|
|
346
|
+
event.preventDefault();
|
|
347
|
+
list.querySelector(".nova-symbols-cell")?.focus();
|
|
348
|
+
} else if (event.key === "Enter") {
|
|
349
|
+
event.preventDefault();
|
|
350
|
+
list.querySelector(".nova-symbols-cell")?.click();
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
list.addEventListener("keydown", (event) => {
|
|
354
|
+
const cells = [...list.querySelectorAll(".nova-symbols-cell")];
|
|
355
|
+
const index = cells.indexOf(activeElement(list));
|
|
356
|
+
if (index < 0) return;
|
|
357
|
+
const perRow = Math.max(1, cells.filter((c) => c.offsetTop === cells[0].offsetTop).length);
|
|
358
|
+
const step = {
|
|
359
|
+
ArrowRight: 1,
|
|
360
|
+
ArrowLeft: -1,
|
|
361
|
+
ArrowDown: perRow,
|
|
362
|
+
ArrowUp: -perRow
|
|
363
|
+
};
|
|
364
|
+
const key = logicalKey(event, list);
|
|
365
|
+
if (!(key in step)) return;
|
|
366
|
+
event.preventDefault();
|
|
367
|
+
const next = index + step[key];
|
|
368
|
+
if (next < 0) search.focus();
|
|
369
|
+
else cells[Math.min(cells.length - 1, next)]?.focus();
|
|
370
|
+
});
|
|
371
|
+
render("");
|
|
372
|
+
queueMicrotask(() => search.focus());
|
|
373
|
+
return panel;
|
|
374
|
+
}
|
|
375
|
+
function openSymbolDialog(editor, title, build) {
|
|
376
|
+
let handle = null;
|
|
377
|
+
const body = build(() => handle?.close());
|
|
378
|
+
handle = editor.ui.openDialog({ title, body, cancelLabel: editor.ui.t("dialog.close") });
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export {
|
|
382
|
+
en,
|
|
383
|
+
registerLanguage,
|
|
384
|
+
hasLanguage,
|
|
385
|
+
loadLanguage,
|
|
386
|
+
getPluginMessages,
|
|
387
|
+
createTranslator,
|
|
388
|
+
pickLabels,
|
|
389
|
+
insertText,
|
|
390
|
+
symbolPanel,
|
|
391
|
+
openSymbolDialog
|
|
392
|
+
};
|
|
393
|
+
//# sourceMappingURL=chunk-DEYYVZ7O.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/i18n/en.ts","../src/i18n/index.ts","../src/plugins/shared.ts"],"sourcesContent":["/** English UI strings: the default language and the reference set of keys for other languages. */\nexport const en = {\n 'toolbar.label': 'Formatting',\n 'toolbar.options': 'options',\n 'editor.label': 'Rich text editor',\n 'editor.required': 'Please fill in this field.',\n\n undo: 'Undo',\n redo: 'Redo',\n bold: 'Bold',\n italic: 'Italic',\n underline: 'Underline',\n strike: 'Strikethrough',\n code: 'Inline code',\n subscript: 'Subscript',\n superscript: 'Superscript',\n link: 'Link',\n unlink: 'Remove link',\n image: 'Image',\n bulletList: 'Bulleted list',\n orderedList: 'Numbered list',\n indent: 'Increase indent',\n outdent: 'Decrease indent',\n align: 'Alignment',\n alignLeft: 'Align left',\n alignCenter: 'Align center',\n alignRight: 'Align right',\n alignJustify: 'Justify',\n blockquote: 'Quote',\n codeBlock: 'Code block',\n moveBlockUp: 'Move block up',\n moveBlockDown: 'Move block down',\n horizontalRule: 'Horizontal line',\n clearFormatting: 'Clear formatting',\n more: 'More',\n moreFormats: 'More formatting',\n\n blocks: 'Text style',\n styles: 'Formats',\n 'styles.headings': 'Headings',\n 'styles.inline': 'Inline',\n 'styles.blocks': 'Blocks',\n 'styles.align': 'Align',\n paragraph: 'Paragraph',\n h1: 'Heading 1',\n h2: 'Heading 2',\n h3: 'Heading 3',\n h4: 'Heading 4',\n h5: 'Heading 5',\n h6: 'Heading 6',\n\n fontFamily: 'Font',\n fontSize: 'Font size',\n lineHeight: 'Line height',\n default: 'Default',\n textColor: 'Text color',\n backgroundColor: 'Highlight color',\n removeColor: 'Remove color',\n customColor: 'Custom color',\n\n 'dialog.cancel': 'Cancel',\n 'dialog.save': 'Save',\n 'dialog.insert': 'Insert',\n 'dialog.close': 'Close',\n 'dialog.required': 'This field is required',\n 'dialog.invalid': 'Check the format',\n\n 'link.title': 'Insert link',\n 'link.editTitle': 'Edit link',\n 'link.url': 'URL',\n 'link.text': 'Text to display',\n 'link.tooltip': 'Title (tooltip)',\n 'link.newTab': 'Open in new tab',\n 'link.open': 'Open link',\n 'link.edit': 'Edit link',\n 'link.copy': 'Copy link',\n 'link.copied': 'Link copied',\n 'link.invalid': 'This URL is not allowed',\n\n 'image.title': 'Insert image',\n 'image.url': 'Image URL',\n 'image.alt': 'Alternative text',\n 'image.altHint': 'Describe the image for people using screen readers',\n 'image.upload': 'Upload',\n 'image.drop': 'Drop an image here or click to choose',\n 'image.uploading': 'Uploading image…',\n 'image.uploadFailed': 'Image upload failed',\n 'image.retry': 'Retry',\n 'image.retrying': 'Connection problem — retrying the upload…',\n 'image.invalid': 'This image URL is not allowed',\n 'image.or': 'or',\n 'image.toolbar': 'Image options',\n 'image.alignLeft': 'Float left',\n 'image.alignCenter': 'Center',\n 'image.alignRight': 'Float right',\n 'image.editAlt': 'Alternative text',\n 'image.size': 'Size',\n 'image.sizeSmall': 'Small (25%)',\n 'image.sizeMedium': 'Medium (50%)',\n 'image.sizeLarge': 'Large (75%)',\n 'image.sizeFull': 'Full width',\n 'image.sizeOriginal': 'Original size',\n 'image.delete': 'Remove image',\n 'image.caption': 'Caption',\n 'image.captionPlaceholder': 'Add a caption…',\n\n 'status.words': '{count} words',\n 'announce.on': '{name} on',\n 'announce.off': '{name} off',\n 'status.resize': 'Resize editor',\n 'dialog.browse': 'Browse',\n 'dialog.dropFiles': 'Drop files here or',\n 'dialog.fileType': 'This file type is not allowed',\n 'dialog.fileTooLarge': 'The file is too large',\n 'dialog.removeFile': 'Remove',\n\n pasteAsText: 'Paste as text',\n\n 'menu.label': 'Menu',\n 'menu.file': 'File',\n 'menu.edit': 'Edit',\n 'menu.view': 'View',\n 'menu.insert': 'Insert',\n 'menu.format': 'Format',\n 'menu.table': 'Table',\n 'menu.tools': 'Tools',\n 'menu.help': 'Help',\n selectAll: 'Select all',\n print: 'Print',\n 'table.rows': 'Rows',\n 'table.cols': 'Columns',\n 'table.invalidSize': 'Enter a number from 1 to 50',\n\n 'quickbars.selection': 'Quick formatting',\n 'quickbars.insert': 'Quick insert',\n\n 'search.title': 'Find and replace',\n 'search.find': 'Find',\n 'search.replace': 'Replace with',\n 'search.next': 'Next match',\n 'search.prev': 'Previous match',\n 'search.replaceOne': 'Replace',\n 'search.replaceAll': 'Replace all',\n 'search.matchCase': 'Match case',\n 'search.wholeWord': 'Whole words only',\n 'search.count': '{current} of {total}',\n 'search.none': 'No results',\n\n fullscreen: 'Fullscreen',\n preview: 'Preview',\n sourceCode: 'Source code',\n help: 'Keyboard shortcuts',\n 'help.formatting': 'Text formatting',\n 'help.blocks': 'Paragraphs and lists',\n 'help.editing': 'Editing',\n 'help.navigation': 'Navigation',\n 'help.slash': 'Insert block (slash commands)',\n 'help.toMenubar': 'Move to the menu bar',\n 'help.toToolbar': 'Move to the toolbar',\n 'help.toContextToolbar': 'Move to the image/table toolbar',\n 'help.toEditor': 'Back to the text',\n 'help.nextCell': 'Next table cell',\n\n table: 'Table',\n 'table.insert': 'Insert table',\n 'table.size': '{rows} × {cols}',\n 'table.toolbar': 'Table options',\n 'table.rowBefore': 'Insert row above',\n 'table.rowAfter': 'Insert row below',\n 'table.rowDelete': 'Delete row',\n 'table.colBefore': 'Insert column left',\n 'table.colAfter': 'Insert column right',\n 'table.colDelete': 'Delete column',\n 'table.merge': 'Merge cells',\n 'table.split': 'Split cell',\n 'table.rowHeader': 'Header row',\n 'table.colHeader': 'Header column',\n 'table.cellBackground': 'Cell background',\n 'table.delete': 'Delete table',\n 'table.sort': 'Sort',\n 'table.sortAsc': 'Sort A → Z, 1 → 9',\n 'table.sortDesc': 'Sort Z → A, 9 → 1',\n 'table.props': 'Table properties',\n 'table.style': 'Style',\n 'table.styleDefault': 'Default',\n 'table.width': 'Width',\n 'table.widthHint': 'For example 100% or 600px. Leave empty to fit the content.',\n 'table.invalidWidth': 'Enter a width such as 100% or 600px',\n 'table.align': 'Alignment on the page',\n 'table.alignDefault': 'Default',\n 'table.alignCenter': 'Center',\n 'table.alignRight': 'Right',\n 'table.cellProps': 'Cell properties',\n 'table.valign': 'Vertical alignment',\n 'table.valignTop': 'Top',\n 'table.valignMiddle': 'Middle',\n 'table.valignBottom': 'Bottom',\n 'table.cellType': 'Cell type',\n 'table.cellData': 'Data cell',\n 'table.cellHeader': 'Header cell',\n 'table.colWidth': 'Column width, px',\n 'table.colWidthHint': 'Leave empty to fit the content.',\n 'table.invalidColWidth': 'Enter a number from 24 to 4000',\n\n 'slash.label': 'Commands',\n 'slash.empty': 'No matching commands',\n} as const;\n\nexport type MessageKey = keyof typeof en;\nexport type Messages = Record<MessageKey, string>;\n","import { en, type MessageKey, type Messages } from './en';\n\nexport type { MessageKey, Messages };\nexport { en };\n\n/**\n * Plugin strings: `<plugin>.<key>` ('comments.reply', 'anchor.title'). Plugins load lazily, so their\n * strings live in the plugin and are registered when it loads (registerPluginMessages), but they are\n * translated by the same system as the core: registerLanguage and the `translations` option see them.\n */\nexport type PluginMessageKey = `${string}.${string}`;\n\n/**\n * A language pack or individual overrides: core strings (with type hints) and plugin strings.\n * Missing keys fall back to English.\n */\nexport type LanguagePack = Partial<Messages> & { [key: PluginMessageKey]: string };\n\n/** Packs passed through registerLanguage: only what the user gave (without en mixed in). */\nconst userPacks: Record<string, LanguagePack> = {};\n/**\n * Only English is built in (the reference). Other languages are the @novaprose/core/i18n/<code> packs,\n * attached through registerLanguage: each customer downloads only their language.\n */\nconst builtin: Record<string, Messages> = { en };\nconst warned = new Set<string>();\n\n/** A plugin's strings in one language: a string or a list of strings (group names and the like). */\nexport type PluginLabels = Record<string, string | readonly string[]>;\n/** A plugin's dictionary by language; en is the reference and the fallback. */\nexport type PluginDict = { en: PluginLabels } & Record<string, PluginLabels | undefined>;\n\n/** Built-in plugin strings in flat form: namespace → language → 'key' | 'key.0' → string. */\nconst pluginPacks: Record<string, Record<string, Record<string, string>>> = {};\n\nfunction flatten(labels: PluginLabels): Record<string, string> {\n const out: Record<string, string> = {};\n for (const [key, value] of Object.entries(labels)) {\n if (typeof value === 'string') out[key] = value;\n else value.forEach((item, i) => (out[`${key}.${i}`] = item));\n }\n return out;\n}\n\n/** A pack loader: `() => import('@novaprose/core/i18n/de')` — the language downloads only when needed. */\nexport type LanguageLoader = () => Promise<LanguagePack | { default: LanguagePack }>;\n\nconst loaders: Record<string, LanguageLoader> = {};\nconst loading: Record<string, Promise<boolean> | undefined> = {};\n\n/** A pack's strings go into the language's shared dictionary: over the existing ones or under them (a loaded pack doesn't overwrite customizations). */\nfunction install(lang: string, messages: LanguagePack, below = false): void {\n userPacks[lang] = below\n ? { ...messages, ...userPacks[lang] }\n : { ...userPacks[lang], ...messages };\n builtin[lang] = { ...en, ...(userPacks[lang] as Partial<Messages>) };\n}\n\n/**\n * Register a language pack (BCP 47 code: 'de', 'pt-BR') or a function that loads it — then call\n * `await loadLanguage(code)` before creating the editor. Missing keys fall back to English.\n */\nexport function registerLanguage(code: string, messages: LanguagePack | LanguageLoader): void {\n const lang = code.toLowerCase();\n if (typeof messages === 'function') loaders[lang] = messages;\n else install(lang, messages);\n}\n\n/** Whether a language is ready for a new editor: its pack is registered (or it is English). */\nexport function hasLanguage(code: string): boolean {\n const lang = code.toLowerCase();\n return lang in builtin || lang.split('-')[0]! in builtin;\n}\n\n/**\n * Load a language registered with a loader (the CDN builds register every pack this way). true —\n * the language is ready, false — there is neither a pack nor a loader. Strings are taken when an\n * editor is created, so load first. A failed load can be retried: the failure isn't remembered.\n */\nexport function loadLanguage(code: string): Promise<boolean> {\n const lang = code.toLowerCase();\n const base = lang.split('-')[0]!;\n const key = lang in loaders ? lang : base in loaders ? base : null;\n if (!key) return Promise.resolve(hasLanguage(lang));\n return (loading[key] ??= loaders[key]!().then(\n (module) => {\n // A pack module (import()) or the pack itself.\n install(\n key,\n (module as { default?: LanguagePack }).default ?? (module as LanguagePack),\n true,\n );\n return true;\n },\n (error: unknown) => {\n loading[key] = undefined;\n throw error;\n },\n ));\n}\n\n/**\n * A plugin's strings by language (en is the reference). The plugin calls it when its module loads.\n * Strings add up: a plugin and its lazy part can each register theirs under the same namespace.\n */\nexport function registerPluginMessages(namespace: string, dict: PluginDict): void {\n const packs = (pluginPacks[namespace] ??= {});\n for (const [lang, labels] of Object.entries(dict)) {\n if (labels) packs[lang] = { ...packs[lang], ...flatten(labels) };\n }\n}\n\n/**\n * All registered plugin strings, flattened: namespace → language → key → string (to check that\n * translations are complete, and as a template for translators).\n */\nexport function getPluginMessages(): Readonly<\n Record<string, Readonly<Record<string, Record<string, string>>>>\n> {\n return pluginPacks;\n}\n\nexport type Translator = (\n key: MessageKey | PluginMessageKey,\n params?: Record<string, string | number>,\n) => string;\n\nconst interpolate = (template: string, params?: Record<string, string | number>) =>\n params\n ? template.replace(/\\{(\\w+)\\}/g, (_, name: string) => String(params[name] ?? `{${name}}`))\n : template;\n\n/**\n * The translator for an editor instance. Looks for the exact code ('pt-br'), then the base language ('pt'),\n * then English. overrides are targeted replacements of strings from the config (core and plugins alike).\n * Plugin strings are looked up at call time: lazy plugins register after the editor is created.\n */\nexport function createTranslator(language = 'en', overrides: LanguagePack = {}): Translator {\n const code = language.toLowerCase();\n const base = code.split('-')[0]!;\n const pack = builtin[code] ?? builtin[base] ?? en;\n if (pack === en && base !== 'en' && !warned.has(base)) {\n warned.add(base);\n console.warn(\n code in loaders || base in loaders\n ? `[nova] language \"${language}\" is not loaded yet, using English. ` +\n `Load it before creating the editor: await loadLanguage('${language}');`\n : `[nova] language \"${language}\" is not registered, using English. ` +\n `import pack from '@novaprose/core/i18n/${base}'; registerLanguage('${base}', pack);`,\n );\n }\n const messages: Record<string, string> = { ...en, ...pack, ...overrides };\n const user = { ...userPacks[base], ...userPacks[code] } as Record<string, string | undefined>;\n const own = overrides as Record<string, string | undefined>;\n\n return (key, params) => {\n const core = messages[key];\n if (core !== undefined) return interpolate(core, params);\n // A plugin string: config → registerLanguage → the plugin's built-in translation → English.\n const dot = key.indexOf('.');\n const dict = dot > 0 ? pluginPacks[key.slice(0, dot)] : undefined;\n const name = key.slice(dot + 1);\n const template =\n own[key] ??\n user[key] ??\n dict?.[code]?.[name] ??\n dict?.[base]?.[name] ??\n dict?.en?.[name] ??\n key;\n return interpolate(template, params);\n };\n}\n","import type { Editor } from '../editor';\nimport { activeElement, h, logicalKey } from '../ui/dom';\nimport { registerPluginMessages, type PluginLabels } from '../i18n';\n\n/**\n * Labels of a built-in plugin. Plugins load lazily, so the strings live in the plugin itself\n * (en is the reference; translations live in the language packs), but they go through the shared i18n system under the keys\n * `<plugin>.<key>`: registerLanguage('de', { 'anchor.title': … }) and the `translations` option see them.\n */\nexport function pickLabels<T extends PluginLabels>(\n editor: Editor,\n namespace: string,\n dict: { en: T } & Record<string, PluginLabels | undefined>,\n): T {\n registerPluginMessages(namespace, dict);\n const out: Record<string, string | string[]> = {};\n for (const [key, value] of Object.entries(dict.en)) {\n out[key] =\n typeof value === 'string'\n ? editor.ui.t(`${namespace}.${key}`)\n : value.map((_, i) => editor.ui.t(`${namespace}.${key}.${i}`));\n }\n return out as T;\n}\n\nexport function insertText(editor: Editor, text: string): void {\n const { state, dispatch } = editor.view;\n dispatch(state.tr.insertText(text).scrollIntoView());\n editor.focus();\n}\n\nexport interface SymbolGroup {\n title: string;\n /** [character, name for search and screen readers] */\n items: readonly (readonly [string, string])[];\n}\n\n/**\n * A character picker panel: search + a grid of buttons by group. Arrows move focus across the grid,\n * Enter/space inserts, Esc closes the panel (the shared popover stack).\n */\nexport function symbolPanel(options: {\n groups: SymbolGroup[];\n searchLabel: string;\n emptyText: string;\n className: string;\n onPick: (symbol: string) => void;\n}): HTMLElement {\n const search = h('input', {\n type: 'search',\n className: 'nova-input nova-symbols-search',\n placeholder: options.searchLabel,\n 'aria-label': options.searchLabel,\n }) as HTMLInputElement;\n const list = h('div', { className: 'nova-symbols-list' });\n const panel = h('div', { className: `nova-symbols ${options.className}` }, search, list);\n\n const render = (query: string) => {\n const q = query.trim().toLowerCase();\n const sections = options.groups\n .map((group) => ({\n title: group.title,\n items: q ? group.items.filter(([s, name]) => name.includes(q) || s === q) : group.items,\n }))\n .filter((g) => g.items.length);\n if (!sections.length) {\n list.replaceChildren(h('div', { className: 'nova-symbols-empty' }, options.emptyText));\n return;\n }\n list.replaceChildren(\n ...sections.map((section) =>\n h(\n 'div',\n { className: 'nova-symbols-group', role: 'group', 'aria-label': section.title },\n h('div', { className: 'nova-symbols-title' }, section.title),\n h(\n 'div',\n { className: 'nova-symbols-grid' },\n ...section.items.map(([symbol, name]) =>\n h(\n 'button',\n {\n type: 'button',\n className: 'nova-symbols-cell',\n title: name,\n 'aria-label': name,\n onclick: () => options.onPick(symbol),\n },\n symbol,\n ),\n ),\n ),\n ),\n ),\n );\n };\n\n search.addEventListener('input', () => render(search.value));\n search.addEventListener('keydown', (event) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n list.querySelector<HTMLButtonElement>('.nova-symbols-cell')?.focus();\n } else if (event.key === 'Enter') {\n event.preventDefault();\n list.querySelector<HTMLButtonElement>('.nova-symbols-cell')?.click();\n }\n });\n list.addEventListener('keydown', (event) => {\n const cells = [...list.querySelectorAll<HTMLButtonElement>('.nova-symbols-cell')];\n const index = cells.indexOf(activeElement(list) as HTMLButtonElement);\n if (index < 0) return;\n // The width of a grid row comes from the actual position of the buttons.\n const perRow = Math.max(1, cells.filter((c) => c.offsetTop === cells[0]!.offsetTop).length);\n const step: Record<string, number> = {\n ArrowRight: 1,\n ArrowLeft: -1,\n ArrowDown: perRow,\n ArrowUp: -perRow,\n };\n const key = logicalKey(event, list);\n if (!(key in step)) return;\n event.preventDefault();\n const next = index + step[key]!;\n if (next < 0) search.focus();\n else cells[Math.min(cells.length - 1, next)]?.focus();\n });\n\n render('');\n queueMicrotask(() => search.focus());\n return panel;\n}\n\n/** Opens the character panel in a dialog (for a menu item when the button isn't on the toolbar). */\nexport function openSymbolDialog(\n editor: Editor,\n title: string,\n build: (close: () => void) => HTMLElement,\n): void {\n let handle: { close(): void } | null = null;\n const body = build(() => handle?.close());\n handle = editor.ui.openDialog({ title, body, cancelLabel: editor.ui.t('dialog.close') });\n}\n"],"mappings":";;;;;;;AACO,IAAM,KAAK;AAAA,EAChB,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EAEnB,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,WAAW;AAAA,EACX,aAAa;AAAA,EACb,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AAAA,EACP,WAAW;AAAA,EACX,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,aAAa;AAAA,EACb,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,MAAM;AAAA,EACN,aAAa;AAAA,EAEb,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,WAAW;AAAA,EACX,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EAEJ,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,aAAa;AAAA,EAEb,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAElB,cAAc;AAAA,EACd,kBAAkB;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+
// src/plugins/math.ts
|
|
9
|
+
import { NodeSelection, Plugin, PluginKey } from "prosemirror-state";
|
|
10
|
+
|
|
11
|
+
// nova-raw-css:/home/runner/work/novaprose/novaprose/packages/core/src/plugins/math.css?raw
|
|
12
|
+
var math_default = '.nova-math{border-radius:4px;cursor:pointer}.nova-math-inline{display:inline-block;padding:0 2px}.nova-math-block{display:block;margin:0 0 .75em;padding:6px 8px;overflow-x:auto;text-align:center}.nova-math:hover{background:var(--nova-hover)}.nova-math.is-selected{outline:2px solid var(--nova-accent)}.nova-math:not(:has(math)){font-family:var(--nova-mono);font-size:.9em}.nova-math-error{color:var(--nova-danger);text-decoration:underline wavy;text-underline-offset:3px}.nova-math-empty:before{content:var(--nova-math-empty, "");color:var(--nova-muted);font-family:var(--nova-font)}.nova-math-preview{min-height:2.5em;padding:8px;overflow-x:auto;border:1px dashed var(--nova-border);border-radius:var(--nova-radius-sm);text-align:center}';
|
|
13
|
+
|
|
14
|
+
// src/plugins/math.ts
|
|
15
|
+
var LABELS = { en: { empty: "Formula" } };
|
|
16
|
+
function mathLatex(value) {
|
|
17
|
+
return typeof value === "string" ? value.slice(0, 1e4) : "";
|
|
18
|
+
}
|
|
19
|
+
var temml = null;
|
|
20
|
+
function loadTemml() {
|
|
21
|
+
temml ??= import("temml").then(
|
|
22
|
+
(module) => module.default,
|
|
23
|
+
(error) => {
|
|
24
|
+
temml = null;
|
|
25
|
+
console.warn("[nova] math: could not load the formula renderer", error);
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
return temml;
|
|
30
|
+
}
|
|
31
|
+
function renderMath(engine, latex, target, block) {
|
|
32
|
+
try {
|
|
33
|
+
engine.render(latex, target, {
|
|
34
|
+
displayMode: block,
|
|
35
|
+
throwOnError: true,
|
|
36
|
+
trust: false,
|
|
37
|
+
annotate: true
|
|
38
|
+
});
|
|
39
|
+
return null;
|
|
40
|
+
} catch (error) {
|
|
41
|
+
target.textContent = latex;
|
|
42
|
+
return error instanceof Error ? error.message.replace(/^ParseError:\s*/, "") : String(error);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function mathSpec(block) {
|
|
46
|
+
const type = block ? "block-math" : "inline-math";
|
|
47
|
+
const tag = block ? "div" : "span";
|
|
48
|
+
return {
|
|
49
|
+
...block ? { group: "block" } : { group: "inline", inline: true },
|
|
50
|
+
atom: true,
|
|
51
|
+
selectable: true,
|
|
52
|
+
draggable: true,
|
|
53
|
+
attrs: { latex: { default: "" } },
|
|
54
|
+
parseDOM: [
|
|
55
|
+
{
|
|
56
|
+
tag: `${tag}[data-type="${type}"]`,
|
|
57
|
+
getAttrs: (dom) => ({ latex: mathLatex(dom.getAttribute("data-latex")) })
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
toDOM: (node) => {
|
|
61
|
+
const latex = mathLatex(node.attrs.latex);
|
|
62
|
+
return [
|
|
63
|
+
tag,
|
|
64
|
+
{ "data-type": type, "data-latex": latex },
|
|
65
|
+
block ? `\\[${latex}\\]` : `\\(${latex}\\)`
|
|
66
|
+
];
|
|
67
|
+
},
|
|
68
|
+
leafText: (node) => block ? `$$${mathLatex(node.attrs.latex)}$$` : `$${mathLatex(node.attrs.latex)}$`
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
var MathView = class {
|
|
72
|
+
constructor(node, view, getPos, editor) {
|
|
73
|
+
this.node = node;
|
|
74
|
+
this.view = view;
|
|
75
|
+
this.getPos = getPos;
|
|
76
|
+
this.editor = editor;
|
|
77
|
+
const block = node.type.name === "math_block";
|
|
78
|
+
this.dom = document.createElement(block ? "div" : "span");
|
|
79
|
+
this.dom.className = `nova-math ${block ? "nova-math-block" : "nova-math-inline"}`;
|
|
80
|
+
this.dom.contentEditable = "false";
|
|
81
|
+
this.dom.addEventListener("click", () => this.edit());
|
|
82
|
+
this.render();
|
|
83
|
+
}
|
|
84
|
+
node;
|
|
85
|
+
view;
|
|
86
|
+
getPos;
|
|
87
|
+
editor;
|
|
88
|
+
dom;
|
|
89
|
+
latex = "";
|
|
90
|
+
render() {
|
|
91
|
+
const latex = mathLatex(this.node.attrs.latex);
|
|
92
|
+
if (latex === this.latex && this.dom.childNodes.length) return;
|
|
93
|
+
this.latex = latex;
|
|
94
|
+
const block = this.node.type.name === "math_block";
|
|
95
|
+
this.dom.classList.toggle("nova-math-empty", !latex.trim());
|
|
96
|
+
this.dom.textContent = latex.trim() ? latex : "";
|
|
97
|
+
if (!latex.trim()) return;
|
|
98
|
+
void loadTemml().then((engine) => {
|
|
99
|
+
if (!engine || this.latex !== latex) return;
|
|
100
|
+
const error = renderMath(engine, latex, this.dom, block);
|
|
101
|
+
this.dom.classList.toggle("nova-math-error", !!error);
|
|
102
|
+
if (error) this.dom.title = error;
|
|
103
|
+
else this.dom.removeAttribute("title");
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/** Selects the formula and opens editing (the math button is registered by the lazy part). */
|
|
107
|
+
edit() {
|
|
108
|
+
const pos = this.getPos();
|
|
109
|
+
if (pos === void 0 || !this.editor.isEditable()) return;
|
|
110
|
+
this.view.dispatch(
|
|
111
|
+
this.view.state.tr.setSelection(NodeSelection.create(this.view.state.doc, pos))
|
|
112
|
+
);
|
|
113
|
+
const button = this.editor.ui.registry.get("math");
|
|
114
|
+
if (button?.type === "button") button.onAction(this.editor);
|
|
115
|
+
}
|
|
116
|
+
update(node) {
|
|
117
|
+
if (node.type !== this.node.type) return false;
|
|
118
|
+
this.node = node;
|
|
119
|
+
this.render();
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
selectNode() {
|
|
123
|
+
this.dom.classList.add("is-selected");
|
|
124
|
+
}
|
|
125
|
+
deselectNode() {
|
|
126
|
+
this.dom.classList.remove("is-selected");
|
|
127
|
+
}
|
|
128
|
+
ignoreMutation() {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
var math_default2 = definePlugin({
|
|
133
|
+
name: "math",
|
|
134
|
+
nodes: { math_inline: mathSpec(false), math_block: mathSpec(true) },
|
|
135
|
+
prosemirrorPlugins: (editor) => [
|
|
136
|
+
new Plugin({
|
|
137
|
+
key: new PluginKey("nova-math"),
|
|
138
|
+
props: {
|
|
139
|
+
nodeViews: {
|
|
140
|
+
math_inline: (node, view, getPos) => new MathView(node, view, getPos, editor),
|
|
141
|
+
math_block: (node, view, getPos) => new MathView(node, view, getPos, editor)
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
],
|
|
146
|
+
setup(editor) {
|
|
147
|
+
editor.ui.addStyles("nova-math", math_default);
|
|
148
|
+
const { empty } = pickLabels(editor, "math", LABELS);
|
|
149
|
+
editor.root.style.setProperty("--nova-math-empty", JSON.stringify(empty));
|
|
150
|
+
},
|
|
151
|
+
load: () => import("./math-ui-RUTCHTRY.js")
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
export {
|
|
155
|
+
mathLatex,
|
|
156
|
+
loadTemml,
|
|
157
|
+
renderMath,
|
|
158
|
+
math_default2 as math_default
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=chunk-EOJ5XHKA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugins/math.ts","nova-raw-css:/home/runner/work/novaprose/novaprose/packages/core/src/plugins/math.css?raw"],"sourcesContent":["import type { DOMOutputSpec, Node as PMNode, NodeSpec } from 'prosemirror-model';\nimport { NodeSelection, Plugin, PluginKey } from 'prosemirror-state';\nimport type { EditorView, NodeView } from 'prosemirror-view';\nimport type TemmlEngine from 'temml';\nimport type { Editor } from '../editor';\nimport { definePlugin } from '../plugins';\nimport css from './math.css?raw';\nimport { pickLabels } from './shared';\n\n/**\n * The math plugin: LaTeX formulas inline (`$E=mc^2$`) and on their own line. `plugins: ['math']`.\n * The HTML holds the LaTeX source: `<span data-type=\"inline-math\" data-latex=\"E=mc^2\">\\(E=mc^2\\)</span>`\n * (the same format as Tiptap; KaTeX and MathJax on the site's page understand the text with \\( \\)). In the editor\n * the formula is drawn with MathML (Temml, ~58 KB gzip, loaded when the document has a formula):\n * the browser renders it itself, without fonts and styles.\n *\n * Here are the nodes and their view (needed from the first render); the dialog, `$…$` input and the button are in math-ui.ts.\n */\n\nexport const LABELS = { en: { empty: 'Formula' } };\n\n/** The formula source: a string of reasonable length (HTML and JSON can bring anything). */\nexport function mathLatex(value: unknown): string {\n return typeof value === 'string' ? value.slice(0, 10_000) : '';\n}\n\ntype Temml = typeof TemmlEngine;\nlet temml: Promise<Temml | null> | null = null;\n\n/** Temml: one per page, loaded on first demand. */\nexport function loadTemml(): Promise<Temml | null> {\n temml ??= import('temml').then(\n (module) => module.default,\n (error: unknown) => {\n temml = null; // a network hiccup: the next formula tries again\n console.warn('[nova] math: could not load the formula renderer', error);\n return null;\n },\n );\n return temml;\n}\n\n/**\n * Draws a formula into an element. No trust in the LaTeX (`trust: false`): \\href and the like don't work.\n * An error in the formula (or an engine failure) leaves the source in the element and the error text in the answer: how the error\n * shows is up to the caller (a tooltip on the formula, a line under the preview in the dialog).\n */\nexport function renderMath(\n engine: Temml,\n latex: string,\n target: HTMLElement,\n block: boolean,\n): string | null {\n try {\n engine.render(latex, target, {\n displayMode: block,\n throwOnError: true,\n trust: false,\n annotate: true,\n });\n return null;\n } catch (error) {\n target.textContent = latex;\n return error instanceof Error ? error.message.replace(/^ParseError:\\s*/, '') : String(error);\n }\n}\n\nfunction mathSpec(block: boolean): NodeSpec {\n const type = block ? 'block-math' : 'inline-math';\n const tag = block ? 'div' : 'span';\n return {\n ...(block ? { group: 'block' } : { group: 'inline', inline: true }),\n atom: true,\n selectable: true,\n draggable: true,\n attrs: { latex: { default: '' } },\n parseDOM: [\n {\n tag: `${tag}[data-type=\"${type}\"]`,\n getAttrs: (dom) => ({ latex: mathLatex((dom as HTMLElement).getAttribute('data-latex')) }),\n },\n ],\n toDOM: (node): DOMOutputSpec => {\n const latex = mathLatex(node.attrs.latex);\n return [\n tag,\n { 'data-type': type, 'data-latex': latex },\n block ? `\\\\[${latex}\\\\]` : `\\\\(${latex}\\\\)`,\n ];\n },\n leafText: (node) =>\n block ? `$$${mathLatex(node.attrs.latex)}$$` : `$${mathLatex(node.attrs.latex)}$`,\n };\n}\n\n/** The formula view: the source until Temml loads, then MathML. A click edits it (math-ui). */\nclass MathView implements NodeView {\n dom: HTMLElement;\n private latex = '';\n\n constructor(\n private node: PMNode,\n private readonly view: EditorView,\n private readonly getPos: () => number | undefined,\n private readonly editor: Editor,\n ) {\n const block = node.type.name === 'math_block';\n this.dom = document.createElement(block ? 'div' : 'span');\n this.dom.className = `nova-math ${block ? 'nova-math-block' : 'nova-math-inline'}`;\n this.dom.contentEditable = 'false';\n this.dom.addEventListener('click', () => this.edit());\n this.render();\n }\n\n private render(): void {\n const latex = mathLatex(this.node.attrs.latex);\n if (latex === this.latex && this.dom.childNodes.length) return;\n this.latex = latex;\n const block = this.node.type.name === 'math_block';\n this.dom.classList.toggle('nova-math-empty', !latex.trim());\n // The source right away (visible without a network), the formula once the engine loads.\n this.dom.textContent = latex.trim() ? latex : '';\n if (!latex.trim()) return;\n void loadTemml().then((engine) => {\n if (!engine || this.latex !== latex) return;\n const error = renderMath(engine, latex, this.dom, block);\n // An error: the source with a wavy underline, the error text in a tooltip.\n this.dom.classList.toggle('nova-math-error', !!error);\n if (error) this.dom.title = error;\n else this.dom.removeAttribute('title');\n });\n }\n\n /** Selects the formula and opens editing (the math button is registered by the lazy part). */\n private edit(): void {\n const pos = this.getPos();\n if (pos === undefined || !this.editor.isEditable()) return;\n this.view.dispatch(\n this.view.state.tr.setSelection(NodeSelection.create(this.view.state.doc, pos)),\n );\n const button = this.editor.ui.registry.get('math');\n if (button?.type === 'button') button.onAction(this.editor);\n }\n\n update(node: PMNode): boolean {\n if (node.type !== this.node.type) return false;\n this.node = node;\n this.render();\n return true;\n }\n\n selectNode(): void {\n this.dom.classList.add('is-selected');\n }\n\n deselectNode(): void {\n this.dom.classList.remove('is-selected');\n }\n\n ignoreMutation(): boolean {\n return true;\n }\n}\n\nexport default definePlugin({\n name: 'math',\n nodes: { math_inline: mathSpec(false), math_block: mathSpec(true) },\n prosemirrorPlugins: (editor) => [\n new Plugin({\n key: new PluginKey('nova-math'),\n props: {\n nodeViews: {\n math_inline: (node, view, getPos) => new MathView(node, view, getPos, editor),\n math_block: (node, view, getPos) => new MathView(node, view, getPos, editor),\n },\n },\n }),\n ],\n setup(editor) {\n editor.ui.addStyles('nova-math', css);\n // An empty formula shows a label in the interface language (it isn't in the document's HTML).\n const { empty } = pickLabels(editor, 'math', LABELS);\n editor.root.style.setProperty('--nova-math-empty', JSON.stringify(empty));\n },\n load: () => import('./math-ui'),\n});\n",".nova-math{border-radius:4px;cursor:pointer}.nova-math-inline{display:inline-block;padding:0 2px}.nova-math-block{display:block;margin:0 0 .75em;padding:6px 8px;overflow-x:auto;text-align:center}.nova-math:hover{background:var(--nova-hover)}.nova-math.is-selected{outline:2px solid var(--nova-accent)}.nova-math:not(:has(math)){font-family:var(--nova-mono);font-size:.9em}.nova-math-error{color:var(--nova-danger);text-decoration:underline wavy;text-underline-offset:3px}.nova-math-empty:before{content:var(--nova-math-empty, \"\");color:var(--nova-muted);font-family:var(--nova-font)}.nova-math-preview{min-height:2.5em;padding:8px;overflow-x:auto;border:1px dashed var(--nova-border);border-radius:var(--nova-radius-sm);text-align:center}"],"mappings":";;;;;;;;AACA,SAAS,eAAe,QAAQ,iBAAiB;;;ACDjD;;;ADmBO,IAAM,SAAS,EAAE,IAAI,EAAE,OAAO,UAAU,EAAE;AAG1C,SAAS,UAAU,OAAwB;AAChD,SAAO,OAAO,UAAU,WAAW,MAAM,MAAM,GAAG,GAAM,IAAI;AAC9D;AAGA,IAAI,QAAsC;AAGnC,SAAS,YAAmC;AACjD,YAAU,OAAO,OAAO,EAAE;AAAA,IACxB,CAAC,WAAW,OAAO;AAAA,IACnB,CAAC,UAAmB;AAClB,cAAQ;AACR,cAAQ,KAAK,oDAAoD,KAAK;AACt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