@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
package/dist/index.js CHANGED
@@ -1,91 +1,117 @@
1
1
  import {
2
- ContentRules,
2
+ prettyHTML
3
+ } from "./chunk-XIH4SCO6.js";
4
+ import {
3
5
  DEFAULT_MENUBAR,
4
6
  DEFAULT_MENUS,
5
7
  Editor,
6
- Formatter,
7
- HTMLSerializer,
8
- KNOWN_STYLES,
9
- KNOWN_TAGS,
10
- clearSearch,
8
+ REMOTE_CHANGE_META,
11
9
  countWords,
12
10
  createEditor,
13
- createTranslator,
14
- defaultColors,
15
- defaultFontFamilies,
16
- defaultFontSizes,
17
- defaultLineHeights,
18
11
  defaultSlashCommands,
19
12
  defaultToolbar,
20
- en,
13
+ htmlToPlainText,
14
+ printContent
15
+ } from "./chunk-EXX2S352.js";
16
+ import "./chunk-4I4AYH2K.js";
17
+ import "./chunk-YVSUR7E5.js";
18
+ import {
19
+ parserFor
20
+ } from "./chunk-66INZHZ2.js";
21
+ import "./chunk-GTLE2HEW.js";
22
+ import {
23
+ clearSearch,
21
24
  findMatches,
22
25
  findNext,
23
- formatHTML,
24
- getLineHeight,
25
26
  getSearchState,
26
- getStyle,
27
- htmlToPlainText,
28
- isFullscreen,
29
- openHelp,
30
- openPreview,
31
- openSourceCode,
32
- parseToolbar,
33
- parserFor,
34
- printContent,
35
- rankSlashCommands,
36
- registerLanguage,
37
27
  replaceAll,
38
28
  replaceCurrent,
39
- ru,
40
- setLineHeight,
41
- setSearch,
42
- setStyle,
43
- toggleFullscreen
44
- } from "./chunk-46RIM5KP.js";
29
+ setSearch
30
+ } from "./chunk-6LQM7G4V.js";
45
31
  import {
46
- COMMENT_ID_RE,
47
- COMMENT_MAX_LENGTH,
48
- COMMENT_NAME_MAX_LENGTH,
49
- createCommentStore,
50
- newCommentId,
51
- sanitizeThread
52
- } from "./chunk-Z3ELZ77W.js";
32
+ defaultColors,
33
+ defaultFontFamilies,
34
+ defaultFontSizes,
35
+ defaultLineHeights,
36
+ getLineHeight,
37
+ getStyle,
38
+ setLineHeight,
39
+ setStyle
40
+ } from "./chunk-6YSQGFV7.js";
53
41
  import {
54
42
  applyLink,
55
- attachFilePicker,
56
- createTable,
57
- getSelectedImage,
58
- hasHeaderColumn,
59
- hasHeaderRow,
60
- insertTable,
61
- isInTable,
62
43
  normalizeUrl,
44
+ openLinkDialog,
45
+ removeLink
46
+ } from "./chunk-IG2BL4ON.js";
47
+ import {
48
+ getSelectedImage,
63
49
  openImageAltDialog,
64
50
  openImageDialog,
65
- openLinkDialog,
66
- removeLink,
67
- setCellBackground,
68
51
  setImageAttrs,
69
52
  setImageWidthFraction,
70
- tableCommands,
71
- textField,
72
53
  uploadImages
73
- } from "./chunk-435CRWKA.js";
54
+ } from "./chunk-J6W2CDRF.js";
74
55
  import {
75
- createSchema,
76
- cssValue,
77
- imageSize,
78
- schema
79
- } from "./chunk-7ON7PR5R.js";
56
+ createTable,
57
+ hasHeaderColumn,
58
+ hasHeaderRow,
59
+ insertTable,
60
+ setCellBackground,
61
+ tableCommands
62
+ } from "./chunk-GHVB6SV4.js";
63
+ import "./chunk-ANE5ASXG.js";
64
+ import {
65
+ formatHTML,
66
+ isFullscreen,
67
+ openHelp,
68
+ openPreview,
69
+ openSourceCode,
70
+ toggleFullscreen
71
+ } from "./chunk-23ZLVT5D.js";
72
+ import "./chunk-FTEA6L2Q.js";
73
+ import "./chunk-MZGNOHSY.js";
74
+ import "./chunk-I7Y4KSM2.js";
75
+ import "./chunk-T3IRLTKK.js";
76
+ import {
77
+ Formatter,
78
+ createRenderer,
79
+ renderHTML
80
+ } from "./chunk-YDPZCVXS.js";
81
+ import "./chunk-S2XZRKHA.js";
82
+ import "./chunk-LVEQBNLX.js";
83
+ import "./chunk-AQV6FIKK.js";
80
84
  import {
81
- pickLabels
82
- } from "./chunk-6RJENZXT.js";
85
+ HTMLSerializer
86
+ } from "./chunk-53AY5NAF.js";
83
87
  import {
84
- h
85
- } from "./chunk-HZRIBOPW.js";
88
+ PAGE_SIZES,
89
+ pageLayout
90
+ } from "./chunk-OFHGXYG3.js";
91
+ import "./chunk-YG5V7POU.js";
92
+ import "./chunk-C326LHHU.js";
86
93
  import {
87
- icons
88
- } from "./chunk-NPKAIW34.js";
94
+ getComments
95
+ } from "./chunk-N32H37AJ.js";
96
+ import {
97
+ isSuggesting,
98
+ listSuggestions,
99
+ resolveSuggestions,
100
+ setSuggesting,
101
+ suggestionsResult
102
+ } from "./chunk-P2UU2NLT.js";
103
+ import "./chunk-OQMMHWMZ.js";
104
+ import {
105
+ getMentions
106
+ } from "./chunk-GXXXLPDQ.js";
107
+ import {
108
+ createCommentStore,
109
+ sanitizeThread
110
+ } from "./chunk-AP2PJFLB.js";
111
+ import "./chunk-5VCESSQB.js";
112
+ import "./chunk-NTGEKGXU.js";
113
+ import "./chunk-HC6RMBAD.js";
114
+ import "./chunk-EOJ5XHKA.js";
89
115
  import {
90
116
  commands,
91
117
  getActiveAlign,
@@ -94,1473 +120,177 @@ import {
94
120
  isCommandActive,
95
121
  isMarkActive,
96
122
  isNodeActive,
97
- isSafeImageUrl,
98
- isSafeLinkUrl,
99
123
  marksOf,
100
124
  nodesOf,
101
125
  setLink
102
- } from "./chunk-GHEFKKRC.js";
126
+ } from "./chunk-AC3YCAX4.js";
127
+ import "./chunk-HNEAVVBC.js";
128
+ import {
129
+ createSchema,
130
+ isInTable,
131
+ schema
132
+ } from "./chunk-TAM2FHKG.js";
133
+ import "./chunk-XR7CY4NI.js";
134
+ import {
135
+ icons
136
+ } from "./chunk-ADRPQLZ2.js";
137
+ import {
138
+ en,
139
+ getPluginMessages,
140
+ hasLanguage,
141
+ loadLanguage,
142
+ registerLanguage
143
+ } from "./chunk-DEYYVZ7O.js";
103
144
  import {
104
145
  definePlugin,
105
146
  isPluginRegistered,
106
147
  registerPlugin
107
- } from "./chunk-HPLT3XRZ.js";
108
-
109
- // src/plugins/anchor.ts
110
- import { NodeSelection } from "prosemirror-state";
111
- var ICON = icons.anchor;
112
- var LABELS = {
113
- en: {
114
- title: "Anchor",
115
- id: "ID",
116
- hint: "Letters, digits, \u201C-\u201D, \u201C_\u201D, \u201C.\u201D; must start with a letter. Link to it with #ID.",
117
- invalid: "Use letters, digits, \u201C-\u201D, \u201C_\u201D or \u201C.\u201D, starting with a letter",
118
- save: "Save"
119
- },
120
- ru: {
121
- title: "\u042F\u043A\u043E\u0440\u044C",
122
- id: "\u0418\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440",
123
- hint: "\u041B\u0430\u0442\u0438\u043D\u0441\u043A\u0438\u0435 \u0431\u0443\u043A\u0432\u044B, \u0446\u0438\u0444\u0440\u044B, \xAB-\xBB, \xAB_\xBB, \xAB.\xBB; \u043D\u0430\u0447\u0438\u043D\u0430\u0435\u0442\u0441\u044F \u0441 \u0431\u0443\u043A\u0432\u044B. \u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u044F\u043A\u043E\u0440\u044C \u2014 #\u0438\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440.",
124
- invalid: "\u0422\u043E\u043B\u044C\u043A\u043E \u043B\u0430\u0442\u0438\u043D\u0441\u043A\u0438\u0435 \u0431\u0443\u043A\u0432\u044B, \u0446\u0438\u0444\u0440\u044B, \xAB-\xBB, \xAB_\xBB \u0438\u043B\u0438 \xAB.\xBB, \u043F\u0435\u0440\u0432\u0430\u044F \u2014 \u0431\u0443\u043A\u0432\u0430",
125
- save: "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C"
126
- }
127
- };
128
- var ID_RE = /^[A-Za-z][\w.-]{0,63}$/;
129
- var anchor_default = definePlugin({
130
- name: "anchor",
131
- toolbar: "anchor",
132
- nodes: {
133
- anchor: {
134
- group: "inline",
135
- inline: true,
136
- atom: true,
137
- selectable: true,
138
- attrs: { id: {} },
139
- parseDOM: [
140
- {
141
- tag: "a[id]:not([href])",
142
- getAttrs: (dom) => {
143
- const id = dom.getAttribute("id") ?? "";
144
- return ID_RE.test(id) ? { id } : false;
145
- }
146
- },
147
- {
148
- tag: "a[name]:not([href])",
149
- getAttrs: (dom) => {
150
- const id = dom.getAttribute("name") ?? "";
151
- return ID_RE.test(id) ? { id } : false;
152
- }
153
- }
154
- ],
155
- // Документ мог прийти из JSON — идентификатор проверяем и на выходе.
156
- toDOM: (node) => ["a", { id: ID_RE.test(node.attrs.id) ? node.attrs.id : null }]
157
- }
158
- },
159
- setup(editor) {
160
- const labels = pickLabels(editor, LABELS);
161
- const selectedAnchor = () => {
162
- const { selection } = editor.view.state;
163
- return selection instanceof NodeSelection && selection.node.type.name === "anchor" ? selection : null;
164
- };
165
- const open = () => {
166
- const current = selectedAnchor();
167
- const field = textField({
168
- label: labels.id,
169
- hint: labels.hint,
170
- value: current?.node.attrs.id ?? ""
171
- });
172
- editor.ui.openDialog({
173
- title: labels.title,
174
- body: h("div", { className: "nova-form" }, field.el),
175
- submitLabel: labels.save,
176
- onSubmit: () => {
177
- const id = field.input.value.trim();
178
- if (!ID_RE.test(id)) return labels.invalid;
179
- const { state, dispatch } = editor.view;
180
- const type = editor.schema.nodes.anchor;
181
- const sel = selectedAnchor();
182
- if (sel) dispatch(state.tr.setNodeMarkup(sel.from, void 0, { id }));
183
- else dispatch(state.tr.replaceSelectionWith(type.create({ id }), false).scrollIntoView());
184
- return true;
185
- }
186
- });
187
- };
188
- editor.ui.registry.addToggleButton("anchor", {
189
- icon: ICON,
190
- tooltip: labels.title,
191
- isActive: () => selectedAnchor() !== null,
192
- isEnabled: (e) => e.isEditable(),
193
- onAction: open
194
- });
195
- editor.ui.registry.addMenuItem("anchor", { text: labels.title, icon: ICON, onAction: open });
196
- }
197
- });
198
-
199
- // src/plugins/comments.ts
200
- import { Plugin, PluginKey } from "prosemirror-state";
201
- import { Decoration, DecorationSet } from "prosemirror-view";
202
- import { keymap } from "prosemirror-keymap";
203
-
204
- // src/plugins/mentions.ts
205
- var LABELS2 = {
206
- en: { list: "People", empty: "No matches" },
207
- ru: { list: "\u041B\u044E\u0434\u0438", empty: "\u041D\u0438\u043A\u043E\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E" }
208
- };
209
- var MENTION_ID_RE = /^[\w.@:+-]{1,128}$/;
210
- var MAX_NAME = 80;
211
- var cleanName = (value) => value.replace(/^@/, "").trim().slice(0, MAX_NAME);
212
- async function findMentionUsers(fetch, query, max = 8) {
213
- const result = await fetch(query);
214
- if (!Array.isArray(result)) return [];
215
- return result.filter((u) => u && typeof u.id === "string" && MENTION_ID_RE.test(u.id) && u.name).slice(0, max).map((u) => ({
216
- id: u.id,
217
- name: cleanName(String(u.name)),
218
- ...u.description ? { description: String(u.description).slice(0, 120) } : {}
219
- }));
220
- }
221
- function getMentions(editorOrDoc) {
222
- const doc = "view" in editorOrDoc ? editorOrDoc.view.state.doc : editorOrDoc;
223
- const seen = /* @__PURE__ */ new Map();
224
- doc.descendants((node) => {
225
- if (node.type.name === "mention" && !seen.has(node.attrs.id)) {
226
- seen.set(node.attrs.id, {
227
- id: node.attrs.id,
228
- name: node.attrs.name
229
- });
230
- }
231
- });
232
- return [...seen.values()];
233
- }
234
- var mentions_default = definePlugin({
235
- name: "mentions",
236
- nodes: {
237
- mention: {
238
- group: "inline",
239
- inline: true,
240
- atom: true,
241
- selectable: false,
242
- attrs: { id: {}, name: { default: "" } },
243
- parseDOM: [
244
- {
245
- tag: "span[data-mention]",
246
- getAttrs: (dom) => {
247
- const el = dom;
248
- const id = el.getAttribute("data-mention") ?? "";
249
- return MENTION_ID_RE.test(id) ? { id, name: cleanName(el.textContent ?? "") } : false;
250
- }
251
- }
252
- ],
253
- // Документ мог прийти из JSON: id проверяем и при выводе, имя — только текст.
254
- toDOM: (node) => [
255
- "span",
256
- { "data-mention": MENTION_ID_RE.test(node.attrs.id) ? node.attrs.id : null },
257
- `@${cleanName(String(node.attrs.name))}`
258
- ],
259
- leafText: (node) => `@${cleanName(String(node.attrs.name))}`
260
- }
261
- },
262
- setup(editor) {
263
- const options = editor.options.pluginOptions?.mentions;
264
- if (!options?.fetch) {
265
- console.warn("[nova] mentions: set pluginOptions.mentions.fetch to search people");
266
- return;
267
- }
268
- const labels = pickLabels(editor, LABELS2);
269
- const max = options.maxResults ?? 8;
270
- let found = /* @__PURE__ */ new Map();
271
- editor.ui.registry.addAutocompleter("mentions", {
272
- trigger: "@",
273
- label: labels.list,
274
- emptyText: labels.empty,
275
- maxResults: max,
276
- fetch: async (query) => {
277
- const users = await findMentionUsers(options.fetch, query, max);
278
- found = new Map(users.map((u) => [u.id, u]));
279
- return users.map((u) => ({
280
- value: u.id,
281
- label: u.name,
282
- ...u.description ? { detail: u.description } : {}
283
- }));
284
- },
285
- onSelect: (item, range, e) => {
286
- const user = found.get(item.value) ?? { id: item.value, name: item.label };
287
- const { state, dispatch } = e.view;
288
- const node = e.schema.nodes.mention.create({ id: user.id, name: user.name });
289
- dispatch(
290
- state.tr.replaceWith(range.from, range.to, [node, state.schema.text(" ")]).scrollIntoView()
291
- );
292
- options.onMention?.(user, e);
293
- }
294
- });
295
- }
296
- });
297
-
298
- // src/plugins/comments.ts
299
- var LABELS3 = {
300
- en: {
301
- add: "Add comment",
302
- show: "Comments",
303
- panel: "Comments",
304
- guest: "Guest",
305
- newComment: "New comment",
306
- placeholder: "Add a comment\u2026",
307
- replyPlaceholder: "Reply\u2026",
308
- comment: "Comment",
309
- reply: "Reply",
310
- cancel: "Cancel",
311
- save: "Save",
312
- edit: "Edit",
313
- remove: "Delete",
314
- resolve: "Resolve",
315
- reopen: "Reopen",
316
- deleteThread: "Delete thread",
317
- close: "Close comments",
318
- showResolved: "Show resolved",
319
- resolvedBy: "Resolved by {name}",
320
- orphan: "The commented text was deleted",
321
- empty: "No comments yet. Select text and press \u201CAdd comment\u201D ({shortcut}).",
322
- people: "People",
323
- noPeople: "No matches",
324
- edited: "edited",
325
- you: "you",
326
- count: "{count} comments"
327
- },
328
- ru: {
329
- add: "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439",
330
- show: "\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438",
331
- panel: "\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438",
332
- guest: "\u0413\u043E\u0441\u0442\u044C",
333
- newComment: "\u041D\u043E\u0432\u044B\u0439 \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439",
334
- placeholder: "\u041D\u0430\u043F\u0438\u0448\u0438\u0442\u0435 \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439\u2026",
335
- replyPlaceholder: "\u041E\u0442\u0432\u0435\u0442\u0438\u0442\u044C\u2026",
336
- comment: "\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C",
337
- reply: "\u041E\u0442\u0432\u0435\u0442\u0438\u0442\u044C",
338
- cancel: "\u041E\u0442\u043C\u0435\u043D\u0430",
339
- save: "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C",
340
- edit: "\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C",
341
- remove: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C",
342
- resolve: "\u0420\u0435\u0448\u0435\u043D\u043E",
343
- reopen: "\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0441\u043D\u043E\u0432\u0430",
344
- deleteThread: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u043E\u0431\u0441\u0443\u0436\u0434\u0435\u043D\u0438\u0435",
345
- close: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438",
346
- showResolved: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0440\u0435\u0448\u0451\u043D\u043D\u044B\u0435",
347
- resolvedBy: "\u0420\u0435\u0448\u0435\u043D\u043E: {name}",
348
- orphan: "\u041F\u0440\u043E\u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u0442\u0435\u043A\u0441\u0442 \u0443\u0434\u0430\u043B\u0451\u043D",
349
- empty: "\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0435\u0432 \u043F\u043E\u043A\u0430 \u043D\u0435\u0442. \u0412\u044B\u0434\u0435\u043B\u0438\u0442\u0435 \u0442\u0435\u043A\u0441\u0442 \u0438 \u043D\u0430\u0436\u043C\u0438\u0442\u0435 \xAB\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439\xBB ({shortcut}).",
350
- people: "\u041B\u044E\u0434\u0438",
351
- noPeople: "\u041D\u0438\u043A\u043E\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E",
352
- edited: "\u0438\u0437\u043C\u0435\u043D\u0435\u043D\u043E",
353
- you: "\u0432\u044B",
354
- count: "\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0435\u0432: {count}"
355
- }
356
- };
357
- var ICON_ADD = icons.commentAdd;
358
- var ICON_SHOW = icons.comments;
359
- var SHORTCUT = "Mod-Alt-m";
360
- var commentsKey = new PluginKey("nova-comments");
361
- var controllers = /* @__PURE__ */ new WeakMap();
362
- function getComments(editor) {
363
- return controllers.get(editor);
364
- }
365
- function collectRanges(doc) {
366
- const result = /* @__PURE__ */ new Map();
367
- doc.descendants((node, pos) => {
368
- if (!node.isInline) return;
369
- for (const mark of node.marks) {
370
- if (mark.type.name !== "comment") continue;
371
- const id = mark.attrs.id;
372
- const list = result.get(id) ?? [];
373
- const last = list[list.length - 1];
374
- if (last && last.to === pos) last.to = pos + node.nodeSize;
375
- else list.push({ from: pos, to: pos + node.nodeSize });
376
- result.set(id, list);
377
- }
378
- });
379
- return result;
380
- }
381
- function commentIdsAt(state) {
382
- const { $from, empty } = state.selection;
383
- const marks = empty ? [...$from.nodeBefore?.marks ?? [], ...$from.nodeAfter?.marks ?? []] : $from.nodeAfter?.marks ?? [];
384
- return marks.filter((m) => m.type.name === "comment").map((m) => m.attrs.id);
385
- }
386
- var comments_default = definePlugin({
387
- name: "comments",
388
- toolbar: "addcomment showcomments",
389
- marks: {
390
- comment: {
391
- attrs: { id: {} },
392
- // Ввод на границе фрагмента не расширяет его; разные обсуждения могут перекрываться.
393
- inclusive: false,
394
- excludes: "",
395
- parseDOM: [
396
- {
397
- tag: "span[data-comment]",
398
- getAttrs: (dom) => {
399
- const id = dom.getAttribute("data-comment") ?? "";
400
- return COMMENT_ID_RE.test(id) ? { id } : false;
401
- }
402
- }
403
- ],
404
- toDOM: (mark) => [
405
- "span",
406
- { "data-comment": COMMENT_ID_RE.test(mark.attrs.id) ? mark.attrs.id : null },
407
- 0
408
- ]
409
- }
410
- },
411
- prosemirrorPlugins: (editor) => {
412
- let cache = null;
413
- return [
414
- keymap({
415
- [SHORTCUT]: () => getComments(editor)?.startComment() ?? false
416
- }),
417
- new Plugin({
418
- key: commentsKey,
419
- state: {
420
- init: () => ({ pending: null, active: null }),
421
- apply(tr, value) {
422
- const meta = tr.getMeta(commentsKey);
423
- let next = value;
424
- if (tr.docChanged && next.pending) {
425
- const from = tr.mapping.map(next.pending.from, 1);
426
- const to = tr.mapping.map(next.pending.to, -1);
427
- next = { ...next, pending: from < to ? { from, to } : null };
428
- }
429
- if (meta && ("pending" in meta || "active" in meta)) next = { ...next, ...meta };
430
- return next;
431
- }
432
- },
433
- props: {
434
- decorations(state) {
435
- const controller = getComments(editor);
436
- const pluginState = commentsKey.getState(state);
437
- const threads = controller?.store.threads();
438
- if (cache && cache.doc === state.doc && cache.threads === threads && cache.state === pluginState) {
439
- return cache.set;
440
- }
441
- const open = new Set((threads ?? []).filter((t) => !t.resolved).map((t) => t.id));
442
- const decorations = [];
443
- for (const [id, ranges] of collectRanges(state.doc)) {
444
- if (!open.has(id)) continue;
445
- const className = id === pluginState.active ? "nova-comment is-active" : "nova-comment";
446
- for (const { from, to } of ranges) {
447
- decorations.push(Decoration.inline(from, to, { class: className }));
448
- }
449
- }
450
- if (pluginState.pending) {
451
- const { from, to } = pluginState.pending;
452
- decorations.push(
453
- Decoration.inline(from, to, { class: "nova-comment is-active is-pending" })
454
- );
455
- }
456
- const set = DecorationSet.create(state.doc, decorations);
457
- cache = { doc: state.doc, threads, state: pluginState, set };
458
- return set;
459
- }
460
- },
461
- view: () => ({
462
- update(view, prev) {
463
- if (prev.selection.eq(view.state.selection) || prev.doc !== view.state.doc) return;
464
- const controller = getComments(editor);
465
- if (!controller || commentsKey.getState(view.state).pending) return;
466
- const open = new Set(
467
- controller.store.threads().filter((t) => !t.resolved).map((t) => t.id)
468
- );
469
- const id = commentIdsAt(view.state).find((candidate) => open.has(candidate));
470
- if (id && (id !== controller.active() || !controller.isPanelOpen())) {
471
- queueMicrotask(() => {
472
- controller.setActive(id);
473
- void controller.openPanel();
474
- });
475
- }
476
- }
477
- })
478
- })
479
- ];
480
- },
481
- setup(editor) {
482
- const labels = pickLabels(editor, LABELS3);
483
- const options = editor.options.pluginOptions?.comments ?? {};
484
- const store = options.store ?? createCommentStore(options.threads ?? [], options.onChange);
485
- const author = {
486
- id: String(options.author?.id ?? "guest").slice(0, 128),
487
- name: String(options.author?.name || labels.guest).slice(0, COMMENT_NAME_MAX_LENGTH)
488
- };
489
- const markType = () => editor.schema.marks.comment;
490
- const userSource = options.mentions ?? editor.options.pluginOptions?.mentions?.fetch;
491
- const keepMentions = (text, mentions = []) => {
492
- const unique = new Map(mentions.map((m) => [m.id, m]));
493
- return [...unique.values()].filter((m) => text.includes(`@${m.name}`));
494
- };
495
- const makeComment = (text, mentions) => {
496
- const kept = keepMentions(text, mentions);
497
- return {
498
- id: newCommentId(),
499
- author,
500
- text,
501
- createdAt: Date.now(),
502
- ...kept.length ? { mentions: kept } : {}
503
- };
504
- };
505
- const notify = (threadId, comment) => {
506
- if (comment.mentions?.length) {
507
- options.onMention?.({ threadId, comment, users: comment.mentions });
508
- }
509
- };
510
- const pluginState = () => commentsKey.getState(editor.view.state);
511
- const dispatchMeta = (meta) => editor.view.dispatch(editor.view.state.tr.setMeta(commentsKey, meta));
512
- let panel = null;
513
- let panelOpen = false;
514
- let loading = null;
515
- const content = editor.view.dom.parentElement;
516
- const body = document.createElement("div");
517
- body.className = "nova-body";
518
- content.parentElement.insertBefore(body, content);
519
- body.append(content);
520
- const controller = {
521
- editor,
522
- store,
523
- author,
524
- labels,
525
- shortcut: SHORTCUT,
526
- pending: () => pluginState().pending,
527
- active: () => pluginState().active,
528
- setActive(id, scroll = false) {
529
- if (pluginState().active !== id) dispatchMeta({ active: id });
530
- panel?.render();
531
- const range = id ? controller.ranges(id)[0] : void 0;
532
- if (scroll && range) {
533
- const { node } = editor.view.domAtPos(range.from);
534
- const el = node instanceof Element ? node : node.parentElement;
535
- el?.scrollIntoView({ block: "nearest" });
536
- }
537
- },
538
- startComment() {
539
- const { selection } = editor.view.state;
540
- if (selection.empty || !editor.isEditable()) return false;
541
- dispatchMeta({ pending: { from: selection.from, to: selection.to }, active: null });
542
- void controller.openPanel().then(() => {
543
- panel?.render();
544
- panel?.focusComposer();
545
- });
546
- return true;
547
- },
548
- cancelPending() {
549
- dispatchMeta({ pending: null });
550
- panel?.render();
551
- editor.focus();
552
- },
553
- findUsers: userSource ? (query) => findMentionUsers(userSource, query) : null,
554
- submitPending(text, mentions) {
555
- const pending = pluginState().pending;
556
- const value = text.trim().slice(0, COMMENT_MAX_LENGTH);
557
- if (!pending || !value) return null;
558
- const id = newCommentId("t");
559
- const comment = makeComment(value, mentions);
560
- store.createThread({
561
- id,
562
- createdAt: comment.createdAt,
563
- comments: [comment],
564
- resolved: null
565
- });
566
- const { state } = editor.view;
567
- editor.view.dispatch(
568
- state.tr.addMark(pending.from, pending.to, markType().create({ id })).setMeta(commentsKey, { pending: null, active: id }).setMeta("addToHistory", false)
569
- );
570
- panel?.render();
571
- notify(id, comment);
572
- return id;
573
- },
574
- reply(threadId, text, mentions) {
575
- const value = text.trim().slice(0, COMMENT_MAX_LENGTH);
576
- if (!value) return;
577
- const comment = makeComment(value, mentions);
578
- store.reply(threadId, comment);
579
- notify(threadId, comment);
580
- },
581
- ranges: (id) => collectRanges(editor.view.state.doc).get(id) ?? [],
582
- quote(id) {
583
- const { doc } = editor.view.state;
584
- return controller.ranges(id).map(({ from, to }) => doc.textBetween(from, to, " ")).join(" \u2026 ");
585
- },
586
- positionOf: (id) => controller.ranges(id)[0]?.from ?? Number.MAX_SAFE_INTEGER,
587
- deleteThread(id) {
588
- const { state } = editor.view;
589
- const tr = state.tr;
590
- for (const { from, to } of controller.ranges(id)) {
591
- tr.removeMark(from, to, markType().create({ id }));
592
- }
593
- if (pluginState().active === id) tr.setMeta(commentsKey, { active: null });
594
- if (tr.docChanged || tr.getMeta(commentsKey)) {
595
- editor.view.dispatch(tr.setMeta("addToHistory", false));
596
- }
597
- store.deleteThread(id);
598
- },
599
- setResolved(id, resolved) {
600
- store.setResolved(id, resolved ? { by: author, at: Date.now() } : null);
601
- if (resolved && pluginState().active === id) dispatchMeta({ active: null });
602
- },
603
- canEdit: (comment) => options.canEdit ? options.canEdit(comment, author) : comment.author.id === author.id,
604
- isPanelOpen: () => panelOpen,
605
- async openPanel() {
606
- if (!panel) {
607
- loading ??= import("./comments-panel-FYJE3U64.js").then(({ createCommentsPanel }) => {
608
- if (editor.view.isDestroyed) return;
609
- panel = createCommentsPanel(controller);
610
- body.append(panel.el);
611
- });
612
- await loading;
613
- }
614
- if (!panel || panelOpen) return;
615
- editor.ui.closeOverlays();
616
- panelOpen = true;
617
- panel.el.hidden = false;
618
- editor.root.classList.add("nova-comments-open");
619
- panel.render();
620
- editor.updateUI();
621
- },
622
- closePanel() {
623
- if (!panel || !panelOpen) return;
624
- panelOpen = false;
625
- panel.el.hidden = true;
626
- editor.root.classList.remove("nova-comments-open");
627
- if (pluginState().pending) dispatchMeta({ pending: null });
628
- editor.updateUI();
629
- editor.focus();
630
- }
631
- };
632
- controllers.set(editor, controller);
633
- const unsubscribe = store.subscribe(() => {
634
- if (editor.view.isDestroyed) return;
635
- dispatchMeta({ refresh: true });
636
- panel?.render();
637
- });
638
- const add = () => controller.startComment();
639
- const toggle = () => controller.isPanelOpen() ? controller.closePanel() : void controller.openPanel();
640
- const canAdd = (e) => e.isEditable() && !e.view.state.selection.empty;
641
- editor.ui.registry.addButton("addcomment", {
642
- icon: ICON_ADD,
643
- tooltip: labels.add,
644
- shortcut: SHORTCUT,
645
- isEnabled: canAdd,
646
- onAction: add
647
- });
648
- editor.ui.registry.addToggleButton("showcomments", {
649
- icon: ICON_SHOW,
650
- tooltip: labels.show,
651
- isActive: () => panelOpen,
652
- onAction: toggle
653
- });
654
- editor.ui.registry.addMenuItem("addcomment", {
655
- text: labels.add,
656
- icon: ICON_ADD,
657
- shortcut: SHORTCUT,
658
- isEnabled: canAdd,
659
- onAction: add
660
- });
661
- editor.ui.registry.addMenuItem("showcomments", {
662
- text: labels.show,
663
- icon: ICON_SHOW,
664
- isActive: () => panelOpen,
665
- onAction: toggle
666
- });
667
- return () => {
668
- unsubscribe();
669
- panel?.destroy();
670
- controllers.delete(editor);
671
- };
672
- }
673
- });
148
+ } from "./chunk-V7WUHUHM.js";
149
+ import "./chunk-QU3KXMYT.js";
150
+ import "./chunk-G74HNSB6.js";
151
+ import {
152
+ registerHtmlRules
153
+ } from "./chunk-OOVNE6MB.js";
154
+ import "./chunk-3BOK3S3T.js";
155
+ import "./chunk-YDF55N6Z.js";
156
+ import {
157
+ isSafeImageUrl,
158
+ isSafeLinkUrl
159
+ } from "./chunk-4VPDY3LF.js";
674
160
 
675
- // src/plugins/mergetags.ts
676
- import { Plugin as PMPlugin } from "prosemirror-state";
677
- var LABELS4 = {
678
- en: {
679
- insert: "Insert variable",
680
- search: "Variables",
681
- empty: "No variables found",
682
- unknown: "Unknown variable"
683
- },
684
- ru: {
685
- insert: "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u0443\u044E",
686
- search: "\u041F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0435",
687
- empty: "\u041F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0435 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B",
688
- unknown: "\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u0430\u044F"
689
- }
690
- };
691
- var KEY_RE = /^[\w.:-]{1,100}$/;
692
- var ATTR_RE = /^data-[a-z0-9-]{1,40}$/;
693
- function optionsOf(editor) {
694
- return editor.options.pluginOptions?.mergetags ?? {};
695
- }
696
- function attributeOf(editor) {
697
- const attribute = optionsOf(editor).attribute ?? "data-mergetag";
698
- if (ATTR_RE.test(attribute)) return attribute;
699
- console.warn(
700
- `[nova] mergetags: attribute "${attribute}" must look like data-name; using data-mergetag`
701
- );
702
- return "data-mergetag";
703
- }
704
- var isGroup = (entry) => Array.isArray(entry.items);
705
- function flatList(editor) {
706
- return (optionsOf(editor).list ?? []).flatMap(
707
- (entry) => isGroup(entry) ? entry.items : [entry]
708
- );
161
+ // src/node-view.ts
162
+ var CONTROLS = "input, textarea, select, button, label, [data-node-view-control]";
163
+ function report(message, error) {
164
+ console.error(`[nova] ${message}`, error);
709
165
  }
710
- function labelFor(editor, key) {
711
- return flatList(editor).find((tag) => tag.key === key)?.label;
712
- }
713
- function buildNodes(editor) {
714
- const attribute = attributeOf(editor);
715
- return {
716
- mergetag: {
717
- group: "inline",
718
- inline: true,
719
- atom: true,
720
- selectable: true,
721
- draggable: true,
722
- // Свой style «фишки» (цвет, фон, жирность) — оформление, а не формат текста вокруг.
723
- ignoreStyles: true,
724
- attrs: { key: {}, label: { default: "" } },
725
- parseDOM: [
726
- {
727
- tag: `span[${attribute}]`,
728
- // Выше марок и стилей: переменная — целый узел, а не span с форматированием.
729
- priority: 60,
730
- getAttrs: (dom) => {
731
- const el = dom;
732
- const key = el.getAttribute(attribute) ?? "";
733
- if (!KEY_RE.test(key)) return false;
734
- return { key, label: labelFor(editor, key) ?? el.textContent?.trim() ?? key };
735
- }
736
- }
737
- ],
738
- // Документ мог прийти из JSON — ключ проверяем и на выходе.
739
- toDOM: (node) => {
740
- const key = KEY_RE.test(node.attrs.key) ? node.attrs.key : "";
741
- const label = node.attrs.label || key;
742
- return ["span", { [attribute]: key, contenteditable: "false" }, label];
743
- }
744
- }
745
- };
746
- }
747
- var MergeTagView = class {
748
- constructor(node, editor, unknownTitle) {
166
+ var RenderedNodeView = class {
167
+ constructor(node, view, getPos, editor, create, options) {
749
168
  this.node = node;
169
+ this.view = view;
170
+ this.getPos = getPos;
750
171
  this.editor = editor;
751
- this.unknownTitle = unknownTitle;
752
- this.dom = document.createElement("span");
753
- this.dom.className = "nova-mergetag";
754
- this.dom.contentEditable = "false";
755
- this.render();
172
+ this.options = options;
173
+ const tag = options.as ?? (node.isInline ? "span" : "div");
174
+ this.dom = document.createElement(tag);
175
+ this.dom.setAttribute("data-node-view", node.type.name);
176
+ if (options.className) this.dom.className = options.className;
177
+ this.contentDOM = node.isLeaf ? null : document.createElement(options.contentAs ?? tag);
178
+ if (this.contentDOM) this.dom.append(this.contentDOM);
179
+ try {
180
+ this.renderer = create(editor);
181
+ this.renderer.mount(this.dom, this.props());
182
+ } catch (error) {
183
+ report(`Node view for "${node.type.name}" failed to render`, error);
184
+ }
756
185
  }
757
186
  node;
187
+ view;
188
+ getPos;
758
189
  editor;
759
- unknownTitle;
190
+ options;
760
191
  dom;
192
+ contentDOM;
193
+ selected = false;
194
+ renderer = null;
195
+ props() {
196
+ return {
197
+ editor: this.editor,
198
+ node: this.node,
199
+ selected: this.selected,
200
+ getPos: () => this.getPos(),
201
+ updateAttributes: (attrs) => this.updateAttributes(attrs),
202
+ deleteNode: () => this.deleteNode(),
203
+ contentDOM: this.contentDOM
204
+ };
205
+ }
761
206
  render() {
762
- const key = this.node.attrs.key;
763
- const known = labelFor(this.editor, key);
764
- this.dom.textContent = known ?? (this.node.attrs.label || key);
765
- this.dom.dataset.key = key;
766
- const list = optionsOf(this.editor).list;
767
- const unknown = !!list?.length && known === void 0;
768
- this.dom.classList.toggle("is-unknown", unknown);
769
- this.dom.title = unknown ? `${this.unknownTitle}: ${key}` : key;
207
+ try {
208
+ this.renderer?.update(this.props());
209
+ } catch (error) {
210
+ report(`Node view for "${this.node.type.name}" failed to update`, error);
211
+ }
212
+ }
213
+ current() {
214
+ const pos = this.getPos();
215
+ const node = pos === void 0 ? null : this.view.state.doc.nodeAt(pos);
216
+ return node && pos !== void 0 ? { pos, node } : null;
217
+ }
218
+ updateAttributes(attrs) {
219
+ const target = this.current();
220
+ if (!target) return;
221
+ const { tr } = this.view.state;
222
+ this.view.dispatch(tr.setNodeMarkup(target.pos, void 0, { ...target.node.attrs, ...attrs }));
223
+ }
224
+ deleteNode() {
225
+ const target = this.current();
226
+ if (!target) return;
227
+ this.view.dispatch(this.view.state.tr.delete(target.pos, target.pos + target.node.nodeSize));
770
228
  }
771
229
  update(node) {
772
230
  if (node.type !== this.node.type) return false;
231
+ if (node === this.node) return true;
773
232
  this.node = node;
774
233
  this.render();
775
234
  return true;
776
235
  }
777
236
  selectNode() {
778
- this.dom.classList.add("is-selected");
237
+ this.selected = true;
238
+ this.dom.classList.add("ProseMirror-selectednode");
239
+ this.render();
779
240
  }
780
241
  deselectNode() {
781
- this.dom.classList.remove("is-selected");
782
- }
783
- stopEvent() {
784
- return false;
785
- }
786
- ignoreMutation() {
787
- return true;
788
- }
789
- };
790
- function insertTag(editor, tag, range) {
791
- const { state, dispatch } = editor.view;
792
- const node = editor.schema.nodes.mergetag.create({ key: tag.key, label: tag.label });
793
- const tr = range ? state.tr.replaceWith(range.from, range.to, node) : state.tr.replaceSelectionWith(node, false);
794
- dispatch(tr.scrollIntoView());
795
- editor.focus();
796
- }
797
- var mergetags_default = definePlugin({
798
- name: "mergetags",
799
- toolbar: "mergetags",
800
- nodes: buildNodes,
801
- prosemirrorPlugins: (editor) => {
802
- const labels = pickLabels(editor, LABELS4);
803
- return [
804
- new PMPlugin({
805
- props: {
806
- nodeViews: {
807
- mergetag: (node, _view) => new MergeTagView(node, editor, labels.unknown)
808
- }
809
- }
810
- })
811
- ];
812
- },
813
- setup(editor) {
814
- const labels = pickLabels(editor, LABELS4);
815
- editor.ui.registry.addMenuButton("mergetags", {
816
- icon: icons.mergeTags,
817
- tooltip: labels.insert,
818
- isEnabled: (e) => e.isEditable() && flatList(e).length > 0,
819
- items: (e) => {
820
- const entries = [];
821
- const item = (tag, id) => ({
822
- id,
823
- label: tag.label,
824
- onSelect: () => insertTag(e, tag)
825
- });
826
- (optionsOf(e).list ?? []).forEach((entry, index) => {
827
- if (isGroup(entry)) {
828
- if (entries.length) entries.push({ type: "separator" });
829
- entries.push({ type: "heading", label: entry.title });
830
- entry.items.forEach((tag, i) => entries.push(item(tag, `mergetag-${index}-${i}`)));
831
- } else {
832
- entries.push(item(entry, `mergetag-${index}`));
833
- }
834
- });
835
- return entries;
836
- }
837
- });
838
- editor.ui.registry.addAutocompleter("mergetags", {
839
- trigger: "{{",
840
- label: labels.search,
841
- emptyText: labels.empty,
842
- maxResults: 12,
843
- fetch: (query, e) => {
844
- const q = query.toLowerCase();
845
- return flatList(e).filter((tag) => tag.label.toLowerCase().includes(q) || tag.key.toLowerCase().includes(q)).map((tag) => ({ value: tag.key, label: tag.label, detail: tag.key }));
846
- },
847
- onSelect: (item, range, e) => {
848
- const tag = flatList(e).find((t) => t.key === item.value);
849
- if (tag) insertTag(e, tag, range);
850
- }
851
- });
242
+ this.selected = false;
243
+ this.dom.classList.remove("ProseMirror-selectednode");
244
+ this.render();
852
245
  }
853
- });
854
-
855
- // src/plugins/suggestions.ts
856
- import {
857
- Fragment,
858
- Slice
859
- } from "prosemirror-model";
860
- import {
861
- Plugin as Plugin2,
862
- PluginKey as PluginKey2,
863
- TextSelection
864
- } from "prosemirror-state";
865
- import { ReplaceStep } from "prosemirror-transform";
866
- import { Decoration as Decoration2, DecorationSet as DecorationSet2 } from "prosemirror-view";
867
- import { keymap as keymap2 } from "prosemirror-keymap";
868
- var ID_RE2 = /^[A-Za-z0-9_-]{1,64}$/;
869
- var USER_ID_RE = /^[\w.@:+-]{1,128}$/;
870
- var LABELS5 = {
871
- en: {
872
- toggle: "Suggest edits",
873
- review: "Review suggestions",
874
- accept: "Accept",
875
- reject: "Reject",
876
- acceptAll: "Accept all suggestions",
877
- rejectAll: "Reject all suggestions",
878
- next: "Next suggestion",
879
- previous: "Previous suggestion",
880
- inserted: "Inserted by {name}",
881
- deleted: "Deleted by {name}",
882
- toolbar: "Suggestion",
883
- guest: "Guest",
884
- none: "No suggestions"
885
- },
886
- ru: {
887
- toggle: "\u041F\u0440\u0435\u0434\u043B\u0430\u0433\u0430\u0442\u044C \u043F\u0440\u0430\u0432\u043A\u0438",
888
- review: "\u041F\u0440\u0430\u0432\u043A\u0438",
889
- accept: "\u041F\u0440\u0438\u043D\u044F\u0442\u044C",
890
- reject: "\u041E\u0442\u043A\u043B\u043E\u043D\u0438\u0442\u044C",
891
- acceptAll: "\u041F\u0440\u0438\u043D\u044F\u0442\u044C \u0432\u0441\u0435 \u043F\u0440\u0430\u0432\u043A\u0438",
892
- rejectAll: "\u041E\u0442\u043A\u043B\u043E\u043D\u0438\u0442\u044C \u0432\u0441\u0435 \u043F\u0440\u0430\u0432\u043A\u0438",
893
- next: "\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0430\u044F \u043F\u0440\u0430\u0432\u043A\u0430",
894
- previous: "\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0430\u044F \u043F\u0440\u0430\u0432\u043A\u0430",
895
- inserted: "\u0412\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u043E: {name}",
896
- deleted: "\u0423\u0434\u0430\u043B\u0435\u043D\u043E: {name}",
897
- toolbar: "\u041F\u0440\u0430\u0432\u043A\u0430",
898
- guest: "\u0413\u043E\u0441\u0442\u044C",
899
- none: "\u041F\u0440\u0430\u0432\u043E\u043A \u043D\u0435\u0442"
246
+ stopEvent(event) {
247
+ if (this.options.stopEvent) return this.options.stopEvent(event);
248
+ const target = event.target;
249
+ if (!(target instanceof Element) || this.contentDOM?.contains(target)) return false;
250
+ if (event.type.startsWith("drag") || event.type === "drop") return false;
251
+ const control = target.closest(CONTROLS);
252
+ return !!control && this.dom.contains(control);
900
253
  }
901
- };
902
- var ICON_TOGGLE = icons.suggest;
903
- var ICON_REVIEW = icons.review;
904
- var ICON_ACCEPT = icons.check;
905
- var ICON_REJECT = icons.close;
906
- var suggestionsKey = new PluginKey2("nova-suggestions");
907
- var OWN = "nova-suggestions-own";
908
- var PALETTE = ["#1a7f37", "#8250df", "#bf3989", "#0969da", "#bc4c00", "#1b7c83"];
909
- function colorFor(key) {
910
- let hash = 0;
911
- for (const ch of key) hash = hash * 31 + ch.charCodeAt(0) | 0;
912
- return PALETTE[Math.abs(hash) % PALETTE.length];
913
- }
914
- function newId() {
915
- const bytes = new Uint8Array(9);
916
- globalThis.crypto.getRandomValues(bytes);
917
- return "s" + Array.from(bytes, (b) => (b % 36).toString(36)).join("");
918
- }
919
- function markSpec(kind) {
920
- const tag = kind === "insert" ? "ins" : "del";
921
- return {
922
- attrs: { id: {}, author: { default: "" }, name: { default: "" }, time: { default: 0 } },
923
- inclusive: false,
924
- excludes: "",
925
- parseDOM: [
926
- {
927
- tag: `${tag}[data-suggestion]`,
928
- // Раньше правила зачёркивания (<del> без data-suggestion — обычное зачёркивание).
929
- priority: 60,
930
- getAttrs: (dom) => {
931
- const el = dom;
932
- const id = el.getAttribute("data-suggestion") ?? "";
933
- if (!ID_RE2.test(id)) return false;
934
- const author = el.getAttribute("data-author") ?? "";
935
- return {
936
- id,
937
- author: USER_ID_RE.test(author) ? author : "",
938
- name: (el.getAttribute("data-name") ?? "").slice(0, 80),
939
- time: Number(el.getAttribute("data-time")) || 0
940
- };
941
- }
942
- }
943
- ],
944
- toDOM: (mark) => [
945
- tag,
946
- {
947
- "data-suggestion": ID_RE2.test(mark.attrs.id) ? mark.attrs.id : null,
948
- "data-author": USER_ID_RE.test(mark.attrs.author) ? mark.attrs.author : null,
949
- "data-name": String(mark.attrs.name ?? "").slice(0, 80) || null,
950
- "data-time": Number(mark.attrs.time) || null
951
- },
952
- 0
953
- ]
954
- };
955
- }
956
- var typesOf = (schema2) => ({
957
- insert: schema2.marks.suggestion_insert,
958
- delete: schema2.marks.suggestion_delete
959
- });
960
- function isTracked(tr) {
961
- if (!tr.docChanged || tr.getMeta(OWN)) return false;
962
- if (tr.getMeta("addToHistory") === false) return false;
963
- if (tr.getMeta("history$")) return false;
964
- const ySync = tr.getMeta("y-sync$");
965
- if (ySync?.isChangeOrigin) return false;
966
- return tr.steps.every((step) => step instanceof ReplaceStep);
967
- }
968
- function neighbourMark(doc, pos, type, authorId) {
969
- const $pos = doc.resolve(pos);
970
- for (const node of [$pos.nodeBefore, $pos.nodeAfter]) {
971
- const mark = node?.marks.find((m) => m.type === type && m.attrs.author === authorId);
972
- if (mark) return mark;
254
+ ignoreMutation(mutation) {
255
+ if (!this.contentDOM) return true;
256
+ if (mutation.target === this.contentDOM && mutation.type === "attributes") return true;
257
+ return !this.contentDOM.contains(mutation.target);
973
258
  }
974
- return null;
975
- }
976
- function withMark(fragment, mark, parent) {
977
- const nodes = [];
978
- fragment.forEach((node) => {
979
- if (node.isInline) {
980
- nodes.push(
981
- parent && !parent.allowsMarkType(mark.type) ? node : node.mark(mark.addToSet(node.marks))
982
- );
983
- } else {
984
- nodes.push(node.copy(withMark(node.content, mark, node.type)));
985
- }
986
- });
987
- return Fragment.from(nodes);
988
- }
989
- function suggestTransaction(tr, state, author) {
990
- if (!isTracked(tr)) return tr;
991
- const types = typesOf(state.schema);
992
- const out = state.tr;
993
- const time = Date.now();
994
- let toOut = (pos) => pos;
995
- let forwardDeleteEnd = null;
996
- let insertEnd = null;
997
- tr.steps.forEach((rawStep) => {
998
- const step = rawStep;
999
- const outStart = out.steps.length;
1000
- const prev = toOut;
1001
- let from = prev(step.from);
1002
- let to = Math.max(from, prev(step.to));
1003
- if (to > from) {
1004
- const own = [];
1005
- const plain = [];
1006
- out.doc.nodesBetween(from, to, (node, pos) => {
1007
- if (!node.isInline) return true;
1008
- const start = Math.max(pos, from);
1009
- const end = Math.min(pos + node.nodeSize, to);
1010
- if (start >= end) return false;
1011
- const mine = node.marks.some(
1012
- (m) => m.type === types.insert && m.attrs.author === author.id
1013
- );
1014
- if (mine) own.push({ from: start, to: end });
1015
- else if (!types.delete.isInSet(node.marks)) plain.push({ from: start, to: end });
1016
- return false;
1017
- });
1018
- if (plain.length) {
1019
- const first = plain[0];
1020
- const mark = neighbourMark(out.doc, first.from, types.delete, author.id) ?? neighbourMark(out.doc, plain[plain.length - 1].to, types.delete, author.id) ?? types.delete.create({ id: newId(), author: author.id, name: author.name, time });
1021
- for (const range of plain) out.addMark(range.from, range.to, mark);
1022
- }
1023
- for (const range of own.reverse()) out.delete(range.from, range.to);
1024
- const map = out.mapping.slice(outStart);
1025
- from = map.map(from, 1);
1026
- to = map.map(to, -1);
1027
- const sel = state.selection;
1028
- if (tr.steps.length === 1 && step.slice.size === 0 && sel.empty && sel.from === step.from && tr.selection.head === step.from) {
1029
- forwardDeleteEnd = to;
1030
- }
1031
- }
1032
- if (step.slice.size > 0) {
1033
- let at = to;
1034
- if (!step.slice.openStart) {
1035
- for (let next = out.doc.resolve(at).nodeAfter; next && types.delete.isInSet(next.marks); ) {
1036
- at += next.nodeSize;
1037
- next = out.doc.resolve(at).nodeAfter;
1038
- }
1039
- }
1040
- const mark = neighbourMark(out.doc, at, types.insert, author.id) ?? types.insert.create({ id: newId(), author: author.id, name: author.name, time });
1041
- const $at = out.doc.resolve(at);
1042
- const content = withMark(
1043
- step.slice.content,
1044
- mark,
1045
- step.slice.openStart ? null : $at.parent.type
1046
- );
1047
- out.replace(at, at, new Slice(content, step.slice.openStart, step.slice.openEnd));
1048
- if (tr.steps.length === 1) insertEnd = at + step.slice.size;
1049
- }
1050
- const inverse = step.getMap().invert();
1051
- const outMap = out.mapping.slice(outStart);
1052
- toOut = (pos) => outMap.map(prev(inverse.map(pos, -1)), 1);
1053
- });
1054
- if (forwardDeleteEnd !== null) {
1055
- out.setSelection(TextSelection.create(out.doc, forwardDeleteEnd));
1056
- } else if (insertEnd !== null && tr.selection.empty) {
1057
- out.setSelection(TextSelection.create(out.doc, insertEnd));
1058
- } else {
1059
- const anchor = toOut(tr.selection.anchor);
1060
- const head = toOut(tr.selection.head);
259
+ destroy() {
1061
260
  try {
1062
- out.setSelection(TextSelection.create(out.doc, anchor, head));
1063
- } catch {
1064
- }
1065
- }
1066
- for (const key of ["addToHistory", "uiEvent", "paste", "scrollIntoView"]) {
1067
- const value = tr.getMeta(key);
1068
- if (value !== void 0) out.setMeta(key, value);
1069
- }
1070
- if (tr.scrolledIntoView) out.scrollIntoView();
1071
- return out;
1072
- }
1073
- function listSuggestions(doc) {
1074
- const types = typesOf(doc.type.schema);
1075
- const result = [];
1076
- doc.descendants((node, pos) => {
1077
- if (!node.isInline) return true;
1078
- for (const mark of node.marks) {
1079
- const kind = mark.type === types.insert ? "insert" : mark.type === types.delete ? "delete" : null;
1080
- if (!kind) continue;
1081
- const last = result[result.length - 1];
1082
- const text = node.isText ? node.text : "";
1083
- if (last && last.id === mark.attrs.id && last.kind === kind && last.to === pos) {
1084
- last.to = pos + node.nodeSize;
1085
- last.text += text;
1086
- } else {
1087
- result.push({
1088
- id: mark.attrs.id,
1089
- kind,
1090
- author: { id: mark.attrs.author, name: mark.attrs.name },
1091
- time: Number(mark.attrs.time) || 0,
1092
- from: pos,
1093
- to: pos + node.nodeSize,
1094
- text
1095
- });
1096
- }
1097
- }
1098
- return false;
1099
- });
1100
- return result;
1101
- }
1102
- function resolveSuggestions(state, action, ids) {
1103
- const types = typesOf(state.schema);
1104
- const tr = state.tr.setMeta(OWN, true);
1105
- const chosen = listSuggestions(state.doc).filter((s) => !ids || ids.includes(s.id));
1106
- for (const s of [...chosen].sort((a, b) => b.from - a.from)) {
1107
- const remove = s.kind === "insert" === (action === "reject");
1108
- if (remove) tr.delete(s.from, s.to);
1109
- else tr.removeMark(s.from, s.to, s.kind === "insert" ? types.insert : types.delete);
1110
- }
1111
- return tr;
1112
- }
1113
- function suggestionsResult(editor, action) {
1114
- return resolveSuggestions(editor.view.state, action).doc;
1115
- }
1116
- function suggestionAt(state) {
1117
- const { from } = state.selection;
1118
- return listSuggestions(state.doc).find(
1119
- (s) => from >= s.from && from <= s.to && (s.to > from || s.from < from)
1120
- ) ?? null;
1121
- }
1122
- function isSuggesting(state) {
1123
- return suggestionsKey.getState(state)?.enabled ?? false;
1124
- }
1125
- function setSuggesting(editor, enabled) {
1126
- const { state, dispatch } = editor.view;
1127
- dispatch(state.tr.setMeta(suggestionsKey, { enabled }).setMeta(OWN, true));
1128
- editor.updateUI();
1129
- }
1130
- var suggestions_default = definePlugin({
1131
- name: "suggestions",
1132
- toolbar: "suggestions reviewsuggestions",
1133
- marks: {
1134
- suggestion_insert: markSpec("insert"),
1135
- suggestion_delete: markSpec("delete")
1136
- },
1137
- prosemirrorPlugins: (editor) => {
1138
- const options = editor.options.pluginOptions?.suggestions ?? {};
1139
- let cache = null;
1140
- return [
1141
- new Plugin2({
1142
- key: suggestionsKey,
1143
- state: {
1144
- init: () => ({ enabled: !!(options.enabled || options.force) }),
1145
- apply(tr, value) {
1146
- const meta = tr.getMeta(suggestionsKey);
1147
- if (!meta) return value;
1148
- return { enabled: options.force ? true : meta.enabled };
1149
- }
1150
- },
1151
- props: {
1152
- attributes: (state) => suggestionsKey.getState(state)?.enabled ? { class: "nova-suggesting" } : {},
1153
- decorations(state) {
1154
- if (cache?.doc === state.doc) return cache.set;
1155
- const labels = pickLabels(editor, LABELS5);
1156
- const time = new Intl.DateTimeFormat(editor.options.language ?? "en", {
1157
- dateStyle: "medium",
1158
- timeStyle: "short"
1159
- });
1160
- const set = DecorationSet2.create(
1161
- state.doc,
1162
- listSuggestions(state.doc).map(
1163
- (s) => Decoration2.inline(s.from, s.to, {
1164
- title: (s.kind === "insert" ? labels.inserted : labels.deleted).replace(
1165
- "{name}",
1166
- s.author.name || labels.guest
1167
- ) + (s.time ? ` \xB7 ${time.format(s.time)}` : ""),
1168
- class: s.kind === "insert" ? "nova-sugg-insert" : "nova-sugg-delete",
1169
- style: `--nova-suggestion: ${colorFor(s.author.id || s.author.name)}`
1170
- })
1171
- )
1172
- );
1173
- cache = { doc: state.doc, set };
1174
- return set;
1175
- }
1176
- }
1177
- }),
1178
- keymap2({
1179
- // Ctrl/Cmd+Alt+Shift+E — переключить режим правок.
1180
- "Mod-Alt-Shift-e": () => {
1181
- if (options.force) return false;
1182
- setSuggesting(editor, !isSuggesting(editor.view.state));
1183
- return true;
1184
- }
1185
- })
1186
- ];
1187
- },
1188
- transformTransaction(tr, state, editor) {
1189
- if (!isSuggesting(state)) return tr;
1190
- const options = editor.options.pluginOptions?.suggestions ?? {};
1191
- const labels = pickLabels(editor, LABELS5);
1192
- const author = {
1193
- id: USER_ID_RE.test(options.author?.id ?? "") ? options.author.id : "guest",
1194
- name: String(options.author?.name || labels.guest).slice(0, 80)
1195
- };
1196
- return suggestTransaction(tr, state, author);
1197
- },
1198
- setup(editor) {
1199
- const options = editor.options.pluginOptions?.suggestions ?? {};
1200
- const labels = pickLabels(editor, LABELS5);
1201
- const canReview = options.canReview !== false;
1202
- const dispatch = (tr) => editor.view.dispatch(tr);
1203
- const current = () => suggestionAt(editor.view.state);
1204
- const resolveCurrent = (action) => {
1205
- const s = current();
1206
- if (s) dispatch(resolveSuggestions(editor.view.state, action, [s.id]));
1207
- editor.focus();
1208
- };
1209
- const go = (direction) => {
1210
- const { state } = editor.view;
1211
- const list = listSuggestions(state.doc);
1212
- const pos = state.selection.from;
1213
- const target = direction === 1 ? list.find((s) => s.from > pos) ?? list[0] : [...list].reverse().find((s) => s.to < pos) ?? list[list.length - 1];
1214
- if (!target) {
1215
- editor.ui.notify(labels.none);
1216
- return;
1217
- }
1218
- dispatch(
1219
- state.tr.setSelection(TextSelection.create(state.doc, target.from)).scrollIntoView()
1220
- );
1221
- editor.focus();
1222
- };
1223
- const hasAny = () => listSuggestions(editor.view.state.doc).length > 0;
1224
- editor.ui.registry.addToggleButton("suggestions", {
1225
- icon: ICON_TOGGLE,
1226
- tooltip: labels.toggle,
1227
- shortcut: "Mod-Alt-Shift-e",
1228
- isActive: (e) => isSuggesting(e.view.state),
1229
- isEnabled: () => !options.force,
1230
- onAction: (e) => setSuggesting(e, !isSuggesting(e.view.state))
1231
- });
1232
- editor.ui.registry.addMenuButton("reviewsuggestions", {
1233
- icon: ICON_REVIEW,
1234
- tooltip: labels.review,
1235
- isEnabled: hasAny,
1236
- items: () => [
1237
- { id: "next", label: labels.next, onSelect: () => go(1) },
1238
- { id: "previous", label: labels.previous, onSelect: () => go(-1) },
1239
- ...canReview ? [
1240
- { type: "separator" },
1241
- {
1242
- id: "accept-all",
1243
- label: labels.acceptAll,
1244
- onSelect: () => dispatch(resolveSuggestions(editor.view.state, "accept"))
1245
- },
1246
- {
1247
- id: "reject-all",
1248
- label: labels.rejectAll,
1249
- onSelect: () => dispatch(resolveSuggestions(editor.view.state, "reject"))
1250
- }
1251
- ] : []
1252
- ]
1253
- });
1254
- if (canReview) {
1255
- editor.ui.registry.addButton("acceptsuggestion", {
1256
- icon: ICON_ACCEPT,
1257
- text: labels.accept,
1258
- tooltip: labels.accept,
1259
- onAction: () => resolveCurrent("accept")
1260
- });
1261
- editor.ui.registry.addButton("rejectsuggestion", {
1262
- icon: ICON_REJECT,
1263
- text: labels.reject,
1264
- tooltip: labels.reject,
1265
- onAction: () => resolveCurrent("reject")
1266
- });
1267
- editor.ui.registry.addContextToolbar("suggestion", {
1268
- label: labels.toolbar,
1269
- predicate: (e) => suggestionAt(e.view.state) !== null,
1270
- items: "acceptsuggestion rejectsuggestion",
1271
- position: "selection",
1272
- placement: "bottom-start",
1273
- priority: 20
1274
- });
261
+ this.renderer?.destroy();
262
+ } catch (error) {
263
+ report(`Node view for "${this.node.type.name}" failed to clean up`, error);
1275
264
  }
1276
- editor.ui.registry.addMenuItem("suggestions", {
1277
- text: labels.toggle,
1278
- icon: ICON_TOGGLE,
1279
- isActive: (e) => isSuggesting(e.view.state),
1280
- isEnabled: () => !options.force,
1281
- onAction: (e) => setSuggesting(e, !isSuggesting(e.view.state))
1282
- });
1283
- }
1284
- });
1285
-
1286
- // src/plugins/media.ts
1287
- import { NodeSelection as NodeSelection2, Plugin as Plugin3 } from "prosemirror-state";
1288
- var YOUTUBE = /^https?:\/\/(?:www\.|m\.)?(?:youtube(?:-nocookie)?\.com\/(?:watch\?(?:[^#]*&)?v=|embed\/|shorts\/|live\/)|youtu\.be\/)([\w-]{11})(?:[?&#]|$)/i;
1289
- var VIMEO = /^https?:\/\/(?:www\.|player\.)?vimeo\.com\/(?:video\/)?(\d{1,12})(?:[/?#]|$)/i;
1290
- var VIDEO_FILE = /^https:\/\/[^\s"'<>]+\.(?:mp4|webm|ogv|ogg)(?:\?[^\s"'<>#]*)?$/i;
1291
- function parseMediaUrl(url) {
1292
- const value = url.trim();
1293
- const youtube = value.match(YOUTUBE);
1294
- if (youtube)
1295
- return { kind: "youtube", src: `https://www.youtube-nocookie.com/embed/${youtube[1]}` };
1296
- const vimeo = value.match(VIMEO);
1297
- if (vimeo) return { kind: "vimeo", src: `https://player.vimeo.com/video/${vimeo[1]}` };
1298
- if (VIDEO_FILE.test(value)) return { kind: "video", src: value };
1299
- return null;
1300
- }
1301
- var ICON2 = icons.media;
1302
- var LABELS6 = {
1303
- en: {
1304
- title: "Video",
1305
- url: "Video URL",
1306
- hint: "YouTube, Vimeo or a link to an .mp4 / .webm file",
1307
- name: "Title (for screen readers)",
1308
- invalid: "This video address is not supported",
1309
- save: "Insert"
1310
- },
1311
- ru: {
1312
- title: "\u0412\u0438\u0434\u0435\u043E",
1313
- url: "\u0410\u0434\u0440\u0435\u0441 \u0432\u0438\u0434\u0435\u043E",
1314
- hint: "YouTube, Vimeo \u0438\u043B\u0438 \u0441\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u0444\u0430\u0439\u043B .mp4 / .webm",
1315
- name: "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 (\u0434\u043B\u044F \u044D\u043A\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0434\u0438\u043A\u0442\u043E\u0440\u0430)",
1316
- invalid: "\u042D\u0442\u043E\u0442 \u0430\u0434\u0440\u0435\u0441 \u0432\u0438\u0434\u0435\u043E \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F",
1317
- save: "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C"
1318
265
  }
1319
266
  };
1320
- function mediaAttrs(dom, src) {
1321
- const source = src ? parseMediaUrl(src) : null;
1322
- if (!source) return false;
1323
- return {
1324
- ...source,
1325
- width: imageSize(dom.getAttribute("width")) ?? 560,
1326
- height: imageSize(dom.getAttribute("height")) ?? 315,
1327
- title: dom.getAttribute("title") ?? ""
1328
- };
267
+ function defineNodeView(create, options = {}) {
268
+ return (editor) => (node, view, getPos) => new RenderedNodeView(node, view, getPos, editor, create, options);
1329
269
  }
1330
- function renderMedia(node) {
1331
- const source = parseMediaUrl(node.attrs.src);
1332
- if (!source) return null;
1333
- const width = String(imageSize(node.attrs.width) ?? 560);
1334
- const height = String(imageSize(node.attrs.height) ?? 315);
1335
- if (source.kind === "video") {
1336
- return h("video", { src: source.src, controls: true, width, height, preload: "metadata" });
1337
- }
1338
- return h("iframe", {
1339
- src: source.src,
1340
- width,
1341
- height,
1342
- title: node.attrs.title || "Video",
1343
- allow: "accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen",
1344
- allowfullscreen: true,
1345
- loading: "lazy",
1346
- referrerpolicy: "strict-origin-when-cross-origin"
1347
- });
1348
- }
1349
- var media_default = definePlugin({
1350
- name: "media",
1351
- toolbar: "media",
1352
- nodes: {
1353
- media: {
1354
- group: "block",
1355
- atom: true,
1356
- selectable: true,
1357
- draggable: true,
1358
- attrs: {
1359
- kind: { default: "youtube" },
1360
- src: {},
1361
- width: { default: 560 },
1362
- height: { default: 315 },
1363
- title: { default: "" }
1364
- },
1365
- parseDOM: [
1366
- {
1367
- tag: "iframe[src]",
1368
- getAttrs: (dom) => mediaAttrs(dom, dom.getAttribute("src"))
1369
- },
1370
- {
1371
- tag: "video",
1372
- getAttrs: (dom) => {
1373
- const el = dom;
1374
- const src = el.getAttribute("src") ?? el.querySelector("source[src]")?.getAttribute("src") ?? null;
1375
- return mediaAttrs(el, src);
1376
- }
1377
- }
1378
- ],
1379
- toDOM: (node) => {
1380
- const source = parseMediaUrl(node.attrs.src);
1381
- const width = String(imageSize(node.attrs.width) ?? 560);
1382
- const height = String(imageSize(node.attrs.height) ?? 315);
1383
- if (!source) return ["p"];
1384
- if (source.kind === "video")
1385
- return ["video", { src: source.src, controls: "", width, height }];
1386
- return [
1387
- "iframe",
1388
- {
1389
- src: source.src,
1390
- width,
1391
- height,
1392
- title: node.attrs.title || null,
1393
- allow: "accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen",
1394
- allowfullscreen: "",
1395
- loading: "lazy",
1396
- referrerpolicy: "strict-origin-when-cross-origin"
1397
- }
1398
- ];
1399
- }
1400
- }
1401
- },
1402
- prosemirrorPlugins: () => [
1403
- new Plugin3({
1404
- props: {
1405
- nodeViews: {
1406
- // В редакторе плеер закрыт прозрачным слоем: клик выделяет блок, а не запускает видео.
1407
- media: (node) => {
1408
- const player = renderMedia(node);
1409
- const dom = h(
1410
- "div",
1411
- { className: "nova-media", contenteditable: "false" },
1412
- player,
1413
- h("div", { className: "nova-media-overlay", "aria-hidden": "true" })
1414
- );
1415
- return { dom, ignoreMutation: () => true, stopEvent: () => false };
1416
- }
1417
- }
1418
- }
1419
- })
1420
- ],
1421
- setup(editor) {
1422
- const labels = pickLabels(editor, LABELS6);
1423
- const selected = () => {
1424
- const { selection } = editor.view.state;
1425
- return selection instanceof NodeSelection2 && selection.node.type.name === "media" ? selection : null;
1426
- };
1427
- const open = () => {
1428
- const current = selected();
1429
- const url = textField({
1430
- label: labels.url,
1431
- type: "url",
1432
- placeholder: "https://",
1433
- hint: labels.hint,
1434
- value: current?.node.attrs.src ?? ""
1435
- });
1436
- const title = textField({
1437
- label: labels.name,
1438
- value: current?.node.attrs.title ?? ""
1439
- });
1440
- attachFilePicker(editor, url, "media", (picked) => {
1441
- if (picked.title) title.input.value = picked.title;
1442
- });
1443
- editor.ui.openDialog({
1444
- title: labels.title,
1445
- body: h("div", { className: "nova-form" }, url.el, title.el),
1446
- submitLabel: labels.save,
1447
- onSubmit: () => {
1448
- const source = parseMediaUrl(url.input.value);
1449
- if (!source) return labels.invalid;
1450
- const { state, dispatch } = editor.view;
1451
- const attrs = { ...source, title: title.input.value.trim() };
1452
- const sel = selected();
1453
- if (sel)
1454
- dispatch(state.tr.setNodeMarkup(sel.from, void 0, { ...sel.node.attrs, ...attrs }));
1455
- else
1456
- dispatch(
1457
- state.tr.replaceSelectionWith(editor.schema.nodes.media.create(attrs)).scrollIntoView()
1458
- );
1459
- return true;
1460
- }
1461
- });
1462
- };
1463
- editor.ui.registry.addToggleButton("media", {
1464
- icon: ICON2,
1465
- tooltip: labels.title,
1466
- isActive: () => selected() !== null,
1467
- isEnabled: (e) => e.isEditable(),
1468
- onAction: open
1469
- });
1470
- editor.ui.registry.addMenuItem("media", { text: labels.title, icon: ICON2, onAction: open });
1471
- }
1472
- });
1473
-
1474
- // src/plugins/pagebreak.ts
1475
- var ICON3 = icons.pageBreak;
1476
- var LABELS7 = { en: { title: "Page break" }, ru: { title: "\u0420\u0430\u0437\u0440\u044B\u0432 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B" } };
1477
- var pagebreak_default = definePlugin({
1478
- name: "pagebreak",
1479
- toolbar: "pagebreak",
1480
- nodes: {
1481
- pagebreak: {
1482
- group: "block",
1483
- atom: true,
1484
- selectable: true,
1485
- parseDOM: [
1486
- { tag: "div.nova-pagebreak" },
1487
- // Разрыв из других редакторов и Word: пустой блок с page-break-after / break-after.
1488
- {
1489
- tag: "div",
1490
- getAttrs: (dom) => {
1491
- const el = dom;
1492
- const breaks = el.style.breakAfter === "page" || el.style.pageBreakAfter === "always";
1493
- return breaks && !el.textContent?.trim() ? null : false;
1494
- }
1495
- }
1496
- ],
1497
- toDOM: () => ["div", { class: "nova-pagebreak", style: "break-after: page;" }]
1498
- }
1499
- },
1500
- setup(editor) {
1501
- const { title } = pickLabels(editor, LABELS7);
1502
- const insert = () => {
1503
- const { state, dispatch } = editor.view;
1504
- const type = editor.schema.nodes.pagebreak;
1505
- dispatch(state.tr.replaceSelectionWith(type.create()).scrollIntoView());
1506
- editor.focus();
1507
- };
1508
- editor.ui.registry.addButton("pagebreak", {
1509
- icon: ICON3,
1510
- tooltip: title,
1511
- isEnabled: (e) => e.isEditable(),
1512
- onAction: insert
1513
- });
1514
- editor.ui.registry.addMenuItem("pagebreak", { text: title, icon: ICON3, onAction: insert });
1515
- }
1516
- });
1517
-
1518
- // src/plugins/index.ts
1519
- registerPlugin("insertdatetime", () => import("./insertdatetime-T4SEMQWP.js"));
1520
- registerPlugin("quickbars", () => import("./quickbars-4NU4SIPL.js"));
1521
- registerPlugin("charmap", () => import("./charmap-ADLYOIB3.js"));
1522
- registerPlugin("emoticons", () => import("./emoticons-TP4N4ZGY.js"));
1523
- registerPlugin("nonbreaking", () => import("./nonbreaking-HG5HV6AL.js"));
1524
- registerPlugin("autolink", () => import("./autolink-XWDTLY37.js"));
1525
- registerPlugin("autosave", () => import("./autosave-MWNRUNU3.js"));
1526
- registerPlugin("autoresize", () => import("./autoresize-UB3GOA6D.js"));
1527
- registerPlugin("visualblocks", () => import("./visualblocks-RTAYJOGR.js"));
1528
- registerPlugin("anchor", anchor_default);
1529
- registerPlugin("pagebreak", pagebreak_default);
1530
- registerPlugin("media", media_default);
1531
- registerPlugin("comments", comments_default);
1532
- registerPlugin("mentions", mentions_default);
1533
- registerPlugin("mergetags", mergetags_default);
1534
- registerPlugin("suggestions", suggestions_default);
1535
- registerPlugin("directionality", () => import("./directionality-XOHJFSL6.js"));
1536
- registerPlugin("advlist", () => import("./advlist-K2U3VPH2.js"));
1537
- registerPlugin("revisionhistory", () => import("./revisionhistory-3YQPLPLM.js"));
1538
270
  export {
1539
- ContentRules,
1540
271
  DEFAULT_MENUBAR,
1541
272
  DEFAULT_MENUS,
1542
273
  Editor,
1543
274
  Formatter,
1544
275
  HTMLSerializer,
1545
- KNOWN_STYLES,
1546
- KNOWN_TAGS,
1547
- MENTION_ID_RE,
276
+ PAGE_SIZES,
277
+ REMOTE_CHANGE_META,
1548
278
  applyLink,
1549
279
  clearSearch,
1550
280
  commands,
1551
281
  countWords,
1552
282
  createCommentStore,
1553
283
  createEditor,
284
+ createRenderer,
1554
285
  createSchema,
1555
286
  createTable,
1556
- createTranslator,
1557
- cssValue,
1558
287
  defaultColors,
1559
288
  defaultFontFamilies,
1560
289
  defaultFontSizes,
1561
290
  defaultLineHeights,
1562
291
  defaultSlashCommands,
1563
292
  defaultToolbar,
293
+ defineNodeView,
1564
294
  definePlugin,
1565
295
  en,
1566
296
  findMatches,
@@ -1571,14 +301,15 @@ export {
1571
301
  getLineHeight,
1572
302
  getLinkAt,
1573
303
  getMentions,
304
+ getPluginMessages,
1574
305
  getSearchState,
1575
306
  getSelectedImage,
1576
307
  getStyle,
1577
308
  hasHeaderColumn,
1578
309
  hasHeaderRow,
310
+ hasLanguage,
1579
311
  htmlToPlainText,
1580
312
  icons,
1581
- imageSize,
1582
313
  insertImage,
1583
314
  insertTable,
1584
315
  isCommandActive,
@@ -1591,8 +322,8 @@ export {
1591
322
  isSafeLinkUrl,
1592
323
  isSuggesting,
1593
324
  listSuggestions,
325
+ loadLanguage,
1594
326
  marksOf,
1595
- newCommentId,
1596
327
  nodesOf,
1597
328
  normalizeUrl,
1598
329
  openHelp,
@@ -1601,17 +332,18 @@ export {
1601
332
  openLinkDialog,
1602
333
  openPreview,
1603
334
  openSourceCode,
1604
- parseToolbar,
335
+ pageLayout,
1605
336
  parserFor,
337
+ prettyHTML,
1606
338
  printContent,
1607
- rankSlashCommands,
339
+ registerHtmlRules,
1608
340
  registerLanguage,
1609
341
  registerPlugin,
1610
342
  removeLink,
343
+ renderHTML,
1611
344
  replaceAll,
1612
345
  replaceCurrent,
1613
346
  resolveSuggestions,
1614
- ru,
1615
347
  sanitizeThread,
1616
348
  schema,
1617
349
  setCellBackground,