@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
package/dist/index.d.cts
CHANGED
|
@@ -1,1792 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
1
|
+
import { E as Editor, N as NovaSchema } from './editor-BCMxe1M4.cjs';
|
|
2
|
+
export { A as AccordionOptions, b as AccordionState, c as AdvCodeOptions, d as AdvTableOptions, e as AiAction, f as AiMessage, g as AiOptions, h as AiRequest, i as AiShortcut, j as AutocompleterItem, k as AutocompleterSpec, l as AutocorrectCorrection, m as AutocorrectOptions, n as AutosaveOptions, B as BlockFormat, o as BlockPattern, p as BlockTag, q as ButtonSpec, C as ChainCommandName, r as ClassFilter, s as ClassOption, t as CodeGrammarLoader, u as CodeLanguage, v as CodeSampleOptions, w as CommandChain, x as CommandName, y as Comment, z as CommentAuthor, D as CommentStore, F as CommentThread, G as CommentsController, H as CommentsOptions, I as ContextToolbarSpec, J as ControlSpec, K as CorrectionKind, L as DEFAULT_MENUBAR, M as DEFAULT_MENUS, O as DialogApi, Q as DialogData, R as DialogField, S as DialogFieldValue, T as DialogSpec, U as EditImageOptions, V as EditorEvent, W as EditorEventDetails, X as EditorListener, Y as EditorMode, Z as EditorOptions, _ as EditorSelection, $ as EmbedInfo, a0 as ExportPdfOptions, a1 as ExportWordOptions, a2 as FilePickResult, a3 as FilePickType, a4 as FilePicker, a5 as FontOption, a6 as FormatSpec, a7 as Formatter, a8 as FullPageHtmlOptions, a9 as HeadElement, aa as ImageAlign, ab as InlinePattern, ac as InlineTag, ad as LinkCheckerOptions, ae as LinkStatus, af as MarkName, ag as MediaEmbedOptions, ah as MentionUser, ai as MentionsOptions, aj as MenuButtonSpec, ak as MenuDefinition, al as MenuEntry, am as MenuItem, an as MenuItemSpec, ao as MergeTag, ap as MergeTagGroup, aq as MergeTagsOptions, ar as NodeName, as as NodeViewFactory, at as NodeViewOptions, au as NodeViewProps, av as NodeViewRenderer, aw as NotificationAction, ax as NotificationHandle, ay as NotificationOptions, az as NovaPlugin, aA as PAGE_SIZES, aB as PageBand, aC as PageBandParts, aD as PageData, aE as PageEmbedOptions, aF as PageEmbedSize, aG as PageHandler, a as PageLayout, aH as PageLayoutController, P as PageLayoutOptions, aI as PageMargins, aJ as PageSizeName, aK as PanelButtonSpec, aL as PasteOptions, aM as PdfRequest, aN as PluginEntry, aO as PluginOptions, aP as QuickbarsOptions, aQ as REMOTE_CHANGE_META, aR as Registry, aS as ReplacementPattern, aT as Revision, aU as RevisionHistoryOptions, aV as SchemaExtensions, aW as SelectionBookmark, aX as SidebarSpec, aY as Sidebars, aZ as SlashCommand, a_ as StyleFormat, a$ as TableOfContentsOptions, b0 as TableSeries, b1 as TextAlign, b2 as TextPattern, b3 as TextPatternCommand, b4 as TextPatternContext, b5 as ToolbarConfig, b6 as ToolbarMode, b7 as TypographyOptions, b8 as TypographyRule, b9 as UiManager, ba as UploadImageHandler, bb as ViewApi, bc as ViewButton, bd as ViewSpec, be as Views, bf as commands, bg as createCommentStore, bh as createEditor, bi as createSchema, bj as defaultFontFamilies, bk as defaultFontSizes, bl as defaultLineHeights, bm as defaultSlashCommands, bn as defaultToolbar, bo as defineNodeView, bp as definePlugin, bq as getActiveAlign, br as getComments, bs as getLinkAt, bt as getMentions, bu as getSelectedImage, bv as htmlToPlainText, bw as insertImage, bx as isCommandActive, by as isMarkActive, bz as isNodeActive, bA as isPluginRegistered, bB as marksOf, bC as nodesOf, bD as openImageAltDialog, bE as openImageDialog, bF as pageLayout, bG as registerPlugin, bH as sanitizeThread, bI as schema, bJ as setImageAttrs, bK as setImageWidthFraction, bL as setLink, bM as uploadImages } from './editor-BCMxe1M4.cjs';
|
|
3
|
+
export { D as DocumentOptions, a as DocumentRenderer, c as createRenderer, r as renderHTML } from './document-IQqDDT4v.cjs';
|
|
4
|
+
import { Schema, DOMParser, Node, Fragment } from 'prosemirror-model';
|
|
5
|
+
import { EditorState, Command, Transaction } from 'prosemirror-state';
|
|
6
|
+
export { a as LanguageLoader, L as LanguagePack, M as MessageKey, b as Messages, P as PluginMessageKey, T as Translator, e as en, g as getPluginMessages, h as hasLanguage, l as loadLanguage, r as registerLanguage } from './index-CZ9yDvmQ.cjs';
|
|
7
|
+
export { H as HtmlRulesInstance, b as HtmlRulesModule, a as HtmlRulesOptions, S as SchemaSpecs, r as registerHtmlRules } from './html-rules-api-BLDDW9MO.cjs';
|
|
8
|
+
import './a11y.cjs';
|
|
9
|
+
import 'prosemirror-view';
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* появляется уведомление, а кнопка «Восстановить черновик» (restoredraft) становится активной.
|
|
12
|
-
*
|
|
13
|
-
* `plugins: ['autosave']`, настройки — `pluginOptions.autosave`:
|
|
14
|
-
* - key — ключ хранилища (по умолчанию адрес страницы + id элемента);
|
|
15
|
-
* - delay — задержка сохранения после изменения, мс (1000);
|
|
16
|
-
* - retention — сколько хранить черновик, минут (7 дней).
|
|
17
|
-
*/
|
|
18
|
-
interface AutosaveOptions {
|
|
19
|
-
key?: string;
|
|
20
|
-
delay?: number;
|
|
21
|
-
retention?: number;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
type BlockTag = 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'blockquote' | 'pre';
|
|
25
|
-
type InlineTag = 'span' | 'strong' | 'b' | 'em' | 'i' | 'u' | 's' | 'strike' | 'del' | 'code' | 'sub' | 'sup';
|
|
26
|
-
interface FormatSpec {
|
|
27
|
-
/** Сменить тип блока. */
|
|
28
|
-
block?: BlockTag;
|
|
29
|
-
/** Отметить выделенный текст. */
|
|
30
|
-
inline?: InlineTag;
|
|
31
|
-
/** Применить к существующим элементам: 'p,h1', 'img', 'blockquote'. */
|
|
32
|
-
selector?: string;
|
|
33
|
-
/** Классы: 'note' или ['note', 'warning']. */
|
|
34
|
-
classes?: string | string[];
|
|
35
|
-
/**
|
|
36
|
-
* Стили. Для текста — color, background-color, font-family, font-size;
|
|
37
|
-
* для блоков — text-align, line-height. Остальные не поддерживаются (предупреждение в консоли).
|
|
38
|
-
*/
|
|
39
|
-
styles?: Record<string, string>;
|
|
40
|
-
}
|
|
41
|
-
/** Пункт меню «Стили»: свой формат, ссылка на именованный (format) или группа (items). */
|
|
42
|
-
interface StyleFormat extends FormatSpec {
|
|
43
|
-
title: string;
|
|
44
|
-
format?: string;
|
|
45
|
-
items?: StyleFormat[];
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Реестр форматов редактора и их применение к выделению (`editor.formatter`).
|
|
49
|
-
* Классы из зарегистрированных форматов сохраняются при разборе HTML.
|
|
50
|
-
*/
|
|
51
|
-
declare class Formatter {
|
|
52
|
-
private readonly editor;
|
|
53
|
-
/** Пополняется классами новых форматов — схема сверяется с ним при разборе HTML. */
|
|
54
|
-
private readonly allowedClasses;
|
|
55
|
-
private readonly registry;
|
|
56
|
-
constructor(editor: Editor,
|
|
57
|
-
/** Пополняется классами новых форматов — схема сверяется с ним при разборе HTML. */
|
|
58
|
-
allowedClasses: Set<string>);
|
|
59
|
-
/** Зарегистрировать именованный формат (одно описание или несколько вариантов). */
|
|
60
|
-
register(name: string, spec: FormatSpec | FormatSpec[]): void;
|
|
61
|
-
unregister(name: string): void;
|
|
62
|
-
has(name: string): boolean;
|
|
63
|
-
get(name: string): FormatSpec[] | undefined;
|
|
64
|
-
private resolve;
|
|
65
|
-
/** Можно ли применить формат к выделению (для selector — есть ли подходящие элементы). */
|
|
66
|
-
canApply(format: string | FormatSpec): boolean;
|
|
67
|
-
/** Подходит ли выделение под формат. */
|
|
68
|
-
match(format: string | FormatSpec): boolean;
|
|
69
|
-
apply(format: string | FormatSpec): boolean;
|
|
70
|
-
remove(format: string | FormatSpec): boolean;
|
|
71
|
-
toggle(format: string | FormatSpec): boolean;
|
|
72
|
-
private run;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/** Что выбрал пользователь в вашем файловом менеджере. */
|
|
76
|
-
interface FilePickResult {
|
|
77
|
-
url: string;
|
|
78
|
-
/** Текст ссылки (диалог ссылки, если текст ещё пуст). */
|
|
79
|
-
text?: string;
|
|
80
|
-
/** Подсказка (title) ссылки или название видео. */
|
|
81
|
-
title?: string;
|
|
82
|
-
/** Альтернативный текст картинки. */
|
|
83
|
-
alt?: string;
|
|
84
|
-
}
|
|
85
|
-
/** Какое поле просит файл: ссылка на любой файл, картинка или видео. */
|
|
86
|
-
type FilePickType = 'file' | 'image' | 'media';
|
|
87
|
-
/**
|
|
88
|
-
* Ваш выбор файла (как file_picker_callback в TinyMCE): открыть свой менеджер файлов и вернуть адрес.
|
|
89
|
-
* null/undefined — пользователь передумал.
|
|
90
|
-
*/
|
|
91
|
-
type FilePicker = (request: {
|
|
92
|
-
type: FilePickType;
|
|
93
|
-
value: string;
|
|
94
|
-
}) => Promise<FilePickResult | null | undefined> | FilePickResult | null | undefined;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Комментарии к тексту: модель данных и хранилище.
|
|
98
|
-
*
|
|
99
|
-
* Текст документа хранит только якорь — марку `<span data-comment="id">` вокруг обсуждаемого фрагмента.
|
|
100
|
-
* Сами обсуждения (ветки) лежат в хранилище: по умолчанию в памяти (сохраняйте их через `onChange`
|
|
101
|
-
* рядом с HTML), при совместном редактировании — в общем Y.Doc (`collabSession.commentStore()`),
|
|
102
|
-
* или в вашем собственном хранилище с тем же интерфейсом.
|
|
103
|
-
*/
|
|
104
|
-
interface CommentAuthor {
|
|
105
|
-
id: string;
|
|
106
|
-
name: string;
|
|
107
|
-
}
|
|
108
|
-
interface Comment {
|
|
109
|
-
id: string;
|
|
110
|
-
author: CommentAuthor;
|
|
111
|
-
text: string;
|
|
112
|
-
/** Время создания, мс с 1970 (Date.now()). */
|
|
113
|
-
createdAt: number;
|
|
114
|
-
editedAt?: number;
|
|
115
|
-
/** Упомянутые через «@» (в тексте — «@Имя»): кого уведомить. */
|
|
116
|
-
mentions?: CommentAuthor[];
|
|
117
|
-
}
|
|
118
|
-
interface CommentThread {
|
|
119
|
-
/** Совпадает с data-comment у фрагмента текста. */
|
|
120
|
-
id: string;
|
|
121
|
-
createdAt: number;
|
|
122
|
-
/** Первый комментарий — суть обсуждения, остальные — ответы. */
|
|
123
|
-
comments: Comment[];
|
|
124
|
-
/** Ветка решена: подсветка в тексте скрывается, обсуждение остаётся в истории. */
|
|
125
|
-
resolved?: {
|
|
126
|
-
by: CommentAuthor;
|
|
127
|
-
at: number;
|
|
128
|
-
} | null;
|
|
129
|
-
}
|
|
130
|
-
/** Хранилище веток. Методы синхронные: интерфейс обновляется сразу, сохранение — на вашей стороне. */
|
|
131
|
-
interface CommentStore {
|
|
132
|
-
/** Снимок всех веток (новый массив после каждого изменения). */
|
|
133
|
-
threads(): readonly CommentThread[];
|
|
134
|
-
/** Подписка на любые изменения (в том числе пришедшие от других участников). Возвращает отписку. */
|
|
135
|
-
subscribe(listener: () => void): () => void;
|
|
136
|
-
createThread(thread: CommentThread): void;
|
|
137
|
-
reply(threadId: string, comment: Comment): void;
|
|
138
|
-
editComment(threadId: string, commentId: string, text: string): void;
|
|
139
|
-
deleteComment(threadId: string, commentId: string): void;
|
|
140
|
-
setResolved(threadId: string, resolved: CommentThread['resolved']): void;
|
|
141
|
-
deleteThread(threadId: string): void;
|
|
142
|
-
}
|
|
143
|
-
declare function newCommentId(prefix?: string): string;
|
|
144
|
-
/** Привести данные из внешнего источника (JSON, сеть) к безопасному виду; негодное — отбросить. */
|
|
145
|
-
declare function sanitizeThread(value: unknown): CommentThread | null;
|
|
146
|
-
/**
|
|
147
|
-
* Хранилище в памяти. `initial` — ветки, сохранённые раньше (из вашего бэкенда), `onChange` — сохранить.
|
|
148
|
-
*
|
|
149
|
-
* ```ts
|
|
150
|
-
* const store = createCommentStore(saved.threads, (threads) => api.saveComments(postId, threads));
|
|
151
|
-
* ```
|
|
152
|
-
*/
|
|
153
|
-
declare function createCommentStore(initial?: readonly unknown[], onChange?: (threads: readonly CommentThread[]) => void): CommentStore;
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Плагин mentions: «@» в тексте → список людей → упоминание `<span data-mention="id">@Имя</span>`.
|
|
157
|
-
* `plugins: ['mentions']`, список людей — `pluginOptions.mentions.fetch` (обычно поиск в вашем API).
|
|
158
|
-
* Тот же источник используют комментарии: «@» в поле комментария.
|
|
159
|
-
*/
|
|
160
|
-
interface MentionUser {
|
|
161
|
-
id: string;
|
|
162
|
-
name: string;
|
|
163
|
-
/** Вторая строка в списке: должность, e-mail. */
|
|
164
|
-
description?: string;
|
|
165
|
-
}
|
|
166
|
-
interface MentionsOptions {
|
|
167
|
-
/** Поиск людей по началу имени (запрос без «@»). Может вернуть Promise. */
|
|
168
|
-
fetch: (query: string) => MentionUser[] | Promise<MentionUser[]>;
|
|
169
|
-
/** Человека упомянули в тексте (для уведомлений — или соберите их при сохранении: getMentions). */
|
|
170
|
-
onMention?: (user: MentionUser, editor: Editor) => void;
|
|
171
|
-
/** Сколько показывать в списке (по умолчанию 8). */
|
|
172
|
-
maxResults?: number;
|
|
173
|
-
}
|
|
174
|
-
/** id пользователя: UUID, числа, e-mail, логины — без пробелов, кавычек и угловых скобок. */
|
|
175
|
-
declare const MENTION_ID_RE: RegExp;
|
|
176
|
-
/** Кто упомянут в документе (без повторов, в порядке появления) — например, чтобы уведомить. */
|
|
177
|
-
declare function getMentions(editorOrDoc: Editor | Node): MentionUser[];
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Плагин comments: обсуждения фрагментов текста (как комментарии в Google Docs / Word).
|
|
181
|
-
* `plugins: ['comments']`, настройки — `pluginOptions.comments` ({@link CommentsOptions}).
|
|
182
|
-
* Кнопки (имена TinyMCE): `addcomment`, `showcomments`. Ctrl+Alt+M — комментировать выделение.
|
|
183
|
-
*
|
|
184
|
-
* Марка в схеме — поэтому плагин подключается сразу; панель обсуждений грузится лениво при открытии.
|
|
185
|
-
*/
|
|
186
|
-
interface CommentsOptions {
|
|
187
|
-
/** Кто комментирует. По умолчанию — «Гость». */
|
|
188
|
-
author?: CommentAuthor;
|
|
189
|
-
/** Хранилище веток. По умолчанию — в памяти, с `threads` и `onChange`. */
|
|
190
|
-
store?: CommentStore;
|
|
191
|
-
/** Сохранённые ранее ветки (для хранилища по умолчанию). */
|
|
192
|
-
threads?: readonly CommentThread[];
|
|
193
|
-
/** Ветки изменились — сохраните их (для хранилища по умолчанию). */
|
|
194
|
-
onChange?: (threads: readonly CommentThread[]) => void;
|
|
195
|
-
/** Можно ли менять и удалять комментарий. По умолчанию — только автору. */
|
|
196
|
-
canEdit?: (comment: Comment, author: CommentAuthor) => boolean;
|
|
197
|
-
/**
|
|
198
|
-
* Поиск людей для «@» в комментариях. По умолчанию — `pluginOptions.mentions.fetch` (плагин mentions).
|
|
199
|
-
*/
|
|
200
|
-
mentions?: MentionsOptions['fetch'];
|
|
201
|
-
/** В новом комментарии кого-то упомянули — отправьте уведомление. */
|
|
202
|
-
onMention?: (event: {
|
|
203
|
-
threadId: string;
|
|
204
|
-
comment: Comment;
|
|
205
|
-
users: CommentAuthor[];
|
|
206
|
-
}) => void;
|
|
207
|
-
}
|
|
208
|
-
declare const LABELS: {
|
|
209
|
-
en: {
|
|
210
|
-
add: string;
|
|
211
|
-
show: string;
|
|
212
|
-
panel: string;
|
|
213
|
-
guest: string;
|
|
214
|
-
newComment: string;
|
|
215
|
-
placeholder: string;
|
|
216
|
-
replyPlaceholder: string;
|
|
217
|
-
comment: string;
|
|
218
|
-
reply: string;
|
|
219
|
-
cancel: string;
|
|
220
|
-
save: string;
|
|
221
|
-
edit: string;
|
|
222
|
-
remove: string;
|
|
223
|
-
resolve: string;
|
|
224
|
-
reopen: string;
|
|
225
|
-
deleteThread: string;
|
|
226
|
-
close: string;
|
|
227
|
-
showResolved: string;
|
|
228
|
-
resolvedBy: string;
|
|
229
|
-
orphan: string;
|
|
230
|
-
empty: string;
|
|
231
|
-
people: string;
|
|
232
|
-
noPeople: string;
|
|
233
|
-
edited: string;
|
|
234
|
-
you: string;
|
|
235
|
-
count: string;
|
|
236
|
-
};
|
|
237
|
-
ru: {
|
|
238
|
-
add: string;
|
|
239
|
-
show: string;
|
|
240
|
-
panel: string;
|
|
241
|
-
guest: string;
|
|
242
|
-
newComment: string;
|
|
243
|
-
placeholder: string;
|
|
244
|
-
replyPlaceholder: string;
|
|
245
|
-
comment: string;
|
|
246
|
-
reply: string;
|
|
247
|
-
cancel: string;
|
|
248
|
-
save: string;
|
|
249
|
-
edit: string;
|
|
250
|
-
remove: string;
|
|
251
|
-
resolve: string;
|
|
252
|
-
reopen: string;
|
|
253
|
-
deleteThread: string;
|
|
254
|
-
close: string;
|
|
255
|
-
showResolved: string;
|
|
256
|
-
resolvedBy: string;
|
|
257
|
-
orphan: string;
|
|
258
|
-
empty: string;
|
|
259
|
-
people: string;
|
|
260
|
-
noPeople: string;
|
|
261
|
-
edited: string;
|
|
262
|
-
you: string;
|
|
263
|
-
count: string;
|
|
264
|
-
};
|
|
265
|
-
};
|
|
266
|
-
type CommentsLabels = typeof LABELS.en;
|
|
267
|
-
interface PluginState {
|
|
268
|
-
/** Выделение, к которому пишется новый комментарий (ещё не сохранён — без марки в тексте). */
|
|
269
|
-
pending: {
|
|
270
|
-
from: number;
|
|
271
|
-
to: number;
|
|
272
|
-
} | null;
|
|
273
|
-
active: string | null;
|
|
274
|
-
}
|
|
275
|
-
/** Управление комментариями редактора — общий объект для плагина и ленивой панели. */
|
|
276
|
-
interface CommentsController {
|
|
277
|
-
readonly editor: Editor;
|
|
278
|
-
readonly store: CommentStore;
|
|
279
|
-
readonly author: CommentAuthor;
|
|
280
|
-
readonly labels: CommentsLabels;
|
|
281
|
-
readonly shortcut: string;
|
|
282
|
-
pending(): PluginState['pending'];
|
|
283
|
-
active(): string | null;
|
|
284
|
-
setActive(id: string | null, scroll?: boolean): void;
|
|
285
|
-
/** Начать комментарий к выделению: подсветить его и открыть панель с полем ввода. */
|
|
286
|
-
startComment(): boolean;
|
|
287
|
-
cancelPending(): void;
|
|
288
|
-
/** Сохранить новый комментарий к отложенному выделению. Возвращает id ветки. */
|
|
289
|
-
submitPending(text: string, mentions?: CommentAuthor[]): string | null;
|
|
290
|
-
reply(threadId: string, text: string, mentions?: CommentAuthor[]): void;
|
|
291
|
-
/** Поиск людей для «@» (null — источник не настроен, упоминания в комментариях выключены). */
|
|
292
|
-
findUsers: ((query: string) => Promise<MentionUser[]>) | null;
|
|
293
|
-
/** Фрагменты текста ветки (пусто — текст удалён). */
|
|
294
|
-
ranges(id: string): {
|
|
295
|
-
from: number;
|
|
296
|
-
to: number;
|
|
297
|
-
}[];
|
|
298
|
-
quote(id: string): string;
|
|
299
|
-
/** Порядок веток по месту в документе. */
|
|
300
|
-
positionOf(id: string): number;
|
|
301
|
-
deleteThread(id: string): void;
|
|
302
|
-
setResolved(id: string, resolved: boolean): void;
|
|
303
|
-
canEdit(comment: Comment): boolean;
|
|
304
|
-
isPanelOpen(): boolean;
|
|
305
|
-
openPanel(): Promise<void>;
|
|
306
|
-
closePanel(): void;
|
|
307
|
-
}
|
|
308
|
-
/** Контроллер комментариев редактора (если подключён плагин comments). */
|
|
309
|
-
declare function getComments(editor: Editor): CommentsController | undefined;
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Плагин mergetags: переменные шаблона («Имя клиента», «Номер заказа»), которые ваш сервер
|
|
313
|
-
* заменит значениями при печати или отправке. В тексте — нередактируемая «фишка», в HTML —
|
|
314
|
-
* `<span data-mergetag="client">Имя клиента</span>` (имя атрибута настраивается).
|
|
315
|
-
*
|
|
316
|
-
* `plugins: ['mergetags']`, список — `pluginOptions.mergetags.list`. Вставка — кнопка `mergetags`
|
|
317
|
-
* или ввод `{{` в тексте. Переменные, которых нет в списке, не теряются: показываются по ключу.
|
|
318
|
-
*/
|
|
319
|
-
interface MergeTag {
|
|
320
|
-
/** Ключ, который увидит ваш сервер: 'client', 'order.number'. */
|
|
321
|
-
key: string;
|
|
322
|
-
/** Подпись в редакторе: 'Имя клиента'. */
|
|
323
|
-
label: string;
|
|
324
|
-
}
|
|
325
|
-
interface MergeTagGroup {
|
|
326
|
-
title: string;
|
|
327
|
-
items: MergeTag[];
|
|
328
|
-
}
|
|
329
|
-
interface MergeTagsOptions {
|
|
330
|
-
/** Переменные — списком или по группам. */
|
|
331
|
-
list?: (MergeTag | MergeTagGroup)[];
|
|
332
|
-
/** Атрибут с ключом в HTML. По умолчанию 'data-mergetag'. */
|
|
333
|
-
attribute?: string;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Quickbars: панели «по месту», как одноимённый плагин TinyMCE.
|
|
338
|
-
* - над выделенным текстом — быстрое форматирование;
|
|
339
|
-
* - на пустой строке — быстрая вставка (картинка, таблица).
|
|
340
|
-
*
|
|
341
|
-
* Настройки (pluginOptions.quickbars), false — выключить панель:
|
|
342
|
-
* { selection: 'bold italic | quicklink h2 h3 blockquote', insert: 'quickimage quicktable' }
|
|
343
|
-
*/
|
|
344
|
-
interface QuickbarsOptions {
|
|
345
|
-
selection?: string | false;
|
|
346
|
-
insert?: string | false;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Плагин revisionhistory (имя как у TinyMCE): история версий документа.
|
|
351
|
-
* Список версий, просмотр версии с подсветкой отличий от текущего текста, восстановление
|
|
352
|
-
* (обычная правка — отменяется Ctrl+Z). Откуда версии — решает приложение: `pluginOptions.revisionhistory`
|
|
353
|
-
* ({@link RevisionHistoryOptions}); при совместном редактировании — `sync.versions()` из @novaprose/collab.
|
|
354
|
-
*/
|
|
355
|
-
interface Revision {
|
|
356
|
-
id: string;
|
|
357
|
-
/** Время версии, мс с 1970. */
|
|
358
|
-
createdAt: number;
|
|
359
|
-
/** Кто менял документ в этой версии. */
|
|
360
|
-
authors?: string[];
|
|
361
|
-
/** Имя версии («Отправлено юристам»), если её сохранили вручную. */
|
|
362
|
-
label?: string | null;
|
|
363
|
-
}
|
|
364
|
-
interface RevisionHistoryOptions {
|
|
365
|
-
/** Список версий (порядок не важен — показываем новые сверху). */
|
|
366
|
-
list: () => Promise<Revision[]>;
|
|
367
|
-
/** Содержимое версии: HTML или JSON документа. */
|
|
368
|
-
load: (revision: Revision, editor: Editor) => Promise<string | Record<string, unknown>>;
|
|
369
|
-
/** «Сохранить версию» (кнопка появляется, если задано). */
|
|
370
|
-
save?: (label?: string) => Promise<void>;
|
|
371
|
-
/** Версию восстановили (уже после замены содержимого). */
|
|
372
|
-
onRestore?: (revision: Revision) => void;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* Базовая схема документа NovaProse (P0 из PRD §4.1–4.2).
|
|
377
|
-
* Каждый узел и марка описывают и парсинг HTML (parseDOM), и сериализацию (toDOM),
|
|
378
|
-
* поэтому HTML на входе и выходе предсказуем.
|
|
379
|
-
*/
|
|
380
|
-
declare const ALIGNMENTS: readonly ["left", "center", "right", "justify"];
|
|
381
|
-
type TextAlign = (typeof ALIGNMENTS)[number];
|
|
382
|
-
declare const cssValue: {
|
|
383
|
-
color: (v: unknown) => string | null;
|
|
384
|
-
length: (v: unknown) => string | null;
|
|
385
|
-
lineHeight: (v: unknown) => string | null;
|
|
386
|
-
fontFamily: (v: unknown) => string | null;
|
|
387
|
-
};
|
|
388
|
-
type TextDirection = 'ltr' | 'rtl';
|
|
389
|
-
type ImageAlign = 'left' | 'center' | 'right';
|
|
390
|
-
/** Размер картинки в px: целое 1…10000, иначе null ('300', '300px', 300). */
|
|
391
|
-
declare function imageSize(value: unknown): number | null;
|
|
392
|
-
/** Какие классы из HTML сохранять. По умолчанию — никакие: вывод без классов, как раньше. */
|
|
393
|
-
type ClassFilter = (className: string) => boolean;
|
|
394
|
-
declare const nodes: {
|
|
395
|
-
table: NodeSpec;
|
|
396
|
-
table_row: NodeSpec;
|
|
397
|
-
table_cell: NodeSpec;
|
|
398
|
-
table_header: NodeSpec;
|
|
399
|
-
doc: {
|
|
400
|
-
content: string;
|
|
401
|
-
};
|
|
402
|
-
paragraph: {
|
|
403
|
-
group: string;
|
|
404
|
-
content: string;
|
|
405
|
-
attrs: {
|
|
406
|
-
class: {
|
|
407
|
-
default: null;
|
|
408
|
-
};
|
|
409
|
-
align: {
|
|
410
|
-
default: null;
|
|
411
|
-
};
|
|
412
|
-
lineHeight: {
|
|
413
|
-
default: null;
|
|
414
|
-
};
|
|
415
|
-
dir: {
|
|
416
|
-
default: null;
|
|
417
|
-
};
|
|
418
|
-
};
|
|
419
|
-
parseDOM: {
|
|
420
|
-
tag: string;
|
|
421
|
-
getAttrs: (dom: HTMLElement) => {
|
|
422
|
-
class: string | null;
|
|
423
|
-
align: TextAlign | null;
|
|
424
|
-
lineHeight: string | null;
|
|
425
|
-
dir: TextDirection | null;
|
|
426
|
-
};
|
|
427
|
-
}[];
|
|
428
|
-
toDOM: (node: prosemirror_model.Node) => DOMOutputSpec;
|
|
429
|
-
};
|
|
430
|
-
heading: {
|
|
431
|
-
group: string;
|
|
432
|
-
content: string;
|
|
433
|
-
defining: true;
|
|
434
|
-
attrs: {
|
|
435
|
-
class: {
|
|
436
|
-
default: null;
|
|
437
|
-
};
|
|
438
|
-
align: {
|
|
439
|
-
default: null;
|
|
440
|
-
};
|
|
441
|
-
lineHeight: {
|
|
442
|
-
default: null;
|
|
443
|
-
};
|
|
444
|
-
dir: {
|
|
445
|
-
default: null;
|
|
446
|
-
};
|
|
447
|
-
level: {
|
|
448
|
-
default: number;
|
|
449
|
-
};
|
|
450
|
-
};
|
|
451
|
-
parseDOM: {
|
|
452
|
-
tag: string;
|
|
453
|
-
getAttrs: (dom: HTMLElement) => {
|
|
454
|
-
class: string | null;
|
|
455
|
-
align: TextAlign | null;
|
|
456
|
-
lineHeight: string | null;
|
|
457
|
-
dir: TextDirection | null;
|
|
458
|
-
level: number;
|
|
459
|
-
};
|
|
460
|
-
}[];
|
|
461
|
-
toDOM: (node: prosemirror_model.Node) => DOMOutputSpec;
|
|
462
|
-
};
|
|
463
|
-
blockquote: {
|
|
464
|
-
group: string;
|
|
465
|
-
content: string;
|
|
466
|
-
defining: true;
|
|
467
|
-
attrs: {
|
|
468
|
-
class: {
|
|
469
|
-
default: null;
|
|
470
|
-
};
|
|
471
|
-
};
|
|
472
|
-
parseDOM: {
|
|
473
|
-
tag: string;
|
|
474
|
-
getAttrs: (dom: HTMLElement) => {
|
|
475
|
-
class: string | null;
|
|
476
|
-
};
|
|
477
|
-
}[];
|
|
478
|
-
toDOM: (node: prosemirror_model.Node) => DOMOutputSpec;
|
|
479
|
-
};
|
|
480
|
-
horizontal_rule: {
|
|
481
|
-
group: string;
|
|
482
|
-
parseDOM: {
|
|
483
|
-
tag: string;
|
|
484
|
-
}[];
|
|
485
|
-
toDOM: () => DOMOutputSpec;
|
|
486
|
-
};
|
|
487
|
-
code_block: {
|
|
488
|
-
group: string;
|
|
489
|
-
content: string;
|
|
490
|
-
marks: string;
|
|
491
|
-
code: true;
|
|
492
|
-
defining: true;
|
|
493
|
-
attrs: {
|
|
494
|
-
language: {
|
|
495
|
-
default: null;
|
|
496
|
-
};
|
|
497
|
-
};
|
|
498
|
-
parseDOM: {
|
|
499
|
-
tag: string;
|
|
500
|
-
preserveWhitespace: "full";
|
|
501
|
-
getAttrs: (dom: HTMLElement) => {
|
|
502
|
-
language: string | null;
|
|
503
|
-
};
|
|
504
|
-
}[];
|
|
505
|
-
toDOM: (node: prosemirror_model.Node) => DOMOutputSpec;
|
|
506
|
-
};
|
|
507
|
-
bullet_list: {
|
|
508
|
-
group: string;
|
|
509
|
-
content: string;
|
|
510
|
-
attrs: {
|
|
511
|
-
listStyle: {
|
|
512
|
-
default: null;
|
|
513
|
-
};
|
|
514
|
-
};
|
|
515
|
-
parseDOM: {
|
|
516
|
-
tag: string;
|
|
517
|
-
getAttrs: (dom: HTMLElement) => {
|
|
518
|
-
listStyle: string | null;
|
|
519
|
-
};
|
|
520
|
-
}[];
|
|
521
|
-
toDOM: (node: prosemirror_model.Node) => DOMOutputSpec;
|
|
522
|
-
};
|
|
523
|
-
ordered_list: {
|
|
524
|
-
group: string;
|
|
525
|
-
content: string;
|
|
526
|
-
attrs: {
|
|
527
|
-
start: {
|
|
528
|
-
default: number;
|
|
529
|
-
};
|
|
530
|
-
listStyle: {
|
|
531
|
-
default: null;
|
|
532
|
-
};
|
|
533
|
-
};
|
|
534
|
-
parseDOM: {
|
|
535
|
-
tag: string;
|
|
536
|
-
getAttrs: (dom: HTMLElement) => {
|
|
537
|
-
start: number;
|
|
538
|
-
listStyle: string | null;
|
|
539
|
-
};
|
|
540
|
-
}[];
|
|
541
|
-
toDOM: (node: prosemirror_model.Node) => DOMOutputSpec;
|
|
542
|
-
};
|
|
543
|
-
list_item: {
|
|
544
|
-
content: string;
|
|
545
|
-
defining: true;
|
|
546
|
-
parseDOM: {
|
|
547
|
-
tag: string;
|
|
548
|
-
}[];
|
|
549
|
-
toDOM: () => DOMOutputSpec;
|
|
550
|
-
};
|
|
551
|
-
text: {
|
|
552
|
-
group: string;
|
|
553
|
-
};
|
|
554
|
-
image: {
|
|
555
|
-
group: string;
|
|
556
|
-
inline: true;
|
|
557
|
-
draggable: true;
|
|
558
|
-
attrs: {
|
|
559
|
-
class: {
|
|
560
|
-
default: null;
|
|
561
|
-
};
|
|
562
|
-
src: {};
|
|
563
|
-
alt: {
|
|
564
|
-
default: null;
|
|
565
|
-
};
|
|
566
|
-
title: {
|
|
567
|
-
default: null;
|
|
568
|
-
};
|
|
569
|
-
width: {
|
|
570
|
-
default: null;
|
|
571
|
-
};
|
|
572
|
-
height: {
|
|
573
|
-
default: null;
|
|
574
|
-
};
|
|
575
|
-
align: {
|
|
576
|
-
default: null;
|
|
577
|
-
};
|
|
578
|
-
};
|
|
579
|
-
parseDOM: {
|
|
580
|
-
tag: string;
|
|
581
|
-
getAttrs: (dom: HTMLElement) => false | {
|
|
582
|
-
src: string | null;
|
|
583
|
-
alt: string | null;
|
|
584
|
-
title: string | null;
|
|
585
|
-
width: number | null;
|
|
586
|
-
height: number | null;
|
|
587
|
-
align: ImageAlign | null;
|
|
588
|
-
class: string | null;
|
|
589
|
-
};
|
|
590
|
-
}[];
|
|
591
|
-
toDOM: (node: prosemirror_model.Node) => DOMOutputSpec;
|
|
592
|
-
};
|
|
593
|
-
hard_break: {
|
|
594
|
-
group: string;
|
|
595
|
-
inline: true;
|
|
596
|
-
selectable: false;
|
|
597
|
-
parseDOM: {
|
|
598
|
-
tag: string;
|
|
599
|
-
}[];
|
|
600
|
-
toDOM: () => DOMOutputSpec;
|
|
601
|
-
};
|
|
602
|
-
};
|
|
603
|
-
declare const marks: {
|
|
604
|
-
link: {
|
|
605
|
-
attrs: {
|
|
606
|
-
href: {};
|
|
607
|
-
title: {
|
|
608
|
-
default: null;
|
|
609
|
-
};
|
|
610
|
-
target: {
|
|
611
|
-
default: null;
|
|
612
|
-
};
|
|
613
|
-
};
|
|
614
|
-
inclusive: false;
|
|
615
|
-
parseDOM: {
|
|
616
|
-
tag: string;
|
|
617
|
-
getAttrs: (dom: HTMLElement) => false | {
|
|
618
|
-
href: string | null;
|
|
619
|
-
title: string | null;
|
|
620
|
-
target: string | null;
|
|
621
|
-
};
|
|
622
|
-
}[];
|
|
623
|
-
toDOM: (mark: prosemirror_model.Mark) => DOMOutputSpec;
|
|
624
|
-
};
|
|
625
|
-
bold: {
|
|
626
|
-
parseDOM: ({
|
|
627
|
-
tag: string;
|
|
628
|
-
getAttrs?: undefined;
|
|
629
|
-
style?: undefined;
|
|
630
|
-
} | {
|
|
631
|
-
tag: string;
|
|
632
|
-
getAttrs: (dom: HTMLElement) => false | null;
|
|
633
|
-
style?: undefined;
|
|
634
|
-
} | {
|
|
635
|
-
style: string;
|
|
636
|
-
getAttrs: (value: string) => false | null;
|
|
637
|
-
tag?: undefined;
|
|
638
|
-
})[];
|
|
639
|
-
toDOM: () => DOMOutputSpec;
|
|
640
|
-
};
|
|
641
|
-
italic: {
|
|
642
|
-
parseDOM: ({
|
|
643
|
-
tag: string;
|
|
644
|
-
style?: undefined;
|
|
645
|
-
} | {
|
|
646
|
-
style: string;
|
|
647
|
-
tag?: undefined;
|
|
648
|
-
})[];
|
|
649
|
-
toDOM: () => DOMOutputSpec;
|
|
650
|
-
};
|
|
651
|
-
underline: {
|
|
652
|
-
parseDOM: ({
|
|
653
|
-
tag: string;
|
|
654
|
-
style?: undefined;
|
|
655
|
-
} | {
|
|
656
|
-
style: string;
|
|
657
|
-
tag?: undefined;
|
|
658
|
-
})[];
|
|
659
|
-
toDOM: () => DOMOutputSpec;
|
|
660
|
-
};
|
|
661
|
-
strike: {
|
|
662
|
-
parseDOM: ({
|
|
663
|
-
tag: string;
|
|
664
|
-
style?: undefined;
|
|
665
|
-
} | {
|
|
666
|
-
style: string;
|
|
667
|
-
tag?: undefined;
|
|
668
|
-
})[];
|
|
669
|
-
toDOM: () => DOMOutputSpec;
|
|
670
|
-
};
|
|
671
|
-
code: {
|
|
672
|
-
parseDOM: {
|
|
673
|
-
tag: string;
|
|
674
|
-
}[];
|
|
675
|
-
toDOM: () => DOMOutputSpec;
|
|
676
|
-
};
|
|
677
|
-
subscript: {
|
|
678
|
-
excludes: string;
|
|
679
|
-
parseDOM: ({
|
|
680
|
-
tag: string;
|
|
681
|
-
style?: undefined;
|
|
682
|
-
} | {
|
|
683
|
-
style: string;
|
|
684
|
-
tag?: undefined;
|
|
685
|
-
})[];
|
|
686
|
-
toDOM: () => DOMOutputSpec;
|
|
687
|
-
};
|
|
688
|
-
superscript: {
|
|
689
|
-
excludes: string;
|
|
690
|
-
parseDOM: ({
|
|
691
|
-
tag: string;
|
|
692
|
-
style?: undefined;
|
|
693
|
-
} | {
|
|
694
|
-
style: string;
|
|
695
|
-
tag?: undefined;
|
|
696
|
-
})[];
|
|
697
|
-
toDOM: () => DOMOutputSpec;
|
|
698
|
-
};
|
|
699
|
-
color: {
|
|
700
|
-
attrs: {
|
|
701
|
-
value: {};
|
|
702
|
-
};
|
|
703
|
-
parseDOM: ({
|
|
704
|
-
style: string;
|
|
705
|
-
getAttrs: (v: string) => false | {
|
|
706
|
-
value: string;
|
|
707
|
-
};
|
|
708
|
-
tag?: undefined;
|
|
709
|
-
} | {
|
|
710
|
-
tag: string;
|
|
711
|
-
getAttrs: (dom: HTMLElement) => false | {
|
|
712
|
-
value: string;
|
|
713
|
-
};
|
|
714
|
-
style?: undefined;
|
|
715
|
-
})[];
|
|
716
|
-
toDOM: (mark: prosemirror_model.Mark) => DOMOutputSpec;
|
|
717
|
-
};
|
|
718
|
-
background: {
|
|
719
|
-
attrs: {
|
|
720
|
-
value: {};
|
|
721
|
-
};
|
|
722
|
-
parseDOM: ({
|
|
723
|
-
style: string;
|
|
724
|
-
getAttrs: (v: string) => false | {
|
|
725
|
-
value: string;
|
|
726
|
-
};
|
|
727
|
-
tag?: undefined;
|
|
728
|
-
} | {
|
|
729
|
-
tag: string;
|
|
730
|
-
getAttrs: () => {
|
|
731
|
-
value: string;
|
|
732
|
-
};
|
|
733
|
-
style?: undefined;
|
|
734
|
-
})[];
|
|
735
|
-
toDOM: (mark: prosemirror_model.Mark) => DOMOutputSpec;
|
|
736
|
-
};
|
|
737
|
-
font_family: {
|
|
738
|
-
attrs: {
|
|
739
|
-
value: {};
|
|
740
|
-
};
|
|
741
|
-
parseDOM: {
|
|
742
|
-
style: string;
|
|
743
|
-
getAttrs: (v: string) => false | {
|
|
744
|
-
value: string;
|
|
745
|
-
};
|
|
746
|
-
}[];
|
|
747
|
-
toDOM: (mark: prosemirror_model.Mark) => DOMOutputSpec;
|
|
748
|
-
};
|
|
749
|
-
font_size: {
|
|
750
|
-
attrs: {
|
|
751
|
-
value: {};
|
|
752
|
-
};
|
|
753
|
-
parseDOM: {
|
|
754
|
-
style: string;
|
|
755
|
-
getAttrs: (v: string) => false | {
|
|
756
|
-
value: string;
|
|
757
|
-
};
|
|
758
|
-
}[];
|
|
759
|
-
toDOM: (mark: prosemirror_model.Mark) => DOMOutputSpec;
|
|
760
|
-
};
|
|
761
|
-
/** <span class="…"> — инлайн-стиль из style_formats. Только разрешённые классы. */
|
|
762
|
-
span_class: {
|
|
763
|
-
attrs: {
|
|
764
|
-
class: {};
|
|
765
|
-
};
|
|
766
|
-
parseDOM: {
|
|
767
|
-
tag: string;
|
|
768
|
-
consuming: false;
|
|
769
|
-
getAttrs: (dom: HTMLElement) => false | {
|
|
770
|
-
class: string;
|
|
771
|
-
};
|
|
772
|
-
}[];
|
|
773
|
-
toDOM: (mark: prosemirror_model.Mark) => DOMOutputSpec;
|
|
774
|
-
};
|
|
775
|
-
};
|
|
776
|
-
type NodeName = keyof typeof nodes;
|
|
777
|
-
type MarkName = keyof typeof marks;
|
|
778
|
-
/**
|
|
779
|
-
* Схема редактора: базовые узлы и марки + расширения плагинов. Тип оставляем «базовым»: встроенный
|
|
780
|
-
* код обращается только к своим узлам (`schema.nodes.paragraph`), а узлы плагинов доступны по имени.
|
|
781
|
-
*/
|
|
782
|
-
type NovaSchema = Schema<NodeName, MarkName>;
|
|
783
|
-
/** Базовая схема без расширений — у редакторов без плагинов-узлов она общая. */
|
|
784
|
-
declare const schema: NovaSchema;
|
|
785
|
-
interface SchemaExtensions {
|
|
786
|
-
nodes?: Record<string, NodeSpec>;
|
|
787
|
-
marks?: Record<string, MarkSpec>;
|
|
788
|
-
}
|
|
789
|
-
/**
|
|
790
|
-
* Схема с узлами и марками плагинов. Без расширений возвращает общую базовую схему.
|
|
791
|
-
* Новые узлы и марки добавляются в конец: базовые правила разбора HTML остаются в приоритете,
|
|
792
|
-
* если плагин не задал свой `priority` в parseDOM.
|
|
793
|
-
*/
|
|
794
|
-
declare function createSchema(extensions?: SchemaExtensions,
|
|
795
|
-
/** Какие классы сохранять (style_formats, validClasses). Без фильтра — никакие. */
|
|
796
|
-
classFilter?: ClassFilter): NovaSchema;
|
|
797
|
-
|
|
798
|
-
/** Именованные команды редактора. Имена — часть публичного API (см. Editor.exec). */
|
|
799
|
-
type CommandName = 'bold' | 'italic' | 'underline' | 'strike' | 'code' | 'subscript' | 'superscript' | 'paragraph' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'blockquote' | 'codeBlock' | 'bulletList' | 'orderedList' | 'indent' | 'outdent' | 'alignLeft' | 'alignCenter' | 'alignRight' | 'alignJustify' | 'horizontalRule' | 'unlink' | 'clearFormatting' | 'undo' | 'redo';
|
|
800
|
-
/**
|
|
801
|
-
* Типы узлов и марок берём из схемы конкретного редактора (state.schema): у редакторов с плагинами
|
|
802
|
-
* она своя, и сравнение с типами общей базовой схемы дало бы ложь.
|
|
803
|
-
*/
|
|
804
|
-
declare const nodesOf: (state: EditorState) => {
|
|
805
|
-
readonly table: NodeType;
|
|
806
|
-
readonly table_row: NodeType;
|
|
807
|
-
readonly table_cell: NodeType;
|
|
808
|
-
readonly table_header: NodeType;
|
|
809
|
-
readonly doc: NodeType;
|
|
810
|
-
readonly paragraph: NodeType;
|
|
811
|
-
readonly heading: NodeType;
|
|
812
|
-
readonly blockquote: NodeType;
|
|
813
|
-
readonly horizontal_rule: NodeType;
|
|
814
|
-
readonly code_block: NodeType;
|
|
815
|
-
readonly bullet_list: NodeType;
|
|
816
|
-
readonly ordered_list: NodeType;
|
|
817
|
-
readonly list_item: NodeType;
|
|
818
|
-
readonly text: NodeType;
|
|
819
|
-
readonly image: NodeType;
|
|
820
|
-
readonly hard_break: NodeType;
|
|
821
|
-
} & {
|
|
822
|
-
readonly [key: string]: NodeType;
|
|
823
|
-
};
|
|
824
|
-
declare const marksOf: (state: EditorState) => {
|
|
825
|
-
readonly background: MarkType;
|
|
826
|
-
readonly code: MarkType;
|
|
827
|
-
readonly link: MarkType;
|
|
828
|
-
readonly bold: MarkType;
|
|
829
|
-
readonly italic: MarkType;
|
|
830
|
-
readonly underline: MarkType;
|
|
831
|
-
readonly strike: MarkType;
|
|
832
|
-
readonly subscript: MarkType;
|
|
833
|
-
readonly superscript: MarkType;
|
|
834
|
-
readonly color: MarkType;
|
|
835
|
-
readonly font_family: MarkType;
|
|
836
|
-
readonly font_size: MarkType;
|
|
837
|
-
readonly span_class: MarkType;
|
|
838
|
-
} & {
|
|
839
|
-
readonly [key: string]: MarkType;
|
|
840
|
-
};
|
|
841
|
-
declare const commands: Record<CommandName, Command>;
|
|
842
|
-
/** Вставить или обновить ссылку на выделении. */
|
|
843
|
-
declare function setLink(href: string, attrs?: {
|
|
844
|
-
title?: string;
|
|
845
|
-
target?: string;
|
|
846
|
-
}): Command;
|
|
847
|
-
/** Вставить изображение на место выделения. */
|
|
848
|
-
declare function insertImage(src: string, alt?: string): Command;
|
|
849
|
-
declare function isMarkActive(state: EditorState, type: MarkType): boolean;
|
|
850
|
-
declare function isNodeActive(state: EditorState, type: NodeType, attrs?: Record<string, unknown>): boolean;
|
|
851
|
-
declare function getActiveAlign(state: EditorState): TextAlign;
|
|
852
|
-
/**
|
|
853
|
-
* Активна ли команда в текущем выделении: марка применена, блок нужного типа, выравнивание совпадает.
|
|
854
|
-
* Для команд-действий (undo, indent, horizontalRule…) всегда `false`.
|
|
855
|
-
*/
|
|
856
|
-
declare function isCommandActive(state: EditorState, command: CommandName): boolean;
|
|
857
|
-
declare function getLinkAt(state: EditorState): {
|
|
858
|
-
href: string;
|
|
859
|
-
title: string | null;
|
|
860
|
-
target: string | null;
|
|
861
|
-
} | null;
|
|
862
|
-
|
|
863
|
-
/** Английские строки UI — язык по умолчанию и эталон набора ключей для остальных языков. */
|
|
864
|
-
declare const en: {
|
|
865
|
-
readonly 'toolbar.label': "Formatting";
|
|
866
|
-
readonly 'toolbar.options': "options";
|
|
867
|
-
readonly 'editor.label': "Rich text editor";
|
|
868
|
-
readonly 'editor.required': "Please fill in this field.";
|
|
869
|
-
readonly undo: "Undo";
|
|
870
|
-
readonly redo: "Redo";
|
|
871
|
-
readonly bold: "Bold";
|
|
872
|
-
readonly italic: "Italic";
|
|
873
|
-
readonly underline: "Underline";
|
|
874
|
-
readonly strike: "Strikethrough";
|
|
875
|
-
readonly code: "Inline code";
|
|
876
|
-
readonly subscript: "Subscript";
|
|
877
|
-
readonly superscript: "Superscript";
|
|
878
|
-
readonly link: "Link";
|
|
879
|
-
readonly unlink: "Remove link";
|
|
880
|
-
readonly image: "Image";
|
|
881
|
-
readonly bulletList: "Bulleted list";
|
|
882
|
-
readonly orderedList: "Numbered list";
|
|
883
|
-
readonly indent: "Increase indent";
|
|
884
|
-
readonly outdent: "Decrease indent";
|
|
885
|
-
readonly align: "Alignment";
|
|
886
|
-
readonly alignLeft: "Align left";
|
|
887
|
-
readonly alignCenter: "Align center";
|
|
888
|
-
readonly alignRight: "Align right";
|
|
889
|
-
readonly alignJustify: "Justify";
|
|
890
|
-
readonly blockquote: "Quote";
|
|
891
|
-
readonly codeBlock: "Code block";
|
|
892
|
-
readonly horizontalRule: "Horizontal line";
|
|
893
|
-
readonly clearFormatting: "Clear formatting";
|
|
894
|
-
readonly more: "More";
|
|
895
|
-
readonly moreFormats: "More formatting";
|
|
896
|
-
readonly blocks: "Text style";
|
|
897
|
-
readonly styles: "Formats";
|
|
898
|
-
readonly 'styles.headings': "Headings";
|
|
899
|
-
readonly 'styles.inline': "Inline";
|
|
900
|
-
readonly 'styles.blocks': "Blocks";
|
|
901
|
-
readonly 'styles.align': "Align";
|
|
902
|
-
readonly paragraph: "Paragraph";
|
|
903
|
-
readonly h1: "Heading 1";
|
|
904
|
-
readonly h2: "Heading 2";
|
|
905
|
-
readonly h3: "Heading 3";
|
|
906
|
-
readonly h4: "Heading 4";
|
|
907
|
-
readonly h5: "Heading 5";
|
|
908
|
-
readonly h6: "Heading 6";
|
|
909
|
-
readonly fontFamily: "Font";
|
|
910
|
-
readonly fontSize: "Font size";
|
|
911
|
-
readonly lineHeight: "Line height";
|
|
912
|
-
readonly default: "Default";
|
|
913
|
-
readonly textColor: "Text color";
|
|
914
|
-
readonly backgroundColor: "Highlight color";
|
|
915
|
-
readonly removeColor: "Remove color";
|
|
916
|
-
readonly customColor: "Custom color";
|
|
917
|
-
readonly 'dialog.cancel': "Cancel";
|
|
918
|
-
readonly 'dialog.save': "Save";
|
|
919
|
-
readonly 'dialog.insert': "Insert";
|
|
920
|
-
readonly 'dialog.close': "Close";
|
|
921
|
-
readonly 'link.title': "Insert link";
|
|
922
|
-
readonly 'link.editTitle': "Edit link";
|
|
923
|
-
readonly 'link.url': "URL";
|
|
924
|
-
readonly 'link.text': "Text to display";
|
|
925
|
-
readonly 'link.tooltip': "Title (tooltip)";
|
|
926
|
-
readonly 'link.newTab': "Open in new tab";
|
|
927
|
-
readonly 'link.open': "Open link";
|
|
928
|
-
readonly 'link.edit': "Edit link";
|
|
929
|
-
readonly 'link.copy': "Copy link";
|
|
930
|
-
readonly 'link.copied': "Link copied";
|
|
931
|
-
readonly 'link.invalid': "This URL is not allowed";
|
|
932
|
-
readonly 'image.title': "Insert image";
|
|
933
|
-
readonly 'image.url': "Image URL";
|
|
934
|
-
readonly 'image.alt': "Alternative text";
|
|
935
|
-
readonly 'image.altHint': "Describe the image for people using screen readers";
|
|
936
|
-
readonly 'image.upload': "Upload";
|
|
937
|
-
readonly 'image.drop': "Drop an image here or click to choose";
|
|
938
|
-
readonly 'image.uploading': "Uploading image…";
|
|
939
|
-
readonly 'image.uploadFailed': "Image upload failed";
|
|
940
|
-
readonly 'image.invalid': "This image URL is not allowed";
|
|
941
|
-
readonly 'image.or': "or";
|
|
942
|
-
readonly 'image.toolbar': "Image options";
|
|
943
|
-
readonly 'image.alignLeft': "Float left";
|
|
944
|
-
readonly 'image.alignCenter': "Center";
|
|
945
|
-
readonly 'image.alignRight': "Float right";
|
|
946
|
-
readonly 'image.editAlt': "Alternative text";
|
|
947
|
-
readonly 'image.size': "Size";
|
|
948
|
-
readonly 'image.sizeSmall': "Small (25%)";
|
|
949
|
-
readonly 'image.sizeMedium': "Medium (50%)";
|
|
950
|
-
readonly 'image.sizeLarge': "Large (75%)";
|
|
951
|
-
readonly 'image.sizeFull': "Full width";
|
|
952
|
-
readonly 'image.sizeOriginal': "Original size";
|
|
953
|
-
readonly 'image.delete': "Remove image";
|
|
954
|
-
readonly 'status.words': "{count} words";
|
|
955
|
-
readonly 'status.resize': "Resize editor";
|
|
956
|
-
readonly 'dialog.browse': "Browse";
|
|
957
|
-
readonly pasteAsText: "Paste as text";
|
|
958
|
-
readonly 'menu.label': "Menu";
|
|
959
|
-
readonly 'menu.file': "File";
|
|
960
|
-
readonly 'menu.edit': "Edit";
|
|
961
|
-
readonly 'menu.view': "View";
|
|
962
|
-
readonly 'menu.insert': "Insert";
|
|
963
|
-
readonly 'menu.format': "Format";
|
|
964
|
-
readonly 'menu.table': "Table";
|
|
965
|
-
readonly 'menu.help': "Help";
|
|
966
|
-
readonly selectAll: "Select all";
|
|
967
|
-
readonly print: "Print";
|
|
968
|
-
readonly 'table.rows': "Rows";
|
|
969
|
-
readonly 'table.cols': "Columns";
|
|
970
|
-
readonly 'table.invalidSize': "Enter a number from 1 to 50";
|
|
971
|
-
readonly 'quickbars.selection': "Quick formatting";
|
|
972
|
-
readonly 'quickbars.insert': "Quick insert";
|
|
973
|
-
readonly 'search.title': "Find and replace";
|
|
974
|
-
readonly 'search.find': "Find";
|
|
975
|
-
readonly 'search.replace': "Replace with";
|
|
976
|
-
readonly 'search.next': "Next match";
|
|
977
|
-
readonly 'search.prev': "Previous match";
|
|
978
|
-
readonly 'search.replaceOne': "Replace";
|
|
979
|
-
readonly 'search.replaceAll': "Replace all";
|
|
980
|
-
readonly 'search.matchCase': "Match case";
|
|
981
|
-
readonly 'search.wholeWord': "Whole words only";
|
|
982
|
-
readonly 'search.count': "{current} of {total}";
|
|
983
|
-
readonly 'search.none': "No results";
|
|
984
|
-
readonly fullscreen: "Fullscreen";
|
|
985
|
-
readonly preview: "Preview";
|
|
986
|
-
readonly sourceCode: "Source code";
|
|
987
|
-
readonly help: "Keyboard shortcuts";
|
|
988
|
-
readonly 'help.formatting': "Text formatting";
|
|
989
|
-
readonly 'help.blocks': "Paragraphs and lists";
|
|
990
|
-
readonly 'help.editing': "Editing";
|
|
991
|
-
readonly 'help.navigation': "Navigation";
|
|
992
|
-
readonly 'help.slash': "Insert block (slash commands)";
|
|
993
|
-
readonly 'help.toMenubar': "Move to the menu bar";
|
|
994
|
-
readonly 'help.toToolbar': "Move to the toolbar";
|
|
995
|
-
readonly 'help.toContextToolbar': "Move to the image/table toolbar";
|
|
996
|
-
readonly 'help.toEditor': "Back to the text";
|
|
997
|
-
readonly 'help.nextCell': "Next table cell";
|
|
998
|
-
readonly table: "Table";
|
|
999
|
-
readonly 'table.insert': "Insert table";
|
|
1000
|
-
readonly 'table.size': "{rows} × {cols}";
|
|
1001
|
-
readonly 'table.toolbar': "Table options";
|
|
1002
|
-
readonly 'table.rowBefore': "Insert row above";
|
|
1003
|
-
readonly 'table.rowAfter': "Insert row below";
|
|
1004
|
-
readonly 'table.rowDelete': "Delete row";
|
|
1005
|
-
readonly 'table.colBefore': "Insert column left";
|
|
1006
|
-
readonly 'table.colAfter': "Insert column right";
|
|
1007
|
-
readonly 'table.colDelete': "Delete column";
|
|
1008
|
-
readonly 'table.merge': "Merge cells";
|
|
1009
|
-
readonly 'table.split': "Split cell";
|
|
1010
|
-
readonly 'table.rowHeader': "Header row";
|
|
1011
|
-
readonly 'table.colHeader': "Header column";
|
|
1012
|
-
readonly 'table.cellBackground': "Cell background";
|
|
1013
|
-
readonly 'table.delete': "Delete table";
|
|
1014
|
-
readonly 'table.sort': "Sort";
|
|
1015
|
-
readonly 'table.sortAsc': "Sort A → Z, 1 → 9";
|
|
1016
|
-
readonly 'table.sortDesc': "Sort Z → A, 9 → 1";
|
|
1017
|
-
readonly 'table.props': "Table properties";
|
|
1018
|
-
readonly 'table.style': "Style";
|
|
1019
|
-
readonly 'table.styleDefault': "Default";
|
|
1020
|
-
readonly 'table.width': "Width";
|
|
1021
|
-
readonly 'table.widthHint': "For example 100% or 600px. Leave empty to fit the content.";
|
|
1022
|
-
readonly 'table.invalidWidth': "Enter a width such as 100% or 600px";
|
|
1023
|
-
readonly 'table.align': "Alignment on the page";
|
|
1024
|
-
readonly 'table.alignDefault': "Default";
|
|
1025
|
-
readonly 'table.alignCenter': "Center";
|
|
1026
|
-
readonly 'table.alignRight': "Right";
|
|
1027
|
-
readonly 'table.cellProps': "Cell properties";
|
|
1028
|
-
readonly 'table.valign': "Vertical alignment";
|
|
1029
|
-
readonly 'table.valignTop': "Top";
|
|
1030
|
-
readonly 'table.valignMiddle': "Middle";
|
|
1031
|
-
readonly 'table.valignBottom': "Bottom";
|
|
1032
|
-
readonly 'table.cellType': "Cell type";
|
|
1033
|
-
readonly 'table.cellData': "Data cell";
|
|
1034
|
-
readonly 'table.cellHeader': "Header cell";
|
|
1035
|
-
readonly 'table.colWidth': "Column width, px";
|
|
1036
|
-
readonly 'table.colWidthHint': "Leave empty to fit the content.";
|
|
1037
|
-
readonly 'table.invalidColWidth': "Enter a number from 24 to 4000";
|
|
1038
|
-
readonly 'slash.label': "Commands";
|
|
1039
|
-
readonly 'slash.empty': "No matching commands";
|
|
1040
|
-
};
|
|
1041
|
-
type MessageKey = keyof typeof en;
|
|
1042
|
-
type Messages = Record<MessageKey, string>;
|
|
1043
|
-
|
|
1044
|
-
declare const ru: Messages;
|
|
1045
|
-
|
|
1046
|
-
/** Зарегистрировать языковой пакет (BCP-47 код: 'de', 'pt-BR'). Недостающие ключи берутся из английского. */
|
|
1047
|
-
declare function registerLanguage(code: string, messages: Partial<Messages>): void;
|
|
1048
|
-
type Translator = (key: MessageKey, params?: Record<string, string | number>) => string;
|
|
1049
|
-
/**
|
|
1050
|
-
* Переводчик для экземпляра редактора. Ищет точный код ('pt-br'), затем базовый язык ('pt'),
|
|
1051
|
-
* затем английский. overrides — точечная замена строк из конфига.
|
|
12
|
+
* Print what the editor shows (with node views and the page's styles; with page layout, the same
|
|
13
|
+
* sheet). The print module is lazy: it loads on the first print.
|
|
1052
14
|
*/
|
|
1053
|
-
declare function createTranslator(language?: string, overrides?: Partial<Messages>): Translator;
|
|
1054
|
-
|
|
1055
|
-
/**
|
|
1056
|
-
* Загрузчик изображений (аналог images_upload_handler): получает файл, возвращает URL.
|
|
1057
|
-
* progress(0..100) — необязательный индикатор.
|
|
1058
|
-
*/
|
|
1059
|
-
type UploadImageHandler = (file: File, progress: (percent: number) => void) => Promise<string>;
|
|
1060
|
-
/**
|
|
1061
|
-
* Вставить и загрузить файлы изображений. Пока файл грузится, показываем его локальную копию
|
|
1062
|
-
* (blob:) полупрозрачной; после загрузки подменяем src, при ошибке — убираем и сообщаем.
|
|
1063
|
-
* Без uploadImage картинка встраивается как data:URL (как делает TinyMCE без обработчика).
|
|
1064
|
-
*/
|
|
1065
|
-
declare function uploadImages(editor: Editor, files: File[], pos?: number): void;
|
|
1066
|
-
/** Диалог вставки изображения: загрузка файла или URL + обязательный по смыслу alt. */
|
|
1067
|
-
declare function openImageDialog(editor: Editor): void;
|
|
1068
|
-
declare function getSelectedImage(state: EditorState): {
|
|
1069
|
-
node: Node;
|
|
1070
|
-
pos: number;
|
|
1071
|
-
} | null;
|
|
1072
|
-
/** Изменить атрибуты выделенной картинки (выделение узла сохраняется). */
|
|
1073
|
-
declare function setImageAttrs(attrs: Partial<Record<'alt' | 'title' | 'width' | 'height' | 'align', unknown>>): Command;
|
|
1074
|
-
/** Ширина картинки как доля ширины области текста (с сохранением пропорций); null — исходный размер. */
|
|
1075
|
-
declare function setImageWidthFraction(editor: Editor, fraction: number | null): boolean;
|
|
1076
|
-
/** Диалог альтернативного текста — главный пункт доступности картинки. */
|
|
1077
|
-
declare function openImageAltDialog(editor: Editor): void;
|
|
1078
|
-
|
|
1079
|
-
/** 'clean' (по умолчанию) — без шрифтов, кегля, интервалов и цветов «по умолчанию»; 'keep' — как есть. */
|
|
1080
|
-
type PasteStyles = 'clean' | 'keep';
|
|
1081
|
-
|
|
1082
|
-
/**
|
|
1083
|
-
* Обработка вставки:
|
|
1084
|
-
* - режим «Вставить как текст» (переключатель pastetext) — любое содержимое вставляется без форматирования;
|
|
1085
|
-
* - Ctrl/Cmd+Shift+V — разовая вставка без форматирования (ProseMirror сам отдаёт text/plain
|
|
1086
|
-
* при зажатом Shift; мы лишь гарантируем, что HTML-ветка не перехватит её);
|
|
1087
|
-
* - хуки pastePreprocess (строка HTML до разбора) и pastePostprocess (DOM после разбора браузером).
|
|
1088
|
-
*/
|
|
1089
|
-
interface PasteOptions {
|
|
1090
|
-
/** Изменить HTML до разбора: вернуть новую строку. */
|
|
1091
|
-
pastePreprocess?: (html: string, editor: Editor) => string;
|
|
1092
|
-
/** Изменить DOM после разбора: можно удалять/менять узлы на месте. */
|
|
1093
|
-
pastePostprocess?: (fragment: HTMLElement, editor: Editor) => void;
|
|
1094
|
-
/** Включить режим «вставить как текст» сразу. */
|
|
1095
|
-
pasteAsText?: boolean;
|
|
1096
|
-
/**
|
|
1097
|
-
* Оформление при вставке из Word, Google Docs, Excel и веб-страниц.
|
|
1098
|
-
* 'clean' (по умолчанию) — сохраняются жирный, курсив, цвета, списки, таблицы, ссылки, но не шрифт,
|
|
1099
|
-
* кегль и интервалы документа-источника; 'keep' — переносить и их.
|
|
1100
|
-
*/
|
|
1101
|
-
pasteStyles?: PasteStyles;
|
|
1102
|
-
}
|
|
1103
|
-
/** Превращает HTML в простой текст с сохранением абзацев (для режима «как текст»). */
|
|
1104
|
-
declare function htmlToPlainText(html: string): string;
|
|
1105
|
-
|
|
1106
|
-
interface MenuDefinition {
|
|
1107
|
-
/** Заголовок меню (строка) или ключ перевода. */
|
|
1108
|
-
title: string;
|
|
1109
|
-
/** Пункты через пробел, '|' — разделитель: 'undo redo | searchreplace'. */
|
|
1110
|
-
items: string;
|
|
1111
|
-
}
|
|
1112
|
-
/** Стандартные меню. Имена пунктов — из реестра пунктов меню или кнопок тулбара. */
|
|
1113
|
-
declare const DEFAULT_MENUS: Record<string, MenuDefinition>;
|
|
1114
|
-
declare const DEFAULT_MENUBAR = "file edit view insert format table help";
|
|
1115
|
-
|
|
1116
|
-
/**
|
|
1117
|
-
* Ограничение контента (аналог valid_elements / invalid_elements / valid_styles).
|
|
1118
|
-
*
|
|
1119
|
-
* Схема NovaProse одна на процесс, поэтому ограничения — не другая схема, а нормализатор:
|
|
1120
|
-
* всё запрещённое деградирует (жирный → текст, h1 → абзац, список → абзацы, таблица → содержимое)
|
|
1121
|
-
* при любом изменении документа — вставке, перетаскивании, setContent, горячих клавишах.
|
|
1122
|
-
*/
|
|
1123
|
-
interface ContentRulesOptions {
|
|
1124
|
-
/** Разрешены ТОЛЬКО эти элементы: 'p,strong/b,em/i,a[href],ul,ol'. Атрибуты в [...] пока не учитываются. */
|
|
1125
|
-
validElements?: string;
|
|
1126
|
-
/** Запрещённые элементы: 'img,table,h1'. */
|
|
1127
|
-
invalidElements?: string;
|
|
1128
|
-
/** Разрешённые CSS-свойства: 'color,text-align' или { '*': 'color', img: 'float' }. */
|
|
1129
|
-
validStyles?: string | Record<string, string>;
|
|
1130
|
-
}
|
|
1131
|
-
/** Все теги, которыми оперирует NovaProse. p и текст разрешены всегда. */
|
|
1132
|
-
declare const KNOWN_TAGS: readonly ["p", "h1", "h2", "h3", "h4", "h5", "h6", "blockquote", "pre", "hr", "ul", "ol", "li", "img", "br", "table", "tr", "td", "th", "strong", "em", "u", "s", "code", "a", "sub", "sup", "span"];
|
|
1133
|
-
/** Стили NovaProse и какой CSS-свойство каждый пишет. */
|
|
1134
|
-
declare const KNOWN_STYLES: readonly ["color", "background-color", "font-family", "font-size", "text-align", "line-height", "float", "width"];
|
|
1135
|
-
declare class ContentRules {
|
|
1136
|
-
private readonly tags;
|
|
1137
|
-
private readonly styles;
|
|
1138
|
-
constructor(options: ContentRulesOptions);
|
|
1139
|
-
isTagAllowed(tag: string): boolean;
|
|
1140
|
-
isStyleAllowed(property: string): boolean;
|
|
1141
|
-
/** Доступен ли контрол / пункт меню / слэш-команда (по имени). Неизвестные имена — разрешены. */
|
|
1142
|
-
isAllowed(name: string): boolean;
|
|
1143
|
-
private markAllowed;
|
|
1144
|
-
/** Атрибуты блока без запрещённых стилей. */
|
|
1145
|
-
private blockAttrs;
|
|
1146
|
-
/** Привести узел к правилам. Возвращает 0…n узлов (запрещённый блок может «раствориться»). */
|
|
1147
|
-
normalize(node: Node): Node[];
|
|
1148
|
-
normalizeChildren(fragment: Fragment): Fragment;
|
|
1149
|
-
/** Нормализовать документ целиком (начальное содержимое). */
|
|
1150
|
-
normalizeDoc(doc: Node): Node;
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
/**
|
|
1154
|
-
* Плагин NovaProse. Встроенные и сторонние плагины используют один и тот же API.
|
|
1155
|
-
*
|
|
1156
|
-
* ```ts
|
|
1157
|
-
* export default definePlugin({
|
|
1158
|
-
* name: 'signature',
|
|
1159
|
-
* setup(editor) {
|
|
1160
|
-
* editor.ui.registry.addButton('signature', { text: 'Подпись', tooltip: '…', onAction: … });
|
|
1161
|
-
* },
|
|
1162
|
-
* });
|
|
1163
|
-
* ```
|
|
1164
|
-
*/
|
|
1165
|
-
interface NovaPlugin {
|
|
1166
|
-
/** Уникальное имя; по нему плагин указывается в конфиге и в requires других плагинов. */
|
|
1167
|
-
name: string;
|
|
1168
|
-
/** Плагины, которые должны быть подключены раньше. */
|
|
1169
|
-
requires?: string[];
|
|
1170
|
-
/** Регистрация кнопок, команд, автокомплитеров. Может вернуть функцию очистки (при destroy). */
|
|
1171
|
-
setup?: (editor: Editor) => void | (() => void);
|
|
1172
|
-
/**
|
|
1173
|
-
* Кнопки, которые добавляются в конец тулбара по умолчанию ('insertdatetime').
|
|
1174
|
-
* Если пользователь задал свой toolbar — не добавляются: его конфиг главнее.
|
|
1175
|
-
*/
|
|
1176
|
-
toolbar?: string;
|
|
1177
|
-
/** ProseMirror-плагины (ввод, декорации, клавиши). */
|
|
1178
|
-
prosemirrorPlugins?: (editor: Editor) => Plugin[];
|
|
1179
|
-
/**
|
|
1180
|
-
* Новые узлы документа (с parseDOM и toDOM). Расширяют схему конкретного редактора.
|
|
1181
|
-
* Плагин с узлами или марками передаётся объектом, не ленивым загрузчиком: схема создаётся сразу.
|
|
1182
|
-
*/
|
|
1183
|
-
nodes?: Record<string, NodeSpec> | ((editor: Editor) => Record<string, NodeSpec>);
|
|
1184
|
-
/** Новые марки (инлайн-форматирование) с parseDOM и toDOM. */
|
|
1185
|
-
marks?: Record<string, MarkSpec>;
|
|
1186
|
-
/**
|
|
1187
|
-
* Переопределение именованных команд (кнопки, меню, горячие клавиши и editor.exec берут их отсюда).
|
|
1188
|
-
* Например, совместное редактирование заменяет undo/redo своими — «отменить только свои правки».
|
|
1189
|
-
*/
|
|
1190
|
-
commands?: Partial<Record<CommandName, Command>>;
|
|
1191
|
-
/** Плагин ведёт свою историю изменений — встроенная (prosemirror-history) не подключается. */
|
|
1192
|
-
replaceHistory?: boolean;
|
|
1193
|
-
/**
|
|
1194
|
-
* Переписать транзакцию до применения (режим правок превращает удаление в пометку «удалено»).
|
|
1195
|
-
* Вызывается для каждой транзакции редактора; вернуть ту же, если менять нечего.
|
|
1196
|
-
*/
|
|
1197
|
-
transformTransaction?: (tr: Transaction, state: EditorState, editor: Editor) => Transaction;
|
|
1198
|
-
}
|
|
1199
|
-
type Loader = () => Promise<NovaPlugin | {
|
|
1200
|
-
default: NovaPlugin;
|
|
1201
|
-
}>;
|
|
1202
|
-
/** Элемент конфига plugins: объект, имя из реестра или ленивый загрузчик. */
|
|
1203
|
-
type PluginEntry = NovaPlugin | string | Loader;
|
|
1204
|
-
/** Помощник для типизации определения плагина. */
|
|
1205
|
-
declare function definePlugin(plugin: NovaPlugin): NovaPlugin;
|
|
1206
|
-
/** Зарегистрировать плагин (или его ленивый загрузчик) под именем — для `plugins: ['имя']`. */
|
|
1207
|
-
declare function registerPlugin(name: string, plugin: NovaPlugin | Loader): void;
|
|
1208
|
-
declare function isPluginRegistered(name: string): boolean;
|
|
1209
|
-
|
|
1210
|
-
interface FontOption {
|
|
1211
|
-
label: string;
|
|
1212
|
-
value: string;
|
|
1213
|
-
}
|
|
1214
|
-
declare const defaultFontFamilies: FontOption[];
|
|
1215
|
-
declare const defaultFontSizes: string[];
|
|
1216
|
-
declare const defaultLineHeights: string[];
|
|
1217
|
-
|
|
1218
|
-
interface SlashCommand {
|
|
1219
|
-
name: string;
|
|
1220
|
-
/** Ключ перевода подписи. */
|
|
1221
|
-
label: MessageKey;
|
|
1222
|
-
icon: string;
|
|
1223
|
-
/** Доп. слова для поиска (английские — чтобы «/h1» и «/quote» работали в любом языке UI). */
|
|
1224
|
-
keywords: string[];
|
|
1225
|
-
shortcut?: string;
|
|
1226
|
-
run: (editor: Editor) => void;
|
|
1227
|
-
}
|
|
1228
|
-
declare const defaultSlashCommands: SlashCommand[];
|
|
1229
|
-
/**
|
|
1230
|
-
* Ранжирование: совпадение с начала подписи важнее совпадения с начала ключевого слова,
|
|
1231
|
-
* а то — важнее вхождения в середину. Пустой запрос — все команды по порядку.
|
|
1232
|
-
*/
|
|
1233
|
-
declare function rankSlashCommands(commands: SlashCommand[], query: string, t: (k: MessageKey) => string): SlashCommand[];
|
|
1234
|
-
|
|
1235
|
-
interface DialogOptions {
|
|
1236
|
-
host: HTMLElement;
|
|
1237
|
-
title: string;
|
|
1238
|
-
body: HTMLElement;
|
|
1239
|
-
/** Без submitLabel диалог информационный: в подвале только кнопка cancelLabel («Закрыть»). */
|
|
1240
|
-
submitLabel?: string;
|
|
1241
|
-
cancelLabel: string;
|
|
1242
|
-
closeLabel: string;
|
|
1243
|
-
/** Вернуть false (или строку ошибки), чтобы не закрывать диалог. */
|
|
1244
|
-
onSubmit?: () => boolean | string | void | Promise<boolean | string | void>;
|
|
1245
|
-
/** large — для предпросмотра и HTML-кода. */
|
|
1246
|
-
size?: 'normal' | 'large';
|
|
1247
|
-
onClose?: () => void;
|
|
1248
|
-
/** Куда вернуть фокус после закрытия. */
|
|
1249
|
-
returnFocus?: () => void;
|
|
1250
|
-
/** Элемент, получающий фокус при открытии (по умолчанию — первое поле). */
|
|
1251
|
-
initialFocus?: HTMLElement;
|
|
1252
|
-
}
|
|
1253
|
-
interface DialogHandle {
|
|
1254
|
-
el: HTMLElement;
|
|
1255
|
-
close(): void;
|
|
1256
|
-
setError(message: string | null): void;
|
|
1257
|
-
setBusy(busy: boolean): void;
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
type NotificationType = 'info' | 'success' | 'warning' | 'error';
|
|
1261
|
-
interface NotificationOptions {
|
|
1262
|
-
text: string;
|
|
1263
|
-
type?: NotificationType;
|
|
1264
|
-
/** мс до автозакрытия; 0 — не закрывать автоматически. По умолчанию 4000 (ошибки — 0). */
|
|
1265
|
-
timeout?: number;
|
|
1266
|
-
}
|
|
1267
|
-
interface NotificationHandle {
|
|
1268
|
-
close(): void;
|
|
1269
|
-
setText(text: string): void;
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
|
-
type Placement = 'bottom-start' | 'bottom-end' | 'top-start' | 'bottom';
|
|
1273
|
-
type Anchor = HTMLElement | (() => DOMRect);
|
|
1274
|
-
interface PopoverOptions {
|
|
1275
|
-
host: HTMLElement;
|
|
1276
|
-
anchor: Anchor;
|
|
1277
|
-
content: HTMLElement;
|
|
1278
|
-
placement?: Placement;
|
|
1279
|
-
className?: string;
|
|
1280
|
-
/** Закрывать по клику вне панели (по умолчанию да). */
|
|
1281
|
-
dismissOnOutside?: boolean;
|
|
1282
|
-
/** Элементы, клик по которым не считается «вне» (например, кнопка-якорь). */
|
|
1283
|
-
ignore?: HTMLElement[];
|
|
1284
|
-
onClose?: (reason: 'escape' | 'outside' | 'api') => void;
|
|
1285
|
-
}
|
|
1286
|
-
/** Всплывающая панель: меню, палитра цветов, панель ссылки, переполнение тулбара. */
|
|
1287
|
-
declare class Popover {
|
|
1288
|
-
readonly el: HTMLDivElement;
|
|
1289
|
-
private readonly options;
|
|
1290
|
-
private closed;
|
|
1291
|
-
constructor(options: PopoverOptions);
|
|
1292
|
-
get isOpen(): boolean;
|
|
1293
|
-
reposition: () => void;
|
|
1294
|
-
close(reason?: 'escape' | 'outside' | 'api'): void;
|
|
1295
|
-
/** Был ли фокус внутри панели в момент закрытия (тогда его надо вернуть на кнопку). */
|
|
1296
|
-
focusWasInside: boolean;
|
|
1297
|
-
private onKeyDown;
|
|
1298
|
-
private onPointerDown;
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
interface AutocompleterItem {
|
|
1302
|
-
value: string;
|
|
1303
|
-
label: string;
|
|
1304
|
-
icon?: string;
|
|
1305
|
-
/** Подсказка справа — горячая клавиша в формате 'Mod-b'. */
|
|
1306
|
-
shortcut?: string;
|
|
1307
|
-
/** Подсказка справа обычным текстом (должность, e-mail). */
|
|
1308
|
-
detail?: string;
|
|
1309
|
-
}
|
|
1310
|
-
interface AutocompleterSpec {
|
|
1311
|
-
/** Символ-триггер: '/', '@', ':'. */
|
|
1312
|
-
trigger: string;
|
|
1313
|
-
/** Сколько символов после триггера нужно до показа списка (по умолчанию 0). */
|
|
1314
|
-
minChars?: number;
|
|
1315
|
-
/** Пункты для запроса; можно вернуть Promise (поиск на сервере). */
|
|
1316
|
-
fetch: (query: string, editor: Editor) => AutocompleterItem[] | Promise<AutocompleterItem[]>;
|
|
1317
|
-
/** Выбор пункта. range — позиции «триггер + запрос», их обычно удаляют. */
|
|
1318
|
-
onSelect: (item: AutocompleterItem, range: {
|
|
1319
|
-
from: number;
|
|
1320
|
-
to: number;
|
|
1321
|
-
}, editor: Editor) => void;
|
|
1322
|
-
/** Подпись списка для экранного диктора. */
|
|
1323
|
-
label: string;
|
|
1324
|
-
/** Текст, если ничего не найдено (иначе список скрывается). */
|
|
1325
|
-
emptyText?: string;
|
|
1326
|
-
maxResults?: number;
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
interface MenuItem {
|
|
1330
|
-
type?: 'item';
|
|
1331
|
-
id: string;
|
|
1332
|
-
label: string;
|
|
1333
|
-
icon?: string;
|
|
1334
|
-
shortcut?: string;
|
|
1335
|
-
/** Отмечен (радио/чекбокс) — показывается галочка. */
|
|
1336
|
-
active?: boolean;
|
|
1337
|
-
/** Независимый переключатель (жирный, надстрочный) — menuitemcheckbox, а не radio. */
|
|
1338
|
-
checkbox?: boolean;
|
|
1339
|
-
disabled?: boolean;
|
|
1340
|
-
/** Стиль подписи — для превью шрифтов и заголовков прямо в меню. */
|
|
1341
|
-
labelStyle?: string;
|
|
1342
|
-
onSelect: () => void;
|
|
1343
|
-
}
|
|
1344
|
-
interface MenuSeparator {
|
|
1345
|
-
type: 'separator';
|
|
1346
|
-
}
|
|
1347
|
-
/** Заголовок группы пунктов (не нажимается). */
|
|
1348
|
-
interface MenuHeading {
|
|
1349
|
-
type: 'heading';
|
|
1350
|
-
label: string;
|
|
1351
|
-
}
|
|
1352
|
-
type MenuEntry = MenuItem | MenuSeparator | MenuHeading;
|
|
1353
|
-
|
|
1354
|
-
interface ControlBase {
|
|
1355
|
-
/** Подпись для подсказки и aria-label. */
|
|
1356
|
-
tooltip: string;
|
|
1357
|
-
/** SVG-иконка (строка). Если нет — показывается text. */
|
|
1358
|
-
icon?: string;
|
|
1359
|
-
/** Текст на кнопке (для выпадающих списков: «Обычный текст ▾»). */
|
|
1360
|
-
text?: string;
|
|
1361
|
-
/** Горячая клавиша в формате ProseMirror ('Mod-b') — только для подсказки. */
|
|
1362
|
-
shortcut?: string;
|
|
1363
|
-
isEnabled?: (editor: Editor) => boolean;
|
|
1364
|
-
}
|
|
1365
|
-
interface ButtonSpec extends ControlBase {
|
|
1366
|
-
type: 'button';
|
|
1367
|
-
onAction: (editor: Editor) => void;
|
|
1368
|
-
/** Если задан — кнопка становится переключателем (aria-pressed). */
|
|
1369
|
-
isActive?: (editor: Editor) => boolean;
|
|
1370
|
-
}
|
|
1371
|
-
interface MenuButtonSpec extends ControlBase {
|
|
1372
|
-
type: 'menu';
|
|
1373
|
-
items: (editor: Editor) => MenuEntry[];
|
|
1374
|
-
/** Динамическая подпись (текущий стиль блока, шрифт и т.п.). */
|
|
1375
|
-
label?: (editor: Editor) => string;
|
|
1376
|
-
isActive?: (editor: Editor) => boolean;
|
|
1377
|
-
/** Минимальная ширина подписи в символах — чтобы тулбар не прыгал. */
|
|
1378
|
-
minChars?: number;
|
|
1379
|
-
}
|
|
1380
|
-
interface PanelButtonSpec extends ControlBase {
|
|
1381
|
-
type: 'panel';
|
|
1382
|
-
render: (editor: Editor, close: () => void) => HTMLElement;
|
|
1383
|
-
/** Цвет полоски под иконкой (текущий цвет текста/фона). */
|
|
1384
|
-
indicator?: (editor: Editor) => string | null;
|
|
1385
|
-
isActive?: (editor: Editor) => boolean;
|
|
1386
|
-
}
|
|
1387
|
-
/**
|
|
1388
|
-
* Составная кнопка: основная часть выполняет действие (переключить список), стрелка открывает
|
|
1389
|
-
* меню вариантов (стиль маркеров). Как bullist/numlist с плагином advlist.
|
|
1390
|
-
*/
|
|
1391
|
-
interface SplitButtonSpec extends ControlBase {
|
|
1392
|
-
type: 'split';
|
|
1393
|
-
onAction: (editor: Editor) => void;
|
|
1394
|
-
items: (editor: Editor) => MenuEntry[];
|
|
1395
|
-
isActive?: (editor: Editor) => boolean;
|
|
1396
|
-
}
|
|
1397
|
-
type ControlSpec = ButtonSpec | MenuButtonSpec | PanelButtonSpec | SplitButtonSpec;
|
|
1398
|
-
/** Пункт меню менюбара. */
|
|
1399
|
-
interface MenuItemSpec {
|
|
1400
|
-
text: string;
|
|
1401
|
-
icon?: string;
|
|
1402
|
-
shortcut?: string;
|
|
1403
|
-
onAction: (editor: Editor) => void;
|
|
1404
|
-
/** Галочка (переключатель). */
|
|
1405
|
-
isActive?: (editor: Editor) => boolean;
|
|
1406
|
-
isEnabled?: (editor: Editor) => boolean;
|
|
1407
|
-
}
|
|
1408
|
-
/** Контекстный тулбар: появляется рядом с выделенным объектом (картинка, таблица, ссылка). */
|
|
1409
|
-
interface ContextToolbarSpec {
|
|
1410
|
-
/** Когда показывать. Проверяются по порядку регистрации — побеждает первый подходящий. */
|
|
1411
|
-
predicate: (editor: Editor) => boolean;
|
|
1412
|
-
/** Кнопки в формате тулбара ('a b | c'), из того же реестра. */
|
|
1413
|
-
items: string | string[];
|
|
1414
|
-
/** Подпись для экранного диктора. */
|
|
1415
|
-
label: string;
|
|
1416
|
-
/** Где показывать: над выделенным узлом (по умолчанию) или под выделением. */
|
|
1417
|
-
position?: 'node' | 'selection';
|
|
1418
|
-
/** Свой якорь (например, вся таблица). Перекрывает position. */
|
|
1419
|
-
anchor?: (editor: Editor) => DOMRect | null;
|
|
1420
|
-
/** Сторона относительно якоря; при нехватке места переворачивается. */
|
|
1421
|
-
placement?: 'top-start' | 'bottom-start';
|
|
1422
|
-
/** Порядок проверки: больше — раньше (по умолчанию 0). Выделение текста в таблице → quickbar важнее таблицы. */
|
|
1423
|
-
priority?: number;
|
|
1424
|
-
}
|
|
1425
|
-
type WithoutType<T> = Omit<T, 'type'>;
|
|
1426
|
-
/**
|
|
1427
|
-
* Реестр кнопок тулбара (аналог editor.ui.registry). Встроенные кнопки регистрируются так же,
|
|
1428
|
-
* как пользовательские, — плагины ничем не ограничены по сравнению с ядром.
|
|
1429
|
-
*/
|
|
1430
|
-
declare class Registry {
|
|
1431
|
-
private readonly controls;
|
|
1432
|
-
addButton(name: string, spec: WithoutType<ButtonSpec>): void;
|
|
1433
|
-
/** Синоним addButton с isActive — для совместимости с привычным API. */
|
|
1434
|
-
addToggleButton(name: string, spec: WithoutType<ButtonSpec>): void;
|
|
1435
|
-
addMenuButton(name: string, spec: WithoutType<MenuButtonSpec>): void;
|
|
1436
|
-
addPanelButton(name: string, spec: WithoutType<PanelButtonSpec>): void;
|
|
1437
|
-
addSplitButton(name: string, spec: WithoutType<SplitButtonSpec>): void;
|
|
1438
|
-
private readonly menuItems;
|
|
1439
|
-
/** Пункт меню менюбара (аналог addMenuItem). */
|
|
1440
|
-
addMenuItem(name: string, spec: MenuItemSpec): void;
|
|
1441
|
-
/** Пункт-переключатель (с галочкой). */
|
|
1442
|
-
addToggleMenuItem(name: string, spec: MenuItemSpec & {
|
|
1443
|
-
isActive: (editor: Editor) => boolean;
|
|
1444
|
-
}): void;
|
|
1445
|
-
/**
|
|
1446
|
-
* Пункт меню по имени. Если отдельного пункта нет — строится из одноимённой кнопки тулбара
|
|
1447
|
-
* (подпись = tooltip), чтобы не дублировать каждую функцию дважды.
|
|
1448
|
-
*/
|
|
1449
|
-
getMenuItem(name: string): MenuItemSpec | undefined;
|
|
1450
|
-
private readonly contextToolbars;
|
|
1451
|
-
private readonly autocompleters;
|
|
1452
|
-
/** Автокомплитер по символу-триггеру: '/' — команды, '@' — упоминания, ':' — эмодзи. */
|
|
1453
|
-
addAutocompleter(name: string, spec: AutocompleterSpec): void;
|
|
1454
|
-
getAutocompleters(): [string, AutocompleterSpec][];
|
|
1455
|
-
addContextToolbar(name: string, spec: ContextToolbarSpec): void;
|
|
1456
|
-
/** По убыванию priority; при равенстве — в порядке регистрации (sort стабильна). */
|
|
1457
|
-
getContextToolbars(): [string, ContextToolbarSpec][];
|
|
1458
|
-
get(name: string): ControlSpec | undefined;
|
|
1459
|
-
has(name: string): boolean;
|
|
1460
|
-
names(): string[];
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
/**
|
|
1464
|
-
* Одна общая подсказка на редактор: название кнопки + горячая клавиша.
|
|
1465
|
-
* Мышь — с задержкой, клавиатурный фокус — сразу. На тач-устройствах не показывается
|
|
1466
|
-
* (там подпись дублируется aria-label, а не скрывается в подсказке).
|
|
1467
|
-
*/
|
|
1468
|
-
declare class Tooltip {
|
|
1469
|
-
private readonly el;
|
|
1470
|
-
private timer;
|
|
1471
|
-
private target;
|
|
1472
|
-
constructor(host: HTMLElement);
|
|
1473
|
-
/** Подключить подсказку к элементу. Текст берётся из data-tooltip и data-shortcut. */
|
|
1474
|
-
attach(target: HTMLElement): void;
|
|
1475
|
-
private schedule;
|
|
1476
|
-
show(target: HTMLElement): void;
|
|
1477
|
-
hide(): void;
|
|
1478
|
-
get current(): HTMLElement | null;
|
|
1479
|
-
destroy(): void;
|
|
1480
|
-
private clearTimer;
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
|
-
/**
|
|
1484
|
-
* UI-слой экземпляра редактора: реестр кнопок, оверлеи (поповеры, диалоги, подсказки),
|
|
1485
|
-
* уведомления и переводы. Доступен как editor.ui.
|
|
1486
|
-
*/
|
|
1487
|
-
declare class UiManager {
|
|
1488
|
-
private readonly focusEditor;
|
|
1489
|
-
readonly registry: Registry;
|
|
1490
|
-
readonly t: Translator;
|
|
1491
|
-
/** Слой для всех плавающих элементов. Лежит внутри .nova-editor, поэтому наследует тему. */
|
|
1492
|
-
readonly overlayHost: HTMLDivElement;
|
|
1493
|
-
readonly tooltip: Tooltip;
|
|
1494
|
-
private readonly notifications;
|
|
1495
|
-
private popover;
|
|
1496
|
-
private dialog;
|
|
1497
|
-
constructor(root: HTMLElement, t: Translator, focusEditor: () => void);
|
|
1498
|
-
/** Открыть поповер; одновременно открыт только один (кроме панели переполнения тулбара). */
|
|
1499
|
-
openPopover(options: Omit<PopoverOptions, 'host'>): Popover;
|
|
1500
|
-
closePopover(): void;
|
|
1501
|
-
get activePopover(): Popover | null;
|
|
1502
|
-
private readonly dialogListeners;
|
|
1503
|
-
/**
|
|
1504
|
-
* Подписаться на открытие диалога (вернёт отписку). Тулбар так закрывает панель «⋯»: иначе на узком
|
|
1505
|
-
* экране она оставалась открытой поверх текста после закрытия диалога, открытого из неё.
|
|
1506
|
-
*/
|
|
1507
|
-
onDialogOpen(listener: () => void): () => void;
|
|
1508
|
-
/**
|
|
1509
|
-
* Закрыть всплывающие панели и «⋯» тулбара — перед тем как плагин открывает свою панель или вид
|
|
1510
|
-
* (история версий, комментарии), чтобы они не остались поверх.
|
|
1511
|
-
*/
|
|
1512
|
-
closeOverlays(): void;
|
|
1513
|
-
openDialog(options: Omit<DialogOptions, 'host' | 'cancelLabel' | 'closeLabel' | 'returnFocus'> & {
|
|
1514
|
-
cancelLabel?: string;
|
|
1515
|
-
}): DialogHandle;
|
|
1516
|
-
get activeDialog(): DialogHandle | null;
|
|
1517
|
-
notify(options: NotificationOptions | string): NotificationHandle;
|
|
1518
|
-
destroy(): void;
|
|
1519
|
-
}
|
|
1520
|
-
|
|
1521
|
-
/**
|
|
1522
|
-
* Конфиг тулбара: строка в привычном формате ('undo redo | bold italic') или массив имён,
|
|
1523
|
-
* где '|' разделяет группы.
|
|
1524
|
-
*/
|
|
1525
|
-
type ToolbarConfig = string | string[];
|
|
1526
|
-
/** Режим при нехватке ширины: перенос на новую строку или «⋯» с остальными группами. */
|
|
1527
|
-
type ToolbarMode = 'wrap' | 'sliding';
|
|
1528
|
-
declare const defaultToolbar: string;
|
|
1529
|
-
declare function parseToolbar(config: ToolbarConfig): string[][];
|
|
1530
|
-
|
|
1531
|
-
type EditorMode = 'classic' | 'inline' | 'distraction-free';
|
|
1532
|
-
type EditorEvent = 'change' | 'selectionChange' | 'focus' | 'blur' | 'editableChange' | 'destroy';
|
|
1533
|
-
/**
|
|
1534
|
-
* Настройки встроенных плагинов (типизированы — подсказки в редакторе кода) и любых сторонних по имени.
|
|
1535
|
-
* Только типы: модули плагинов не попадают в ядро.
|
|
1536
|
-
*/
|
|
1537
|
-
interface PluginOptions {
|
|
1538
|
-
comments?: CommentsOptions;
|
|
1539
|
-
mentions?: MentionsOptions;
|
|
1540
|
-
mergetags?: MergeTagsOptions;
|
|
1541
|
-
revisionhistory?: RevisionHistoryOptions;
|
|
1542
|
-
autosave?: AutosaveOptions;
|
|
1543
|
-
quickbars?: QuickbarsOptions;
|
|
1544
|
-
[plugin: string]: unknown;
|
|
1545
|
-
}
|
|
1546
|
-
interface EditorOptions extends PasteOptions, ContentRulesOptions {
|
|
1547
|
-
/** Элемент, внутрь которого монтируется редактор. */
|
|
1548
|
-
element: HTMLElement;
|
|
1549
|
-
/** Начальное содержимое: HTML-строка или JSON документа. */
|
|
1550
|
-
content?: string | Record<string, unknown>;
|
|
1551
|
-
/**
|
|
1552
|
-
* Тулбар: строка ('undo redo | bold italic'), массив имён или false (headless — UI рисует клиент).
|
|
1553
|
-
* По умолчанию — стандартный набор.
|
|
1554
|
-
*/
|
|
1555
|
-
toolbar?: false | ToolbarConfig;
|
|
1556
|
-
/** Поведение тулбара при нехватке ширины. По умолчанию 'sliding' (лишнее уходит в «⋯»). */
|
|
1557
|
-
toolbarMode?: ToolbarMode;
|
|
1558
|
-
/**
|
|
1559
|
-
* classic — рамка и панели (по умолчанию); inline — без рамки, панель появляется над текстом при фокусе;
|
|
1560
|
-
* distraction-free — без постоянных панелей, только quickbars над выделением и на пустой строке.
|
|
1561
|
-
*/
|
|
1562
|
-
mode?: EditorMode;
|
|
1563
|
-
/** Менюбар: true — стандартный ('file edit view insert format table help'), строка — свой набор. По умолчанию нет. */
|
|
1564
|
-
menubar?: boolean | string;
|
|
1565
|
-
/** Свои меню и переопределение стандартных: { insert: { title: 'Вставка', items: 'image link | hr' } }. */
|
|
1566
|
-
menu?: Record<string, MenuDefinition>;
|
|
1567
|
-
/** Статусбар с путём к элементу и счётчиком слов. По умолчанию включён. */
|
|
1568
|
-
statusbar?: boolean;
|
|
1569
|
-
/** Плейсхолдер для пустого документа. */
|
|
1570
|
-
placeholder?: string;
|
|
1571
|
-
editable?: boolean;
|
|
1572
|
-
/**
|
|
1573
|
-
* Отключённый редактор — как disabled у поля формы: текст не редактируется и не получает фокус,
|
|
1574
|
-
* панели неактивны. В отличие от editable: false (только чтение) выглядит приглушённо.
|
|
1575
|
-
*/
|
|
1576
|
-
disabled?: boolean;
|
|
1577
|
-
/**
|
|
1578
|
-
* Ручка изменения размера в статусбаре: true — по высоте, 'both' — по высоте и ширине.
|
|
1579
|
-
* Мышь, палец или клавиатура (стрелки на ручке). По умолчанию нет.
|
|
1580
|
-
*/
|
|
1581
|
-
resize?: boolean | 'both';
|
|
1582
|
-
/**
|
|
1583
|
-
* Пункты списка блоков (кнопка `blocks`) и их порядок: [{ label: 'Подзаголовок', block: 'h3' }].
|
|
1584
|
-
* По умолчанию — абзац, H1–H6 и блок кода.
|
|
1585
|
-
*/
|
|
1586
|
-
blockFormats?: BlockFormat[];
|
|
1587
|
-
/**
|
|
1588
|
-
* Стили содержимого (как content_style в TinyMCE): применяются только к тексту этого редактора.
|
|
1589
|
-
* `body`/`html` в селекторах — это сама область текста: 'body { font-family: Georgia }'.
|
|
1590
|
-
*/
|
|
1591
|
-
contentStyle?: string;
|
|
1592
|
-
/**
|
|
1593
|
-
* Файлы стилей содержимого (как content_css): загружаются и применяются только к тексту
|
|
1594
|
-
* этого редактора; относительные url() и @import работают. `await editor.ready` ждёт загрузки.
|
|
1595
|
-
*/
|
|
1596
|
-
contentCss?: string | string[];
|
|
1597
|
-
/**
|
|
1598
|
-
* Именованные форматы (как formats в TinyMCE): { note: { block: 'p', classes: 'note' } }.
|
|
1599
|
-
* Применяются через editor.formatter.apply('note'); их классы сохраняются при разборе HTML.
|
|
1600
|
-
*/
|
|
1601
|
-
formats?: Record<string, FormatSpec | FormatSpec[]>;
|
|
1602
|
-
/**
|
|
1603
|
-
* Пункты меню «Стили» (кнопка `styles`): свои форматы, ссылки на именованные и группы.
|
|
1604
|
-
* По умолчанию — заголовки, текст, блоки и выравнивание.
|
|
1605
|
-
*/
|
|
1606
|
-
styleFormats?: StyleFormat[];
|
|
1607
|
-
/** true — добавить styleFormats к стандартному набору, а не заменить его. */
|
|
1608
|
-
styleFormatsMerge?: boolean;
|
|
1609
|
-
/**
|
|
1610
|
-
* Какие классы сохранять в HTML кроме классов из форматов: список или true — все.
|
|
1611
|
-
* По умолчанию только классы форматов (вставленный мусор вроде MsoNormal не попадает в документ).
|
|
1612
|
-
*/
|
|
1613
|
-
validClasses?: string[] | true;
|
|
1614
|
-
/**
|
|
1615
|
-
* Стили таблиц на выбор в свойствах таблицы (как table_class_list в TinyMCE):
|
|
1616
|
-
* [{ title: 'С рамками', value: 'grid' }]. Внешний вид задаёт ваш CSS (contentCss).
|
|
1617
|
-
*/
|
|
1618
|
-
tableClassList?: ClassOption[];
|
|
1619
|
-
/** Стили ячеек на выбор в свойствах ячейки (как table_cell_class_list). */
|
|
1620
|
-
tableCellClassList?: ClassOption[];
|
|
1621
|
-
/** Язык UI (BCP-47): 'en', 'ru'… По умолчанию 'en'. */
|
|
1622
|
-
language?: string;
|
|
1623
|
-
/** Точечная замена строк UI. */
|
|
1624
|
-
translations?: Partial<Messages>;
|
|
1625
|
-
/** Загрузка изображений на ваш сервер. Без неё картинки встраиваются как data:URL. */
|
|
1626
|
-
uploadImage?: UploadImageHandler;
|
|
1627
|
-
/**
|
|
1628
|
-
* Свой выбор файла: кнопка «Обзор» у поля адреса в диалогах ссылки, картинки и видео.
|
|
1629
|
-
* Получает тип поля и текущий адрес, возвращает { url, text?, title?, alt? } или null.
|
|
1630
|
-
*/
|
|
1631
|
-
filePicker?: FilePicker;
|
|
1632
|
-
/** Для каких полей показывать «Обзор»: 'file' (ссылка), 'image', 'media'. По умолчанию — для всех. */
|
|
1633
|
-
filePickerTypes?: FilePickType[];
|
|
1634
|
-
fontFamilies?: FontOption[];
|
|
1635
|
-
fontSizes?: string[];
|
|
1636
|
-
lineHeights?: string[];
|
|
1637
|
-
colors?: string[];
|
|
1638
|
-
/** Слэш-команды «/». false — выключить; массив — дополнительные команды к стандартным. */
|
|
1639
|
-
slashCommands?: false | SlashCommand[];
|
|
1640
|
-
/**
|
|
1641
|
-
* Плагины NovaProse: объект, имя из реестра ('insertdatetime') или ленивый загрузчик (() => import(...)).
|
|
1642
|
-
* Ленивые грузятся после создания редактора; дождаться — `await editor.ready`.
|
|
1643
|
-
*/
|
|
1644
|
-
plugins?: PluginEntry[];
|
|
1645
|
-
/** Настройки плагинов по имени: { comments: {...}, mentions: {...} }. Встроенные — с типами. */
|
|
1646
|
-
pluginOptions?: PluginOptions;
|
|
1647
|
-
/** Сырые ProseMirror-плагины (для низкоуровневых расширений). */
|
|
1648
|
-
prosemirrorPlugins?: Plugin[];
|
|
1649
|
-
/** Вызывается до отрисовки тулбара — место для editor.ui.registry.addButton(...). */
|
|
1650
|
-
setup?: (editor: Editor) => void;
|
|
1651
|
-
onChange?: (editor: Editor) => void;
|
|
1652
|
-
}
|
|
1653
|
-
/** Пункт списка стилей таблицы или ячейки: подпись и класс. */
|
|
1654
|
-
interface ClassOption {
|
|
1655
|
-
title: string;
|
|
1656
|
-
value: string;
|
|
1657
|
-
}
|
|
1658
|
-
/** Пункт списка блоков: подпись и тег блока. */
|
|
1659
|
-
interface BlockFormat {
|
|
1660
|
-
label: string;
|
|
1661
|
-
block: 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'pre';
|
|
1662
|
-
}
|
|
1663
|
-
type Listener = (editor: Editor) => void;
|
|
1664
|
-
/**
|
|
1665
|
-
* Публичный API редактора NovaProse.
|
|
1666
|
-
* Обёртки (React, Vue…) работают только через этот класс, а не через ProseMirror напрямую.
|
|
1667
|
-
*/
|
|
1668
|
-
declare class Editor {
|
|
1669
|
-
readonly view: EditorView;
|
|
1670
|
-
readonly root: HTMLElement;
|
|
1671
|
-
readonly ui: UiManager;
|
|
1672
|
-
readonly options: Readonly<EditorOptions>;
|
|
1673
|
-
private readonly listeners;
|
|
1674
|
-
/** Выполняется, когда загружены и подключены все ленивые плагины. */
|
|
1675
|
-
readonly ready: Promise<void>;
|
|
1676
|
-
private toolbar;
|
|
1677
|
-
private readonly toolbarHost;
|
|
1678
|
-
private readonly menubar;
|
|
1679
|
-
readonly mode: EditorMode;
|
|
1680
|
-
private readonly pluginsByName;
|
|
1681
|
-
private readonly commandOverrides;
|
|
1682
|
-
private readonly transactionTransforms;
|
|
1683
|
-
private readonly cleanups;
|
|
1684
|
-
/** Ограничения контента (validElements/invalidElements/validStyles) или null — без ограничений. */
|
|
1685
|
-
readonly contentRules: ContentRules | null;
|
|
1686
|
-
/** Схема документа этого редактора: базовая + узлы и марки синхронных плагинов. */
|
|
1687
|
-
readonly schema: NovaSchema;
|
|
1688
|
-
/** Форматы: register / apply / remove / toggle / match. */
|
|
1689
|
-
readonly formatter: Formatter;
|
|
1690
|
-
private readonly statusbar;
|
|
1691
|
-
private readonly searchBar;
|
|
1692
|
-
private destroyed;
|
|
1693
|
-
private editable;
|
|
1694
|
-
private disabled;
|
|
1695
|
-
private pasteAsText;
|
|
1696
|
-
constructor(options: EditorOptions);
|
|
1697
|
-
/** contentStyle сразу, contentCss — по мере загрузки. Каждый редактор — своя область. */
|
|
1698
|
-
private applyContentStyles;
|
|
1699
|
-
/** Разрешён ли контрол/команда/тег по ограничениям контента (без ограничений — всегда да). */
|
|
1700
|
-
isAllowed(name: string): boolean;
|
|
1701
|
-
hasPlugin(name: string): boolean;
|
|
1702
|
-
/**
|
|
1703
|
-
* Схема с узлами и марками плагинов. Конфликт имён — ошибка конфигурации: сообщаем и работаем
|
|
1704
|
-
* на базовой схеме, чтобы редактор всё равно открылся.
|
|
1705
|
-
*/
|
|
1706
|
-
private buildSchema;
|
|
1707
|
-
private collectPmPlugins;
|
|
1708
|
-
/** setup с изоляцией ошибок: упавший плагин не ломает редактор. */
|
|
1709
|
-
private setupPlugin;
|
|
1710
|
-
private loadLazyPlugins;
|
|
1711
|
-
/**
|
|
1712
|
-
* Обновить состояние кнопок (нажата / доступна) без изменения документа — например, после того как
|
|
1713
|
-
* плагин переключил режим отображения. Изменения документа обновляют UI сами.
|
|
1714
|
-
*/
|
|
1715
|
-
updateUI(): void;
|
|
1716
|
-
/** Перестроить тулбар (после регистрации новых кнопок плагинами). */
|
|
1717
|
-
rebuildToolbar(): void;
|
|
1718
|
-
/** Конфиг тулбара: пользовательский как есть; по умолчанию — плюс кнопки подключённых плагинов. */
|
|
1719
|
-
private toolbarConfig;
|
|
1720
|
-
private handleTransaction;
|
|
1721
|
-
private updatePlaceholder;
|
|
1722
|
-
/** HTML документа. Детерминирован: одинаков во всех браузерах и в Node. */
|
|
1723
|
-
getHTML(): string;
|
|
1724
|
-
getJSON(): Record<string, unknown>;
|
|
1725
|
-
getText(): string;
|
|
1726
|
-
/** Заменить содержимое. По умолчанию попадает в историю undo. */
|
|
1727
|
-
setContent(content: string | Record<string, unknown>, { addToHistory }?: {
|
|
1728
|
-
addToHistory?: boolean | undefined;
|
|
1729
|
-
}): void;
|
|
1730
|
-
/**
|
|
1731
|
-
* Вставить HTML в позицию курсора (как insertContent в TinyMCE). HTML разбирается схемой
|
|
1732
|
-
* редактора — как вставка: без скриптов, опасных ссылок и лишних тегов.
|
|
1733
|
-
* Блоки (абзацы, таблицы) встают отдельными блоками. Таблица, вставляемая при курсоре
|
|
1734
|
-
* внутри таблицы, встаёт после неё (а не заменяет её ячейки).
|
|
1735
|
-
*/
|
|
1736
|
-
insertContent(html: string): boolean;
|
|
1737
|
-
isEmpty(): boolean;
|
|
1738
|
-
/** Выполнить именованную команду или произвольную ProseMirror-команду. */
|
|
1739
|
-
/** Команда по имени: переопределение плагина или встроенная. */
|
|
1740
|
-
resolveCommand(name: CommandName): Command;
|
|
1741
|
-
private registerCommands;
|
|
1742
|
-
exec(command: CommandName | Command): boolean;
|
|
1743
|
-
/** Можно ли выполнить команду в текущем состоянии (для disabled-кнопок). */
|
|
1744
|
-
can(command: CommandName | Command): boolean;
|
|
1745
|
-
/** Активна ли именованная команда в текущем выделении (для своих кнопок тулбара). */
|
|
1746
|
-
isActive(command: CommandName): boolean;
|
|
1747
|
-
focus(): void;
|
|
1748
|
-
/** Режим «вставлять как текст» (переключатель pastetext). */
|
|
1749
|
-
isPasteAsText(): boolean;
|
|
1750
|
-
setPasteAsText(value: boolean): void;
|
|
1751
|
-
/** Открыть панель «Найти и заменить» (Ctrl/Cmd+F). */
|
|
1752
|
-
openSearch(): void;
|
|
1753
|
-
closeSearch(): void;
|
|
1754
|
-
/** Можно ли сейчас править текст: не «только чтение» и не отключён. */
|
|
1755
|
-
isEditable(): boolean;
|
|
1756
|
-
isDisabled(): boolean;
|
|
1757
|
-
/** Отключить или включить редактор (как disabled у поля формы). */
|
|
1758
|
-
setDisabled(value: boolean): void;
|
|
1759
|
-
private applyDisabled;
|
|
1760
|
-
setEditable(value: boolean): void;
|
|
1761
|
-
on(event: EditorEvent, listener: Listener): () => void;
|
|
1762
|
-
off(event: EditorEvent, listener: Listener): void;
|
|
1763
|
-
private emit;
|
|
1764
|
-
destroy(): void;
|
|
1765
|
-
}
|
|
1766
|
-
declare function createEditor(options: EditorOptions): Editor;
|
|
1767
|
-
|
|
1768
|
-
/** Печать содержимого через скрытый iframe (HTML уже очищен схемой). */
|
|
1769
15
|
declare function printContent(editor: Editor): void;
|
|
1770
16
|
|
|
1771
|
-
/**
|
|
17
|
+
/** A parser for a specific editor's schema (created once per schema). */
|
|
1772
18
|
declare function parserFor(target: Schema): DOMParser;
|
|
1773
19
|
|
|
1774
|
-
/**
|
|
20
|
+
/** Style marks with a value: color, background, font, size. */
|
|
1775
21
|
type StyleMark = 'color' | 'background' | 'font_family' | 'font_size';
|
|
1776
22
|
/**
|
|
1777
|
-
*
|
|
1778
|
-
*
|
|
23
|
+
* Set a style on the selection (value = null removes it). With an empty selection the style applies
|
|
24
|
+
* to the next typed text (storedMarks).
|
|
1779
25
|
*/
|
|
1780
26
|
declare function setStyle(markName: StyleMark, value: string | null): Command;
|
|
1781
|
-
/**
|
|
27
|
+
/** The current value of a style at the start of the selection (or null). */
|
|
1782
28
|
declare function getStyle(state: EditorState, markName: StyleMark): string | null;
|
|
1783
|
-
/**
|
|
29
|
+
/** Line height for paragraphs and headings in the selection. */
|
|
1784
30
|
declare function setLineHeight(value: string | null): Command;
|
|
1785
31
|
declare function getLineHeight(state: EditorState): string | null;
|
|
1786
32
|
|
|
1787
33
|
/**
|
|
1788
|
-
*
|
|
1789
|
-
*
|
|
34
|
+
* Turns user input into a URL: 'example.com' → 'https://example.com', 'a@b.com' → 'mailto:a@b.com'.
|
|
35
|
+
* Relative paths and anchors are left alone.
|
|
1790
36
|
*/
|
|
1791
37
|
declare function normalizeUrl(input: string): string;
|
|
1792
38
|
interface LinkAttrs {
|
|
@@ -1796,18 +42,17 @@ interface LinkAttrs {
|
|
|
1796
42
|
target?: string | null;
|
|
1797
43
|
}
|
|
1798
44
|
/**
|
|
1799
|
-
*
|
|
1800
|
-
*
|
|
45
|
+
* Create or update a link. If `text` is given and differs from the current text, the text is
|
|
46
|
+
* replaced and other marks (bold and so on) are kept.
|
|
1801
47
|
*/
|
|
1802
48
|
declare function applyLink(attrs: LinkAttrs): Command;
|
|
1803
49
|
declare function removeLink(): Command;
|
|
1804
|
-
/**
|
|
50
|
+
/** The insert/edit link dialog. */
|
|
1805
51
|
declare function openLinkDialog(editor: Editor): void;
|
|
1806
52
|
|
|
1807
|
-
/**
|
|
53
|
+
/** The default palette: 8 hues × (dark, base, light) plus a gray scale. */
|
|
1808
54
|
declare const defaultColors: string[];
|
|
1809
55
|
|
|
1810
|
-
/** Считает слова так же, как пользователь: числа и слова с дефисом/апострофом — одно слово. */
|
|
1811
56
|
declare function countWords(text: string): number;
|
|
1812
57
|
|
|
1813
58
|
declare function isSafeLinkUrl(url: string): boolean;
|
|
@@ -1824,101 +69,164 @@ interface SearchMatch {
|
|
|
1824
69
|
}
|
|
1825
70
|
interface SearchState extends SearchOptions {
|
|
1826
71
|
matches: SearchMatch[];
|
|
1827
|
-
/**
|
|
72
|
+
/** Index of the current match, or -1. */
|
|
1828
73
|
current: number;
|
|
1829
74
|
}
|
|
1830
75
|
/**
|
|
1831
|
-
*
|
|
1832
|
-
*
|
|
76
|
+
* All matches in the document. Inside a text block a letter and an inline object take one position
|
|
77
|
+
* each, so an index in the block's text + (pos + 1) is the position in the document.
|
|
1833
78
|
*/
|
|
1834
79
|
declare function findMatches(doc: Node, options: SearchOptions): SearchMatch[];
|
|
1835
80
|
declare function getSearchState(state: EditorState): SearchState;
|
|
1836
|
-
/**
|
|
81
|
+
/** Set the query. The current match is the first one after the cursor. */
|
|
1837
82
|
declare function setSearch(options: SearchOptions): Command;
|
|
1838
83
|
declare const clearSearch: Command;
|
|
1839
|
-
/**
|
|
84
|
+
/** Go to the next (dir = 1) or previous (-1) match, wrapping around. */
|
|
1840
85
|
declare function findNext(dir?: 1 | -1): Command;
|
|
1841
|
-
/**
|
|
86
|
+
/** Replace the current match and go to the next one. */
|
|
1842
87
|
declare function replaceCurrent(replacement: string): Command;
|
|
1843
|
-
/**
|
|
88
|
+
/** Replace all matches in one transaction (one undo step). */
|
|
1844
89
|
declare function replaceAll(replacement: string): Command;
|
|
1845
90
|
|
|
1846
91
|
declare function isFullscreen(editor: Editor): boolean;
|
|
1847
|
-
/**
|
|
92
|
+
/** The editor on the whole screen; the page under it doesn't scroll. */
|
|
1848
93
|
declare function toggleFullscreen(editor: Editor, value?: boolean): void;
|
|
1849
94
|
/**
|
|
1850
|
-
*
|
|
1851
|
-
*
|
|
95
|
+
* A preview of the result. The DOM is built by the schema's serializer (no HTML string parsing), in
|
|
96
|
+
* a container with the same content styles, without editing. `doc` and `title`: another document
|
|
97
|
+
* to show (for example, the text with every suggestion accepted) under its own title.
|
|
1852
98
|
*/
|
|
1853
|
-
declare function openPreview(editor: Editor
|
|
1854
|
-
|
|
99
|
+
declare function openPreview(editor: Editor, { doc, title }?: {
|
|
100
|
+
doc?: Node;
|
|
101
|
+
title?: string;
|
|
102
|
+
}): void;
|
|
103
|
+
/** Line breaks after block tags, so the HTML is easy to read and edit. */
|
|
1855
104
|
declare function formatHTML(html: string): string;
|
|
1856
|
-
/**
|
|
105
|
+
/** View and edit the HTML (the code plugin). Saving goes through the schema, with the same cleanup. */
|
|
1857
106
|
declare function openSourceCode(editor: Editor): void;
|
|
1858
107
|
declare function openHelp(editor: Editor): void;
|
|
1859
108
|
|
|
1860
|
-
/**
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
109
|
+
/**
|
|
110
|
+
* HTML laid out for reading: every block on its own line, nested ones indented. Only the space
|
|
111
|
+
* between blocks changes, never text: a tag holds its blocks on separate lines only when a block
|
|
112
|
+
* follows it at once, inline content stays on its line, and <pre> stays as it is. Reading the result
|
|
113
|
+
* back gives the same document.
|
|
114
|
+
*/
|
|
115
|
+
declare function prettyHTML(html: string, indent?: string): string;
|
|
116
|
+
|
|
117
|
+
type SortDirection = 'asc' | 'desc';
|
|
118
|
+
/** How to sort a table (the "Sort" dialog of advanced tables). */
|
|
119
|
+
interface SortOptions {
|
|
120
|
+
/** 'column': the rows, by the values in a column; 'row': the columns, by the values in a row. */
|
|
121
|
+
by: 'column' | 'row';
|
|
122
|
+
/** The column (or row) whose values decide, from 0; the one with the cursor when left out. */
|
|
123
|
+
index?: number;
|
|
124
|
+
direction: SortDirection;
|
|
125
|
+
/** Only the selected rows (or columns), or the whole table (the default). */
|
|
126
|
+
scope?: 'table' | 'selection';
|
|
127
|
+
}
|
|
1877
128
|
|
|
1878
|
-
/**
|
|
129
|
+
/**
|
|
130
|
+
* Table nodes for the schema, without depending on prosemirror-tables: the library itself (cell
|
|
131
|
+
* selection, column widths, commands) loads lazily, but the schema is needed right away. The specs
|
|
132
|
+
* are compatible with it (tableRole, the colspan/rowspan/colwidth attributes, the same HTML).
|
|
133
|
+
*
|
|
134
|
+
* Adapted from prosemirror-tables (MIT, © Marijn Haverbeke and others): tableNodes, getCellAttrs,
|
|
135
|
+
* setCellAttrs.
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
/** The cursor is inside a table (like isInTable from prosemirror-tables). */
|
|
139
|
+
declare function isInTable(state: EditorState): boolean;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Tables in the first load are only the light part: creating and inserting a table, the size grid,
|
|
143
|
+
* the table's position on screen. The mechanics (cell selection, column widths, row and column
|
|
144
|
+
* commands, sorting, properties) are the ./table module on prosemirror-tables: ~10 KB gzip, loaded
|
|
145
|
+
* in the background right after the editor is created and part of `editor.ready`.
|
|
146
|
+
*
|
|
147
|
+
* The commands and helpers of the mechanics are available here as stand-ins with the same API:
|
|
148
|
+
* until the module has loaded (the first milliseconds), a command is "unavailable" (false), like any command that doesn't apply.
|
|
149
|
+
*/
|
|
150
|
+
|
|
151
|
+
type TableCommandName = 'addRowBefore' | 'addRowAfter' | 'deleteRow' | 'addColumnBefore' | 'addColumnAfter' | 'deleteColumn' | 'mergeCells' | 'splitCell' | 'toggleHeaderRow' | 'toggleHeaderColumn' | 'deleteTable';
|
|
152
|
+
/** Row, column and cell commands (public API; unavailable until the mechanics have loaded). */
|
|
153
|
+
declare const tableCommands: Record<TableCommandName, Command>;
|
|
154
|
+
/** Background of the selected cells (null removes it). */
|
|
1879
155
|
declare function setCellBackground(color: string | null): Command;
|
|
1880
|
-
/** Есть ли в текущей таблице строка-заголовок (первая строка из th). */
|
|
1881
156
|
declare function hasHeaderRow(state: EditorState): boolean;
|
|
1882
|
-
/** Есть ли столбец-заголовок (первая ячейка каждой строки — th). */
|
|
1883
157
|
declare function hasHeaderColumn(state: EditorState): boolean;
|
|
158
|
+
/** Create a rows×cols table; the first row is headers when withHeader. */
|
|
159
|
+
declare function createTable(rows: number, cols: number, withHeader?: boolean, schema?: NovaSchema): Node;
|
|
160
|
+
/** Insert a table in place of the selection and put the cursor in its first cell. */
|
|
161
|
+
declare function insertTable(rows: number, cols: number, withHeader?: boolean): Command;
|
|
1884
162
|
|
|
1885
163
|
/**
|
|
1886
|
-
*
|
|
1887
|
-
*
|
|
1888
|
-
*
|
|
1889
|
-
*
|
|
164
|
+
* The suggestions plugin — suggesting mode (like "Suggesting" in Google Docs). In suggesting mode,
|
|
165
|
+
* an edit doesn't change the document directly: insertions are marked <ins>, deletions <del> (the
|
|
166
|
+
* text stays until a decision). Every suggestion knows its author and time; it is accepted or
|
|
167
|
+
* rejected one by one (the panel above it) or all at once. In HTML: `<ins data-suggestion="id" …>`.
|
|
1890
168
|
*
|
|
1891
|
-
*
|
|
1892
|
-
*
|
|
169
|
+
* Inserting and deleting text is tracked, and so is text formatting (bold, a color, a link…): the
|
|
170
|
+
* new formatting shows at once, and the text remembers what it was, to go back to it if the
|
|
171
|
+
* suggestion is rejected (`<span data-suggestion="id" data-format="[…]">`). So is a node's type and
|
|
172
|
+
* style (a heading instead of a paragraph, alignment, a numbered list instead of a bulleted one,
|
|
173
|
+
* table and cell properties, an image's size): the node remembers what it was
|
|
174
|
+
* (`<h2 data-suggestion="id" data-before='{"type":"paragraph"}'>`). Whole nodes inserted or deleted
|
|
175
|
+
* (a table, a row, a column, an image, a line) carry the suggestion themselves
|
|
176
|
+
* (`<tr data-suggestion="id" data-change="delete">`); a deleted one stays until the deletion is
|
|
177
|
+
* accepted. Putting paragraphs into a list or a quote, taking them out, Tab and Shift+Tab in a list
|
|
178
|
+
* are suggestions on the item or the quote (`data-change="wrap"` / `"unwrap"`). An edit that can't be
|
|
179
|
+
* a suggestion (merging table cells, a page setup) isn't made in suggesting mode: nothing changes
|
|
180
|
+
* the document directly.
|
|
1893
181
|
*/
|
|
1894
182
|
interface SuggestionAuthor {
|
|
1895
183
|
id: string;
|
|
1896
184
|
name: string;
|
|
1897
185
|
}
|
|
1898
186
|
interface SuggestionsOptions {
|
|
1899
|
-
/**
|
|
187
|
+
/** Who is suggesting. */
|
|
1900
188
|
author?: SuggestionAuthor;
|
|
1901
|
-
/**
|
|
189
|
+
/** Start in suggesting mode. */
|
|
1902
190
|
enabled?: boolean;
|
|
1903
|
-
/**
|
|
191
|
+
/** Suggestions only: the mode can't be turned off (someone who may not change the text directly). */
|
|
1904
192
|
force?: boolean;
|
|
1905
|
-
/**
|
|
193
|
+
/** Whether this user can accept and reject suggestions (yes by default). */
|
|
1906
194
|
canReview?: boolean;
|
|
1907
195
|
}
|
|
1908
196
|
interface Suggestion {
|
|
1909
197
|
id: string;
|
|
1910
|
-
|
|
198
|
+
/**
|
|
199
|
+
* insert and delete: text, or a whole node (`node` says which); format: the text's formatting
|
|
200
|
+
* changed; block: a node's type or style; split: a new paragraph break before the block; join:
|
|
201
|
+
* the paragraph break before it deleted; wrap: the node put into a list or a quote, or one level
|
|
202
|
+
* deeper in a list (Tab); unwrap: taking it out of one suggested.
|
|
203
|
+
*/
|
|
204
|
+
kind: 'insert' | 'delete' | 'format' | 'block' | 'split' | 'join' | 'wrap' | 'unwrap';
|
|
1911
205
|
author: SuggestionAuthor;
|
|
1912
206
|
time: number;
|
|
207
|
+
/** Text: where it starts and ends. A suggestion a node carries (`node` is set): the whole node. */
|
|
1913
208
|
from: number;
|
|
1914
209
|
to: number;
|
|
1915
210
|
text: string;
|
|
1916
|
-
|
|
1917
|
-
|
|
211
|
+
/** The type name of the node that carries the suggestion (not set for text). */
|
|
212
|
+
node?: string;
|
|
213
|
+
/** format: the formatting (mark names) the text got, and the formatting it lost. */
|
|
214
|
+
added?: string[];
|
|
215
|
+
removed?: string[];
|
|
216
|
+
/** block: what the block was before: its type and attributes. */
|
|
217
|
+
before?: BlockBefore;
|
|
218
|
+
/** split and join: how many levels the paragraph break is (a list item: 2). */
|
|
219
|
+
depth?: number;
|
|
220
|
+
}
|
|
221
|
+
interface BlockBefore {
|
|
222
|
+
type: string;
|
|
223
|
+
attrs: Record<string, string | number | boolean | null>;
|
|
224
|
+
}
|
|
225
|
+
/** All suggestions in the document (consecutive parts of one suggestion are merged). */
|
|
1918
226
|
declare function listSuggestions(doc: Node): Suggestion[];
|
|
1919
|
-
/**
|
|
227
|
+
/** Accept or reject suggestions (all of them, or those with the given ids). */
|
|
1920
228
|
declare function resolveSuggestions(state: EditorState, action: 'accept' | 'reject', ids?: readonly string[]): Transaction;
|
|
1921
|
-
/**
|
|
229
|
+
/** The document without suggestions: as if all were accepted (accept) or all rejected (reject). */
|
|
1922
230
|
declare function suggestionsResult(editor: Editor, action: 'accept' | 'reject'): Node;
|
|
1923
231
|
declare function isSuggesting(state: EditorState): boolean;
|
|
1924
232
|
declare function setSuggesting(editor: Editor, enabled: boolean): void;
|
|
@@ -1954,6 +262,7 @@ declare const icons: {
|
|
|
1954
262
|
imageRight: string;
|
|
1955
263
|
resize: string;
|
|
1956
264
|
altText: string;
|
|
265
|
+
imageCaption: string;
|
|
1957
266
|
trash: string;
|
|
1958
267
|
paragraph: string;
|
|
1959
268
|
h1: string;
|
|
@@ -1998,6 +307,7 @@ declare const icons: {
|
|
|
1998
307
|
browse: string;
|
|
1999
308
|
mergeTags: string;
|
|
2000
309
|
resizeHandleBoth: string;
|
|
310
|
+
sidebar: string;
|
|
2001
311
|
anchor: string;
|
|
2002
312
|
save: string;
|
|
2003
313
|
charmap: string;
|
|
@@ -2006,6 +316,13 @@ declare const icons: {
|
|
|
2006
316
|
emoji: string;
|
|
2007
317
|
dateTime: string;
|
|
2008
318
|
media: string;
|
|
319
|
+
checklist: string;
|
|
320
|
+
codeSample: string;
|
|
321
|
+
dragHandle: string;
|
|
322
|
+
accordion: string;
|
|
323
|
+
tableOfContents: string;
|
|
324
|
+
math: string;
|
|
325
|
+
duplicate: string;
|
|
2009
326
|
nonBreaking: string;
|
|
2010
327
|
pageBreak: string;
|
|
2011
328
|
history: string;
|
|
@@ -2014,13 +331,28 @@ declare const icons: {
|
|
|
2014
331
|
visualBlocks: string;
|
|
2015
332
|
ltr: string;
|
|
2016
333
|
rtl: string;
|
|
334
|
+
caseChange: string;
|
|
335
|
+
formatPainter: string;
|
|
336
|
+
permanentPen: string;
|
|
337
|
+
visualChars: string;
|
|
338
|
+
cancelChanges: string;
|
|
339
|
+
template: string;
|
|
340
|
+
footnote: string;
|
|
341
|
+
footnotesUpdate: string;
|
|
2017
342
|
};
|
|
2018
343
|
|
|
2019
344
|
declare class HTMLSerializer {
|
|
345
|
+
/**
|
|
346
|
+
* A cache of rendered marks, separate for each mark type: the serializer is shared by every editor
|
|
347
|
+
* on the page, while a mark's output depends on the editor's schema (attribute rules, plugins).
|
|
348
|
+
*/
|
|
2020
349
|
private readonly cache;
|
|
2021
|
-
serializeFragment(fragment: Fragment
|
|
350
|
+
serializeFragment(fragment: Fragment, { pre }?: {
|
|
351
|
+
pre?: boolean;
|
|
352
|
+
}): string;
|
|
2022
353
|
serializeNode(node: Node): string;
|
|
2023
354
|
private renderMark;
|
|
2024
355
|
}
|
|
2025
356
|
|
|
2026
|
-
export {
|
|
357
|
+
export { Editor, HTMLSerializer, NovaSchema, applyLink, clearSearch, countWords, createTable, defaultColors, findMatches, findNext, formatHTML, getLineHeight, getSearchState, getStyle, hasHeaderColumn, hasHeaderRow, icons, insertTable, isFullscreen, isInTable, isSafeImageUrl, isSafeLinkUrl, isSuggesting, listSuggestions, normalizeUrl, openHelp, openLinkDialog, openPreview, openSourceCode, parserFor, prettyHTML, printContent, removeLink, replaceAll, replaceCurrent, resolveSuggestions, setCellBackground, setLineHeight, setSearch, setStyle, setSuggesting, suggestionsResult, tableCommands, toggleFullscreen };
|
|
358
|
+
export type { LinkAttrs, SearchMatch, SearchOptions, SearchState, SortOptions, StyleMark, Suggestion, SuggestionAuthor, SuggestionsOptions };
|