@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
@@ -0,0 +1,893 @@
1
+ import {
2
+ openLinkDialog,
3
+ removeLink
4
+ } from "./chunk-IG2BL4ON.js";
5
+ import {
6
+ getSelectedImage,
7
+ hasImageCaption,
8
+ openImageAltDialog,
9
+ openImageDialog,
10
+ setImageAttrs,
11
+ setImageWidthFraction,
12
+ toggleImageCaption
13
+ } from "./chunk-J6W2CDRF.js";
14
+ import {
15
+ createTableGridPanel,
16
+ hasHeaderColumn,
17
+ hasHeaderRow,
18
+ insertTable,
19
+ setCellBackground,
20
+ sortTable,
21
+ tableCommands,
22
+ tableRect
23
+ } from "./chunk-GHVB6SV4.js";
24
+ import {
25
+ isFullscreen,
26
+ openHelp,
27
+ openPreview,
28
+ openSourceCode,
29
+ toggleFullscreen
30
+ } from "./chunk-23ZLVT5D.js";
31
+ import {
32
+ getActiveAlign,
33
+ getLinkAt,
34
+ isMarkActive,
35
+ isNodeActive,
36
+ marksOf,
37
+ nodesOf
38
+ } from "./chunk-AC3YCAX4.js";
39
+ import {
40
+ cssValue,
41
+ isInTable
42
+ } from "./chunk-TAM2FHKG.js";
43
+ import {
44
+ icons
45
+ } from "./chunk-ADRPQLZ2.js";
46
+ import {
47
+ activeElement,
48
+ h,
49
+ icon,
50
+ logicalKey
51
+ } from "./chunk-QU3KXMYT.js";
52
+
53
+ // src/styles.ts
54
+ var validators = {
55
+ color: cssValue.color,
56
+ background: cssValue.color,
57
+ font_family: cssValue.fontFamily,
58
+ font_size: cssValue.length
59
+ };
60
+ function setStyle(markName, value) {
61
+ return (state, dispatch) => {
62
+ const type = marksOf(state)[markName];
63
+ const valid = value === null ? null : validators[markName](value);
64
+ if (value !== null && !valid) return false;
65
+ const { empty } = state.selection;
66
+ if (!dispatch) return true;
67
+ const tr = state.tr;
68
+ if (empty) {
69
+ tr.removeStoredMark(type);
70
+ if (valid) tr.addStoredMark(type.create({ value: valid }));
71
+ } else {
72
+ for (const range of state.selection.ranges) {
73
+ tr.removeMark(range.$from.pos, range.$to.pos, type);
74
+ if (valid) tr.addMark(range.$from.pos, range.$to.pos, type.create({ value: valid }));
75
+ }
76
+ }
77
+ dispatch(tr.scrollIntoView());
78
+ return true;
79
+ };
80
+ }
81
+ function getStyle(state, markName) {
82
+ const type = marksOf(state)[markName];
83
+ const { $from, empty } = state.selection;
84
+ const marks = empty ? state.storedMarks ?? $from.marks() : $from.nodeAfter?.marks ?? $from.marks();
85
+ const mark = type.isInSet(marks);
86
+ return mark ? mark.attrs.value : null;
87
+ }
88
+ function setLineHeight(value) {
89
+ return (state, dispatch) => {
90
+ const valid = value === null ? null : cssValue.lineHeight(value);
91
+ if (value !== null && !valid) return false;
92
+ const { from, to } = state.selection;
93
+ const tr = state.tr;
94
+ let applicable = false;
95
+ state.doc.nodesBetween(from, to, (node, pos) => {
96
+ if (node.type === nodesOf(state).paragraph || node.type === nodesOf(state).heading) {
97
+ applicable = true;
98
+ tr.setNodeMarkup(pos, void 0, { ...node.attrs, lineHeight: valid });
99
+ }
100
+ });
101
+ if (!applicable) return false;
102
+ dispatch?.(tr);
103
+ return true;
104
+ };
105
+ }
106
+ function getLineHeight(state) {
107
+ return state.selection.$from.parent.attrs.lineHeight ?? null;
108
+ }
109
+
110
+ // src/ui/color-panel.ts
111
+ var defaultColors = [
112
+ "#000000",
113
+ "#434343",
114
+ "#666666",
115
+ "#999999",
116
+ "#b7b7b7",
117
+ "#d9d9d9",
118
+ "#efefef",
119
+ "#ffffff",
120
+ "#b91c1c",
121
+ "#c2410c",
122
+ "#a16207",
123
+ "#15803d",
124
+ "#0e7490",
125
+ "#1d4ed8",
126
+ "#6d28d9",
127
+ "#be185d",
128
+ "#ef4444",
129
+ "#f97316",
130
+ "#eab308",
131
+ "#22c55e",
132
+ "#06b6d4",
133
+ "#3b82f6",
134
+ "#8b5cf6",
135
+ "#ec4899",
136
+ "#fecaca",
137
+ "#fed7aa",
138
+ "#fef08a",
139
+ "#bbf7d0",
140
+ "#a5f3fc",
141
+ "#bfdbfe",
142
+ "#ddd6fe",
143
+ "#fbcfe8"
144
+ ];
145
+ function createColorPanel(options) {
146
+ const COLUMNS = 8;
147
+ const swatches = [];
148
+ const current = options.current?.toLowerCase() ?? null;
149
+ const grid = h("div", { className: "nova-swatches", role: "grid", "aria-label": options.label });
150
+ let row = null;
151
+ for (const color of options.colors) {
152
+ const selected = current === color.toLowerCase();
153
+ const swatch = h(
154
+ "button",
155
+ {
156
+ type: "button",
157
+ className: "nova-swatch",
158
+ role: "gridcell",
159
+ "aria-label": color,
160
+ "aria-selected": String(selected),
161
+ title: color,
162
+ tabindex: "-1"
163
+ },
164
+ selected ? icon(icons.check) : null
165
+ );
166
+ swatch.style.setProperty("--swatch", color);
167
+ swatch.addEventListener("click", () => options.onPick(color));
168
+ swatches.push(swatch);
169
+ if (!row || row.childElementCount === COLUMNS) {
170
+ row = h("div", { className: "nova-swatch-row", role: "row" });
171
+ grid.append(row);
172
+ }
173
+ row.append(swatch);
174
+ }
175
+ (swatches.find((s) => s.getAttribute("aria-selected") === "true") ?? swatches[0])?.setAttribute(
176
+ "tabindex",
177
+ "0"
178
+ );
179
+ grid.addEventListener("keydown", (event) => {
180
+ const index = swatches.indexOf(activeElement(grid));
181
+ if (index < 0) return;
182
+ const delta = {
183
+ ArrowRight: 1,
184
+ ArrowLeft: -1,
185
+ ArrowDown: COLUMNS,
186
+ ArrowUp: -COLUMNS
187
+ };
188
+ const step = delta[logicalKey(event, grid)];
189
+ if (step === void 0) return;
190
+ event.preventDefault();
191
+ const next = swatches[Math.min(swatches.length - 1, Math.max(0, index + step))];
192
+ swatches[index].tabIndex = -1;
193
+ next.tabIndex = 0;
194
+ next.focus();
195
+ });
196
+ const remove = h(
197
+ "button",
198
+ { type: "button", className: "nova-panel-action" },
199
+ icon(icons.clearFormatting),
200
+ options.removeLabel
201
+ );
202
+ remove.addEventListener("click", () => options.onPick(null));
203
+ const custom = h("input", {
204
+ type: "color",
205
+ className: "nova-color-input",
206
+ "aria-label": options.customLabel,
207
+ value: /^#[0-9a-f]{6}$/i.test(current ?? "") ? current : "#000000"
208
+ });
209
+ custom.addEventListener("change", () => options.onPick(custom.value));
210
+ return h(
211
+ "div",
212
+ { className: "nova-color-panel" },
213
+ grid,
214
+ h(
215
+ "div",
216
+ { className: "nova-panel-footer" },
217
+ remove,
218
+ h("label", { className: "nova-panel-action" }, custom, options.customLabel)
219
+ )
220
+ );
221
+ }
222
+
223
+ // src/ui/table-ui.ts
224
+ function registerTableUi(editor) {
225
+ const { registry, t } = editor.ui;
226
+ const sizeLabel = (rows, cols) => t("table.size", { rows, cols });
227
+ registry.addPanelButton("table", {
228
+ icon: icons.table,
229
+ tooltip: t("table.insert"),
230
+ isEnabled: (e) => e.can(insertTable(1, 1)),
231
+ render: (e, close) => createTableGridPanel(
232
+ (rows, cols) => {
233
+ close();
234
+ e.exec(insertTable(rows, cols));
235
+ },
236
+ sizeLabel,
237
+ t("table.insert")
238
+ )
239
+ });
240
+ const button = (name, label, svg, command, isActive) => registry.addButton(name, {
241
+ icon: svg,
242
+ tooltip: t(label),
243
+ onAction: (e) => e.exec(command),
244
+ isEnabled: (e) => e.can(command),
245
+ ...isActive ? { isActive } : {}
246
+ });
247
+ button("tableinsertrowbefore", "table.rowBefore", icons.rowBefore, tableCommands.addRowBefore);
248
+ button("tableinsertrowafter", "table.rowAfter", icons.rowAfter, tableCommands.addRowAfter);
249
+ button("tabledeleterow", "table.rowDelete", icons.rowDelete, tableCommands.deleteRow);
250
+ button("tableinsertcolbefore", "table.colBefore", icons.colBefore, tableCommands.addColumnBefore);
251
+ button("tableinsertcolafter", "table.colAfter", icons.colAfter, tableCommands.addColumnAfter);
252
+ button("tabledeletecol", "table.colDelete", icons.colDelete, tableCommands.deleteColumn);
253
+ button("tablemergecells", "table.merge", icons.merge, tableCommands.mergeCells);
254
+ button("tablesplitcells", "table.split", icons.split, tableCommands.splitCell);
255
+ button(
256
+ "tablerowheader",
257
+ "table.rowHeader",
258
+ icons.rowHeader,
259
+ tableCommands.toggleHeaderRow,
260
+ (e) => hasHeaderRow(e.view.state)
261
+ );
262
+ button(
263
+ "tablecolheader",
264
+ "table.colHeader",
265
+ icons.colHeader,
266
+ tableCommands.toggleHeaderColumn,
267
+ (e) => hasHeaderColumn(e.view.state)
268
+ );
269
+ button("tabledelete", "table.delete", icons.tableDelete, tableCommands.deleteTable);
270
+ registry.addPanelButton("tablecellbackground", {
271
+ icon: icons.highlight,
272
+ tooltip: t("table.cellBackground"),
273
+ isEnabled: (e) => isInTable(e.view.state),
274
+ render: (e, close) => createColorPanel({
275
+ colors: e.options.colors ?? defaultColors,
276
+ current: null,
277
+ label: t("table.cellBackground"),
278
+ removeLabel: t("removeColor"),
279
+ customLabel: t("customColor"),
280
+ onPick: (color) => {
281
+ close();
282
+ e.exec(setCellBackground(color));
283
+ }
284
+ })
285
+ });
286
+ registry.addMenuButton("advtablesort", {
287
+ icon: icons.sort,
288
+ tooltip: t("table.sort"),
289
+ isEnabled: (e) => e.can(sortTable("asc")),
290
+ items: (e) => {
291
+ const quick = ["asc", "desc"].map((direction) => ({
292
+ id: direction,
293
+ label: t(direction === "asc" ? "table.sortAsc" : "table.sortDesc"),
294
+ onSelect: () => e.exec(sortTable(direction, e.options.language))
295
+ }));
296
+ const advanced = e.ui.registry.getMenuItem("advtablesort");
297
+ return advanced ? [...quick, { id: "advanced", label: advanced.text, onSelect: () => advanced.onAction(e) }] : quick;
298
+ }
299
+ });
300
+ registry.addButton("tableprops", {
301
+ icon: icons.tableProps,
302
+ tooltip: t("table.props"),
303
+ isEnabled: (e) => isInTable(e.view.state),
304
+ // The dialogs are a lazy part: loaded on first open.
305
+ onAction: (e) => void import("./table-dialogs-UMIIZQYE.js").then((m) => m.openTableProps(e))
306
+ });
307
+ registry.addButton("tablecellprops", {
308
+ icon: icons.cellProps,
309
+ tooltip: t("table.cellProps"),
310
+ isEnabled: (e) => isInTable(e.view.state),
311
+ onAction: (e) => void import("./table-dialogs-UMIIZQYE.js").then((m) => m.openCellProps(e))
312
+ });
313
+ registry.addContextToolbar("table", {
314
+ label: t("table.toolbar"),
315
+ predicate: (e) => isInTable(e.view.state),
316
+ anchor: (e) => tableRect(e),
317
+ placement: "bottom-start",
318
+ items: "tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol | tablemergecells tablesplitcells | tablerowheader tablecolheader tablecellbackground | advtablesort advtablerownumbering tablecellprops tableprops | tabledelete"
319
+ });
320
+ }
321
+
322
+ // src/ui/builtins.ts
323
+ var defaultFontFamilies = [
324
+ { label: "Sans Serif", value: 'system-ui, -apple-system, "Segoe UI", Roboto, sans-serif' },
325
+ { label: "Serif", value: 'Georgia, "Times New Roman", serif' },
326
+ { label: "Monospace", value: "ui-monospace, Menlo, Consolas, monospace" },
327
+ { label: "Arial", value: "Arial, Helvetica, sans-serif" },
328
+ { label: "Georgia", value: "Georgia, serif" },
329
+ { label: "Times New Roman", value: '"Times New Roman", Times, serif' },
330
+ { label: "Verdana", value: "Verdana, Geneva, sans-serif" },
331
+ { label: "Courier New", value: '"Courier New", Courier, monospace' }
332
+ ];
333
+ var defaultFontSizes = [
334
+ "8pt",
335
+ "10pt",
336
+ "12pt",
337
+ "14pt",
338
+ "16pt",
339
+ "18pt",
340
+ "24pt",
341
+ "36pt",
342
+ "48pt"
343
+ ];
344
+ var defaultLineHeights = ["1", "1.15", "1.5", "2", "2.5", "3"];
345
+ var SHORTCUTS = {
346
+ undo: "Mod-z",
347
+ redo: "Mod-Shift-z",
348
+ bold: "Mod-b",
349
+ italic: "Mod-i",
350
+ underline: "Mod-u",
351
+ strike: "Mod-Shift-x",
352
+ code: "Mod-e",
353
+ subscript: "Mod-,",
354
+ superscript: "Mod-.",
355
+ bulletList: "Mod-Shift-8",
356
+ orderedList: "Mod-Shift-7",
357
+ alignLeft: "Mod-Shift-l",
358
+ alignCenter: "Mod-Shift-e",
359
+ alignRight: "Mod-Shift-r",
360
+ alignJustify: "Mod-Shift-j",
361
+ indent: "Mod-]",
362
+ outdent: "Mod-[",
363
+ clearFormatting: "Mod-\\",
364
+ paragraph: "Mod-Alt-0",
365
+ h1: "Mod-Alt-1",
366
+ h2: "Mod-Alt-2",
367
+ h3: "Mod-Alt-3",
368
+ h4: "Mod-Alt-4",
369
+ h5: "Mod-Alt-5",
370
+ h6: "Mod-Alt-6"
371
+ };
372
+ function computedAtCursor(editor) {
373
+ try {
374
+ const { node } = editor.view.domAtPos(editor.view.state.selection.from);
375
+ const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
376
+ return el ? getComputedStyle(el) : null;
377
+ } catch {
378
+ return null;
379
+ }
380
+ }
381
+ var GENERIC_FONTS = {
382
+ "system-ui": "Sans Serif",
383
+ "-apple-system": "Sans Serif",
384
+ "sans-serif": "Sans Serif",
385
+ serif: "Serif",
386
+ monospace: "Monospace",
387
+ "ui-monospace": "Monospace"
388
+ };
389
+ function prettyFontName(family) {
390
+ const first = String(family).split(",")[0].trim().replace(/["']/g, "");
391
+ return GENERIC_FONTS[first.toLowerCase()] ?? first;
392
+ }
393
+ function pxToPt(px) {
394
+ const value = parseFloat(px);
395
+ if (!Number.isFinite(value) || value <= 0) return null;
396
+ return `${Math.round(value * 0.75 * 2) / 2}pt`;
397
+ }
398
+ var sameFont = (a, b) => typeof a === "string" && a.replace(/["'\s]/g, "").toLowerCase() === b.replace(/["'\s]/g, "").toLowerCase();
399
+ function registerBuiltins(editor) {
400
+ const { registry, t } = editor.ui;
401
+ const state = () => editor.view.state;
402
+ const commandButton = (name, command, svg, isActive) => registry.addButton(name, {
403
+ icon: svg,
404
+ tooltip: t(command),
405
+ ...SHORTCUTS[command] ? { shortcut: SHORTCUTS[command] } : {},
406
+ onAction: (e) => e.exec(command),
407
+ isEnabled: (e) => e.can(command),
408
+ ...isActive ? { isActive } : {}
409
+ });
410
+ const markButton = (name, command, mark, svg) => commandButton(name, command, svg, () => isMarkActive(state(), editor.schema.marks[mark]));
411
+ commandButton("undo", "undo", icons.undo);
412
+ commandButton("redo", "redo", icons.redo);
413
+ markButton("bold", "bold", "bold", icons.bold);
414
+ markButton("italic", "italic", "italic", icons.italic);
415
+ markButton("underline", "underline", "underline", icons.underline);
416
+ markButton("strikethrough", "strike", "strike", icons.strike);
417
+ markButton("inlinecode", "code", "code", icons.code);
418
+ markButton("subscript", "subscript", "subscript", icons.subscript);
419
+ markButton("superscript", "superscript", "superscript", icons.superscript);
420
+ commandButton(
421
+ "bullist",
422
+ "bulletList",
423
+ icons.bulletList,
424
+ () => isNodeActive(state(), editor.schema.nodes.bullet_list)
425
+ );
426
+ commandButton(
427
+ "numlist",
428
+ "orderedList",
429
+ icons.orderedList,
430
+ () => isNodeActive(state(), editor.schema.nodes.ordered_list)
431
+ );
432
+ commandButton("indent", "indent", icons.indent);
433
+ commandButton("outdent", "outdent", icons.outdent);
434
+ commandButton(
435
+ "blockquote",
436
+ "blockquote",
437
+ icons.blockquote,
438
+ () => isNodeActive(state(), editor.schema.nodes.blockquote)
439
+ );
440
+ commandButton(
441
+ "codeblock",
442
+ "codeBlock",
443
+ icons.codeBlock,
444
+ () => isNodeActive(state(), editor.schema.nodes.code_block)
445
+ );
446
+ commandButton("hr", "horizontalRule", icons.horizontalRule);
447
+ commandButton("removeformat", "clearFormatting", icons.clearFormatting);
448
+ const alignments = [
449
+ ["alignLeft", "left", icons.alignLeft],
450
+ ["alignCenter", "center", icons.alignCenter],
451
+ ["alignRight", "right", icons.alignRight],
452
+ ["alignJustify", "justify", icons.alignJustify]
453
+ ];
454
+ for (const [command, align, svg] of alignments) {
455
+ commandButton(command.toLowerCase(), command, svg, () => getActiveAlign(state()) === align);
456
+ }
457
+ registry.addMenuButton("align", {
458
+ icon: icons.alignLeft,
459
+ tooltip: t("align"),
460
+ isEnabled: (e) => e.can("alignLeft"),
461
+ items: (e) => alignments.map(([command, align, svg]) => ({
462
+ id: command,
463
+ label: t(command),
464
+ icon: svg,
465
+ ...SHORTCUTS[command] ? { shortcut: SHORTCUTS[command] } : {},
466
+ active: getActiveAlign(e.view.state) === align,
467
+ onSelect: () => e.exec(command)
468
+ }))
469
+ });
470
+ const blockItems = [
471
+ { command: "paragraph", style: "" },
472
+ { command: "h1", style: "font-size: 1.6em; font-weight: 700" },
473
+ { command: "h2", style: "font-size: 1.35em; font-weight: 700" },
474
+ { command: "h3", style: "font-size: 1.15em; font-weight: 700" },
475
+ { command: "h4", style: "font-size: 1em; font-weight: 700" },
476
+ { command: "h5", style: "font-size: 0.9em; font-weight: 700" },
477
+ { command: "h6", style: "font-size: 0.85em; font-weight: 700" },
478
+ { command: "codeBlock", style: "font-family: ui-monospace, monospace" }
479
+ ];
480
+ const currentBlock = () => {
481
+ const parent = state().selection.$from.parent;
482
+ if (parent.type === editor.schema.nodes.heading) return `h${parent.attrs.level}`;
483
+ if (parent.type === editor.schema.nodes.code_block) return "codeBlock";
484
+ return "paragraph";
485
+ };
486
+ for (let level = 1; level <= 6; level++) {
487
+ const command = `h${level}`;
488
+ registry.addToggleButton(command, {
489
+ ...level <= 3 ? { icon: icons[`h${level}`] } : { text: `H${level}` },
490
+ tooltip: t(command),
491
+ ...SHORTCUTS[command] ? { shortcut: SHORTCUTS[command] } : {},
492
+ isActive: () => currentBlock() === command,
493
+ isEnabled: (e) => e.can(command) || currentBlock() === command,
494
+ onAction: (e) => e.exec(currentBlock() === command ? "paragraph" : command)
495
+ });
496
+ }
497
+ const BLOCK_COMMANDS = {
498
+ p: "paragraph",
499
+ h1: "h1",
500
+ h2: "h2",
501
+ h3: "h3",
502
+ h4: "h4",
503
+ h5: "h5",
504
+ h6: "h6",
505
+ pre: "codeBlock"
506
+ };
507
+ const blockList = () => {
508
+ const custom = editor.options.blockFormats;
509
+ if (!custom?.length) return blockItems;
510
+ return custom.flatMap(({ label, block }) => {
511
+ const command = BLOCK_COMMANDS[block];
512
+ const item = blockItems.find((i) => i.command === command);
513
+ return item ? [{ ...item, label }] : [];
514
+ });
515
+ };
516
+ registry.addMenuButton("blocks", {
517
+ tooltip: t("blocks"),
518
+ label: () => blockList().find((i) => i.command === currentBlock())?.label ?? t(currentBlock()),
519
+ minChars: 11,
520
+ isEnabled: (e) => blockList().some(({ command }) => e.can(command)),
521
+ items: (e) => blockList().filter(({ command }) => e.isAllowed(command)).map(({ command, style, label }) => ({
522
+ id: command,
523
+ label: label ?? t(command),
524
+ labelStyle: style,
525
+ ...SHORTCUTS[command] ? { shortcut: SHORTCUTS[command] } : {},
526
+ active: currentBlock() === command,
527
+ onSelect: () => e.exec(command)
528
+ }))
529
+ });
530
+ const ALIGN_SELECTOR = "p,h1,h2,h3,h4,h5,h6";
531
+ const defaultStyleFormats = () => [
532
+ {
533
+ title: t("styles.headings"),
534
+ items: [1, 2, 3, 4, 5, 6].map((level) => ({
535
+ title: t(`h${level}`),
536
+ block: `h${level}`
537
+ }))
538
+ },
539
+ {
540
+ title: t("styles.inline"),
541
+ items: [
542
+ { title: t("bold"), inline: "strong" },
543
+ { title: t("italic"), inline: "em" },
544
+ { title: t("underline"), inline: "u" },
545
+ { title: t("strike"), inline: "s" },
546
+ { title: t("superscript"), inline: "sup" },
547
+ { title: t("subscript"), inline: "sub" },
548
+ { title: t("code"), inline: "code" }
549
+ ]
550
+ },
551
+ {
552
+ title: t("styles.blocks"),
553
+ items: [
554
+ { title: t("paragraph"), block: "p" },
555
+ { title: t("blockquote"), block: "blockquote" },
556
+ { title: t("codeBlock"), block: "pre" }
557
+ ]
558
+ },
559
+ {
560
+ title: t("styles.align"),
561
+ items: ["left", "center", "right", "justify"].map((align) => ({
562
+ title: t(
563
+ `align${align === "justify" ? "Justify" : align[0].toUpperCase() + align.slice(1)}`
564
+ ),
565
+ selector: ALIGN_SELECTOR,
566
+ styles: { "text-align": align }
567
+ }))
568
+ }
569
+ ];
570
+ const formatOf = (item) => item.format ?? item;
571
+ const previewStyle = (item) => {
572
+ const spec = item.format ? editor.formatter.get(item.format)?.[0] : item;
573
+ const parts = [];
574
+ const block = spec?.block;
575
+ if (block && /^h[1-6]$/.test(block)) parts.push("font-weight: 700");
576
+ if (spec?.inline === "strong" || spec?.inline === "b") parts.push("font-weight: 700");
577
+ if (spec?.inline === "em" || spec?.inline === "i") parts.push("font-style: italic");
578
+ if (spec?.inline === "u") parts.push("text-decoration: underline");
579
+ if (spec?.inline === "s" || spec?.inline === "strike" || spec?.inline === "del")
580
+ parts.push("text-decoration: line-through");
581
+ if (spec?.inline === "code" || block === "pre")
582
+ parts.push("font-family: ui-monospace, monospace");
583
+ for (const prop of ["color", "background-color", "font-family"]) {
584
+ const value = spec?.styles?.[prop];
585
+ if (value && /^[#\w\s,'"().%-]+$/.test(value)) parts.push(`${prop}: ${value}`);
586
+ }
587
+ return parts.join("; ");
588
+ };
589
+ const flatStyles = (items) => items.flatMap((item) => item.items ? flatStyles(item.items) : [item]);
590
+ const styleFormats = () => {
591
+ const custom = editor.options.styleFormats;
592
+ const own = !custom ? defaultStyleFormats() : editor.options.styleFormatsMerge ? [...defaultStyleFormats(), ...custom] : custom;
593
+ const added = registry.getStyleFormats();
594
+ if (!added.items.length) return own;
595
+ return added.replace ? [...added.items] : [...own, ...added.items];
596
+ };
597
+ registry.addMenuButton("styles", {
598
+ tooltip: t("styles"),
599
+ minChars: 10,
600
+ label: (e) => flatStyles(styleFormats()).find((item) => e.formatter.match(formatOf(item)))?.title ?? t("styles"),
601
+ items: (e) => {
602
+ const entries = [];
603
+ const add = (items, prefix) => {
604
+ items.forEach((item, index) => {
605
+ if (item.items) {
606
+ if (entries.length) entries.push({ type: "separator" });
607
+ entries.push({ type: "heading", label: item.title });
608
+ add(item.items, `${prefix}${index}-`);
609
+ return;
610
+ }
611
+ entries.push({
612
+ id: `style-${prefix}${index}`,
613
+ label: item.title,
614
+ labelStyle: previewStyle(item),
615
+ active: e.formatter.match(formatOf(item)),
616
+ // A selector format without matching elements (no image selected) is inactive.
617
+ disabled: !e.formatter.canApply(formatOf(item)),
618
+ onSelect: () => e.formatter.toggle(formatOf(item))
619
+ });
620
+ });
621
+ };
622
+ add(styleFormats(), "");
623
+ return entries;
624
+ }
625
+ });
626
+ const families = editor.options.fontFamilies ?? defaultFontFamilies;
627
+ registry.addMenuButton("fontfamily", {
628
+ tooltip: t("fontFamily"),
629
+ minChars: 9,
630
+ label: (e) => {
631
+ const value = getStyle(state(), "font_family");
632
+ if (value)
633
+ return families.find((f) => sameFont(value, f.value))?.label ?? prettyFontName(value);
634
+ const computed = computedAtCursor(e)?.fontFamily;
635
+ return computed ? prettyFontName(computed) : t("fontFamily");
636
+ },
637
+ items: (e) => {
638
+ const value = getStyle(e.view.state, "font_family");
639
+ return [
640
+ {
641
+ id: "default",
642
+ label: t("default"),
643
+ active: value === null,
644
+ onSelect: () => e.exec(setStyle("font_family", null))
645
+ },
646
+ { type: "separator" },
647
+ ...families.map((f) => ({
648
+ id: f.label,
649
+ label: f.label,
650
+ labelStyle: `font-family: ${f.value}`,
651
+ active: sameFont(value, f.value),
652
+ onSelect: () => e.exec(setStyle("font_family", f.value))
653
+ }))
654
+ ];
655
+ }
656
+ });
657
+ const sizes = editor.options.fontSizes ?? defaultFontSizes;
658
+ registry.addMenuButton("fontsize", {
659
+ tooltip: t("fontSize"),
660
+ minChars: 4,
661
+ label: (e) => getStyle(state(), "font_size") ?? pxToPt(computedAtCursor(e)?.fontSize ?? "") ?? "\u2014",
662
+ items: (e) => {
663
+ const value = getStyle(e.view.state, "font_size");
664
+ return [
665
+ {
666
+ id: "default",
667
+ label: t("default"),
668
+ active: value === null,
669
+ onSelect: () => e.exec(setStyle("font_size", null))
670
+ },
671
+ { type: "separator" },
672
+ ...sizes.map((size) => ({
673
+ id: size,
674
+ label: size,
675
+ active: value === size,
676
+ onSelect: () => e.exec(setStyle("font_size", size))
677
+ }))
678
+ ];
679
+ }
680
+ });
681
+ const lineHeights = editor.options.lineHeights ?? defaultLineHeights;
682
+ registry.addMenuButton("lineheight", {
683
+ icon: icons.lineHeight,
684
+ tooltip: t("lineHeight"),
685
+ isEnabled: (e) => e.can(setLineHeight(null)),
686
+ items: (e) => {
687
+ const value = getLineHeight(e.view.state);
688
+ return [
689
+ {
690
+ id: "default",
691
+ label: t("default"),
692
+ active: value === null,
693
+ onSelect: () => e.exec(setLineHeight(null))
694
+ },
695
+ ...lineHeights.map((lh) => ({
696
+ id: lh,
697
+ label: lh,
698
+ active: value === lh,
699
+ onSelect: () => e.exec(setLineHeight(lh))
700
+ }))
701
+ ];
702
+ }
703
+ });
704
+ const colorButton = (name, mark, svg, label) => registry.addPanelButton(name, {
705
+ icon: svg,
706
+ tooltip: t(label),
707
+ indicator: () => getStyle(state(), mark),
708
+ render: (e, close) => createColorPanel({
709
+ colors: e.options.colors ?? defaultColors,
710
+ current: getStyle(e.view.state, mark),
711
+ label: t(label),
712
+ removeLabel: t("removeColor"),
713
+ customLabel: t("customColor"),
714
+ onPick: (color) => {
715
+ close();
716
+ e.exec(setStyle(mark, color));
717
+ }
718
+ })
719
+ });
720
+ colorButton("forecolor", "color", icons.textColor, "textColor");
721
+ colorButton("backcolor", "background", icons.highlight, "backgroundColor");
722
+ const extraMarks = [
723
+ ["superscript", "superscript", icons.superscript],
724
+ ["subscript", "subscript", icons.subscript],
725
+ ["code", "code", icons.code]
726
+ ];
727
+ registry.addMenuButton("moreformats", {
728
+ icon: icons.formatMore,
729
+ tooltip: t("moreFormats"),
730
+ isActive: (e) => extraMarks.some(([, mark]) => isMarkActive(e.view.state, editor.schema.marks[mark])),
731
+ items: (e) => [
732
+ ...extraMarks.filter(([command]) => e.isAllowed(command)).map(([command, mark, svg]) => ({
733
+ id: command,
734
+ label: t(command),
735
+ icon: svg,
736
+ checkbox: true,
737
+ active: isMarkActive(e.view.state, editor.schema.marks[mark]),
738
+ disabled: !e.can(command),
739
+ ...SHORTCUTS[command] ? { shortcut: SHORTCUTS[command] } : {},
740
+ onSelect: () => e.exec(command)
741
+ })),
742
+ { type: "separator" },
743
+ {
744
+ id: "clearFormatting",
745
+ label: t("clearFormatting"),
746
+ icon: icons.clearFormatting,
747
+ disabled: !e.can("clearFormatting"),
748
+ shortcut: SHORTCUTS.clearFormatting,
749
+ onSelect: () => e.exec("clearFormatting")
750
+ },
751
+ {
752
+ id: "pasteAsText",
753
+ label: t("pasteAsText"),
754
+ icon: icons.pasteText,
755
+ checkbox: true,
756
+ active: e.isPasteAsText(),
757
+ onSelect: () => {
758
+ e.setPasteAsText(!e.isPasteAsText());
759
+ e.focus();
760
+ }
761
+ }
762
+ ]
763
+ });
764
+ registry.addToggleButton("pastetext", {
765
+ icon: icons.pasteText,
766
+ tooltip: t("pasteAsText"),
767
+ isActive: (e) => e.isPasteAsText(),
768
+ onAction: (e) => {
769
+ e.setPasteAsText(!e.isPasteAsText());
770
+ e.focus();
771
+ }
772
+ });
773
+ registry.addButton("link", {
774
+ icon: icons.link,
775
+ tooltip: t("link"),
776
+ shortcut: "Mod-k",
777
+ onAction: (e) => openLinkDialog(e),
778
+ isActive: () => !!getLinkAt(state())
779
+ });
780
+ registry.addButton("unlink", {
781
+ icon: icons.unlink,
782
+ tooltip: t("unlink"),
783
+ onAction: (e) => e.exec(removeLink()),
784
+ isEnabled: (e) => e.can(removeLink())
785
+ });
786
+ registry.addButton("image", {
787
+ icon: icons.image,
788
+ tooltip: t("image"),
789
+ onAction: (e) => openImageDialog(e)
790
+ });
791
+ const imageAlign = () => getSelectedImage(state())?.attrs.align ?? null;
792
+ const imageAlignButton = (name, align, svg, label) => registry.addToggleButton(name, {
793
+ icon: svg,
794
+ tooltip: t(label),
795
+ isActive: () => imageAlign() === align,
796
+ // Pressing again removes the alignment: the image is "inline" again.
797
+ onAction: (e) => e.exec(setImageAttrs({ align: imageAlign() === align ? null : align }))
798
+ });
799
+ imageAlignButton("imagealignleft", "left", icons.imageLeft, "image.alignLeft");
800
+ imageAlignButton("imagealigncenter", "center", icons.imageCenter, "image.alignCenter");
801
+ imageAlignButton("imagealignright", "right", icons.imageRight, "image.alignRight");
802
+ const imageSizes = [
803
+ ["image.sizeSmall", 0.25],
804
+ ["image.sizeMedium", 0.5],
805
+ ["image.sizeLarge", 0.75],
806
+ ["image.sizeFull", 1],
807
+ ["image.sizeOriginal", null]
808
+ ];
809
+ registry.addMenuButton("imagesize", {
810
+ icon: icons.resize,
811
+ tooltip: t("image.size"),
812
+ items: (e) => imageSizes.map(([label, fraction]) => ({
813
+ id: label,
814
+ label: t(label),
815
+ onSelect: () => setImageWidthFraction(e, fraction)
816
+ }))
817
+ });
818
+ registry.addButton("imagealt", {
819
+ icon: icons.altText,
820
+ tooltip: t("image.editAlt"),
821
+ onAction: (e) => openImageAltDialog(e)
822
+ });
823
+ registry.addToggleButton("imagecaption", {
824
+ icon: icons.imageCaption,
825
+ tooltip: t("image.caption"),
826
+ isActive: (e) => hasImageCaption(e.view.state),
827
+ onAction: (e) => e.exec(toggleImageCaption)
828
+ });
829
+ registry.addButton("imagedelete", {
830
+ icon: icons.trash,
831
+ tooltip: t("image.delete"),
832
+ onAction: (e) => e.exec((s, dispatch) => {
833
+ const image = getSelectedImage(s);
834
+ if (!image) return false;
835
+ dispatch?.(s.tr.delete(image.pos, image.pos + image.node.nodeSize).scrollIntoView());
836
+ return true;
837
+ })
838
+ });
839
+ registerTableUi(editor);
840
+ registry.addButton("searchreplace", {
841
+ icon: icons.search,
842
+ tooltip: t("search.title"),
843
+ shortcut: "Mod-f",
844
+ onAction: (e) => e.openSearch()
845
+ });
846
+ registry.addToggleButton("fullscreen", {
847
+ icon: icons.fullscreen,
848
+ tooltip: t("fullscreen"),
849
+ shortcut: "Mod-Shift-f",
850
+ isActive: (e) => isFullscreen(e),
851
+ onAction: (e) => toggleFullscreen(e)
852
+ });
853
+ registry.addButton("preview", {
854
+ icon: icons.preview,
855
+ tooltip: t("preview"),
856
+ onAction: (e) => openPreview(e)
857
+ });
858
+ registry.addButton("code", {
859
+ icon: icons.sourceCode,
860
+ tooltip: t("sourceCode"),
861
+ onAction: (e) => openSourceCode(e)
862
+ });
863
+ registry.addButton("help", {
864
+ icon: icons.help,
865
+ tooltip: t("help"),
866
+ shortcut: "Alt-0",
867
+ onAction: (e) => openHelp(e)
868
+ });
869
+ registry.addContextToolbar("image", {
870
+ label: t("image.toolbar"),
871
+ predicate: (e) => !!getSelectedImage(e.view.state),
872
+ items: "imagealignleft imagealigncenter imagealignright | imagesize imagealt imagecaption | imagedelete",
873
+ // Above the image (and with a caption, above the whole figure, even when the cursor is in the caption).
874
+ anchor: (e) => {
875
+ const image = getSelectedImage(e.view.state);
876
+ const dom = image ? e.view.nodeDOM(image.pos) : null;
877
+ return dom?.getBoundingClientRect() ?? null;
878
+ }
879
+ });
880
+ }
881
+
882
+ export {
883
+ setStyle,
884
+ getStyle,
885
+ setLineHeight,
886
+ getLineHeight,
887
+ defaultColors,
888
+ defaultFontFamilies,
889
+ defaultFontSizes,
890
+ defaultLineHeights,
891
+ registerBuiltins
892
+ };
893
+ //# sourceMappingURL=chunk-6YSQGFV7.js.map