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