@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,206 @@
1
+ import {
2
+ defaultFontFamilies,
3
+ defaultFontSizes
4
+ } from "./chunk-6YSQGFV7.js";
5
+ import "./chunk-IG2BL4ON.js";
6
+ import "./chunk-J6W2CDRF.js";
7
+ import "./chunk-GHVB6SV4.js";
8
+ import "./chunk-23ZLVT5D.js";
9
+ import "./chunk-FTEA6L2Q.js";
10
+ import "./chunk-MZGNOHSY.js";
11
+ import "./chunk-AC3YCAX4.js";
12
+ import "./chunk-HNEAVVBC.js";
13
+ import "./chunk-TAM2FHKG.js";
14
+ import "./chunk-XR7CY4NI.js";
15
+ import {
16
+ icons
17
+ } from "./chunk-ADRPQLZ2.js";
18
+ import {
19
+ pickLabels
20
+ } from "./chunk-DEYYVZ7O.js";
21
+ import {
22
+ definePlugin
23
+ } from "./chunk-V7WUHUHM.js";
24
+ import "./chunk-QU3KXMYT.js";
25
+ import "./chunk-G74HNSB6.js";
26
+ import "./chunk-4VPDY3LF.js";
27
+
28
+ // src/plugins/permanentpen.ts
29
+ import { Mark } from "prosemirror-model";
30
+ import { Plugin } from "prosemirror-state";
31
+ var LABELS = {
32
+ en: {
33
+ button: "Permanent pen",
34
+ configure: "Permanent pen properties",
35
+ highlight: "Highlight the text",
36
+ on: "Permanent pen on",
37
+ off: "Permanent pen off"
38
+ }
39
+ };
40
+ var DEFAULT_PEN = { forecolor: "#C0392B", bold: true };
41
+ var PEN_MARKS = [
42
+ "bold",
43
+ "italic",
44
+ "underline",
45
+ "strike",
46
+ "color",
47
+ "background",
48
+ "font_family",
49
+ "font_size"
50
+ ];
51
+ function penMarks(schema, pen) {
52
+ const marks = [];
53
+ const add = (name, attrs) => {
54
+ const type = schema.marks[name];
55
+ if (type) marks.push(type.create(attrs));
56
+ };
57
+ if (pen.bold) add("bold");
58
+ if (pen.italic) add("italic");
59
+ if (pen.underline) add("underline");
60
+ if (pen.strikethrough) add("strike");
61
+ if (typeof pen.forecolor === "string" && pen.forecolor) add("color", { value: pen.forecolor });
62
+ if (typeof pen.hilitecolor === "string" && pen.hilitecolor)
63
+ add("background", { value: pen.hilitecolor });
64
+ if (typeof pen.fontname === "string" && pen.fontname) add("font_family", { value: pen.fontname });
65
+ if (typeof pen.fontsize === "string" && pen.fontsize) add("font_size", { value: pen.fontsize });
66
+ return Mark.setFrom(marks);
67
+ }
68
+ function marksForCursor(state, pen) {
69
+ const current = state.storedMarks ?? state.selection.$from.marks();
70
+ const keep = current.filter((mark) => !PEN_MARKS.includes(mark.type.name));
71
+ return Mark.setFrom([...keep, ...pen ?? []]);
72
+ }
73
+ var pens = /* @__PURE__ */ new WeakMap();
74
+ function penOf(editor) {
75
+ let pen = pens.get(editor);
76
+ if (!pen) {
77
+ const options = editor.options.pluginOptions?.permanentpen ?? {};
78
+ const properties = options.properties && typeof options.properties === "object" ? { ...options.properties } : { ...DEFAULT_PEN };
79
+ pen = { active: false, properties };
80
+ pens.set(editor, pen);
81
+ }
82
+ return pen;
83
+ }
84
+ function applyToCursor(editor) {
85
+ const { state } = editor.view;
86
+ if (!state.selection.empty) return;
87
+ const pen = penOf(editor);
88
+ const marks = marksForCursor(state, pen.active ? penMarks(state.schema, pen.properties) : null);
89
+ editor.view.dispatch(state.tr.setStoredMarks(marks));
90
+ }
91
+ async function configure(editor) {
92
+ const { t } = editor.ui;
93
+ const labels = pickLabels(editor, "permanentpen", LABELS);
94
+ const pen = penOf(editor);
95
+ const current = pen.properties;
96
+ const families = editor.options.fontFamilies ?? defaultFontFamilies;
97
+ const fontOptions = [
98
+ { value: "", label: t("default") },
99
+ ...families.map((family) => ({ value: family.value, label: family.label }))
100
+ ];
101
+ if (current.fontname && !fontOptions.some((option) => option.value === current.fontname)) {
102
+ fontOptions.push({ value: current.fontname, label: current.fontname });
103
+ }
104
+ const sizes = editor.options.fontSizes ?? defaultFontSizes;
105
+ const sizeOptions = [
106
+ { value: "", label: t("default") },
107
+ ...sizes.map((size) => ({ value: size, label: size }))
108
+ ];
109
+ if (current.fontsize && !sizeOptions.some((option) => option.value === current.fontsize)) {
110
+ sizeOptions.push({ value: current.fontsize, label: current.fontsize });
111
+ }
112
+ const fields = [
113
+ { type: "select", name: "fontname", label: t("fontFamily"), options: fontOptions },
114
+ { type: "select", name: "fontsize", label: t("fontSize"), options: sizeOptions },
115
+ { type: "checkbox", name: "bold", label: t("bold") },
116
+ { type: "checkbox", name: "italic", label: t("italic") },
117
+ { type: "checkbox", name: "underline", label: t("underline") },
118
+ { type: "checkbox", name: "strikethrough", label: t("strike") },
119
+ { type: "color", name: "forecolor", label: t("textColor") },
120
+ { type: "checkbox", name: "highlight", label: labels.highlight },
121
+ {
122
+ type: "color",
123
+ name: "hilitecolor",
124
+ label: t("backgroundColor"),
125
+ disabled: !current.hilitecolor
126
+ }
127
+ ];
128
+ const data = await editor.ui.dialog({
129
+ title: labels.configure,
130
+ fields,
131
+ initialData: {
132
+ fontname: current.fontname ?? "",
133
+ fontsize: current.fontsize ?? "",
134
+ bold: !!current.bold,
135
+ italic: !!current.italic,
136
+ underline: !!current.underline,
137
+ strikethrough: !!current.strikethrough,
138
+ forecolor: current.forecolor || "#000000",
139
+ highlight: !!current.hilitecolor,
140
+ hilitecolor: current.hilitecolor || "#ffff00"
141
+ },
142
+ onChange: (values, { name }, api) => {
143
+ if (name === "highlight") api.setEnabled("hilitecolor", values.highlight === true);
144
+ }
145
+ });
146
+ if (!data) return;
147
+ pen.properties = {
148
+ fontname: String(data.fontname ?? ""),
149
+ fontsize: String(data.fontsize ?? ""),
150
+ bold: data.bold === true,
151
+ italic: data.italic === true,
152
+ underline: data.underline === true,
153
+ strikethrough: data.strikethrough === true,
154
+ forecolor: String(data.forecolor ?? ""),
155
+ hilitecolor: data.highlight === true ? String(data.hilitecolor ?? "") : ""
156
+ };
157
+ if (pen.active) applyToCursor(editor);
158
+ editor.focus();
159
+ }
160
+ var permanentpen_default = definePlugin({
161
+ name: "permanentpen",
162
+ toolbar: "permanentpen",
163
+ prosemirrorPlugins: (editor) => [
164
+ new Plugin({
165
+ // While the pen is on, the marks for typing at the cursor are the pen's (after Enter, a click,
166
+ // arrows): typed and composed (IME) text both take stored marks.
167
+ appendTransaction(_transactions, _old, state) {
168
+ const pen = penOf(editor);
169
+ if (!pen.active || !state.selection.empty) return null;
170
+ const want = marksForCursor(state, penMarks(state.schema, pen.properties));
171
+ const current = state.storedMarks ?? state.selection.$from.marks();
172
+ return Mark.sameSet(current, want) ? null : state.tr.setStoredMarks(want);
173
+ }
174
+ })
175
+ ],
176
+ setup(editor) {
177
+ const labels = pickLabels(editor, "permanentpen", LABELS);
178
+ const pen = penOf(editor);
179
+ editor.ui.registry.addButton("permanentpen", {
180
+ icon: icons.permanentPen,
181
+ tooltip: labels.button,
182
+ isActive: () => pen.active,
183
+ isEnabled: (e) => e.isEditable(),
184
+ onAction: (e) => {
185
+ pen.active = !pen.active;
186
+ applyToCursor(e);
187
+ e.updateUI();
188
+ e.ui.announce(pen.active ? labels.on : labels.off);
189
+ e.focus();
190
+ }
191
+ });
192
+ editor.ui.registry.addMenuItem("configurepermanentpen", {
193
+ text: labels.configure,
194
+ isEnabled: (e) => e.isEditable(),
195
+ onAction: (e) => void configure(e)
196
+ });
197
+ return () => pens.delete(editor);
198
+ }
199
+ });
200
+ export {
201
+ DEFAULT_PEN,
202
+ LABELS,
203
+ permanentpen_default as default,
204
+ penMarks
205
+ };
206
+ //# sourceMappingURL=permanentpen-6D5LLKFX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugins/permanentpen.ts"],"sourcesContent":["import { Mark, type Schema } from 'prosemirror-model';\nimport { Plugin, type EditorState } from 'prosemirror-state';\nimport type { Editor } from '../editor';\nimport { definePlugin } from '../plugins';\nimport { defaultFontFamilies, defaultFontSizes } from '../ui/builtins';\nimport type { DialogField } from '../ui/form-dialog-types';\nimport { icons } from '../ui/icons';\nimport { pickLabels } from './shared';\n\n/**\n * The permanentpen plugin (named as in TinyMCE): while the pen is on, everything typed gets the pen's\n * formatting, wherever the cursor goes — for notes and remarks that must stand apart from the text.\n * The `permanentpen` button turns it on and off; `configurepermanentpen` (a menu item) opens its\n * properties: font, size, bold, italic, underline, strikethrough, text and highlight color. The\n * defaults come from `pluginOptions.permanentpen.properties` (for TinyMCE, `permanentpen_properties`).\n */\n\nexport const LABELS = {\n en: {\n button: 'Permanent pen',\n configure: 'Permanent pen properties',\n highlight: 'Highlight the text',\n on: 'Permanent pen on',\n off: 'Permanent pen off',\n },\n};\n\n/** The pen's formatting, with TinyMCE's property names. */\nexport interface PermanentPenProperties {\n fontname?: string;\n fontsize?: string;\n forecolor?: string;\n /** Background (highlight) color; empty — none. */\n hilitecolor?: string;\n bold?: boolean;\n italic?: boolean;\n underline?: boolean;\n strikethrough?: boolean;\n}\n\nexport interface PermanentPenOptions {\n properties?: PermanentPenProperties;\n}\n\n/** A dark red that keeps 4.5:1 contrast on white, bold. */\nexport const DEFAULT_PEN: PermanentPenProperties = { forecolor: '#C0392B', bold: true };\n\n/** Marks the pen sets or replaces; other marks at the cursor (links, comments) stay. */\nconst PEN_MARKS = [\n 'bold',\n 'italic',\n 'underline',\n 'strike',\n 'color',\n 'background',\n 'font_family',\n 'font_size',\n];\n\n/** The pen's properties as marks of this schema. */\nexport function penMarks(schema: Schema, pen: PermanentPenProperties): readonly Mark[] {\n const marks: Mark[] = [];\n const add = (name: string, attrs?: Record<string, unknown>) => {\n const type = schema.marks[name];\n if (type) marks.push(type.create(attrs));\n };\n if (pen.bold) add('bold');\n if (pen.italic) add('italic');\n if (pen.underline) add('underline');\n if (pen.strikethrough) add('strike');\n if (typeof pen.forecolor === 'string' && pen.forecolor) add('color', { value: pen.forecolor });\n if (typeof pen.hilitecolor === 'string' && pen.hilitecolor)\n add('background', { value: pen.hilitecolor });\n if (typeof pen.fontname === 'string' && pen.fontname) add('font_family', { value: pen.fontname });\n if (typeof pen.fontsize === 'string' && pen.fontsize) add('font_size', { value: pen.fontsize });\n return Mark.setFrom(marks);\n}\n\n/** The marks for typing at the cursor: the pen's, plus whatever non-formatting marks are there. */\nfunction marksForCursor(state: EditorState, pen: readonly Mark[] | null): readonly Mark[] {\n const current = state.storedMarks ?? state.selection.$from.marks();\n const keep = current.filter((mark) => !PEN_MARKS.includes(mark.type.name));\n return Mark.setFrom([...keep, ...(pen ?? [])]);\n}\n\ninterface Pen {\n active: boolean;\n properties: PermanentPenProperties;\n}\n\nconst pens = new WeakMap<Editor, Pen>();\n\nfunction penOf(editor: Editor): Pen {\n let pen = pens.get(editor);\n if (!pen) {\n const options = (editor.options.pluginOptions?.permanentpen ?? {}) as PermanentPenOptions;\n const properties =\n options.properties && typeof options.properties === 'object'\n ? { ...options.properties }\n : { ...DEFAULT_PEN };\n pen = { active: false, properties };\n pens.set(editor, pen);\n }\n return pen;\n}\n\n/** Typing continues with the pen's marks (on) or without them (off). */\nfunction applyToCursor(editor: Editor): void {\n const { state } = editor.view;\n if (!state.selection.empty) return;\n const pen = penOf(editor);\n const marks = marksForCursor(state, pen.active ? penMarks(state.schema, pen.properties) : null);\n editor.view.dispatch(state.tr.setStoredMarks(marks));\n}\n\nasync function configure(editor: Editor): Promise<void> {\n const { t } = editor.ui;\n const labels = pickLabels(editor, 'permanentpen', LABELS);\n const pen = penOf(editor);\n const current = pen.properties;\n const families = editor.options.fontFamilies ?? defaultFontFamilies;\n const fontOptions = [\n { value: '', label: t('default') },\n ...families.map((family) => ({ value: family.value, label: family.label })),\n ];\n if (current.fontname && !fontOptions.some((option) => option.value === current.fontname)) {\n fontOptions.push({ value: current.fontname, label: current.fontname });\n }\n const sizes = editor.options.fontSizes ?? defaultFontSizes;\n const sizeOptions = [\n { value: '', label: t('default') },\n ...sizes.map((size) => ({ value: size, label: size })),\n ];\n if (current.fontsize && !sizeOptions.some((option) => option.value === current.fontsize)) {\n sizeOptions.push({ value: current.fontsize, label: current.fontsize });\n }\n const fields: DialogField[] = [\n { type: 'select', name: 'fontname', label: t('fontFamily'), options: fontOptions },\n { type: 'select', name: 'fontsize', label: t('fontSize'), options: sizeOptions },\n { type: 'checkbox', name: 'bold', label: t('bold') },\n { type: 'checkbox', name: 'italic', label: t('italic') },\n { type: 'checkbox', name: 'underline', label: t('underline') },\n { type: 'checkbox', name: 'strikethrough', label: t('strike') },\n { type: 'color', name: 'forecolor', label: t('textColor') },\n { type: 'checkbox', name: 'highlight', label: labels.highlight },\n {\n type: 'color',\n name: 'hilitecolor',\n label: t('backgroundColor'),\n disabled: !current.hilitecolor,\n },\n ];\n const data = await editor.ui.dialog({\n title: labels.configure,\n fields,\n initialData: {\n fontname: current.fontname ?? '',\n fontsize: current.fontsize ?? '',\n bold: !!current.bold,\n italic: !!current.italic,\n underline: !!current.underline,\n strikethrough: !!current.strikethrough,\n forecolor: current.forecolor || '#000000',\n highlight: !!current.hilitecolor,\n hilitecolor: current.hilitecolor || '#ffff00',\n },\n onChange: (values, { name }, api) => {\n if (name === 'highlight') api.setEnabled('hilitecolor', values.highlight === true);\n },\n });\n if (!data) return;\n pen.properties = {\n fontname: String(data.fontname ?? ''),\n fontsize: String(data.fontsize ?? ''),\n bold: data.bold === true,\n italic: data.italic === true,\n underline: data.underline === true,\n strikethrough: data.strikethrough === true,\n forecolor: String(data.forecolor ?? ''),\n hilitecolor: data.highlight === true ? String(data.hilitecolor ?? '') : '',\n };\n if (pen.active) applyToCursor(editor);\n editor.focus();\n}\n\nexport default definePlugin({\n name: 'permanentpen',\n toolbar: 'permanentpen',\n prosemirrorPlugins: (editor) => [\n new Plugin({\n // While the pen is on, the marks for typing at the cursor are the pen's (after Enter, a click,\n // arrows): typed and composed (IME) text both take stored marks.\n appendTransaction(_transactions, _old, state) {\n const pen = penOf(editor);\n if (!pen.active || !state.selection.empty) return null;\n const want = marksForCursor(state, penMarks(state.schema, pen.properties));\n const current = state.storedMarks ?? state.selection.$from.marks();\n return Mark.sameSet(current, want) ? null : state.tr.setStoredMarks(want);\n },\n }),\n ],\n setup(editor: Editor) {\n const labels = pickLabels(editor, 'permanentpen', LABELS);\n const pen = penOf(editor);\n editor.ui.registry.addButton('permanentpen', {\n icon: icons.permanentPen,\n tooltip: labels.button,\n isActive: () => pen.active,\n isEnabled: (e) => e.isEditable(),\n onAction: (e) => {\n pen.active = !pen.active;\n applyToCursor(e);\n e.updateUI();\n e.ui.announce(pen.active ? labels.on : labels.off);\n e.focus();\n },\n });\n editor.ui.registry.addMenuItem('configurepermanentpen', {\n text: labels.configure,\n isEnabled: (e) => e.isEditable(),\n onAction: (e) => void configure(e),\n });\n return () => pens.delete(editor);\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAyB;AAClC,SAAS,cAAgC;AAg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Ae,MAAM,UAAU,MAAM,MAAM;AACjE,eAAO,KAAK,QAAQ,SAAS,IAAI,IAAI,OAAO,MAAM,GAAG,eAAe,IAAI;AAAA,MAC1E;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EACA,MAAM,QAAgB;AACpB,UAAM,SAAS,WAAW,QAAQ,gBAAgB,MAAM;AACxD,UAAM,MAAM,MAAM,MAAM;AACxB,WAAO,GAAG,SAAS,UAAU,gBAAgB;AAAA,MAC3C,MAAM,MAAM;AAAA,MACZ,SAAS,OAAO;AAAA,MAChB,UAAU,MAAM,IAAI;AAAA,MACpB,WAAW,CAAC,MAAM,EAAE,WAAW;AAAA,MAC/B,UAAU,CAAC,MAAM;AACf,YAAI,SAAS,CAAC,IAAI;AAClB,sBAAc,CAAC;AACf,UAAE,SAAS;AACX,UAAE,GAAG,SAAS,IAAI,SAAS,OAAO,KAAK,OAAO,GAAG;AACjD,UAAE,MAAM;AAAA,MACV;AAAA,IACF,CAAC;AACD,WAAO,GAAG,SAAS,YAAY,yBAAyB;AAAA,MACtD,MAAM,OAAO;AAAA,MACb,WAAW,CAAC,MAAM,EAAE,WAAW;AAAA,MAC/B,UAAU,CAAC,MAAM,KAAK,UAAU,CAAC;AAAA,IACnC,CAAC;AACD,WAAO,MAAM,KAAK,OAAO,MAAM;AAAA,EACjC;AACF,CAAC;","names":[]}
@@ -0,0 +1,178 @@
1
+ import {
2
+ FLAT_MARK_SELECTOR
3
+ } from "./chunk-ANE5ASXG.js";
4
+ import {
5
+ pageLayout
6
+ } from "./chunk-OFHGXYG3.js";
7
+ import "./chunk-V7WUHUHM.js";
8
+ import {
9
+ h
10
+ } from "./chunk-QU3KXMYT.js";
11
+
12
+ // src/ui/print.ts
13
+ function sourceOf(sheet, fontsOnly) {
14
+ if (sheet.disabled) return null;
15
+ const media = sheet.media?.mediaText;
16
+ try {
17
+ const rules = [...sheet.cssRules].filter((rule) => !fontsOnly || rule.type === 5);
18
+ return { css: rules.map((rule) => rule.cssText).join("\n"), media };
19
+ } catch {
20
+ return !fontsOnly && sheet.href ? { href: sheet.href, media } : null;
21
+ }
22
+ }
23
+ function styleSources(editor) {
24
+ const root = editor.root.getRootNode();
25
+ const shadow = typeof ShadowRoot !== "undefined" && root instanceof ShadowRoot ? root : null;
26
+ const sheets = (target, fontsOnly) => [...target.styleSheets, ...target.adoptedStyleSheets ?? []].map((sheet) => sourceOf(sheet, fontsOnly)).filter((source) => !!source);
27
+ return [...sheets(document, !!shadow), ...shadow ? sheets(shadow, false) : []];
28
+ }
29
+ function cssString(text) {
30
+ const escaped = text.replace(/[\\"<>]/g, (ch) => `\\${ch.charCodeAt(0).toString(16)} `).replace(/[\n\r\f]/g, " ");
31
+ return `"${escaped}"`;
32
+ }
33
+ function marginBoxContent(template) {
34
+ const parts = template.split(/(\{pages?\})/).filter((part) => part !== "");
35
+ const tokens = parts.map(
36
+ (part) => part === "{page}" ? "counter(page)" : part === "{pages}" ? "counter(pages)" : cssString(part)
37
+ );
38
+ return tokens.join(" ") || '""';
39
+ }
40
+ var SIDES = ["left", "center", "right"];
41
+ var BAND_STYLE = "font: 9pt/1.3 system-ui, -apple-system, 'Segoe UI', sans-serif; color: #444;";
42
+ function marginBoxes(band, edge) {
43
+ if (!band) return "";
44
+ return SIDES.filter((side) => band[side]).map((side) => `@${edge}-${side} { content: ${marginBoxContent(band[side])}; ${BAND_STYLE} }`).join(" ");
45
+ }
46
+ function printCss(layout) {
47
+ const page = layout ? `size: ${layout.width}mm ${layout.height}mm; margin: ${layout.margins.top}mm ${layout.margins.right}mm ${layout.margins.bottom}mm ${layout.margins.left}mm;` : "margin: 20mm;";
48
+ const bands = layout ? `${marginBoxes(layout.header, "top")} ${marginBoxes(layout.footer, "bottom")}`.trim() : "";
49
+ const titlePage = bands && layout?.differentFirstPage ? `@page :first { ${["top", "bottom"].flatMap((edge) => SIDES.map((side) => `@${edge}-${side} { content: none; }`)).join(" ")} }` : "";
50
+ return `
51
+ @page { ${page}${bands ? ` ${bands}` : ""} }${titlePage ? `
52
+ ${titlePage}` : ""}
53
+ html, body { margin: 0 !important; padding: 0 !important; background: #fff !important;
54
+ height: auto !important; overflow: visible !important; }
55
+ body > .nova-print { display: block !important; }
56
+ .nova-print, .nova-print * { visibility: visible !important; }
57
+ .nova-print, .nova-print > .nova-content { position: static !important; inset: auto !important;
58
+ display: block !important; width: auto !important; height: auto !important; min-height: 0 !important;
59
+ max-height: none !important; margin: 0 !important; padding: 0 !important; border: 0 !important;
60
+ border-radius: 0 !important; box-shadow: none !important; background: none !important;
61
+ overflow: visible !important; contain: none !important; }
62
+ .nova-print .nova-prosemirror { width: auto !important; max-width: none !important; min-height: 0 !important;
63
+ margin: 0 !important; padding: 0 !important; box-shadow: none !important; background: none !important;
64
+ orphans: 1; widows: 1; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
65
+ .nova-print tr, .nova-print img, .nova-print figure, .nova-print video, .nova-print iframe,
66
+ .nova-print canvas, .nova-print svg { break-inside: avoid; }
67
+ .nova-print .nova-pagebreak { break-after: page !important; height: 0 !important; margin: 0 !important;
68
+ padding: 0 !important; border: 0 !important; visibility: hidden !important; }
69
+ .nova-print .nova-pagebreak::before, .nova-print .nova-pagebreak::after { display: none !important; }
70
+ .nova-print .ProseMirror-selectednode { outline: none !important; }
71
+ `;
72
+ }
73
+ function contentClone(dom) {
74
+ const clone = dom.cloneNode(true);
75
+ clone.removeAttribute("contenteditable");
76
+ clone.classList.remove("ProseMirror-focused", "nova-empty");
77
+ for (const el of clone.querySelectorAll(".ProseMirror-gapcursor, .nova-image-handle"))
78
+ el.remove();
79
+ for (const el of clone.querySelectorAll(FLAT_MARK_SELECTOR))
80
+ if (el.getAttribute("role") === "none") el.removeAttribute("role");
81
+ for (const el of clone.querySelectorAll("[loading]")) el.removeAttribute("loading");
82
+ const originals = dom.querySelectorAll("canvas");
83
+ clone.querySelectorAll("canvas").forEach((canvas, index) => {
84
+ try {
85
+ const image = document.createElement("img");
86
+ image.src = originals[index].toDataURL();
87
+ image.style.cssText = canvas.style.cssText;
88
+ image.className = canvas.className;
89
+ canvas.replaceWith(image);
90
+ } catch {
91
+ }
92
+ });
93
+ return clone;
94
+ }
95
+ function buildPrintDocument(editor, doc) {
96
+ for (const source of styleSources(editor)) {
97
+ if (source.href) {
98
+ const link = doc.createElement("link");
99
+ link.rel = "stylesheet";
100
+ link.href = source.href;
101
+ if (source.media) link.media = source.media;
102
+ doc.head.append(link);
103
+ } else {
104
+ const style2 = doc.createElement("style");
105
+ style2.textContent = source.media && source.media !== "all" ? `@media ${source.media} {
106
+ ${source.css}
107
+ }` : source.css;
108
+ doc.head.append(style2);
109
+ }
110
+ }
111
+ const style = doc.createElement("style");
112
+ style.textContent = printCss(pageLayout(editor)?.layout);
113
+ doc.head.append(style);
114
+ doc.documentElement.setAttribute("data-theme", "light");
115
+ if (editor.root.closest("[lang]"))
116
+ doc.documentElement.lang = editor.root.closest("[lang]").getAttribute("lang");
117
+ const root = doc.createElement("div");
118
+ root.className = `${editor.root.className} nova-print`;
119
+ root.dir = editor.direction;
120
+ const content = doc.createElement("div");
121
+ content.className = "nova-content";
122
+ content.append(contentClone(editor.view.dom));
123
+ root.append(content);
124
+ doc.body.append(root);
125
+ }
126
+ function printDocumentHtml(editor, title = "") {
127
+ const doc = document.implementation.createHTMLDocument(title);
128
+ const charset = doc.createElement("meta");
129
+ charset.setAttribute("charset", "utf-8");
130
+ const base = doc.createElement("base");
131
+ base.href = document.baseURI;
132
+ doc.head.prepend(charset, base);
133
+ buildPrintDocument(editor, doc);
134
+ return `<!doctype html>
135
+ ${doc.documentElement.outerHTML}`;
136
+ }
137
+ function loaded(doc) {
138
+ const waits = [];
139
+ const onLoad = (el) => new Promise((resolve) => {
140
+ el.addEventListener("load", resolve, { once: true });
141
+ el.addEventListener("error", resolve, { once: true });
142
+ });
143
+ for (const image of doc.images) if (!image.complete) waits.push(onLoad(image));
144
+ for (const link of doc.querySelectorAll('link[rel="stylesheet"]'))
145
+ if (!link.sheet) waits.push(onLoad(link));
146
+ void doc.body.offsetHeight;
147
+ if (doc.fonts) waits.push(doc.fonts.ready);
148
+ return Promise.race([
149
+ Promise.all(waits).then(() => void 0),
150
+ new Promise((resolve) => setTimeout(resolve, 2e3))
151
+ ]);
152
+ }
153
+ async function print(editor) {
154
+ const iframe = h("iframe", { title: "print", "aria-hidden": "true", tabindex: "-1" });
155
+ iframe.style.cssText = "position:fixed;width:0;height:0;border:0;right:0;bottom:0;visibility:hidden";
156
+ document.body.append(iframe);
157
+ const doc = iframe.contentDocument;
158
+ const win = iframe.contentWindow;
159
+ if (!doc || !win) return iframe.remove();
160
+ doc.open();
161
+ doc.write('<!doctype html><html><head><meta charset="utf-8"></head><body></body></html>');
162
+ doc.close();
163
+ buildPrintDocument(editor, doc);
164
+ await loaded(doc);
165
+ const cleanup = () => setTimeout(() => iframe.remove(), 1e3);
166
+ win.addEventListener("afterprint", cleanup);
167
+ win.focus();
168
+ win.print();
169
+ cleanup();
170
+ }
171
+ export {
172
+ buildPrintDocument,
173
+ marginBoxContent,
174
+ print,
175
+ printCss,
176
+ printDocumentHtml
177
+ };
178
+ //# sourceMappingURL=print-MZMLQIQX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ui/print.ts"],"sourcesContent":["import type { Editor } from '../editor';\nimport { FLAT_MARK_SELECTOR } from '../mark-views';\nimport { pageLayout, type PageBandParts, type PageLayout } from '../plugins/pagelayout';\nimport { h } from './dom';\n\n/**\n * Printing as on screen: a copy of the editor's text, node views included (formulas, code highlighting,\n * custom blocks), in a hidden iframe with every style of the page, contentStyle/contentCss included.\n * In page mode (pagelayout) the sheet is the same: size and margins in @page, the same text width, so\n * pages break where the editor draws their borders. A lazy module: it loads on print.\n */\n\ninterface StyleSource {\n css?: string;\n href?: string;\n media?: string;\n}\n\n/** A style sheet's rules as text (third-party sheets without access to their rules, as a link). */\nfunction sourceOf(sheet: CSSStyleSheet, fontsOnly: boolean): StyleSource | null {\n if (sheet.disabled) return null;\n const media = sheet.media?.mediaText;\n try {\n const rules = [...sheet.cssRules].filter((rule) => !fontsOnly || rule.type === 5);\n return { css: rules.map((rule) => rule.cssText).join('\\n'), media };\n } catch {\n return !fontsOnly && sheet.href ? { href: sheet.href, media } : null;\n }\n}\n\n/**\n * The styles the editor draws the text with. Inside a shadow root, its styles and the document's fonts\n * (document styles don't reach inside it, so they don't go into the print either).\n */\nfunction styleSources(editor: Editor): StyleSource[] {\n const root = editor.root.getRootNode();\n const shadow = typeof ShadowRoot !== 'undefined' && root instanceof ShadowRoot ? root : null;\n const sheets = (target: Document | ShadowRoot, fontsOnly: boolean) =>\n [...target.styleSheets, ...(target.adoptedStyleSheets ?? [])]\n .map((sheet) => sourceOf(sheet, fontsOnly))\n .filter((source): source is StyleSource => !!source);\n return [...sheets(document, !!shadow), ...(shadow ? sheets(shadow, false) : [])];\n}\n\n/**\n * Text as a CSS string. Quotes, backslashes and angle brackets become escapes, so the text can't end the\n * string or the <style> it sits in (the print document also goes to a server as HTML for PDF files).\n */\nfunction cssString(text: string): string {\n const escaped = text\n .replace(/[\\\\\"<>]/g, (ch) => `\\\\${ch.charCodeAt(0).toString(16)} `)\n .replace(/[\\n\\r\\f]/g, ' ');\n return `\"${escaped}\"`;\n}\n\n/** A header or footer part → the CSS `content` value: text in quotes, {page} and {pages} as page counters. */\nexport function marginBoxContent(template: string): string {\n const parts = template.split(/(\\{pages?\\})/).filter((part) => part !== '');\n const tokens = parts.map((part) =>\n part === '{page}' ? 'counter(page)' : part === '{pages}' ? 'counter(pages)' : cssString(part),\n );\n return tokens.join(' ') || '\"\"';\n}\n\nconst SIDES = ['left', 'center', 'right'] as const;\n/** Header and footer text: small, grey, in the system font, as in the editor's page view. */\nconst BAND_STYLE = \"font: 9pt/1.3 system-ui, -apple-system, 'Segoe UI', sans-serif; color: #444;\";\n\n/** CSS page margin boxes (@top-left … @bottom-right) for the header and footer. */\nfunction marginBoxes(band: PageBandParts | null, edge: 'top' | 'bottom'): string {\n if (!band) return '';\n return SIDES.filter((side) => band[side])\n .map((side) => `@${edge}-${side} { content: ${marginBoxContent(band[side])}; ${BAND_STYLE} }`)\n .join(' ');\n}\n\n/** Printing on top of the page styles: only the content, the sheet from page mode, no editor frame. */\nexport function printCss(layout: PageLayout | undefined): string {\n const page = layout\n ? `size: ${layout.width}mm ${layout.height}mm; margin: ${layout.margins.top}mm ${layout.margins.right}mm ${layout.margins.bottom}mm ${layout.margins.left}mm;`\n : 'margin: 20mm;';\n // Headers and footers: CSS margin boxes, printed by Chromium (Chrome, Edge) and by headless Chrome into PDF files.\n const bands = layout\n ? `${marginBoxes(layout.header, 'top')} ${marginBoxes(layout.footer, 'bottom')}`.trim()\n : '';\n const titlePage =\n bands && layout?.differentFirstPage\n ? `@page :first { ${(['top', 'bottom'] as const)\n .flatMap((edge) => SIDES.map((side) => `@${edge}-${side} { content: none; }`))\n .join(' ')} }`\n : '';\n return `\n@page { ${page}${bands ? ` ${bands}` : ''} }${titlePage ? `\\n${titlePage}` : ''}\nhtml, body { margin: 0 !important; padding: 0 !important; background: #fff !important;\n height: auto !important; overflow: visible !important; }\nbody > .nova-print { display: block !important; }\n.nova-print, .nova-print * { visibility: visible !important; }\n.nova-print, .nova-print > .nova-content { position: static !important; inset: auto !important;\n display: block !important; width: auto !important; height: auto !important; min-height: 0 !important;\n max-height: none !important; margin: 0 !important; padding: 0 !important; border: 0 !important;\n border-radius: 0 !important; box-shadow: none !important; background: none !important;\n overflow: visible !important; contain: none !important; }\n.nova-print .nova-prosemirror { width: auto !important; max-width: none !important; min-height: 0 !important;\n margin: 0 !important; padding: 0 !important; box-shadow: none !important; background: none !important;\n orphans: 1; widows: 1; print-color-adjust: exact; -webkit-print-color-adjust: exact; }\n.nova-print tr, .nova-print img, .nova-print figure, .nova-print video, .nova-print iframe,\n.nova-print canvas, .nova-print svg { break-inside: avoid; }\n.nova-print .nova-pagebreak { break-after: page !important; height: 0 !important; margin: 0 !important;\n padding: 0 !important; border: 0 !important; visibility: hidden !important; }\n.nova-print .nova-pagebreak::before, .nova-print .nova-pagebreak::after { display: none !important; }\n.nova-print .ProseMirror-selectednode { outline: none !important; }\n`;\n}\n\n/** A copy of the editor's text without traces of editing. */\nfunction contentClone(dom: HTMLElement): HTMLElement {\n const clone = dom.cloneNode(true) as HTMLElement;\n clone.removeAttribute('contenteditable');\n clone.classList.remove('ProseMirror-focused', 'nova-empty');\n for (const el of clone.querySelectorAll('.ProseMirror-gapcursor, .nova-image-handle'))\n el.remove();\n // Bold, italic... carry role=\"none\" only for screen readers in the editor (mark-views.ts).\n for (const el of clone.querySelectorAll(FLAT_MARK_SELECTOR))\n if (el.getAttribute('role') === 'none') el.removeAttribute('role');\n // Lazy images in an invisible iframe would never load.\n for (const el of clone.querySelectorAll('[loading]')) el.removeAttribute('loading');\n // cloneNode doesn't copy a canvas drawing, so it is carried over as an image.\n const originals = dom.querySelectorAll('canvas');\n clone.querySelectorAll('canvas').forEach((canvas, index) => {\n try {\n const image = document.createElement('img');\n image.src = originals[index]!.toDataURL();\n image.style.cssText = canvas.style.cssText;\n image.className = canvas.className;\n canvas.replaceWith(image);\n } catch {\n // a canvas with cross-origin images (tainted) stays empty\n }\n });\n return clone;\n}\n\n/** The print document: the page styles, print rules and a root like the editor's. */\nexport function buildPrintDocument(editor: Editor, doc: Document): void {\n for (const source of styleSources(editor)) {\n if (source.href) {\n const link = doc.createElement('link');\n link.rel = 'stylesheet';\n link.href = source.href;\n if (source.media) link.media = source.media;\n doc.head.append(link);\n } else {\n const style = doc.createElement('style');\n style.textContent =\n source.media && source.media !== 'all'\n ? `@media ${source.media} {\\n${source.css}\\n}`\n : source.css!;\n doc.head.append(style);\n }\n }\n const style = doc.createElement('style');\n style.textContent = printCss(pageLayout(editor)?.layout);\n doc.head.append(style);\n // Paper is light even with a dark system theme.\n doc.documentElement.setAttribute('data-theme', 'light');\n if (editor.root.closest('[lang]'))\n doc.documentElement.lang = editor.root.closest('[lang]')!.getAttribute('lang')!;\n // Classes of the editor root: the content style scopes (contentStyle/contentCss) and page mode.\n const root = doc.createElement('div');\n root.className = `${editor.root.className} nova-print`;\n root.dir = editor.direction;\n const content = doc.createElement('div');\n content.className = 'nova-content';\n content.append(contentClone(editor.view.dom));\n root.append(content);\n doc.body.append(root);\n}\n\n/**\n * The print document as one HTML string, for a server that makes a PDF from it (headless Chrome:\n * `page.setContent(html)`, `page.pdf({ preferCSSPageSize: true })`). Addresses of images and style sheets\n * resolve against this page (`<base href>`); the sheet, margins, header and footer are in its @page rule.\n */\nexport function printDocumentHtml(editor: Editor, title = ''): string {\n const doc = document.implementation.createHTMLDocument(title);\n const charset = doc.createElement('meta');\n charset.setAttribute('charset', 'utf-8');\n const base = doc.createElement('base');\n base.href = document.baseURI;\n doc.head.prepend(charset, base);\n buildPrintDocument(editor, doc);\n return `<!doctype html>\\n${doc.documentElement.outerHTML}`;\n}\n\n/** The print document's images, style sheets and fonts have loaded (but no longer than 2 s). */\nfunction loaded(doc: Document): Promise<void> {\n const waits: Promise<unknown>[] = [];\n const onLoad = (el: HTMLElement) =>\n new Promise((resolve) => {\n el.addEventListener('load', resolve, { once: true });\n el.addEventListener('error', resolve, { once: true });\n });\n for (const image of doc.images) if (!image.complete) waits.push(onLoad(image));\n for (const link of doc.querySelectorAll<HTMLLinkElement>('link[rel=\"stylesheet\"]'))\n if (!link.sheet) waits.push(onLoad(link));\n void doc.body.offsetHeight; // layout starts loading the fonts\n if (doc.fonts) waits.push(doc.fonts.ready);\n return Promise.race([\n Promise.all(waits).then(() => undefined),\n new Promise<void>((resolve) => setTimeout(resolve, 2000)),\n ]);\n}\n\n/** Prints the editor's content (the browser's print dialog, which also offers \"Save as PDF\"). */\nexport async function print(editor: Editor): Promise<void> {\n const iframe = h('iframe', { title: 'print', 'aria-hidden': 'true', tabindex: '-1' });\n iframe.style.cssText =\n 'position:fixed;width:0;height:0;border:0;right:0;bottom:0;visibility:hidden';\n document.body.append(iframe);\n const doc = iframe.contentDocument;\n const win = iframe.contentWindow;\n if (!doc || !win) return iframe.remove();\n // Standards mode, as on the page with the editor: an empty iframe is in quirks mode,\n // where lines and tables are laid out differently and pages would break in the wrong places.\n doc.open();\n doc.write('<!doctype html><html><head><meta charset=\"utf-8\"></head><body></body></html>');\n doc.close();\n buildPrintDocument(editor, doc);\n await loaded(doc);\n const cleanup = () => setTimeout(() => iframe.remove(), 1000);\n win.addEventListener('afterprint', cleanup);\n win.focus();\n win.print();\n cleanup();\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,SAAS,SAAS,OAAsB,WAAwC;AAC9E,MAAI,MAAM,SAAU,QAAO;AAC3B,QAAM,QAAQ,MAAM,OAAO;AAC3B,MAAI;AACF,UAAM,QAAQ,CAAC,GAAG,MAAM,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC,aAAa,KAAK,SAAS,CAAC;AAChF,WAAO,EAAE,KAAK,MAAM,IAAI,CAAC,SAAS,KAAK,OAAO,EAAE,KAAK,IAAI,GAAG,MAAM;AAAA,EACpE,QAAQ;AACN,WAAO,CAAC,aAAa,MAAM,OAAO,EAAE,MAAM,MAAM,MAAM,MAAM,IAAI;AAAA,EAClE;AACF;AAMA,SAAS,aAAa,QAA+B;AACnD,QAAM,OAAO,OAAO,KAAK,YAAY;AACrC,QAAM,SAAS,OAAO,eAAe,eAAe,gBAAgB,aAAa,OAAO;AACxF,QAAM,SAAS,CAAC,QAA+B,cAC7C,CAAC,GAAG,OAAO,aAAa,GAAI,OAAO,sBAAsB,CAAC,CAAE,EACzD,IAAI,CAAC,UAAU,SAAS,OAAO,SAAS,CAAC,EACzC,OAAO,CAAC,WAAkC,CAAC,CAAC,MAAM;AACvD,SAAO,CAAC,GAAG,OAAO,UAAU,CAAC,CAAC,MAAM,GAAG,GAAI,SAAS,OAAO,QAAQ,KAAK,IAAI,CAAC,CAAE;AACjF;AAMA,SAAS,UAAU,MAAsB;AACvC,QAAM,UAAU,KACb,QAAQ,YAAY,CAAC,OAAO,KAAK,GAAG,WAAW,CAAC,EAAE,SAAS,EAAE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,OAAM,KAAK,OAAO,KAAK,CAAC;AAC7E,aAAW,QAAQ,IAAI,iBAAkC,wBAAwB;AAC/E,QAAI,CAAC,KAAK,MAAO,OAAM,KAAK,OAAO,IAAI,CAAC;AAC1C,OAAK,IAAI,KAAK;AACd,MAAI,IAAI,MAAO,OAAM,KAAK,IAAI,MAAM,KAAK;AACzC,SAAO,QAAQ,KAAK;AAAA,IAClB,QAAQ,IAAI,KAAK,EAAE,KAAK,MAAM,MAAS;AAAA,IACvC,IAAI,QAAc,CAAC,YAAY,WAAW,SAAS,GAAI,CAAC;AAAA,EAC1D,CAAC;AACH;AAGA,eAAsB,MAAM,QAA+B;AACzD,QAAM,SAAS,EAAE,UAAU,EAAE,OAAO,SAAS,eAAe,QAAQ,UAAU,KAAK,CAAC;AACpF,SAAO,MAAM,UACX;AACF,WAAS,KAAK,OAAO,MAAM;AAC3B,QAAM,MAAM,OAAO;AACnB,QAAM,MAAM,OAAO;AACnB,MAAI,CAAC,OAAO,CAAC,IAAK,QAAO,OAAO,OAAO;AAGvC,MAAI,KAAK;AACT,MAAI,MAAM,8EAA8E;AACxF,MAAI,MAAM;AACV,qBAAmB,QAAQ,GAAG;AAC9B,QAAM,OAAO,GAAG;AAChB,QAAM,UAAU,MAAM,WAAW,MAAM,OAAO,OAAO,GAAG,GAAI;AAC5D,MAAI,iBAAiB,cAAc,OAAO;AAC1C,MAAI,MAAM;AACV,MAAI,MAAM;AACV,UAAQ;AACV;","names":["style"]}
@@ -1,19 +1,30 @@
1
1
  import {
2
- insertTable,
3
- isInTable,
2
+ openLinkDialog
3
+ } from "./chunk-IG2BL4ON.js";
4
+ import {
4
5
  isSupportedImage,
5
- openLinkDialog,
6
6
  uploadImages
7
- } from "./chunk-435CRWKA.js";
8
- import "./chunk-7ON7PR5R.js";
9
- import "./chunk-HZRIBOPW.js";
7
+ } from "./chunk-J6W2CDRF.js";
8
+ import {
9
+ insertTable
10
+ } from "./chunk-GHVB6SV4.js";
11
+ import "./chunk-FTEA6L2Q.js";
12
+ import "./chunk-MZGNOHSY.js";
13
+ import "./chunk-AC3YCAX4.js";
14
+ import "./chunk-HNEAVVBC.js";
15
+ import {
16
+ isInTable
17
+ } from "./chunk-TAM2FHKG.js";
18
+ import "./chunk-XR7CY4NI.js";
10
19
  import {
11
20
  icons
12
- } from "./chunk-NPKAIW34.js";
13
- import "./chunk-GHEFKKRC.js";
21
+ } from "./chunk-ADRPQLZ2.js";
14
22
  import {
15
23
  definePlugin
16
- } from "./chunk-HPLT3XRZ.js";
24
+ } from "./chunk-V7WUHUHM.js";
25
+ import "./chunk-QU3KXMYT.js";
26
+ import "./chunk-G74HNSB6.js";
27
+ import "./chunk-4VPDY3LF.js";
17
28
 
18
29
  // src/plugins/quickbars.ts
19
30
  import { TextSelection } from "prosemirror-state";
@@ -70,12 +81,13 @@ var quickbars_default = definePlugin({
70
81
  items: selection,
71
82
  position: "selection",
72
83
  placement: "top-start",
73
- // Выделение текста в таблице: форматирование важнее панели таблицы.
84
+ // Text selected in a table: formatting matters more than the table toolbar.
74
85
  priority: 10
75
86
  });
76
87
  }
88
+ const coarse = typeof matchMedia === "function" && matchMedia("(pointer: coarse)").matches;
77
89
  const insert = options.insert === void 0 ? DEFAULT_INSERT : options.insert;
78
- if (insert) {
90
+ if (insert && !coarse) {
79
91
  registry.addContextToolbar("quickbars-insert", {
80
92
  label: t("quickbars.insert"),
81
93
  predicate: isOnEmptyLine,
@@ -93,4 +105,4 @@ export {
93
105
  hasTextSelection,
94
106
  isOnEmptyLine
95
107
  };
96
- //# sourceMappingURL=quickbars-4NU4SIPL.js.map
108
+ //# sourceMappingURL=quickbars-UZ2Q67TX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugins/quickbars.ts"],"sourcesContent":["import { TextSelection } from 'prosemirror-state';\nimport type { Editor } from '../editor';\nimport { isSupportedImage, uploadImages } from '../image';\nimport { openLinkDialog } from '../link';\nimport { definePlugin } from '../plugins';\nimport { insertTable, isInTable } from '../tables';\nimport { icons } from '../ui/icons';\n\n/**\n * Quickbars: toolbars in place, like the TinyMCE plugin of the same name.\n * - above selected text — quick formatting;\n * - on an empty line — quick insert (image, table).\n *\n * Options (pluginOptions.quickbars), false turns a bar off:\n * { selection: 'bold italic | quicklink h2 h3 blockquote', insert: 'quickimage quicktable' }\n */\nexport interface QuickbarsOptions {\n selection?: string | false;\n insert?: string | false;\n}\n\nexport const DEFAULT_SELECTION = 'bold italic underline | quicklink h2 h3 blockquote';\nexport const DEFAULT_INSERT = 'quickimage quicktable';\n\n/** Non-empty text is selected (not table cells, not an image), and not in a code block. */\nexport function hasTextSelection(editor: Editor): boolean {\n const { selection } = editor.view.state;\n if (!(selection instanceof TextSelection) || selection.empty) return false;\n if (selection.$from.parent.type.spec.code) return false;\n return editor.view.state.doc.textBetween(selection.from, selection.to).trim().length > 0;\n}\n\n/** The cursor is on an empty top-level line (not in a list, a table, a quote). */\nexport function isOnEmptyLine(editor: Editor): boolean {\n const { selection } = editor.view.state;\n if (!selection.empty) return false;\n const { $from } = selection;\n return (\n $from.depth === 1 &&\n $from.parent.type === editor.schema.nodes.paragraph &&\n $from.parent.content.size === 0 &&\n !isInTable(editor.view.state)\n );\n}\n\nfunction pickImage(editor: Editor): void {\n const input = document.createElement('input');\n input.type = 'file';\n input.accept = 'image/png,image/jpeg,image/gif,image/webp,image/avif';\n input.addEventListener('change', () => {\n const files = [...(input.files ?? [])].filter(isSupportedImage);\n if (files.length) uploadImages(editor, files);\n });\n input.click();\n}\n\nexport default definePlugin({\n name: 'quickbars',\n setup(editor) {\n const { registry, t } = editor.ui;\n const options = (editor.options.pluginOptions?.quickbars ?? {}) as QuickbarsOptions;\n\n registry.addButton('quicklink', {\n icon: icons.link,\n tooltip: t('link'),\n shortcut: 'Mod-k',\n onAction: (e) => openLinkDialog(e),\n });\n registry.addButton('quickimage', {\n icon: icons.image,\n tooltip: t('image'),\n onAction: (e) => pickImage(e),\n });\n registry.addButton('quicktable', {\n icon: icons.table,\n tooltip: t('table.insert'),\n onAction: (e) => e.exec(insertTable(2, 2)),\n });\n\n const selection = options.selection === undefined ? DEFAULT_SELECTION : options.selection;\n if (selection) {\n registry.addContextToolbar('quickbars-selection', {\n label: t('quickbars.selection'),\n predicate: hasTextSelection,\n items: selection,\n position: 'selection',\n placement: 'top-start',\n // Text selected in a table: formatting matters more than the table toolbar.\n priority: 10,\n });\n }\n\n // On a touch screen the insert toolbar isn't shown: it would pop up on every empty line\n // (and on a new line right by the keyboard it would cover it). Image and table are in the toolbar.\n const coarse = typeof matchMedia === 'function' && matchMedia('(pointer: coarse)').matches;\n const insert = options.insert === undefined ? DEFAULT_INSERT : options.insert;\n if (insert && !coarse) {\n registry.addContextToolbar('quickbars-insert', {\n label: t('quickbars.insert'),\n predicate: isOnEmptyLine,\n items: insert,\n position: 'selection',\n placement: 'bottom-start',\n });\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAqBvB,IAAM,oBAAoB;AAC1B,IAAM,iBAAiB;AAGvB,SAAS,iBAAiB,QAAyB;AACxD,QAAM,EAAE,UAAU,IAAI,OAAO,KAAK;AAClC,MAAI,EAAE,qBAAqB,kBAAkB,UAAU,MAAO,QAAO;AACrE,MAAI,UAAU,MAAM,OAAO,KAAK,KAAK,KAAM,QAAO;AAClD,SAAO,OAAO,KAAK,MAAM,IAAI,YAAY,UAAU,MAAM,UAAU,EAAE,EAAE,KAAK,EAAE,SAAS;AACzF;AAGO,SAAS,cAAc,QAAyB;AACrD,QAAM,EAAE,UAAU,IAAI,OAAO,KAAK;AAClC,MAAI,CAAC,UAAU,MAAO,QAAO;AAC7B,QAAM,EAAE,MAAM,IAAI;AAClB,SACE,MAAM,UAAU,KAChB,MAAM,OAAO,SAAS,OAAO,OAAO,MAAM,aAC1C,MAAM,OAAO,QAAQ,SAAS,KAC9B,CAAC,UAAU,OAAO,KAAK,KAAK;AAEhC;AAEA,SAAS,UAAU,QAAsB;AACvC,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