@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.
Files changed (338) hide show
  1. package/README.md +20 -4
  2. package/dist/a11y.cjs +314 -0
  3. package/dist/a11y.cjs.map +1 -0
  4. package/dist/a11y.d.cts +51 -0
  5. package/dist/a11y.d.ts +51 -0
  6. package/dist/a11y.js +11 -0
  7. package/dist/a11y.js.map +1 -0
  8. package/dist/a11ychecker-7KQU7DD3.js +449 -0
  9. package/dist/a11ychecker-7KQU7DD3.js.map +1 -0
  10. package/dist/accordion-ui-FGN3I5UF.js +201 -0
  11. package/dist/accordion-ui-FGN3I5UF.js.map +1 -0
  12. package/dist/advcode-65Z2ELUB.js +51 -0
  13. package/dist/advcode-65Z2ELUB.js.map +1 -0
  14. package/dist/advcode-editor-WIOCY552.js +257 -0
  15. package/dist/advcode-editor-WIOCY552.js.map +1 -0
  16. package/dist/{advlist-K2U3VPH2.js → advlist-CEHE6YXS.js} +14 -20
  17. package/dist/advlist-CEHE6YXS.js.map +1 -0
  18. package/dist/advtable-ui-5CBOPTHW.js +364 -0
  19. package/dist/advtable-ui-5CBOPTHW.js.map +1 -0
  20. package/dist/ai-IRQYZHRK.js +1485 -0
  21. package/dist/ai-IRQYZHRK.js.map +1 -0
  22. package/dist/anchor-ui-NWIIRKGY.js +81 -0
  23. package/dist/anchor-ui-NWIIRKGY.js.map +1 -0
  24. package/dist/autocorrect-6GFLVDPC.js +851 -0
  25. package/dist/autocorrect-6GFLVDPC.js.map +1 -0
  26. package/dist/{autolink-XWDTLY37.js → autolink-N427KVQO.js} +13 -7
  27. package/dist/autolink-N427KVQO.js.map +1 -0
  28. package/dist/{autoresize-UB3GOA6D.js → autoresize-YRZAVCNO.js} +2 -2
  29. package/dist/autoresize-YRZAVCNO.js.map +1 -0
  30. package/dist/{autosave-MWNRUNU3.js → autosave-L7OZ3KLK.js} +9 -13
  31. package/dist/autosave-L7OZ3KLK.js.map +1 -0
  32. package/dist/casechange-5G6RAJ7K.js +201 -0
  33. package/dist/casechange-5G6RAJ7K.js.map +1 -0
  34. package/dist/{charmap-ADLYOIB3.js → charmap-5CBBDWOP.js} +9 -14
  35. package/dist/charmap-5CBBDWOP.js.map +1 -0
  36. package/dist/checklist-HM4VXZKY.js +189 -0
  37. package/dist/checklist-HM4VXZKY.js.map +1 -0
  38. package/dist/chunk-23ZLVT5D.js +163 -0
  39. package/dist/chunk-23ZLVT5D.js.map +1 -0
  40. package/dist/chunk-3BOK3S3T.js +26 -0
  41. package/dist/chunk-3BOK3S3T.js.map +1 -0
  42. package/dist/chunk-4I4AYH2K.js +101 -0
  43. package/dist/chunk-4I4AYH2K.js.map +1 -0
  44. package/dist/chunk-4VPDY3LF.js +27 -0
  45. package/dist/chunk-4VPDY3LF.js.map +1 -0
  46. package/dist/chunk-53AY5NAF.js +214 -0
  47. package/dist/chunk-53AY5NAF.js.map +1 -0
  48. package/dist/chunk-5VCESSQB.js +137 -0
  49. package/dist/chunk-5VCESSQB.js.map +1 -0
  50. package/dist/chunk-66INZHZ2.js +79 -0
  51. package/dist/chunk-66INZHZ2.js.map +1 -0
  52. package/dist/chunk-6LQM7G4V.js +159 -0
  53. package/dist/chunk-6LQM7G4V.js.map +1 -0
  54. package/dist/chunk-6YSQGFV7.js +893 -0
  55. package/dist/chunk-6YSQGFV7.js.map +1 -0
  56. package/dist/{chunk-GHEFKKRC.js → chunk-AC3YCAX4.js} +108 -29
  57. package/dist/chunk-AC3YCAX4.js.map +1 -0
  58. package/dist/{chunk-NPKAIW34.js → chunk-ADRPQLZ2.js} +50 -1
  59. package/dist/chunk-ADRPQLZ2.js.map +1 -0
  60. package/dist/chunk-ANE5ASXG.js +26 -0
  61. package/dist/chunk-ANE5ASXG.js.map +1 -0
  62. package/dist/{chunk-Z3ELZ77W.js → chunk-AP2PJFLB.js} +5 -2
  63. package/dist/chunk-AP2PJFLB.js.map +1 -0
  64. package/dist/chunk-AQV6FIKK.js +259 -0
  65. package/dist/chunk-AQV6FIKK.js.map +1 -0
  66. package/dist/chunk-AUQSATWL.js +322 -0
  67. package/dist/chunk-AUQSATWL.js.map +1 -0
  68. package/dist/chunk-C326LHHU.js +143 -0
  69. package/dist/chunk-C326LHHU.js.map +1 -0
  70. package/dist/chunk-DEYYVZ7O.js +393 -0
  71. package/dist/chunk-DEYYVZ7O.js.map +1 -0
  72. package/dist/chunk-EOJ5XHKA.js +160 -0
  73. package/dist/chunk-EOJ5XHKA.js.map +1 -0
  74. package/dist/chunk-EXX2S352.js +3642 -0
  75. package/dist/chunk-EXX2S352.js.map +1 -0
  76. package/dist/chunk-FTEA6L2Q.js +47 -0
  77. package/dist/chunk-FTEA6L2Q.js.map +1 -0
  78. package/dist/chunk-G74HNSB6.js +9 -0
  79. package/dist/chunk-G74HNSB6.js.map +1 -0
  80. package/dist/chunk-GHVB6SV4.js +177 -0
  81. package/dist/chunk-GHVB6SV4.js.map +1 -0
  82. package/dist/chunk-GTLE2HEW.js +108 -0
  83. package/dist/chunk-GTLE2HEW.js.map +1 -0
  84. package/dist/chunk-GXXXLPDQ.js +67 -0
  85. package/dist/chunk-GXXXLPDQ.js.map +1 -0
  86. package/dist/chunk-HC6RMBAD.js +163 -0
  87. package/dist/chunk-HC6RMBAD.js.map +1 -0
  88. package/dist/chunk-HNEAVVBC.js +98 -0
  89. package/dist/chunk-HNEAVVBC.js.map +1 -0
  90. package/dist/chunk-I7Y4KSM2.js +165 -0
  91. package/dist/chunk-I7Y4KSM2.js.map +1 -0
  92. package/dist/chunk-IG2BL4ON.js +127 -0
  93. package/dist/chunk-IG2BL4ON.js.map +1 -0
  94. package/dist/chunk-J6W2CDRF.js +425 -0
  95. package/dist/chunk-J6W2CDRF.js.map +1 -0
  96. package/dist/chunk-LVEQBNLX.js +207 -0
  97. package/dist/chunk-LVEQBNLX.js.map +1 -0
  98. package/dist/chunk-MZGNOHSY.js +176 -0
  99. package/dist/chunk-MZGNOHSY.js.map +1 -0
  100. package/dist/chunk-N32H37AJ.js +373 -0
  101. package/dist/chunk-N32H37AJ.js.map +1 -0
  102. package/dist/chunk-NTGEKGXU.js +263 -0
  103. package/dist/chunk-NTGEKGXU.js.map +1 -0
  104. package/dist/chunk-OFHGXYG3.js +140 -0
  105. package/dist/chunk-OFHGXYG3.js.map +1 -0
  106. package/dist/chunk-OOVNE6MB.js +28 -0
  107. package/dist/chunk-OOVNE6MB.js.map +1 -0
  108. package/dist/chunk-OQMMHWMZ.js +7 -0
  109. package/dist/chunk-OQMMHWMZ.js.map +1 -0
  110. package/dist/chunk-P2UU2NLT.js +1149 -0
  111. package/dist/chunk-P2UU2NLT.js.map +1 -0
  112. package/dist/{chunk-HZRIBOPW.js → chunk-QU3KXMYT.js} +45 -3
  113. package/dist/chunk-QU3KXMYT.js.map +1 -0
  114. package/dist/chunk-S2XZRKHA.js +29 -0
  115. package/dist/chunk-S2XZRKHA.js.map +1 -0
  116. package/dist/chunk-SCIRO4XK.js +144 -0
  117. package/dist/chunk-SCIRO4XK.js.map +1 -0
  118. package/dist/chunk-T3IRLTKK.js +158 -0
  119. package/dist/chunk-T3IRLTKK.js.map +1 -0
  120. package/dist/chunk-TABIUD2L.js +66 -0
  121. package/dist/chunk-TABIUD2L.js.map +1 -0
  122. package/dist/{chunk-7ON7PR5R.js → chunk-TAM2FHKG.js} +374 -52
  123. package/dist/chunk-TAM2FHKG.js.map +1 -0
  124. package/dist/chunk-UTMS2P2K.js +288 -0
  125. package/dist/chunk-UTMS2P2K.js.map +1 -0
  126. package/dist/{chunk-HPLT3XRZ.js → chunk-V7WUHUHM.js} +13 -1
  127. package/dist/chunk-V7WUHUHM.js.map +1 -0
  128. package/dist/chunk-VK6YF2AA.js +359 -0
  129. package/dist/chunk-VK6YF2AA.js.map +1 -0
  130. package/dist/chunk-WAOU5NGN.js +430 -0
  131. package/dist/chunk-WAOU5NGN.js.map +1 -0
  132. package/dist/chunk-XIH4SCO6.js +112 -0
  133. package/dist/chunk-XIH4SCO6.js.map +1 -0
  134. package/dist/chunk-XR7CY4NI.js +11 -0
  135. package/dist/chunk-XR7CY4NI.js.map +1 -0
  136. package/dist/chunk-YDF55N6Z.js +164 -0
  137. package/dist/chunk-YDF55N6Z.js.map +1 -0
  138. package/dist/chunk-YDPZCVXS.js +923 -0
  139. package/dist/chunk-YDPZCVXS.js.map +1 -0
  140. package/dist/chunk-YG5V7POU.js +137 -0
  141. package/dist/chunk-YG5V7POU.js.map +1 -0
  142. package/dist/chunk-YVSUR7E5.js +151 -0
  143. package/dist/chunk-YVSUR7E5.js.map +1 -0
  144. package/dist/codesample-GHWIC7PT.js +546 -0
  145. package/dist/codesample-GHWIC7PT.js.map +1 -0
  146. package/dist/{comments-panel-FYJE3U64.js → comments-panel-SOLBZ46Q.js} +12 -6
  147. package/dist/comments-panel-SOLBZ46Q.js.map +1 -0
  148. package/dist/{directionality-XOHJFSL6.js → directionality-EGQKGDZA.js} +16 -11
  149. package/dist/directionality-EGQKGDZA.js.map +1 -0
  150. package/dist/document-0ft41E6d.d.ts +39 -0
  151. package/dist/document-IQqDDT4v.d.cts +39 -0
  152. package/dist/docx.cjs +23518 -0
  153. package/dist/docx.cjs.map +1 -0
  154. package/dist/docx.d.cts +83 -0
  155. package/dist/docx.d.ts +83 -0
  156. package/dist/docx.js +1821 -0
  157. package/dist/docx.js.map +1 -0
  158. package/dist/draghandle-U6CYZHPA.js +389 -0
  159. package/dist/draghandle-U6CYZHPA.js.map +1 -0
  160. package/dist/editimage-5EWPSM22.js +683 -0
  161. package/dist/editimage-5EWPSM22.js.map +1 -0
  162. package/dist/editor-BCMxe1M4.d.cts +2888 -0
  163. package/dist/editor-Dmtwjw2u.d.ts +2888 -0
  164. package/dist/email-ELNMEQ6E.js +177 -0
  165. package/dist/email-ELNMEQ6E.js.map +1 -0
  166. package/dist/email.cjs +588 -0
  167. package/dist/email.cjs.map +1 -0
  168. package/dist/email.d.cts +7 -0
  169. package/dist/email.d.ts +7 -0
  170. package/dist/email.js +21 -0
  171. package/dist/email.js.map +1 -0
  172. package/dist/{emoticons-TP4N4ZGY.js → emoticons-EGHNZKSA.js} +9 -14
  173. package/dist/emoticons-EGHNZKSA.js.map +1 -0
  174. package/dist/exportpdf-4P7X3NY2.js +91 -0
  175. package/dist/exportpdf-4P7X3NY2.js.map +1 -0
  176. package/dist/exportword-JFJ3KTYZ.js +16 -0
  177. package/dist/exportword-JFJ3KTYZ.js.map +1 -0
  178. package/dist/footnotes-ui-FV6QRGDA.js +449 -0
  179. package/dist/footnotes-ui-FV6QRGDA.js.map +1 -0
  180. package/dist/form-dialog-SNWFPM2K.js +379 -0
  181. package/dist/form-dialog-SNWFPM2K.js.map +1 -0
  182. package/dist/formatpainter-IEXX27OJ.js +209 -0
  183. package/dist/formatpainter-IEXX27OJ.js.map +1 -0
  184. package/dist/fullpagehtml-ui-RE4C2NO5.js +220 -0
  185. package/dist/fullpagehtml-ui-RE4C2NO5.js.map +1 -0
  186. package/dist/html-rules-api-BLDDW9MO.d.cts +42 -0
  187. package/dist/html-rules-api-BLDDW9MO.d.ts +42 -0
  188. package/dist/html-rules.cjs +482 -0
  189. package/dist/html-rules.cjs.map +1 -0
  190. package/dist/html-rules.d.cts +89 -0
  191. package/dist/html-rules.d.ts +89 -0
  192. package/dist/html-rules.js +417 -0
  193. package/dist/html-rules.js.map +1 -0
  194. package/dist/i18n/de.cjs +670 -0
  195. package/dist/i18n/de.cjs.map +1 -0
  196. package/dist/i18n/de.d.cts +9 -0
  197. package/dist/i18n/de.d.ts +9 -0
  198. package/dist/i18n/de.js +649 -0
  199. package/dist/i18n/de.js.map +1 -0
  200. package/dist/i18n/es.cjs +670 -0
  201. package/dist/i18n/es.cjs.map +1 -0
  202. package/dist/i18n/es.d.cts +9 -0
  203. package/dist/i18n/es.d.ts +9 -0
  204. package/dist/i18n/es.js +649 -0
  205. package/dist/i18n/es.js.map +1 -0
  206. package/dist/i18n/fr.cjs +670 -0
  207. package/dist/i18n/fr.cjs.map +1 -0
  208. package/dist/i18n/fr.d.cts +9 -0
  209. package/dist/i18n/fr.d.ts +9 -0
  210. package/dist/i18n/fr.js +649 -0
  211. package/dist/i18n/fr.js.map +1 -0
  212. package/dist/i18n/it.cjs +670 -0
  213. package/dist/i18n/it.cjs.map +1 -0
  214. package/dist/i18n/it.d.cts +9 -0
  215. package/dist/i18n/it.d.ts +9 -0
  216. package/dist/i18n/it.js +649 -0
  217. package/dist/i18n/it.js.map +1 -0
  218. package/dist/i18n/pt-BR.cjs +670 -0
  219. package/dist/i18n/pt-BR.cjs.map +1 -0
  220. package/dist/i18n/pt-BR.d.cts +9 -0
  221. package/dist/i18n/pt-BR.d.ts +9 -0
  222. package/dist/i18n/pt-BR.js +649 -0
  223. package/dist/i18n/pt-BR.js.map +1 -0
  224. package/dist/i18n/ru.cjs +670 -0
  225. package/dist/i18n/ru.cjs.map +1 -0
  226. package/dist/i18n/ru.d.cts +10 -0
  227. package/dist/i18n/ru.d.ts +10 -0
  228. package/dist/i18n/ru.js +649 -0
  229. package/dist/i18n/ru.js.map +1 -0
  230. package/dist/importcss-JLNIRKGH.js +127 -0
  231. package/dist/importcss-JLNIRKGH.js.map +1 -0
  232. package/dist/importword-D7Z6RXGQ.js +73 -0
  233. package/dist/importword-D7Z6RXGQ.js.map +1 -0
  234. package/dist/index-CZ9yDvmQ.d.cts +235 -0
  235. package/dist/index-CZ9yDvmQ.d.ts +235 -0
  236. package/dist/index.cjs +29531 -10134
  237. package/dist/index.cjs.map +1 -1
  238. package/dist/index.d.cts +160 -1828
  239. package/dist/index.d.ts +160 -1828
  240. package/dist/index.js +212 -1480
  241. package/dist/index.js.map +1 -1
  242. package/dist/{insertdatetime-T4SEMQWP.js → insertdatetime-YW2VHYZH.js} +10 -16
  243. package/dist/insertdatetime-YW2VHYZH.js.map +1 -0
  244. package/dist/linkchecker-3S3MCPOS.js +287 -0
  245. package/dist/linkchecker-3S3MCPOS.js.map +1 -0
  246. package/dist/markdown-26O3N3T2.js +136 -0
  247. package/dist/markdown-26O3N3T2.js.map +1 -0
  248. package/dist/markdown.cjs +356 -0
  249. package/dist/markdown.cjs.map +1 -0
  250. package/dist/markdown.d.cts +25 -0
  251. package/dist/markdown.d.ts +25 -0
  252. package/dist/markdown.js +10 -0
  253. package/dist/markdown.js.map +1 -0
  254. package/dist/math-ui-RUTCHTRY.js +157 -0
  255. package/dist/math-ui-RUTCHTRY.js.map +1 -0
  256. package/dist/media-ui-36TE3CJD.js +123 -0
  257. package/dist/media-ui-36TE3CJD.js.map +1 -0
  258. package/dist/mediaembed-ui-ZNTGZ2SQ.js +207 -0
  259. package/dist/mediaembed-ui-ZNTGZ2SQ.js.map +1 -0
  260. package/dist/mentions-ui-O4IPWQT4.js +58 -0
  261. package/dist/mentions-ui-O4IPWQT4.js.map +1 -0
  262. package/dist/mergetags-ui-HS3Q2R36.js +73 -0
  263. package/dist/mergetags-ui-HS3Q2R36.js.map +1 -0
  264. package/dist/{nonbreaking-HG5HV6AL.js → nonbreaking-GYRUH4UO.js} +10 -9
  265. package/dist/nonbreaking-GYRUH4UO.js.map +1 -0
  266. package/dist/pagebreak-ui-I4ZPYK3U.js +50 -0
  267. package/dist/pagebreak-ui-I4ZPYK3U.js.map +1 -0
  268. package/dist/pageembed-ui-WOY6VWRJ.js +172 -0
  269. package/dist/pageembed-ui-WOY6VWRJ.js.map +1 -0
  270. package/dist/pagelayout-ui-Y2IM7FJQ.js +236 -0
  271. package/dist/pagelayout-ui-Y2IM7FJQ.js.map +1 -0
  272. package/dist/paste-office-3A6KWKCV.js +520 -0
  273. package/dist/paste-office-3A6KWKCV.js.map +1 -0
  274. package/dist/permanentpen-6D5LLKFX.js +206 -0
  275. package/dist/permanentpen-6D5LLKFX.js.map +1 -0
  276. package/dist/print-MZMLQIQX.js +178 -0
  277. package/dist/print-MZMLQIQX.js.map +1 -0
  278. package/dist/{quickbars-4NU4SIPL.js → quickbars-UZ2Q67TX.js} +24 -12
  279. package/dist/quickbars-UZ2Q67TX.js.map +1 -0
  280. package/dist/{revisionhistory-3YQPLPLM.js → revisionhistory-ACRB23HL.js} +48 -173
  281. package/dist/revisionhistory-ACRB23HL.js.map +1 -0
  282. package/dist/save-72ZLF6AO.js +120 -0
  283. package/dist/save-72ZLF6AO.js.map +1 -0
  284. package/dist/search-bar-HTZQNPD3.js +212 -0
  285. package/dist/search-bar-HTZQNPD3.js.map +1 -0
  286. package/dist/spellchecker-DJ7SP5JY.js +474 -0
  287. package/dist/spellchecker-DJ7SP5JY.js.map +1 -0
  288. package/dist/suggestions-panel-RJXC4LCM.js +596 -0
  289. package/dist/suggestions-panel-RJXC4LCM.js.map +1 -0
  290. package/dist/suggestions-ui-PODMNH7D.js +395 -0
  291. package/dist/suggestions-ui-PODMNH7D.js.map +1 -0
  292. package/dist/table-OBHE465Y.js +54 -0
  293. package/dist/table-OBHE465Y.js.map +1 -0
  294. package/dist/table-dialogs-UMIIZQYE.js +119 -0
  295. package/dist/table-dialogs-UMIIZQYE.js.map +1 -0
  296. package/dist/tableofcontents-ui-U2PYNPX6.js +167 -0
  297. package/dist/tableofcontents-ui-U2PYNPX6.js.map +1 -0
  298. package/dist/template-YYC2MGVH.js +278 -0
  299. package/dist/template-YYC2MGVH.js.map +1 -0
  300. package/dist/typography-EQUXUXIN.js +399 -0
  301. package/dist/typography-EQUXUXIN.js.map +1 -0
  302. package/dist/upload.cjs +160 -0
  303. package/dist/upload.cjs.map +1 -0
  304. package/dist/upload.d.cts +72 -0
  305. package/dist/upload.d.ts +72 -0
  306. package/dist/upload.js +132 -0
  307. package/dist/upload.js.map +1 -0
  308. package/dist/{visualblocks-RTAYJOGR.js → visualblocks-O5QW7ZDT.js} +10 -9
  309. package/dist/visualblocks-O5QW7ZDT.js.map +1 -0
  310. package/dist/visualchars-UQFRWQPE.js +134 -0
  311. package/dist/visualchars-UQFRWQPE.js.map +1 -0
  312. package/package.json +96 -6
  313. package/src/style.css +440 -508
  314. package/dist/advlist-K2U3VPH2.js.map +0 -1
  315. package/dist/autolink-XWDTLY37.js.map +0 -1
  316. package/dist/autoresize-UB3GOA6D.js.map +0 -1
  317. package/dist/autosave-MWNRUNU3.js.map +0 -1
  318. package/dist/charmap-ADLYOIB3.js.map +0 -1
  319. package/dist/chunk-435CRWKA.js +0 -983
  320. package/dist/chunk-435CRWKA.js.map +0 -1
  321. package/dist/chunk-46RIM5KP.js +0 -5949
  322. package/dist/chunk-46RIM5KP.js.map +0 -1
  323. package/dist/chunk-6RJENZXT.js +0 -104
  324. package/dist/chunk-6RJENZXT.js.map +0 -1
  325. package/dist/chunk-7ON7PR5R.js.map +0 -1
  326. package/dist/chunk-GHEFKKRC.js.map +0 -1
  327. package/dist/chunk-HPLT3XRZ.js.map +0 -1
  328. package/dist/chunk-HZRIBOPW.js.map +0 -1
  329. package/dist/chunk-NPKAIW34.js.map +0 -1
  330. package/dist/chunk-Z3ELZ77W.js.map +0 -1
  331. package/dist/comments-panel-FYJE3U64.js.map +0 -1
  332. package/dist/directionality-XOHJFSL6.js.map +0 -1
  333. package/dist/emoticons-TP4N4ZGY.js.map +0 -1
  334. package/dist/insertdatetime-T4SEMQWP.js.map +0 -1
  335. package/dist/nonbreaking-HG5HV6AL.js.map +0 -1
  336. package/dist/quickbars-4NU4SIPL.js.map +0 -1
  337. package/dist/revisionhistory-3YQPLPLM.js.map +0 -1
  338. package/dist/visualblocks-RTAYJOGR.js.map +0 -1
@@ -0,0 +1,2888 @@
1
+ import { A11yCheckOptions, A11yIssue } from './a11y.js';
2
+ import * as prosemirror_model from 'prosemirror-model';
3
+ import { Schema, NodeSpec, Node as Node$1, DOMOutputSpec, Fragment, MarkSpec, MarkType, NodeType } from 'prosemirror-model';
4
+ import { Command, EditorState, Plugin, Transaction } from 'prosemirror-state';
5
+ import { NodeViewConstructor, EditorView } from 'prosemirror-view';
6
+ import { H as HtmlRulesInstance } from './html-rules-api-BLDDW9MO.js';
7
+ import { T as Translator, M as MessageKey, L as LanguagePack } from './index-CZ9yDvmQ.js';
8
+
9
+ /**
10
+ * Content restrictions (like valid_elements / invalid_elements / valid_styles).
11
+ *
12
+ * There is one NovaProse schema per process, so restrictions are not another schema but a
13
+ * normalizer: everything disallowed degrades (bold → text, h1 → paragraph, list → paragraphs,
14
+ * table → its content) on any change of the document — paste, drag and drop, setContent, shortcuts.
15
+ */
16
+ interface ContentRulesOptions {
17
+ /**
18
+ * ONLY these elements are allowed: 'p,strong/b,em/i,a[href|title],ul,ol'. An attribute list in
19
+ * [...] is the complete list for the element; an element without [...] keeps its built-in attributes.
20
+ */
21
+ validElements?: string;
22
+ /**
23
+ * More elements and attributes (validElements syntax): 'div[class],h2[id],i[class]'. A rule for an
24
+ * element replaces its attribute list; `@[id|title]` — attributes of all elements.
25
+ */
26
+ extendedValidElements?: string;
27
+ /** Your own elements: 'my-widget,~my-chip' (~ — inline, like span; without ~ — a block, like div). */
28
+ customElements?: string;
29
+ /** Disallowed elements: 'img,table,h1'. */
30
+ invalidElements?: string;
31
+ /** Allowed CSS properties: 'color,text-align' or { '*': 'color', img: 'float' }. */
32
+ validStyles?: string | Record<string, string>;
33
+ }
34
+
35
+ /**
36
+ * The base document schema of NovaProse. Every node and mark defines both HTML parsing (parseDOM)
37
+ * and serialization (toDOM), so the HTML going in and out is predictable.
38
+ */
39
+ declare const ALIGNMENTS: readonly ["left", "center", "right", "justify"];
40
+ type TextAlign = (typeof ALIGNMENTS)[number];
41
+ type TextDirection = 'ltr' | 'rtl';
42
+ type ImageAlign = 'left' | 'center' | 'right';
43
+ /** Which classes from HTML to keep. By default none: output without classes. */
44
+ type ClassFilter = (className: string) => boolean;
45
+ declare const nodes: {
46
+ table: NodeSpec;
47
+ table_row: NodeSpec;
48
+ table_cell: NodeSpec;
49
+ table_header: NodeSpec;
50
+ doc: {
51
+ content: string;
52
+ };
53
+ paragraph: {
54
+ group: string;
55
+ content: string;
56
+ attrs: {
57
+ class: {
58
+ default: null;
59
+ };
60
+ align: {
61
+ default: null;
62
+ };
63
+ lineHeight: {
64
+ default: null;
65
+ };
66
+ dir: {
67
+ default: null;
68
+ };
69
+ indent: {
70
+ default: number;
71
+ };
72
+ };
73
+ parseDOM: {
74
+ tag: string;
75
+ getAttrs: (dom: HTMLElement) => {
76
+ class: string | null;
77
+ align: TextAlign | null;
78
+ lineHeight: string | null;
79
+ dir: TextDirection | null;
80
+ indent: number;
81
+ };
82
+ }[];
83
+ toDOM: (node: Node$1) => DOMOutputSpec;
84
+ };
85
+ heading: {
86
+ group: string;
87
+ content: string;
88
+ defining: true;
89
+ attrs: {
90
+ class: {
91
+ default: null;
92
+ };
93
+ align: {
94
+ default: null;
95
+ };
96
+ lineHeight: {
97
+ default: null;
98
+ };
99
+ dir: {
100
+ default: null;
101
+ };
102
+ indent: {
103
+ default: number;
104
+ };
105
+ level: {
106
+ default: number;
107
+ };
108
+ id: {
109
+ default: null;
110
+ };
111
+ };
112
+ parseDOM: {
113
+ tag: string;
114
+ getAttrs: (dom: HTMLElement) => {
115
+ class: string | null;
116
+ align: TextAlign | null;
117
+ lineHeight: string | null;
118
+ dir: TextDirection | null;
119
+ indent: number;
120
+ level: number;
121
+ id: string | null;
122
+ };
123
+ }[];
124
+ toDOM: (node: Node$1) => DOMOutputSpec;
125
+ };
126
+ blockquote: {
127
+ group: string;
128
+ content: string;
129
+ defining: true;
130
+ attrs: {
131
+ class: {
132
+ default: null;
133
+ };
134
+ };
135
+ parseDOM: {
136
+ tag: string;
137
+ getAttrs: (dom: HTMLElement) => {
138
+ class: string | null;
139
+ };
140
+ }[];
141
+ toDOM: (node: Node$1) => DOMOutputSpec;
142
+ };
143
+ horizontal_rule: {
144
+ group: string;
145
+ parseDOM: {
146
+ tag: string;
147
+ }[];
148
+ toDOM: () => DOMOutputSpec;
149
+ };
150
+ code_block: {
151
+ group: string;
152
+ content: string;
153
+ marks: string;
154
+ code: true;
155
+ defining: true;
156
+ attrs: {
157
+ language: {
158
+ default: null;
159
+ };
160
+ };
161
+ parseDOM: {
162
+ tag: string;
163
+ preserveWhitespace: "full";
164
+ getAttrs: (dom: HTMLElement) => {
165
+ language: string | null;
166
+ };
167
+ getContent: (dom: Node, schema: Schema<any, any>) => Fragment;
168
+ }[];
169
+ toDOM: (node: Node$1) => DOMOutputSpec;
170
+ };
171
+ bullet_list: {
172
+ group: string;
173
+ content: string;
174
+ attrs: {
175
+ listStyle: {
176
+ default: null;
177
+ };
178
+ checklist: {
179
+ default: boolean;
180
+ };
181
+ };
182
+ parseDOM: {
183
+ tag: string;
184
+ getAttrs: (dom: HTMLElement) => {
185
+ listStyle: string | null;
186
+ checklist: boolean;
187
+ };
188
+ }[];
189
+ toDOM: (node: Node$1) => DOMOutputSpec;
190
+ };
191
+ ordered_list: {
192
+ group: string;
193
+ content: string;
194
+ attrs: {
195
+ start: {
196
+ default: number;
197
+ };
198
+ listStyle: {
199
+ default: null;
200
+ };
201
+ };
202
+ parseDOM: {
203
+ tag: string;
204
+ getAttrs: (dom: HTMLElement) => {
205
+ start: number;
206
+ listStyle: string | null;
207
+ };
208
+ }[];
209
+ toDOM: (node: Node$1) => DOMOutputSpec;
210
+ };
211
+ list_item: {
212
+ content: string;
213
+ defining: true;
214
+ attrs: {
215
+ checked: {
216
+ default: null;
217
+ };
218
+ };
219
+ parseDOM: {
220
+ tag: string;
221
+ getAttrs: (dom: HTMLElement) => {
222
+ checked: boolean | null;
223
+ };
224
+ }[];
225
+ toDOM: (node: Node$1) => DOMOutputSpec;
226
+ };
227
+ text: {
228
+ group: string;
229
+ };
230
+ /**
231
+ * An image with a caption: <figure><img><figcaption>…</figcaption></figure>, as in HTML — two
232
+ * blocks inside. So the caption can't become a heading or a list (the schema won't let another
233
+ * block into figure) and the image is never lost. Image attributes live on figure_image, alignment on figure.
234
+ */
235
+ figure: {
236
+ group: string;
237
+ content: string;
238
+ draggable: true;
239
+ isolating: true;
240
+ attrs: {
241
+ class: {
242
+ default: null;
243
+ };
244
+ align: {
245
+ default: null;
246
+ };
247
+ };
248
+ parseDOM: {
249
+ tag: string;
250
+ getAttrs: (dom: HTMLElement) => false | {
251
+ align: ImageAlign | null;
252
+ class: string | null;
253
+ };
254
+ }[];
255
+ toDOM: (node: Node$1) => DOMOutputSpec;
256
+ };
257
+ /** An image inside figure (a block, unlike an image in a line). */
258
+ figure_image: {
259
+ atom: true;
260
+ selectable: false;
261
+ attrs: {
262
+ src: {
263
+ default: string;
264
+ };
265
+ alt: {
266
+ default: null;
267
+ };
268
+ title: {
269
+ default: null;
270
+ };
271
+ width: {
272
+ default: null;
273
+ };
274
+ height: {
275
+ default: null;
276
+ };
277
+ };
278
+ parseDOM: {
279
+ tag: string;
280
+ context: string;
281
+ priority: number;
282
+ getAttrs: (dom: HTMLElement) => false | {
283
+ src: string | null;
284
+ alt: string | null;
285
+ title: string | null;
286
+ width: number | null;
287
+ height: number | null;
288
+ };
289
+ }[];
290
+ toDOM: (node: Node$1) => DOMOutputSpec;
291
+ };
292
+ figcaption: {
293
+ content: string;
294
+ parseDOM: {
295
+ tag: string;
296
+ context: string;
297
+ }[];
298
+ toDOM: () => DOMOutputSpec;
299
+ };
300
+ image: {
301
+ group: string;
302
+ inline: true;
303
+ draggable: true;
304
+ attrs: {
305
+ class: {
306
+ default: null;
307
+ };
308
+ src: {};
309
+ alt: {
310
+ default: null;
311
+ };
312
+ title: {
313
+ default: null;
314
+ };
315
+ width: {
316
+ default: null;
317
+ };
318
+ height: {
319
+ default: null;
320
+ };
321
+ align: {
322
+ default: null;
323
+ };
324
+ };
325
+ parseDOM: {
326
+ tag: string;
327
+ getAttrs: (dom: HTMLElement) => false | {
328
+ src: string | null;
329
+ alt: string | null;
330
+ title: string | null;
331
+ width: number | null;
332
+ height: number | null;
333
+ align: ImageAlign | null;
334
+ class: string | null;
335
+ };
336
+ }[];
337
+ toDOM: (node: Node$1) => DOMOutputSpec;
338
+ };
339
+ hard_break: {
340
+ group: string;
341
+ inline: true;
342
+ selectable: false;
343
+ parseDOM: {
344
+ tag: string;
345
+ }[];
346
+ toDOM: () => DOMOutputSpec;
347
+ };
348
+ };
349
+ declare const marks: {
350
+ link: {
351
+ attrs: {
352
+ href: {};
353
+ title: {
354
+ default: null;
355
+ };
356
+ target: {
357
+ default: null;
358
+ };
359
+ };
360
+ inclusive: false;
361
+ parseDOM: {
362
+ tag: string;
363
+ getAttrs: (dom: HTMLElement) => false | {
364
+ href: string | null;
365
+ title: string | null;
366
+ target: string | null;
367
+ };
368
+ }[];
369
+ toDOM: (mark: prosemirror_model.Mark) => DOMOutputSpec;
370
+ };
371
+ bold: {
372
+ parseDOM: ({
373
+ tag: string;
374
+ getAttrs?: undefined;
375
+ style?: undefined;
376
+ } | {
377
+ tag: string;
378
+ getAttrs: (dom: HTMLElement) => false | null;
379
+ style?: undefined;
380
+ } | {
381
+ style: string;
382
+ getAttrs: (value: string) => false | null;
383
+ tag?: undefined;
384
+ })[];
385
+ toDOM: () => DOMOutputSpec;
386
+ };
387
+ italic: {
388
+ parseDOM: ({
389
+ tag: string;
390
+ style?: undefined;
391
+ } | {
392
+ style: string;
393
+ tag?: undefined;
394
+ })[];
395
+ toDOM: () => DOMOutputSpec;
396
+ };
397
+ underline: {
398
+ parseDOM: ({
399
+ tag: string;
400
+ style?: undefined;
401
+ } | {
402
+ style: string;
403
+ tag?: undefined;
404
+ })[];
405
+ toDOM: () => DOMOutputSpec;
406
+ };
407
+ strike: {
408
+ parseDOM: ({
409
+ tag: string;
410
+ style?: undefined;
411
+ } | {
412
+ style: string;
413
+ tag?: undefined;
414
+ })[];
415
+ toDOM: () => DOMOutputSpec;
416
+ };
417
+ code: {
418
+ code: true;
419
+ parseDOM: {
420
+ tag: string;
421
+ }[];
422
+ toDOM: () => DOMOutputSpec;
423
+ };
424
+ subscript: {
425
+ excludes: string;
426
+ parseDOM: ({
427
+ tag: string;
428
+ style?: undefined;
429
+ } | {
430
+ style: string;
431
+ tag?: undefined;
432
+ })[];
433
+ toDOM: () => DOMOutputSpec;
434
+ };
435
+ superscript: {
436
+ excludes: string;
437
+ parseDOM: ({
438
+ tag: string;
439
+ style?: undefined;
440
+ } | {
441
+ style: string;
442
+ tag?: undefined;
443
+ })[];
444
+ toDOM: () => DOMOutputSpec;
445
+ };
446
+ color: {
447
+ attrs: {
448
+ value: {};
449
+ };
450
+ parseDOM: ({
451
+ style: string;
452
+ getAttrs: (v: string) => false | {
453
+ value: string;
454
+ };
455
+ tag?: undefined;
456
+ } | {
457
+ tag: string;
458
+ getAttrs: (dom: HTMLElement) => false | {
459
+ value: string;
460
+ };
461
+ style?: undefined;
462
+ })[];
463
+ toDOM: (mark: prosemirror_model.Mark) => DOMOutputSpec;
464
+ };
465
+ background: {
466
+ attrs: {
467
+ value: {};
468
+ };
469
+ parseDOM: ({
470
+ style: string;
471
+ getAttrs: (v: string) => false | {
472
+ value: string;
473
+ };
474
+ tag?: undefined;
475
+ } | {
476
+ tag: string;
477
+ getAttrs: () => {
478
+ value: string;
479
+ };
480
+ style?: undefined;
481
+ })[];
482
+ toDOM: (mark: prosemirror_model.Mark) => DOMOutputSpec;
483
+ };
484
+ font_family: {
485
+ attrs: {
486
+ value: {};
487
+ };
488
+ parseDOM: {
489
+ style: string;
490
+ getAttrs: (v: string) => false | {
491
+ value: string;
492
+ };
493
+ }[];
494
+ toDOM: (mark: prosemirror_model.Mark) => DOMOutputSpec;
495
+ };
496
+ font_size: {
497
+ attrs: {
498
+ value: {};
499
+ };
500
+ parseDOM: {
501
+ style: string;
502
+ getAttrs: (v: string) => false | {
503
+ value: string;
504
+ };
505
+ }[];
506
+ toDOM: (mark: prosemirror_model.Mark) => DOMOutputSpec;
507
+ };
508
+ /** <span class="…"> — an inline style from style_formats. Allowed classes only. */
509
+ span_class: {
510
+ attrs: {
511
+ class: {};
512
+ };
513
+ parseDOM: {
514
+ tag: string;
515
+ consuming: false;
516
+ getAttrs: (dom: HTMLElement) => false | {
517
+ class: string;
518
+ };
519
+ }[];
520
+ toDOM: (mark: prosemirror_model.Mark) => DOMOutputSpec;
521
+ };
522
+ };
523
+ type NodeName = keyof typeof nodes;
524
+ type MarkName = keyof typeof marks;
525
+ /**
526
+ * An editor's schema: base nodes and marks plus plugin extensions. The type stays the base one:
527
+ * built-in code only touches its own nodes (`schema.nodes.paragraph`), plugin nodes are available by name.
528
+ */
529
+ type NovaSchema = Schema<NodeName, MarkName>;
530
+ /** The base schema without extensions, shared by editors without node plugins. */
531
+ declare const schema: NovaSchema;
532
+ interface SchemaExtensions {
533
+ nodes?: Record<string, NodeSpec>;
534
+ marks?: Record<string, MarkSpec>;
535
+ /** Attributes plugins add to existing nodes, by attribute name. */
536
+ attributes?: Record<string, NodeAttribute>;
537
+ }
538
+ /**
539
+ * An attribute a plugin adds to existing nodes: read from the node's element when HTML is parsed and
540
+ * written back to it. The value can come from JSON as anything: `render` must cope with that.
541
+ */
542
+ interface NodeAttribute {
543
+ /**
544
+ * Which nodes get it: their names, 'textblock' for every node that holds text, or 'all' for every
545
+ * node but the document and text.
546
+ */
547
+ nodes: readonly string[] | 'textblock' | 'all';
548
+ default: unknown;
549
+ /** The value from the element (null or undefined: none). */
550
+ parse(dom: HTMLElement): unknown;
551
+ /** The element's attributes for a value ({} for none). */
552
+ render(value: unknown): Record<string, string>;
553
+ }
554
+ /**
555
+ * A schema with the nodes and marks of plugins; without extensions, the shared base schema. New
556
+ * nodes and marks go at the end, so the base HTML parse rules keep priority unless a plugin sets its
557
+ * own `priority` in parseDOM.
558
+ */
559
+ declare function createSchema(extensions?: SchemaExtensions,
560
+ /** Which classes to keep (style_formats, validClasses). Without a filter, none. */
561
+ classFilter?: ClassFilter,
562
+ /** Rules for elements and attributes (validElements with attributes, extendedValidElements…). */
563
+ htmlRules?: HtmlRulesInstance | null,
564
+ /** The editor's direction: right-to-left, a block's indent is margin-right. */
565
+ direction?: 'ltr' | 'rtl'): NovaSchema;
566
+
567
+ /** The editor's named commands. The names are part of the public API (see Editor.exec). */
568
+ 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' | 'moveBlockUp' | 'moveBlockDown';
569
+ /**
570
+ * Node and mark types come from the schema of the specific editor (state.schema): editors with
571
+ * plugins have their own, and comparing with the shared base schema's types would give false.
572
+ */
573
+ declare const nodesOf: (state: EditorState) => {
574
+ readonly doc: NodeType;
575
+ readonly paragraph: NodeType;
576
+ readonly heading: NodeType;
577
+ readonly blockquote: NodeType;
578
+ readonly horizontal_rule: NodeType;
579
+ readonly code_block: NodeType;
580
+ readonly bullet_list: NodeType;
581
+ readonly ordered_list: NodeType;
582
+ readonly list_item: NodeType;
583
+ readonly text: NodeType;
584
+ readonly figure: NodeType;
585
+ readonly figure_image: NodeType;
586
+ readonly figcaption: NodeType;
587
+ readonly image: NodeType;
588
+ readonly hard_break: NodeType;
589
+ readonly table: NodeType;
590
+ readonly table_row: NodeType;
591
+ readonly table_cell: NodeType;
592
+ readonly table_header: NodeType;
593
+ } & {
594
+ readonly [key: string]: NodeType;
595
+ };
596
+ declare const marksOf: (state: EditorState) => {
597
+ readonly link: MarkType;
598
+ readonly bold: MarkType;
599
+ readonly italic: MarkType;
600
+ readonly underline: MarkType;
601
+ readonly strike: MarkType;
602
+ readonly code: MarkType;
603
+ readonly subscript: MarkType;
604
+ readonly superscript: MarkType;
605
+ readonly color: MarkType;
606
+ readonly background: MarkType;
607
+ readonly font_family: MarkType;
608
+ readonly font_size: MarkType;
609
+ readonly span_class: MarkType;
610
+ } & {
611
+ readonly [key: string]: MarkType;
612
+ };
613
+ declare const commands: Record<CommandName, Command>;
614
+ /** Insert or update a link on the selection. */
615
+ declare function setLink(href: string, attrs?: {
616
+ title?: string;
617
+ target?: string;
618
+ }): Command;
619
+ /** Insert an image in place of the selection. */
620
+ declare function insertImage(src: string, alt?: string): Command;
621
+ declare function isMarkActive(state: EditorState, type: MarkType): boolean;
622
+ declare function isNodeActive(state: EditorState, type: NodeType, attrs?: Record<string, unknown>): boolean;
623
+ declare function getActiveAlign(state: EditorState): TextAlign;
624
+ /**
625
+ * Whether a command is active for the current selection: the mark is applied, the block has the
626
+ * right type, the alignment matches. Always `false` for action commands (undo, indent, horizontalRule…).
627
+ */
628
+ declare function isCommandActive(state: EditorState, command: CommandName): boolean;
629
+ declare function getLinkAt(state: EditorState): {
630
+ href: string;
631
+ title: string | null;
632
+ target: string | null;
633
+ } | null;
634
+
635
+ /**
636
+ * A command chain: several steps as one edit (one undo step, one change event).
637
+ *
638
+ * editor.chain().exec('h2').exec('alignCenter').run();
639
+ * editor.chain().insertContent('<p>Note</p>').exec(setStyle('color', '#e03e2d')).run();
640
+ *
641
+ * Steps work on a shared transaction: each sees the document and the selection after the previous
642
+ * ones (like chains in other ProseMirror editors). The difference is all-or-nothing: if a step
643
+ * fails, the document doesn't change and run() returns false. can() checks the chain honestly: the
644
+ * steps run on a draft transaction that is never applied.
645
+ */
646
+ /** Named commands for a chain: undo and redo only work on their own (editor.exec). */
647
+ type ChainCommandName = Exclude<CommandName, 'undo' | 'redo'>;
648
+ interface CommandChain {
649
+ /** A step: a named command or a ProseMirror command (setStyle(…), applyLink(…), your own). */
650
+ exec(command: ChainCommandName | Command): CommandChain;
651
+ /** A step: insert HTML at the cursor, like editor.insertContent(). */
652
+ insertContent(html: string): CommandChain;
653
+ /** Run the steps as one edit. If a step fails, the document doesn't change and the result is false. */
654
+ run(): boolean;
655
+ /** Whether run() would succeed now (for buttons). The document doesn't change. */
656
+ can(): boolean;
657
+ }
658
+
659
+ /**
660
+ * A node drawn by your own code — a React or Vue component, or plain DOM. The core takes care of
661
+ * ProseMirror (editable content, selection, mutations, events); the renderer only draws markup:
662
+ *
663
+ * nodeViews: { callout: defineNodeView(() => ({ mount(dom, props) {…}, update(props) {…}, destroy() {…} })) }
664
+ *
665
+ * The framework wrappers provide ready renderers: reactNodeView(Component), vueNodeView(Component).
666
+ * A view doesn't change the document's HTML: getHTML() and the server use the schema's toDOM.
667
+ */
668
+ interface NodeViewProps {
669
+ editor: Editor;
670
+ /** The document node: `node.attrs`, `node.type.name`, `node.textContent`. */
671
+ node: Node$1;
672
+ /** The whole node is selected (a click on a node without content, or a selection around it). */
673
+ selected: boolean;
674
+ /** The node's position in the document; undefined when the node is already gone. */
675
+ getPos(): number | undefined;
676
+ /** Change the node's attributes — one edit, undone with Ctrl+Z. */
677
+ updateAttributes(attrs: Record<string, unknown>): void;
678
+ /** Delete the node. */
679
+ deleteNode(): void;
680
+ /**
681
+ * The element of the editable content (for nodes with content, null otherwise). The renderer puts
682
+ * it in its place in the markup (the NodeViewContent component); until then it sits in the view's root.
683
+ */
684
+ contentDOM: HTMLElement | null;
685
+ }
686
+ interface NodeViewRenderer {
687
+ /** Draw the view in the dom element (already created; the editor inserts it into the document). */
688
+ mount(dom: HTMLElement, props: NodeViewProps): void;
689
+ /** The node, its attributes or the selection changed. */
690
+ update(props: NodeViewProps): void;
691
+ /** The node left the document (or the editor was destroyed). */
692
+ destroy(): void;
693
+ }
694
+ interface NodeViewOptions {
695
+ /** Tag of the view's root: div by default, span for inline nodes. */
696
+ as?: string;
697
+ /** Tag of the content element: the same as the root's by default. */
698
+ contentAs?: string;
699
+ /** Class of the view's root. */
700
+ className?: string;
701
+ /**
702
+ * Whether the view takes an event away from the editor. By default it takes events of the view's
703
+ * inputs, lists and buttons (outside the content), so typing in them doesn't reach the document.
704
+ */
705
+ stopEvent?: (event: Event) => boolean;
706
+ }
707
+ /** A view factory for NovaPlugin.nodeViews: the core calls it with its editor. */
708
+ type NodeViewFactory = (editor: Editor) => NodeViewConstructor;
709
+ /** A node view from your own renderer (React, Vue, DOM): `create` is called for each node. */
710
+ declare function defineNodeView(create: (editor: Editor) => NodeViewRenderer, options?: NodeViewOptions): NodeViewFactory;
711
+
712
+ interface MenuDefinition {
713
+ /** The menu title (a string) or a translation key. */
714
+ title: string;
715
+ /** Items separated by spaces, '|' is a separator: 'undo redo | searchreplace'. */
716
+ items: string;
717
+ }
718
+ /** The standard menus. Item names come from the registry of menu items or toolbar buttons. */
719
+ declare const DEFAULT_MENUS: Record<string, MenuDefinition>;
720
+ declare const DEFAULT_MENUBAR = "file edit view insert format table help";
721
+
722
+ /** What the user chose in your file manager. */
723
+ interface FilePickResult {
724
+ url: string;
725
+ /** Link text (in the link dialog, when the text is still empty). */
726
+ text?: string;
727
+ /** The link's tooltip (title) or the video's name. */
728
+ title?: string;
729
+ /** The image's alternative text. */
730
+ alt?: string;
731
+ }
732
+ /** Which field asks for a file: a link to any file, an image or a video. */
733
+ type FilePickType = 'file' | 'image' | 'media';
734
+ /**
735
+ * Your own file picker (like file_picker_callback in TinyMCE): open your file manager and return an
736
+ * address. null/undefined — the user changed their mind.
737
+ */
738
+ type FilePicker = (request: {
739
+ type: FilePickType;
740
+ value: string;
741
+ }) => Promise<FilePickResult | null | undefined> | FilePickResult | null | undefined;
742
+
743
+ type BlockTag = 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'blockquote' | 'pre';
744
+ type InlineTag = 'span' | 'strong' | 'b' | 'em' | 'i' | 'u' | 's' | 'strike' | 'del' | 'code' | 'sub' | 'sup';
745
+ interface FormatSpec {
746
+ /** Change the block type. */
747
+ block?: BlockTag;
748
+ /** Mark the selected text. */
749
+ inline?: InlineTag;
750
+ /** Apply to existing elements: 'p,h1', 'img', 'blockquote'. */
751
+ selector?: string;
752
+ /** Classes: 'note' or ['note', 'warning']. */
753
+ classes?: string | string[];
754
+ /**
755
+ * Styles. For text — color, background-color, font-family, font-size; for blocks — text-align,
756
+ * line-height. Others aren't supported (a warning in the console).
757
+ */
758
+ styles?: Record<string, string>;
759
+ }
760
+ /** An item of the Styles menu: your own format, a reference to a named one (format) or a group (items). */
761
+ interface StyleFormat extends FormatSpec {
762
+ title: string;
763
+ format?: string;
764
+ items?: StyleFormat[];
765
+ }
766
+ /**
767
+ * The editor's formats and applying them to the selection (`editor.formatter`). Classes of
768
+ * registered formats are kept when HTML is parsed.
769
+ */
770
+ declare class Formatter {
771
+ private readonly editor;
772
+ /** Grows with the classes of new formats; the schema checks against it when parsing HTML. */
773
+ private readonly allowedClasses;
774
+ private readonly registry;
775
+ constructor(editor: Editor,
776
+ /** Grows with the classes of new formats; the schema checks against it when parsing HTML. */
777
+ allowedClasses: Set<string>);
778
+ /** Register a named format (one description or several variants). */
779
+ register(name: string, spec: FormatSpec | FormatSpec[]): void;
780
+ unregister(name: string): void;
781
+ has(name: string): boolean;
782
+ get(name: string): FormatSpec[] | undefined;
783
+ private resolve;
784
+ /** Whether the format can apply to the selection (for selector: whether there are matching elements). */
785
+ canApply(format: string | FormatSpec): boolean;
786
+ /** Whether the selection matches the format. */
787
+ match(format: string | FormatSpec): boolean;
788
+ apply(format: string | FormatSpec): boolean;
789
+ remove(format: string | FormatSpec): boolean;
790
+ toggle(format: string | FormatSpec): boolean;
791
+ private run;
792
+ }
793
+
794
+ /**
795
+ * Image upload handler (like images_upload_handler): gets a file, returns its URL. progress(0..100)
796
+ * is an optional progress indicator.
797
+ */
798
+ type UploadImageHandler = (file: File, progress: (percent: number) => void) => Promise<string>;
799
+ /**
800
+ * Insert and upload image files. While a file uploads, its local copy (blob:) is shown
801
+ * semi-transparent; after the upload src is replaced, and on an error the image is removed with a
802
+ * message. Without uploadImage the image is embedded as a data: URL (as TinyMCE does without a handler).
803
+ */
804
+ declare function uploadImages(editor: Editor, files: File[], pos?: number): void;
805
+ /** The insert image dialog: upload a file or enter a URL, plus the alt text that should always be there. */
806
+ declare function openImageDialog(editor: Editor): void;
807
+ /** The selected image: the node (image or figure), its position and the image's attributes. */
808
+ interface SelectedImage {
809
+ node: Node$1;
810
+ pos: number;
811
+ /** src, alt, title, width, height, align — for figure, collected from figure and figure_image. */
812
+ attrs: Record<string, unknown>;
813
+ }
814
+ /**
815
+ * The selected image: an image in a line, an image with a caption (figure), or the caption the
816
+ * cursor is in. The image toolbar actions (alignment, size, alt) work for both.
817
+ */
818
+ declare function getSelectedImage(state: EditorState): SelectedImage | null;
819
+ /**
820
+ * Change the attributes of the selected image. For figure, alignment goes on figure and the rest
821
+ * on the image inside. Selection: an image in a line stays selected as a node; for figure the
822
+ * cursor isn't touched (you can keep typing the caption).
823
+ */
824
+ declare function setImageAttrs(attrs: Partial<Record<'alt' | 'title' | 'width' | 'height' | 'align', unknown>>): Command;
825
+ /** Image width as a fraction of the text area width (aspect ratio kept); null — the original size. */
826
+ declare function setImageWidthFraction(editor: Editor, fraction: number | null): boolean;
827
+ /** The alternative text dialog — the most important accessibility setting of an image. */
828
+ declare function openImageAltDialog(editor: Editor): void;
829
+
830
+ /**
831
+ * A dialog described by its fields, for plugins (editor.ui.dialog). The implementation
832
+ * (form-dialog.ts) loads when a dialog first opens; only these types are in the core's first load.
833
+ *
834
+ * const data = await editor.ui.dialog({
835
+ * title: 'Insert video',
836
+ * submitLabel: 'Insert',
837
+ * fields: [
838
+ * { type: 'url', name: 'src', label: 'Video URL', required: true },
839
+ * { type: 'checkbox', name: 'autoplay', label: 'Autoplay' },
840
+ * ],
841
+ * }); // the data, or null if the dialog was closed
842
+ */
843
+ /** A field's value; for a file field, an array of the chosen files (empty when none). */
844
+ type DialogFieldValue = string | number | boolean | null | File[];
845
+ type DialogData = Record<string, DialogFieldValue>;
846
+ interface FieldBase {
847
+ name: string;
848
+ label: string;
849
+ /** A hint under the field (linked to it through aria-describedby). */
850
+ hint?: string;
851
+ required?: boolean;
852
+ disabled?: boolean;
853
+ /** Your own check: return an error message or nothing. */
854
+ validate?: (value: DialogFieldValue, data: DialogData) => string | null | undefined | void;
855
+ }
856
+ type DialogField = (FieldBase & {
857
+ type: 'text' | 'url' | 'email' | 'tel';
858
+ placeholder?: string;
859
+ }) | (FieldBase & {
860
+ type: 'number';
861
+ min?: number;
862
+ max?: number;
863
+ step?: number;
864
+ }) | (FieldBase & {
865
+ type: 'textarea';
866
+ rows?: number;
867
+ placeholder?: string;
868
+ /** A field for code: monospace, no spell check, no line wrapping. */
869
+ code?: boolean;
870
+ }) | (FieldBase & {
871
+ type: 'select';
872
+ options: {
873
+ value: string;
874
+ label: string;
875
+ }[];
876
+ }) | (FieldBase & {
877
+ type: 'checkbox' | 'color';
878
+ }) | (FieldBase & {
879
+ type: 'file';
880
+ /** Accepted types, as in <input accept>: 'image/*,.pdf'. */
881
+ accept?: string;
882
+ multiple?: boolean;
883
+ /** The largest size of one file, in bytes. */
884
+ maxSize?: number;
885
+ }) | {
886
+ type: 'message';
887
+ text: string;
888
+ tone?: 'info' | 'warning' | 'error';
889
+ } | {
890
+ type: 'custom';
891
+ render: (api: DialogApi) => HTMLElement;
892
+ };
893
+ /** A dialog tab: a title and its own fields (the data of all tabs comes in one object). */
894
+ interface DialogTab {
895
+ title: string;
896
+ fields: DialogField[];
897
+ }
898
+ interface DialogSpecBase {
899
+ title: string;
900
+ initialData?: DialogData;
901
+ /** Label of the submit button ("Save" by default). */
902
+ submitLabel?: string;
903
+ cancelLabel?: string;
904
+ size?: 'normal' | 'large';
905
+ /**
906
+ * Submit after the fields are checked. Return false or an error message to keep the dialog open.
907
+ * May return a promise (the buttons are disabled until it settles).
908
+ */
909
+ onSubmit?: (data: DialogData, api: DialogApi) => void | boolean | string | Promise<void | boolean | string>;
910
+ onChange?: (data: DialogData, details: {
911
+ name: string;
912
+ }, api: DialogApi) => void;
913
+ /** The dialog was closed without submitting (Esc, Cancel, the close button). */
914
+ onCancel?: () => void;
915
+ /** Close the dialog from outside (for example, when leaving the page), like Cancel. */
916
+ signal?: AbortSignal;
917
+ }
918
+ /** Fields as a list or in tabs (`tabs`). */
919
+ type DialogSpec = DialogSpecBase & ({
920
+ fields: DialogField[];
921
+ tabs?: undefined;
922
+ } | {
923
+ tabs: DialogTab[];
924
+ fields?: undefined;
925
+ });
926
+ interface DialogApi {
927
+ getData(): DialogData;
928
+ setData(data: DialogData): void;
929
+ /** An error for the whole dialog (above the buttons). */
930
+ setError(message: string | null): void;
931
+ /** An error for a field (under it). */
932
+ setFieldError(name: string, message: string | null): void;
933
+ setBusy(busy: boolean): void;
934
+ setEnabled(name: string, enabled: boolean): void;
935
+ focus(name: string): void;
936
+ /** Show a tab (by index, from zero). */
937
+ showTab(index: number): void;
938
+ close(): void;
939
+ }
940
+
941
+ /**
942
+ * Plugin sidebars (comments, an outline, your own tools): a column next to the text, below it on a
943
+ * narrow screen. One sidebar is open at a time. Its content is drawn on first show (it can load
944
+ * lazily), and the sidebar stays in the DOM, keeping its state between shows.
945
+ *
946
+ * editor.ui.registry.addSidebar('outline', {
947
+ * title: 'Outline',
948
+ * icon: '<svg …>',
949
+ * render: (container, editor) => { … },
950
+ * });
951
+ * editor.ui.sidebar.toggle('outline');
952
+ */
953
+ interface SidebarSpec {
954
+ /** The sidebar's title (visible and announced) and the default button label. */
955
+ title: string;
956
+ /** Icon of the toolbar button (an SVG string). */
957
+ icon?: string;
958
+ /** Tooltip of the button (title by default). */
959
+ tooltip?: string;
960
+ /**
961
+ * A toolbar toggle button and a menu item named after the sidebar (yes by default, if the name is
962
+ * free). false — toggle the sidebar with your own buttons through editor.ui.sidebar.
963
+ */
964
+ button?: boolean;
965
+ /** false — the sidebar draws its own title and close button (the container then has no role). */
966
+ header?: boolean;
967
+ /** Draw the content — once, on first show. May return a cleanup function. */
968
+ render: (container: HTMLElement, editor: Editor) => void | (() => void) | Promise<void | (() => void)>;
969
+ onShow?: (editor: Editor) => void;
970
+ onHide?: (editor: Editor) => void;
971
+ }
972
+ declare class Sidebars {
973
+ private readonly editor;
974
+ private current;
975
+ private readonly mounted;
976
+ private column;
977
+ private opening;
978
+ private destroyed;
979
+ constructor(editor: Editor);
980
+ /** Name of the open sidebar, or null. */
981
+ get active(): string | null;
982
+ isOpen(name: string): boolean;
983
+ /**
984
+ * Show a sidebar (another open one closes). `focus` — move focus into the sidebar (for example,
985
+ * when it was opened from the keyboard, to work with it right away).
986
+ */
987
+ show(name: string, options?: {
988
+ focus?: boolean;
989
+ }): Promise<void>;
990
+ /** Close the open sidebar. Focus returns from it to the text. */
991
+ hide(options?: {
992
+ restoreFocus?: boolean;
993
+ }): void;
994
+ toggle(name: string, options?: {
995
+ focus?: boolean;
996
+ }): Promise<void>;
997
+ destroy(): void;
998
+ /** The "text + sidebar" column: created with the first sidebar; without sidebars the markup doesn't change. */
999
+ private host;
1000
+ private mount;
1001
+ }
1002
+
1003
+ /**
1004
+ * Views: a plugin's own screen in place of the editor (a review, a history, a report), with its own
1005
+ * buttons. One view is open at a time; while it is, the editor's toolbar, text and status bar are out
1006
+ * of sight (and out of the Tab order), and Escape or the view's buttons bring the text back.
1007
+ *
1008
+ * editor.ui.registry.addView('report', {
1009
+ * title: 'Report',
1010
+ * buttons: [{ text: 'Done', buttonType: 'primary', onAction: (e) => e.ui.view.hide() }],
1011
+ * onShow: (api) => api.getContainer().replaceChildren(…),
1012
+ * });
1013
+ * editor.ui.view.toggle('report');
1014
+ */
1015
+ interface ViewButton {
1016
+ text: string;
1017
+ /** primary: the view's main action (a filled button). */
1018
+ buttonType?: 'primary' | 'secondary';
1019
+ onAction: (editor: Editor) => void;
1020
+ }
1021
+ interface ViewApi {
1022
+ /** The element the view draws its content into. */
1023
+ getContainer(): HTMLElement;
1024
+ }
1025
+ interface ViewSpec {
1026
+ /** The view's heading (visible and announced); without it the view is named after its name. */
1027
+ title?: string;
1028
+ /** Buttons at the top of the view, on the end side. */
1029
+ buttons?: ViewButton[];
1030
+ /** Draw or refresh the content: called every time the view is shown. */
1031
+ onShow?: (api: ViewApi) => void;
1032
+ onHide?: (api: ViewApi) => void;
1033
+ }
1034
+ declare class Views {
1035
+ private readonly editor;
1036
+ private current;
1037
+ private readonly mounted;
1038
+ constructor(editor: Editor);
1039
+ /** The name of the open view, or null. */
1040
+ get active(): string | null;
1041
+ isOpen(name: string): boolean;
1042
+ show(name: string): void;
1043
+ /** Close the open view: the editor comes back, and focus returns to the text. */
1044
+ hide(options?: {
1045
+ restoreFocus?: boolean;
1046
+ }): void;
1047
+ toggle(name: string): void;
1048
+ destroy(): void;
1049
+ private mount;
1050
+ }
1051
+
1052
+ interface AutocompleterItem {
1053
+ value: string;
1054
+ label: string;
1055
+ icon?: string;
1056
+ /** A hint on the right: a shortcut in 'Mod-b' format. */
1057
+ shortcut?: string;
1058
+ /** A hint on the right as plain text (a job title, an e-mail). */
1059
+ detail?: string;
1060
+ }
1061
+ interface AutocompleterSpec {
1062
+ /** The trigger character: '/', '@', ':'. */
1063
+ trigger: string;
1064
+ /** How many characters after the trigger before the list shows (0 by default). */
1065
+ minChars?: number;
1066
+ /** Items for a query; may return a Promise (a search on the server). */
1067
+ fetch: (query: string, editor: Editor) => AutocompleterItem[] | Promise<AutocompleterItem[]>;
1068
+ /** An item was chosen. range — the positions of "trigger + query", usually deleted. */
1069
+ onSelect: (item: AutocompleterItem, range: {
1070
+ from: number;
1071
+ to: number;
1072
+ }, editor: Editor) => void;
1073
+ /** Label of the list for screen readers. */
1074
+ label: string;
1075
+ /** Text when nothing is found (otherwise the list hides). */
1076
+ emptyText?: string;
1077
+ maxResults?: number;
1078
+ }
1079
+
1080
+ interface MenuItem {
1081
+ type?: 'item';
1082
+ id: string;
1083
+ label: string;
1084
+ icon?: string;
1085
+ shortcut?: string;
1086
+ /** Checked (radio/checkbox): a check mark is shown. */
1087
+ active?: boolean;
1088
+ /** An independent toggle (bold, superscript): menuitemcheckbox rather than radio. */
1089
+ checkbox?: boolean;
1090
+ disabled?: boolean;
1091
+ /** Style of the label, to preview fonts and headings right in the menu. */
1092
+ labelStyle?: string;
1093
+ onSelect: () => void;
1094
+ }
1095
+ interface MenuSeparator {
1096
+ type: 'separator';
1097
+ }
1098
+ /** A heading of a group of items (not clickable). */
1099
+ interface MenuHeading {
1100
+ type: 'heading';
1101
+ label: string;
1102
+ }
1103
+ type MenuEntry = MenuItem | MenuSeparator | MenuHeading;
1104
+
1105
+ interface ControlBase {
1106
+ /** Text for the tooltip and aria-label. */
1107
+ tooltip: string;
1108
+ /** An SVG icon (string). Without one, `text` is shown. */
1109
+ icon?: string;
1110
+ /** Text on the button (for dropdowns: "Paragraph ▾"). */
1111
+ text?: string;
1112
+ /** Shortcut in ProseMirror format ('Mod-b'), shown in the tooltip only. */
1113
+ shortcut?: string;
1114
+ isEnabled?: (editor: Editor) => boolean;
1115
+ }
1116
+ interface ButtonSpec extends ControlBase {
1117
+ type: 'button';
1118
+ onAction: (editor: Editor) => void;
1119
+ /** When set, the button becomes a toggle (aria-pressed). */
1120
+ isActive?: (editor: Editor) => boolean;
1121
+ }
1122
+ interface MenuButtonSpec extends ControlBase {
1123
+ type: 'menu';
1124
+ items: (editor: Editor) => MenuEntry[];
1125
+ /** A dynamic label (the current block style, font and so on). */
1126
+ label?: (editor: Editor) => string;
1127
+ isActive?: (editor: Editor) => boolean;
1128
+ /** Minimum label width in characters, so the toolbar doesn't jump. */
1129
+ minChars?: number;
1130
+ }
1131
+ interface PanelButtonSpec extends ControlBase {
1132
+ type: 'panel';
1133
+ render: (editor: Editor, close: () => void) => HTMLElement;
1134
+ /** Color of the bar under the icon (the current text or background color). */
1135
+ indicator?: (editor: Editor) => string | null;
1136
+ isActive?: (editor: Editor) => boolean;
1137
+ }
1138
+ /**
1139
+ * A split button: the main part runs an action (toggle a list), the arrow opens a menu of variants
1140
+ * (the bullet style). Like bullist/numlist with the advlist plugin.
1141
+ */
1142
+ interface SplitButtonSpec extends ControlBase {
1143
+ type: 'split';
1144
+ onAction: (editor: Editor) => void;
1145
+ items: (editor: Editor) => MenuEntry[];
1146
+ isActive?: (editor: Editor) => boolean;
1147
+ }
1148
+ type ControlSpec = ButtonSpec | MenuButtonSpec | PanelButtonSpec | SplitButtonSpec;
1149
+ /** A menu bar item. */
1150
+ interface MenuItemSpec {
1151
+ text: string;
1152
+ icon?: string;
1153
+ shortcut?: string;
1154
+ onAction: (editor: Editor) => void;
1155
+ /** A check mark (toggle). */
1156
+ isActive?: (editor: Editor) => boolean;
1157
+ isEnabled?: (editor: Editor) => boolean;
1158
+ }
1159
+ type ContextPlacement = 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
1160
+ /** A context toolbar: appears next to the selected object (image, table, link). */
1161
+ interface ContextToolbarSpec {
1162
+ /** When to show it. Checked in order of registration; the first match wins. */
1163
+ predicate: (editor: Editor) => boolean;
1164
+ /** Buttons in toolbar format ('a b | c'), from the same registry. */
1165
+ items: string | string[];
1166
+ /** Label for screen readers. */
1167
+ label: string;
1168
+ /** Where to show it: above the selected node (default) or below the selection. */
1169
+ position?: 'node' | 'selection';
1170
+ /** Your own anchor (for example, the whole table). Overrides position. */
1171
+ anchor?: (editor: Editor) => DOMRect | null;
1172
+ /**
1173
+ * The side relative to the anchor; flips when there isn't room. A function when the side depends
1174
+ * on the state (a code block is always left-to-right, even in a right-to-left document).
1175
+ */
1176
+ placement?: ContextPlacement | ((editor: Editor) => ContextPlacement);
1177
+ /** Check order: higher goes first (default 0). Text selected in a table → the quickbar beats the table. */
1178
+ priority?: number;
1179
+ }
1180
+ type WithoutType<T> = Omit<T, 'type'>;
1181
+ /**
1182
+ * The registry of toolbar controls (like editor.ui.registry). Built-in buttons are registered the
1183
+ * same way as yours, so plugins can do everything the core can.
1184
+ */
1185
+ declare class Registry {
1186
+ private readonly controls;
1187
+ addButton(name: string, spec: WithoutType<ButtonSpec>): void;
1188
+ /** A synonym of addButton with isActive, for the familiar API. */
1189
+ addToggleButton(name: string, spec: WithoutType<ButtonSpec>): void;
1190
+ addMenuButton(name: string, spec: WithoutType<MenuButtonSpec>): void;
1191
+ addPanelButton(name: string, spec: WithoutType<PanelButtonSpec>): void;
1192
+ addSplitButton(name: string, spec: WithoutType<SplitButtonSpec>): void;
1193
+ private readonly menuItems;
1194
+ private styleFormats;
1195
+ /**
1196
+ * Items for the Styles menu from a plugin (importcss): after the menu's own items, or instead of
1197
+ * them (`replace`).
1198
+ */
1199
+ addStyleFormats(items: StyleFormat[], { replace }?: {
1200
+ replace?: boolean | undefined;
1201
+ }): void;
1202
+ /** What plugins added to the Styles menu. */
1203
+ getStyleFormats(): {
1204
+ items: readonly StyleFormat[];
1205
+ replace: boolean;
1206
+ };
1207
+ /** A menu bar item (like addMenuItem). */
1208
+ addMenuItem(name: string, spec: MenuItemSpec): void;
1209
+ /** A toggle item (with a check mark). */
1210
+ addToggleMenuItem(name: string, spec: MenuItemSpec & {
1211
+ isActive: (editor: Editor) => boolean;
1212
+ }): void;
1213
+ /**
1214
+ * A menu item by name. If there is no separate item, it is built from the toolbar button of the
1215
+ * same name (label = tooltip), so each feature isn't defined twice.
1216
+ */
1217
+ getMenuItem(name: string): MenuItemSpec | undefined;
1218
+ private readonly contextToolbars;
1219
+ private readonly autocompleters;
1220
+ /** An autocompleter on a trigger character: '/' — commands, '@' — mentions, ':' — emoji. */
1221
+ private readonly sidebars;
1222
+ /**
1223
+ * A sidebar (shown with editor.ui.sidebar). If the name is free, a toggle button with that name is
1224
+ * added for the toolbar and menus too (`button: false` — without it).
1225
+ */
1226
+ addSidebar(name: string, spec: SidebarSpec): void;
1227
+ getSidebar(name: string): SidebarSpec | undefined;
1228
+ private readonly views;
1229
+ /** A view: a plugin's screen in place of the editor (shown with editor.ui.view). */
1230
+ addView(name: string, spec: ViewSpec): void;
1231
+ getView(name: string): ViewSpec | undefined;
1232
+ addAutocompleter(name: string, spec: AutocompleterSpec): void;
1233
+ getAutocompleters(): [string, AutocompleterSpec][];
1234
+ addContextToolbar(name: string, spec: ContextToolbarSpec): void;
1235
+ /** By descending priority; equal ones in registration order (the sort is stable). */
1236
+ getContextToolbars(): [string, ContextToolbarSpec][];
1237
+ get(name: string): ControlSpec | undefined;
1238
+ has(name: string): boolean;
1239
+ names(): string[];
1240
+ }
1241
+
1242
+ /**
1243
+ * Toolbar configuration: a string in the familiar format ('undo redo | bold italic') or an array of
1244
+ * names, where '|' separates groups.
1245
+ */
1246
+ type ToolbarConfig = string | string[];
1247
+ /**
1248
+ * What the toolbar does when it runs out of width: 'floating' (the groups that don't fit open from
1249
+ * "⋯" in a panel over the text), 'sliding' (they open from "⋯" in a strip under the toolbar), 'scrolling'
1250
+ * (one row that scrolls sideways, for touch screens), 'wrap' (more rows).
1251
+ */
1252
+ type ToolbarMode = 'floating' | 'sliding' | 'scrolling' | 'wrap';
1253
+ declare const defaultToolbar: string;
1254
+
1255
+ interface FontOption {
1256
+ label: string;
1257
+ value: string;
1258
+ }
1259
+ declare const defaultFontFamilies: FontOption[];
1260
+ declare const defaultFontSizes: string[];
1261
+ declare const defaultLineHeights: string[];
1262
+
1263
+ interface DialogOptions {
1264
+ host: HTMLElement;
1265
+ title: string;
1266
+ body: HTMLElement;
1267
+ /** Without submitLabel the dialog is informational: the footer has only the cancelLabel button ("Close"). */
1268
+ submitLabel?: string;
1269
+ cancelLabel: string;
1270
+ closeLabel: string;
1271
+ /** Return false (or an error message) to keep the dialog open. */
1272
+ onSubmit?: () => boolean | string | void | Promise<boolean | string | void>;
1273
+ /** large — for the preview and the HTML source. */
1274
+ size?: 'normal' | 'large';
1275
+ onClose?: () => void;
1276
+ /** Where focus returns after closing. */
1277
+ returnFocus?: () => void;
1278
+ /** The element that gets focus on opening (the first field by default). */
1279
+ initialFocus?: HTMLElement;
1280
+ }
1281
+ interface DialogHandle {
1282
+ el: HTMLElement;
1283
+ close(): void;
1284
+ setError(message: string | null): void;
1285
+ setBusy(busy: boolean): void;
1286
+ }
1287
+
1288
+ type NotificationType = 'info' | 'success' | 'warning' | 'error';
1289
+ interface NotificationOptions {
1290
+ text: string;
1291
+ type?: NotificationType;
1292
+ /** ms until it closes by itself; 0 — never. Default 4000 (errors: 0). */
1293
+ timeout?: number;
1294
+ /** Action buttons ("Retry"): clicking one runs the action and closes the notification. */
1295
+ actions?: NotificationAction[];
1296
+ /** The notification was closed with the close button or by its timer (not through an action). */
1297
+ onClose?: () => void;
1298
+ }
1299
+ interface NotificationAction {
1300
+ label: string;
1301
+ onAction: () => void;
1302
+ }
1303
+ interface NotificationHandle {
1304
+ close(): void;
1305
+ setText(text: string): void;
1306
+ }
1307
+
1308
+ type Placement = 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end' | 'bottom';
1309
+ type Anchor = HTMLElement | (() => DOMRect);
1310
+ interface PopoverOptions {
1311
+ host: HTMLElement;
1312
+ anchor: Anchor;
1313
+ content: HTMLElement;
1314
+ placement?: Placement;
1315
+ className?: string;
1316
+ /** Close on a click outside the panel (yes by default). */
1317
+ dismissOnOutside?: boolean;
1318
+ /** Elements whose clicks don't count as "outside" (for example, the anchor button). */
1319
+ ignore?: HTMLElement[];
1320
+ onClose?: (reason: 'escape' | 'outside' | 'api') => void;
1321
+ }
1322
+ /** A floating panel: a menu, the color palette, the link panel, the toolbar overflow. */
1323
+ declare class Popover {
1324
+ readonly el: HTMLDivElement;
1325
+ private readonly options;
1326
+ private closed;
1327
+ private unlisten;
1328
+ constructor(options: PopoverOptions);
1329
+ get isOpen(): boolean;
1330
+ reposition: () => void;
1331
+ close(reason?: 'escape' | 'outside' | 'api'): void;
1332
+ /** Whether focus was inside the panel when it closed (then it goes back to the button). */
1333
+ focusWasInside: boolean;
1334
+ private onKeyDown;
1335
+ private onPointerDown;
1336
+ }
1337
+
1338
+ /**
1339
+ * One shared tooltip per editor: the button name plus its shortcut. With a delay for the mouse, at
1340
+ * once for keyboard focus. Not shown on touch devices (there the label is in aria-label rather than
1341
+ * hidden in a tooltip). Content on hover as WCAG 1.4.13 asks: Escape dismisses it without moving
1342
+ * focus or the pointer, and the pointer can move onto it without it disappearing.
1343
+ */
1344
+ declare class Tooltip {
1345
+ private readonly el;
1346
+ private timer;
1347
+ private target;
1348
+ private offEscape;
1349
+ constructor(host: HTMLElement);
1350
+ /** Attach the tooltip to an element. The text comes from data-tooltip and data-shortcut. */
1351
+ attach(target: HTMLElement): void;
1352
+ private schedule;
1353
+ show(target: HTMLElement): void;
1354
+ hide(): void;
1355
+ get current(): HTMLElement | null;
1356
+ destroy(): void;
1357
+ private clearTimer;
1358
+ }
1359
+
1360
+ /**
1361
+ * The UI layer of an editor instance: the control registry, overlays (popovers, dialogs, tooltips),
1362
+ * notifications and translations. Available as editor.ui.
1363
+ */
1364
+ declare class UiManager {
1365
+ private readonly focusEditor;
1366
+ readonly registry: Registry;
1367
+ readonly t: Translator;
1368
+ /** The layer for all floating elements. It sits inside .nova-editor, so it inherits the theme. */
1369
+ readonly overlayHost: HTMLDivElement;
1370
+ readonly tooltip: Tooltip;
1371
+ /** Plugin sidebars: show / hide / toggle (register them with registry.addSidebar). */
1372
+ readonly sidebar: Sidebars;
1373
+ /** Plugin views in place of the editor: show / hide / toggle (register them with registry.addView). */
1374
+ readonly view: Views;
1375
+ private readonly notifications;
1376
+ private popover;
1377
+ private currentDialog;
1378
+ /** The hidden polite live region for announce(); it exists from the start, so screen readers watch it. */
1379
+ private readonly liveRegion;
1380
+ private announceTimer;
1381
+ private readonly rootEl;
1382
+ constructor(root: HTMLElement, t: Translator, focusEditor: () => void, editor: Editor);
1383
+ /**
1384
+ * Say a short message to screen readers without moving focus: what a shortcut or a typed Markdown
1385
+ * shortcut changed ("Bold on", "Bulleted list"). Plugins can use it for their own changes.
1386
+ */
1387
+ announce(message: string): void;
1388
+ /**
1389
+ * Add a plugin's styles to the editor's document (or shadow root) — once per page, however many
1390
+ * editors there are. For panels and dialogs that load lazily: their styles don't belong in the
1391
+ * first-load style.css. Constructed style sheets don't need 'unsafe-inline' in your CSP; where they
1392
+ * aren't supported, a plain <style> is used. Override such styles with a selector at least as specific.
1393
+ */
1394
+ addStyles(id: string, css: string): void;
1395
+ /**
1396
+ * A dialog described by its fields (for plugins): validation, errors at the fields, accessibility.
1397
+ * Returns the data, or null if the dialog was closed. The implementation loads when first opened.
1398
+ */
1399
+ dialog(spec: DialogSpec): Promise<DialogData | null>;
1400
+ /** Open a popover; only one is open at a time (except the toolbar overflow panel). */
1401
+ openPopover(options: Omit<PopoverOptions, 'host'>): Popover;
1402
+ closePopover(): void;
1403
+ get activePopover(): Popover | null;
1404
+ private readonly dialogListeners;
1405
+ /**
1406
+ * Subscribe to a dialog opening (returns an unsubscribe function). The toolbar uses it to close
1407
+ * its "⋯" panel, which on a narrow screen otherwise stayed over the text after a dialog opened from it closed.
1408
+ */
1409
+ onDialogOpen(listener: () => void): () => void;
1410
+ /**
1411
+ * Close floating panels and the toolbar's "⋯" before a plugin opens its own panel or view (version
1412
+ * history, comments), so they don't stay on top.
1413
+ */
1414
+ closeOverlays(): void;
1415
+ openDialog(options: Omit<DialogOptions, 'host' | 'cancelLabel' | 'closeLabel' | 'returnFocus'> & {
1416
+ cancelLabel?: string;
1417
+ }): DialogHandle;
1418
+ get activeDialog(): DialogHandle | null;
1419
+ notify(options: NotificationOptions | string): NotificationHandle;
1420
+ destroy(): void;
1421
+ }
1422
+
1423
+ /**
1424
+ * editor.selection: what is selected, as HTML or text, where it is on the screen, and ways to move
1425
+ * it. Positions are document positions (0 is before the first block), the numbers ProseMirror uses.
1426
+ */
1427
+ /** A place in the document kept across changes: moveToBookmark() puts the selection back there. */
1428
+ interface SelectionBookmark {
1429
+ readonly id: number;
1430
+ }
1431
+ interface EditorSelection {
1432
+ /** Where the selection starts and ends, as document positions (from ≤ to). */
1433
+ getRange(): {
1434
+ from: number;
1435
+ to: number;
1436
+ };
1437
+ /** Selects from…to (kept inside the document); without `to`, puts the cursor at `from`. */
1438
+ setRange(from: number, to?: number): void;
1439
+ /** Whether nothing is selected: only a cursor. */
1440
+ isCollapsed(): boolean;
1441
+ /** Collapses the selection to its start (true) or its end. */
1442
+ collapse(toStart?: boolean): void;
1443
+ /** Selects the whole document. */
1444
+ selectAll(): void;
1445
+ /** The selected content as HTML, as getHTML() writes it; '' for a cursor. */
1446
+ getHTML(): string;
1447
+ /** The selected text, blocks on separate lines. */
1448
+ getText(): string;
1449
+ /** Replaces the selection with HTML, read and checked like insertContent(). */
1450
+ setHTML(html: string): boolean;
1451
+ /** The element of the editing area where the selection starts. */
1452
+ getNode(): HTMLElement | null;
1453
+ /** Selects an element of the editing area: the whole of it, or only what is inside it. */
1454
+ select(node: Node, content?: boolean): void;
1455
+ /** Puts the cursor in an element of the editing area, `offset` into it (its start by default). */
1456
+ setCursorLocation(node: Node, offset?: number): void;
1457
+ /** The selection as a DOM Range (to measure it, or for a popup of your own); null when hidden. */
1458
+ getDOMRange(): Range | null;
1459
+ /** Where the selection is on the screen; null when the editor isn't shown. */
1460
+ getRect(): DOMRect | null;
1461
+ /** Remembers the selection; later changes to the document move it along. */
1462
+ getBookmark(): SelectionBookmark;
1463
+ /** Puts the selection back where the bookmark is now; false when its text was deleted. */
1464
+ moveToBookmark(bookmark: SelectionBookmark): boolean;
1465
+ /** Scrolls the selection into view. */
1466
+ scrollIntoView(): void;
1467
+ }
1468
+
1469
+ /**
1470
+ * A NovaProse plugin. Built-in and third-party plugins use the same API.
1471
+ *
1472
+ * ```ts
1473
+ * export default definePlugin({
1474
+ * name: 'signature',
1475
+ * setup(editor) {
1476
+ * editor.ui.registry.addButton('signature', { text: 'Signature', tooltip: '…', onAction: … });
1477
+ * },
1478
+ * });
1479
+ * ```
1480
+ */
1481
+ interface NovaPlugin {
1482
+ /** A unique name: the plugin is listed under it in the configuration and in `requires` of other plugins. */
1483
+ name: string;
1484
+ /** Plugins that must be set up first. */
1485
+ requires?: string[];
1486
+ /** Register buttons, commands, autocompleters. May return a cleanup function (called on destroy). */
1487
+ setup?: (editor: Editor) => void | (() => void);
1488
+ /**
1489
+ * Buttons appended to the end of the default toolbar ('insertdatetime'). Not added when the user
1490
+ * set their own toolbar: their configuration wins.
1491
+ */
1492
+ toolbar?: string;
1493
+ /** ProseMirror plugins (input handling, decorations, keys). */
1494
+ prosemirrorPlugins?: (editor: Editor) => Plugin[];
1495
+ /**
1496
+ * New document nodes (with parseDOM and toDOM); they extend this editor's schema. A plugin with
1497
+ * nodes or marks is passed as an object, not a lazy loader: the schema is created right away.
1498
+ * The function gets the editor before it is created — read only `editor.options`; on the server
1499
+ * (createRenderer) it gets just the options.
1500
+ */
1501
+ nodes?: Record<string, NodeSpec> | ((editor: Editor) => Record<string, NodeSpec>);
1502
+ /** New marks (inline formatting) with parseDOM and toDOM. */
1503
+ marks?: Record<string, MarkSpec>;
1504
+ /**
1505
+ * Attributes added to existing nodes, by name: read from the node's element when HTML is parsed and
1506
+ * written back to it (`nodes: 'textblock'` for every node that holds text). The suggestions plugin
1507
+ * keeps a suggested change of a block's type or style this way.
1508
+ */
1509
+ nodeAttributes?: Record<string, NodeAttribute>;
1510
+ /**
1511
+ * Your own way to draw nodes in the editor: `{ callout: reactNodeView(Callout) }`, `vueNodeView(…)`
1512
+ * or `defineNodeView(…)`. Doesn't affect the HTML (that comes from toDOM). Views belong in the plugin
1513
+ * itself, not in its lazy part: adding them later would redraw the whole document.
1514
+ */
1515
+ nodeViews?: Record<string, NodeViewFactory>;
1516
+ /**
1517
+ * Override named commands (buttons, menus, shortcuts and editor.exec take them from here). For
1518
+ * example, collaboration replaces undo/redo with its own, which undo only your own changes.
1519
+ */
1520
+ commands?: Partial<Record<CommandName, Command>>;
1521
+ /** The plugin keeps its own history: the built-in one (prosemirror-history) is not added. */
1522
+ replaceHistory?: boolean;
1523
+ /**
1524
+ * Rewrite a transaction before it is applied (suggesting mode turns a deletion into a "deleted"
1525
+ * mark). Called for every transaction of the editor; return the same one when there is nothing to change.
1526
+ */
1527
+ transformTransaction?: (tr: Transaction, state: EditorState, editor: Editor) => Transaction;
1528
+ /**
1529
+ * The whole page around the content (the fullpagehtml plugin): how HTML that is a whole document
1530
+ * is taken apart, and how getHTML() puts the content back into its page. The page itself lives in
1531
+ * the document's attributes (declare them with `nodeAttributes`, `nodes: ['doc']`), so undo,
1532
+ * JSON and the server renderer keep it. A function gets the options, as `nodes` does.
1533
+ */
1534
+ page?: PageHandler | ((context: {
1535
+ options: Editor['options'];
1536
+ }) => PageHandler);
1537
+ /**
1538
+ * The lazy part of a plugin with nodes: buttons, dialogs, commands, keys. The schema is created
1539
+ * right away, so the nodes and everything that draws them (nodeViews) stay in the plugin itself
1540
+ * (first load), and the rest is a separate chunk loaded after the editor is created (part of
1541
+ * `editor.ready`). The part is an ordinary plugin without nodes.
1542
+ */
1543
+ load?: Loader;
1544
+ }
1545
+ /** A whole HTML document around the content: see `NovaPlugin.page`. */
1546
+ interface PageHandler {
1547
+ /**
1548
+ * HTML that is a whole document (a doctype, `<html>`, `<head>` or `<body>`), taken apart: the
1549
+ * content's HTML and the document's attributes. null when the HTML is only content.
1550
+ */
1551
+ read(html: string): {
1552
+ content: string;
1553
+ attrs: Record<string, unknown>;
1554
+ } | null;
1555
+ /** The whole document: the content's HTML inside the page the document's attributes describe. */
1556
+ write(content: string, attrs: Readonly<Record<string, unknown>>): string;
1557
+ /** The source code view shows the whole document (true) or only the content. */
1558
+ inSource?: boolean;
1559
+ }
1560
+ type Loader = () => Promise<NovaPlugin | {
1561
+ default: NovaPlugin;
1562
+ }>;
1563
+ /** An entry of the plugins option: an object, a registered name or a lazy loader. */
1564
+ type PluginEntry = NovaPlugin | string | Loader;
1565
+ /** A helper for typing a plugin definition. */
1566
+ declare function definePlugin(plugin: NovaPlugin): NovaPlugin;
1567
+ /** Register a plugin (or its lazy loader) under a name, for `plugins: ['name']`. */
1568
+ declare function registerPlugin(name: string, plugin: NovaPlugin | Loader): void;
1569
+ declare function isPluginRegistered(name: string): boolean;
1570
+
1571
+ interface SlashCommand {
1572
+ name: string;
1573
+ /** Translation key of the label. */
1574
+ label: MessageKey;
1575
+ icon: string;
1576
+ /** Extra search words (English, so "/h1" and "/quote" work in any UI language). */
1577
+ keywords: string[];
1578
+ shortcut?: string;
1579
+ run: (editor: Editor) => void;
1580
+ }
1581
+ declare const defaultSlashCommands: SlashCommand[];
1582
+
1583
+ /**
1584
+ * Cleans up HTML pasted from Word, Word Online, Google Docs, Excel, Google Sheets, LibreOffice
1585
+ * and regular web pages. Runs before the schema parses it: turns "office" markup into clean HTML
1586
+ * that the schema understands correctly (real lists instead of paragraphs with markers, styles from
1587
+ * classes moved into style, no service tags or styles).
1588
+ *
1589
+ * Built from the public description of the Office clipboard format and the observed behavior of
1590
+ * the applications, without anyone else's code (clean room, see CLAUDE.md).
1591
+ */
1592
+
1593
+ /** 'clean' (default) — without fonts, sizes, spacing and "default" colors; 'keep' — as it is. */
1594
+ type PasteStyles = 'clean' | 'keep';
1595
+
1596
+ /**
1597
+ * Paste handling:
1598
+ * - "Paste as text" mode (the pastetext toggle): any content is pasted without formatting;
1599
+ * - Ctrl/Cmd+Shift+V pastes once without formatting (ProseMirror itself hands over text/plain when
1600
+ * Shift is held; we only make sure the HTML branch doesn't take it);
1601
+ * - the pastePreprocess (HTML string before parsing) and pastePostprocess (DOM after the browser parsed it) hooks.
1602
+ */
1603
+ interface PasteOptions {
1604
+ /** Change the HTML before it is parsed: return a new string. */
1605
+ pastePreprocess?: (html: string, editor: Editor) => string;
1606
+ /** Change the DOM after it is parsed: nodes can be removed or changed in place. */
1607
+ pastePostprocess?: (fragment: HTMLElement, editor: Editor) => void;
1608
+ /** Start in "paste as text" mode. */
1609
+ pasteAsText?: boolean;
1610
+ /**
1611
+ * Formatting when pasting from Word, Google Docs, Excel and web pages. 'clean' (default) keeps
1612
+ * bold, italic, colors, lists, tables and links, but not the source document's font, size and
1613
+ * spacing; 'keep' brings those too.
1614
+ */
1615
+ pasteStyles?: PasteStyles;
1616
+ }
1617
+ /** Turns HTML into plain text, keeping paragraphs (for "paste as text" mode). */
1618
+ declare function htmlToPlainText(html: string): string;
1619
+
1620
+ /**
1621
+ * Comments on the text: the data model and the store.
1622
+ *
1623
+ * The document's text keeps only the anchor — a `<span data-comment="id">` mark around the discussed
1624
+ * fragment. The discussions (threads) themselves live in a store: in memory by default (save them
1625
+ * next to the HTML with `onChange`), in the shared Y.Doc when collaborating
1626
+ * (`collabSession.commentStore()`), or in your own store with the same interface.
1627
+ */
1628
+ interface CommentAuthor {
1629
+ id: string;
1630
+ name: string;
1631
+ }
1632
+ interface Comment {
1633
+ id: string;
1634
+ author: CommentAuthor;
1635
+ text: string;
1636
+ /** When it was created, ms since 1970 (Date.now()). */
1637
+ createdAt: number;
1638
+ editedAt?: number;
1639
+ /** People mentioned with "@" ("@Name" in the text): whom to notify. */
1640
+ mentions?: CommentAuthor[];
1641
+ }
1642
+ interface CommentThread {
1643
+ /** Matches data-comment of the text fragment. */
1644
+ id: string;
1645
+ createdAt: number;
1646
+ /** The first comment starts the discussion, the rest are replies. */
1647
+ comments: Comment[];
1648
+ /** The thread is resolved: its highlight in the text is hidden, the discussion stays in the history. */
1649
+ resolved?: {
1650
+ by: CommentAuthor;
1651
+ at: number;
1652
+ } | null;
1653
+ /**
1654
+ * A discussion of a suggested edit (the suggestion's id) rather than of a piece of text: it shows
1655
+ * on the suggestion's card and is resolved when the suggestion is accepted or rejected.
1656
+ */
1657
+ suggestion?: string;
1658
+ }
1659
+ /** A store of threads. Its methods are synchronous: the UI updates at once, saving is up to you. */
1660
+ interface CommentStore {
1661
+ /** A snapshot of all threads (a new array after every change). */
1662
+ threads(): readonly CommentThread[];
1663
+ /** Subscribe to any change (including ones from other participants). Returns an unsubscribe function. */
1664
+ subscribe(listener: () => void): () => void;
1665
+ createThread(thread: CommentThread): void;
1666
+ reply(threadId: string, comment: Comment): void;
1667
+ editComment(threadId: string, commentId: string, text: string): void;
1668
+ deleteComment(threadId: string, commentId: string): void;
1669
+ setResolved(threadId: string, resolved: CommentThread['resolved']): void;
1670
+ deleteThread(threadId: string): void;
1671
+ }
1672
+ /** Make data from an outside source (JSON, network) safe; drop whatever doesn't fit. */
1673
+ declare function sanitizeThread(value: unknown): CommentThread | null;
1674
+ /**
1675
+ * An in-memory store. `initial` — threads saved earlier (from your backend), `onChange` — save them.
1676
+ *
1677
+ * ```ts
1678
+ * const store = createCommentStore(saved.threads, (threads) => api.saveComments(postId, threads));
1679
+ * ```
1680
+ */
1681
+ declare function createCommentStore(initial?: readonly unknown[], onChange?: (threads: readonly CommentThread[]) => void): CommentStore;
1682
+
1683
+ /**
1684
+ * The mentions plugin: "@" in the text → a list of people → a mention
1685
+ * `<span data-mention="id">@Name</span>`. `plugins: ['mentions']`, the people come from
1686
+ * `pluginOptions.mentions.fetch` (usually a search in your API). Comments use the same source for
1687
+ * "@" in a comment field. This part is the node and shared functions; the list while typing "@" is in mentions-ui.ts.
1688
+ */
1689
+ interface MentionUser {
1690
+ id: string;
1691
+ name: string;
1692
+ /** A second line in the list: a job title, an e-mail. */
1693
+ description?: string;
1694
+ }
1695
+ interface MentionsOptions {
1696
+ /** Find people by the start of their name (the query without "@"). May return a Promise. */
1697
+ fetch: (query: string) => MentionUser[] | Promise<MentionUser[]>;
1698
+ /** Someone was mentioned in the text (for notifications — or collect them on save with getMentions). */
1699
+ onMention?: (user: MentionUser, editor: Editor) => void;
1700
+ /** How many to show in the list (8 by default). */
1701
+ maxResults?: number;
1702
+ }
1703
+ /** Who is mentioned in the document (no repeats, in order of appearance) — for example, to notify them. */
1704
+ declare function getMentions(editorOrDoc: Editor | Node$1): MentionUser[];
1705
+
1706
+ /**
1707
+ * The comments plugin: discussions about parts of the text (like comments in Google Docs or Word).
1708
+ * `plugins: ['comments']`, options in `pluginOptions.comments` ({@link CommentsOptions}).
1709
+ * Buttons (TinyMCE names): `addcomment`, `showcomments`. Ctrl+Alt+M comments on the selection.
1710
+ *
1711
+ * A mark in the schema, so the plugin is set up right away; the discussion panel loads lazily when opened.
1712
+ */
1713
+ interface CommentsOptions {
1714
+ /** Who is commenting. Default: "Guest". */
1715
+ author?: CommentAuthor;
1716
+ /** Where threads are stored. Default: in memory, with `threads` and `onChange`. */
1717
+ store?: CommentStore;
1718
+ /** Previously saved threads (for the default store). */
1719
+ threads?: readonly CommentThread[];
1720
+ /** The threads changed — save them (for the default store). */
1721
+ onChange?: (threads: readonly CommentThread[]) => void;
1722
+ /** Whether a comment can be edited and deleted. Default: only by its author. */
1723
+ canEdit?: (comment: Comment, author: CommentAuthor) => boolean;
1724
+ /**
1725
+ * Finding people for "@" in comments. Default: `pluginOptions.mentions.fetch` (the mentions plugin).
1726
+ */
1727
+ mentions?: MentionsOptions['fetch'];
1728
+ /** Someone was mentioned in a new comment — send them a notification. */
1729
+ onMention?: (event: {
1730
+ threadId: string;
1731
+ comment: Comment;
1732
+ users: CommentAuthor[];
1733
+ }) => void;
1734
+ }
1735
+ declare const LABELS: {
1736
+ en: {
1737
+ add: string;
1738
+ show: string;
1739
+ panel: string;
1740
+ guest: string;
1741
+ newComment: string;
1742
+ placeholder: string;
1743
+ replyPlaceholder: string;
1744
+ comment: string;
1745
+ reply: string;
1746
+ cancel: string;
1747
+ save: string;
1748
+ edit: string;
1749
+ remove: string;
1750
+ resolve: string;
1751
+ reopen: string;
1752
+ deleteThread: string;
1753
+ close: string;
1754
+ showResolved: string;
1755
+ resolvedBy: string;
1756
+ orphan: string;
1757
+ empty: string;
1758
+ people: string;
1759
+ noPeople: string;
1760
+ edited: string;
1761
+ you: string;
1762
+ count: string;
1763
+ };
1764
+ };
1765
+ type CommentsLabels = typeof LABELS.en;
1766
+ interface PluginState {
1767
+ /** The selection a new comment is being written for (not saved yet, so no mark in the text). */
1768
+ pending: {
1769
+ from: number;
1770
+ to: number;
1771
+ } | null;
1772
+ active: string | null;
1773
+ }
1774
+ /** Controls the editor's comments: one object shared by the plugin and the lazy panel. */
1775
+ interface CommentsController {
1776
+ readonly editor: Editor;
1777
+ readonly store: CommentStore;
1778
+ readonly author: CommentAuthor;
1779
+ readonly labels: CommentsLabels;
1780
+ readonly shortcut: string;
1781
+ pending(): PluginState['pending'];
1782
+ active(): string | null;
1783
+ setActive(id: string | null, scroll?: boolean): void;
1784
+ /** Start a comment on the selection: highlight it and open the panel with an input. */
1785
+ startComment(): boolean;
1786
+ cancelPending(): void;
1787
+ /** Save a new comment on the pending selection. Returns the thread ID. */
1788
+ submitPending(text: string, mentions?: CommentAuthor[]): string | null;
1789
+ reply(threadId: string, text: string, mentions?: CommentAuthor[]): void;
1790
+ /** Finding people for "@" (null when no source is set up and mentions in comments are off). */
1791
+ findUsers: ((query: string) => Promise<MentionUser[]>) | null;
1792
+ /** Text fragments of a thread (empty when the text was deleted). */
1793
+ ranges(id: string): {
1794
+ from: number;
1795
+ to: number;
1796
+ }[];
1797
+ quote(id: string): string;
1798
+ /** Threads in the order of their place in the document. */
1799
+ positionOf(id: string): number;
1800
+ deleteThread(id: string): void;
1801
+ setResolved(id: string, resolved: boolean): void;
1802
+ canEdit(comment: Comment): boolean;
1803
+ isPanelOpen(): boolean;
1804
+ openPanel(): Promise<void>;
1805
+ closePanel(): void;
1806
+ }
1807
+ /** The editor's comments controller (when the comments plugin is active). */
1808
+ declare function getComments(editor: Editor): CommentsController | undefined;
1809
+
1810
+ /**
1811
+ * The pagelayout plugin: page layout. The text sits on a sheet of the exact size with margins, as
1812
+ * when printed; page boundaries show right in the text; printing and export use the same sizes.
1813
+ *
1814
+ * plugins: ['pagelayout'],
1815
+ * pluginOptions: { pagelayout: { size: 'A4', orientation: 'portrait', margins: 20 } }
1816
+ *
1817
+ * This part is the sheet itself (needed from the first frame: a sheet appearing later would shift
1818
+ * the whole text) and the settings with pageLayout(editor). Page boundaries are computed in the lazy part, pagelayout-ui.ts.
1819
+ */
1820
+ type PageSizeName = 'A3' | 'A4' | 'A5' | 'A6' | 'Letter' | 'Legal';
1821
+ interface PageMargins {
1822
+ top: number;
1823
+ right: number;
1824
+ bottom: number;
1825
+ left: number;
1826
+ }
1827
+ /** Text in a page margin: one string (centered), or parts at the left, the center and the right. */
1828
+ type PageBand = string | {
1829
+ left?: string;
1830
+ center?: string;
1831
+ right?: string;
1832
+ };
1833
+ interface PageLayoutOptions {
1834
+ /** Sheet size: 'A4' (default), 'A3', 'A5', 'A6', 'Letter', 'Legal' or { width, height } in mm. */
1835
+ size?: PageSizeName | {
1836
+ width: number;
1837
+ height: number;
1838
+ };
1839
+ /** Orientation; without it, portrait for standard sizes and as given for your own size. */
1840
+ orientation?: 'portrait' | 'landscape';
1841
+ /** Margins in mm: one number for all sides, or per side. Default 20. */
1842
+ margins?: number | Partial<PageMargins>;
1843
+ /**
1844
+ * Text in the top margin of every page: one string (centered) or { left, center, right }.
1845
+ * `{page}` and `{pages}` become the page number and the number of pages: 'Page {page} of {pages}'.
1846
+ */
1847
+ header?: PageBand;
1848
+ /** Text in the bottom margin of every page, like `header`. */
1849
+ footer?: PageBand;
1850
+ /** The first page without header and footer (a title page), as "Different first page" in Word. */
1851
+ differentFirstPage?: boolean;
1852
+ }
1853
+ /** A header or footer: its three parts, '' where there is nothing. */
1854
+ interface PageBandParts {
1855
+ left: string;
1856
+ center: string;
1857
+ right: string;
1858
+ }
1859
+ /** The sheet in mm (orientation already applied), the margins and the header and footer. */
1860
+ interface PageLayout {
1861
+ size: PageSizeName | 'custom';
1862
+ orientation: 'portrait' | 'landscape';
1863
+ width: number;
1864
+ height: number;
1865
+ margins: PageMargins;
1866
+ /** null when there is none. */
1867
+ header: PageBandParts | null;
1868
+ footer: PageBandParts | null;
1869
+ differentFirstPage: boolean;
1870
+ }
1871
+ /** Sheet sizes in mm (portrait). */
1872
+ declare const PAGE_SIZES: Readonly<Record<PageSizeName, readonly [number, number]>>;
1873
+ interface PageLayoutController {
1874
+ /** The current sheet (mm). */
1875
+ readonly layout: PageLayout;
1876
+ /**
1877
+ * How many pages the document has. null — not counted yet, or the sheet is narrower than the page
1878
+ * (a narrow screen: lines wrap differently than in print).
1879
+ */
1880
+ readonly pages: number | null;
1881
+ /** Change the size, orientation or margins (the rest stays). */
1882
+ set(options: PageLayoutOptions): void;
1883
+ /** The sheet or the page count changed. Returns an unsubscribe function. */
1884
+ onChange(listener: () => void): () => void;
1885
+ }
1886
+ /** The editor's page layout (the pagelayout plugin); undefined when the plugin isn't active. */
1887
+ declare function pageLayout(editor: Editor): PageLayoutController | undefined;
1888
+
1889
+ /**
1890
+ * What the parts of the ai plugin share: the request to your model and its ready prompt, the quick
1891
+ * actions, the text around the cursor. ai.ts is the plugin (the assistant window and the menus),
1892
+ * ai-chat.ts the chat panel, ai-complete.ts autocomplete.
1893
+ */
1894
+ type AiAction = 'improve' | 'fix' | 'shorter' | 'longer' | 'simplify' | 'formal' | 'friendly' | 'summarize' | 'continue' | 'custom' | 'chat' | 'edit' | 'complete';
1895
+ /** A message of the chat panel's conversation. */
1896
+ interface AiMessage {
1897
+ role: 'user' | 'assistant';
1898
+ text: string;
1899
+ }
1900
+ interface AiRequest {
1901
+ /** What to do: the user's own words, or a quick action's ready instruction in English. */
1902
+ instruction: string;
1903
+ /**
1904
+ * Who asks: a quick action (improve, fix, shorter, longer, simplify, formal, friendly, summarize,
1905
+ * continue), custom (the user's own request in the assistant window), chat (a message in the chat
1906
+ * panel), edit (changes to the document from the chat panel) or complete (autocomplete).
1907
+ */
1908
+ action: AiAction;
1909
+ /**
1910
+ * The text to work on: the selected text, paragraphs separated by a blank line (empty: the model
1911
+ * writes at the cursor). For edit, the blocks to change, each as `<block id="N">text</block>` on its
1912
+ * own line.
1913
+ */
1914
+ text: string;
1915
+ /** Up to 1,500 characters before and after the text (or the cursor), for context. */
1916
+ before: string;
1917
+ after: string;
1918
+ /** chat: the whole document as text (up to `maxDocument` characters); empty for other actions. */
1919
+ document: string;
1920
+ /** chat: the conversation so far, oldest first, without the current message. */
1921
+ messages: AiMessage[];
1922
+ /**
1923
+ * A ready prompt for the model: the fields above with the rules for the answer. Send it as the
1924
+ * user's message, or build your own prompt from the fields and `rules`.
1925
+ */
1926
+ prompt: string;
1927
+ /** How the model must answer for the editor to use the answer: the format, the language, the blocks of edit. */
1928
+ rules: string[];
1929
+ /** The editor's UI language (for example, en). */
1930
+ language: string;
1931
+ /** Cancellation: the user closed the window, pressed Stop, or typed on (autocomplete). */
1932
+ signal: AbortSignal;
1933
+ }
1934
+ /** A quick action of your own (the aishortcuts menu and the assistant window). */
1935
+ interface AiShortcut {
1936
+ /** The name in the menu. */
1937
+ title: string;
1938
+ /** The instruction for the model: with a selection the answer rewrites it, without one it is written at the cursor. */
1939
+ prompt?: string;
1940
+ /** true: only with a selection; false: only without one; not set: always. */
1941
+ selection?: boolean;
1942
+ /** A group of shortcuts, instead of `prompt`. */
1943
+ items?: AiShortcut[];
1944
+ }
1945
+ interface AiOptions {
1946
+ /**
1947
+ * The request to the model through your server. Return the answer's text, or a stream of pieces
1948
+ * (AsyncIterable) to show it as it is written. The answer is plain text: paragraphs separated by a
1949
+ * blank line. `request.prompt` is a ready prompt: send it to the model as it is.
1950
+ */
1951
+ request?: (request: AiRequest) => Promise<string> | AsyncIterable<string>;
1952
+ /** Author name on the suggestions ("AI" in the UI language by default). */
1953
+ name?: string;
1954
+ /**
1955
+ * Quick actions of the aishortcuts menu and the assistant window: your own list instead of the
1956
+ * built-in one. false hides the menu.
1957
+ */
1958
+ shortcuts?: AiShortcut[] | false;
1959
+ /**
1960
+ * Suggest how the text goes on as the author types: grey text after the cursor, Tab accepts it.
1961
+ * Off by default: every pause in typing is a request to your model. `delay`: the pause, 700 ms by default.
1962
+ */
1963
+ autocomplete?: boolean | {
1964
+ delay?: number;
1965
+ };
1966
+ /** The most document text sent to the model, in characters (the chat and edits of the whole document). 50,000 by default. */
1967
+ maxDocument?: number;
1968
+ }
1969
+
1970
+ /** What kind of change: a typo from a list, TWo INitial CApitals, or the first letter of a sentence. */
1971
+ type CorrectionKind = 'typo' | 'capitals' | 'sentence';
1972
+
1973
+ interface AutocorrectOptions {
1974
+ /**
1975
+ * Correct typos as you type: the built-in English list and your `replacements`, "i" → "I", TWo
1976
+ * INitial CApitals. true by default.
1977
+ */
1978
+ autocorrect?: boolean;
1979
+ /** Start sentences with a capital letter. false by default. */
1980
+ capitalize?: boolean;
1981
+ /**
1982
+ * Your own corrections in any language, a typo → the right word: `{ recieve: 'receive' }`. A typo
1983
+ * is found whatever its case, and the case it was typed in is kept. They add to the built-in list
1984
+ * and win over it.
1985
+ */
1986
+ replacements?: Record<string, string>;
1987
+ /** The built-in English list of common typos. true by default; it applies to English content. */
1988
+ builtInList?: boolean;
1989
+ /** Words never changed, such as names of products: `['VMware', 'npm']`. */
1990
+ ignore?: string[];
1991
+ /**
1992
+ * The language of the content ('en', 'de-DE'…): the built-in list and "i" → "I" are for English. By
1993
+ * default the spell checker's language, otherwise the `lang` attribute of the page.
1994
+ */
1995
+ language?: string;
1996
+ /** Remember the person's choice from the menu (in localStorage) the next time. true by default. */
1997
+ remember?: boolean;
1998
+ /** Called after each correction, and again with `reverted: true` when the person takes it back. */
1999
+ onCorrect?: (correction: AutocorrectCorrection) => void;
2000
+ }
2001
+ interface AutocorrectCorrection {
2002
+ /** What was typed. */
2003
+ word: string;
2004
+ /** What it became. */
2005
+ replacement: string;
2006
+ /** A typo from a list, TWo INitial CApitals, or the first letter of a sentence. */
2007
+ kind: CorrectionKind;
2008
+ /** The person took the correction back (Backspace right after it). */
2009
+ reverted: boolean;
2010
+ }
2011
+
2012
+ type LinkStatus = 'valid' | 'invalid' | 'unknown';
2013
+ interface LinkCheckerOptions {
2014
+ /** Your service, through your server: the status of each address. */
2015
+ check?: (urls: string[], signal: AbortSignal) => Promise<Record<string, LinkStatus>>;
2016
+ /** When `check` isn't given: a server that answers POST { urls } with { results: { [url]: status } }. */
2017
+ serviceUrl?: string;
2018
+ /** Changes an address before it is checked (leave out a token in it); the link stays as it is. */
2019
+ preprocess?: (url: string) => string;
2020
+ /** Start with checking on (yes, when there is a service). */
2021
+ active?: boolean;
2022
+ /** How long after a change the links are checked, in milliseconds (1000). */
2023
+ delay?: number;
2024
+ }
2025
+
2026
+ /**
2027
+ * The pageembed plugin: a web page shown in the document, in a frame. `plugins: ['pageembed']`.
2028
+ * Here are the node and its view in the editor; the dialog and the button are in pageembed-ui.ts.
2029
+ *
2030
+ * An embed is a wrapper with a frame: `<div class="nova-pageembed …"><iframe …></iframe></div>`. A
2031
+ * sized one (`nova-pageembed--16by9`) fills the width and keeps the ratio, a fixed one has its own
2032
+ * width and height.
2033
+ *
2034
+ * Security: only absolute http(s) addresses are embedded, without a name and password in them,
2035
+ * when parsing and on output (a document can come as JSON); `allowUrl` narrows them to your list.
2036
+ * An <iframe> on its own isn't embedded, so a pasted web page doesn't bring its frames along. The
2037
+ * frame is sandboxed: the page runs its own scripts, forms and popups, but can't navigate the page
2038
+ * it is shown on, and gets no camera, microphone or location.
2039
+ */
2040
+ interface PageEmbedSize {
2041
+ /** The name in the dialog ("Full width, 16:9" when left out). */
2042
+ text?: string;
2043
+ /** The class it adds to the wrapper; "…--16by9" fills the width with that ratio. */
2044
+ value: string;
2045
+ }
2046
+ interface PageEmbedOptions {
2047
+ /** The sizes offered besides a fixed one. An empty list: only a fixed size. */
2048
+ sizes?: PageEmbedSize[];
2049
+ /** Sizes also as inline styles, so the page that shows the HTML needs no CSS for them (yes). */
2050
+ inlineStyles?: boolean;
2051
+ /** The wrapper's class ('nova-pageembed'). */
2052
+ className?: string;
2053
+ /** The frame's sandbox (`allow-*` words); false: no sandbox. */
2054
+ sandbox?: string | false;
2055
+ /** Which addresses may be embedded: every http(s) one by default. */
2056
+ allowUrl?: (url: string) => boolean;
2057
+ }
2058
+
2059
+ /** A series of values for the numbers column. */
2060
+ interface TableSeries {
2061
+ /** The name in the menu. */
2062
+ title: string;
2063
+ /** The value of a numbered row (index counts the rows under the header rows, from 0). */
2064
+ value(index: number): string | undefined;
2065
+ }
2066
+ interface AdvTableOptions {
2067
+ /** Your own series, besides `numeric` (1, 2, 3) and `alpha` (A, B, C). */
2068
+ series?: Record<string, TableSeries>;
2069
+ }
2070
+
2071
+ interface AdvCodeOptions {
2072
+ /** Lay the HTML out with one block per line and nested ones indented (yes). */
2073
+ prettify?: boolean;
2074
+ /** Wrap long lines (yes). */
2075
+ wrap?: boolean;
2076
+ /** The text size, in pixels (14). */
2077
+ fontSize?: number;
2078
+ }
2079
+
2080
+ interface EditImageOptions {
2081
+ /** Your way to get an image's file, through your server for images on other sites. */
2082
+ fetchImage?: (src: string) => Promise<Blob>;
2083
+ /** Sites whose images are fetched with the reader's cookies (they must allow it with CORS). */
2084
+ credentialsHosts?: string[];
2085
+ /** The quality of a saved JPEG or WebP, 0 to 1 (0.92). */
2086
+ quality?: number;
2087
+ /** The buttons added to the image's toolbar ('rotateleft rotateright | flipv fliph | editimage'). */
2088
+ toolbar?: string;
2089
+ }
2090
+
2091
+ /**
2092
+ * The mediaembed plugin: a link to a page becomes a card with its title, description, picture and
2093
+ * site, from your service (`resolve` or `serviceUrl`); a video link becomes a player (the media
2094
+ * plugin). Here are the card node and its view; asking the service and the buttons are in
2095
+ * mediaembed-ui.ts.
2096
+ *
2097
+ * Security: nothing from the service is put in as HTML. The card is built from text, its address
2098
+ * and picture are checked like any link and image, when parsing, from JSON and on output.
2099
+ */
2100
+ interface MediaEmbedOptions {
2101
+ /**
2102
+ * Your service: what a page is (its title, description, picture, site), through your server.
2103
+ * null when nothing is known about it: the link stays a link.
2104
+ */
2105
+ resolve?: (url: string, signal: AbortSignal) => Promise<EmbedInfo | null | undefined>;
2106
+ /** When `resolve` isn't given: a server that answers POST { url } with an EmbedInfo (or null). */
2107
+ serviceUrl?: string;
2108
+ /** The widest a card gets, in pixels (650). */
2109
+ maxWidth?: number;
2110
+ /** The card's look as inline styles too, so the page that shows it needs no CSS (yes). */
2111
+ inlineStyles?: boolean;
2112
+ /** The card's class; its parts get "-title", "-description", "-thumbnail", "-website", "-author". */
2113
+ className?: string;
2114
+ }
2115
+ /** What the service says about a page. Everything is optional; unknown fields are ignored. */
2116
+ interface EmbedInfo {
2117
+ /** 'video': a player (`video` is its address); 'photo': a picture (`image`); otherwise a card. */
2118
+ type?: 'link' | 'video' | 'photo' | 'rich';
2119
+ title?: string;
2120
+ description?: string;
2121
+ /** A picture for the card (or the photo itself). */
2122
+ image?: string;
2123
+ /** The site's name. */
2124
+ site?: string;
2125
+ author?: string;
2126
+ /** For a video: the player's address (YouTube, Vimeo or a video file). */
2127
+ video?: string;
2128
+ }
2129
+
2130
+ /**
2131
+ * The fullpagehtml plugin: a whole HTML document, not only its content. The doctype, the attributes
2132
+ * of <html> and <body> and the head (title, meta tags, style sheets) are kept around the content:
2133
+ * getHTML() gives the whole page, and setContent() of a whole page reads its head. The page lives in
2134
+ * the document's `page` attribute, so undo, JSON and the server renderer keep it. The Document
2135
+ * properties dialog is in fullpagehtml-ui.ts.
2136
+ *
2137
+ * Security: a page's scripts are never kept, nor <base>, a refresh or cookie from <meta>, event
2138
+ * handlers, or addresses other than http(s) and relative ones. Everything is checked again whenever
2139
+ * the page is written: a document can arrive as JSON with anything in it.
2140
+ */
2141
+ interface FullPageHtmlOptions {
2142
+ /** The doctype of a page that has none (`<!DOCTYPE html>`). */
2143
+ doctype?: string;
2144
+ /** The title of a page that has none. */
2145
+ title?: string;
2146
+ /** The character encoding a page declares when it declares none, as `<meta charset>`: 'UTF-8'. */
2147
+ encoding?: string;
2148
+ /** The body's style for a page whose body has none: 'font-family: Georgia; color: #222222'. */
2149
+ bodyStyle?: string;
2150
+ /** The source code view shows only the content, not the whole page. */
2151
+ hideInSourceView?: boolean;
2152
+ }
2153
+ /** The parts of a page kept around the content (the document's `page` attribute). */
2154
+ interface PageData {
2155
+ /** `<!DOCTYPE html>` or an older HTML or XHTML doctype. */
2156
+ doctype?: string;
2157
+ /** The attributes of <html>: lang, dir. */
2158
+ html?: Record<string, string>;
2159
+ /** The head, in order. */
2160
+ head?: HeadElement[];
2161
+ /** The attributes of <body>: style, class, dir, lang. */
2162
+ body?: Record<string, string>;
2163
+ }
2164
+ type HeadElement = {
2165
+ tag: 'title';
2166
+ text: string;
2167
+ } | {
2168
+ tag: 'meta' | 'link';
2169
+ attrs: Record<string, string>;
2170
+ } | {
2171
+ tag: 'style';
2172
+ attrs: Record<string, string>;
2173
+ text: string;
2174
+ };
2175
+
2176
+ /**
2177
+ * Typography rules over a block's text: typographic quotes of the language, dashes, an ellipsis,
2178
+ * symbols, arrows, math signs, fractions, spaces and non-breaking spaces. Each rule finds edits in
2179
+ * a text; nothing here knows the editor. Addresses, email addresses and `code` are left alone.
2180
+ */
2181
+ type TypographyRule = 'quotes' | 'dashes' | 'ellipsis' | 'symbols' | 'arrows' | 'math' | 'fractions' | 'spaces' | 'nbsp';
2182
+
2183
+ interface TypographyOptions {
2184
+ /**
2185
+ * The language whose typography applies ('en-US', 'de', 'fr'…). By default the autocorrect or
2186
+ * spell checker language, otherwise the `lang` attribute of the page. The person's choice from
2187
+ * the menu wins and is remembered.
2188
+ */
2189
+ language?: string;
2190
+ /** The languages in the button's menu (codes). */
2191
+ languages?: string[];
2192
+ /** Rules to turn off (all are on by default): `{ nbsp: false }`. */
2193
+ rules?: Partial<Record<TypographyRule, boolean>>;
2194
+ /** Formatting and blocks left alone, by name, besides code: `['link']`. */
2195
+ ignore?: string[];
2196
+ /** Remember the language chosen in the menu (in localStorage). true by default. */
2197
+ remember?: boolean;
2198
+ }
2199
+
2200
+ /**
2201
+ * Your own typing shortcuts (`textPatterns: [...]`), in place of the built-in ones. Three kinds:
2202
+ * - at the start of a block: `{ start: '#', format: 'h1' }`, `{ start: '1.', command: 'orderedList' }`
2203
+ * — when a space follows the start (or Enter, `trigger: 'enter'`);
2204
+ * - between two markers: `{ start: '*', end: '*', format: 'italic' }` — when the end marker is typed
2205
+ * and a space or Enter follows it;
2206
+ * - a replacement: `{ start: '(c)', replacement: '©' }` — when a space or Enter follows it.
2207
+ * `format` is a format registered with `formats` (`editor.formatter`) or a built-in one: bold, italic,
2208
+ * underline, strikethrough, code, subscript, superscript, p, h1–h6, blockquote, pre. `command` is a
2209
+ * named command or a function that gets the editor and `value`.
2210
+ */
2211
+ type TextPattern = InlinePattern | BlockPattern | ReplacementPattern;
2212
+ /** A command a pattern runs: a named one, or your own function. */
2213
+ type TextPatternCommand = CommandName | ((editor: Editor, value?: unknown) => void);
2214
+ interface InlinePattern {
2215
+ start: string;
2216
+ end: string;
2217
+ format?: string;
2218
+ command?: TextPatternCommand;
2219
+ value?: unknown;
2220
+ }
2221
+ interface BlockPattern {
2222
+ start: string;
2223
+ format?: string;
2224
+ command?: TextPatternCommand;
2225
+ value?: unknown;
2226
+ /** What completes the pattern: a space after it (default) or Enter at the end of the block. */
2227
+ trigger?: 'space' | 'enter';
2228
+ }
2229
+ interface ReplacementPattern {
2230
+ start: string;
2231
+ replacement: string;
2232
+ }
2233
+ /** What `textPatternsLookup` gets on every attempt: the block's text before the cursor and its element. */
2234
+ interface TextPatternContext {
2235
+ text: string;
2236
+ block: HTMLElement | null;
2237
+ }
2238
+
2239
+ /** What your server gets: the print document and the file name. */
2240
+ interface PdfRequest {
2241
+ /** A whole HTML page: the editor's text, its styles and the @page rule with the sheet, header and footer. */
2242
+ html: string;
2243
+ filename: string;
2244
+ }
2245
+ interface ExportPdfOptions {
2246
+ /** The file name (document.pdf by default). */
2247
+ filename?: string;
2248
+ /**
2249
+ * Sends the print document to your server and returns the PDF: a Blob, bytes or a fetch Response.
2250
+ * On the server, headless Chrome: `await page.setContent(html); await page.pdf({ preferCSSPageSize: true })`
2251
+ * (a ready example: novaprose.com/guides/pages-and-printing/). Without it, the button opens the print dialog.
2252
+ */
2253
+ request?: (request: PdfRequest) => Promise<Blob | ArrayBuffer | Uint8Array | Response> | Blob | ArrayBuffer | Uint8Array | Response;
2254
+ }
2255
+
2256
+ interface ExportWordOptions {
2257
+ /** The file name (document.docx by default). */
2258
+ filename?: string;
2259
+ /** Text font in Word (Calibri by default) and size in points (12). */
2260
+ font?: string;
2261
+ fontSize?: number;
2262
+ }
2263
+
2264
+ /**
2265
+ * The mergetags plugin: template variables ("Client name", "Order number") that your server replaces
2266
+ * with values when printing or sending. In the text it is a non-editable chip, in HTML
2267
+ * `<span data-mergetag="client">Client name</span>` (the attribute name can be changed).
2268
+ *
2269
+ * `plugins: ['mergetags']`, the list in `pluginOptions.mergetags.list`. Insert them with the
2270
+ * `mergetags` button or by typing `{{`. Variables missing from the list aren't lost: they show by key.
2271
+ * This part is the node and how it looks in the editor; the menu and typing `{{` are in mergetags-ui.ts.
2272
+ */
2273
+ interface MergeTag {
2274
+ /** The key your server sees: 'client', 'order.number'. */
2275
+ key: string;
2276
+ /** The label in the editor: 'Client name'. */
2277
+ label: string;
2278
+ }
2279
+ interface MergeTagGroup {
2280
+ title: string;
2281
+ items: MergeTag[];
2282
+ }
2283
+ interface MergeTagsOptions {
2284
+ /** Variables, as a list or in groups. */
2285
+ list?: (MergeTag | MergeTagGroup)[];
2286
+ /** The HTML attribute holding the key. Default 'data-mergetag'. */
2287
+ attribute?: string;
2288
+ }
2289
+
2290
+ /**
2291
+ * The revisionhistory plugin (named as in TinyMCE): the document's version history. A list of
2292
+ * versions, viewing a version with the differences from the current text highlighted, and
2293
+ * restoring (an ordinary edit — Ctrl+Z undoes it). Your app decides where versions come from:
2294
+ * `pluginOptions.revisionhistory` ({@link RevisionHistoryOptions}); with collaboration, `sync.versions()` from @novaprose/collab.
2295
+ */
2296
+ interface Revision {
2297
+ id: string;
2298
+ /** Time of the version, ms since 1970. */
2299
+ createdAt: number;
2300
+ /** Who changed the document in this version. */
2301
+ authors?: string[];
2302
+ /** Name of the version ("Sent to legal") if it was saved by hand. */
2303
+ label?: string | null;
2304
+ }
2305
+ interface RevisionHistoryOptions {
2306
+ /** The list of versions (order doesn't matter: newest are shown first). */
2307
+ list: () => Promise<Revision[]>;
2308
+ /** A version's content: HTML or a JSON document. */
2309
+ load: (revision: Revision, editor: Editor) => Promise<string | Record<string, unknown>>;
2310
+ /** "Save version" (the button appears when this is set). */
2311
+ save?: (label?: string) => Promise<void>;
2312
+ /** A version was restored (after the content was already replaced). */
2313
+ onRestore?: (revision: Revision) => void;
2314
+ }
2315
+
2316
+ /**
2317
+ * The autosave plugin: a draft in the browser's localStorage, so text isn't lost when a tab is
2318
+ * closed, the page reloads or something crashes. If a draft different from the current content is
2319
+ * found on opening, a notification appears and the "Restore draft" button (restoredraft) becomes active.
2320
+ *
2321
+ * `plugins: ['autosave']`, options in `pluginOptions.autosave`:
2322
+ * - key — the storage key (the page address + the element's id by default);
2323
+ * - delay — how long after a change to save, ms (1000);
2324
+ * - retention — how long to keep a draft, minutes (7 days).
2325
+ */
2326
+ interface AutosaveOptions {
2327
+ key?: string;
2328
+ delay?: number;
2329
+ retention?: number;
2330
+ }
2331
+
2332
+ /**
2333
+ * Quickbars: toolbars in place, like the TinyMCE plugin of the same name.
2334
+ * - above selected text — quick formatting;
2335
+ * - on an empty line — quick insert (image, table).
2336
+ *
2337
+ * Options (pluginOptions.quickbars), false turns a bar off:
2338
+ * { selection: 'bold italic | quicklink h2 h3 blockquote', insert: 'quickimage quicktable' }
2339
+ */
2340
+ interface QuickbarsOptions {
2341
+ selection?: string | false;
2342
+ insert?: string | false;
2343
+ }
2344
+
2345
+ /**
2346
+ * Code highlighting languages: highlight.js grammars, aliases and the list to choose from. Each
2347
+ * grammar is a separate lazy chunk: a document with JavaScript code downloads only the highlighter
2348
+ * core and JavaScript (~11 KB gzip), not every language at once.
2349
+ */
2350
+ /** A highlight.js grammar: a function returning the language definition. */
2351
+ type CodeGrammar = (hljs: never) => unknown;
2352
+ /** A grammar loader: a module with a default export, or the function itself. */
2353
+ type CodeGrammarLoader = () => Promise<{
2354
+ default: CodeGrammar;
2355
+ } | CodeGrammar>;
2356
+ /** An item of the language list: the value (the class `language-<value>` in HTML) and a label. */
2357
+ interface CodeLanguage {
2358
+ value: string;
2359
+ label: string;
2360
+ }
2361
+
2362
+ interface CodeSampleOptions {
2363
+ /**
2364
+ * Languages in the menu and dialog, in order. The value is the name for the `language-…` class;
2365
+ * highlighting uses the built-in grammar with the same name or alias (js, ts, sh, html, markup…).
2366
+ */
2367
+ languages?: CodeLanguage[];
2368
+ /**
2369
+ * Your own highlight.js grammars for languages outside the built-in set, by language value:
2370
+ * `{ '1c': () => import('highlight.js/lib/languages/1c') }`.
2371
+ */
2372
+ grammars?: Record<string, CodeGrammarLoader>;
2373
+ }
2374
+
2375
+ interface TableOfContentsOptions {
2376
+ /** Which heading levels go into the table of contents: 1…depth (3 by default). */
2377
+ depth?: number;
2378
+ /** The block's class in HTML (`nova-toc` by default; TinyMCE uses `mce-toc`). */
2379
+ className?: string;
2380
+ /** Tag of the table of contents title: `p` (default) or `h1`–`h6`. */
2381
+ titleTag?: string;
2382
+ /** The title; "Contents" in the UI language by default. An empty string — no title. */
2383
+ title?: string;
2384
+ /** A numbered list instead of a bulleted one. */
2385
+ orderedList?: boolean;
2386
+ }
2387
+
2388
+ type AccordionState = 'inherited' | 'collapsed' | 'expanded';
2389
+ interface AccordionOptions {
2390
+ /**
2391
+ * The state when HTML is loaded: as in the markup (`inherited`, default), all collapsed
2392
+ * (`collapsed`) or all expanded (`expanded`). Like `details_initial_state` in TinyMCE.
2393
+ */
2394
+ initialState?: AccordionState;
2395
+ /**
2396
+ * The `open` attribute in getHTML: as in the editor (`inherited`, default), always collapsed or
2397
+ * always expanded. Like `details_serialized_state` in TinyMCE.
2398
+ */
2399
+ serializedState?: AccordionState;
2400
+ }
2401
+
2402
+ interface ImportWordOptions {
2403
+ /** replace (default) — replace the content; insert — insert at the cursor. */
2404
+ mode?: 'replace' | 'insert';
2405
+ }
2406
+
2407
+ interface SpellCheckRequest {
2408
+ /** The text to check: one or more paragraphs, separated by a blank line. */
2409
+ text: string;
2410
+ /** The language: en-US, de-DE…, or auto (the service detects it). */
2411
+ language: string;
2412
+ /** Cancelled when the editor closes. */
2413
+ signal: AbortSignal;
2414
+ }
2415
+ interface SpellCheckMatch {
2416
+ /** Where the problem starts in `text` (in UTF-16 code units, as in JavaScript strings). */
2417
+ offset: number;
2418
+ /** How long it is. */
2419
+ length: number;
2420
+ /** spelling (a misspelled word, the default) or grammar (grammar and style). */
2421
+ kind?: 'spelling' | 'grammar';
2422
+ /** What is wrong, for the person: shown in the bubble. */
2423
+ message?: string;
2424
+ /** Corrections, best first: up to five are shown. */
2425
+ replacements?: string[];
2426
+ }
2427
+ interface SpellCheckerOptions {
2428
+ /** Your checking service, through your server: the problems found in the text. */
2429
+ check?: (request: SpellCheckRequest) => Promise<SpellCheckMatch[]>;
2430
+ /**
2431
+ * A LanguageTool server, yours or a hosted one, when `check` isn't given: its address
2432
+ * (https://lt.example.com, the API is at /v2/check), headers for it, and `picky` for more style hints.
2433
+ */
2434
+ languageTool?: {
2435
+ url: string;
2436
+ headers?: Record<string, string>;
2437
+ level?: 'default' | 'picky';
2438
+ };
2439
+ /** The language to check in (auto by default: the service detects it). */
2440
+ language?: string;
2441
+ /** Languages in the button's menu: [{ code: 'en-US', name: 'English (US)' }, …]. */
2442
+ languages?: {
2443
+ code: string;
2444
+ name: string;
2445
+ }[];
2446
+ /** Start with checking on (yes by default). */
2447
+ active?: boolean;
2448
+ /** Words never marked: names, product terms. */
2449
+ ignore?: string[];
2450
+ /** Save a word in your dictionary ("Add to dictionary" shows when this is given). */
2451
+ addToDictionary?: (word: string, language: string) => void | Promise<void>;
2452
+ }
2453
+
2454
+ interface A11yCheckerOptions extends A11yCheckOptions {
2455
+ /** Leave out issues: return false for the ones not to show. */
2456
+ filterIssue?: (issue: A11yIssue) => boolean;
2457
+ }
2458
+
2459
+ /**
2460
+ * Email HTML from the editor's content (a separate entry, @novaprose/core/email: it isn't part of the
2461
+ * first load). Email clients drop or ignore style sheets, so the content styles go into each
2462
+ * element's style attribute, with the cascade as a browser applies it: specificity, order,
2463
+ * !important, inline styles. What email clients can't show becomes something they can: a video
2464
+ * becomes a link, a collapsible block plain text, a formula its TeX. Optionally a whole email
2465
+ * document: a centered column that Outlook keeps too, preview text for the inbox, and the
2466
+ * @media rules in its head for the clients that read them.
2467
+ *
2468
+ * Runs in a browser, or on a server with a DOM such as jsdom (it parses HTML with DOMParser).
2469
+ */
2470
+ /** A filter: a substring, a regular expression or a function. */
2471
+ type EmailFilter = string | RegExp | ((value: string) => boolean);
2472
+ interface EmailDocumentOptions {
2473
+ /** The document's title (a few email clients show it). */
2474
+ title?: string;
2475
+ /** Preview text that inboxes show after the subject; hidden in the email itself. */
2476
+ preheader?: string;
2477
+ /** The width of the email's column, in pixels: 600 by default. */
2478
+ width?: number;
2479
+ /** The background around the column: #ffffff by default. */
2480
+ background?: string;
2481
+ /** The background of the column: #ffffff by default. */
2482
+ contentBackground?: string;
2483
+ /** The language of the text (the editor's language by default). */
2484
+ lang?: string;
2485
+ /** The direction of the text (the editor's direction by default). */
2486
+ dir?: 'ltr' | 'rtl';
2487
+ }
2488
+ interface EmailOptions {
2489
+ /** More CSS to put inline, after the editor's content styles. */
2490
+ css?: string;
2491
+ /**
2492
+ * Built-in styles that make the email look like the text in the editor: fonts, tables with
2493
+ * borders, quotes, code, images that fit. Yes by default; your styles override them.
2494
+ */
2495
+ baseStyles?: boolean;
2496
+ /** Which selectors are put inline (a substring, a RegExp or a function); all by default. */
2497
+ selectorFilter?: EmailFilter;
2498
+ /** Which content style files are read, by their address; all by default. */
2499
+ fileFilter?: EmailFilter;
2500
+ /** Relative links and images become absolute against this address: the page's address by default. */
2501
+ baseUrl?: string;
2502
+ /** A whole email document (doctype, head, a centered column) instead of the content alone. */
2503
+ document?: boolean | EmailDocumentOptions;
2504
+ }
2505
+ /** The built-in email styles: the editor's look in properties email clients understand. */
2506
+ declare const EMAIL_CSS = "\nbody { font-family: -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 1.6; color: #1f2328; }\np { margin: 0 0 12px; }\nh1, h2, h3, h4, h5, h6 { margin: 20px 0 8px; line-height: 1.25; }\nh1 { font-size: 32px; }\nh2 { font-size: 24px; }\nh3 { font-size: 19px; }\nh4 { font-size: 16px; }\nh5 { font-size: 14px; }\nh6 { font-size: 13px; }\na { color: #0969da; text-decoration: underline; }\nblockquote { margin: 0 0 12px; padding: 0 0 0 16px; border-left: 3px solid #d0d7de; color: #59636e; }\npre { margin: 0 0 12px; padding: 12px 14px; border-radius: 6px; background: #f6f8fa; font-family: Menlo, Consolas, 'Courier New', monospace; font-size: 14px; white-space: pre-wrap; }\ncode { padding: 1px 4px; border-radius: 4px; background: #f6f8fa; font-family: Menlo, Consolas, 'Courier New', monospace; font-size: 14px; }\npre code { padding: 0; background: transparent; }\nul, ol { margin: 0 0 12px; padding-left: 24px; }\nli > p { margin: 0; }\nul[data-type=\"taskList\"] { padding-left: 0; list-style: none; }\ntable { width: 100%; margin: 0 0 12px; border-collapse: collapse; }\nth, td { padding: 6px 8px; border: 1px solid #afb8c1; vertical-align: top; }\nth { background: #f6f8fa; font-weight: 600; }\ntd > :last-child, th > :last-child { margin-bottom: 0; }\nimg { max-width: 100%; height: auto; border: 0; }\nfigure { margin: 12px 0; }\nfigure img { display: block; }\nfigcaption { padding-top: 6px; color: #59636e; font-size: 14px; text-align: center; }\nhr { margin: 20px 0; border: 0; border-top: 1px solid #d0d7de; }\n[data-type=\"math-inline\"], [data-type=\"math-block\"] { font-family: Menlo, Consolas, 'Courier New', monospace; }\n";
2507
+ interface Declaration {
2508
+ name: string;
2509
+ value: string;
2510
+ important: boolean;
2511
+ }
2512
+ /** `color: red; margin: 0 !important` → declarations, as written (shorthands stay shorthands). */
2513
+ declare function parseDeclarations(body: string): Declaration[];
2514
+ /** Specificity as one comparable number: ids, then classes, then types. */
2515
+ declare function specificity(selector: string): number;
2516
+ /**
2517
+ * HTML → email HTML: styles inline, markup email clients understand, and with `document` a whole
2518
+ * email. `contentCss` is the editor's content CSS (emailHTML reads it from the editor).
2519
+ */
2520
+ declare function toEmailHTML(html: string, options?: EmailOptions & {
2521
+ contentCss?: string;
2522
+ dir?: 'ltr' | 'rtl';
2523
+ }): string;
2524
+ /** The editor's content CSS as text: its contentCss files (those `fileFilter` lets through), then contentStyle. */
2525
+ declare function editorContentCss(editor: Editor, fileFilter?: EmailFilter): Promise<string>;
2526
+ /** The email plugin's options (pluginOptions.email), then `options`, with the editor's language and direction. */
2527
+ declare function emailSettings(editor: Editor, options?: EmailOptions): EmailOptions & {
2528
+ dir?: 'ltr' | 'rtl';
2529
+ };
2530
+ /**
2531
+ * The editor's content as email HTML: its content styles (contentCss, contentStyle) and the email
2532
+ * plugin's options (pluginOptions.email) apply, then `options`.
2533
+ */
2534
+ declare function emailHTML(editor: Editor, options?: EmailOptions): Promise<string>;
2535
+
2536
+ type EditorMode = 'classic' | 'inline' | 'distraction-free';
2537
+ /** Marks a transaction that came from a collaborator (set by @novaprose/collab): it is not user input. */
2538
+ declare const REMOTE_CHANGE_META = "nova:remote";
2539
+ /** Event details: the second argument of a listener, `editor.on(event, (editor, detail) => …)`. */
2540
+ interface EditorEventDetails {
2541
+ /** The editor is ready: lazy plugins and content styles are loaded (same as `await editor.ready`). */
2542
+ init: undefined;
2543
+ /** The document changed in any way: typing, the API, a collaborator. */
2544
+ change: {
2545
+ transaction: Transaction;
2546
+ };
2547
+ /** The user of this editor changed the document (typing, paste, toolbar buttons, shortcuts). */
2548
+ input: {
2549
+ transaction: Transaction;
2550
+ };
2551
+ selectionChange: {
2552
+ transaction: Transaction;
2553
+ };
2554
+ focus: {
2555
+ event: FocusEvent;
2556
+ };
2557
+ blur: {
2558
+ event: FocusEvent;
2559
+ };
2560
+ editableChange: undefined;
2561
+ destroy: undefined;
2562
+ /** Before setContent: `detail.content` can be replaced. */
2563
+ beforeSetContent: {
2564
+ content: string | Record<string, unknown>;
2565
+ };
2566
+ setContent: {
2567
+ content: string | Record<string, unknown>;
2568
+ };
2569
+ /** A key in the text, before the editor handles it; `detail.event.preventDefault()` cancels that. */
2570
+ keydown: {
2571
+ event: KeyboardEvent;
2572
+ };
2573
+ }
2574
+ type EditorEvent = keyof EditorEventDetails;
2575
+ type EditorListener<E extends EditorEvent = EditorEvent> = (editor: Editor, detail: EditorEventDetails[E]) => void;
2576
+ /**
2577
+ * Options of the built-in plugins (typed, so your code editor suggests them) and of any other plugin
2578
+ * by name. Types only: plugin modules are not pulled into the core.
2579
+ */
2580
+ interface PluginOptions {
2581
+ comments?: CommentsOptions;
2582
+ mentions?: MentionsOptions;
2583
+ mergetags?: MergeTagsOptions;
2584
+ revisionhistory?: RevisionHistoryOptions;
2585
+ autosave?: AutosaveOptions;
2586
+ quickbars?: QuickbarsOptions;
2587
+ codesample?: CodeSampleOptions;
2588
+ accordion?: AccordionOptions;
2589
+ tableofcontents?: TableOfContentsOptions;
2590
+ pagelayout?: PageLayoutOptions;
2591
+ exportword?: ExportWordOptions;
2592
+ exportpdf?: ExportPdfOptions;
2593
+ importword?: ImportWordOptions;
2594
+ ai?: AiOptions;
2595
+ spellchecker?: SpellCheckerOptions;
2596
+ autocorrect?: AutocorrectOptions;
2597
+ typography?: TypographyOptions;
2598
+ a11ychecker?: A11yCheckerOptions;
2599
+ linkchecker?: LinkCheckerOptions;
2600
+ pageembed?: PageEmbedOptions;
2601
+ advtable?: AdvTableOptions;
2602
+ advcode?: AdvCodeOptions;
2603
+ editimage?: EditImageOptions;
2604
+ mediaembed?: MediaEmbedOptions;
2605
+ fullpagehtml?: FullPageHtmlOptions;
2606
+ /** The email plugin's options; emailHTML() from @novaprose/core/email uses them too. */
2607
+ email?: EmailOptions;
2608
+ [plugin: string]: unknown;
2609
+ }
2610
+ interface EditorOptions extends PasteOptions, ContentRulesOptions {
2611
+ /** The element the editor is mounted into. */
2612
+ element: HTMLElement;
2613
+ /** Initial content: an HTML string or a JSON document. */
2614
+ content?: string | Record<string, unknown>;
2615
+ /**
2616
+ * Toolbar: a string ('undo redo | bold italic'), an array of names, or false (headless: you draw
2617
+ * the UI). Defaults to the standard set.
2618
+ */
2619
+ toolbar?: false | ToolbarConfig;
2620
+ /**
2621
+ * What the toolbar does when it runs out of width: 'floating' (default: the groups that don't fit
2622
+ * open from "⋯" over the text), 'sliding' (they open in a strip under the toolbar), 'scrolling'
2623
+ * (one row that scrolls sideways), 'wrap' (more rows).
2624
+ */
2625
+ toolbarMode?: ToolbarMode;
2626
+ /**
2627
+ * classic — a frame with bars (default); inline — no frame, the toolbar appears above the text on
2628
+ * focus; distraction-free — no permanent bars, only quick toolbars over the selection and empty lines.
2629
+ */
2630
+ mode?: EditorMode;
2631
+ /** Menu bar: true for the standard one ('file edit view insert format table help'), a string for your own set. Off by default. */
2632
+ menubar?: boolean | string;
2633
+ /**
2634
+ * Shortcuts that react to typed characters: Markdown ("# " a heading, "- " a list, "```" a code
2635
+ * block) and typography ("--" a dash, "..." an ellipsis). On by default; false turns them off,
2636
+ * for people who dictate or type those characters as text (WCAG 2.1.4). A list of patterns
2637
+ * replaces the built-in ones: `[{ start: '*', end: '*', format: 'italic' }, { start: '#', format:
2638
+ * 'h1' }, { start: '(c)', replacement: '©' }]`.
2639
+ */
2640
+ textPatterns?: boolean | TextPattern[];
2641
+ /** More patterns on every attempt (from the text before the cursor and its block): added to textPatterns. */
2642
+ textPatternsLookup?: (context: TextPatternContext) => TextPattern[];
2643
+ /** Your own menus, or overrides of the standard ones: { insert: { title: 'Insert', items: 'image link | hr' } }. */
2644
+ menu?: Record<string, MenuDefinition>;
2645
+ /** Status bar with the element path and the word count. On by default. */
2646
+ statusbar?: boolean;
2647
+ /** Placeholder for an empty document. */
2648
+ placeholder?: string;
2649
+ editable?: boolean;
2650
+ /**
2651
+ * A disabled editor, like a disabled form field: the text can't be edited or focused and the bars
2652
+ * are inactive. Unlike editable: false (read-only), it looks dimmed.
2653
+ */
2654
+ disabled?: boolean;
2655
+ /**
2656
+ * Resize handle in the status bar: true — height, 'both' — height and width. Works with a mouse,
2657
+ * a finger or the keyboard (arrow keys on the handle). Off by default.
2658
+ */
2659
+ resize?: boolean | 'both';
2660
+ /**
2661
+ * Items of the block list (the `blocks` button) and their order: [{ label: 'Subheading', block: 'h3' }].
2662
+ * Default: paragraph, H1–H6 and code block.
2663
+ */
2664
+ blockFormats?: BlockFormat[];
2665
+ /**
2666
+ * Content styles (like content_style in TinyMCE), applied only to this editor's text. `body` and
2667
+ * `html` in selectors mean the text area itself: 'body { font-family: Georgia }'.
2668
+ */
2669
+ contentStyle?: string;
2670
+ /**
2671
+ * Content style sheets (like content_css), loaded and applied only to this editor's text;
2672
+ * relative url() and @import work. `await editor.ready` waits for them.
2673
+ */
2674
+ contentCss?: string | string[];
2675
+ /**
2676
+ * Named formats (like formats in TinyMCE): { note: { block: 'p', classes: 'note' } }. Apply them
2677
+ * with editor.formatter.apply('note'); their classes are kept when HTML is parsed.
2678
+ */
2679
+ formats?: Record<string, FormatSpec | FormatSpec[]>;
2680
+ /**
2681
+ * Items of the Styles menu (the `styles` button): your formats, references to named formats and
2682
+ * groups. Default: headings, text, blocks and alignment.
2683
+ */
2684
+ styleFormats?: StyleFormat[];
2685
+ /** true — add styleFormats to the standard set instead of replacing it. */
2686
+ styleFormatsMerge?: boolean;
2687
+ /**
2688
+ * Which classes to keep in the HTML besides those of the formats: a list, or true for all. By
2689
+ * default only format classes (pasted clutter such as MsoNormal stays out of the document).
2690
+ */
2691
+ validClasses?: string[] | true;
2692
+ /**
2693
+ * Table styles to choose from in the table properties (like table_class_list in TinyMCE):
2694
+ * [{ title: 'Bordered', value: 'grid' }]. Your CSS (contentCss) defines how they look.
2695
+ */
2696
+ tableClassList?: ClassOption[];
2697
+ /** Cell styles to choose from in the cell properties (like table_cell_class_list). */
2698
+ tableCellClassList?: ClassOption[];
2699
+ /** UI language (BCP 47): 'en', 'de'… Default 'en'. */
2700
+ language?: string;
2701
+ /**
2702
+ * Writing direction of the UI and the text. By default right-to-left for Arabic, Hebrew, Persian
2703
+ * and Urdu (from `language`), otherwise the page's direction.
2704
+ */
2705
+ direction?: 'ltr' | 'rtl';
2706
+ /** Override individual UI strings. */
2707
+ translations?: LanguagePack;
2708
+ /** Upload images to your server. Without it, images are embedded as data: URLs. */
2709
+ uploadImage?: UploadImageHandler;
2710
+ /**
2711
+ * Your own file picker: a Browse button next to the address field of the link, image and video
2712
+ * dialogs. Gets the field type and the current address, returns { url, text?, title?, alt? } or null.
2713
+ */
2714
+ filePicker?: FilePicker;
2715
+ /** Which fields get Browse: 'file' (link), 'image', 'media'. Default: all of them. */
2716
+ filePickerTypes?: FilePickType[];
2717
+ fontFamilies?: FontOption[];
2718
+ fontSizes?: string[];
2719
+ lineHeights?: string[];
2720
+ colors?: string[];
2721
+ /** Slash commands ("/"). false turns them off; an array adds commands to the standard ones. */
2722
+ slashCommands?: false | SlashCommand[];
2723
+ /**
2724
+ * NovaProse plugins: an object, a registered name ('insertdatetime') or a lazy loader
2725
+ * (() => import(...)). Lazy ones load after the editor is created; wait for them with `await editor.ready`.
2726
+ */
2727
+ plugins?: PluginEntry[];
2728
+ /** Plugin options by name: { comments: {...}, mentions: {...} }. Built-in plugins are typed. */
2729
+ pluginOptions?: PluginOptions;
2730
+ /** Raw ProseMirror plugins (for low-level extensions). */
2731
+ prosemirrorPlugins?: Plugin[];
2732
+ /** Called before the toolbar is drawn — the place for editor.ui.registry.addButton(...). */
2733
+ setup?: (editor: Editor) => void;
2734
+ onChange?: (editor: Editor) => void;
2735
+ }
2736
+ /** An item of the table or cell style list: a label and a class. */
2737
+ interface ClassOption {
2738
+ title: string;
2739
+ value: string;
2740
+ }
2741
+ /** An item of the block list: a label and the block's tag. */
2742
+ interface BlockFormat {
2743
+ label: string;
2744
+ block: 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'pre';
2745
+ }
2746
+ /**
2747
+ * The public API of a NovaProse editor. The framework wrappers (React, Vue…) work only through this
2748
+ * class, never with ProseMirror directly.
2749
+ */
2750
+ declare class Editor {
2751
+ readonly view: EditorView;
2752
+ readonly root: HTMLElement;
2753
+ readonly ui: UiManager;
2754
+ readonly options: Readonly<EditorOptions>;
2755
+ private readonly listeners;
2756
+ /** Resolves when all lazy plugins are loaded and set up. */
2757
+ readonly ready: Promise<void>;
2758
+ private toolbar;
2759
+ private readonly toolbarHost;
2760
+ private readonly menubar;
2761
+ readonly mode: EditorMode;
2762
+ /** The editor's writing direction (the direction option, the language or the page's dir). */
2763
+ readonly direction: 'ltr' | 'rtl';
2764
+ private readonly pluginsByName;
2765
+ private readonly commandOverrides;
2766
+ private readonly transactionTransforms;
2767
+ private readonly cleanups;
2768
+ /** Content restrictions (validElements/invalidElements/validStyles), or null when there are none. */
2769
+ private readonly contentRules;
2770
+ /** This editor's document schema: the built-in one plus nodes and marks of plugins. */
2771
+ readonly schema: NovaSchema;
2772
+ /** Formats: register / apply / remove / toggle / match. */
2773
+ readonly formatter: Formatter;
2774
+ /** The selection: its HTML and text, its range and place on screen, moving it, bookmarks. */
2775
+ readonly selection: EditorSelection;
2776
+ private readonly statusbar;
2777
+ /** The find and replace bar: a lazy part, there once editor.ready resolves (see loadSearchBar). */
2778
+ private searchBar;
2779
+ private searchBarLoad;
2780
+ private contentHost;
2781
+ private destroyed;
2782
+ private editable;
2783
+ private disabled;
2784
+ private pasteAsText;
2785
+ constructor(options: EditorOptions);
2786
+ /**
2787
+ * Install table editing (cell selection, column widths, Tab between cells) once it has loaded, at
2788
+ * its place before `anchor`, as if the plugins had been there from the start.
2789
+ */
2790
+ private installTables;
2791
+ /** contentStyle right away, contentCss as it loads. Each editor gets its own scope. */
2792
+ private applyContentStyles;
2793
+ /** Whether content restrictions allow a control, command or tag (always true without restrictions). */
2794
+ isAllowed(name: string): boolean;
2795
+ hasPlugin(name: string): boolean;
2796
+ private collectPmPlugins;
2797
+ /** setup with errors isolated: a failing plugin doesn't break the editor. */
2798
+ private setupPlugin;
2799
+ private loadLazyPlugins;
2800
+ /**
2801
+ * Refresh the button state (pressed / enabled) without changing the document — for example, after a
2802
+ * plugin switched a display mode. Document changes refresh the UI by themselves.
2803
+ */
2804
+ updateUI(): void;
2805
+ /** Rebuild the toolbar (after plugins registered new buttons). */
2806
+ rebuildToolbar(): void;
2807
+ /** Toolbar configuration: yours as it is; the default one plus the buttons of active plugins. */
2808
+ private toolbarConfig;
2809
+ private handleTransaction;
2810
+ private updatePlaceholder;
2811
+ /**
2812
+ * The document's HTML. Deterministic: the same in every browser and in Node. With the fullpagehtml
2813
+ * plugin it is the whole page (doctype, head, body); `fullPage: false` gives only the content.
2814
+ */
2815
+ getHTML({ fullPage }?: {
2816
+ fullPage?: boolean;
2817
+ }): string;
2818
+ getJSON(): Record<string, unknown>;
2819
+ getText(): string;
2820
+ /**
2821
+ * Replace the content. By default it can be undone. With the fullpagehtml plugin, HTML that is a
2822
+ * whole page (or JSON) replaces the page too; HTML that is only content, or `fullPage: false`,
2823
+ * keeps the page as it is.
2824
+ */
2825
+ setContent(content: string | Record<string, unknown>, { addToHistory, fullPage }?: {
2826
+ addToHistory?: boolean;
2827
+ fullPage?: boolean;
2828
+ }): void;
2829
+ /**
2830
+ * Insert HTML at the cursor (like insertContent in TinyMCE). The HTML is parsed by the editor's
2831
+ * schema, as a paste is: no scripts, unsafe links or unknown tags. Blocks (paragraphs, tables) are
2832
+ * inserted as separate blocks. A table inserted with the cursor inside a table goes after it
2833
+ * rather than replacing its cells.
2834
+ */
2835
+ insertContent(html: string): boolean;
2836
+ isEmpty(): boolean;
2837
+ /** The command for a name: a plugin's override or the built-in one; unknown names return false. */
2838
+ private resolveCommand;
2839
+ private registerCommands;
2840
+ /** Run a named command or any ProseMirror command; returns whether it ran. */
2841
+ exec(command: CommandName | Command): boolean;
2842
+ /**
2843
+ * Several commands as one edit — one undo step, one change event:
2844
+ * `editor.chain().exec('h2').exec('alignCenter').run()`. If a step fails, the document doesn't
2845
+ * change and run() returns false; `chain().….can()` checks without changing anything (for buttons).
2846
+ */
2847
+ chain(): CommandChain;
2848
+ /**
2849
+ * Whether the command can run in the current state (for disabled buttons). A command that throws
2850
+ * (a document with content its schema doesn't allow, from JSON) can't run: the buttons go on
2851
+ * updating instead of breaking.
2852
+ */
2853
+ can(command: CommandName | Command): boolean;
2854
+ /** Whether a named command is active for the current selection (for your own toolbar buttons). */
2855
+ isActive(command: CommandName): boolean;
2856
+ /**
2857
+ * The state of a named command for your own toolbar: whether it is active (a pressed button) and
2858
+ * whether it can run now. The equivalent of queryCommandState / queryCommandEnabled.
2859
+ */
2860
+ getCommandState(command: CommandName): {
2861
+ active: boolean;
2862
+ enabled: boolean;
2863
+ };
2864
+ focus(): void;
2865
+ /** "Paste as text" mode (the pastetext toggle). */
2866
+ isPasteAsText(): boolean;
2867
+ setPasteAsText(value: boolean): void;
2868
+ /** The find and replace bar, loaded once (a separate chunk: the first load stays smaller). */
2869
+ private loadSearchBar;
2870
+ /** Open the find and replace bar (Ctrl/Cmd+F). Resolves once it is open. */
2871
+ openSearch(): Promise<void>;
2872
+ closeSearch(): void;
2873
+ /** Whether the text can be edited now: neither read-only nor disabled. */
2874
+ isEditable(): boolean;
2875
+ isDisabled(): boolean;
2876
+ /** Disable or enable the editor (like disabled on a form field). */
2877
+ setDisabled(value: boolean): void;
2878
+ private applyDisabled;
2879
+ setEditable(value: boolean): void;
2880
+ on<E extends EditorEvent>(event: E, listener: EditorListener<E>): () => void;
2881
+ off<E extends EditorEvent>(event: E, listener: EditorListener<E>): void;
2882
+ private emit;
2883
+ destroy(): void;
2884
+ }
2885
+ declare function createEditor(options: EditorOptions): Editor;
2886
+
2887
+ export { Editor as E, DEFAULT_MENUBAR as L, DEFAULT_MENUS as M, Formatter as a7, PAGE_SIZES as aA, REMOTE_CHANGE_META as aQ, Registry as aR, Sidebars as aY, UiManager as b9, isPluginRegistered as bA, marksOf as bB, nodesOf as bC, openImageAltDialog as bD, openImageDialog as bE, pageLayout as bF, registerPlugin as bG, sanitizeThread as bH, schema as bI, setImageAttrs as bJ, setImageWidthFraction as bK, setLink as bL, uploadImages as bM, EMAIL_CSS as bP, editorContentCss as bT, emailHTML as bU, emailSettings as bV, parseDeclarations as bW, specificity as bX, toEmailHTML as bY, Views as be, commands as bf, createCommentStore as bg, createEditor as bh, createSchema as bi, defaultFontFamilies as bj, defaultFontSizes as bk, defaultLineHeights as bl, defaultSlashCommands as bm, defaultToolbar as bn, defineNodeView as bo, definePlugin as bp, getActiveAlign as bq, getComments as br, getLinkAt as bs, getMentions as bt, getSelectedImage as bu, htmlToPlainText as bv, insertImage as bw, isCommandActive as bx, isMarkActive as by, isNodeActive as bz };
2888
+ export type { EmbedInfo as $, AccordionOptions as A, BlockFormat as B, ChainCommandName as C, CommentStore as D, CommentThread as F, CommentsController as G, CommentsOptions as H, ContextToolbarSpec as I, ControlSpec as J, CorrectionKind as K, NovaSchema as N, DialogApi as O, PageLayoutOptions as P, DialogData as Q, DialogField as R, DialogFieldValue as S, DialogSpec as T, EditImageOptions as U, EditorEvent as V, EditorEventDetails as W, EditorListener as X, EditorMode as Y, EditorOptions as Z, EditorSelection as _, PageLayout as a, TableOfContentsOptions as a$, ExportPdfOptions as a0, ExportWordOptions as a1, FilePickResult as a2, FilePickType as a3, FilePicker as a4, FontOption as a5, FormatSpec as a6, FullPageHtmlOptions as a8, HeadElement as a9, PageBand as aB, PageBandParts as aC, PageData as aD, PageEmbedOptions as aE, PageEmbedSize as aF, PageHandler as aG, PageLayoutController as aH, PageMargins as aI, PageSizeName as aJ, PanelButtonSpec as aK, PasteOptions as aL, PdfRequest as aM, PluginEntry as aN, PluginOptions as aO, QuickbarsOptions as aP, ReplacementPattern as aS, Revision as aT, RevisionHistoryOptions as aU, SchemaExtensions as aV, SelectionBookmark as aW, SidebarSpec as aX, SlashCommand as aZ, StyleFormat as a_, ImageAlign as aa, InlinePattern as ab, InlineTag as ac, LinkCheckerOptions as ad, LinkStatus as ae, MarkName as af, MediaEmbedOptions as ag, MentionUser as ah, MentionsOptions as ai, MenuButtonSpec as aj, MenuDefinition as ak, MenuEntry as al, MenuItem as am, MenuItemSpec as an, MergeTag as ao, MergeTagGroup as ap, MergeTagsOptions as aq, NodeName as ar, NodeViewFactory as as, NodeViewOptions as at, NodeViewProps as au, NodeViewRenderer as av, NotificationAction as aw, NotificationHandle as ax, NotificationOptions as ay, NovaPlugin as az, AccordionState as b, TableSeries as b0, TextAlign as b1, TextPattern as b2, TextPatternCommand as b3, TextPatternContext as b4, ToolbarConfig as b5, ToolbarMode as b6, TypographyOptions as b7, TypographyRule as b8, ContentRulesOptions as bN, Declaration as bO, EmailDocumentOptions as bQ, EmailFilter as bR, EmailOptions as bS, UploadImageHandler as ba, ViewApi as bb, ViewButton as bc, ViewSpec as bd, AdvCodeOptions as c, AdvTableOptions as d, AiAction as e, AiMessage as f, AiOptions as g, AiRequest as h, AiShortcut as i, AutocompleterItem as j, AutocompleterSpec as k, AutocorrectCorrection as l, AutocorrectOptions as m, AutosaveOptions as n, BlockPattern as o, BlockTag as p, ButtonSpec as q, ClassFilter as r, ClassOption as s, CodeGrammarLoader as t, CodeLanguage as u, CodeSampleOptions as v, CommandChain as w, CommandName as x, Comment as y, CommentAuthor as z };