@novaprose/core 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (338) hide show
  1. package/README.md +20 -4
  2. package/dist/a11y.cjs +314 -0
  3. package/dist/a11y.cjs.map +1 -0
  4. package/dist/a11y.d.cts +51 -0
  5. package/dist/a11y.d.ts +51 -0
  6. package/dist/a11y.js +11 -0
  7. package/dist/a11y.js.map +1 -0
  8. package/dist/a11ychecker-7KQU7DD3.js +449 -0
  9. package/dist/a11ychecker-7KQU7DD3.js.map +1 -0
  10. package/dist/accordion-ui-FGN3I5UF.js +201 -0
  11. package/dist/accordion-ui-FGN3I5UF.js.map +1 -0
  12. package/dist/advcode-65Z2ELUB.js +51 -0
  13. package/dist/advcode-65Z2ELUB.js.map +1 -0
  14. package/dist/advcode-editor-WIOCY552.js +257 -0
  15. package/dist/advcode-editor-WIOCY552.js.map +1 -0
  16. package/dist/{advlist-K2U3VPH2.js → advlist-CEHE6YXS.js} +14 -20
  17. package/dist/advlist-CEHE6YXS.js.map +1 -0
  18. package/dist/advtable-ui-5CBOPTHW.js +364 -0
  19. package/dist/advtable-ui-5CBOPTHW.js.map +1 -0
  20. package/dist/ai-IRQYZHRK.js +1485 -0
  21. package/dist/ai-IRQYZHRK.js.map +1 -0
  22. package/dist/anchor-ui-NWIIRKGY.js +81 -0
  23. package/dist/anchor-ui-NWIIRKGY.js.map +1 -0
  24. package/dist/autocorrect-6GFLVDPC.js +851 -0
  25. package/dist/autocorrect-6GFLVDPC.js.map +1 -0
  26. package/dist/{autolink-XWDTLY37.js → autolink-N427KVQO.js} +13 -7
  27. package/dist/autolink-N427KVQO.js.map +1 -0
  28. package/dist/{autoresize-UB3GOA6D.js → autoresize-YRZAVCNO.js} +2 -2
  29. package/dist/autoresize-YRZAVCNO.js.map +1 -0
  30. package/dist/{autosave-MWNRUNU3.js → autosave-L7OZ3KLK.js} +9 -13
  31. package/dist/autosave-L7OZ3KLK.js.map +1 -0
  32. package/dist/casechange-5G6RAJ7K.js +201 -0
  33. package/dist/casechange-5G6RAJ7K.js.map +1 -0
  34. package/dist/{charmap-ADLYOIB3.js → charmap-5CBBDWOP.js} +9 -14
  35. package/dist/charmap-5CBBDWOP.js.map +1 -0
  36. package/dist/checklist-HM4VXZKY.js +189 -0
  37. package/dist/checklist-HM4VXZKY.js.map +1 -0
  38. package/dist/chunk-23ZLVT5D.js +163 -0
  39. package/dist/chunk-23ZLVT5D.js.map +1 -0
  40. package/dist/chunk-3BOK3S3T.js +26 -0
  41. package/dist/chunk-3BOK3S3T.js.map +1 -0
  42. package/dist/chunk-4I4AYH2K.js +101 -0
  43. package/dist/chunk-4I4AYH2K.js.map +1 -0
  44. package/dist/chunk-4VPDY3LF.js +27 -0
  45. package/dist/chunk-4VPDY3LF.js.map +1 -0
  46. package/dist/chunk-53AY5NAF.js +214 -0
  47. package/dist/chunk-53AY5NAF.js.map +1 -0
  48. package/dist/chunk-5VCESSQB.js +137 -0
  49. package/dist/chunk-5VCESSQB.js.map +1 -0
  50. package/dist/chunk-66INZHZ2.js +79 -0
  51. package/dist/chunk-66INZHZ2.js.map +1 -0
  52. package/dist/chunk-6LQM7G4V.js +159 -0
  53. package/dist/chunk-6LQM7G4V.js.map +1 -0
  54. package/dist/chunk-6YSQGFV7.js +893 -0
  55. package/dist/chunk-6YSQGFV7.js.map +1 -0
  56. package/dist/{chunk-GHEFKKRC.js → chunk-AC3YCAX4.js} +108 -29
  57. package/dist/chunk-AC3YCAX4.js.map +1 -0
  58. package/dist/{chunk-NPKAIW34.js → chunk-ADRPQLZ2.js} +50 -1
  59. package/dist/chunk-ADRPQLZ2.js.map +1 -0
  60. package/dist/chunk-ANE5ASXG.js +26 -0
  61. package/dist/chunk-ANE5ASXG.js.map +1 -0
  62. package/dist/{chunk-Z3ELZ77W.js → chunk-AP2PJFLB.js} +5 -2
  63. package/dist/chunk-AP2PJFLB.js.map +1 -0
  64. package/dist/chunk-AQV6FIKK.js +259 -0
  65. package/dist/chunk-AQV6FIKK.js.map +1 -0
  66. package/dist/chunk-AUQSATWL.js +322 -0
  67. package/dist/chunk-AUQSATWL.js.map +1 -0
  68. package/dist/chunk-C326LHHU.js +143 -0
  69. package/dist/chunk-C326LHHU.js.map +1 -0
  70. package/dist/chunk-DEYYVZ7O.js +393 -0
  71. package/dist/chunk-DEYYVZ7O.js.map +1 -0
  72. package/dist/chunk-EOJ5XHKA.js +160 -0
  73. package/dist/chunk-EOJ5XHKA.js.map +1 -0
  74. package/dist/chunk-EXX2S352.js +3642 -0
  75. package/dist/chunk-EXX2S352.js.map +1 -0
  76. package/dist/chunk-FTEA6L2Q.js +47 -0
  77. package/dist/chunk-FTEA6L2Q.js.map +1 -0
  78. package/dist/chunk-G74HNSB6.js +9 -0
  79. package/dist/chunk-G74HNSB6.js.map +1 -0
  80. package/dist/chunk-GHVB6SV4.js +177 -0
  81. package/dist/chunk-GHVB6SV4.js.map +1 -0
  82. package/dist/chunk-GTLE2HEW.js +108 -0
  83. package/dist/chunk-GTLE2HEW.js.map +1 -0
  84. package/dist/chunk-GXXXLPDQ.js +67 -0
  85. package/dist/chunk-GXXXLPDQ.js.map +1 -0
  86. package/dist/chunk-HC6RMBAD.js +163 -0
  87. package/dist/chunk-HC6RMBAD.js.map +1 -0
  88. package/dist/chunk-HNEAVVBC.js +98 -0
  89. package/dist/chunk-HNEAVVBC.js.map +1 -0
  90. package/dist/chunk-I7Y4KSM2.js +165 -0
  91. package/dist/chunk-I7Y4KSM2.js.map +1 -0
  92. package/dist/chunk-IG2BL4ON.js +127 -0
  93. package/dist/chunk-IG2BL4ON.js.map +1 -0
  94. package/dist/chunk-J6W2CDRF.js +425 -0
  95. package/dist/chunk-J6W2CDRF.js.map +1 -0
  96. package/dist/chunk-LVEQBNLX.js +207 -0
  97. package/dist/chunk-LVEQBNLX.js.map +1 -0
  98. package/dist/chunk-MZGNOHSY.js +176 -0
  99. package/dist/chunk-MZGNOHSY.js.map +1 -0
  100. package/dist/chunk-N32H37AJ.js +373 -0
  101. package/dist/chunk-N32H37AJ.js.map +1 -0
  102. package/dist/chunk-NTGEKGXU.js +263 -0
  103. package/dist/chunk-NTGEKGXU.js.map +1 -0
  104. package/dist/chunk-OFHGXYG3.js +140 -0
  105. package/dist/chunk-OFHGXYG3.js.map +1 -0
  106. package/dist/chunk-OOVNE6MB.js +28 -0
  107. package/dist/chunk-OOVNE6MB.js.map +1 -0
  108. package/dist/chunk-OQMMHWMZ.js +7 -0
  109. package/dist/chunk-OQMMHWMZ.js.map +1 -0
  110. package/dist/chunk-P2UU2NLT.js +1149 -0
  111. package/dist/chunk-P2UU2NLT.js.map +1 -0
  112. package/dist/{chunk-HZRIBOPW.js → chunk-QU3KXMYT.js} +45 -3
  113. package/dist/chunk-QU3KXMYT.js.map +1 -0
  114. package/dist/chunk-S2XZRKHA.js +29 -0
  115. package/dist/chunk-S2XZRKHA.js.map +1 -0
  116. package/dist/chunk-SCIRO4XK.js +144 -0
  117. package/dist/chunk-SCIRO4XK.js.map +1 -0
  118. package/dist/chunk-T3IRLTKK.js +158 -0
  119. package/dist/chunk-T3IRLTKK.js.map +1 -0
  120. package/dist/chunk-TABIUD2L.js +66 -0
  121. package/dist/chunk-TABIUD2L.js.map +1 -0
  122. package/dist/{chunk-7ON7PR5R.js → chunk-TAM2FHKG.js} +374 -52
  123. package/dist/chunk-TAM2FHKG.js.map +1 -0
  124. package/dist/chunk-UTMS2P2K.js +288 -0
  125. package/dist/chunk-UTMS2P2K.js.map +1 -0
  126. package/dist/{chunk-HPLT3XRZ.js → chunk-V7WUHUHM.js} +13 -1
  127. package/dist/chunk-V7WUHUHM.js.map +1 -0
  128. package/dist/chunk-VK6YF2AA.js +359 -0
  129. package/dist/chunk-VK6YF2AA.js.map +1 -0
  130. package/dist/chunk-WAOU5NGN.js +430 -0
  131. package/dist/chunk-WAOU5NGN.js.map +1 -0
  132. package/dist/chunk-XIH4SCO6.js +112 -0
  133. package/dist/chunk-XIH4SCO6.js.map +1 -0
  134. package/dist/chunk-XR7CY4NI.js +11 -0
  135. package/dist/chunk-XR7CY4NI.js.map +1 -0
  136. package/dist/chunk-YDF55N6Z.js +164 -0
  137. package/dist/chunk-YDF55N6Z.js.map +1 -0
  138. package/dist/chunk-YDPZCVXS.js +923 -0
  139. package/dist/chunk-YDPZCVXS.js.map +1 -0
  140. package/dist/chunk-YG5V7POU.js +137 -0
  141. package/dist/chunk-YG5V7POU.js.map +1 -0
  142. package/dist/chunk-YVSUR7E5.js +151 -0
  143. package/dist/chunk-YVSUR7E5.js.map +1 -0
  144. package/dist/codesample-GHWIC7PT.js +546 -0
  145. package/dist/codesample-GHWIC7PT.js.map +1 -0
  146. package/dist/{comments-panel-FYJE3U64.js → comments-panel-SOLBZ46Q.js} +12 -6
  147. package/dist/comments-panel-SOLBZ46Q.js.map +1 -0
  148. package/dist/{directionality-XOHJFSL6.js → directionality-EGQKGDZA.js} +16 -11
  149. package/dist/directionality-EGQKGDZA.js.map +1 -0
  150. package/dist/document-0ft41E6d.d.ts +39 -0
  151. package/dist/document-IQqDDT4v.d.cts +39 -0
  152. package/dist/docx.cjs +23518 -0
  153. package/dist/docx.cjs.map +1 -0
  154. package/dist/docx.d.cts +83 -0
  155. package/dist/docx.d.ts +83 -0
  156. package/dist/docx.js +1821 -0
  157. package/dist/docx.js.map +1 -0
  158. package/dist/draghandle-U6CYZHPA.js +389 -0
  159. package/dist/draghandle-U6CYZHPA.js.map +1 -0
  160. package/dist/editimage-5EWPSM22.js +683 -0
  161. package/dist/editimage-5EWPSM22.js.map +1 -0
  162. package/dist/editor-BCMxe1M4.d.cts +2888 -0
  163. package/dist/editor-Dmtwjw2u.d.ts +2888 -0
  164. package/dist/email-ELNMEQ6E.js +177 -0
  165. package/dist/email-ELNMEQ6E.js.map +1 -0
  166. package/dist/email.cjs +588 -0
  167. package/dist/email.cjs.map +1 -0
  168. package/dist/email.d.cts +7 -0
  169. package/dist/email.d.ts +7 -0
  170. package/dist/email.js +21 -0
  171. package/dist/email.js.map +1 -0
  172. package/dist/{emoticons-TP4N4ZGY.js → emoticons-EGHNZKSA.js} +9 -14
  173. package/dist/emoticons-EGHNZKSA.js.map +1 -0
  174. package/dist/exportpdf-4P7X3NY2.js +91 -0
  175. package/dist/exportpdf-4P7X3NY2.js.map +1 -0
  176. package/dist/exportword-JFJ3KTYZ.js +16 -0
  177. package/dist/exportword-JFJ3KTYZ.js.map +1 -0
  178. package/dist/footnotes-ui-FV6QRGDA.js +449 -0
  179. package/dist/footnotes-ui-FV6QRGDA.js.map +1 -0
  180. package/dist/form-dialog-SNWFPM2K.js +379 -0
  181. package/dist/form-dialog-SNWFPM2K.js.map +1 -0
  182. package/dist/formatpainter-IEXX27OJ.js +209 -0
  183. package/dist/formatpainter-IEXX27OJ.js.map +1 -0
  184. package/dist/fullpagehtml-ui-RE4C2NO5.js +220 -0
  185. package/dist/fullpagehtml-ui-RE4C2NO5.js.map +1 -0
  186. package/dist/html-rules-api-BLDDW9MO.d.cts +42 -0
  187. package/dist/html-rules-api-BLDDW9MO.d.ts +42 -0
  188. package/dist/html-rules.cjs +482 -0
  189. package/dist/html-rules.cjs.map +1 -0
  190. package/dist/html-rules.d.cts +89 -0
  191. package/dist/html-rules.d.ts +89 -0
  192. package/dist/html-rules.js +417 -0
  193. package/dist/html-rules.js.map +1 -0
  194. package/dist/i18n/de.cjs +670 -0
  195. package/dist/i18n/de.cjs.map +1 -0
  196. package/dist/i18n/de.d.cts +9 -0
  197. package/dist/i18n/de.d.ts +9 -0
  198. package/dist/i18n/de.js +649 -0
  199. package/dist/i18n/de.js.map +1 -0
  200. package/dist/i18n/es.cjs +670 -0
  201. package/dist/i18n/es.cjs.map +1 -0
  202. package/dist/i18n/es.d.cts +9 -0
  203. package/dist/i18n/es.d.ts +9 -0
  204. package/dist/i18n/es.js +649 -0
  205. package/dist/i18n/es.js.map +1 -0
  206. package/dist/i18n/fr.cjs +670 -0
  207. package/dist/i18n/fr.cjs.map +1 -0
  208. package/dist/i18n/fr.d.cts +9 -0
  209. package/dist/i18n/fr.d.ts +9 -0
  210. package/dist/i18n/fr.js +649 -0
  211. package/dist/i18n/fr.js.map +1 -0
  212. package/dist/i18n/it.cjs +670 -0
  213. package/dist/i18n/it.cjs.map +1 -0
  214. package/dist/i18n/it.d.cts +9 -0
  215. package/dist/i18n/it.d.ts +9 -0
  216. package/dist/i18n/it.js +649 -0
  217. package/dist/i18n/it.js.map +1 -0
  218. package/dist/i18n/pt-BR.cjs +670 -0
  219. package/dist/i18n/pt-BR.cjs.map +1 -0
  220. package/dist/i18n/pt-BR.d.cts +9 -0
  221. package/dist/i18n/pt-BR.d.ts +9 -0
  222. package/dist/i18n/pt-BR.js +649 -0
  223. package/dist/i18n/pt-BR.js.map +1 -0
  224. package/dist/i18n/ru.cjs +670 -0
  225. package/dist/i18n/ru.cjs.map +1 -0
  226. package/dist/i18n/ru.d.cts +10 -0
  227. package/dist/i18n/ru.d.ts +10 -0
  228. package/dist/i18n/ru.js +649 -0
  229. package/dist/i18n/ru.js.map +1 -0
  230. package/dist/importcss-JLNIRKGH.js +127 -0
  231. package/dist/importcss-JLNIRKGH.js.map +1 -0
  232. package/dist/importword-D7Z6RXGQ.js +73 -0
  233. package/dist/importword-D7Z6RXGQ.js.map +1 -0
  234. package/dist/index-CZ9yDvmQ.d.cts +235 -0
  235. package/dist/index-CZ9yDvmQ.d.ts +235 -0
  236. package/dist/index.cjs +29531 -10134
  237. package/dist/index.cjs.map +1 -1
  238. package/dist/index.d.cts +160 -1828
  239. package/dist/index.d.ts +160 -1828
  240. package/dist/index.js +212 -1480
  241. package/dist/index.js.map +1 -1
  242. package/dist/{insertdatetime-T4SEMQWP.js → insertdatetime-YW2VHYZH.js} +10 -16
  243. package/dist/insertdatetime-YW2VHYZH.js.map +1 -0
  244. package/dist/linkchecker-3S3MCPOS.js +287 -0
  245. package/dist/linkchecker-3S3MCPOS.js.map +1 -0
  246. package/dist/markdown-26O3N3T2.js +136 -0
  247. package/dist/markdown-26O3N3T2.js.map +1 -0
  248. package/dist/markdown.cjs +356 -0
  249. package/dist/markdown.cjs.map +1 -0
  250. package/dist/markdown.d.cts +25 -0
  251. package/dist/markdown.d.ts +25 -0
  252. package/dist/markdown.js +10 -0
  253. package/dist/markdown.js.map +1 -0
  254. package/dist/math-ui-RUTCHTRY.js +157 -0
  255. package/dist/math-ui-RUTCHTRY.js.map +1 -0
  256. package/dist/media-ui-36TE3CJD.js +123 -0
  257. package/dist/media-ui-36TE3CJD.js.map +1 -0
  258. package/dist/mediaembed-ui-ZNTGZ2SQ.js +207 -0
  259. package/dist/mediaembed-ui-ZNTGZ2SQ.js.map +1 -0
  260. package/dist/mentions-ui-O4IPWQT4.js +58 -0
  261. package/dist/mentions-ui-O4IPWQT4.js.map +1 -0
  262. package/dist/mergetags-ui-HS3Q2R36.js +73 -0
  263. package/dist/mergetags-ui-HS3Q2R36.js.map +1 -0
  264. package/dist/{nonbreaking-HG5HV6AL.js → nonbreaking-GYRUH4UO.js} +10 -9
  265. package/dist/nonbreaking-GYRUH4UO.js.map +1 -0
  266. package/dist/pagebreak-ui-I4ZPYK3U.js +50 -0
  267. package/dist/pagebreak-ui-I4ZPYK3U.js.map +1 -0
  268. package/dist/pageembed-ui-WOY6VWRJ.js +172 -0
  269. package/dist/pageembed-ui-WOY6VWRJ.js.map +1 -0
  270. package/dist/pagelayout-ui-Y2IM7FJQ.js +236 -0
  271. package/dist/pagelayout-ui-Y2IM7FJQ.js.map +1 -0
  272. package/dist/paste-office-3A6KWKCV.js +520 -0
  273. package/dist/paste-office-3A6KWKCV.js.map +1 -0
  274. package/dist/permanentpen-6D5LLKFX.js +206 -0
  275. package/dist/permanentpen-6D5LLKFX.js.map +1 -0
  276. package/dist/print-MZMLQIQX.js +178 -0
  277. package/dist/print-MZMLQIQX.js.map +1 -0
  278. package/dist/{quickbars-4NU4SIPL.js → quickbars-UZ2Q67TX.js} +24 -12
  279. package/dist/quickbars-UZ2Q67TX.js.map +1 -0
  280. package/dist/{revisionhistory-3YQPLPLM.js → revisionhistory-ACRB23HL.js} +48 -173
  281. package/dist/revisionhistory-ACRB23HL.js.map +1 -0
  282. package/dist/save-72ZLF6AO.js +120 -0
  283. package/dist/save-72ZLF6AO.js.map +1 -0
  284. package/dist/search-bar-HTZQNPD3.js +212 -0
  285. package/dist/search-bar-HTZQNPD3.js.map +1 -0
  286. package/dist/spellchecker-DJ7SP5JY.js +474 -0
  287. package/dist/spellchecker-DJ7SP5JY.js.map +1 -0
  288. package/dist/suggestions-panel-RJXC4LCM.js +596 -0
  289. package/dist/suggestions-panel-RJXC4LCM.js.map +1 -0
  290. package/dist/suggestions-ui-PODMNH7D.js +395 -0
  291. package/dist/suggestions-ui-PODMNH7D.js.map +1 -0
  292. package/dist/table-OBHE465Y.js +54 -0
  293. package/dist/table-OBHE465Y.js.map +1 -0
  294. package/dist/table-dialogs-UMIIZQYE.js +119 -0
  295. package/dist/table-dialogs-UMIIZQYE.js.map +1 -0
  296. package/dist/tableofcontents-ui-U2PYNPX6.js +167 -0
  297. package/dist/tableofcontents-ui-U2PYNPX6.js.map +1 -0
  298. package/dist/template-YYC2MGVH.js +278 -0
  299. package/dist/template-YYC2MGVH.js.map +1 -0
  300. package/dist/typography-EQUXUXIN.js +399 -0
  301. package/dist/typography-EQUXUXIN.js.map +1 -0
  302. package/dist/upload.cjs +160 -0
  303. package/dist/upload.cjs.map +1 -0
  304. package/dist/upload.d.cts +72 -0
  305. package/dist/upload.d.ts +72 -0
  306. package/dist/upload.js +132 -0
  307. package/dist/upload.js.map +1 -0
  308. package/dist/{visualblocks-RTAYJOGR.js → visualblocks-O5QW7ZDT.js} +10 -9
  309. package/dist/visualblocks-O5QW7ZDT.js.map +1 -0
  310. package/dist/visualchars-UQFRWQPE.js +134 -0
  311. package/dist/visualchars-UQFRWQPE.js.map +1 -0
  312. package/package.json +96 -6
  313. package/src/style.css +440 -508
  314. package/dist/advlist-K2U3VPH2.js.map +0 -1
  315. package/dist/autolink-XWDTLY37.js.map +0 -1
  316. package/dist/autoresize-UB3GOA6D.js.map +0 -1
  317. package/dist/autosave-MWNRUNU3.js.map +0 -1
  318. package/dist/charmap-ADLYOIB3.js.map +0 -1
  319. package/dist/chunk-435CRWKA.js +0 -983
  320. package/dist/chunk-435CRWKA.js.map +0 -1
  321. package/dist/chunk-46RIM5KP.js +0 -5949
  322. package/dist/chunk-46RIM5KP.js.map +0 -1
  323. package/dist/chunk-6RJENZXT.js +0 -104
  324. package/dist/chunk-6RJENZXT.js.map +0 -1
  325. package/dist/chunk-7ON7PR5R.js.map +0 -1
  326. package/dist/chunk-GHEFKKRC.js.map +0 -1
  327. package/dist/chunk-HPLT3XRZ.js.map +0 -1
  328. package/dist/chunk-HZRIBOPW.js.map +0 -1
  329. package/dist/chunk-NPKAIW34.js.map +0 -1
  330. package/dist/chunk-Z3ELZ77W.js.map +0 -1
  331. package/dist/comments-panel-FYJE3U64.js.map +0 -1
  332. package/dist/directionality-XOHJFSL6.js.map +0 -1
  333. package/dist/emoticons-TP4N4ZGY.js.map +0 -1
  334. package/dist/insertdatetime-T4SEMQWP.js.map +0 -1
  335. package/dist/nonbreaking-HG5HV6AL.js.map +0 -1
  336. package/dist/quickbars-4NU4SIPL.js.map +0 -1
  337. package/dist/revisionhistory-3YQPLPLM.js.map +0 -1
  338. package/dist/visualblocks-RTAYJOGR.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugins/formatpainter.ts"],"sourcesContent":["import type { Mark, MarkType, Node as PMNode, NodeType } from 'prosemirror-model';\nimport type { EditorState, Transaction } from 'prosemirror-state';\nimport { keymap } from 'prosemirror-keymap';\nimport type { Editor } from '../editor';\nimport { definePlugin } from '../plugins';\nimport { icons } from '../ui/icons';\nimport { pickLabels } from './shared';\n\n/**\n * The formatpainter plugin (named as in TinyMCE): copy the formatting of one place and apply it to\n * another.\n *\n * - The `formatpainter` button copies the formatting at the cursor; the next selection made with the\n * mouse gets it, then the painter turns off. A double click keeps it on for several selections, until\n * the button again or Escape.\n * - Keyboard: Ctrl+Alt+C (⌘⌥C on a Mac) copies, Ctrl+Alt+V (⌘⌥V) applies to the selection; repeat as\n * often as needed.\n *\n * Copied: text formatting (bold, italic, underline, strikethrough, inline code, subscript, superscript,\n * text and background color, font, size, style classes) and the block's kind and layout (paragraph or\n * heading level, alignment, line height, indent). Links, comments and suggestions are not formatting:\n * they stay where they are. Block formatting is applied when the target is a cursor, several blocks or\n * a whole block; part of one block gets only the text formatting. A cursor in a word paints the word.\n */\n\nexport const LABELS = {\n en: {\n button: 'Format painter',\n copied: 'Format copied. Select the text to apply it to.',\n sticky: 'Format painter stays on. Press Escape to stop.',\n stored: 'Format copied',\n applied: 'Format applied',\n off: 'Format painter off',\n },\n};\n\n/** Marks that are formatting (copied and replaced); the rest (links, comments…) stay. */\nconst FORMAT_MARKS = [\n 'bold',\n 'italic',\n 'underline',\n 'strike',\n 'code',\n 'subscript',\n 'superscript',\n 'color',\n 'background',\n 'font_family',\n 'font_size',\n 'span_class',\n];\n/** Block attributes that are layout (copied with the block's kind). */\nconst BLOCK_ATTRS = ['align', 'lineHeight', 'indent'];\n\nexport interface CopiedFormat {\n marks: readonly Mark[];\n /** The source block's kind (paragraph, heading) and its layout attributes. */\n block: { type: NodeType; attrs: Record<string, unknown> } | null;\n}\n\nconst formatMarkTypes = (state: EditorState): MarkType[] =>\n FORMAT_MARKS.flatMap((name) => state.schema.marks[name] ?? []);\n\nconst isFormatMark = (mark: Mark) => FORMAT_MARKS.includes(mark.type.name);\n\n/** The formatting at the cursor, or of the first letter of the selection. */\nexport function copyFormat(state: EditorState): CopiedFormat {\n const { selection } = state;\n let marks: readonly Mark[] = selection.empty\n ? (state.storedMarks ?? selection.$from.marks())\n : [];\n if (!selection.empty) {\n state.doc.nodesBetween(selection.from, selection.to, (node) => {\n if (node.isText && !marks.length) marks = node.marks;\n return !marks.length;\n });\n }\n const source = selection.$from.parent;\n const block =\n source.isTextblock && !source.type.spec.code\n ? {\n type: source.type,\n attrs: Object.fromEntries(\n Object.entries(source.attrs).filter(\n ([key]) => key === 'level' || BLOCK_ATTRS.includes(key),\n ),\n ),\n }\n : null;\n return { marks: marks.filter(isFormatMark), block };\n}\n\n/** The word at a cursor, or null. */\nfunction wordAt(state: EditorState): { from: number; to: number } | null {\n const { $from } = state.selection;\n if (!$from.parent.isTextblock) return null;\n const text = $from.parent.textBetween(0, $from.parent.content.size, undefined, '\\ufffc');\n const word = /[\\p{L}\\p{N}\\p{M}'’]/u;\n let start = $from.parentOffset;\n let end = start;\n while (start > 0 && word.test(text[start - 1]!)) start--;\n while (end < text.length && word.test(text[end]!)) end++;\n return start === end ? null : { from: $from.start() + start, to: $from.start() + end };\n}\n\n/** The block's new kind and attributes, or null when it can't take the copied kind here. */\nfunction blockMarkup(\n tr: Transaction,\n pos: number,\n node: PMNode,\n block: NonNullable<CopiedFormat['block']>,\n): { type: NodeType; attrs: Record<string, unknown> } {\n const $pos = tr.doc.resolve(pos);\n const index = $pos.index();\n const canChange = $pos.parent.canReplaceWith(index, index + 1, block.type);\n const type = canChange ? block.type : node.type;\n const attrs: Record<string, unknown> = {};\n for (const key of Object.keys(type.spec.attrs ?? {})) {\n attrs[key] =\n key in block.attrs && (key !== 'level' || canChange) ? block.attrs[key] : node.attrs[key];\n }\n return { type, attrs };\n}\n\n/** Applies a copied format to the selection; null when there is nothing to change. */\nexport function applyFormat(state: EditorState, format: CopiedFormat): Transaction | null {\n const { selection } = state;\n const tr = state.tr;\n const range = selection.empty ? wordAt(state) : { from: selection.from, to: selection.to };\n if (range) {\n for (const type of formatMarkTypes(state)) tr.removeMark(range.from, range.to, type);\n for (const mark of format.marks) tr.addMark(range.from, range.to, mark);\n } else if (selection.empty) {\n // An empty line: what is typed next gets the format.\n const keep = (state.storedMarks ?? selection.$from.marks()).filter((m) => !isFormatMark(m));\n tr.setStoredMarks([...keep, ...format.marks]);\n }\n const { $from, $to } = selection;\n const wholeBlock =\n $from.sameParent($to) &&\n $from.parentOffset === 0 &&\n $to.parentOffset === $to.parent.content.size;\n if (format.block && (selection.empty || !$from.sameParent($to) || wholeBlock)) {\n const block = format.block;\n state.doc.nodesBetween(selection.from, selection.to, (node, pos) => {\n if (!node.isTextblock) return true;\n if (node.type.spec.code) return false;\n const mapped = tr.mapping.map(pos);\n const { type, attrs } = blockMarkup(tr, mapped, node, block);\n const same =\n type === node.type && Object.keys(attrs).every((key) => attrs[key] === node.attrs[key]);\n if (!same) tr.setNodeMarkup(mapped, type, attrs, node.marks);\n return false;\n });\n }\n return tr.docChanged || tr.storedMarksSet ? tr.scrollIntoView() : null;\n}\n\ntype Mode = 'off' | 'once' | 'sticky';\n\n/** The painter of one editor: shared by its keys (created first) and its button. */\ninterface Painter {\n format: CopiedFormat | null;\n mode: Mode;\n armedAt: number;\n}\n\nconst painters = new WeakMap<Editor, Painter>();\n\nfunction painterOf(editor: Editor): Painter {\n let painter = painters.get(editor);\n if (!painter) {\n painter = { format: null, mode: 'off', armedAt: 0 };\n painters.set(editor, painter);\n }\n return painter;\n}\n\nfunction setMode(editor: Editor, mode: Mode): void {\n painterOf(editor).mode = mode;\n editor.view.dom.style.cursor = mode === 'off' ? '' : 'copy';\n editor.updateUI();\n}\n\nfunction paint(editor: Editor): boolean {\n const { format } = painterOf(editor);\n if (!format) return false;\n const tr = applyFormat(editor.view.state, format);\n if (tr) editor.view.dispatch(tr);\n editor.ui.announce(pickLabels(editor, 'formatpainter', LABELS).applied);\n return true;\n}\n\nexport default definePlugin({\n name: 'formatpainter',\n toolbar: 'formatpainter',\n prosemirrorPlugins: (editor) => [\n keymap({\n 'Mod-Alt-c': (state) => {\n painterOf(editor).format = copyFormat(state);\n editor.ui.announce(pickLabels(editor, 'formatpainter', LABELS).stored);\n return true;\n },\n 'Mod-Alt-v': () => editor.isEditable() && paint(editor),\n Escape: () => {\n if (painterOf(editor).mode === 'off') return false;\n setMode(editor, 'off');\n editor.ui.announce(pickLabels(editor, 'formatpainter', LABELS).off);\n return true;\n },\n }),\n ],\n setup(editor: Editor) {\n const labels = pickLabels(editor, 'formatpainter', LABELS);\n const painter = painterOf(editor);\n\n const onMouseUp = () => {\n if (painter.mode === 'off') return;\n // After mouseup the browser still finishes the selection: let ProseMirror read it first.\n setTimeout(() => {\n if (painter.mode === 'off' || !editor.view.dom.isConnected) return;\n paint(editor);\n if (painter.mode === 'once') setMode(editor, 'off');\n }, 0);\n };\n editor.view.dom.addEventListener('mouseup', onMouseUp);\n\n /** On (copying the format at the cursor) or off. */\n const toggle = (e: Editor) => {\n if (painter.mode !== 'off') {\n setMode(e, 'off');\n e.ui.announce(labels.off);\n } else {\n painter.format = copyFormat(e.view.state);\n painter.armedAt = Date.now();\n setMode(e, 'once');\n e.ui.announce(labels.copied);\n }\n e.focus();\n };\n const isActive = () => painter.mode !== 'off';\n const isEnabled = (e: Editor) => e.isEditable();\n\n editor.ui.registry.addButton('formatpainter', {\n icon: icons.formatPainter,\n tooltip: labels.button,\n isActive,\n isEnabled,\n onAction: (e) => {\n if (painter.mode === 'once' && Date.now() - painter.armedAt < 500) {\n // The second click of a double click: keep painting.\n setMode(e, 'sticky');\n e.ui.announce(labels.sticky);\n e.focus();\n } else toggle(e);\n },\n });\n // The menu item (and mceToggleFormatPainter) is a plain on/off: a menu has no double click.\n editor.ui.registry.addMenuItem('formatpainter', {\n text: labels.button,\n icon: icons.formatPainter,\n isActive,\n isEnabled,\n onAction: toggle,\n });\n\n return () => {\n editor.view.dom.removeEventListener('mouseup', onMouseUp);\n painters.delete(editor);\n };\n },\n});\n"],"mappings":";;;;;;;;;;;;AAEA,SAAS,cAAc;AAuBhB,IAAM,SAAS;AAAA,EACpB,IAAI;AAAA,IACF,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,KAAK;AAAA,EACP;AACF;AAGA,IAAM,eAAe;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,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AG,SAAS,OAAO,GAAG;AAAA,MAC1B,OAAO;AACL,gBAAQ,SAAS,WAAW,EAAE,KAAK,KAAK;AACxC,gBAAQ,UAAU,KAAK,IAAI;AAC3B,gBAAQ,GAAG,MAAM;AACjB,UAAE,GAAG,SAAS,OAAO,MAAM;AAAA,MAC7B;AACA,QAAE,MAAM;AAAA,IACV;AACA,UAAM,WAAW,MAAM,QAAQ,SAAS;AACxC,UAAM,YAAY,CAAC,MAAc,EAAE,WAAW;AAE9C,WAAO,GAAG,SAAS,UAAU,iBAAiB;AAAA,MAC5C,MAAM,MAAM;AAAA,MACZ,SAAS,OAAO;AAAA,MAChB;AAAA,MACA;AAAA,MACA,UAAU,CAAC,MAAM;AACf,YAAI,QAAQ,SAAS,UAAU,KAAK,IAAI,IAAI,QAAQ,UAAU,KAAK;AAEjE,kBAAQ,GAAG,QAAQ;AACnB,YAAE,GAAG,SAAS,OAAO,MAAM;AAC3B,YAAE,MAAM;AAAA,QACV,MAAO,QAAO,CAAC;AAAA,MACjB;AAAA,IACF,CAAC;AAED,WAAO,GAAG,SAAS,YAAY,iBAAiB;AAAA,MAC9C,MAAM,OAAO;AAAA,MACb,MAAM,MAAM;AAAA,MACZ;AAAA,MACA;AAAA,MACA,UAAU;AAAA,IACZ,CAAC;AAED,WAAO,MAAM;AACX,aAAO,KAAK,IAAI,oBAAoB,WAAW,SAAS;AACxD,eAAS,OAAO,MAAM;AAAA,IACxB;AAAA,EACF;AACF,CAAC;","names":[]}
@@ -0,0 +1,220 @@
1
+ import {
2
+ cleanPage
3
+ } from "./chunk-AQV6FIKK.js";
4
+ import "./chunk-53AY5NAF.js";
5
+ import "./chunk-TAM2FHKG.js";
6
+ import "./chunk-XR7CY4NI.js";
7
+ import {
8
+ pickLabels
9
+ } from "./chunk-DEYYVZ7O.js";
10
+ import {
11
+ definePlugin
12
+ } from "./chunk-V7WUHUHM.js";
13
+ import "./chunk-QU3KXMYT.js";
14
+ import "./chunk-G74HNSB6.js";
15
+ import "./chunk-3BOK3S3T.js";
16
+ import "./chunk-4VPDY3LF.js";
17
+
18
+ // src/plugins/fullpagehtml-ui.ts
19
+ var ICON = '<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/><path d="M9 13h6"/><path d="M9 17h4"/></svg>';
20
+ var LABELS = {
21
+ en: {
22
+ title: "Document properties",
23
+ tabAbout: "About the page",
24
+ tabSearch: "Language and search",
25
+ pageTitle: "Title",
26
+ pageTitleHint: "Shown on the browser tab and in search results.",
27
+ description: "Description",
28
+ descriptionHint: "Search engines may show it under the title.",
29
+ keywords: "Keywords",
30
+ keywordsHint: "Separated by commas.",
31
+ author: "Author",
32
+ language: "Language",
33
+ languageHint: "A language code, such as en or de-CH: screen readers use it.",
34
+ languageInvalid: "Enter a language code, such as en or pt-BR.",
35
+ robots: "Search engines",
36
+ robotsAll: "Show the page and follow its links",
37
+ robotsNoFollow: "Show the page, don\u2019t follow its links",
38
+ robotsNoIndex: "Don\u2019t show the page, follow its links",
39
+ robotsNone: "Don\u2019t show the page or follow its links",
40
+ encoding: "Character encoding",
41
+ encodingNone: "Not declared"
42
+ }
43
+ };
44
+ var LANG_RE = /^[a-z]{1,8}(?:-[a-z0-9]{1,8}){0,4}$/i;
45
+ var isMeta = (el, name) => el.tag === "meta" && el.attrs.name?.toLowerCase() === name;
46
+ function metaContent(page, name) {
47
+ const el = page.head?.find((item) => isMeta(item, name));
48
+ return el && el.tag === "meta" ? el.attrs.content ?? "" : "";
49
+ }
50
+ function withMeta(head, name, content) {
51
+ const at = head.findIndex((el2) => isMeta(el2, name));
52
+ if (!content) return at < 0 ? head : head.filter((_, i) => i !== at);
53
+ const el = { tag: "meta", attrs: { name, content } };
54
+ return at < 0 ? [...head, el] : head.map((old, i) => i === at ? el : old);
55
+ }
56
+ var isCharset = (el) => el.tag === "meta" && (!!el.attrs.charset || el.attrs["http-equiv"]?.toLowerCase() === "content-type");
57
+ function charsetOf(page) {
58
+ const el = page.head?.find(isCharset);
59
+ if (!el || el.tag !== "meta") return "";
60
+ return el.attrs.charset ?? /charset=([\w.:-]+)/i.exec(el.attrs.content ?? "")?.[1] ?? "";
61
+ }
62
+ function withCharset(head, charset) {
63
+ const rest = head.filter((el) => !isCharset(el));
64
+ return charset ? [{ tag: "meta", attrs: { charset } }, ...rest] : rest;
65
+ }
66
+ function titleOf(page) {
67
+ const el = page.head?.find((item) => item.tag === "title");
68
+ return el?.tag === "title" ? el.text : "";
69
+ }
70
+ function withTitle(head, text) {
71
+ const at = head.findIndex((el2) => el2.tag === "title");
72
+ if (!text) return at < 0 ? head : head.filter((_, i) => i !== at);
73
+ const el = { tag: "title", text };
74
+ if (at >= 0) return head.map((old, i) => i === at ? el : old);
75
+ const after = head.findIndex((item) => !isCharset(item));
76
+ const index = after < 0 ? head.length : after;
77
+ return [...head.slice(0, index), el, ...head.slice(index)];
78
+ }
79
+ function robotsOf(page) {
80
+ const words = metaContent(page, "robots").toLowerCase().split(/[\s,]+/).filter(Boolean);
81
+ const none = words.includes("none");
82
+ return {
83
+ index: !none && !words.includes("noindex"),
84
+ follow: !none && !words.includes("nofollow"),
85
+ other: words.filter(
86
+ (w) => !["none", "noindex", "nofollow", "index", "follow", "all"].includes(w)
87
+ )
88
+ };
89
+ }
90
+ var ROBOTS = ["all", "nofollow", "noindex", "none"];
91
+ var fullpagehtml_ui_default = definePlugin({
92
+ name: "fullpagehtml-ui",
93
+ requires: ["fullpagehtml"],
94
+ setup(editor) {
95
+ const labels = pickLabels(editor, "fullpagehtml", LABELS);
96
+ const open = async () => {
97
+ const page = cleanPage(editor.view.state.doc.attrs.page);
98
+ const robots = robotsOf(page);
99
+ const charset = charsetOf(page);
100
+ const data = await editor.ui.dialog({
101
+ title: labels.title,
102
+ initialData: {
103
+ title: titleOf(page),
104
+ description: metaContent(page, "description"),
105
+ keywords: metaContent(page, "keywords"),
106
+ author: metaContent(page, "author"),
107
+ lang: page.html?.lang ?? "",
108
+ robots: robots.index ? robots.follow ? "all" : "nofollow" : robots.follow ? "noindex" : "none",
109
+ encoding: charset
110
+ },
111
+ // Two short tabs rather than one long form: the dialog fits a laptop's screen.
112
+ tabs: [
113
+ {
114
+ title: labels.tabAbout,
115
+ fields: [
116
+ {
117
+ type: "text",
118
+ name: "title",
119
+ label: labels.pageTitle,
120
+ hint: labels.pageTitleHint
121
+ },
122
+ {
123
+ type: "textarea",
124
+ name: "description",
125
+ label: labels.description,
126
+ hint: labels.descriptionHint,
127
+ rows: 3
128
+ },
129
+ {
130
+ type: "text",
131
+ name: "keywords",
132
+ label: labels.keywords,
133
+ hint: labels.keywordsHint
134
+ },
135
+ { type: "text", name: "author", label: labels.author }
136
+ ]
137
+ },
138
+ {
139
+ title: labels.tabSearch,
140
+ fields: [
141
+ {
142
+ type: "text",
143
+ name: "lang",
144
+ label: labels.language,
145
+ hint: labels.languageHint,
146
+ validate: (value2) => typeof value2 === "string" && value2.trim() && !LANG_RE.test(value2.trim()) ? labels.languageInvalid : null
147
+ },
148
+ {
149
+ type: "select",
150
+ name: "robots",
151
+ label: labels.robots,
152
+ options: [
153
+ { value: "all", label: labels.robotsAll },
154
+ { value: "nofollow", label: labels.robotsNoFollow },
155
+ { value: "noindex", label: labels.robotsNoIndex },
156
+ { value: "none", label: labels.robotsNone }
157
+ ]
158
+ },
159
+ {
160
+ type: "select",
161
+ name: "encoding",
162
+ label: labels.encoding,
163
+ // The page's own encoding as it is written, and UTF-8.
164
+ options: [
165
+ { value: "", label: labels.encodingNone },
166
+ ...charset ? [{ value: charset, label: charset }] : [],
167
+ ...charset.toUpperCase() !== "UTF-8" ? [{ value: "UTF-8", label: "UTF-8" }] : []
168
+ ]
169
+ }
170
+ ]
171
+ }
172
+ ]
173
+ });
174
+ if (!data) return;
175
+ const value = (name) => typeof data[name] === "string" ? data[name].replace(/\s+/g, " ").trim() : "";
176
+ let head = page.head ?? [];
177
+ if (value("encoding") !== charset) head = withCharset(head, value("encoding"));
178
+ head = withTitle(head, value("title"));
179
+ head = withMeta(head, "description", value("description"));
180
+ head = withMeta(head, "keywords", value("keywords"));
181
+ head = withMeta(head, "author", value("author"));
182
+ const choice = ROBOTS.includes(data.robots) ? data.robots : "all";
183
+ const words = [
184
+ ...choice === "noindex" || choice === "none" ? ["noindex"] : [],
185
+ ...choice === "nofollow" || choice === "none" ? ["nofollow"] : [],
186
+ ...robots.other
187
+ ];
188
+ head = withMeta(head, "robots", words.join(", "));
189
+ const lang = value("lang");
190
+ const html = { ...page.html };
191
+ if (lang) html.lang = lang;
192
+ else delete html.lang;
193
+ const next = cleanPage({ ...page, html, head });
194
+ if (JSON.stringify(next) !== JSON.stringify(cleanPage(editor.view.state.doc.attrs.page))) {
195
+ editor.view.dispatch(editor.view.state.tr.setDocAttribute("page", next));
196
+ }
197
+ editor.focus();
198
+ };
199
+ editor.ui.registry.addButton("fullpagehtml", {
200
+ icon: ICON,
201
+ tooltip: labels.title,
202
+ isEnabled: (e) => e.isEditable(),
203
+ onAction: () => void open()
204
+ });
205
+ editor.ui.registry.addMenuItem("fullpagehtml", {
206
+ text: labels.title,
207
+ icon: ICON,
208
+ isEnabled: (e) => e.isEditable(),
209
+ onAction: () => void open()
210
+ });
211
+ }
212
+ });
213
+ export {
214
+ LABELS,
215
+ charsetOf,
216
+ fullpagehtml_ui_default as default,
217
+ metaContent,
218
+ titleOf
219
+ };
220
+ //# sourceMappingURL=fullpagehtml-ui-RE4C2NO5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugins/fullpagehtml-ui.ts"],"sourcesContent":["import { definePlugin } from '../plugins';\nimport { cleanPage, type HeadElement, type PageData } from './fullpagehtml';\nimport { pickLabels } from './shared';\n\n/** The lazy part of fullpagehtml: the Document properties dialog, its button and menu item. */\n\nconst ICON =\n '<svg viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z\"/><path d=\"M14 3v5h5\"/><path d=\"M9 13h6\"/><path d=\"M9 17h4\"/></svg>';\n\nexport const LABELS = {\n en: {\n title: 'Document properties',\n tabAbout: 'About the page',\n tabSearch: 'Language and search',\n pageTitle: 'Title',\n pageTitleHint: 'Shown on the browser tab and in search results.',\n description: 'Description',\n descriptionHint: 'Search engines may show it under the title.',\n keywords: 'Keywords',\n keywordsHint: 'Separated by commas.',\n author: 'Author',\n language: 'Language',\n languageHint: 'A language code, such as en or de-CH: screen readers use it.',\n languageInvalid: 'Enter a language code, such as en or pt-BR.',\n robots: 'Search engines',\n robotsAll: 'Show the page and follow its links',\n robotsNoFollow: 'Show the page, don’t follow its links',\n robotsNoIndex: 'Don’t show the page, follow its links',\n robotsNone: 'Don’t show the page or follow its links',\n encoding: 'Character encoding',\n encodingNone: 'Not declared',\n },\n};\n\nconst LANG_RE = /^[a-z]{1,8}(?:-[a-z0-9]{1,8}){0,4}$/i;\n\ntype Head = HeadElement[];\n\nconst isMeta = (el: HeadElement, name: string) =>\n el.tag === 'meta' && el.attrs.name?.toLowerCase() === name;\n\n/** The content of <meta name=\"…\">. */\nexport function metaContent(page: PageData, name: string): string {\n const el = page.head?.find((item) => isMeta(item, name));\n return el && el.tag === 'meta' ? (el.attrs.content ?? '') : '';\n}\n\n/** The head with <meta name=\"…\"> set to `content` (removed when empty), in its place or at the end. */\nfunction withMeta(head: Head, name: string, content: string): Head {\n const at = head.findIndex((el) => isMeta(el, name));\n if (!content) return at < 0 ? head : head.filter((_, i) => i !== at);\n const el: HeadElement = { tag: 'meta', attrs: { name, content } };\n return at < 0 ? [...head, el] : head.map((old, i) => (i === at ? el : old));\n}\n\nconst isCharset = (el: HeadElement) =>\n el.tag === 'meta' &&\n (!!el.attrs.charset || el.attrs['http-equiv']?.toLowerCase() === 'content-type');\n\nexport function charsetOf(page: PageData): string {\n const el = page.head?.find(isCharset);\n if (!el || el.tag !== 'meta') return '';\n return el.attrs.charset ?? /charset=([\\w.:-]+)/i.exec(el.attrs.content ?? '')?.[1] ?? '';\n}\n\nfunction withCharset(head: Head, charset: string): Head {\n const rest = head.filter((el) => !isCharset(el));\n return charset ? [{ tag: 'meta', attrs: { charset } }, ...rest] : rest;\n}\n\nexport function titleOf(page: PageData): string {\n const el = page.head?.find((item) => item.tag === 'title');\n return el?.tag === 'title' ? el.text : '';\n}\n\n/** The head with its title (removed when empty), in its place or after the character encoding. */\nfunction withTitle(head: Head, text: string): Head {\n const at = head.findIndex((el) => el.tag === 'title');\n if (!text) return at < 0 ? head : head.filter((_, i) => i !== at);\n const el: HeadElement = { tag: 'title', text };\n if (at >= 0) return head.map((old, i) => (i === at ? el : old));\n const after = head.findIndex((item) => !isCharset(item));\n const index = after < 0 ? head.length : after;\n return [...head.slice(0, index), el, ...head.slice(index)];\n}\n\n/** noindex and nofollow from <meta name=\"robots\">; its other words are kept. */\nfunction robotsOf(page: PageData): { index: boolean; follow: boolean; other: string[] } {\n const words = metaContent(page, 'robots')\n .toLowerCase()\n .split(/[\\s,]+/)\n .filter(Boolean);\n const none = words.includes('none');\n return {\n index: !none && !words.includes('noindex'),\n follow: !none && !words.includes('nofollow'),\n other: words.filter(\n (w) => !['none', 'noindex', 'nofollow', 'index', 'follow', 'all'].includes(w),\n ),\n };\n}\n\nconst ROBOTS = ['all', 'nofollow', 'noindex', 'none'] as const;\n\nexport default definePlugin({\n name: 'fullpagehtml-ui',\n requires: ['fullpagehtml'],\n setup(editor) {\n const labels = pickLabels(editor, 'fullpagehtml', LABELS);\n\n const open = async () => {\n const page = cleanPage(editor.view.state.doc.attrs.page);\n const robots = robotsOf(page);\n const charset = charsetOf(page);\n const data = await editor.ui.dialog({\n title: labels.title,\n initialData: {\n title: titleOf(page),\n description: metaContent(page, 'description'),\n keywords: metaContent(page, 'keywords'),\n author: metaContent(page, 'author'),\n lang: page.html?.lang ?? '',\n robots: robots.index\n ? robots.follow\n ? 'all'\n : 'nofollow'\n : robots.follow\n ? 'noindex'\n : 'none',\n encoding: charset,\n },\n // Two short tabs rather than one long form: the dialog fits a laptop's screen.\n tabs: [\n {\n title: labels.tabAbout,\n fields: [\n {\n type: 'text',\n name: 'title',\n label: labels.pageTitle,\n hint: labels.pageTitleHint,\n },\n {\n type: 'textarea',\n name: 'description',\n label: labels.description,\n hint: labels.descriptionHint,\n rows: 3,\n },\n {\n type: 'text',\n name: 'keywords',\n label: labels.keywords,\n hint: labels.keywordsHint,\n },\n { type: 'text', name: 'author', label: labels.author },\n ],\n },\n {\n title: labels.tabSearch,\n fields: [\n {\n type: 'text',\n name: 'lang',\n label: labels.language,\n hint: labels.languageHint,\n validate: (value) =>\n typeof value === 'string' && value.trim() && !LANG_RE.test(value.trim())\n ? labels.languageInvalid\n : null,\n },\n {\n type: 'select',\n name: 'robots',\n label: labels.robots,\n options: [\n { value: 'all', label: labels.robotsAll },\n { value: 'nofollow', label: labels.robotsNoFollow },\n { value: 'noindex', label: labels.robotsNoIndex },\n { value: 'none', label: labels.robotsNone },\n ],\n },\n {\n type: 'select',\n name: 'encoding',\n label: labels.encoding,\n // The page's own encoding as it is written, and UTF-8.\n options: [\n { value: '', label: labels.encodingNone },\n ...(charset ? [{ value: charset, label: charset }] : []),\n ...(charset.toUpperCase() !== 'UTF-8'\n ? [{ value: 'UTF-8', label: 'UTF-8' }]\n : []),\n ],\n },\n ],\n },\n ],\n });\n if (!data) return;\n const value = (name: string) =>\n typeof data[name] === 'string' ? (data[name] as string).replace(/\\s+/g, ' ').trim() : '';\n let head: Head = page.head ?? [];\n // Unchanged, the page's own way of saying it stays.\n if (value('encoding') !== charset) head = withCharset(head, value('encoding'));\n head = withTitle(head, value('title'));\n head = withMeta(head, 'description', value('description'));\n head = withMeta(head, 'keywords', value('keywords'));\n head = withMeta(head, 'author', value('author'));\n const choice = ROBOTS.includes(data.robots as (typeof ROBOTS)[number])\n ? (data.robots as (typeof ROBOTS)[number])\n : 'all';\n const words = [\n ...(choice === 'noindex' || choice === 'none' ? ['noindex'] : []),\n ...(choice === 'nofollow' || choice === 'none' ? ['nofollow'] : []),\n ...robots.other,\n ];\n head = withMeta(head, 'robots', words.join(', '));\n const lang = value('lang');\n const html = { ...page.html };\n if (lang) html.lang = lang;\n else delete html.lang;\n const next = cleanPage({ ...page, html, head });\n if (JSON.stringify(next) !== JSON.stringify(cleanPage(editor.view.state.doc.attrs.page))) {\n editor.view.dispatch(editor.view.state.tr.setDocAttribute('page', next));\n }\n editor.focus();\n };\n\n editor.ui.registry.addButton('fullpagehtml', {\n icon: ICON,\n tooltip: labels.title,\n isEnabled: (e) => e.isEditable(),\n onAction: () => void open(),\n });\n editor.ui.registry.addMenuItem('fullpagehtml', {\n text: labels.title,\n icon: ICON,\n isEnabled: (e) => e.isEditable(),\n onAction: () => void open(),\n });\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAMA,IAAM,OACJ;AAEK,IAAM,SAAS;AAAA,EACpB,IAAI;AAAA,IACF,OAAO;AAAA,IACP,UAAU;AAAA,IACV,WAAW;AAAA,IACX,WAAW;AAAA,IACX,eAAe;AAAA,IACf,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,UAAU;AAAA,IACV,cAAc;AAAA,IACd,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,gBAAgB;AAAA,IAChB,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,cAAc;AAAA,EAChB;AACF;AAEA,IAAM,UAAU;AAIhB,IAAM,SAAS,CAAC,IAAiB,SAC/B,GAAG,QAAQ,UAAU,GAAG,MAAM,MAAM,YAAY,MAAM;AAGjD,SAAS,YAAY,MAAgB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AW,cAAc,WAAW,SAAS,CAAC,UAAU,IAAI,CAAC;AAAA,QACjE,GAAG,OAAO;AAAA,MACZ;AACA,aAAO,SAAS,MAAM,UAAU,MAAM,KAAK,IAAI,CAAC;AAChD,YAAM,OAAO,MAAM,MAAM;AACzB,YAAM,OAAO,EAAE,GAAG,KAAK,KAAK;AAC5B,UAAI,KAAM,MAAK,OAAO;AAAA,UACjB,QAAO,KAAK;AACjB,YAAM,OAAO,UAAU,EAAE,GAAG,MAAM,MAAM,KAAK,CAAC;AAC9C,UAAI,KAAK,UAAU,IAAI,MAAM,KAAK,UAAU,UAAU,OAAO,KAAK,MAAM,IAAI,MAAM,IAAI,CAAC,GAAG;AACxF,eAAO,KAAK,SAAS,OAAO,KAAK,MAAM,GAAG,gBAAgB,QAAQ,IAAI,CAAC;AAAA,MACzE;AACA,aAAO,MAAM;AAAA,IACf;AAEA,WAAO,GAAG,SAAS,UAAU,gBAAgB;AAAA,MAC3C,MAAM;AAAA,MACN,SAAS,OAAO;AAAA,MAChB,WAAW,CAAC,MAAM,EAAE,WAAW;AAAA,MAC/B,UAAU,MAAM,KAAK,KAAK;AAAA,IAC5B,CAAC;AACD,WAAO,GAAG,SAAS,YAAY,gBAAgB;AAAA,MAC7C,MAAM,OAAO;AAAA,MACb,MAAM;AAAA,MACN,WAAW,CAAC,MAAM,EAAE,WAAW;AAAA,MAC/B,UAAU,MAAM,KAAK,KAAK;AAAA,IAC5B,CAAC;AAAA,EACH;AACF,CAAC;","names":["el","value"]}
@@ -0,0 +1,42 @@
1
+ import { NodeSpec, MarkSpec, Schema } from 'prosemirror-model';
2
+
3
+ /**
4
+ * The hook for element and attribute rules. The implementation is a separate import,
5
+ * `@novaprose/core/html-rules` (~3 KB gzip): few need it, so it isn't part of the first load.
6
+ *
7
+ * import { registerHtmlRules } from '@novaprose/core';
8
+ * import { htmlRules } from '@novaprose/core/html-rules';
9
+ * registerHtmlRules(htmlRules);
10
+ */
11
+ interface HtmlRulesOptions {
12
+ /** Only these elements are allowed; attributes in [...] are the complete list for the element. */
13
+ validElements?: string;
14
+ /** More elements and attributes: 'div[class],h2[id],i[class],a[href|rel|data-*]'. */
15
+ extendedValidElements?: string;
16
+ /** Disallowed elements. */
17
+ invalidElements?: string;
18
+ /** Your own elements: 'my-widget,~my-chip' (~ — inline, like span; without ~ — a block, like div). */
19
+ customElements?: string;
20
+ }
21
+ /** The node and mark specs the document schema is built from; HTML rules change them before that. */
22
+ interface SchemaSpecs {
23
+ nodes: Record<string, NodeSpec>;
24
+ marks: Record<string, MarkSpec>;
25
+ }
26
+ /** The rules of one editor: they change the schema specs. */
27
+ interface HtmlRulesInstance {
28
+ /** Whether the rules allow class on a built-in element (then classes are kept). */
29
+ readonly classOnBuiltIn: boolean;
30
+ /** Specs with the rules applied; after the schema is created, store it in `ref.schema`. */
31
+ apply(specs: SchemaSpecs, ref: {
32
+ schema?: Schema;
33
+ }): SchemaSpecs;
34
+ }
35
+ interface HtmlRulesModule {
36
+ create(options: HtmlRulesOptions): HtmlRulesInstance | null;
37
+ }
38
+ /** Install the element and attribute rules (once per page). */
39
+ declare function registerHtmlRules(module: HtmlRulesModule): void;
40
+
41
+ export { registerHtmlRules as r };
42
+ export type { HtmlRulesInstance as H, SchemaSpecs as S, HtmlRulesOptions as a, HtmlRulesModule as b };
@@ -0,0 +1,42 @@
1
+ import { NodeSpec, MarkSpec, Schema } from 'prosemirror-model';
2
+
3
+ /**
4
+ * The hook for element and attribute rules. The implementation is a separate import,
5
+ * `@novaprose/core/html-rules` (~3 KB gzip): few need it, so it isn't part of the first load.
6
+ *
7
+ * import { registerHtmlRules } from '@novaprose/core';
8
+ * import { htmlRules } from '@novaprose/core/html-rules';
9
+ * registerHtmlRules(htmlRules);
10
+ */
11
+ interface HtmlRulesOptions {
12
+ /** Only these elements are allowed; attributes in [...] are the complete list for the element. */
13
+ validElements?: string;
14
+ /** More elements and attributes: 'div[class],h2[id],i[class],a[href|rel|data-*]'. */
15
+ extendedValidElements?: string;
16
+ /** Disallowed elements. */
17
+ invalidElements?: string;
18
+ /** Your own elements: 'my-widget,~my-chip' (~ — inline, like span; without ~ — a block, like div). */
19
+ customElements?: string;
20
+ }
21
+ /** The node and mark specs the document schema is built from; HTML rules change them before that. */
22
+ interface SchemaSpecs {
23
+ nodes: Record<string, NodeSpec>;
24
+ marks: Record<string, MarkSpec>;
25
+ }
26
+ /** The rules of one editor: they change the schema specs. */
27
+ interface HtmlRulesInstance {
28
+ /** Whether the rules allow class on a built-in element (then classes are kept). */
29
+ readonly classOnBuiltIn: boolean;
30
+ /** Specs with the rules applied; after the schema is created, store it in `ref.schema`. */
31
+ apply(specs: SchemaSpecs, ref: {
32
+ schema?: Schema;
33
+ }): SchemaSpecs;
34
+ }
35
+ interface HtmlRulesModule {
36
+ create(options: HtmlRulesOptions): HtmlRulesInstance | null;
37
+ }
38
+ /** Install the element and attribute rules (once per page). */
39
+ declare function registerHtmlRules(module: HtmlRulesModule): void;
40
+
41
+ export { registerHtmlRules as r };
42
+ export type { HtmlRulesInstance as H, SchemaSpecs as S, HtmlRulesOptions as a, HtmlRulesModule as b };