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