jodit-pro 4.9.4 → 4.9.15

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 (329) hide show
  1. package/CHANGELOG.md +44 -2
  2. package/config.js +1 -0
  3. package/es2015/jodit.css +1 -1
  4. package/es2015/jodit.fat.min.css +1 -1
  5. package/es2015/jodit.fat.min.js +26 -26
  6. package/es2015/jodit.js +5 -3
  7. package/es2015/jodit.min.js +2 -2
  8. package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
  9. package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.js +10 -4
  10. package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.min.js +6 -6
  11. package/es2015/plugins/autocomplete/autocomplete.js +1 -1
  12. package/es2015/plugins/autocomplete/autocomplete.min.js +1 -1
  13. package/es2015/plugins/backup/backup.css +1 -1
  14. package/es2015/plugins/backup/backup.js +1 -1
  15. package/es2015/plugins/backup/backup.min.js +1 -1
  16. package/es2015/plugins/button-generator/button-generator.css +1 -1
  17. package/es2015/plugins/button-generator/button-generator.js +1 -1
  18. package/es2015/plugins/button-generator/button-generator.min.js +1 -1
  19. package/es2015/plugins/change-case/change-case.js +1 -1
  20. package/es2015/plugins/change-case/change-case.min.js +1 -1
  21. package/es2015/plugins/color-picker/color-picker.css +1 -1
  22. package/es2015/plugins/color-picker/color-picker.js +1 -1
  23. package/es2015/plugins/color-picker/color-picker.min.js +1 -1
  24. package/es2015/plugins/emoji/emoji.css +1 -1
  25. package/es2015/plugins/emoji/emoji.js +1 -1
  26. package/es2015/plugins/emoji/emoji.min.js +1 -1
  27. package/es2015/plugins/export-docs/export-docs.js +1 -1
  28. package/es2015/plugins/export-docs/export-docs.min.js +1 -1
  29. package/es2015/plugins/finder/finder.css +1 -1
  30. package/es2015/plugins/finder/finder.js +1 -1
  31. package/es2015/plugins/finder/finder.min.js +1 -1
  32. package/es2015/plugins/google-maps/google-maps.css +1 -1
  33. package/es2015/plugins/google-maps/google-maps.js +1 -1
  34. package/es2015/plugins/google-maps/google-maps.min.js +1 -1
  35. package/es2015/plugins/google-search/google-search.js +1 -1
  36. package/es2015/plugins/google-search/google-search.min.js +1 -1
  37. package/es2015/plugins/highlight-signature/highlight-signature.js +1 -1
  38. package/es2015/plugins/highlight-signature/highlight-signature.min.js +1 -1
  39. package/es2015/plugins/iframe-editor/iframe-editor.css +1 -1
  40. package/es2015/plugins/iframe-editor/iframe-editor.js +1 -1
  41. package/es2015/plugins/iframe-editor/iframe-editor.min.js +1 -1
  42. package/es2015/plugins/keyboard/keyboard.css +1 -1
  43. package/es2015/plugins/keyboard/keyboard.js +1 -1
  44. package/es2015/plugins/keyboard/keyboard.min.js +1 -1
  45. package/es2015/plugins/mobile-view/mobile-view.js +1 -1
  46. package/es2015/plugins/mobile-view/mobile-view.min.js +1 -1
  47. package/es2015/plugins/page-break/page-break.js +1 -1
  48. package/es2015/plugins/page-break/page-break.min.js +1 -1
  49. package/es2015/plugins/paste-code/paste-code.css +1 -1
  50. package/es2015/plugins/paste-code/paste-code.js +1 -1
  51. package/es2015/plugins/paste-code/paste-code.min.js +1 -1
  52. package/es2015/plugins/paste-from-word/paste-from-word.js +1 -1
  53. package/es2015/plugins/paste-from-word/paste-from-word.min.js +1 -1
  54. package/es2015/plugins/show-blocks/show-blocks.js +1 -1
  55. package/es2015/plugins/show-blocks/show-blocks.min.js +1 -1
  56. package/es2015/plugins/style/style.css +79 -0
  57. package/es2015/plugins/style/style.js +395 -0
  58. package/es2015/plugins/style/style.min.css +1 -0
  59. package/es2015/plugins/style/style.min.js +8 -0
  60. package/es2015/plugins/todo-list/todo-list.css +1 -1
  61. package/es2015/plugins/todo-list/todo-list.js +1 -1
  62. package/es2015/plugins/todo-list/todo-list.min.js +1 -1
  63. package/es2015/plugins/translate/translate.css +1 -1
  64. package/es2015/plugins/translate/translate.js +1 -1
  65. package/es2015/plugins/translate/translate.min.js +1 -1
  66. package/es2015/plugins/tune-block/tune-block.css +1 -1
  67. package/es2015/plugins/tune-block/tune-block.js +1 -1
  68. package/es2015/plugins/tune-block/tune-block.min.js +1 -1
  69. package/es2018/jodit.fat.min.css +1 -1
  70. package/es2018/jodit.fat.min.js +15 -15
  71. package/es2018/jodit.min.js +2 -2
  72. package/es2018/plugins/ai-assistant-pro/ai-assistant-pro.min.js +7 -7
  73. package/es2018/plugins/autocomplete/autocomplete.min.js +1 -1
  74. package/es2018/plugins/backup/backup.min.js +1 -1
  75. package/es2018/plugins/button-generator/button-generator.min.js +1 -1
  76. package/es2018/plugins/change-case/change-case.min.js +1 -1
  77. package/es2018/plugins/color-picker/color-picker.min.js +1 -1
  78. package/es2018/plugins/emoji/emoji.min.js +1 -1
  79. package/es2018/plugins/export-docs/export-docs.min.js +1 -1
  80. package/es2018/plugins/finder/finder.min.js +1 -1
  81. package/es2018/plugins/google-maps/google-maps.min.js +1 -1
  82. package/es2018/plugins/google-search/google-search.min.js +1 -1
  83. package/es2018/plugins/highlight-signature/highlight-signature.min.js +1 -1
  84. package/es2018/plugins/iframe-editor/iframe-editor.min.js +1 -1
  85. package/es2018/plugins/keyboard/keyboard.min.js +1 -1
  86. package/es2018/plugins/mobile-view/mobile-view.min.js +1 -1
  87. package/es2018/plugins/page-break/page-break.min.js +1 -1
  88. package/es2018/plugins/paste-code/paste-code.min.js +1 -1
  89. package/es2018/plugins/paste-from-word/paste-from-word.min.js +1 -1
  90. package/es2018/plugins/show-blocks/show-blocks.min.js +1 -1
  91. package/es2018/plugins/style/style.min.css +1 -0
  92. package/es2018/plugins/style/style.min.js +8 -0
  93. package/es2018/plugins/todo-list/todo-list.min.js +1 -1
  94. package/es2018/plugins/translate/translate.min.js +1 -1
  95. package/es2018/plugins/tune-block/tune-block.min.js +1 -1
  96. package/es2021/jodit.css +1 -1
  97. package/es2021/jodit.fat.min.css +1 -1
  98. package/es2021/jodit.fat.min.js +16 -16
  99. package/es2021/jodit.js +5 -3
  100. package/es2021/jodit.min.js +2 -2
  101. package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
  102. package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.js +9 -4
  103. package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.min.js +28 -28
  104. package/es2021/plugins/autocomplete/autocomplete.js +1 -1
  105. package/es2021/plugins/autocomplete/autocomplete.min.js +1 -1
  106. package/es2021/plugins/backup/backup.css +1 -1
  107. package/es2021/plugins/backup/backup.js +1 -1
  108. package/es2021/plugins/backup/backup.min.js +1 -1
  109. package/es2021/plugins/button-generator/button-generator.css +1 -1
  110. package/es2021/plugins/button-generator/button-generator.js +1 -1
  111. package/es2021/plugins/button-generator/button-generator.min.js +1 -1
  112. package/es2021/plugins/change-case/change-case.js +1 -1
  113. package/es2021/plugins/change-case/change-case.min.js +1 -1
  114. package/es2021/plugins/color-picker/color-picker.css +1 -1
  115. package/es2021/plugins/color-picker/color-picker.js +1 -1
  116. package/es2021/plugins/color-picker/color-picker.min.js +1 -1
  117. package/es2021/plugins/emoji/emoji.css +1 -1
  118. package/es2021/plugins/emoji/emoji.js +1 -1
  119. package/es2021/plugins/emoji/emoji.min.js +1 -1
  120. package/es2021/plugins/export-docs/export-docs.js +1 -1
  121. package/es2021/plugins/export-docs/export-docs.min.js +1 -1
  122. package/es2021/plugins/finder/finder.css +1 -1
  123. package/es2021/plugins/finder/finder.js +1 -1
  124. package/es2021/plugins/finder/finder.min.js +1 -1
  125. package/es2021/plugins/google-maps/google-maps.css +1 -1
  126. package/es2021/plugins/google-maps/google-maps.js +1 -1
  127. package/es2021/plugins/google-maps/google-maps.min.js +1 -1
  128. package/es2021/plugins/google-search/google-search.js +1 -1
  129. package/es2021/plugins/google-search/google-search.min.js +1 -1
  130. package/es2021/plugins/highlight-signature/highlight-signature.js +1 -1
  131. package/es2021/plugins/highlight-signature/highlight-signature.min.js +1 -1
  132. package/es2021/plugins/iframe-editor/iframe-editor.css +1 -1
  133. package/es2021/plugins/iframe-editor/iframe-editor.js +1 -1
  134. package/es2021/plugins/iframe-editor/iframe-editor.min.js +1 -1
  135. package/es2021/plugins/keyboard/keyboard.css +1 -1
  136. package/es2021/plugins/keyboard/keyboard.js +1 -1
  137. package/es2021/plugins/keyboard/keyboard.min.js +1 -1
  138. package/es2021/plugins/mobile-view/mobile-view.js +1 -1
  139. package/es2021/plugins/mobile-view/mobile-view.min.js +1 -1
  140. package/es2021/plugins/page-break/page-break.js +1 -1
  141. package/es2021/plugins/page-break/page-break.min.js +1 -1
  142. package/es2021/plugins/paste-code/paste-code.css +1 -1
  143. package/es2021/plugins/paste-code/paste-code.js +1 -1
  144. package/es2021/plugins/paste-code/paste-code.min.js +1 -1
  145. package/es2021/plugins/paste-from-word/paste-from-word.js +1 -1
  146. package/es2021/plugins/paste-from-word/paste-from-word.min.js +1 -1
  147. package/es2021/plugins/show-blocks/show-blocks.js +1 -1
  148. package/es2021/plugins/show-blocks/show-blocks.min.js +1 -1
  149. package/es2021/plugins/style/style.css +79 -0
  150. package/es2021/plugins/style/style.js +395 -0
  151. package/es2021/plugins/style/style.min.css +1 -0
  152. package/es2021/plugins/style/style.min.js +8 -0
  153. package/es2021/plugins/todo-list/todo-list.css +1 -1
  154. package/es2021/plugins/todo-list/todo-list.js +1 -1
  155. package/es2021/plugins/todo-list/todo-list.min.js +1 -1
  156. package/es2021/plugins/translate/translate.css +1 -1
  157. package/es2021/plugins/translate/translate.js +1 -1
  158. package/es2021/plugins/translate/translate.min.js +1 -1
  159. package/es2021/plugins/tune-block/tune-block.css +1 -1
  160. package/es2021/plugins/tune-block/tune-block.js +1 -1
  161. package/es2021/plugins/tune-block/tune-block.min.js +1 -1
  162. package/es2021.en/jodit.css +1 -1
  163. package/es2021.en/jodit.fat.min.css +1 -1
  164. package/es2021.en/jodit.fat.min.js +14 -14
  165. package/es2021.en/jodit.js +5 -3
  166. package/es2021.en/jodit.min.js +2 -2
  167. package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
  168. package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.js +9 -4
  169. package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.min.js +7 -7
  170. package/es2021.en/plugins/autocomplete/autocomplete.js +1 -1
  171. package/es2021.en/plugins/autocomplete/autocomplete.min.js +1 -1
  172. package/es2021.en/plugins/backup/backup.css +1 -1
  173. package/es2021.en/plugins/backup/backup.js +1 -1
  174. package/es2021.en/plugins/backup/backup.min.js +1 -1
  175. package/es2021.en/plugins/button-generator/button-generator.css +1 -1
  176. package/es2021.en/plugins/button-generator/button-generator.js +1 -1
  177. package/es2021.en/plugins/button-generator/button-generator.min.js +1 -1
  178. package/es2021.en/plugins/change-case/change-case.js +1 -1
  179. package/es2021.en/plugins/change-case/change-case.min.js +1 -1
  180. package/es2021.en/plugins/color-picker/color-picker.css +1 -1
  181. package/es2021.en/plugins/color-picker/color-picker.js +1 -1
  182. package/es2021.en/plugins/color-picker/color-picker.min.js +1 -1
  183. package/es2021.en/plugins/emoji/emoji.css +1 -1
  184. package/es2021.en/plugins/emoji/emoji.js +1 -1
  185. package/es2021.en/plugins/emoji/emoji.min.js +1 -1
  186. package/es2021.en/plugins/export-docs/export-docs.js +1 -1
  187. package/es2021.en/plugins/export-docs/export-docs.min.js +1 -1
  188. package/es2021.en/plugins/finder/finder.css +1 -1
  189. package/es2021.en/plugins/finder/finder.js +1 -1
  190. package/es2021.en/plugins/finder/finder.min.js +1 -1
  191. package/es2021.en/plugins/google-maps/google-maps.css +1 -1
  192. package/es2021.en/plugins/google-maps/google-maps.js +1 -1
  193. package/es2021.en/plugins/google-maps/google-maps.min.js +1 -1
  194. package/es2021.en/plugins/google-search/google-search.js +1 -1
  195. package/es2021.en/plugins/google-search/google-search.min.js +1 -1
  196. package/es2021.en/plugins/highlight-signature/highlight-signature.js +1 -1
  197. package/es2021.en/plugins/highlight-signature/highlight-signature.min.js +1 -1
  198. package/es2021.en/plugins/iframe-editor/iframe-editor.css +1 -1
  199. package/es2021.en/plugins/iframe-editor/iframe-editor.js +1 -1
  200. package/es2021.en/plugins/iframe-editor/iframe-editor.min.js +1 -1
  201. package/es2021.en/plugins/keyboard/keyboard.css +1 -1
  202. package/es2021.en/plugins/keyboard/keyboard.js +1 -1
  203. package/es2021.en/plugins/keyboard/keyboard.min.js +1 -1
  204. package/es2021.en/plugins/mobile-view/mobile-view.js +1 -1
  205. package/es2021.en/plugins/mobile-view/mobile-view.min.js +1 -1
  206. package/es2021.en/plugins/page-break/page-break.js +1 -1
  207. package/es2021.en/plugins/page-break/page-break.min.js +1 -1
  208. package/es2021.en/plugins/paste-code/paste-code.css +1 -1
  209. package/es2021.en/plugins/paste-code/paste-code.js +1 -1
  210. package/es2021.en/plugins/paste-code/paste-code.min.js +1 -1
  211. package/es2021.en/plugins/paste-from-word/paste-from-word.js +1 -1
  212. package/es2021.en/plugins/paste-from-word/paste-from-word.min.js +1 -1
  213. package/es2021.en/plugins/show-blocks/show-blocks.js +1 -1
  214. package/es2021.en/plugins/show-blocks/show-blocks.min.js +1 -1
  215. package/es2021.en/plugins/style/style.css +79 -0
  216. package/es2021.en/plugins/style/style.js +395 -0
  217. package/es2021.en/plugins/style/style.min.css +1 -0
  218. package/es2021.en/plugins/style/style.min.js +8 -0
  219. package/es2021.en/plugins/todo-list/todo-list.css +1 -1
  220. package/es2021.en/plugins/todo-list/todo-list.js +1 -1
  221. package/es2021.en/plugins/todo-list/todo-list.min.js +1 -1
  222. package/es2021.en/plugins/translate/translate.css +1 -1
  223. package/es2021.en/plugins/translate/translate.js +1 -1
  224. package/es2021.en/plugins/translate/translate.min.js +1 -1
  225. package/es2021.en/plugins/tune-block/tune-block.css +1 -1
  226. package/es2021.en/plugins/tune-block/tune-block.js +1 -1
  227. package/es2021.en/plugins/tune-block/tune-block.min.js +1 -1
  228. package/es5/jodit.css +2 -2
  229. package/es5/jodit.fat.min.css +1 -1
  230. package/es5/jodit.fat.min.js +2 -2
  231. package/es5/jodit.js +5 -3
  232. package/es5/jodit.min.css +2 -2
  233. package/es5/jodit.min.js +2 -2
  234. package/es5/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
  235. package/es5/plugins/ai-assistant-pro/ai-assistant-pro.js +11 -5
  236. package/es5/plugins/ai-assistant-pro/ai-assistant-pro.min.js +2 -2
  237. package/es5/plugins/autocomplete/autocomplete.js +1 -1
  238. package/es5/plugins/autocomplete/autocomplete.min.js +1 -1
  239. package/es5/plugins/backup/backup.css +1 -1
  240. package/es5/plugins/backup/backup.js +1 -1
  241. package/es5/plugins/backup/backup.min.js +1 -1
  242. package/es5/plugins/button-generator/button-generator.css +1 -1
  243. package/es5/plugins/button-generator/button-generator.js +1 -1
  244. package/es5/plugins/button-generator/button-generator.min.js +1 -1
  245. package/es5/plugins/change-case/change-case.js +1 -1
  246. package/es5/plugins/change-case/change-case.min.js +1 -1
  247. package/es5/plugins/color-picker/color-picker.css +1 -1
  248. package/es5/plugins/color-picker/color-picker.js +1 -1
  249. package/es5/plugins/color-picker/color-picker.min.js +1 -1
  250. package/es5/plugins/emoji/emoji.css +1 -1
  251. package/es5/plugins/emoji/emoji.js +1 -1
  252. package/es5/plugins/emoji/emoji.min.js +1 -1
  253. package/es5/plugins/export-docs/export-docs.js +1 -1
  254. package/es5/plugins/export-docs/export-docs.min.js +1 -1
  255. package/es5/plugins/finder/finder.css +1 -1
  256. package/es5/plugins/finder/finder.js +1 -1
  257. package/es5/plugins/finder/finder.min.js +1 -1
  258. package/es5/plugins/google-maps/google-maps.css +1 -1
  259. package/es5/plugins/google-maps/google-maps.js +1 -1
  260. package/es5/plugins/google-maps/google-maps.min.js +1 -1
  261. package/es5/plugins/google-search/google-search.js +1 -1
  262. package/es5/plugins/google-search/google-search.min.js +1 -1
  263. package/es5/plugins/highlight-signature/highlight-signature.js +1 -1
  264. package/es5/plugins/highlight-signature/highlight-signature.min.js +1 -1
  265. package/es5/plugins/iframe-editor/iframe-editor.css +1 -1
  266. package/es5/plugins/iframe-editor/iframe-editor.js +1 -1
  267. package/es5/plugins/iframe-editor/iframe-editor.min.js +1 -1
  268. package/es5/plugins/keyboard/keyboard.css +1 -1
  269. package/es5/plugins/keyboard/keyboard.js +1 -1
  270. package/es5/plugins/keyboard/keyboard.min.js +1 -1
  271. package/es5/plugins/mobile-view/mobile-view.js +1 -1
  272. package/es5/plugins/mobile-view/mobile-view.min.js +1 -1
  273. package/es5/plugins/page-break/page-break.js +1 -1
  274. package/es5/plugins/page-break/page-break.min.js +1 -1
  275. package/es5/plugins/paste-code/paste-code.css +1 -1
  276. package/es5/plugins/paste-code/paste-code.js +1 -1
  277. package/es5/plugins/paste-code/paste-code.min.js +1 -1
  278. package/es5/plugins/paste-from-word/paste-from-word.js +1 -1
  279. package/es5/plugins/paste-from-word/paste-from-word.min.js +1 -1
  280. package/es5/plugins/show-blocks/show-blocks.js +1 -1
  281. package/es5/plugins/show-blocks/show-blocks.min.js +1 -1
  282. package/es5/plugins/style/style.css +79 -0
  283. package/es5/plugins/style/style.js +524 -0
  284. package/es5/plugins/style/style.min.css +1 -0
  285. package/es5/plugins/style/style.min.js +8 -0
  286. package/es5/plugins/todo-list/todo-list.css +1 -1
  287. package/es5/plugins/todo-list/todo-list.js +1 -1
  288. package/es5/plugins/todo-list/todo-list.min.js +1 -1
  289. package/es5/plugins/translate/translate.css +1 -1
  290. package/es5/plugins/translate/translate.js +1 -1
  291. package/es5/plugins/translate/translate.min.js +1 -1
  292. package/es5/plugins/tune-block/tune-block.css +1 -1
  293. package/es5/plugins/tune-block/tune-block.js +1 -1
  294. package/es5/plugins/tune-block/tune-block.min.js +1 -1
  295. package/es5/polyfills.fat.min.js +1 -1
  296. package/es5/polyfills.js +1 -1
  297. package/es5/polyfills.min.js +1 -1
  298. package/esm/config.d.ts +6 -0
  299. package/esm/plugins/ai-assistant-pro/ai-assistant-pro.js +2 -2
  300. package/esm/plugins/ai-assistant-pro/core/ai-response-handler.js +1 -1
  301. package/esm/plugins/ai-assistant-pro/core/panel-resize.js +1 -1
  302. package/esm/plugins/ai-assistant-pro/helpers/api-client.js +1 -1
  303. package/esm/plugins/all.js +1 -1
  304. package/esm/plugins/style/config.d.ts +13 -0
  305. package/esm/plugins/style/config.js +1 -0
  306. package/esm/plugins/style/helpers/apply-style.d.ts +8 -0
  307. package/esm/plugins/style/helpers/apply-style.js +1 -0
  308. package/esm/plugins/style/helpers/classify-definitions.d.ts +7 -0
  309. package/esm/plugins/style/helpers/classify-definitions.js +1 -0
  310. package/esm/plugins/style/helpers/detect-active-style.d.ts +8 -0
  311. package/esm/plugins/style/helpers/detect-active-style.js +1 -0
  312. package/esm/plugins/style/icon.svg.js +1 -0
  313. package/esm/plugins/style/interface.d.ts +15 -0
  314. package/esm/plugins/style/interface.js +0 -0
  315. package/esm/plugins/style/style.d.ts +18 -0
  316. package/esm/plugins/style/style.js +1 -0
  317. package/esm/plugins/style/ui/style-popup.d.ts +8 -0
  318. package/esm/plugins/style/ui/style-popup.js +1 -0
  319. package/examples/assets/app.js +2 -1
  320. package/examples/style-plugin.html +508 -0
  321. package/package.json +1 -1
  322. package/types/config.d.ts +6 -0
  323. package/types/plugins/style/config.d.ts +13 -0
  324. package/types/plugins/style/helpers/apply-style.d.ts +8 -0
  325. package/types/plugins/style/helpers/classify-definitions.d.ts +7 -0
  326. package/types/plugins/style/helpers/detect-active-style.d.ts +8 -0
  327. package/types/plugins/style/interface.d.ts +15 -0
  328. package/types/plugins/style/style.d.ts +18 -0
  329. package/types/plugins/style/ui/style-popup.d.ts +8 -0
package/esm/config.d.ts CHANGED
@@ -19,6 +19,7 @@ import type { ButtonGroup } from "jodit/esm/types/index";
19
19
  import type { ILayoutKeys } from "./plugins/keyboard/interface";
20
20
  import type { CanPromise } from "jodit/esm/types/index";
21
21
  import type { IUIOption } from "jodit/esm/types/index";
22
+ import type { IStyleDefinition } from "./plugins/style/interface";
22
23
  import type { ITranslateProviderFactory } from "./plugins/translate/interface";
23
24
  import type { IGoogleTranslateProviderOptions } from "./plugins/translate/interface";
24
25
  import type { IControlType } from "jodit/esm/types/index";
@@ -192,6 +193,11 @@ interface Config {
192
193
  tagList: string[];
193
194
  };
194
195
  }
196
+ interface Config {
197
+ customStyles: {
198
+ definitions: IStyleDefinition[];
199
+ };
200
+ }
195
201
  interface Config {
196
202
  todoList: {
197
203
  className: string;
@@ -1,3 +1,3 @@
1
- var j=Object.defineProperty;var f=(m,t)=>j(m,"name",{value:t,configurable:!0});var u,h=function(m,t,e,a){var s=arguments.length,i=s<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,e):a,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(m,t,e,a);else for(var o=m.length-1;o>=0;o--)(n=m[o])&&(i=(s<3?n(i):s>3?n(t,e,i):n(t,e))||i);return s>3&&i&&Object.defineProperty(t,e,i),i};import"./config.js";import{APIClient as x}from"./helpers/api-client.js";import{PermissionManager as A}from"./helpers/permission-manager.js";import{StateManager as T}from"./helpers/state-manager.js";import{createStorageProvider as D,WebStorageConversationStorage as I}from"./helpers/storage/index.js";import{ToolRegistry as S}from"./helpers/tool-registry.js";import{UIMainPanel as b}from"./ui/main-panel/index.js";import{applyTheme as R,areAllToolCallsExecuted as E,createNewConversation as M,createUserMessage as _,deleteConversationWithCleanup as O,executeToolCall as k,findParentMessageId as F,getCurrentSelectionContext as v,handleBackToList as W,handleConversationSearch as H,handleConversationSelect as q,handleToolApproval as z,handleToolDenial as L,invertMode as Q,loadInitialData as V,processArtifacts as $,processFinalResponse as N,processStreamingResponse as U,resizeInPanelView as y,updateToolCallInMessage as B}from"./core/index.js";import*as G from"./langs/index.js";import{IS_PROD as J}from"jodit/esm/core/constants.js";import{cache as c,cached as g,component as X,debounce as Y,watch as d}from"jodit/esm/core/decorators/index.js";import{extendLang as Z}from"jodit/esm/core/global.js";import{isAbortError as C,isString as K}from"jodit/esm/core/helpers/index.js";import{Plugin as tt}from"jodit/esm/core/plugin/index.js";import{JoditPro as et}from"../../jodit-pro.js";import{UIFlightPosition as w}from"../../traits/flight-position/flight-position.js";import{UIResize as P}from"../../traits/resize/resize.js";let r=(u=class extends tt{constructor(){super(...arguments),this.buttons=[{name:"aiAssistantPro",group:"insert"},{name:"aiCommandsPro",group:"insert"}],this.__initedPromise=null,this.__openedMode=null}get state(){return this.stateManager.state}get toolRegistry(){return new S(this.j)}get permissionManager(){return new A(this.j,this.toolRegistry)}get apiClient(){return new x(this.j,this.toolRegistry)}get storage(){const{storage:t,storageKey:e,maxConversations:a}=this.j.o.aiAssistantPro;if(typeof t=="string"){const s=D(t,e);return new I(s,a)}return t}get stateManager(){return new T(this.j)}get mainPanel(){return new b(this.j,this.stateManager.state,this.j.o.aiAssistantPro,t=>{const e=this.stateManager.getCurrentConversation();e&&this.stateManager.setCurrentConversation({...e,...t})})}get dialog(){const t=this.j.dlg({resizable:this.j.o.aiAssistantPro.resizable,eventEmmiter:this.j.e});return t.e.on(t,"afterClose",()=>{this.j.e.fire("closeAIAssistantPro.ai-assistant-pro")}),t}afterInit(){Z(G),this.setupEventListeners(),this.j.async.promise(t=>{const{initiallyOpened:e,persistOpenState:a}=this.j.o.aiAssistantPro;let s=e;if(a){this.storage.getGlobalSettings().then(i=>{if(i?.isOpen!=null&&(s=i.isOpen),s)return this.openAssistant()}).catch(()=>null).finally(()=>t(void 0));return}t(void 0)}).catch(()=>null)}__loadData(){return this.__initedPromise?this.__initedPromise:this.isDestructed?Promise.reject():(this.__initedPromise=this.j.async.promise(t=>{this.loadInitialData().then(t)}).catch(()=>null),this.__initedPromise)}async loadInitialData(){this.mainPanel.setMod("ready",!0),await V(this.j,this.storage,this.stateManager)}setupEventListeners(){this.j.e.on("selectConversation.ai-assistant-pro",async t=>{try{await this.__loadData(),await q(t,this.storage,this.stateManager)}catch(e){J||console.log(e)}}),this.j.e.on("newConversation.ai-assistant-pro",async()=>{await this.__loadData();const t=M(this.j,this.state.defaultModel,this.state.defaultTemperature);this.stateManager.setCurrentConversation(t)}),this.j.e.on("deleteConversation.ai-assistant-pro",async t=>{await this.__loadData(),await this.deleteConversation(t)}),this.j.e.on("backToList.ai-assistant-pro",async()=>{await this.__loadData(),await W(this.storage,this.stateManager)}),this.j.e.on("removeContext.ai-assistant-pro",async t=>{await this.__loadData(),this.stateManager.removeSelectionContext(t)}),this.j.e.on("approveToolCall.ai-assistant-pro",async(t,e)=>{try{await this.__loadData();const a=await z(t,e,this.stateManager,this.permissionManager,this.storage);if(a){const s=this.stateManager.getCurrentConversation();if(!s)return;const i=s.messages.find(n=>{var o;return(o=n.toolCalls)===null||o===void 0?void 0:o.some(l=>l.id===a.id)});if(!i)return;await this.executeToolCall(i.id,a)}}catch(a){if(C(a))return;this.stateManager.setError(a instanceof Error?a.message:String(a))}}),this.j.e.on("denyToolCall.ai-assistant-pro",async t=>{await this.__loadData(),await L(this.j,t,this.stateManager,this.storage)}),this.j.e.on("abortRequest.ai-assistant-pro",async()=>{await this.__loadData(),this.apiClient.abort(),this.stateManager.setLoading(!1)})}__applyTheme(){R(this.j,this.stateManager.state.theme,this.stateManager.state.displayMode,this.mainPanel.container,this.dialog)}async openAssistant(){if(this.stateManager.isOpen()){this.stateManager.close(),await this.__closeInContainer();return}await this.__loadData(),!this.isDestructed&&(this.stateManager.open(),await this.__openInContainer(),this.j.o.aiAssistantPro.includeSelectionByDefault&&!this.j.s.isCollapsed()&&this.addCurrentSelectionToContext())}async __openInContainer(){const{resizable:t,allowClose:e,flightPanelHeight:a}=this.j.o.aiAssistantPro,{displayMode:s,panelWidth:i,panelHeight:n}=this.stateManager.state;switch(this.__applyTheme(),this.mainPanel.setMod("displayMode",s),this.mainPanel.setMod("allowClose",e),this.mainPanel.setParentView(s==="dialog"||s==="flight"?this.dialog:this.j),this.__openedMode=s,s){case"dialog":{this.dialog.setSize(i,n).open().setContent(this.mainPanel.container);break}case"flight":{w.install(this.mainPanel,this.j.container,{panelHeight:a,containerClassName:this.getFullElName("flight-container")});break}default:{t&&(P.remove(this.mainPanel),P.install(this.mainPanel,Q(s),{handleClassName:this.getFullElName("ai-assistent-resize-handle"),onResize:f(({newSize:o})=>{const l=s==="left"||s==="right"?o:i,p=s==="top"||s==="bottom"?o:n;return this.stateManager.state.panelWidth=l,this.stateManager.state.panelHeight=p,!0},"onResize")})),this.j.currentPlace.slots[s].appendChild(this.mainPanel.container),y(this.j,s,i,n);break}}}__onResizeInPanelView(){const{displayMode:t,panelWidth:e,panelHeight:a}=this.stateManager.state;y(this.j,t,e,a)}async __closeInContainer(){const{displayMode:t}=await this.stateManager.state;switch(this.__openedMode!==t&&this.__openedMode==="dialog"&&this.dialog.close(),this.__openedMode!==t&&this.__openedMode==="flight"&&this.__closeFlightMode(),t){case"dialog":{this.dialog.close();break}case"flight":{this.__closeFlightMode();break}default:{this.mainPanel.container.remove();break}}}__closeFlightMode(){w.remove(this.mainPanel)}__onSavedStateChange(){var t;const e=this.stateManager.state;return this.storage.saveGlobalSettings({displayMode:e.displayMode,panelWidth:e.panelWidth,panelHeight:e.panelHeight,theme:e.theme,defaultModel:e.defaultModel,defaultTemperature:e.defaultTemperature,currentConversationId:(t=e.currentConversation)===null||t===void 0?void 0:t.id,...this.j.o.aiAssistantPro.persistOpenState?{isOpen:e.isOpen}:{}})}async closeAssistant(){this.stateManager.isOpen()&&(await this.__loadData(),this.stateManager.close(),this.__closeInContainer())}async addCurrentSelectionToContext(){await this.__loadData();const t=v(this.j);t&&this.stateManager.addSelectionContext(t)}async executeQuickCommand(t){const{quickCommandsSilentMode:e,quickCommandsDisplayMode:a}=this.j.o.aiAssistantPro,s=this.j.o.aiAssistant;let i;if(s&&s[t]&&K(s[t])&&(i=s[t]),!i){this.j.e.fire("error",`Command not found: ${t}`);return}const n=this.j.s.isCollapsed()?this.j.value:this.j.s.html;if(!n)return;const o=s?.aiCommonPrefixPrompt||"",l=s?.aiCommonSuffixPrompt||"",p=`${o}${i}${l}
1
+ var j=Object.defineProperty;var f=(m,t)=>j(m,"name",{value:t,configurable:!0});var u,h=function(m,t,e,a){var s=arguments.length,i=s<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,e):a,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(m,t,e,a);else for(var o=m.length-1;o>=0;o--)(n=m[o])&&(i=(s<3?n(i):s>3?n(t,e,i):n(t,e))||i);return s>3&&i&&Object.defineProperty(t,e,i),i};import"./config.js";import{APIClient as x}from"./helpers/api-client.js";import{PermissionManager as A}from"./helpers/permission-manager.js";import{StateManager as T}from"./helpers/state-manager.js";import{createStorageProvider as D,WebStorageConversationStorage as I}from"./helpers/storage/index.js";import{ToolRegistry as S}from"./helpers/tool-registry.js";import{UIMainPanel as b}from"./ui/main-panel/index.js";import{applyTheme as R,areAllToolCallsExecuted as E,createNewConversation as M,createUserMessage as _,deleteConversationWithCleanup as O,executeToolCall as k,findParentMessageId as F,getCurrentSelectionContext as v,handleBackToList as W,handleConversationSearch as z,handleConversationSelect as H,handleToolApproval as q,handleToolDenial as L,invertMode as Q,loadInitialData as V,processArtifacts as $,processFinalResponse as N,processStreamingResponse as U,resizeInPanelView as y,updateToolCallInMessage as B}from"./core/index.js";import*as G from"./langs/index.js";import{IS_PROD as J}from"jodit/esm/core/constants.js";import{cache as c,cached as g,component as X,debounce as Y,watch as d}from"jodit/esm/core/decorators/index.js";import{extendLang as Z}from"jodit/esm/core/global.js";import{isAbortError as C,isString as K}from"jodit/esm/core/helpers/index.js";import{Plugin as tt}from"jodit/esm/core/plugin/index.js";import{JoditPro as et}from"../../jodit-pro.js";import{UIFlightPosition as w}from"../../traits/flight-position/flight-position.js";import{UIResize as P}from"../../traits/resize/resize.js";let r=(u=class extends tt{constructor(){super(...arguments),this.buttons=[{name:"aiAssistantPro",group:"insert"},{name:"aiCommandsPro",group:"insert"}],this.__initedPromise=null,this.__openedMode=null}get state(){return this.stateManager.state}get toolRegistry(){return new S(this.j)}get permissionManager(){return new A(this.j,this.toolRegistry)}get apiClient(){return new x(this.j,this.toolRegistry)}get storage(){const{storage:t,storageKey:e,maxConversations:a}=this.j.o.aiAssistantPro;if(typeof t=="string"){const s=D(t,e);return new I(s,a)}return t}get stateManager(){return new T(this.j)}get mainPanel(){return new b(this.j,this.stateManager.state,this.j.o.aiAssistantPro,t=>{const e=this.stateManager.getCurrentConversation();e&&this.stateManager.setCurrentConversation({...e,...t})})}get dialog(){const t=this.j.dlg({resizable:this.j.o.aiAssistantPro.resizable,eventEmmiter:this.j.e});return t.e.on(t,"afterClose",()=>{this.j.e.fire("closeAIAssistantPro.ai-assistant-pro")}),t}afterInit(){Z(G),this.setupEventListeners(),this.j.async.promise(t=>{const{initiallyOpened:e,persistOpenState:a}=this.j.o.aiAssistantPro;let s=e;if(a){this.storage.getGlobalSettings().then(i=>{if(i?.isOpen!=null&&(s=i.isOpen),s)return this.openAssistant()}).catch(()=>null).finally(()=>t(void 0));return}t(void 0)}).catch(()=>null)}__loadData(){return this.__initedPromise?this.__initedPromise:this.isDestructed?Promise.reject():(this.__initedPromise=this.j.async.promise(t=>{this.loadInitialData().then(t)}).catch(()=>null),this.__initedPromise)}async loadInitialData(){this.mainPanel.setMod("ready",!0),await V(this.j,this.storage,this.stateManager)}setupEventListeners(){this.j.e.on("selectConversation.ai-assistant-pro",async t=>{try{await this.__loadData(),await H(t,this.storage,this.stateManager)}catch(e){J||console.log(e)}}),this.j.e.on("newConversation.ai-assistant-pro",async()=>{await this.__loadData();const t=M(this.j,this.state.defaultModel,this.state.defaultTemperature);this.stateManager.setCurrentConversation(t)}),this.j.e.on("deleteConversation.ai-assistant-pro",async t=>{await this.__loadData(),await this.deleteConversation(t)}),this.j.e.on("backToList.ai-assistant-pro",async()=>{await this.__loadData(),await W(this.storage,this.stateManager)}),this.j.e.on("removeContext.ai-assistant-pro",async t=>{await this.__loadData(),this.stateManager.removeSelectionContext(t)}),this.j.e.on("approveToolCall.ai-assistant-pro",async(t,e)=>{try{await this.__loadData();const a=await q(t,e,this.stateManager,this.permissionManager,this.storage);if(a){const s=this.stateManager.getCurrentConversation();if(!s)return;const i=s.messages.find(n=>{var o;return(o=n.toolCalls)===null||o===void 0?void 0:o.some(l=>l.id===a.id)});if(!i)return;await this.executeToolCall(i.id,a)}}catch(a){if(C(a))return;this.stateManager.setError(a instanceof Error?a.message:String(a))}}),this.j.e.on("denyToolCall.ai-assistant-pro",async t=>{await this.__loadData(),await L(this.j,t,this.stateManager,this.storage)}),this.j.e.on("abortRequest.ai-assistant-pro",async()=>{await this.__loadData(),this.apiClient.abort(),this.stateManager.setLoading(!1)})}__applyTheme(){R(this.j,this.stateManager.state.theme,this.stateManager.state.displayMode,this.mainPanel.container,this.dialog)}async openAssistant(){if(this.stateManager.isOpen()){this.stateManager.close(),await this.__closeInContainer();return}await this.__loadData(),!this.isDestructed&&(this.stateManager.open(),await this.__openInContainer(),this.j.o.aiAssistantPro.includeSelectionByDefault&&!this.j.s.isCollapsed()&&this.addCurrentSelectionToContext())}async __openInContainer(){const{resizable:t,allowClose:e,flightPanelHeight:a}=this.j.o.aiAssistantPro,{displayMode:s="right",panelWidth:i,panelHeight:n}=this.stateManager.state;switch(this.__applyTheme(),this.mainPanel.setMod("displayMode",s),this.mainPanel.setMod("allowClose",e),this.mainPanel.setParentView(s==="dialog"||s==="flight"?this.dialog:this.j),this.__openedMode=s,s){case"dialog":{this.dialog.setSize(i,n).open().setContent(this.mainPanel.container);break}case"flight":{w.install(this.mainPanel,this.j.container,{panelHeight:a,containerClassName:this.getFullElName("flight-container")});break}default:{t&&(P.remove(this.mainPanel),P.install(this.mainPanel,Q(s),{handleClassName:this.getFullElName("ai-assistent-resize-handle"),onResize:f(({newSize:o})=>{const l=s==="left"||s==="right"?o:i,p=s==="top"||s==="bottom"?o:n;return this.stateManager.state.panelWidth=l,this.stateManager.state.panelHeight=p,!0},"onResize")})),this.j.currentPlace.slots[s].appendChild(this.mainPanel.container),y(this.j,s,i,n);break}}}__onResizeInPanelView(){const{displayMode:t,panelWidth:e,panelHeight:a}=this.stateManager.state;y(this.j,t,e,a)}async __closeInContainer(){const{displayMode:t}=await this.stateManager.state;switch(this.__openedMode!==t&&this.__openedMode==="dialog"&&this.dialog.close(),this.__openedMode!==t&&this.__openedMode==="flight"&&this.__closeFlightMode(),t){case"dialog":{this.dialog.close();break}case"flight":{this.__closeFlightMode();break}default:{this.mainPanel.container.remove();break}}}__closeFlightMode(){w.remove(this.mainPanel)}__onSavedStateChange(){var t;const e=this.stateManager.state;return this.storage.saveGlobalSettings({displayMode:e.displayMode,panelWidth:e.panelWidth,panelHeight:e.panelHeight,theme:e.theme,defaultModel:e.defaultModel,defaultTemperature:e.defaultTemperature,currentConversationId:(t=e.currentConversation)===null||t===void 0?void 0:t.id,...this.j.o.aiAssistantPro.persistOpenState?{isOpen:e.isOpen}:{}})}async closeAssistant(){this.stateManager.isOpen()&&(await this.__loadData(),this.stateManager.close(),this.__closeInContainer())}async addCurrentSelectionToContext(){await this.__loadData();const t=v(this.j);t&&this.stateManager.addSelectionContext(t)}async executeQuickCommand(t){const{quickCommandsSilentMode:e,quickCommandsDisplayMode:a}=this.j.o.aiAssistantPro,s=this.j.o.aiAssistant;let i;if(s&&s[t]&&K(s[t])&&(i=s[t]),!i){this.j.e.fire("error",`Command not found: ${t}`);return}const n=this.j.s.isCollapsed()?this.j.value:this.j.s.html;if(!n)return;const o=s?.aiCommonPrefixPrompt||"",l=s?.aiCommonSuffixPrompt||"",p=`${o}${i}${l}
2
2
 
3
- ${n}`.trim();e?await this.__executeQuickCommandSilent(p,n):await this.__executeQuickCommandWithPanel(p,a)}async __executeQuickCommandSilent(t,e){await this.__loadData(),this.j.progressbar.show().progress(100);try{const a=_(t),s=M(this.j,this.state.defaultModel,this.state.defaultTemperature,[a]),i=await this.apiClient.sendRequest(s.id,s.messages,null,[],s.options);if(i.mode==="final"){const n=i.response.content;n&&this.j.s.insertHTML(n)}}catch(a){C(a)||this.j.e.fire("error",a)}finally{this.j.progressbar.hide()}}async __executeQuickCommandWithPanel(t,e){await this.__loadData();const a=this.stateManager.state.displayMode;this.stateManager.state.displayMode=e;const s=v(this.j);s&&this.stateManager.addSelectionContext(s),this.stateManager.isOpen()||await this.openAssistant(),await this.sendMessage(t),this.stateManager.state.displayMode=a}async sendMessage(t){await this.__loadData();let e=this.stateManager.getCurrentConversation();const a=this.stateManager.getEditingMessageId();if(a&&e){const i=e.messages.findIndex(n=>n.id===a);if(i!==-1){const n=e.messages.slice(0,i),o={...e,messages:n,updatedAt:Date.now()};this.stateManager.setCurrentConversation(o),await this.storage.save(o),this.stateManager.clearEditingMessage(),e=o}}e||(e=M(this.j,this.state.defaultModel,this.state.defaultTemperature),this.stateManager.setCurrentConversation(e));let s=null;t.trim()&&(s=_(t),e.title||(e={...e,title:t}),e={...e,updated:Date.now(),messages:[...e.messages,s]}),this.stateManager.setCurrentConversation({...e}),s&&this.j.e.fire("messageSent.ai-assistant-pro",s),this.stateManager.setLoading(!0),this.stateManager.clearError();try{await this.sendRequestToAI(0),this.stateManager.clearSelectionContexts()}catch(i){if(C(i))return;this.stateManager.setError(i instanceof Error?i.message:String(i))}finally{this.stateManager.setLoading(!1)}}async sendRequestToAI(t=0){const e=this.j.o.aiAssistantPro.maxRecursionToolCallDepth;if(t>=e)throw Error(`Max recursion depth ${e} reached for tool calls`);let a=this.stateManager.getCurrentConversation();if(!a)return;const s=F(a),[i]=await Promise.all([this.apiClient.sendRequest(a.id,a.messages,s,this.stateManager.getSelectionContexts(),a.options),this.storage.save(a)]);let n,o;if(i.mode==="stream"){const l=await U(this.stateManager,i,a);n=l.aiMessage,o=l.index,a=l.conversation}else{const l=N(i,a);n=l.aiMessage,o=l.index,a=l.conversation}a=await $(this.j,n,a,o),this.j.e.fire("messageReceived.ai-assistant-pro",n),this.stateManager.setCurrentConversation({...a}),await this.storage.save(a),await this.handleToolCalls(n.id,t)}async deleteConversation(t){await this.__loadData(),await O(this.j,t,this.storage,this.stateManager,this.permissionManager)}async searchConversations(t){await this.__loadData(),await H(t,this.storage,this.stateManager)}async handleToolCalls(t,e=0){const a=this.stateManager.getCurrentConversation();if(!a)return;const s=a.messages.find(l=>l.id===t);if(!s)return;const i=s.toolCalls;if(!i||i.length===0)return;await this.__loadData();const{approved:n,needsPermission:o}=this.permissionManager.filterToolCalls(i,a.permissions);this.stateManager.setPendingToolCalls(o);for(const l of n)await this.executeToolCall(t,l,e)}async executeToolCall(t,e,a=0){await this.__loadData();let s=this.stateManager.getCurrentConversation();if(!s)return;const i=await k(this.j,e,this.toolRegistry),n=s.messages.findIndex(p=>p.id===t);if(n===-1)return;const o=s.messages[n],l=s.messages.slice();l[n]=B(o,i),s={...s,messages:l,updated:Date.now()},this.stateManager.setCurrentConversation(s),E(s)&&await this.sendRequestToAI(a+1)}async copyMessage(t){const e=this.stateManager.getCurrentConversation();if(!e)return;const a=e.messages.find(s=>s.id===t);if(a)try{await navigator.clipboard.writeText(a.content),this.j.message.success("Message copied to clipboard")}catch{this.j.e.fire("error",new Error("Failed to copy message"))}}async restartFromMessage(t){const e=this.stateManager.getCurrentConversation();if(!e)return;const a=e.messages.findIndex(o=>o.id===t);if(a===-1)return;const s=e.messages[a];if(s.role!=="user")return;await this.__loadData();const i=e.messages.slice(0,a),n={...e,messages:i,updatedAt:Date.now()};this.stateManager.setCurrentConversation(n),await this.storage.save(n),await this.sendMessage(s.content)}async editMessage(t){const e=this.stateManager.getCurrentConversation();if(!e)return;const a=e.messages.find(s=>s.id===t);!a||a.role!=="user"||(this.stateManager.setEditingMessageId(t),this.mainPanel.inputArea.setValue(a.content),this.mainPanel.inputArea.focus())}cancelEditMessage(){this.stateManager.isEditingMessage()&&(this.stateManager.clearEditingMessage(),this.mainPanel.inputArea.setValue(""))}async deleteMessage(t){await this.__loadData();const e=this.stateManager.getCurrentConversation();if(!e||e.messages.findIndex(n=>n.id===t)===-1)return;const s=e.messages.filter(n=>n.id!==t),i={...e,messages:s,updatedAt:Date.now()};this.stateManager.setCurrentConversation(i),await this.storage.save(i)}beforeDestruct(){var t,e,a,s,i,n,o,l;this.__closeFlightMode(),(t=g(this,"toolRegistry"))===null||t===void 0||t.destruct(),(e=g(this,"permissionManager"))===null||e===void 0||e.destruct(),(a=g(this,"apiClient"))===null||a===void 0||a.destruct(),(s=g(this,"stateManager"))===null||s===void 0||s.destruct(),(i=g(this,"mainPanel"))===null||i===void 0||i.destruct(),(n=g(this,"dialog"))===null||n===void 0||n.destruct(),(l=(o=g(this,"storage"))===null||o===void 0?void 0:o.close)===null||l===void 0||l.call(o)}},f(u,"aiAssistantPro"),u);r.requires=["license"],h([c],r.prototype,"toolRegistry",null),h([c],r.prototype,"permissionManager",null),h([c],r.prototype,"apiClient",null),h([c],r.prototype,"storage",null),h([c],r.prototype,"stateManager",null),h([c],r.prototype,"mainPanel",null),h([c],r.prototype,"dialog",null),h([d("state.theme")],r.prototype,"__applyTheme",null),h([d(":openAIAssistantPro.ai-assistant-pro")],r.prototype,"openAssistant",null),h([d(["state.panelWidth","state.panelHeight"])],r.prototype,"__onResizeInPanelView",null),h([d(["state.isOpen","state.displayMode","state.panelWidth","state.panelHeight","state.theme","state.defaultModel","state.defaultTemperature","state.currentConversation"]),Y()],r.prototype,"__onSavedStateChange",null),h([d(":closeAIAssistantPro.ai-assistant-pro")],r.prototype,"closeAssistant",null),h([d(":addContextToAIAssistant.ai-assistant-pro")],r.prototype,"addCurrentSelectionToContext",null),h([d(":executeQuickCommand.ai-assistant-pro")],r.prototype,"executeQuickCommand",null),h([d(":sendMessage.ai-assistant-pro")],r.prototype,"sendMessage",null),h([d(":searchConversations.ai-assistant-pro")],r.prototype,"searchConversations",null),h([d(":copyMessage.ai-assistant-pro")],r.prototype,"copyMessage",null),h([d(":restartFromMessage.ai-assistant-pro")],r.prototype,"restartFromMessage",null),h([d(":editMessage.ai-assistant-pro")],r.prototype,"editMessage",null),h([d(":cancelEditMessage.ai-assistant-pro")],r.prototype,"cancelEditMessage",null),h([d(":deleteMessage.ai-assistant-pro")],r.prototype,"deleteMessage",null),r=h([X],r);et.plugins.add("aiAssistantPro",r);export{r as aiAssistantPro};
3
+ ${n}`.trim();e?await this.__executeQuickCommandSilent(p,n):await this.__executeQuickCommandWithPanel(p,a)}async __executeQuickCommandSilent(t,e){await this.__loadData(),this.j.progressbar.show().progress(100);try{const a=_(t),s=M(this.j,this.state.defaultModel,this.state.defaultTemperature,[a]),i=await this.apiClient.sendRequest(s.id,s.messages,null,[],s.options);if(i.mode==="final"){const n=i.response.content;n&&this.j.s.insertHTML(n)}}catch(a){C(a)||this.j.e.fire("error",a)}finally{this.j.progressbar.hide()}}async __executeQuickCommandWithPanel(t,e){await this.__loadData();const a=this.stateManager.state.displayMode;this.stateManager.state.displayMode=e;const s=v(this.j);s&&this.stateManager.addSelectionContext(s),this.stateManager.isOpen()||await this.openAssistant(),await this.sendMessage(t),this.stateManager.state.displayMode=a}async sendMessage(t){await this.__loadData();let e=this.stateManager.getCurrentConversation();const a=this.stateManager.getEditingMessageId();if(a&&e){const i=e.messages.findIndex(n=>n.id===a);if(i!==-1){const n=e.messages.slice(0,i),o={...e,messages:n,updatedAt:Date.now()};this.stateManager.setCurrentConversation(o),await this.storage.save(o),this.stateManager.clearEditingMessage(),e=o}}e||(e=M(this.j,this.state.defaultModel,this.state.defaultTemperature),this.stateManager.setCurrentConversation(e));let s=null;t.trim()&&(s=_(t),e.title||(e={...e,title:t}),e={...e,updated:Date.now(),messages:[...e.messages,s]}),this.stateManager.setCurrentConversation({...e}),s&&this.j.e.fire("messageSent.ai-assistant-pro",s),this.stateManager.setLoading(!0),this.stateManager.clearError();try{await this.sendRequestToAI(0),this.stateManager.clearSelectionContexts()}catch(i){if(C(i))return;this.stateManager.setError(i instanceof Error?i.message:String(i))}finally{this.stateManager.setLoading(!1)}}async sendRequestToAI(t=0){const e=this.j.o.aiAssistantPro.maxRecursionToolCallDepth;if(t>=e)throw Error(`Max recursion depth ${e} reached for tool calls`);let a=this.stateManager.getCurrentConversation();if(!a)return;const s=F(a),[i]=await Promise.all([this.apiClient.sendRequest(a.id,a.messages,s,this.stateManager.getSelectionContexts(),a.options),this.storage.save(a)]);let n,o;if(i.mode==="stream"){const l=await U(this.stateManager,i,a);n=l.aiMessage,o=l.index,a=l.conversation}else{const l=N(i,a);n=l.aiMessage,o=l.index,a=l.conversation}a=await $(this.j,n,a,o),this.j.e.fire("messageReceived.ai-assistant-pro",n),this.stateManager.setCurrentConversation({...a}),await this.storage.save(a),await this.handleToolCalls(n.id,t)}async deleteConversation(t){await this.__loadData(),await O(this.j,t,this.storage,this.stateManager,this.permissionManager)}async searchConversations(t){await this.__loadData(),await z(t,this.storage,this.stateManager)}async handleToolCalls(t,e=0){const a=this.stateManager.getCurrentConversation();if(!a)return;const s=a.messages.find(l=>l.id===t);if(!s)return;const i=s.toolCalls;if(!i||i.length===0)return;await this.__loadData();const{approved:n,needsPermission:o}=this.permissionManager.filterToolCalls(i,a.permissions);this.stateManager.setPendingToolCalls(o);for(const l of n)await this.executeToolCall(t,l,e)}async executeToolCall(t,e,a=0){await this.__loadData();let s=this.stateManager.getCurrentConversation();if(!s)return;const i=await k(this.j,e,this.toolRegistry),n=s.messages.findIndex(p=>p.id===t);if(n===-1)return;const o=s.messages[n],l=s.messages.slice();l[n]=B(o,i),s={...s,messages:l,updated:Date.now()},this.stateManager.setCurrentConversation(s),E(s)&&await this.sendRequestToAI(a+1)}async copyMessage(t){const e=this.stateManager.getCurrentConversation();if(!e)return;const a=e.messages.find(s=>s.id===t);if(a)try{await navigator.clipboard.writeText(a.content),this.j.message.success("Message copied to clipboard")}catch{this.j.e.fire("error",new Error("Failed to copy message"))}}async restartFromMessage(t){const e=this.stateManager.getCurrentConversation();if(!e)return;const a=e.messages.findIndex(o=>o.id===t);if(a===-1)return;const s=e.messages[a];if(s.role!=="user")return;await this.__loadData();const i=e.messages.slice(0,a),n={...e,messages:i,updatedAt:Date.now()};this.stateManager.setCurrentConversation(n),await this.storage.save(n),await this.sendMessage(s.content)}async editMessage(t){const e=this.stateManager.getCurrentConversation();if(!e)return;const a=e.messages.find(s=>s.id===t);!a||a.role!=="user"||(this.stateManager.setEditingMessageId(t),this.mainPanel.inputArea.setValue(a.content),this.mainPanel.inputArea.focus())}cancelEditMessage(){this.stateManager.isEditingMessage()&&(this.stateManager.clearEditingMessage(),this.mainPanel.inputArea.setValue(""))}async deleteMessage(t){await this.__loadData();const e=this.stateManager.getCurrentConversation();if(!e||e.messages.findIndex(n=>n.id===t)===-1)return;const s=e.messages.filter(n=>n.id!==t),i={...e,messages:s,updatedAt:Date.now()};this.stateManager.setCurrentConversation(i),await this.storage.save(i)}beforeDestruct(){var t,e,a,s,i,n,o,l;this.__closeFlightMode(),(t=g(this,"toolRegistry"))===null||t===void 0||t.destruct(),(e=g(this,"permissionManager"))===null||e===void 0||e.destruct(),(a=g(this,"apiClient"))===null||a===void 0||a.destruct(),(s=g(this,"stateManager"))===null||s===void 0||s.destruct(),(i=g(this,"mainPanel"))===null||i===void 0||i.destruct(),(n=g(this,"dialog"))===null||n===void 0||n.destruct(),(l=(o=g(this,"storage"))===null||o===void 0?void 0:o.close)===null||l===void 0||l.call(o)}},f(u,"aiAssistantPro"),u);r.requires=["license"],h([c],r.prototype,"toolRegistry",null),h([c],r.prototype,"permissionManager",null),h([c],r.prototype,"apiClient",null),h([c],r.prototype,"storage",null),h([c],r.prototype,"stateManager",null),h([c],r.prototype,"mainPanel",null),h([c],r.prototype,"dialog",null),h([d("state.theme")],r.prototype,"__applyTheme",null),h([d(":openAIAssistantPro.ai-assistant-pro")],r.prototype,"openAssistant",null),h([d([":resize","state.panelWidth","state.panelHeight"])],r.prototype,"__onResizeInPanelView",null),h([d(["state.isOpen","state.displayMode","state.panelWidth","state.panelHeight","state.theme","state.defaultModel","state.defaultTemperature","state.currentConversation"]),Y()],r.prototype,"__onSavedStateChange",null),h([d(":closeAIAssistantPro.ai-assistant-pro")],r.prototype,"closeAssistant",null),h([d(":addContextToAIAssistant.ai-assistant-pro")],r.prototype,"addCurrentSelectionToContext",null),h([d(":executeQuickCommand.ai-assistant-pro")],r.prototype,"executeQuickCommand",null),h([d(":sendMessage.ai-assistant-pro")],r.prototype,"sendMessage",null),h([d(":searchConversations.ai-assistant-pro")],r.prototype,"searchConversations",null),h([d(":copyMessage.ai-assistant-pro")],r.prototype,"copyMessage",null),h([d(":restartFromMessage.ai-assistant-pro")],r.prototype,"restartFromMessage",null),h([d(":editMessage.ai-assistant-pro")],r.prototype,"editMessage",null),h([d(":cancelEditMessage.ai-assistant-pro")],r.prototype,"cancelEditMessage",null),h([d(":deleteMessage.ai-assistant-pro")],r.prototype,"deleteMessage",null),r=h([X],r);et.plugins.add("aiAssistantPro",r);export{r as aiAssistantPro};
@@ -1 +1 @@
1
- var l=Object.defineProperty;var o=(a,t)=>l(a,"name",{value:t,configurable:!0});import{createAIMessage as p,createErrorMessage as d,uploadArtifacts as i}from"./message-builder.js";async function m(a,t,s){let e=p(),r=-1;for await(const n of t.stream){switch(n.type){case"created":{e={...e,id:n.response.responseId,content:""},r=s.messages.length;break}case"text-delta":{e={...e,content:e.content+n.delta};break}case"completed":{e={...e,toolCalls:n.response.toolCalls||[],artifacts:n.response.artifacts||[]};break}case"error":{const c=d(n.error);e={...e,id:c.id,content:c.content};break}}if(e.id){const c=s.messages.slice();c[r>=0?r:s.messages.length]=e,s={...s,messages:c,updated:Date.now()},a.setCurrentConversation(s)}}return{aiMessage:e,index:r,conversation:s}}o(m,"processStreamingResponse");function u(a,t){const s={...p(),id:a.response.responseId,content:a.response.content,toolCalls:a.response.toolCalls||[],artifacts:a.response.artifacts||[]},e=t.messages.slice();e.push(s),t={...t,messages:e,updated:Date.now()};const r=t.messages.length-1;return{aiMessage:s,index:r,conversation:t}}o(u,"processFinalResponse");async function h(a,t,s,e){if(t.artifacts&&t.artifacts.length>0){const r=s.messages.slice();return r[e]={...r[e],artifacts:await i(a,t.artifacts)},{...s,messages:r,updated:Date.now()}}return s}o(h,"processArtifacts");export{h as processArtifacts,u as processFinalResponse,m as processStreamingResponse};
1
+ var l=Object.defineProperty;var c=(a,t)=>l(a,"name",{value:t,configurable:!0});import{createAIMessage as p,createErrorMessage as d,uploadArtifacts as i}from"./message-builder.js";async function m(a,t,s){let e=p(),r=-1;for await(const n of t.stream){switch(n.type){case"created":{e={...e,id:n.response.responseId,content:""},r=s.messages.length;break}case"text-delta":{e={...e,content:e.content+n.delta};break}case"completed":{e={...e,id:n.response.responseId,toolCalls:n.response.toolCalls||[],artifacts:n.response.artifacts||[]};break}case"error":{const o=d(n.error);e={...e,id:o.id,content:o.content};break}}if(e.id){const o=s.messages.slice();o[r>=0?r:s.messages.length]=e,s={...s,messages:o,updated:Date.now()},a.setCurrentConversation(s)}}return{aiMessage:e,index:r,conversation:s}}c(m,"processStreamingResponse");function u(a,t){const s={...p(),id:a.response.responseId,content:a.response.content,toolCalls:a.response.toolCalls||[],artifacts:a.response.artifacts||[]},e=t.messages.slice();e.push(s),t={...t,messages:e,updated:Date.now()};const r=t.messages.length-1;return{aiMessage:s,index:r,conversation:t}}c(u,"processFinalResponse");async function h(a,t,s,e){if(t.artifacts&&t.artifacts.length>0){const r=s.messages.slice();return r[e]={...r[e],artifacts:await i(a,t.artifacts)},{...s,messages:r,updated:Date.now()}}return s}c(h,"processArtifacts");export{h as processArtifacts,u as processFinalResponse,m as processStreamingResponse};
@@ -1 +1 @@
1
- var s=Object.defineProperty;var l=(r,t)=>s(r,"name",{value:t,configurable:!0});function c(r){switch(r){case"left":return"right";case"right":return"left";case"top":return"bottom";case"bottom":return"top"}}l(c,"invertMode");function f(r,t,u,i){var e,n,o;t==="dialog"||t==="flight"||((t==="left"||t==="right")&&((e=r.currentPlace.slots[c(t)])===null||e===void 0||e.style.setProperty(`--jd-slot-${c(t)}-width`,"auto"),(n=r.currentPlace.slots[t])===null||n===void 0||n.style.setProperty(`--jd-slot-${t}-width`,`${u}px`)),(o=r.currentPlace.slots[t])===null||o===void 0||o.style.setProperty("min-height",`${i}px`))}l(f,"resizeInPanelView");export{c as invertMode,f as resizeInPanelView};
1
+ var f=Object.defineProperty;var l=(r,t)=>f(r,"name",{value:t,configurable:!0});import{css as v}from"jodit/esm/core/helpers/utils/css.js";function i(r){switch(r){case"left":return"right";case"right":return"left";case"top":return"bottom";case"bottom":return"top"}}l(i,"invertMode");function P(r,t,u,s){var e,n,o,c;if(t==="dialog"||t==="flight")return;(t==="left"||t==="right")&&((e=r.currentPlace.slots[i(t)])===null||e===void 0||e.style.setProperty(`--jd-slot-${i(t)}-width`,"auto"),(n=r.currentPlace.slots[t])===null||n===void 0||n.style.setProperty(`--jd-slot-${t}-width`,`${u}px`));const h=(o=v(r.currentPlace.workplace,"height"))!==null&&o!==void 0?o:0;(c=r.currentPlace.slots[t])===null||c===void 0||c.style.setProperty("min-height",`${Math.min(h,s)}px`)}l(P,"resizeInPanelView");export{i as invertMode,P as resizeInPanelView};
@@ -1 +1 @@
1
- var b=Object.defineProperty;var m=(y,o)=>b(y,"name",{value:o,configurable:!0});import{IS_PROD as C}from"jodit/esm/core/constants.js";import{abort as R}from"jodit/esm/core/helpers/index.js";const w=class w{constructor(o,t){this.jodit=o,this.toolRegistry=t,this.abortControllers=new Set}async sendRequest(o,t,e,r,l){const{apiRequest:n,requestTimeout:c,maxRetries:i}=this.jodit.o.aiAssistantPro;if(!n)throw new Error("AI Assistant Pro callback is not configured");const s=new AbortController;this.abortControllers.add(s);try{const a=this.buildRequestContext(o,t,e,r,l);let h=null;for(let f=0;f<=i;f++)try{if(s.signal.aborted)throw R();const d=setTimeout(()=>{s.abort()},c);try{const u=await n(a,s.signal);return clearTimeout(d),this.validateResponse(u),u}catch(u){throw clearTimeout(d),u}}catch(d){if(h=d,C||console.warn(`API request attempt ${f+1} failed:`,d),f<i){const u=this.calculateRetryDelay(f);await this.sleep(u)}else throw d}throw h||new Error("API request failed after all retries")}finally{this.abortControllers.delete(s)}}abort(){this.abortControllers.forEach(o=>{o.abort()}),this.abortControllers.clear()}isInProgress(){return this.abortControllers.size>0}buildRequestContext(o,t,e,r,l){const{apiMode:n,instructions:c}=this.jodit.o.aiAssistantPro;let i={mode:n,conversationId:o,tools:this.toolRegistry.getAllTools(),selectionContexts:r,conversationOptions:l,instructions:c},s=[];if(n==="full")s=t;else if(e){const a=t.findIndex(h=>h.id===e);a!==-1?s=t.slice(a+1):s=t,i={...i,parentMessageId:e}}else s=t;return i={...i,messages:this.expandToolMessages(s,t.find(a=>a.id===e))},i}expandToolMessages(o,t){const e=[];for(const r of o)e.push(r),this.expandToolResultsMessage(r,e);return t&&this.expandToolResultsMessage(t,e),e}expandToolResultsMessage(o,t){var e;if(o.toolCalls&&o.toolCalls.length>0)for(const r of o.toolCalls){const l=(e=r.result)!==null&&e!==void 0?e:{error:"result not found"};if(t.find(c=>c.id===`${r.id}-result`))continue;const n={id:`${r.id}-result`,role:"tool",content:l.error?`Error: ${l.error}`:JSON.stringify(l.result),timestamp:o.timestamp,toolResults:[{toolCallId:r.id,result:l}]};t.push(n)}}validateResponse(o){if(o.mode!=="final")return;const t=o.response;if(!t)throw new Error("API returned empty response");if(!t.responseId)throw new Error("API response missing messageId");if(t.content===void 0)throw new Error("API response missing content");if(t.finished===void 0)throw new Error("API response missing finished flag");if(t.toolCalls){if(!Array.isArray(t.toolCalls))throw new Error("API response toolCalls must be an array");t.toolCalls.forEach((e,r)=>{if(!e.id)throw new Error(`Tool call at index ${r} is missing id`);if(!e.name)throw new Error(`Tool call at index ${r} is missing name`);if(!e.arguments||typeof e.arguments!="object")throw new Error(`Tool call at index ${r} has invalid arguments`)})}}calculateRetryDelay(o){const{retryDelay:t}=this.jodit.o.aiAssistantPro,e=t*Math.pow(2,o),r=Math.random()*t;return e+r}sleep(o){return new Promise(t=>setTimeout(t,o))}destruct(){this.abort()}};m(w,"APIClient");let p=w;export{p as APIClient};
1
+ var b=Object.defineProperty;var w=(y,o)=>b(y,"name",{value:o,configurable:!0});import{IS_PROD as C}from"jodit/esm/core/constants.js";import{abort as R}from"jodit/esm/core/helpers/index.js";const p=class p{constructor(o,t){this.jodit=o,this.toolRegistry=t,this.abortControllers=new Set}async sendRequest(o,t,e,r,l){const{apiRequest:n,requestTimeout:c,maxRetries:i}=this.jodit.o.aiAssistantPro;if(!n)throw new Error("AI Assistant Pro callback is not configured");const s=new AbortController;this.abortControllers.add(s);try{const a=this.buildRequestContext(o,t,e,r,l);let h=null;for(let f=0;f<=i;f++)try{if(s.signal.aborted)throw R();const d=setTimeout(()=>{s.abort()},c);try{const u=await n(a,s.signal);return clearTimeout(d),this.validateResponse(u),u}catch(u){throw clearTimeout(d),u}}catch(d){if(h=d,C||console.warn(`API request attempt ${f+1} failed:`,d),f<i){const u=this.calculateRetryDelay(f);await this.sleep(u)}else throw d}throw h||new Error("API request failed after all retries")}finally{this.abortControllers.delete(s)}}abort(){this.abortControllers.forEach(o=>{o.abort()}),this.abortControllers.clear()}isInProgress(){return this.abortControllers.size>0}buildRequestContext(o,t,e,r,l){const{apiMode:n,instructions:c}=this.jodit.o.aiAssistantPro;let i={mode:n,conversationId:o,tools:this.toolRegistry.getAllTools(),selectionContexts:r,conversationOptions:l,instructions:c},s=[];if(n==="full")s=t;else if(e){const a=t.findIndex(h=>h.id===e);a!==-1?s=t.slice(a+1):s=t,i={...i,parentMessageId:e}}else s=t;return i={...i,messages:this.expandToolMessages(s,t.find(a=>a.id===e))},i}expandToolMessages(o,t){const e=[];for(const r of o)e.push(r),this.expandToolResultsMessage(r,e);return t&&this.expandToolResultsMessage(t,e),e}expandToolResultsMessage(o,t){var e;if(o.toolCalls&&o.toolCalls.length>0)for(const r of o.toolCalls){const l=(e=r.result)!==null&&e!==void 0?e:{error:"result not found"};if(t.find(c=>c.id===`${r.id}-result`))continue;const n={id:`${r.id}-result`,role:"tool",content:l.error?`Error: ${l.error}`:JSON.stringify(l.result),timestamp:o.timestamp,toolResults:[{toolCallId:r.id,result:l}]};t.push(n)}}validateResponse(o){if(o.mode!=="final")return;const t=o.response;if(!t)throw new Error("API returned empty response");if(!t.responseId)throw new Error("API response missing responseId");if(t.content===void 0)throw new Error("API response missing content");if(t.finished===void 0)throw new Error("API response missing finished flag");if(t.toolCalls){if(!Array.isArray(t.toolCalls))throw new Error("API response toolCalls must be an array");t.toolCalls.forEach((e,r)=>{if(!e.id)throw new Error(`Tool call at index ${r} is missing id`);if(!e.name)throw new Error(`Tool call at index ${r} is missing name`);if(!e.arguments||typeof e.arguments!="object")throw new Error(`Tool call at index ${r} has invalid arguments`)})}}calculateRetryDelay(o){const{retryDelay:t}=this.jodit.o.aiAssistantPro,e=t*Math.pow(2,o),r=Math.random()*t;return e+r}sleep(o){return new Promise(t=>setTimeout(t,o))}destruct(){this.abort()}};w(p,"APIClient");let m=p;export{m as APIClient};
@@ -1 +1 @@
1
- import"jodit/esm/plugins/all.js";import"./paste-from-word/paste-from-word.js";import"./license/license.js";import"./autocomplete/autocomplete.js";import"jodit/esm/plugins/speech-recognize/speech-recognize.js";import"./ai-assistant-pro/ai-assistant-pro.js";import"./backup/backup.js";import"./button-generator/button-generator.js";import"./change-case/change-case.js";import"./color-picker/color-picker.js";import"./emoji/emoji.js";import"./export-docs/export-docs.js";import"./finder/finder.js";import"./google-maps/google-maps.js";import"./google-search/google-search.js";import"./highlight-signature/highlight-signature.js";import"./iframe-editor/iframe-editor.js";import"./keyboard/keyboard.js";import"./mobile-view/mobile-view.js";import"./page-break/page-break.js";import"./paste-code/paste-code.js";import"./show-blocks/show-blocks.js";import"./todo-list/todo-list.js";import"./translate/translate.js";import"./tune-block/tune-block.js";
1
+ import"jodit/esm/plugins/all.js";import"./paste-from-word/paste-from-word.js";import"./license/license.js";import"./autocomplete/autocomplete.js";import"jodit/esm/plugins/speech-recognize/speech-recognize.js";import"./ai-assistant-pro/ai-assistant-pro.js";import"./backup/backup.js";import"./button-generator/button-generator.js";import"./change-case/change-case.js";import"./color-picker/color-picker.js";import"./emoji/emoji.js";import"./export-docs/export-docs.js";import"./finder/finder.js";import"./google-maps/google-maps.js";import"./google-search/google-search.js";import"./highlight-signature/highlight-signature.js";import"./iframe-editor/iframe-editor.js";import"./keyboard/keyboard.js";import"./mobile-view/mobile-view.js";import"./page-break/page-break.js";import"./paste-code/paste-code.js";import"./show-blocks/show-blocks.js";import"./style/style.js";import"./todo-list/todo-list.js";import"./translate/translate.js";import"./tune-block/tune-block.js";
@@ -0,0 +1,13 @@
1
+ /*!
2
+ * Jodit Editor PRO (https://xdsoft.net/jodit/)
3
+ * See LICENSE.md in the project root for license information.
4
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/
5
+ */
6
+ import type { IStyleDefinition } from "./interface";
7
+ declare module 'jodit/esm/config' {
8
+ interface Config {
9
+ customStyles: {
10
+ definitions: IStyleDefinition[];
11
+ };
12
+ }
13
+ }
@@ -0,0 +1 @@
1
+ import{detectActiveStyle as n}from"./helpers/detect-active-style.js";import{buildStylePopup as r}from"./ui/style-popup.js";import f from"./icon.svg.js";import{Config as i}from"jodit/esm/config.js";i.prototype.customStyles={definitions:[]},i.prototype.controls.style={tooltip:"Styles",icon:f,isDisabled(t){return!t.o.customStyles.definitions.length||!t.s.current()},isActive(t){const e=t.o.customStyles.definitions;return e.length?n(t,e)!=null:!1},update(t,e){const o=t.o.customStyles.definitions;if(!o.length)return;const s=n(t,o);t.o.textIcons&&(s?e.state.text=s.name:e.state.text="")},popup(t,e,o){const s=t.o.customStyles.definitions;if(!s.length)return!1;t.s.save();const l=r(t,s,()=>{t.s.restore(),o()});return t.e.one("beforePopupClose",()=>{t.s.restore()}),l}};
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Jodit Editor PRO (https://xdsoft.net/jodit/)
3
+ * See LICENSE.md in the project root for license information.
4
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/
5
+ */
6
+ import type { IJodit } from "jodit/esm/types/index";
7
+ import type { IStyleDefinition } from "../interface";
8
+ export declare function applyStyle(editor: IJodit, def: IStyleDefinition, definitions: IStyleDefinition[]): void;
@@ -0,0 +1 @@
1
+ var i=Object.defineProperty;var r=(s,t)=>i(s,"name",{value:t,configurable:!0});import{detectActiveStyle as m}from"./detect-active-style.js";import{IS_BLOCK as c}from"jodit/esm/core/constants.js";import{Dom as l}from"jodit/esm/core/dom/dom.js";function a(s,t){const n=s.s.current();if(!n)return null;if(c.test(t.element))return l.closest(n,l.isBlock,s.editor);let e=l.isElement(n)?n:n.parentNode;for(;e&&e!==s.editor;){if(l.isElement(e)&&e.nodeName.toLowerCase()===t.element)return e;e=e.parentNode}return null}r(a,"findTarget");function o(s,t){for(const n of t)s.classList.remove(n);s.className===""&&s.removeAttribute("class")}r(o,"removeClassesFromElement");function u(s,t){if(t.classes.length<=1)return;const n=s.s.current();if(n)if(c.test(t.element)){const e=l.closest(n,l.isBlock,s.editor);e&&o(e,t.classes.slice(1))}else{const e=a(s,t);e&&(o(e,t.classes.slice(1)),e.nodeName.toLowerCase()==="span"&&!e.attributes.length&&l.unwrap(e))}}r(u,"cleanupExtraClasses");function f(s,t){if(t.classes.length<=1)return;const n=a(s,t);if(n)for(let e=1;e<t.classes.length;e++)n.classList.add(t.classes[e])}r(f,"addExtraClasses");function h(s,t,n){const e=m(s,n);e&&(s.s.commitStyle({element:e.element,attributes:{class:e.classes[0]}}),u(s,e),e===t)||(s.s.commitStyle({element:t.element,attributes:{class:t.classes[0]}}),f(s,t))}r(h,"applyStyle");export{h as applyStyle};
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * Jodit Editor PRO (https://xdsoft.net/jodit/)
3
+ * See LICENSE.md in the project root for license information.
4
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/
5
+ */
6
+ import type { IStyleDefinition, IStyleGroup } from "../interface";
7
+ export declare function classifyDefinitions(definitions: IStyleDefinition[]): IStyleGroup[];
@@ -0,0 +1 @@
1
+ var f=Object.defineProperty;var o=(e,t)=>f(e,"name",{value:t,configurable:!0});import{IS_BLOCK as l}from"jodit/esm/core/constants.js";function r(e){const t=[],s=[];for(const n of e)l.test(n.element)?t.push(n):s.push(n);const i=[];return t.length&&i.push({title:"Block styles",definitions:t}),s.length&&i.push({title:"Text styles",definitions:s}),i}o(r,"classifyDefinitions");export{r as classifyDefinitions};
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Jodit Editor PRO (https://xdsoft.net/jodit/)
3
+ * See LICENSE.md in the project root for license information.
4
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/
5
+ */
6
+ import type { IJodit } from "jodit/esm/types/index";
7
+ import type { IStyleDefinition } from "../interface";
8
+ export declare function detectActiveStyle(editor: IJodit, definitions: IStyleDefinition[]): IStyleDefinition | null;
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var i=(t,r)=>c(t,"name",{value:r,configurable:!0});import{IS_BLOCK as f}from"jodit/esm/core/constants.js";import{Dom as s}from"jodit/esm/core/dom/dom.js";function l(t,r){return t.nodeName.toLowerCase()!==r.element?!1:r.classes.every(n=>t.classList.contains(n))}i(l,"elementMatchesDefinition");function d(t,r){const n=t.s.current();if(!n)return null;for(const o of r)if(f.test(o.element)){const e=s.closest(n,s.isBlock,t.editor);if(e&&l(e,o))return o}else{let e=s.isElement(n)?n:n.parentNode;for(;e&&e!==t.editor;){if(s.isElement(e)&&l(e,o))return o;e=e.parentNode}}return null}i(d,"detectActiveStyle");export{d as detectActiveStyle};
@@ -0,0 +1 @@
1
+ var t='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="1.5"> <rect x="2" y="3.5" width="9" height="9" rx="1.5" fill="none"/> <rect x="2" y="14.5" width="9" height="9" rx="1.5" fill="none"/> <rect x="13" y="14.5" width="9" height="9" rx="1.5" fill="none"/> <rect x="13" y="3.5" width="9" height="9" rx="1.5" fill="currentColor" transform="rotate(45 17.5 8)"/> </svg> ';export{t as default};
@@ -0,0 +1,15 @@
1
+ /*!
2
+ * Jodit Editor PRO (https://xdsoft.net/jodit/)
3
+ * See LICENSE.md in the project root for license information.
4
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/
5
+ */
6
+ import type { HTMLTagNames } from "jodit/esm/types/index";
7
+ export interface IStyleDefinition {
8
+ name: string;
9
+ element: HTMLTagNames;
10
+ classes: string[];
11
+ }
12
+ export interface IStyleGroup {
13
+ title: string;
14
+ definitions: IStyleDefinition[];
15
+ }
File without changes
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * Jodit Editor PRO (https://xdsoft.net/jodit/)
3
+ * See LICENSE.md in the project root for license information.
4
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/
5
+ */
6
+ import type { IJodit } from "jodit/esm/types/index";
7
+ import "./config";
8
+ import { Plugin } from "jodit/esm/core/plugin/index";
9
+ export declare class style extends Plugin {
10
+ /** @override */
11
+ static requires: string[];
12
+ /** @override */
13
+ buttons: Plugin['buttons'];
14
+ /** @override */
15
+ protected afterInit(_jodit: IJodit): void;
16
+ /** @override */
17
+ protected beforeDestruct(_jodit: IJodit): void;
18
+ }
@@ -0,0 +1 @@
1
+ var s=Object.defineProperty;var e=(i,r)=>s(i,"name",{value:r,configurable:!0});import"./config.js";import{Plugin as n}from"jodit/esm/core/plugin/index.js";import{JoditPro as u}from"../../jodit-pro.js";const o=class o extends n{constructor(){super(...arguments),this.buttons=[{name:"style",group:"font"}]}afterInit(r){}beforeDestruct(r){}};e(o,"style");let t=o;t.requires=["license"],u.plugins.add("style",t);export{t as style};
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Jodit Editor PRO (https://xdsoft.net/jodit/)
3
+ * See LICENSE.md in the project root for license information.
4
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/
5
+ */
6
+ import type { IJodit } from "jodit/esm/types/index";
7
+ import type { IStyleDefinition } from "../interface";
8
+ export declare function buildStylePopup(editor: IJodit, definitions: IStyleDefinition[], close: () => void): HTMLElement;
@@ -0,0 +1 @@
1
+ var y=Object.defineProperty;var _=(t,s)=>y(t,"name",{value:s,configurable:!0});import{applyStyle as h}from"../helpers/apply-style.js";import{classifyDefinitions as $}from"../helpers/classify-definitions.js";import{detectActiveStyle as b}from"../helpers/detect-active-style.js";const e="jodit-style-popup";function w(t,s,f){const u=$(s),m=b(t,s),o=t.c.div(e);for(const p of u){const a=t.c.div(`${e}__group-title`);a.textContent=t.i18n(p.title),o.appendChild(a);const i=t.c.div(`${e}__grid`);for(const c of p.definitions){const n=t.c.element("button");n.type="button";const v=m===c;n.className=`${e}__card`+(v?` ${e}__card_active_true`:"");const d=t.c.div(`${e}__card-preview`),l=t.c.element(c.element);for(const C of c.classes)l.classList.add(C);l.textContent=c.name,d.appendChild(l),n.appendChild(d);const r=t.c.div(`${e}__card-label`);r.textContent=c.name,n.appendChild(r),t.e.on(n,"click",()=>{t.s.focus(),h(t,c,s),t.synchronizeValues(),f()}),i.appendChild(n)}o.appendChild(i)}return o}_(w,"buildStylePopup");export{w as buildStylePopup};
@@ -16,7 +16,8 @@ const links = {
16
16
  'custom-icons.html': 'Custom Icons / Font Awesome',
17
17
  'oneinstance.html': 'One Instance',
18
18
  'color-picker.html': 'Color Picker',
19
- 'theme.html': 'Dark theme'
19
+ 'theme.html': 'Dark theme',
20
+ 'style-plugin.html': 'Style Plugin'
20
21
  };
21
22
 
22
23
  if (examples) {