@ckeditor/ckeditor5-emoji 0.0.0-nightly-20250217.0 → 0.0.1

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 (406) hide show
  1. package/LICENSE.md +5 -16
  2. package/README.md +3 -30
  3. package/package.json +5 -58
  4. package/CHANGELOG.md +0 -4
  5. package/build/emoji.js +0 -5
  6. package/build/translations/af.js +0 -1
  7. package/build/translations/ar.js +0 -1
  8. package/build/translations/ast.js +0 -1
  9. package/build/translations/az.js +0 -1
  10. package/build/translations/bg.js +0 -1
  11. package/build/translations/bn.js +0 -1
  12. package/build/translations/bs.js +0 -1
  13. package/build/translations/ca.js +0 -1
  14. package/build/translations/cs.js +0 -1
  15. package/build/translations/da.js +0 -1
  16. package/build/translations/de-ch.js +0 -1
  17. package/build/translations/de.js +0 -1
  18. package/build/translations/el.js +0 -1
  19. package/build/translations/en-au.js +0 -1
  20. package/build/translations/en-gb.js +0 -1
  21. package/build/translations/eo.js +0 -1
  22. package/build/translations/es-co.js +0 -1
  23. package/build/translations/es.js +0 -1
  24. package/build/translations/et.js +0 -1
  25. package/build/translations/eu.js +0 -1
  26. package/build/translations/fa.js +0 -1
  27. package/build/translations/fi.js +0 -1
  28. package/build/translations/fr.js +0 -1
  29. package/build/translations/gl.js +0 -1
  30. package/build/translations/gu.js +0 -1
  31. package/build/translations/he.js +0 -1
  32. package/build/translations/hi.js +0 -1
  33. package/build/translations/hr.js +0 -1
  34. package/build/translations/hu.js +0 -1
  35. package/build/translations/hy.js +0 -1
  36. package/build/translations/id.js +0 -1
  37. package/build/translations/it.js +0 -1
  38. package/build/translations/ja.js +0 -1
  39. package/build/translations/jv.js +0 -1
  40. package/build/translations/kk.js +0 -1
  41. package/build/translations/km.js +0 -1
  42. package/build/translations/kn.js +0 -1
  43. package/build/translations/ko.js +0 -1
  44. package/build/translations/ku.js +0 -1
  45. package/build/translations/lt.js +0 -1
  46. package/build/translations/lv.js +0 -1
  47. package/build/translations/ms.js +0 -1
  48. package/build/translations/nb.js +0 -1
  49. package/build/translations/ne.js +0 -1
  50. package/build/translations/nl.js +0 -1
  51. package/build/translations/no.js +0 -1
  52. package/build/translations/oc.js +0 -1
  53. package/build/translations/pl.js +0 -1
  54. package/build/translations/pt-br.js +0 -1
  55. package/build/translations/pt.js +0 -1
  56. package/build/translations/ro.js +0 -1
  57. package/build/translations/ru.js +0 -1
  58. package/build/translations/si.js +0 -1
  59. package/build/translations/sk.js +0 -1
  60. package/build/translations/sl.js +0 -1
  61. package/build/translations/sq.js +0 -1
  62. package/build/translations/sr-latn.js +0 -1
  63. package/build/translations/sr.js +0 -1
  64. package/build/translations/sv.js +0 -1
  65. package/build/translations/th.js +0 -1
  66. package/build/translations/ti.js +0 -1
  67. package/build/translations/tk.js +0 -1
  68. package/build/translations/tr.js +0 -1
  69. package/build/translations/tt.js +0 -1
  70. package/build/translations/ug.js +0 -1
  71. package/build/translations/uk.js +0 -1
  72. package/build/translations/ur.js +0 -1
  73. package/build/translations/uz.js +0 -1
  74. package/build/translations/vi.js +0 -1
  75. package/build/translations/zh-cn.js +0 -1
  76. package/build/translations/zh.js +0 -1
  77. package/ckeditor5-metadata.json +0 -45
  78. package/dist/index-content.css +0 -4
  79. package/dist/index-editor.css +0 -111
  80. package/dist/index.css +0 -143
  81. package/dist/index.css.map +0 -1
  82. package/dist/index.js +0 -1698
  83. package/dist/index.js.map +0 -1
  84. package/dist/translations/af.d.ts +0 -8
  85. package/dist/translations/af.js +0 -5
  86. package/dist/translations/af.umd.js +0 -11
  87. package/dist/translations/ar.d.ts +0 -8
  88. package/dist/translations/ar.js +0 -5
  89. package/dist/translations/ar.umd.js +0 -11
  90. package/dist/translations/ast.d.ts +0 -8
  91. package/dist/translations/ast.js +0 -5
  92. package/dist/translations/ast.umd.js +0 -11
  93. package/dist/translations/az.d.ts +0 -8
  94. package/dist/translations/az.js +0 -5
  95. package/dist/translations/az.umd.js +0 -11
  96. package/dist/translations/bg.d.ts +0 -8
  97. package/dist/translations/bg.js +0 -5
  98. package/dist/translations/bg.umd.js +0 -11
  99. package/dist/translations/bn.d.ts +0 -8
  100. package/dist/translations/bn.js +0 -5
  101. package/dist/translations/bn.umd.js +0 -11
  102. package/dist/translations/bs.d.ts +0 -8
  103. package/dist/translations/bs.js +0 -5
  104. package/dist/translations/bs.umd.js +0 -11
  105. package/dist/translations/ca.d.ts +0 -8
  106. package/dist/translations/ca.js +0 -5
  107. package/dist/translations/ca.umd.js +0 -11
  108. package/dist/translations/cs.d.ts +0 -8
  109. package/dist/translations/cs.js +0 -5
  110. package/dist/translations/cs.umd.js +0 -11
  111. package/dist/translations/da.d.ts +0 -8
  112. package/dist/translations/da.js +0 -5
  113. package/dist/translations/da.umd.js +0 -11
  114. package/dist/translations/de-ch.d.ts +0 -8
  115. package/dist/translations/de-ch.js +0 -5
  116. package/dist/translations/de-ch.umd.js +0 -11
  117. package/dist/translations/de.d.ts +0 -8
  118. package/dist/translations/de.js +0 -5
  119. package/dist/translations/de.umd.js +0 -11
  120. package/dist/translations/el.d.ts +0 -8
  121. package/dist/translations/el.js +0 -5
  122. package/dist/translations/el.umd.js +0 -11
  123. package/dist/translations/en-au.d.ts +0 -8
  124. package/dist/translations/en-au.js +0 -5
  125. package/dist/translations/en-au.umd.js +0 -11
  126. package/dist/translations/en-gb.d.ts +0 -8
  127. package/dist/translations/en-gb.js +0 -5
  128. package/dist/translations/en-gb.umd.js +0 -11
  129. package/dist/translations/en.d.ts +0 -8
  130. package/dist/translations/en.js +0 -5
  131. package/dist/translations/en.umd.js +0 -11
  132. package/dist/translations/eo.d.ts +0 -8
  133. package/dist/translations/eo.js +0 -5
  134. package/dist/translations/eo.umd.js +0 -11
  135. package/dist/translations/es-co.d.ts +0 -8
  136. package/dist/translations/es-co.js +0 -5
  137. package/dist/translations/es-co.umd.js +0 -11
  138. package/dist/translations/es.d.ts +0 -8
  139. package/dist/translations/es.js +0 -5
  140. package/dist/translations/es.umd.js +0 -11
  141. package/dist/translations/et.d.ts +0 -8
  142. package/dist/translations/et.js +0 -5
  143. package/dist/translations/et.umd.js +0 -11
  144. package/dist/translations/eu.d.ts +0 -8
  145. package/dist/translations/eu.js +0 -5
  146. package/dist/translations/eu.umd.js +0 -11
  147. package/dist/translations/fa.d.ts +0 -8
  148. package/dist/translations/fa.js +0 -5
  149. package/dist/translations/fa.umd.js +0 -11
  150. package/dist/translations/fi.d.ts +0 -8
  151. package/dist/translations/fi.js +0 -5
  152. package/dist/translations/fi.umd.js +0 -11
  153. package/dist/translations/fr.d.ts +0 -8
  154. package/dist/translations/fr.js +0 -5
  155. package/dist/translations/fr.umd.js +0 -11
  156. package/dist/translations/gl.d.ts +0 -8
  157. package/dist/translations/gl.js +0 -5
  158. package/dist/translations/gl.umd.js +0 -11
  159. package/dist/translations/gu.d.ts +0 -8
  160. package/dist/translations/gu.js +0 -5
  161. package/dist/translations/gu.umd.js +0 -11
  162. package/dist/translations/he.d.ts +0 -8
  163. package/dist/translations/he.js +0 -5
  164. package/dist/translations/he.umd.js +0 -11
  165. package/dist/translations/hi.d.ts +0 -8
  166. package/dist/translations/hi.js +0 -5
  167. package/dist/translations/hi.umd.js +0 -11
  168. package/dist/translations/hr.d.ts +0 -8
  169. package/dist/translations/hr.js +0 -5
  170. package/dist/translations/hr.umd.js +0 -11
  171. package/dist/translations/hu.d.ts +0 -8
  172. package/dist/translations/hu.js +0 -5
  173. package/dist/translations/hu.umd.js +0 -11
  174. package/dist/translations/hy.d.ts +0 -8
  175. package/dist/translations/hy.js +0 -5
  176. package/dist/translations/hy.umd.js +0 -11
  177. package/dist/translations/id.d.ts +0 -8
  178. package/dist/translations/id.js +0 -5
  179. package/dist/translations/id.umd.js +0 -11
  180. package/dist/translations/it.d.ts +0 -8
  181. package/dist/translations/it.js +0 -5
  182. package/dist/translations/it.umd.js +0 -11
  183. package/dist/translations/ja.d.ts +0 -8
  184. package/dist/translations/ja.js +0 -5
  185. package/dist/translations/ja.umd.js +0 -11
  186. package/dist/translations/jv.d.ts +0 -8
  187. package/dist/translations/jv.js +0 -5
  188. package/dist/translations/jv.umd.js +0 -11
  189. package/dist/translations/kk.d.ts +0 -8
  190. package/dist/translations/kk.js +0 -5
  191. package/dist/translations/kk.umd.js +0 -11
  192. package/dist/translations/km.d.ts +0 -8
  193. package/dist/translations/km.js +0 -5
  194. package/dist/translations/km.umd.js +0 -11
  195. package/dist/translations/kn.d.ts +0 -8
  196. package/dist/translations/kn.js +0 -5
  197. package/dist/translations/kn.umd.js +0 -11
  198. package/dist/translations/ko.d.ts +0 -8
  199. package/dist/translations/ko.js +0 -5
  200. package/dist/translations/ko.umd.js +0 -11
  201. package/dist/translations/ku.d.ts +0 -8
  202. package/dist/translations/ku.js +0 -5
  203. package/dist/translations/ku.umd.js +0 -11
  204. package/dist/translations/lt.d.ts +0 -8
  205. package/dist/translations/lt.js +0 -5
  206. package/dist/translations/lt.umd.js +0 -11
  207. package/dist/translations/lv.d.ts +0 -8
  208. package/dist/translations/lv.js +0 -5
  209. package/dist/translations/lv.umd.js +0 -11
  210. package/dist/translations/ms.d.ts +0 -8
  211. package/dist/translations/ms.js +0 -5
  212. package/dist/translations/ms.umd.js +0 -11
  213. package/dist/translations/nb.d.ts +0 -8
  214. package/dist/translations/nb.js +0 -5
  215. package/dist/translations/nb.umd.js +0 -11
  216. package/dist/translations/ne.d.ts +0 -8
  217. package/dist/translations/ne.js +0 -5
  218. package/dist/translations/ne.umd.js +0 -11
  219. package/dist/translations/nl.d.ts +0 -8
  220. package/dist/translations/nl.js +0 -5
  221. package/dist/translations/nl.umd.js +0 -11
  222. package/dist/translations/no.d.ts +0 -8
  223. package/dist/translations/no.js +0 -5
  224. package/dist/translations/no.umd.js +0 -11
  225. package/dist/translations/oc.d.ts +0 -8
  226. package/dist/translations/oc.js +0 -5
  227. package/dist/translations/oc.umd.js +0 -11
  228. package/dist/translations/pl.d.ts +0 -8
  229. package/dist/translations/pl.js +0 -5
  230. package/dist/translations/pl.umd.js +0 -11
  231. package/dist/translations/pt-br.d.ts +0 -8
  232. package/dist/translations/pt-br.js +0 -5
  233. package/dist/translations/pt-br.umd.js +0 -11
  234. package/dist/translations/pt.d.ts +0 -8
  235. package/dist/translations/pt.js +0 -5
  236. package/dist/translations/pt.umd.js +0 -11
  237. package/dist/translations/ro.d.ts +0 -8
  238. package/dist/translations/ro.js +0 -5
  239. package/dist/translations/ro.umd.js +0 -11
  240. package/dist/translations/ru.d.ts +0 -8
  241. package/dist/translations/ru.js +0 -5
  242. package/dist/translations/ru.umd.js +0 -11
  243. package/dist/translations/si.d.ts +0 -8
  244. package/dist/translations/si.js +0 -5
  245. package/dist/translations/si.umd.js +0 -11
  246. package/dist/translations/sk.d.ts +0 -8
  247. package/dist/translations/sk.js +0 -5
  248. package/dist/translations/sk.umd.js +0 -11
  249. package/dist/translations/sl.d.ts +0 -8
  250. package/dist/translations/sl.js +0 -5
  251. package/dist/translations/sl.umd.js +0 -11
  252. package/dist/translations/sq.d.ts +0 -8
  253. package/dist/translations/sq.js +0 -5
  254. package/dist/translations/sq.umd.js +0 -11
  255. package/dist/translations/sr-latn.d.ts +0 -8
  256. package/dist/translations/sr-latn.js +0 -5
  257. package/dist/translations/sr-latn.umd.js +0 -11
  258. package/dist/translations/sr.d.ts +0 -8
  259. package/dist/translations/sr.js +0 -5
  260. package/dist/translations/sr.umd.js +0 -11
  261. package/dist/translations/sv.d.ts +0 -8
  262. package/dist/translations/sv.js +0 -5
  263. package/dist/translations/sv.umd.js +0 -11
  264. package/dist/translations/th.d.ts +0 -8
  265. package/dist/translations/th.js +0 -5
  266. package/dist/translations/th.umd.js +0 -11
  267. package/dist/translations/ti.d.ts +0 -8
  268. package/dist/translations/ti.js +0 -5
  269. package/dist/translations/ti.umd.js +0 -11
  270. package/dist/translations/tk.d.ts +0 -8
  271. package/dist/translations/tk.js +0 -5
  272. package/dist/translations/tk.umd.js +0 -11
  273. package/dist/translations/tr.d.ts +0 -8
  274. package/dist/translations/tr.js +0 -5
  275. package/dist/translations/tr.umd.js +0 -11
  276. package/dist/translations/tt.d.ts +0 -8
  277. package/dist/translations/tt.js +0 -5
  278. package/dist/translations/tt.umd.js +0 -11
  279. package/dist/translations/ug.d.ts +0 -8
  280. package/dist/translations/ug.js +0 -5
  281. package/dist/translations/ug.umd.js +0 -11
  282. package/dist/translations/uk.d.ts +0 -8
  283. package/dist/translations/uk.js +0 -5
  284. package/dist/translations/uk.umd.js +0 -11
  285. package/dist/translations/ur.d.ts +0 -8
  286. package/dist/translations/ur.js +0 -5
  287. package/dist/translations/ur.umd.js +0 -11
  288. package/dist/translations/uz.d.ts +0 -8
  289. package/dist/translations/uz.js +0 -5
  290. package/dist/translations/uz.umd.js +0 -11
  291. package/dist/translations/vi.d.ts +0 -8
  292. package/dist/translations/vi.js +0 -5
  293. package/dist/translations/vi.umd.js +0 -11
  294. package/dist/translations/zh-cn.d.ts +0 -8
  295. package/dist/translations/zh-cn.js +0 -5
  296. package/dist/translations/zh-cn.umd.js +0 -11
  297. package/dist/translations/zh.d.ts +0 -8
  298. package/dist/translations/zh.js +0 -5
  299. package/dist/translations/zh.umd.js +0 -11
  300. package/lang/contexts.json +0 -24
  301. package/lang/translations/af.po +0 -100
  302. package/lang/translations/ar.po +0 -100
  303. package/lang/translations/ast.po +0 -100
  304. package/lang/translations/az.po +0 -100
  305. package/lang/translations/bg.po +0 -100
  306. package/lang/translations/bn.po +0 -100
  307. package/lang/translations/bs.po +0 -100
  308. package/lang/translations/ca.po +0 -100
  309. package/lang/translations/cs.po +0 -100
  310. package/lang/translations/da.po +0 -100
  311. package/lang/translations/de-ch.po +0 -100
  312. package/lang/translations/de.po +0 -100
  313. package/lang/translations/el.po +0 -100
  314. package/lang/translations/en-au.po +0 -100
  315. package/lang/translations/en-gb.po +0 -100
  316. package/lang/translations/en.po +0 -100
  317. package/lang/translations/eo.po +0 -100
  318. package/lang/translations/es-co.po +0 -100
  319. package/lang/translations/es.po +0 -100
  320. package/lang/translations/et.po +0 -100
  321. package/lang/translations/eu.po +0 -100
  322. package/lang/translations/fa.po +0 -100
  323. package/lang/translations/fi.po +0 -100
  324. package/lang/translations/fr.po +0 -100
  325. package/lang/translations/gl.po +0 -100
  326. package/lang/translations/gu.po +0 -100
  327. package/lang/translations/he.po +0 -100
  328. package/lang/translations/hi.po +0 -100
  329. package/lang/translations/hr.po +0 -100
  330. package/lang/translations/hu.po +0 -100
  331. package/lang/translations/hy.po +0 -100
  332. package/lang/translations/id.po +0 -100
  333. package/lang/translations/it.po +0 -100
  334. package/lang/translations/ja.po +0 -100
  335. package/lang/translations/jv.po +0 -100
  336. package/lang/translations/kk.po +0 -100
  337. package/lang/translations/km.po +0 -100
  338. package/lang/translations/kn.po +0 -100
  339. package/lang/translations/ko.po +0 -100
  340. package/lang/translations/ku.po +0 -100
  341. package/lang/translations/lt.po +0 -100
  342. package/lang/translations/lv.po +0 -100
  343. package/lang/translations/ms.po +0 -100
  344. package/lang/translations/nb.po +0 -100
  345. package/lang/translations/ne.po +0 -100
  346. package/lang/translations/nl.po +0 -100
  347. package/lang/translations/no.po +0 -100
  348. package/lang/translations/oc.po +0 -100
  349. package/lang/translations/pl.po +0 -100
  350. package/lang/translations/pt-br.po +0 -100
  351. package/lang/translations/pt.po +0 -100
  352. package/lang/translations/ro.po +0 -100
  353. package/lang/translations/ru.po +0 -100
  354. package/lang/translations/si.po +0 -100
  355. package/lang/translations/sk.po +0 -100
  356. package/lang/translations/sl.po +0 -100
  357. package/lang/translations/sq.po +0 -100
  358. package/lang/translations/sr-latn.po +0 -100
  359. package/lang/translations/sr.po +0 -100
  360. package/lang/translations/sv.po +0 -100
  361. package/lang/translations/th.po +0 -100
  362. package/lang/translations/ti.po +0 -100
  363. package/lang/translations/tk.po +0 -100
  364. package/lang/translations/tr.po +0 -100
  365. package/lang/translations/tt.po +0 -100
  366. package/lang/translations/ug.po +0 -100
  367. package/lang/translations/uk.po +0 -100
  368. package/lang/translations/ur.po +0 -100
  369. package/lang/translations/uz.po +0 -100
  370. package/lang/translations/vi.po +0 -100
  371. package/lang/translations/zh-cn.po +0 -100
  372. package/lang/translations/zh.po +0 -100
  373. package/src/augmentation.d.ts +0 -25
  374. package/src/augmentation.js +0 -5
  375. package/src/emoji.d.ts +0 -32
  376. package/src/emoji.js +0 -38
  377. package/src/emojicommand.d.ts +0 -24
  378. package/src/emojicommand.js +0 -33
  379. package/src/emojiconfig.d.ts +0 -98
  380. package/src/emojiconfig.js +0 -5
  381. package/src/emojimention.d.ts +0 -75
  382. package/src/emojimention.js +0 -210
  383. package/src/emojipicker.d.ts +0 -97
  384. package/src/emojipicker.js +0 -255
  385. package/src/emojirepository.d.ts +0 -169
  386. package/src/emojirepository.js +0 -290
  387. package/src/emojiutils.d.ts +0 -58
  388. package/src/emojiutils.js +0 -141
  389. package/src/index.d.ts +0 -15
  390. package/src/index.js +0 -14
  391. package/src/ui/emojicategoriesview.d.ts +0 -68
  392. package/src/ui/emojicategoriesview.js +0 -131
  393. package/src/ui/emojigridview.d.ts +0 -140
  394. package/src/ui/emojigridview.js +0 -183
  395. package/src/ui/emojipickerview.d.ts +0 -91
  396. package/src/ui/emojipickerview.js +0 -173
  397. package/src/ui/emojisearchview.d.ts +0 -51
  398. package/src/ui/emojisearchview.js +0 -89
  399. package/src/ui/emojitoneview.d.ts +0 -46
  400. package/src/ui/emojitoneview.js +0 -89
  401. package/src/utils/isemojisupported.d.ts +0 -11
  402. package/src/utils/isemojisupported.js +0 -68
  403. package/theme/emojicategories.css +0 -29
  404. package/theme/emojigrid.css +0 -55
  405. package/theme/emojipicker.css +0 -32
  406. package/theme/emojitone.css +0 -21
@@ -1,210 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module emoji/emojimention
7
- */
8
- import { logWarning } from 'ckeditor5/src/utils.js';
9
- import { Plugin } from 'ckeditor5/src/core.js';
10
- import { Typing } from 'ckeditor5/src/typing.js';
11
- import EmojiRepository from './emojirepository.js';
12
- const EMOJI_MENTION_MARKER = ':';
13
- const EMOJI_SHOW_ALL_OPTION_ID = ':__EMOJI_SHOW_ALL:';
14
- const EMOJI_HINT_OPTION_ID = ':__EMOJI_HINT:';
15
- /**
16
- * The emoji mention plugin.
17
- *
18
- * Introduces the autocomplete of emojis while typing.
19
- */
20
- export default class EmojiMention extends Plugin {
21
- /**
22
- * @inheritDoc
23
- */
24
- static get requires() {
25
- return [EmojiRepository, Typing, 'Mention'];
26
- }
27
- /**
28
- * @inheritDoc
29
- */
30
- static get pluginName() {
31
- return 'EmojiMention';
32
- }
33
- /**
34
- * @inheritDoc
35
- */
36
- static get isOfficialPlugin() {
37
- return true;
38
- }
39
- /**
40
- * @inheritDoc
41
- */
42
- constructor(editor) {
43
- super(editor);
44
- this.editor.config.define('emoji', {
45
- dropdownLimit: 6
46
- });
47
- this._emojiDropdownLimit = editor.config.get('emoji.dropdownLimit');
48
- this._skinTone = editor.config.get('emoji.skinTone');
49
- this._setupMentionConfiguration(editor);
50
- }
51
- /**
52
- * Initializes the configuration for emojis in the mention feature.
53
- * If the marker used by emoji mention is already registered, it displays a warning.
54
- * If emoji mention configuration is detected, it does not register it for a second time.
55
- */
56
- _setupMentionConfiguration(editor) {
57
- const mergeFieldsPrefix = editor.config.get('mergeFields.prefix');
58
- const mentionFeedsConfigs = editor.config.get('mention.feeds');
59
- const isEmojiMarkerUsedByMergeFields = mergeFieldsPrefix ? mergeFieldsPrefix[0] === EMOJI_MENTION_MARKER : false;
60
- const isEmojiMarkerUsedByMention = mentionFeedsConfigs
61
- .filter(config => !config._isEmojiMarker)
62
- .some(config => config.marker === EMOJI_MENTION_MARKER);
63
- if (isEmojiMarkerUsedByMention || isEmojiMarkerUsedByMergeFields) {
64
- /**
65
- * The `marker` in the `emoji` config is already used by other plugin configuration.
66
- *
67
- * @error emoji-config-marker-already-used
68
- * @param {string} marker Used marker.
69
- */
70
- logWarning('emoji-config-marker-already-used', { marker: EMOJI_MENTION_MARKER });
71
- return;
72
- }
73
- const isEmojiConfigDefined = mentionFeedsConfigs.some(config => config._isEmojiMarker);
74
- if (isEmojiConfigDefined) {
75
- return;
76
- }
77
- const emojiMentionFeedConfig = {
78
- _isEmojiMarker: true,
79
- marker: EMOJI_MENTION_MARKER,
80
- dropdownLimit: this._emojiDropdownLimit,
81
- itemRenderer: this._customItemRendererFactory(this.editor.t),
82
- feed: this._queryEmojiCallbackFactory()
83
- };
84
- this.editor.config.set('mention.feeds', [...mentionFeedsConfigs, emojiMentionFeedConfig]);
85
- }
86
- /**
87
- * @inheritDoc
88
- */
89
- async init() {
90
- const editor = this.editor;
91
- this.emojiPickerPlugin = editor.plugins.has('EmojiPicker') ? editor.plugins.get('EmojiPicker') : null;
92
- this.emojiRepositoryPlugin = editor.plugins.get('EmojiRepository');
93
- this._isEmojiRepositoryAvailable = await this.emojiRepositoryPlugin.isReady();
94
- // Override the `mention` command listener if the emoji repository is ready.
95
- if (this._isEmojiRepositoryAvailable) {
96
- editor.once('ready', this._overrideMentionExecuteListener.bind(this));
97
- }
98
- }
99
- /**
100
- * Returns the `itemRenderer()` callback for mention config.
101
- */
102
- _customItemRendererFactory(t) {
103
- return (item) => {
104
- const itemElement = document.createElement('button');
105
- itemElement.classList.add('ck');
106
- itemElement.classList.add('ck-button');
107
- itemElement.classList.add('ck-button_with-text');
108
- itemElement.id = `mention-list-item-id${item.id.slice(0, -1)}`;
109
- itemElement.type = 'button';
110
- itemElement.tabIndex = -1;
111
- const labelElement = document.createElement('span');
112
- labelElement.classList.add('ck');
113
- labelElement.classList.add('ck-button__label');
114
- itemElement.appendChild(labelElement);
115
- if (item.id === EMOJI_HINT_OPTION_ID) {
116
- itemElement.classList.add('ck-list-item-button');
117
- itemElement.classList.add('ck-disabled');
118
- labelElement.textContent = t('Keep on typing to see the emoji.');
119
- }
120
- else if (item.id === EMOJI_SHOW_ALL_OPTION_ID) {
121
- labelElement.textContent = t('Show all emoji...');
122
- }
123
- else {
124
- labelElement.textContent = `${item.text} ${item.id}`;
125
- }
126
- return itemElement;
127
- };
128
- }
129
- /**
130
- * Overrides the default mention execute listener to insert an emoji as plain text instead.
131
- */
132
- _overrideMentionExecuteListener() {
133
- const editor = this.editor;
134
- editor.commands.get('mention').on('execute', (event, data) => {
135
- const eventData = data[0];
136
- // Ignore non-emoji auto-complete actions.
137
- if (eventData.marker !== EMOJI_MENTION_MARKER) {
138
- return;
139
- }
140
- // Do not propagate the event.
141
- event.stop();
142
- // Do nothing when executing after selecting a hint message.
143
- if (eventData.mention.id === EMOJI_HINT_OPTION_ID) {
144
- return;
145
- }
146
- // Trigger the picker UI.
147
- if (eventData.mention.id === EMOJI_SHOW_ALL_OPTION_ID) {
148
- const text = [...eventData.range.getItems()]
149
- .filter(item => item.is('$textProxy'))
150
- .map(item => item.data)
151
- .reduce((result, text) => result + text, '');
152
- editor.model.change(writer => {
153
- editor.model.deleteContent(writer.createSelection(eventData.range));
154
- });
155
- const emojiPickerPlugin = this.emojiPickerPlugin;
156
- emojiPickerPlugin.showUI(text.slice(1));
157
- setTimeout(() => {
158
- emojiPickerPlugin.emojiPickerView.focus();
159
- });
160
- }
161
- // Or insert the emoji to editor.
162
- else {
163
- editor.execute('insertText', {
164
- text: eventData.mention.text,
165
- range: eventData.range
166
- });
167
- }
168
- }, { priority: 'high' });
169
- }
170
- /**
171
- * Returns the `feed()` callback for mention config.
172
- */
173
- _queryEmojiCallbackFactory() {
174
- return (searchQuery) => {
175
- // Do not show anything when a query starts with a space.
176
- if (searchQuery.startsWith(' ')) {
177
- return [];
178
- }
179
- // Do not show anything when a query starts with a marker character.
180
- if (searchQuery.startsWith(EMOJI_MENTION_MARKER)) {
181
- return [];
182
- }
183
- // If the repository plugin is not available, return an empty feed to avoid confusion. See: #17842.
184
- if (!this._isEmojiRepositoryAvailable) {
185
- return [];
186
- }
187
- const emojis = this.emojiRepositoryPlugin.getEmojiByQuery(searchQuery)
188
- .map(emoji => {
189
- let text = emoji.skins[this._skinTone] || emoji.skins.default;
190
- if (this.emojiPickerPlugin) {
191
- text = emoji.skins[this.emojiPickerPlugin.skinTone] || emoji.skins.default;
192
- }
193
- return {
194
- id: `:${emoji.annotation}:`,
195
- text
196
- };
197
- });
198
- if (!this.emojiPickerPlugin) {
199
- return emojis.slice(0, this._emojiDropdownLimit);
200
- }
201
- const actionItem = {
202
- id: searchQuery.length > 1 ? EMOJI_SHOW_ALL_OPTION_ID : EMOJI_HINT_OPTION_ID
203
- };
204
- return [
205
- ...emojis.slice(0, this._emojiDropdownLimit - 1),
206
- actionItem
207
- ];
208
- };
209
- }
210
- }
@@ -1,97 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module emoji/emojipicker
7
- */
8
- import { ContextualBalloon, Dialog } from 'ckeditor5/src/ui.js';
9
- import { Plugin } from 'ckeditor5/src/core.js';
10
- import { Typing } from 'ckeditor5/src/typing.js';
11
- import EmojiRepository from './emojirepository.js';
12
- import EmojiPickerView from './ui/emojipickerview.js';
13
- import type { SkinToneId } from './emojiconfig.js';
14
- import '../theme/emojipicker.css';
15
- /**
16
- * The emoji picker plugin.
17
- *
18
- * Introduces the `'emoji'` dropdown.
19
- */
20
- export default class EmojiPicker extends Plugin {
21
- /**
22
- * The actions view displayed inside the balloon.
23
- */
24
- emojiPickerView: EmojiPickerView | undefined;
25
- /**
26
- * The contextual balloon plugin instance.
27
- */
28
- balloonPlugin: ContextualBalloon;
29
- /**
30
- * An instance of the {@link module:emoji/emojirepository~EmojiRepository} plugin.
31
- */
32
- emojiRepositoryPlugin: EmojiRepository;
33
- /**
34
- * @inheritDoc
35
- */
36
- static get requires(): readonly [typeof EmojiRepository, typeof ContextualBalloon, typeof Dialog, typeof Typing];
37
- /**
38
- * @inheritDoc
39
- */
40
- static get pluginName(): "EmojiPicker";
41
- /**
42
- * @inheritDoc
43
- */
44
- static get isOfficialPlugin(): true;
45
- /**
46
- * @inheritDoc
47
- */
48
- init(): Promise<void>;
49
- /**
50
- * @inheritDoc
51
- */
52
- destroy(): void;
53
- /**
54
- * Represents an active skin tone. Its value depends on the emoji UI plugin.
55
- *
56
- * Before opening the UI for the first time, the returned value is read from the editor configuration.
57
- * Otherwise, it reflects the user's intention.
58
- */
59
- get skinTone(): SkinToneId;
60
- /**
61
- * Displays the balloon with the emoji picker.
62
- *
63
- * @param [searchValue=''] A default query used to filer the grid when opening the UI.
64
- */
65
- showUI(searchValue?: string): void;
66
- /**
67
- * Creates a button for toolbar and menu bar that will show the emoji dialog.
68
- */
69
- private _createButton;
70
- /**
71
- * Creates an instance of the `EmojiPickerView` class that represents an emoji balloon.
72
- */
73
- private _createEmojiPickerView;
74
- /**
75
- * Hides the balloon with the emoji picker.
76
- */
77
- private _hideUI;
78
- /**
79
- * Registers converters.
80
- */
81
- private _setupConversion;
82
- /**
83
- * Returns positioning options for the {@link #balloonPlugin}. They control the way the balloon is attached
84
- * to the target element or selection.
85
- */
86
- private _getBalloonPositionData;
87
- /**
88
- * Displays a fake visual selection when the contextual balloon is displayed.
89
- *
90
- * This adds an 'emoji-picker' marker into the document that is rendered as a highlight on selected text fragment.
91
- */
92
- private _showFakeVisualSelection;
93
- /**
94
- * Hides the fake visual selection.
95
- */
96
- private _hideFakeVisualSelection;
97
- }
@@ -1,255 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module emoji/emojipicker
7
- */
8
- import { ButtonView, clickOutsideHandler, ContextualBalloon, Dialog, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';
9
- import { icons, Plugin } from 'ckeditor5/src/core.js';
10
- import { Typing } from 'ckeditor5/src/typing.js';
11
- import EmojiCommand from './emojicommand.js';
12
- import EmojiRepository from './emojirepository.js';
13
- import EmojiPickerView from './ui/emojipickerview.js';
14
- import '../theme/emojipicker.css';
15
- const VISUAL_SELECTION_MARKER_NAME = 'emoji-picker';
16
- /**
17
- * The emoji picker plugin.
18
- *
19
- * Introduces the `'emoji'` dropdown.
20
- */
21
- export default class EmojiPicker extends Plugin {
22
- /**
23
- * @inheritDoc
24
- */
25
- static get requires() {
26
- return [EmojiRepository, ContextualBalloon, Dialog, Typing];
27
- }
28
- /**
29
- * @inheritDoc
30
- */
31
- static get pluginName() {
32
- return 'EmojiPicker';
33
- }
34
- /**
35
- * @inheritDoc
36
- */
37
- static get isOfficialPlugin() {
38
- return true;
39
- }
40
- /**
41
- * @inheritDoc
42
- */
43
- async init() {
44
- const editor = this.editor;
45
- this.balloonPlugin = editor.plugins.get('ContextualBalloon');
46
- this.emojiRepositoryPlugin = editor.plugins.get('EmojiRepository');
47
- // Skip registering a button in the toolbar and list item in the menu bar if the emoji repository is not ready.
48
- if (!await this.emojiRepositoryPlugin.isReady()) {
49
- return;
50
- }
51
- const command = new EmojiCommand(editor);
52
- editor.commands.add('emoji', command);
53
- editor.ui.componentFactory.add('emoji', () => {
54
- const button = this._createButton(ButtonView, command);
55
- button.set({
56
- tooltip: true
57
- });
58
- return button;
59
- });
60
- editor.ui.componentFactory.add('menuBar:emoji', () => {
61
- return this._createButton(MenuBarMenuListItemButtonView, command);
62
- });
63
- this._setupConversion();
64
- }
65
- /**
66
- * @inheritDoc
67
- */
68
- destroy() {
69
- super.destroy();
70
- if (this.emojiPickerView) {
71
- this.emojiPickerView.destroy();
72
- }
73
- }
74
- /**
75
- * Represents an active skin tone. Its value depends on the emoji UI plugin.
76
- *
77
- * Before opening the UI for the first time, the returned value is read from the editor configuration.
78
- * Otherwise, it reflects the user's intention.
79
- */
80
- get skinTone() {
81
- if (!this.emojiPickerView) {
82
- return this.editor.config.get('emoji.skinTone');
83
- }
84
- return this.emojiPickerView.gridView.skinTone;
85
- }
86
- /**
87
- * Displays the balloon with the emoji picker.
88
- *
89
- * @param [searchValue=''] A default query used to filer the grid when opening the UI.
90
- */
91
- showUI(searchValue = '') {
92
- // Show visual selection on a text when the contextual balloon is displayed.
93
- // See #17654.
94
- this._showFakeVisualSelection();
95
- if (!this.emojiPickerView) {
96
- this.emojiPickerView = this._createEmojiPickerView();
97
- }
98
- if (searchValue) {
99
- this.emojiPickerView.searchView.setInputValue(searchValue);
100
- }
101
- this.emojiPickerView.searchView.search(searchValue);
102
- if (!this.balloonPlugin.hasView(this.emojiPickerView)) {
103
- this.balloonPlugin.add({
104
- view: this.emojiPickerView,
105
- position: this._getBalloonPositionData()
106
- });
107
- }
108
- this.emojiPickerView.focus();
109
- }
110
- /**
111
- * Creates a button for toolbar and menu bar that will show the emoji dialog.
112
- */
113
- _createButton(ViewClass, command) {
114
- const buttonView = new ViewClass(this.editor.locale);
115
- const t = this.editor.locale.t;
116
- buttonView.bind('isEnabled').to(command, 'isEnabled');
117
- buttonView.set({
118
- label: t('Emoji'),
119
- icon: icons.emoji,
120
- isToggleable: true
121
- });
122
- buttonView.on('execute', () => {
123
- this.showUI();
124
- });
125
- return buttonView;
126
- }
127
- /**
128
- * Creates an instance of the `EmojiPickerView` class that represents an emoji balloon.
129
- */
130
- _createEmojiPickerView() {
131
- const emojiPickerView = new EmojiPickerView(this.editor.locale, {
132
- emojiCategories: this.emojiRepositoryPlugin.getEmojiCategories(),
133
- skinTone: this.editor.config.get('emoji.skinTone'),
134
- skinTones: this.emojiRepositoryPlugin.getSkinTones(),
135
- getEmojiByQuery: (query) => {
136
- return this.emojiRepositoryPlugin.getEmojiByQuery(query);
137
- }
138
- });
139
- // Insert an emoji on a tile click.
140
- this.listenTo(emojiPickerView.gridView, 'execute', (evt, data) => {
141
- const editor = this.editor;
142
- const textToInsert = data.emoji;
143
- this._hideUI();
144
- editor.execute('insertText', { text: textToInsert });
145
- });
146
- // Update the balloon position when layout is changed.
147
- this.listenTo(emojiPickerView, 'update', () => {
148
- if (this.balloonPlugin.visibleView === emojiPickerView) {
149
- this.balloonPlugin.updatePosition();
150
- }
151
- });
152
- // Close the panel on `Esc` key press when the **actions have focus**.
153
- emojiPickerView.keystrokes.set('Esc', (data, cancel) => {
154
- this._hideUI();
155
- cancel();
156
- });
157
- // Close the dialog when clicking outside of it.
158
- clickOutsideHandler({
159
- emitter: emojiPickerView,
160
- contextElements: [this.balloonPlugin.view.element],
161
- callback: () => this._hideUI(),
162
- activator: () => this.balloonPlugin.visibleView === emojiPickerView
163
- });
164
- return emojiPickerView;
165
- }
166
- /**
167
- * Hides the balloon with the emoji picker.
168
- */
169
- _hideUI() {
170
- this.balloonPlugin.remove(this.emojiPickerView);
171
- this.emojiPickerView.searchView.setInputValue('');
172
- this.editor.editing.view.focus();
173
- this._hideFakeVisualSelection();
174
- }
175
- /**
176
- * Registers converters.
177
- */
178
- _setupConversion() {
179
- const editor = this.editor;
180
- // Renders a fake visual selection marker on an expanded selection.
181
- editor.conversion.for('editingDowncast').markerToHighlight({
182
- model: VISUAL_SELECTION_MARKER_NAME,
183
- view: {
184
- classes: ['ck-fake-emoji-selection']
185
- }
186
- });
187
- // Renders a fake visual selection marker on a collapsed selection.
188
- editor.conversion.for('editingDowncast').markerToElement({
189
- model: VISUAL_SELECTION_MARKER_NAME,
190
- view: (data, { writer }) => {
191
- if (!data.markerRange.isCollapsed) {
192
- return null;
193
- }
194
- const markerElement = writer.createUIElement('span');
195
- writer.addClass(['ck-fake-emoji-selection', 'ck-fake-emoji-selection_collapsed'], markerElement);
196
- return markerElement;
197
- }
198
- });
199
- }
200
- /**
201
- * Returns positioning options for the {@link #balloonPlugin}. They control the way the balloon is attached
202
- * to the target element or selection.
203
- */
204
- _getBalloonPositionData() {
205
- const view = this.editor.editing.view;
206
- const viewDocument = view.document;
207
- // Set a target position by converting view selection range to DOM.
208
- const target = () => view.domConverter.viewRangeToDom(viewDocument.selection.getFirstRange());
209
- return {
210
- target
211
- };
212
- }
213
- /**
214
- * Displays a fake visual selection when the contextual balloon is displayed.
215
- *
216
- * This adds an 'emoji-picker' marker into the document that is rendered as a highlight on selected text fragment.
217
- */
218
- _showFakeVisualSelection() {
219
- const model = this.editor.model;
220
- model.change(writer => {
221
- const range = model.document.selection.getFirstRange();
222
- if (model.markers.has(VISUAL_SELECTION_MARKER_NAME)) {
223
- writer.updateMarker(VISUAL_SELECTION_MARKER_NAME, { range });
224
- }
225
- else {
226
- if (range.start.isAtEnd) {
227
- const startPosition = range.start.getLastMatchingPosition(({ item }) => !model.schema.isContent(item), { boundaries: range });
228
- writer.addMarker(VISUAL_SELECTION_MARKER_NAME, {
229
- usingOperation: false,
230
- affectsData: false,
231
- range: writer.createRange(startPosition, range.end)
232
- });
233
- }
234
- else {
235
- writer.addMarker(VISUAL_SELECTION_MARKER_NAME, {
236
- usingOperation: false,
237
- affectsData: false,
238
- range
239
- });
240
- }
241
- }
242
- });
243
- }
244
- /**
245
- * Hides the fake visual selection.
246
- */
247
- _hideFakeVisualSelection() {
248
- const model = this.editor.model;
249
- if (model.markers.has(VISUAL_SELECTION_MARKER_NAME)) {
250
- model.change(writer => {
251
- writer.removeMarker(VISUAL_SELECTION_MARKER_NAME);
252
- });
253
- }
254
- }
255
- }