texditor 2.0.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 (330) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +232 -0
  3. package/dist/core/base/base-model.d.ts +160 -0
  4. package/dist/core/base/base-model.d.ts.map +1 -0
  5. package/dist/core/base/event-manager.d.ts +20 -0
  6. package/dist/core/base/event-manager.d.ts.map +1 -0
  7. package/dist/core/base/index.d.ts +3 -0
  8. package/dist/core/base/index.d.ts.map +1 -0
  9. package/dist/core/base.d.ts +2 -0
  10. package/dist/core/base.mjs +1 -0
  11. package/dist/core/block-manager.d.ts +91 -0
  12. package/dist/core/block-manager.d.ts.map +1 -0
  13. package/dist/core/commands.d.ts +73 -0
  14. package/dist/core/commands.d.ts.map +1 -0
  15. package/dist/core/config.d.ts +11 -0
  16. package/dist/core/config.d.ts.map +1 -0
  17. package/dist/core/events.d.ts +121 -0
  18. package/dist/core/events.d.ts.map +1 -0
  19. package/dist/core/extensions.d.ts +23 -0
  20. package/dist/core/extensions.d.ts.map +1 -0
  21. package/dist/core/history-manager.d.ts +76 -0
  22. package/dist/core/history-manager.d.ts.map +1 -0
  23. package/dist/core/i18n.d.ts +29 -0
  24. package/dist/core/i18n.d.ts.map +1 -0
  25. package/dist/core/models/action-model.d.ts +54 -0
  26. package/dist/core/models/action-model.d.ts.map +1 -0
  27. package/dist/core/models/block-model.d.ts +396 -0
  28. package/dist/core/models/block-model.d.ts.map +1 -0
  29. package/dist/core/models/extension-model.d.ts +25 -0
  30. package/dist/core/models/extension-model.d.ts.map +1 -0
  31. package/dist/core/models/file-action-model.d.ts +20 -0
  32. package/dist/core/models/file-action-model.d.ts.map +1 -0
  33. package/dist/core/models/index.d.ts +7 -0
  34. package/dist/core/models/index.d.ts.map +1 -0
  35. package/dist/core/models/tool-model.d.ts +69 -0
  36. package/dist/core/models/tool-model.d.ts.map +1 -0
  37. package/dist/core/models.d.ts +2 -0
  38. package/dist/core/models.mjs +6 -0
  39. package/dist/core/security/sanitizer.d.ts +65 -0
  40. package/dist/core/security/sanitizer.d.ts.map +1 -0
  41. package/dist/core/selection-api.d.ts +52 -0
  42. package/dist/core/selection-api.d.ts.map +1 -0
  43. package/dist/core/tools.d.ts +27 -0
  44. package/dist/core/tools.d.ts.map +1 -0
  45. package/dist/core/ui/slider.d.ts +50 -0
  46. package/dist/core/ui/slider.d.ts.map +1 -0
  47. package/dist/core/ui/toasts.d.ts +23 -0
  48. package/dist/core/ui/toasts.d.ts.map +1 -0
  49. package/dist/core/ui/virtual-selection.d.ts +171 -0
  50. package/dist/core/ui/virtual-selection.d.ts.map +1 -0
  51. package/dist/entities/actions/convert-action.d.ts +9 -0
  52. package/dist/entities/actions/convert-action.d.ts.map +1 -0
  53. package/dist/entities/actions/create-action.d.ts +8 -0
  54. package/dist/entities/actions/create-action.d.ts.map +1 -0
  55. package/dist/entities/actions/delete-action.d.ts +8 -0
  56. package/dist/entities/actions/delete-action.d.ts.map +1 -0
  57. package/dist/entities/actions/index.d.ts +7 -0
  58. package/dist/entities/actions/index.d.ts.map +1 -0
  59. package/dist/entities/actions/move-down-action.d.ts +9 -0
  60. package/dist/entities/actions/move-down-action.d.ts.map +1 -0
  61. package/dist/entities/actions/move-up-action.d.ts +9 -0
  62. package/dist/entities/actions/move-up-action.d.ts.map +1 -0
  63. package/dist/entities/actions.d.ts +2 -0
  64. package/dist/entities/actions.mjs +6 -0
  65. package/dist/entities/blocks/code/index.d.ts +48 -0
  66. package/dist/entities/blocks/code/index.d.ts.map +1 -0
  67. package/dist/entities/blocks/code/languages.d.ts +4 -0
  68. package/dist/entities/blocks/code/languages.d.ts.map +1 -0
  69. package/dist/entities/blocks/files/actions/DeleteFileAction.d.ts +7 -0
  70. package/dist/entities/blocks/files/actions/DeleteFileAction.d.ts.map +1 -0
  71. package/dist/entities/blocks/files/actions/DownloadFileAction.d.ts +12 -0
  72. package/dist/entities/blocks/files/actions/DownloadFileAction.d.ts.map +1 -0
  73. package/dist/entities/blocks/files/actions/EditFileAction.d.ts +32 -0
  74. package/dist/entities/blocks/files/actions/EditFileAction.d.ts.map +1 -0
  75. package/dist/entities/blocks/files/actions/MoveLeftFileAction.d.ts +8 -0
  76. package/dist/entities/blocks/files/actions/MoveLeftFileAction.d.ts.map +1 -0
  77. package/dist/entities/blocks/files/actions/MoveRightFileAction.d.ts +8 -0
  78. package/dist/entities/blocks/files/actions/MoveRightFileAction.d.ts.map +1 -0
  79. package/dist/entities/blocks/files/index.d.ts +185 -0
  80. package/dist/entities/blocks/files/index.d.ts.map +1 -0
  81. package/dist/entities/blocks/gallery/index.d.ts +60 -0
  82. package/dist/entities/blocks/gallery/index.d.ts.map +1 -0
  83. package/dist/entities/blocks/header/H1.d.ts +4 -0
  84. package/dist/entities/blocks/header/H1.d.ts.map +1 -0
  85. package/dist/entities/blocks/header/H2.d.ts +6 -0
  86. package/dist/entities/blocks/header/H2.d.ts.map +1 -0
  87. package/dist/entities/blocks/header/H3.d.ts +6 -0
  88. package/dist/entities/blocks/header/H3.d.ts.map +1 -0
  89. package/dist/entities/blocks/header/H4.d.ts +6 -0
  90. package/dist/entities/blocks/header/H4.d.ts.map +1 -0
  91. package/dist/entities/blocks/header/H5.d.ts +6 -0
  92. package/dist/entities/blocks/header/H5.d.ts.map +1 -0
  93. package/dist/entities/blocks/header/H6.d.ts +6 -0
  94. package/dist/entities/blocks/header/H6.d.ts.map +1 -0
  95. package/dist/entities/blocks/header/index.d.ts +6 -0
  96. package/dist/entities/blocks/header/index.d.ts.map +1 -0
  97. package/dist/entities/blocks/index.d.ts +14 -0
  98. package/dist/entities/blocks/index.d.ts.map +1 -0
  99. package/dist/entities/blocks/list/index.d.ts +6 -0
  100. package/dist/entities/blocks/list/index.d.ts.map +1 -0
  101. package/dist/entities/blocks/list/ol.d.ts +6 -0
  102. package/dist/entities/blocks/list/ol.d.ts.map +1 -0
  103. package/dist/entities/blocks/paragraph/index.d.ts +6 -0
  104. package/dist/entities/blocks/paragraph/index.d.ts.map +1 -0
  105. package/dist/entities/blocks.d.ts +2 -0
  106. package/dist/entities/blocks.mjs +13 -0
  107. package/dist/entities/extensions/delete-selected.d.ts +9 -0
  108. package/dist/entities/extensions/delete-selected.d.ts.map +1 -0
  109. package/dist/entities/extensions/index.d.ts +5 -0
  110. package/dist/entities/extensions/index.d.ts.map +1 -0
  111. package/dist/entities/extensions/redo.d.ts +8 -0
  112. package/dist/entities/extensions/redo.d.ts.map +1 -0
  113. package/dist/entities/extensions/undo.d.ts +8 -0
  114. package/dist/entities/extensions/undo.d.ts.map +1 -0
  115. package/dist/entities/extensions.d.ts +2 -0
  116. package/dist/entities/extensions.mjs +4 -0
  117. package/dist/entities/tools/bold.d.ts +6 -0
  118. package/dist/entities/tools/bold.d.ts.map +1 -0
  119. package/dist/entities/tools/clear-formatting.d.ts +7 -0
  120. package/dist/entities/tools/clear-formatting.d.ts.map +1 -0
  121. package/dist/entities/tools/index.d.ts +10 -0
  122. package/dist/entities/tools/index.d.ts.map +1 -0
  123. package/dist/entities/tools/inline-code.d.ts +6 -0
  124. package/dist/entities/tools/inline-code.d.ts.map +1 -0
  125. package/dist/entities/tools/italic.d.ts +6 -0
  126. package/dist/entities/tools/italic.d.ts.map +1 -0
  127. package/dist/entities/tools/link.d.ts +35 -0
  128. package/dist/entities/tools/link.d.ts.map +1 -0
  129. package/dist/entities/tools/marker.d.ts +6 -0
  130. package/dist/entities/tools/marker.d.ts.map +1 -0
  131. package/dist/entities/tools/subscript.d.ts +6 -0
  132. package/dist/entities/tools/subscript.d.ts.map +1 -0
  133. package/dist/entities/tools/superscript.d.ts +6 -0
  134. package/dist/entities/tools/superscript.d.ts.map +1 -0
  135. package/dist/entities/tools.d.ts +2 -0
  136. package/dist/entities/tools.mjs +9 -0
  137. package/dist/icons/index.d.ts +42 -0
  138. package/dist/icons/index.d.ts.map +1 -0
  139. package/dist/locales/en.d.ts +66 -0
  140. package/dist/locales/en.d.ts.map +1 -0
  141. package/dist/locales/index.d.ts +4 -0
  142. package/dist/locales/index.d.ts.map +1 -0
  143. package/dist/locales/ru.d.ts +66 -0
  144. package/dist/locales/ru.d.ts.map +1 -0
  145. package/dist/locales.d.ts +2 -0
  146. package/dist/locales.mjs +3 -0
  147. package/dist/main.d.ts +6 -0
  148. package/dist/node_modules/snappykit/dist/snappykit.mjs +440 -0
  149. package/dist/node_modules/sortum/dist/sortum.mjs +588 -0
  150. package/dist/src/core/base/base-model.mjs +184 -0
  151. package/dist/src/core/base/event-manager.mjs +31 -0
  152. package/dist/src/core/block-manager.mjs +499 -0
  153. package/dist/src/core/commands.mjs +311 -0
  154. package/dist/src/core/config.mjs +12 -0
  155. package/dist/src/core/events.mjs +369 -0
  156. package/dist/src/core/extensions.mjs +48 -0
  157. package/dist/src/core/history-manager.mjs +107 -0
  158. package/dist/src/core/i18n.mjs +25 -0
  159. package/dist/src/core/models/action-model.mjs +72 -0
  160. package/dist/src/core/models/block-model.mjs +619 -0
  161. package/dist/src/core/models/extension-model.mjs +28 -0
  162. package/dist/src/core/models/file-action-model.mjs +24 -0
  163. package/dist/src/core/models/tool-model.mjs +80 -0
  164. package/dist/src/core/security/sanitizer.mjs +130 -0
  165. package/dist/src/core/selection-api.mjs +202 -0
  166. package/dist/src/core/tools.mjs +88 -0
  167. package/dist/src/core/ui/slider.mjs +81 -0
  168. package/dist/src/core/ui/toasts.mjs +55 -0
  169. package/dist/src/core/ui/virtual-selection.mjs +205 -0
  170. package/dist/src/entities/actions/convert-action.mjs +43 -0
  171. package/dist/src/entities/actions/create-action.mjs +39 -0
  172. package/dist/src/entities/actions/delete-action.mjs +19 -0
  173. package/dist/src/entities/actions/move-down-action.mjs +22 -0
  174. package/dist/src/entities/actions/move-up-action.mjs +22 -0
  175. package/dist/src/entities/blocks/code/index.mjs +144 -0
  176. package/dist/src/entities/blocks/code/languages.mjs +54 -0
  177. package/dist/src/entities/blocks/files/actions/DeleteFileAction.mjs +21 -0
  178. package/dist/src/entities/blocks/files/actions/DownloadFileAction.mjs +44 -0
  179. package/dist/src/entities/blocks/files/actions/EditFileAction.mjs +111 -0
  180. package/dist/src/entities/blocks/files/actions/MoveLeftFileAction.mjs +24 -0
  181. package/dist/src/entities/blocks/files/actions/MoveRightFileAction.mjs +24 -0
  182. package/dist/src/entities/blocks/files/index.mjs +424 -0
  183. package/dist/src/entities/blocks/gallery/index.mjs +141 -0
  184. package/dist/src/entities/blocks/header/H1.mjs +5 -0
  185. package/dist/src/entities/blocks/header/H2.mjs +16 -0
  186. package/dist/src/entities/blocks/header/H3.mjs +16 -0
  187. package/dist/src/entities/blocks/header/H4.mjs +16 -0
  188. package/dist/src/entities/blocks/header/H5.mjs +16 -0
  189. package/dist/src/entities/blocks/header/H6.mjs +16 -0
  190. package/dist/src/entities/blocks/header/index.mjs +46 -0
  191. package/dist/src/entities/blocks/list/index.mjs +51 -0
  192. package/dist/src/entities/blocks/list/ol.mjs +16 -0
  193. package/dist/src/entities/blocks/paragraph/index.mjs +46 -0
  194. package/dist/src/entities/extensions/delete-selected.mjs +27 -0
  195. package/dist/src/entities/extensions/redo.mjs +22 -0
  196. package/dist/src/entities/extensions/undo.mjs +22 -0
  197. package/dist/src/entities/tools/bold.mjs +16 -0
  198. package/dist/src/entities/tools/clear-formatting.mjs +20 -0
  199. package/dist/src/entities/tools/inline-code.mjs +19 -0
  200. package/dist/src/entities/tools/italic.mjs +16 -0
  201. package/dist/src/entities/tools/link.mjs +89 -0
  202. package/dist/src/entities/tools/marker.mjs +17 -0
  203. package/dist/src/entities/tools/subscript.mjs +17 -0
  204. package/dist/src/entities/tools/superscript.mjs +18 -0
  205. package/dist/src/icons/index.mjs +4 -0
  206. package/dist/src/locales/en.mjs +68 -0
  207. package/dist/src/locales/ru.mjs +68 -0
  208. package/dist/src/store/currentStore.mjs +8 -0
  209. package/dist/src/store/mainStore.mjs +4 -0
  210. package/dist/src/utils/ajax.mjs +35 -0
  211. package/dist/src/utils/common.mjs +26 -0
  212. package/dist/src/utils/icon.mjs +12 -0
  213. package/dist/src/utils/sanitizer.mjs +20 -0
  214. package/dist/src/views/extensions.mjs +18 -0
  215. package/dist/src/views/main.mjs +19 -0
  216. package/dist/src/views/tools.mjs +9 -0
  217. package/dist/store/currentStore.d.ts +15 -0
  218. package/dist/store/currentStore.d.ts.map +1 -0
  219. package/dist/store/mainStore.d.ts +14 -0
  220. package/dist/store/mainStore.d.ts.map +1 -0
  221. package/dist/styles/animations.css +1 -0
  222. package/dist/styles/core/ui/selection.css +1 -0
  223. package/dist/styles/core/ui/slider.css +1 -0
  224. package/dist/styles/entities/blocks/code.css +1 -0
  225. package/dist/styles/entities/blocks/files.css +1 -0
  226. package/dist/styles/entities/blocks/gallery.css +1 -0
  227. package/dist/styles/entities/blocks/list.css +1 -0
  228. package/dist/styles/entities/blocks/paragraph.css +1 -0
  229. package/dist/styles/entities/tools/inline-code.css +1 -0
  230. package/dist/styles/entities/tools/link.css +1 -0
  231. package/dist/styles/texditor.css +1 -0
  232. package/dist/styles/theme.css +42 -0
  233. package/dist/texditor.d.ts +68 -0
  234. package/dist/texditor.d.ts.map +1 -0
  235. package/dist/texditor.mjs +138 -0
  236. package/dist/types/core/base/base-model.d.ts +212 -0
  237. package/dist/types/core/base/base-model.d.ts.map +1 -0
  238. package/dist/types/core/base/event-manager.d.ts +42 -0
  239. package/dist/types/core/base/event-manager.d.ts.map +1 -0
  240. package/dist/types/core/base/index.d.ts +3 -0
  241. package/dist/types/core/base/index.d.ts.map +1 -0
  242. package/dist/types/core/block-manager.d.ts +223 -0
  243. package/dist/types/core/block-manager.d.ts.map +1 -0
  244. package/dist/types/core/commands.d.ts +93 -0
  245. package/dist/types/core/commands.d.ts.map +1 -0
  246. package/dist/types/core/config.d.ts +86 -0
  247. package/dist/types/core/config.d.ts.map +1 -0
  248. package/dist/types/core/events.d.ts +58 -0
  249. package/dist/types/core/events.d.ts.map +1 -0
  250. package/dist/types/core/extensions.d.ts +19 -0
  251. package/dist/types/core/extensions.d.ts.map +1 -0
  252. package/dist/types/core/history-manager.d.ts +72 -0
  253. package/dist/types/core/history-manager.d.ts.map +1 -0
  254. package/dist/types/core/http/index.d.ts +2 -0
  255. package/dist/types/core/http/index.d.ts.map +1 -0
  256. package/dist/types/core/http/response.d.ts +6 -0
  257. package/dist/types/core/http/response.d.ts.map +1 -0
  258. package/dist/types/core/i18n.d.ts +40 -0
  259. package/dist/types/core/i18n.d.ts.map +1 -0
  260. package/dist/types/core/index.d.ts +15 -0
  261. package/dist/types/core/index.d.ts.map +1 -0
  262. package/dist/types/core/models/action-model.d.ts +46 -0
  263. package/dist/types/core/models/action-model.d.ts.map +1 -0
  264. package/dist/types/core/models/block-model.d.ts +404 -0
  265. package/dist/types/core/models/block-model.d.ts.map +1 -0
  266. package/dist/types/core/models/extension-model.d.ts +41 -0
  267. package/dist/types/core/models/extension-model.d.ts.map +1 -0
  268. package/dist/types/core/models/file-action-model.d.ts +36 -0
  269. package/dist/types/core/models/file-action-model.d.ts.map +1 -0
  270. package/dist/types/core/models/index.d.ts +7 -0
  271. package/dist/types/core/models/index.d.ts.map +1 -0
  272. package/dist/types/core/models/tool-model.d.ts +54 -0
  273. package/dist/types/core/models/tool-model.d.ts.map +1 -0
  274. package/dist/types/core/sanitizer.d.ts +27 -0
  275. package/dist/types/core/sanitizer.d.ts.map +1 -0
  276. package/dist/types/core/selection-api.d.ts +116 -0
  277. package/dist/types/core/selection-api.d.ts.map +1 -0
  278. package/dist/types/core/tools.d.ts +35 -0
  279. package/dist/types/core/tools.d.ts.map +1 -0
  280. package/dist/types/core/ui/index.d.ts +4 -0
  281. package/dist/types/core/ui/index.d.ts.map +1 -0
  282. package/dist/types/core/ui/slider.d.ts +45 -0
  283. package/dist/types/core/ui/slider.d.ts.map +1 -0
  284. package/dist/types/core/ui/toasts.d.ts +58 -0
  285. package/dist/types/core/ui/toasts.d.ts.map +1 -0
  286. package/dist/types/core/ui/virtual-selection.d.ts +83 -0
  287. package/dist/types/core/ui/virtual-selection.d.ts.map +1 -0
  288. package/dist/types/entities/blocks/code.d.ts +4 -0
  289. package/dist/types/entities/blocks/code.d.ts.map +1 -0
  290. package/dist/types/entities/blocks/files.d.ts +170 -0
  291. package/dist/types/entities/blocks/files.d.ts.map +1 -0
  292. package/dist/types/entities/blocks/gallery.d.ts +40 -0
  293. package/dist/types/entities/blocks/gallery.d.ts.map +1 -0
  294. package/dist/types/entities/blocks/header.d.ts +4 -0
  295. package/dist/types/entities/blocks/header.d.ts.map +1 -0
  296. package/dist/types/entities/blocks/index.d.ts +7 -0
  297. package/dist/types/entities/blocks/index.d.ts.map +1 -0
  298. package/dist/types/entities/blocks/list.d.ts +4 -0
  299. package/dist/types/entities/blocks/list.d.ts.map +1 -0
  300. package/dist/types/entities/blocks/paragraph.d.ts +4 -0
  301. package/dist/types/entities/blocks/paragraph.d.ts.map +1 -0
  302. package/dist/types/entities/index.d.ts +2 -0
  303. package/dist/types/entities/index.d.ts.map +1 -0
  304. package/dist/types/index.d.ts +5 -0
  305. package/dist/types/index.d.ts.map +1 -0
  306. package/dist/types/texditor.d.ts +66 -0
  307. package/dist/types/texditor.d.ts.map +1 -0
  308. package/dist/types/utils/ajax.d.ts +31 -0
  309. package/dist/types/utils/ajax.d.ts.map +1 -0
  310. package/dist/types/utils/icon.d.ts +10 -0
  311. package/dist/types/utils/icon.d.ts.map +1 -0
  312. package/dist/types/utils/index.d.ts +3 -0
  313. package/dist/types/utils/index.d.ts.map +1 -0
  314. package/dist/utils/ajax.d.ts +9 -0
  315. package/dist/utils/ajax.d.ts.map +1 -0
  316. package/dist/utils/common.d.ts +28 -0
  317. package/dist/utils/common.d.ts.map +1 -0
  318. package/dist/utils/icon.d.ts +12 -0
  319. package/dist/utils/icon.d.ts.map +1 -0
  320. package/dist/utils/index.d.ts +5 -0
  321. package/dist/utils/index.d.ts.map +1 -0
  322. package/dist/utils/sanitizer.d.ts +8 -0
  323. package/dist/utils/sanitizer.d.ts.map +1 -0
  324. package/dist/views/extensions.d.ts +3 -0
  325. package/dist/views/extensions.d.ts.map +1 -0
  326. package/dist/views/main.d.ts +3 -0
  327. package/dist/views/main.d.ts.map +1 -0
  328. package/dist/views/tools.d.ts +2 -0
  329. package/dist/views/tools.d.ts.map +1 -0
  330. package/package.json +75 -0
@@ -0,0 +1,205 @@
1
+ import { Q as e, S as t, Z as n, b as r, g as i, ie as a, m as o, w as s, x as c, y as l } from "../../../node_modules/snappykit/dist/snappykit.mjs";
2
+ /* empty css */
3
+ //#region src/core/ui/virtual-selection.ts
4
+ var u = class {
5
+ constructor(e) {
6
+ this.blocks = [], this.isDragging = !1, this.isLassoActive = !1, this.hasMoved = !1, this.isTouchScrolling = !1, this.startedInContentEditable = !1, this.contentEditableStartPoint = {
7
+ x: 0,
8
+ y: 0
9
+ }, this.startPointInDocument = {
10
+ x: 0,
11
+ y: 0
12
+ }, this.currentPointInDocument = {
13
+ x: 0,
14
+ y: 0
15
+ }, this.selectedIndices = /* @__PURE__ */ new Set(), this.selectionRect = null, this.eventId = "slUi_" + o(8), this.autoScrollInterval = null, this.startBlock = null, this.touchDelayTimeout = null, this.pendingLassoActivation = !1, this.rafId = null, this.needsUpdate = !1, this.cachedLassoRect = null, this.cachedSelectedIndices = /* @__PURE__ */ new Set(), this.options = {
16
+ blocksContainer: e.blocksContainer,
17
+ blockSelector: e.blockSelector,
18
+ selectionZone: e.selectionZone || document.body,
19
+ selectedBlockClass: e.selectedBlockClass || "tex-ui-vs-selected",
20
+ exitTolerance: e.exitTolerance || 12,
21
+ autoScrollSpeed: e.autoScrollSpeed || 20,
22
+ autoScrollEdgeThreshold: e.autoScrollEdgeThreshold || 60,
23
+ touchActivationDelay: e.touchActivationDelay || 200,
24
+ onSelectionChange: e.onSelectionChange || (() => {}),
25
+ onLassoStart: e.onLassoStart || (() => {}),
26
+ onLassoEnd: e.onLassoEnd || (() => {})
27
+ }, this.init();
28
+ }
29
+ setTouchAction(e) {
30
+ i(this.options.selectionZone, "touch-action", e);
31
+ }
32
+ init() {
33
+ this.refreshBlocks(), this.createElements(), this.attachEvents(), this.setTouchAction("pan-y");
34
+ }
35
+ isInsideContentEditable(e) {
36
+ let t = e;
37
+ for (; t && t !== this.options.selectionZone;) {
38
+ if (t.contentEditable === "true") return !0;
39
+ t = t.parentElement;
40
+ }
41
+ return !1;
42
+ }
43
+ getFullBlockRect(e) {
44
+ let t = e.getBoundingClientRect(), n = window.getComputedStyle(e), r = parseFloat(n.marginTop), i = parseFloat(n.marginRight), a = parseFloat(n.marginBottom), o = parseFloat(n.marginLeft);
45
+ return new DOMRect(t.left + window.scrollX - o, t.top + window.scrollY - r, t.width + o + i, t.height + r + a);
46
+ }
47
+ hasExitedBlockBoundaries(e, t) {
48
+ let n = this.getFullBlockRect(t), r = {
49
+ left: e.x - n.left,
50
+ right: n.right - e.x,
51
+ top: e.y - n.top,
52
+ bottom: n.bottom - e.y
53
+ }, i = Math.min(Math.abs(r.left), Math.abs(r.right), Math.abs(r.top), Math.abs(r.bottom));
54
+ return (e.x < n.left || e.x > n.right || e.y < n.top || e.y > n.bottom) && i >= this.options.exitTolerance;
55
+ }
56
+ refreshBlocks() {
57
+ this.blocks.length = 0, t(this.options.blockSelector, (e) => {
58
+ this.blocks.push(e);
59
+ }, this.options.blocksContainer), this.updateBlocksVisuals(!0);
60
+ }
61
+ createElements() {
62
+ this.selectionRect &&= (this.selectionRect.parentNode && c(this.selectionRect), null), this.selectionRect = a("div", (e) => {
63
+ l(e, "tex-ui-vs-rect"), i(e, { display: "none" });
64
+ }), s(document.body, this.selectionRect);
65
+ }
66
+ attachEvents() {
67
+ let e = this.eventId, t = this.options.selectionZone;
68
+ n(t, "mousedown." + e, (e) => this.onMouseDown(e)), n(window, "mousemove." + e, (e) => this.onMouseMove(e)), n(window, "mouseup." + e, () => this.onMouseUp()), n(t, "touchstart." + e, (e) => this.onTouchStart(e), { passive: !1 }), n(t, "touchmove." + e, (e) => this.onTouchMove(e), { passive: !1 }), n(window, "touchend." + e, () => this.onTouchEnd());
69
+ }
70
+ viewportToDocument(e, t) {
71
+ return {
72
+ x: e + window.scrollX,
73
+ y: t + window.scrollY
74
+ };
75
+ }
76
+ documentToViewport(e, t) {
77
+ return {
78
+ x: e - window.scrollX,
79
+ y: t - window.scrollY
80
+ };
81
+ }
82
+ getBlockAtPoint(e, t) {
83
+ for (let n of this.blocks) {
84
+ let r = this.getFullBlockRect(n);
85
+ if (e >= r.left && e <= r.right && t >= r.top && t <= r.bottom) return n;
86
+ }
87
+ return null;
88
+ }
89
+ startAutoScroll() {
90
+ this.autoScrollInterval ||= window.setInterval(() => {
91
+ if (!this.isLassoActive || !this.isDragging) return;
92
+ let e = this.currentPointInDocument.y - window.scrollY, t = this.options.autoScrollEdgeThreshold, n = 0;
93
+ e < t ? n = -this.options.autoScrollSpeed : e > window.innerHeight - t && (n = this.options.autoScrollSpeed), n !== 0 && (window.scrollBy(0, n), this.currentPointInDocument.y += n, this.scheduleUpdate());
94
+ }, 16);
95
+ }
96
+ stopAutoScroll() {
97
+ this.autoScrollInterval &&= (clearInterval(this.autoScrollInterval), null);
98
+ }
99
+ startLassoMode() {
100
+ if (this.isLassoActive) return;
101
+ this.isLassoActive = !0, this.startAutoScroll();
102
+ let e = window.getSelection();
103
+ e && e.removeAllRanges(), this.options.onLassoStart();
104
+ }
105
+ stopLassoMode() {
106
+ this.isLassoActive && (this.isLassoActive = !1, this.stopAutoScroll(), this.cancelRAF(), this.options.onLassoEnd(), this.selectionRect && i(this.selectionRect, "display", "none"), this.cachedLassoRect = null, this.cachedSelectedIndices.clear());
107
+ }
108
+ scheduleUpdate() {
109
+ this.needsUpdate || (this.needsUpdate = !0, this.rafId === null && (this.rafId = requestAnimationFrame(() => {
110
+ this.rafId = null, this.needsUpdate = !1, this.performUpdate();
111
+ })));
112
+ }
113
+ performUpdate() {
114
+ if (!this.isLassoActive) return;
115
+ this.cachedLassoRect ||= new DOMRect();
116
+ let e = this.cachedLassoRect;
117
+ e.x = Math.min(this.startPointInDocument.x, this.currentPointInDocument.x), e.y = Math.min(this.startPointInDocument.y, this.currentPointInDocument.y), e.width = Math.abs(this.currentPointInDocument.x - this.startPointInDocument.x), e.height = Math.abs(this.currentPointInDocument.y - this.startPointInDocument.y), this.cachedSelectedIndices.clear(), this.blocks.forEach((t, n) => {
118
+ let r = this.getFullBlockRect(t);
119
+ e.right < r.left || e.left > r.right || e.bottom < r.top || e.top > r.bottom || this.cachedSelectedIndices.add(n);
120
+ }), this.areSetsEqual(this.selectedIndices, this.cachedSelectedIndices) || (this.selectedIndices = new Set(this.cachedSelectedIndices), this.updateBlocksVisuals()), this.updateSelectionRect();
121
+ }
122
+ areSetsEqual(e, t) {
123
+ if (e.size !== t.size) return !1;
124
+ for (let n of e) if (!t.has(n)) return !1;
125
+ return !0;
126
+ }
127
+ cancelRAF() {
128
+ this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null), this.needsUpdate = !1;
129
+ }
130
+ updateSelectionRect() {
131
+ if (!this.selectionRect || !this.isLassoActive) return;
132
+ let e = this.documentToViewport(this.startPointInDocument.x, this.startPointInDocument.y), t = this.documentToViewport(this.currentPointInDocument.x, this.currentPointInDocument.y);
133
+ i(this.selectionRect, {
134
+ display: "block",
135
+ left: Math.min(e.x, t.x) + "px",
136
+ top: Math.min(e.y, t.y) + "px",
137
+ width: Math.abs(t.x - e.x) + "px",
138
+ height: Math.abs(t.y - e.y) + "px"
139
+ });
140
+ }
141
+ updateLassoSelection() {
142
+ this.isLassoActive && this.scheduleUpdate();
143
+ }
144
+ updateBlocksVisuals(e = !1) {
145
+ let t = this.options.selectedBlockClass;
146
+ this.blocks.forEach((e, n) => {
147
+ this.selectedIndices.has(n) ? e.classList.contains(t) || l(e, t) : e.classList.contains(t) && r(e, t);
148
+ }), e || this.options.onSelectionChange(Array.from(this.selectedIndices), this.getSelectedBlocks());
149
+ }
150
+ onMouseDown(e) {
151
+ if (e.button !== 0) return;
152
+ let t = e.target, n = this.viewportToDocument(e.clientX, e.clientY);
153
+ this.startPointInDocument = n, this.currentPointInDocument = n, this.isDragging = !0, this.hasMoved = !1, this.startedInContentEditable = this.isInsideContentEditable(t), this.contentEditableStartPoint = n, this.startBlock = this.getBlockAtPoint(n.x, n.y);
154
+ }
155
+ onMouseMove(e) {
156
+ if (!this.isDragging) return;
157
+ let t = this.viewportToDocument(e.clientX, e.clientY);
158
+ this.currentPointInDocument = t;
159
+ let n = t.x - this.startPointInDocument.x, r = t.y - this.startPointInDocument.y;
160
+ (Math.abs(n) > 2 || Math.abs(r) > 2) && (this.hasMoved = !0), !this.isLassoActive && this.hasMoved && !this.startBlock && this.startLassoMode(), !this.isLassoActive && this.hasMoved && this.startBlock && this.hasExitedBlockBoundaries(t, this.startBlock) && (this.startLassoMode(), e.preventDefault()), this.isLassoActive && (this.updateLassoSelection(), e.preventDefault());
161
+ }
162
+ onMouseUp() {
163
+ this.isDragging && (this.isLassoActive && (this.updateLassoSelection(), this.stopLassoMode()), this.isDragging = !1, this.startedInContentEditable = !1, this.pendingLassoActivation = !1, this.startBlock = null, this.touchDelayTimeout &&= (clearTimeout(this.touchDelayTimeout), null), this.cancelRAF());
164
+ }
165
+ onTouchStart(e) {
166
+ let t = e.touches[0];
167
+ if (!t) return;
168
+ let n = e.target, r = this.viewportToDocument(t.clientX, t.clientY);
169
+ this.startPointInDocument = r, this.currentPointInDocument = r, this.isDragging = !0, this.hasMoved = !1, this.startedInContentEditable = this.isInsideContentEditable(n), this.contentEditableStartPoint = r, this.isTouchScrolling = !1, this.pendingLassoActivation = !1, this.startBlock = this.getBlockAtPoint(r.x, r.y), this.touchDelayTimeout &&= (clearTimeout(this.touchDelayTimeout), null), this.setTouchAction("none");
170
+ }
171
+ onTouchMove(e) {
172
+ if (!this.isDragging) return;
173
+ let t = e.touches[0];
174
+ if (!t) return;
175
+ let n = this.viewportToDocument(t.clientX, t.clientY);
176
+ this.currentPointInDocument = n;
177
+ let r = n.x - this.startPointInDocument.x, i = n.y - this.startPointInDocument.y, a = Math.abs(r), o = Math.abs(i);
178
+ if (!this.isLassoActive && o > a && o > 10) {
179
+ this.isTouchScrolling = !0, this.setTouchAction("pan-y"), this.touchDelayTimeout &&= (clearTimeout(this.touchDelayTimeout), null), this.pendingLassoActivation = !1;
180
+ return;
181
+ }
182
+ !this.isLassoActive && !this.isTouchScrolling && (a > 5 || o > 5) && !this.pendingLassoActivation && !this.touchDelayTimeout && (this.pendingLassoActivation = !0, this.touchDelayTimeout = window.setTimeout(() => {
183
+ this.isDragging && !this.isLassoActive && !this.isTouchScrolling && (this.startBlock ? this.startBlock && this.hasExitedBlockBoundaries(this.currentPointInDocument, this.startBlock) && (this.startLassoMode(), e.preventDefault()) : (this.startLassoMode(), e.preventDefault())), this.touchDelayTimeout = null, this.pendingLassoActivation = !1;
184
+ }, this.options.touchActivationDelay)), a < 3 && o < 3 && this.pendingLassoActivation && this.touchDelayTimeout && (clearTimeout(this.touchDelayTimeout), this.touchDelayTimeout = null, this.pendingLassoActivation = !1), this.isLassoActive && (this.updateLassoSelection(), e.preventDefault()), (this.pendingLassoActivation || this.isLassoActive) && e.preventDefault();
185
+ }
186
+ onTouchEnd() {
187
+ this.touchDelayTimeout &&= (clearTimeout(this.touchDelayTimeout), null), this.pendingLassoActivation = !1, this.isDragging && (this.isLassoActive && (this.updateLassoSelection(), this.stopLassoMode()), this.isDragging = !1, this.startedInContentEditable = !1, this.isTouchScrolling = !1, this.startBlock = null, this.setTouchAction("pan-y"), this.cancelRAF());
188
+ }
189
+ getSelectedIndices() {
190
+ return Array.from(this.selectedIndices);
191
+ }
192
+ getSelectedBlocks() {
193
+ return Array.from(this.selectedIndices).map((e) => this.blocks[e]).filter(Boolean);
194
+ }
195
+ clearSelection() {
196
+ this.selectedIndices.clear(), this.updateBlocksVisuals(!0);
197
+ }
198
+ destroy() {
199
+ this.stopAutoScroll(), this.cancelRAF(), this.touchDelayTimeout &&= (clearTimeout(this.touchDelayTimeout), null);
200
+ let t = this.eventId, n = this.options.selectionZone;
201
+ e(n, "mousedown." + t), e(window, "mousemove." + t), e(window, "mouseup." + t), e(n, "touchstart." + t), e(n, "touchmove." + t), e(window, "touchend." + t), this.selectionRect?.parentNode && this.selectionRect.parentNode.removeChild(this.selectionRect), this.selectionRect = null, this.blocks.length = 0, this.selectedIndices.clear(), this.cachedSelectedIndices.clear(), this.cachedLassoRect = null, this.startBlock = null, this.setTouchAction("pan-y");
202
+ }
203
+ };
204
+ //#endregion
205
+ export { u as default };
@@ -0,0 +1,43 @@
1
+ import { Te as e, ie as t, se as n, w as r, y as i } from "../../../node_modules/snappykit/dist/snappykit.mjs";
2
+ import { IconConvert as a } from "../../icons/index.mjs";
3
+ import { renderIcon as o } from "../../utils/icon.mjs";
4
+ import s from "../../core/models/action-model.mjs";
5
+ //#region src/entities/actions/convert-action.ts
6
+ var c = class extends s {
7
+ configure() {
8
+ return {
9
+ name: "convertAction",
10
+ icon: a,
11
+ translation: "convert",
12
+ dropdown: !0
13
+ };
14
+ }
15
+ dropdown() {
16
+ let { blockManager: a } = this.editor, s = this.getBlockElement(), c = a.getSchemas();
17
+ return t("div", (l) => {
18
+ r(l, t("h4", (e) => {
19
+ e.textContent = this.getTranslation() || this.getName();
20
+ })), c.forEach((c) => {
21
+ let u = c.model;
22
+ u.isConvertible() && s?.baseModel.getName() !== u.getName() && r(l, t("div", (c) => {
23
+ i(c, "tex-actions-content-dropdown-item");
24
+ let l = u.getIcon();
25
+ l && r(c, t("span", (e) => n(e, o(l, {
26
+ width: u.getIconWidth(),
27
+ height: u.getIconHeight()
28
+ })))), r(c, t("span", (e) => {
29
+ n(e, u.getTranslation() || u.getName());
30
+ })), e(c, "click.am", () => {
31
+ s && a.convert(s, u);
32
+ });
33
+ }));
34
+ });
35
+ });
36
+ }
37
+ isVisible() {
38
+ let e = this.getBlockElement()?.baseModel;
39
+ return e ? e.isConvertible() : !1;
40
+ }
41
+ };
42
+ //#endregion
43
+ export { c as default };
@@ -0,0 +1,39 @@
1
+ import { Te as e, ie as t, se as n, w as r, y as i } from "../../../node_modules/snappykit/dist/snappykit.mjs";
2
+ import { IconPlus as a } from "../../icons/index.mjs";
3
+ import { renderIcon as o } from "../../utils/icon.mjs";
4
+ import s from "../../core/models/action-model.mjs";
5
+ //#region src/entities/actions/create-action.ts
6
+ var c = class extends s {
7
+ configure() {
8
+ return {
9
+ name: "createAction",
10
+ translation: "createAction",
11
+ icon: a,
12
+ dropdown: !0
13
+ };
14
+ }
15
+ dropdown() {
16
+ let { blockManager: a } = this.editor, s = a.getSchemas();
17
+ return t("div", (c) => {
18
+ r(c, t("h4", (e) => {
19
+ e.textContent = this.getTranslation() || this.getName();
20
+ })), s.forEach((s) => {
21
+ let l = s.model;
22
+ r(c, t("div", (s) => {
23
+ i(s, "tex-actions-content-dropdown-item");
24
+ let c = l.getIcon();
25
+ c && r(s, t("span", (e) => n(e, o(c, {
26
+ width: l.getIconWidth(),
27
+ height: l.getIconHeight()
28
+ })))), r(s, t("span", (e) => {
29
+ n(e, l.getTranslation() || l.getName());
30
+ })), e(s, "click.am", () => {
31
+ a.createBlock(l.getName());
32
+ });
33
+ }));
34
+ });
35
+ });
36
+ }
37
+ };
38
+ //#endregion
39
+ export { c as default };
@@ -0,0 +1,19 @@
1
+ import { IconTrash as e } from "../../icons/index.mjs";
2
+ import t from "../../core/models/action-model.mjs";
3
+ //#region src/entities/actions/delete-action.ts
4
+ var n = class extends t {
5
+ configure() {
6
+ return {
7
+ name: "deleteAction",
8
+ translation: "deleteAction",
9
+ icon: e,
10
+ confirm: !0
11
+ };
12
+ }
13
+ onClick() {
14
+ let { blockManager: e } = this.editor;
15
+ e.removeBlock();
16
+ }
17
+ };
18
+ //#endregion
19
+ export { n as default };
@@ -0,0 +1,22 @@
1
+ import { IconArrowDown as e } from "../../icons/index.mjs";
2
+ import t from "../../core/models/action-model.mjs";
3
+ //#region src/entities/actions/move-down-action.ts
4
+ var n = class extends t {
5
+ configure() {
6
+ return {
7
+ name: "moveDownAction",
8
+ translation: "moveDownAction",
9
+ icon: e
10
+ };
11
+ }
12
+ onClick() {
13
+ let { blockManager: e } = this.editor, t = e.getIndex(), n = this.getBlockElement()?.baseModel;
14
+ e.moveBlock(t, t + 1), n && n.showActions();
15
+ }
16
+ isVisible() {
17
+ let { blockManager: e } = this.editor;
18
+ return e.getIndex() + 1 != e.count();
19
+ }
20
+ };
21
+ //#endregion
22
+ export { n as default };
@@ -0,0 +1,22 @@
1
+ import { IconArrowUp as e } from "../../icons/index.mjs";
2
+ import t from "../../core/models/action-model.mjs";
3
+ //#region src/entities/actions/move-up-action.ts
4
+ var n = class extends t {
5
+ configure() {
6
+ return {
7
+ name: "moveUpAction",
8
+ translation: "moveUpAction",
9
+ icon: e
10
+ };
11
+ }
12
+ onClick() {
13
+ let { blockManager: e } = this.editor, t = e.getIndex(), n = this.getBlockElement()?.baseModel;
14
+ e.moveBlock(t, t - 1), n && n.showActions();
15
+ }
16
+ isVisible() {
17
+ let { blockManager: e } = this.editor;
18
+ return e.getIndex() > 0 && e.count() !== 0;
19
+ }
20
+ };
21
+ //#endregion
22
+ export { n as default };
@@ -0,0 +1,144 @@
1
+ import { A as e, N as t, O as n, Q as r, S as i, T as a, Z as o, c as s, g as c, ie as l, le as u, n as d, se as f, ue as p, w as m, y as h } from "../../../../node_modules/snappykit/dist/snappykit.mjs";
2
+ import { IconArrowDown as g, IconCode as _, IconCornerUpRight as v } from "../../../icons/index.mjs";
3
+ import { renderIcon as y } from "../../../utils/icon.mjs";
4
+ import b from "../../../core/models/block-model.mjs";
5
+ import x from "./languages.mjs";
6
+ /* empty css */
7
+ //#region src/entities/blocks/code/index.ts
8
+ var S = class extends b {
9
+ configure() {
10
+ return {
11
+ name: "code",
12
+ tagName: "pre",
13
+ translation: "code",
14
+ groupCode: "code",
15
+ className: "tex-code",
16
+ autoParse: !1,
17
+ autoMerge: !0,
18
+ icon: _,
19
+ placeholder: this.editor.i18n.get("codePlaceholder", "Enter your code"),
20
+ editable: !0,
21
+ emptyDetect: !0,
22
+ sanitizer: !1,
23
+ raw: !0,
24
+ enterCreate: !1,
25
+ convertible: !0,
26
+ languages: x,
27
+ showLanguages: !0,
28
+ customSave: !0,
29
+ search: !0,
30
+ lineBreakInfoMessage: "Ctrl + Enter"
31
+ };
32
+ }
33
+ onCompose() {
34
+ let e = this.getElement();
35
+ this.init(e);
36
+ }
37
+ init(t) {
38
+ if (!t) return;
39
+ let { events: d, i18n: _ } = this.editor;
40
+ if (this.getConfig("showLanguages", !0)) {
41
+ let v = _.get("notSpecified", "Not specified");
42
+ if (t) {
43
+ let b = this.getConfig("languages", {}), x = (e) => b[e] || v, S = (e = v) => {
44
+ i(".tex-code-lang-link-name", (t) => {
45
+ t.textContent = e;
46
+ }, t);
47
+ };
48
+ a(t, l("div", (a) => {
49
+ h(a, "tex-code-lang");
50
+ let C = l("div", (r) => {
51
+ h(r, "tex-code-menu tex-animate-fadeIn"), this.getConfig("search", !0) && m(r, l("div", (r) => {
52
+ h(r, "tex-code-menu-search"), m(r, l("input", (r) => {
53
+ h(r, "tex-input"), n(r, "type", "text"), n(r, "placeholder", _.get("search", "Search")), o(r, "input.codeLang", (n) => {
54
+ n.preventDefault(), p(r);
55
+ let a = s(p(r)).trim();
56
+ i(".tex-code-menu-item", (t) => {
57
+ if (a) {
58
+ let n = t.textContent?.toLowerCase() || "", r = e(t, "langKey") || "";
59
+ !n.includes(a) && !r.includes(a) ? c(t, "display", "none") : c(t, "display", "");
60
+ } else c(t, "display", "");
61
+ }, t);
62
+ });
63
+ }));
64
+ })), m(r, l("div", (e) => {
65
+ h(e, "tex-code-menu-item"), n(e, "data-lang-key", ""), f(e, v), o(e, "click.rmLang", () => {
66
+ this.removeOption("lang"), S(), T(), d.change({
67
+ modelCode: this.getModelCode(),
68
+ type: "codeClearLanguage",
69
+ blockElement: t
70
+ });
71
+ });
72
+ }));
73
+ for (let [e, i] of Object.entries(b)) m(r, l("div", (r) => {
74
+ h(r, "tex-code-menu-item"), n(r, "data-lang-key", e), f(r, i), o(r, "click.chLang", () => {
75
+ this.setOption("lang", e), S(i), T(), d.change({
76
+ modelCode: this.getModelCode(),
77
+ type: "codeChangeLanguage",
78
+ blockElement: t,
79
+ lang: e
80
+ });
81
+ });
82
+ }));
83
+ }), w = this.getEventId(), T = () => {
84
+ r(document, "click.codeMenu" + w), c(C, "display", "");
85
+ };
86
+ m(a, [l("a", (e) => {
87
+ h(e, "tex-code-lang-link"), m(e, [l("span", (e) => {
88
+ h(e, "tex-code-lang-link-name"), e.textContent = x(this.getOption("lang", "") || "");
89
+ }), l("span", (e) => {
90
+ f(e, y(g, {
91
+ width: 12,
92
+ height: 12
93
+ }));
94
+ })]), o(e, "click.codeLink", () => {
95
+ c(C, "display", "block"), o(document, "click.codeMenu" + w, (e) => {
96
+ u(e.target, C) || T();
97
+ }, !0);
98
+ });
99
+ }), C]);
100
+ }));
101
+ }
102
+ }
103
+ let b = this.getConfig("lineBreakInfoMessage", "");
104
+ b && m(t, l("div", (e) => {
105
+ h(e, "tex-code-line-break-info"), m(e, [l("span", (e) => {
106
+ f(e, b);
107
+ }), l("span", (e) => {
108
+ f(e, y(v, {
109
+ width: 12,
110
+ height: 12
111
+ }));
112
+ })]);
113
+ }));
114
+ }
115
+ onKeyDown(e) {
116
+ let { blockManager: t } = this.editor;
117
+ return e.ctrlKey && e.key === "Enter" ? (t.createDefaultBlock(), e.preventDefault(), !1) : !0;
118
+ }
119
+ save(e, n) {
120
+ let { blockManager: r } = this.editor, i = r.getContentElement(n);
121
+ if (i && !d(t(i))) {
122
+ e.data = [t(i)];
123
+ let n = this.getOption("lang", "");
124
+ n && (e.lang = n);
125
+ }
126
+ return e;
127
+ }
128
+ parse(e) {
129
+ let t = this.getConfig("languages", {}), n = e?.lang || "";
130
+ return n && !t[n] && (n = ""), {
131
+ lang: n,
132
+ data: typeof e.data[0] == "string" ? e.data[0] : ""
133
+ };
134
+ }
135
+ afterConvert(e) {
136
+ return this.init(e), e;
137
+ }
138
+ destroy() {
139
+ let e = this.getEventId();
140
+ r(document, "click.codeMenu" + e);
141
+ }
142
+ };
143
+ //#endregion
144
+ export { S as default };
@@ -0,0 +1,54 @@
1
+ //#region src/entities/blocks/code/languages.ts
2
+ var e = {
3
+ bash: "Bash",
4
+ c: "C",
5
+ clojure: "Clojure",
6
+ cmake: "CMake",
7
+ cpp: "C++",
8
+ csharp: "C#",
9
+ css: "CSS",
10
+ dart: "Dart",
11
+ dockerfile: "Dockerfile",
12
+ elixir: "Elixir",
13
+ erlang: "Erlang",
14
+ fsharp: "F#",
15
+ go: "Go",
16
+ graphql: "GraphQL",
17
+ groovy: "Groovy",
18
+ haskell: "Haskell",
19
+ html: "HTML",
20
+ java: "Java",
21
+ javascript: "JavaScript",
22
+ json: "JSON",
23
+ julia: "Julia",
24
+ kotlin: "Kotlin",
25
+ less: "Less",
26
+ lua: "Lua",
27
+ makefile: "Makefile",
28
+ markdown: "Markdown",
29
+ matlab: "MATLAB",
30
+ nginx: "Nginx",
31
+ objectivec: "Objective-C",
32
+ perl: "Perl",
33
+ php: "PHP",
34
+ plaintext: "Plain Text",
35
+ powershell: "PowerShell",
36
+ python: "Python",
37
+ r: "R",
38
+ ruby: "Ruby",
39
+ rust: "Rust",
40
+ scala: "Scala",
41
+ scss: "SCSS",
42
+ shell: "Shell",
43
+ sql: "SQL",
44
+ swift: "Swift",
45
+ svelte: "Svelte",
46
+ toml: "TOML",
47
+ typescript: "TypeScript",
48
+ vim: "Vim script",
49
+ wasm: "WebAssembly",
50
+ xml: "XML",
51
+ yaml: "YAML"
52
+ };
53
+ //#endregion
54
+ export { e as default };
@@ -0,0 +1,21 @@
1
+ import { IconTrash as e } from "../../../../icons/index.mjs";
2
+ import t from "../../../../core/models/file-action-model.mjs";
3
+ //#region src/entities/blocks/files/actions/DeleteFileAction.ts
4
+ var n = class extends t {
5
+ configure() {
6
+ return {
7
+ name: "delete",
8
+ icon: e,
9
+ translation: "delete"
10
+ };
11
+ }
12
+ onClick(e) {
13
+ let { blockManager: t } = this.editor, n = this.getBlockElement(), r = n?.baseModel, i = this.getItemElement();
14
+ if (n && r && i) {
15
+ let e = r.getItemIndex(i), n = t.getIndex();
16
+ r.removeItem(e), r.isEmpty() ? t.removeBlock() : t.focus(n);
17
+ }
18
+ }
19
+ };
20
+ //#endregion
21
+ export { n as default };
@@ -0,0 +1,44 @@
1
+ import { O as e } from "../../../../../node_modules/snappykit/dist/snappykit.mjs";
2
+ import { IconDownload as t } from "../../../../icons/index.mjs";
3
+ import n from "../../../../core/models/file-action-model.mjs";
4
+ //#region src/entities/blocks/files/actions/DownloadFileAction.ts
5
+ var r = class extends n {
6
+ configure() {
7
+ return {
8
+ name: "download",
9
+ icon: t,
10
+ elementTagName: "a",
11
+ translation: "downloadFile"
12
+ };
13
+ }
14
+ onClick() {
15
+ let { events: e } = this.editor, t = this.getBlockElement(), n = t?.baseModel;
16
+ if (t && n) {
17
+ let r = this.getItemElement();
18
+ if (r) {
19
+ let i = n.getContentElement(), a = n.getItemIndex(r);
20
+ e.change({
21
+ modelCode: this.getModelCode(),
22
+ type: "download",
23
+ contentElement: i,
24
+ blockElement: t,
25
+ item: r,
26
+ index: a
27
+ });
28
+ }
29
+ }
30
+ }
31
+ onMount(t) {
32
+ let n = this.getItemElement();
33
+ if (n) {
34
+ let r = n.fileUrl, i = n.fileName || "";
35
+ r && e(t, {
36
+ href: r,
37
+ target: "_blank",
38
+ download: i || r.split("/").pop() || ""
39
+ });
40
+ }
41
+ }
42
+ };
43
+ //#endregion
44
+ export { r as default };